diff --git a/dist/preview release/babylon.js b/dist/preview release/babylon.js index 0db2de0224b..3102e95f64d 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,this),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;s=65536)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("undefined"!=typeof HTMLElement&&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("undefined"!=typeof HTMLElement&&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)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 e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(var t=0;t0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._bindedRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._bindedRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},e.prototype._queueNewFrame=function(t,i){return e.QueueNewFrame(t,i)},e.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._bindedRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._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;i=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},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||ArrayBuffer.isView(l)||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&&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,"a",function(){return n}),i.d(t,"d",function(){return r}),i.d(t,"b",function(){return o}),i.d(t,"c",function(){return a});var n=function(){function e(e,t,i,n){void 0===t&&(t=!1),this.initalize(e,t,i,n)}return e.prototype.initalize=function(e,t,i,n){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this},e}(),r=function(){return function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}}(),o=function(){function e(){}return e.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e0},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 s}),i.d(t,"b",function(){return c}),i.d(t,"c",function(){return l});var n=i(16),r=i(29),o=i(38),a=i(12),s=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.r=e,this.g=t,this.b=i}return e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},e.prototype.getClassName=function(){return"Color3"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*e^(255*this.g|0))^(255*this.b|0)},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,this},e.prototype.toColor4=function(e){return void 0===e&&(e=1),new c(this.r,this.g,this.b,e)},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b)},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,this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},e.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t)},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*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),this},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b)},e.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b)},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,this},e.prototype.clone=function(){return new e(this.r,this.g,this.b)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},e.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0;return"#"+n.a.ToHex(e)+n.a.ToHex(t)+n.a.ToHex(i)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toHSV=function(){var t=new e;return this.toHSVToRef(t),t},e.prototype.toHSVToRef=function(e){var t=this.r,i=this.g,n=this.b,r=Math.max(t,i,n),o=Math.min(t,i,n),a=0,s=0,c=r,l=r-o;0!==r&&(s=l/r),r!=o&&(r==t?(a=(i-n)/l,i=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;n>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&&r.a.IsNavigatorAvailable()&&!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 s});var n=i(0),r=i(4),o=i(21),a=i(11),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,l){void 0===s&&(s=!1),void 0===l&&(l=!1);var u=i.toString(),h=t.getScaledIntensity();l||t._uniformBuffer.bindToEffect(o,"Light"+u),e.BindLightProperties(t,o,i),t.diffuse.scaleToRef(h,c.c.Color3[0]),t._uniformBuffer.updateColor4("vLightDiffuse",c.c.Color3[0],s?t.radius:t.range,u),a&&(t.specular.scaleToRef(h,c.c.Color3[1]),t._uniformBuffer.updateColor3("vLightSpecular",c.c.Color3[1],u)),n.shadowsEnabled&&this.BindLightShadow(t,r,u,o),t._uniformBuffer.update()},e.BindLights=function(e,t,i,n,r,o,a){void 0===r&&(r=4),void 0===o&&(o=!1),void 0===a&&(a=!1);for(var s=Math.min(t.lightSources.length,r),c=0;c-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=1.401298e-45);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(11),l=i(4),u=i(35),h=i(6),d=i(68),f=i(78),p=i(15),_=i(9),m=i(12),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(98),i(99),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(100),i(101),i(139),i(111),i(102),i(115),i(103),i(140),i(141),i(132),i(133),i(116);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(112),i(117),i(89),i(90),i(91),i(74),i(75),i(143),i(104),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){var s=o._areLightsDisposed;o.markAsProcessed();var c=new h.c;o.REFLECTION&&c.addFallback(0,"REFLECTION"),o.SPECULAR&&c.addFallback(0,"SPECULAR"),o.BUMP&&c.addFallback(0,"BUMP"),o.PARALLAX&&c.addFallback(1,"PARALLAX"),o.PARALLAXOCCLUSION&&c.addFallback(0,"PARALLAXOCCLUSION"),o.SPECULAROVERALPHA&&c.addFallback(0,"SPECULAROVERALPHA"),o.FOG&&c.addFallback(1,"FOG"),o.POINTSIZE&&c.addFallback(0,"POINTSIZE"),o.LOGARITHMICDEPTH&&c.addFallback(0,"LOGARITHMICDEPTH"),p.a.HandleFallbacksForShadows(o,c,this._maxSimultaneousLights),o.SPECULARTERM&&c.addFallback(0,"SPECULARTERM"),o.DIFFUSEFRESNEL&&c.addFallback(1,"DIFFUSEFRESNEL"),o.OPACITYFRESNEL&&c.addFallback(2,"OPACITYFRESNEL"),o.REFLECTIONFRESNEL&&c.addFallback(3,"REFLECTIONFRESNEL"),o.EMISSIVEFRESNEL&&c.addFallback(4,"EMISSIVEFRESNEL"),o.FRESNEL&&c.addFallback(4,"FRESNEL"),o.MULTIVIEW&&c.addFallback(0,"MULTIVIEW");var d=[l.b.PositionKind];o.NORMAL&&d.push(l.b.NormalKind),o.UV1&&d.push(l.b.UVKind),o.UV2&&d.push(l.b.UV2Kind),o.VERTEXCOLOR&&d.push(l.b.ColorKind),p.a.PrepareAttributesForBones(d,e,o,c),p.a.PrepareAttributesForInstances(d,o),p.a.PrepareAttributesForMorphTargets(d,e,o);var f="default",m=["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"],g=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler"],v=["Material","Scene"];u.a&&(u.a.PrepareUniforms(m,o),u.a.PrepareSamplers(g,o)),p.a.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:v,samplers:g,defines:o,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(f=this.customShaderNameResolve(f,m,v,g,o));var y=o.toString(),b=i.effect,T=r.getEngine().createEffect(f,{attributes:d,uniformsNames:m,uniformBuffersNames:v,samplers:g,defines:y,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS}},a);if(T)if(this.allowShaderHotSwapping&&b&&!T.isReady()){if(T=b,this._rebuildInParallel=!0,o.markAsUnprocessed(),s)return o._areLightsDisposed=!0,!1}else this._rebuildInParallel=!1,r.resetCachedMaterial(),i.setEffect(T,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,!1,this._rebuildInParallel),(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(11),s=i(28),c=i(76),l=i(12),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(39),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(97),a=i(46),s=i(3),c=i(107),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(8),a=i(0),s=i(19),c=i(37),l=i(51),u=(i(83),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,i){var o=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);var u=i||function(e){return o.attachedNode==e||e.isDescendantOf(o.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add(function(t,i){if(o.enabled)if(t.type==s.a.POINTERDOWN)o.startAndReleaseDragOnPointerEvents&&!o.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&u(t.pickInfo.pickedMesh)&&o._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint);else if(t.type==s.a.POINTERUP)o.startAndReleaseDragOnPointerEvents&&o.currentDraggingPointerID==t.event.pointerId&&o.releaseDrag();else if(t.type==s.a.POINTERMOVE){var n=t.event.pointerId;o.currentDraggingPointerID===e._AnyMouseID&&n!==e._AnyMouseID&&"mouse"==t.event.pointerType&&(o._lastPointerRay[o.currentDraggingPointerID]&&(o._lastPointerRay[n]=o._lastPointerRay[o.currentDraggingPointerID],delete o._lastPointerRay[o.currentDraggingPointerID]),o.currentDraggingPointerID=n),o._lastPointerRay[n]||(o._lastPointerRay[n]=new c.a(new a.e,new a.e)),t.pickInfo&&t.pickInfo.ray&&(o._lastPointerRay[n].origin.copyFrom(t.pickInfo.ray.origin),o._lastPointerRay[n].direction.copyFrom(t.pickInfo.ray.direction),o.currentDraggingPointerID==n&&o.dragging&&o._moveDrag(t.pickInfo.ray))}}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(function(){o._moving&&o.moveAttached&&(l.a._RemoveAndStorePivotPoint(o.attachedNode),o._targetPosition.subtractToRef(o.attachedNode.absolutePosition,o._tmpVector),o._tmpVector.scaleInPlace(o.dragDeltaRatio),o.attachedNode.getAbsolutePosition().addToRef(o._tmpVector,o._tmpVector),o.validateDrag(o._tmpVector)&&o.attachedNode.setAbsolutePosition(o._tmpVector),l.a._RestorePivotPoint(o.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(){return 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(11),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(11),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(29),c=i(11),l=function(){return 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(12),d=i(11),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(38),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(38),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(){return 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(39),jt=i(37);!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(96),Mi=i(106);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(80);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(){return 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.updateControllerLaserColor=!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(){return 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(123),Hn=i(105),Xn=i(79),Yn=i(71),Kn=i(49),Qn="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}";ni.a.ShadersStore.rgbdEncodePixelShader=Qn;var qn="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}";ni.a.ShadersStore.rgbdDecodePixelShader=qn;var Zn=function(){function e(){}return e.GetEnvInfo=function(t){for(var i=new DataView(t),n=0,r=0;r17)throw new Error("Exceeded maximum custom attributes");return"layout(location="+n+") "+e.prototype.attributeProcessor.call(this,t)},t.prototype.varyingProcessor=function(t,i){var n;return i?n=this._varyingLocationMap[t]:(n=this._varyingLocationCount++,this._varyingLocationMap[t]=n),"layout(location="+n+") "+e.prototype.varyingProcessor.call(this,t,i)},t.prototype.uniformProcessor=function(e){var t=e.match(/uniform\s+([^\s]+)\s+([^\s]+)\s*(?:\[.+\])?\s*;/),i=t[1],n=t[2];switch(i){case"sampler2D":case"samplerCube":var r=i.substr(7),o=this._textureCount++;return this._replacements.push({searchValue:new RegExp("\\b"+n+"\\b"),replaceValue:"sampler"+r+"("+n+"Texture, "+n+")"}),"layout(binding="+o+") uniform texture"+r+" "+n+"Texture;\nlayout(binding="+o+") uniform sampler "+n+";"}return this._uniforms.push(e),1===this._uniforms.length?"":""},t.prototype.preProcessor=function(e,t,i){return this._genericAttributeLocation=10,i||(this._varyingLocationCount=0,this._varyingLocationMap={}),this._replacements=[],this._textureCount=0,this._uniforms=[],e},t.prototype.postProcessor=function(t,i,n){return t=(t=(t=e.prototype.postProcessor.call(this,t,i,n)).replace("","uniform Frame {\n"+this._uniforms.join("\n")+"\n};")).replace("out vec4 glFragColor","layout(location=0) out vec4 glFragColor")},t}(Hn.a),ir=function(){function e(){this.isAsync=!1,this.isReady=!1}return e.prototype._handlesSpectorRebuildCallback=function(e){throw new Error("Not implemented")},e}(),nr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t}(Xn.a),rr=function(){function e(){}return e.POINT=0,e.MINPOINT_MAGPOINT_MIPPOINT=e.POINT,e.BILINEAR=1,e.MINLINEAR_MAGLINEAR_MIPPOINT=e.BILINEAR,e.TRILINEAR=2,e.MINLINEAR_MAGLINEAR_MIPLINEAR=e.TRILINEAR,e.ANISOTROPIC=3,e.POINT_COMPARE=4,e.TRILINEAR_COMPARE=5,e.MINBILINEAR_MAGPOINT=6,e.MINLINEAR_MAGPOINT_MIPLINEAR=e.MINBILINEAR_MAGPOINT,e.MINPOINT_MAGPOINT_MIPLINEAR=7,e.MINPOINT_MAGLINEAR_MIPPOINT=8,e.MINPOINT_MAGLINEAR_MIPLINEAR=9,e.MINLINEAR_MAGPOINT_MIPPOINT=10,e}(),or=function(){function e(){}return e.WRAP=0,e.MIRROR=1,e.CLAMP=2,e.BORDER=3,e.MIRROR_ONCE=4,e}(),ar=function(e){function t(){var t=e.call(this,null)||this;return t._native=nativeEngine,t._webGLVersion=2,t.disableUniformBuffers=!0,t._caps=new Ce.c,t._caps.maxTexturesImageUnits=16,t._caps.maxVertexTextureImageUnits=16,t._caps.maxTextureSize=512,t._caps.maxCubemapTextureSize=512,t._caps.maxRenderTextureSize=512,t._caps.maxVertexAttribs=16,t._caps.maxVaryingVectors=16,t._caps.maxFragmentUniformVectors=16,t._caps.maxVertexUniformVectors=16,t._caps.standardDerivatives=!0,t._caps.astc=null,t._caps.s3tc=null,t._caps.pvrtc=null,t._caps.etc1=null,t._caps.etc2=null,t._caps.maxAnisotropy=16,t._caps.uintIndices=!1,t._caps.fragmentDepthSupported=!1,t._caps.highPrecisionShaderSupported=!0,t._caps.colorBufferFloat=!1,t._caps.textureFloat=!1,t._caps.textureFloatLinearFiltering=!1,t._caps.textureFloatRender=!1,t._caps.textureHalfFloat=!1,t._caps.textureHalfFloatLinearFiltering=!1,t._caps.textureHalfFloatRender=!1,t._caps.textureLOD=!0,t._caps.drawBuffersExtension=!1,t._caps.depthTextureExtension=!1,t._caps.vertexArrayObject=!0,t._caps.instancedArrays=!1,Ie.b.Log("Babylon Native (v"+Ce.b.Version+") launched"),"undefined"==typeof URL&&(window.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(window.Blob=function(){}),t._shaderProcessor=new tr,t}return h.d(t,e),t.prototype.getHardwareScalingLevel=function(){return 1},t.prototype._queueNewFrame=function(e,t){return this._native.requestAnimationFrame(e),0},t.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1),this._native.clear(e.r,e.g,e.b,e.a,t,i,n)},t.prototype.createIndexBuffer=function(e){var t=this._normalizeIndexData(e),i=new nr;return i.references=1,i.is32Bits=4===t.BYTES_PER_ELEMENT,i.nativeIndexBuffer=this._native.createIndexBuffer(t),i},t.prototype.createVertexBuffer=function(e){var t=new nr;return t.references=1,t.nativeVertexBuffer=this._native.createVertexBuffer(ArrayBuffer.isView(e)?e:new Float32Array(e)),t},t.prototype.recordVertexArrayObject=function(e,t,i){var n=this._native.createVertexArray();t&&this._native.recordIndexBuffer(n,t.nativeIndexBuffer);for(var r=i.getAttributesNames(),o=0;o=0){var s=e[r[o]];if(s){var c=s.getBuffer();c&&this._native.recordVertexBuffer(n,c.nativeVertexBuffer,a,s.byteOffset,s.byteStride,s.getSize(),s.type,s.normalized)}}}return n},t.prototype.bindVertexArrayObject=function(e){this._native.bindVertexArray(e)},t.prototype.releaseVertexArrayObject=function(e){this._native.deleteVertexArray(e)},t.prototype.getAttributes=function(e,t){var i=e;return this._native.getAttributes(i.nativeProgram,t)},t.prototype.drawElementsType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._native.drawIndexed(e,t,i)},t.prototype.drawArraysType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._native.draw(e,t,i)},t.prototype.createPipelineContext=function(){return new ir},t.prototype._preparePipelineContext=function(e,t,i,n,r,o,a){var s=e;s.nativeProgram=n?this.createRawShaderProgram(e,t,i,void 0,a):this.createShaderProgram(e,t,i,o,void 0,a)},t.prototype._isRenderingStateCompiled=function(e){return!0},t.prototype._executeWhenRenderingStateIsCompiled=function(e,t){t()},t.prototype.createRawShaderProgram=function(e,t,i,n,r){throw void 0===r&&(r=null),new Error("Not Supported")},t.prototype.createShaderProgram=function(e,t,i,n,r,o){void 0===o&&(o=null),this.onBeforeShaderCompilationObservable.notifyObservers(this);var a=this._native.createProgram(Ce.b._concatenateShader(t,n),Ce.b._concatenateShader(i,n));return this.onAfterShaderCompilationObservable.notifyObservers(this),a},t.prototype._setProgram=function(e){this._currentProgram!==e&&(this._native.setProgram(e),this._currentProgram=e)},t.prototype._releaseEffect=function(e){},t.prototype._deletePipelineContext=function(e){},t.prototype.getUniforms=function(e,t){var i=e;return this._native.getUniforms(i.nativeProgram,t)},t.prototype.bindUniformBlock=function(e,t,i){throw new Error("Not Implemented")},t.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.nativeProgram);for(var i=e.getSamplers(),n=0;n-1?d.substring(g).toLowerCase():""),y=null,b=0,T=Ce.b._TextureLoaders;b-1?e.substring(p).toLowerCase():"")))throw new Error("Cannot load cubemap: non-ENV format not supported.");if(i&&6===i.length)throw new Error("Multi-file loading not yet supported.");return this._loadFile(e,function(e){e=e;var t=Zn.GetEnvInfo(e);if(f.width=t.width,f.height=t.width,Zn.UploadEnvSpherical(f,t),1!==t.version)throw new Error('Unsupported babylon environment map version "'+t.version+'"');var i=t.specular;if(!i)throw new Error("Nothing else parsed so far");f._lodGenerationScale=i.lodGenerationScale;var n=Zn.CreateImageDataArrayBufferViews(e,t);f.format=Ce.b.TEXTUREFORMAT_RGBA,f.type=Ce.b.TEXTURETYPE_UNSIGNED_INT,f.generateMipMaps=!0,f.getEngine().updateTextureSamplingMode($e.a.TRILINEAR_SAMPLINGMODE,f),f._isRGBD=!0,f.invertY=!0,d._native.loadCubeTexture(f._webGLTexture,n,!0),f.isReady=!0,r&&r()},void 0,void 0,!0,function(e,t){o&&e&&o(e.status+" "+e.statusText,t)}),this._internalTexturesCache.push(f),f},t.prototype._getSamplingFilter=function(e){switch(e){case Ce.b.TEXTURE_BILINEAR_SAMPLINGMODE:return rr.MINLINEAR_MAGLINEAR_MIPPOINT;case Ce.b.TEXTURE_TRILINEAR_SAMPLINGMODE:return rr.MINLINEAR_MAGLINEAR_MIPLINEAR;case Ce.b.TEXTURE_NEAREST_SAMPLINGMODE:return rr.MINPOINT_MAGPOINT_MIPLINEAR;case Ce.b.TEXTURE_NEAREST_NEAREST_MIPNEAREST:return rr.MINPOINT_MAGPOINT_MIPPOINT;case Ce.b.TEXTURE_NEAREST_LINEAR_MIPNEAREST:return rr.MINLINEAR_MAGPOINT_MIPPOINT;case Ce.b.TEXTURE_NEAREST_LINEAR_MIPLINEAR:case Ce.b.TEXTURE_NEAREST_LINEAR:return rr.MINLINEAR_MAGPOINT_MIPLINEAR;case Ce.b.TEXTURE_NEAREST_NEAREST:return rr.MINPOINT_MAGPOINT_MIPPOINT;case Ce.b.TEXTURE_LINEAR_NEAREST_MIPNEAREST:return rr.MINPOINT_MAGLINEAR_MIPPOINT;case Ce.b.TEXTURE_LINEAR_NEAREST_MIPLINEAR:return rr.MINPOINT_MAGLINEAR_MIPLINEAR;case Ce.b.TEXTURE_LINEAR_LINEAR:return rr.MINLINEAR_MAGLINEAR_MIPLINEAR;case Ce.b.TEXTURE_LINEAR_NEAREST:return rr.MINPOINT_MAGLINEAR_MIPLINEAR;default:throw new Error("Unexpected sampling mode: "+e+".")}},t.prototype.createRenderTargetTexture=function(e,t){var i=new $n.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?Ce.b.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?$e.a.TRILINEAR_SAMPLINGMODE:t.samplingMode):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=Ce.b.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=$e.a.TRILINEAR_SAMPLINGMODE);var n=new et.a(this,et.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},t.prototype.updateTextureSamplingMode=function(e,t){if(t._webGLTexture){var i=this._getSamplingFilter(e);this._native.setTextureSampling(t._webGLTexture,i)}t.samplingMode=e},t.prototype.bindFramebuffer=function(e,t,i,n,r){throw new Error("bindFramebuffer not yet implemented.")},t.prototype.unBindFramebuffer=function(e,t,i){throw void 0===t&&(t=!1),new Error("unBindFramebuffer not yet implemented.")},t.prototype.createDynamicVertexBuffer=function(e){throw new Error("createDynamicVertexBuffer not yet implemented.")},t.prototype.updateDynamicIndexBuffer=function(e,t,i){throw void 0===i&&(i=0),new Error("updateDynamicIndexBuffer not yet implemented.")},t.prototype.updateDynamicVertexBuffer=function(e,t,i,n){throw new Error("updateDynamicVertexBuffer not yet implemented.")},t.prototype._setTexture=function(e,t,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1);var r,o=this._boundUniforms[e];if(!o)return!1;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._native.setTexture(o,null)),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===Ce.b.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;return r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:this.emptyTexture,this._activeChannel=e,!(!r||!r._webGLTexture)&&(this._native.setTextureWrapMode(r._webGLTexture,this._getAddressMode(t.wrapU),this._getAddressMode(t.wrapV),this._getAddressMode(t.wrapR)),this._updateAnisotropicLevel(t),this._native.setTexture(o,r._webGLTexture),!0)},t.prototype._updateAnisotropicLevel=function(e){var t=e.getInternalTexture(),i=e.anisotropicFilteringLevel;t&&t._webGLTexture&&t._cachedAnisotropicFilteringLevel!==i&&(this._native.setTextureAnisotropicLevel(t._webGLTexture,i),t._cachedAnisotropicFilteringLevel=i)},t.prototype._getAddressMode=function(e){switch(e){case Ce.b.TEXTURE_WRAP_ADDRESSMODE:return or.WRAP;case Ce.b.TEXTURE_CLAMP_ADDRESSMODE:return or.CLAMP;case Ce.b.TEXTURE_MIRROR_ADDRESSMODE:return or.MIRROR;default:throw new Error("Unexpected wrap mode: "+e+".")}},t.prototype._bindTexture=function(e,t){throw new Error("_bindTexture not implemented.")},t.prototype._deleteBuffer=function(e){e.nativeIndexBuffer&&(this._native.deleteIndexBuffer(e.nativeIndexBuffer),delete e.nativeIndexBuffer),e.nativeVertexBuffer&&(this._native.deleteVertexBuffer(e.nativeVertexBuffer),delete e.nativeVertexBuffer)},t.prototype.releaseEffects=function(){},t.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){throw void 0===o&&(o=0),void 0===a&&(a=0),new Error("_uploadCompressedDataToTextureDirectly not implemented.")},t.prototype._uploadDataToTextureDirectly=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadDataToTextureDirectly not implemented.")},t.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},t.prototype._uploadImageToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},t}(Ce.b),sr=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),cr=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return sr.COPY;case 86:return sr.PASTE;case 88:return sr.CUT;default:return-1}},e}(),lr=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(lr.GAMEPAD_ID_PREFIX)},create:function(e){return new lr(e)}});var ur=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}(fr.a),mr=i(48),gr=i(45),vr=function(e){function t(t,i){void 0===t&&(t=s.a.Gray()),void 0===i&&(i=pr.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(gr.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(n._boundingDimensions.x,0,0)]},i.utilityLayerScene)),r.push(gr.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(gr.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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=mr.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=dr.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=dr.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}(fr.a),yr=function(e){function t(t,i,n,r,c,l){void 0===i&&(i=s.a.Gray()),void 0===n&&(n=pr.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}(fr.a),br=function(e){function t(t,i,n){void 0===t&&(t=pr.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 yr(new a.e(1,0,0),s.a.Red().scale(.5),t,i,r,n),r.yGizmo=new yr(new a.e(0,1,0),s.a.Green().scale(.5),t,i,r,n),r.zGizmo=new yr(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}(fr.a),Tr=i(41),Er=i(83),Ar=function(e){function t(i,n,r,c){void 0===n&&(n=s.a.Gray()),void 0===r&&(r=pr.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 Tr.a("plane",e),n=Er.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 Tr.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.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?(this.getScene().useRightHandedSystem?e.setFloat3(t,-this.transformedDirection.x,-this.transformedDirection.y,-this.transformedDirection.z):e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(this.getScene().useRightHandedSystem?e.setFloat3(t,-this.direction.x,-this.direction.y,-this.direction.z):e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),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}(Mr);Se.a.CreateHemisphere=function(e,t,i,n){var r={segments:t,diameter:i};return Ir.CreateHemisphere(e,r,n)};var Ir=function(){function e(){}return e.CreateHemisphere=function(e,t,i){t.diameter||(t.diameter=1),t.segments||(t.segments=16);var n=mr.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 Dr(e,a.e.Zero(),a.e.Zero(),0,0,t)}});var Dr=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 Cr.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.transferToNodeMaterialEffect=function(e,t){var i;return i=this.computeTransformedInformation()?a.e.Normalize(this.transformedDirection):a.e.Normalize(this.direction),this.getScene().useRightHandedSystem?e.setFloat3(t,-i.x,-i.y,-i.z):e.setFloat3(t,i.x,i.y,i.z),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}(Mr),Lr=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 Or?t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof Dr?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=Ir.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=mr.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);mr.a.CreateSphere(i.name,{segments:10,diameter:1},e).parent=i;var n=Ir.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,mr.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}(fr.a);ni.a.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};";var wr="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=wr;var Fr="#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=Fr;var Nr="#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=Nr;var Br="\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=Br;ni.a.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";var Ur="\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=Ur;var Vr=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),kr=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 Vr("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 Vr("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 kr(e,t,i,n)};var Gr=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=Gr.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(jr.a.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),jr.a.PrepareDefinesForFrameBoundValues(r,a,o,i),jr.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"),jr.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),jr.a.PrepareAttributesForBones(l,e,o,c),jr.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)),jr.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),jr.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&&Xr.a.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),jr.a.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),s&&Xr.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&&Xr.a.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),s&&Xr.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)))),jr.a.BindClipPlane(this._activeEffect,n),jr.a.BindEyePosition(o,n)}!a&&this.isFrozen||(n.lightsEnabled&&jr.a.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights,!1),this.bindView(o),jr.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}(Hr.a);c.a.RegisteredTypes["BABYLON.BackgroundMaterial"]=$r;var eo=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 Kn.a)this._scene.environmentTexture=this._options.environmentTexture;else{var e=zr.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 $r("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 Kn.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 kr("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;i0&&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}(),oo=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&&Xr.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&&Xr.a.AnisotropicTextureEnabled?jr.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&&Xr.a.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),jr.a.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&Xr.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}(),ao=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}(),so=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&&Xr.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&&Xr.a.SheenTextureEnabled?jr.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&&Xr.a.SheenTextureEnabled&&(e.updateFloat2("vSheenInfos",this._texture.coordinatesIndex,this._texture.level),jr.a.BindTextureMatrix(this._texture,e,"sheen")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity)),t.texturesEnabled&&this._texture&&Xr.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}(),co=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&&Xr.a.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&Xr.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&&Xr.a.ThicknessTextureEnabled&&jr.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&&Xr.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&&Xr.a.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),jr.a.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),o&&Xr.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&&Xr.a.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),o&&Xr.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){Xr.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!!(Xr.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}(),lo="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=lo;var uo="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=uo;var ho="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=ho;var fo="#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=fo;i(102);var po="\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=po;var _o="#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=_o;var mo="\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=mo;var go="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=go;var vo="\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) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(environmentBrdfSampler,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=vo;var yo="#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=yo;var bo="#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=bo;i(139),i(140),i(141),i(133);var To="#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 So);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&&Xr.a.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&Xr.a.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&Xr.a.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var a=this._getReflectionTexture();if(a&&Xr.a.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;if(a.irradianceTexture&&!a.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&Xr.a.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&Xr.a.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(Xr.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&&Xr.a.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&Xr.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=n._areLightsDisposed,l=this._prepareEffect(e,n,this.onCompiled,this.onError,i);if(l)if(this.allowShaderHotSwapping&&s&&!l.isReady()){if(l=s,this._rebuildInParallel=!0,n.markAsUnprocessed(),c)return n._areLightsDisposed=!0,!1}else this._rebuildInParallel=!1,r.resetCachedMaterial(),t.setEffect(l,n),this.buildUniformLayout();return!(!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=oo.AddFallbacks(t,s,c),c=oo.AddFallbacks(t,s,c),c=co.AddFallbacks(t,s,c),c=so.AddFallbacks(t,s,c),t.ENVIRONMENTBRDF&&s.addFallback(c++,"ENVIRONMENTBRDF"),t.TANGENT&&s.addFallback(c++,"TANGENT"),t.BUMP&&s.addFallback(c++,"BUMP"),c=jr.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),jr.a.PrepareAttributesForBones(l,e,t,s),jr.a.PrepareAttributesForInstances(l,t),jr.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"];co.AddUniforms(h),co.AddSamplers(d),ro.AddUniforms(h),ro.AddSamplers(d),oo.AddUniforms(h),oo.AddSamplers(d),so.AddUniforms(h),so.AddSamplers(d),Gi.a&&(Gi.a.PrepareUniforms(h,t),Gi.a.PrepareSamplers(d,t)),jr.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(jr.a.PrepareDefinesForLights(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,jr.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&&Xr.a.DiffuseTextureEnabled?jr.a.PrepareDefinesForMergedUV(this._albedoTexture,i,"ALBEDO"):i.ALBEDO=!1,this._ambientTexture&&Xr.a.AmbientTextureEnabled?(jr.a.PrepareDefinesForMergedUV(this._ambientTexture,i,"AMBIENT"),i.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):i.AMBIENT=!1,this._opacityTexture&&Xr.a.OpacityTextureEnabled?(jr.a.PrepareDefinesForMergedUV(this._opacityTexture,i,"OPACITY"),i.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):i.OPACITY=!1;var s=this._getReflectionTexture();if(s&&Xr.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&&Xr.a.LightmapTextureEnabled?(jr.a.PrepareDefinesForMergedUV(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,i.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):i.LIGHTMAP=!1,this._emissiveTexture&&Xr.a.EmissiveTextureEnabled?jr.a.PrepareDefinesForMergedUV(this._emissiveTexture,i,"EMISSIVE"):i.EMISSIVE=!1,Xr.a.SpecularTextureEnabled?(this._metallicTexture?(jr.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?(jr.a.PrepareDefinesForMergedUV(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):i.REFLECTIVITY=!1,this._microSurfaceTexture?jr.a.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),o.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&Xr.a.BumpTextureEnabled&&!this._disableBumpMap?(jr.a.PrepareDefinesForMergedUV(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&Xr.a.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):i.BUMP=!1,this._environmentBRDFTexture&&Xr.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&&(jr.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),jr.a.PrepareDefinesForFrameBoundValues(o,a,i,!!n,r),jr.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 So,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),ro.PrepareUniformBuffer(e),oo.PrepareUniformBuffer(e),so.PrepareUniformBuffer(e),co.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);jr.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&&Xr.a.DiffuseTextureEnabled&&(u.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),jr.a.BindTextureMatrix(this._albedoTexture,u,"albedo")),this._ambientTexture&&Xr.a.AmbientTextureEnabled&&(u.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),jr.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&Xr.a.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),jr.a.BindTextureMatrix(this._opacityTexture,u,"opacity")),l&&Xr.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&&Xr.a.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),jr.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&Xr.a.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),jr.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),Xr.a.SpecularTextureEnabled&&(this._metallicTexture?(u.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),jr.a.BindTextureMatrix(this._metallicTexture,u,"reflectivity")):this._reflectivityTexture&&(u.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),jr.a.BindTextureMatrix(this._reflectivityTexture,u,"reflectivity")),this._microSurfaceTexture&&(u.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),jr.a.BindTextureMatrix(this._microSurfaceTexture,u,"microSurfaceSampler"))),this._bumpTexture&&h.getCaps().standardDerivatives&&Xr.a.BumpTextureEnabled&&!this._disableBumpMap&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),jr.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",Xr.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&&Xr.a.DiffuseTextureEnabled&&u.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&Xr.a.AmbientTextureEnabled&&u.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&Xr.a.OpacityTextureEnabled&&u.setTexture("opacitySampler",this._opacityTexture),l&&Xr.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&&Xr.a.EmissiveTextureEnabled&&u.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&Xr.a.LightmapTextureEnabled&&u.setTexture("lightmapSampler",this._lightmapTexture),Xr.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&&Xr.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),jr.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&&jr.a.BindLights(r,i,this._activeEffect,o,this._maxSimultaneousLights,this._lightFalloff!==t.LIGHTFALLOFF_STANDARD,this._rebuildInParallel),(r.fogEnabled&&i.applyFog&&r.fogMode!==K.a.FOGMODE_NONE||l)&&this.bindView(a),jr.a.BindFogParameters(r,i,this._activeEffect,!0),o.NUM_MORPH_INFLUENCERS&&jr.a.BindMorphTargetParameters(i,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),jr.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}(Hr.a),xo=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=no.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===Ro.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Ro.LIGHTFALLOFF_PHYSICAL:Ro.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===Ro.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Ro.LIGHTFALLOFF_GLTF:Ro.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=Ro.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=Ro.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=Ro.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=Ro.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=Ro.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}(Ro);c.a.RegisteredTypes["BABYLON.PBRMaterial"]=xo;var Co=i(84);function Mo(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var Oo=Mo("DXT1"),Io=Mo("DXT3"),Do=Mo("DXT5"),Lo=Mo("DX10"),wo=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===Lo?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 Lo: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===Oo||r===Io||r===Do,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=Co.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 Yn.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),wo.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 Kn.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 Fo=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),wo.UploadDDSLevels(a,t,l,o,s,6,-1,c),o.isFourCC||1!==o.mipmapCount||a.generateMipMapsForCubemap(t)}else{var u=e;o=wo.GetDDSInfo(u),t.width=o.width,t.height=o.height,i&&(o.sphericalPolynomial=new Yn.b),s=(o.isRGB||o.isLuminance||o.mipmapCount>1)&&t.generateMipMaps,a._unpackFlipY(o.isCompressed),wo.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=wo.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(){wo.UploadDDSLevels(t.getEngine(),t,e,n,r,1)})},e}();Ce.b._TextureLoaders.push(new Fo);var No=function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e,t,i,n,r){return 0===e.indexOf(".env")},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){if(!Array.isArray(e)){e=e;var o=Zn.GetEnvInfo(e);o?(t.width=o.width,t.height=o.width,Zn.UploadEnvSpherical(t,o),Zn.UploadEnvLevelsAsync(t,e,o).then(function(){t.isReady=!0,n&&n()})):r&&r("Can not parse the environment file",null)}},e.prototype.loadData=function(e,t,i){throw".env not supported in 2d."},e}();Ce.b._TextureLoaders.push(new No);var Bo=function(){function e(t,i,n,r){this.arrayBuffer=t,this.isInvalid=!1;var o=new Uint8Array(this.arrayBuffer,0,12);if(171!==o[0]||75!==o[1]||84!==o[2]||88!==o[3]||32!==o[4]||49!==o[5]||49!==o[6]||187!==o[7]||13!==o[8]||10!==o[9]||26!==o[10]||10!==o[11])return this.isInvalid=!0,void m.a.Error("texture missing KTX identifier");var a=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,12,13*a),c=67305985===s.getUint32(0,!0);this.glType=s.getUint32(1*a,c),this.glTypeSize=s.getUint32(2*a,c),this.glFormat=s.getUint32(3*a,c),this.glInternalFormat=s.getUint32(4*a,c),this.glBaseInternalFormat=s.getUint32(5*a,c),this.pixelWidth=s.getUint32(6*a,c),this.pixelHeight=s.getUint32(7*a,c),this.pixelDepth=s.getUint32(8*a,c),this.numberOfArrayElements=s.getUint32(9*a,c),this.numberOfFaces=s.getUint32(10*a,c),this.numberOfMipmapLevels=s.getUint32(11*a,c),this.bytesOfKeyValueData=s.getUint32(12*a,c),0===this.glType?(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===i?this.loadType=e.COMPRESSED_2D:m.a.Error("number of faces expected"+i+", but found "+this.numberOfFaces):m.a.Error("texture arrays not currently supported"):m.a.Error("only 2D textures currently supported")):m.a.Error("only compressed formats currently supported")}return e.prototype.uploadLevels=function(t,i){switch(this.loadType){case e.COMPRESSED_2D:this._upload2DCompressedLevels(t,i);break;case e.TEX_2D:case e.COMPRESSED_3D:case e.TEX_3D:}},e.prototype._upload2DCompressedLevels=function(t,i){for(var n=e.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,o=this.pixelHeight,a=i?this.numberOfMipmapLevels:1,s=0;s-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 Bo(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 Bo(e,1);i(n.pixelWidth,n.pixelHeight,!1,!0,function(){n.uploadLevels(t,t.generateMipMaps)},n.isInvalid)},e}();Ce.b._TextureLoaders.unshift(new Uo);var Vo=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),Go=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}(),zo=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}(),jo=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 $r(i+"_material",o),u=s._videoTexture=new ko(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=mr.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}(Tr.a),Wo=i(47),Ho=function(){function e(e){this.engine=e,this._captureGPUFrameTime=!1,this._gpuFrameTime=new Wo.a,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new Wo.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}(),Xo=function(){function e(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new Wo.a,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new Wo.a,this._captureFrameTime=!1,this._frameTime=new Wo.a,this._captureRenderTime=!1,this._renderTime=new Wo.a,this._captureInterFrameTime=!1,this._interFrameTime=new Wo.a,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new Wo.a,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new Wo.a,this._capturePhysicsTime=!1,this._physicsTime=new Wo.a,this._captureAnimationsTime=!1,this._animationsTime=new Wo.a,this._captureCameraRenderTime=!1,this._cameraRenderTime=new Wo.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}(),Yo=i(25),Ko="#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),jr.a.PrepareAttributesForMorphTargetsInfluencers(o,a,m)),t&&(r.push("#define INSTANCES"),jr.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}(),oa="\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=oa;var aa="\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=aa;var sa=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 ra(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(Yo.a.TriangleFillMode,0,6):(t.setAlphaMode(this.alphaBlendingMode),t.drawElementsType(Yo.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}(),ca=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}(),la="\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=la;var ua="\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=ua;var ha=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}();ha._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_LENSFLARESYSTEM);t||(t=new da(e),e._addComponent(t))};var fa="#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=fa;var pa="\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=pa;var _a="\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=_a;var ma=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 Vr(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 Vr(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()===Cr.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),jr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,u)),t&&(i.push("#define INSTANCES"),jr.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}(),Aa=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 Ea.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}(Kn.a);c.a.RegisteredTypes["BABYLON.HDRCubeTexture"]=Pa;var Sa=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 Ca.e.HingeJoint:case Ca.e.Hinge2Joint:n=new this.BJSCANNON.HingeConstraint(t,i,o);break;case Ca.e.DistanceJoint:n=new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance||2);break;case Ca.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 Ca.e.LockJoint:n=new this.BJSCANNON.LockConstraint(t,i,o);break;case Ca.e.PointToPointJoint:case Ca.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!==Ca.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!==Ca.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}();Ma.DefaultPluginFactory=function(){return new Ia};var Da=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 Oa}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,Ma.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 xa.a.ParticleImpostor:m.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case xa.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 xa.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 xa.a.PlaneImpostor:case xa.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 Ca.e.BallAndSocketJoint:n="jointBall";break;case Ca.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 Ca.e.DistanceJoint:n="jointDistance",a.max=r.maxDistance;break;case Ca.e.PrismaticJoint:n="jointPrisme";break;case Ca.e.SliderJoint:n="jointSlide";break;case Ca.e.WheelJoint:n="jointWheel";break;case Ca.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=La.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}(),Fa=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 Oa,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!=xa.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 xa.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 xa.a.CapsuleImpostor:n=new Ammo.btCapsuleShape(o.x/2,o.y/2);break;case xa.a.CylinderImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btCylinderShape(this._tmpAmmoVectorA);break;case xa.a.PlaneImpostor:case xa.a.BoxImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btBoxShape(this._tmpAmmoVectorA);break;case xa.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 xa.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 xa.a.NoImpostor:n=new Ammo.btSphereShape(o.x/2);break;case xa.a.SoftbodyImpostor:n=this._createSoftbody(e);break;case xa.a.ClothImpostor:n=this._createCloth(e);break;case xa.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===xa.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 Na=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}},za=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 Pa((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e,p,!0,!f);l.environmentTextureRotationY&&(_.rotationY=l.environmentTextureRotationY),e.environmentTexture=_}else if(Ba.a.EndsWith(l.environmentTexture,".env")){var g=new zr((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e);l.environmentTextureRotationY&&(g.rotationY=l.environmentTextureRotationY),e.environmentTexture=g}else{var v=zr.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}(Kn.a);c.a.RegisteredTypes["BABYLON.ColorGradingTexture"]=Qa;var qa=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=Ea.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}(),Ja=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=Za.GetTGAHeader(n);i(r.width,r.height,t.generateMipMaps,!1,function(){Za.UploadContent(t,n)})},e}();Ce.b._TextureLoaders.push(new Ja);var $a;!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"}($a||($a={}));var es=function(){function e(){}return e.GetInternalFormatFromBasisFormat=function(e){if(e===$a.cTFETC1)return 36196;if(e===$a.cTFBC1)return 33776;if(e===$a.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(["("+ts+")()"],{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;es.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}};es.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(){es.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 is),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 ns=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),rs=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}(),os="\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=os;var as=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 rs(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(Yo.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(Yo.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),ss=i(66),cs=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 ss.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!==ds.AutoDetect){switch(this.type){case ds.Vector3:if(e.type===ds.Color3)return!0;case ds.Vector4:if(e.type===ds.Color4)return!0;case ds.Color3:if(e.type===ds.Vector3)return!0;case ds.Color4:if(e.type===ds.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}(),vs=i(129),ys=function(){function e(e,t,i,n){void 0===t&&(t=hs.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=vs.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 gs(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 gs(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._linkConnectionTypes=function(e,t){this._inputs[e]._linkedConnectionSource=this._inputs[t],this._inputs[t]._linkedConnectionSource=this._inputs[e]},e.prototype._processBuild=function(e,t,i,n){e.build(t,n);var r=null!=t._vertexState,o=e._buildTarget===hs.Vertex&&e.target!==hs.VertexAndFragment;if(r&&(0==(e.target&i.target)||this.target!==hs.VertexAndFragment&&o)&&(!e.isInput&&t.target!==e._buildTarget||e.isInput&&e.isAttribute)){var a=i.connectedPoint;t._vertexState._emitVaryingFromString("v_"+a.associatedVariableName,t._getGLType(a.type))&&(t._vertexState.compilationString+="v_"+a.associatedVariableName+" = "+a.associatedVariableName+";\r\n"),i.associatedVariableName="v_"+a.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&hs.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&hs.Fragment)&&this._addFragmentOutputNode(e),this},t.prototype.removeOutputNode=function(e){return null===e.target?this:(0!=(e.target&hs.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&hs.Fragment)&&this._removeFragmentOutputNode(e),this)},t.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=hs.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=hs.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),e._preparationId=this._buildId,-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}(),fc=function(){function e(e){var t,i=this;this.onApplyObservable=new o.c;var n=e.uniformNames||[];e.vertexShader?t={fragmentSource:e.fragmentShader,vertexSource:e.vertexShader,spectorName:e.name||"effectWrapper"}:(n.push("scale"),t={fragmentSource:e.fragmentShader,vertex:"postprocess",spectorName:e.name||"effectWrapper"},this.onApplyObservable.add(function(){i.effect.setFloat2("scale",1,1)})),this.effect=new ni.a(t,e.attributeNames||["position"],n,e.samplerNames,e.engine)}return e.prototype.dispose=function(){this.effect.dispose()},e}(),pc=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 Pc(f,t.shared)).plane&&r.push(d),p.length>=3&&(d=new Pc(p,t.shared)).plane&&o.push(d)}},e.EPSILON=1e-5,e}(),Pc=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}(),Sc=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}(),Fc=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=La.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){bc.b.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())}),bc.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=Za.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}(),ol=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}(),al=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}(),sl=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}(),cl=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}(sl),ll=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}(),ul=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}(),hl=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}(),dl=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}(hl),fl=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}(),vl=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"}(nl||(nl={}));var yl=function(){function e(e){this.particleSystem=e,this.type=nl.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}(),bl="\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=bl;var Tl="\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=Tl;var El=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 vl(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===nl.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===nl.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 ol,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?gl.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&&gl.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&&gl.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&&gl.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&&gl.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&&gl.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&&gl.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&&gl.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 pl;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);gl.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;gl.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;gl.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 pl;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 ml;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===El.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(Yo.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),jr.a.BindClipPlane(this._renderEffect,this._scene)}switch(this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._renderEffect),this.blendMode){case El.BLENDMODE_ADD:this._engine.setAlphaMode(g.a.ALPHA_ADD);break;case El.BLENDMODE_ONEONE:this._engine.setAlphaMode(g.a.ALPHA_ONEONE);break;case El.BLENDMODE_STANDARD:this._engine.setAlphaMode(g.a.ALPHA_COMBINE);break;case El.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(Yo.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 El._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),El._Parse(e,o,i,n),e.preventAutoStart&&(o.preventAutoStart=e.preventAutoStart),r||o.preventAutoStart||o.start(),o},t}(fl),Ml=(function(){}(),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=mr.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=this.nbParticles,P=this._posToShape(f),S=this._uvsToShapeUV(_);for(g.copyFromFloats(0,0,0),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===Nl.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=mr.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}(),Gl=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 Wl,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}(),zl=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 Hl,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===Bl.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===Bl.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}(),jl=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 Xl,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}(),Wl=function(){return function(){this.radius=5,this.strength=10,this.falloff=Nl.Constant,this.sphere={segments:32,diameter:1}}}(),Hl=function(){return function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=Bl.Center}}(),Xl=function(){return 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"}(Nl||(Nl={})),function(e){e[e.Center=0]="Center",e[e.Perpendicular=1]="Perpendicular"}(Bl||(Bl={}));var Yl="\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=Yl;var Kl=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),Ql=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),Eu="#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=Eu;var Au=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),Pu="\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=Pu;var Su=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 Ru="#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=Ru;var xu="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=xu;var Cu=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),jr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),jr.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 ns("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,Yo.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])),jr.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,Yo.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}(),Bu=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 Uu(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new Bu}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var Uu=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}(),Vu=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=hu.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 Fu("sharpen",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._sharpenEffect=new Ql(c,a.SharpenPostProcessId,function(){return a.sharpen},!0),a.depthOfField=new pu(a._scene,null,a._depthOfFieldBlurLevel,a._defaultPipelineTextureType,!0),a.bloom=new eu(a._scene,a._bloomScale,a._bloomWeight,a.bloomKernel,a._defaultPipelineTextureType,!0),a.chromaticAberration=new iu("ChromaticAberration",c.getRenderWidth(),c.getRenderHeight(),1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._chromaticAberrationEffect=new Ql(c,a.ChromaticAberrationPostProcessId,function(){return a.chromaticAberration},!0),a.grain=new Au("Grain",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._grainEffect=new Ql(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 eu(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 Ql(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 Tu("fxaa",1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new Ql(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 Ql(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 Ql(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 Vr("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 Vr("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 Ql(e.getEngine(),"HDRBlurH"+i,function(){return s},!0)),this.addEffect(new Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(e.getEngine(),"HDRDepthOfField",function(){return i.depthOfFieldPostProcess},!0))},t.prototype._createMotionBlurPostProcess=function(e,t){var i=this;if(this._isObjectBasedMotionBlur){var n=new Iu("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 Ql(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,Yo.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,Yo.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=oh;var ah=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,Yo.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)),jr.a.BindMorphTargetParameters(t,o._effect),t._processRendering(e,o._effect,Yo.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),jr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),jr.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 ah(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 sh=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}();ah._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_DEPTHRENDERER);t||(t=new sh(e),e._addComponent(t))};var ch="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}";ni.a.ShadersStore.linePixelShader=ch;var lh="\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=lh;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 hh(this,e,t),this},Object.defineProperty(Ye.a.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),Mc.b.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new dh(this,e,t),this},Mc.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),Mc.b.prototype.enableEdgesRendering.apply(this,arguments),this};var uh=function(){return function(){this.edges=new Array,this.edgesConnectedCount=0}}(),hh=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 Ka.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=fh;var ph="\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=ph;K.a.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new _h(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 _h=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)),jr.a.BindMorphTargetParameters(s,this._effect),s._bind(e,this._effect,Yo.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,Yo.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),jr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,s)),t&&(i.push("#define INSTANCES"),jr.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}(),mh=i(125),gh=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}(),yh="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=yh;var bh="\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=bh;var Th,Eh=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 vh(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 Ch(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}(),Gh=i(122),zh=i(121),jh=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}(),Wh=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}(jh),Hh=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}(jh),Xh=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}(jh),Yh=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}(jh),Kh=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}(jh),Qh=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}(jh),qh=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}(jh),Zh=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}(jh),Jh=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}(),cd=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 Tu("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=cd.CreateScreenshot,Ie.b.CreateScreenshotAsync=cd.CreateScreenshotAsync,Ie.b.CreateScreenshotUsingRenderTarget=cd.CreateScreenshotUsingRenderTarget,Ie.b.CreateScreenshotUsingRenderTargetAsync=cd.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"}(Rh||(Rh={}));var ld=i(120),ud=i(119);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,"NativeEngine",function(){return ar}),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 sr}),i.d(t,"ClipboardInfo",function(){return cr}),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 lr}),i.d(t,"GearVRController",function(){return ur}),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 hr.a}),i.d(t,"AxisScaleGizmo",function(){return _r}),i.d(t,"BoundingBoxGizmo",function(){return vr}),i.d(t,"Gizmo",function(){return fr.a}),i.d(t,"GizmoManager",function(){return xr}),i.d(t,"PlaneRotationGizmo",function(){return yr}),i.d(t,"PositionGizmo",function(){return Pr}),i.d(t,"RotationGizmo",function(){return br}),i.d(t,"ScaleGizmo",function(){return Rr}),i.d(t,"LightGizmo",function(){return Lr}),i.d(t,"PlaneDragGizmo",function(){return Ar}),i.d(t,"EnvironmentHelper",function(){return eo}),i.d(t,"PhotoDome",function(){return to}),i.d(t,"_forceSceneHelpersToBundle",function(){return!0}),i.d(t,"VideoDome",function(){return jo}),i.d(t,"EngineInstrumentation",function(){return Ho}),i.d(t,"SceneInstrumentation",function(){return Xo}),i.d(t,"_TimeToken",function(){return zn}),i.d(t,"EffectLayer",function(){return qo}),i.d(t,"EffectLayerSceneComponent",function(){return Zo}),i.d(t,"GlowLayer",function(){return ea}),i.d(t,"HighlightLayer",function(){return na}),i.d(t,"Layer",function(){return sa}),i.d(t,"LayerSceneComponent",function(){return ra}),i.d(t,"LensFlare",function(){return ca}),i.d(t,"LensFlareSystem",function(){return ha}),i.d(t,"LensFlareSystemSceneComponent",function(){return da}),i.d(t,"Light",function(){return Cr.a}),i.d(t,"ShadowLight",function(){return Mr}),i.d(t,"DirectionalLight",function(){return Or}),i.d(t,"HemisphericLight",function(){return Ui.a}),i.d(t,"PointLight",function(){return va}),i.d(t,"SpotLight",function(){return Dr}),i.d(t,"ShadowGenerator",function(){return ma}),i.d(t,"ShadowGeneratorSceneComponent",function(){return ga}),i.d(t,"DefaultLoadingScreen",function(){return ya}),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,"BackgroundMaterial",function(){return $r}),i.d(t,"ColorCurves",function(){return ja.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 Wa}),i.d(t,"ImageProcessingConfigurationDefines",function(){return Gi.b}),i.d(t,"ImageProcessingConfiguration",function(){return Gi.a}),i.d(t,"Material",function(){return Yo.a}),i.d(t,"MaterialDefines",function(){return Wr.a}),i.d(t,"MaterialHelper",function(){return jr.a}),i.d(t,"MultiMaterial",function(){return Ta.a}),i.d(t,"PushMaterial",function(){return Hr.a}),i.d(t,"ShaderMaterial",function(){return Ka.a}),i.d(t,"StandardMaterialDefines",function(){return zi.b}),i.d(t,"StandardMaterial",function(){return zi.a}),i.d(t,"BaseTexture",function(){return Kn.a}),i.d(t,"CubeTexture",function(){return zr}),i.d(t,"DynamicTexture",function(){return ji}),i.d(t,"EquiRectangularCubeTexture",function(){return qa}),i.d(t,"HDRCubeTexture",function(){return Pa}),i.d(t,"InternalTexture",function(){return et.a}),i.d(t,"MirrorTexture",function(){return kr}),i.d(t,"MultiRenderTarget",function(){return ns}),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 Xr.a}),i.d(t,"EffectRenderer",function(){return dc}),i.d(t,"EffectWrapper",function(){return fc}),i.d(t,"PBRMaterialDefines",function(){return So}),i.d(t,"PBRBaseMaterial",function(){return Ro}),i.d(t,"PBRBaseSimpleMaterial",function(){return Ha}),i.d(t,"PBRMaterial",function(){return xo}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return Xa}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return Ya}),i.d(t,"ColorGradingTexture",function(){return Qa}),i.d(t,"RawCubeTexture",function(){return fs}),i.d(t,"RawTexture3D",function(){return ps}),i.d(t,"RefractionTexture",function(){return _s}),i.d(t,"VideoTexture",function(){return ko}),i.d(t,"HtmlElementTexture",function(){return ms}),i.d(t,"NodeMaterialBlockTargets",function(){return hs}),i.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return ds}),i.d(t,"NodeMaterialConnectionPoint",function(){return gs}),i.d(t,"NodeMaterialBlock",function(){return ys}),i.d(t,"NodeMaterialDefines",function(){return Ms}),i.d(t,"NodeMaterial",function(){return Os}),i.d(t,"NodeMaterialSystemValues",function(){return Ss}),i.d(t,"_DDSTextureLoader",function(){return Fo}),i.d(t,"_ENVTextureLoader",function(){return No}),i.d(t,"_KTXTextureLoader",function(){return Uo}),i.d(t,"_TGATextureLoader",function(){return Ja}),i.d(t,"_BasisTextureLoader",function(){return is}),i.d(t,"CustomProceduralTexture",function(){return cs}),i.d(t,"NoiseProceduralTexture",function(){return us}),i.d(t,"ProceduralTexture",function(){return as}),i.d(t,"ProceduralTextureSceneComponent",function(){return rs}),i.d(t,"MultiplyBlock",function(){return zs}),i.d(t,"AddBlock",function(){return js}),i.d(t,"ScaleBlock",function(){return Ws}),i.d(t,"ClampBlock",function(){return Hs}),i.d(t,"CrossBlock",function(){return Xs}),i.d(t,"DotBlock",function(){return Ys}),i.d(t,"TransformBlock",function(){return Es}),i.d(t,"RemapBlock",function(){return Ks}),i.d(t,"NormalizeBlock",function(){return qs}),i.d(t,"TrigonometryBlockOperations",function(){return Qs}),i.d(t,"TrigonometryBlock",function(){return Zs}),i.d(t,"ColorMergerBlock",function(){return Js}),i.d(t,"VectorMergerBlock",function(){return $s}),i.d(t,"ColorSplitterBlock",function(){return ec}),i.d(t,"VectorSplitterBlock",function(){return tc}),i.d(t,"LerpBlock",function(){return ic}),i.d(t,"DivideBlock",function(){return nc}),i.d(t,"SubtractBlock",function(){return rc}),i.d(t,"StepBlock",function(){return oc}),i.d(t,"OppositeBlock",function(){return ac}),i.d(t,"ViewDirectionBlock",function(){return sc}),i.d(t,"FresnelBlock",function(){return cc}),i.d(t,"MaxBlock",function(){return lc}),i.d(t,"MinBlock",function(){return uc}),i.d(t,"NodeMaterialOptimizer",function(){return hc}),i.d(t,"VertexOutputBlock",function(){return As}),i.d(t,"BonesBlock",function(){return Is}),i.d(t,"InstancesBlock",function(){return Ds}),i.d(t,"MorphTargetsBlock",function(){return Ls}),i.d(t,"LightInformationBlock",function(){return ws}),i.d(t,"FragmentOutputBlock",function(){return xs}),i.d(t,"AlphaTestBlock",function(){return Fs}),i.d(t,"ImageProcessingBlock",function(){return Ns}),i.d(t,"PerturbNormalBlock",function(){return Bs}),i.d(t,"FogBlock",function(){return Us}),i.d(t,"LightBlock",function(){return Vs}),i.d(t,"TextureBlock",function(){return ks}),i.d(t,"ReflectionTextureBlock",function(){return Gs}),i.d(t,"InputBlock",function(){return Cs}),i.d(t,"AnimatedInputBlockTypes",function(){return Rs}),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 Yn.a}),i.d(t,"SphericalPolynomial",function(){return Yn.b}),i.d(t,"PositionNormalVertex",function(){return Go}),i.d(t,"PositionNormalTextureVertex",function(){return zo}),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 Rc}),i.d(t,"Geometry",function(){return ba.a}),i.d(t,"GroundMesh",function(){return Ki}),i.d(t,"TrailMesh",function(){return xc}),i.d(t,"InstancedMesh",function(){return Cc.a}),i.d(t,"LinesMesh",function(){return Mc.b}),i.d(t,"InstancedLinesMesh",function(){return Mc.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 Wc}),i.d(t,"SimplificationSettings",function(){return Hc}),i.d(t,"SimplificationQueue",function(){return Xc}),i.d(t,"SimplificationType",function(){return zc}),i.d(t,"SimplicationQueueSceneComponent",function(){return Jc}),i.d(t,"Polygon",function(){return Fc}),i.d(t,"PolygonMeshBuilder",function(){return Nc}),i.d(t,"BaseSubMesh",function(){return bc.a}),i.d(t,"SubMesh",function(){return bc.b}),i.d(t,"MeshLODLevel",function(){return $c.a}),i.d(t,"TransformNode",function(){return Tr.a}),i.d(t,"BoxBuilder",function(){return dr.a}),i.d(t,"SphereBuilder",function(){return mr.a}),i.d(t,"CylinderBuilder",function(){return Ji.a}),i.d(t,"TorusBuilder",function(){return Zi}),i.d(t,"LinesBuilder",function(){return gr.a}),i.d(t,"PlaneBuilder",function(){return Er.a}),i.d(t,"GroundBuilder",function(){return Qi}),i.d(t,"DataBuffer",function(){return Xn.a}),i.d(t,"WebGLDataBuffer",function(){return el.a}),i.d(t,"DracoCompression",function(){return yc}),i.d(t,"TiledBoxBuilder",function(){return Ic}),i.d(t,"DiscBuilder",function(){return Oc}),i.d(t,"RibbonBuilder",function(){return La}),i.d(t,"HemisphereBuilder",function(){return Ir}),i.d(t,"TorusKnotBuilder",function(){return Dc}),i.d(t,"PolygonBuilder",function(){return Bc}),i.d(t,"ShapeBuilder",function(){return wa}),i.d(t,"LatheBuilder",function(){return Uc}),i.d(t,"TiledPlaneBuilder",function(){return Vc}),i.d(t,"TubeBuilder",function(){return kc}),i.d(t,"PolyhedronBuilder",function(){return Sr}),i.d(t,"IcoSphereBuilder",function(){return Gc}),i.d(t,"DecalBuilder",function(){return jc}),i.d(t,"MorphTarget",function(){return Sa}),i.d(t,"MorphTargetManager",function(){return Ra}),i.d(t,"RecastJSPlugin",function(){return tl}),i.d(t,"RecastJSCrowd",function(){return il}),i.d(t,"Node",function(){return B.a}),i.d(t,"Database",function(){return rl}),i.d(t,"BaseParticleSystem",function(){return fl}),i.d(t,"GPUParticleSystem",function(){return Cl}),i.d(t,"Particle",function(){return vl}),i.d(t,"ParticleHelper",function(){return Ol}),i.d(t,"ParticleSystem",function(){return El}),i.d(t,"_IDoNeedToBeInTheBuild",function(){return 42}),i.d(t,"ParticleSystemSet",function(){return Ml}),i.d(t,"SolidParticle",function(){return Il}),i.d(t,"ModelShape",function(){return Dl}),i.d(t,"DepthSortedParticle",function(){return Ll}),i.d(t,"SolidParticleSystem",function(){return Fl}),i.d(t,"SubEmitterType",function(){return nl}),i.d(t,"SubEmitter",function(){return yl}),i.d(t,"BoxParticleEmitter",function(){return ol}),i.d(t,"ConeParticleEmitter",function(){return al}),i.d(t,"CylinderParticleEmitter",function(){return sl}),i.d(t,"CylinderDirectedParticleEmitter",function(){return cl}),i.d(t,"HemisphericParticleEmitter",function(){return ll}),i.d(t,"PointParticleEmitter",function(){return ul}),i.d(t,"SphereParticleEmitter",function(){return hl}),i.d(t,"SphereDirectedParticleEmitter",function(){return dl}),i.d(t,"PhysicsEngine",function(){return Ma}),i.d(t,"PhysicsEngineSceneComponent",function(){return Ul}),i.d(t,"PhysicsHelper",function(){return Vl}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return Wl}),i.d(t,"PhysicsUpdraftEventOptions",function(){return Hl}),i.d(t,"PhysicsVortexEventOptions",function(){return Xl}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return Nl}),i.d(t,"PhysicsUpdraftMode",function(){return Bl}),i.d(t,"PhysicsImpostor",function(){return xa.a}),i.d(t,"PhysicsJoint",function(){return Ca.e}),i.d(t,"DistanceJoint",function(){return Ca.a}),i.d(t,"MotorEnabledJoint",function(){return Ca.d}),i.d(t,"HingeJoint",function(){return Ca.c}),i.d(t,"Hinge2Joint",function(){return Ca.b}),i.d(t,"CannonJSPlugin",function(){return Ia}),i.d(t,"AmmoJSPlugin",function(){return Fa}),i.d(t,"OimoJSPlugin",function(){return Da}),i.d(t,"AnaglyphPostProcess",function(){return hi}),i.d(t,"BlackAndWhitePostProcess",function(){return Kl}),i.d(t,"BloomEffect",function(){return eu}),i.d(t,"BloomMergePostProcess",function(){return $l}),i.d(t,"BlurPostProcess",function(){return Vr}),i.d(t,"ChromaticAberrationPostProcess",function(){return iu}),i.d(t,"CircleOfConfusionPostProcess",function(){return ru}),i.d(t,"ColorCorrectionPostProcess",function(){return au}),i.d(t,"ConvolutionPostProcess",function(){return cu}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return lu}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return hu}),i.d(t,"DepthOfFieldEffect",function(){return pu}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return du}),i.d(t,"DepthOfFieldMergePostProcess",function(){return fu}),i.d(t,"DisplayPassPostProcess",function(){return mu}),i.d(t,"ExtractHighlightsPostProcess",function(){return Zl}),i.d(t,"FilterPostProcess",function(){return vu}),i.d(t,"FxaaPostProcess",function(){return Tu}),i.d(t,"GrainPostProcess",function(){return Au}),i.d(t,"HighlightsPostProcess",function(){return Su}),i.d(t,"ImageProcessingPostProcess",function(){return Hi}),i.d(t,"MotionBlurPostProcess",function(){return Iu}),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 Lu}),i.d(t,"SharpenPostProcess",function(){return Fu}),i.d(t,"StereoscopicInterlacePostProcess",function(){return gi}),i.d(t,"TonemappingOperator",function(){return Zu}),i.d(t,"TonemapPostProcess",function(){return Ju}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return nh}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return Si}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return Li}),i.d(t,"PostProcessRenderEffect",function(){return Ql}),i.d(t,"PostProcessRenderPipeline",function(){return Nu}),i.d(t,"PostProcessRenderPipelineManager",function(){return Bu}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return Uu}),i.d(t,"DefaultRenderingPipeline",function(){return Vu}),i.d(t,"LensRenderingPipeline",function(){return zu}),i.d(t,"SSAO2RenderingPipeline",function(){return Hu}),i.d(t,"SSAORenderingPipeline",function(){return Yu}),i.d(t,"StandardRenderingPipeline",function(){return Qu}),i.d(t,"ReflectionProbe",function(){return Na}),i.d(t,"BoundingBoxRenderer",function(){return rh}),i.d(t,"DepthRenderer",function(){return ah}),i.d(t,"DepthRendererSceneComponent",function(){return sh}),i.d(t,"EdgesRenderer",function(){return hh}),i.d(t,"LineEdgesRenderer",function(){return dh}),i.d(t,"GeometryBufferRenderer",function(){return Cu}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return Mu}),i.d(t,"OutlineRenderer",function(){return _h}),i.d(t,"RenderingGroup",function(){return mh.a}),i.d(t,"RenderingGroupInfo",function(){return Mi.a}),i.d(t,"RenderingManager",function(){return Mi.b}),i.d(t,"UtilityLayerRenderer",function(){return pr.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 gh}),i.d(t,"SpriteManager",function(){return Eh}),i.d(t,"SpritePackedManager",function(){return Ah}),i.d(t,"SpriteSceneComponent",function(){return vh}),i.d(t,"_AlphaState",function(){return Ph.a}),i.d(t,"_DepthCullingState",function(){return Ph.b}),i.d(t,"_StencilState",function(){return Ph.c}),i.d(t,"AndOrNotEvaluator",function(){return Sh.a}),i.d(t,"AssetTaskState",function(){return Th}),i.d(t,"AbstractAssetTask",function(){return xh}),i.d(t,"AssetsProgressEvent",function(){return Ch}),i.d(t,"MeshAssetTask",function(){return Mh}),i.d(t,"TextFileAssetTask",function(){return Oh}),i.d(t,"BinaryFileAssetTask",function(){return Ih}),i.d(t,"ImageAssetTask",function(){return Dh}),i.d(t,"TextureAssetTask",function(){return Lh}),i.d(t,"CubeTextureAssetTask",function(){return wh}),i.d(t,"HDRCubeTextureAssetTask",function(){return Fh}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return Nh}),i.d(t,"AssetsManager",function(){return Bh}),i.d(t,"DDSTools",function(){return wo}),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 Uh}),i.d(t,"EnvironmentTextureTools",function(){return Zn}),i.d(t,"MeshExploder",function(){return Vh}),i.d(t,"FilesInput",function(){return kh}),i.d(t,"CubeMapToSphericalPolynomialTools",function(){return Co.a}),i.d(t,"KhronosTextureContainer",function(){return Bo}),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 Gh.a}),i.d(t,"RollingAverage",function(){return Gh.b}),i.d(t,"PromisePolyfill",function(){return zh.a}),i.d(t,"SceneOptimization",function(){return jh}),i.d(t,"TextureOptimization",function(){return Wh}),i.d(t,"HardwareScalingOptimization",function(){return Hh}),i.d(t,"ShadowsOptimization",function(){return Xh}),i.d(t,"PostProcessesOptimization",function(){return Yh}),i.d(t,"LensFlaresOptimization",function(){return Kh}),i.d(t,"CustomOptimization",function(){return Qh}),i.d(t,"ParticlesOptimization",function(){return qh}),i.d(t,"RenderTargetsOptimization",function(){return Zh}),i.d(t,"MergeMeshesOptimization",function(){return Jh}),i.d(t,"SceneOptimizerOptions",function(){return $h}),i.d(t,"SceneOptimizer",function(){return ed}),i.d(t,"SceneSerializer",function(){return rd}),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 od.a}),i.d(t,"TextureTools",function(){return ad}),i.d(t,"TGATools",function(){return Za}),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 sd}),i.d(t,"JoystickAxis",function(){return xt}),i.d(t,"VirtualJoystick",function(){return Mt}),i.d(t,"WorkerPool",function(){return pc}),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 cd}),i.d(t,"WebRequest",function(){return ss.a}),i.d(t,"InspectableType",function(){return Rh}),i.d(t,"BRDFTextureTools",function(){return no}),i.d(t,"RGBDTextureTools",function(){return io}),i.d(t,"ColorGradient",function(){return pl}),i.d(t,"Color3Gradient",function(){return _l}),i.d(t,"FactorGradient",function(){return ml}),i.d(t,"GradientHelper",function(){return gl}),i.d(t,"PerfCounter",function(){return Wo.a}),i.d(t,"RetryStrategy",function(){return ld.a}),i.d(t,"LoadFileError",function(){return ud.a}),i.d(t,"HDRTools",function(){return Aa}),i.d(t,"PanoramaToCubeMapTools",function(){return Ea})},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(39),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(){return 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 r});var n=i(0),r=function(){return 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(112),i(73),i(74),i(75),i(104),"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(10),o=i(7),a=i(93),s=i(27),c=i(3),l=i(79),u=function(){return 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._deleteBuffer=function(e){},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(113),r=i(88);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,"NativeEngine",function(){return n.NativeEngine}),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,"BackgroundMaterial",function(){return n.BackgroundMaterial}),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,"RGBDTextureTools",function(){return n.RGBDTextureTools}),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,"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,"NodeMaterialSystemValues",function(){return n.NodeMaterialSystemValues}),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,"OppositeBlock",function(){return n.OppositeBlock}),i.d(t,"ViewDirectionBlock",function(){return n.ViewDirectionBlock}),i.d(t,"FresnelBlock",function(){return n.FresnelBlock}),i.d(t,"MaxBlock",function(){return n.MaxBlock}),i.d(t,"MinBlock",function(){return n.MinBlock}),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,"LightInformationBlock",function(){return n.LightInformationBlock}),i.d(t,"FragmentOutputBlock",function(){return n.FragmentOutputBlock}),i.d(t,"AlphaTestBlock",function(){return n.AlphaTestBlock}),i.d(t,"ImageProcessingBlock",function(){return n.ImageProcessingBlock}),i.d(t,"PerturbNormalBlock",function(){return n.PerturbNormalBlock}),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,this),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;s=65536)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("undefined"!=typeof HTMLElement&&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("undefined"!=typeof HTMLElement&&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)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 e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(var t=0;t0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._bindedRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._bindedRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},e.prototype._queueNewFrame=function(t,i){return e.QueueNewFrame(t,i)},e.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._bindedRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._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;i=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},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||ArrayBuffer.isView(l)||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&&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,"a",function(){return n}),i.d(t,"d",function(){return r}),i.d(t,"b",function(){return o}),i.d(t,"c",function(){return a});var n=function(){function e(e,t,i,n){void 0===t&&(t=!1),this.initalize(e,t,i,n)}return e.prototype.initalize=function(e,t,i,n){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this},e}(),r=function(){return function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}}(),o=function(){function e(){}return e.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e0},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 s}),i.d(t,"b",function(){return c}),i.d(t,"c",function(){return l});var n=i(16),r=i(29),o=i(38),a=i(12),s=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.r=e,this.g=t,this.b=i}return e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},e.prototype.getClassName=function(){return"Color3"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*e^(255*this.g|0))^(255*this.b|0)},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,this},e.prototype.toColor4=function(e){return void 0===e&&(e=1),new c(this.r,this.g,this.b,e)},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b)},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,this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},e.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t)},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*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),this},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b)},e.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b)},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,this},e.prototype.clone=function(){return new e(this.r,this.g,this.b)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},e.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0;return"#"+n.a.ToHex(e)+n.a.ToHex(t)+n.a.ToHex(i)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toHSV=function(){var t=new e;return this.toHSVToRef(t),t},e.prototype.toHSVToRef=function(e){var t=this.r,i=this.g,n=this.b,r=Math.max(t,i,n),o=Math.min(t,i,n),a=0,s=0,c=r,l=r-o;0!==r&&(s=l/r),r!=o&&(r==t?(a=(i-n)/l,i=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;n>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&&r.a.IsNavigatorAvailable()&&!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 s});var n=i(0),r=i(4),o=i(21),a=i(11),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,l){void 0===s&&(s=!1),void 0===l&&(l=!1);var u=i.toString(),h=t.getScaledIntensity();l||t._uniformBuffer.bindToEffect(o,"Light"+u),e.BindLightProperties(t,o,i),t.diffuse.scaleToRef(h,c.c.Color3[0]),t._uniformBuffer.updateColor4("vLightDiffuse",c.c.Color3[0],s?t.radius:t.range,u),a&&(t.specular.scaleToRef(h,c.c.Color3[1]),t._uniformBuffer.updateColor3("vLightSpecular",c.c.Color3[1],u)),n.shadowsEnabled&&this.BindLightShadow(t,r,u,o),t._uniformBuffer.update()},e.BindLights=function(e,t,i,n,r,o,a){void 0===r&&(r=4),void 0===o&&(o=!1),void 0===a&&(a=!1);for(var s=Math.min(t.lightSources.length,r),c=0;c-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=1.401298e-45);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(11),l=i(4),u=i(35),h=i(6),d=i(68),f=i(78),p=i(15),_=i(9),m=i(12),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(98),i(99),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(100),i(101),i(139),i(111),i(102),i(115),i(103),i(140),i(141),i(132),i(133),i(116);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(112),i(117),i(89),i(90),i(91),i(74),i(75),i(143),i(104),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){var s=o._areLightsDisposed;o.markAsProcessed();var c=new h.c;o.REFLECTION&&c.addFallback(0,"REFLECTION"),o.SPECULAR&&c.addFallback(0,"SPECULAR"),o.BUMP&&c.addFallback(0,"BUMP"),o.PARALLAX&&c.addFallback(1,"PARALLAX"),o.PARALLAXOCCLUSION&&c.addFallback(0,"PARALLAXOCCLUSION"),o.SPECULAROVERALPHA&&c.addFallback(0,"SPECULAROVERALPHA"),o.FOG&&c.addFallback(1,"FOG"),o.POINTSIZE&&c.addFallback(0,"POINTSIZE"),o.LOGARITHMICDEPTH&&c.addFallback(0,"LOGARITHMICDEPTH"),p.a.HandleFallbacksForShadows(o,c,this._maxSimultaneousLights),o.SPECULARTERM&&c.addFallback(0,"SPECULARTERM"),o.DIFFUSEFRESNEL&&c.addFallback(1,"DIFFUSEFRESNEL"),o.OPACITYFRESNEL&&c.addFallback(2,"OPACITYFRESNEL"),o.REFLECTIONFRESNEL&&c.addFallback(3,"REFLECTIONFRESNEL"),o.EMISSIVEFRESNEL&&c.addFallback(4,"EMISSIVEFRESNEL"),o.FRESNEL&&c.addFallback(4,"FRESNEL"),o.MULTIVIEW&&c.addFallback(0,"MULTIVIEW");var d=[l.b.PositionKind];o.NORMAL&&d.push(l.b.NormalKind),o.UV1&&d.push(l.b.UVKind),o.UV2&&d.push(l.b.UV2Kind),o.VERTEXCOLOR&&d.push(l.b.ColorKind),p.a.PrepareAttributesForBones(d,e,o,c),p.a.PrepareAttributesForInstances(d,o),p.a.PrepareAttributesForMorphTargets(d,e,o);var f="default",m=["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"],g=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler"],v=["Material","Scene"];u.a&&(u.a.PrepareUniforms(m,o),u.a.PrepareSamplers(g,o)),p.a.PrepareUniformsAndSamplersList({uniformsNames:m,uniformBuffersNames:v,samplers:g,defines:o,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(f=this.customShaderNameResolve(f,m,v,g,o));var y=o.toString(),b=i.effect,T=r.getEngine().createEffect(f,{attributes:d,uniformsNames:m,uniformBuffersNames:v,samplers:g,defines:y,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS}},a);if(T)if(this.allowShaderHotSwapping&&b&&!T.isReady()){if(T=b,this._rebuildInParallel=!0,o.markAsUnprocessed(),s)return o._areLightsDisposed=!0,!1}else this._rebuildInParallel=!1,r.resetCachedMaterial(),i.setEffect(T,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,!1,this._rebuildInParallel),(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(11),s=i(28),c=i(76),l=i(12),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(39),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(97),a=i(46),s=i(3),c=i(107),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(8),a=i(0),s=i(19),c=i(37),l=i(51),u=(i(83),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,i){var o=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);var u=i||function(e){return o.attachedNode==e||e.isDescendantOf(o.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add(function(t,i){if(o.enabled)if(t.type==s.a.POINTERDOWN)o.startAndReleaseDragOnPointerEvents&&!o.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&u(t.pickInfo.pickedMesh)&&o._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint);else if(t.type==s.a.POINTERUP)o.startAndReleaseDragOnPointerEvents&&o.currentDraggingPointerID==t.event.pointerId&&o.releaseDrag();else if(t.type==s.a.POINTERMOVE){var n=t.event.pointerId;o.currentDraggingPointerID===e._AnyMouseID&&n!==e._AnyMouseID&&"mouse"==t.event.pointerType&&(o._lastPointerRay[o.currentDraggingPointerID]&&(o._lastPointerRay[n]=o._lastPointerRay[o.currentDraggingPointerID],delete o._lastPointerRay[o.currentDraggingPointerID]),o.currentDraggingPointerID=n),o._lastPointerRay[n]||(o._lastPointerRay[n]=new c.a(new a.e,new a.e)),t.pickInfo&&t.pickInfo.ray&&(o._lastPointerRay[n].origin.copyFrom(t.pickInfo.ray.origin),o._lastPointerRay[n].direction.copyFrom(t.pickInfo.ray.direction),o.currentDraggingPointerID==n&&o.dragging&&o._moveDrag(t.pickInfo.ray))}}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(function(){o._moving&&o.moveAttached&&(l.a._RemoveAndStorePivotPoint(o.attachedNode),o._targetPosition.subtractToRef(o.attachedNode.absolutePosition,o._tmpVector),o._tmpVector.scaleInPlace(o.dragDeltaRatio),o.attachedNode.getAbsolutePosition().addToRef(o._tmpVector,o._tmpVector),o.validateDrag(o._tmpVector)&&o.attachedNode.setAbsolutePosition(o._tmpVector),l.a._RestorePivotPoint(o.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(){return 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(11),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(11),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(29),c=i(11),l=function(){return 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(12),d=i(11),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(38),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(38),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(){return 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(39),jt=i(37);!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(96),Mi=i(106);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(80);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(){return 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.updateControllerLaserColor=!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(){return 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(123),Hn=i(105),Xn=i(79),Yn=i(71),Kn=i(49),Qn="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}";ni.a.ShadersStore.rgbdEncodePixelShader=Qn;var qn="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}";ni.a.ShadersStore.rgbdDecodePixelShader=qn;var Zn=function(){function e(){}return e.GetEnvInfo=function(t){for(var i=new DataView(t),n=0,r=0;r17)throw new Error("Exceeded maximum custom attributes");return"layout(location="+n+") "+e.prototype.attributeProcessor.call(this,t)},t.prototype.varyingProcessor=function(t,i){var n;return i?n=this._varyingLocationMap[t]:(n=this._varyingLocationCount++,this._varyingLocationMap[t]=n),"layout(location="+n+") "+e.prototype.varyingProcessor.call(this,t,i)},t.prototype.uniformProcessor=function(e){var t=e.match(/uniform\s+([^\s]+)\s+([^\s]+)\s*(?:\[.+\])?\s*;/),i=t[1],n=t[2];switch(i){case"sampler2D":case"samplerCube":var r=i.substr(7),o=this._textureCount++;return this._replacements.push({searchValue:new RegExp("\\b"+n+"\\b"),replaceValue:"sampler"+r+"("+n+"Texture, "+n+")"}),"layout(binding="+o+") uniform texture"+r+" "+n+"Texture;\nlayout(binding="+o+") uniform sampler "+n+";"}return this._uniforms.push(e),1===this._uniforms.length?"":""},t.prototype.preProcessor=function(e,t,i){return this._genericAttributeLocation=10,i||(this._varyingLocationCount=0,this._varyingLocationMap={}),this._replacements=[],this._textureCount=0,this._uniforms=[],e},t.prototype.postProcessor=function(t,i,n){return t=(t=(t=e.prototype.postProcessor.call(this,t,i,n)).replace("","uniform Frame {\n"+this._uniforms.join("\n")+"\n};")).replace("out vec4 glFragColor","layout(location=0) out vec4 glFragColor")},t}(Hn.a),ir=function(){function e(){this.isAsync=!1,this.isReady=!1}return e.prototype._handlesSpectorRebuildCallback=function(e){throw new Error("Not implemented")},e}(),nr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t}(Xn.a),rr=function(){function e(){}return e.POINT=0,e.MINPOINT_MAGPOINT_MIPPOINT=e.POINT,e.BILINEAR=1,e.MINLINEAR_MAGLINEAR_MIPPOINT=e.BILINEAR,e.TRILINEAR=2,e.MINLINEAR_MAGLINEAR_MIPLINEAR=e.TRILINEAR,e.ANISOTROPIC=3,e.POINT_COMPARE=4,e.TRILINEAR_COMPARE=5,e.MINBILINEAR_MAGPOINT=6,e.MINLINEAR_MAGPOINT_MIPLINEAR=e.MINBILINEAR_MAGPOINT,e.MINPOINT_MAGPOINT_MIPLINEAR=7,e.MINPOINT_MAGLINEAR_MIPPOINT=8,e.MINPOINT_MAGLINEAR_MIPLINEAR=9,e.MINLINEAR_MAGPOINT_MIPPOINT=10,e}(),or=function(){function e(){}return e.WRAP=0,e.MIRROR=1,e.CLAMP=2,e.BORDER=3,e.MIRROR_ONCE=4,e}(),ar=function(e){function t(){var t=e.call(this,null)||this;return t._native=nativeEngine,t._webGLVersion=2,t.disableUniformBuffers=!0,t._caps=new Ce.c,t._caps.maxTexturesImageUnits=16,t._caps.maxVertexTextureImageUnits=16,t._caps.maxTextureSize=512,t._caps.maxCubemapTextureSize=512,t._caps.maxRenderTextureSize=512,t._caps.maxVertexAttribs=16,t._caps.maxVaryingVectors=16,t._caps.maxFragmentUniformVectors=16,t._caps.maxVertexUniformVectors=16,t._caps.standardDerivatives=!0,t._caps.astc=null,t._caps.s3tc=null,t._caps.pvrtc=null,t._caps.etc1=null,t._caps.etc2=null,t._caps.maxAnisotropy=16,t._caps.uintIndices=!1,t._caps.fragmentDepthSupported=!1,t._caps.highPrecisionShaderSupported=!0,t._caps.colorBufferFloat=!1,t._caps.textureFloat=!1,t._caps.textureFloatLinearFiltering=!1,t._caps.textureFloatRender=!1,t._caps.textureHalfFloat=!1,t._caps.textureHalfFloatLinearFiltering=!1,t._caps.textureHalfFloatRender=!1,t._caps.textureLOD=!0,t._caps.drawBuffersExtension=!1,t._caps.depthTextureExtension=!1,t._caps.vertexArrayObject=!0,t._caps.instancedArrays=!1,Ie.b.Log("Babylon Native (v"+Ce.b.Version+") launched"),"undefined"==typeof URL&&(window.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(window.Blob=function(){}),t._shaderProcessor=new tr,t}return h.d(t,e),t.prototype.getHardwareScalingLevel=function(){return 1},t.prototype._queueNewFrame=function(e,t){return this._native.requestAnimationFrame(e),0},t.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1),this._native.clear(e.r,e.g,e.b,e.a,t,i,n)},t.prototype.createIndexBuffer=function(e){var t=this._normalizeIndexData(e),i=new nr;return i.references=1,i.is32Bits=4===t.BYTES_PER_ELEMENT,i.nativeIndexBuffer=this._native.createIndexBuffer(t),i},t.prototype.createVertexBuffer=function(e){var t=new nr;return t.references=1,t.nativeVertexBuffer=this._native.createVertexBuffer(ArrayBuffer.isView(e)?e:new Float32Array(e)),t},t.prototype.recordVertexArrayObject=function(e,t,i){var n=this._native.createVertexArray();t&&this._native.recordIndexBuffer(n,t.nativeIndexBuffer);for(var r=i.getAttributesNames(),o=0;o=0){var s=e[r[o]];if(s){var c=s.getBuffer();c&&this._native.recordVertexBuffer(n,c.nativeVertexBuffer,a,s.byteOffset,s.byteStride,s.getSize(),s.type,s.normalized)}}}return n},t.prototype.bindVertexArrayObject=function(e){this._native.bindVertexArray(e)},t.prototype.releaseVertexArrayObject=function(e){this._native.deleteVertexArray(e)},t.prototype.getAttributes=function(e,t){var i=e;return this._native.getAttributes(i.nativeProgram,t)},t.prototype.drawElementsType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._native.drawIndexed(e,t,i)},t.prototype.drawArraysType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._native.draw(e,t,i)},t.prototype.createPipelineContext=function(){return new ir},t.prototype._preparePipelineContext=function(e,t,i,n,r,o,a){var s=e;s.nativeProgram=n?this.createRawShaderProgram(e,t,i,void 0,a):this.createShaderProgram(e,t,i,o,void 0,a)},t.prototype._isRenderingStateCompiled=function(e){return!0},t.prototype._executeWhenRenderingStateIsCompiled=function(e,t){t()},t.prototype.createRawShaderProgram=function(e,t,i,n,r){throw void 0===r&&(r=null),new Error("Not Supported")},t.prototype.createShaderProgram=function(e,t,i,n,r,o){void 0===o&&(o=null),this.onBeforeShaderCompilationObservable.notifyObservers(this);var a=this._native.createProgram(Ce.b._concatenateShader(t,n),Ce.b._concatenateShader(i,n));return this.onAfterShaderCompilationObservable.notifyObservers(this),a},t.prototype._setProgram=function(e){this._currentProgram!==e&&(this._native.setProgram(e),this._currentProgram=e)},t.prototype._releaseEffect=function(e){},t.prototype._deletePipelineContext=function(e){},t.prototype.getUniforms=function(e,t){var i=e;return this._native.getUniforms(i.nativeProgram,t)},t.prototype.bindUniformBlock=function(e,t,i){throw new Error("Not Implemented")},t.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.nativeProgram);for(var i=e.getSamplers(),n=0;n-1?d.substring(g).toLowerCase():""),y=null,b=0,T=Ce.b._TextureLoaders;b-1?e.substring(p).toLowerCase():"")))throw new Error("Cannot load cubemap: non-ENV format not supported.");if(i&&6===i.length)throw new Error("Multi-file loading not yet supported.");return this._loadFile(e,function(e){e=e;var t=Zn.GetEnvInfo(e);if(f.width=t.width,f.height=t.width,Zn.UploadEnvSpherical(f,t),1!==t.version)throw new Error('Unsupported babylon environment map version "'+t.version+'"');var i=t.specular;if(!i)throw new Error("Nothing else parsed so far");f._lodGenerationScale=i.lodGenerationScale;var n=Zn.CreateImageDataArrayBufferViews(e,t);f.format=Ce.b.TEXTUREFORMAT_RGBA,f.type=Ce.b.TEXTURETYPE_UNSIGNED_INT,f.generateMipMaps=!0,f.getEngine().updateTextureSamplingMode($e.a.TRILINEAR_SAMPLINGMODE,f),f._isRGBD=!0,f.invertY=!0,d._native.loadCubeTexture(f._webGLTexture,n,!0),f.isReady=!0,r&&r()},void 0,void 0,!0,function(e,t){o&&e&&o(e.status+" "+e.statusText,t)}),this._internalTexturesCache.push(f),f},t.prototype._getSamplingFilter=function(e){switch(e){case Ce.b.TEXTURE_BILINEAR_SAMPLINGMODE:return rr.MINLINEAR_MAGLINEAR_MIPPOINT;case Ce.b.TEXTURE_TRILINEAR_SAMPLINGMODE:return rr.MINLINEAR_MAGLINEAR_MIPLINEAR;case Ce.b.TEXTURE_NEAREST_SAMPLINGMODE:return rr.MINPOINT_MAGPOINT_MIPLINEAR;case Ce.b.TEXTURE_NEAREST_NEAREST_MIPNEAREST:return rr.MINPOINT_MAGPOINT_MIPPOINT;case Ce.b.TEXTURE_NEAREST_LINEAR_MIPNEAREST:return rr.MINLINEAR_MAGPOINT_MIPPOINT;case Ce.b.TEXTURE_NEAREST_LINEAR_MIPLINEAR:case Ce.b.TEXTURE_NEAREST_LINEAR:return rr.MINLINEAR_MAGPOINT_MIPLINEAR;case Ce.b.TEXTURE_NEAREST_NEAREST:return rr.MINPOINT_MAGPOINT_MIPPOINT;case Ce.b.TEXTURE_LINEAR_NEAREST_MIPNEAREST:return rr.MINPOINT_MAGLINEAR_MIPPOINT;case Ce.b.TEXTURE_LINEAR_NEAREST_MIPLINEAR:return rr.MINPOINT_MAGLINEAR_MIPLINEAR;case Ce.b.TEXTURE_LINEAR_LINEAR:return rr.MINLINEAR_MAGLINEAR_MIPLINEAR;case Ce.b.TEXTURE_LINEAR_NEAREST:return rr.MINPOINT_MAGLINEAR_MIPLINEAR;default:throw new Error("Unexpected sampling mode: "+e+".")}},t.prototype.createRenderTargetTexture=function(e,t){var i=new $n.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?Ce.b.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?$e.a.TRILINEAR_SAMPLINGMODE:t.samplingMode):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=Ce.b.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=$e.a.TRILINEAR_SAMPLINGMODE);var n=new et.a(this,et.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},t.prototype.updateTextureSamplingMode=function(e,t){if(t._webGLTexture){var i=this._getSamplingFilter(e);this._native.setTextureSampling(t._webGLTexture,i)}t.samplingMode=e},t.prototype.bindFramebuffer=function(e,t,i,n,r){throw new Error("bindFramebuffer not yet implemented.")},t.prototype.unBindFramebuffer=function(e,t,i){throw void 0===t&&(t=!1),new Error("unBindFramebuffer not yet implemented.")},t.prototype.createDynamicVertexBuffer=function(e){throw new Error("createDynamicVertexBuffer not yet implemented.")},t.prototype.updateDynamicIndexBuffer=function(e,t,i){throw void 0===i&&(i=0),new Error("updateDynamicIndexBuffer not yet implemented.")},t.prototype.updateDynamicVertexBuffer=function(e,t,i,n){throw new Error("updateDynamicVertexBuffer not yet implemented.")},t.prototype._setTexture=function(e,t,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1);var r,o=this._boundUniforms[e];if(!o)return!1;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._native.setTexture(o,null)),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===Ce.b.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;return r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:this.emptyTexture,this._activeChannel=e,!(!r||!r._webGLTexture)&&(this._native.setTextureWrapMode(r._webGLTexture,this._getAddressMode(t.wrapU),this._getAddressMode(t.wrapV),this._getAddressMode(t.wrapR)),this._updateAnisotropicLevel(t),this._native.setTexture(o,r._webGLTexture),!0)},t.prototype._updateAnisotropicLevel=function(e){var t=e.getInternalTexture(),i=e.anisotropicFilteringLevel;t&&t._webGLTexture&&t._cachedAnisotropicFilteringLevel!==i&&(this._native.setTextureAnisotropicLevel(t._webGLTexture,i),t._cachedAnisotropicFilteringLevel=i)},t.prototype._getAddressMode=function(e){switch(e){case Ce.b.TEXTURE_WRAP_ADDRESSMODE:return or.WRAP;case Ce.b.TEXTURE_CLAMP_ADDRESSMODE:return or.CLAMP;case Ce.b.TEXTURE_MIRROR_ADDRESSMODE:return or.MIRROR;default:throw new Error("Unexpected wrap mode: "+e+".")}},t.prototype._bindTexture=function(e,t){throw new Error("_bindTexture not implemented.")},t.prototype._deleteBuffer=function(e){e.nativeIndexBuffer&&(this._native.deleteIndexBuffer(e.nativeIndexBuffer),delete e.nativeIndexBuffer),e.nativeVertexBuffer&&(this._native.deleteVertexBuffer(e.nativeVertexBuffer),delete e.nativeVertexBuffer)},t.prototype.releaseEffects=function(){},t.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){throw void 0===o&&(o=0),void 0===a&&(a=0),new Error("_uploadCompressedDataToTextureDirectly not implemented.")},t.prototype._uploadDataToTextureDirectly=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadDataToTextureDirectly not implemented.")},t.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},t.prototype._uploadImageToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},t}(Ce.b),sr=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),cr=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return sr.COPY;case 86:return sr.PASTE;case 88:return sr.CUT;default:return-1}},e}(),lr=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(lr.GAMEPAD_ID_PREFIX)},create:function(e){return new lr(e)}});var ur=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}(fr.a),mr=i(48),gr=i(45),vr=function(e){function t(t,i){void 0===t&&(t=s.a.Gray()),void 0===i&&(i=pr.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(gr.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(n._boundingDimensions.x,0,0)]},i.utilityLayerScene)),r.push(gr.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(gr.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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(gr.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=mr.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=dr.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=dr.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}(fr.a),yr=function(e){function t(t,i,n,r,c,l){void 0===i&&(i=s.a.Gray()),void 0===n&&(n=pr.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}(fr.a),br=function(e){function t(t,i,n){void 0===t&&(t=pr.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 yr(new a.e(1,0,0),s.a.Red().scale(.5),t,i,r,n),r.yGizmo=new yr(new a.e(0,1,0),s.a.Green().scale(.5),t,i,r,n),r.zGizmo=new yr(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}(fr.a),Tr=i(41),Er=i(83),Ar=function(e){function t(i,n,r,c){void 0===n&&(n=s.a.Gray()),void 0===r&&(r=pr.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 Tr.a("plane",e),n=Er.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 Tr.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.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?(this.getScene().useRightHandedSystem?e.setFloat3(t,-this.transformedDirection.x,-this.transformedDirection.y,-this.transformedDirection.z):e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(this.getScene().useRightHandedSystem?e.setFloat3(t,-this.direction.x,-this.direction.y,-this.direction.z):e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),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}(Mr);Se.a.CreateHemisphere=function(e,t,i,n){var r={segments:t,diameter:i};return Ir.CreateHemisphere(e,r,n)};var Ir=function(){function e(){}return e.CreateHemisphere=function(e,t,i){t.diameter||(t.diameter=1),t.segments||(t.segments=16);var n=mr.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 Dr(e,a.e.Zero(),a.e.Zero(),0,0,t)}});var Dr=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 Cr.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.transferToNodeMaterialEffect=function(e,t){var i;return i=this.computeTransformedInformation()?a.e.Normalize(this.transformedDirection):a.e.Normalize(this.direction),this.getScene().useRightHandedSystem?e.setFloat3(t,-i.x,-i.y,-i.z):e.setFloat3(t,i.x,i.y,i.z),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}(Mr),Lr=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 Or?t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof Dr?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=Ir.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=mr.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);mr.a.CreateSphere(i.name,{segments:10,diameter:1},e).parent=i;var n=Ir.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,mr.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}(fr.a);ni.a.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};";var wr="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=wr;var Fr="#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=Fr;var Nr="#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=Nr;var Br="\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=Br;ni.a.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";var Ur="\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=Ur;var Vr=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),kr=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 Vr("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 Vr("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 kr(e,t,i,n)};var Gr=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=Gr.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(jr.a.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),jr.a.PrepareDefinesForFrameBoundValues(r,a,o,i),jr.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"),jr.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),jr.a.PrepareAttributesForBones(l,e,o,c),jr.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)),jr.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),jr.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&&Xr.a.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),jr.a.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),s&&Xr.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&&Xr.a.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),s&&Xr.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)))),jr.a.BindClipPlane(this._activeEffect,n),jr.a.BindEyePosition(o,n)}!a&&this.isFrozen||(n.lightsEnabled&&jr.a.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights,!1),this.bindView(o),jr.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}(Hr.a);c.a.RegisteredTypes["BABYLON.BackgroundMaterial"]=$r;var eo=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 Kn.a)this._scene.environmentTexture=this._options.environmentTexture;else{var e=zr.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 $r("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 Kn.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 kr("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;i0&&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}(),oo=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&&Xr.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&&Xr.a.AnisotropicTextureEnabled?jr.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&&Xr.a.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),jr.a.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&Xr.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}(),ao=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}(),so=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&&Xr.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&&Xr.a.SheenTextureEnabled?jr.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&&Xr.a.SheenTextureEnabled&&(e.updateFloat2("vSheenInfos",this._texture.coordinatesIndex,this._texture.level),jr.a.BindTextureMatrix(this._texture,e,"sheen")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity)),t.texturesEnabled&&this._texture&&Xr.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}(),co=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&&Xr.a.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&Xr.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&&Xr.a.ThicknessTextureEnabled&&jr.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&&Xr.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&&Xr.a.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),jr.a.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),o&&Xr.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&&Xr.a.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),o&&Xr.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){Xr.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!!(Xr.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}(),lo="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=lo;var uo="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=uo;var ho="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=ho;var fo="#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=fo;i(102);var po="\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=po;var _o="#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=_o;var mo="\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=mo;var go="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=go;var vo="\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) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(environmentBrdfSampler,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=vo;var yo="#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=yo;var bo="#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=bo;i(139),i(140),i(141),i(133);var To="#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 So);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&&Xr.a.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&Xr.a.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&Xr.a.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var a=this._getReflectionTexture();if(a&&Xr.a.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;if(a.irradianceTexture&&!a.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&Xr.a.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&Xr.a.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(Xr.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&&Xr.a.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&Xr.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=n._areLightsDisposed,l=this._prepareEffect(e,n,this.onCompiled,this.onError,i);if(l)if(this.allowShaderHotSwapping&&s&&!l.isReady()){if(l=s,this._rebuildInParallel=!0,n.markAsUnprocessed(),c)return n._areLightsDisposed=!0,!1}else this._rebuildInParallel=!1,r.resetCachedMaterial(),t.setEffect(l,n),this.buildUniformLayout();return!(!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=oo.AddFallbacks(t,s,c),c=oo.AddFallbacks(t,s,c),c=co.AddFallbacks(t,s,c),c=so.AddFallbacks(t,s,c),t.ENVIRONMENTBRDF&&s.addFallback(c++,"ENVIRONMENTBRDF"),t.TANGENT&&s.addFallback(c++,"TANGENT"),t.BUMP&&s.addFallback(c++,"BUMP"),c=jr.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),jr.a.PrepareAttributesForBones(l,e,t,s),jr.a.PrepareAttributesForInstances(l,t),jr.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"];co.AddUniforms(h),co.AddSamplers(d),ro.AddUniforms(h),ro.AddSamplers(d),oo.AddUniforms(h),oo.AddSamplers(d),so.AddUniforms(h),so.AddSamplers(d),Gi.a&&(Gi.a.PrepareUniforms(h,t),Gi.a.PrepareSamplers(d,t)),jr.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(jr.a.PrepareDefinesForLights(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,jr.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&&Xr.a.DiffuseTextureEnabled?jr.a.PrepareDefinesForMergedUV(this._albedoTexture,i,"ALBEDO"):i.ALBEDO=!1,this._ambientTexture&&Xr.a.AmbientTextureEnabled?(jr.a.PrepareDefinesForMergedUV(this._ambientTexture,i,"AMBIENT"),i.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):i.AMBIENT=!1,this._opacityTexture&&Xr.a.OpacityTextureEnabled?(jr.a.PrepareDefinesForMergedUV(this._opacityTexture,i,"OPACITY"),i.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):i.OPACITY=!1;var s=this._getReflectionTexture();if(s&&Xr.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&&Xr.a.LightmapTextureEnabled?(jr.a.PrepareDefinesForMergedUV(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,i.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):i.LIGHTMAP=!1,this._emissiveTexture&&Xr.a.EmissiveTextureEnabled?jr.a.PrepareDefinesForMergedUV(this._emissiveTexture,i,"EMISSIVE"):i.EMISSIVE=!1,Xr.a.SpecularTextureEnabled?(this._metallicTexture?(jr.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?(jr.a.PrepareDefinesForMergedUV(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):i.REFLECTIVITY=!1,this._microSurfaceTexture?jr.a.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),o.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&Xr.a.BumpTextureEnabled&&!this._disableBumpMap?(jr.a.PrepareDefinesForMergedUV(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&Xr.a.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):i.BUMP=!1,this._environmentBRDFTexture&&Xr.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&&(jr.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),jr.a.PrepareDefinesForFrameBoundValues(o,a,i,!!n,r),jr.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 So,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),ro.PrepareUniformBuffer(e),oo.PrepareUniformBuffer(e),so.PrepareUniformBuffer(e),co.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);jr.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&&Xr.a.DiffuseTextureEnabled&&(u.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),jr.a.BindTextureMatrix(this._albedoTexture,u,"albedo")),this._ambientTexture&&Xr.a.AmbientTextureEnabled&&(u.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),jr.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&Xr.a.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),jr.a.BindTextureMatrix(this._opacityTexture,u,"opacity")),l&&Xr.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&&Xr.a.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),jr.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&Xr.a.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),jr.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),Xr.a.SpecularTextureEnabled&&(this._metallicTexture?(u.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),jr.a.BindTextureMatrix(this._metallicTexture,u,"reflectivity")):this._reflectivityTexture&&(u.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),jr.a.BindTextureMatrix(this._reflectivityTexture,u,"reflectivity")),this._microSurfaceTexture&&(u.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),jr.a.BindTextureMatrix(this._microSurfaceTexture,u,"microSurfaceSampler"))),this._bumpTexture&&h.getCaps().standardDerivatives&&Xr.a.BumpTextureEnabled&&!this._disableBumpMap&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),jr.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",Xr.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&&Xr.a.DiffuseTextureEnabled&&u.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&Xr.a.AmbientTextureEnabled&&u.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&Xr.a.OpacityTextureEnabled&&u.setTexture("opacitySampler",this._opacityTexture),l&&Xr.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&&Xr.a.EmissiveTextureEnabled&&u.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&Xr.a.LightmapTextureEnabled&&u.setTexture("lightmapSampler",this._lightmapTexture),Xr.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&&Xr.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),jr.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&&jr.a.BindLights(r,i,this._activeEffect,o,this._maxSimultaneousLights,this._lightFalloff!==t.LIGHTFALLOFF_STANDARD,this._rebuildInParallel),(r.fogEnabled&&i.applyFog&&r.fogMode!==K.a.FOGMODE_NONE||l)&&this.bindView(a),jr.a.BindFogParameters(r,i,this._activeEffect,!0),o.NUM_MORPH_INFLUENCERS&&jr.a.BindMorphTargetParameters(i,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),jr.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}(Hr.a),xo=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=no.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===Ro.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Ro.LIGHTFALLOFF_PHYSICAL:Ro.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===Ro.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Ro.LIGHTFALLOFF_GLTF:Ro.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=Ro.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=Ro.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=Ro.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=Ro.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=Ro.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}(Ro);c.a.RegisteredTypes["BABYLON.PBRMaterial"]=xo;var Co=i(84);function Mo(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var Oo=Mo("DXT1"),Io=Mo("DXT3"),Do=Mo("DXT5"),Lo=Mo("DX10"),wo=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===Lo?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 Lo: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===Oo||r===Io||r===Do,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=Co.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 Yn.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),wo.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 Kn.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 Fo=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),wo.UploadDDSLevels(a,t,l,o,s,6,-1,c),o.isFourCC||1!==o.mipmapCount||a.generateMipMapsForCubemap(t)}else{var u=e;o=wo.GetDDSInfo(u),t.width=o.width,t.height=o.height,i&&(o.sphericalPolynomial=new Yn.b),s=(o.isRGB||o.isLuminance||o.mipmapCount>1)&&t.generateMipMaps,a._unpackFlipY(o.isCompressed),wo.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=wo.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(){wo.UploadDDSLevels(t.getEngine(),t,e,n,r,1)})},e}();Ce.b._TextureLoaders.push(new Fo);var No=function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e,t,i,n,r){return 0===e.indexOf(".env")},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){if(!Array.isArray(e)){e=e;var o=Zn.GetEnvInfo(e);o?(t.width=o.width,t.height=o.width,Zn.UploadEnvSpherical(t,o),Zn.UploadEnvLevelsAsync(t,e,o).then(function(){t.isReady=!0,n&&n()})):r&&r("Can not parse the environment file",null)}},e.prototype.loadData=function(e,t,i){throw".env not supported in 2d."},e}();Ce.b._TextureLoaders.push(new No);var Bo=function(){function e(t,i,n,r){this.arrayBuffer=t,this.isInvalid=!1;var o=new Uint8Array(this.arrayBuffer,0,12);if(171!==o[0]||75!==o[1]||84!==o[2]||88!==o[3]||32!==o[4]||49!==o[5]||49!==o[6]||187!==o[7]||13!==o[8]||10!==o[9]||26!==o[10]||10!==o[11])return this.isInvalid=!0,void m.a.Error("texture missing KTX identifier");var a=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,12,13*a),c=67305985===s.getUint32(0,!0);this.glType=s.getUint32(1*a,c),this.glTypeSize=s.getUint32(2*a,c),this.glFormat=s.getUint32(3*a,c),this.glInternalFormat=s.getUint32(4*a,c),this.glBaseInternalFormat=s.getUint32(5*a,c),this.pixelWidth=s.getUint32(6*a,c),this.pixelHeight=s.getUint32(7*a,c),this.pixelDepth=s.getUint32(8*a,c),this.numberOfArrayElements=s.getUint32(9*a,c),this.numberOfFaces=s.getUint32(10*a,c),this.numberOfMipmapLevels=s.getUint32(11*a,c),this.bytesOfKeyValueData=s.getUint32(12*a,c),0===this.glType?(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===i?this.loadType=e.COMPRESSED_2D:m.a.Error("number of faces expected"+i+", but found "+this.numberOfFaces):m.a.Error("texture arrays not currently supported"):m.a.Error("only 2D textures currently supported")):m.a.Error("only compressed formats currently supported")}return e.prototype.uploadLevels=function(t,i){switch(this.loadType){case e.COMPRESSED_2D:this._upload2DCompressedLevels(t,i);break;case e.TEX_2D:case e.COMPRESSED_3D:case e.TEX_3D:}},e.prototype._upload2DCompressedLevels=function(t,i){for(var n=e.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,o=this.pixelHeight,a=i?this.numberOfMipmapLevels:1,s=0;s-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 Bo(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 Bo(e,1);i(n.pixelWidth,n.pixelHeight,!1,!0,function(){n.uploadLevels(t,t.generateMipMaps)},n.isInvalid)},e}();Ce.b._TextureLoaders.unshift(new Uo);var Vo=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),Go=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}(),zo=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}(),jo=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 $r(i+"_material",o),u=s._videoTexture=new ko(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=mr.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}(Tr.a),Wo=i(47),Ho=function(){function e(e){this.engine=e,this._captureGPUFrameTime=!1,this._gpuFrameTime=new Wo.a,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new Wo.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}(),Xo=function(){function e(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new Wo.a,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new Wo.a,this._captureFrameTime=!1,this._frameTime=new Wo.a,this._captureRenderTime=!1,this._renderTime=new Wo.a,this._captureInterFrameTime=!1,this._interFrameTime=new Wo.a,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new Wo.a,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new Wo.a,this._capturePhysicsTime=!1,this._physicsTime=new Wo.a,this._captureAnimationsTime=!1,this._animationsTime=new Wo.a,this._captureCameraRenderTime=!1,this._cameraRenderTime=new Wo.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}(),Yo=i(25),Ko="#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),jr.a.PrepareAttributesForMorphTargetsInfluencers(o,a,m)),t&&(r.push("#define INSTANCES"),jr.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}(),oa="\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=oa;var aa="\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=aa;var sa=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 ra(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(Yo.a.TriangleFillMode,0,6):(t.setAlphaMode(this.alphaBlendingMode),t.drawElementsType(Yo.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}(),ca=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}(),la="\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=la;var ua="\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=ua;var ha=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}();ha._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_LENSFLARESYSTEM);t||(t=new da(e),e._addComponent(t))};var fa="#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=fa;var pa="\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=pa;var _a="\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=_a;var ma=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 Vr(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 Vr(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()===Cr.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),jr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,u)),t&&(i.push("#define INSTANCES"),jr.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}(),Aa=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 Ea.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}(Kn.a);c.a.RegisteredTypes["BABYLON.HDRCubeTexture"]=Pa;var Sa=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 Ca.e.HingeJoint:case Ca.e.Hinge2Joint:n=new this.BJSCANNON.HingeConstraint(t,i,o);break;case Ca.e.DistanceJoint:n=new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance||2);break;case Ca.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 Ca.e.LockJoint:n=new this.BJSCANNON.LockConstraint(t,i,o);break;case Ca.e.PointToPointJoint:case Ca.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!==Ca.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!==Ca.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}();Ma.DefaultPluginFactory=function(){return new Ia};var Da=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 Oa}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,Ma.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 xa.a.ParticleImpostor:m.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case xa.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 xa.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 xa.a.PlaneImpostor:case xa.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 Ca.e.BallAndSocketJoint:n="jointBall";break;case Ca.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 Ca.e.DistanceJoint:n="jointDistance",a.max=r.maxDistance;break;case Ca.e.PrismaticJoint:n="jointPrisme";break;case Ca.e.SliderJoint:n="jointSlide";break;case Ca.e.WheelJoint:n="jointWheel";break;case Ca.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=La.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}(),Fa=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 Oa,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!=xa.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 xa.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 xa.a.CapsuleImpostor:n=new Ammo.btCapsuleShape(o.x/2,o.y/2);break;case xa.a.CylinderImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btCylinderShape(this._tmpAmmoVectorA);break;case xa.a.PlaneImpostor:case xa.a.BoxImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btBoxShape(this._tmpAmmoVectorA);break;case xa.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 xa.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 xa.a.NoImpostor:n=new Ammo.btSphereShape(o.x/2);break;case xa.a.SoftbodyImpostor:n=this._createSoftbody(e);break;case xa.a.ClothImpostor:n=this._createCloth(e);break;case xa.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===xa.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 Na=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}},za=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 Pa((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e,p,!0,!f);l.environmentTextureRotationY&&(_.rotationY=l.environmentTextureRotationY),e.environmentTexture=_}else if(Ba.a.EndsWith(l.environmentTexture,".env")){var g=new zr((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e);l.environmentTextureRotationY&&(g.rotationY=l.environmentTextureRotationY),e.environmentTexture=g}else{var v=zr.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}(Kn.a);c.a.RegisteredTypes["BABYLON.ColorGradingTexture"]=Qa;var qa=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=Ea.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}(),Ja=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=Za.GetTGAHeader(n);i(r.width,r.height,t.generateMipMaps,!1,function(){Za.UploadContent(t,n)})},e}();Ce.b._TextureLoaders.push(new Ja);var $a;!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"}($a||($a={}));var es=function(){function e(){}return e.GetInternalFormatFromBasisFormat=function(e){if(e===$a.cTFETC1)return 36196;if(e===$a.cTFBC1)return 33776;if(e===$a.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(["("+ts+")()"],{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;es.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}};es.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(){es.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 is),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 ns=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),rs=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}(),os="\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=os;var as=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 rs(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(Yo.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(Yo.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),ss=i(66),cs=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 ss.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!==ds.AutoDetect){switch(this.type){case ds.Vector3:if(e.type===ds.Color3)return!0;case ds.Vector4:if(e.type===ds.Color4)return!0;case ds.Color3:if(e.type===ds.Vector3)return!0;case ds.Color4:if(e.type===ds.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}(),vs=i(129),ys=function(){function e(e,t,i,n){void 0===t&&(t=hs.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=vs.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 gs(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 gs(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._linkConnectionTypes=function(e,t){this._inputs[e]._linkedConnectionSource=this._inputs[t],this._inputs[t]._linkedConnectionSource=this._inputs[e]},e.prototype._processBuild=function(e,t,i,n){e.build(t,n);var r=null!=t._vertexState,o=e._buildTarget===hs.Vertex&&e.target!==hs.VertexAndFragment;if(r&&(0==(e.target&i.target)||this.target!==hs.VertexAndFragment&&o)&&(!e.isInput&&t.target!==e._buildTarget||e.isInput&&e.isAttribute)){var a=i.connectedPoint;t._vertexState._emitVaryingFromString("v_"+a.associatedVariableName,t._getGLType(a.type))&&(t._vertexState.compilationString+="v_"+a.associatedVariableName+" = "+a.associatedVariableName+";\r\n"),i.associatedVariableName="v_"+a.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&hs.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&hs.Fragment)&&this._addFragmentOutputNode(e),this},t.prototype.removeOutputNode=function(e){return null===e.target?this:(0!=(e.target&hs.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&hs.Fragment)&&this._removeFragmentOutputNode(e),this)},t.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=hs.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=hs.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),e._preparationId=this._buildId,-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}(),fc=function(){function e(e){var t,i=this;this.onApplyObservable=new o.c;var n=e.uniformNames||[];e.vertexShader?t={fragmentSource:e.fragmentShader,vertexSource:e.vertexShader,spectorName:e.name||"effectWrapper"}:(n.push("scale"),t={fragmentSource:e.fragmentShader,vertex:"postprocess",spectorName:e.name||"effectWrapper"},this.onApplyObservable.add(function(){i.effect.setFloat2("scale",1,1)})),this.effect=new ni.a(t,e.attributeNames||["position"],n,e.samplerNames,e.engine)}return e.prototype.dispose=function(){this.effect.dispose()},e}(),pc=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 Pc(f,t.shared)).plane&&r.push(d),p.length>=3&&(d=new Pc(p,t.shared)).plane&&o.push(d)}},e.EPSILON=1e-5,e}(),Pc=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}(),Sc=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}(),Fc=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=La.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){bc.b.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())}),bc.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=Za.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}(),ol=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}(),al=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}(),sl=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}(),cl=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}(sl),ll=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}(),ul=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}(),hl=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}(),dl=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}(hl),fl=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}(),vl=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"}(nl||(nl={}));var yl=function(){function e(e){this.particleSystem=e,this.type=nl.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}(),bl="\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=bl;var Tl="\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=Tl;var El=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 vl(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===nl.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===nl.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 ol,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?gl.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&&gl.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&&gl.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&&gl.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&&gl.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&&gl.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&&gl.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&&gl.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 pl;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);gl.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;gl.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;gl.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 pl;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 ml;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===El.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(Yo.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),jr.a.BindClipPlane(this._renderEffect,this._scene)}switch(this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._renderEffect),this.blendMode){case El.BLENDMODE_ADD:this._engine.setAlphaMode(g.a.ALPHA_ADD);break;case El.BLENDMODE_ONEONE:this._engine.setAlphaMode(g.a.ALPHA_ONEONE);break;case El.BLENDMODE_STANDARD:this._engine.setAlphaMode(g.a.ALPHA_COMBINE);break;case El.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(Yo.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 El._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),El._Parse(e,o,i,n),e.preventAutoStart&&(o.preventAutoStart=e.preventAutoStart),r||o.preventAutoStart||o.start(),o},t}(fl),Ml=(function(){}(),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=mr.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=this.nbParticles,P=this._posToShape(f),S=this._uvsToShapeUV(_);for(g.copyFromFloats(0,0,0),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===Nl.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=mr.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}(),Gl=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 Wl,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}(),zl=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 Hl,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===Bl.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===Bl.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}(),jl=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 Xl,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}(),Wl=function(){return function(){this.radius=5,this.strength=10,this.falloff=Nl.Constant,this.sphere={segments:32,diameter:1}}}(),Hl=function(){return function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=Bl.Center}}(),Xl=function(){return 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"}(Nl||(Nl={})),function(e){e[e.Center=0]="Center",e[e.Perpendicular=1]="Perpendicular"}(Bl||(Bl={}));var Yl="\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=Yl;var Kl=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),Ql=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),Eu="#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=Eu;var Au=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),Pu="\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=Pu;var Su=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 Ru="#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=Ru;var xu="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=xu;var Cu=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),jr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),jr.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 ns("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,Yo.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])),jr.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,Yo.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}(),Bu=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 Uu(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new Bu}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var Uu=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}(),Vu=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=hu.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 Fu("sharpen",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._sharpenEffect=new Ql(c,a.SharpenPostProcessId,function(){return a.sharpen},!0),a.depthOfField=new pu(a._scene,null,a._depthOfFieldBlurLevel,a._defaultPipelineTextureType,!0),a.bloom=new eu(a._scene,a._bloomScale,a._bloomWeight,a.bloomKernel,a._defaultPipelineTextureType,!0),a.chromaticAberration=new iu("ChromaticAberration",c.getRenderWidth(),c.getRenderHeight(),1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._chromaticAberrationEffect=new Ql(c,a.ChromaticAberrationPostProcessId,function(){return a.chromaticAberration},!0),a.grain=new Au("Grain",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._grainEffect=new Ql(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 eu(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 Ql(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 Tu("fxaa",1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new Ql(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 Ql(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 Ql(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 Vr("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 Vr("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 Ql(e.getEngine(),"HDRBlurH"+i,function(){return s},!0)),this.addEffect(new Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(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 Ql(e.getEngine(),"HDRDepthOfField",function(){return i.depthOfFieldPostProcess},!0))},t.prototype._createMotionBlurPostProcess=function(e,t){var i=this;if(this._isObjectBasedMotionBlur){var n=new Iu("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 Ql(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,Yo.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,Yo.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=oh;var ah=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,Yo.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)),jr.a.BindMorphTargetParameters(t,o._effect),t._processRendering(e,o._effect,Yo.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),jr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),jr.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 ah(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 sh=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}();ah._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_DEPTHRENDERER);t||(t=new sh(e),e._addComponent(t))};var ch="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}";ni.a.ShadersStore.linePixelShader=ch;var lh="\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=lh;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 hh(this,e,t),this},Object.defineProperty(Ye.a.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),Mc.b.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new dh(this,e,t),this},Mc.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),Mc.b.prototype.enableEdgesRendering.apply(this,arguments),this};var uh=function(){return function(){this.edges=new Array,this.edgesConnectedCount=0}}(),hh=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 Ka.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=fh;var ph="\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=ph;K.a.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new _h(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 _h=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)),jr.a.BindMorphTargetParameters(s,this._effect),s._bind(e,this._effect,Yo.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,Yo.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),jr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,s)),t&&(i.push("#define INSTANCES"),jr.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}(),mh=i(125),gh=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}(),yh="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=yh;var bh="\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=bh;var Th,Eh=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 vh(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 Ch(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}(),Gh=i(122),zh=i(121),jh=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}(),Wh=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}(jh),Hh=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}(jh),Xh=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}(jh),Yh=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}(jh),Kh=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}(jh),Qh=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}(jh),qh=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}(jh),Zh=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}(jh),Jh=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}(),cd=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 Tu("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=cd.CreateScreenshot,Ie.b.CreateScreenshotAsync=cd.CreateScreenshotAsync,Ie.b.CreateScreenshotUsingRenderTarget=cd.CreateScreenshotUsingRenderTarget,Ie.b.CreateScreenshotUsingRenderTargetAsync=cd.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"}(Rh||(Rh={}));var ld=i(120),ud=i(119);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,"NativeEngine",function(){return ar}),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 sr}),i.d(t,"ClipboardInfo",function(){return cr}),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 lr}),i.d(t,"GearVRController",function(){return ur}),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 hr.a}),i.d(t,"AxisScaleGizmo",function(){return _r}),i.d(t,"BoundingBoxGizmo",function(){return vr}),i.d(t,"Gizmo",function(){return fr.a}),i.d(t,"GizmoManager",function(){return xr}),i.d(t,"PlaneRotationGizmo",function(){return yr}),i.d(t,"PositionGizmo",function(){return Pr}),i.d(t,"RotationGizmo",function(){return br}),i.d(t,"ScaleGizmo",function(){return Rr}),i.d(t,"LightGizmo",function(){return Lr}),i.d(t,"PlaneDragGizmo",function(){return Ar}),i.d(t,"EnvironmentHelper",function(){return eo}),i.d(t,"PhotoDome",function(){return to}),i.d(t,"_forceSceneHelpersToBundle",function(){return!0}),i.d(t,"VideoDome",function(){return jo}),i.d(t,"EngineInstrumentation",function(){return Ho}),i.d(t,"SceneInstrumentation",function(){return Xo}),i.d(t,"_TimeToken",function(){return zn}),i.d(t,"EffectLayer",function(){return qo}),i.d(t,"EffectLayerSceneComponent",function(){return Zo}),i.d(t,"GlowLayer",function(){return ea}),i.d(t,"HighlightLayer",function(){return na}),i.d(t,"Layer",function(){return sa}),i.d(t,"LayerSceneComponent",function(){return ra}),i.d(t,"LensFlare",function(){return ca}),i.d(t,"LensFlareSystem",function(){return ha}),i.d(t,"LensFlareSystemSceneComponent",function(){return da}),i.d(t,"Light",function(){return Cr.a}),i.d(t,"ShadowLight",function(){return Mr}),i.d(t,"DirectionalLight",function(){return Or}),i.d(t,"HemisphericLight",function(){return Ui.a}),i.d(t,"PointLight",function(){return va}),i.d(t,"SpotLight",function(){return Dr}),i.d(t,"ShadowGenerator",function(){return ma}),i.d(t,"ShadowGeneratorSceneComponent",function(){return ga}),i.d(t,"DefaultLoadingScreen",function(){return ya}),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 ja.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 Wa}),i.d(t,"ImageProcessingConfigurationDefines",function(){return Gi.b}),i.d(t,"ImageProcessingConfiguration",function(){return Gi.a}),i.d(t,"Material",function(){return Yo.a}),i.d(t,"MaterialDefines",function(){return Wr.a}),i.d(t,"MaterialHelper",function(){return jr.a}),i.d(t,"MultiMaterial",function(){return Ta.a}),i.d(t,"PushMaterial",function(){return Hr.a}),i.d(t,"ShaderMaterial",function(){return Ka.a}),i.d(t,"StandardMaterialDefines",function(){return zi.b}),i.d(t,"StandardMaterial",function(){return zi.a}),i.d(t,"BaseTexture",function(){return Kn.a}),i.d(t,"CubeTexture",function(){return zr}),i.d(t,"DynamicTexture",function(){return ji}),i.d(t,"EquiRectangularCubeTexture",function(){return qa}),i.d(t,"HDRCubeTexture",function(){return Pa}),i.d(t,"InternalTexture",function(){return et.a}),i.d(t,"MirrorTexture",function(){return kr}),i.d(t,"MultiRenderTarget",function(){return ns}),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 Xr.a}),i.d(t,"EffectRenderer",function(){return dc}),i.d(t,"EffectWrapper",function(){return fc}),i.d(t,"BackgroundMaterial",function(){return $r}),i.d(t,"PBRMaterialDefines",function(){return So}),i.d(t,"PBRBaseMaterial",function(){return Ro}),i.d(t,"PBRBaseSimpleMaterial",function(){return Ha}),i.d(t,"PBRMaterial",function(){return xo}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return Xa}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return Ya}),i.d(t,"ColorGradingTexture",function(){return Qa}),i.d(t,"RawCubeTexture",function(){return fs}),i.d(t,"RawTexture3D",function(){return ps}),i.d(t,"RefractionTexture",function(){return _s}),i.d(t,"VideoTexture",function(){return ko}),i.d(t,"HtmlElementTexture",function(){return ms}),i.d(t,"NodeMaterialBlockTargets",function(){return hs}),i.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return ds}),i.d(t,"NodeMaterialConnectionPoint",function(){return gs}),i.d(t,"NodeMaterialBlock",function(){return ys}),i.d(t,"NodeMaterialDefines",function(){return Ms}),i.d(t,"NodeMaterial",function(){return Os}),i.d(t,"NodeMaterialSystemValues",function(){return Ss}),i.d(t,"_DDSTextureLoader",function(){return Fo}),i.d(t,"_ENVTextureLoader",function(){return No}),i.d(t,"_KTXTextureLoader",function(){return Uo}),i.d(t,"_TGATextureLoader",function(){return Ja}),i.d(t,"_BasisTextureLoader",function(){return is}),i.d(t,"CustomProceduralTexture",function(){return cs}),i.d(t,"NoiseProceduralTexture",function(){return us}),i.d(t,"ProceduralTexture",function(){return as}),i.d(t,"ProceduralTextureSceneComponent",function(){return rs}),i.d(t,"MultiplyBlock",function(){return zs}),i.d(t,"AddBlock",function(){return js}),i.d(t,"ScaleBlock",function(){return Ws}),i.d(t,"ClampBlock",function(){return Hs}),i.d(t,"CrossBlock",function(){return Xs}),i.d(t,"DotBlock",function(){return Ys}),i.d(t,"TransformBlock",function(){return Es}),i.d(t,"RemapBlock",function(){return Ks}),i.d(t,"NormalizeBlock",function(){return qs}),i.d(t,"TrigonometryBlockOperations",function(){return Qs}),i.d(t,"TrigonometryBlock",function(){return Zs}),i.d(t,"ColorMergerBlock",function(){return Js}),i.d(t,"VectorMergerBlock",function(){return $s}),i.d(t,"ColorSplitterBlock",function(){return ec}),i.d(t,"VectorSplitterBlock",function(){return tc}),i.d(t,"LerpBlock",function(){return ic}),i.d(t,"DivideBlock",function(){return nc}),i.d(t,"SubtractBlock",function(){return rc}),i.d(t,"StepBlock",function(){return oc}),i.d(t,"OppositeBlock",function(){return ac}),i.d(t,"ViewDirectionBlock",function(){return sc}),i.d(t,"FresnelBlock",function(){return cc}),i.d(t,"MaxBlock",function(){return lc}),i.d(t,"MinBlock",function(){return uc}),i.d(t,"NodeMaterialOptimizer",function(){return hc}),i.d(t,"VertexOutputBlock",function(){return As}),i.d(t,"BonesBlock",function(){return Is}),i.d(t,"InstancesBlock",function(){return Ds}),i.d(t,"MorphTargetsBlock",function(){return Ls}),i.d(t,"LightInformationBlock",function(){return ws}),i.d(t,"FragmentOutputBlock",function(){return xs}),i.d(t,"AlphaTestBlock",function(){return Fs}),i.d(t,"ImageProcessingBlock",function(){return Ns}),i.d(t,"PerturbNormalBlock",function(){return Bs}),i.d(t,"FogBlock",function(){return Us}),i.d(t,"LightBlock",function(){return Vs}),i.d(t,"TextureBlock",function(){return ks}),i.d(t,"ReflectionTextureBlock",function(){return Gs}),i.d(t,"InputBlock",function(){return Cs}),i.d(t,"AnimatedInputBlockTypes",function(){return Rs}),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 Yn.a}),i.d(t,"SphericalPolynomial",function(){return Yn.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 Go}),i.d(t,"PositionNormalTextureVertex",function(){return zo}),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 Rc}),i.d(t,"Geometry",function(){return ba.a}),i.d(t,"GroundMesh",function(){return Ki}),i.d(t,"TrailMesh",function(){return xc}),i.d(t,"InstancedMesh",function(){return Cc.a}),i.d(t,"LinesMesh",function(){return Mc.b}),i.d(t,"InstancedLinesMesh",function(){return Mc.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 Wc}),i.d(t,"SimplificationSettings",function(){return Hc}),i.d(t,"SimplificationQueue",function(){return Xc}),i.d(t,"SimplificationType",function(){return zc}),i.d(t,"SimplicationQueueSceneComponent",function(){return Jc}),i.d(t,"Polygon",function(){return Fc}),i.d(t,"PolygonMeshBuilder",function(){return Nc}),i.d(t,"BaseSubMesh",function(){return bc.a}),i.d(t,"SubMesh",function(){return bc.b}),i.d(t,"MeshLODLevel",function(){return $c.a}),i.d(t,"TransformNode",function(){return Tr.a}),i.d(t,"BoxBuilder",function(){return dr.a}),i.d(t,"SphereBuilder",function(){return mr.a}),i.d(t,"CylinderBuilder",function(){return Ji.a}),i.d(t,"TorusBuilder",function(){return Zi}),i.d(t,"LinesBuilder",function(){return gr.a}),i.d(t,"PlaneBuilder",function(){return Er.a}),i.d(t,"GroundBuilder",function(){return Qi}),i.d(t,"DataBuffer",function(){return Xn.a}),i.d(t,"WebGLDataBuffer",function(){return el.a}),i.d(t,"DracoCompression",function(){return yc}),i.d(t,"TiledBoxBuilder",function(){return Ic}),i.d(t,"DiscBuilder",function(){return Oc}),i.d(t,"RibbonBuilder",function(){return La}),i.d(t,"HemisphereBuilder",function(){return Ir}),i.d(t,"TorusKnotBuilder",function(){return Dc}),i.d(t,"PolygonBuilder",function(){return Bc}),i.d(t,"ShapeBuilder",function(){return wa}),i.d(t,"LatheBuilder",function(){return Uc}),i.d(t,"TiledPlaneBuilder",function(){return Vc}),i.d(t,"TubeBuilder",function(){return kc}),i.d(t,"PolyhedronBuilder",function(){return Sr}),i.d(t,"IcoSphereBuilder",function(){return Gc}),i.d(t,"DecalBuilder",function(){return jc}),i.d(t,"MorphTarget",function(){return Sa}),i.d(t,"MorphTargetManager",function(){return Ra}),i.d(t,"RecastJSPlugin",function(){return tl}),i.d(t,"RecastJSCrowd",function(){return il}),i.d(t,"Node",function(){return B.a}),i.d(t,"Database",function(){return rl}),i.d(t,"BaseParticleSystem",function(){return fl}),i.d(t,"GPUParticleSystem",function(){return Cl}),i.d(t,"Particle",function(){return vl}),i.d(t,"ParticleHelper",function(){return Ol}),i.d(t,"ParticleSystem",function(){return El}),i.d(t,"_IDoNeedToBeInTheBuild",function(){return 42}),i.d(t,"ParticleSystemSet",function(){return Ml}),i.d(t,"SolidParticle",function(){return Il}),i.d(t,"ModelShape",function(){return Dl}),i.d(t,"DepthSortedParticle",function(){return Ll}),i.d(t,"SolidParticleSystem",function(){return Fl}),i.d(t,"SubEmitterType",function(){return nl}),i.d(t,"SubEmitter",function(){return yl}),i.d(t,"BoxParticleEmitter",function(){return ol}),i.d(t,"ConeParticleEmitter",function(){return al}),i.d(t,"CylinderParticleEmitter",function(){return sl}),i.d(t,"CylinderDirectedParticleEmitter",function(){return cl}),i.d(t,"HemisphericParticleEmitter",function(){return ll}),i.d(t,"PointParticleEmitter",function(){return ul}),i.d(t,"SphereParticleEmitter",function(){return hl}),i.d(t,"SphereDirectedParticleEmitter",function(){return dl}),i.d(t,"PhysicsEngine",function(){return Ma}),i.d(t,"PhysicsEngineSceneComponent",function(){return Ul}),i.d(t,"PhysicsHelper",function(){return Vl}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return Wl}),i.d(t,"PhysicsUpdraftEventOptions",function(){return Hl}),i.d(t,"PhysicsVortexEventOptions",function(){return Xl}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return Nl}),i.d(t,"PhysicsUpdraftMode",function(){return Bl}),i.d(t,"PhysicsImpostor",function(){return xa.a}),i.d(t,"PhysicsJoint",function(){return Ca.e}),i.d(t,"DistanceJoint",function(){return Ca.a}),i.d(t,"MotorEnabledJoint",function(){return Ca.d}),i.d(t,"HingeJoint",function(){return Ca.c}),i.d(t,"Hinge2Joint",function(){return Ca.b}),i.d(t,"CannonJSPlugin",function(){return Ia}),i.d(t,"AmmoJSPlugin",function(){return Fa}),i.d(t,"OimoJSPlugin",function(){return Da}),i.d(t,"AnaglyphPostProcess",function(){return hi}),i.d(t,"BlackAndWhitePostProcess",function(){return Kl}),i.d(t,"BloomEffect",function(){return eu}),i.d(t,"BloomMergePostProcess",function(){return $l}),i.d(t,"BlurPostProcess",function(){return Vr}),i.d(t,"ChromaticAberrationPostProcess",function(){return iu}),i.d(t,"CircleOfConfusionPostProcess",function(){return ru}),i.d(t,"ColorCorrectionPostProcess",function(){return au}),i.d(t,"ConvolutionPostProcess",function(){return cu}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return lu}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return hu}),i.d(t,"DepthOfFieldEffect",function(){return pu}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return du}),i.d(t,"DepthOfFieldMergePostProcess",function(){return fu}),i.d(t,"DisplayPassPostProcess",function(){return mu}),i.d(t,"ExtractHighlightsPostProcess",function(){return Zl}),i.d(t,"FilterPostProcess",function(){return vu}),i.d(t,"FxaaPostProcess",function(){return Tu}),i.d(t,"GrainPostProcess",function(){return Au}),i.d(t,"HighlightsPostProcess",function(){return Su}),i.d(t,"ImageProcessingPostProcess",function(){return Hi}),i.d(t,"MotionBlurPostProcess",function(){return Iu}),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 Lu}),i.d(t,"SharpenPostProcess",function(){return Fu}),i.d(t,"StereoscopicInterlacePostProcess",function(){return gi}),i.d(t,"TonemappingOperator",function(){return Zu}),i.d(t,"TonemapPostProcess",function(){return Ju}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return nh}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return Si}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return Li}),i.d(t,"PostProcessRenderEffect",function(){return Ql}),i.d(t,"PostProcessRenderPipeline",function(){return Nu}),i.d(t,"PostProcessRenderPipelineManager",function(){return Bu}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return Uu}),i.d(t,"DefaultRenderingPipeline",function(){return Vu}),i.d(t,"LensRenderingPipeline",function(){return zu}),i.d(t,"SSAO2RenderingPipeline",function(){return Hu}),i.d(t,"SSAORenderingPipeline",function(){return Yu}),i.d(t,"StandardRenderingPipeline",function(){return Qu}),i.d(t,"ReflectionProbe",function(){return Na}),i.d(t,"BoundingBoxRenderer",function(){return rh}),i.d(t,"DepthRenderer",function(){return ah}),i.d(t,"DepthRendererSceneComponent",function(){return sh}),i.d(t,"EdgesRenderer",function(){return hh}),i.d(t,"LineEdgesRenderer",function(){return dh}),i.d(t,"GeometryBufferRenderer",function(){return Cu}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return Mu}),i.d(t,"OutlineRenderer",function(){return _h}),i.d(t,"RenderingGroup",function(){return mh.a}),i.d(t,"RenderingGroupInfo",function(){return Mi.a}),i.d(t,"RenderingManager",function(){return Mi.b}),i.d(t,"UtilityLayerRenderer",function(){return pr.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 gh}),i.d(t,"SpriteManager",function(){return Eh}),i.d(t,"SpritePackedManager",function(){return Ah}),i.d(t,"SpriteSceneComponent",function(){return vh}),i.d(t,"_AlphaState",function(){return Ph.a}),i.d(t,"_DepthCullingState",function(){return Ph.b}),i.d(t,"_StencilState",function(){return Ph.c}),i.d(t,"AndOrNotEvaluator",function(){return Sh.a}),i.d(t,"AssetTaskState",function(){return Th}),i.d(t,"AbstractAssetTask",function(){return xh}),i.d(t,"AssetsProgressEvent",function(){return Ch}),i.d(t,"MeshAssetTask",function(){return Mh}),i.d(t,"TextFileAssetTask",function(){return Oh}),i.d(t,"BinaryFileAssetTask",function(){return Ih}),i.d(t,"ImageAssetTask",function(){return Dh}),i.d(t,"TextureAssetTask",function(){return Lh}),i.d(t,"CubeTextureAssetTask",function(){return wh}),i.d(t,"HDRCubeTextureAssetTask",function(){return Fh}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return Nh}),i.d(t,"AssetsManager",function(){return Bh}),i.d(t,"DDSTools",function(){return wo}),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 Uh}),i.d(t,"EnvironmentTextureTools",function(){return Zn}),i.d(t,"MeshExploder",function(){return Vh}),i.d(t,"FilesInput",function(){return kh}),i.d(t,"CubeMapToSphericalPolynomialTools",function(){return Co.a}),i.d(t,"KhronosTextureContainer",function(){return Bo}),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 Gh.a}),i.d(t,"RollingAverage",function(){return Gh.b}),i.d(t,"PromisePolyfill",function(){return zh.a}),i.d(t,"SceneOptimization",function(){return jh}),i.d(t,"TextureOptimization",function(){return Wh}),i.d(t,"HardwareScalingOptimization",function(){return Hh}),i.d(t,"ShadowsOptimization",function(){return Xh}),i.d(t,"PostProcessesOptimization",function(){return Yh}),i.d(t,"LensFlaresOptimization",function(){return Kh}),i.d(t,"CustomOptimization",function(){return Qh}),i.d(t,"ParticlesOptimization",function(){return qh}),i.d(t,"RenderTargetsOptimization",function(){return Zh}),i.d(t,"MergeMeshesOptimization",function(){return Jh}),i.d(t,"SceneOptimizerOptions",function(){return $h}),i.d(t,"SceneOptimizer",function(){return ed}),i.d(t,"SceneSerializer",function(){return rd}),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 od.a}),i.d(t,"TextureTools",function(){return ad}),i.d(t,"TGATools",function(){return Za}),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 sd}),i.d(t,"JoystickAxis",function(){return xt}),i.d(t,"VirtualJoystick",function(){return Mt}),i.d(t,"WorkerPool",function(){return pc}),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 cd}),i.d(t,"WebRequest",function(){return ss.a}),i.d(t,"InspectableType",function(){return Rh}),i.d(t,"BRDFTextureTools",function(){return no}),i.d(t,"RGBDTextureTools",function(){return io}),i.d(t,"ColorGradient",function(){return pl}),i.d(t,"Color3Gradient",function(){return _l}),i.d(t,"FactorGradient",function(){return ml}),i.d(t,"GradientHelper",function(){return gl}),i.d(t,"PerfCounter",function(){return Wo.a}),i.d(t,"RetryStrategy",function(){return ld.a}),i.d(t,"LoadFileError",function(){return ud.a}),i.d(t,"HDRTools",function(){return Aa}),i.d(t,"PanoramaToCubeMapTools",function(){return Ea})},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(39),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(){return 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 r});var n=i(0),r=function(){return 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(112),i(73),i(74),i(75),i(104),"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(10),o=i(7),a=i(93),s=i(27),c=i(3),l=i(79),u=function(){return 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._deleteBuffer=function(e){},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(113),r=i(88);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,"NativeEngine",function(){return n.NativeEngine}),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,"RGBDTextureTools",function(){return n.RGBDTextureTools}),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,"NodeMaterialSystemValues",function(){return n.NodeMaterialSystemValues}),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,"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,"OppositeBlock",function(){return n.OppositeBlock}),i.d(t,"ViewDirectionBlock",function(){return n.ViewDirectionBlock}),i.d(t,"FresnelBlock",function(){return n.FresnelBlock}),i.d(t,"MaxBlock",function(){return n.MaxBlock}),i.d(t,"MinBlock",function(){return n.MinBlock}),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,"LightInformationBlock",function(){return n.LightInformationBlock}),i.d(t,"FragmentOutputBlock",function(){return n.FragmentOutputBlock}),i.d(t,"AlphaTestBlock",function(){return n.AlphaTestBlock}),i.d(t,"ImageProcessingBlock",function(){return n.ImageProcessingBlock}),i.d(t,"PerturbNormalBlock",function(){return n.PerturbNormalBlock}),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/dist/preview release/babylon.max.js b/dist/preview release/babylon.max.js index 81131aad104..13fc1dd0fa4 100644 --- a/dist/preview release/babylon.max.js +++ b/dist/preview release/babylon.max.js @@ -9534,7 +9534,7 @@ var FadeInOutBehavior = /** @class */ (function () { /*!***********************************!*\ !*** ./Behaviors/Meshes/index.ts ***! \***********************************/ -/*! exports provided: AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior */ +/*! exports provided: PointerDragBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -10363,7 +10363,7 @@ var SixDofDragBehavior = /** @class */ (function () { /*!****************************!*\ !*** ./Behaviors/index.ts ***! \****************************/ -/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior */ +/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -10376,14 +10376,14 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FramingBehavior", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_0__["FramingBehavior"]; }); /* harmony import */ var _Meshes_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Meshes/index */ "./Behaviors/Meshes/index.ts"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PointerDragBehavior", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__["PointerDragBehavior"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AttachToBoxBehavior", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__["AttachToBoxBehavior"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FadeInOutBehavior", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__["FadeInOutBehavior"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultiPointerScaleBehavior", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__["MultiPointerScaleBehavior"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PointerDragBehavior", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__["PointerDragBehavior"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SixDofDragBehavior", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__["SixDofDragBehavior"]; }); @@ -43232,7 +43232,7 @@ var GamepadSystemSceneComponent = /** @class */ (function () { /*!***************************!*\ !*** ./Gamepads/index.ts ***! \***************************/ -/*! exports provided: StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController */ +/*! exports provided: DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51710,7 +51710,7 @@ var LayerSceneComponent = /** @class */ (function () { /*!**************************!*\ !*** ./Legacy/legacy.ts ***! \**************************/ -/*! exports provided: Debug, AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */ +/*! exports provided: Debug, AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -51832,6 +51832,14 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WeightedSound", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["WeightedSound"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AutoRotationBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["AutoRotationBehavior"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BouncingBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["BouncingBehavior"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FramingBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["FramingBehavior"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PointerDragBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PointerDragBehavior"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Bone", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Bone"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoneIKController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["BoneIKController"]; }); @@ -51946,6 +51954,26 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ClipboardInfo", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["ClipboardInfo"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DaydreamController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["DaydreamController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GearVRController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["GearVRController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["GenericController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OculusTouchController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["OculusTouchController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerType", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PoseEnabledControllerType"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerHelper", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PoseEnabledControllerHelper"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PoseEnabledController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ViveController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["ViveController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WebVRController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["WebVRController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WindowsMotionController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["WindowsMotionController"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StickValues", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["StickValues"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Gamepad", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Gamepad"]; }); @@ -52122,20 +52150,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Frustum", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Frustum"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Orientation", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Orientation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BezierCurve", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["BezierCurve"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Angle", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Angle"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Arc2", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Arc2"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path2", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Path2"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path3D", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Path3D"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Curve3", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Curve3"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Plane", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Plane"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Size", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Size"]; }); @@ -52566,20 +52580,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LoadFileError", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["LoadFileError"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AutoRotationBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["AutoRotationBehavior"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BouncingBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["BouncingBehavior"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FramingBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["FramingBehavior"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AttachToBoxBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["AttachToBoxBehavior"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FadeInOutBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["FadeInOutBehavior"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultiPointerScaleBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["MultiPointerScaleBehavior"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PointerDragBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PointerDragBehavior"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SixDofDragBehavior", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["SixDofDragBehavior"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArcRotateCameraGamepadInput", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["ArcRotateCameraGamepadInput"]; }); @@ -52680,26 +52686,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_forceTransformFeedbackToBundle", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["_forceTransformFeedbackToBundle"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DaydreamController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["DaydreamController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GearVRController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["GearVRController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["GenericController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OculusTouchController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["OculusTouchController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerType", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PoseEnabledControllerType"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerHelper", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PoseEnabledControllerHelper"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PoseEnabledController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ViveController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["ViveController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WebVRController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["WebVRController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WindowsMotionController", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["WindowsMotionController"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ShadowGenerator", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["ShadowGenerator"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ShadowGeneratorSceneComponent", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["ShadowGeneratorSceneComponent"]; }); @@ -52746,6 +52732,20 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NodeMaterialSystemValues", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["NodeMaterialSystemValues"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Orientation", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Orientation"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BezierCurve", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["BezierCurve"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Angle", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Angle"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Arc2", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Arc2"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path2", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Path2"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path3D", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Path3D"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Curve3", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["Curve3"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PositionNormalVertex", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PositionNormalVertex"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PositionNormalTextureVertex", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PositionNormalTextureVertex"]; }); @@ -89855,7 +89855,7 @@ var UniformBuffer = /** @class */ (function () { /*!************************!*\ !*** ./Maths/index.ts ***! \************************/ -/*! exports provided: Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, PositionNormalVertex, PositionNormalTextureVertex */ +/*! exports provided: Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -89882,20 +89882,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Frustum", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Frustum"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Orientation", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Orientation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BezierCurve", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["BezierCurve"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Angle", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Angle"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Arc2", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Arc2"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path2", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Path2"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path3D", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Path3D"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Curve3", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Curve3"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Plane", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Plane"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Size", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Size"]; }); @@ -89914,6 +89900,20 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Viewport", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Viewport"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Orientation", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Orientation"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BezierCurve", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["BezierCurve"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Angle", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Angle"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Arc2", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Arc2"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path2", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Path2"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path3D", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Path3D"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Curve3", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["Curve3"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PositionNormalVertex", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["PositionNormalVertex"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PositionNormalTextureVertex", function() { return _math__WEBPACK_IMPORTED_MODULE_1__["PositionNormalTextureVertex"]; }); @@ -92511,7 +92511,7 @@ var Size = /** @class */ (function () { /*!***********************!*\ !*** ./Maths/math.ts ***! \***********************/ -/*! exports provided: Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, PositionNormalVertex, PositionNormalTextureVertex */ +/*! exports provided: Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -159136,7 +159136,7 @@ var AssetContainer = /** @class */ (function (_super) { /*!******************!*\ !*** ./index.ts ***! \******************/ -/*! exports provided: AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */ +/*! exports provided: AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -159259,14 +159259,14 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FramingBehavior", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__["FramingBehavior"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PointerDragBehavior", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__["PointerDragBehavior"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AttachToBoxBehavior", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__["AttachToBoxBehavior"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FadeInOutBehavior", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__["FadeInOutBehavior"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultiPointerScaleBehavior", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__["MultiPointerScaleBehavior"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PointerDragBehavior", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__["PointerDragBehavior"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SixDofDragBehavior", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__["SixDofDragBehavior"]; }); /* harmony import */ var _Bones_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Bones/index */ "./Bones/index.ts"); @@ -159489,6 +159489,26 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ClipboardInfo", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__["ClipboardInfo"]; }); /* harmony import */ var _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Gamepads/index */ "./Gamepads/index.ts"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DaydreamController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["DaydreamController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GearVRController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["GearVRController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["GenericController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OculusTouchController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["OculusTouchController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerType", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["PoseEnabledControllerType"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerHelper", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["PoseEnabledControllerHelper"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["PoseEnabledController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ViveController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["ViveController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WebVRController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["WebVRController"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WindowsMotionController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["WindowsMotionController"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StickValues", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["StickValues"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Gamepad", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["Gamepad"]; }); @@ -159511,26 +159531,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DualShockPad", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["DualShockPad"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DaydreamController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["DaydreamController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GearVRController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["GearVRController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GenericController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["GenericController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OculusTouchController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["OculusTouchController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerType", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["PoseEnabledControllerType"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledControllerHelper", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["PoseEnabledControllerHelper"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PoseEnabledController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["PoseEnabledController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ViveController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["ViveController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WebVRController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["WebVRController"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WindowsMotionController", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__["WindowsMotionController"]; }); - /* harmony import */ var _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Gizmos/index */ "./Gizmos/index.ts"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AxisDragGizmo", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__["AxisDragGizmo"]; }); @@ -159838,20 +159838,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Frustum", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Frustum"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Orientation", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Orientation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BezierCurve", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["BezierCurve"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Angle", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Angle"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Arc2", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Arc2"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path2", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Path2"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path3D", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Path3D"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Curve3", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Curve3"]; }); - /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Plane", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Plane"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Size", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Size"]; }); @@ -159874,6 +159860,20 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SphericalPolynomial", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["SphericalPolynomial"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Orientation", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Orientation"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BezierCurve", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["BezierCurve"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Angle", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Angle"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Arc2", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Arc2"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path2", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Path2"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Path3D", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Path3D"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Curve3", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["Curve3"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PositionNormalVertex", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["PositionNormalVertex"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PositionNormalTextureVertex", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__["PositionNormalTextureVertex"]; }); diff --git a/dist/preview release/materialsLibrary/babylon.waterMaterial.js b/dist/preview release/materialsLibrary/babylon.waterMaterial.js index 26d34602174..f563a3763e2 100644 --- a/dist/preview release/materialsLibrary/babylon.waterMaterial.js +++ b/dist/preview release/materialsLibrary/babylon.waterMaterial.js @@ -419,7 +419,7 @@ __webpack_require__.r(__webpack_exports__); var name = 'waterPixelShader'; -var shader = "#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n"; +var shader = "#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n"; babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader; /** @hidden */ var waterPixelShader = { name: name, shader: shader }; diff --git a/dist/preview release/materialsLibrary/babylon.waterMaterial.js.map b/dist/preview release/materialsLibrary/babylon.waterMaterial.js.map index a2a4bfc854c..e940dbe8ee4 100644 --- a/dist/preview release/materialsLibrary/babylon.waterMaterial.js.map +++ b/dist/preview release/materialsLibrary/babylon.waterMaterial.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://BABYLONJS/materialsLibrary/src/webpack/universalModuleDefinition","webpack://BABYLONJS/materialsLibrary/src/webpack/bootstrap","webpack://BABYLONJS/node_modules/tslib/tslib.es6.js","webpack://BABYLONJS/materialsLibrary/src/(webpack)/buildin/global.js","webpack://BABYLONJS/materialsLibrary/src/legacy/legacy-water.ts","webpack://BABYLONJS/materialsLibrary/src/water/index.ts","webpack://BABYLONJS/materialsLibrary/src/water/water.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/water/water.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/water/waterMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/external {\"root\":\"BABYLON\",\"commonjs\":\"babylonjs\",\"commonjs2\":\"babylonjs\",\"amd\":\"babylonjs\"}"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA,+DAA+D;AAC/D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;;AAEO;AACP;AACA,mBAAmB,sBAAsB;AACzC;AACA;;AAEO;AACP;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;;AAEO;AACP;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;;AAEO;AACP,mCAAmC,oCAAoC;AACvE;;AAEO;AACP;AACA;;AAEO;AACP;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,iEAAiE,uBAAuB,EAAE,4BAA4B;AACrJ;AACA,KAAK;AACL;;AAEO;AACP,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,gBAAgB;AACzC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;;AAEO;AACP,4BAA4B,sBAAsB;AAClD;AACA;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA,iBAAiB,sFAAsF,aAAa,EAAE;AACtH,sBAAsB,gCAAgC,qCAAqC,0CAA0C,EAAE,EAAE,GAAG;AAC5I,2BAA2B,MAAM,eAAe,EAAE,YAAY,oBAAoB,EAAE;AACpF,sBAAsB,oGAAoG;AAC1H,6BAA6B,uBAAuB;AACpD,4BAA4B,wBAAwB;AACpD,2BAA2B,yDAAyD;AACpF;;AAEO;AACP;AACA,iBAAiB,4CAA4C,SAAS,EAAE,qDAAqD,aAAa,EAAE;AAC5I,yBAAyB,6BAA6B,oBAAoB,gDAAgD,gBAAgB,EAAE,KAAK;AACjJ;;AAEO;AACP;AACA;AACA,2GAA2G,sFAAsF,aAAa,EAAE;AAChN,sBAAsB,8BAA8B,gDAAgD,uDAAuD,EAAE,EAAE,GAAG;AAClK,4CAA4C,sCAAsC,UAAU,oBAAoB,EAAE,EAAE,UAAU;AAC9H;;AAEO;AACP,gCAAgC,uCAAuC,aAAa,EAAE,EAAE,OAAO,kBAAkB;AACjH;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,4CAA4C;AAC5C;;;;;;;;;;;;ACzLA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;;;;;;ACnBA;AAAA;AAAA;AAAA;AAAmC;AAEnC;;;GAGG;AACH,IAAI,YAAY,GAAG,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AACrH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,IAAI,GAAG,IAAI,mCAAM,EAAE;QACd,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,mCAAO,CAAC,GAAG,CAAC,CAAC;KACzD;CACJ;AAEwB;;;;;;;;;;;;;;ACbzB;AAAA;AAAA;AAAA;AAAgC;;;;;;;;;;;;;ACAhC;AAAA;AAAA;AAAA;AAAoD;AACM;AACW;AACF;AACA;AACL;AACI;AACC;AACI;AACT;AACG;AACL;AACJ;AACG;AACL;AAEtD,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,w+KAiMZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,gBAAgB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACtN/C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACA;AACJ;AACJ;AACI;AACN;AACI;AACC;AAEzD,IAAI,IAAI,GAAG,mBAAmB,CAAC;AAC/B,IAAI,MAAM,GAAG,w1FAuHZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,iBAAiB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC1IwG;AACjF;AACnB;AACD;AAEK;AACD;AAGgC;AACH;AACd;AACgE;AAClE;AACJ;AACE;AACX;AAGV;AAEL;AACc;AAE5B;AACF;AAExB;IAAmC,8EAAe;IAwC9C;QAAA,YACI,iBAAO,SAEV;QA1CM,UAAI,GAAG,KAAK,CAAC;QACb,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,sBAAgB,GAAG,KAAK,CAAC;QACzB,qBAAe,GAAG,KAAK,CAAC;QACxB,qBAAe,GAAG,KAAK,CAAC;QACxB,2BAAqB,GAAG,KAAK,CAAC;QAE9B,qBAAe,GAAG,KAAK,CAAC;QACxB,cAAQ,GAAG,KAAK,CAAC;QACjB,+BAAyB,GAAG,KAAK,CAAC;QAClC,6BAAuB,GAAG,KAAK,CAAC;QAChC,iBAAW,GAAG,KAAK,CAAC;QACpB,sBAAgB,GAAG,KAAK,CAAC;QACzB,cAAQ,GAAG,KAAK,CAAC;QACjB,cAAQ,GAAG,KAAK,CAAC;QACjB,iBAAW,GAAG,KAAK,CAAC;QACpB,kBAAY,GAAG,KAAK,CAAC;QACrB,oBAAc,GAAG,KAAK,CAAC;QACvB,yBAAmB,GAAG,KAAK,CAAC;QAC5B,qBAAe,GAAG,KAAK,CAAC;QACxB,gCAA0B,GAAG,KAAK,CAAC;QAItC,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,2BAAC;AAAD,CAAC,CA5CkC,yEAAe,GA4CjD;AAED;IAAmC,uEAAY;IA4I3C;;MAEE;IACF,uBAAY,IAAY,EAAE,KAAY,EAAS,gBAAiD;QAAjD,0DAAgC,iEAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAAhG,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SAmBrB;QApB8C,sBAAgB,GAAhB,gBAAgB,CAAiC;QArIzF,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,mBAAa,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGpC,mBAAa,GAAG,EAAE,CAAC;QAGlB,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;QAInC;;UAEE;QAEK,eAAS,GAAW,CAAC,CAAC;QAC7B;;UAEE;QAEK,mBAAa,GAAY,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAChC;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAChC;;WAEG;QAEK,sBAAgB,GAAG,KAAK,CAAC;QAIjC;;WAEG;QAEK,sBAAgB,GAAG,KAAK,CAAC;QAIjC;;WAEG;QAEK,4BAAsB,GAAG,KAAK,CAAC;QAIvC;;UAEE;QAEK,gBAAU,GAAW,IAAI,gEAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACtD;;UAEE;QAEK,sBAAgB,GAAW,GAAG,CAAC;QACtC;;WAEG;QAEI,iBAAW,GAAW,IAAI,gEAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACvD;;WAEG;QAEI,uBAAiB,GAAW,GAAG,CAAC;QACvC;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAEhC;;UAEE;QAEK,eAAS,GAAW,GAAG,CAAC;QAC/B;;;WAGG;QAEI,sBAAgB,GAAY,KAAK,CAAC;QAE/B,oBAAc,GAAG,IAAI,oEAAU,CAAsB,EAAE,CAAC,CAAC;QAEnE;;UAEE;QACM,WAAK,GAA2B,IAAI,CAAC;QAKrC,0BAAoB,GAAW,gEAAM,CAAC,IAAI,EAAE,CAAC;QAC7C,eAAS,GAAW,CAAC,CAAC;QACtB,oBAAc,GAAW,CAAC,CAAC;QAwB/B,KAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAEnD,wBAAwB;QACxB,KAAI,CAAC,uBAAuB,GAAG;YAC3B,KAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;YAC5B,KAAI,CAAC,cAAc,CAAC,IAAI,CAAsB,KAAI,CAAC,cAAc,CAAC,CAAC;YACnE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAsB,KAAI,CAAC,cAAc,CAAC,CAAC;YAEnE,OAAO,KAAI,CAAC,cAAc,CAAC;QAC/B,CAAC,CAAC;QAEF,KAAI,CAAC,6BAA6B,GAAG,KAAI,CAAC,QAAQ,EAAE,CAAC,4BAA4B,CAAC;QAClF,IAAI,KAAI,CAAC,6BAA6B,EAAE;YACpC,KAAI,CAAC,wBAAwB,GAAG,KAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,GAAG,CAAC;gBACtF,KAAI,CAAC,uCAAuC,EAAE,CAAC;YACnD,CAAC,CAAC,CAAC;SACN;;IACL,CAAC;IA3BD,sBAAW,kDAAuB;QAHlC;;WAEG;aACH;YACI,OAAO,IAAI,CAAC;QAChB,CAAC;;;OAAA;IA4BD,sBAAW,8CAAmB;aAA9B;YACI,OAAO,IAAI,CAAC,oBAAoB,CAAC;QACrC,CAAC;aAED,UAA+B,KAAc;YACzC,IAAI,CAAC,oBAAoB,GAAG,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,sBAAsB,CAAC;YAClG,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACxC,CAAC;;;OALA;IAQD,sBAAW,4CAAiB;QAD5B,YAAY;aACZ;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAED,sBAAW,4CAAiB;aAA5B;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAED,UAAU;IACH,uCAAe,GAAtB,UAAuB,IAAS;QAC5B,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;IACL,CAAC;IAEM,2CAAmB,GAA1B,UAA2B,MAAe;QACtC,IAAI,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;SACjD;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;SACjD;IACL,CAAC;IAEM,qCAAa,GAApB;QACI,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,CAAC;IAED,sBAAW,+CAAoB;aAA/B;YACI,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC;QAC3E,CAAC;;;OAAA;IAEM,yCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,wCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,2CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,yCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,oBAAoB,EAAE,CAAC;SACzD;QAED,IAAI,OAAO,GAAyB,OAAO,CAAC,gBAAgB,CAAC;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,WAAW,IAAI,uEAAa,CAAC,kBAAkB,EAAE;oBACtD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE;wBAC7B,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;qBACvB;iBACJ;gBAED,IAAI,uEAAa,CAAC,wBAAwB,EAAE;oBACxC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;iBAC7B;aACJ;SACJ;QAED,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAE5J,IAAI,OAAO,CAAC,aAAa,EAAE;YACvB,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;aAClC;YAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;aAClC;YAED,IAAI,IAAI,CAAC,sBAAsB,EAAE;gBAC7B,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;aACxC;SACJ;QAED,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE9I,mBAAmB;QACnB,IAAI,OAAO,CAAC,wBAAwB,IAAI,IAAI,CAAC,6BAA6B,EAAE;YACxE,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,OAAO,EAAE,EAAE;gBAC/C,OAAO,KAAK,CAAC;aAChB;YAED,IAAI,CAAC,6BAA6B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAE3D,OAAO,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;YACtG,OAAO,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;SACzG;QAED,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,iBAAiB;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACvE;YAED,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;SAClC;QAED,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,IAAI,OAAO,CAAC,gBAAgB,EAAE;gBAC1B,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;aAChD;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,OAAO,CAAC;YACzB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB;gBAC/G,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,cAAc;gBACd,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc;gBACzE,0BAA0B;gBAE1B,QAAQ;gBACR,+BAA+B,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW;gBACnF,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW;aAClI,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,eAAe;gBAC3B,QAAQ;gBACR,mBAAmB,EAAE,mBAAmB;aAC3C,CAAC;YACF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,IAAI,sFAA4B,EAAE;gBAC9B,sFAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAChE,sFAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACnE;YAED,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YACH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,sBAAsB,EAAE;aAC1E,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAE5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,sCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAyB,OAAO,CAAC,gBAAgB,CAAC;QAC7D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACxB,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,WAAW,IAAI,uEAAa,CAAC,kBAAkB,EAAE;gBACtD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBAEjE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACxG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;aACrF;YACD,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1F;QAED,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,aAAa;QACb,wEAAc,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAEhE,QAAQ;QACR,IAAI,uEAAa,CAAC,wBAAwB,EAAE;YACxC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACxE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;SAC3E;QAED,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAEjH,kEAAkE;QAClE,IAAI,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC;QACjD,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE;YACnC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;YAChC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC;SACzC;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACzE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzD,mBAAmB;QACnB,IAAI,IAAI,CAAC,6BAA6B,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,EAAE;YAC9F,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEO,4CAAoB,GAA5B,UAA6B,KAAY,EAAE,gBAAyB;QAApE,iBAiFC;QAhFG,iBAAiB;QACjB,IAAI,CAAC,cAAc,GAAG,IAAI,6EAAmB,CAAC,IAAI,GAAG,aAAa,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACnJ,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEhD,IAAI,CAAC,cAAc,GAAG,IAAI,6EAAmB,CAAC,IAAI,GAAG,aAAa,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACnJ,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEhD,IAAI,SAAkB,CAAC;QACvB,IAAI,SAAS,GAAoB,IAAI,CAAC;QACtC,IAAI,eAAuB,CAAC;QAC5B,IAAI,YAAY,GAAG,gEAAM,CAAC,IAAI,EAAE,CAAC;QAEjC,IAAI,CAAC,cAAc,CAAC,cAAc,GAAG;YACjC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBACjC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;aAChC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;gBAE5B,IAAI,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBACzD,KAAK,CAAC,SAAS,GAAG,+DAAK,CAAC,qBAAqB,CAAC,IAAI,iEAAO,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;aAC5G;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG;YAChC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aACpC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aAC/B;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,cAAc,GAAG;YACjC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBACjC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;aAChC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;gBAE5B,IAAI,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBACzD,KAAK,CAAC,SAAS,GAAG,+DAAK,CAAC,qBAAqB,CAAC,IAAI,iEAAO,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAE1G,gEAAM,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;aACzD;YAED,YAAY;YACZ,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YAExC,YAAY,CAAC,aAAa,CAAC,eAAe,EAAE,KAAI,CAAC,oBAAoB,CAAC,CAAC;YACvE,KAAK,CAAC,kBAAkB,CAAC,KAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACjF,KAAK,CAAC,SAAS,EAAE,CAAC,aAAa,GAAG,KAAK,CAAC;YACxC,KAAK,CAAC,uBAAuB,GAAG,iEAAO,CAAC,oBAAoB,CAAU,KAAK,CAAC,YAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACtH,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG;YAChC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aACpC;YAED,aAAa;YACb,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;YAE5B,YAAY;YACZ,KAAK,CAAC,kBAAkB,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACvE,KAAK,CAAC,SAAS,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;YACvC,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC;QACzC,CAAC,CAAC;IACN,CAAC;IAEM,sCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAClC;QACD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QACD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,yCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC1C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,kCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,YAAY,KAAK,OAAO,EAAE;YAC/B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,+BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;SAC9B;QAED,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAsB,IAAI,CAAC,cAAc,CAAC,CAAC;QAClG,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACxD;QACD,KAAK,GAAG,CAAC,CAAC,CAAC;QACX,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAsB,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9F,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACxD;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QAED,mCAAmC;QACnC,IAAI,IAAI,CAAC,6BAA6B,IAAI,IAAI,CAAC,wBAAwB,EAAE;YACrE,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;SAC/F;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,6BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,aAAa,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAxC,CAAwC,EAAE,IAAI,CAAC,CAAC;IAC3F,CAAC;IAEM,iCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,uBAAuB,CAAC;QAEzD,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC5D,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC7E;SACJ;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,oCAAY,GAAnB;QACI,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,UAAU;IACI,mBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,IAAI,GAAG,GAAG,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAArC,CAAqC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACzG,GAAG,CAAC,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC;QAE3C,OAAO,GAAG,CAAC;IACf,CAAC;IAEa,+BAAiB,GAA/B,UAAgC,IAAY,EAAE,KAAY;QACtD,IAAI,IAAI,GAAG,8DAAI,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IAChB,CAAC;IAlrBD;QADC,oFAAkB,CAAC,aAAa,CAAC;uDACA;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;sDACrB;IAGhC;QADC,mFAAiB,EAAE;uDACsB;IAG1C;QADC,mFAAiB,EAAE;wDACuB;IAG3C;QADC,2EAAS,EAAE;wDACc;IAG1B;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;0DACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;iEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;gEACd;IAMrC;QADC,2EAAS,EAAE;oDACiB;IAK7B;QADC,oFAAkB,EAAE;wDAC6B;IAKlD;QADC,2EAAS,EAAE;qDACoB;IAKhC;QADC,2EAAS,EAAE;qDACoB;IAKhC;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;0DACjB;IAMhC;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;0DACjB;IAMhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;iEACI;IAEvC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;gEACX;IAMtC;QADC,mFAAiB,EAAE;qDACkC;IAKtD;QADC,2EAAS,EAAE;2DAC0B;IAKtC;QADC,mFAAiB,EAAE;sDACmC;IAKvD;QADC,2EAAS,EAAE;4DAC2B;IAKvC;QADC,2EAAS,EAAE;qDACoB;IAMhC;QADC,2EAAS,EAAE;oDACmB;IAM/B;QADC,2EAAS,EAAE;2DAC6B;IA0DzC;QADC,2EAAS,EAAE;4DAGX;IAghBL,oBAAC;CAAA,CAxrBkC,sEAAY,GAwrB9C;AAxrByB;AA0rB1B,oEAAU,CAAC,eAAe,CAAC,uBAAuB,CAAC,GAAG,aAAa,CAAC;;;;;;;;;;;;ACpwBpE,uE","file":"babylon.waterMaterial.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"babylonjs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"babylonjs-materials\", [\"babylonjs\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"babylonjs-materials\"] = factory(require(\"babylonjs\"));\n\telse\n\t\troot[\"MATERIALS\"] = factory(root[\"BABYLON\"]);\n})((typeof self !== \"undefined\" ? self : typeof global !== \"undefined\" ? global : this), function(__WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./legacy/legacy-water.ts\");\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","import * as MatLib from \"../water\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nvar globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);\r\nif (typeof globalObject !== \"undefined\") {\r\n for (var key in MatLib) {\r\n (globalObject).BABYLON[key] = (MatLib)[key];\r\n }\r\n}\r\n\r\nexport * from \"../water\";","export * from \"./waterMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'waterPixelShader';\nlet shader = `#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthVertex\";\n\nlet name = 'waterVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\nimport { serializeAsVector2, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\nimport { Matrix, Vector2, Vector3 } from \"babylonjs/Maths/math.vector\";\nimport { Color3 } from \"babylonjs/Maths/math.color\";\nimport { Plane } from 'babylonjs/Maths/math.plane';\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\nimport { Constants } from \"babylonjs/Engines/constants\";\nimport { SmartArray } from \"babylonjs/Misc/smartArray\";\nimport { Observer } from 'babylonjs/Misc/observable';\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\nimport { RenderTargetTexture } from \"babylonjs/Materials/Textures/renderTargetTexture\";\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\nimport { IImageProcessingConfigurationDefines, ImageProcessingConfiguration } from \"babylonjs/Materials/imageProcessingConfiguration\";\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Camera } from \"babylonjs/Cameras/camera\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nimport \"./water.fragment\";\nimport \"./water.vertex\";\n\nclass WaterMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {\n public BUMP = false;\n public REFLECTION = false;\n public CLIPPLANE = false;\n public CLIPPLANE2 = false;\n public CLIPPLANE3 = false;\n public CLIPPLANE4 = false;\n public ALPHATEST = false;\n public DEPTHPREPASS = false;\n public POINTSIZE = false;\n public FOG = false;\n public NORMAL = false;\n public UV1 = false;\n public UV2 = false;\n public VERTEXCOLOR = false;\n public VERTEXALPHA = false;\n public NUM_BONE_INFLUENCERS = 0;\n public BonesPerMesh = 0;\n public INSTANCES = false;\n public SPECULARTERM = false;\n public LOGARITHMICDEPTH = false;\n public FRESNELSEPARATE = false;\n public BUMPSUPERIMPOSE = false;\n public BUMPAFFECTSREFLECTION = false;\n\n public IMAGEPROCESSING = false;\n public VIGNETTE = false;\n public VIGNETTEBLENDMODEMULTIPLY = false;\n public VIGNETTEBLENDMODEOPAQUE = false;\n public TONEMAPPING = false;\n public TONEMAPPING_ACES = false;\n public CONTRAST = false;\n public EXPOSURE = false;\n public COLORCURVES = false;\n public COLORGRADING = false;\n public COLORGRADING3D = false;\n public SAMPLER3DGREENDEPTH = false;\n public SAMPLER3DBGRMAP = false;\n public IMAGEPROCESSINGPOSTPROCESS = false;\n\n constructor() {\n super();\n this.rebuild();\n }\n}\n\nexport class WaterMaterial extends PushMaterial {\n /*\n * Public members\n */\n @serializeAsTexture(\"bumpTexture\")\n private _bumpTexture: BaseTexture;\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n public bumpTexture: BaseTexture;\n\n @serializeAsColor3()\n public diffuseColor = new Color3(1, 1, 1);\n\n @serializeAsColor3()\n public specularColor = new Color3(0, 0, 0);\n\n @serialize()\n public specularPower = 64;\n\n @serialize(\"disableLighting\")\n private _disableLighting = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public disableLighting: boolean;\n\n @serialize(\"maxSimultaneousLights\")\n private _maxSimultaneousLights = 4;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public maxSimultaneousLights: number;\n\n /**\n * @param {number}: Represents the wind force\n */\n @serialize()\n public windForce: number = 6;\n /**\n * @param {Vector2}: The direction of the wind in the plane (X, Z)\n */\n @serializeAsVector2()\n public windDirection: Vector2 = new Vector2(0, 1);\n /**\n * @param {number}: Wave height, represents the height of the waves\n */\n @serialize()\n public waveHeight: number = 0.4;\n /**\n * @param {number}: Bump height, represents the bump height related to the bump map\n */\n @serialize()\n public bumpHeight: number = 0.4;\n /**\n * @param {boolean}: Add a smaller moving bump to less steady waves.\n */\n @serialize(\"bumpSuperimpose\")\n private _bumpSuperimpose = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpSuperimpose: boolean;\n\n /**\n * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.\n */\n @serialize(\"fresnelSeparate\")\n private _fresnelSeparate = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public fresnelSeparate: boolean;\n\n /**\n * @param {boolean}: bump Waves modify the reflection.\n */\n @serialize(\"bumpAffectsReflection\")\n private _bumpAffectsReflection = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpAffectsReflection: boolean;\n\n /**\n * @param {number}: The water color blended with the refraction (near)\n */\n @serializeAsColor3()\n public waterColor: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color\n */\n @serialize()\n public colorBlendFactor: number = 0.2;\n /**\n * @param {number}: The water color blended with the reflection (far)\n */\n @serializeAsColor3()\n public waterColor2: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color (reflection, far)\n */\n @serialize()\n public colorBlendFactor2: number = 0.2;\n /**\n * @param {number}: Represents the maximum length of a wave\n */\n @serialize()\n public waveLength: number = 0.1;\n\n /**\n * @param {number}: Defines the waves speed\n */\n @serialize()\n public waveSpeed: number = 1.0;\n /**\n * Sets or gets wether or not automatic clipping should be enabled or not. Setting to true will save performances and\n * will avoid calculating useless pixels in the pixel shader of the water material.\n */\n @serialize()\n public disableClipPlane: boolean = false;\n\n protected _renderTargets = new SmartArray(16);\n\n /*\n * Private members\n */\n private _mesh: Nullable = null;\n\n private _refractionRTT: Nullable;\n private _reflectionRTT: Nullable;\n\n private _reflectionTransform: Matrix = Matrix.Zero();\n private _lastTime: number = 0;\n private _lastDeltaTime: number = 0;\n\n private _renderId: number;\n\n private _useLogarithmicDepth: boolean;\n\n private _waitingRenderList: Nullable;\n\n private _imageProcessingConfiguration: Nullable;\n private _imageProcessingObserver: Nullable>;\n\n /**\n * Gets a boolean indicating that current material needs to register RTT\n */\n public get hasRenderTargetTextures(): boolean {\n return true;\n }\n\n /**\n * Constructor\n */\n constructor(name: string, scene: Scene, public renderTargetSize: Vector2 = new Vector2(512, 512)) {\n super(name, scene);\n\n this._createRenderTargets(scene, renderTargetSize);\n\n // Create render targets\n this.getRenderTargetTextures = (): SmartArray => {\n this._renderTargets.reset();\n this._renderTargets.push(this._reflectionRTT);\n this._renderTargets.push(this._refractionRTT);\n\n return this._renderTargets;\n };\n\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\n if (this._imageProcessingConfiguration) {\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\n this._markAllSubMeshesAsImageProcessingDirty();\n });\n }\n }\n\n @serialize()\n public get useLogarithmicDepth(): boolean {\n return this._useLogarithmicDepth;\n }\n\n public set useLogarithmicDepth(value: boolean) {\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\n this._markAllSubMeshesAsMiscDirty();\n }\n\n // Get / Set\n public get refractionTexture(): Nullable {\n return this._refractionRTT;\n }\n\n public get reflectionTexture(): Nullable {\n return this._reflectionRTT;\n }\n\n // Methods\n public addToRenderList(node: any): void {\n if (this._refractionRTT && this._refractionRTT.renderList) {\n this._refractionRTT.renderList.push(node);\n }\n\n if (this._reflectionRTT && this._reflectionRTT.renderList) {\n this._reflectionRTT.renderList.push(node);\n }\n }\n\n public enableRenderTargets(enable: boolean): void {\n var refreshRate = enable ? 1 : 0;\n\n if (this._refractionRTT) {\n this._refractionRTT.refreshRate = refreshRate;\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.refreshRate = refreshRate;\n }\n }\n\n public getRenderList(): Nullable {\n return this._refractionRTT ? this._refractionRTT.renderList : [];\n }\n\n public get renderTargetsEnabled(): boolean {\n return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);\n }\n\n public needAlphaBlending(): boolean {\n return (this.alpha < 1.0);\n }\n\n public needAlphaTesting(): boolean {\n return false;\n }\n\n public getAlphaTestTexture(): Nullable {\n return null;\n }\n\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\n if (this.isFrozen) {\n if (this._wasPreviouslyReady && subMesh.effect) {\n return true;\n }\n }\n\n if (!subMesh._materialDefines) {\n subMesh._materialDefines = new WaterMaterialDefines();\n }\n\n var defines = subMesh._materialDefines;\n var scene = this.getScene();\n\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\n if (this._renderId === scene.getRenderId()) {\n return true;\n }\n }\n\n var engine = scene.getEngine();\n\n // Textures\n if (defines._areTexturesDirty) {\n defines._needUVs = false;\n if (scene.texturesEnabled) {\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n if (!this.bumpTexture.isReady()) {\n return false;\n } else {\n defines._needUVs = true;\n defines.BUMP = true;\n }\n }\n\n if (MaterialFlags.ReflectionTextureEnabled) {\n defines.REFLECTION = true;\n }\n }\n }\n\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\n\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\n\n if (defines._areMiscDirty) {\n if (this._fresnelSeparate) {\n defines.FRESNELSEPARATE = true;\n }\n\n if (this._bumpSuperimpose) {\n defines.BUMPSUPERIMPOSE = true;\n }\n\n if (this._bumpAffectsReflection) {\n defines.BUMPAFFECTSREFLECTION = true;\n }\n }\n\n // Lights\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\n\n // Image processing\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\n if (!this._imageProcessingConfiguration.isReady()) {\n return false;\n }\n\n this._imageProcessingConfiguration.prepareDefines(defines);\n\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\n }\n\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\n\n // Configure this\n this._mesh = mesh;\n\n if (this._waitingRenderList) {\n for (var i = 0; i < this._waitingRenderList.length; i++) {\n this.addToRenderList(scene.getNodeByID(this._waitingRenderList[i]));\n }\n\n this._waitingRenderList = null;\n }\n\n // Get correct effect\n if (defines.isDirty) {\n defines.markAsProcessed();\n scene.resetCachedMaterial();\n\n // Fallbacks\n var fallbacks = new EffectFallbacks();\n if (defines.FOG) {\n fallbacks.addFallback(1, \"FOG\");\n }\n\n if (defines.LOGARITHMICDEPTH) {\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\n }\n\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\n\n if (defines.NUM_BONE_INFLUENCERS > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n\n //Attributes\n var attribs = [VertexBuffer.PositionKind];\n\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n\n if (defines.UV1) {\n attribs.push(VertexBuffer.UVKind);\n }\n\n if (defines.UV2) {\n attribs.push(VertexBuffer.UV2Kind);\n }\n\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n\n // Legacy browser patch\n var shaderName = \"water\";\n var join = defines.toString();\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\n \"vNormalInfos\",\n \"mBones\",\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"normalMatrix\",\n \"logarithmicDepthConstant\",\n\n // Water\n \"worldReflectionViewProjection\", \"windDirection\", \"waveLength\", \"time\", \"windForce\",\n \"cameraPosition\", \"bumpHeight\", \"waveHeight\", \"waterColor\", \"waterColor2\", \"colorBlendFactor\", \"colorBlendFactor2\", \"waveSpeed\"\n ];\n var samplers = [\"normalSampler\",\n // Water\n \"refractionSampler\", \"reflectionSampler\"\n ];\n var uniformBuffers = new Array();\n\n if (ImageProcessingConfiguration) {\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\n }\n\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this.maxSimultaneousLights\n });\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\n {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }\n }, engine), defines);\n\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n\n this._renderId = scene.getRenderId();\n this._wasPreviouslyReady = true;\n\n return true;\n }\n\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\n var scene = this.getScene();\n\n var defines = subMesh._materialDefines;\n if (!defines) {\n return;\n }\n\n var effect = subMesh.effect;\n if (!effect || !this._mesh) {\n return;\n }\n this._activeEffect = effect;\n\n // Matrices\n this.bindOnlyWorldMatrix(world);\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n\n // Bones\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\n\n if (this._mustRebind(scene, effect)) {\n // Textures\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n this._activeEffect.setTexture(\"normalSampler\", this.bumpTexture);\n\n this._activeEffect.setFloat2(\"vNormalInfos\", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);\n this._activeEffect.setMatrix(\"normalMatrix\", this.bumpTexture.getTextureMatrix());\n }\n // Clip plane\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\n\n // Point size\n if (this.pointsCloud) {\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\n }\n\n MaterialHelper.BindEyePosition(effect, scene);\n }\n\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\n\n if (defines.SPECULARTERM) {\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\n }\n\n if (scene.lightsEnabled && !this.disableLighting) {\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\n }\n\n // View\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\n }\n\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\n\n // Log. depth\n MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);\n\n // Water\n if (MaterialFlags.ReflectionTextureEnabled) {\n this._activeEffect.setTexture(\"refractionSampler\", this._refractionRTT);\n this._activeEffect.setTexture(\"reflectionSampler\", this._reflectionRTT);\n }\n\n var wrvp = this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(scene.getProjectionMatrix());\n\n // Add delta time. Prevent adding delta time if it hasn't changed.\n let deltaTime = scene.getEngine().getDeltaTime();\n if (deltaTime !== this._lastDeltaTime) {\n this._lastDeltaTime = deltaTime;\n this._lastTime += this._lastDeltaTime;\n }\n\n this._activeEffect.setMatrix(\"worldReflectionViewProjection\", wrvp);\n this._activeEffect.setVector2(\"windDirection\", this.windDirection);\n this._activeEffect.setFloat(\"waveLength\", this.waveLength);\n this._activeEffect.setFloat(\"time\", this._lastTime / 100000);\n this._activeEffect.setFloat(\"windForce\", this.windForce);\n this._activeEffect.setFloat(\"waveHeight\", this.waveHeight);\n this._activeEffect.setFloat(\"bumpHeight\", this.bumpHeight);\n this._activeEffect.setColor4(\"waterColor\", this.waterColor, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor\", this.colorBlendFactor);\n this._activeEffect.setColor4(\"waterColor2\", this.waterColor2, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor2\", this.colorBlendFactor2);\n this._activeEffect.setFloat(\"waveSpeed\", this.waveSpeed);\n\n // image processing\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\n this._imageProcessingConfiguration.bind(this._activeEffect);\n }\n\n this._afterBind(mesh, this._activeEffect);\n }\n\n private _createRenderTargets(scene: Scene, renderTargetSize: Vector2): void {\n // Render targets\n this._refractionRTT = new RenderTargetTexture(name + \"_refraction\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._refractionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.ignoreCameraViewport = true;\n\n this._reflectionRTT = new RenderTargetTexture(name + \"_reflection\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._reflectionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.ignoreCameraViewport = true;\n\n var isVisible: boolean;\n var clipPlane: Nullable = null;\n var savedViewMatrix: Matrix;\n var mirrorMatrix = Matrix.Zero();\n\n this._refractionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony + 0.05, 0), new Vector3(0, 1, 0));\n }\n };\n\n this._refractionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n scene.clipPlane = clipPlane;\n }\n };\n\n this._reflectionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony - 0.05, 0), new Vector3(0, -1, 0));\n\n Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);\n }\n\n // Transform\n savedViewMatrix = scene.getViewMatrix();\n\n mirrorMatrix.multiplyToRef(savedViewMatrix, this._reflectionTransform);\n scene.setTransformMatrix(this._reflectionTransform, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = false;\n scene._mirroredCameraPosition = Vector3.TransformCoordinates((scene.activeCamera).position, mirrorMatrix);\n };\n\n this._reflectionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n scene.clipPlane = clipPlane;\n\n // Transform\n scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = true;\n scene._mirroredCameraPosition = null;\n };\n }\n\n public getAnimatables(): IAnimatable[] {\n var results = [];\n\n if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {\n results.push(this.bumpTexture);\n }\n if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {\n results.push(this._reflectionRTT);\n }\n if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {\n results.push(this._refractionRTT);\n }\n\n return results;\n }\n\n public getActiveTextures(): BaseTexture[] {\n var activeTextures = super.getActiveTextures();\n\n if (this._bumpTexture) {\n activeTextures.push(this._bumpTexture);\n }\n\n return activeTextures;\n }\n\n public hasTexture(texture: BaseTexture): boolean {\n if (super.hasTexture(texture)) {\n return true;\n }\n\n if (this._bumpTexture === texture) {\n return true;\n }\n\n return false;\n }\n\n public dispose(forceDisposeEffect?: boolean): void {\n if (this.bumpTexture) {\n this.bumpTexture.dispose();\n }\n\n var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n index = -1;\n index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.dispose();\n }\n if (this._refractionRTT) {\n this._refractionRTT.dispose();\n }\n\n // Remove image-processing observer\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n\n super.dispose(forceDisposeEffect);\n }\n\n public clone(name: string): WaterMaterial {\n return SerializationHelper.Clone(() => new WaterMaterial(name, this.getScene()), this);\n }\n\n public serialize(): any {\n var serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.WaterMaterial\";\n\n serializationObject.renderList = [];\n if (this._refractionRTT && this._refractionRTT.renderList) {\n for (var i = 0; i < this._refractionRTT.renderList.length; i++) {\n serializationObject.renderList.push(this._refractionRTT.renderList[i].id);\n }\n }\n\n return serializationObject;\n }\n\n public getClassName(): string {\n return \"WaterMaterial\";\n }\n\n // Statics\n public static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial {\n var mat = SerializationHelper.Parse(() => new WaterMaterial(source.name, scene), source, scene, rootUrl);\n mat._waitingRenderList = source.renderList;\n\n return mat;\n }\n\n public static CreateDefaultMesh(name: string, scene: Scene): Mesh {\n var mesh = Mesh.CreateGround(name, 512, 512, 32, scene, false);\n return mesh;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.WaterMaterial\"] = WaterMaterial;","module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://BABYLONJS/materialsLibrary/src/webpack/universalModuleDefinition","webpack://BABYLONJS/materialsLibrary/src/webpack/bootstrap","webpack://BABYLONJS/node_modules/tslib/tslib.es6.js","webpack://BABYLONJS/materialsLibrary/src/(webpack)/buildin/global.js","webpack://BABYLONJS/materialsLibrary/src/legacy/legacy-water.ts","webpack://BABYLONJS/materialsLibrary/src/water/index.ts","webpack://BABYLONJS/materialsLibrary/src/water/water.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/water/water.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/water/waterMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/external {\"root\":\"BABYLON\",\"commonjs\":\"babylonjs\",\"commonjs2\":\"babylonjs\",\"amd\":\"babylonjs\"}"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA,+DAA+D;AAC/D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;;AAEO;AACP;AACA,mBAAmB,sBAAsB;AACzC;AACA;;AAEO;AACP;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;;AAEO;AACP;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;;AAEO;AACP,mCAAmC,oCAAoC;AACvE;;AAEO;AACP;AACA;;AAEO;AACP;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,iEAAiE,uBAAuB,EAAE,4BAA4B;AACrJ;AACA,KAAK;AACL;;AAEO;AACP,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,gBAAgB;AACzC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;;AAEO;AACP,4BAA4B,sBAAsB;AAClD;AACA;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA,iBAAiB,sFAAsF,aAAa,EAAE;AACtH,sBAAsB,gCAAgC,qCAAqC,0CAA0C,EAAE,EAAE,GAAG;AAC5I,2BAA2B,MAAM,eAAe,EAAE,YAAY,oBAAoB,EAAE;AACpF,sBAAsB,oGAAoG;AAC1H,6BAA6B,uBAAuB;AACpD,4BAA4B,wBAAwB;AACpD,2BAA2B,yDAAyD;AACpF;;AAEO;AACP;AACA,iBAAiB,4CAA4C,SAAS,EAAE,qDAAqD,aAAa,EAAE;AAC5I,yBAAyB,6BAA6B,oBAAoB,gDAAgD,gBAAgB,EAAE,KAAK;AACjJ;;AAEO;AACP;AACA;AACA,2GAA2G,sFAAsF,aAAa,EAAE;AAChN,sBAAsB,8BAA8B,gDAAgD,uDAAuD,EAAE,EAAE,GAAG;AAClK,4CAA4C,sCAAsC,UAAU,oBAAoB,EAAE,EAAE,UAAU;AAC9H;;AAEO;AACP,gCAAgC,uCAAuC,aAAa,EAAE,EAAE,OAAO,kBAAkB;AACjH;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,4CAA4C;AAC5C;;;;;;;;;;;;ACzLA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;;;;;;ACnBA;AAAA;AAAA;AAAA;AAAmC;AAEnC;;;GAGG;AACH,IAAI,YAAY,GAAG,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AACrH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,IAAI,GAAG,IAAI,mCAAM,EAAE;QACd,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,mCAAO,CAAC,GAAG,CAAC,CAAC;KACzD;CACJ;AAEwB;;;;;;;;;;;;;;ACbzB;AAAA;AAAA;AAAA;AAAgC;;;;;;;;;;;;;ACAhC;AAAA;AAAA;AAAA;AAAoD;AACM;AACW;AACF;AACA;AACL;AACI;AACC;AACI;AACT;AACG;AACL;AACJ;AACG;AACL;AAEtD,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,i/KAiMZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,gBAAgB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACtN/C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACA;AACJ;AACJ;AACI;AACN;AACI;AACC;AAEzD,IAAI,IAAI,GAAG,mBAAmB,CAAC;AAC/B,IAAI,MAAM,GAAG,w1FAuHZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,iBAAiB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC1IwG;AACjF;AACnB;AACD;AAEK;AACD;AAGgC;AACH;AACd;AACgE;AAClE;AACJ;AACE;AACX;AAGV;AAEL;AACc;AAE5B;AACF;AAExB;IAAmC,8EAAe;IAwC9C;QAAA,YACI,iBAAO,SAEV;QA1CM,UAAI,GAAG,KAAK,CAAC;QACb,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,sBAAgB,GAAG,KAAK,CAAC;QACzB,qBAAe,GAAG,KAAK,CAAC;QACxB,qBAAe,GAAG,KAAK,CAAC;QACxB,2BAAqB,GAAG,KAAK,CAAC;QAE9B,qBAAe,GAAG,KAAK,CAAC;QACxB,cAAQ,GAAG,KAAK,CAAC;QACjB,+BAAyB,GAAG,KAAK,CAAC;QAClC,6BAAuB,GAAG,KAAK,CAAC;QAChC,iBAAW,GAAG,KAAK,CAAC;QACpB,sBAAgB,GAAG,KAAK,CAAC;QACzB,cAAQ,GAAG,KAAK,CAAC;QACjB,cAAQ,GAAG,KAAK,CAAC;QACjB,iBAAW,GAAG,KAAK,CAAC;QACpB,kBAAY,GAAG,KAAK,CAAC;QACrB,oBAAc,GAAG,KAAK,CAAC;QACvB,yBAAmB,GAAG,KAAK,CAAC;QAC5B,qBAAe,GAAG,KAAK,CAAC;QACxB,gCAA0B,GAAG,KAAK,CAAC;QAItC,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,2BAAC;AAAD,CAAC,CA5CkC,yEAAe,GA4CjD;AAED;IAAmC,uEAAY;IA4I3C;;MAEE;IACF,uBAAY,IAAY,EAAE,KAAY,EAAS,gBAAiD;QAAjD,0DAAgC,iEAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAAhG,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SAmBrB;QApB8C,sBAAgB,GAAhB,gBAAgB,CAAiC;QArIzF,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,mBAAa,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGpC,mBAAa,GAAG,EAAE,CAAC;QAGlB,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;QAInC;;UAEE;QAEK,eAAS,GAAW,CAAC,CAAC;QAC7B;;UAEE;QAEK,mBAAa,GAAY,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAChC;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAChC;;WAEG;QAEK,sBAAgB,GAAG,KAAK,CAAC;QAIjC;;WAEG;QAEK,sBAAgB,GAAG,KAAK,CAAC;QAIjC;;WAEG;QAEK,4BAAsB,GAAG,KAAK,CAAC;QAIvC;;UAEE;QAEK,gBAAU,GAAW,IAAI,gEAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACtD;;UAEE;QAEK,sBAAgB,GAAW,GAAG,CAAC;QACtC;;WAEG;QAEI,iBAAW,GAAW,IAAI,gEAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACvD;;WAEG;QAEI,uBAAiB,GAAW,GAAG,CAAC;QACvC;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAEhC;;UAEE;QAEK,eAAS,GAAW,GAAG,CAAC;QAC/B;;;WAGG;QAEI,sBAAgB,GAAY,KAAK,CAAC;QAE/B,oBAAc,GAAG,IAAI,oEAAU,CAAsB,EAAE,CAAC,CAAC;QAEnE;;UAEE;QACM,WAAK,GAA2B,IAAI,CAAC;QAKrC,0BAAoB,GAAW,gEAAM,CAAC,IAAI,EAAE,CAAC;QAC7C,eAAS,GAAW,CAAC,CAAC;QACtB,oBAAc,GAAW,CAAC,CAAC;QAwB/B,KAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAEnD,wBAAwB;QACxB,KAAI,CAAC,uBAAuB,GAAG;YAC3B,KAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;YAC5B,KAAI,CAAC,cAAc,CAAC,IAAI,CAAsB,KAAI,CAAC,cAAc,CAAC,CAAC;YACnE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAsB,KAAI,CAAC,cAAc,CAAC,CAAC;YAEnE,OAAO,KAAI,CAAC,cAAc,CAAC;QAC/B,CAAC,CAAC;QAEF,KAAI,CAAC,6BAA6B,GAAG,KAAI,CAAC,QAAQ,EAAE,CAAC,4BAA4B,CAAC;QAClF,IAAI,KAAI,CAAC,6BAA6B,EAAE;YACpC,KAAI,CAAC,wBAAwB,GAAG,KAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,GAAG,CAAC;gBACtF,KAAI,CAAC,uCAAuC,EAAE,CAAC;YACnD,CAAC,CAAC,CAAC;SACN;;IACL,CAAC;IA3BD,sBAAW,kDAAuB;QAHlC;;WAEG;aACH;YACI,OAAO,IAAI,CAAC;QAChB,CAAC;;;OAAA;IA4BD,sBAAW,8CAAmB;aAA9B;YACI,OAAO,IAAI,CAAC,oBAAoB,CAAC;QACrC,CAAC;aAED,UAA+B,KAAc;YACzC,IAAI,CAAC,oBAAoB,GAAG,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,sBAAsB,CAAC;YAClG,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACxC,CAAC;;;OALA;IAQD,sBAAW,4CAAiB;QAD5B,YAAY;aACZ;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAED,sBAAW,4CAAiB;aAA5B;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAED,UAAU;IACH,uCAAe,GAAtB,UAAuB,IAAS;QAC5B,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;IACL,CAAC;IAEM,2CAAmB,GAA1B,UAA2B,MAAe;QACtC,IAAI,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;SACjD;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;SACjD;IACL,CAAC;IAEM,qCAAa,GAApB;QACI,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,CAAC;IAED,sBAAW,+CAAoB;aAA/B;YACI,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC;QAC3E,CAAC;;;OAAA;IAEM,yCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,wCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,2CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,yCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,oBAAoB,EAAE,CAAC;SACzD;QAED,IAAI,OAAO,GAAyB,OAAO,CAAC,gBAAgB,CAAC;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,WAAW,IAAI,uEAAa,CAAC,kBAAkB,EAAE;oBACtD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE;wBAC7B,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;qBACvB;iBACJ;gBAED,IAAI,uEAAa,CAAC,wBAAwB,EAAE;oBACxC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;iBAC7B;aACJ;SACJ;QAED,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAE5J,IAAI,OAAO,CAAC,aAAa,EAAE;YACvB,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;aAClC;YAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;aAClC;YAED,IAAI,IAAI,CAAC,sBAAsB,EAAE;gBAC7B,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;aACxC;SACJ;QAED,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE9I,mBAAmB;QACnB,IAAI,OAAO,CAAC,wBAAwB,IAAI,IAAI,CAAC,6BAA6B,EAAE;YACxE,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,OAAO,EAAE,EAAE;gBAC/C,OAAO,KAAK,CAAC;aAChB;YAED,IAAI,CAAC,6BAA6B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAE3D,OAAO,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;YACtG,OAAO,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;SACzG;QAED,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,iBAAiB;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACvE;YAED,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;SAClC;QAED,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,IAAI,OAAO,CAAC,gBAAgB,EAAE;gBAC1B,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;aAChD;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,OAAO,CAAC;YACzB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB;gBAC/G,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,cAAc;gBACd,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc;gBACzE,0BAA0B;gBAE1B,QAAQ;gBACR,+BAA+B,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW;gBACnF,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW;aAClI,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,eAAe;gBAC3B,QAAQ;gBACR,mBAAmB,EAAE,mBAAmB;aAC3C,CAAC;YACF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,IAAI,sFAA4B,EAAE;gBAC9B,sFAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAChE,sFAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACnE;YAED,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YACH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,sBAAsB,EAAE;aAC1E,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAE5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,sCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAyB,OAAO,CAAC,gBAAgB,CAAC;QAC7D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACxB,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,WAAW,IAAI,uEAAa,CAAC,kBAAkB,EAAE;gBACtD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBAEjE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACxG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;aACrF;YACD,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1F;QAED,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,aAAa;QACb,wEAAc,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAEhE,QAAQ;QACR,IAAI,uEAAa,CAAC,wBAAwB,EAAE;YACxC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACxE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;SAC3E;QAED,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAEjH,kEAAkE;QAClE,IAAI,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC;QACjD,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE;YACnC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;YAChC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC;SACzC;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACzE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzD,mBAAmB;QACnB,IAAI,IAAI,CAAC,6BAA6B,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,EAAE;YAC9F,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEO,4CAAoB,GAA5B,UAA6B,KAAY,EAAE,gBAAyB;QAApE,iBAiFC;QAhFG,iBAAiB;QACjB,IAAI,CAAC,cAAc,GAAG,IAAI,6EAAmB,CAAC,IAAI,GAAG,aAAa,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACnJ,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEhD,IAAI,CAAC,cAAc,GAAG,IAAI,6EAAmB,CAAC,IAAI,GAAG,aAAa,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACnJ,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEhD,IAAI,SAAkB,CAAC;QACvB,IAAI,SAAS,GAAoB,IAAI,CAAC;QACtC,IAAI,eAAuB,CAAC;QAC5B,IAAI,YAAY,GAAG,gEAAM,CAAC,IAAI,EAAE,CAAC;QAEjC,IAAI,CAAC,cAAc,CAAC,cAAc,GAAG;YACjC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBACjC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;aAChC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;gBAE5B,IAAI,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBACzD,KAAK,CAAC,SAAS,GAAG,+DAAK,CAAC,qBAAqB,CAAC,IAAI,iEAAO,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;aAC5G;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG;YAChC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aACpC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aAC/B;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,cAAc,GAAG;YACjC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBACjC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;aAChC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;gBAE5B,IAAI,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBACzD,KAAK,CAAC,SAAS,GAAG,+DAAK,CAAC,qBAAqB,CAAC,IAAI,iEAAO,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAE1G,gEAAM,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;aACzD;YAED,YAAY;YACZ,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YAExC,YAAY,CAAC,aAAa,CAAC,eAAe,EAAE,KAAI,CAAC,oBAAoB,CAAC,CAAC;YACvE,KAAK,CAAC,kBAAkB,CAAC,KAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACjF,KAAK,CAAC,SAAS,EAAE,CAAC,aAAa,GAAG,KAAK,CAAC;YACxC,KAAK,CAAC,uBAAuB,GAAG,iEAAO,CAAC,oBAAoB,CAAU,KAAK,CAAC,YAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACtH,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG;YAChC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aACpC;YAED,aAAa;YACb,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;YAE5B,YAAY;YACZ,KAAK,CAAC,kBAAkB,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACvE,KAAK,CAAC,SAAS,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;YACvC,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC;QACzC,CAAC,CAAC;IACN,CAAC;IAEM,sCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAClC;QACD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QACD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,yCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC1C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,kCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,YAAY,KAAK,OAAO,EAAE;YAC/B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,+BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;SAC9B;QAED,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAsB,IAAI,CAAC,cAAc,CAAC,CAAC;QAClG,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACxD;QACD,KAAK,GAAG,CAAC,CAAC,CAAC;QACX,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAsB,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9F,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACxD;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QAED,mCAAmC;QACnC,IAAI,IAAI,CAAC,6BAA6B,IAAI,IAAI,CAAC,wBAAwB,EAAE;YACrE,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;SAC/F;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,6BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,aAAa,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAxC,CAAwC,EAAE,IAAI,CAAC,CAAC;IAC3F,CAAC;IAEM,iCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,uBAAuB,CAAC;QAEzD,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC5D,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC7E;SACJ;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,oCAAY,GAAnB;QACI,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,UAAU;IACI,mBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,IAAI,GAAG,GAAG,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAArC,CAAqC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACzG,GAAG,CAAC,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC;QAE3C,OAAO,GAAG,CAAC;IACf,CAAC;IAEa,+BAAiB,GAA/B,UAAgC,IAAY,EAAE,KAAY;QACtD,IAAI,IAAI,GAAG,8DAAI,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IAChB,CAAC;IAlrBD;QADC,oFAAkB,CAAC,aAAa,CAAC;uDACA;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;sDACrB;IAGhC;QADC,mFAAiB,EAAE;uDACsB;IAG1C;QADC,mFAAiB,EAAE;wDACuB;IAG3C;QADC,2EAAS,EAAE;wDACc;IAG1B;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;0DACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;iEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;gEACd;IAMrC;QADC,2EAAS,EAAE;oDACiB;IAK7B;QADC,oFAAkB,EAAE;wDAC6B;IAKlD;QADC,2EAAS,EAAE;qDACoB;IAKhC;QADC,2EAAS,EAAE;qDACoB;IAKhC;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;0DACjB;IAMhC;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;0DACjB;IAMhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;iEACI;IAEvC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;gEACX;IAMtC;QADC,mFAAiB,EAAE;qDACkC;IAKtD;QADC,2EAAS,EAAE;2DAC0B;IAKtC;QADC,mFAAiB,EAAE;sDACmC;IAKvD;QADC,2EAAS,EAAE;4DAC2B;IAKvC;QADC,2EAAS,EAAE;qDACoB;IAMhC;QADC,2EAAS,EAAE;oDACmB;IAM/B;QADC,2EAAS,EAAE;2DAC6B;IA0DzC;QADC,2EAAS,EAAE;4DAGX;IAghBL,oBAAC;CAAA,CAxrBkC,sEAAY,GAwrB9C;AAxrByB;AA0rB1B,oEAAU,CAAC,eAAe,CAAC,uBAAuB,CAAC,GAAG,aAAa,CAAC;;;;;;;;;;;;ACpwBpE,uE","file":"babylon.waterMaterial.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"babylonjs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"babylonjs-materials\", [\"babylonjs\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"babylonjs-materials\"] = factory(require(\"babylonjs\"));\n\telse\n\t\troot[\"MATERIALS\"] = factory(root[\"BABYLON\"]);\n})((typeof self !== \"undefined\" ? self : typeof global !== \"undefined\" ? global : this), function(__WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./legacy/legacy-water.ts\");\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","import * as MatLib from \"../water\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nvar globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);\r\nif (typeof globalObject !== \"undefined\") {\r\n for (var key in MatLib) {\r\n (globalObject).BABYLON[key] = (MatLib)[key];\r\n }\r\n}\r\n\r\nexport * from \"../water\";","export * from \"./waterMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'waterPixelShader';\nlet shader = `#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthVertex\";\n\nlet name = 'waterVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\nimport { serializeAsVector2, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\nimport { Matrix, Vector2, Vector3 } from \"babylonjs/Maths/math.vector\";\nimport { Color3 } from \"babylonjs/Maths/math.color\";\nimport { Plane } from 'babylonjs/Maths/math.plane';\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\nimport { Constants } from \"babylonjs/Engines/constants\";\nimport { SmartArray } from \"babylonjs/Misc/smartArray\";\nimport { Observer } from 'babylonjs/Misc/observable';\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\nimport { RenderTargetTexture } from \"babylonjs/Materials/Textures/renderTargetTexture\";\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\nimport { IImageProcessingConfigurationDefines, ImageProcessingConfiguration } from \"babylonjs/Materials/imageProcessingConfiguration\";\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Camera } from \"babylonjs/Cameras/camera\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nimport \"./water.fragment\";\nimport \"./water.vertex\";\n\nclass WaterMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {\n public BUMP = false;\n public REFLECTION = false;\n public CLIPPLANE = false;\n public CLIPPLANE2 = false;\n public CLIPPLANE3 = false;\n public CLIPPLANE4 = false;\n public ALPHATEST = false;\n public DEPTHPREPASS = false;\n public POINTSIZE = false;\n public FOG = false;\n public NORMAL = false;\n public UV1 = false;\n public UV2 = false;\n public VERTEXCOLOR = false;\n public VERTEXALPHA = false;\n public NUM_BONE_INFLUENCERS = 0;\n public BonesPerMesh = 0;\n public INSTANCES = false;\n public SPECULARTERM = false;\n public LOGARITHMICDEPTH = false;\n public FRESNELSEPARATE = false;\n public BUMPSUPERIMPOSE = false;\n public BUMPAFFECTSREFLECTION = false;\n\n public IMAGEPROCESSING = false;\n public VIGNETTE = false;\n public VIGNETTEBLENDMODEMULTIPLY = false;\n public VIGNETTEBLENDMODEOPAQUE = false;\n public TONEMAPPING = false;\n public TONEMAPPING_ACES = false;\n public CONTRAST = false;\n public EXPOSURE = false;\n public COLORCURVES = false;\n public COLORGRADING = false;\n public COLORGRADING3D = false;\n public SAMPLER3DGREENDEPTH = false;\n public SAMPLER3DBGRMAP = false;\n public IMAGEPROCESSINGPOSTPROCESS = false;\n\n constructor() {\n super();\n this.rebuild();\n }\n}\n\nexport class WaterMaterial extends PushMaterial {\n /*\n * Public members\n */\n @serializeAsTexture(\"bumpTexture\")\n private _bumpTexture: BaseTexture;\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n public bumpTexture: BaseTexture;\n\n @serializeAsColor3()\n public diffuseColor = new Color3(1, 1, 1);\n\n @serializeAsColor3()\n public specularColor = new Color3(0, 0, 0);\n\n @serialize()\n public specularPower = 64;\n\n @serialize(\"disableLighting\")\n private _disableLighting = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public disableLighting: boolean;\n\n @serialize(\"maxSimultaneousLights\")\n private _maxSimultaneousLights = 4;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public maxSimultaneousLights: number;\n\n /**\n * @param {number}: Represents the wind force\n */\n @serialize()\n public windForce: number = 6;\n /**\n * @param {Vector2}: The direction of the wind in the plane (X, Z)\n */\n @serializeAsVector2()\n public windDirection: Vector2 = new Vector2(0, 1);\n /**\n * @param {number}: Wave height, represents the height of the waves\n */\n @serialize()\n public waveHeight: number = 0.4;\n /**\n * @param {number}: Bump height, represents the bump height related to the bump map\n */\n @serialize()\n public bumpHeight: number = 0.4;\n /**\n * @param {boolean}: Add a smaller moving bump to less steady waves.\n */\n @serialize(\"bumpSuperimpose\")\n private _bumpSuperimpose = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpSuperimpose: boolean;\n\n /**\n * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.\n */\n @serialize(\"fresnelSeparate\")\n private _fresnelSeparate = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public fresnelSeparate: boolean;\n\n /**\n * @param {boolean}: bump Waves modify the reflection.\n */\n @serialize(\"bumpAffectsReflection\")\n private _bumpAffectsReflection = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpAffectsReflection: boolean;\n\n /**\n * @param {number}: The water color blended with the refraction (near)\n */\n @serializeAsColor3()\n public waterColor: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color\n */\n @serialize()\n public colorBlendFactor: number = 0.2;\n /**\n * @param {number}: The water color blended with the reflection (far)\n */\n @serializeAsColor3()\n public waterColor2: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color (reflection, far)\n */\n @serialize()\n public colorBlendFactor2: number = 0.2;\n /**\n * @param {number}: Represents the maximum length of a wave\n */\n @serialize()\n public waveLength: number = 0.1;\n\n /**\n * @param {number}: Defines the waves speed\n */\n @serialize()\n public waveSpeed: number = 1.0;\n /**\n * Sets or gets wether or not automatic clipping should be enabled or not. Setting to true will save performances and\n * will avoid calculating useless pixels in the pixel shader of the water material.\n */\n @serialize()\n public disableClipPlane: boolean = false;\n\n protected _renderTargets = new SmartArray(16);\n\n /*\n * Private members\n */\n private _mesh: Nullable = null;\n\n private _refractionRTT: Nullable;\n private _reflectionRTT: Nullable;\n\n private _reflectionTransform: Matrix = Matrix.Zero();\n private _lastTime: number = 0;\n private _lastDeltaTime: number = 0;\n\n private _renderId: number;\n\n private _useLogarithmicDepth: boolean;\n\n private _waitingRenderList: Nullable;\n\n private _imageProcessingConfiguration: Nullable;\n private _imageProcessingObserver: Nullable>;\n\n /**\n * Gets a boolean indicating that current material needs to register RTT\n */\n public get hasRenderTargetTextures(): boolean {\n return true;\n }\n\n /**\n * Constructor\n */\n constructor(name: string, scene: Scene, public renderTargetSize: Vector2 = new Vector2(512, 512)) {\n super(name, scene);\n\n this._createRenderTargets(scene, renderTargetSize);\n\n // Create render targets\n this.getRenderTargetTextures = (): SmartArray => {\n this._renderTargets.reset();\n this._renderTargets.push(this._reflectionRTT);\n this._renderTargets.push(this._refractionRTT);\n\n return this._renderTargets;\n };\n\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\n if (this._imageProcessingConfiguration) {\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\n this._markAllSubMeshesAsImageProcessingDirty();\n });\n }\n }\n\n @serialize()\n public get useLogarithmicDepth(): boolean {\n return this._useLogarithmicDepth;\n }\n\n public set useLogarithmicDepth(value: boolean) {\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\n this._markAllSubMeshesAsMiscDirty();\n }\n\n // Get / Set\n public get refractionTexture(): Nullable {\n return this._refractionRTT;\n }\n\n public get reflectionTexture(): Nullable {\n return this._reflectionRTT;\n }\n\n // Methods\n public addToRenderList(node: any): void {\n if (this._refractionRTT && this._refractionRTT.renderList) {\n this._refractionRTT.renderList.push(node);\n }\n\n if (this._reflectionRTT && this._reflectionRTT.renderList) {\n this._reflectionRTT.renderList.push(node);\n }\n }\n\n public enableRenderTargets(enable: boolean): void {\n var refreshRate = enable ? 1 : 0;\n\n if (this._refractionRTT) {\n this._refractionRTT.refreshRate = refreshRate;\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.refreshRate = refreshRate;\n }\n }\n\n public getRenderList(): Nullable {\n return this._refractionRTT ? this._refractionRTT.renderList : [];\n }\n\n public get renderTargetsEnabled(): boolean {\n return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);\n }\n\n public needAlphaBlending(): boolean {\n return (this.alpha < 1.0);\n }\n\n public needAlphaTesting(): boolean {\n return false;\n }\n\n public getAlphaTestTexture(): Nullable {\n return null;\n }\n\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\n if (this.isFrozen) {\n if (this._wasPreviouslyReady && subMesh.effect) {\n return true;\n }\n }\n\n if (!subMesh._materialDefines) {\n subMesh._materialDefines = new WaterMaterialDefines();\n }\n\n var defines = subMesh._materialDefines;\n var scene = this.getScene();\n\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\n if (this._renderId === scene.getRenderId()) {\n return true;\n }\n }\n\n var engine = scene.getEngine();\n\n // Textures\n if (defines._areTexturesDirty) {\n defines._needUVs = false;\n if (scene.texturesEnabled) {\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n if (!this.bumpTexture.isReady()) {\n return false;\n } else {\n defines._needUVs = true;\n defines.BUMP = true;\n }\n }\n\n if (MaterialFlags.ReflectionTextureEnabled) {\n defines.REFLECTION = true;\n }\n }\n }\n\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\n\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\n\n if (defines._areMiscDirty) {\n if (this._fresnelSeparate) {\n defines.FRESNELSEPARATE = true;\n }\n\n if (this._bumpSuperimpose) {\n defines.BUMPSUPERIMPOSE = true;\n }\n\n if (this._bumpAffectsReflection) {\n defines.BUMPAFFECTSREFLECTION = true;\n }\n }\n\n // Lights\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\n\n // Image processing\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\n if (!this._imageProcessingConfiguration.isReady()) {\n return false;\n }\n\n this._imageProcessingConfiguration.prepareDefines(defines);\n\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\n }\n\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\n\n // Configure this\n this._mesh = mesh;\n\n if (this._waitingRenderList) {\n for (var i = 0; i < this._waitingRenderList.length; i++) {\n this.addToRenderList(scene.getNodeByID(this._waitingRenderList[i]));\n }\n\n this._waitingRenderList = null;\n }\n\n // Get correct effect\n if (defines.isDirty) {\n defines.markAsProcessed();\n scene.resetCachedMaterial();\n\n // Fallbacks\n var fallbacks = new EffectFallbacks();\n if (defines.FOG) {\n fallbacks.addFallback(1, \"FOG\");\n }\n\n if (defines.LOGARITHMICDEPTH) {\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\n }\n\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\n\n if (defines.NUM_BONE_INFLUENCERS > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n\n //Attributes\n var attribs = [VertexBuffer.PositionKind];\n\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n\n if (defines.UV1) {\n attribs.push(VertexBuffer.UVKind);\n }\n\n if (defines.UV2) {\n attribs.push(VertexBuffer.UV2Kind);\n }\n\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n\n // Legacy browser patch\n var shaderName = \"water\";\n var join = defines.toString();\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\n \"vNormalInfos\",\n \"mBones\",\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"normalMatrix\",\n \"logarithmicDepthConstant\",\n\n // Water\n \"worldReflectionViewProjection\", \"windDirection\", \"waveLength\", \"time\", \"windForce\",\n \"cameraPosition\", \"bumpHeight\", \"waveHeight\", \"waterColor\", \"waterColor2\", \"colorBlendFactor\", \"colorBlendFactor2\", \"waveSpeed\"\n ];\n var samplers = [\"normalSampler\",\n // Water\n \"refractionSampler\", \"reflectionSampler\"\n ];\n var uniformBuffers = new Array();\n\n if (ImageProcessingConfiguration) {\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\n }\n\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this.maxSimultaneousLights\n });\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\n {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }\n }, engine), defines);\n\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n\n this._renderId = scene.getRenderId();\n this._wasPreviouslyReady = true;\n\n return true;\n }\n\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\n var scene = this.getScene();\n\n var defines = subMesh._materialDefines;\n if (!defines) {\n return;\n }\n\n var effect = subMesh.effect;\n if (!effect || !this._mesh) {\n return;\n }\n this._activeEffect = effect;\n\n // Matrices\n this.bindOnlyWorldMatrix(world);\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n\n // Bones\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\n\n if (this._mustRebind(scene, effect)) {\n // Textures\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n this._activeEffect.setTexture(\"normalSampler\", this.bumpTexture);\n\n this._activeEffect.setFloat2(\"vNormalInfos\", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);\n this._activeEffect.setMatrix(\"normalMatrix\", this.bumpTexture.getTextureMatrix());\n }\n // Clip plane\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\n\n // Point size\n if (this.pointsCloud) {\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\n }\n\n MaterialHelper.BindEyePosition(effect, scene);\n }\n\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\n\n if (defines.SPECULARTERM) {\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\n }\n\n if (scene.lightsEnabled && !this.disableLighting) {\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\n }\n\n // View\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\n }\n\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\n\n // Log. depth\n MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);\n\n // Water\n if (MaterialFlags.ReflectionTextureEnabled) {\n this._activeEffect.setTexture(\"refractionSampler\", this._refractionRTT);\n this._activeEffect.setTexture(\"reflectionSampler\", this._reflectionRTT);\n }\n\n var wrvp = this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(scene.getProjectionMatrix());\n\n // Add delta time. Prevent adding delta time if it hasn't changed.\n let deltaTime = scene.getEngine().getDeltaTime();\n if (deltaTime !== this._lastDeltaTime) {\n this._lastDeltaTime = deltaTime;\n this._lastTime += this._lastDeltaTime;\n }\n\n this._activeEffect.setMatrix(\"worldReflectionViewProjection\", wrvp);\n this._activeEffect.setVector2(\"windDirection\", this.windDirection);\n this._activeEffect.setFloat(\"waveLength\", this.waveLength);\n this._activeEffect.setFloat(\"time\", this._lastTime / 100000);\n this._activeEffect.setFloat(\"windForce\", this.windForce);\n this._activeEffect.setFloat(\"waveHeight\", this.waveHeight);\n this._activeEffect.setFloat(\"bumpHeight\", this.bumpHeight);\n this._activeEffect.setColor4(\"waterColor\", this.waterColor, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor\", this.colorBlendFactor);\n this._activeEffect.setColor4(\"waterColor2\", this.waterColor2, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor2\", this.colorBlendFactor2);\n this._activeEffect.setFloat(\"waveSpeed\", this.waveSpeed);\n\n // image processing\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\n this._imageProcessingConfiguration.bind(this._activeEffect);\n }\n\n this._afterBind(mesh, this._activeEffect);\n }\n\n private _createRenderTargets(scene: Scene, renderTargetSize: Vector2): void {\n // Render targets\n this._refractionRTT = new RenderTargetTexture(name + \"_refraction\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._refractionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.ignoreCameraViewport = true;\n\n this._reflectionRTT = new RenderTargetTexture(name + \"_reflection\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._reflectionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.ignoreCameraViewport = true;\n\n var isVisible: boolean;\n var clipPlane: Nullable = null;\n var savedViewMatrix: Matrix;\n var mirrorMatrix = Matrix.Zero();\n\n this._refractionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony + 0.05, 0), new Vector3(0, 1, 0));\n }\n };\n\n this._refractionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n scene.clipPlane = clipPlane;\n }\n };\n\n this._reflectionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony - 0.05, 0), new Vector3(0, -1, 0));\n\n Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);\n }\n\n // Transform\n savedViewMatrix = scene.getViewMatrix();\n\n mirrorMatrix.multiplyToRef(savedViewMatrix, this._reflectionTransform);\n scene.setTransformMatrix(this._reflectionTransform, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = false;\n scene._mirroredCameraPosition = Vector3.TransformCoordinates((scene.activeCamera).position, mirrorMatrix);\n };\n\n this._reflectionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n scene.clipPlane = clipPlane;\n\n // Transform\n scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = true;\n scene._mirroredCameraPosition = null;\n };\n }\n\n public getAnimatables(): IAnimatable[] {\n var results = [];\n\n if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {\n results.push(this.bumpTexture);\n }\n if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {\n results.push(this._reflectionRTT);\n }\n if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {\n results.push(this._refractionRTT);\n }\n\n return results;\n }\n\n public getActiveTextures(): BaseTexture[] {\n var activeTextures = super.getActiveTextures();\n\n if (this._bumpTexture) {\n activeTextures.push(this._bumpTexture);\n }\n\n return activeTextures;\n }\n\n public hasTexture(texture: BaseTexture): boolean {\n if (super.hasTexture(texture)) {\n return true;\n }\n\n if (this._bumpTexture === texture) {\n return true;\n }\n\n return false;\n }\n\n public dispose(forceDisposeEffect?: boolean): void {\n if (this.bumpTexture) {\n this.bumpTexture.dispose();\n }\n\n var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n index = -1;\n index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.dispose();\n }\n if (this._refractionRTT) {\n this._refractionRTT.dispose();\n }\n\n // Remove image-processing observer\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n\n super.dispose(forceDisposeEffect);\n }\n\n public clone(name: string): WaterMaterial {\n return SerializationHelper.Clone(() => new WaterMaterial(name, this.getScene()), this);\n }\n\n public serialize(): any {\n var serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.WaterMaterial\";\n\n serializationObject.renderList = [];\n if (this._refractionRTT && this._refractionRTT.renderList) {\n for (var i = 0; i < this._refractionRTT.renderList.length; i++) {\n serializationObject.renderList.push(this._refractionRTT.renderList[i].id);\n }\n }\n\n return serializationObject;\n }\n\n public getClassName(): string {\n return \"WaterMaterial\";\n }\n\n // Statics\n public static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial {\n var mat = SerializationHelper.Parse(() => new WaterMaterial(source.name, scene), source, scene, rootUrl);\n mat._waitingRenderList = source.renderList;\n\n return mat;\n }\n\n public static CreateDefaultMesh(name: string, scene: Scene): Mesh {\n var mesh = Mesh.CreateGround(name, 512, 512, 32, scene, false);\n return mesh;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.WaterMaterial\"] = WaterMaterial;","module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/preview release/materialsLibrary/babylon.waterMaterial.min.js b/dist/preview release/materialsLibrary/babylon.waterMaterial.min.js index c11e45fb619..f0c3fedd2c5 100644 --- a/dist/preview release/materialsLibrary/babylon.waterMaterial.min.js +++ b/dist/preview release/materialsLibrary/babylon.waterMaterial.min.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 i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function o(e,t,r,i){var n,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,r,a):n(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}},2:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},3:function(e,t,r){"use strict";r.r(t);var i=r(1),n=r(0),o="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n";n.Effect.ShadersStore.waterPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n";n.Effect.ShadersStore.waterVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.BUMP=!1,t.REFLECTION=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.SPECULARTERM=!1,t.LOGARITHMICDEPTH=!1,t.FRESNELSEPARATE=!1,t.BUMPSUPERIMPOSE=!1,t.BUMPAFFECTSREFLECTION=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.rebuild(),t}return i.b(t,e),t}(n.MaterialDefines),l=function(e){function t(t,r,i){void 0===i&&(i=new n.Vector2(512,512));var o=e.call(this,t,r)||this;return o.renderTargetSize=i,o.diffuseColor=new n.Color3(1,1,1),o.specularColor=new n.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new n.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new n.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new n.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.disableClipPlane=!1,o._renderTargets=new n.SmartArray(16),o._mesh=null,o._reflectionTransform=n.Matrix.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(r,i),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return i.b(t,e),Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!0,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var t=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=t),this._reflectionRTT&&(this._reflectionRTT.refreshRate=t)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!0,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,r){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var i=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(i._areTexturesDirty&&(i._needUVs=!1,o.texturesEnabled)){if(this.bumpTexture&&n.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;i._needUVs=!0,i.BUMP=!0}n.MaterialFlags.ReflectionTextureEnabled&&(i.REFLECTION=!0)}if(n.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,i,!!r),n.MaterialHelper.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),i),i._areMiscDirty&&(this._fresnelSeparate&&(i.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(i.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(i.BUMPAFFECTSREFLECTION=!0)),i._needNormals=n.MaterialHelper.PrepareDefinesForLights(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(i),i.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,i.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(n.MaterialHelper.PrepareDefinesForAttributes(e,i,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l0&&c.addCPUSkinningFallback(0,e);var f=[n.VertexBuffer.PositionKind];i.NORMAL&&f.push(n.VertexBuffer.NormalKind),i.UV1&&f.push(n.VertexBuffer.UVKind),i.UV2&&f.push(n.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&f.push(n.VertexBuffer.ColorKind),n.MaterialHelper.PrepareAttributesForBones(f,e,i,c),n.MaterialHelper.PrepareAttributesForInstances(f,i);var u=i.toString(),d=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed"],p=["normalSampler","refractionSampler","reflectionSampler"],m=new Array;n.ImageProcessingConfiguration&&(n.ImageProcessingConfiguration.PrepareUniforms(d,i),n.ImageProcessingConfiguration.PrepareSamplers(p,i)),n.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:m,samplers:p,defines:i,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("water",{attributes:f,uniformsNames:d,uniformBuffersNames:m,samplers:p,defines:u,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),i)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,r){var i=this.getScene(),o=r._materialDefines;if(o){var a=r.effect;if(a&&this._mesh){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",i.getTransformMatrix()),n.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(i,a)&&(this.bumpTexture&&n.MaterialFlags.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),n.MaterialHelper.BindClipPlane(this._activeEffect,i),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.MaterialHelper.BindEyePosition(a,i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),i.lightsEnabled&&!this.disableLighting&&n.MaterialHelper.BindLights(i,t,this._activeEffect,o,this.maxSimultaneousLights),i.fogEnabled&&t.applyFog&&i.fogMode!==n.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",i.getViewMatrix()),n.MaterialHelper.BindFogParameters(i,t,this._activeEffect),n.MaterialHelper.BindLogDepth(o,this._activeEffect,i),n.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var s=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(i.getProjectionMatrix()),l=i.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",s),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(t,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,t){var r,i=this;this._refractionRTT=new n.RenderTargetTexture(name+"_refraction",{width:t.x,height:t.y},e,!1,!0),this._refractionRTT.wrapU=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new n.RenderTargetTexture(name+"_reflection",{width:t.x,height:t.y},e,!1,!0),this._reflectionRTT.wrapU=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s=n.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(i._mesh&&(r=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var t=i._mesh?i._mesh.position.y:0;e.clipPlane=n.Plane.FromPositionAndNormal(new n.Vector3(0,t+.05,0),new n.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=r),i.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(i._mesh&&(r=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var t=i._mesh?i._mesh.position.y:0;e.clipPlane=n.Plane.FromPositionAndNormal(new n.Vector3(0,t-.05,0),new n.Vector3(0,-1,0)),n.Matrix.ReflectionToRef(e.clipPlane,s)}o=e.getViewMatrix(),s.multiplyToRef(o,i._reflectionTransform),e.setTransformMatrix(i._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=n.Vector3.TransformCoordinates(e.activeCamera.position,s)},this._reflectionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=r),e.clipPlane=a,e.setTransformMatrix(o,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&t.push(this._bumpTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._bumpTexture===t},t.prototype.dispose=function(t){this.bumpTexture&&this.bumpTexture.dispose();var r=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=r&&this.getScene().customRenderTargets.splice(r,1),r=-1,-1!=(r=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&this.getScene().customRenderTargets.splice(r,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var r=this;return n.SerializationHelper.Clone(function(){return new t(e,r.getScene())},this)},t.prototype.serialize=function(){var e=n.SerializationHelper.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var t=0;t=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,r,a):n(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}},2:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},3:function(e,t,r){"use strict";r.r(t);var i=r(1),n=r(0),o="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n";n.Effect.ShadersStore.waterPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n";n.Effect.ShadersStore.waterVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.BUMP=!1,t.REFLECTION=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.SPECULARTERM=!1,t.LOGARITHMICDEPTH=!1,t.FRESNELSEPARATE=!1,t.BUMPSUPERIMPOSE=!1,t.BUMPAFFECTSREFLECTION=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.rebuild(),t}return i.b(t,e),t}(n.MaterialDefines),l=function(e){function t(t,r,i){void 0===i&&(i=new n.Vector2(512,512));var o=e.call(this,t,r)||this;return o.renderTargetSize=i,o.diffuseColor=new n.Color3(1,1,1),o.specularColor=new n.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new n.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new n.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new n.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.disableClipPlane=!1,o._renderTargets=new n.SmartArray(16),o._mesh=null,o._reflectionTransform=n.Matrix.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(r,i),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return i.b(t,e),Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!0,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var t=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=t),this._reflectionRTT&&(this._reflectionRTT.refreshRate=t)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!0,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,r){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var i=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(i._areTexturesDirty&&(i._needUVs=!1,o.texturesEnabled)){if(this.bumpTexture&&n.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;i._needUVs=!0,i.BUMP=!0}n.MaterialFlags.ReflectionTextureEnabled&&(i.REFLECTION=!0)}if(n.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,i,!!r),n.MaterialHelper.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),i),i._areMiscDirty&&(this._fresnelSeparate&&(i.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(i.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(i.BUMPAFFECTSREFLECTION=!0)),i._needNormals=n.MaterialHelper.PrepareDefinesForLights(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(i),i.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,i.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(n.MaterialHelper.PrepareDefinesForAttributes(e,i,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l0&&c.addCPUSkinningFallback(0,e);var f=[n.VertexBuffer.PositionKind];i.NORMAL&&f.push(n.VertexBuffer.NormalKind),i.UV1&&f.push(n.VertexBuffer.UVKind),i.UV2&&f.push(n.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&f.push(n.VertexBuffer.ColorKind),n.MaterialHelper.PrepareAttributesForBones(f,e,i,c),n.MaterialHelper.PrepareAttributesForInstances(f,i);var u=i.toString(),d=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed"],p=["normalSampler","refractionSampler","reflectionSampler"],m=new Array;n.ImageProcessingConfiguration&&(n.ImageProcessingConfiguration.PrepareUniforms(d,i),n.ImageProcessingConfiguration.PrepareSamplers(p,i)),n.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:m,samplers:p,defines:i,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("water",{attributes:f,uniformsNames:d,uniformBuffersNames:m,samplers:p,defines:u,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),i)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,r){var i=this.getScene(),o=r._materialDefines;if(o){var a=r.effect;if(a&&this._mesh){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",i.getTransformMatrix()),n.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(i,a)&&(this.bumpTexture&&n.MaterialFlags.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),n.MaterialHelper.BindClipPlane(this._activeEffect,i),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.MaterialHelper.BindEyePosition(a,i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),i.lightsEnabled&&!this.disableLighting&&n.MaterialHelper.BindLights(i,t,this._activeEffect,o,this.maxSimultaneousLights),i.fogEnabled&&t.applyFog&&i.fogMode!==n.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",i.getViewMatrix()),n.MaterialHelper.BindFogParameters(i,t,this._activeEffect),n.MaterialHelper.BindLogDepth(o,this._activeEffect,i),n.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var s=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(i.getProjectionMatrix()),l=i.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",s),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(t,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,t){var r,i=this;this._refractionRTT=new n.RenderTargetTexture(name+"_refraction",{width:t.x,height:t.y},e,!1,!0),this._refractionRTT.wrapU=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new n.RenderTargetTexture(name+"_reflection",{width:t.x,height:t.y},e,!1,!0),this._reflectionRTT.wrapU=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=n.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s=n.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(i._mesh&&(r=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var t=i._mesh?i._mesh.position.y:0;e.clipPlane=n.Plane.FromPositionAndNormal(new n.Vector3(0,t+.05,0),new n.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=r),i.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(i._mesh&&(r=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var t=i._mesh?i._mesh.position.y:0;e.clipPlane=n.Plane.FromPositionAndNormal(new n.Vector3(0,t-.05,0),new n.Vector3(0,-1,0)),n.Matrix.ReflectionToRef(e.clipPlane,s)}o=e.getViewMatrix(),s.multiplyToRef(o,i._reflectionTransform),e.setTransformMatrix(i._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=n.Vector3.TransformCoordinates(e.activeCamera.position,s)},this._reflectionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=r),e.clipPlane=a,e.setTransformMatrix(o,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&t.push(this._bumpTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._bumpTexture===t},t.prototype.dispose=function(t){this.bumpTexture&&this.bumpTexture.dispose();var r=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=r&&this.getScene().customRenderTargets.splice(r,1),r=-1,-1!=(r=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&this.getScene().customRenderTargets.splice(r,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var r=this;return n.SerializationHelper.Clone(function(){return new t(e,r.getScene())},this)},t.prototype.serialize=function(){var e=n.SerializationHelper.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var t=0;t= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'cellPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\nvoid main(void)\n{\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var cellPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'cellVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var cellVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\n\r\nimport \"./cell.fragment\";\r\nimport \"./cell.vertex\";\r\n\r\nclass CellMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public NDOTL = true;\r\n public CUSTOMUSERLIGHTING = true;\r\n public CELLBASIC = true;\r\n public DEPTHPREPASS = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class CellMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"computeHighLevel\")\r\n public _computeHighLevel: boolean = false;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public computeHighLevel: boolean;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new CellMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n defines.CELLBASIC = !this.computeHighLevel;\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"cell\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\"\r\n ];\r\n var samplers = [\"diffuseSampler\"];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights - 1 }\r\n }, engine), defines);\r\n\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.CellMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial {\r\n return SerializationHelper.Parse(() => new CellMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.CellMaterial\"] = CellMaterial;\r\n","export * from \"./cellMaterial\";","import { Texture } from \"babylonjs/Materials/Textures/texture\";\nimport { Effect } from \"babylonjs/Materials/effect\";\nimport { StandardMaterialDefines } from \"babylonjs/Materials/standardMaterial\";\nimport { StandardMaterial } from \"babylonjs/Materials/standardMaterial\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nexport class CustomShaderStructure {\n\n public FragmentStore: string;\n public VertexStore: string;\n\n constructor() { }\n}\n\nexport class ShaderSpecialParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n\n // diffuseColor\n public Fragment_Custom_Diffuse: string;\n // lights\n public Fragment_Before_Lights: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class CustomMaterial extends StandardMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderSpecialParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: any[];\n _newSamplerInstances: Texture[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh, effect: Effect) {\n for (var el in this._newUniformInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n for (var el in this._newSamplerInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines): string {\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n CustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + CustomMaterial.ShaderIndexer;\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"));\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderSpecialParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"defaultPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"defaultVertexShader\"];\n }\n\n public AddUniform(name: string, kind: string, param: any): CustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = new Array();\n this._newUniformInstances = new Array();\n }\n if (param) {\n if (kind.indexOf(\"sampler\") == -1) {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n else {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Diffuse = shaderPart.replace(\"result\", \"diffuseColor\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.CustomMaterial\"] = CustomMaterial;","export * from \"./customMaterial\";\nexport * from \"./pbrCustomMaterial\";","import { Texture } from \"babylonjs/Materials/Textures/texture\";\nimport { Effect } from \"babylonjs/Materials/effect\";\nimport { PBRMaterialDefines } from \"babylonjs/Materials/PBR/pbrBaseMaterial\";\nimport { PBRMaterial } from \"babylonjs/Materials/PBR/pbrMaterial\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nexport class ShaderAlebdoParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n\n // albedoColor\n public Fragment_Custom_Albedo: string;\n // lights\n public Fragment_Before_Lights: string;\n // roughness\n public Fragment_Custom_MetallicRoughness: string;\n // microsurface\n public Fragment_Custom_MicroSurface: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class PBRCustomMaterial extends PBRMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderAlebdoParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: any[];\n _newSamplerInstances: Texture[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh, effect: Effect) {\n for (var el in this._newUniformInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n for (var el in this._newSamplerInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines): string {\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n PBRCustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + PBRCustomMaterial.ShaderIndexer;\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALBEDO', (this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS', (this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE', (this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"));\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderAlebdoParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\n }\n\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = new Array();\n this._newUniformInstances = new Array();\n }\n if (param) {\n if (kind.indexOf(\"sampler\") == -1) {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n else {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.PBRCustomMaterial\"] = PBRCustomMaterial;","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'firePixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\nuniform sampler2D distortionSampler;\nuniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#include\n\n#include\nvec4 bx2(vec4 x)\n{\nreturn vec4(2.0)*x-vec4(1.0);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\n\nfloat alpha=1.0;\n#ifdef DIFFUSE\n\nconst float distortionAmount0=0.092;\nconst float distortionAmount1=0.092;\nconst float distortionAmount2=0.092;\nvec2 heightAttenuation=vec2(0.3,0.39);\nvec4 noise0=texture2D(distortionSampler,vDistortionCoords1);\nvec4 noise1=texture2D(distortionSampler,vDistortionCoords2);\nvec4 noise2=texture2D(distortionSampler,vDistortionCoords3);\nvec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;\nvec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);\nvec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;\nbaseColor*=opacityColor;\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=vec4(baseColor.rgb,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var firePixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\n\nlet name = 'fireVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n\nuniform float time;\nuniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#ifdef DIFFUSE\nvDiffuseUV=uv;\nvDiffuseUV.y-=0.2;\n#endif\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\n\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;\nvDistortionCoords1.x=uv.x;\nvDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;\nvDistortionCoords2.x=uv.x;\nvDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;\nvDistortionCoords3.x=uv.x;\nvDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var fireVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { Tags } from \"babylonjs/Misc/tags\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { EffectFallbacks } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\n\r\nimport \"./fire.fragment\";\r\nimport \"./fire.vertex\";\r\n\r\nclass FireMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public UV1 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public BonesPerMesh = 0;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FireMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: Nullable;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: Nullable;\r\n\r\n @serializeAsTexture(\"distortionTexture\")\r\n private _distortionTexture: Nullable;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public distortionTexture: Nullable;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: Nullable;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: Nullable;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public speed = 1.0;\r\n\r\n private _scaledDiffuse = new Color3();\r\n private _renderId: number;\r\n private _lastTime: number = 0;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new FireMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n\r\n defines.ALPHATEST = this._opacityTexture ? true : false;\r\n\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n defines.POINTSIZE = (this.pointsCloud || scene.forcePointsCloud);\r\n defines.FOG = (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE && this.fogEnabled);\r\n }\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"fire\";\r\n\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: [\"world\", \"view\", \"viewProjection\", \"vEyePosition\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\",\r\n // Fire\r\n \"time\", \"speed\"\r\n ],\r\n uniformBuffersNames: [],\r\n samplers: [\"diffuseSampler\",\r\n // Fire\r\n \"distortionSampler\", \"opacitySampler\"\r\n ],\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: null,\r\n maxSimultaneousLights: 4,\r\n transformFeedbackVaryings: null\r\n }, engine), defines);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n\r\n this._activeEffect.setTexture(\"distortionSampler\", this._distortionTexture);\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this._scaledDiffuse, this.alpha * mesh.visibility);\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n // Time\r\n this._lastTime += scene.getEngine().getDeltaTime();\r\n this._activeEffect.setFloat(\"time\", this._lastTime);\r\n\r\n // Speed\r\n this._activeEffect.setFloat(\"speed\", this.speed);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._distortionTexture && this._distortionTexture.animations && this._distortionTexture.animations.length > 0) {\r\n results.push(this._distortionTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._distortionTexture) {\r\n activeTextures.push(this._distortionTexture);\r\n }\r\n\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._distortionTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FireMaterial\";\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._distortionTexture) {\r\n this._distortionTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FireMaterial {\r\n return SerializationHelper.Clone(() => new FireMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n\r\n var serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FireMaterial\";\r\n serializationObject.diffuseColor = this.diffuseColor.asArray();\r\n serializationObject.speed = this.speed;\r\n\r\n if (this._diffuseTexture) {\r\n serializationObject._diffuseTexture = this._diffuseTexture.serialize();\r\n }\r\n\r\n if (this._distortionTexture) {\r\n serializationObject._distortionTexture = this._distortionTexture.serialize();\r\n }\r\n\r\n if (this._opacityTexture) {\r\n serializationObject._opacityTexture = this._opacityTexture.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FireMaterial {\r\n var material = new FireMaterial(source.name, scene);\r\n\r\n material.diffuseColor = Color3.FromArray(source.diffuseColor);\r\n material.speed = source.speed;\r\n\r\n material.alpha = source.alpha;\r\n\r\n material.id = source.id;\r\n\r\n Tags.AddTagsTo(material, source.tags);\r\n material.backFaceCulling = source.backFaceCulling;\r\n material.wireframe = source.wireframe;\r\n\r\n if (source._diffuseTexture) {\r\n material._diffuseTexture = Texture.Parse(source._diffuseTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._distortionTexture) {\r\n material._distortionTexture = Texture.Parse(source._distortionTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._opacityTexture) {\r\n material._opacityTexture = Texture.Parse(source._opacityTexture, scene, rootUrl);\r\n }\r\n\r\n if (source.checkReadyOnlyOnce) {\r\n material.checkReadyOnlyOnce = source.checkReadyOnlyOnce;\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.FireMaterial\"] = FireMaterial;","export * from \"./fireMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'furPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 furColor;\nuniform float furLength;\nvarying vec3 vPositionW;\nvarying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform float furOcclusion;\nuniform sampler2D furTexture;\nvarying vec2 vFurUV;\n#endif\n#include\n#include\n#include\n#include\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=furColor;\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\n\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));\nif (furTextureColor.a<=0.0 || furTextureColor.g[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;\nvec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var furPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'furVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\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\nuniform float furLength;\nuniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform vec3 furGravity;\nuniform float furTime;\nuniform float furSpacing;\nuniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n#include\n#include\n\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else\nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);\nvec3 tangent2=vec3(-normal.z,0,normal.x);\nr=Rand(tangent1*r);\nfloat J=(2.0+4.0*r);\nr=Rand(tangent2*r);\nfloat K=(2.0+2.0*r);\ntangent1=tangent1*J+tangent2*K;\ntangent1=normalize(tangent1);\nvec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\n\nvec3 forceDirection=vec3(0.0,0.0,0.0);\nforceDirection.x=sin(furTime+position.x*0.05)*0.2;\nforceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;\nforceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;\nvec3 displacement=vec3(0.0,0.0,0.0);\ndisplacement=furGravity+forceDirection;\nfloat displacementFactor=pow(furOffset,3.0);\nvec3 aNormal=normal;\naNormal.xyz+=displacement*displacementFactor;\nnewPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var furVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { Tags } from \"babylonjs/Misc/tags\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"babylonjs/Materials/Textures/dynamicTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./fur.fragment\";\r\nimport \"./fur.vertex\";\r\n\r\nclass FurMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public HEIGHTMAP = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public HIGHLEVEL = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FurMaterial extends PushMaterial {\r\n\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"heightTexture\")\r\n private _heightTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public heightTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public furLength: number = 1;\r\n\r\n @serialize()\r\n public furAngle: number = 0;\r\n\r\n @serializeAsColor3()\r\n public furColor = new Color3(0.44, 0.21, 0.02);\r\n\r\n @serialize()\r\n public furOffset: number = 0.0;\r\n\r\n @serialize()\r\n public furSpacing: number = 12;\r\n\r\n @serializeAsVector3()\r\n public furGravity = new Vector3(0, 0, 0);\r\n\r\n @serialize()\r\n public furSpeed: number = 100;\r\n\r\n @serialize()\r\n public furDensity: number = 20;\r\n\r\n @serialize()\r\n public furOcclusion: number = 0.0;\r\n\r\n public furTexture: DynamicTexture;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n @serialize()\r\n public highLevelFur: boolean = true;\r\n\r\n public _meshes: AbstractMesh[];\r\n\r\n private _renderId: number;\r\n\r\n private _furTime: number = 0;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n @serialize()\r\n public get furTime() {\r\n return this._furTime;\r\n }\r\n\r\n public set furTime(furTime: number) {\r\n this._furTime = furTime;\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n public updateFur(): void {\r\n for (var i = 1; i < this._meshes.length; i++) {\r\n var offsetFur = this._meshes[i].material;\r\n\r\n offsetFur.furLength = this.furLength;\r\n offsetFur.furAngle = this.furAngle;\r\n offsetFur.furGravity = this.furGravity;\r\n offsetFur.furSpacing = this.furSpacing;\r\n offsetFur.furSpeed = this.furSpeed;\r\n offsetFur.furColor = this.furColor;\r\n offsetFur.diffuseTexture = this.diffuseTexture;\r\n offsetFur.furTexture = this.furTexture;\r\n offsetFur.highLevelFur = this.highLevelFur;\r\n offsetFur.furTime = this.furTime;\r\n offsetFur.furDensity = this.furDensity;\r\n }\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new FurMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n if (this.heightTexture && engine.getCaps().maxVertexTextureImageUnits) {\r\n if (!this.heightTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.HEIGHTMAP = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n if (this.highLevelFur !== defines.HIGHLEVEL) {\r\n defines.HIGHLEVEL = true;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"fur\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\",\r\n \"furLength\", \"furAngle\", \"furColor\", \"furOffset\", \"furGravity\", \"furTime\", \"furSpacing\", \"furDensity\", \"furOcclusion\"\r\n ];\r\n var samplers = [\"diffuseSampler\",\r\n \"heightTexture\", \"furTexture\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (scene.getCachedMaterial() !== this) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n if (this._heightTexture) {\r\n this._activeEffect.setTexture(\"heightTexture\", this._heightTexture);\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setFloat(\"furLength\", this.furLength);\r\n this._activeEffect.setFloat(\"furAngle\", this.furAngle);\r\n this._activeEffect.setColor4(\"furColor\", this.furColor, 1.0);\r\n\r\n if (this.highLevelFur) {\r\n this._activeEffect.setVector3(\"furGravity\", this.furGravity);\r\n this._activeEffect.setFloat(\"furOffset\", this.furOffset);\r\n this._activeEffect.setFloat(\"furSpacing\", this.furSpacing);\r\n this._activeEffect.setFloat(\"furDensity\", this.furDensity);\r\n this._activeEffect.setFloat(\"furOcclusion\", this.furOcclusion);\r\n\r\n this._furTime += this.getScene().getEngine().getDeltaTime() / this.furSpeed;\r\n this._activeEffect.setFloat(\"furTime\", this._furTime);\r\n\r\n this._activeEffect.setTexture(\"furTexture\", this.furTexture);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n if (this.heightTexture && this.heightTexture.animations && this.heightTexture.animations.length > 0) {\r\n results.push(this.heightTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._heightTexture) {\r\n activeTextures.push(this._heightTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._heightTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n if (this._meshes) {\r\n for (var i = 1; i < this._meshes.length; i++) {\r\n let mat = this._meshes[i].material;\r\n\r\n if (mat) {\r\n mat.dispose(forceDisposeEffect);\r\n }\r\n this._meshes[i].dispose();\r\n }\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FurMaterial {\r\n return SerializationHelper.Clone(() => new FurMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.FurMaterial\";\r\n\r\n if (this._meshes) {\r\n serializationObject.sourceMeshName = this._meshes[0].name;\r\n serializationObject.quality = this._meshes.length;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FurMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial {\r\n var material = SerializationHelper.Parse(() => new FurMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.sourceMeshName && material.highLevelFur) {\r\n scene.executeWhenReady(() => {\r\n var sourceMesh = scene.getMeshByName(source.sourceMeshName);\r\n if (sourceMesh) {\r\n var furTexture = FurMaterial.GenerateTexture(\"Fur Texture\", scene);\r\n material.furTexture = furTexture;\r\n FurMaterial.FurifyMesh(sourceMesh, source.quality);\r\n }\r\n });\r\n }\r\n\r\n return material;\r\n }\r\n\r\n public static GenerateTexture(name: string, scene: Scene): DynamicTexture {\r\n // Generate fur textures\r\n var texture = new DynamicTexture(\"FurTexture \" + name, 256, scene, true);\r\n var context = texture.getContext();\r\n\r\n for (var i = 0; i < 20000; ++i) {\r\n context.fillStyle = \"rgba(255, \" + Math.floor(Math.random() * 255) + \", \" + Math.floor(Math.random() * 255) + \", 1)\";\r\n context.fillRect((Math.random() * texture.getSize().width), (Math.random() * texture.getSize().height), 2, 2);\r\n }\r\n\r\n texture.update(false);\r\n texture.wrapU = Texture.WRAP_ADDRESSMODE;\r\n texture.wrapV = Texture.WRAP_ADDRESSMODE;\r\n\r\n return texture;\r\n }\r\n\r\n // Creates and returns an array of meshes used as shells for the Fur Material\r\n // that can be disposed later in your code\r\n // The quality is in interval [0, 100]\r\n public static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[] {\r\n var meshes = [sourceMesh];\r\n var mat: FurMaterial = sourceMesh.material;\r\n var i;\r\n\r\n if (!(mat instanceof FurMaterial)) {\r\n throw \"The material of the source mesh must be a Fur Material\";\r\n }\r\n\r\n for (i = 1; i < quality; i++) {\r\n var offsetFur = new FurMaterial(mat.name + i, sourceMesh.getScene());\r\n sourceMesh.getScene().materials.pop();\r\n Tags.EnableFor(offsetFur);\r\n Tags.AddTagsTo(offsetFur, \"furShellMaterial\");\r\n\r\n offsetFur.furLength = mat.furLength;\r\n offsetFur.furAngle = mat.furAngle;\r\n offsetFur.furGravity = mat.furGravity;\r\n offsetFur.furSpacing = mat.furSpacing;\r\n offsetFur.furSpeed = mat.furSpeed;\r\n offsetFur.furColor = mat.furColor;\r\n offsetFur.diffuseTexture = mat.diffuseTexture;\r\n offsetFur.furOffset = i / quality;\r\n offsetFur.furTexture = mat.furTexture;\r\n offsetFur.highLevelFur = mat.highLevelFur;\r\n offsetFur.furTime = mat.furTime;\r\n offsetFur.furDensity = mat.furDensity;\r\n\r\n var offsetMesh = sourceMesh.clone(sourceMesh.name + i) as Mesh;\r\n\r\n offsetMesh.material = offsetFur;\r\n offsetMesh.skeleton = sourceMesh.skeleton;\r\n offsetMesh.position = Vector3.Zero();\r\n meshes.push(offsetMesh);\r\n }\r\n\r\n for (i = 1; i < meshes.length; i++) {\r\n meshes[i].parent = sourceMesh;\r\n }\r\n\r\n (sourceMesh.material)._meshes = meshes;\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.FurMaterial\"] = FurMaterial;","export * from \"./furMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'gradientPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\n\nuniform vec4 topColor;\nuniform vec4 bottomColor;\nuniform float offset;\nuniform float scale;\nuniform float smoothness;\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\nfloat h=vPosition.y*scale+offset;\nfloat mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));\nvec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));\n\nvec3 diffuseColor=baseColor.rgb;\n\nfloat alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef EMISSIVE\nvec3 diffuseBase=baseColor.rgb;\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);\n#endif\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gradientPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'gradientVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\nvPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gradientVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { EffectCreationOptions, EffectFallbacks } from \"babylonjs/Materials/effect\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./gradient.fragment\";\r\nimport \"./gradient.vertex\";\r\n\r\nclass GradientMaterialDefines extends MaterialDefines {\r\n public EMISSIVE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class GradientMaterial extends PushMaterial {\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n // The gradient top color, red by default\r\n @serializeAsColor3()\r\n public topColor = new Color3(1, 0, 0);\r\n\r\n @serialize()\r\n public topColorAlpha = 1.0;\r\n\r\n // The gradient top color, blue by default\r\n @serializeAsColor3()\r\n public bottomColor = new Color3(0, 0, 1);\r\n\r\n @serialize()\r\n public bottomColorAlpha = 1.0;\r\n\r\n // Gradient offset\r\n @serialize()\r\n public offset = 0;\r\n\r\n @serialize()\r\n public scale = 1.0;\r\n\r\n @serialize()\r\n public smoothness = 1.0;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0 || this.topColorAlpha < 1.0 || this.bottomColorAlpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new GradientMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n defines.EMISSIVE = this._disableLighting;\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"gradient\";\r\n var join = defines.toString();\r\n\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\",\r\n \"topColor\", \"bottomColor\", \"offset\", \"smoothness\", \"scale\"\r\n ];\r\n var samplers: string[] = [];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, effect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(effect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setColor4(\"topColor\", this.topColor, this.topColorAlpha);\r\n this._activeEffect.setColor4(\"bottomColor\", this.bottomColor, this.bottomColorAlpha);\r\n this._activeEffect.setFloat(\"offset\", this.offset);\r\n this._activeEffect.setFloat(\"scale\", this.scale);\r\n this._activeEffect.setFloat(\"smoothness\", this.smoothness);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): GradientMaterial {\r\n return SerializationHelper.Clone(() => new GradientMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GradientMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"GradientMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial {\r\n return SerializationHelper.Parse(() => new GradientMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.GradientMaterial\"] = GradientMaterial;","export * from \"./gradientMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'gridPixelShader';\nlet shader = `#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;\nuniform vec3 mainColor;\nuniform vec3 lineColor;\nuniform vec4 gridControl;\nuniform vec3 gridOffset;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\nfloat getVisibility(float position) {\n\nfloat majorGridFrequency=gridControl.y;\nif (floor(position+0.5) == floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{\nreturn 1.0;\n}\nreturn gridControl.z;\n}\nfloat getAnisotropicAttenuation(float differentialLength) {\nconst float maxNumberOfLines=10.0;\nreturn clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);\n}\nfloat isPointOnLine(float position,float differentialLength) {\nfloat fractionPartOfPosition=position-floor(position+0.5);\nfractionPartOfPosition/=differentialLength;\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);\nfloat result=0.5+0.5*cos(fractionPartOfPosition*PI);\nreturn result;\n}\nfloat contributionOnAxis(float position) {\nfloat differentialLength=length(vec2(dFdx(position),dFdy(position)));\ndifferentialLength*=SQRT2;\n\nfloat result=isPointOnLine(position,differentialLength);\n\nfloat visibility=getVisibility(position);\nresult*=visibility;\n\nfloat anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);\nresult*=anisotropicAttenuation;\nreturn result;\n}\nfloat normalImpactOnAxis(float x) {\nfloat normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);\nreturn normalImpact;\n}\nvoid main(void) {\n\nfloat gridRatio=gridControl.x;\nvec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;\n\nfloat x=contributionOnAxis(gridPos.x);\nfloat y=contributionOnAxis(gridPos.y);\nfloat z=contributionOnAxis(gridPos.z);\n\nvec3 normal=normalize(vNormal);\nx*=normalImpactOnAxis(normal.x);\ny*=normalImpactOnAxis(normal.y);\nz*=normalImpactOnAxis(normal.z);\n\nfloat grid=clamp(x+y+z,0.,1.);\n\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\n\ngl_FragColor=vec4(color.rgb,opacity);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gridPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\n\nlet name = 'gridVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\nvoid main(void) {\n#include\n#ifdef FOG\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#endif\n#include\nvec4 cameraSpacePosition=view*finalWorld*vec4(position,1.0);\ngl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\nvPosition=position;\nvNormal=normal;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gridVertexShader = { name, shader };\n","import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix, Vector4, Vector3 } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./grid.fragment\";\r\nimport \"./grid.vertex\";\r\n\r\nclass GridMaterialDefines extends MaterialDefines {\r\n public OPACITY = false;\r\n public TRANSPARENT = false;\r\n public FOG = false;\r\n public PREMULTIPLYALPHA = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * The grid materials allows you to wrap any shape with a grid.\r\n * Colors are customizable.\r\n */\r\nexport class GridMaterial extends PushMaterial {\r\n\r\n /**\r\n * Main color of the grid (e.g. between lines)\r\n */\r\n @serializeAsColor3()\r\n public mainColor = Color3.Black();\r\n\r\n /**\r\n * Color of the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public lineColor = Color3.Teal();\r\n\r\n /**\r\n * The scale of the grid compared to unit.\r\n */\r\n @serialize()\r\n public gridRatio = 1.0;\r\n\r\n /**\r\n * Allows setting an offset for the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public gridOffset = Vector3.Zero();\r\n\r\n /**\r\n * The frequency of thicker lines.\r\n */\r\n @serialize()\r\n public majorUnitFrequency = 10;\r\n\r\n /**\r\n * The visibility of minor units in the grid.\r\n */\r\n @serialize()\r\n public minorUnitVisibility = 0.33;\r\n\r\n /**\r\n * The grid opacity outside of the lines.\r\n */\r\n @serialize()\r\n public opacity = 1.0;\r\n\r\n /**\r\n * Determine RBG output is premultiplied by alpha value.\r\n */\r\n @serialize()\r\n public preMultiplyAlpha = false;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: BaseTexture;\r\n\r\n private _gridControl: Vector4 = new Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity);\r\n\r\n private _renderId: number;\r\n\r\n /**\r\n * constructor\r\n * @param name The name given to the material in order to identify it afterwards.\r\n * @param scene The scene the material is used in.\r\n */\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * Returns wehter or not the grid requires alpha blending.\r\n */\r\n public needAlphaBlending(): boolean {\r\n return this.opacity < 1.0 || this._opacityTexture && this._opacityTexture.isReady();\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending();\r\n }\r\n\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new GridMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n if (defines.TRANSPARENT !== (this.opacity < 1.0)) {\r\n defines.TRANSPARENT = !defines.TRANSPARENT;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.PREMULTIPLYALPHA != this.preMultiplyAlpha) {\r\n defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.OPACITY = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, false, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, scene.getEngine(), defines, !!useInstances);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Attributes\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, false);\r\n var attribs = [VertexBuffer.PositionKind, VertexBuffer.NormalKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Defines\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(\"grid\",\r\n attribs,\r\n [\"projection\", \"mainColor\", \"lineColor\", \"gridControl\", \"gridOffset\", \"vFogInfos\", \"vFogColor\", \"world\", \"view\",\r\n \"opacityMatrix\", \"vOpacityInfos\"],\r\n [\"opacitySampler\"],\r\n join,\r\n undefined,\r\n this.onCompiled,\r\n this.onError), defines);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n if (!defines.INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n this._activeEffect.setMatrix(\"projection\", scene.getProjectionMatrix());\r\n\r\n // Uniforms\r\n if (this._mustRebind(scene, effect)) {\r\n this._activeEffect.setColor3(\"mainColor\", this.mainColor);\r\n this._activeEffect.setColor3(\"lineColor\", this.lineColor);\r\n\r\n this._activeEffect.setVector3(\"gridOffset\", this.gridOffset);\r\n\r\n this._gridControl.x = this.gridRatio;\r\n this._gridControl.y = Math.round(this.majorUnitFrequency);\r\n this._gridControl.z = this.minorUnitVisibility;\r\n this._gridControl.w = this.opacity;\r\n this._activeEffect.setVector4(\"gridControl\", this._gridControl);\r\n\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n this._activeEffect.setFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n this._activeEffect.setMatrix(\"opacityMatrix\", this._opacityTexture.getTextureMatrix());\r\n }\r\n }\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n /**\r\n * Dispose the material and its associated resources.\r\n * @param forceDisposeEffect will also dispose the used effect when true\r\n */\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): GridMaterial {\r\n return SerializationHelper.Clone(() => new GridMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GridMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"GridMaterial\";\r\n }\r\n\r\n public static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {\r\n return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.GridMaterial\"] = GridMaterial;","export * from \"./gridMaterial\";","export * from \"./cell\";\r\nexport * from \"./custom\";\r\nexport * from \"./fire\";\r\nexport * from \"./fur\";\r\nexport * from \"./gradient\";\r\nexport * from \"./grid\";\r\nexport * from \"./lava\";\r\nexport * from \"./mix\";\r\nexport * from \"./normal\";\r\nexport * from \"./shadowOnly\";\r\nexport * from \"./simple\";\r\nexport * from \"./sky\";\r\nexport * from \"./terrain\";\r\nexport * from \"./triPlanar\";\r\nexport * from \"./water\";","export * from \"./lavaMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'lavaPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n\nuniform float time;\nuniform float speed;\nuniform float movingSpeed;\nuniform vec3 fogColor;\nuniform sampler2D noiseTexture;\nuniform float fogDensity;\n\nvarying float noise;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nfloat random( vec3 scale,float seed ){\nreturn fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;\n}\nvoid main(void) {\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#ifdef DIFFUSE\n\nvec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );\nvec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time*0.02;\nvec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;\nT1.x+=noiseTex.x*2.0;\nT1.y+=noiseTex.y*2.0;\nT2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;\nT2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;\nfloat p=texture2D( noiseTexture,T1*3.0 ).a;\nvec4 lavaColor=texture2D( diffuseSampler,T2*4.0);\nvec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );\nbaseColor=temp;\nfloat depth=gl_FragCoord.z*4.0;\nconst float LOG2=1.442695;\nfloat fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );\nfogFactor=1.0-clamp( fogFactor,0.0,1.0 );\nbaseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );\ndiffuseColor=baseColor.rgb;\n\n\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var lavaPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'lavaVertexShader';\nlet shader = `precision highp float;\n\nuniform float time;\nuniform float lowFrequencySpeed;\n\nvarying float noise;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n\n\n\nvec3 mod289(vec3 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 mod289(vec4 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 permute(vec4 x)\n{\nreturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\nreturn 1.79284291400159-0.85373472095314*r;\n}\nvec3 fade(vec3 t) {\nreturn t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\nfloat pnoise(vec3 P,vec3 rep)\n{\nvec3 Pi0=mod(floor(P),rep);\nvec3 Pi1=mod(Pi0+vec3(1.0),rep);\nPi0=mod289(Pi0);\nPi1=mod289(Pi1);\nvec3 Pf0=fract(P);\nvec3 Pf1=Pf0-vec3(1.0);\nvec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);\nvec4 iy=vec4(Pi0.yy,Pi1.yy);\nvec4 iz0=Pi0.zzzz;\nvec4 iz1=Pi1.zzzz;\nvec4 ixy=permute(permute(ix)+iy);\nvec4 ixy0=permute(ixy+iz0);\nvec4 ixy1=permute(ixy+iz1);\nvec4 gx0=ixy0*(1.0/7.0);\nvec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;\ngx0=fract(gx0);\nvec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);\nvec4 sz0=step(gz0,vec4(0.0));\ngx0-=sz0*(step(0.0,gx0)-0.5);\ngy0-=sz0*(step(0.0,gy0)-0.5);\nvec4 gx1=ixy1*(1.0/7.0);\nvec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;\ngx1=fract(gx1);\nvec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);\nvec4 sz1=step(gz1,vec4(0.0));\ngx1-=sz1*(step(0.0,gx1)-0.5);\ngy1-=sz1*(step(0.0,gy1)-0.5);\nvec3 g000=vec3(gx0.x,gy0.x,gz0.x);\nvec3 g100=vec3(gx0.y,gy0.y,gz0.y);\nvec3 g010=vec3(gx0.z,gy0.z,gz0.z);\nvec3 g110=vec3(gx0.w,gy0.w,gz0.w);\nvec3 g001=vec3(gx1.x,gy1.x,gz1.x);\nvec3 g101=vec3(gx1.y,gy1.y,gz1.y);\nvec3 g011=vec3(gx1.z,gy1.z,gz1.z);\nvec3 g111=vec3(gx1.w,gy1.w,gz1.w);\nvec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));\ng000*=norm0.x;\ng010*=norm0.y;\ng100*=norm0.z;\ng110*=norm0.w;\nvec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));\ng001*=norm1.x;\ng011*=norm1.y;\ng101*=norm1.z;\ng111*=norm1.w;\nfloat n000=dot(g000,Pf0);\nfloat n100=dot(g100,vec3(Pf1.x,Pf0.yz));\nfloat n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));\nfloat n110=dot(g110,vec3(Pf1.xy,Pf0.z));\nfloat n001=dot(g001,vec3(Pf0.xy,Pf1.z));\nfloat n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));\nfloat n011=dot(g011,vec3(Pf0.x,Pf1.yz));\nfloat n111=dot(g111,Pf1);\nvec3 fade_xyz=fade(Pf0);\nvec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);\nvec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);\nfloat n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);\nreturn 2.2*n_xyz;\n}\n\nfloat turbulence( vec3 p ) {\nfloat w=100.0;\nfloat t=-.5;\nfor (float f=1.0 ; f<=10.0 ; f++ ){\nfloat power=pow( 2.0,f );\nt+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );\n}\nreturn t;\n}\nvoid main(void) {\n#include\n#include\n#ifdef NORMAL\n\nnoise=10.0*-.10*turbulence( .5*normal+time*1.15 );\n\nfloat b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );\n\nfloat displacement =-1.5*noise+b;\n\nvec3 newPosition=position+normal*displacement;\ngl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var lavaVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\nimport { Color3 } from \"babylonjs/Maths/math.color\";\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nimport \"./lava.fragment\";\nimport \"./lava.vertex\";\n\nclass LavaMaterialDefines extends MaterialDefines {\n public DIFFUSE = false;\n public CLIPPLANE = false;\n public CLIPPLANE2 = false;\n public CLIPPLANE3 = false;\n public CLIPPLANE4 = false;\n public ALPHATEST = false;\n public DEPTHPREPASS = false;\n public POINTSIZE = false;\n public FOG = false;\n public LIGHT0 = false;\n public LIGHT1 = false;\n public LIGHT2 = false;\n public LIGHT3 = false;\n public SPOTLIGHT0 = false;\n public SPOTLIGHT1 = false;\n public SPOTLIGHT2 = false;\n public SPOTLIGHT3 = false;\n public HEMILIGHT0 = false;\n public HEMILIGHT1 = false;\n public HEMILIGHT2 = false;\n public HEMILIGHT3 = false;\n public DIRLIGHT0 = false;\n public DIRLIGHT1 = false;\n public DIRLIGHT2 = false;\n public DIRLIGHT3 = false;\n public POINTLIGHT0 = false;\n public POINTLIGHT1 = false;\n public POINTLIGHT2 = false;\n public POINTLIGHT3 = false;\n public SHADOW0 = false;\n public SHADOW1 = false;\n public SHADOW2 = false;\n public SHADOW3 = false;\n public SHADOWS = false;\n public SHADOWESM0 = false;\n public SHADOWESM1 = false;\n public SHADOWESM2 = false;\n public SHADOWESM3 = false;\n public SHADOWPOISSON0 = false;\n public SHADOWPOISSON1 = false;\n public SHADOWPOISSON2 = false;\n public SHADOWPOISSON3 = false;\n public SHADOWPCF0 = false;\n public SHADOWPCF1 = false;\n public SHADOWPCF2 = false;\n public SHADOWPCF3 = false;\n public SHADOWPCSS0 = false;\n public SHADOWPCSS1 = false;\n public SHADOWPCSS2 = false;\n public SHADOWPCSS3 = false;\n public NORMAL = false;\n public UV1 = false;\n public UV2 = false;\n public VERTEXCOLOR = false;\n public VERTEXALPHA = false;\n public NUM_BONE_INFLUENCERS = 0;\n public BonesPerMesh = 0;\n public INSTANCES = false;\n public UNLIT = false;\n\n constructor() {\n super();\n this.rebuild();\n }\n}\n\nexport class LavaMaterial extends PushMaterial {\n @serializeAsTexture(\"diffuseTexture\")\n private _diffuseTexture: BaseTexture;\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n public diffuseTexture: BaseTexture;\n\n @serializeAsTexture()\n public noiseTexture: BaseTexture;\n\n @serializeAsColor3()\n public fogColor: Color3;\n\n @serialize()\n public speed: number = 1;\n\n @serialize()\n public movingSpeed: number = 1;\n\n @serialize()\n public lowFrequencySpeed: number = 1;\n\n @serialize()\n public fogDensity: number = 0.15;\n\n private _lastTime: number = 0;\n\n @serializeAsColor3()\n public diffuseColor = new Color3(1, 1, 1);\n\n @serialize(\"disableLighting\")\n private _disableLighting = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public disableLighting: boolean;\n\n @serialize(\"unlit\")\n private _unlit = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public unlit: boolean;\n\n @serialize(\"maxSimultaneousLights\")\n private _maxSimultaneousLights = 4;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public maxSimultaneousLights: number;\n\n private _scaledDiffuse = new Color3();\n private _renderId: number;\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n }\n\n public needAlphaBlending(): boolean {\n return (this.alpha < 1.0);\n }\n\n public needAlphaTesting(): boolean {\n return false;\n }\n\n public getAlphaTestTexture(): Nullable {\n return null;\n }\n\n // Methods\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\n if (this.isFrozen) {\n if (this._wasPreviouslyReady && subMesh.effect) {\n return true;\n }\n }\n\n if (!subMesh._materialDefines) {\n subMesh._materialDefines = new LavaMaterialDefines();\n }\n\n var defines = subMesh._materialDefines;\n var scene = this.getScene();\n\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\n if (this._renderId === scene.getRenderId()) {\n return true;\n }\n }\n\n var engine = scene.getEngine();\n\n // Textures\n if (defines._areTexturesDirty) {\n defines._needUVs = false;\n if (scene.texturesEnabled) {\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\n if (!this._diffuseTexture.isReady()) {\n return false;\n } else {\n defines._needUVs = true;\n defines.DIFFUSE = true;\n }\n }\n }\n }\n\n // Misc.\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\n\n // Lights\n defines._needNormals = true;\n\n MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\n\n // Values that need to be evaluated on every frame\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\n\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\n\n // Get correct effect\n if (defines.isDirty) {\n defines.markAsProcessed();\n scene.resetCachedMaterial();\n\n // Fallbacks\n var fallbacks = new EffectFallbacks();\n if (defines.FOG) {\n fallbacks.addFallback(1, \"FOG\");\n }\n\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks);\n\n if (defines.NUM_BONE_INFLUENCERS > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n\n //Attributes\n var attribs = [VertexBuffer.PositionKind];\n\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n\n if (defines.UV1) {\n attribs.push(VertexBuffer.UVKind);\n }\n\n if (defines.UV2) {\n attribs.push(VertexBuffer.UV2Kind);\n }\n\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n\n // Legacy browser patch\n var shaderName = \"lava\";\n var join = defines.toString();\n\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\n \"vDiffuseInfos\",\n \"mBones\",\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\",\n \"time\", \"speed\", \"movingSpeed\",\n \"fogColor\", \"fogDensity\", \"lowFrequencySpeed\"\n ];\n\n var samplers = [\"diffuseSampler\",\n \"noiseTexture\"\n ];\n var uniformBuffers = new Array();\n\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this.maxSimultaneousLights\n });\n\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\n {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\n }, engine), defines);\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n\n this._renderId = scene.getRenderId();\n this._wasPreviouslyReady = true;\n\n return true;\n }\n\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\n var scene = this.getScene();\n\n var defines = subMesh._materialDefines;\n if (!defines) {\n return;\n }\n\n var effect = subMesh.effect;\n\n if (!effect) {\n return;\n }\n this._activeEffect = effect;\n\n defines.UNLIT = this._unlit;\n\n // Matrices\n this.bindOnlyWorldMatrix(world);\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n\n // Bones\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\n\n if (this._mustRebind(scene, effect)) {\n // Textures\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\n\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\n }\n\n if (this.noiseTexture) {\n this._activeEffect.setTexture(\"noiseTexture\", this.noiseTexture);\n }\n\n // Clip plane\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\n\n // Point size\n if (this.pointsCloud) {\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\n }\n\n MaterialHelper.BindEyePosition(effect, scene);\n }\n\n this._activeEffect.setColor4(\"vDiffuseColor\", this._scaledDiffuse, this.alpha * mesh.visibility);\n\n if (scene.lightsEnabled && !this.disableLighting) {\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines);\n }\n\n // View\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\n }\n\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\n\n this._lastTime += scene.getEngine().getDeltaTime();\n this._activeEffect.setFloat(\"time\", this._lastTime * this.speed / 1000);\n\n if (!this.fogColor) {\n this.fogColor = Color3.Black();\n }\n this._activeEffect.setColor3(\"fogColor\", this.fogColor);\n this._activeEffect.setFloat(\"fogDensity\", this.fogDensity);\n\n this._activeEffect.setFloat(\"lowFrequencySpeed\", this.lowFrequencySpeed);\n this._activeEffect.setFloat(\"movingSpeed\", this.movingSpeed);\n\n this._afterBind(mesh, this._activeEffect);\n }\n\n public getAnimatables(): IAnimatable[] {\n var results = [];\n\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\n results.push(this.diffuseTexture);\n }\n\n if (this.noiseTexture && this.noiseTexture.animations && this.noiseTexture.animations.length > 0) {\n results.push(this.noiseTexture);\n }\n\n return results;\n }\n\n public getActiveTextures(): BaseTexture[] {\n var activeTextures = super.getActiveTextures();\n\n if (this._diffuseTexture) {\n activeTextures.push(this._diffuseTexture);\n }\n\n return activeTextures;\n }\n\n public hasTexture(texture: BaseTexture): boolean {\n if (super.hasTexture(texture)) {\n return true;\n }\n\n if (this.diffuseTexture === texture) {\n return true;\n }\n\n return false;\n }\n\n public dispose(forceDisposeEffect?: boolean): void {\n if (this.diffuseTexture) {\n this.diffuseTexture.dispose();\n }\n if (this.noiseTexture) {\n this.noiseTexture.dispose();\n }\n\n super.dispose(forceDisposeEffect);\n }\n\n public clone(name: string): LavaMaterial {\n return SerializationHelper.Clone(() => new LavaMaterial(name, this.getScene()), this);\n }\n\n public serialize(): any {\n var serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.LavaMaterial\";\n return serializationObject;\n }\n\n public getClassName(): string {\n return \"LavaMaterial\";\n }\n\n // Statics\n public static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial {\n return SerializationHelper.Parse(() => new LavaMaterial(source.name, scene), source, scene, rootUrl);\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.LavaMaterial\"] = LavaMaterial;","import * as MatLib from \"../index\";\r\n\r\n/**\r\n * Legacy support, defining window.BABYLON.GridMaterial... (global variable).\r\n *\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nvar globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);\r\nif (typeof globalObject !== \"undefined\") {\r\n (globalObject).BABYLON = (globalObject).BABYLON || {};\r\n for (var mat in MatLib) {\r\n (globalObject).BABYLON[mat] = (MatLib)[mat];\r\n }\r\n}\r\n\r\nexport * from \"../index\";","export * from \"./mixMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'mixPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D mixMap1Sampler;\nuniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform sampler2D diffuse4Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\nuniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;\nuniform sampler2D diffuse6Sampler;\nuniform sampler2D diffuse7Sampler;\nuniform sampler2D diffuse8Sampler;\nuniform vec2 diffuse5Infos;\nuniform vec2 diffuse6Infos;\nuniform vec2 diffuse7Infos;\nuniform vec2 diffuse8Infos;\n#endif\n#endif\n\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 finalMixColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\nvec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);\ndiffuse1Color.rgb*=mixColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);\ndiffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);\nvec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);\nvec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);\nvec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);\ndiffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);\ndiffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);\ndiffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var mixPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'mixVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var mixVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./mix.fragment\";\r\nimport \"./mix.vertex\";\r\n\r\nclass MixMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public MIXMAP2 = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class MixMaterial extends PushMaterial {\r\n /**\r\n * Mix textures\r\n */\r\n\r\n @serializeAsTexture(\"mixTexture1\")\r\n private _mixTexture1: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture1: BaseTexture;\r\n\r\n @serializeAsTexture(\"mixTexture2\")\r\n private _mixTexture2: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture2: BaseTexture;\r\n\r\n /**\r\n * Diffuse textures\r\n */\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture1: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture2: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture3: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture4\")\r\n private _diffuseTexture4: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture4: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture5: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture5: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture6: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture6: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture7: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture7: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture4\")\r\n private _diffuseTexture8: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture8: Texture;\r\n\r\n /**\r\n * Uniforms\r\n */\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0, 0, 0);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new MixMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (!this._mixTexture1 || !this._mixTexture1.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needUVs = true;\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture1 || !this._diffuseTexture1.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.DIFFUSE = true;\r\n\r\n if (!this._diffuseTexture2 || !this._diffuseTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture3 || !this._diffuseTexture3.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture4 || !this._diffuseTexture4.isReady()) {\r\n return false;\r\n }\r\n\r\n if (this._mixTexture2) {\r\n if (!this._mixTexture2.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.MIXMAP2 = true;\r\n\r\n if (!this._diffuseTexture5 || !this._diffuseTexture5.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture6 || !this._diffuseTexture6.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture7 || !this._diffuseTexture7.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture8 || !this._diffuseTexture8.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"mix\";\r\n var join = defines.toString();\r\n var uniforms = [\r\n \"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vTextureInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"textureMatrix\",\r\n \"diffuse1Infos\", \"diffuse2Infos\", \"diffuse3Infos\", \"diffuse4Infos\",\r\n \"diffuse5Infos\", \"diffuse6Infos\", \"diffuse7Infos\", \"diffuse8Infos\"\r\n ];\r\n var samplers = [\r\n \"mixMap1Sampler\", \"mixMap2Sampler\",\r\n \"diffuse1Sampler\", \"diffuse2Sampler\", \"diffuse3Sampler\", \"diffuse4Sampler\",\r\n \"diffuse5Sampler\", \"diffuse6Sampler\", \"diffuse7Sampler\", \"diffuse8Sampler\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._mixTexture1) {\r\n this._activeEffect.setTexture(\"mixMap1Sampler\", this._mixTexture1);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture1.coordinatesIndex, this._mixTexture1.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture1.getTextureMatrix());\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture1) {\r\n this._activeEffect.setTexture(\"diffuse1Sampler\", this._diffuseTexture1);\r\n this._activeEffect.setFloat2(\"diffuse1Infos\", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);\r\n }\r\n if (this._diffuseTexture2) {\r\n this._activeEffect.setTexture(\"diffuse2Sampler\", this._diffuseTexture2);\r\n this._activeEffect.setFloat2(\"diffuse2Infos\", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);\r\n }\r\n if (this._diffuseTexture3) {\r\n this._activeEffect.setTexture(\"diffuse3Sampler\", this._diffuseTexture3);\r\n this._activeEffect.setFloat2(\"diffuse3Infos\", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);\r\n }\r\n if (this._diffuseTexture4) {\r\n this._activeEffect.setTexture(\"diffuse4Sampler\", this._diffuseTexture4);\r\n this._activeEffect.setFloat2(\"diffuse4Infos\", this._diffuseTexture4.uScale, this._diffuseTexture4.vScale);\r\n }\r\n }\r\n }\r\n\r\n if (this._mixTexture2) {\r\n this._activeEffect.setTexture(\"mixMap2Sampler\", this._mixTexture2);\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture5) {\r\n this._activeEffect.setTexture(\"diffuse5Sampler\", this._diffuseTexture5);\r\n this._activeEffect.setFloat2(\"diffuse5Infos\", this._diffuseTexture5.uScale, this._diffuseTexture5.vScale);\r\n }\r\n if (this._diffuseTexture6) {\r\n this._activeEffect.setTexture(\"diffuse6Sampler\", this._diffuseTexture6);\r\n this._activeEffect.setFloat2(\"diffuse6Infos\", this._diffuseTexture6.uScale, this._diffuseTexture6.vScale);\r\n }\r\n if (this._diffuseTexture7) {\r\n this._activeEffect.setTexture(\"diffuse7Sampler\", this._diffuseTexture7);\r\n this._activeEffect.setFloat2(\"diffuse7Infos\", this._diffuseTexture7.uScale, this._diffuseTexture7.vScale);\r\n }\r\n if (this._diffuseTexture8) {\r\n this._activeEffect.setTexture(\"diffuse8Sampler\", this._diffuseTexture8);\r\n this._activeEffect.setFloat2(\"diffuse8Infos\", this._diffuseTexture8.uScale, this._diffuseTexture8.vScale);\r\n }\r\n }\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._mixTexture1 && this._mixTexture1.animations && this._mixTexture1.animations.length > 0) {\r\n results.push(this._mixTexture1);\r\n }\r\n\r\n if (this._mixTexture2 && this._mixTexture2.animations && this._mixTexture2.animations.length > 0) {\r\n results.push(this._mixTexture2);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n // Mix map 1\r\n if (this._mixTexture1) {\r\n activeTextures.push(this._mixTexture1);\r\n }\r\n\r\n if (this._diffuseTexture1) {\r\n activeTextures.push(this._diffuseTexture1);\r\n }\r\n\r\n if (this._diffuseTexture2) {\r\n activeTextures.push(this._diffuseTexture2);\r\n }\r\n\r\n if (this._diffuseTexture3) {\r\n activeTextures.push(this._diffuseTexture3);\r\n }\r\n\r\n if (this._diffuseTexture4) {\r\n activeTextures.push(this._diffuseTexture4);\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2) {\r\n activeTextures.push(this._mixTexture2);\r\n }\r\n\r\n if (this._diffuseTexture5) {\r\n activeTextures.push(this._diffuseTexture5);\r\n }\r\n\r\n if (this._diffuseTexture6) {\r\n activeTextures.push(this._diffuseTexture6);\r\n }\r\n\r\n if (this._diffuseTexture7) {\r\n activeTextures.push(this._diffuseTexture7);\r\n }\r\n\r\n if (this._diffuseTexture8) {\r\n activeTextures.push(this._diffuseTexture8);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n // Mix map 1\r\n if (this._mixTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture4 === texture) {\r\n return true;\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture5 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture6 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture7 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture8 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._mixTexture1) {\r\n this._mixTexture1.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): MixMaterial {\r\n return SerializationHelper.Clone(() => new MixMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.MixMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"MixMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): MixMaterial {\r\n return SerializationHelper.Parse(() => new MixMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.MixMaterial\"] = MixMaterial;\r\n","export * from \"./normalMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'normalPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=baseColor.rgb;\n#endif\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var normalPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'normalVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var normalVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./normal.fragment\";\r\nimport \"./normal.vertex\";\r\n\r\nclass NormalMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public LIGHTING = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class NormalMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending() || (mesh.visibility < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new NormalMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = true;\r\n MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n defines.LIGHTING = !this._disableLighting;\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"normal\";\r\n var join = defines.toString();\r\n\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\"\r\n ];\r\n var samplers = [\"diffuseSampler\"];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\r\n }\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): NormalMaterial {\r\n return SerializationHelper.Clone(() => new NormalMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.NormalMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"NormalMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial {\r\n return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.NormalMaterial\"] = NormalMaterial;","export * from \"./shadowOnlyMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'shadowOnlyPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform float alpha;\nuniform vec3 shadowColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..1]\n\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var shadowOnlyPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'shadowOnlyVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var shadowOnlyVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { IShadowLight } from \"babylonjs/Lights/shadowLight\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./shadowOnly.fragment\";\r\nimport \"./shadowOnly.vertex\";\r\n\r\nclass ShadowOnlyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _renderId: number;\r\n private _activeLight: IShadowLight;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public shadowColor = Color3.Black();\r\n\r\n public needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n public get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new ShadowOnlyMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (var light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n var lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, 1);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, 1);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"shadowOnly\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\", \"alpha\", \"shadowColor\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\"\r\n ];\r\n var samplers = new Array();\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 1 }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n // Lights\r\n if (scene.lightsEnabled) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone(() => new ShadowOnlyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.ShadowOnlyMaterial\"] = ShadowOnlyMaterial;","export * from \"./simpleMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'simplePixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var simplePixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'simpleVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var simpleVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./simple.fragment\";\r\nimport \"./simple.vertex\";\r\n\r\nclass SimpleMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class SimpleMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new SimpleMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"simple\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\"\r\n ];\r\n var samplers = [\"diffuseSampler\"];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights - 1 }\r\n }, engine), defines);\r\n\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): SimpleMaterial {\r\n return SerializationHelper.Clone(() => new SimpleMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.SimpleMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"SimpleMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial {\r\n return SerializationHelper.Parse(() => new SimpleMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.SimpleMaterial\"] = SimpleMaterial;","export * from \"./skyMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'skyPixelShader';\nlet shader = `precision highp float;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n\nuniform vec3 cameraPosition;\nuniform vec3 cameraOffset;\nuniform float luminance;\nuniform float turbidity;\nuniform float rayleigh;\nuniform float mieCoefficient;\nuniform float mieDirectionalG;\nuniform vec3 sunPosition;\n\n#include\n\nconst float e=2.71828182845904523536028747135266249775724709369995957;\nconst float pi=3.141592653589793238462643383279502884197169;\nconst float n=1.0003;\nconst float N=2.545E25;\nconst float pn=0.035;\nconst vec3 lambda=vec3(680E-9,550E-9,450E-9);\nconst vec3 K=vec3(0.686,0.678,0.666);\nconst float v=4.0;\nconst float rayleighZenithLength=8.4E3;\nconst float mieZenithLength=1.25E3;\nconst vec3 up=vec3(0.0,1.0,0.0);\nconst float EE=1000.0;\nconst float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;\nconst float cutoffAngle=pi/1.95;\nconst float steepness=1.5;\nvec3 totalRayleigh(vec3 lambda)\n{\nreturn (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));\n}\nvec3 simplifiedRayleigh()\n{\nreturn 0.0005/vec3(94,40,18);\n}\nfloat rayleighPhase(float cosTheta)\n{\nreturn (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));\n}\nvec3 totalMie(vec3 lambda,vec3 K,float T)\n{\nfloat c=(0.2*T )*10E-18;\nreturn 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;\n}\nfloat hgPhase(float cosTheta,float g)\n{\nreturn (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));\n}\nfloat sunIntensity(float zenithAngleCos)\n{\nreturn EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));\n}\nfloat A=0.15;\nfloat B=0.50;\nfloat C=0.10;\nfloat D=0.20;\nfloat EEE=0.02;\nfloat F=0.30;\nfloat W=1000.0;\nvec3 Uncharted2Tonemap(vec3 x)\n{\nreturn ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;\n}\nvoid main(void) {\n\n#include\n\nfloat sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);\nfloat rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));\nvec3 sunDirection=normalize(sunPosition);\nfloat sunE=sunIntensity(dot(sunDirection,up));\nvec3 betaR=simplifiedRayleigh()*rayleighCoefficient;\nvec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;\nfloat zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition+cameraOffset))));\nfloat sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nfloat sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nvec3 Fex=exp(-(betaR*sR+betaM*sM));\nfloat cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);\nfloat rPhase=rayleighPhase(cosTheta*0.5+0.5);\nvec3 betaRTheta=betaR*rPhase;\nfloat mPhase=hgPhase(cosTheta,mieDirectionalG);\nvec3 betaMTheta=betaM*mPhase;\nvec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));\nLin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));\nvec3 direction=normalize(vPositionW-cameraPosition);\nfloat theta=acos(direction.y);\nfloat phi=atan(direction.z,direction.x);\nvec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);\nvec3 L0=vec3(0.1)*Fex;\nfloat sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);\nL0+=(sunE*19000.0*Fex)*sundisk;\nvec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));\nvec3 texColor=(Lin+L0);\ntexColor*=0.04 ;\ntexColor+=vec3(0.0,0.001,0.0025)*0.3;\nfloat g_fMaxLuminance=1.0;\nfloat fLumScaled=0.1/luminance;\nfloat fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled);\nfloat ExposureBias=fLumCompressed;\nvec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);\n\n\n\nvec3 retColor=curr*whiteScale;\n\n\nfloat alpha=1.0;\n#ifdef VERTEXCOLOR\nretColor.rgb*=vColor.rgb;\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);\n\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var skyPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\n\nlet name = 'skyVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\nvoid main(void) {\ngl_Position=viewProjection*world*vec4(position,1.0);\nvec4 worldPos=world*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var skyVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsVector3, serialize, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Vector3, Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./sky.fragment\";\r\nimport \"./sky.vertex\";\r\n\r\n/** @hidden */\r\nclass SkyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * This is the sky material which allows to create dynamic and texture free effects for skyboxes.\r\n * @see https://doc.babylonjs.com/extensions/sky\r\n */\r\nexport class SkyMaterial extends PushMaterial {\r\n /**\r\n * Defines the overall luminance of sky in interval ]0, 1[.\r\n */\r\n @serialize()\r\n public luminance: number = 1.0;\r\n\r\n /**\r\n * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.\r\n */\r\n @serialize()\r\n public turbidity: number = 10.0;\r\n\r\n /**\r\n * Defines the sky appearance (light intensity).\r\n */\r\n @serialize()\r\n public rayleigh: number = 2.0;\r\n\r\n /**\r\n * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.\r\n */\r\n @serialize()\r\n public mieCoefficient: number = 0.005;\r\n\r\n /**\r\n * Defines the amount of haze particles following the Mie scattering theory.\r\n */\r\n @serialize()\r\n public mieDirectionalG: number = 0.8;\r\n\r\n /**\r\n * Defines the distance of the sun according to the active scene camera.\r\n */\r\n @serialize()\r\n public distance: number = 500;\r\n\r\n /**\r\n * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said\r\n * \"inclined\".\r\n */\r\n @serialize()\r\n public inclination: number = 0.49;\r\n\r\n /**\r\n * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between\r\n * an object direction and a reference direction.\r\n */\r\n @serialize()\r\n public azimuth: number = 0.25;\r\n\r\n /**\r\n * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then\r\n * the property is overriden by the inclination and the azimuth and can be read at any moment.\r\n */\r\n @serializeAsVector3()\r\n public sunPosition: Vector3 = new Vector3(0, 100, 0);\r\n\r\n /**\r\n * Defines if the sun position should be computed (inclination and azimuth) according to the given\r\n * .sunPosition property.\r\n */\r\n @serialize()\r\n public useSunPosition: boolean = false;\r\n\r\n /**\r\n * Defines an offset vector used to get a horizon offset.\r\n * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis\r\n */\r\n @serialize()\r\n public cameraOffset: Vector3 = Vector3.Zero();\r\n\r\n // Private members\r\n private _cameraPosition: Vector3 = Vector3.Zero();\r\n\r\n private _renderId: number;\r\n\r\n /**\r\n * Instantiates a new sky material.\r\n * This material allows to create dynamic and texture free\r\n * effects for skyboxes by taking care of the atmosphere state.\r\n * @see https://doc.babylonjs.com/extensions/sky\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns false as the sky material doesn't need alpha testing.\r\n */\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns null as the sky material has no texture.\r\n */\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new SkyMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n var shaderName = \"sky\";\r\n\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n attribs,\r\n [\"world\", \"viewProjection\", \"view\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\", \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\",\r\n \"luminance\", \"turbidity\", \"rayleigh\", \"mieCoefficient\", \"mieDirectionalG\", \"sunPosition\",\r\n \"cameraPosition\", \"cameraOffset\"\r\n ],\r\n [],\r\n join, fallbacks, this.onCompiled, this.onError), defines);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n // Sky\r\n var camera = scene.activeCamera;\r\n if (camera) {\r\n var cameraWorldMatrix = camera.getWorldMatrix();\r\n this._cameraPosition.x = cameraWorldMatrix.m[12];\r\n this._cameraPosition.y = cameraWorldMatrix.m[13];\r\n this._cameraPosition.z = cameraWorldMatrix.m[14];\r\n this._activeEffect.setVector3(\"cameraPosition\", this._cameraPosition);\r\n }\r\n\r\n this._activeEffect.setVector3(\"cameraOffset\", this.cameraOffset);\r\n\r\n if (this.luminance > 0) {\r\n this._activeEffect.setFloat(\"luminance\", this.luminance);\r\n }\r\n\r\n this._activeEffect.setFloat(\"turbidity\", this.turbidity);\r\n this._activeEffect.setFloat(\"rayleigh\", this.rayleigh);\r\n this._activeEffect.setFloat(\"mieCoefficient\", this.mieCoefficient);\r\n this._activeEffect.setFloat(\"mieDirectionalG\", this.mieDirectionalG);\r\n\r\n if (!this.useSunPosition) {\r\n var theta = Math.PI * (this.inclination - 0.5);\r\n var phi = 2 * Math.PI * (this.azimuth - 0.5);\r\n\r\n this.sunPosition.x = this.distance * Math.cos(phi);\r\n this.sunPosition.y = this.distance * Math.sin(phi) * Math.sin(theta);\r\n this.sunPosition.z = this.distance * Math.sin(phi) * Math.cos(theta);\r\n }\r\n\r\n this._activeEffect.setVector3(\"sunPosition\", this.sunPosition);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n */\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n public clone(name: string): SkyMaterial {\r\n return SerializationHelper.Clone(() => new SkyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.SkyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the material e.g. \"SkyMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"SkyMaterial\";\r\n }\r\n\r\n /**\r\n * Creates a sky material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new sky material\r\n */\r\n public static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial {\r\n return SerializationHelper.Parse(() => new SkyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.SkyMaterial\"] = SkyMaterial;","export * from \"./terrainMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'terrainPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D textureSampler;\nuniform vec2 vTextureInfos;\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\nuniform sampler2D bump2Sampler;\nuniform sampler2D bump3Sampler;\n#endif\n\n#include\n#include\n#include\n\n#include\n\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{\nvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\nvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\nvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\nbump1Color.rgb*=mixColor.r;\nbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\nvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\nmap=map*255./127.-128./127.;\nmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\nreturn normalize(TBN*map);\n}\n#endif\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\ndiffuse1Color.rgb*=baseColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\nbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var terrainPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'terrainVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var terrainVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./terrain.fragment\";\r\nimport \"./terrain.vertex\";\r\n\r\nclass TerrainMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public BUMP = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class TerrainMaterial extends PushMaterial {\r\n @serializeAsTexture(\"mixTexture\")\r\n private _mixTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture1: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture2: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture3: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture1\")\r\n private _bumpTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture1: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture2\")\r\n private _bumpTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture2: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture3\")\r\n private _bumpTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture3: Texture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0, 0, 0);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new TerrainMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (!this.mixTexture || !this.mixTexture.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needUVs = true;\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture1 || !this.diffuseTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture2 || !this.diffuseTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture3 || !this.diffuseTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.DIFFUSE = true;\r\n }\r\n\r\n if (this.bumpTexture1 && this.bumpTexture2 && this.bumpTexture3 && MaterialFlags.BumpTextureEnabled) {\r\n if (!this.bumpTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needNormals = true;\r\n defines.BUMP = true;\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"terrain\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vTextureInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"textureMatrix\",\r\n \"diffuse1Infos\", \"diffuse2Infos\", \"diffuse3Infos\"\r\n ];\r\n var samplers = [\"textureSampler\", \"diffuse1Sampler\", \"diffuse2Sampler\", \"diffuse3Sampler\",\r\n \"bump1Sampler\", \"bump2Sampler\", \"bump3Sampler\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this.mixTexture) {\r\n this._activeEffect.setTexture(\"textureSampler\", this._mixTexture);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture.coordinatesIndex, this._mixTexture.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture.getTextureMatrix());\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture1) {\r\n this._activeEffect.setTexture(\"diffuse1Sampler\", this._diffuseTexture1);\r\n this._activeEffect.setFloat2(\"diffuse1Infos\", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);\r\n }\r\n if (this._diffuseTexture2) {\r\n this._activeEffect.setTexture(\"diffuse2Sampler\", this._diffuseTexture2);\r\n this._activeEffect.setFloat2(\"diffuse2Infos\", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);\r\n }\r\n if (this._diffuseTexture3) {\r\n this._activeEffect.setTexture(\"diffuse3Sampler\", this._diffuseTexture3);\r\n this._activeEffect.setFloat2(\"diffuse3Infos\", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);\r\n }\r\n }\r\n\r\n if (MaterialFlags.BumpTextureEnabled && scene.getEngine().getCaps().standardDerivatives) {\r\n if (this._bumpTexture1) {\r\n this._activeEffect.setTexture(\"bump1Sampler\", this._bumpTexture1);\r\n }\r\n if (this._bumpTexture2) {\r\n this._activeEffect.setTexture(\"bump2Sampler\", this._bumpTexture2);\r\n }\r\n if (this._bumpTexture3) {\r\n this._activeEffect.setTexture(\"bump3Sampler\", this._bumpTexture3);\r\n }\r\n }\r\n }\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {\r\n results.push(this.mixTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._mixTexture) {\r\n activeTextures.push(this._mixTexture);\r\n }\r\n\r\n if (this._diffuseTexture1) {\r\n activeTextures.push(this._diffuseTexture1);\r\n }\r\n\r\n if (this._diffuseTexture2) {\r\n activeTextures.push(this._diffuseTexture2);\r\n }\r\n\r\n if (this._diffuseTexture3) {\r\n activeTextures.push(this._diffuseTexture3);\r\n }\r\n\r\n if (this._bumpTexture1) {\r\n activeTextures.push(this._bumpTexture1);\r\n }\r\n\r\n if (this._bumpTexture2) {\r\n activeTextures.push(this._bumpTexture2);\r\n }\r\n\r\n if (this._bumpTexture3) {\r\n activeTextures.push(this._bumpTexture3);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._mixTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.mixTexture) {\r\n this.mixTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): TerrainMaterial {\r\n return SerializationHelper.Clone(() => new TerrainMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.TerrainMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"TerrainMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial {\r\n return SerializationHelper.Parse(() => new TerrainMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.TerrainMaterial\"] = TerrainMaterial;","export * from \"./triPlanarMaterial\";","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\n\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./triplanar.fragment\";\r\nimport \"./triplanar.vertex\";\r\n\r\nclass TriPlanarMaterialDefines extends MaterialDefines {\r\n public DIFFUSEX = false;\r\n public DIFFUSEY = false;\r\n public DIFFUSEZ = false;\r\n\r\n public BUMPX = false;\r\n public BUMPY = false;\r\n public BUMPZ = false;\r\n\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class TriPlanarMaterial extends PushMaterial {\r\n @serializeAsTexture()\r\n public mixTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTextureX\")\r\n private _diffuseTextureX: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTextureX: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTexturY\")\r\n private _diffuseTextureY: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTextureY: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTextureZ\")\r\n private _diffuseTextureZ: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTextureZ: BaseTexture;\r\n\r\n @serializeAsTexture(\"normalTextureX\")\r\n private _normalTextureX: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public normalTextureX: BaseTexture;\r\n\r\n @serializeAsTexture(\"normalTextureY\")\r\n private _normalTextureY: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public normalTextureY: BaseTexture;\r\n\r\n @serializeAsTexture(\"normalTextureZ\")\r\n private _normalTextureZ: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public normalTextureZ: BaseTexture;\r\n\r\n @serialize()\r\n public tileSize: number = 1;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0.2, 0.2, 0.2);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new TriPlanarMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n var textures = [this.diffuseTextureX, this.diffuseTextureY, this.diffuseTextureZ];\r\n var textureDefines = [\"DIFFUSEX\", \"DIFFUSEY\", \"DIFFUSEZ\"];\r\n\r\n for (var i = 0; i < textures.length; i++) {\r\n if (textures[i]) {\r\n if (!textures[i].isReady()) {\r\n return false;\r\n } else {\r\n (defines)[textureDefines[i]] = true;\r\n }\r\n }\r\n }\r\n }\r\n if (MaterialFlags.BumpTextureEnabled) {\r\n var textures = [this.normalTextureX, this.normalTextureY, this.normalTextureZ];\r\n var textureDefines = [\"BUMPX\", \"BUMPY\", \"BUMPZ\"];\r\n\r\n for (var i = 0; i < textures.length; i++) {\r\n if (textures[i]) {\r\n if (!textures[i].isReady()) {\r\n return false;\r\n } else {\r\n (defines)[textureDefines[i]] = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"triplanar\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\",\r\n \"tileSize\"\r\n ];\r\n var samplers = [\"diffuseSamplerX\", \"diffuseSamplerY\", \"diffuseSamplerZ\",\r\n \"normalSamplerX\", \"normalSamplerY\", \"normalSamplerZ\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n this._activeEffect.setFloat(\"tileSize\", this.tileSize);\r\n\r\n if (scene.getCachedMaterial() !== this) {\r\n // Textures\r\n if (this.diffuseTextureX) {\r\n this._activeEffect.setTexture(\"diffuseSamplerX\", this.diffuseTextureX);\r\n }\r\n if (this.diffuseTextureY) {\r\n this._activeEffect.setTexture(\"diffuseSamplerY\", this.diffuseTextureY);\r\n }\r\n if (this.diffuseTextureZ) {\r\n this._activeEffect.setTexture(\"diffuseSamplerZ\", this.diffuseTextureZ);\r\n }\r\n if (this.normalTextureX) {\r\n this._activeEffect.setTexture(\"normalSamplerX\", this.normalTextureX);\r\n }\r\n if (this.normalTextureY) {\r\n this._activeEffect.setTexture(\"normalSamplerY\", this.normalTextureY);\r\n }\r\n if (this.normalTextureZ) {\r\n this._activeEffect.setTexture(\"normalSamplerZ\", this.normalTextureZ);\r\n }\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {\r\n results.push(this.mixTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTextureX) {\r\n activeTextures.push(this._diffuseTextureX);\r\n }\r\n\r\n if (this._diffuseTextureY) {\r\n activeTextures.push(this._diffuseTextureY);\r\n }\r\n\r\n if (this._diffuseTextureZ) {\r\n activeTextures.push(this._diffuseTextureZ);\r\n }\r\n\r\n if (this._normalTextureX) {\r\n activeTextures.push(this._normalTextureX);\r\n }\r\n\r\n if (this._normalTextureY) {\r\n activeTextures.push(this._normalTextureY);\r\n }\r\n\r\n if (this._normalTextureZ) {\r\n activeTextures.push(this._normalTextureZ);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTextureX === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTextureY === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTextureZ === texture) {\r\n return true;\r\n }\r\n\r\n if (this._normalTextureX === texture) {\r\n return true;\r\n }\r\n\r\n if (this._normalTextureY === texture) {\r\n return true;\r\n }\r\n\r\n if (this._normalTextureZ === texture) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.mixTexture) {\r\n this.mixTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): TriPlanarMaterial {\r\n return SerializationHelper.Clone(() => new TriPlanarMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.TriPlanarMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"TriPlanarMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial {\r\n return SerializationHelper.Parse(() => new TriPlanarMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.TriPlanarMaterial\"] = TriPlanarMaterial;","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'triplanarPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\nuniform sampler2D diffuseSamplerX;\n#ifdef BUMPX\nuniform sampler2D normalSamplerX;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\nuniform sampler2D diffuseSamplerY;\n#ifdef BUMPY\nuniform sampler2D normalSamplerY;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\nuniform sampler2D diffuseSamplerZ;\n#ifdef BUMPZ\nuniform sampler2D normalSamplerZ;\n#endif\n#endif\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#include\n#include\n#include\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(0.,0.,0.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=tangentSpace[2];\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec4 baseNormal=vec4(0.0,0.0,0.0,1.0);\nnormalW*=normalW;\n#ifdef DIFFUSEX\nbaseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nnormalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var triplanarPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'triplanarVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\n#endif\nuniform float tileSize;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void)\n{\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef DIFFUSEX\nvTextureUVX=worldPos.zy/tileSize;\n#endif\n#ifdef DIFFUSEY\nvTextureUVY=worldPos.xz/tileSize;\n#endif\n#ifdef DIFFUSEZ\nvTextureUVZ=worldPos.xy/tileSize;\n#endif\n#ifdef NORMAL\n\nvec3 xtan=vec3(0,0,1);\nvec3 xbin=vec3(0,1,0);\nvec3 ytan=vec3(1,0,0);\nvec3 ybin=vec3(0,0,1);\nvec3 ztan=vec3(1,0,0);\nvec3 zbin=vec3(0,1,0);\nvec3 normalizedNormal=normalize(normal);\nnormalizedNormal*=normalizedNormal;\nvec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);\nvec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);\nworldTangent=(world*vec4(worldTangent,1.0)).xyz;\nworldBinormal=(world*vec4(worldBinormal,1.0)).xyz;\nvec3 worldNormal=normalize(cross(worldTangent,worldBinormal));\ntangentSpace[0]=worldTangent;\ntangentSpace[1]=worldBinormal;\ntangentSpace[2]=worldNormal;\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var triplanarVertexShader = { name, shader };\n","export * from \"./waterMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'waterPixelShader';\nlet shader = `#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthVertex\";\n\nlet name = 'waterVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\nimport { serializeAsVector2, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\nimport { Matrix, Vector2, Vector3 } from \"babylonjs/Maths/math.vector\";\nimport { Color3 } from \"babylonjs/Maths/math.color\";\nimport { Plane } from 'babylonjs/Maths/math.plane';\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\nimport { Constants } from \"babylonjs/Engines/constants\";\nimport { SmartArray } from \"babylonjs/Misc/smartArray\";\nimport { Observer } from 'babylonjs/Misc/observable';\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\nimport { RenderTargetTexture } from \"babylonjs/Materials/Textures/renderTargetTexture\";\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\nimport { IImageProcessingConfigurationDefines, ImageProcessingConfiguration } from \"babylonjs/Materials/imageProcessingConfiguration\";\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Camera } from \"babylonjs/Cameras/camera\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nimport \"./water.fragment\";\nimport \"./water.vertex\";\n\nclass WaterMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {\n public BUMP = false;\n public REFLECTION = false;\n public CLIPPLANE = false;\n public CLIPPLANE2 = false;\n public CLIPPLANE3 = false;\n public CLIPPLANE4 = false;\n public ALPHATEST = false;\n public DEPTHPREPASS = false;\n public POINTSIZE = false;\n public FOG = false;\n public NORMAL = false;\n public UV1 = false;\n public UV2 = false;\n public VERTEXCOLOR = false;\n public VERTEXALPHA = false;\n public NUM_BONE_INFLUENCERS = 0;\n public BonesPerMesh = 0;\n public INSTANCES = false;\n public SPECULARTERM = false;\n public LOGARITHMICDEPTH = false;\n public FRESNELSEPARATE = false;\n public BUMPSUPERIMPOSE = false;\n public BUMPAFFECTSREFLECTION = false;\n\n public IMAGEPROCESSING = false;\n public VIGNETTE = false;\n public VIGNETTEBLENDMODEMULTIPLY = false;\n public VIGNETTEBLENDMODEOPAQUE = false;\n public TONEMAPPING = false;\n public TONEMAPPING_ACES = false;\n public CONTRAST = false;\n public EXPOSURE = false;\n public COLORCURVES = false;\n public COLORGRADING = false;\n public COLORGRADING3D = false;\n public SAMPLER3DGREENDEPTH = false;\n public SAMPLER3DBGRMAP = false;\n public IMAGEPROCESSINGPOSTPROCESS = false;\n\n constructor() {\n super();\n this.rebuild();\n }\n}\n\nexport class WaterMaterial extends PushMaterial {\n /*\n * Public members\n */\n @serializeAsTexture(\"bumpTexture\")\n private _bumpTexture: BaseTexture;\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n public bumpTexture: BaseTexture;\n\n @serializeAsColor3()\n public diffuseColor = new Color3(1, 1, 1);\n\n @serializeAsColor3()\n public specularColor = new Color3(0, 0, 0);\n\n @serialize()\n public specularPower = 64;\n\n @serialize(\"disableLighting\")\n private _disableLighting = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public disableLighting: boolean;\n\n @serialize(\"maxSimultaneousLights\")\n private _maxSimultaneousLights = 4;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public maxSimultaneousLights: number;\n\n /**\n * @param {number}: Represents the wind force\n */\n @serialize()\n public windForce: number = 6;\n /**\n * @param {Vector2}: The direction of the wind in the plane (X, Z)\n */\n @serializeAsVector2()\n public windDirection: Vector2 = new Vector2(0, 1);\n /**\n * @param {number}: Wave height, represents the height of the waves\n */\n @serialize()\n public waveHeight: number = 0.4;\n /**\n * @param {number}: Bump height, represents the bump height related to the bump map\n */\n @serialize()\n public bumpHeight: number = 0.4;\n /**\n * @param {boolean}: Add a smaller moving bump to less steady waves.\n */\n @serialize(\"bumpSuperimpose\")\n private _bumpSuperimpose = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpSuperimpose: boolean;\n\n /**\n * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.\n */\n @serialize(\"fresnelSeparate\")\n private _fresnelSeparate = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public fresnelSeparate: boolean;\n\n /**\n * @param {boolean}: bump Waves modify the reflection.\n */\n @serialize(\"bumpAffectsReflection\")\n private _bumpAffectsReflection = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpAffectsReflection: boolean;\n\n /**\n * @param {number}: The water color blended with the refraction (near)\n */\n @serializeAsColor3()\n public waterColor: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color\n */\n @serialize()\n public colorBlendFactor: number = 0.2;\n /**\n * @param {number}: The water color blended with the reflection (far)\n */\n @serializeAsColor3()\n public waterColor2: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color (reflection, far)\n */\n @serialize()\n public colorBlendFactor2: number = 0.2;\n /**\n * @param {number}: Represents the maximum length of a wave\n */\n @serialize()\n public waveLength: number = 0.1;\n\n /**\n * @param {number}: Defines the waves speed\n */\n @serialize()\n public waveSpeed: number = 1.0;\n /**\n * Sets or gets wether or not automatic clipping should be enabled or not. Setting to true will save performances and\n * will avoid calculating useless pixels in the pixel shader of the water material.\n */\n @serialize()\n public disableClipPlane: boolean = false;\n\n protected _renderTargets = new SmartArray(16);\n\n /*\n * Private members\n */\n private _mesh: Nullable = null;\n\n private _refractionRTT: Nullable;\n private _reflectionRTT: Nullable;\n\n private _reflectionTransform: Matrix = Matrix.Zero();\n private _lastTime: number = 0;\n private _lastDeltaTime: number = 0;\n\n private _renderId: number;\n\n private _useLogarithmicDepth: boolean;\n\n private _waitingRenderList: Nullable;\n\n private _imageProcessingConfiguration: Nullable;\n private _imageProcessingObserver: Nullable>;\n\n /**\n * Gets a boolean indicating that current material needs to register RTT\n */\n public get hasRenderTargetTextures(): boolean {\n return true;\n }\n\n /**\n * Constructor\n */\n constructor(name: string, scene: Scene, public renderTargetSize: Vector2 = new Vector2(512, 512)) {\n super(name, scene);\n\n this._createRenderTargets(scene, renderTargetSize);\n\n // Create render targets\n this.getRenderTargetTextures = (): SmartArray => {\n this._renderTargets.reset();\n this._renderTargets.push(this._reflectionRTT);\n this._renderTargets.push(this._refractionRTT);\n\n return this._renderTargets;\n };\n\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\n if (this._imageProcessingConfiguration) {\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\n this._markAllSubMeshesAsImageProcessingDirty();\n });\n }\n }\n\n @serialize()\n public get useLogarithmicDepth(): boolean {\n return this._useLogarithmicDepth;\n }\n\n public set useLogarithmicDepth(value: boolean) {\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\n this._markAllSubMeshesAsMiscDirty();\n }\n\n // Get / Set\n public get refractionTexture(): Nullable {\n return this._refractionRTT;\n }\n\n public get reflectionTexture(): Nullable {\n return this._reflectionRTT;\n }\n\n // Methods\n public addToRenderList(node: any): void {\n if (this._refractionRTT && this._refractionRTT.renderList) {\n this._refractionRTT.renderList.push(node);\n }\n\n if (this._reflectionRTT && this._reflectionRTT.renderList) {\n this._reflectionRTT.renderList.push(node);\n }\n }\n\n public enableRenderTargets(enable: boolean): void {\n var refreshRate = enable ? 1 : 0;\n\n if (this._refractionRTT) {\n this._refractionRTT.refreshRate = refreshRate;\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.refreshRate = refreshRate;\n }\n }\n\n public getRenderList(): Nullable {\n return this._refractionRTT ? this._refractionRTT.renderList : [];\n }\n\n public get renderTargetsEnabled(): boolean {\n return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);\n }\n\n public needAlphaBlending(): boolean {\n return (this.alpha < 1.0);\n }\n\n public needAlphaTesting(): boolean {\n return false;\n }\n\n public getAlphaTestTexture(): Nullable {\n return null;\n }\n\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\n if (this.isFrozen) {\n if (this._wasPreviouslyReady && subMesh.effect) {\n return true;\n }\n }\n\n if (!subMesh._materialDefines) {\n subMesh._materialDefines = new WaterMaterialDefines();\n }\n\n var defines = subMesh._materialDefines;\n var scene = this.getScene();\n\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\n if (this._renderId === scene.getRenderId()) {\n return true;\n }\n }\n\n var engine = scene.getEngine();\n\n // Textures\n if (defines._areTexturesDirty) {\n defines._needUVs = false;\n if (scene.texturesEnabled) {\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n if (!this.bumpTexture.isReady()) {\n return false;\n } else {\n defines._needUVs = true;\n defines.BUMP = true;\n }\n }\n\n if (MaterialFlags.ReflectionTextureEnabled) {\n defines.REFLECTION = true;\n }\n }\n }\n\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\n\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\n\n if (defines._areMiscDirty) {\n if (this._fresnelSeparate) {\n defines.FRESNELSEPARATE = true;\n }\n\n if (this._bumpSuperimpose) {\n defines.BUMPSUPERIMPOSE = true;\n }\n\n if (this._bumpAffectsReflection) {\n defines.BUMPAFFECTSREFLECTION = true;\n }\n }\n\n // Lights\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\n\n // Image processing\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\n if (!this._imageProcessingConfiguration.isReady()) {\n return false;\n }\n\n this._imageProcessingConfiguration.prepareDefines(defines);\n\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\n }\n\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\n\n // Configure this\n this._mesh = mesh;\n\n if (this._waitingRenderList) {\n for (var i = 0; i < this._waitingRenderList.length; i++) {\n this.addToRenderList(scene.getNodeByID(this._waitingRenderList[i]));\n }\n\n this._waitingRenderList = null;\n }\n\n // Get correct effect\n if (defines.isDirty) {\n defines.markAsProcessed();\n scene.resetCachedMaterial();\n\n // Fallbacks\n var fallbacks = new EffectFallbacks();\n if (defines.FOG) {\n fallbacks.addFallback(1, \"FOG\");\n }\n\n if (defines.LOGARITHMICDEPTH) {\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\n }\n\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\n\n if (defines.NUM_BONE_INFLUENCERS > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n\n //Attributes\n var attribs = [VertexBuffer.PositionKind];\n\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n\n if (defines.UV1) {\n attribs.push(VertexBuffer.UVKind);\n }\n\n if (defines.UV2) {\n attribs.push(VertexBuffer.UV2Kind);\n }\n\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n\n // Legacy browser patch\n var shaderName = \"water\";\n var join = defines.toString();\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\n \"vNormalInfos\",\n \"mBones\",\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"normalMatrix\",\n \"logarithmicDepthConstant\",\n\n // Water\n \"worldReflectionViewProjection\", \"windDirection\", \"waveLength\", \"time\", \"windForce\",\n \"cameraPosition\", \"bumpHeight\", \"waveHeight\", \"waterColor\", \"waterColor2\", \"colorBlendFactor\", \"colorBlendFactor2\", \"waveSpeed\"\n ];\n var samplers = [\"normalSampler\",\n // Water\n \"refractionSampler\", \"reflectionSampler\"\n ];\n var uniformBuffers = new Array();\n\n if (ImageProcessingConfiguration) {\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\n }\n\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this.maxSimultaneousLights\n });\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\n {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }\n }, engine), defines);\n\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n\n this._renderId = scene.getRenderId();\n this._wasPreviouslyReady = true;\n\n return true;\n }\n\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\n var scene = this.getScene();\n\n var defines = subMesh._materialDefines;\n if (!defines) {\n return;\n }\n\n var effect = subMesh.effect;\n if (!effect || !this._mesh) {\n return;\n }\n this._activeEffect = effect;\n\n // Matrices\n this.bindOnlyWorldMatrix(world);\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n\n // Bones\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\n\n if (this._mustRebind(scene, effect)) {\n // Textures\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n this._activeEffect.setTexture(\"normalSampler\", this.bumpTexture);\n\n this._activeEffect.setFloat2(\"vNormalInfos\", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);\n this._activeEffect.setMatrix(\"normalMatrix\", this.bumpTexture.getTextureMatrix());\n }\n // Clip plane\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\n\n // Point size\n if (this.pointsCloud) {\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\n }\n\n MaterialHelper.BindEyePosition(effect, scene);\n }\n\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\n\n if (defines.SPECULARTERM) {\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\n }\n\n if (scene.lightsEnabled && !this.disableLighting) {\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\n }\n\n // View\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\n }\n\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\n\n // Log. depth\n MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);\n\n // Water\n if (MaterialFlags.ReflectionTextureEnabled) {\n this._activeEffect.setTexture(\"refractionSampler\", this._refractionRTT);\n this._activeEffect.setTexture(\"reflectionSampler\", this._reflectionRTT);\n }\n\n var wrvp = this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(scene.getProjectionMatrix());\n\n // Add delta time. Prevent adding delta time if it hasn't changed.\n let deltaTime = scene.getEngine().getDeltaTime();\n if (deltaTime !== this._lastDeltaTime) {\n this._lastDeltaTime = deltaTime;\n this._lastTime += this._lastDeltaTime;\n }\n\n this._activeEffect.setMatrix(\"worldReflectionViewProjection\", wrvp);\n this._activeEffect.setVector2(\"windDirection\", this.windDirection);\n this._activeEffect.setFloat(\"waveLength\", this.waveLength);\n this._activeEffect.setFloat(\"time\", this._lastTime / 100000);\n this._activeEffect.setFloat(\"windForce\", this.windForce);\n this._activeEffect.setFloat(\"waveHeight\", this.waveHeight);\n this._activeEffect.setFloat(\"bumpHeight\", this.bumpHeight);\n this._activeEffect.setColor4(\"waterColor\", this.waterColor, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor\", this.colorBlendFactor);\n this._activeEffect.setColor4(\"waterColor2\", this.waterColor2, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor2\", this.colorBlendFactor2);\n this._activeEffect.setFloat(\"waveSpeed\", this.waveSpeed);\n\n // image processing\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\n this._imageProcessingConfiguration.bind(this._activeEffect);\n }\n\n this._afterBind(mesh, this._activeEffect);\n }\n\n private _createRenderTargets(scene: Scene, renderTargetSize: Vector2): void {\n // Render targets\n this._refractionRTT = new RenderTargetTexture(name + \"_refraction\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._refractionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.ignoreCameraViewport = true;\n\n this._reflectionRTT = new RenderTargetTexture(name + \"_reflection\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._reflectionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.ignoreCameraViewport = true;\n\n var isVisible: boolean;\n var clipPlane: Nullable = null;\n var savedViewMatrix: Matrix;\n var mirrorMatrix = Matrix.Zero();\n\n this._refractionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony + 0.05, 0), new Vector3(0, 1, 0));\n }\n };\n\n this._refractionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n scene.clipPlane = clipPlane;\n }\n };\n\n this._reflectionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony - 0.05, 0), new Vector3(0, -1, 0));\n\n Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);\n }\n\n // Transform\n savedViewMatrix = scene.getViewMatrix();\n\n mirrorMatrix.multiplyToRef(savedViewMatrix, this._reflectionTransform);\n scene.setTransformMatrix(this._reflectionTransform, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = false;\n scene._mirroredCameraPosition = Vector3.TransformCoordinates((scene.activeCamera).position, mirrorMatrix);\n };\n\n this._reflectionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n scene.clipPlane = clipPlane;\n\n // Transform\n scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = true;\n scene._mirroredCameraPosition = null;\n };\n }\n\n public getAnimatables(): IAnimatable[] {\n var results = [];\n\n if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {\n results.push(this.bumpTexture);\n }\n if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {\n results.push(this._reflectionRTT);\n }\n if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {\n results.push(this._refractionRTT);\n }\n\n return results;\n }\n\n public getActiveTextures(): BaseTexture[] {\n var activeTextures = super.getActiveTextures();\n\n if (this._bumpTexture) {\n activeTextures.push(this._bumpTexture);\n }\n\n return activeTextures;\n }\n\n public hasTexture(texture: BaseTexture): boolean {\n if (super.hasTexture(texture)) {\n return true;\n }\n\n if (this._bumpTexture === texture) {\n return true;\n }\n\n return false;\n }\n\n public dispose(forceDisposeEffect?: boolean): void {\n if (this.bumpTexture) {\n this.bumpTexture.dispose();\n }\n\n var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n index = -1;\n index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.dispose();\n }\n if (this._refractionRTT) {\n this._refractionRTT.dispose();\n }\n\n // Remove image-processing observer\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n\n super.dispose(forceDisposeEffect);\n }\n\n public clone(name: string): WaterMaterial {\n return SerializationHelper.Clone(() => new WaterMaterial(name, this.getScene()), this);\n }\n\n public serialize(): any {\n var serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.WaterMaterial\";\n\n serializationObject.renderList = [];\n if (this._refractionRTT && this._refractionRTT.renderList) {\n for (var i = 0; i < this._refractionRTT.renderList.length; i++) {\n serializationObject.renderList.push(this._refractionRTT.renderList[i].id);\n }\n }\n\n return serializationObject;\n }\n\n public getClassName(): string {\n return \"WaterMaterial\";\n }\n\n // Statics\n public static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial {\n var mat = SerializationHelper.Parse(() => new WaterMaterial(source.name, scene), source, scene, rootUrl);\n mat._waitingRenderList = source.renderList;\n\n return mat;\n }\n\n public static CreateDefaultMesh(name: string, scene: Scene): Mesh {\n var mesh = Mesh.CreateGround(name, 512, 512, 32, scene, false);\n return mesh;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.WaterMaterial\"] = WaterMaterial;","module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://BABYLONJS/materialsLibrary/src/webpack/universalModuleDefinition","webpack://BABYLONJS/materialsLibrary/src/webpack/bootstrap","webpack://BABYLONJS/node_modules/tslib/tslib.es6.js","webpack://BABYLONJS/materialsLibrary/src/(webpack)/buildin/global.js","webpack://BABYLONJS/materialsLibrary/src/cell/cell.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/cell/cell.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/cell/cellMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/cell/index.ts","webpack://BABYLONJS/materialsLibrary/src/custom/customMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/custom/index.ts","webpack://BABYLONJS/materialsLibrary/src/custom/pbrCustomMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/fire/fire.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/fire/fire.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/fire/fireMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/fire/index.ts","webpack://BABYLONJS/materialsLibrary/src/fur/fur.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/fur/fur.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/fur/furMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/fur/index.ts","webpack://BABYLONJS/materialsLibrary/src/gradient/gradient.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/gradient/gradient.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/gradient/gradientMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/gradient/index.ts","webpack://BABYLONJS/materialsLibrary/src/grid/grid.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/grid/grid.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/grid/gridMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/grid/index.ts","webpack://BABYLONJS/materialsLibrary/src/index.ts","webpack://BABYLONJS/materialsLibrary/src/lava/index.ts","webpack://BABYLONJS/materialsLibrary/src/lava/lava.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/lava/lava.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/lava/lavaMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/legacy/legacy.ts","webpack://BABYLONJS/materialsLibrary/src/mix/index.ts","webpack://BABYLONJS/materialsLibrary/src/mix/mix.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/mix/mix.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/mix/mixMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/normal/index.ts","webpack://BABYLONJS/materialsLibrary/src/normal/normal.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/normal/normal.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/normal/normalMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/shadowOnly/index.ts","webpack://BABYLONJS/materialsLibrary/src/shadowOnly/shadowOnly.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/shadowOnly/shadowOnly.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/shadowOnly/shadowOnlyMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/simple/index.ts","webpack://BABYLONJS/materialsLibrary/src/simple/simple.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/simple/simple.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/simple/simpleMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/sky/index.ts","webpack://BABYLONJS/materialsLibrary/src/sky/sky.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/sky/sky.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/sky/skyMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/terrain/index.ts","webpack://BABYLONJS/materialsLibrary/src/terrain/terrain.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/terrain/terrain.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/terrain/terrainMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/triPlanar/index.ts","webpack://BABYLONJS/materialsLibrary/src/triPlanar/triPlanarMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/triPlanar/triplanar.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/triPlanar/triplanar.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/water/index.ts","webpack://BABYLONJS/materialsLibrary/src/water/water.fragment.ts","webpack://BABYLONJS/materialsLibrary/src/water/water.vertex.ts","webpack://BABYLONJS/materialsLibrary/src/water/waterMaterial.ts","webpack://BABYLONJS/materialsLibrary/src/external {\"root\":\"BABYLON\",\"commonjs\":\"babylonjs\",\"commonjs2\":\"babylonjs\",\"amd\":\"babylonjs\"}"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA,+DAA+D;AAC/D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;;AAEO;AACP;AACA,mBAAmB,sBAAsB;AACzC;AACA;;AAEO;AACP;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;;AAEO;AACP;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;;AAEO;AACP,mCAAmC,oCAAoC;AACvE;;AAEO;AACP;AACA;;AAEO;AACP;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,iEAAiE,uBAAuB,EAAE,4BAA4B;AACrJ;AACA,KAAK;AACL;;AAEO;AACP,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,gBAAgB;AACzC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;;AAEO;AACP,4BAA4B,sBAAsB;AAClD;AACA;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA,iBAAiB,sFAAsF,aAAa,EAAE;AACtH,sBAAsB,gCAAgC,qCAAqC,0CAA0C,EAAE,EAAE,GAAG;AAC5I,2BAA2B,MAAM,eAAe,EAAE,YAAY,oBAAoB,EAAE;AACpF,sBAAsB,oGAAoG;AAC1H,6BAA6B,uBAAuB;AACpD,4BAA4B,wBAAwB;AACpD,2BAA2B,yDAAyD;AACpF;;AAEO;AACP;AACA,iBAAiB,4CAA4C,SAAS,EAAE,qDAAqD,aAAa,EAAE;AAC5I,yBAAyB,6BAA6B,oBAAoB,gDAAgD,gBAAgB,EAAE,KAAK;AACjJ;;AAEO;AACP;AACA;AACA,2GAA2G,sFAAsF,aAAa,EAAE;AAChN,sBAAsB,8BAA8B,gDAAgD,uDAAuD,EAAE,EAAE,GAAG;AAClK,4CAA4C,sCAAsC,UAAU,oBAAoB,EAAE,EAAE,UAAU;AAC9H;;AAEO;AACP,gCAAgC,uCAAuC,aAAa,EAAE,EAAE,OAAO,kBAAkB;AACjH;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,4CAA4C;AAC5C;;;;;;;;;;;;ACzLA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;;;;;;ACnBA;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,+9EAmHX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,eAAe,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACrI9C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,g+CA+EZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,gBAAgB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AChGqF;AAEhF;AAEgC;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAG7B;AACF;AAEvB;IAAkC,6EAAe;IAsB7C;QAAA,YACI,iBAAO,SAEV;QAxBM,aAAO,GAAG,KAAK,CAAC;QAChB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,WAAK,GAAG,IAAI,CAAC;QACb,wBAAkB,GAAG,IAAI,CAAC;QAC1B,eAAS,GAAG,IAAI,CAAC;QACjB,kBAAY,GAAG,KAAK,CAAC;QAIxB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,0BAAC;AAAD,CAAC,CA1BiC,yEAAe,GA0BhD;AAED;IAAkC,sEAAY;IA0B1C,sBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QArBM,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,uBAAiB,GAAY,KAAK,CAAC;QAKlC,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;;IAQnC,CAAC;IAEM,wCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,uCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,0CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,wCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,mBAAmB,EAAE,CAAC;SACxD;QAED,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBAC7D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;wBACjC,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;qBAC1B;iBACJ;aACJ;SACJ;QAED,aAAa;QACb,OAAO,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;QAE3C,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/I,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,IAAI,UAAU,GAAG,MAAM,CAAC;YACxB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe;gBAC7F,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,eAAe;gBACf,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;aAC7E,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAClC,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YACH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,GAAG,CAAC,EAAE;aAC7E,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAE5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,qCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC7D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBAEtE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACjH,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;aAC1F;YAED,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,SAAS;QACT,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;SACpG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,qCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACvG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACtC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,wCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,iCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,IAAI,CAAC,eAAe,KAAK,OAAO,CAAC;IAC5C,CAAC;IAEM,8BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;SAClC;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,mCAAY,GAAnB;QACI,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,4BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAe,cAAM,WAAI,YAAY,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAvC,CAAuC,EAAE,IAAI,CAAC,CAAC;IACxG,CAAC;IAEM,gCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,UAAU;IACI,kBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAApC,CAAoC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;IA9RD;QADC,oFAAkB,CAAC,gBAAgB,CAAC;yDACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDAClB;IAGnC;QADC,mFAAiB,CAAC,SAAS,CAAC;sDACa;IAG1C;QADC,2EAAS,CAAC,kBAAkB,CAAC;2DACY;IAE1C;QADC,kFAAgB,CAAC,kCAAkC,CAAC;0DACpB;IAGjC;QADC,2EAAS,CAAC,iBAAiB,CAAC;0DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;yDACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;gEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;+DACd;IA2QzC,mBAAC;CAAA,CAjSiC,sEAAY,GAiS7C;AAjSwB;AAmSzB,oEAAU,CAAC,eAAe,CAAC,sBAAsB,CAAC,GAAG,YAAY,CAAC;;;;;;;;;;;;;ACpVlE;AAAA;AAAA;AAAA;AAA+B;;;;;;;;;;;;;;;;;;;;;ACCqB;AAEoB;AAGlB;AAEtD;IAKI;IAAgB,CAAC;IACrB,4BAAC;AAAD,CAAC;;AAED;IAEI;IAAgB,CAAC;IA6BrB,yBAAC;AAAD,CAAC;;AAED;IAAoC,wEAAgB;IAyGhD,wBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SAMrB;QALG,KAAI,CAAC,WAAW,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAC5C,KAAI,CAAC,uBAAuB,GAAG,KAAI,CAAC,OAAO,CAAC;QAE5C,KAAI,CAAC,cAAc,GAAG,iEAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;QAChE,KAAI,CAAC,YAAY,GAAG,iEAAM,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;;IACnE,CAAC;IAnGM,wCAAe,GAAtB,UAAuB,IAAU,EAAE,MAAc;QAC7C,KAAK,IAAI,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE;YACtC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACjB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACtB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACtB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACtB,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC1D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE;gBACvB,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aACzD;SACJ;QACD,KAAK,IAAI,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE;YACtC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,IAAI,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC1G,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;SACJ;IACL,CAAC;IAEM,sCAAa,GAApB,UAAqB,IAAY,EAAE,GAAa;QAC5C,IAAI,IAAI,IAAI,SAAS,EAAE;YACnB,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE;gBAC/B,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;oBACnD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;iBACpC;aACJ;SACJ;QACD,IAAI,IAAI,IAAI,SAAS,EAAE;YACnB,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE;gBAC/B,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;oBACnD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;iBACpC;aACJ;SACJ;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,gCAAO,GAAd,UAAe,UAAkB,EAAE,QAAkB,EAAE,cAAwB,EAAE,QAAkB,EAAE,OAAgC;QAArI,iBA6CC;QA3CG,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,OAAO,IAAI,CAAC,kBAAkB,CAAC;SAClC;QACD,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAE9B,cAAc,CAAC,aAAa,EAAE,CAAC;QAC/B,IAAI,IAAI,GAAW,SAAS,GAAG,cAAc,CAAC,aAAa,CAAC;QAE5D,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAExC,IAAI,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,GAAG,UAAC,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,CAAC,EAAE;gBACJ,OAAO;aACV;YACD,KAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,IAAI;gBAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aAAE;YAC3B,OAAO,CAAC,EAAE,GAAG;QACjB,CAAC,CAAC;QAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,GAAG,cAAc,CAAC,GAAG,IAAI,CAAC,YAAY;aACzD,OAAO,CAAC,6BAA6B,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5G,OAAO,CAAC,mCAAmC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5L,OAAO,CAAC,kCAAkC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACzH,OAAO,CAAC,uCAAuC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACxJ,OAAO,CAAC,qCAAqC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAClJ,OAAO,CAAC,gCAAgC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzH,iEAAM,CAAC,YAAY,CAAC,IAAI,GAAG,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc;aAC1D,OAAO,CAAC,+BAA+B,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAClH,OAAO,CAAC,oCAAoC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC/H,OAAO,CAAC,qCAAqC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAClM,OAAO,CAAC,wCAAwC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC7I,OAAO,CAAC,sCAAsC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACvI,OAAO,CAAC,uCAAuC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC1I,OAAO,CAAC,oCAAoC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACjI,OAAO,CAAC,0CAA0C,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzJ,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAE/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAWM,mCAAU,GAAjB,UAAkB,IAAY,EAAE,IAAY,EAAE,KAAU;QACpD,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACtB,IAAI,CAAC,cAAc,GAAG,IAAI,KAAK,EAAE,CAAC;YAClC,IAAI,CAAC,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,oBAAoB,GAAG,IAAI,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,oBAAoB,GAAG,IAAI,KAAK,EAAE,CAAC;SAC3C;QACD,IAAI,KAAK,EAAE;YACP,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,oBAAqB,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;aAC/D;iBACI;gBACK,IAAI,CAAC,oBAAqB,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;aAC/D;SACJ;QACD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;QAC/D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uCAAc,GAArB,UAAsB,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,6CAAoB,GAA3B,UAA4B,UAAkB;QAC1C,IAAI,CAAC,WAAW,CAAC,oBAAoB,GAAG,UAAU,CAAC;QACnD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,2CAAkB,GAAzB,UAA0B,UAAkB;QACxC,IAAI,CAAC,WAAW,CAAC,kBAAkB,GAAG,UAAU,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,gDAAuB,GAA9B,UAA+B,UAAkB;QAC7C,IAAI,CAAC,WAAW,CAAC,uBAAuB,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACxF,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,8CAAqB,GAA5B,UAA6B,UAAkB;QAC3C,IAAI,CAAC,WAAW,CAAC,qBAAqB,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,+CAAsB,GAA7B,UAA8B,UAAkB;QAC5C,IAAI,CAAC,WAAW,CAAC,sBAAsB,GAAG,UAAU,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,4CAAmB,GAA1B,UAA2B,UAAkB;QACzC,IAAI,CAAC,WAAW,CAAC,mBAAmB,GAAG,UAAU,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,kDAAyB,GAAhC,UAAiC,UAAkB;QAC/C,IAAI,CAAC,WAAW,CAAC,yBAAyB,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,qCAAY,GAAnB,UAAoB,UAAkB;QAClC,IAAI,CAAC,WAAW,CAAC,YAAY,GAAG,UAAU,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,2CAAkB,GAAzB,UAA0B,UAAkB;QACxC,IAAI,CAAC,WAAW,CAAC,kBAAkB,GAAG,UAAU,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,yCAAgB,GAAvB,UAAwB,UAAkB;QACtC,IAAI,CAAC,WAAW,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,sDAA6B,GAApC,UAAqC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,oDAA2B,GAAlC,UAAmC,UAAkB;QACjD,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uCAAc,GAArB,UAAsB,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IA1Ma,4BAAa,GAAG,CAAC,CAAC;IA2MpC,qBAAC;CAAA,CA5MmC,2EAAgB,GA4MnD;AA5M0B;AA8M3B,qEAAU,CAAC,eAAe,CAAC,wBAAwB,CAAC,GAAG,cAAc,CAAC;;;;;;;;;;;;;AC/PtE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAiC;AACG;;;;;;;;;;;;;;;;;;;;ACAgB;AAEc;AAGZ;AAEtD;IAEI;IAAgB,CAAC;IAiCrB,wBAAC;AAAD,CAAC;;AAED;IAAuC,2EAAW;IA2G9C,2BAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SAMrB;QALG,KAAI,CAAC,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAC3C,KAAI,CAAC,uBAAuB,GAAG,KAAI,CAAC,OAAO,CAAC;QAE5C,KAAI,CAAC,cAAc,GAAG,iEAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAC5D,KAAI,CAAC,YAAY,GAAG,iEAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;;IAC/D,CAAC;IArGM,2CAAe,GAAtB,UAAuB,IAAU,EAAE,MAAc;QAC7C,KAAK,IAAI,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE;YACtC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACjB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACtB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACtB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;gBACtB,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC1D;iBACI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE;gBACvB,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aACzD;SACJ;QACD,KAAK,IAAI,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE;YACtC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,IAAI,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC1G,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3D;SACJ;IACL,CAAC;IAEM,yCAAa,GAApB,UAAqB,IAAY,EAAE,GAAa;QAC5C,IAAI,IAAI,IAAI,SAAS,EAAE;YACnB,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE;gBAC/B,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;oBACnD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;iBACpC;aACJ;SACJ;QACD,IAAI,IAAI,IAAI,SAAS,EAAE;YACnB,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE;gBAC/B,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;oBACnD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;iBACpC;aACJ;SACJ;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,mCAAO,GAAd,UAAe,UAAkB,EAAE,QAAkB,EAAE,cAAwB,EAAE,QAAkB,EAAE,OAA2B;QAAhI,iBA+CC;QA7CG,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,OAAO,IAAI,CAAC,kBAAkB,CAAC;SAClC;QACD,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAE9B,iBAAiB,CAAC,aAAa,EAAE,CAAC;QAClC,IAAI,IAAI,GAAW,SAAS,GAAG,iBAAiB,CAAC,aAAa,CAAC;QAE/D,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAExC,IAAI,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,GAAG,UAAC,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,CAAC,EAAE;gBACJ,OAAO;aACV;YACD,KAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,IAAI;gBAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aAAE;YAC3B,OAAO,CAAC,EAAE,GAAG;QACjB,CAAC,CAAC;QAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,GAAG,cAAc,CAAC,GAAG,IAAI,CAAC,YAAY;aACzD,OAAO,CAAC,6BAA6B,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5G,OAAO,CAAC,mCAAmC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5L,OAAO,CAAC,kCAAkC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACzH,OAAO,CAAC,uCAAuC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACxJ,OAAO,CAAC,qCAAqC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAClJ,OAAO,CAAC,gCAAgC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzH,iEAAM,CAAC,YAAY,CAAC,IAAI,GAAG,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc;aAC1D,OAAO,CAAC,+BAA+B,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAClH,OAAO,CAAC,oCAAoC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC/H,OAAO,CAAC,qCAAqC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAClM,OAAO,CAAC,uCAAuC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC1I,OAAO,CAAC,sCAAsC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACvI,OAAO,CAAC,uCAAuC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC1I,OAAO,CAAC,kDAAkD,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC3K,OAAO,CAAC,6CAA6C,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5J,OAAO,CAAC,oCAAoC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACjI,OAAO,CAAC,0CAA0C,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzJ,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAE/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAWM,sCAAU,GAAjB,UAAkB,IAAY,EAAE,IAAY,EAAE,KAAU;QACpD,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACtB,IAAI,CAAC,cAAc,GAAG,IAAI,KAAK,EAAE,CAAC;YAClC,IAAI,CAAC,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,oBAAoB,GAAG,IAAI,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,oBAAoB,GAAG,IAAI,KAAK,EAAE,CAAC;SAC3C;QACD,IAAI,KAAK,EAAE;YACP,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,oBAAqB,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;aAC/D;iBACI;gBACK,IAAI,CAAC,oBAAqB,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;aAC/D;SACJ;QACD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;QAC/D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,0CAAc,GAArB,UAAsB,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,gDAAoB,GAA3B,UAA4B,UAAkB;QAC1C,IAAI,CAAC,WAAW,CAAC,oBAAoB,GAAG,UAAU,CAAC;QACnD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,8CAAkB,GAAzB,UAA0B,UAAkB;QACxC,IAAI,CAAC,WAAW,CAAC,kBAAkB,GAAG,UAAU,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,kDAAsB,GAA7B,UAA8B,UAAkB;QAC5C,IAAI,CAAC,WAAW,CAAC,sBAAsB,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxF,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,iDAAqB,GAA5B,UAA6B,UAAkB;QAC3C,IAAI,CAAC,WAAW,CAAC,qBAAqB,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,kDAAsB,GAA7B,UAA8B,UAAkB;QAC5C,IAAI,CAAC,WAAW,CAAC,sBAAsB,GAAG,UAAU,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,6DAAiC,GAAxC,UAAyC,UAAkB;QACvD,IAAI,CAAC,WAAW,CAAC,iCAAiC,GAAG,UAAU,CAAC;QAChE,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,wDAA4B,GAAnC,UAAoC,UAAkB;QAClD,IAAI,CAAC,WAAW,CAAC,4BAA4B,GAAG,UAAU,CAAC;QAC3D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,+CAAmB,GAA1B,UAA2B,UAAkB;QACzC,IAAI,CAAC,WAAW,CAAC,mBAAmB,GAAG,UAAU,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,qDAAyB,GAAhC,UAAiC,UAAkB;QAC/C,IAAI,CAAC,WAAW,CAAC,yBAAyB,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,wCAAY,GAAnB,UAAoB,UAAkB;QAClC,IAAI,CAAC,WAAW,CAAC,YAAY,GAAG,UAAU,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,8CAAkB,GAAzB,UAA0B,UAAkB;QACxC,IAAI,CAAC,WAAW,CAAC,kBAAkB,GAAG,UAAU,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,4CAAgB,GAAvB,UAAwB,UAAkB;QACtC,IAAI,CAAC,WAAW,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,yDAA6B,GAApC,UAAqC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uDAA2B,GAAlC,UAAmC,UAAkB;QACjD,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,0CAAc,GAArB,UAAsB,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAtNa,+BAAa,GAAG,CAAC,CAAC;IAuNpC,wBAAC;CAAA,CAxNsC,sEAAW,GAwNjD;AAxN6B;AA0N9B,qEAAU,CAAC,eAAe,CAAC,2BAA2B,CAAC,GAAG,iBAAiB,CAAC;;;;;;;;;;;;;ACvQ5E;AAAA;AAAA;AAAA;AAAoD;AACmB;AACN;AACL;AACL;AACD;AAEtD,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,+yDAsEX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,eAAe,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;AClF9C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACL;AACJ;AACI;AACN;AAEpD,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,26CAwEZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,gBAAgB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;ACtFqF;AAEhF;AACT;AAEoB;AACF;AACS;AACF;AACJ;AACE;AACX;AAIf;AACc;AAG7B;AACF;AAEvB;IAAkC,6EAAe;IAiB7C;QAAA,YACI,iBAAO,SAEV;QAnBM,aAAO,GAAG,KAAK,CAAC;QAChB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,kBAAY,GAAG,CAAC,CAAC;QACjB,0BAAoB,GAAG,CAAC,CAAC;QACzB,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,0BAAC;AAAD,CAAC,CArBiC,yEAAe,GAqBhD;AAED;IAAkC,sEAAY;IA0B1C,sBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAXM,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,WAAK,GAAG,GAAG,CAAC;QAEX,oBAAc,GAAG,IAAI,gEAAM,EAAE,CAAC;QAE9B,eAAS,GAAW,CAAC,CAAC;;IAI9B,CAAC;IAEM,wCAAiB,GAAxB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,uCAAgB,GAAvB;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,0CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,wCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,mBAAmB,EAAE,CAAC;SACxD;QAED,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC7D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;oBACjC,OAAO,KAAK,CAAC;iBAChB;qBAAM;oBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;oBACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;iBAC1B;aACJ;SACJ;QAED,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAExD,QAAQ;QACR,IAAI,OAAO,CAAC,aAAa,EAAE;YACvB,OAAO,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACjE,OAAO,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;SAChH;QAED,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAEvE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAE1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,MAAM,CAAC;YAExB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EACvD;gBACI,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc;oBAC7D,WAAW,EAAE,WAAW,EAAE,WAAW;oBACrC,eAAe;oBACf,QAAQ;oBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;oBAC1E,OAAO;oBACP,MAAM,EAAE,OAAO;iBAClB;gBACD,mBAAmB,EAAE,EAAE;gBACvB,QAAQ,EAAE,CAAC,gBAAgB;oBACvB,OAAO;oBACP,mBAAmB,EAAE,gBAAgB;iBACxC;gBACD,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,IAAI;gBACrB,qBAAqB,EAAE,CAAC;gBACxB,yBAAyB,EAAE,IAAI;aAClC,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,qCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC7D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBAEtE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACjH,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;gBAEvF,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;gBAC5E,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;aACzE;YAED,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAEjG,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,OAAO;QACP,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAEpD,QAAQ;QACR,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAEjD,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,qCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACvG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACtC;QACD,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAChH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACzC;QACD,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACvG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACtC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,wCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;SAChD;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,iCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,eAAe,KAAK,OAAO,EAAE;YAClC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,kBAAkB,KAAK,OAAO,EAAE;YACrC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,eAAe,KAAK,OAAO,EAAE;YAClC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,mCAAY,GAAnB;QACI,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,8BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;SAClC;QACD,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;SACrC;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,4BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAe,cAAM,WAAI,YAAY,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAvC,CAAuC,EAAE,IAAI,CAAC,CAAC;IACxG,CAAC;IAEM,gCAAS,GAAhB;QAEI,IAAI,mBAAmB,GAAG,iBAAM,SAAS,WAAE,CAAC;QAC5C,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC/D,mBAAmB,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEvC,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;SAC1E;QAED,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,mBAAmB,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC;SAChF;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;SAC1E;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEa,kBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,IAAI,QAAQ,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEpD,QAAQ,CAAC,YAAY,GAAG,gEAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9D,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAE9B,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAE9B,QAAQ,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QAExB,8DAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,QAAQ,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAClD,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAEtC,IAAI,MAAM,CAAC,eAAe,EAAE;YACxB,QAAQ,CAAC,eAAe,GAAG,iEAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACpF;QAED,IAAI,MAAM,CAAC,kBAAkB,EAAE;YAC3B,QAAQ,CAAC,kBAAkB,GAAG,iEAAO,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SAC1F;QAED,IAAI,MAAM,CAAC,eAAe,EAAE;YACxB,QAAQ,CAAC,eAAe,GAAG,iEAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACpF;QAED,IAAI,MAAM,CAAC,kBAAkB,EAAE;YAC3B,QAAQ,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;SAC3D;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IA9VD;QADC,oFAAkB,CAAC,gBAAgB,CAAC;yDACU;IAE/C;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACR;IAG7C;QADC,oFAAkB,CAAC,mBAAmB,CAAC;4DACU;IAElD;QADC,kFAAgB,CAAC,kCAAkC,CAAC;2DACL;IAGhD;QADC,oFAAkB,CAAC,gBAAgB,CAAC;yDACU;IAE/C;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACR;IAG7C;QADC,mFAAiB,CAAC,SAAS,CAAC;sDACa;IAG1C;QADC,2EAAS,EAAE;+CACO;IA6UvB,mBAAC;CAAA,CAjWiC,sEAAY,GAiW7C;AAjWwB;AAmWzB,oEAAU,CAAC,eAAe,CAAC,sBAAsB,CAAC,GAAG,YAAY,CAAC;;;;;;;;;;;;;ACjZlE;AAAA;AAAA;AAAA;AAA+B;;;;;;;;;;;;;ACA/B;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACF;AACM;AACX;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,gBAAgB,CAAC;AAC5B,IAAI,MAAM,GAAG,otEAkGX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,cAAc,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACpH7C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,2kGA2IZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,eAAe,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC5J0G;AAC1F;AACV;AAET;AAEoB;AACc;AACO;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAE9B;AACF;AAEtB;IAAiC,4EAAe;IAqB5C;QAAA,YACI,iBAAO,SAEV;QAvBM,aAAO,GAAG,KAAK,CAAC;QAChB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,yBAAC;AAAD,CAAC,CAzBgC,yEAAe,GAyB/C;AAED;IAAiC,qEAAY;IA+DzC,qBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QApDM,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,eAAS,GAAW,CAAC,CAAC;QAGtB,cAAQ,GAAW,CAAC,CAAC;QAGrB,cAAQ,GAAG,IAAI,gEAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAGxC,eAAS,GAAW,GAAG,CAAC;QAGxB,gBAAU,GAAW,EAAE,CAAC;QAGxB,gBAAU,GAAG,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGlC,cAAQ,GAAW,GAAG,CAAC;QAGvB,gBAAU,GAAW,EAAE,CAAC;QAGxB,kBAAY,GAAW,GAAG,CAAC;QAK1B,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;QAK5B,kBAAY,GAAY,IAAI,CAAC;QAM5B,cAAQ,GAAW,CAAC,CAAC;;IAI7B,CAAC;IAGD,sBAAW,gCAAO;aAAlB;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;aAED,UAAmB,OAAe;YAC9B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC5B,CAAC;;;OAJA;IAMM,uCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,sCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,yCAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,+BAAS,GAAhB;QACI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,SAAS,GAAgB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YAEtD,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YACrC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;YACnC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;YACvC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;YACvC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;YACnC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;YACnC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;YAC/C,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;YACvC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YAC3C,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YACjC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;SAC1C;IACL,CAAC;IAED,UAAU;IACH,uCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,kBAAkB,EAAE,CAAC;SACvD;QAED,IAAI,OAAO,GAAuB,OAAO,CAAC,gBAAgB,CAAC;QAC3D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,cAAc,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBAC5D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE;wBAChC,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;qBAC1B;iBACJ;gBACD,IAAI,IAAI,CAAC,aAAa,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,0BAA0B,EAAE;oBACnE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE;wBAC/B,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;qBAC5B;iBACJ;aACJ;SACJ;QAED,aAAa;QACb,IAAI,IAAI,CAAC,YAAY,KAAK,OAAO,CAAC,SAAS,EAAE;YACzC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;YACzB,OAAO,CAAC,iBAAiB,EAAE,CAAC;SAC/B;QAED,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/I,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAE1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,KAAK,CAAC;YACvB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe;gBAC7F,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,eAAe;gBACf,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;gBAC1E,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc;aACxH,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,gBAAgB;gBAC5B,eAAe,EAAE,YAAY;aAChC,CAAC;YAEF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EAAE;aACzE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,oCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAuB,OAAO,CAAC,gBAAgB,CAAC;QAC3D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,KAAK,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;YACpC,WAAW;YACX,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC7D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBAEtE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACjH,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;aAC1F;YAED,IAAI,IAAI,CAAC,cAAc,EAAE;gBACrB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;aACvE;YAED,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvD,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YACzD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAE/D,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5E,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEtD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;SAChE;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,oCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QAED,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,UAAU,IAAI,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACjG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SACpC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,uCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAC5C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,gCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,EAAE;YACjC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,EAAE;YACjC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,6BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC1C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAEnC,IAAI,GAAG,EAAE;oBACL,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;iBACnC;gBACD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;aAC7B;SACJ;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,2BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,WAAW,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAtC,CAAsC,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC;IAEM,+BAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,qBAAqB,CAAC;QAEvD,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,mBAAmB,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAC1D,mBAAmB,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;SACrD;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,kCAAY,GAAnB;QACI,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,UAAU;IACI,iBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,IAAI,QAAQ,GAAG,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAnC,CAAmC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAE5G,IAAI,MAAM,CAAC,cAAc,IAAI,QAAQ,CAAC,YAAY,EAAE;YAChD,KAAK,CAAC,gBAAgB,CAAC;gBACnB,IAAI,UAAU,GAAS,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;gBAClE,IAAI,UAAU,EAAE;oBACZ,IAAI,UAAU,GAAG,WAAW,CAAC,eAAe,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;oBACnE,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;oBACjC,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;iBACtD;YACL,CAAC,CAAC,CAAC;SACN;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEa,2BAAe,GAA7B,UAA8B,IAAY,EAAE,KAAY;QACpD,wBAAwB;QACxB,IAAI,OAAO,GAAG,IAAI,wEAAc,CAAC,aAAa,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACzE,IAAI,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE;YAC5B,OAAO,CAAC,SAAS,GAAG,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC;YACrH,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACjH;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtB,OAAO,CAAC,KAAK,GAAG,iEAAO,CAAC,gBAAgB,CAAC;QACzC,OAAO,CAAC,KAAK,GAAG,iEAAO,CAAC,gBAAgB,CAAC;QAEzC,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,6EAA6E;IAC7E,0CAA0C;IAC1C,sCAAsC;IACxB,sBAAU,GAAxB,UAAyB,UAAgB,EAAE,OAAe;QACtD,IAAI,MAAM,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,IAAI,GAAG,GAA6B,UAAU,CAAC,QAAQ,CAAC;QACxD,IAAI,CAAC,CAAC;QAEN,IAAI,CAAC,CAAC,GAAG,YAAY,WAAW,CAAC,EAAE;YAC/B,MAAM,wDAAwD,CAAC;SAClE;QAED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;YAC1B,IAAI,SAAS,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;YACrE,UAAU,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACtC,8DAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YAC1B,8DAAI,CAAC,SAAS,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;YAE9C,SAAS,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;YACpC,SAAS,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;YAClC,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;YACtC,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;YACtC,SAAS,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;YAClC,SAAS,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;YAClC,SAAS,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC;YAC9C,SAAS,CAAC,SAAS,GAAG,CAAC,GAAG,OAAO,CAAC;YAClC,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;YACtC,SAAS,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;YAC1C,SAAS,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YAChC,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;YAEtC,IAAI,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAS,CAAC;YAE/D,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC;YAChC,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;YAC1C,UAAU,CAAC,QAAQ,GAAG,iEAAO,CAAC,IAAI,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC3B;QAED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAChC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,UAAU,CAAC;SACjC;QAEa,UAAU,CAAC,QAAS,CAAC,OAAO,GAAG,MAAM,CAAC;QAEpD,OAAO,MAAM,CAAC;IAClB,CAAC;IAhfD;QADC,oFAAkB,CAAC,gBAAgB,CAAC;wDACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;uDAClB;IAGnC;QADC,oFAAkB,CAAC,eAAe,CAAC;uDACA;IAEpC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;sDACnB;IAGlC;QADC,mFAAiB,EAAE;qDACsB;IAG1C;QADC,2EAAS,EAAE;kDACiB;IAG7B;QADC,2EAAS,EAAE;iDACgB;IAG5B;QADC,mFAAiB,EAAE;iDAC2B;IAG/C;QADC,2EAAS,EAAE;kDACmB;IAG/B;QADC,2EAAS,EAAE;mDACmB;IAG/B;QADC,oFAAkB,EAAE;mDACoB;IAGzC;QADC,2EAAS,EAAE;iDACkB;IAG9B;QADC,2EAAS,EAAE;mDACmB;IAG/B;QADC,2EAAS,EAAE;qDACsB;IAKlC;QADC,2EAAS,CAAC,iBAAiB,CAAC;yDACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;wDACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;+DACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;8DACd;IAGrC;QADC,2EAAS,EAAE;qDACwB;IAapC;QADC,2EAAS,EAAE;8CAGX;IA8aL,kBAAC;CAAA,CApfgC,sEAAY,GAof5C;AApfuB;AAsfxB,oEAAU,CAAC,eAAe,CAAC,qBAAqB,CAAC,GAAG,WAAW,CAAC;;;;;;;;;;;;;ACziBhE;AAAA;AAAA;AAAA;AAA8B;;;;;;;;;;;;;ACA9B;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,qBAAqB,CAAC;AACjC,IAAI,MAAM,GAAG,2nDAyEZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,mBAAmB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;AC3FlD;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,sBAAsB,CAAC;AAClC,IAAI,MAAM,GAAG,uvCAkEZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,oBAAoB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;ACnF6D;AAE5D;AAGkB;AACF;AACgB;AACpB;AACT;AAIf;AACc;AAEzB;AACF;AAE3B;IAAsC,iFAAe;IAmBjD;QAAA,YACI,iBAAO,SAEV;QArBM,cAAQ,GAAG,KAAK,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,8BAAC;AAAD,CAAC,CAvBqC,yEAAe,GAuBpD;AAED;IAAsC,0EAAY;IAsC9C,0BAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QArCO,4BAAsB,GAAG,CAAC,CAAC;QAInC,yCAAyC;QAElC,cAAQ,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAG/B,mBAAa,GAAG,GAAG,CAAC;QAE3B,0CAA0C;QAEnC,iBAAW,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGlC,sBAAgB,GAAG,GAAG,CAAC;QAE9B,kBAAkB;QAEX,YAAM,GAAG,CAAC,CAAC;QAGX,WAAK,GAAG,GAAG,CAAC;QAGZ,gBAAU,GAAG,GAAG,CAAC;QAGhB,sBAAgB,GAAG,KAAK,CAAC;;IAQjC,CAAC;IAEM,4CAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,IAAI,IAAI,CAAC,aAAa,GAAG,GAAG,IAAI,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC,CAAC;IACzF,CAAC;IAEM,2CAAgB,GAAvB;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,8CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,4CAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;SAC5D;QAED,IAAI,OAAO,GAA4B,OAAO,CAAC,gBAAgB,CAAC;QAChE,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/I,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAEzC,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAEvE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAE1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAE7D,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,UAAU,CAAC;YAC5B,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAE9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa;gBAC5E,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa;gBACzD,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO;aAC7D,CAAC;YACF,IAAI,QAAQ,GAAa,EAAE,CAAC;YAC5B,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,CAAC;aAC3B,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE;aAChD,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,yCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAA4B,OAAO,CAAC,gBAAgB,CAAC;QAChE,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QAED,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAE5C,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACrF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAE3D,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,yCAAc,GAArB;QACI,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,kCAAO,GAAd,UAAe,kBAA4B;QAEvC,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,gCAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,gBAAgB,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAA3C,CAA2C,EAAE,IAAI,CAAC,CAAC;IAC9F,CAAC;IAEM,oCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,0BAA0B,CAAC;QAC5D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,uCAAY,GAAnB;QACI,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAED,UAAU;IACI,sBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAxC,CAAwC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7G,CAAC;IA1PD;QADC,2EAAS,CAAC,uBAAuB,CAAC;oEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;mEACd;IAIrC;QADC,mFAAiB,EAAE;sDACkB;IAGtC;QADC,2EAAS,EAAE;2DACe;IAI3B;QADC,mFAAiB,EAAE;yDACqB;IAGzC;QADC,2EAAS,EAAE;8DACkB;IAI9B;QADC,2EAAS,EAAE;oDACM;IAGlB;QADC,2EAAS,EAAE;mDACO;IAGnB;QADC,2EAAS,EAAE;wDACY;IAGxB;QADC,2EAAS,CAAC,iBAAiB,CAAC;8DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;6DACnB;IA4NpC,uBAAC;CAAA,CA9PqC,sEAAY,GA8PjD;AA9P4B;AAgQ7B,oEAAU,CAAC,eAAe,CAAC,0BAA0B,CAAC,GAAG,gBAAgB,CAAC;;;;;;;;;;;;;AC7S1E;AAAA;AAAA;AAAA;AAAmC;;;;;;;;;;;;;ACAnC;AAAA;AAAA;AAAA;AAAoD;AACa;AACX;AAEtD,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,y3EA0FX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,eAAe,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACnG9C;AAAA;AAAA;AAAA;AAAoD;AACW;AACA;AACL;AACN;AAEpD,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,s8BAiDX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,gBAAgB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC5DqF;AAC7D;AACnB;AAEkB;AACF;AACJ;AACE;AACX;AAKD;AAE7B;AACF;AAEvB;IAAkC,6EAAe;IAS7C;QAAA,YACI,iBAAO,SAEV;QAXM,aAAO,GAAG,KAAK,CAAC;QAChB,iBAAW,GAAG,KAAK,CAAC;QACpB,SAAG,GAAG,KAAK,CAAC;QACZ,sBAAgB,GAAG,KAAK,CAAC;QACzB,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,0BAAC;AAAD,CAAC,CAbiC,yEAAe,GAahD;AAED;;;GAGG;AACH;IAAkC,sEAAY;IA2D1C;;;;OAIG;IACH,sBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAhED;;WAEG;QAEI,eAAS,GAAG,gEAAM,CAAC,KAAK,EAAE,CAAC;QAElC;;WAEG;QAEI,eAAS,GAAG,gEAAM,CAAC,IAAI,EAAE,CAAC;QAEjC;;WAEG;QAEI,eAAS,GAAG,GAAG,CAAC;QAEvB;;WAEG;QAEI,gBAAU,GAAG,iEAAO,CAAC,IAAI,EAAE,CAAC;QAEnC;;WAEG;QAEI,wBAAkB,GAAG,EAAE,CAAC;QAE/B;;WAEG;QAEI,yBAAmB,GAAG,IAAI,CAAC;QAElC;;WAEG;QAEI,aAAO,GAAG,GAAG,CAAC;QAErB;;WAEG;QAEI,sBAAgB,GAAG,KAAK,CAAC;QAOxB,kBAAY,GAAY,IAAI,iEAAO,CAAC,KAAI,CAAC,SAAS,EAAE,KAAI,CAAC,kBAAkB,EAAE,KAAI,CAAC,mBAAmB,EAAE,KAAI,CAAC,OAAO,CAAC,CAAC;;IAW7H,CAAC;IAED;;OAEG;IACI,wCAAiB,GAAxB;QACI,OAAO,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;IACxF,CAAC;IAEM,+CAAwB,GAA/B,UAAgC,IAAkB;QAC9C,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACpC,CAAC;IAEM,wCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,mBAAmB,EAAE,CAAC;SACxD;QAED,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE;YAC9C,OAAO,CAAC,WAAW,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC;YAC3C,OAAO,CAAC,iBAAiB,EAAE,CAAC;SAC/B;QAED,IAAI,OAAO,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACnD,OAAO,CAAC,gBAAgB,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACrD,OAAO,CAAC,iBAAiB,EAAE,CAAC;SAC/B;QAED,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBAC7D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;wBACjC,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;qBAC1B;iBACJ;aACJ;SACJ;QAED,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAEjG,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC;QAEpG,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,aAAa;YACb,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACxE,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,EAAE,sEAAY,CAAC,UAAU,CAAC,CAAC;YAEnE,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YACD,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,UAAU;YACV,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,MAAM,EACnD,OAAO,EACP,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;gBAC3G,eAAe,EAAE,eAAe,CAAC,EACrC,CAAC,gBAAgB,CAAC,EAClB,IAAI,EACJ,SAAS,EACT,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;SAC/B;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,qCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACpB,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;SACnC;QACD,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAExE,WAAW;QACX,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1D,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAE1D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAE7D,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC1D,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;YACnC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAEhE,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC7D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBACtE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACjH,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;aAC1F;SACJ;QACD,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACI,8BAAO,GAAd,UAAe,kBAA4B;QACvC,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,4BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,YAAY,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAvC,CAAuC,EAAE,IAAI,CAAC,CAAC;IAC1F,CAAC;IAEM,gCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,mCAAY,GAAnB;QACI,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEa,kBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAApC,CAAoC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;IA1OD;QADC,mFAAiB,EAAE;mDACc;IAMlC;QADC,mFAAiB,EAAE;mDACa;IAMjC;QADC,2EAAS,EAAE;mDACW;IAMvB;QADC,mFAAiB,EAAE;oDACe;IAMnC;QADC,2EAAS,EAAE;4DACmB;IAM/B;QADC,2EAAS,EAAE;6DACsB;IAMlC;QADC,2EAAS,EAAE;iDACS;IAMrB;QADC,2EAAS,EAAE;0DACoB;IAGhC;QADC,oFAAkB,CAAC,gBAAgB,CAAC;yDACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDAClB;IA4LvC,mBAAC;CAAA,CAjPiC,sEAAY,GAiP7C;AAjPwB;AAmPzB,oEAAU,CAAC,eAAe,CAAC,sBAAsB,CAAC,GAAG,YAAY,CAAC;;;;;;;;;;;;;ACxRlE;AAAA;AAAA;AAAA;AAA+B;;;;;;;;;;;;;ACA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAuB;AACE;AACF;AACD;AACK;AACJ;AACA;AACD;AACG;AACI;AACJ;AACH;AACI;AACE;AACJ;;;;;;;;;;;;;ACdxB;AAAA;AAAA;AAAA;AAA+B;;;;;;;;;;;;;ACA/B;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,2nFA4GX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,eAAe,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;AC9H9C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,kuIAyLX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,gBAAgB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC1MqF;AAEhF;AAGgC;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAE7B;AACF;AAEvB;IAAkC,6EAAe;IA6D7C;QAAA,YACI,iBAAO,SAEV;QA/DM,aAAO,GAAG,KAAK,CAAC;QAChB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,YAAM,GAAG,KAAK,CAAC;QACf,YAAM,GAAG,KAAK,CAAC;QACf,YAAM,GAAG,KAAK,CAAC;QACf,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,oBAAc,GAAG,KAAK,CAAC;QACvB,oBAAc,GAAG,KAAK,CAAC;QACvB,oBAAc,GAAG,KAAK,CAAC;QACvB,oBAAc,GAAG,KAAK,CAAC;QACvB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,WAAK,GAAG,KAAK,CAAC;QAIjB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,0BAAC;AAAD,CAAC,CAjEiC,yEAAe,GAiEhD;AAED;IAAkC,sEAAY;IA+C1C,sBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QApCM,WAAK,GAAW,CAAC,CAAC;QAGlB,iBAAW,GAAW,CAAC,CAAC;QAGxB,uBAAiB,GAAW,CAAC,CAAC;QAG9B,gBAAU,GAAW,IAAI,CAAC;QAEzB,eAAS,GAAW,CAAC,CAAC;QAGvB,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGlC,sBAAgB,GAAG,KAAK,CAAC;QAKzB,YAAM,GAAG,KAAK,CAAC;QAKf,4BAAsB,GAAG,CAAC,CAAC;QAI3B,oBAAc,GAAG,IAAI,gEAAM,EAAE,CAAC;;IAKtC,CAAC;IAEM,wCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,uCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,0CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,wCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,mBAAmB,EAAE,CAAC;SACxD;QAED,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBAC7D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;wBACjC,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;qBAC1B;iBACJ;aACJ;SACJ;QAED,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;QAE5B,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAExH,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAE7D,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,MAAM,CAAC;YACxB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAE9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe;gBAC7F,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,eAAe;gBACf,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;gBAC1E,MAAM,EAAE,OAAO,EAAE,aAAa;gBAC9B,UAAU,EAAE,YAAY,EAAE,mBAAmB;aAChD,CAAC;YAEF,IAAI,QAAQ,GAAG,CAAC,gBAAgB;gBAC5B,cAAc;aACjB,CAAC;YACF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EAAE;aACzE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,qCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAwB,OAAO,CAAC,gBAAgB,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,cAAc,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC5D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;gBAErE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC/G,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,CAAC;aACzF;YAED,IAAI,IAAI,CAAC,YAAY,EAAE;gBACnB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;aACpE;YAED,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAEjG,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SACvE;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAExE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,IAAI,CAAC,QAAQ,GAAG,gEAAM,CAAC,KAAK,EAAE,CAAC;SAClC;QACD,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAE3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACzE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAE7D,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,qCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QAED,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACnC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,wCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,iCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,EAAE;YACjC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,8BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,4BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,YAAY,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAvC,CAAuC,EAAE,IAAI,CAAC,CAAC;IAC1F,CAAC;IAEM,gCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,mCAAY,GAAnB;QACI,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,UAAU;IACI,kBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAApC,CAAoC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;IAtVD;QADC,oFAAkB,CAAC,gBAAgB,CAAC;yDACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDAClB;IAGnC;QADC,oFAAkB,EAAE;sDACY;IAGjC;QADC,mFAAiB,EAAE;kDACI;IAGxB;QADC,2EAAS,EAAE;+CACa;IAGzB;QADC,2EAAS,EAAE;qDACmB;IAG/B;QADC,2EAAS,EAAE;2DACyB;IAGrC;QADC,2EAAS,EAAE;oDACqB;IAKjC;QADC,mFAAiB,EAAE;sDACsB;IAG1C;QADC,2EAAS,CAAC,iBAAiB,CAAC;0DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;yDACnB;IAGhC;QADC,2EAAS,CAAC,OAAO,CAAC;gDACI;IAEvB;QADC,kFAAgB,CAAC,gCAAgC,CAAC;+CAC7B;IAGtB;QADC,2EAAS,CAAC,uBAAuB,CAAC;gEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;+DACd;IA+SzC,mBAAC;CAAA,CAzViC,sEAAY,GAyV7C;AAzVwB;AA2VzB,oEAAU,CAAC,eAAe,CAAC,sBAAsB,CAAC,GAAG,YAAY,CAAC;;;;;;;;;;;;;ACnblE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAmC;AAEnC;;;;;GAKG;AACH,IAAI,YAAY,GAAG,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AACrH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IAC/B,YAAa,CAAC,OAAO,GAAS,YAAa,CAAC,OAAO,IAAI,EAAE,CAAC;IAChE,KAAK,IAAI,GAAG,IAAI,mCAAM,EAAE;QACd,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,mCAAO,CAAC,GAAG,CAAC,CAAC;KACzD;CACJ;AAEwB;;;;;;;;;;;;;;AChBzB;AAAA;AAAA;AAAA;AAA8B;;;;;;;;;;;;;ACA9B;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,gBAAgB,CAAC;AAC5B,IAAI,MAAM,GAAG,4mHA8HZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,cAAc,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;AChJ7C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,k+CAgFZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,eAAe,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;ACjGsF;AAEhF;AAIgC;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAE9B;AACF;AAEtB;IAAiC,4EAAe;IAqB5C;QAAA,YACI,iBAAO,SAEV;QAvBM,aAAO,GAAG,KAAK,CAAC;QAChB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,kBAAY,GAAG,KAAK,CAAC;QACrB,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,aAAO,GAAG,KAAK,CAAC;QAInB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,yBAAC;AAAD,CAAC,CAzBgC,yEAAe,GAyB/C;AAED;IAAiC,qEAAY;IAoFzC,qBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QA3BD;;WAEG;QAGI,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,mBAAa,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGpC,mBAAa,GAAG,EAAE,CAAC;QAGlB,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;;IAQnC,CAAC;IAEM,uCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,sCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,yCAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,uCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,kBAAkB,EAAE,CAAC;SACvD;QAED,IAAI,OAAO,GAAuB,OAAO,CAAC,gBAAgB,CAAC;QAC3D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,KAAK,CAAC,eAAe,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;gBACpD,OAAO,KAAK,CAAC;aAChB;YAED,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YAExB,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBACrC,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;oBAC5D,OAAO,KAAK,CAAC;iBAChB;gBAED,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;gBAEvB,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;oBAC5D,OAAO,KAAK,CAAC;iBAChB;gBACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;oBAC5D,OAAO,KAAK,CAAC;iBAChB;gBACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;oBAC5D,OAAO,KAAK,CAAC;iBAChB;gBAED,IAAI,IAAI,CAAC,YAAY,EAAE;oBACnB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;wBAC9B,OAAO,KAAK,CAAC;qBAChB;oBAED,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;oBAEvB,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;wBAC5D,OAAO,KAAK,CAAC;qBAChB;oBACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;wBAC5D,OAAO,KAAK,CAAC;qBAChB;oBACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;wBAC5D,OAAO,KAAK,CAAC;qBAChB;oBACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;wBAC5D,OAAO,KAAK,CAAC;qBAChB;iBACJ;aACJ;SACJ;QAED,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/I,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,KAAK,CAAC;YACvB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG;gBACX,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB;gBACnG,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,eAAe;gBACf,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;gBAC1E,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe;gBAClE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe;aACrE,CAAC;YACF,IAAI,QAAQ,GAAG;gBACX,gBAAgB,EAAE,gBAAgB;gBAClC,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB;gBAC1E,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB;aAC7E,CAAC;YAEF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EAAE;aACzE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,oCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAuB,OAAO,CAAC,gBAAgB,CAAC;QAC3D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,YAAY,EAAE;gBACnB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;gBACnE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC3G,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;gBAEpF,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBACrC,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;iBACJ;aACJ;YAED,IAAI,IAAI,CAAC,YAAY,EAAE;gBACnB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;gBAEnE,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBACrC,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;iBACJ;aACJ;YAED,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1F;QAED,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,oCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACnC;QAED,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACnC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,uCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,YAAY;QACZ,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC1C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,YAAY;QACZ,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC1C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,gCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,YAAY;QACZ,IAAI,IAAI,CAAC,YAAY,KAAK,OAAO,EAAE;YAC/B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,YAAY;QACZ,IAAI,IAAI,CAAC,YAAY,KAAK,OAAO,EAAE;YAC/B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,6BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,2BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,WAAW,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAtC,CAAsC,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC;IAEM,+BAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,qBAAqB,CAAC;QACvD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,kCAAY,GAAnB;QACI,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,UAAU;IACI,iBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAnC,CAAmC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC;IA3fD;QADC,oFAAkB,CAAC,aAAa,CAAC;qDACA;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;oDACrB;IAGhC;QADC,oFAAkB,CAAC,aAAa,CAAC;qDACA;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;oDACrB;IAOhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;yDACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;wDACrB;IAOhC;QADC,mFAAiB,EAAE;qDACsB;IAG1C;QADC,mFAAiB,EAAE;sDACuB;IAG3C;QADC,2EAAS,EAAE;sDACc;IAG1B;QADC,2EAAS,CAAC,iBAAiB,CAAC;yDACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;wDACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;+DACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;8DACd;IAkbzC,kBAAC;CAAA,CAlgBgC,sEAAY,GAkgB5C;AAlgBuB;AAogBxB,oEAAU,CAAC,eAAe,CAAC,qBAAqB,CAAC,GAAG,WAAW,CAAC;;;;;;;;;;;;;ACrjBhE;AAAA;AAAA;AAAA;AAAiC;;;;;;;;;;;;;ACAjC;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,mBAAmB,CAAC;AAC/B,IAAI,MAAM,GAAG,6lDAyEX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,iBAAiB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;AC3FhD;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,oBAAoB,CAAC;AAChC,IAAI,MAAM,GAAG,i4CAwEZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,kBAAkB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;ACzFmF;AAEhF;AAGgC;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAE3B;AACF;AAEzB;IAAoC,+EAAe;IA2D/C;QAAA,YACI,iBAAO,SAEV;QA7DM,aAAO,GAAG,KAAK,CAAC;QAChB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,YAAM,GAAG,KAAK,CAAC;QACf,YAAM,GAAG,KAAK,CAAC;QACf,YAAM,GAAG,KAAK,CAAC;QACf,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,eAAS,GAAG,KAAK,CAAC;QAClB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,aAAO,GAAG,KAAK,CAAC;QAChB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,oBAAc,GAAG,KAAK,CAAC;QACvB,oBAAc,GAAG,KAAK,CAAC;QACvB,oBAAc,GAAG,KAAK,CAAC;QACvB,oBAAc,GAAG,KAAK,CAAC;QACvB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,cAAQ,GAAG,KAAK,CAAC;QAIpB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,4BAAC;AAAD,CAAC,CA/DmC,yEAAe,GA+DlD;AAED;IAAoC,wEAAY;IAqB5C,wBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAhBM,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGlC,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;;IAQnC,CAAC;IAEM,0CAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,iDAAwB,GAA/B,UAAgC,IAAkB;QAC9C,OAAO,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;IAC/D,CAAC;IAEM,yCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,4CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,0CAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,qBAAqB,EAAE,CAAC;SAC1D;QAED,IAAI,OAAO,GAA0B,OAAO,CAAC,gBAAgB,CAAC;QAC9D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBAC7D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;wBACjC,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;qBAC1B;iBACJ;aACJ;SACJ;QAED,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;QAC5B,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAExH,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,OAAO,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;QAE1C,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAE1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAE7D,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,IAAI,UAAU,GAAG,QAAQ,CAAC;YAC1B,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAE9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe;gBAC7F,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,eAAe;gBACf,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;aAC7E,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAClC,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,CAAC;aAC3B,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE;aAChD,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAA0B,OAAO,CAAC,gBAAgB,CAAC;QAC9D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,cAAc,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC5D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;gBAErE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC/G,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,CAAC;aACzF;YACD,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,SAAS;QACT,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SACvE;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,uCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,0CAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,mCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,EAAE;YACjC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,gCAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,8BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,cAAc,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAzC,CAAyC,EAAE,IAAI,CAAC,CAAC;IAC5F,CAAC;IAEM,kCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,wBAAwB,CAAC;QAC1D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,qCAAY,GAAnB;QACI,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,UAAU;IACI,oBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAtC,CAAsC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;IA9RD;QADC,oFAAkB,CAAC,gBAAgB,CAAC;2DACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;0DAClB;IAGnC;QADC,mFAAiB,EAAE;wDACsB;IAG1C;QADC,2EAAS,CAAC,iBAAiB,CAAC;4DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;2DACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;kEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;iEACd;IAgRzC,qBAAC;CAAA,CAjSmC,sEAAY,GAiS/C;AAjS0B;AAmS3B,oEAAU,CAAC,eAAe,CAAC,wBAAwB,CAAC,GAAG,cAAc,CAAC;;;;;;;;;;;;;ACzXtE;AAAA;AAAA;AAAA;AAAqC;;;;;;;;;;;;;ACArC;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACJ;AACF;AAEtD,IAAI,IAAI,GAAG,uBAAuB,CAAC;AACnC,IAAI,MAAM,GAAG,21BAsCX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,qBAAqB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACvDpD;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,wBAAwB,CAAC;AACpC,IAAI,MAAM,GAAG,+7BA4CZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,sBAAsB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC7DW;AAEZ;AAGgC;AACd;AACF;AACJ;AACT;AAIf;AACc;AAEvB;AACF;AAE7B;IAAwC,mFAAe;IAYnD;QAAA,YACI,iBAAO,SAEV;QAdM,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,gCAAC;AAAD,CAAC,CAhBuC,yEAAe,GAgBtD;AAED;IAAwC,4EAAY;IAIhD,4BAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAEM,iBAAW,GAAG,gEAAM,CAAC,KAAK,EAAE,CAAC;;IAFpC,CAAC;IAIM,8CAAiB,GAAxB;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,6CAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,gDAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,sBAAW,2CAAW;aAAtB;YACI,OAAO,IAAI,CAAC,YAAY,CAAC;QAC7B,CAAC;aAED,UAAuB,KAAmB;YACtC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC9B,CAAC;;;OAJA;IAMD,UAAU;IACH,8CAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,yBAAyB,EAAE,CAAC;SAC9D;QAED,IAAI,OAAO,GAA8B,OAAO,CAAC,gBAAgB,CAAC;QAClE,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,qDAAqD;QACrD,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,KAAkB,UAAiB,EAAjB,SAAI,CAAC,YAAY,EAAjB,cAAiB,EAAjB,IAAiB,EAAE;gBAAhC,IAAI,KAAK;gBACV,IAAI,KAAK,CAAC,aAAa,EAAE;oBACrB,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;wBAC7B,MAAM,CAAC,cAAc;qBACxB;oBAED,IAAI,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;oBAEjE,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE;wBACtB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;wBAC3C,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;qBACrD;oBACD,MAAM;iBACT;aACJ;SACJ;QAED,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAE9F,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAEvE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAE1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAEhE,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,IAAI,UAAU,GAAG,YAAY,CAAC;YAC9B,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa;gBAC5E,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa;gBAC7D,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa;aAC5D,CAAC;YACF,IAAI,QAAQ,GAAG,IAAI,KAAK,EAAU,CAAC;YAEnC,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,CAAC;aAC3B,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE;aAChD,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,2CAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAA8B,OAAO,CAAC,gBAAgB,CAAC;QAClE,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YAE9D,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,SAAS;QACT,IAAI,KAAK,CAAC,aAAa,EAAE;YACrB,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;SAC1E;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,kCAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAqB,cAAM,WAAI,kBAAkB,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAA7C,CAA6C,EAAE,IAAI,CAAC,CAAC;IACpH,CAAC;IAEM,sCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,4BAA4B,CAAC;QAC9D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,yCAAY,GAAnB;QACI,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAED,UAAU;IACI,wBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAA1C,CAA0C,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/G,CAAC;IACL,yBAAC;AAAD,CAAC,CA7NuC,sEAAY,GA6NnD;;AAED,oEAAU,CAAC,eAAe,CAAC,4BAA4B,CAAC,GAAG,kBAAkB,CAAC;;;;;;;;;;;;;ACrQ9E;AAAA;AAAA;AAAA;AAAiC;;;;;;;;;;;;;ACAjC;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,mBAAmB,CAAC;AAC/B,IAAI,MAAM,GAAG,+/CAsEX,CAAC;AAEH,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,iBAAiB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACxFhD;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,oBAAoB,CAAC;AAChC,IAAI,MAAM,GAAG,g+CA+EZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,kBAAkB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AChGmF;AAEhF;AAGgC;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAE3B;AACF;AAEzB;IAAoC,+EAAe;IAmB/C;QAAA,YACI,iBAAO,SAEV;QArBM,aAAO,GAAG,KAAK,CAAC;QAChB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,4BAAC;AAAD,CAAC,CAvBmC,yEAAe,GAuBlD;AAED;IAAoC,wEAAY;IAqB5C,wBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAhBM,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGlC,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;;IAQnC,CAAC;IAEM,0CAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,yCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,4CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,0CAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,qBAAqB,EAAE,CAAC;SAC1D;QAED,IAAI,OAAO,GAA0B,OAAO,CAAC,gBAAgB,CAAC;QAC9D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBAC7D,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;wBACjC,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;qBAC1B;iBACJ;aACJ;SACJ;QAED,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/I,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,IAAI,UAAU,GAAG,QAAQ,CAAC;YAC1B,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe;gBAC7F,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,eAAe;gBACf,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;aAC7E,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAClC,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YACH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,sBAAsB,GAAG,CAAC,EAAE;aAC9E,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAE5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAA0B,OAAO,CAAC,gBAAgB,CAAC;QAC9D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,eAAe,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBAC7D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBAEtE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBACjH,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;aAC1F;YAED,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,SAAS;QACT,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,uCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACvG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACtC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,0CAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,mCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,cAAc,KAAK,OAAO,EAAE;YACjC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,gCAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;SAClC;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,8BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAiB,cAAM,WAAI,cAAc,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAzC,CAAyC,EAAE,IAAI,CAAC,CAAC;IAC5G,CAAC;IAEM,kCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,wBAAwB,CAAC;QAC1D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,qCAAY,GAAnB;QACI,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,UAAU;IACI,oBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAtC,CAAsC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;IA1RD;QADC,oFAAkB,CAAC,gBAAgB,CAAC;2DACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;0DAClB;IAGnC;QADC,mFAAiB,CAAC,SAAS,CAAC;wDACa;IAG1C;QADC,2EAAS,CAAC,iBAAiB,CAAC;4DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;2DACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;kEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;iEACd;IA4QzC,qBAAC;CAAA,CA7RmC,sEAAY,GA6R/C;AA7R0B;AA+R3B,oEAAU,CAAC,eAAe,CAAC,wBAAwB,CAAC,GAAG,cAAc,CAAC;;;;;;;;;;;;;AC7UtE;AAAA;AAAA;AAAA;AAA8B;;;;;;;;;;;;;ACA9B;AAAA;AAAA;AAAA;AAAoD;AACmB;AACN;AACL;AACN;AAEtD,IAAI,IAAI,GAAG,gBAAgB,CAAC;AAC5B,IAAI,MAAM,GAAG,s9HA8HZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,cAAc,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACzI7C;AAAA;AAAA;AAAA;AAAoD;AACiB;AACN;AACL;AACN;AAEpD,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,iqBAqCZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,eAAe,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC/CiD;AACjC;AAGD;AACS;AACF;AACJ;AACT;AAIf;AACc;AAE9B;AACF;AAEtB,cAAc;AACd;IAAiC,4EAAe;IAU5C;QAAA,YACI,iBAAO,SAEV;QAZM,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QAIvB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,yBAAC;AAAD,CAAC,CAdgC,yEAAe,GAc/C;AAED;;;GAGG;AACH;IAAiC,qEAAY;IA6EzC;;;;;;;OAOG;IACH,qBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAtFD;;WAEG;QAEI,eAAS,GAAW,GAAG,CAAC;QAE/B;;UAEE;QAEK,eAAS,GAAW,IAAI,CAAC;QAEhC;;WAEG;QAEI,cAAQ,GAAW,GAAG,CAAC;QAE9B;;WAEG;QAEI,oBAAc,GAAW,KAAK,CAAC;QAEtC;;WAEG;QAEI,qBAAe,GAAW,GAAG,CAAC;QAErC;;WAEG;QAEI,cAAQ,GAAW,GAAG,CAAC;QAE9B;;;WAGG;QAEI,iBAAW,GAAW,IAAI,CAAC;QAElC;;;WAGG;QAEI,aAAO,GAAW,IAAI,CAAC;QAE9B;;;WAGG;QAEI,iBAAW,GAAY,IAAI,iEAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAErD;;;WAGG;QAEI,oBAAc,GAAY,KAAK,CAAC;QAEvC;;;WAGG;QAEI,kBAAY,GAAY,iEAAO,CAAC,IAAI,EAAE,CAAC;QAE9C,kBAAkB;QACV,qBAAe,GAAY,iEAAO,CAAC,IAAI,EAAE,CAAC;;IAclD,CAAC;IAED;;;OAGG;IACI,uCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,sCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;OAGG;IACI,yCAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;;OAOG;IACI,uCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,kBAAkB,EAAE,CAAC;SACvD;QAED,IAAI,OAAO,GAAuB,OAAO,CAAC,gBAAgB,CAAC;QAC3D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAE5G,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAEvE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAE1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,IAAI,UAAU,GAAG,KAAK,CAAC;YAEvB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EACvD,OAAO,EACP,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM;gBAC9B,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa;gBAChG,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa;gBACxF,gBAAgB,EAAE,cAAc;aACnC,EACD,EAAE,EACF,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;SACjE;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,oCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAuB,OAAO,CAAC,gBAAgB,CAAC;QAC3D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YAEjC,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;SACJ;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,MAAM;QACN,IAAI,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;QAChC,IAAI,MAAM,EAAE;YACR,IAAI,iBAAiB,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;YAChD,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACjD,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACjD,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACjD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;SACzE;QAED,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAEjE,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;SAC5D;QAED,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAErE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACtB,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC;YAC/C,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC;YAE7C,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACnD,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrE,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACxE;QAED,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAE/D,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACI,oCAAc,GAArB;QACI,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,6BAAO,GAAd,UAAe,kBAA4B;QACvC,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,2BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAc,cAAM,WAAI,WAAW,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAtC,CAAsC,EAAE,IAAI,CAAC,CAAC;IACtG,CAAC;IAED;;;OAGG;IACI,+BAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,qBAAqB,CAAC;QACvD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACI,kCAAY,GAAnB;QACI,OAAO,aAAa,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACW,iBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAnC,CAAmC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC;IA1TD;QADC,2EAAS,EAAE;kDACmB;IAM/B;QADC,2EAAS,EAAE;kDACoB;IAMhC;QADC,2EAAS,EAAE;iDACkB;IAM9B;QADC,2EAAS,EAAE;uDAC0B;IAMtC;QADC,2EAAS,EAAE;wDACyB;IAMrC;QADC,2EAAS,EAAE;iDACkB;IAO9B;QADC,2EAAS,EAAE;oDACsB;IAOlC;QADC,2EAAS,EAAE;gDACkB;IAO9B;QADC,oFAAkB,EAAE;oDACgC;IAOrD;QADC,2EAAS,EAAE;uDAC2B;IAOvC;QADC,2EAAS,EAAE;qDACkC;IA0PlD,kBAAC;CAAA,CAhUgC,sEAAY,GAgU5C;AAhUuB;AAkUxB,oEAAU,CAAC,eAAe,CAAC,qBAAqB,CAAC,GAAG,WAAW,CAAC;;;;;;;;;;;;;AC1WhE;AAAA;AAAA;AAAA;AAAkC;;;;;;;;;;;;;ACAlC;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,oBAAoB,CAAC;AAChC,IAAI,MAAM,GAAG,qnHA2IZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,kBAAkB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;AC7JjD;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,qBAAqB,CAAC;AACjC,IAAI,MAAM,GAAG,k+CAgFZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,mBAAmB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;ACjGkF;AAEhF;AAIgC;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAE1B;AACF;AAE1B;IAAqC,gFAAe;IAqBhD;QAAA,YACI,iBAAO,SAEV;QAvBM,aAAO,GAAG,KAAK,CAAC;QAChB,UAAI,GAAG,KAAK,CAAC;QACb,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,kBAAY,GAAG,KAAK,CAAC;QACrB,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,6BAAC;AAAD,CAAC,CAzBoC,yEAAe,GAyBnD;AAED;IAAqC,yEAAY;IAyD7C,yBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAtBM,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,mBAAa,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGpC,mBAAa,GAAG,EAAE,CAAC;QAGlB,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;;IAQnC,CAAC;IAEM,2CAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,0CAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,6CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,2CAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,sBAAsB,EAAE,CAAC;SAC3D;QAED,IAAI,OAAO,GAA2B,OAAO,CAAC,gBAAgB,CAAC;QAC/D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,KAAK,CAAC,eAAe,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE;gBAChD,OAAO,KAAK,CAAC;aAChB;YAED,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YAExB,IAAI,uEAAa,CAAC,qBAAqB,EAAE;gBACrC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;oBAC1D,OAAO,KAAK,CAAC;iBAChB;gBACD,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;oBAC1D,OAAO,KAAK,CAAC;iBAChB;gBACD,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;oBAC1D,OAAO,KAAK,CAAC;iBAChB;gBAED,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;aAC1B;YAED,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,uEAAa,CAAC,kBAAkB,EAAE;gBACjG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;oBAC9B,OAAO,KAAK,CAAC;iBAChB;gBACD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;oBAC9B,OAAO,KAAK,CAAC;iBAChB;gBACD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;oBAC9B,OAAO,KAAK,CAAC;iBAChB;gBAED,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;gBAC5B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;aACvB;SACJ;QAED,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/I,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,SAAS,CAAC;YAC3B,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB;gBAC/G,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,eAAe;gBACf,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe;gBAC1E,eAAe,EAAE,eAAe,EAAE,eAAe;aACpD,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB;gBACrF,cAAc,EAAE,cAAc,EAAE,cAAc;aACjD,CAAC;YAEF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EAAE;aACzE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,wCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAA2B,OAAO,CAAC,gBAAgB,CAAC;QAC/D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBAClE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACzG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;gBAEnF,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBACrC,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;oBACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;wBACvB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACxE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;qBAC7G;iBACJ;gBAED,IAAI,uEAAa,CAAC,kBAAkB,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,mBAAmB,EAAE;oBACrF,IAAI,IAAI,CAAC,aAAa,EAAE;wBACpB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;qBACrE;oBACD,IAAI,IAAI,CAAC,aAAa,EAAE;wBACpB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;qBACrE;oBACD,IAAI,IAAI,CAAC,aAAa,EAAE;wBACpB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;qBACrE;iBACJ;aACJ;YACD,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1F;QAED,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,wCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACxF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,2CAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACzC;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC3C;QAED,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC3C;QAED,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC3C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,oCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE;YAC9B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,aAAa,KAAK,OAAO,EAAE;YAChC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,aAAa,KAAK,OAAO,EAAE;YAChC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,aAAa,KAAK,OAAO,EAAE;YAChC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,iCAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,+BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,eAAe,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAA1C,CAA0C,EAAE,IAAI,CAAC,CAAC;IAC7F,CAAC;IAEM,mCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,yBAAyB,CAAC;QAC3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,sCAAY,GAAnB;QACI,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IAED,UAAU;IACI,qBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAvC,CAAuC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5G,CAAC;IAtaD;QADC,oFAAkB,CAAC,YAAY,CAAC;wDACA;IAEjC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;uDACtB;IAG/B;QADC,oFAAkB,CAAC,iBAAiB,CAAC;6DACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;4DACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;6DACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;4DACrB;IAGhC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;6DACJ;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;4DACrB;IAGhC;QADC,oFAAkB,CAAC,cAAc,CAAC;0DACJ;IAE/B;QADC,kFAAgB,CAAC,kCAAkC,CAAC;yDACxB;IAG7B;QADC,oFAAkB,CAAC,cAAc,CAAC;0DACJ;IAE/B;QADC,kFAAgB,CAAC,kCAAkC,CAAC;yDACxB;IAG7B;QADC,oFAAkB,CAAC,cAAc,CAAC;0DACJ;IAE/B;QADC,kFAAgB,CAAC,kCAAkC,CAAC;yDACxB;IAG7B;QADC,mFAAiB,EAAE;yDACsB;IAG1C;QADC,mFAAiB,EAAE;0DACuB;IAG3C;QADC,2EAAS,EAAE;0DACc;IAG1B;QADC,2EAAS,CAAC,iBAAiB,CAAC;6DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;4DACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;mEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;kEACd;IAoXzC,sBAAC;CAAA,CAzaoC,sEAAY,GAyahD;AAza2B;AA2a5B,oEAAU,CAAC,eAAe,CAAC,yBAAyB,CAAC,GAAG,eAAe,CAAC;;;;;;;;;;;;;AC5dxE;AAAA;AAAA;AAAA;AAAoC;;;;;;;;;;;;;;;;;;;;;ACCgG;AAEhF;AAIgC;AACd;AACF;AACJ;AACE;AACX;AAIf;AACc;AAExB;AACF;AAE5B;IAAuC,kFAAe;IAyBlD;QAAA,YACI,iBAAO,SAEV;QA3BM,cAAQ,GAAG,KAAK,CAAC;QACjB,cAAQ,GAAG,KAAK,CAAC;QACjB,cAAQ,GAAG,KAAK,CAAC;QAEjB,WAAK,GAAG,KAAK,CAAC;QACd,WAAK,GAAG,KAAK,CAAC;QACd,WAAK,GAAG,KAAK,CAAC;QAEd,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,kBAAY,GAAG,KAAK,CAAC;QACrB,YAAM,GAAG,KAAK,CAAC;QACf,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAIrB,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,+BAAC;AAAD,CAAC,CA7BsC,yEAAe,GA6BrD;AAED;IAAuC,2EAAY;IA0D/C,2BAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SACrB;QAzBM,cAAQ,GAAW,CAAC,CAAC;QAGrB,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,mBAAa,GAAG,IAAI,gEAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAG1C,mBAAa,GAAG,EAAE,CAAC;QAGlB,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;;IAQnC,CAAC;IAEM,6CAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,4CAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,+CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;IACH,6CAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,wBAAwB,EAAE,CAAC;SAC7D;QAED,IAAI,OAAO,GAA6B,OAAO,CAAC,gBAAgB,CAAC;QACjE,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,uEAAa,CAAC,qBAAqB,EAAE;oBACrC,IAAI,QAAQ,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;oBAClF,IAAI,cAAc,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;oBAE1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACtC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;4BACb,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE;gCACxB,OAAO,KAAK,CAAC;6BAChB;iCAAM;gCACG,OAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;6BAC5C;yBACJ;qBACJ;iBACJ;gBACD,IAAI,uEAAa,CAAC,kBAAkB,EAAE;oBAClC,IAAI,QAAQ,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC/E,IAAI,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;oBAEjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACtC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;4BACb,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE;gCACxB,OAAO,KAAK,CAAC;6BAChB;iCAAM;gCACG,OAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;6BAC5C;yBACJ;qBACJ;iBACJ;aACJ;SACJ;QAED,QAAQ;QACR,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAExI,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/I,kDAAkD;QAClD,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,WAAW,CAAC;YAC7B,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB;gBAC/G,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa;gBACzD,UAAU;aACb,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB;gBACnE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB;aACvD,CAAC;YAEF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YAEH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EAAE;aACzE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAC5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,0CAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAA6B,OAAO,CAAC,gBAAgB,CAAC;QACjE,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEvD,IAAI,KAAK,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;YACpC,WAAW;YACX,IAAI,IAAI,CAAC,eAAe,EAAE;gBACtB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;aAC1E;YACD,IAAI,IAAI,CAAC,eAAe,EAAE;gBACtB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;aAC1E;YACD,IAAI,IAAI,CAAC,eAAe,EAAE;gBACtB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;aAC1E;YACD,IAAI,IAAI,CAAC,cAAc,EAAE;gBACrB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;aACxE;YACD,IAAI,IAAI,CAAC,cAAc,EAAE;gBACrB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;aACxE;YACD,IAAI,IAAI,CAAC,cAAc,EAAE;gBACrB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;aACxE;YACD,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1F;QAED,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEM,0CAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACxF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,6CAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,sCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,KAAK,OAAO,EAAE;YACnC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,eAAe,KAAK,OAAO,EAAE;YAClC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,eAAe,KAAK,OAAO,EAAE;YAClC,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,eAAe,KAAK,OAAO,EAAE;YAClC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,mCAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,iCAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,iBAAiB,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAA5C,CAA4C,EAAE,IAAI,CAAC,CAAC;IAC/F,CAAC;IAEM,qCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,2BAA2B,CAAC;QAC7D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,wCAAY,GAAnB;QACI,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,UAAU;IACI,uBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAzC,CAAyC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9G,CAAC;IArYD;QADC,oFAAkB,EAAE;yDACU;IAG/B;QADC,oFAAkB,CAAC,iBAAiB,CAAC;+DACA;IAEtC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;8DACjB;IAGpC;QADC,oFAAkB,CAAC,gBAAgB,CAAC;+DACC;IAEtC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;8DACjB;IAGpC;QADC,oFAAkB,CAAC,iBAAiB,CAAC;+DACA;IAEtC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;8DACjB;IAGpC;QADC,oFAAkB,CAAC,gBAAgB,CAAC;8DACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;6DAClB;IAGnC;QADC,oFAAkB,CAAC,gBAAgB,CAAC;8DACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;6DAClB;IAGnC;QADC,oFAAkB,CAAC,gBAAgB,CAAC;8DACA;IAErC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;6DAClB;IAGnC;QADC,2EAAS,EAAE;uDACgB;IAG5B;QADC,mFAAiB,EAAE;2DACsB;IAG1C;QADC,mFAAiB,EAAE;4DAC6B;IAGjD;QADC,2EAAS,EAAE;4DACc;IAG1B;QADC,2EAAS,CAAC,iBAAiB,CAAC;+DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;8DACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;qEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;oEACd;IAkVzC,wBAAC;CAAA,CAxYsC,sEAAY,GAwYlD;AAxY6B;AA0Y9B,oEAAU,CAAC,eAAe,CAAC,2BAA2B,CAAC,GAAG,iBAAiB,CAAC;;;;;;;;;;;;;AC/b5E;AAAA;AAAA;AAAA;AAAoD;AACM;AACS;AACL;AACI;AACC;AACI;AACN;AACL;AACL;AACC;AACF;AAEtD,IAAI,IAAI,GAAG,sBAAsB,CAAC;AAClC,IAAI,MAAM,GAAG,qnFAqHZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,oBAAoB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACvInD;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACJ;AACJ;AACI;AACN;AACI;AAExD,IAAI,IAAI,GAAG,uBAAuB,CAAC;AACnC,IAAI,MAAM,GAAG,0gEAwFZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,qBAAqB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;AC1GpD;AAAA;AAAA;AAAA;AAAgC;;;;;;;;;;;;;ACAhC;AAAA;AAAA;AAAA;AAAoD;AACM;AACW;AACF;AACA;AACL;AACI;AACC;AACI;AACT;AACG;AACL;AACJ;AACG;AACL;AAEtD,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,i/KAiMZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,gBAAgB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;ACtN/C;AAAA;AAAA;AAAA;AAAoD;AACO;AACI;AACM;AACN;AACI;AACL;AACA;AACJ;AACJ;AACI;AACN;AACI;AACC;AAEzD,IAAI,IAAI,GAAG,mBAAmB,CAAC;AAC/B,IAAI,MAAM,GAAG,w1FAuHZ,CAAC;AAEF,iEAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACnC,cAAc;AACP,IAAI,iBAAiB,GAAG,EAAE,IAAI,QAAE,MAAM,UAAE,CAAC;;;;;;;;;;;;;;;;;;;;;AC1IwG;AACjF;AACnB;AACD;AAEK;AACD;AAGgC;AACH;AACd;AACgE;AAClE;AACJ;AACE;AACX;AAGV;AAEL;AACc;AAE5B;AACF;AAExB;IAAmC,8EAAe;IAwC9C;QAAA,YACI,iBAAO,SAEV;QA1CM,UAAI,GAAG,KAAK,CAAC;QACb,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,gBAAU,GAAG,KAAK,CAAC;QACnB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,eAAS,GAAG,KAAK,CAAC;QAClB,SAAG,GAAG,KAAK,CAAC;QACZ,YAAM,GAAG,KAAK,CAAC;QACf,SAAG,GAAG,KAAK,CAAC;QACZ,SAAG,GAAG,KAAK,CAAC;QACZ,iBAAW,GAAG,KAAK,CAAC;QACpB,iBAAW,GAAG,KAAK,CAAC;QACpB,0BAAoB,GAAG,CAAC,CAAC;QACzB,kBAAY,GAAG,CAAC,CAAC;QACjB,eAAS,GAAG,KAAK,CAAC;QAClB,kBAAY,GAAG,KAAK,CAAC;QACrB,sBAAgB,GAAG,KAAK,CAAC;QACzB,qBAAe,GAAG,KAAK,CAAC;QACxB,qBAAe,GAAG,KAAK,CAAC;QACxB,2BAAqB,GAAG,KAAK,CAAC;QAE9B,qBAAe,GAAG,KAAK,CAAC;QACxB,cAAQ,GAAG,KAAK,CAAC;QACjB,+BAAyB,GAAG,KAAK,CAAC;QAClC,6BAAuB,GAAG,KAAK,CAAC;QAChC,iBAAW,GAAG,KAAK,CAAC;QACpB,sBAAgB,GAAG,KAAK,CAAC;QACzB,cAAQ,GAAG,KAAK,CAAC;QACjB,cAAQ,GAAG,KAAK,CAAC;QACjB,iBAAW,GAAG,KAAK,CAAC;QACpB,kBAAY,GAAG,KAAK,CAAC;QACrB,oBAAc,GAAG,KAAK,CAAC;QACvB,yBAAmB,GAAG,KAAK,CAAC;QAC5B,qBAAe,GAAG,KAAK,CAAC;QACxB,gCAA0B,GAAG,KAAK,CAAC;QAItC,KAAI,CAAC,OAAO,EAAE,CAAC;;IACnB,CAAC;IACL,2BAAC;AAAD,CAAC,CA5CkC,yEAAe,GA4CjD;AAED;IAAmC,uEAAY;IA4I3C;;MAEE;IACF,uBAAY,IAAY,EAAE,KAAY,EAAS,gBAAiD;QAAjD,0DAAgC,iEAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAAhG,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SAmBrB;QApB8C,sBAAgB,GAAhB,gBAAgB,CAAiC;QArIzF,kBAAY,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGnC,mBAAa,GAAG,IAAI,gEAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGpC,mBAAa,GAAG,EAAE,CAAC;QAGlB,sBAAgB,GAAG,KAAK,CAAC;QAKzB,4BAAsB,GAAG,CAAC,CAAC;QAInC;;UAEE;QAEK,eAAS,GAAW,CAAC,CAAC;QAC7B;;UAEE;QAEK,mBAAa,GAAY,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAChC;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAChC;;WAEG;QAEK,sBAAgB,GAAG,KAAK,CAAC;QAIjC;;WAEG;QAEK,sBAAgB,GAAG,KAAK,CAAC;QAIjC;;WAEG;QAEK,4BAAsB,GAAG,KAAK,CAAC;QAIvC;;UAEE;QAEK,gBAAU,GAAW,IAAI,gEAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACtD;;UAEE;QAEK,sBAAgB,GAAW,GAAG,CAAC;QACtC;;WAEG;QAEI,iBAAW,GAAW,IAAI,gEAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACvD;;WAEG;QAEI,uBAAiB,GAAW,GAAG,CAAC;QACvC;;UAEE;QAEK,gBAAU,GAAW,GAAG,CAAC;QAEhC;;UAEE;QAEK,eAAS,GAAW,GAAG,CAAC;QAC/B;;;WAGG;QAEI,sBAAgB,GAAY,KAAK,CAAC;QAE/B,oBAAc,GAAG,IAAI,oEAAU,CAAsB,EAAE,CAAC,CAAC;QAEnE;;UAEE;QACM,WAAK,GAA2B,IAAI,CAAC;QAKrC,0BAAoB,GAAW,gEAAM,CAAC,IAAI,EAAE,CAAC;QAC7C,eAAS,GAAW,CAAC,CAAC;QACtB,oBAAc,GAAW,CAAC,CAAC;QAwB/B,KAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAEnD,wBAAwB;QACxB,KAAI,CAAC,uBAAuB,GAAG;YAC3B,KAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;YAC5B,KAAI,CAAC,cAAc,CAAC,IAAI,CAAsB,KAAI,CAAC,cAAc,CAAC,CAAC;YACnE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAsB,KAAI,CAAC,cAAc,CAAC,CAAC;YAEnE,OAAO,KAAI,CAAC,cAAc,CAAC;QAC/B,CAAC,CAAC;QAEF,KAAI,CAAC,6BAA6B,GAAG,KAAI,CAAC,QAAQ,EAAE,CAAC,4BAA4B,CAAC;QAClF,IAAI,KAAI,CAAC,6BAA6B,EAAE;YACpC,KAAI,CAAC,wBAAwB,GAAG,KAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,GAAG,CAAC;gBACtF,KAAI,CAAC,uCAAuC,EAAE,CAAC;YACnD,CAAC,CAAC,CAAC;SACN;;IACL,CAAC;IA3BD,sBAAW,kDAAuB;QAHlC;;WAEG;aACH;YACI,OAAO,IAAI,CAAC;QAChB,CAAC;;;OAAA;IA4BD,sBAAW,8CAAmB;aAA9B;YACI,OAAO,IAAI,CAAC,oBAAoB,CAAC;QACrC,CAAC;aAED,UAA+B,KAAc;YACzC,IAAI,CAAC,oBAAoB,GAAG,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,sBAAsB,CAAC;YAClG,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACxC,CAAC;;;OALA;IAQD,sBAAW,4CAAiB;QAD5B,YAAY;aACZ;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAED,sBAAW,4CAAiB;aAA5B;YACI,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;;;OAAA;IAED,UAAU;IACH,uCAAe,GAAtB,UAAuB,IAAS;QAC5B,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;QAED,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;IACL,CAAC;IAEM,2CAAmB,GAA1B,UAA2B,MAAe;QACtC,IAAI,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;SACjD;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;SACjD;IACL,CAAC;IAEM,qCAAa,GAApB;QACI,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,CAAC;IAED,sBAAW,+CAAoB;aAA/B;YACI,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC;QAC3E,CAAC;;;OAAA;IAEM,yCAAiB,GAAxB;QACI,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,wCAAgB,GAAvB;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,2CAAmB,GAA1B;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,yCAAiB,GAAxB,UAAyB,IAAkB,EAAE,OAAgB,EAAE,YAAsB;QACjF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC5C,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,oBAAoB,EAAE,CAAC;SACzD;QAED,IAAI,OAAO,GAAyB,OAAO,CAAC,gBAAgB,CAAC;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE;YAC/C,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,EAAE;gBACxC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,IAAI,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE/B,WAAW;QACX,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC3B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YACzB,IAAI,KAAK,CAAC,eAAe,EAAE;gBACvB,IAAI,IAAI,CAAC,WAAW,IAAI,uEAAa,CAAC,kBAAkB,EAAE;oBACtD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE;wBAC7B,OAAO,KAAK,CAAC;qBAChB;yBAAM;wBACH,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACxB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;qBACvB;iBACJ;gBAED,IAAI,uEAAa,CAAC,wBAAwB,EAAE;oBACxC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;iBAC7B;aACJ;SACJ;QAED,wEAAc,CAAC,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtG,wEAAc,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAE5J,IAAI,OAAO,CAAC,aAAa,EAAE;YACvB,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;aAClC;YAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;aAClC;YAED,IAAI,IAAI,CAAC,sBAAsB,EAAE;gBAC7B,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;aACxC;SACJ;QAED,SAAS;QACT,OAAO,CAAC,YAAY,GAAG,wEAAc,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE9I,mBAAmB;QACnB,IAAI,OAAO,CAAC,wBAAwB,IAAI,IAAI,CAAC,6BAA6B,EAAE;YACxE,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,OAAO,EAAE,EAAE;gBAC/C,OAAO,KAAK,CAAC;aAChB;YAED,IAAI,CAAC,6BAA6B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAE3D,OAAO,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;YACtG,OAAO,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;SACzG;QAED,UAAU;QACV,wEAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,iBAAiB;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACvE;YAED,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;SAClC;QAED,qBAAqB;QACrB,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAE5B,YAAY;YACZ,IAAI,SAAS,GAAG,IAAI,yEAAe,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnC;YAED,IAAI,OAAO,CAAC,gBAAgB,EAAE;gBAC1B,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;aAChD;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEzF,IAAI,OAAO,CAAC,oBAAoB,GAAG,CAAC,EAAE;gBAClC,SAAS,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC7C;YAED,YAAY;YACZ,IAAI,OAAO,GAAG,CAAC,sEAAY,CAAC,YAAY,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,UAAU,CAAC,CAAC;aACzC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,MAAM,CAAC,CAAC;aACrC;YAED,IAAI,OAAO,CAAC,GAAG,EAAE;gBACb,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,sEAAY,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,wEAAc,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5E,wEAAc,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAE/D,uBAAuB;YACvB,IAAI,UAAU,GAAG,OAAO,CAAC;YACzB,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB;gBAC/G,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,cAAc;gBACd,QAAQ;gBACR,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc;gBACzE,0BAA0B;gBAE1B,QAAQ;gBACR,+BAA+B,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW;gBACnF,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW;aAClI,CAAC;YACF,IAAI,QAAQ,GAAG,CAAC,eAAe;gBAC3B,QAAQ;gBACR,mBAAmB,EAAE,mBAAmB;aAC3C,CAAC;YACF,IAAI,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;YAEzC,IAAI,sFAA4B,EAAE;gBAC9B,sFAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAChE,sFAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACnE;YAED,wEAAc,CAAC,8BAA8B,CAAwB;gBACjE,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;aACpD,CAAC,CAAC;YACH,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,UAAU,EAChC;gBACnB,UAAU,EAAE,OAAO;gBACnB,aAAa,EAAE,QAAQ;gBACvB,mBAAmB,EAAE,cAAc;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,SAAS;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,eAAe,EAAE,EAAE,qBAAqB,EAAE,IAAI,CAAC,sBAAsB,EAAE;aAC1E,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;SAE5B;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,sCAAc,GAArB,UAAsB,KAAa,EAAE,IAAU,EAAE,OAAgB;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE5B,IAAI,OAAO,GAAyB,OAAO,CAAC,gBAAgB,CAAC;QAC7D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO;SACV;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACxB,OAAO;SACV;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,WAAW;QACX,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAE3E,QAAQ;QACR,wEAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;YACjC,WAAW;YACX,IAAI,IAAI,CAAC,WAAW,IAAI,uEAAa,CAAC,kBAAkB,EAAE;gBACtD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBAEjE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACxG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;aACrF;YACD,aAAa;YACb,wEAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAExD,aAAa;YACb,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5D;YAED,wEAAc,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;QAE/F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1F;QAED,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC9C,wEAAc,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACnG;QAED,OAAO;QACP,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,+DAAK,CAAC,YAAY,EAAE;YAC3E,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM;QACN,wEAAc,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,aAAa;QACb,wEAAc,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAEhE,QAAQ;QACR,IAAI,uEAAa,CAAC,wBAAwB,EAAE;YACxC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACxE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;SAC3E;QAED,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAEjH,kEAAkE;QAClE,IAAI,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC;QACjD,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE;YACnC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;YAChC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC;SACzC;QAED,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACzE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzD,mBAAmB;QACnB,IAAI,IAAI,CAAC,6BAA6B,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,EAAE;YAC9F,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAEO,4CAAoB,GAA5B,UAA6B,KAAY,EAAE,gBAAyB;QAApE,iBAiFC;QAhFG,iBAAiB;QACjB,IAAI,CAAC,cAAc,GAAG,IAAI,6EAAmB,CAAC,IAAI,GAAG,aAAa,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACnJ,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEhD,IAAI,CAAC,cAAc,GAAG,IAAI,6EAAmB,CAAC,IAAI,GAAG,aAAa,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACnJ,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,mEAAS,CAAC,0BAA0B,CAAC;QACjE,IAAI,CAAC,cAAc,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEhD,IAAI,SAAkB,CAAC;QACvB,IAAI,SAAS,GAAoB,IAAI,CAAC;QACtC,IAAI,eAAuB,CAAC;QAC5B,IAAI,YAAY,GAAG,gEAAM,CAAC,IAAI,EAAE,CAAC;QAEjC,IAAI,CAAC,cAAc,CAAC,cAAc,GAAG;YACjC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBACjC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;aAChC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;gBAE5B,IAAI,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBACzD,KAAK,CAAC,SAAS,GAAG,+DAAK,CAAC,qBAAqB,CAAC,IAAI,iEAAO,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;aAC5G;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG;YAChC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aACpC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aAC/B;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,cAAc,GAAG;YACjC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBACjC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;aAChC;YAED,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,gBAAgB,EAAE;gBACxB,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;gBAE5B,IAAI,SAAS,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBACzD,KAAK,CAAC,SAAS,GAAG,+DAAK,CAAC,qBAAqB,CAAC,IAAI,iEAAO,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,iEAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAE1G,gEAAM,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;aACzD;YAED,YAAY;YACZ,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YAExC,YAAY,CAAC,aAAa,CAAC,eAAe,EAAE,KAAI,CAAC,oBAAoB,CAAC,CAAC;YACvE,KAAK,CAAC,kBAAkB,CAAC,KAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACjF,KAAK,CAAC,SAAS,EAAE,CAAC,aAAa,GAAG,KAAK,CAAC;YACxC,KAAK,CAAC,uBAAuB,GAAG,iEAAO,CAAC,oBAAoB,CAAU,KAAK,CAAC,YAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACtH,CAAC,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG;YAChC,IAAI,KAAI,CAAC,KAAK,EAAE;gBACZ,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;aACpC;YAED,aAAa;YACb,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;YAE5B,YAAY;YACZ,KAAK,CAAC,kBAAkB,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACvE,KAAK,CAAC,SAAS,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;YACvC,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC;QACzC,CAAC,CAAC;IACN,CAAC;IAEM,sCAAc,GAArB;QACI,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAClC;QACD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QACD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACpG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAEM,yCAAiB,GAAxB;QACI,IAAI,cAAc,GAAG,iBAAM,iBAAiB,WAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC1C;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,kCAAU,GAAjB,UAAkB,OAAoB;QAClC,IAAI,iBAAM,UAAU,YAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,YAAY,KAAK,OAAO,EAAE;YAC/B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,+BAAO,GAAd,UAAe,kBAA4B;QACvC,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;SAC9B;QAED,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAsB,IAAI,CAAC,cAAc,CAAC,CAAC;QAClG,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACxD;QACD,KAAK,GAAG,CAAC,CAAC,CAAC;QACX,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAsB,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9F,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SACxD;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QAED,mCAAmC;QACnC,IAAI,IAAI,CAAC,6BAA6B,IAAI,IAAI,CAAC,wBAAwB,EAAE;YACrE,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;SAC/F;QAED,iBAAM,OAAO,YAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAEM,6BAAK,GAAZ,UAAa,IAAY;QAAzB,iBAEC;QADG,OAAO,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,aAAa,CAAC,IAAI,EAAE,KAAI,CAAC,QAAQ,EAAE,CAAC,EAAxC,CAAwC,EAAE,IAAI,CAAC,CAAC;IAC3F,CAAC;IAEM,iCAAS,GAAhB;QACI,IAAI,mBAAmB,GAAG,6EAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9D,mBAAmB,CAAC,UAAU,GAAG,uBAAuB,CAAC;QAEzD,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;YACvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC5D,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC7E;SACJ;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,oCAAY,GAAnB;QACI,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,UAAU;IACI,mBAAK,GAAnB,UAAoB,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,IAAI,GAAG,GAAG,6EAAmB,CAAC,KAAK,CAAC,cAAM,WAAI,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAArC,CAAqC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACzG,GAAG,CAAC,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC;QAE3C,OAAO,GAAG,CAAC;IACf,CAAC;IAEa,+BAAiB,GAA/B,UAAgC,IAAY,EAAE,KAAY;QACtD,IAAI,IAAI,GAAG,8DAAI,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IAChB,CAAC;IAlrBD;QADC,oFAAkB,CAAC,aAAa,CAAC;uDACA;IAElC;QADC,kFAAgB,CAAC,kCAAkC,CAAC;sDACrB;IAGhC;QADC,mFAAiB,EAAE;uDACsB;IAG1C;QADC,mFAAiB,EAAE;wDACuB;IAG3C;QADC,2EAAS,EAAE;wDACc;IAG1B;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;0DACnB;IAGhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;iEACA;IAEnC;QADC,kFAAgB,CAAC,gCAAgC,CAAC;gEACd;IAMrC;QADC,2EAAS,EAAE;oDACiB;IAK7B;QADC,oFAAkB,EAAE;wDAC6B;IAKlD;QADC,2EAAS,EAAE;qDACoB;IAKhC;QADC,2EAAS,EAAE;qDACoB;IAKhC;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;0DACjB;IAMhC;QADC,2EAAS,CAAC,iBAAiB,CAAC;2DACI;IAEjC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;0DACjB;IAMhC;QADC,2EAAS,CAAC,uBAAuB,CAAC;iEACI;IAEvC;QADC,kFAAgB,CAAC,8BAA8B,CAAC;gEACX;IAMtC;QADC,mFAAiB,EAAE;qDACkC;IAKtD;QADC,2EAAS,EAAE;2DAC0B;IAKtC;QADC,mFAAiB,EAAE;sDACmC;IAKvD;QADC,2EAAS,EAAE;4DAC2B;IAKvC;QADC,2EAAS,EAAE;qDACoB;IAMhC;QADC,2EAAS,EAAE;oDACmB;IAM/B;QADC,2EAAS,EAAE;2DAC6B;IA0DzC;QADC,2EAAS,EAAE;4DAGX;IAghBL,oBAAC;CAAA,CAxrBkC,sEAAY,GAwrB9C;AAxrByB;AA0rB1B,oEAAU,CAAC,eAAe,CAAC,uBAAuB,CAAC,GAAG,aAAa,CAAC;;;;;;;;;;;;ACpwBpE,uE","file":"babylonjs.materials.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"babylonjs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"babylonjs-materials\", [\"babylonjs\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"babylonjs-materials\"] = factory(require(\"babylonjs\"));\n\telse\n\t\troot[\"MATERIALS\"] = factory(root[\"BABYLON\"]);\n})((typeof self !== \"undefined\" ? self : typeof global !== \"undefined\" ? global : this), function(__WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./legacy/legacy.ts\");\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'cellPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\nvoid main(void)\n{\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var cellPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'cellVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var cellVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\n\r\nimport \"./cell.fragment\";\r\nimport \"./cell.vertex\";\r\n\r\nclass CellMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public NDOTL = true;\r\n public CUSTOMUSERLIGHTING = true;\r\n public CELLBASIC = true;\r\n public DEPTHPREPASS = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class CellMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"computeHighLevel\")\r\n public _computeHighLevel: boolean = false;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public computeHighLevel: boolean;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new CellMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n defines.CELLBASIC = !this.computeHighLevel;\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"cell\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\"\r\n ];\r\n var samplers = [\"diffuseSampler\"];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights - 1 }\r\n }, engine), defines);\r\n\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.CellMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial {\r\n return SerializationHelper.Parse(() => new CellMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.CellMaterial\"] = CellMaterial;\r\n","export * from \"./cellMaterial\";","import { Texture } from \"babylonjs/Materials/Textures/texture\";\nimport { Effect } from \"babylonjs/Materials/effect\";\nimport { StandardMaterialDefines } from \"babylonjs/Materials/standardMaterial\";\nimport { StandardMaterial } from \"babylonjs/Materials/standardMaterial\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nexport class CustomShaderStructure {\n\n public FragmentStore: string;\n public VertexStore: string;\n\n constructor() { }\n}\n\nexport class ShaderSpecialParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n\n // diffuseColor\n public Fragment_Custom_Diffuse: string;\n // lights\n public Fragment_Before_Lights: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class CustomMaterial extends StandardMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderSpecialParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: any[];\n _newSamplerInstances: Texture[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh, effect: Effect) {\n for (var el in this._newUniformInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n for (var el in this._newSamplerInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines): string {\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n CustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + CustomMaterial.ShaderIndexer;\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"));\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderSpecialParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"defaultPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"defaultVertexShader\"];\n }\n\n public AddUniform(name: string, kind: string, param: any): CustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = new Array();\n this._newUniformInstances = new Array();\n }\n if (param) {\n if (kind.indexOf(\"sampler\") == -1) {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n else {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Diffuse = shaderPart.replace(\"result\", \"diffuseColor\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.CustomMaterial\"] = CustomMaterial;","export * from \"./customMaterial\";\nexport * from \"./pbrCustomMaterial\";","import { Texture } from \"babylonjs/Materials/Textures/texture\";\nimport { Effect } from \"babylonjs/Materials/effect\";\nimport { PBRMaterialDefines } from \"babylonjs/Materials/PBR/pbrBaseMaterial\";\nimport { PBRMaterial } from \"babylonjs/Materials/PBR/pbrMaterial\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nexport class ShaderAlebdoParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n\n // albedoColor\n public Fragment_Custom_Albedo: string;\n // lights\n public Fragment_Before_Lights: string;\n // roughness\n public Fragment_Custom_MetallicRoughness: string;\n // microsurface\n public Fragment_Custom_MicroSurface: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class PBRCustomMaterial extends PBRMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderAlebdoParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: any[];\n _newSamplerInstances: Texture[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh, effect: Effect) {\n for (var el in this._newUniformInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n for (var el in this._newSamplerInstances) {\n var ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\") {\n for (var ind in this._newUniforms) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines): string {\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n PBRCustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + PBRCustomMaterial.ShaderIndexer;\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALBEDO', (this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS', (this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE', (this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"));\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderAlebdoParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\n }\n\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = new Array();\n this._newUniformInstances = new Array();\n }\n if (param) {\n if (kind.indexOf(\"sampler\") == -1) {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n else {\n (this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.PBRCustomMaterial\"] = PBRCustomMaterial;","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'firePixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\nuniform sampler2D distortionSampler;\nuniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#include\n\n#include\nvec4 bx2(vec4 x)\n{\nreturn vec4(2.0)*x-vec4(1.0);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\n\nfloat alpha=1.0;\n#ifdef DIFFUSE\n\nconst float distortionAmount0=0.092;\nconst float distortionAmount1=0.092;\nconst float distortionAmount2=0.092;\nvec2 heightAttenuation=vec2(0.3,0.39);\nvec4 noise0=texture2D(distortionSampler,vDistortionCoords1);\nvec4 noise1=texture2D(distortionSampler,vDistortionCoords2);\nvec4 noise2=texture2D(distortionSampler,vDistortionCoords3);\nvec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;\nvec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);\nvec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;\nbaseColor*=opacityColor;\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=vec4(baseColor.rgb,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var firePixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\n\nlet name = 'fireVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n\nuniform float time;\nuniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#ifdef DIFFUSE\nvDiffuseUV=uv;\nvDiffuseUV.y-=0.2;\n#endif\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\n\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;\nvDistortionCoords1.x=uv.x;\nvDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;\nvDistortionCoords2.x=uv.x;\nvDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;\nvDistortionCoords3.x=uv.x;\nvDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var fireVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { Tags } from \"babylonjs/Misc/tags\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { EffectFallbacks } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\n\r\nimport \"./fire.fragment\";\r\nimport \"./fire.vertex\";\r\n\r\nclass FireMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public UV1 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public BonesPerMesh = 0;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FireMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: Nullable;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: Nullable;\r\n\r\n @serializeAsTexture(\"distortionTexture\")\r\n private _distortionTexture: Nullable;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public distortionTexture: Nullable;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: Nullable;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: Nullable;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public speed = 1.0;\r\n\r\n private _scaledDiffuse = new Color3();\r\n private _renderId: number;\r\n private _lastTime: number = 0;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new FireMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n\r\n defines.ALPHATEST = this._opacityTexture ? true : false;\r\n\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n defines.POINTSIZE = (this.pointsCloud || scene.forcePointsCloud);\r\n defines.FOG = (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE && this.fogEnabled);\r\n }\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"fire\";\r\n\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: [\"world\", \"view\", \"viewProjection\", \"vEyePosition\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\",\r\n // Fire\r\n \"time\", \"speed\"\r\n ],\r\n uniformBuffersNames: [],\r\n samplers: [\"diffuseSampler\",\r\n // Fire\r\n \"distortionSampler\", \"opacitySampler\"\r\n ],\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: null,\r\n maxSimultaneousLights: 4,\r\n transformFeedbackVaryings: null\r\n }, engine), defines);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n\r\n this._activeEffect.setTexture(\"distortionSampler\", this._distortionTexture);\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this._scaledDiffuse, this.alpha * mesh.visibility);\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n // Time\r\n this._lastTime += scene.getEngine().getDeltaTime();\r\n this._activeEffect.setFloat(\"time\", this._lastTime);\r\n\r\n // Speed\r\n this._activeEffect.setFloat(\"speed\", this.speed);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._distortionTexture && this._distortionTexture.animations && this._distortionTexture.animations.length > 0) {\r\n results.push(this._distortionTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._distortionTexture) {\r\n activeTextures.push(this._distortionTexture);\r\n }\r\n\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._distortionTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FireMaterial\";\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._distortionTexture) {\r\n this._distortionTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FireMaterial {\r\n return SerializationHelper.Clone(() => new FireMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n\r\n var serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FireMaterial\";\r\n serializationObject.diffuseColor = this.diffuseColor.asArray();\r\n serializationObject.speed = this.speed;\r\n\r\n if (this._diffuseTexture) {\r\n serializationObject._diffuseTexture = this._diffuseTexture.serialize();\r\n }\r\n\r\n if (this._distortionTexture) {\r\n serializationObject._distortionTexture = this._distortionTexture.serialize();\r\n }\r\n\r\n if (this._opacityTexture) {\r\n serializationObject._opacityTexture = this._opacityTexture.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FireMaterial {\r\n var material = new FireMaterial(source.name, scene);\r\n\r\n material.diffuseColor = Color3.FromArray(source.diffuseColor);\r\n material.speed = source.speed;\r\n\r\n material.alpha = source.alpha;\r\n\r\n material.id = source.id;\r\n\r\n Tags.AddTagsTo(material, source.tags);\r\n material.backFaceCulling = source.backFaceCulling;\r\n material.wireframe = source.wireframe;\r\n\r\n if (source._diffuseTexture) {\r\n material._diffuseTexture = Texture.Parse(source._diffuseTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._distortionTexture) {\r\n material._distortionTexture = Texture.Parse(source._distortionTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._opacityTexture) {\r\n material._opacityTexture = Texture.Parse(source._opacityTexture, scene, rootUrl);\r\n }\r\n\r\n if (source.checkReadyOnlyOnce) {\r\n material.checkReadyOnlyOnce = source.checkReadyOnlyOnce;\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.FireMaterial\"] = FireMaterial;","export * from \"./fireMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'furPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 furColor;\nuniform float furLength;\nvarying vec3 vPositionW;\nvarying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform float furOcclusion;\nuniform sampler2D furTexture;\nvarying vec2 vFurUV;\n#endif\n#include\n#include\n#include\n#include\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=furColor;\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\n\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));\nif (furTextureColor.a<=0.0 || furTextureColor.g[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;\nvec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var furPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'furVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\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\nuniform float furLength;\nuniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform vec3 furGravity;\nuniform float furTime;\nuniform float furSpacing;\nuniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n#include\n#include\n\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else\nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);\nvec3 tangent2=vec3(-normal.z,0,normal.x);\nr=Rand(tangent1*r);\nfloat J=(2.0+4.0*r);\nr=Rand(tangent2*r);\nfloat K=(2.0+2.0*r);\ntangent1=tangent1*J+tangent2*K;\ntangent1=normalize(tangent1);\nvec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\n\nvec3 forceDirection=vec3(0.0,0.0,0.0);\nforceDirection.x=sin(furTime+position.x*0.05)*0.2;\nforceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;\nforceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;\nvec3 displacement=vec3(0.0,0.0,0.0);\ndisplacement=furGravity+forceDirection;\nfloat displacementFactor=pow(furOffset,3.0);\nvec3 aNormal=normal;\naNormal.xyz+=displacement*displacementFactor;\nnewPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var furVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { Tags } from \"babylonjs/Misc/tags\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"babylonjs/Materials/Textures/dynamicTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./fur.fragment\";\r\nimport \"./fur.vertex\";\r\n\r\nclass FurMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public HEIGHTMAP = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public HIGHLEVEL = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FurMaterial extends PushMaterial {\r\n\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"heightTexture\")\r\n private _heightTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public heightTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public furLength: number = 1;\r\n\r\n @serialize()\r\n public furAngle: number = 0;\r\n\r\n @serializeAsColor3()\r\n public furColor = new Color3(0.44, 0.21, 0.02);\r\n\r\n @serialize()\r\n public furOffset: number = 0.0;\r\n\r\n @serialize()\r\n public furSpacing: number = 12;\r\n\r\n @serializeAsVector3()\r\n public furGravity = new Vector3(0, 0, 0);\r\n\r\n @serialize()\r\n public furSpeed: number = 100;\r\n\r\n @serialize()\r\n public furDensity: number = 20;\r\n\r\n @serialize()\r\n public furOcclusion: number = 0.0;\r\n\r\n public furTexture: DynamicTexture;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n @serialize()\r\n public highLevelFur: boolean = true;\r\n\r\n public _meshes: AbstractMesh[];\r\n\r\n private _renderId: number;\r\n\r\n private _furTime: number = 0;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n @serialize()\r\n public get furTime() {\r\n return this._furTime;\r\n }\r\n\r\n public set furTime(furTime: number) {\r\n this._furTime = furTime;\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n public updateFur(): void {\r\n for (var i = 1; i < this._meshes.length; i++) {\r\n var offsetFur = this._meshes[i].material;\r\n\r\n offsetFur.furLength = this.furLength;\r\n offsetFur.furAngle = this.furAngle;\r\n offsetFur.furGravity = this.furGravity;\r\n offsetFur.furSpacing = this.furSpacing;\r\n offsetFur.furSpeed = this.furSpeed;\r\n offsetFur.furColor = this.furColor;\r\n offsetFur.diffuseTexture = this.diffuseTexture;\r\n offsetFur.furTexture = this.furTexture;\r\n offsetFur.highLevelFur = this.highLevelFur;\r\n offsetFur.furTime = this.furTime;\r\n offsetFur.furDensity = this.furDensity;\r\n }\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new FurMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n if (this.heightTexture && engine.getCaps().maxVertexTextureImageUnits) {\r\n if (!this.heightTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.HEIGHTMAP = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n if (this.highLevelFur !== defines.HIGHLEVEL) {\r\n defines.HIGHLEVEL = true;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"fur\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\",\r\n \"furLength\", \"furAngle\", \"furColor\", \"furOffset\", \"furGravity\", \"furTime\", \"furSpacing\", \"furDensity\", \"furOcclusion\"\r\n ];\r\n var samplers = [\"diffuseSampler\",\r\n \"heightTexture\", \"furTexture\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (scene.getCachedMaterial() !== this) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n if (this._heightTexture) {\r\n this._activeEffect.setTexture(\"heightTexture\", this._heightTexture);\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setFloat(\"furLength\", this.furLength);\r\n this._activeEffect.setFloat(\"furAngle\", this.furAngle);\r\n this._activeEffect.setColor4(\"furColor\", this.furColor, 1.0);\r\n\r\n if (this.highLevelFur) {\r\n this._activeEffect.setVector3(\"furGravity\", this.furGravity);\r\n this._activeEffect.setFloat(\"furOffset\", this.furOffset);\r\n this._activeEffect.setFloat(\"furSpacing\", this.furSpacing);\r\n this._activeEffect.setFloat(\"furDensity\", this.furDensity);\r\n this._activeEffect.setFloat(\"furOcclusion\", this.furOcclusion);\r\n\r\n this._furTime += this.getScene().getEngine().getDeltaTime() / this.furSpeed;\r\n this._activeEffect.setFloat(\"furTime\", this._furTime);\r\n\r\n this._activeEffect.setTexture(\"furTexture\", this.furTexture);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n if (this.heightTexture && this.heightTexture.animations && this.heightTexture.animations.length > 0) {\r\n results.push(this.heightTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._heightTexture) {\r\n activeTextures.push(this._heightTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._heightTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n if (this._meshes) {\r\n for (var i = 1; i < this._meshes.length; i++) {\r\n let mat = this._meshes[i].material;\r\n\r\n if (mat) {\r\n mat.dispose(forceDisposeEffect);\r\n }\r\n this._meshes[i].dispose();\r\n }\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FurMaterial {\r\n return SerializationHelper.Clone(() => new FurMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.FurMaterial\";\r\n\r\n if (this._meshes) {\r\n serializationObject.sourceMeshName = this._meshes[0].name;\r\n serializationObject.quality = this._meshes.length;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FurMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial {\r\n var material = SerializationHelper.Parse(() => new FurMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.sourceMeshName && material.highLevelFur) {\r\n scene.executeWhenReady(() => {\r\n var sourceMesh = scene.getMeshByName(source.sourceMeshName);\r\n if (sourceMesh) {\r\n var furTexture = FurMaterial.GenerateTexture(\"Fur Texture\", scene);\r\n material.furTexture = furTexture;\r\n FurMaterial.FurifyMesh(sourceMesh, source.quality);\r\n }\r\n });\r\n }\r\n\r\n return material;\r\n }\r\n\r\n public static GenerateTexture(name: string, scene: Scene): DynamicTexture {\r\n // Generate fur textures\r\n var texture = new DynamicTexture(\"FurTexture \" + name, 256, scene, true);\r\n var context = texture.getContext();\r\n\r\n for (var i = 0; i < 20000; ++i) {\r\n context.fillStyle = \"rgba(255, \" + Math.floor(Math.random() * 255) + \", \" + Math.floor(Math.random() * 255) + \", 1)\";\r\n context.fillRect((Math.random() * texture.getSize().width), (Math.random() * texture.getSize().height), 2, 2);\r\n }\r\n\r\n texture.update(false);\r\n texture.wrapU = Texture.WRAP_ADDRESSMODE;\r\n texture.wrapV = Texture.WRAP_ADDRESSMODE;\r\n\r\n return texture;\r\n }\r\n\r\n // Creates and returns an array of meshes used as shells for the Fur Material\r\n // that can be disposed later in your code\r\n // The quality is in interval [0, 100]\r\n public static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[] {\r\n var meshes = [sourceMesh];\r\n var mat: FurMaterial = sourceMesh.material;\r\n var i;\r\n\r\n if (!(mat instanceof FurMaterial)) {\r\n throw \"The material of the source mesh must be a Fur Material\";\r\n }\r\n\r\n for (i = 1; i < quality; i++) {\r\n var offsetFur = new FurMaterial(mat.name + i, sourceMesh.getScene());\r\n sourceMesh.getScene().materials.pop();\r\n Tags.EnableFor(offsetFur);\r\n Tags.AddTagsTo(offsetFur, \"furShellMaterial\");\r\n\r\n offsetFur.furLength = mat.furLength;\r\n offsetFur.furAngle = mat.furAngle;\r\n offsetFur.furGravity = mat.furGravity;\r\n offsetFur.furSpacing = mat.furSpacing;\r\n offsetFur.furSpeed = mat.furSpeed;\r\n offsetFur.furColor = mat.furColor;\r\n offsetFur.diffuseTexture = mat.diffuseTexture;\r\n offsetFur.furOffset = i / quality;\r\n offsetFur.furTexture = mat.furTexture;\r\n offsetFur.highLevelFur = mat.highLevelFur;\r\n offsetFur.furTime = mat.furTime;\r\n offsetFur.furDensity = mat.furDensity;\r\n\r\n var offsetMesh = sourceMesh.clone(sourceMesh.name + i) as Mesh;\r\n\r\n offsetMesh.material = offsetFur;\r\n offsetMesh.skeleton = sourceMesh.skeleton;\r\n offsetMesh.position = Vector3.Zero();\r\n meshes.push(offsetMesh);\r\n }\r\n\r\n for (i = 1; i < meshes.length; i++) {\r\n meshes[i].parent = sourceMesh;\r\n }\r\n\r\n (sourceMesh.material)._meshes = meshes;\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.FurMaterial\"] = FurMaterial;","export * from \"./furMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'gradientPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\n\nuniform vec4 topColor;\nuniform vec4 bottomColor;\nuniform float offset;\nuniform float scale;\nuniform float smoothness;\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\nfloat h=vPosition.y*scale+offset;\nfloat mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));\nvec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));\n\nvec3 diffuseColor=baseColor.rgb;\n\nfloat alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef EMISSIVE\nvec3 diffuseBase=baseColor.rgb;\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);\n#endif\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gradientPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'gradientVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\nvPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gradientVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { EffectCreationOptions, EffectFallbacks } from \"babylonjs/Materials/effect\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./gradient.fragment\";\r\nimport \"./gradient.vertex\";\r\n\r\nclass GradientMaterialDefines extends MaterialDefines {\r\n public EMISSIVE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class GradientMaterial extends PushMaterial {\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n // The gradient top color, red by default\r\n @serializeAsColor3()\r\n public topColor = new Color3(1, 0, 0);\r\n\r\n @serialize()\r\n public topColorAlpha = 1.0;\r\n\r\n // The gradient top color, blue by default\r\n @serializeAsColor3()\r\n public bottomColor = new Color3(0, 0, 1);\r\n\r\n @serialize()\r\n public bottomColorAlpha = 1.0;\r\n\r\n // Gradient offset\r\n @serialize()\r\n public offset = 0;\r\n\r\n @serialize()\r\n public scale = 1.0;\r\n\r\n @serialize()\r\n public smoothness = 1.0;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0 || this.topColorAlpha < 1.0 || this.bottomColorAlpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new GradientMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n defines.EMISSIVE = this._disableLighting;\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"gradient\";\r\n var join = defines.toString();\r\n\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\",\r\n \"topColor\", \"bottomColor\", \"offset\", \"smoothness\", \"scale\"\r\n ];\r\n var samplers: string[] = [];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, effect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(effect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setColor4(\"topColor\", this.topColor, this.topColorAlpha);\r\n this._activeEffect.setColor4(\"bottomColor\", this.bottomColor, this.bottomColorAlpha);\r\n this._activeEffect.setFloat(\"offset\", this.offset);\r\n this._activeEffect.setFloat(\"scale\", this.scale);\r\n this._activeEffect.setFloat(\"smoothness\", this.smoothness);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): GradientMaterial {\r\n return SerializationHelper.Clone(() => new GradientMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GradientMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"GradientMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial {\r\n return SerializationHelper.Parse(() => new GradientMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.GradientMaterial\"] = GradientMaterial;","export * from \"./gradientMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'gridPixelShader';\nlet shader = `#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;\nuniform vec3 mainColor;\nuniform vec3 lineColor;\nuniform vec4 gridControl;\nuniform vec3 gridOffset;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\nfloat getVisibility(float position) {\n\nfloat majorGridFrequency=gridControl.y;\nif (floor(position+0.5) == floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{\nreturn 1.0;\n}\nreturn gridControl.z;\n}\nfloat getAnisotropicAttenuation(float differentialLength) {\nconst float maxNumberOfLines=10.0;\nreturn clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);\n}\nfloat isPointOnLine(float position,float differentialLength) {\nfloat fractionPartOfPosition=position-floor(position+0.5);\nfractionPartOfPosition/=differentialLength;\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);\nfloat result=0.5+0.5*cos(fractionPartOfPosition*PI);\nreturn result;\n}\nfloat contributionOnAxis(float position) {\nfloat differentialLength=length(vec2(dFdx(position),dFdy(position)));\ndifferentialLength*=SQRT2;\n\nfloat result=isPointOnLine(position,differentialLength);\n\nfloat visibility=getVisibility(position);\nresult*=visibility;\n\nfloat anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);\nresult*=anisotropicAttenuation;\nreturn result;\n}\nfloat normalImpactOnAxis(float x) {\nfloat normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);\nreturn normalImpact;\n}\nvoid main(void) {\n\nfloat gridRatio=gridControl.x;\nvec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;\n\nfloat x=contributionOnAxis(gridPos.x);\nfloat y=contributionOnAxis(gridPos.y);\nfloat z=contributionOnAxis(gridPos.z);\n\nvec3 normal=normalize(vNormal);\nx*=normalImpactOnAxis(normal.x);\ny*=normalImpactOnAxis(normal.y);\nz*=normalImpactOnAxis(normal.z);\n\nfloat grid=clamp(x+y+z,0.,1.);\n\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\n\ngl_FragColor=vec4(color.rgb,opacity);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gridPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\n\nlet name = 'gridVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\nvoid main(void) {\n#include\n#ifdef FOG\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#endif\n#include\nvec4 cameraSpacePosition=view*finalWorld*vec4(position,1.0);\ngl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\nvPosition=position;\nvNormal=normal;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var gridVertexShader = { name, shader };\n","import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix, Vector4, Vector3 } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./grid.fragment\";\r\nimport \"./grid.vertex\";\r\n\r\nclass GridMaterialDefines extends MaterialDefines {\r\n public OPACITY = false;\r\n public TRANSPARENT = false;\r\n public FOG = false;\r\n public PREMULTIPLYALPHA = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * The grid materials allows you to wrap any shape with a grid.\r\n * Colors are customizable.\r\n */\r\nexport class GridMaterial extends PushMaterial {\r\n\r\n /**\r\n * Main color of the grid (e.g. between lines)\r\n */\r\n @serializeAsColor3()\r\n public mainColor = Color3.Black();\r\n\r\n /**\r\n * Color of the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public lineColor = Color3.Teal();\r\n\r\n /**\r\n * The scale of the grid compared to unit.\r\n */\r\n @serialize()\r\n public gridRatio = 1.0;\r\n\r\n /**\r\n * Allows setting an offset for the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public gridOffset = Vector3.Zero();\r\n\r\n /**\r\n * The frequency of thicker lines.\r\n */\r\n @serialize()\r\n public majorUnitFrequency = 10;\r\n\r\n /**\r\n * The visibility of minor units in the grid.\r\n */\r\n @serialize()\r\n public minorUnitVisibility = 0.33;\r\n\r\n /**\r\n * The grid opacity outside of the lines.\r\n */\r\n @serialize()\r\n public opacity = 1.0;\r\n\r\n /**\r\n * Determine RBG output is premultiplied by alpha value.\r\n */\r\n @serialize()\r\n public preMultiplyAlpha = false;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: BaseTexture;\r\n\r\n private _gridControl: Vector4 = new Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity);\r\n\r\n private _renderId: number;\r\n\r\n /**\r\n * constructor\r\n * @param name The name given to the material in order to identify it afterwards.\r\n * @param scene The scene the material is used in.\r\n */\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * Returns wehter or not the grid requires alpha blending.\r\n */\r\n public needAlphaBlending(): boolean {\r\n return this.opacity < 1.0 || this._opacityTexture && this._opacityTexture.isReady();\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending();\r\n }\r\n\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new GridMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n if (defines.TRANSPARENT !== (this.opacity < 1.0)) {\r\n defines.TRANSPARENT = !defines.TRANSPARENT;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.PREMULTIPLYALPHA != this.preMultiplyAlpha) {\r\n defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.OPACITY = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, false, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, scene.getEngine(), defines, !!useInstances);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Attributes\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, false);\r\n var attribs = [VertexBuffer.PositionKind, VertexBuffer.NormalKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Defines\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(\"grid\",\r\n attribs,\r\n [\"projection\", \"mainColor\", \"lineColor\", \"gridControl\", \"gridOffset\", \"vFogInfos\", \"vFogColor\", \"world\", \"view\",\r\n \"opacityMatrix\", \"vOpacityInfos\"],\r\n [\"opacitySampler\"],\r\n join,\r\n undefined,\r\n this.onCompiled,\r\n this.onError), defines);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n if (!defines.INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n this._activeEffect.setMatrix(\"projection\", scene.getProjectionMatrix());\r\n\r\n // Uniforms\r\n if (this._mustRebind(scene, effect)) {\r\n this._activeEffect.setColor3(\"mainColor\", this.mainColor);\r\n this._activeEffect.setColor3(\"lineColor\", this.lineColor);\r\n\r\n this._activeEffect.setVector3(\"gridOffset\", this.gridOffset);\r\n\r\n this._gridControl.x = this.gridRatio;\r\n this._gridControl.y = Math.round(this.majorUnitFrequency);\r\n this._gridControl.z = this.minorUnitVisibility;\r\n this._gridControl.w = this.opacity;\r\n this._activeEffect.setVector4(\"gridControl\", this._gridControl);\r\n\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n this._activeEffect.setFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n this._activeEffect.setMatrix(\"opacityMatrix\", this._opacityTexture.getTextureMatrix());\r\n }\r\n }\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n /**\r\n * Dispose the material and its associated resources.\r\n * @param forceDisposeEffect will also dispose the used effect when true\r\n */\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): GridMaterial {\r\n return SerializationHelper.Clone(() => new GridMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.GridMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"GridMaterial\";\r\n }\r\n\r\n public static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {\r\n return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.GridMaterial\"] = GridMaterial;","export * from \"./gridMaterial\";","export * from \"./cell\";\r\nexport * from \"./custom\";\r\nexport * from \"./fire\";\r\nexport * from \"./fur\";\r\nexport * from \"./gradient\";\r\nexport * from \"./grid\";\r\nexport * from \"./lava\";\r\nexport * from \"./mix\";\r\nexport * from \"./normal\";\r\nexport * from \"./shadowOnly\";\r\nexport * from \"./simple\";\r\nexport * from \"./sky\";\r\nexport * from \"./terrain\";\r\nexport * from \"./triPlanar\";\r\nexport * from \"./water\";","export * from \"./lavaMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'lavaPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n\nuniform float time;\nuniform float speed;\nuniform float movingSpeed;\nuniform vec3 fogColor;\nuniform sampler2D noiseTexture;\nuniform float fogDensity;\n\nvarying float noise;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nfloat random( vec3 scale,float seed ){\nreturn fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;\n}\nvoid main(void) {\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#ifdef DIFFUSE\n\nvec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );\nvec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time*0.02;\nvec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;\nT1.x+=noiseTex.x*2.0;\nT1.y+=noiseTex.y*2.0;\nT2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;\nT2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;\nfloat p=texture2D( noiseTexture,T1*3.0 ).a;\nvec4 lavaColor=texture2D( diffuseSampler,T2*4.0);\nvec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );\nbaseColor=temp;\nfloat depth=gl_FragCoord.z*4.0;\nconst float LOG2=1.442695;\nfloat fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );\nfogFactor=1.0-clamp( fogFactor,0.0,1.0 );\nbaseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );\ndiffuseColor=baseColor.rgb;\n\n\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var lavaPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'lavaVertexShader';\nlet shader = `precision highp float;\n\nuniform float time;\nuniform float lowFrequencySpeed;\n\nvarying float noise;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n\n\n\nvec3 mod289(vec3 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 mod289(vec4 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 permute(vec4 x)\n{\nreturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\nreturn 1.79284291400159-0.85373472095314*r;\n}\nvec3 fade(vec3 t) {\nreturn t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\nfloat pnoise(vec3 P,vec3 rep)\n{\nvec3 Pi0=mod(floor(P),rep);\nvec3 Pi1=mod(Pi0+vec3(1.0),rep);\nPi0=mod289(Pi0);\nPi1=mod289(Pi1);\nvec3 Pf0=fract(P);\nvec3 Pf1=Pf0-vec3(1.0);\nvec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);\nvec4 iy=vec4(Pi0.yy,Pi1.yy);\nvec4 iz0=Pi0.zzzz;\nvec4 iz1=Pi1.zzzz;\nvec4 ixy=permute(permute(ix)+iy);\nvec4 ixy0=permute(ixy+iz0);\nvec4 ixy1=permute(ixy+iz1);\nvec4 gx0=ixy0*(1.0/7.0);\nvec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;\ngx0=fract(gx0);\nvec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);\nvec4 sz0=step(gz0,vec4(0.0));\ngx0-=sz0*(step(0.0,gx0)-0.5);\ngy0-=sz0*(step(0.0,gy0)-0.5);\nvec4 gx1=ixy1*(1.0/7.0);\nvec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;\ngx1=fract(gx1);\nvec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);\nvec4 sz1=step(gz1,vec4(0.0));\ngx1-=sz1*(step(0.0,gx1)-0.5);\ngy1-=sz1*(step(0.0,gy1)-0.5);\nvec3 g000=vec3(gx0.x,gy0.x,gz0.x);\nvec3 g100=vec3(gx0.y,gy0.y,gz0.y);\nvec3 g010=vec3(gx0.z,gy0.z,gz0.z);\nvec3 g110=vec3(gx0.w,gy0.w,gz0.w);\nvec3 g001=vec3(gx1.x,gy1.x,gz1.x);\nvec3 g101=vec3(gx1.y,gy1.y,gz1.y);\nvec3 g011=vec3(gx1.z,gy1.z,gz1.z);\nvec3 g111=vec3(gx1.w,gy1.w,gz1.w);\nvec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));\ng000*=norm0.x;\ng010*=norm0.y;\ng100*=norm0.z;\ng110*=norm0.w;\nvec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));\ng001*=norm1.x;\ng011*=norm1.y;\ng101*=norm1.z;\ng111*=norm1.w;\nfloat n000=dot(g000,Pf0);\nfloat n100=dot(g100,vec3(Pf1.x,Pf0.yz));\nfloat n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));\nfloat n110=dot(g110,vec3(Pf1.xy,Pf0.z));\nfloat n001=dot(g001,vec3(Pf0.xy,Pf1.z));\nfloat n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));\nfloat n011=dot(g011,vec3(Pf0.x,Pf1.yz));\nfloat n111=dot(g111,Pf1);\nvec3 fade_xyz=fade(Pf0);\nvec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);\nvec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);\nfloat n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);\nreturn 2.2*n_xyz;\n}\n\nfloat turbulence( vec3 p ) {\nfloat w=100.0;\nfloat t=-.5;\nfor (float f=1.0 ; f<=10.0 ; f++ ){\nfloat power=pow( 2.0,f );\nt+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );\n}\nreturn t;\n}\nvoid main(void) {\n#include\n#include\n#ifdef NORMAL\n\nnoise=10.0*-.10*turbulence( .5*normal+time*1.15 );\n\nfloat b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );\n\nfloat displacement =-1.5*noise+b;\n\nvec3 newPosition=position+normal*displacement;\ngl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var lavaVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\nimport { Color3 } from \"babylonjs/Maths/math.color\";\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nimport \"./lava.fragment\";\nimport \"./lava.vertex\";\n\nclass LavaMaterialDefines extends MaterialDefines {\n public DIFFUSE = false;\n public CLIPPLANE = false;\n public CLIPPLANE2 = false;\n public CLIPPLANE3 = false;\n public CLIPPLANE4 = false;\n public ALPHATEST = false;\n public DEPTHPREPASS = false;\n public POINTSIZE = false;\n public FOG = false;\n public LIGHT0 = false;\n public LIGHT1 = false;\n public LIGHT2 = false;\n public LIGHT3 = false;\n public SPOTLIGHT0 = false;\n public SPOTLIGHT1 = false;\n public SPOTLIGHT2 = false;\n public SPOTLIGHT3 = false;\n public HEMILIGHT0 = false;\n public HEMILIGHT1 = false;\n public HEMILIGHT2 = false;\n public HEMILIGHT3 = false;\n public DIRLIGHT0 = false;\n public DIRLIGHT1 = false;\n public DIRLIGHT2 = false;\n public DIRLIGHT3 = false;\n public POINTLIGHT0 = false;\n public POINTLIGHT1 = false;\n public POINTLIGHT2 = false;\n public POINTLIGHT3 = false;\n public SHADOW0 = false;\n public SHADOW1 = false;\n public SHADOW2 = false;\n public SHADOW3 = false;\n public SHADOWS = false;\n public SHADOWESM0 = false;\n public SHADOWESM1 = false;\n public SHADOWESM2 = false;\n public SHADOWESM3 = false;\n public SHADOWPOISSON0 = false;\n public SHADOWPOISSON1 = false;\n public SHADOWPOISSON2 = false;\n public SHADOWPOISSON3 = false;\n public SHADOWPCF0 = false;\n public SHADOWPCF1 = false;\n public SHADOWPCF2 = false;\n public SHADOWPCF3 = false;\n public SHADOWPCSS0 = false;\n public SHADOWPCSS1 = false;\n public SHADOWPCSS2 = false;\n public SHADOWPCSS3 = false;\n public NORMAL = false;\n public UV1 = false;\n public UV2 = false;\n public VERTEXCOLOR = false;\n public VERTEXALPHA = false;\n public NUM_BONE_INFLUENCERS = 0;\n public BonesPerMesh = 0;\n public INSTANCES = false;\n public UNLIT = false;\n\n constructor() {\n super();\n this.rebuild();\n }\n}\n\nexport class LavaMaterial extends PushMaterial {\n @serializeAsTexture(\"diffuseTexture\")\n private _diffuseTexture: BaseTexture;\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n public diffuseTexture: BaseTexture;\n\n @serializeAsTexture()\n public noiseTexture: BaseTexture;\n\n @serializeAsColor3()\n public fogColor: Color3;\n\n @serialize()\n public speed: number = 1;\n\n @serialize()\n public movingSpeed: number = 1;\n\n @serialize()\n public lowFrequencySpeed: number = 1;\n\n @serialize()\n public fogDensity: number = 0.15;\n\n private _lastTime: number = 0;\n\n @serializeAsColor3()\n public diffuseColor = new Color3(1, 1, 1);\n\n @serialize(\"disableLighting\")\n private _disableLighting = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public disableLighting: boolean;\n\n @serialize(\"unlit\")\n private _unlit = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public unlit: boolean;\n\n @serialize(\"maxSimultaneousLights\")\n private _maxSimultaneousLights = 4;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public maxSimultaneousLights: number;\n\n private _scaledDiffuse = new Color3();\n private _renderId: number;\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n }\n\n public needAlphaBlending(): boolean {\n return (this.alpha < 1.0);\n }\n\n public needAlphaTesting(): boolean {\n return false;\n }\n\n public getAlphaTestTexture(): Nullable {\n return null;\n }\n\n // Methods\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\n if (this.isFrozen) {\n if (this._wasPreviouslyReady && subMesh.effect) {\n return true;\n }\n }\n\n if (!subMesh._materialDefines) {\n subMesh._materialDefines = new LavaMaterialDefines();\n }\n\n var defines = subMesh._materialDefines;\n var scene = this.getScene();\n\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\n if (this._renderId === scene.getRenderId()) {\n return true;\n }\n }\n\n var engine = scene.getEngine();\n\n // Textures\n if (defines._areTexturesDirty) {\n defines._needUVs = false;\n if (scene.texturesEnabled) {\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\n if (!this._diffuseTexture.isReady()) {\n return false;\n } else {\n defines._needUVs = true;\n defines.DIFFUSE = true;\n }\n }\n }\n }\n\n // Misc.\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\n\n // Lights\n defines._needNormals = true;\n\n MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\n\n // Values that need to be evaluated on every frame\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\n\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\n\n // Get correct effect\n if (defines.isDirty) {\n defines.markAsProcessed();\n scene.resetCachedMaterial();\n\n // Fallbacks\n var fallbacks = new EffectFallbacks();\n if (defines.FOG) {\n fallbacks.addFallback(1, \"FOG\");\n }\n\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks);\n\n if (defines.NUM_BONE_INFLUENCERS > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n\n //Attributes\n var attribs = [VertexBuffer.PositionKind];\n\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n\n if (defines.UV1) {\n attribs.push(VertexBuffer.UVKind);\n }\n\n if (defines.UV2) {\n attribs.push(VertexBuffer.UV2Kind);\n }\n\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n\n // Legacy browser patch\n var shaderName = \"lava\";\n var join = defines.toString();\n\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\n \"vDiffuseInfos\",\n \"mBones\",\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\",\n \"time\", \"speed\", \"movingSpeed\",\n \"fogColor\", \"fogDensity\", \"lowFrequencySpeed\"\n ];\n\n var samplers = [\"diffuseSampler\",\n \"noiseTexture\"\n ];\n var uniformBuffers = new Array();\n\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this.maxSimultaneousLights\n });\n\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\n {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\n }, engine), defines);\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n\n this._renderId = scene.getRenderId();\n this._wasPreviouslyReady = true;\n\n return true;\n }\n\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\n var scene = this.getScene();\n\n var defines = subMesh._materialDefines;\n if (!defines) {\n return;\n }\n\n var effect = subMesh.effect;\n\n if (!effect) {\n return;\n }\n this._activeEffect = effect;\n\n defines.UNLIT = this._unlit;\n\n // Matrices\n this.bindOnlyWorldMatrix(world);\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n\n // Bones\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\n\n if (this._mustRebind(scene, effect)) {\n // Textures\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\n\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\n }\n\n if (this.noiseTexture) {\n this._activeEffect.setTexture(\"noiseTexture\", this.noiseTexture);\n }\n\n // Clip plane\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\n\n // Point size\n if (this.pointsCloud) {\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\n }\n\n MaterialHelper.BindEyePosition(effect, scene);\n }\n\n this._activeEffect.setColor4(\"vDiffuseColor\", this._scaledDiffuse, this.alpha * mesh.visibility);\n\n if (scene.lightsEnabled && !this.disableLighting) {\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines);\n }\n\n // View\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\n }\n\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\n\n this._lastTime += scene.getEngine().getDeltaTime();\n this._activeEffect.setFloat(\"time\", this._lastTime * this.speed / 1000);\n\n if (!this.fogColor) {\n this.fogColor = Color3.Black();\n }\n this._activeEffect.setColor3(\"fogColor\", this.fogColor);\n this._activeEffect.setFloat(\"fogDensity\", this.fogDensity);\n\n this._activeEffect.setFloat(\"lowFrequencySpeed\", this.lowFrequencySpeed);\n this._activeEffect.setFloat(\"movingSpeed\", this.movingSpeed);\n\n this._afterBind(mesh, this._activeEffect);\n }\n\n public getAnimatables(): IAnimatable[] {\n var results = [];\n\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\n results.push(this.diffuseTexture);\n }\n\n if (this.noiseTexture && this.noiseTexture.animations && this.noiseTexture.animations.length > 0) {\n results.push(this.noiseTexture);\n }\n\n return results;\n }\n\n public getActiveTextures(): BaseTexture[] {\n var activeTextures = super.getActiveTextures();\n\n if (this._diffuseTexture) {\n activeTextures.push(this._diffuseTexture);\n }\n\n return activeTextures;\n }\n\n public hasTexture(texture: BaseTexture): boolean {\n if (super.hasTexture(texture)) {\n return true;\n }\n\n if (this.diffuseTexture === texture) {\n return true;\n }\n\n return false;\n }\n\n public dispose(forceDisposeEffect?: boolean): void {\n if (this.diffuseTexture) {\n this.diffuseTexture.dispose();\n }\n if (this.noiseTexture) {\n this.noiseTexture.dispose();\n }\n\n super.dispose(forceDisposeEffect);\n }\n\n public clone(name: string): LavaMaterial {\n return SerializationHelper.Clone(() => new LavaMaterial(name, this.getScene()), this);\n }\n\n public serialize(): any {\n var serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.LavaMaterial\";\n return serializationObject;\n }\n\n public getClassName(): string {\n return \"LavaMaterial\";\n }\n\n // Statics\n public static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial {\n return SerializationHelper.Parse(() => new LavaMaterial(source.name, scene), source, scene, rootUrl);\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.LavaMaterial\"] = LavaMaterial;","import * as MatLib from \"../index\";\r\n\r\n/**\r\n * Legacy support, defining window.BABYLON.GridMaterial... (global variable).\r\n *\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nvar globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);\r\nif (typeof globalObject !== \"undefined\") {\r\n (globalObject).BABYLON = (globalObject).BABYLON || {};\r\n for (var mat in MatLib) {\r\n (globalObject).BABYLON[mat] = (MatLib)[mat];\r\n }\r\n}\r\n\r\nexport * from \"../index\";","export * from \"./mixMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'mixPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D mixMap1Sampler;\nuniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform sampler2D diffuse4Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\nuniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;\nuniform sampler2D diffuse6Sampler;\nuniform sampler2D diffuse7Sampler;\nuniform sampler2D diffuse8Sampler;\nuniform vec2 diffuse5Infos;\nuniform vec2 diffuse6Infos;\nuniform vec2 diffuse7Infos;\nuniform vec2 diffuse8Infos;\n#endif\n#endif\n\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 finalMixColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\nvec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);\ndiffuse1Color.rgb*=mixColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);\ndiffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);\nvec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);\nvec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);\nvec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);\ndiffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);\ndiffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);\ndiffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var mixPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'mixVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var mixVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./mix.fragment\";\r\nimport \"./mix.vertex\";\r\n\r\nclass MixMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public MIXMAP2 = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class MixMaterial extends PushMaterial {\r\n /**\r\n * Mix textures\r\n */\r\n\r\n @serializeAsTexture(\"mixTexture1\")\r\n private _mixTexture1: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture1: BaseTexture;\r\n\r\n @serializeAsTexture(\"mixTexture2\")\r\n private _mixTexture2: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture2: BaseTexture;\r\n\r\n /**\r\n * Diffuse textures\r\n */\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture1: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture2: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture3: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture4\")\r\n private _diffuseTexture4: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture4: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture5: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture5: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture6: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture6: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture7: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture7: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture4\")\r\n private _diffuseTexture8: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture8: Texture;\r\n\r\n /**\r\n * Uniforms\r\n */\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0, 0, 0);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new MixMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (!this._mixTexture1 || !this._mixTexture1.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needUVs = true;\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture1 || !this._diffuseTexture1.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.DIFFUSE = true;\r\n\r\n if (!this._diffuseTexture2 || !this._diffuseTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture3 || !this._diffuseTexture3.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture4 || !this._diffuseTexture4.isReady()) {\r\n return false;\r\n }\r\n\r\n if (this._mixTexture2) {\r\n if (!this._mixTexture2.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.MIXMAP2 = true;\r\n\r\n if (!this._diffuseTexture5 || !this._diffuseTexture5.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture6 || !this._diffuseTexture6.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture7 || !this._diffuseTexture7.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture8 || !this._diffuseTexture8.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"mix\";\r\n var join = defines.toString();\r\n var uniforms = [\r\n \"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vTextureInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"textureMatrix\",\r\n \"diffuse1Infos\", \"diffuse2Infos\", \"diffuse3Infos\", \"diffuse4Infos\",\r\n \"diffuse5Infos\", \"diffuse6Infos\", \"diffuse7Infos\", \"diffuse8Infos\"\r\n ];\r\n var samplers = [\r\n \"mixMap1Sampler\", \"mixMap2Sampler\",\r\n \"diffuse1Sampler\", \"diffuse2Sampler\", \"diffuse3Sampler\", \"diffuse4Sampler\",\r\n \"diffuse5Sampler\", \"diffuse6Sampler\", \"diffuse7Sampler\", \"diffuse8Sampler\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._mixTexture1) {\r\n this._activeEffect.setTexture(\"mixMap1Sampler\", this._mixTexture1);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture1.coordinatesIndex, this._mixTexture1.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture1.getTextureMatrix());\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture1) {\r\n this._activeEffect.setTexture(\"diffuse1Sampler\", this._diffuseTexture1);\r\n this._activeEffect.setFloat2(\"diffuse1Infos\", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);\r\n }\r\n if (this._diffuseTexture2) {\r\n this._activeEffect.setTexture(\"diffuse2Sampler\", this._diffuseTexture2);\r\n this._activeEffect.setFloat2(\"diffuse2Infos\", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);\r\n }\r\n if (this._diffuseTexture3) {\r\n this._activeEffect.setTexture(\"diffuse3Sampler\", this._diffuseTexture3);\r\n this._activeEffect.setFloat2(\"diffuse3Infos\", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);\r\n }\r\n if (this._diffuseTexture4) {\r\n this._activeEffect.setTexture(\"diffuse4Sampler\", this._diffuseTexture4);\r\n this._activeEffect.setFloat2(\"diffuse4Infos\", this._diffuseTexture4.uScale, this._diffuseTexture4.vScale);\r\n }\r\n }\r\n }\r\n\r\n if (this._mixTexture2) {\r\n this._activeEffect.setTexture(\"mixMap2Sampler\", this._mixTexture2);\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture5) {\r\n this._activeEffect.setTexture(\"diffuse5Sampler\", this._diffuseTexture5);\r\n this._activeEffect.setFloat2(\"diffuse5Infos\", this._diffuseTexture5.uScale, this._diffuseTexture5.vScale);\r\n }\r\n if (this._diffuseTexture6) {\r\n this._activeEffect.setTexture(\"diffuse6Sampler\", this._diffuseTexture6);\r\n this._activeEffect.setFloat2(\"diffuse6Infos\", this._diffuseTexture6.uScale, this._diffuseTexture6.vScale);\r\n }\r\n if (this._diffuseTexture7) {\r\n this._activeEffect.setTexture(\"diffuse7Sampler\", this._diffuseTexture7);\r\n this._activeEffect.setFloat2(\"diffuse7Infos\", this._diffuseTexture7.uScale, this._diffuseTexture7.vScale);\r\n }\r\n if (this._diffuseTexture8) {\r\n this._activeEffect.setTexture(\"diffuse8Sampler\", this._diffuseTexture8);\r\n this._activeEffect.setFloat2(\"diffuse8Infos\", this._diffuseTexture8.uScale, this._diffuseTexture8.vScale);\r\n }\r\n }\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._mixTexture1 && this._mixTexture1.animations && this._mixTexture1.animations.length > 0) {\r\n results.push(this._mixTexture1);\r\n }\r\n\r\n if (this._mixTexture2 && this._mixTexture2.animations && this._mixTexture2.animations.length > 0) {\r\n results.push(this._mixTexture2);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n // Mix map 1\r\n if (this._mixTexture1) {\r\n activeTextures.push(this._mixTexture1);\r\n }\r\n\r\n if (this._diffuseTexture1) {\r\n activeTextures.push(this._diffuseTexture1);\r\n }\r\n\r\n if (this._diffuseTexture2) {\r\n activeTextures.push(this._diffuseTexture2);\r\n }\r\n\r\n if (this._diffuseTexture3) {\r\n activeTextures.push(this._diffuseTexture3);\r\n }\r\n\r\n if (this._diffuseTexture4) {\r\n activeTextures.push(this._diffuseTexture4);\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2) {\r\n activeTextures.push(this._mixTexture2);\r\n }\r\n\r\n if (this._diffuseTexture5) {\r\n activeTextures.push(this._diffuseTexture5);\r\n }\r\n\r\n if (this._diffuseTexture6) {\r\n activeTextures.push(this._diffuseTexture6);\r\n }\r\n\r\n if (this._diffuseTexture7) {\r\n activeTextures.push(this._diffuseTexture7);\r\n }\r\n\r\n if (this._diffuseTexture8) {\r\n activeTextures.push(this._diffuseTexture8);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n // Mix map 1\r\n if (this._mixTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture4 === texture) {\r\n return true;\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture5 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture6 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture7 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture8 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._mixTexture1) {\r\n this._mixTexture1.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): MixMaterial {\r\n return SerializationHelper.Clone(() => new MixMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.MixMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"MixMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): MixMaterial {\r\n return SerializationHelper.Parse(() => new MixMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.MixMaterial\"] = MixMaterial;\r\n","export * from \"./normalMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'normalPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=baseColor.rgb;\n#endif\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var normalPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'normalVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var normalVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./normal.fragment\";\r\nimport \"./normal.vertex\";\r\n\r\nclass NormalMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public LIGHTING = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class NormalMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending() || (mesh.visibility < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new NormalMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = true;\r\n MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n defines.LIGHTING = !this._disableLighting;\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"normal\";\r\n var join = defines.toString();\r\n\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\"\r\n ];\r\n var samplers = [\"diffuseSampler\"];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\r\n }\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): NormalMaterial {\r\n return SerializationHelper.Clone(() => new NormalMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.NormalMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"NormalMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial {\r\n return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.NormalMaterial\"] = NormalMaterial;","export * from \"./shadowOnlyMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'shadowOnlyPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform float alpha;\nuniform vec3 shadowColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..1]\n\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var shadowOnlyPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'shadowOnlyVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var shadowOnlyVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { IShadowLight } from \"babylonjs/Lights/shadowLight\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./shadowOnly.fragment\";\r\nimport \"./shadowOnly.vertex\";\r\n\r\nclass ShadowOnlyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _renderId: number;\r\n private _activeLight: IShadowLight;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public shadowColor = Color3.Black();\r\n\r\n public needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n public get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new ShadowOnlyMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (var light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n var lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, 1);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, 1);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"shadowOnly\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\", \"alpha\", \"shadowColor\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\"\r\n ];\r\n var samplers = new Array();\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 1 }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n // Lights\r\n if (scene.lightsEnabled) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone(() => new ShadowOnlyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.ShadowOnlyMaterial\"] = ShadowOnlyMaterial;","export * from \"./simpleMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'simplePixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var simplePixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'simpleVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var simpleVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./simple.fragment\";\r\nimport \"./simple.vertex\";\r\n\r\nclass SimpleMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class SimpleMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new SimpleMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n var shaderName = \"simple\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\"\r\n ];\r\n var samplers = [\"diffuseSampler\"];\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights - 1 }\r\n }, engine), defines);\r\n\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): SimpleMaterial {\r\n return SerializationHelper.Clone(() => new SimpleMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.SimpleMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"SimpleMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial {\r\n return SerializationHelper.Parse(() => new SimpleMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.SimpleMaterial\"] = SimpleMaterial;","export * from \"./skyMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'skyPixelShader';\nlet shader = `precision highp float;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n\nuniform vec3 cameraPosition;\nuniform vec3 cameraOffset;\nuniform float luminance;\nuniform float turbidity;\nuniform float rayleigh;\nuniform float mieCoefficient;\nuniform float mieDirectionalG;\nuniform vec3 sunPosition;\n\n#include\n\nconst float e=2.71828182845904523536028747135266249775724709369995957;\nconst float pi=3.141592653589793238462643383279502884197169;\nconst float n=1.0003;\nconst float N=2.545E25;\nconst float pn=0.035;\nconst vec3 lambda=vec3(680E-9,550E-9,450E-9);\nconst vec3 K=vec3(0.686,0.678,0.666);\nconst float v=4.0;\nconst float rayleighZenithLength=8.4E3;\nconst float mieZenithLength=1.25E3;\nconst vec3 up=vec3(0.0,1.0,0.0);\nconst float EE=1000.0;\nconst float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;\nconst float cutoffAngle=pi/1.95;\nconst float steepness=1.5;\nvec3 totalRayleigh(vec3 lambda)\n{\nreturn (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));\n}\nvec3 simplifiedRayleigh()\n{\nreturn 0.0005/vec3(94,40,18);\n}\nfloat rayleighPhase(float cosTheta)\n{\nreturn (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));\n}\nvec3 totalMie(vec3 lambda,vec3 K,float T)\n{\nfloat c=(0.2*T )*10E-18;\nreturn 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;\n}\nfloat hgPhase(float cosTheta,float g)\n{\nreturn (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));\n}\nfloat sunIntensity(float zenithAngleCos)\n{\nreturn EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));\n}\nfloat A=0.15;\nfloat B=0.50;\nfloat C=0.10;\nfloat D=0.20;\nfloat EEE=0.02;\nfloat F=0.30;\nfloat W=1000.0;\nvec3 Uncharted2Tonemap(vec3 x)\n{\nreturn ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;\n}\nvoid main(void) {\n\n#include\n\nfloat sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);\nfloat rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));\nvec3 sunDirection=normalize(sunPosition);\nfloat sunE=sunIntensity(dot(sunDirection,up));\nvec3 betaR=simplifiedRayleigh()*rayleighCoefficient;\nvec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;\nfloat zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition+cameraOffset))));\nfloat sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nfloat sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nvec3 Fex=exp(-(betaR*sR+betaM*sM));\nfloat cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);\nfloat rPhase=rayleighPhase(cosTheta*0.5+0.5);\nvec3 betaRTheta=betaR*rPhase;\nfloat mPhase=hgPhase(cosTheta,mieDirectionalG);\nvec3 betaMTheta=betaM*mPhase;\nvec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));\nLin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));\nvec3 direction=normalize(vPositionW-cameraPosition);\nfloat theta=acos(direction.y);\nfloat phi=atan(direction.z,direction.x);\nvec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);\nvec3 L0=vec3(0.1)*Fex;\nfloat sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);\nL0+=(sunE*19000.0*Fex)*sundisk;\nvec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));\nvec3 texColor=(Lin+L0);\ntexColor*=0.04 ;\ntexColor+=vec3(0.0,0.001,0.0025)*0.3;\nfloat g_fMaxLuminance=1.0;\nfloat fLumScaled=0.1/luminance;\nfloat fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled);\nfloat ExposureBias=fLumCompressed;\nvec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);\n\n\n\nvec3 retColor=curr*whiteScale;\n\n\nfloat alpha=1.0;\n#ifdef VERTEXCOLOR\nretColor.rgb*=vColor.rgb;\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);\n\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var skyPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\n\nlet name = 'skyVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\nvoid main(void) {\ngl_Position=viewProjection*world*vec4(position,1.0);\nvec4 worldPos=world*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var skyVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsVector3, serialize, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Vector3, Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./sky.fragment\";\r\nimport \"./sky.vertex\";\r\n\r\n/** @hidden */\r\nclass SkyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * This is the sky material which allows to create dynamic and texture free effects for skyboxes.\r\n * @see https://doc.babylonjs.com/extensions/sky\r\n */\r\nexport class SkyMaterial extends PushMaterial {\r\n /**\r\n * Defines the overall luminance of sky in interval ]0, 1[.\r\n */\r\n @serialize()\r\n public luminance: number = 1.0;\r\n\r\n /**\r\n * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.\r\n */\r\n @serialize()\r\n public turbidity: number = 10.0;\r\n\r\n /**\r\n * Defines the sky appearance (light intensity).\r\n */\r\n @serialize()\r\n public rayleigh: number = 2.0;\r\n\r\n /**\r\n * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.\r\n */\r\n @serialize()\r\n public mieCoefficient: number = 0.005;\r\n\r\n /**\r\n * Defines the amount of haze particles following the Mie scattering theory.\r\n */\r\n @serialize()\r\n public mieDirectionalG: number = 0.8;\r\n\r\n /**\r\n * Defines the distance of the sun according to the active scene camera.\r\n */\r\n @serialize()\r\n public distance: number = 500;\r\n\r\n /**\r\n * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said\r\n * \"inclined\".\r\n */\r\n @serialize()\r\n public inclination: number = 0.49;\r\n\r\n /**\r\n * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between\r\n * an object direction and a reference direction.\r\n */\r\n @serialize()\r\n public azimuth: number = 0.25;\r\n\r\n /**\r\n * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then\r\n * the property is overriden by the inclination and the azimuth and can be read at any moment.\r\n */\r\n @serializeAsVector3()\r\n public sunPosition: Vector3 = new Vector3(0, 100, 0);\r\n\r\n /**\r\n * Defines if the sun position should be computed (inclination and azimuth) according to the given\r\n * .sunPosition property.\r\n */\r\n @serialize()\r\n public useSunPosition: boolean = false;\r\n\r\n /**\r\n * Defines an offset vector used to get a horizon offset.\r\n * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis\r\n */\r\n @serialize()\r\n public cameraOffset: Vector3 = Vector3.Zero();\r\n\r\n // Private members\r\n private _cameraPosition: Vector3 = Vector3.Zero();\r\n\r\n private _renderId: number;\r\n\r\n /**\r\n * Instantiates a new sky material.\r\n * This material allows to create dynamic and texture free\r\n * effects for skyboxes by taking care of the atmosphere state.\r\n * @see https://doc.babylonjs.com/extensions/sky\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns false as the sky material doesn't need alpha testing.\r\n */\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns null as the sky material has no texture.\r\n */\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new SkyMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n var shaderName = \"sky\";\r\n\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n attribs,\r\n [\"world\", \"viewProjection\", \"view\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\", \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\",\r\n \"luminance\", \"turbidity\", \"rayleigh\", \"mieCoefficient\", \"mieDirectionalG\", \"sunPosition\",\r\n \"cameraPosition\", \"cameraOffset\"\r\n ],\r\n [],\r\n join, fallbacks, this.onCompiled, this.onError), defines);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n // Sky\r\n var camera = scene.activeCamera;\r\n if (camera) {\r\n var cameraWorldMatrix = camera.getWorldMatrix();\r\n this._cameraPosition.x = cameraWorldMatrix.m[12];\r\n this._cameraPosition.y = cameraWorldMatrix.m[13];\r\n this._cameraPosition.z = cameraWorldMatrix.m[14];\r\n this._activeEffect.setVector3(\"cameraPosition\", this._cameraPosition);\r\n }\r\n\r\n this._activeEffect.setVector3(\"cameraOffset\", this.cameraOffset);\r\n\r\n if (this.luminance > 0) {\r\n this._activeEffect.setFloat(\"luminance\", this.luminance);\r\n }\r\n\r\n this._activeEffect.setFloat(\"turbidity\", this.turbidity);\r\n this._activeEffect.setFloat(\"rayleigh\", this.rayleigh);\r\n this._activeEffect.setFloat(\"mieCoefficient\", this.mieCoefficient);\r\n this._activeEffect.setFloat(\"mieDirectionalG\", this.mieDirectionalG);\r\n\r\n if (!this.useSunPosition) {\r\n var theta = Math.PI * (this.inclination - 0.5);\r\n var phi = 2 * Math.PI * (this.azimuth - 0.5);\r\n\r\n this.sunPosition.x = this.distance * Math.cos(phi);\r\n this.sunPosition.y = this.distance * Math.sin(phi) * Math.sin(theta);\r\n this.sunPosition.z = this.distance * Math.sin(phi) * Math.cos(theta);\r\n }\r\n\r\n this._activeEffect.setVector3(\"sunPosition\", this.sunPosition);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n */\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n public clone(name: string): SkyMaterial {\r\n return SerializationHelper.Clone(() => new SkyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.SkyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the material e.g. \"SkyMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"SkyMaterial\";\r\n }\r\n\r\n /**\r\n * Creates a sky material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new sky material\r\n */\r\n public static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial {\r\n return SerializationHelper.Parse(() => new SkyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.SkyMaterial\"] = SkyMaterial;","export * from \"./terrainMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'terrainPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D textureSampler;\nuniform vec2 vTextureInfos;\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\nuniform sampler2D bump2Sampler;\nuniform sampler2D bump3Sampler;\n#endif\n\n#include\n#include\n#include\n\n#include\n\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{\nvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\nvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\nvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\nbump1Color.rgb*=mixColor.r;\nbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\nvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\nmap=map*255./127.-128./127.;\nmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\nreturn normalize(TBN*map);\n}\n#endif\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\ndiffuse1Color.rgb*=baseColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\nbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var terrainPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'terrainVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var terrainVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"babylonjs/Materials/Textures/texture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./terrain.fragment\";\r\nimport \"./terrain.vertex\";\r\n\r\nclass TerrainMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public BUMP = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class TerrainMaterial extends PushMaterial {\r\n @serializeAsTexture(\"mixTexture\")\r\n private _mixTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture1: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture2: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture3: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture1\")\r\n private _bumpTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture1: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture2\")\r\n private _bumpTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture2: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture3\")\r\n private _bumpTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture3: Texture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0, 0, 0);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new TerrainMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (!this.mixTexture || !this.mixTexture.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needUVs = true;\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture1 || !this.diffuseTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture2 || !this.diffuseTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture3 || !this.diffuseTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.DIFFUSE = true;\r\n }\r\n\r\n if (this.bumpTexture1 && this.bumpTexture2 && this.bumpTexture3 && MaterialFlags.BumpTextureEnabled) {\r\n if (!this.bumpTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needNormals = true;\r\n defines.BUMP = true;\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"terrain\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vTextureInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"textureMatrix\",\r\n \"diffuse1Infos\", \"diffuse2Infos\", \"diffuse3Infos\"\r\n ];\r\n var samplers = [\"textureSampler\", \"diffuse1Sampler\", \"diffuse2Sampler\", \"diffuse3Sampler\",\r\n \"bump1Sampler\", \"bump2Sampler\", \"bump3Sampler\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this.mixTexture) {\r\n this._activeEffect.setTexture(\"textureSampler\", this._mixTexture);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture.coordinatesIndex, this._mixTexture.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture.getTextureMatrix());\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture1) {\r\n this._activeEffect.setTexture(\"diffuse1Sampler\", this._diffuseTexture1);\r\n this._activeEffect.setFloat2(\"diffuse1Infos\", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);\r\n }\r\n if (this._diffuseTexture2) {\r\n this._activeEffect.setTexture(\"diffuse2Sampler\", this._diffuseTexture2);\r\n this._activeEffect.setFloat2(\"diffuse2Infos\", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);\r\n }\r\n if (this._diffuseTexture3) {\r\n this._activeEffect.setTexture(\"diffuse3Sampler\", this._diffuseTexture3);\r\n this._activeEffect.setFloat2(\"diffuse3Infos\", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);\r\n }\r\n }\r\n\r\n if (MaterialFlags.BumpTextureEnabled && scene.getEngine().getCaps().standardDerivatives) {\r\n if (this._bumpTexture1) {\r\n this._activeEffect.setTexture(\"bump1Sampler\", this._bumpTexture1);\r\n }\r\n if (this._bumpTexture2) {\r\n this._activeEffect.setTexture(\"bump2Sampler\", this._bumpTexture2);\r\n }\r\n if (this._bumpTexture3) {\r\n this._activeEffect.setTexture(\"bump3Sampler\", this._bumpTexture3);\r\n }\r\n }\r\n }\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {\r\n results.push(this.mixTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._mixTexture) {\r\n activeTextures.push(this._mixTexture);\r\n }\r\n\r\n if (this._diffuseTexture1) {\r\n activeTextures.push(this._diffuseTexture1);\r\n }\r\n\r\n if (this._diffuseTexture2) {\r\n activeTextures.push(this._diffuseTexture2);\r\n }\r\n\r\n if (this._diffuseTexture3) {\r\n activeTextures.push(this._diffuseTexture3);\r\n }\r\n\r\n if (this._bumpTexture1) {\r\n activeTextures.push(this._bumpTexture1);\r\n }\r\n\r\n if (this._bumpTexture2) {\r\n activeTextures.push(this._bumpTexture2);\r\n }\r\n\r\n if (this._bumpTexture3) {\r\n activeTextures.push(this._bumpTexture3);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._mixTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.mixTexture) {\r\n this.mixTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): TerrainMaterial {\r\n return SerializationHelper.Clone(() => new TerrainMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.TerrainMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"TerrainMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial {\r\n return SerializationHelper.Parse(() => new TerrainMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.TerrainMaterial\"] = TerrainMaterial;","export * from \"./triPlanarMaterial\";","import { Nullable } from \"babylonjs/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\r\nimport { Matrix } from \"babylonjs/Maths/math.vector\";\r\nimport { Color3 } from \"babylonjs/Maths/math.color\";\r\n\r\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\r\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\r\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\r\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\r\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\r\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\r\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\r\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\r\nimport { Scene } from \"babylonjs/scene\";\r\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\r\n\r\nimport \"./triplanar.fragment\";\r\nimport \"./triplanar.vertex\";\r\n\r\nclass TriPlanarMaterialDefines extends MaterialDefines {\r\n public DIFFUSEX = false;\r\n public DIFFUSEY = false;\r\n public DIFFUSEZ = false;\r\n\r\n public BUMPX = false;\r\n public BUMPY = false;\r\n public BUMPZ = false;\r\n\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class TriPlanarMaterial extends PushMaterial {\r\n @serializeAsTexture()\r\n public mixTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTextureX\")\r\n private _diffuseTextureX: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTextureX: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTexturY\")\r\n private _diffuseTextureY: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTextureY: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTextureZ\")\r\n private _diffuseTextureZ: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTextureZ: BaseTexture;\r\n\r\n @serializeAsTexture(\"normalTextureX\")\r\n private _normalTextureX: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public normalTextureX: BaseTexture;\r\n\r\n @serializeAsTexture(\"normalTextureY\")\r\n private _normalTextureY: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public normalTextureY: BaseTexture;\r\n\r\n @serializeAsTexture(\"normalTextureZ\")\r\n private _normalTextureZ: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public normalTextureZ: BaseTexture;\r\n\r\n @serialize()\r\n public tileSize: number = 1;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0.2, 0.2, 0.2);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n private _renderId: number;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return (this.alpha < 1.0);\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (this._wasPreviouslyReady && subMesh.effect) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new TriPlanarMaterialDefines();\r\n }\r\n\r\n var defines = subMesh._materialDefines;\r\n var scene = this.getScene();\r\n\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (this._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n var engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n var textures = [this.diffuseTextureX, this.diffuseTextureY, this.diffuseTextureZ];\r\n var textureDefines = [\"DIFFUSEX\", \"DIFFUSEY\", \"DIFFUSEZ\"];\r\n\r\n for (var i = 0; i < textures.length; i++) {\r\n if (textures[i]) {\r\n if (!textures[i].isReady()) {\r\n return false;\r\n } else {\r\n (defines)[textureDefines[i]] = true;\r\n }\r\n }\r\n }\r\n }\r\n if (MaterialFlags.BumpTextureEnabled) {\r\n var textures = [this.normalTextureX, this.normalTextureY, this.normalTextureZ];\r\n var textureDefines = [\"BUMPX\", \"BUMPY\", \"BUMPZ\"];\r\n\r\n for (var i = 0; i < textures.length; i++) {\r\n if (textures[i]) {\r\n if (!textures[i].isReady()) {\r\n return false;\r\n } else {\r\n (defines)[textureDefines[i]] = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n var shaderName = \"triplanar\";\r\n var join = defines.toString();\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\",\r\n \"tileSize\"\r\n ];\r\n var samplers = [\"diffuseSamplerX\", \"diffuseSamplerY\", \"diffuseSamplerZ\",\r\n \"normalSamplerX\", \"normalSamplerY\", \"normalSamplerZ\"\r\n ];\r\n\r\n var uniformBuffers = new Array();\r\n\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights\r\n });\r\n\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }\r\n }, engine), defines);\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n this._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n var scene = this.getScene();\r\n\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n this._activeEffect.setFloat(\"tileSize\", this.tileSize);\r\n\r\n if (scene.getCachedMaterial() !== this) {\r\n // Textures\r\n if (this.diffuseTextureX) {\r\n this._activeEffect.setTexture(\"diffuseSamplerX\", this.diffuseTextureX);\r\n }\r\n if (this.diffuseTextureY) {\r\n this._activeEffect.setTexture(\"diffuseSamplerY\", this.diffuseTextureY);\r\n }\r\n if (this.diffuseTextureZ) {\r\n this._activeEffect.setTexture(\"diffuseSamplerZ\", this.diffuseTextureZ);\r\n }\r\n if (this.normalTextureX) {\r\n this._activeEffect.setTexture(\"normalSamplerX\", this.normalTextureX);\r\n }\r\n if (this.normalTextureY) {\r\n this._activeEffect.setTexture(\"normalSamplerY\", this.normalTextureY);\r\n }\r\n if (this.normalTextureZ) {\r\n this._activeEffect.setTexture(\"normalSamplerZ\", this.normalTextureZ);\r\n }\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n var results = [];\r\n\r\n if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {\r\n results.push(this.mixTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n var activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTextureX) {\r\n activeTextures.push(this._diffuseTextureX);\r\n }\r\n\r\n if (this._diffuseTextureY) {\r\n activeTextures.push(this._diffuseTextureY);\r\n }\r\n\r\n if (this._diffuseTextureZ) {\r\n activeTextures.push(this._diffuseTextureZ);\r\n }\r\n\r\n if (this._normalTextureX) {\r\n activeTextures.push(this._normalTextureX);\r\n }\r\n\r\n if (this._normalTextureY) {\r\n activeTextures.push(this._normalTextureY);\r\n }\r\n\r\n if (this._normalTextureZ) {\r\n activeTextures.push(this._normalTextureZ);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTextureX === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTextureY === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTextureZ === texture) {\r\n return true;\r\n }\r\n\r\n if (this._normalTextureX === texture) {\r\n return true;\r\n }\r\n\r\n if (this._normalTextureY === texture) {\r\n return true;\r\n }\r\n\r\n if (this._normalTextureZ === texture) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.mixTexture) {\r\n this.mixTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): TriPlanarMaterial {\r\n return SerializationHelper.Clone(() => new TriPlanarMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.TriPlanarMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"TriPlanarMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial {\r\n return SerializationHelper.Parse(() => new TriPlanarMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\n_TypeStore.RegisteredTypes[\"BABYLON.TriPlanarMaterial\"] = TriPlanarMaterial;","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/depthPrePass\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'triplanarPixelShader';\nlet shader = `precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\nuniform sampler2D diffuseSamplerX;\n#ifdef BUMPX\nuniform sampler2D normalSamplerX;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\nuniform sampler2D diffuseSamplerY;\n#ifdef BUMPY\nuniform sampler2D normalSamplerY;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\nuniform sampler2D diffuseSamplerZ;\n#ifdef BUMPZ\nuniform sampler2D normalSamplerZ;\n#endif\n#endif\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#include\n#include\n#include\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(0.,0.,0.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=tangentSpace[2];\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec4 baseNormal=vec4(0.0,0.0,0.0,1.0);\nnormalW*=normalW;\n#ifdef DIFFUSEX\nbaseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nnormalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var triplanarPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'triplanarVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\n#endif\nuniform float tileSize;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void)\n{\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef DIFFUSEX\nvTextureUVX=worldPos.zy/tileSize;\n#endif\n#ifdef DIFFUSEY\nvTextureUVY=worldPos.xz/tileSize;\n#endif\n#ifdef DIFFUSEZ\nvTextureUVZ=worldPos.xy/tileSize;\n#endif\n#ifdef NORMAL\n\nvec3 xtan=vec3(0,0,1);\nvec3 xbin=vec3(0,1,0);\nvec3 ytan=vec3(1,0,0);\nvec3 ybin=vec3(0,0,1);\nvec3 ztan=vec3(1,0,0);\nvec3 zbin=vec3(0,1,0);\nvec3 normalizedNormal=normalize(normal);\nnormalizedNormal*=normalizedNormal;\nvec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);\nvec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);\nworldTangent=(world*vec4(worldTangent,1.0)).xyz;\nworldBinormal=(world*vec4(worldBinormal,1.0)).xyz;\nvec3 worldNormal=normalize(cross(worldTangent,worldBinormal));\ntangentSpace[0]=worldTangent;\ntangentSpace[1]=worldBinormal;\ntangentSpace[2]=worldNormal;\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var triplanarVertexShader = { name, shader };\n","export * from \"./waterMaterial\";","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/helperFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/imageProcessingFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthFragment\";\nimport \"babylonjs/Shaders/ShadersInclude/fogFragment\";\n\nlet name = 'waterPixelShader';\nlet shader = `#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterPixelShader = { name, shader };\n","import { Effect } from \"babylonjs/Materials/effect\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"babylonjs/Shaders/ShadersInclude/instancesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/bonesVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/fogVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/shadowsVertex\";\nimport \"babylonjs/Shaders/ShadersInclude/logDepthVertex\";\n\nlet name = 'waterVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n`;\n\nEffect.ShadersStore[name] = shader;\n/** @hidden */\nexport var waterVertexShader = { name, shader };\n","import { Nullable } from \"babylonjs/types\";\nimport { serializeAsVector2, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"babylonjs/Misc/decorators\";\nimport { Matrix, Vector2, Vector3 } from \"babylonjs/Maths/math.vector\";\nimport { Color3 } from \"babylonjs/Maths/math.color\";\nimport { Plane } from 'babylonjs/Maths/math.plane';\nimport { IAnimatable } from 'babylonjs/Animations/animatable.interface';\nimport { Constants } from \"babylonjs/Engines/constants\";\nimport { SmartArray } from \"babylonjs/Misc/smartArray\";\nimport { Observer } from 'babylonjs/Misc/observable';\nimport { BaseTexture } from \"babylonjs/Materials/Textures/baseTexture\";\nimport { RenderTargetTexture } from \"babylonjs/Materials/Textures/renderTargetTexture\";\nimport { EffectFallbacks, EffectCreationOptions } from \"babylonjs/Materials/effect\";\nimport { MaterialDefines } from \"babylonjs/Materials/materialDefines\";\nimport { IImageProcessingConfigurationDefines, ImageProcessingConfiguration } from \"babylonjs/Materials/imageProcessingConfiguration\";\nimport { MaterialHelper } from \"babylonjs/Materials/materialHelper\";\nimport { PushMaterial } from \"babylonjs/Materials/pushMaterial\";\nimport { MaterialFlags } from \"babylonjs/Materials/materialFlags\";\nimport { VertexBuffer } from \"babylonjs/Meshes/buffer\";\nimport { AbstractMesh } from \"babylonjs/Meshes/abstractMesh\";\nimport { SubMesh } from \"babylonjs/Meshes/subMesh\";\nimport { Mesh } from \"babylonjs/Meshes/mesh\";\nimport { Camera } from \"babylonjs/Cameras/camera\";\nimport { Scene } from \"babylonjs/scene\";\nimport { _TypeStore } from 'babylonjs/Misc/typeStore';\n\nimport \"./water.fragment\";\nimport \"./water.vertex\";\n\nclass WaterMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {\n public BUMP = false;\n public REFLECTION = false;\n public CLIPPLANE = false;\n public CLIPPLANE2 = false;\n public CLIPPLANE3 = false;\n public CLIPPLANE4 = false;\n public ALPHATEST = false;\n public DEPTHPREPASS = false;\n public POINTSIZE = false;\n public FOG = false;\n public NORMAL = false;\n public UV1 = false;\n public UV2 = false;\n public VERTEXCOLOR = false;\n public VERTEXALPHA = false;\n public NUM_BONE_INFLUENCERS = 0;\n public BonesPerMesh = 0;\n public INSTANCES = false;\n public SPECULARTERM = false;\n public LOGARITHMICDEPTH = false;\n public FRESNELSEPARATE = false;\n public BUMPSUPERIMPOSE = false;\n public BUMPAFFECTSREFLECTION = false;\n\n public IMAGEPROCESSING = false;\n public VIGNETTE = false;\n public VIGNETTEBLENDMODEMULTIPLY = false;\n public VIGNETTEBLENDMODEOPAQUE = false;\n public TONEMAPPING = false;\n public TONEMAPPING_ACES = false;\n public CONTRAST = false;\n public EXPOSURE = false;\n public COLORCURVES = false;\n public COLORGRADING = false;\n public COLORGRADING3D = false;\n public SAMPLER3DGREENDEPTH = false;\n public SAMPLER3DBGRMAP = false;\n public IMAGEPROCESSINGPOSTPROCESS = false;\n\n constructor() {\n super();\n this.rebuild();\n }\n}\n\nexport class WaterMaterial extends PushMaterial {\n /*\n * Public members\n */\n @serializeAsTexture(\"bumpTexture\")\n private _bumpTexture: BaseTexture;\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n public bumpTexture: BaseTexture;\n\n @serializeAsColor3()\n public diffuseColor = new Color3(1, 1, 1);\n\n @serializeAsColor3()\n public specularColor = new Color3(0, 0, 0);\n\n @serialize()\n public specularPower = 64;\n\n @serialize(\"disableLighting\")\n private _disableLighting = false;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public disableLighting: boolean;\n\n @serialize(\"maxSimultaneousLights\")\n private _maxSimultaneousLights = 4;\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n public maxSimultaneousLights: number;\n\n /**\n * @param {number}: Represents the wind force\n */\n @serialize()\n public windForce: number = 6;\n /**\n * @param {Vector2}: The direction of the wind in the plane (X, Z)\n */\n @serializeAsVector2()\n public windDirection: Vector2 = new Vector2(0, 1);\n /**\n * @param {number}: Wave height, represents the height of the waves\n */\n @serialize()\n public waveHeight: number = 0.4;\n /**\n * @param {number}: Bump height, represents the bump height related to the bump map\n */\n @serialize()\n public bumpHeight: number = 0.4;\n /**\n * @param {boolean}: Add a smaller moving bump to less steady waves.\n */\n @serialize(\"bumpSuperimpose\")\n private _bumpSuperimpose = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpSuperimpose: boolean;\n\n /**\n * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.\n */\n @serialize(\"fresnelSeparate\")\n private _fresnelSeparate = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public fresnelSeparate: boolean;\n\n /**\n * @param {boolean}: bump Waves modify the reflection.\n */\n @serialize(\"bumpAffectsReflection\")\n private _bumpAffectsReflection = false;\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n public bumpAffectsReflection: boolean;\n\n /**\n * @param {number}: The water color blended with the refraction (near)\n */\n @serializeAsColor3()\n public waterColor: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color\n */\n @serialize()\n public colorBlendFactor: number = 0.2;\n /**\n * @param {number}: The water color blended with the reflection (far)\n */\n @serializeAsColor3()\n public waterColor2: Color3 = new Color3(0.1, 0.1, 0.6);\n /**\n * @param {number}: The blend factor related to the water color (reflection, far)\n */\n @serialize()\n public colorBlendFactor2: number = 0.2;\n /**\n * @param {number}: Represents the maximum length of a wave\n */\n @serialize()\n public waveLength: number = 0.1;\n\n /**\n * @param {number}: Defines the waves speed\n */\n @serialize()\n public waveSpeed: number = 1.0;\n /**\n * Sets or gets wether or not automatic clipping should be enabled or not. Setting to true will save performances and\n * will avoid calculating useless pixels in the pixel shader of the water material.\n */\n @serialize()\n public disableClipPlane: boolean = false;\n\n protected _renderTargets = new SmartArray(16);\n\n /*\n * Private members\n */\n private _mesh: Nullable = null;\n\n private _refractionRTT: Nullable;\n private _reflectionRTT: Nullable;\n\n private _reflectionTransform: Matrix = Matrix.Zero();\n private _lastTime: number = 0;\n private _lastDeltaTime: number = 0;\n\n private _renderId: number;\n\n private _useLogarithmicDepth: boolean;\n\n private _waitingRenderList: Nullable;\n\n private _imageProcessingConfiguration: Nullable;\n private _imageProcessingObserver: Nullable>;\n\n /**\n * Gets a boolean indicating that current material needs to register RTT\n */\n public get hasRenderTargetTextures(): boolean {\n return true;\n }\n\n /**\n * Constructor\n */\n constructor(name: string, scene: Scene, public renderTargetSize: Vector2 = new Vector2(512, 512)) {\n super(name, scene);\n\n this._createRenderTargets(scene, renderTargetSize);\n\n // Create render targets\n this.getRenderTargetTextures = (): SmartArray => {\n this._renderTargets.reset();\n this._renderTargets.push(this._reflectionRTT);\n this._renderTargets.push(this._refractionRTT);\n\n return this._renderTargets;\n };\n\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\n if (this._imageProcessingConfiguration) {\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\n this._markAllSubMeshesAsImageProcessingDirty();\n });\n }\n }\n\n @serialize()\n public get useLogarithmicDepth(): boolean {\n return this._useLogarithmicDepth;\n }\n\n public set useLogarithmicDepth(value: boolean) {\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\n this._markAllSubMeshesAsMiscDirty();\n }\n\n // Get / Set\n public get refractionTexture(): Nullable {\n return this._refractionRTT;\n }\n\n public get reflectionTexture(): Nullable {\n return this._reflectionRTT;\n }\n\n // Methods\n public addToRenderList(node: any): void {\n if (this._refractionRTT && this._refractionRTT.renderList) {\n this._refractionRTT.renderList.push(node);\n }\n\n if (this._reflectionRTT && this._reflectionRTT.renderList) {\n this._reflectionRTT.renderList.push(node);\n }\n }\n\n public enableRenderTargets(enable: boolean): void {\n var refreshRate = enable ? 1 : 0;\n\n if (this._refractionRTT) {\n this._refractionRTT.refreshRate = refreshRate;\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.refreshRate = refreshRate;\n }\n }\n\n public getRenderList(): Nullable {\n return this._refractionRTT ? this._refractionRTT.renderList : [];\n }\n\n public get renderTargetsEnabled(): boolean {\n return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);\n }\n\n public needAlphaBlending(): boolean {\n return (this.alpha < 1.0);\n }\n\n public needAlphaTesting(): boolean {\n return false;\n }\n\n public getAlphaTestTexture(): Nullable {\n return null;\n }\n\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\n if (this.isFrozen) {\n if (this._wasPreviouslyReady && subMesh.effect) {\n return true;\n }\n }\n\n if (!subMesh._materialDefines) {\n subMesh._materialDefines = new WaterMaterialDefines();\n }\n\n var defines = subMesh._materialDefines;\n var scene = this.getScene();\n\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\n if (this._renderId === scene.getRenderId()) {\n return true;\n }\n }\n\n var engine = scene.getEngine();\n\n // Textures\n if (defines._areTexturesDirty) {\n defines._needUVs = false;\n if (scene.texturesEnabled) {\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n if (!this.bumpTexture.isReady()) {\n return false;\n } else {\n defines._needUVs = true;\n defines.BUMP = true;\n }\n }\n\n if (MaterialFlags.ReflectionTextureEnabled) {\n defines.REFLECTION = true;\n }\n }\n }\n\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);\n\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\n\n if (defines._areMiscDirty) {\n if (this._fresnelSeparate) {\n defines.FRESNELSEPARATE = true;\n }\n\n if (this._bumpSuperimpose) {\n defines.BUMPSUPERIMPOSE = true;\n }\n\n if (this._bumpAffectsReflection) {\n defines.BUMPAFFECTSREFLECTION = true;\n }\n }\n\n // Lights\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\n\n // Image processing\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\n if (!this._imageProcessingConfiguration.isReady()) {\n return false;\n }\n\n this._imageProcessingConfiguration.prepareDefines(defines);\n\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\n }\n\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\n\n // Configure this\n this._mesh = mesh;\n\n if (this._waitingRenderList) {\n for (var i = 0; i < this._waitingRenderList.length; i++) {\n this.addToRenderList(scene.getNodeByID(this._waitingRenderList[i]));\n }\n\n this._waitingRenderList = null;\n }\n\n // Get correct effect\n if (defines.isDirty) {\n defines.markAsProcessed();\n scene.resetCachedMaterial();\n\n // Fallbacks\n var fallbacks = new EffectFallbacks();\n if (defines.FOG) {\n fallbacks.addFallback(1, \"FOG\");\n }\n\n if (defines.LOGARITHMICDEPTH) {\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\n }\n\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\n\n if (defines.NUM_BONE_INFLUENCERS > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n\n //Attributes\n var attribs = [VertexBuffer.PositionKind];\n\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n\n if (defines.UV1) {\n attribs.push(VertexBuffer.UVKind);\n }\n\n if (defines.UV2) {\n attribs.push(VertexBuffer.UV2Kind);\n }\n\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n\n // Legacy browser patch\n var shaderName = \"water\";\n var join = defines.toString();\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vDiffuseColor\", \"vSpecularColor\",\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\n \"vNormalInfos\",\n \"mBones\",\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"normalMatrix\",\n \"logarithmicDepthConstant\",\n\n // Water\n \"worldReflectionViewProjection\", \"windDirection\", \"waveLength\", \"time\", \"windForce\",\n \"cameraPosition\", \"bumpHeight\", \"waveHeight\", \"waterColor\", \"waterColor2\", \"colorBlendFactor\", \"colorBlendFactor2\", \"waveSpeed\"\n ];\n var samplers = [\"normalSampler\",\n // Water\n \"refractionSampler\", \"reflectionSampler\"\n ];\n var uniformBuffers = new Array();\n\n if (ImageProcessingConfiguration) {\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\n }\n\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this.maxSimultaneousLights\n });\n subMesh.setEffect(scene.getEngine().createEffect(shaderName,\n {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }\n }, engine), defines);\n\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n\n this._renderId = scene.getRenderId();\n this._wasPreviouslyReady = true;\n\n return true;\n }\n\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\n var scene = this.getScene();\n\n var defines = subMesh._materialDefines;\n if (!defines) {\n return;\n }\n\n var effect = subMesh.effect;\n if (!effect || !this._mesh) {\n return;\n }\n this._activeEffect = effect;\n\n // Matrices\n this.bindOnlyWorldMatrix(world);\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n\n // Bones\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\n\n if (this._mustRebind(scene, effect)) {\n // Textures\n if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n this._activeEffect.setTexture(\"normalSampler\", this.bumpTexture);\n\n this._activeEffect.setFloat2(\"vNormalInfos\", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);\n this._activeEffect.setMatrix(\"normalMatrix\", this.bumpTexture.getTextureMatrix());\n }\n // Clip plane\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\n\n // Point size\n if (this.pointsCloud) {\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\n }\n\n MaterialHelper.BindEyePosition(effect, scene);\n }\n\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\n\n if (defines.SPECULARTERM) {\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\n }\n\n if (scene.lightsEnabled && !this.disableLighting) {\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\n }\n\n // View\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\n }\n\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\n\n // Log. depth\n MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);\n\n // Water\n if (MaterialFlags.ReflectionTextureEnabled) {\n this._activeEffect.setTexture(\"refractionSampler\", this._refractionRTT);\n this._activeEffect.setTexture(\"reflectionSampler\", this._reflectionRTT);\n }\n\n var wrvp = this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(scene.getProjectionMatrix());\n\n // Add delta time. Prevent adding delta time if it hasn't changed.\n let deltaTime = scene.getEngine().getDeltaTime();\n if (deltaTime !== this._lastDeltaTime) {\n this._lastDeltaTime = deltaTime;\n this._lastTime += this._lastDeltaTime;\n }\n\n this._activeEffect.setMatrix(\"worldReflectionViewProjection\", wrvp);\n this._activeEffect.setVector2(\"windDirection\", this.windDirection);\n this._activeEffect.setFloat(\"waveLength\", this.waveLength);\n this._activeEffect.setFloat(\"time\", this._lastTime / 100000);\n this._activeEffect.setFloat(\"windForce\", this.windForce);\n this._activeEffect.setFloat(\"waveHeight\", this.waveHeight);\n this._activeEffect.setFloat(\"bumpHeight\", this.bumpHeight);\n this._activeEffect.setColor4(\"waterColor\", this.waterColor, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor\", this.colorBlendFactor);\n this._activeEffect.setColor4(\"waterColor2\", this.waterColor2, 1.0);\n this._activeEffect.setFloat(\"colorBlendFactor2\", this.colorBlendFactor2);\n this._activeEffect.setFloat(\"waveSpeed\", this.waveSpeed);\n\n // image processing\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\n this._imageProcessingConfiguration.bind(this._activeEffect);\n }\n\n this._afterBind(mesh, this._activeEffect);\n }\n\n private _createRenderTargets(scene: Scene, renderTargetSize: Vector2): void {\n // Render targets\n this._refractionRTT = new RenderTargetTexture(name + \"_refraction\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._refractionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._refractionRTT.ignoreCameraViewport = true;\n\n this._reflectionRTT = new RenderTargetTexture(name + \"_reflection\", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);\n this._reflectionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\n this._reflectionRTT.ignoreCameraViewport = true;\n\n var isVisible: boolean;\n var clipPlane: Nullable = null;\n var savedViewMatrix: Matrix;\n var mirrorMatrix = Matrix.Zero();\n\n this._refractionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony + 0.05, 0), new Vector3(0, 1, 0));\n }\n };\n\n this._refractionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n scene.clipPlane = clipPlane;\n }\n };\n\n this._reflectionRTT.onBeforeRender = () => {\n if (this._mesh) {\n isVisible = this._mesh.isVisible;\n this._mesh.isVisible = false;\n }\n\n // Clip plane\n if (!this.disableClipPlane) {\n clipPlane = scene.clipPlane;\n\n var positiony = this._mesh ? this._mesh.position.y : 0.0;\n scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony - 0.05, 0), new Vector3(0, -1, 0));\n\n Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);\n }\n\n // Transform\n savedViewMatrix = scene.getViewMatrix();\n\n mirrorMatrix.multiplyToRef(savedViewMatrix, this._reflectionTransform);\n scene.setTransformMatrix(this._reflectionTransform, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = false;\n scene._mirroredCameraPosition = Vector3.TransformCoordinates((scene.activeCamera).position, mirrorMatrix);\n };\n\n this._reflectionRTT.onAfterRender = () => {\n if (this._mesh) {\n this._mesh.isVisible = isVisible;\n }\n\n // Clip plane\n scene.clipPlane = clipPlane;\n\n // Transform\n scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());\n scene.getEngine().cullBackFaces = true;\n scene._mirroredCameraPosition = null;\n };\n }\n\n public getAnimatables(): IAnimatable[] {\n var results = [];\n\n if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {\n results.push(this.bumpTexture);\n }\n if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {\n results.push(this._reflectionRTT);\n }\n if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {\n results.push(this._refractionRTT);\n }\n\n return results;\n }\n\n public getActiveTextures(): BaseTexture[] {\n var activeTextures = super.getActiveTextures();\n\n if (this._bumpTexture) {\n activeTextures.push(this._bumpTexture);\n }\n\n return activeTextures;\n }\n\n public hasTexture(texture: BaseTexture): boolean {\n if (super.hasTexture(texture)) {\n return true;\n }\n\n if (this._bumpTexture === texture) {\n return true;\n }\n\n return false;\n }\n\n public dispose(forceDisposeEffect?: boolean): void {\n if (this.bumpTexture) {\n this.bumpTexture.dispose();\n }\n\n var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n index = -1;\n index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);\n if (index != -1) {\n this.getScene().customRenderTargets.splice(index, 1);\n }\n\n if (this._reflectionRTT) {\n this._reflectionRTT.dispose();\n }\n if (this._refractionRTT) {\n this._refractionRTT.dispose();\n }\n\n // Remove image-processing observer\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n\n super.dispose(forceDisposeEffect);\n }\n\n public clone(name: string): WaterMaterial {\n return SerializationHelper.Clone(() => new WaterMaterial(name, this.getScene()), this);\n }\n\n public serialize(): any {\n var serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.WaterMaterial\";\n\n serializationObject.renderList = [];\n if (this._refractionRTT && this._refractionRTT.renderList) {\n for (var i = 0; i < this._refractionRTT.renderList.length; i++) {\n serializationObject.renderList.push(this._refractionRTT.renderList[i].id);\n }\n }\n\n return serializationObject;\n }\n\n public getClassName(): string {\n return \"WaterMaterial\";\n }\n\n // Statics\n public static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial {\n var mat = SerializationHelper.Parse(() => new WaterMaterial(source.name, scene), source, scene, rootUrl);\n mat._waitingRenderList = source.renderList;\n\n return mat;\n }\n\n public static CreateDefaultMesh(name: string, scene: Scene): Mesh {\n var mesh = Mesh.CreateGround(name, 512, 512, 32, scene, false);\n return mesh;\n }\n}\n\n_TypeStore.RegisteredTypes[\"BABYLON.WaterMaterial\"] = WaterMaterial;","module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/preview release/materialsLibrary/babylonjs.materials.min.js b/dist/preview release/materialsLibrary/babylonjs.materials.min.js index 649251da78f..ce364006b12 100644 --- a/dist/preview release/materialsLibrary/babylonjs.materials.min.js +++ b/dist/preview release/materialsLibrary/babylonjs.materials.min.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)}function o(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=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(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.waterPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n";r.Effect.ShadersStore.waterVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.BUMP=!1,t.REFLECTION=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.SPECULARTERM=!1,t.LOGARITHMICDEPTH=!1,t.FRESNELSEPARATE=!1,t.BUMPSUPERIMPOSE=!1,t.BUMPAFFECTSREFLECTION=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i,n){void 0===n&&(n=new r.Vector2(512,512));var o=e.call(this,t,i)||this;return o.renderTargetSize=n,o.diffuseColor=new r.Color3(1,1,1),o.specularColor=new r.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new r.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new r.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new r.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.disableClipPlane=!1,o._renderTargets=new r.SmartArray(16),o._mesh=null,o._reflectionTransform=r.Matrix.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,n),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return n.b(t,e),Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!0,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var t=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=t),this._reflectionRTT&&(this._reflectionRTT.refreshRate=t)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!0,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled)){if(this.bumpTexture&&r.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;n._needUVs=!0,n.BUMP=!0}r.MaterialFlags.ReflectionTextureEnabled&&(n.REFLECTION=!0)}if(r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._areMiscDirty&&(this._fresnelSeparate&&(n.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(n.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(n.BUMPAFFECTSREFLECTION=!0)),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!0,this._maxSimultaneousLights,this._disableLighting),n._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(n),n.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,n.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),this._mesh=e,this._waitingRenderList){for(var f=0;f0&&l.addCPUSkinningFallback(0,e);var u=[r.VertexBuffer.PositionKind];n.NORMAL&&u.push(r.VertexBuffer.NormalKind),n.UV1&&u.push(r.VertexBuffer.UVKind),n.UV2&&u.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&u.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(u,e,n,l),r.MaterialHelper.PrepareAttributesForInstances(u,n);var c=n.toString(),d=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed"],p=["normalSampler","refractionSampler","reflectionSampler"],h=new Array;r.ImageProcessingConfiguration&&(r.ImageProcessingConfiguration.PrepareUniforms(d,n),r.ImageProcessingConfiguration.PrepareSamplers(p,n)),r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:h,samplers:p,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("water",{attributes:u,uniformsNames:d,uniformBuffersNames:h,samplers:p,defines:c,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;if(a&&this._mesh){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.bumpTexture&&r.MaterialFlags.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),r.MaterialHelper.BindLogDepth(o,this._activeEffect,n),r.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var s=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(n.getProjectionMatrix()),f=n.getEngine().getDeltaTime();f!==this._lastDeltaTime&&(this._lastDeltaTime=f,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",s),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(t,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,t){var i,n=this;this._refractionRTT=new r.RenderTargetTexture(name+"_refraction",{width:t.x,height:t.y},e,!1,!0),this._refractionRTT.wrapU=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new r.RenderTargetTexture(name+"_reflection",{width:t.x,height:t.y},e,!1,!0),this._reflectionRTT.wrapU=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s=r.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(n._mesh&&(i=n._mesh.isVisible,n._mesh.isVisible=!1),!n.disableClipPlane){a=e.clipPlane;var t=n._mesh?n._mesh.position.y:0;e.clipPlane=r.Plane.FromPositionAndNormal(new r.Vector3(0,t+.05,0),new r.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){n._mesh&&(n._mesh.isVisible=i),n.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(n._mesh&&(i=n._mesh.isVisible,n._mesh.isVisible=!1),!n.disableClipPlane){a=e.clipPlane;var t=n._mesh?n._mesh.position.y:0;e.clipPlane=r.Plane.FromPositionAndNormal(new r.Vector3(0,t-.05,0),new r.Vector3(0,-1,0)),r.Matrix.ReflectionToRef(e.clipPlane,s)}o=e.getViewMatrix(),s.multiplyToRef(o,n._reflectionTransform),e.setTransformMatrix(n._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=r.Vector3.TransformCoordinates(e.activeCamera.position,s)},this._reflectionRTT.onAfterRender=function(){n._mesh&&(n._mesh.isVisible=i),e.clipPlane=a,e.setTransformMatrix(o,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&t.push(this._bumpTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._bumpTexture===t},t.prototype.dispose=function(t){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=-1,-1!=(i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.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 r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var t=0;t\n\nuniform vec3 cameraPosition;\nuniform vec3 cameraOffset;\nuniform float luminance;\nuniform float turbidity;\nuniform float rayleigh;\nuniform float mieCoefficient;\nuniform float mieDirectionalG;\nuniform vec3 sunPosition;\n\n#include\n\nconst float e=2.71828182845904523536028747135266249775724709369995957;\nconst float pi=3.141592653589793238462643383279502884197169;\nconst float n=1.0003;\nconst float N=2.545E25;\nconst float pn=0.035;\nconst vec3 lambda=vec3(680E-9,550E-9,450E-9);\nconst vec3 K=vec3(0.686,0.678,0.666);\nconst float v=4.0;\nconst float rayleighZenithLength=8.4E3;\nconst float mieZenithLength=1.25E3;\nconst vec3 up=vec3(0.0,1.0,0.0);\nconst float EE=1000.0;\nconst float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;\nconst float cutoffAngle=pi/1.95;\nconst float steepness=1.5;\nvec3 totalRayleigh(vec3 lambda)\n{\nreturn (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));\n}\nvec3 simplifiedRayleigh()\n{\nreturn 0.0005/vec3(94,40,18);\n}\nfloat rayleighPhase(float cosTheta)\n{\nreturn (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));\n}\nvec3 totalMie(vec3 lambda,vec3 K,float T)\n{\nfloat c=(0.2*T )*10E-18;\nreturn 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;\n}\nfloat hgPhase(float cosTheta,float g)\n{\nreturn (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));\n}\nfloat sunIntensity(float zenithAngleCos)\n{\nreturn EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));\n}\nfloat A=0.15;\nfloat B=0.50;\nfloat C=0.10;\nfloat D=0.20;\nfloat EEE=0.02;\nfloat F=0.30;\nfloat W=1000.0;\nvec3 Uncharted2Tonemap(vec3 x)\n{\nreturn ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;\n}\nvoid main(void) {\n\n#include\n\nfloat sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);\nfloat rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));\nvec3 sunDirection=normalize(sunPosition);\nfloat sunE=sunIntensity(dot(sunDirection,up));\nvec3 betaR=simplifiedRayleigh()*rayleighCoefficient;\nvec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;\nfloat zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition+cameraOffset))));\nfloat sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nfloat sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nvec3 Fex=exp(-(betaR*sR+betaM*sM));\nfloat cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);\nfloat rPhase=rayleighPhase(cosTheta*0.5+0.5);\nvec3 betaRTheta=betaR*rPhase;\nfloat mPhase=hgPhase(cosTheta,mieDirectionalG);\nvec3 betaMTheta=betaM*mPhase;\nvec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));\nLin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));\nvec3 direction=normalize(vPositionW-cameraPosition);\nfloat theta=acos(direction.y);\nfloat phi=atan(direction.z,direction.x);\nvec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);\nvec3 L0=vec3(0.1)*Fex;\nfloat sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);\nL0+=(sunE*19000.0*Fex)*sundisk;\nvec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));\nvec3 texColor=(Lin+L0);\ntexColor*=0.04 ;\ntexColor+=vec3(0.0,0.001,0.0025)*0.3;\nfloat g_fMaxLuminance=1.0;\nfloat fLumScaled=0.1/luminance;\nfloat fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled);\nfloat ExposureBias=fLumCompressed;\nvec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);\n\n\n\nvec3 retColor=curr*whiteScale;\n\n\nfloat alpha=1.0;\n#ifdef VERTEXCOLOR\nretColor.rgb*=vColor.rgb;\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);\n\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.skyPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\nvoid main(void) {\ngl_Position=viewProjection*world*vec4(position,1.0);\nvec4 worldPos=world*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.skyVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.POINTSIZE=!1,t.FOG=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.luminance=1,n.turbidity=10,n.rayleigh=2,n.mieCoefficient=.005,n.mieDirectionalG=.8,n.distance=500,n.inclination=.49,n.azimuth=.25,n.sunPosition=new r.Vector3(0,100,0),n.useSunPosition=!1,n.cameraOffset=r.Vector3.Zero(),n._cameraPosition=r.Vector3.Zero(),n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,!1,n),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new r.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG");var f=[r.VertexBuffer.PositionKind];n.VERTEXCOLOR&&f.push(r.VertexBuffer.ColorKind);var l=n.toString();t.setEffect(o.getEngine().createEffect("sky",f,["world","viewProjection","view","vFogInfos","vFogColor","pointSize","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","luminance","turbidity","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","cameraPosition","cameraOffset"],[],l,a,this.onCompiled,this.onError),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();if(i._materialDefines){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._mustRebind(n,o)&&(r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize)),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect);var a=n.activeCamera;if(a){var s=a.getWorldMatrix();this._cameraPosition.x=s.m[12],this._cameraPosition.y=s.m[13],this._cameraPosition.z=s.m[14],this._activeEffect.setVector3("cameraPosition",this._cameraPosition)}if(this._activeEffect.setVector3("cameraOffset",this.cameraOffset),this.luminance>0&&this._activeEffect.setFloat("luminance",this.luminance),this._activeEffect.setFloat("turbidity",this.turbidity),this._activeEffect.setFloat("rayleigh",this.rayleigh),this._activeEffect.setFloat("mieCoefficient",this.mieCoefficient),this._activeEffect.setFloat("mieDirectionalG",this.mieDirectionalG),!this.useSunPosition){var f=Math.PI*(this.inclination-.5),l=2*Math.PI*(this.azimuth-.5);this.sunPosition.x=this.distance*Math.cos(l),this.sunPosition.y=this.distance*Math.sin(l)*Math.sin(f),this.sunPosition.z=this.distance*Math.sin(l)*Math.cos(f)}this._activeEffect.setVector3("sunPosition",this.sunPosition),this._afterBind(t,this._activeEffect)}}},t.prototype.getAnimatables=function(){return[]},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.SkyMaterial",e},t.prototype.getClassName=function(){return"SkyMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serialize)()],t.prototype,"luminance",void 0),n.a([Object(r.serialize)()],t.prototype,"turbidity",void 0),n.a([Object(r.serialize)()],t.prototype,"rayleigh",void 0),n.a([Object(r.serialize)()],t.prototype,"mieCoefficient",void 0),n.a([Object(r.serialize)()],t.prototype,"mieDirectionalG",void 0),n.a([Object(r.serialize)()],t.prototype,"distance",void 0),n.a([Object(r.serialize)()],t.prototype,"inclination",void 0),n.a([Object(r.serialize)()],t.prototype,"azimuth",void 0),n.a([Object(r.serializeAsVector3)()],t.prototype,"sunPosition",void 0),n.a([Object(r.serialize)()],t.prototype,"useSunPosition",void 0),n.a([Object(r.serialize)()],t.prototype,"cameraOffset",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.SkyMaterial"]=f,i.d(t,"SkyMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\nuniform sampler2D distortionSampler;\nuniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#include\n\n#include\nvec4 bx2(vec4 x)\n{\nreturn vec4(2.0)*x-vec4(1.0);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\n\nfloat alpha=1.0;\n#ifdef DIFFUSE\n\nconst float distortionAmount0=0.092;\nconst float distortionAmount1=0.092;\nconst float distortionAmount2=0.092;\nvec2 heightAttenuation=vec2(0.3,0.39);\nvec4 noise0=texture2D(distortionSampler,vDistortionCoords1);\nvec4 noise1=texture2D(distortionSampler,vDistortionCoords2);\nvec4 noise2=texture2D(distortionSampler,vDistortionCoords3);\nvec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;\nvec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);\nvec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;\nbaseColor*=opacityColor;\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=vec4(baseColor.rgb,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.firePixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n\nuniform float time;\nuniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#ifdef DIFFUSE\nvDiffuseUV=uv;\nvDiffuseUV.y-=0.2;\n#endif\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\n\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;\nvDistortionCoords1.x=uv.x;\nvDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;\nvDistortionCoords2.x=uv.x;\nvDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;\nvDistortionCoords3.x=uv.x;\nvDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n}\n";r.Effect.ShadersStore.fireVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.UV1=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.BonesPerMesh=0,t.NUM_BONE_INFLUENCERS=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.speed=1,n._scaledDiffuse=new r.Color3,n._lastTime=0,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return!1},t.prototype.needAlphaTesting=function(){return!0},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(n.ALPHATEST=!!this._opacityTexture,n._areMiscDirty&&(n.POINTSIZE=this.pointsCloud||o.forcePointsCloud,n.FOG=o.fogEnabled&&e.applyFog&&o.fogMode!==r.Scene.FOGMODE_NONE&&this.fogEnabled),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.UV1&&l.push(r.VertexBuffer.UVKind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString();t.setEffect(o.getEngine().createEffect("fire",{attributes:l,uniformsNames:["world","view","viewProjection","vEyePosition","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","time","speed"],uniformBuffersNames:[],samplers:["diffuseSampler","distortionSampler","opacitySampler"],defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:null,maxSimultaneousLights:4,transformFeedbackVaryings:null},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();if(i._materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,o)&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix()),this._activeEffect.setTexture("distortionSampler",this._distortionTexture),this._activeEffect.setTexture("opacitySampler",this._opacityTexture)),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(o,n)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._lastTime+=n.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime),this._activeEffect.setFloat("speed",this.speed),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._distortionTexture&&this._distortionTexture.animations&&this._distortionTexture.animations.length>0&&e.push(this._distortionTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._distortionTexture&&t.push(this._distortionTexture),this._opacityTexture&&t.push(this._opacityTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTexture===t||(this._distortionTexture===t||this._opacityTexture===t))},t.prototype.getClassName=function(){return"FireMaterial"},t.prototype.dispose=function(t){this._diffuseTexture&&this._diffuseTexture.dispose(),this._distortionTexture&&this._distortionTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.customType="BABYLON.FireMaterial",t.diffuseColor=this.diffuseColor.asArray(),t.speed=this.speed,this._diffuseTexture&&(t._diffuseTexture=this._diffuseTexture.serialize()),this._distortionTexture&&(t._distortionTexture=this._distortionTexture.serialize()),this._opacityTexture&&(t._opacityTexture=this._opacityTexture.serialize()),t},t.Parse=function(e,i,n){var o=new t(e.name,i);return o.diffuseColor=r.Color3.FromArray(e.diffuseColor),o.speed=e.speed,o.alpha=e.alpha,o.id=e.id,r.Tags.AddTagsTo(o,e.tags),o.backFaceCulling=e.backFaceCulling,o.wireframe=e.wireframe,e._diffuseTexture&&(o._diffuseTexture=r.Texture.Parse(e._diffuseTexture,i,n)),e._distortionTexture&&(o._distortionTexture=r.Texture.Parse(e._distortionTexture,i,n)),e._opacityTexture&&(o._opacityTexture=r.Texture.Parse(e._opacityTexture,i,n)),e.checkReadyOnlyOnce&&(o.checkReadyOnlyOnce=e.checkReadyOnlyOnce),o},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsTexture)("distortionTexture")],t.prototype,"_distortionTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"distortionTexture",void 0),n.a([Object(r.serializeAsTexture)("opacityTexture")],t.prototype,"_opacityTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityTexture",void 0),n.a([Object(r.serializeAsColor3)("diffuse")],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)()],t.prototype,"speed",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.FireMaterial"]=f,i.d(t,"FireMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\nuniform sampler2D diffuseSamplerX;\n#ifdef BUMPX\nuniform sampler2D normalSamplerX;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\nuniform sampler2D diffuseSamplerY;\n#ifdef BUMPY\nuniform sampler2D normalSamplerY;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\nuniform sampler2D diffuseSamplerZ;\n#ifdef BUMPZ\nuniform sampler2D normalSamplerZ;\n#endif\n#endif\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#include\n#include\n#include\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(0.,0.,0.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=tangentSpace[2];\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec4 baseNormal=vec4(0.0,0.0,0.0,1.0);\nnormalW*=normalW;\n#ifdef DIFFUSEX\nbaseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nnormalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.triplanarPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\n#endif\nuniform float tileSize;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void)\n{\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef DIFFUSEX\nvTextureUVX=worldPos.zy/tileSize;\n#endif\n#ifdef DIFFUSEY\nvTextureUVY=worldPos.xz/tileSize;\n#endif\n#ifdef DIFFUSEZ\nvTextureUVZ=worldPos.xy/tileSize;\n#endif\n#ifdef NORMAL\n\nvec3 xtan=vec3(0,0,1);\nvec3 xbin=vec3(0,1,0);\nvec3 ytan=vec3(1,0,0);\nvec3 ybin=vec3(0,0,1);\nvec3 ztan=vec3(1,0,0);\nvec3 zbin=vec3(0,1,0);\nvec3 normalizedNormal=normalize(normal);\nnormalizedNormal*=normalizedNormal;\nvec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);\nvec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);\nworldTangent=(world*vec4(worldTangent,1.0)).xyz;\nworldBinormal=(world*vec4(worldBinormal,1.0)).xyz;\nvec3 worldNormal=normalize(cross(worldTangent,worldBinormal));\ntangentSpace[0]=worldTangent;\ntangentSpace[1]=worldBinormal;\ntangentSpace[2]=worldNormal;\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.triplanarVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSEX=!1,t.DIFFUSEY=!1,t.DIFFUSEZ=!1,t.BUMPX=!1,t.BUMPY=!1,t.BUMPZ=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.NORMAL=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.tileSize=1,n.diffuseColor=new r.Color3(1,1,1),n.specularColor=new r.Color3(.2,.2,.2),n.specularPower=64,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&o.texturesEnabled){if(r.MaterialFlags.DiffuseTextureEnabled)for(var f=[this.diffuseTextureX,this.diffuseTextureY,this.diffuseTextureZ],l=["DIFFUSEX","DIFFUSEY","DIFFUSEZ"],u=0;u0&&c.addCPUSkinningFallback(0,e);var d=[r.VertexBuffer.PositionKind];n.NORMAL&&d.push(r.VertexBuffer.NormalKind),n.VERTEXCOLOR&&d.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(d,e,n,c),r.MaterialHelper.PrepareAttributesForInstances(d,n);var p=n.toString(),h=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","tileSize"],v=["diffuseSamplerX","diffuseSamplerY","diffuseSamplerZ","normalSamplerX","normalSamplerY","normalSamplerZ"],m=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:m,samplers:v,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("triplanar",{attributes:d,uniformsNames:h,uniformBuffersNames:m,samplers:v,defines:p,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._activeEffect.setFloat("tileSize",this.tileSize),n.getCachedMaterial()!==this&&(this.diffuseTextureX&&this._activeEffect.setTexture("diffuseSamplerX",this.diffuseTextureX),this.diffuseTextureY&&this._activeEffect.setTexture("diffuseSamplerY",this.diffuseTextureY),this.diffuseTextureZ&&this._activeEffect.setTexture("diffuseSamplerZ",this.diffuseTextureZ),this.normalTextureX&&this._activeEffect.setTexture("normalSamplerX",this.normalTextureX),this.normalTextureY&&this._activeEffect.setTexture("normalSamplerY",this.normalTextureY),this.normalTextureZ&&this._activeEffect.setTexture("normalSamplerZ",this.normalTextureZ),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTextureX&&t.push(this._diffuseTextureX),this._diffuseTextureY&&t.push(this._diffuseTextureY),this._diffuseTextureZ&&t.push(this._diffuseTextureZ),this._normalTextureX&&t.push(this._normalTextureX),this._normalTextureY&&t.push(this._normalTextureY),this._normalTextureZ&&t.push(this._normalTextureZ),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTextureX===t||(this._diffuseTextureY===t||(this._diffuseTextureZ===t||(this._normalTextureX===t||(this._normalTextureY===t||this._normalTextureZ===t)))))},t.prototype.dispose=function(t){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.TriPlanarMaterial",e},t.prototype.getClassName=function(){return"TriPlanarMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)()],t.prototype,"mixTexture",void 0),n.a([Object(r.serializeAsTexture)("diffuseTextureX")],t.prototype,"_diffuseTextureX",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTextureX",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexturY")],t.prototype,"_diffuseTextureY",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTextureY",void 0),n.a([Object(r.serializeAsTexture)("diffuseTextureZ")],t.prototype,"_diffuseTextureZ",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTextureZ",void 0),n.a([Object(r.serializeAsTexture)("normalTextureX")],t.prototype,"_normalTextureX",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"normalTextureX",void 0),n.a([Object(r.serializeAsTexture)("normalTextureY")],t.prototype,"_normalTextureY",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"normalTextureY",void 0),n.a([Object(r.serializeAsTexture)("normalTextureZ")],t.prototype,"_normalTextureZ",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"normalTextureZ",void 0),n.a([Object(r.serialize)()],t.prototype,"tileSize",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"specularColor",void 0),n.a([Object(r.serialize)()],t.prototype,"specularPower",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.TriPlanarMaterial"]=f,i.d(t,"TriPlanarMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 furColor;\nuniform float furLength;\nvarying vec3 vPositionW;\nvarying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform float furOcclusion;\nuniform sampler2D furTexture;\nvarying vec2 vFurUV;\n#endif\n#include\n#include\n#include\n#include\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=furColor;\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\n\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));\nif (furTextureColor.a<=0.0 || furTextureColor.g[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;\nvec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.furPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\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\nuniform float furLength;\nuniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform vec3 furGravity;\nuniform float furTime;\nuniform float furSpacing;\nuniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n#include\n#include\n\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else\nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);\nvec3 tangent2=vec3(-normal.z,0,normal.x);\nr=Rand(tangent1*r);\nfloat J=(2.0+4.0*r);\nr=Rand(tangent2*r);\nfloat K=(2.0+2.0*r);\ntangent1=tangent1*J+tangent2*K;\ntangent1=normalize(tangent1);\nvec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\n\nvec3 forceDirection=vec3(0.0,0.0,0.0);\nforceDirection.x=sin(furTime+position.x*0.05)*0.2;\nforceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;\nforceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;\nvec3 displacement=vec3(0.0,0.0,0.0);\ndisplacement=furGravity+forceDirection;\nfloat displacementFactor=pow(furOffset,3.0);\nvec3 aNormal=normal;\naNormal.xyz+=displacement*displacementFactor;\nnewPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.furVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.HEIGHTMAP=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.HIGHLEVEL=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.furLength=1,n.furAngle=0,n.furColor=new r.Color3(.44,.21,.02),n.furOffset=0,n.furSpacing=12,n.furGravity=new r.Vector3(0,0,0),n.furSpeed=100,n.furDensity=20,n.furOcclusion=0,n._disableLighting=!1,n._maxSimultaneousLights=4,n.highLevelFur=!0,n._furTime=0,n}return n.b(t,e),Object.defineProperty(t.prototype,"furTime",{get:function(){return this._furTime},set:function(e){this._furTime=e},enumerable:!0,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.updateFur=function(){for(var e=1;e0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","furLength","furAngle","furColor","furOffset","furGravity","furTime","furSpacing","furDensity","furOcclusion"],d=["diffuseSampler","heightTexture","furTexture"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("fur",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),n.getCachedMaterial()!==this&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),this._heightTexture&&this._activeEffect.setTexture("heightTexture",this._heightTexture),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._activeEffect.setFloat("furLength",this.furLength),this._activeEffect.setFloat("furAngle",this.furAngle),this._activeEffect.setColor4("furColor",this.furColor,1),this.highLevelFur&&(this._activeEffect.setVector3("furGravity",this.furGravity),this._activeEffect.setFloat("furOffset",this.furOffset),this._activeEffect.setFloat("furSpacing",this.furSpacing),this._activeEffect.setFloat("furDensity",this.furDensity),this._activeEffect.setFloat("furOcclusion",this.furOcclusion),this._furTime+=this.getScene().getEngine().getDeltaTime()/this.furSpeed,this._activeEffect.setFloat("furTime",this._furTime),this._activeEffect.setTexture("furTexture",this.furTexture)),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.heightTexture&&this.heightTexture.animations&&this.heightTexture.animations.length>0&&e.push(this.heightTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._heightTexture&&t.push(this._heightTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this.diffuseTexture===t||this._heightTexture===t)},t.prototype.dispose=function(t){if(this.diffuseTexture&&this.diffuseTexture.dispose(),this._meshes)for(var i=1;i\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D textureSampler;\nuniform vec2 vTextureInfos;\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\nuniform sampler2D bump2Sampler;\nuniform sampler2D bump3Sampler;\n#endif\n\n#include\n#include\n#include\n\n#include\n\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{\nvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\nvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\nvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\nbump1Color.rgb*=mixColor.r;\nbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\nvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\nmap=map*255./127.-128./127.;\nmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\nreturn normalize(TBN*map);\n}\n#endif\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\ndiffuse1Color.rgb*=baseColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\nbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.terrainPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.terrainVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.BUMP=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.specularColor=new r.Color3(0,0,0),n.specularPower=64,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(o.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(n._needUVs=!0,r.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture1||!this.diffuseTexture1.isReady())return!1;if(!this.diffuseTexture2||!this.diffuseTexture2.isReady())return!1;if(!this.diffuseTexture3||!this.diffuseTexture3.isReady())return!1;n.DIFFUSE=!0}if(this.bumpTexture1&&this.bumpTexture2&&this.bumpTexture3&&r.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture1.isReady())return!1;if(!this.bumpTexture2.isReady())return!1;if(!this.bumpTexture3.isReady())return!1;n._needNormals=!0,n.BUMP=!0}}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],d=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("terrain",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.mixTexture&&(this._activeEffect.setTexture("textureSampler",this._mixTexture),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture.coordinatesIndex,this._mixTexture.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture.getTextureMatrix()),r.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale))),r.MaterialFlags.BumpTextureEnabled&&n.getEngine().getCaps().standardDerivatives&&(this._bumpTexture1&&this._activeEffect.setTexture("bump1Sampler",this._bumpTexture1),this._bumpTexture2&&this._activeEffect.setTexture("bump2Sampler",this._bumpTexture2),this._bumpTexture3&&this._activeEffect.setTexture("bump3Sampler",this._bumpTexture3))),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._mixTexture&&t.push(this._mixTexture),this._diffuseTexture1&&t.push(this._diffuseTexture1),this._diffuseTexture2&&t.push(this._diffuseTexture2),this._diffuseTexture3&&t.push(this._diffuseTexture3),this._bumpTexture1&&t.push(this._bumpTexture1),this._bumpTexture2&&t.push(this._bumpTexture2),this._bumpTexture3&&t.push(this._bumpTexture3),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._mixTexture===t||(this._diffuseTexture1===t||(this._diffuseTexture2===t||(this._diffuseTexture3===t||(this._bumpTexture1===t||(this._bumpTexture2===t||this._bumpTexture3===t))))))},t.prototype.dispose=function(t){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.TerrainMaterial",e},t.prototype.getClassName=function(){return"TerrainMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("mixTexture")],t.prototype,"_mixTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"mixTexture",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture1")],t.prototype,"_diffuseTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture1",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture2")],t.prototype,"_diffuseTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture2",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture3")],t.prototype,"_diffuseTexture3",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture3",void 0),n.a([Object(r.serializeAsTexture)("bumpTexture1")],t.prototype,"_bumpTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture1",void 0),n.a([Object(r.serializeAsTexture)("bumpTexture2")],t.prototype,"_bumpTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture2",void 0),n.a([Object(r.serializeAsTexture)("bumpTexture3")],t.prototype,"_bumpTexture3",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture3",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"specularColor",void 0),n.a([Object(r.serialize)()],t.prototype,"specularPower",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.TerrainMaterial"]=f,i.d(t,"TerrainMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\n\nuniform vec4 topColor;\nuniform vec4 bottomColor;\nuniform float offset;\nuniform float scale;\nuniform float smoothness;\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\nfloat h=vPosition.y*scale+offset;\nfloat mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));\nvec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));\n\nvec3 diffuseColor=baseColor.rgb;\n\nfloat alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef EMISSIVE\nvec3 diffuseBase=baseColor.rgb;\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);\n#endif\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.gradientPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\nvPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.gradientVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.EMISSIVE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n._maxSimultaneousLights=4,n.topColor=new r.Color3(1,0,0),n.topColorAlpha=1,n.bottomColor=new r.Color3(0,0,1),n.bottomColorAlpha=1,n.offset=0,n.scale=1,n.smoothness=1,n._disableLighting=!1,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1||this.topColorAlpha<1||this.bottomColorAlpha<1},t.prototype.needAlphaTesting=function(){return!0},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),n.EMISSIVE=this._disableLighting,r.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","topColor","bottomColor","offset","smoothness","scale"],d=[],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:4}),t.setEffect(o.getEngine().createEffect("gradient",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,a),this._mustRebind(n,a)&&(r.MaterialHelper.BindClipPlane(a,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._activeEffect.setColor4("topColor",this.topColor,this.topColorAlpha),this._activeEffect.setColor4("bottomColor",this.bottomColor,this.bottomColorAlpha),this._activeEffect.setFloat("offset",this.offset),this._activeEffect.setFloat("scale",this.scale),this._activeEffect.setFloat("smoothness",this.smoothness),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){return[]},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.GradientMaterial",e},t.prototype.getClassName=function(){return"GradientMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"topColor",void 0),n.a([Object(r.serialize)()],t.prototype,"topColorAlpha",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"bottomColor",void 0),n.a([Object(r.serialize)()],t.prototype,"bottomColorAlpha",void 0),n.a([Object(r.serialize)()],t.prototype,"offset",void 0),n.a([Object(r.serialize)()],t.prototype,"scale",void 0),n.a([Object(r.serialize)()],t.prototype,"smoothness",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.GradientMaterial"]=f,i.d(t,"GradientMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\nvoid main(void)\n{\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.cellPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.cellVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.NDOTL=!0,t.CUSTOMUSERLIGHTING=!0,t.CELLBASIC=!0,t.DEPTHPREPASS=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n._computeHighLevel=!1,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(n.CELLBASIC=!this.computeHighLevel,r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix"],d=["diffuseSampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("cell",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights-1}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this._maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._diffuseTexture===t},t.prototype.dispose=function(t){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.getClassName=function(){return"CellMaterial"},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.CellMaterial",e},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsColor3)("diffuse")],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("computeHighLevel")],t.prototype,"_computeHighLevel",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"computeHighLevel",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.CellMaterial"]=f,i.d(t,"CellMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;\nuniform vec3 mainColor;\nuniform vec3 lineColor;\nuniform vec4 gridControl;\nuniform vec3 gridOffset;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\nfloat getVisibility(float position) {\n\nfloat majorGridFrequency=gridControl.y;\nif (floor(position+0.5) == floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{\nreturn 1.0;\n}\nreturn gridControl.z;\n}\nfloat getAnisotropicAttenuation(float differentialLength) {\nconst float maxNumberOfLines=10.0;\nreturn clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);\n}\nfloat isPointOnLine(float position,float differentialLength) {\nfloat fractionPartOfPosition=position-floor(position+0.5);\nfractionPartOfPosition/=differentialLength;\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);\nfloat result=0.5+0.5*cos(fractionPartOfPosition*PI);\nreturn result;\n}\nfloat contributionOnAxis(float position) {\nfloat differentialLength=length(vec2(dFdx(position),dFdy(position)));\ndifferentialLength*=SQRT2;\n\nfloat result=isPointOnLine(position,differentialLength);\n\nfloat visibility=getVisibility(position);\nresult*=visibility;\n\nfloat anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);\nresult*=anisotropicAttenuation;\nreturn result;\n}\nfloat normalImpactOnAxis(float x) {\nfloat normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);\nreturn normalImpact;\n}\nvoid main(void) {\n\nfloat gridRatio=gridControl.x;\nvec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;\n\nfloat x=contributionOnAxis(gridPos.x);\nfloat y=contributionOnAxis(gridPos.y);\nfloat z=contributionOnAxis(gridPos.z);\n\nvec3 normal=normalize(vNormal);\nx*=normalImpactOnAxis(normal.x);\ny*=normalImpactOnAxis(normal.y);\nz*=normalImpactOnAxis(normal.z);\n\nfloat grid=clamp(x+y+z,0.,1.);\n\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\n\ngl_FragColor=vec4(color.rgb,opacity);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n}";r.Effect.ShadersStore.gridPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\nvoid main(void) {\n#include\n#ifdef FOG\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#endif\n#include\nvec4 cameraSpacePosition=view*finalWorld*vec4(position,1.0);\ngl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\nvPosition=position;\nvNormal=normal;\n}";r.Effect.ShadersStore.gridVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.OPACITY=!1,t.TRANSPARENT=!1,t.FOG=!1,t.PREMULTIPLYALPHA=!1,t.UV1=!1,t.UV2=!1,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.mainColor=r.Color3.Black(),n.lineColor=r.Color3.Teal(),n.gridRatio=1,n.gridOffset=r.Vector3.Zero(),n.majorUnitFrequency=10,n.minorUnitVisibility=.33,n.opacity=1,n.preMultiplyAlpha=!1,n._gridControl=new r.Vector4(n.gridRatio,n.majorUnitFrequency,n.minorUnitVisibility,n.opacity),n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()},t.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;if(n.TRANSPARENT!==this.opacity<1&&(n.TRANSPARENT=!n.TRANSPARENT,n.markAsUnprocessed()),n.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(n.PREMULTIPLYALPHA=!n.PREMULTIPLYALPHA,n.markAsUnprocessed()),n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._opacityTexture&&r.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;n._needUVs=!0,n.OPACITY=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,!1,this.fogEnabled,!1,n),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,o.getEngine(),n,!!i),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial(),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!1);var a=[r.VertexBuffer.PositionKind,r.VertexBuffer.NormalKind];n.UV1&&a.push(r.VertexBuffer.UVKind),n.UV2&&a.push(r.VertexBuffer.UV2Kind),r.MaterialHelper.PrepareAttributesForInstances(a,n);var f=n.toString();t.setEffect(o.getEngine().createEffect("grid",a,["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos"],["opacitySampler"],f,void 0,this.onCompiled,this.onError),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,o.INSTANCES||this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",n.getViewMatrix()),this._activeEffect.setMatrix("projection",n.getProjectionMatrix()),this._mustRebind(n,a)&&(this._activeEffect.setColor3("mainColor",this.mainColor),this._activeEffect.setColor3("lineColor",this.lineColor),this._activeEffect.setVector3("gridOffset",this.gridOffset),this._gridControl.x=this.gridRatio,this._gridControl.y=Math.round(this.majorUnitFrequency),this._gridControl.z=this.minorUnitVisibility,this._gridControl.w=this.opacity,this._activeEffect.setVector4("gridControl",this._gridControl),this._opacityTexture&&r.MaterialFlags.OpacityTextureEnabled&&(this._activeEffect.setTexture("opacitySampler",this._opacityTexture),this._activeEffect.setFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),this._activeEffect.setMatrix("opacityMatrix",this._opacityTexture.getTextureMatrix()))),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.GridMaterial",e},t.prototype.getClassName=function(){return"GridMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsColor3)()],t.prototype,"mainColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"lineColor",void 0),n.a([Object(r.serialize)()],t.prototype,"gridRatio",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"gridOffset",void 0),n.a([Object(r.serialize)()],t.prototype,"majorUnitFrequency",void 0),n.a([Object(r.serialize)()],t.prototype,"minorUnitVisibility",void 0),n.a([Object(r.serialize)()],t.prototype,"opacity",void 0),n.a([Object(r.serialize)()],t.prototype,"preMultiplyAlpha",void 0),n.a([Object(r.serializeAsTexture)("opacityTexture")],t.prototype,"_opacityTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityTexture",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.GridMaterial"]=f,i.d(t,"GridMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.simplePixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.simpleVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix"],d=["diffuseSampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("simple",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights-1}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this.diffuseTexture===t},t.prototype.dispose=function(t){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.SimpleMaterial",e},t.prototype.getClassName=function(){return"SimpleMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsColor3)("diffuse")],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.SimpleMaterial"]=f,i.d(t,"SimpleMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n\nuniform float time;\nuniform float speed;\nuniform float movingSpeed;\nuniform vec3 fogColor;\nuniform sampler2D noiseTexture;\nuniform float fogDensity;\n\nvarying float noise;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nfloat random( vec3 scale,float seed ){\nreturn fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;\n}\nvoid main(void) {\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#ifdef DIFFUSE\n\nvec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );\nvec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time*0.02;\nvec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;\nT1.x+=noiseTex.x*2.0;\nT1.y+=noiseTex.y*2.0;\nT2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;\nT2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;\nfloat p=texture2D( noiseTexture,T1*3.0 ).a;\nvec4 lavaColor=texture2D( diffuseSampler,T2*4.0);\nvec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );\nbaseColor=temp;\nfloat depth=gl_FragCoord.z*4.0;\nconst float LOG2=1.442695;\nfloat fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );\nfogFactor=1.0-clamp( fogFactor,0.0,1.0 );\nbaseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );\ndiffuseColor=baseColor.rgb;\n\n\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.lavaPixelShader=o;var a="precision highp float;\n\nuniform float time;\nuniform float lowFrequencySpeed;\n\nvarying float noise;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n\n\n\nvec3 mod289(vec3 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 mod289(vec4 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 permute(vec4 x)\n{\nreturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\nreturn 1.79284291400159-0.85373472095314*r;\n}\nvec3 fade(vec3 t) {\nreturn t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\nfloat pnoise(vec3 P,vec3 rep)\n{\nvec3 Pi0=mod(floor(P),rep);\nvec3 Pi1=mod(Pi0+vec3(1.0),rep);\nPi0=mod289(Pi0);\nPi1=mod289(Pi1);\nvec3 Pf0=fract(P);\nvec3 Pf1=Pf0-vec3(1.0);\nvec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);\nvec4 iy=vec4(Pi0.yy,Pi1.yy);\nvec4 iz0=Pi0.zzzz;\nvec4 iz1=Pi1.zzzz;\nvec4 ixy=permute(permute(ix)+iy);\nvec4 ixy0=permute(ixy+iz0);\nvec4 ixy1=permute(ixy+iz1);\nvec4 gx0=ixy0*(1.0/7.0);\nvec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;\ngx0=fract(gx0);\nvec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);\nvec4 sz0=step(gz0,vec4(0.0));\ngx0-=sz0*(step(0.0,gx0)-0.5);\ngy0-=sz0*(step(0.0,gy0)-0.5);\nvec4 gx1=ixy1*(1.0/7.0);\nvec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;\ngx1=fract(gx1);\nvec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);\nvec4 sz1=step(gz1,vec4(0.0));\ngx1-=sz1*(step(0.0,gx1)-0.5);\ngy1-=sz1*(step(0.0,gy1)-0.5);\nvec3 g000=vec3(gx0.x,gy0.x,gz0.x);\nvec3 g100=vec3(gx0.y,gy0.y,gz0.y);\nvec3 g010=vec3(gx0.z,gy0.z,gz0.z);\nvec3 g110=vec3(gx0.w,gy0.w,gz0.w);\nvec3 g001=vec3(gx1.x,gy1.x,gz1.x);\nvec3 g101=vec3(gx1.y,gy1.y,gz1.y);\nvec3 g011=vec3(gx1.z,gy1.z,gz1.z);\nvec3 g111=vec3(gx1.w,gy1.w,gz1.w);\nvec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));\ng000*=norm0.x;\ng010*=norm0.y;\ng100*=norm0.z;\ng110*=norm0.w;\nvec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));\ng001*=norm1.x;\ng011*=norm1.y;\ng101*=norm1.z;\ng111*=norm1.w;\nfloat n000=dot(g000,Pf0);\nfloat n100=dot(g100,vec3(Pf1.x,Pf0.yz));\nfloat n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));\nfloat n110=dot(g110,vec3(Pf1.xy,Pf0.z));\nfloat n001=dot(g001,vec3(Pf0.xy,Pf1.z));\nfloat n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));\nfloat n011=dot(g011,vec3(Pf0.x,Pf1.yz));\nfloat n111=dot(g111,Pf1);\nvec3 fade_xyz=fade(Pf0);\nvec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);\nvec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);\nfloat n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);\nreturn 2.2*n_xyz;\n}\n\nfloat turbulence( vec3 p ) {\nfloat w=100.0;\nfloat t=-.5;\nfor (float f=1.0 ; f<=10.0 ; f++ ){\nfloat power=pow( 2.0,f );\nt+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );\n}\nreturn t;\n}\nvoid main(void) {\n#include\n#include\n#ifdef NORMAL\n\nnoise=10.0*-.10*turbulence( .5*normal+time*1.15 );\n\nfloat b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );\n\nfloat displacement =-1.5*noise+b;\n\nvec3 newPosition=position+normal*displacement;\ngl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}";r.Effect.ShadersStore.lavaVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.LIGHT0=!1,t.LIGHT1=!1,t.LIGHT2=!1,t.LIGHT3=!1,t.SPOTLIGHT0=!1,t.SPOTLIGHT1=!1,t.SPOTLIGHT2=!1,t.SPOTLIGHT3=!1,t.HEMILIGHT0=!1,t.HEMILIGHT1=!1,t.HEMILIGHT2=!1,t.HEMILIGHT3=!1,t.DIRLIGHT0=!1,t.DIRLIGHT1=!1,t.DIRLIGHT2=!1,t.DIRLIGHT3=!1,t.POINTLIGHT0=!1,t.POINTLIGHT1=!1,t.POINTLIGHT2=!1,t.POINTLIGHT3=!1,t.SHADOW0=!1,t.SHADOW1=!1,t.SHADOW2=!1,t.SHADOW3=!1,t.SHADOWS=!1,t.SHADOWESM0=!1,t.SHADOWESM1=!1,t.SHADOWESM2=!1,t.SHADOWESM3=!1,t.SHADOWPOISSON0=!1,t.SHADOWPOISSON1=!1,t.SHADOWPOISSON2=!1,t.SHADOWPOISSON3=!1,t.SHADOWPCF0=!1,t.SHADOWPCF1=!1,t.SHADOWPCF2=!1,t.SHADOWPCF3=!1,t.SHADOWPCSS0=!1,t.SHADOWPCSS1=!1,t.SHADOWPCSS2=!1,t.SHADOWPCSS3=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.UNLIT=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.speed=1,n.movingSpeed=1,n.lowFrequencySpeed=1,n.fogDensity=.15,n._lastTime=0,n.diffuseColor=new r.Color3(1,1,1),n._disableLighting=!1,n._unlit=!1,n._maxSimultaneousLights=4,n._scaledDiffuse=new r.Color3,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=!0,r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","time","speed","movingSpeed","fogColor","fogDensity","lowFrequencySpeed"],d=["diffuseSampler","noiseTexture"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("lava",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,o.UNLIT=this._unlit,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),this.noiseTexture&&this._activeEffect.setTexture("noiseTexture",this.noiseTexture),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._lastTime+=n.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime*this.speed/1e3),this.fogColor||(this.fogColor=r.Color3.Black()),this._activeEffect.setColor3("fogColor",this.fogColor),this._activeEffect.setFloat("fogDensity",this.fogDensity),this._activeEffect.setFloat("lowFrequencySpeed",this.lowFrequencySpeed),this._activeEffect.setFloat("movingSpeed",this.movingSpeed),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.noiseTexture&&this.noiseTexture.animations&&this.noiseTexture.animations.length>0&&e.push(this.noiseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this.diffuseTexture===t},t.prototype.dispose=function(t){this.diffuseTexture&&this.diffuseTexture.dispose(),this.noiseTexture&&this.noiseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.LavaMaterial",e},t.prototype.getClassName=function(){return"LavaMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsTexture)()],t.prototype,"noiseTexture",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"fogColor",void 0),n.a([Object(r.serialize)()],t.prototype,"speed",void 0),n.a([Object(r.serialize)()],t.prototype,"movingSpeed",void 0),n.a([Object(r.serialize)()],t.prototype,"lowFrequencySpeed",void 0),n.a([Object(r.serialize)()],t.prototype,"fogDensity",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("unlit")],t.prototype,"_unlit",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"unlit",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.LavaMaterial"]=f,i.d(t,"LavaMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform float alpha;\nuniform vec3 shadowColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..1]\n\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.shadowOnlyPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.shadowOnlyVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.shadowColor=r.Color3.Black(),n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return!0},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},Object.defineProperty(t.prototype,"activeLight",{get:function(){return this._activeLight},set:function(e){this._activeLight=e},enumerable:!0,configurable:!0}),t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(this._activeLight)for(var f=0,l=e.lightSources;f0&&d.addCPUSkinningFallback(0,e);var p=[r.VertexBuffer.PositionKind];n.NORMAL&&p.push(r.VertexBuffer.NormalKind),r.MaterialHelper.PrepareAttributesForBones(p,e,n,d),r.MaterialHelper.PrepareAttributesForInstances(p,n);var h=n.toString(),v=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4"],m=new Array,g=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:v,uniformBuffersNames:g,samplers:m,defines:n,maxSimultaneousLights:1}),t.setEffect(o.getEngine().createEffect("shadowOnly",{attributes:p,uniformsNames:v,uniformBuffersNames:g,samplers:m,defines:h,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),r.MaterialHelper.BindEyePosition(a,n)),n.lightsEnabled&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,1),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.ShadowOnlyMaterial",e},t.prototype.getClassName=function(){return"ShadowOnlyMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.ShadowOnlyMaterial"]=f,i.d(t,"ShadowOnlyMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D mixMap1Sampler;\nuniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform sampler2D diffuse4Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\nuniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;\nuniform sampler2D diffuse6Sampler;\nuniform sampler2D diffuse7Sampler;\nuniform sampler2D diffuse8Sampler;\nuniform vec2 diffuse5Infos;\nuniform vec2 diffuse6Infos;\nuniform vec2 diffuse7Infos;\nuniform vec2 diffuse8Infos;\n#endif\n#endif\n\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 finalMixColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\nvec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);\ndiffuse1Color.rgb*=mixColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);\ndiffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);\nvec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);\nvec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);\nvec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);\ndiffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);\ndiffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);\ndiffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.mixPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.mixVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.MIXMAP2=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.specularColor=new r.Color3(0,0,0),n.specularPower=64,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(o.texturesEnabled){if(!this._mixTexture1||!this._mixTexture1.isReady())return!1;if(n._needUVs=!0,r.MaterialFlags.DiffuseTextureEnabled){if(!this._diffuseTexture1||!this._diffuseTexture1.isReady())return!1;if(n.DIFFUSE=!0,!this._diffuseTexture2||!this._diffuseTexture2.isReady())return!1;if(!this._diffuseTexture3||!this._diffuseTexture3.isReady())return!1;if(!this._diffuseTexture4||!this._diffuseTexture4.isReady())return!1;if(this._mixTexture2){if(!this._mixTexture2.isReady())return!1;if(n.MIXMAP2=!0,!this._diffuseTexture5||!this._diffuseTexture5.isReady())return!1;if(!this._diffuseTexture6||!this._diffuseTexture6.isReady())return!1;if(!this._diffuseTexture7||!this._diffuseTexture7.isReady())return!1;if(!this._diffuseTexture8||!this._diffuseTexture8.isReady())return!1}}}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos","diffuse4Infos","diffuse5Infos","diffuse6Infos","diffuse7Infos","diffuse8Infos"],d=["mixMap1Sampler","mixMap2Sampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","diffuse4Sampler","diffuse5Sampler","diffuse6Sampler","diffuse7Sampler","diffuse8Sampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("mix",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this._mixTexture1&&(this._activeEffect.setTexture("mixMap1Sampler",this._mixTexture1),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture1.coordinatesIndex,this._mixTexture1.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture1.getTextureMatrix()),r.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale)),this._diffuseTexture4&&(this._activeEffect.setTexture("diffuse4Sampler",this._diffuseTexture4),this._activeEffect.setFloat2("diffuse4Infos",this._diffuseTexture4.uScale,this._diffuseTexture4.vScale)))),this._mixTexture2&&(this._activeEffect.setTexture("mixMap2Sampler",this._mixTexture2),r.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture5&&(this._activeEffect.setTexture("diffuse5Sampler",this._diffuseTexture5),this._activeEffect.setFloat2("diffuse5Infos",this._diffuseTexture5.uScale,this._diffuseTexture5.vScale)),this._diffuseTexture6&&(this._activeEffect.setTexture("diffuse6Sampler",this._diffuseTexture6),this._activeEffect.setFloat2("diffuse6Infos",this._diffuseTexture6.uScale,this._diffuseTexture6.vScale)),this._diffuseTexture7&&(this._activeEffect.setTexture("diffuse7Sampler",this._diffuseTexture7),this._activeEffect.setFloat2("diffuse7Infos",this._diffuseTexture7.uScale,this._diffuseTexture7.vScale)),this._diffuseTexture8&&(this._activeEffect.setTexture("diffuse8Sampler",this._diffuseTexture8),this._activeEffect.setFloat2("diffuse8Infos",this._diffuseTexture8.uScale,this._diffuseTexture8.vScale)))),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._mixTexture1&&this._mixTexture1.animations&&this._mixTexture1.animations.length>0&&e.push(this._mixTexture1),this._mixTexture2&&this._mixTexture2.animations&&this._mixTexture2.animations.length>0&&e.push(this._mixTexture2),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._mixTexture1&&t.push(this._mixTexture1),this._diffuseTexture1&&t.push(this._diffuseTexture1),this._diffuseTexture2&&t.push(this._diffuseTexture2),this._diffuseTexture3&&t.push(this._diffuseTexture3),this._diffuseTexture4&&t.push(this._diffuseTexture4),this._mixTexture2&&t.push(this._mixTexture2),this._diffuseTexture5&&t.push(this._diffuseTexture5),this._diffuseTexture6&&t.push(this._diffuseTexture6),this._diffuseTexture7&&t.push(this._diffuseTexture7),this._diffuseTexture8&&t.push(this._diffuseTexture8),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._mixTexture1===t||(this._diffuseTexture1===t||(this._diffuseTexture2===t||(this._diffuseTexture3===t||(this._diffuseTexture4===t||(this._mixTexture2===t||(this._diffuseTexture5===t||(this._diffuseTexture6===t||(this._diffuseTexture7===t||this._diffuseTexture8===t)))))))))},t.prototype.dispose=function(t){this._mixTexture1&&this._mixTexture1.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.MixMaterial",e},t.prototype.getClassName=function(){return"MixMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("mixTexture1")],t.prototype,"_mixTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"mixTexture1",void 0),n.a([Object(r.serializeAsTexture)("mixTexture2")],t.prototype,"_mixTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"mixTexture2",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture1")],t.prototype,"_diffuseTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture1",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture2")],t.prototype,"_diffuseTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture2",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture3")],t.prototype,"_diffuseTexture3",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture3",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture4")],t.prototype,"_diffuseTexture4",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture4",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture1")],t.prototype,"_diffuseTexture5",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture5",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture2")],t.prototype,"_diffuseTexture6",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture6",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture3")],t.prototype,"_diffuseTexture7",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture7",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture4")],t.prototype,"_diffuseTexture8",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture8",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"specularColor",void 0),n.a([Object(r.serialize)()],t.prototype,"specularPower",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.MixMaterial"]=f,i.d(t,"MixMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=baseColor.rgb;\n#endif\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.normalPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.normalVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.LIGHT0=!1,t.LIGHT1=!1,t.LIGHT2=!1,t.LIGHT3=!1,t.SPOTLIGHT0=!1,t.SPOTLIGHT1=!1,t.SPOTLIGHT2=!1,t.SPOTLIGHT3=!1,t.HEMILIGHT0=!1,t.HEMILIGHT1=!1,t.HEMILIGHT2=!1,t.HEMILIGHT3=!1,t.DIRLIGHT0=!1,t.DIRLIGHT1=!1,t.DIRLIGHT2=!1,t.DIRLIGHT3=!1,t.POINTLIGHT0=!1,t.POINTLIGHT1=!1,t.POINTLIGHT2=!1,t.POINTLIGHT3=!1,t.SHADOW0=!1,t.SHADOW1=!1,t.SHADOW2=!1,t.SHADOW3=!1,t.SHADOWS=!1,t.SHADOWESM0=!1,t.SHADOWESM1=!1,t.SHADOWESM2=!1,t.SHADOWESM3=!1,t.SHADOWPOISSON0=!1,t.SHADOWPOISSON1=!1,t.SHADOWPOISSON2=!1,t.SHADOWPOISSON3=!1,t.SHADOWPCF0=!1,t.SHADOWPCF1=!1,t.SHADOWPCF2=!1,t.SHADOWPCF3=!1,t.SHADOWPCSS0=!1,t.SHADOWPCSS1=!1,t.SHADOWPCSS2=!1,t.SHADOWPCSS3=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.LIGHTING=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()||e.visibility<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=!0,r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),n.LIGHTING=!this._disableLighting,r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix"],d=["diffuseSampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:4}),t.setEffect(o.getEngine().createEffect("normal",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this.diffuseTexture===t},t.prototype.dispose=function(t){this.diffuseTexture&&this.diffuseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.NormalMaterial",e},t.prototype.getClassName=function(){return"NormalMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.NormalMaterial"]=f,i.d(t,"NormalMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o=function(){return function(){}}(),a=function(){return function(){}}(),s=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.CustomParts=new a,n.customShaderNameResolve=n.Builder,n.FragmentShader=r.Effect.ShadersStore.defaultPixelShader,n.VertexShader=r.Effect.ShadersStore.defaultVertexShader,n}return n.b(t,e),t.prototype.AttachAfterBind=function(e,t){for(var i in this._newUniformInstances){"vec2"==(n=i.toString().split("-"))[0]?t.setVector2(n[1],this._newUniformInstances[i]):"vec3"==n[0]?t.setVector3(n[1],this._newUniformInstances[i]):"vec4"==n[0]?t.setVector4(n[1],this._newUniformInstances[i]):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[i]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[i])}for(var i in this._newSamplerInstances){var n;"sampler2D"==(n=i.toString().split("-"))[0]&&this._newSamplerInstances[i].isReady&&this._newSamplerInstances[i].isReady()&&t.setTexture(n[1],this._newSamplerInstances[i])}},t.prototype.ReviewUniform=function(e,t){if("uniform"==e)for(var i in this._newUniforms)-1==this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);if("sampler"==e)for(var i in this._newUniforms)-1!=this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);return t},t.prototype.Builder=function(e,i,n,o,a){var s=this;if(this._isCreatedShader)return this._createdShaderName;this._isCreatedShader=!1,t.ShaderIndexer++;var f="custom_"+t.ShaderIndexer;this.ReviewUniform("uniform",i),this.ReviewUniform("sampler",o);var l=this._afterBind.bind(this);return this._afterBind=function(e,t){if(t){s.AttachAfterBind(e,t);try{l(e,t)}catch(t){}}},r.Effect.ShadersStore[f+"VertexShader"]=this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN",this.CustomParts.Vertex_Begin?this.CustomParts.Vertex_Begin:"").replace("#define CUSTOM_VERTEX_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Vertex_Definitions?this.CustomParts.Vertex_Definitions:"")).replace("#define CUSTOM_VERTEX_MAIN_BEGIN",this.CustomParts.Vertex_MainBegin?this.CustomParts.Vertex_MainBegin:"").replace("#define CUSTOM_VERTEX_UPDATE_POSITION",this.CustomParts.Vertex_Before_PositionUpdated?this.CustomParts.Vertex_Before_PositionUpdated:"").replace("#define CUSTOM_VERTEX_UPDATE_NORMAL",this.CustomParts.Vertex_Before_NormalUpdated?this.CustomParts.Vertex_Before_NormalUpdated:"").replace("#define CUSTOM_VERTEX_MAIN_END",this.CustomParts.Vertex_MainEnd?this.CustomParts.Vertex_MainEnd:""),r.Effect.ShadersStore[f+"PixelShader"]=this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN",this.CustomParts.Fragment_Begin?this.CustomParts.Fragment_Begin:"").replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN",this.CustomParts.Fragment_MainBegin?this.CustomParts.Fragment_MainBegin:"").replace("#define CUSTOM_FRAGMENT_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Fragment_Definitions?this.CustomParts.Fragment_Definitions:"")).replace("#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE",this.CustomParts.Fragment_Custom_Diffuse?this.CustomParts.Fragment_Custom_Diffuse:"").replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA",this.CustomParts.Fragment_Custom_Alpha?this.CustomParts.Fragment_Custom_Alpha:"").replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS",this.CustomParts.Fragment_Before_Lights?this.CustomParts.Fragment_Before_Lights:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FOG",this.CustomParts.Fragment_Before_Fog?this.CustomParts.Fragment_Before_Fog:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR",this.CustomParts.Fragment_Before_FragColor?this.CustomParts.Fragment_Before_FragColor:""),this._isCreatedShader=!0,this._createdShaderName=f,f},t.prototype.AddUniform=function(e,t,i){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances=new Array,this._newUniformInstances=new Array),i&&(t.indexOf("sampler"),this._newUniformInstances[t+"-"+e]=i),this._customUniform.push("uniform "+t+" "+e+";"),this._newUniforms.push(e),this},t.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},t.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},t.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},t.prototype.Fragment_Custom_Diffuse=function(e){return this.CustomParts.Fragment_Custom_Diffuse=e.replace("result","diffuseColor"),this},t.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},t.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},t.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},t.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},t.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},t.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},t.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},t.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},t.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},t.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},t.ShaderIndexer=1,t}(r.StandardMaterial);r._TypeStore.RegisteredTypes["BABYLON.CustomMaterial"]=s;var f=function(){return function(){}}(),l=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.CustomParts=new f,n.customShaderNameResolve=n.Builder,n.FragmentShader=r.Effect.ShadersStore.pbrPixelShader,n.VertexShader=r.Effect.ShadersStore.pbrVertexShader,n}return n.b(t,e),t.prototype.AttachAfterBind=function(e,t){for(var i in this._newUniformInstances){"vec2"==(n=i.toString().split("-"))[0]?t.setVector2(n[1],this._newUniformInstances[i]):"vec3"==n[0]?t.setVector3(n[1],this._newUniformInstances[i]):"vec4"==n[0]?t.setVector4(n[1],this._newUniformInstances[i]):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[i]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[i])}for(var i in this._newSamplerInstances){var n;"sampler2D"==(n=i.toString().split("-"))[0]&&this._newSamplerInstances[i].isReady&&this._newSamplerInstances[i].isReady()&&t.setTexture(n[1],this._newSamplerInstances[i])}},t.prototype.ReviewUniform=function(e,t){if("uniform"==e)for(var i in this._newUniforms)-1==this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);if("sampler"==e)for(var i in this._newUniforms)-1!=this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);return t},t.prototype.Builder=function(e,i,n,o,a){var s=this;if(this._isCreatedShader)return this._createdShaderName;this._isCreatedShader=!1,t.ShaderIndexer++;var f="custom_"+t.ShaderIndexer;this.ReviewUniform("uniform",i),this.ReviewUniform("sampler",o);var l=this._afterBind.bind(this);return this._afterBind=function(e,t){if(t){s.AttachAfterBind(e,t);try{l(e,t)}catch(t){}}},r.Effect.ShadersStore[f+"VertexShader"]=this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN",this.CustomParts.Vertex_Begin?this.CustomParts.Vertex_Begin:"").replace("#define CUSTOM_VERTEX_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Vertex_Definitions?this.CustomParts.Vertex_Definitions:"")).replace("#define CUSTOM_VERTEX_MAIN_BEGIN",this.CustomParts.Vertex_MainBegin?this.CustomParts.Vertex_MainBegin:"").replace("#define CUSTOM_VERTEX_UPDATE_POSITION",this.CustomParts.Vertex_Before_PositionUpdated?this.CustomParts.Vertex_Before_PositionUpdated:"").replace("#define CUSTOM_VERTEX_UPDATE_NORMAL",this.CustomParts.Vertex_Before_NormalUpdated?this.CustomParts.Vertex_Before_NormalUpdated:"").replace("#define CUSTOM_VERTEX_MAIN_END",this.CustomParts.Vertex_MainEnd?this.CustomParts.Vertex_MainEnd:""),r.Effect.ShadersStore[f+"PixelShader"]=this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN",this.CustomParts.Fragment_Begin?this.CustomParts.Fragment_Begin:"").replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN",this.CustomParts.Fragment_MainBegin?this.CustomParts.Fragment_MainBegin:"").replace("#define CUSTOM_FRAGMENT_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Fragment_Definitions?this.CustomParts.Fragment_Definitions:"")).replace("#define CUSTOM_FRAGMENT_UPDATE_ALBEDO",this.CustomParts.Fragment_Custom_Albedo?this.CustomParts.Fragment_Custom_Albedo:"").replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA",this.CustomParts.Fragment_Custom_Alpha?this.CustomParts.Fragment_Custom_Alpha:"").replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS",this.CustomParts.Fragment_Before_Lights?this.CustomParts.Fragment_Before_Lights:"").replace("#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS",this.CustomParts.Fragment_Custom_MetallicRoughness?this.CustomParts.Fragment_Custom_MetallicRoughness:"").replace("#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE",this.CustomParts.Fragment_Custom_MicroSurface?this.CustomParts.Fragment_Custom_MicroSurface:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FOG",this.CustomParts.Fragment_Before_Fog?this.CustomParts.Fragment_Before_Fog:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR",this.CustomParts.Fragment_Before_FragColor?this.CustomParts.Fragment_Before_FragColor:""),this._isCreatedShader=!0,this._createdShaderName=f,f},t.prototype.AddUniform=function(e,t,i){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances=new Array,this._newUniformInstances=new Array),i&&(t.indexOf("sampler"),this._newUniformInstances[t+"-"+e]=i),this._customUniform.push("uniform "+t+" "+e+";"),this._newUniforms.push(e),this},t.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},t.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},t.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},t.prototype.Fragment_Custom_Albedo=function(e){return this.CustomParts.Fragment_Custom_Albedo=e.replace("result","surfaceAlbedo"),this},t.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},t.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},t.prototype.Fragment_Custom_MetallicRoughness=function(e){return this.CustomParts.Fragment_Custom_MetallicRoughness=e,this},t.prototype.Fragment_Custom_MicroSurface=function(e){return this.CustomParts.Fragment_Custom_MicroSurface=e,this},t.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},t.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},t.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},t.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},t.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},t.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},t.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},t.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},t.ShaderIndexer=1,t}(r.PBRMaterial);r._TypeStore.RegisteredTypes["BABYLON.PBRCustomMaterial"]=l,i.d(t,"CustomShaderStructure",function(){return o}),i.d(t,"ShaderSpecialParts",function(){return a}),i.d(t,"CustomMaterial",function(){return s}),i.d(t,"ShaderAlebdoParts",function(){return f}),i.d(t,"PBRCustomMaterial",function(){return l})},function(e,t,i){"use strict";i.r(t);var n=i(10);i.d(t,"CellMaterial",function(){return n.CellMaterial});var r=i(17);i.d(t,"CustomShaderStructure",function(){return r.CustomShaderStructure}),i.d(t,"ShaderSpecialParts",function(){return r.ShaderSpecialParts}),i.d(t,"CustomMaterial",function(){return r.CustomMaterial}),i.d(t,"ShaderAlebdoParts",function(){return r.ShaderAlebdoParts}),i.d(t,"PBRCustomMaterial",function(){return r.PBRCustomMaterial});var o=i(5);i.d(t,"FireMaterial",function(){return o.FireMaterial});var a=i(7);i.d(t,"FurMaterial",function(){return a.FurMaterial});var s=i(9);i.d(t,"GradientMaterial",function(){return s.GradientMaterial});var f=i(11);i.d(t,"GridMaterial",function(){return f.GridMaterial});var l=i(13);i.d(t,"LavaMaterial",function(){return l.LavaMaterial});var u=i(15);i.d(t,"MixMaterial",function(){return u.MixMaterial});var c=i(16);i.d(t,"NormalMaterial",function(){return c.NormalMaterial});var d=i(14);i.d(t,"ShadowOnlyMaterial",function(){return d.ShadowOnlyMaterial});var p=i(12);i.d(t,"SimpleMaterial",function(){return p.SimpleMaterial});var h=i(4);i.d(t,"SkyMaterial",function(){return h.SkyMaterial});var v=i(8);i.d(t,"TerrainMaterial",function(){return v.TerrainMaterial});var m=i(6);i.d(t,"TriPlanarMaterial",function(){return m.TriPlanarMaterial});var g=i(3);i.d(t,"WaterMaterial",function(){return g.WaterMaterial})},function(e,t,i){"use strict";i.r(t),function(e){var n=i(18);i.d(t,"CellMaterial",function(){return n.CellMaterial}),i.d(t,"CustomShaderStructure",function(){return n.CustomShaderStructure}),i.d(t,"ShaderSpecialParts",function(){return n.ShaderSpecialParts}),i.d(t,"CustomMaterial",function(){return n.CustomMaterial}),i.d(t,"ShaderAlebdoParts",function(){return n.ShaderAlebdoParts}),i.d(t,"PBRCustomMaterial",function(){return n.PBRCustomMaterial}),i.d(t,"FireMaterial",function(){return n.FireMaterial}),i.d(t,"FurMaterial",function(){return n.FurMaterial}),i.d(t,"GradientMaterial",function(){return n.GradientMaterial}),i.d(t,"GridMaterial",function(){return n.GridMaterial}),i.d(t,"LavaMaterial",function(){return n.LavaMaterial}),i.d(t,"MixMaterial",function(){return n.MixMaterial}),i.d(t,"NormalMaterial",function(){return n.NormalMaterial}),i.d(t,"ShadowOnlyMaterial",function(){return n.ShadowOnlyMaterial}),i.d(t,"SimpleMaterial",function(){return n.SimpleMaterial}),i.d(t,"SkyMaterial",function(){return n.SkyMaterial}),i.d(t,"TerrainMaterial",function(){return n.TerrainMaterial}),i.d(t,"TriPlanarMaterial",function(){return n.TriPlanarMaterial}),i.d(t,"WaterMaterial",function(){return n.WaterMaterial});var r=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in r.BABYLON=r.BABYLON||{},n)r.BABYLON[o]=n[o]}.call(this,i(2))}])}); \ 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)}function o(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=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(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n#include\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include\n#include\n\n#include\nvoid main(void) {\n\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#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else\n#ifdef REFLECTION\n\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.waterPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x == 0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include\n}\n";r.Effect.ShadersStore.waterVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.BUMP=!1,t.REFLECTION=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.SPECULARTERM=!1,t.LOGARITHMICDEPTH=!1,t.FRESNELSEPARATE=!1,t.BUMPSUPERIMPOSE=!1,t.BUMPAFFECTSREFLECTION=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i,n){void 0===n&&(n=new r.Vector2(512,512));var o=e.call(this,t,i)||this;return o.renderTargetSize=n,o.diffuseColor=new r.Color3(1,1,1),o.specularColor=new r.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new r.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new r.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new r.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.disableClipPlane=!1,o._renderTargets=new r.SmartArray(16),o._mesh=null,o._reflectionTransform=r.Matrix.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,n),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return n.b(t,e),Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!0,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var t=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=t),this._reflectionRTT&&(this._reflectionRTT.refreshRate=t)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!0,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled)){if(this.bumpTexture&&r.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;n._needUVs=!0,n.BUMP=!0}r.MaterialFlags.ReflectionTextureEnabled&&(n.REFLECTION=!0)}if(r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._areMiscDirty&&(this._fresnelSeparate&&(n.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(n.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(n.BUMPAFFECTSREFLECTION=!0)),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!0,this._maxSimultaneousLights,this._disableLighting),n._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(n),n.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,n.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),this._mesh=e,this._waitingRenderList){for(var f=0;f0&&l.addCPUSkinningFallback(0,e);var u=[r.VertexBuffer.PositionKind];n.NORMAL&&u.push(r.VertexBuffer.NormalKind),n.UV1&&u.push(r.VertexBuffer.UVKind),n.UV2&&u.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&u.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(u,e,n,l),r.MaterialHelper.PrepareAttributesForInstances(u,n);var c=n.toString(),d=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed"],p=["normalSampler","refractionSampler","reflectionSampler"],h=new Array;r.ImageProcessingConfiguration&&(r.ImageProcessingConfiguration.PrepareUniforms(d,n),r.ImageProcessingConfiguration.PrepareSamplers(p,n)),r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:h,samplers:p,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("water",{attributes:u,uniformsNames:d,uniformBuffersNames:h,samplers:p,defines:c,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;if(a&&this._mesh){this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.bumpTexture&&r.MaterialFlags.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),r.MaterialHelper.BindLogDepth(o,this._activeEffect,n),r.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var s=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(n.getProjectionMatrix()),f=n.getEngine().getDeltaTime();f!==this._lastDeltaTime&&(this._lastDeltaTime=f,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",s),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(t,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,t){var i,n=this;this._refractionRTT=new r.RenderTargetTexture(name+"_refraction",{width:t.x,height:t.y},e,!1,!0),this._refractionRTT.wrapU=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new r.RenderTargetTexture(name+"_reflection",{width:t.x,height:t.y},e,!1,!0),this._reflectionRTT.wrapU=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=r.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s=r.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(n._mesh&&(i=n._mesh.isVisible,n._mesh.isVisible=!1),!n.disableClipPlane){a=e.clipPlane;var t=n._mesh?n._mesh.position.y:0;e.clipPlane=r.Plane.FromPositionAndNormal(new r.Vector3(0,t+.05,0),new r.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){n._mesh&&(n._mesh.isVisible=i),n.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(n._mesh&&(i=n._mesh.isVisible,n._mesh.isVisible=!1),!n.disableClipPlane){a=e.clipPlane;var t=n._mesh?n._mesh.position.y:0;e.clipPlane=r.Plane.FromPositionAndNormal(new r.Vector3(0,t-.05,0),new r.Vector3(0,-1,0)),r.Matrix.ReflectionToRef(e.clipPlane,s)}o=e.getViewMatrix(),s.multiplyToRef(o,n._reflectionTransform),e.setTransformMatrix(n._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=r.Vector3.TransformCoordinates(e.activeCamera.position,s)},this._reflectionRTT.onAfterRender=function(){n._mesh&&(n._mesh.isVisible=i),e.clipPlane=a,e.setTransformMatrix(o,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&t.push(this._bumpTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._bumpTexture===t},t.prototype.dispose=function(t){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=-1,-1!=(i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.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 r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var t=0;t\n\nuniform vec3 cameraPosition;\nuniform vec3 cameraOffset;\nuniform float luminance;\nuniform float turbidity;\nuniform float rayleigh;\nuniform float mieCoefficient;\nuniform float mieDirectionalG;\nuniform vec3 sunPosition;\n\n#include\n\nconst float e=2.71828182845904523536028747135266249775724709369995957;\nconst float pi=3.141592653589793238462643383279502884197169;\nconst float n=1.0003;\nconst float N=2.545E25;\nconst float pn=0.035;\nconst vec3 lambda=vec3(680E-9,550E-9,450E-9);\nconst vec3 K=vec3(0.686,0.678,0.666);\nconst float v=4.0;\nconst float rayleighZenithLength=8.4E3;\nconst float mieZenithLength=1.25E3;\nconst vec3 up=vec3(0.0,1.0,0.0);\nconst float EE=1000.0;\nconst float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;\nconst float cutoffAngle=pi/1.95;\nconst float steepness=1.5;\nvec3 totalRayleigh(vec3 lambda)\n{\nreturn (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));\n}\nvec3 simplifiedRayleigh()\n{\nreturn 0.0005/vec3(94,40,18);\n}\nfloat rayleighPhase(float cosTheta)\n{\nreturn (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));\n}\nvec3 totalMie(vec3 lambda,vec3 K,float T)\n{\nfloat c=(0.2*T )*10E-18;\nreturn 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;\n}\nfloat hgPhase(float cosTheta,float g)\n{\nreturn (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));\n}\nfloat sunIntensity(float zenithAngleCos)\n{\nreturn EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));\n}\nfloat A=0.15;\nfloat B=0.50;\nfloat C=0.10;\nfloat D=0.20;\nfloat EEE=0.02;\nfloat F=0.30;\nfloat W=1000.0;\nvec3 Uncharted2Tonemap(vec3 x)\n{\nreturn ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;\n}\nvoid main(void) {\n\n#include\n\nfloat sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);\nfloat rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));\nvec3 sunDirection=normalize(sunPosition);\nfloat sunE=sunIntensity(dot(sunDirection,up));\nvec3 betaR=simplifiedRayleigh()*rayleighCoefficient;\nvec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;\nfloat zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition+cameraOffset))));\nfloat sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nfloat sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nvec3 Fex=exp(-(betaR*sR+betaM*sM));\nfloat cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);\nfloat rPhase=rayleighPhase(cosTheta*0.5+0.5);\nvec3 betaRTheta=betaR*rPhase;\nfloat mPhase=hgPhase(cosTheta,mieDirectionalG);\nvec3 betaMTheta=betaM*mPhase;\nvec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));\nLin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));\nvec3 direction=normalize(vPositionW-cameraPosition);\nfloat theta=acos(direction.y);\nfloat phi=atan(direction.z,direction.x);\nvec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);\nvec3 L0=vec3(0.1)*Fex;\nfloat sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);\nL0+=(sunE*19000.0*Fex)*sundisk;\nvec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));\nvec3 texColor=(Lin+L0);\ntexColor*=0.04 ;\ntexColor+=vec3(0.0,0.001,0.0025)*0.3;\nfloat g_fMaxLuminance=1.0;\nfloat fLumScaled=0.1/luminance;\nfloat fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled);\nfloat ExposureBias=fLumCompressed;\nvec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);\n\n\n\nvec3 retColor=curr*whiteScale;\n\n\nfloat alpha=1.0;\n#ifdef VERTEXCOLOR\nretColor.rgb*=vColor.rgb;\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);\n\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.skyPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\nvoid main(void) {\ngl_Position=viewProjection*world*vec4(position,1.0);\nvec4 worldPos=world*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.skyVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.POINTSIZE=!1,t.FOG=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.luminance=1,n.turbidity=10,n.rayleigh=2,n.mieCoefficient=.005,n.mieDirectionalG=.8,n.distance=500,n.inclination=.49,n.azimuth=.25,n.sunPosition=new r.Vector3(0,100,0),n.useSunPosition=!1,n.cameraOffset=r.Vector3.Zero(),n._cameraPosition=r.Vector3.Zero(),n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,!1,n),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new r.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG");var f=[r.VertexBuffer.PositionKind];n.VERTEXCOLOR&&f.push(r.VertexBuffer.ColorKind);var l=n.toString();t.setEffect(o.getEngine().createEffect("sky",f,["world","viewProjection","view","vFogInfos","vFogColor","pointSize","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","luminance","turbidity","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","cameraPosition","cameraOffset"],[],l,a,this.onCompiled,this.onError),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();if(i._materialDefines){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._mustRebind(n,o)&&(r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize)),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect);var a=n.activeCamera;if(a){var s=a.getWorldMatrix();this._cameraPosition.x=s.m[12],this._cameraPosition.y=s.m[13],this._cameraPosition.z=s.m[14],this._activeEffect.setVector3("cameraPosition",this._cameraPosition)}if(this._activeEffect.setVector3("cameraOffset",this.cameraOffset),this.luminance>0&&this._activeEffect.setFloat("luminance",this.luminance),this._activeEffect.setFloat("turbidity",this.turbidity),this._activeEffect.setFloat("rayleigh",this.rayleigh),this._activeEffect.setFloat("mieCoefficient",this.mieCoefficient),this._activeEffect.setFloat("mieDirectionalG",this.mieDirectionalG),!this.useSunPosition){var f=Math.PI*(this.inclination-.5),l=2*Math.PI*(this.azimuth-.5);this.sunPosition.x=this.distance*Math.cos(l),this.sunPosition.y=this.distance*Math.sin(l)*Math.sin(f),this.sunPosition.z=this.distance*Math.sin(l)*Math.cos(f)}this._activeEffect.setVector3("sunPosition",this.sunPosition),this._afterBind(t,this._activeEffect)}}},t.prototype.getAnimatables=function(){return[]},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.SkyMaterial",e},t.prototype.getClassName=function(){return"SkyMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serialize)()],t.prototype,"luminance",void 0),n.a([Object(r.serialize)()],t.prototype,"turbidity",void 0),n.a([Object(r.serialize)()],t.prototype,"rayleigh",void 0),n.a([Object(r.serialize)()],t.prototype,"mieCoefficient",void 0),n.a([Object(r.serialize)()],t.prototype,"mieDirectionalG",void 0),n.a([Object(r.serialize)()],t.prototype,"distance",void 0),n.a([Object(r.serialize)()],t.prototype,"inclination",void 0),n.a([Object(r.serialize)()],t.prototype,"azimuth",void 0),n.a([Object(r.serializeAsVector3)()],t.prototype,"sunPosition",void 0),n.a([Object(r.serialize)()],t.prototype,"useSunPosition",void 0),n.a([Object(r.serialize)()],t.prototype,"cameraOffset",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.SkyMaterial"]=f,i.d(t,"SkyMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\nuniform sampler2D distortionSampler;\nuniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#include\n\n#include\nvec4 bx2(vec4 x)\n{\nreturn vec4(2.0)*x-vec4(1.0);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\n\nfloat alpha=1.0;\n#ifdef DIFFUSE\n\nconst float distortionAmount0=0.092;\nconst float distortionAmount1=0.092;\nconst float distortionAmount2=0.092;\nvec2 heightAttenuation=vec2(0.3,0.39);\nvec4 noise0=texture2D(distortionSampler,vDistortionCoords1);\nvec4 noise1=texture2D(distortionSampler,vDistortionCoords2);\nvec4 noise2=texture2D(distortionSampler,vDistortionCoords3);\nvec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;\nvec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);\nvec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;\nbaseColor*=opacityColor;\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=vec4(baseColor.rgb,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.firePixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n\nuniform float time;\nuniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n\n#ifdef DIFFUSE\nvDiffuseUV=uv;\nvDiffuseUV.y-=0.2;\n#endif\n\n#include\n\n#include\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\n\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;\nvDistortionCoords1.x=uv.x;\nvDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;\nvDistortionCoords2.x=uv.x;\nvDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;\nvDistortionCoords3.x=uv.x;\nvDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n}\n";r.Effect.ShadersStore.fireVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.UV1=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.BonesPerMesh=0,t.NUM_BONE_INFLUENCERS=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.speed=1,n._scaledDiffuse=new r.Color3,n._lastTime=0,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return!1},t.prototype.needAlphaTesting=function(){return!0},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(n.ALPHATEST=!!this._opacityTexture,n._areMiscDirty&&(n.POINTSIZE=this.pointsCloud||o.forcePointsCloud,n.FOG=o.fogEnabled&&e.applyFog&&o.fogMode!==r.Scene.FOGMODE_NONE&&this.fogEnabled),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.UV1&&l.push(r.VertexBuffer.UVKind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString();t.setEffect(o.getEngine().createEffect("fire",{attributes:l,uniformsNames:["world","view","viewProjection","vEyePosition","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","time","speed"],uniformBuffersNames:[],samplers:["diffuseSampler","distortionSampler","opacitySampler"],defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:null,maxSimultaneousLights:4,transformFeedbackVaryings:null},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();if(i._materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,o)&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix()),this._activeEffect.setTexture("distortionSampler",this._distortionTexture),this._activeEffect.setTexture("opacitySampler",this._opacityTexture)),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(o,n)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._lastTime+=n.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime),this._activeEffect.setFloat("speed",this.speed),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._distortionTexture&&this._distortionTexture.animations&&this._distortionTexture.animations.length>0&&e.push(this._distortionTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._distortionTexture&&t.push(this._distortionTexture),this._opacityTexture&&t.push(this._opacityTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTexture===t||(this._distortionTexture===t||this._opacityTexture===t))},t.prototype.getClassName=function(){return"FireMaterial"},t.prototype.dispose=function(t){this._diffuseTexture&&this._diffuseTexture.dispose(),this._distortionTexture&&this._distortionTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.customType="BABYLON.FireMaterial",t.diffuseColor=this.diffuseColor.asArray(),t.speed=this.speed,this._diffuseTexture&&(t._diffuseTexture=this._diffuseTexture.serialize()),this._distortionTexture&&(t._distortionTexture=this._distortionTexture.serialize()),this._opacityTexture&&(t._opacityTexture=this._opacityTexture.serialize()),t},t.Parse=function(e,i,n){var o=new t(e.name,i);return o.diffuseColor=r.Color3.FromArray(e.diffuseColor),o.speed=e.speed,o.alpha=e.alpha,o.id=e.id,r.Tags.AddTagsTo(o,e.tags),o.backFaceCulling=e.backFaceCulling,o.wireframe=e.wireframe,e._diffuseTexture&&(o._diffuseTexture=r.Texture.Parse(e._diffuseTexture,i,n)),e._distortionTexture&&(o._distortionTexture=r.Texture.Parse(e._distortionTexture,i,n)),e._opacityTexture&&(o._opacityTexture=r.Texture.Parse(e._opacityTexture,i,n)),e.checkReadyOnlyOnce&&(o.checkReadyOnlyOnce=e.checkReadyOnlyOnce),o},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsTexture)("distortionTexture")],t.prototype,"_distortionTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"distortionTexture",void 0),n.a([Object(r.serializeAsTexture)("opacityTexture")],t.prototype,"_opacityTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityTexture",void 0),n.a([Object(r.serializeAsColor3)("diffuse")],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)()],t.prototype,"speed",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.FireMaterial"]=f,i.d(t,"FireMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\nuniform sampler2D diffuseSamplerX;\n#ifdef BUMPX\nuniform sampler2D normalSamplerX;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\nuniform sampler2D diffuseSamplerY;\n#ifdef BUMPY\nuniform sampler2D normalSamplerY;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\nuniform sampler2D diffuseSamplerZ;\n#ifdef BUMPZ\nuniform sampler2D normalSamplerZ;\n#endif\n#endif\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#include\n#include\n#include\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(0.,0.,0.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=tangentSpace[2];\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec4 baseNormal=vec4(0.0,0.0,0.0,1.0);\nnormalW*=normalW;\n#ifdef DIFFUSEX\nbaseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nnormalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.triplanarPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\n#endif\nuniform float tileSize;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void)\n{\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef DIFFUSEX\nvTextureUVX=worldPos.zy/tileSize;\n#endif\n#ifdef DIFFUSEY\nvTextureUVY=worldPos.xz/tileSize;\n#endif\n#ifdef DIFFUSEZ\nvTextureUVZ=worldPos.xy/tileSize;\n#endif\n#ifdef NORMAL\n\nvec3 xtan=vec3(0,0,1);\nvec3 xbin=vec3(0,1,0);\nvec3 ytan=vec3(1,0,0);\nvec3 ybin=vec3(0,0,1);\nvec3 ztan=vec3(1,0,0);\nvec3 zbin=vec3(0,1,0);\nvec3 normalizedNormal=normalize(normal);\nnormalizedNormal*=normalizedNormal;\nvec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);\nvec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);\nworldTangent=(world*vec4(worldTangent,1.0)).xyz;\nworldBinormal=(world*vec4(worldBinormal,1.0)).xyz;\nvec3 worldNormal=normalize(cross(worldTangent,worldBinormal));\ntangentSpace[0]=worldTangent;\ntangentSpace[1]=worldBinormal;\ntangentSpace[2]=worldNormal;\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.triplanarVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSEX=!1,t.DIFFUSEY=!1,t.DIFFUSEZ=!1,t.BUMPX=!1,t.BUMPY=!1,t.BUMPZ=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.NORMAL=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.tileSize=1,n.diffuseColor=new r.Color3(1,1,1),n.specularColor=new r.Color3(.2,.2,.2),n.specularPower=64,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&o.texturesEnabled){if(r.MaterialFlags.DiffuseTextureEnabled)for(var f=[this.diffuseTextureX,this.diffuseTextureY,this.diffuseTextureZ],l=["DIFFUSEX","DIFFUSEY","DIFFUSEZ"],u=0;u0&&c.addCPUSkinningFallback(0,e);var d=[r.VertexBuffer.PositionKind];n.NORMAL&&d.push(r.VertexBuffer.NormalKind),n.VERTEXCOLOR&&d.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(d,e,n,c),r.MaterialHelper.PrepareAttributesForInstances(d,n);var p=n.toString(),h=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","tileSize"],v=["diffuseSamplerX","diffuseSamplerY","diffuseSamplerZ","normalSamplerX","normalSamplerY","normalSamplerZ"],m=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:m,samplers:v,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("triplanar",{attributes:d,uniformsNames:h,uniformBuffersNames:m,samplers:v,defines:p,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._activeEffect.setFloat("tileSize",this.tileSize),n.getCachedMaterial()!==this&&(this.diffuseTextureX&&this._activeEffect.setTexture("diffuseSamplerX",this.diffuseTextureX),this.diffuseTextureY&&this._activeEffect.setTexture("diffuseSamplerY",this.diffuseTextureY),this.diffuseTextureZ&&this._activeEffect.setTexture("diffuseSamplerZ",this.diffuseTextureZ),this.normalTextureX&&this._activeEffect.setTexture("normalSamplerX",this.normalTextureX),this.normalTextureY&&this._activeEffect.setTexture("normalSamplerY",this.normalTextureY),this.normalTextureZ&&this._activeEffect.setTexture("normalSamplerZ",this.normalTextureZ),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTextureX&&t.push(this._diffuseTextureX),this._diffuseTextureY&&t.push(this._diffuseTextureY),this._diffuseTextureZ&&t.push(this._diffuseTextureZ),this._normalTextureX&&t.push(this._normalTextureX),this._normalTextureY&&t.push(this._normalTextureY),this._normalTextureZ&&t.push(this._normalTextureZ),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTextureX===t||(this._diffuseTextureY===t||(this._diffuseTextureZ===t||(this._normalTextureX===t||(this._normalTextureY===t||this._normalTextureZ===t)))))},t.prototype.dispose=function(t){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.TriPlanarMaterial",e},t.prototype.getClassName=function(){return"TriPlanarMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)()],t.prototype,"mixTexture",void 0),n.a([Object(r.serializeAsTexture)("diffuseTextureX")],t.prototype,"_diffuseTextureX",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTextureX",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexturY")],t.prototype,"_diffuseTextureY",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTextureY",void 0),n.a([Object(r.serializeAsTexture)("diffuseTextureZ")],t.prototype,"_diffuseTextureZ",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTextureZ",void 0),n.a([Object(r.serializeAsTexture)("normalTextureX")],t.prototype,"_normalTextureX",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"normalTextureX",void 0),n.a([Object(r.serializeAsTexture)("normalTextureY")],t.prototype,"_normalTextureY",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"normalTextureY",void 0),n.a([Object(r.serializeAsTexture)("normalTextureZ")],t.prototype,"_normalTextureZ",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"normalTextureZ",void 0),n.a([Object(r.serialize)()],t.prototype,"tileSize",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"specularColor",void 0),n.a([Object(r.serialize)()],t.prototype,"specularPower",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.TriPlanarMaterial"]=f,i.d(t,"TriPlanarMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 furColor;\nuniform float furLength;\nvarying vec3 vPositionW;\nvarying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform float furOcclusion;\nuniform sampler2D furTexture;\nvarying vec2 vFurUV;\n#endif\n#include\n#include\n#include\n#include\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=furColor;\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\n\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));\nif (furTextureColor.a<=0.0 || furTextureColor.g[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;\nvec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.furPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\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\nuniform float furLength;\nuniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform vec3 furGravity;\nuniform float furTime;\nuniform float furSpacing;\nuniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n#include\n#include\n\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else\nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);\nvec3 tangent2=vec3(-normal.z,0,normal.x);\nr=Rand(tangent1*r);\nfloat J=(2.0+4.0*r);\nr=Rand(tangent2*r);\nfloat K=(2.0+2.0*r);\ntangent1=tangent1*J+tangent2*K;\ntangent1=normalize(tangent1);\nvec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\n\nvec3 forceDirection=vec3(0.0,0.0,0.0);\nforceDirection.x=sin(furTime+position.x*0.05)*0.2;\nforceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;\nforceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;\nvec3 displacement=vec3(0.0,0.0,0.0);\ndisplacement=furGravity+forceDirection;\nfloat displacementFactor=pow(furOffset,3.0);\nvec3 aNormal=normal;\naNormal.xyz+=displacement*displacementFactor;\nnewPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.furVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.HEIGHTMAP=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.HIGHLEVEL=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.furLength=1,n.furAngle=0,n.furColor=new r.Color3(.44,.21,.02),n.furOffset=0,n.furSpacing=12,n.furGravity=new r.Vector3(0,0,0),n.furSpeed=100,n.furDensity=20,n.furOcclusion=0,n._disableLighting=!1,n._maxSimultaneousLights=4,n.highLevelFur=!0,n._furTime=0,n}return n.b(t,e),Object.defineProperty(t.prototype,"furTime",{get:function(){return this._furTime},set:function(e){this._furTime=e},enumerable:!0,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.updateFur=function(){for(var e=1;e0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","furLength","furAngle","furColor","furOffset","furGravity","furTime","furSpacing","furDensity","furOcclusion"],d=["diffuseSampler","heightTexture","furTexture"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("fur",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),n.getCachedMaterial()!==this&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),this._heightTexture&&this._activeEffect.setTexture("heightTexture",this._heightTexture),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._activeEffect.setFloat("furLength",this.furLength),this._activeEffect.setFloat("furAngle",this.furAngle),this._activeEffect.setColor4("furColor",this.furColor,1),this.highLevelFur&&(this._activeEffect.setVector3("furGravity",this.furGravity),this._activeEffect.setFloat("furOffset",this.furOffset),this._activeEffect.setFloat("furSpacing",this.furSpacing),this._activeEffect.setFloat("furDensity",this.furDensity),this._activeEffect.setFloat("furOcclusion",this.furOcclusion),this._furTime+=this.getScene().getEngine().getDeltaTime()/this.furSpeed,this._activeEffect.setFloat("furTime",this._furTime),this._activeEffect.setTexture("furTexture",this.furTexture)),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.heightTexture&&this.heightTexture.animations&&this.heightTexture.animations.length>0&&e.push(this.heightTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._heightTexture&&t.push(this._heightTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this.diffuseTexture===t||this._heightTexture===t)},t.prototype.dispose=function(t){if(this.diffuseTexture&&this.diffuseTexture.dispose(),this._meshes)for(var i=1;i\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D textureSampler;\nuniform vec2 vTextureInfos;\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\nuniform sampler2D bump2Sampler;\nuniform sampler2D bump3Sampler;\n#endif\n\n#include\n#include\n#include\n\n#include\n\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{\nvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\nvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\nvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\nbump1Color.rgb*=mixColor.r;\nbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\nvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\nmap=map*255./127.-128./127.;\nmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\nreturn normalize(TBN*map);\n}\n#endif\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\ndiffuse1Color.rgb*=baseColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\nbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.terrainPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.terrainVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.BUMP=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.specularColor=new r.Color3(0,0,0),n.specularPower=64,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(o.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(n._needUVs=!0,r.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture1||!this.diffuseTexture1.isReady())return!1;if(!this.diffuseTexture2||!this.diffuseTexture2.isReady())return!1;if(!this.diffuseTexture3||!this.diffuseTexture3.isReady())return!1;n.DIFFUSE=!0}if(this.bumpTexture1&&this.bumpTexture2&&this.bumpTexture3&&r.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture1.isReady())return!1;if(!this.bumpTexture2.isReady())return!1;if(!this.bumpTexture3.isReady())return!1;n._needNormals=!0,n.BUMP=!0}}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],d=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("terrain",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.mixTexture&&(this._activeEffect.setTexture("textureSampler",this._mixTexture),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture.coordinatesIndex,this._mixTexture.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture.getTextureMatrix()),r.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale))),r.MaterialFlags.BumpTextureEnabled&&n.getEngine().getCaps().standardDerivatives&&(this._bumpTexture1&&this._activeEffect.setTexture("bump1Sampler",this._bumpTexture1),this._bumpTexture2&&this._activeEffect.setTexture("bump2Sampler",this._bumpTexture2),this._bumpTexture3&&this._activeEffect.setTexture("bump3Sampler",this._bumpTexture3))),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._mixTexture&&t.push(this._mixTexture),this._diffuseTexture1&&t.push(this._diffuseTexture1),this._diffuseTexture2&&t.push(this._diffuseTexture2),this._diffuseTexture3&&t.push(this._diffuseTexture3),this._bumpTexture1&&t.push(this._bumpTexture1),this._bumpTexture2&&t.push(this._bumpTexture2),this._bumpTexture3&&t.push(this._bumpTexture3),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._mixTexture===t||(this._diffuseTexture1===t||(this._diffuseTexture2===t||(this._diffuseTexture3===t||(this._bumpTexture1===t||(this._bumpTexture2===t||this._bumpTexture3===t))))))},t.prototype.dispose=function(t){this.mixTexture&&this.mixTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.TerrainMaterial",e},t.prototype.getClassName=function(){return"TerrainMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("mixTexture")],t.prototype,"_mixTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"mixTexture",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture1")],t.prototype,"_diffuseTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture1",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture2")],t.prototype,"_diffuseTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture2",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture3")],t.prototype,"_diffuseTexture3",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture3",void 0),n.a([Object(r.serializeAsTexture)("bumpTexture1")],t.prototype,"_bumpTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture1",void 0),n.a([Object(r.serializeAsTexture)("bumpTexture2")],t.prototype,"_bumpTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture2",void 0),n.a([Object(r.serializeAsTexture)("bumpTexture3")],t.prototype,"_bumpTexture3",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture3",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"specularColor",void 0),n.a([Object(r.serialize)()],t.prototype,"specularPower",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.TerrainMaterial"]=f,i.d(t,"TerrainMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\n\nuniform vec4 topColor;\nuniform vec4 bottomColor;\nuniform float offset;\nuniform float scale;\nuniform float smoothness;\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\nfloat h=vPosition.y*scale+offset;\nfloat mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));\nvec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));\n\nvec3 diffuseColor=baseColor.rgb;\n\nfloat alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef EMISSIVE\nvec3 diffuseBase=baseColor.rgb;\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);\n#endif\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.gradientPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\nvPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.gradientVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.EMISSIVE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n._maxSimultaneousLights=4,n.topColor=new r.Color3(1,0,0),n.topColorAlpha=1,n.bottomColor=new r.Color3(0,0,1),n.bottomColorAlpha=1,n.offset=0,n.scale=1,n.smoothness=1,n._disableLighting=!1,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1||this.topColorAlpha<1||this.bottomColorAlpha<1},t.prototype.needAlphaTesting=function(){return!0},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),n.EMISSIVE=this._disableLighting,r.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","topColor","bottomColor","offset","smoothness","scale"],d=[],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:4}),t.setEffect(o.getEngine().createEffect("gradient",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,a),this._mustRebind(n,a)&&(r.MaterialHelper.BindClipPlane(a,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._activeEffect.setColor4("topColor",this.topColor,this.topColorAlpha),this._activeEffect.setColor4("bottomColor",this.bottomColor,this.bottomColorAlpha),this._activeEffect.setFloat("offset",this.offset),this._activeEffect.setFloat("scale",this.scale),this._activeEffect.setFloat("smoothness",this.smoothness),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){return[]},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.GradientMaterial",e},t.prototype.getClassName=function(){return"GradientMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"topColor",void 0),n.a([Object(r.serialize)()],t.prototype,"topColorAlpha",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"bottomColor",void 0),n.a([Object(r.serialize)()],t.prototype,"bottomColorAlpha",void 0),n.a([Object(r.serialize)()],t.prototype,"offset",void 0),n.a([Object(r.serialize)()],t.prototype,"scale",void 0),n.a([Object(r.serialize)()],t.prototype,"smoothness",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.GradientMaterial"]=f,i.d(t,"GradientMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\nvoid main(void)\n{\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.cellPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.cellVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.NDOTL=!0,t.CUSTOMUSERLIGHTING=!0,t.CELLBASIC=!0,t.DEPTHPREPASS=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n._computeHighLevel=!1,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(n.CELLBASIC=!this.computeHighLevel,r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix"],d=["diffuseSampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("cell",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights-1}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this._maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._diffuseTexture===t},t.prototype.dispose=function(t){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.getClassName=function(){return"CellMaterial"},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.CellMaterial",e},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsColor3)("diffuse")],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("computeHighLevel")],t.prototype,"_computeHighLevel",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"computeHighLevel",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.CellMaterial"]=f,i.d(t,"CellMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;\nuniform vec3 mainColor;\nuniform vec3 lineColor;\nuniform vec4 gridControl;\nuniform vec3 gridOffset;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\nfloat getVisibility(float position) {\n\nfloat majorGridFrequency=gridControl.y;\nif (floor(position+0.5) == floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{\nreturn 1.0;\n}\nreturn gridControl.z;\n}\nfloat getAnisotropicAttenuation(float differentialLength) {\nconst float maxNumberOfLines=10.0;\nreturn clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);\n}\nfloat isPointOnLine(float position,float differentialLength) {\nfloat fractionPartOfPosition=position-floor(position+0.5);\nfractionPartOfPosition/=differentialLength;\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);\nfloat result=0.5+0.5*cos(fractionPartOfPosition*PI);\nreturn result;\n}\nfloat contributionOnAxis(float position) {\nfloat differentialLength=length(vec2(dFdx(position),dFdy(position)));\ndifferentialLength*=SQRT2;\n\nfloat result=isPointOnLine(position,differentialLength);\n\nfloat visibility=getVisibility(position);\nresult*=visibility;\n\nfloat anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);\nresult*=anisotropicAttenuation;\nreturn result;\n}\nfloat normalImpactOnAxis(float x) {\nfloat normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);\nreturn normalImpact;\n}\nvoid main(void) {\n\nfloat gridRatio=gridControl.x;\nvec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;\n\nfloat x=contributionOnAxis(gridPos.x);\nfloat y=contributionOnAxis(gridPos.y);\nfloat z=contributionOnAxis(gridPos.z);\n\nvec3 normal=normalize(vNormal);\nx*=normalImpactOnAxis(normal.x);\ny*=normalImpactOnAxis(normal.y);\nz*=normalImpactOnAxis(normal.z);\n\nfloat grid=clamp(x+y+z,0.,1.);\n\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\n\ngl_FragColor=vec4(color.rgb,opacity);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n}";r.Effect.ShadersStore.gridPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\nvoid main(void) {\n#include\n#ifdef FOG\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#endif\n#include\nvec4 cameraSpacePosition=view*finalWorld*vec4(position,1.0);\ngl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\nvPosition=position;\nvNormal=normal;\n}";r.Effect.ShadersStore.gridVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.OPACITY=!1,t.TRANSPARENT=!1,t.FOG=!1,t.PREMULTIPLYALPHA=!1,t.UV1=!1,t.UV2=!1,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.mainColor=r.Color3.Black(),n.lineColor=r.Color3.Teal(),n.gridRatio=1,n.gridOffset=r.Vector3.Zero(),n.majorUnitFrequency=10,n.minorUnitVisibility=.33,n.opacity=1,n.preMultiplyAlpha=!1,n._gridControl=new r.Vector4(n.gridRatio,n.majorUnitFrequency,n.minorUnitVisibility,n.opacity),n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()},t.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;if(n.TRANSPARENT!==this.opacity<1&&(n.TRANSPARENT=!n.TRANSPARENT,n.markAsUnprocessed()),n.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(n.PREMULTIPLYALPHA=!n.PREMULTIPLYALPHA,n.markAsUnprocessed()),n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._opacityTexture&&r.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;n._needUVs=!0,n.OPACITY=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,!1,this.fogEnabled,!1,n),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,o.getEngine(),n,!!i),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial(),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!1);var a=[r.VertexBuffer.PositionKind,r.VertexBuffer.NormalKind];n.UV1&&a.push(r.VertexBuffer.UVKind),n.UV2&&a.push(r.VertexBuffer.UV2Kind),r.MaterialHelper.PrepareAttributesForInstances(a,n);var f=n.toString();t.setEffect(o.getEngine().createEffect("grid",a,["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos"],["opacitySampler"],f,void 0,this.onCompiled,this.onError),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,o.INSTANCES||this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",n.getViewMatrix()),this._activeEffect.setMatrix("projection",n.getProjectionMatrix()),this._mustRebind(n,a)&&(this._activeEffect.setColor3("mainColor",this.mainColor),this._activeEffect.setColor3("lineColor",this.lineColor),this._activeEffect.setVector3("gridOffset",this.gridOffset),this._gridControl.x=this.gridRatio,this._gridControl.y=Math.round(this.majorUnitFrequency),this._gridControl.z=this.minorUnitVisibility,this._gridControl.w=this.opacity,this._activeEffect.setVector4("gridControl",this._gridControl),this._opacityTexture&&r.MaterialFlags.OpacityTextureEnabled&&(this._activeEffect.setTexture("opacitySampler",this._opacityTexture),this._activeEffect.setFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),this._activeEffect.setMatrix("opacityMatrix",this._opacityTexture.getTextureMatrix()))),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.GridMaterial",e},t.prototype.getClassName=function(){return"GridMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsColor3)()],t.prototype,"mainColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"lineColor",void 0),n.a([Object(r.serialize)()],t.prototype,"gridRatio",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"gridOffset",void 0),n.a([Object(r.serialize)()],t.prototype,"majorUnitFrequency",void 0),n.a([Object(r.serialize)()],t.prototype,"minorUnitVisibility",void 0),n.a([Object(r.serialize)()],t.prototype,"opacity",void 0),n.a([Object(r.serialize)()],t.prototype,"preMultiplyAlpha",void 0),n.a([Object(r.serializeAsTexture)("opacityTexture")],t.prototype,"_opacityTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityTexture",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.GridMaterial"]=f,i.d(t,"GridMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.simplePixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.simpleVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix"],d=["diffuseSampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("simple",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights-1}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this.diffuseTexture===t},t.prototype.dispose=function(t){this._diffuseTexture&&this._diffuseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.SimpleMaterial",e},t.prototype.getClassName=function(){return"SimpleMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsColor3)("diffuse")],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.SimpleMaterial"]=f,i.d(t,"SimpleMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n\nuniform float time;\nuniform float speed;\nuniform float movingSpeed;\nuniform vec3 fogColor;\nuniform sampler2D noiseTexture;\nuniform float fogDensity;\n\nvarying float noise;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nfloat random( vec3 scale,float seed ){\nreturn fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;\n}\nvoid main(void) {\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#ifdef DIFFUSE\n\nvec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );\nvec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time*0.02;\nvec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;\nT1.x+=noiseTex.x*2.0;\nT1.y+=noiseTex.y*2.0;\nT2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;\nT2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;\nfloat p=texture2D( noiseTexture,T1*3.0 ).a;\nvec4 lavaColor=texture2D( diffuseSampler,T2*4.0);\nvec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );\nbaseColor=temp;\nfloat depth=gl_FragCoord.z*4.0;\nconst float LOG2=1.442695;\nfloat fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );\nfogFactor=1.0-clamp( fogFactor,0.0,1.0 );\nbaseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );\ndiffuseColor=baseColor.rgb;\n\n\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.lavaPixelShader=o;var a="precision highp float;\n\nuniform float time;\nuniform float lowFrequencySpeed;\n\nvarying float noise;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\n\n\n\nvec3 mod289(vec3 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 mod289(vec4 x)\n{\nreturn x-floor(x*(1.0/289.0))*289.0;\n}\nvec4 permute(vec4 x)\n{\nreturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\nreturn 1.79284291400159-0.85373472095314*r;\n}\nvec3 fade(vec3 t) {\nreturn t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\nfloat pnoise(vec3 P,vec3 rep)\n{\nvec3 Pi0=mod(floor(P),rep);\nvec3 Pi1=mod(Pi0+vec3(1.0),rep);\nPi0=mod289(Pi0);\nPi1=mod289(Pi1);\nvec3 Pf0=fract(P);\nvec3 Pf1=Pf0-vec3(1.0);\nvec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);\nvec4 iy=vec4(Pi0.yy,Pi1.yy);\nvec4 iz0=Pi0.zzzz;\nvec4 iz1=Pi1.zzzz;\nvec4 ixy=permute(permute(ix)+iy);\nvec4 ixy0=permute(ixy+iz0);\nvec4 ixy1=permute(ixy+iz1);\nvec4 gx0=ixy0*(1.0/7.0);\nvec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;\ngx0=fract(gx0);\nvec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);\nvec4 sz0=step(gz0,vec4(0.0));\ngx0-=sz0*(step(0.0,gx0)-0.5);\ngy0-=sz0*(step(0.0,gy0)-0.5);\nvec4 gx1=ixy1*(1.0/7.0);\nvec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;\ngx1=fract(gx1);\nvec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);\nvec4 sz1=step(gz1,vec4(0.0));\ngx1-=sz1*(step(0.0,gx1)-0.5);\ngy1-=sz1*(step(0.0,gy1)-0.5);\nvec3 g000=vec3(gx0.x,gy0.x,gz0.x);\nvec3 g100=vec3(gx0.y,gy0.y,gz0.y);\nvec3 g010=vec3(gx0.z,gy0.z,gz0.z);\nvec3 g110=vec3(gx0.w,gy0.w,gz0.w);\nvec3 g001=vec3(gx1.x,gy1.x,gz1.x);\nvec3 g101=vec3(gx1.y,gy1.y,gz1.y);\nvec3 g011=vec3(gx1.z,gy1.z,gz1.z);\nvec3 g111=vec3(gx1.w,gy1.w,gz1.w);\nvec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));\ng000*=norm0.x;\ng010*=norm0.y;\ng100*=norm0.z;\ng110*=norm0.w;\nvec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));\ng001*=norm1.x;\ng011*=norm1.y;\ng101*=norm1.z;\ng111*=norm1.w;\nfloat n000=dot(g000,Pf0);\nfloat n100=dot(g100,vec3(Pf1.x,Pf0.yz));\nfloat n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));\nfloat n110=dot(g110,vec3(Pf1.xy,Pf0.z));\nfloat n001=dot(g001,vec3(Pf0.xy,Pf1.z));\nfloat n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));\nfloat n011=dot(g011,vec3(Pf0.x,Pf1.yz));\nfloat n111=dot(g111,Pf1);\nvec3 fade_xyz=fade(Pf0);\nvec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);\nvec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);\nfloat n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);\nreturn 2.2*n_xyz;\n}\n\nfloat turbulence( vec3 p ) {\nfloat w=100.0;\nfloat t=-.5;\nfor (float f=1.0 ; f<=10.0 ; f++ ){\nfloat power=pow( 2.0,f );\nt+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );\n}\nreturn t;\n}\nvoid main(void) {\n#include\n#include\n#ifdef NORMAL\n\nnoise=10.0*-.10*turbulence( .5*normal+time*1.15 );\n\nfloat b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );\n\nfloat displacement =-1.5*noise+b;\n\nvec3 newPosition=position+normal*displacement;\ngl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}";r.Effect.ShadersStore.lavaVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.LIGHT0=!1,t.LIGHT1=!1,t.LIGHT2=!1,t.LIGHT3=!1,t.SPOTLIGHT0=!1,t.SPOTLIGHT1=!1,t.SPOTLIGHT2=!1,t.SPOTLIGHT3=!1,t.HEMILIGHT0=!1,t.HEMILIGHT1=!1,t.HEMILIGHT2=!1,t.HEMILIGHT3=!1,t.DIRLIGHT0=!1,t.DIRLIGHT1=!1,t.DIRLIGHT2=!1,t.DIRLIGHT3=!1,t.POINTLIGHT0=!1,t.POINTLIGHT1=!1,t.POINTLIGHT2=!1,t.POINTLIGHT3=!1,t.SHADOW0=!1,t.SHADOW1=!1,t.SHADOW2=!1,t.SHADOW3=!1,t.SHADOWS=!1,t.SHADOWESM0=!1,t.SHADOWESM1=!1,t.SHADOWESM2=!1,t.SHADOWESM3=!1,t.SHADOWPOISSON0=!1,t.SHADOWPOISSON1=!1,t.SHADOWPOISSON2=!1,t.SHADOWPOISSON3=!1,t.SHADOWPCF0=!1,t.SHADOWPCF1=!1,t.SHADOWPCF2=!1,t.SHADOWPCF3=!1,t.SHADOWPCSS0=!1,t.SHADOWPCSS1=!1,t.SHADOWPCSS2=!1,t.SHADOWPCSS3=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.UNLIT=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.speed=1,n.movingSpeed=1,n.lowFrequencySpeed=1,n.fogDensity=.15,n._lastTime=0,n.diffuseColor=new r.Color3(1,1,1),n._disableLighting=!1,n._unlit=!1,n._maxSimultaneousLights=4,n._scaledDiffuse=new r.Color3,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=!0,r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","time","speed","movingSpeed","fogColor","fogDensity","lowFrequencySpeed"],d=["diffuseSampler","noiseTexture"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("lava",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,o.UNLIT=this._unlit,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),this.noiseTexture&&this._activeEffect.setTexture("noiseTexture",this.noiseTexture),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._lastTime+=n.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime*this.speed/1e3),this.fogColor||(this.fogColor=r.Color3.Black()),this._activeEffect.setColor3("fogColor",this.fogColor),this._activeEffect.setFloat("fogDensity",this.fogDensity),this._activeEffect.setFloat("lowFrequencySpeed",this.lowFrequencySpeed),this._activeEffect.setFloat("movingSpeed",this.movingSpeed),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),this.noiseTexture&&this.noiseTexture.animations&&this.noiseTexture.animations.length>0&&e.push(this.noiseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this.diffuseTexture===t},t.prototype.dispose=function(t){this.diffuseTexture&&this.diffuseTexture.dispose(),this.noiseTexture&&this.noiseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.LavaMaterial",e},t.prototype.getClassName=function(){return"LavaMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsTexture)()],t.prototype,"noiseTexture",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"fogColor",void 0),n.a([Object(r.serialize)()],t.prototype,"speed",void 0),n.a([Object(r.serialize)()],t.prototype,"movingSpeed",void 0),n.a([Object(r.serialize)()],t.prototype,"lowFrequencySpeed",void 0),n.a([Object(r.serialize)()],t.prototype,"fogDensity",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("unlit")],t.prototype,"_unlit",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"unlit",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.LavaMaterial"]=f,i.d(t,"LavaMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform float alpha;\nuniform vec3 shadowColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0..1]\n\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.shadowOnlyPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.shadowOnlyVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.shadowColor=r.Color3.Black(),n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return!0},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},Object.defineProperty(t.prototype,"activeLight",{get:function(){return this._activeLight},set:function(e){this._activeLight=e},enumerable:!0,configurable:!0}),t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(this._activeLight)for(var f=0,l=e.lightSources;f0&&d.addCPUSkinningFallback(0,e);var p=[r.VertexBuffer.PositionKind];n.NORMAL&&p.push(r.VertexBuffer.NormalKind),r.MaterialHelper.PrepareAttributesForBones(p,e,n,d),r.MaterialHelper.PrepareAttributesForInstances(p,n);var h=n.toString(),v=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4"],m=new Array,g=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:v,uniformBuffersNames:g,samplers:m,defines:n,maxSimultaneousLights:1}),t.setEffect(o.getEngine().createEffect("shadowOnly",{attributes:p,uniformsNames:v,uniformBuffersNames:g,samplers:m,defines:h,fallbacks:d,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),r.MaterialHelper.BindEyePosition(a,n)),n.lightsEnabled&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,1),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.ShadowOnlyMaterial",e},t.prototype.getClassName=function(){return"ShadowOnlyMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.ShadowOnlyMaterial"]=f,i.d(t,"ShadowOnlyMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D mixMap1Sampler;\nuniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform sampler2D diffuse4Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\nuniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;\nuniform sampler2D diffuse6Sampler;\nuniform sampler2D diffuse7Sampler;\nuniform sampler2D diffuse8Sampler;\nuniform vec2 diffuse5Infos;\nuniform vec2 diffuse6Infos;\nuniform vec2 diffuse7Infos;\nuniform vec2 diffuse8Infos;\n#endif\n#endif\n\n#include\n#include\n#include\n\n#include\nvoid main(void) {\n\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 finalMixColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\nvec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);\ndiffuse1Color.rgb*=mixColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);\ndiffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);\nvec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);\nvec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);\nvec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);\ndiffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);\ndiffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);\ndiffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include\ngl_FragColor=color;\n}\n";r.Effect.ShadersStore.mixPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\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<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n\n#include[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.mixVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.MIXMAP2=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n.specularColor=new r.Color3(0,0,0),n.specularPower=64,n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(o.texturesEnabled){if(!this._mixTexture1||!this._mixTexture1.isReady())return!1;if(n._needUVs=!0,r.MaterialFlags.DiffuseTextureEnabled){if(!this._diffuseTexture1||!this._diffuseTexture1.isReady())return!1;if(n.DIFFUSE=!0,!this._diffuseTexture2||!this._diffuseTexture2.isReady())return!1;if(!this._diffuseTexture3||!this._diffuseTexture3.isReady())return!1;if(!this._diffuseTexture4||!this._diffuseTexture4.isReady())return!1;if(this._mixTexture2){if(!this._mixTexture2.isReady())return!1;if(n.MIXMAP2=!0,!this._diffuseTexture5||!this._diffuseTexture5.isReady())return!1;if(!this._diffuseTexture6||!this._diffuseTexture6.isReady())return!1;if(!this._diffuseTexture7||!this._diffuseTexture7.isReady())return!1;if(!this._diffuseTexture8||!this._diffuseTexture8.isReady())return!1}}}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f,this.maxSimultaneousLights),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(r.VertexBuffer.ColorKind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos","diffuse4Infos","diffuse5Infos","diffuse6Infos","diffuse7Infos","diffuse8Infos"],d=["mixMap1Sampler","mixMap2Sampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","diffuse4Sampler","diffuse5Sampler","diffuse6Sampler","diffuse7Sampler","diffuse8Sampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(o.getEngine().createEffect("mix",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this._mixTexture1&&(this._activeEffect.setTexture("mixMap1Sampler",this._mixTexture1),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture1.coordinatesIndex,this._mixTexture1.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture1.getTextureMatrix()),r.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale)),this._diffuseTexture4&&(this._activeEffect.setTexture("diffuse4Sampler",this._diffuseTexture4),this._activeEffect.setFloat2("diffuse4Infos",this._diffuseTexture4.uScale,this._diffuseTexture4.vScale)))),this._mixTexture2&&(this._activeEffect.setTexture("mixMap2Sampler",this._mixTexture2),r.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture5&&(this._activeEffect.setTexture("diffuse5Sampler",this._diffuseTexture5),this._activeEffect.setFloat2("diffuse5Infos",this._diffuseTexture5.uScale,this._diffuseTexture5.vScale)),this._diffuseTexture6&&(this._activeEffect.setTexture("diffuse6Sampler",this._diffuseTexture6),this._activeEffect.setFloat2("diffuse6Infos",this._diffuseTexture6.uScale,this._diffuseTexture6.vScale)),this._diffuseTexture7&&(this._activeEffect.setTexture("diffuse7Sampler",this._diffuseTexture7),this._activeEffect.setFloat2("diffuse7Infos",this._diffuseTexture7.uScale,this._diffuseTexture7.vScale)),this._diffuseTexture8&&(this._activeEffect.setTexture("diffuse8Sampler",this._diffuseTexture8),this._activeEffect.setFloat2("diffuse8Infos",this._diffuseTexture8.uScale,this._diffuseTexture8.vScale)))),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this._mixTexture1&&this._mixTexture1.animations&&this._mixTexture1.animations.length>0&&e.push(this._mixTexture1),this._mixTexture2&&this._mixTexture2.animations&&this._mixTexture2.animations.length>0&&e.push(this._mixTexture2),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._mixTexture1&&t.push(this._mixTexture1),this._diffuseTexture1&&t.push(this._diffuseTexture1),this._diffuseTexture2&&t.push(this._diffuseTexture2),this._diffuseTexture3&&t.push(this._diffuseTexture3),this._diffuseTexture4&&t.push(this._diffuseTexture4),this._mixTexture2&&t.push(this._mixTexture2),this._diffuseTexture5&&t.push(this._diffuseTexture5),this._diffuseTexture6&&t.push(this._diffuseTexture6),this._diffuseTexture7&&t.push(this._diffuseTexture7),this._diffuseTexture8&&t.push(this._diffuseTexture8),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._mixTexture1===t||(this._diffuseTexture1===t||(this._diffuseTexture2===t||(this._diffuseTexture3===t||(this._diffuseTexture4===t||(this._mixTexture2===t||(this._diffuseTexture5===t||(this._diffuseTexture6===t||(this._diffuseTexture7===t||this._diffuseTexture8===t)))))))))},t.prototype.dispose=function(t){this._mixTexture1&&this._mixTexture1.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.MixMaterial",e},t.prototype.getClassName=function(){return"MixMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("mixTexture1")],t.prototype,"_mixTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"mixTexture1",void 0),n.a([Object(r.serializeAsTexture)("mixTexture2")],t.prototype,"_mixTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"mixTexture2",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture1")],t.prototype,"_diffuseTexture1",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture1",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture2")],t.prototype,"_diffuseTexture2",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture2",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture3")],t.prototype,"_diffuseTexture3",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture3",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture4")],t.prototype,"_diffuseTexture4",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture4",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture1")],t.prototype,"_diffuseTexture5",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture5",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture2")],t.prototype,"_diffuseTexture6",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture6",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture3")],t.prototype,"_diffuseTexture7",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture7",void 0),n.a([Object(r.serializeAsTexture)("diffuseTexture4")],t.prototype,"_diffuseTexture8",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture8",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"specularColor",void 0),n.a([Object(r.serialize)()],t.prototype,"specularPower",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.MixMaterial"]=f,i.d(t,"MixMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o="precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n\n#include\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include\n#include\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include\n\n#include\nvoid main(void) {\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include[0]\n#include[1]\n#include[2]\n#include[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=baseColor.rgb;\n#endif\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include\ngl_FragColor=color;\n}";r.Effect.ShadersStore.normalPixelShader=o;var a="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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\n#include\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include\n\n#include\n#include[0..maxSimultaneousLights]\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";r.Effect.ShadersStore.normalVertexShader=a;var s=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.POINTSIZE=!1,t.FOG=!1,t.LIGHT0=!1,t.LIGHT1=!1,t.LIGHT2=!1,t.LIGHT3=!1,t.SPOTLIGHT0=!1,t.SPOTLIGHT1=!1,t.SPOTLIGHT2=!1,t.SPOTLIGHT3=!1,t.HEMILIGHT0=!1,t.HEMILIGHT1=!1,t.HEMILIGHT2=!1,t.HEMILIGHT3=!1,t.DIRLIGHT0=!1,t.DIRLIGHT1=!1,t.DIRLIGHT2=!1,t.DIRLIGHT3=!1,t.POINTLIGHT0=!1,t.POINTLIGHT1=!1,t.POINTLIGHT2=!1,t.POINTLIGHT3=!1,t.SHADOW0=!1,t.SHADOW1=!1,t.SHADOW2=!1,t.SHADOW3=!1,t.SHADOWS=!1,t.SHADOWESM0=!1,t.SHADOWESM1=!1,t.SHADOWESM2=!1,t.SHADOWESM3=!1,t.SHADOWPOISSON0=!1,t.SHADOWPOISSON1=!1,t.SHADOWPOISSON2=!1,t.SHADOWPOISSON3=!1,t.SHADOWPCF0=!1,t.SHADOWPCF1=!1,t.SHADOWPCF2=!1,t.SHADOWPCF3=!1,t.SHADOWPCSS0=!1,t.SHADOWPCSS1=!1,t.SHADOWPCSS2=!1,t.SHADOWPCSS3=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.LIGHTING=!1,t.rebuild(),t}return n.b(t,e),t}(r.MaterialDefines),f=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.diffuseColor=new r.Color3(1,1,1),n._disableLighting=!1,n._maxSimultaneousLights=4,n}return n.b(t,e),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()||e.visibility<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&this._wasPreviouslyReady&&t.effect)return!0;t._materialDefines||(t._materialDefines=new s);var n=t._materialDefines,o=this.getScene();if(!this.checkReadyOnEveryCall&&t.effect&&this._renderId===o.getRenderId())return!0;var a=o.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(r.MaterialHelper.PrepareDefinesForMisc(e,o,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=!0,r.MaterialHelper.PrepareDefinesForLights(o,e,n,!1,this._maxSimultaneousLights,this._disableLighting),r.MaterialHelper.PrepareDefinesForFrameBoundValues(o,a,n,!!i),n.LIGHTING=!this._disableLighting,r.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var f=new r.EffectFallbacks;n.FOG&&f.addFallback(1,"FOG"),r.MaterialHelper.HandleFallbacksForShadows(n,f),n.NUM_BONE_INFLUENCERS>0&&f.addCPUSkinningFallback(0,e);var l=[r.VertexBuffer.PositionKind];n.NORMAL&&l.push(r.VertexBuffer.NormalKind),n.UV1&&l.push(r.VertexBuffer.UVKind),n.UV2&&l.push(r.VertexBuffer.UV2Kind),r.MaterialHelper.PrepareAttributesForBones(l,e,n,f),r.MaterialHelper.PrepareAttributesForInstances(l,n);var u=n.toString(),c=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix"],d=["diffuseSampler"],p=new Array;r.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:n,maxSimultaneousLights:4}),t.setEffect(o.getEngine().createEffect("normal",{attributes:l,uniformsNames:c,uniformBuffersNames:p,samplers:d,defines:u,fallbacks:f,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},a),n)}return!(!t.effect||!t.effect.isReady())&&(this._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),o=i._materialDefines;if(o){var a=i.effect;a&&(this._activeEffect=a,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),r.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,a)&&(this.diffuseTexture&&r.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),r.MaterialHelper.BindClipPlane(this._activeEffect,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),r.MaterialHelper.BindEyePosition(a,n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&r.MaterialHelper.BindLights(n,t,this._activeEffect,o),n.fogEnabled&&t.applyFog&&n.fogMode!==r.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),r.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))}},t.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this.diffuseTexture===t},t.prototype.dispose=function(t){this.diffuseTexture&&this.diffuseTexture.dispose(),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return r.SerializationHelper.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this);return e.customType="BABYLON.NormalMaterial",e},t.prototype.getClassName=function(){return"NormalMaterial"},t.Parse=function(e,i,n){return r.SerializationHelper.Parse(function(){return new t(e.name,i)},e,i,n)},n.a([Object(r.serializeAsTexture)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),n.a([Object(r.serializeAsColor3)()],t.prototype,"diffuseColor",void 0),n.a([Object(r.serialize)("disableLighting")],t.prototype,"_disableLighting",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.a([Object(r.serialize)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.a([Object(r.expandToProperty)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),t}(r.PushMaterial);r._TypeStore.RegisteredTypes["BABYLON.NormalMaterial"]=f,i.d(t,"NormalMaterial",function(){return f})},function(e,t,i){"use strict";i.r(t);var n=i(1),r=i(0),o=function(){return function(){}}(),a=function(){return function(){}}(),s=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.CustomParts=new a,n.customShaderNameResolve=n.Builder,n.FragmentShader=r.Effect.ShadersStore.defaultPixelShader,n.VertexShader=r.Effect.ShadersStore.defaultVertexShader,n}return n.b(t,e),t.prototype.AttachAfterBind=function(e,t){for(var i in this._newUniformInstances){"vec2"==(n=i.toString().split("-"))[0]?t.setVector2(n[1],this._newUniformInstances[i]):"vec3"==n[0]?t.setVector3(n[1],this._newUniformInstances[i]):"vec4"==n[0]?t.setVector4(n[1],this._newUniformInstances[i]):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[i]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[i])}for(var i in this._newSamplerInstances){var n;"sampler2D"==(n=i.toString().split("-"))[0]&&this._newSamplerInstances[i].isReady&&this._newSamplerInstances[i].isReady()&&t.setTexture(n[1],this._newSamplerInstances[i])}},t.prototype.ReviewUniform=function(e,t){if("uniform"==e)for(var i in this._newUniforms)-1==this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);if("sampler"==e)for(var i in this._newUniforms)-1!=this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);return t},t.prototype.Builder=function(e,i,n,o,a){var s=this;if(this._isCreatedShader)return this._createdShaderName;this._isCreatedShader=!1,t.ShaderIndexer++;var f="custom_"+t.ShaderIndexer;this.ReviewUniform("uniform",i),this.ReviewUniform("sampler",o);var l=this._afterBind.bind(this);return this._afterBind=function(e,t){if(t){s.AttachAfterBind(e,t);try{l(e,t)}catch(t){}}},r.Effect.ShadersStore[f+"VertexShader"]=this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN",this.CustomParts.Vertex_Begin?this.CustomParts.Vertex_Begin:"").replace("#define CUSTOM_VERTEX_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Vertex_Definitions?this.CustomParts.Vertex_Definitions:"")).replace("#define CUSTOM_VERTEX_MAIN_BEGIN",this.CustomParts.Vertex_MainBegin?this.CustomParts.Vertex_MainBegin:"").replace("#define CUSTOM_VERTEX_UPDATE_POSITION",this.CustomParts.Vertex_Before_PositionUpdated?this.CustomParts.Vertex_Before_PositionUpdated:"").replace("#define CUSTOM_VERTEX_UPDATE_NORMAL",this.CustomParts.Vertex_Before_NormalUpdated?this.CustomParts.Vertex_Before_NormalUpdated:"").replace("#define CUSTOM_VERTEX_MAIN_END",this.CustomParts.Vertex_MainEnd?this.CustomParts.Vertex_MainEnd:""),r.Effect.ShadersStore[f+"PixelShader"]=this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN",this.CustomParts.Fragment_Begin?this.CustomParts.Fragment_Begin:"").replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN",this.CustomParts.Fragment_MainBegin?this.CustomParts.Fragment_MainBegin:"").replace("#define CUSTOM_FRAGMENT_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Fragment_Definitions?this.CustomParts.Fragment_Definitions:"")).replace("#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE",this.CustomParts.Fragment_Custom_Diffuse?this.CustomParts.Fragment_Custom_Diffuse:"").replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA",this.CustomParts.Fragment_Custom_Alpha?this.CustomParts.Fragment_Custom_Alpha:"").replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS",this.CustomParts.Fragment_Before_Lights?this.CustomParts.Fragment_Before_Lights:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FOG",this.CustomParts.Fragment_Before_Fog?this.CustomParts.Fragment_Before_Fog:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR",this.CustomParts.Fragment_Before_FragColor?this.CustomParts.Fragment_Before_FragColor:""),this._isCreatedShader=!0,this._createdShaderName=f,f},t.prototype.AddUniform=function(e,t,i){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances=new Array,this._newUniformInstances=new Array),i&&(t.indexOf("sampler"),this._newUniformInstances[t+"-"+e]=i),this._customUniform.push("uniform "+t+" "+e+";"),this._newUniforms.push(e),this},t.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},t.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},t.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},t.prototype.Fragment_Custom_Diffuse=function(e){return this.CustomParts.Fragment_Custom_Diffuse=e.replace("result","diffuseColor"),this},t.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},t.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},t.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},t.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},t.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},t.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},t.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},t.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},t.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},t.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},t.ShaderIndexer=1,t}(r.StandardMaterial);r._TypeStore.RegisteredTypes["BABYLON.CustomMaterial"]=s;var f=function(){return function(){}}(),l=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.CustomParts=new f,n.customShaderNameResolve=n.Builder,n.FragmentShader=r.Effect.ShadersStore.pbrPixelShader,n.VertexShader=r.Effect.ShadersStore.pbrVertexShader,n}return n.b(t,e),t.prototype.AttachAfterBind=function(e,t){for(var i in this._newUniformInstances){"vec2"==(n=i.toString().split("-"))[0]?t.setVector2(n[1],this._newUniformInstances[i]):"vec3"==n[0]?t.setVector3(n[1],this._newUniformInstances[i]):"vec4"==n[0]?t.setVector4(n[1],this._newUniformInstances[i]):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[i]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[i])}for(var i in this._newSamplerInstances){var n;"sampler2D"==(n=i.toString().split("-"))[0]&&this._newSamplerInstances[i].isReady&&this._newSamplerInstances[i].isReady()&&t.setTexture(n[1],this._newSamplerInstances[i])}},t.prototype.ReviewUniform=function(e,t){if("uniform"==e)for(var i in this._newUniforms)-1==this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);if("sampler"==e)for(var i in this._newUniforms)-1!=this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i]);return t},t.prototype.Builder=function(e,i,n,o,a){var s=this;if(this._isCreatedShader)return this._createdShaderName;this._isCreatedShader=!1,t.ShaderIndexer++;var f="custom_"+t.ShaderIndexer;this.ReviewUniform("uniform",i),this.ReviewUniform("sampler",o);var l=this._afterBind.bind(this);return this._afterBind=function(e,t){if(t){s.AttachAfterBind(e,t);try{l(e,t)}catch(t){}}},r.Effect.ShadersStore[f+"VertexShader"]=this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN",this.CustomParts.Vertex_Begin?this.CustomParts.Vertex_Begin:"").replace("#define CUSTOM_VERTEX_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Vertex_Definitions?this.CustomParts.Vertex_Definitions:"")).replace("#define CUSTOM_VERTEX_MAIN_BEGIN",this.CustomParts.Vertex_MainBegin?this.CustomParts.Vertex_MainBegin:"").replace("#define CUSTOM_VERTEX_UPDATE_POSITION",this.CustomParts.Vertex_Before_PositionUpdated?this.CustomParts.Vertex_Before_PositionUpdated:"").replace("#define CUSTOM_VERTEX_UPDATE_NORMAL",this.CustomParts.Vertex_Before_NormalUpdated?this.CustomParts.Vertex_Before_NormalUpdated:"").replace("#define CUSTOM_VERTEX_MAIN_END",this.CustomParts.Vertex_MainEnd?this.CustomParts.Vertex_MainEnd:""),r.Effect.ShadersStore[f+"PixelShader"]=this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN",this.CustomParts.Fragment_Begin?this.CustomParts.Fragment_Begin:"").replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN",this.CustomParts.Fragment_MainBegin?this.CustomParts.Fragment_MainBegin:"").replace("#define CUSTOM_FRAGMENT_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Fragment_Definitions?this.CustomParts.Fragment_Definitions:"")).replace("#define CUSTOM_FRAGMENT_UPDATE_ALBEDO",this.CustomParts.Fragment_Custom_Albedo?this.CustomParts.Fragment_Custom_Albedo:"").replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA",this.CustomParts.Fragment_Custom_Alpha?this.CustomParts.Fragment_Custom_Alpha:"").replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS",this.CustomParts.Fragment_Before_Lights?this.CustomParts.Fragment_Before_Lights:"").replace("#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS",this.CustomParts.Fragment_Custom_MetallicRoughness?this.CustomParts.Fragment_Custom_MetallicRoughness:"").replace("#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE",this.CustomParts.Fragment_Custom_MicroSurface?this.CustomParts.Fragment_Custom_MicroSurface:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FOG",this.CustomParts.Fragment_Before_Fog?this.CustomParts.Fragment_Before_Fog:"").replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR",this.CustomParts.Fragment_Before_FragColor?this.CustomParts.Fragment_Before_FragColor:""),this._isCreatedShader=!0,this._createdShaderName=f,f},t.prototype.AddUniform=function(e,t,i){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances=new Array,this._newUniformInstances=new Array),i&&(t.indexOf("sampler"),this._newUniformInstances[t+"-"+e]=i),this._customUniform.push("uniform "+t+" "+e+";"),this._newUniforms.push(e),this},t.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},t.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},t.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},t.prototype.Fragment_Custom_Albedo=function(e){return this.CustomParts.Fragment_Custom_Albedo=e.replace("result","surfaceAlbedo"),this},t.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},t.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},t.prototype.Fragment_Custom_MetallicRoughness=function(e){return this.CustomParts.Fragment_Custom_MetallicRoughness=e,this},t.prototype.Fragment_Custom_MicroSurface=function(e){return this.CustomParts.Fragment_Custom_MicroSurface=e,this},t.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},t.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},t.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},t.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},t.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},t.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},t.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},t.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},t.ShaderIndexer=1,t}(r.PBRMaterial);r._TypeStore.RegisteredTypes["BABYLON.PBRCustomMaterial"]=l,i.d(t,"CustomShaderStructure",function(){return o}),i.d(t,"ShaderSpecialParts",function(){return a}),i.d(t,"CustomMaterial",function(){return s}),i.d(t,"ShaderAlebdoParts",function(){return f}),i.d(t,"PBRCustomMaterial",function(){return l})},function(e,t,i){"use strict";i.r(t);var n=i(10);i.d(t,"CellMaterial",function(){return n.CellMaterial});var r=i(17);i.d(t,"CustomShaderStructure",function(){return r.CustomShaderStructure}),i.d(t,"ShaderSpecialParts",function(){return r.ShaderSpecialParts}),i.d(t,"CustomMaterial",function(){return r.CustomMaterial}),i.d(t,"ShaderAlebdoParts",function(){return r.ShaderAlebdoParts}),i.d(t,"PBRCustomMaterial",function(){return r.PBRCustomMaterial});var o=i(5);i.d(t,"FireMaterial",function(){return o.FireMaterial});var a=i(7);i.d(t,"FurMaterial",function(){return a.FurMaterial});var s=i(9);i.d(t,"GradientMaterial",function(){return s.GradientMaterial});var f=i(11);i.d(t,"GridMaterial",function(){return f.GridMaterial});var l=i(13);i.d(t,"LavaMaterial",function(){return l.LavaMaterial});var u=i(15);i.d(t,"MixMaterial",function(){return u.MixMaterial});var c=i(16);i.d(t,"NormalMaterial",function(){return c.NormalMaterial});var d=i(14);i.d(t,"ShadowOnlyMaterial",function(){return d.ShadowOnlyMaterial});var p=i(12);i.d(t,"SimpleMaterial",function(){return p.SimpleMaterial});var h=i(4);i.d(t,"SkyMaterial",function(){return h.SkyMaterial});var v=i(8);i.d(t,"TerrainMaterial",function(){return v.TerrainMaterial});var m=i(6);i.d(t,"TriPlanarMaterial",function(){return m.TriPlanarMaterial});var g=i(3);i.d(t,"WaterMaterial",function(){return g.WaterMaterial})},function(e,t,i){"use strict";i.r(t),function(e){var n=i(18);i.d(t,"CellMaterial",function(){return n.CellMaterial}),i.d(t,"CustomShaderStructure",function(){return n.CustomShaderStructure}),i.d(t,"ShaderSpecialParts",function(){return n.ShaderSpecialParts}),i.d(t,"CustomMaterial",function(){return n.CustomMaterial}),i.d(t,"ShaderAlebdoParts",function(){return n.ShaderAlebdoParts}),i.d(t,"PBRCustomMaterial",function(){return n.PBRCustomMaterial}),i.d(t,"FireMaterial",function(){return n.FireMaterial}),i.d(t,"FurMaterial",function(){return n.FurMaterial}),i.d(t,"GradientMaterial",function(){return n.GradientMaterial}),i.d(t,"GridMaterial",function(){return n.GridMaterial}),i.d(t,"LavaMaterial",function(){return n.LavaMaterial}),i.d(t,"MixMaterial",function(){return n.MixMaterial}),i.d(t,"NormalMaterial",function(){return n.NormalMaterial}),i.d(t,"ShadowOnlyMaterial",function(){return n.ShadowOnlyMaterial}),i.d(t,"SimpleMaterial",function(){return n.SimpleMaterial}),i.d(t,"SkyMaterial",function(){return n.SkyMaterial}),i.d(t,"TerrainMaterial",function(){return n.TerrainMaterial}),i.d(t,"TriPlanarMaterial",function(){return n.TriPlanarMaterial}),i.d(t,"WaterMaterial",function(){return n.WaterMaterial});var r=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in r.BABYLON=r.BABYLON||{},n)r.BABYLON[o]=n[o]}.call(this,i(2))}])}); \ No newline at end of file diff --git a/dist/preview release/viewer/babylon.viewer.js b/dist/preview release/viewer/babylon.viewer.js index bc5d6778871..f24a49a0fc4 100644 --- a/dist/preview release/viewer/babylon.viewer.js +++ b/dist/preview release/viewer/babylon.viewer.js @@ -171,7 +171,7 @@ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Arr /*!***********************************!*\ !*** ./Behaviors/Meshes/index.ts ***! \***********************************/ -/*! exports provided: AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./attachToBoxBehavior */"./Behaviors/Meshes/attachToBoxBehavior.ts");r.d(t,"AttachToBoxBehavior",function(){return n.AttachToBoxBehavior});var i=r(/*! ./fadeInOutBehavior */"./Behaviors/Meshes/fadeInOutBehavior.ts");r.d(t,"FadeInOutBehavior",function(){return i.FadeInOutBehavior});var o=r(/*! ./multiPointerScaleBehavior */"./Behaviors/Meshes/multiPointerScaleBehavior.ts");r.d(t,"MultiPointerScaleBehavior",function(){return o.MultiPointerScaleBehavior});var s=r(/*! ./pointerDragBehavior */"./Behaviors/Meshes/pointerDragBehavior.ts");r.d(t,"PointerDragBehavior",function(){return s.PointerDragBehavior});var a=r(/*! ./sixDofDragBehavior */"./Behaviors/Meshes/sixDofDragBehavior.ts");r.d(t,"SixDofDragBehavior",function(){return a.SixDofDragBehavior})},"./Behaviors/Meshes/multiPointerScaleBehavior.ts": +/*! exports provided: PointerDragBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./attachToBoxBehavior */"./Behaviors/Meshes/attachToBoxBehavior.ts");r.d(t,"AttachToBoxBehavior",function(){return n.AttachToBoxBehavior});var i=r(/*! ./fadeInOutBehavior */"./Behaviors/Meshes/fadeInOutBehavior.ts");r.d(t,"FadeInOutBehavior",function(){return i.FadeInOutBehavior});var o=r(/*! ./multiPointerScaleBehavior */"./Behaviors/Meshes/multiPointerScaleBehavior.ts");r.d(t,"MultiPointerScaleBehavior",function(){return o.MultiPointerScaleBehavior});var s=r(/*! ./pointerDragBehavior */"./Behaviors/Meshes/pointerDragBehavior.ts");r.d(t,"PointerDragBehavior",function(){return s.PointerDragBehavior});var a=r(/*! ./sixDofDragBehavior */"./Behaviors/Meshes/sixDofDragBehavior.ts");r.d(t,"SixDofDragBehavior",function(){return a.SixDofDragBehavior})},"./Behaviors/Meshes/multiPointerScaleBehavior.ts": /*!*******************************************************!*\ !*** ./Behaviors/Meshes/multiPointerScaleBehavior.ts ***! \*******************************************************/ @@ -187,7 +187,7 @@ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Arr /*!****************************!*\ !*** ./Behaviors/index.ts ***! \****************************/ -/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./Cameras/index */"./Behaviors/Cameras/index.ts");r.d(t,"AutoRotationBehavior",function(){return n.AutoRotationBehavior}),r.d(t,"BouncingBehavior",function(){return n.BouncingBehavior}),r.d(t,"FramingBehavior",function(){return n.FramingBehavior});var i=r(/*! ./Meshes/index */"./Behaviors/Meshes/index.ts");r.d(t,"AttachToBoxBehavior",function(){return i.AttachToBoxBehavior}),r.d(t,"FadeInOutBehavior",function(){return i.FadeInOutBehavior}),r.d(t,"MultiPointerScaleBehavior",function(){return i.MultiPointerScaleBehavior}),r.d(t,"PointerDragBehavior",function(){return i.PointerDragBehavior}),r.d(t,"SixDofDragBehavior",function(){return i.SixDofDragBehavior})},"./Bones/bone.ts": +/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./Cameras/index */"./Behaviors/Cameras/index.ts");r.d(t,"AutoRotationBehavior",function(){return n.AutoRotationBehavior}),r.d(t,"BouncingBehavior",function(){return n.BouncingBehavior}),r.d(t,"FramingBehavior",function(){return n.FramingBehavior});var i=r(/*! ./Meshes/index */"./Behaviors/Meshes/index.ts");r.d(t,"PointerDragBehavior",function(){return i.PointerDragBehavior}),r.d(t,"AttachToBoxBehavior",function(){return i.AttachToBoxBehavior}),r.d(t,"FadeInOutBehavior",function(){return i.FadeInOutBehavior}),r.d(t,"MultiPointerScaleBehavior",function(){return i.MultiPointerScaleBehavior}),r.d(t,"SixDofDragBehavior",function(){return i.SixDofDragBehavior})},"./Bones/bone.ts": /*!***********************!*\ !*** ./Bones/bone.ts ***! \***********************/ @@ -747,7 +747,7 @@ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Arr /*!***************************!*\ !*** ./Gamepads/index.ts ***! \***************************/ -/*! exports provided: StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./Controllers/index */"./Gamepads/Controllers/index.ts");r.d(t,"DaydreamController",function(){return n.DaydreamController}),r.d(t,"GearVRController",function(){return n.GearVRController}),r.d(t,"GenericController",function(){return n.GenericController}),r.d(t,"OculusTouchController",function(){return n.OculusTouchController}),r.d(t,"PoseEnabledControllerType",function(){return n.PoseEnabledControllerType}),r.d(t,"PoseEnabledControllerHelper",function(){return n.PoseEnabledControllerHelper}),r.d(t,"PoseEnabledController",function(){return n.PoseEnabledController}),r.d(t,"ViveController",function(){return n.ViveController}),r.d(t,"WebVRController",function(){return n.WebVRController}),r.d(t,"WindowsMotionController",function(){return n.WindowsMotionController});var i=r(/*! ./gamepad */"./Gamepads/gamepad.ts");r.d(t,"StickValues",function(){return i.StickValues}),r.d(t,"Gamepad",function(){return i.Gamepad}),r.d(t,"GenericPad",function(){return i.GenericPad});var o=r(/*! ./gamepadManager */"./Gamepads/gamepadManager.ts");r.d(t,"GamepadManager",function(){return o.GamepadManager});var s=r(/*! ./gamepadSceneComponent */"./Gamepads/gamepadSceneComponent.ts");r.d(t,"GamepadSystemSceneComponent",function(){return s.GamepadSystemSceneComponent});var a=r(/*! ./xboxGamepad */"./Gamepads/xboxGamepad.ts");r.d(t,"Xbox360Button",function(){return a.Xbox360Button}),r.d(t,"Xbox360Dpad",function(){return a.Xbox360Dpad}),r.d(t,"Xbox360Pad",function(){return a.Xbox360Pad});var c=r(/*! ./dualShockGamepad */"./Gamepads/dualShockGamepad.ts");r.d(t,"DualShockButton",function(){return c.DualShockButton}),r.d(t,"DualShockDpad",function(){return c.DualShockDpad}),r.d(t,"DualShockPad",function(){return c.DualShockPad})},"./Gamepads/xboxGamepad.ts": +/*! exports provided: DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./Controllers/index */"./Gamepads/Controllers/index.ts");r.d(t,"DaydreamController",function(){return n.DaydreamController}),r.d(t,"GearVRController",function(){return n.GearVRController}),r.d(t,"GenericController",function(){return n.GenericController}),r.d(t,"OculusTouchController",function(){return n.OculusTouchController}),r.d(t,"PoseEnabledControllerType",function(){return n.PoseEnabledControllerType}),r.d(t,"PoseEnabledControllerHelper",function(){return n.PoseEnabledControllerHelper}),r.d(t,"PoseEnabledController",function(){return n.PoseEnabledController}),r.d(t,"ViveController",function(){return n.ViveController}),r.d(t,"WebVRController",function(){return n.WebVRController}),r.d(t,"WindowsMotionController",function(){return n.WindowsMotionController});var i=r(/*! ./gamepad */"./Gamepads/gamepad.ts");r.d(t,"StickValues",function(){return i.StickValues}),r.d(t,"Gamepad",function(){return i.Gamepad}),r.d(t,"GenericPad",function(){return i.GenericPad});var o=r(/*! ./gamepadManager */"./Gamepads/gamepadManager.ts");r.d(t,"GamepadManager",function(){return o.GamepadManager});var s=r(/*! ./gamepadSceneComponent */"./Gamepads/gamepadSceneComponent.ts");r.d(t,"GamepadSystemSceneComponent",function(){return s.GamepadSystemSceneComponent});var a=r(/*! ./xboxGamepad */"./Gamepads/xboxGamepad.ts");r.d(t,"Xbox360Button",function(){return a.Xbox360Button}),r.d(t,"Xbox360Dpad",function(){return a.Xbox360Dpad}),r.d(t,"Xbox360Pad",function(){return a.Xbox360Pad});var c=r(/*! ./dualShockGamepad */"./Gamepads/dualShockGamepad.ts");r.d(t,"DualShockButton",function(){return c.DualShockButton}),r.d(t,"DualShockDpad",function(){return c.DualShockDpad}),r.d(t,"DualShockPad",function(){return c.DualShockPad})},"./Gamepads/xboxGamepad.ts": /*!*********************************!*\ !*** ./Gamepads/xboxGamepad.ts ***! \*********************************/ @@ -871,7 +871,7 @@ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Arr /*!**************************!*\ !*** ./Legacy/legacy.ts ***! \**************************/ -/*! exports provided: Debug, AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Debug",function(){return l});var n=r(/*! ../index */"./index.ts"),i=r(/*! ../Debug/index */"./Debug/index.ts");r.d(t,"AbstractScene",function(){return n.AbstractScene}),r.d(t,"KeepAssets",function(){return n.KeepAssets}),r.d(t,"AssetContainer",function(){return n.AssetContainer}),r.d(t,"Node",function(){return n.Node}),r.d(t,"Scene",function(){return n.Scene}),r.d(t,"SceneComponentConstants",function(){return n.SceneComponentConstants}),r.d(t,"Stage",function(){return n.Stage}),r.d(t,"AbstractActionManager",function(){return n.AbstractActionManager}),r.d(t,"Action",function(){return n.Action}),r.d(t,"ActionEvent",function(){return n.ActionEvent}),r.d(t,"ActionManager",function(){return n.ActionManager}),r.d(t,"Condition",function(){return n.Condition}),r.d(t,"ValueCondition",function(){return n.ValueCondition}),r.d(t,"PredicateCondition",function(){return n.PredicateCondition}),r.d(t,"StateCondition",function(){return n.StateCondition}),r.d(t,"SwitchBooleanAction",function(){return n.SwitchBooleanAction}),r.d(t,"SetStateAction",function(){return n.SetStateAction}),r.d(t,"SetValueAction",function(){return n.SetValueAction}),r.d(t,"IncrementValueAction",function(){return n.IncrementValueAction}),r.d(t,"PlayAnimationAction",function(){return n.PlayAnimationAction}),r.d(t,"StopAnimationAction",function(){return n.StopAnimationAction}),r.d(t,"DoNothingAction",function(){return n.DoNothingAction}),r.d(t,"CombineAction",function(){return n.CombineAction}),r.d(t,"ExecuteCodeAction",function(){return n.ExecuteCodeAction}),r.d(t,"SetParentAction",function(){return n.SetParentAction}),r.d(t,"PlaySoundAction",function(){return n.PlaySoundAction}),r.d(t,"StopSoundAction",function(){return n.StopSoundAction}),r.d(t,"InterpolateValueAction",function(){return n.InterpolateValueAction}),r.d(t,"Animatable",function(){return n.Animatable}),r.d(t,"_IAnimationState",function(){return n._IAnimationState}),r.d(t,"Animation",function(){return n.Animation}),r.d(t,"TargetedAnimation",function(){return n.TargetedAnimation}),r.d(t,"AnimationGroup",function(){return n.AnimationGroup}),r.d(t,"AnimationPropertiesOverride",function(){return n.AnimationPropertiesOverride}),r.d(t,"EasingFunction",function(){return n.EasingFunction}),r.d(t,"CircleEase",function(){return n.CircleEase}),r.d(t,"BackEase",function(){return n.BackEase}),r.d(t,"BounceEase",function(){return n.BounceEase}),r.d(t,"CubicEase",function(){return n.CubicEase}),r.d(t,"ElasticEase",function(){return n.ElasticEase}),r.d(t,"ExponentialEase",function(){return n.ExponentialEase}),r.d(t,"PowerEase",function(){return n.PowerEase}),r.d(t,"QuadraticEase",function(){return n.QuadraticEase}),r.d(t,"QuarticEase",function(){return n.QuarticEase}),r.d(t,"QuinticEase",function(){return n.QuinticEase}),r.d(t,"SineEase",function(){return n.SineEase}),r.d(t,"BezierCurveEase",function(){return n.BezierCurveEase}),r.d(t,"RuntimeAnimation",function(){return n.RuntimeAnimation}),r.d(t,"AnimationEvent",function(){return n.AnimationEvent}),r.d(t,"AnimationKeyInterpolation",function(){return n.AnimationKeyInterpolation}),r.d(t,"AnimationRange",function(){return n.AnimationRange}),r.d(t,"Analyser",function(){return n.Analyser}),r.d(t,"AudioEngine",function(){return n.AudioEngine}),r.d(t,"AudioSceneComponent",function(){return n.AudioSceneComponent}),r.d(t,"Sound",function(){return n.Sound}),r.d(t,"SoundTrack",function(){return n.SoundTrack}),r.d(t,"WeightedSound",function(){return n.WeightedSound}),r.d(t,"Bone",function(){return n.Bone}),r.d(t,"BoneIKController",function(){return n.BoneIKController}),r.d(t,"BoneLookController",function(){return n.BoneLookController}),r.d(t,"Skeleton",function(){return n.Skeleton}),r.d(t,"CameraInputTypes",function(){return n.CameraInputTypes}),r.d(t,"CameraInputsManager",function(){return n.CameraInputsManager}),r.d(t,"Camera",function(){return n.Camera}),r.d(t,"TargetCamera",function(){return n.TargetCamera}),r.d(t,"FreeCamera",function(){return n.FreeCamera}),r.d(t,"FreeCameraInputsManager",function(){return n.FreeCameraInputsManager}),r.d(t,"TouchCamera",function(){return n.TouchCamera}),r.d(t,"ArcRotateCamera",function(){return n.ArcRotateCamera}),r.d(t,"ArcRotateCameraInputsManager",function(){return n.ArcRotateCameraInputsManager}),r.d(t,"DeviceOrientationCamera",function(){return n.DeviceOrientationCamera}),r.d(t,"FlyCamera",function(){return n.FlyCamera}),r.d(t,"FlyCameraInputsManager",function(){return n.FlyCameraInputsManager}),r.d(t,"FollowCamera",function(){return n.FollowCamera}),r.d(t,"ArcFollowCamera",function(){return n.ArcFollowCamera}),r.d(t,"FollowCameraInputsManager",function(){return n.FollowCameraInputsManager}),r.d(t,"GamepadCamera",function(){return n.GamepadCamera}),r.d(t,"UniversalCamera",function(){return n.UniversalCamera}),r.d(t,"VirtualJoysticksCamera",function(){return n.VirtualJoysticksCamera}),r.d(t,"Collider",function(){return n.Collider}),r.d(t,"DefaultCollisionCoordinator",function(){return n.DefaultCollisionCoordinator}),r.d(t,"PickingInfo",function(){return n.PickingInfo}),r.d(t,"IntersectionInfo",function(){return n.IntersectionInfo}),r.d(t,"_MeshCollisionData",function(){return n._MeshCollisionData}),r.d(t,"BoundingBox",function(){return n.BoundingBox}),r.d(t,"BoundingInfo",function(){return n.BoundingInfo}),r.d(t,"BoundingSphere",function(){return n.BoundingSphere}),r.d(t,"Ray",function(){return n.Ray}),r.d(t,"AxesViewer",function(){return n.AxesViewer}),r.d(t,"BoneAxesViewer",function(){return n.BoneAxesViewer}),r.d(t,"DebugLayer",function(){return n.DebugLayer}),r.d(t,"PhysicsViewer",function(){return n.PhysicsViewer}),r.d(t,"RayHelper",function(){return n.RayHelper}),r.d(t,"SkeletonViewer",function(){return n.SkeletonViewer}),r.d(t,"Constants",function(){return n.Constants}),r.d(t,"InstancingAttributeInfo",function(){return n.InstancingAttributeInfo}),r.d(t,"DepthTextureCreationOptions",function(){return n.DepthTextureCreationOptions}),r.d(t,"EngineCapabilities",function(){return n.EngineCapabilities}),r.d(t,"Engine",function(){return n.Engine}),r.d(t,"EngineStore",function(){return n.EngineStore}),r.d(t,"NullEngineOptions",function(){return n.NullEngineOptions}),r.d(t,"NullEngine",function(){return n.NullEngine}),r.d(t,"WebGLPipelineContext",function(){return n.WebGLPipelineContext}),r.d(t,"WebGL2ShaderProcessor",function(){return n.WebGL2ShaderProcessor}),r.d(t,"NativeEngine",function(){return n.NativeEngine}),r.d(t,"KeyboardEventTypes",function(){return n.KeyboardEventTypes}),r.d(t,"KeyboardInfo",function(){return n.KeyboardInfo}),r.d(t,"KeyboardInfoPre",function(){return n.KeyboardInfoPre}),r.d(t,"PointerEventTypes",function(){return n.PointerEventTypes}),r.d(t,"PointerInfoBase",function(){return n.PointerInfoBase}),r.d(t,"PointerInfoPre",function(){return n.PointerInfoPre}),r.d(t,"PointerInfo",function(){return n.PointerInfo}),r.d(t,"ClipboardEventTypes",function(){return n.ClipboardEventTypes}),r.d(t,"ClipboardInfo",function(){return n.ClipboardInfo}),r.d(t,"StickValues",function(){return n.StickValues}),r.d(t,"Gamepad",function(){return n.Gamepad}),r.d(t,"GenericPad",function(){return n.GenericPad}),r.d(t,"GamepadManager",function(){return n.GamepadManager}),r.d(t,"GamepadSystemSceneComponent",function(){return n.GamepadSystemSceneComponent}),r.d(t,"Xbox360Button",function(){return n.Xbox360Button}),r.d(t,"Xbox360Dpad",function(){return n.Xbox360Dpad}),r.d(t,"Xbox360Pad",function(){return n.Xbox360Pad}),r.d(t,"DualShockButton",function(){return n.DualShockButton}),r.d(t,"DualShockDpad",function(){return n.DualShockDpad}),r.d(t,"DualShockPad",function(){return n.DualShockPad}),r.d(t,"AxisDragGizmo",function(){return n.AxisDragGizmo}),r.d(t,"AxisScaleGizmo",function(){return n.AxisScaleGizmo}),r.d(t,"BoundingBoxGizmo",function(){return n.BoundingBoxGizmo}),r.d(t,"Gizmo",function(){return n.Gizmo}),r.d(t,"GizmoManager",function(){return n.GizmoManager}),r.d(t,"PlaneRotationGizmo",function(){return n.PlaneRotationGizmo}),r.d(t,"PositionGizmo",function(){return n.PositionGizmo}),r.d(t,"RotationGizmo",function(){return n.RotationGizmo}),r.d(t,"ScaleGizmo",function(){return n.ScaleGizmo}),r.d(t,"LightGizmo",function(){return n.LightGizmo}),r.d(t,"PlaneDragGizmo",function(){return n.PlaneDragGizmo}),r.d(t,"EnvironmentHelper",function(){return n.EnvironmentHelper}),r.d(t,"PhotoDome",function(){return n.PhotoDome}),r.d(t,"_forceSceneHelpersToBundle",function(){return n._forceSceneHelpersToBundle}),r.d(t,"VideoDome",function(){return n.VideoDome}),r.d(t,"EngineInstrumentation",function(){return n.EngineInstrumentation}),r.d(t,"SceneInstrumentation",function(){return n.SceneInstrumentation}),r.d(t,"_TimeToken",function(){return n._TimeToken}),r.d(t,"EffectLayer",function(){return n.EffectLayer}),r.d(t,"EffectLayerSceneComponent",function(){return n.EffectLayerSceneComponent}),r.d(t,"GlowLayer",function(){return n.GlowLayer}),r.d(t,"HighlightLayer",function(){return n.HighlightLayer}),r.d(t,"Layer",function(){return n.Layer}),r.d(t,"LayerSceneComponent",function(){return n.LayerSceneComponent}),r.d(t,"LensFlare",function(){return n.LensFlare}),r.d(t,"LensFlareSystem",function(){return n.LensFlareSystem}),r.d(t,"LensFlareSystemSceneComponent",function(){return n.LensFlareSystemSceneComponent}),r.d(t,"Light",function(){return n.Light}),r.d(t,"ShadowLight",function(){return n.ShadowLight}),r.d(t,"DirectionalLight",function(){return n.DirectionalLight}),r.d(t,"HemisphericLight",function(){return n.HemisphericLight}),r.d(t,"PointLight",function(){return n.PointLight}),r.d(t,"SpotLight",function(){return n.SpotLight}),r.d(t,"DefaultLoadingScreen",function(){return n.DefaultLoadingScreen}),r.d(t,"SceneLoaderProgressEvent",function(){return n.SceneLoaderProgressEvent}),r.d(t,"SceneLoader",function(){return n.SceneLoader}),r.d(t,"SceneLoaderFlags",function(){return n.SceneLoaderFlags}),r.d(t,"ColorCurves",function(){return n.ColorCurves}),r.d(t,"EffectFallbacks",function(){return n.EffectFallbacks}),r.d(t,"EffectCreationOptions",function(){return n.EffectCreationOptions}),r.d(t,"Effect",function(){return n.Effect}),r.d(t,"FresnelParameters",function(){return n.FresnelParameters}),r.d(t,"ImageProcessingConfigurationDefines",function(){return n.ImageProcessingConfigurationDefines}),r.d(t,"ImageProcessingConfiguration",function(){return n.ImageProcessingConfiguration}),r.d(t,"Material",function(){return n.Material}),r.d(t,"MaterialDefines",function(){return n.MaterialDefines}),r.d(t,"MaterialHelper",function(){return n.MaterialHelper}),r.d(t,"MultiMaterial",function(){return n.MultiMaterial}),r.d(t,"PushMaterial",function(){return n.PushMaterial}),r.d(t,"ShaderMaterial",function(){return n.ShaderMaterial}),r.d(t,"StandardMaterialDefines",function(){return n.StandardMaterialDefines}),r.d(t,"StandardMaterial",function(){return n.StandardMaterial}),r.d(t,"BaseTexture",function(){return n.BaseTexture}),r.d(t,"CubeTexture",function(){return n.CubeTexture}),r.d(t,"DynamicTexture",function(){return n.DynamicTexture}),r.d(t,"EquiRectangularCubeTexture",function(){return n.EquiRectangularCubeTexture}),r.d(t,"HDRCubeTexture",function(){return n.HDRCubeTexture}),r.d(t,"InternalTexture",function(){return n.InternalTexture}),r.d(t,"MirrorTexture",function(){return n.MirrorTexture}),r.d(t,"MultiRenderTarget",function(){return n.MultiRenderTarget}),r.d(t,"RawTexture",function(){return n.RawTexture}),r.d(t,"RenderTargetTexture",function(){return n.RenderTargetTexture}),r.d(t,"Texture",function(){return n.Texture}),r.d(t,"UniformBuffer",function(){return n.UniformBuffer}),r.d(t,"MaterialFlags",function(){return n.MaterialFlags}),r.d(t,"EffectRenderer",function(){return n.EffectRenderer}),r.d(t,"EffectWrapper",function(){return n.EffectWrapper}),r.d(t,"Scalar",function(){return n.Scalar}),r.d(t,"Space",function(){return n.Space}),r.d(t,"Axis",function(){return n.Axis}),r.d(t,"Color3",function(){return n.Color3}),r.d(t,"Color4",function(){return n.Color4}),r.d(t,"TmpColors",function(){return n.TmpColors}),r.d(t,"ToGammaSpace",function(){return n.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return n.ToLinearSpace}),r.d(t,"Epsilon",function(){return n.Epsilon}),r.d(t,"Frustum",function(){return n.Frustum}),r.d(t,"Orientation",function(){return n.Orientation}),r.d(t,"BezierCurve",function(){return n.BezierCurve}),r.d(t,"Angle",function(){return n.Angle}),r.d(t,"Arc2",function(){return n.Arc2}),r.d(t,"Path2",function(){return n.Path2}),r.d(t,"Path3D",function(){return n.Path3D}),r.d(t,"Curve3",function(){return n.Curve3}),r.d(t,"Plane",function(){return n.Plane}),r.d(t,"Size",function(){return n.Size}),r.d(t,"Vector2",function(){return n.Vector2}),r.d(t,"Vector3",function(){return n.Vector3}),r.d(t,"Vector4",function(){return n.Vector4}),r.d(t,"Quaternion",function(){return n.Quaternion}),r.d(t,"Matrix",function(){return n.Matrix}),r.d(t,"TmpVectors",function(){return n.TmpVectors}),r.d(t,"Viewport",function(){return n.Viewport}),r.d(t,"SphericalHarmonics",function(){return n.SphericalHarmonics}),r.d(t,"SphericalPolynomial",function(){return n.SphericalPolynomial}),r.d(t,"AbstractMesh",function(){return n.AbstractMesh}),r.d(t,"Buffer",function(){return n.Buffer}),r.d(t,"VertexBuffer",function(){return n.VertexBuffer}),r.d(t,"CSG",function(){return n.CSG}),r.d(t,"Geometry",function(){return n.Geometry}),r.d(t,"GroundMesh",function(){return n.GroundMesh}),r.d(t,"TrailMesh",function(){return n.TrailMesh}),r.d(t,"InstancedMesh",function(){return n.InstancedMesh}),r.d(t,"LinesMesh",function(){return n.LinesMesh}),r.d(t,"InstancedLinesMesh",function(){return n.InstancedLinesMesh}),r.d(t,"_CreationDataStorage",function(){return n._CreationDataStorage}),r.d(t,"_InstancesBatch",function(){return n._InstancesBatch}),r.d(t,"Mesh",function(){return n.Mesh}),r.d(t,"VertexData",function(){return n.VertexData}),r.d(t,"MeshBuilder",function(){return n.MeshBuilder}),r.d(t,"SimplificationSettings",function(){return n.SimplificationSettings}),r.d(t,"SimplificationQueue",function(){return n.SimplificationQueue}),r.d(t,"SimplificationType",function(){return n.SimplificationType}),r.d(t,"SimplicationQueueSceneComponent",function(){return n.SimplicationQueueSceneComponent}),r.d(t,"Polygon",function(){return n.Polygon}),r.d(t,"PolygonMeshBuilder",function(){return n.PolygonMeshBuilder}),r.d(t,"BaseSubMesh",function(){return n.BaseSubMesh}),r.d(t,"SubMesh",function(){return n.SubMesh}),r.d(t,"MeshLODLevel",function(){return n.MeshLODLevel}),r.d(t,"TransformNode",function(){return n.TransformNode}),r.d(t,"BoxBuilder",function(){return n.BoxBuilder}),r.d(t,"SphereBuilder",function(){return n.SphereBuilder}),r.d(t,"CylinderBuilder",function(){return n.CylinderBuilder}),r.d(t,"TorusBuilder",function(){return n.TorusBuilder}),r.d(t,"LinesBuilder",function(){return n.LinesBuilder}),r.d(t,"PlaneBuilder",function(){return n.PlaneBuilder}),r.d(t,"GroundBuilder",function(){return n.GroundBuilder}),r.d(t,"DataBuffer",function(){return n.DataBuffer}),r.d(t,"WebGLDataBuffer",function(){return n.WebGLDataBuffer}),r.d(t,"MorphTarget",function(){return n.MorphTarget}),r.d(t,"MorphTargetManager",function(){return n.MorphTargetManager}),r.d(t,"Database",function(){return n.Database}),r.d(t,"BaseParticleSystem",function(){return n.BaseParticleSystem}),r.d(t,"GPUParticleSystem",function(){return n.GPUParticleSystem}),r.d(t,"Particle",function(){return n.Particle}),r.d(t,"ParticleHelper",function(){return n.ParticleHelper}),r.d(t,"ParticleSystem",function(){return n.ParticleSystem}),r.d(t,"_IDoNeedToBeInTheBuild",function(){return n._IDoNeedToBeInTheBuild}),r.d(t,"ParticleSystemSet",function(){return n.ParticleSystemSet}),r.d(t,"SolidParticle",function(){return n.SolidParticle}),r.d(t,"ModelShape",function(){return n.ModelShape}),r.d(t,"DepthSortedParticle",function(){return n.DepthSortedParticle}),r.d(t,"SolidParticleSystem",function(){return n.SolidParticleSystem}),r.d(t,"SubEmitterType",function(){return n.SubEmitterType}),r.d(t,"SubEmitter",function(){return n.SubEmitter}),r.d(t,"PhysicsEngine",function(){return n.PhysicsEngine}),r.d(t,"PhysicsEngineSceneComponent",function(){return n.PhysicsEngineSceneComponent}),r.d(t,"PhysicsHelper",function(){return n.PhysicsHelper}),r.d(t,"PhysicsRadialExplosionEventOptions",function(){return n.PhysicsRadialExplosionEventOptions}),r.d(t,"PhysicsUpdraftEventOptions",function(){return n.PhysicsUpdraftEventOptions}),r.d(t,"PhysicsVortexEventOptions",function(){return n.PhysicsVortexEventOptions}),r.d(t,"PhysicsRadialImpulseFalloff",function(){return n.PhysicsRadialImpulseFalloff}),r.d(t,"PhysicsUpdraftMode",function(){return n.PhysicsUpdraftMode}),r.d(t,"PhysicsImpostor",function(){return n.PhysicsImpostor}),r.d(t,"PhysicsJoint",function(){return n.PhysicsJoint}),r.d(t,"DistanceJoint",function(){return n.DistanceJoint}),r.d(t,"MotorEnabledJoint",function(){return n.MotorEnabledJoint}),r.d(t,"HingeJoint",function(){return n.HingeJoint}),r.d(t,"Hinge2Joint",function(){return n.Hinge2Joint}),r.d(t,"AnaglyphPostProcess",function(){return n.AnaglyphPostProcess}),r.d(t,"BlackAndWhitePostProcess",function(){return n.BlackAndWhitePostProcess}),r.d(t,"BloomEffect",function(){return n.BloomEffect}),r.d(t,"BloomMergePostProcess",function(){return n.BloomMergePostProcess}),r.d(t,"BlurPostProcess",function(){return n.BlurPostProcess}),r.d(t,"ChromaticAberrationPostProcess",function(){return n.ChromaticAberrationPostProcess}),r.d(t,"CircleOfConfusionPostProcess",function(){return n.CircleOfConfusionPostProcess}),r.d(t,"ColorCorrectionPostProcess",function(){return n.ColorCorrectionPostProcess}),r.d(t,"ConvolutionPostProcess",function(){return n.ConvolutionPostProcess}),r.d(t,"DepthOfFieldBlurPostProcess",function(){return n.DepthOfFieldBlurPostProcess}),r.d(t,"DepthOfFieldEffectBlurLevel",function(){return n.DepthOfFieldEffectBlurLevel}),r.d(t,"DepthOfFieldEffect",function(){return n.DepthOfFieldEffect}),r.d(t,"DepthOfFieldMergePostProcessOptions",function(){return n.DepthOfFieldMergePostProcessOptions}),r.d(t,"DepthOfFieldMergePostProcess",function(){return n.DepthOfFieldMergePostProcess}),r.d(t,"DisplayPassPostProcess",function(){return n.DisplayPassPostProcess}),r.d(t,"ExtractHighlightsPostProcess",function(){return n.ExtractHighlightsPostProcess}),r.d(t,"FilterPostProcess",function(){return n.FilterPostProcess}),r.d(t,"FxaaPostProcess",function(){return n.FxaaPostProcess}),r.d(t,"GrainPostProcess",function(){return n.GrainPostProcess}),r.d(t,"HighlightsPostProcess",function(){return n.HighlightsPostProcess}),r.d(t,"ImageProcessingPostProcess",function(){return n.ImageProcessingPostProcess}),r.d(t,"MotionBlurPostProcess",function(){return n.MotionBlurPostProcess}),r.d(t,"PassPostProcess",function(){return n.PassPostProcess}),r.d(t,"PassCubePostProcess",function(){return n.PassCubePostProcess}),r.d(t,"PostProcess",function(){return n.PostProcess}),r.d(t,"PostProcessManager",function(){return n.PostProcessManager}),r.d(t,"RefractionPostProcess",function(){return n.RefractionPostProcess}),r.d(t,"SharpenPostProcess",function(){return n.SharpenPostProcess}),r.d(t,"StereoscopicInterlacePostProcess",function(){return n.StereoscopicInterlacePostProcess}),r.d(t,"TonemappingOperator",function(){return n.TonemappingOperator}),r.d(t,"TonemapPostProcess",function(){return n.TonemapPostProcess}),r.d(t,"VolumetricLightScatteringPostProcess",function(){return n.VolumetricLightScatteringPostProcess}),r.d(t,"VRDistortionCorrectionPostProcess",function(){return n.VRDistortionCorrectionPostProcess}),r.d(t,"VRMultiviewToSingleviewPostProcess",function(){return n.VRMultiviewToSingleviewPostProcess}),r.d(t,"ReflectionProbe",function(){return n.ReflectionProbe}),r.d(t,"BoundingBoxRenderer",function(){return n.BoundingBoxRenderer}),r.d(t,"DepthRenderer",function(){return n.DepthRenderer}),r.d(t,"DepthRendererSceneComponent",function(){return n.DepthRendererSceneComponent}),r.d(t,"EdgesRenderer",function(){return n.EdgesRenderer}),r.d(t,"LineEdgesRenderer",function(){return n.LineEdgesRenderer}),r.d(t,"GeometryBufferRenderer",function(){return n.GeometryBufferRenderer}),r.d(t,"GeometryBufferRendererSceneComponent",function(){return n.GeometryBufferRendererSceneComponent}),r.d(t,"OutlineRenderer",function(){return n.OutlineRenderer}),r.d(t,"RenderingGroup",function(){return n.RenderingGroup}),r.d(t,"RenderingGroupInfo",function(){return n.RenderingGroupInfo}),r.d(t,"RenderingManager",function(){return n.RenderingManager}),r.d(t,"UtilityLayerRenderer",function(){return n.UtilityLayerRenderer}),r.d(t,"Sprite",function(){return n.Sprite}),r.d(t,"SpriteManager",function(){return n.SpriteManager}),r.d(t,"SpritePackedManager",function(){return n.SpritePackedManager}),r.d(t,"SpriteSceneComponent",function(){return n.SpriteSceneComponent}),r.d(t,"_AlphaState",function(){return n._AlphaState}),r.d(t,"_DepthCullingState",function(){return n._DepthCullingState}),r.d(t,"_StencilState",function(){return n._StencilState}),r.d(t,"AndOrNotEvaluator",function(){return n.AndOrNotEvaluator}),r.d(t,"AssetTaskState",function(){return n.AssetTaskState}),r.d(t,"AbstractAssetTask",function(){return n.AbstractAssetTask}),r.d(t,"AssetsProgressEvent",function(){return n.AssetsProgressEvent}),r.d(t,"MeshAssetTask",function(){return n.MeshAssetTask}),r.d(t,"TextFileAssetTask",function(){return n.TextFileAssetTask}),r.d(t,"BinaryFileAssetTask",function(){return n.BinaryFileAssetTask}),r.d(t,"ImageAssetTask",function(){return n.ImageAssetTask}),r.d(t,"TextureAssetTask",function(){return n.TextureAssetTask}),r.d(t,"CubeTextureAssetTask",function(){return n.CubeTextureAssetTask}),r.d(t,"HDRCubeTextureAssetTask",function(){return n.HDRCubeTextureAssetTask}),r.d(t,"EquiRectangularCubeTextureAssetTask",function(){return n.EquiRectangularCubeTextureAssetTask}),r.d(t,"AssetsManager",function(){return n.AssetsManager}),r.d(t,"DDSTools",function(){return n.DDSTools}),r.d(t,"expandToProperty",function(){return n.expandToProperty}),r.d(t,"serialize",function(){return n.serialize}),r.d(t,"serializeAsTexture",function(){return n.serializeAsTexture}),r.d(t,"serializeAsColor3",function(){return n.serializeAsColor3}),r.d(t,"serializeAsFresnelParameters",function(){return n.serializeAsFresnelParameters}),r.d(t,"serializeAsVector2",function(){return n.serializeAsVector2}),r.d(t,"serializeAsVector3",function(){return n.serializeAsVector3}),r.d(t,"serializeAsMeshReference",function(){return n.serializeAsMeshReference}),r.d(t,"serializeAsColorCurves",function(){return n.serializeAsColorCurves}),r.d(t,"serializeAsColor4",function(){return n.serializeAsColor4}),r.d(t,"serializeAsImageProcessingConfiguration",function(){return n.serializeAsImageProcessingConfiguration}),r.d(t,"serializeAsQuaternion",function(){return n.serializeAsQuaternion}),r.d(t,"serializeAsMatrix",function(){return n.serializeAsMatrix}),r.d(t,"serializeAsCameraReference",function(){return n.serializeAsCameraReference}),r.d(t,"SerializationHelper",function(){return n.SerializationHelper}),r.d(t,"Deferred",function(){return n.Deferred}),r.d(t,"EnvironmentTextureTools",function(){return n.EnvironmentTextureTools}),r.d(t,"MeshExploder",function(){return n.MeshExploder}),r.d(t,"FilesInput",function(){return n.FilesInput}),r.d(t,"CubeMapToSphericalPolynomialTools",function(){return n.CubeMapToSphericalPolynomialTools}),r.d(t,"KhronosTextureContainer",function(){return n.KhronosTextureContainer}),r.d(t,"EventState",function(){return n.EventState}),r.d(t,"Observer",function(){return n.Observer}),r.d(t,"MultiObserver",function(){return n.MultiObserver}),r.d(t,"Observable",function(){return n.Observable}),r.d(t,"PerformanceMonitor",function(){return n.PerformanceMonitor}),r.d(t,"RollingAverage",function(){return n.RollingAverage}),r.d(t,"PromisePolyfill",function(){return n.PromisePolyfill}),r.d(t,"SceneOptimization",function(){return n.SceneOptimization}),r.d(t,"TextureOptimization",function(){return n.TextureOptimization}),r.d(t,"HardwareScalingOptimization",function(){return n.HardwareScalingOptimization}),r.d(t,"ShadowsOptimization",function(){return n.ShadowsOptimization}),r.d(t,"PostProcessesOptimization",function(){return n.PostProcessesOptimization}),r.d(t,"LensFlaresOptimization",function(){return n.LensFlaresOptimization}),r.d(t,"CustomOptimization",function(){return n.CustomOptimization}),r.d(t,"ParticlesOptimization",function(){return n.ParticlesOptimization}),r.d(t,"RenderTargetsOptimization",function(){return n.RenderTargetsOptimization}),r.d(t,"MergeMeshesOptimization",function(){return n.MergeMeshesOptimization}),r.d(t,"SceneOptimizerOptions",function(){return n.SceneOptimizerOptions}),r.d(t,"SceneOptimizer",function(){return n.SceneOptimizer}),r.d(t,"SceneSerializer",function(){return n.SceneSerializer}),r.d(t,"SmartArray",function(){return n.SmartArray}),r.d(t,"SmartArrayNoDuplicate",function(){return n.SmartArrayNoDuplicate}),r.d(t,"StringDictionary",function(){return n.StringDictionary}),r.d(t,"Tags",function(){return n.Tags}),r.d(t,"TextureTools",function(){return n.TextureTools}),r.d(t,"TGATools",function(){return n.TGATools}),r.d(t,"Tools",function(){return n.Tools}),r.d(t,"className",function(){return n.className}),r.d(t,"AsyncLoop",function(){return n.AsyncLoop}),r.d(t,"VideoRecorder",function(){return n.VideoRecorder}),r.d(t,"JoystickAxis",function(){return n.JoystickAxis}),r.d(t,"VirtualJoystick",function(){return n.VirtualJoystick}),r.d(t,"WorkerPool",function(){return n.WorkerPool}),r.d(t,"Logger",function(){return n.Logger}),r.d(t,"_TypeStore",function(){return n._TypeStore}),r.d(t,"FilesInputStore",function(){return n.FilesInputStore}),r.d(t,"DeepCopier",function(){return n.DeepCopier}),r.d(t,"PivotTools",function(){return n.PivotTools}),r.d(t,"PrecisionDate",function(){return n.PrecisionDate}),r.d(t,"ScreenshotTools",function(){return n.ScreenshotTools}),r.d(t,"WebRequest",function(){return n.WebRequest}),r.d(t,"InspectableType",function(){return n.InspectableType}),r.d(t,"BRDFTextureTools",function(){return n.BRDFTextureTools}),r.d(t,"RGBDTextureTools",function(){return n.RGBDTextureTools}),r.d(t,"ColorGradient",function(){return n.ColorGradient}),r.d(t,"Color3Gradient",function(){return n.Color3Gradient}),r.d(t,"FactorGradient",function(){return n.FactorGradient}),r.d(t,"GradientHelper",function(){return n.GradientHelper}),r.d(t,"PerfCounter",function(){return n.PerfCounter}),r.d(t,"RetryStrategy",function(){return n.RetryStrategy}),r.d(t,"LoadFileError",function(){return n.LoadFileError}),r.d(t,"AutoRotationBehavior",function(){return n.AutoRotationBehavior}),r.d(t,"BouncingBehavior",function(){return n.BouncingBehavior}),r.d(t,"FramingBehavior",function(){return n.FramingBehavior}),r.d(t,"AttachToBoxBehavior",function(){return n.AttachToBoxBehavior}),r.d(t,"FadeInOutBehavior",function(){return n.FadeInOutBehavior}),r.d(t,"MultiPointerScaleBehavior",function(){return n.MultiPointerScaleBehavior}),r.d(t,"PointerDragBehavior",function(){return n.PointerDragBehavior}),r.d(t,"SixDofDragBehavior",function(){return n.SixDofDragBehavior}),r.d(t,"ArcRotateCameraGamepadInput",function(){return n.ArcRotateCameraGamepadInput}),r.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return n.ArcRotateCameraKeyboardMoveInput}),r.d(t,"ArcRotateCameraMouseWheelInput",function(){return n.ArcRotateCameraMouseWheelInput}),r.d(t,"ArcRotateCameraPointersInput",function(){return n.ArcRotateCameraPointersInput}),r.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return n.ArcRotateCameraVRDeviceOrientationInput}),r.d(t,"FlyCameraKeyboardInput",function(){return n.FlyCameraKeyboardInput}),r.d(t,"FlyCameraMouseInput",function(){return n.FlyCameraMouseInput}),r.d(t,"FollowCameraKeyboardMoveInput",function(){return n.FollowCameraKeyboardMoveInput}),r.d(t,"FollowCameraMouseWheelInput",function(){return n.FollowCameraMouseWheelInput}),r.d(t,"FollowCameraPointersInput",function(){return n.FollowCameraPointersInput}),r.d(t,"FreeCameraDeviceOrientationInput",function(){return n.FreeCameraDeviceOrientationInput}),r.d(t,"FreeCameraGamepadInput",function(){return n.FreeCameraGamepadInput}),r.d(t,"FreeCameraKeyboardMoveInput",function(){return n.FreeCameraKeyboardMoveInput}),r.d(t,"FreeCameraMouseInput",function(){return n.FreeCameraMouseInput}),r.d(t,"FreeCameraTouchInput",function(){return n.FreeCameraTouchInput}),r.d(t,"FreeCameraVirtualJoystickInput",function(){return n.FreeCameraVirtualJoystickInput}),r.d(t,"AnaglyphArcRotateCamera",function(){return n.AnaglyphArcRotateCamera}),r.d(t,"AnaglyphFreeCamera",function(){return n.AnaglyphFreeCamera}),r.d(t,"AnaglyphGamepadCamera",function(){return n.AnaglyphGamepadCamera}),r.d(t,"AnaglyphUniversalCamera",function(){return n.AnaglyphUniversalCamera}),r.d(t,"StereoscopicArcRotateCamera",function(){return n.StereoscopicArcRotateCamera}),r.d(t,"StereoscopicFreeCamera",function(){return n.StereoscopicFreeCamera}),r.d(t,"StereoscopicGamepadCamera",function(){return n.StereoscopicGamepadCamera}),r.d(t,"StereoscopicUniversalCamera",function(){return n.StereoscopicUniversalCamera}),r.d(t,"VRCameraMetrics",function(){return n.VRCameraMetrics}),r.d(t,"VRDeviceOrientationArcRotateCamera",function(){return n.VRDeviceOrientationArcRotateCamera}),r.d(t,"VRDeviceOrientationFreeCamera",function(){return n.VRDeviceOrientationFreeCamera}),r.d(t,"VRDeviceOrientationGamepadCamera",function(){return n.VRDeviceOrientationGamepadCamera}),r.d(t,"OnAfterEnteringVRObservableEvent",function(){return n.OnAfterEnteringVRObservableEvent}),r.d(t,"VRExperienceHelper",function(){return n.VRExperienceHelper}),r.d(t,"WebVRFreeCamera",function(){return n.WebVRFreeCamera}),r.d(t,"WebXRCamera",function(){return n.WebXRCamera}),r.d(t,"WebXREnterExitUIButton",function(){return n.WebXREnterExitUIButton}),r.d(t,"WebXREnterExitUIOptions",function(){return n.WebXREnterExitUIOptions}),r.d(t,"WebXREnterExitUI",function(){return n.WebXREnterExitUI}),r.d(t,"WebXRState",function(){return n.WebXRState}),r.d(t,"WebXRExperienceHelper",function(){return n.WebXRExperienceHelper}),r.d(t,"WebXRInput",function(){return n.WebXRInput}),r.d(t,"WebXRControllerTeleportation",function(){return n.WebXRControllerTeleportation}),r.d(t,"WebXRControllerPointerSelection",function(){return n.WebXRControllerPointerSelection}),r.d(t,"WebXRControllerModelLoader",function(){return n.WebXRControllerModelLoader}),r.d(t,"WebXRController",function(){return n.WebXRController}),r.d(t,"WebXRManagedOutputCanvas",function(){return n.WebXRManagedOutputCanvas}),r.d(t,"WebXRSessionManager",function(){return n.WebXRSessionManager}),r.d(t,"Octree",function(){return n.Octree}),r.d(t,"OctreeBlock",function(){return n.OctreeBlock}),r.d(t,"OctreeSceneComponent",function(){return n.OctreeSceneComponent}),r.d(t,"_OcclusionDataStorage",function(){return n._OcclusionDataStorage}),r.d(t,"_forceTransformFeedbackToBundle",function(){return n._forceTransformFeedbackToBundle}),r.d(t,"DaydreamController",function(){return n.DaydreamController}),r.d(t,"GearVRController",function(){return n.GearVRController}),r.d(t,"GenericController",function(){return n.GenericController}),r.d(t,"OculusTouchController",function(){return n.OculusTouchController}),r.d(t,"PoseEnabledControllerType",function(){return n.PoseEnabledControllerType}),r.d(t,"PoseEnabledControllerHelper",function(){return n.PoseEnabledControllerHelper}),r.d(t,"PoseEnabledController",function(){return n.PoseEnabledController}),r.d(t,"ViveController",function(){return n.ViveController}),r.d(t,"WebVRController",function(){return n.WebVRController}),r.d(t,"WindowsMotionController",function(){return n.WindowsMotionController}),r.d(t,"ShadowGenerator",function(){return n.ShadowGenerator}),r.d(t,"ShadowGeneratorSceneComponent",function(){return n.ShadowGeneratorSceneComponent}),r.d(t,"_BabylonLoaderRegistered",function(){return n._BabylonLoaderRegistered}),r.d(t,"BackgroundMaterial",function(){return n.BackgroundMaterial}),r.d(t,"PBRMaterialDefines",function(){return n.PBRMaterialDefines}),r.d(t,"PBRBaseMaterial",function(){return n.PBRBaseMaterial}),r.d(t,"PBRBaseSimpleMaterial",function(){return n.PBRBaseSimpleMaterial}),r.d(t,"PBRMaterial",function(){return n.PBRMaterial}),r.d(t,"PBRMetallicRoughnessMaterial",function(){return n.PBRMetallicRoughnessMaterial}),r.d(t,"PBRSpecularGlossinessMaterial",function(){return n.PBRSpecularGlossinessMaterial}),r.d(t,"ColorGradingTexture",function(){return n.ColorGradingTexture}),r.d(t,"RawCubeTexture",function(){return n.RawCubeTexture}),r.d(t,"RawTexture3D",function(){return n.RawTexture3D}),r.d(t,"RefractionTexture",function(){return n.RefractionTexture}),r.d(t,"VideoTexture",function(){return n.VideoTexture}),r.d(t,"HtmlElementTexture",function(){return n.HtmlElementTexture}),r.d(t,"NodeMaterialBlockTargets",function(){return n.NodeMaterialBlockTargets}),r.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return n.NodeMaterialBlockConnectionPointTypes}),r.d(t,"NodeMaterialConnectionPoint",function(){return n.NodeMaterialConnectionPoint}),r.d(t,"NodeMaterialBlock",function(){return n.NodeMaterialBlock}),r.d(t,"NodeMaterialDefines",function(){return n.NodeMaterialDefines}),r.d(t,"NodeMaterial",function(){return n.NodeMaterial}),r.d(t,"NodeMaterialSystemValues",function(){return n.NodeMaterialSystemValues}),r.d(t,"PositionNormalVertex",function(){return n.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return n.PositionNormalTextureVertex}),r.d(t,"DracoCompression",function(){return n.DracoCompression}),r.d(t,"TiledBoxBuilder",function(){return n.TiledBoxBuilder}),r.d(t,"DiscBuilder",function(){return n.DiscBuilder}),r.d(t,"RibbonBuilder",function(){return n.RibbonBuilder}),r.d(t,"HemisphereBuilder",function(){return n.HemisphereBuilder}),r.d(t,"TorusKnotBuilder",function(){return n.TorusKnotBuilder}),r.d(t,"PolygonBuilder",function(){return n.PolygonBuilder}),r.d(t,"ShapeBuilder",function(){return n.ShapeBuilder}),r.d(t,"LatheBuilder",function(){return n.LatheBuilder}),r.d(t,"TiledPlaneBuilder",function(){return n.TiledPlaneBuilder}),r.d(t,"TubeBuilder",function(){return n.TubeBuilder}),r.d(t,"PolyhedronBuilder",function(){return n.PolyhedronBuilder}),r.d(t,"IcoSphereBuilder",function(){return n.IcoSphereBuilder}),r.d(t,"DecalBuilder",function(){return n.DecalBuilder}),r.d(t,"RecastJSPlugin",function(){return n.RecastJSPlugin}),r.d(t,"RecastJSCrowd",function(){return n.RecastJSCrowd}),r.d(t,"BoxParticleEmitter",function(){return n.BoxParticleEmitter}),r.d(t,"ConeParticleEmitter",function(){return n.ConeParticleEmitter}),r.d(t,"CylinderParticleEmitter",function(){return n.CylinderParticleEmitter}),r.d(t,"CylinderDirectedParticleEmitter",function(){return n.CylinderDirectedParticleEmitter}),r.d(t,"HemisphericParticleEmitter",function(){return n.HemisphericParticleEmitter}),r.d(t,"PointParticleEmitter",function(){return n.PointParticleEmitter}),r.d(t,"SphereParticleEmitter",function(){return n.SphereParticleEmitter}),r.d(t,"SphereDirectedParticleEmitter",function(){return n.SphereDirectedParticleEmitter}),r.d(t,"CannonJSPlugin",function(){return n.CannonJSPlugin}),r.d(t,"AmmoJSPlugin",function(){return n.AmmoJSPlugin}),r.d(t,"OimoJSPlugin",function(){return n.OimoJSPlugin}),r.d(t,"PostProcessRenderEffect",function(){return n.PostProcessRenderEffect}),r.d(t,"PostProcessRenderPipeline",function(){return n.PostProcessRenderPipeline}),r.d(t,"PostProcessRenderPipelineManager",function(){return n.PostProcessRenderPipelineManager}),r.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return n.PostProcessRenderPipelineManagerSceneComponent}),r.d(t,"HDRTools",function(){return n.HDRTools}),r.d(t,"PanoramaToCubeMapTools",function(){return n.PanoramaToCubeMapTools}),r.d(t,"_DDSTextureLoader",function(){return n._DDSTextureLoader}),r.d(t,"_ENVTextureLoader",function(){return n._ENVTextureLoader}),r.d(t,"_KTXTextureLoader",function(){return n._KTXTextureLoader}),r.d(t,"_TGATextureLoader",function(){return n._TGATextureLoader}),r.d(t,"_BasisTextureLoader",function(){return n._BasisTextureLoader}),r.d(t,"CustomProceduralTexture",function(){return n.CustomProceduralTexture}),r.d(t,"NoiseProceduralTexture",function(){return n.NoiseProceduralTexture}),r.d(t,"ProceduralTexture",function(){return n.ProceduralTexture}),r.d(t,"ProceduralTextureSceneComponent",function(){return n.ProceduralTextureSceneComponent}),r.d(t,"MultiplyBlock",function(){return n.MultiplyBlock}),r.d(t,"AddBlock",function(){return n.AddBlock}),r.d(t,"ScaleBlock",function(){return n.ScaleBlock}),r.d(t,"ClampBlock",function(){return n.ClampBlock}),r.d(t,"CrossBlock",function(){return n.CrossBlock}),r.d(t,"DotBlock",function(){return n.DotBlock}),r.d(t,"TransformBlock",function(){return n.TransformBlock}),r.d(t,"RemapBlock",function(){return n.RemapBlock}),r.d(t,"NormalizeBlock",function(){return n.NormalizeBlock}),r.d(t,"TrigonometryBlockOperations",function(){return n.TrigonometryBlockOperations}),r.d(t,"TrigonometryBlock",function(){return n.TrigonometryBlock}),r.d(t,"ColorMergerBlock",function(){return n.ColorMergerBlock}),r.d(t,"VectorMergerBlock",function(){return n.VectorMergerBlock}),r.d(t,"ColorSplitterBlock",function(){return n.ColorSplitterBlock}),r.d(t,"VectorSplitterBlock",function(){return n.VectorSplitterBlock}),r.d(t,"LerpBlock",function(){return n.LerpBlock}),r.d(t,"DivideBlock",function(){return n.DivideBlock}),r.d(t,"SubtractBlock",function(){return n.SubtractBlock}),r.d(t,"StepBlock",function(){return n.StepBlock}),r.d(t,"OppositeBlock",function(){return n.OppositeBlock}),r.d(t,"ViewDirectionBlock",function(){return n.ViewDirectionBlock}),r.d(t,"FresnelBlock",function(){return n.FresnelBlock}),r.d(t,"MaxBlock",function(){return n.MaxBlock}),r.d(t,"MinBlock",function(){return n.MinBlock}),r.d(t,"NodeMaterialOptimizer",function(){return n.NodeMaterialOptimizer}),r.d(t,"DefaultRenderingPipeline",function(){return n.DefaultRenderingPipeline}),r.d(t,"LensRenderingPipeline",function(){return n.LensRenderingPipeline}),r.d(t,"SSAO2RenderingPipeline",function(){return n.SSAO2RenderingPipeline}),r.d(t,"SSAORenderingPipeline",function(){return n.SSAORenderingPipeline}),r.d(t,"StandardRenderingPipeline",function(){return n.StandardRenderingPipeline}),r.d(t,"VertexOutputBlock",function(){return n.VertexOutputBlock}),r.d(t,"BonesBlock",function(){return n.BonesBlock}),r.d(t,"InstancesBlock",function(){return n.InstancesBlock}),r.d(t,"MorphTargetsBlock",function(){return n.MorphTargetsBlock}),r.d(t,"LightInformationBlock",function(){return n.LightInformationBlock}),r.d(t,"FragmentOutputBlock",function(){return n.FragmentOutputBlock}),r.d(t,"AlphaTestBlock",function(){return n.AlphaTestBlock}),r.d(t,"ImageProcessingBlock",function(){return n.ImageProcessingBlock}),r.d(t,"PerturbNormalBlock",function(){return n.PerturbNormalBlock}),r.d(t,"FogBlock",function(){return n.FogBlock}),r.d(t,"LightBlock",function(){return n.LightBlock}),r.d(t,"TextureBlock",function(){return n.TextureBlock}),r.d(t,"ReflectionTextureBlock",function(){return n.ReflectionTextureBlock}),r.d(t,"InputBlock",function(){return n.InputBlock}),r.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=s,o.BABYLON=o.BABYLON||{};var s=o.BABYLON;s.Debug=s.Debug||{};var a=[];for(var c in i)s.Debug[c]=i[c],a.push(c);for(var c in n)s[c]=n[c]}var l={AxesViewer:i.AxesViewer,BoneAxesViewer:i.BoneAxesViewer,PhysicsViewer:i.PhysicsViewer,SkeletonViewer:i.SkeletonViewer}}.call(this,r(/*! ./../../node_modules/webpack/buildin/global.js */"../node_modules/webpack/buildin/global.js"))},"./LensFlares/index.ts": +/*! exports provided: Debug, AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Debug",function(){return l});var n=r(/*! ../index */"./index.ts"),i=r(/*! ../Debug/index */"./Debug/index.ts");r.d(t,"AbstractScene",function(){return n.AbstractScene}),r.d(t,"KeepAssets",function(){return n.KeepAssets}),r.d(t,"AssetContainer",function(){return n.AssetContainer}),r.d(t,"Node",function(){return n.Node}),r.d(t,"Scene",function(){return n.Scene}),r.d(t,"SceneComponentConstants",function(){return n.SceneComponentConstants}),r.d(t,"Stage",function(){return n.Stage}),r.d(t,"AbstractActionManager",function(){return n.AbstractActionManager}),r.d(t,"Action",function(){return n.Action}),r.d(t,"ActionEvent",function(){return n.ActionEvent}),r.d(t,"ActionManager",function(){return n.ActionManager}),r.d(t,"Condition",function(){return n.Condition}),r.d(t,"ValueCondition",function(){return n.ValueCondition}),r.d(t,"PredicateCondition",function(){return n.PredicateCondition}),r.d(t,"StateCondition",function(){return n.StateCondition}),r.d(t,"SwitchBooleanAction",function(){return n.SwitchBooleanAction}),r.d(t,"SetStateAction",function(){return n.SetStateAction}),r.d(t,"SetValueAction",function(){return n.SetValueAction}),r.d(t,"IncrementValueAction",function(){return n.IncrementValueAction}),r.d(t,"PlayAnimationAction",function(){return n.PlayAnimationAction}),r.d(t,"StopAnimationAction",function(){return n.StopAnimationAction}),r.d(t,"DoNothingAction",function(){return n.DoNothingAction}),r.d(t,"CombineAction",function(){return n.CombineAction}),r.d(t,"ExecuteCodeAction",function(){return n.ExecuteCodeAction}),r.d(t,"SetParentAction",function(){return n.SetParentAction}),r.d(t,"PlaySoundAction",function(){return n.PlaySoundAction}),r.d(t,"StopSoundAction",function(){return n.StopSoundAction}),r.d(t,"InterpolateValueAction",function(){return n.InterpolateValueAction}),r.d(t,"Animatable",function(){return n.Animatable}),r.d(t,"_IAnimationState",function(){return n._IAnimationState}),r.d(t,"Animation",function(){return n.Animation}),r.d(t,"TargetedAnimation",function(){return n.TargetedAnimation}),r.d(t,"AnimationGroup",function(){return n.AnimationGroup}),r.d(t,"AnimationPropertiesOverride",function(){return n.AnimationPropertiesOverride}),r.d(t,"EasingFunction",function(){return n.EasingFunction}),r.d(t,"CircleEase",function(){return n.CircleEase}),r.d(t,"BackEase",function(){return n.BackEase}),r.d(t,"BounceEase",function(){return n.BounceEase}),r.d(t,"CubicEase",function(){return n.CubicEase}),r.d(t,"ElasticEase",function(){return n.ElasticEase}),r.d(t,"ExponentialEase",function(){return n.ExponentialEase}),r.d(t,"PowerEase",function(){return n.PowerEase}),r.d(t,"QuadraticEase",function(){return n.QuadraticEase}),r.d(t,"QuarticEase",function(){return n.QuarticEase}),r.d(t,"QuinticEase",function(){return n.QuinticEase}),r.d(t,"SineEase",function(){return n.SineEase}),r.d(t,"BezierCurveEase",function(){return n.BezierCurveEase}),r.d(t,"RuntimeAnimation",function(){return n.RuntimeAnimation}),r.d(t,"AnimationEvent",function(){return n.AnimationEvent}),r.d(t,"AnimationKeyInterpolation",function(){return n.AnimationKeyInterpolation}),r.d(t,"AnimationRange",function(){return n.AnimationRange}),r.d(t,"Analyser",function(){return n.Analyser}),r.d(t,"AudioEngine",function(){return n.AudioEngine}),r.d(t,"AudioSceneComponent",function(){return n.AudioSceneComponent}),r.d(t,"Sound",function(){return n.Sound}),r.d(t,"SoundTrack",function(){return n.SoundTrack}),r.d(t,"WeightedSound",function(){return n.WeightedSound}),r.d(t,"AutoRotationBehavior",function(){return n.AutoRotationBehavior}),r.d(t,"BouncingBehavior",function(){return n.BouncingBehavior}),r.d(t,"FramingBehavior",function(){return n.FramingBehavior}),r.d(t,"PointerDragBehavior",function(){return n.PointerDragBehavior}),r.d(t,"Bone",function(){return n.Bone}),r.d(t,"BoneIKController",function(){return n.BoneIKController}),r.d(t,"BoneLookController",function(){return n.BoneLookController}),r.d(t,"Skeleton",function(){return n.Skeleton}),r.d(t,"CameraInputTypes",function(){return n.CameraInputTypes}),r.d(t,"CameraInputsManager",function(){return n.CameraInputsManager}),r.d(t,"Camera",function(){return n.Camera}),r.d(t,"TargetCamera",function(){return n.TargetCamera}),r.d(t,"FreeCamera",function(){return n.FreeCamera}),r.d(t,"FreeCameraInputsManager",function(){return n.FreeCameraInputsManager}),r.d(t,"TouchCamera",function(){return n.TouchCamera}),r.d(t,"ArcRotateCamera",function(){return n.ArcRotateCamera}),r.d(t,"ArcRotateCameraInputsManager",function(){return n.ArcRotateCameraInputsManager}),r.d(t,"DeviceOrientationCamera",function(){return n.DeviceOrientationCamera}),r.d(t,"FlyCamera",function(){return n.FlyCamera}),r.d(t,"FlyCameraInputsManager",function(){return n.FlyCameraInputsManager}),r.d(t,"FollowCamera",function(){return n.FollowCamera}),r.d(t,"ArcFollowCamera",function(){return n.ArcFollowCamera}),r.d(t,"FollowCameraInputsManager",function(){return n.FollowCameraInputsManager}),r.d(t,"GamepadCamera",function(){return n.GamepadCamera}),r.d(t,"UniversalCamera",function(){return n.UniversalCamera}),r.d(t,"VirtualJoysticksCamera",function(){return n.VirtualJoysticksCamera}),r.d(t,"Collider",function(){return n.Collider}),r.d(t,"DefaultCollisionCoordinator",function(){return n.DefaultCollisionCoordinator}),r.d(t,"PickingInfo",function(){return n.PickingInfo}),r.d(t,"IntersectionInfo",function(){return n.IntersectionInfo}),r.d(t,"_MeshCollisionData",function(){return n._MeshCollisionData}),r.d(t,"BoundingBox",function(){return n.BoundingBox}),r.d(t,"BoundingInfo",function(){return n.BoundingInfo}),r.d(t,"BoundingSphere",function(){return n.BoundingSphere}),r.d(t,"Ray",function(){return n.Ray}),r.d(t,"AxesViewer",function(){return n.AxesViewer}),r.d(t,"BoneAxesViewer",function(){return n.BoneAxesViewer}),r.d(t,"DebugLayer",function(){return n.DebugLayer}),r.d(t,"PhysicsViewer",function(){return n.PhysicsViewer}),r.d(t,"RayHelper",function(){return n.RayHelper}),r.d(t,"SkeletonViewer",function(){return n.SkeletonViewer}),r.d(t,"Constants",function(){return n.Constants}),r.d(t,"InstancingAttributeInfo",function(){return n.InstancingAttributeInfo}),r.d(t,"DepthTextureCreationOptions",function(){return n.DepthTextureCreationOptions}),r.d(t,"EngineCapabilities",function(){return n.EngineCapabilities}),r.d(t,"Engine",function(){return n.Engine}),r.d(t,"EngineStore",function(){return n.EngineStore}),r.d(t,"NullEngineOptions",function(){return n.NullEngineOptions}),r.d(t,"NullEngine",function(){return n.NullEngine}),r.d(t,"WebGLPipelineContext",function(){return n.WebGLPipelineContext}),r.d(t,"WebGL2ShaderProcessor",function(){return n.WebGL2ShaderProcessor}),r.d(t,"NativeEngine",function(){return n.NativeEngine}),r.d(t,"KeyboardEventTypes",function(){return n.KeyboardEventTypes}),r.d(t,"KeyboardInfo",function(){return n.KeyboardInfo}),r.d(t,"KeyboardInfoPre",function(){return n.KeyboardInfoPre}),r.d(t,"PointerEventTypes",function(){return n.PointerEventTypes}),r.d(t,"PointerInfoBase",function(){return n.PointerInfoBase}),r.d(t,"PointerInfoPre",function(){return n.PointerInfoPre}),r.d(t,"PointerInfo",function(){return n.PointerInfo}),r.d(t,"ClipboardEventTypes",function(){return n.ClipboardEventTypes}),r.d(t,"ClipboardInfo",function(){return n.ClipboardInfo}),r.d(t,"DaydreamController",function(){return n.DaydreamController}),r.d(t,"GearVRController",function(){return n.GearVRController}),r.d(t,"GenericController",function(){return n.GenericController}),r.d(t,"OculusTouchController",function(){return n.OculusTouchController}),r.d(t,"PoseEnabledControllerType",function(){return n.PoseEnabledControllerType}),r.d(t,"PoseEnabledControllerHelper",function(){return n.PoseEnabledControllerHelper}),r.d(t,"PoseEnabledController",function(){return n.PoseEnabledController}),r.d(t,"ViveController",function(){return n.ViveController}),r.d(t,"WebVRController",function(){return n.WebVRController}),r.d(t,"WindowsMotionController",function(){return n.WindowsMotionController}),r.d(t,"StickValues",function(){return n.StickValues}),r.d(t,"Gamepad",function(){return n.Gamepad}),r.d(t,"GenericPad",function(){return n.GenericPad}),r.d(t,"GamepadManager",function(){return n.GamepadManager}),r.d(t,"GamepadSystemSceneComponent",function(){return n.GamepadSystemSceneComponent}),r.d(t,"Xbox360Button",function(){return n.Xbox360Button}),r.d(t,"Xbox360Dpad",function(){return n.Xbox360Dpad}),r.d(t,"Xbox360Pad",function(){return n.Xbox360Pad}),r.d(t,"DualShockButton",function(){return n.DualShockButton}),r.d(t,"DualShockDpad",function(){return n.DualShockDpad}),r.d(t,"DualShockPad",function(){return n.DualShockPad}),r.d(t,"AxisDragGizmo",function(){return n.AxisDragGizmo}),r.d(t,"AxisScaleGizmo",function(){return n.AxisScaleGizmo}),r.d(t,"BoundingBoxGizmo",function(){return n.BoundingBoxGizmo}),r.d(t,"Gizmo",function(){return n.Gizmo}),r.d(t,"GizmoManager",function(){return n.GizmoManager}),r.d(t,"PlaneRotationGizmo",function(){return n.PlaneRotationGizmo}),r.d(t,"PositionGizmo",function(){return n.PositionGizmo}),r.d(t,"RotationGizmo",function(){return n.RotationGizmo}),r.d(t,"ScaleGizmo",function(){return n.ScaleGizmo}),r.d(t,"LightGizmo",function(){return n.LightGizmo}),r.d(t,"PlaneDragGizmo",function(){return n.PlaneDragGizmo}),r.d(t,"EnvironmentHelper",function(){return n.EnvironmentHelper}),r.d(t,"PhotoDome",function(){return n.PhotoDome}),r.d(t,"_forceSceneHelpersToBundle",function(){return n._forceSceneHelpersToBundle}),r.d(t,"VideoDome",function(){return n.VideoDome}),r.d(t,"EngineInstrumentation",function(){return n.EngineInstrumentation}),r.d(t,"SceneInstrumentation",function(){return n.SceneInstrumentation}),r.d(t,"_TimeToken",function(){return n._TimeToken}),r.d(t,"EffectLayer",function(){return n.EffectLayer}),r.d(t,"EffectLayerSceneComponent",function(){return n.EffectLayerSceneComponent}),r.d(t,"GlowLayer",function(){return n.GlowLayer}),r.d(t,"HighlightLayer",function(){return n.HighlightLayer}),r.d(t,"Layer",function(){return n.Layer}),r.d(t,"LayerSceneComponent",function(){return n.LayerSceneComponent}),r.d(t,"LensFlare",function(){return n.LensFlare}),r.d(t,"LensFlareSystem",function(){return n.LensFlareSystem}),r.d(t,"LensFlareSystemSceneComponent",function(){return n.LensFlareSystemSceneComponent}),r.d(t,"Light",function(){return n.Light}),r.d(t,"ShadowLight",function(){return n.ShadowLight}),r.d(t,"DirectionalLight",function(){return n.DirectionalLight}),r.d(t,"HemisphericLight",function(){return n.HemisphericLight}),r.d(t,"PointLight",function(){return n.PointLight}),r.d(t,"SpotLight",function(){return n.SpotLight}),r.d(t,"DefaultLoadingScreen",function(){return n.DefaultLoadingScreen}),r.d(t,"SceneLoaderProgressEvent",function(){return n.SceneLoaderProgressEvent}),r.d(t,"SceneLoader",function(){return n.SceneLoader}),r.d(t,"SceneLoaderFlags",function(){return n.SceneLoaderFlags}),r.d(t,"ColorCurves",function(){return n.ColorCurves}),r.d(t,"EffectFallbacks",function(){return n.EffectFallbacks}),r.d(t,"EffectCreationOptions",function(){return n.EffectCreationOptions}),r.d(t,"Effect",function(){return n.Effect}),r.d(t,"FresnelParameters",function(){return n.FresnelParameters}),r.d(t,"ImageProcessingConfigurationDefines",function(){return n.ImageProcessingConfigurationDefines}),r.d(t,"ImageProcessingConfiguration",function(){return n.ImageProcessingConfiguration}),r.d(t,"Material",function(){return n.Material}),r.d(t,"MaterialDefines",function(){return n.MaterialDefines}),r.d(t,"MaterialHelper",function(){return n.MaterialHelper}),r.d(t,"MultiMaterial",function(){return n.MultiMaterial}),r.d(t,"PushMaterial",function(){return n.PushMaterial}),r.d(t,"ShaderMaterial",function(){return n.ShaderMaterial}),r.d(t,"StandardMaterialDefines",function(){return n.StandardMaterialDefines}),r.d(t,"StandardMaterial",function(){return n.StandardMaterial}),r.d(t,"BaseTexture",function(){return n.BaseTexture}),r.d(t,"CubeTexture",function(){return n.CubeTexture}),r.d(t,"DynamicTexture",function(){return n.DynamicTexture}),r.d(t,"EquiRectangularCubeTexture",function(){return n.EquiRectangularCubeTexture}),r.d(t,"HDRCubeTexture",function(){return n.HDRCubeTexture}),r.d(t,"InternalTexture",function(){return n.InternalTexture}),r.d(t,"MirrorTexture",function(){return n.MirrorTexture}),r.d(t,"MultiRenderTarget",function(){return n.MultiRenderTarget}),r.d(t,"RawTexture",function(){return n.RawTexture}),r.d(t,"RenderTargetTexture",function(){return n.RenderTargetTexture}),r.d(t,"Texture",function(){return n.Texture}),r.d(t,"UniformBuffer",function(){return n.UniformBuffer}),r.d(t,"MaterialFlags",function(){return n.MaterialFlags}),r.d(t,"EffectRenderer",function(){return n.EffectRenderer}),r.d(t,"EffectWrapper",function(){return n.EffectWrapper}),r.d(t,"Scalar",function(){return n.Scalar}),r.d(t,"Space",function(){return n.Space}),r.d(t,"Axis",function(){return n.Axis}),r.d(t,"Color3",function(){return n.Color3}),r.d(t,"Color4",function(){return n.Color4}),r.d(t,"TmpColors",function(){return n.TmpColors}),r.d(t,"ToGammaSpace",function(){return n.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return n.ToLinearSpace}),r.d(t,"Epsilon",function(){return n.Epsilon}),r.d(t,"Frustum",function(){return n.Frustum}),r.d(t,"Plane",function(){return n.Plane}),r.d(t,"Size",function(){return n.Size}),r.d(t,"Vector2",function(){return n.Vector2}),r.d(t,"Vector3",function(){return n.Vector3}),r.d(t,"Vector4",function(){return n.Vector4}),r.d(t,"Quaternion",function(){return n.Quaternion}),r.d(t,"Matrix",function(){return n.Matrix}),r.d(t,"TmpVectors",function(){return n.TmpVectors}),r.d(t,"Viewport",function(){return n.Viewport}),r.d(t,"SphericalHarmonics",function(){return n.SphericalHarmonics}),r.d(t,"SphericalPolynomial",function(){return n.SphericalPolynomial}),r.d(t,"AbstractMesh",function(){return n.AbstractMesh}),r.d(t,"Buffer",function(){return n.Buffer}),r.d(t,"VertexBuffer",function(){return n.VertexBuffer}),r.d(t,"CSG",function(){return n.CSG}),r.d(t,"Geometry",function(){return n.Geometry}),r.d(t,"GroundMesh",function(){return n.GroundMesh}),r.d(t,"TrailMesh",function(){return n.TrailMesh}),r.d(t,"InstancedMesh",function(){return n.InstancedMesh}),r.d(t,"LinesMesh",function(){return n.LinesMesh}),r.d(t,"InstancedLinesMesh",function(){return n.InstancedLinesMesh}),r.d(t,"_CreationDataStorage",function(){return n._CreationDataStorage}),r.d(t,"_InstancesBatch",function(){return n._InstancesBatch}),r.d(t,"Mesh",function(){return n.Mesh}),r.d(t,"VertexData",function(){return n.VertexData}),r.d(t,"MeshBuilder",function(){return n.MeshBuilder}),r.d(t,"SimplificationSettings",function(){return n.SimplificationSettings}),r.d(t,"SimplificationQueue",function(){return n.SimplificationQueue}),r.d(t,"SimplificationType",function(){return n.SimplificationType}),r.d(t,"SimplicationQueueSceneComponent",function(){return n.SimplicationQueueSceneComponent}),r.d(t,"Polygon",function(){return n.Polygon}),r.d(t,"PolygonMeshBuilder",function(){return n.PolygonMeshBuilder}),r.d(t,"BaseSubMesh",function(){return n.BaseSubMesh}),r.d(t,"SubMesh",function(){return n.SubMesh}),r.d(t,"MeshLODLevel",function(){return n.MeshLODLevel}),r.d(t,"TransformNode",function(){return n.TransformNode}),r.d(t,"BoxBuilder",function(){return n.BoxBuilder}),r.d(t,"SphereBuilder",function(){return n.SphereBuilder}),r.d(t,"CylinderBuilder",function(){return n.CylinderBuilder}),r.d(t,"TorusBuilder",function(){return n.TorusBuilder}),r.d(t,"LinesBuilder",function(){return n.LinesBuilder}),r.d(t,"PlaneBuilder",function(){return n.PlaneBuilder}),r.d(t,"GroundBuilder",function(){return n.GroundBuilder}),r.d(t,"DataBuffer",function(){return n.DataBuffer}),r.d(t,"WebGLDataBuffer",function(){return n.WebGLDataBuffer}),r.d(t,"MorphTarget",function(){return n.MorphTarget}),r.d(t,"MorphTargetManager",function(){return n.MorphTargetManager}),r.d(t,"Database",function(){return n.Database}),r.d(t,"BaseParticleSystem",function(){return n.BaseParticleSystem}),r.d(t,"GPUParticleSystem",function(){return n.GPUParticleSystem}),r.d(t,"Particle",function(){return n.Particle}),r.d(t,"ParticleHelper",function(){return n.ParticleHelper}),r.d(t,"ParticleSystem",function(){return n.ParticleSystem}),r.d(t,"_IDoNeedToBeInTheBuild",function(){return n._IDoNeedToBeInTheBuild}),r.d(t,"ParticleSystemSet",function(){return n.ParticleSystemSet}),r.d(t,"SolidParticle",function(){return n.SolidParticle}),r.d(t,"ModelShape",function(){return n.ModelShape}),r.d(t,"DepthSortedParticle",function(){return n.DepthSortedParticle}),r.d(t,"SolidParticleSystem",function(){return n.SolidParticleSystem}),r.d(t,"SubEmitterType",function(){return n.SubEmitterType}),r.d(t,"SubEmitter",function(){return n.SubEmitter}),r.d(t,"PhysicsEngine",function(){return n.PhysicsEngine}),r.d(t,"PhysicsEngineSceneComponent",function(){return n.PhysicsEngineSceneComponent}),r.d(t,"PhysicsHelper",function(){return n.PhysicsHelper}),r.d(t,"PhysicsRadialExplosionEventOptions",function(){return n.PhysicsRadialExplosionEventOptions}),r.d(t,"PhysicsUpdraftEventOptions",function(){return n.PhysicsUpdraftEventOptions}),r.d(t,"PhysicsVortexEventOptions",function(){return n.PhysicsVortexEventOptions}),r.d(t,"PhysicsRadialImpulseFalloff",function(){return n.PhysicsRadialImpulseFalloff}),r.d(t,"PhysicsUpdraftMode",function(){return n.PhysicsUpdraftMode}),r.d(t,"PhysicsImpostor",function(){return n.PhysicsImpostor}),r.d(t,"PhysicsJoint",function(){return n.PhysicsJoint}),r.d(t,"DistanceJoint",function(){return n.DistanceJoint}),r.d(t,"MotorEnabledJoint",function(){return n.MotorEnabledJoint}),r.d(t,"HingeJoint",function(){return n.HingeJoint}),r.d(t,"Hinge2Joint",function(){return n.Hinge2Joint}),r.d(t,"AnaglyphPostProcess",function(){return n.AnaglyphPostProcess}),r.d(t,"BlackAndWhitePostProcess",function(){return n.BlackAndWhitePostProcess}),r.d(t,"BloomEffect",function(){return n.BloomEffect}),r.d(t,"BloomMergePostProcess",function(){return n.BloomMergePostProcess}),r.d(t,"BlurPostProcess",function(){return n.BlurPostProcess}),r.d(t,"ChromaticAberrationPostProcess",function(){return n.ChromaticAberrationPostProcess}),r.d(t,"CircleOfConfusionPostProcess",function(){return n.CircleOfConfusionPostProcess}),r.d(t,"ColorCorrectionPostProcess",function(){return n.ColorCorrectionPostProcess}),r.d(t,"ConvolutionPostProcess",function(){return n.ConvolutionPostProcess}),r.d(t,"DepthOfFieldBlurPostProcess",function(){return n.DepthOfFieldBlurPostProcess}),r.d(t,"DepthOfFieldEffectBlurLevel",function(){return n.DepthOfFieldEffectBlurLevel}),r.d(t,"DepthOfFieldEffect",function(){return n.DepthOfFieldEffect}),r.d(t,"DepthOfFieldMergePostProcessOptions",function(){return n.DepthOfFieldMergePostProcessOptions}),r.d(t,"DepthOfFieldMergePostProcess",function(){return n.DepthOfFieldMergePostProcess}),r.d(t,"DisplayPassPostProcess",function(){return n.DisplayPassPostProcess}),r.d(t,"ExtractHighlightsPostProcess",function(){return n.ExtractHighlightsPostProcess}),r.d(t,"FilterPostProcess",function(){return n.FilterPostProcess}),r.d(t,"FxaaPostProcess",function(){return n.FxaaPostProcess}),r.d(t,"GrainPostProcess",function(){return n.GrainPostProcess}),r.d(t,"HighlightsPostProcess",function(){return n.HighlightsPostProcess}),r.d(t,"ImageProcessingPostProcess",function(){return n.ImageProcessingPostProcess}),r.d(t,"MotionBlurPostProcess",function(){return n.MotionBlurPostProcess}),r.d(t,"PassPostProcess",function(){return n.PassPostProcess}),r.d(t,"PassCubePostProcess",function(){return n.PassCubePostProcess}),r.d(t,"PostProcess",function(){return n.PostProcess}),r.d(t,"PostProcessManager",function(){return n.PostProcessManager}),r.d(t,"RefractionPostProcess",function(){return n.RefractionPostProcess}),r.d(t,"SharpenPostProcess",function(){return n.SharpenPostProcess}),r.d(t,"StereoscopicInterlacePostProcess",function(){return n.StereoscopicInterlacePostProcess}),r.d(t,"TonemappingOperator",function(){return n.TonemappingOperator}),r.d(t,"TonemapPostProcess",function(){return n.TonemapPostProcess}),r.d(t,"VolumetricLightScatteringPostProcess",function(){return n.VolumetricLightScatteringPostProcess}),r.d(t,"VRDistortionCorrectionPostProcess",function(){return n.VRDistortionCorrectionPostProcess}),r.d(t,"VRMultiviewToSingleviewPostProcess",function(){return n.VRMultiviewToSingleviewPostProcess}),r.d(t,"ReflectionProbe",function(){return n.ReflectionProbe}),r.d(t,"BoundingBoxRenderer",function(){return n.BoundingBoxRenderer}),r.d(t,"DepthRenderer",function(){return n.DepthRenderer}),r.d(t,"DepthRendererSceneComponent",function(){return n.DepthRendererSceneComponent}),r.d(t,"EdgesRenderer",function(){return n.EdgesRenderer}),r.d(t,"LineEdgesRenderer",function(){return n.LineEdgesRenderer}),r.d(t,"GeometryBufferRenderer",function(){return n.GeometryBufferRenderer}),r.d(t,"GeometryBufferRendererSceneComponent",function(){return n.GeometryBufferRendererSceneComponent}),r.d(t,"OutlineRenderer",function(){return n.OutlineRenderer}),r.d(t,"RenderingGroup",function(){return n.RenderingGroup}),r.d(t,"RenderingGroupInfo",function(){return n.RenderingGroupInfo}),r.d(t,"RenderingManager",function(){return n.RenderingManager}),r.d(t,"UtilityLayerRenderer",function(){return n.UtilityLayerRenderer}),r.d(t,"Sprite",function(){return n.Sprite}),r.d(t,"SpriteManager",function(){return n.SpriteManager}),r.d(t,"SpritePackedManager",function(){return n.SpritePackedManager}),r.d(t,"SpriteSceneComponent",function(){return n.SpriteSceneComponent}),r.d(t,"_AlphaState",function(){return n._AlphaState}),r.d(t,"_DepthCullingState",function(){return n._DepthCullingState}),r.d(t,"_StencilState",function(){return n._StencilState}),r.d(t,"AndOrNotEvaluator",function(){return n.AndOrNotEvaluator}),r.d(t,"AssetTaskState",function(){return n.AssetTaskState}),r.d(t,"AbstractAssetTask",function(){return n.AbstractAssetTask}),r.d(t,"AssetsProgressEvent",function(){return n.AssetsProgressEvent}),r.d(t,"MeshAssetTask",function(){return n.MeshAssetTask}),r.d(t,"TextFileAssetTask",function(){return n.TextFileAssetTask}),r.d(t,"BinaryFileAssetTask",function(){return n.BinaryFileAssetTask}),r.d(t,"ImageAssetTask",function(){return n.ImageAssetTask}),r.d(t,"TextureAssetTask",function(){return n.TextureAssetTask}),r.d(t,"CubeTextureAssetTask",function(){return n.CubeTextureAssetTask}),r.d(t,"HDRCubeTextureAssetTask",function(){return n.HDRCubeTextureAssetTask}),r.d(t,"EquiRectangularCubeTextureAssetTask",function(){return n.EquiRectangularCubeTextureAssetTask}),r.d(t,"AssetsManager",function(){return n.AssetsManager}),r.d(t,"DDSTools",function(){return n.DDSTools}),r.d(t,"expandToProperty",function(){return n.expandToProperty}),r.d(t,"serialize",function(){return n.serialize}),r.d(t,"serializeAsTexture",function(){return n.serializeAsTexture}),r.d(t,"serializeAsColor3",function(){return n.serializeAsColor3}),r.d(t,"serializeAsFresnelParameters",function(){return n.serializeAsFresnelParameters}),r.d(t,"serializeAsVector2",function(){return n.serializeAsVector2}),r.d(t,"serializeAsVector3",function(){return n.serializeAsVector3}),r.d(t,"serializeAsMeshReference",function(){return n.serializeAsMeshReference}),r.d(t,"serializeAsColorCurves",function(){return n.serializeAsColorCurves}),r.d(t,"serializeAsColor4",function(){return n.serializeAsColor4}),r.d(t,"serializeAsImageProcessingConfiguration",function(){return n.serializeAsImageProcessingConfiguration}),r.d(t,"serializeAsQuaternion",function(){return n.serializeAsQuaternion}),r.d(t,"serializeAsMatrix",function(){return n.serializeAsMatrix}),r.d(t,"serializeAsCameraReference",function(){return n.serializeAsCameraReference}),r.d(t,"SerializationHelper",function(){return n.SerializationHelper}),r.d(t,"Deferred",function(){return n.Deferred}),r.d(t,"EnvironmentTextureTools",function(){return n.EnvironmentTextureTools}),r.d(t,"MeshExploder",function(){return n.MeshExploder}),r.d(t,"FilesInput",function(){return n.FilesInput}),r.d(t,"CubeMapToSphericalPolynomialTools",function(){return n.CubeMapToSphericalPolynomialTools}),r.d(t,"KhronosTextureContainer",function(){return n.KhronosTextureContainer}),r.d(t,"EventState",function(){return n.EventState}),r.d(t,"Observer",function(){return n.Observer}),r.d(t,"MultiObserver",function(){return n.MultiObserver}),r.d(t,"Observable",function(){return n.Observable}),r.d(t,"PerformanceMonitor",function(){return n.PerformanceMonitor}),r.d(t,"RollingAverage",function(){return n.RollingAverage}),r.d(t,"PromisePolyfill",function(){return n.PromisePolyfill}),r.d(t,"SceneOptimization",function(){return n.SceneOptimization}),r.d(t,"TextureOptimization",function(){return n.TextureOptimization}),r.d(t,"HardwareScalingOptimization",function(){return n.HardwareScalingOptimization}),r.d(t,"ShadowsOptimization",function(){return n.ShadowsOptimization}),r.d(t,"PostProcessesOptimization",function(){return n.PostProcessesOptimization}),r.d(t,"LensFlaresOptimization",function(){return n.LensFlaresOptimization}),r.d(t,"CustomOptimization",function(){return n.CustomOptimization}),r.d(t,"ParticlesOptimization",function(){return n.ParticlesOptimization}),r.d(t,"RenderTargetsOptimization",function(){return n.RenderTargetsOptimization}),r.d(t,"MergeMeshesOptimization",function(){return n.MergeMeshesOptimization}),r.d(t,"SceneOptimizerOptions",function(){return n.SceneOptimizerOptions}),r.d(t,"SceneOptimizer",function(){return n.SceneOptimizer}),r.d(t,"SceneSerializer",function(){return n.SceneSerializer}),r.d(t,"SmartArray",function(){return n.SmartArray}),r.d(t,"SmartArrayNoDuplicate",function(){return n.SmartArrayNoDuplicate}),r.d(t,"StringDictionary",function(){return n.StringDictionary}),r.d(t,"Tags",function(){return n.Tags}),r.d(t,"TextureTools",function(){return n.TextureTools}),r.d(t,"TGATools",function(){return n.TGATools}),r.d(t,"Tools",function(){return n.Tools}),r.d(t,"className",function(){return n.className}),r.d(t,"AsyncLoop",function(){return n.AsyncLoop}),r.d(t,"VideoRecorder",function(){return n.VideoRecorder}),r.d(t,"JoystickAxis",function(){return n.JoystickAxis}),r.d(t,"VirtualJoystick",function(){return n.VirtualJoystick}),r.d(t,"WorkerPool",function(){return n.WorkerPool}),r.d(t,"Logger",function(){return n.Logger}),r.d(t,"_TypeStore",function(){return n._TypeStore}),r.d(t,"FilesInputStore",function(){return n.FilesInputStore}),r.d(t,"DeepCopier",function(){return n.DeepCopier}),r.d(t,"PivotTools",function(){return n.PivotTools}),r.d(t,"PrecisionDate",function(){return n.PrecisionDate}),r.d(t,"ScreenshotTools",function(){return n.ScreenshotTools}),r.d(t,"WebRequest",function(){return n.WebRequest}),r.d(t,"InspectableType",function(){return n.InspectableType}),r.d(t,"BRDFTextureTools",function(){return n.BRDFTextureTools}),r.d(t,"RGBDTextureTools",function(){return n.RGBDTextureTools}),r.d(t,"ColorGradient",function(){return n.ColorGradient}),r.d(t,"Color3Gradient",function(){return n.Color3Gradient}),r.d(t,"FactorGradient",function(){return n.FactorGradient}),r.d(t,"GradientHelper",function(){return n.GradientHelper}),r.d(t,"PerfCounter",function(){return n.PerfCounter}),r.d(t,"RetryStrategy",function(){return n.RetryStrategy}),r.d(t,"LoadFileError",function(){return n.LoadFileError}),r.d(t,"AttachToBoxBehavior",function(){return n.AttachToBoxBehavior}),r.d(t,"FadeInOutBehavior",function(){return n.FadeInOutBehavior}),r.d(t,"MultiPointerScaleBehavior",function(){return n.MultiPointerScaleBehavior}),r.d(t,"SixDofDragBehavior",function(){return n.SixDofDragBehavior}),r.d(t,"ArcRotateCameraGamepadInput",function(){return n.ArcRotateCameraGamepadInput}),r.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return n.ArcRotateCameraKeyboardMoveInput}),r.d(t,"ArcRotateCameraMouseWheelInput",function(){return n.ArcRotateCameraMouseWheelInput}),r.d(t,"ArcRotateCameraPointersInput",function(){return n.ArcRotateCameraPointersInput}),r.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return n.ArcRotateCameraVRDeviceOrientationInput}),r.d(t,"FlyCameraKeyboardInput",function(){return n.FlyCameraKeyboardInput}),r.d(t,"FlyCameraMouseInput",function(){return n.FlyCameraMouseInput}),r.d(t,"FollowCameraKeyboardMoveInput",function(){return n.FollowCameraKeyboardMoveInput}),r.d(t,"FollowCameraMouseWheelInput",function(){return n.FollowCameraMouseWheelInput}),r.d(t,"FollowCameraPointersInput",function(){return n.FollowCameraPointersInput}),r.d(t,"FreeCameraDeviceOrientationInput",function(){return n.FreeCameraDeviceOrientationInput}),r.d(t,"FreeCameraGamepadInput",function(){return n.FreeCameraGamepadInput}),r.d(t,"FreeCameraKeyboardMoveInput",function(){return n.FreeCameraKeyboardMoveInput}),r.d(t,"FreeCameraMouseInput",function(){return n.FreeCameraMouseInput}),r.d(t,"FreeCameraTouchInput",function(){return n.FreeCameraTouchInput}),r.d(t,"FreeCameraVirtualJoystickInput",function(){return n.FreeCameraVirtualJoystickInput}),r.d(t,"AnaglyphArcRotateCamera",function(){return n.AnaglyphArcRotateCamera}),r.d(t,"AnaglyphFreeCamera",function(){return n.AnaglyphFreeCamera}),r.d(t,"AnaglyphGamepadCamera",function(){return n.AnaglyphGamepadCamera}),r.d(t,"AnaglyphUniversalCamera",function(){return n.AnaglyphUniversalCamera}),r.d(t,"StereoscopicArcRotateCamera",function(){return n.StereoscopicArcRotateCamera}),r.d(t,"StereoscopicFreeCamera",function(){return n.StereoscopicFreeCamera}),r.d(t,"StereoscopicGamepadCamera",function(){return n.StereoscopicGamepadCamera}),r.d(t,"StereoscopicUniversalCamera",function(){return n.StereoscopicUniversalCamera}),r.d(t,"VRCameraMetrics",function(){return n.VRCameraMetrics}),r.d(t,"VRDeviceOrientationArcRotateCamera",function(){return n.VRDeviceOrientationArcRotateCamera}),r.d(t,"VRDeviceOrientationFreeCamera",function(){return n.VRDeviceOrientationFreeCamera}),r.d(t,"VRDeviceOrientationGamepadCamera",function(){return n.VRDeviceOrientationGamepadCamera}),r.d(t,"OnAfterEnteringVRObservableEvent",function(){return n.OnAfterEnteringVRObservableEvent}),r.d(t,"VRExperienceHelper",function(){return n.VRExperienceHelper}),r.d(t,"WebVRFreeCamera",function(){return n.WebVRFreeCamera}),r.d(t,"WebXRCamera",function(){return n.WebXRCamera}),r.d(t,"WebXREnterExitUIButton",function(){return n.WebXREnterExitUIButton}),r.d(t,"WebXREnterExitUIOptions",function(){return n.WebXREnterExitUIOptions}),r.d(t,"WebXREnterExitUI",function(){return n.WebXREnterExitUI}),r.d(t,"WebXRState",function(){return n.WebXRState}),r.d(t,"WebXRExperienceHelper",function(){return n.WebXRExperienceHelper}),r.d(t,"WebXRInput",function(){return n.WebXRInput}),r.d(t,"WebXRControllerTeleportation",function(){return n.WebXRControllerTeleportation}),r.d(t,"WebXRControllerPointerSelection",function(){return n.WebXRControllerPointerSelection}),r.d(t,"WebXRControllerModelLoader",function(){return n.WebXRControllerModelLoader}),r.d(t,"WebXRController",function(){return n.WebXRController}),r.d(t,"WebXRManagedOutputCanvas",function(){return n.WebXRManagedOutputCanvas}),r.d(t,"WebXRSessionManager",function(){return n.WebXRSessionManager}),r.d(t,"Octree",function(){return n.Octree}),r.d(t,"OctreeBlock",function(){return n.OctreeBlock}),r.d(t,"OctreeSceneComponent",function(){return n.OctreeSceneComponent}),r.d(t,"_OcclusionDataStorage",function(){return n._OcclusionDataStorage}),r.d(t,"_forceTransformFeedbackToBundle",function(){return n._forceTransformFeedbackToBundle}),r.d(t,"ShadowGenerator",function(){return n.ShadowGenerator}),r.d(t,"ShadowGeneratorSceneComponent",function(){return n.ShadowGeneratorSceneComponent}),r.d(t,"_BabylonLoaderRegistered",function(){return n._BabylonLoaderRegistered}),r.d(t,"BackgroundMaterial",function(){return n.BackgroundMaterial}),r.d(t,"PBRMaterialDefines",function(){return n.PBRMaterialDefines}),r.d(t,"PBRBaseMaterial",function(){return n.PBRBaseMaterial}),r.d(t,"PBRBaseSimpleMaterial",function(){return n.PBRBaseSimpleMaterial}),r.d(t,"PBRMaterial",function(){return n.PBRMaterial}),r.d(t,"PBRMetallicRoughnessMaterial",function(){return n.PBRMetallicRoughnessMaterial}),r.d(t,"PBRSpecularGlossinessMaterial",function(){return n.PBRSpecularGlossinessMaterial}),r.d(t,"ColorGradingTexture",function(){return n.ColorGradingTexture}),r.d(t,"RawCubeTexture",function(){return n.RawCubeTexture}),r.d(t,"RawTexture3D",function(){return n.RawTexture3D}),r.d(t,"RefractionTexture",function(){return n.RefractionTexture}),r.d(t,"VideoTexture",function(){return n.VideoTexture}),r.d(t,"HtmlElementTexture",function(){return n.HtmlElementTexture}),r.d(t,"NodeMaterialBlockTargets",function(){return n.NodeMaterialBlockTargets}),r.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return n.NodeMaterialBlockConnectionPointTypes}),r.d(t,"NodeMaterialConnectionPoint",function(){return n.NodeMaterialConnectionPoint}),r.d(t,"NodeMaterialBlock",function(){return n.NodeMaterialBlock}),r.d(t,"NodeMaterialDefines",function(){return n.NodeMaterialDefines}),r.d(t,"NodeMaterial",function(){return n.NodeMaterial}),r.d(t,"NodeMaterialSystemValues",function(){return n.NodeMaterialSystemValues}),r.d(t,"Orientation",function(){return n.Orientation}),r.d(t,"BezierCurve",function(){return n.BezierCurve}),r.d(t,"Angle",function(){return n.Angle}),r.d(t,"Arc2",function(){return n.Arc2}),r.d(t,"Path2",function(){return n.Path2}),r.d(t,"Path3D",function(){return n.Path3D}),r.d(t,"Curve3",function(){return n.Curve3}),r.d(t,"PositionNormalVertex",function(){return n.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return n.PositionNormalTextureVertex}),r.d(t,"DracoCompression",function(){return n.DracoCompression}),r.d(t,"TiledBoxBuilder",function(){return n.TiledBoxBuilder}),r.d(t,"DiscBuilder",function(){return n.DiscBuilder}),r.d(t,"RibbonBuilder",function(){return n.RibbonBuilder}),r.d(t,"HemisphereBuilder",function(){return n.HemisphereBuilder}),r.d(t,"TorusKnotBuilder",function(){return n.TorusKnotBuilder}),r.d(t,"PolygonBuilder",function(){return n.PolygonBuilder}),r.d(t,"ShapeBuilder",function(){return n.ShapeBuilder}),r.d(t,"LatheBuilder",function(){return n.LatheBuilder}),r.d(t,"TiledPlaneBuilder",function(){return n.TiledPlaneBuilder}),r.d(t,"TubeBuilder",function(){return n.TubeBuilder}),r.d(t,"PolyhedronBuilder",function(){return n.PolyhedronBuilder}),r.d(t,"IcoSphereBuilder",function(){return n.IcoSphereBuilder}),r.d(t,"DecalBuilder",function(){return n.DecalBuilder}),r.d(t,"RecastJSPlugin",function(){return n.RecastJSPlugin}),r.d(t,"RecastJSCrowd",function(){return n.RecastJSCrowd}),r.d(t,"BoxParticleEmitter",function(){return n.BoxParticleEmitter}),r.d(t,"ConeParticleEmitter",function(){return n.ConeParticleEmitter}),r.d(t,"CylinderParticleEmitter",function(){return n.CylinderParticleEmitter}),r.d(t,"CylinderDirectedParticleEmitter",function(){return n.CylinderDirectedParticleEmitter}),r.d(t,"HemisphericParticleEmitter",function(){return n.HemisphericParticleEmitter}),r.d(t,"PointParticleEmitter",function(){return n.PointParticleEmitter}),r.d(t,"SphereParticleEmitter",function(){return n.SphereParticleEmitter}),r.d(t,"SphereDirectedParticleEmitter",function(){return n.SphereDirectedParticleEmitter}),r.d(t,"CannonJSPlugin",function(){return n.CannonJSPlugin}),r.d(t,"AmmoJSPlugin",function(){return n.AmmoJSPlugin}),r.d(t,"OimoJSPlugin",function(){return n.OimoJSPlugin}),r.d(t,"PostProcessRenderEffect",function(){return n.PostProcessRenderEffect}),r.d(t,"PostProcessRenderPipeline",function(){return n.PostProcessRenderPipeline}),r.d(t,"PostProcessRenderPipelineManager",function(){return n.PostProcessRenderPipelineManager}),r.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return n.PostProcessRenderPipelineManagerSceneComponent}),r.d(t,"HDRTools",function(){return n.HDRTools}),r.d(t,"PanoramaToCubeMapTools",function(){return n.PanoramaToCubeMapTools}),r.d(t,"_DDSTextureLoader",function(){return n._DDSTextureLoader}),r.d(t,"_ENVTextureLoader",function(){return n._ENVTextureLoader}),r.d(t,"_KTXTextureLoader",function(){return n._KTXTextureLoader}),r.d(t,"_TGATextureLoader",function(){return n._TGATextureLoader}),r.d(t,"_BasisTextureLoader",function(){return n._BasisTextureLoader}),r.d(t,"CustomProceduralTexture",function(){return n.CustomProceduralTexture}),r.d(t,"NoiseProceduralTexture",function(){return n.NoiseProceduralTexture}),r.d(t,"ProceduralTexture",function(){return n.ProceduralTexture}),r.d(t,"ProceduralTextureSceneComponent",function(){return n.ProceduralTextureSceneComponent}),r.d(t,"MultiplyBlock",function(){return n.MultiplyBlock}),r.d(t,"AddBlock",function(){return n.AddBlock}),r.d(t,"ScaleBlock",function(){return n.ScaleBlock}),r.d(t,"ClampBlock",function(){return n.ClampBlock}),r.d(t,"CrossBlock",function(){return n.CrossBlock}),r.d(t,"DotBlock",function(){return n.DotBlock}),r.d(t,"TransformBlock",function(){return n.TransformBlock}),r.d(t,"RemapBlock",function(){return n.RemapBlock}),r.d(t,"NormalizeBlock",function(){return n.NormalizeBlock}),r.d(t,"TrigonometryBlockOperations",function(){return n.TrigonometryBlockOperations}),r.d(t,"TrigonometryBlock",function(){return n.TrigonometryBlock}),r.d(t,"ColorMergerBlock",function(){return n.ColorMergerBlock}),r.d(t,"VectorMergerBlock",function(){return n.VectorMergerBlock}),r.d(t,"ColorSplitterBlock",function(){return n.ColorSplitterBlock}),r.d(t,"VectorSplitterBlock",function(){return n.VectorSplitterBlock}),r.d(t,"LerpBlock",function(){return n.LerpBlock}),r.d(t,"DivideBlock",function(){return n.DivideBlock}),r.d(t,"SubtractBlock",function(){return n.SubtractBlock}),r.d(t,"StepBlock",function(){return n.StepBlock}),r.d(t,"OppositeBlock",function(){return n.OppositeBlock}),r.d(t,"ViewDirectionBlock",function(){return n.ViewDirectionBlock}),r.d(t,"FresnelBlock",function(){return n.FresnelBlock}),r.d(t,"MaxBlock",function(){return n.MaxBlock}),r.d(t,"MinBlock",function(){return n.MinBlock}),r.d(t,"NodeMaterialOptimizer",function(){return n.NodeMaterialOptimizer}),r.d(t,"DefaultRenderingPipeline",function(){return n.DefaultRenderingPipeline}),r.d(t,"LensRenderingPipeline",function(){return n.LensRenderingPipeline}),r.d(t,"SSAO2RenderingPipeline",function(){return n.SSAO2RenderingPipeline}),r.d(t,"SSAORenderingPipeline",function(){return n.SSAORenderingPipeline}),r.d(t,"StandardRenderingPipeline",function(){return n.StandardRenderingPipeline}),r.d(t,"VertexOutputBlock",function(){return n.VertexOutputBlock}),r.d(t,"BonesBlock",function(){return n.BonesBlock}),r.d(t,"InstancesBlock",function(){return n.InstancesBlock}),r.d(t,"MorphTargetsBlock",function(){return n.MorphTargetsBlock}),r.d(t,"LightInformationBlock",function(){return n.LightInformationBlock}),r.d(t,"FragmentOutputBlock",function(){return n.FragmentOutputBlock}),r.d(t,"AlphaTestBlock",function(){return n.AlphaTestBlock}),r.d(t,"ImageProcessingBlock",function(){return n.ImageProcessingBlock}),r.d(t,"PerturbNormalBlock",function(){return n.PerturbNormalBlock}),r.d(t,"FogBlock",function(){return n.FogBlock}),r.d(t,"LightBlock",function(){return n.LightBlock}),r.d(t,"TextureBlock",function(){return n.TextureBlock}),r.d(t,"ReflectionTextureBlock",function(){return n.ReflectionTextureBlock}),r.d(t,"InputBlock",function(){return n.InputBlock}),r.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=s,o.BABYLON=o.BABYLON||{};var s=o.BABYLON;s.Debug=s.Debug||{};var a=[];for(var c in i)s.Debug[c]=i[c],a.push(c);for(var c in n)s[c]=n[c]}var l={AxesViewer:i.AxesViewer,BoneAxesViewer:i.BoneAxesViewer,PhysicsViewer:i.PhysicsViewer,SkeletonViewer:i.SkeletonViewer}}.call(this,r(/*! ./../../node_modules/webpack/buildin/global.js */"../node_modules/webpack/buildin/global.js"))},"./LensFlares/index.ts": /*!*****************************!*\ !*** ./LensFlares/index.ts ***! \*****************************/ @@ -1411,7 +1411,7 @@ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Arr /*!************************!*\ !*** ./Maths/index.ts ***! \************************/ -/*! exports provided: Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, PositionNormalVertex, PositionNormalTextureVertex */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./math.scalar */"./Maths/math.scalar.ts");r.d(t,"Scalar",function(){return n.Scalar});var i=r(/*! ./math */"./Maths/math.ts");r.d(t,"Space",function(){return i.Space}),r.d(t,"Axis",function(){return i.Axis}),r.d(t,"Color3",function(){return i.Color3}),r.d(t,"Color4",function(){return i.Color4}),r.d(t,"TmpColors",function(){return i.TmpColors}),r.d(t,"ToGammaSpace",function(){return i.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return i.ToLinearSpace}),r.d(t,"Epsilon",function(){return i.Epsilon}),r.d(t,"Frustum",function(){return i.Frustum}),r.d(t,"Orientation",function(){return i.Orientation}),r.d(t,"BezierCurve",function(){return i.BezierCurve}),r.d(t,"Angle",function(){return i.Angle}),r.d(t,"Arc2",function(){return i.Arc2}),r.d(t,"Path2",function(){return i.Path2}),r.d(t,"Path3D",function(){return i.Path3D}),r.d(t,"Curve3",function(){return i.Curve3}),r.d(t,"Plane",function(){return i.Plane}),r.d(t,"Size",function(){return i.Size}),r.d(t,"Vector2",function(){return i.Vector2}),r.d(t,"Vector3",function(){return i.Vector3}),r.d(t,"Vector4",function(){return i.Vector4}),r.d(t,"Quaternion",function(){return i.Quaternion}),r.d(t,"Matrix",function(){return i.Matrix}),r.d(t,"TmpVectors",function(){return i.TmpVectors}),r.d(t,"Viewport",function(){return i.Viewport}),r.d(t,"PositionNormalVertex",function(){return i.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return i.PositionNormalTextureVertex});var o=r(/*! ./sphericalPolynomial */"./Maths/sphericalPolynomial.ts");r.d(t,"SphericalHarmonics",function(){return o.SphericalHarmonics}),r.d(t,"SphericalPolynomial",function(){return o.SphericalPolynomial})},"./Maths/math.axis.ts": +/*! exports provided: Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./math.scalar */"./Maths/math.scalar.ts");r.d(t,"Scalar",function(){return n.Scalar});var i=r(/*! ./math */"./Maths/math.ts");r.d(t,"Space",function(){return i.Space}),r.d(t,"Axis",function(){return i.Axis}),r.d(t,"Color3",function(){return i.Color3}),r.d(t,"Color4",function(){return i.Color4}),r.d(t,"TmpColors",function(){return i.TmpColors}),r.d(t,"ToGammaSpace",function(){return i.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return i.ToLinearSpace}),r.d(t,"Epsilon",function(){return i.Epsilon}),r.d(t,"Frustum",function(){return i.Frustum}),r.d(t,"Plane",function(){return i.Plane}),r.d(t,"Size",function(){return i.Size}),r.d(t,"Vector2",function(){return i.Vector2}),r.d(t,"Vector3",function(){return i.Vector3}),r.d(t,"Vector4",function(){return i.Vector4}),r.d(t,"Quaternion",function(){return i.Quaternion}),r.d(t,"Matrix",function(){return i.Matrix}),r.d(t,"TmpVectors",function(){return i.TmpVectors}),r.d(t,"Viewport",function(){return i.Viewport}),r.d(t,"Orientation",function(){return i.Orientation}),r.d(t,"BezierCurve",function(){return i.BezierCurve}),r.d(t,"Angle",function(){return i.Angle}),r.d(t,"Arc2",function(){return i.Arc2}),r.d(t,"Path2",function(){return i.Path2}),r.d(t,"Path3D",function(){return i.Path3D}),r.d(t,"Curve3",function(){return i.Curve3}),r.d(t,"PositionNormalVertex",function(){return i.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return i.PositionNormalTextureVertex});var o=r(/*! ./sphericalPolynomial */"./Maths/sphericalPolynomial.ts");r.d(t,"SphericalHarmonics",function(){return o.SphericalHarmonics}),r.d(t,"SphericalPolynomial",function(){return o.SphericalPolynomial})},"./Maths/math.axis.ts": /*!****************************!*\ !*** ./Maths/math.axis.ts ***! \****************************/ @@ -1451,7 +1451,7 @@ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Arr /*!***********************!*\ !*** ./Maths/math.ts ***! \***********************/ -/*! exports provided: Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, PositionNormalVertex, PositionNormalTextureVertex */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./math.axis */"./Maths/math.axis.ts");r.d(t,"Space",function(){return n.Space}),r.d(t,"Axis",function(){return n.Axis});var i=r(/*! ./math.color */"./Maths/math.color.ts");r.d(t,"Color3",function(){return i.Color3}),r.d(t,"Color4",function(){return i.Color4}),r.d(t,"TmpColors",function(){return i.TmpColors});var o=r(/*! ./math.constants */"./Maths/math.constants.ts");r.d(t,"ToGammaSpace",function(){return o.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return o.ToLinearSpace}),r.d(t,"Epsilon",function(){return o.Epsilon});var s=r(/*! ./math.frustum */"./Maths/math.frustum.ts");r.d(t,"Frustum",function(){return s.Frustum});var a=r(/*! ./math.path */"./Maths/math.path.ts");r.d(t,"Orientation",function(){return a.Orientation}),r.d(t,"BezierCurve",function(){return a.BezierCurve}),r.d(t,"Angle",function(){return a.Angle}),r.d(t,"Arc2",function(){return a.Arc2}),r.d(t,"Path2",function(){return a.Path2}),r.d(t,"Path3D",function(){return a.Path3D}),r.d(t,"Curve3",function(){return a.Curve3});var c=r(/*! ./math.plane */"./Maths/math.plane.ts");r.d(t,"Plane",function(){return c.Plane});var l=r(/*! ./math.size */"./Maths/math.size.ts");r.d(t,"Size",function(){return l.Size});var u=r(/*! ./math.vector */"./Maths/math.vector.ts");r.d(t,"Vector2",function(){return u.Vector2}),r.d(t,"Vector3",function(){return u.Vector3}),r.d(t,"Vector4",function(){return u.Vector4}),r.d(t,"Quaternion",function(){return u.Quaternion}),r.d(t,"Matrix",function(){return u.Matrix}),r.d(t,"TmpVectors",function(){return u.TmpVectors});var h=r(/*! ./math.vertexFormat */"./Maths/math.vertexFormat.ts");r.d(t,"PositionNormalVertex",function(){return h.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return h.PositionNormalTextureVertex});var d=r(/*! ./math.viewport */"./Maths/math.viewport.ts");r.d(t,"Viewport",function(){return d.Viewport})},"./Maths/math.vector.ts": +/*! exports provided: Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./math.axis */"./Maths/math.axis.ts");r.d(t,"Space",function(){return n.Space}),r.d(t,"Axis",function(){return n.Axis});var i=r(/*! ./math.color */"./Maths/math.color.ts");r.d(t,"Color3",function(){return i.Color3}),r.d(t,"Color4",function(){return i.Color4}),r.d(t,"TmpColors",function(){return i.TmpColors});var o=r(/*! ./math.constants */"./Maths/math.constants.ts");r.d(t,"ToGammaSpace",function(){return o.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return o.ToLinearSpace}),r.d(t,"Epsilon",function(){return o.Epsilon});var s=r(/*! ./math.frustum */"./Maths/math.frustum.ts");r.d(t,"Frustum",function(){return s.Frustum});var a=r(/*! ./math.path */"./Maths/math.path.ts");r.d(t,"Orientation",function(){return a.Orientation}),r.d(t,"BezierCurve",function(){return a.BezierCurve}),r.d(t,"Angle",function(){return a.Angle}),r.d(t,"Arc2",function(){return a.Arc2}),r.d(t,"Path2",function(){return a.Path2}),r.d(t,"Path3D",function(){return a.Path3D}),r.d(t,"Curve3",function(){return a.Curve3});var c=r(/*! ./math.plane */"./Maths/math.plane.ts");r.d(t,"Plane",function(){return c.Plane});var l=r(/*! ./math.size */"./Maths/math.size.ts");r.d(t,"Size",function(){return l.Size});var u=r(/*! ./math.vector */"./Maths/math.vector.ts");r.d(t,"Vector2",function(){return u.Vector2}),r.d(t,"Vector3",function(){return u.Vector3}),r.d(t,"Vector4",function(){return u.Vector4}),r.d(t,"Quaternion",function(){return u.Quaternion}),r.d(t,"Matrix",function(){return u.Matrix}),r.d(t,"TmpVectors",function(){return u.TmpVectors});var h=r(/*! ./math.vertexFormat */"./Maths/math.vertexFormat.ts");r.d(t,"PositionNormalVertex",function(){return h.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return h.PositionNormalTextureVertex});var d=r(/*! ./math.viewport */"./Maths/math.viewport.ts");r.d(t,"Viewport",function(){return d.Viewport})},"./Maths/math.vector.ts": /*!******************************!*\ !*** ./Maths/math.vector.ts ***! \******************************/ @@ -2823,7 +2823,7 @@ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Arr /*!******************!*\ !*** ./index.ts ***! \******************/ -/*! exports provided: AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./abstractScene */"./abstractScene.ts");r.d(t,"AbstractScene",function(){return n.AbstractScene});var i=r(/*! ./Actions/index */"./Actions/index.ts");r.d(t,"AbstractActionManager",function(){return i.AbstractActionManager}),r.d(t,"Action",function(){return i.Action}),r.d(t,"ActionEvent",function(){return i.ActionEvent}),r.d(t,"ActionManager",function(){return i.ActionManager}),r.d(t,"Condition",function(){return i.Condition}),r.d(t,"ValueCondition",function(){return i.ValueCondition}),r.d(t,"PredicateCondition",function(){return i.PredicateCondition}),r.d(t,"StateCondition",function(){return i.StateCondition}),r.d(t,"SwitchBooleanAction",function(){return i.SwitchBooleanAction}),r.d(t,"SetStateAction",function(){return i.SetStateAction}),r.d(t,"SetValueAction",function(){return i.SetValueAction}),r.d(t,"IncrementValueAction",function(){return i.IncrementValueAction}),r.d(t,"PlayAnimationAction",function(){return i.PlayAnimationAction}),r.d(t,"StopAnimationAction",function(){return i.StopAnimationAction}),r.d(t,"DoNothingAction",function(){return i.DoNothingAction}),r.d(t,"CombineAction",function(){return i.CombineAction}),r.d(t,"ExecuteCodeAction",function(){return i.ExecuteCodeAction}),r.d(t,"SetParentAction",function(){return i.SetParentAction}),r.d(t,"PlaySoundAction",function(){return i.PlaySoundAction}),r.d(t,"StopSoundAction",function(){return i.StopSoundAction}),r.d(t,"InterpolateValueAction",function(){return i.InterpolateValueAction});var o=r(/*! ./Animations/index */"./Animations/index.ts");r.d(t,"Animatable",function(){return o.Animatable}),r.d(t,"_IAnimationState",function(){return o._IAnimationState}),r.d(t,"Animation",function(){return o.Animation}),r.d(t,"TargetedAnimation",function(){return o.TargetedAnimation}),r.d(t,"AnimationGroup",function(){return o.AnimationGroup}),r.d(t,"AnimationPropertiesOverride",function(){return o.AnimationPropertiesOverride}),r.d(t,"EasingFunction",function(){return o.EasingFunction}),r.d(t,"CircleEase",function(){return o.CircleEase}),r.d(t,"BackEase",function(){return o.BackEase}),r.d(t,"BounceEase",function(){return o.BounceEase}),r.d(t,"CubicEase",function(){return o.CubicEase}),r.d(t,"ElasticEase",function(){return o.ElasticEase}),r.d(t,"ExponentialEase",function(){return o.ExponentialEase}),r.d(t,"PowerEase",function(){return o.PowerEase}),r.d(t,"QuadraticEase",function(){return o.QuadraticEase}),r.d(t,"QuarticEase",function(){return o.QuarticEase}),r.d(t,"QuinticEase",function(){return o.QuinticEase}),r.d(t,"SineEase",function(){return o.SineEase}),r.d(t,"BezierCurveEase",function(){return o.BezierCurveEase}),r.d(t,"RuntimeAnimation",function(){return o.RuntimeAnimation}),r.d(t,"AnimationEvent",function(){return o.AnimationEvent}),r.d(t,"AnimationKeyInterpolation",function(){return o.AnimationKeyInterpolation}),r.d(t,"AnimationRange",function(){return o.AnimationRange});var s=r(/*! ./assetContainer */"./assetContainer.ts");r.d(t,"KeepAssets",function(){return s.KeepAssets}),r.d(t,"AssetContainer",function(){return s.AssetContainer});var a=r(/*! ./Audio/index */"./Audio/index.ts");r.d(t,"Analyser",function(){return a.Analyser}),r.d(t,"AudioEngine",function(){return a.AudioEngine}),r.d(t,"AudioSceneComponent",function(){return a.AudioSceneComponent}),r.d(t,"Sound",function(){return a.Sound}),r.d(t,"SoundTrack",function(){return a.SoundTrack}),r.d(t,"WeightedSound",function(){return a.WeightedSound});var c=r(/*! ./Behaviors/index */"./Behaviors/index.ts");r.d(t,"AutoRotationBehavior",function(){return c.AutoRotationBehavior}),r.d(t,"BouncingBehavior",function(){return c.BouncingBehavior}),r.d(t,"FramingBehavior",function(){return c.FramingBehavior}),r.d(t,"AttachToBoxBehavior",function(){return c.AttachToBoxBehavior}),r.d(t,"FadeInOutBehavior",function(){return c.FadeInOutBehavior}),r.d(t,"MultiPointerScaleBehavior",function(){return c.MultiPointerScaleBehavior}),r.d(t,"PointerDragBehavior",function(){return c.PointerDragBehavior}),r.d(t,"SixDofDragBehavior",function(){return c.SixDofDragBehavior});var l=r(/*! ./Bones/index */"./Bones/index.ts");r.d(t,"Bone",function(){return l.Bone}),r.d(t,"BoneIKController",function(){return l.BoneIKController}),r.d(t,"BoneLookController",function(){return l.BoneLookController}),r.d(t,"Skeleton",function(){return l.Skeleton});var u=r(/*! ./Cameras/index */"./Cameras/index.ts");r.d(t,"CameraInputTypes",function(){return u.CameraInputTypes}),r.d(t,"CameraInputsManager",function(){return u.CameraInputsManager}),r.d(t,"Camera",function(){return u.Camera}),r.d(t,"TargetCamera",function(){return u.TargetCamera}),r.d(t,"FreeCamera",function(){return u.FreeCamera}),r.d(t,"FreeCameraInputsManager",function(){return u.FreeCameraInputsManager}),r.d(t,"TouchCamera",function(){return u.TouchCamera}),r.d(t,"ArcRotateCamera",function(){return u.ArcRotateCamera}),r.d(t,"ArcRotateCameraInputsManager",function(){return u.ArcRotateCameraInputsManager}),r.d(t,"DeviceOrientationCamera",function(){return u.DeviceOrientationCamera}),r.d(t,"FlyCamera",function(){return u.FlyCamera}),r.d(t,"FlyCameraInputsManager",function(){return u.FlyCameraInputsManager}),r.d(t,"FollowCamera",function(){return u.FollowCamera}),r.d(t,"ArcFollowCamera",function(){return u.ArcFollowCamera}),r.d(t,"FollowCameraInputsManager",function(){return u.FollowCameraInputsManager}),r.d(t,"GamepadCamera",function(){return u.GamepadCamera}),r.d(t,"UniversalCamera",function(){return u.UniversalCamera}),r.d(t,"VirtualJoysticksCamera",function(){return u.VirtualJoysticksCamera}),r.d(t,"ArcRotateCameraGamepadInput",function(){return u.ArcRotateCameraGamepadInput}),r.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return u.ArcRotateCameraKeyboardMoveInput}),r.d(t,"ArcRotateCameraMouseWheelInput",function(){return u.ArcRotateCameraMouseWheelInput}),r.d(t,"ArcRotateCameraPointersInput",function(){return u.ArcRotateCameraPointersInput}),r.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return u.ArcRotateCameraVRDeviceOrientationInput}),r.d(t,"FlyCameraKeyboardInput",function(){return u.FlyCameraKeyboardInput}),r.d(t,"FlyCameraMouseInput",function(){return u.FlyCameraMouseInput}),r.d(t,"FollowCameraKeyboardMoveInput",function(){return u.FollowCameraKeyboardMoveInput}),r.d(t,"FollowCameraMouseWheelInput",function(){return u.FollowCameraMouseWheelInput}),r.d(t,"FollowCameraPointersInput",function(){return u.FollowCameraPointersInput}),r.d(t,"FreeCameraDeviceOrientationInput",function(){return u.FreeCameraDeviceOrientationInput}),r.d(t,"FreeCameraGamepadInput",function(){return u.FreeCameraGamepadInput}),r.d(t,"FreeCameraKeyboardMoveInput",function(){return u.FreeCameraKeyboardMoveInput}),r.d(t,"FreeCameraMouseInput",function(){return u.FreeCameraMouseInput}),r.d(t,"FreeCameraTouchInput",function(){return u.FreeCameraTouchInput}),r.d(t,"FreeCameraVirtualJoystickInput",function(){return u.FreeCameraVirtualJoystickInput}),r.d(t,"AnaglyphArcRotateCamera",function(){return u.AnaglyphArcRotateCamera}),r.d(t,"AnaglyphFreeCamera",function(){return u.AnaglyphFreeCamera}),r.d(t,"AnaglyphGamepadCamera",function(){return u.AnaglyphGamepadCamera}),r.d(t,"AnaglyphUniversalCamera",function(){return u.AnaglyphUniversalCamera}),r.d(t,"StereoscopicArcRotateCamera",function(){return u.StereoscopicArcRotateCamera}),r.d(t,"StereoscopicFreeCamera",function(){return u.StereoscopicFreeCamera}),r.d(t,"StereoscopicGamepadCamera",function(){return u.StereoscopicGamepadCamera}),r.d(t,"StereoscopicUniversalCamera",function(){return u.StereoscopicUniversalCamera}),r.d(t,"VRCameraMetrics",function(){return u.VRCameraMetrics}),r.d(t,"VRDeviceOrientationArcRotateCamera",function(){return u.VRDeviceOrientationArcRotateCamera}),r.d(t,"VRDeviceOrientationFreeCamera",function(){return u.VRDeviceOrientationFreeCamera}),r.d(t,"VRDeviceOrientationGamepadCamera",function(){return u.VRDeviceOrientationGamepadCamera}),r.d(t,"OnAfterEnteringVRObservableEvent",function(){return u.OnAfterEnteringVRObservableEvent}),r.d(t,"VRExperienceHelper",function(){return u.VRExperienceHelper}),r.d(t,"WebVRFreeCamera",function(){return u.WebVRFreeCamera}),r.d(t,"WebXRCamera",function(){return u.WebXRCamera}),r.d(t,"WebXREnterExitUIButton",function(){return u.WebXREnterExitUIButton}),r.d(t,"WebXREnterExitUIOptions",function(){return u.WebXREnterExitUIOptions}),r.d(t,"WebXREnterExitUI",function(){return u.WebXREnterExitUI}),r.d(t,"WebXRState",function(){return u.WebXRState}),r.d(t,"WebXRExperienceHelper",function(){return u.WebXRExperienceHelper}),r.d(t,"WebXRInput",function(){return u.WebXRInput}),r.d(t,"WebXRControllerTeleportation",function(){return u.WebXRControllerTeleportation}),r.d(t,"WebXRControllerPointerSelection",function(){return u.WebXRControllerPointerSelection}),r.d(t,"WebXRControllerModelLoader",function(){return u.WebXRControllerModelLoader}),r.d(t,"WebXRController",function(){return u.WebXRController}),r.d(t,"WebXRManagedOutputCanvas",function(){return u.WebXRManagedOutputCanvas}),r.d(t,"WebXRSessionManager",function(){return u.WebXRSessionManager});var h=r(/*! ./Collisions/index */"./Collisions/index.ts");r.d(t,"Collider",function(){return h.Collider}),r.d(t,"DefaultCollisionCoordinator",function(){return h.DefaultCollisionCoordinator}),r.d(t,"PickingInfo",function(){return h.PickingInfo}),r.d(t,"IntersectionInfo",function(){return h.IntersectionInfo}),r.d(t,"_MeshCollisionData",function(){return h._MeshCollisionData});var d=r(/*! ./Culling/index */"./Culling/index.ts");r.d(t,"BoundingBox",function(){return d.BoundingBox}),r.d(t,"BoundingInfo",function(){return d.BoundingInfo}),r.d(t,"BoundingSphere",function(){return d.BoundingSphere}),r.d(t,"Ray",function(){return d.Ray}),r.d(t,"Octree",function(){return d.Octree}),r.d(t,"OctreeBlock",function(){return d.OctreeBlock}),r.d(t,"OctreeSceneComponent",function(){return d.OctreeSceneComponent});var f=r(/*! ./Debug/index */"./Debug/index.ts");r.d(t,"AxesViewer",function(){return f.AxesViewer}),r.d(t,"BoneAxesViewer",function(){return f.BoneAxesViewer}),r.d(t,"DebugLayer",function(){return f.DebugLayer}),r.d(t,"PhysicsViewer",function(){return f.PhysicsViewer}),r.d(t,"RayHelper",function(){return f.RayHelper}),r.d(t,"SkeletonViewer",function(){return f.SkeletonViewer});var p=r(/*! ./Engines/index */"./Engines/index.ts");r.d(t,"Constants",function(){return p.Constants}),r.d(t,"InstancingAttributeInfo",function(){return p.InstancingAttributeInfo}),r.d(t,"DepthTextureCreationOptions",function(){return p.DepthTextureCreationOptions}),r.d(t,"EngineCapabilities",function(){return p.EngineCapabilities}),r.d(t,"Engine",function(){return p.Engine}),r.d(t,"EngineStore",function(){return p.EngineStore}),r.d(t,"NullEngineOptions",function(){return p.NullEngineOptions}),r.d(t,"NullEngine",function(){return p.NullEngine}),r.d(t,"WebGLPipelineContext",function(){return p.WebGLPipelineContext}),r.d(t,"WebGL2ShaderProcessor",function(){return p.WebGL2ShaderProcessor}),r.d(t,"NativeEngine",function(){return p.NativeEngine}),r.d(t,"_OcclusionDataStorage",function(){return p._OcclusionDataStorage}),r.d(t,"_forceTransformFeedbackToBundle",function(){return p._forceTransformFeedbackToBundle});var m=r(/*! ./Events/index */"./Events/index.ts");r.d(t,"KeyboardEventTypes",function(){return m.KeyboardEventTypes}),r.d(t,"KeyboardInfo",function(){return m.KeyboardInfo}),r.d(t,"KeyboardInfoPre",function(){return m.KeyboardInfoPre}),r.d(t,"PointerEventTypes",function(){return m.PointerEventTypes}),r.d(t,"PointerInfoBase",function(){return m.PointerInfoBase}),r.d(t,"PointerInfoPre",function(){return m.PointerInfoPre}),r.d(t,"PointerInfo",function(){return m.PointerInfo}),r.d(t,"ClipboardEventTypes",function(){return m.ClipboardEventTypes}),r.d(t,"ClipboardInfo",function(){return m.ClipboardInfo});var g=r(/*! ./Gamepads/index */"./Gamepads/index.ts");r.d(t,"StickValues",function(){return g.StickValues}),r.d(t,"Gamepad",function(){return g.Gamepad}),r.d(t,"GenericPad",function(){return g.GenericPad}),r.d(t,"GamepadManager",function(){return g.GamepadManager}),r.d(t,"GamepadSystemSceneComponent",function(){return g.GamepadSystemSceneComponent}),r.d(t,"Xbox360Button",function(){return g.Xbox360Button}),r.d(t,"Xbox360Dpad",function(){return g.Xbox360Dpad}),r.d(t,"Xbox360Pad",function(){return g.Xbox360Pad}),r.d(t,"DualShockButton",function(){return g.DualShockButton}),r.d(t,"DualShockDpad",function(){return g.DualShockDpad}),r.d(t,"DualShockPad",function(){return g.DualShockPad}),r.d(t,"DaydreamController",function(){return g.DaydreamController}),r.d(t,"GearVRController",function(){return g.GearVRController}),r.d(t,"GenericController",function(){return g.GenericController}),r.d(t,"OculusTouchController",function(){return g.OculusTouchController}),r.d(t,"PoseEnabledControllerType",function(){return g.PoseEnabledControllerType}),r.d(t,"PoseEnabledControllerHelper",function(){return g.PoseEnabledControllerHelper}),r.d(t,"PoseEnabledController",function(){return g.PoseEnabledController}),r.d(t,"ViveController",function(){return g.ViveController}),r.d(t,"WebVRController",function(){return g.WebVRController}),r.d(t,"WindowsMotionController",function(){return g.WindowsMotionController});var _=r(/*! ./Gizmos/index */"./Gizmos/index.ts");r.d(t,"AxisDragGizmo",function(){return _.AxisDragGizmo}),r.d(t,"AxisScaleGizmo",function(){return _.AxisScaleGizmo}),r.d(t,"BoundingBoxGizmo",function(){return _.BoundingBoxGizmo}),r.d(t,"Gizmo",function(){return _.Gizmo}),r.d(t,"GizmoManager",function(){return _.GizmoManager}),r.d(t,"PlaneRotationGizmo",function(){return _.PlaneRotationGizmo}),r.d(t,"PositionGizmo",function(){return _.PositionGizmo}),r.d(t,"RotationGizmo",function(){return _.RotationGizmo}),r.d(t,"ScaleGizmo",function(){return _.ScaleGizmo}),r.d(t,"LightGizmo",function(){return _.LightGizmo}),r.d(t,"PlaneDragGizmo",function(){return _.PlaneDragGizmo});var v=r(/*! ./Helpers/index */"./Helpers/index.ts");r.d(t,"EnvironmentHelper",function(){return v.EnvironmentHelper}),r.d(t,"PhotoDome",function(){return v.PhotoDome}),r.d(t,"_forceSceneHelpersToBundle",function(){return v._forceSceneHelpersToBundle}),r.d(t,"VideoDome",function(){return v.VideoDome});var A=r(/*! ./Instrumentation/index */"./Instrumentation/index.ts");r.d(t,"EngineInstrumentation",function(){return A.EngineInstrumentation}),r.d(t,"SceneInstrumentation",function(){return A.SceneInstrumentation}),r.d(t,"_TimeToken",function(){return A._TimeToken});var y=r(/*! ./Layers/index */"./Layers/index.ts");r.d(t,"EffectLayer",function(){return y.EffectLayer}),r.d(t,"EffectLayerSceneComponent",function(){return y.EffectLayerSceneComponent}),r.d(t,"GlowLayer",function(){return y.GlowLayer}),r.d(t,"HighlightLayer",function(){return y.HighlightLayer}),r.d(t,"Layer",function(){return y.Layer}),r.d(t,"LayerSceneComponent",function(){return y.LayerSceneComponent});var b=r(/*! ./LensFlares/index */"./LensFlares/index.ts");r.d(t,"LensFlare",function(){return b.LensFlare}),r.d(t,"LensFlareSystem",function(){return b.LensFlareSystem}),r.d(t,"LensFlareSystemSceneComponent",function(){return b.LensFlareSystemSceneComponent});var T=r(/*! ./Lights/index */"./Lights/index.ts");r.d(t,"Light",function(){return T.Light}),r.d(t,"ShadowLight",function(){return T.ShadowLight}),r.d(t,"DirectionalLight",function(){return T.DirectionalLight}),r.d(t,"HemisphericLight",function(){return T.HemisphericLight}),r.d(t,"PointLight",function(){return T.PointLight}),r.d(t,"SpotLight",function(){return T.SpotLight}),r.d(t,"ShadowGenerator",function(){return T.ShadowGenerator}),r.d(t,"ShadowGeneratorSceneComponent",function(){return T.ShadowGeneratorSceneComponent});var E=r(/*! ./Loading/index */"./Loading/index.ts");r.d(t,"DefaultLoadingScreen",function(){return E.DefaultLoadingScreen}),r.d(t,"SceneLoaderProgressEvent",function(){return E.SceneLoaderProgressEvent}),r.d(t,"SceneLoader",function(){return E.SceneLoader}),r.d(t,"SceneLoaderFlags",function(){return E.SceneLoaderFlags}),r.d(t,"_BabylonLoaderRegistered",function(){return E._BabylonLoaderRegistered});var M=r(/*! ./Materials/index */"./Materials/index.ts");r.d(t,"ColorCurves",function(){return M.ColorCurves}),r.d(t,"EffectFallbacks",function(){return M.EffectFallbacks}),r.d(t,"EffectCreationOptions",function(){return M.EffectCreationOptions}),r.d(t,"Effect",function(){return M.Effect}),r.d(t,"FresnelParameters",function(){return M.FresnelParameters}),r.d(t,"ImageProcessingConfigurationDefines",function(){return M.ImageProcessingConfigurationDefines}),r.d(t,"ImageProcessingConfiguration",function(){return M.ImageProcessingConfiguration}),r.d(t,"Material",function(){return M.Material}),r.d(t,"MaterialDefines",function(){return M.MaterialDefines}),r.d(t,"MaterialHelper",function(){return M.MaterialHelper}),r.d(t,"MultiMaterial",function(){return M.MultiMaterial}),r.d(t,"PushMaterial",function(){return M.PushMaterial}),r.d(t,"ShaderMaterial",function(){return M.ShaderMaterial}),r.d(t,"StandardMaterialDefines",function(){return M.StandardMaterialDefines}),r.d(t,"StandardMaterial",function(){return M.StandardMaterial}),r.d(t,"BaseTexture",function(){return M.BaseTexture}),r.d(t,"CubeTexture",function(){return M.CubeTexture}),r.d(t,"DynamicTexture",function(){return M.DynamicTexture}),r.d(t,"EquiRectangularCubeTexture",function(){return M.EquiRectangularCubeTexture}),r.d(t,"HDRCubeTexture",function(){return M.HDRCubeTexture}),r.d(t,"InternalTexture",function(){return M.InternalTexture}),r.d(t,"MirrorTexture",function(){return M.MirrorTexture}),r.d(t,"MultiRenderTarget",function(){return M.MultiRenderTarget}),r.d(t,"RawTexture",function(){return M.RawTexture}),r.d(t,"RenderTargetTexture",function(){return M.RenderTargetTexture}),r.d(t,"Texture",function(){return M.Texture}),r.d(t,"UniformBuffer",function(){return M.UniformBuffer}),r.d(t,"MaterialFlags",function(){return M.MaterialFlags}),r.d(t,"EffectRenderer",function(){return M.EffectRenderer}),r.d(t,"EffectWrapper",function(){return M.EffectWrapper}),r.d(t,"BackgroundMaterial",function(){return M.BackgroundMaterial}),r.d(t,"PBRMaterialDefines",function(){return M.PBRMaterialDefines}),r.d(t,"PBRBaseMaterial",function(){return M.PBRBaseMaterial}),r.d(t,"PBRBaseSimpleMaterial",function(){return M.PBRBaseSimpleMaterial}),r.d(t,"PBRMaterial",function(){return M.PBRMaterial}),r.d(t,"PBRMetallicRoughnessMaterial",function(){return M.PBRMetallicRoughnessMaterial}),r.d(t,"PBRSpecularGlossinessMaterial",function(){return M.PBRSpecularGlossinessMaterial}),r.d(t,"ColorGradingTexture",function(){return M.ColorGradingTexture}),r.d(t,"RawCubeTexture",function(){return M.RawCubeTexture}),r.d(t,"RawTexture3D",function(){return M.RawTexture3D}),r.d(t,"RefractionTexture",function(){return M.RefractionTexture}),r.d(t,"VideoTexture",function(){return M.VideoTexture}),r.d(t,"HtmlElementTexture",function(){return M.HtmlElementTexture}),r.d(t,"NodeMaterialBlockTargets",function(){return M.NodeMaterialBlockTargets}),r.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return M.NodeMaterialBlockConnectionPointTypes}),r.d(t,"NodeMaterialConnectionPoint",function(){return M.NodeMaterialConnectionPoint}),r.d(t,"NodeMaterialBlock",function(){return M.NodeMaterialBlock}),r.d(t,"NodeMaterialDefines",function(){return M.NodeMaterialDefines}),r.d(t,"NodeMaterial",function(){return M.NodeMaterial}),r.d(t,"NodeMaterialSystemValues",function(){return M.NodeMaterialSystemValues}),r.d(t,"_DDSTextureLoader",function(){return M._DDSTextureLoader}),r.d(t,"_ENVTextureLoader",function(){return M._ENVTextureLoader}),r.d(t,"_KTXTextureLoader",function(){return M._KTXTextureLoader}),r.d(t,"_TGATextureLoader",function(){return M._TGATextureLoader}),r.d(t,"_BasisTextureLoader",function(){return M._BasisTextureLoader}),r.d(t,"CustomProceduralTexture",function(){return M.CustomProceduralTexture}),r.d(t,"NoiseProceduralTexture",function(){return M.NoiseProceduralTexture}),r.d(t,"ProceduralTexture",function(){return M.ProceduralTexture}),r.d(t,"ProceduralTextureSceneComponent",function(){return M.ProceduralTextureSceneComponent}),r.d(t,"MultiplyBlock",function(){return M.MultiplyBlock}),r.d(t,"AddBlock",function(){return M.AddBlock}),r.d(t,"ScaleBlock",function(){return M.ScaleBlock}),r.d(t,"ClampBlock",function(){return M.ClampBlock}),r.d(t,"CrossBlock",function(){return M.CrossBlock}),r.d(t,"DotBlock",function(){return M.DotBlock}),r.d(t,"TransformBlock",function(){return M.TransformBlock}),r.d(t,"RemapBlock",function(){return M.RemapBlock}),r.d(t,"NormalizeBlock",function(){return M.NormalizeBlock}),r.d(t,"TrigonometryBlockOperations",function(){return M.TrigonometryBlockOperations}),r.d(t,"TrigonometryBlock",function(){return M.TrigonometryBlock}),r.d(t,"ColorMergerBlock",function(){return M.ColorMergerBlock}),r.d(t,"VectorMergerBlock",function(){return M.VectorMergerBlock}),r.d(t,"ColorSplitterBlock",function(){return M.ColorSplitterBlock}),r.d(t,"VectorSplitterBlock",function(){return M.VectorSplitterBlock}),r.d(t,"LerpBlock",function(){return M.LerpBlock}),r.d(t,"DivideBlock",function(){return M.DivideBlock}),r.d(t,"SubtractBlock",function(){return M.SubtractBlock}),r.d(t,"StepBlock",function(){return M.StepBlock}),r.d(t,"OppositeBlock",function(){return M.OppositeBlock}),r.d(t,"ViewDirectionBlock",function(){return M.ViewDirectionBlock}),r.d(t,"FresnelBlock",function(){return M.FresnelBlock}),r.d(t,"MaxBlock",function(){return M.MaxBlock}),r.d(t,"MinBlock",function(){return M.MinBlock}),r.d(t,"NodeMaterialOptimizer",function(){return M.NodeMaterialOptimizer}),r.d(t,"VertexOutputBlock",function(){return M.VertexOutputBlock}),r.d(t,"BonesBlock",function(){return M.BonesBlock}),r.d(t,"InstancesBlock",function(){return M.InstancesBlock}),r.d(t,"MorphTargetsBlock",function(){return M.MorphTargetsBlock}),r.d(t,"LightInformationBlock",function(){return M.LightInformationBlock}),r.d(t,"FragmentOutputBlock",function(){return M.FragmentOutputBlock}),r.d(t,"AlphaTestBlock",function(){return M.AlphaTestBlock}),r.d(t,"ImageProcessingBlock",function(){return M.ImageProcessingBlock}),r.d(t,"PerturbNormalBlock",function(){return M.PerturbNormalBlock}),r.d(t,"FogBlock",function(){return M.FogBlock}),r.d(t,"LightBlock",function(){return M.LightBlock}),r.d(t,"TextureBlock",function(){return M.TextureBlock}),r.d(t,"ReflectionTextureBlock",function(){return M.ReflectionTextureBlock}),r.d(t,"InputBlock",function(){return M.InputBlock}),r.d(t,"AnimatedInputBlockTypes",function(){return M.AnimatedInputBlockTypes});var P=r(/*! ./Maths/index */"./Maths/index.ts");r.d(t,"Scalar",function(){return P.Scalar}),r.d(t,"Space",function(){return P.Space}),r.d(t,"Axis",function(){return P.Axis}),r.d(t,"Color3",function(){return P.Color3}),r.d(t,"Color4",function(){return P.Color4}),r.d(t,"TmpColors",function(){return P.TmpColors}),r.d(t,"ToGammaSpace",function(){return P.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return P.ToLinearSpace}),r.d(t,"Epsilon",function(){return P.Epsilon}),r.d(t,"Frustum",function(){return P.Frustum}),r.d(t,"Orientation",function(){return P.Orientation}),r.d(t,"BezierCurve",function(){return P.BezierCurve}),r.d(t,"Angle",function(){return P.Angle}),r.d(t,"Arc2",function(){return P.Arc2}),r.d(t,"Path2",function(){return P.Path2}),r.d(t,"Path3D",function(){return P.Path3D}),r.d(t,"Curve3",function(){return P.Curve3}),r.d(t,"Plane",function(){return P.Plane}),r.d(t,"Size",function(){return P.Size}),r.d(t,"Vector2",function(){return P.Vector2}),r.d(t,"Vector3",function(){return P.Vector3}),r.d(t,"Vector4",function(){return P.Vector4}),r.d(t,"Quaternion",function(){return P.Quaternion}),r.d(t,"Matrix",function(){return P.Matrix}),r.d(t,"TmpVectors",function(){return P.TmpVectors}),r.d(t,"Viewport",function(){return P.Viewport}),r.d(t,"SphericalHarmonics",function(){return P.SphericalHarmonics}),r.d(t,"SphericalPolynomial",function(){return P.SphericalPolynomial}),r.d(t,"PositionNormalVertex",function(){return P.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return P.PositionNormalTextureVertex});var x=r(/*! ./Meshes/index */"./Meshes/index.ts");r.d(t,"AbstractMesh",function(){return x.AbstractMesh}),r.d(t,"Buffer",function(){return x.Buffer}),r.d(t,"VertexBuffer",function(){return x.VertexBuffer}),r.d(t,"CSG",function(){return x.CSG}),r.d(t,"Geometry",function(){return x.Geometry}),r.d(t,"GroundMesh",function(){return x.GroundMesh}),r.d(t,"TrailMesh",function(){return x.TrailMesh}),r.d(t,"InstancedMesh",function(){return x.InstancedMesh}),r.d(t,"LinesMesh",function(){return x.LinesMesh}),r.d(t,"InstancedLinesMesh",function(){return x.InstancedLinesMesh}),r.d(t,"_CreationDataStorage",function(){return x._CreationDataStorage}),r.d(t,"_InstancesBatch",function(){return x._InstancesBatch}),r.d(t,"Mesh",function(){return x.Mesh}),r.d(t,"VertexData",function(){return x.VertexData}),r.d(t,"MeshBuilder",function(){return x.MeshBuilder}),r.d(t,"SimplificationSettings",function(){return x.SimplificationSettings}),r.d(t,"SimplificationQueue",function(){return x.SimplificationQueue}),r.d(t,"SimplificationType",function(){return x.SimplificationType}),r.d(t,"SimplicationQueueSceneComponent",function(){return x.SimplicationQueueSceneComponent}),r.d(t,"Polygon",function(){return x.Polygon}),r.d(t,"PolygonMeshBuilder",function(){return x.PolygonMeshBuilder}),r.d(t,"BaseSubMesh",function(){return x.BaseSubMesh}),r.d(t,"SubMesh",function(){return x.SubMesh}),r.d(t,"MeshLODLevel",function(){return x.MeshLODLevel}),r.d(t,"TransformNode",function(){return x.TransformNode}),r.d(t,"BoxBuilder",function(){return x.BoxBuilder}),r.d(t,"SphereBuilder",function(){return x.SphereBuilder}),r.d(t,"CylinderBuilder",function(){return x.CylinderBuilder}),r.d(t,"TorusBuilder",function(){return x.TorusBuilder}),r.d(t,"LinesBuilder",function(){return x.LinesBuilder}),r.d(t,"PlaneBuilder",function(){return x.PlaneBuilder}),r.d(t,"GroundBuilder",function(){return x.GroundBuilder}),r.d(t,"DataBuffer",function(){return x.DataBuffer}),r.d(t,"WebGLDataBuffer",function(){return x.WebGLDataBuffer}),r.d(t,"DracoCompression",function(){return x.DracoCompression}),r.d(t,"TiledBoxBuilder",function(){return x.TiledBoxBuilder}),r.d(t,"DiscBuilder",function(){return x.DiscBuilder}),r.d(t,"RibbonBuilder",function(){return x.RibbonBuilder}),r.d(t,"HemisphereBuilder",function(){return x.HemisphereBuilder}),r.d(t,"TorusKnotBuilder",function(){return x.TorusKnotBuilder}),r.d(t,"PolygonBuilder",function(){return x.PolygonBuilder}),r.d(t,"ShapeBuilder",function(){return x.ShapeBuilder}),r.d(t,"LatheBuilder",function(){return x.LatheBuilder}),r.d(t,"TiledPlaneBuilder",function(){return x.TiledPlaneBuilder}),r.d(t,"TubeBuilder",function(){return x.TubeBuilder}),r.d(t,"PolyhedronBuilder",function(){return x.PolyhedronBuilder}),r.d(t,"IcoSphereBuilder",function(){return x.IcoSphereBuilder}),r.d(t,"DecalBuilder",function(){return x.DecalBuilder});var S=r(/*! ./Morph/index */"./Morph/index.ts");r.d(t,"MorphTarget",function(){return S.MorphTarget}),r.d(t,"MorphTargetManager",function(){return S.MorphTargetManager});var C=r(/*! ./Navigation/index */"./Navigation/index.ts");r.d(t,"RecastJSPlugin",function(){return C.RecastJSPlugin}),r.d(t,"RecastJSCrowd",function(){return C.RecastJSCrowd});var R=r(/*! ./node */"./node.ts");r.d(t,"Node",function(){return R.Node});var O=r(/*! ./Offline/index */"./Offline/index.ts");r.d(t,"Database",function(){return O.Database});var D=r(/*! ./Particles/index */"./Particles/index.ts");r.d(t,"BaseParticleSystem",function(){return D.BaseParticleSystem}),r.d(t,"GPUParticleSystem",function(){return D.GPUParticleSystem}),r.d(t,"Particle",function(){return D.Particle}),r.d(t,"ParticleHelper",function(){return D.ParticleHelper}),r.d(t,"ParticleSystem",function(){return D.ParticleSystem}),r.d(t,"_IDoNeedToBeInTheBuild",function(){return D._IDoNeedToBeInTheBuild}),r.d(t,"ParticleSystemSet",function(){return D.ParticleSystemSet}),r.d(t,"SolidParticle",function(){return D.SolidParticle}),r.d(t,"ModelShape",function(){return D.ModelShape}),r.d(t,"DepthSortedParticle",function(){return D.DepthSortedParticle}),r.d(t,"SolidParticleSystem",function(){return D.SolidParticleSystem}),r.d(t,"SubEmitterType",function(){return D.SubEmitterType}),r.d(t,"SubEmitter",function(){return D.SubEmitter}),r.d(t,"BoxParticleEmitter",function(){return D.BoxParticleEmitter}),r.d(t,"ConeParticleEmitter",function(){return D.ConeParticleEmitter}),r.d(t,"CylinderParticleEmitter",function(){return D.CylinderParticleEmitter}),r.d(t,"CylinderDirectedParticleEmitter",function(){return D.CylinderDirectedParticleEmitter}),r.d(t,"HemisphericParticleEmitter",function(){return D.HemisphericParticleEmitter}),r.d(t,"PointParticleEmitter",function(){return D.PointParticleEmitter}),r.d(t,"SphereParticleEmitter",function(){return D.SphereParticleEmitter}),r.d(t,"SphereDirectedParticleEmitter",function(){return D.SphereDirectedParticleEmitter});var I=r(/*! ./Physics/index */"./Physics/index.ts");r.d(t,"PhysicsEngine",function(){return I.PhysicsEngine}),r.d(t,"PhysicsEngineSceneComponent",function(){return I.PhysicsEngineSceneComponent}),r.d(t,"PhysicsHelper",function(){return I.PhysicsHelper}),r.d(t,"PhysicsRadialExplosionEventOptions",function(){return I.PhysicsRadialExplosionEventOptions}),r.d(t,"PhysicsUpdraftEventOptions",function(){return I.PhysicsUpdraftEventOptions}),r.d(t,"PhysicsVortexEventOptions",function(){return I.PhysicsVortexEventOptions}),r.d(t,"PhysicsRadialImpulseFalloff",function(){return I.PhysicsRadialImpulseFalloff}),r.d(t,"PhysicsUpdraftMode",function(){return I.PhysicsUpdraftMode}),r.d(t,"PhysicsImpostor",function(){return I.PhysicsImpostor}),r.d(t,"PhysicsJoint",function(){return I.PhysicsJoint}),r.d(t,"DistanceJoint",function(){return I.DistanceJoint}),r.d(t,"MotorEnabledJoint",function(){return I.MotorEnabledJoint}),r.d(t,"HingeJoint",function(){return I.HingeJoint}),r.d(t,"Hinge2Joint",function(){return I.Hinge2Joint}),r.d(t,"CannonJSPlugin",function(){return I.CannonJSPlugin}),r.d(t,"AmmoJSPlugin",function(){return I.AmmoJSPlugin}),r.d(t,"OimoJSPlugin",function(){return I.OimoJSPlugin});var L=r(/*! ./PostProcesses/index */"./PostProcesses/index.ts");r.d(t,"AnaglyphPostProcess",function(){return L.AnaglyphPostProcess}),r.d(t,"BlackAndWhitePostProcess",function(){return L.BlackAndWhitePostProcess}),r.d(t,"BloomEffect",function(){return L.BloomEffect}),r.d(t,"BloomMergePostProcess",function(){return L.BloomMergePostProcess}),r.d(t,"BlurPostProcess",function(){return L.BlurPostProcess}),r.d(t,"ChromaticAberrationPostProcess",function(){return L.ChromaticAberrationPostProcess}),r.d(t,"CircleOfConfusionPostProcess",function(){return L.CircleOfConfusionPostProcess}),r.d(t,"ColorCorrectionPostProcess",function(){return L.ColorCorrectionPostProcess}),r.d(t,"ConvolutionPostProcess",function(){return L.ConvolutionPostProcess}),r.d(t,"DepthOfFieldBlurPostProcess",function(){return L.DepthOfFieldBlurPostProcess}),r.d(t,"DepthOfFieldEffectBlurLevel",function(){return L.DepthOfFieldEffectBlurLevel}),r.d(t,"DepthOfFieldEffect",function(){return L.DepthOfFieldEffect}),r.d(t,"DepthOfFieldMergePostProcessOptions",function(){return L.DepthOfFieldMergePostProcessOptions}),r.d(t,"DepthOfFieldMergePostProcess",function(){return L.DepthOfFieldMergePostProcess}),r.d(t,"DisplayPassPostProcess",function(){return L.DisplayPassPostProcess}),r.d(t,"ExtractHighlightsPostProcess",function(){return L.ExtractHighlightsPostProcess}),r.d(t,"FilterPostProcess",function(){return L.FilterPostProcess}),r.d(t,"FxaaPostProcess",function(){return L.FxaaPostProcess}),r.d(t,"GrainPostProcess",function(){return L.GrainPostProcess}),r.d(t,"HighlightsPostProcess",function(){return L.HighlightsPostProcess}),r.d(t,"ImageProcessingPostProcess",function(){return L.ImageProcessingPostProcess}),r.d(t,"MotionBlurPostProcess",function(){return L.MotionBlurPostProcess}),r.d(t,"PassPostProcess",function(){return L.PassPostProcess}),r.d(t,"PassCubePostProcess",function(){return L.PassCubePostProcess}),r.d(t,"PostProcess",function(){return L.PostProcess}),r.d(t,"PostProcessManager",function(){return L.PostProcessManager}),r.d(t,"RefractionPostProcess",function(){return L.RefractionPostProcess}),r.d(t,"SharpenPostProcess",function(){return L.SharpenPostProcess}),r.d(t,"StereoscopicInterlacePostProcess",function(){return L.StereoscopicInterlacePostProcess}),r.d(t,"TonemappingOperator",function(){return L.TonemappingOperator}),r.d(t,"TonemapPostProcess",function(){return L.TonemapPostProcess}),r.d(t,"VolumetricLightScatteringPostProcess",function(){return L.VolumetricLightScatteringPostProcess}),r.d(t,"VRDistortionCorrectionPostProcess",function(){return L.VRDistortionCorrectionPostProcess}),r.d(t,"VRMultiviewToSingleviewPostProcess",function(){return L.VRMultiviewToSingleviewPostProcess}),r.d(t,"PostProcessRenderEffect",function(){return L.PostProcessRenderEffect}),r.d(t,"PostProcessRenderPipeline",function(){return L.PostProcessRenderPipeline}),r.d(t,"PostProcessRenderPipelineManager",function(){return L.PostProcessRenderPipelineManager}),r.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return L.PostProcessRenderPipelineManagerSceneComponent}),r.d(t,"DefaultRenderingPipeline",function(){return L.DefaultRenderingPipeline}),r.d(t,"LensRenderingPipeline",function(){return L.LensRenderingPipeline}),r.d(t,"SSAO2RenderingPipeline",function(){return L.SSAO2RenderingPipeline}),r.d(t,"SSAORenderingPipeline",function(){return L.SSAORenderingPipeline}),r.d(t,"StandardRenderingPipeline",function(){return L.StandardRenderingPipeline});var w=r(/*! ./Probes/index */"./Probes/index.ts");r.d(t,"ReflectionProbe",function(){return w.ReflectionProbe});var B=r(/*! ./Rendering/index */"./Rendering/index.ts");r.d(t,"BoundingBoxRenderer",function(){return B.BoundingBoxRenderer}),r.d(t,"DepthRenderer",function(){return B.DepthRenderer}),r.d(t,"DepthRendererSceneComponent",function(){return B.DepthRendererSceneComponent}),r.d(t,"EdgesRenderer",function(){return B.EdgesRenderer}),r.d(t,"LineEdgesRenderer",function(){return B.LineEdgesRenderer}),r.d(t,"GeometryBufferRenderer",function(){return B.GeometryBufferRenderer}),r.d(t,"GeometryBufferRendererSceneComponent",function(){return B.GeometryBufferRendererSceneComponent}),r.d(t,"OutlineRenderer",function(){return B.OutlineRenderer}),r.d(t,"RenderingGroup",function(){return B.RenderingGroup}),r.d(t,"RenderingGroupInfo",function(){return B.RenderingGroupInfo}),r.d(t,"RenderingManager",function(){return B.RenderingManager}),r.d(t,"UtilityLayerRenderer",function(){return B.UtilityLayerRenderer});var N=r(/*! ./scene */"./scene.ts");r.d(t,"Scene",function(){return N.Scene});var F=r(/*! ./sceneComponent */"./sceneComponent.ts");r.d(t,"SceneComponentConstants",function(){return F.SceneComponentConstants}),r.d(t,"Stage",function(){return F.Stage});var V=r(/*! ./Sprites/index */"./Sprites/index.ts");r.d(t,"Sprite",function(){return V.Sprite}),r.d(t,"SpriteManager",function(){return V.SpriteManager}),r.d(t,"SpritePackedManager",function(){return V.SpritePackedManager}),r.d(t,"SpriteSceneComponent",function(){return V.SpriteSceneComponent});var k=r(/*! ./States/index */"./States/index.ts");r.d(t,"_AlphaState",function(){return k._AlphaState}),r.d(t,"_DepthCullingState",function(){return k._DepthCullingState}),r.d(t,"_StencilState",function(){return k._StencilState});var U=r(/*! ./Misc/index */"./Misc/index.ts");r.d(t,"AndOrNotEvaluator",function(){return U.AndOrNotEvaluator}),r.d(t,"AssetTaskState",function(){return U.AssetTaskState}),r.d(t,"AbstractAssetTask",function(){return U.AbstractAssetTask}),r.d(t,"AssetsProgressEvent",function(){return U.AssetsProgressEvent}),r.d(t,"MeshAssetTask",function(){return U.MeshAssetTask}),r.d(t,"TextFileAssetTask",function(){return U.TextFileAssetTask}),r.d(t,"BinaryFileAssetTask",function(){return U.BinaryFileAssetTask}),r.d(t,"ImageAssetTask",function(){return U.ImageAssetTask}),r.d(t,"TextureAssetTask",function(){return U.TextureAssetTask}),r.d(t,"CubeTextureAssetTask",function(){return U.CubeTextureAssetTask}),r.d(t,"HDRCubeTextureAssetTask",function(){return U.HDRCubeTextureAssetTask}),r.d(t,"EquiRectangularCubeTextureAssetTask",function(){return U.EquiRectangularCubeTextureAssetTask}),r.d(t,"AssetsManager",function(){return U.AssetsManager}),r.d(t,"DDSTools",function(){return U.DDSTools}),r.d(t,"expandToProperty",function(){return U.expandToProperty}),r.d(t,"serialize",function(){return U.serialize}),r.d(t,"serializeAsTexture",function(){return U.serializeAsTexture}),r.d(t,"serializeAsColor3",function(){return U.serializeAsColor3}),r.d(t,"serializeAsFresnelParameters",function(){return U.serializeAsFresnelParameters}),r.d(t,"serializeAsVector2",function(){return U.serializeAsVector2}),r.d(t,"serializeAsVector3",function(){return U.serializeAsVector3}),r.d(t,"serializeAsMeshReference",function(){return U.serializeAsMeshReference}),r.d(t,"serializeAsColorCurves",function(){return U.serializeAsColorCurves}),r.d(t,"serializeAsColor4",function(){return U.serializeAsColor4}),r.d(t,"serializeAsImageProcessingConfiguration",function(){return U.serializeAsImageProcessingConfiguration}),r.d(t,"serializeAsQuaternion",function(){return U.serializeAsQuaternion}),r.d(t,"serializeAsMatrix",function(){return U.serializeAsMatrix}),r.d(t,"serializeAsCameraReference",function(){return U.serializeAsCameraReference}),r.d(t,"SerializationHelper",function(){return U.SerializationHelper}),r.d(t,"Deferred",function(){return U.Deferred}),r.d(t,"EnvironmentTextureTools",function(){return U.EnvironmentTextureTools}),r.d(t,"MeshExploder",function(){return U.MeshExploder}),r.d(t,"FilesInput",function(){return U.FilesInput}),r.d(t,"CubeMapToSphericalPolynomialTools",function(){return U.CubeMapToSphericalPolynomialTools}),r.d(t,"KhronosTextureContainer",function(){return U.KhronosTextureContainer}),r.d(t,"EventState",function(){return U.EventState}),r.d(t,"Observer",function(){return U.Observer}),r.d(t,"MultiObserver",function(){return U.MultiObserver}),r.d(t,"Observable",function(){return U.Observable}),r.d(t,"PerformanceMonitor",function(){return U.PerformanceMonitor}),r.d(t,"RollingAverage",function(){return U.RollingAverage}),r.d(t,"PromisePolyfill",function(){return U.PromisePolyfill}),r.d(t,"SceneOptimization",function(){return U.SceneOptimization}),r.d(t,"TextureOptimization",function(){return U.TextureOptimization}),r.d(t,"HardwareScalingOptimization",function(){return U.HardwareScalingOptimization}),r.d(t,"ShadowsOptimization",function(){return U.ShadowsOptimization}),r.d(t,"PostProcessesOptimization",function(){return U.PostProcessesOptimization}),r.d(t,"LensFlaresOptimization",function(){return U.LensFlaresOptimization}),r.d(t,"CustomOptimization",function(){return U.CustomOptimization}),r.d(t,"ParticlesOptimization",function(){return U.ParticlesOptimization}),r.d(t,"RenderTargetsOptimization",function(){return U.RenderTargetsOptimization}),r.d(t,"MergeMeshesOptimization",function(){return U.MergeMeshesOptimization}),r.d(t,"SceneOptimizerOptions",function(){return U.SceneOptimizerOptions}),r.d(t,"SceneOptimizer",function(){return U.SceneOptimizer}),r.d(t,"SceneSerializer",function(){return U.SceneSerializer}),r.d(t,"SmartArray",function(){return U.SmartArray}),r.d(t,"SmartArrayNoDuplicate",function(){return U.SmartArrayNoDuplicate}),r.d(t,"StringDictionary",function(){return U.StringDictionary}),r.d(t,"Tags",function(){return U.Tags}),r.d(t,"TextureTools",function(){return U.TextureTools}),r.d(t,"TGATools",function(){return U.TGATools}),r.d(t,"Tools",function(){return U.Tools}),r.d(t,"className",function(){return U.className}),r.d(t,"AsyncLoop",function(){return U.AsyncLoop}),r.d(t,"VideoRecorder",function(){return U.VideoRecorder}),r.d(t,"JoystickAxis",function(){return U.JoystickAxis}),r.d(t,"VirtualJoystick",function(){return U.VirtualJoystick}),r.d(t,"WorkerPool",function(){return U.WorkerPool}),r.d(t,"Logger",function(){return U.Logger}),r.d(t,"_TypeStore",function(){return U._TypeStore}),r.d(t,"FilesInputStore",function(){return U.FilesInputStore}),r.d(t,"DeepCopier",function(){return U.DeepCopier}),r.d(t,"PivotTools",function(){return U.PivotTools}),r.d(t,"PrecisionDate",function(){return U.PrecisionDate}),r.d(t,"ScreenshotTools",function(){return U.ScreenshotTools}),r.d(t,"WebRequest",function(){return U.WebRequest}),r.d(t,"InspectableType",function(){return U.InspectableType}),r.d(t,"BRDFTextureTools",function(){return U.BRDFTextureTools}),r.d(t,"RGBDTextureTools",function(){return U.RGBDTextureTools}),r.d(t,"ColorGradient",function(){return U.ColorGradient}),r.d(t,"Color3Gradient",function(){return U.Color3Gradient}),r.d(t,"FactorGradient",function(){return U.FactorGradient}),r.d(t,"GradientHelper",function(){return U.GradientHelper}),r.d(t,"PerfCounter",function(){return U.PerfCounter}),r.d(t,"RetryStrategy",function(){return U.RetryStrategy}),r.d(t,"LoadFileError",function(){return U.LoadFileError}),r.d(t,"HDRTools",function(){return U.HDRTools}),r.d(t,"PanoramaToCubeMapTools",function(){return U.PanoramaToCubeMapTools})},"./node.ts": +/*! exports provided: AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./abstractScene */"./abstractScene.ts");r.d(t,"AbstractScene",function(){return n.AbstractScene});var i=r(/*! ./Actions/index */"./Actions/index.ts");r.d(t,"AbstractActionManager",function(){return i.AbstractActionManager}),r.d(t,"Action",function(){return i.Action}),r.d(t,"ActionEvent",function(){return i.ActionEvent}),r.d(t,"ActionManager",function(){return i.ActionManager}),r.d(t,"Condition",function(){return i.Condition}),r.d(t,"ValueCondition",function(){return i.ValueCondition}),r.d(t,"PredicateCondition",function(){return i.PredicateCondition}),r.d(t,"StateCondition",function(){return i.StateCondition}),r.d(t,"SwitchBooleanAction",function(){return i.SwitchBooleanAction}),r.d(t,"SetStateAction",function(){return i.SetStateAction}),r.d(t,"SetValueAction",function(){return i.SetValueAction}),r.d(t,"IncrementValueAction",function(){return i.IncrementValueAction}),r.d(t,"PlayAnimationAction",function(){return i.PlayAnimationAction}),r.d(t,"StopAnimationAction",function(){return i.StopAnimationAction}),r.d(t,"DoNothingAction",function(){return i.DoNothingAction}),r.d(t,"CombineAction",function(){return i.CombineAction}),r.d(t,"ExecuteCodeAction",function(){return i.ExecuteCodeAction}),r.d(t,"SetParentAction",function(){return i.SetParentAction}),r.d(t,"PlaySoundAction",function(){return i.PlaySoundAction}),r.d(t,"StopSoundAction",function(){return i.StopSoundAction}),r.d(t,"InterpolateValueAction",function(){return i.InterpolateValueAction});var o=r(/*! ./Animations/index */"./Animations/index.ts");r.d(t,"Animatable",function(){return o.Animatable}),r.d(t,"_IAnimationState",function(){return o._IAnimationState}),r.d(t,"Animation",function(){return o.Animation}),r.d(t,"TargetedAnimation",function(){return o.TargetedAnimation}),r.d(t,"AnimationGroup",function(){return o.AnimationGroup}),r.d(t,"AnimationPropertiesOverride",function(){return o.AnimationPropertiesOverride}),r.d(t,"EasingFunction",function(){return o.EasingFunction}),r.d(t,"CircleEase",function(){return o.CircleEase}),r.d(t,"BackEase",function(){return o.BackEase}),r.d(t,"BounceEase",function(){return o.BounceEase}),r.d(t,"CubicEase",function(){return o.CubicEase}),r.d(t,"ElasticEase",function(){return o.ElasticEase}),r.d(t,"ExponentialEase",function(){return o.ExponentialEase}),r.d(t,"PowerEase",function(){return o.PowerEase}),r.d(t,"QuadraticEase",function(){return o.QuadraticEase}),r.d(t,"QuarticEase",function(){return o.QuarticEase}),r.d(t,"QuinticEase",function(){return o.QuinticEase}),r.d(t,"SineEase",function(){return o.SineEase}),r.d(t,"BezierCurveEase",function(){return o.BezierCurveEase}),r.d(t,"RuntimeAnimation",function(){return o.RuntimeAnimation}),r.d(t,"AnimationEvent",function(){return o.AnimationEvent}),r.d(t,"AnimationKeyInterpolation",function(){return o.AnimationKeyInterpolation}),r.d(t,"AnimationRange",function(){return o.AnimationRange});var s=r(/*! ./assetContainer */"./assetContainer.ts");r.d(t,"KeepAssets",function(){return s.KeepAssets}),r.d(t,"AssetContainer",function(){return s.AssetContainer});var a=r(/*! ./Audio/index */"./Audio/index.ts");r.d(t,"Analyser",function(){return a.Analyser}),r.d(t,"AudioEngine",function(){return a.AudioEngine}),r.d(t,"AudioSceneComponent",function(){return a.AudioSceneComponent}),r.d(t,"Sound",function(){return a.Sound}),r.d(t,"SoundTrack",function(){return a.SoundTrack}),r.d(t,"WeightedSound",function(){return a.WeightedSound});var c=r(/*! ./Behaviors/index */"./Behaviors/index.ts");r.d(t,"AutoRotationBehavior",function(){return c.AutoRotationBehavior}),r.d(t,"BouncingBehavior",function(){return c.BouncingBehavior}),r.d(t,"FramingBehavior",function(){return c.FramingBehavior}),r.d(t,"PointerDragBehavior",function(){return c.PointerDragBehavior}),r.d(t,"AttachToBoxBehavior",function(){return c.AttachToBoxBehavior}),r.d(t,"FadeInOutBehavior",function(){return c.FadeInOutBehavior}),r.d(t,"MultiPointerScaleBehavior",function(){return c.MultiPointerScaleBehavior}),r.d(t,"SixDofDragBehavior",function(){return c.SixDofDragBehavior});var l=r(/*! ./Bones/index */"./Bones/index.ts");r.d(t,"Bone",function(){return l.Bone}),r.d(t,"BoneIKController",function(){return l.BoneIKController}),r.d(t,"BoneLookController",function(){return l.BoneLookController}),r.d(t,"Skeleton",function(){return l.Skeleton});var u=r(/*! ./Cameras/index */"./Cameras/index.ts");r.d(t,"CameraInputTypes",function(){return u.CameraInputTypes}),r.d(t,"CameraInputsManager",function(){return u.CameraInputsManager}),r.d(t,"Camera",function(){return u.Camera}),r.d(t,"TargetCamera",function(){return u.TargetCamera}),r.d(t,"FreeCamera",function(){return u.FreeCamera}),r.d(t,"FreeCameraInputsManager",function(){return u.FreeCameraInputsManager}),r.d(t,"TouchCamera",function(){return u.TouchCamera}),r.d(t,"ArcRotateCamera",function(){return u.ArcRotateCamera}),r.d(t,"ArcRotateCameraInputsManager",function(){return u.ArcRotateCameraInputsManager}),r.d(t,"DeviceOrientationCamera",function(){return u.DeviceOrientationCamera}),r.d(t,"FlyCamera",function(){return u.FlyCamera}),r.d(t,"FlyCameraInputsManager",function(){return u.FlyCameraInputsManager}),r.d(t,"FollowCamera",function(){return u.FollowCamera}),r.d(t,"ArcFollowCamera",function(){return u.ArcFollowCamera}),r.d(t,"FollowCameraInputsManager",function(){return u.FollowCameraInputsManager}),r.d(t,"GamepadCamera",function(){return u.GamepadCamera}),r.d(t,"UniversalCamera",function(){return u.UniversalCamera}),r.d(t,"VirtualJoysticksCamera",function(){return u.VirtualJoysticksCamera}),r.d(t,"ArcRotateCameraGamepadInput",function(){return u.ArcRotateCameraGamepadInput}),r.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return u.ArcRotateCameraKeyboardMoveInput}),r.d(t,"ArcRotateCameraMouseWheelInput",function(){return u.ArcRotateCameraMouseWheelInput}),r.d(t,"ArcRotateCameraPointersInput",function(){return u.ArcRotateCameraPointersInput}),r.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return u.ArcRotateCameraVRDeviceOrientationInput}),r.d(t,"FlyCameraKeyboardInput",function(){return u.FlyCameraKeyboardInput}),r.d(t,"FlyCameraMouseInput",function(){return u.FlyCameraMouseInput}),r.d(t,"FollowCameraKeyboardMoveInput",function(){return u.FollowCameraKeyboardMoveInput}),r.d(t,"FollowCameraMouseWheelInput",function(){return u.FollowCameraMouseWheelInput}),r.d(t,"FollowCameraPointersInput",function(){return u.FollowCameraPointersInput}),r.d(t,"FreeCameraDeviceOrientationInput",function(){return u.FreeCameraDeviceOrientationInput}),r.d(t,"FreeCameraGamepadInput",function(){return u.FreeCameraGamepadInput}),r.d(t,"FreeCameraKeyboardMoveInput",function(){return u.FreeCameraKeyboardMoveInput}),r.d(t,"FreeCameraMouseInput",function(){return u.FreeCameraMouseInput}),r.d(t,"FreeCameraTouchInput",function(){return u.FreeCameraTouchInput}),r.d(t,"FreeCameraVirtualJoystickInput",function(){return u.FreeCameraVirtualJoystickInput}),r.d(t,"AnaglyphArcRotateCamera",function(){return u.AnaglyphArcRotateCamera}),r.d(t,"AnaglyphFreeCamera",function(){return u.AnaglyphFreeCamera}),r.d(t,"AnaglyphGamepadCamera",function(){return u.AnaglyphGamepadCamera}),r.d(t,"AnaglyphUniversalCamera",function(){return u.AnaglyphUniversalCamera}),r.d(t,"StereoscopicArcRotateCamera",function(){return u.StereoscopicArcRotateCamera}),r.d(t,"StereoscopicFreeCamera",function(){return u.StereoscopicFreeCamera}),r.d(t,"StereoscopicGamepadCamera",function(){return u.StereoscopicGamepadCamera}),r.d(t,"StereoscopicUniversalCamera",function(){return u.StereoscopicUniversalCamera}),r.d(t,"VRCameraMetrics",function(){return u.VRCameraMetrics}),r.d(t,"VRDeviceOrientationArcRotateCamera",function(){return u.VRDeviceOrientationArcRotateCamera}),r.d(t,"VRDeviceOrientationFreeCamera",function(){return u.VRDeviceOrientationFreeCamera}),r.d(t,"VRDeviceOrientationGamepadCamera",function(){return u.VRDeviceOrientationGamepadCamera}),r.d(t,"OnAfterEnteringVRObservableEvent",function(){return u.OnAfterEnteringVRObservableEvent}),r.d(t,"VRExperienceHelper",function(){return u.VRExperienceHelper}),r.d(t,"WebVRFreeCamera",function(){return u.WebVRFreeCamera}),r.d(t,"WebXRCamera",function(){return u.WebXRCamera}),r.d(t,"WebXREnterExitUIButton",function(){return u.WebXREnterExitUIButton}),r.d(t,"WebXREnterExitUIOptions",function(){return u.WebXREnterExitUIOptions}),r.d(t,"WebXREnterExitUI",function(){return u.WebXREnterExitUI}),r.d(t,"WebXRState",function(){return u.WebXRState}),r.d(t,"WebXRExperienceHelper",function(){return u.WebXRExperienceHelper}),r.d(t,"WebXRInput",function(){return u.WebXRInput}),r.d(t,"WebXRControllerTeleportation",function(){return u.WebXRControllerTeleportation}),r.d(t,"WebXRControllerPointerSelection",function(){return u.WebXRControllerPointerSelection}),r.d(t,"WebXRControllerModelLoader",function(){return u.WebXRControllerModelLoader}),r.d(t,"WebXRController",function(){return u.WebXRController}),r.d(t,"WebXRManagedOutputCanvas",function(){return u.WebXRManagedOutputCanvas}),r.d(t,"WebXRSessionManager",function(){return u.WebXRSessionManager});var h=r(/*! ./Collisions/index */"./Collisions/index.ts");r.d(t,"Collider",function(){return h.Collider}),r.d(t,"DefaultCollisionCoordinator",function(){return h.DefaultCollisionCoordinator}),r.d(t,"PickingInfo",function(){return h.PickingInfo}),r.d(t,"IntersectionInfo",function(){return h.IntersectionInfo}),r.d(t,"_MeshCollisionData",function(){return h._MeshCollisionData});var d=r(/*! ./Culling/index */"./Culling/index.ts");r.d(t,"BoundingBox",function(){return d.BoundingBox}),r.d(t,"BoundingInfo",function(){return d.BoundingInfo}),r.d(t,"BoundingSphere",function(){return d.BoundingSphere}),r.d(t,"Ray",function(){return d.Ray}),r.d(t,"Octree",function(){return d.Octree}),r.d(t,"OctreeBlock",function(){return d.OctreeBlock}),r.d(t,"OctreeSceneComponent",function(){return d.OctreeSceneComponent});var f=r(/*! ./Debug/index */"./Debug/index.ts");r.d(t,"AxesViewer",function(){return f.AxesViewer}),r.d(t,"BoneAxesViewer",function(){return f.BoneAxesViewer}),r.d(t,"DebugLayer",function(){return f.DebugLayer}),r.d(t,"PhysicsViewer",function(){return f.PhysicsViewer}),r.d(t,"RayHelper",function(){return f.RayHelper}),r.d(t,"SkeletonViewer",function(){return f.SkeletonViewer});var p=r(/*! ./Engines/index */"./Engines/index.ts");r.d(t,"Constants",function(){return p.Constants}),r.d(t,"InstancingAttributeInfo",function(){return p.InstancingAttributeInfo}),r.d(t,"DepthTextureCreationOptions",function(){return p.DepthTextureCreationOptions}),r.d(t,"EngineCapabilities",function(){return p.EngineCapabilities}),r.d(t,"Engine",function(){return p.Engine}),r.d(t,"EngineStore",function(){return p.EngineStore}),r.d(t,"NullEngineOptions",function(){return p.NullEngineOptions}),r.d(t,"NullEngine",function(){return p.NullEngine}),r.d(t,"WebGLPipelineContext",function(){return p.WebGLPipelineContext}),r.d(t,"WebGL2ShaderProcessor",function(){return p.WebGL2ShaderProcessor}),r.d(t,"NativeEngine",function(){return p.NativeEngine}),r.d(t,"_OcclusionDataStorage",function(){return p._OcclusionDataStorage}),r.d(t,"_forceTransformFeedbackToBundle",function(){return p._forceTransformFeedbackToBundle});var m=r(/*! ./Events/index */"./Events/index.ts");r.d(t,"KeyboardEventTypes",function(){return m.KeyboardEventTypes}),r.d(t,"KeyboardInfo",function(){return m.KeyboardInfo}),r.d(t,"KeyboardInfoPre",function(){return m.KeyboardInfoPre}),r.d(t,"PointerEventTypes",function(){return m.PointerEventTypes}),r.d(t,"PointerInfoBase",function(){return m.PointerInfoBase}),r.d(t,"PointerInfoPre",function(){return m.PointerInfoPre}),r.d(t,"PointerInfo",function(){return m.PointerInfo}),r.d(t,"ClipboardEventTypes",function(){return m.ClipboardEventTypes}),r.d(t,"ClipboardInfo",function(){return m.ClipboardInfo});var g=r(/*! ./Gamepads/index */"./Gamepads/index.ts");r.d(t,"DaydreamController",function(){return g.DaydreamController}),r.d(t,"GearVRController",function(){return g.GearVRController}),r.d(t,"GenericController",function(){return g.GenericController}),r.d(t,"OculusTouchController",function(){return g.OculusTouchController}),r.d(t,"PoseEnabledControllerType",function(){return g.PoseEnabledControllerType}),r.d(t,"PoseEnabledControllerHelper",function(){return g.PoseEnabledControllerHelper}),r.d(t,"PoseEnabledController",function(){return g.PoseEnabledController}),r.d(t,"ViveController",function(){return g.ViveController}),r.d(t,"WebVRController",function(){return g.WebVRController}),r.d(t,"WindowsMotionController",function(){return g.WindowsMotionController}),r.d(t,"StickValues",function(){return g.StickValues}),r.d(t,"Gamepad",function(){return g.Gamepad}),r.d(t,"GenericPad",function(){return g.GenericPad}),r.d(t,"GamepadManager",function(){return g.GamepadManager}),r.d(t,"GamepadSystemSceneComponent",function(){return g.GamepadSystemSceneComponent}),r.d(t,"Xbox360Button",function(){return g.Xbox360Button}),r.d(t,"Xbox360Dpad",function(){return g.Xbox360Dpad}),r.d(t,"Xbox360Pad",function(){return g.Xbox360Pad}),r.d(t,"DualShockButton",function(){return g.DualShockButton}),r.d(t,"DualShockDpad",function(){return g.DualShockDpad}),r.d(t,"DualShockPad",function(){return g.DualShockPad});var _=r(/*! ./Gizmos/index */"./Gizmos/index.ts");r.d(t,"AxisDragGizmo",function(){return _.AxisDragGizmo}),r.d(t,"AxisScaleGizmo",function(){return _.AxisScaleGizmo}),r.d(t,"BoundingBoxGizmo",function(){return _.BoundingBoxGizmo}),r.d(t,"Gizmo",function(){return _.Gizmo}),r.d(t,"GizmoManager",function(){return _.GizmoManager}),r.d(t,"PlaneRotationGizmo",function(){return _.PlaneRotationGizmo}),r.d(t,"PositionGizmo",function(){return _.PositionGizmo}),r.d(t,"RotationGizmo",function(){return _.RotationGizmo}),r.d(t,"ScaleGizmo",function(){return _.ScaleGizmo}),r.d(t,"LightGizmo",function(){return _.LightGizmo}),r.d(t,"PlaneDragGizmo",function(){return _.PlaneDragGizmo});var v=r(/*! ./Helpers/index */"./Helpers/index.ts");r.d(t,"EnvironmentHelper",function(){return v.EnvironmentHelper}),r.d(t,"PhotoDome",function(){return v.PhotoDome}),r.d(t,"_forceSceneHelpersToBundle",function(){return v._forceSceneHelpersToBundle}),r.d(t,"VideoDome",function(){return v.VideoDome});var A=r(/*! ./Instrumentation/index */"./Instrumentation/index.ts");r.d(t,"EngineInstrumentation",function(){return A.EngineInstrumentation}),r.d(t,"SceneInstrumentation",function(){return A.SceneInstrumentation}),r.d(t,"_TimeToken",function(){return A._TimeToken});var y=r(/*! ./Layers/index */"./Layers/index.ts");r.d(t,"EffectLayer",function(){return y.EffectLayer}),r.d(t,"EffectLayerSceneComponent",function(){return y.EffectLayerSceneComponent}),r.d(t,"GlowLayer",function(){return y.GlowLayer}),r.d(t,"HighlightLayer",function(){return y.HighlightLayer}),r.d(t,"Layer",function(){return y.Layer}),r.d(t,"LayerSceneComponent",function(){return y.LayerSceneComponent});var b=r(/*! ./LensFlares/index */"./LensFlares/index.ts");r.d(t,"LensFlare",function(){return b.LensFlare}),r.d(t,"LensFlareSystem",function(){return b.LensFlareSystem}),r.d(t,"LensFlareSystemSceneComponent",function(){return b.LensFlareSystemSceneComponent});var T=r(/*! ./Lights/index */"./Lights/index.ts");r.d(t,"Light",function(){return T.Light}),r.d(t,"ShadowLight",function(){return T.ShadowLight}),r.d(t,"DirectionalLight",function(){return T.DirectionalLight}),r.d(t,"HemisphericLight",function(){return T.HemisphericLight}),r.d(t,"PointLight",function(){return T.PointLight}),r.d(t,"SpotLight",function(){return T.SpotLight}),r.d(t,"ShadowGenerator",function(){return T.ShadowGenerator}),r.d(t,"ShadowGeneratorSceneComponent",function(){return T.ShadowGeneratorSceneComponent});var E=r(/*! ./Loading/index */"./Loading/index.ts");r.d(t,"DefaultLoadingScreen",function(){return E.DefaultLoadingScreen}),r.d(t,"SceneLoaderProgressEvent",function(){return E.SceneLoaderProgressEvent}),r.d(t,"SceneLoader",function(){return E.SceneLoader}),r.d(t,"SceneLoaderFlags",function(){return E.SceneLoaderFlags}),r.d(t,"_BabylonLoaderRegistered",function(){return E._BabylonLoaderRegistered});var M=r(/*! ./Materials/index */"./Materials/index.ts");r.d(t,"ColorCurves",function(){return M.ColorCurves}),r.d(t,"EffectFallbacks",function(){return M.EffectFallbacks}),r.d(t,"EffectCreationOptions",function(){return M.EffectCreationOptions}),r.d(t,"Effect",function(){return M.Effect}),r.d(t,"FresnelParameters",function(){return M.FresnelParameters}),r.d(t,"ImageProcessingConfigurationDefines",function(){return M.ImageProcessingConfigurationDefines}),r.d(t,"ImageProcessingConfiguration",function(){return M.ImageProcessingConfiguration}),r.d(t,"Material",function(){return M.Material}),r.d(t,"MaterialDefines",function(){return M.MaterialDefines}),r.d(t,"MaterialHelper",function(){return M.MaterialHelper}),r.d(t,"MultiMaterial",function(){return M.MultiMaterial}),r.d(t,"PushMaterial",function(){return M.PushMaterial}),r.d(t,"ShaderMaterial",function(){return M.ShaderMaterial}),r.d(t,"StandardMaterialDefines",function(){return M.StandardMaterialDefines}),r.d(t,"StandardMaterial",function(){return M.StandardMaterial}),r.d(t,"BaseTexture",function(){return M.BaseTexture}),r.d(t,"CubeTexture",function(){return M.CubeTexture}),r.d(t,"DynamicTexture",function(){return M.DynamicTexture}),r.d(t,"EquiRectangularCubeTexture",function(){return M.EquiRectangularCubeTexture}),r.d(t,"HDRCubeTexture",function(){return M.HDRCubeTexture}),r.d(t,"InternalTexture",function(){return M.InternalTexture}),r.d(t,"MirrorTexture",function(){return M.MirrorTexture}),r.d(t,"MultiRenderTarget",function(){return M.MultiRenderTarget}),r.d(t,"RawTexture",function(){return M.RawTexture}),r.d(t,"RenderTargetTexture",function(){return M.RenderTargetTexture}),r.d(t,"Texture",function(){return M.Texture}),r.d(t,"UniformBuffer",function(){return M.UniformBuffer}),r.d(t,"MaterialFlags",function(){return M.MaterialFlags}),r.d(t,"EffectRenderer",function(){return M.EffectRenderer}),r.d(t,"EffectWrapper",function(){return M.EffectWrapper}),r.d(t,"BackgroundMaterial",function(){return M.BackgroundMaterial}),r.d(t,"PBRMaterialDefines",function(){return M.PBRMaterialDefines}),r.d(t,"PBRBaseMaterial",function(){return M.PBRBaseMaterial}),r.d(t,"PBRBaseSimpleMaterial",function(){return M.PBRBaseSimpleMaterial}),r.d(t,"PBRMaterial",function(){return M.PBRMaterial}),r.d(t,"PBRMetallicRoughnessMaterial",function(){return M.PBRMetallicRoughnessMaterial}),r.d(t,"PBRSpecularGlossinessMaterial",function(){return M.PBRSpecularGlossinessMaterial}),r.d(t,"ColorGradingTexture",function(){return M.ColorGradingTexture}),r.d(t,"RawCubeTexture",function(){return M.RawCubeTexture}),r.d(t,"RawTexture3D",function(){return M.RawTexture3D}),r.d(t,"RefractionTexture",function(){return M.RefractionTexture}),r.d(t,"VideoTexture",function(){return M.VideoTexture}),r.d(t,"HtmlElementTexture",function(){return M.HtmlElementTexture}),r.d(t,"NodeMaterialBlockTargets",function(){return M.NodeMaterialBlockTargets}),r.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return M.NodeMaterialBlockConnectionPointTypes}),r.d(t,"NodeMaterialConnectionPoint",function(){return M.NodeMaterialConnectionPoint}),r.d(t,"NodeMaterialBlock",function(){return M.NodeMaterialBlock}),r.d(t,"NodeMaterialDefines",function(){return M.NodeMaterialDefines}),r.d(t,"NodeMaterial",function(){return M.NodeMaterial}),r.d(t,"NodeMaterialSystemValues",function(){return M.NodeMaterialSystemValues}),r.d(t,"_DDSTextureLoader",function(){return M._DDSTextureLoader}),r.d(t,"_ENVTextureLoader",function(){return M._ENVTextureLoader}),r.d(t,"_KTXTextureLoader",function(){return M._KTXTextureLoader}),r.d(t,"_TGATextureLoader",function(){return M._TGATextureLoader}),r.d(t,"_BasisTextureLoader",function(){return M._BasisTextureLoader}),r.d(t,"CustomProceduralTexture",function(){return M.CustomProceduralTexture}),r.d(t,"NoiseProceduralTexture",function(){return M.NoiseProceduralTexture}),r.d(t,"ProceduralTexture",function(){return M.ProceduralTexture}),r.d(t,"ProceduralTextureSceneComponent",function(){return M.ProceduralTextureSceneComponent}),r.d(t,"MultiplyBlock",function(){return M.MultiplyBlock}),r.d(t,"AddBlock",function(){return M.AddBlock}),r.d(t,"ScaleBlock",function(){return M.ScaleBlock}),r.d(t,"ClampBlock",function(){return M.ClampBlock}),r.d(t,"CrossBlock",function(){return M.CrossBlock}),r.d(t,"DotBlock",function(){return M.DotBlock}),r.d(t,"TransformBlock",function(){return M.TransformBlock}),r.d(t,"RemapBlock",function(){return M.RemapBlock}),r.d(t,"NormalizeBlock",function(){return M.NormalizeBlock}),r.d(t,"TrigonometryBlockOperations",function(){return M.TrigonometryBlockOperations}),r.d(t,"TrigonometryBlock",function(){return M.TrigonometryBlock}),r.d(t,"ColorMergerBlock",function(){return M.ColorMergerBlock}),r.d(t,"VectorMergerBlock",function(){return M.VectorMergerBlock}),r.d(t,"ColorSplitterBlock",function(){return M.ColorSplitterBlock}),r.d(t,"VectorSplitterBlock",function(){return M.VectorSplitterBlock}),r.d(t,"LerpBlock",function(){return M.LerpBlock}),r.d(t,"DivideBlock",function(){return M.DivideBlock}),r.d(t,"SubtractBlock",function(){return M.SubtractBlock}),r.d(t,"StepBlock",function(){return M.StepBlock}),r.d(t,"OppositeBlock",function(){return M.OppositeBlock}),r.d(t,"ViewDirectionBlock",function(){return M.ViewDirectionBlock}),r.d(t,"FresnelBlock",function(){return M.FresnelBlock}),r.d(t,"MaxBlock",function(){return M.MaxBlock}),r.d(t,"MinBlock",function(){return M.MinBlock}),r.d(t,"NodeMaterialOptimizer",function(){return M.NodeMaterialOptimizer}),r.d(t,"VertexOutputBlock",function(){return M.VertexOutputBlock}),r.d(t,"BonesBlock",function(){return M.BonesBlock}),r.d(t,"InstancesBlock",function(){return M.InstancesBlock}),r.d(t,"MorphTargetsBlock",function(){return M.MorphTargetsBlock}),r.d(t,"LightInformationBlock",function(){return M.LightInformationBlock}),r.d(t,"FragmentOutputBlock",function(){return M.FragmentOutputBlock}),r.d(t,"AlphaTestBlock",function(){return M.AlphaTestBlock}),r.d(t,"ImageProcessingBlock",function(){return M.ImageProcessingBlock}),r.d(t,"PerturbNormalBlock",function(){return M.PerturbNormalBlock}),r.d(t,"FogBlock",function(){return M.FogBlock}),r.d(t,"LightBlock",function(){return M.LightBlock}),r.d(t,"TextureBlock",function(){return M.TextureBlock}),r.d(t,"ReflectionTextureBlock",function(){return M.ReflectionTextureBlock}),r.d(t,"InputBlock",function(){return M.InputBlock}),r.d(t,"AnimatedInputBlockTypes",function(){return M.AnimatedInputBlockTypes});var P=r(/*! ./Maths/index */"./Maths/index.ts");r.d(t,"Scalar",function(){return P.Scalar}),r.d(t,"Space",function(){return P.Space}),r.d(t,"Axis",function(){return P.Axis}),r.d(t,"Color3",function(){return P.Color3}),r.d(t,"Color4",function(){return P.Color4}),r.d(t,"TmpColors",function(){return P.TmpColors}),r.d(t,"ToGammaSpace",function(){return P.ToGammaSpace}),r.d(t,"ToLinearSpace",function(){return P.ToLinearSpace}),r.d(t,"Epsilon",function(){return P.Epsilon}),r.d(t,"Frustum",function(){return P.Frustum}),r.d(t,"Plane",function(){return P.Plane}),r.d(t,"Size",function(){return P.Size}),r.d(t,"Vector2",function(){return P.Vector2}),r.d(t,"Vector3",function(){return P.Vector3}),r.d(t,"Vector4",function(){return P.Vector4}),r.d(t,"Quaternion",function(){return P.Quaternion}),r.d(t,"Matrix",function(){return P.Matrix}),r.d(t,"TmpVectors",function(){return P.TmpVectors}),r.d(t,"Viewport",function(){return P.Viewport}),r.d(t,"SphericalHarmonics",function(){return P.SphericalHarmonics}),r.d(t,"SphericalPolynomial",function(){return P.SphericalPolynomial}),r.d(t,"Orientation",function(){return P.Orientation}),r.d(t,"BezierCurve",function(){return P.BezierCurve}),r.d(t,"Angle",function(){return P.Angle}),r.d(t,"Arc2",function(){return P.Arc2}),r.d(t,"Path2",function(){return P.Path2}),r.d(t,"Path3D",function(){return P.Path3D}),r.d(t,"Curve3",function(){return P.Curve3}),r.d(t,"PositionNormalVertex",function(){return P.PositionNormalVertex}),r.d(t,"PositionNormalTextureVertex",function(){return P.PositionNormalTextureVertex});var x=r(/*! ./Meshes/index */"./Meshes/index.ts");r.d(t,"AbstractMesh",function(){return x.AbstractMesh}),r.d(t,"Buffer",function(){return x.Buffer}),r.d(t,"VertexBuffer",function(){return x.VertexBuffer}),r.d(t,"CSG",function(){return x.CSG}),r.d(t,"Geometry",function(){return x.Geometry}),r.d(t,"GroundMesh",function(){return x.GroundMesh}),r.d(t,"TrailMesh",function(){return x.TrailMesh}),r.d(t,"InstancedMesh",function(){return x.InstancedMesh}),r.d(t,"LinesMesh",function(){return x.LinesMesh}),r.d(t,"InstancedLinesMesh",function(){return x.InstancedLinesMesh}),r.d(t,"_CreationDataStorage",function(){return x._CreationDataStorage}),r.d(t,"_InstancesBatch",function(){return x._InstancesBatch}),r.d(t,"Mesh",function(){return x.Mesh}),r.d(t,"VertexData",function(){return x.VertexData}),r.d(t,"MeshBuilder",function(){return x.MeshBuilder}),r.d(t,"SimplificationSettings",function(){return x.SimplificationSettings}),r.d(t,"SimplificationQueue",function(){return x.SimplificationQueue}),r.d(t,"SimplificationType",function(){return x.SimplificationType}),r.d(t,"SimplicationQueueSceneComponent",function(){return x.SimplicationQueueSceneComponent}),r.d(t,"Polygon",function(){return x.Polygon}),r.d(t,"PolygonMeshBuilder",function(){return x.PolygonMeshBuilder}),r.d(t,"BaseSubMesh",function(){return x.BaseSubMesh}),r.d(t,"SubMesh",function(){return x.SubMesh}),r.d(t,"MeshLODLevel",function(){return x.MeshLODLevel}),r.d(t,"TransformNode",function(){return x.TransformNode}),r.d(t,"BoxBuilder",function(){return x.BoxBuilder}),r.d(t,"SphereBuilder",function(){return x.SphereBuilder}),r.d(t,"CylinderBuilder",function(){return x.CylinderBuilder}),r.d(t,"TorusBuilder",function(){return x.TorusBuilder}),r.d(t,"LinesBuilder",function(){return x.LinesBuilder}),r.d(t,"PlaneBuilder",function(){return x.PlaneBuilder}),r.d(t,"GroundBuilder",function(){return x.GroundBuilder}),r.d(t,"DataBuffer",function(){return x.DataBuffer}),r.d(t,"WebGLDataBuffer",function(){return x.WebGLDataBuffer}),r.d(t,"DracoCompression",function(){return x.DracoCompression}),r.d(t,"TiledBoxBuilder",function(){return x.TiledBoxBuilder}),r.d(t,"DiscBuilder",function(){return x.DiscBuilder}),r.d(t,"RibbonBuilder",function(){return x.RibbonBuilder}),r.d(t,"HemisphereBuilder",function(){return x.HemisphereBuilder}),r.d(t,"TorusKnotBuilder",function(){return x.TorusKnotBuilder}),r.d(t,"PolygonBuilder",function(){return x.PolygonBuilder}),r.d(t,"ShapeBuilder",function(){return x.ShapeBuilder}),r.d(t,"LatheBuilder",function(){return x.LatheBuilder}),r.d(t,"TiledPlaneBuilder",function(){return x.TiledPlaneBuilder}),r.d(t,"TubeBuilder",function(){return x.TubeBuilder}),r.d(t,"PolyhedronBuilder",function(){return x.PolyhedronBuilder}),r.d(t,"IcoSphereBuilder",function(){return x.IcoSphereBuilder}),r.d(t,"DecalBuilder",function(){return x.DecalBuilder});var S=r(/*! ./Morph/index */"./Morph/index.ts");r.d(t,"MorphTarget",function(){return S.MorphTarget}),r.d(t,"MorphTargetManager",function(){return S.MorphTargetManager});var C=r(/*! ./Navigation/index */"./Navigation/index.ts");r.d(t,"RecastJSPlugin",function(){return C.RecastJSPlugin}),r.d(t,"RecastJSCrowd",function(){return C.RecastJSCrowd});var R=r(/*! ./node */"./node.ts");r.d(t,"Node",function(){return R.Node});var O=r(/*! ./Offline/index */"./Offline/index.ts");r.d(t,"Database",function(){return O.Database});var D=r(/*! ./Particles/index */"./Particles/index.ts");r.d(t,"BaseParticleSystem",function(){return D.BaseParticleSystem}),r.d(t,"GPUParticleSystem",function(){return D.GPUParticleSystem}),r.d(t,"Particle",function(){return D.Particle}),r.d(t,"ParticleHelper",function(){return D.ParticleHelper}),r.d(t,"ParticleSystem",function(){return D.ParticleSystem}),r.d(t,"_IDoNeedToBeInTheBuild",function(){return D._IDoNeedToBeInTheBuild}),r.d(t,"ParticleSystemSet",function(){return D.ParticleSystemSet}),r.d(t,"SolidParticle",function(){return D.SolidParticle}),r.d(t,"ModelShape",function(){return D.ModelShape}),r.d(t,"DepthSortedParticle",function(){return D.DepthSortedParticle}),r.d(t,"SolidParticleSystem",function(){return D.SolidParticleSystem}),r.d(t,"SubEmitterType",function(){return D.SubEmitterType}),r.d(t,"SubEmitter",function(){return D.SubEmitter}),r.d(t,"BoxParticleEmitter",function(){return D.BoxParticleEmitter}),r.d(t,"ConeParticleEmitter",function(){return D.ConeParticleEmitter}),r.d(t,"CylinderParticleEmitter",function(){return D.CylinderParticleEmitter}),r.d(t,"CylinderDirectedParticleEmitter",function(){return D.CylinderDirectedParticleEmitter}),r.d(t,"HemisphericParticleEmitter",function(){return D.HemisphericParticleEmitter}),r.d(t,"PointParticleEmitter",function(){return D.PointParticleEmitter}),r.d(t,"SphereParticleEmitter",function(){return D.SphereParticleEmitter}),r.d(t,"SphereDirectedParticleEmitter",function(){return D.SphereDirectedParticleEmitter});var I=r(/*! ./Physics/index */"./Physics/index.ts");r.d(t,"PhysicsEngine",function(){return I.PhysicsEngine}),r.d(t,"PhysicsEngineSceneComponent",function(){return I.PhysicsEngineSceneComponent}),r.d(t,"PhysicsHelper",function(){return I.PhysicsHelper}),r.d(t,"PhysicsRadialExplosionEventOptions",function(){return I.PhysicsRadialExplosionEventOptions}),r.d(t,"PhysicsUpdraftEventOptions",function(){return I.PhysicsUpdraftEventOptions}),r.d(t,"PhysicsVortexEventOptions",function(){return I.PhysicsVortexEventOptions}),r.d(t,"PhysicsRadialImpulseFalloff",function(){return I.PhysicsRadialImpulseFalloff}),r.d(t,"PhysicsUpdraftMode",function(){return I.PhysicsUpdraftMode}),r.d(t,"PhysicsImpostor",function(){return I.PhysicsImpostor}),r.d(t,"PhysicsJoint",function(){return I.PhysicsJoint}),r.d(t,"DistanceJoint",function(){return I.DistanceJoint}),r.d(t,"MotorEnabledJoint",function(){return I.MotorEnabledJoint}),r.d(t,"HingeJoint",function(){return I.HingeJoint}),r.d(t,"Hinge2Joint",function(){return I.Hinge2Joint}),r.d(t,"CannonJSPlugin",function(){return I.CannonJSPlugin}),r.d(t,"AmmoJSPlugin",function(){return I.AmmoJSPlugin}),r.d(t,"OimoJSPlugin",function(){return I.OimoJSPlugin});var L=r(/*! ./PostProcesses/index */"./PostProcesses/index.ts");r.d(t,"AnaglyphPostProcess",function(){return L.AnaglyphPostProcess}),r.d(t,"BlackAndWhitePostProcess",function(){return L.BlackAndWhitePostProcess}),r.d(t,"BloomEffect",function(){return L.BloomEffect}),r.d(t,"BloomMergePostProcess",function(){return L.BloomMergePostProcess}),r.d(t,"BlurPostProcess",function(){return L.BlurPostProcess}),r.d(t,"ChromaticAberrationPostProcess",function(){return L.ChromaticAberrationPostProcess}),r.d(t,"CircleOfConfusionPostProcess",function(){return L.CircleOfConfusionPostProcess}),r.d(t,"ColorCorrectionPostProcess",function(){return L.ColorCorrectionPostProcess}),r.d(t,"ConvolutionPostProcess",function(){return L.ConvolutionPostProcess}),r.d(t,"DepthOfFieldBlurPostProcess",function(){return L.DepthOfFieldBlurPostProcess}),r.d(t,"DepthOfFieldEffectBlurLevel",function(){return L.DepthOfFieldEffectBlurLevel}),r.d(t,"DepthOfFieldEffect",function(){return L.DepthOfFieldEffect}),r.d(t,"DepthOfFieldMergePostProcessOptions",function(){return L.DepthOfFieldMergePostProcessOptions}),r.d(t,"DepthOfFieldMergePostProcess",function(){return L.DepthOfFieldMergePostProcess}),r.d(t,"DisplayPassPostProcess",function(){return L.DisplayPassPostProcess}),r.d(t,"ExtractHighlightsPostProcess",function(){return L.ExtractHighlightsPostProcess}),r.d(t,"FilterPostProcess",function(){return L.FilterPostProcess}),r.d(t,"FxaaPostProcess",function(){return L.FxaaPostProcess}),r.d(t,"GrainPostProcess",function(){return L.GrainPostProcess}),r.d(t,"HighlightsPostProcess",function(){return L.HighlightsPostProcess}),r.d(t,"ImageProcessingPostProcess",function(){return L.ImageProcessingPostProcess}),r.d(t,"MotionBlurPostProcess",function(){return L.MotionBlurPostProcess}),r.d(t,"PassPostProcess",function(){return L.PassPostProcess}),r.d(t,"PassCubePostProcess",function(){return L.PassCubePostProcess}),r.d(t,"PostProcess",function(){return L.PostProcess}),r.d(t,"PostProcessManager",function(){return L.PostProcessManager}),r.d(t,"RefractionPostProcess",function(){return L.RefractionPostProcess}),r.d(t,"SharpenPostProcess",function(){return L.SharpenPostProcess}),r.d(t,"StereoscopicInterlacePostProcess",function(){return L.StereoscopicInterlacePostProcess}),r.d(t,"TonemappingOperator",function(){return L.TonemappingOperator}),r.d(t,"TonemapPostProcess",function(){return L.TonemapPostProcess}),r.d(t,"VolumetricLightScatteringPostProcess",function(){return L.VolumetricLightScatteringPostProcess}),r.d(t,"VRDistortionCorrectionPostProcess",function(){return L.VRDistortionCorrectionPostProcess}),r.d(t,"VRMultiviewToSingleviewPostProcess",function(){return L.VRMultiviewToSingleviewPostProcess}),r.d(t,"PostProcessRenderEffect",function(){return L.PostProcessRenderEffect}),r.d(t,"PostProcessRenderPipeline",function(){return L.PostProcessRenderPipeline}),r.d(t,"PostProcessRenderPipelineManager",function(){return L.PostProcessRenderPipelineManager}),r.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return L.PostProcessRenderPipelineManagerSceneComponent}),r.d(t,"DefaultRenderingPipeline",function(){return L.DefaultRenderingPipeline}),r.d(t,"LensRenderingPipeline",function(){return L.LensRenderingPipeline}),r.d(t,"SSAO2RenderingPipeline",function(){return L.SSAO2RenderingPipeline}),r.d(t,"SSAORenderingPipeline",function(){return L.SSAORenderingPipeline}),r.d(t,"StandardRenderingPipeline",function(){return L.StandardRenderingPipeline});var w=r(/*! ./Probes/index */"./Probes/index.ts");r.d(t,"ReflectionProbe",function(){return w.ReflectionProbe});var B=r(/*! ./Rendering/index */"./Rendering/index.ts");r.d(t,"BoundingBoxRenderer",function(){return B.BoundingBoxRenderer}),r.d(t,"DepthRenderer",function(){return B.DepthRenderer}),r.d(t,"DepthRendererSceneComponent",function(){return B.DepthRendererSceneComponent}),r.d(t,"EdgesRenderer",function(){return B.EdgesRenderer}),r.d(t,"LineEdgesRenderer",function(){return B.LineEdgesRenderer}),r.d(t,"GeometryBufferRenderer",function(){return B.GeometryBufferRenderer}),r.d(t,"GeometryBufferRendererSceneComponent",function(){return B.GeometryBufferRendererSceneComponent}),r.d(t,"OutlineRenderer",function(){return B.OutlineRenderer}),r.d(t,"RenderingGroup",function(){return B.RenderingGroup}),r.d(t,"RenderingGroupInfo",function(){return B.RenderingGroupInfo}),r.d(t,"RenderingManager",function(){return B.RenderingManager}),r.d(t,"UtilityLayerRenderer",function(){return B.UtilityLayerRenderer});var N=r(/*! ./scene */"./scene.ts");r.d(t,"Scene",function(){return N.Scene});var F=r(/*! ./sceneComponent */"./sceneComponent.ts");r.d(t,"SceneComponentConstants",function(){return F.SceneComponentConstants}),r.d(t,"Stage",function(){return F.Stage});var V=r(/*! ./Sprites/index */"./Sprites/index.ts");r.d(t,"Sprite",function(){return V.Sprite}),r.d(t,"SpriteManager",function(){return V.SpriteManager}),r.d(t,"SpritePackedManager",function(){return V.SpritePackedManager}),r.d(t,"SpriteSceneComponent",function(){return V.SpriteSceneComponent});var k=r(/*! ./States/index */"./States/index.ts");r.d(t,"_AlphaState",function(){return k._AlphaState}),r.d(t,"_DepthCullingState",function(){return k._DepthCullingState}),r.d(t,"_StencilState",function(){return k._StencilState});var U=r(/*! ./Misc/index */"./Misc/index.ts");r.d(t,"AndOrNotEvaluator",function(){return U.AndOrNotEvaluator}),r.d(t,"AssetTaskState",function(){return U.AssetTaskState}),r.d(t,"AbstractAssetTask",function(){return U.AbstractAssetTask}),r.d(t,"AssetsProgressEvent",function(){return U.AssetsProgressEvent}),r.d(t,"MeshAssetTask",function(){return U.MeshAssetTask}),r.d(t,"TextFileAssetTask",function(){return U.TextFileAssetTask}),r.d(t,"BinaryFileAssetTask",function(){return U.BinaryFileAssetTask}),r.d(t,"ImageAssetTask",function(){return U.ImageAssetTask}),r.d(t,"TextureAssetTask",function(){return U.TextureAssetTask}),r.d(t,"CubeTextureAssetTask",function(){return U.CubeTextureAssetTask}),r.d(t,"HDRCubeTextureAssetTask",function(){return U.HDRCubeTextureAssetTask}),r.d(t,"EquiRectangularCubeTextureAssetTask",function(){return U.EquiRectangularCubeTextureAssetTask}),r.d(t,"AssetsManager",function(){return U.AssetsManager}),r.d(t,"DDSTools",function(){return U.DDSTools}),r.d(t,"expandToProperty",function(){return U.expandToProperty}),r.d(t,"serialize",function(){return U.serialize}),r.d(t,"serializeAsTexture",function(){return U.serializeAsTexture}),r.d(t,"serializeAsColor3",function(){return U.serializeAsColor3}),r.d(t,"serializeAsFresnelParameters",function(){return U.serializeAsFresnelParameters}),r.d(t,"serializeAsVector2",function(){return U.serializeAsVector2}),r.d(t,"serializeAsVector3",function(){return U.serializeAsVector3}),r.d(t,"serializeAsMeshReference",function(){return U.serializeAsMeshReference}),r.d(t,"serializeAsColorCurves",function(){return U.serializeAsColorCurves}),r.d(t,"serializeAsColor4",function(){return U.serializeAsColor4}),r.d(t,"serializeAsImageProcessingConfiguration",function(){return U.serializeAsImageProcessingConfiguration}),r.d(t,"serializeAsQuaternion",function(){return U.serializeAsQuaternion}),r.d(t,"serializeAsMatrix",function(){return U.serializeAsMatrix}),r.d(t,"serializeAsCameraReference",function(){return U.serializeAsCameraReference}),r.d(t,"SerializationHelper",function(){return U.SerializationHelper}),r.d(t,"Deferred",function(){return U.Deferred}),r.d(t,"EnvironmentTextureTools",function(){return U.EnvironmentTextureTools}),r.d(t,"MeshExploder",function(){return U.MeshExploder}),r.d(t,"FilesInput",function(){return U.FilesInput}),r.d(t,"CubeMapToSphericalPolynomialTools",function(){return U.CubeMapToSphericalPolynomialTools}),r.d(t,"KhronosTextureContainer",function(){return U.KhronosTextureContainer}),r.d(t,"EventState",function(){return U.EventState}),r.d(t,"Observer",function(){return U.Observer}),r.d(t,"MultiObserver",function(){return U.MultiObserver}),r.d(t,"Observable",function(){return U.Observable}),r.d(t,"PerformanceMonitor",function(){return U.PerformanceMonitor}),r.d(t,"RollingAverage",function(){return U.RollingAverage}),r.d(t,"PromisePolyfill",function(){return U.PromisePolyfill}),r.d(t,"SceneOptimization",function(){return U.SceneOptimization}),r.d(t,"TextureOptimization",function(){return U.TextureOptimization}),r.d(t,"HardwareScalingOptimization",function(){return U.HardwareScalingOptimization}),r.d(t,"ShadowsOptimization",function(){return U.ShadowsOptimization}),r.d(t,"PostProcessesOptimization",function(){return U.PostProcessesOptimization}),r.d(t,"LensFlaresOptimization",function(){return U.LensFlaresOptimization}),r.d(t,"CustomOptimization",function(){return U.CustomOptimization}),r.d(t,"ParticlesOptimization",function(){return U.ParticlesOptimization}),r.d(t,"RenderTargetsOptimization",function(){return U.RenderTargetsOptimization}),r.d(t,"MergeMeshesOptimization",function(){return U.MergeMeshesOptimization}),r.d(t,"SceneOptimizerOptions",function(){return U.SceneOptimizerOptions}),r.d(t,"SceneOptimizer",function(){return U.SceneOptimizer}),r.d(t,"SceneSerializer",function(){return U.SceneSerializer}),r.d(t,"SmartArray",function(){return U.SmartArray}),r.d(t,"SmartArrayNoDuplicate",function(){return U.SmartArrayNoDuplicate}),r.d(t,"StringDictionary",function(){return U.StringDictionary}),r.d(t,"Tags",function(){return U.Tags}),r.d(t,"TextureTools",function(){return U.TextureTools}),r.d(t,"TGATools",function(){return U.TGATools}),r.d(t,"Tools",function(){return U.Tools}),r.d(t,"className",function(){return U.className}),r.d(t,"AsyncLoop",function(){return U.AsyncLoop}),r.d(t,"VideoRecorder",function(){return U.VideoRecorder}),r.d(t,"JoystickAxis",function(){return U.JoystickAxis}),r.d(t,"VirtualJoystick",function(){return U.VirtualJoystick}),r.d(t,"WorkerPool",function(){return U.WorkerPool}),r.d(t,"Logger",function(){return U.Logger}),r.d(t,"_TypeStore",function(){return U._TypeStore}),r.d(t,"FilesInputStore",function(){return U.FilesInputStore}),r.d(t,"DeepCopier",function(){return U.DeepCopier}),r.d(t,"PivotTools",function(){return U.PivotTools}),r.d(t,"PrecisionDate",function(){return U.PrecisionDate}),r.d(t,"ScreenshotTools",function(){return U.ScreenshotTools}),r.d(t,"WebRequest",function(){return U.WebRequest}),r.d(t,"InspectableType",function(){return U.InspectableType}),r.d(t,"BRDFTextureTools",function(){return U.BRDFTextureTools}),r.d(t,"RGBDTextureTools",function(){return U.RGBDTextureTools}),r.d(t,"ColorGradient",function(){return U.ColorGradient}),r.d(t,"Color3Gradient",function(){return U.Color3Gradient}),r.d(t,"FactorGradient",function(){return U.FactorGradient}),r.d(t,"GradientHelper",function(){return U.GradientHelper}),r.d(t,"PerfCounter",function(){return U.PerfCounter}),r.d(t,"RetryStrategy",function(){return U.RetryStrategy}),r.d(t,"LoadFileError",function(){return U.LoadFileError}),r.d(t,"HDRTools",function(){return U.HDRTools}),r.d(t,"PanoramaToCubeMapTools",function(){return U.PanoramaToCubeMapTools})},"./node.ts": /*!*****************!*\ !*** ./node.ts ***! \*****************/ diff --git a/dist/preview release/viewer/babylon.viewer.max.js b/dist/preview release/viewer/babylon.viewer.max.js index 92796ed4821..c4c6a36796f 100644 --- a/dist/preview release/viewer/babylon.viewer.max.js +++ b/dist/preview release/viewer/babylon.viewer.max.js @@ -112,7 +112,7 @@ var BabylonViewer = /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(global) {(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse {}\n})((typeof self !== \"undefined\" ? self : typeof global !== \"undefined\" ? global : this), function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./Legacy/legacy.ts\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"../node_modules/tslib/tslib.es6.js\":\n/*!******************************************!*\\\n !*** ../node_modules/tslib/tslib.es6.js ***!\n \\******************************************/\n/*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__extends\", function() { return __extends; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__assign\", function() { return __assign; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__rest\", function() { return __rest; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__decorate\", function() { return __decorate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__param\", function() { return __param; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__metadata\", function() { return __metadata; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__awaiter\", function() { return __awaiter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__generator\", function() { return __generator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__exportStar\", function() { return __exportStar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__values\", function() { return __values; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__read\", function() { return __read; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__spread\", function() { return __spread; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__await\", function() { return __await; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncGenerator\", function() { return __asyncGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncDelegator\", function() { return __asyncDelegator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncValues\", function() { return __asyncValues; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__makeTemplateObject\", function() { return __makeTemplateObject; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__importStar\", function() { return __importStar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__importDefault\", function() { return __importDefault; });\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nfunction __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nfunction __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nfunction __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nfunction __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nfunction __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nfunction __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nfunction __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nfunction __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nfunction __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n/***/ }),\n\n/***/ \"../node_modules/webpack/buildin/global.js\":\n/*!*************************************************!*\\\n !*** ../node_modules/webpack/buildin/global.js ***!\n \\*************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n/***/ }),\n\n/***/ \"./Actions/abstractActionManager.ts\":\n/*!******************************************!*\\\n !*** ./Actions/abstractActionManager.ts ***!\n \\******************************************/\n/*! exports provided: AbstractActionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return AbstractActionManager; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n/**\r\n * Abstract class used to decouple action Manager from scene and meshes.\r\n * Do not instantiate.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar AbstractActionManager = /** @class */ (function () {\r\n function AbstractActionManager() {\r\n /** Gets the cursor to use when hovering items */\r\n this.hoverCursor = '';\r\n /** Gets the list of actions */\r\n this.actions = new Array();\r\n /**\r\n * Gets or sets a boolean indicating that the manager is recursive meaning that it can trigger action from children\r\n */\r\n this.isRecursive = false;\r\n }\r\n Object.defineProperty(AbstractActionManager, \"HasTriggers\", {\r\n /**\r\n * Does exist one action manager with at least one trigger\r\n **/\r\n get: function () {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractActionManager, \"HasPickTriggers\", {\r\n /**\r\n * Does exist one action manager with at least one pick trigger\r\n **/\r\n get: function () {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n var t_int = parseInt(t);\r\n if (t_int >= _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].ACTION_OnPickTrigger && t_int <= _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].ACTION_OnPickUpTrigger) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Does exist one action manager that handles actions of a given trigger\r\n * @param trigger defines the trigger to be tested\r\n * @return a boolean indicating whether the trigger is handeled by at least one action manager\r\n **/\r\n AbstractActionManager.HasSpecificTrigger = function (trigger) {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n var t_int = parseInt(t);\r\n if (t_int === trigger) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** Gets the list of active triggers */\r\n AbstractActionManager.Triggers = {};\r\n return AbstractActionManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/action.ts\":\n/*!***************************!*\\\n !*** ./Actions/action.ts ***!\n \\***************************/\n/*! exports provided: Action */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return Action; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The action to be carried out following a trigger\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#available-actions\r\n */\r\nvar Action = /** @class */ (function () {\r\n /**\r\n * Creates a new Action\r\n * @param triggerOptions the trigger, with or without parameters, for the action\r\n * @param condition an optional determinant of action\r\n */\r\n function Action(\r\n /** the trigger, with or without parameters, for the action */\r\n triggerOptions, condition) {\r\n this.triggerOptions = triggerOptions;\r\n /**\r\n * An event triggered prior to action being executed.\r\n */\r\n this.onBeforeExecuteObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n if (triggerOptions.parameter) {\r\n this.trigger = triggerOptions.trigger;\r\n this._triggerParameter = triggerOptions.parameter;\r\n }\r\n else if (triggerOptions.trigger) {\r\n this.trigger = triggerOptions.trigger;\r\n }\r\n else {\r\n this.trigger = triggerOptions;\r\n }\r\n this._nextActiveAction = this;\r\n this._condition = condition;\r\n }\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action.prototype._prepare = function () {\r\n };\r\n /**\r\n * Gets the trigger parameters\r\n * @returns the trigger parameters\r\n */\r\n Action.prototype.getTriggerParameter = function () {\r\n return this._triggerParameter;\r\n };\r\n /**\r\n * Internal only - executes current action event\r\n * @hidden\r\n */\r\n Action.prototype._executeCurrent = function (evt) {\r\n if (this._nextActiveAction._condition) {\r\n var condition = this._nextActiveAction._condition;\r\n var currentRenderId = this._actionManager.getScene().getRenderId();\r\n // We cache the current evaluation for the current frame\r\n if (condition._evaluationId === currentRenderId) {\r\n if (!condition._currentResult) {\r\n return;\r\n }\r\n }\r\n else {\r\n condition._evaluationId = currentRenderId;\r\n if (!condition.isValid()) {\r\n condition._currentResult = false;\r\n return;\r\n }\r\n condition._currentResult = true;\r\n }\r\n }\r\n this.onBeforeExecuteObservable.notifyObservers(this);\r\n this._nextActiveAction.execute(evt);\r\n this.skipToNextActiveAction();\r\n };\r\n /**\r\n * Execute placeholder for child classes\r\n * @param evt optional action event\r\n */\r\n Action.prototype.execute = function (evt) {\r\n };\r\n /**\r\n * Skips to next active action\r\n */\r\n Action.prototype.skipToNextActiveAction = function () {\r\n if (this._nextActiveAction._child) {\r\n if (!this._nextActiveAction._child._actionManager) {\r\n this._nextActiveAction._child._actionManager = this._actionManager;\r\n }\r\n this._nextActiveAction = this._nextActiveAction._child;\r\n }\r\n else {\r\n this._nextActiveAction = this;\r\n }\r\n };\r\n /**\r\n * Adds action to chain of actions, may be a DoNothingAction\r\n * @param action defines the next action to execute\r\n * @returns The action passed in\r\n * @see https://www.babylonjs-playground.com/#1T30HR#0\r\n */\r\n Action.prototype.then = function (action) {\r\n this._child = action;\r\n action._actionManager = this._actionManager;\r\n action._prepare();\r\n return action;\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action.prototype._getProperty = function (propertyPath) {\r\n return this._actionManager._getProperty(propertyPath);\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action.prototype._getEffectiveTarget = function (target, propertyPath) {\r\n return this._actionManager._getEffectiveTarget(target, propertyPath);\r\n };\r\n /**\r\n * Serialize placeholder for child classes\r\n * @param parent of child\r\n * @returns the serialized object\r\n */\r\n Action.prototype.serialize = function (parent) {\r\n };\r\n /**\r\n * Internal only called by serialize\r\n * @hidden\r\n */\r\n Action.prototype._serialize = function (serializedAction, parent) {\r\n var serializationObject = {\r\n type: 1,\r\n children: [],\r\n name: serializedAction.name,\r\n properties: serializedAction.properties || []\r\n };\r\n // Serialize child\r\n if (this._child) {\r\n this._child.serialize(serializationObject);\r\n }\r\n // Check if \"this\" has a condition\r\n if (this._condition) {\r\n var serializedCondition = this._condition.serialize();\r\n serializedCondition.children.push(serializationObject);\r\n if (parent) {\r\n parent.children.push(serializedCondition);\r\n }\r\n return serializedCondition;\r\n }\r\n if (parent) {\r\n parent.children.push(serializationObject);\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action._SerializeValueAsString = function (value) {\r\n if (typeof value === \"number\") {\r\n return value.toString();\r\n }\r\n if (typeof value === \"boolean\") {\r\n return value ? \"true\" : \"false\";\r\n }\r\n if (value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"]) {\r\n return value.x + \", \" + value.y;\r\n }\r\n if (value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]) {\r\n return value.x + \", \" + value.y + \", \" + value.z;\r\n }\r\n if (value instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"]) {\r\n return value.r + \", \" + value.g + \", \" + value.b;\r\n }\r\n if (value instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"]) {\r\n return value.r + \", \" + value.g + \", \" + value.b + \", \" + value.a;\r\n }\r\n return value; // string\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action._GetTargetProperty = function (target) {\r\n return {\r\n name: \"target\",\r\n targetType: target._isMesh ? \"MeshProperties\"\r\n : target._isLight ? \"LightProperties\"\r\n : target._isCamera ? \"CameraProperties\"\r\n : \"SceneProperties\",\r\n value: target._isScene ? \"Scene\" : target.name\r\n };\r\n };\r\n return Action;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Action\"] = Action;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/actionEvent.ts\":\n/*!********************************!*\\\n !*** ./Actions/actionEvent.ts ***!\n \\********************************/\n/*! exports provided: ActionEvent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return ActionEvent; });\n/**\r\n * ActionEvent is the event being sent when an action is triggered.\r\n */\r\nvar ActionEvent = /** @class */ (function () {\r\n /**\r\n * Creates a new ActionEvent\r\n * @param source The mesh or sprite that triggered the action\r\n * @param pointerX The X mouse cursor position at the time of the event\r\n * @param pointerY The Y mouse cursor position at the time of the event\r\n * @param meshUnderPointer The mesh that is currently pointed at (can be null)\r\n * @param sourceEvent the original (browser) event that triggered the ActionEvent\r\n * @param additionalData additional data for the event\r\n */\r\n function ActionEvent(\r\n /** The mesh or sprite that triggered the action */\r\n source, \r\n /** The X mouse cursor position at the time of the event */\r\n pointerX, \r\n /** The Y mouse cursor position at the time of the event */\r\n pointerY, \r\n /** The mesh that is currently pointed at (can be null) */\r\n meshUnderPointer, \r\n /** the original (browser) event that triggered the ActionEvent */\r\n sourceEvent, \r\n /** additional data for the event */\r\n additionalData) {\r\n this.source = source;\r\n this.pointerX = pointerX;\r\n this.pointerY = pointerY;\r\n this.meshUnderPointer = meshUnderPointer;\r\n this.sourceEvent = sourceEvent;\r\n this.additionalData = additionalData;\r\n }\r\n /**\r\n * Helper function to auto-create an ActionEvent from a source mesh.\r\n * @param source The source mesh that triggered the event\r\n * @param evt The original (browser) event\r\n * @param additionalData additional data for the event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNew = function (source, evt, additionalData) {\r\n var scene = source.getScene();\r\n return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer || source, evt, additionalData);\r\n };\r\n /**\r\n * Helper function to auto-create an ActionEvent from a source sprite\r\n * @param source The source sprite that triggered the event\r\n * @param scene Scene associated with the sprite\r\n * @param evt The original (browser) event\r\n * @param additionalData additional data for the event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNewFromSprite = function (source, scene, evt, additionalData) {\r\n return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);\r\n };\r\n /**\r\n * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew\r\n * @param scene the scene where the event occurred\r\n * @param evt The original (browser) event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNewFromScene = function (scene, evt) {\r\n return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);\r\n };\r\n /**\r\n * Helper function to auto-create an ActionEvent from a primitive\r\n * @param prim defines the target primitive\r\n * @param pointerPos defines the pointer position\r\n * @param evt The original (browser) event\r\n * @param additionalData additional data for the event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNewFromPrimitive = function (prim, pointerPos, evt, additionalData) {\r\n return new ActionEvent(prim, pointerPos.x, pointerPos.y, null, evt, additionalData);\r\n };\r\n return ActionEvent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/actionManager.ts\":\n/*!**********************************!*\\\n !*** ./Actions/actionManager.ts ***!\n \\**********************************/\n/*! exports provided: ActionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return ActionManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _condition__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./condition */ \"./Actions/condition.ts\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _directActions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./directActions */ \"./Actions/directActions.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _abstractActionManager__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./abstractActionManager */ \"./Actions/abstractActionManager.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Action Manager manages all events to be triggered on a given mesh or the global scene.\r\n * A single scene can have many Action Managers to handle predefined actions on specific meshes.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar ActionManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ActionManager, _super);\r\n /**\r\n * Creates a new action manager\r\n * @param scene defines the hosting scene\r\n */\r\n function ActionManager(scene) {\r\n var _this = _super.call(this) || this;\r\n _this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n scene.actionManagers.push(_this);\r\n return _this;\r\n }\r\n // Methods\r\n /**\r\n * Releases all associated resources\r\n */\r\n ActionManager.prototype.dispose = function () {\r\n var index = this._scene.actionManagers.indexOf(this);\r\n for (var i = 0; i < this.actions.length; i++) {\r\n var action = this.actions[i];\r\n ActionManager.Triggers[action.trigger]--;\r\n if (ActionManager.Triggers[action.trigger] === 0) {\r\n delete ActionManager.Triggers[action.trigger];\r\n }\r\n }\r\n if (index > -1) {\r\n this._scene.actionManagers.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Gets hosting scene\r\n * @returns the hosting scene\r\n */\r\n ActionManager.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Does this action manager handles actions of any of the given triggers\r\n * @param triggers defines the triggers to be tested\r\n * @return a boolean indicating whether one (or more) of the triggers is handled\r\n */\r\n ActionManager.prototype.hasSpecificTriggers = function (triggers) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (triggers.indexOf(action.trigger) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Does this action manager handles actions of any of the given triggers. This function takes two arguments for\r\n * speed.\r\n * @param triggerA defines the trigger to be tested\r\n * @param triggerB defines the trigger to be tested\r\n * @return a boolean indicating whether one (or more) of the triggers is handled\r\n */\r\n ActionManager.prototype.hasSpecificTriggers2 = function (triggerA, triggerB) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (triggerA == action.trigger || triggerB == action.trigger) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Does this action manager handles actions of a given trigger\r\n * @param trigger defines the trigger to be tested\r\n * @param parameterPredicate defines an optional predicate to filter triggers by parameter\r\n * @return whether the trigger is handled\r\n */\r\n ActionManager.prototype.hasSpecificTrigger = function (trigger, parameterPredicate) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger === trigger) {\r\n if (parameterPredicate) {\r\n if (parameterPredicate(action.getTriggerParameter())) {\r\n return true;\r\n }\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(ActionManager.prototype, \"hasPointerTriggers\", {\r\n /**\r\n * Does this action manager has pointer triggers\r\n */\r\n get: function () {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger >= ActionManager.OnPickTrigger && action.trigger <= ActionManager.OnPointerOutTrigger) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ActionManager.prototype, \"hasPickTriggers\", {\r\n /**\r\n * Does this action manager has pick triggers\r\n */\r\n get: function () {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger >= ActionManager.OnPickTrigger && action.trigger <= ActionManager.OnPickUpTrigger) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers an action to this action manager\r\n * @param action defines the action to be registered\r\n * @return the action amended (prepared) after registration\r\n */\r\n ActionManager.prototype.registerAction = function (action) {\r\n if (action.trigger === ActionManager.OnEveryFrameTrigger) {\r\n if (this.getScene().actionManager !== this) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_7__[\"Logger\"].Warn(\"OnEveryFrameTrigger can only be used with scene.actionManager\");\r\n return null;\r\n }\r\n }\r\n this.actions.push(action);\r\n if (ActionManager.Triggers[action.trigger]) {\r\n ActionManager.Triggers[action.trigger]++;\r\n }\r\n else {\r\n ActionManager.Triggers[action.trigger] = 1;\r\n }\r\n action._actionManager = this;\r\n action._prepare();\r\n return action;\r\n };\r\n /**\r\n * Unregisters an action to this action manager\r\n * @param action defines the action to be unregistered\r\n * @return a boolean indicating whether the action has been unregistered\r\n */\r\n ActionManager.prototype.unregisterAction = function (action) {\r\n var index = this.actions.indexOf(action);\r\n if (index !== -1) {\r\n this.actions.splice(index, 1);\r\n ActionManager.Triggers[action.trigger] -= 1;\r\n if (ActionManager.Triggers[action.trigger] === 0) {\r\n delete ActionManager.Triggers[action.trigger];\r\n }\r\n delete action._actionManager;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Process a specific trigger\r\n * @param trigger defines the trigger to process\r\n * @param evt defines the event details to be processed\r\n */\r\n ActionManager.prototype.processTrigger = function (trigger, evt) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger === trigger) {\r\n if (evt) {\r\n if (trigger === ActionManager.OnKeyUpTrigger\r\n || trigger === ActionManager.OnKeyDownTrigger) {\r\n var parameter = action.getTriggerParameter();\r\n if (parameter && parameter !== evt.sourceEvent.keyCode) {\r\n if (!parameter.toLowerCase) {\r\n continue;\r\n }\r\n var lowerCase = parameter.toLowerCase();\r\n if (lowerCase !== evt.sourceEvent.key) {\r\n var unicode = evt.sourceEvent.charCode ? evt.sourceEvent.charCode : evt.sourceEvent.keyCode;\r\n var actualkey = String.fromCharCode(unicode).toLowerCase();\r\n if (actualkey !== lowerCase) {\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n action._executeCurrent(evt);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n ActionManager.prototype._getEffectiveTarget = function (target, propertyPath) {\r\n var properties = propertyPath.split(\".\");\r\n for (var index = 0; index < properties.length - 1; index++) {\r\n target = target[properties[index]];\r\n }\r\n return target;\r\n };\r\n /** @hidden */\r\n ActionManager.prototype._getProperty = function (propertyPath) {\r\n var properties = propertyPath.split(\".\");\r\n return properties[properties.length - 1];\r\n };\r\n /**\r\n * Serialize this manager to a JSON object\r\n * @param name defines the property name to store this manager\r\n * @returns a JSON representation of this manager\r\n */\r\n ActionManager.prototype.serialize = function (name) {\r\n var root = {\r\n children: new Array(),\r\n name: name,\r\n type: 3,\r\n properties: new Array() // Empty for root but required\r\n };\r\n for (var i = 0; i < this.actions.length; i++) {\r\n var triggerObject = {\r\n type: 0,\r\n children: new Array(),\r\n name: ActionManager.GetTriggerName(this.actions[i].trigger),\r\n properties: new Array()\r\n };\r\n var triggerOptions = this.actions[i].triggerOptions;\r\n if (triggerOptions && typeof triggerOptions !== \"number\") {\r\n if (triggerOptions.parameter instanceof Node) {\r\n triggerObject.properties.push(_action__WEBPACK_IMPORTED_MODULE_4__[\"Action\"]._GetTargetProperty(triggerOptions.parameter));\r\n }\r\n else {\r\n var parameter = {};\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_8__[\"DeepCopier\"].DeepCopy(triggerOptions.parameter, parameter, [\"mesh\"]);\r\n if (triggerOptions.parameter && triggerOptions.parameter.mesh) {\r\n parameter._meshId = triggerOptions.parameter.mesh.id;\r\n }\r\n triggerObject.properties.push({ name: \"parameter\", targetType: null, value: parameter });\r\n }\r\n }\r\n // Serialize child action, recursively\r\n this.actions[i].serialize(triggerObject);\r\n // Add serialized trigger\r\n root.children.push(triggerObject);\r\n }\r\n return root;\r\n };\r\n /**\r\n * Creates a new ActionManager from a JSON data\r\n * @param parsedActions defines the JSON data to read from\r\n * @param object defines the hosting mesh\r\n * @param scene defines the hosting scene\r\n */\r\n ActionManager.Parse = function (parsedActions, object, scene) {\r\n var actionManager = new ActionManager(scene);\r\n if (object === null) {\r\n scene.actionManager = actionManager;\r\n }\r\n else {\r\n object.actionManager = actionManager;\r\n }\r\n // instanciate a new object\r\n var instanciate = function (name, params) {\r\n var internalClassType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_9__[\"_TypeStore\"].GetClass(\"BABYLON.\" + name);\r\n if (internalClassType) {\r\n var newInstance = Object.create(internalClassType.prototype);\r\n newInstance.constructor.apply(newInstance, params);\r\n return newInstance;\r\n }\r\n };\r\n var parseParameter = function (name, value, target, propertyPath) {\r\n if (propertyPath === null) {\r\n // String, boolean or float\r\n var floatValue = parseFloat(value);\r\n if (value === \"true\" || value === \"false\") {\r\n return value === \"true\";\r\n }\r\n else {\r\n return isNaN(floatValue) ? value : floatValue;\r\n }\r\n }\r\n var effectiveTarget = propertyPath.split(\".\");\r\n var values = value.split(\",\");\r\n // Get effective Target\r\n for (var i = 0; i < effectiveTarget.length; i++) {\r\n target = target[effectiveTarget[i]];\r\n }\r\n // Return appropriate value with its type\r\n if (typeof (target) === \"boolean\") {\r\n return values[0] === \"true\";\r\n }\r\n if (typeof (target) === \"string\") {\r\n return values[0];\r\n }\r\n // Parameters with multiple values such as Vector3 etc.\r\n var split = new Array();\r\n for (var i = 0; i < values.length; i++) {\r\n split.push(parseFloat(values[i]));\r\n }\r\n if (target instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(split);\r\n }\r\n if (target instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"]) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"].FromArray(split);\r\n }\r\n if (target instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"]) {\r\n return _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].FromArray(split);\r\n }\r\n if (target instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"]) {\r\n return _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"].FromArray(split);\r\n }\r\n return parseFloat(values[0]);\r\n };\r\n // traverse graph per trigger\r\n var traverse = function (parsedAction, trigger, condition, action, combineArray) {\r\n if (combineArray === void 0) { combineArray = null; }\r\n if (parsedAction.detached) {\r\n return;\r\n }\r\n var parameters = new Array();\r\n var target = null;\r\n var propertyPath = null;\r\n var combine = parsedAction.combine && parsedAction.combine.length > 0;\r\n // Parameters\r\n if (parsedAction.type === 2) {\r\n parameters.push(actionManager);\r\n }\r\n else {\r\n parameters.push(trigger);\r\n }\r\n if (combine) {\r\n var actions = new Array();\r\n for (var j = 0; j < parsedAction.combine.length; j++) {\r\n traverse(parsedAction.combine[j], ActionManager.NothingTrigger, condition, action, actions);\r\n }\r\n parameters.push(actions);\r\n }\r\n else {\r\n for (var i = 0; i < parsedAction.properties.length; i++) {\r\n var value = parsedAction.properties[i].value;\r\n var name = parsedAction.properties[i].name;\r\n var targetType = parsedAction.properties[i].targetType;\r\n if (name === \"target\") {\r\n if (targetType !== null && targetType === \"SceneProperties\") {\r\n value = target = scene;\r\n }\r\n else {\r\n value = target = scene.getNodeByName(value);\r\n }\r\n }\r\n else if (name === \"parent\") {\r\n value = scene.getNodeByName(value);\r\n }\r\n else if (name === \"sound\") {\r\n // Can not externalize to component, so only checks for the presence off the API.\r\n if (scene.getSoundByName) {\r\n value = scene.getSoundByName(value);\r\n }\r\n }\r\n else if (name !== \"propertyPath\") {\r\n if (parsedAction.type === 2 && name === \"operator\") {\r\n value = _condition__WEBPACK_IMPORTED_MODULE_3__[\"ValueCondition\"][value];\r\n }\r\n else {\r\n value = parseParameter(name, value, target, name === \"value\" ? propertyPath : null);\r\n }\r\n }\r\n else {\r\n propertyPath = value;\r\n }\r\n parameters.push(value);\r\n }\r\n }\r\n if (combineArray === null) {\r\n parameters.push(condition);\r\n }\r\n else {\r\n parameters.push(null);\r\n }\r\n // If interpolate value action\r\n if (parsedAction.name === \"InterpolateValueAction\") {\r\n var param = parameters[parameters.length - 2];\r\n parameters[parameters.length - 1] = param;\r\n parameters[parameters.length - 2] = condition;\r\n }\r\n // Action or condition(s) and not CombineAction\r\n var newAction = instanciate(parsedAction.name, parameters);\r\n if (newAction instanceof _condition__WEBPACK_IMPORTED_MODULE_3__[\"Condition\"] && condition !== null) {\r\n var nothing = new _directActions__WEBPACK_IMPORTED_MODULE_5__[\"DoNothingAction\"](trigger, condition);\r\n if (action) {\r\n action.then(nothing);\r\n }\r\n else {\r\n actionManager.registerAction(nothing);\r\n }\r\n action = nothing;\r\n }\r\n if (combineArray === null) {\r\n if (newAction instanceof _condition__WEBPACK_IMPORTED_MODULE_3__[\"Condition\"]) {\r\n condition = newAction;\r\n newAction = action;\r\n }\r\n else {\r\n condition = null;\r\n if (action) {\r\n action.then(newAction);\r\n }\r\n else {\r\n actionManager.registerAction(newAction);\r\n }\r\n }\r\n }\r\n else {\r\n combineArray.push(newAction);\r\n }\r\n for (var i = 0; i < parsedAction.children.length; i++) {\r\n traverse(parsedAction.children[i], trigger, condition, newAction, null);\r\n }\r\n };\r\n // triggers\r\n for (var i = 0; i < parsedActions.children.length; i++) {\r\n var triggerParams;\r\n var trigger = parsedActions.children[i];\r\n if (trigger.properties.length > 0) {\r\n var param = trigger.properties[0].value;\r\n var value = trigger.properties[0].targetType === null ? param : scene.getMeshByName(param);\r\n if (value._meshId) {\r\n value.mesh = scene.getMeshByID(value._meshId);\r\n }\r\n triggerParams = { trigger: ActionManager[trigger.name], parameter: value };\r\n }\r\n else {\r\n triggerParams = ActionManager[trigger.name];\r\n }\r\n for (var j = 0; j < trigger.children.length; j++) {\r\n if (!trigger.detached) {\r\n traverse(trigger.children[j], triggerParams, null, null);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Get a trigger name by index\r\n * @param trigger defines the trigger index\r\n * @returns a trigger name\r\n */\r\n ActionManager.GetTriggerName = function (trigger) {\r\n switch (trigger) {\r\n case 0: return \"NothingTrigger\";\r\n case 1: return \"OnPickTrigger\";\r\n case 2: return \"OnLeftPickTrigger\";\r\n case 3: return \"OnRightPickTrigger\";\r\n case 4: return \"OnCenterPickTrigger\";\r\n case 5: return \"OnPickDownTrigger\";\r\n case 6: return \"OnPickUpTrigger\";\r\n case 7: return \"OnLongPressTrigger\";\r\n case 8: return \"OnPointerOverTrigger\";\r\n case 9: return \"OnPointerOutTrigger\";\r\n case 10: return \"OnEveryFrameTrigger\";\r\n case 11: return \"OnIntersectionEnterTrigger\";\r\n case 12: return \"OnIntersectionExitTrigger\";\r\n case 13: return \"OnKeyDownTrigger\";\r\n case 14: return \"OnKeyUpTrigger\";\r\n case 15: return \"OnPickOutTrigger\";\r\n default: return \"\";\r\n }\r\n };\r\n /**\r\n * Nothing\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.NothingTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_NothingTrigger;\r\n /**\r\n * On pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickTrigger;\r\n /**\r\n * On left pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnLeftPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnLeftPickTrigger;\r\n /**\r\n * On right pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnRightPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnRightPickTrigger;\r\n /**\r\n * On center pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnCenterPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnCenterPickTrigger;\r\n /**\r\n * On pick down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickDownTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickDownTrigger;\r\n /**\r\n * On double pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnDoublePickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnDoublePickTrigger;\r\n /**\r\n * On pick up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickUpTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickUpTrigger;\r\n /**\r\n * On pick out.\r\n * This trigger will only be raised if you also declared a OnPickDown\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickOutTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickOutTrigger;\r\n /**\r\n * On long press\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnLongPressTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnLongPressTrigger;\r\n /**\r\n * On pointer over\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPointerOverTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPointerOverTrigger;\r\n /**\r\n * On pointer out\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPointerOutTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPointerOutTrigger;\r\n /**\r\n * On every frame\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnEveryFrameTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnEveryFrameTrigger;\r\n /**\r\n * On intersection enter\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnIntersectionEnterTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnIntersectionEnterTrigger;\r\n /**\r\n * On intersection exit\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnIntersectionExitTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnIntersectionExitTrigger;\r\n /**\r\n * On key down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnKeyDownTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnKeyDownTrigger;\r\n /**\r\n * On key up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnKeyUpTrigger = 15;\r\n return ActionManager;\r\n}(_abstractActionManager__WEBPACK_IMPORTED_MODULE_10__[\"AbstractActionManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/condition.ts\":\n/*!******************************!*\\\n !*** ./Actions/condition.ts ***!\n \\******************************/\n/*! exports provided: Condition, ValueCondition, PredicateCondition, StateCondition */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return Condition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return ValueCondition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return PredicateCondition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return StateCondition; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n/**\r\n * A Condition applied to an Action\r\n */\r\nvar Condition = /** @class */ (function () {\r\n /**\r\n * Creates a new Condition\r\n * @param actionManager the manager of the action the condition is applied to\r\n */\r\n function Condition(actionManager) {\r\n this._actionManager = actionManager;\r\n }\r\n /**\r\n * Check if the current condition is valid\r\n * @returns a boolean\r\n */\r\n Condition.prototype.isValid = function () {\r\n return true;\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Condition.prototype._getProperty = function (propertyPath) {\r\n return this._actionManager._getProperty(propertyPath);\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Condition.prototype._getEffectiveTarget = function (target, propertyPath) {\r\n return this._actionManager._getEffectiveTarget(target, propertyPath);\r\n };\r\n /**\r\n * Serialize placeholder for child classes\r\n * @returns the serialized object\r\n */\r\n Condition.prototype.serialize = function () {\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Condition.prototype._serialize = function (serializedCondition) {\r\n return {\r\n type: 2,\r\n children: [],\r\n name: serializedCondition.name,\r\n properties: serializedCondition.properties\r\n };\r\n };\r\n return Condition;\r\n}());\r\n\r\n/**\r\n * Defines specific conditional operators as extensions of Condition\r\n */\r\nvar ValueCondition = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ValueCondition, _super);\r\n /**\r\n * Creates a new ValueCondition\r\n * @param actionManager manager for the action the condition applies to\r\n * @param target for the action\r\n * @param propertyPath path to specify the property of the target the conditional operator uses\r\n * @param value the value compared by the conditional operator against the current value of the property\r\n * @param operator the conditional operator, default ValueCondition.IsEqual\r\n */\r\n function ValueCondition(actionManager, target, \r\n /** path to specify the property of the target the conditional operator uses */\r\n propertyPath, \r\n /** the value compared by the conditional operator against the current value of the property */\r\n value, \r\n /** the conditional operator, default ValueCondition.IsEqual */\r\n operator) {\r\n if (operator === void 0) { operator = ValueCondition.IsEqual; }\r\n var _this = _super.call(this, actionManager) || this;\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this.operator = operator;\r\n _this._target = target;\r\n _this._effectiveTarget = _this._getEffectiveTarget(target, _this.propertyPath);\r\n _this._property = _this._getProperty(_this.propertyPath);\r\n return _this;\r\n }\r\n Object.defineProperty(ValueCondition, \"IsEqual\", {\r\n /**\r\n * returns the number for IsEqual\r\n */\r\n get: function () {\r\n return ValueCondition._IsEqual;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueCondition, \"IsDifferent\", {\r\n /**\r\n * Returns the number for IsDifferent\r\n */\r\n get: function () {\r\n return ValueCondition._IsDifferent;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueCondition, \"IsGreater\", {\r\n /**\r\n * Returns the number for IsGreater\r\n */\r\n get: function () {\r\n return ValueCondition._IsGreater;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueCondition, \"IsLesser\", {\r\n /**\r\n * Returns the number for IsLesser\r\n */\r\n get: function () {\r\n return ValueCondition._IsLesser;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Compares the given value with the property value for the specified conditional operator\r\n * @returns the result of the comparison\r\n */\r\n ValueCondition.prototype.isValid = function () {\r\n switch (this.operator) {\r\n case ValueCondition.IsGreater:\r\n return this._effectiveTarget[this._property] > this.value;\r\n case ValueCondition.IsLesser:\r\n return this._effectiveTarget[this._property] < this.value;\r\n case ValueCondition.IsEqual:\r\n case ValueCondition.IsDifferent:\r\n var check;\r\n if (this.value.equals) {\r\n check = this.value.equals(this._effectiveTarget[this._property]);\r\n }\r\n else {\r\n check = this.value === this._effectiveTarget[this._property];\r\n }\r\n return this.operator === ValueCondition.IsEqual ? check : !check;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Serialize the ValueCondition into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n ValueCondition.prototype.serialize = function () {\r\n return this._serialize({\r\n name: \"ValueCondition\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.value) },\r\n { name: \"operator\", value: ValueCondition.GetOperatorName(this.operator) }\r\n ]\r\n });\r\n };\r\n /**\r\n * Gets the name of the conditional operator for the ValueCondition\r\n * @param operator the conditional operator\r\n * @returns the name\r\n */\r\n ValueCondition.GetOperatorName = function (operator) {\r\n switch (operator) {\r\n case ValueCondition._IsEqual: return \"IsEqual\";\r\n case ValueCondition._IsDifferent: return \"IsDifferent\";\r\n case ValueCondition._IsGreater: return \"IsGreater\";\r\n case ValueCondition._IsLesser: return \"IsLesser\";\r\n default: return \"\";\r\n }\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsEqual = 0;\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsDifferent = 1;\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsGreater = 2;\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsLesser = 3;\r\n return ValueCondition;\r\n}(Condition));\r\n\r\n/**\r\n * Defines a predicate condition as an extension of Condition\r\n */\r\nvar PredicateCondition = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PredicateCondition, _super);\r\n /**\r\n * Creates a new PredicateCondition\r\n * @param actionManager manager for the action the condition applies to\r\n * @param predicate defines the predicate function used to validate the condition\r\n */\r\n function PredicateCondition(actionManager, \r\n /** defines the predicate function used to validate the condition */\r\n predicate) {\r\n var _this = _super.call(this, actionManager) || this;\r\n _this.predicate = predicate;\r\n return _this;\r\n }\r\n /**\r\n * @returns the validity of the predicate condition\r\n */\r\n PredicateCondition.prototype.isValid = function () {\r\n return this.predicate();\r\n };\r\n return PredicateCondition;\r\n}(Condition));\r\n\r\n/**\r\n * Defines a state condition as an extension of Condition\r\n */\r\nvar StateCondition = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StateCondition, _super);\r\n /**\r\n * Creates a new StateCondition\r\n * @param actionManager manager for the action the condition applies to\r\n * @param target of the condition\r\n * @param value to compare with target state\r\n */\r\n function StateCondition(actionManager, target, \r\n /** Value to compare with target state */\r\n value) {\r\n var _this = _super.call(this, actionManager) || this;\r\n _this.value = value;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /**\r\n * Gets a boolean indicating if the current condition is met\r\n * @returns the validity of the state\r\n */\r\n StateCondition.prototype.isValid = function () {\r\n return this._target.state === this.value;\r\n };\r\n /**\r\n * Serialize the StateCondition into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n StateCondition.prototype.serialize = function () {\r\n return this._serialize({\r\n name: \"StateCondition\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"value\", value: this.value }\r\n ]\r\n });\r\n };\r\n return StateCondition;\r\n}(Condition));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ValueCondition\"] = ValueCondition;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PredicateCondition\"] = PredicateCondition;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StateCondition\"] = StateCondition;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/directActions.ts\":\n/*!**********************************!*\\\n !*** ./Actions/directActions.ts ***!\n \\**********************************/\n/*! exports provided: SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return SwitchBooleanAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return SetStateAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return SetValueAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return IncrementValueAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return PlayAnimationAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return StopAnimationAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return DoNothingAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return CombineAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return ExecuteCodeAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return SetParentAction; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This defines an action responsible to toggle a boolean once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SwitchBooleanAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SwitchBooleanAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the boolean\r\n * @param propertyPath defines the path to the boolean property in the target object\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SwitchBooleanAction(triggerOptions, target, propertyPath, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.propertyPath = propertyPath;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n SwitchBooleanAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n };\r\n /**\r\n * Execute the action toggle the boolean value.\r\n */\r\n SwitchBooleanAction.prototype.execute = function () {\r\n this._effectiveTarget[this._property] = !this._effectiveTarget[this._property];\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SwitchBooleanAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SwitchBooleanAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath }\r\n ]\r\n }, parent);\r\n };\r\n return SwitchBooleanAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to set a the state field of the target\r\n * to a desired value once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SetStateAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SetStateAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the state property\r\n * @param value defines the value to store in the state field\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SetStateAction(triggerOptions, target, value, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.value = value;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /**\r\n * Execute the action and store the value on the target state property.\r\n */\r\n SetStateAction.prototype.execute = function () {\r\n this._target.state = this.value;\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SetStateAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SetStateAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"value\", value: this.value }\r\n ]\r\n }, parent);\r\n };\r\n return SetStateAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to set a property of the target\r\n * to a desired value once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SetValueAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SetValueAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the property\r\n * @param propertyPath defines the path of the property to set in the target\r\n * @param value defines the value to set in the property\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SetValueAction(triggerOptions, target, propertyPath, value, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n SetValueAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n };\r\n /**\r\n * Execute the action and set the targetted property to the desired value.\r\n */\r\n SetValueAction.prototype.execute = function () {\r\n this._effectiveTarget[this._property] = this.value;\r\n if (this._target.markAsDirty) {\r\n this._target.markAsDirty(this._property);\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SetValueAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SetValueAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._SerializeValueAsString(this.value) }\r\n ]\r\n }, parent);\r\n };\r\n return SetValueAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to increment the target value\r\n * to a desired value once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar IncrementValueAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](IncrementValueAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the property\r\n * @param propertyPath defines the path of the property to increment in the target\r\n * @param value defines the value value we should increment the property by\r\n * @param condition defines the trigger related conditions\r\n */\r\n function IncrementValueAction(triggerOptions, target, propertyPath, value, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n IncrementValueAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n if (typeof this._effectiveTarget[this._property] !== \"number\") {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Warning: IncrementValueAction can only be used with number values\");\r\n }\r\n };\r\n /**\r\n * Execute the action and increment the target of the value amount.\r\n */\r\n IncrementValueAction.prototype.execute = function () {\r\n this._effectiveTarget[this._property] += this.value;\r\n if (this._target.markAsDirty) {\r\n this._target.markAsDirty(this._property);\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n IncrementValueAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"IncrementValueAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._SerializeValueAsString(this.value) }\r\n ]\r\n }, parent);\r\n };\r\n return IncrementValueAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to start an animation once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar PlayAnimationAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlayAnimationAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the target animation or animation name\r\n * @param from defines from where the animation should start (animation frame)\r\n * @param end defines where the animation should stop (animation frame)\r\n * @param loop defines if the animation should loop or stop after the first play\r\n * @param condition defines the trigger related conditions\r\n */\r\n function PlayAnimationAction(triggerOptions, target, from, to, loop, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.from = from;\r\n _this.to = to;\r\n _this.loop = loop;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PlayAnimationAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and play the animation.\r\n */\r\n PlayAnimationAction.prototype.execute = function () {\r\n var scene = this._actionManager.getScene();\r\n scene.beginAnimation(this._target, this.from, this.to, this.loop);\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n PlayAnimationAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"PlayAnimationAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"from\", value: String(this.from) },\r\n { name: \"to\", value: String(this.to) },\r\n { name: \"loop\", value: _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._SerializeValueAsString(this.loop) || false }\r\n ]\r\n }, parent);\r\n };\r\n return PlayAnimationAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to stop an animation once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar StopAnimationAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StopAnimationAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the target animation or animation name\r\n * @param condition defines the trigger related conditions\r\n */\r\n function StopAnimationAction(triggerOptions, target, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n StopAnimationAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and stop the animation.\r\n */\r\n StopAnimationAction.prototype.execute = function () {\r\n var scene = this._actionManager.getScene();\r\n scene.stopAnimation(this._target);\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n StopAnimationAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"StopAnimationAction\",\r\n properties: [_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target)]\r\n }, parent);\r\n };\r\n return StopAnimationAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible that does nothing once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar DoNothingAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DoNothingAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param condition defines the trigger related conditions\r\n */\r\n function DoNothingAction(triggerOptions, condition) {\r\n if (triggerOptions === void 0) { triggerOptions = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].ACTION_NothingTrigger; }\r\n return _super.call(this, triggerOptions, condition) || this;\r\n }\r\n /**\r\n * Execute the action and do nothing.\r\n */\r\n DoNothingAction.prototype.execute = function () {\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n DoNothingAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"DoNothingAction\",\r\n properties: []\r\n }, parent);\r\n };\r\n return DoNothingAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to trigger several actions once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar CombineAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CombineAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param children defines the list of aggregated animations to run\r\n * @param condition defines the trigger related conditions\r\n */\r\n function CombineAction(triggerOptions, children, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.children = children;\r\n return _this;\r\n }\r\n /** @hidden */\r\n CombineAction.prototype._prepare = function () {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index]._actionManager = this._actionManager;\r\n this.children[index]._prepare();\r\n }\r\n };\r\n /**\r\n * Execute the action and executes all the aggregated actions.\r\n */\r\n CombineAction.prototype.execute = function (evt) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index].execute(evt);\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n CombineAction.prototype.serialize = function (parent) {\r\n var serializationObject = _super.prototype._serialize.call(this, {\r\n name: \"CombineAction\",\r\n properties: [],\r\n combine: []\r\n }, parent);\r\n for (var i = 0; i < this.children.length; i++) {\r\n serializationObject.combine.push(this.children[i].serialize(null));\r\n }\r\n return serializationObject;\r\n };\r\n return CombineAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to run code (external event) once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar ExecuteCodeAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ExecuteCodeAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param func defines the callback function to run\r\n * @param condition defines the trigger related conditions\r\n */\r\n function ExecuteCodeAction(triggerOptions, func, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.func = func;\r\n return _this;\r\n }\r\n /**\r\n * Execute the action and run the attached code.\r\n */\r\n ExecuteCodeAction.prototype.execute = function (evt) {\r\n this.func(evt);\r\n };\r\n return ExecuteCodeAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to set the parent property of the target once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SetParentAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SetParentAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the target containing the parent property\r\n * @param parent defines from where the animation should start (animation frame)\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SetParentAction(triggerOptions, target, parent, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._target = target;\r\n _this._parent = parent;\r\n return _this;\r\n }\r\n /** @hidden */\r\n SetParentAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and set the parent property.\r\n */\r\n SetParentAction.prototype.execute = function () {\r\n if (this._target.parent === this._parent) {\r\n return;\r\n }\r\n var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();\r\n invertParentWorldMatrix.invert();\r\n this._target.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(this._target.position, invertParentWorldMatrix);\r\n this._target.parent = this._parent;\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SetParentAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SetParentAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._parent),\r\n ]\r\n }, parent);\r\n };\r\n return SetParentAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetParentAction\"] = SetParentAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ExecuteCodeAction\"] = ExecuteCodeAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DoNothingAction\"] = DoNothingAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StopAnimationAction\"] = StopAnimationAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PlayAnimationAction\"] = PlayAnimationAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.IncrementValueAction\"] = IncrementValueAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetValueAction\"] = SetValueAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetStateAction\"] = SetStateAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetParentAction\"] = SetParentAction;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/directAudioActions.ts\":\n/*!***************************************!*\\\n !*** ./Actions/directAudioActions.ts ***!\n \\***************************************/\n/*! exports provided: PlaySoundAction, StopSoundAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return PlaySoundAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return StopSoundAction; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n/**\r\n * This defines an action helpful to play a defined sound on a triggered action.\r\n */\r\nvar PlaySoundAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlaySoundAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param sound defines the sound to play\r\n * @param condition defines the trigger related conditions\r\n */\r\n function PlaySoundAction(triggerOptions, sound, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._sound = sound;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PlaySoundAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and play the sound.\r\n */\r\n PlaySoundAction.prototype.execute = function () {\r\n if (this._sound !== undefined) {\r\n this._sound.play();\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n PlaySoundAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"PlaySoundAction\",\r\n properties: [{ name: \"sound\", value: this._sound.name }]\r\n }, parent);\r\n };\r\n return PlaySoundAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action helpful to stop a defined sound on a triggered action.\r\n */\r\nvar StopSoundAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StopSoundAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param sound defines the sound to stop\r\n * @param condition defines the trigger related conditions\r\n */\r\n function StopSoundAction(triggerOptions, sound, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._sound = sound;\r\n return _this;\r\n }\r\n /** @hidden */\r\n StopSoundAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and stop the sound.\r\n */\r\n StopSoundAction.prototype.execute = function () {\r\n if (this._sound !== undefined) {\r\n this._sound.stop();\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n StopSoundAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"StopSoundAction\",\r\n properties: [{ name: \"sound\", value: this._sound.name }]\r\n }, parent);\r\n };\r\n return StopSoundAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PlaySoundAction\"] = StopSoundAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StopSoundAction\"] = StopSoundAction;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/index.ts\":\n/*!**************************!*\\\n !*** ./Actions/index.ts ***!\n \\**************************/\n/*! exports provided: AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _abstractActionManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstractActionManager */ \"./Actions/abstractActionManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return _abstractActionManager__WEBPACK_IMPORTED_MODULE_0__[\"AbstractActionManager\"]; });\n\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]; });\n\n/* harmony import */ var _actionEvent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return _actionEvent__WEBPACK_IMPORTED_MODULE_2__[\"ActionEvent\"]; });\n\n/* harmony import */ var _actionManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./actionManager */ \"./Actions/actionManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return _actionManager__WEBPACK_IMPORTED_MODULE_3__[\"ActionManager\"]; });\n\n/* harmony import */ var _condition__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./condition */ \"./Actions/condition.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"Condition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"ValueCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"PredicateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"StateCondition\"]; });\n\n/* harmony import */ var _directActions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./directActions */ \"./Actions/directActions.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SwitchBooleanAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SetStateAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SetValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"IncrementValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"PlayAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"StopAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"DoNothingAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"CombineAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"ExecuteCodeAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SetParentAction\"]; });\n\n/* harmony import */ var _directAudioActions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./directAudioActions */ \"./Actions/directAudioActions.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return _directAudioActions__WEBPACK_IMPORTED_MODULE_6__[\"PlaySoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return _directAudioActions__WEBPACK_IMPORTED_MODULE_6__[\"StopSoundAction\"]; });\n\n/* harmony import */ var _interpolateValueAction__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./interpolateValueAction */ \"./Actions/interpolateValueAction.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return _interpolateValueAction__WEBPACK_IMPORTED_MODULE_7__[\"InterpolateValueAction\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/interpolateValueAction.ts\":\n/*!*******************************************!*\\\n !*** ./Actions/interpolateValueAction.ts ***!\n \\*******************************************/\n/*! exports provided: InterpolateValueAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return InterpolateValueAction; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Animations/animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This defines an action responsible to change the value of a property\r\n * by interpolating between its current value and the newly set one once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar InterpolateValueAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InterpolateValueAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the value to interpolate\r\n * @param propertyPath defines the path to the property in the target object\r\n * @param value defines the target value at the end of the interpolation\r\n * @param duration deines the time it will take for the property to interpolate to the value.\r\n * @param condition defines the trigger related conditions\r\n * @param stopOtherAnimations defines if the other scene animations should be stopped when the action has been triggered\r\n * @param onInterpolationDone defines a callback raised once the interpolation animation has been done\r\n */\r\n function InterpolateValueAction(triggerOptions, target, propertyPath, value, duration, condition, stopOtherAnimations, onInterpolationDone) {\r\n if (duration === void 0) { duration = 1000; }\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n /**\r\n * Defines the time it will take for the property to interpolate to the value.\r\n */\r\n _this.duration = 1000;\r\n /**\r\n * Observable triggered once the interpolation animation has been done.\r\n */\r\n _this.onInterpolationDoneObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this.duration = duration;\r\n _this.stopOtherAnimations = stopOtherAnimations;\r\n _this.onInterpolationDone = onInterpolationDone;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n InterpolateValueAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n };\r\n /**\r\n * Execute the action starts the value interpolation.\r\n */\r\n InterpolateValueAction.prototype.execute = function () {\r\n var _this = this;\r\n var scene = this._actionManager.getScene();\r\n var keys = [\r\n {\r\n frame: 0,\r\n value: this._effectiveTarget[this._property]\r\n }, {\r\n frame: 100,\r\n value: this.value\r\n }\r\n ];\r\n var dataType;\r\n if (typeof this.value === \"number\") {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_FLOAT;\r\n }\r\n else if (this.value instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_COLOR3;\r\n }\r\n else if (this.value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_VECTOR3;\r\n }\r\n else if (this.value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_MATRIX;\r\n }\r\n else if (this.value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_QUATERNION;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"InterpolateValueAction: Unsupported type (\" + typeof this.value + \")\");\r\n return;\r\n }\r\n var animation = new _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"](\"InterpolateValueAction\", this._property, 100 * (1000.0 / this.duration), dataType, _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n animation.setKeys(keys);\r\n if (this.stopOtherAnimations) {\r\n scene.stopAnimation(this._effectiveTarget);\r\n }\r\n var wrapper = function () {\r\n _this.onInterpolationDoneObservable.notifyObservers(_this);\r\n if (_this.onInterpolationDone) {\r\n _this.onInterpolationDone();\r\n }\r\n };\r\n scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, wrapper);\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n InterpolateValueAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"InterpolateValueAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.value) },\r\n { name: \"duration\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.duration) },\r\n { name: \"stopOtherAnimations\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.stopOtherAnimations) || false }\r\n ]\r\n }, parent);\r\n };\r\n return InterpolateValueAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.InterpolateValueAction\"] = InterpolateValueAction;\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animatable.ts\":\n/*!**********************************!*\\\n !*** ./Animations/animatable.ts ***!\n \\**********************************/\n/*! exports provided: Animatable */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return Animatable; });\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _runtimeAnimation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./runtimeAnimation */ \"./Animations/runtimeAnimation.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _Bones_bone__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Bones/bone */ \"./Bones/bone.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store an actual running animation\r\n */\r\nvar Animatable = /** @class */ (function () {\r\n /**\r\n * Creates a new Animatable\r\n * @param scene defines the hosting scene\r\n * @param target defines the target object\r\n * @param fromFrame defines the starting frame number (default is 0)\r\n * @param toFrame defines the ending frame number (default is 100)\r\n * @param loopAnimation defines if the animation must loop (default is false)\r\n * @param speedRatio defines the factor to apply to animation speed (default is 1)\r\n * @param onAnimationEnd defines a callback to call when animation ends if it is not looping\r\n * @param animations defines a group of animation to add to the new Animatable\r\n * @param onAnimationLoop defines a callback to call when animation loops\r\n */\r\n function Animatable(scene, \r\n /** defines the target object */\r\n target, \r\n /** defines the starting frame number (default is 0) */\r\n fromFrame, \r\n /** defines the ending frame number (default is 100) */\r\n toFrame, \r\n /** defines if the animation must loop (default is false) */\r\n loopAnimation, speedRatio, \r\n /** defines a callback to call when animation ends if it is not looping */\r\n onAnimationEnd, animations, \r\n /** defines a callback to call when animation loops */\r\n onAnimationLoop) {\r\n if (fromFrame === void 0) { fromFrame = 0; }\r\n if (toFrame === void 0) { toFrame = 100; }\r\n if (loopAnimation === void 0) { loopAnimation = false; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n this.target = target;\r\n this.fromFrame = fromFrame;\r\n this.toFrame = toFrame;\r\n this.loopAnimation = loopAnimation;\r\n this.onAnimationEnd = onAnimationEnd;\r\n this.onAnimationLoop = onAnimationLoop;\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n this._runtimeAnimations = new Array();\r\n this._paused = false;\r\n this._speedRatio = 1;\r\n this._weight = -1.0;\r\n this._syncRoot = null;\r\n /**\r\n * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.\r\n * This will only apply for non looping animation (default is true)\r\n */\r\n this.disposeOnEnd = true;\r\n /**\r\n * Gets a boolean indicating if the animation has started\r\n */\r\n this.animationStarted = false;\r\n /**\r\n * Observer raised when the animation ends\r\n */\r\n this.onAnimationEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observer raised when the animation loops\r\n */\r\n this.onAnimationLoopObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this._scene = scene;\r\n if (animations) {\r\n this.appendAnimations(target, animations);\r\n }\r\n this._speedRatio = speedRatio;\r\n scene._activeAnimatables.push(this);\r\n }\r\n Object.defineProperty(Animatable.prototype, \"syncRoot\", {\r\n /**\r\n * Gets the root Animatable used to synchronize and normalize animations\r\n */\r\n get: function () {\r\n return this._syncRoot;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"masterFrame\", {\r\n /**\r\n * Gets the current frame of the first RuntimeAnimation\r\n * Used to synchronize Animatables\r\n */\r\n get: function () {\r\n if (this._runtimeAnimations.length === 0) {\r\n return 0;\r\n }\r\n return this._runtimeAnimations[0].currentFrame;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"weight\", {\r\n /**\r\n * Gets or sets the animatable weight (-1.0 by default meaning not weighted)\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n set: function (value) {\r\n if (value === -1) { // -1 is ok and means no weight\r\n this._weight = -1;\r\n return;\r\n }\r\n // Else weight must be in [0, 1] range\r\n this._weight = Math.min(Math.max(value, 0), 1.0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to apply to the animatable (1.0 by default)\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n set: function (value) {\r\n for (var index = 0; index < this._runtimeAnimations.length; index++) {\r\n var animation = this._runtimeAnimations[index];\r\n animation._prepareForSpeedRatioChange(value);\r\n }\r\n this._speedRatio = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Synchronize and normalize current Animatable with a source Animatable\r\n * This is useful when using animation weights and when animations are not of the same length\r\n * @param root defines the root Animatable to synchronize with\r\n * @returns the current Animatable\r\n */\r\n Animatable.prototype.syncWith = function (root) {\r\n this._syncRoot = root;\r\n if (root) {\r\n // Make sure this animatable will animate after the root\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n this._scene._activeAnimatables.push(this);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the list of runtime animations\r\n * @returns an array of RuntimeAnimation\r\n */\r\n Animatable.prototype.getAnimations = function () {\r\n return this._runtimeAnimations;\r\n };\r\n /**\r\n * Adds more animations to the current animatable\r\n * @param target defines the target of the animations\r\n * @param animations defines the new animations to add\r\n */\r\n Animatable.prototype.appendAnimations = function (target, animations) {\r\n var _this = this;\r\n for (var index = 0; index < animations.length; index++) {\r\n var animation = animations[index];\r\n var newRuntimeAnimation = new _runtimeAnimation__WEBPACK_IMPORTED_MODULE_1__[\"RuntimeAnimation\"](target, animation, this._scene, this);\r\n newRuntimeAnimation._onLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(_this);\r\n if (_this.onAnimationLoop) {\r\n _this.onAnimationLoop();\r\n }\r\n };\r\n this._runtimeAnimations.push(newRuntimeAnimation);\r\n }\r\n };\r\n /**\r\n * Gets the source animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the source animation for the given property\r\n */\r\n Animatable.prototype.getAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index].animation;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the runtime animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the runtime animation for the given property\r\n */\r\n Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Resets the animatable to its original state\r\n */\r\n Animatable.prototype.reset = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].reset(true);\r\n }\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n };\r\n /**\r\n * Allows the animatable to blend with current running animations\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-blending\r\n * @param blendingSpeed defines the blending speed to use\r\n */\r\n Animatable.prototype.enableBlending = function (blendingSpeed) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = true;\r\n runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;\r\n }\r\n };\r\n /**\r\n * Disable animation blending\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Animatable.prototype.disableBlending = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = false;\r\n }\r\n };\r\n /**\r\n * Jump directly to a given frame\r\n * @param frame defines the frame to jump to\r\n */\r\n Animatable.prototype.goToFrame = function (frame) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n if (runtimeAnimations[0]) {\r\n var fps = runtimeAnimations[0].animation.framePerSecond;\r\n var currentFrame = runtimeAnimations[0].currentFrame;\r\n var adjustTime = frame - currentFrame;\r\n var delay = this.speedRatio !== 0 ? adjustTime * 1000 / (fps * this.speedRatio) : 0;\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = 0;\r\n }\r\n this._localDelayOffset -= delay;\r\n }\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].goToFrame(frame);\r\n }\r\n };\r\n /**\r\n * Pause the animation\r\n */\r\n Animatable.prototype.pause = function () {\r\n if (this._paused) {\r\n return;\r\n }\r\n this._paused = true;\r\n };\r\n /**\r\n * Restart the animation\r\n */\r\n Animatable.prototype.restart = function () {\r\n this._paused = false;\r\n };\r\n Animatable.prototype._raiseOnAnimationEnd = function () {\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n this.onAnimationEndObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop and delete the current animation\r\n * @param animationName defines a string used to only stop some of the runtime animations instead of all\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Animatable.prototype.stop = function (animationName, targetMask) {\r\n if (animationName || targetMask) {\r\n var idx = this._scene._activeAnimatables.indexOf(this);\r\n if (idx > -1) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = runtimeAnimations.length - 1; index >= 0; index--) {\r\n var runtimeAnimation = runtimeAnimations[index];\r\n if (animationName && runtimeAnimation.animation.name != animationName) {\r\n continue;\r\n }\r\n if (targetMask && !targetMask(runtimeAnimation.target)) {\r\n continue;\r\n }\r\n runtimeAnimation.dispose();\r\n runtimeAnimations.splice(index, 1);\r\n }\r\n if (runtimeAnimations.length == 0) {\r\n this._scene._activeAnimatables.splice(idx, 1);\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n }\r\n else {\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n };\r\n /**\r\n * Wait asynchronously for the animation to end\r\n * @returns a promise which will be fullfilled when the animation ends\r\n */\r\n Animatable.prototype.waitAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.onAnimationEndObservable.add(function () {\r\n resolve(_this);\r\n }, undefined, undefined, _this, true);\r\n });\r\n };\r\n /** @hidden */\r\n Animatable.prototype._animate = function (delay) {\r\n if (this._paused) {\r\n this.animationStarted = false;\r\n if (this._pausedDelay === null) {\r\n this._pausedDelay = delay;\r\n }\r\n return true;\r\n }\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = delay;\r\n this._pausedDelay = null;\r\n }\r\n else if (this._pausedDelay !== null) {\r\n this._localDelayOffset += delay - this._pausedDelay;\r\n this._pausedDelay = null;\r\n }\r\n if (this._weight === 0) { // We consider that an animation with a weight === 0 is \"actively\" paused\r\n return true;\r\n }\r\n // Animating\r\n var running = false;\r\n var runtimeAnimations = this._runtimeAnimations;\r\n var index;\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n var animation = runtimeAnimations[index];\r\n var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);\r\n running = running || isRunning;\r\n }\r\n this.animationStarted = running;\r\n if (!running) {\r\n if (this.disposeOnEnd) {\r\n // Remove from active animatables\r\n index = this._scene._activeAnimatables.indexOf(this);\r\n this._scene._activeAnimatables.splice(index, 1);\r\n // Dispose all runtime animations\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n }\r\n this._raiseOnAnimationEnd();\r\n if (this.disposeOnEnd) {\r\n this.onAnimationEnd = null;\r\n this.onAnimationLoop = null;\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationEndObservable.clear();\r\n }\r\n }\r\n return running;\r\n };\r\n return Animatable;\r\n}());\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._animate = function () {\r\n if (!this.animationsEnabled) {\r\n return;\r\n }\r\n var animatables = this._activeAnimatables;\r\n if (animatables.length === 0) {\r\n return;\r\n }\r\n // Getting time\r\n var now = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_5__[\"PrecisionDate\"].Now;\r\n if (!this._animationTimeLast) {\r\n if (this._pendingData.length > 0) {\r\n return;\r\n }\r\n this._animationTimeLast = now;\r\n }\r\n var deltaTime = this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;\r\n this._animationTime += deltaTime;\r\n var animationTime = this._animationTime;\r\n this._animationTimeLast = now;\r\n for (var index = 0; index < animatables.length; index++) {\r\n var animatable = animatables[index];\r\n if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {\r\n index--; // Array was updated\r\n }\r\n }\r\n // Late animation bindings\r\n this._processLateAnimationBindings();\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginWeightedAnimation = function (target, from, to, weight, loop, speedRatio, onAnimationEnd, animatable, targetMask, onAnimationLoop) {\r\n if (weight === void 0) { weight = 1.0; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n var returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop);\r\n returnedAnimatable.weight = weight;\r\n return returnedAnimatable;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n if (stopCurrent) {\r\n this.stopAnimation(target, undefined, targetMask);\r\n }\r\n if (!animatable) {\r\n animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop);\r\n }\r\n var shouldRunTargetAnimations = targetMask ? targetMask(target) : true;\r\n // Local animations\r\n if (target.animations && shouldRunTargetAnimations) {\r\n animatable.appendAnimations(target, target.animations);\r\n }\r\n // Children animations\r\n if (target.getAnimatables) {\r\n var animatables = target.getAnimatables();\r\n for (var index = 0; index < animatables.length; index++) {\r\n this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);\r\n }\r\n }\r\n animatable.reset();\r\n return animatable;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask));\r\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\r\n var child = children_1[_i];\r\n result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask));\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop) {\r\n if (speedRatio === undefined) {\r\n speedRatio = 1.0;\r\n }\r\n var animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop);\r\n return animatable;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginDirectHierarchyAnimation = function (target, directDescendantsOnly, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop) {\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop));\r\n for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\r\n var child = children_2[_i];\r\n result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop));\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.getAnimatableByTarget = function (target) {\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n return this._activeAnimatables[index];\r\n }\r\n }\r\n return null;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.getAllAnimatablesByTarget = function (target) {\r\n var result = [];\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n result.push(this._activeAnimatables[index]);\r\n }\r\n }\r\n return result;\r\n};\r\n/**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.stopAnimation = function (target, animationName, targetMask) {\r\n var animatables = this.getAllAnimatablesByTarget(target);\r\n for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {\r\n var animatable = animatables_1[_i];\r\n animatable.stop(animationName, targetMask);\r\n }\r\n};\r\n/**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.stopAllAnimations = function () {\r\n if (this._activeAnimatables) {\r\n for (var i = 0; i < this._activeAnimatables.length; i++) {\r\n this._activeAnimatables[i].stop();\r\n }\r\n this._activeAnimatables = [];\r\n }\r\n for (var _i = 0, _a = this.animationGroups; _i < _a.length; _i++) {\r\n var group = _a[_i];\r\n group.stop();\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation, originalValue) {\r\n var target = runtimeAnimation.target;\r\n this._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n animations: [],\r\n originalValue: originalValue\r\n };\r\n }\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._processLateAnimationBindingsForMatrices = function (holder) {\r\n var normalizer = 1.0;\r\n var finalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[0];\r\n var finalScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[1];\r\n var finalQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Quaternion[0];\r\n var startIndex = 0;\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var scale = 1;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n originalValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n scale = 1.0 - holder.totalWeight;\r\n }\r\n else {\r\n startIndex = 1;\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n scale = originalAnimation.weight / normalizer;\r\n if (scale == 1) {\r\n return originalAnimation.currentValue;\r\n }\r\n }\r\n finalScaling.scaleInPlace(scale);\r\n finalPosition.scaleInPlace(scale);\r\n finalQuaternion.scaleInPlace(scale);\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n var scale = runtimeAnimation.weight / normalizer;\r\n var currentPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[2];\r\n var currentScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[3];\r\n var currentQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Quaternion[1];\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.scaleAndAddToRef(scale, finalScaling);\r\n currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(scale, finalPosition);\r\n }\r\n var workValue = originalAnimation._animationState.workValue;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);\r\n return workValue;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._processLateAnimationBindingsForQuaternions = function (holder, refQuaternion) {\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n if (holder.animations.length === 1) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), refQuaternion);\r\n return refQuaternion;\r\n }\r\n var normalizer = 1.0;\r\n var quaternions;\r\n var weights;\r\n if (holder.totalWeight < 1.0) {\r\n var scale = 1.0 - holder.totalWeight;\r\n quaternions = [];\r\n weights = [];\r\n quaternions.push(originalValue);\r\n weights.push(scale);\r\n }\r\n else {\r\n if (holder.animations.length === 2) { // Slerp as soon as we can\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);\r\n return refQuaternion;\r\n }\r\n quaternions = [];\r\n weights = [];\r\n normalizer = holder.totalWeight;\r\n }\r\n for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n quaternions.push(runtimeAnimation.currentValue);\r\n weights.push(runtimeAnimation.weight / normalizer);\r\n }\r\n // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions\r\n var cumulativeAmount = 0;\r\n var cumulativeQuaternion = null;\r\n for (var index = 0; index < quaternions.length;) {\r\n if (!cumulativeQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);\r\n cumulativeQuaternion = refQuaternion;\r\n cumulativeAmount = weights[index] + weights[index + 1];\r\n index += 2;\r\n continue;\r\n }\r\n cumulativeAmount += weights[index];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);\r\n index++;\r\n }\r\n return cumulativeQuaternion;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._processLateAnimationBindings = function () {\r\n if (!this._registeredForLateAnimationBindings.length) {\r\n return;\r\n }\r\n for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {\r\n var target = this._registeredForLateAnimationBindings.data[index];\r\n for (var path in target._lateAnimationHolders) {\r\n var holder = target._lateAnimationHolders[path];\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var matrixDecomposeMode = _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix\r\n var finalValue = target[path];\r\n if (matrixDecomposeMode) {\r\n finalValue = this._processLateAnimationBindingsForMatrices(holder);\r\n }\r\n else {\r\n var quaternionMode = originalValue.w !== undefined;\r\n if (quaternionMode) {\r\n finalValue = this._processLateAnimationBindingsForQuaternions(holder, finalValue || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].Identity());\r\n }\r\n else {\r\n var startIndex = 0;\r\n var normalizer = 1.0;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n if (originalValue.scale) {\r\n finalValue = originalValue.scale(1.0 - holder.totalWeight);\r\n }\r\n else {\r\n finalValue = originalValue * (1.0 - holder.totalWeight);\r\n }\r\n }\r\n else {\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n var scale_1 = originalAnimation.weight / normalizer;\r\n if (scale_1 !== 1) {\r\n if (originalAnimation.currentValue.scale) {\r\n finalValue = originalAnimation.currentValue.scale(scale_1);\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue * scale_1;\r\n }\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue;\r\n }\r\n startIndex = 1;\r\n }\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n var scale = runtimeAnimation.weight / normalizer;\r\n if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n }\r\n else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n }\r\n }\r\n target[path] = finalValue;\r\n }\r\n target._lateAnimationHolders = {};\r\n }\r\n this._registeredForLateAnimationBindings.reset();\r\n};\r\n_Bones_bone__WEBPACK_IMPORTED_MODULE_6__[\"Bone\"].prototype.copyAnimationRange = function (source, rangeName, frameOffset, rescaleAsRequired, skelDimensionsRatio) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (skelDimensionsRatio === void 0) { skelDimensionsRatio = null; }\r\n // all animation may be coming from a library skeleton, so may need to create animation\r\n if (this.animations.length === 0) {\r\n this.animations.push(new _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"](this.name, \"_matrix\", source.animations[0].framePerSecond, _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].ANIMATIONTYPE_MATRIX, 0));\r\n this.animations[0].setKeys([]);\r\n }\r\n // get animation info / verify there is such a range from the source bone\r\n var sourceRange = source.animations[0].getRange(rangeName);\r\n if (!sourceRange) {\r\n return false;\r\n }\r\n var from = sourceRange.from;\r\n var to = sourceRange.to;\r\n var sourceKeys = source.animations[0].getKeys();\r\n // rescaling prep\r\n var sourceBoneLength = source.length;\r\n var sourceParent = source.getParent();\r\n var parent = this.getParent();\r\n var parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;\r\n var parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;\r\n var dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);\r\n var destKeys = this.animations[0].getKeys();\r\n // loop vars declaration\r\n var orig;\r\n var origTranslation;\r\n var mat;\r\n for (var key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {\r\n orig = sourceKeys[key];\r\n if (orig.frame >= from && orig.frame <= to) {\r\n if (rescaleAsRequired) {\r\n mat = orig.value.clone();\r\n // scale based on parent ratio, when bone has parent\r\n if (parentScalingReqd) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.scaleInPlace(parentRatio));\r\n // scale based on skeleton dimension ratio when root bone, and value is passed\r\n }\r\n else if (dimensionsScalingReqd && skelDimensionsRatio) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));\r\n // use original when root bone, and no data for skelDimensionsRatio\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n destKeys.push({ frame: orig.frame + frameOffset, value: mat });\r\n }\r\n }\r\n this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);\r\n return true;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animation.ts\":\n/*!*********************************!*\\\n !*** ./Animations/animation.ts ***!\n \\*********************************/\n/*! exports provided: _IAnimationState, Animation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _IAnimationState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return Animation; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _animationKey__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./animationKey */ \"./Animations/animationKey.ts\");\n/* harmony import */ var _animationRange__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./animationRange */ \"./Animations/animationRange.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Maths/math.size */ \"./Maths/math.size.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar _IAnimationState = /** @class */ (function () {\r\n function _IAnimationState() {\r\n }\r\n return _IAnimationState;\r\n}());\r\n\r\n/**\r\n * Class used to store any kind of animation\r\n */\r\nvar Animation = /** @class */ (function () {\r\n /**\r\n * Initializes the animation\r\n * @param name Name of the animation\r\n * @param targetProperty Property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param dataType The data type of the animation\r\n * @param loopMode The loop mode of the animation\r\n * @param enableBlending Specifies if blending should be enabled\r\n */\r\n function Animation(\r\n /**Name of the animation */\r\n name, \r\n /**Property to animate */\r\n targetProperty, \r\n /**The frames per second of the animation */\r\n framePerSecond, \r\n /**The data type of the animation */\r\n dataType, \r\n /**The loop mode of the animation */\r\n loopMode, \r\n /**Specifies if blending should be enabled */\r\n enableBlending) {\r\n this.name = name;\r\n this.targetProperty = targetProperty;\r\n this.framePerSecond = framePerSecond;\r\n this.dataType = dataType;\r\n this.loopMode = loopMode;\r\n this.enableBlending = enableBlending;\r\n /**\r\n * @hidden Internal use only\r\n */\r\n this._runtimeAnimations = new Array();\r\n /**\r\n * The set of event that will be linked to this animation\r\n */\r\n this._events = new Array();\r\n /**\r\n * Stores the blending speed of the animation\r\n */\r\n this.blendingSpeed = 0.01;\r\n /**\r\n * Stores the animation ranges for the animation\r\n */\r\n this._ranges = {};\r\n this.targetPropertyPath = targetProperty.split(\".\");\r\n this.dataType = dataType;\r\n this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;\r\n }\r\n /**\r\n * @hidden Internal use\r\n */\r\n Animation._PrepareAnimation = function (name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction) {\r\n var dataType = undefined;\r\n if (!isNaN(parseFloat(from)) && isFinite(from)) {\r\n dataType = Animation.ANIMATIONTYPE_FLOAT;\r\n }\r\n else if (from instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]) {\r\n dataType = Animation.ANIMATIONTYPE_QUATERNION;\r\n }\r\n else if (from instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n else if (from instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"]) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR2;\r\n }\r\n else if (from instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"]) {\r\n dataType = Animation.ANIMATIONTYPE_COLOR3;\r\n }\r\n else if (from instanceof _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"]) {\r\n dataType = Animation.ANIMATIONTYPE_SIZE;\r\n }\r\n if (dataType == undefined) {\r\n return null;\r\n }\r\n var animation = new Animation(name, targetProperty, framePerSecond, dataType, loopMode);\r\n var keys = [{ frame: 0, value: from }, { frame: totalFrame, value: to }];\r\n animation.setKeys(keys);\r\n if (easingFunction !== undefined) {\r\n animation.setEasingFunction(easingFunction);\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Sets up an animation\r\n * @param property The property to animate\r\n * @param animationType The animation type to apply\r\n * @param framePerSecond The frames per second of the animation\r\n * @param easingFunction The easing function used in the animation\r\n * @returns The created animation\r\n */\r\n Animation.CreateAnimation = function (property, animationType, framePerSecond, easingFunction) {\r\n var animation = new Animation(property + \"Animation\", property, framePerSecond, animationType, Animation.ANIMATIONLOOPMODE_CONSTANT);\r\n animation.setEasingFunction(easingFunction);\r\n return animation;\r\n };\r\n /**\r\n * Create and start an animation on a node\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second yo use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when animation end\r\n * @returns the animatable created for this animation\r\n */\r\n Animation.CreateAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n return node.getScene().beginDirectAnimation(node, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Create and start an animation on a node and its descendants\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second to use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @returns the list of animatables created for all nodes\r\n * @example https://www.babylonjs-playground.com/#MH0VLI\r\n */\r\n Animation.CreateAndStartHierarchyAnimation = function (name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n var scene = node.getScene();\r\n return scene.beginDirectHierarchyAnimation(node, directDescendantsOnly, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Creates a new animation, merges it with the existing animations and starts it\r\n * @param name Name of the animation\r\n * @param node Node which contains the scene that begins the animations\r\n * @param targetProperty Specifies which property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param totalFrame The total number of frames\r\n * @param from The frame at the beginning of the animation\r\n * @param to The frame at the end of the animation\r\n * @param loopMode Specifies the loop mode of the animation\r\n * @param easingFunction (Optional) The easing function of the animation, which allow custom mathematical formulas for animations\r\n * @param onAnimationEnd Callback to run once the animation is complete\r\n * @returns Nullable animation\r\n */\r\n Animation.CreateMergeAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n node.animations.push(animation);\r\n return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Transition property of an host to the target Value\r\n * @param property The property to transition\r\n * @param targetValue The target Value of the property\r\n * @param host The object where the property to animate belongs\r\n * @param scene Scene used to run the animation\r\n * @param frameRate Framerate (in frame/s) to use\r\n * @param transition The transition type we want to use\r\n * @param duration The duration of the animation, in milliseconds\r\n * @param onAnimationEnd Callback trigger at the end of the animation\r\n * @returns Nullable animation\r\n */\r\n Animation.TransitionTo = function (property, targetValue, host, scene, frameRate, transition, duration, onAnimationEnd) {\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n if (duration <= 0) {\r\n host[property] = targetValue;\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n return null;\r\n }\r\n var endFrame = frameRate * (duration / 1000);\r\n transition.setKeys([{\r\n frame: 0,\r\n value: host[property].clone ? host[property].clone() : host[property]\r\n },\r\n {\r\n frame: endFrame,\r\n value: targetValue\r\n }]);\r\n if (!host.animations) {\r\n host.animations = [];\r\n }\r\n host.animations.push(transition);\r\n var animation = scene.beginAnimation(host, 0, endFrame, false);\r\n animation.onAnimationEnd = onAnimationEnd;\r\n return animation;\r\n };\r\n Object.defineProperty(Animation.prototype, \"runtimeAnimations\", {\r\n /**\r\n * Return the array of runtime animations currently using this animation\r\n */\r\n get: function () {\r\n return this._runtimeAnimations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation.prototype, \"hasRunningRuntimeAnimations\", {\r\n /**\r\n * Specifies if any of the runtime animations are currently running\r\n */\r\n get: function () {\r\n for (var _i = 0, _a = this._runtimeAnimations; _i < _a.length; _i++) {\r\n var runtimeAnimation = _a[_i];\r\n if (!runtimeAnimation.isStopped) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Converts the animation to a string\r\n * @param fullDetails support for multiple levels of logging within scene loading\r\n * @returns String form of the animation\r\n */\r\n Animation.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", property: \" + this.targetProperty;\r\n ret += \", datatype: \" + ([\"Float\", \"Vector3\", \"Quaternion\", \"Matrix\", \"Color3\", \"Vector2\"])[this.dataType];\r\n ret += \", nKeys: \" + (this._keys ? this._keys.length : \"none\");\r\n ret += \", nRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Add an event to this animation\r\n * @param event Event to add\r\n */\r\n Animation.prototype.addEvent = function (event) {\r\n this._events.push(event);\r\n };\r\n /**\r\n * Remove all events found at the given frame\r\n * @param frame The frame to remove events from\r\n */\r\n Animation.prototype.removeEvents = function (frame) {\r\n for (var index = 0; index < this._events.length; index++) {\r\n if (this._events[index].frame === frame) {\r\n this._events.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n };\r\n /**\r\n * Retrieves all the events from the animation\r\n * @returns Events from the animation\r\n */\r\n Animation.prototype.getEvents = function () {\r\n return this._events;\r\n };\r\n /**\r\n * Creates an animation range\r\n * @param name Name of the animation range\r\n * @param from Starting frame of the animation range\r\n * @param to Ending frame of the animation\r\n */\r\n Animation.prototype.createRange = function (name, from, to) {\r\n // check name not already in use; could happen for bones after serialized\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new _animationRange__WEBPACK_IMPORTED_MODULE_6__[\"AnimationRange\"](name, from, to);\r\n }\r\n };\r\n /**\r\n * Deletes an animation range by name\r\n * @param name Name of the animation range to delete\r\n * @param deleteFrames Specifies if the key frames for the range should also be deleted (true) or not (false)\r\n */\r\n Animation.prototype.deleteRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n var range = this._ranges[name];\r\n if (!range) {\r\n return;\r\n }\r\n if (deleteFrames) {\r\n var from = range.from;\r\n var to = range.to;\r\n // this loop MUST go high to low for multiple splices to work\r\n for (var key = this._keys.length - 1; key >= 0; key--) {\r\n if (this._keys[key].frame >= from && this._keys[key].frame <= to) {\r\n this._keys.splice(key, 1);\r\n }\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets the animation range by name, or null if not defined\r\n * @param name Name of the animation range\r\n * @returns Nullable animation range\r\n */\r\n Animation.prototype.getRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the key frames from the animation\r\n * @returns The key frames of the animation\r\n */\r\n Animation.prototype.getKeys = function () {\r\n return this._keys;\r\n };\r\n /**\r\n * Gets the highest frame rate of the animation\r\n * @returns Highest frame rate of the animation\r\n */\r\n Animation.prototype.getHighestFrame = function () {\r\n var ret = 0;\r\n for (var key = 0, nKeys = this._keys.length; key < nKeys; key++) {\r\n if (ret < this._keys[key].frame) {\r\n ret = this._keys[key].frame;\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the easing function of the animation\r\n * @returns Easing function of the animation\r\n */\r\n Animation.prototype.getEasingFunction = function () {\r\n return this._easingFunction;\r\n };\r\n /**\r\n * Sets the easing function of the animation\r\n * @param easingFunction A custom mathematical formula for animation\r\n */\r\n Animation.prototype.setEasingFunction = function (easingFunction) {\r\n this._easingFunction = easingFunction;\r\n };\r\n /**\r\n * Interpolates a scalar linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a scalar cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion using a spherical linear interpolation\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Slerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Hermite(startValue, outTangent, endValue, inTangent, gradient).normalize();\r\n };\r\n /**\r\n * Interpolates a Vector3 linearl\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector3 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns InterpolatedVector3 value\r\n */\r\n Animation.prototype.vector3InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a size linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Size value\r\n */\r\n Animation.prototype.sizeInterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Color3 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Color3 value\r\n */\r\n Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._getKeyValue = function (value) {\r\n if (typeof value === \"function\") {\r\n return value();\r\n }\r\n return value;\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._interpolate = function (currentFrame, state) {\r\n if (state.loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && state.repeatCount > 0) {\r\n return state.highLimitValue.clone ? state.highLimitValue.clone() : state.highLimitValue;\r\n }\r\n var keys = this._keys;\r\n if (keys.length === 1) {\r\n return this._getKeyValue(keys[0].value);\r\n }\r\n var startKeyIndex = state.key;\r\n if (keys[startKeyIndex].frame >= currentFrame) {\r\n while (startKeyIndex - 1 >= 0 && keys[startKeyIndex].frame >= currentFrame) {\r\n startKeyIndex--;\r\n }\r\n }\r\n for (var key = startKeyIndex; key < keys.length; key++) {\r\n var endKey = keys[key + 1];\r\n if (endKey.frame >= currentFrame) {\r\n state.key = key;\r\n var startKey = keys[key];\r\n var startValue = this._getKeyValue(startKey.value);\r\n if (startKey.interpolation === _animationKey__WEBPACK_IMPORTED_MODULE_5__[\"AnimationKeyInterpolation\"].STEP) {\r\n return startValue;\r\n }\r\n var endValue = this._getKeyValue(endKey.value);\r\n var useTangent = startKey.outTangent !== undefined && endKey.inTangent !== undefined;\r\n var frameDelta = endKey.frame - startKey.frame;\r\n // gradient : percent of currentFrame between the frame inf and the frame sup\r\n var gradient = (currentFrame - startKey.frame) / frameDelta;\r\n // check for easingFunction and correction of gradient\r\n var easingFunction = this.getEasingFunction();\r\n if (easingFunction != null) {\r\n gradient = easingFunction.ease(gradient);\r\n }\r\n switch (this.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n var floatValue = useTangent ? this.floatInterpolateFunctionWithTangents(startValue, startKey.outTangent * frameDelta, endValue, endKey.inTangent * frameDelta, gradient) : this.floatInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return floatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return state.offsetValue * state.repeatCount + floatValue;\r\n }\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n var quatValue = useTangent ? this.quaternionInterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.quaternionInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return quatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return quatValue.addInPlace(state.offsetValue.scale(state.repeatCount));\r\n }\r\n return quatValue;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n var vec3Value = useTangent ? this.vector3InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector3InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec3Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec3Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n var vec2Value = useTangent ? this.vector2InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector2InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec2Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec2Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Matrix\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n if (Animation.AllowMatricesInterpolation) {\r\n return this.matrixInterpolateFunction(startValue, endValue, gradient, state.workValue);\r\n }\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return startValue;\r\n }\r\n default:\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n return this._getKeyValue(keys[keys.length - 1].value);\r\n };\r\n /**\r\n * Defines the function to use to interpolate matrices\r\n * @param startValue defines the start matrix\r\n * @param endValue defines the end matrix\r\n * @param gradient defines the gradient between both matrices\r\n * @param result defines an optional target matrix where to store the interpolation\r\n * @returns the interpolated matrix\r\n */\r\n Animation.prototype.matrixInterpolateFunction = function (startValue, endValue, gradient, result) {\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerp(startValue, endValue, gradient);\r\n }\r\n if (result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Makes a copy of the animation\r\n * @returns Cloned animation\r\n */\r\n Animation.prototype.clone = function () {\r\n var clone = new Animation(this.name, this.targetPropertyPath.join(\".\"), this.framePerSecond, this.dataType, this.loopMode);\r\n clone.enableBlending = this.enableBlending;\r\n clone.blendingSpeed = this.blendingSpeed;\r\n if (this._keys) {\r\n clone.setKeys(this._keys);\r\n }\r\n if (this._ranges) {\r\n clone._ranges = {};\r\n for (var name in this._ranges) {\r\n var range = this._ranges[name];\r\n if (!range) {\r\n continue;\r\n }\r\n clone._ranges[name] = range.clone();\r\n }\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Sets the key frames of the animation\r\n * @param values The animation key frames to set\r\n */\r\n Animation.prototype.setKeys = function (values) {\r\n this._keys = values.slice(0);\r\n };\r\n /**\r\n * Serializes the animation to an object\r\n * @returns Serialized object\r\n */\r\n Animation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.property = this.targetProperty;\r\n serializationObject.framePerSecond = this.framePerSecond;\r\n serializationObject.dataType = this.dataType;\r\n serializationObject.loopBehavior = this.loopMode;\r\n serializationObject.enableBlending = this.enableBlending;\r\n serializationObject.blendingSpeed = this.blendingSpeed;\r\n var dataType = this.dataType;\r\n serializationObject.keys = [];\r\n var keys = this.getKeys();\r\n for (var index = 0; index < keys.length; index++) {\r\n var animationKey = keys[index];\r\n var key = {};\r\n key.frame = animationKey.frame;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n key.values = [animationKey.value];\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n key.values = animationKey.value.asArray();\r\n break;\r\n }\r\n serializationObject.keys.push(key);\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n return serializationObject;\r\n };\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_FLOAT\", {\r\n /**\r\n * Get the float animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_FLOAT;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_VECTOR3\", {\r\n /**\r\n * Get the Vector3 animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_VECTOR3;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_VECTOR2\", {\r\n /**\r\n * Get the Vector2 animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_VECTOR2;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_SIZE\", {\r\n /**\r\n * Get the Size animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_SIZE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_QUATERNION\", {\r\n /**\r\n * Get the Quaternion animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_QUATERNION;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_MATRIX\", {\r\n /**\r\n * Get the Matrix animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_MATRIX;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_COLOR3\", {\r\n /**\r\n * Get the Color3 animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_COLOR3;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONLOOPMODE_RELATIVE\", {\r\n /**\r\n * Get the Relative Loop Mode\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONLOOPMODE_RELATIVE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONLOOPMODE_CYCLE\", {\r\n /**\r\n * Get the Cycle Loop Mode\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONLOOPMODE_CYCLE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONLOOPMODE_CONSTANT\", {\r\n /**\r\n * Get the Constant Loop Mode\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONLOOPMODE_CONSTANT;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Animation._UniversalLerp = function (left, right, amount) {\r\n var constructor = left.constructor;\r\n if (constructor.Lerp) { // Lerp supported\r\n return constructor.Lerp(left, right, amount);\r\n }\r\n else if (constructor.Slerp) { // Slerp supported\r\n return constructor.Slerp(left, right, amount);\r\n }\r\n else if (left.toFixed) { // Number\r\n return left * (1.0 - amount) + amount * right;\r\n }\r\n else { // Blending not supported\r\n return right;\r\n }\r\n };\r\n /**\r\n * Parses an animation object and creates an animation\r\n * @param parsedAnimation Parsed animation object\r\n * @returns Animation object\r\n */\r\n Animation.Parse = function (parsedAnimation) {\r\n var animation = new Animation(parsedAnimation.name, parsedAnimation.property, parsedAnimation.framePerSecond, parsedAnimation.dataType, parsedAnimation.loopBehavior);\r\n var dataType = parsedAnimation.dataType;\r\n var keys = [];\r\n var data;\r\n var index;\r\n if (parsedAnimation.enableBlending) {\r\n animation.enableBlending = parsedAnimation.enableBlending;\r\n }\r\n if (parsedAnimation.blendingSpeed) {\r\n animation.blendingSpeed = parsedAnimation.blendingSpeed;\r\n }\r\n for (index = 0; index < parsedAnimation.keys.length; index++) {\r\n var key = parsedAnimation.keys[index];\r\n var inTangent;\r\n var outTangent;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n data = key.values[0];\r\n if (key.values.length >= 1) {\r\n inTangent = key.values[1];\r\n }\r\n if (key.values.length >= 2) {\r\n outTangent = key.values[2];\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n data = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromArray(key.values);\r\n if (key.values.length >= 8) {\r\n var _inTangent = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromArray(key.values.slice(4, 8));\r\n if (!_inTangent.equals(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Zero())) {\r\n inTangent = _inTangent;\r\n }\r\n }\r\n if (key.values.length >= 12) {\r\n var _outTangent = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromArray(key.values.slice(8, 12));\r\n if (!_outTangent.equals(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Zero())) {\r\n outTangent = _outTangent;\r\n }\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n data = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n data = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n default:\r\n data = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(key.values);\r\n break;\r\n }\r\n var keyData = {};\r\n keyData.frame = key.frame;\r\n keyData.value = data;\r\n if (inTangent != undefined) {\r\n keyData.inTangent = inTangent;\r\n }\r\n if (outTangent != undefined) {\r\n keyData.outTangent = outTangent;\r\n }\r\n keys.push(keyData);\r\n }\r\n animation.setKeys(keys);\r\n if (parsedAnimation.ranges) {\r\n for (index = 0; index < parsedAnimation.ranges.length; index++) {\r\n data = parsedAnimation.ranges[index];\r\n animation.createRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n Animation.AppendSerializedAnimations = function (source, destination) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"].AppendSerializedAnimations(source, destination);\r\n };\r\n /**\r\n * Use matrix interpolation instead of using direct key value when animating matrices\r\n */\r\n Animation.AllowMatricesInterpolation = false;\r\n /**\r\n * When matrix interpolation is enabled, this boolean forces the system to use Matrix.DecomposeLerp instead of Matrix.Lerp. Interpolation is more precise but slower\r\n */\r\n Animation.AllowMatrixDecomposeForInterpolation = true;\r\n // Statics\r\n /**\r\n * Float animation type\r\n */\r\n Animation._ANIMATIONTYPE_FLOAT = 0;\r\n /**\r\n * Vector3 animation type\r\n */\r\n Animation._ANIMATIONTYPE_VECTOR3 = 1;\r\n /**\r\n * Quaternion animation type\r\n */\r\n Animation._ANIMATIONTYPE_QUATERNION = 2;\r\n /**\r\n * Matrix animation type\r\n */\r\n Animation._ANIMATIONTYPE_MATRIX = 3;\r\n /**\r\n * Color3 animation type\r\n */\r\n Animation._ANIMATIONTYPE_COLOR3 = 4;\r\n /**\r\n * Vector2 animation type\r\n */\r\n Animation._ANIMATIONTYPE_VECTOR2 = 5;\r\n /**\r\n * Size animation type\r\n */\r\n Animation._ANIMATIONTYPE_SIZE = 6;\r\n /**\r\n * Relative Loop Mode\r\n */\r\n Animation._ANIMATIONLOOPMODE_RELATIVE = 0;\r\n /**\r\n * Cycle Loop Mode\r\n */\r\n Animation._ANIMATIONLOOPMODE_CYCLE = 1;\r\n /**\r\n * Constant Loop Mode\r\n */\r\n Animation._ANIMATIONLOOPMODE_CONSTANT = 2;\r\n return Animation;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Animation\"] = Animation;\r\n_node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"]._AnimationRangeFactory = function (name, from, to) { return new _animationRange__WEBPACK_IMPORTED_MODULE_6__[\"AnimationRange\"](name, from, to); };\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationEvent.ts\":\n/*!**************************************!*\\\n !*** ./Animations/animationEvent.ts ***!\n \\**************************************/\n/*! exports provided: AnimationEvent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return AnimationEvent; });\n/**\r\n * Composed of a frame, and an action function\r\n */\r\nvar AnimationEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the animation event\r\n * @param frame The frame for which the event is triggered\r\n * @param action The event to perform when triggered\r\n * @param onlyOnce Specifies if the event should be triggered only once\r\n */\r\n function AnimationEvent(\r\n /** The frame for which the event is triggered **/\r\n frame, \r\n /** The event to perform when triggered **/\r\n action, \r\n /** Specifies if the event should be triggered only once**/\r\n onlyOnce) {\r\n this.frame = frame;\r\n this.action = action;\r\n this.onlyOnce = onlyOnce;\r\n /**\r\n * Specifies if the animation event is done\r\n */\r\n this.isDone = false;\r\n }\r\n /** @hidden */\r\n AnimationEvent.prototype._clone = function () {\r\n return new AnimationEvent(this.frame, this.action, this.onlyOnce);\r\n };\r\n return AnimationEvent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationGroup.ts\":\n/*!**************************************!*\\\n !*** ./Animations/animationGroup.ts ***!\n \\**************************************/\n/*! exports provided: TargetedAnimation, AnimationGroup */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return TargetedAnimation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return AnimationGroup; });\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _animatable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./animatable */ \"./Animations/animatable.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nvar TargetedAnimation = /** @class */ (function () {\r\n function TargetedAnimation() {\r\n }\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n TargetedAnimation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n return serializationObject;\r\n };\r\n return TargetedAnimation;\r\n}());\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nvar AnimationGroup = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see http://doc.babylonjs.com/how_to/group\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n */\r\n function AnimationGroup(\r\n /** The name of the animation group */\r\n name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n this._targetedAnimations = new Array();\r\n this._animatables = new Array();\r\n this._from = Number.MAX_VALUE;\r\n this._to = -Number.MAX_VALUE;\r\n this._speedRatio = 1;\r\n this._loopAnimation = false;\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n this.onAnimationEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n this.onAnimationLoopObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n this.onAnimationGroupEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n this.onAnimationGroupPauseObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n this.onAnimationGroupPlayObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedScene;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.animationGroups.push(this);\r\n }\r\n Object.defineProperty(AnimationGroup.prototype, \"from\", {\r\n /**\r\n * Gets the first frame\r\n */\r\n get: function () {\r\n return this._from;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"to\", {\r\n /**\r\n * Gets the last frame\r\n */\r\n get: function () {\r\n return this._to;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isStarted\", {\r\n /**\r\n * Define if the animations are started\r\n */\r\n get: function () {\r\n return this._isStarted;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isPlaying\", {\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n get: function () {\r\n return this._isStarted && !this._isPaused;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n set: function (value) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n this._speedRatio = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"loopAnimation\", {\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n get: function () {\r\n return this._loopAnimation;\r\n },\r\n set: function (value) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n this._loopAnimation = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"targetedAnimations\", {\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n get: function () {\r\n return this._targetedAnimations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"animatables\", {\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n get: function () {\r\n return this._animatables;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n AnimationGroup.prototype.addTargetedAnimation = function (animation, target) {\r\n var targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n var keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n this._targetedAnimations.push(targetedAnimation);\r\n return targetedAnimation;\r\n };\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.normalize = function (beginFrame, endFrame) {\r\n if (beginFrame === void 0) { beginFrame = null; }\r\n if (endFrame === void 0) { endFrame = null; }\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n for (var index = 0; index < this._targetedAnimations.length; index++) {\r\n var targetedAnimation = this._targetedAnimations[index];\r\n var keys = targetedAnimation.animation.getKeys();\r\n var startKey = keys[0];\r\n var endKey = keys[keys.length - 1];\r\n if (startKey.frame > beginFrame) {\r\n var newKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n if (endKey.frame < endFrame) {\r\n var newKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.outTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n return this;\r\n };\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @returns the current animation group\r\n */\r\n AnimationGroup.prototype.start = function (loop, speedRatio, from, to) {\r\n var _this = this;\r\n if (loop === void 0) { loop = false; }\r\n if (speedRatio === void 0) { speedRatio = 1; }\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n this._loopAnimation = loop;\r\n var _loop_1 = function (targetedAnimation) {\r\n var animatable = this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio);\r\n animatable.onAnimationEnd = function () {\r\n _this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n _this._checkAnimationGroupEnded(animatable);\r\n };\r\n animatable.onAnimationLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n };\r\n this_1._animatables.push(animatable);\r\n };\r\n var this_1 = this;\r\n for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {\r\n var targetedAnimation = _a[_i];\r\n _loop_1(targetedAnimation);\r\n }\r\n this._speedRatio = speedRatio;\r\n if (from !== undefined && to !== undefined) {\r\n if (from < to && this._speedRatio < 0) {\r\n var temp = to;\r\n to = from;\r\n from = temp;\r\n }\r\n else if (from > to && this._speedRatio > 0) {\r\n this._speedRatio = -speedRatio;\r\n }\r\n }\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.pause = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n this._isPaused = true;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.play = function (loop) {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n }\r\n else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n this._isPaused = false;\r\n return this;\r\n };\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.reset = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.restart = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.stop = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n var list = this._animatables.slice();\r\n for (var index = 0; index < list.length; index++) {\r\n list[index].stop();\r\n }\r\n this._isStarted = false;\r\n return this;\r\n };\r\n /**\r\n * Set animation weight for all animatables\r\n * @param weight defines the weight to use\r\n * @return the animationGroup\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with\r\n * @return the animationGroup\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.syncAllAnimationsWith = function (root) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @return the animationGroup\r\n */\r\n AnimationGroup.prototype.goToFrame = function (frame) {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Dispose all associated resources\r\n */\r\n AnimationGroup.prototype.dispose = function () {\r\n this._targetedAnimations = [];\r\n this._animatables = [];\r\n var index = this._scene.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n };\r\n AnimationGroup.prototype._checkAnimationGroupEnded = function (animatable) {\r\n // animatable should be taken out of the array\r\n var idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @returns the new aniamtion group\r\n */\r\n AnimationGroup.prototype.clone = function (newName, targetConverter) {\r\n var newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {\r\n var targetAnimation = _a[_i];\r\n newGroup.addTargetedAnimation(targetAnimation.animation.clone(), targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target);\r\n }\r\n return newGroup;\r\n };\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n AnimationGroup.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (var targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n var targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n AnimationGroup.Parse = function (parsedAnimationGroup, scene) {\r\n var animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (var i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n var targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n var animation = _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].Parse(targetedAnimation.animation);\r\n var id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") { // morph target animation\r\n var morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n }\r\n else {\r\n var targetNode = scene.getNodeByID(id);\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.from !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n return animationGroup;\r\n };\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n AnimationGroup.prototype.getClassName = function () {\r\n return \"AnimationGroup\";\r\n };\r\n /**\r\n * Creates a detailled string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n AnimationGroup.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n };\r\n return AnimationGroup;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationKey.ts\":\n/*!************************************!*\\\n !*** ./Animations/animationKey.ts ***!\n \\************************************/\n/*! exports provided: AnimationKeyInterpolation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return AnimationKeyInterpolation; });\n/**\r\n * Enum for the animation key frame interpolation type\r\n */\r\nvar AnimationKeyInterpolation;\r\n(function (AnimationKeyInterpolation) {\r\n /**\r\n * Do not interpolate between keys and use the start key value only. Tangents are ignored\r\n */\r\n AnimationKeyInterpolation[AnimationKeyInterpolation[\"STEP\"] = 1] = \"STEP\";\r\n})(AnimationKeyInterpolation || (AnimationKeyInterpolation = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationPropertiesOverride.ts\":\n/*!***************************************************!*\\\n !*** ./Animations/animationPropertiesOverride.ts ***!\n \\***************************************************/\n/*! exports provided: AnimationPropertiesOverride */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return AnimationPropertiesOverride; });\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Animations/animation */ \"./Animations/animation.ts\");\n\r\n/**\r\n * Class used to override all child animations of a given target\r\n */\r\nvar AnimationPropertiesOverride = /** @class */ (function () {\r\n function AnimationPropertiesOverride() {\r\n /**\r\n * Gets or sets a value indicating if animation blending must be used\r\n */\r\n this.enableBlending = false;\r\n /**\r\n * Gets or sets the blending speed to use when enableBlending is true\r\n */\r\n this.blendingSpeed = 0.01;\r\n /**\r\n * Gets or sets the default loop mode to use\r\n */\r\n this.loopMode = _Animations_animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE;\r\n }\r\n return AnimationPropertiesOverride;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationRange.ts\":\n/*!**************************************!*\\\n !*** ./Animations/animationRange.ts ***!\n \\**************************************/\n/*! exports provided: AnimationRange */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return AnimationRange; });\n/**\r\n * Represents the range of an animation\r\n */\r\nvar AnimationRange = /** @class */ (function () {\r\n /**\r\n * Initializes the range of an animation\r\n * @param name The name of the animation range\r\n * @param from The starting frame of the animation\r\n * @param to The ending frame of the animation\r\n */\r\n function AnimationRange(\r\n /**The name of the animation range**/\r\n name, \r\n /**The starting frame of the animation */\r\n from, \r\n /**The ending frame of the animation*/\r\n to) {\r\n this.name = name;\r\n this.from = from;\r\n this.to = to;\r\n }\r\n /**\r\n * Makes a copy of the animation range\r\n * @returns A copy of the animation range\r\n */\r\n AnimationRange.prototype.clone = function () {\r\n return new AnimationRange(this.name, this.from, this.to);\r\n };\r\n return AnimationRange;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/easing.ts\":\n/*!******************************!*\\\n !*** ./Animations/easing.ts ***!\n \\******************************/\n/*! exports provided: EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return EasingFunction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return CircleEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return BackEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return BounceEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return CubicEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return ElasticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return ExponentialEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return PowerEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return QuadraticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return QuarticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return QuinticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return SineEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return BezierCurveEase; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n/**\r\n * Base class used for every default easing function.\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar EasingFunction = /** @class */ (function () {\r\n function EasingFunction() {\r\n this._easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n }\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n EasingFunction.prototype.setEasingMode = function (easingMode) {\r\n var n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n };\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n EasingFunction.prototype.getEasingMode = function () {\r\n return this._easingMode;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n EasingFunction.prototype.easeInCore = function (gradient) {\r\n throw new Error('You must implement this method');\r\n };\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n EasingFunction.prototype.ease = function (gradient) {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return (1 - this.easeInCore(1 - gradient));\r\n }\r\n if (gradient >= 0.5) {\r\n return (((1 - this.easeInCore((1 - gradient) * 2)) * 0.5) + 0.5);\r\n }\r\n return (this.easeInCore(gradient * 2) * 0.5);\r\n };\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEIN = 0;\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEOUT = 1;\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n EasingFunction.EASINGMODE_EASEINOUT = 2;\r\n return EasingFunction;\r\n}());\r\n\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CircleEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CircleEase, _super);\r\n function CircleEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CircleEase.prototype.easeInCore = function (gradient) {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return (1.0 - Math.sqrt(1.0 - (gradient * gradient)));\r\n };\r\n return CircleEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BackEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BackEase, _super);\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n function BackEase(\r\n /** Defines the amplitude of the function */\r\n amplitude) {\r\n if (amplitude === void 0) { amplitude = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.amplitude = amplitude;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BackEase.prototype.easeInCore = function (gradient) {\r\n var num = Math.max(0, this.amplitude);\r\n return (Math.pow(gradient, 3.0) - ((gradient * num) * Math.sin(3.1415926535897931 * gradient)));\r\n };\r\n return BackEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BounceEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BounceEase, _super);\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n function BounceEase(\r\n /** Defines the number of bounces */\r\n bounces, \r\n /** Defines the amplitude of the bounce */\r\n bounciness) {\r\n if (bounces === void 0) { bounces = 3; }\r\n if (bounciness === void 0) { bounciness = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.bounces = bounces;\r\n _this.bounciness = bounciness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BounceEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.bounces);\r\n var bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n var num9 = Math.pow(bounciness, y);\r\n var num5 = 1.0 - bounciness;\r\n var num4 = ((1.0 - num9) / num5) + (num9 * 0.5);\r\n var num15 = gradient * num4;\r\n var num65 = Math.log((-num15 * (1.0 - bounciness)) + 1.0) / Math.log(bounciness);\r\n var num3 = Math.floor(num65);\r\n var num13 = num3 + 1.0;\r\n var num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n var num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n var num7 = (num8 + num12) * 0.5;\r\n var num6 = gradient - num7;\r\n var num2 = num7 - num8;\r\n return (((-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2)) * (num6 + num2));\r\n };\r\n return BounceEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CubicEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CubicEase, _super);\r\n function CubicEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CubicEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient);\r\n };\r\n return CubicEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ElasticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ElasticEase, _super);\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n function ElasticEase(\r\n /** Defines the number of oscillations*/\r\n oscillations, \r\n /** Defines the amplitude of the oscillations*/\r\n springiness) {\r\n if (oscillations === void 0) { oscillations = 3; }\r\n if (springiness === void 0) { springiness = 3; }\r\n var _this = _super.call(this) || this;\r\n _this.oscillations = oscillations;\r\n _this.springiness = springiness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ElasticEase.prototype.easeInCore = function (gradient) {\r\n var num2;\r\n var num3 = Math.max(0.0, this.oscillations);\r\n var num = Math.max(0.0, this.springiness);\r\n if (num == 0) {\r\n num2 = gradient;\r\n }\r\n else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return (num2 * Math.sin(((6.2831853071795862 * num3) + 1.5707963267948966) * gradient));\r\n };\r\n return ElasticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ExponentialEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ExponentialEase, _super);\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n function ExponentialEase(\r\n /** Defines the exponent of the function */\r\n exponent) {\r\n if (exponent === void 0) { exponent = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ExponentialEase.prototype.easeInCore = function (gradient) {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n return ((Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0));\r\n };\r\n return ExponentialEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar PowerEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PowerEase, _super);\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n function PowerEase(\r\n /** Defines the power of the function */\r\n power) {\r\n if (power === void 0) { power = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.power = power;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PowerEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n };\r\n return PowerEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuadraticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](QuadraticEase, _super);\r\n function QuadraticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuadraticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient);\r\n };\r\n return QuadraticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuarticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](QuarticEase, _super);\r\n function QuarticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuarticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient);\r\n };\r\n return QuarticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuinticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](QuinticEase, _super);\r\n function QuinticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuinticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient * gradient);\r\n };\r\n return QuinticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar SineEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SineEase, _super);\r\n function SineEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n SineEase.prototype.easeInCore = function (gradient) {\r\n return (1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient)));\r\n };\r\n return SineEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BezierCurveEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BezierCurveEase, _super);\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n function BezierCurveEase(\r\n /** Defines the x component of the start tangent in the bezier curve */\r\n x1, \r\n /** Defines the y component of the start tangent in the bezier curve */\r\n y1, \r\n /** Defines the x component of the end tangent in the bezier curve */\r\n x2, \r\n /** Defines the y component of the end tangent in the bezier curve */\r\n y2) {\r\n if (x1 === void 0) { x1 = 0; }\r\n if (y1 === void 0) { y1 = 0; }\r\n if (x2 === void 0) { x2 = 1; }\r\n if (y2 === void 0) { y2 = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.x1 = x1;\r\n _this.y1 = y1;\r\n _this.x2 = x2;\r\n _this.y2 = y2;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BezierCurveEase.prototype.easeInCore = function (gradient) {\r\n return _Maths_math_path__WEBPACK_IMPORTED_MODULE_1__[\"BezierCurve\"].Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n };\r\n return BezierCurveEase;\r\n}(EasingFunction));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/index.ts\":\n/*!*****************************!*\\\n !*** ./Animations/index.ts ***!\n \\*****************************/\n/*! exports provided: Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _animatable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./animatable */ \"./Animations/animatable.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return _animatable__WEBPACK_IMPORTED_MODULE_0__[\"Animatable\"]; });\n\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _animation__WEBPACK_IMPORTED_MODULE_1__[\"_IAnimationState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return _animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"]; });\n\n/* harmony import */ var _animationGroup__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./animationGroup */ \"./Animations/animationGroup.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return _animationGroup__WEBPACK_IMPORTED_MODULE_2__[\"TargetedAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return _animationGroup__WEBPACK_IMPORTED_MODULE_2__[\"AnimationGroup\"]; });\n\n/* harmony import */ var _animationPropertiesOverride__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./animationPropertiesOverride */ \"./Animations/animationPropertiesOverride.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return _animationPropertiesOverride__WEBPACK_IMPORTED_MODULE_3__[\"AnimationPropertiesOverride\"]; });\n\n/* harmony import */ var _easing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./easing */ \"./Animations/easing.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"EasingFunction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"CircleEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"BackEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"BounceEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"CubicEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"ElasticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"ExponentialEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"PowerEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"QuadraticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"QuarticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"QuinticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"SineEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"BezierCurveEase\"]; });\n\n/* harmony import */ var _runtimeAnimation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./runtimeAnimation */ \"./Animations/runtimeAnimation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return _runtimeAnimation__WEBPACK_IMPORTED_MODULE_5__[\"RuntimeAnimation\"]; });\n\n/* harmony import */ var _animationEvent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./animationEvent */ \"./Animations/animationEvent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return _animationEvent__WEBPACK_IMPORTED_MODULE_6__[\"AnimationEvent\"]; });\n\n/* empty/unused harmony star reexport *//* harmony import */ var _animationKey__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./animationKey */ \"./Animations/animationKey.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return _animationKey__WEBPACK_IMPORTED_MODULE_7__[\"AnimationKeyInterpolation\"]; });\n\n/* harmony import */ var _animationRange__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./animationRange */ \"./Animations/animationRange.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return _animationRange__WEBPACK_IMPORTED_MODULE_8__[\"AnimationRange\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/runtimeAnimation.ts\":\n/*!****************************************!*\\\n !*** ./Animations/runtimeAnimation.ts ***!\n \\****************************************/\n/*! exports provided: RuntimeAnimation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return RuntimeAnimation; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.size */ \"./Maths/math.size.ts\");\n\r\n\r\n\r\n\r\n// Static values to help the garbage collector\r\n// Quaternion\r\nvar _staticOffsetValueQuaternion = Object.freeze(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"](0, 0, 0, 0));\r\n// Vector3\r\nvar _staticOffsetValueVector3 = Object.freeze(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero());\r\n// Vector2\r\nvar _staticOffsetValueVector2 = Object.freeze(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero());\r\n// Size\r\nvar _staticOffsetValueSize = Object.freeze(_Maths_math_size__WEBPACK_IMPORTED_MODULE_3__[\"Size\"].Zero());\r\n// Color3\r\nvar _staticOffsetValueColor3 = Object.freeze(_Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].Black());\r\n/**\r\n * Defines a runtime animation\r\n */\r\nvar RuntimeAnimation = /** @class */ (function () {\r\n /**\r\n * Create a new RuntimeAnimation object\r\n * @param target defines the target of the animation\r\n * @param animation defines the source animation object\r\n * @param scene defines the hosting scene\r\n * @param host defines the initiating Animatable\r\n */\r\n function RuntimeAnimation(target, animation, scene, host) {\r\n var _this = this;\r\n this._events = new Array();\r\n /**\r\n * The current frame of the runtime animation\r\n */\r\n this._currentFrame = 0;\r\n /**\r\n * The original value of the runtime animation\r\n */\r\n this._originalValue = new Array();\r\n /**\r\n * The original blend value of the runtime animation\r\n */\r\n this._originalBlendValue = null;\r\n /**\r\n * The offsets cache of the runtime animation\r\n */\r\n this._offsetsCache = {};\r\n /**\r\n * The high limits cache of the runtime animation\r\n */\r\n this._highLimitsCache = {};\r\n /**\r\n * Specifies if the runtime animation has been stopped\r\n */\r\n this._stopped = false;\r\n /**\r\n * The blending factor of the runtime animation\r\n */\r\n this._blendingFactor = 0;\r\n /**\r\n * The current value of the runtime animation\r\n */\r\n this._currentValue = null;\r\n this._currentActiveTarget = null;\r\n this._directTarget = null;\r\n /**\r\n * The target path of the runtime animation\r\n */\r\n this._targetPath = \"\";\r\n /**\r\n * The weight of the runtime animation\r\n */\r\n this._weight = 1.0;\r\n /**\r\n * The ratio offset of the runtime animation\r\n */\r\n this._ratioOffset = 0;\r\n /**\r\n * The previous delay of the runtime animation\r\n */\r\n this._previousDelay = 0;\r\n /**\r\n * The previous ratio of the runtime animation\r\n */\r\n this._previousRatio = 0;\r\n this._targetIsArray = false;\r\n this._animation = animation;\r\n this._target = target;\r\n this._scene = scene;\r\n this._host = host;\r\n this._activeTargets = [];\r\n animation._runtimeAnimations.push(this);\r\n // State\r\n this._animationState = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: this._getCorrectLoopMode()\r\n };\r\n if (this._animation.dataType === _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_MATRIX) {\r\n this._animationState.workValue = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Zero();\r\n }\r\n // Limits\r\n this._keys = this._animation.getKeys();\r\n this._minFrame = this._keys[0].frame;\r\n this._maxFrame = this._keys[this._keys.length - 1].frame;\r\n this._minValue = this._keys[0].value;\r\n this._maxValue = this._keys[this._keys.length - 1].value;\r\n // Add a start key at frame 0 if missing\r\n if (this._minFrame !== 0) {\r\n var newKey = { frame: 0, value: this._minValue };\r\n this._keys.splice(0, 0, newKey);\r\n }\r\n // Check data\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target_1 = _a[_i];\r\n this._preparePath(target_1, index);\r\n this._getOriginalValues(index);\r\n index++;\r\n }\r\n this._targetIsArray = true;\r\n }\r\n else {\r\n this._preparePath(this._target);\r\n this._getOriginalValues();\r\n this._targetIsArray = false;\r\n this._directTarget = this._activeTargets[0];\r\n }\r\n // Cloning events locally\r\n var events = animation.getEvents();\r\n if (events && events.length > 0) {\r\n events.forEach(function (e) {\r\n _this._events.push(e._clone());\r\n });\r\n }\r\n this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;\r\n }\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentFrame\", {\r\n /**\r\n * Gets the current frame of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentFrame;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"weight\", {\r\n /**\r\n * Gets the weight of the runtime animation\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentValue\", {\r\n /**\r\n * Gets the current value of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"targetPath\", {\r\n /**\r\n * Gets the target path of the runtime animation\r\n */\r\n get: function () {\r\n return this._targetPath;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"target\", {\r\n /**\r\n * Gets the actual target of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentActiveTarget;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RuntimeAnimation.prototype._preparePath = function (target, targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var targetPropertyPath = this._animation.targetPropertyPath;\r\n if (targetPropertyPath.length > 1) {\r\n var property = target[targetPropertyPath[0]];\r\n for (var index = 1; index < targetPropertyPath.length - 1; index++) {\r\n property = property[targetPropertyPath[index]];\r\n }\r\n this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];\r\n this._activeTargets[targetIndex] = property;\r\n }\r\n else {\r\n this._targetPath = targetPropertyPath[0];\r\n this._activeTargets[targetIndex] = target;\r\n }\r\n };\r\n Object.defineProperty(RuntimeAnimation.prototype, \"animation\", {\r\n /**\r\n * Gets the animation from the runtime animation\r\n */\r\n get: function () {\r\n return this._animation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the runtime animation to the beginning\r\n * @param restoreOriginal defines whether to restore the target property to the original value\r\n */\r\n RuntimeAnimation.prototype.reset = function (restoreOriginal) {\r\n if (restoreOriginal === void 0) { restoreOriginal = false; }\r\n if (restoreOriginal) {\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (this._originalValue[index] !== undefined) {\r\n this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);\r\n }\r\n index++;\r\n }\r\n }\r\n else {\r\n if (this._originalValue[0] !== undefined) {\r\n this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);\r\n }\r\n }\r\n }\r\n this._offsetsCache = {};\r\n this._highLimitsCache = {};\r\n this._currentFrame = 0;\r\n this._blendingFactor = 0;\r\n // Events\r\n for (var index = 0; index < this._events.length; index++) {\r\n this._events[index].isDone = false;\r\n }\r\n };\r\n /**\r\n * Specifies if the runtime animation is stopped\r\n * @returns Boolean specifying if the runtime animation is stopped\r\n */\r\n RuntimeAnimation.prototype.isStopped = function () {\r\n return this._stopped;\r\n };\r\n /**\r\n * Disposes of the runtime animation\r\n */\r\n RuntimeAnimation.prototype.dispose = function () {\r\n var index = this._animation.runtimeAnimations.indexOf(this);\r\n if (index > -1) {\r\n this._animation.runtimeAnimations.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Apply the interpolated value to the target\r\n * @param currentValue defines the value computed by the animation\r\n * @param weight defines the weight to apply to this value (Defaults to 1.0)\r\n */\r\n RuntimeAnimation.prototype.setValue = function (currentValue, weight) {\r\n if (this._targetIsArray) {\r\n for (var index = 0; index < this._target.length; index++) {\r\n var target = this._target[index];\r\n this._setValue(target, this._activeTargets[index], currentValue, weight, index);\r\n }\r\n return;\r\n }\r\n this._setValue(this._target, this._directTarget, currentValue, weight, 0);\r\n };\r\n RuntimeAnimation.prototype._getOriginalValues = function (targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var originalValue;\r\n var target = this._activeTargets[targetIndex];\r\n if (target.getRestPose && this._targetPath === \"_matrix\") { // For bones\r\n originalValue = target.getRestPose();\r\n }\r\n else {\r\n originalValue = target[this._targetPath];\r\n }\r\n if (originalValue && originalValue.clone) {\r\n this._originalValue[targetIndex] = originalValue.clone();\r\n }\r\n else {\r\n this._originalValue[targetIndex] = originalValue;\r\n }\r\n };\r\n RuntimeAnimation.prototype._setValue = function (target, destination, currentValue, weight, targetIndex) {\r\n // Set value\r\n this._currentActiveTarget = destination;\r\n this._weight = weight;\r\n if (this._enableBlending && this._blendingFactor <= 1.0) {\r\n if (!this._originalBlendValue) {\r\n var originalValue = destination[this._targetPath];\r\n if (originalValue.clone) {\r\n this._originalBlendValue = originalValue.clone();\r\n }\r\n else {\r\n this._originalBlendValue = originalValue;\r\n }\r\n }\r\n if (this._originalBlendValue.m) { // Matrix\r\n if (_animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].AllowMatrixDecomposeForInterpolation) {\r\n if (this._currentValue) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n else {\r\n if (this._currentValue) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Lerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n }\r\n else {\r\n this._currentValue = _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"]._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;\r\n this._blendingFactor += blendingSpeed;\r\n }\r\n else {\r\n this._currentValue = currentValue;\r\n }\r\n if (weight !== -1.0) {\r\n this._scene._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);\r\n }\r\n else {\r\n destination[this._targetPath] = this._currentValue;\r\n }\r\n if (target.markAsDirty) {\r\n target.markAsDirty(this._animation.targetProperty);\r\n }\r\n };\r\n /**\r\n * Gets the loop pmode of the runtime animation\r\n * @returns Loop Mode\r\n */\r\n RuntimeAnimation.prototype._getCorrectLoopMode = function () {\r\n if (this._target && this._target.animationPropertiesOverride) {\r\n return this._target.animationPropertiesOverride.loopMode;\r\n }\r\n return this._animation.loopMode;\r\n };\r\n /**\r\n * Move the current animation to a given frame\r\n * @param frame defines the frame to move to\r\n */\r\n RuntimeAnimation.prototype.goToFrame = function (frame) {\r\n var keys = this._animation.getKeys();\r\n if (frame < keys[0].frame) {\r\n frame = keys[0].frame;\r\n }\r\n else if (frame > keys[keys.length - 1].frame) {\r\n frame = keys[keys.length - 1].frame;\r\n }\r\n // Need to reset animation events\r\n var events = this._events;\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset events in the future\r\n events[index].isDone = events[index].frame < frame;\r\n }\r\n }\r\n }\r\n this._currentFrame = frame;\r\n var currentValue = this._animation._interpolate(frame, this._animationState);\r\n this.setValue(currentValue, -1);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {\r\n var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;\r\n this._ratioOffset = this._previousRatio - newRatio;\r\n };\r\n /**\r\n * Execute the current animation\r\n * @param delay defines the delay to add to the current frame\r\n * @param from defines the lower bound of the animation range\r\n * @param to defines the upper bound of the animation range\r\n * @param loop defines if the current animation must loop\r\n * @param speedRatio defines the current speed ratio\r\n * @param weight defines the weight of the animation (default is -1 so no weight)\r\n * @param onLoop optional callback called when animation loops\r\n * @returns a boolean indicating if the animation is running\r\n */\r\n RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {\r\n if (weight === void 0) { weight = -1.0; }\r\n var animation = this._animation;\r\n var targetPropertyPath = animation.targetPropertyPath;\r\n if (!targetPropertyPath || targetPropertyPath.length < 1) {\r\n this._stopped = true;\r\n return false;\r\n }\r\n var returnValue = true;\r\n // Check limits\r\n if (from < this._minFrame || from > this._maxFrame) {\r\n from = this._minFrame;\r\n }\r\n if (to < this._minFrame || to > this._maxFrame) {\r\n to = this._maxFrame;\r\n }\r\n var range = to - from;\r\n var offsetValue;\r\n // Compute ratio which represents the frame delta between from and to\r\n var ratio = (delay * (animation.framePerSecond * speedRatio) / 1000.0) + this._ratioOffset;\r\n var highLimitValue = 0;\r\n this._previousDelay = delay;\r\n this._previousRatio = ratio;\r\n if (!loop && (to >= from && ratio >= range)) { // If we are out of range and not looping get back to caller\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._maxValue);\r\n }\r\n else if (!loop && (from >= to && ratio <= range)) {\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._minValue);\r\n }\r\n else if (this._animationState.loopMode !== _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE) {\r\n var keyOffset = to.toString() + from.toString();\r\n if (!this._offsetsCache[keyOffset]) {\r\n this._animationState.repeatCount = 0;\r\n this._animationState.loopMode = _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE;\r\n var fromValue = animation._interpolate(from, this._animationState);\r\n var toValue = animation._interpolate(to, this._animationState);\r\n this._animationState.loopMode = this._getCorrectLoopMode();\r\n switch (animation.dataType) {\r\n // Float\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_FLOAT:\r\n this._offsetsCache[keyOffset] = toValue - fromValue;\r\n break;\r\n // Quaternion\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_QUATERNION:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Vector2\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR2:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Size\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_SIZE:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Color3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_COLOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n default:\r\n break;\r\n }\r\n this._highLimitsCache[keyOffset] = toValue;\r\n }\r\n highLimitValue = this._highLimitsCache[keyOffset];\r\n offsetValue = this._offsetsCache[keyOffset];\r\n }\r\n if (offsetValue === undefined) {\r\n switch (animation.dataType) {\r\n // Float\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_FLOAT:\r\n offsetValue = 0;\r\n break;\r\n // Quaternion\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_QUATERNION:\r\n offsetValue = _staticOffsetValueQuaternion;\r\n break;\r\n // Vector3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR3:\r\n offsetValue = _staticOffsetValueVector3;\r\n break;\r\n // Vector2\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR2:\r\n offsetValue = _staticOffsetValueVector2;\r\n break;\r\n // Size\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_SIZE:\r\n offsetValue = _staticOffsetValueSize;\r\n break;\r\n // Color3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_COLOR3:\r\n offsetValue = _staticOffsetValueColor3;\r\n }\r\n }\r\n // Compute value\r\n var currentFrame;\r\n if (this._host && this._host.syncRoot) {\r\n var syncRoot = this._host.syncRoot;\r\n var hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);\r\n currentFrame = from + (to - from) * hostNormalizedFrame;\r\n }\r\n else {\r\n currentFrame = (returnValue && range !== 0) ? from + ratio % range : to;\r\n }\r\n // Reset events if looping\r\n var events = this._events;\r\n if (range > 0 && this.currentFrame > currentFrame ||\r\n range < 0 && this.currentFrame < currentFrame) {\r\n this._onLoop();\r\n // Need to reset animation events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset event, the animation is looping\r\n events[index].isDone = false;\r\n }\r\n }\r\n }\r\n }\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = range === 0 ? 0 : (ratio / range) >> 0;\r\n this._animationState.highLimitValue = highLimitValue;\r\n this._animationState.offsetValue = offsetValue;\r\n var currentValue = animation._interpolate(currentFrame, this._animationState);\r\n // Set value\r\n this.setValue(currentValue, weight);\r\n // Check events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n // Make sure current frame has passed event frame and that event frame is within the current range\r\n // Also, handle both forward and reverse animations\r\n if ((range > 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||\r\n (range < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {\r\n var event = events[index];\r\n if (!event.isDone) {\r\n // If event should be done only once, remove it.\r\n if (event.onlyOnce) {\r\n events.splice(index, 1);\r\n index--;\r\n }\r\n event.isDone = true;\r\n event.action(currentFrame);\r\n } // Don't do anything if the event has already be done.\r\n }\r\n }\r\n }\r\n if (!returnValue) {\r\n this._stopped = true;\r\n }\r\n return returnValue;\r\n };\r\n return RuntimeAnimation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/analyser.ts\":\n/*!***************************!*\\\n !*** ./Audio/analyser.ts ***!\n \\***************************/\n/*! exports provided: Analyser */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return Analyser; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/**\r\n * Class used to work with sound analyzer using fast fourier transform (FFT)\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar Analyser = /** @class */ (function () {\r\n /**\r\n * Creates a new analyser\r\n * @param scene defines hosting scene\r\n */\r\n function Analyser(scene) {\r\n /**\r\n * Gets or sets the smoothing\r\n * @ignorenaming\r\n */\r\n this.SMOOTHING = 0.75;\r\n /**\r\n * Gets or sets the FFT table size\r\n * @ignorenaming\r\n */\r\n this.FFT_SIZE = 512;\r\n /**\r\n * Gets or sets the bar graph amplitude\r\n * @ignorenaming\r\n */\r\n this.BARGRAPHAMPLITUDE = 256;\r\n /**\r\n * Gets or sets the position of the debug canvas\r\n * @ignorenaming\r\n */\r\n this.DEBUGCANVASPOS = { x: 20, y: 20 };\r\n /**\r\n * Gets or sets the debug canvas size\r\n * @ignorenaming\r\n */\r\n this.DEBUGCANVASSIZE = { width: 320, height: 200 };\r\n this._scene = scene;\r\n this._audioEngine = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine;\r\n if (this._audioEngine.canUseWebAudio && this._audioEngine.audioContext) {\r\n this._webAudioAnalyser = this._audioEngine.audioContext.createAnalyser();\r\n this._webAudioAnalyser.minDecibels = -140;\r\n this._webAudioAnalyser.maxDecibels = 0;\r\n this._byteFreqs = new Uint8Array(this._webAudioAnalyser.frequencyBinCount);\r\n this._byteTime = new Uint8Array(this._webAudioAnalyser.frequencyBinCount);\r\n this._floatFreqs = new Float32Array(this._webAudioAnalyser.frequencyBinCount);\r\n }\r\n }\r\n /**\r\n * Get the number of data values you will have to play with for the visualization\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/frequencyBinCount\r\n * @returns a number\r\n */\r\n Analyser.prototype.getFrequencyBinCount = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n return this._webAudioAnalyser.frequencyBinCount;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Gets the current frequency data as a byte array\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData\r\n * @returns a Uint8Array\r\n */\r\n Analyser.prototype.getByteFrequencyData = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;\r\n this._webAudioAnalyser.fftSize = this.FFT_SIZE;\r\n this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs);\r\n }\r\n return this._byteFreqs;\r\n };\r\n /**\r\n * Gets the current waveform as a byte array\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteTimeDomainData\r\n * @returns a Uint8Array\r\n */\r\n Analyser.prototype.getByteTimeDomainData = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;\r\n this._webAudioAnalyser.fftSize = this.FFT_SIZE;\r\n this._webAudioAnalyser.getByteTimeDomainData(this._byteTime);\r\n }\r\n return this._byteTime;\r\n };\r\n /**\r\n * Gets the current frequency data as a float array\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData\r\n * @returns a Float32Array\r\n */\r\n Analyser.prototype.getFloatFrequencyData = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;\r\n this._webAudioAnalyser.fftSize = this.FFT_SIZE;\r\n this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs);\r\n }\r\n return this._floatFreqs;\r\n };\r\n /**\r\n * Renders the debug canvas\r\n */\r\n Analyser.prototype.drawDebugCanvas = function () {\r\n var _this = this;\r\n if (this._audioEngine.canUseWebAudio) {\r\n if (!this._debugCanvas) {\r\n this._debugCanvas = document.createElement(\"canvas\");\r\n this._debugCanvas.width = this.DEBUGCANVASSIZE.width;\r\n this._debugCanvas.height = this.DEBUGCANVASSIZE.height;\r\n this._debugCanvas.style.position = \"absolute\";\r\n this._debugCanvas.style.top = this.DEBUGCANVASPOS.y + \"px\";\r\n this._debugCanvas.style.left = this.DEBUGCANVASPOS.x + \"px\";\r\n this._debugCanvasContext = this._debugCanvas.getContext(\"2d\");\r\n document.body.appendChild(this._debugCanvas);\r\n this._registerFunc = function () {\r\n _this.drawDebugCanvas();\r\n };\r\n this._scene.registerBeforeRender(this._registerFunc);\r\n }\r\n if (this._registerFunc && this._debugCanvasContext) {\r\n var workingArray = this.getByteFrequencyData();\r\n this._debugCanvasContext.fillStyle = 'rgb(0, 0, 0)';\r\n this._debugCanvasContext.fillRect(0, 0, this.DEBUGCANVASSIZE.width, this.DEBUGCANVASSIZE.height);\r\n // Draw the frequency domain chart.\r\n for (var i = 0; i < this.getFrequencyBinCount(); i++) {\r\n var value = workingArray[i];\r\n var percent = value / this.BARGRAPHAMPLITUDE;\r\n var height = this.DEBUGCANVASSIZE.height * percent;\r\n var offset = this.DEBUGCANVASSIZE.height - height - 1;\r\n var barWidth = this.DEBUGCANVASSIZE.width / this.getFrequencyBinCount();\r\n var hue = i / this.getFrequencyBinCount() * 360;\r\n this._debugCanvasContext.fillStyle = 'hsl(' + hue + ', 100%, 50%)';\r\n this._debugCanvasContext.fillRect(i * barWidth, offset, barWidth, height);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Stops rendering the debug canvas and removes it\r\n */\r\n Analyser.prototype.stopDebugCanvas = function () {\r\n if (this._debugCanvas) {\r\n if (this._registerFunc) {\r\n this._scene.unregisterBeforeRender(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n document.body.removeChild(this._debugCanvas);\r\n this._debugCanvas = null;\r\n this._debugCanvasContext = null;\r\n }\r\n };\r\n /**\r\n * Connects two audio nodes\r\n * @param inputAudioNode defines first node to connect\r\n * @param outputAudioNode defines second node to connect\r\n */\r\n Analyser.prototype.connectAudioNodes = function (inputAudioNode, outputAudioNode) {\r\n if (this._audioEngine.canUseWebAudio) {\r\n inputAudioNode.connect(this._webAudioAnalyser);\r\n this._webAudioAnalyser.connect(outputAudioNode);\r\n }\r\n };\r\n /**\r\n * Releases all associated resources\r\n */\r\n Analyser.prototype.dispose = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.disconnect();\r\n }\r\n };\r\n return Analyser;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/audioEngine.ts\":\n/*!******************************!*\\\n !*** ./Audio/audioEngine.ts ***!\n \\******************************/\n/*! exports provided: AudioEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return AudioEngine; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n// Sets the default audio engine to Babylon.js\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].AudioEngineFactory = function (hostElement) { return new AudioEngine(hostElement); };\r\n/**\r\n * This represents the default audio engine used in babylon.\r\n * It is responsible to play, synchronize and analyse sounds throughout the application.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar AudioEngine = /** @class */ (function () {\r\n /**\r\n * Instantiates a new audio engine.\r\n *\r\n * There should be only one per page as some browsers restrict the number\r\n * of audio contexts you can create.\r\n * @param hostElement defines the host element where to display the mute icon if necessary\r\n */\r\n function AudioEngine(hostElement) {\r\n var _this = this;\r\n if (hostElement === void 0) { hostElement = null; }\r\n this._audioContext = null;\r\n this._audioContextInitialized = false;\r\n this._muteButton = null;\r\n /**\r\n * Gets whether the current host supports Web Audio and thus could create AudioContexts.\r\n */\r\n this.canUseWebAudio = false;\r\n /**\r\n * Defines if Babylon should emit a warning if WebAudio is not supported.\r\n * @ignoreNaming\r\n */\r\n this.WarnedWebAudioUnsupported = false;\r\n /**\r\n * Gets whether or not mp3 are supported by your browser.\r\n */\r\n this.isMP3supported = false;\r\n /**\r\n * Gets whether or not ogg are supported by your browser.\r\n */\r\n this.isOGGsupported = false;\r\n /**\r\n * Gets whether audio has been unlocked on the device.\r\n * Some Browsers have strong restrictions about Audio and won t autoplay unless\r\n * a user interaction has happened.\r\n */\r\n this.unlocked = true;\r\n /**\r\n * Defines if the audio engine relies on a custom unlocked button.\r\n * In this case, the embedded button will not be displayed.\r\n */\r\n this.useCustomUnlockedButton = false;\r\n /**\r\n * Event raised when audio has been unlocked on the browser.\r\n */\r\n this.onAudioUnlockedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Event raised when audio has been locked on the browser.\r\n */\r\n this.onAudioLockedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._tryToRun = false;\r\n this._onResize = function () {\r\n _this._moveButtonToTopLeft();\r\n };\r\n if (typeof window.AudioContext !== 'undefined' || typeof window.webkitAudioContext !== 'undefined') {\r\n window.AudioContext = window.AudioContext || window.webkitAudioContext;\r\n this.canUseWebAudio = true;\r\n }\r\n var audioElem = document.createElement('audio');\r\n this._hostElement = hostElement;\r\n try {\r\n if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/mpeg; codecs=\"mp3\"').replace(/^no$/, '')) {\r\n this.isMP3supported = true;\r\n }\r\n }\r\n catch (e) {\r\n // protect error during capability check.\r\n }\r\n try {\r\n if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/ogg; codecs=\"vorbis\"').replace(/^no$/, '')) {\r\n this.isOGGsupported = true;\r\n }\r\n }\r\n catch (e) {\r\n // protect error during capability check.\r\n }\r\n }\r\n Object.defineProperty(AudioEngine.prototype, \"audioContext\", {\r\n /**\r\n * Gets the current AudioContext if available.\r\n */\r\n get: function () {\r\n if (!this._audioContextInitialized) {\r\n this._initializeAudioContext();\r\n }\r\n else {\r\n if (!this.unlocked && !this._muteButton) {\r\n this._displayMuteButton();\r\n }\r\n }\r\n return this._audioContext;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Flags the audio engine in Locked state.\r\n * This happens due to new browser policies preventing audio to autoplay.\r\n */\r\n AudioEngine.prototype.lock = function () {\r\n this._triggerSuspendedState();\r\n };\r\n /**\r\n * Unlocks the audio engine once a user action has been done on the dom.\r\n * This is helpful to resume play once browser policies have been satisfied.\r\n */\r\n AudioEngine.prototype.unlock = function () {\r\n this._triggerRunningState();\r\n };\r\n AudioEngine.prototype._resumeAudioContext = function () {\r\n var result;\r\n if (this._audioContext.resume) {\r\n result = this._audioContext.resume();\r\n }\r\n return result || Promise.resolve();\r\n };\r\n AudioEngine.prototype._initializeAudioContext = function () {\r\n try {\r\n if (this.canUseWebAudio) {\r\n this._audioContext = new AudioContext();\r\n // create a global volume gain node\r\n this.masterGain = this._audioContext.createGain();\r\n this.masterGain.gain.value = 1;\r\n this.masterGain.connect(this._audioContext.destination);\r\n this._audioContextInitialized = true;\r\n if (this._audioContext.state === \"running\") {\r\n // Do not wait for the promise to unlock.\r\n this._triggerRunningState();\r\n }\r\n }\r\n }\r\n catch (e) {\r\n this.canUseWebAudio = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Web Audio: \" + e.message);\r\n }\r\n };\r\n AudioEngine.prototype._triggerRunningState = function () {\r\n var _this = this;\r\n if (this._tryToRun) {\r\n return;\r\n }\r\n this._tryToRun = true;\r\n this._resumeAudioContext()\r\n .then(function () {\r\n _this._tryToRun = false;\r\n if (_this._muteButton) {\r\n _this._hideMuteButton();\r\n }\r\n }).catch(function () {\r\n _this._tryToRun = false;\r\n _this.unlocked = false;\r\n });\r\n // Notify users that the audio stack is unlocked/unmuted\r\n this.unlocked = true;\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n };\r\n AudioEngine.prototype._triggerSuspendedState = function () {\r\n this.unlocked = false;\r\n this.onAudioLockedObservable.notifyObservers(this);\r\n this._displayMuteButton();\r\n };\r\n AudioEngine.prototype._displayMuteButton = function () {\r\n var _this = this;\r\n if (this.useCustomUnlockedButton || this._muteButton) {\r\n return;\r\n }\r\n this._muteButton = document.createElement(\"BUTTON\");\r\n this._muteButton.className = \"babylonUnmuteIcon\";\r\n this._muteButton.id = \"babylonUnmuteIconBtn\";\r\n this._muteButton.title = \"Unmute\";\r\n var css = \".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }\";\r\n var style = document.createElement('style');\r\n style.appendChild(document.createTextNode(css));\r\n document.getElementsByTagName('head')[0].appendChild(style);\r\n document.body.appendChild(this._muteButton);\r\n this._moveButtonToTopLeft();\r\n this._muteButton.addEventListener('touchend', function () {\r\n _this._triggerRunningState();\r\n }, true);\r\n this._muteButton.addEventListener('click', function () {\r\n _this._triggerRunningState();\r\n }, true);\r\n window.addEventListener(\"resize\", this._onResize);\r\n };\r\n AudioEngine.prototype._moveButtonToTopLeft = function () {\r\n if (this._hostElement && this._muteButton) {\r\n this._muteButton.style.top = this._hostElement.offsetTop + 20 + \"px\";\r\n this._muteButton.style.left = this._hostElement.offsetLeft + 20 + \"px\";\r\n }\r\n };\r\n AudioEngine.prototype._hideMuteButton = function () {\r\n if (this._muteButton) {\r\n document.body.removeChild(this._muteButton);\r\n this._muteButton = null;\r\n }\r\n };\r\n /**\r\n * Destroy and release the resources associated with the audio ccontext.\r\n */\r\n AudioEngine.prototype.dispose = function () {\r\n if (this.canUseWebAudio && this._audioContextInitialized) {\r\n if (this._connectedAnalyser && this._audioContext) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n this._connectedAnalyser.dispose();\r\n this.masterGain.disconnect();\r\n this.masterGain.connect(this._audioContext.destination);\r\n this._connectedAnalyser = null;\r\n }\r\n this.masterGain.gain.value = 1;\r\n }\r\n this.WarnedWebAudioUnsupported = false;\r\n this._hideMuteButton();\r\n window.removeEventListener(\"resize\", this._onResize);\r\n this.onAudioUnlockedObservable.clear();\r\n this.onAudioLockedObservable.clear();\r\n };\r\n /**\r\n * Gets the global volume sets on the master gain.\r\n * @returns the global volume if set or -1 otherwise\r\n */\r\n AudioEngine.prototype.getGlobalVolume = function () {\r\n if (this.canUseWebAudio && this._audioContextInitialized) {\r\n return this.masterGain.gain.value;\r\n }\r\n else {\r\n return -1;\r\n }\r\n };\r\n /**\r\n * Sets the global volume of your experience (sets on the master gain).\r\n * @param newVolume Defines the new global volume of the application\r\n */\r\n AudioEngine.prototype.setGlobalVolume = function (newVolume) {\r\n if (this.canUseWebAudio && this._audioContextInitialized) {\r\n this.masterGain.gain.value = newVolume;\r\n }\r\n };\r\n /**\r\n * Connect the audio engine to an audio analyser allowing some amazing\r\n * synchornization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n AudioEngine.prototype.connectToAnalyser = function (analyser) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n if (this.canUseWebAudio && this._audioContextInitialized && this._audioContext) {\r\n this._connectedAnalyser = analyser;\r\n this.masterGain.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this.masterGain, this._audioContext.destination);\r\n }\r\n };\r\n return AudioEngine;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/audioSceneComponent.ts\":\n/*!**************************************!*\\\n !*** ./Audio/audioSceneComponent.ts ***!\n \\**************************************/\n/*! exports provided: AudioSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return AudioSceneComponent; });\n/* harmony import */ var _sound__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sound */ \"./Audio/sound.ts\");\n/* harmony import */ var _soundTrack__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./soundTrack */ \"./Audio/soundTrack.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _audioEngine__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./audioEngine */ \"./Audio/audioEngine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_6__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO, function (parsedData, scene, container, rootUrl) {\r\n // TODO: add sound\r\n var loadedSounds = [];\r\n var loadedSound;\r\n container.sounds = container.sounds || [];\r\n if (parsedData.sounds !== undefined && parsedData.sounds !== null) {\r\n for (var index = 0, cache = parsedData.sounds.length; index < cache; index++) {\r\n var parsedSound = parsedData.sounds[index];\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (!parsedSound.url) {\r\n parsedSound.url = parsedSound.name;\r\n }\r\n if (!loadedSounds[parsedSound.url]) {\r\n loadedSound = _sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"].Parse(parsedSound, scene, rootUrl);\r\n loadedSounds[parsedSound.url] = loadedSound;\r\n container.sounds.push(loadedSound);\r\n }\r\n else {\r\n container.sounds.push(_sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"].Parse(parsedSound, scene, rootUrl, loadedSounds[parsedSound.url]));\r\n }\r\n }\r\n else {\r\n container.sounds.push(new _sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"](parsedSound.name, null, scene));\r\n }\r\n }\r\n }\r\n loadedSounds = [];\r\n});\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"mainSoundTrack\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (!this._mainSoundTrack) {\r\n this._mainSoundTrack = new _soundTrack__WEBPACK_IMPORTED_MODULE_1__[\"SoundTrack\"](this, { mainTrack: true });\r\n }\r\n return this._mainSoundTrack;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype.getSoundByName = function (name) {\r\n var index;\r\n for (index = 0; index < this.mainSoundTrack.soundCollection.length; index++) {\r\n if (this.mainSoundTrack.soundCollection[index].name === name) {\r\n return this.mainSoundTrack.soundCollection[index];\r\n }\r\n }\r\n if (this.soundTracks) {\r\n for (var sdIndex = 0; sdIndex < this.soundTracks.length; sdIndex++) {\r\n for (index = 0; index < this.soundTracks[sdIndex].soundCollection.length; index++) {\r\n if (this.soundTracks[sdIndex].soundCollection[index].name === name) {\r\n return this.soundTracks[sdIndex].soundCollection[index];\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n};\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"audioEnabled\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n return compo.audioEnabled;\r\n },\r\n set: function (value) {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (value) {\r\n compo.enableAudio();\r\n }\r\n else {\r\n compo.disableAudio();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"headphone\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n return compo.headphone;\r\n },\r\n set: function (value) {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (value) {\r\n compo.switchAudioModeForHeadphones();\r\n }\r\n else {\r\n compo.switchAudioModeForNormalSpeakers();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"audioListenerPositionProvider\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n return compo.audioListenerPositionProvider;\r\n },\r\n set: function (value) {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (typeof value !== 'function') {\r\n throw new Error('The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3');\r\n }\r\n else {\r\n compo.audioListenerPositionProvider = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Defines the sound scene component responsible to manage any sounds\r\n * in a given scene.\r\n */\r\nvar AudioSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function AudioSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO;\r\n this._audioEnabled = true;\r\n this._headphone = false;\r\n this._audioListenerPositionProvider = null;\r\n this.scene = scene;\r\n scene.soundTracks = new Array();\r\n scene.sounds = new Array();\r\n }\r\n Object.defineProperty(AudioSceneComponent.prototype, \"audioEnabled\", {\r\n /**\r\n * Gets whether audio is enabled or not.\r\n * Please use related enable/disable method to switch state.\r\n */\r\n get: function () {\r\n return this._audioEnabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AudioSceneComponent.prototype, \"headphone\", {\r\n /**\r\n * Gets whether audio is outputing to headphone or not.\r\n * Please use the according Switch methods to change output.\r\n */\r\n get: function () {\r\n return this._headphone;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AudioSceneComponent.prototype, \"audioListenerPositionProvider\", {\r\n /**\r\n * Gets the current audio listener position provider\r\n */\r\n get: function () {\r\n return this._audioListenerPositionProvider;\r\n },\r\n /**\r\n * Sets a custom listener position for all sounds in the scene\r\n * By default, this is the position of the first active camera\r\n */\r\n set: function (value) {\r\n this._audioListenerPositionProvider = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n AudioSceneComponent.prototype.register = function () {\r\n this.scene._afterRenderStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_AFTERRENDER_AUDIO, this, this._afterRender);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n AudioSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do here. (Not rendering related)\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n AudioSceneComponent.prototype.serialize = function (serializationObject) {\r\n serializationObject.sounds = [];\r\n if (this.scene.soundTracks) {\r\n for (var index = 0; index < this.scene.soundTracks.length; index++) {\r\n var soundtrack = this.scene.soundTracks[index];\r\n for (var soundId = 0; soundId < soundtrack.soundCollection.length; soundId++) {\r\n serializationObject.sounds.push(soundtrack.soundCollection[soundId].serialize());\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n AudioSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach(function (sound) {\r\n sound.play();\r\n sound.autoplay = true;\r\n _this.scene.mainSoundTrack.AddSound(sound);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n AudioSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (dispose === void 0) { dispose = false; }\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach(function (sound) {\r\n sound.stop();\r\n sound.autoplay = false;\r\n _this.scene.mainSoundTrack.RemoveSound(sound);\r\n if (dispose) {\r\n sound.dispose();\r\n }\r\n });\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n AudioSceneComponent.prototype.dispose = function () {\r\n var scene = this.scene;\r\n if (scene._mainSoundTrack) {\r\n scene.mainSoundTrack.dispose();\r\n }\r\n if (scene.soundTracks) {\r\n for (var scIndex = 0; scIndex < scene.soundTracks.length; scIndex++) {\r\n scene.soundTracks[scIndex].dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Disables audio in the associated scene.\r\n */\r\n AudioSceneComponent.prototype.disableAudio = function () {\r\n var scene = this.scene;\r\n this._audioEnabled = false;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext.suspend();\r\n }\r\n var i;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n scene.mainSoundTrack.soundCollection[i].pause();\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (var j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n scene.soundTracks[i].soundCollection[j].pause();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Enables audio in the associated scene.\r\n */\r\n AudioSceneComponent.prototype.enableAudio = function () {\r\n var scene = this.scene;\r\n this._audioEnabled = true;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext.resume();\r\n }\r\n var i;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n if (scene.mainSoundTrack.soundCollection[i].isPaused) {\r\n scene.mainSoundTrack.soundCollection[i].play();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (var j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n if (scene.soundTracks[i].soundCollection[j].isPaused) {\r\n scene.soundTracks[i].soundCollection[j].play();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Switch audio to headphone output.\r\n */\r\n AudioSceneComponent.prototype.switchAudioModeForHeadphones = function () {\r\n var scene = this.scene;\r\n this._headphone = true;\r\n scene.mainSoundTrack.switchPanningModelToHRTF();\r\n if (scene.soundTracks) {\r\n for (var i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n };\r\n /**\r\n * Switch audio to normal speakers.\r\n */\r\n AudioSceneComponent.prototype.switchAudioModeForNormalSpeakers = function () {\r\n var scene = this.scene;\r\n this._headphone = false;\r\n scene.mainSoundTrack.switchPanningModelToEqualPower();\r\n if (scene.soundTracks) {\r\n for (var i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n };\r\n AudioSceneComponent.prototype._afterRender = function () {\r\n var scene = this.scene;\r\n if (!this._audioEnabled || !scene._mainSoundTrack || !scene.soundTracks || (scene._mainSoundTrack.soundCollection.length === 0 && scene.soundTracks.length === 1)) {\r\n return;\r\n }\r\n var audioEngine = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine;\r\n if (audioEngine.audioContext) {\r\n // A custom listener position provider was set\r\n // Use the users provided position instead of camera's\r\n if (this._audioListenerPositionProvider) {\r\n var position = this._audioListenerPositionProvider();\r\n // Make sure all coordinates were provided\r\n position.x = position.x || 0;\r\n position.y = position.y || 0;\r\n position.z = position.z || 0;\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(position.x, position.y, position.z);\r\n }\r\n else {\r\n var listeningCamera;\r\n if (scene.activeCameras.length > 0) {\r\n listeningCamera = scene.activeCameras[0];\r\n }\r\n else {\r\n listeningCamera = scene.activeCamera;\r\n }\r\n // Check if there is a listening camera\r\n if (listeningCamera) {\r\n // Set the listener position to the listening camera global position\r\n audioEngine.audioContext.listener.setPosition(listeningCamera.globalPosition.x, listeningCamera.globalPosition.y, listeningCamera.globalPosition.z);\r\n // for VR cameras\r\n if (listeningCamera.rigCameras && listeningCamera.rigCameras.length > 0) {\r\n listeningCamera = listeningCamera.rigCameras[0];\r\n }\r\n var mat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(listeningCamera.getViewMatrix());\r\n var cameraDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, -1), mat);\r\n cameraDirection.normalize();\r\n // To avoid some errors on GearVR\r\n if (!isNaN(cameraDirection.x) && !isNaN(cameraDirection.y) && !isNaN(cameraDirection.z)) {\r\n audioEngine.audioContext.listener.setOrientation(cameraDirection.x, cameraDirection.y, cameraDirection.z, 0, 1, 0);\r\n }\r\n }\r\n // Otherwise set the listener position to 0, 0 ,0\r\n else {\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(0, 0, 0);\r\n }\r\n }\r\n var i;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n var sound = scene.mainSoundTrack.soundCollection[i];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (var j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n sound = scene.soundTracks[i].soundCollection[j];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n return AudioSceneComponent;\r\n}());\r\n\r\n_sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"]._SceneComponentInitialization = function (scene) {\r\n var compo = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(scene);\r\n scene._addComponent(compo);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Audio/index.ts\":\n/*!************************!*\\\n !*** ./Audio/index.ts ***!\n \\************************/\n/*! exports provided: Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _analyser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./analyser */ \"./Audio/analyser.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return _analyser__WEBPACK_IMPORTED_MODULE_0__[\"Analyser\"]; });\n\n/* harmony import */ var _audioEngine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./audioEngine */ \"./Audio/audioEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return _audioEngine__WEBPACK_IMPORTED_MODULE_1__[\"AudioEngine\"]; });\n\n/* harmony import */ var _audioSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./audioSceneComponent */ \"./Audio/audioSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return _audioSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"AudioSceneComponent\"]; });\n\n/* harmony import */ var _sound__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sound */ \"./Audio/sound.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return _sound__WEBPACK_IMPORTED_MODULE_3__[\"Sound\"]; });\n\n/* harmony import */ var _soundTrack__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./soundTrack */ \"./Audio/soundTrack.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return _soundTrack__WEBPACK_IMPORTED_MODULE_4__[\"SoundTrack\"]; });\n\n/* harmony import */ var _weightedsound__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./weightedsound */ \"./Audio/weightedsound.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return _weightedsound__WEBPACK_IMPORTED_MODULE_5__[\"WeightedSound\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/sound.ts\":\n/*!************************!*\\\n !*** ./Audio/sound.ts ***!\n \\************************/\n/*! exports provided: Sound */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return Sound; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines a sound that can be played in the application.\r\n * The sound can either be an ambient track or a simple sound played in reaction to a user action.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar Sound = /** @class */ (function () {\r\n /**\r\n * Create a sound and attach it to a scene\r\n * @param name Name of your sound\r\n * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer, it also works with MediaStreams\r\n * @param scene defines the scene the sound belongs to\r\n * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played\r\n * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming\r\n */\r\n function Sound(name, urlOrArrayBuffer, scene, readyToPlayCallback, options) {\r\n var _this = this;\r\n if (readyToPlayCallback === void 0) { readyToPlayCallback = null; }\r\n /**\r\n * Does the sound autoplay once loaded.\r\n */\r\n this.autoplay = false;\r\n /**\r\n * Does the sound loop after it finishes playing once.\r\n */\r\n this.loop = false;\r\n /**\r\n * Does the sound use a custom attenuation curve to simulate the falloff\r\n * happening when the source gets further away from the camera.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n this.useCustomAttenuation = false;\r\n /**\r\n * Is this sound currently played.\r\n */\r\n this.isPlaying = false;\r\n /**\r\n * Is this sound currently paused.\r\n */\r\n this.isPaused = false;\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.spatialSound = false;\r\n /**\r\n * Define the reference distance the sound should be heard perfectly.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.refDistance = 1;\r\n /**\r\n * Define the roll off factor of spatial sounds.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.rolloffFactor = 1;\r\n /**\r\n * Define the max distance the sound should be heard (intensity just became 0 at this point).\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.maxDistance = 100;\r\n /**\r\n * Define the distance attenuation model the sound will follow.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.distanceModel = \"linear\";\r\n /**\r\n * Observable event when the current playing sound finishes.\r\n */\r\n this.onEndedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._panningModel = \"equalpower\";\r\n this._playbackRate = 1;\r\n this._streaming = false;\r\n this._startTime = 0;\r\n this._startOffset = 0;\r\n this._position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n this._positionInEmitterSpace = false;\r\n this._localDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1, 0, 0);\r\n this._volume = 1;\r\n this._isReadyToPlay = false;\r\n this._isDirectional = false;\r\n // Used if you'd like to create a directional sound.\r\n // If not set, the sound will be omnidirectional\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._coneOuterGain = 0;\r\n this._isOutputConnected = false;\r\n this._urlType = \"Unknown\";\r\n this.name = name;\r\n this._scene = scene;\r\n Sound._SceneComponentInitialization(scene);\r\n this._readyToPlayCallback = readyToPlayCallback;\r\n // Default custom attenuation function is a linear attenuation\r\n this._customAttenuationFunction = function (currentVolume, currentDistance, maxDistance, refDistance, rolloffFactor) {\r\n if (currentDistance < maxDistance) {\r\n return currentVolume * (1 - currentDistance / maxDistance);\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n if (options) {\r\n this.autoplay = options.autoplay || false;\r\n this.loop = options.loop || false;\r\n // if volume === 0, we need another way to check this option\r\n if (options.volume !== undefined) {\r\n this._volume = options.volume;\r\n }\r\n this.spatialSound = options.spatialSound || false;\r\n this.maxDistance = options.maxDistance || 100;\r\n this.useCustomAttenuation = options.useCustomAttenuation || false;\r\n this.rolloffFactor = options.rolloffFactor || 1;\r\n this.refDistance = options.refDistance || 1;\r\n this.distanceModel = options.distanceModel || \"linear\";\r\n this._playbackRate = options.playbackRate || 1;\r\n this._streaming = options.streaming || false;\r\n this._length = options.length;\r\n this._offset = options.offset;\r\n }\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n this._soundGain = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createGain();\r\n this._soundGain.gain.value = this._volume;\r\n this._inputAudioNode = this._soundGain;\r\n this._outputAudioNode = this._soundGain;\r\n if (this.spatialSound) {\r\n this._createSpatialParameters();\r\n }\r\n this._scene.mainSoundTrack.AddSound(this);\r\n var validParameter = true;\r\n // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound\r\n if (urlOrArrayBuffer) {\r\n try {\r\n if (typeof (urlOrArrayBuffer) === \"string\") {\r\n this._urlType = \"String\";\r\n }\r\n else if (urlOrArrayBuffer instanceof ArrayBuffer) {\r\n this._urlType = \"ArrayBuffer\";\r\n }\r\n else if (urlOrArrayBuffer instanceof MediaStream) {\r\n this._urlType = \"MediaStream\";\r\n }\r\n else if (Array.isArray(urlOrArrayBuffer)) {\r\n this._urlType = \"Array\";\r\n }\r\n var urls = [];\r\n var codecSupportedFound = false;\r\n switch (this._urlType) {\r\n case \"MediaStream\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createMediaStreamSource(urlOrArrayBuffer);\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"ArrayBuffer\":\r\n if (urlOrArrayBuffer.byteLength > 0) {\r\n codecSupportedFound = true;\r\n this._soundLoaded(urlOrArrayBuffer);\r\n }\r\n break;\r\n case \"String\":\r\n urls.push(urlOrArrayBuffer);\r\n case \"Array\":\r\n if (urls.length === 0) {\r\n urls = urlOrArrayBuffer;\r\n }\r\n // If we found a supported format, we load it immediately and stop the loop\r\n for (var i = 0; i < urls.length; i++) {\r\n var url = urls[i];\r\n codecSupportedFound = (options && options.skipCodecCheck) ||\r\n (url.indexOf(\".mp3\", url.length - 4) !== -1 && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.isMP3supported) ||\r\n (url.indexOf(\".ogg\", url.length - 4) !== -1 && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.isOGGsupported) ||\r\n (url.indexOf(\".wav\", url.length - 4) !== -1) ||\r\n (url.indexOf(\"blob:\") !== -1);\r\n if (codecSupportedFound) {\r\n // Loading sound using XHR2\r\n if (!this._streaming) {\r\n this._scene._loadFile(url, function (data) {\r\n _this._soundLoaded(data);\r\n }, undefined, true, true, function (exception) {\r\n if (exception) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"XHR \" + exception.status + \" error on: \" + url + \".\");\r\n }\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Sound creation aborted.\");\r\n _this._scene.mainSoundTrack.RemoveSound(_this);\r\n });\r\n }\r\n // Streaming sound using HTML5 Audio tag\r\n else {\r\n this._htmlAudioElement = new Audio(url);\r\n this._htmlAudioElement.controls = false;\r\n this._htmlAudioElement.loop = this.loop;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].SetCorsBehavior(url, this._htmlAudioElement);\r\n this._htmlAudioElement.preload = \"auto\";\r\n this._htmlAudioElement.addEventListener(\"canplaythrough\", function () {\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n });\r\n document.body.appendChild(this._htmlAudioElement);\r\n this._htmlAudioElement.load();\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n default:\r\n validParameter = false;\r\n break;\r\n }\r\n if (!validParameter) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.\");\r\n }\r\n else {\r\n if (!codecSupportedFound) {\r\n this._isReadyToPlay = true;\r\n // Simulating a ready to play event to avoid breaking code path\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Unexpected error. Sound creation aborted.\");\r\n this._scene.mainSoundTrack.RemoveSound(this);\r\n }\r\n }\r\n }\r\n else {\r\n // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers\r\n this._scene.mainSoundTrack.AddSound(this);\r\n if (!_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.WarnedWebAudioUnsupported) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Web Audio is not supported by your browser.\");\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.WarnedWebAudioUnsupported = true;\r\n }\r\n // Simulating a ready to play event to avoid breaking code for non web audio browsers\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n /**\r\n * Release the sound and its associated resources\r\n */\r\n Sound.prototype.dispose = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (this.isPlaying) {\r\n this.stop();\r\n }\r\n this._isReadyToPlay = false;\r\n if (this.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.RemoveSound(this);\r\n }\r\n else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[this.soundTrackId].RemoveSound(this);\r\n }\r\n if (this._soundGain) {\r\n this._soundGain.disconnect();\r\n this._soundGain = null;\r\n }\r\n if (this._soundPanner) {\r\n this._soundPanner.disconnect();\r\n this._soundPanner = null;\r\n }\r\n if (this._soundSource) {\r\n this._soundSource.disconnect();\r\n this._soundSource = null;\r\n }\r\n this._audioBuffer = null;\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n this._htmlAudioElement.src = \"\";\r\n document.body.removeChild(this._htmlAudioElement);\r\n }\r\n if (this._streamingSource) {\r\n this._streamingSource.disconnect();\r\n }\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets if the sounds is ready to be played or not.\r\n * @returns true if ready, otherwise false\r\n */\r\n Sound.prototype.isReady = function () {\r\n return this._isReadyToPlay;\r\n };\r\n Sound.prototype._soundLoaded = function (audioData) {\r\n var _this = this;\r\n if (!_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n return;\r\n }\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.decodeAudioData(audioData, function (buffer) {\r\n _this._audioBuffer = buffer;\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, function (err) { _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Error while decoding audio data for: \" + _this.name + \" / Error: \" + err); });\r\n };\r\n /**\r\n * Sets the data of the sound from an audiobuffer\r\n * @param audioBuffer The audioBuffer containing the data\r\n */\r\n Sound.prototype.setAudioBuffer = function (audioBuffer) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n this._audioBuffer = audioBuffer;\r\n this._isReadyToPlay = true;\r\n }\r\n };\r\n /**\r\n * Updates the current sounds options such as maxdistance, loop...\r\n * @param options A JSON object containing values named as the object properties\r\n */\r\n Sound.prototype.updateOptions = function (options) {\r\n if (options) {\r\n this.loop = options.loop || this.loop;\r\n this.maxDistance = options.maxDistance || this.maxDistance;\r\n this.useCustomAttenuation = options.useCustomAttenuation || this.useCustomAttenuation;\r\n this.rolloffFactor = options.rolloffFactor || this.rolloffFactor;\r\n this.refDistance = options.refDistance || this.refDistance;\r\n this.distanceModel = options.distanceModel || this.distanceModel;\r\n this._playbackRate = options.playbackRate || this._playbackRate;\r\n this._length = options.length ? options.length / 1000 : undefined;\r\n this._offset = options.offset ? options.offset / 1000 : undefined;\r\n this._updateSpatialParameters();\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n else {\r\n if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n Sound.prototype._createSpatialParameters = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n if (this._scene.headphone) {\r\n this._panningModel = \"HRTF\";\r\n }\r\n this._soundPanner = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createPanner();\r\n this._updateSpatialParameters();\r\n this._soundPanner.connect(this._outputAudioNode);\r\n this._inputAudioNode = this._soundPanner;\r\n }\r\n };\r\n Sound.prototype._updateSpatialParameters = function () {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (this.useCustomAttenuation) {\r\n // Tricks to disable in a way embedded Web Audio attenuation\r\n this._soundPanner.distanceModel = \"linear\";\r\n this._soundPanner.maxDistance = Number.MAX_VALUE;\r\n this._soundPanner.refDistance = 1;\r\n this._soundPanner.rolloffFactor = 1;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n else {\r\n this._soundPanner.distanceModel = this.distanceModel;\r\n this._soundPanner.maxDistance = this.maxDistance;\r\n this._soundPanner.refDistance = this.refDistance;\r\n this._soundPanner.rolloffFactor = this.rolloffFactor;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n }\r\n };\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToHRTF = function () {\r\n this._panningModel = \"HRTF\";\r\n this._switchPanningModel();\r\n };\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToEqualPower = function () {\r\n this._panningModel = \"equalpower\";\r\n this._switchPanningModel();\r\n };\r\n Sound.prototype._switchPanningModel = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n };\r\n /**\r\n * Connect this sound to a sound track audio node like gain...\r\n * @param soundTrackAudioNode the sound track audio node to connect to\r\n */\r\n Sound.prototype.connectToSoundTrackAudioNode = function (soundTrackAudioNode) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (this._isOutputConnected) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode.connect(soundTrackAudioNode);\r\n this._isOutputConnected = true;\r\n }\r\n };\r\n /**\r\n * Transform this sound into a directional source\r\n * @param coneInnerAngle Size of the inner cone in degree\r\n * @param coneOuterAngle Size of the outer cone in degree\r\n * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)\r\n */\r\n Sound.prototype.setDirectionalCone = function (coneInnerAngle, coneOuterAngle, coneOuterGain) {\r\n if (coneOuterAngle < coneInnerAngle) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = coneInnerAngle;\r\n this._coneOuterAngle = coneOuterAngle;\r\n this._coneOuterGain = coneOuterGain;\r\n this._isDirectional = true;\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n };\r\n Object.defineProperty(Sound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Sound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the position of the emitter if spatial sound is enabled\r\n * @param newPosition Defines the new posisiton\r\n */\r\n Sound.prototype.setPosition = function (newPosition) {\r\n this._position = newPosition;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n };\r\n /**\r\n * Sets the local direction of the emitter if spatial sound is enabled\r\n * @param newLocalDirection Defines the new local direction\r\n */\r\n Sound.prototype.setLocalDirectionToMesh = function (newLocalDirection) {\r\n this._localDirection = newLocalDirection;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._connectedTransformNode && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n Sound.prototype._updateDirection = function () {\r\n if (!this._connectedTransformNode || !this._soundPanner) {\r\n return;\r\n }\r\n var mat = this._connectedTransformNode.getWorldMatrix();\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormal(this._localDirection, mat);\r\n direction.normalize();\r\n this._soundPanner.setOrientation(direction.x, direction.y, direction.z);\r\n };\r\n /** @hidden */\r\n Sound.prototype.updateDistanceFromListener = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {\r\n var distance = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);\r\n this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);\r\n }\r\n };\r\n /**\r\n * Sets a new custom attenuation function for the sound.\r\n * @param callback Defines the function used for the attenuation\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n Sound.prototype.setAttenuationFunction = function (callback) {\r\n this._customAttenuationFunction = callback;\r\n };\r\n /**\r\n * Play the sound\r\n * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.\r\n * @param offset (optional) Start the sound at a specific time in seconds\r\n * @param length (optional) Sound duration (in seconds)\r\n */\r\n Sound.prototype.play = function (time, offset, length) {\r\n var _this = this;\r\n if (this._isReadyToPlay && this._scene.audioEnabled && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n try {\r\n if (this._startOffset < 0) {\r\n time = -this._startOffset;\r\n this._startOffset = 0;\r\n }\r\n var startTime = time ? _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time : _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime;\r\n if (!this._soundSource || !this._streamingSource) {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (!isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n if (this._isDirectional) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n this._soundPanner.coneOuterGain = this._coneOuterGain;\r\n if (this._connectedTransformNode) {\r\n this._updateDirection();\r\n }\r\n else {\r\n this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);\r\n }\r\n }\r\n }\r\n }\r\n if (this._streaming) {\r\n if (!this._streamingSource) {\r\n this._streamingSource = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);\r\n this._htmlAudioElement.onended = function () { _this._onended(); };\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n this._streamingSource.disconnect();\r\n this._streamingSource.connect(this._inputAudioNode);\r\n if (this._htmlAudioElement) {\r\n // required to manage properly the new suspended default state of Chrome\r\n // When the option 'streaming: true' is used, we need first to wait for\r\n // the audio engine to be unlocked by a user gesture before trying to play\r\n // an HTML Audio elememt\r\n var tryToPlay = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.unlocked) {\r\n var playPromise = _this._htmlAudioElement.play();\r\n // In browsers that don’t yet support this functionality,\r\n // playPromise won’t be defined.\r\n if (playPromise !== undefined) {\r\n playPromise.catch(function (error) {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.onAudioUnlockedObservable.addOnce(function () { tryToPlay(); });\r\n }\r\n });\r\n }\r\n }\r\n else {\r\n if (_this.loop || _this.autoplay) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.onAudioUnlockedObservable.addOnce(function () { tryToPlay(); });\r\n }\r\n }\r\n };\r\n tryToPlay();\r\n }\r\n }\r\n else {\r\n var tryToPlay = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n length = length || _this._length;\r\n offset = offset || _this._offset;\r\n _this._soundSource = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createBufferSource();\r\n _this._soundSource.buffer = _this._audioBuffer;\r\n _this._soundSource.connect(_this._inputAudioNode);\r\n _this._soundSource.loop = _this.loop;\r\n if (offset !== undefined) {\r\n _this._soundSource.loopStart = offset;\r\n }\r\n if (length !== undefined) {\r\n _this._soundSource.loopEnd = (offset | 0) + length;\r\n }\r\n _this._soundSource.playbackRate.value = _this._playbackRate;\r\n _this._soundSource.onended = function () { _this._onended(); };\r\n startTime = time ? _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time : _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime;\r\n var actualOffset = _this.isPaused ? _this._startOffset % _this._soundSource.buffer.duration : offset ? offset : 0;\r\n _this._soundSource.start(startTime, actualOffset, _this.loop ? undefined : length);\r\n }\r\n };\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.state === \"suspended\") {\r\n // Wait a bit for FF as context seems late to be ready.\r\n setTimeout(function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.state === \"suspended\") {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.onAudioUnlockedObservable.addOnce(function () { tryToPlay(); });\r\n }\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }, 500);\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }\r\n this._startTime = startTime;\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Error while trying to play audio: \" + this.name + \", \" + ex.message);\r\n }\r\n }\r\n };\r\n Sound.prototype._onended = function () {\r\n this.isPlaying = false;\r\n if (this.onended) {\r\n this.onended();\r\n }\r\n this.onEndedObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop the sound\r\n * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.\r\n */\r\n Sound.prototype.stop = function (time) {\r\n var _this = this;\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n // Test needed for Firefox or it will generate an Invalid State Error\r\n if (this._htmlAudioElement.currentTime > 0) {\r\n this._htmlAudioElement.currentTime = 0;\r\n }\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n }\r\n else if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext && this._soundSource) {\r\n var stopTime = time ? _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time : _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime;\r\n this._soundSource.stop(stopTime);\r\n this._soundSource.onended = function () { _this.isPlaying = false; };\r\n if (!this.isPaused) {\r\n this._startOffset = 0;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Put the sound in pause\r\n */\r\n Sound.prototype.pause = function () {\r\n if (this.isPlaying) {\r\n this.isPaused = true;\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n }\r\n else if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n this.stop(0);\r\n this._startOffset += _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a dedicated volume for this sounds\r\n * @param newVolume Define the new volume of the sound\r\n * @param time Define time for gradual change to new volume\r\n */\r\n Sound.prototype.setVolume = function (newVolume, time) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._soundGain) {\r\n if (time && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n this._soundGain.gain.cancelScheduledValues(_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.linearRampToValueAtTime(newVolume, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time);\r\n }\r\n else {\r\n this._soundGain.gain.value = newVolume;\r\n }\r\n }\r\n this._volume = newVolume;\r\n };\r\n /**\r\n * Set the sound play back rate\r\n * @param newPlaybackRate Define the playback rate the sound should be played at\r\n */\r\n Sound.prototype.setPlaybackRate = function (newPlaybackRate) {\r\n this._playbackRate = newPlaybackRate;\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n else if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the volume of the sound.\r\n * @returns the volume of the sound\r\n */\r\n Sound.prototype.getVolume = function () {\r\n return this._volume;\r\n };\r\n /**\r\n * Attach the sound to a dedicated mesh\r\n * @param transformNode The transform node to connect the sound with\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.attachToMesh = function (transformNode) {\r\n var _this = this;\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n this._connectedTransformNode = transformNode;\r\n if (!this.spatialSound) {\r\n this.spatialSound = true;\r\n this._createSpatialParameters();\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode);\r\n this._registerFunc = function (transformNode) { return _this._onRegisterAfterWorldMatrixUpdate(transformNode); };\r\n this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);\r\n };\r\n /**\r\n * Detach the sound from the previously attached mesh\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.detachFromMesh = function () {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n this._connectedTransformNode = null;\r\n }\r\n };\r\n Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (node) {\r\n if (!node.getBoundingInfo) {\r\n return;\r\n }\r\n var mesh = node;\r\n if (this._positionInEmitterSpace) {\r\n mesh.worldMatrixFromCache.invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[0]);\r\n this.setPosition(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[0].getTranslation());\r\n }\r\n else {\r\n var boundingInfo = mesh.getBoundingInfo();\r\n this.setPosition(boundingInfo.boundingSphere.centerWorld);\r\n }\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n /**\r\n * Clone the current sound in the scene.\r\n * @returns the new sound clone\r\n */\r\n Sound.prototype.clone = function () {\r\n var _this = this;\r\n if (!this._streaming) {\r\n var setBufferAndRun = function () {\r\n if (_this._isReadyToPlay) {\r\n clonedSound._audioBuffer = _this.getAudioBuffer();\r\n clonedSound._isReadyToPlay = true;\r\n if (clonedSound.autoplay) {\r\n clonedSound.play(0, _this._offset, _this._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n var currentOptions = {\r\n autoplay: this.autoplay, loop: this.loop,\r\n volume: this._volume, spatialSound: this.spatialSound, maxDistance: this.maxDistance,\r\n useCustomAttenuation: this.useCustomAttenuation, rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance, distanceModel: this.distanceModel\r\n };\r\n var clonedSound = new Sound(this.name + \"_cloned\", new ArrayBuffer(0), this._scene, null, currentOptions);\r\n if (this.useCustomAttenuation) {\r\n clonedSound.setAttenuationFunction(this._customAttenuationFunction);\r\n }\r\n clonedSound.setPosition(this._position);\r\n clonedSound.setPlaybackRate(this._playbackRate);\r\n setBufferAndRun();\r\n return clonedSound;\r\n }\r\n // Can't clone a streaming sound\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Gets the current underlying audio buffer containing the data\r\n * @returns the audio buffer\r\n */\r\n Sound.prototype.getAudioBuffer = function () {\r\n return this._audioBuffer;\r\n };\r\n /**\r\n * Serializes the Sound in a JSON representation\r\n * @returns the JSON representation of the sound\r\n */\r\n Sound.prototype.serialize = function () {\r\n var serializationObject = {\r\n name: this.name,\r\n url: this.name,\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this.spatialSound,\r\n maxDistance: this.maxDistance,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n playbackRate: this._playbackRate,\r\n panningModel: this._panningModel,\r\n soundTrackId: this.soundTrackId\r\n };\r\n if (this.spatialSound) {\r\n if (this._connectedTransformNode) {\r\n serializationObject.connectedMeshId = this._connectedTransformNode.id;\r\n }\r\n serializationObject.position = this._position.asArray();\r\n serializationObject.refDistance = this.refDistance;\r\n serializationObject.distanceModel = this.distanceModel;\r\n serializationObject.isDirectional = this._isDirectional;\r\n serializationObject.localDirectionToMesh = this._localDirection.asArray();\r\n serializationObject.coneInnerAngle = this._coneInnerAngle;\r\n serializationObject.coneOuterAngle = this._coneOuterAngle;\r\n serializationObject.coneOuterGain = this._coneOuterGain;\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse a JSON representation of a sound to innstantiate in a given scene\r\n * @param parsedSound Define the JSON representation of the sound (usually coming from the serialize method)\r\n * @param scene Define the scene the new parsed sound should be created in\r\n * @param rootUrl Define the rooturl of the load in case we need to fetch relative dependencies\r\n * @param sourceSound Define a cound place holder if do not need to instantiate a new one\r\n * @returns the newly parsed sound\r\n */\r\n Sound.Parse = function (parsedSound, scene, rootUrl, sourceSound) {\r\n var soundName = parsedSound.name;\r\n var soundUrl;\r\n if (parsedSound.url) {\r\n soundUrl = rootUrl + parsedSound.url;\r\n }\r\n else {\r\n soundUrl = rootUrl + soundName;\r\n }\r\n var options = {\r\n autoplay: parsedSound.autoplay, loop: parsedSound.loop, volume: parsedSound.volume,\r\n spatialSound: parsedSound.spatialSound, maxDistance: parsedSound.maxDistance,\r\n rolloffFactor: parsedSound.rolloffFactor,\r\n refDistance: parsedSound.refDistance,\r\n distanceModel: parsedSound.distanceModel,\r\n playbackRate: parsedSound.playbackRate\r\n };\r\n var newSound;\r\n if (!sourceSound) {\r\n newSound = new Sound(soundName, soundUrl, scene, function () { scene._removePendingData(newSound); }, options);\r\n scene._addPendingData(newSound);\r\n }\r\n else {\r\n var setBufferAndRun = function () {\r\n if (sourceSound._isReadyToPlay) {\r\n newSound._audioBuffer = sourceSound.getAudioBuffer();\r\n newSound._isReadyToPlay = true;\r\n if (newSound.autoplay) {\r\n newSound.play(0, newSound._offset, newSound._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);\r\n setBufferAndRun();\r\n }\r\n if (parsedSound.position) {\r\n var soundPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedSound.position);\r\n newSound.setPosition(soundPosition);\r\n }\r\n if (parsedSound.isDirectional) {\r\n newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);\r\n if (parsedSound.localDirectionToMesh) {\r\n var localDirectionToMesh = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedSound.localDirectionToMesh);\r\n newSound.setLocalDirectionToMesh(localDirectionToMesh);\r\n }\r\n }\r\n if (parsedSound.connectedMeshId) {\r\n var connectedMesh = scene.getMeshByID(parsedSound.connectedMeshId);\r\n if (connectedMesh) {\r\n newSound.attachToMesh(connectedMesh);\r\n }\r\n }\r\n return newSound;\r\n };\r\n /** @hidden */\r\n Sound._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"AudioSceneComponent\");\r\n };\r\n return Sound;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/soundTrack.ts\":\n/*!*****************************!*\\\n !*** ./Audio/soundTrack.ts ***!\n \\*****************************/\n/*! exports provided: SoundTrack */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return SoundTrack; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/**\r\n * It could be useful to isolate your music & sounds on several tracks to better manage volume on a grouped instance of sounds.\r\n * It will be also used in a future release to apply effects on a specific track.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-sound-tracks\r\n */\r\nvar SoundTrack = /** @class */ (function () {\r\n /**\r\n * Creates a new sound track.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-sound-tracks\r\n * @param scene Define the scene the sound track belongs to\r\n * @param options\r\n */\r\n function SoundTrack(scene, options) {\r\n if (options === void 0) { options = {}; }\r\n /**\r\n * The unique identifier of the sound track in the scene.\r\n */\r\n this.id = -1;\r\n this._isMainTrack = false;\r\n this._isInitialized = false;\r\n this._scene = scene;\r\n this.soundCollection = new Array();\r\n this._options = options;\r\n if (!this._isMainTrack && this._scene.soundTracks) {\r\n this._scene.soundTracks.push(this);\r\n this.id = this._scene.soundTracks.length - 1;\r\n }\r\n }\r\n SoundTrack.prototype._initializeSoundTrackAudioGraph = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.audioContext) {\r\n this._outputAudioNode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.audioContext.createGain();\r\n this._outputAudioNode.connect(_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.masterGain);\r\n if (this._options) {\r\n if (this._options.volume) {\r\n this._outputAudioNode.gain.value = this._options.volume;\r\n }\r\n if (this._options.mainTrack) {\r\n this._isMainTrack = this._options.mainTrack;\r\n }\r\n }\r\n this._isInitialized = true;\r\n }\r\n };\r\n /**\r\n * Release the sound track and its associated resources\r\n */\r\n SoundTrack.prototype.dispose = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n while (this.soundCollection.length) {\r\n this.soundCollection[0].dispose();\r\n }\r\n if (this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode = null;\r\n }\r\n };\r\n /**\r\n * Adds a sound to this sound track\r\n * @param sound define the cound to add\r\n * @ignoreNaming\r\n */\r\n SoundTrack.prototype.AddSound = function (sound) {\r\n if (!this._isInitialized) {\r\n this._initializeSoundTrackAudioGraph();\r\n }\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n sound.connectToSoundTrackAudioNode(this._outputAudioNode);\r\n }\r\n if (sound.soundTrackId) {\r\n if (sound.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.RemoveSound(sound);\r\n }\r\n else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[sound.soundTrackId].RemoveSound(sound);\r\n }\r\n }\r\n this.soundCollection.push(sound);\r\n sound.soundTrackId = this.id;\r\n };\r\n /**\r\n * Removes a sound to this sound track\r\n * @param sound define the cound to remove\r\n * @ignoreNaming\r\n */\r\n SoundTrack.prototype.RemoveSound = function (sound) {\r\n var index = this.soundCollection.indexOf(sound);\r\n if (index !== -1) {\r\n this.soundCollection.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Set a global volume for the full sound track.\r\n * @param newVolume Define the new volume of the sound track\r\n */\r\n SoundTrack.prototype.setVolume = function (newVolume) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.gain.value = newVolume;\r\n }\r\n };\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n SoundTrack.prototype.switchPanningModelToHRTF = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n for (var i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n };\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n SoundTrack.prototype.switchPanningModelToEqualPower = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n for (var i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n };\r\n /**\r\n * Connect the sound track to an audio analyser allowing some amazing\r\n * synchornization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n SoundTrack.prototype.connectToAnalyser = function (analyser) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n this._connectedAnalyser = analyser;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.masterGain);\r\n }\r\n };\r\n return SoundTrack;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/weightedsound.ts\":\n/*!********************************!*\\\n !*** ./Audio/weightedsound.ts ***!\n \\********************************/\n/*! exports provided: WeightedSound */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return WeightedSound; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * Wraps one or more Sound objects and selects one with random weight for playback.\r\n */\r\nvar WeightedSound = /** @class */ (function () {\r\n /**\r\n * Creates a new WeightedSound from the list of sounds given.\r\n * @param loop When true a Sound will be selected and played when the current playing Sound completes.\r\n * @param sounds Array of Sounds that will be selected from.\r\n * @param weights Array of number values for selection weights; length must equal sounds, values will be normalized to 1\r\n */\r\n function WeightedSound(loop, sounds, weights) {\r\n var _this = this;\r\n /** When true a Sound will be selected and played when the current playing Sound completes. */\r\n this.loop = false;\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._volume = 1;\r\n /** A Sound is currently playing. */\r\n this.isPlaying = false;\r\n /** A Sound is currently paused. */\r\n this.isPaused = false;\r\n this._sounds = [];\r\n this._weights = [];\r\n if (sounds.length !== weights.length) {\r\n throw new Error('Sounds length does not equal weights length');\r\n }\r\n this.loop = loop;\r\n this._weights = weights;\r\n // Normalize the weights\r\n var weightSum = 0;\r\n for (var _i = 0, weights_1 = weights; _i < weights_1.length; _i++) {\r\n var weight = weights_1[_i];\r\n weightSum += weight;\r\n }\r\n var invWeightSum = weightSum > 0 ? 1 / weightSum : 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n this._weights[i] *= invWeightSum;\r\n }\r\n this._sounds = sounds;\r\n for (var _a = 0, _b = this._sounds; _a < _b.length; _a++) {\r\n var sound = _b[_a];\r\n sound.onEndedObservable.add(function () { _this._onended(); });\r\n }\r\n }\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * The size of cone in degrees for a directional sound in which there will be no attenuation.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * The size of cone in degress for a directional sound in which there will be no attenuation.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeInnerAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeOuterAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"volume\", {\r\n /**\r\n * Playback volume.\r\n */\r\n get: function () {\r\n return this._volume;\r\n },\r\n /**\r\n * Playback volume.\r\n */\r\n set: function (value) {\r\n if (value !== this._volume) {\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.setVolume(value);\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WeightedSound.prototype._onended = function () {\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].autoplay = false;\r\n }\r\n if (this.loop && this.isPlaying) {\r\n this.play();\r\n }\r\n else {\r\n this.isPlaying = false;\r\n }\r\n };\r\n /**\r\n * Suspend playback\r\n */\r\n WeightedSound.prototype.pause = function () {\r\n this.isPaused = true;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].pause();\r\n }\r\n };\r\n /**\r\n * Stop playback\r\n */\r\n WeightedSound.prototype.stop = function () {\r\n this.isPlaying = false;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].stop();\r\n }\r\n };\r\n /**\r\n * Start playback.\r\n * @param startOffset Position the clip head at a specific time in seconds.\r\n */\r\n WeightedSound.prototype.play = function (startOffset) {\r\n if (!this.isPaused) {\r\n this.stop();\r\n var randomValue = Math.random();\r\n var total = 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n total += this._weights[i];\r\n if (randomValue <= total) {\r\n this._currentIndex = i;\r\n break;\r\n }\r\n }\r\n }\r\n var sound = this._sounds[this._currentIndex];\r\n if (sound.isReady()) {\r\n sound.play(0, this.isPaused ? undefined : startOffset);\r\n }\r\n else {\r\n sound.autoplay = true;\r\n }\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n };\r\n return WeightedSound;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/autoRotationBehavior.ts\":\n/*!***************************************************!*\\\n !*** ./Behaviors/Cameras/autoRotationBehavior.ts ***!\n \\***************************************************/\n/*! exports provided: AutoRotationBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return AutoRotationBehavior; });\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n\r\n\r\n/**\r\n * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\nvar AutoRotationBehavior = /** @class */ (function () {\r\n function AutoRotationBehavior() {\r\n this._zoomStopsAnimation = false;\r\n this._idleRotationSpeed = 0.05;\r\n this._idleRotationWaitTime = 2000;\r\n this._idleRotationSpinupTime = 2000;\r\n this._isPointerDown = false;\r\n this._lastFrameTime = null;\r\n this._lastInteractionTime = -Infinity;\r\n this._cameraRotationSpeed = 0;\r\n this._lastFrameRadius = 0;\r\n }\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"AutoRotation\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpeed\", {\r\n /**\r\n * Gets the default speed at which the camera rotates around the model.\r\n */\r\n get: function () {\r\n return this._idleRotationSpeed;\r\n },\r\n /**\r\n * Sets the default speed at which the camera rotates around the model.\r\n */\r\n set: function (speed) {\r\n this._idleRotationSpeed = speed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationWaitTime\", {\r\n /**\r\n * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n get: function () {\r\n return this._idleRotationWaitTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n set: function (time) {\r\n this._idleRotationWaitTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpinupTime\", {\r\n /**\r\n * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n get: function () {\r\n return this._idleRotationSpinupTime;\r\n },\r\n /**\r\n * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n set: function (time) {\r\n this._idleRotationSpinupTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"rotationInProgress\", {\r\n /**\r\n * Gets a value indicating if the camera is currently rotating because of this behavior\r\n */\r\n get: function () {\r\n return Math.abs(this._cameraRotationSpeed) > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n AutoRotationBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n AutoRotationBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n var now = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_1__[\"PrecisionDate\"].Now;\r\n var dt = 0;\r\n if (_this._lastFrameTime != null) {\r\n dt = now - _this._lastFrameTime;\r\n }\r\n _this._lastFrameTime = now;\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n var timeToRotation = now - _this._lastInteractionTime - _this._idleRotationWaitTime;\r\n var scale = Math.max(Math.min(timeToRotation / (_this._idleRotationSpinupTime), 1), 0);\r\n _this._cameraRotationSpeed = _this._idleRotationSpeed * scale;\r\n // Step camera rotation by rotation speed\r\n if (_this._attachedCamera) {\r\n _this._attachedCamera.alpha -= _this._cameraRotationSpeed * (dt / 1000);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n AutoRotationBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Returns true if user is scrolling.\r\n * @return true if user is scrolling.\r\n */\r\n AutoRotationBehavior.prototype._userIsZooming = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialRadiusOffset !== 0;\r\n };\r\n AutoRotationBehavior.prototype._shouldAnimationStopForInteraction = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n var zoomHasHitLimit = false;\r\n if (this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0) {\r\n zoomHasHitLimit = true;\r\n }\r\n // Update the record of previous radius - works as an approx. indicator of hitting radius limits\r\n this._lastFrameRadius = this._attachedCamera.radius;\r\n return this._zoomStopsAnimation ? zoomHasHitLimit : this._userIsZooming();\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n AutoRotationBehavior.prototype._applyUserInteraction = function () {\r\n if (this._userIsMoving() && !this._shouldAnimationStopForInteraction()) {\r\n this._lastInteractionTime = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_1__[\"PrecisionDate\"].Now;\r\n }\r\n };\r\n // Tools\r\n AutoRotationBehavior.prototype._userIsMoving = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n };\r\n return AutoRotationBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/bouncingBehavior.ts\":\n/*!***********************************************!*\\\n !*** ./Behaviors/Cameras/bouncingBehavior.ts ***!\n \\***********************************************/\n/*! exports provided: BouncingBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return BouncingBehavior; });\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n\r\n\r\n/**\r\n * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\nvar BouncingBehavior = /** @class */ (function () {\r\n function BouncingBehavior() {\r\n /**\r\n * The duration of the animation, in milliseconds\r\n */\r\n this.transitionDuration = 450;\r\n /**\r\n * Length of the distance animated by the transition when lower radius is reached\r\n */\r\n this.lowerRadiusTransitionRange = 2;\r\n /**\r\n * Length of the distance animated by the transition when upper radius is reached\r\n */\r\n this.upperRadiusTransitionRange = -2;\r\n this._autoTransitionRange = false;\r\n // Animations\r\n this._radiusIsAnimating = false;\r\n this._radiusBounceTransition = null;\r\n this._animatables = new Array();\r\n }\r\n Object.defineProperty(BouncingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Bouncing\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BouncingBehavior.prototype, \"autoTransitionRange\", {\r\n /**\r\n * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n */\r\n get: function () {\r\n return this._autoTransitionRange;\r\n },\r\n /**\r\n * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n * Transition ranges will be set to 5% of the bounding box diagonal in world space\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._autoTransitionRange === value) {\r\n return;\r\n }\r\n this._autoTransitionRange = value;\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n if (value) {\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n mesh.computeWorldMatrix(true);\r\n var diagonal = mesh.getBoundingInfo().diagonalLength;\r\n _this.lowerRadiusTransitionRange = diagonal * 0.05;\r\n _this.upperRadiusTransitionRange = diagonal * 0.05;\r\n });\r\n }\r\n else if (this._onMeshTargetChangedObserver) {\r\n camera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n BouncingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n BouncingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n if (!_this._attachedCamera) {\r\n return;\r\n }\r\n // Add the bounce animation to the lower radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.lowerRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.lowerRadiusTransitionRange);\r\n }\r\n // Add the bounce animation to the upper radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.upperRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.upperRadiusTransitionRange);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n BouncingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Checks if the camera radius is at the specified limit. Takes into account animation locks.\r\n * @param radiusLimit The limit to check against.\r\n * @return Bool to indicate if at limit.\r\n */\r\n BouncingBehavior.prototype._isRadiusAtLimit = function (radiusLimit) {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n if (this._attachedCamera.radius === radiusLimit && !this._radiusIsAnimating) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Applies an animation to the radius of the camera, extending by the radiusDelta.\r\n * @param radiusDelta The delta by which to animate to. Can be negative.\r\n */\r\n BouncingBehavior.prototype._applyBoundRadiusAnimation = function (radiusDelta) {\r\n var _this = this;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (!this._radiusBounceTransition) {\r\n BouncingBehavior.EasingFunction.setEasingMode(BouncingBehavior.EasingMode);\r\n this._radiusBounceTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"].CreateAnimation(\"radius\", _Animations_animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"].ANIMATIONTYPE_FLOAT, 60, BouncingBehavior.EasingFunction);\r\n }\r\n // Prevent zoom until bounce has completed\r\n this._cachedWheelPrecision = this._attachedCamera.wheelPrecision;\r\n this._attachedCamera.wheelPrecision = Infinity;\r\n this._attachedCamera.inertialRadiusOffset = 0;\r\n // Animate to the radius limit\r\n this.stopAllAnimations();\r\n this._radiusIsAnimating = true;\r\n var animatable = _Animations_animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"].TransitionTo(\"radius\", this._attachedCamera.radius + radiusDelta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusBounceTransition, this.transitionDuration, function () { return _this._clearAnimationLocks(); });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the camera properties.\r\n */\r\n BouncingBehavior.prototype._clearAnimationLocks = function () {\r\n this._radiusIsAnimating = false;\r\n if (this._attachedCamera) {\r\n this._attachedCamera.wheelPrecision = this._cachedWheelPrecision;\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n BouncingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n this._animatables.shift();\r\n }\r\n };\r\n /**\r\n * The easing function used by animations\r\n */\r\n BouncingBehavior.EasingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"BackEase\"](0.3);\r\n /**\r\n * The easing mode used by animations\r\n */\r\n BouncingBehavior.EasingMode = _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"EasingFunction\"].EASINGMODE_EASEOUT;\r\n return BouncingBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/framingBehavior.ts\":\n/*!**********************************************!*\\\n !*** ./Behaviors/Cameras/framingBehavior.ts ***!\n \\**********************************************/\n/*! exports provided: FramingBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return FramingBehavior; });\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\nvar FramingBehavior = /** @class */ (function () {\r\n function FramingBehavior() {\r\n this._mode = FramingBehavior.FitFrustumSidesMode;\r\n this._radiusScale = 1.0;\r\n this._positionScale = 0.5;\r\n this._defaultElevation = 0.3;\r\n this._elevationReturnTime = 1500;\r\n this._elevationReturnWaitTime = 1000;\r\n this._zoomStopsAnimation = false;\r\n this._framingTime = 1500;\r\n /**\r\n * Define if the behavior should automatically change the configured\r\n * camera limits and sensibilities.\r\n */\r\n this.autoCorrectCameraLimitsAndSensibility = true;\r\n this._isPointerDown = false;\r\n this._lastInteractionTime = -Infinity;\r\n // Framing control\r\n this._animatables = new Array();\r\n this._betaIsAnimating = false;\r\n }\r\n Object.defineProperty(FramingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Framing\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"mode\", {\r\n /**\r\n * Gets current mode used by the behavior.\r\n */\r\n get: function () {\r\n return this._mode;\r\n },\r\n /**\r\n * Sets the current mode used by the behavior\r\n */\r\n set: function (mode) {\r\n this._mode = mode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"radiusScale\", {\r\n /**\r\n * Gets the scale applied to the radius\r\n */\r\n get: function () {\r\n return this._radiusScale;\r\n },\r\n /**\r\n * Sets the scale applied to the radius (1 by default)\r\n */\r\n set: function (radius) {\r\n this._radiusScale = radius;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"positionScale\", {\r\n /**\r\n * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n get: function () {\r\n return this._positionScale;\r\n },\r\n /**\r\n * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n set: function (scale) {\r\n this._positionScale = scale;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"defaultElevation\", {\r\n /**\r\n * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n get: function () {\r\n return this._defaultElevation;\r\n },\r\n /**\r\n * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n set: function (elevation) {\r\n this._defaultElevation = elevation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnTime\", {\r\n /**\r\n * Gets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n get: function () {\r\n return this._elevationReturnTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n set: function (speed) {\r\n this._elevationReturnTime = speed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnWaitTime\", {\r\n /**\r\n * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n get: function () {\r\n return this._elevationReturnWaitTime;\r\n },\r\n /**\r\n * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n set: function (time) {\r\n this._elevationReturnWaitTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"framingTime\", {\r\n /**\r\n * Gets the transition time when framing the mesh, in milliseconds\r\n */\r\n get: function () {\r\n return this._framingTime;\r\n },\r\n /**\r\n * Sets the transition time when framing the mesh, in milliseconds\r\n */\r\n set: function (time) {\r\n this._framingTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n FramingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n FramingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n FramingBehavior.EasingFunction.setEasingMode(FramingBehavior.EasingMode);\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"].POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (mesh) {\r\n _this.zoomOnMesh(mesh);\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n // Maintain the camera above the ground. If the user pulls the camera beneath the ground plane, lift it\r\n // back to the default position after a given timeout\r\n _this._maintainCameraAboveGround();\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n FramingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Targets the given mesh and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param radius Optional. If a cached radius position already exists, overrides default.\r\n * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMesh = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getBoundingInfo().boundingBox;\r\n this.zoomOnBoundingInfo(boundingBox.minimumWorld, boundingBox.maximumWorld, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given mesh with its children and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param radius Optional. If a cached radius position already exists, overrides default.\r\n * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshHierarchy = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getHierarchyBoundingVectors(true);\r\n this.zoomOnBoundingInfo(boundingBox.min, boundingBox.max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given meshes with their children and updates zoom level accordingly.\r\n * @param meshes The mesh to target.\r\n * @param radius Optional. If a cached radius position already exists, overrides default.\r\n * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshesHierarchy = function (meshes, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var min = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var i = 0; i < meshes.length; i++) {\r\n var boundingInfo = meshes[i].getHierarchyBoundingVectors(true);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CheckExtends(boundingInfo.min, min, max);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CheckExtends(boundingInfo.max, min, max);\r\n }\r\n this.zoomOnBoundingInfo(min, max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the bounding box info defined by its extends and updates zoom level accordingly.\r\n * @param minimumWorld Determines the smaller position of the bounding box extend\r\n * @param maximumWorld Determines the bigger position of the bounding box extend\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnBoundingInfo = function (minimumWorld, maximumWorld, focusOnOriginXZ, onAnimationEnd) {\r\n var _this = this;\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var zoomTarget;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n // Find target by interpolating from bottom of bounding box in world-space to top via framingPositionY\r\n var bottom = minimumWorld.y;\r\n var top = maximumWorld.y;\r\n var zoomTargetY = bottom + (top - bottom) * this._positionScale;\r\n var radiusWorld = maximumWorld.subtract(minimumWorld).scale(0.5);\r\n if (focusOnOriginXZ) {\r\n zoomTarget = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, zoomTargetY, 0);\r\n }\r\n else {\r\n var centerWorld = minimumWorld.add(radiusWorld);\r\n zoomTarget = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](centerWorld.x, zoomTargetY, centerWorld.z);\r\n }\r\n if (!this._vectorTransition) {\r\n this._vectorTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].CreateAnimation(\"target\", _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].ANIMATIONTYPE_VECTOR3, 60, FramingBehavior.EasingFunction);\r\n }\r\n this._betaIsAnimating = true;\r\n var animatable = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].TransitionTo(\"target\", zoomTarget, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n // sets the radius and lower radius bounds\r\n // Small delta ensures camera is not always at lower zoom limit.\r\n var radius = 0;\r\n if (this._mode === FramingBehavior.FitFrustumSidesMode) {\r\n var position = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n this._attachedCamera.lowerRadiusLimit = radiusWorld.length() + this._attachedCamera.minZ;\r\n }\r\n radius = position;\r\n }\r\n else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n radius = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null) {\r\n this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;\r\n }\r\n }\r\n // Set sensibilities\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n var extend = maximumWorld.subtract(minimumWorld).length();\r\n this._attachedCamera.panningSensibility = 5000 / extend;\r\n this._attachedCamera.wheelPrecision = 100 / radius;\r\n }\r\n // transition to new radius\r\n if (!this._radiusTransition) {\r\n this._radiusTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].CreateAnimation(\"radius\", _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n animatable = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].TransitionTo(\"radius\", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function () {\r\n _this.stopAllAnimations();\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n if (_this._attachedCamera && _this._attachedCamera.useInputToRestoreState) {\r\n _this._attachedCamera.storeState();\r\n }\r\n });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Calculates the lowest radius for the camera based on the bounding box of the mesh.\r\n * @param mesh The mesh on which to base the calculation. mesh boundingInfo used to estimate necessary\r\n *\t\t\t frustum width.\r\n * @return The minimum distance from the primary mesh's center point at which the camera must be kept in order\r\n *\t\t to fully enclose the mesh in the viewing frustum.\r\n */\r\n FramingBehavior.prototype._calculateLowerRadiusFromModelBoundingSphere = function (minimumWorld, maximumWorld) {\r\n var size = maximumWorld.subtract(minimumWorld);\r\n var boxVectorGlobalDiagonal = size.length();\r\n var frustumSlope = this._getFrustumSlope();\r\n // Formula for setting distance\r\n // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)\r\n var radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;\r\n // Horizon distance\r\n var radius = radiusWithoutFraming * this._radiusScale;\r\n var distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.x * frustumSlope.x));\r\n var distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.y * frustumSlope.y));\r\n var distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return 0;\r\n }\r\n if (camera.lowerRadiusLimit && this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n // Don't exceed the requested limit\r\n distance = distance < camera.lowerRadiusLimit ? camera.lowerRadiusLimit : distance;\r\n }\r\n // Don't exceed the upper radius limit\r\n if (camera.upperRadiusLimit) {\r\n distance = distance > camera.upperRadiusLimit ? camera.upperRadiusLimit : distance;\r\n }\r\n return distance;\r\n };\r\n /**\r\n * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera\r\n * is automatically returned to its default position (expected to be above ground plane).\r\n */\r\n FramingBehavior.prototype._maintainCameraAboveGround = function () {\r\n var _this = this;\r\n if (this._elevationReturnTime < 0) {\r\n return;\r\n }\r\n var timeSinceInteraction = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__[\"PrecisionDate\"].Now - this._lastInteractionTime;\r\n var defaultBeta = Math.PI * 0.5 - this._defaultElevation;\r\n var limitBeta = Math.PI * 0.5;\r\n // Bring the camera back up if below the ground plane\r\n if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > limitBeta && timeSinceInteraction >= this._elevationReturnWaitTime) {\r\n this._betaIsAnimating = true;\r\n //Transition to new position\r\n this.stopAllAnimations();\r\n if (!this._betaTransition) {\r\n this._betaTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].CreateAnimation(\"beta\", _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n var animatabe = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].TransitionTo(\"beta\", defaultBeta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._betaTransition, this._elevationReturnTime, function () {\r\n _this._clearAnimationLocks();\r\n _this.stopAllAnimations();\r\n });\r\n if (animatabe) {\r\n this._animatables.push(animatabe);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the frustum slope based on the canvas ratio and camera FOV\r\n * @returns The frustum slope represented as a Vector2 with X and Y slopes\r\n */\r\n FramingBehavior.prototype._getFrustumSlope = function () {\r\n // Calculate the viewport ratio\r\n // Aspect Ratio is Height/Width.\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n }\r\n var engine = camera.getScene().getEngine();\r\n var aspectRatio = engine.getAspectRatio(camera);\r\n // Camera FOV is the vertical field of view (top-bottom) in radians.\r\n // Slope of the frustum top/bottom planes in view space, relative to the forward vector.\r\n var frustumSlopeY = Math.tan(camera.fov / 2);\r\n // Slope of the frustum left/right planes in view space, relative to the forward vector.\r\n // Provides the amount that one side (e.g. left) of the frustum gets wider for every unit\r\n // along the forward vector.\r\n var frustumSlopeX = frustumSlopeY * aspectRatio;\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](frustumSlopeX, frustumSlopeY);\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.\r\n */\r\n FramingBehavior.prototype._clearAnimationLocks = function () {\r\n this._betaIsAnimating = false;\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n FramingBehavior.prototype._applyUserInteraction = function () {\r\n if (this.isUserIsMoving) {\r\n this._lastInteractionTime = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__[\"PrecisionDate\"].Now;\r\n this.stopAllAnimations();\r\n this._clearAnimationLocks();\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n FramingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n if (this._animatables[0]) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n }\r\n this._animatables.shift();\r\n }\r\n };\r\n Object.defineProperty(FramingBehavior.prototype, \"isUserIsMoving\", {\r\n /**\r\n * Gets a value indicating if the user is moving the camera\r\n */\r\n get: function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * The easing function used by animations\r\n */\r\n FramingBehavior.EasingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"ExponentialEase\"]();\r\n /**\r\n * The easing mode used by animations\r\n */\r\n FramingBehavior.EasingMode = _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"EasingFunction\"].EASINGMODE_EASEINOUT;\r\n // Statics\r\n /**\r\n * The camera can move all the way towards the mesh.\r\n */\r\n FramingBehavior.IgnoreBoundsSizeMode = 0;\r\n /**\r\n * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides\r\n */\r\n FramingBehavior.FitFrustumSidesMode = 1;\r\n return FramingBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/index.ts\":\n/*!************************************!*\\\n !*** ./Behaviors/Cameras/index.ts ***!\n \\************************************/\n/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _autoRotationBehavior__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autoRotationBehavior */ \"./Behaviors/Cameras/autoRotationBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _autoRotationBehavior__WEBPACK_IMPORTED_MODULE_0__[\"AutoRotationBehavior\"]; });\n\n/* harmony import */ var _bouncingBehavior__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bouncingBehavior */ \"./Behaviors/Cameras/bouncingBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _bouncingBehavior__WEBPACK_IMPORTED_MODULE_1__[\"BouncingBehavior\"]; });\n\n/* harmony import */ var _framingBehavior__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./framingBehavior */ \"./Behaviors/Cameras/framingBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _framingBehavior__WEBPACK_IMPORTED_MODULE_2__[\"FramingBehavior\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/attachToBoxBehavior.ts\":\n/*!*************************************************!*\\\n !*** ./Behaviors/Meshes/attachToBoxBehavior.ts ***!\n \\*************************************************/\n/*! exports provided: AttachToBoxBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return AttachToBoxBehavior; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * @hidden\r\n */\r\nvar FaceDirectionInfo = /** @class */ (function () {\r\n function FaceDirectionInfo(direction, rotatedDirection, diff, ignore) {\r\n if (rotatedDirection === void 0) { rotatedDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](); }\r\n if (diff === void 0) { diff = 0; }\r\n if (ignore === void 0) { ignore = false; }\r\n this.direction = direction;\r\n this.rotatedDirection = rotatedDirection;\r\n this.diff = diff;\r\n this.ignore = ignore;\r\n }\r\n return FaceDirectionInfo;\r\n}());\r\n/**\r\n * A behavior that when attached to a mesh will will place a specified node on the meshes face pointing towards the camera\r\n */\r\nvar AttachToBoxBehavior = /** @class */ (function () {\r\n /**\r\n * Creates the AttachToBoxBehavior, used to attach UI to the closest face of the box to a camera\r\n * @param ui The transform node that should be attched to the mesh\r\n */\r\n function AttachToBoxBehavior(ui) {\r\n this.ui = ui;\r\n /**\r\n * The name of the behavior\r\n */\r\n this.name = \"AttachToBoxBehavior\";\r\n /**\r\n * The distance away from the face of the mesh that the UI should be attached to (default: 0.15)\r\n */\r\n this.distanceAwayFromFace = 0.15;\r\n /**\r\n * The distance from the bottom of the face that the UI should be attached to (default: 0.15)\r\n */\r\n this.distanceAwayFromBottomOfFace = 0.15;\r\n this._faceVectors = [new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Down()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Left()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Right()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Forward()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Forward().scaleInPlace(-1))];\r\n this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]();\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n this._zeroVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._lookAtTmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]();\r\n /* Does nothing */\r\n }\r\n /**\r\n * Initializes the behavior\r\n */\r\n AttachToBoxBehavior.prototype.init = function () {\r\n /* Does nothing */\r\n };\r\n AttachToBoxBehavior.prototype._closestFace = function (targetDirection) {\r\n var _this = this;\r\n // Go over each face and calculate the angle between the face's normal and targetDirection\r\n this._faceVectors.forEach(function (v) {\r\n if (!_this._target.rotationQuaternion) {\r\n _this._target.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRoll(_this._target.rotation.y, _this._target.rotation.x, _this._target.rotation.z);\r\n }\r\n _this._target.rotationQuaternion.toRotationMatrix(_this._tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(v.direction, _this._tmpMatrix, v.rotatedDirection);\r\n v.diff = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].GetAngleBetweenVectors(v.rotatedDirection, targetDirection, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(v.rotatedDirection, targetDirection));\r\n });\r\n // Return the face information of the one with the normal closeset to target direction\r\n return this._faceVectors.reduce(function (min, p) {\r\n if (min.ignore) {\r\n return p;\r\n }\r\n else if (p.ignore) {\r\n return min;\r\n }\r\n else {\r\n return min.diff < p.diff ? min : p;\r\n }\r\n }, this._faceVectors[0]);\r\n };\r\n AttachToBoxBehavior.prototype._lookAtToRef = function (pos, up, ref) {\r\n if (up === void 0) { up = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1, 0); }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].LookAtLHToRef(this._zeroVector, pos, up, this._lookAtTmpMatrix);\r\n this._lookAtTmpMatrix.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromRotationMatrixToRef(this._lookAtTmpMatrix, ref);\r\n };\r\n /**\r\n * Attaches the AttachToBoxBehavior to the passed in mesh\r\n * @param target The mesh that the specified node will be attached to\r\n */\r\n AttachToBoxBehavior.prototype.attach = function (target) {\r\n var _this = this;\r\n this._target = target;\r\n this._scene = this._target.getScene();\r\n // Every frame, update the app bars position\r\n this._onRenderObserver = this._scene.onBeforeRenderObservable.add(function () {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n // Find the face closest to the cameras position\r\n var cameraPos = _this._scene.activeCamera.position;\r\n if (_this._scene.activeCamera.devicePosition) {\r\n cameraPos = _this._scene.activeCamera.devicePosition;\r\n }\r\n var facing = _this._closestFace(cameraPos.subtract(target.position));\r\n if (_this._scene.activeCamera.leftCamera) {\r\n _this._scene.activeCamera.leftCamera.computeWorldMatrix().getRotationMatrixToRef(_this._tmpMatrix);\r\n }\r\n else {\r\n _this._scene.activeCamera.computeWorldMatrix().getRotationMatrixToRef(_this._tmpMatrix);\r\n }\r\n // Get camera up direction\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(), _this._tmpMatrix, _this._tmpVector);\r\n // Ignore faces to not select a parrelel face for the up vector of the UI\r\n _this._faceVectors.forEach(function (v) {\r\n if (facing.direction.x && v.direction.x) {\r\n v.ignore = true;\r\n }\r\n if (facing.direction.y && v.direction.y) {\r\n v.ignore = true;\r\n }\r\n if (facing.direction.z && v.direction.z) {\r\n v.ignore = true;\r\n }\r\n });\r\n var facingUp = _this._closestFace(_this._tmpVector);\r\n // Unignore faces\r\n _this._faceVectors.forEach(function (v) {\r\n v.ignore = false;\r\n });\r\n // Position the app bar on that face\r\n _this.ui.position.copyFrom(target.position);\r\n if (facing.direction.x) {\r\n facing.rotatedDirection.scaleToRef((target.scaling.x / 2) + _this.distanceAwayFromFace, _this._tmpVector);\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n }\r\n if (facing.direction.y) {\r\n facing.rotatedDirection.scaleToRef((target.scaling.y / 2) + _this.distanceAwayFromFace, _this._tmpVector);\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n }\r\n if (facing.direction.z) {\r\n facing.rotatedDirection.scaleToRef((target.scaling.z / 2) + _this.distanceAwayFromFace, _this._tmpVector);\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n }\r\n // Rotate to be oriented properly to the camera\r\n if (!_this.ui.rotationQuaternion) {\r\n _this.ui.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRoll(_this.ui.rotation.y, _this.ui.rotation.x, _this.ui.rotation.z);\r\n }\r\n facing.rotatedDirection.scaleToRef(-1, _this._tmpVector);\r\n _this._lookAtToRef(_this._tmpVector, facingUp.rotatedDirection, _this.ui.rotationQuaternion);\r\n // Place ui the correct distance from the bottom of the mesh\r\n if (facingUp.direction.x) {\r\n _this.ui.up.scaleToRef(_this.distanceAwayFromBottomOfFace - target.scaling.x / 2, _this._tmpVector);\r\n }\r\n if (facingUp.direction.y) {\r\n _this.ui.up.scaleToRef(_this.distanceAwayFromBottomOfFace - target.scaling.y / 2, _this._tmpVector);\r\n }\r\n if (facingUp.direction.z) {\r\n _this.ui.up.scaleToRef(_this.distanceAwayFromBottomOfFace - target.scaling.z / 2, _this._tmpVector);\r\n }\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n AttachToBoxBehavior.prototype.detach = function () {\r\n this._scene.onBeforeRenderObservable.remove(this._onRenderObserver);\r\n };\r\n return AttachToBoxBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/fadeInOutBehavior.ts\":\n/*!***********************************************!*\\\n !*** ./Behaviors/Meshes/fadeInOutBehavior.ts ***!\n \\***********************************************/\n/*! exports provided: FadeInOutBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return FadeInOutBehavior; });\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to fade in and out\r\n */\r\nvar FadeInOutBehavior = /** @class */ (function () {\r\n /**\r\n * Instatiates the FadeInOutBehavior\r\n */\r\n function FadeInOutBehavior() {\r\n var _this = this;\r\n /**\r\n * Time in milliseconds to delay before fading in (Default: 0)\r\n */\r\n this.delay = 0;\r\n /**\r\n * Time in milliseconds for the mesh to fade in (Default: 300)\r\n */\r\n this.fadeInTime = 300;\r\n this._millisecondsPerFrame = 1000 / 60;\r\n this._hovered = false;\r\n this._hoverValue = 0;\r\n this._ownerNode = null;\r\n this._update = function () {\r\n if (_this._ownerNode) {\r\n _this._hoverValue += _this._hovered ? _this._millisecondsPerFrame : -_this._millisecondsPerFrame;\r\n _this._setAllVisibility(_this._ownerNode, (_this._hoverValue - _this.delay) / _this.fadeInTime);\r\n if (_this._ownerNode.visibility > 1) {\r\n _this._setAllVisibility(_this._ownerNode, 1);\r\n _this._hoverValue = _this.fadeInTime + _this.delay;\r\n return;\r\n }\r\n else if (_this._ownerNode.visibility < 0) {\r\n _this._setAllVisibility(_this._ownerNode, 0);\r\n if (_this._hoverValue < 0) {\r\n _this._hoverValue = 0;\r\n return;\r\n }\r\n }\r\n setTimeout(_this._update, _this._millisecondsPerFrame);\r\n }\r\n };\r\n }\r\n Object.defineProperty(FadeInOutBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"FadeInOut\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n FadeInOutBehavior.prototype.init = function () {\r\n };\r\n /**\r\n * Attaches the fade behavior on the passed in mesh\r\n * @param ownerNode The mesh that will be faded in/out once attached\r\n */\r\n FadeInOutBehavior.prototype.attach = function (ownerNode) {\r\n this._ownerNode = ownerNode;\r\n this._setAllVisibility(this._ownerNode, 0);\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n FadeInOutBehavior.prototype.detach = function () {\r\n this._ownerNode = null;\r\n };\r\n /**\r\n * Triggers the mesh to begin fading in or out\r\n * @param value if the object should fade in or out (true to fade in)\r\n */\r\n FadeInOutBehavior.prototype.fadeIn = function (value) {\r\n this._hovered = value;\r\n this._update();\r\n };\r\n FadeInOutBehavior.prototype._setAllVisibility = function (mesh, value) {\r\n var _this = this;\r\n mesh.visibility = value;\r\n mesh.getChildMeshes().forEach(function (c) {\r\n _this._setAllVisibility(c, value);\r\n });\r\n };\r\n return FadeInOutBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/index.ts\":\n/*!***********************************!*\\\n !*** ./Behaviors/Meshes/index.ts ***!\n \\***********************************/\n/*! exports provided: AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _attachToBoxBehavior__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./attachToBoxBehavior */ \"./Behaviors/Meshes/attachToBoxBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _attachToBoxBehavior__WEBPACK_IMPORTED_MODULE_0__[\"AttachToBoxBehavior\"]; });\n\n/* harmony import */ var _fadeInOutBehavior__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fadeInOutBehavior */ \"./Behaviors/Meshes/fadeInOutBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _fadeInOutBehavior__WEBPACK_IMPORTED_MODULE_1__[\"FadeInOutBehavior\"]; });\n\n/* harmony import */ var _multiPointerScaleBehavior__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./multiPointerScaleBehavior */ \"./Behaviors/Meshes/multiPointerScaleBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _multiPointerScaleBehavior__WEBPACK_IMPORTED_MODULE_2__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony import */ var _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_3__[\"PointerDragBehavior\"]; });\n\n/* harmony import */ var _sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sixDofDragBehavior */ \"./Behaviors/Meshes/sixDofDragBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_4__[\"SixDofDragBehavior\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/multiPointerScaleBehavior.ts\":\n/*!*******************************************************!*\\\n !*** ./Behaviors/Meshes/multiPointerScaleBehavior.ts ***!\n \\*******************************************************/\n/*! exports provided: MultiPointerScaleBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return MultiPointerScaleBehavior; });\n/* harmony import */ var _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be scaled\r\n */\r\nvar MultiPointerScaleBehavior = /** @class */ (function () {\r\n /**\r\n * Instantiate a new behavior that when attached to a mesh will allow the mesh to be scaled\r\n */\r\n function MultiPointerScaleBehavior() {\r\n this._startDistance = 0;\r\n this._initialScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0);\r\n this._targetScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0);\r\n this._sceneRenderObserver = null;\r\n this._dragBehaviorA = new _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_0__[\"PointerDragBehavior\"]({});\r\n this._dragBehaviorA.moveAttached = false;\r\n this._dragBehaviorB = new _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_0__[\"PointerDragBehavior\"]({});\r\n this._dragBehaviorB.moveAttached = false;\r\n }\r\n Object.defineProperty(MultiPointerScaleBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"MultiPointerScale\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n MultiPointerScaleBehavior.prototype.init = function () { };\r\n MultiPointerScaleBehavior.prototype._getCurrentDistance = function () {\r\n return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length();\r\n };\r\n /**\r\n * Attaches the scale behavior the passed in mesh\r\n * @param ownerNode The mesh that will be scaled around once attached\r\n */\r\n MultiPointerScaleBehavior.prototype.attach = function (ownerNode) {\r\n var _this = this;\r\n this._ownerNode = ownerNode;\r\n // Create 2 drag behaviors such that each will only be triggered by a separate pointer\r\n this._dragBehaviorA.onDragStartObservable.add(function (e) {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n if (_this._dragBehaviorA.currentDraggingPointerID == _this._dragBehaviorB.currentDraggingPointerID) {\r\n _this._dragBehaviorA.releaseDrag();\r\n }\r\n else {\r\n _this._initialScale.copyFrom(ownerNode.scaling);\r\n _this._startDistance = _this._getCurrentDistance();\r\n }\r\n }\r\n });\r\n this._dragBehaviorB.onDragStartObservable.add(function (e) {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n if (_this._dragBehaviorA.currentDraggingPointerID == _this._dragBehaviorB.currentDraggingPointerID) {\r\n _this._dragBehaviorB.releaseDrag();\r\n }\r\n else {\r\n _this._initialScale.copyFrom(ownerNode.scaling);\r\n _this._startDistance = _this._getCurrentDistance();\r\n }\r\n }\r\n });\r\n // Once both drag behaviors are active scale based on the distance between the two pointers\r\n [this._dragBehaviorA, this._dragBehaviorB].forEach(function (behavior) {\r\n behavior.onDragObservable.add(function () {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n var ratio = _this._getCurrentDistance() / _this._startDistance;\r\n _this._initialScale.scaleToRef(ratio, _this._targetScale);\r\n }\r\n });\r\n });\r\n ownerNode.addBehavior(this._dragBehaviorA);\r\n ownerNode.addBehavior(this._dragBehaviorB);\r\n // On every frame move towards target scaling to avoid jitter caused by vr controllers\r\n this._sceneRenderObserver = ownerNode.getScene().onBeforeRenderObservable.add(function () {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n var change = _this._targetScale.subtract(ownerNode.scaling).scaleInPlace(0.1);\r\n if (change.length() > 0.01) {\r\n ownerNode.scaling.addInPlace(change);\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n MultiPointerScaleBehavior.prototype.detach = function () {\r\n var _this = this;\r\n this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver);\r\n [this._dragBehaviorA, this._dragBehaviorB].forEach(function (behavior) {\r\n behavior.onDragStartObservable.clear();\r\n behavior.onDragObservable.clear();\r\n _this._ownerNode.removeBehavior(behavior);\r\n });\r\n };\r\n return MultiPointerScaleBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/pointerDragBehavior.ts\":\n/*!*************************************************!*\\\n !*** ./Behaviors/Meshes/pointerDragBehavior.ts ***!\n \\*************************************************/\n/*! exports provided: PointerDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return PointerDragBehavior; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/pivotTools */ \"./Misc/pivotTools.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nvar PointerDragBehavior = /** @class */ (function () {\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n */\r\n function PointerDragBehavior(options) {\r\n this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n this.maxDragAngle = 0;\r\n /**\r\n * @hidden\r\n */\r\n this._useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n this.currentDraggingPointerID = -1;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n this.dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n this.dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n this.updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n this._debugMode = false;\r\n this._moving = false;\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n * * delta between last drag position and current drag position in world space\r\n * * dragDistance along the drag axis\r\n * * dragPlaneNormal normal of the current drag plane used during the drag\r\n * * dragPlanePoint in world space where the drag intersects the drag plane\r\n */\r\n this.onDragObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n */\r\n this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n this.moveAttached = true;\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n this.enabled = true;\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n this.startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n this.detachCameraControls = true;\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n this.useObjectOrienationForDragging = true;\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved\r\n */\r\n this.validateDrag = function (targetPosition) { return true; };\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._alternatePickedPoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._worldDragAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._targetPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._attachedElement = null;\r\n this._startDragRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]());\r\n this._lastPointerRay = {};\r\n this._dragDelta = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n // Variables to avoid instantiation in the below method\r\n this._pointA = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._pointB = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._pointC = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._lineA = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._lineB = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._localAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._lookAt = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._options = options ? options : {};\r\n var optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n Object.defineProperty(PointerDragBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"PointerDrag\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n PointerDragBehavior.prototype.init = function () { };\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n PointerDragBehavior.prototype.attach = function (ownerNode, predicate) {\r\n var _this = this;\r\n this._scene = ownerNode.getScene();\r\n this.attachedNode = ownerNode;\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._planeScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._planeScene = this._scene;\r\n }\r\n else {\r\n PointerDragBehavior._planeScene = new _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"](this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._planeScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(function () {\r\n PointerDragBehavior._planeScene.dispose();\r\n PointerDragBehavior._planeScene = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreatePlane(\"pointerDragPlane\", this._debugMode ? 1 : 10000, PointerDragBehavior._planeScene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].DOUBLESIDE);\r\n // State of the drag\r\n this.lastDragPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n var pickPredicate = !!predicate ? predicate : function (m) {\r\n return _this.attachedNode == m || m.isDescendantOf(_this.attachedNode);\r\n };\r\n this._pointerObserver = this._scene.onPointerObservable.add(function (pointerInfo, eventState) {\r\n if (!_this.enabled) {\r\n return;\r\n }\r\n if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (_this.startAndReleaseDragOnPointerEvents && !_this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.pickedPoint && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\r\n _this._startDrag(pointerInfo.event.pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERUP) {\r\n if (_this.startAndReleaseDragOnPointerEvents && _this.currentDraggingPointerID == pointerInfo.event.pointerId) {\r\n _this.releaseDrag();\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE) {\r\n var pointerId = pointerInfo.event.pointerId;\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (_this.currentDraggingPointerID === PointerDragBehavior._AnyMouseID && pointerId !== PointerDragBehavior._AnyMouseID && pointerInfo.event.pointerType == \"mouse\") {\r\n if (_this._lastPointerRay[_this.currentDraggingPointerID]) {\r\n _this._lastPointerRay[pointerId] = _this._lastPointerRay[_this.currentDraggingPointerID];\r\n delete _this._lastPointerRay[_this.currentDraggingPointerID];\r\n }\r\n _this.currentDraggingPointerID = pointerId;\r\n }\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!_this._lastPointerRay[pointerId]) {\r\n _this._lastPointerRay[pointerId] = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n _this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n if (_this.currentDraggingPointerID == pointerId && _this.dragging) {\r\n _this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n }\r\n });\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(function () {\r\n if (_this._moving && _this.moveAttached) {\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(_this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n _this._targetPosition.subtractToRef((_this.attachedNode).absolutePosition, _this._tmpVector);\r\n _this._tmpVector.scaleInPlace(_this.dragDeltaRatio);\r\n (_this.attachedNode).getAbsolutePosition().addToRef(_this._tmpVector, _this._tmpVector);\r\n if (_this.validateDrag(_this._tmpVector)) {\r\n (_this.attachedNode).setAbsolutePosition(_this._tmpVector);\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(_this.attachedNode);\r\n }\r\n });\r\n };\r\n /**\r\n * Force relase the drag action by code.\r\n */\r\n PointerDragBehavior.prototype.releaseDrag = function () {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID });\r\n this.currentDraggingPointerID = -1;\r\n this._moving = false;\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n this._scene.activeCamera.attachControl(this._attachedElement, true);\r\n }\r\n };\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n PointerDragBehavior.prototype.startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (pointerId === void 0) { pointerId = PointerDragBehavior._AnyMouseID; }\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n var lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseID) {\r\n lastRay = this._lastPointerRay[Object.keys(this._lastPointerRay)[0]];\r\n }\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n };\r\n PointerDragBehavior.prototype._startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n }\r\n else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerID = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });\r\n this._targetPosition.copyFrom((this.attachedNode).absolutePosition);\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedElement) {\r\n this._attachedElement = this._scene.activeCamera.inputs.attachedElement;\r\n this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement);\r\n }\r\n else {\r\n this._attachedElement = null;\r\n }\r\n }\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(this.attachedNode);\r\n };\r\n PointerDragBehavior.prototype._moveDrag = function (ray) {\r\n this._moving = true;\r\n var pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n if (pickedPoint) {\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n var dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrienationForDragging\r\n this.useObjectOrienationForDragging ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis) : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n dragLength = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n }\r\n else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({ dragDistance: dragLength, delta: this._dragDelta, dragPlanePoint: pickedPoint, dragPlaneNormal: this._dragPlane.forward, pointerId: this.currentDraggingPointerID });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n }\r\n };\r\n PointerDragBehavior.prototype._pickWithRayOnDragPlane = function (ray) {\r\n var _this = this;\r\n if (!ray) {\r\n return null;\r\n }\r\n // Calculate angle between plane normal and ray\r\n var angle = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n (this.attachedNode).absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n var dot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace((this.attachedNode).absolutePosition);\r\n return this._alternatePickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n var pickResult = PointerDragBehavior._planeScene.pickWithRay(ray, function (m) { return m == _this._dragPlane; });\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && pickResult.pickedPoint) {\r\n return pickResult.pickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n PointerDragBehavior.prototype._updateDragPlanePosition = function (ray, dragPlanePosition) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrienationForDragging ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragAxis);\r\n // Calculate plane normal in direction of camera but perpendicular to drag axis\r\n this._pointA.addToRef(this._localAxis, this._pointB); // towards drag axis\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointA.addToRef(this._pointC.normalize(), this._pointC); // towards camera\r\n // Get perpendicular line from direction to camera and drag axis\r\n this._pointB.subtractToRef(this._pointA, this._lineA);\r\n this._pointC.subtractToRef(this._pointA, this._lineB);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(this._lineA, this._lineB, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendiculat to camera\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(this._lineA, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrienationForDragging ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else {\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(ray.origin);\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition);\r\n this._dragPlane.computeWorldMatrix(true);\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n PointerDragBehavior.prototype.detach = function () {\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n this.releaseDrag();\r\n };\r\n PointerDragBehavior._AnyMouseID = -2;\r\n return PointerDragBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/sixDofDragBehavior.ts\":\n/*!************************************************!*\\\n !*** ./Behaviors/Meshes/sixDofDragBehavior.ts ***!\n \\************************************************/\n/*! exports provided: SixDofDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return SixDofDragBehavior; });\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/pivotTools */ \"./Misc/pivotTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around based on directions and origin of the pointer's ray\r\n */\r\nvar SixDofDragBehavior = /** @class */ (function () {\r\n /**\r\n * Instantiates a behavior that when attached to a mesh will allow the mesh to be dragged around based on directions and origin of the pointer's ray\r\n */\r\n function SixDofDragBehavior() {\r\n this._sceneRenderObserver = null;\r\n this._targetPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._moving = false;\r\n this._startingOrientation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n /**\r\n * How much faster the object should move when the controller is moving towards it. This is useful to bring objects that are far away from the user to them faster. Set this to 0 to avoid any speed increase. (Default: 3)\r\n */\r\n this.zDragFactor = 3;\r\n /**\r\n * If the object should rotate to face the drag origin\r\n */\r\n this.rotateDraggedObject = true;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n this.dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n this.dragDeltaRatio = 0.2;\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n this.currentDraggingPointerID = -1;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n this.detachCameraControls = true;\r\n /**\r\n * Fires each time a drag starts\r\n */\r\n this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n }\r\n Object.defineProperty(SixDofDragBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"SixDofDrag\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n SixDofDragBehavior.prototype.init = function () { };\r\n Object.defineProperty(SixDofDragBehavior.prototype, \"_pointerCamera\", {\r\n /**\r\n * In the case of multiplea active cameras, the cameraToUseForPointers should be used if set instead of active camera\r\n */\r\n get: function () {\r\n if (this._scene.cameraToUseForPointers) {\r\n return this._scene.cameraToUseForPointers;\r\n }\r\n else {\r\n return this._scene.activeCamera;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches the scale behavior the passed in mesh\r\n * @param ownerNode The mesh that will be scaled around once attached\r\n */\r\n SixDofDragBehavior.prototype.attach = function (ownerNode) {\r\n var _this = this;\r\n this._ownerNode = ownerNode;\r\n this._scene = this._ownerNode.getScene();\r\n if (!SixDofDragBehavior._virtualScene) {\r\n SixDofDragBehavior._virtualScene = new _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"](this._scene.getEngine());\r\n SixDofDragBehavior._virtualScene.detachControl();\r\n this._scene.getEngine().scenes.pop();\r\n }\r\n var pickedMesh = null;\r\n var lastSixDofOriginPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n // Setup virtual meshes to be used for dragging without dirtying the existing scene\r\n this._virtualOriginMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"](\"\", SixDofDragBehavior._virtualScene);\r\n this._virtualOriginMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n this._virtualDragMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"](\"\", SixDofDragBehavior._virtualScene);\r\n this._virtualDragMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n var pickPredicate = function (m) {\r\n return _this._ownerNode == m || m.isDescendantOf(_this._ownerNode);\r\n };\r\n var attachedElement = null;\r\n this._pointerObserver = this._scene.onPointerObservable.add(function (pointerInfo, eventState) {\r\n if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (!_this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\r\n if (_this._pointerCamera && _this._pointerCamera.cameraRigMode == _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__[\"Camera\"].RIG_MODE_NONE) {\r\n pointerInfo.pickInfo.ray.origin.copyFrom(_this._pointerCamera.globalPosition);\r\n }\r\n pickedMesh = _this._ownerNode;\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(pickedMesh);\r\n lastSixDofOriginPosition.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n // Set position and orientation of the controller\r\n _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(pointerInfo.pickInfo.ray.direction));\r\n // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged\r\n _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);\r\n pickedMesh.computeWorldMatrix();\r\n _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);\r\n if (!pickedMesh.rotationQuaternion) {\r\n pickedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);\r\n }\r\n var oldParent = pickedMesh.parent;\r\n pickedMesh.setParent(null);\r\n _this._virtualDragMesh.rotationQuaternion.copyFrom(pickedMesh.rotationQuaternion);\r\n pickedMesh.setParent(oldParent);\r\n _this._virtualOriginMesh.addChild(_this._virtualDragMesh);\r\n // Update state\r\n _this._targetPosition.copyFrom(_this._virtualDragMesh.absolutePosition);\r\n _this.dragging = true;\r\n _this.currentDraggingPointerID = pointerInfo.event.pointerId;\r\n // Detatch camera controls\r\n if (_this.detachCameraControls && _this._pointerCamera && !_this._pointerCamera.leftCamera) {\r\n if (_this._pointerCamera.inputs.attachedElement) {\r\n attachedElement = _this._pointerCamera.inputs.attachedElement;\r\n _this._pointerCamera.detachControl(_this._pointerCamera.inputs.attachedElement);\r\n }\r\n else {\r\n attachedElement = null;\r\n }\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(pickedMesh);\r\n _this.onDragStartObservable.notifyObservers({});\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP) {\r\n if (_this.currentDraggingPointerID == pointerInfo.event.pointerId) {\r\n _this.dragging = false;\r\n _this._moving = false;\r\n _this.currentDraggingPointerID = -1;\r\n pickedMesh = null;\r\n _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);\r\n // Reattach camera controls\r\n if (_this.detachCameraControls && attachedElement && _this._pointerCamera && !_this._pointerCamera.leftCamera) {\r\n _this._pointerCamera.attachControl(attachedElement, true);\r\n }\r\n _this.onDragEndObservable.notifyObservers({});\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (_this.currentDraggingPointerID == pointerInfo.event.pointerId && _this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.ray && pickedMesh) {\r\n var zDragFactor = _this.zDragFactor;\r\n if (_this._pointerCamera && _this._pointerCamera.cameraRigMode == _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__[\"Camera\"].RIG_MODE_NONE) {\r\n pointerInfo.pickInfo.ray.origin.copyFrom(_this._pointerCamera.globalPosition);\r\n zDragFactor = 0;\r\n }\r\n // Calculate controller drag distance in controller space\r\n var originDragDifference = pointerInfo.pickInfo.ray.origin.subtract(lastSixDofOriginPosition);\r\n lastSixDofOriginPosition.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n var localOriginDragDifference = -_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(originDragDifference, pointerInfo.pickInfo.ray.direction);\r\n _this._virtualOriginMesh.addChild(_this._virtualDragMesh);\r\n // Determine how much the controller moved to/away towards the dragged object and use this to move the object further when its further away\r\n _this._virtualDragMesh.position.z -= _this._virtualDragMesh.position.z < 1 ? localOriginDragDifference * _this.zDragFactor : localOriginDragDifference * zDragFactor * _this._virtualDragMesh.position.z;\r\n if (_this._virtualDragMesh.position.z < 0) {\r\n _this._virtualDragMesh.position.z = 0;\r\n }\r\n // Update the controller position\r\n _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(pointerInfo.pickInfo.ray.direction));\r\n _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);\r\n // Move the virtualObjectsPosition into the picked mesh's space if needed\r\n _this._targetPosition.copyFrom(_this._virtualDragMesh.absolutePosition);\r\n if (pickedMesh.parent) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(_this._targetPosition, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(pickedMesh.parent.getWorldMatrix()), _this._targetPosition);\r\n }\r\n if (!_this._moving) {\r\n _this._startingOrientation.copyFrom(_this._virtualDragMesh.rotationQuaternion);\r\n }\r\n _this._moving = true;\r\n }\r\n }\r\n });\r\n var tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n // On every frame move towards target scaling to avoid jitter caused by vr controllers\r\n this._sceneRenderObserver = ownerNode.getScene().onBeforeRenderObservable.add(function () {\r\n if (_this.dragging && _this._moving && pickedMesh) {\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(pickedMesh);\r\n // Slowly move mesh to avoid jitter\r\n pickedMesh.position.addInPlace(_this._targetPosition.subtract(pickedMesh.position).scale(_this.dragDeltaRatio));\r\n if (_this.rotateDraggedObject) {\r\n // Get change in rotation\r\n tmpQuaternion.copyFrom(_this._startingOrientation);\r\n tmpQuaternion.x = -tmpQuaternion.x;\r\n tmpQuaternion.y = -tmpQuaternion.y;\r\n tmpQuaternion.z = -tmpQuaternion.z;\r\n _this._virtualDragMesh.rotationQuaternion.multiplyToRef(tmpQuaternion, tmpQuaternion);\r\n // Convert change in rotation to only y axis rotation\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(tmpQuaternion.toEulerAngles(\"xyz\").y, 0, 0, tmpQuaternion);\r\n tmpQuaternion.multiplyToRef(_this._startingOrientation, tmpQuaternion);\r\n // Slowly move mesh to avoid jitter\r\n var oldParent = pickedMesh.parent;\r\n // Only rotate the mesh if it's parent has uniform scaling\r\n if (!oldParent || (oldParent.scaling && !oldParent.scaling.isNonUniformWithinEpsilon(0.001))) {\r\n pickedMesh.setParent(null);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].SlerpToRef(pickedMesh.rotationQuaternion, tmpQuaternion, _this.dragDeltaRatio, pickedMesh.rotationQuaternion);\r\n pickedMesh.setParent(oldParent);\r\n }\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(pickedMesh);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n SixDofDragBehavior.prototype.detach = function () {\r\n if (this._scene) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._ownerNode) {\r\n this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver);\r\n }\r\n if (this._virtualOriginMesh) {\r\n this._virtualOriginMesh.dispose();\r\n }\r\n if (this._virtualDragMesh) {\r\n this._virtualDragMesh.dispose();\r\n }\r\n this.onDragEndObservable.clear();\r\n this.onDragStartObservable.clear();\r\n };\r\n return SixDofDragBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/index.ts\":\n/*!****************************!*\\\n !*** ./Behaviors/index.ts ***!\n \\****************************/\n/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Cameras_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Cameras/index */ \"./Behaviors/Cameras/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_0__[\"AutoRotationBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_0__[\"BouncingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_0__[\"FramingBehavior\"]; });\n\n/* harmony import */ var _Meshes_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Meshes/index */ \"./Behaviors/Meshes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"AttachToBoxBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"FadeInOutBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"PointerDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"SixDofDragBehavior\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/bone.ts\":\n/*!***********************!*\\\n !*** ./Bones/bone.ts ***!\n \\***********************/\n/*! exports provided: Bone */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return Bone; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store bone information\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Bone = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Bone, _super);\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix\r\n * @param restPose defines the rest pose matrix\r\n * @param baseMatrix defines the base matrix\r\n * @param index defines index of the bone in the hiearchy\r\n */\r\n function Bone(\r\n /**\r\n * defines the bone name\r\n */\r\n name, skeleton, parentBone, localMatrix, restPose, baseMatrix, index) {\r\n if (parentBone === void 0) { parentBone = null; }\r\n if (localMatrix === void 0) { localMatrix = null; }\r\n if (restPose === void 0) { restPose = null; }\r\n if (baseMatrix === void 0) { baseMatrix = null; }\r\n if (index === void 0) { index = null; }\r\n var _this = _super.call(this, name, skeleton.getScene(), false) || this;\r\n _this.name = name;\r\n /**\r\n * Gets the list of child bones\r\n */\r\n _this.children = new Array();\r\n /** Gets the animations associated with this bone */\r\n _this.animations = new Array();\r\n /**\r\n * @hidden Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n _this._index = null;\r\n _this._absoluteTransform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n _this._invertedAbsoluteTransform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n _this._scalingDeterminant = 1;\r\n _this._worldTransform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n _this._needToDecompose = true;\r\n _this._needToCompose = false;\r\n /** @hidden */\r\n _this._linkedTransformNode = null;\r\n /** @hidden */\r\n _this._waitingTransformNodeId = null;\r\n _this._skeleton = skeleton;\r\n _this._localMatrix = localMatrix ? localMatrix.clone() : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _this._restPose = restPose ? restPose : _this._localMatrix.clone();\r\n _this._baseMatrix = baseMatrix ? baseMatrix : _this._localMatrix.clone();\r\n _this._index = index;\r\n skeleton.bones.push(_this);\r\n _this.setParent(parentBone, false);\r\n if (baseMatrix || localMatrix) {\r\n _this._updateDifferenceMatrix();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Bone.prototype, \"_matrix\", {\r\n /** @hidden */\r\n get: function () {\r\n this._compose();\r\n return this._localMatrix;\r\n },\r\n /** @hidden */\r\n set: function (value) {\r\n this._localMatrix.copyFrom(value);\r\n this._needToDecompose = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Bone.prototype.getClassName = function () {\r\n return \"Bone\";\r\n };\r\n // Members\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n Bone.prototype.getSkeleton = function () {\r\n return this._skeleton;\r\n };\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n Bone.prototype.getParent = function () {\r\n return this._parent;\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Bone.prototype.getChildren = function () {\r\n return this.children;\r\n };\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n */\r\n Bone.prototype.setParent = function (parent, updateDifferenceMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (this._parent === parent) {\r\n return;\r\n }\r\n if (this._parent) {\r\n var index = this._parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this._parent.children.splice(index, 1);\r\n }\r\n }\r\n this._parent = parent;\r\n if (this._parent) {\r\n this._parent.children.push(this);\r\n }\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n this.markAsDirty();\r\n };\r\n /**\r\n * Gets the local matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getLocalMatrix = function () {\r\n this._compose();\r\n return this._localMatrix;\r\n };\r\n /**\r\n * Gets the base matrix (initial matrix which remains unchanged)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getBaseMatrix = function () {\r\n return this._baseMatrix;\r\n };\r\n /**\r\n * Gets the rest pose matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getRestPose = function () {\r\n return this._restPose;\r\n };\r\n /**\r\n * Gets a matrix used to store world matrix (ie. the matrix sent to shaders)\r\n */\r\n Bone.prototype.getWorldMatrix = function () {\r\n return this._worldTransform;\r\n };\r\n /**\r\n * Sets the local matrix to rest pose matrix\r\n */\r\n Bone.prototype.returnToRest = function () {\r\n this.updateMatrix(this._restPose.clone());\r\n };\r\n /**\r\n * Gets the inverse of the absolute transform matrix.\r\n * This matrix will be multiplied by local matrix to get the difference matrix (ie. the difference between original state and current state)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getInvertedAbsoluteTransform = function () {\r\n return this._invertedAbsoluteTransform;\r\n };\r\n /**\r\n * Gets the absolute transform matrix (ie base matrix * parent world matrix)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getAbsoluteTransform = function () {\r\n return this._absoluteTransform;\r\n };\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is copied from the transform node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n Bone.prototype.linkTransformNode = function (transformNode) {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n this._linkedTransformNode = transformNode;\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n };\r\n // Properties (matches AbstractMesh properties)\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n Bone.prototype.getTransformNode = function () {\r\n return this._linkedTransformNode;\r\n };\r\n Object.defineProperty(Bone.prototype, \"position\", {\r\n /** Gets or sets current position (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localPosition;\r\n },\r\n set: function (newPosition) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n this._markAsDirtyAndCompose();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotation\", {\r\n /** Gets or sets current rotation (in local space) */\r\n get: function () {\r\n return this.getRotation();\r\n },\r\n set: function (newRotation) {\r\n this.setRotation(newRotation);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotationQuaternion\", {\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localRotation;\r\n },\r\n set: function (newRotation) {\r\n this.setRotationQuaternion(newRotation);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"scaling\", {\r\n /** Gets or sets current scaling (in local space) */\r\n get: function () {\r\n return this.getScale();\r\n },\r\n set: function (newScaling) {\r\n this.setScale(newScaling);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets the animation properties override\r\n */\r\n get: function () {\r\n return this._skeleton.animationPropertiesOverride;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n Bone.prototype._decompose = function () {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n this._needToDecompose = false;\r\n if (!this._localScaling) {\r\n this._localScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._localRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Zero();\r\n this._localPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n };\r\n Bone.prototype._compose = function () {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n this._needToCompose = false;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n };\r\n /**\r\n * Update the base and local matrices\r\n * @param matrix defines the new base or local matrix\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n * @param updateLocalMatrix defines if the local matrix should be updated\r\n */\r\n Bone.prototype.updateMatrix = function (matrix, updateDifferenceMatrix, updateLocalMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (updateLocalMatrix === void 0) { updateLocalMatrix = true; }\r\n this._baseMatrix.copyFrom(matrix);\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n if (updateLocalMatrix) {\r\n this._localMatrix.copyFrom(matrix);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n else {\r\n this.markAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Bone.prototype._updateDifferenceMatrix = function (rootMatrix, updateChildren) {\r\n if (updateChildren === void 0) { updateChildren = true; }\r\n if (!rootMatrix) {\r\n rootMatrix = this._baseMatrix;\r\n }\r\n if (this._parent) {\r\n rootMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(rootMatrix);\r\n }\r\n this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);\r\n if (updateChildren) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateDifferenceMatrix();\r\n }\r\n }\r\n this._scalingDeterminant = (this._absoluteTransform.determinant() < 0 ? -1 : 1);\r\n };\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n */\r\n Bone.prototype.markAsDirty = function () {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n };\r\n /** @hidden */\r\n Bone.prototype._markAsDirtyAndCompose = function () {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n };\r\n Bone.prototype._markAsDirtyAndDecompose = function () {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n };\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.translate = function (vec, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var tvec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n }\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n tmat.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(vec, tmat, tvec);\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the postion of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setPosition = function (position, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n lm.setTranslationFromFloats(position.x, position.y, position.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var vec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n }\r\n tmat.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(position, tmat, vec);\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param mesh The mesh that this bone is attached to\r\n */\r\n Bone.prototype.setAbsolutePosition = function (position, mesh) {\r\n this.setPosition(position, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD, mesh);\r\n };\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n Bone.prototype.scale = function (x, y, z, scaleChildren) {\r\n if (scaleChildren === void 0) { scaleChildren = false; }\r\n var locMat = this.getLocalMatrix();\r\n // Apply new scaling on top of current local matrix\r\n var scaleMat = Bone._tmpMats[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n var cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n child._markAsDirtyAndDecompose();\r\n }\r\n this._markAsDirtyAndDecompose();\r\n if (scaleChildren) {\r\n for (var _b = 0, _c = this.children; _b < _c.length; _b++) {\r\n var child = _c[_b];\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n };\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n Bone.prototype.setScale = function (scale) {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n };\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n Bone.prototype.getScale = function () {\r\n this._decompose();\r\n return this._localScaling;\r\n };\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n Bone.prototype.getScaleToRef = function (result) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n };\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setYawPitchRoll = function (yaw, pitch, roll, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.rotate = function (axis, amount, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var rmat = Bone._tmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setAxisAngle = function (axis, angle, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].RotationAxisToRef(axis, angle, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationAxisToRef(axis, angle, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the euler rotation of the bone in local of world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotation = function (rotation, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);\r\n };\r\n /**\r\n * Set the quaternion rotation of the bone in local of world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n this._markAsDirtyAndCompose();\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromQuaternionToRef(quat, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation matrix of the bone in local of world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationMatrix = function (rotMat, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat2 = Bone._tmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n this._rotateWithMatrix(rotMat2, space, mesh);\r\n };\r\n Bone.prototype._rotateWithMatrix = function (rmat, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var lmat = this.getLocalMatrix();\r\n var lx = lmat.m[12];\r\n var ly = lmat.m[13];\r\n var lz = lmat.m[14];\r\n var parent = this.getParent();\r\n var parentScale = Bone._tmpMats[3];\r\n var parentScaleInv = Bone._tmpMats[4];\r\n if (parent && space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD) {\r\n if (mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parent.getAbsoluteTransform().multiplyToRef(parentScale, parentScale);\r\n }\r\n else {\r\n parentScale.copyFrom(parent.getAbsoluteTransform());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD && mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n this.computeAbsoluteTransforms();\r\n this._markAsDirtyAndDecompose();\r\n };\r\n Bone.prototype._getNegativeRotationToRef = function (rotMatInv, mesh) {\r\n var scaleMatrix = Bone._tmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteTransform());\r\n if (mesh) {\r\n rotMatInv.multiplyToRef(mesh.getWorldMatrix(), rotMatInv);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ScalingToRef(mesh.scaling.x, mesh.scaling.y, mesh.scaling.z, scaleMatrix);\r\n }\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n return true;\r\n };\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The position of the bone\r\n */\r\n Bone.prototype.getPosition = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getPositionToRef(space, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 to copy the position to\r\n */\r\n Bone.prototype.getPositionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var lm = this.getLocalMatrix();\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n };\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The absolute position of the bone\r\n */\r\n Bone.prototype.getAbsolutePosition = function (mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getPositionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n Bone.prototype.getAbsolutePositionToRef = function (mesh, result) {\r\n this.getPositionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD, mesh, result);\r\n };\r\n /**\r\n * Compute the absolute transforms of this bone and its children\r\n */\r\n Bone.prototype.computeAbsoluteTransforms = function () {\r\n this._compose();\r\n if (this._parent) {\r\n this._localMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(this._localMatrix);\r\n var poseMatrix = this._skeleton.getPoseMatrix();\r\n if (poseMatrix) {\r\n this._absoluteTransform.multiplyToRef(poseMatrix, this._absoluteTransform);\r\n }\r\n }\r\n var children = this.children;\r\n var len = children.length;\r\n for (var i = 0; i < len; i++) {\r\n children[i].computeAbsoluteTransforms();\r\n }\r\n };\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world direction\r\n */\r\n Bone.prototype.getDirection = function (localAxis, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getDirectionToRef(localAxis, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n Bone.prototype.getDirectionToRef = function (localAxis, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var mat = Bone._tmpMats[0];\r\n mat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalToRef(localAxis, mat, result);\r\n result.normalize();\r\n };\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The euler rotation\r\n */\r\n Bone.prototype.getRotation = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getRotationToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var quat = Bone._tmpQuat;\r\n this.getRotationQuaternionToRef(space, mesh, quat);\r\n quat.toEulerAnglesToRef(result);\r\n };\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The quaternion rotation\r\n */\r\n Bone.prototype.getRotationQuaternion = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n this.getRotationQuaternionToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationQuaternionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n };\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The rotation matrix\r\n */\r\n Bone.prototype.getRotationMatrix = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n this.getRotationMatrixToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world position\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getAbsolutePositionFromLocalToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The local position\r\n */\r\n Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getLocalPositionFromAbsoluteToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n tmat.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n Bone._tmpVecs = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(2, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n Bone._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n Bone._tmpMats = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(5, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity);\r\n return Bone;\r\n}(_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/boneIKController.ts\":\n/*!***********************************!*\\\n !*** ./Bones/boneIKController.ts ***!\n \\***********************************/\n/*! exports provided: BoneIKController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return BoneIKController; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n/**\r\n * Class used to apply inverse kinematics to bones\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#boneikcontroller\r\n */\r\nvar BoneIKController = /** @class */ (function () {\r\n /**\r\n * Creates a new BoneIKController\r\n * @param mesh defines the mesh to control\r\n * @param bone defines the bone to control\r\n * @param options defines options to set up the controller\r\n */\r\n function BoneIKController(mesh, bone, options) {\r\n /**\r\n * Gets or sets the target position\r\n */\r\n this.targetPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Gets or sets the pole target position\r\n */\r\n this.poleTargetPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Gets or sets the pole target local offset\r\n */\r\n this.poleTargetLocalOffset = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Gets or sets the pole angle\r\n */\r\n this.poleAngle = 0;\r\n /**\r\n * The amount to slerp (spherical linear interpolation) to the target. Set this to a value between 0 and 1 (a value of 1 disables slerp)\r\n */\r\n this.slerpAmount = 1;\r\n this._bone1Quat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Identity();\r\n this._bone1Mat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity();\r\n this._bone2Ang = Math.PI;\r\n this._maxAngle = Math.PI;\r\n this._rightHandedSystem = false;\r\n this._bendAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Right();\r\n this._slerping = false;\r\n this._adjustRoll = 0;\r\n this._bone2 = bone;\r\n this._bone1 = bone.getParent();\r\n if (!this._bone1) {\r\n return;\r\n }\r\n this.mesh = mesh;\r\n var bonePos = bone.getPosition();\r\n if (bone.getAbsoluteTransform().determinant() > 0) {\r\n this._rightHandedSystem = true;\r\n this._bendAxis.x = 0;\r\n this._bendAxis.y = 0;\r\n this._bendAxis.z = -1;\r\n if (bonePos.x > bonePos.y && bonePos.x > bonePos.z) {\r\n this._adjustRoll = Math.PI * .5;\r\n this._bendAxis.z = 1;\r\n }\r\n }\r\n if (this._bone1.length) {\r\n var boneScale1 = this._bone1.getScale();\r\n var boneScale2 = this._bone2.getScale();\r\n this._bone1Length = this._bone1.length * boneScale1.y * this.mesh.scaling.y;\r\n this._bone2Length = this._bone2.length * boneScale2.y * this.mesh.scaling.y;\r\n }\r\n else if (this._bone1.children[0]) {\r\n mesh.computeWorldMatrix(true);\r\n var pos1 = this._bone2.children[0].getAbsolutePosition(mesh);\r\n var pos2 = this._bone2.getAbsolutePosition(mesh);\r\n var pos3 = this._bone1.getAbsolutePosition(mesh);\r\n this._bone1Length = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(pos1, pos2);\r\n this._bone2Length = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(pos2, pos3);\r\n }\r\n this._bone1.getRotationMatrixToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].WORLD, mesh, this._bone1Mat);\r\n this.maxAngle = Math.PI;\r\n if (options) {\r\n if (options.targetMesh) {\r\n this.targetMesh = options.targetMesh;\r\n this.targetMesh.computeWorldMatrix(true);\r\n }\r\n if (options.poleTargetMesh) {\r\n this.poleTargetMesh = options.poleTargetMesh;\r\n this.poleTargetMesh.computeWorldMatrix(true);\r\n }\r\n else if (options.poleTargetBone) {\r\n this.poleTargetBone = options.poleTargetBone;\r\n }\r\n else if (this._bone1.getParent()) {\r\n this.poleTargetBone = this._bone1.getParent();\r\n }\r\n if (options.poleTargetLocalOffset) {\r\n this.poleTargetLocalOffset.copyFrom(options.poleTargetLocalOffset);\r\n }\r\n if (options.poleAngle) {\r\n this.poleAngle = options.poleAngle;\r\n }\r\n if (options.bendAxis) {\r\n this._bendAxis.copyFrom(options.bendAxis);\r\n }\r\n if (options.maxAngle) {\r\n this.maxAngle = options.maxAngle;\r\n }\r\n if (options.slerpAmount) {\r\n this.slerpAmount = options.slerpAmount;\r\n }\r\n }\r\n }\r\n Object.defineProperty(BoneIKController.prototype, \"maxAngle\", {\r\n /**\r\n * Gets or sets maximum allowed angle\r\n */\r\n get: function () {\r\n return this._maxAngle;\r\n },\r\n set: function (value) {\r\n this._setMaxAngle(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n BoneIKController.prototype._setMaxAngle = function (ang) {\r\n if (ang < 0) {\r\n ang = 0;\r\n }\r\n if (ang > Math.PI || ang == undefined) {\r\n ang = Math.PI;\r\n }\r\n this._maxAngle = ang;\r\n var a = this._bone1Length;\r\n var b = this._bone2Length;\r\n this._maxReach = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(ang));\r\n };\r\n /**\r\n * Force the controller to update the bones\r\n */\r\n BoneIKController.prototype.update = function () {\r\n var bone1 = this._bone1;\r\n if (!bone1) {\r\n return;\r\n }\r\n var target = this.targetPosition;\r\n var poleTarget = this.poleTargetPosition;\r\n var mat1 = BoneIKController._tmpMats[0];\r\n var mat2 = BoneIKController._tmpMats[1];\r\n if (this.targetMesh) {\r\n target.copyFrom(this.targetMesh.getAbsolutePosition());\r\n }\r\n if (this.poleTargetBone) {\r\n this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset, this.mesh, poleTarget);\r\n }\r\n else if (this.poleTargetMesh) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(this.poleTargetLocalOffset, this.poleTargetMesh.getWorldMatrix(), poleTarget);\r\n }\r\n var bonePos = BoneIKController._tmpVecs[0];\r\n var zaxis = BoneIKController._tmpVecs[1];\r\n var xaxis = BoneIKController._tmpVecs[2];\r\n var yaxis = BoneIKController._tmpVecs[3];\r\n var upAxis = BoneIKController._tmpVecs[4];\r\n var _tmpQuat = BoneIKController._tmpQuat;\r\n bone1.getAbsolutePositionToRef(this.mesh, bonePos);\r\n poleTarget.subtractToRef(bonePos, upAxis);\r\n if (upAxis.x == 0 && upAxis.y == 0 && upAxis.z == 0) {\r\n upAxis.y = 1;\r\n }\r\n else {\r\n upAxis.normalize();\r\n }\r\n target.subtractToRef(bonePos, yaxis);\r\n yaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(yaxis, upAxis, zaxis);\r\n zaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(yaxis, zaxis, xaxis);\r\n xaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].FromXYZAxesToRef(xaxis, yaxis, zaxis, mat1);\r\n var a = this._bone1Length;\r\n var b = this._bone2Length;\r\n var c = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(bonePos, target);\r\n if (this._maxReach > 0) {\r\n c = Math.min(this._maxReach, c);\r\n }\r\n var acosa = (b * b + c * c - a * a) / (2 * b * c);\r\n var acosb = (c * c + a * a - b * b) / (2 * c * a);\r\n if (acosa > 1) {\r\n acosa = 1;\r\n }\r\n if (acosb > 1) {\r\n acosb = 1;\r\n }\r\n if (acosa < -1) {\r\n acosa = -1;\r\n }\r\n if (acosb < -1) {\r\n acosb = -1;\r\n }\r\n var angA = Math.acos(acosa);\r\n var angB = Math.acos(acosb);\r\n var angC = -angA - angB;\r\n if (this._rightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationYawPitchRollToRef(0, 0, this._adjustRoll, mat2);\r\n mat2.multiplyToRef(mat1, mat1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(this._bendAxis, angB, mat2);\r\n mat2.multiplyToRef(mat1, mat1);\r\n }\r\n else {\r\n var _tmpVec = BoneIKController._tmpVecs[5];\r\n _tmpVec.copyFrom(this._bendAxis);\r\n _tmpVec.x *= -1;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(_tmpVec, -angB, mat2);\r\n mat2.multiplyToRef(mat1, mat1);\r\n }\r\n if (this.poleAngle) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(yaxis, this.poleAngle, mat2);\r\n mat1.multiplyToRef(mat2, mat1);\r\n }\r\n if (this._bone1) {\r\n if (this.slerpAmount < 1) {\r\n if (!this._slerping) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromRotationMatrixToRef(this._bone1Mat, this._bone1Quat);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromRotationMatrixToRef(mat1, _tmpQuat);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].SlerpToRef(this._bone1Quat, _tmpQuat, this.slerpAmount, this._bone1Quat);\r\n angC = this._bone2Ang * (1.0 - this.slerpAmount) + angC * this.slerpAmount;\r\n this._bone1.setRotationQuaternion(this._bone1Quat, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].WORLD, this.mesh);\r\n this._slerping = true;\r\n }\r\n else {\r\n this._bone1.setRotationMatrix(mat1, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].WORLD, this.mesh);\r\n this._bone1Mat.copyFrom(mat1);\r\n this._slerping = false;\r\n }\r\n }\r\n this._bone2.setAxisAngle(this._bendAxis, angC, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].LOCAL);\r\n this._bone2Ang = angC;\r\n };\r\n BoneIKController._tmpVecs = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero()];\r\n BoneIKController._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Identity();\r\n BoneIKController._tmpMats = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity()];\r\n return BoneIKController;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/boneLookController.ts\":\n/*!*************************************!*\\\n !*** ./Bones/boneLookController.ts ***!\n \\*************************************/\n/*! exports provided: BoneLookController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return BoneLookController; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to make a bone look toward a point in space\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#bonelookcontroller\r\n */\r\nvar BoneLookController = /** @class */ (function () {\r\n /**\r\n * Create a BoneLookController\r\n * @param mesh the mesh that the bone belongs to\r\n * @param bone the bone that will be looking to the target\r\n * @param target the target Vector3 to look at\r\n * @param options optional settings:\r\n * * maxYaw: the maximum angle the bone will yaw to\r\n * * minYaw: the minimum angle the bone will yaw to\r\n * * maxPitch: the maximum angle the bone will pitch to\r\n * * minPitch: the minimum angle the bone will yaw to\r\n * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.\r\n * * upAxis: the up axis of the coordinate system\r\n * * upAxisSpace: the space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD.\r\n * * yawAxis: set yawAxis if the bone does not yaw on the y axis\r\n * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis\r\n * * adjustYaw: used to make an adjustment to the yaw of the bone\r\n * * adjustPitch: used to make an adjustment to the pitch of the bone\r\n * * adjustRoll: used to make an adjustment to the roll of the bone\r\n **/\r\n function BoneLookController(mesh, bone, target, options) {\r\n /**\r\n * The up axis of the coordinate system that is used when the bone is rotated\r\n */\r\n this.upAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Up();\r\n /**\r\n * The space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD\r\n */\r\n this.upAxisSpace = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL;\r\n /**\r\n * Used to make an adjustment to the yaw of the bone\r\n */\r\n this.adjustYaw = 0;\r\n /**\r\n * Used to make an adjustment to the pitch of the bone\r\n */\r\n this.adjustPitch = 0;\r\n /**\r\n * Used to make an adjustment to the roll of the bone\r\n */\r\n this.adjustRoll = 0;\r\n /**\r\n * The amount to slerp (spherical linear interpolation) to the target. Set this to a value between 0 and 1 (a value of 1 disables slerp)\r\n */\r\n this.slerpAmount = 1;\r\n this._boneQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n this._slerping = false;\r\n this._firstFrameSkipped = false;\r\n this._fowardAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Forward();\r\n this.mesh = mesh;\r\n this.bone = bone;\r\n this.target = target;\r\n if (options) {\r\n if (options.adjustYaw) {\r\n this.adjustYaw = options.adjustYaw;\r\n }\r\n if (options.adjustPitch) {\r\n this.adjustPitch = options.adjustPitch;\r\n }\r\n if (options.adjustRoll) {\r\n this.adjustRoll = options.adjustRoll;\r\n }\r\n if (options.maxYaw != null) {\r\n this.maxYaw = options.maxYaw;\r\n }\r\n else {\r\n this.maxYaw = Math.PI;\r\n }\r\n if (options.minYaw != null) {\r\n this.minYaw = options.minYaw;\r\n }\r\n else {\r\n this.minYaw = -Math.PI;\r\n }\r\n if (options.maxPitch != null) {\r\n this.maxPitch = options.maxPitch;\r\n }\r\n else {\r\n this.maxPitch = Math.PI;\r\n }\r\n if (options.minPitch != null) {\r\n this.minPitch = options.minPitch;\r\n }\r\n else {\r\n this.minPitch = -Math.PI;\r\n }\r\n if (options.slerpAmount != null) {\r\n this.slerpAmount = options.slerpAmount;\r\n }\r\n if (options.upAxis != null) {\r\n this.upAxis = options.upAxis;\r\n }\r\n if (options.upAxisSpace != null) {\r\n this.upAxisSpace = options.upAxisSpace;\r\n }\r\n if (options.yawAxis != null || options.pitchAxis != null) {\r\n var newYawAxis = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Axis\"].Y;\r\n var newPitchAxis = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Axis\"].X;\r\n if (options.yawAxis != null) {\r\n newYawAxis = options.yawAxis.clone();\r\n newYawAxis.normalize();\r\n }\r\n if (options.pitchAxis != null) {\r\n newPitchAxis = options.pitchAxis.clone();\r\n newPitchAxis.normalize();\r\n }\r\n var newRollAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(newPitchAxis, newYawAxis);\r\n this._transformYawPitch = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromXYZAxesToRef(newPitchAxis, newYawAxis, newRollAxis, this._transformYawPitch);\r\n this._transformYawPitchInv = this._transformYawPitch.clone();\r\n this._transformYawPitch.invert();\r\n }\r\n }\r\n if (!bone.getParent() && this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].BONE) {\r\n this.upAxisSpace = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL;\r\n }\r\n }\r\n Object.defineProperty(BoneLookController.prototype, \"minYaw\", {\r\n /**\r\n * Gets or sets the minimum yaw angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._minYaw;\r\n },\r\n set: function (value) {\r\n this._minYaw = value;\r\n this._minYawSin = Math.sin(value);\r\n this._minYawCos = Math.cos(value);\r\n if (this._maxYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * .5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoneLookController.prototype, \"maxYaw\", {\r\n /**\r\n * Gets or sets the maximum yaw angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._maxYaw;\r\n },\r\n set: function (value) {\r\n this._maxYaw = value;\r\n this._maxYawSin = Math.sin(value);\r\n this._maxYawCos = Math.cos(value);\r\n if (this._minYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * .5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoneLookController.prototype, \"minPitch\", {\r\n /**\r\n * Gets or sets the minimum pitch angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._minPitch;\r\n },\r\n set: function (value) {\r\n this._minPitch = value;\r\n this._minPitchTan = Math.tan(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoneLookController.prototype, \"maxPitch\", {\r\n /**\r\n * Gets or sets the maximum pitch angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._maxPitch;\r\n },\r\n set: function (value) {\r\n this._maxPitch = value;\r\n this._maxPitchTan = Math.tan(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Update the bone to look at the target. This should be called before the scene is rendered (use scene.registerBeforeRender())\r\n */\r\n BoneLookController.prototype.update = function () {\r\n //skip the first frame when slerping so that the mesh rotation is correct\r\n if (this.slerpAmount < 1 && !this._firstFrameSkipped) {\r\n this._firstFrameSkipped = true;\r\n return;\r\n }\r\n var bone = this.bone;\r\n var bonePos = BoneLookController._tmpVecs[0];\r\n bone.getAbsolutePositionToRef(this.mesh, bonePos);\r\n var target = this.target;\r\n var _tmpMat1 = BoneLookController._tmpMats[0];\r\n var _tmpMat2 = BoneLookController._tmpMats[1];\r\n var mesh = this.mesh;\r\n var parentBone = bone.getParent();\r\n var upAxis = BoneLookController._tmpVecs[1];\r\n upAxis.copyFrom(this.upAxis);\r\n if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].BONE && parentBone) {\r\n if (this._transformYawPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(upAxis, this._transformYawPitchInv, upAxis);\r\n }\r\n parentBone.getDirectionToRef(upAxis, this.mesh, upAxis);\r\n }\r\n else if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL) {\r\n mesh.getDirectionToRef(upAxis, upAxis);\r\n if (mesh.scaling.x != 1 || mesh.scaling.y != 1 || mesh.scaling.z != 1) {\r\n upAxis.normalize();\r\n }\r\n }\r\n var checkYaw = false;\r\n var checkPitch = false;\r\n if (this._maxYaw != Math.PI || this._minYaw != -Math.PI) {\r\n checkYaw = true;\r\n }\r\n if (this._maxPitch != Math.PI || this._minPitch != -Math.PI) {\r\n checkPitch = true;\r\n }\r\n if (checkYaw || checkPitch) {\r\n var spaceMat = BoneLookController._tmpMats[2];\r\n var spaceMatInv = BoneLookController._tmpMats[3];\r\n if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].BONE && upAxis.y == 1 && parentBone) {\r\n parentBone.getRotationMatrixToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh, spaceMat);\r\n }\r\n else if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL && upAxis.y == 1 && !parentBone) {\r\n spaceMat.copyFrom(mesh.getWorldMatrix());\r\n }\r\n else {\r\n var forwardAxis = BoneLookController._tmpVecs[2];\r\n forwardAxis.copyFrom(this._fowardAxis);\r\n if (this._transformYawPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(forwardAxis, this._transformYawPitchInv, forwardAxis);\r\n }\r\n if (parentBone) {\r\n parentBone.getDirectionToRef(forwardAxis, this.mesh, forwardAxis);\r\n }\r\n else {\r\n mesh.getDirectionToRef(forwardAxis, forwardAxis);\r\n }\r\n var rightAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(upAxis, forwardAxis);\r\n rightAxis.normalize();\r\n var forwardAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(rightAxis, upAxis);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromXYZAxesToRef(rightAxis, upAxis, forwardAxis, spaceMat);\r\n }\r\n spaceMat.invertToRef(spaceMatInv);\r\n var xzlen = null;\r\n if (checkPitch) {\r\n var localTarget = BoneLookController._tmpVecs[3];\r\n target.subtractToRef(bonePos, localTarget);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n var pitch = Math.atan2(localTarget.y, xzlen);\r\n var newPitch = pitch;\r\n if (pitch > this._maxPitch) {\r\n localTarget.y = this._maxPitchTan * xzlen;\r\n newPitch = this._maxPitch;\r\n }\r\n else if (pitch < this._minPitch) {\r\n localTarget.y = this._minPitchTan * xzlen;\r\n newPitch = this._minPitch;\r\n }\r\n if (pitch != newPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n if (checkYaw) {\r\n var localTarget = BoneLookController._tmpVecs[4];\r\n target.subtractToRef(bonePos, localTarget);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n var yaw = Math.atan2(localTarget.x, localTarget.z);\r\n var newYaw = yaw;\r\n if (yaw > this._maxYaw || yaw < this._minYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n if (this._yawRange > Math.PI) {\r\n if (this._isAngleBetween(yaw, this._maxYaw, this._midYawConstraint)) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n newYaw = this._maxYaw;\r\n }\r\n else if (this._isAngleBetween(yaw, this._midYawConstraint, this._minYaw)) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n newYaw = this._minYaw;\r\n }\r\n }\r\n else {\r\n if (yaw > this._maxYaw) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n newYaw = this._maxYaw;\r\n }\r\n else if (yaw < this._minYaw) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n newYaw = this._minYaw;\r\n }\r\n }\r\n }\r\n if (this._slerping && this._yawRange > Math.PI) {\r\n //are we going to be crossing into the min/max region?\r\n var boneFwd = BoneLookController._tmpVecs[8];\r\n boneFwd.copyFrom(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Axis\"].Z);\r\n if (this._transformYawPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(boneFwd, this._transformYawPitchInv, boneFwd);\r\n }\r\n var boneRotMat = BoneLookController._tmpMats[4];\r\n this._boneQuat.toRotationMatrix(boneRotMat);\r\n this.mesh.getWorldMatrix().multiplyToRef(boneRotMat, boneRotMat);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(boneFwd, boneRotMat, boneFwd);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(boneFwd, spaceMatInv, boneFwd);\r\n var boneYaw = Math.atan2(boneFwd.x, boneFwd.z);\r\n var angBtwTar = this._getAngleBetween(boneYaw, yaw);\r\n var angBtwMidYaw = this._getAngleBetween(boneYaw, this._midYawConstraint);\r\n if (angBtwTar > angBtwMidYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n var angBtwMax = this._getAngleBetween(boneYaw, this._maxYaw);\r\n var angBtwMin = this._getAngleBetween(boneYaw, this._minYaw);\r\n if (angBtwMin < angBtwMax) {\r\n newYaw = boneYaw + Math.PI * .75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n }\r\n else {\r\n newYaw = boneYaw - Math.PI * .75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n }\r\n }\r\n }\r\n if (yaw != newYaw) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n }\r\n var zaxis = BoneLookController._tmpVecs[5];\r\n var xaxis = BoneLookController._tmpVecs[6];\r\n var yaxis = BoneLookController._tmpVecs[7];\r\n var _tmpQuat = BoneLookController._tmpQuat;\r\n target.subtractToRef(bonePos, zaxis);\r\n zaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(upAxis, zaxis, xaxis);\r\n xaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(zaxis, xaxis, yaxis);\r\n yaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromXYZAxesToRef(xaxis, yaxis, zaxis, _tmpMat1);\r\n if (xaxis.x === 0 && xaxis.y === 0 && xaxis.z === 0) {\r\n return;\r\n }\r\n if (yaxis.x === 0 && yaxis.y === 0 && yaxis.z === 0) {\r\n return;\r\n }\r\n if (zaxis.x === 0 && zaxis.y === 0 && zaxis.z === 0) {\r\n return;\r\n }\r\n if (this.adjustYaw || this.adjustPitch || this.adjustRoll) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, _tmpMat2);\r\n _tmpMat2.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n if (this.slerpAmount < 1) {\r\n if (!this._slerping) {\r\n this.bone.getRotationQuaternionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh, this._boneQuat);\r\n }\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromRotationMatrixToRef(_tmpMat1, _tmpQuat);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].SlerpToRef(this._boneQuat, _tmpQuat, this.slerpAmount, this._boneQuat);\r\n this.bone.setRotationQuaternion(this._boneQuat, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh);\r\n this._slerping = true;\r\n }\r\n else {\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n this.bone.setRotationMatrix(_tmpMat1, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh);\r\n this._slerping = false;\r\n }\r\n };\r\n BoneLookController.prototype._getAngleDiff = function (ang1, ang2) {\r\n var angDiff = ang2 - ang1;\r\n angDiff %= Math.PI * 2;\r\n if (angDiff > Math.PI) {\r\n angDiff -= Math.PI * 2;\r\n }\r\n else if (angDiff < -Math.PI) {\r\n angDiff += Math.PI * 2;\r\n }\r\n return angDiff;\r\n };\r\n BoneLookController.prototype._getAngleBetween = function (ang1, ang2) {\r\n ang1 %= (2 * Math.PI);\r\n ang1 = (ang1 < 0) ? ang1 + (2 * Math.PI) : ang1;\r\n ang2 %= (2 * Math.PI);\r\n ang2 = (ang2 < 0) ? ang2 + (2 * Math.PI) : ang2;\r\n var ab = 0;\r\n if (ang1 < ang2) {\r\n ab = ang2 - ang1;\r\n }\r\n else {\r\n ab = ang1 - ang2;\r\n }\r\n if (ab > Math.PI) {\r\n ab = Math.PI * 2 - ab;\r\n }\r\n return ab;\r\n };\r\n BoneLookController.prototype._isAngleBetween = function (ang, ang1, ang2) {\r\n ang %= (2 * Math.PI);\r\n ang = (ang < 0) ? ang + (2 * Math.PI) : ang;\r\n ang1 %= (2 * Math.PI);\r\n ang1 = (ang1 < 0) ? ang1 + (2 * Math.PI) : ang1;\r\n ang2 %= (2 * Math.PI);\r\n ang2 = (ang2 < 0) ? ang2 + (2 * Math.PI) : ang2;\r\n if (ang1 < ang2) {\r\n if (ang > ang1 && ang < ang2) {\r\n return true;\r\n }\r\n }\r\n else {\r\n if (ang > ang2 && ang < ang1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n BoneLookController._tmpVecs = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(10, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n BoneLookController._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n BoneLookController._tmpMats = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(5, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity);\r\n return BoneLookController;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/index.ts\":\n/*!************************!*\\\n !*** ./Bones/index.ts ***!\n \\************************/\n/*! exports provided: Bone, BoneIKController, BoneLookController, Skeleton */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bone */ \"./Bones/bone.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return _bone__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"]; });\n\n/* harmony import */ var _boneIKController__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boneIKController */ \"./Bones/boneIKController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return _boneIKController__WEBPACK_IMPORTED_MODULE_1__[\"BoneIKController\"]; });\n\n/* harmony import */ var _boneLookController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boneLookController */ \"./Bones/boneLookController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return _boneLookController__WEBPACK_IMPORTED_MODULE_2__[\"BoneLookController\"]; });\n\n/* harmony import */ var _skeleton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./skeleton */ \"./Bones/skeleton.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return _skeleton__WEBPACK_IMPORTED_MODULE_3__[\"Skeleton\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/skeleton.ts\":\n/*!***************************!*\\\n !*** ./Bones/skeleton.ts ***!\n \\***************************/\n/*! exports provided: Skeleton */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return Skeleton; });\n/* harmony import */ var _bone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bone */ \"./Bones/bone.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Animations/animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Animations_animationRange__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Animations/animationRange */ \"./Animations/animationRange.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to handle skinning animations\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Skeleton = /** @class */ (function () {\r\n /**\r\n * Creates a new skeleton\r\n * @param name defines the skeleton name\r\n * @param id defines the skeleton Id\r\n * @param scene defines the hosting scene\r\n */\r\n function Skeleton(\r\n /** defines the skeleton name */\r\n name, \r\n /** defines the skeleton Id */\r\n id, scene) {\r\n this.name = name;\r\n this.id = id;\r\n /**\r\n * Defines the list of child bones\r\n */\r\n this.bones = new Array();\r\n /**\r\n * Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)\r\n */\r\n this.needInitialSkinMatrix = false;\r\n /**\r\n * Defines a mesh that override the matrix used to get the world matrix (null by default).\r\n */\r\n this.overrideMesh = null;\r\n this._isDirty = true;\r\n this._meshesWithPoseMatrix = new Array();\r\n this._identity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n this._ranges = {};\r\n this._lastAbsoluteTransformsUpdateId = -1;\r\n this._canUseTextureForBones = false;\r\n this._uniqueId = 0;\r\n /** @hidden */\r\n this._numBonesWithLinkedTransformNode = 0;\r\n /** @hidden */\r\n this._hasWaitingData = null;\r\n /**\r\n * Specifies if the skeleton should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n this._useTextureToStoreBoneMatrices = true;\r\n this._animationPropertiesOverride = null;\r\n // Events\r\n /**\r\n * An observable triggered before computing the skeleton's matrices\r\n */\r\n this.onBeforeComputeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this.bones = [];\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n this._uniqueId = this._scene.getUniqueId();\r\n this._scene.addSkeleton(this);\r\n //make sure it will recalculate the matrix next time prepare is called.\r\n this._isDirty = true;\r\n var engineCaps = this._scene.getEngine().getCaps();\r\n this._canUseTextureForBones = engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0;\r\n }\r\n Object.defineProperty(Skeleton.prototype, \"useTextureToStoreBoneMatrices\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true).\r\n * Please note that this option is not available if the hardware does not support it\r\n */\r\n get: function () {\r\n return this._useTextureToStoreBoneMatrices;\r\n },\r\n set: function (value) {\r\n this._useTextureToStoreBoneMatrices = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"isUsingTextureForMatrices\", {\r\n /**\r\n * Gets a boolean indicating that the skeleton effectively stores matrices into a texture\r\n */\r\n get: function () {\r\n return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this skeleton\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Skeleton.prototype.getClassName = function () {\r\n return \"Skeleton\";\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Skeleton.prototype.getChildren = function () {\r\n return this.bones.filter(function (b) { return !b.getParent(); });\r\n };\r\n // Members\r\n /**\r\n * Gets the list of transform matrices to send to shaders (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a Float32Array containing matrices data\r\n */\r\n Skeleton.prototype.getTransformMatrices = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {\r\n return mesh._bonesTransformMatrices;\r\n }\r\n if (!this._transformMatrices) {\r\n this.prepare();\r\n }\r\n return this._transformMatrices;\r\n };\r\n /**\r\n * Gets the list of transform matrices to send to shaders inside a texture (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a raw texture containing the data\r\n */\r\n Skeleton.prototype.getTransformMatrixTexture = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._transformMatrixTexture) {\r\n return mesh._transformMatrixTexture;\r\n }\r\n return this._transformMatrixTexture;\r\n };\r\n /**\r\n * Gets the current hosting scene\r\n * @returns a scene object\r\n */\r\n Skeleton.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n // Methods\r\n /**\r\n * Gets a string representing the current skeleton data\r\n * @param fullDetails defines a boolean indicating if we want a verbose version\r\n * @returns a string representing the current skeleton data\r\n */\r\n Skeleton.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", nBones: \" + this.bones.length;\r\n ret += \", nAnimationRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name_1 in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name_1;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Get bone's index searching by name\r\n * @param name defines bone's name to search for\r\n * @return the indice of the bone. Returns -1 if not found\r\n */\r\n Skeleton.prototype.getBoneIndexByName = function (name) {\r\n for (var boneIndex = 0, cache = this.bones.length; boneIndex < cache; boneIndex++) {\r\n if (this.bones[boneIndex].name === name) {\r\n return boneIndex;\r\n }\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Creater a new animation range\r\n * @param name defines the name of the range\r\n * @param from defines the start key\r\n * @param to defines the end key\r\n */\r\n Skeleton.prototype.createAnimationRange = function (name, from, to) {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new _Animations_animationRange__WEBPACK_IMPORTED_MODULE_5__[\"AnimationRange\"](name, from, to);\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range\r\n * @param deleteFrames defines if frames must be removed as well\r\n */\r\n Skeleton.prototype.deleteAnimationRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets a specific animation range\r\n * @param name defines the name of the range to look for\r\n * @returns the requested animation range or null if not found\r\n */\r\n Skeleton.prototype.getAnimationRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the list of all animation ranges defined on this skeleton\r\n * @returns an array\r\n */\r\n Skeleton.prototype.getAnimationRanges = function () {\r\n var animationRanges = [];\r\n var name;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n };\r\n /**\r\n * Copy animation range from a source skeleton.\r\n * This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences\r\n * @param source defines the source skeleton\r\n * @param name defines the name of the range to copy\r\n * @param rescaleAsRequired defines if rescaling must be applied if required\r\n * @returns true if operation was successful\r\n */\r\n Skeleton.prototype.copyAnimationRange = function (source, name, rescaleAsRequired) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (this._ranges[name] || !source.getAnimationRange(name)) {\r\n return false;\r\n }\r\n var ret = true;\r\n var frameOffset = this._getHighestAnimationFrame() + 1;\r\n // make a dictionary of source skeleton's bones, so exact same order or doublely nested loop is not required\r\n var boneDict = {};\r\n var sourceBones = source.bones;\r\n var nBones;\r\n var i;\r\n for (i = 0, nBones = sourceBones.length; i < nBones; i++) {\r\n boneDict[sourceBones[i].name] = sourceBones[i];\r\n }\r\n if (this.bones.length !== sourceBones.length) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Warn(\"copyAnimationRange: this rig has \" + this.bones.length + \" bones, while source as \" + sourceBones.length);\r\n ret = false;\r\n }\r\n var skelDimensionsRatio = (rescaleAsRequired && this.dimensionsAtRest && source.dimensionsAtRest) ? this.dimensionsAtRest.divide(source.dimensionsAtRest) : null;\r\n for (i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n var boneName = this.bones[i].name;\r\n var sourceBone = boneDict[boneName];\r\n if (sourceBone) {\r\n ret = ret && this.bones[i].copyAnimationRange(sourceBone, name, frameOffset, rescaleAsRequired, skelDimensionsRatio);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Warn(\"copyAnimationRange: not same rig, missing source bone \" + boneName);\r\n ret = false;\r\n }\r\n }\r\n // do not call createAnimationRange(), since it also is done to bones, which was already done\r\n var range = source.getAnimationRange(name);\r\n if (range) {\r\n this._ranges[name] = new _Animations_animationRange__WEBPACK_IMPORTED_MODULE_5__[\"AnimationRange\"](name, range.from + frameOffset, range.to + frameOffset);\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Forces the skeleton to go to rest pose\r\n */\r\n Skeleton.prototype.returnToRest = function () {\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this.bones[index].returnToRest();\r\n }\r\n };\r\n Skeleton.prototype._getHighestAnimationFrame = function () {\r\n var ret = 0;\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n var highest = this.bones[i].animations[0].getHighestFrame();\r\n if (ret < highest) {\r\n ret = highest;\r\n }\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Begin a specific animation range\r\n * @param name defines the name of the range to start\r\n * @param loop defines if looping must be turned on (false by default)\r\n * @param speedRatio defines the speed ratio to apply (1 by default)\r\n * @param onAnimationEnd defines a callback which will be called when animation will end\r\n * @returns a new animatable\r\n */\r\n Skeleton.prototype.beginAnimation = function (name, loop, speedRatio, onAnimationEnd) {\r\n var range = this.getAnimationRange(name);\r\n if (!range) {\r\n return null;\r\n }\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._markAsDirty = function () {\r\n this._isDirty = true;\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._registerMeshWithPoseMatrix = function (mesh) {\r\n this._meshesWithPoseMatrix.push(mesh);\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._unregisterMeshWithPoseMatrix = function (mesh) {\r\n var index = this._meshesWithPoseMatrix.indexOf(mesh);\r\n if (index > -1) {\r\n this._meshesWithPoseMatrix.splice(index, 1);\r\n }\r\n };\r\n Skeleton.prototype._computeTransformMatrices = function (targetMatrix, initialSkinMatrix) {\r\n this.onBeforeComputeObservable.notifyObservers(this);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n bone._childUpdateId++;\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n bone.getLocalMatrix().multiplyToRef(parentBone.getWorldMatrix(), bone.getWorldMatrix());\r\n }\r\n else {\r\n if (initialSkinMatrix) {\r\n bone.getLocalMatrix().multiplyToRef(initialSkinMatrix, bone.getWorldMatrix());\r\n }\r\n else {\r\n bone.getWorldMatrix().copyFrom(bone.getLocalMatrix());\r\n }\r\n }\r\n if (bone._index !== -1) {\r\n var mappedIndex = bone._index === null ? index : bone._index;\r\n bone.getInvertedAbsoluteTransform().multiplyToArray(bone.getWorldMatrix(), targetMatrix, mappedIndex * 16);\r\n }\r\n }\r\n this._identity.copyToArray(targetMatrix, this.bones.length * 16);\r\n };\r\n /**\r\n * Build all resources required to render a skeleton\r\n */\r\n Skeleton.prototype.prepare = function () {\r\n // Update the local matrix of bones with linked transform nodes.\r\n if (this._numBonesWithLinkedTransformNode > 0) {\r\n for (var _i = 0, _a = this.bones; _i < _a.length; _i++) {\r\n var bone_1 = _a[_i];\r\n if (bone_1._linkedTransformNode) {\r\n // Computing the world matrix also computes the local matrix.\r\n bone_1._linkedTransformNode.computeWorldMatrix();\r\n bone_1._matrix = bone_1._linkedTransformNode._localMatrix;\r\n bone_1.markAsDirty();\r\n }\r\n }\r\n }\r\n if (!this._isDirty) {\r\n return;\r\n }\r\n if (this.needInitialSkinMatrix) {\r\n for (var index = 0; index < this._meshesWithPoseMatrix.length; index++) {\r\n var mesh = this._meshesWithPoseMatrix[index];\r\n var poseMatrix = mesh.getPoseMatrix();\r\n if (!mesh._bonesTransformMatrices || mesh._bonesTransformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n mesh._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n }\r\n if (this._synchronizedWithMesh !== mesh) {\r\n this._synchronizedWithMesh = mesh;\r\n // Prepare bones\r\n for (var boneIndex = 0; boneIndex < this.bones.length; boneIndex++) {\r\n var bone = this.bones[boneIndex];\r\n if (!bone.getParent()) {\r\n var matrix = bone.getBaseMatrix();\r\n matrix.multiplyToRef(poseMatrix, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[1]);\r\n bone._updateDifferenceMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[1]);\r\n }\r\n }\r\n if (this.isUsingTextureForMatrices) {\r\n var textureWidth = (this.bones.length + 1) * 4;\r\n if (!mesh._transformMatrixTexture || mesh._transformMatrixTexture.getSize().width !== textureWidth) {\r\n if (mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.dispose();\r\n }\r\n mesh._transformMatrixTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_3__[\"RawTexture\"].CreateRGBATexture(mesh._bonesTransformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n }\r\n }\r\n }\r\n this._computeTransformMatrices(mesh._bonesTransformMatrices, poseMatrix);\r\n if (this.isUsingTextureForMatrices && mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.update(mesh._bonesTransformMatrices);\r\n }\r\n }\r\n }\r\n else {\r\n if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n if (this.isUsingTextureForMatrices) {\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n }\r\n this._transformMatrixTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_3__[\"RawTexture\"].CreateRGBATexture(this._transformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n }\r\n }\r\n this._computeTransformMatrices(this._transformMatrices, null);\r\n if (this.isUsingTextureForMatrices && this._transformMatrixTexture) {\r\n this._transformMatrixTexture.update(this._transformMatrices);\r\n }\r\n }\r\n this._isDirty = false;\r\n this._scene._activeBones.addCount(this.bones.length, false);\r\n };\r\n /**\r\n * Gets the list of animatables currently running for this skeleton\r\n * @returns an array of animatables\r\n */\r\n Skeleton.prototype.getAnimatables = function () {\r\n if (!this._animatables || this._animatables.length !== this.bones.length) {\r\n this._animatables = [];\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._animatables.push(this.bones[index]);\r\n }\r\n }\r\n return this._animatables;\r\n };\r\n /**\r\n * Clone the current skeleton\r\n * @param name defines the name of the new skeleton\r\n * @param id defines the id of the new skeleton\r\n * @returns the new skeleton\r\n */\r\n Skeleton.prototype.clone = function (name, id) {\r\n var result = new Skeleton(name, id || name, this._scene);\r\n result.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var source = this.bones[index];\r\n var parentBone = null;\r\n var parent_1 = source.getParent();\r\n if (parent_1) {\r\n var parentIndex = this.bones.indexOf(parent_1);\r\n parentBone = result.bones[parentIndex];\r\n }\r\n var bone = new _bone__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"](source.name, result, parentBone, source.getBaseMatrix().clone(), source.getRestPose().clone());\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_9__[\"DeepCopier\"].DeepCopy(source.animations, bone.animations);\r\n }\r\n if (this._ranges) {\r\n result._ranges = {};\r\n for (var rangeName in this._ranges) {\r\n var range = this._ranges[rangeName];\r\n if (range) {\r\n result._ranges[rangeName] = range.clone();\r\n }\r\n }\r\n }\r\n this._isDirty = true;\r\n return result;\r\n };\r\n /**\r\n * Enable animation blending for this skeleton\r\n * @param blendingSpeed defines the blending speed to apply\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Skeleton.prototype.enableBlending = function (blendingSpeed) {\r\n if (blendingSpeed === void 0) { blendingSpeed = 0.01; }\r\n this.bones.forEach(function (bone) {\r\n bone.animations.forEach(function (animation) {\r\n animation.enableBlending = true;\r\n animation.blendingSpeed = blendingSpeed;\r\n });\r\n });\r\n };\r\n /**\r\n * Releases all resources associated with the current skeleton\r\n */\r\n Skeleton.prototype.dispose = function () {\r\n this._meshesWithPoseMatrix = [];\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeSkeleton(this);\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n };\r\n /**\r\n * Serialize the skeleton in a JSON object\r\n * @returns a JSON object\r\n */\r\n Skeleton.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (this.dimensionsAtRest) {\r\n serializationObject.dimensionsAtRest = this.dimensionsAtRest.asArray();\r\n }\r\n serializationObject.bones = [];\r\n serializationObject.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n var parent_2 = bone.getParent();\r\n var serializedBone = {\r\n parentBoneIndex: parent_2 ? this.bones.indexOf(parent_2) : -1,\r\n name: bone.name,\r\n matrix: bone.getBaseMatrix().toArray(),\r\n rest: bone.getRestPose().toArray()\r\n };\r\n serializationObject.bones.push(serializedBone);\r\n if (bone.length) {\r\n serializedBone.length = bone.length;\r\n }\r\n if (bone.metadata) {\r\n serializedBone.metadata = bone.metadata;\r\n }\r\n if (bone.animations && bone.animations.length > 0) {\r\n serializedBone.animation = bone.animations[0].serialize();\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new skeleton from serialized data\r\n * @param parsedSkeleton defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns a new skeleton\r\n */\r\n Skeleton.Parse = function (parsedSkeleton, scene) {\r\n var skeleton = new Skeleton(parsedSkeleton.name, parsedSkeleton.id, scene);\r\n if (parsedSkeleton.dimensionsAtRest) {\r\n skeleton.dimensionsAtRest = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedSkeleton.dimensionsAtRest);\r\n }\r\n skeleton.needInitialSkinMatrix = parsedSkeleton.needInitialSkinMatrix;\r\n var index;\r\n for (index = 0; index < parsedSkeleton.bones.length; index++) {\r\n var parsedBone = parsedSkeleton.bones[index];\r\n var parentBone = null;\r\n if (parsedBone.parentBoneIndex > -1) {\r\n parentBone = skeleton.bones[parsedBone.parentBoneIndex];\r\n }\r\n var rest = parsedBone.rest ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromArray(parsedBone.rest) : null;\r\n var bone = new _bone__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"](parsedBone.name, skeleton, parentBone, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromArray(parsedBone.matrix), rest);\r\n if (parsedBone.id !== undefined && parsedBone.id !== null) {\r\n bone.id = parsedBone.id;\r\n }\r\n if (parsedBone.length) {\r\n bone.length = parsedBone.length;\r\n }\r\n if (parsedBone.metadata) {\r\n bone.metadata = parsedBone.metadata;\r\n }\r\n if (parsedBone.animation) {\r\n bone.animations.push(_Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].Parse(parsedBone.animation));\r\n }\r\n if (parsedBone.linkedTransformNodeId !== undefined && parsedBone.linkedTransformNodeId !== null) {\r\n skeleton._hasWaitingData = true;\r\n bone._waitingTransformNodeId = parsedBone.linkedTransformNodeId;\r\n }\r\n }\r\n // placed after bones, so createAnimationRange can cascade down\r\n if (parsedSkeleton.ranges) {\r\n for (index = 0; index < parsedSkeleton.ranges.length; index++) {\r\n var data = parsedSkeleton.ranges[index];\r\n skeleton.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return skeleton;\r\n };\r\n /**\r\n * Compute all node absolute transforms\r\n * @param forceUpdate defines if computation must be done even if cache is up to date\r\n */\r\n Skeleton.prototype.computeAbsoluteTransforms = function (forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var renderId = this._scene.getRenderId();\r\n if (this._lastAbsoluteTransformsUpdateId != renderId || forceUpdate) {\r\n this.bones[0].computeAbsoluteTransforms();\r\n this._lastAbsoluteTransformsUpdateId = renderId;\r\n }\r\n };\r\n /**\r\n * Gets the root pose matrix\r\n * @returns a matrix\r\n */\r\n Skeleton.prototype.getPoseMatrix = function () {\r\n var poseMatrix = null;\r\n if (this._meshesWithPoseMatrix.length > 0) {\r\n poseMatrix = this._meshesWithPoseMatrix[0].getPoseMatrix();\r\n }\r\n return poseMatrix;\r\n };\r\n /**\r\n * Sorts bones per internal index\r\n */\r\n Skeleton.prototype.sortBones = function () {\r\n var bones = new Array();\r\n var visited = new Array(this.bones.length);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._sortBones(index, bones, visited);\r\n }\r\n this.bones = bones;\r\n };\r\n Skeleton.prototype._sortBones = function (index, bones, visited) {\r\n if (visited[index]) {\r\n return;\r\n }\r\n visited[index] = true;\r\n var bone = this.bones[index];\r\n if (bone._index === undefined) {\r\n bone._index = index;\r\n }\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n this._sortBones(this.bones.indexOf(parentBone), bones, visited);\r\n }\r\n bones.push(bone);\r\n };\r\n return Skeleton;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/BaseCameraPointersInput.ts\":\n/*!***************************************************!*\\\n !*** ./Cameras/Inputs/BaseCameraPointersInput.ts ***!\n \\***************************************************/\n/*! exports provided: BaseCameraPointersInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseCameraPointersInput\", function() { return BaseCameraPointersInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Base class for Camera Pointer Inputs.\r\n * See FollowCameraPointersInput in src/Cameras/Inputs/followCameraPointersInput.ts\r\n * for example usage.\r\n */\r\nvar BaseCameraPointersInput = /** @class */ (function () {\r\n function BaseCameraPointersInput() {\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n BaseCameraPointersInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var engine = this.camera.getEngine();\r\n var previousPinchSquaredDistance = 0;\r\n var previousMultiTouchPanPosition = null;\r\n this.pointA = null;\r\n this.pointB = null;\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n this._pointerInput = function (p, s) {\r\n var evt = p.event;\r\n var isTouch = evt.pointerType === \"touch\";\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE &&\r\n _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n _this._altKey = evt.altKey;\r\n _this._ctrlKey = evt.ctrlKey;\r\n _this._metaKey = evt.metaKey;\r\n _this._shiftKey = evt.shiftKey;\r\n _this._buttonsPressed = evt.buttons;\r\n if (engine.isPointerLock) {\r\n var offsetX = evt.movementX ||\r\n evt.mozMovementX ||\r\n evt.webkitMovementX ||\r\n evt.msMovementX ||\r\n 0;\r\n var offsetY = evt.movementY ||\r\n evt.mozMovementY ||\r\n evt.webkitMovementY ||\r\n evt.msMovementY ||\r\n 0;\r\n _this.onTouch(null, offsetX, offsetY);\r\n _this.pointA = null;\r\n _this.pointB = null;\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n if (_this.pointA === null) {\r\n _this.pointA = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n else if (_this.pointB === null) {\r\n _this.pointB = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n _this.onButtonDown(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element.focus();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOUBLETAP) {\r\n _this.onDoubleTap(evt.pointerType);\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n if (!isTouch) {\r\n _this.pointB = null; // Mouse and pen are mono pointer\r\n }\r\n //would be better to use pointers.remove(evt.pointerId) for multitouch gestures,\r\n //but emptying completely pointers collection is required to fix a bug on iPhone :\r\n //when changing orientation while pinching camera,\r\n //one pointer stay pressed forever if we don't release all pointers\r\n //will be ok to put back pointers.remove(evt.pointerId); when iPhone bug corrected\r\n if (engine._badOS) {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n else {\r\n //only remove the impacted pointer in case of multitouch allowing on most\r\n //platforms switching from rotate to zoom and pan seamlessly.\r\n if (_this.pointB && _this.pointA && _this.pointA.pointerId == evt.pointerId) {\r\n _this.pointA = _this.pointB;\r\n _this.pointB = null;\r\n }\r\n else if (_this.pointA && _this.pointB &&\r\n _this.pointB.pointerId == evt.pointerId) {\r\n _this.pointB = null;\r\n }\r\n else {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n }\r\n if (previousPinchSquaredDistance !== 0 || previousMultiTouchPanPosition) {\r\n // Previous pinch data is populated but a button has been lifted\r\n // so pinch has ended.\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, 0, // pinchSquaredDistance\r\n previousMultiTouchPanPosition, null // multiTouchPanPosition\r\n );\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n }\r\n _this.onButtonUp(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n // One button down\r\n if (_this.pointA && _this.pointB === null) {\r\n var offsetX = evt.clientX - _this.pointA.x;\r\n var offsetY = evt.clientY - _this.pointA.y;\r\n _this.onTouch(_this.pointA, offsetX, offsetY);\r\n _this.pointA.x = evt.clientX;\r\n _this.pointA.y = evt.clientY;\r\n }\r\n // Two buttons down: pinch\r\n else if (_this.pointA && _this.pointB) {\r\n var ed = (_this.pointA.pointerId === evt.pointerId) ?\r\n _this.pointA : _this.pointB;\r\n ed.x = evt.clientX;\r\n ed.y = evt.clientY;\r\n var distX = _this.pointA.x - _this.pointB.x;\r\n var distY = _this.pointA.y - _this.pointB.y;\r\n var pinchSquaredDistance = (distX * distX) + (distY * distY);\r\n var multiTouchPanPosition = { x: (_this.pointA.x + _this.pointB.x) / 2,\r\n y: (_this.pointA.y + _this.pointB.y) / 2,\r\n pointerId: evt.pointerId,\r\n type: p.type };\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition);\r\n previousMultiTouchPanPosition = multiTouchPanPosition;\r\n previousPinchSquaredDistance = pinchSquaredDistance;\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP |\r\n _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE);\r\n this._onLostFocus = function () {\r\n _this.pointA = _this.pointB = null;\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n _this.onLostFocus();\r\n };\r\n element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].RegisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(), [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n BaseCameraPointersInput.prototype.detachControl = function (element) {\r\n if (this._onLostFocus) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].UnregisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(), [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n }\r\n if (element && this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n if (this.onContextMenu) {\r\n element.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n this._onLostFocus = null;\r\n }\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n BaseCameraPointersInput.prototype.getClassName = function () {\r\n return \"BaseCameraPointersInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n BaseCameraPointersInput.prototype.getSimpleName = function () {\r\n return \"pointers\";\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n * Override this method to provide functionality on POINTERDOUBLETAP event.\r\n */\r\n BaseCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onLostFocus = function () {\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseCameraPointersInput.prototype, \"buttons\", void 0);\r\n return BaseCameraPointersInput;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraGamepadInput.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraGamepadInput.ts ***!\n \\*******************************************************/\n/*! exports provided: ArcRotateCameraGamepadInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return ArcRotateCameraGamepadInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the gamepad inputs to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraGamepadInput = /** @class */ (function () {\r\n function ArcRotateCameraGamepadInput() {\r\n /**\r\n * Defines the gamepad rotation sensiblity.\r\n * This is the threshold from when rotation starts to be accounted for to prevent jittering.\r\n */\r\n this.gamepadRotationSensibility = 80;\r\n /**\r\n * Defines the gamepad move sensiblity.\r\n * This is the threshold from when moving starts to be accounted for for to prevent jittering.\r\n */\r\n this.gamepadMoveSensibility = 40;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraGamepadInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var manager = this.camera.getScene().gamepadManager;\r\n this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {\r\n if (gamepad.type !== _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__[\"Gamepad\"].POSE_ENABLED) {\r\n // prioritize XBOX gamepads.\r\n if (!_this.gamepad || gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__[\"Gamepad\"].XBOX) {\r\n _this.gamepad = gamepad;\r\n }\r\n }\r\n });\r\n this._onGamepadDisconnectedObserver = manager.onGamepadDisconnectedObservable.add(function (gamepad) {\r\n if (_this.gamepad === gamepad) {\r\n _this.gamepad = null;\r\n }\r\n });\r\n this.gamepad = manager.getGamepadByType(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__[\"Gamepad\"].XBOX);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraGamepadInput.prototype.detachControl = function (element) {\r\n this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);\r\n this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);\r\n this.gamepad = null;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraGamepadInput.prototype.checkInputs = function () {\r\n if (this.gamepad) {\r\n var camera = this.camera;\r\n var RSValues = this.gamepad.rightStick;\r\n if (RSValues) {\r\n if (RSValues.x != 0) {\r\n var normalizedRX = RSValues.x / this.gamepadRotationSensibility;\r\n if (normalizedRX != 0 && Math.abs(normalizedRX) > 0.005) {\r\n camera.inertialAlphaOffset += normalizedRX;\r\n }\r\n }\r\n if (RSValues.y != 0) {\r\n var normalizedRY = RSValues.y / this.gamepadRotationSensibility;\r\n if (normalizedRY != 0 && Math.abs(normalizedRY) > 0.005) {\r\n camera.inertialBetaOffset += normalizedRY;\r\n }\r\n }\r\n }\r\n var LSValues = this.gamepad.leftStick;\r\n if (LSValues && LSValues.y != 0) {\r\n var normalizedLY = LSValues.y / this.gamepadMoveSensibility;\r\n if (normalizedLY != 0 && Math.abs(normalizedLY) > 0.005) {\r\n this.camera.inertialRadiusOffset -= normalizedLY;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraGamepadInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraGamepadInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraGamepadInput.prototype.getSimpleName = function () {\r\n return \"gamepad\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraGamepadInput.prototype, \"gamepadRotationSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraGamepadInput.prototype, \"gamepadMoveSensibility\", void 0);\r\n return ArcRotateCameraGamepadInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraGamepadInput\"] = ArcRotateCameraGamepadInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts\":\n/*!************************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts ***!\n \\************************************************************/\n/*! exports provided: ArcRotateCameraKeyboardMoveInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return ArcRotateCameraKeyboardMoveInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the keyboard inputs to control the movement of an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraKeyboardMoveInput = /** @class */ (function () {\r\n function ArcRotateCameraKeyboardMoveInput() {\r\n /**\r\n * Defines the list of key codes associated with the up action (increase alpha)\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Defines the list of key codes associated with the down action (decrease alpha)\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Defines the list of key codes associated with the left action (increase beta)\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Defines the list of key codes associated with the right action (decrease beta)\r\n */\r\n this.keysRight = [39];\r\n /**\r\n * Defines the list of key codes associated with the reset action.\r\n * Those keys reset the camera to its last stored state (with the method camera.storeState())\r\n */\r\n this.keysReset = [220];\r\n /**\r\n * Defines the panning sensibility of the inputs.\r\n * (How fast is the camera paning)\r\n */\r\n this.panningSensibility = 50.0;\r\n /**\r\n * Defines the zooming sensibility of the inputs.\r\n * (How fast is the camera zooming)\r\n */\r\n this.zoomingSensibility = 25.0;\r\n /**\r\n * Defines wether maintaining the alt key down switch the movement mode from\r\n * orientation to zoom.\r\n */\r\n this.useAltToZoom = true;\r\n /**\r\n * Rotation speed of the camera\r\n */\r\n this.angularSpeed = 0.01;\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n _this._ctrlPressed = evt.ctrlKey;\r\n _this._altPressed = evt.altKey;\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX -= 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY += 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset += 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX += 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY -= 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset -= 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysReset.indexOf(keyCode) !== -1) {\r\n if (camera.useInputToRestoreState) {\r\n camera.restoreState();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraKeyboardMoveInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysReset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"panningSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"zoomingSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"useAltToZoom\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"angularSpeed\", void 0);\r\n return ArcRotateCameraKeyboardMoveInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraKeyboardMoveInput\"] = ArcRotateCameraKeyboardMoveInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts\":\n/*!**********************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts ***!\n \\**********************************************************/\n/*! exports provided: ArcRotateCameraMouseWheelInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return ArcRotateCameraMouseWheelInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the mouse wheel inputs to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraMouseWheelInput = /** @class */ (function () {\r\n function ArcRotateCameraMouseWheelInput() {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n this.wheelPrecision = 3.0;\r\n /**\r\n * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when wheel is used.\r\n */\r\n this.wheelDeltaPercentage = 0;\r\n }\r\n ArcRotateCameraMouseWheelInput.prototype.computeDeltaFromMouseWheelLegacyEvent = function (mouseWheelLegacyEvent, radius) {\r\n var delta = 0;\r\n var wheelDelta = (mouseWheelLegacyEvent.wheelDelta * 0.01 * this.wheelDeltaPercentage) * radius;\r\n if (mouseWheelLegacyEvent.wheelDelta > 0) {\r\n delta = wheelDelta / (1.0 + this.wheelDeltaPercentage);\r\n }\r\n else {\r\n delta = wheelDelta * (1.0 + this.wheelDeltaPercentage);\r\n }\r\n return delta;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n this._wheel = function (p, s) {\r\n //sanity check - this should be a PointerWheel event.\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL) {\r\n return;\r\n }\r\n var event = p.event;\r\n var delta = 0;\r\n var mouseWheelLegacyEvent = event;\r\n if (mouseWheelLegacyEvent.wheelDelta) {\r\n if (_this.wheelDeltaPercentage) {\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(mouseWheelLegacyEvent, _this.camera.radius);\r\n // If zooming in, estimate the target radius and use that to compute the delta for inertia\r\n // this will stop multiple scroll events zooming in from adding too much inertia\r\n if (delta > 0) {\r\n var estimatedTargetRadius = _this.camera.radius;\r\n var targetInertia = _this.camera.inertialRadiusOffset + delta;\r\n for (var i = 0; i < 20 && Math.abs(targetInertia) > 0.001; i++) {\r\n estimatedTargetRadius -= targetInertia;\r\n targetInertia *= _this.camera.inertia;\r\n }\r\n estimatedTargetRadius = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Clamp(estimatedTargetRadius, 0, Number.MAX_VALUE);\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(mouseWheelLegacyEvent, estimatedTargetRadius);\r\n }\r\n }\r\n else {\r\n delta = mouseWheelLegacyEvent.wheelDelta / (_this.wheelPrecision * 40);\r\n }\r\n }\r\n else {\r\n var deltaValue = event.deltaY || event.detail;\r\n delta = -deltaValue / _this.wheelPrecision;\r\n }\r\n if (delta) {\r\n _this.camera.inertialRadiusOffset += delta;\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelDeltaPercentage\", void 0);\r\n return ArcRotateCameraMouseWheelInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraMouseWheelInput\"] = ArcRotateCameraMouseWheelInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraPointersInput.ts\":\n/*!********************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraPointersInput.ts ***!\n \\********************************************************/\n/*! exports provided: ArcRotateCameraPointersInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return ArcRotateCameraPointersInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/Inputs/BaseCameraPointersInput */ \"./Cameras/Inputs/BaseCameraPointersInput.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the pointers inputs to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraPointersInput = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcRotateCameraPointersInput, _super);\r\n function ArcRotateCameraPointersInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n _this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityX = 1000.0;\r\n /**\r\n * Defines the pointer angular sensibility along the Y axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityY = 1000.0;\r\n /**\r\n * Defines the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n _this.pinchPrecision = 12.0;\r\n /**\r\n * pinchDeltaPercentage will be used instead of pinchPrecision if different\r\n * from 0.\r\n * It defines the percentage of current camera.radius to use as delta when\r\n * pinch zoom is used.\r\n */\r\n _this.pinchDeltaPercentage = 0;\r\n /**\r\n * Defines the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n _this.panningSensibility = 1000.0;\r\n /**\r\n * Defines whether panning (2 fingers swipe) is enabled through multitouch.\r\n */\r\n _this.multiTouchPanning = true;\r\n /**\r\n * Defines whether panning is enabled for both pan (2 fingers swipe) and\r\n * zoom (pinch) through multitouch.\r\n */\r\n _this.multiTouchPanAndZoom = true;\r\n /**\r\n * Revers pinch action direction.\r\n */\r\n _this.pinchInwards = true;\r\n _this._isPanClick = false;\r\n _this._twoFingerActivityCount = 0;\r\n _this._isPinching = false;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraPointersInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraPointersInput\";\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n if (this.panningSensibility !== 0 &&\r\n ((this._ctrlKey && this.camera._useCtrlForPanning) || this._isPanClick)) {\r\n this.camera.inertialPanningX += -offsetX / this.panningSensibility;\r\n this.camera.inertialPanningY += offsetY / this.panningSensibility;\r\n }\r\n else {\r\n this.camera.inertialAlphaOffset -= offsetX / this.angularSensibilityX;\r\n this.camera.inertialBetaOffset -= offsetY / this.angularSensibilityY;\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n if (this.camera.useInputToRestoreState) {\r\n this.camera.restoreState();\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n if (previousPinchSquaredDistance === 0 && previousMultiTouchPanPosition === null) {\r\n // First time this method is called for new pinch.\r\n // Next time this is called there will be a\r\n // previousPinchSquaredDistance and pinchSquaredDistance to compare.\r\n return;\r\n }\r\n if (pinchSquaredDistance === 0 && multiTouchPanPosition === null) {\r\n // Last time this method is called at the end of a pinch.\r\n return;\r\n }\r\n var direction = this.pinchInwards ? 1 : -1;\r\n if (this.multiTouchPanAndZoom) {\r\n if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n if (this.panningSensibility !== 0 &&\r\n previousMultiTouchPanPosition && multiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n else {\r\n this._twoFingerActivityCount++;\r\n var previousPinchDistance = Math.sqrt(previousPinchSquaredDistance);\r\n var pinchDistance = Math.sqrt(pinchSquaredDistance);\r\n if (this._isPinching ||\r\n (this._twoFingerActivityCount < 20 &&\r\n Math.abs(pinchDistance - previousPinchDistance) >\r\n this.camera.pinchToPanMaxDistance)) {\r\n // Since pinch has not been active long, assume we intend to zoom.\r\n if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n // Since we are pinching, remain pinching on next iteration.\r\n this._isPinching = true;\r\n }\r\n else {\r\n // Pause between pinch starting and moving implies not a zoom event.\r\n // Pan instead.\r\n if (this.panningSensibility !== 0 && this.multiTouchPanning &&\r\n multiTouchPanPosition && previousMultiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n this._isPanClick = evt.button === this.camera._panningMouseButton;\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onLostFocus = function () {\r\n this._isPanClick = false;\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"buttons\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchDeltaPercentage\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"panningSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanning\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanAndZoom\", void 0);\r\n return ArcRotateCameraPointersInput;\r\n}(_Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__[\"BaseCameraPointersInput\"]));\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraPointersInput\"] =\r\n ArcRotateCameraPointersInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts\":\n/*!*******************************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts ***!\n \\*******************************************************************/\n/*! exports provided: ArcRotateCameraVRDeviceOrientationInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return ArcRotateCameraVRDeviceOrientationInput; });\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n\r\n\r\n/**\r\n * Add orientation input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n_Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"ArcRotateCameraInputsManager\"].prototype.addVRDeviceOrientation = function () {\r\n this.add(new ArcRotateCameraVRDeviceOrientationInput());\r\n return this;\r\n};\r\n/**\r\n * Manage the device orientation inputs (gyroscope) to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraVRDeviceOrientationInput = /** @class */ (function () {\r\n /**\r\n * Instantiate a new ArcRotateCameraVRDeviceOrientationInput.\r\n */\r\n function ArcRotateCameraVRDeviceOrientationInput() {\r\n /**\r\n * Defines a correction factor applied on the alpha value retrieved from the orientation events.\r\n */\r\n this.alphaCorrection = 1;\r\n /**\r\n * Defines a correction factor applied on the gamma value retrieved from the orientation events.\r\n */\r\n this.gammaCorrection = 1;\r\n this._alpha = 0;\r\n this._gamma = 0;\r\n this._dirty = false;\r\n this._deviceOrientationHandler = this._onOrientationEvent.bind(this);\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.attachControl = function (element, noPreventDefault) {\r\n this.camera.attachControl(element, noPreventDefault);\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n hostWindow.addEventListener(\"deviceorientation\", this._deviceOrientationHandler);\r\n };\r\n /** @hidden */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype._onOrientationEvent = function (evt) {\r\n if (evt.alpha !== null) {\r\n this._alpha = (+evt.alpha | 0) * this.alphaCorrection;\r\n }\r\n if (evt.gamma !== null) {\r\n this._gamma = (+evt.gamma | 0) * this.gammaCorrection;\r\n }\r\n this._dirty = true;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.checkInputs = function () {\r\n if (this._dirty) {\r\n this._dirty = false;\r\n if (this._gamma < 0) {\r\n this._gamma = 180 + this._gamma;\r\n }\r\n this.camera.alpha = (-this._alpha / 180.0 * Math.PI) % Math.PI * 2;\r\n this.camera.beta = (this._gamma / 180.0 * Math.PI);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.detachControl = function (element) {\r\n window.removeEventListener(\"deviceorientation\", this._deviceOrientationHandler);\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraVRDeviceOrientationInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.getSimpleName = function () {\r\n return \"VRDeviceOrientation\";\r\n };\r\n return ArcRotateCameraVRDeviceOrientationInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputTypes\"][\"ArcRotateCameraVRDeviceOrientationInput\"] = ArcRotateCameraVRDeviceOrientationInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/flyCameraKeyboardInput.ts\":\n/*!**************************************************!*\\\n !*** ./Cameras/Inputs/flyCameraKeyboardInput.ts ***!\n \\**************************************************/\n/*! exports provided: FlyCameraKeyboardInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return FlyCameraKeyboardInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Listen to keyboard events to control the camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FlyCameraKeyboardInput = /** @class */ (function () {\r\n function FlyCameraKeyboardInput() {\r\n /**\r\n * The list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysForward = [87];\r\n /**\r\n * The list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysBackward = [83];\r\n /**\r\n * The list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysUp = [69];\r\n /**\r\n * The list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysDown = [81];\r\n /**\r\n * The list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n this.keysRight = [68];\r\n /**\r\n * The list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n this.keysLeft = [65];\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FlyCameraKeyboardInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n if (_this.keysForward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysBackward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysForward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysBackward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FlyCameraKeyboardInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FlyCameraKeyboardInput.prototype.getClassName = function () {\r\n return \"FlyCameraKeyboardInput\";\r\n };\r\n /** @hidden */\r\n FlyCameraKeyboardInput.prototype._onLostFocus = function (e) {\r\n this._keys = [];\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FlyCameraKeyboardInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FlyCameraKeyboardInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n // Keyboard\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n var speed = camera._computeLocalCameraSpeed();\r\n if (this.keysForward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, speed);\r\n }\r\n else if (this.keysBackward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, -speed);\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, speed, 0);\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, -speed, 0);\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(speed, 0, 0);\r\n }\r\n else if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(-speed, 0, 0);\r\n }\r\n if (camera.getScene().useRightHandedSystem) {\r\n camera._localDirection.z *= -1;\r\n }\r\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);\r\n camera.cameraDirection.addInPlace(camera._transformedDirection);\r\n }\r\n }\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysForward\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysBackward\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysUp\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysRight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysLeft\", void 0);\r\n return FlyCameraKeyboardInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FlyCameraKeyboardInput\"] = FlyCameraKeyboardInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/flyCameraMouseInput.ts\":\n/*!***********************************************!*\\\n !*** ./Cameras/Inputs/flyCameraMouseInput.ts ***!\n \\***********************************************/\n/*! exports provided: FlyCameraMouseInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return FlyCameraMouseInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Listen to mouse events to control the camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FlyCameraMouseInput = /** @class */ (function () {\r\n /**\r\n * Listen to mouse events to control the camera.\r\n * @param touchEnabled Define if touch is enabled. (Default is true.)\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\n function FlyCameraMouseInput(touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n /**\r\n * Defines the buttons associated with the input to handle camera rotation.\r\n */\r\n this.buttons = [0, 1, 2];\r\n /**\r\n * Assign buttons for Yaw control.\r\n */\r\n this.buttonsYaw = [-1, 0, 1];\r\n /**\r\n * Assign buttons for Pitch control.\r\n */\r\n this.buttonsPitch = [-1, 0, 1];\r\n /**\r\n * Assign buttons for Roll control.\r\n */\r\n this.buttonsRoll = [2];\r\n /**\r\n * Detect if any button is being pressed while mouse is moved.\r\n * -1 = Mouse locked.\r\n * 0 = Left button.\r\n * 1 = Middle Button.\r\n * 2 = Right Button.\r\n */\r\n this.activeButton = -1;\r\n /**\r\n * Defines the pointer's angular sensibility, to control the camera rotation speed.\r\n * Higher values reduce its sensitivity.\r\n */\r\n this.angularSensibility = 1000.0;\r\n this.previousPosition = null;\r\n }\r\n /**\r\n * Attach the mouse control to the HTML DOM element.\r\n * @param element Defines the element that listens to the input events.\r\n * @param noPreventDefault Defines whether events caught by the controls should call preventdefault().\r\n */\r\n FlyCameraMouseInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n this.element = element;\r\n this.noPreventDefault = noPreventDefault;\r\n this._observer = this.camera.getScene().onPointerObservable.add(function (p, s) {\r\n _this._pointerInput(p, s);\r\n }, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE);\r\n // Correct Roll by rate, if enabled.\r\n this._rollObserver = this.camera.getScene().onBeforeRenderObservable.add(function () {\r\n if (_this.camera.rollCorrect) {\r\n _this.camera.restoreRoll(_this.camera.rollCorrect);\r\n }\r\n });\r\n // Helper function to keep 'this'.\r\n this._mousemoveCallback = function (e) {\r\n _this._onMouseMove(e);\r\n };\r\n element.addEventListener(\"mousemove\", this._mousemoveCallback, false);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FlyCameraMouseInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this.camera.getScene().onBeforeRenderObservable.remove(this._rollObserver);\r\n if (this._mousemoveCallback) {\r\n element.removeEventListener(\"mousemove\", this._mousemoveCallback);\r\n }\r\n this._observer = null;\r\n this._rollObserver = null;\r\n this.previousPosition = null;\r\n this.noPreventDefault = undefined;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name.\r\n */\r\n FlyCameraMouseInput.prototype.getClassName = function () {\r\n return \"FlyCameraMouseInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input's friendly name.\r\n */\r\n FlyCameraMouseInput.prototype.getSimpleName = function () {\r\n return \"mouse\";\r\n };\r\n // Track mouse movement, when the pointer is not locked.\r\n FlyCameraMouseInput.prototype._pointerInput = function (p, s) {\r\n var e = p.event;\r\n var camera = this.camera;\r\n var engine = camera.getEngine();\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (!this.touchEnabled && e.pointerType === \"touch\") {\r\n return;\r\n }\r\n // Mouse is moved but an unknown mouse button is pressed.\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE && this.buttons.indexOf(e.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (e.srcElement || e.target);\r\n // Mouse down.\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(e.pointerId);\r\n }\r\n catch (e) {\r\n // Nothing to do with the error. Execution continues.\r\n }\r\n this.previousPosition = {\r\n x: e.clientX,\r\n y: e.clientY\r\n };\r\n this.activeButton = e.button;\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n this.element.focus();\r\n }\r\n }\r\n else \r\n // Mouse up.\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(e.pointerId);\r\n }\r\n catch (e) {\r\n // Nothing to do with the error. Execution continues.\r\n }\r\n this.activeButton = -1;\r\n this.previousPosition = null;\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n }\r\n }\r\n else \r\n // Mouse move.\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!this.previousPosition || engine.isPointerLock) {\r\n return;\r\n }\r\n var offsetX = e.clientX - this.previousPosition.x;\r\n var offsetY = e.clientY - this.previousPosition.y;\r\n this.rotateCamera(offsetX, offsetY);\r\n this.previousPosition = {\r\n x: e.clientX,\r\n y: e.clientY\r\n };\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n }\r\n }\r\n };\r\n // Track mouse movement, when pointer is locked.\r\n FlyCameraMouseInput.prototype._onMouseMove = function (e) {\r\n var camera = this.camera;\r\n var engine = camera.getEngine();\r\n if (!engine.isPointerLock || engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n var offsetX = e.movementX || e.mozMovementX || e.webkitMovementX || e.msMovementX || 0;\r\n var offsetY = e.movementY || e.mozMovementY || e.webkitMovementY || e.msMovementY || 0;\r\n this.rotateCamera(offsetX, offsetY);\r\n this.previousPosition = null;\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n }\r\n };\r\n /**\r\n * Rotate camera by mouse offset.\r\n */\r\n FlyCameraMouseInput.prototype.rotateCamera = function (offsetX, offsetY) {\r\n var _this = this;\r\n var camera = this.camera;\r\n var scene = this.camera.getScene();\r\n if (scene.useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (camera.parent && camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n var x = offsetX / this.angularSensibility;\r\n var y = offsetY / this.angularSensibility;\r\n // Initialize to current rotation.\r\n var currentRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, camera.rotation.z);\r\n var rotationChange;\r\n // Pitch.\r\n if (this.buttonsPitch.some(function (v) { return v === _this.activeButton; })) {\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].X, y);\r\n // Apply Pitch to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n }\r\n // Yaw.\r\n if (this.buttonsYaw.some(function (v) { return v === _this.activeButton; })) {\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y, x);\r\n // Apply Yaw to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n // Add Roll, if banked turning is enabled, within Roll limit.\r\n var limit = (camera.bankedTurnLimit) + camera._trackRoll; // Defaults to 90° plus manual roll.\r\n if (camera.bankedTurn && -limit < camera.rotation.z && camera.rotation.z < limit) {\r\n var bankingDelta = camera.bankedTurnMultiplier * -x;\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Z, bankingDelta);\r\n // Apply Yaw to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n }\r\n }\r\n // Roll.\r\n if (this.buttonsRoll.some(function (v) { return v === _this.activeButton; })) {\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Z, -x);\r\n // Track Rolling.\r\n camera._trackRoll -= x;\r\n // Apply Pitch to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n }\r\n // Apply rotationQuaternion to Euler camera.rotation.\r\n currentRotation.toEulerAnglesToRef(camera.rotation);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraMouseInput.prototype, \"buttons\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraMouseInput.prototype, \"angularSensibility\", void 0);\r\n return FlyCameraMouseInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FlyCameraMouseInput\"] = FlyCameraMouseInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/followCameraKeyboardMoveInput.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/Inputs/followCameraKeyboardMoveInput.ts ***!\n \\*********************************************************/\n/*! exports provided: FollowCameraKeyboardMoveInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return FollowCameraKeyboardMoveInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the keyboard inputs to control the movement of a follow camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraKeyboardMoveInput = /** @class */ (function () {\r\n function FollowCameraKeyboardMoveInput() {\r\n /**\r\n * Defines the list of key codes associated with the up action (increase heightOffset)\r\n */\r\n this.keysHeightOffsetIncr = [38];\r\n /**\r\n * Defines the list of key codes associated with the down action (decrease heightOffset)\r\n */\r\n this.keysHeightOffsetDecr = [40];\r\n /**\r\n * Defines whether the Alt modifier key is required to move up/down (alter heightOffset)\r\n */\r\n this.keysHeightOffsetModifierAlt = false;\r\n /**\r\n * Defines whether the Ctrl modifier key is required to move up/down (alter heightOffset)\r\n */\r\n this.keysHeightOffsetModifierCtrl = false;\r\n /**\r\n * Defines whether the Shift modifier key is required to move up/down (alter heightOffset)\r\n */\r\n this.keysHeightOffsetModifierShift = false;\r\n /**\r\n * Defines the list of key codes associated with the left action (increase rotationOffset)\r\n */\r\n this.keysRotationOffsetIncr = [37];\r\n /**\r\n * Defines the list of key codes associated with the right action (decrease rotationOffset)\r\n */\r\n this.keysRotationOffsetDecr = [39];\r\n /**\r\n * Defines whether the Alt modifier key is required to move left/right (alter rotationOffset)\r\n */\r\n this.keysRotationOffsetModifierAlt = false;\r\n /**\r\n * Defines whether the Ctrl modifier key is required to move left/right (alter rotationOffset)\r\n */\r\n this.keysRotationOffsetModifierCtrl = false;\r\n /**\r\n * Defines whether the Shift modifier key is required to move left/right (alter rotationOffset)\r\n */\r\n this.keysRotationOffsetModifierShift = false;\r\n /**\r\n * Defines the list of key codes associated with the zoom-in action (decrease radius)\r\n */\r\n this.keysRadiusIncr = [40];\r\n /**\r\n * Defines the list of key codes associated with the zoom-out action (increase radius)\r\n */\r\n this.keysRadiusDecr = [38];\r\n /**\r\n * Defines whether the Alt modifier key is required to zoom in/out (alter radius value)\r\n */\r\n this.keysRadiusModifierAlt = true;\r\n /**\r\n * Defines whether the Ctrl modifier key is required to zoom in/out (alter radius value)\r\n */\r\n this.keysRadiusModifierCtrl = false;\r\n /**\r\n * Defines whether the Shift modifier key is required to zoom in/out (alter radius value)\r\n */\r\n this.keysRadiusModifierShift = false;\r\n /**\r\n * Defines the rate of change of heightOffset.\r\n */\r\n this.heightSensibility = 1;\r\n /**\r\n * Defines the rate of change of rotationOffset.\r\n */\r\n this.rotationSensibility = 1;\r\n /**\r\n * Defines the rate of change of radius.\r\n */\r\n this.radiusSensibility = 1;\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n _this._ctrlPressed = evt.ctrlKey;\r\n _this._altPressed = evt.altKey;\r\n _this._shiftPressed = evt.shiftKey;\r\n if (_this.keysHeightOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysHeightOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusDecr.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysHeightOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysHeightOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusDecr.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n var _this = this;\r\n if (this._onKeyboardObserver) {\r\n this._keys.forEach(function (keyCode) {\r\n if (_this.keysHeightOffsetIncr.indexOf(keyCode) !== -1 &&\r\n _this._modifierHeightOffset()) {\r\n _this.camera.heightOffset += _this.heightSensibility;\r\n }\r\n else if (_this.keysHeightOffsetDecr.indexOf(keyCode) !== -1 &&\r\n _this._modifierHeightOffset()) {\r\n _this.camera.heightOffset -= _this.heightSensibility;\r\n }\r\n else if (_this.keysRotationOffsetIncr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRotationOffset()) {\r\n _this.camera.rotationOffset += _this.rotationSensibility;\r\n _this.camera.rotationOffset %= 360;\r\n }\r\n else if (_this.keysRotationOffsetDecr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRotationOffset()) {\r\n _this.camera.rotationOffset -= _this.rotationSensibility;\r\n _this.camera.rotationOffset %= 360;\r\n }\r\n else if (_this.keysRadiusIncr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRadius()) {\r\n _this.camera.radius += _this.radiusSensibility;\r\n }\r\n else if (_this.keysRadiusDecr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRadius()) {\r\n _this.camera.radius -= _this.radiusSensibility;\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"FollowCameraKeyboardMoveInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n /**\r\n * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to\r\n * allow modification of the heightOffset value.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype._modifierHeightOffset = function () {\r\n return (this.keysHeightOffsetModifierAlt === this._altPressed &&\r\n this.keysHeightOffsetModifierCtrl === this._ctrlPressed &&\r\n this.keysHeightOffsetModifierShift === this._shiftPressed);\r\n };\r\n /**\r\n * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to\r\n * allow modification of the rotationOffset value.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype._modifierRotationOffset = function () {\r\n return (this.keysRotationOffsetModifierAlt === this._altPressed &&\r\n this.keysRotationOffsetModifierCtrl === this._ctrlPressed &&\r\n this.keysRotationOffsetModifierShift === this._shiftPressed);\r\n };\r\n /**\r\n * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to\r\n * allow modification of the radius value.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype._modifierRadius = function () {\r\n return (this.keysRadiusModifierAlt === this._altPressed &&\r\n this.keysRadiusModifierCtrl === this._ctrlPressed &&\r\n this.keysRadiusModifierShift === this._shiftPressed);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetIncr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetDecr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetModifierAlt\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetModifierCtrl\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetModifierShift\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetIncr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetDecr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetModifierAlt\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetModifierCtrl\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetModifierShift\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusIncr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusDecr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusModifierAlt\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusModifierCtrl\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusModifierShift\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"heightSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"rotationSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"radiusSensibility\", void 0);\r\n return FollowCameraKeyboardMoveInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputTypes\"][\"FollowCameraKeyboardMoveInput\"] = FollowCameraKeyboardMoveInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/followCameraMouseWheelInput.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Inputs/followCameraMouseWheelInput.ts ***!\n \\*******************************************************/\n/*! exports provided: FollowCameraMouseWheelInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return FollowCameraMouseWheelInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the mouse wheel inputs to control a follow camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraMouseWheelInput = /** @class */ (function () {\r\n function FollowCameraMouseWheelInput() {\r\n /**\r\n * Moue wheel controls zoom. (Mouse wheel modifies camera.radius value.)\r\n */\r\n this.axisControlRadius = true;\r\n /**\r\n * Moue wheel controls height. (Mouse wheel modifies camera.heightOffset value.)\r\n */\r\n this.axisControlHeight = false;\r\n /**\r\n * Moue wheel controls angle. (Mouse wheel modifies camera.rotationOffset value.)\r\n */\r\n this.axisControlRotation = false;\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera moves in\r\n * relation to mouseWheel events.\r\n */\r\n this.wheelPrecision = 3.0;\r\n /**\r\n * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when wheel is used.\r\n */\r\n this.wheelDeltaPercentage = 0;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FollowCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n this._wheel = function (p, s) {\r\n // sanity check - this should be a PointerWheel event.\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL) {\r\n return;\r\n }\r\n var event = p.event;\r\n var delta = 0;\r\n // Chrome, Safari: event.deltaY\r\n // IE: event.wheelDelta\r\n // Firefox: event.detail (inverted)\r\n var wheelDelta = Math.max(-1, Math.min(1, (event.deltaY || event.wheelDelta || -event.detail)));\r\n if (_this.wheelDeltaPercentage) {\r\n console.assert((_this.axisControlRadius +\r\n _this.axisControlHeight +\r\n _this.axisControlRotation) <= 1, \"wheelDeltaPercentage only usable when mouse wheel \" +\r\n \"controlls ONE axis. \" +\r\n \"Currently enabled: \" +\r\n \"axisControlRadius: \" + _this.axisControlRadius +\r\n \", axisControlHeightOffset: \" + _this.axisControlHeight +\r\n \", axisControlRotationOffset: \" + _this.axisControlRotation);\r\n if (_this.axisControlRadius) {\r\n delta =\r\n wheelDelta * 0.01 * _this.wheelDeltaPercentage *\r\n _this.camera.radius;\r\n }\r\n else if (_this.axisControlHeight) {\r\n delta =\r\n wheelDelta * 0.01 * _this.wheelDeltaPercentage *\r\n _this.camera.heightOffset;\r\n }\r\n else if (_this.axisControlRotation) {\r\n delta =\r\n wheelDelta * 0.01 * _this.wheelDeltaPercentage *\r\n _this.camera.rotationOffset;\r\n }\r\n }\r\n else {\r\n delta = wheelDelta * _this.wheelPrecision;\r\n }\r\n if (delta) {\r\n if (_this.axisControlRadius) {\r\n _this.camera.radius += delta;\r\n }\r\n else if (_this.axisControlHeight) {\r\n _this.camera.heightOffset -= delta;\r\n }\r\n else if (_this.axisControlRotation) {\r\n _this.camera.rotationOffset -= delta;\r\n }\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FollowCameraMouseWheelInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FollowCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FollowCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"axisControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"axisControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"axisControlRotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"wheelPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"wheelDeltaPercentage\", void 0);\r\n return FollowCameraMouseWheelInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FollowCameraMouseWheelInput\"] = FollowCameraMouseWheelInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/followCameraPointersInput.ts\":\n/*!*****************************************************!*\\\n !*** ./Cameras/Inputs/followCameraPointersInput.ts ***!\n \\*****************************************************/\n/*! exports provided: FollowCameraPointersInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return FollowCameraPointersInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/Inputs/BaseCameraPointersInput */ \"./Cameras/Inputs/BaseCameraPointersInput.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the pointers inputs to control an follow camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraPointersInput = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FollowCameraPointersInput, _super);\r\n function FollowCameraPointersInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Defines the pointer angular sensibility along the X axis or how fast is\r\n * the camera rotating.\r\n * A negative number will reverse the axis direction.\r\n */\r\n _this.angularSensibilityX = 1;\r\n /**\r\n * Defines the pointer angular sensibility along the Y axis or how fast is\r\n * the camera rotating.\r\n * A negative number will reverse the axis direction.\r\n */\r\n _this.angularSensibilityY = 1;\r\n /**\r\n * Defines the pointer pinch precision or how fast is the camera zooming.\r\n * A negative number will reverse the axis direction.\r\n */\r\n _this.pinchPrecision = 10000.0;\r\n /**\r\n * pinchDeltaPercentage will be used instead of pinchPrecision if different\r\n * from 0.\r\n * It defines the percentage of current camera.radius to use as delta when\r\n * pinch zoom is used.\r\n */\r\n _this.pinchDeltaPercentage = 0;\r\n /**\r\n * Pointer X axis controls zoom. (X axis modifies camera.radius value.)\r\n */\r\n _this.axisXControlRadius = false;\r\n /**\r\n * Pointer X axis controls height. (X axis modifies camera.heightOffset value.)\r\n */\r\n _this.axisXControlHeight = false;\r\n /**\r\n * Pointer X axis controls angle. (X axis modifies camera.rotationOffset value.)\r\n */\r\n _this.axisXControlRotation = true;\r\n /**\r\n * Pointer Y axis controls zoom. (Y axis modifies camera.radius value.)\r\n */\r\n _this.axisYControlRadius = false;\r\n /**\r\n * Pointer Y axis controls height. (Y axis modifies camera.heightOffset value.)\r\n */\r\n _this.axisYControlHeight = true;\r\n /**\r\n * Pointer Y axis controls angle. (Y axis modifies camera.rotationOffset value.)\r\n */\r\n _this.axisYControlRotation = false;\r\n /**\r\n * Pinch controls zoom. (Pinch modifies camera.radius value.)\r\n */\r\n _this.axisPinchControlRadius = true;\r\n /**\r\n * Pinch controls height. (Pinch modifies camera.heightOffset value.)\r\n */\r\n _this.axisPinchControlHeight = false;\r\n /**\r\n * Pinch controls angle. (Pinch modifies camera.rotationOffset value.)\r\n */\r\n _this.axisPinchControlRotation = false;\r\n /**\r\n * Log error messages if basic misconfiguration has occurred.\r\n */\r\n _this.warningEnable = true;\r\n /* Check for obvious misconfiguration. */\r\n _this._warningCounter = 0;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n FollowCameraPointersInput.prototype.getClassName = function () {\r\n return \"FollowCameraPointersInput\";\r\n };\r\n FollowCameraPointersInput.prototype.onTouch = function (pointA, offsetX, offsetY) {\r\n this._warning();\r\n if (this.axisXControlRotation) {\r\n this.camera.rotationOffset += offsetX / this.angularSensibilityX;\r\n }\r\n else if (this.axisYControlRotation) {\r\n this.camera.rotationOffset += offsetY / this.angularSensibilityX;\r\n }\r\n if (this.axisXControlHeight) {\r\n this.camera.heightOffset += offsetX / this.angularSensibilityY;\r\n }\r\n else if (this.axisYControlHeight) {\r\n this.camera.heightOffset += offsetY / this.angularSensibilityY;\r\n }\r\n if (this.axisXControlRadius) {\r\n this.camera.radius -= offsetX / this.angularSensibilityY;\r\n }\r\n else if (this.axisYControlRadius) {\r\n this.camera.radius -= offsetY / this.angularSensibilityY;\r\n }\r\n };\r\n FollowCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n if (previousPinchSquaredDistance === 0 && previousMultiTouchPanPosition === null) {\r\n // First time this method is called for new pinch.\r\n // Next time this is called there will be a\r\n // previousPinchSquaredDistance and pinchSquaredDistance to compare.\r\n return;\r\n }\r\n if (pinchSquaredDistance === 0 && multiTouchPanPosition === null) {\r\n // Last time this method is called at the end of a pinch.\r\n return;\r\n }\r\n var pinchDelta = (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n if (this.pinchDeltaPercentage) {\r\n pinchDelta *= 0.01 * this.pinchDeltaPercentage;\r\n if (this.axisPinchControlRotation) {\r\n this.camera.rotationOffset += pinchDelta * this.camera.rotationOffset;\r\n }\r\n if (this.axisPinchControlHeight) {\r\n this.camera.heightOffset += pinchDelta * this.camera.heightOffset;\r\n }\r\n if (this.axisPinchControlRadius) {\r\n this.camera.radius -= pinchDelta * this.camera.radius;\r\n }\r\n }\r\n else {\r\n if (this.axisPinchControlRotation) {\r\n this.camera.rotationOffset += pinchDelta;\r\n }\r\n if (this.axisPinchControlHeight) {\r\n this.camera.heightOffset += pinchDelta;\r\n }\r\n if (this.axisPinchControlRadius) {\r\n this.camera.radius -= pinchDelta;\r\n }\r\n }\r\n };\r\n FollowCameraPointersInput.prototype._warning = function () {\r\n if (!this.warningEnable || this._warningCounter++ % 100 !== 0) {\r\n return;\r\n }\r\n var warn = \"It probably only makes sense to control ONE camera \" +\r\n \"property with each pointer axis. Set 'warningEnable = false' \" +\r\n \"if you are sure. Currently enabled: \";\r\n console.assert((this.axisXControlRotation +\r\n this.axisXControlHeight +\r\n this.axisXControlRadius) <= 1, warn +\r\n \"axisXControlRotation: \" + this.axisXControlRotation +\r\n \", axisXControlHeight: \" + this.axisXControlHeight +\r\n \", axisXControlRadius: \" + this.axisXControlRadius);\r\n console.assert((this.axisYControlRotation +\r\n this.axisYControlHeight +\r\n this.axisYControlRadius) <= 1, warn +\r\n \"axisYControlRotation: \" + this.axisYControlRotation +\r\n \", axisYControlHeight: \" + this.axisYControlHeight +\r\n \", axisYControlRadius: \" + this.axisYControlRadius);\r\n console.assert((this.axisPinchControlRotation +\r\n this.axisPinchControlHeight +\r\n this.axisPinchControlRadius) <= 1, warn +\r\n \"axisPinchControlRotation: \" + this.axisPinchControlRotation +\r\n \", axisPinchControlHeight: \" + this.axisPinchControlHeight +\r\n \", axisPinchControlRadius: \" + this.axisPinchControlRadius);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"angularSensibilityX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"angularSensibilityY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"pinchPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"pinchDeltaPercentage\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisXControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisXControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisXControlRotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisYControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisYControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisYControlRotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisPinchControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisPinchControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisPinchControlRotation\", void 0);\r\n return FollowCameraPointersInput;\r\n}(_Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__[\"BaseCameraPointersInput\"]));\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FollowCameraPointersInput\"] = FollowCameraPointersInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraDeviceOrientationInput.ts\":\n/*!************************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraDeviceOrientationInput.ts ***!\n \\************************************************************/\n/*! exports provided: FreeCameraDeviceOrientationInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return FreeCameraDeviceOrientationInput; });\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Add orientation input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n_Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraInputsManager\"].prototype.addDeviceOrientation = function () {\r\n if (!this._deviceOrientationInput) {\r\n this._deviceOrientationInput = new FreeCameraDeviceOrientationInput();\r\n this.add(this._deviceOrientationInput);\r\n }\r\n return this;\r\n};\r\n/**\r\n * Takes information about the orientation of the device as reported by the deviceorientation event to orient the camera.\r\n * Screen rotation is taken into account.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraDeviceOrientationInput = /** @class */ (function () {\r\n /**\r\n * Instantiates a new input\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\n function FreeCameraDeviceOrientationInput() {\r\n var _this = this;\r\n this._screenOrientationAngle = 0;\r\n this._screenQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n this._alpha = 0;\r\n this._beta = 0;\r\n this._gamma = 0;\r\n /**\r\n * @hidden\r\n */\r\n this._onDeviceOrientationChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n this._orientationChanged = function () {\r\n _this._screenOrientationAngle = (window.orientation !== undefined ? +window.orientation : (window.screen.orientation && (window.screen.orientation)['angle'] ? (window.screen.orientation).angle : 0));\r\n _this._screenOrientationAngle = -_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(_this._screenOrientationAngle / 2);\r\n _this._screenQuaternion.copyFromFloats(0, Math.sin(_this._screenOrientationAngle), 0, Math.cos(_this._screenOrientationAngle));\r\n };\r\n this._deviceOrientation = function (evt) {\r\n _this._alpha = evt.alpha !== null ? evt.alpha : 0;\r\n _this._beta = evt.beta !== null ? evt.beta : 0;\r\n _this._gamma = evt.gamma !== null ? evt.gamma : 0;\r\n if (evt.alpha !== null) {\r\n _this._onDeviceOrientationChangedObservable.notifyObservers();\r\n }\r\n };\r\n this._constantTranform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"](-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5));\r\n this._orientationChanged();\r\n }\r\n /**\r\n * Can be used to detect if a device orientation sensor is availible on a device\r\n * @param timeout amount of time in milliseconds to wait for a response from the sensor (default: infinite)\r\n * @returns a promise that will resolve on orientation change\r\n */\r\n FreeCameraDeviceOrientationInput.WaitForOrientationChangeAsync = function (timeout) {\r\n return new Promise(function (res, rej) {\r\n var gotValue = false;\r\n var eventHandler = function () {\r\n window.removeEventListener(\"deviceorientation\", eventHandler);\r\n gotValue = true;\r\n res();\r\n };\r\n // If timeout is pupulated reject the promise\r\n if (timeout) {\r\n setTimeout(function () {\r\n if (!gotValue) {\r\n window.removeEventListener(\"deviceorientation\", eventHandler);\r\n rej(\"WaitForOrientationChangeAsync timed out\");\r\n }\r\n }, timeout);\r\n }\r\n window.addEventListener(\"deviceorientation\", eventHandler);\r\n });\r\n };\r\n Object.defineProperty(FreeCameraDeviceOrientationInput.prototype, \"camera\", {\r\n /**\r\n * Define the camera controlled by the input.\r\n */\r\n get: function () {\r\n return this._camera;\r\n },\r\n set: function (camera) {\r\n var _this = this;\r\n this._camera = camera;\r\n if (this._camera != null && !this._camera.rotationQuaternion) {\r\n this._camera.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n }\r\n if (this._camera) {\r\n this._camera.onDisposeObservable.add(function () {\r\n _this._onDeviceOrientationChangedObservable.clear();\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n hostWindow.addEventListener(\"orientationchange\", this._orientationChanged);\r\n hostWindow.addEventListener(\"deviceorientation\", this._deviceOrientation);\r\n //In certain cases, the attach control is called AFTER orientation was changed,\r\n //So this is needed.\r\n this._orientationChanged();\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.detachControl = function (element) {\r\n window.removeEventListener(\"orientationchange\", this._orientationChanged);\r\n window.removeEventListener(\"deviceorientation\", this._deviceOrientation);\r\n this._alpha = 0;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.checkInputs = function () {\r\n //if no device orientation provided, don't update the rotation.\r\n //Only testing against alpha under the assumption thatnorientation will never be so exact when set.\r\n if (!this._alpha) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].RotationYawPitchRollToRef(_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this._alpha), _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this._beta), -_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this._gamma), this.camera.rotationQuaternion);\r\n this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion);\r\n this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform);\r\n //Mirror on XY Plane\r\n this._camera.rotationQuaternion.z *= -1;\r\n this._camera.rotationQuaternion.w *= -1;\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.getClassName = function () {\r\n return \"FreeCameraDeviceOrientationInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.getSimpleName = function () {\r\n return \"deviceOrientation\";\r\n };\r\n return FreeCameraDeviceOrientationInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputTypes\"][\"FreeCameraDeviceOrientationInput\"] = FreeCameraDeviceOrientationInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraGamepadInput.ts\":\n/*!**************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraGamepadInput.ts ***!\n \\**************************************************/\n/*! exports provided: FreeCameraGamepadInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return FreeCameraGamepadInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the gamepad inputs to control a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraGamepadInput = /** @class */ (function () {\r\n function FreeCameraGamepadInput() {\r\n /**\r\n * Defines the gamepad rotation sensiblity.\r\n * This is the threshold from when rotation starts to be accounted for to prevent jittering.\r\n */\r\n this.gamepadAngularSensibility = 200;\r\n /**\r\n * Defines the gamepad move sensiblity.\r\n * This is the threshold from when moving starts to be accounted for for to prevent jittering.\r\n */\r\n this.gamepadMoveSensibility = 40;\r\n this._cameraTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n this._deltaTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._vector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._vector2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraGamepadInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var manager = this.camera.getScene().gamepadManager;\r\n this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {\r\n if (gamepad.type !== _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].POSE_ENABLED) {\r\n // prioritize XBOX gamepads.\r\n if (!_this.gamepad || gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].XBOX) {\r\n _this.gamepad = gamepad;\r\n }\r\n }\r\n });\r\n this._onGamepadDisconnectedObserver = manager.onGamepadDisconnectedObservable.add(function (gamepad) {\r\n if (_this.gamepad === gamepad) {\r\n _this.gamepad = null;\r\n }\r\n });\r\n this.gamepad = manager.getGamepadByType(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].XBOX);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraGamepadInput.prototype.detachControl = function (element) {\r\n this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);\r\n this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);\r\n this.gamepad = null;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraGamepadInput.prototype.checkInputs = function () {\r\n if (this.gamepad && this.gamepad.leftStick) {\r\n var camera = this.camera;\r\n var LSValues = this.gamepad.leftStick;\r\n var normalizedLX = LSValues.x / this.gamepadMoveSensibility;\r\n var normalizedLY = LSValues.y / this.gamepadMoveSensibility;\r\n LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;\r\n LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;\r\n var RSValues = this.gamepad.rightStick;\r\n if (RSValues) {\r\n var normalizedRX = RSValues.x / this.gamepadAngularSensibility;\r\n var normalizedRY = RSValues.y / this.gamepadAngularSensibility;\r\n RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;\r\n RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 0;\r\n }\r\n else {\r\n RSValues = { x: 0, y: 0 };\r\n }\r\n if (!camera.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, this._cameraTransform);\r\n }\r\n else {\r\n camera.rotationQuaternion.toRotationMatrix(this._cameraTransform);\r\n }\r\n var speed = camera._computeLocalCameraSpeed() * 50.0;\r\n this._vector3.copyFromFloats(LSValues.x * speed, 0, -LSValues.y * speed);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._vector3, this._cameraTransform, this._deltaTransform);\r\n camera.cameraDirection.addInPlace(this._deltaTransform);\r\n this._vector2.copyFromFloats(RSValues.y, RSValues.x);\r\n camera.cameraRotation.addInPlace(this._vector2);\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraGamepadInput.prototype.getClassName = function () {\r\n return \"FreeCameraGamepadInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraGamepadInput.prototype.getSimpleName = function () {\r\n return \"gamepad\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraGamepadInput.prototype, \"gamepadAngularSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraGamepadInput.prototype, \"gamepadMoveSensibility\", void 0);\r\n return FreeCameraGamepadInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FreeCameraGamepadInput\"] = FreeCameraGamepadInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraKeyboardMoveInput.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraKeyboardMoveInput.ts ***!\n \\*******************************************************/\n/*! exports provided: FreeCameraKeyboardMoveInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return FreeCameraKeyboardMoveInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the keyboard inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraKeyboardMoveInput = /** @class */ (function () {\r\n function FreeCameraKeyboardMoveInput() {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n this.keysRight = [39];\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n // Keyboard\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n var speed = camera._computeLocalCameraSpeed();\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(-speed, 0, 0);\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, speed);\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(speed, 0, 0);\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, -speed);\r\n }\r\n if (camera.getScene().useRightHandedSystem) {\r\n camera._localDirection.z *= -1;\r\n }\r\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);\r\n camera.cameraDirection.addInPlace(camera._transformedDirection);\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"FreeCameraKeyboardMoveInput\";\r\n };\r\n /** @hidden */\r\n FreeCameraKeyboardMoveInput.prototype._onLostFocus = function () {\r\n this._keys = [];\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n return FreeCameraKeyboardMoveInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FreeCameraKeyboardMoveInput\"] = FreeCameraKeyboardMoveInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraMouseInput.ts\":\n/*!************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraMouseInput.ts ***!\n \\************************************************/\n/*! exports provided: FreeCameraMouseInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return FreeCameraMouseInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraMouseInput = /** @class */ (function () {\r\n /**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param touchEnabled Defines if touch is enabled or not\r\n */\r\n function FreeCameraMouseInput(\r\n /**\r\n * Define if touch is enabled in the mouse input\r\n */\r\n touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n this.touchEnabled = touchEnabled;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\r\n */\r\n this.angularSensibility = 2000.0;\r\n this.previousPosition = null;\r\n /**\r\n * Observable for when a pointer move event occurs containing the move offset\r\n */\r\n this.onPointerMovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * @hidden\r\n * If the camera should be rotated automatically based on pointer movement\r\n */\r\n this._allowCameraRotation = true;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraMouseInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var engine = this.camera.getEngine();\r\n if (!this._pointerInput) {\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (!_this.touchEnabled && evt.pointerType === \"touch\") {\r\n return;\r\n }\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE && _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element.focus();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!_this.previousPosition || engine.isPointerLock) {\r\n return;\r\n }\r\n var offsetX = evt.clientX - _this.previousPosition.x;\r\n var offsetY = evt.clientY - _this.previousPosition.y;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n if (_this._allowCameraRotation) {\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n }\r\n _this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n };\r\n }\r\n this._onMouseMove = function (evt) {\r\n if (!engine.isPointerLock) {\r\n return;\r\n }\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERUP | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE);\r\n element.addEventListener(\"mousemove\", this._onMouseMove, false);\r\n element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n FreeCameraMouseInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraMouseInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n if (this._onMouseMove) {\r\n element.removeEventListener(\"mousemove\", this._onMouseMove);\r\n }\r\n if (this.onContextMenu) {\r\n element.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n if (this.onPointerMovedObservable) {\r\n this.onPointerMovedObservable.clear();\r\n }\r\n this._observer = null;\r\n this._onMouseMove = null;\r\n this.previousPosition = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraMouseInput.prototype.getClassName = function () {\r\n return \"FreeCameraMouseInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraMouseInput.prototype.getSimpleName = function () {\r\n return \"mouse\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FreeCameraMouseInput.prototype, \"buttons\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FreeCameraMouseInput.prototype, \"angularSensibility\", void 0);\r\n return FreeCameraMouseInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"CameraInputTypes\"][\"FreeCameraMouseInput\"] = FreeCameraMouseInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraTouchInput.ts\":\n/*!************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraTouchInput.ts ***!\n \\************************************************/\n/*! exports provided: FreeCameraTouchInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return FreeCameraTouchInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraTouchInput = /** @class */ (function () {\r\n function FreeCameraTouchInput() {\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The higher the faster.\r\n */\r\n this.touchAngularSensibility = 200000.0;\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The higher the faster.\r\n */\r\n this.touchMoveSensibility = 250.0;\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n this._pointerPressed = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraTouchInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var previousPosition = null;\r\n if (this._pointerInput === undefined) {\r\n this._onLostFocus = function () {\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n };\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n if (evt.pointerType === \"mouse\") {\r\n return;\r\n }\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n _this._pointerPressed.push(evt.pointerId);\r\n if (_this._pointerPressed.length !== 1) {\r\n return;\r\n }\r\n previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY\r\n };\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index === -1) {\r\n return;\r\n }\r\n _this._pointerPressed.splice(index, 1);\r\n if (index != 0) {\r\n return;\r\n }\r\n previousPosition = null;\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n if (!previousPosition) {\r\n return;\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index != 0) {\r\n return;\r\n }\r\n _this._offsetX = evt.clientX - previousPosition.x;\r\n _this._offsetY = -(evt.clientY - previousPosition.y);\r\n }\r\n };\r\n }\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE);\r\n if (this._onLostFocus) {\r\n element.addEventListener(\"blur\", this._onLostFocus);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraTouchInput.prototype.detachControl = function (element) {\r\n if (this._pointerInput && element) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n }\r\n if (this._onLostFocus) {\r\n element.removeEventListener(\"blur\", this._onLostFocus);\r\n this._onLostFocus = null;\r\n }\r\n this._pointerPressed = [];\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n }\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraTouchInput.prototype.checkInputs = function () {\r\n if (this._offsetX && this._offsetY) {\r\n var camera = this.camera;\r\n camera.cameraRotation.y += this._offsetX / this.touchAngularSensibility;\r\n if (this._pointerPressed.length > 1) {\r\n camera.cameraRotation.x += -this._offsetY / this.touchAngularSensibility;\r\n }\r\n else {\r\n var speed = camera._computeLocalCameraSpeed();\r\n var direction = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](0, 0, speed * this._offsetY / this.touchMoveSensibility);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);\r\n camera.cameraDirection.addInPlace(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinates(direction, camera._cameraRotationMatrix));\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraTouchInput.prototype.getClassName = function () {\r\n return \"FreeCameraTouchInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraTouchInput.prototype.getSimpleName = function () {\r\n return \"touch\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraTouchInput.prototype, \"touchAngularSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraTouchInput.prototype, \"touchMoveSensibility\", void 0);\r\n return FreeCameraTouchInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FreeCameraTouchInput\"] = FreeCameraTouchInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraVirtualJoystickInput.ts\":\n/*!**********************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraVirtualJoystickInput.ts ***!\n \\**********************************************************/\n/*! exports provided: FreeCameraVirtualJoystickInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return FreeCameraVirtualJoystickInput; });\n/* harmony import */ var _Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/virtualJoystick */ \"./Misc/virtualJoystick.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n/**\r\n* Add virtual joystick input support to the input manager.\r\n* @returns the current input manager\r\n*/\r\n_Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraInputsManager\"].prototype.addVirtualJoystick = function () {\r\n this.add(new FreeCameraVirtualJoystickInput());\r\n return this;\r\n};\r\n/**\r\n * Manage the Virtual Joystick inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraVirtualJoystickInput = /** @class */ (function () {\r\n function FreeCameraVirtualJoystickInput() {\r\n }\r\n /**\r\n * Gets the left stick of the virtual joystick.\r\n * @returns The virtual Joystick\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getLeftJoystick = function () {\r\n return this._leftjoystick;\r\n };\r\n /**\r\n * Gets the right stick of the virtual joystick.\r\n * @returns The virtual Joystick\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getRightJoystick = function () {\r\n return this._rightjoystick;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.checkInputs = function () {\r\n if (this._leftjoystick) {\r\n var camera = this.camera;\r\n var speed = camera._computeLocalCameraSpeed() * 50;\r\n var cameraTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, 0);\r\n var deltaTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](this._leftjoystick.deltaPosition.x * speed, this._leftjoystick.deltaPosition.y * speed, this._leftjoystick.deltaPosition.z * speed), cameraTransform);\r\n camera.cameraDirection = camera.cameraDirection.add(deltaTransform);\r\n camera.cameraRotation = camera.cameraRotation.addVector3(this._rightjoystick.deltaPosition);\r\n if (!this._leftjoystick.pressed) {\r\n this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(0.9);\r\n }\r\n if (!this._rightjoystick.pressed) {\r\n this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(0.9);\r\n }\r\n }\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.attachControl = function (element, noPreventDefault) {\r\n this._leftjoystick = new _Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoystick\"](true);\r\n this._leftjoystick.setAxisForUpDown(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].Z);\r\n this._leftjoystick.setAxisForLeftRight(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].X);\r\n this._leftjoystick.setJoystickSensibility(0.15);\r\n this._rightjoystick = new _Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoystick\"](false);\r\n this._rightjoystick.setAxisForUpDown(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].X);\r\n this._rightjoystick.setAxisForLeftRight(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].Y);\r\n this._rightjoystick.reverseUpDown = true;\r\n this._rightjoystick.setJoystickSensibility(0.05);\r\n this._rightjoystick.setJoystickColor(\"yellow\");\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.detachControl = function (element) {\r\n this._leftjoystick.releaseCanvas();\r\n this._rightjoystick.releaseCanvas();\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getClassName = function () {\r\n return \"FreeCameraVirtualJoystickInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getSimpleName = function () {\r\n return \"virtualJoystick\";\r\n };\r\n return FreeCameraVirtualJoystickInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputTypes\"][\"FreeCameraVirtualJoystickInput\"] = FreeCameraVirtualJoystickInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/index.ts\":\n/*!*********************************!*\\\n !*** ./Cameras/Inputs/index.ts ***!\n \\*********************************/\n/*! exports provided: ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arcRotateCameraGamepadInput */ \"./Cameras/Inputs/arcRotateCameraGamepadInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony import */ var _arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./arcRotateCameraKeyboardMoveInput */ \"./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_1__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony import */ var _arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./arcRotateCameraMouseWheelInput */ \"./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony import */ var _arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arcRotateCameraPointersInput */ \"./Cameras/Inputs/arcRotateCameraPointersInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony import */ var _arcRotateCameraVRDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./arcRotateCameraVRDeviceOrientationInput */ \"./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _arcRotateCameraVRDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_4__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony import */ var _flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flyCameraKeyboardInput */ \"./Cameras/Inputs/flyCameraKeyboardInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_5__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony import */ var _flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flyCameraMouseInput */ \"./Cameras/Inputs/flyCameraMouseInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_6__[\"FlyCameraMouseInput\"]; });\n\n/* harmony import */ var _followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./followCameraKeyboardMoveInput */ \"./Cameras/Inputs/followCameraKeyboardMoveInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony import */ var _followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./followCameraMouseWheelInput */ \"./Cameras/Inputs/followCameraMouseWheelInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_8__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony import */ var _followCameraPointersInput__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./followCameraPointersInput */ \"./Cameras/Inputs/followCameraPointersInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _followCameraPointersInput__WEBPACK_IMPORTED_MODULE_9__[\"FollowCameraPointersInput\"]; });\n\n/* harmony import */ var _freeCameraDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./freeCameraDeviceOrientationInput */ \"./Cameras/Inputs/freeCameraDeviceOrientationInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _freeCameraDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_10__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony import */ var _freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./freeCameraGamepadInput */ \"./Cameras/Inputs/freeCameraGamepadInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_11__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony import */ var _freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./freeCameraKeyboardMoveInput */ \"./Cameras/Inputs/freeCameraKeyboardMoveInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_12__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony import */ var _freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./freeCameraMouseInput */ \"./Cameras/Inputs/freeCameraMouseInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_13__[\"FreeCameraMouseInput\"]; });\n\n/* harmony import */ var _freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./freeCameraTouchInput */ \"./Cameras/Inputs/freeCameraTouchInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_14__[\"FreeCameraTouchInput\"]; });\n\n/* harmony import */ var _freeCameraVirtualJoystickInput__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./freeCameraVirtualJoystickInput */ \"./Cameras/Inputs/freeCameraVirtualJoystickInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _freeCameraVirtualJoystickInput__WEBPACK_IMPORTED_MODULE_15__[\"FreeCameraVirtualJoystickInput\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts ***!\n \\*********************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../PostProcesses/anaglyphPostProcess */ \"./PostProcesses/anaglyphPostProcess.ts\");\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setStereoscopicAnaglyphRigMode = function (camera) {\r\n camera._rigCameras[0]._rigPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__[\"PassPostProcess\"](camera.name + \"_passthru\", 1.0, camera._rigCameras[0]);\r\n camera._rigCameras[1]._rigPostProcess = new _PostProcesses_anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"AnaglyphPostProcess\"](camera.name + \"_anaglyph\", 1.0, camera._rigCameras);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/stereoscopicRigMode.ts\":\n/*!*************************************************!*\\\n !*** ./Cameras/RigModes/stereoscopicRigMode.ts ***!\n \\*************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../PostProcesses/stereoscopicInterlacePostProcess */ \"./PostProcesses/stereoscopicInterlacePostProcess.ts\");\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setStereoscopicRigMode = function (camera) {\r\n var isStereoscopicHoriz = camera.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL || camera.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;\r\n camera._rigCameras[0]._rigPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__[\"PassPostProcess\"](camera.name + \"_passthru\", 1.0, camera._rigCameras[0]);\r\n camera._rigCameras[1]._rigPostProcess = new _PostProcesses_stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_2__[\"StereoscopicInterlacePostProcess\"](camera.name + \"_stereoInterlace\", camera._rigCameras, isStereoscopicHoriz);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/vrRigMode.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/RigModes/vrRigMode.ts ***!\n \\***************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _PostProcesses_vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../PostProcesses/vrDistortionCorrectionPostProcess */ \"./PostProcesses/vrDistortionCorrectionPostProcess.ts\");\n/* harmony import */ var _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../PostProcesses/vrMultiviewToSingleviewPostProcess */ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\");\n/* harmony import */ var _VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../VR/vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setVRRigMode = function (camera, rigParams) {\r\n var metrics = rigParams.vrCameraMetrics || _VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_4__[\"VRCameraMetrics\"].GetDefault();\r\n camera._rigCameras[0]._cameraRigParams.vrMetrics = metrics;\r\n camera._rigCameras[0].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_6__[\"Viewport\"](0, 0, 0.5, 1.0);\r\n camera._rigCameras[0]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[0]._cameraRigParams.vrHMatrix = metrics.leftHMatrix;\r\n camera._rigCameras[0]._cameraRigParams.vrPreViewMatrix = metrics.leftPreViewMatrix;\r\n camera._rigCameras[0].getProjectionMatrix = camera._rigCameras[0]._getVRProjectionMatrix;\r\n camera._rigCameras[1]._cameraRigParams.vrMetrics = metrics;\r\n camera._rigCameras[1].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_6__[\"Viewport\"](0.5, 0, 0.5, 1.0);\r\n camera._rigCameras[1]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[1]._cameraRigParams.vrHMatrix = metrics.rightHMatrix;\r\n camera._rigCameras[1]._cameraRigParams.vrPreViewMatrix = metrics.rightPreViewMatrix;\r\n camera._rigCameras[1].getProjectionMatrix = camera._rigCameras[1]._getVRProjectionMatrix;\r\n // For multiview on a webVR camera\r\n // First multiview will be rendered to camera._multiviewTexture\r\n // Then this postprocess will run on each eye to copy the right texture to each eye\r\n if (metrics.multiviewEnabled) {\r\n if (!camera.getScene().getEngine().getCaps().multiview) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Warn(\"Multiview is not supported, falling back to standard rendering\");\r\n metrics.multiviewEnabled = false;\r\n }\r\n else {\r\n camera._useMultiviewToSingleView = true;\r\n camera._rigPostProcess = new _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_3__[\"VRMultiviewToSingleviewPostProcess\"](\"VRMultiviewToSingleview\", camera, metrics.postProcessScaleFactor);\r\n }\r\n }\r\n if (metrics.compensateDistortion) {\r\n camera._rigCameras[0]._rigPostProcess = new _PostProcesses_vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"VRDistortionCorrectionPostProcess\"](\"VR_Distort_Compensation_Left\", camera._rigCameras[0], false, metrics);\r\n camera._rigCameras[1]._rigPostProcess = new _PostProcesses_vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"VRDistortionCorrectionPostProcess\"](\"VR_Distort_Compensation_Right\", camera._rigCameras[1], true, metrics);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/webVRRigMode.ts\":\n/*!******************************************!*\\\n !*** ./Cameras/RigModes/webVRRigMode.ts ***!\n \\******************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setWebVRRigMode = function (camera, rigParams) {\r\n if (rigParams.vrDisplay) {\r\n var leftEye = rigParams.vrDisplay.getEyeParameters('left');\r\n var rightEye = rigParams.vrDisplay.getEyeParameters('right');\r\n //Left eye\r\n camera._rigCameras[0].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_2__[\"Viewport\"](0, 0, 0.5, 1.0);\r\n camera._rigCameras[0].setCameraRigParameter(\"left\", true);\r\n //leaving this for future reference\r\n camera._rigCameras[0].setCameraRigParameter(\"specs\", rigParams.specs);\r\n camera._rigCameras[0].setCameraRigParameter(\"eyeParameters\", leftEye);\r\n camera._rigCameras[0].setCameraRigParameter(\"frameData\", rigParams.frameData);\r\n camera._rigCameras[0].setCameraRigParameter(\"parentCamera\", rigParams.parentCamera);\r\n camera._rigCameras[0]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[0].getProjectionMatrix = camera._getWebVRProjectionMatrix;\r\n camera._rigCameras[0].parent = camera;\r\n camera._rigCameras[0]._getViewMatrix = camera._getWebVRViewMatrix;\r\n //Right eye\r\n camera._rigCameras[1].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_2__[\"Viewport\"](0.5, 0, 0.5, 1.0);\r\n camera._rigCameras[1].setCameraRigParameter('eyeParameters', rightEye);\r\n camera._rigCameras[1].setCameraRigParameter(\"specs\", rigParams.specs);\r\n camera._rigCameras[1].setCameraRigParameter(\"frameData\", rigParams.frameData);\r\n camera._rigCameras[1].setCameraRigParameter(\"parentCamera\", rigParams.parentCamera);\r\n camera._rigCameras[1]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[1].getProjectionMatrix = camera._getWebVRProjectionMatrix;\r\n camera._rigCameras[1].parent = camera;\r\n camera._rigCameras[1]._getViewMatrix = camera._getWebVRViewMatrix;\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphArcRotateCamera.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphArcRotateCamera.ts ***!\n \\*********************************************************/\n/*! exports provided: AnaglyphArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return AnaglyphArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphArcRotateCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on ArcRotateCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphArcRotateCamera, _super);\r\n /**\r\n * Creates a new AnaglyphArcRotateCamera\r\n * @param name defines camera name\r\n * @param alpha defines alpha angle (in radians)\r\n * @param beta defines beta angle (in radians)\r\n * @param radius defines radius\r\n * @param target defines camera target\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphArcRotateCamera(name, alpha, beta, radius, target, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, alpha, beta, radius, target, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphArcRotateCamera\r\n */\r\n AnaglyphArcRotateCamera.prototype.getClassName = function () {\r\n return \"AnaglyphArcRotateCamera\";\r\n };\r\n return AnaglyphArcRotateCamera;\r\n}(_Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphFreeCamera.ts\":\n/*!****************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphFreeCamera.ts ***!\n \\****************************************************/\n/*! exports provided: AnaglyphFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return AnaglyphFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphFreeCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on FreeCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphFreeCamera, _super);\r\n /**\r\n * Creates a new AnaglyphFreeCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphFreeCamera(name, position, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphFreeCamera\r\n */\r\n AnaglyphFreeCamera.prototype.getClassName = function () {\r\n return \"AnaglyphFreeCamera\";\r\n };\r\n return AnaglyphFreeCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphGamepadCamera.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphGamepadCamera.ts ***!\n \\*******************************************************/\n/*! exports provided: AnaglyphGamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return AnaglyphGamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/gamepadCamera */ \"./Cameras/gamepadCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphGamepadCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphGamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on GamepadCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphGamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphGamepadCamera, _super);\r\n /**\r\n * Creates a new AnaglyphGamepadCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphGamepadCamera(name, position, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphGamepadCamera\r\n */\r\n AnaglyphGamepadCamera.prototype.getClassName = function () {\r\n return \"AnaglyphGamepadCamera\";\r\n };\r\n return AnaglyphGamepadCamera;\r\n}(_Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__[\"GamepadCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphUniversalCamera.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphUniversalCamera.ts ***!\n \\*********************************************************/\n/*! exports provided: AnaglyphUniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return AnaglyphUniversalCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphUniversalCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphUniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on UniversalCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphUniversalCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphUniversalCamera, _super);\r\n /**\r\n * Creates a new AnaglyphUniversalCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphUniversalCamera(name, position, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphUniversalCamera\r\n */\r\n AnaglyphUniversalCamera.prototype.getClassName = function () {\r\n return \"AnaglyphUniversalCamera\";\r\n };\r\n return AnaglyphUniversalCamera;\r\n}(_Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__[\"UniversalCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/index.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/Stereoscopic/index.ts ***!\n \\***************************************/\n/*! exports provided: AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _anaglyphArcRotateCamera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./anaglyphArcRotateCamera */ \"./Cameras/Stereoscopic/anaglyphArcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _anaglyphArcRotateCamera__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony import */ var _anaglyphFreeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./anaglyphFreeCamera */ \"./Cameras/Stereoscopic/anaglyphFreeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _anaglyphFreeCamera__WEBPACK_IMPORTED_MODULE_1__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony import */ var _anaglyphGamepadCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./anaglyphGamepadCamera */ \"./Cameras/Stereoscopic/anaglyphGamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _anaglyphGamepadCamera__WEBPACK_IMPORTED_MODULE_2__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony import */ var _anaglyphUniversalCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./anaglyphUniversalCamera */ \"./Cameras/Stereoscopic/anaglyphUniversalCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _anaglyphUniversalCamera__WEBPACK_IMPORTED_MODULE_3__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony import */ var _stereoscopicArcRotateCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stereoscopicArcRotateCamera */ \"./Cameras/Stereoscopic/stereoscopicArcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _stereoscopicArcRotateCamera__WEBPACK_IMPORTED_MODULE_4__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony import */ var _stereoscopicFreeCamera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stereoscopicFreeCamera */ \"./Cameras/Stereoscopic/stereoscopicFreeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _stereoscopicFreeCamera__WEBPACK_IMPORTED_MODULE_5__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony import */ var _stereoscopicGamepadCamera__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stereoscopicGamepadCamera */ \"./Cameras/Stereoscopic/stereoscopicGamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _stereoscopicGamepadCamera__WEBPACK_IMPORTED_MODULE_6__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony import */ var _stereoscopicUniversalCamera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stereoscopicUniversalCamera */ \"./Cameras/Stereoscopic/stereoscopicUniversalCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _stereoscopicUniversalCamera__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicUniversalCamera\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicArcRotateCamera.ts\":\n/*!*************************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicArcRotateCamera.ts ***!\n \\*************************************************************/\n/*! exports provided: StereoscopicArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return StereoscopicArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicArcRotateCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on ArcRotateCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicArcRotateCamera, _super);\r\n /**\r\n * Creates a new StereoscopicArcRotateCamera\r\n * @param name defines camera name\r\n * @param alpha defines alpha angle (in radians)\r\n * @param beta defines beta angle (in radians)\r\n * @param radius defines radius\r\n * @param target defines camera target\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicArcRotateCamera(name, alpha, beta, radius, target, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, alpha, beta, radius, target, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicArcRotateCamera\r\n */\r\n StereoscopicArcRotateCamera.prototype.getClassName = function () {\r\n return \"StereoscopicArcRotateCamera\";\r\n };\r\n return StereoscopicArcRotateCamera;\r\n}(_Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicFreeCamera.ts\":\n/*!********************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicFreeCamera.ts ***!\n \\********************************************************/\n/*! exports provided: StereoscopicFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return StereoscopicFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicFreeCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on FreeCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicFreeCamera, _super);\r\n /**\r\n * Creates a new StereoscopicFreeCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicFreeCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicFreeCamera\r\n */\r\n StereoscopicFreeCamera.prototype.getClassName = function () {\r\n return \"StereoscopicFreeCamera\";\r\n };\r\n return StereoscopicFreeCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicGamepadCamera.ts\":\n/*!***********************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicGamepadCamera.ts ***!\n \\***********************************************************/\n/*! exports provided: StereoscopicGamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return StereoscopicGamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/gamepadCamera */ \"./Cameras/gamepadCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicGamepadCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicGamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on GamepadCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicGamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicGamepadCamera, _super);\r\n /**\r\n * Creates a new StereoscopicGamepadCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicGamepadCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicGamepadCamera\r\n */\r\n StereoscopicGamepadCamera.prototype.getClassName = function () {\r\n return \"StereoscopicGamepadCamera\";\r\n };\r\n return StereoscopicGamepadCamera;\r\n}(_Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__[\"GamepadCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicUniversalCamera.ts\":\n/*!*************************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicUniversalCamera.ts ***!\n \\*************************************************************/\n/*! exports provided: StereoscopicUniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return StereoscopicUniversalCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicFreeCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicUniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on UniversalCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicUniversalCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicUniversalCamera, _super);\r\n /**\r\n * Creates a new StereoscopicUniversalCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicUniversalCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicUniversalCamera\r\n */\r\n StereoscopicUniversalCamera.prototype.getClassName = function () {\r\n return \"StereoscopicUniversalCamera\";\r\n };\r\n return StereoscopicUniversalCamera;\r\n}(_Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__[\"UniversalCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/index.ts\":\n/*!*****************************!*\\\n !*** ./Cameras/VR/index.ts ***!\n \\*****************************/\n/*! exports provided: VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_0__[\"VRCameraMetrics\"]; });\n\n/* harmony import */ var _vrDeviceOrientationArcRotateCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vrDeviceOrientationArcRotateCamera */ \"./Cameras/VR/vrDeviceOrientationArcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _vrDeviceOrientationArcRotateCamera__WEBPACK_IMPORTED_MODULE_1__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony import */ var _vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vrDeviceOrientationFreeCamera */ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_2__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony import */ var _vrDeviceOrientationGamepadCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vrDeviceOrientationGamepadCamera */ \"./Cameras/VR/vrDeviceOrientationGamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _vrDeviceOrientationGamepadCamera__WEBPACK_IMPORTED_MODULE_3__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony import */ var _vrExperienceHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./vrExperienceHelper */ \"./Cameras/VR/vrExperienceHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _vrExperienceHelper__WEBPACK_IMPORTED_MODULE_4__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _vrExperienceHelper__WEBPACK_IMPORTED_MODULE_4__[\"VRExperienceHelper\"]; });\n\n/* harmony import */ var _webVRCamera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webVRCamera */ \"./Cameras/VR/webVRCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _webVRCamera__WEBPACK_IMPORTED_MODULE_5__[\"WebVRFreeCamera\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrCameraMetrics.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/VR/vrCameraMetrics.ts ***!\n \\***************************************/\n/*! exports provided: VRCameraMetrics */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return VRCameraMetrics; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * This represents all the required metrics to create a VR camera.\r\n * @see http://doc.babylonjs.com/babylon101/cameras#device-orientation-camera\r\n */\r\nvar VRCameraMetrics = /** @class */ (function () {\r\n function VRCameraMetrics() {\r\n /**\r\n * Define if the current vr camera should compensate the distortion of the lense or not.\r\n */\r\n this.compensateDistortion = true;\r\n /**\r\n * Defines if multiview should be enabled when rendering (Default: false)\r\n */\r\n this.multiviewEnabled = false;\r\n }\r\n Object.defineProperty(VRCameraMetrics.prototype, \"aspectRatio\", {\r\n /**\r\n * Gets the rendering aspect ratio based on the provided resolutions.\r\n */\r\n get: function () {\r\n return this.hResolution / (2 * this.vResolution);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"aspectRatioFov\", {\r\n /**\r\n * Gets the aspect ratio based on the FOV, scale factors, and real screen sizes.\r\n */\r\n get: function () {\r\n return (2 * Math.atan((this.postProcessScaleFactor * this.vScreenSize) / (2 * this.eyeToScreenDistance)));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"leftHMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);\r\n var h = (4 * meters) / this.hScreenSize;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(h, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"rightHMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);\r\n var h = (4 * meters) / this.hScreenSize;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(-h, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"leftPreViewMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(0.5 * this.interpupillaryDistance, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"rightPreViewMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(-0.5 * this.interpupillaryDistance, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the default VRMetrics based on the most generic setup.\r\n * @returns the default vr metrics\r\n */\r\n VRCameraMetrics.GetDefault = function () {\r\n var result = new VRCameraMetrics();\r\n result.hResolution = 1280;\r\n result.vResolution = 800;\r\n result.hScreenSize = 0.149759993;\r\n result.vScreenSize = 0.0935999975;\r\n result.vScreenCenter = 0.0467999987;\r\n result.eyeToScreenDistance = 0.0410000011;\r\n result.lensSeparationDistance = 0.0635000020;\r\n result.interpupillaryDistance = 0.0640000030;\r\n result.distortionK = [1.0, 0.219999999, 0.239999995, 0.0];\r\n result.chromaAbCorrection = [0.995999992, -0.00400000019, 1.01400006, 0.0];\r\n result.postProcessScaleFactor = 1.714605507808412;\r\n result.lensCenterOffset = 0.151976421;\r\n return result;\r\n };\r\n return VRCameraMetrics;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrDeviceOrientationArcRotateCamera.ts\":\n/*!**********************************************************!*\\\n !*** ./Cameras/VR/vrDeviceOrientationArcRotateCamera.ts ***!\n \\**********************************************************/\n/*! exports provided: VRDeviceOrientationArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return VRDeviceOrientationArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _Inputs_arcRotateCameraVRDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Inputs/arcRotateCameraVRDeviceOrientationInput */ \"./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts\");\n/* harmony import */ var _RigModes_vrRigMode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../RigModes/vrRigMode */ \"./Cameras/RigModes/vrRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"VRDeviceOrientationFreeCamera\", function (name, scene) {\r\n return function () { return new VRDeviceOrientationArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * Camera used to simulate VR rendering (based on ArcRotateCamera)\r\n * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras\r\n */\r\nvar VRDeviceOrientationArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDeviceOrientationArcRotateCamera, _super);\r\n /**\r\n * Creates a new VRDeviceOrientationArcRotateCamera\r\n * @param name defines camera name\r\n * @param alpha defines the camera rotation along the logitudinal axis\r\n * @param beta defines the camera rotation along the latitudinal axis\r\n * @param radius defines the camera distance from its target\r\n * @param target defines the camera target\r\n * @param scene defines the scene the camera belongs to\r\n * @param compensateDistortion defines if the camera needs to compensate the lens distorsion\r\n * @param vrCameraMetrics defines the vr metrics associated to the camera\r\n */\r\n function VRDeviceOrientationArcRotateCamera(name, alpha, beta, radius, target, scene, compensateDistortion, vrCameraMetrics) {\r\n if (compensateDistortion === void 0) { compensateDistortion = true; }\r\n if (vrCameraMetrics === void 0) { vrCameraMetrics = _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__[\"VRCameraMetrics\"].GetDefault(); }\r\n var _this = _super.call(this, name, alpha, beta, radius, target, scene) || this;\r\n vrCameraMetrics.compensateDistortion = compensateDistortion;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });\r\n _this.inputs.addVRDeviceOrientation();\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns VRDeviceOrientationArcRotateCamera\r\n */\r\n VRDeviceOrientationArcRotateCamera.prototype.getClassName = function () {\r\n return \"VRDeviceOrientationArcRotateCamera\";\r\n };\r\n return VRDeviceOrientationArcRotateCamera;\r\n}(_Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\":\n/*!*****************************************************!*\\\n !*** ./Cameras/VR/vrDeviceOrientationFreeCamera.ts ***!\n \\*****************************************************/\n/*! exports provided: VRDeviceOrientationFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return VRDeviceOrientationFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/deviceOrientationCamera */ \"./Cameras/deviceOrientationCamera.ts\");\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_vrRigMode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../RigModes/vrRigMode */ \"./Cameras/RigModes/vrRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"VRDeviceOrientationFreeCamera\", function (name, scene) {\r\n return function () { return new VRDeviceOrientationFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * Camera used to simulate VR rendering (based on FreeCamera)\r\n * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras\r\n */\r\nvar VRDeviceOrientationFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDeviceOrientationFreeCamera, _super);\r\n /**\r\n * Creates a new VRDeviceOrientationFreeCamera\r\n * @param name defines camera name\r\n * @param position defines the start position of the camera\r\n * @param scene defines the scene the camera belongs to\r\n * @param compensateDistortion defines if the camera needs to compensate the lens distorsion\r\n * @param vrCameraMetrics defines the vr metrics associated to the camera\r\n */\r\n function VRDeviceOrientationFreeCamera(name, position, scene, compensateDistortion, vrCameraMetrics) {\r\n if (compensateDistortion === void 0) { compensateDistortion = true; }\r\n if (vrCameraMetrics === void 0) { vrCameraMetrics = _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__[\"VRCameraMetrics\"].GetDefault(); }\r\n var _this = _super.call(this, name, position, scene) || this;\r\n vrCameraMetrics.compensateDistortion = compensateDistortion;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns VRDeviceOrientationFreeCamera\r\n */\r\n VRDeviceOrientationFreeCamera.prototype.getClassName = function () {\r\n return \"VRDeviceOrientationFreeCamera\";\r\n };\r\n return VRDeviceOrientationFreeCamera;\r\n}(_Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_2__[\"DeviceOrientationCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrDeviceOrientationGamepadCamera.ts\":\n/*!********************************************************!*\\\n !*** ./Cameras/VR/vrDeviceOrientationGamepadCamera.ts ***!\n \\********************************************************/\n/*! exports provided: VRDeviceOrientationGamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return VRDeviceOrientationGamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vrDeviceOrientationFreeCamera */ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\");\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _Gamepads_gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Gamepads/gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"VRDeviceOrientationGamepadCamera\", function (name, scene) {\r\n return function () { return new VRDeviceOrientationGamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * Camera used to simulate VR rendering (based on VRDeviceOrientationFreeCamera)\r\n * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras\r\n */\r\nvar VRDeviceOrientationGamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDeviceOrientationGamepadCamera, _super);\r\n /**\r\n * Creates a new VRDeviceOrientationGamepadCamera\r\n * @param name defines camera name\r\n * @param position defines the start position of the camera\r\n * @param scene defines the scene the camera belongs to\r\n * @param compensateDistortion defines if the camera needs to compensate the lens distorsion\r\n * @param vrCameraMetrics defines the vr metrics associated to the camera\r\n */\r\n function VRDeviceOrientationGamepadCamera(name, position, scene, compensateDistortion, vrCameraMetrics) {\r\n if (compensateDistortion === void 0) { compensateDistortion = true; }\r\n if (vrCameraMetrics === void 0) { vrCameraMetrics = _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_2__[\"VRCameraMetrics\"].GetDefault(); }\r\n var _this = _super.call(this, name, position, scene, compensateDistortion, vrCameraMetrics) || this;\r\n _this.inputs.addGamepad();\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns VRDeviceOrientationGamepadCamera\r\n */\r\n VRDeviceOrientationGamepadCamera.prototype.getClassName = function () {\r\n return \"VRDeviceOrientationGamepadCamera\";\r\n };\r\n return VRDeviceOrientationGamepadCamera;\r\n}(_vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_1__[\"VRDeviceOrientationFreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrExperienceHelper.ts\":\n/*!******************************************!*\\\n !*** ./Cameras/VR/vrExperienceHelper.ts ***!\n \\******************************************/\n/*! exports provided: OnAfterEnteringVRObservableEvent, VRExperienceHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return OnAfterEnteringVRObservableEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return VRExperienceHelper; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Cameras/targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Cameras/deviceOrientationCamera */ \"./Cameras/deviceOrientationCamera.ts\");\n/* harmony import */ var _Cameras_VR_vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Cameras/VR/vrDeviceOrientationFreeCamera */ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\");\n/* harmony import */ var _Cameras_VR_webVRCamera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Cameras/VR/webVRCamera */ \"./Cameras/VR/webVRCamera.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony import */ var _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Gamepads/Controllers/poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _Gamepads_Controllers_webVRController__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Gamepads/Controllers/webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _Gamepads_xboxGamepad__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Gamepads/xboxGamepad */ \"./Gamepads/xboxGamepad.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../PostProcesses/imageProcessingPostProcess */ \"./PostProcesses/imageProcessingPostProcess.ts\");\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Cameras_VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../Cameras/VR/vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Meshes_Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../Meshes/Builders/groundBuilder */ \"./Meshes/Builders/groundBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_torusBuilder__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../Meshes/Builders/torusBuilder */ \"./Meshes/Builders/torusBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Gamepads_gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../../Gamepads/gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n/* harmony import */ var _Animations_animatable__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../../Animations/animatable */ \"./Animations/animatable.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar VRExperienceHelperGazer = /** @class */ (function () {\r\n function VRExperienceHelperGazer(scene, gazeTrackerToClone) {\r\n if (gazeTrackerToClone === void 0) { gazeTrackerToClone = null; }\r\n this.scene = scene;\r\n /** @hidden */\r\n this._pointerDownOnMeshAsked = false;\r\n /** @hidden */\r\n this._isActionableMesh = false;\r\n /** @hidden */\r\n this._teleportationRequestInitiated = false;\r\n /** @hidden */\r\n this._teleportationBackRequestInitiated = false;\r\n /** @hidden */\r\n this._rotationRightAsked = false;\r\n /** @hidden */\r\n this._rotationLeftAsked = false;\r\n /** @hidden */\r\n this._dpadPressed = true;\r\n /** @hidden */\r\n this._activePointer = false;\r\n this._id = VRExperienceHelperGazer._idCounter++;\r\n // Gaze tracker\r\n if (!gazeTrackerToClone) {\r\n this._gazeTracker = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateTorus(\"gazeTracker\", 0.0035, 0.0025, 20, scene, false);\r\n this._gazeTracker.bakeCurrentTransformIntoVertices();\r\n this._gazeTracker.isPickable = false;\r\n this._gazeTracker.isVisible = false;\r\n var targetMat = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__[\"StandardMaterial\"](\"targetMat\", scene);\r\n targetMat.specularColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"].Black();\r\n targetMat.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7);\r\n targetMat.backFaceCulling = false;\r\n this._gazeTracker.material = targetMat;\r\n }\r\n else {\r\n this._gazeTracker = gazeTrackerToClone.clone(\"gazeTracker\");\r\n }\r\n }\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._getForwardRay = function (length) {\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_16__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Zero(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, 0, length));\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._selectionPointerDown = function () {\r\n this._pointerDownOnMeshAsked = true;\r\n if (this._currentHit) {\r\n this.scene.simulatePointerDown(this._currentHit, { pointerId: this._id });\r\n }\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._selectionPointerUp = function () {\r\n if (this._currentHit) {\r\n this.scene.simulatePointerUp(this._currentHit, { pointerId: this._id });\r\n }\r\n this._pointerDownOnMeshAsked = false;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._activatePointer = function () {\r\n this._activePointer = true;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._deactivatePointer = function () {\r\n this._activePointer = false;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._updatePointerDistance = function (distance) {\r\n if (distance === void 0) { distance = 100; }\r\n };\r\n VRExperienceHelperGazer.prototype.dispose = function () {\r\n this._interactionsEnabled = false;\r\n this._teleportationEnabled = false;\r\n if (this._gazeTracker) {\r\n this._gazeTracker.dispose();\r\n }\r\n };\r\n VRExperienceHelperGazer._idCounter = 0;\r\n return VRExperienceHelperGazer;\r\n}());\r\nvar VRExperienceHelperControllerGazer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRExperienceHelperControllerGazer, _super);\r\n function VRExperienceHelperControllerGazer(webVRController, scene, gazeTrackerToClone) {\r\n var _this = _super.call(this, scene, gazeTrackerToClone) || this;\r\n _this.webVRController = webVRController;\r\n // Laser pointer\r\n _this._laserPointer = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateCylinder(\"laserPointer\", 1, 0.004, 0.0002, 20, 1, scene, false);\r\n var laserPointerMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__[\"StandardMaterial\"](\"laserPointerMat\", scene);\r\n laserPointerMaterial.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7);\r\n laserPointerMaterial.alpha = 0.6;\r\n _this._laserPointer.material = laserPointerMaterial;\r\n _this._laserPointer.rotation.x = Math.PI / 2;\r\n _this._laserPointer.position.z = -0.5;\r\n _this._laserPointer.isVisible = false;\r\n _this._laserPointer.isPickable = false;\r\n if (!webVRController.mesh) {\r\n // Create an empty mesh that is used prior to loading the high quality model\r\n var preloadMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"](\"preloadControllerMesh\", scene);\r\n var preloadPointerPose = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"](_Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__[\"PoseEnabledController\"].POINTING_POSE, scene);\r\n preloadPointerPose.rotation.x = -0.7;\r\n preloadMesh.addChild(preloadPointerPose);\r\n webVRController.attachToMesh(preloadMesh);\r\n }\r\n _this._setLaserPointerParent(webVRController.mesh);\r\n _this._meshAttachedObserver = webVRController._meshAttachedObservable.add(function (mesh) {\r\n _this._setLaserPointerParent(mesh);\r\n });\r\n return _this;\r\n }\r\n VRExperienceHelperControllerGazer.prototype._getForwardRay = function (length) {\r\n return this.webVRController.getForwardRay(length);\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._activatePointer = function () {\r\n _super.prototype._activatePointer.call(this);\r\n this._laserPointer.isVisible = true;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._deactivatePointer = function () {\r\n _super.prototype._deactivatePointer.call(this);\r\n this._laserPointer.isVisible = false;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._setLaserPointerColor = function (color) {\r\n this._laserPointer.material.emissiveColor = color;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._setLaserPointerParent = function (mesh) {\r\n var makeNotPick = function (root) {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach(function (c) {\r\n makeNotPick(c);\r\n });\r\n };\r\n makeNotPick(mesh);\r\n var meshChildren = mesh.getChildren(undefined, false);\r\n var laserParent = mesh;\r\n this.webVRController._pointingPoseNode = null;\r\n for (var i = 0; i < meshChildren.length; i++) {\r\n if (meshChildren[i].name && meshChildren[i].name.indexOf(_Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__[\"PoseEnabledController\"].POINTING_POSE) >= 0) {\r\n laserParent = meshChildren[i];\r\n this.webVRController._pointingPoseNode = laserParent;\r\n break;\r\n }\r\n }\r\n this._laserPointer.parent = laserParent;\r\n };\r\n VRExperienceHelperControllerGazer.prototype._updatePointerDistance = function (distance) {\r\n if (distance === void 0) { distance = 100; }\r\n this._laserPointer.scaling.y = distance;\r\n this._laserPointer.position.z = -distance / 2;\r\n };\r\n VRExperienceHelperControllerGazer.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this._laserPointer.dispose();\r\n if (this._meshAttachedObserver) {\r\n this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver);\r\n }\r\n };\r\n return VRExperienceHelperControllerGazer;\r\n}(VRExperienceHelperGazer));\r\nvar VRExperienceHelperCameraGazer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRExperienceHelperCameraGazer, _super);\r\n function VRExperienceHelperCameraGazer(getCamera, scene) {\r\n var _this = _super.call(this, scene) || this;\r\n _this.getCamera = getCamera;\r\n return _this;\r\n }\r\n VRExperienceHelperCameraGazer.prototype._getForwardRay = function (length) {\r\n var camera = this.getCamera();\r\n if (camera) {\r\n return camera.getForwardRay(length);\r\n }\r\n else {\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_16__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Forward());\r\n }\r\n };\r\n return VRExperienceHelperCameraGazer;\r\n}(VRExperienceHelperGazer));\r\n/**\r\n * Event containing information after VR has been entered\r\n */\r\nvar OnAfterEnteringVRObservableEvent = /** @class */ (function () {\r\n function OnAfterEnteringVRObservableEvent() {\r\n }\r\n return OnAfterEnteringVRObservableEvent;\r\n}());\r\n\r\n/**\r\n * Helps to quickly add VR support to an existing scene.\r\n * See http://doc.babylonjs.com/how_to/webvr_helper\r\n */\r\nvar VRExperienceHelper = /** @class */ (function () {\r\n /**\r\n * Instantiates a VRExperienceHelper.\r\n * Helps to quickly add VR support to an existing scene.\r\n * @param scene The scene the VRExperienceHelper belongs to.\r\n * @param webVROptions Options to modify the vr experience helper's behavior.\r\n */\r\n function VRExperienceHelper(scene, \r\n /** Options to modify the vr experience helper's behavior. */\r\n webVROptions) {\r\n var _this = this;\r\n if (webVROptions === void 0) { webVROptions = {}; }\r\n this.webVROptions = webVROptions;\r\n // Can the system support WebVR, even if a headset isn't plugged in?\r\n this._webVRsupported = false;\r\n // If WebVR is supported, is a headset plugged in and are we ready to present?\r\n this._webVRready = false;\r\n // Are we waiting for the requestPresent callback to complete?\r\n this._webVRrequesting = false;\r\n // Are we presenting to the headset right now? (this is the vrDevice state)\r\n this._webVRpresenting = false;\r\n // Are we presenting in the fullscreen fallback?\r\n this._fullscreenVRpresenting = false;\r\n /**\r\n * Gets or sets a boolean indicating that gaze can be enabled even if pointer lock is not engage (useful on iOS where fullscreen mode and pointer lock are not supported)\r\n */\r\n this.enableGazeEvenWhenNoPointerLock = false;\r\n /**\r\n * Gets or sets a boolean indicating that the VREXperienceHelper will exit VR if double tap is detected\r\n */\r\n this.exitVROnDoubleTap = true;\r\n /**\r\n * Observable raised right before entering VR.\r\n */\r\n this.onEnteringVRObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when entering VR has completed.\r\n */\r\n this.onAfterEnteringVRObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when exiting VR.\r\n */\r\n this.onExitingVRObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when controller mesh is loaded.\r\n */\r\n this.onControllerMeshLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this._useCustomVRButton = false;\r\n this._teleportationRequested = false;\r\n this._teleportActive = false;\r\n this._floorMeshesCollection = [];\r\n this._rotationAllowed = true;\r\n this._teleportBackwardsVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, -1, -1);\r\n this._isDefaultTeleportationTarget = true;\r\n this._teleportationFillColor = \"#444444\";\r\n this._teleportationBorderColor = \"#FFFFFF\";\r\n this._rotationAngle = 0;\r\n this._haloCenter = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, 0, 0);\r\n this._padSensibilityUp = 0.65;\r\n this._padSensibilityDown = 0.35;\r\n this._leftController = null;\r\n this._rightController = null;\r\n /**\r\n * Observable raised when a new mesh is selected based on meshSelectionPredicate\r\n */\r\n this.onNewMeshSelected = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when a new mesh is selected based on meshSelectionPredicate.\r\n * This observable will provide the mesh and the controller used to select the mesh\r\n */\r\n this.onMeshSelectedWithController = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when a new mesh is picked based on meshSelectionPredicate\r\n */\r\n this.onNewMeshPicked = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised before camera teleportation\r\n */\r\n this.onBeforeCameraTeleport = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised after camera teleportation\r\n */\r\n this.onAfterCameraTeleport = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when current selected mesh gets unselected\r\n */\r\n this.onSelectedMeshUnselected = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Set teleportation enabled. If set to false camera teleportation will be disabled but camera rotation will be kept.\r\n */\r\n this.teleportationEnabled = true;\r\n this._teleportationInitialized = false;\r\n this._interactionsEnabled = false;\r\n this._interactionsRequested = false;\r\n this._displayGaze = true;\r\n this._displayLaserPointer = true;\r\n /**\r\n * If the gaze trackers scale should be updated to be constant size when pointing at near/far meshes\r\n */\r\n this.updateGazeTrackerScale = true;\r\n /**\r\n * If the gaze trackers color should be updated when selecting meshes\r\n */\r\n this.updateGazeTrackerColor = true;\r\n /**\r\n * If the controller laser color should be updated when selecting meshes\r\n */\r\n this.updateControllerLaserColor = true;\r\n /**\r\n * Defines wether or not Pointer lock should be requested when switching to\r\n * full screen.\r\n */\r\n this.requestPointerLockOnFullScreen = true;\r\n this._onResize = function () {\r\n _this.moveButtonToBottomRight();\r\n if (_this._fullscreenVRpresenting && _this._webVRready) {\r\n _this.exitVR();\r\n }\r\n };\r\n this._onFullscreenChange = function () {\r\n var anyDoc = document;\r\n if (anyDoc.fullscreen !== undefined) {\r\n _this._fullscreenVRpresenting = document.fullscreen;\r\n }\r\n else if (anyDoc.mozFullScreen !== undefined) {\r\n _this._fullscreenVRpresenting = anyDoc.mozFullScreen;\r\n }\r\n else if (anyDoc.webkitIsFullScreen !== undefined) {\r\n _this._fullscreenVRpresenting = anyDoc.webkitIsFullScreen;\r\n }\r\n else if (anyDoc.msIsFullScreen !== undefined) {\r\n _this._fullscreenVRpresenting = anyDoc.msIsFullScreen;\r\n }\r\n else if (document.msFullscreenElement !== undefined) {\r\n _this._fullscreenVRpresenting = document.msFullscreenElement;\r\n }\r\n if (!_this._fullscreenVRpresenting && _this._canvas) {\r\n _this.exitVR();\r\n if (!_this._useCustomVRButton && _this._btnVR) {\r\n _this._btnVR.style.top = _this._canvas.offsetTop + _this._canvas.offsetHeight - 70 + \"px\";\r\n _this._btnVR.style.left = _this._canvas.offsetLeft + _this._canvas.offsetWidth - 100 + \"px\";\r\n }\r\n }\r\n };\r\n this._cachedAngularSensibility = { angularSensibilityX: null, angularSensibilityY: null, angularSensibility: null };\r\n this.beforeRender = function () {\r\n if (_this._leftController && _this._leftController._activePointer) {\r\n _this._castRayAndSelectObject(_this._leftController);\r\n }\r\n if (_this._rightController && _this._rightController._activePointer) {\r\n _this._castRayAndSelectObject(_this._rightController);\r\n }\r\n if (_this._noControllerIsActive && (_this._scene.getEngine().isPointerLock || _this.enableGazeEvenWhenNoPointerLock)) {\r\n _this._castRayAndSelectObject(_this._cameraGazer);\r\n }\r\n else {\r\n _this._cameraGazer._gazeTracker.isVisible = false;\r\n }\r\n };\r\n this._onNewGamepadConnected = function (gamepad) {\r\n if (gamepad.type !== _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_11__[\"Gamepad\"].POSE_ENABLED) {\r\n if (gamepad.leftStick) {\r\n gamepad.onleftstickchanged(function (stickValues) {\r\n if (_this._teleportationInitialized && _this.teleportationEnabled) {\r\n // Listening to classic/xbox gamepad only if no VR controller is active\r\n if ((!_this._leftController && !_this._rightController) ||\r\n ((_this._leftController && !_this._leftController._activePointer) &&\r\n (_this._rightController && !_this._rightController._activePointer))) {\r\n _this._checkTeleportWithRay(stickValues, _this._cameraGazer);\r\n _this._checkTeleportBackwards(stickValues, _this._cameraGazer);\r\n }\r\n }\r\n });\r\n }\r\n if (gamepad.rightStick) {\r\n gamepad.onrightstickchanged(function (stickValues) {\r\n if (_this._teleportationInitialized) {\r\n _this._checkRotate(stickValues, _this._cameraGazer);\r\n }\r\n });\r\n }\r\n if (gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_11__[\"Gamepad\"].XBOX) {\r\n gamepad.onbuttondown(function (buttonPressed) {\r\n if (_this._interactionsEnabled && buttonPressed === _Gamepads_xboxGamepad__WEBPACK_IMPORTED_MODULE_14__[\"Xbox360Button\"].A) {\r\n _this._cameraGazer._selectionPointerDown();\r\n }\r\n });\r\n gamepad.onbuttonup(function (buttonPressed) {\r\n if (_this._interactionsEnabled && buttonPressed === _Gamepads_xboxGamepad__WEBPACK_IMPORTED_MODULE_14__[\"Xbox360Button\"].A) {\r\n _this._cameraGazer._selectionPointerUp();\r\n }\r\n });\r\n }\r\n }\r\n else {\r\n var webVRController = gamepad;\r\n var controller = new VRExperienceHelperControllerGazer(webVRController, _this._scene, _this._cameraGazer._gazeTracker);\r\n if (webVRController.hand === \"right\" || (_this._leftController && _this._leftController.webVRController != webVRController)) {\r\n _this._rightController = controller;\r\n }\r\n else {\r\n _this._leftController = controller;\r\n }\r\n _this._tryEnableInteractionOnController(controller);\r\n }\r\n };\r\n // This only succeeds if the controller's mesh exists for the controller so this must be called whenever new controller is connected or when mesh is loaded\r\n this._tryEnableInteractionOnController = function (controller) {\r\n if (_this._interactionsRequested && !controller._interactionsEnabled) {\r\n _this._enableInteractionOnController(controller);\r\n }\r\n if (_this._teleportationRequested && !controller._teleportationEnabled) {\r\n _this._enableTeleportationOnController(controller);\r\n }\r\n };\r\n this._onNewGamepadDisconnected = function (gamepad) {\r\n if (gamepad instanceof _Gamepads_Controllers_webVRController__WEBPACK_IMPORTED_MODULE_13__[\"WebVRController\"]) {\r\n if (gamepad.hand === \"left\" && _this._leftController != null) {\r\n _this._leftController.dispose();\r\n _this._leftController = null;\r\n }\r\n if (gamepad.hand === \"right\" && _this._rightController != null) {\r\n _this._rightController.dispose();\r\n _this._rightController = null;\r\n }\r\n }\r\n };\r\n this._workingVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Zero();\r\n this._workingQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].Identity();\r\n this._workingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Matrix\"].Identity();\r\n this._scene = scene;\r\n this._canvas = scene.getEngine().getRenderingCanvas();\r\n // Parse options\r\n if (webVROptions.createFallbackVRDeviceOrientationFreeCamera === undefined) {\r\n webVROptions.createFallbackVRDeviceOrientationFreeCamera = true;\r\n }\r\n if (webVROptions.createDeviceOrientationCamera === undefined) {\r\n webVROptions.createDeviceOrientationCamera = true;\r\n }\r\n if (webVROptions.laserToggle === undefined) {\r\n webVROptions.laserToggle = true;\r\n }\r\n if (webVROptions.defaultHeight === undefined) {\r\n webVROptions.defaultHeight = 1.7;\r\n }\r\n if (webVROptions.useCustomVRButton) {\r\n this._useCustomVRButton = true;\r\n if (webVROptions.customVRButton) {\r\n this._btnVR = webVROptions.customVRButton;\r\n }\r\n }\r\n if (webVROptions.rayLength) {\r\n this._rayLength = webVROptions.rayLength;\r\n }\r\n this._defaultHeight = webVROptions.defaultHeight;\r\n if (webVROptions.positionScale) {\r\n this._rayLength *= webVROptions.positionScale;\r\n this._defaultHeight *= webVROptions.positionScale;\r\n }\r\n this._hasEnteredVR = false;\r\n // Set position\r\n if (this._scene.activeCamera) {\r\n this._position = this._scene.activeCamera.position.clone();\r\n }\r\n else {\r\n this._position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, this._defaultHeight, 0);\r\n }\r\n // Set non-vr camera\r\n if (webVROptions.createDeviceOrientationCamera || !this._scene.activeCamera) {\r\n this._deviceOrientationCamera = new _Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_5__[\"DeviceOrientationCamera\"](\"deviceOrientationVRHelper\", this._position.clone(), scene);\r\n // Copy data from existing camera\r\n if (this._scene.activeCamera) {\r\n this._deviceOrientationCamera.minZ = this._scene.activeCamera.minZ;\r\n this._deviceOrientationCamera.maxZ = this._scene.activeCamera.maxZ;\r\n // Set rotation from previous camera\r\n if (this._scene.activeCamera instanceof _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"] && this._scene.activeCamera.rotation) {\r\n var targetCamera = this._scene.activeCamera;\r\n if (targetCamera.rotationQuaternion) {\r\n this._deviceOrientationCamera.rotationQuaternion.copyFrom(targetCamera.rotationQuaternion);\r\n }\r\n else {\r\n this._deviceOrientationCamera.rotationQuaternion.copyFrom(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].RotationYawPitchRoll(targetCamera.rotation.y, targetCamera.rotation.x, targetCamera.rotation.z));\r\n }\r\n this._deviceOrientationCamera.rotation = targetCamera.rotation.clone();\r\n }\r\n }\r\n this._scene.activeCamera = this._deviceOrientationCamera;\r\n if (this._canvas) {\r\n this._scene.activeCamera.attachControl(this._canvas);\r\n }\r\n }\r\n else {\r\n this._existingCamera = this._scene.activeCamera;\r\n }\r\n // Create VR cameras\r\n if (webVROptions.createFallbackVRDeviceOrientationFreeCamera) {\r\n if (webVROptions.useMultiview) {\r\n if (!webVROptions.vrDeviceOrientationCameraMetrics) {\r\n webVROptions.vrDeviceOrientationCameraMetrics = _Cameras_VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_23__[\"VRCameraMetrics\"].GetDefault();\r\n }\r\n webVROptions.vrDeviceOrientationCameraMetrics.multiviewEnabled = true;\r\n }\r\n this._vrDeviceOrientationCamera = new _Cameras_VR_vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_6__[\"VRDeviceOrientationFreeCamera\"](\"VRDeviceOrientationVRHelper\", this._position, this._scene, true, webVROptions.vrDeviceOrientationCameraMetrics);\r\n this._vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE;\r\n }\r\n this._webVRCamera = new _Cameras_VR_webVRCamera__WEBPACK_IMPORTED_MODULE_7__[\"WebVRFreeCamera\"](\"WebVRHelper\", this._position, this._scene, webVROptions);\r\n this._webVRCamera.useStandingMatrix();\r\n this._cameraGazer = new VRExperienceHelperCameraGazer(function () { return _this.currentVRCamera; }, scene);\r\n // Create default button\r\n if (!this._useCustomVRButton) {\r\n this._btnVR = document.createElement(\"BUTTON\");\r\n this._btnVR.className = \"babylonVRicon\";\r\n this._btnVR.id = \"babylonVRiconbtn\";\r\n this._btnVR.title = \"Click to switch to VR\";\r\n var css = \".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) }\";\r\n css += \".babylonVRicon.vrdisplaypresenting { display: none; }\";\r\n // TODO: Add user feedback so that they know what state the VRDisplay is in (disconnected, connected, entering-VR)\r\n // css += \".babylonVRicon.vrdisplaysupported { }\";\r\n // css += \".babylonVRicon.vrdisplayready { }\";\r\n // css += \".babylonVRicon.vrdisplayrequesting { }\";\r\n var style = document.createElement('style');\r\n style.appendChild(document.createTextNode(css));\r\n document.getElementsByTagName('head')[0].appendChild(style);\r\n this.moveButtonToBottomRight();\r\n }\r\n // VR button click event\r\n if (this._btnVR) {\r\n this._btnVR.addEventListener(\"click\", function () {\r\n if (!_this.isInVRMode) {\r\n _this.enterVR();\r\n }\r\n else {\r\n _this.exitVR();\r\n }\r\n });\r\n }\r\n // Window events\r\n var hostWindow = this._scene.getEngine().getHostWindow();\r\n hostWindow.addEventListener(\"resize\", this._onResize);\r\n document.addEventListener(\"fullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"mozfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"webkitfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"msfullscreenchange\", this._onFullscreenChange, false);\r\n document.onmsfullscreenchange = this._onFullscreenChange;\r\n // Display vr button when headset is connected\r\n if (webVROptions.createFallbackVRDeviceOrientationFreeCamera) {\r\n this.displayVRButton();\r\n }\r\n else {\r\n this._scene.getEngine().onVRDisplayChangedObservable.add(function (e) {\r\n if (e.vrDisplay) {\r\n _this.displayVRButton();\r\n }\r\n });\r\n }\r\n // Exiting VR mode using 'ESC' key on desktop\r\n this._onKeyDown = function (event) {\r\n if (event.keyCode === 27 && _this.isInVRMode) {\r\n _this.exitVR();\r\n }\r\n };\r\n document.addEventListener(\"keydown\", this._onKeyDown);\r\n // Exiting VR mode double tapping the touch screen\r\n this._scene.onPrePointerObservable.add(function () {\r\n if (_this.isInVRMode && _this.exitVROnDoubleTap) {\r\n _this.exitVR();\r\n if (_this._fullscreenVRpresenting) {\r\n _this._scene.getEngine().exitFullscreen();\r\n }\r\n }\r\n }, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__[\"PointerEventTypes\"].POINTERDOUBLETAP, false);\r\n // Listen for WebVR display changes\r\n this._onVRDisplayChanged = function (eventArgs) { return _this.onVRDisplayChanged(eventArgs); };\r\n this._onVrDisplayPresentChange = function () { return _this.onVrDisplayPresentChange(); };\r\n this._onVRRequestPresentStart = function () {\r\n _this._webVRrequesting = true;\r\n _this.updateButtonVisibility();\r\n };\r\n this._onVRRequestPresentComplete = function () {\r\n _this._webVRrequesting = false;\r\n _this.updateButtonVisibility();\r\n };\r\n scene.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged);\r\n scene.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart);\r\n scene.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete);\r\n hostWindow.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n scene.onDisposeObservable.add(function () {\r\n _this.dispose();\r\n });\r\n // Gamepad connection events\r\n this._webVRCamera.onControllerMeshLoadedObservable.add(function (webVRController) { return _this._onDefaultMeshLoaded(webVRController); });\r\n this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected);\r\n this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected);\r\n this.updateButtonVisibility();\r\n //create easing functions\r\n this._circleEase = new _Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"CircleEase\"]();\r\n this._circleEase.setEasingMode(_Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"EasingFunction\"].EASINGMODE_EASEINOUT);\r\n // Allow clicking in the vrDeviceOrientationCamera\r\n scene.onPointerObservable.add(function (e) {\r\n if (_this._interactionsEnabled) {\r\n if (scene.activeCamera === _this.vrDeviceOrientationCamera && e.event.pointerType === \"mouse\") {\r\n if (e.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._cameraGazer._selectionPointerDown();\r\n }\r\n else if (e.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__[\"PointerEventTypes\"].POINTERUP) {\r\n _this._cameraGazer._selectionPointerUp();\r\n }\r\n }\r\n }\r\n });\r\n if (this.webVROptions.floorMeshes) {\r\n this.enableTeleportation({ floorMeshes: this.webVROptions.floorMeshes });\r\n }\r\n }\r\n Object.defineProperty(VRExperienceHelper.prototype, \"onEnteringVR\", {\r\n /** Return this.onEnteringVRObservable\r\n * Note: This one is for backward compatibility. Please use onEnteringVRObservable directly\r\n */\r\n get: function () {\r\n return this.onEnteringVRObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"onExitingVR\", {\r\n /** Return this.onExitingVRObservable\r\n * Note: This one is for backward compatibility. Please use onExitingVRObservable directly\r\n */\r\n get: function () {\r\n return this.onExitingVRObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"onControllerMeshLoaded\", {\r\n /** Return this.onControllerMeshLoadedObservable\r\n * Note: This one is for backward compatibility. Please use onControllerMeshLoadedObservable directly\r\n */\r\n get: function () {\r\n return this.onControllerMeshLoadedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"teleportationTarget\", {\r\n /**\r\n * The mesh used to display where the user is going to teleport.\r\n */\r\n get: function () {\r\n return this._teleportationTarget;\r\n },\r\n /**\r\n * Sets the mesh to be used to display where the user is going to teleport.\r\n */\r\n set: function (value) {\r\n if (value) {\r\n value.name = \"teleportationTarget\";\r\n this._isDefaultTeleportationTarget = false;\r\n this._teleportationTarget = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"gazeTrackerMesh\", {\r\n /**\r\n * The mesh used to display where the user is selecting, this mesh will be cloned and set as the gazeTracker for the left and right controller\r\n * when set bakeCurrentTransformIntoVertices will be called on the mesh.\r\n * See http://doc.babylonjs.com/resources/baking_transformations\r\n */\r\n get: function () {\r\n return this._cameraGazer._gazeTracker;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n // Dispose of existing meshes\r\n if (this._cameraGazer._gazeTracker) {\r\n this._cameraGazer._gazeTracker.dispose();\r\n }\r\n if (this._leftController && this._leftController._gazeTracker) {\r\n this._leftController._gazeTracker.dispose();\r\n }\r\n if (this._rightController && this._rightController._gazeTracker) {\r\n this._rightController._gazeTracker.dispose();\r\n }\r\n // Set and create gaze trackers on head and controllers\r\n this._cameraGazer._gazeTracker = value;\r\n this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices();\r\n this._cameraGazer._gazeTracker.isPickable = false;\r\n this._cameraGazer._gazeTracker.isVisible = false;\r\n this._cameraGazer._gazeTracker.name = \"gazeTracker\";\r\n if (this._leftController) {\r\n this._leftController._gazeTracker = this._cameraGazer._gazeTracker.clone(\"gazeTracker\");\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker = this._cameraGazer._gazeTracker.clone(\"gazeTracker\");\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"leftControllerGazeTrackerMesh\", {\r\n /**\r\n * The gaze tracking mesh corresponding to the left controller\r\n */\r\n get: function () {\r\n if (this._leftController) {\r\n return this._leftController._gazeTracker;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"rightControllerGazeTrackerMesh\", {\r\n /**\r\n * The gaze tracking mesh corresponding to the right controller\r\n */\r\n get: function () {\r\n if (this._rightController) {\r\n return this._rightController._gazeTracker;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"displayGaze\", {\r\n /**\r\n * If the ray of the gaze should be displayed.\r\n */\r\n get: function () {\r\n return this._displayGaze;\r\n },\r\n /**\r\n * Sets if the ray of the gaze should be displayed.\r\n */\r\n set: function (value) {\r\n this._displayGaze = value;\r\n if (!value) {\r\n this._cameraGazer._gazeTracker.isVisible = false;\r\n if (this._leftController) {\r\n this._leftController._gazeTracker.isVisible = false;\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker.isVisible = false;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"displayLaserPointer\", {\r\n /**\r\n * If the ray of the LaserPointer should be displayed.\r\n */\r\n get: function () {\r\n return this._displayLaserPointer;\r\n },\r\n /**\r\n * Sets if the ray of the LaserPointer should be displayed.\r\n */\r\n set: function (value) {\r\n this._displayLaserPointer = value;\r\n if (!value) {\r\n if (this._rightController) {\r\n this._rightController._deactivatePointer();\r\n this._rightController._gazeTracker.isVisible = false;\r\n }\r\n if (this._leftController) {\r\n this._leftController._deactivatePointer();\r\n this._leftController._gazeTracker.isVisible = false;\r\n }\r\n }\r\n else {\r\n if (this._rightController) {\r\n this._rightController._activatePointer();\r\n }\r\n if (this._leftController) {\r\n this._leftController._activatePointer();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"deviceOrientationCamera\", {\r\n /**\r\n * The deviceOrientationCamera used as the camera when not in VR.\r\n */\r\n get: function () {\r\n return this._deviceOrientationCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"currentVRCamera\", {\r\n /**\r\n * Based on the current WebVR support, returns the current VR camera used.\r\n */\r\n get: function () {\r\n if (this._webVRready) {\r\n return this._webVRCamera;\r\n }\r\n else {\r\n return this._scene.activeCamera;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"webVRCamera\", {\r\n /**\r\n * The webVRCamera which is used when in VR.\r\n */\r\n get: function () {\r\n return this._webVRCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"vrDeviceOrientationCamera\", {\r\n /**\r\n * The deviceOrientationCamera that is used as a fallback when vr device is not connected.\r\n */\r\n get: function () {\r\n return this._vrDeviceOrientationCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"vrButton\", {\r\n /**\r\n * The html button that is used to trigger entering into VR.\r\n */\r\n get: function () {\r\n return this._btnVR;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"_teleportationRequestInitiated\", {\r\n get: function () {\r\n var result = this._cameraGazer._teleportationRequestInitiated\r\n || (this._leftController !== null && this._leftController._teleportationRequestInitiated)\r\n || (this._rightController !== null && this._rightController._teleportationRequestInitiated);\r\n return result;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Raised when one of the controller has loaded successfully its associated default mesh\r\n VRExperienceHelper.prototype._onDefaultMeshLoaded = function (webVRController) {\r\n if (this._leftController && this._leftController.webVRController == webVRController) {\r\n if (webVRController.mesh) {\r\n this._leftController._setLaserPointerParent(webVRController.mesh);\r\n }\r\n }\r\n if (this._rightController && this._rightController.webVRController == webVRController) {\r\n if (webVRController.mesh) {\r\n this._rightController._setLaserPointerParent(webVRController.mesh);\r\n }\r\n }\r\n try {\r\n this.onControllerMeshLoadedObservable.notifyObservers(webVRController);\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error in your custom logic onControllerMeshLoaded: \" + err);\r\n }\r\n };\r\n Object.defineProperty(VRExperienceHelper.prototype, \"isInVRMode\", {\r\n /**\r\n * Gets a value indicating if we are currently in VR mode.\r\n */\r\n get: function () {\r\n return this._webVRpresenting || this._fullscreenVRpresenting;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VRExperienceHelper.prototype.onVrDisplayPresentChange = function () {\r\n var vrDisplay = this._scene.getEngine().getVRDevice();\r\n if (vrDisplay) {\r\n var wasPresenting = this._webVRpresenting;\r\n this._webVRpresenting = vrDisplay.isPresenting;\r\n if (wasPresenting && !this._webVRpresenting) {\r\n this.exitVR();\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?');\r\n }\r\n this.updateButtonVisibility();\r\n };\r\n VRExperienceHelper.prototype.onVRDisplayChanged = function (eventArgs) {\r\n this._webVRsupported = eventArgs.vrSupported;\r\n this._webVRready = !!eventArgs.vrDisplay;\r\n this._webVRpresenting = eventArgs.vrDisplay && eventArgs.vrDisplay.isPresenting;\r\n this.updateButtonVisibility();\r\n };\r\n VRExperienceHelper.prototype.moveButtonToBottomRight = function () {\r\n if (this._canvas && !this._useCustomVRButton && this._btnVR) {\r\n var rect = this._canvas.getBoundingClientRect();\r\n this._btnVR.style.top = rect.top + rect.height - 70 + \"px\";\r\n this._btnVR.style.left = rect.left + rect.width - 100 + \"px\";\r\n }\r\n };\r\n VRExperienceHelper.prototype.displayVRButton = function () {\r\n if (!this._useCustomVRButton && !this._btnVRDisplayed && this._btnVR) {\r\n document.body.appendChild(this._btnVR);\r\n this._btnVRDisplayed = true;\r\n }\r\n };\r\n VRExperienceHelper.prototype.updateButtonVisibility = function () {\r\n if (!this._btnVR || this._useCustomVRButton) {\r\n return;\r\n }\r\n this._btnVR.className = \"babylonVRicon\";\r\n if (this.isInVRMode) {\r\n this._btnVR.className += \" vrdisplaypresenting\";\r\n }\r\n else {\r\n if (this._webVRready) {\r\n this._btnVR.className += \" vrdisplayready\";\r\n }\r\n if (this._webVRsupported) {\r\n this._btnVR.className += \" vrdisplaysupported\";\r\n }\r\n if (this._webVRrequesting) {\r\n this._btnVR.className += \" vrdisplayrequesting\";\r\n }\r\n }\r\n };\r\n /**\r\n * Attempt to enter VR. If a headset is connected and ready, will request present on that.\r\n * Otherwise, will use the fullscreen API.\r\n */\r\n VRExperienceHelper.prototype.enterVR = function () {\r\n var _this = this;\r\n if (this.onEnteringVRObservable) {\r\n try {\r\n this.onEnteringVRObservable.notifyObservers(this);\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error in your custom logic onEnteringVR: \" + err);\r\n }\r\n }\r\n if (this._scene.activeCamera) {\r\n this._position = this._scene.activeCamera.position.clone();\r\n if (this.vrDeviceOrientationCamera) {\r\n this.vrDeviceOrientationCamera.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles();\r\n this.vrDeviceOrientationCamera.angularSensibility = 2000;\r\n }\r\n if (this.webVRCamera) {\r\n var currentYRotation = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y;\r\n var desiredYRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y;\r\n var delta = desiredYRotation - currentYRotation;\r\n var currentGlobalRotation = this.webVRCamera.rotationQuaternion.toEulerAngles().y;\r\n this.webVRCamera.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromEulerAngles(0, currentGlobalRotation + delta, 0);\r\n }\r\n // make sure that we return to the last active camera\r\n this._existingCamera = this._scene.activeCamera;\r\n // Remove and cache angular sensability to avoid camera rotation when in VR\r\n if (this._existingCamera.angularSensibilityX) {\r\n this._cachedAngularSensibility.angularSensibilityX = this._existingCamera.angularSensibilityX;\r\n this._existingCamera.angularSensibilityX = Number.MAX_VALUE;\r\n }\r\n if (this._existingCamera.angularSensibilityY) {\r\n this._cachedAngularSensibility.angularSensibilityY = this._existingCamera.angularSensibilityY;\r\n this._existingCamera.angularSensibilityY = Number.MAX_VALUE;\r\n }\r\n if (this._existingCamera.angularSensibility) {\r\n this._cachedAngularSensibility.angularSensibility = this._existingCamera.angularSensibility;\r\n this._existingCamera.angularSensibility = Number.MAX_VALUE;\r\n }\r\n }\r\n if (this._webVRrequesting) {\r\n return;\r\n }\r\n // If WebVR is supported and a headset is connected\r\n if (this._webVRready) {\r\n if (!this._webVRpresenting) {\r\n this._scene.getEngine().onVRRequestPresentComplete.addOnce(function (result) {\r\n _this.onAfterEnteringVRObservable.notifyObservers({ success: result });\r\n });\r\n this._webVRCamera.position = this._position;\r\n this._scene.activeCamera = this._webVRCamera;\r\n }\r\n }\r\n else if (this._vrDeviceOrientationCamera) {\r\n this._vrDeviceOrientationCamera.position = this._position;\r\n if (this._scene.activeCamera) {\r\n this._vrDeviceOrientationCamera.minZ = this._scene.activeCamera.minZ;\r\n }\r\n this._scene.activeCamera = this._vrDeviceOrientationCamera;\r\n this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen);\r\n this.updateButtonVisibility();\r\n this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(function () {\r\n _this.onAfterEnteringVRObservable.notifyObservers({ success: true });\r\n });\r\n }\r\n if (this._scene.activeCamera && this._canvas) {\r\n this._scene.activeCamera.attachControl(this._canvas);\r\n }\r\n if (this._interactionsEnabled) {\r\n this._scene.registerBeforeRender(this.beforeRender);\r\n }\r\n if (this._displayLaserPointer) {\r\n [this._leftController, this._rightController].forEach(function (controller) {\r\n if (controller) {\r\n controller._activatePointer();\r\n }\r\n });\r\n }\r\n this._hasEnteredVR = true;\r\n };\r\n /**\r\n * Attempt to exit VR, or fullscreen.\r\n */\r\n VRExperienceHelper.prototype.exitVR = function () {\r\n if (this._hasEnteredVR) {\r\n if (this.onExitingVRObservable) {\r\n try {\r\n this.onExitingVRObservable.notifyObservers(this);\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error in your custom logic onExitingVR: \" + err);\r\n }\r\n }\r\n if (this._webVRpresenting) {\r\n this._scene.getEngine().disableVR();\r\n }\r\n if (this._scene.activeCamera) {\r\n this._position = this._scene.activeCamera.position.clone();\r\n }\r\n if (this.vrDeviceOrientationCamera) {\r\n this.vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE;\r\n }\r\n if (this._deviceOrientationCamera) {\r\n this._deviceOrientationCamera.position = this._position;\r\n this._scene.activeCamera = this._deviceOrientationCamera;\r\n if (this._canvas) {\r\n this._scene.activeCamera.attachControl(this._canvas);\r\n }\r\n // Restore angular sensibility\r\n if (this._cachedAngularSensibility.angularSensibilityX) {\r\n this._deviceOrientationCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX;\r\n this._cachedAngularSensibility.angularSensibilityX = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibilityY) {\r\n this._deviceOrientationCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY;\r\n this._cachedAngularSensibility.angularSensibilityY = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibility) {\r\n this._deviceOrientationCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility;\r\n this._cachedAngularSensibility.angularSensibility = null;\r\n }\r\n }\r\n else if (this._existingCamera) {\r\n this._existingCamera.position = this._position;\r\n this._scene.activeCamera = this._existingCamera;\r\n // Restore angular sensibility\r\n if (this._cachedAngularSensibility.angularSensibilityX) {\r\n this._existingCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX;\r\n this._cachedAngularSensibility.angularSensibilityX = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibilityY) {\r\n this._existingCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY;\r\n this._cachedAngularSensibility.angularSensibilityY = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibility) {\r\n this._existingCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility;\r\n this._cachedAngularSensibility.angularSensibility = null;\r\n }\r\n }\r\n this.updateButtonVisibility();\r\n if (this._interactionsEnabled) {\r\n this._scene.unregisterBeforeRender(this.beforeRender);\r\n this._cameraGazer._gazeTracker.isVisible = false;\r\n if (this._leftController) {\r\n this._leftController._gazeTracker.isVisible = false;\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker.isVisible = false;\r\n }\r\n }\r\n // resize to update width and height when exiting vr exits fullscreen\r\n this._scene.getEngine().resize();\r\n [this._leftController, this._rightController].forEach(function (controller) {\r\n if (controller) {\r\n controller._deactivatePointer();\r\n }\r\n });\r\n this._hasEnteredVR = false;\r\n // Update engine state to re enable non-vr camera input\r\n var engine = this._scene.getEngine();\r\n if (engine._onVrDisplayPresentChange) {\r\n engine._onVrDisplayPresentChange();\r\n }\r\n }\r\n };\r\n Object.defineProperty(VRExperienceHelper.prototype, \"position\", {\r\n /**\r\n * The position of the vr experience helper.\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n /**\r\n * Sets the position of the vr experience helper.\r\n */\r\n set: function (value) {\r\n this._position = value;\r\n if (this._scene.activeCamera) {\r\n this._scene.activeCamera.position = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Enables controllers and user interactions such as selecting and object or clicking on an object.\r\n */\r\n VRExperienceHelper.prototype.enableInteractions = function () {\r\n var _this = this;\r\n if (!this._interactionsEnabled) {\r\n this._interactionsRequested = true;\r\n if (this._leftController) {\r\n this._enableInteractionOnController(this._leftController);\r\n }\r\n if (this._rightController) {\r\n this._enableInteractionOnController(this._rightController);\r\n }\r\n this.raySelectionPredicate = function (mesh) {\r\n return mesh.isVisible && (mesh.isPickable || mesh.name === _this._floorMeshName);\r\n };\r\n this.meshSelectionPredicate = function () {\r\n return true;\r\n };\r\n this._raySelectionPredicate = function (mesh) {\r\n if (_this._isTeleportationFloor(mesh) || (mesh.name.indexOf(\"gazeTracker\") === -1\r\n && mesh.name.indexOf(\"teleportationTarget\") === -1\r\n && mesh.name.indexOf(\"torusTeleportation\") === -1)) {\r\n return _this.raySelectionPredicate(mesh);\r\n }\r\n return false;\r\n };\r\n this._interactionsEnabled = true;\r\n }\r\n };\r\n Object.defineProperty(VRExperienceHelper.prototype, \"_noControllerIsActive\", {\r\n get: function () {\r\n return !(this._leftController && this._leftController._activePointer) && !(this._rightController && this._rightController._activePointer);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VRExperienceHelper.prototype._isTeleportationFloor = function (mesh) {\r\n for (var i = 0; i < this._floorMeshesCollection.length; i++) {\r\n if (this._floorMeshesCollection[i].id === mesh.id) {\r\n return true;\r\n }\r\n }\r\n if (this._floorMeshName && mesh.name === this._floorMeshName) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Adds a floor mesh to be used for teleportation.\r\n * @param floorMesh the mesh to be used for teleportation.\r\n */\r\n VRExperienceHelper.prototype.addFloorMesh = function (floorMesh) {\r\n if (!this._floorMeshesCollection) {\r\n return;\r\n }\r\n if (this._floorMeshesCollection.indexOf(floorMesh) > -1) {\r\n return;\r\n }\r\n this._floorMeshesCollection.push(floorMesh);\r\n };\r\n /**\r\n * Removes a floor mesh from being used for teleportation.\r\n * @param floorMesh the mesh to be removed.\r\n */\r\n VRExperienceHelper.prototype.removeFloorMesh = function (floorMesh) {\r\n if (!this._floorMeshesCollection) {\r\n return;\r\n }\r\n var meshIndex = this._floorMeshesCollection.indexOf(floorMesh);\r\n if (meshIndex !== -1) {\r\n this._floorMeshesCollection.splice(meshIndex, 1);\r\n }\r\n };\r\n /**\r\n * Enables interactions and teleportation using the VR controllers and gaze.\r\n * @param vrTeleportationOptions options to modify teleportation behavior.\r\n */\r\n VRExperienceHelper.prototype.enableTeleportation = function (vrTeleportationOptions) {\r\n if (vrTeleportationOptions === void 0) { vrTeleportationOptions = {}; }\r\n if (!this._teleportationInitialized) {\r\n this._teleportationRequested = true;\r\n this.enableInteractions();\r\n if (vrTeleportationOptions.floorMeshName) {\r\n this._floorMeshName = vrTeleportationOptions.floorMeshName;\r\n }\r\n if (vrTeleportationOptions.floorMeshes) {\r\n this._floorMeshesCollection = vrTeleportationOptions.floorMeshes;\r\n }\r\n if (this._leftController != null) {\r\n this._enableTeleportationOnController(this._leftController);\r\n }\r\n if (this._rightController != null) {\r\n this._enableTeleportationOnController(this._rightController);\r\n }\r\n // Creates an image processing post process for the vignette not relying\r\n // on the main scene configuration for image processing to reduce setup and spaces\r\n // (gamma/linear) conflicts.\r\n var imageProcessingConfiguration = new _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_17__[\"ImageProcessingConfiguration\"]();\r\n imageProcessingConfiguration.vignetteColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color4\"](0, 0, 0, 0);\r\n imageProcessingConfiguration.vignetteEnabled = true;\r\n this._postProcessMove = new _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_20__[\"ImageProcessingPostProcess\"](\"postProcessMove\", 1.0, this._webVRCamera, undefined, undefined, undefined, undefined, imageProcessingConfiguration);\r\n this._webVRCamera.detachPostProcess(this._postProcessMove);\r\n this._teleportationInitialized = true;\r\n if (this._isDefaultTeleportationTarget) {\r\n this._createTeleportationCircles();\r\n this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor);\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._enableInteractionOnController = function (controller) {\r\n var _this = this;\r\n var controllerMesh = controller.webVRController.mesh;\r\n if (controllerMesh) {\r\n controller._interactionsEnabled = true;\r\n if (this.isInVRMode && this._displayLaserPointer) {\r\n controller._activatePointer();\r\n }\r\n if (this.webVROptions.laserToggle) {\r\n controller.webVRController.onMainButtonStateChangedObservable.add(function (stateObject) {\r\n // Enabling / disabling laserPointer\r\n if (_this._displayLaserPointer && stateObject.value === 1) {\r\n if (controller._activePointer) {\r\n controller._deactivatePointer();\r\n }\r\n else {\r\n controller._activatePointer();\r\n }\r\n if (_this.displayGaze) {\r\n controller._gazeTracker.isVisible = controller._activePointer;\r\n }\r\n }\r\n });\r\n }\r\n controller.webVRController.onTriggerStateChangedObservable.add(function (stateObject) {\r\n var gazer = controller;\r\n if (_this._noControllerIsActive) {\r\n gazer = _this._cameraGazer;\r\n }\r\n if (!gazer._pointerDownOnMeshAsked) {\r\n if (stateObject.value > _this._padSensibilityUp) {\r\n gazer._selectionPointerDown();\r\n }\r\n }\r\n else if (stateObject.value < _this._padSensibilityDown) {\r\n gazer._selectionPointerUp();\r\n }\r\n });\r\n }\r\n };\r\n VRExperienceHelper.prototype._checkTeleportWithRay = function (stateObject, gazer) {\r\n // Dont teleport if another gaze already requested teleportation\r\n if (this._teleportationRequestInitiated && !gazer._teleportationRequestInitiated) {\r\n return;\r\n }\r\n if (!gazer._teleportationRequestInitiated) {\r\n if (stateObject.y < -this._padSensibilityUp && gazer._dpadPressed) {\r\n gazer._activatePointer();\r\n gazer._teleportationRequestInitiated = true;\r\n }\r\n }\r\n else {\r\n // Listening to the proper controller values changes to confirm teleportation\r\n if (Math.sqrt(stateObject.y * stateObject.y + stateObject.x * stateObject.x) < this._padSensibilityDown) {\r\n if (this._teleportActive) {\r\n this.teleportCamera(this._haloCenter);\r\n }\r\n gazer._teleportationRequestInitiated = false;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._checkRotate = function (stateObject, gazer) {\r\n // Only rotate when user is not currently selecting a teleportation location\r\n if (gazer._teleportationRequestInitiated) {\r\n return;\r\n }\r\n if (!gazer._rotationLeftAsked) {\r\n if (stateObject.x < -this._padSensibilityUp && gazer._dpadPressed) {\r\n gazer._rotationLeftAsked = true;\r\n if (this._rotationAllowed) {\r\n this._rotateCamera(false);\r\n }\r\n }\r\n }\r\n else {\r\n if (stateObject.x > -this._padSensibilityDown) {\r\n gazer._rotationLeftAsked = false;\r\n }\r\n }\r\n if (!gazer._rotationRightAsked) {\r\n if (stateObject.x > this._padSensibilityUp && gazer._dpadPressed) {\r\n gazer._rotationRightAsked = true;\r\n if (this._rotationAllowed) {\r\n this._rotateCamera(true);\r\n }\r\n }\r\n }\r\n else {\r\n if (stateObject.x < this._padSensibilityDown) {\r\n gazer._rotationRightAsked = false;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._checkTeleportBackwards = function (stateObject, gazer) {\r\n // Only teleport backwards when user is not currently selecting a teleportation location\r\n if (gazer._teleportationRequestInitiated) {\r\n return;\r\n }\r\n // Teleport backwards\r\n if (stateObject.y > this._padSensibilityUp && gazer._dpadPressed) {\r\n if (!gazer._teleportationBackRequestInitiated) {\r\n if (!this.currentVRCamera) {\r\n return;\r\n }\r\n // Get rotation and position of the current camera\r\n var rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix());\r\n var position = this.currentVRCamera.position;\r\n // If the camera has device position, use that instead\r\n if (this.currentVRCamera.devicePosition && this.currentVRCamera.deviceRotationQuaternion) {\r\n rotation = this.currentVRCamera.deviceRotationQuaternion;\r\n position = this.currentVRCamera.devicePosition;\r\n }\r\n // Get matrix with only the y rotation of the device rotation\r\n rotation.toEulerAnglesToRef(this._workingVector);\r\n this._workingVector.z = 0;\r\n this._workingVector.x = 0;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].RotationYawPitchRollToRef(this._workingVector.y, this._workingVector.x, this._workingVector.z, this._workingQuaternion);\r\n this._workingQuaternion.toRotationMatrix(this._workingMatrix);\r\n // Rotate backwards ray by device rotation to cast at the ground behind the user\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].TransformCoordinatesToRef(this._teleportBackwardsVector, this._workingMatrix, this._workingVector);\r\n // Teleport if ray hit the ground and is not to far away eg. backwards off a cliff\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_16__[\"Ray\"](position, this._workingVector);\r\n var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);\r\n if (hit && hit.pickedPoint && hit.pickedMesh && this._isTeleportationFloor(hit.pickedMesh) && hit.distance < 5) {\r\n this.teleportCamera(hit.pickedPoint);\r\n }\r\n gazer._teleportationBackRequestInitiated = true;\r\n }\r\n }\r\n else {\r\n gazer._teleportationBackRequestInitiated = false;\r\n }\r\n };\r\n VRExperienceHelper.prototype._enableTeleportationOnController = function (controller) {\r\n var _this = this;\r\n var controllerMesh = controller.webVRController.mesh;\r\n if (controllerMesh) {\r\n if (!controller._interactionsEnabled) {\r\n this._enableInteractionOnController(controller);\r\n }\r\n controller._interactionsEnabled = true;\r\n controller._teleportationEnabled = true;\r\n if (controller.webVRController.controllerType === _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__[\"PoseEnabledControllerType\"].VIVE) {\r\n controller._dpadPressed = false;\r\n controller.webVRController.onPadStateChangedObservable.add(function (stateObject) {\r\n controller._dpadPressed = stateObject.pressed;\r\n if (!controller._dpadPressed) {\r\n controller._rotationLeftAsked = false;\r\n controller._rotationRightAsked = false;\r\n controller._teleportationBackRequestInitiated = false;\r\n }\r\n });\r\n }\r\n controller.webVRController.onPadValuesChangedObservable.add(function (stateObject) {\r\n if (_this.teleportationEnabled) {\r\n _this._checkTeleportBackwards(stateObject, controller);\r\n _this._checkTeleportWithRay(stateObject, controller);\r\n }\r\n _this._checkRotate(stateObject, controller);\r\n });\r\n }\r\n };\r\n VRExperienceHelper.prototype._createTeleportationCircles = function () {\r\n this._teleportationTarget = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateGround(\"teleportationTarget\", 2, 2, 2, this._scene);\r\n this._teleportationTarget.isPickable = false;\r\n var length = 512;\r\n var dynamicTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_19__[\"DynamicTexture\"](\"DynamicTexture\", length, this._scene, true);\r\n dynamicTexture.hasAlpha = true;\r\n var context = dynamicTexture.getContext();\r\n var centerX = length / 2;\r\n var centerY = length / 2;\r\n var radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = this._teleportationFillColor;\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = this._teleportationBorderColor;\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n var teleportationCircleMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__[\"StandardMaterial\"](\"TextPlaneMaterial\", this._scene);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n this._teleportationTarget.material = teleportationCircleMaterial;\r\n var torus = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateTorus(\"torusTeleportation\", 0.75, 0.1, 25, this._scene, false);\r\n torus.isPickable = false;\r\n torus.parent = this._teleportationTarget;\r\n var animationInnerCircle = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationInnerCircle\", \"position.y\", 30, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE);\r\n var keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n var easingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"SineEase\"]();\r\n easingFunction.setEasingMode(_Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"EasingFunction\"].EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n this._scene.beginAnimation(torus, 0, 60, true);\r\n this._hideTeleportationTarget();\r\n };\r\n VRExperienceHelper.prototype._displayTeleportationTarget = function () {\r\n this._teleportActive = true;\r\n if (this._teleportationInitialized) {\r\n this._teleportationTarget.isVisible = true;\r\n if (this._isDefaultTeleportationTarget) {\r\n this._teleportationTarget.getChildren()[0].isVisible = true;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._hideTeleportationTarget = function () {\r\n this._teleportActive = false;\r\n if (this._teleportationInitialized) {\r\n this._teleportationTarget.isVisible = false;\r\n if (this._isDefaultTeleportationTarget) {\r\n this._teleportationTarget.getChildren()[0].isVisible = false;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._rotateCamera = function (right) {\r\n var _this = this;\r\n if (!(this.currentVRCamera instanceof _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"])) {\r\n return;\r\n }\r\n if (right) {\r\n this._rotationAngle++;\r\n }\r\n else {\r\n this._rotationAngle--;\r\n }\r\n this.currentVRCamera.animations = [];\r\n var target = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Matrix\"].RotationY(Math.PI / 4 * this._rotationAngle));\r\n var animationRotation = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationRotation\", \"rotationQuaternion\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_QUATERNION, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var animationRotationKeys = [];\r\n animationRotationKeys.push({\r\n frame: 0,\r\n value: this.currentVRCamera.rotationQuaternion\r\n });\r\n animationRotationKeys.push({\r\n frame: 6,\r\n value: target\r\n });\r\n animationRotation.setKeys(animationRotationKeys);\r\n animationRotation.setEasingFunction(this._circleEase);\r\n this.currentVRCamera.animations.push(animationRotation);\r\n this._postProcessMove.animations = [];\r\n var animationPP = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP\", \"vignetteWeight\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteWeightKeys = [];\r\n vignetteWeightKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 3,\r\n value: 4\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 6,\r\n value: 0\r\n });\r\n animationPP.setKeys(vignetteWeightKeys);\r\n animationPP.setEasingFunction(this._circleEase);\r\n this._postProcessMove.animations.push(animationPP);\r\n var animationPP2 = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP2\", \"vignetteStretch\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteStretchKeys = [];\r\n vignetteStretchKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 3,\r\n value: 10\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 6,\r\n value: 0\r\n });\r\n animationPP2.setKeys(vignetteStretchKeys);\r\n animationPP2.setEasingFunction(this._circleEase);\r\n this._postProcessMove.animations.push(animationPP2);\r\n this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0;\r\n this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0;\r\n this._postProcessMove.samples = 4;\r\n this._webVRCamera.attachPostProcess(this._postProcessMove);\r\n this._scene.beginAnimation(this._postProcessMove, 0, 6, false, 1, function () {\r\n _this._webVRCamera.detachPostProcess(_this._postProcessMove);\r\n });\r\n this._scene.beginAnimation(this.currentVRCamera, 0, 6, false, 1);\r\n };\r\n VRExperienceHelper.prototype._moveTeleportationSelectorTo = function (hit, gazer, ray) {\r\n if (hit.pickedPoint) {\r\n if (gazer._teleportationRequestInitiated) {\r\n this._displayTeleportationTarget();\r\n this._haloCenter.copyFrom(hit.pickedPoint);\r\n this._teleportationTarget.position.copyFrom(hit.pickedPoint);\r\n }\r\n var pickNormal = this._convertNormalToDirectionOfRay(hit.getNormal(true, false), ray);\r\n if (pickNormal) {\r\n var axis1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_29__[\"Axis\"].Y, pickNormal);\r\n var axis2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(pickNormal, axis1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].RotationFromAxisToRef(axis2, pickNormal, axis1, this._teleportationTarget.rotation);\r\n }\r\n this._teleportationTarget.position.y += 0.1;\r\n }\r\n };\r\n /**\r\n * Teleports the users feet to the desired location\r\n * @param location The location where the user's feet should be placed\r\n */\r\n VRExperienceHelper.prototype.teleportCamera = function (location) {\r\n var _this = this;\r\n if (!(this.currentVRCamera instanceof _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"])) {\r\n return;\r\n }\r\n // Teleport the hmd to where the user is looking by moving the anchor to where they are looking minus the\r\n // offset of the headset from the anchor.\r\n if (this.webVRCamera.leftCamera) {\r\n this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition);\r\n this._workingVector.subtractInPlace(this.webVRCamera.position);\r\n location.subtractToRef(this._workingVector, this._workingVector);\r\n }\r\n else {\r\n this._workingVector.copyFrom(location);\r\n }\r\n // Add height to account for user's height offset\r\n if (this.isInVRMode) {\r\n this._workingVector.y += this.webVRCamera.deviceDistanceToRoomGround() * this._webVRCamera.deviceScaleFactor;\r\n }\r\n else {\r\n this._workingVector.y += this._defaultHeight;\r\n }\r\n this.onBeforeCameraTeleport.notifyObservers(this._workingVector);\r\n // Create animation from the camera's position to the new location\r\n this.currentVRCamera.animations = [];\r\n var animationCameraTeleportation = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationCameraTeleportation\", \"position\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_VECTOR3, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var animationCameraTeleportationKeys = [{\r\n frame: 0,\r\n value: this.currentVRCamera.position\r\n },\r\n {\r\n frame: 11,\r\n value: this._workingVector\r\n }\r\n ];\r\n animationCameraTeleportation.setKeys(animationCameraTeleportationKeys);\r\n animationCameraTeleportation.setEasingFunction(this._circleEase);\r\n this.currentVRCamera.animations.push(animationCameraTeleportation);\r\n this._postProcessMove.animations = [];\r\n var animationPP = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP\", \"vignetteWeight\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteWeightKeys = [];\r\n vignetteWeightKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 5,\r\n value: 8\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 11,\r\n value: 0\r\n });\r\n animationPP.setKeys(vignetteWeightKeys);\r\n this._postProcessMove.animations.push(animationPP);\r\n var animationPP2 = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP2\", \"vignetteStretch\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteStretchKeys = [];\r\n vignetteStretchKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 5,\r\n value: 10\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 11,\r\n value: 0\r\n });\r\n animationPP2.setKeys(vignetteStretchKeys);\r\n this._postProcessMove.animations.push(animationPP2);\r\n this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0;\r\n this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0;\r\n this._webVRCamera.attachPostProcess(this._postProcessMove);\r\n this._scene.beginAnimation(this._postProcessMove, 0, 11, false, 1, function () {\r\n _this._webVRCamera.detachPostProcess(_this._postProcessMove);\r\n });\r\n this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1, function () {\r\n _this.onAfterCameraTeleport.notifyObservers(_this._workingVector);\r\n });\r\n this._hideTeleportationTarget();\r\n };\r\n VRExperienceHelper.prototype._convertNormalToDirectionOfRay = function (normal, ray) {\r\n if (normal) {\r\n var angle = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Dot(normal, ray.direction));\r\n if (angle < Math.PI / 2) {\r\n normal.scaleInPlace(-1);\r\n }\r\n }\r\n return normal;\r\n };\r\n VRExperienceHelper.prototype._castRayAndSelectObject = function (gazer) {\r\n if (!(this.currentVRCamera instanceof _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"])) {\r\n return;\r\n }\r\n var ray = gazer._getForwardRay(this._rayLength);\r\n var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);\r\n if (hit) {\r\n // Populate the controllers mesh that can be used for drag/drop\r\n if (gazer._laserPointer) {\r\n hit.originMesh = gazer._laserPointer.parent;\r\n }\r\n this._scene.simulatePointerMove(hit, { pointerId: gazer._id });\r\n }\r\n gazer._currentHit = hit;\r\n // Moving the gazeTracker on the mesh face targetted\r\n if (hit && hit.pickedPoint) {\r\n if (this._displayGaze) {\r\n var multiplier = 1;\r\n gazer._gazeTracker.isVisible = true;\r\n if (gazer._isActionableMesh) {\r\n multiplier = 3;\r\n }\r\n if (this.updateGazeTrackerScale) {\r\n gazer._gazeTracker.scaling.x = hit.distance * multiplier;\r\n gazer._gazeTracker.scaling.y = hit.distance * multiplier;\r\n gazer._gazeTracker.scaling.z = hit.distance * multiplier;\r\n }\r\n var pickNormal = this._convertNormalToDirectionOfRay(hit.getNormal(), ray);\r\n // To avoid z-fighting\r\n var deltaFighting = 0.002;\r\n if (pickNormal) {\r\n var axis1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_29__[\"Axis\"].Y, pickNormal);\r\n var axis2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(pickNormal, axis1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].RotationFromAxisToRef(axis2, pickNormal, axis1, gazer._gazeTracker.rotation);\r\n }\r\n gazer._gazeTracker.position.copyFrom(hit.pickedPoint);\r\n if (gazer._gazeTracker.position.x < 0) {\r\n gazer._gazeTracker.position.x += deltaFighting;\r\n }\r\n else {\r\n gazer._gazeTracker.position.x -= deltaFighting;\r\n }\r\n if (gazer._gazeTracker.position.y < 0) {\r\n gazer._gazeTracker.position.y += deltaFighting;\r\n }\r\n else {\r\n gazer._gazeTracker.position.y -= deltaFighting;\r\n }\r\n if (gazer._gazeTracker.position.z < 0) {\r\n gazer._gazeTracker.position.z += deltaFighting;\r\n }\r\n else {\r\n gazer._gazeTracker.position.z -= deltaFighting;\r\n }\r\n }\r\n // Changing the size of the laser pointer based on the distance from the targetted point\r\n gazer._updatePointerDistance(hit.distance);\r\n }\r\n else {\r\n gazer._updatePointerDistance();\r\n gazer._gazeTracker.isVisible = false;\r\n }\r\n if (hit && hit.pickedMesh) {\r\n // The object selected is the floor, we're in a teleportation scenario\r\n if (this._teleportationInitialized && this._isTeleportationFloor(hit.pickedMesh) && hit.pickedPoint) {\r\n // Moving the teleportation area to this targetted point\r\n //Raise onSelectedMeshUnselected observable if ray collided floor mesh/meshes and a non floor mesh was previously selected\r\n if (gazer._currentMeshSelected && !this._isTeleportationFloor(gazer._currentMeshSelected)) {\r\n this._notifySelectedMeshUnselected(gazer._currentMeshSelected);\r\n }\r\n gazer._currentMeshSelected = null;\r\n if (gazer._teleportationRequestInitiated) {\r\n this._moveTeleportationSelectorTo(hit, gazer, ray);\r\n }\r\n return;\r\n }\r\n // If not, we're in a selection scenario\r\n //this._teleportationAllowed = false;\r\n if (hit.pickedMesh !== gazer._currentMeshSelected) {\r\n if (this.meshSelectionPredicate(hit.pickedMesh)) {\r\n this.onNewMeshPicked.notifyObservers(hit);\r\n gazer._currentMeshSelected = hit.pickedMesh;\r\n if (hit.pickedMesh.isPickable && hit.pickedMesh.actionManager) {\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0, 0, 1));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.2, 0.2, 1));\r\n gazer._isActionableMesh = true;\r\n }\r\n else {\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n gazer._isActionableMesh = false;\r\n }\r\n try {\r\n this.onNewMeshSelected.notifyObservers(hit.pickedMesh);\r\n var gazerAsControllerGazer = gazer;\r\n if (gazerAsControllerGazer.webVRController) {\r\n this.onMeshSelectedWithController.notifyObservers({ mesh: hit.pickedMesh, controller: gazerAsControllerGazer.webVRController });\r\n }\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error while raising onNewMeshSelected or onMeshSelectedWithController: \" + err);\r\n }\r\n }\r\n else {\r\n this._notifySelectedMeshUnselected(gazer._currentMeshSelected);\r\n gazer._currentMeshSelected = null;\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n }\r\n }\r\n }\r\n else {\r\n this._notifySelectedMeshUnselected(gazer._currentMeshSelected);\r\n gazer._currentMeshSelected = null;\r\n //this._teleportationAllowed = false;\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n }\r\n };\r\n VRExperienceHelper.prototype._notifySelectedMeshUnselected = function (mesh) {\r\n if (mesh) {\r\n this.onSelectedMeshUnselected.notifyObservers(mesh);\r\n }\r\n };\r\n /**\r\n * Sets the color of the laser ray from the vr controllers.\r\n * @param color new color for the ray.\r\n */\r\n VRExperienceHelper.prototype.changeLaserColor = function (color) {\r\n if (!this.updateControllerLaserColor) {\r\n return;\r\n }\r\n if (this._leftController) {\r\n this._leftController._setLaserPointerColor(color);\r\n }\r\n if (this._rightController) {\r\n this._rightController._setLaserPointerColor(color);\r\n }\r\n };\r\n /**\r\n * Sets the color of the ray from the vr headsets gaze.\r\n * @param color new color for the ray.\r\n */\r\n VRExperienceHelper.prototype.changeGazeColor = function (color) {\r\n if (!this.updateGazeTrackerColor) {\r\n return;\r\n }\r\n if (!this._cameraGazer._gazeTracker.material) {\r\n return;\r\n }\r\n this._cameraGazer._gazeTracker.material.emissiveColor = color;\r\n if (this._leftController) {\r\n this._leftController._gazeTracker.material.emissiveColor = color;\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker.material.emissiveColor = color;\r\n }\r\n };\r\n /**\r\n * Exits VR and disposes of the vr experience helper\r\n */\r\n VRExperienceHelper.prototype.dispose = function () {\r\n if (this.isInVRMode) {\r\n this.exitVR();\r\n }\r\n if (this._postProcessMove) {\r\n this._postProcessMove.dispose();\r\n }\r\n if (this._webVRCamera) {\r\n this._webVRCamera.dispose();\r\n }\r\n if (this._vrDeviceOrientationCamera) {\r\n this._vrDeviceOrientationCamera.dispose();\r\n }\r\n if (!this._useCustomVRButton && this._btnVR && this._btnVR.parentNode) {\r\n document.body.removeChild(this._btnVR);\r\n }\r\n if (this._deviceOrientationCamera && (this._scene.activeCamera != this._deviceOrientationCamera)) {\r\n this._deviceOrientationCamera.dispose();\r\n }\r\n if (this._cameraGazer) {\r\n this._cameraGazer.dispose();\r\n }\r\n if (this._leftController) {\r\n this._leftController.dispose();\r\n }\r\n if (this._rightController) {\r\n this._rightController.dispose();\r\n }\r\n if (this._teleportationTarget) {\r\n this._teleportationTarget.dispose();\r\n }\r\n this._floorMeshesCollection = [];\r\n document.removeEventListener(\"keydown\", this._onKeyDown);\r\n window.removeEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n window.removeEventListener(\"resize\", this._onResize);\r\n document.removeEventListener(\"fullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"mozfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"webkitfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"msfullscreenchange\", this._onFullscreenChange);\r\n document.onmsfullscreenchange = null;\r\n this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChanged);\r\n this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart);\r\n this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete);\r\n window.removeEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected);\r\n this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected);\r\n this._scene.unregisterBeforeRender(this.beforeRender);\r\n };\r\n /**\r\n * Gets the name of the VRExperienceHelper class\r\n * @returns \"VRExperienceHelper\"\r\n */\r\n VRExperienceHelper.prototype.getClassName = function () {\r\n return \"VRExperienceHelper\";\r\n };\r\n return VRExperienceHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/webVRCamera.ts\":\n/*!***********************************!*\\\n !*** ./Cameras/VR/webVRCamera.ts ***!\n \\***********************************/\n/*! exports provided: WebVRFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return WebVRFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony import */ var _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Gamepads/Controllers/poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../PostProcesses/vrMultiviewToSingleviewPostProcess */ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\");\n/* harmony import */ var _RigModes_webVRRigMode__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../RigModes/webVRRigMode */ \"./Cameras/RigModes/webVRRigMode.ts\");\n/* harmony import */ var _Engines_Extensions_engine_webVR__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Engines/Extensions/engine.webVR */ \"./Engines/Extensions/engine.webVR.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n// Side effect import to add webvr support to engine\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].AddNodeConstructor(\"WebVRFreeCamera\", function (name, scene) {\r\n return function () { return new WebVRFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n_node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].AddNodeConstructor(\"WebVRGamepadCamera\", function (name, scene) {\r\n return function () { return new WebVRFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a WebVR camera.\r\n * The WebVR camera is Babylon's simple interface to interaction with Windows Mixed Reality, HTC Vive and Oculus Rift.\r\n * @example http://doc.babylonjs.com/how_to/webvr_camera\r\n */\r\nvar WebVRFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebVRFreeCamera, _super);\r\n /**\r\n * Instantiates a WebVRFreeCamera.\r\n * @param name The name of the WebVRFreeCamera\r\n * @param position The starting anchor position for the camera\r\n * @param scene The scene the camera belongs to\r\n * @param webVROptions a set of customizable options for the webVRCamera\r\n */\r\n function WebVRFreeCamera(name, position, scene, webVROptions) {\r\n if (webVROptions === void 0) { webVROptions = {}; }\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.webVROptions = webVROptions;\r\n /**\r\n * @hidden\r\n * The vrDisplay tied to the camera. See https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay\r\n */\r\n _this._vrDevice = null;\r\n /**\r\n * The rawPose of the vrDevice.\r\n */\r\n _this.rawPose = null;\r\n _this._specsVersion = \"1.1\";\r\n _this._attached = false;\r\n _this._descendants = [];\r\n // Represents device position and rotation in room space. Should only be used to help calculate babylon space values\r\n _this._deviceRoomPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n _this._deviceRoomRotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].Identity();\r\n _this._standingMatrix = null;\r\n /**\r\n * Represents device position in babylon space.\r\n */\r\n _this.devicePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n /**\r\n * Represents device rotation in babylon space.\r\n */\r\n _this.deviceRotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].Identity();\r\n /**\r\n * The scale of the device to be used when translating from device space to babylon space.\r\n */\r\n _this.deviceScaleFactor = 1;\r\n _this._deviceToWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n _this._worldToDevice = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n /**\r\n * References to the webVR controllers for the vrDevice.\r\n */\r\n _this.controllers = [];\r\n /**\r\n * Emits an event when a controller is attached.\r\n */\r\n _this.onControllersAttachedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Emits an event when a controller's mesh has been loaded;\r\n */\r\n _this.onControllerMeshLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Emits an event when the HMD's pose has been updated.\r\n */\r\n _this.onPoseUpdatedFromDeviceObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._poseSet = false;\r\n /**\r\n * If the rig cameras be used as parent instead of this camera.\r\n */\r\n _this.rigParenting = true;\r\n _this._defaultHeight = undefined;\r\n _this._htmlElementAttached = null;\r\n _this._detachIfAttached = function () {\r\n var vrDisplay = _this.getEngine().getVRDevice();\r\n if (vrDisplay && !vrDisplay.isPresenting && _this._htmlElementAttached) {\r\n _this.detachControl(_this._htmlElementAttached);\r\n }\r\n };\r\n _this._workingVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n _this._oneVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].One();\r\n _this._workingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n _this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"]();\r\n _this._cache.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n if (webVROptions.defaultHeight) {\r\n _this._defaultHeight = webVROptions.defaultHeight;\r\n _this.position.y = _this._defaultHeight;\r\n }\r\n _this.minZ = 0.1;\r\n //legacy support - the compensation boolean was removed.\r\n if (arguments.length === 5) {\r\n _this.webVROptions = arguments[4];\r\n }\r\n // default webVR options\r\n if (_this.webVROptions.trackPosition == undefined) {\r\n _this.webVROptions.trackPosition = true;\r\n }\r\n if (_this.webVROptions.controllerMeshes == undefined) {\r\n _this.webVROptions.controllerMeshes = true;\r\n }\r\n if (_this.webVROptions.defaultLightingOnControllers == undefined) {\r\n _this.webVROptions.defaultLightingOnControllers = true;\r\n }\r\n _this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"]();\r\n if (_this.webVROptions && _this.webVROptions.positionScale) {\r\n _this.deviceScaleFactor = _this.webVROptions.positionScale;\r\n }\r\n //enable VR\r\n var engine = _this.getEngine();\r\n _this._onVREnabled = function (success) { if (success) {\r\n _this.initControllers();\r\n } };\r\n engine.onVRRequestPresentComplete.add(_this._onVREnabled);\r\n engine.initWebVR().add(function (event) {\r\n if (!event.vrDisplay || _this._vrDevice === event.vrDisplay) {\r\n return;\r\n }\r\n _this._vrDevice = event.vrDisplay;\r\n //reset the rig parameters.\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_3__[\"Camera\"].RIG_MODE_WEBVR, { parentCamera: _this, vrDisplay: _this._vrDevice, frameData: _this._frameData, specs: _this._specsVersion });\r\n if (_this._attached) {\r\n _this.getEngine().enableVR();\r\n }\r\n });\r\n if (typeof (VRFrameData) !== \"undefined\") {\r\n _this._frameData = new VRFrameData();\r\n }\r\n if (webVROptions.useMultiview) {\r\n if (!_this.getScene().getEngine().getCaps().multiview) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"Multiview is not supported, falling back to standard rendering\");\r\n _this._useMultiviewToSingleView = false;\r\n }\r\n else {\r\n _this._useMultiviewToSingleView = true;\r\n _this._rigPostProcess = new _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"VRMultiviewToSingleviewPostProcess\"](\"VRMultiviewToSingleview\", _this, 1.0);\r\n }\r\n }\r\n /**\r\n * The idea behind the following lines:\r\n * objects that have the camera as parent should actually have the rig cameras as a parent.\r\n * BUT, each of those cameras has a different view matrix, which means that if we set the parent to the first rig camera,\r\n * the second will not show it correctly.\r\n *\r\n * To solve this - each object that has the camera as parent will be added to a protected array.\r\n * When the rig camera renders, it will take this array and set all of those to be its children.\r\n * This way, the right camera will be used as a parent, and the mesh will be rendered correctly.\r\n * Amazing!\r\n */\r\n scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n if (camera.parent === _this && _this.rigParenting) {\r\n _this._descendants = _this.getDescendants(true, function (n) {\r\n // don't take the cameras or the controllers!\r\n var isController = _this.controllers.some(function (controller) { return controller._mesh === n; });\r\n var isRigCamera = _this._rigCameras.indexOf(n) !== -1;\r\n return !isController && !isRigCamera;\r\n });\r\n _this._descendants.forEach(function (node) {\r\n node.parent = camera;\r\n });\r\n }\r\n });\r\n scene.onAfterCameraRenderObservable.add(function (camera) {\r\n if (camera.parent === _this && _this.rigParenting) {\r\n _this._descendants.forEach(function (node) {\r\n node.parent = _this;\r\n });\r\n }\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Gets the device distance from the ground in meters.\r\n * @returns the distance in meters from the vrDevice to ground in device space. If standing matrix is not supported for the vrDevice 0 is returned.\r\n */\r\n WebVRFreeCamera.prototype.deviceDistanceToRoomGround = function () {\r\n if (this._standingMatrix) {\r\n // Add standing matrix offset to get real offset from ground in room\r\n this._standingMatrix.getTranslationToRef(this._workingVector);\r\n return this._deviceRoomPosition.y + this._workingVector.y;\r\n }\r\n //If VRDisplay does not inform stage parameters and no default height is set we fallback to zero.\r\n return this._defaultHeight || 0;\r\n };\r\n /**\r\n * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.\r\n * @param callback will be called when the standing matrix is set. Callback parameter is if the standing matrix is supported.\r\n */\r\n WebVRFreeCamera.prototype.useStandingMatrix = function (callback) {\r\n var _this = this;\r\n if (callback === void 0) { callback = function (bool) { }; }\r\n // Use standing matrix if available\r\n this.getEngine().initWebVRAsync().then(function (result) {\r\n if (!result.vrDisplay || !result.vrDisplay.stageParameters || !result.vrDisplay.stageParameters.sittingToStandingTransform || !_this.webVROptions.trackPosition) {\r\n callback(false);\r\n }\r\n else {\r\n _this._standingMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"]();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromFloat32ArrayToRefScaled(result.vrDisplay.stageParameters.sittingToStandingTransform, 0, 1, _this._standingMatrix);\r\n if (!_this.getScene().useRightHandedSystem) {\r\n if (_this._standingMatrix) {\r\n _this._standingMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n }\r\n callback(true);\r\n }\r\n });\r\n };\r\n /**\r\n * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.\r\n * @returns A promise with a boolean set to if the standing matrix is supported.\r\n */\r\n WebVRFreeCamera.prototype.useStandingMatrixAsync = function () {\r\n var _this = this;\r\n return new Promise(function (res) {\r\n _this.useStandingMatrix(function (supported) {\r\n res(supported);\r\n });\r\n });\r\n };\r\n /**\r\n * Disposes the camera\r\n */\r\n WebVRFreeCamera.prototype.dispose = function () {\r\n this._detachIfAttached();\r\n this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled);\r\n if (this._updateCacheWhenTrackingDisabledObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver);\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets a vrController by name.\r\n * @param name The name of the controller to retreive\r\n * @returns the controller matching the name specified or null if not found\r\n */\r\n WebVRFreeCamera.prototype.getControllerByName = function (name) {\r\n for (var _i = 0, _a = this.controllers; _i < _a.length; _i++) {\r\n var gp = _a[_i];\r\n if (gp.hand === name) {\r\n return gp;\r\n }\r\n }\r\n return null;\r\n };\r\n Object.defineProperty(WebVRFreeCamera.prototype, \"leftController\", {\r\n /**\r\n * The controller corresponding to the users left hand.\r\n */\r\n get: function () {\r\n if (!this._leftController) {\r\n this._leftController = this.getControllerByName(\"left\");\r\n }\r\n return this._leftController;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebVRFreeCamera.prototype, \"rightController\", {\r\n /**\r\n * The controller corresponding to the users right hand.\r\n */\r\n get: function () {\r\n if (!this._rightController) {\r\n this._rightController = this.getControllerByName(\"right\");\r\n }\r\n return this._rightController;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Casts a ray forward from the vrCamera's gaze.\r\n * @param length Length of the ray (default: 100)\r\n * @returns the ray corresponding to the gaze\r\n */\r\n WebVRFreeCamera.prototype.getForwardRay = function (length) {\r\n if (length === void 0) { length = 100; }\r\n if (this.leftCamera) {\r\n // Use left eye to avoid computation to compute center on every call\r\n return _super.prototype.getForwardRay.call(this, length, this.leftCamera.getWorldMatrix(), this.leftCamera.globalPosition); // Need the actual rendered camera\r\n }\r\n else {\r\n return _super.prototype.getForwardRay.call(this, length);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Updates the camera based on device's frame data\r\n */\r\n WebVRFreeCamera.prototype._checkInputs = function () {\r\n if (this._vrDevice && this._vrDevice.isPresenting) {\r\n this._vrDevice.getFrameData(this._frameData);\r\n this.updateFromDevice(this._frameData.pose);\r\n }\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /**\r\n * Updates the poseControlled values based on the input device pose.\r\n * @param poseData Pose coming from the device\r\n */\r\n WebVRFreeCamera.prototype.updateFromDevice = function (poseData) {\r\n if (poseData && poseData.orientation && poseData.orientation.length === 4) {\r\n this.rawPose = poseData;\r\n this._deviceRoomRotationQuaternion.copyFromFloats(poseData.orientation[0], poseData.orientation[1], -poseData.orientation[2], -poseData.orientation[3]);\r\n if (this.getScene().useRightHandedSystem) {\r\n this._deviceRoomRotationQuaternion.z *= -1;\r\n this._deviceRoomRotationQuaternion.w *= -1;\r\n }\r\n if (this.webVROptions.trackPosition && this.rawPose.position) {\r\n this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2]);\r\n if (this.getScene().useRightHandedSystem) {\r\n this._deviceRoomPosition.z *= -1;\r\n }\r\n }\r\n this._poseSet = true;\r\n }\r\n };\r\n /**\r\n * WebVR's attach control will start broadcasting frames to the device.\r\n * Note that in certain browsers (chrome for example) this function must be called\r\n * within a user-interaction callback. Example:\r\n *
 scene.onPointerDown = function() { camera.attachControl(canvas); }
\r\n *\r\n * @param element html element to attach the vrDevice to\r\n * @param noPreventDefault prevent the default html element operation when attaching the vrDevice\r\n */\r\n WebVRFreeCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n _super.prototype.attachControl.call(this, element, noPreventDefault);\r\n this._attached = true;\r\n this._htmlElementAttached = element;\r\n noPreventDefault = _Cameras_camera__WEBPACK_IMPORTED_MODULE_3__[\"Camera\"].ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;\r\n if (this._vrDevice) {\r\n this.getEngine().enableVR();\r\n }\r\n var hostWindow = this._scene.getEngine().getHostWindow();\r\n hostWindow.addEventListener('vrdisplaypresentchange', this._detachIfAttached);\r\n };\r\n /**\r\n * Detaches the camera from the html element and disables VR\r\n *\r\n * @param element html element to detach from\r\n */\r\n WebVRFreeCamera.prototype.detachControl = function (element) {\r\n this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);\r\n this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);\r\n _super.prototype.detachControl.call(this, element);\r\n this._attached = false;\r\n this.getEngine().disableVR();\r\n window.removeEventListener('vrdisplaypresentchange', this._detachIfAttached);\r\n };\r\n /**\r\n * @returns the name of this class\r\n */\r\n WebVRFreeCamera.prototype.getClassName = function () {\r\n return \"WebVRFreeCamera\";\r\n };\r\n /**\r\n * Calls resetPose on the vrDisplay\r\n * See: https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/resetPose\r\n */\r\n WebVRFreeCamera.prototype.resetToCurrentRotation = function () {\r\n //uses the vrDisplay's \"resetPose()\".\r\n //pitch and roll won't be affected.\r\n this._vrDevice.resetPose();\r\n };\r\n /**\r\n * @hidden\r\n * Updates the rig cameras (left and right eye)\r\n */\r\n WebVRFreeCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n camLeft.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion);\r\n camLeft.position.copyFrom(this._deviceRoomPosition);\r\n camRight.position.copyFrom(this._deviceRoomPosition);\r\n };\r\n // Remove translation from 6dof headset if trackposition is set to false\r\n WebVRFreeCamera.prototype._correctPositionIfNotTrackPosition = function (matrix, isViewMatrix) {\r\n if (isViewMatrix === void 0) { isViewMatrix = false; }\r\n if (this.rawPose && this.rawPose.position && !this.webVROptions.trackPosition) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].TranslationToRef(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2], this._tmpMatrix);\r\n if (!isViewMatrix) {\r\n this._tmpMatrix.invert();\r\n }\r\n this._tmpMatrix.multiplyToRef(matrix, matrix);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Updates the cached values of the camera\r\n * @param ignoreParentClass ignores updating the parent class's cache (default: false)\r\n */\r\n WebVRFreeCamera.prototype._updateCache = function (ignoreParentClass) {\r\n var _this = this;\r\n if (!this.rotationQuaternion.equals(this._cache.rotationQuaternion) || !this.position.equals(this._cache.position)) {\r\n // Update to ensure devicePosition is up to date with most recent _deviceRoomPosition\r\n if (!this.updateCacheCalled) {\r\n // make sure it is only called once per loop. this.update() might cause an infinite loop.\r\n this.updateCacheCalled = true;\r\n this.update();\r\n }\r\n // Set working vector to the device position in room space rotated by the new rotation\r\n this.rotationQuaternion.toRotationMatrix(this._workingMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinatesToRef(this._deviceRoomPosition, this._workingMatrix, this._workingVector);\r\n // Subtract this vector from the current device position in world to get the translation for the device world matrix\r\n this.devicePosition.subtractToRef(this._workingVector, this._workingVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].ComposeToRef(this._oneVector, this.rotationQuaternion, this._workingVector, this._deviceToWorld);\r\n // Add translation from anchor position\r\n this._deviceToWorld.getTranslationToRef(this._workingVector);\r\n this._workingVector.addInPlace(this.position);\r\n this._workingVector.subtractInPlace(this._cache.position);\r\n this._deviceToWorld.setTranslation(this._workingVector);\r\n // Set an inverted matrix to be used when updating the camera\r\n this._deviceToWorld.invertToRef(this._worldToDevice);\r\n // Update the gamepad to ensure the mesh is updated on the same frame as camera\r\n this.controllers.forEach(function (controller) {\r\n controller._deviceToWorld.copyFrom(_this._deviceToWorld);\r\n _this._correctPositionIfNotTrackPosition(controller._deviceToWorld);\r\n controller.update();\r\n });\r\n }\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this.updateCacheCalled = false;\r\n };\r\n /**\r\n * @hidden\r\n * Get current device position in babylon world\r\n */\r\n WebVRFreeCamera.prototype._computeDevicePosition = function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinatesToRef(this._deviceRoomPosition, this._deviceToWorld, this.devicePosition);\r\n };\r\n /**\r\n * Updates the current device position and rotation in the babylon world\r\n */\r\n WebVRFreeCamera.prototype.update = function () {\r\n this._computeDevicePosition();\r\n // Get current device rotation in babylon world\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix);\r\n this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);\r\n if (this._poseSet) {\r\n this.onPoseUpdatedFromDeviceObservable.notifyObservers(null);\r\n }\r\n _super.prototype.update.call(this);\r\n };\r\n /**\r\n * @hidden\r\n * Gets the view matrix of this camera (Always set to identity as left and right eye cameras contain the actual view matrix)\r\n * @returns an identity matrix\r\n */\r\n WebVRFreeCamera.prototype._getViewMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n };\r\n /**\r\n * This function is called by the two RIG cameras.\r\n * 'this' is the left or right camera (and NOT (!!!) the WebVRFreeCamera instance)\r\n * @hidden\r\n */\r\n WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {\r\n // Update the parent camera prior to using a child camera to avoid desynchronization\r\n var parentCamera = this._cameraRigParams[\"parentCamera\"];\r\n parentCamera._updateCache();\r\n //WebVR 1.1\r\n var viewArray = this._cameraRigParams[\"left\"] ? this._cameraRigParams[\"frameData\"].leftViewMatrix : this._cameraRigParams[\"frameData\"].rightViewMatrix;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromArrayToRef(viewArray, 0, this._webvrViewMatrix);\r\n if (!this.getScene().useRightHandedSystem) {\r\n this._webvrViewMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n // update the camera rotation matrix\r\n this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n // should the view matrix be updated with scale and position offset?\r\n if (parentCamera.deviceScaleFactor !== 1) {\r\n this._webvrViewMatrix.invert();\r\n // scale the position, if set\r\n if (parentCamera.deviceScaleFactor) {\r\n this._webvrViewMatrix.multiplyAtIndex(12, parentCamera.deviceScaleFactor);\r\n this._webvrViewMatrix.multiplyAtIndex(13, parentCamera.deviceScaleFactor);\r\n this._webvrViewMatrix.multiplyAtIndex(14, parentCamera.deviceScaleFactor);\r\n }\r\n this._webvrViewMatrix.invert();\r\n }\r\n // Remove translation from 6dof headset if trackposition is set to false\r\n parentCamera._correctPositionIfNotTrackPosition(this._webvrViewMatrix, true);\r\n parentCamera._worldToDevice.multiplyToRef(this._webvrViewMatrix, this._webvrViewMatrix);\r\n // Compute global position\r\n this._workingMatrix = this._workingMatrix || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n this._webvrViewMatrix.invertToRef(this._workingMatrix);\r\n this._workingMatrix.multiplyToRef(parentCamera.getWorldMatrix(), this._workingMatrix);\r\n this._workingMatrix.getTranslationToRef(this._globalPosition);\r\n this._markSyncedWithParent();\r\n return this._webvrViewMatrix;\r\n };\r\n /** @hidden */\r\n WebVRFreeCamera.prototype._getWebVRProjectionMatrix = function () {\r\n var parentCamera = this.parent;\r\n parentCamera._vrDevice.depthNear = parentCamera.minZ;\r\n parentCamera._vrDevice.depthFar = parentCamera.maxZ;\r\n var projectionArray = this._cameraRigParams[\"left\"] ? this._cameraRigParams[\"frameData\"].leftProjectionMatrix : this._cameraRigParams[\"frameData\"].rightProjectionMatrix;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromArrayToRef(projectionArray, 0, this._projectionMatrix);\r\n //babylon compatible matrix\r\n if (!this.getScene().useRightHandedSystem) {\r\n this._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Initializes the controllers and their meshes\r\n */\r\n WebVRFreeCamera.prototype.initControllers = function () {\r\n var _this = this;\r\n this.controllers = [];\r\n var manager = this.getScene().gamepadManager;\r\n this._onGamepadDisconnectedObserver = manager.onGamepadDisconnectedObservable.add(function (gamepad) {\r\n if (gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"].POSE_ENABLED) {\r\n var webVrController = gamepad;\r\n if (webVrController.defaultModel) {\r\n webVrController.defaultModel.setEnabled(false);\r\n }\r\n if (webVrController.hand === \"right\") {\r\n _this._rightController = null;\r\n }\r\n if (webVrController.hand === \"left\") {\r\n _this._leftController = null;\r\n }\r\n var controllerIndex = _this.controllers.indexOf(webVrController);\r\n if (controllerIndex !== -1) {\r\n _this.controllers.splice(controllerIndex, 1);\r\n }\r\n }\r\n });\r\n this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {\r\n if (gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"].POSE_ENABLED) {\r\n var webVrController_1 = gamepad;\r\n if (!_this.webVROptions.trackPosition) {\r\n webVrController_1._disableTrackPosition(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](webVrController_1.hand == \"left\" ? -0.15 : 0.15, -0.5, 0.25));\r\n // Cache must be updated before rendering controllers to avoid them being one frame behind\r\n if (!_this._updateCacheWhenTrackingDisabledObserver) {\r\n _this._updateCacheWhenTrackingDisabledObserver = _this._scene.onBeforeRenderObservable.add(function () {\r\n _this._updateCache();\r\n });\r\n }\r\n }\r\n webVrController_1.deviceScaleFactor = _this.deviceScaleFactor;\r\n webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);\r\n _this._correctPositionIfNotTrackPosition(webVrController_1._deviceToWorld);\r\n if (_this.webVROptions.controllerMeshes) {\r\n if (webVrController_1.defaultModel) {\r\n webVrController_1.defaultModel.setEnabled(true);\r\n }\r\n else {\r\n // Load the meshes\r\n webVrController_1.initControllerMesh(_this.getScene(), function (loadedMesh) {\r\n loadedMesh.scaling.scaleInPlace(_this.deviceScaleFactor);\r\n _this.onControllerMeshLoadedObservable.notifyObservers(webVrController_1);\r\n if (_this.webVROptions.defaultLightingOnControllers) {\r\n if (!_this._lightOnControllers) {\r\n _this._lightOnControllers = new _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_8__[\"HemisphericLight\"](\"vrControllersLight\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](0, 1, 0), _this.getScene());\r\n }\r\n var activateLightOnSubMeshes_1 = function (mesh, light) {\r\n var children = mesh.getChildren();\r\n if (children && children.length !== 0) {\r\n children.forEach(function (mesh) {\r\n light.includedOnlyMeshes.push(mesh);\r\n activateLightOnSubMeshes_1(mesh, light);\r\n });\r\n }\r\n };\r\n _this._lightOnControllers.includedOnlyMeshes.push(loadedMesh);\r\n activateLightOnSubMeshes_1(loadedMesh, _this._lightOnControllers);\r\n }\r\n });\r\n }\r\n }\r\n webVrController_1.attachToPoseControlledCamera(_this);\r\n // since this is async - sanity check. Is the controller already stored?\r\n if (_this.controllers.indexOf(webVrController_1) === -1) {\r\n //add to the controllers array\r\n _this.controllers.push(webVrController_1);\r\n // Forced to add some control code for Vive as it doesn't always fill properly the \"hand\" property\r\n // Sometimes, both controllers are set correctly (left and right), sometimes none, sometimes only one of them...\r\n // So we're overriding setting left & right manually to be sure\r\n var firstViveWandDetected = false;\r\n for (var i = 0; i < _this.controllers.length; i++) {\r\n if (_this.controllers[i].controllerType === _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_6__[\"PoseEnabledControllerType\"].VIVE) {\r\n if (!firstViveWandDetected) {\r\n firstViveWandDetected = true;\r\n _this.controllers[i].hand = \"left\";\r\n }\r\n else {\r\n _this.controllers[i].hand = \"right\";\r\n }\r\n }\r\n }\r\n //did we find enough controllers? Great! let the developer know.\r\n if (_this.controllers.length >= 2) {\r\n _this.onControllersAttachedObservable.notifyObservers(_this.controllers);\r\n }\r\n }\r\n }\r\n });\r\n };\r\n return WebVRFreeCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/index.ts\":\n/*!*****************************!*\\\n !*** ./Cameras/XR/index.ts ***!\n \\*****************************/\n/*! exports provided: WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _webXRCamera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webXRCamera */ \"./Cameras/XR/webXRCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _webXRCamera__WEBPACK_IMPORTED_MODULE_0__[\"WebXRCamera\"]; });\n\n/* harmony import */ var _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webXREnterExitUI */ \"./Cameras/XR/webXREnterExitUI.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__[\"WebXREnterExitUI\"]; });\n\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRExperienceHelper\"]; });\n\n/* harmony import */ var _webXRInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webXRInput */ \"./Cameras/XR/webXRInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _webXRInput__WEBPACK_IMPORTED_MODULE_3__[\"WebXRInput\"]; });\n\n/* harmony import */ var _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webXRControllerTeleportation */ \"./Cameras/XR/webXRControllerTeleportation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony import */ var _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webXRControllerPointerSelection */ \"./Cameras/XR/webXRControllerPointerSelection.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_5__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony import */ var _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webXRControllerModelLoader */ \"./Cameras/XR/webXRControllerModelLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_6__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony import */ var _webXRController__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./webXRController */ \"./Cameras/XR/webXRController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _webXRController__WEBPACK_IMPORTED_MODULE_7__[\"WebXRController\"]; });\n\n/* harmony import */ var _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./webXRManagedOutputCanvas */ \"./Cameras/XR/webXRManagedOutputCanvas.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_8__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony import */ var _webXRSessionManager__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./webXRSessionManager */ \"./Cameras/XR/webXRSessionManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _webXRSessionManager__WEBPACK_IMPORTED_MODULE_9__[\"WebXRSessionManager\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRCamera.ts\":\n/*!***********************************!*\\\n !*** ./Cameras/XR/webXRCamera.ts ***!\n \\***********************************/\n/*! exports provided: WebXRCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return WebXRCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Cameras/targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n */\r\nvar WebXRCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebXRCamera, _super);\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n */\r\n function WebXRCamera(name, scene) {\r\n var _this = _super.call(this, name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), scene) || this;\r\n // Initial camera configuration\r\n _this.minZ = 0.1;\r\n _this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n _this.cameraRigMode = _Cameras_camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_CUSTOM;\r\n _this.updateUpVectorFromRotation = true;\r\n _this._updateNumberOfRigCameras(1);\r\n return _this;\r\n }\r\n WebXRCamera.prototype._updateNumberOfRigCameras = function (viewCount) {\r\n if (viewCount === void 0) { viewCount = 1; }\r\n while (this.rigCameras.length < viewCount) {\r\n var newCamera = new _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"](\"view: \" + this.rigCameras.length, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.parent = this;\r\n newCamera.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n newCamera.updateUpVectorFromRotation = true;\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n var removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n WebXRCamera.prototype._updateForDualEyeDebugging = function (pupilDistance) {\r\n if (pupilDistance === void 0) { pupilDistance = 0.01; }\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_5__[\"Viewport\"](0, 0, 0.5, 1.0);\r\n this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_5__[\"Viewport\"](0.5, 0, 0.5, 1.0);\r\n this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n };\r\n /**\r\n * Updates the cameras position from the current pose information of the XR session\r\n * @param xrSessionManager the session containing pose information\r\n * @returns true if the camera has been updated, false if the session did not contain pose or frame data\r\n */\r\n WebXRCamera.prototype.updateFromXRSessionManager = function (xrSessionManager) {\r\n var _this = this;\r\n // Ensure all frame data is available\r\n if (!xrSessionManager.currentFrame || !xrSessionManager.currentFrame.getViewerPose) {\r\n return false;\r\n }\r\n var pose = xrSessionManager.currentFrame.getViewerPose(xrSessionManager.referenceSpace);\r\n if (!pose || !pose.transform || !pose.transform.matrix) {\r\n return false;\r\n }\r\n // Update the parent cameras matrix\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromFloat32ArrayToRefScaled(pose.transform.matrix, 0, 1, WebXRCamera._TmpMatrix);\r\n if (!this._scene.useRightHandedSystem) {\r\n WebXRCamera._TmpMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n WebXRCamera._TmpMatrix.getTranslationToRef(this.position);\r\n WebXRCamera._TmpMatrix.getRotationMatrixToRef(WebXRCamera._TmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromRotationMatrixToRef(WebXRCamera._TmpMatrix, this.rotationQuaternion);\r\n this.computeWorldMatrix();\r\n // Update camera rigs\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n pose.views.forEach(function (view, i) {\r\n // Update view/projection matrix\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromFloat32ArrayToRefScaled(view.transform.matrix, 0, 1, _this.rigCameras[i]._computedViewMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, _this.rigCameras[i]._projectionMatrix);\r\n if (!_this._scene.useRightHandedSystem) {\r\n _this.rigCameras[i]._computedViewMatrix.toggleModelMatrixHandInPlace();\r\n _this.rigCameras[i]._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n // Update viewport\r\n if (xrSessionManager.session.renderState.baseLayer) {\r\n var viewport = xrSessionManager.session.renderState.baseLayer.getViewport(view);\r\n var width = xrSessionManager.session.renderState.baseLayer.framebufferWidth;\r\n var height = xrSessionManager.session.renderState.baseLayer.framebufferHeight;\r\n _this.rigCameras[i].viewport.width = viewport.width / width;\r\n _this.rigCameras[i].viewport.height = viewport.height / height;\r\n _this.rigCameras[i].viewport.x = viewport.x / width;\r\n _this.rigCameras[i].viewport.y = viewport.y / height;\r\n }\r\n // Set cameras to render to the session's render target\r\n _this.rigCameras[i].outputRenderTarget = xrSessionManager._sessionRenderTargetTexture;\r\n });\r\n return true;\r\n };\r\n WebXRCamera._TmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n return WebXRCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRController.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/XR/webXRController.ts ***!\n \\***************************************/\n/*! exports provided: WebXRController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return WebXRController; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n/**\r\n * Represents an XR input\r\n */\r\nvar WebXRController = /** @class */ (function () {\r\n /**\r\n * Creates the controller\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n * @param scene the scene which the controller should be associated to\r\n * @param inputSource the underlying input source for the controller\r\n * @param parentContainer parent that the controller meshes should be children of\r\n */\r\n function WebXRController(scene, \r\n /** The underlying input source for the controller */\r\n inputSource, parentContainer) {\r\n if (parentContainer === void 0) { parentContainer = null; }\r\n this.scene = scene;\r\n this.inputSource = inputSource;\r\n this.parentContainer = parentContainer;\r\n /**\r\n * Event that fires when the controller is removed/disposed\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n this.pointer = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"](\"controllerPointer\", scene);\r\n if (parentContainer) {\r\n parentContainer.addChild(this.pointer);\r\n }\r\n if (this.inputSource.gripSpace) {\r\n this.grip = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"](\"controllerGrip\", this.scene);\r\n if (this.parentContainer) {\r\n this.parentContainer.addChild(this.grip);\r\n }\r\n }\r\n }\r\n /**\r\n * Updates the controller pose based on the given XRFrame\r\n * @param xrFrame xr frame to update the pose with\r\n * @param referenceSpace reference space to use\r\n */\r\n WebXRController.prototype.updateFromXRFrame = function (xrFrame, referenceSpace) {\r\n var pose = xrFrame.getPose(this.inputSource.targetRaySpace, referenceSpace);\r\n // Update the pointer mesh\r\n if (pose) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromFloat32ArrayToRefScaled(pose.transform.matrix, 0, 1, this._tmpMatrix);\r\n if (!this.pointer.getScene().useRightHandedSystem) {\r\n this._tmpMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n if (!this.pointer.rotationQuaternion) {\r\n this.pointer.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._tmpMatrix.decompose(this.pointer.scaling, this.pointer.rotationQuaternion, this.pointer.position);\r\n }\r\n // Update the grip mesh if it exists\r\n if (this.inputSource.gripSpace && this.grip) {\r\n var pose_1 = xrFrame.getPose(this.inputSource.gripSpace, referenceSpace);\r\n if (pose_1) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromFloat32ArrayToRefScaled(pose_1.transform.matrix, 0, 1, this._tmpMatrix);\r\n if (!this.grip.getScene().useRightHandedSystem) {\r\n this._tmpMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n if (!this.grip.rotationQuaternion) {\r\n this.grip.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._tmpMatrix.decompose(this.grip.scaling, this.grip.rotationQuaternion, this.grip.position);\r\n }\r\n }\r\n };\r\n /**\r\n * Gets a world space ray coming from the controller\r\n * @param result the resulting ray\r\n */\r\n WebXRController.prototype.getWorldPointerRayToRef = function (result) {\r\n // Force update to ensure picked point is synced with ray\r\n var worldMatrix = this.pointer.computeWorldMatrix(true);\r\n worldMatrix.decompose(undefined, this._tmpQuaternion, undefined);\r\n this._tmpVector.set(0, 0, 1);\r\n this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion, this._tmpVector);\r\n result.origin = this.pointer.absolutePosition;\r\n result.direction.copyFrom(this._tmpVector);\r\n result.length = 1000;\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXRController.prototype.dispose = function () {\r\n if (this.grip) {\r\n this.grip.dispose();\r\n }\r\n this.pointer.dispose();\r\n this.onDisposeObservable.notifyObservers({});\r\n };\r\n return WebXRController;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRControllerModelLoader.ts\":\n/*!**************************************************!*\\\n !*** ./Cameras/XR/webXRControllerModelLoader.ts ***!\n \\**************************************************/\n/*! exports provided: WebXRControllerModelLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return WebXRControllerModelLoader; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Gamepads_Controllers_windowsMotionController__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Gamepads/Controllers/windowsMotionController */ \"./Gamepads/Controllers/windowsMotionController.ts\");\n/* harmony import */ var _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Gamepads/Controllers/oculusTouchController */ \"./Gamepads/Controllers/oculusTouchController.ts\");\n/* harmony import */ var _Gamepads_Controllers_viveController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Gamepads/Controllers/viveController */ \"./Gamepads/Controllers/viveController.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Loads a controller model and adds it as a child of the WebXRControllers grip when the controller is created\r\n */\r\nvar WebXRControllerModelLoader = /** @class */ (function () {\r\n /**\r\n * Creates the WebXRControllerModelLoader\r\n * @param input xr input that creates the controllers\r\n */\r\n function WebXRControllerModelLoader(input) {\r\n input.onControllerAddedObservable.add(function (c) {\r\n if (c.inputSource.gamepad && c.inputSource.gamepad.id === \"htc-vive\") {\r\n var controllerModel_1 = new _Gamepads_Controllers_viveController__WEBPACK_IMPORTED_MODULE_3__[\"ViveController\"](c.inputSource.gamepad);\r\n controllerModel_1.hand = c.inputSource.handedness;\r\n controllerModel_1.isXR = true;\r\n controllerModel_1.initControllerMesh(c.grip.getScene(), function (m) {\r\n m.isPickable = false;\r\n m.getChildMeshes(false).forEach(function (m) {\r\n m.isPickable = false;\r\n });\r\n controllerModel_1.mesh.parent = c.grip;\r\n controllerModel_1.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI, 0);\r\n });\r\n }\r\n else if (c.inputSource.gamepad && c.inputSource.gamepad.id === \"oculus-touch\") {\r\n var controllerModel_2 = new _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__[\"OculusTouchController\"](c.inputSource.gamepad);\r\n controllerModel_2.hand = c.inputSource.handedness;\r\n controllerModel_2.isXR = true;\r\n controllerModel_2.initControllerMesh(c.grip.getScene(), function (m) {\r\n controllerModel_2.mesh.parent = c.grip;\r\n controllerModel_2.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI, 0);\r\n controllerModel_2.mesh.position.y = 0.034;\r\n controllerModel_2.mesh.position.z = 0.052;\r\n });\r\n }\r\n else if (c.inputSource.gamepad && c.inputSource.gamepad.id === \"oculus-quest\") {\r\n _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__[\"OculusTouchController\"]._IsQuest = true;\r\n var controllerModel_3 = new _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__[\"OculusTouchController\"](c.inputSource.gamepad);\r\n controllerModel_3.hand = c.inputSource.handedness;\r\n controllerModel_3.isXR = true;\r\n controllerModel_3.initControllerMesh(c.grip.getScene(), function (m) {\r\n controllerModel_3.mesh.parent = c.grip;\r\n controllerModel_3.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(Math.PI / -4, Math.PI, 0);\r\n });\r\n }\r\n else {\r\n var controllerModel_4 = new _Gamepads_Controllers_windowsMotionController__WEBPACK_IMPORTED_MODULE_1__[\"WindowsMotionController\"](c.inputSource.gamepad);\r\n controllerModel_4.hand = c.inputSource.handedness;\r\n controllerModel_4.isXR = true;\r\n controllerModel_4.initControllerMesh(c.grip.getScene(), function (m) {\r\n controllerModel_4.mesh.parent = c.grip;\r\n controllerModel_4.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI, 0);\r\n });\r\n }\r\n });\r\n }\r\n return WebXRControllerModelLoader;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRControllerPointerSelection.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/XR/webXRControllerPointerSelection.ts ***!\n \\*******************************************************/\n/*! exports provided: WebXRControllerPointerSelection */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return WebXRControllerPointerSelection; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Handles pointer input automatically for the pointer of XR controllers\r\n */\r\nvar WebXRControllerPointerSelection = /** @class */ (function () {\r\n /**\r\n * Creates a WebXRControllerPointerSelection\r\n * @param input input manager to setup pointer selection\r\n */\r\n function WebXRControllerPointerSelection(input) {\r\n var _this = this;\r\n this._tmpRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]());\r\n input.onControllerAddedObservable.add(function (controller) {\r\n var scene = controller.pointer.getScene();\r\n var laserPointer;\r\n var cursorMesh;\r\n var triggerDown = false;\r\n var id;\r\n id = WebXRControllerPointerSelection._idCounter++;\r\n // Create a laser pointer for the XR controller\r\n laserPointer = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateCylinder(\"laserPointer\", 1, 0.0002, 0.004, 20, 1, scene, false);\r\n laserPointer.parent = controller.pointer;\r\n var laserPointerMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__[\"StandardMaterial\"](\"laserPointerMat\", scene);\r\n laserPointerMaterial.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.7, 0.7, 0.7);\r\n laserPointerMaterial.alpha = 0.6;\r\n laserPointer.material = laserPointerMaterial;\r\n laserPointer.rotation.x = Math.PI / 2;\r\n _this._updatePointerDistance(laserPointer, 1);\r\n laserPointer.isPickable = false;\r\n // Create a gaze tracker for the XR controlelr\r\n cursorMesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorus(\"gazeTracker\", 0.0035 * 3, 0.0025 * 3, 20, scene, false);\r\n cursorMesh.bakeCurrentTransformIntoVertices();\r\n cursorMesh.isPickable = false;\r\n cursorMesh.isVisible = false;\r\n var targetMat = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__[\"StandardMaterial\"](\"targetMat\", scene);\r\n targetMat.specularColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Black();\r\n targetMat.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.7, 0.7, 0.7);\r\n targetMat.backFaceCulling = false;\r\n cursorMesh.material = targetMat;\r\n var renderObserver = scene.onBeforeRenderObservable.add(function () {\r\n // Every frame check collisions/input\r\n controller.getWorldPointerRayToRef(_this._tmpRay);\r\n var pick = scene.pickWithRay(_this._tmpRay);\r\n if (pick) {\r\n if (controller.inputSource.gamepad && controller.inputSource.gamepad.buttons[0] && controller.inputSource.gamepad.buttons[0].value > 0.7) {\r\n if (!triggerDown) {\r\n scene.simulatePointerDown(pick, { pointerId: id });\r\n }\r\n triggerDown = true;\r\n }\r\n else {\r\n if (triggerDown) {\r\n scene.simulatePointerUp(pick, { pointerId: id });\r\n }\r\n triggerDown = false;\r\n }\r\n scene.simulatePointerMove(pick, { pointerId: id });\r\n }\r\n if (pick && pick.pickedPoint && pick.hit) {\r\n // Update laser state\r\n _this._updatePointerDistance(laserPointer, pick.distance);\r\n // Update cursor state\r\n cursorMesh.position.copyFrom(pick.pickedPoint);\r\n cursorMesh.scaling.x = Math.sqrt(pick.distance);\r\n cursorMesh.scaling.y = Math.sqrt(pick.distance);\r\n cursorMesh.scaling.z = Math.sqrt(pick.distance);\r\n // To avoid z-fighting\r\n var pickNormal = _this._convertNormalToDirectionOfRay(pick.getNormal(), _this._tmpRay);\r\n var deltaFighting = 0.002;\r\n cursorMesh.position.copyFrom(pick.pickedPoint);\r\n if (pickNormal) {\r\n var axis1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y, pickNormal);\r\n var axis2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(pickNormal, axis1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].RotationFromAxisToRef(axis2, pickNormal, axis1, cursorMesh.rotation);\r\n cursorMesh.position.addInPlace(pickNormal.scale(deltaFighting));\r\n }\r\n cursorMesh.isVisible = true;\r\n }\r\n else {\r\n cursorMesh.isVisible = false;\r\n }\r\n });\r\n controller.onDisposeObservable.addOnce(function () {\r\n laserPointer.dispose();\r\n cursorMesh.dispose();\r\n scene.onBeforeRenderObservable.remove(renderObserver);\r\n });\r\n });\r\n }\r\n WebXRControllerPointerSelection.prototype._convertNormalToDirectionOfRay = function (normal, ray) {\r\n if (normal) {\r\n var angle = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(normal, ray.direction));\r\n if (angle < Math.PI / 2) {\r\n normal.scaleInPlace(-1);\r\n }\r\n }\r\n return normal;\r\n };\r\n WebXRControllerPointerSelection.prototype._updatePointerDistance = function (_laserPointer, distance) {\r\n if (distance === void 0) { distance = 100; }\r\n _laserPointer.scaling.y = distance;\r\n _laserPointer.position.z = distance / 2;\r\n };\r\n WebXRControllerPointerSelection._idCounter = 0;\r\n return WebXRControllerPointerSelection;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRControllerTeleportation.ts\":\n/*!****************************************************!*\\\n !*** ./Cameras/XR/webXRControllerTeleportation.ts ***!\n \\****************************************************/\n/*! exports provided: WebXRControllerTeleportation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return WebXRControllerTeleportation; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Enables teleportation\r\n */\r\nvar WebXRControllerTeleportation = /** @class */ (function () {\r\n /**\r\n * Creates a WebXRControllerTeleportation\r\n * @param input input manager to add teleportation to\r\n * @param floorMeshes floormeshes which can be teleported to\r\n */\r\n function WebXRControllerTeleportation(input, floorMeshes) {\r\n var _this = this;\r\n if (floorMeshes === void 0) { floorMeshes = []; }\r\n this._teleportationFillColor = \"#444444\";\r\n this._teleportationBorderColor = \"#FFFFFF\";\r\n this._tmpRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]());\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n input.onControllerAddedObservable.add(function (c) {\r\n var scene = c.pointer.getScene();\r\n var forwardReadyToTeleport = false;\r\n var backwardReadyToTeleport = false;\r\n var leftReadyToTeleport = false;\r\n var rightReadyToTeleport = false;\r\n // Teleport target abd it's animation\r\n var teleportationTarget = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateGround(\"teleportationTarget\", 2, 2, 2, scene);\r\n teleportationTarget.isPickable = false;\r\n var length = 512;\r\n var dynamicTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_4__[\"DynamicTexture\"](\"DynamicTexture\", length, scene, true);\r\n dynamicTexture.hasAlpha = true;\r\n var context = dynamicTexture.getContext();\r\n var centerX = length / 2;\r\n var centerY = length / 2;\r\n var radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = _this._teleportationFillColor;\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = _this._teleportationBorderColor;\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n var teleportationCircleMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__[\"StandardMaterial\"](\"TextPlaneMaterial\", scene);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n teleportationTarget.material = teleportationCircleMaterial;\r\n var torus = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorus(\"torusTeleportation\", 0.75, 0.1, 25, scene, false);\r\n torus.isPickable = false;\r\n torus.parent = teleportationTarget;\r\n var animationInnerCircle = new _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"](\"animationInnerCircle\", \"position.y\", 30, _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE);\r\n var keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n var easingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_5__[\"SineEase\"]();\r\n easingFunction.setEasingMode(_Animations_easing__WEBPACK_IMPORTED_MODULE_5__[\"EasingFunction\"].EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n scene.beginAnimation(torus, 0, 60, true);\r\n // Handle user input on every frame\r\n var renderObserver = scene.onBeforeRenderObservable.add(function () {\r\n // Move the teleportationTarget to where the user is targetting to teleport to\r\n if (forwardReadyToTeleport) {\r\n c.getWorldPointerRayToRef(_this._tmpRay);\r\n var pick = scene.pickWithRay(_this._tmpRay, function (o) {\r\n return floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedPoint) {\r\n // To avoid z-fighting\r\n teleportationTarget.position.copyFrom(pick.pickedPoint);\r\n teleportationTarget.position.y += 0.002;\r\n }\r\n teleportationTarget.isVisible = true;\r\n teleportationTarget.getChildren()[0].isVisible = true;\r\n }\r\n else {\r\n teleportationTarget.isVisible = false;\r\n teleportationTarget.getChildren()[0].isVisible = false;\r\n }\r\n if (c.inputSource.gamepad) {\r\n if (c.inputSource.gamepad.axes[1] !== undefined) {\r\n // Forward teleportation\r\n if (c.inputSource.gamepad.axes[1] < -0.7) {\r\n forwardReadyToTeleport = true;\r\n }\r\n else {\r\n if (forwardReadyToTeleport) {\r\n // Teleport the users feet to where they targetted\r\n _this._tmpVector.copyFrom(teleportationTarget.position);\r\n _this._tmpVector.y += input.baseExperience.camera.position.y;\r\n input.baseExperience.setPositionOfCameraUsingContainer(_this._tmpVector);\r\n }\r\n forwardReadyToTeleport = false;\r\n }\r\n // Backward teleportation\r\n if (c.inputSource.gamepad.axes[1] > 0.7) {\r\n backwardReadyToTeleport = true;\r\n }\r\n else {\r\n if (backwardReadyToTeleport) {\r\n // Cast a ray down from behind the user\r\n var camMat = input.baseExperience.camera.computeWorldMatrix();\r\n var q = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]();\r\n camMat.decompose(undefined, q, _this._tmpRay.origin);\r\n _this._tmpVector.set(0, 0, -1);\r\n _this._tmpVector.rotateByQuaternionToRef(q, _this._tmpVector);\r\n _this._tmpVector.y = 0;\r\n _this._tmpVector.normalize();\r\n _this._tmpVector.y = -1.5;\r\n _this._tmpVector.normalize();\r\n _this._tmpRay.direction.copyFrom(_this._tmpVector);\r\n var pick = scene.pickWithRay(_this._tmpRay, function (o) {\r\n return floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedPoint) {\r\n // Teleport the users feet to where they targetted\r\n _this._tmpVector.copyFrom(pick.pickedPoint);\r\n _this._tmpVector.y += input.baseExperience.camera.position.y;\r\n input.baseExperience.setPositionOfCameraUsingContainer(_this._tmpVector);\r\n }\r\n }\r\n backwardReadyToTeleport = false;\r\n }\r\n }\r\n if (c.inputSource.gamepad.axes[0] !== undefined) {\r\n if (c.inputSource.gamepad.axes[0] < -0.7) {\r\n leftReadyToTeleport = true;\r\n }\r\n else {\r\n if (leftReadyToTeleport) {\r\n input.baseExperience.rotateCameraByQuaternionUsingContainer(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, -Math.PI / 4, 0));\r\n }\r\n leftReadyToTeleport = false;\r\n }\r\n if (c.inputSource.gamepad.axes[0] > 0.7) {\r\n rightReadyToTeleport = true;\r\n }\r\n else {\r\n if (rightReadyToTeleport) {\r\n input.baseExperience.rotateCameraByQuaternionUsingContainer(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI / 4, 0));\r\n }\r\n rightReadyToTeleport = false;\r\n }\r\n }\r\n }\r\n });\r\n c.onDisposeObservable.addOnce(function () {\r\n teleportationTarget.dispose();\r\n dynamicTexture.dispose();\r\n teleportationCircleMaterial.dispose();\r\n torus.dispose();\r\n scene.onBeforeRenderObservable.remove(renderObserver);\r\n });\r\n });\r\n }\r\n return WebXRControllerTeleportation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRDefaultExperience.ts\":\n/*!**********************************************!*\\\n !*** ./Cameras/XR/webXRDefaultExperience.ts ***!\n \\**********************************************/\n/*! exports provided: WebXRDefaultExperienceOptions, WebXRDefaultExperience */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRDefaultExperienceOptions\", function() { return WebXRDefaultExperienceOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRDefaultExperience\", function() { return WebXRDefaultExperience; });\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n/* harmony import */ var _webXRInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webXRInput */ \"./Cameras/XR/webXRInput.ts\");\n/* harmony import */ var _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRControllerModelLoader */ \"./Cameras/XR/webXRControllerModelLoader.ts\");\n/* harmony import */ var _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webXRControllerPointerSelection */ \"./Cameras/XR/webXRControllerPointerSelection.ts\");\n/* harmony import */ var _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webXRControllerTeleportation */ \"./Cameras/XR/webXRControllerTeleportation.ts\");\n/* harmony import */ var _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webXRManagedOutputCanvas */ \"./Cameras/XR/webXRManagedOutputCanvas.ts\");\n/* harmony import */ var _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webXREnterExitUI */ \"./Cameras/XR/webXREnterExitUI.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Options for the default xr helper\r\n */\r\nvar WebXRDefaultExperienceOptions = /** @class */ (function () {\r\n function WebXRDefaultExperienceOptions() {\r\n }\r\n return WebXRDefaultExperienceOptions;\r\n}());\r\n\r\n/**\r\n * Default experience which provides a similar setup to the previous webVRExperience\r\n */\r\nvar WebXRDefaultExperience = /** @class */ (function () {\r\n function WebXRDefaultExperience() {\r\n }\r\n /**\r\n * Creates the default xr experience\r\n * @param scene scene\r\n * @param options options for basic configuration\r\n * @returns resulting WebXRDefaultExperience\r\n */\r\n WebXRDefaultExperience.CreateAsync = function (scene, options) {\r\n var result = new WebXRDefaultExperience();\r\n // Create base experience\r\n return _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__[\"WebXRExperienceHelper\"].CreateAsync(scene).then(function (xrHelper) {\r\n result.baseExperience = xrHelper;\r\n // Add controller support\r\n result.input = new _webXRInput__WEBPACK_IMPORTED_MODULE_1__[\"WebXRInput\"](xrHelper);\r\n result.controllerModelLoader = new _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_2__[\"WebXRControllerModelLoader\"](result.input);\r\n result.pointerSelection = new _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_3__[\"WebXRControllerPointerSelection\"](result.input);\r\n result.teleportation = new _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__[\"WebXRControllerTeleportation\"](result.input, options.floorMeshes);\r\n // Create output canvas manager (this controls where the xr frames will be rendered)\r\n result.outputCanvas = new _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_5__[\"WebXRManagedOutputCanvas\"](xrHelper, scene.getEngine().getRenderingCanvas());\r\n // Create ui for entering/exiting xr\r\n return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_6__[\"WebXREnterExitUI\"].CreateAsync(scene, result.baseExperience, { webXRManagedOutputCanvas: result.outputCanvas });\r\n }).then(function (ui) {\r\n result.enterExitUI = ui;\r\n return result;\r\n });\r\n };\r\n /**\r\n * DIsposes of the experience helper\r\n */\r\n WebXRDefaultExperience.prototype.dispose = function () {\r\n if (this.baseExperience) {\r\n this.baseExperience.dispose();\r\n }\r\n if (this.input) {\r\n this.input.dispose();\r\n }\r\n if (this.enterExitUI) {\r\n this.enterExitUI.dispose();\r\n }\r\n if (this.outputCanvas) {\r\n this.outputCanvas.dispose();\r\n }\r\n };\r\n return WebXRDefaultExperience;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXREnterExitUI.ts\":\n/*!****************************************!*\\\n !*** ./Cameras/XR/webXREnterExitUI.ts ***!\n \\****************************************/\n/*! exports provided: WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return WebXREnterExitUIButton; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return WebXREnterExitUIOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return WebXREnterExitUI; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n\r\n\r\n\r\n/**\r\n * Button which can be used to enter a different mode of XR\r\n */\r\nvar WebXREnterExitUIButton = /** @class */ (function () {\r\n /**\r\n * Creates a WebXREnterExitUIButton\r\n * @param element button element\r\n * @param sessionMode XR initialization session mode\r\n * @param referenceSpaceType the type of reference space to be used\r\n */\r\n function WebXREnterExitUIButton(\r\n /** button element */\r\n element, \r\n /** XR initialization options for the button */\r\n sessionMode, \r\n /** Reference space type */\r\n referenceSpaceType) {\r\n this.element = element;\r\n this.sessionMode = sessionMode;\r\n this.referenceSpaceType = referenceSpaceType;\r\n }\r\n /**\r\n * Overwritable function which can be used to update the button's visuals when the state changes\r\n * @param activeButton the current active button in the UI\r\n */\r\n WebXREnterExitUIButton.prototype.update = function (activeButton) {\r\n };\r\n return WebXREnterExitUIButton;\r\n}());\r\n\r\n/**\r\n * Options to create the webXR UI\r\n */\r\nvar WebXREnterExitUIOptions = /** @class */ (function () {\r\n function WebXREnterExitUIOptions() {\r\n }\r\n return WebXREnterExitUIOptions;\r\n}());\r\n\r\n/**\r\n * UI to allow the user to enter/exit XR mode\r\n */\r\nvar WebXREnterExitUI = /** @class */ (function () {\r\n function WebXREnterExitUI(scene, options) {\r\n var _this = this;\r\n this.scene = scene;\r\n this._buttons = [];\r\n this._activeButton = null;\r\n /**\r\n * Fired every time the active button is changed.\r\n *\r\n * When xr is entered via a button that launches xr that button will be the callback parameter\r\n *\r\n * When exiting xr the callback parameter will be null)\r\n */\r\n this.activeButtonChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._overlay = document.createElement(\"div\");\r\n this._overlay.style.cssText = \"z-index:11;position: absolute; right: 20px;bottom: 50px;\";\r\n if (options.customButtons) {\r\n this._buttons = options.customButtons;\r\n }\r\n else {\r\n var hmdBtn = document.createElement(\"button\");\r\n hmdBtn.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;\";\r\n hmdBtn.innerText = \"HMD\";\r\n this._buttons.push(new WebXREnterExitUIButton(hmdBtn, \"immersive-vr\", \"local-floor\"));\r\n this._buttons[this._buttons.length - 1].update = function (activeButton) {\r\n this.element.style.display = (activeButton === null || activeButton === this) ? \"\" : \"none\";\r\n this.element.innerText = activeButton === this ? \"EXIT\" : \"HMD\";\r\n };\r\n this._updateButtons(null);\r\n }\r\n var renderCanvas = scene.getEngine().getRenderingCanvas();\r\n if (renderCanvas && renderCanvas.parentNode) {\r\n renderCanvas.parentNode.appendChild(this._overlay);\r\n scene.onDisposeObservable.addOnce(function () {\r\n _this.dispose();\r\n });\r\n }\r\n }\r\n /**\r\n * Creates UI to allow the user to enter/exit XR mode\r\n * @param scene the scene to add the ui to\r\n * @param helper the xr experience helper to enter/exit xr with\r\n * @param options options to configure the UI\r\n * @returns the created ui\r\n */\r\n WebXREnterExitUI.CreateAsync = function (scene, helper, options) {\r\n var _this = this;\r\n var ui = new WebXREnterExitUI(scene, options);\r\n var supportedPromises = ui._buttons.map(function (btn) {\r\n return helper.sessionManager.supportsSessionAsync(btn.sessionMode);\r\n });\r\n helper.onStateChangedObservable.add(function (state) {\r\n if (state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"].NOT_IN_XR) {\r\n ui._updateButtons(null);\r\n }\r\n });\r\n return Promise.all(supportedPromises).then(function (results) {\r\n results.forEach(function (supported, i) {\r\n if (supported) {\r\n ui._overlay.appendChild(ui._buttons[i].element);\r\n ui._buttons[i].element.onclick = function () { return tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"](_this, void 0, void 0, function () {\r\n return tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"](this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!(helper.state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"].IN_XR)) return [3 /*break*/, 2];\r\n ui._updateButtons(null);\r\n return [4 /*yield*/, helper.exitXRAsync()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n case 2:\r\n if (!(helper.state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"].NOT_IN_XR)) return [3 /*break*/, 4];\r\n ui._updateButtons(ui._buttons[i]);\r\n if (!options.webXRManagedOutputCanvas) return [3 /*break*/, 4];\r\n return [4 /*yield*/, helper.enterXRAsync(ui._buttons[i].sessionMode, ui._buttons[i].referenceSpaceType, options.webXRManagedOutputCanvas)];\r\n case 3:\r\n _a.sent();\r\n _a.label = 4;\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n }); };\r\n }\r\n });\r\n return ui;\r\n });\r\n };\r\n WebXREnterExitUI.prototype._updateButtons = function (activeButton) {\r\n var _this = this;\r\n this._activeButton = activeButton;\r\n this._buttons.forEach(function (b) {\r\n b.update(_this._activeButton);\r\n });\r\n this.activeButtonChangedObservable.notifyObservers(this._activeButton);\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXREnterExitUI.prototype.dispose = function () {\r\n var renderCanvas = this.scene.getEngine().getRenderingCanvas();\r\n if (renderCanvas && renderCanvas.parentNode && renderCanvas.parentNode.contains(this._overlay)) {\r\n renderCanvas.parentNode.removeChild(this._overlay);\r\n }\r\n this.activeButtonChangedObservable.clear();\r\n };\r\n return WebXREnterExitUI;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRExperienceHelper.ts\":\n/*!*********************************************!*\\\n !*** ./Cameras/XR/webXRExperienceHelper.ts ***!\n \\*********************************************/\n/*! exports provided: WebXRState, WebXRExperienceHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return WebXRState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return WebXRExperienceHelper; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _webXRSessionManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webXRSessionManager */ \"./Cameras/XR/webXRSessionManager.ts\");\n/* harmony import */ var _webXRCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webXRCamera */ \"./Cameras/XR/webXRCamera.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * States of the webXR experience\r\n */\r\nvar WebXRState;\r\n(function (WebXRState) {\r\n /**\r\n * Transitioning to being in XR mode\r\n */\r\n WebXRState[WebXRState[\"ENTERING_XR\"] = 0] = \"ENTERING_XR\";\r\n /**\r\n * Transitioning to non XR mode\r\n */\r\n WebXRState[WebXRState[\"EXITING_XR\"] = 1] = \"EXITING_XR\";\r\n /**\r\n * In XR mode and presenting\r\n */\r\n WebXRState[WebXRState[\"IN_XR\"] = 2] = \"IN_XR\";\r\n /**\r\n * Not entered XR mode\r\n */\r\n WebXRState[WebXRState[\"NOT_IN_XR\"] = 3] = \"NOT_IN_XR\";\r\n})(WebXRState || (WebXRState = {}));\r\n/**\r\n * Base set of functionality needed to create an XR experince (WebXRSessionManager, Camera, StateManagement, etc.)\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n */\r\nvar WebXRExperienceHelper = /** @class */ (function () {\r\n /**\r\n * Creates a WebXRExperienceHelper\r\n * @param scene The scene the helper should be created in\r\n */\r\n function WebXRExperienceHelper(scene) {\r\n var _this = this;\r\n this.scene = scene;\r\n /**\r\n * The current state of the XR experience (eg. transitioning, in XR or not in XR)\r\n */\r\n this.state = WebXRState.NOT_IN_XR;\r\n /**\r\n * Fires when the state of the experience helper has changed\r\n */\r\n this.onStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._nonVRCamera = null;\r\n this._originalSceneAutoClear = true;\r\n this._supported = false;\r\n this.camera = new _webXRCamera__WEBPACK_IMPORTED_MODULE_4__[\"WebXRCamera\"](\"\", scene);\r\n this.sessionManager = new _webXRSessionManager__WEBPACK_IMPORTED_MODULE_3__[\"WebXRSessionManager\"](scene);\r\n this.container = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"](\"WebXR Container\", scene);\r\n this.camera.parent = this.container;\r\n scene.onDisposeObservable.add(function () {\r\n _this.exitXRAsync();\r\n });\r\n }\r\n WebXRExperienceHelper.prototype._setState = function (val) {\r\n this.state = val;\r\n this.onStateChangedObservable.notifyObservers(this.state);\r\n };\r\n /**\r\n * Creates the experience helper\r\n * @param scene the scene to attach the experience helper to\r\n * @returns a promise for the experience helper\r\n */\r\n WebXRExperienceHelper.CreateAsync = function (scene) {\r\n var helper = new WebXRExperienceHelper(scene);\r\n return helper.sessionManager.initializeAsync().then(function () {\r\n helper._supported = true;\r\n return helper;\r\n }).catch(function () {\r\n return helper;\r\n });\r\n };\r\n /**\r\n * Exits XR mode and returns the scene to its original state\r\n * @returns promise that resolves after xr mode has exited\r\n */\r\n WebXRExperienceHelper.prototype.exitXRAsync = function () {\r\n this._setState(WebXRState.EXITING_XR);\r\n return this.sessionManager.exitXRAsync();\r\n };\r\n /**\r\n * Enters XR mode (This must be done within a user interaction in most browsers eg. button click)\r\n * @param sessionCreationOptions options for the XR session\r\n * @param referenceSpaceType frame of reference of the XR session\r\n * @param outputCanvas the output canvas that will be used to enter XR mode\r\n * @returns promise that resolves after xr mode has entered\r\n */\r\n WebXRExperienceHelper.prototype.enterXRAsync = function (sessionCreationOptions, referenceSpaceType, outputCanvas) {\r\n var _this = this;\r\n if (!this._supported) {\r\n throw \"XR session not supported by this browser\";\r\n }\r\n this._setState(WebXRState.ENTERING_XR);\r\n return this.sessionManager.initializeSessionAsync(sessionCreationOptions).then(function () {\r\n return _this.sessionManager.setReferenceSpaceAsync(referenceSpaceType);\r\n }).then(function () {\r\n return outputCanvas.initializeXRLayerAsync(_this.sessionManager.session);\r\n }).then(function () {\r\n return _this.sessionManager.updateRenderStateAsync({ depthFar: _this.camera.maxZ, depthNear: _this.camera.minZ, baseLayer: outputCanvas.xrLayer });\r\n }).then(function () {\r\n return _this.sessionManager.startRenderingToXRAsync();\r\n }).then(function () {\r\n // Cache pre xr scene settings\r\n _this._originalSceneAutoClear = _this.scene.autoClear;\r\n _this._nonVRCamera = _this.scene.activeCamera;\r\n // Overwrite current scene settings\r\n _this.scene.autoClear = false;\r\n _this.scene.activeCamera = _this.camera;\r\n _this.sessionManager.onXRFrameObservable.add(function () {\r\n _this.camera.updateFromXRSessionManager(_this.sessionManager);\r\n });\r\n _this.sessionManager.onXRSessionEnded.addOnce(function () {\r\n // Reset camera rigs output render target to ensure sessions render target is not drawn after it ends\r\n _this.camera.rigCameras.forEach(function (c) {\r\n c.outputRenderTarget = null;\r\n });\r\n // Restore scene settings\r\n _this.scene.autoClear = _this._originalSceneAutoClear;\r\n _this.scene.activeCamera = _this._nonVRCamera;\r\n _this._setState(WebXRState.NOT_IN_XR);\r\n });\r\n // Wait until the first frame arrives before setting state to in xr\r\n _this.sessionManager.onXRFrameObservable.addOnce(function () {\r\n _this._setState(WebXRState.IN_XR);\r\n });\r\n }).catch(function (e) {\r\n console.log(e);\r\n console.log(e.message);\r\n });\r\n };\r\n /**\r\n * Updates the global position of the camera by moving the camera's container\r\n * This should be used instead of modifying the camera's position as it will be overwritten by an xrSessions's update frame\r\n * @param position The desired global position of the camera\r\n */\r\n WebXRExperienceHelper.prototype.setPositionOfCameraUsingContainer = function (position) {\r\n this.camera.globalPosition.subtractToRef(position, WebXRExperienceHelper._TmpVector);\r\n this.container.position.subtractInPlace(WebXRExperienceHelper._TmpVector);\r\n };\r\n /**\r\n * Rotates the xr camera by rotating the camera's container around the camera's position\r\n * This should be used instead of modifying the camera's rotation as it will be overwritten by an xrSessions's update frame\r\n * @param rotation the desired quaternion rotation to apply to the camera\r\n */\r\n WebXRExperienceHelper.prototype.rotateCameraByQuaternionUsingContainer = function (rotation) {\r\n if (!this.container.rotationQuaternion) {\r\n this.container.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromEulerVector(this.container.rotation);\r\n }\r\n this.container.rotationQuaternion.multiplyInPlace(rotation);\r\n this.container.position.rotateByQuaternionAroundPointToRef(rotation, this.camera.globalPosition, this.container.position);\r\n };\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n WebXRExperienceHelper.prototype.dispose = function () {\r\n this.camera.dispose();\r\n this.container.dispose();\r\n this.onStateChangedObservable.clear();\r\n this.sessionManager.dispose();\r\n };\r\n WebXRExperienceHelper._TmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]();\r\n return WebXRExperienceHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRInput.ts\":\n/*!**********************************!*\\\n !*** ./Cameras/XR/webXRInput.ts ***!\n \\**********************************/\n/*! exports provided: WebXRInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return WebXRInput; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n/* harmony import */ var _webXRController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRController */ \"./Cameras/XR/webXRController.ts\");\n\r\n\r\n\r\n/**\r\n * XR input used to track XR inputs such as controllers/rays\r\n */\r\nvar WebXRInput = /** @class */ (function () {\r\n /**\r\n * Initializes the WebXRInput\r\n * @param baseExperience experience helper which the input should be created for\r\n */\r\n function WebXRInput(\r\n /**\r\n * Base experience the input listens to\r\n */\r\n baseExperience) {\r\n var _this = this;\r\n this.baseExperience = baseExperience;\r\n /**\r\n * XR controllers being tracked\r\n */\r\n this.controllers = [];\r\n /**\r\n * Event when a controller has been connected/added\r\n */\r\n this.onControllerAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Event when a controller has been removed/disconnected\r\n */\r\n this.onControllerRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._onInputSourcesChange = function (event) {\r\n _this._addAndRemoveControllers(event.added, event.removed);\r\n };\r\n // Remove controllers when exiting XR\r\n this._stateObserver = baseExperience.onStateChangedObservable.add(function (s) {\r\n if (s === _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_1__[\"WebXRState\"].NOT_IN_XR) {\r\n _this._addAndRemoveControllers([], _this.controllers.map(function (c) { return c.inputSource; }));\r\n }\r\n });\r\n this._frameObserver = baseExperience.sessionManager.onXRFrameObservable.add(function () {\r\n if (!baseExperience.sessionManager.currentFrame) {\r\n return;\r\n }\r\n // Start listing to input add/remove event\r\n if (_this.controllers.length == 0 && baseExperience.sessionManager.session.inputSources) {\r\n _this._addAndRemoveControllers(baseExperience.sessionManager.session.inputSources, []);\r\n baseExperience.sessionManager.session.addEventListener(\"inputsourceschange\", _this._onInputSourcesChange);\r\n }\r\n // Update controller pose info\r\n _this.controllers.forEach(function (controller) {\r\n controller.updateFromXRFrame(baseExperience.sessionManager.currentFrame, baseExperience.sessionManager.referenceSpace);\r\n });\r\n });\r\n }\r\n WebXRInput.prototype._addAndRemoveControllers = function (addInputs, removeInputs) {\r\n var _this = this;\r\n // Add controllers if they don't already exist\r\n var sources = this.controllers.map(function (c) { return c.inputSource; });\r\n for (var _i = 0, addInputs_1 = addInputs; _i < addInputs_1.length; _i++) {\r\n var input = addInputs_1[_i];\r\n if (sources.indexOf(input) === -1) {\r\n var controller = new _webXRController__WEBPACK_IMPORTED_MODULE_2__[\"WebXRController\"](this.baseExperience.camera._scene, input, this.baseExperience.container);\r\n this.controllers.push(controller);\r\n this.onControllerAddedObservable.notifyObservers(controller);\r\n }\r\n }\r\n // Remove and dispose of controllers to be disposed\r\n var keepControllers = [];\r\n var removedControllers = [];\r\n this.controllers.forEach(function (c) {\r\n if (removeInputs.indexOf(c.inputSource) === -1) {\r\n keepControllers.push(c);\r\n }\r\n else {\r\n removedControllers.push(c);\r\n }\r\n });\r\n this.controllers = keepControllers;\r\n removedControllers.forEach(function (c) {\r\n _this.onControllerRemovedObservable.notifyObservers(c);\r\n c.dispose();\r\n });\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXRInput.prototype.dispose = function () {\r\n this.controllers.forEach(function (c) {\r\n c.dispose();\r\n });\r\n this.baseExperience.sessionManager.onXRFrameObservable.remove(this._frameObserver);\r\n this.baseExperience.onStateChangedObservable.remove(this._stateObserver);\r\n };\r\n return WebXRInput;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRManagedOutputCanvas.ts\":\n/*!************************************************!*\\\n !*** ./Cameras/XR/webXRManagedOutputCanvas.ts ***!\n \\************************************************/\n/*! exports provided: WebXRManagedOutputCanvas */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return WebXRManagedOutputCanvas; });\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n\r\n/**\r\n * Creates a canvas that is added/removed from the webpage when entering/exiting XR\r\n */\r\nvar WebXRManagedOutputCanvas = /** @class */ (function () {\r\n /**\r\n * Initializes the canvas to be added/removed upon entering/exiting xr\r\n * @param helper the xr experience helper used to trigger adding/removing of the canvas\r\n * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)\r\n */\r\n function WebXRManagedOutputCanvas(helper, canvas) {\r\n var _this = this;\r\n this.helper = helper;\r\n this._canvas = null;\r\n /**\r\n * xr layer for the canvas\r\n */\r\n this.xrLayer = null;\r\n if (!canvas) {\r\n canvas = document.createElement('canvas');\r\n canvas.style.cssText = \"position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;\";\r\n }\r\n this._setManagedOutputCanvas(canvas);\r\n helper.onStateChangedObservable.add(function (stateInfo) {\r\n if (stateInfo == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__[\"WebXRState\"].ENTERING_XR) {\r\n // The canvas is added to the screen before entering XR because currently the xr session must be initialized while the canvas is added render properly\r\n _this._addCanvas();\r\n }\r\n else if (helper.state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__[\"WebXRState\"].NOT_IN_XR) {\r\n _this._removeCanvas();\r\n }\r\n });\r\n }\r\n /**\r\n * Initializes the xr layer for the session\r\n * @param xrSession xr session\r\n * @returns a promise that will resolve once the XR Layer has been created\r\n */\r\n WebXRManagedOutputCanvas.prototype.initializeXRLayerAsync = function (xrSession) {\r\n var _this = this;\r\n return this.canvasContext.makeXRCompatible().then(function () {\r\n _this.xrLayer = new XRWebGLLayer(xrSession, _this.canvasContext);\r\n });\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXRManagedOutputCanvas.prototype.dispose = function () {\r\n this._removeCanvas();\r\n this._setManagedOutputCanvas(null);\r\n };\r\n WebXRManagedOutputCanvas.prototype._setManagedOutputCanvas = function (canvas) {\r\n this._removeCanvas();\r\n if (!canvas) {\r\n this._canvas = null;\r\n this.canvasContext = null;\r\n }\r\n else {\r\n this._canvas = canvas;\r\n this.canvasContext = this._canvas.getContext('webgl');\r\n if (!this.canvasContext) {\r\n this.canvasContext = this._canvas.getContext('webgl2');\r\n }\r\n }\r\n };\r\n WebXRManagedOutputCanvas.prototype._addCanvas = function () {\r\n if (this._canvas && this._canvas !== this.helper.container.getScene().getEngine().getRenderingCanvas()) {\r\n document.body.appendChild(this._canvas);\r\n }\r\n };\r\n WebXRManagedOutputCanvas.prototype._removeCanvas = function () {\r\n if (this._canvas && document.body.contains(this._canvas) && this._canvas !== this.helper.container.getScene().getEngine().getRenderingCanvas()) {\r\n document.body.removeChild(this._canvas);\r\n }\r\n };\r\n return WebXRManagedOutputCanvas;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRSessionManager.ts\":\n/*!*******************************************!*\\\n !*** ./Cameras/XR/webXRSessionManager.ts ***!\n \\*******************************************/\n/*! exports provided: WebXRSessionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return WebXRSessionManager; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manages an XRSession to work with Babylon's engine\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n */\r\nvar WebXRSessionManager = /** @class */ (function () {\r\n /**\r\n * Constructs a WebXRSessionManager, this must be initialized within a user action before usage\r\n * @param scene The scene which the session should be created for\r\n */\r\n function WebXRSessionManager(scene) {\r\n this.scene = scene;\r\n /**\r\n * Fires every time a new xrFrame arrives which can be used to update the camera\r\n */\r\n this.onXRFrameObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fires when the xr session is ended either by the device or manually done\r\n */\r\n this.onXRSessionEnded = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** @hidden */\r\n this._sessionRenderTargetTexture = null;\r\n this.baseLayer = null;\r\n }\r\n /**\r\n * Initializes the manager\r\n * After initialization enterXR can be called to start an XR session\r\n * @returns Promise which resolves after it is initialized\r\n */\r\n WebXRSessionManager.prototype.initializeAsync = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"The WebXR APIs are still under development and are subject to change in the future.\");\r\n // Check if the browser supports webXR\r\n this._xrNavigator = navigator;\r\n if (!this._xrNavigator.xr) {\r\n return Promise.reject(\"webXR not supported by this browser\");\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Initializes an xr session\r\n * @param xrSessionMode mode to initialize\r\n * @returns a promise which will resolve once the session has been initialized\r\n */\r\n WebXRSessionManager.prototype.initializeSessionAsync = function (xrSessionMode) {\r\n var _this = this;\r\n return this._xrNavigator.xr.requestSession(xrSessionMode).then(function (session) {\r\n _this.session = session;\r\n // handle when the session is ended (By calling session.end or device ends its own session eg. pressing home button on phone)\r\n _this.session.addEventListener(\"end\", function () {\r\n // Remove render target texture and notify frame obervers\r\n _this._sessionRenderTargetTexture = null;\r\n // Restore frame buffer to avoid clear on xr framebuffer after session end\r\n _this.scene.getEngine().restoreDefaultFramebuffer();\r\n // Need to restart render loop as after the session is ended the last request for new frame will never call callback\r\n _this.scene.getEngine().customAnimationFrameRequester = null;\r\n _this.onXRSessionEnded.notifyObservers(null);\r\n _this.scene.getEngine()._renderLoop();\r\n }, { once: true });\r\n });\r\n };\r\n /**\r\n * Sets the reference space on the xr session\r\n * @param referenceSpace space to set\r\n * @returns a promise that will resolve once the reference space has been set\r\n */\r\n WebXRSessionManager.prototype.setReferenceSpaceAsync = function (referenceSpace) {\r\n var _this = this;\r\n return this.session.requestReferenceSpace(referenceSpace).then(function (referenceSpace) {\r\n _this.referenceSpace = referenceSpace;\r\n });\r\n };\r\n /**\r\n * Updates the render state of the session\r\n * @param state state to set\r\n * @returns a promise that resolves once the render state has been updated\r\n */\r\n WebXRSessionManager.prototype.updateRenderStateAsync = function (state) {\r\n if (state.baseLayer) {\r\n this.baseLayer = state.baseLayer;\r\n }\r\n return this.session.updateRenderState(state);\r\n };\r\n /**\r\n * Starts rendering to the xr layer\r\n * @returns a promise that will resolve once rendering has started\r\n */\r\n WebXRSessionManager.prototype.startRenderingToXRAsync = function () {\r\n var _this = this;\r\n // Tell the engine's render loop to be driven by the xr session's refresh rate and provide xr pose information\r\n this.scene.getEngine().customAnimationFrameRequester = {\r\n requestAnimationFrame: this.session.requestAnimationFrame.bind(this.session),\r\n renderFunction: function (timestamp, xrFrame) {\r\n // Store the XR frame in the manager to be consumed by the XR camera to update pose\r\n _this.currentFrame = xrFrame;\r\n _this.onXRFrameObservable.notifyObservers(null);\r\n _this.scene.getEngine()._renderLoop();\r\n }\r\n };\r\n // Create render target texture from xr's webgl render target\r\n this._sessionRenderTargetTexture = WebXRSessionManager._CreateRenderTargetTextureFromSession(this.session, this.scene, this.baseLayer);\r\n // Stop window's animation frame and trigger sessions animation frame\r\n window.cancelAnimationFrame(this.scene.getEngine()._frameHandler);\r\n this.scene.getEngine()._renderLoop();\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Stops the xrSession and restores the renderloop\r\n * @returns Promise which resolves after it exits XR\r\n */\r\n WebXRSessionManager.prototype.exitXRAsync = function () {\r\n if (this.session) {\r\n this.session.end();\r\n }\r\n return new Promise(function () { });\r\n };\r\n /**\r\n * Checks if a session would be supported for the creation options specified\r\n * @param sessionMode session mode to check if supported eg. immersive-vr\r\n * @returns true if supported\r\n */\r\n WebXRSessionManager.prototype.supportsSessionAsync = function (sessionMode) {\r\n if (!navigator.xr || !navigator.xr.supportsSession) {\r\n return Promise.resolve(false);\r\n }\r\n else {\r\n return navigator.xr.supportsSession(sessionMode).then(function () {\r\n return Promise.resolve(true);\r\n }).catch(function (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(e);\r\n return Promise.resolve(false);\r\n });\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Converts the render layer of xrSession to a render target\r\n * @param session session to create render target for\r\n * @param scene scene the new render target should be created for\r\n */\r\n WebXRSessionManager._CreateRenderTargetTextureFromSession = function (session, scene, baseLayer) {\r\n if (!baseLayer) {\r\n throw \"no layer\";\r\n }\r\n // Create internal texture\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](scene.getEngine(), _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_UNKNOWN, true);\r\n internalTexture.width = baseLayer.framebufferWidth;\r\n internalTexture.height = baseLayer.framebufferHeight;\r\n internalTexture._framebuffer = baseLayer.framebuffer;\r\n // Create render target texture from the internal texture\r\n var renderTargetTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetTexture\"](\"XR renderTargetTexture\", { width: internalTexture.width, height: internalTexture.height }, scene, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);\r\n renderTargetTexture._texture = internalTexture;\r\n return renderTargetTexture;\r\n };\r\n /**\r\n * Disposes of the session manager\r\n */\r\n WebXRSessionManager.prototype.dispose = function () {\r\n this.onXRFrameObservable.clear();\r\n this.onXRSessionEnded.clear();\r\n };\r\n return WebXRSessionManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/arcRotateCamera.ts\":\n/*!************************************!*\\\n !*** ./Cameras/arcRotateCamera.ts ***!\n \\************************************/\n/*! exports provided: ArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return ArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Behaviors_Cameras_autoRotationBehavior__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Behaviors/Cameras/autoRotationBehavior */ \"./Behaviors/Cameras/autoRotationBehavior.ts\");\n/* harmony import */ var _Behaviors_Cameras_bouncingBehavior__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Behaviors/Cameras/bouncingBehavior */ \"./Behaviors/Cameras/bouncingBehavior.ts\");\n/* harmony import */ var _Behaviors_Cameras_framingBehavior__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Behaviors/Cameras/framingBehavior */ \"./Behaviors/Cameras/framingBehavior.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Cameras/arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"ArcRotateCamera\", function (name, scene) {\r\n return function () { return new ArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents an orbital type of camera.\r\n *\r\n * This camera always points towards a given target position and can be rotated around that target with the target as the centre of rotation. It can be controlled with cursors and mouse, or with touch events.\r\n * Think of this camera as one orbiting its target position, or more imaginatively as a spy satellite orbiting the earth. Its position relative to the target (earth) can be set by three parameters, alpha (radians) the longitudinal rotation, beta (radians) the latitudinal rotation and radius the distance from the target position.\r\n * @see http://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera\r\n */\r\nvar ArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcRotateCamera, _super);\r\n /**\r\n * Instantiates a new ArcRotateCamera in a given scene\r\n * @param name Defines the name of the camera\r\n * @param alpha Defines the camera rotation along the logitudinal axis\r\n * @param beta Defines the camera rotation along the latitudinal axis\r\n * @param radius Defines the camera distance from its target\r\n * @param target Defines the camera target\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function ArcRotateCamera(name, alpha, beta, radius, target, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene, setActiveOnSceneIfNoneActive) || this;\r\n _this._upVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up();\r\n /**\r\n * Current inertia value on the longitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialAlphaOffset = 0;\r\n /**\r\n * Current inertia value on the latitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialBetaOffset = 0;\r\n /**\r\n * Current inertia value on the radius axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialRadiusOffset = 0;\r\n /**\r\n * Minimum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerAlphaLimit = null;\r\n /**\r\n * Maximum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperAlphaLimit = null;\r\n /**\r\n * Minimum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerBetaLimit = 0.01;\r\n /**\r\n * Maximum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperBetaLimit = Math.PI - 0.01;\r\n /**\r\n * Minimum allowed distance of the camera to the target (The camera can not get closer).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRadiusLimit = null;\r\n /**\r\n * Maximum allowed distance of the camera to the target (The camera can not get further).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRadiusLimit = null;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the X axis.\r\n */\r\n _this.inertialPanningX = 0;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the Y axis.\r\n */\r\n _this.inertialPanningY = 0;\r\n /**\r\n * Defines the distance used to consider the camera in pan mode vs pinch/zoom.\r\n * Basically if your fingers moves away from more than this distance you will be considered\r\n * in pinch mode.\r\n */\r\n _this.pinchToPanMaxDistance = 20;\r\n /**\r\n * Defines the maximum distance the camera can pan.\r\n * This could help keeping the cammera always in your scene.\r\n */\r\n _this.panningDistanceLimit = null;\r\n /**\r\n * Defines the target of the camera before paning.\r\n */\r\n _this.panningOriginTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n /**\r\n * Defines the value of the inertia used during panning.\r\n * 0 would mean stop inertia and one would mean no decelleration at all.\r\n */\r\n _this.panningInertia = 0.9;\r\n //-- end properties for backward compatibility for inputs\r\n /**\r\n * Defines how much the radius should be scaled while zomming on a particular mesh (through the zoomOn function)\r\n */\r\n _this.zoomOnFactor = 1;\r\n /**\r\n * Defines a screen offset for the camera position.\r\n */\r\n _this.targetScreenOffset = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n /**\r\n * Allows the camera to be completely reversed.\r\n * If false the camera can not arrive upside down.\r\n */\r\n _this.allowUpsideDown = true;\r\n /**\r\n * Define if double tap/click is used to restore the previously saved state of the camera.\r\n */\r\n _this.useInputToRestoreState = true;\r\n /** @hidden */\r\n _this._viewMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n /**\r\n * Defines the allowed panning axis.\r\n */\r\n _this.panningAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 1, 0);\r\n /**\r\n * Observable triggered when the mesh target has been changed on the camera.\r\n */\r\n _this.onMeshTargetChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Defines whether the camera should check collision with the objects oh the scene.\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#how-can-i-do-this\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Defines the collision radius of the camera.\r\n * This simulates a sphere around the camera.\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.collisionRadius = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0.5, 0.5, 0.5);\r\n _this._previousPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._collisionVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._computationVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n if (!collidedMesh) {\r\n _this._previousPosition.copyFrom(_this._position);\r\n }\r\n else {\r\n _this.setPosition(newPosition);\r\n if (_this.onCollide) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n // Recompute because of constraints\r\n var cosa = Math.cos(_this.alpha);\r\n var sina = Math.sin(_this.alpha);\r\n var cosb = Math.cos(_this.beta);\r\n var sinb = Math.sin(_this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n var target = _this._getTargetPosition();\r\n _this._computationVector.copyFromFloats(_this.radius * cosa * sinb, _this.radius * cosb, _this.radius * sina * sinb);\r\n target.addToRef(_this._computationVector, _this._newPosition);\r\n _this._position.copyFrom(_this._newPosition);\r\n var up = _this.upVector;\r\n if (_this.allowUpsideDown && _this.beta < 0) {\r\n up = up.clone();\r\n up = up.negate();\r\n }\r\n _this._computeViewMatrix(_this._position, target, up);\r\n _this._viewMatrix.addAtIndex(12, _this.targetScreenOffset.x);\r\n _this._viewMatrix.addAtIndex(13, _this.targetScreenOffset.y);\r\n _this._collisionTriggered = false;\r\n };\r\n _this._target = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n if (target) {\r\n _this.setTarget(target);\r\n }\r\n _this.alpha = alpha;\r\n _this.beta = beta;\r\n _this.radius = radius;\r\n _this.getViewMatrix();\r\n _this.inputs = new _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__[\"ArcRotateCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouseWheel().addPointers();\r\n return _this;\r\n }\r\n Object.defineProperty(ArcRotateCamera.prototype, \"target\", {\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n */\r\n get: function () {\r\n return this._target;\r\n },\r\n set: function (value) {\r\n this.setTarget(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this.setPosition(newPosition);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"upVector\", {\r\n get: function () {\r\n return this._upVector;\r\n },\r\n /**\r\n * The vector the camera should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())\r\n * Setting this will copy the given vector to the camera's upVector, and set rotation matrices to and from Y up.\r\n * DO NOT set the up vector using copyFrom or copyFromFloats, as this bypasses setting the above matrices.\r\n */\r\n set: function (vec) {\r\n if (!this._upToYMatrix) {\r\n this._YToUpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n this._upToYMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n this._upVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n vec.normalize();\r\n this._upVector.copyFrom(vec);\r\n this.setMatUp();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the Y-up to camera up-vector rotation matrix, and the up-vector to Y-up rotation matrix.\r\n */\r\n ArcRotateCamera.prototype.setMatUp = function () {\r\n // from y-up to custom-up (used in _getViewMatrix)\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationAlignToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].UpReadOnly, this._upVector, this._YToUpMatrix);\r\n // from custom-up to y-up (used in rebuildAnglesAndRadius)\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationAlignToRef(this._upVector, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].UpReadOnly, this._upToYMatrix);\r\n };\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityX\", {\r\n //-- begin properties for backward compatibility for inputs\r\n /**\r\n * Gets or Set the pointer angular sensibility along the X axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityX;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityX = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityY\", {\r\n /**\r\n * Gets or Set the pointer angular sensibility along the Y axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityY;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityY = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchPrecision\", {\r\n /**\r\n * Gets or Set the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchPrecision = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchDeltaPercentage\", {\r\n /**\r\n * Gets or Set the pointer pinch delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"panningSensibility\", {\r\n /**\r\n * Gets or Set the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.panningSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.panningSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelPrecision\", {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelPrecision = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelDeltaPercentage\", {\r\n /**\r\n * Gets or Set the mouse wheel delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"bouncingBehavior\", {\r\n /**\r\n * Gets the bouncing behavior of the camera if it has been enabled.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useBouncingBehavior\", {\r\n /**\r\n * Defines if the bouncing behavior of the camera is enabled on the camera.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useBouncingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._bouncingBehavior = new _Behaviors_Cameras_bouncingBehavior__WEBPACK_IMPORTED_MODULE_7__[\"BouncingBehavior\"]();\r\n this.addBehavior(this._bouncingBehavior);\r\n }\r\n else if (this._bouncingBehavior) {\r\n this.removeBehavior(this._bouncingBehavior);\r\n this._bouncingBehavior = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"framingBehavior\", {\r\n /**\r\n * Gets the framing behavior of the camera if it has been enabled.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useFramingBehavior\", {\r\n /**\r\n * Defines if the framing behavior of the camera is enabled on the camera.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useFramingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._framingBehavior = new _Behaviors_Cameras_framingBehavior__WEBPACK_IMPORTED_MODULE_8__[\"FramingBehavior\"]();\r\n this.addBehavior(this._framingBehavior);\r\n }\r\n else if (this._framingBehavior) {\r\n this.removeBehavior(this._framingBehavior);\r\n this._framingBehavior = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"autoRotationBehavior\", {\r\n /**\r\n * Gets the auto rotation behavior of the camera if it has been enabled.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useAutoRotationBehavior\", {\r\n /**\r\n * Defines if the auto rotation behavior of the camera is enabled on the camera.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useAutoRotationBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._autoRotationBehavior = new _Behaviors_Cameras_autoRotationBehavior__WEBPACK_IMPORTED_MODULE_6__[\"AutoRotationBehavior\"]();\r\n this.addBehavior(this._autoRotationBehavior);\r\n }\r\n else if (this._autoRotationBehavior) {\r\n this.removeBehavior(this._autoRotationBehavior);\r\n this._autoRotationBehavior = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Cache\r\n /** @hidden */\r\n ArcRotateCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache._target = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.alpha = undefined;\r\n this._cache.beta = undefined;\r\n this._cache.radius = undefined;\r\n this._cache.targetScreenOffset = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache._target.copyFrom(this._getTargetPosition());\r\n this._cache.alpha = this.alpha;\r\n this._cache.beta = this.beta;\r\n this._cache.radius = this.radius;\r\n this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset);\r\n };\r\n ArcRotateCamera.prototype._getTargetPosition = function () {\r\n if (this._targetHost && this._targetHost.getAbsolutePosition) {\r\n var pos = this._targetHost.absolutePosition;\r\n if (this._targetBoundingCenter) {\r\n pos.addToRef(this._targetBoundingCenter, this._target);\r\n }\r\n else {\r\n this._target.copyFrom(pos);\r\n }\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (lockedTargetPosition) {\r\n return lockedTargetPosition;\r\n }\r\n return this._target;\r\n };\r\n /**\r\n * Stores the current state of the camera (alpha, beta, radius and target)\r\n * @returns the camera itself\r\n */\r\n ArcRotateCamera.prototype.storeState = function () {\r\n this._storedAlpha = this.alpha;\r\n this._storedBeta = this.beta;\r\n this._storedRadius = this.radius;\r\n this._storedTarget = this._getTargetPosition().clone();\r\n this._storedTargetScreenOffset = this.targetScreenOffset.clone();\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * @hidden\r\n * Restored camera state. You must call storeState() first\r\n */\r\n ArcRotateCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.setTarget(this._storedTarget.clone());\r\n this.alpha = this._storedAlpha;\r\n this.beta = this._storedBeta;\r\n this.radius = this._storedRadius;\r\n this.targetScreenOffset = this._storedTargetScreenOffset.clone();\r\n this.inertialAlphaOffset = 0;\r\n this.inertialBetaOffset = 0;\r\n this.inertialRadiusOffset = 0;\r\n this.inertialPanningX = 0;\r\n this.inertialPanningY = 0;\r\n return true;\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n return this._cache._target.equals(this._getTargetPosition())\r\n && this._cache.alpha === this.alpha\r\n && this._cache.beta === this.beta\r\n && this._cache.radius === this.radius\r\n && this._cache.targetScreenOffset.equals(this.targetScreenOffset);\r\n };\r\n /**\r\n * Attached controls to the current camera.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n * @param useCtrlForPanning Defines whether ctrl is used for paning within the controls\r\n * @param panningMouseButton Defines whether panning is allowed through mouse click button\r\n */\r\n ArcRotateCamera.prototype.attachControl = function (element, noPreventDefault, useCtrlForPanning, panningMouseButton) {\r\n var _this = this;\r\n if (useCtrlForPanning === void 0) { useCtrlForPanning = true; }\r\n if (panningMouseButton === void 0) { panningMouseButton = 2; }\r\n this._useCtrlForPanning = useCtrlForPanning;\r\n this._panningMouseButton = panningMouseButton;\r\n this.inputs.attachElement(element, noPreventDefault);\r\n this._reset = function () {\r\n _this.inertialAlphaOffset = 0;\r\n _this.inertialBetaOffset = 0;\r\n _this.inertialRadiusOffset = 0;\r\n _this.inertialPanningX = 0;\r\n _this.inertialPanningY = 0;\r\n };\r\n };\r\n /**\r\n * Detach the current controls from the camera.\r\n * The camera will stop reacting to inputs.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n if (this._reset) {\r\n this._reset();\r\n }\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._checkInputs = function () {\r\n //if (async) collision inspection was triggered, don't update the camera's position - until the collision callback was called.\r\n if (this._collisionTriggered) {\r\n return;\r\n }\r\n this.inputs.checkInputs();\r\n // Inertia\r\n if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {\r\n var inertialAlphaOffset = this.inertialAlphaOffset;\r\n if (this.beta <= 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n this.alpha += inertialAlphaOffset;\r\n this.beta += this.inertialBetaOffset;\r\n this.radius -= this.inertialRadiusOffset;\r\n this.inertialAlphaOffset *= this.inertia;\r\n this.inertialBetaOffset *= this.inertia;\r\n this.inertialRadiusOffset *= this.inertia;\r\n if (Math.abs(this.inertialAlphaOffset) < _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialAlphaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialBetaOffset) < _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialBetaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialRadiusOffset) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialRadiusOffset = 0;\r\n }\r\n }\r\n // Panning inertia\r\n if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) {\r\n if (!this._localDirection) {\r\n this._localDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);\r\n this._localDirection.multiplyInPlace(this.panningAxis);\r\n this._viewMatrix.invertToRef(this._cameraTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);\r\n //Eliminate y if map panning is enabled (panningAxis == 1,0,1)\r\n if (!this.panningAxis.y) {\r\n this._transformedDirection.y = 0;\r\n }\r\n if (!this._targetHost) {\r\n if (this.panningDistanceLimit) {\r\n this._transformedDirection.addInPlace(this._target);\r\n var distanceSquared = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].DistanceSquared(this._transformedDirection, this.panningOriginTarget);\r\n if (distanceSquared <= (this.panningDistanceLimit * this.panningDistanceLimit)) {\r\n this._target.copyFrom(this._transformedDirection);\r\n }\r\n }\r\n else {\r\n this._target.addInPlace(this._transformedDirection);\r\n }\r\n }\r\n this.inertialPanningX *= this.panningInertia;\r\n this.inertialPanningY *= this.panningInertia;\r\n if (Math.abs(this.inertialPanningX) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialPanningX = 0;\r\n }\r\n if (Math.abs(this.inertialPanningY) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialPanningY = 0;\r\n }\r\n }\r\n // Limits\r\n this._checkLimits();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n ArcRotateCamera.prototype._checkLimits = function () {\r\n if (this.lowerBetaLimit === null || this.lowerBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta > Math.PI) {\r\n this.beta = this.beta - (2 * Math.PI);\r\n }\r\n }\r\n else {\r\n if (this.beta < this.lowerBetaLimit) {\r\n this.beta = this.lowerBetaLimit;\r\n }\r\n }\r\n if (this.upperBetaLimit === null || this.upperBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta < -Math.PI) {\r\n this.beta = this.beta + (2 * Math.PI);\r\n }\r\n }\r\n else {\r\n if (this.beta > this.upperBetaLimit) {\r\n this.beta = this.upperBetaLimit;\r\n }\r\n }\r\n if (this.lowerAlphaLimit !== null && this.alpha < this.lowerAlphaLimit) {\r\n this.alpha = this.lowerAlphaLimit;\r\n }\r\n if (this.upperAlphaLimit !== null && this.alpha > this.upperAlphaLimit) {\r\n this.alpha = this.upperAlphaLimit;\r\n }\r\n if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {\r\n this.radius = this.lowerRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {\r\n this.radius = this.upperRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n };\r\n /**\r\n * Rebuilds angles (alpha, beta) and radius from the give position and target\r\n */\r\n ArcRotateCamera.prototype.rebuildAnglesAndRadius = function () {\r\n this._position.subtractToRef(this._getTargetPosition(), this._computationVector);\r\n // need to rotate to Y up equivalent if up vector not Axis.Y\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector);\r\n }\r\n this.radius = this._computationVector.length();\r\n if (this.radius === 0) {\r\n this.radius = 0.0001; // Just to avoid division by zero\r\n }\r\n // Alpha\r\n if (this._computationVector.x === 0 && this._computationVector.z === 0) {\r\n this.alpha = Math.PI / 2; // avoid division by zero when looking along up axis, and set to acos(0)\r\n }\r\n else {\r\n this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2)));\r\n }\r\n if (this._computationVector.z < 0) {\r\n this.alpha = 2 * Math.PI - this.alpha;\r\n }\r\n // Beta\r\n this.beta = Math.acos(this._computationVector.y / this.radius);\r\n this._checkLimits();\r\n };\r\n /**\r\n * Use a position to define the current camera related information like aplha, beta and radius\r\n * @param position Defines the position to set the camera at\r\n */\r\n ArcRotateCamera.prototype.setPosition = function (position) {\r\n if (this._position.equals(position)) {\r\n return;\r\n }\r\n this._position.copyFrom(position);\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /**\r\n * Defines the target the camera should look at.\r\n * This will automatically adapt alpha beta and radius to fit within the new target.\r\n * @param target Defines the new target as a Vector or a mesh\r\n * @param toBoundingCenter In case of a mesh target, defines wether to target the mesh position or its bounding information center\r\n * @param allowSamePosition If false, prevents reapplying the new computed position if it is identical to the current one (optim)\r\n */\r\n ArcRotateCamera.prototype.setTarget = function (target, toBoundingCenter, allowSamePosition) {\r\n if (toBoundingCenter === void 0) { toBoundingCenter = false; }\r\n if (allowSamePosition === void 0) { allowSamePosition = false; }\r\n if (target.getBoundingInfo) {\r\n if (toBoundingCenter) {\r\n this._targetBoundingCenter = target.getBoundingInfo().boundingBox.centerWorld.clone();\r\n }\r\n else {\r\n this._targetBoundingCenter = null;\r\n }\r\n target.computeWorldMatrix();\r\n this._targetHost = target;\r\n this._target = this._getTargetPosition();\r\n this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);\r\n }\r\n else {\r\n var newTarget = target;\r\n var currentTarget = this._getTargetPosition();\r\n if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {\r\n return;\r\n }\r\n this._targetHost = null;\r\n this._target = newTarget;\r\n this._targetBoundingCenter = null;\r\n this.onMeshTargetChangedObservable.notifyObservers(null);\r\n }\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._getViewMatrix = function () {\r\n // Compute\r\n var cosa = Math.cos(this.alpha);\r\n var sina = Math.sin(this.alpha);\r\n var cosb = Math.cos(this.beta);\r\n var sinb = Math.sin(this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n var target = this._getTargetPosition();\r\n this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);\r\n // Rotate according to up vector\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._computationVector, this._YToUpMatrix, this._computationVector);\r\n }\r\n target.addToRef(this._computationVector, this._newPosition);\r\n if (this.getScene().collisionsEnabled && this.checkCollisions) {\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.collisionRadius;\r\n this._newPosition.subtractToRef(this._position, this._collisionVelocity);\r\n this._collisionTriggered = true;\r\n coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n }\r\n else {\r\n this._position.copyFrom(this._newPosition);\r\n var up = this.upVector;\r\n if (this.allowUpsideDown && sinb < 0) {\r\n up = up.negate();\r\n }\r\n this._computeViewMatrix(this._position, target, up);\r\n this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);\r\n this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);\r\n }\r\n this._currentTarget = target;\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Zooms on a mesh to be at the min distance where we could see it fully in the current viewport.\r\n * @param meshes Defines the mesh to zoom on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.zoomOn = function (meshes, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n meshes = meshes || this.getScene().meshes;\r\n var minMaxVector = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].MinMax(meshes);\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(minMaxVector.min, minMaxVector.max);\r\n this.radius = distance * this.zoomOnFactor;\r\n this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance }, doNotUpdateMaxZ);\r\n };\r\n /**\r\n * Focus on a mesh or a bounding box. This adapts the target and maxRadius if necessary but does not update the current radius.\r\n * The target will be changed but the radius\r\n * @param meshesOrMinMaxVectorAndDistance Defines the mesh or bounding info to focus on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n var meshesOrMinMaxVector;\r\n var distance;\r\n if (meshesOrMinMaxVectorAndDistance.min === undefined) { // meshes\r\n var meshes = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;\r\n meshesOrMinMaxVector = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].MinMax(meshes);\r\n distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);\r\n }\r\n else { //minMaxVector and distance\r\n var minMaxVectorAndDistance = meshesOrMinMaxVectorAndDistance;\r\n meshesOrMinMaxVector = minMaxVectorAndDistance;\r\n distance = minMaxVectorAndDistance.distance;\r\n }\r\n this._target = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].Center(meshesOrMinMaxVector);\r\n if (!doNotUpdateMaxZ) {\r\n this.maxZ = distance * 2;\r\n }\r\n };\r\n /**\r\n * @override\r\n * Override Camera.createRigCamera\r\n */\r\n ArcRotateCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n var alphaShift = 0;\r\n switch (this.cameraRigMode) {\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_VR:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);\r\n break;\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);\r\n break;\r\n }\r\n var rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());\r\n rigCam._cameraRigParams = {};\r\n return rigCam;\r\n };\r\n /**\r\n * @hidden\r\n * @override\r\n * Override Camera._updateRigCameras\r\n */\r\n ArcRotateCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n camLeft.beta = camRight.beta = this.beta;\r\n switch (this.cameraRigMode) {\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_VR:\r\n camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n ArcRotateCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n ArcRotateCamera.prototype.getClassName = function () {\r\n return \"ArcRotateCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"alpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"beta\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"target\")\r\n ], ArcRotateCamera.prototype, \"_target\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"upVector\")\r\n ], ArcRotateCamera.prototype, \"_upVector\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialAlphaOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialBetaOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialRadiusOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"lowerAlphaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"upperAlphaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"lowerBetaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"upperBetaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"lowerRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"upperRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialPanningX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialPanningY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"pinchToPanMaxDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"panningDistanceLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ArcRotateCamera.prototype, \"panningOriginTarget\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"panningInertia\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"zoomOnFactor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"targetScreenOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"allowUpsideDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"useInputToRestoreState\", void 0);\r\n return ArcRotateCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_10__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/arcRotateCameraInputsManager.ts\":\n/*!*************************************************!*\\\n !*** ./Cameras/arcRotateCameraInputsManager.ts ***!\n \\*************************************************/\n/*! exports provided: ArcRotateCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return ArcRotateCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraPointersInput */ \"./Cameras/Inputs/arcRotateCameraPointersInput.ts\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraKeyboardMoveInput */ \"./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraMouseWheelInput */ \"./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the ArcRotateCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcRotateCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new ArcRotateCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function ArcRotateCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addMouseWheel = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__[\"ArcRotateCameraMouseWheelInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add pointers input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addPointers = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_1__[\"ArcRotateCameraPointersInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCameraKeyboardMoveInput\"]());\r\n return this;\r\n };\r\n return ArcRotateCameraInputsManager;\r\n}(_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_4__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/camera.ts\":\n/*!***************************!*\\\n !*** ./Cameras/camera.ts ***!\n \\***************************/\n/*! exports provided: Camera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return Camera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n/* harmony import */ var _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Maths/math.frustum */ \"./Maths/math.frustum.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This is the base class of all the camera used in the application.\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar Camera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Camera, _super);\r\n /**\r\n * Instantiates a new camera object.\r\n * This should not be used directly but through the inherited cameras: ArcRotate, Free...\r\n * @see http://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the position of the camera\r\n * @param scene Defines the scene the camera belongs too\r\n * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene\r\n */\r\n function Camera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n /** @hidden */\r\n _this._position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n /**\r\n * The vector the camera should consider as up.\r\n * (default is Vector3(0, 1, 0) aka Vector3.Up())\r\n */\r\n _this.upVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Up();\r\n /**\r\n * Define the current limit on the left side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoLeft = null;\r\n /**\r\n * Define the current limit on the right side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoRight = null;\r\n /**\r\n * Define the current limit on the bottom side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoBottom = null;\r\n /**\r\n * Define the current limit on the top side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoTop = null;\r\n /**\r\n * Field Of View is set in Radians. (default is 0.8)\r\n */\r\n _this.fov = 0.8;\r\n /**\r\n * Define the minimum distance the camera can see from.\r\n * This is important to note that the depth buffer are not infinite and the closer it starts\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.minZ = 1;\r\n /**\r\n * Define the maximum distance the camera can see to.\r\n * This is important to note that the depth buffer are not infinite and the further it end\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.maxZ = 10000.0;\r\n /**\r\n * Define the default inertia of the camera.\r\n * This helps giving a smooth feeling to the camera movement.\r\n */\r\n _this.inertia = 0.9;\r\n /**\r\n * Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)\r\n */\r\n _this.mode = Camera.PERSPECTIVE_CAMERA;\r\n /**\r\n * Define wether the camera is intermediate.\r\n * This is useful to not present the output directly to the screen in case of rig without post process for instance\r\n */\r\n _this.isIntermediate = false;\r\n /**\r\n * Define the viewport of the camera.\r\n * This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.\r\n */\r\n _this.viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_10__[\"Viewport\"](0, 0, 1.0, 1.0);\r\n /**\r\n * Restricts the camera to viewing objects with the same layerMask.\r\n * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0\r\n */\r\n _this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)\r\n */\r\n _this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;\r\n /**\r\n * Rig mode of the camera.\r\n * This is useful to create the camera with two \"eyes\" instead of one to create VR or stereoscopic scenes.\r\n * This is normally controlled byt the camera themselves as internal use.\r\n */\r\n _this.cameraRigMode = Camera.RIG_MODE_NONE;\r\n /**\r\n * Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene\r\n * This is pretty helpfull if you wish to make a camera render to a texture you could reuse somewhere\r\n * else in the scene. (Eg. security camera)\r\n *\r\n * To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corrisponding to an HMD)\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * When set, the camera will render to this render target instead of the default canvas\r\n *\r\n * If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead\r\n */\r\n _this.outputRenderTarget = null;\r\n /**\r\n * Observable triggered when the camera view matrix has changed.\r\n */\r\n _this.onViewMatrixChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Observable triggered when the camera Projection matrix has changed.\r\n */\r\n _this.onProjectionMatrixChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Observable triggered when the inputs have been processed.\r\n */\r\n _this.onAfterCheckInputsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Observable triggered when reset has been called and applied to the camera.\r\n */\r\n _this.onRestoreStateObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /** @hidden */\r\n _this._rigCameras = new Array();\r\n _this._webvrViewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n /** @hidden */\r\n _this._skipRendering = false;\r\n /** @hidden */\r\n _this._projectionMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]();\r\n /** @hidden */\r\n _this._postProcesses = new Array();\r\n /** @hidden */\r\n _this._activeMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__[\"SmartArray\"](256);\r\n _this._globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n _this._computedViewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n _this._doNotComputeProjectionMatrix = false;\r\n _this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Zero();\r\n _this._refreshFrustumPlanes = true;\r\n /** @hidden */\r\n _this._isCamera = true;\r\n /** @hidden */\r\n _this._isLeftCamera = false;\r\n /** @hidden */\r\n _this._isRightCamera = false;\r\n _this.getScene().addCamera(_this);\r\n if (setActiveOnSceneIfNoneActive && !_this.getScene().activeCamera) {\r\n _this.getScene().activeCamera = _this;\r\n }\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(Camera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Store current camera state (fov, position, etc..)\r\n * @returns the camera\r\n */\r\n Camera.prototype.storeState = function () {\r\n this._stateStored = true;\r\n this._storedFov = this.fov;\r\n return this;\r\n };\r\n /**\r\n * Restores the camera state values if it has been stored. You must call storeState() first\r\n */\r\n Camera.prototype._restoreStateValues = function () {\r\n if (!this._stateStored) {\r\n return false;\r\n }\r\n this.fov = this._storedFov;\r\n return true;\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first.\r\n * @returns true if restored and false otherwise\r\n */\r\n Camera.prototype.restoreState = function () {\r\n if (this._restoreStateValues()) {\r\n this.onRestoreStateObservable.notifyObservers(this);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the class name of the camera.\r\n * @returns the class name\r\n */\r\n Camera.prototype.getClassName = function () {\r\n return \"Camera\";\r\n };\r\n /**\r\n * Gets a string representation of the camera useful for debug purpose.\r\n * @param fullDetails Defines that a more verboe level of logging is required\r\n * @returns the string representation\r\n */\r\n Camera.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n Object.defineProperty(Camera.prototype, \"globalPosition\", {\r\n /**\r\n * Gets the current world space position of the camera.\r\n */\r\n get: function () {\r\n return this._globalPosition;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of active meshes this frame (meshes no culled or excluded by lod s in the frame)\r\n * @returns the active meshe list\r\n */\r\n Camera.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Check wether a mesh is part of the current active mesh list of the camera\r\n * @param mesh Defines the mesh to check\r\n * @returns true if active, false otherwise\r\n */\r\n Camera.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n /**\r\n * Is this camera ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including post processes) has to be done (false by default)\r\n * @return true if the camera is ready\r\n */\r\n Camera.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (completeCheck) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var pp = _a[_i];\r\n if (pp && !pp.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return _super.prototype.isReady.call(this, completeCheck);\r\n };\r\n /** @hidden */\r\n Camera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.upVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.mode = undefined;\r\n this._cache.minZ = undefined;\r\n this._cache.maxZ = undefined;\r\n this._cache.fov = undefined;\r\n this._cache.fovMode = undefined;\r\n this._cache.aspectRatio = undefined;\r\n this._cache.orthoLeft = undefined;\r\n this._cache.orthoRight = undefined;\r\n this._cache.orthoBottom = undefined;\r\n this._cache.orthoTop = undefined;\r\n this._cache.renderWidth = undefined;\r\n this._cache.renderHeight = undefined;\r\n };\r\n /** @hidden */\r\n Camera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache.position.copyFrom(this.position);\r\n this._cache.upVector.copyFrom(this.upVector);\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronized = function () {\r\n return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronized.call(this)) {\r\n return false;\r\n }\r\n return this._cache.position.equals(this.position)\r\n && this._cache.upVector.equals(this.upVector)\r\n && this.isSynchronizedWithParent();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedProjectionMatrix = function () {\r\n var check = this._cache.mode === this.mode\r\n && this._cache.minZ === this.minZ\r\n && this._cache.maxZ === this.maxZ;\r\n if (!check) {\r\n return false;\r\n }\r\n var engine = this.getEngine();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n check = this._cache.fov === this.fov\r\n && this._cache.fovMode === this.fovMode\r\n && this._cache.aspectRatio === engine.getAspectRatio(this);\r\n }\r\n else {\r\n check = this._cache.orthoLeft === this.orthoLeft\r\n && this._cache.orthoRight === this.orthoRight\r\n && this._cache.orthoBottom === this.orthoBottom\r\n && this._cache.orthoTop === this.orthoTop\r\n && this._cache.renderWidth === engine.getRenderWidth()\r\n && this._cache.renderHeight === engine.getRenderHeight();\r\n }\r\n return check;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n Camera.prototype.attachControl = function (element, noPreventDefault) {\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n Camera.prototype.detachControl = function (element) {\r\n };\r\n /**\r\n * Update the camera state according to the different inputs gathered during the frame.\r\n */\r\n Camera.prototype.update = function () {\r\n this._checkInputs();\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._updateRigCameras();\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._checkInputs = function () {\r\n this.onAfterCheckInputsObservable.notifyObservers(this);\r\n };\r\n Object.defineProperty(Camera.prototype, \"rigCameras\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._rigCameras;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rigPostProcess\", {\r\n /**\r\n * Gets the post process used by the rig cameras\r\n */\r\n get: function () {\r\n return this._rigPostProcess;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Internal, gets the first post proces.\r\n * @returns the first post process to be run on this camera.\r\n */\r\n Camera.prototype._getFirstPostProcess = function () {\r\n for (var ppIndex = 0; ppIndex < this._postProcesses.length; ppIndex++) {\r\n if (this._postProcesses[ppIndex] !== null) {\r\n return this._postProcesses[ppIndex];\r\n }\r\n }\r\n return null;\r\n };\r\n Camera.prototype._cascadePostProcessesToRigCams = function () {\r\n // invalidate framebuffer\r\n var firstPostProcess = this._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera\r\n for (var i = 0, len = this._rigCameras.length; i < len; i++) {\r\n var cam = this._rigCameras[i];\r\n var rigPostProcess = cam._rigPostProcess;\r\n // for VR rig, there does not have to be a post process\r\n if (rigPostProcess) {\r\n var isPass = rigPostProcess.getEffectName() === \"pass\";\r\n if (isPass) {\r\n // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses\r\n cam.isIntermediate = this._postProcesses.length === 0;\r\n }\r\n cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);\r\n rigPostProcess.markTextureDirty();\r\n }\r\n else {\r\n cam._postProcesses = this._postProcesses.slice(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Attach a post process to the camera.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to attach to the camera\r\n * @param insertAt The position of the post process in case several of them are in use in the scene\r\n * @returns the position the post process has been inserted at\r\n */\r\n Camera.prototype.attachPostProcess = function (postProcess, insertAt) {\r\n if (insertAt === void 0) { insertAt = null; }\r\n if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_7__[\"Logger\"].Error(\"You're trying to reuse a post process not defined as reusable.\");\r\n return 0;\r\n }\r\n if (insertAt == null || insertAt < 0) {\r\n this._postProcesses.push(postProcess);\r\n }\r\n else if (this._postProcesses[insertAt] === null) {\r\n this._postProcesses[insertAt] = postProcess;\r\n }\r\n else {\r\n this._postProcesses.splice(insertAt, 0, postProcess);\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n return this._postProcesses.indexOf(postProcess);\r\n };\r\n /**\r\n * Detach a post process to the camera.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to detach from the camera\r\n */\r\n Camera.prototype.detachPostProcess = function (postProcess) {\r\n var idx = this._postProcesses.indexOf(postProcess);\r\n if (idx !== -1) {\r\n this._postProcesses[idx] = null;\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n };\r\n /**\r\n * Gets the current world matrix of the camera\r\n */\r\n Camera.prototype.getWorldMatrix = function () {\r\n if (this._isSynchronizedViewMatrix()) {\r\n return this._worldMatrix;\r\n }\r\n // Getting the the view matrix will also compute the world matrix.\r\n this.getViewMatrix();\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n Camera.prototype._getViewMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n };\r\n /**\r\n * Gets the current view matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the view matrix\r\n */\r\n Camera.prototype.getViewMatrix = function (force) {\r\n if (!force && this._isSynchronizedViewMatrix()) {\r\n return this._computedViewMatrix;\r\n }\r\n this.updateCache();\r\n this._computedViewMatrix = this._getViewMatrix();\r\n this._currentRenderId = this.getScene().getRenderId();\r\n this._childUpdateId++;\r\n this._refreshFrustumPlanes = true;\r\n if (this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix) {\r\n this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix);\r\n }\r\n // Notify parent camera if rig camera is changed\r\n if (this.parent && this.parent.onViewMatrixChangedObservable) {\r\n this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent);\r\n }\r\n this.onViewMatrixChangedObservable.notifyObservers(this);\r\n this._computedViewMatrix.invertToRef(this._worldMatrix);\r\n return this._computedViewMatrix;\r\n };\r\n /**\r\n * Freeze the projection matrix.\r\n * It will prevent the cache check of the camera projection compute and can speed up perf\r\n * if no parameter of the camera are meant to change\r\n * @param projection Defines manually a projection if necessary\r\n */\r\n Camera.prototype.freezeProjectionMatrix = function (projection) {\r\n this._doNotComputeProjectionMatrix = true;\r\n if (projection !== undefined) {\r\n this._projectionMatrix = projection;\r\n }\r\n };\r\n /**\r\n * Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.\r\n */\r\n Camera.prototype.unfreezeProjectionMatrix = function () {\r\n this._doNotComputeProjectionMatrix = false;\r\n };\r\n /**\r\n * Gets the current projection matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the projection matrix\r\n */\r\n Camera.prototype.getProjectionMatrix = function (force) {\r\n if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {\r\n return this._projectionMatrix;\r\n }\r\n // Cache\r\n this._cache.mode = this.mode;\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = this.maxZ;\r\n // Matrix\r\n this._refreshFrustumPlanes = true;\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n this._cache.fov = this.fov;\r\n this._cache.fovMode = this.fovMode;\r\n this._cache.aspectRatio = engine.getAspectRatio(this);\r\n if (this.minZ <= 0) {\r\n this.minZ = 0.1;\r\n }\r\n if (scene.useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].PerspectiveFovRHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].PerspectiveFovLHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);\r\n }\r\n }\r\n else {\r\n var halfWidth = engine.getRenderWidth() / 2.0;\r\n var halfHeight = engine.getRenderHeight() / 2.0;\r\n if (scene.useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].OrthoOffCenterRHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n this._cache.orthoLeft = this.orthoLeft;\r\n this._cache.orthoRight = this.orthoRight;\r\n this._cache.orthoBottom = this.orthoBottom;\r\n this._cache.orthoTop = this.orthoTop;\r\n this._cache.renderWidth = engine.getRenderWidth();\r\n this._cache.renderHeight = engine.getRenderHeight();\r\n }\r\n this.onProjectionMatrixChangedObservable.notifyObservers(this);\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the transformation matrix (ie. the multiplication of view by projection matrices)\r\n * @returns a Matrix\r\n */\r\n Camera.prototype.getTransformationMatrix = function () {\r\n this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n return this._transformMatrix;\r\n };\r\n Camera.prototype._updateFrustumPlanes = function () {\r\n if (!this._refreshFrustumPlanes) {\r\n return;\r\n }\r\n this.getTransformationMatrix();\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_11__[\"Frustum\"].GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_11__[\"Frustum\"].GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n this._refreshFrustumPlanes = false;\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * This checks the bounding box center. See isCompletelyInFrustum for a full bounding check\r\n * @param target The object to check\r\n * @param checkRigCameras If the rig cameras should be checked (eg. with webVR camera both eyes should be checked) (Default: false)\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isInFrustum = function (target, checkRigCameras) {\r\n if (checkRigCameras === void 0) { checkRigCameras = false; }\r\n this._updateFrustumPlanes();\r\n if (checkRigCameras && this.rigCameras.length > 0) {\r\n var result = false;\r\n this.rigCameras.forEach(function (cam) {\r\n cam._updateFrustumPlanes();\r\n result = result || target.isInFrustum(cam._frustumPlanes);\r\n });\r\n return result;\r\n }\r\n else {\r\n return target.isInFrustum(this._frustumPlanes);\r\n }\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param target The object to check\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isCompletelyInFrustum = function (target) {\r\n this._updateFrustumPlanes();\r\n return target.isCompletelyInFrustum(this._frustumPlanes);\r\n };\r\n /**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\n Camera.prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Camera.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Observables\r\n this.onViewMatrixChangedObservable.clear();\r\n this.onProjectionMatrixChangedObservable.clear();\r\n this.onAfterCheckInputsObservable.clear();\r\n this.onRestoreStateObservable.clear();\r\n // Inputs\r\n if (this.inputs) {\r\n this.inputs.clear();\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeCamera(this);\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n // Postprocesses\r\n if (this._rigPostProcess) {\r\n this._rigPostProcess.dispose(this);\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else {\r\n var i = this._postProcesses.length;\r\n while (--i >= 0) {\r\n var postProcess = this._postProcesses[i];\r\n if (postProcess) {\r\n postProcess.dispose(this);\r\n }\r\n }\r\n }\r\n // Render targets\r\n var i = this.customRenderTargets.length;\r\n while (--i >= 0) {\r\n this.customRenderTargets[i].dispose();\r\n }\r\n this.customRenderTargets = [];\r\n // Active Meshes\r\n this._activeMeshes.dispose();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n Object.defineProperty(Camera.prototype, \"isLeftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isLeftCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"isRightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isRightCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"leftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the left camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getLeftTarget = function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0].getTarget();\r\n };\r\n /**\r\n * Gets the right camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getRightTarget = function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1].getTarget();\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Camera.prototype.setCameraRigMode = function (mode, rigParams) {\r\n if (this.cameraRigMode === mode) {\r\n return;\r\n }\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n this.cameraRigMode = mode;\r\n this._cameraRigParams = {};\r\n //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target,\r\n //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced\r\n this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;\r\n this._cameraRigParams.stereoHalfAngle = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].ToRadians(this._cameraRigParams.interaxialDistance / 0.0637);\r\n // create the rig cameras, unless none\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n var leftCamera = this.createRigCamera(this.name + \"_L\", 0);\r\n if (leftCamera) {\r\n leftCamera._isLeftCamera = true;\r\n }\r\n var rightCamera = this.createRigCamera(this.name + \"_R\", 1);\r\n if (rightCamera) {\r\n rightCamera._isRightCamera = true;\r\n }\r\n if (leftCamera && rightCamera) {\r\n this._rigCameras.push(leftCamera);\r\n this._rigCameras.push(rightCamera);\r\n }\r\n }\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n Camera._setStereoscopicAnaglyphRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n Camera._setStereoscopicRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_VR:\r\n Camera._setVRRigMode(this, rigParams);\r\n break;\r\n case Camera.RIG_MODE_WEBVR:\r\n Camera._setWebVRRigMode(this, rigParams);\r\n break;\r\n }\r\n this._cascadePostProcessesToRigCams();\r\n this.update();\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicAnaglyphRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/vrRigMode before using VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setWebVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera.prototype._getVRProjectionMatrix = function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix);\r\n this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);\r\n return this._projectionMatrix;\r\n };\r\n Camera.prototype._updateCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n Camera.prototype._updateWebVRCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRProjectionMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRViewMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n };\r\n /** @hidden */\r\n Camera.prototype.setCameraRigParameter = function (name, value) {\r\n if (!this._cameraRigParams) {\r\n this._cameraRigParams = {};\r\n }\r\n this._cameraRigParams[name] = value;\r\n //provisionnally:\r\n if (name === \"interaxialDistance\") {\r\n this._cameraRigParams.stereoHalfAngle = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].ToRadians(value / 0.0637);\r\n }\r\n };\r\n /**\r\n * needs to be overridden by children so sub has required properties to be copied\r\n * @hidden\r\n */\r\n Camera.prototype.createRigCamera = function (name, cameraIndex) {\r\n return null;\r\n };\r\n /**\r\n * May need to be overridden by children\r\n * @hidden\r\n */\r\n Camera.prototype._updateRigCameras = function () {\r\n for (var i = 0; i < this._rigCameras.length; i++) {\r\n this._rigCameras[i].minZ = this.minZ;\r\n this._rigCameras[i].maxZ = this.maxZ;\r\n this._rigCameras[i].fov = this.fov;\r\n this._rigCameras[i].upVector.copyFrom(this.upVector);\r\n }\r\n // only update viewport when ANAGLYPH\r\n if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {\r\n this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._setupInputs = function () {\r\n };\r\n /**\r\n * Serialiaze the camera setup to a json represention\r\n * @returns the JSON representation\r\n */\r\n Camera.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n // Type\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n if (this.inputs) {\r\n this.inputs.serialize(serializationObject);\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Clones the current camera.\r\n * @param name The cloned camera name\r\n * @returns the cloned camera\r\n */\r\n Camera.prototype.clone = function (name) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(Camera.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);\r\n };\r\n /**\r\n * Gets the direction of the camera relative to a given local axis.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @return the direction\r\n */\r\n Camera.prototype.getDirection = function (localAxis) {\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n /**\r\n * Gets the direction of the camera relative to a given local axis into a passed vector.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @param result Defines the vector to store the result in\r\n */\r\n Camera.prototype.getDirectionToRef = function (localAxis, result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n };\r\n /**\r\n * Gets a camera constructor for a given camera type\r\n * @param type The type of the camera to construct (should be equal to one of the camera class name)\r\n * @param name The name of the camera the result will be able to instantiate\r\n * @param scene The scene the result will construct the camera in\r\n * @param interaxial_distance In case of stereoscopic setup, the distance between both eyes\r\n * @param isStereoscopicSideBySide In case of stereoscopic setup, should the sereo be side b side\r\n * @returns a factory method to construc the camera\r\n */\r\n Camera.GetConstructorFromName = function (type, name, scene, interaxial_distance, isStereoscopicSideBySide) {\r\n if (interaxial_distance === void 0) { interaxial_distance = 0; }\r\n if (isStereoscopicSideBySide === void 0) { isStereoscopicSideBySide = true; }\r\n var constructorFunc = _node__WEBPACK_IMPORTED_MODULE_6__[\"Node\"].Construct(type, name, scene, {\r\n interaxial_distance: interaxial_distance,\r\n isStereoscopicSideBySide: isStereoscopicSideBySide\r\n });\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to universal camera\r\n return function () { return Camera._createDefaultParsedCamera(name, scene); };\r\n };\r\n /**\r\n * Compute the world matrix of the camera.\r\n * @returns the camera workd matrix\r\n */\r\n Camera.prototype.computeWorldMatrix = function () {\r\n return this.getWorldMatrix();\r\n };\r\n /**\r\n * Parse a JSON and creates the camera from the parsed information\r\n * @param parsedCamera The JSON to parse\r\n * @param scene The scene to instantiate the camera in\r\n * @returns the newly constructed camera\r\n */\r\n Camera.Parse = function (parsedCamera, scene) {\r\n var type = parsedCamera.type;\r\n var construct = Camera.GetConstructorFromName(type, parsedCamera.name, scene, parsedCamera.interaxial_distance, parsedCamera.isStereoscopicSideBySide);\r\n var camera = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(construct, parsedCamera, scene);\r\n // Parent\r\n if (parsedCamera.parentId) {\r\n camera._waitingParentId = parsedCamera.parentId;\r\n }\r\n //If camera has an input manager, let it parse inputs settings\r\n if (camera.inputs) {\r\n camera.inputs.parse(parsedCamera);\r\n camera._setupInputs();\r\n }\r\n if (camera.setPosition) { // need to force position\r\n camera.position.copyFromFloats(0, 0, 0);\r\n camera.setPosition(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedCamera.position));\r\n }\r\n // Target\r\n if (parsedCamera.target) {\r\n if (camera.setTarget) {\r\n camera.setTarget(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedCamera.target));\r\n }\r\n }\r\n // Apply 3d rig, when found\r\n if (parsedCamera.cameraRigMode) {\r\n var rigParams = (parsedCamera.interaxial_distance) ? { interaxialDistance: parsedCamera.interaxial_distance } : {};\r\n camera.setCameraRigMode(parsedCamera.cameraRigMode, rigParams);\r\n }\r\n // Animations\r\n if (parsedCamera.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedCamera.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedCamera.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n camera.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_6__[\"Node\"].ParseAnimationRanges(camera, parsedCamera, scene);\r\n }\r\n if (parsedCamera.autoAnimate) {\r\n scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);\r\n }\r\n return camera;\r\n };\r\n /** @hidden */\r\n Camera._createDefaultParsedCamera = function (name, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"UniversalCamera\");\r\n };\r\n /**\r\n * This is the default projection mode used by the cameras.\r\n * It helps recreating a feeling of perspective and better appreciate depth.\r\n * This is the best way to simulate real life cameras.\r\n */\r\n Camera.PERSPECTIVE_CAMERA = 0;\r\n /**\r\n * This helps creating camera with an orthographic mode.\r\n * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.\r\n */\r\n Camera.ORTHOGRAPHIC_CAMERA = 1;\r\n /**\r\n * This is the default FOV mode for perspective cameras.\r\n * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_VERTICAL_FIXED = 0;\r\n /**\r\n * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_HORIZONTAL_FIXED = 1;\r\n /**\r\n * This specifies ther is no need for a camera rig.\r\n * Basically only one eye is rendered corresponding to the camera.\r\n */\r\n Camera.RIG_MODE_NONE = 0;\r\n /**\r\n * Simulates a camera Rig with one blue eye and one red eye.\r\n * This can be use with 3d blue and red glasses.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a none parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;\r\n /**\r\n * Defines that both eyes of the camera will be rendered over under each other.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (carbox).\r\n */\r\n Camera.RIG_MODE_VR = 20;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (webVR).\r\n */\r\n Camera.RIG_MODE_WEBVR = 21;\r\n /**\r\n * Custom rig mode allowing rig cameras to be populated manually with any number of cameras\r\n */\r\n Camera.RIG_MODE_CUSTOM = 22;\r\n /**\r\n * Defines if by default attaching controls should prevent the default javascript event to continue.\r\n */\r\n Camera.ForceAttachControlToAlwaysPreventDefault = false;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"position\")\r\n ], Camera.prototype, \"_position\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], Camera.prototype, \"upVector\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoLeft\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoRight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoBottom\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoTop\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"fov\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"minZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"maxZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"inertia\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"mode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"layerMask\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"fovMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"cameraRigMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"interaxialDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"isStereoscopicSideBySide\", void 0);\r\n return Camera;\r\n}(_node__WEBPACK_IMPORTED_MODULE_6__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/cameraInputsManager.ts\":\n/*!****************************************!*\\\n !*** ./Cameras/cameraInputsManager.ts ***!\n \\****************************************/\n/*! exports provided: CameraInputTypes, CameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return CameraInputTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return CameraInputsManager; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n\r\n\r\n\r\n/**\r\n * @ignore\r\n * This is a list of all the different input types that are available in the application.\r\n * Fo instance: ArcRotateCameraGamepadInput...\r\n */\r\nvar CameraInputTypes = {};\r\n/**\r\n * This represents the input manager used within a camera.\r\n * It helps dealing with all the different kind of input attached to a camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar CameraInputsManager = /** @class */ (function () {\r\n /**\r\n * Instantiate a new Camera Input Manager.\r\n * @param camera Defines the camera the input manager blongs to\r\n */\r\n function CameraInputsManager(camera) {\r\n this.attached = {};\r\n this.camera = camera;\r\n this.checkInputs = function () { };\r\n }\r\n /**\r\n * Add an input method to a camera\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param input camera input method\r\n */\r\n CameraInputsManager.prototype.add = function (input) {\r\n var type = input.getSimpleName();\r\n if (this.attached[type]) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"camera input of type \" + type + \" already exists on camera\");\r\n return;\r\n }\r\n this.attached[type] = input;\r\n input.camera = this.camera;\r\n //for checkInputs, we are dynamically creating a function\r\n //the goal is to avoid the performance penalty of looping for inputs in the render loop\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n if (this.attachedElement) {\r\n input.attachControl(this.attachedElement);\r\n }\r\n };\r\n /**\r\n * Remove a specific input method from a camera\r\n * example: camera.inputs.remove(camera.inputs.attached.mouse);\r\n * @param inputToRemove camera input method\r\n */\r\n CameraInputsManager.prototype.remove = function (inputToRemove) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input === inputToRemove) {\r\n input.detachControl(this.attachedElement);\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n /**\r\n * Remove a specific input type from a camera\r\n * example: camera.inputs.remove(\"ArcRotateCameraGamepadInput\");\r\n * @param inputType the type of the input to remove\r\n */\r\n CameraInputsManager.prototype.removeByType = function (inputType) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.getClassName() === inputType) {\r\n input.detachControl(this.attachedElement);\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n CameraInputsManager.prototype._addCheckInputs = function (fn) {\r\n var current = this.checkInputs;\r\n return function () {\r\n current();\r\n fn();\r\n };\r\n };\r\n /**\r\n * Attach the input controls to the currently attached dom element to listen the events from.\r\n * @param input Defines the input to attach\r\n */\r\n CameraInputsManager.prototype.attachInput = function (input) {\r\n if (this.attachedElement) {\r\n input.attachControl(this.attachedElement, this.noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Attach the current manager inputs controls to a specific dom element to listen the events from.\r\n * @param element Defines the dom element to collect the events from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n CameraInputsManager.prototype.attachElement = function (element, noPreventDefault) {\r\n if (noPreventDefault === void 0) { noPreventDefault = false; }\r\n if (this.attachedElement) {\r\n return;\r\n }\r\n noPreventDefault = _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;\r\n this.attachedElement = element;\r\n this.noPreventDefault = noPreventDefault;\r\n for (var cam in this.attached) {\r\n this.attached[cam].attachControl(element, noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Detach the current manager inputs controls from a specific dom element.\r\n * @param element Defines the dom element to collect the events from\r\n * @param disconnect Defines whether the input should be removed from the current list of attached inputs\r\n */\r\n CameraInputsManager.prototype.detachElement = function (element, disconnect) {\r\n if (disconnect === void 0) { disconnect = false; }\r\n if (this.attachedElement !== element) {\r\n return;\r\n }\r\n for (var cam in this.attached) {\r\n this.attached[cam].detachControl(element);\r\n if (disconnect) {\r\n this.attached[cam].camera = null;\r\n }\r\n }\r\n this.attachedElement = null;\r\n };\r\n /**\r\n * Rebuild the dynamic inputCheck function from the current list of\r\n * defined inputs in the manager.\r\n */\r\n CameraInputsManager.prototype.rebuildInputCheck = function () {\r\n this.checkInputs = function () { };\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n }\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n CameraInputsManager.prototype.clear = function () {\r\n if (this.attachedElement) {\r\n this.detachElement(this.attachedElement, true);\r\n }\r\n this.attached = {};\r\n this.attachedElement = null;\r\n this.checkInputs = function () { };\r\n };\r\n /**\r\n * Serialize the current input manager attached to a camera.\r\n * This ensures than once parsed,\r\n * the input associated to the camera will be identical to the current ones\r\n * @param serializedCamera Defines the camera serialization JSON the input serialization should write to\r\n */\r\n CameraInputsManager.prototype.serialize = function (serializedCamera) {\r\n var inputs = {};\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n var res = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(input);\r\n inputs[input.getClassName()] = res;\r\n }\r\n serializedCamera.inputsmgr = inputs;\r\n };\r\n /**\r\n * Parses an input manager serialized JSON to restore the previous list of inputs\r\n * and states associated to a camera.\r\n * @param parsedCamera Defines the JSON to parse\r\n */\r\n CameraInputsManager.prototype.parse = function (parsedCamera) {\r\n var parsedInputs = parsedCamera.inputsmgr;\r\n if (parsedInputs) {\r\n this.clear();\r\n for (var n in parsedInputs) {\r\n var construct = CameraInputTypes[n];\r\n if (construct) {\r\n var parsedinput = parsedInputs[n];\r\n var input = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new construct(); }, parsedinput, null);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n else {\r\n //2016-03-08 this part is for managing backward compatibility\r\n for (var n in this.attached) {\r\n var construct = CameraInputTypes[this.attached[n].getClassName()];\r\n if (construct) {\r\n var input = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new construct(); }, parsedCamera, null);\r\n this.remove(this.attached[n]);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n };\r\n return CameraInputsManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/deviceOrientationCamera.ts\":\n/*!********************************************!*\\\n !*** ./Cameras/deviceOrientationCamera.ts ***!\n \\********************************************/\n/*! exports provided: DeviceOrientationCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return DeviceOrientationCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Inputs_freeCameraDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Inputs/freeCameraDeviceOrientationInput */ \"./Cameras/Inputs/freeCameraDeviceOrientationInput.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"DeviceOrientationCamera\", function (name, scene) {\r\n return function () { return new DeviceOrientationCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n// We're mainly based on the logic defined into the FreeCamera code\r\n/**\r\n * This is a camera specifically designed to react to device orientation events such as a modern mobile device\r\n * being tilted forward or back and left or right.\r\n */\r\nvar DeviceOrientationCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DeviceOrientationCamera, _super);\r\n /**\r\n * Creates a new device orientation camera\r\n * @param name The name of the camera\r\n * @param position The start position camera\r\n * @param scene The scene the camera belongs to\r\n */\r\n function DeviceOrientationCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this._tmpDragQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this._disablePointerInputWhenUsingDeviceOrientation = true;\r\n _this._dragFactor = 0;\r\n _this._quaternionCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this.inputs.addDeviceOrientation();\r\n // When the orientation sensor fires it's first event, disable mouse input\r\n if (_this.inputs._deviceOrientationInput) {\r\n _this.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function () {\r\n if (_this._disablePointerInputWhenUsingDeviceOrientation) {\r\n if (_this.inputs._mouseInput) {\r\n _this.inputs._mouseInput._allowCameraRotation = false;\r\n _this.inputs._mouseInput.onPointerMovedObservable.add(function (e) {\r\n if (_this._dragFactor != 0) {\r\n if (!_this._initialQuaternion) {\r\n _this._initialQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n // Rotate the initial space around the y axis to allow users to \"turn around\" via touch/mouse\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].FromEulerAnglesToRef(0, e.offsetX * _this._dragFactor, 0, _this._tmpDragQuaternion);\r\n _this._initialQuaternion.multiplyToRef(_this._tmpDragQuaternion, _this._initialQuaternion);\r\n }\r\n });\r\n }\r\n }\r\n });\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(DeviceOrientationCamera.prototype, \"disablePointerInputWhenUsingDeviceOrientation\", {\r\n /**\r\n * Gets or sets a boolean indicating that pointer input must be disabled on first orientation sensor update (Default: true)\r\n */\r\n get: function () {\r\n return this._disablePointerInputWhenUsingDeviceOrientation;\r\n },\r\n set: function (value) {\r\n this._disablePointerInputWhenUsingDeviceOrientation = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Enabled turning on the y axis when the orientation sensor is active\r\n * @param dragFactor the factor that controls the turn speed (default: 1/300)\r\n */\r\n DeviceOrientationCamera.prototype.enableHorizontalDragging = function (dragFactor) {\r\n if (dragFactor === void 0) { dragFactor = 1 / 300; }\r\n this._dragFactor = dragFactor;\r\n };\r\n /**\r\n * Gets the current instance class name (\"DeviceOrientationCamera\").\r\n * This helps avoiding instanceof at run time.\r\n * @returns the class name\r\n */\r\n DeviceOrientationCamera.prototype.getClassName = function () {\r\n return \"DeviceOrientationCamera\";\r\n };\r\n /**\r\n * @hidden\r\n * Checks and applies the current values of the inputs to the camera. (Internal use only)\r\n */\r\n DeviceOrientationCamera.prototype._checkInputs = function () {\r\n _super.prototype._checkInputs.call(this);\r\n this._quaternionCache.copyFrom(this.rotationQuaternion);\r\n if (this._initialQuaternion) {\r\n this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n }\r\n };\r\n /**\r\n * Reset the camera to its default orientation on the specified axis only.\r\n * @param axis The axis to reset\r\n */\r\n DeviceOrientationCamera.prototype.resetToCurrentRotation = function (axis) {\r\n var _this = this;\r\n if (axis === void 0) { axis = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y; }\r\n //can only work if this camera has a rotation quaternion already.\r\n if (!this.rotationQuaternion) {\r\n return;\r\n }\r\n if (!this._initialQuaternion) {\r\n this._initialQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._initialQuaternion.copyFrom(this._quaternionCache || this.rotationQuaternion);\r\n ['x', 'y', 'z'].forEach(function (axisName) {\r\n if (!axis[axisName]) {\r\n _this._initialQuaternion[axisName] = 0;\r\n }\r\n else {\r\n _this._initialQuaternion[axisName] *= -1;\r\n }\r\n });\r\n this._initialQuaternion.normalize();\r\n //force rotation update\r\n this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n };\r\n return DeviceOrientationCamera;\r\n}(_freeCamera__WEBPACK_IMPORTED_MODULE_1__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/flyCamera.ts\":\n/*!******************************!*\\\n !*** ./Cameras/flyCamera.ts ***!\n \\******************************/\n/*! exports provided: FlyCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return FlyCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flyCameraInputsManager */ \"./Cameras/flyCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This is a flying camera, designed for 3D movement and rotation in all directions,\r\n * such as in a 3D Space Shooter or a Flight Simulator.\r\n */\r\nvar FlyCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FlyCamera, _super);\r\n /**\r\n * Instantiates a FlyCamera.\r\n * This is a flying camera, designed for 3D movement and rotation in all directions,\r\n * such as in a 3D Space Shooter or a Flight Simulator.\r\n * @param name Define the name of the camera in the scene.\r\n * @param position Define the starting position of the camera in the scene.\r\n * @param scene Define the scene the camera belongs to.\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active, if no other camera has been defined as active.\r\n */\r\n function FlyCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful for simulating a camera body, like a player's body.\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.ellipsoid = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1, 1, 1);\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful if the camera is attached away from the player's body center,\r\n * such as at its head.\r\n */\r\n _this.ellipsoidOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n _this.applyGravity = false;\r\n /**\r\n * Define the current direction the camera is moving to.\r\n */\r\n _this.cameraDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /**\r\n * Track Roll to maintain the wanted Rolling when looking around.\r\n */\r\n _this._trackRoll = 0;\r\n /**\r\n * Slowly correct the Roll to its original value after a Pitch+Yaw rotation.\r\n */\r\n _this.rollCorrect = 100;\r\n /**\r\n * Mimic a banked turn, Rolling the camera when Yawing.\r\n * It's recommended to use rollCorrect = 10 for faster banking correction.\r\n */\r\n _this.bankedTurn = false;\r\n /**\r\n * Limit in radians for how much Roll banking will add. (Default: 90°)\r\n */\r\n _this.bankedTurnLimit = Math.PI / 2;\r\n /**\r\n * Value of 0 disables the banked Roll.\r\n * Value of 1 is equal to the Yaw angle in radians.\r\n */\r\n _this.bankedTurnMultiplier = 1;\r\n _this._needMoveForGravity = false;\r\n _this._oldPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._diffPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n // Collisions.\r\n _this._collisionMask = -1;\r\n /** @hidden */\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n var updatePosition = function (newPos) {\r\n _this._newPosition.copyFrom(newPos);\r\n _this._newPosition.subtractToRef(_this._oldPosition, _this._diffPosition);\r\n if (_this._diffPosition.length() > _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._diffPosition);\r\n if (_this.onCollide && collidedMesh) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n };\r\n updatePosition(newPosition);\r\n };\r\n _this.inputs = new _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"FlyCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouse();\r\n return _this;\r\n }\r\n Object.defineProperty(FlyCamera.prototype, \"angularSensibility\", {\r\n /**\r\n * Gets the input sensibility for mouse input.\r\n * Higher values reduce sensitivity.\r\n */\r\n get: function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n return 0;\r\n },\r\n /**\r\n * Sets the input sensibility for a mouse input.\r\n * Higher values reduce sensitivity.\r\n */\r\n set: function (value) {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysForward\", {\r\n /**\r\n * Get the keys for camera movement forward.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysForward;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement forward.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysForward = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysBackward\", {\r\n /**\r\n * Get the keys for camera movement backward.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysBackward;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysBackward = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysUp\", {\r\n /**\r\n * Get the keys for camera movement up.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement up.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysDown\", {\r\n /**\r\n * Get the keys for camera movement down.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement down.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Get the keys for camera movement left.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement left.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysRight\", {\r\n /**\r\n * Set the keys for camera movement right.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement right.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach a control to the HTML DOM element.\r\n * @param element Defines the element that listens to the input events.\r\n * @param noPreventDefault Defines whether events caught by the controls should call preventdefault(). https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault\r\n */\r\n FlyCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n this.inputs.attachElement(element, noPreventDefault);\r\n };\r\n /**\r\n * Detach a control from the HTML DOM element.\r\n * The camera will stop reacting to that input.\r\n * @param element Defines the element that listens to the input events.\r\n */\r\n FlyCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n this.cameraDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n };\r\n Object.defineProperty(FlyCamera.prototype, \"collisionMask\", {\r\n /**\r\n * Get the mask that the camera ignores in collision events.\r\n */\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n /**\r\n * Set the mask that the camera ignores in collision events.\r\n */\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n FlyCamera.prototype._collideWithWorld = function (displacement) {\r\n var globalPosition;\r\n if (this.parent) {\r\n globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n }\r\n else {\r\n globalPosition = this.position;\r\n }\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n // No need for clone, as long as gravity is not on.\r\n var actualDisplacement = displacement;\r\n // Add gravity to direction to prevent dual-collision checking.\r\n if (this.applyGravity) {\r\n // This prevents mending with cameraDirection, a global variable of the fly camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n };\r\n /** @hidden */\r\n FlyCamera.prototype._checkInputs = function () {\r\n if (!this._localDirection) {\r\n this._localDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n this.inputs.checkInputs();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /** @hidden */\r\n FlyCamera.prototype._decideIfNeedsToMove = function () {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n FlyCamera.prototype._updatePosition = function () {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n }\r\n else {\r\n _super.prototype._updatePosition.call(this);\r\n }\r\n };\r\n /**\r\n * Restore the Roll to its target value at the rate specified.\r\n * @param rate - Higher means slower restoring.\r\n * @hidden\r\n */\r\n FlyCamera.prototype.restoreRoll = function (rate) {\r\n var limit = this._trackRoll; // Target Roll.\r\n var z = this.rotation.z; // Current Roll.\r\n var delta = limit - z; // Difference in Roll.\r\n var minRad = 0.001; // Tenth of a radian is a barely noticable difference.\r\n // If the difference is noticable, restore the Roll.\r\n if (Math.abs(delta) >= minRad) {\r\n // Change Z rotation towards the target Roll.\r\n this.rotation.z += delta / rate;\r\n // Match when near enough.\r\n if (Math.abs(limit - this.rotation.z) <= minRad) {\r\n this.rotation.z = limit;\r\n }\r\n }\r\n };\r\n /**\r\n * Destroy the camera and release the current resources held by it.\r\n */\r\n FlyCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Get the current object class name.\r\n * @returns the class name.\r\n */\r\n FlyCamera.prototype.getClassName = function () {\r\n return \"FlyCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FlyCamera.prototype, \"ellipsoid\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FlyCamera.prototype, \"ellipsoidOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCamera.prototype, \"checkCollisions\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCamera.prototype, \"applyGravity\", void 0);\r\n return FlyCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/flyCameraInputsManager.ts\":\n/*!*******************************************!*\\\n !*** ./Cameras/flyCameraInputsManager.ts ***!\n \\*******************************************/\n/*! exports provided: FlyCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return FlyCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/Inputs/flyCameraMouseInput */ \"./Cameras/Inputs/flyCameraMouseInput.ts\");\n/* harmony import */ var _Cameras_Inputs_flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/Inputs/flyCameraKeyboardInput */ \"./Cameras/Inputs/flyCameraKeyboardInput.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the FlyCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FlyCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FlyCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FlyCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to.\r\n */\r\n function FlyCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the new FlyCameraKeyboardMoveInput().\r\n */\r\n FlyCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Cameras_Inputs_flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_3__[\"FlyCameraKeyboardInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add mouse input support to the input manager.\r\n * @param touchEnabled Enable touch screen support.\r\n * @returns the new FlyCameraMouseInput().\r\n */\r\n FlyCameraInputsManager.prototype.addMouse = function (touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n this.add(new _Cameras_Inputs_flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_2__[\"FlyCameraMouseInput\"](touchEnabled));\r\n return this;\r\n };\r\n return FlyCameraInputsManager;\r\n}(_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/followCamera.ts\":\n/*!*********************************!*\\\n !*** ./Cameras/followCamera.ts ***!\n \\*********************************/\n/*! exports provided: FollowCamera, ArcFollowCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return FollowCamera; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return ArcFollowCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./followCameraInputsManager */ \"./Cameras/followCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"FollowCamera\", function (name, scene) {\r\n return function () { return new FollowCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"ArcFollowCamera\", function (name, scene) {\r\n return function () { return new ArcFollowCamera(name, 0, 0, 1.0, null, scene); };\r\n});\r\n/**\r\n * A follow camera takes a mesh as a target and follows it as it moves. Both a free camera version followCamera and\r\n * an arc rotate version arcFollowCamera are available.\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n */\r\nvar FollowCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FollowCamera, _super);\r\n /**\r\n * Instantiates the follow camera.\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the position of the camera\r\n * @param scene Define the scene the camera belong to\r\n * @param lockedTarget Define the target of the camera\r\n */\r\n function FollowCamera(name, position, scene, lockedTarget) {\r\n if (lockedTarget === void 0) { lockedTarget = null; }\r\n var _this = _super.call(this, name, position, scene) || this;\r\n /**\r\n * Distance the follow camera should follow an object at\r\n */\r\n _this.radius = 12;\r\n /**\r\n * Minimum allowed distance of the camera to the axis of rotation\r\n * (The camera can not get closer).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRadiusLimit = null;\r\n /**\r\n * Maximum allowed distance of the camera to the axis of rotation\r\n * (The camera can not get further).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRadiusLimit = null;\r\n /**\r\n * Define a rotation offset between the camera and the object it follows\r\n */\r\n _this.rotationOffset = 0;\r\n /**\r\n * Minimum allowed angle to camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRotationOffsetLimit = null;\r\n /**\r\n * Maximum allowed angle to camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRotationOffsetLimit = null;\r\n /**\r\n * Define a height offset between the camera and the object it follows.\r\n * It can help following an object from the top (like a car chaing a plane)\r\n */\r\n _this.heightOffset = 4;\r\n /**\r\n * Minimum allowed height of camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerHeightOffsetLimit = null;\r\n /**\r\n * Maximum allowed height of camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperHeightOffsetLimit = null;\r\n /**\r\n * Define how fast the camera can accelerate to follow it s target.\r\n */\r\n _this.cameraAcceleration = 0.05;\r\n /**\r\n * Define the speed limit of the camera following an object.\r\n */\r\n _this.maxCameraSpeed = 20;\r\n _this.lockedTarget = lockedTarget;\r\n _this.inputs = new _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_6__[\"FollowCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouseWheel().addPointers();\r\n return _this;\r\n // Uncomment the following line when the relevant handlers have been implemented.\r\n // this.inputs.addKeyboard().addMouseWheel().addPointers().addVRDeviceOrientation();\r\n }\r\n FollowCamera.prototype._follow = function (cameraTarget) {\r\n if (!cameraTarget) {\r\n return;\r\n }\r\n var yRotation;\r\n if (cameraTarget.rotationQuaternion) {\r\n var rotMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"]();\r\n cameraTarget.rotationQuaternion.toRotationMatrix(rotMatrix);\r\n yRotation = Math.atan2(rotMatrix.m[8], rotMatrix.m[10]);\r\n }\r\n else {\r\n yRotation = cameraTarget.rotation.y;\r\n }\r\n var radians = _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this.rotationOffset) + yRotation;\r\n var targetPosition = cameraTarget.getAbsolutePosition();\r\n var targetX = targetPosition.x + Math.sin(radians) * this.radius;\r\n var targetZ = targetPosition.z + Math.cos(radians) * this.radius;\r\n var dx = targetX - this.position.x;\r\n var dy = (targetPosition.y + this.heightOffset) - this.position.y;\r\n var dz = (targetZ) - this.position.z;\r\n var vx = dx * this.cameraAcceleration * 2; //this is set to .05\r\n var vy = dy * this.cameraAcceleration;\r\n var vz = dz * this.cameraAcceleration * 2;\r\n if (vx > this.maxCameraSpeed || vx < -this.maxCameraSpeed) {\r\n vx = vx < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;\r\n }\r\n if (vy > this.maxCameraSpeed || vy < -this.maxCameraSpeed) {\r\n vy = vy < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;\r\n }\r\n if (vz > this.maxCameraSpeed || vz < -this.maxCameraSpeed) {\r\n vz = vz < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;\r\n }\r\n this.position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](this.position.x + vx, this.position.y + vy, this.position.z + vz);\r\n this.setTarget(targetPosition);\r\n };\r\n /**\r\n * Attached controls to the current camera.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FollowCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n this.inputs.attachElement(element, noPreventDefault);\r\n this._reset = function () {\r\n };\r\n };\r\n /**\r\n * Detach the current controls from the camera.\r\n * The camera will stop reacting to inputs.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FollowCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n if (this._reset) {\r\n this._reset();\r\n }\r\n };\r\n /** @hidden */\r\n FollowCamera.prototype._checkInputs = function () {\r\n this.inputs.checkInputs();\r\n this._checkLimits();\r\n _super.prototype._checkInputs.call(this);\r\n if (this.lockedTarget) {\r\n this._follow(this.lockedTarget);\r\n }\r\n };\r\n FollowCamera.prototype._checkLimits = function () {\r\n if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {\r\n this.radius = this.lowerRadiusLimit;\r\n }\r\n if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {\r\n this.radius = this.upperRadiusLimit;\r\n }\r\n if (this.lowerHeightOffsetLimit !== null &&\r\n this.heightOffset < this.lowerHeightOffsetLimit) {\r\n this.heightOffset = this.lowerHeightOffsetLimit;\r\n }\r\n if (this.upperHeightOffsetLimit !== null &&\r\n this.heightOffset > this.upperHeightOffsetLimit) {\r\n this.heightOffset = this.upperHeightOffsetLimit;\r\n }\r\n if (this.lowerRotationOffsetLimit !== null &&\r\n this.rotationOffset < this.lowerRotationOffsetLimit) {\r\n this.rotationOffset = this.lowerRotationOffsetLimit;\r\n }\r\n if (this.upperRotationOffsetLimit !== null &&\r\n this.rotationOffset > this.upperRotationOffsetLimit) {\r\n this.rotationOffset = this.upperRotationOffsetLimit;\r\n }\r\n };\r\n /**\r\n * Gets the camera class name.\r\n * @returns the class name\r\n */\r\n FollowCamera.prototype.getClassName = function () {\r\n return \"FollowCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"lowerRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"upperRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"rotationOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"lowerRotationOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"upperRotationOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"heightOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"lowerHeightOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"upperHeightOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"cameraAcceleration\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"maxCameraSpeed\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])(\"lockedTargetId\")\r\n ], FollowCamera.prototype, \"lockedTarget\", void 0);\r\n return FollowCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_3__[\"TargetCamera\"]));\r\n\r\n/**\r\n * Arc Rotate version of the follow camera.\r\n * It still follows a Defined mesh but in an Arc Rotate Camera fashion.\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n */\r\nvar ArcFollowCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcFollowCamera, _super);\r\n /**\r\n * Instantiates a new ArcFollowCamera\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n * @param name Define the name of the camera\r\n * @param alpha Define the rotation angle of the camera around the logitudinal axis\r\n * @param beta Define the rotation angle of the camera around the elevation axis\r\n * @param radius Define the radius of the camera from its target point\r\n * @param target Define the target of the camera\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function ArcFollowCamera(name, \r\n /** The longitudinal angle of the camera */\r\n alpha, \r\n /** The latitudinal angle of the camera */\r\n beta, \r\n /** The radius of the camera from its target */\r\n radius, \r\n /** Define the camera target (the messh it should follow) */\r\n target, scene) {\r\n var _this = _super.call(this, name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene) || this;\r\n _this.alpha = alpha;\r\n _this.beta = beta;\r\n _this.radius = radius;\r\n _this.target = target;\r\n _this._cartesianCoordinates = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n _this._follow();\r\n return _this;\r\n }\r\n ArcFollowCamera.prototype._follow = function () {\r\n if (!this.target) {\r\n return;\r\n }\r\n this._cartesianCoordinates.x = this.radius * Math.cos(this.alpha) * Math.cos(this.beta);\r\n this._cartesianCoordinates.y = this.radius * Math.sin(this.beta);\r\n this._cartesianCoordinates.z = this.radius * Math.sin(this.alpha) * Math.cos(this.beta);\r\n var targetPosition = this.target.getAbsolutePosition();\r\n this.position = targetPosition.add(this._cartesianCoordinates);\r\n this.setTarget(targetPosition);\r\n };\r\n /** @hidden */\r\n ArcFollowCamera.prototype._checkInputs = function () {\r\n _super.prototype._checkInputs.call(this);\r\n this._follow();\r\n };\r\n /**\r\n * Returns the class name of the object.\r\n * It is mostly used internally for serialization purposes.\r\n */\r\n ArcFollowCamera.prototype.getClassName = function () {\r\n return \"ArcFollowCamera\";\r\n };\r\n return ArcFollowCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_3__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/followCameraInputsManager.ts\":\n/*!**********************************************!*\\\n !*** ./Cameras/followCameraInputsManager.ts ***!\n \\**********************************************/\n/*! exports provided: FollowCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return FollowCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Inputs_followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Inputs/followCameraKeyboardMoveInput */ \"./Cameras/Inputs/followCameraKeyboardMoveInput.ts\");\n/* harmony import */ var _Inputs_followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Inputs/followCameraMouseWheelInput */ \"./Cameras/Inputs/followCameraMouseWheelInput.ts\");\n/* harmony import */ var _Inputs_followCameraPointersInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Inputs/followCameraPointersInput */ \"./Cameras/Inputs/followCameraPointersInput.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the FollowCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FollowCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FollowCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function FollowCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Inputs_followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__[\"FollowCameraKeyboardMoveInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addMouseWheel = function () {\r\n this.add(new _Inputs_followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__[\"FollowCameraMouseWheelInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add pointers input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addPointers = function () {\r\n this.add(new _Inputs_followCameraPointersInput__WEBPACK_IMPORTED_MODULE_4__[\"FollowCameraPointersInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add orientation input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addVRDeviceOrientation = function () {\r\n console.warn(\"DeviceOrientation support not yet implemented for FollowCamera.\");\r\n return this;\r\n };\r\n return FollowCameraInputsManager;\r\n}(_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/freeCamera.ts\":\n/*!*******************************!*\\\n !*** ./Cameras/freeCamera.ts ***!\n \\*******************************/\n/*! exports provided: FreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return FreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar FreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FreeCamera, _super);\r\n /**\r\n * Instantiates a Free Camera.\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function FreeCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful to simulate a camera body like the player body around the camera\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.ellipsoid = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.5, 1, 0.5);\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful to determine the center of the body near the gravity center of the body\r\n * instead of its head.\r\n */\r\n _this.ellipsoidOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n _this.applyGravity = false;\r\n _this._needMoveForGravity = false;\r\n _this._oldPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._diffPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n // Collisions\r\n _this._collisionMask = -1;\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n var updatePosition = function (newPos) {\r\n _this._newPosition.copyFrom(newPos);\r\n _this._newPosition.subtractToRef(_this._oldPosition, _this._diffPosition);\r\n if (_this._diffPosition.length() > _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._diffPosition);\r\n if (_this.onCollide && collidedMesh) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n };\r\n updatePosition(newPosition);\r\n };\r\n _this.inputs = new _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"FreeCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouse();\r\n return _this;\r\n }\r\n Object.defineProperty(FreeCamera.prototype, \"angularSensibility\", {\r\n /**\r\n * Gets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n get: function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n return 0;\r\n },\r\n /**\r\n * Sets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n set: function (value) {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attached controls to the current camera.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n this.inputs.attachElement(element, noPreventDefault);\r\n };\r\n /**\r\n * Detach the current controls from the camera.\r\n * The camera will stop reacting to inputs.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n this.cameraDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n this.cameraRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 0);\r\n };\r\n Object.defineProperty(FreeCamera.prototype, \"collisionMask\", {\r\n /**\r\n * Define a collision mask to limit the list of object the camera can collide with\r\n */\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n FreeCamera.prototype._collideWithWorld = function (displacement) {\r\n var globalPosition;\r\n if (this.parent) {\r\n globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n }\r\n else {\r\n globalPosition = this.position;\r\n }\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n //no need for clone, as long as gravity is not on.\r\n var actualDisplacement = displacement;\r\n //add gravity to the direction to prevent the dual-collision checking\r\n if (this.applyGravity) {\r\n //this prevents mending with cameraDirection, a global variable of the free camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._checkInputs = function () {\r\n if (!this._localDirection) {\r\n this._localDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n this.inputs.checkInputs();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._decideIfNeedsToMove = function () {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._updatePosition = function () {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n }\r\n else {\r\n _super.prototype._updatePosition.call(this);\r\n }\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n FreeCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n FreeCamera.prototype.getClassName = function () {\r\n return \"FreeCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FreeCamera.prototype, \"ellipsoid\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FreeCamera.prototype, \"ellipsoidOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCamera.prototype, \"checkCollisions\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCamera.prototype, \"applyGravity\", void 0);\r\n return FreeCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/freeCameraInputsManager.ts\":\n/*!********************************************!*\\\n !*** ./Cameras/freeCameraInputsManager.ts ***!\n \\********************************************/\n/*! exports provided: FreeCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return FreeCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraKeyboardMoveInput */ \"./Cameras/Inputs/freeCameraKeyboardMoveInput.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraMouseInput */ \"./Cameras/Inputs/freeCameraMouseInput.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraTouchInput */ \"./Cameras/Inputs/freeCameraTouchInput.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the FreeCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FreeCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FreeCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function FreeCameraInputsManager(camera) {\r\n var _this = _super.call(this, camera) || this;\r\n /**\r\n * @hidden\r\n */\r\n _this._mouseInput = null;\r\n return _this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Cameras_Inputs_freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__[\"FreeCameraKeyboardMoveInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add mouse input support to the input manager.\r\n * @param touchEnabled if the FreeCameraMouseInput should support touch (default: true)\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addMouse = function (touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n if (!this._mouseInput) {\r\n this._mouseInput = new _Cameras_Inputs_freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraMouseInput\"](touchEnabled);\r\n this.add(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the mouse input support from the manager\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.removeMouse = function () {\r\n if (this._mouseInput) {\r\n this.remove(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add touch input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addTouch = function () {\r\n this.add(new _Cameras_Inputs_freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_4__[\"FreeCameraTouchInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n FreeCameraInputsManager.prototype.clear = function () {\r\n _super.prototype.clear.call(this);\r\n this._mouseInput = null;\r\n };\r\n return FreeCameraInputsManager;\r\n}(_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/gamepadCamera.ts\":\n/*!**********************************!*\\\n !*** ./Cameras/gamepadCamera.ts ***!\n \\**********************************/\n/*! exports provided: GamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return GamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _universalCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"GamepadCamera\", function (name, scene) {\r\n return function () { return new GamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a FPS type of camera. This is only here for back compat purpose.\r\n * Please use the UniversalCamera instead as both are identical.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar GamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GamepadCamera, _super);\r\n /**\r\n * Instantiates a new Gamepad Camera\r\n * This represents a FPS type of camera. This is only here for back compat purpose.\r\n * Please use the UniversalCamera instead as both are identical.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function GamepadCamera(name, position, scene) {\r\n return _super.call(this, name, position, scene) || this;\r\n }\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n GamepadCamera.prototype.getClassName = function () {\r\n return \"GamepadCamera\";\r\n };\r\n return GamepadCamera;\r\n}(_universalCamera__WEBPACK_IMPORTED_MODULE_1__[\"UniversalCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/index.ts\":\n/*!**************************!*\\\n !*** ./Cameras/index.ts ***!\n \\**************************/\n/*! exports provided: CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Inputs_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Inputs/index */ \"./Cameras/Inputs/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraTouchInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraVirtualJoystickInput\"]; });\n\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]; });\n\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"]; });\n\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return _targetCamera__WEBPACK_IMPORTED_MODULE_3__[\"TargetCamera\"]; });\n\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return _freeCamera__WEBPACK_IMPORTED_MODULE_4__[\"FreeCamera\"]; });\n\n/* harmony import */ var _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"FreeCameraInputsManager\"]; });\n\n/* harmony import */ var _touchCamera__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./touchCamera */ \"./Cameras/touchCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return _touchCamera__WEBPACK_IMPORTED_MODULE_6__[\"TouchCamera\"]; });\n\n/* harmony import */ var _arcRotateCamera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return _arcRotateCamera__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCamera\"]; });\n\n/* harmony import */ var _arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return _arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_8__[\"ArcRotateCameraInputsManager\"]; });\n\n/* harmony import */ var _deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./deviceOrientationCamera */ \"./Cameras/deviceOrientationCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return _deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_9__[\"DeviceOrientationCamera\"]; });\n\n/* harmony import */ var _flyCamera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flyCamera */ \"./Cameras/flyCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return _flyCamera__WEBPACK_IMPORTED_MODULE_10__[\"FlyCamera\"]; });\n\n/* harmony import */ var _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./flyCameraInputsManager */ \"./Cameras/flyCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__[\"FlyCameraInputsManager\"]; });\n\n/* harmony import */ var _followCamera__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./followCamera */ \"./Cameras/followCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return _followCamera__WEBPACK_IMPORTED_MODULE_12__[\"FollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return _followCamera__WEBPACK_IMPORTED_MODULE_12__[\"ArcFollowCamera\"]; });\n\n/* harmony import */ var _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./followCameraInputsManager */ \"./Cameras/followCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_13__[\"FollowCameraInputsManager\"]; });\n\n/* harmony import */ var _gamepadCamera__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./gamepadCamera */ \"./Cameras/gamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return _gamepadCamera__WEBPACK_IMPORTED_MODULE_14__[\"GamepadCamera\"]; });\n\n/* harmony import */ var _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Stereoscopic/index */ \"./Cameras/Stereoscopic/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicUniversalCamera\"]; });\n\n/* harmony import */ var _universalCamera__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return _universalCamera__WEBPACK_IMPORTED_MODULE_16__[\"UniversalCamera\"]; });\n\n/* harmony import */ var _virtualJoysticksCamera__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./virtualJoysticksCamera */ \"./Cameras/virtualJoysticksCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return _virtualJoysticksCamera__WEBPACK_IMPORTED_MODULE_17__[\"VirtualJoysticksCamera\"]; });\n\n/* harmony import */ var _VR_index__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./VR/index */ \"./Cameras/VR/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRCameraMetrics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"WebVRFreeCamera\"]; });\n\n/* harmony import */ var _XR_index__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./XR/index */ \"./Cameras/XR/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXREnterExitUI\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRSessionManager\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/targetCamera.ts\":\n/*!*********************************!*\\\n !*** ./Cameras/targetCamera.ts ***!\n \\*********************************/\n/*! exports provided: TargetCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return TargetCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A target camera takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar TargetCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TargetCamera, _super);\r\n /**\r\n * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see http://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the start position of the camera in the scene\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function TargetCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the current direction the camera is moving to\r\n */\r\n _this.cameraDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Define the current rotation the camera is rotating to\r\n */\r\n _this.cameraRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 0);\r\n /**\r\n * When set, the up vector of the camera will be updated by the rotation of the camera\r\n */\r\n _this.updateUpVectorFromRotation = false;\r\n _this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n /**\r\n * Define the current rotation of the camera\r\n */\r\n _this.rotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Define the current speed of the camera\r\n */\r\n _this.speed = 2.0;\r\n /**\r\n * Add cconstraint to the camera to prevent it to move freely in all directions and\r\n * around all axis.\r\n */\r\n _this.noRotationConstraint = false;\r\n /**\r\n * Define the current target of the camera as an object or a position.\r\n */\r\n _this.lockedTarget = null;\r\n /** @hidden */\r\n _this._currentTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n _this._initialFocalDistance = 1;\r\n /** @hidden */\r\n _this._viewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._camMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._cameraTransformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._cameraRotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._referencePoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1);\r\n /** @hidden */\r\n _this._transformedReferencePoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._globalCurrentTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._globalCurrentUpVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._defaultUp = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up();\r\n _this._cachedRotationZ = 0;\r\n _this._cachedQuaternionRotationZ = 0;\r\n return _this;\r\n }\r\n /**\r\n * Gets the position in front of the camera at a given distance.\r\n * @param distance The distance from the camera we want the position to be\r\n * @returns the position\r\n */\r\n TargetCamera.prototype.getFrontPosition = function (distance) {\r\n this.getWorldMatrix();\r\n var direction = this.getTarget().subtract(this.position);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n return this.globalPosition.add(direction);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getLockedTargetPosition = function () {\r\n if (!this.lockedTarget) {\r\n return null;\r\n }\r\n if (this.lockedTarget.absolutePosition) {\r\n this.lockedTarget.computeWorldMatrix();\r\n }\r\n return this.lockedTarget.absolutePosition || this.lockedTarget;\r\n };\r\n /**\r\n * Store current camera state of the camera (fov, position, rotation, etc..)\r\n * @returns the camera\r\n */\r\n TargetCamera.prototype.storeState = function () {\r\n this._storedPosition = this.position.clone();\r\n this._storedRotation = this.rotation.clone();\r\n if (this.rotationQuaternion) {\r\n this._storedRotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first\r\n * @returns whether it was successful or not\r\n * @hidden\r\n */\r\n TargetCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.position = this._storedPosition.clone();\r\n this.rotation = this._storedRotation.clone();\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = this._storedRotationQuaternion.clone();\r\n }\r\n this.cameraDirection.copyFromFloats(0, 0, 0);\r\n this.cameraRotation.copyFromFloats(0, 0);\r\n return true;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.lockedTarget = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (!lockedTargetPosition) {\r\n this._cache.lockedTarget = null;\r\n }\r\n else {\r\n if (!this._cache.lockedTarget) {\r\n this._cache.lockedTarget = lockedTargetPosition.clone();\r\n }\r\n else {\r\n this._cache.lockedTarget.copyFrom(lockedTargetPosition);\r\n }\r\n }\r\n this._cache.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n TargetCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition)\r\n && (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation));\r\n };\r\n // Methods\r\n /** @hidden */\r\n TargetCamera.prototype._computeLocalCameraSpeed = function () {\r\n var engine = this.getEngine();\r\n return this.speed * Math.sqrt((engine.getDeltaTime() / (engine.getFps() * 100.0)));\r\n };\r\n // Target\r\n /**\r\n * Defines the target the camera should look at.\r\n * @param target Defines the new target as a Vector or a mesh\r\n */\r\n TargetCamera.prototype.setTarget = function (target) {\r\n this.upVector.normalize();\r\n this._initialFocalDistance = target.subtract(this.position).length();\r\n if (this.position.z === target.z) {\r\n this.position.z += _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"];\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtLHToRef(this.position, target, this._defaultUp, this._camMatrix);\r\n this._camMatrix.invert();\r\n this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);\r\n var vDir = target.subtract(this.position);\r\n if (vDir.x >= 0.0) {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) + Math.PI / 2.0);\r\n }\r\n else {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) - Math.PI / 2.0);\r\n }\r\n this.rotation.z = 0;\r\n if (isNaN(this.rotation.x)) {\r\n this.rotation.x = 0;\r\n }\r\n if (isNaN(this.rotation.y)) {\r\n this.rotation.y = 0;\r\n }\r\n if (isNaN(this.rotation.z)) {\r\n this.rotation.z = 0;\r\n }\r\n if (this.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n };\r\n /**\r\n * Return the current target position of the camera. This value is expressed in local space.\r\n * @returns the target position\r\n */\r\n TargetCamera.prototype.getTarget = function () {\r\n return this._currentTarget;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._decideIfNeedsToMove = function () {\r\n return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updatePosition = function () {\r\n if (this.parent) {\r\n this.parent.getWorldMatrix().invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(this.cameraDirection, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0], _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0]);\r\n this.position.addInPlace(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0]);\r\n return;\r\n }\r\n this.position.addInPlace(this.cameraDirection);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._checkInputs = function () {\r\n var needToMove = this._decideIfNeedsToMove();\r\n var needToRotate = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0;\r\n // Move\r\n if (needToMove) {\r\n this._updatePosition();\r\n }\r\n // Rotate\r\n if (needToRotate) {\r\n this.rotation.x += this.cameraRotation.x;\r\n this.rotation.y += this.cameraRotation.y;\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n }\r\n if (!this.noRotationConstraint) {\r\n var limit = 1.570796;\r\n if (this.rotation.x > limit) {\r\n this.rotation.x = limit;\r\n }\r\n if (this.rotation.x < -limit) {\r\n this.rotation.x = -limit;\r\n }\r\n }\r\n }\r\n // Inertia\r\n if (needToMove) {\r\n if (Math.abs(this.cameraDirection.x) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraDirection.x = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.y) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraDirection.y = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.z) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraDirection.z = 0;\r\n }\r\n this.cameraDirection.scaleInPlace(this.inertia);\r\n }\r\n if (needToRotate) {\r\n if (Math.abs(this.cameraRotation.x) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraRotation.x = 0;\r\n }\r\n if (Math.abs(this.cameraRotation.y) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraRotation.y = 0;\r\n }\r\n this.cameraRotation.scaleInPlace(this.inertia);\r\n }\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n TargetCamera.prototype._updateCameraRotationMatrix = function () {\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);\r\n }\r\n };\r\n /**\r\n * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well)\r\n * @returns the current camera\r\n */\r\n TargetCamera.prototype._rotateUpVectorWithCameraRotationMatrix = function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(this._defaultUp, this._cameraRotationMatrix, this.upVector);\r\n return this;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getViewMatrix = function () {\r\n if (this.lockedTarget) {\r\n this.setTarget(this._getLockedTargetPosition());\r\n }\r\n // Compute\r\n this._updateCameraRotationMatrix();\r\n // Apply the changed rotation to the upVector\r\n if (this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedQuaternionRotationZ = this.rotationQuaternion.z;\r\n }\r\n else if (this._cachedRotationZ != this.rotation.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedRotationZ = this.rotation.z;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n if (this.updateUpVectorFromRotation) {\r\n if (this.rotationQuaternion) {\r\n _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].FromEulerVectorToRef(this.rotation, this._tmpQuaternion);\r\n _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);\r\n }\r\n }\r\n this._computeViewMatrix(this.position, this._currentTarget, this.upVector);\r\n return this._viewMatrix;\r\n };\r\n TargetCamera.prototype._computeViewMatrix = function (position, target, up) {\r\n if (this.parent) {\r\n var parentWorldMatrix = this.parent.getWorldMatrix();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(target, parentWorldMatrix, this._globalCurrentTarget);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(up, parentWorldMatrix, this._globalCurrentUpVector);\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._globalPosition.copyFrom(position);\r\n this._globalCurrentTarget.copyFrom(target);\r\n this._globalCurrentUpVector.copyFrom(up);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtRHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtLHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n if (this.cameraRigMode !== _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_NONE) {\r\n var rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());\r\n if (this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_VR || this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_WEBVR) {\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n }\r\n rigCamera._cameraRigParams = {};\r\n rigCamera.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n }\r\n return rigCamera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n this.computeWorldMatrix();\r\n switch (this.cameraRigMode) {\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:\r\n var leftSign = (this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;\r\n var rightSign = (this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);\r\n break;\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_VR:\r\n if (camLeft.rotationQuaternion) {\r\n camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n else {\r\n camLeft.rotation.copyFrom(this.rotation);\r\n camRight.rotation.copyFrom(this.rotation);\r\n }\r\n camLeft.position.copyFrom(this.position);\r\n camRight.position.copyFrom(this.position);\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n TargetCamera.prototype._getRigCamPositionAndTarget = function (halfSpace, rigCamera) {\r\n var target = this.getTarget();\r\n target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);\r\n TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n var newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._TargetTransformMatrix.multiplyToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationY(halfSpace), TargetCamera._RigCamTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);\r\n rigCamera.setTarget(newFocalTarget);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n TargetCamera.prototype.getClassName = function () {\r\n return \"TargetCamera\";\r\n };\r\n TargetCamera._RigCamTransformMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n TargetCamera._TargetTransformMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n TargetCamera._TargetFocalPoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], TargetCamera.prototype, \"rotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TargetCamera.prototype, \"speed\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])(\"lockedTargetId\")\r\n ], TargetCamera.prototype, \"lockedTarget\", void 0);\r\n return TargetCamera;\r\n}(_camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/touchCamera.ts\":\n/*!********************************!*\\\n !*** ./Cameras/touchCamera.ts ***!\n \\********************************/\n/*! exports provided: TouchCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return TouchCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"TouchCamera\", function (name, scene) {\r\n return function () { return new TouchCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a FPS type of camera controlled by touch.\r\n * This is like a universal camera minus the Gamepad controls.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar TouchCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TouchCamera, _super);\r\n /**\r\n * Instantiates a new touch camera.\r\n * This represents a FPS type of camera controlled by touch.\r\n * This is like a universal camera minus the Gamepad controls.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function TouchCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.inputs.addTouch();\r\n _this._setupInputs();\r\n return _this;\r\n }\r\n Object.defineProperty(TouchCamera.prototype, \"touchAngularSensibility\", {\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The higher the faster.\r\n */\r\n get: function () {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n return touch.touchAngularSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n touch.touchAngularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TouchCamera.prototype, \"touchMoveSensibility\", {\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The higher the faster.\r\n */\r\n get: function () {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n return touch.touchMoveSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n touch.touchMoveSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n TouchCamera.prototype.getClassName = function () {\r\n return \"TouchCamera\";\r\n };\r\n /** @hidden */\r\n TouchCamera.prototype._setupInputs = function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.touchEnabled = false;\r\n }\r\n };\r\n return TouchCamera;\r\n}(_freeCamera__WEBPACK_IMPORTED_MODULE_1__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/universalCamera.ts\":\n/*!************************************!*\\\n !*** ./Cameras/universalCamera.ts ***!\n \\************************************/\n/*! exports provided: UniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return UniversalCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _touchCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./touchCamera */ \"./Cameras/touchCamera.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Gamepads_gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Gamepads/gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_2__[\"Node\"].AddNodeConstructor(\"FreeCamera\", function (name, scene) {\r\n // Forcing to use the Universal camera\r\n return function () { return new UniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * The Universal Camera is the one to choose for first person shooter type games, and works with all the keyboard, mouse, touch and gamepads. This replaces the earlier Free Camera,\r\n * which still works and will still be found in many Playgrounds.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar UniversalCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](UniversalCamera, _super);\r\n /**\r\n * The Universal Camera is the one to choose for first person shooter type games, and works with all the keyboard, mouse, touch and gamepads. This replaces the earlier Free Camera,\r\n * which still works and will still be found in many Playgrounds.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function UniversalCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.inputs.addGamepad();\r\n return _this;\r\n }\r\n Object.defineProperty(UniversalCamera.prototype, \"gamepadAngularSensibility\", {\r\n /**\r\n * Defines the gamepad rotation sensiblity.\r\n * This is the threshold from when rotation starts to be accounted for to prevent jittering.\r\n */\r\n get: function () {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n return gamepad.gamepadAngularSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n gamepad.gamepadAngularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UniversalCamera.prototype, \"gamepadMoveSensibility\", {\r\n /**\r\n * Defines the gamepad move sensiblity.\r\n * This is the threshold from when moving starts to be accounted for for to prevent jittering.\r\n */\r\n get: function () {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n return gamepad.gamepadMoveSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n gamepad.gamepadMoveSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n UniversalCamera.prototype.getClassName = function () {\r\n return \"UniversalCamera\";\r\n };\r\n return UniversalCamera;\r\n}(_touchCamera__WEBPACK_IMPORTED_MODULE_1__[\"TouchCamera\"]));\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_4__[\"Camera\"]._createDefaultParsedCamera = function (name, scene) {\r\n return new UniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/virtualJoysticksCamera.ts\":\n/*!*******************************************!*\\\n !*** ./Cameras/virtualJoysticksCamera.ts ***!\n \\*******************************************/\n/*! exports provided: VirtualJoysticksCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return VirtualJoysticksCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Inputs_freeCameraVirtualJoystickInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Inputs/freeCameraVirtualJoystickInput */ \"./Cameras/Inputs/freeCameraVirtualJoystickInput.ts\");\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"VirtualJoysticksCamera\", function (name, scene) {\r\n return function () { return new VirtualJoysticksCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * It is identical to the Free Camera and simply adds by default a virtual joystick.\r\n * Virtual Joysticks are on-screen 2D graphics that are used to control the camera or other scene items.\r\n * @see http://doc.babylonjs.com/features/cameras#virtual-joysticks-camera\r\n */\r\nvar VirtualJoysticksCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VirtualJoysticksCamera, _super);\r\n /**\r\n * Intantiates a VirtualJoysticksCamera. It can be useful in First Person Shooter game for instance.\r\n * It is identical to the Free Camera and simply adds by default a virtual joystick.\r\n * Virtual Joysticks are on-screen 2D graphics that are used to control the camera or other scene items.\r\n * @see http://doc.babylonjs.com/features/cameras#virtual-joysticks-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function VirtualJoysticksCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.inputs.addVirtualJoystick();\r\n return _this;\r\n }\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n VirtualJoysticksCamera.prototype.getClassName = function () {\r\n return \"VirtualJoysticksCamera\";\r\n };\r\n return VirtualJoysticksCamera;\r\n}(_freeCamera__WEBPACK_IMPORTED_MODULE_1__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/collider.ts\":\n/*!********************************!*\\\n !*** ./Collisions/collider.ts ***!\n \\********************************/\n/*! exports provided: Collider */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return Collider; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\nvar intersectBoxAASphere = function (boxMin, boxMax, sphereCenter, sphereRadius) {\r\n if (boxMin.x > sphereCenter.x + sphereRadius) {\r\n return false;\r\n }\r\n if (sphereCenter.x - sphereRadius > boxMax.x) {\r\n return false;\r\n }\r\n if (boxMin.y > sphereCenter.y + sphereRadius) {\r\n return false;\r\n }\r\n if (sphereCenter.y - sphereRadius > boxMax.y) {\r\n return false;\r\n }\r\n if (boxMin.z > sphereCenter.z + sphereRadius) {\r\n return false;\r\n }\r\n if (sphereCenter.z - sphereRadius > boxMax.z) {\r\n return false;\r\n }\r\n return true;\r\n};\r\nvar getLowestRoot = (function () {\r\n var result = { root: 0, found: false };\r\n return function (a, b, c, maxR) {\r\n result.root = 0;\r\n result.found = false;\r\n var determinant = b * b - 4.0 * a * c;\r\n if (determinant < 0) {\r\n return result;\r\n }\r\n var sqrtD = Math.sqrt(determinant);\r\n var r1 = (-b - sqrtD) / (2.0 * a);\r\n var r2 = (-b + sqrtD) / (2.0 * a);\r\n if (r1 > r2) {\r\n var temp = r2;\r\n r2 = r1;\r\n r1 = temp;\r\n }\r\n if (r1 > 0 && r1 < maxR) {\r\n result.root = r1;\r\n result.found = true;\r\n return result;\r\n }\r\n if (r2 > 0 && r2 < maxR) {\r\n result.root = r2;\r\n result.found = true;\r\n return result;\r\n }\r\n return result;\r\n };\r\n})();\r\n/** @hidden */\r\nvar Collider = /** @class */ (function () {\r\n function Collider() {\r\n this._collisionPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._planeIntersectionPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._edge = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._baseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._destinationPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._slidePlaneNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._displacementVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n this._radius = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].One();\r\n /** @hidden */\r\n this._retry = 0;\r\n /** @hidden */\r\n this._basePointWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._velocityWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._normalizedVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._collisionMask = -1;\r\n }\r\n Object.defineProperty(Collider.prototype, \"collisionMask\", {\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Collider.prototype, \"slidePlaneNormal\", {\r\n /**\r\n * Gets the plane normal used to compute the sliding response (in local space)\r\n */\r\n get: function () {\r\n return this._slidePlaneNormal;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /** @hidden */\r\n Collider.prototype._initialize = function (source, dir, e) {\r\n this._velocity = dir;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].NormalizeToRef(dir, this._normalizedVelocity);\r\n this._basePoint = source;\r\n source.multiplyToRef(this._radius, this._basePointWorld);\r\n dir.multiplyToRef(this._radius, this._velocityWorld);\r\n this._velocityWorldLength = this._velocityWorld.length();\r\n this._epsilon = e;\r\n this.collisionFound = false;\r\n };\r\n /** @hidden */\r\n Collider.prototype._checkPointInTriangle = function (point, pa, pb, pc, n) {\r\n pa.subtractToRef(point, this._tempVector);\r\n pb.subtractToRef(point, this._tempVector2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(this._tempVector, this._tempVector2, this._tempVector4);\r\n var d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._tempVector4, n);\r\n if (d < 0) {\r\n return false;\r\n }\r\n pc.subtractToRef(point, this._tempVector3);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4);\r\n d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._tempVector4, n);\r\n if (d < 0) {\r\n return false;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(this._tempVector3, this._tempVector, this._tempVector4);\r\n d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._tempVector4, n);\r\n return d >= 0;\r\n };\r\n /** @hidden */\r\n Collider.prototype._canDoCollision = function (sphereCenter, sphereRadius, vecMin, vecMax) {\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(this._basePointWorld, sphereCenter);\r\n var max = Math.max(this._radius.x, this._radius.y, this._radius.z);\r\n if (distance > this._velocityWorldLength + max + sphereRadius) {\r\n return false;\r\n }\r\n if (!intersectBoxAASphere(vecMin, vecMax, this._basePointWorld, this._velocityWorldLength + max)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Collider.prototype._testTriangle = function (faceIndex, trianglePlaneArray, p1, p2, p3, hasMaterial, hostMesh) {\r\n var t0;\r\n var embeddedInPlane = false;\r\n //defensive programming, actually not needed.\r\n if (!trianglePlaneArray) {\r\n trianglePlaneArray = [];\r\n }\r\n if (!trianglePlaneArray[faceIndex]) {\r\n trianglePlaneArray[faceIndex] = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"](0, 0, 0, 0);\r\n trianglePlaneArray[faceIndex].copyFromPoints(p1, p2, p3);\r\n }\r\n var trianglePlane = trianglePlaneArray[faceIndex];\r\n if ((!hasMaterial) && !trianglePlane.isFrontFacingTo(this._normalizedVelocity, 0)) {\r\n return;\r\n }\r\n var signedDistToTrianglePlane = trianglePlane.signedDistanceTo(this._basePoint);\r\n var normalDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(trianglePlane.normal, this._velocity);\r\n if (normalDotVelocity == 0) {\r\n if (Math.abs(signedDistToTrianglePlane) >= 1.0) {\r\n return;\r\n }\r\n embeddedInPlane = true;\r\n t0 = 0;\r\n }\r\n else {\r\n t0 = (-1.0 - signedDistToTrianglePlane) / normalDotVelocity;\r\n var t1 = (1.0 - signedDistToTrianglePlane) / normalDotVelocity;\r\n if (t0 > t1) {\r\n var temp = t1;\r\n t1 = t0;\r\n t0 = temp;\r\n }\r\n if (t0 > 1.0 || t1 < 0.0) {\r\n return;\r\n }\r\n if (t0 < 0) {\r\n t0 = 0;\r\n }\r\n if (t0 > 1.0) {\r\n t0 = 1.0;\r\n }\r\n }\r\n this._collisionPoint.copyFromFloats(0, 0, 0);\r\n var found = false;\r\n var t = 1.0;\r\n if (!embeddedInPlane) {\r\n this._basePoint.subtractToRef(trianglePlane.normal, this._planeIntersectionPoint);\r\n this._velocity.scaleToRef(t0, this._tempVector);\r\n this._planeIntersectionPoint.addInPlace(this._tempVector);\r\n if (this._checkPointInTriangle(this._planeIntersectionPoint, p1, p2, p3, trianglePlane.normal)) {\r\n found = true;\r\n t = t0;\r\n this._collisionPoint.copyFrom(this._planeIntersectionPoint);\r\n }\r\n }\r\n if (!found) {\r\n var velocitySquaredLength = this._velocity.lengthSquared();\r\n var a = velocitySquaredLength;\r\n this._basePoint.subtractToRef(p1, this._tempVector);\r\n var b = 2.0 * (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._tempVector));\r\n var c = this._tempVector.lengthSquared() - 1.0;\r\n var lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._collisionPoint.copyFrom(p1);\r\n }\r\n this._basePoint.subtractToRef(p2, this._tempVector);\r\n b = 2.0 * (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._tempVector));\r\n c = this._tempVector.lengthSquared() - 1.0;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._collisionPoint.copyFrom(p2);\r\n }\r\n this._basePoint.subtractToRef(p3, this._tempVector);\r\n b = 2.0 * (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._tempVector));\r\n c = this._tempVector.lengthSquared() - 1.0;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._collisionPoint.copyFrom(p3);\r\n }\r\n p2.subtractToRef(p1, this._edge);\r\n p1.subtractToRef(this._basePoint, this._baseToVertex);\r\n var edgeSquaredLength = this._edge.lengthSquared();\r\n var edgeDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._velocity);\r\n var edgeDotBaseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._baseToVertex);\r\n a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;\r\n b = edgeSquaredLength * (2.0 * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;\r\n c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n var f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;\r\n if (f >= 0.0 && f <= 1.0) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._edge.scaleInPlace(f);\r\n p1.addToRef(this._edge, this._collisionPoint);\r\n }\r\n }\r\n p3.subtractToRef(p2, this._edge);\r\n p2.subtractToRef(this._basePoint, this._baseToVertex);\r\n edgeSquaredLength = this._edge.lengthSquared();\r\n edgeDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._velocity);\r\n edgeDotBaseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._baseToVertex);\r\n a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;\r\n b = edgeSquaredLength * (2.0 * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;\r\n c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;\r\n if (f >= 0.0 && f <= 1.0) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._edge.scaleInPlace(f);\r\n p2.addToRef(this._edge, this._collisionPoint);\r\n }\r\n }\r\n p1.subtractToRef(p3, this._edge);\r\n p3.subtractToRef(this._basePoint, this._baseToVertex);\r\n edgeSquaredLength = this._edge.lengthSquared();\r\n edgeDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._velocity);\r\n edgeDotBaseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._baseToVertex);\r\n a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;\r\n b = edgeSquaredLength * (2.0 * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;\r\n c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;\r\n if (f >= 0.0 && f <= 1.0) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._edge.scaleInPlace(f);\r\n p3.addToRef(this._edge, this._collisionPoint);\r\n }\r\n }\r\n }\r\n if (found) {\r\n var distToCollision = t * this._velocity.length();\r\n if (!this.collisionFound || distToCollision < this._nearestDistance) {\r\n if (!this.intersectionPoint) {\r\n this.intersectionPoint = this._collisionPoint.clone();\r\n }\r\n else {\r\n this.intersectionPoint.copyFrom(this._collisionPoint);\r\n }\r\n this._nearestDistance = distToCollision;\r\n this.collisionFound = true;\r\n this.collidedMesh = hostMesh;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Collider.prototype._collide = function (trianglePlaneArray, pts, indices, indexStart, indexEnd, decal, hasMaterial, hostMesh) {\r\n for (var i = indexStart; i < indexEnd; i += 3) {\r\n var p1 = pts[indices[i] - decal];\r\n var p2 = pts[indices[i + 1] - decal];\r\n var p3 = pts[indices[i + 2] - decal];\r\n this._testTriangle(i, trianglePlaneArray, p3, p2, p1, hasMaterial, hostMesh);\r\n }\r\n };\r\n /** @hidden */\r\n Collider.prototype._getResponse = function (pos, vel) {\r\n pos.addToRef(vel, this._destinationPoint);\r\n vel.scaleInPlace((this._nearestDistance / vel.length()));\r\n this._basePoint.addToRef(vel, pos);\r\n pos.subtractToRef(this.intersectionPoint, this._slidePlaneNormal);\r\n this._slidePlaneNormal.normalize();\r\n this._slidePlaneNormal.scaleToRef(this._epsilon, this._displacementVector);\r\n pos.addInPlace(this._displacementVector);\r\n this.intersectionPoint.addInPlace(this._displacementVector);\r\n this._slidePlaneNormal.scaleInPlace(_Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"].SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint));\r\n this._destinationPoint.subtractInPlace(this._slidePlaneNormal);\r\n this._destinationPoint.subtractToRef(this.intersectionPoint, vel);\r\n };\r\n return Collider;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/collisionCoordinator.ts\":\n/*!********************************************!*\\\n !*** ./Collisions/collisionCoordinator.ts ***!\n \\********************************************/\n/*! exports provided: DefaultCollisionCoordinator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return DefaultCollisionCoordinator; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _collider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./collider */ \"./Collisions/collider.ts\");\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar DefaultCollisionCoordinator = /** @class */ (function () {\r\n function DefaultCollisionCoordinator() {\r\n this._scaledPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._scaledVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._finalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n }\r\n DefaultCollisionCoordinator.prototype.getNewPosition = function (position, displacement, collider, maximumRetry, excludedMesh, onNewPosition, collisionIndex) {\r\n position.divideToRef(collider._radius, this._scaledPosition);\r\n displacement.divideToRef(collider._radius, this._scaledVelocity);\r\n collider.collidedMesh = null;\r\n collider._retry = 0;\r\n collider._initialVelocity = this._scaledVelocity;\r\n collider._initialPosition = this._scaledPosition;\r\n this._collideWithWorld(this._scaledPosition, this._scaledVelocity, collider, maximumRetry, this._finalPosition, excludedMesh);\r\n this._finalPosition.multiplyInPlace(collider._radius);\r\n //run the callback\r\n onNewPosition(collisionIndex, this._finalPosition, collider.collidedMesh);\r\n };\r\n DefaultCollisionCoordinator.prototype.createCollider = function () {\r\n return new _collider__WEBPACK_IMPORTED_MODULE_3__[\"Collider\"]();\r\n };\r\n DefaultCollisionCoordinator.prototype.init = function (scene) {\r\n this._scene = scene;\r\n };\r\n DefaultCollisionCoordinator.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {\r\n if (excludedMesh === void 0) { excludedMesh = null; }\r\n var closeDistance = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].CollisionsEpsilon * 10.0;\r\n if (collider._retry >= maximumRetry) {\r\n finalPosition.copyFrom(position);\r\n return;\r\n }\r\n // Check if this is a mesh else camera or -1\r\n var collisionMask = (excludedMesh ? excludedMesh.collisionMask : collider.collisionMask);\r\n collider._initialize(position, velocity, closeDistance);\r\n // Check all meshes\r\n for (var index = 0; index < this._scene.meshes.length; index++) {\r\n var mesh = this._scene.meshes[index];\r\n if (mesh.isEnabled() && mesh.checkCollisions && mesh.subMeshes && mesh !== excludedMesh && ((collisionMask & mesh.collisionGroup) !== 0)) {\r\n mesh._checkCollision(collider);\r\n }\r\n }\r\n if (!collider.collisionFound) {\r\n position.addToRef(velocity, finalPosition);\r\n return;\r\n }\r\n if (velocity.x !== 0 || velocity.y !== 0 || velocity.z !== 0) {\r\n collider._getResponse(position, velocity);\r\n }\r\n if (velocity.length() <= closeDistance) {\r\n finalPosition.copyFrom(position);\r\n return;\r\n }\r\n collider._retry++;\r\n this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);\r\n };\r\n return DefaultCollisionCoordinator;\r\n}());\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].CollisionCoordinatorFactory = function () {\r\n return new DefaultCollisionCoordinator();\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/index.ts\":\n/*!*****************************!*\\\n !*** ./Collisions/index.ts ***!\n \\*****************************/\n/*! exports provided: Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _collider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./collider */ \"./Collisions/collider.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return _collider__WEBPACK_IMPORTED_MODULE_0__[\"Collider\"]; });\n\n/* harmony import */ var _collisionCoordinator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./collisionCoordinator */ \"./Collisions/collisionCoordinator.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return _collisionCoordinator__WEBPACK_IMPORTED_MODULE_1__[\"DefaultCollisionCoordinator\"]; });\n\n/* harmony import */ var _pickingInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return _pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]; });\n\n/* harmony import */ var _intersectionInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersectionInfo */ \"./Collisions/intersectionInfo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return _intersectionInfo__WEBPACK_IMPORTED_MODULE_3__[\"IntersectionInfo\"]; });\n\n/* harmony import */ var _meshCollisionData__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./meshCollisionData */ \"./Collisions/meshCollisionData.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _meshCollisionData__WEBPACK_IMPORTED_MODULE_4__[\"_MeshCollisionData\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/intersectionInfo.ts\":\n/*!****************************************!*\\\n !*** ./Collisions/intersectionInfo.ts ***!\n \\****************************************/\n/*! exports provided: IntersectionInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return IntersectionInfo; });\n/**\r\n * @hidden\r\n */\r\nvar IntersectionInfo = /** @class */ (function () {\r\n function IntersectionInfo(bu, bv, distance) {\r\n this.bu = bu;\r\n this.bv = bv;\r\n this.distance = distance;\r\n this.faceId = 0;\r\n this.subMeshId = 0;\r\n }\r\n return IntersectionInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/meshCollisionData.ts\":\n/*!*****************************************!*\\\n !*** ./Collisions/meshCollisionData.ts ***!\n \\*****************************************/\n/*! exports provided: _MeshCollisionData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _MeshCollisionData; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * @hidden\r\n */\r\nvar _MeshCollisionData = /** @class */ (function () {\r\n function _MeshCollisionData() {\r\n this._checkCollisions = false;\r\n this._collisionMask = -1;\r\n this._collisionGroup = -1;\r\n this._collider = null;\r\n this._oldPositionForCollisions = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n this._diffPositionForCollisions = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n return _MeshCollisionData;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/pickingInfo.ts\":\n/*!***********************************!*\\\n !*** ./Collisions/pickingInfo.ts ***!\n \\***********************************/\n/*! exports provided: PickingInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return PickingInfo; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n\r\n\r\n/**\r\n * Information about the result of picking within a scene\r\n * @see https://doc.babylonjs.com/babylon101/picking_collisions\r\n */\r\nvar PickingInfo = /** @class */ (function () {\r\n function PickingInfo() {\r\n /** @hidden */\r\n this._pickingUnavailable = false;\r\n /**\r\n * If the pick collided with an object\r\n */\r\n this.hit = false;\r\n /**\r\n * Distance away where the pick collided\r\n */\r\n this.distance = 0;\r\n /**\r\n * The location of pick collision\r\n */\r\n this.pickedPoint = null;\r\n /**\r\n * The mesh corresponding the the pick collision\r\n */\r\n this.pickedMesh = null;\r\n /** (See getTextureCoordinates) The barycentric U coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bu = 0;\r\n /** (See getTextureCoordinates) The barycentric V coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bv = 0;\r\n /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n this.faceId = -1;\r\n /** Id of the the submesh that was picked */\r\n this.subMeshId = 0;\r\n /** If a sprite was picked, this will be the sprite the pick collided with */\r\n this.pickedSprite = null;\r\n /**\r\n * If a mesh was used to do the picking (eg. 6dof controller) this will be populated.\r\n */\r\n this.originMesh = null;\r\n /**\r\n * The ray that was used to perform the picking.\r\n */\r\n this.ray = null;\r\n }\r\n /**\r\n * Gets the normal correspodning to the face the pick collided with\r\n * @param useWorldCoordinates If the resulting normal should be relative to the world (default: false)\r\n * @param useVerticesNormals If the vertices normals should be used to calculate the normal instead of the normal map\r\n * @returns The normal correspodning to the face the pick collided with\r\n */\r\n PickingInfo.prototype.getNormal = function (useWorldCoordinates, useVerticesNormals) {\r\n if (useWorldCoordinates === void 0) { useWorldCoordinates = false; }\r\n if (useVerticesNormals === void 0) { useVerticesNormals = true; }\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var result;\r\n if (useVerticesNormals) {\r\n var normals = this.pickedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind);\r\n var normal0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(normals, indices[this.faceId * 3] * 3);\r\n var normal1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(normals, indices[this.faceId * 3 + 1] * 3);\r\n var normal2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(normals, indices[this.faceId * 3 + 2] * 3);\r\n normal0 = normal0.scale(this.bu);\r\n normal1 = normal1.scale(this.bv);\r\n normal2 = normal2.scale(1.0 - this.bu - this.bv);\r\n result = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);\r\n }\r\n else {\r\n var positions = this.pickedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var vertex1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, indices[this.faceId * 3] * 3);\r\n var vertex2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, indices[this.faceId * 3 + 1] * 3);\r\n var vertex3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, indices[this.faceId * 3 + 2] * 3);\r\n var p1p2 = vertex1.subtract(vertex2);\r\n var p3p2 = vertex3.subtract(vertex2);\r\n result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(p1p2, p3p2);\r\n }\r\n if (useWorldCoordinates) {\r\n var wm = this.pickedMesh.getWorldMatrix();\r\n if (this.pickedMesh.nonUniformScaling) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0].copyFrom(wm);\r\n wm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n wm.setTranslationFromFloats(0, 0, 0);\r\n wm.invert();\r\n wm.transposeToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1]);\r\n wm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1];\r\n }\r\n result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(result, wm);\r\n }\r\n result.normalize();\r\n return result;\r\n };\r\n /**\r\n * Gets the texture coordinates of where the pick occured\r\n * @returns the vector containing the coordnates of the texture\r\n */\r\n PickingInfo.prototype.getTextureCoordinates = function () {\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var uvs = this.pickedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n if (!uvs) {\r\n return null;\r\n }\r\n var uv0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].FromArray(uvs, indices[this.faceId * 3] * 2);\r\n var uv1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].FromArray(uvs, indices[this.faceId * 3 + 1] * 2);\r\n var uv2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].FromArray(uvs, indices[this.faceId * 3 + 2] * 2);\r\n uv0 = uv0.scale(this.bu);\r\n uv1 = uv1.scale(this.bv);\r\n uv2 = uv2.scale(1.0 - this.bu - this.bv);\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);\r\n };\r\n return PickingInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/index.ts\":\n/*!**********************************!*\\\n !*** ./Culling/Octrees/index.ts ***!\n \\**********************************/\n/*! exports provided: Octree, OctreeBlock, OctreeSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _octree__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./octree */ \"./Culling/Octrees/octree.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _octree__WEBPACK_IMPORTED_MODULE_0__[\"Octree\"]; });\n\n/* harmony import */ var _octreeBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./octreeBlock */ \"./Culling/Octrees/octreeBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _octreeBlock__WEBPACK_IMPORTED_MODULE_1__[\"OctreeBlock\"]; });\n\n/* harmony import */ var _octreeSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./octreeSceneComponent */ \"./Culling/Octrees/octreeSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _octreeSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"OctreeSceneComponent\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/octree.ts\":\n/*!***********************************!*\\\n !*** ./Culling/Octrees/octree.ts ***!\n \\***********************************/\n/*! exports provided: Octree */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return Octree; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _octreeBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./octreeBlock */ \"./Culling/Octrees/octreeBlock.ts\");\n\r\n\r\n/**\r\n * Octrees are a really powerful data structure that can quickly select entities based on space coordinates.\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n */\r\nvar Octree = /** @class */ (function () {\r\n /**\r\n * Creates a octree\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n * @param creationFunc function to be used to instatiate the octree\r\n * @param maxBlockCapacity defines the maximum number of meshes you want on your octree's leaves (default: 64)\r\n * @param maxDepth defines the maximum depth (sub-levels) for your octree. Default value is 2, which means 8 8 8 = 512 blocks :) (This parameter takes precedence over capacity.)\r\n */\r\n function Octree(creationFunc, maxBlockCapacity, \r\n /** Defines the maximum depth (sub-levels) for your octree. Default value is 2, which means 8 8 8 = 512 blocks :) (This parameter takes precedence over capacity.) */\r\n maxDepth) {\r\n if (maxDepth === void 0) { maxDepth = 2; }\r\n this.maxDepth = maxDepth;\r\n /**\r\n * Content stored in the octree\r\n */\r\n this.dynamicContent = new Array();\r\n this._maxBlockCapacity = maxBlockCapacity || 64;\r\n this._selectionContent = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArrayNoDuplicate\"](1024);\r\n this._creationFunc = creationFunc;\r\n }\r\n // Methods\r\n /**\r\n * Updates the octree by adding blocks for the passed in meshes within the min and max world parameters\r\n * @param worldMin worldMin for the octree blocks var blockSize = new Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);\r\n * @param worldMax worldMax for the octree blocks var blockSize = new Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);\r\n * @param entries meshes to be added to the octree blocks\r\n */\r\n Octree.prototype.update = function (worldMin, worldMax, entries) {\r\n _octreeBlock__WEBPACK_IMPORTED_MODULE_1__[\"OctreeBlock\"]._CreateBlocks(worldMin, worldMax, entries, this._maxBlockCapacity, 0, this.maxDepth, this, this._creationFunc);\r\n };\r\n /**\r\n * Adds a mesh to the octree\r\n * @param entry Mesh to add to the octree\r\n */\r\n Octree.prototype.addMesh = function (entry) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.addEntry(entry);\r\n }\r\n };\r\n /**\r\n * Remove an element from the octree\r\n * @param entry defines the element to remove\r\n */\r\n Octree.prototype.removeMesh = function (entry) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.removeEntry(entry);\r\n }\r\n };\r\n /**\r\n * Selects an array of meshes within the frustum\r\n * @param frustumPlanes The frustum planes to use which will select all meshes within it\r\n * @param allowDuplicate If duplicate objects are allowed in the resulting object array\r\n * @returns array of meshes within the frustum\r\n */\r\n Octree.prototype.select = function (frustumPlanes, allowDuplicate) {\r\n this._selectionContent.reset();\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.select(frustumPlanes, this._selectionContent, allowDuplicate);\r\n }\r\n if (allowDuplicate) {\r\n this._selectionContent.concat(this.dynamicContent);\r\n }\r\n else {\r\n this._selectionContent.concatWithNoDuplicate(this.dynamicContent);\r\n }\r\n return this._selectionContent;\r\n };\r\n /**\r\n * Test if the octree intersect with the given bounding sphere and if yes, then add its content to the selection array\r\n * @param sphereCenter defines the bounding sphere center\r\n * @param sphereRadius defines the bounding sphere radius\r\n * @param allowDuplicate defines if the selection array can contains duplicated entries\r\n * @returns an array of objects that intersect the sphere\r\n */\r\n Octree.prototype.intersects = function (sphereCenter, sphereRadius, allowDuplicate) {\r\n this._selectionContent.reset();\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersects(sphereCenter, sphereRadius, this._selectionContent, allowDuplicate);\r\n }\r\n if (allowDuplicate) {\r\n this._selectionContent.concat(this.dynamicContent);\r\n }\r\n else {\r\n this._selectionContent.concatWithNoDuplicate(this.dynamicContent);\r\n }\r\n return this._selectionContent;\r\n };\r\n /**\r\n * Test if the octree intersect with the given ray and if yes, then add its content to resulting array\r\n * @param ray defines the ray to test with\r\n * @returns array of intersected objects\r\n */\r\n Octree.prototype.intersectsRay = function (ray) {\r\n this._selectionContent.reset();\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersectsRay(ray, this._selectionContent);\r\n }\r\n this._selectionContent.concatWithNoDuplicate(this.dynamicContent);\r\n return this._selectionContent;\r\n };\r\n /**\r\n * Adds a mesh into the octree block if it intersects the block\r\n */\r\n Octree.CreationFuncForMeshes = function (entry, block) {\r\n var boundingInfo = entry.getBoundingInfo();\r\n if (!entry.isBlocked && boundingInfo.boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {\r\n block.entries.push(entry);\r\n }\r\n };\r\n /**\r\n * Adds a submesh into the octree block if it intersects the block\r\n */\r\n Octree.CreationFuncForSubMeshes = function (entry, block) {\r\n var boundingInfo = entry.getBoundingInfo();\r\n if (boundingInfo.boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {\r\n block.entries.push(entry);\r\n }\r\n };\r\n return Octree;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/octreeBlock.ts\":\n/*!****************************************!*\\\n !*** ./Culling/Octrees/octreeBlock.ts ***!\n \\****************************************/\n/*! exports provided: OctreeBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return OctreeBlock; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Culling_boundingBox__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Culling/boundingBox */ \"./Culling/boundingBox.ts\");\n\r\n\r\n/**\r\n * Class used to store a cell in an octree\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n */\r\nvar OctreeBlock = /** @class */ (function () {\r\n /**\r\n * Creates a new block\r\n * @param minPoint defines the minimum vector (in world space) of the block's bounding box\r\n * @param maxPoint defines the maximum vector (in world space) of the block's bounding box\r\n * @param capacity defines the maximum capacity of this block (if capacity is reached the block will be split into sub blocks)\r\n * @param depth defines the current depth of this block in the octree\r\n * @param maxDepth defines the maximal depth allowed (beyond this value, the capacity is ignored)\r\n * @param creationFunc defines a callback to call when an element is added to the block\r\n */\r\n function OctreeBlock(minPoint, maxPoint, capacity, depth, maxDepth, creationFunc) {\r\n /**\r\n * Gets the content of the current block\r\n */\r\n this.entries = new Array();\r\n this._boundingVectors = new Array();\r\n this._capacity = capacity;\r\n this._depth = depth;\r\n this._maxDepth = maxDepth;\r\n this._creationFunc = creationFunc;\r\n this._minPoint = minPoint;\r\n this._maxPoint = maxPoint;\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors[2].x = maxPoint.x;\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors[3].y = maxPoint.y;\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors[4].z = maxPoint.z;\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors[5].z = minPoint.z;\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors[6].x = minPoint.x;\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors[7].y = minPoint.y;\r\n }\r\n Object.defineProperty(OctreeBlock.prototype, \"capacity\", {\r\n // Property\r\n /**\r\n * Gets the maximum capacity of this block (if capacity is reached the block will be split into sub blocks)\r\n */\r\n get: function () {\r\n return this._capacity;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OctreeBlock.prototype, \"minPoint\", {\r\n /**\r\n * Gets the minimum vector (in world space) of the block's bounding box\r\n */\r\n get: function () {\r\n return this._minPoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OctreeBlock.prototype, \"maxPoint\", {\r\n /**\r\n * Gets the maximum vector (in world space) of the block's bounding box\r\n */\r\n get: function () {\r\n return this._maxPoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Add a new element to this block\r\n * @param entry defines the element to add\r\n */\r\n OctreeBlock.prototype.addEntry = function (entry) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.addEntry(entry);\r\n }\r\n return;\r\n }\r\n this._creationFunc(entry, this);\r\n if (this.entries.length > this.capacity && this._depth < this._maxDepth) {\r\n this.createInnerBlocks();\r\n }\r\n };\r\n /**\r\n * Remove an element from this block\r\n * @param entry defines the element to remove\r\n */\r\n OctreeBlock.prototype.removeEntry = function (entry) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.removeEntry(entry);\r\n }\r\n return;\r\n }\r\n var entryIndex = this.entries.indexOf(entry);\r\n if (entryIndex > -1) {\r\n this.entries.splice(entryIndex, 1);\r\n }\r\n };\r\n /**\r\n * Add an array of elements to this block\r\n * @param entries defines the array of elements to add\r\n */\r\n OctreeBlock.prototype.addEntries = function (entries) {\r\n for (var index = 0; index < entries.length; index++) {\r\n var mesh = entries[index];\r\n this.addEntry(mesh);\r\n }\r\n };\r\n /**\r\n * Test if the current block intersects the furstum planes and if yes, then add its content to the selection array\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @param selection defines the array to store current content if selection is positive\r\n * @param allowDuplicate defines if the selection array can contains duplicated entries\r\n */\r\n OctreeBlock.prototype.select = function (frustumPlanes, selection, allowDuplicate) {\r\n if (_Culling_boundingBox__WEBPACK_IMPORTED_MODULE_1__[\"BoundingBox\"].IsInFrustum(this._boundingVectors, frustumPlanes)) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.select(frustumPlanes, selection, allowDuplicate);\r\n }\r\n return;\r\n }\r\n if (allowDuplicate) {\r\n selection.concat(this.entries);\r\n }\r\n else {\r\n selection.concatWithNoDuplicate(this.entries);\r\n }\r\n }\r\n };\r\n /**\r\n * Test if the current block intersect with the given bounding sphere and if yes, then add its content to the selection array\r\n * @param sphereCenter defines the bounding sphere center\r\n * @param sphereRadius defines the bounding sphere radius\r\n * @param selection defines the array to store current content if selection is positive\r\n * @param allowDuplicate defines if the selection array can contains duplicated entries\r\n */\r\n OctreeBlock.prototype.intersects = function (sphereCenter, sphereRadius, selection, allowDuplicate) {\r\n if (_Culling_boundingBox__WEBPACK_IMPORTED_MODULE_1__[\"BoundingBox\"].IntersectsSphere(this._minPoint, this._maxPoint, sphereCenter, sphereRadius)) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersects(sphereCenter, sphereRadius, selection, allowDuplicate);\r\n }\r\n return;\r\n }\r\n if (allowDuplicate) {\r\n selection.concat(this.entries);\r\n }\r\n else {\r\n selection.concatWithNoDuplicate(this.entries);\r\n }\r\n }\r\n };\r\n /**\r\n * Test if the current block intersect with the given ray and if yes, then add its content to the selection array\r\n * @param ray defines the ray to test with\r\n * @param selection defines the array to store current content if selection is positive\r\n */\r\n OctreeBlock.prototype.intersectsRay = function (ray, selection) {\r\n if (ray.intersectsBoxMinMax(this._minPoint, this._maxPoint)) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersectsRay(ray, selection);\r\n }\r\n return;\r\n }\r\n selection.concatWithNoDuplicate(this.entries);\r\n }\r\n };\r\n /**\r\n * Subdivide the content into child blocks (this block will then be empty)\r\n */\r\n OctreeBlock.prototype.createInnerBlocks = function () {\r\n OctreeBlock._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);\r\n };\r\n /**\r\n * @hidden\r\n */\r\n OctreeBlock._CreateBlocks = function (worldMin, worldMax, entries, maxBlockCapacity, currentDepth, maxDepth, target, creationFunc) {\r\n target.blocks = new Array();\r\n var blockSize = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);\r\n // Segmenting space\r\n for (var x = 0; x < 2; x++) {\r\n for (var y = 0; y < 2; y++) {\r\n for (var z = 0; z < 2; z++) {\r\n var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));\r\n var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));\r\n var block = new OctreeBlock(localMin, localMax, maxBlockCapacity, currentDepth + 1, maxDepth, creationFunc);\r\n block.addEntries(entries);\r\n target.blocks.push(block);\r\n }\r\n }\r\n }\r\n };\r\n return OctreeBlock;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/octreeSceneComponent.ts\":\n/*!*************************************************!*\\\n !*** ./Culling/Octrees/octreeSceneComponent.ts ***!\n \\*************************************************/\n/*! exports provided: OctreeSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return OctreeSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _octree__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./octree */ \"./Culling/Octrees/octree.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.createOrUpdateSelectionOctree = function (maxCapacity, maxDepth) {\r\n if (maxCapacity === void 0) { maxCapacity = 64; }\r\n if (maxDepth === void 0) { maxDepth = 2; }\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OCTREE);\r\n if (!component) {\r\n component = new OctreeSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n if (!this._selectionOctree) {\r\n this._selectionOctree = new _octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"](_octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"].CreationFuncForMeshes, maxCapacity, maxDepth);\r\n }\r\n var worldExtends = this.getWorldExtends();\r\n // Update octree\r\n this._selectionOctree.update(worldExtends.min, worldExtends.max, this.meshes);\r\n return this._selectionOctree;\r\n};\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"selectionOctree\", {\r\n get: function () {\r\n return this._selectionOctree;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * This function will create an octree to help to select the right submeshes for rendering, picking and collision computations.\r\n * Please note that you must have a decent number of submeshes to get performance improvements when using an octree\r\n * @param maxCapacity defines the maximum size of each block (64 by default)\r\n * @param maxDepth defines the maximum depth to use (no more than 2 levels by default)\r\n * @returns the new octree\r\n * @see https://www.babylonjs-playground.com/#NA4OQ#12\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.createOrUpdateSubmeshesOctree = function (maxCapacity, maxDepth) {\r\n if (maxCapacity === void 0) { maxCapacity = 64; }\r\n if (maxDepth === void 0) { maxDepth = 2; }\r\n var scene = this.getScene();\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OCTREE);\r\n if (!component) {\r\n component = new OctreeSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n if (!this._submeshesOctree) {\r\n this._submeshesOctree = new _octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"](_octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"].CreationFuncForSubMeshes, maxCapacity, maxDepth);\r\n }\r\n this.computeWorldMatrix(true);\r\n var boundingInfo = this.getBoundingInfo();\r\n // Update octree\r\n var bbox = boundingInfo.boundingBox;\r\n this._submeshesOctree.update(bbox.minimumWorld, bbox.maximumWorld, this.subMeshes);\r\n return this._submeshesOctree;\r\n};\r\n/**\r\n * Defines the octree scene component responsible to manage any octrees\r\n * in a given scene.\r\n */\r\nvar OctreeSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function OctreeSceneComponent(scene) {\r\n /**\r\n * The component name help to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OCTREE;\r\n /**\r\n * Indicates if the meshes have been checked to make sure they are isEnabled()\r\n */\r\n this.checksIsEnabled = true;\r\n this._tempRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](1, 1, 1));\r\n this.scene = scene;\r\n this.scene.getActiveMeshCandidates = this.getActiveMeshCandidates.bind(this);\r\n this.scene.getActiveSubMeshCandidates = this.getActiveSubMeshCandidates.bind(this);\r\n this.scene.getCollidingSubMeshCandidates = this.getCollidingSubMeshCandidates.bind(this);\r\n this.scene.getIntersectingSubMeshCandidates = this.getIntersectingSubMeshCandidates.bind(this);\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n OctreeSceneComponent.prototype.register = function () {\r\n var _this = this;\r\n this.scene.onMeshRemovedObservable.add(function (mesh) {\r\n var sceneOctree = _this.scene.selectionOctree;\r\n if (sceneOctree !== undefined && sceneOctree !== null) {\r\n var index = sceneOctree.dynamicContent.indexOf(mesh);\r\n if (index !== -1) {\r\n sceneOctree.dynamicContent.splice(index, 1);\r\n }\r\n }\r\n });\r\n this.scene.onMeshImportedObservable.add(function (mesh) {\r\n var sceneOctree = _this.scene.selectionOctree;\r\n if (sceneOctree !== undefined && sceneOctree !== null) {\r\n sceneOctree.addMesh(mesh);\r\n }\r\n });\r\n };\r\n /**\r\n * Return the list of active meshes\r\n * @returns the list of active meshes\r\n */\r\n OctreeSceneComponent.prototype.getActiveMeshCandidates = function () {\r\n if (this.scene._selectionOctree) {\r\n var selection = this.scene._selectionOctree.select(this.scene.frustumPlanes);\r\n return selection;\r\n }\r\n return this.scene._getDefaultMeshCandidates();\r\n };\r\n /**\r\n * Return the list of active sub meshes\r\n * @param mesh The mesh to get the candidates sub meshes from\r\n * @returns the list of active sub meshes\r\n */\r\n OctreeSceneComponent.prototype.getActiveSubMeshCandidates = function (mesh) {\r\n if (mesh._submeshesOctree && mesh.useOctreeForRenderingSelection) {\r\n var intersections = mesh._submeshesOctree.select(this.scene.frustumPlanes);\r\n return intersections;\r\n }\r\n return this.scene._getDefaultSubMeshCandidates(mesh);\r\n };\r\n /**\r\n * Return the list of sub meshes intersecting with a given local ray\r\n * @param mesh defines the mesh to find the submesh for\r\n * @param localRay defines the ray in local space\r\n * @returns the list of intersecting sub meshes\r\n */\r\n OctreeSceneComponent.prototype.getIntersectingSubMeshCandidates = function (mesh, localRay) {\r\n if (mesh._submeshesOctree && mesh.useOctreeForPicking) {\r\n _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"].TransformToRef(localRay, mesh.getWorldMatrix(), this._tempRay);\r\n var intersections = mesh._submeshesOctree.intersectsRay(this._tempRay);\r\n return intersections;\r\n }\r\n return this.scene._getDefaultSubMeshCandidates(mesh);\r\n };\r\n /**\r\n * Return the list of sub meshes colliding with a collider\r\n * @param mesh defines the mesh to find the submesh for\r\n * @param collider defines the collider to evaluate the collision against\r\n * @returns the list of colliding sub meshes\r\n */\r\n OctreeSceneComponent.prototype.getCollidingSubMeshCandidates = function (mesh, collider) {\r\n if (mesh._submeshesOctree && mesh.useOctreeForCollisions) {\r\n var radius = collider._velocityWorldLength + Math.max(collider._radius.x, collider._radius.y, collider._radius.z);\r\n var intersections = mesh._submeshesOctree.intersects(collider._basePointWorld, radius);\r\n return intersections;\r\n }\r\n return this.scene._getDefaultSubMeshCandidates(mesh);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n OctreeSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n OctreeSceneComponent.prototype.dispose = function () {\r\n // Nothing to do here.\r\n };\r\n return OctreeSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/boundingBox.ts\":\n/*!********************************!*\\\n !*** ./Culling/boundingBox.ts ***!\n \\********************************/\n/*! exports provided: BoundingBox */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return BoundingBox; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to store bounding box information\r\n */\r\nvar BoundingBox = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding box\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingBox(min, max, worldMatrix) {\r\n /**\r\n * Gets the 8 vectors representing the bounding box in local space\r\n */\r\n this.vectors = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(8, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n /**\r\n * Gets the center of the bounding box in local space\r\n */\r\n this.center = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the center of the bounding box in world space\r\n */\r\n this.centerWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the extend size in local space\r\n */\r\n this.extendSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the extend size in world space\r\n */\r\n this.extendSizeWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the OBB (object bounding box) directions\r\n */\r\n this.directions = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n /**\r\n * Gets the 8 vectors representing the bounding box in world space\r\n */\r\n this.vectorsWorld = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(8, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n /**\r\n * Gets the minimum vector in world space\r\n */\r\n this.minimumWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the maximum vector in world space\r\n */\r\n this.maximumWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n // Methods\r\n /**\r\n * Recreates the entire bounding box from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingBox.prototype.reConstruct = function (min, max, worldMatrix) {\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var vectors = this.vectors;\r\n this.minimum.copyFromFloats(minX, minY, minZ);\r\n this.maximum.copyFromFloats(maxX, maxY, maxZ);\r\n vectors[0].copyFromFloats(minX, minY, minZ);\r\n vectors[1].copyFromFloats(maxX, maxY, maxZ);\r\n vectors[2].copyFromFloats(maxX, minY, minZ);\r\n vectors[3].copyFromFloats(minX, maxY, minZ);\r\n vectors[4].copyFromFloats(minX, minY, maxZ);\r\n vectors[5].copyFromFloats(maxX, maxY, minZ);\r\n vectors[6].copyFromFloats(minX, maxY, maxZ);\r\n vectors[7].copyFromFloats(maxX, minY, maxZ);\r\n // OBB\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);\r\n this._worldMatrix = worldMatrix || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly;\r\n this._update(this._worldMatrix);\r\n };\r\n /**\r\n * Scale the current bounding box by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingBox.prototype.scale = function (factor) {\r\n var tmpVectors = BoundingBox.TmpVector3;\r\n var diff = this.maximum.subtractToRef(this.minimum, tmpVectors[0]);\r\n var len = diff.length();\r\n diff.normalizeFromLength(len);\r\n var distance = len * factor;\r\n var newRadius = diff.scaleInPlace(distance * 0.5);\r\n var min = this.center.subtractToRef(newRadius, tmpVectors[1]);\r\n var max = this.center.addToRef(newRadius, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingBox.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n BoundingBox.prototype._update = function (world) {\r\n var minWorld = this.minimumWorld;\r\n var maxWorld = this.maximumWorld;\r\n var directions = this.directions;\r\n var vectorsWorld = this.vectorsWorld;\r\n var vectors = this.vectors;\r\n if (!world.isIdentity()) {\r\n minWorld.setAll(Number.MAX_VALUE);\r\n maxWorld.setAll(-Number.MAX_VALUE);\r\n for (var index = 0; index < 8; ++index) {\r\n var v = vectorsWorld[index];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(vectors[index], world, v);\r\n minWorld.minimizeInPlace(v);\r\n maxWorld.maximizeInPlace(v);\r\n }\r\n // Extend\r\n maxWorld.subtractToRef(minWorld, this.extendSizeWorld).scaleInPlace(0.5);\r\n maxWorld.addToRef(minWorld, this.centerWorld).scaleInPlace(0.5);\r\n }\r\n else {\r\n minWorld.copyFrom(this.minimum);\r\n maxWorld.copyFrom(this.maximum);\r\n for (var index = 0; index < 8; ++index) {\r\n vectorsWorld[index].copyFrom(vectors[index]);\r\n }\r\n // Extend\r\n this.extendSizeWorld.copyFrom(this.extendSize);\r\n this.centerWorld.copyFrom(this.center);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(world.m, 0, directions[0]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(world.m, 4, directions[1]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(world.m, 8, directions[2]);\r\n this._worldMatrix = world;\r\n };\r\n /**\r\n * Tests if the bounding box is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.isInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if the bounding box is entirely inside the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an inclusion\r\n */\r\n BoundingBox.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if a point is inside the bounding box\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding box\r\n */\r\n BoundingBox.prototype.intersectsPoint = function (point) {\r\n var min = this.minimumWorld;\r\n var max = this.maximumWorld;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var pointX = point.x, pointY = point.y, pointZ = point.z;\r\n var delta = -_Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"];\r\n if (maxX - pointX < delta || delta > pointX - minX) {\r\n return false;\r\n }\r\n if (maxY - pointY < delta || delta > pointY - minY) {\r\n return false;\r\n }\r\n if (maxZ - pointZ < delta || delta > pointZ - minZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a bounding sphere\r\n * @param sphere defines the sphere to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsSphere = function (sphere) {\r\n return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, sphere.radiusWorld);\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a box defined by a min and max vectors\r\n * @param min defines the min vector to use\r\n * @param max defines the max vector to use\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsMinMax = function (min, max) {\r\n var myMin = this.minimumWorld;\r\n var myMax = this.maximumWorld;\r\n var myMinX = myMin.x, myMinY = myMin.y, myMinZ = myMin.z, myMaxX = myMax.x, myMaxY = myMax.y, myMaxZ = myMax.z;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n if (myMaxX < minX || myMinX > maxX) {\r\n return false;\r\n }\r\n if (myMaxY < minY || myMinY > maxY) {\r\n return false;\r\n }\r\n if (myMaxZ < minZ || myMinZ > maxZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Tests if two bounding boxes are intersections\r\n * @param box0 defines the first box to test\r\n * @param box1 defines the second box to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.Intersects = function (box0, box1) {\r\n return box0.intersectsMinMax(box1.minimumWorld, box1.maximumWorld);\r\n };\r\n /**\r\n * Tests if a bounding box defines by a min/max vectors intersects a sphere\r\n * @param minPoint defines the minimum vector of the bounding box\r\n * @param maxPoint defines the maximum vector of the bounding box\r\n * @param sphereCenter defines the sphere center\r\n * @param sphereRadius defines the sphere radius\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.IntersectsSphere = function (minPoint, maxPoint, sphereCenter, sphereRadius) {\r\n var vector = BoundingBox.TmpVector3[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].ClampToRef(sphereCenter, minPoint, maxPoint, vector);\r\n var num = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(sphereCenter, vector);\r\n return (num <= (sphereRadius * sphereRadius));\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors is entirely inside frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an inclusion\r\n */\r\n BoundingBox.IsCompletelyInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors intersects frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an intersection\r\n */\r\n BoundingBox.IsInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var canReturnFalse = true;\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) >= 0) {\r\n canReturnFalse = false;\r\n break;\r\n }\r\n }\r\n if (canReturnFalse) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n BoundingBox.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n return BoundingBox;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/boundingInfo.ts\":\n/*!*********************************!*\\\n !*** ./Culling/boundingInfo.ts ***!\n \\*********************************/\n/*! exports provided: BoundingInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return BoundingInfo; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _boundingBox__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./boundingBox */ \"./Culling/boundingBox.ts\");\n/* harmony import */ var _boundingSphere__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boundingSphere */ \"./Culling/boundingSphere.ts\");\n\r\n\r\n\r\n\r\n\r\nvar _result0 = { min: 0, max: 0 };\r\nvar _result1 = { min: 0, max: 0 };\r\nvar computeBoxExtents = function (axis, box, result) {\r\n var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.centerWorld, axis);\r\n var r0 = Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.directions[0], axis)) * box.extendSize.x;\r\n var r1 = Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.directions[1], axis)) * box.extendSize.y;\r\n var r2 = Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.directions[2], axis)) * box.extendSize.z;\r\n var r = r0 + r1 + r2;\r\n result.min = p - r;\r\n result.max = p + r;\r\n};\r\nvar axisOverlap = function (axis, box0, box1) {\r\n computeBoxExtents(axis, box0, _result0);\r\n computeBoxExtents(axis, box1, _result1);\r\n return !(_result0.min > _result1.max || _result1.min > _result0.max);\r\n};\r\n/**\r\n * Info for a bounding data of a mesh\r\n */\r\nvar BoundingInfo = /** @class */ (function () {\r\n /**\r\n * Constructs bounding info\r\n * @param minimum min vector of the bounding box/sphere\r\n * @param maximum max vector of the bounding box/sphere\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingInfo(minimum, maximum, worldMatrix) {\r\n this._isLocked = false;\r\n this.boundingBox = new _boundingBox__WEBPACK_IMPORTED_MODULE_3__[\"BoundingBox\"](minimum, maximum, worldMatrix);\r\n this.boundingSphere = new _boundingSphere__WEBPACK_IMPORTED_MODULE_4__[\"BoundingSphere\"](minimum, maximum, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding info from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingInfo.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.boundingBox.reConstruct(min, max, worldMatrix);\r\n this.boundingSphere.reConstruct(min, max, worldMatrix);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"minimum\", {\r\n /**\r\n * min vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.minimum;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"maximum\", {\r\n /**\r\n * max vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.maximum;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"isLocked\", {\r\n /**\r\n * If the info is locked and won't be updated to avoid perf overhead\r\n */\r\n get: function () {\r\n return this._isLocked;\r\n },\r\n set: function (value) {\r\n this._isLocked = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Updates the bounding sphere and box\r\n * @param world world matrix to be used to update\r\n */\r\n BoundingInfo.prototype.update = function (world) {\r\n if (this._isLocked) {\r\n return;\r\n }\r\n this.boundingBox._update(world);\r\n this.boundingSphere._update(world);\r\n };\r\n /**\r\n * Recreate the bounding info to be centered around a specific point given a specific extend.\r\n * @param center New center of the bounding info\r\n * @param extend New extend of the bounding info\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.centerOn = function (center, extend) {\r\n var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);\r\n var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);\r\n this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n return this;\r\n };\r\n /**\r\n * Scale the current bounding info by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.scale = function (factor) {\r\n this.boundingBox.scale(factor);\r\n this.boundingSphere.scale(factor);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the bounding info is within the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum to test\r\n * @param strategy defines the strategy to use for the culling (default is BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD)\r\n * @returns true if the bounding info is in the frustum planes\r\n */\r\n BoundingInfo.prototype.isInFrustum = function (frustumPlanes, strategy) {\r\n if (strategy === void 0) { strategy = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_STANDARD; }\r\n var inclusionTest = (strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION || strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY);\r\n if (inclusionTest) {\r\n if (this.boundingSphere.isCenterInFrustum(frustumPlanes)) {\r\n return true;\r\n }\r\n }\r\n if (!this.boundingSphere.isInFrustum(frustumPlanes)) {\r\n return false;\r\n }\r\n var bSphereOnlyTest = (strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY || strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY);\r\n if (bSphereOnlyTest) {\r\n return true;\r\n }\r\n return this.boundingBox.isInFrustum(frustumPlanes);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"diagonalLength\", {\r\n /**\r\n * Gets the world distance between the min and max points of the bounding box\r\n */\r\n get: function () {\r\n var boundingBox = this.boundingBox;\r\n var diag = boundingBox.maximumWorld.subtractToRef(boundingBox.minimumWorld, BoundingInfo.TmpVector3[0]);\r\n return diag.length();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param frustumPlanes Camera near/planes\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n BoundingInfo.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this.boundingBox.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /** @hidden */\r\n BoundingInfo.prototype._checkCollision = function (collider) {\r\n return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);\r\n };\r\n /**\r\n * Checks if a point is inside the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param point the point to check intersection with\r\n * @returns if the point intersects\r\n */\r\n BoundingInfo.prototype.intersectsPoint = function (point) {\r\n if (!this.boundingSphere.centerWorld) {\r\n return false;\r\n }\r\n if (!this.boundingSphere.intersectsPoint(point)) {\r\n return false;\r\n }\r\n if (!this.boundingBox.intersectsPoint(point)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if another bounding info intersects the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param boundingInfo the bounding info to check intersection with\r\n * @param precise if the intersection should be done using OBB\r\n * @returns if the bounding info intersects\r\n */\r\n BoundingInfo.prototype.intersects = function (boundingInfo, precise) {\r\n if (!_boundingSphere__WEBPACK_IMPORTED_MODULE_4__[\"BoundingSphere\"].Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {\r\n return false;\r\n }\r\n if (!_boundingBox__WEBPACK_IMPORTED_MODULE_3__[\"BoundingBox\"].Intersects(this.boundingBox, boundingInfo.boundingBox)) {\r\n return false;\r\n }\r\n if (!precise) {\r\n return true;\r\n }\r\n var box0 = this.boundingBox;\r\n var box1 = boundingInfo.boundingBox;\r\n if (!axisOverlap(box0.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[0], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[0], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[0], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[1], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[1], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[1], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[2], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[2], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[2], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingInfo.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(2, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n return BoundingInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/boundingSphere.ts\":\n/*!***********************************!*\\\n !*** ./Culling/boundingSphere.ts ***!\n \\***********************************/\n/*! exports provided: BoundingSphere */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return BoundingSphere; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n/**\r\n * Class used to store bounding sphere information\r\n */\r\nvar BoundingSphere = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding sphere\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingSphere(min, max, worldMatrix) {\r\n /**\r\n * Gets the center of the bounding sphere in local space\r\n */\r\n this.center = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the center of the bounding sphere in world space\r\n */\r\n this.centerWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding sphere from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingSphere.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.minimum.copyFrom(min);\r\n this.maximum.copyFrom(max);\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Distance(min, max);\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n this.radius = distance * 0.5;\r\n this._update(worldMatrix || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly);\r\n };\r\n /**\r\n * Scale the current bounding sphere by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingSphere.prototype.scale = function (factor) {\r\n var newRadius = this.radius * factor;\r\n var tmpVectors = BoundingSphere.TmpVector3;\r\n var tempRadiusVector = tmpVectors[0].setAll(newRadius);\r\n var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);\r\n var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingSphere.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n // Methods\r\n /** @hidden */\r\n BoundingSphere.prototype._update = function (worldMatrix) {\r\n if (!worldMatrix.isIdentity()) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(this.center, worldMatrix, this.centerWorld);\r\n var tempVector = BoundingSphere.TmpVector3[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, worldMatrix, tempVector);\r\n this.radiusWorld = Math.max(Math.abs(tempVector.x), Math.abs(tempVector.y), Math.abs(tempVector.z)) * this.radius;\r\n }\r\n else {\r\n this.centerWorld.copyFrom(this.center);\r\n this.radiusWorld = this.radius;\r\n }\r\n };\r\n /**\r\n * Tests if the bounding sphere is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n var radius = this.radiusWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) <= -radius) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding sphere center is in between the frustum planes.\r\n * Used for optimistic fast inclusion.\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if the sphere center is in between the frustum planes\r\n */\r\n BoundingSphere.prototype.isCenterInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) < 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a point is inside the bounding sphere\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding sphere\r\n */\r\n BoundingSphere.prototype.intersectsPoint = function (point) {\r\n var squareDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(this.centerWorld, point);\r\n if (this.radiusWorld * this.radiusWorld < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Checks if two sphere intersct\r\n * @param sphere0 sphere 0\r\n * @param sphere1 sphere 1\r\n * @returns true if the speres intersect\r\n */\r\n BoundingSphere.Intersects = function (sphere0, sphere1) {\r\n var squareDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(sphere0.centerWorld, sphere1.centerWorld);\r\n var radiusSum = sphere0.radiusWorld + sphere1.radiusWorld;\r\n if (radiusSum * radiusSum < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingSphere.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n return BoundingSphere;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/index.ts\":\n/*!**************************!*\\\n !*** ./Culling/index.ts ***!\n \\**************************/\n/*! exports provided: BoundingBox, BoundingInfo, BoundingSphere, Ray, Octree, OctreeBlock, OctreeSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boundingBox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boundingBox */ \"./Culling/boundingBox.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return _boundingBox__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBox\"]; });\n\n/* harmony import */ var _boundingInfo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return _boundingInfo__WEBPACK_IMPORTED_MODULE_1__[\"BoundingInfo\"]; });\n\n/* harmony import */ var _boundingSphere__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boundingSphere */ \"./Culling/boundingSphere.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return _boundingSphere__WEBPACK_IMPORTED_MODULE_2__[\"BoundingSphere\"]; });\n\n/* harmony import */ var _Octrees_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Octrees/index */ \"./Culling/Octrees/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _Octrees_index__WEBPACK_IMPORTED_MODULE_3__[\"Octree\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _Octrees_index__WEBPACK_IMPORTED_MODULE_3__[\"OctreeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _Octrees_index__WEBPACK_IMPORTED_MODULE_3__[\"OctreeSceneComponent\"]; });\n\n/* harmony import */ var _ray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ray */ \"./Culling/ray.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return _ray__WEBPACK_IMPORTED_MODULE_4__[\"Ray\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/ray.ts\":\n/*!************************!*\\\n !*** ./Culling/ray.ts ***!\n \\************************/\n/*! exports provided: Ray */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return Ray; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Collisions/intersectionInfo */ \"./Collisions/intersectionInfo.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Cameras/camera */ \"./Cameras/camera.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class representing a ray with position and direction\r\n */\r\nvar Ray = /** @class */ (function () {\r\n /**\r\n * Creates a new ray\r\n * @param origin origin point\r\n * @param direction direction\r\n * @param length length of the ray\r\n */\r\n function Ray(\r\n /** origin point */\r\n origin, \r\n /** direction */\r\n direction, \r\n /** length of the ray */\r\n length) {\r\n if (length === void 0) { length = Number.MAX_VALUE; }\r\n this.origin = origin;\r\n this.direction = direction;\r\n this.length = length;\r\n }\r\n // Methods\r\n /**\r\n * Checks if the ray intersects a box\r\n * @param minimum bound of the box\r\n * @param maximum bound of the box\r\n * @param intersectionTreshold extra extend to be added to the box in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBoxMinMax = function (minimum, maximum, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var newMinimum = Ray.TmpVector3[0].copyFromFloats(minimum.x - intersectionTreshold, minimum.y - intersectionTreshold, minimum.z - intersectionTreshold);\r\n var newMaximum = Ray.TmpVector3[1].copyFromFloats(maximum.x + intersectionTreshold, maximum.y + intersectionTreshold, maximum.z + intersectionTreshold);\r\n var d = 0.0;\r\n var maxValue = Number.MAX_VALUE;\r\n var inv;\r\n var min;\r\n var max;\r\n var temp;\r\n if (Math.abs(this.direction.x) < 0.0000001) {\r\n if (this.origin.x < newMinimum.x || this.origin.x > newMaximum.x) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.x;\r\n min = (newMinimum.x - this.origin.x) * inv;\r\n max = (newMaximum.x - this.origin.x) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.y) < 0.0000001) {\r\n if (this.origin.y < newMinimum.y || this.origin.y > newMaximum.y) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.y;\r\n min = (newMinimum.y - this.origin.y) * inv;\r\n max = (newMaximum.y - this.origin.y) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.z) < 0.0000001) {\r\n if (this.origin.z < newMinimum.z || this.origin.z > newMaximum.z) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.z;\r\n min = (newMinimum.z - this.origin.z) * inv;\r\n max = (newMaximum.z - this.origin.z) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if the ray intersects a box\r\n * @param box the bounding box to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingBox in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBox = function (box, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n return this.intersectsBoxMinMax(box.minimum, box.maximum, intersectionTreshold);\r\n };\r\n /**\r\n * If the ray hits a sphere\r\n * @param sphere the bounding sphere to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingSphere in all direction\r\n * @returns true if it hits the sphere\r\n */\r\n Ray.prototype.intersectsSphere = function (sphere, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var x = sphere.center.x - this.origin.x;\r\n var y = sphere.center.y - this.origin.y;\r\n var z = sphere.center.z - this.origin.z;\r\n var pyth = (x * x) + (y * y) + (z * z);\r\n var radius = sphere.radius + intersectionTreshold;\r\n var rr = radius * radius;\r\n if (pyth <= rr) {\r\n return true;\r\n }\r\n var dot = (x * this.direction.x) + (y * this.direction.y) + (z * this.direction.z);\r\n if (dot < 0.0) {\r\n return false;\r\n }\r\n var temp = pyth - (dot * dot);\r\n return temp <= rr;\r\n };\r\n /**\r\n * If the ray hits a triange\r\n * @param vertex0 triangle vertex\r\n * @param vertex1 triangle vertex\r\n * @param vertex2 triangle vertex\r\n * @returns intersection information if hit\r\n */\r\n Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {\r\n var edge1 = Ray.TmpVector3[0];\r\n var edge2 = Ray.TmpVector3[1];\r\n var pvec = Ray.TmpVector3[2];\r\n var tvec = Ray.TmpVector3[3];\r\n var qvec = Ray.TmpVector3[4];\r\n vertex1.subtractToRef(vertex0, edge1);\r\n vertex2.subtractToRef(vertex0, edge2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(this.direction, edge2, pvec);\r\n var det = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(edge1, pvec);\r\n if (det === 0) {\r\n return null;\r\n }\r\n var invdet = 1 / det;\r\n this.origin.subtractToRef(vertex0, tvec);\r\n var bv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(tvec, pvec) * invdet;\r\n if (bv < 0 || bv > 1.0) {\r\n return null;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(tvec, edge1, qvec);\r\n var bw = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(this.direction, qvec) * invdet;\r\n if (bw < 0 || bv + bw > 1.0) {\r\n return null;\r\n }\r\n //check if the distance is longer than the predefined length.\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(edge2, qvec) * invdet;\r\n if (distance > this.length) {\r\n return null;\r\n }\r\n return new _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_3__[\"IntersectionInfo\"](1 - bv - bw, bv, distance);\r\n };\r\n /**\r\n * Checks if ray intersects a plane\r\n * @param plane the plane to check\r\n * @returns the distance away it was hit\r\n */\r\n Ray.prototype.intersectsPlane = function (plane) {\r\n var distance;\r\n var result1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(plane.normal, this.direction);\r\n if (Math.abs(result1) < 9.99999997475243E-07) {\r\n return null;\r\n }\r\n else {\r\n var result2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(plane.normal, this.origin);\r\n distance = (-plane.d - result2) / result1;\r\n if (distance < 0.0) {\r\n if (distance < -9.99999997475243E-07) {\r\n return null;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n return distance;\r\n }\r\n };\r\n /**\r\n * Calculate the intercept of a ray on a given axis\r\n * @param axis to check 'x' | 'y' | 'z'\r\n * @param offset from axis interception (i.e. an offset of 1y is intercepted above ground)\r\n * @returns a vector containing the coordinates where 'axis' is equal to zero (else offset), or null if there is no intercept.\r\n */\r\n Ray.prototype.intersectsAxis = function (axis, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n switch (axis) {\r\n case 'y':\r\n var t = (this.origin.y - offset) / this.direction.y;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](this.origin.x + (this.direction.x * -t), offset, this.origin.z + (this.direction.z * -t));\r\n case 'x':\r\n var t = (this.origin.x - offset) / this.direction.x;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](offset, this.origin.y + (this.direction.y * -t), this.origin.z + (this.direction.z * -t));\r\n case 'z':\r\n var t = (this.origin.z - offset) / this.direction.z;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](this.origin.x + (this.direction.x * -t), this.origin.y + (this.direction.y * -t), offset);\r\n default:\r\n return null;\r\n }\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param mesh the mesh to check\r\n * @param fastCheck if only the bounding box should checked\r\n * @returns picking info of the intersecton\r\n */\r\n Ray.prototype.intersectsMesh = function (mesh, fastCheck) {\r\n var tm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0];\r\n mesh.getWorldMatrix().invertToRef(tm);\r\n if (this._tmpRay) {\r\n Ray.TransformToRef(this, tm, this._tmpRay);\r\n }\r\n else {\r\n this._tmpRay = Ray.Transform(this, tm);\r\n }\r\n return mesh.intersects(this._tmpRay, fastCheck);\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param meshes the meshes to check\r\n * @param fastCheck if only the bounding box should checked\r\n * @param results array to store result in\r\n * @returns Array of picking infos\r\n */\r\n Ray.prototype.intersectsMeshes = function (meshes, fastCheck, results) {\r\n if (results) {\r\n results.length = 0;\r\n }\r\n else {\r\n results = [];\r\n }\r\n for (var i = 0; i < meshes.length; i++) {\r\n var pickInfo = this.intersectsMesh(meshes[i], fastCheck);\r\n if (pickInfo.hit) {\r\n results.push(pickInfo);\r\n }\r\n }\r\n results.sort(this._comparePickingInfo);\r\n return results;\r\n };\r\n Ray.prototype._comparePickingInfo = function (pickingInfoA, pickingInfoB) {\r\n if (pickingInfoA.distance < pickingInfoB.distance) {\r\n return -1;\r\n }\r\n else if (pickingInfoA.distance > pickingInfoB.distance) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Intersection test between the ray and a given segment whithin a given tolerance (threshold)\r\n * @param sega the first point of the segment to test the intersection against\r\n * @param segb the second point of the segment to test the intersection against\r\n * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful\r\n * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection\r\n */\r\n Ray.prototype.intersectionSegment = function (sega, segb, threshold) {\r\n var o = this.origin;\r\n var u = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[0];\r\n var rsegb = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[1];\r\n var v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[2];\r\n var w = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[3];\r\n segb.subtractToRef(sega, u);\r\n this.direction.scaleToRef(Ray.rayl, v);\r\n o.addToRef(v, rsegb);\r\n sega.subtractToRef(o, w);\r\n var a = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(u, u); // always >= 0\r\n var b = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(u, v);\r\n var c = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(v, v); // always >= 0\r\n var d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(u, w);\r\n var e = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(v, w);\r\n var D = a * c - b * b; // always >= 0\r\n var sc, sN, sD = D; // sc = sN / sD, default sD = D >= 0\r\n var tc, tN, tD = D; // tc = tN / tD, default tD = D >= 0\r\n // compute the line parameters of the two closest points\r\n if (D < Ray.smallnum) { // the lines are almost parallel\r\n sN = 0.0; // force using point P0 on segment S1\r\n sD = 1.0; // to prevent possible division by 0.0 later\r\n tN = e;\r\n tD = c;\r\n }\r\n else { // get the closest points on the infinite lines\r\n sN = (b * e - c * d);\r\n tN = (a * e - b * d);\r\n if (sN < 0.0) { // sc < 0 => the s=0 edge is visible\r\n sN = 0.0;\r\n tN = e;\r\n tD = c;\r\n }\r\n else if (sN > sD) { // sc > 1 => the s=1 edge is visible\r\n sN = sD;\r\n tN = e + b;\r\n tD = c;\r\n }\r\n }\r\n if (tN < 0.0) { // tc < 0 => the t=0 edge is visible\r\n tN = 0.0;\r\n // recompute sc for this edge\r\n if (-d < 0.0) {\r\n sN = 0.0;\r\n }\r\n else if (-d > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = -d;\r\n sD = a;\r\n }\r\n }\r\n else if (tN > tD) { // tc > 1 => the t=1 edge is visible\r\n tN = tD;\r\n // recompute sc for this edge\r\n if ((-d + b) < 0.0) {\r\n sN = 0;\r\n }\r\n else if ((-d + b) > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = (-d + b);\r\n sD = a;\r\n }\r\n }\r\n // finally do the division to get sc and tc\r\n sc = (Math.abs(sN) < Ray.smallnum ? 0.0 : sN / sD);\r\n tc = (Math.abs(tN) < Ray.smallnum ? 0.0 : tN / tD);\r\n // get the difference of the two closest points\r\n var qtc = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[4];\r\n v.scaleToRef(tc, qtc);\r\n var qsc = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[5];\r\n u.scaleToRef(sc, qsc);\r\n qsc.addInPlace(w);\r\n var dP = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[6];\r\n qsc.subtractToRef(qtc, dP); // = S1(sc) - S2(tc)\r\n var isIntersected = (tc > 0) && (tc <= this.length) && (dP.lengthSquared() < (threshold * threshold)); // return intersection result\r\n if (isIntersected) {\r\n return qsc.length();\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Update the ray from viewport position\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns this ray updated\r\n */\r\n Ray.prototype.update = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n this.unprojectRayToRef(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a ray with origin and direction of 0,0,0\r\n * @returns the new ray\r\n */\r\n Ray.Zero = function () {\r\n return new Ray(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero());\r\n };\r\n /**\r\n * Creates a new ray from screen space and viewport\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns new ray\r\n */\r\n Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Ray.Zero();\r\n return result.update(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n };\r\n /**\r\n * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be\r\n * transformed to the given world matrix.\r\n * @param origin The origin point\r\n * @param end The end point\r\n * @param world a matrix to transform the ray to. Default is the identity matrix.\r\n * @returns the new ray\r\n */\r\n Ray.CreateNewFromTo = function (origin, end, world) {\r\n if (world === void 0) { world = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly; }\r\n var direction = end.subtract(origin);\r\n var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));\r\n direction.normalize();\r\n return Ray.Transform(new Ray(origin, direction, length), world);\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @returns the resulting new ray\r\n */\r\n Ray.Transform = function (ray, matrix) {\r\n var result = new Ray(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0));\r\n Ray.TransformToRef(ray, matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @param result ray to store result in\r\n */\r\n Ray.TransformToRef = function (ray, matrix, result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(ray.origin, matrix, result.origin);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalToRef(ray.direction, matrix, result.direction);\r\n result.length = ray.length;\r\n var dir = result.direction;\r\n var len = dir.length();\r\n if (!(len === 0 || len === 1)) {\r\n var num = 1.0 / len;\r\n dir.x *= num;\r\n dir.y *= num;\r\n dir.z *= num;\r\n result.length *= len;\r\n }\r\n };\r\n /**\r\n * Unproject a ray from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n */\r\n Ray.prototype.unprojectRayToRef = function (sourceX, sourceY, viewportWidth, viewportHeight, world, view, projection) {\r\n var matrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var nearScreenSource = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[0];\r\n nearScreenSource.x = sourceX / viewportWidth * 2 - 1;\r\n nearScreenSource.y = -(sourceY / viewportHeight * 2 - 1);\r\n nearScreenSource.z = -1.0;\r\n var farScreenSource = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[1].copyFromFloats(nearScreenSource.x, nearScreenSource.y, 1.0);\r\n var nearVec3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[2];\r\n var farVec3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[3];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]._UnprojectFromInvertedMatrixToRef(nearScreenSource, matrix, nearVec3);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]._UnprojectFromInvertedMatrixToRef(farScreenSource, matrix, farVec3);\r\n this.origin.copyFrom(nearVec3);\r\n farVec3.subtractToRef(nearVec3, this.direction);\r\n this.direction.normalize();\r\n };\r\n Ray.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(6, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n Ray.smallnum = 0.00000001;\r\n Ray.rayl = 10e8;\r\n return Ray;\r\n}());\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var result = Ray.Zero();\r\n this.createPickingRayToRef(x, y, world, result, camera, cameraViewSpace);\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, world ? world : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly, cameraViewSpace ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly : camera.getViewMatrix(), camera.getProjectionMatrix());\r\n return this;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n var result = Ray.Zero();\r\n this.createPickingRayInCameraSpaceToRef(x, y, result, camera);\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return this;\r\n }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n var identity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, identity, identity, camera.getProjectionMatrix());\r\n return this;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype._internalPick = function (rayFunction, predicate, fastCheck, trianglePredicate) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfo = null;\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.getWorldMatrix();\r\n var ray = rayFunction(world);\r\n var result = mesh.intersects(ray, fastCheck, trianglePredicate);\r\n if (!result || !result.hit) {\r\n continue;\r\n }\r\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\r\n continue;\r\n }\r\n pickingInfo = result;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n return pickingInfo || new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]();\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype._internalMultiPick = function (rayFunction, predicate, trianglePredicate) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfos = new Array();\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.getWorldMatrix();\r\n var ray = rayFunction(world);\r\n var result = mesh.intersects(ray, false, trianglePredicate);\r\n if (!result || !result.hit) {\r\n continue;\r\n }\r\n pickingInfos.push(result);\r\n }\r\n return pickingInfos;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n var _this = this;\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var result = this._internalPick(function (world) {\r\n if (!_this._tempPickingRay) {\r\n _this._tempPickingRay = Ray.Zero();\r\n }\r\n _this.createPickingRayToRef(x, y, world, _this._tempPickingRay, camera || null);\r\n return _this._tempPickingRay;\r\n }, predicate, fastCheck, trianglePredicate);\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n var _this = this;\r\n var result = this._internalPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, fastCheck, trianglePredicate);\r\n if (result) {\r\n result.ray = ray;\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) { return _this.createPickingRay(x, y, world, camera || null); }, predicate, trianglePredicate);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, trianglePredicate);\r\n};\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_5__[\"Camera\"].prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n if (!transform) {\r\n transform = this.getWorldMatrix();\r\n }\r\n if (!origin) {\r\n origin = this.position;\r\n }\r\n var forward = this._scene.useRightHandedSystem ? new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, -1) : new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 1);\r\n var forwardWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormal(forward, transform);\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Normalize(forwardWorld);\r\n return new Ray(origin, direction, length);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Debug/axesViewer.ts\":\n/*!*****************************!*\\\n !*** ./Debug/axesViewer.ts ***!\n \\*****************************/\n/*! exports provided: AxesViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return AxesViewer; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Gizmos/axisDragGizmo */ \"./Gizmos/axisDragGizmo.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The Axes viewer will show 3 axes in a specific point in space\r\n */\r\nvar AxesViewer = /** @class */ (function () {\r\n /**\r\n * Creates a new AxesViewer\r\n * @param scene defines the hosting scene\r\n * @param scaleLines defines a number used to scale line length (1 by default)\r\n * @param renderingGroupId defines a number used to set the renderingGroupId of the meshes (2 by default)\r\n * @param xAxis defines the node hierarchy used to render the x-axis\r\n * @param yAxis defines the node hierarchy used to render the y-axis\r\n * @param zAxis defines the node hierarchy used to render the z-axis\r\n */\r\n function AxesViewer(scene, scaleLines, renderingGroupId, xAxis, yAxis, zAxis) {\r\n if (scaleLines === void 0) { scaleLines = 1; }\r\n if (renderingGroupId === void 0) { renderingGroupId = 2; }\r\n this._scaleLinesFactor = 4;\r\n this._instanced = false;\r\n /**\r\n * Gets or sets a number used to scale line length\r\n */\r\n this.scaleLines = 1;\r\n this.scaleLines = scaleLines;\r\n if (!xAxis) {\r\n var redColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__[\"StandardMaterial\"](\"\", scene);\r\n redColoredMaterial.disableLighting = true;\r\n redColoredMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Red().scale(0.5);\r\n xAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrow(scene, redColoredMaterial);\r\n }\r\n if (!yAxis) {\r\n var greenColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__[\"StandardMaterial\"](\"\", scene);\r\n greenColoredMaterial.disableLighting = true;\r\n greenColoredMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Green().scale(0.5);\r\n yAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrow(scene, greenColoredMaterial);\r\n }\r\n if (!zAxis) {\r\n var blueColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__[\"StandardMaterial\"](\"\", scene);\r\n blueColoredMaterial.disableLighting = true;\r\n blueColoredMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Blue().scale(0.5);\r\n zAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrow(scene, blueColoredMaterial);\r\n }\r\n this._xAxis = xAxis;\r\n this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._yAxis = yAxis;\r\n this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._zAxis = zAxis;\r\n this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n if (renderingGroupId != null) {\r\n AxesViewer._SetRenderingGroupId(this._xAxis, renderingGroupId);\r\n AxesViewer._SetRenderingGroupId(this._yAxis, renderingGroupId);\r\n AxesViewer._SetRenderingGroupId(this._zAxis, renderingGroupId);\r\n }\r\n this.scene = scene;\r\n this.update(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Right(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Forward());\r\n }\r\n Object.defineProperty(AxesViewer.prototype, \"xAxis\", {\r\n /** Gets the node hierarchy used to render x-axis */\r\n get: function () {\r\n return this._xAxis;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxesViewer.prototype, \"yAxis\", {\r\n /** Gets the node hierarchy used to render y-axis */\r\n get: function () {\r\n return this._yAxis;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxesViewer.prototype, \"zAxis\", {\r\n /** Gets the node hierarchy used to render z-axis */\r\n get: function () {\r\n return this._zAxis;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Force the viewer to update\r\n * @param position defines the position of the viewer\r\n * @param xaxis defines the x axis of the viewer\r\n * @param yaxis defines the y axis of the viewer\r\n * @param zaxis defines the z axis of the viewer\r\n */\r\n AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {\r\n this._xAxis.position.copyFrom(position);\r\n this._xAxis.setDirection(xaxis);\r\n this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._yAxis.position.copyFrom(position);\r\n this._yAxis.setDirection(yaxis);\r\n this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._zAxis.position.copyFrom(position);\r\n this._zAxis.setDirection(zaxis);\r\n this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n };\r\n /**\r\n * Creates an instance of this axes viewer.\r\n * @returns a new axes viewer with instanced meshes\r\n */\r\n AxesViewer.prototype.createInstance = function () {\r\n var xAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrowInstance(this.scene, this._xAxis);\r\n var yAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrowInstance(this.scene, this._yAxis);\r\n var zAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrowInstance(this.scene, this._zAxis);\r\n var axesViewer = new AxesViewer(this.scene, this.scaleLines, null, xAxis, yAxis, zAxis);\r\n axesViewer._instanced = true;\r\n return axesViewer;\r\n };\r\n /** Releases resources */\r\n AxesViewer.prototype.dispose = function () {\r\n if (this._xAxis) {\r\n this._xAxis.dispose(false, !this._instanced);\r\n delete this._xAxis;\r\n }\r\n if (this._yAxis) {\r\n this._yAxis.dispose(false, !this._instanced);\r\n delete this._yAxis;\r\n }\r\n if (this._zAxis) {\r\n this._zAxis.dispose(false, !this._instanced);\r\n delete this._zAxis;\r\n }\r\n delete this.scene;\r\n };\r\n AxesViewer._SetRenderingGroupId = function (node, id) {\r\n node.getChildMeshes().forEach(function (mesh) {\r\n mesh.renderingGroupId = id;\r\n });\r\n };\r\n return AxesViewer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/boneAxesViewer.ts\":\n/*!*********************************!*\\\n !*** ./Debug/boneAxesViewer.ts ***!\n \\*********************************/\n/*! exports provided: BoneAxesViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return BoneAxesViewer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Debug_axesViewer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Debug/axesViewer */ \"./Debug/axesViewer.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The BoneAxesViewer will attach 3 axes to a specific bone of a specific mesh\r\n * @see demo here: https://www.babylonjs-playground.com/#0DE8F4#8\r\n */\r\nvar BoneAxesViewer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BoneAxesViewer, _super);\r\n /**\r\n * Creates a new BoneAxesViewer\r\n * @param scene defines the hosting scene\r\n * @param bone defines the target bone\r\n * @param mesh defines the target mesh\r\n * @param scaleLines defines a scaling factor for line length (1 by default)\r\n */\r\n function BoneAxesViewer(scene, bone, mesh, scaleLines) {\r\n if (scaleLines === void 0) { scaleLines = 1; }\r\n var _this = _super.call(this, scene, scaleLines) || this;\r\n /** Gets current position */\r\n _this.pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** Gets direction of X axis */\r\n _this.xaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** Gets direction of Y axis */\r\n _this.yaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** Gets direction of Z axis */\r\n _this.zaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this.mesh = mesh;\r\n _this.bone = bone;\r\n return _this;\r\n }\r\n /**\r\n * Force the viewer to update\r\n */\r\n BoneAxesViewer.prototype.update = function () {\r\n if (!this.mesh || !this.bone) {\r\n return;\r\n }\r\n var bone = this.bone;\r\n bone._markAsDirtyAndCompose();\r\n bone.getAbsolutePositionToRef(this.mesh, this.pos);\r\n bone.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__[\"Axis\"].X, this.mesh, this.xaxis);\r\n bone.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__[\"Axis\"].Y, this.mesh, this.yaxis);\r\n bone.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__[\"Axis\"].Z, this.mesh, this.zaxis);\r\n _super.prototype.update.call(this, this.pos, this.xaxis, this.yaxis, this.zaxis);\r\n };\r\n /** Releases resources */\r\n BoneAxesViewer.prototype.dispose = function () {\r\n if (this.mesh) {\r\n this.mesh = null;\r\n this.bone = null;\r\n _super.prototype.dispose.call(this);\r\n }\r\n };\r\n return BoneAxesViewer;\r\n}(_Debug_axesViewer__WEBPACK_IMPORTED_MODULE_1__[\"AxesViewer\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/debugLayer.ts\":\n/*!*****************************!*\\\n !*** ./Debug/debugLayer.ts ***!\n \\*****************************/\n/*! exports provided: DebugLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return DebugLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype, \"debugLayer\", {\r\n get: function () {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see http://doc.babylonjs.com/features/playground_debuglayer\r\n */\r\nvar DebugLayer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see http://doc.babylonjs.com/features/playground_debuglayer\r\n * @param scene Defines the scene to inspect\r\n */\r\n function DebugLayer(scene) {\r\n var _this = this;\r\n this.BJSINSPECTOR = this._getGlobalInspector();\r\n this._scene = scene;\r\n this._scene.onDisposeObservable.add(function () {\r\n // Debug layer\r\n if (_this._scene._debugLayer) {\r\n _this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n Object.defineProperty(DebugLayer.prototype, \"onPropertyChangedObservable\", {\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n get: function () {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n }\r\n return this._onPropertyChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Creates the inspector window. */\r\n DebugLayer.prototype._createInspector = function (config) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n if (this._onPropertyChangedObservable) {\r\n for (var _i = 0, _a = this._onPropertyChangedObservable.observers; _i < _a.length; _i++) {\r\n var observer = _a[_i];\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n var userOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ overlay: false, showExplorer: true, showInspector: true, embedMode: false, handleResize: true, enablePopup: true }, config);\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n };\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitle defines the specific block to highlight\r\n */\r\n DebugLayer.prototype.select = function (entity, lineContainerTitle) {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitle);\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n };\r\n /** Get the inspector from bundle or global */\r\n DebugLayer.prototype._getGlobalInspector = function () {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof INSPECTOR !== 'undefined') {\r\n return INSPECTOR;\r\n }\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== 'undefined' && typeof BABYLON.Inspector !== 'undefined') {\r\n return BABYLON;\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n DebugLayer.prototype.isVisible = function () {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n };\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n DebugLayer.prototype.hide = function () {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n };\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @return a promise fulfilled when the debug layer is visible\r\n */\r\n DebugLayer.prototype.show = function (config) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (typeof _this.BJSINSPECTOR == 'undefined') {\r\n var inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n // Load inspector and add it to the DOM\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].LoadScript(inspectorUrl, function () {\r\n _this._createInspector(config);\r\n resolve(_this);\r\n });\r\n }\r\n else {\r\n // Otherwise creates the inspector\r\n _this._createInspector(config);\r\n resolve(_this);\r\n }\r\n });\r\n };\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n DebugLayer.InspectorURL = \"https://unpkg.com/babylonjs-inspector@\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].Version + \"/babylon.inspector.bundle.js\";\r\n return DebugLayer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/index.ts\":\n/*!************************!*\\\n !*** ./Debug/index.ts ***!\n \\************************/\n/*! exports provided: AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _axesViewer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./axesViewer */ \"./Debug/axesViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return _axesViewer__WEBPACK_IMPORTED_MODULE_0__[\"AxesViewer\"]; });\n\n/* harmony import */ var _boneAxesViewer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boneAxesViewer */ \"./Debug/boneAxesViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return _boneAxesViewer__WEBPACK_IMPORTED_MODULE_1__[\"BoneAxesViewer\"]; });\n\n/* harmony import */ var _debugLayer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./debugLayer */ \"./Debug/debugLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return _debugLayer__WEBPACK_IMPORTED_MODULE_2__[\"DebugLayer\"]; });\n\n/* harmony import */ var _physicsViewer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./physicsViewer */ \"./Debug/physicsViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return _physicsViewer__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsViewer\"]; });\n\n/* harmony import */ var _rayHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./rayHelper */ \"./Debug/rayHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return _rayHelper__WEBPACK_IMPORTED_MODULE_4__[\"RayHelper\"]; });\n\n/* harmony import */ var _skeletonViewer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./skeletonViewer */ \"./Debug/skeletonViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return _skeletonViewer__WEBPACK_IMPORTED_MODULE_5__[\"SkeletonViewer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/physicsViewer.ts\":\n/*!********************************!*\\\n !*** ./Debug/physicsViewer.ts ***!\n \\********************************/\n/*! exports provided: PhysicsViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return PhysicsViewer; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Used to show the physics impostor around the specific mesh\r\n */\r\nvar PhysicsViewer = /** @class */ (function () {\r\n /**\r\n * Creates a new PhysicsViewer\r\n * @param scene defines the hosting scene\r\n */\r\n function PhysicsViewer(scene) {\r\n /** @hidden */\r\n this._impostors = [];\r\n /** @hidden */\r\n this._meshes = [];\r\n /** @hidden */\r\n this._numMeshes = 0;\r\n this._debugMeshMeshes = new Array();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene;\r\n var physicEngine = this._scene.getPhysicsEngine();\r\n if (physicEngine) {\r\n this._physicsEnginePlugin = physicEngine.getPhysicsPlugin();\r\n }\r\n this._utilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"](this._scene, false);\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;\r\n }\r\n /** @hidden */\r\n PhysicsViewer.prototype._updateDebugMeshes = function () {\r\n var plugin = this._physicsEnginePlugin;\r\n for (var i = 0; i < this._numMeshes; i++) {\r\n var impostor = this._impostors[i];\r\n if (!impostor) {\r\n continue;\r\n }\r\n if (impostor.isDisposed) {\r\n this.hideImpostor(this._impostors[i--]);\r\n }\r\n else {\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].MeshImpostor) {\r\n continue;\r\n }\r\n var mesh = this._meshes[i];\r\n if (mesh && plugin) {\r\n plugin.syncMeshWithImpostor(mesh, impostor);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Renders a specified physic impostor\r\n * @param impostor defines the impostor to render\r\n * @param targetMesh defines the mesh represented by the impostor\r\n * @returns the new debug mesh used to render the impostor\r\n */\r\n PhysicsViewer.prototype.showImpostor = function (impostor, targetMesh) {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n for (var i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n return null;\r\n }\r\n }\r\n var debugMesh = this._getDebugMesh(impostor, targetMesh);\r\n if (debugMesh) {\r\n this._impostors[this._numMeshes] = impostor;\r\n this._meshes[this._numMeshes] = debugMesh;\r\n if (this._numMeshes === 0) {\r\n this._renderFunction = this._updateDebugMeshes.bind(this);\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n this._numMeshes++;\r\n }\r\n return debugMesh;\r\n };\r\n /**\r\n * Hides a specified physic impostor\r\n * @param impostor defines the impostor to hide\r\n */\r\n PhysicsViewer.prototype.hideImpostor = function (impostor) {\r\n if (!impostor || !this._scene || !this._utilityLayer) {\r\n return;\r\n }\r\n var removed = false;\r\n var utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n for (var i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n var mesh = this._meshes[i];\r\n if (!mesh) {\r\n continue;\r\n }\r\n utilityLayerScene.removeMesh(mesh);\r\n mesh.dispose();\r\n var index = this._debugMeshMeshes.indexOf(mesh);\r\n if (index > -1) {\r\n this._debugMeshMeshes.splice(index, 1);\r\n }\r\n this._numMeshes--;\r\n if (this._numMeshes > 0) {\r\n this._meshes[i] = this._meshes[this._numMeshes];\r\n this._impostors[i] = this._impostors[this._numMeshes];\r\n this._meshes[this._numMeshes] = null;\r\n this._impostors[this._numMeshes] = null;\r\n }\r\n else {\r\n this._meshes[0] = null;\r\n this._impostors[0] = null;\r\n }\r\n removed = true;\r\n break;\r\n }\r\n }\r\n if (removed && this._numMeshes === 0) {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n }\r\n };\r\n PhysicsViewer.prototype._getDebugMaterial = function (scene) {\r\n if (!this._debugMaterial) {\r\n this._debugMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"]('', scene);\r\n this._debugMaterial.wireframe = true;\r\n this._debugMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].White();\r\n this._debugMaterial.disableLighting = true;\r\n }\r\n return this._debugMaterial;\r\n };\r\n PhysicsViewer.prototype._getDebugBoxMesh = function (scene) {\r\n if (!this._debugBoxMesh) {\r\n this._debugBoxMesh = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_1__[\"BoxBuilder\"].CreateBox('physicsBodyBoxViewMesh', { size: 1 }, scene);\r\n this._debugBoxMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n this._debugBoxMesh.material = this._getDebugMaterial(scene);\r\n this._debugBoxMesh.setEnabled(false);\r\n }\r\n return this._debugBoxMesh.createInstance('physicsBodyBoxViewInstance');\r\n };\r\n PhysicsViewer.prototype._getDebugSphereMesh = function (scene) {\r\n if (!this._debugSphereMesh) {\r\n this._debugSphereMesh = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_2__[\"SphereBuilder\"].CreateSphere('physicsBodySphereViewMesh', { diameter: 1 }, scene);\r\n this._debugSphereMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n this._debugSphereMesh.material = this._getDebugMaterial(scene);\r\n this._debugSphereMesh.setEnabled(false);\r\n }\r\n return this._debugSphereMesh.createInstance('physicsBodyBoxViewInstance');\r\n };\r\n PhysicsViewer.prototype._getDebugCylinderMesh = function (scene) {\r\n if (!this._debugCylinderMesh) {\r\n this._debugCylinderMesh = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_9__[\"CylinderBuilder\"].CreateCylinder('physicsBodyCylinderViewMesh', { diameterTop: 1, diameterBottom: 1, height: 1 }, scene);\r\n this._debugCylinderMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n this._debugCylinderMesh.material = this._getDebugMaterial(scene);\r\n this._debugCylinderMesh.setEnabled(false);\r\n }\r\n return this._debugCylinderMesh.createInstance('physicsBodyBoxViewInstance');\r\n };\r\n PhysicsViewer.prototype._getDebugMeshMesh = function (mesh, scene) {\r\n var wireframeOver = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](mesh.name, scene, null, mesh);\r\n wireframeOver.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n wireframeOver.setParent(mesh);\r\n wireframeOver.material = this._getDebugMaterial(scene);\r\n this._debugMeshMeshes.push(wireframeOver);\r\n return wireframeOver;\r\n };\r\n PhysicsViewer.prototype._getDebugMesh = function (impostor, targetMesh) {\r\n var _this = this;\r\n if (!this._utilityLayer) {\r\n return null;\r\n }\r\n // Only create child impostor debug meshes when evaluating the parent\r\n if (targetMesh && targetMesh.parent && targetMesh.parent.physicsImpostor) {\r\n return null;\r\n }\r\n var mesh = null;\r\n var utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n switch (impostor.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].BoxImpostor:\r\n mesh = this._getDebugBoxMesh(utilityLayerScene);\r\n impostor.getBoxSizeToRef(mesh.scaling);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].SphereImpostor:\r\n mesh = this._getDebugSphereMesh(utilityLayerScene);\r\n var radius = impostor.getRadius();\r\n mesh.scaling.x = radius * 2;\r\n mesh.scaling.y = radius * 2;\r\n mesh.scaling.z = radius * 2;\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].MeshImpostor:\r\n if (targetMesh) {\r\n mesh = this._getDebugMeshMesh(targetMesh, utilityLayerScene);\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].NoImpostor:\r\n if (targetMesh) {\r\n // Handle compound impostors\r\n var childMeshes = targetMesh.getChildMeshes().filter(function (c) { return c.physicsImpostor ? 1 : 0; });\r\n childMeshes.forEach(function (m) {\r\n var a = _this._getDebugBoxMesh(utilityLayerScene);\r\n a.parent = m;\r\n });\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].CylinderImpostor:\r\n mesh = this._getDebugCylinderMesh(utilityLayerScene);\r\n var bi = impostor.object.getBoundingInfo();\r\n mesh.scaling.x = bi.boundingBox.maximum.x - bi.boundingBox.minimum.x;\r\n mesh.scaling.y = bi.boundingBox.maximum.y - bi.boundingBox.minimum.y;\r\n mesh.scaling.z = bi.boundingBox.maximum.z - bi.boundingBox.minimum.z;\r\n break;\r\n }\r\n return mesh;\r\n };\r\n /** Releases all resources */\r\n PhysicsViewer.prototype.dispose = function () {\r\n var count = this._numMeshes;\r\n for (var index = 0; index < count; index++) {\r\n this.hideImpostor(this._impostors[0]);\r\n }\r\n if (this._debugBoxMesh) {\r\n this._debugBoxMesh.dispose();\r\n }\r\n if (this._debugSphereMesh) {\r\n this._debugSphereMesh.dispose();\r\n }\r\n if (this._debugCylinderMesh) {\r\n this._debugCylinderMesh.dispose();\r\n }\r\n if (this._debugMaterial) {\r\n this._debugMaterial.dispose();\r\n }\r\n this._impostors.length = 0;\r\n this._scene = null;\r\n this._physicsEnginePlugin = null;\r\n if (this._utilityLayer) {\r\n this._utilityLayer.dispose();\r\n this._utilityLayer = null;\r\n }\r\n };\r\n return PhysicsViewer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/rayHelper.ts\":\n/*!****************************!*\\\n !*** ./Debug/rayHelper.ts ***!\n \\****************************/\n/*! exports provided: RayHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return RayHelper; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n\r\n\r\n\r\n/**\r\n * As raycast might be hard to debug, the RayHelper can help rendering the different rays\r\n * in order to better appreciate the issue one might have.\r\n * @see http://doc.babylonjs.com/babylon101/raycasts#debugging\r\n */\r\nvar RayHelper = /** @class */ (function () {\r\n /**\r\n * Instantiate a new ray helper.\r\n * As raycast might be hard to debug, the RayHelper can help rendering the different rays\r\n * in order to better appreciate the issue one might have.\r\n * @see http://doc.babylonjs.com/babylon101/raycasts#debugging\r\n * @param ray Defines the ray we are currently tryin to visualize\r\n */\r\n function RayHelper(ray) {\r\n this.ray = ray;\r\n }\r\n /**\r\n * Helper function to create a colored helper in a scene in one line.\r\n * @param ray Defines the ray we are currently tryin to visualize\r\n * @param scene Defines the scene the ray is used in\r\n * @param color Defines the color we want to see the ray in\r\n * @returns The newly created ray helper.\r\n */\r\n RayHelper.CreateAndShow = function (ray, scene, color) {\r\n var helper = new RayHelper(ray);\r\n helper.show(scene, color);\r\n return helper;\r\n };\r\n /**\r\n * Shows the ray we are willing to debug.\r\n * @param scene Defines the scene the ray needs to be rendered in\r\n * @param color Defines the color the ray needs to be rendered in\r\n */\r\n RayHelper.prototype.show = function (scene, color) {\r\n if (!this._renderFunction && this.ray) {\r\n var ray = this.ray;\r\n this._renderFunction = this._render.bind(this);\r\n this._scene = scene;\r\n this._renderPoints = [ray.origin, ray.origin.add(ray.direction.scale(ray.length))];\r\n this._renderLine = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLines(\"ray\", this._renderPoints, scene, true);\r\n if (this._renderFunction) {\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n }\r\n if (color && this._renderLine) {\r\n this._renderLine.color.copyFrom(color);\r\n }\r\n };\r\n /**\r\n * Hides the ray we are debugging.\r\n */\r\n RayHelper.prototype.hide = function () {\r\n if (this._renderFunction && this._scene) {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n this._scene = null;\r\n this._renderFunction = null;\r\n if (this._renderLine) {\r\n this._renderLine.dispose();\r\n this._renderLine = null;\r\n }\r\n this._renderPoints = [];\r\n }\r\n };\r\n RayHelper.prototype._render = function () {\r\n var ray = this.ray;\r\n if (!ray) {\r\n return;\r\n }\r\n var point = this._renderPoints[1];\r\n var len = Math.min(ray.length, 1000000);\r\n point.copyFrom(ray.direction);\r\n point.scaleInPlace(len);\r\n point.addInPlace(ray.origin);\r\n _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLines(\"ray\", this._renderPoints, this._scene, true, this._renderLine);\r\n };\r\n /**\r\n * Attach a ray helper to a mesh so that we can easily see its orientation for instance or information like its normals.\r\n * @param mesh Defines the mesh we want the helper attached to\r\n * @param meshSpaceDirection Defines the direction of the Ray in mesh space (local space of the mesh node)\r\n * @param meshSpaceOrigin Defines the origin of the Ray in mesh space (local space of the mesh node)\r\n * @param length Defines the length of the ray\r\n */\r\n RayHelper.prototype.attachToMesh = function (mesh, meshSpaceDirection, meshSpaceOrigin, length) {\r\n this._attachedToMesh = mesh;\r\n var ray = this.ray;\r\n if (!ray) {\r\n return;\r\n }\r\n if (!ray.direction) {\r\n ray.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n if (!ray.origin) {\r\n ray.origin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n if (length) {\r\n ray.length = length;\r\n }\r\n if (!meshSpaceOrigin) {\r\n meshSpaceOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n if (!meshSpaceDirection) {\r\n // -1 so that this will work with Mesh.lookAt\r\n meshSpaceDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1);\r\n }\r\n if (!this._meshSpaceDirection) {\r\n this._meshSpaceDirection = meshSpaceDirection.clone();\r\n this._meshSpaceOrigin = meshSpaceOrigin.clone();\r\n }\r\n else {\r\n this._meshSpaceDirection.copyFrom(meshSpaceDirection);\r\n this._meshSpaceOrigin.copyFrom(meshSpaceOrigin);\r\n }\r\n if (!this._updateToMeshFunction) {\r\n this._updateToMeshFunction = this._updateToMesh.bind(this);\r\n this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction);\r\n }\r\n this._updateToMesh();\r\n };\r\n /**\r\n * Detach the ray helper from the mesh it has previously been attached to.\r\n */\r\n RayHelper.prototype.detachFromMesh = function () {\r\n if (this._attachedToMesh) {\r\n if (this._updateToMeshFunction) {\r\n this._attachedToMesh.getScene().unregisterBeforeRender(this._updateToMeshFunction);\r\n }\r\n this._attachedToMesh = null;\r\n this._updateToMeshFunction = null;\r\n }\r\n };\r\n RayHelper.prototype._updateToMesh = function () {\r\n var ray = this.ray;\r\n if (!this._attachedToMesh || !ray) {\r\n return;\r\n }\r\n if (this._attachedToMesh._isDisposed) {\r\n this.detachFromMesh();\r\n return;\r\n }\r\n this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection, ray.direction);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(this._meshSpaceOrigin, this._attachedToMesh.getWorldMatrix(), ray.origin);\r\n };\r\n /**\r\n * Dispose the helper and release its associated resources.\r\n */\r\n RayHelper.prototype.dispose = function () {\r\n this.hide();\r\n this.detachFromMesh();\r\n this.ray = null;\r\n };\r\n return RayHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/skeletonViewer.ts\":\n/*!*********************************!*\\\n !*** ./Debug/skeletonViewer.ts ***!\n \\*********************************/\n/*! exports provided: SkeletonViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return SkeletonViewer; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to render a debug view of a given skeleton\r\n * @see http://www.babylonjs-playground.com/#1BZJVJ#8\r\n */\r\nvar SkeletonViewer = /** @class */ (function () {\r\n /**\r\n * Creates a new SkeletonViewer\r\n * @param skeleton defines the skeleton to render\r\n * @param mesh defines the mesh attached to the skeleton\r\n * @param scene defines the hosting scene\r\n * @param autoUpdateBonesMatrices defines a boolean indicating if bones matrices must be forced to update before rendering (true by default)\r\n * @param renderingGroupId defines the rendering group id to use with the viewer\r\n */\r\n function SkeletonViewer(\r\n /** defines the skeleton to render */\r\n skeleton, \r\n /** defines the mesh attached to the skeleton */\r\n mesh, scene, \r\n /** defines a boolean indicating if bones matrices must be forced to update before rendering (true by default) */\r\n autoUpdateBonesMatrices, \r\n /** defines the rendering group id to use with the viewer */\r\n renderingGroupId) {\r\n if (autoUpdateBonesMatrices === void 0) { autoUpdateBonesMatrices = true; }\r\n if (renderingGroupId === void 0) { renderingGroupId = 1; }\r\n this.skeleton = skeleton;\r\n this.mesh = mesh;\r\n this.autoUpdateBonesMatrices = autoUpdateBonesMatrices;\r\n this.renderingGroupId = renderingGroupId;\r\n /** Gets or sets the color used to render the skeleton */\r\n this.color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].White();\r\n this._debugLines = new Array();\r\n this._isEnabled = false;\r\n this._scene = scene;\r\n this._utilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__[\"UtilityLayerRenderer\"](this._scene, false);\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;\r\n this.update();\r\n this._renderFunction = this.update.bind(this);\r\n }\r\n Object.defineProperty(SkeletonViewer.prototype, \"debugMesh\", {\r\n /**\r\n * Returns the mesh used to render the bones\r\n */\r\n get: function () {\r\n return this._debugMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SkeletonViewer.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /** Gets or sets a boolean indicating if the viewer is enabled */\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n if (value) {\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n else {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SkeletonViewer.prototype._getBonePosition = function (position, bone, meshMat, x, y, z) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n if (z === void 0) { z = 0; }\r\n var tmat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var parentBone = bone.getParent();\r\n tmat.copyFrom(bone.getLocalMatrix());\r\n if (x !== 0 || y !== 0 || z !== 0) {\r\n var tmat2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].IdentityToRef(tmat2);\r\n tmat2.setTranslationFromFloats(x, y, z);\r\n tmat2.multiplyToRef(tmat, tmat);\r\n }\r\n if (parentBone) {\r\n tmat.multiplyToRef(parentBone.getAbsoluteTransform(), tmat);\r\n }\r\n tmat.multiplyToRef(meshMat, tmat);\r\n position.x = tmat.m[12];\r\n position.y = tmat.m[13];\r\n position.z = tmat.m[14];\r\n };\r\n SkeletonViewer.prototype._getLinesForBonesWithLength = function (bones, meshMat) {\r\n var len = bones.length;\r\n var mesh = this.mesh._effectiveMesh;\r\n var meshPos = mesh.position;\r\n for (var i = 0; i < len; i++) {\r\n var bone = bones[i];\r\n var points = this._debugLines[i];\r\n if (!points) {\r\n points = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero()];\r\n this._debugLines[i] = points;\r\n }\r\n this._getBonePosition(points[0], bone, meshMat);\r\n this._getBonePosition(points[1], bone, meshMat, 0, bone.length, 0);\r\n points[0].subtractInPlace(meshPos);\r\n points[1].subtractInPlace(meshPos);\r\n }\r\n };\r\n SkeletonViewer.prototype._getLinesForBonesNoLength = function (bones, meshMat) {\r\n var len = bones.length;\r\n var boneNum = 0;\r\n var mesh = this.mesh._effectiveMesh;\r\n var meshPos = mesh.position;\r\n for (var i = len - 1; i >= 0; i--) {\r\n var childBone = bones[i];\r\n var parentBone = childBone.getParent();\r\n if (!parentBone) {\r\n continue;\r\n }\r\n var points = this._debugLines[boneNum];\r\n if (!points) {\r\n points = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero()];\r\n this._debugLines[boneNum] = points;\r\n }\r\n childBone.getAbsolutePositionToRef(mesh, points[0]);\r\n parentBone.getAbsolutePositionToRef(mesh, points[1]);\r\n points[0].subtractInPlace(meshPos);\r\n points[1].subtractInPlace(meshPos);\r\n boneNum++;\r\n }\r\n };\r\n /** Update the viewer to sync with current skeleton state */\r\n SkeletonViewer.prototype.update = function () {\r\n if (!this._utilityLayer) {\r\n return;\r\n }\r\n if (this.autoUpdateBonesMatrices) {\r\n this.skeleton.computeAbsoluteTransforms();\r\n }\r\n var mesh = this.mesh._effectiveMesh;\r\n if (this.skeleton.bones[0].length === undefined) {\r\n this._getLinesForBonesNoLength(this.skeleton.bones, mesh.getWorldMatrix());\r\n }\r\n else {\r\n this._getLinesForBonesWithLength(this.skeleton.bones, mesh.getWorldMatrix());\r\n }\r\n var targetScene = this._utilityLayer.utilityLayerScene;\r\n if (!this._debugMesh) {\r\n this._debugMesh = _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__[\"LinesBuilder\"].CreateLineSystem(\"\", { lines: this._debugLines, updatable: true, instance: null }, targetScene);\r\n this._debugMesh.renderingGroupId = this.renderingGroupId;\r\n }\r\n else {\r\n _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__[\"LinesBuilder\"].CreateLineSystem(\"\", { lines: this._debugLines, updatable: true, instance: this._debugMesh }, targetScene);\r\n }\r\n this._debugMesh.position.copyFrom(this.mesh.position);\r\n this._debugMesh.color = this.color;\r\n };\r\n /** Release associated resources */\r\n SkeletonViewer.prototype.dispose = function () {\r\n this.isEnabled = false;\r\n if (this._debugMesh) {\r\n this.isEnabled = false;\r\n this._debugMesh.dispose();\r\n this._debugMesh = null;\r\n }\r\n if (this._utilityLayer) {\r\n this._utilityLayer.dispose();\r\n this._utilityLayer = null;\r\n }\r\n };\r\n return SkeletonViewer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.cubeTexture.ts\":\n/*!**************************************************!*\\\n !*** ./Engines/Extensions/engine.cubeTexture.ts ***!\n \\**************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._createDepthStencilCubeTexture = function (size, options) {\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_UNKNOWN);\r\n internalTexture.isCube = true;\r\n if (this.webGLVersion === 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Depth cube texture is not supported by WebGL 1.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n // Create the depth/stencil buffer\r\n for (var face = 0; face < 6; face++) {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH24_STENCIL8, size, size, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH_COMPONENT24, size, size, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n return internalTexture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._partialLoadFile = function (url, index, loadedFiles, onfinish, onErrorCallBack) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var onload = function (data) {\r\n loadedFiles[index] = data;\r\n loadedFiles._internalCount++;\r\n if (loadedFiles._internalCount === 6) {\r\n onfinish(loadedFiles);\r\n }\r\n };\r\n var onerror = function (request, exception) {\r\n if (onErrorCallBack && request) {\r\n onErrorCallBack(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n this._loadFile(url, onload, undefined, undefined, true, onerror);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._cascadeLoadFiles = function (scene, onfinish, files, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedFiles = [];\r\n loadedFiles._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadFile(files[index], index, loadedFiles, onfinish, onError);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._cascadeLoadImgs = function (scene, onfinish, files, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedImages = [];\r\n loadedImages._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadImg(files[index], index, loadedImages, scene, onfinish, onError);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._partialLoadImg = function (url, index, loadedImages, scene, onfinish, onErrorCallBack) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var img;\r\n var onload = function () {\r\n loadedImages[index] = img;\r\n loadedImages._internalCount++;\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n if (loadedImages._internalCount === 6) {\r\n onfinish(loadedImages);\r\n }\r\n };\r\n var onerror = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n if (onErrorCallBack) {\r\n onErrorCallBack(message, exception);\r\n }\r\n };\r\n img = _Misc_fileTools__WEBPACK_IMPORTED_MODULE_4__[\"FileTools\"].LoadImage(url, onload, onerror, scene ? scene.offlineProvider : null);\r\n if (scene) {\r\n scene._addPendingData(img);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback, excludeLoaders) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (excludeLoaders === void 0) { excludeLoaders = []; }\r\n var gl = this._gl;\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_CUBE);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n }\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n for (var _i = 0, _a = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (excludeLoaders.indexOf(availableLoader) === -1 && availableLoader.canLoad(extension, this._textureFormatInUse, fallback, false, false)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n var onInternalError = function (request, exception) {\r\n if (loader) {\r\n var fallbackUrl = loader.getFallbackTextureUrl(texture.url, _this._textureFormatInUse);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(loader.constructor.name + \" failed when trying to load \" + texture.url + \", falling back to the next supported loader\");\r\n if (fallbackUrl) {\r\n excludeLoaders.push(loader);\r\n _this.createCubeTexture(fallbackUrl, scene, files, noMipmap, onLoad, onError, format, extension, createPolynomials, lodScale, lodOffset, texture, excludeLoaders);\r\n return;\r\n }\r\n }\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n if (loader) {\r\n rootUrl = loader.transformUrl(rootUrl, this._textureFormatInUse);\r\n var onloaddata = function (data) {\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n loader.loadCubeData(data, texture, createPolynomials, onLoad, onError);\r\n };\r\n if (files && files.length === 6) {\r\n if (loader.supportCascades) {\r\n this._cascadeLoadFiles(scene, onloaddata, files, onError);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Textures type does not support cascades.\");\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(\"Texture loader does not support cascades.\");\r\n }\r\n }\r\n }\r\n else {\r\n this._loadFile(rootUrl, onloaddata, undefined, undefined, true, onInternalError);\r\n }\r\n }\r\n else {\r\n if (!files) {\r\n throw new Error(\"Cannot load cubemap because files were not defined\");\r\n }\r\n this._cascadeLoadImgs(scene, function (imgs) {\r\n var width = _this.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].GetExponentOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize) : imgs[0].width;\r\n var height = width;\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n return;\r\n }\r\n _this._workingCanvas.width = width;\r\n _this._workingCanvas.height = height;\r\n var faces = [\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X, gl.TEXTURE_CUBE_MAP_POSITIVE_Y, gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\r\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X, gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, gl.TEXTURE_CUBE_MAP_NEGATIVE_Z\r\n ];\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var internalFormat = format ? _this._getInternalFormat(format) : _this._gl.RGBA;\r\n for (var index = 0; index < faces.length; index++) {\r\n if (imgs[index].width !== width || imgs[index].height !== height) {\r\n _this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n }\r\n else {\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, imgs[index]);\r\n }\r\n }\r\n if (!noMipmap) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n _this._setCubeMapTextureParams(!noMipmap);\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n if (format) {\r\n texture.format = format;\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n }, files, onError);\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.multiRender.ts\":\n/*!**************************************************!*\\\n !*** ./Engines/Extensions/engine.multiRender.ts ***!\n \\**************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.unBindMultiColorAttachmentFramebuffer = function (textures, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n // If MSAA, we need to bitblt back to main texture\r\n var gl = this._gl;\r\n if (textures[0]._MSAAFramebuffer) {\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, textures[0]._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, textures[0]._framebuffer);\r\n var attachments = textures[0]._attachments;\r\n if (!attachments) {\r\n attachments = new Array(textures.length);\r\n textures[0]._attachments = attachments;\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n for (var j = 0; j < attachments.length; j++) {\r\n attachments[j] = gl.NONE;\r\n }\r\n attachments[i] = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n gl.readBuffer(attachments[i]);\r\n gl.drawBuffers(attachments);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n for (var i = 0; i < attachments.length; i++) {\r\n attachments[i] = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n gl.drawBuffers(attachments);\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n }\r\n if (onBeforeUnbind) {\r\n if (textures[0]._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(textures[0]._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createMultipleRenderTarget = function (size, options) {\r\n var generateMipMaps = false;\r\n var generateDepthBuffer = true;\r\n var generateStencilBuffer = false;\r\n var generateDepthTexture = false;\r\n var textureCount = 1;\r\n var defaultType = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n var defaultSamplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n var types = new Array();\r\n var samplingModes = new Array();\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps === undefined ? false : options.generateMipMaps;\r\n generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n generateStencilBuffer = options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n generateDepthTexture = options.generateDepthTexture === undefined ? false : options.generateDepthTexture;\r\n textureCount = options.textureCount || 1;\r\n if (options.types) {\r\n types = options.types;\r\n }\r\n if (options.samplingModes) {\r\n samplingModes = options.samplingModes;\r\n }\r\n }\r\n var gl = this._gl;\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var textures = [];\r\n var attachments = [];\r\n var depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);\r\n for (var i = 0; i < textureCount; i++) {\r\n var samplingMode = samplingModes[i] || defaultSamplingMode;\r\n var type = types[i] || defaultType;\r\n if (type === _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n else if (type === _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n if (type === _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_MULTIRENDERTARGET);\r\n var attachment = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n textures.push(texture);\r\n attachments.push(attachment);\r\n gl.activeTexture(gl[\"TEXTURE\" + i]);\r\n gl.bindTexture(gl.TEXTURE_2D, texture._webGLTexture);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), width, height, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n gl.framebufferTexture2D(gl.DRAW_FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture._webGLTexture, 0);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n texture._framebuffer = framebuffer;\r\n texture._depthStencilBuffer = depthStencilBuffer;\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._generateDepthBuffer = generateDepthBuffer;\r\n texture._generateStencilBuffer = generateStencilBuffer;\r\n texture._attachments = attachments;\r\n this._internalTexturesCache.push(texture);\r\n }\r\n if (generateDepthTexture && this._caps.depthTextureExtension) {\r\n // Depth texture\r\n var depthTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_MULTIRENDERTARGET);\r\n gl.activeTexture(gl.TEXTURE0);\r\n gl.bindTexture(gl.TEXTURE_2D, depthTexture._webGLTexture);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this.webGLVersion < 2 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, width, height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._webGLTexture, 0);\r\n depthTexture._framebuffer = framebuffer;\r\n depthTexture.baseWidth = width;\r\n depthTexture.baseHeight = height;\r\n depthTexture.width = width;\r\n depthTexture.height = height;\r\n depthTexture.isReady = true;\r\n depthTexture.samples = 1;\r\n depthTexture.generateMipMaps = generateMipMaps;\r\n depthTexture.samplingMode = gl.NEAREST;\r\n depthTexture._generateDepthBuffer = generateDepthBuffer;\r\n depthTexture._generateStencilBuffer = generateStencilBuffer;\r\n textures.push(depthTexture);\r\n this._internalTexturesCache.push(depthTexture);\r\n }\r\n gl.drawBuffers(attachments);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(null);\r\n this.resetTextureCache();\r\n return textures;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateMultipleRenderTargetTextureSampleCount = function (textures, samples) {\r\n if (this.webGLVersion < 2 || !textures || textures.length == 0) {\r\n return 1;\r\n }\r\n if (textures[0].samples === samples) {\r\n return samples;\r\n }\r\n var gl = this._gl;\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n // Dispose previous render buffers\r\n if (textures[0]._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(textures[0]._depthStencilBuffer);\r\n textures[0]._depthStencilBuffer = null;\r\n }\r\n if (textures[0]._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(textures[0]._MSAAFramebuffer);\r\n textures[0]._MSAAFramebuffer = null;\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n if (textures[i]._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(textures[i]._MSAARenderBuffer);\r\n textures[i]._MSAARenderBuffer = null;\r\n }\r\n }\r\n if (samples > 1) {\r\n var framebuffer = gl.createFramebuffer();\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n this._bindUnboundFramebuffer(framebuffer);\r\n var depthStencilBuffer = this._setupFramebufferDepthAttachments(textures[0]._generateStencilBuffer, textures[0]._generateDepthBuffer, textures[0].width, textures[0].height, samples);\r\n var attachments = [];\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n var attachment = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n var colorRenderbuffer = gl.createRenderbuffer();\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, colorRenderbuffer);\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, this._getRGBAMultiSampleBufferFormat(texture.type), texture.width, texture.height);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, colorRenderbuffer);\r\n texture._MSAAFramebuffer = framebuffer;\r\n texture._MSAARenderBuffer = colorRenderbuffer;\r\n texture.samples = samples;\r\n texture._depthStencilBuffer = depthStencilBuffer;\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n attachments.push(attachment);\r\n }\r\n gl.drawBuffers(attachments);\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(textures[0]._framebuffer);\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n return samples;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.multiview.ts\":\n/*!************************************************!*\\\n !*** ./Engines/Extensions/engine.multiview.ts ***!\n \\************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Materials_Textures_MultiviewRenderTarget__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Materials/Textures/MultiviewRenderTarget */ \"./Materials/Textures/MultiviewRenderTarget.ts\");\n/* harmony import */ var _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Maths/math.frustum */ \"./Maths/math.frustum.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.createMultiviewRenderTargetTexture = function (width, height) {\r\n var gl = this._gl;\r\n if (!this.getCaps().multiview) {\r\n throw \"Multiview is not supported\";\r\n }\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"].DATASOURCE_UNKNOWN, true);\r\n internalTexture.width = width;\r\n internalTexture.height = height;\r\n internalTexture._framebuffer = gl.createFramebuffer();\r\n internalTexture._colorTextureArray = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D_ARRAY, internalTexture._colorTextureArray);\r\n gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, width, height, 2);\r\n internalTexture._depthStencilTextureArray = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D_ARRAY, internalTexture._depthStencilTextureArray);\r\n gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.DEPTH32F_STENCIL8, width, height, 2);\r\n internalTexture.isReady = true;\r\n return internalTexture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.bindMultiviewFramebuffer = function (multiviewTexture) {\r\n var gl = this._gl;\r\n var ext = this.getCaps().multiview;\r\n this.bindFramebuffer(multiviewTexture, undefined, undefined, undefined, true);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, multiviewTexture._framebuffer);\r\n if (multiviewTexture._colorTextureArray && multiviewTexture._depthStencilTextureArray) {\r\n ext.framebufferTextureMultiviewOVR(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, multiviewTexture._colorTextureArray, 0, 0, 2);\r\n ext.framebufferTextureMultiviewOVR(gl.DRAW_FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, multiviewTexture._depthStencilTextureArray, 0, 0, 2);\r\n }\r\n else {\r\n throw \"Invalid multiview frame buffer\";\r\n }\r\n};\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].prototype._useMultiviewToSingleView = false;\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].prototype._multiviewTexture = null;\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].prototype._resizeOrCreateMultiviewTexture = function (width, height) {\r\n if (!this._multiviewTexture) {\r\n this._multiviewTexture = new _Materials_Textures_MultiviewRenderTarget__WEBPACK_IMPORTED_MODULE_6__[\"MultiviewRenderTarget\"](this.getScene(), { width: width, height: height });\r\n }\r\n else if (this._multiviewTexture.getRenderWidth() != width || this._multiviewTexture.getRenderHeight() != height) {\r\n this._multiviewTexture.dispose();\r\n this._multiviewTexture = new _Materials_Textures_MultiviewRenderTarget__WEBPACK_IMPORTED_MODULE_6__[\"MultiviewRenderTarget\"](this.getScene(), { width: width, height: height });\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._transformMatrixR = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Zero();\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._multiviewSceneUbo = null;\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._createMultiviewUbo = function () {\r\n this._multiviewSceneUbo = new _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__[\"UniformBuffer\"](this.getEngine(), undefined, true);\r\n this._multiviewSceneUbo.addUniform(\"viewProjection\", 16);\r\n this._multiviewSceneUbo.addUniform(\"viewProjectionR\", 16);\r\n this._multiviewSceneUbo.addUniform(\"view\", 16);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._updateMultiviewUbo = function (viewR, projectionR) {\r\n if (viewR && projectionR) {\r\n viewR.multiplyToRef(projectionR, this._transformMatrixR);\r\n }\r\n if (viewR && projectionR) {\r\n viewR.multiplyToRef(projectionR, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Matrix[0]);\r\n _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_7__[\"Frustum\"].GetRightPlaneToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Matrix[0], this._frustumPlanes[3]); // Replace right plane by second camera right plane\r\n }\r\n if (this._multiviewSceneUbo) {\r\n this._multiviewSceneUbo.updateMatrix(\"viewProjection\", this.getTransformMatrix());\r\n this._multiviewSceneUbo.updateMatrix(\"viewProjectionR\", this._transformMatrixR);\r\n this._multiviewSceneUbo.updateMatrix(\"view\", this._viewMatrix);\r\n this._multiviewSceneUbo.update();\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._renderMultiviewToSingleView = function (camera) {\r\n // Multiview is only able to be displayed directly for API's such as webXR\r\n // This displays a multiview image by rendering to the multiview image and then\r\n // copying the result into the sub cameras instead of rendering them and proceeding as normal from there\r\n // Render to a multiview texture\r\n camera._resizeOrCreateMultiviewTexture((camera._rigPostProcess && camera._rigPostProcess && camera._rigPostProcess.width > 0) ? camera._rigPostProcess.width / 2 : this.getEngine().getRenderWidth(true) / 2, (camera._rigPostProcess && camera._rigPostProcess && camera._rigPostProcess.height > 0) ? camera._rigPostProcess.height : this.getEngine().getRenderHeight(true));\r\n if (!this._multiviewSceneUbo) {\r\n this._createMultiviewUbo();\r\n }\r\n camera.outputRenderTarget = camera._multiviewTexture;\r\n this._renderForCamera(camera);\r\n camera.outputRenderTarget = null;\r\n // Consume the multiview texture through a shader for each eye\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n var engine = this.getEngine();\r\n this._activeCamera = camera._rigCameras[index];\r\n engine.setViewport(this._activeCamera.viewport);\r\n if (this.postProcessManager) {\r\n this.postProcessManager._prepareFrame();\r\n this.postProcessManager._finalizeFrame(this._activeCamera.isIntermediate);\r\n }\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.occlusionQuery.ts\":\n/*!*****************************************************!*\\\n !*** ./Engines/Extensions/engine.occlusionQuery.ts ***!\n \\*****************************************************/\n/*! exports provided: _OcclusionDataStorage */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _OcclusionDataStorage; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Instrumentation_timeToken__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Instrumentation/timeToken */ \"./Instrumentation/timeToken.ts\");\n\r\n\r\n\r\n/** @hidden */\r\nvar _OcclusionDataStorage = /** @class */ (function () {\r\n function _OcclusionDataStorage() {\r\n /** @hidden */\r\n this.occlusionInternalRetryCounter = 0;\r\n /** @hidden */\r\n this.isOcclusionQueryInProgress = false;\r\n /** @hidden */\r\n this.isOccluded = false;\r\n /** @hidden */\r\n this.occlusionRetryCount = -1;\r\n /** @hidden */\r\n this.occlusionType = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_TYPE_NONE;\r\n /** @hidden */\r\n this.occlusionQueryAlgorithmType = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n }\r\n return _OcclusionDataStorage;\r\n}());\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createQuery = function () {\r\n return this._gl.createQuery();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.deleteQuery = function (query) {\r\n this._gl.deleteQuery(query);\r\n return this;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.isQueryResultAvailable = function (query) {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.getQueryResult = function (query) {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.beginOcclusionQuery = function (algorithmType, query) {\r\n var glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.beginQuery(glAlgorithm, query);\r\n return this;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.endOcclusionQuery = function (algorithmType) {\r\n var glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.endQuery(glAlgorithm);\r\n return this;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._createTimeQuery = function () {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.createQueryEXT) {\r\n return timerQuery.createQueryEXT();\r\n }\r\n return this.createQuery();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._deleteTimeQuery = function (query) {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.deleteQueryEXT) {\r\n timerQuery.deleteQueryEXT(query);\r\n return;\r\n }\r\n this.deleteQuery(query);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getTimeQueryResult = function (query) {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_EXT);\r\n }\r\n return this.getQueryResult(query);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getTimeQueryAvailability = function (query) {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_AVAILABLE_EXT);\r\n }\r\n return this.isQueryResultAvailable(query);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.startTimeQuery = function () {\r\n var caps = this.getCaps();\r\n var timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n var token = new _Instrumentation_timeToken__WEBPACK_IMPORTED_MODULE_2__[\"_TimeToken\"]();\r\n this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n if (caps.canUseTimestampForTimerQuery) {\r\n token._startTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n else {\r\n if (this._currentNonTimestampToken) {\r\n return this._currentNonTimestampToken;\r\n }\r\n token._timeElapsedQuery = this._createTimeQuery();\r\n if (timerQuery.beginQueryEXT) {\r\n timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n else {\r\n this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n this._currentNonTimestampToken = token;\r\n }\r\n return token;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.endTimeQuery = function (token) {\r\n var caps = this.getCaps();\r\n var timerQuery = caps.timerQuery;\r\n if (!timerQuery || !token) {\r\n return -1;\r\n }\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery) {\r\n return -1;\r\n }\r\n if (!token._endTimeQuery) {\r\n token._endTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._endTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n }\r\n else if (!token._timeElapsedQueryEnded) {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n if (timerQuery.endQueryEXT) {\r\n timerQuery.endQueryEXT(timerQuery.TIME_ELAPSED_EXT);\r\n }\r\n else {\r\n this._gl.endQuery(timerQuery.TIME_ELAPSED_EXT);\r\n }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n var disjoint = this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n var available = false;\r\n if (token._endTimeQuery) {\r\n available = this._getTimeQueryAvailability(token._endTimeQuery);\r\n }\r\n else if (token._timeElapsedQuery) {\r\n available = this._getTimeQueryAvailability(token._timeElapsedQuery);\r\n }\r\n if (available && !disjoint) {\r\n var result = 0;\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery || !token._endTimeQuery) {\r\n return -1;\r\n }\r\n var timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n var timeEnd = this._getTimeQueryResult(token._endTimeQuery);\r\n result = timeEnd - timeStart;\r\n this._deleteTimeQuery(token._startTimeQuery);\r\n this._deleteTimeQuery(token._endTimeQuery);\r\n token._startTimeQuery = null;\r\n token._endTimeQuery = null;\r\n }\r\n else {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n result = this._getTimeQueryResult(token._timeElapsedQuery);\r\n this._deleteTimeQuery(token._timeElapsedQuery);\r\n token._timeElapsedQuery = null;\r\n token._timeElapsedQueryEnded = false;\r\n this._currentNonTimestampToken = null;\r\n }\r\n return result;\r\n }\r\n return -1;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getGlAlgorithmType = function (algorithmType) {\r\n return algorithmType === _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"isOcclusionQueryInProgress\", {\r\n get: function () {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"_occlusionDataStorage\", {\r\n get: function () {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"isOccluded\", {\r\n get: function () {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function () {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"occlusionType\", {\r\n get: function () {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"occlusionRetryCount\", {\r\n get: function () {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype._checkOcclusionQuery = function () {\r\n var dataStorage = this._occlusionDataStorage;\r\n if (dataStorage.occlusionType === _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n var engine = this.getEngine();\r\n if (engine.webGLVersion < 2) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery) {\r\n var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult === 1 ? false : true;\r\n }\r\n else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n }\r\n var scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n if (!this._occlusionQuery) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery);\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n return dataStorage.isOccluded;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.rawTexture.ts\":\n/*!*************************************************!*\\\n !*** ./Engines/Extensions/engine.rawTexture.ts ***!\n \\*************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateRawTexture = function (texture, data, format, invertY, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format);\r\n // Babylon's internalFormat but gl's texImage2D format\r\n var internalFormat = this._getInternalFormat(format);\r\n var textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);\r\n }\r\n else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_RAW);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n this.updateRawTexture(texture, data, format, invertY, compression, type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n var gl = this._gl;\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_CUBERAW);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n var width = size;\r\n var height = width;\r\n texture.width = width;\r\n texture.height = height;\r\n // Double check on POT to generate Mips.\r\n var isPot = !this.needPOTTextures || (_Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.width) && _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n texture.generateMipMaps = generateMipMaps;\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateRawCubeTexture = function (texture, data, format, type, invertY, compression, level) {\r\n if (compression === void 0) { compression = null; }\r\n if (level === void 0) { level = 0; }\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var faceData = data[faceIndex];\r\n if (compression) {\r\n gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, (this.getCaps().s3tc)[compression], texture.width, texture.height, 0, faceData);\r\n }\r\n else {\r\n if (needConversion) {\r\n faceData = this._convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n var isPot = !this.needPOTTextures || (_Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.width) && _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad, onError, samplingMode, invertY) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (invertY === void 0) { invertY = false; }\r\n var gl = this._gl;\r\n var texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode);\r\n scene._addPendingData(texture);\r\n texture.url = url;\r\n this._internalTexturesCache.push(texture);\r\n var onerror = function (request, exception) {\r\n scene._removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n var internalCallback = function (data) {\r\n var width = texture.width;\r\n var faceDataArrays = callback(data);\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n if (mipmapGenerator) {\r\n var textureType = _this._getWebGLTextureType(type);\r\n var internalFormat = _this._getInternalFormat(format);\r\n var internalSizedFomat = _this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var mipData = mipmapGenerator(faceDataArrays);\r\n for (var level = 0; level < mipData.length; level++) {\r\n var mipSize = width >> level;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _this._convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n _this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene._removePendingData(texture);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n this._loadFile(url, function (data) {\r\n internalCallback(data);\r\n }, undefined, scene.offlineProvider, true, onerror);\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_RAW3D);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.is3D = true;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(this._gl.TEXTURE_3D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_3D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_3D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateRawTexture3D = function (texture, data, format, invertY, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var internalType = this._getWebGLTextureType(textureType);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(this._gl.TEXTURE_3D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, texture.depth, 0, data);\r\n }\r\n else {\r\n this._gl.texImage3D(this._gl.TEXTURE_3D, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_3D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.renderTarget.ts\":\n/*!***************************************************!*\\\n !*** ./Engines/Extensions/engine.renderTarget.ts ***!\n \\***************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.createRenderTargetCubeTexture = function (size, options) {\r\n var fullOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ generateMipMaps: true, generateDepthBuffer: true, generateStencilBuffer: false, type: _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT, samplingMode: _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE, format: _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTUREFORMAT_RGBA }, options);\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;\r\n if (fullOptions.type === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n else if (fullOptions.type === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n var gl = this._gl;\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);\r\n if (fullOptions.type === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n fullOptions.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(\"Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type\");\r\n }\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n for (var face = 0; face < 6; face++) {\r\n gl.texImage2D((gl.TEXTURE_CUBE_MAP_POSITIVE_X + face), 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);\r\n }\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);\r\n // MipMaps\r\n if (fullOptions.generateMipMaps) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(null);\r\n texture._framebuffer = framebuffer;\r\n texture.width = size;\r\n texture.height = size;\r\n texture.isReady = true;\r\n texture.isCube = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.transformFeedback.ts\":\n/*!********************************************************!*\\\n !*** ./Engines/Extensions/engine.transformFeedback.ts ***!\n \\********************************************************/\n/*! exports provided: _forceTransformFeedbackToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _forceTransformFeedbackToBundle; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/** @hidden */\r\nvar _forceTransformFeedbackToBundle = true;\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createTransformFeedback = function () {\r\n return this._gl.createTransformFeedback();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.deleteTransformFeedback = function (value) {\r\n this._gl.deleteTransformFeedback(value);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.bindTransformFeedback = function (value) {\r\n this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.beginTransformFeedback = function (usePoints) {\r\n if (usePoints === void 0) { usePoints = true; }\r\n this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.endTransformFeedback = function () {\r\n this._gl.endTransformFeedback();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.setTranformFeedbackVaryings = function (program, value) {\r\n this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.bindTransformFeedbackBuffer = function (value) {\r\n this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value ? value.underlyingResource : null);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.webVR.ts\":\n/*!********************************************!*\\\n !*** ./Engines/Extensions/engine.webVR.ts ***!\n \\********************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.size */ \"./Maths/math.size.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/domManagement */ \"./Misc/domManagement.ts\");\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype, \"isInVRExclusivePointerMode\", {\r\n get: function () {\r\n return this._vrExclusivePointerMode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._prepareVRComponent = function () {\r\n this._vrSupported = false;\r\n this._vrExclusivePointerMode = false;\r\n this.onVRDisplayChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this.onVRRequestPresentComplete = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this.onVRRequestPresentStart = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.isVRDevicePresent = function () {\r\n return !!this._vrDisplay;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.getVRDevice = function () {\r\n return this._vrDisplay;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.initWebVR = function () {\r\n this.initWebVRAsync();\r\n return this.onVRDisplayChangedObservable;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.initWebVRAsync = function () {\r\n var _this = this;\r\n var notifyObservers = function () {\r\n var eventArgs = {\r\n vrDisplay: _this._vrDisplay,\r\n vrSupported: _this._vrSupported\r\n };\r\n _this.onVRDisplayChangedObservable.notifyObservers(eventArgs);\r\n _this._webVRInitPromise = new Promise(function (res) { res(eventArgs); });\r\n };\r\n if (!this._onVrDisplayConnect) {\r\n this._onVrDisplayConnect = function (event) {\r\n _this._vrDisplay = event.display;\r\n notifyObservers();\r\n };\r\n this._onVrDisplayDisconnect = function () {\r\n _this._vrDisplay.cancelAnimationFrame(_this._frameHandler);\r\n _this._vrDisplay = undefined;\r\n _this._frameHandler = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].QueueNewFrame(_this._bindedRenderFunction);\r\n notifyObservers();\r\n };\r\n this._onVrDisplayPresentChange = function () {\r\n _this._vrExclusivePointerMode = _this._vrDisplay && _this._vrDisplay.isPresenting;\r\n };\r\n var hostWindow = this.getHostWindow();\r\n hostWindow.addEventListener('vrdisplayconnect', this._onVrDisplayConnect);\r\n hostWindow.addEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);\r\n hostWindow.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n }\r\n this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync();\r\n this._webVRInitPromise.then(notifyObservers);\r\n return this._webVRInitPromise;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getVRDisplaysAsync = function () {\r\n var _this = this;\r\n return new Promise(function (res) {\r\n if (navigator.getVRDisplays) {\r\n navigator.getVRDisplays().then(function (devices) {\r\n _this._vrSupported = true;\r\n // note that devices may actually be an empty array. This is fine;\r\n // we expect this._vrDisplay to be undefined in this case.\r\n _this._vrDisplay = devices[0];\r\n res({\r\n vrDisplay: _this._vrDisplay,\r\n vrSupported: _this._vrSupported\r\n });\r\n });\r\n }\r\n else {\r\n _this._vrDisplay = undefined;\r\n _this._vrSupported = false;\r\n res({\r\n vrDisplay: _this._vrDisplay,\r\n vrSupported: _this._vrSupported\r\n });\r\n }\r\n });\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.enableVR = function () {\r\n var _this = this;\r\n if (this._vrDisplay && !this._vrDisplay.isPresenting) {\r\n var onResolved = function () {\r\n _this.onVRRequestPresentComplete.notifyObservers(true);\r\n _this._onVRFullScreenTriggered();\r\n };\r\n var onRejected = function () {\r\n _this.onVRRequestPresentComplete.notifyObservers(false);\r\n };\r\n this.onVRRequestPresentStart.notifyObservers(this);\r\n this._vrDisplay.requestPresent([{ source: this.getRenderingCanvas() }]).then(onResolved).catch(onRejected);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._onVRFullScreenTriggered = function () {\r\n if (this._vrDisplay && this._vrDisplay.isPresenting) {\r\n //get the old size before we change\r\n this._oldSize = new _Maths_math_size__WEBPACK_IMPORTED_MODULE_1__[\"Size\"](this.getRenderWidth(), this.getRenderHeight());\r\n this._oldHardwareScaleFactor = this.getHardwareScalingLevel();\r\n //get the width and height, change the render size\r\n var leftEye = this._vrDisplay.getEyeParameters('left');\r\n this.setHardwareScalingLevel(1);\r\n this.setSize(leftEye.renderWidth * 2, leftEye.renderHeight);\r\n }\r\n else {\r\n this.setHardwareScalingLevel(this._oldHardwareScaleFactor);\r\n this.setSize(this._oldSize.width, this._oldSize.height);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.disableVR = function () {\r\n var _this = this;\r\n if (this._vrDisplay && this._vrDisplay.isPresenting) {\r\n this._vrDisplay.exitPresent()\r\n .then(function () { return _this._onVRFullScreenTriggered(); })\r\n .catch(function () { return _this._onVRFullScreenTriggered(); });\r\n }\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_4__[\"DomManagement\"].IsWindowObjectExist()) {\r\n window.removeEventListener('vrdisplaypointerrestricted', this._onVRDisplayPointerRestricted);\r\n window.removeEventListener('vrdisplaypointerunrestricted', this._onVRDisplayPointerUnrestricted);\r\n if (this._onVrDisplayConnect) {\r\n window.removeEventListener('vrdisplayconnect', this._onVrDisplayConnect);\r\n if (this._onVrDisplayDisconnect) {\r\n window.removeEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);\r\n }\r\n if (this._onVrDisplayPresentChange) {\r\n window.removeEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n }\r\n this._onVrDisplayConnect = null;\r\n this._onVrDisplayDisconnect = null;\r\n }\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._connectVREvents = function (canvas, document) {\r\n this._onVRDisplayPointerRestricted = function () {\r\n if (canvas) {\r\n canvas.requestPointerLock();\r\n }\r\n };\r\n this._onVRDisplayPointerUnrestricted = function () {\r\n if (!document.exitPointerLock) {\r\n return;\r\n }\r\n document.exitPointerLock();\r\n };\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_4__[\"DomManagement\"].IsWindowObjectExist()) {\r\n var hostWindow = this.getHostWindow();\r\n hostWindow.addEventListener('vrdisplaypointerrestricted', this._onVRDisplayPointerRestricted, false);\r\n hostWindow.addEventListener('vrdisplaypointerunrestricted', this._onVRDisplayPointerUnrestricted, false);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._submitVRFrame = function () {\r\n // Submit frame to the vr device, if enabled\r\n if (this._vrDisplay && this._vrDisplay.isPresenting) {\r\n // TODO: We should only submit the frame if we read frameData successfully.\r\n try {\r\n this._vrDisplay.submitFrame();\r\n }\r\n catch (e) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].Warn(\"webVR submitFrame has had an unexpected failure: \" + e);\r\n }\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.isVRPresenting = function () {\r\n return this._vrDisplay && this._vrDisplay.isPresenting;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._requestVRFrame = function () {\r\n this._frameHandler = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].QueueNewFrame(this._bindedRenderFunction, this._vrDisplay);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/index.ts\":\n/*!*************************************!*\\\n !*** ./Engines/Extensions/index.ts ***!\n \\*************************************/\n/*! exports provided: _OcclusionDataStorage, _forceTransformFeedbackToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _engine_occlusionQuery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.occlusionQuery */ \"./Engines/Extensions/engine.occlusionQuery.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _engine_occlusionQuery__WEBPACK_IMPORTED_MODULE_0__[\"_OcclusionDataStorage\"]; });\n\n/* harmony import */ var _engine_transformFeedback__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.transformFeedback */ \"./Engines/Extensions/engine.transformFeedback.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _engine_transformFeedback__WEBPACK_IMPORTED_MODULE_1__[\"_forceTransformFeedbackToBundle\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Native/nativeShaderProcessor.ts\":\n/*!*************************************************!*\\\n !*** ./Engines/Native/nativeShaderProcessor.ts ***!\n \\*************************************************/\n/*! exports provided: NativeShaderProcessor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NativeShaderProcessor\", function() { return NativeShaderProcessor; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../WebGL/webGL2ShaderProcessors */ \"./Engines/WebGL/webGL2ShaderProcessors.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\nvar _a;\r\n\r\n\r\n\r\n// These numbers must match the values for bgfx::Attrib::Enum\r\nvar attributeLocations = (_a = {},\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind] = 0,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind] = 1,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].TangentKind] = 2,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind] = 4,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].MatricesIndicesKind] = 8,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].MatricesWeightsKind] = 9,\r\n _a);\r\n// Must match bgfx::Attrib::TexCoord0\r\nvar firstGenericAttributeLocation = 10;\r\n// Must match bgfx::Attrib::TexCoord7\r\nvar lastGenericAttributeLocation = 17;\r\n/** @hidden */\r\nvar NativeShaderProcessor = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NativeShaderProcessor, _super);\r\n function NativeShaderProcessor() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n NativeShaderProcessor.prototype.lineProcessor = function (line) {\r\n for (var _i = 0, _a = this._replacements; _i < _a.length; _i++) {\r\n var replacement = _a[_i];\r\n line = line.replace(replacement.searchValue, replacement.replaceValue);\r\n }\r\n return line;\r\n };\r\n NativeShaderProcessor.prototype.attributeProcessor = function (attribute) {\r\n var match = attribute.match(/attribute\\s+[^\\s]+\\s+([^\\s]+)\\s*(?:\\[.+\\])?\\s*;/);\r\n var name = match[1];\r\n var location = attributeLocations[name];\r\n if (location === undefined) {\r\n location = this._genericAttributeLocation++;\r\n if (location > lastGenericAttributeLocation) {\r\n throw new Error(\"Exceeded maximum custom attributes\");\r\n }\r\n }\r\n return \"layout(location=\" + location + \") \" + _super.prototype.attributeProcessor.call(this, attribute);\r\n };\r\n NativeShaderProcessor.prototype.varyingProcessor = function (varying, isFragment) {\r\n var location;\r\n if (isFragment) {\r\n location = this._varyingLocationMap[varying];\r\n }\r\n else {\r\n location = this._varyingLocationCount++;\r\n this._varyingLocationMap[varying] = location;\r\n }\r\n return \"layout(location=\" + location + \") \" + _super.prototype.varyingProcessor.call(this, varying, isFragment);\r\n };\r\n NativeShaderProcessor.prototype.uniformProcessor = function (uniform) {\r\n var match = uniform.match(/uniform\\s+([^\\s]+)\\s+([^\\s]+)\\s*(?:\\[.+\\])?\\s*;/);\r\n var type = match[1];\r\n var name = match[2];\r\n switch (type) {\r\n case \"sampler2D\":\r\n case \"samplerCube\": {\r\n var suffix = type.substr(7);\r\n var binding = this._textureCount++;\r\n this._replacements.push({ searchValue: new RegExp(\"\\\\b\" + name + \"\\\\b\"), replaceValue: \"sampler\" + suffix + \"(\" + name + \"Texture, \" + name + \")\" });\r\n return \"layout(binding=\" + binding + \") uniform texture\" + suffix + \" \" + name + \"Texture;\\nlayout(binding=\" + binding + \") uniform sampler \" + name + \";\";\r\n }\r\n }\r\n this._uniforms.push(uniform);\r\n return this._uniforms.length === 1 ? \"\" : \"\";\r\n };\r\n NativeShaderProcessor.prototype.preProcessor = function (code, defines, isFragment) {\r\n this._genericAttributeLocation = firstGenericAttributeLocation;\r\n if (!isFragment) {\r\n this._varyingLocationCount = 0;\r\n this._varyingLocationMap = {};\r\n }\r\n this._replacements = [];\r\n this._textureCount = 0;\r\n this._uniforms = [];\r\n return code;\r\n };\r\n NativeShaderProcessor.prototype.postProcessor = function (code, defines, isFragment) {\r\n code = _super.prototype.postProcessor.call(this, code, defines, isFragment);\r\n code = code.replace(\"\", \"uniform Frame {\\n\" + this._uniforms.join(\"\\n\") + \"\\n};\");\r\n code = code.replace(\"out vec4 glFragColor\", \"layout(location=0) out vec4 glFragColor\");\r\n return code;\r\n };\r\n return NativeShaderProcessor;\r\n}(_WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_1__[\"WebGL2ShaderProcessor\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineAndOperator.ts\":\n/*!*****************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineAndOperator.ts ***!\n \\*****************************************************************************/\n/*! exports provided: ShaderDefineAndOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineAndOperator\", function() { return ShaderDefineAndOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineAndOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineAndOperator, _super);\r\n function ShaderDefineAndOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineAndOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) && this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineAndOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.ts\":\n/*!************************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.ts ***!\n \\************************************************************************************/\n/*! exports provided: ShaderDefineArithmeticOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineArithmeticOperator\", function() { return ShaderDefineArithmeticOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineArithmeticOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineArithmeticOperator, _super);\r\n function ShaderDefineArithmeticOperator(define, operand, testValue) {\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.operand = operand;\r\n _this.testValue = testValue;\r\n return _this;\r\n }\r\n ShaderDefineArithmeticOperator.prototype.isTrue = function (preprocessors) {\r\n var value = preprocessors[this.define];\r\n if (value === undefined) {\r\n return false;\r\n }\r\n var condition = false;\r\n var left = parseInt(value);\r\n var right = parseInt(this.testValue);\r\n switch (this.operand) {\r\n case \">\":\r\n condition = left > right;\r\n break;\r\n case \"<\":\r\n condition = left < right;\r\n break;\r\n case \"<=\":\r\n condition = left <= right;\r\n break;\r\n case \">=\":\r\n condition = left >= right;\r\n break;\r\n case \"==\":\r\n condition = left === right;\r\n break;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineArithmeticOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.ts\":\n/*!***********************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.ts ***!\n \\***********************************************************************************/\n/*! exports provided: ShaderDefineIsDefinedOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineIsDefinedOperator\", function() { return ShaderDefineIsDefinedOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineIsDefinedOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineIsDefinedOperator, _super);\r\n function ShaderDefineIsDefinedOperator(define, not) {\r\n if (not === void 0) { not = false; }\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.not = not;\r\n return _this;\r\n }\r\n ShaderDefineIsDefinedOperator.prototype.isTrue = function (preprocessors) {\r\n var condition = preprocessors[this.define] !== undefined;\r\n if (this.not) {\r\n condition = !condition;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineIsDefinedOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineOrOperator.ts\":\n/*!****************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineOrOperator.ts ***!\n \\****************************************************************************/\n/*! exports provided: ShaderDefineOrOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineOrOperator\", function() { return ShaderDefineOrOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineOrOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineOrOperator, _super);\r\n function ShaderDefineOrOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineOrOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) || this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineOrOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\":\n/*!******************************************************************!*\\\n !*** ./Engines/Processors/Expressions/shaderDefineExpression.ts ***!\n \\******************************************************************/\n/*! exports provided: ShaderDefineExpression */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineExpression\", function() { return ShaderDefineExpression; });\n/** @hidden */\r\nvar ShaderDefineExpression = /** @class */ (function () {\r\n function ShaderDefineExpression() {\r\n }\r\n ShaderDefineExpression.prototype.isTrue = function (preprocessors) {\r\n return true;\r\n };\r\n return ShaderDefineExpression;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeConditionNode.ts\":\n/*!*******************************************************!*\\\n !*** ./Engines/Processors/shaderCodeConditionNode.ts ***!\n \\*******************************************************/\n/*! exports provided: ShaderCodeConditionNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeConditionNode\", function() { return ShaderCodeConditionNode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shaderCodeNode */ \"./Engines/Processors/shaderCodeNode.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderCodeConditionNode = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderCodeConditionNode, _super);\r\n function ShaderCodeConditionNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeConditionNode.prototype.process = function (preprocessors, options) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n var node = this.children[index];\r\n if (node.isValid(preprocessors)) {\r\n return node.process(preprocessors, options);\r\n }\r\n }\r\n return \"\";\r\n };\r\n return ShaderCodeConditionNode;\r\n}(_shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__[\"ShaderCodeNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeCursor.ts\":\n/*!************************************************!*\\\n !*** ./Engines/Processors/shaderCodeCursor.ts ***!\n \\************************************************/\n/*! exports provided: ShaderCodeCursor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeCursor\", function() { return ShaderCodeCursor; });\n/** @hidden */\r\nvar ShaderCodeCursor = /** @class */ (function () {\r\n function ShaderCodeCursor() {\r\n }\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"currentLine\", {\r\n get: function () {\r\n return this._lines[this.lineIndex];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"canRead\", {\r\n get: function () {\r\n return this.lineIndex < this._lines.length - 1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"lines\", {\r\n set: function (value) {\r\n this._lines = [];\r\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\r\n var line = value_1[_i];\r\n // Prevent removing line break in macros.\r\n if (line[0] === \"#\") {\r\n this._lines.push(line);\r\n continue;\r\n }\r\n var split = line.split(\";\");\r\n for (var index = 0; index < split.length; index++) {\r\n var subLine = split[index];\r\n subLine = subLine.trim();\r\n if (!subLine) {\r\n continue;\r\n }\r\n this._lines.push(subLine + (index !== split.length - 1 ? \";\" : \"\"));\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ShaderCodeCursor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeNode.ts\":\n/*!**********************************************!*\\\n !*** ./Engines/Processors/shaderCodeNode.ts ***!\n \\**********************************************/\n/*! exports provided: ShaderCodeNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeNode\", function() { return ShaderCodeNode; });\n/* harmony import */ var _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/stringTools */ \"./Misc/stringTools.ts\");\n\r\n/** @hidden */\r\nvar ShaderCodeNode = /** @class */ (function () {\r\n function ShaderCodeNode() {\r\n this.children = [];\r\n }\r\n ShaderCodeNode.prototype.isValid = function (preprocessors) {\r\n return true;\r\n };\r\n ShaderCodeNode.prototype.process = function (preprocessors, options) {\r\n var result = \"\";\r\n if (this.line) {\r\n var value = this.line;\r\n var processor = options.processor;\r\n if (processor) {\r\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\r\n if (processor.lineProcessor) {\r\n value = processor.lineProcessor(value, options.isFragment);\r\n }\r\n if (processor.attributeProcessor && _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__[\"StringTools\"].StartsWith(this.line, \"attribute\")) {\r\n value = processor.attributeProcessor(this.line);\r\n }\r\n else if (processor.varyingProcessor && _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__[\"StringTools\"].StartsWith(this.line, \"varying\")) {\r\n value = processor.varyingProcessor(this.line, options.isFragment);\r\n }\r\n else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__[\"StringTools\"].StartsWith(this.line, \"uniform\")) {\r\n var regex = /uniform (.+) (.+)/;\r\n if (regex.test(this.line)) { // uniform\r\n if (processor.uniformProcessor) {\r\n value = processor.uniformProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n else { // Uniform buffer\r\n if (processor.uniformBufferProcessor) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n }\r\n }\r\n if (processor.endOfUniformBufferProcessor) {\r\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\r\n options.lookForClosingBracketForUniformBuffer = false;\r\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n }\r\n result += value + \"\\r\\n\";\r\n }\r\n this.children.forEach(function (child) {\r\n result += child.process(preprocessors, options);\r\n });\r\n if (this.additionalDefineKey) {\r\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\r\n }\r\n return result;\r\n };\r\n return ShaderCodeNode;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeTestNode.ts\":\n/*!**************************************************!*\\\n !*** ./Engines/Processors/shaderCodeTestNode.ts ***!\n \\**************************************************/\n/*! exports provided: ShaderCodeTestNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeTestNode\", function() { return ShaderCodeTestNode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shaderCodeNode */ \"./Engines/Processors/shaderCodeNode.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderCodeTestNode = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderCodeTestNode, _super);\r\n function ShaderCodeTestNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeTestNode.prototype.isValid = function (preprocessors) {\r\n return this.testExpression.isTrue(preprocessors);\r\n };\r\n return ShaderCodeTestNode;\r\n}(_shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__[\"ShaderCodeNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderProcessor.ts\":\n/*!***********************************************!*\\\n !*** ./Engines/Processors/shaderProcessor.ts ***!\n \\***********************************************/\n/*! exports provided: ShaderProcessor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderProcessor\", function() { return ShaderProcessor; });\n/* harmony import */ var _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shaderCodeNode */ \"./Engines/Processors/shaderCodeNode.ts\");\n/* harmony import */ var _shaderCodeCursor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shaderCodeCursor */ \"./Engines/Processors/shaderCodeCursor.ts\");\n/* harmony import */ var _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shaderCodeConditionNode */ \"./Engines/Processors/shaderCodeConditionNode.ts\");\n/* harmony import */ var _shaderCodeTestNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shaderCodeTestNode */ \"./Engines/Processors/shaderCodeTestNode.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineIsDefinedOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineOrOperator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineOrOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineOrOperator.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineAndOperator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineAndOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineAndOperator.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineArithmeticOperator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineArithmeticOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar ShaderProcessor = /** @class */ (function () {\r\n function ShaderProcessor() {\r\n }\r\n ShaderProcessor.Process = function (sourceCode, options, callback) {\r\n var _this = this;\r\n this._ProcessIncludes(sourceCode, options, function (codeWithIncludes) {\r\n var migratedCode = _this._ProcessShaderConversion(codeWithIncludes, options);\r\n callback(migratedCode);\r\n });\r\n };\r\n ShaderProcessor._ProcessPrecision = function (source, options) {\r\n var shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\r\n if (source.indexOf(\"precision highp float\") === -1) {\r\n if (!shouldUseHighPrecisionShader) {\r\n source = \"precision mediump float;\\n\" + source;\r\n }\r\n else {\r\n source = \"precision highp float;\\n\" + source;\r\n }\r\n }\r\n else {\r\n if (!shouldUseHighPrecisionShader) { // Moving highp to mediump\r\n source = source.replace(\"precision highp float\", \"precision mediump float\");\r\n }\r\n }\r\n return source;\r\n };\r\n ShaderProcessor._ExtractOperation = function (expression) {\r\n var regex = /defined\\((.+)\\)/;\r\n var match = regex.exec(expression);\r\n if (match && match.length) {\r\n return new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](match[1].trim(), expression[0] === \"!\");\r\n }\r\n var operators = [\"==\", \">=\", \"<=\", \"<\", \">\"];\r\n var operator = \"\";\r\n var indexOperator = 0;\r\n for (var _i = 0, operators_1 = operators; _i < operators_1.length; _i++) {\r\n operator = operators_1[_i];\r\n indexOperator = expression.indexOf(operator);\r\n if (indexOperator > -1) {\r\n break;\r\n }\r\n }\r\n if (indexOperator === -1) {\r\n return new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](expression);\r\n }\r\n var define = expression.substring(0, indexOperator).trim();\r\n var value = expression.substring(indexOperator + operator.length).trim();\r\n return new _Expressions_Operators_shaderDefineArithmeticOperator__WEBPACK_IMPORTED_MODULE_7__[\"ShaderDefineArithmeticOperator\"](define, operator, value);\r\n };\r\n ShaderProcessor._BuildSubExpression = function (expression) {\r\n var indexOr = expression.indexOf(\"||\");\r\n if (indexOr === -1) {\r\n var indexAnd = expression.indexOf(\"&&\");\r\n if (indexAnd > -1) {\r\n var andOperator = new _Expressions_Operators_shaderDefineAndOperator__WEBPACK_IMPORTED_MODULE_6__[\"ShaderDefineAndOperator\"]();\r\n var leftPart = expression.substring(0, indexAnd).trim();\r\n var rightPart = expression.substring(indexAnd + 2).trim();\r\n andOperator.leftOperand = this._BuildSubExpression(leftPart);\r\n andOperator.rightOperand = this._BuildSubExpression(rightPart);\r\n return andOperator;\r\n }\r\n else {\r\n return this._ExtractOperation(expression);\r\n }\r\n }\r\n else {\r\n var orOperator = new _Expressions_Operators_shaderDefineOrOperator__WEBPACK_IMPORTED_MODULE_5__[\"ShaderDefineOrOperator\"]();\r\n var leftPart = expression.substring(0, indexOr).trim();\r\n var rightPart = expression.substring(indexOr + 2).trim();\r\n orOperator.leftOperand = this._BuildSubExpression(leftPart);\r\n orOperator.rightOperand = this._BuildSubExpression(rightPart);\r\n return orOperator;\r\n }\r\n };\r\n ShaderProcessor._BuildExpression = function (line, start) {\r\n var node = new _shaderCodeTestNode__WEBPACK_IMPORTED_MODULE_3__[\"ShaderCodeTestNode\"]();\r\n var command = line.substring(0, start);\r\n var expression = line.substring(start).trim();\r\n if (command === \"#ifdef\") {\r\n node.testExpression = new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](expression);\r\n }\r\n else if (command === \"#ifndef\") {\r\n node.testExpression = new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](expression, true);\r\n }\r\n else {\r\n node.testExpression = this._BuildSubExpression(expression);\r\n }\r\n return node;\r\n };\r\n ShaderProcessor._MoveCursorWithinIf = function (cursor, rootNode, ifNode) {\r\n var line = cursor.currentLine;\r\n while (this._MoveCursor(cursor, ifNode)) {\r\n line = cursor.currentLine;\r\n var first5 = line.substring(0, 5).toLowerCase();\r\n if (first5 === \"#else\") {\r\n var elseNode = new _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__[\"ShaderCodeNode\"]();\r\n rootNode.children.push(elseNode);\r\n this._MoveCursor(cursor, elseNode);\r\n return;\r\n }\r\n else if (first5 === \"#elif\") {\r\n var elifNode = this._BuildExpression(line, 5);\r\n rootNode.children.push(elifNode);\r\n ifNode = elifNode;\r\n }\r\n }\r\n };\r\n ShaderProcessor._MoveCursor = function (cursor, rootNode) {\r\n while (cursor.canRead) {\r\n cursor.lineIndex++;\r\n var line = cursor.currentLine;\r\n var keywords = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\r\n var matches = keywords.exec(line);\r\n if (matches && matches.length) {\r\n var keyword = matches[0];\r\n switch (keyword) {\r\n case \"#ifdef\": {\r\n var newRootNode = new _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__[\"ShaderCodeConditionNode\"]();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 6);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#else\":\r\n case \"#elif\":\r\n return true;\r\n case \"#endif\":\r\n return false;\r\n case \"#ifndef\": {\r\n var newRootNode = new _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__[\"ShaderCodeConditionNode\"]();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 7);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#if\": {\r\n var newRootNode = new _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__[\"ShaderCodeConditionNode\"]();\r\n var ifNode = this._BuildExpression(line, 3);\r\n rootNode.children.push(newRootNode);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n var newNode = new _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__[\"ShaderCodeNode\"]();\r\n newNode.line = line;\r\n rootNode.children.push(newNode);\r\n // Detect additional defines\r\n if (line[0] === \"#\" && line[1] === \"d\") {\r\n var split = line.replace(\";\", \"\").split(\" \");\r\n newNode.additionalDefineKey = split[1];\r\n if (split.length === 3) {\r\n newNode.additionalDefineValue = split[2];\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n ShaderProcessor._EvaluatePreProcessors = function (sourceCode, preprocessors, options) {\r\n var rootNode = new _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__[\"ShaderCodeNode\"]();\r\n var cursor = new _shaderCodeCursor__WEBPACK_IMPORTED_MODULE_1__[\"ShaderCodeCursor\"]();\r\n cursor.lineIndex = -1;\r\n cursor.lines = sourceCode.split(\"\\n\");\r\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\r\n this._MoveCursor(cursor, rootNode);\r\n // Recompose\r\n return rootNode.process(preprocessors, options);\r\n };\r\n ShaderProcessor._PreparePreProcessors = function (options) {\r\n var defines = options.defines;\r\n var preprocessors = {};\r\n for (var _i = 0, defines_1 = defines; _i < defines_1.length; _i++) {\r\n var define = defines_1[_i];\r\n var keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\r\n var split = keyValue.split(\" \");\r\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\r\n }\r\n preprocessors[\"GL_ES\"] = \"true\";\r\n preprocessors[\"__VERSION__\"] = options.version;\r\n preprocessors[options.platformName] = \"true\";\r\n return preprocessors;\r\n };\r\n ShaderProcessor._ProcessShaderConversion = function (sourceCode, options) {\r\n var preparedSourceCode = this._ProcessPrecision(sourceCode, options);\r\n if (!options.processor) {\r\n return preparedSourceCode;\r\n }\r\n // Already converted\r\n if (preparedSourceCode.indexOf(\"#version 3\") !== -1) {\r\n return preparedSourceCode.replace(\"#version 300 es\", \"\");\r\n }\r\n var defines = options.defines;\r\n var preprocessors = this._PreparePreProcessors(options);\r\n // General pre processing\r\n if (options.processor.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n preparedSourceCode = this._EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n // Post processing\r\n if (options.processor.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n return preparedSourceCode;\r\n };\r\n ShaderProcessor._ProcessIncludes = function (sourceCode, options, callback) {\r\n var _this = this;\r\n var regex = /#include<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\r\n var match = regex.exec(sourceCode);\r\n var returnValue = new String(sourceCode);\r\n while (match != null) {\r\n var includeFile = match[1];\r\n // Uniform declaration\r\n if (includeFile.indexOf(\"__decl__\") !== -1) {\r\n includeFile = includeFile.replace(/__decl__/, \"\");\r\n if (options.supportsUniformBuffers) {\r\n includeFile = includeFile.replace(/Vertex/, \"Ubo\");\r\n includeFile = includeFile.replace(/Fragment/, \"Ubo\");\r\n }\r\n includeFile = includeFile + \"Declaration\";\r\n }\r\n if (options.includesShadersStore[includeFile]) {\r\n // Substitution\r\n var includeContent = options.includesShadersStore[includeFile];\r\n if (match[2]) {\r\n var splits = match[3].split(\",\");\r\n for (var index = 0; index < splits.length; index += 2) {\r\n var source = new RegExp(splits[index], \"g\");\r\n var dest = splits[index + 1];\r\n includeContent = includeContent.replace(source, dest);\r\n }\r\n }\r\n if (match[4]) {\r\n var indexString = match[5];\r\n if (indexString.indexOf(\"..\") !== -1) {\r\n var indexSplits = indexString.split(\"..\");\r\n var minIndex = parseInt(indexSplits[0]);\r\n var maxIndex = parseInt(indexSplits[1]);\r\n var sourceIncludeContent = includeContent.slice(0);\r\n includeContent = \"\";\r\n if (isNaN(maxIndex)) {\r\n maxIndex = options.indexParameters[indexSplits[1]];\r\n }\r\n for (var i = minIndex; i < maxIndex; i++) {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n sourceIncludeContent = sourceIncludeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent += sourceIncludeContent.replace(/\\{X\\}/g, i.toString()) + \"\\n\";\r\n }\r\n }\r\n else {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n includeContent = includeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent = includeContent.replace(/\\{X\\}/g, indexString);\r\n }\r\n }\r\n // Replace\r\n returnValue = returnValue.replace(match[0], includeContent);\r\n }\r\n else {\r\n var includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadFile(includeShaderUrl, function (fileContent) {\r\n options.includesShadersStore[includeFile] = fileContent;\r\n _this._ProcessIncludes(returnValue, options, callback);\r\n });\r\n return;\r\n }\r\n match = regex.exec(sourceCode);\r\n }\r\n callback(returnValue);\r\n };\r\n return ShaderProcessor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/WebGL/webGL2ShaderProcessors.ts\":\n/*!*************************************************!*\\\n !*** ./Engines/WebGL/webGL2ShaderProcessors.ts ***!\n \\*************************************************/\n/*! exports provided: WebGL2ShaderProcessor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return WebGL2ShaderProcessor; });\n/** @hidden */\r\nvar WebGL2ShaderProcessor = /** @class */ (function () {\r\n function WebGL2ShaderProcessor() {\r\n }\r\n WebGL2ShaderProcessor.prototype.attributeProcessor = function (attribute) {\r\n return attribute.replace(\"attribute\", \"in\");\r\n };\r\n WebGL2ShaderProcessor.prototype.varyingProcessor = function (varying, isFragment) {\r\n return varying.replace(\"varying\", isFragment ? \"in\" : \"out\");\r\n };\r\n WebGL2ShaderProcessor.prototype.postProcessor = function (code, defines, isFragment) {\r\n var hasDrawBuffersExtension = code.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;\r\n // Remove extensions\r\n var regex = /#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;\r\n code = code.replace(regex, \"\");\r\n // Replace instructions\r\n code = code.replace(/texture2D\\s*\\(/g, \"texture(\");\r\n if (isFragment) {\r\n code = code.replace(/texture2DLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCubeLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCube\\s*\\(/g, \"texture(\");\r\n code = code.replace(/gl_FragDepthEXT/g, \"gl_FragDepth\");\r\n code = code.replace(/gl_FragColor/g, \"glFragColor\");\r\n code = code.replace(/gl_FragData/g, \"glFragData\");\r\n code = code.replace(/void\\s+?main\\s*\\(/g, (hasDrawBuffersExtension ? \"\" : \"out vec4 glFragColor;\\n\") + \"void main(\");\r\n }\r\n else {\r\n var hasMultiviewExtension = defines.indexOf(\"#define MULTIVIEW\") !== -1;\r\n if (hasMultiviewExtension) {\r\n return \"#extension GL_OVR_multiview2 : require\\nlayout (num_views = 2) in;\\n\" + code;\r\n }\r\n }\r\n return code;\r\n };\r\n return WebGL2ShaderProcessor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/WebGL/webGLPipelineContext.ts\":\n/*!***********************************************!*\\\n !*** ./Engines/WebGL/webGLPipelineContext.ts ***!\n \\***********************************************/\n/*! exports provided: WebGLPipelineContext */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return WebGLPipelineContext; });\n/** @hidden */\r\nvar WebGLPipelineContext = /** @class */ (function () {\r\n function WebGLPipelineContext() {\r\n }\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isAsync\", {\r\n get: function () {\r\n return this.isParallelCompiled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isReady\", {\r\n get: function () {\r\n if (this.program) {\r\n if (this.isParallelCompiled) {\r\n return this.engine._isRenderingStateCompiled(this);\r\n }\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WebGLPipelineContext.prototype._handlesSpectorRebuildCallback = function (onCompiled) {\r\n if (onCompiled && this.program) {\r\n onCompiled(this.program);\r\n }\r\n };\r\n return WebGLPipelineContext;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/constants.ts\":\n/*!******************************!*\\\n !*** ./Engines/constants.ts ***!\n \\******************************/\n/*! exports provided: Constants */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return Constants; });\n/** Defines the cross module used constants to avoid circular dependncies */\r\nvar Constants = /** @class */ (function () {\r\n function Constants() {\r\n }\r\n /** Defines that alpha blending is disabled */\r\n Constants.ALPHA_DISABLE = 0;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + DEST */\r\n Constants.ALPHA_ADD = 1;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_COMBINE = 2;\r\n /** Defines that alpha blending to DEST - SRC * DEST */\r\n Constants.ALPHA_SUBTRACT = 3;\r\n /** Defines that alpha blending to SRC * DEST */\r\n Constants.ALPHA_MULTIPLY = 4;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Constants.ALPHA_MAXIMIZED = 5;\r\n /** Defines that alpha blending to SRC + DEST */\r\n Constants.ALPHA_ONEONE = 6;\r\n /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_PREMULTIPLIED = 7;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\r\n /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */\r\n Constants.ALPHA_INTERPOLATE = 9;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_SCREENMODE = 10;\r\n /** Defines that the ressource is not delayed*/\r\n Constants.DELAYLOADSTATE_NONE = 0;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Constants.DELAYLOADSTATE_LOADED = 1;\r\n /** Defines that the ressource is currently delay loading */\r\n Constants.DELAYLOADSTATE_LOADING = 2;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Constants.DELAYLOADSTATE_NOTLOADED = 4;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Constants.NEVER = 0x0200;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Constants.ALWAYS = 0x0207;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Constants.LESS = 0x0201;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Constants.EQUAL = 0x0202;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Constants.LEQUAL = 0x0203;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Constants.GREATER = 0x0204;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Constants.GEQUAL = 0x0206;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Constants.NOTEQUAL = 0x0205;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Constants.KEEP = 0x1E00;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Constants.REPLACE = 0x1E01;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Constants.INCR = 0x1E02;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Constants.DECR = 0x1E03;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Constants.INVERT = 0x150A;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Constants.INCR_WRAP = 0x8507;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Constants.DECR_WRAP = 0x8508;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Constants.TEXTURE_MIRROR_ADDRESSMODE = 2;\r\n /** ALPHA */\r\n Constants.TEXTUREFORMAT_ALPHA = 0;\r\n /** LUMINANCE */\r\n Constants.TEXTUREFORMAT_LUMINANCE = 1;\r\n /** LUMINANCE_ALPHA */\r\n Constants.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\r\n /** RGB */\r\n Constants.TEXTUREFORMAT_RGB = 4;\r\n /** RGBA */\r\n Constants.TEXTUREFORMAT_RGBA = 5;\r\n /** RED */\r\n Constants.TEXTUREFORMAT_RED = 6;\r\n /** RED (2nd reference) */\r\n Constants.TEXTUREFORMAT_R = 6;\r\n /** RG */\r\n Constants.TEXTUREFORMAT_RG = 7;\r\n /** RED_INTEGER */\r\n Constants.TEXTUREFORMAT_RED_INTEGER = 8;\r\n /** RED_INTEGER (2nd reference) */\r\n Constants.TEXTUREFORMAT_R_INTEGER = 8;\r\n /** RG_INTEGER */\r\n Constants.TEXTUREFORMAT_RG_INTEGER = 9;\r\n /** RGB_INTEGER */\r\n Constants.TEXTUREFORMAT_RGB_INTEGER = 10;\r\n /** RGBA_INTEGER */\r\n Constants.TEXTUREFORMAT_RGBA_INTEGER = 11;\r\n /** UNSIGNED_BYTE */\r\n Constants.TEXTURETYPE_UNSIGNED_BYTE = 0;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Constants.TEXTURETYPE_UNSIGNED_INT = 0;\r\n /** FLOAT */\r\n Constants.TEXTURETYPE_FLOAT = 1;\r\n /** HALF_FLOAT */\r\n Constants.TEXTURETYPE_HALF_FLOAT = 2;\r\n /** BYTE */\r\n Constants.TEXTURETYPE_BYTE = 3;\r\n /** SHORT */\r\n Constants.TEXTURETYPE_SHORT = 4;\r\n /** UNSIGNED_SHORT */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT = 5;\r\n /** INT */\r\n Constants.TEXTURETYPE_INT = 6;\r\n /** UNSIGNED_INT */\r\n Constants.TEXTURETYPE_UNSIGNED_INTEGER = 7;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\r\n /** UNSIGNED_INT_24_8 */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Constants.TEXTURE_NEAREST_SAMPLINGMODE = 1;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Constants.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 1;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Constants.TEXTURE_NEAREST_LINEAR = 7;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Constants.TEXTURE_NEAREST_NEAREST = 8;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** mag = linear and min = linear and mip = none */\r\n Constants.TEXTURE_LINEAR_LINEAR = 11;\r\n /** mag = linear and min = nearest and mip = none */\r\n Constants.TEXTURE_LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Constants.TEXTURE_EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Constants.TEXTURE_SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Constants.TEXTURE_PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Constants.TEXTURE_CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Constants.TEXTURE_PROJECTION_MODE = 4;\r\n /** Skybox coordinates mode */\r\n Constants.TEXTURE_SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Constants.TEXTURE_INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Constants.TEXTURE_EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Constants.SCALEMODE_FLOOR = 1;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Constants.SCALEMODE_NEAREST = 2;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Constants.SCALEMODE_CEILING = 3;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Constants.MATERIAL_TextureDirtyFlag = 1;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Constants.MATERIAL_LightDirtyFlag = 2;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Constants.MATERIAL_FresnelDirtyFlag = 4;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Constants.MATERIAL_AttributesDirtyFlag = 8;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Constants.MATERIAL_MiscDirtyFlag = 16;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Constants.MATERIAL_AllDirtyFlag = 31;\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Constants.MATERIAL_TriangleFillMode = 0;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Constants.MATERIAL_WireFrameFillMode = 1;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Constants.MATERIAL_PointFillMode = 2;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Constants.MATERIAL_PointListDrawMode = 3;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Constants.MATERIAL_LineListDrawMode = 4;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Constants.MATERIAL_LineLoopDrawMode = 5;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Constants.MATERIAL_LineStripDrawMode = 6;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Constants.MATERIAL_TriangleStripDrawMode = 7;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Constants.MATERIAL_TriangleFanDrawMode = 8;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Constants.MATERIAL_ClockWiseSideOrientation = 0;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Constants.MATERIAL_CounterClockWiseSideOrientation = 1;\r\n /**\r\n * Nothing\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_NothingTrigger = 0;\r\n /**\r\n * On pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickTrigger = 1;\r\n /**\r\n * On left pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLeftPickTrigger = 2;\r\n /**\r\n * On right pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnRightPickTrigger = 3;\r\n /**\r\n * On center pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnCenterPickTrigger = 4;\r\n /**\r\n * On pick down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickDownTrigger = 5;\r\n /**\r\n * On double pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnDoublePickTrigger = 6;\r\n /**\r\n * On pick up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickUpTrigger = 7;\r\n /**\r\n * On pick out.\r\n * This trigger will only be raised if you also declared a OnPickDown\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickOutTrigger = 16;\r\n /**\r\n * On long press\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLongPressTrigger = 8;\r\n /**\r\n * On pointer over\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOverTrigger = 9;\r\n /**\r\n * On pointer out\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOutTrigger = 10;\r\n /**\r\n * On every frame\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnEveryFrameTrigger = 11;\r\n /**\r\n * On intersection enter\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionEnterTrigger = 12;\r\n /**\r\n * On intersection exit\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionExitTrigger = 13;\r\n /**\r\n * On key down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyDownTrigger = 14;\r\n /**\r\n * On key up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyUpTrigger = 15;\r\n /**\r\n * Billboard mode will only apply to Y axis\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_Y = 2;\r\n /**\r\n * Billboard mode will apply to all axes\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_STRETCHED = 8;\r\n /**\r\n * Gets or sets base Assets URL\r\n */\r\n Constants.PARTICLES_BaseAssetsUrl = \"https://assets.babylonjs.com/particles\";\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_STANDARD = 0;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\r\n /**\r\n * No logging while loading\r\n */\r\n Constants.SCENELOADER_NO_LOGGING = 0;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n Constants.SCENELOADER_MINIMAL_LOGGING = 1;\r\n /**\r\n * Summary logging while loading\r\n */\r\n Constants.SCENELOADER_SUMMARY_LOGGING = 2;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n Constants.SCENELOADER_DETAILED_LOGGING = 3;\r\n return Constants;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/engine.ts\":\n/*!***************************!*\\\n !*** ./Engines/engine.ts ***!\n \\***************************/\n/*! exports provided: InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return InstancingAttributeInfo; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return DepthTextureCreationOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return EngineCapabilities; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return Engine; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_performanceMonitor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/performanceMonitor */ \"./Misc/performanceMonitor.ts\");\n/* harmony import */ var _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/stringDictionary */ \"./Misc/stringDictionary.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _States_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../States/index */ \"./States/index.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _engineStore__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./WebGL/webGLPipelineContext */ \"./Engines/WebGL/webGLPipelineContext.ts\");\n/* harmony import */ var _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Meshes/WebGL/webGLDataBuffer */ \"./Meshes/WebGL/webGLDataBuffer.ts\");\n/* harmony import */ var _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./WebGL/webGL2ShaderProcessors */ \"./Engines/WebGL/webGL2ShaderProcessors.ts\");\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Keeps track of all the buffer info used in engine.\r\n */\r\nvar BufferPointer = /** @class */ (function () {\r\n function BufferPointer() {\r\n }\r\n return BufferPointer;\r\n}());\r\n/**\r\n * Interface for attribute information associated with buffer instanciation\r\n */\r\nvar InstancingAttributeInfo = /** @class */ (function () {\r\n function InstancingAttributeInfo() {\r\n }\r\n return InstancingAttributeInfo;\r\n}());\r\n\r\n/**\r\n * Define options used to create a depth texture\r\n */\r\nvar DepthTextureCreationOptions = /** @class */ (function () {\r\n function DepthTextureCreationOptions() {\r\n }\r\n return DepthTextureCreationOptions;\r\n}());\r\n\r\n/**\r\n * Class used to describe the capabilities of the engine relatively to the current browser\r\n */\r\nvar EngineCapabilities = /** @class */ (function () {\r\n function EngineCapabilities() {\r\n /** Max number of texture samples for MSAA */\r\n this.maxMSAASamples = 1;\r\n }\r\n return EngineCapabilities;\r\n}());\r\n\r\n/**\r\n * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio\r\n */\r\nvar Engine = /** @class */ (function () {\r\n /**\r\n * Creates a new engine\r\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context\r\n * @param antialias defines enable antialiasing (default: false)\r\n * @param options defines further options to be sent to the getContext() function\r\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\r\n */\r\n function Engine(canvasOrContext, antialias, options, adaptToDeviceRatio) {\r\n var _this = this;\r\n if (adaptToDeviceRatio === void 0) { adaptToDeviceRatio = false; }\r\n /**\r\n * Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required\r\n */\r\n this.forcePOTTextures = false;\r\n /**\r\n * Gets a boolean indicating if the engine is currently rendering in fullscreen mode\r\n */\r\n this.isFullscreen = false;\r\n /**\r\n * Gets a boolean indicating if the pointer is currently locked\r\n */\r\n this.isPointerLock = false;\r\n /**\r\n * Gets or sets a boolean indicating if back faces must be culled (true by default)\r\n */\r\n this.cullBackFaces = true;\r\n /**\r\n * Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foregroun\r\n */\r\n this.renderEvenInBackground = true;\r\n /**\r\n * Gets or sets a boolean indicating that cache can be kept between frames\r\n */\r\n this.preventCacheWipeBetweenFrames = false;\r\n /**\r\n * Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest\r\n **/\r\n this.enableOfflineSupport = false;\r\n /**\r\n * Gets or sets a boolean to enable/disable checking manifest if IndexedDB support is enabled (js will always consider the database is up to date)\r\n **/\r\n this.disableManifestCheck = false;\r\n /**\r\n * Gets the list of created scenes\r\n */\r\n this.scenes = new Array();\r\n /**\r\n * Event raised when a new scene is created\r\n */\r\n this.onNewSceneAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Gets the list of created postprocesses\r\n */\r\n this.postProcesses = new Array();\r\n /** Gets or sets a boolean indicating if the engine should validate programs after compilation */\r\n this.validateShaderPrograms = false;\r\n // Observables\r\n /**\r\n * Observable event triggered each time the rendering canvas is resized\r\n */\r\n this.onResizeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time the canvas loses focus\r\n */\r\n this.onCanvasBlurObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time the canvas gains focus\r\n */\r\n this.onCanvasFocusObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time the canvas receives pointerout event\r\n */\r\n this.onCanvasPointerOutObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered before each texture is initialized\r\n */\r\n this.onBeforeTextureInitObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n // Uniform buffers list\r\n /**\r\n * Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported\r\n */\r\n this.disableUniformBuffers = false;\r\n /** @hidden */\r\n this._uniformBuffers = new Array();\r\n // Observables\r\n /**\r\n * Observable raised when the engine begins a new frame\r\n */\r\n this.onBeginFrameObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * If set, will be used to request the next animation frame for the render loop\r\n */\r\n this.customAnimationFrameRequester = null;\r\n /**\r\n * Observable raised when the engine ends the current frame\r\n */\r\n this.onEndFrameObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable raised when the engine is about to compile a shader\r\n */\r\n this.onBeforeShaderCompilationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable raised when the engine has jsut compiled a shader\r\n */\r\n this.onAfterShaderCompilationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._windowIsBackground = false;\r\n this._webGLVersion = 1.0;\r\n this._highPrecisionShadersAllowed = true;\r\n /** @hidden */\r\n this._badOS = false;\r\n /** @hidden */\r\n this._badDesktopOS = false;\r\n this._colorWrite = true;\r\n /** @hidden */\r\n this._drawCalls = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_16__[\"PerfCounter\"]();\r\n this._renderingQueueLaunched = false;\r\n this._activeRenderLoops = new Array();\r\n // Deterministic lockstepMaxSteps\r\n this._deterministicLockstep = false;\r\n this._lockstepMaxSteps = 4;\r\n // Lost context\r\n /**\r\n * Observable signaled when a context lost event is raised\r\n */\r\n this.onContextLostObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable signaled when a context restored event is raised\r\n */\r\n this.onContextRestoredObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._contextWasLost = false;\r\n /** @hidden */\r\n this._doNotHandleContextLost = false;\r\n // FPS\r\n this._performanceMonitor = new _Misc_performanceMonitor__WEBPACK_IMPORTED_MODULE_2__[\"PerformanceMonitor\"]();\r\n this._fps = 60;\r\n this._deltaTime = 0;\r\n /**\r\n * Turn this value on if you want to pause FPS computation when in background\r\n */\r\n this.disablePerformanceMonitorInBackground = false;\r\n /**\r\n * Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported\r\n */\r\n this.disableVertexArrayObjects = false;\r\n // States\r\n /** @hidden */\r\n this._depthCullingState = new _States_index__WEBPACK_IMPORTED_MODULE_6__[\"_DepthCullingState\"]();\r\n /** @hidden */\r\n this._stencilState = new _States_index__WEBPACK_IMPORTED_MODULE_6__[\"_StencilState\"]();\r\n /** @hidden */\r\n this._alphaState = new _States_index__WEBPACK_IMPORTED_MODULE_6__[\"_AlphaState\"]();\r\n /** @hidden */\r\n this._alphaMode = Engine.ALPHA_DISABLE;\r\n // Cache\r\n /** @hidden */\r\n this._internalTexturesCache = new Array();\r\n /** @hidden */\r\n this._activeChannel = 0;\r\n this._currentTextureChannel = -1;\r\n /** @hidden */\r\n this._boundTexturesCache = {};\r\n this._compiledEffects = {};\r\n this._vertexAttribArraysEnabled = [];\r\n this._uintIndicesCurrentlySet = false;\r\n this._currentBoundBuffer = new Array();\r\n /** @hidden */\r\n this._currentFramebuffer = null;\r\n this._currentBufferPointers = new Array();\r\n this._currentInstanceLocations = new Array();\r\n this._currentInstanceBuffers = new Array();\r\n this._vaoRecordInProgress = false;\r\n this._mustWipeVertexAttributes = false;\r\n this._nextFreeTextureSlots = new Array();\r\n this._maxSimultaneousTextures = 0;\r\n this._activeRequests = new Array();\r\n // Hardware supported Compressed Textures\r\n this._texturesSupported = new Array();\r\n /**\r\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\r\n */\r\n this.premultipliedAlpha = true;\r\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\r\n this._unpackFlipYCached = null;\r\n /**\r\n * In case you are sharing the context with other applications, it might\r\n * be interested to not cache the unpack flip y state to ensure a consistent\r\n * value would be set.\r\n */\r\n this.enableUnpackFlipYCached = true;\r\n this._boundUniforms = {};\r\n var canvas = null;\r\n Engine.Instances.push(this);\r\n if (!canvasOrContext) {\r\n return;\r\n }\r\n options = options || {};\r\n if (canvasOrContext.getContext) {\r\n canvas = canvasOrContext;\r\n this._renderingCanvas = canvas;\r\n if (antialias != null) {\r\n options.antialias = antialias;\r\n }\r\n if (options.deterministicLockstep === undefined) {\r\n options.deterministicLockstep = false;\r\n }\r\n if (options.lockstepMaxSteps === undefined) {\r\n options.lockstepMaxSteps = 4;\r\n }\r\n if (options.preserveDrawingBuffer === undefined) {\r\n options.preserveDrawingBuffer = false;\r\n }\r\n if (options.audioEngine === undefined) {\r\n options.audioEngine = true;\r\n }\r\n if (options.stencil === undefined) {\r\n options.stencil = true;\r\n }\r\n if (options.premultipliedAlpha === false) {\r\n this.premultipliedAlpha = false;\r\n }\r\n this._deterministicLockstep = options.deterministicLockstep;\r\n this._lockstepMaxSteps = options.lockstepMaxSteps;\r\n this._doNotHandleContextLost = options.doNotHandleContextLost ? true : false;\r\n // Exceptions\r\n if (navigator && navigator.userAgent) {\r\n var ua = navigator.userAgent;\r\n for (var _i = 0, _a = Engine.ExceptionList; _i < _a.length; _i++) {\r\n var exception = _a[_i];\r\n var key = exception.key;\r\n var targets = exception.targets;\r\n var check = new RegExp(key);\r\n if (check.test(ua)) {\r\n if (exception.capture && exception.captureConstraint) {\r\n var capture = exception.capture;\r\n var constraint = exception.captureConstraint;\r\n var regex = new RegExp(capture);\r\n var matches = regex.exec(ua);\r\n if (matches && matches.length > 0) {\r\n var capturedValue = parseInt(matches[matches.length - 1]);\r\n if (capturedValue >= constraint) {\r\n continue;\r\n }\r\n }\r\n }\r\n for (var _b = 0, targets_1 = targets; _b < targets_1.length; _b++) {\r\n var target = targets_1[_b];\r\n switch (target) {\r\n case \"uniformBuffer\":\r\n this.disableUniformBuffers = true;\r\n break;\r\n case \"vao\":\r\n this.disableVertexArrayObjects = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Context lost\r\n if (!this._doNotHandleContextLost) {\r\n this._onContextLost = function (evt) {\r\n evt.preventDefault();\r\n _this._contextWasLost = true;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"WebGL context lost.\");\r\n _this.onContextLostObservable.notifyObservers(_this);\r\n };\r\n this._onContextRestored = function () {\r\n // Adding a timeout to avoid race condition at browser level\r\n setTimeout(function () {\r\n // Rebuild gl context\r\n _this._initGLContext();\r\n // Rebuild effects\r\n _this._rebuildEffects();\r\n // Rebuild textures\r\n _this._rebuildInternalTextures();\r\n // Rebuild buffers\r\n _this._rebuildBuffers();\r\n // Cache\r\n _this.wipeCaches(true);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"WebGL context successfully restored.\");\r\n _this.onContextRestoredObservable.notifyObservers(_this);\r\n _this._contextWasLost = false;\r\n }, 0);\r\n };\r\n canvas.addEventListener(\"webglcontextlost\", this._onContextLost, false);\r\n canvas.addEventListener(\"webglcontextrestored\", this._onContextRestored, false);\r\n options.powerPreference = \"high-performance\";\r\n }\r\n // GL\r\n if (!options.disableWebGL2Support) {\r\n try {\r\n this._gl = (canvas.getContext(\"webgl2\", options) || canvas.getContext(\"experimental-webgl2\", options));\r\n if (this._gl) {\r\n this._webGLVersion = 2.0;\r\n // Prevent weird browsers to lie :-)\r\n if (!this._gl.deleteQuery) {\r\n this._webGLVersion = 1.0;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n }\r\n if (!this._gl) {\r\n if (!canvas) {\r\n throw new Error(\"The provided canvas is null or undefined.\");\r\n }\r\n try {\r\n this._gl = (canvas.getContext(\"webgl\", options) || canvas.getContext(\"experimental-webgl\", options));\r\n }\r\n catch (e) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n if (!this._gl) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n // Ensures a consistent color space unpacking of textures cross browser.\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n this._onCanvasFocus = function () {\r\n _this.onCanvasFocusObservable.notifyObservers(_this);\r\n };\r\n this._onCanvasBlur = function () {\r\n _this.onCanvasBlurObservable.notifyObservers(_this);\r\n };\r\n canvas.addEventListener(\"focus\", this._onCanvasFocus);\r\n canvas.addEventListener(\"blur\", this._onCanvasBlur);\r\n this._onBlur = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.disable();\r\n }\r\n _this._windowIsBackground = true;\r\n };\r\n this._onFocus = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.enable();\r\n }\r\n _this._windowIsBackground = false;\r\n };\r\n this._onCanvasPointerOut = function (ev) {\r\n _this.onCanvasPointerOutObservable.notifyObservers(ev);\r\n };\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n var hostWindow = this.getHostWindow();\r\n hostWindow.addEventListener(\"blur\", this._onBlur);\r\n hostWindow.addEventListener(\"focus\", this._onFocus);\r\n }\r\n canvas.addEventListener(\"pointerout\", this._onCanvasPointerOut);\r\n if (!options.doNotHandleTouchAction) {\r\n this._disableTouchAction();\r\n }\r\n }\r\n else {\r\n this._gl = canvasOrContext;\r\n this._renderingCanvas = this._gl.canvas;\r\n if (this._gl.renderbufferStorageMultisample) {\r\n this._webGLVersion = 2.0;\r\n }\r\n var attributes = this._gl.getContextAttributes();\r\n if (attributes) {\r\n options.stencil = attributes.stencil;\r\n }\r\n }\r\n if (options.useHighPrecisionFloats !== undefined) {\r\n this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;\r\n }\r\n // Viewport\r\n var devicePixelRatio = _Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist() ? (window.devicePixelRatio || 1.0) : 1.0;\r\n var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\r\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\r\n this.resize();\r\n this._isStencilEnable = options.stencil ? true : false;\r\n this._initGLContext();\r\n if (canvas) {\r\n var anyDoc_1 = document;\r\n // Fullscreen\r\n this._onFullscreenChange = function () {\r\n if (anyDoc_1.fullscreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.fullscreen;\r\n }\r\n else if (anyDoc_1.mozFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.mozFullScreen;\r\n }\r\n else if (anyDoc_1.webkitIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.webkitIsFullScreen;\r\n }\r\n else if (anyDoc_1.msIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.msIsFullScreen;\r\n }\r\n // Pointer lock\r\n if (_this.isFullscreen && _this._pointerLockRequested && canvas) {\r\n Engine._RequestPointerlock(canvas);\r\n }\r\n };\r\n document.addEventListener(\"fullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"mozfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"webkitfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"msfullscreenchange\", this._onFullscreenChange, false);\r\n // Pointer lock\r\n this._onPointerLockChange = function () {\r\n _this.isPointerLock = (anyDoc_1.mozPointerLockElement === canvas ||\r\n anyDoc_1.webkitPointerLockElement === canvas ||\r\n anyDoc_1.msPointerLockElement === canvas ||\r\n anyDoc_1.pointerLockElement === canvas);\r\n };\r\n document.addEventListener(\"pointerlockchange\", this._onPointerLockChange, false);\r\n document.addEventListener(\"mspointerlockchange\", this._onPointerLockChange, false);\r\n document.addEventListener(\"mozpointerlockchange\", this._onPointerLockChange, false);\r\n document.addEventListener(\"webkitpointerlockchange\", this._onPointerLockChange, false);\r\n this._connectVREvents(canvas, anyDoc_1);\r\n }\r\n // Create Audio Engine if needed.\r\n if (!Engine.audioEngine && options.audioEngine && Engine.AudioEngineFactory) {\r\n Engine.audioEngine = Engine.AudioEngineFactory(this.getRenderingCanvas());\r\n }\r\n // Prepare buffer pointers\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._currentBufferPointers[i] = new BufferPointer();\r\n }\r\n // Load WebVR Devices\r\n this._prepareVRComponent();\r\n if (options.autoEnableWebVR) {\r\n this.initWebVR();\r\n }\r\n // Shader processor\r\n if (this.webGLVersion > 1) {\r\n this._shaderProcessor = new _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_15__[\"WebGL2ShaderProcessor\"]();\r\n }\r\n // Detect if we are running on a faulty buggy OS.\r\n this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);\r\n // Detect if we are running on a faulty buggy desktop OS.\r\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n console.log(\"Babylon.js v\" + Engine.Version + \" - \" + this.description);\r\n this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;\r\n }\r\n Object.defineProperty(Engine, \"Instances\", {\r\n /** Gets the list of created engines */\r\n get: function () {\r\n return _engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].Instances;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n return _engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].LastCreatedEngine;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return _engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].LastCreatedScene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation\r\n * @param flag defines which part of the materials must be marked as dirty\r\n * @param predicate defines a predicate used to filter which materials should be affected\r\n */\r\n Engine.MarkAllMaterialsAsDirty = function (flag, predicate) {\r\n for (var engineIndex = 0; engineIndex < Engine.Instances.length; engineIndex++) {\r\n var engine = Engine.Instances[engineIndex];\r\n for (var sceneIndex = 0; sceneIndex < engine.scenes.length; sceneIndex++) {\r\n engine.scenes[sceneIndex].markAllMaterialsAsDirty(flag, predicate);\r\n }\r\n }\r\n };\r\n Object.defineProperty(Engine, \"NpmPackage\", {\r\n /**\r\n * Returns the current npm package of the sdk\r\n */\r\n // Not mixed with Version for tooling purpose.\r\n get: function () {\r\n return \"babylonjs@4.1.0-alpha.17\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"Version\", {\r\n /**\r\n * Returns the current version of the framework\r\n */\r\n get: function () {\r\n return \"4.1.0-alpha.17\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"description\", {\r\n /**\r\n * Returns a string describing the current engine\r\n */\r\n get: function () {\r\n var description = \"WebGL\" + this.webGLVersion;\r\n if (this._caps.parallelShaderCompile) {\r\n description += \" - Parallel shader compilation\";\r\n }\r\n return description;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"ShadersRepository\", {\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n get: function () {\r\n return _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ShadersRepository;\r\n },\r\n set: function (value) {\r\n _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ShadersRepository = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Method called to create the default loading screen.\r\n * This can be overriden in your own app.\r\n * @param canvas The rendering canvas element\r\n * @returns The loading screen\r\n */\r\n Engine.DefaultLoadingScreenFactory = function (canvas) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"LoadingScreen\");\r\n };\r\n Object.defineProperty(Engine.prototype, \"supportsUniformBuffers\", {\r\n /**\r\n * Gets a boolean indicating that the engine supports uniform buffers\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n */\r\n get: function () {\r\n return this.webGLVersion > 1 && !this.disableUniformBuffers;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"_shouldUseHighPrecisionShader\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"needPOTTextures\", {\r\n /**\r\n * Gets a boolean indicating that only power of 2 textures are supported\r\n * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them\r\n */\r\n get: function () {\r\n return this._webGLVersion < 2 || this.forcePOTTextures;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"doNotHandleContextLost\", {\r\n /**\r\n * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#handling-webgl-context-lost\r\n */\r\n get: function () {\r\n return this._doNotHandleContextLost;\r\n },\r\n set: function (value) {\r\n this._doNotHandleContextLost = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"performanceMonitor\", {\r\n /**\r\n * Gets the performance monitor attached to this engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n */\r\n get: function () {\r\n return this._performanceMonitor;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"texturesSupported\", {\r\n /**\r\n * Gets the list of texture formats supported\r\n */\r\n get: function () {\r\n return this._texturesSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"textureFormatInUse\", {\r\n /**\r\n * Gets the list of texture formats in use\r\n */\r\n get: function () {\r\n return this._textureFormatInUse;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"currentViewport\", {\r\n /**\r\n * Gets the current viewport\r\n */\r\n get: function () {\r\n return this._cachedViewport;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"emptyTexture\", {\r\n /**\r\n * Gets the default empty texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture) {\r\n this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, Engine.TEXTUREFORMAT_RGBA, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n return this._emptyTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"emptyTexture3D\", {\r\n /**\r\n * Gets the default empty 3D texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture3D) {\r\n this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, Engine.TEXTUREFORMAT_RGBA, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n return this._emptyTexture3D;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"emptyCubeTexture\", {\r\n /**\r\n * Gets the default empty cube texture\r\n */\r\n get: function () {\r\n if (!this._emptyCubeTexture) {\r\n var faceData = new Uint8Array(4);\r\n var cubeData = [faceData, faceData, faceData, faceData, faceData, faceData];\r\n this._emptyCubeTexture = this.createRawCubeTexture(cubeData, 1, Engine.TEXTUREFORMAT_RGBA, Engine.TEXTURETYPE_UNSIGNED_INT, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n return this._emptyCubeTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // WebVR\r\n /**\r\n * Initializes a webVR display and starts listening to display change events\r\n * The onVRDisplayChangedObservable will be notified upon these changes\r\n * @returns The onVRDisplayChangedObservable\r\n */\r\n Engine.prototype.initWebVR = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"WebVRCamera\");\r\n };\r\n /** @hidden */\r\n Engine.prototype._prepareVRComponent = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._connectVREvents = function (canvas, document) {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._submitVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Call this function to leave webVR mode\r\n * Will do nothing if webVR is not supported or if there is no webVR device\r\n * @see http://doc.babylonjs.com/how_to/webvr_camera\r\n */\r\n Engine.prototype.disableVR = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Gets a boolean indicating that the system is in VR mode and is presenting\r\n * @returns true if VR mode is engaged\r\n */\r\n Engine.prototype.isVRPresenting = function () {\r\n return false;\r\n };\r\n /** @hidden */\r\n Engine.prototype._requestVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n Engine.prototype._disableTouchAction = function () {\r\n if (!this._renderingCanvas) {\r\n return;\r\n }\r\n this._renderingCanvas.setAttribute(\"touch-action\", \"none\");\r\n this._renderingCanvas.style.touchAction = \"none\";\r\n this._renderingCanvas.style.msTouchAction = \"none\";\r\n };\r\n Engine.prototype._rebuildInternalTextures = function () {\r\n var currentState = this._internalTexturesCache.slice(); // Do a copy because the rebuild will add proxies\r\n for (var _i = 0, currentState_1 = currentState; _i < currentState_1.length; _i++) {\r\n var internalTexture = currentState_1[_i];\r\n internalTexture._rebuild();\r\n }\r\n };\r\n Engine.prototype._rebuildEffects = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n effect._prepareEffect();\r\n }\r\n _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ResetCache();\r\n };\r\n /**\r\n * Gets a boolean indicating if all created effects are ready\r\n * @returns true if all effects are ready\r\n */\r\n Engine.prototype.areAllEffectsReady = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n if (!effect.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Engine.prototype._rebuildBuffers = function () {\r\n // Index / Vertex\r\n for (var _i = 0, _a = this.scenes; _i < _a.length; _i++) {\r\n var scene = _a[_i];\r\n scene.resetCachedMaterial();\r\n scene._rebuildGeometries();\r\n scene._rebuildTextures();\r\n }\r\n // Uniforms\r\n for (var _b = 0, _c = this._uniformBuffers; _b < _c.length; _b++) {\r\n var uniformBuffer = _c[_b];\r\n uniformBuffer._rebuild();\r\n }\r\n };\r\n Engine.prototype._initGLContext = function () {\r\n // Caps\r\n this._caps = new EngineCapabilities();\r\n this._caps.maxTexturesImageUnits = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);\r\n this._caps.maxCombinedTexturesImageUnits = this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);\r\n this._caps.maxVertexTextureImageUnits = this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\r\n this._caps.maxTextureSize = this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE);\r\n this._caps.maxCubemapTextureSize = this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE);\r\n this._caps.maxRenderTextureSize = this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE);\r\n this._caps.maxVertexAttribs = this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS);\r\n this._caps.maxVaryingVectors = this._gl.getParameter(this._gl.MAX_VARYING_VECTORS);\r\n this._caps.maxFragmentUniformVectors = this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS);\r\n this._caps.maxVertexUniformVectors = this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS);\r\n // Infos\r\n this._glVersion = this._gl.getParameter(this._gl.VERSION);\r\n var rendererInfo = this._gl.getExtension(\"WEBGL_debug_renderer_info\");\r\n if (rendererInfo != null) {\r\n this._glRenderer = this._gl.getParameter(rendererInfo.UNMASKED_RENDERER_WEBGL);\r\n this._glVendor = this._gl.getParameter(rendererInfo.UNMASKED_VENDOR_WEBGL);\r\n }\r\n if (!this._glVendor) {\r\n this._glVendor = \"Unknown vendor\";\r\n }\r\n if (!this._glRenderer) {\r\n this._glRenderer = \"Unknown renderer\";\r\n }\r\n // Constants\r\n this._gl.HALF_FLOAT_OES = 0x8D61; // Half floating-point type (16-bit).\r\n if (this._gl.RGBA16F !== 0x881A) {\r\n this._gl.RGBA16F = 0x881A; // RGBA 16-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.RGBA32F !== 0x8814) {\r\n this._gl.RGBA32F = 0x8814; // RGBA 32-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.DEPTH24_STENCIL8 !== 35056) {\r\n this._gl.DEPTH24_STENCIL8 = 35056;\r\n }\r\n // Extensions\r\n this._caps.standardDerivatives = this._webGLVersion > 1 || (this._gl.getExtension('OES_standard_derivatives') !== null);\r\n this._caps.astc = this._gl.getExtension('WEBGL_compressed_texture_astc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_astc');\r\n this._caps.s3tc = this._gl.getExtension('WEBGL_compressed_texture_s3tc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');\r\n this._caps.pvrtc = this._gl.getExtension('WEBGL_compressed_texture_pvrtc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');\r\n this._caps.etc1 = this._gl.getExtension('WEBGL_compressed_texture_etc1') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc1');\r\n this._caps.etc2 = this._gl.getExtension('WEBGL_compressed_texture_etc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc') ||\r\n this._gl.getExtension('WEBGL_compressed_texture_es3_0'); // also a requirement of OpenGL ES 3\r\n 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');\r\n this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0;\r\n this._caps.uintIndices = this._webGLVersion > 1 || this._gl.getExtension('OES_element_index_uint') !== null;\r\n this._caps.fragmentDepthSupported = this._webGLVersion > 1 || this._gl.getExtension('EXT_frag_depth') !== null;\r\n this._caps.highPrecisionShaderSupported = false;\r\n this._caps.timerQuery = this._gl.getExtension('EXT_disjoint_timer_query_webgl2') || this._gl.getExtension(\"EXT_disjoint_timer_query\");\r\n if (this._caps.timerQuery) {\r\n if (this._webGLVersion === 1) {\r\n this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery);\r\n }\r\n this._caps.canUseTimestampForTimerQuery = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT) > 0;\r\n }\r\n // Checks if some of the format renders first to allow the use of webgl inspector.\r\n this._caps.colorBufferFloat = this._webGLVersion > 1 && this._gl.getExtension('EXT_color_buffer_float');\r\n this._caps.textureFloat = (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_float')) ? true : false;\r\n this._caps.textureFloatLinearFiltering = this._caps.textureFloat && this._gl.getExtension('OES_texture_float_linear') ? true : false;\r\n this._caps.textureFloatRender = this._caps.textureFloat && this._canRenderToFloatFramebuffer() ? true : false;\r\n this._caps.textureHalfFloat = (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_half_float')) ? true : false;\r\n this._caps.textureHalfFloatLinearFiltering = (this._webGLVersion > 1 || (this._caps.textureHalfFloat && this._gl.getExtension('OES_texture_half_float_linear'))) ? true : false;\r\n if (this._webGLVersion > 1) {\r\n this._gl.HALF_FLOAT_OES = 0x140B;\r\n }\r\n this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer();\r\n this._caps.textureLOD = (this._webGLVersion > 1 || this._gl.getExtension('EXT_shader_texture_lod')) ? true : false;\r\n this._caps.multiview = this._gl.getExtension('OVR_multiview2');\r\n // Draw buffers\r\n if (this._webGLVersion > 1) {\r\n this._caps.drawBuffersExtension = true;\r\n this._caps.maxMSAASamples = this._gl.getParameter(this._gl.MAX_SAMPLES);\r\n }\r\n else {\r\n var drawBuffersExtension = this._gl.getExtension('WEBGL_draw_buffers');\r\n if (drawBuffersExtension !== null) {\r\n this._caps.drawBuffersExtension = true;\r\n this._gl.drawBuffers = drawBuffersExtension.drawBuffersWEBGL.bind(drawBuffersExtension);\r\n this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;\r\n for (var i = 0; i < 16; i++) {\r\n this._gl[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"] = drawBuffersExtension[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n }\r\n else {\r\n this._caps.drawBuffersExtension = false;\r\n }\r\n }\r\n // Shader compiler threads\r\n this._caps.parallelShaderCompile = this._gl.getExtension('KHR_parallel_shader_compile');\r\n // Depth Texture\r\n if (this._webGLVersion > 1) {\r\n this._caps.depthTextureExtension = true;\r\n }\r\n else {\r\n var depthTextureExtension = this._gl.getExtension('WEBGL_depth_texture');\r\n if (depthTextureExtension != null) {\r\n this._caps.depthTextureExtension = true;\r\n this._gl.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\r\n }\r\n }\r\n // Vertex array object\r\n if (this.disableVertexArrayObjects) {\r\n this._caps.vertexArrayObject = false;\r\n }\r\n else if (this._webGLVersion > 1) {\r\n this._caps.vertexArrayObject = true;\r\n }\r\n else {\r\n var vertexArrayObjectExtension = this._gl.getExtension('OES_vertex_array_object');\r\n if (vertexArrayObjectExtension != null) {\r\n this._caps.vertexArrayObject = true;\r\n this._gl.createVertexArray = vertexArrayObjectExtension.createVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.bindVertexArray = vertexArrayObjectExtension.bindVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.deleteVertexArray = vertexArrayObjectExtension.deleteVertexArrayOES.bind(vertexArrayObjectExtension);\r\n }\r\n else {\r\n this._caps.vertexArrayObject = false;\r\n }\r\n }\r\n // Instances count\r\n if (this._webGLVersion > 1) {\r\n this._caps.instancedArrays = true;\r\n }\r\n else {\r\n var instanceExtension = this._gl.getExtension('ANGLE_instanced_arrays');\r\n if (instanceExtension != null) {\r\n this._caps.instancedArrays = true;\r\n this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);\r\n this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);\r\n this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);\r\n }\r\n else {\r\n this._caps.instancedArrays = false;\r\n }\r\n }\r\n // Intelligently add supported compressed formats in order to check for.\r\n // Check for ASTC support first as it is most powerful and to be very cross platform.\r\n // Next PVRTC & DXT, which are probably superior to ETC1/2.\r\n // Likely no hardware which supports both PVR & DXT, so order matters little.\r\n // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.\r\n if (this._caps.astc) {\r\n this.texturesSupported.push('-astc.ktx');\r\n }\r\n if (this._caps.s3tc) {\r\n this.texturesSupported.push('-dxt.ktx');\r\n }\r\n if (this._caps.pvrtc) {\r\n this.texturesSupported.push('-pvrtc.ktx');\r\n }\r\n if (this._caps.etc2) {\r\n this.texturesSupported.push('-etc2.ktx');\r\n }\r\n if (this._caps.etc1) {\r\n this.texturesSupported.push('-etc1.ktx');\r\n }\r\n if (this._gl.getShaderPrecisionFormat) {\r\n var vertex_highp = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT);\r\n var fragment_highp = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);\r\n if (vertex_highp && fragment_highp) {\r\n this._caps.highPrecisionShaderSupported = vertex_highp.precision !== 0 && fragment_highp.precision !== 0;\r\n }\r\n }\r\n // Depth buffer\r\n this.setDepthBuffer(true);\r\n this.setDepthFunctionToLessOrEqual();\r\n this.setDepthWrite(true);\r\n // Texture maps\r\n this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;\r\n for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {\r\n this._nextFreeTextureSlots.push(slot);\r\n }\r\n };\r\n Object.defineProperty(Engine.prototype, \"webGLVersion\", {\r\n /**\r\n * Gets version of the current webGL context\r\n */\r\n get: function () {\r\n return this._webGLVersion;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"Engine\" string\r\n */\r\n Engine.prototype.getClassName = function () {\r\n return \"Engine\";\r\n };\r\n Object.defineProperty(Engine.prototype, \"isStencilEnable\", {\r\n /**\r\n * Returns true if the stencil buffer has been enabled through the creation option of the context.\r\n */\r\n get: function () {\r\n return this._isStencilEnable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Engine.prototype._prepareWorkingCanvas = function () {\r\n if (this._workingCanvas) {\r\n return;\r\n }\r\n this._workingCanvas = document.createElement(\"canvas\");\r\n var context = this._workingCanvas.getContext(\"2d\");\r\n if (context) {\r\n this._workingContext = context;\r\n }\r\n };\r\n /**\r\n * Reset the texture cache to empty state\r\n */\r\n Engine.prototype.resetTextureCache = function () {\r\n for (var key in this._boundTexturesCache) {\r\n if (!this._boundTexturesCache.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n this._boundTexturesCache[key] = null;\r\n }\r\n this._currentTextureChannel = -1;\r\n };\r\n /**\r\n * Gets a boolean indicating that the engine is running in deterministic lock step mode\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns true if engine is in deterministic lock step mode\r\n */\r\n Engine.prototype.isDeterministicLockStep = function () {\r\n return this._deterministicLockstep;\r\n };\r\n /**\r\n * Gets the max steps when engine is running in deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the max steps\r\n */\r\n Engine.prototype.getLockstepMaxSteps = function () {\r\n return this._lockstepMaxSteps;\r\n };\r\n /**\r\n * Gets an object containing information about the current webGL context\r\n * @returns an object containing the vender, the renderer and the version of the current webGL context\r\n */\r\n Engine.prototype.getGlInfo = function () {\r\n return {\r\n vendor: this._glVendor,\r\n renderer: this._glRenderer,\r\n version: this._glVersion\r\n };\r\n };\r\n /**\r\n * Gets current aspect ratio\r\n * @param viewportOwner defines the camera to use to get the aspect ratio\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getAspectRatio = function (viewportOwner, useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n var viewport = viewportOwner.viewport;\r\n return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);\r\n };\r\n /**\r\n * Gets current screen aspect ratio\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getScreenAspectRatio = function () {\r\n return (this.getRenderWidth(true)) / (this.getRenderHeight(true));\r\n };\r\n /**\r\n * Gets the current render width\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render width\r\n */\r\n Engine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._gl.drawingBufferWidth;\r\n };\r\n /**\r\n * Gets the current render height\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render height\r\n */\r\n Engine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._gl.drawingBufferHeight;\r\n };\r\n /**\r\n * Gets the HTML canvas attached with the current webGL context\r\n * @returns a HTML canvas\r\n */\r\n Engine.prototype.getRenderingCanvas = function () {\r\n return this._renderingCanvas;\r\n };\r\n /**\r\n * Gets host window\r\n * @returns the host window object\r\n */\r\n Engine.prototype.getHostWindow = function () {\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView) {\r\n return this._renderingCanvas.ownerDocument.defaultView;\r\n }\r\n return window;\r\n };\r\n /**\r\n * Gets host document\r\n * @returns the host document object\r\n */\r\n Engine.prototype.getHostDocument = function () {\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument) {\r\n return this._renderingCanvas.ownerDocument;\r\n }\r\n return document;\r\n };\r\n /**\r\n * Gets the client rect of the HTML canvas attached with the current webGL context\r\n * @returns a client rectanglee\r\n */\r\n Engine.prototype.getRenderingCanvasClientRect = function () {\r\n if (!this._renderingCanvas) {\r\n return null;\r\n }\r\n return this._renderingCanvas.getBoundingClientRect();\r\n };\r\n /**\r\n * Defines the hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @param level defines the level to use\r\n */\r\n Engine.prototype.setHardwareScalingLevel = function (level) {\r\n this._hardwareScalingLevel = level;\r\n this.resize();\r\n };\r\n /**\r\n * Gets the current hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @returns a number indicating the current hardware scaling level\r\n */\r\n Engine.prototype.getHardwareScalingLevel = function () {\r\n return this._hardwareScalingLevel;\r\n };\r\n /**\r\n * Gets the list of loaded textures\r\n * @returns an array containing all loaded textures\r\n */\r\n Engine.prototype.getLoadedTexturesCache = function () {\r\n return this._internalTexturesCache;\r\n };\r\n /**\r\n * Gets the object containing all engine capabilities\r\n * @returns the EngineCapabilities object\r\n */\r\n Engine.prototype.getCaps = function () {\r\n return this._caps;\r\n };\r\n /**\r\n * Gets the current depth function\r\n * @returns a number defining the depth function\r\n */\r\n Engine.prototype.getDepthFunction = function () {\r\n return this._depthCullingState.depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function\r\n * @param depthFunc defines the function to use\r\n */\r\n Engine.prototype.setDepthFunction = function (depthFunc) {\r\n this._depthCullingState.depthFunc = depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function to GREATER\r\n */\r\n Engine.prototype.setDepthFunctionToGreater = function () {\r\n this._depthCullingState.depthFunc = this._gl.GREATER;\r\n };\r\n /**\r\n * Sets the current depth function to GEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToGreaterOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.GEQUAL;\r\n };\r\n /**\r\n * Sets the current depth function to LESS\r\n */\r\n Engine.prototype.setDepthFunctionToLess = function () {\r\n this._depthCullingState.depthFunc = this._gl.LESS;\r\n };\r\n /**\r\n * Caches the the state of the stencil buffer\r\n */\r\n Engine.prototype.cacheStencilState = function () {\r\n this._cachedStencilBuffer = this.getStencilBuffer();\r\n this._cachedStencilFunction = this.getStencilFunction();\r\n this._cachedStencilMask = this.getStencilMask();\r\n this._cachedStencilOperationPass = this.getStencilOperationPass();\r\n this._cachedStencilOperationFail = this.getStencilOperationFail();\r\n this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();\r\n this._cachedStencilReference = this.getStencilFunctionReference();\r\n };\r\n /**\r\n * Restores the state of the stencil buffer\r\n */\r\n Engine.prototype.restoreStencilState = function () {\r\n this.setStencilFunction(this._cachedStencilFunction);\r\n this.setStencilMask(this._cachedStencilMask);\r\n this.setStencilBuffer(this._cachedStencilBuffer);\r\n this.setStencilOperationPass(this._cachedStencilOperationPass);\r\n this.setStencilOperationFail(this._cachedStencilOperationFail);\r\n this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);\r\n this.setStencilFunctionReference(this._cachedStencilReference);\r\n };\r\n /**\r\n * Sets the current depth function to LEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToLessOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n };\r\n /**\r\n * Gets a boolean indicating if stencil buffer is enabled\r\n * @returns the current stencil buffer state\r\n */\r\n Engine.prototype.getStencilBuffer = function () {\r\n return this._stencilState.stencilTest;\r\n };\r\n /**\r\n * Enable or disable the stencil buffer\r\n * @param enable defines if the stencil buffer must be enabled or disabled\r\n */\r\n Engine.prototype.setStencilBuffer = function (enable) {\r\n this._stencilState.stencilTest = enable;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the new stencil mask to use\r\n */\r\n Engine.prototype.getStencilMask = function () {\r\n return this._stencilState.stencilMask;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilMask = function (mask) {\r\n this._stencilState.stencilMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil function\r\n * @returns a number defining the stencil function to use\r\n */\r\n Engine.prototype.getStencilFunction = function () {\r\n return this._stencilState.stencilFunc;\r\n };\r\n /**\r\n * Gets the current stencil reference value\r\n * @returns a number defining the stencil reference value to use\r\n */\r\n Engine.prototype.getStencilFunctionReference = function () {\r\n return this._stencilState.stencilFuncRef;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the stencil mask to use\r\n */\r\n Engine.prototype.getStencilFunctionMask = function () {\r\n return this._stencilState.stencilFuncMask;\r\n };\r\n /**\r\n * Sets the current stencil function\r\n * @param stencilFunc defines the new stencil function to use\r\n */\r\n Engine.prototype.setStencilFunction = function (stencilFunc) {\r\n this._stencilState.stencilFunc = stencilFunc;\r\n };\r\n /**\r\n * Sets the current stencil reference\r\n * @param reference defines the new stencil reference to use\r\n */\r\n Engine.prototype.setStencilFunctionReference = function (reference) {\r\n this._stencilState.stencilFuncRef = reference;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilFunctionMask = function (mask) {\r\n this._stencilState.stencilFuncMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil fails\r\n * @returns a number defining stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.getStencilOperationFail = function () {\r\n return this._stencilState.stencilOpStencilFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when depth fails\r\n * @returns a number defining stencil operation to use when depth fails\r\n */\r\n Engine.prototype.getStencilOperationDepthFail = function () {\r\n return this._stencilState.stencilOpDepthFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil passes\r\n * @returns a number defining stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.getStencilOperationPass = function () {\r\n return this._stencilState.stencilOpStencilDepthPass;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil fails\r\n * @param operation defines the stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.setStencilOperationFail = function (operation) {\r\n this._stencilState.stencilOpStencilFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when depth fails\r\n * @param operation defines the stencil operation to use when depth fails\r\n */\r\n Engine.prototype.setStencilOperationDepthFail = function (operation) {\r\n this._stencilState.stencilOpDepthFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil passes\r\n * @param operation defines the stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.setStencilOperationPass = function (operation) {\r\n this._stencilState.stencilOpStencilDepthPass = operation;\r\n };\r\n /**\r\n * Sets a boolean indicating if the dithering state is enabled or disabled\r\n * @param value defines the dithering state\r\n */\r\n Engine.prototype.setDitheringState = function (value) {\r\n if (value) {\r\n this._gl.enable(this._gl.DITHER);\r\n }\r\n else {\r\n this._gl.disable(this._gl.DITHER);\r\n }\r\n };\r\n /**\r\n * Sets a boolean indicating if the rasterizer state is enabled or disabled\r\n * @param value defines the rasterizer state\r\n */\r\n Engine.prototype.setRasterizerState = function (value) {\r\n if (value) {\r\n this._gl.disable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n else {\r\n this._gl.enable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n };\r\n /**\r\n * stop executing a render loop function and remove it from the execution array\r\n * @param renderFunction defines the function to be removed. If not provided all functions will be removed.\r\n */\r\n Engine.prototype.stopRenderLoop = function (renderFunction) {\r\n if (!renderFunction) {\r\n this._activeRenderLoops = [];\r\n return;\r\n }\r\n var index = this._activeRenderLoops.indexOf(renderFunction);\r\n if (index >= 0) {\r\n this._activeRenderLoops.splice(index, 1);\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._renderLoop = function () {\r\n if (!this._contextWasLost) {\r\n var shouldRender = true;\r\n if (!this.renderEvenInBackground && this._windowIsBackground) {\r\n shouldRender = false;\r\n }\r\n if (shouldRender) {\r\n // Start new frame\r\n this.beginFrame();\r\n for (var index = 0; index < this._activeRenderLoops.length; index++) {\r\n var renderFunction = this._activeRenderLoops[index];\r\n renderFunction();\r\n }\r\n // Present\r\n this.endFrame();\r\n }\r\n }\r\n if (this._activeRenderLoops.length > 0) {\r\n // Register new frame\r\n if (this.customAnimationFrameRequester) {\r\n this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._bindedRenderFunction, this.customAnimationFrameRequester);\r\n this._frameHandler = this.customAnimationFrameRequester.requestID;\r\n }\r\n else if (this.isVRPresenting()) {\r\n this._requestVRFrame();\r\n }\r\n else {\r\n this._frameHandler = this._queueNewFrame(this._bindedRenderFunction, this.getHostWindow());\r\n }\r\n }\r\n else {\r\n this._renderingQueueLaunched = false;\r\n }\r\n };\r\n /**\r\n * Can be used to override the current requestAnimationFrame requester.\r\n * @hidden\r\n */\r\n Engine.prototype._queueNewFrame = function (bindedRenderFunction, requester) {\r\n return Engine.QueueNewFrame(bindedRenderFunction, requester);\r\n };\r\n /**\r\n * Register and execute a render loop. The engine can have more than one render function\r\n * @param renderFunction defines the function to continuously execute\r\n */\r\n Engine.prototype.runRenderLoop = function (renderFunction) {\r\n if (this._activeRenderLoops.indexOf(renderFunction) !== -1) {\r\n return;\r\n }\r\n this._activeRenderLoops.push(renderFunction);\r\n if (!this._renderingQueueLaunched) {\r\n this._renderingQueueLaunched = true;\r\n this._bindedRenderFunction = this._renderLoop.bind(this);\r\n this._frameHandler = this._queueNewFrame(this._bindedRenderFunction, this.getHostWindow());\r\n }\r\n };\r\n /**\r\n * Toggle full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.switchFullscreen = function (requestPointerLock) {\r\n if (this.isFullscreen) {\r\n this.exitFullscreen();\r\n }\r\n else {\r\n this.enterFullscreen(requestPointerLock);\r\n }\r\n };\r\n /**\r\n * Enters full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.enterFullscreen = function (requestPointerLock) {\r\n if (!this.isFullscreen) {\r\n this._pointerLockRequested = requestPointerLock;\r\n if (this._renderingCanvas) {\r\n Engine._RequestFullscreen(this._renderingCanvas);\r\n }\r\n }\r\n };\r\n /**\r\n * Exits full screen mode\r\n */\r\n Engine.prototype.exitFullscreen = function () {\r\n if (this.isFullscreen) {\r\n Engine._ExitFullscreen();\r\n }\r\n };\r\n /**\r\n * Enters Pointerlock mode\r\n */\r\n Engine.prototype.enterPointerlock = function () {\r\n if (this._renderingCanvas) {\r\n Engine._RequestPointerlock(this._renderingCanvas);\r\n }\r\n };\r\n /**\r\n * Exits Pointerlock mode\r\n */\r\n Engine.prototype.exitPointerlock = function () {\r\n Engine._ExitPointerlock();\r\n };\r\n /**\r\n * Clear the current render buffer or the current render target (if any is set up)\r\n * @param color defines the color to use\r\n * @param backBuffer defines if the back buffer must be cleared\r\n * @param depth defines if the depth buffer must be cleared\r\n * @param stencil defines if the stencil buffer must be cleared\r\n */\r\n Engine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n this.applyStates();\r\n var mode = 0;\r\n if (backBuffer && color) {\r\n this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);\r\n mode |= this._gl.COLOR_BUFFER_BIT;\r\n }\r\n if (depth) {\r\n this._gl.clearDepth(1.0);\r\n mode |= this._gl.DEPTH_BUFFER_BIT;\r\n }\r\n if (stencil) {\r\n this._gl.clearStencil(0);\r\n mode |= this._gl.STENCIL_BUFFER_BIT;\r\n }\r\n this._gl.clear(mode);\r\n };\r\n /**\r\n * Executes a scissor clear (ie. a clear on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n * @param clearColor defines the clear color\r\n */\r\n Engine.prototype.scissorClear = function (x, y, width, height, clearColor) {\r\n this.enableScissor(x, y, width, height);\r\n this.clear(clearColor, true, true, true);\r\n this.disableScissor();\r\n };\r\n /**\r\n * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n */\r\n Engine.prototype.enableScissor = function (x, y, width, height) {\r\n var gl = this._gl;\r\n // Change state\r\n gl.enable(gl.SCISSOR_TEST);\r\n gl.scissor(x, y, width, height);\r\n };\r\n /**\r\n * Disable previously set scissor test rectangle\r\n */\r\n Engine.prototype.disableScissor = function () {\r\n var gl = this._gl;\r\n gl.disable(gl.SCISSOR_TEST);\r\n };\r\n /** @hidden */\r\n Engine.prototype._viewport = function (x, y, width, height) {\r\n if (x !== this._viewportCached.x ||\r\n y !== this._viewportCached.y ||\r\n width !== this._viewportCached.z ||\r\n height !== this._viewportCached.w) {\r\n this._viewportCached.x = x;\r\n this._viewportCached.y = y;\r\n this._viewportCached.z = width;\r\n this._viewportCached.w = height;\r\n this._gl.viewport(x, y, width, height);\r\n }\r\n };\r\n /**\r\n * Set the WebGL's viewport\r\n * @param viewport defines the viewport element to be used\r\n * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used\r\n * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used\r\n */\r\n Engine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n var width = requiredWidth || this.getRenderWidth();\r\n var height = requiredHeight || this.getRenderHeight();\r\n var x = viewport.x || 0;\r\n var y = viewport.y || 0;\r\n this._cachedViewport = viewport;\r\n this._viewport(x * width, y * height, width * viewport.width, height * viewport.height);\r\n };\r\n /**\r\n * Directly set the WebGL Viewport\r\n * @param x defines the x coordinate of the viewport (in screen space)\r\n * @param y defines the y coordinate of the viewport (in screen space)\r\n * @param width defines the width of the viewport (in screen space)\r\n * @param height defines the height of the viewport (in screen space)\r\n * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state\r\n */\r\n Engine.prototype.setDirectViewport = function (x, y, width, height) {\r\n var currentViewport = this._cachedViewport;\r\n this._cachedViewport = null;\r\n this._viewport(x, y, width, height);\r\n return currentViewport;\r\n };\r\n /**\r\n * Begin a new frame\r\n */\r\n Engine.prototype.beginFrame = function () {\r\n this.onBeginFrameObservable.notifyObservers(this);\r\n this._measureFps();\r\n };\r\n /**\r\n * Enf the current frame\r\n */\r\n Engine.prototype.endFrame = function () {\r\n // Force a flush in case we are using a bad OS.\r\n if (this._badOS) {\r\n this.flushFramebuffer();\r\n }\r\n this._submitVRFrame();\r\n this.onEndFrameObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Resize the view according to the canvas' size\r\n */\r\n Engine.prototype.resize = function () {\r\n // We're not resizing the size of the canvas while in VR mode & presenting\r\n if (!this.isVRPresenting()) {\r\n var width = this._renderingCanvas ? this._renderingCanvas.clientWidth : window.innerWidth;\r\n var height = this._renderingCanvas ? this._renderingCanvas.clientHeight : window.innerHeight;\r\n this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel);\r\n }\r\n };\r\n /**\r\n * Force a specific size of the canvas\r\n * @param width defines the new canvas' width\r\n * @param height defines the new canvas' height\r\n */\r\n Engine.prototype.setSize = function (width, height) {\r\n if (!this._renderingCanvas) {\r\n return;\r\n }\r\n width = width | 0;\r\n height = height | 0;\r\n if (this._renderingCanvas.width === width && this._renderingCanvas.height === height) {\r\n return;\r\n }\r\n this._renderingCanvas.width = width;\r\n this._renderingCanvas.height = height;\r\n for (var index = 0; index < this.scenes.length; index++) {\r\n var scene = this.scenes[index];\r\n for (var camIndex = 0; camIndex < scene.cameras.length; camIndex++) {\r\n var cam = scene.cameras[camIndex];\r\n cam._currentRenderId = 0;\r\n }\r\n }\r\n if (this.onResizeObservable.hasObservers) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Binds the frame buffer to the specified texture.\r\n * @param texture The texture to render to or null for the default canvas\r\n * @param faceIndex The face of the texture to render to in case of cube texture\r\n * @param requiredWidth The width of the target to render to\r\n * @param requiredHeight The height of the target to render to\r\n * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true\r\n * @param depthStencilTexture The depth stencil texture to use to render\r\n * @param lodLevel defines le lod level to bind to the frame buffer\r\n */\r\n Engine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport, depthStencilTexture, lodLevel) {\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n this._currentRenderTarget = texture;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer ? texture._MSAAFramebuffer : texture._framebuffer);\r\n var gl = this._gl;\r\n if (texture.isCube) {\r\n if (faceIndex === undefined) {\r\n faceIndex = 0;\r\n }\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, lodLevel);\r\n if (depthStencilTexture) {\r\n if (depthStencilTexture._generateStencilBuffer) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n }\r\n }\r\n if (this._cachedViewport && !forceFullscreenViewport) {\r\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\r\n }\r\n else {\r\n if (!requiredWidth) {\r\n requiredWidth = texture.width;\r\n if (lodLevel) {\r\n requiredWidth = requiredWidth / Math.pow(2, lodLevel);\r\n }\r\n }\r\n if (!requiredHeight) {\r\n requiredHeight = texture.height;\r\n if (lodLevel) {\r\n requiredHeight = requiredHeight / Math.pow(2, lodLevel);\r\n }\r\n }\r\n this._viewport(0, 0, requiredWidth, requiredHeight);\r\n }\r\n this.wipeCaches();\r\n };\r\n /** @hidden */\r\n Engine.prototype._bindUnboundFramebuffer = function (framebuffer) {\r\n if (this._currentFramebuffer !== framebuffer) {\r\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer);\r\n this._currentFramebuffer = framebuffer;\r\n }\r\n };\r\n /**\r\n * Unbind the current render target texture from the webGL context\r\n * @param texture defines the render target texture to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n Engine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n // If MSAA, we need to bitblt back to main texture\r\n var gl = this._gl;\r\n if (texture._MSAAFramebuffer) {\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, texture._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, texture._framebuffer);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n if (onBeforeUnbind) {\r\n if (texture._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n };\r\n /**\r\n * Force the mipmap generation for the given render target texture\r\n * @param texture defines the render target texture to use\r\n */\r\n Engine.prototype.generateMipMapsForCubemap = function (texture) {\r\n if (texture.generateMipMaps) {\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n };\r\n /**\r\n * Force a webGL flush (ie. a flush of all waiting webGL commands)\r\n */\r\n Engine.prototype.flushFramebuffer = function () {\r\n this._gl.flush();\r\n };\r\n /**\r\n * Unbind the current render target and bind the default framebuffer\r\n */\r\n Engine.prototype.restoreDefaultFramebuffer = function () {\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(null);\r\n }\r\n if (this._cachedViewport) {\r\n this.setViewport(this._cachedViewport);\r\n }\r\n this.wipeCaches();\r\n };\r\n // UBOs\r\n /**\r\n * Create an uniform buffer\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n * @param elements defines the content of the uniform buffer\r\n * @returns the webGL uniform buffer\r\n */\r\n Engine.prototype.createUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create uniform buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n };\r\n /**\r\n * Create a dynamic uniform buffer\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n * @param elements defines the content of the uniform buffer\r\n * @returns the webGL uniform buffer\r\n */\r\n Engine.prototype.createDynamicUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create dynamic uniform buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n };\r\n /**\r\n * Update an existing uniform buffer\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n * @param uniformBuffer defines the target uniform buffer\r\n * @param elements defines the content to update\r\n * @param offset defines the offset in the uniform buffer where update should start\r\n * @param count defines the size of the data to update\r\n */\r\n Engine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {\r\n this.bindUniformBuffer(uniformBuffer);\r\n if (offset === undefined) {\r\n offset = 0;\r\n }\r\n if (count === undefined) {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));\r\n }\r\n }\r\n else {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));\r\n }\r\n }\r\n this.bindUniformBuffer(null);\r\n };\r\n // VBOs\r\n Engine.prototype._resetVertexBufferBinding = function () {\r\n this.bindArrayBuffer(null);\r\n this._cachedVertexBuffers = null;\r\n };\r\n /**\r\n * Creates a vertex buffer\r\n * @param data the data for the vertex buffer\r\n * @returns the new WebGL static buffer\r\n */\r\n Engine.prototype.createVertexBuffer = function (data) {\r\n var vbo = this._gl.createBuffer();\r\n if (!vbo) {\r\n throw new Error(\"Unable to create vertex buffer\");\r\n }\r\n var dataBuffer = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](vbo);\r\n this.bindArrayBuffer(dataBuffer);\r\n if (data instanceof Array) {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, this._gl.STATIC_DRAW);\r\n }\r\n this._resetVertexBufferBinding();\r\n dataBuffer.references = 1;\r\n return dataBuffer;\r\n };\r\n /**\r\n * Creates a dynamic vertex buffer\r\n * @param data the data for the dynamic vertex buffer\r\n * @returns the new WebGL dynamic buffer\r\n */\r\n Engine.prototype.createDynamicVertexBuffer = function (data) {\r\n var vbo = this._gl.createBuffer();\r\n if (!vbo) {\r\n throw new Error(\"Unable to create dynamic vertex buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](vbo);\r\n this.bindArrayBuffer(result);\r\n if (data instanceof Array) {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), this._gl.DYNAMIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, this._gl.DYNAMIC_DRAW);\r\n }\r\n this._resetVertexBufferBinding();\r\n result.references = 1;\r\n return result;\r\n };\r\n /**\r\n * Update a dynamic index buffer\r\n * @param indexBuffer defines the target index buffer\r\n * @param indices defines the data to update\r\n * @param offset defines the offset in the target index buffer where update should start\r\n */\r\n Engine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n // Force cache update\r\n this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;\r\n this.bindIndexBuffer(indexBuffer);\r\n var arrayBuffer;\r\n if (indices instanceof Uint16Array || indices instanceof Uint32Array) {\r\n arrayBuffer = indices;\r\n }\r\n else {\r\n arrayBuffer = indexBuffer.is32Bits ? new Uint32Array(indices) : new Uint16Array(indices);\r\n }\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, arrayBuffer, this._gl.DYNAMIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n };\r\n /**\r\n * Updates a dynamic vertex buffer.\r\n * @param vertexBuffer the vertex buffer to update\r\n * @param data the data used to update the vertex buffer\r\n * @param byteOffset the byte offset of the data\r\n * @param byteLength the byte length of the data\r\n */\r\n Engine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\r\n this.bindArrayBuffer(vertexBuffer);\r\n if (byteOffset === undefined) {\r\n byteOffset = 0;\r\n }\r\n if (byteLength === undefined) {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);\r\n }\r\n }\r\n else {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));\r\n }\r\n else {\r\n if (data instanceof ArrayBuffer) {\r\n data = new Uint8Array(data, byteOffset, byteLength);\r\n }\r\n else {\r\n data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\r\n }\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n }\r\n this._resetVertexBufferBinding();\r\n };\r\n Engine.prototype._resetIndexBufferBinding = function () {\r\n this.bindIndexBuffer(null);\r\n this._cachedIndexBuffer = null;\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the content of the index buffer\r\n * @param updatable defines if the index buffer must be updatable\r\n * @returns a new webGL buffer\r\n */\r\n Engine.prototype.createIndexBuffer = function (indices, updatable) {\r\n var vbo = this._gl.createBuffer();\r\n var dataBuffer = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](vbo);\r\n if (!vbo) {\r\n throw new Error(\"Unable to create index buffer\");\r\n }\r\n this.bindIndexBuffer(dataBuffer);\r\n var data = this._normalizeIndexData(indices);\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, data, updatable ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n dataBuffer.references = 1;\r\n dataBuffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);\r\n return dataBuffer;\r\n };\r\n Engine.prototype._normalizeIndexData = function (indices) {\r\n if (indices instanceof Uint16Array) {\r\n return indices;\r\n }\r\n // Check 32 bit support\r\n if (this._caps.uintIndices) {\r\n if (indices instanceof Uint32Array) {\r\n return indices;\r\n }\r\n else {\r\n // number[] or Int32Array, check if 32 bit is necessary\r\n for (var index = 0; index < indices.length; index++) {\r\n if (indices[index] >= 65535) {\r\n return new Uint32Array(indices);\r\n }\r\n }\r\n return new Uint16Array(indices);\r\n }\r\n }\r\n // No 32 bit support, force conversion to 16 bit (values greater 16 bit are lost)\r\n return new Uint16Array(indices);\r\n };\r\n /**\r\n * Bind a webGL buffer to the webGL context\r\n * @param buffer defines the buffer to bind\r\n */\r\n Engine.prototype.bindArrayBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ARRAY_BUFFER);\r\n };\r\n /**\r\n * Bind an uniform buffer to the current webGL context\r\n * @param buffer defines the buffer to bind\r\n */\r\n Engine.prototype.bindUniformBuffer = function (buffer) {\r\n this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);\r\n };\r\n /**\r\n * Bind a buffer to the current webGL context at a given location\r\n * @param buffer defines the buffer to bind\r\n * @param location defines the index where to bind the buffer\r\n */\r\n Engine.prototype.bindUniformBufferBase = function (buffer, location) {\r\n this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);\r\n };\r\n /**\r\n * Bind a specific block at a given index in a specific shader program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param blockName defines the block name\r\n * @param index defines the index where to bind the block\r\n */\r\n Engine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n var program = pipelineContext.program;\r\n var uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\r\n this._gl.uniformBlockBinding(program, uniformLocation, index);\r\n };\r\n Engine.prototype.bindIndexBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ELEMENT_ARRAY_BUFFER);\r\n };\r\n Engine.prototype.bindBuffer = function (buffer, target) {\r\n if (this._vaoRecordInProgress || this._currentBoundBuffer[target] !== buffer) {\r\n this._gl.bindBuffer(target, buffer ? buffer.underlyingResource : null);\r\n this._currentBoundBuffer[target] = buffer;\r\n }\r\n };\r\n /**\r\n * update the bound buffer with the given data\r\n * @param data defines the data to update\r\n */\r\n Engine.prototype.updateArrayBuffer = function (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n };\r\n Engine.prototype._vertexAttribPointer = function (buffer, indx, size, type, normalized, stride, offset) {\r\n var pointer = this._currentBufferPointers[indx];\r\n var changed = false;\r\n if (!pointer.active) {\r\n changed = true;\r\n pointer.active = true;\r\n pointer.index = indx;\r\n pointer.size = size;\r\n pointer.type = type;\r\n pointer.normalized = normalized;\r\n pointer.stride = stride;\r\n pointer.offset = offset;\r\n pointer.buffer = buffer;\r\n }\r\n else {\r\n if (pointer.buffer !== buffer) {\r\n pointer.buffer = buffer;\r\n changed = true;\r\n }\r\n if (pointer.size !== size) {\r\n pointer.size = size;\r\n changed = true;\r\n }\r\n if (pointer.type !== type) {\r\n pointer.type = type;\r\n changed = true;\r\n }\r\n if (pointer.normalized !== normalized) {\r\n pointer.normalized = normalized;\r\n changed = true;\r\n }\r\n if (pointer.stride !== stride) {\r\n pointer.stride = stride;\r\n changed = true;\r\n }\r\n if (pointer.offset !== offset) {\r\n pointer.offset = offset;\r\n changed = true;\r\n }\r\n }\r\n if (changed || this._vaoRecordInProgress) {\r\n this.bindArrayBuffer(buffer);\r\n this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset);\r\n }\r\n };\r\n Engine.prototype._bindIndexBufferWithCache = function (indexBuffer) {\r\n if (indexBuffer == null) {\r\n return;\r\n }\r\n if (this._cachedIndexBuffer !== indexBuffer) {\r\n this._cachedIndexBuffer = indexBuffer;\r\n this.bindIndexBuffer(indexBuffer);\r\n this._uintIndicesCurrentlySet = indexBuffer.is32Bits;\r\n }\r\n };\r\n Engine.prototype._bindVertexBuffersAttributes = function (vertexBuffers, effect) {\r\n var attributes = effect.getAttributesNames();\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.unbindAllAttributes();\r\n for (var index = 0; index < attributes.length; index++) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n var vertexBuffer = vertexBuffers[attributes[index]];\r\n if (!vertexBuffer) {\r\n continue;\r\n }\r\n this._gl.enableVertexAttribArray(order);\r\n if (!this._vaoRecordInProgress) {\r\n this._vertexAttribArraysEnabled[order] = true;\r\n }\r\n var buffer = vertexBuffer.getBuffer();\r\n if (buffer) {\r\n this._vertexAttribPointer(buffer, order, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized, vertexBuffer.byteStride, vertexBuffer.byteOffset);\r\n if (vertexBuffer.getIsInstanced()) {\r\n this._gl.vertexAttribDivisor(order, vertexBuffer.getInstanceDivisor());\r\n if (!this._vaoRecordInProgress) {\r\n this._currentInstanceLocations.push(order);\r\n this._currentInstanceBuffers.push(buffer);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Records a vertex array object\r\n * @see http://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexBuffers defines the list of vertex buffers to store\r\n * @param indexBuffer defines the index buffer to store\r\n * @param effect defines the effect to store\r\n * @returns the new vertex array object\r\n */\r\n Engine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {\r\n var vao = this._gl.createVertexArray();\r\n this._vaoRecordInProgress = true;\r\n this._gl.bindVertexArray(vao);\r\n this._mustWipeVertexAttributes = true;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n this.bindIndexBuffer(indexBuffer);\r\n this._vaoRecordInProgress = false;\r\n this._gl.bindVertexArray(null);\r\n return vao;\r\n };\r\n /**\r\n * Bind a specific vertex array object\r\n * @see http://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexArrayObject defines the vertex array object to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n */\r\n Engine.prototype.bindVertexArrayObject = function (vertexArrayObject, indexBuffer) {\r\n if (this._cachedVertexArrayObject !== vertexArrayObject) {\r\n this._cachedVertexArrayObject = vertexArrayObject;\r\n this._gl.bindVertexArray(vertexArrayObject);\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._uintIndicesCurrentlySet = indexBuffer != null && indexBuffer.is32Bits;\r\n this._mustWipeVertexAttributes = true;\r\n }\r\n };\r\n /**\r\n * Bind webGl buffers directly to the webGL context\r\n * @param vertexBuffer defines the vertex buffer to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer\r\n * @param vertexStrideSize defines the vertex stride of the vertex buffer\r\n * @param effect defines the effect associated with the vertex buffer\r\n */\r\n Engine.prototype.bindBuffersDirectly = function (vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffer || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffer;\r\n this._cachedEffectForVertexBuffers = effect;\r\n var attributesCount = effect.getAttributesCount();\r\n this._unbindVertexArrayObject();\r\n this.unbindAllAttributes();\r\n var offset = 0;\r\n for (var index = 0; index < attributesCount; index++) {\r\n if (index < vertexDeclaration.length) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n this._gl.enableVertexAttribArray(order);\r\n this._vertexAttribArraysEnabled[order] = true;\r\n this._vertexAttribPointer(vertexBuffer, order, vertexDeclaration[index], this._gl.FLOAT, false, vertexStrideSize, offset);\r\n }\r\n offset += vertexDeclaration[index] * 4;\r\n }\r\n }\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n Engine.prototype._unbindVertexArrayObject = function () {\r\n if (!this._cachedVertexArrayObject) {\r\n return;\r\n }\r\n this._cachedVertexArrayObject = null;\r\n this._gl.bindVertexArray(null);\r\n };\r\n /**\r\n * Bind a list of vertex buffers to the webGL context\r\n * @param vertexBuffers defines the list of vertex buffers to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param effect defines the effect associated with the vertex buffers\r\n */\r\n Engine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffers || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffers;\r\n this._cachedEffectForVertexBuffers = effect;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n /**\r\n * Unbind all instance attributes\r\n */\r\n Engine.prototype.unbindInstanceAttributes = function () {\r\n var boundBuffer;\r\n for (var i = 0, ul = this._currentInstanceLocations.length; i < ul; i++) {\r\n var instancesBuffer = this._currentInstanceBuffers[i];\r\n if (boundBuffer != instancesBuffer && instancesBuffer.references) {\r\n boundBuffer = instancesBuffer;\r\n this.bindArrayBuffer(instancesBuffer);\r\n }\r\n var offsetLocation = this._currentInstanceLocations[i];\r\n this._gl.vertexAttribDivisor(offsetLocation, 0);\r\n }\r\n this._currentInstanceBuffers.length = 0;\r\n this._currentInstanceLocations.length = 0;\r\n };\r\n /**\r\n * Release and free the memory of a vertex array object\r\n * @param vao defines the vertex array object to delete\r\n */\r\n Engine.prototype.releaseVertexArrayObject = function (vao) {\r\n this._gl.deleteVertexArray(vao);\r\n };\r\n /** @hidden */\r\n Engine.prototype._releaseBuffer = function (buffer) {\r\n buffer.references--;\r\n if (buffer.references === 0) {\r\n this._deleteBuffer(buffer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n Engine.prototype._deleteBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer.underlyingResource);\r\n };\r\n /**\r\n * Creates a webGL buffer to use with instanciation\r\n * @param capacity defines the size of the buffer\r\n * @returns the webGL buffer\r\n */\r\n Engine.prototype.createInstancesBuffer = function (capacity) {\r\n var buffer = this._gl.createBuffer();\r\n if (!buffer) {\r\n throw new Error(\"Unable to create instance buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](buffer);\r\n result.capacity = capacity;\r\n this.bindArrayBuffer(result);\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);\r\n return result;\r\n };\r\n /**\r\n * Delete a webGL buffer used with instanciation\r\n * @param buffer defines the webGL buffer to delete\r\n */\r\n Engine.prototype.deleteInstancesBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer);\r\n };\r\n /**\r\n * Update the content of a webGL buffer used with instanciation and bind it to the webGL context\r\n * @param instancesBuffer defines the webGL buffer to update and bind\r\n * @param data defines the data to store in the buffer\r\n * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer\r\n */\r\n Engine.prototype.updateAndBindInstancesBuffer = function (instancesBuffer, data, offsetLocations) {\r\n this.bindArrayBuffer(instancesBuffer);\r\n if (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n if (offsetLocations[0].index !== undefined) {\r\n var stride = 0;\r\n for (var i = 0; i < offsetLocations.length; i++) {\r\n var ai = offsetLocations[i];\r\n stride += ai.attributeSize * 4;\r\n }\r\n for (var i = 0; i < offsetLocations.length; i++) {\r\n var ai = offsetLocations[i];\r\n if (!this._vertexAttribArraysEnabled[ai.index]) {\r\n this._gl.enableVertexAttribArray(ai.index);\r\n this._vertexAttribArraysEnabled[ai.index] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attribyteType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);\r\n this._gl.vertexAttribDivisor(ai.index, 1);\r\n this._currentInstanceLocations.push(ai.index);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n else {\r\n for (var index = 0; index < 4; index++) {\r\n var offsetLocation = offsetLocations[index];\r\n if (!this._vertexAttribArraysEnabled[offsetLocation]) {\r\n this._gl.enableVertexAttribArray(offsetLocation);\r\n this._vertexAttribArraysEnabled[offsetLocation] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16);\r\n this._gl.vertexAttribDivisor(offsetLocation, 1);\r\n this._currentInstanceLocations.push(offsetLocation);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n };\r\n /**\r\n * Apply all cached states (depth, culling, stencil and alpha)\r\n */\r\n Engine.prototype.applyStates = function () {\r\n this._depthCullingState.apply(this._gl);\r\n this._stencilState.apply(this._gl);\r\n this._alphaState.apply(this._gl);\r\n };\r\n /**\r\n * Send a draw order\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {\r\n this.drawElementsType(useTriangles ? _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode : _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode, indexStart, indexCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of points\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawPointClouds = function (verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointFillMode, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawUnIndexed = function (useTriangles, verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(useTriangles ? _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode : _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of indexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._drawCalls.addCount(1, false);\r\n // Render\r\n var drawMode = this._drawMode(fillMode);\r\n var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\r\n var mult = this._uintIndicesCurrentlySet ? 4 : 2;\r\n if (instancesCount) {\r\n this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\r\n }\r\n else {\r\n this._gl.drawElements(drawMode, indexCount, indexFormat, indexStart * mult);\r\n }\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._drawCalls.addCount(1, false);\r\n var drawMode = this._drawMode(fillMode);\r\n if (instancesCount) {\r\n this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\r\n }\r\n else {\r\n this._gl.drawArrays(drawMode, verticesStart, verticesCount);\r\n }\r\n };\r\n Engine.prototype._drawMode = function (fillMode) {\r\n switch (fillMode) {\r\n // Triangle views\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode:\r\n return this._gl.TRIANGLES;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointFillMode:\r\n return this._gl.POINTS;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode:\r\n return this._gl.LINES;\r\n // Draw modes\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointListDrawMode:\r\n return this._gl.POINTS;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineListDrawMode:\r\n return this._gl.LINES;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineLoopDrawMode:\r\n return this._gl.LINE_LOOP;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineStripDrawMode:\r\n return this._gl.LINE_STRIP;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleStripDrawMode:\r\n return this._gl.TRIANGLE_STRIP;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFanDrawMode:\r\n return this._gl.TRIANGLE_FAN;\r\n default:\r\n return this._gl.TRIANGLES;\r\n }\r\n };\r\n // Shaders\r\n /** @hidden */\r\n Engine.prototype._releaseEffect = function (effect) {\r\n if (this._compiledEffects[effect._key]) {\r\n delete this._compiledEffects[effect._key];\r\n this._deletePipelineContext(effect.getPipelineContext());\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._deletePipelineContext = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (webGLPipelineContext && webGLPipelineContext.program) {\r\n webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;\r\n if (webGLPipelineContext.transformFeedback) {\r\n this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);\r\n webGLPipelineContext.transformFeedback = null;\r\n }\r\n this._gl.deleteProgram(webGLPipelineContext.program);\r\n }\r\n };\r\n /**\r\n * Create a new effect (used to store vertex/fragment shaders)\r\n * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)\r\n * @param attributesNamesOrOptions defines either a list of attribute names or an EffectCreationOptions object\r\n * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use\r\n * @param samplers defines an array of string used to represent textures\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param fallbacks defines the list of potential fallbacks to use if shader conmpilation fails\r\n * @param onCompiled defines a function to call when the effect creation is successful\r\n * @param onError defines a function to call when the effect creation has failed\r\n * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)\r\n * @returns the new Effect\r\n */\r\n Engine.prototype.createEffect = function (baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName;\r\n var name = vertex + \"+\" + fragment + \"@\" + (defines ? defines : attributesNamesOrOptions.defines);\r\n if (this._compiledEffects[name]) {\r\n var compiledEffect = this._compiledEffects[name];\r\n if (onCompiled && compiledEffect.isReady()) {\r\n onCompiled(compiledEffect);\r\n }\r\n return compiledEffect;\r\n }\r\n var effect = new _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"](baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters);\r\n effect._key = name;\r\n this._compiledEffects[name] = effect;\r\n return effect;\r\n };\r\n Engine._concatenateShader = function (source, defines, shaderVersion) {\r\n if (shaderVersion === void 0) { shaderVersion = \"\"; }\r\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\r\n };\r\n Engine.prototype._compileShader = function (source, type, defines, shaderVersion) {\r\n return this._compileRawShader(Engine._concatenateShader(source, defines, shaderVersion), type);\r\n };\r\n Engine.prototype._compileRawShader = function (source, type) {\r\n var gl = this._gl;\r\n var shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n if (!shader) {\r\n throw new Error(\"Something went wrong while compile the shader.\");\r\n }\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n return shader;\r\n };\r\n /**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n Engine.prototype.createRawShaderProgram = function (pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var vertexShader = this._compileRawShader(vertexCode, \"vertex\");\r\n var fragmentShader = this._compileRawShader(fragmentCode, \"fragment\");\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n Engine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n this.onBeforeShaderCompilationObservable.notifyObservers(this);\r\n var shaderVersion = (this._webGLVersion > 1) ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n var vertexShader = this._compileShader(vertexCode, \"vertex\", defines, shaderVersion);\r\n var fragmentShader = this._compileShader(fragmentCode, \"fragment\", defines, shaderVersion);\r\n var program = this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n this.onAfterShaderCompilationObservable.notifyObservers(this);\r\n return program;\r\n };\r\n /**\r\n * Creates a new pipeline context\r\n * @returns the new pipeline\r\n */\r\n Engine.prototype.createPipelineContext = function () {\r\n var pipelineContext = new _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_13__[\"WebGLPipelineContext\"]();\r\n pipelineContext.engine = this;\r\n if (this._caps.parallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n return pipelineContext;\r\n };\r\n Engine.prototype._createShaderProgram = function (pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n var shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n var transformFeedback = this.createTransformFeedback();\r\n this.bindTransformFeedback(transformFeedback);\r\n this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);\r\n pipelineContext.transformFeedback = transformFeedback;\r\n }\r\n context.linkProgram(shaderProgram);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n this.bindTransformFeedback(null);\r\n }\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n if (!pipelineContext.isParallelCompiled) {\r\n this._finalizePipelineContext(pipelineContext);\r\n }\r\n return shaderProgram;\r\n };\r\n Engine.prototype._finalizePipelineContext = function (pipelineContext) {\r\n var context = pipelineContext.context;\r\n var vertexShader = pipelineContext.vertexShader;\r\n var fragmentShader = pipelineContext.fragmentShader;\r\n var program = pipelineContext.program;\r\n var linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) { // Get more info\r\n // Vertex\r\n if (!this._gl.getShaderParameter(vertexShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n // Fragment\r\n if (!this._gl.getShaderParameter(fragmentShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n if (this.validateShaderPrograms) {\r\n context.validateProgram(program);\r\n var validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n if (!validated) {\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._preparePipelineContext = function (pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rebuildRebind, defines, transformFeedbackVaryings) {\r\n var webGLRenderingState = pipelineContext;\r\n if (createAsRaw) {\r\n webGLRenderingState.program = this.createRawShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\r\n }\r\n else {\r\n webGLRenderingState.program = this.createShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n };\r\n /** @hidden */\r\n Engine.prototype._isRenderingStateCompiled = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (this._gl.getProgramParameter(webGLPipelineContext.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\r\n this._finalizePipelineContext(webGLPipelineContext);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n Engine.prototype._executeWhenRenderingStateIsCompiled = function (pipelineContext, action) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action();\r\n return;\r\n }\r\n webGLPipelineContext.onCompiled = action;\r\n };\r\n /**\r\n * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param uniformsNames defines the list of uniform names\r\n * @returns an array of webGL uniform locations\r\n */\r\n Engine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n var results = new Array();\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < uniformsNames.length; index++) {\r\n results.push(this._gl.getUniformLocation(webGLPipelineContext.program, uniformsNames[index]));\r\n }\r\n return results;\r\n };\r\n /**\r\n * Gets the lsit of active attributes for a given webGL program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param attributesNames defines the list of attribute names to get\r\n * @returns an array of indices indicating the offset of each attribute\r\n */\r\n Engine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n var results = [];\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < attributesNames.length; index++) {\r\n try {\r\n results.push(this._gl.getAttribLocation(webGLPipelineContext.program, attributesNames[index]));\r\n }\r\n catch (e) {\r\n results.push(-1);\r\n }\r\n }\r\n return results;\r\n };\r\n /**\r\n * Activates an effect, mkaing it the current one (ie. the one used for rendering)\r\n * @param effect defines the effect to activate\r\n */\r\n Engine.prototype.enableEffect = function (effect) {\r\n if (!effect || effect === this._currentEffect) {\r\n return;\r\n }\r\n // Use program\r\n this.bindSamplers(effect);\r\n this._currentEffect = effect;\r\n if (effect.onBind) {\r\n effect.onBind(effect);\r\n }\r\n if (effect._onBindObservable) {\r\n effect._onBindObservable.notifyObservers(effect);\r\n }\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as matrices)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrices defines the array of float32 to store\r\n */\r\n Engine.prototype.setMatrices = function (uniform, matrices) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix4fv(uniform, false, matrices);\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (3x3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 3x3 matrix to store\r\n */\r\n Engine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix3fv(uniform, false, matrix);\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (2x2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 2x2 matrix to store\r\n */\r\n Engine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix2fv(uniform, false, matrix);\r\n };\r\n /**\r\n * Set the value of an uniform to a number (int)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the int number to store\r\n */\r\n Engine.prototype.setInt = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, value);\r\n };\r\n /**\r\n * Set the value of an uniform to a number (float)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the float number to store\r\n */\r\n Engine.prototype.setFloat = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1f(uniform, value);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec2\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n */\r\n Engine.prototype.setFloat2 = function (uniform, x, y) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform2f(uniform, x, y);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec3\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n */\r\n Engine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform3f(uniform, x, y, z);\r\n };\r\n /**\r\n * Set the value of an uniform to a boolean\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param bool defines the boolean to store\r\n */\r\n Engine.prototype.setBool = function (uniform, bool) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, bool);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec4\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n * @param w defines the 4th component of the value\r\n */\r\n Engine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform4f(uniform, x, y, z, w);\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniform defines the uniform location\r\n * @param color4 defines the value to be set\r\n */\r\n Engine.prototype.setDirectColor4 = function (uniform, color4) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform4f(uniform, color4.r, color4.g, color4.b, color4.a);\r\n };\r\n // States\r\n /**\r\n * Set various states to the webGL context\r\n * @param culling defines backface culling state\r\n * @param zOffset defines the value to apply to zOffset (0 by default)\r\n * @param force defines if states must be applied even if cache is up to date\r\n * @param reverseSide defines if culling must be reversed (CCW instead of CW and CW instead of CCW)\r\n */\r\n Engine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n // Culling\r\n if (this._depthCullingState.cull !== culling || force) {\r\n this._depthCullingState.cull = culling;\r\n }\r\n // Cull face\r\n var cullFace = this.cullBackFaces ? this._gl.BACK : this._gl.FRONT;\r\n if (this._depthCullingState.cullFace !== cullFace || force) {\r\n this._depthCullingState.cullFace = cullFace;\r\n }\r\n // Z offset\r\n this.setZOffset(zOffset);\r\n // Front face\r\n var frontFace = reverseSide ? this._gl.CW : this._gl.CCW;\r\n if (this._depthCullingState.frontFace !== frontFace || force) {\r\n this._depthCullingState.frontFace = frontFace;\r\n }\r\n };\r\n /**\r\n * Set the z offset to apply to current rendering\r\n * @param value defines the offset to apply\r\n */\r\n Engine.prototype.setZOffset = function (value) {\r\n this._depthCullingState.zOffset = value;\r\n };\r\n /**\r\n * Gets the current value of the zOffset\r\n * @returns the current zOffset state\r\n */\r\n Engine.prototype.getZOffset = function () {\r\n return this._depthCullingState.zOffset;\r\n };\r\n /**\r\n * Enable or disable depth buffering\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthBuffer = function (enable) {\r\n this._depthCullingState.depthTest = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if depth writing is enabled\r\n * @returns the current depth writing state\r\n */\r\n Engine.prototype.getDepthWrite = function () {\r\n return this._depthCullingState.depthMask;\r\n };\r\n /**\r\n * Enable or disable depth writing\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthWrite = function (enable) {\r\n this._depthCullingState.depthMask = enable;\r\n };\r\n /**\r\n * Enable or disable color writing\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setColorWrite = function (enable) {\r\n this._gl.colorMask(enable, enable, enable, enable);\r\n this._colorWrite = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if color writing is enabled\r\n * @returns the current color writing state\r\n */\r\n Engine.prototype.getColorWrite = function () {\r\n return this._colorWrite;\r\n };\r\n /**\r\n * Sets alpha constants used by some alpha blending modes\r\n * @param r defines the red component\r\n * @param g defines the green component\r\n * @param b defines the blue component\r\n * @param a defines the alpha component\r\n */\r\n Engine.prototype.setAlphaConstants = function (r, g, b, a) {\r\n this._alphaState.setAlphaBlendConstants(r, g, b, a);\r\n };\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n */\r\n Engine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n switch (mode) {\r\n case Engine.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Engine.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === Engine.ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n };\r\n /**\r\n * Gets the current alpha mode\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n * @returns the current alpha mode\r\n */\r\n Engine.prototype.getAlphaMode = function () {\r\n return this._alphaMode;\r\n };\r\n // Textures\r\n /**\r\n * Clears the list of texture accessible through engine.\r\n * This can help preventing texture load conflict due to name collision.\r\n */\r\n Engine.prototype.clearInternalTexturesCache = function () {\r\n this._internalTexturesCache = [];\r\n };\r\n /**\r\n * Force the entire cache to be cleared\r\n * You should not have to use this function unless your engine needs to share the webGL context with another engine\r\n * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)\r\n */\r\n Engine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames && !bruteForce) {\r\n return;\r\n }\r\n this._currentEffect = null;\r\n this._viewportCached.x = 0;\r\n this._viewportCached.y = 0;\r\n this._viewportCached.z = 0;\r\n this._viewportCached.w = 0;\r\n if (bruteForce) {\r\n this.resetTextureCache();\r\n this._currentProgram = null;\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this.setDepthFunctionToLessOrEqual();\r\n this._alphaState.reset();\r\n this._unpackFlipYCached = null;\r\n }\r\n this._resetVertexBufferBinding();\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n this._unbindVertexArrayObject();\r\n this.bindIndexBuffer(null);\r\n };\r\n /**\r\n * Set the compressed texture format to use, based on the formats you have, and the formats\r\n * supported by the hardware / browser.\r\n *\r\n * Khronos Texture Container (.ktx) files are used to support this. This format has the\r\n * advantage of being specifically designed for OpenGL. Header elements directly correspond\r\n * to API arguments needed to compressed textures. This puts the burden on the container\r\n * generator to house the arcane code for determining these for current & future formats.\r\n *\r\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\r\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\r\n *\r\n * Note: The result of this call is not taken into account when a texture is base64.\r\n *\r\n * @param formatsAvailable defines the list of those format families you have created\r\n * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)\r\n *\r\n * Current families are astc, dxt, pvrtc, etc2, & etc1.\r\n * @returns The extension selected.\r\n */\r\n Engine.prototype.setTextureFormatToUse = function (formatsAvailable) {\r\n for (var i = 0, len1 = this.texturesSupported.length; i < len1; i++) {\r\n for (var j = 0, len2 = formatsAvailable.length; j < len2; j++) {\r\n if (this._texturesSupported[i] === formatsAvailable[j].toLowerCase()) {\r\n return this._textureFormatInUse = this._texturesSupported[i];\r\n }\r\n }\r\n }\r\n // actively set format to nothing, to allow this to be called more than once\r\n // and possibly fail the 2nd time\r\n this._textureFormatInUse = null;\r\n return null;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getSamplingParameters = function (samplingMode, generateMipMaps) {\r\n var gl = this._gl;\r\n var magFilter = gl.NEAREST;\r\n var minFilter = gl.NEAREST;\r\n switch (samplingMode) {\r\n case Engine.TEXTURE_BILINEAR_SAMPLINGMODE:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_TRILINEAR_SAMPLINGMODE:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_SAMPLINGMODE:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_LINEAR:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case Engine.TEXTURE_NEAREST_NEAREST:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.NEAREST;\r\n break;\r\n case Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_LINEAR_LINEAR:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case Engine.TEXTURE_LINEAR_NEAREST:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.NEAREST;\r\n break;\r\n }\r\n return {\r\n min: minFilter,\r\n mag: magFilter\r\n };\r\n };\r\n /** @hidden */\r\n Engine.prototype._createTexture = function () {\r\n var texture = this._gl.createTexture();\r\n if (!texture) {\r\n throw new Error(\"Unable to create texture\");\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Usually called from Texture.ts.\r\n * Passed information to create a WebGLTexture\r\n * @param urlArg defines a value which contains one of the following:\r\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\r\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\r\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\r\n * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)\r\n * @param scene needed for loading to the correct scene\r\n * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param onLoad optional callback to be called upon successful completion\r\n * @param onError optional callback to be called upon failure\r\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob\r\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\r\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param excludeLoaders array of texture loaders that should be excluded when picking a loader for the texture (default: empty array)\r\n * @returns a InternalTexture for assignment back into BABYLON.Texture\r\n */\r\n Engine.prototype.createTexture = function (urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension, excludeLoaders) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (format === void 0) { format = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (excludeLoaders === void 0) { excludeLoaders = []; }\r\n var url = String(urlArg); // assign a new string, so that the original is still available in case of fallback\r\n var fromData = url.substr(0, 5) === \"data:\";\r\n var fromBlob = url.substr(0, 5) === \"blob:\";\r\n var isBase64 = fromData && url.indexOf(\";base64,\") !== -1;\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_URL);\r\n // establish the file extension, if possible\r\n var lastDot = url.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n for (var _i = 0, _a = Engine._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (excludeLoaders.indexOf(availableLoader) === -1 && availableLoader.canLoad(extension, this._textureFormatInUse, fallback, isBase64, buffer ? true : false)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n if (loader) {\r\n url = loader.transformUrl(url, this._textureFormatInUse);\r\n }\r\n if (scene) {\r\n scene._addPendingData(texture);\r\n }\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n if (!this._doNotHandleContextLost) {\r\n // Keep a link to the buffer only if we plan to handle context lost\r\n texture._buffer = buffer;\r\n }\r\n var onLoadObserver = null;\r\n if (onLoad && !fallback) {\r\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\r\n }\r\n if (!fallback) {\r\n this._internalTexturesCache.push(texture);\r\n }\r\n var onInternalError = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n var customFallback = false;\r\n if (loader) {\r\n var fallbackUrl = loader.getFallbackTextureUrl(url, _this._textureFormatInUse);\r\n if (fallbackUrl) {\r\n // Add Back\r\n customFallback = true;\r\n excludeLoaders.push(loader);\r\n _this.createTexture(urlArg, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture, undefined, undefined, excludeLoaders);\r\n return;\r\n }\r\n }\r\n if (!customFallback) {\r\n if (onLoadObserver) {\r\n texture.onLoadedObservable.remove(onLoadObserver);\r\n }\r\n if (_engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].UseFallbackTexture) {\r\n _this.createTexture(_engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture);\r\n return;\r\n }\r\n }\r\n if (onError) {\r\n onError(message || \"Unknown error\", exception);\r\n }\r\n };\r\n // processing for non-image formats\r\n if (loader) {\r\n var callback = function (data) {\r\n loader.loadData(data, texture, function (width, height, loadMipmap, isCompressed, done, loadFailed) {\r\n if (loadFailed) {\r\n onInternalError(\"TextureLoader failed to load data\");\r\n }\r\n else {\r\n _this._prepareWebGLTexture(texture, scene, width, height, texture.invertY, !loadMipmap, isCompressed, function () {\r\n done();\r\n return false;\r\n }, samplingMode);\r\n }\r\n });\r\n };\r\n if (!buffer) {\r\n this._loadFile(url, callback, undefined, scene ? scene.offlineProvider : undefined, true, function (request, exception) {\r\n onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\r\n });\r\n }\r\n else {\r\n //callback(buffer as ArrayBuffer);\r\n if (buffer instanceof ArrayBuffer) {\r\n callback(buffer);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Unable to load: only ArrayBuffer supported here\", null);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var onload = function (img) {\r\n if (fromBlob && !_this._doNotHandleContextLost) {\r\n // We need to store the image if we need to rebuild the texture\r\n // in case of a webgl context lost\r\n texture._buffer = img;\r\n }\r\n _this._prepareWebGLTexture(texture, scene, img.width, img.height, texture.invertY, noMipmap, false, function (potWidth, potHeight, continuationCallback) {\r\n var gl = _this._gl;\r\n var isPot = (img.width === potWidth && img.height === potHeight);\r\n var internalFormat = format ? _this._getInternalFormat(format) : ((extension === \".jpg\") ? gl.RGB : gl.RGBA);\r\n if (isPot) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n return false;\r\n }\r\n var maxTextureSize = _this._caps.maxTextureSize;\r\n if (img.width > maxTextureSize || img.height > maxTextureSize || Engine._RescalePostProcessFactory === null) {\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n return false;\r\n }\r\n _this._workingCanvas.width = potWidth;\r\n _this._workingCanvas.height = potHeight;\r\n _this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n return false;\r\n }\r\n else {\r\n // Using shaders when possible to rescale because canvas.drawImage is lossy\r\n var source_1 = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](_this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, source_1, true);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n _this._rescaleTexture(source_1, texture, scene, internalFormat, function () {\r\n _this._releaseTexture(source_1);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n continuationCallback();\r\n });\r\n }\r\n return true;\r\n }, samplingMode);\r\n };\r\n if (!fromData || isBase64) {\r\n if (buffer instanceof HTMLImageElement) {\r\n onload(buffer);\r\n }\r\n else {\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__[\"FileTools\"].LoadImage(url, onload, onInternalError, scene ? scene.offlineProvider : null);\r\n }\r\n }\r\n else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__[\"FileTools\"].LoadImage(buffer, onload, onInternalError, scene ? scene.offlineProvider : null);\r\n }\r\n else {\r\n onload(buffer);\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * @hidden\r\n * Rescales a texture\r\n * @param source input texutre\r\n * @param destination destination texture\r\n * @param scene scene to use to render the resize\r\n * @param internalFormat format to use when resizing\r\n * @param onComplete callback to be called when resize has completed\r\n */\r\n Engine.prototype._rescaleTexture = function (source, destination, scene, internalFormat, onComplete) {\r\n var _this = this;\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);\r\n var rtt = this.createRenderTargetTexture({\r\n width: destination.width,\r\n height: destination.height,\r\n }, {\r\n generateMipMaps: false,\r\n type: Engine.TEXTURETYPE_UNSIGNED_INT,\r\n samplingMode: Engine.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false\r\n });\r\n if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {\r\n this._rescalePostProcess = Engine._RescalePostProcessFactory(this);\r\n }\r\n this._rescalePostProcess.getEffect().executeWhenCompiled(function () {\r\n _this._rescalePostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", source);\r\n };\r\n var hostingScene = scene;\r\n if (!hostingScene) {\r\n hostingScene = _this.scenes[_this.scenes.length - 1];\r\n }\r\n hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);\r\n _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination, true);\r\n _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);\r\n _this.unBindFramebuffer(rtt);\r\n _this._releaseTexture(rtt);\r\n if (onComplete) {\r\n onComplete();\r\n }\r\n });\r\n };\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n Engine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = Engine.TEXTURETYPE_UNSIGNED_INT; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"Engine.RawTexture\");\r\n };\r\n /** @hidden */\r\n Engine.prototype._unpackFlipY = function (value) {\r\n if (this._unpackFlipYCached !== value) {\r\n this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);\r\n if (this.enableUnpackFlipYCached) {\r\n this._unpackFlipYCached = value;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._getUnpackAlignement = function () {\r\n return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);\r\n };\r\n /**\r\n * Creates a dynamic texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @returns the dynamic texture inside an InternalTexture\r\n */\r\n Engine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_DYNAMIC);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n if (generateMipMaps) {\r\n width = this.needPOTTextures ? Engine.GetExponentOfTwo(width, this._caps.maxTextureSize) : width;\r\n height = this.needPOTTextures ? Engine.GetExponentOfTwo(height, this._caps.maxTextureSize) : height;\r\n }\r\n // this.resetTextureCache();\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = false;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n this.updateTextureSamplingMode(samplingMode, texture);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n /**\r\n * Update the sampling mode of a given texture\r\n * @param samplingMode defines the required sampling mode\r\n * @param texture defines the texture to update\r\n */\r\n Engine.prototype.updateTextureSamplingMode = function (samplingMode, texture) {\r\n var filters = this._getSamplingParameters(samplingMode, texture.generateMipMaps);\r\n if (texture.isCube) {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else if (texture.is3D) {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n else {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n texture.samplingMode = samplingMode;\r\n };\r\n /**\r\n * Update the content of a dynamic texture\r\n * @param texture defines the texture to update\r\n * @param canvas defines the canvas containing the source\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param premulAlpha defines if alpha is stored as premultiplied\r\n * @param format defines the format of the data\r\n * @param forceBindTexture if the texture should be forced to be bound eg. after a graphics context loss (Default: false)\r\n */\r\n Engine.prototype.updateDynamicTexture = function (texture, canvas, invertY, premulAlpha, format, forceBindTexture) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n if (forceBindTexture === void 0) { forceBindTexture = false; }\r\n if (!texture) {\r\n return;\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true, forceBindTexture);\r\n this._unpackFlipY(invertY);\r\n if (premulAlpha) {\r\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);\r\n }\r\n var internalFormat = format ? this._getInternalFormat(format) : this._gl.RGBA;\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalFormat, internalFormat, this._gl.UNSIGNED_BYTE, canvas);\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n if (premulAlpha) {\r\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\r\n }\r\n texture.isReady = true;\r\n };\r\n /**\r\n * Update a video texture\r\n * @param texture defines the texture to update\r\n * @param video defines the video element to use\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n Engine.prototype.updateVideoTexture = function (texture, video, invertY) {\r\n if (!texture || texture._isDisabled) {\r\n return;\r\n }\r\n var wasPreviouslyBound = this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(!invertY); // Video are upside down by default\r\n try {\r\n // Testing video texture support\r\n if (this._videoTextureSupported === undefined) {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, video);\r\n if (this._gl.getError() !== 0) {\r\n this._videoTextureSupported = false;\r\n }\r\n else {\r\n this._videoTextureSupported = true;\r\n }\r\n }\r\n // Copy video through the current working canvas if video texture is not supported\r\n if (!this._videoTextureSupported) {\r\n if (!texture._workingCanvas) {\r\n texture._workingCanvas = document.createElement(\"canvas\");\r\n var context = texture._workingCanvas.getContext(\"2d\");\r\n if (!context) {\r\n throw new Error(\"Unable to get 2d context\");\r\n }\r\n texture._workingContext = context;\r\n texture._workingCanvas.width = texture.width;\r\n texture._workingCanvas.height = texture.height;\r\n }\r\n texture._workingContext.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, texture.width, texture.height);\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, texture._workingCanvas);\r\n }\r\n else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, video);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n if (!wasPreviouslyBound) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n }\r\n catch (ex) {\r\n // Something unexpected\r\n // Let's disable the texture\r\n texture._isDisabled = true;\r\n }\r\n };\r\n /**\r\n * Updates a depth texture Comparison Mode and Function.\r\n * If the comparison Function is equal to 0, the mode will be set to none.\r\n * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.\r\n * @param texture The texture to set the comparison function for\r\n * @param comparisonFunction The comparison function to set, 0 if no comparison required\r\n */\r\n Engine.prototype.updateTextureComparisonFunction = function (texture, comparisonFunction) {\r\n if (this.webGLVersion === 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Error(\"WebGL 1 does not support texture comparison.\");\r\n return;\r\n }\r\n var gl = this._gl;\r\n if (texture.isCube) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, Engine.LEQUAL);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, Engine.LEQUAL);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n texture._comparisonFunction = comparisonFunction;\r\n };\r\n /** @hidden */\r\n Engine.prototype._setupDepthStencilTexture = function (internalTexture, size, generateStencil, bilinearFiltering, comparisonFunction) {\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n internalTexture.baseWidth = width;\r\n internalTexture.baseHeight = height;\r\n internalTexture.width = width;\r\n internalTexture.height = height;\r\n internalTexture.isReady = true;\r\n internalTexture.samples = 1;\r\n internalTexture.generateMipMaps = false;\r\n internalTexture._generateDepthBuffer = true;\r\n internalTexture._generateStencilBuffer = generateStencil;\r\n internalTexture.samplingMode = bilinearFiltering ? Engine.TEXTURE_BILINEAR_SAMPLINGMODE : Engine.TEXTURE_NEAREST_SAMPLINGMODE;\r\n internalTexture.type = Engine.TEXTURETYPE_UNSIGNED_INT;\r\n internalTexture._comparisonFunction = comparisonFunction;\r\n var gl = this._gl;\r\n var target = internalTexture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n var samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);\r\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);\r\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, Engine.LEQUAL);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n };\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @returns The texture\r\n */\r\n Engine.prototype.createDepthStencilTexture = function (size, options) {\r\n if (options.isCube) {\r\n var width = size.width || size;\r\n return this._createDepthStencilCubeTexture(width, options);\r\n }\r\n else {\r\n return this._createDepthStencilTexture(size, options);\r\n }\r\n };\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @returns The texture\r\n */\r\n Engine.prototype._createDepthStencilTexture = function (size, options) {\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_DEPTHTEXTURE);\r\n if (!this._caps.depthTextureExtension) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_2D, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n if (this.webGLVersion > 1) {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH24_STENCIL8, internalTexture.width, internalTexture.height, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT24, internalTexture.width, internalTexture.height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n else {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_STENCIL, internalTexture.width, internalTexture.height, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, internalTexture.width, internalTexture.height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n return internalTexture;\r\n };\r\n /**\r\n * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.\r\n * @param renderTarget The render target to set the frame buffer for\r\n */\r\n Engine.prototype.setFrameBufferDepthStencilTexture = function (renderTarget) {\r\n // Create the framebuffer\r\n var internalTexture = renderTarget.getInternalTexture();\r\n if (!internalTexture || !internalTexture._framebuffer || !renderTarget.depthStencilTexture) {\r\n return;\r\n }\r\n var gl = this._gl;\r\n var depthStencilTexture = renderTarget.depthStencilTexture;\r\n this._bindUnboundFramebuffer(internalTexture._framebuffer);\r\n if (depthStencilTexture.isCube) {\r\n if (depthStencilTexture._generateStencilBuffer) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);\r\n }\r\n }\r\n else {\r\n if (depthStencilTexture._generateStencilBuffer) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);\r\n }\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n };\r\n /**\r\n * Creates a new render target texture\r\n * @param size defines the size of the texture\r\n * @param options defines the options used to create the texture\r\n * @returns a new render target texture stored in an InternalTexture\r\n */\r\n Engine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_11__[\"RenderTargetCreationOptions\"]();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? Engine.TEXTURETYPE_UNSIGNED_INT : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? Engine.TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;\r\n fullOptions.format = options.format === undefined ? Engine.TEXTUREFORMAT_RGBA : options.format;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = Engine.TEXTURETYPE_UNSIGNED_INT;\r\n fullOptions.samplingMode = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n fullOptions.format = Engine.TEXTUREFORMAT_RGBA;\r\n }\r\n if (fullOptions.type === Engine.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n else if (fullOptions.type === Engine.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n var gl = this._gl;\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps ? true : false);\r\n if (fullOptions.type === Engine.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n fullOptions.type = Engine.TEXTURETYPE_UNSIGNED_INT;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);\r\n // Create the framebuffer\r\n var currentFrameBuffer = this._currentFramebuffer;\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);\r\n if (fullOptions.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n texture._framebuffer = framebuffer;\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n // this.resetTextureCache();\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n /** @hidden */\r\n Engine.prototype._setupFramebufferDepthAttachments = function (generateStencilBuffer, generateDepthBuffer, width, height, samples) {\r\n if (samples === void 0) { samples = 1; }\r\n var depthStencilBuffer = null;\r\n var gl = this._gl;\r\n // Create the depth/stencil buffer\r\n if (generateStencilBuffer) {\r\n depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH24_STENCIL8, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);\r\n }\r\n else if (generateDepthBuffer) {\r\n depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH_COMPONENT16, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);\r\n }\r\n return depthStencilBuffer;\r\n };\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see http://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param texture defines the texture to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n Engine.prototype.updateRenderTargetTextureSampleCount = function (texture, samples) {\r\n if (this.webGLVersion < 2 || !texture) {\r\n return 1;\r\n }\r\n if (texture.samples === samples) {\r\n return samples;\r\n }\r\n var gl = this._gl;\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n // Dispose previous render buffers\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n if (samples > 1) {\r\n var framebuffer = gl.createFramebuffer();\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n texture._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer);\r\n var colorRenderbuffer = gl.createRenderbuffer();\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, colorRenderbuffer);\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, this._getRGBAMultiSampleBufferFormat(texture.type), texture.width, texture.height);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorRenderbuffer);\r\n texture._MSAARenderBuffer = colorRenderbuffer;\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n texture.samples = samples;\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(texture._generateStencilBuffer, texture._generateDepthBuffer, texture.width, texture.height, samples);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(null);\r\n return samples;\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod, babylonInternalFormat, useTextureWidthAndHeight) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n if (useTextureWidthAndHeight === void 0) { useTextureWidthAndHeight = false; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = babylonInternalFormat === undefined ? this._getRGBABufferInternalSizedFormat(texture.type, format) : this._getInternalFormat(babylonInternalFormat);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n var lodMaxWidth = Math.round(Math.log(texture.width) * Math.LOG2E);\r\n var lodMaxHeight = Math.round(Math.log(texture.height) * Math.LOG2E);\r\n var width = useTextureWidthAndHeight ? texture.width : Math.pow(2, Math.max(lodMaxWidth - lod, 0));\r\n var height = useTextureWidthAndHeight ? texture.height : Math.pow(2, Math.max(lodMaxHeight - lod, 0));\r\n gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n gl.texImage2D(target, lod, internalFormat, format, textureType, image);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Engine.prototype._setCubeMapTextureParams = function (loadMipmap) {\r\n var gl = this._gl;\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, loadMipmap ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n };\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n Engine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n Engine.prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = Engine.TEXTURETYPE_UNSIGNED_INT; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"Engine.RawTexture\");\r\n };\r\n Engine.prototype._prepareWebGLTextureContinuation = function (texture, scene, noMipmap, isCompressed, samplingMode) {\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, !noMipmap);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (!noMipmap && !isCompressed) {\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n };\r\n Engine.prototype._prepareWebGLTexture = function (texture, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n var maxTextureSize = this.getCaps().maxTextureSize;\r\n var potWidth = Math.min(maxTextureSize, this.needPOTTextures ? Engine.GetExponentOfTwo(width, maxTextureSize) : width);\r\n var potHeight = Math.min(maxTextureSize, this.needPOTTextures ? Engine.GetExponentOfTwo(height, maxTextureSize) : height);\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n if (!texture._webGLTexture) {\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n return;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n texture.isReady = true;\r\n if (processFunction(potWidth, potHeight, function () {\r\n _this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n })) {\r\n // Returning as texture needs extra async steps\r\n return;\r\n }\r\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n };\r\n /** @hidden */\r\n Engine.prototype._convertRGBtoRGBATextureData = function (rgbData, width, height, textureType) {\r\n // Create new RGBA data container.\r\n var rgbaData;\r\n if (textureType === Engine.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n }\r\n else {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n }\r\n // Convert each pixel.\r\n for (var x = 0; x < width; x++) {\r\n for (var y = 0; y < height; y++) {\r\n var index = (y * width + x) * 3;\r\n var newIndex = (y * width + x) * 4;\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = 1;\r\n }\r\n }\r\n return rgbaData;\r\n };\r\n /** @hidden */\r\n Engine.prototype._releaseFramebufferObjects = function (texture) {\r\n var gl = this._gl;\r\n if (texture._framebuffer) {\r\n gl.deleteFramebuffer(texture._framebuffer);\r\n texture._framebuffer = null;\r\n }\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._releaseTexture = function (texture) {\r\n this._releaseFramebufferObjects(texture);\r\n this._deleteTexture(texture._webGLTexture);\r\n // Unbind channels\r\n this.unbindAllTextures();\r\n var index = this._internalTexturesCache.indexOf(texture);\r\n if (index !== -1) {\r\n this._internalTexturesCache.splice(index, 1);\r\n }\r\n // Integrated fixed lod samplers.\r\n if (texture._lodTextureHigh) {\r\n texture._lodTextureHigh.dispose();\r\n }\r\n if (texture._lodTextureMid) {\r\n texture._lodTextureMid.dispose();\r\n }\r\n if (texture._lodTextureLow) {\r\n texture._lodTextureLow.dispose();\r\n }\r\n // Integrated irradiance map.\r\n if (texture._irradianceTexture) {\r\n texture._irradianceTexture.dispose();\r\n }\r\n // Set output texture of post process to null if the texture has been released/disposed\r\n this.scenes.forEach(function (scene) {\r\n scene.postProcesses.forEach(function (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n });\r\n scene.cameras.forEach(function (camera) {\r\n camera._postProcesses.forEach(function (postProcess) {\r\n if (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n }\r\n });\r\n });\r\n });\r\n };\r\n Engine.prototype._deleteTexture = function (texture) {\r\n this._gl.deleteTexture(texture);\r\n };\r\n Engine.prototype._setProgram = function (program) {\r\n if (this._currentProgram !== program) {\r\n this._gl.useProgram(program);\r\n this._currentProgram = program;\r\n }\r\n };\r\n /**\r\n * Binds an effect to the webGL context\r\n * @param effect defines the effect to bind\r\n */\r\n Engine.prototype.bindSamplers = function (effect) {\r\n var webGLPipelineContext = effect.getPipelineContext();\r\n this._setProgram(webGLPipelineContext.program);\r\n var samplers = effect.getSamplers();\r\n for (var index = 0; index < samplers.length; index++) {\r\n var uniform = effect.getUniform(samplers[index]);\r\n if (uniform) {\r\n this._boundUniforms[index] = uniform;\r\n }\r\n }\r\n this._currentEffect = null;\r\n };\r\n Engine.prototype._activateCurrentTexture = function () {\r\n if (this._currentTextureChannel !== this._activeChannel) {\r\n this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel);\r\n this._currentTextureChannel = this._activeChannel;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._bindTextureDirectly = function (target, texture, forTextureDataUpdate, force) {\r\n if (forTextureDataUpdate === void 0) { forTextureDataUpdate = false; }\r\n if (force === void 0) { force = false; }\r\n var wasPreviouslyBound = false;\r\n var isTextureForRendering = texture && texture._associatedChannel > -1;\r\n if (forTextureDataUpdate && isTextureForRendering) {\r\n this._activeChannel = texture._associatedChannel;\r\n }\r\n var currentTextureBound = this._boundTexturesCache[this._activeChannel];\r\n if (currentTextureBound !== texture || force) {\r\n this._activateCurrentTexture();\r\n if (texture && texture.isMultiview) {\r\n this._gl.bindTexture(target, texture ? texture._colorTextureArray : null);\r\n }\r\n else {\r\n this._gl.bindTexture(target, texture ? texture._webGLTexture : null);\r\n }\r\n this._boundTexturesCache[this._activeChannel] = texture;\r\n if (texture) {\r\n texture._associatedChannel = this._activeChannel;\r\n }\r\n }\r\n else if (forTextureDataUpdate) {\r\n wasPreviouslyBound = true;\r\n this._activateCurrentTexture();\r\n }\r\n if (isTextureForRendering && !forTextureDataUpdate) {\r\n this._bindSamplerUniformToChannel(texture._associatedChannel, this._activeChannel);\r\n }\r\n return wasPreviouslyBound;\r\n };\r\n /** @hidden */\r\n Engine.prototype._bindTexture = function (channel, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (texture) {\r\n texture._associatedChannel = channel;\r\n }\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);\r\n };\r\n /**\r\n * Sets a texture to the webGL context from a postprocess\r\n * @param channel defines the channel to use\r\n * @param postProcess defines the source postprocess\r\n */\r\n Engine.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._textures.data[postProcess._currentRenderTextureInd] : null);\r\n };\r\n /**\r\n * Binds the output of the passed in post process to the texture channel specified\r\n * @param channel The channel the texture should be bound to\r\n * @param postProcess The post process which's output should be bound\r\n */\r\n Engine.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._outputTexture : null);\r\n };\r\n /**\r\n * Unbind all textures from the webGL context\r\n */\r\n Engine.prototype.unbindAllTextures = function () {\r\n for (var channel = 0; channel < this._maxSimultaneousTextures; channel++) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a texture to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The texture to apply\r\n */\r\n Engine.prototype.setTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n this._setTexture(channel, texture);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The render target texture containing the depth stencil texture to apply\r\n */\r\n Engine.prototype.setDepthStencilTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n if (!texture || !texture.depthStencilTexture) {\r\n this._setTexture(channel, null);\r\n }\r\n else {\r\n this._setTexture(channel, texture, false, true);\r\n }\r\n };\r\n Engine.prototype._bindSamplerUniformToChannel = function (sourceSlot, destination) {\r\n var uniform = this._boundUniforms[sourceSlot];\r\n if (!uniform || uniform._currentState === destination) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, destination);\r\n uniform._currentState = destination;\r\n };\r\n Engine.prototype._getTextureWrapMode = function (mode) {\r\n switch (mode) {\r\n case Engine.TEXTURE_WRAP_ADDRESSMODE:\r\n return this._gl.REPEAT;\r\n case Engine.TEXTURE_CLAMP_ADDRESSMODE:\r\n return this._gl.CLAMP_TO_EDGE;\r\n case Engine.TEXTURE_MIRROR_ADDRESSMODE:\r\n return this._gl.MIRRORED_REPEAT;\r\n }\r\n return this._gl.REPEAT;\r\n };\r\n Engine.prototype._setTexture = function (channel, texture, isPartOfTextureArray, depthStencilTexture) {\r\n if (isPartOfTextureArray === void 0) { isPartOfTextureArray = false; }\r\n if (depthStencilTexture === void 0) { depthStencilTexture = false; }\r\n // Not ready?\r\n if (!texture) {\r\n if (this._boundTexturesCache[channel] != null) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n }\r\n return false;\r\n }\r\n // Video\r\n if (texture.video) {\r\n this._activeChannel = channel;\r\n texture.update();\r\n }\r\n else if (texture.delayLoadState === Engine.DELAYLOADSTATE_NOTLOADED) { // Delay loading\r\n texture.delayLoad();\r\n return false;\r\n }\r\n var internalTexture;\r\n if (depthStencilTexture) {\r\n internalTexture = texture.depthStencilTexture;\r\n }\r\n else if (texture.isReady()) {\r\n internalTexture = texture.getInternalTexture();\r\n }\r\n else if (texture.isCube) {\r\n internalTexture = this.emptyCubeTexture;\r\n }\r\n else if (texture.is3D) {\r\n internalTexture = this.emptyTexture3D;\r\n }\r\n else {\r\n internalTexture = this.emptyTexture;\r\n }\r\n if (!isPartOfTextureArray && internalTexture) {\r\n internalTexture._associatedChannel = channel;\r\n }\r\n var needToBind = true;\r\n if (this._boundTexturesCache[channel] === internalTexture) {\r\n if (!isPartOfTextureArray) {\r\n this._bindSamplerUniformToChannel(internalTexture._associatedChannel, channel);\r\n }\r\n needToBind = false;\r\n }\r\n this._activeChannel = channel;\r\n if (internalTexture && internalTexture.isMultiview) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, internalTexture, isPartOfTextureArray);\r\n }\r\n }\r\n else if (internalTexture && internalTexture.is3D) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapR !== texture.wrapR) {\r\n internalTexture._cachedWrapR = texture.wrapR;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(texture.wrapR), internalTexture);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_3D, texture);\r\n }\r\n else if (internalTexture && internalTexture.isCube) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {\r\n internalTexture._cachedCoordinatesMode = texture.coordinatesMode;\r\n // CUBIC_MODE and SKYBOX_MODE both require CLAMP_TO_EDGE. All other modes use REPEAT.\r\n var textureWrapMode = (texture.coordinatesMode !== Engine.TEXTURE_CUBIC_MODE && texture.coordinatesMode !== Engine.TEXTURE_SKYBOX_MODE) ? this._gl.REPEAT : this._gl.CLAMP_TO_EDGE;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_S, textureWrapMode, internalTexture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_T, textureWrapMode);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, texture);\r\n }\r\n else {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_2D, texture);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sets an array of texture to the webGL context\r\n * @param channel defines the channel where the texture array must be set\r\n * @param uniform defines the associated uniform location\r\n * @param textures defines the array of textures to bind\r\n */\r\n Engine.prototype.setTextureArray = function (channel, uniform, textures) {\r\n if (channel === undefined || !uniform) {\r\n return;\r\n }\r\n if (!this._textureUnits || this._textureUnits.length !== textures.length) {\r\n this._textureUnits = new Int32Array(textures.length);\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i].getInternalTexture();\r\n if (texture) {\r\n this._textureUnits[i] = channel + i;\r\n texture._associatedChannel = channel + i;\r\n }\r\n else {\r\n this._textureUnits[i] = -1;\r\n }\r\n }\r\n this._gl.uniform1iv(uniform, this._textureUnits);\r\n for (var index = 0; index < textures.length; index++) {\r\n this._setTexture(this._textureUnits[index], textures[index], true);\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._setAnisotropicLevel = function (target, texture) {\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return;\r\n }\r\n var anisotropicFilterExtension = this._caps.textureAnisotropicFilterExtension;\r\n var value = texture.anisotropicFilteringLevel;\r\n if (internalTexture.samplingMode !== Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST\r\n && internalTexture.samplingMode !== Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR\r\n && internalTexture.samplingMode !== Engine.TEXTURE_LINEAR_LINEAR) {\r\n value = 1; // Forcing the anisotropic to 1 because else webgl will force filters to linear\r\n }\r\n if (anisotropicFilterExtension && internalTexture._cachedAnisotropicFilteringLevel !== value) {\r\n this._setTextureParameterFloat(target, anisotropicFilterExtension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(value, this._caps.maxAnisotropy), internalTexture);\r\n internalTexture._cachedAnisotropicFilteringLevel = value;\r\n }\r\n };\r\n Engine.prototype._setTextureParameterFloat = function (target, parameter, value, texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n this._gl.texParameterf(target, parameter, value);\r\n };\r\n Engine.prototype._setTextureParameterInteger = function (target, parameter, value, texture) {\r\n if (texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n }\r\n this._gl.texParameteri(target, parameter, value);\r\n };\r\n /**\r\n * Reads pixels from the current frame buffer. Please note that this function can be slow\r\n * @param x defines the x coordinate of the rectangle where pixels must be read\r\n * @param y defines the y coordinate of the rectangle where pixels must be read\r\n * @param width defines the width of the rectangle where pixels must be read\r\n * @param height defines the height of the rectangle where pixels must be read\r\n * @returns a Uint8Array containing RGBA colors\r\n */\r\n Engine.prototype.readPixels = function (x, y, width, height) {\r\n var data = new Uint8Array(height * width * 4);\r\n this._gl.readPixels(x, y, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data);\r\n return data;\r\n };\r\n /**\r\n * Add an externaly attached data from its key.\r\n * This method call will fail and return false, if such key already exists.\r\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\r\n * @param key the unique key that identifies the data\r\n * @param data the data object to associate to the key for this Engine instance\r\n * @return true if no such key were already present and the data was added successfully, false otherwise\r\n */\r\n Engine.prototype.addExternalData = function (key, data) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.add(key, data);\r\n };\r\n /**\r\n * Get an externaly attached data from its key\r\n * @param key the unique key that identifies the data\r\n * @return the associated data, if present (can be null), or undefined if not present\r\n */\r\n Engine.prototype.getExternalData = function (key) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.get(key);\r\n };\r\n /**\r\n * Get an externaly attached data from its key, create it using a factory if it's not already present\r\n * @param key the unique key that identifies the data\r\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\r\n * @return the associated data, can be null if the factory returned null.\r\n */\r\n Engine.prototype.getOrAddExternalDataWithFactory = function (key, factory) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.getOrAddWithFactory(key, factory);\r\n };\r\n /**\r\n * Remove an externaly attached data from the Engine instance\r\n * @param key the unique key that identifies the data\r\n * @return true if the data was successfully removed, false if it doesn't exist\r\n */\r\n Engine.prototype.removeExternalData = function (key) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.remove(key);\r\n };\r\n /**\r\n * Unbind all vertex attributes from the webGL context\r\n */\r\n Engine.prototype.unbindAllAttributes = function () {\r\n if (this._mustWipeVertexAttributes) {\r\n this._mustWipeVertexAttributes = false;\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._gl.disableVertexAttribArray(i);\r\n this._vertexAttribArraysEnabled[i] = false;\r\n this._currentBufferPointers[i].active = false;\r\n }\r\n return;\r\n }\r\n for (var i = 0, ul = this._vertexAttribArraysEnabled.length; i < ul; i++) {\r\n if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {\r\n continue;\r\n }\r\n this._gl.disableVertexAttribArray(i);\r\n this._vertexAttribArraysEnabled[i] = false;\r\n this._currentBufferPointers[i].active = false;\r\n }\r\n };\r\n /**\r\n * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled\r\n */\r\n Engine.prototype.releaseEffects = function () {\r\n for (var name in this._compiledEffects) {\r\n var webGLPipelineContext = this._compiledEffects[name].getPipelineContext();\r\n this._deletePipelineContext(webGLPipelineContext);\r\n }\r\n this._compiledEffects = {};\r\n };\r\n /**\r\n * Dispose and release all associated resources\r\n */\r\n Engine.prototype.dispose = function () {\r\n this.hideLoadingUI();\r\n this.stopRenderLoop();\r\n this.onNewSceneAddedObservable.clear();\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Empty texture\r\n if (this._emptyTexture) {\r\n this._releaseTexture(this._emptyTexture);\r\n this._emptyTexture = null;\r\n }\r\n if (this._emptyCubeTexture) {\r\n this._releaseTexture(this._emptyCubeTexture);\r\n this._emptyCubeTexture = null;\r\n }\r\n // Rescale PP\r\n if (this._rescalePostProcess) {\r\n this._rescalePostProcess.dispose();\r\n }\r\n // Release scenes\r\n while (this.scenes.length) {\r\n this.scenes[0].dispose();\r\n }\r\n // Release audio engine\r\n if (Engine.Instances.length === 1 && Engine.audioEngine) {\r\n Engine.audioEngine.dispose();\r\n }\r\n // Release effects\r\n this.releaseEffects();\r\n // Unbind\r\n this.unbindAllAttributes();\r\n this._boundUniforms = [];\r\n if (this._dummyFramebuffer) {\r\n this._gl.deleteFramebuffer(this._dummyFramebuffer);\r\n }\r\n //WebVR\r\n this.disableVR();\r\n // Events\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n window.removeEventListener(\"blur\", this._onBlur);\r\n window.removeEventListener(\"focus\", this._onFocus);\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.removeEventListener(\"focus\", this._onCanvasFocus);\r\n this._renderingCanvas.removeEventListener(\"blur\", this._onCanvasBlur);\r\n this._renderingCanvas.removeEventListener(\"pointerout\", this._onCanvasPointerOut);\r\n if (!this._doNotHandleContextLost) {\r\n this._renderingCanvas.removeEventListener(\"webglcontextlost\", this._onContextLost);\r\n this._renderingCanvas.removeEventListener(\"webglcontextrestored\", this._onContextRestored);\r\n }\r\n }\r\n document.removeEventListener(\"fullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"mozfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"webkitfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"msfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"pointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mspointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mozpointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"webkitpointerlockchange\", this._onPointerLockChange);\r\n }\r\n // Remove from Instances\r\n var index = Engine.Instances.indexOf(this);\r\n if (index >= 0) {\r\n Engine.Instances.splice(index, 1);\r\n }\r\n this._workingCanvas = null;\r\n this._workingContext = null;\r\n this._currentBufferPointers = [];\r\n this._renderingCanvas = null;\r\n this._currentProgram = null;\r\n this._bindedRenderFunction = null;\r\n this.onResizeObservable.clear();\r\n this.onCanvasBlurObservable.clear();\r\n this.onCanvasFocusObservable.clear();\r\n this.onCanvasPointerOutObservable.clear();\r\n this.onBeginFrameObservable.clear();\r\n this.onEndFrameObservable.clear();\r\n _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ResetCache();\r\n // Abort active requests\r\n for (var _i = 0, _a = this._activeRequests; _i < _a.length; _i++) {\r\n var request = _a[_i];\r\n request.abort();\r\n }\r\n };\r\n // Loading screen\r\n /**\r\n * Display the loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.displayLoadingUI = function () {\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this.loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.displayLoadingUI();\r\n }\r\n };\r\n /**\r\n * Hide the loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.hideLoadingUI = function () {\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this._loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.hideLoadingUI();\r\n }\r\n };\r\n Object.defineProperty(Engine.prototype, \"loadingScreen\", {\r\n /**\r\n * Gets the current loading screen object\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n get: function () {\r\n if (!this._loadingScreen && this._renderingCanvas) {\r\n this._loadingScreen = Engine.DefaultLoadingScreenFactory(this._renderingCanvas);\r\n }\r\n return this._loadingScreen;\r\n },\r\n /**\r\n * Sets the current loading screen object\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (loadingScreen) {\r\n this._loadingScreen = loadingScreen;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIText\", {\r\n /**\r\n * Sets the current loading screen text\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (text) {\r\n this.loadingScreen.loadingUIText = text;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIBackgroundColor\", {\r\n /**\r\n * Sets the current loading screen background color\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (color) {\r\n this.loadingScreen.loadingUIBackgroundColor = color;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach a new callback raised when context lost event is fired\r\n * @param callback defines the callback to call\r\n */\r\n Engine.prototype.attachContextLostEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextlost\", callback, false);\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context restored event is fired\r\n * @param callback defines the callback to call\r\n */\r\n Engine.prototype.attachContextRestoredEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextrestored\", callback, false);\r\n }\r\n };\r\n /**\r\n * Gets the source code of the vertex shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the vertex shader associated with the program\r\n */\r\n Engine.prototype.getVertexShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[0]);\r\n };\r\n /**\r\n * Gets the source code of the fragment shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the fragment shader associated with the program\r\n */\r\n Engine.prototype.getFragmentShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[1]);\r\n };\r\n /**\r\n * Get the current error code of the webGL context\r\n * @returns the error code\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\r\n */\r\n Engine.prototype.getError = function () {\r\n return this._gl.getError();\r\n };\r\n // FPS\r\n /**\r\n * Gets the current framerate\r\n * @returns a number representing the framerate\r\n */\r\n Engine.prototype.getFps = function () {\r\n return this._fps;\r\n };\r\n /**\r\n * Gets the time spent between current and previous frame\r\n * @returns a number representing the delta time in ms\r\n */\r\n Engine.prototype.getDeltaTime = function () {\r\n return this._deltaTime;\r\n };\r\n Engine.prototype._measureFps = function () {\r\n this._performanceMonitor.sampleFrame();\r\n this._fps = this._performanceMonitor.averageFPS;\r\n this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;\r\n };\r\n /** @hidden */\r\n Engine.prototype._readTexturePixels = function (texture, width, height, faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = -1; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n var gl = this._gl;\r\n if (!this._dummyFramebuffer) {\r\n var dummy = gl.createFramebuffer();\r\n if (!dummy) {\r\n throw new Error(\"Unable to create dummy framebuffer\");\r\n }\r\n this._dummyFramebuffer = dummy;\r\n }\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);\r\n if (faceIndex > -1) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, level);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, level);\r\n }\r\n var readType = (texture.type !== undefined) ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;\r\n switch (readType) {\r\n case gl.UNSIGNED_BYTE:\r\n if (!buffer) {\r\n buffer = new Uint8Array(4 * width * height);\r\n }\r\n readType = gl.UNSIGNED_BYTE;\r\n break;\r\n default:\r\n if (!buffer) {\r\n buffer = new Float32Array(4 * width * height);\r\n }\r\n readType = gl.FLOAT;\r\n break;\r\n }\r\n gl.readPixels(0, 0, width, height, gl.RGBA, readType, buffer);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);\r\n return buffer;\r\n };\r\n Engine.prototype._canRenderToFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(Engine.TEXTURETYPE_FLOAT);\r\n };\r\n Engine.prototype._canRenderToHalfFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(Engine.TEXTURETYPE_HALF_FLOAT);\r\n };\r\n // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture\r\n Engine.prototype._canRenderToFramebuffer = function (type) {\r\n var gl = this._gl;\r\n //clear existing errors\r\n while (gl.getError() !== gl.NO_ERROR) { }\r\n var successful = true;\r\n var texture = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D, texture);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), 1, 1, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n var fb = gl.createFramebuffer();\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\r\n var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\r\n successful = successful && (status === gl.FRAMEBUFFER_COMPLETE);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n //try render by clearing frame buffer's color buffer\r\n if (successful) {\r\n gl.clear(gl.COLOR_BUFFER_BIT);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //try reading from frame to ensure render occurs (just creating the FBO is not sufficient to determine if rendering is supported)\r\n if (successful) {\r\n //in practice it's sufficient to just read from the backbuffer rather than handle potentially issues reading from the texture\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n var readFormat = gl.RGBA;\r\n var readType = gl.UNSIGNED_BYTE;\r\n var buffer = new Uint8Array(4);\r\n gl.readPixels(0, 0, 1, 1, readFormat, readType, buffer);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //clean up\r\n gl.deleteTexture(texture);\r\n gl.deleteFramebuffer(fb);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n //clear accumulated errors\r\n while (!successful && (gl.getError() !== gl.NO_ERROR)) { }\r\n return successful;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getWebGLTextureType = function (type) {\r\n if (this._webGLVersion === 1) {\r\n switch (type) {\r\n case Engine.TEXTURETYPE_FLOAT:\r\n return this._gl.FLOAT;\r\n case Engine.TEXTURETYPE_HALF_FLOAT:\r\n return this._gl.HALF_FLOAT_OES;\r\n case Engine.TEXTURETYPE_UNSIGNED_BYTE:\r\n return this._gl.UNSIGNED_BYTE;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n }\r\n switch (type) {\r\n case Engine.TEXTURETYPE_BYTE:\r\n return this._gl.BYTE;\r\n case Engine.TEXTURETYPE_UNSIGNED_BYTE:\r\n return this._gl.UNSIGNED_BYTE;\r\n case Engine.TEXTURETYPE_SHORT:\r\n return this._gl.SHORT;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT:\r\n return this._gl.UNSIGNED_SHORT;\r\n case Engine.TEXTURETYPE_INT:\r\n return this._gl.INT;\r\n case Engine.TEXTURETYPE_UNSIGNED_INTEGER: // Refers to UNSIGNED_INT\r\n return this._gl.UNSIGNED_INT;\r\n case Engine.TEXTURETYPE_FLOAT:\r\n return this._gl.FLOAT;\r\n case Engine.TEXTURETYPE_HALF_FLOAT:\r\n return this._gl.HALF_FLOAT;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:\r\n return this._gl.UNSIGNED_INT_2_10_10_10_REV;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_24_8:\r\n return this._gl.UNSIGNED_INT_24_8;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:\r\n return this._gl.UNSIGNED_INT_10F_11F_11F_REV;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:\r\n return this._gl.UNSIGNED_INT_5_9_9_9_REV;\r\n case Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:\r\n return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getInternalFormat = function (format) {\r\n var internalFormat = this._gl.RGBA;\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_ALPHA:\r\n internalFormat = this._gl.ALPHA;\r\n break;\r\n case Engine.TEXTUREFORMAT_LUMINANCE:\r\n internalFormat = this._gl.LUMINANCE;\r\n break;\r\n case Engine.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n internalFormat = this._gl.LUMINANCE_ALPHA;\r\n break;\r\n case Engine.TEXTUREFORMAT_RED:\r\n internalFormat = this._gl.RED;\r\n break;\r\n case Engine.TEXTUREFORMAT_RG:\r\n internalFormat = this._gl.RG;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n internalFormat = this._gl.RGB;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n internalFormat = this._gl.RGBA;\r\n break;\r\n }\r\n if (this._webGLVersion > 1) {\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n internalFormat = this._gl.RED_INTEGER;\r\n break;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n internalFormat = this._gl.RG_INTEGER;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n internalFormat = this._gl.RGB_INTEGER;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n internalFormat = this._gl.RGBA_INTEGER;\r\n break;\r\n }\r\n }\r\n return internalFormat;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getRGBABufferInternalSizedFormat = function (type, format) {\r\n if (this._webGLVersion === 1) {\r\n if (format !== undefined) {\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_ALPHA:\r\n return this._gl.ALPHA;\r\n case Engine.TEXTUREFORMAT_LUMINANCE:\r\n return this._gl.LUMINANCE;\r\n case Engine.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n return this._gl.LUMINANCE_ALPHA;\r\n }\r\n }\r\n return this._gl.RGBA;\r\n }\r\n switch (type) {\r\n case Engine.TEXTURETYPE_BYTE:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R8_SNORM;\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG8_SNORM;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB8_SNORM;\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R8I;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG8I;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB8I;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA8I;\r\n default:\r\n return this._gl.RGBA8_SNORM;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_BYTE:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R8;\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG8;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB8; // By default. Other possibilities are RGB565, SRGB8.\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGBA8; // By default. Other possibilities are RGB5_A1, RGBA4, SRGB8_ALPHA8.\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R8UI;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG8UI;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB8UI;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA8UI;\r\n case Engine.TEXTUREFORMAT_ALPHA:\r\n return this._gl.ALPHA;\r\n case Engine.TEXTUREFORMAT_LUMINANCE:\r\n return this._gl.LUMINANCE;\r\n case Engine.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n return this._gl.LUMINANCE_ALPHA;\r\n default:\r\n return this._gl.RGBA8;\r\n }\r\n case Engine.TEXTURETYPE_SHORT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R16I;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG16I;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB16I;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA16I;\r\n default:\r\n return this._gl.RGBA16I;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R16UI;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG16UI;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB16UI;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA16UI;\r\n default:\r\n return this._gl.RGBA16UI;\r\n }\r\n case Engine.TEXTURETYPE_INT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R32I;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG32I;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB32I;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA32I;\r\n default:\r\n return this._gl.RGBA32I;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_INTEGER: // Refers to UNSIGNED_INT\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R32UI;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG32UI;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB32UI;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA32UI;\r\n default:\r\n return this._gl.RGBA32UI;\r\n }\r\n case Engine.TEXTURETYPE_FLOAT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R32F; // By default. Other possibility is R16F.\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG32F; // By default. Other possibility is RG16F.\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB32F; // By default. Other possibilities are RGB16F, R11F_G11F_B10F, RGB9_E5.\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGBA32F; // By default. Other possibility is RGBA16F.\r\n default:\r\n return this._gl.RGBA32F;\r\n }\r\n case Engine.TEXTURETYPE_HALF_FLOAT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R16F;\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG16F;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB16F; // By default. Other possibilities are R11F_G11F_B10F, RGB9_E5.\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGBA16F;\r\n default:\r\n return this._gl.RGBA16F;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n return this._gl.RGB565;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:\r\n return this._gl.R11F_G11F_B10F;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:\r\n return this._gl.RGB9_E5;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n return this._gl.RGBA4;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n return this._gl.RGB5_A1;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGB10_A2; // By default. Other possibility is RGB5_A1.\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGB10_A2UI;\r\n default:\r\n return this._gl.RGB10_A2;\r\n }\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getRGBAMultiSampleBufferFormat = function (type) {\r\n if (type === Engine.TEXTURETYPE_FLOAT) {\r\n return this._gl.RGBA32F;\r\n }\r\n else if (type === Engine.TEXTURETYPE_HALF_FLOAT) {\r\n return this._gl.RGBA16F;\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n Engine.prototype._loadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__[\"FileTools\"].LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Engine.prototype._loadFileAsync = function (url, offlineProvider, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, offlineProvider, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n // Statics\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)\r\n * @returns true if the engine can be created\r\n * @ignorenaming\r\n */\r\n Engine.isSupported = function () {\r\n try {\r\n var tempcanvas = document.createElement(\"canvas\");\r\n var gl = tempcanvas.getContext(\"webgl\") || tempcanvas.getContext(\"experimental-webgl\");\r\n return gl != null && !!window.WebGLRenderingContext;\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Find the next highest power of two.\r\n * @param x Number to start search from.\r\n * @return Next highest power of two.\r\n */\r\n Engine.CeilingPOT = function (x) {\r\n x--;\r\n x |= x >> 1;\r\n x |= x >> 2;\r\n x |= x >> 4;\r\n x |= x >> 8;\r\n x |= x >> 16;\r\n x++;\r\n return x;\r\n };\r\n /**\r\n * Find the next lowest power of two.\r\n * @param x Number to start search from.\r\n * @return Next lowest power of two.\r\n */\r\n Engine.FloorPOT = function (x) {\r\n x = x | (x >> 1);\r\n x = x | (x >> 2);\r\n x = x | (x >> 4);\r\n x = x | (x >> 8);\r\n x = x | (x >> 16);\r\n return x - (x >> 1);\r\n };\r\n /**\r\n * Find the nearest power of two.\r\n * @param x Number to start search from.\r\n * @return Next nearest power of two.\r\n */\r\n Engine.NearestPOT = function (x) {\r\n var c = Engine.CeilingPOT(x);\r\n var f = Engine.FloorPOT(x);\r\n return (c - x) > (x - f) ? f : c;\r\n };\r\n /**\r\n * Get the closest exponent of two\r\n * @param value defines the value to approximate\r\n * @param max defines the maximum value to return\r\n * @param mode defines how to define the closest value\r\n * @returns closest exponent of two of the given value\r\n */\r\n Engine.GetExponentOfTwo = function (value, max, mode) {\r\n if (mode === void 0) { mode = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_NEAREST; }\r\n var pot;\r\n switch (mode) {\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_FLOOR:\r\n pot = Engine.FloorPOT(value);\r\n break;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_NEAREST:\r\n pot = Engine.NearestPOT(value);\r\n break;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_CEILING:\r\n default:\r\n pot = Engine.CeilingPOT(value);\r\n break;\r\n }\r\n return Math.min(pot, max);\r\n };\r\n /**\r\n * Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)\r\n * @param func - the function to be called\r\n * @param requester - the object that will request the next frame. Falls back to window.\r\n * @returns frame number\r\n */\r\n Engine.QueueNewFrame = function (func, requester) {\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return setTimeout(func, 16);\r\n }\r\n if (!requester) {\r\n requester = window;\r\n }\r\n if (requester.requestAnimationFrame) {\r\n return requester.requestAnimationFrame(func);\r\n }\r\n else if (requester.msRequestAnimationFrame) {\r\n return requester.msRequestAnimationFrame(func);\r\n }\r\n else if (requester.webkitRequestAnimationFrame) {\r\n return requester.webkitRequestAnimationFrame(func);\r\n }\r\n else if (requester.mozRequestAnimationFrame) {\r\n return requester.mozRequestAnimationFrame(func);\r\n }\r\n else if (requester.oRequestAnimationFrame) {\r\n return requester.oRequestAnimationFrame(func);\r\n }\r\n else {\r\n return window.setTimeout(func, 16);\r\n }\r\n };\r\n /**\r\n * Ask the browser to promote the current element to pointerlock mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestPointerlock = function (element) {\r\n element.requestPointerLock = element.requestPointerLock || element.msRequestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;\r\n if (element.requestPointerLock) {\r\n element.requestPointerLock();\r\n }\r\n };\r\n /**\r\n * Asks the browser to exit pointerlock mode\r\n */\r\n Engine._ExitPointerlock = function () {\r\n var anyDoc = document;\r\n document.exitPointerLock = document.exitPointerLock || anyDoc.msExitPointerLock || anyDoc.mozExitPointerLock || anyDoc.webkitExitPointerLock;\r\n if (document.exitPointerLock) {\r\n document.exitPointerLock();\r\n }\r\n };\r\n /**\r\n * Ask the browser to promote the current element to fullscreen rendering mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestFullscreen = function (element) {\r\n var requestFunction = element.requestFullscreen || element.msRequestFullscreen || element.webkitRequestFullscreen || element.mozRequestFullScreen;\r\n if (!requestFunction) {\r\n return;\r\n }\r\n requestFunction.call(element);\r\n };\r\n /**\r\n * Asks the browser to exit fullscreen mode\r\n */\r\n Engine._ExitFullscreen = function () {\r\n var anyDoc = document;\r\n if (document.exitFullscreen) {\r\n document.exitFullscreen();\r\n }\r\n else if (anyDoc.mozCancelFullScreen) {\r\n anyDoc.mozCancelFullScreen();\r\n }\r\n else if (anyDoc.webkitCancelFullScreen) {\r\n anyDoc.webkitCancelFullScreen();\r\n }\r\n else if (anyDoc.msCancelFullScreen) {\r\n anyDoc.msCancelFullScreen();\r\n }\r\n };\r\n /** Use this array to turn off some WebGL2 features on known buggy browsers version */\r\n Engine.ExceptionList = [\r\n { key: \"Chrome\\/63\\.0\", capture: \"63\\\\.0\\\\.3239\\\\.(\\\\d+)\", captureConstraint: 108, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/58\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/59\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Chrome\\/72.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/73.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/74.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/71\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/72\", capture: null, captureConstraint: null, targets: [\"vao\"] }\r\n ];\r\n /** @hidden */\r\n Engine._TextureLoaders = [];\r\n // Const statics\r\n /** Defines that alpha blending is disabled */\r\n Engine.ALPHA_DISABLE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_DISABLE;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + DEST */\r\n Engine.ALPHA_ADD = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_ADD;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_COMBINE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_COMBINE;\r\n /** Defines that alpha blending to DEST - SRC * DEST */\r\n Engine.ALPHA_SUBTRACT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_SUBTRACT;\r\n /** Defines that alpha blending to SRC * DEST */\r\n Engine.ALPHA_MULTIPLY = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_MULTIPLY;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Engine.ALPHA_MAXIMIZED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_MAXIMIZED;\r\n /** Defines that alpha blending to SRC + DEST */\r\n Engine.ALPHA_ONEONE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_ONEONE;\r\n /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_PREMULTIPLIED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_PREMULTIPLIED;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_PREMULTIPLIED_PORTERDUFF = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */\r\n Engine.ALPHA_INTERPOLATE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_INTERPOLATE;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_SCREENMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_SCREENMODE;\r\n /** Defines that the ressource is not delayed*/\r\n Engine.DELAYLOADSTATE_NONE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Engine.DELAYLOADSTATE_LOADED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n /** Defines that the ressource is currently delay loading */\r\n Engine.DELAYLOADSTATE_LOADING = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADING;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Engine.DELAYLOADSTATE_NOTLOADED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Engine.NEVER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].NEVER;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Engine.ALWAYS = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALWAYS;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Engine.LESS = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].LESS;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Engine.EQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].EQUAL;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Engine.LEQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].LEQUAL;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Engine.GREATER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].GREATER;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Engine.GEQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].GEQUAL;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Engine.NOTEQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].NOTEQUAL;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Engine.KEEP = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].KEEP;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Engine.REPLACE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].REPLACE;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Engine.INCR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].INCR;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Engine.DECR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DECR;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Engine.INVERT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].INVERT;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Engine.INCR_WRAP = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].INCR_WRAP;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Engine.DECR_WRAP = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DECR_WRAP;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_CLAMP_ADDRESSMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_WRAP_ADDRESSMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /** Texture is repeating and mirrored */\r\n Engine.TEXTURE_MIRROR_ADDRESSMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_MIRROR_ADDRESSMODE;\r\n /** ALPHA */\r\n Engine.TEXTUREFORMAT_ALPHA = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_ALPHA;\r\n /** LUMINANCE */\r\n Engine.TEXTUREFORMAT_LUMINANCE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_LUMINANCE;\r\n /** LUMINANCE_ALPHA */\r\n Engine.TEXTUREFORMAT_LUMINANCE_ALPHA = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_LUMINANCE_ALPHA;\r\n /** RGB */\r\n Engine.TEXTUREFORMAT_RGB = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGB;\r\n /** RGBA */\r\n Engine.TEXTUREFORMAT_RGBA = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n /** RED */\r\n Engine.TEXTUREFORMAT_RED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RED;\r\n /** RED (2nd reference) */\r\n Engine.TEXTUREFORMAT_R = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_R;\r\n /** RG */\r\n Engine.TEXTUREFORMAT_RG = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RG;\r\n /** RED_INTEGER */\r\n Engine.TEXTUREFORMAT_RED_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RED_INTEGER;\r\n /** RED_INTEGER (2nd reference) */\r\n Engine.TEXTUREFORMAT_R_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_R_INTEGER;\r\n /** RG_INTEGER */\r\n Engine.TEXTUREFORMAT_RG_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RG_INTEGER;\r\n /** RGB_INTEGER */\r\n Engine.TEXTUREFORMAT_RGB_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGB_INTEGER;\r\n /** RGBA_INTEGER */\r\n Engine.TEXTUREFORMAT_RGBA_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGBA_INTEGER;\r\n /** UNSIGNED_BYTE */\r\n Engine.TEXTURETYPE_UNSIGNED_BYTE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_BYTE;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Engine.TEXTURETYPE_UNSIGNED_INT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n /** FLOAT */\r\n Engine.TEXTURETYPE_FLOAT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n /** HALF_FLOAT */\r\n Engine.TEXTURETYPE_HALF_FLOAT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n /** BYTE */\r\n Engine.TEXTURETYPE_BYTE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_BYTE;\r\n /** SHORT */\r\n Engine.TEXTURETYPE_SHORT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_SHORT;\r\n /** UNSIGNED_SHORT */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT;\r\n /** INT */\r\n Engine.TEXTURETYPE_INT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_INT;\r\n /** UNSIGNED_INT */\r\n Engine.TEXTURETYPE_UNSIGNED_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INTEGER;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT_5_6_5;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV;\r\n /** UNSIGNED_INT_24_8 */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_24_8 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_24_8;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_SAMPLINGMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_BILINEAR_SAMPLINGMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_TRILINEAR_SAMPLINGMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPLINEAR;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPNEAREST;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = linear and mip = none */\r\n Engine.TEXTURE_NEAREST_LINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_LINEAR;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Engine.TEXTURE_NEAREST_NEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_NEAREST;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n /** mag = linear and min = linear and mip = none */\r\n Engine.TEXTURE_LINEAR_LINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_LINEAR;\r\n /** mag = linear and min = nearest and mip = none */\r\n Engine.TEXTURE_LINEAR_NEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_NEAREST;\r\n /** Explicit coordinates mode */\r\n Engine.TEXTURE_EXPLICIT_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_EXPLICIT_MODE;\r\n /** Spherical coordinates mode */\r\n Engine.TEXTURE_SPHERICAL_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_SPHERICAL_MODE;\r\n /** Planar coordinates mode */\r\n Engine.TEXTURE_PLANAR_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_PLANAR_MODE;\r\n /** Cubic coordinates mode */\r\n Engine.TEXTURE_CUBIC_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_CUBIC_MODE;\r\n /** Projection coordinates mode */\r\n Engine.TEXTURE_PROJECTION_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_PROJECTION_MODE;\r\n /** Skybox coordinates mode */\r\n Engine.TEXTURE_SKYBOX_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_SKYBOX_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n Engine.TEXTURE_INVCUBIC_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_INVCUBIC_MODE;\r\n /** Equirectangular coordinates mode */\r\n Engine.TEXTURE_EQUIRECTANGULAR_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Engine.SCALEMODE_FLOOR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_FLOOR;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Engine.SCALEMODE_NEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_NEAREST;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Engine.SCALEMODE_CEILING = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_CEILING;\r\n // Updatable statics so stick with vars here\r\n /**\r\n * Gets or sets the epsilon value used by collision engine\r\n */\r\n Engine.CollisionsEpsilon = 0.001;\r\n /**\r\n * Method called to create the default rescale post process on each engine.\r\n */\r\n Engine._RescalePostProcessFactory = null;\r\n return Engine;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/engineStore.ts\":\n/*!********************************!*\\\n !*** ./Engines/engineStore.ts ***!\n \\********************************/\n/*! exports provided: EngineStore */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return EngineStore; });\n/**\r\n * The engine store class is responsible to hold all the instances of Engine and Scene created\r\n * during the life time of the application.\r\n */\r\nvar EngineStore = /** @class */ (function () {\r\n function EngineStore() {\r\n }\r\n Object.defineProperty(EngineStore, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n if (this.Instances.length === 0) {\r\n return null;\r\n }\r\n return this.Instances[this.Instances.length - 1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineStore, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return this._LastCreatedScene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Gets the list of created engines */\r\n EngineStore.Instances = new Array();\r\n /** @hidden */\r\n EngineStore._LastCreatedScene = null;\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.UseFallbackTexture = true;\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.FallbackTexture = \"\";\r\n return EngineStore;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/index.ts\":\n/*!**************************!*\\\n !*** ./Engines/index.ts ***!\n \\**************************/\n/*! exports provided: Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, _OcclusionDataStorage, _forceTransformFeedbackToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./Engines/constants.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"]; });\n\n/* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine */ \"./Engines/engine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"InstancingAttributeInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"DepthTextureCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"EngineCapabilities\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]; });\n\n/* harmony import */ var _engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./engineStore */ \"./Engines/engineStore.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return _engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"]; });\n\n/* harmony import */ var _nullEngine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nullEngine */ \"./Engines/nullEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return _nullEngine__WEBPACK_IMPORTED_MODULE_3__[\"NullEngineOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return _nullEngine__WEBPACK_IMPORTED_MODULE_3__[\"NullEngine\"]; });\n\n/* harmony import */ var _Extensions_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Extensions/index */ \"./Engines/Extensions/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_4__[\"_OcclusionDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_4__[\"_forceTransformFeedbackToBundle\"]; });\n\n/* harmony import */ var _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./WebGL/webGLPipelineContext */ \"./Engines/WebGL/webGLPipelineContext.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_5__[\"WebGLPipelineContext\"]; });\n\n/* harmony import */ var _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./WebGL/webGL2ShaderProcessors */ \"./Engines/WebGL/webGL2ShaderProcessors.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_6__[\"WebGL2ShaderProcessor\"]; });\n\n/* harmony import */ var _nativeEngine__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./nativeEngine */ \"./Engines/nativeEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return _nativeEngine__WEBPACK_IMPORTED_MODULE_7__[\"NativeEngine\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/nativeEngine.ts\":\n/*!*********************************!*\\\n !*** ./Engines/nativeEngine.ts ***!\n \\*********************************/\n/*! exports provided: NativeEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return NativeEngine; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/dataBuffer */ \"./Meshes/dataBuffer.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Native_nativeShaderProcessor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Native/nativeShaderProcessor */ \"./Engines/Native/nativeShaderProcessor.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar NativePipelineContext = /** @class */ (function () {\r\n function NativePipelineContext() {\r\n // TODO: async should be true?\r\n this.isAsync = false;\r\n this.isReady = false;\r\n }\r\n // TODO: what should this do?\r\n NativePipelineContext.prototype._handlesSpectorRebuildCallback = function (onCompiled) {\r\n throw new Error(\"Not implemented\");\r\n };\r\n return NativePipelineContext;\r\n}());\r\n/**\r\n * Container for accessors for natively-stored mesh data buffers.\r\n */\r\nvar NativeDataBuffer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NativeDataBuffer, _super);\r\n function NativeDataBuffer() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return NativeDataBuffer;\r\n}(_Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_4__[\"DataBuffer\"]));\r\n// TODO: change this to match bgfx.\r\n// Must match Filter enum in SpectreEngine.h.\r\nvar NativeFilter = /** @class */ (function () {\r\n function NativeFilter() {\r\n }\r\n NativeFilter.POINT = 0;\r\n NativeFilter.MINPOINT_MAGPOINT_MIPPOINT = NativeFilter.POINT;\r\n NativeFilter.BILINEAR = 1;\r\n NativeFilter.MINLINEAR_MAGLINEAR_MIPPOINT = NativeFilter.BILINEAR;\r\n NativeFilter.TRILINEAR = 2;\r\n NativeFilter.MINLINEAR_MAGLINEAR_MIPLINEAR = NativeFilter.TRILINEAR;\r\n NativeFilter.ANISOTROPIC = 3;\r\n NativeFilter.POINT_COMPARE = 4;\r\n NativeFilter.TRILINEAR_COMPARE = 5;\r\n NativeFilter.MINBILINEAR_MAGPOINT = 6;\r\n NativeFilter.MINLINEAR_MAGPOINT_MIPLINEAR = NativeFilter.MINBILINEAR_MAGPOINT;\r\n NativeFilter.MINPOINT_MAGPOINT_MIPLINEAR = 7;\r\n NativeFilter.MINPOINT_MAGLINEAR_MIPPOINT = 8;\r\n NativeFilter.MINPOINT_MAGLINEAR_MIPLINEAR = 9;\r\n NativeFilter.MINLINEAR_MAGPOINT_MIPPOINT = 10;\r\n return NativeFilter;\r\n}());\r\n// TODO: change this to match bgfx.\r\n// Must match AddressMode enum in SpectreEngine.h.\r\nvar NativeAddressMode = /** @class */ (function () {\r\n function NativeAddressMode() {\r\n }\r\n NativeAddressMode.WRAP = 0;\r\n NativeAddressMode.MIRROR = 1;\r\n NativeAddressMode.CLAMP = 2;\r\n NativeAddressMode.BORDER = 3;\r\n NativeAddressMode.MIRROR_ONCE = 4;\r\n return NativeAddressMode;\r\n}());\r\n/** @hidden */\r\nvar NativeEngine = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NativeEngine, _super);\r\n function NativeEngine() {\r\n var _this = _super.call(this, null) || this;\r\n _this._native = nativeEngine;\r\n _this._webGLVersion = 2;\r\n _this.disableUniformBuffers = true;\r\n // TODO: Initialize this more correctly based on the hardware capabilities.\r\n // Init caps\r\n _this._caps = new _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"EngineCapabilities\"]();\r\n _this._caps.maxTexturesImageUnits = 16;\r\n _this._caps.maxVertexTextureImageUnits = 16;\r\n _this._caps.maxTextureSize = 512;\r\n _this._caps.maxCubemapTextureSize = 512;\r\n _this._caps.maxRenderTextureSize = 512;\r\n _this._caps.maxVertexAttribs = 16;\r\n _this._caps.maxVaryingVectors = 16;\r\n _this._caps.maxFragmentUniformVectors = 16;\r\n _this._caps.maxVertexUniformVectors = 16;\r\n // Extensions\r\n _this._caps.standardDerivatives = true;\r\n _this._caps.astc = null;\r\n _this._caps.s3tc = null;\r\n _this._caps.pvrtc = null;\r\n _this._caps.etc1 = null;\r\n _this._caps.etc2 = null;\r\n _this._caps.maxAnisotropy = 16; // TODO: Retrieve this smartly. Currently set to D3D11 maximum allowable value.\r\n _this._caps.uintIndices = false;\r\n _this._caps.fragmentDepthSupported = false;\r\n _this._caps.highPrecisionShaderSupported = true;\r\n _this._caps.colorBufferFloat = false;\r\n _this._caps.textureFloat = false;\r\n _this._caps.textureFloatLinearFiltering = false;\r\n _this._caps.textureFloatRender = false;\r\n _this._caps.textureHalfFloat = false;\r\n _this._caps.textureHalfFloatLinearFiltering = false;\r\n _this._caps.textureHalfFloatRender = false;\r\n _this._caps.textureLOD = true;\r\n _this._caps.drawBuffersExtension = false;\r\n _this._caps.depthTextureExtension = false;\r\n _this._caps.vertexArrayObject = true;\r\n _this._caps.instancedArrays = false;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].Log(\"Babylon Native (v\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].Version + \") launched\");\r\n // Wrappers\r\n if (typeof URL === \"undefined\") {\r\n window.URL = {\r\n createObjectURL: function () { },\r\n revokeObjectURL: function () { }\r\n };\r\n }\r\n if (typeof Blob === \"undefined\") {\r\n window.Blob = function () { };\r\n }\r\n // Shader processor\r\n _this._shaderProcessor = new _Native_nativeShaderProcessor__WEBPACK_IMPORTED_MODULE_8__[\"NativeShaderProcessor\"]();\r\n return _this;\r\n }\r\n NativeEngine.prototype.getHardwareScalingLevel = function () {\r\n return 1.0;\r\n };\r\n /**\r\n * Can be used to override the current requestAnimationFrame requester.\r\n * @hidden\r\n */\r\n NativeEngine.prototype._queueNewFrame = function (bindedRenderFunction, requester) {\r\n this._native.requestAnimationFrame(bindedRenderFunction);\r\n return 0;\r\n };\r\n NativeEngine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n this._native.clear(color.r, color.g, color.b, color.a, backBuffer, depth, stencil);\r\n };\r\n NativeEngine.prototype.createIndexBuffer = function (indices) {\r\n var data = this._normalizeIndexData(indices);\r\n var buffer = new NativeDataBuffer();\r\n buffer.references = 1;\r\n buffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);\r\n buffer.nativeIndexBuffer = this._native.createIndexBuffer(data);\r\n return buffer;\r\n };\r\n NativeEngine.prototype.createVertexBuffer = function (data) {\r\n var buffer = new NativeDataBuffer();\r\n buffer.references = 1;\r\n buffer.nativeVertexBuffer = this._native.createVertexBuffer(ArrayBuffer.isView(data) ? data : new Float32Array(data));\r\n return buffer;\r\n };\r\n NativeEngine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {\r\n var vertexArray = this._native.createVertexArray();\r\n if (indexBuffer) {\r\n this._native.recordIndexBuffer(vertexArray, indexBuffer.nativeIndexBuffer);\r\n }\r\n var attributes = effect.getAttributesNames();\r\n for (var index = 0; index < attributes.length; index++) {\r\n var location_1 = effect.getAttributeLocation(index);\r\n if (location_1 >= 0) {\r\n var kind = attributes[index];\r\n var vertexBuffer = vertexBuffers[kind];\r\n if (vertexBuffer) {\r\n var buffer = vertexBuffer.getBuffer();\r\n if (buffer) {\r\n this._native.recordVertexBuffer(vertexArray, buffer.nativeVertexBuffer, location_1, vertexBuffer.byteOffset, vertexBuffer.byteStride, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized);\r\n }\r\n }\r\n }\r\n }\r\n return vertexArray;\r\n };\r\n NativeEngine.prototype.bindVertexArrayObject = function (vertexArray) {\r\n this._native.bindVertexArray(vertexArray);\r\n };\r\n NativeEngine.prototype.releaseVertexArrayObject = function (vertexArray) {\r\n this._native.deleteVertexArray(vertexArray);\r\n };\r\n NativeEngine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n var nativePipelineContext = pipelineContext;\r\n return this._native.getAttributes(nativePipelineContext.nativeProgram, attributesNames);\r\n };\r\n /**\r\n * Draw a list of indexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n NativeEngine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n // Apply states\r\n this._drawCalls.addCount(1, false);\r\n // TODO: Make this implementation more robust like core Engine version.\r\n // Render\r\n //var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\r\n //var mult = this._uintIndicesCurrentlySet ? 4 : 2;\r\n // if (instancesCount) {\r\n // this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\r\n // } else {\r\n this._native.drawIndexed(fillMode, indexStart, indexCount);\r\n // }\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n NativeEngine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n // Apply states\r\n this._drawCalls.addCount(1, false);\r\n // TODO: Make this implementation more robust like core Engine version.\r\n // if (instancesCount) {\r\n // this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\r\n // } else {\r\n this._native.draw(fillMode, verticesStart, verticesCount);\r\n // }\r\n };\r\n NativeEngine.prototype.createPipelineContext = function () {\r\n return new NativePipelineContext();\r\n };\r\n NativeEngine.prototype._preparePipelineContext = function (pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rebuildRebind, defines, transformFeedbackVaryings) {\r\n var nativePipelineContext = pipelineContext;\r\n if (createAsRaw) {\r\n nativePipelineContext.nativeProgram = this.createRawShaderProgram(pipelineContext, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\r\n }\r\n else {\r\n nativePipelineContext.nativeProgram = this.createShaderProgram(pipelineContext, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\r\n }\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._isRenderingStateCompiled = function (pipelineContext) {\r\n // TODO: support async shader compilcation\r\n return true;\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._executeWhenRenderingStateIsCompiled = function (pipelineContext, action) {\r\n // TODO: support async shader compilcation\r\n action();\r\n };\r\n NativeEngine.prototype.createRawShaderProgram = function (pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n throw new Error(\"Not Supported\");\r\n };\r\n NativeEngine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n this.onBeforeShaderCompilationObservable.notifyObservers(this);\r\n var program = this._native.createProgram(_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._concatenateShader(vertexCode, defines), _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._concatenateShader(fragmentCode, defines));\r\n this.onAfterShaderCompilationObservable.notifyObservers(this);\r\n return program;\r\n };\r\n NativeEngine.prototype._setProgram = function (program) {\r\n if (this._currentProgram !== program) {\r\n this._native.setProgram(program);\r\n this._currentProgram = program;\r\n }\r\n };\r\n NativeEngine.prototype._releaseEffect = function (effect) {\r\n // TODO\r\n };\r\n NativeEngine.prototype._deletePipelineContext = function (pipelineContext) {\r\n // TODO\r\n };\r\n NativeEngine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n var nativePipelineContext = pipelineContext;\r\n return this._native.getUniforms(nativePipelineContext.nativeProgram, uniformsNames);\r\n };\r\n NativeEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n // TODO\r\n throw new Error(\"Not Implemented\");\r\n };\r\n NativeEngine.prototype.bindSamplers = function (effect) {\r\n var nativePipelineContext = effect.getPipelineContext();\r\n this._setProgram(nativePipelineContext.nativeProgram);\r\n // TODO: share this with engine?\r\n var samplers = effect.getSamplers();\r\n for (var index = 0; index < samplers.length; index++) {\r\n var uniform = effect.getUniform(samplers[index]);\r\n if (uniform) {\r\n this._boundUniforms[index] = uniform;\r\n }\r\n }\r\n this._currentEffect = null;\r\n };\r\n NativeEngine.prototype.setMatrix = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrix(uniform, matrix.toArray());\r\n };\r\n NativeEngine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._native.getRenderWidth();\r\n };\r\n NativeEngine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._native.getRenderHeight();\r\n };\r\n NativeEngine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n // TODO: Implement.\r\n this._cachedViewport = viewport;\r\n };\r\n NativeEngine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n this._native.setState(culling, zOffset, reverseSide);\r\n };\r\n /**\r\n * Set the z offset to apply to current rendering\r\n * @param value defines the offset to apply\r\n */\r\n NativeEngine.prototype.setZOffset = function (value) {\r\n this._native.setZOffset(value);\r\n };\r\n /**\r\n * Gets the current value of the zOffset\r\n * @returns the current zOffset state\r\n */\r\n NativeEngine.prototype.getZOffset = function () {\r\n return this._native.getZOffset();\r\n };\r\n /**\r\n * Enable or disable depth buffering\r\n * @param enable defines the state to set\r\n */\r\n NativeEngine.prototype.setDepthBuffer = function (enable) {\r\n this._native.setDepthTest(enable);\r\n };\r\n /**\r\n * Gets a boolean indicating if depth writing is enabled\r\n * @returns the current depth writing state\r\n */\r\n NativeEngine.prototype.getDepthWrite = function () {\r\n return this._native.getDepthWrite();\r\n };\r\n /**\r\n * Enable or disable depth writing\r\n * @param enable defines the state to set\r\n */\r\n NativeEngine.prototype.setDepthWrite = function (enable) {\r\n this._native.setDepthWrite(enable);\r\n };\r\n /**\r\n * Enable or disable color writing\r\n * @param enable defines the state to set\r\n */\r\n NativeEngine.prototype.setColorWrite = function (enable) {\r\n this._native.setColorWrite(enable);\r\n this._colorWrite = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if color writing is enabled\r\n * @returns the current color writing state\r\n */\r\n NativeEngine.prototype.getColorWrite = function () {\r\n return this._colorWrite;\r\n };\r\n /**\r\n * Sets alpha constants used by some alpha blending modes\r\n * @param r defines the red component\r\n * @param g defines the green component\r\n * @param b defines the blue component\r\n * @param a defines the alpha component\r\n */\r\n NativeEngine.prototype.setAlphaConstants = function (r, g, b, a) {\r\n throw new Error(\"Setting alpha blend constant color not yet implemented.\");\r\n };\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the BABYLON.Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n */\r\n NativeEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n this._native.setBlendMode(mode);\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n };\r\n /**\r\n * Gets the current alpha mode\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n * @returns the current alpha mode\r\n */\r\n NativeEngine.prototype.getAlphaMode = function () {\r\n return this._alphaMode;\r\n };\r\n NativeEngine.prototype.setIntArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray(uniform, array);\r\n };\r\n NativeEngine.prototype.setIntArray2 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray2(uniform, array);\r\n };\r\n NativeEngine.prototype.setIntArray3 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray3(uniform, array);\r\n };\r\n NativeEngine.prototype.setIntArray4 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray4(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray2 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray2(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray3 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray3(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray4 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray4(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray2 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray2(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray3 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray3(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray4 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray4(uniform, array);\r\n };\r\n NativeEngine.prototype.setMatrices = function (uniform, matrices) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrices(uniform, matrices);\r\n };\r\n NativeEngine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrix3x3(uniform, matrix);\r\n };\r\n NativeEngine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrix2x2(uniform, matrix);\r\n };\r\n NativeEngine.prototype.setFloat = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat(uniform, value);\r\n };\r\n NativeEngine.prototype.setFloat2 = function (uniform, x, y) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat2(uniform, x, y);\r\n };\r\n NativeEngine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat3(uniform, x, y, z);\r\n };\r\n NativeEngine.prototype.setBool = function (uniform, bool) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setBool(uniform, bool);\r\n };\r\n NativeEngine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat4(uniform, x, y, z, w);\r\n };\r\n NativeEngine.prototype.setColor3 = function (uniform, color3) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat3(uniform, color3.r, color3.g, color3.b);\r\n };\r\n NativeEngine.prototype.setColor4 = function (uniform, color3, alpha) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat4(uniform, color3.r, color3.g, color3.b, alpha);\r\n };\r\n NativeEngine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames) {\r\n return;\r\n }\r\n this.resetTextureCache();\r\n this._currentEffect = null;\r\n if (bruteForce) {\r\n this._currentProgram = null;\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this._alphaState.reset();\r\n }\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n };\r\n NativeEngine.prototype._createTexture = function () {\r\n return this._native.createTexture();\r\n };\r\n NativeEngine.prototype._deleteTexture = function (texture) {\r\n this._native.deleteTexture(texture);\r\n };\r\n // TODO: Refactor to share more logic with babylon.engine.ts version.\r\n /**\r\n * Usually called from BABYLON.Texture.ts.\r\n * Passed information to create a WebGLTexture\r\n * @param urlArg defines a value which contains one of the following:\r\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\r\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\r\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\r\n * @param invertY when true, image is flipped when loaded. You probably want true. Ignored for compressed textures. Must be flipped in the file\r\n * @param scene needed for loading to the correct scene\r\n * @param samplingMode mode with should be used sample / access the texture (Default: BABYLON.Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param onLoad optional callback to be called upon successful completion\r\n * @param onError optional callback to be called upon failure\r\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), or a Blob\r\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\r\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns a InternalTexture for assignment back into BABYLON.Texture\r\n */\r\n NativeEngine.prototype.createTexture = function (urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (format === void 0) { format = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n var url = String(urlArg); // assign a new string, so that the original is still available in case of fallback\r\n var fromData = url.substr(0, 5) === \"data:\";\r\n var fromBlob = url.substr(0, 5) === \"blob:\";\r\n var isBase64 = fromData && url.indexOf(\"base64\") !== -1;\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_URL);\r\n // establish the file extension, if possible\r\n var lastDot = url.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\");\r\n // TODO: Add support for compressed texture formats.\r\n var textureFormatInUse = null;\r\n var loader = null;\r\n for (var _i = 0, _a = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (availableLoader.canLoad(extension, textureFormatInUse, fallback, isBase64, buffer ? true : false)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n if (loader) {\r\n url = loader.transformUrl(url, textureFormatInUse);\r\n }\r\n if (scene) {\r\n scene._addPendingData(texture);\r\n }\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n if (!this.doNotHandleContextLost) {\r\n // Keep a link to the buffer only if we plan to handle context lost\r\n texture._buffer = buffer;\r\n }\r\n var onLoadObserver = null;\r\n if (onLoad && !fallback) {\r\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\r\n }\r\n if (!fallback) {\r\n this._internalTexturesCache.push(texture);\r\n }\r\n var onInternalError = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n var customFallback = false;\r\n if (loader) {\r\n var fallbackUrl = loader.getFallbackTextureUrl(url, textureFormatInUse);\r\n if (fallbackUrl) {\r\n // Add Back\r\n customFallback = true;\r\n _this.createTexture(urlArg, noMipmap, invertY, scene, samplingMode, null, onError, buffer, texture);\r\n }\r\n }\r\n if (!customFallback) {\r\n if (onLoadObserver) {\r\n texture.onLoadedObservable.remove(onLoadObserver);\r\n }\r\n if (_Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].UseFallbackTexture) {\r\n _this.createTexture(_Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].fallbackTexture, noMipmap, invertY, scene, samplingMode, null, onError, buffer, texture);\r\n }\r\n }\r\n if (onError) {\r\n onError(message || \"Unknown error\", exception);\r\n }\r\n };\r\n // processing for non-image formats\r\n if (loader) {\r\n throw new Error(\"Loading textures from IInternalTextureLoader not yet implemented.\");\r\n // var callback = (data: string | ArrayBuffer) => {\r\n // loader!.loadData(data as ArrayBuffer, texture, (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void) => {\r\n // this._prepareWebGLTexture(texture, scene, width, height, invertY, !loadMipmap, isCompressed, () => {\r\n // done();\r\n // return false;\r\n // },\r\n // samplingMode);\r\n // });\r\n // }\r\n // if (!buffer) {\r\n // this._loadFile(url, callback, undefined, scene ? scene.database : undefined, true, (request?: XMLHttpRequest, exception?: any) => {\r\n // onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\r\n // });\r\n // } else {\r\n // callback(buffer as ArrayBuffer);\r\n // }\r\n }\r\n else {\r\n var onload = function (data, responseURL) {\r\n if (typeof (data) === \"string\") {\r\n throw new Error(\"Loading textures from string data not yet implemented.\");\r\n }\r\n if (fromBlob && !_this.doNotHandleContextLost) {\r\n // We need to store the image if we need to rebuild the texture\r\n // in case of a webgl context lost\r\n texture._buffer = data;\r\n }\r\n var webGLTexture = texture._webGLTexture;\r\n if (!webGLTexture) {\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n return;\r\n }\r\n _this._native.loadTexture(webGLTexture, data, !noMipmap);\r\n if (invertY) {\r\n throw new Error(\"Support for textures with inverted Y coordinates not yet implemented.\");\r\n }\r\n //this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n texture.baseWidth = _this._native.getTextureWidth(webGLTexture);\r\n texture.baseHeight = _this._native.getTextureHeight(webGLTexture);\r\n texture.width = texture.baseWidth;\r\n texture.height = texture.baseHeight;\r\n texture.isReady = true;\r\n var filter = _this._getSamplingFilter(samplingMode);\r\n _this._native.setTextureSampling(webGLTexture, filter);\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n };\r\n if (buffer instanceof ArrayBuffer) {\r\n onload(buffer);\r\n }\r\n else if (ArrayBuffer.isView(buffer)) {\r\n onload(buffer.buffer);\r\n }\r\n else if (buffer instanceof Blob) {\r\n throw new Error(\"Loading texture from Blob not yet implemented.\");\r\n }\r\n else if (!fromData) {\r\n var onLoadFileError = function (request, exception) {\r\n onInternalError(\"Failed to retrieve \" + url + \".\", exception);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].LoadFile(url, onload, undefined, undefined, /*useArrayBuffer*/ true, onLoadFileError);\r\n }\r\n else {\r\n onload(_Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].DecodeBase64(buffer));\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials if a polynomial sphere should be created for the cube texture\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param fallback defines texture to use while falling back when (compressed) texture file not found.\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n NativeEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n if (fallback === void 0) { fallback = null; }\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_CUBE);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n }\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n if (extension === \".env\") {\r\n var onloaddata = function (data) {\r\n data = data;\r\n var info = _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__[\"EnvironmentTextureTools\"].GetEnvInfo(data);\r\n texture.width = info.width;\r\n texture.height = info.width;\r\n _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__[\"EnvironmentTextureTools\"].UploadEnvSpherical(texture, info);\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n if (!specularInfo) {\r\n throw new Error(\"Nothing else parsed so far\");\r\n }\r\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\r\n var imageData = _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__[\"EnvironmentTextureTools\"].CreateImageDataArrayBufferViews(data, info);\r\n texture.format = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTUREFORMAT_RGBA;\r\n texture.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n texture.generateMipMaps = true;\r\n texture.getEngine().updateTextureSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE, texture);\r\n texture._isRGBD = true;\r\n texture.invertY = true;\r\n _this._native.loadCubeTexture(texture._webGLTexture, imageData, true);\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n if (files && files.length === 6) {\r\n throw new Error(\"Multi-file loading not yet supported.\");\r\n }\r\n else {\r\n var onInternalError = function (request, exception) {\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n this._loadFile(rootUrl, onloaddata, undefined, undefined, true, onInternalError);\r\n }\r\n }\r\n else {\r\n throw new Error(\"Cannot load cubemap: non-ENV format not supported.\");\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n // Returns a NativeFilter.XXXX value.\r\n NativeEngine.prototype._getSamplingFilter = function (samplingMode) {\r\n switch (samplingMode) {\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_BILINEAR_SAMPLINGMODE:\r\n return NativeFilter.MINLINEAR_MAGLINEAR_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE:\r\n return NativeFilter.MINLINEAR_MAGLINEAR_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE:\r\n return NativeFilter.MINPOINT_MAGPOINT_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_NEAREST_MIPNEAREST:\r\n return NativeFilter.MINPOINT_MAGPOINT_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_LINEAR_MIPNEAREST:\r\n return NativeFilter.MINLINEAR_MAGPOINT_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_LINEAR_MIPLINEAR:\r\n return NativeFilter.MINLINEAR_MAGPOINT_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_LINEAR:\r\n return NativeFilter.MINLINEAR_MAGPOINT_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_NEAREST:\r\n return NativeFilter.MINPOINT_MAGPOINT_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_NEAREST_MIPNEAREST:\r\n return NativeFilter.MINPOINT_MAGLINEAR_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_NEAREST_MIPLINEAR:\r\n return NativeFilter.MINPOINT_MAGLINEAR_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_LINEAR:\r\n return NativeFilter.MINLINEAR_MAGLINEAR_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_NEAREST:\r\n return NativeFilter.MINPOINT_MAGLINEAR_MIPLINEAR;\r\n default:\r\n throw new Error(\"Unexpected sampling mode: \" + samplingMode + \".\");\r\n }\r\n };\r\n NativeEngine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_7__[\"RenderTargetCreationOptions\"]();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE : options.samplingMode;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n fullOptions.samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE;\r\n }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n texture._depthStencilBuffer = {};\r\n texture._framebuffer = {};\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n NativeEngine.prototype.updateTextureSamplingMode = function (samplingMode, texture) {\r\n if (texture._webGLTexture) {\r\n var filter = this._getSamplingFilter(samplingMode);\r\n this._native.setTextureSampling(texture._webGLTexture, filter);\r\n }\r\n texture.samplingMode = samplingMode;\r\n };\r\n NativeEngine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {\r\n throw new Error(\"bindFramebuffer not yet implemented.\");\r\n };\r\n NativeEngine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n throw new Error(\"unBindFramebuffer not yet implemented.\");\r\n };\r\n NativeEngine.prototype.createDynamicVertexBuffer = function (data) {\r\n throw new Error(\"createDynamicVertexBuffer not yet implemented.\");\r\n };\r\n NativeEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n throw new Error(\"updateDynamicIndexBuffer not yet implemented.\");\r\n };\r\n /**\r\n * Updates a dynamic vertex buffer.\r\n * @param vertexBuffer the vertex buffer to update\r\n * @param data the data used to update the vertex buffer\r\n * @param byteOffset the byte offset of the data (optional)\r\n * @param byteLength the byte length of the data (optional)\r\n */\r\n NativeEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\r\n throw new Error(\"updateDynamicVertexBuffer not yet implemented.\");\r\n };\r\n // TODO: Refactor to share more logic with base Engine implementation.\r\n NativeEngine.prototype._setTexture = function (channel, texture, isPartOfTextureArray, depthStencilTexture) {\r\n if (isPartOfTextureArray === void 0) { isPartOfTextureArray = false; }\r\n if (depthStencilTexture === void 0) { depthStencilTexture = false; }\r\n var uniform = this._boundUniforms[channel];\r\n if (!uniform) {\r\n return false;\r\n }\r\n // Not ready?\r\n if (!texture) {\r\n if (this._boundTexturesCache[channel] != null) {\r\n this._activeChannel = channel;\r\n this._native.setTexture(uniform, null);\r\n }\r\n return false;\r\n }\r\n // Video\r\n if (texture.video) {\r\n this._activeChannel = channel;\r\n texture.update();\r\n }\r\n else if (texture.delayLoadState === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].DELAYLOADSTATE_NOTLOADED) { // Delay loading\r\n texture.delayLoad();\r\n return false;\r\n }\r\n var internalTexture;\r\n if (depthStencilTexture) {\r\n internalTexture = texture.depthStencilTexture;\r\n }\r\n else if (texture.isReady()) {\r\n internalTexture = texture.getInternalTexture();\r\n }\r\n else if (texture.isCube) {\r\n internalTexture = this.emptyCubeTexture;\r\n }\r\n else if (texture.is3D) {\r\n internalTexture = this.emptyTexture3D;\r\n }\r\n else {\r\n internalTexture = this.emptyTexture;\r\n }\r\n this._activeChannel = channel;\r\n if (!internalTexture ||\r\n !internalTexture._webGLTexture) {\r\n return false;\r\n }\r\n this._native.setTextureWrapMode(internalTexture._webGLTexture, this._getAddressMode(texture.wrapU), this._getAddressMode(texture.wrapV), this._getAddressMode(texture.wrapR));\r\n this._updateAnisotropicLevel(texture);\r\n this._native.setTexture(uniform, internalTexture._webGLTexture);\r\n return true;\r\n };\r\n // TODO: Share more of this logic with the base implementation.\r\n // TODO: Rename to match naming in base implementation once refactoring allows different parameters.\r\n NativeEngine.prototype._updateAnisotropicLevel = function (texture) {\r\n var internalTexture = texture.getInternalTexture();\r\n var value = texture.anisotropicFilteringLevel;\r\n if (!internalTexture || !internalTexture._webGLTexture) {\r\n return;\r\n }\r\n if (internalTexture._cachedAnisotropicFilteringLevel !== value) {\r\n this._native.setTextureAnisotropicLevel(internalTexture._webGLTexture, value);\r\n internalTexture._cachedAnisotropicFilteringLevel = value;\r\n }\r\n };\r\n // Returns a NativeAddressMode.XXX value.\r\n NativeEngine.prototype._getAddressMode = function (wrapMode) {\r\n switch (wrapMode) {\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_WRAP_ADDRESSMODE:\r\n return NativeAddressMode.WRAP;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_CLAMP_ADDRESSMODE:\r\n return NativeAddressMode.CLAMP;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_MIRROR_ADDRESSMODE:\r\n return NativeAddressMode.MIRROR;\r\n default:\r\n throw new Error(\"Unexpected wrap mode: \" + wrapMode + \".\");\r\n }\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._bindTexture = function (channel, texture) {\r\n throw new Error(\"_bindTexture not implemented.\");\r\n };\r\n NativeEngine.prototype._deleteBuffer = function (buffer) {\r\n if (buffer.nativeIndexBuffer) {\r\n this._native.deleteIndexBuffer(buffer.nativeIndexBuffer);\r\n delete buffer.nativeIndexBuffer;\r\n }\r\n if (buffer.nativeVertexBuffer) {\r\n this._native.deleteVertexBuffer(buffer.nativeVertexBuffer);\r\n delete buffer.nativeVertexBuffer;\r\n }\r\n };\r\n NativeEngine.prototype.releaseEffects = function () {\r\n // TODO\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadCompressedDataToTextureDirectly not implemented.\");\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadDataToTextureDirectly not implemented.\");\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadArrayBufferViewToTexture not implemented.\");\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadArrayBufferViewToTexture not implemented.\");\r\n };\r\n return NativeEngine;\r\n}(_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/nullEngine.ts\":\n/*!*******************************!*\\\n !*** ./Engines/nullEngine.ts ***!\n \\*******************************/\n/*! exports provided: NullEngineOptions, NullEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return NullEngineOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return NullEngine; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/dataBuffer */ \"./Meshes/dataBuffer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Options to create the null engine\r\n */\r\nvar NullEngineOptions = /** @class */ (function () {\r\n function NullEngineOptions() {\r\n /**\r\n * Render width (Default: 512)\r\n */\r\n this.renderWidth = 512;\r\n /**\r\n * Render height (Default: 256)\r\n */\r\n this.renderHeight = 256;\r\n /**\r\n * Texture size (Default: 512)\r\n */\r\n this.textureSize = 512;\r\n /**\r\n * If delta time between frames should be constant\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n this.deterministicLockstep = false;\r\n /**\r\n * Maximum about of steps between frames (Default: 4)\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n this.lockstepMaxSteps = 4;\r\n }\r\n return NullEngineOptions;\r\n}());\r\n\r\n/**\r\n * The null engine class provides support for headless version of babylon.js.\r\n * This can be used in server side scenario or for testing purposes\r\n */\r\nvar NullEngine = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NullEngine, _super);\r\n function NullEngine(options) {\r\n if (options === void 0) { options = new NullEngineOptions(); }\r\n var _this = _super.call(this, null) || this;\r\n if (options.deterministicLockstep === undefined) {\r\n options.deterministicLockstep = false;\r\n }\r\n if (options.lockstepMaxSteps === undefined) {\r\n options.lockstepMaxSteps = 4;\r\n }\r\n _this._options = options;\r\n // Init caps\r\n // We consider we are on a webgl1 capable device\r\n _this._caps = new _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"EngineCapabilities\"]();\r\n _this._caps.maxTexturesImageUnits = 16;\r\n _this._caps.maxVertexTextureImageUnits = 16;\r\n _this._caps.maxTextureSize = 512;\r\n _this._caps.maxCubemapTextureSize = 512;\r\n _this._caps.maxRenderTextureSize = 512;\r\n _this._caps.maxVertexAttribs = 16;\r\n _this._caps.maxVaryingVectors = 16;\r\n _this._caps.maxFragmentUniformVectors = 16;\r\n _this._caps.maxVertexUniformVectors = 16;\r\n // Extensions\r\n _this._caps.standardDerivatives = false;\r\n _this._caps.astc = null;\r\n _this._caps.s3tc = null;\r\n _this._caps.pvrtc = null;\r\n _this._caps.etc1 = null;\r\n _this._caps.etc2 = null;\r\n _this._caps.textureAnisotropicFilterExtension = null;\r\n _this._caps.maxAnisotropy = 0;\r\n _this._caps.uintIndices = false;\r\n _this._caps.fragmentDepthSupported = false;\r\n _this._caps.highPrecisionShaderSupported = true;\r\n _this._caps.colorBufferFloat = false;\r\n _this._caps.textureFloat = false;\r\n _this._caps.textureFloatLinearFiltering = false;\r\n _this._caps.textureFloatRender = false;\r\n _this._caps.textureHalfFloat = false;\r\n _this._caps.textureHalfFloatLinearFiltering = false;\r\n _this._caps.textureHalfFloatRender = false;\r\n _this._caps.textureLOD = false;\r\n _this._caps.drawBuffersExtension = false;\r\n _this._caps.depthTextureExtension = false;\r\n _this._caps.vertexArrayObject = false;\r\n _this._caps.instancedArrays = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log(\"Babylon.js v\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].Version + \" - Null engine\");\r\n // Wrappers\r\n var theCurrentGlobal = (typeof self !== \"undefined\" ? self : typeof global !== \"undefined\" ? global : window);\r\n if (typeof URL === \"undefined\") {\r\n theCurrentGlobal.URL = {\r\n createObjectURL: function () { },\r\n revokeObjectURL: function () { }\r\n };\r\n }\r\n if (typeof Blob === \"undefined\") {\r\n theCurrentGlobal.Blob = function () { };\r\n }\r\n return _this;\r\n }\r\n /**\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n NullEngine.prototype.isDeterministicLockStep = function () {\r\n return this._options.deterministicLockstep;\r\n };\r\n /** @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep */\r\n NullEngine.prototype.getLockstepMaxSteps = function () {\r\n return this._options.lockstepMaxSteps;\r\n };\r\n /**\r\n * Sets hardware scaling, used to save performance if needed\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\n NullEngine.prototype.getHardwareScalingLevel = function () {\r\n return 1.0;\r\n };\r\n NullEngine.prototype.createVertexBuffer = function (vertices) {\r\n var buffer = new _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__[\"DataBuffer\"]();\r\n buffer.references = 1;\r\n return buffer;\r\n };\r\n NullEngine.prototype.createIndexBuffer = function (indices) {\r\n var buffer = new _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__[\"DataBuffer\"]();\r\n buffer.references = 1;\r\n return buffer;\r\n };\r\n NullEngine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n };\r\n NullEngine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._options.renderWidth;\r\n };\r\n NullEngine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._options.renderHeight;\r\n };\r\n NullEngine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n this._cachedViewport = viewport;\r\n };\r\n NullEngine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context) {\r\n return {\r\n __SPECTOR_rebuildProgram: null,\r\n };\r\n };\r\n NullEngine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n return [];\r\n };\r\n NullEngine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n return [];\r\n };\r\n NullEngine.prototype.bindSamplers = function (effect) {\r\n this._currentEffect = null;\r\n };\r\n NullEngine.prototype.enableEffect = function (effect) {\r\n this._currentEffect = effect;\r\n if (effect.onBind) {\r\n effect.onBind(effect);\r\n }\r\n if (effect._onBindObservable) {\r\n effect._onBindObservable.notifyObservers(effect);\r\n }\r\n };\r\n NullEngine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n };\r\n NullEngine.prototype.setIntArray = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setIntArray2 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setIntArray3 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setIntArray4 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray2 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray3 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray4 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray2 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray3 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray4 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setMatrices = function (uniform, matrices) {\r\n };\r\n NullEngine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n };\r\n NullEngine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n };\r\n NullEngine.prototype.setFloat = function (uniform, value) {\r\n };\r\n NullEngine.prototype.setFloat2 = function (uniform, x, y) {\r\n };\r\n NullEngine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n };\r\n NullEngine.prototype.setBool = function (uniform, bool) {\r\n };\r\n NullEngine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n };\r\n NullEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n this._alphaState.alphaBlend = (mode !== _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].ALPHA_DISABLE);\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n };\r\n NullEngine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {\r\n };\r\n NullEngine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames) {\r\n return;\r\n }\r\n this.resetTextureCache();\r\n this._currentEffect = null;\r\n if (bruteForce) {\r\n this._currentProgram = null;\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this._alphaState.reset();\r\n }\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n };\r\n NullEngine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {\r\n };\r\n NullEngine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n };\r\n NullEngine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._createTexture = function () {\r\n return {};\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._releaseTexture = function (texture) {\r\n };\r\n NullEngine.prototype.createTexture = function (urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallBack, format) {\r\n if (samplingMode === void 0) { samplingMode = _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_URL);\r\n var url = String(urlArg);\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture.baseWidth = this._options.textureSize;\r\n texture.baseHeight = this._options.textureSize;\r\n texture.width = this._options.textureSize;\r\n texture.height = this._options.textureSize;\r\n if (format) {\r\n texture.format = format;\r\n }\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n NullEngine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetCreationOptions\"]();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n fullOptions.samplingMode = _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n texture._depthStencilBuffer = {};\r\n texture._framebuffer = {};\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n NullEngine.prototype.updateTextureSamplingMode = function (samplingMode, texture) {\r\n texture.samplingMode = samplingMode;\r\n };\r\n NullEngine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n this._currentRenderTarget = texture;\r\n this._currentFramebuffer = texture._MSAAFramebuffer ? texture._MSAAFramebuffer : texture._framebuffer;\r\n if (this._cachedViewport && !forceFullscreenViewport) {\r\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\r\n }\r\n };\r\n NullEngine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n if (onBeforeUnbind) {\r\n if (texture._MSAAFramebuffer) {\r\n this._currentFramebuffer = texture._framebuffer;\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._currentFramebuffer = null;\r\n };\r\n NullEngine.prototype.createDynamicVertexBuffer = function (vertices) {\r\n var buffer = new _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__[\"DataBuffer\"]();\r\n buffer.references = 1;\r\n buffer.capacity = 1;\r\n return buffer;\r\n };\r\n NullEngine.prototype.updateDynamicTexture = function (texture, canvas, invertY, premulAlpha, format) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n };\r\n NullEngine.prototype.areAllEffectsReady = function () {\r\n return true;\r\n };\r\n /**\r\n * @hidden\r\n * Get the current error code of the webGL context\r\n * @returns the error code\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\r\n */\r\n NullEngine.prototype.getError = function () {\r\n return 0;\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._getUnpackAlignement = function () {\r\n return 1;\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._unpackFlipY = function (value) {\r\n };\r\n NullEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n };\r\n /**\r\n * Updates a dynamic vertex buffer.\r\n * @param vertexBuffer the vertex buffer to update\r\n * @param data the data used to update the vertex buffer\r\n * @param byteOffset the byte offset of the data (optional)\r\n * @param byteLength the byte length of the data (optional)\r\n */\r\n NullEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, vertices, byteOffset, byteLength) {\r\n };\r\n NullEngine.prototype._bindTextureDirectly = function (target, texture) {\r\n if (this._boundTexturesCache[this._activeChannel] !== texture) {\r\n this._boundTexturesCache[this._activeChannel] = texture;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._bindTexture = function (channel, texture) {\r\n if (channel < 0) {\r\n return;\r\n }\r\n this._bindTextureDirectly(0, texture);\r\n };\r\n NullEngine.prototype._deleteBuffer = function (buffer) {\r\n };\r\n NullEngine.prototype.releaseEffects = function () {\r\n };\r\n NullEngine.prototype.displayLoadingUI = function () {\r\n };\r\n NullEngine.prototype.hideLoadingUI = function () {\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n return NullEngine;\r\n}(_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"]));\r\n\r\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"../node_modules/webpack/buildin/global.js\")))\n\n/***/ }),\n\n/***/ \"./Events/clipboardEvents.ts\":\n/*!***********************************!*\\\n !*** ./Events/clipboardEvents.ts ***!\n \\***********************************/\n/*! exports provided: ClipboardEventTypes, ClipboardInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return ClipboardEventTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return ClipboardInfo; });\n/**\r\n * Gather the list of clipboard event types as constants.\r\n */\r\nvar ClipboardEventTypes = /** @class */ (function () {\r\n function ClipboardEventTypes() {\r\n }\r\n /**\r\n * The clipboard event is fired when a copy command is active (pressed).\r\n */\r\n ClipboardEventTypes.COPY = 0x01; //\r\n /**\r\n * The clipboard event is fired when a cut command is active (pressed).\r\n */\r\n ClipboardEventTypes.CUT = 0x02;\r\n /**\r\n * The clipboard event is fired when a paste command is active (pressed).\r\n */\r\n ClipboardEventTypes.PASTE = 0x03;\r\n return ClipboardEventTypes;\r\n}());\r\n\r\n/**\r\n * This class is used to store clipboard related info for the onClipboardObservable event.\r\n */\r\nvar ClipboardInfo = /** @class */ (function () {\r\n /**\r\n *Creates an instance of ClipboardInfo.\r\n * @param type Defines the type of event (BABYLON.ClipboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function ClipboardInfo(\r\n /**\r\n * Defines the type of event (BABYLON.ClipboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n /**\r\n * Get the clipboard event's type from the keycode.\r\n * @param keyCode Defines the keyCode for the current keyboard event.\r\n * @return {number}\r\n */\r\n ClipboardInfo.GetTypeFromCharacter = function (keyCode) {\r\n var charCode = keyCode;\r\n //TODO: add codes for extended ASCII\r\n switch (charCode) {\r\n case 67: return ClipboardEventTypes.COPY;\r\n case 86: return ClipboardEventTypes.PASTE;\r\n case 88: return ClipboardEventTypes.CUT;\r\n default: return -1;\r\n }\r\n };\r\n return ClipboardInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Events/index.ts\":\n/*!*************************!*\\\n !*** ./Events/index.ts ***!\n \\*************************/\n/*! exports provided: KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keyboardEvents */ \"./Events/keyboardEvents.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfoPre\"]; });\n\n/* harmony import */ var _pointerEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerInfoBase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerInfo\"]; });\n\n/* harmony import */ var _clipboardEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./clipboardEvents */ \"./Events/clipboardEvents.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return _clipboardEvents__WEBPACK_IMPORTED_MODULE_2__[\"ClipboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return _clipboardEvents__WEBPACK_IMPORTED_MODULE_2__[\"ClipboardInfo\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Events/keyboardEvents.ts\":\n/*!**********************************!*\\\n !*** ./Events/keyboardEvents.ts ***!\n \\**********************************/\n/*! exports provided: KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return KeyboardEventTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return KeyboardInfo; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return KeyboardInfoPre; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * Gather the list of keyboard event types as constants.\r\n */\r\nvar KeyboardEventTypes = /** @class */ (function () {\r\n function KeyboardEventTypes() {\r\n }\r\n /**\r\n * The keydown event is fired when a key becomes active (pressed).\r\n */\r\n KeyboardEventTypes.KEYDOWN = 0x01;\r\n /**\r\n * The keyup event is fired when a key has been released.\r\n */\r\n KeyboardEventTypes.KEYUP = 0x02;\r\n return KeyboardEventTypes;\r\n}());\r\n\r\n/**\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n */\r\nvar KeyboardInfo = /** @class */ (function () {\r\n /**\r\n * Instantiates a new keyboard info.\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfo(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return KeyboardInfo;\r\n}());\r\n\r\n/**\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable\r\n */\r\nvar KeyboardInfoPre = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](KeyboardInfoPre, _super);\r\n /**\r\n * Instantiates a new keyboard pre info.\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfoPre(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.type = type;\r\n _this.event = event;\r\n _this.skipOnPointerObservable = false;\r\n return _this;\r\n }\r\n return KeyboardInfoPre;\r\n}(KeyboardInfo));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Events/pointerEvents.ts\":\n/*!*********************************!*\\\n !*** ./Events/pointerEvents.ts ***!\n \\*********************************/\n/*! exports provided: PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return PointerEventTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return PointerInfoBase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return PointerInfoPre; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return PointerInfo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n/**\r\n * Gather the list of pointer event types as constants.\r\n */\r\nvar PointerEventTypes = /** @class */ (function () {\r\n function PointerEventTypes() {\r\n }\r\n /**\r\n * The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.\r\n */\r\n PointerEventTypes.POINTERDOWN = 0x01;\r\n /**\r\n * The pointerup event is fired when a pointer is no longer active.\r\n */\r\n PointerEventTypes.POINTERUP = 0x02;\r\n /**\r\n * The pointermove event is fired when a pointer changes coordinates.\r\n */\r\n PointerEventTypes.POINTERMOVE = 0x04;\r\n /**\r\n * The pointerwheel event is fired when a mouse wheel has been rotated.\r\n */\r\n PointerEventTypes.POINTERWHEEL = 0x08;\r\n /**\r\n * The pointerpick event is fired when a mesh or sprite has been picked by the pointer.\r\n */\r\n PointerEventTypes.POINTERPICK = 0x10;\r\n /**\r\n * The pointertap event is fired when a the object has been touched and released without drag.\r\n */\r\n PointerEventTypes.POINTERTAP = 0x20;\r\n /**\r\n * The pointerdoubletap event is fired when a the object has been touched and released twice without drag.\r\n */\r\n PointerEventTypes.POINTERDOUBLETAP = 0x40;\r\n return PointerEventTypes;\r\n}());\r\n\r\n/**\r\n * Base class of pointer info types.\r\n */\r\nvar PointerInfoBase = /** @class */ (function () {\r\n /**\r\n * Instantiates the base class of pointers info.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function PointerInfoBase(\r\n /**\r\n * Defines the type of event (PointerEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return PointerInfoBase;\r\n}());\r\n\r\n/**\r\n * This class is used to store pointer related info for the onPrePointerObservable event.\r\n * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable\r\n */\r\nvar PointerInfoPre = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PointerInfoPre, _super);\r\n /**\r\n * Instantiates a PointerInfoPre to store pointer related info to the onPrePointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param localX Defines the local x coordinates of the pointer when the event occured\r\n * @param localY Defines the local y coordinates of the pointer when the event occured\r\n */\r\n function PointerInfoPre(type, event, localX, localY) {\r\n var _this = _super.call(this, type, event) || this;\r\n /**\r\n * Ray from a pointer if availible (eg. 6dof controller)\r\n */\r\n _this.ray = null;\r\n _this.skipOnPointerObservable = false;\r\n _this.localPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](localX, localY);\r\n return _this;\r\n }\r\n return PointerInfoPre;\r\n}(PointerInfoBase));\r\n\r\n/**\r\n * This type contains all the data related to a pointer event in Babylon.js.\r\n * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.\r\n */\r\nvar PointerInfo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PointerInfo, _super);\r\n /**\r\n * Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param pickInfo Defines the picking info associated to the info (if any)\\\r\n */\r\n function PointerInfo(type, event, \r\n /**\r\n * Defines the picking info associated to the info (if any)\\\r\n */\r\n pickInfo) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.pickInfo = pickInfo;\r\n return _this;\r\n }\r\n return PointerInfo;\r\n}(PointerInfoBase));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/daydreamController.ts\":\n/*!****************************************************!*\\\n !*** ./Gamepads/Controllers/daydreamController.ts ***!\n \\****************************************************/\n/*! exports provided: DaydreamController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return DaydreamController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Google Daydream controller\r\n */\r\nvar DaydreamController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DaydreamController, _super);\r\n /**\r\n * Creates a new DaydreamController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function DaydreamController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerType\"].DAYDREAM;\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n DaydreamController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoader\"].ImportMesh(\"\", DaydreamController.MODEL_BASE_URL, DaydreamController.MODEL_FILENAME, scene, function (newMeshes) {\r\n _this._defaultModel = newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n DaydreamController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n // Daydream controller only has 1 GamepadButton (on the trackpad).\r\n if (buttonIdx === 0) {\r\n var observable = this.onTriggerStateChangedObservable;\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n }\r\n else {\r\n // If the app or home buttons are ever made available\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Unrecognized Daydream button index: \" + buttonIdx);\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n DaydreamController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/generic/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n DaydreamController.MODEL_FILENAME = 'generic.babylon';\r\n /**\r\n * Gamepad Id prefix used to identify Daydream Controller.\r\n */\r\n DaydreamController.GAMEPAD_ID_PREFIX = 'Daydream'; // id is 'Daydream Controller'\r\n return DaydreamController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_3__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.indexOf(DaydreamController.GAMEPAD_ID_PREFIX) === 0;\r\n },\r\n create: function (gamepadInfo) {\r\n return new DaydreamController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/gearVRController.ts\":\n/*!**************************************************!*\\\n !*** ./Gamepads/Controllers/gearVRController.ts ***!\n \\**************************************************/\n/*! exports provided: GearVRController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return GearVRController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gear VR Controller\r\n */\r\nvar GearVRController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GearVRController, _super);\r\n /**\r\n * Creates a new GearVRController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function GearVRController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this._buttonIndexToObservableNameMap = [\r\n 'onPadStateChangedObservable',\r\n 'onTriggerStateChangedObservable' // Trigger\r\n ];\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_5__[\"PoseEnabledControllerType\"].GEAR_VR;\r\n // Initial starting position defaults to where hand would be (incase of only 3dof controller)\r\n _this._calculatedPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](_this.hand == \"left\" ? -0.15 : 0.15, -0.5, 0.25);\r\n _this._disableTrackPosition(_this._calculatedPosition);\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n GearVRController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_3__[\"SceneLoader\"].ImportMesh(\"\", GearVRController.MODEL_BASE_URL, GearVRController.MODEL_FILENAME, scene, function (newMeshes) {\r\n // Offset the controller so it will rotate around the users wrist\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"\", scene);\r\n newMeshes[1].parent = mesh;\r\n newMeshes[1].position.z = -0.15;\r\n _this._defaultModel = mesh;\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n GearVRController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n if (buttonIdx < this._buttonIndexToObservableNameMap.length) {\r\n var observableName = this._buttonIndexToObservableNameMap[buttonIdx];\r\n // Only emit events for buttons that we know how to map from index to observable\r\n var observable = this[observableName];\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n GearVRController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/generic/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n GearVRController.MODEL_FILENAME = 'generic.babylon';\r\n /**\r\n * Gamepad Id prefix used to identify this controller.\r\n */\r\n GearVRController.GAMEPAD_ID_PREFIX = 'Gear VR'; // id is 'Gear VR Controller'\r\n return GearVRController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_4__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_5__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.indexOf(GearVRController.GAMEPAD_ID_PREFIX) === 0 ||\r\n gamepadInfo.id.indexOf('Oculus Go') !== -1 ||\r\n gamepadInfo.id.indexOf('Vive Focus') !== -1;\r\n },\r\n create: function (gamepadInfo) {\r\n return new GearVRController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/genericController.ts\":\n/*!***************************************************!*\\\n !*** ./Gamepads/Controllers/genericController.ts ***!\n \\***************************************************/\n/*! exports provided: GenericController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return GenericController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Generic Controller\r\n */\r\nvar GenericController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GenericController, _super);\r\n /**\r\n * Creates a new GenericController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function GenericController(vrGamepad) {\r\n return _super.call(this, vrGamepad) || this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n GenericController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__[\"SceneLoader\"].ImportMesh(\"\", GenericController.MODEL_BASE_URL, GenericController.MODEL_FILENAME, scene, function (newMeshes) {\r\n _this._defaultModel = newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n GenericController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n console.log(\"Button id: \" + buttonIdx + \"state: \");\r\n console.dir(state);\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n GenericController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/generic/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n GenericController.MODEL_FILENAME = 'generic.babylon';\r\n return GenericController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_2__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_3__[\"PoseEnabledControllerHelper\"]._DefaultControllerFactory = function (gamepadInfo) { return new GenericController(gamepadInfo); };\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/index.ts\":\n/*!***************************************!*\\\n !*** ./Gamepads/Controllers/index.ts ***!\n \\***************************************/\n/*! exports provided: DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _daydreamController__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./daydreamController */ \"./Gamepads/Controllers/daydreamController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _daydreamController__WEBPACK_IMPORTED_MODULE_0__[\"DaydreamController\"]; });\n\n/* harmony import */ var _gearVRController__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gearVRController */ \"./Gamepads/Controllers/gearVRController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _gearVRController__WEBPACK_IMPORTED_MODULE_1__[\"GearVRController\"]; });\n\n/* harmony import */ var _genericController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./genericController */ \"./Gamepads/Controllers/genericController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _genericController__WEBPACK_IMPORTED_MODULE_2__[\"GenericController\"]; });\n\n/* harmony import */ var _oculusTouchController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./oculusTouchController */ \"./Gamepads/Controllers/oculusTouchController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _oculusTouchController__WEBPACK_IMPORTED_MODULE_3__[\"OculusTouchController\"]; });\n\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledController\"]; });\n\n/* harmony import */ var _viveController__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./viveController */ \"./Gamepads/Controllers/viveController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _viveController__WEBPACK_IMPORTED_MODULE_5__[\"ViveController\"]; });\n\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _webVRController__WEBPACK_IMPORTED_MODULE_6__[\"WebVRController\"]; });\n\n/* harmony import */ var _windowsMotionController__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./windowsMotionController */ \"./Gamepads/Controllers/windowsMotionController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _windowsMotionController__WEBPACK_IMPORTED_MODULE_7__[\"WindowsMotionController\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/oculusTouchController.ts\":\n/*!*******************************************************!*\\\n !*** ./Gamepads/Controllers/oculusTouchController.ts ***!\n \\*******************************************************/\n/*! exports provided: OculusTouchController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return OculusTouchController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Oculus Touch Controller\r\n */\r\nvar OculusTouchController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](OculusTouchController, _super);\r\n /**\r\n * Creates a new OculusTouchController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function OculusTouchController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n /**\r\n * Fired when the secondary trigger on this controller is modified\r\n */\r\n _this.onSecondaryTriggerStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the thumb rest on this controller is modified\r\n */\r\n _this.onThumbRestChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerType\"].OCULUS;\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n OculusTouchController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n var meshName;\r\n // Hand\r\n if (this.hand === 'left') {\r\n meshName = OculusTouchController.MODEL_LEFT_FILENAME;\r\n }\r\n else { // Right is the default if no hand is specified\r\n meshName = OculusTouchController.MODEL_RIGHT_FILENAME;\r\n }\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoader\"].ImportMesh(\"\", OculusTouchController._IsQuest ? OculusTouchController.QUEST_MODEL_BASE_URL : OculusTouchController.MODEL_BASE_URL, meshName, scene, function (newMeshes) {\r\n /*\r\n Parent Mesh name: oculus_touch_left\r\n - body\r\n - trigger\r\n - thumbstick\r\n - grip\r\n - button_y\r\n - button_x\r\n - button_enter\r\n */\r\n _this._defaultModel = OculusTouchController._IsQuest ? newMeshes[0] : newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n Object.defineProperty(OculusTouchController.prototype, \"onAButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the A button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'right') {\r\n return this.onMainButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No A button on left hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OculusTouchController.prototype, \"onBButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the B button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'right') {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No B button on left hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OculusTouchController.prototype, \"onXButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the X button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'left') {\r\n return this.onMainButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No X button on right hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OculusTouchController.prototype, \"onYButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the Y button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'left') {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No Y button on right hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * 0) thumb stick (touch, press, value = pressed (0,1)). value is in this.leftStick\r\n * 1) index trigger (touch (?), press (only when value > 0.1), value 0 to 1)\r\n * 2) secondary trigger (same)\r\n * 3) A (right) X (left), touch, pressed = value\r\n * 4) B / Y\r\n * 5) thumb rest\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n OculusTouchController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n var notifyObject = state; //{ state: state, changes: changes };\r\n var triggerDirection = this.hand === 'right' ? -1 : 1;\r\n switch (buttonIdx) {\r\n case 0:\r\n this.onPadStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 1: // index trigger\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n (this._defaultModel.getChildren()[3]).rotation.x = -notifyObject.value * 0.20;\r\n (this._defaultModel.getChildren()[3]).position.y = -notifyObject.value * 0.005;\r\n (this._defaultModel.getChildren()[3]).position.z = -notifyObject.value * 0.005;\r\n }\r\n this.onTriggerStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 2: // secondary trigger\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n (this._defaultModel.getChildren()[4]).position.x = triggerDirection * notifyObject.value * 0.0035;\r\n }\r\n this.onSecondaryTriggerStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 3:\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n if (notifyObject.pressed) {\r\n (this._defaultModel.getChildren()[1]).position.y = -0.001;\r\n }\r\n else {\r\n (this._defaultModel.getChildren()[1]).position.y = 0;\r\n }\r\n }\r\n this.onMainButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 4:\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n if (notifyObject.pressed) {\r\n (this._defaultModel.getChildren()[2]).position.y = -0.001;\r\n }\r\n else {\r\n (this._defaultModel.getChildren()[2]).position.y = 0;\r\n }\r\n }\r\n this.onSecondaryButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 5:\r\n this.onThumbRestChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n OculusTouchController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/oculus/';\r\n /**\r\n * File name for the left controller model.\r\n */\r\n OculusTouchController.MODEL_LEFT_FILENAME = 'left.babylon';\r\n /**\r\n * File name for the right controller model.\r\n */\r\n OculusTouchController.MODEL_RIGHT_FILENAME = 'right.babylon';\r\n /**\r\n * Base Url for the Quest controller model.\r\n */\r\n OculusTouchController.QUEST_MODEL_BASE_URL = 'https://controllers.babylonjs.com/oculusQuest/';\r\n /**\r\n * @hidden\r\n * If the controllers are running on a device that needs the updated Quest controller models\r\n */\r\n OculusTouchController._IsQuest = false;\r\n return OculusTouchController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_3__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n // If the headset reports being an Oculus Quest, use the Quest controller models\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].LastCreatedEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].LastCreatedEngine._vrDisplay && _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].LastCreatedEngine._vrDisplay.displayName === \"Oculus Quest\") {\r\n OculusTouchController._IsQuest = true;\r\n }\r\n return gamepadInfo.id.indexOf('Oculus Touch') !== -1;\r\n },\r\n create: function (gamepadInfo) {\r\n return new OculusTouchController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/poseEnabledController.ts\":\n/*!*******************************************************!*\\\n !*** ./Gamepads/Controllers/poseEnabledController.ts ***!\n \\*******************************************************/\n/*! exports provided: PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return PoseEnabledControllerType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return PoseEnabledControllerHelper; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return PoseEnabledController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n* Defines the types of pose enabled controllers that are supported\r\n*/\r\nvar PoseEnabledControllerType;\r\n(function (PoseEnabledControllerType) {\r\n /**\r\n * HTC Vive\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"VIVE\"] = 0] = \"VIVE\";\r\n /**\r\n * Oculus Rift\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"OCULUS\"] = 1] = \"OCULUS\";\r\n /**\r\n * Windows mixed reality\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"WINDOWS\"] = 2] = \"WINDOWS\";\r\n /**\r\n * Samsung gear VR\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"GEAR_VR\"] = 3] = \"GEAR_VR\";\r\n /**\r\n * Google Daydream\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"DAYDREAM\"] = 4] = \"DAYDREAM\";\r\n /**\r\n * Generic\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"GENERIC\"] = 5] = \"GENERIC\";\r\n})(PoseEnabledControllerType || (PoseEnabledControllerType = {}));\r\n/**\r\n * Defines the PoseEnabledControllerHelper object that is used initialize a gamepad as the controller type it is specified as (eg. windows mixed reality controller)\r\n */\r\nvar PoseEnabledControllerHelper = /** @class */ (function () {\r\n function PoseEnabledControllerHelper() {\r\n }\r\n /**\r\n * Initializes a gamepad as the controller type it is specified as (eg. windows mixed reality controller)\r\n * @param vrGamepad the gamepad to initialized\r\n * @returns a vr controller of the type the gamepad identified as\r\n */\r\n PoseEnabledControllerHelper.InitiateController = function (vrGamepad) {\r\n for (var _i = 0, _a = this._ControllerFactories; _i < _a.length; _i++) {\r\n var factory = _a[_i];\r\n if (factory.canCreate(vrGamepad)) {\r\n return factory.create(vrGamepad);\r\n }\r\n }\r\n if (this._DefaultControllerFactory) {\r\n return this._DefaultControllerFactory(vrGamepad);\r\n }\r\n throw \"The type of gamepad you are trying to load needs to be imported first or is not supported.\";\r\n };\r\n /** @hidden */\r\n PoseEnabledControllerHelper._ControllerFactories = [];\r\n /** @hidden */\r\n PoseEnabledControllerHelper._DefaultControllerFactory = null;\r\n return PoseEnabledControllerHelper;\r\n}());\r\n\r\n/**\r\n * Defines the PoseEnabledController object that contains state of a vr capable controller\r\n */\r\nvar PoseEnabledController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PoseEnabledController, _super);\r\n /**\r\n * Creates a new PoseEnabledController from a gamepad\r\n * @param browserGamepad the gamepad that the PoseEnabledController should be created from\r\n */\r\n function PoseEnabledController(browserGamepad) {\r\n var _this = _super.call(this, browserGamepad.id, browserGamepad.index, browserGamepad) || this;\r\n /**\r\n * If the controller is used in a webXR session\r\n */\r\n _this.isXR = false;\r\n // Represents device position and rotation in room space. Should only be used to help calculate babylon space values\r\n _this._deviceRoomPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._deviceRoomRotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * The device position in babylon space\r\n */\r\n _this.devicePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /**\r\n * The device rotation in babylon space\r\n */\r\n _this.deviceRotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * The scale factor of the device in babylon space\r\n */\r\n _this.deviceScaleFactor = 1;\r\n // Used to convert 6dof controllers to 3dof\r\n _this._trackPosition = true;\r\n _this._maxRotationDistFromHeadset = Math.PI / 5;\r\n _this._draggedRoomRotation = 0;\r\n _this._leftHandSystemQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * Internal, matrix used to convert room space to babylon space\r\n * @hidden\r\n */\r\n _this._deviceToWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n /**\r\n * Node to be used when casting a ray from the controller\r\n * @hidden\r\n */\r\n _this._pointingPoseNode = null;\r\n _this._workingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n /**\r\n * @hidden\r\n */\r\n _this._meshAttachedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this.type = _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"].POSE_ENABLED;\r\n _this.controllerType = PoseEnabledControllerType.GENERIC;\r\n _this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this._calculatedPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._calculatedRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRollToRef(Math.PI, 0, 0, _this._leftHandSystemQuaternion);\r\n return _this;\r\n }\r\n /**\r\n * @hidden\r\n */\r\n PoseEnabledController.prototype._disableTrackPosition = function (fixedPosition) {\r\n if (this._trackPosition) {\r\n this._calculatedPosition.copyFrom(fixedPosition);\r\n this._trackPosition = false;\r\n }\r\n };\r\n /**\r\n * Updates the state of the pose enbaled controller and mesh based on the current position and rotation of the controller\r\n */\r\n PoseEnabledController.prototype.update = function () {\r\n if (this.isXR) {\r\n return;\r\n }\r\n _super.prototype.update.call(this);\r\n this._updatePoseAndMesh();\r\n };\r\n /**\r\n * Updates only the pose device and mesh without doing any button event checking\r\n */\r\n PoseEnabledController.prototype._updatePoseAndMesh = function () {\r\n if (this.isXR) {\r\n return;\r\n }\r\n var pose = this.browserGamepad.pose;\r\n this.updateFromDevice(pose);\r\n if (!this._trackPosition && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene.activeCamera && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene.activeCamera.devicePosition) {\r\n var camera = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene.activeCamera;\r\n camera._computeDevicePosition();\r\n this._deviceToWorld.setTranslation(camera.devicePosition);\r\n if (camera.deviceRotationQuaternion) {\r\n var camera = camera;\r\n camera._deviceRoomRotationQuaternion.toEulerAnglesToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Vector3[0]);\r\n // Find the radian distance away that the headset is from the controllers rotation\r\n var distanceAway = Math.atan2(Math.sin(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Vector3[0].y - this._draggedRoomRotation), Math.cos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Vector3[0].y - this._draggedRoomRotation));\r\n if (Math.abs(distanceAway) > this._maxRotationDistFromHeadset) {\r\n // Only rotate enouph to be within the _maxRotationDistFromHeadset\r\n var rotationAmount = distanceAway - (distanceAway < 0 ? -this._maxRotationDistFromHeadset : this._maxRotationDistFromHeadset);\r\n this._draggedRoomRotation += rotationAmount;\r\n // Rotate controller around headset\r\n var sin = Math.sin(-rotationAmount);\r\n var cos = Math.cos(-rotationAmount);\r\n this._calculatedPosition.x = this._calculatedPosition.x * cos - this._calculatedPosition.z * sin;\r\n this._calculatedPosition.z = this._calculatedPosition.x * sin + this._calculatedPosition.z * cos;\r\n }\r\n }\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(this._calculatedPosition, this._deviceToWorld, this.devicePosition);\r\n this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);\r\n this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation);\r\n if (this._mesh) {\r\n this._mesh.position.copyFrom(this.devicePosition);\r\n if (this._mesh.rotationQuaternion) {\r\n this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion);\r\n }\r\n }\r\n };\r\n /**\r\n * Updates the state of the pose enbaled controller based on the raw pose data from the device\r\n * @param poseData raw pose fromthe device\r\n */\r\n PoseEnabledController.prototype.updateFromDevice = function (poseData) {\r\n if (this.isXR) {\r\n return;\r\n }\r\n if (poseData) {\r\n this.rawPose = poseData;\r\n if (poseData.position) {\r\n this._deviceRoomPosition.copyFromFloats(poseData.position[0], poseData.position[1], -poseData.position[2]);\r\n if (this._mesh && this._mesh.getScene().useRightHandedSystem) {\r\n this._deviceRoomPosition.z *= -1;\r\n }\r\n if (this._trackPosition) {\r\n this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor, this._calculatedPosition);\r\n }\r\n this._calculatedPosition.addInPlace(this.position);\r\n }\r\n var pose = this.rawPose;\r\n if (poseData.orientation && pose.orientation && pose.orientation.length === 4) {\r\n this._deviceRoomRotationQuaternion.copyFromFloats(pose.orientation[0], pose.orientation[1], -pose.orientation[2], -pose.orientation[3]);\r\n if (this._mesh) {\r\n if (this._mesh.getScene().useRightHandedSystem) {\r\n this._deviceRoomRotationQuaternion.z *= -1;\r\n this._deviceRoomRotationQuaternion.w *= -1;\r\n }\r\n else {\r\n this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion, this._deviceRoomRotationQuaternion);\r\n }\r\n }\r\n // if the camera is set, rotate to the camera's rotation\r\n this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion, this._calculatedRotation);\r\n }\r\n }\r\n };\r\n /**\r\n * Attaches a mesh to the controller\r\n * @param mesh the mesh to be attached\r\n */\r\n PoseEnabledController.prototype.attachToMesh = function (mesh) {\r\n if (this._mesh) {\r\n this._mesh.parent = null;\r\n }\r\n this._mesh = mesh;\r\n if (this._poseControlledCamera) {\r\n this._mesh.parent = this._poseControlledCamera;\r\n }\r\n if (!this._mesh.rotationQuaternion) {\r\n this._mesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n // Sync controller mesh and pointing pose node's state with controller, this is done to avoid a frame where position is 0,0,0 when attaching mesh\r\n if (!this.isXR) {\r\n this._updatePoseAndMesh();\r\n if (this._pointingPoseNode) {\r\n var parents = [];\r\n var obj = this._pointingPoseNode;\r\n while (obj.parent) {\r\n parents.push(obj.parent);\r\n obj = obj.parent;\r\n }\r\n parents.reverse().forEach(function (p) { p.computeWorldMatrix(true); });\r\n }\r\n }\r\n this._meshAttachedObservable.notifyObservers(mesh);\r\n };\r\n /**\r\n * Attaches the controllers mesh to a camera\r\n * @param camera the camera the mesh should be attached to\r\n */\r\n PoseEnabledController.prototype.attachToPoseControlledCamera = function (camera) {\r\n this._poseControlledCamera = camera;\r\n if (this._mesh) {\r\n this._mesh.parent = this._poseControlledCamera;\r\n }\r\n };\r\n /**\r\n * Disposes of the controller\r\n */\r\n PoseEnabledController.prototype.dispose = function () {\r\n if (this._mesh) {\r\n this._mesh.dispose();\r\n }\r\n this._mesh = null;\r\n _super.prototype.dispose.call(this);\r\n };\r\n Object.defineProperty(PoseEnabledController.prototype, \"mesh\", {\r\n /**\r\n * The mesh that is attached to the controller\r\n */\r\n get: function () {\r\n return this._mesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the ray of the controller in the direction the controller is pointing\r\n * @param length the length the resulting ray should be\r\n * @returns a ray in the direction the controller is pointing\r\n */\r\n PoseEnabledController.prototype.getForwardRay = function (length) {\r\n if (length === void 0) { length = 100; }\r\n if (!this.mesh) {\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 1), length);\r\n }\r\n var m = this._pointingPoseNode ? this._pointingPoseNode.getWorldMatrix() : this.mesh.getWorldMatrix();\r\n var origin = m.getTranslation();\r\n var forward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, -1);\r\n var forwardWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormal(forward, m);\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(forwardWorld);\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"](origin, direction, length);\r\n };\r\n /**\r\n * Name of the child mesh that can be used to cast a ray from the controller\r\n */\r\n PoseEnabledController.POINTING_POSE = \"POINTING_POSE\";\r\n return PoseEnabledController;\r\n}(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/viveController.ts\":\n/*!************************************************!*\\\n !*** ./Gamepads/Controllers/viveController.ts ***!\n \\************************************************/\n/*! exports provided: ViveController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return ViveController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Vive Controller\r\n */\r\nvar ViveController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ViveController, _super);\r\n /**\r\n * Creates a new ViveController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function ViveController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_3__[\"PoseEnabledControllerType\"].VIVE;\r\n _this._invertLeftStickY = true;\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n ViveController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__[\"SceneLoader\"].ImportMesh(\"\", ViveController.MODEL_BASE_URL, ViveController.MODEL_FILENAME, scene, function (newMeshes) {\r\n /*\r\n Parent Mesh name: ViveWand\r\n - body\r\n - r_gripper\r\n - l_gripper\r\n - menu_button\r\n - system_button\r\n - trackpad\r\n - trigger\r\n - LED\r\n */\r\n _this._defaultModel = newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n Object.defineProperty(ViveController.prototype, \"onLeftButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the left button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onMainButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViveController.prototype, \"onRightButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the right button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onMainButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViveController.prototype, \"onMenuButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the menu button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * Vive mapping:\r\n * 0: touchpad\r\n * 1: trigger\r\n * 2: left AND right buttons\r\n * 3: menu button\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n ViveController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n var notifyObject = state; //{ state: state, changes: changes };\r\n switch (buttonIdx) {\r\n case 0:\r\n this.onPadStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 1: // index trigger\r\n if (this._defaultModel) {\r\n (this._defaultModel.getChildren()[6]).rotation.x = -notifyObject.value * 0.15;\r\n }\r\n this.onTriggerStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 2: // left AND right button\r\n this.onMainButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 3:\r\n if (this._defaultModel) {\r\n if (notifyObject.pressed) {\r\n (this._defaultModel.getChildren()[2]).position.y = -0.001;\r\n }\r\n else {\r\n (this._defaultModel.getChildren()[2]).position.y = 0;\r\n }\r\n }\r\n this.onSecondaryButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n ViveController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/vive/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n ViveController.MODEL_FILENAME = 'wand.babylon';\r\n return ViveController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_2__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_3__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.toLowerCase().indexOf('openvr') !== -1;\r\n },\r\n create: function (gamepadInfo) {\r\n return new ViveController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/webVRController.ts\":\n/*!*************************************************!*\\\n !*** ./Gamepads/Controllers/webVRController.ts ***!\n \\*************************************************/\n/*! exports provided: WebVRController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return WebVRController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n/**\r\n * Defines the WebVRController object that represents controllers tracked in 3D space\r\n */\r\nvar WebVRController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebVRController, _super);\r\n /**\r\n * Creates a new WebVRController from a gamepad\r\n * @param vrGamepad the gamepad that the WebVRController should be created from\r\n */\r\n function WebVRController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n // Observables\r\n /**\r\n * Fired when the trigger state has changed\r\n */\r\n _this.onTriggerStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the main button state has changed\r\n */\r\n _this.onMainButtonStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the secondary button state has changed\r\n */\r\n _this.onSecondaryButtonStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the pad state has changed\r\n */\r\n _this.onPadStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when controllers stick values have changed\r\n */\r\n _this.onPadValuesChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * X and Y axis corresponding to the controllers joystick\r\n */\r\n _this.pad = { x: 0, y: 0 };\r\n // avoid GC, store state in a tmp object\r\n _this._changes = {\r\n pressChanged: false,\r\n touchChanged: false,\r\n valueChanged: false,\r\n changed: false\r\n };\r\n _this._buttons = new Array(vrGamepad.buttons.length);\r\n _this.hand = vrGamepad.hand;\r\n return _this;\r\n }\r\n /**\r\n * Fired when a controller button's state has changed\r\n * @param callback the callback containing the button that was modified\r\n */\r\n WebVRController.prototype.onButtonStateChange = function (callback) {\r\n this._onButtonStateChange = callback;\r\n };\r\n Object.defineProperty(WebVRController.prototype, \"defaultModel\", {\r\n /**\r\n * The default controller model for the controller\r\n */\r\n get: function () {\r\n return this._defaultModel;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the state of the controller and mesh based on the current position and rotation of the controller\r\n */\r\n WebVRController.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n for (var index = 0; index < this._buttons.length; index++) {\r\n this._setButtonValue(this.browserGamepad.buttons[index], this._buttons[index], index);\r\n }\r\n if (this.leftStick.x !== this.pad.x || this.leftStick.y !== this.pad.y) {\r\n this.pad.x = this.leftStick.x;\r\n this.pad.y = this.leftStick.y;\r\n this.onPadValuesChangedObservable.notifyObservers(this.pad);\r\n }\r\n };\r\n WebVRController.prototype._setButtonValue = function (newState, currentState, buttonIndex) {\r\n if (!newState) {\r\n newState = {\r\n pressed: false,\r\n touched: false,\r\n value: 0\r\n };\r\n }\r\n if (!currentState) {\r\n this._buttons[buttonIndex] = {\r\n pressed: newState.pressed,\r\n touched: newState.touched,\r\n value: newState.value\r\n };\r\n return;\r\n }\r\n this._checkChanges(newState, currentState);\r\n if (this._changes.changed) {\r\n this._onButtonStateChange && this._onButtonStateChange(this.index, buttonIndex, newState);\r\n this._handleButtonChange(buttonIndex, newState, this._changes);\r\n }\r\n this._buttons[buttonIndex].pressed = newState.pressed;\r\n this._buttons[buttonIndex].touched = newState.touched;\r\n // oculus triggers are never 0, thou not touched.\r\n this._buttons[buttonIndex].value = newState.value < 0.00000001 ? 0 : newState.value;\r\n };\r\n WebVRController.prototype._checkChanges = function (newState, currentState) {\r\n this._changes.pressChanged = newState.pressed !== currentState.pressed;\r\n this._changes.touchChanged = newState.touched !== currentState.touched;\r\n this._changes.valueChanged = newState.value !== currentState.value;\r\n this._changes.changed = this._changes.pressChanged || this._changes.touchChanged || this._changes.valueChanged;\r\n return this._changes;\r\n };\r\n /**\r\n * Disposes of th webVRCOntroller\r\n */\r\n WebVRController.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onTriggerStateChangedObservable.clear();\r\n this.onMainButtonStateChangedObservable.clear();\r\n this.onSecondaryButtonStateChangedObservable.clear();\r\n this.onPadStateChangedObservable.clear();\r\n this.onPadValuesChangedObservable.clear();\r\n };\r\n return WebVRController;\r\n}(_poseEnabledController__WEBPACK_IMPORTED_MODULE_2__[\"PoseEnabledController\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/windowsMotionController.ts\":\n/*!*********************************************************!*\\\n !*** ./Gamepads/Controllers/windowsMotionController.ts ***!\n \\*********************************************************/\n/*! exports provided: WindowsMotionController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return WindowsMotionController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _genericController__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./genericController */ \"./Gamepads/Controllers/genericController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines the LoadedMeshInfo object that describes information about the loaded webVR controller mesh\r\n */\r\nvar LoadedMeshInfo = /** @class */ (function () {\r\n function LoadedMeshInfo() {\r\n /**\r\n * Map of the button meshes contained in the controller\r\n */\r\n this.buttonMeshes = {};\r\n /**\r\n * Map of the axis meshes contained in the controller\r\n */\r\n this.axisMeshes = {};\r\n }\r\n return LoadedMeshInfo;\r\n}());\r\n/**\r\n * Defines the WindowsMotionController object that the state of the windows motion controller\r\n */\r\nvar WindowsMotionController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WindowsMotionController, _super);\r\n /**\r\n * Creates a new WindowsMotionController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function WindowsMotionController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this._mapping = {\r\n // Semantic button names\r\n buttons: ['thumbstick', 'trigger', 'grip', 'menu', 'trackpad'],\r\n // A mapping of the button name to glTF model node name\r\n // that should be transformed by button value.\r\n buttonMeshNames: {\r\n 'trigger': 'SELECT',\r\n 'menu': 'MENU',\r\n 'grip': 'GRASP',\r\n 'thumbstick': 'THUMBSTICK_PRESS',\r\n 'trackpad': 'TOUCHPAD_PRESS'\r\n },\r\n // This mapping is used to translate from the Motion Controller to Babylon semantics\r\n buttonObservableNames: {\r\n 'trigger': 'onTriggerStateChangedObservable',\r\n 'menu': 'onSecondaryButtonStateChangedObservable',\r\n 'grip': 'onMainButtonStateChangedObservable',\r\n 'thumbstick': 'onPadStateChangedObservable',\r\n 'trackpad': 'onTrackpadChangedObservable'\r\n },\r\n // A mapping of the axis name to glTF model node name\r\n // that should be transformed by axis value.\r\n // This array mirrors the browserGamepad.axes array, such that\r\n // the mesh corresponding to axis 0 is in this array index 0.\r\n axisMeshNames: [\r\n 'THUMBSTICK_X',\r\n 'THUMBSTICK_Y',\r\n 'TOUCHPAD_TOUCH_X',\r\n 'TOUCHPAD_TOUCH_Y'\r\n ],\r\n pointingPoseMeshName: _poseEnabledController__WEBPACK_IMPORTED_MODULE_9__[\"PoseEnabledController\"].POINTING_POSE\r\n };\r\n /**\r\n * Fired when the trackpad on this controller is clicked\r\n */\r\n _this.onTrackpadChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Fired when the trackpad on this controller is modified\r\n */\r\n _this.onTrackpadValuesChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * The current x and y values of this controller's trackpad\r\n */\r\n _this.trackpad = { x: 0, y: 0 };\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_9__[\"PoseEnabledControllerType\"].WINDOWS;\r\n _this._loadedMeshInfo = null;\r\n return _this;\r\n }\r\n Object.defineProperty(WindowsMotionController.prototype, \"onTriggerButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the trigger on this controller is modified\r\n */\r\n get: function () {\r\n return this.onTriggerStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onMenuButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the menu button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onGripButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the grip button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onMainButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onThumbstickButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the thumbstick button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onPadStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onTouchpadButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the touchpad button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onTrackpadChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onTouchpadValuesChangedObservable\", {\r\n /**\r\n * Fired when the touchpad values on this controller are modified\r\n */\r\n get: function () {\r\n return this.onTrackpadValuesChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WindowsMotionController.prototype._updateTrackpad = function () {\r\n if (this.browserGamepad.axes && (this.browserGamepad.axes[2] != this.trackpad.x || this.browserGamepad.axes[3] != this.trackpad.y)) {\r\n this.trackpad.x = this.browserGamepad[\"axes\"][2];\r\n this.trackpad.y = this.browserGamepad[\"axes\"][3];\r\n this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad);\r\n }\r\n };\r\n /**\r\n * Called once per frame by the engine.\r\n */\r\n WindowsMotionController.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n if (this.browserGamepad.axes) {\r\n this._updateTrackpad();\r\n // Only need to animate axes if there is a loaded mesh\r\n if (this._loadedMeshInfo) {\r\n for (var axis = 0; axis < this._mapping.axisMeshNames.length; axis++) {\r\n this._lerpAxisTransform(axis, this.browserGamepad.axes[axis]);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n WindowsMotionController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n var buttonName = this._mapping.buttons[buttonIdx];\r\n if (!buttonName) {\r\n return;\r\n }\r\n // Update the trackpad to ensure trackpad.x/y are accurate during button events between frames\r\n this._updateTrackpad();\r\n // Only emit events for buttons that we know how to map from index to name\r\n var observable = this[(this._mapping.buttonObservableNames)[buttonName]];\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n this._lerpButtonTransform(buttonName, state.value);\r\n };\r\n /**\r\n * Moves the buttons on the controller mesh based on their current state\r\n * @param buttonName the name of the button to move\r\n * @param buttonValue the value of the button which determines the buttons new position\r\n */\r\n WindowsMotionController.prototype._lerpButtonTransform = function (buttonName, buttonValue) {\r\n // If there is no loaded mesh, there is nothing to transform.\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n var meshInfo = this._loadedMeshInfo.buttonMeshes[buttonName];\r\n if (!meshInfo.unpressed.rotationQuaternion || !meshInfo.pressed.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].SlerpToRef(meshInfo.unpressed.rotationQuaternion, meshInfo.pressed.rotationQuaternion, buttonValue, meshInfo.value.rotationQuaternion);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].LerpToRef(meshInfo.unpressed.position, meshInfo.pressed.position, buttonValue, meshInfo.value.position);\r\n };\r\n /**\r\n * Moves the axis on the controller mesh based on its current state\r\n * @param axis the index of the axis\r\n * @param axisValue the value of the axis which determines the meshes new position\r\n * @hidden\r\n */\r\n WindowsMotionController.prototype._lerpAxisTransform = function (axis, axisValue) {\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n var meshInfo = this._loadedMeshInfo.axisMeshes[axis];\r\n if (!meshInfo) {\r\n return;\r\n }\r\n if (!meshInfo.min.rotationQuaternion || !meshInfo.max.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n // Convert from gamepad value range (-1 to +1) to lerp range (0 to 1)\r\n var lerpValue = axisValue * 0.5 + 0.5;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].SlerpToRef(meshInfo.min.rotationQuaternion, meshInfo.max.rotationQuaternion, lerpValue, meshInfo.value.rotationQuaternion);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].LerpToRef(meshInfo.min.position, meshInfo.max.position, lerpValue, meshInfo.value.position);\r\n };\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n WindowsMotionController.prototype.initControllerMesh = function (scene, meshLoaded, forceDefault) {\r\n var _this = this;\r\n if (forceDefault === void 0) { forceDefault = false; }\r\n var path;\r\n var filename;\r\n // Checking if GLB loader is present\r\n if (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_6__[\"SceneLoader\"].IsPluginForExtensionAvailable(\".glb\")) {\r\n // Determine the device specific folder based on the ID suffix\r\n var device = 'default';\r\n if (this.id && !forceDefault) {\r\n var match = this.id.match(WindowsMotionController.GAMEPAD_ID_PATTERN);\r\n device = ((match && match[0]) || device);\r\n }\r\n // Hand\r\n if (this.hand === 'left') {\r\n filename = WindowsMotionController.MODEL_LEFT_FILENAME;\r\n }\r\n else { // Right is the default if no hand is specified\r\n filename = WindowsMotionController.MODEL_RIGHT_FILENAME;\r\n }\r\n path = WindowsMotionController.MODEL_BASE_URL + device + '/';\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models\");\r\n path = _genericController__WEBPACK_IMPORTED_MODULE_8__[\"GenericController\"].MODEL_BASE_URL;\r\n filename = _genericController__WEBPACK_IMPORTED_MODULE_8__[\"GenericController\"].MODEL_FILENAME;\r\n }\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_6__[\"SceneLoader\"].ImportMesh(\"\", path, filename, scene, function (meshes) {\r\n // glTF files successfully loaded from the remote server, now process them to ensure they are in the right format.\r\n _this._loadedMeshInfo = _this.processModel(scene, meshes);\r\n if (!_this._loadedMeshInfo) {\r\n return;\r\n }\r\n _this._defaultModel = _this._loadedMeshInfo.rootNode;\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n }, null, function (scene, message) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log(message);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Failed to retrieve controller model from the remote server: ' + path + filename);\r\n if (!forceDefault) {\r\n _this.initControllerMesh(scene, meshLoaded, true);\r\n }\r\n });\r\n };\r\n /**\r\n * Takes a list of meshes (as loaded from the glTF file) and finds the root node, as well as nodes that\r\n * can be transformed by button presses and axes values, based on this._mapping.\r\n *\r\n * @param scene scene in which the meshes exist\r\n * @param meshes list of meshes that make up the controller model to process\r\n * @return structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.\r\n */\r\n WindowsMotionController.prototype.processModel = function (scene, meshes) {\r\n var loadedMeshInfo = null;\r\n // Create a new mesh to contain the glTF hierarchy\r\n var parentMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](this.id + \" \" + this.hand, scene);\r\n // Find the root node in the loaded glTF scene, and attach it as a child of 'parentMesh'\r\n var childMesh = null;\r\n for (var i = 0; i < meshes.length; i++) {\r\n var mesh = meshes[i];\r\n if (!mesh.parent) {\r\n // Exclude controller meshes from picking results\r\n mesh.isPickable = false;\r\n // Handle root node, attach to the new parentMesh\r\n childMesh = mesh;\r\n break;\r\n }\r\n }\r\n if (childMesh) {\r\n childMesh.setParent(parentMesh);\r\n // Create our mesh info. Note that this method will always return non-null.\r\n loadedMeshInfo = this.createMeshInfo(parentMesh);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Could not find root node in model file.');\r\n }\r\n return loadedMeshInfo;\r\n };\r\n WindowsMotionController.prototype.createMeshInfo = function (rootNode) {\r\n var loadedMeshInfo = new LoadedMeshInfo();\r\n var i;\r\n loadedMeshInfo.rootNode = rootNode;\r\n // Reset the caches\r\n loadedMeshInfo.buttonMeshes = {};\r\n loadedMeshInfo.axisMeshes = {};\r\n // Button Meshes\r\n for (i = 0; i < this._mapping.buttons.length; i++) {\r\n var buttonMeshName = this._mapping.buttonMeshNames[this._mapping.buttons[i]];\r\n if (!buttonMeshName) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log('Skipping unknown button at index: ' + i + ' with mapped name: ' + this._mapping.buttons[i]);\r\n continue;\r\n }\r\n var buttonMesh = getChildByName(rootNode, buttonMeshName);\r\n if (!buttonMesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing button mesh with name: ' + buttonMeshName);\r\n continue;\r\n }\r\n var buttonMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(buttonMesh, 'VALUE'),\r\n pressed: getImmediateChildByName(buttonMesh, 'PRESSED'),\r\n unpressed: getImmediateChildByName(buttonMesh, 'UNPRESSED')\r\n };\r\n if (buttonMeshInfo.value && buttonMeshInfo.pressed && buttonMeshInfo.unpressed) {\r\n loadedMeshInfo.buttonMeshes[this._mapping.buttons[i]] = buttonMeshInfo;\r\n }\r\n else {\r\n // If we didn't find the mesh, it simply means this button won't have transforms applied as mapped button value changes.\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing button submesh under mesh with name: ' + buttonMeshName +\r\n '(VALUE: ' + !!buttonMeshInfo.value +\r\n ', PRESSED: ' + !!buttonMeshInfo.pressed +\r\n ', UNPRESSED:' + !!buttonMeshInfo.unpressed +\r\n ')');\r\n }\r\n }\r\n // Axis Meshes\r\n for (i = 0; i < this._mapping.axisMeshNames.length; i++) {\r\n var axisMeshName = this._mapping.axisMeshNames[i];\r\n if (!axisMeshName) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log('Skipping unknown axis at index: ' + i);\r\n continue;\r\n }\r\n var axisMesh = getChildByName(rootNode, axisMeshName);\r\n if (!axisMesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing axis mesh with name: ' + axisMeshName);\r\n continue;\r\n }\r\n var axisMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(axisMesh, 'VALUE'),\r\n min: getImmediateChildByName(axisMesh, 'MIN'),\r\n max: getImmediateChildByName(axisMesh, 'MAX')\r\n };\r\n if (axisMeshInfo.value && axisMeshInfo.min && axisMeshInfo.max) {\r\n loadedMeshInfo.axisMeshes[i] = axisMeshInfo;\r\n }\r\n else {\r\n // If we didn't find the mesh, it simply means thit axis won't have transforms applied as mapped axis values change.\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing axis submesh under mesh with name: ' + axisMeshName +\r\n '(VALUE: ' + !!axisMeshInfo.value +\r\n ', MIN: ' + !!axisMeshInfo.min +\r\n ', MAX:' + !!axisMeshInfo.max +\r\n ')');\r\n }\r\n }\r\n // Pointing Ray\r\n loadedMeshInfo.pointingPoseNode = getChildByName(rootNode, this._mapping.pointingPoseMeshName);\r\n if (!loadedMeshInfo.pointingPoseNode) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing pointing pose mesh with name: ' + this._mapping.pointingPoseMeshName);\r\n }\r\n else {\r\n this._pointingPoseNode = loadedMeshInfo.pointingPoseNode;\r\n }\r\n return loadedMeshInfo;\r\n // Look through all children recursively. This will return null if no mesh exists with the given name.\r\n function getChildByName(node, name) {\r\n return node.getChildren(function (n) { return n.name === name; }, false)[0];\r\n }\r\n // Look through only immediate children. This will return null if no mesh exists with the given name.\r\n function getImmediateChildByName(node, name) {\r\n return node.getChildren(function (n) { return n.name == name; }, true)[0];\r\n }\r\n };\r\n /**\r\n * Gets the ray of the controller in the direction the controller is pointing\r\n * @param length the length the resulting ray should be\r\n * @returns a ray in the direction the controller is pointing\r\n */\r\n WindowsMotionController.prototype.getForwardRay = function (length) {\r\n if (length === void 0) { length = 100; }\r\n if (!(this._loadedMeshInfo && this._loadedMeshInfo.pointingPoseNode)) {\r\n return _super.prototype.getForwardRay.call(this, length);\r\n }\r\n var m = this._loadedMeshInfo.pointingPoseNode.getWorldMatrix();\r\n var origin = m.getTranslation();\r\n var forward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, -1);\r\n var forwardWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(forward, m);\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(forwardWorld);\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](origin, direction, length);\r\n };\r\n /**\r\n * Disposes of the controller\r\n */\r\n WindowsMotionController.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onTrackpadChangedObservable.clear();\r\n };\r\n /**\r\n * The base url used to load the left and right controller models\r\n */\r\n WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/microsoft/';\r\n /**\r\n * The name of the left controller model file\r\n */\r\n WindowsMotionController.MODEL_LEFT_FILENAME = 'left.glb';\r\n /**\r\n * The name of the right controller model file\r\n */\r\n WindowsMotionController.MODEL_RIGHT_FILENAME = 'right.glb';\r\n /**\r\n * The controller name prefix for this controller type\r\n */\r\n WindowsMotionController.GAMEPAD_ID_PREFIX = 'Spatial Controller (Spatial Interaction Source) ';\r\n /**\r\n * The controller id pattern for this controller type\r\n */\r\n WindowsMotionController.GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/;\r\n return WindowsMotionController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_7__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_9__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.indexOf(WindowsMotionController.GAMEPAD_ID_PREFIX) === 0;\r\n },\r\n create: function (gamepadInfo) {\r\n return new WindowsMotionController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/dualShockGamepad.ts\":\n/*!**************************************!*\\\n !*** ./Gamepads/dualShockGamepad.ts ***!\n \\**************************************/\n/*! exports provided: DualShockButton, DualShockDpad, DualShockPad */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return DualShockButton; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return DualShockDpad; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return DualShockPad; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _gamepad__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n/**\r\n * Defines supported buttons for DualShock compatible gamepads\r\n */\r\nvar DualShockButton;\r\n(function (DualShockButton) {\r\n /** Cross */\r\n DualShockButton[DualShockButton[\"Cross\"] = 0] = \"Cross\";\r\n /** Circle */\r\n DualShockButton[DualShockButton[\"Circle\"] = 1] = \"Circle\";\r\n /** Square */\r\n DualShockButton[DualShockButton[\"Square\"] = 2] = \"Square\";\r\n /** Triangle */\r\n DualShockButton[DualShockButton[\"Triangle\"] = 3] = \"Triangle\";\r\n /** Options */\r\n DualShockButton[DualShockButton[\"Options\"] = 4] = \"Options\";\r\n /** Share */\r\n DualShockButton[DualShockButton[\"Share\"] = 5] = \"Share\";\r\n /** L1 */\r\n DualShockButton[DualShockButton[\"L1\"] = 6] = \"L1\";\r\n /** R1 */\r\n DualShockButton[DualShockButton[\"R1\"] = 7] = \"R1\";\r\n /** Left stick */\r\n DualShockButton[DualShockButton[\"LeftStick\"] = 8] = \"LeftStick\";\r\n /** Right stick */\r\n DualShockButton[DualShockButton[\"RightStick\"] = 9] = \"RightStick\";\r\n})(DualShockButton || (DualShockButton = {}));\r\n/** Defines values for DualShock DPad */\r\nvar DualShockDpad;\r\n(function (DualShockDpad) {\r\n /** Up */\r\n DualShockDpad[DualShockDpad[\"Up\"] = 0] = \"Up\";\r\n /** Down */\r\n DualShockDpad[DualShockDpad[\"Down\"] = 1] = \"Down\";\r\n /** Left */\r\n DualShockDpad[DualShockDpad[\"Left\"] = 2] = \"Left\";\r\n /** Right */\r\n DualShockDpad[DualShockDpad[\"Right\"] = 3] = \"Right\";\r\n})(DualShockDpad || (DualShockDpad = {}));\r\n/**\r\n * Defines a DualShock gamepad\r\n */\r\nvar DualShockPad = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DualShockPad, _super);\r\n /**\r\n * Creates a new DualShock gamepad object\r\n * @param id defines the id of this gamepad\r\n * @param index defines its index\r\n * @param gamepad defines the internal HTML gamepad object\r\n */\r\n function DualShockPad(id, index, gamepad) {\r\n var _this = _super.call(this, id.replace(\"STANDARD GAMEPAD\", \"SONY PLAYSTATION DUALSHOCK\"), index, gamepad, 0, 1, 2, 3) || this;\r\n _this._leftTrigger = 0;\r\n _this._rightTrigger = 0;\r\n /** Observable raised when a button is pressed */\r\n _this.onButtonDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a button is released */\r\n _this.onButtonUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is pressed */\r\n _this.onPadDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is released */\r\n _this.onPadUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._buttonCross = 0;\r\n _this._buttonCircle = 0;\r\n _this._buttonSquare = 0;\r\n _this._buttonTriangle = 0;\r\n _this._buttonShare = 0;\r\n _this._buttonOptions = 0;\r\n _this._buttonL1 = 0;\r\n _this._buttonR1 = 0;\r\n _this._buttonLeftStick = 0;\r\n _this._buttonRightStick = 0;\r\n _this._dPadUp = 0;\r\n _this._dPadDown = 0;\r\n _this._dPadLeft = 0;\r\n _this._dPadRight = 0;\r\n _this.type = _gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"].DUALSHOCK;\r\n return _this;\r\n }\r\n /**\r\n * Defines the callback to call when left trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onlefttriggerchanged = function (callback) {\r\n this._onlefttriggerchanged = callback;\r\n };\r\n /**\r\n * Defines the callback to call when right trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onrighttriggerchanged = function (callback) {\r\n this._onrighttriggerchanged = callback;\r\n };\r\n Object.defineProperty(DualShockPad.prototype, \"leftTrigger\", {\r\n /**\r\n * Gets the left trigger value\r\n */\r\n get: function () {\r\n return this._leftTrigger;\r\n },\r\n /**\r\n * Sets the left trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onlefttriggerchanged && this._leftTrigger !== newValue) {\r\n this._onlefttriggerchanged(newValue);\r\n }\r\n this._leftTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"rightTrigger\", {\r\n /**\r\n * Gets the right trigger value\r\n */\r\n get: function () {\r\n return this._rightTrigger;\r\n },\r\n /**\r\n * Sets the right trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onrighttriggerchanged && this._rightTrigger !== newValue) {\r\n this._onrighttriggerchanged(newValue);\r\n }\r\n this._rightTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Defines the callback to call when a button is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onbuttondown = function (callback) {\r\n this._onbuttondown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a button is released\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onbuttonup = function (callback) {\r\n this._onbuttonup = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.ondpaddown = function (callback) {\r\n this._ondpaddown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is released\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.ondpadup = function (callback) {\r\n this._ondpadup = callback;\r\n };\r\n DualShockPad.prototype._setButtonValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._onbuttondown) {\r\n this._onbuttondown(buttonType);\r\n }\r\n this.onButtonDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._onbuttonup) {\r\n this._onbuttonup(buttonType);\r\n }\r\n this.onButtonUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n DualShockPad.prototype._setDPadValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._ondpaddown) {\r\n this._ondpaddown(buttonType);\r\n }\r\n this.onPadDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._ondpadup) {\r\n this._ondpadup(buttonType);\r\n }\r\n this.onPadUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n Object.defineProperty(DualShockPad.prototype, \"buttonCross\", {\r\n /**\r\n * Gets the value of the `Cross` button\r\n */\r\n get: function () {\r\n return this._buttonCross;\r\n },\r\n /**\r\n * Sets the value of the `Cross` button\r\n */\r\n set: function (value) {\r\n this._buttonCross = this._setButtonValue(value, this._buttonCross, DualShockButton.Cross);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonCircle\", {\r\n /**\r\n * Gets the value of the `Circle` button\r\n */\r\n get: function () {\r\n return this._buttonCircle;\r\n },\r\n /**\r\n * Sets the value of the `Circle` button\r\n */\r\n set: function (value) {\r\n this._buttonCircle = this._setButtonValue(value, this._buttonCircle, DualShockButton.Circle);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonSquare\", {\r\n /**\r\n * Gets the value of the `Square` button\r\n */\r\n get: function () {\r\n return this._buttonSquare;\r\n },\r\n /**\r\n * Sets the value of the `Square` button\r\n */\r\n set: function (value) {\r\n this._buttonSquare = this._setButtonValue(value, this._buttonSquare, DualShockButton.Square);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonTriangle\", {\r\n /**\r\n * Gets the value of the `Triangle` button\r\n */\r\n get: function () {\r\n return this._buttonTriangle;\r\n },\r\n /**\r\n * Sets the value of the `Triangle` button\r\n */\r\n set: function (value) {\r\n this._buttonTriangle = this._setButtonValue(value, this._buttonTriangle, DualShockButton.Triangle);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonOptions\", {\r\n /**\r\n * Gets the value of the `Options` button\r\n */\r\n get: function () {\r\n return this._buttonOptions;\r\n },\r\n /**\r\n * Sets the value of the `Options` button\r\n */\r\n set: function (value) {\r\n this._buttonOptions = this._setButtonValue(value, this._buttonOptions, DualShockButton.Options);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonShare\", {\r\n /**\r\n * Gets the value of the `Share` button\r\n */\r\n get: function () {\r\n return this._buttonShare;\r\n },\r\n /**\r\n * Sets the value of the `Share` button\r\n */\r\n set: function (value) {\r\n this._buttonShare = this._setButtonValue(value, this._buttonShare, DualShockButton.Share);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonL1\", {\r\n /**\r\n * Gets the value of the `L1` button\r\n */\r\n get: function () {\r\n return this._buttonL1;\r\n },\r\n /**\r\n * Sets the value of the `L1` button\r\n */\r\n set: function (value) {\r\n this._buttonL1 = this._setButtonValue(value, this._buttonL1, DualShockButton.L1);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonR1\", {\r\n /**\r\n * Gets the value of the `R1` button\r\n */\r\n get: function () {\r\n return this._buttonR1;\r\n },\r\n /**\r\n * Sets the value of the `R1` button\r\n */\r\n set: function (value) {\r\n this._buttonR1 = this._setButtonValue(value, this._buttonR1, DualShockButton.R1);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonLeftStick\", {\r\n /**\r\n * Gets the value of the Left joystick\r\n */\r\n get: function () {\r\n return this._buttonLeftStick;\r\n },\r\n /**\r\n * Sets the value of the Left joystick\r\n */\r\n set: function (value) {\r\n this._buttonLeftStick = this._setButtonValue(value, this._buttonLeftStick, DualShockButton.LeftStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonRightStick\", {\r\n /**\r\n * Gets the value of the Right joystick\r\n */\r\n get: function () {\r\n return this._buttonRightStick;\r\n },\r\n /**\r\n * Sets the value of the Right joystick\r\n */\r\n set: function (value) {\r\n this._buttonRightStick = this._setButtonValue(value, this._buttonRightStick, DualShockButton.RightStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadUp\", {\r\n /**\r\n * Gets the value of D-pad up\r\n */\r\n get: function () {\r\n return this._dPadUp;\r\n },\r\n /**\r\n * Sets the value of D-pad up\r\n */\r\n set: function (value) {\r\n this._dPadUp = this._setDPadValue(value, this._dPadUp, DualShockDpad.Up);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadDown\", {\r\n /**\r\n * Gets the value of D-pad down\r\n */\r\n get: function () {\r\n return this._dPadDown;\r\n },\r\n /**\r\n * Sets the value of D-pad down\r\n */\r\n set: function (value) {\r\n this._dPadDown = this._setDPadValue(value, this._dPadDown, DualShockDpad.Down);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadLeft\", {\r\n /**\r\n * Gets the value of D-pad left\r\n */\r\n get: function () {\r\n return this._dPadLeft;\r\n },\r\n /**\r\n * Sets the value of D-pad left\r\n */\r\n set: function (value) {\r\n this._dPadLeft = this._setDPadValue(value, this._dPadLeft, DualShockDpad.Left);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadRight\", {\r\n /**\r\n * Gets the value of D-pad right\r\n */\r\n get: function () {\r\n return this._dPadRight;\r\n },\r\n /**\r\n * Sets the value of D-pad right\r\n */\r\n set: function (value) {\r\n this._dPadRight = this._setDPadValue(value, this._dPadRight, DualShockDpad.Right);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Force the gamepad to synchronize with device values\r\n */\r\n DualShockPad.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n this.buttonCross = this.browserGamepad.buttons[0].value;\r\n this.buttonCircle = this.browserGamepad.buttons[1].value;\r\n this.buttonSquare = this.browserGamepad.buttons[2].value;\r\n this.buttonTriangle = this.browserGamepad.buttons[3].value;\r\n this.buttonL1 = this.browserGamepad.buttons[4].value;\r\n this.buttonR1 = this.browserGamepad.buttons[5].value;\r\n this.leftTrigger = this.browserGamepad.buttons[6].value;\r\n this.rightTrigger = this.browserGamepad.buttons[7].value;\r\n this.buttonShare = this.browserGamepad.buttons[8].value;\r\n this.buttonOptions = this.browserGamepad.buttons[9].value;\r\n this.buttonLeftStick = this.browserGamepad.buttons[10].value;\r\n this.buttonRightStick = this.browserGamepad.buttons[11].value;\r\n this.dPadUp = this.browserGamepad.buttons[12].value;\r\n this.dPadDown = this.browserGamepad.buttons[13].value;\r\n this.dPadLeft = this.browserGamepad.buttons[14].value;\r\n this.dPadRight = this.browserGamepad.buttons[15].value;\r\n };\r\n /**\r\n * Disposes the gamepad\r\n */\r\n DualShockPad.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onButtonDownObservable.clear();\r\n this.onButtonUpObservable.clear();\r\n this.onPadDownObservable.clear();\r\n this.onPadUpObservable.clear();\r\n };\r\n return DualShockPad;\r\n}(_gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/gamepad.ts\":\n/*!*****************************!*\\\n !*** ./Gamepads/gamepad.ts ***!\n \\*****************************/\n/*! exports provided: StickValues, Gamepad, GenericPad */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return StickValues; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return Gamepad; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return GenericPad; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n\r\n\r\n/**\r\n * Represents a gamepad control stick position\r\n */\r\nvar StickValues = /** @class */ (function () {\r\n /**\r\n * Initializes the gamepad x and y control stick values\r\n * @param x The x component of the gamepad control stick value\r\n * @param y The y component of the gamepad control stick value\r\n */\r\n function StickValues(\r\n /**\r\n * The x component of the control stick\r\n */\r\n x, \r\n /**\r\n * The y component of the control stick\r\n */\r\n y) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n return StickValues;\r\n}());\r\n\r\n/**\r\n * Represents a gamepad\r\n */\r\nvar Gamepad = /** @class */ (function () {\r\n /**\r\n * Initializes the gamepad\r\n * @param id The id of the gamepad\r\n * @param index The index of the gamepad\r\n * @param browserGamepad The browser gamepad\r\n * @param leftStickX The x component of the left joystick\r\n * @param leftStickY The y component of the left joystick\r\n * @param rightStickX The x component of the right joystick\r\n * @param rightStickY The y component of the right joystick\r\n */\r\n function Gamepad(\r\n /**\r\n * The id of the gamepad\r\n */\r\n id, \r\n /**\r\n * The index of the gamepad\r\n */\r\n index, \r\n /**\r\n * The browser gamepad\r\n */\r\n browserGamepad, leftStickX, leftStickY, rightStickX, rightStickY) {\r\n if (leftStickX === void 0) { leftStickX = 0; }\r\n if (leftStickY === void 0) { leftStickY = 1; }\r\n if (rightStickX === void 0) { rightStickX = 2; }\r\n if (rightStickY === void 0) { rightStickY = 3; }\r\n this.id = id;\r\n this.index = index;\r\n this.browserGamepad = browserGamepad;\r\n this._leftStick = { x: 0, y: 0 };\r\n this._rightStick = { x: 0, y: 0 };\r\n /** @hidden */\r\n this._isConnected = true;\r\n /**\r\n * Specifies whether the left control stick should be Y-inverted\r\n */\r\n this._invertLeftStickY = false;\r\n this.type = Gamepad.GAMEPAD;\r\n this._leftStickAxisX = leftStickX;\r\n this._leftStickAxisY = leftStickY;\r\n this._rightStickAxisX = rightStickX;\r\n this._rightStickAxisY = rightStickY;\r\n if (this.browserGamepad.axes.length >= 2) {\r\n this._leftStick = { x: this.browserGamepad.axes[this._leftStickAxisX], y: this.browserGamepad.axes[this._leftStickAxisY] };\r\n }\r\n if (this.browserGamepad.axes.length >= 4) {\r\n this._rightStick = { x: this.browserGamepad.axes[this._rightStickAxisX], y: this.browserGamepad.axes[this._rightStickAxisY] };\r\n }\r\n }\r\n Object.defineProperty(Gamepad.prototype, \"isConnected\", {\r\n /**\r\n * Specifies if the gamepad has been connected\r\n */\r\n get: function () {\r\n return this._isConnected;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Callback triggered when the left joystick has changed\r\n * @param callback\r\n */\r\n Gamepad.prototype.onleftstickchanged = function (callback) {\r\n this._onleftstickchanged = callback;\r\n };\r\n /**\r\n * Callback triggered when the right joystick has changed\r\n * @param callback\r\n */\r\n Gamepad.prototype.onrightstickchanged = function (callback) {\r\n this._onrightstickchanged = callback;\r\n };\r\n Object.defineProperty(Gamepad.prototype, \"leftStick\", {\r\n /**\r\n * Gets the left joystick\r\n */\r\n get: function () {\r\n return this._leftStick;\r\n },\r\n /**\r\n * Sets the left joystick values\r\n */\r\n set: function (newValues) {\r\n if (this._onleftstickchanged && (this._leftStick.x !== newValues.x || this._leftStick.y !== newValues.y)) {\r\n this._onleftstickchanged(newValues);\r\n }\r\n this._leftStick = newValues;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Gamepad.prototype, \"rightStick\", {\r\n /**\r\n * Gets the right joystick\r\n */\r\n get: function () {\r\n return this._rightStick;\r\n },\r\n /**\r\n * Sets the right joystick value\r\n */\r\n set: function (newValues) {\r\n if (this._onrightstickchanged && (this._rightStick.x !== newValues.x || this._rightStick.y !== newValues.y)) {\r\n this._onrightstickchanged(newValues);\r\n }\r\n this._rightStick = newValues;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the gamepad joystick positions\r\n */\r\n Gamepad.prototype.update = function () {\r\n if (this._leftStick) {\r\n this.leftStick = { x: this.browserGamepad.axes[this._leftStickAxisX], y: this.browserGamepad.axes[this._leftStickAxisY] };\r\n if (this._invertLeftStickY) {\r\n this.leftStick.y *= -1;\r\n }\r\n }\r\n if (this._rightStick) {\r\n this.rightStick = { x: this.browserGamepad.axes[this._rightStickAxisX], y: this.browserGamepad.axes[this._rightStickAxisY] };\r\n }\r\n };\r\n /**\r\n * Disposes the gamepad\r\n */\r\n Gamepad.prototype.dispose = function () {\r\n };\r\n /**\r\n * Represents a gamepad controller\r\n */\r\n Gamepad.GAMEPAD = 0;\r\n /**\r\n * Represents a generic controller\r\n */\r\n Gamepad.GENERIC = 1;\r\n /**\r\n * Represents an XBox controller\r\n */\r\n Gamepad.XBOX = 2;\r\n /**\r\n * Represents a pose-enabled controller\r\n */\r\n Gamepad.POSE_ENABLED = 3;\r\n /**\r\n * Represents an Dual Shock controller\r\n */\r\n Gamepad.DUALSHOCK = 4;\r\n return Gamepad;\r\n}());\r\n\r\n/**\r\n * Represents a generic gamepad\r\n */\r\nvar GenericPad = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GenericPad, _super);\r\n /**\r\n * Initializes the generic gamepad\r\n * @param id The id of the generic gamepad\r\n * @param index The index of the generic gamepad\r\n * @param browserGamepad The browser gamepad\r\n */\r\n function GenericPad(id, index, browserGamepad) {\r\n var _this = _super.call(this, id, index, browserGamepad) || this;\r\n /**\r\n * Observable triggered when a button has been pressed\r\n */\r\n _this.onButtonDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable triggered when a button has been released\r\n */\r\n _this.onButtonUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this.type = Gamepad.GENERIC;\r\n _this._buttons = new Array(browserGamepad.buttons.length);\r\n return _this;\r\n }\r\n /**\r\n * Callback triggered when a button has been pressed\r\n * @param callback Called when a button has been pressed\r\n */\r\n GenericPad.prototype.onbuttondown = function (callback) {\r\n this._onbuttondown = callback;\r\n };\r\n /**\r\n * Callback triggered when a button has been released\r\n * @param callback Called when a button has been released\r\n */\r\n GenericPad.prototype.onbuttonup = function (callback) {\r\n this._onbuttonup = callback;\r\n };\r\n GenericPad.prototype._setButtonValue = function (newValue, currentValue, buttonIndex) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._onbuttondown) {\r\n this._onbuttondown(buttonIndex);\r\n }\r\n this.onButtonDownObservable.notifyObservers(buttonIndex);\r\n }\r\n if (newValue === 0) {\r\n if (this._onbuttonup) {\r\n this._onbuttonup(buttonIndex);\r\n }\r\n this.onButtonUpObservable.notifyObservers(buttonIndex);\r\n }\r\n }\r\n return newValue;\r\n };\r\n /**\r\n * Updates the generic gamepad\r\n */\r\n GenericPad.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n for (var index = 0; index < this._buttons.length; index++) {\r\n this._buttons[index] = this._setButtonValue(this.browserGamepad.buttons[index].value, this._buttons[index], index);\r\n }\r\n };\r\n /**\r\n * Disposes the generic gamepad\r\n */\r\n GenericPad.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onButtonDownObservable.clear();\r\n this.onButtonUpObservable.clear();\r\n };\r\n return GenericPad;\r\n}(Gamepad));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/gamepadManager.ts\":\n/*!************************************!*\\\n !*** ./Gamepads/gamepadManager.ts ***!\n \\************************************/\n/*! exports provided: GamepadManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return GamepadManager; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Gamepads/Controllers/poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _xboxGamepad__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./xboxGamepad */ \"./Gamepads/xboxGamepad.ts\");\n/* harmony import */ var _gamepad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _dualShockGamepad__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./dualShockGamepad */ \"./Gamepads/dualShockGamepad.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manager for handling gamepads\r\n */\r\nvar GamepadManager = /** @class */ (function () {\r\n /**\r\n * Initializes the gamepad manager\r\n * @param _scene BabylonJS scene\r\n */\r\n function GamepadManager(_scene) {\r\n var _this = this;\r\n this._scene = _scene;\r\n this._babylonGamepads = [];\r\n this._oneGamepadConnected = false;\r\n /** @hidden */\r\n this._isMonitoring = false;\r\n /**\r\n * observable to be triggered when the gamepad controller has been disconnected\r\n */\r\n this.onGamepadDisconnectedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n this._gamepadEventSupported = false;\r\n }\r\n else {\r\n this._gamepadEventSupported = 'GamepadEvent' in window;\r\n this._gamepadSupport = (navigator.getGamepads ||\r\n navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);\r\n }\r\n this.onGamepadConnectedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"](function (observer) {\r\n // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected\r\n for (var i in _this._babylonGamepads) {\r\n var gamepad = _this._babylonGamepads[i];\r\n if (gamepad && gamepad._isConnected) {\r\n _this.onGamepadConnectedObservable.notifyObserver(observer, gamepad);\r\n }\r\n }\r\n });\r\n this._onGamepadConnectedEvent = function (evt) {\r\n var gamepad = evt.gamepad;\r\n if (gamepad.index in _this._babylonGamepads) {\r\n if (_this._babylonGamepads[gamepad.index].isConnected) {\r\n return;\r\n }\r\n }\r\n var newGamepad;\r\n if (_this._babylonGamepads[gamepad.index]) {\r\n newGamepad = _this._babylonGamepads[gamepad.index];\r\n newGamepad.browserGamepad = gamepad;\r\n newGamepad._isConnected = true;\r\n }\r\n else {\r\n newGamepad = _this._addNewGamepad(gamepad);\r\n }\r\n _this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n _this._startMonitoringGamepads();\r\n };\r\n this._onGamepadDisconnectedEvent = function (evt) {\r\n var gamepad = evt.gamepad;\r\n // Remove the gamepad from the list of gamepads to monitor.\r\n for (var i in _this._babylonGamepads) {\r\n if (_this._babylonGamepads[i].index === gamepad.index) {\r\n var disconnectedGamepad = _this._babylonGamepads[i];\r\n disconnectedGamepad._isConnected = false;\r\n _this.onGamepadDisconnectedObservable.notifyObservers(disconnectedGamepad);\r\n break;\r\n }\r\n }\r\n };\r\n if (this._gamepadSupport) {\r\n //first add already-connected gamepads\r\n this._updateGamepadObjects();\r\n if (this._babylonGamepads.length) {\r\n this._startMonitoringGamepads();\r\n }\r\n // Checking if the gamepad connected event is supported (like in Firefox)\r\n if (this._gamepadEventSupported) {\r\n var hostWindow = this._scene ? this._scene.getEngine().getHostWindow() : window;\r\n hostWindow.addEventListener('gamepadconnected', this._onGamepadConnectedEvent, false);\r\n hostWindow.addEventListener('gamepaddisconnected', this._onGamepadDisconnectedEvent, false);\r\n }\r\n else {\r\n this._startMonitoringGamepads();\r\n }\r\n }\r\n }\r\n Object.defineProperty(GamepadManager.prototype, \"gamepads\", {\r\n /**\r\n * The gamepads in the game pad manager\r\n */\r\n get: function () {\r\n return this._babylonGamepads;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the gamepad controllers based on type\r\n * @param type The type of gamepad controller\r\n * @returns Nullable gamepad\r\n */\r\n GamepadManager.prototype.getGamepadByType = function (type) {\r\n if (type === void 0) { type = _gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].XBOX; }\r\n for (var _i = 0, _a = this._babylonGamepads; _i < _a.length; _i++) {\r\n var gamepad = _a[_i];\r\n if (gamepad && gamepad.type === type) {\r\n return gamepad;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Disposes the gamepad manager\r\n */\r\n GamepadManager.prototype.dispose = function () {\r\n if (this._gamepadEventSupported) {\r\n if (this._onGamepadConnectedEvent) {\r\n window.removeEventListener('gamepadconnected', this._onGamepadConnectedEvent);\r\n }\r\n if (this._onGamepadDisconnectedEvent) {\r\n window.removeEventListener('gamepaddisconnected', this._onGamepadDisconnectedEvent);\r\n }\r\n this._onGamepadConnectedEvent = null;\r\n this._onGamepadDisconnectedEvent = null;\r\n }\r\n this._babylonGamepads.forEach(function (gamepad) {\r\n gamepad.dispose();\r\n });\r\n this.onGamepadConnectedObservable.clear();\r\n this.onGamepadDisconnectedObservable.clear();\r\n this._oneGamepadConnected = false;\r\n this._stopMonitoringGamepads();\r\n this._babylonGamepads = [];\r\n };\r\n GamepadManager.prototype._addNewGamepad = function (gamepad) {\r\n if (!this._oneGamepadConnected) {\r\n this._oneGamepadConnected = true;\r\n }\r\n var newGamepad;\r\n var dualShock = (gamepad.id.search(\"054c\") !== -1);\r\n var xboxOne = (gamepad.id.search(\"Xbox One\") !== -1);\r\n if (xboxOne || gamepad.id.search(\"Xbox 360\") !== -1 || gamepad.id.search(\"xinput\") !== -1) {\r\n newGamepad = new _xboxGamepad__WEBPACK_IMPORTED_MODULE_3__[\"Xbox360Pad\"](gamepad.id, gamepad.index, gamepad, xboxOne);\r\n }\r\n else if (dualShock) {\r\n newGamepad = new _dualShockGamepad__WEBPACK_IMPORTED_MODULE_6__[\"DualShockPad\"](gamepad.id, gamepad.index, gamepad);\r\n }\r\n // if pose is supported, use the (WebVR) pose enabled controller\r\n else if (gamepad.pose) {\r\n newGamepad = _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_2__[\"PoseEnabledControllerHelper\"].InitiateController(gamepad);\r\n }\r\n else {\r\n newGamepad = new _gamepad__WEBPACK_IMPORTED_MODULE_4__[\"GenericPad\"](gamepad.id, gamepad.index, gamepad);\r\n }\r\n this._babylonGamepads[newGamepad.index] = newGamepad;\r\n return newGamepad;\r\n };\r\n GamepadManager.prototype._startMonitoringGamepads = function () {\r\n if (!this._isMonitoring) {\r\n this._isMonitoring = true;\r\n //back-comp\r\n if (!this._scene) {\r\n this._checkGamepadsStatus();\r\n }\r\n }\r\n };\r\n GamepadManager.prototype._stopMonitoringGamepads = function () {\r\n this._isMonitoring = false;\r\n };\r\n /** @hidden */\r\n GamepadManager.prototype._checkGamepadsStatus = function () {\r\n var _this = this;\r\n // Hack to be compatible Chrome\r\n this._updateGamepadObjects();\r\n for (var i in this._babylonGamepads) {\r\n var gamepad = this._babylonGamepads[i];\r\n if (!gamepad || !gamepad.isConnected) {\r\n continue;\r\n }\r\n gamepad.update();\r\n }\r\n if (this._isMonitoring && !this._scene) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].QueueNewFrame(function () { _this._checkGamepadsStatus(); });\r\n }\r\n };\r\n // This function is called only on Chrome, which does not properly support\r\n // connection/disconnection events and forces you to recopy again the gamepad object\r\n GamepadManager.prototype._updateGamepadObjects = function () {\r\n var gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r\n for (var i = 0; i < gamepads.length; i++) {\r\n var gamepad = gamepads[i];\r\n if (gamepad) {\r\n if (!this._babylonGamepads[gamepad.index]) {\r\n var newGamepad = this._addNewGamepad(gamepad);\r\n this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n }\r\n else {\r\n // Forced to copy again this object for Chrome for unknown reason\r\n this._babylonGamepads[i].browserGamepad = gamepad;\r\n if (!this._babylonGamepads[i].isConnected) {\r\n this._babylonGamepads[i]._isConnected = true;\r\n this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[i]);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n return GamepadManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/gamepadSceneComponent.ts\":\n/*!*******************************************!*\\\n !*** ./Gamepads/gamepadSceneComponent.ts ***!\n \\*******************************************/\n/*! exports provided: GamepadSystemSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return GamepadSystemSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _gamepadManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gamepadManager */ \"./Gamepads/gamepadManager.ts\");\n/* harmony import */ var _Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraGamepadInput */ \"./Cameras/Inputs/freeCameraGamepadInput.ts\");\n/* harmony import */ var _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Cameras/arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraGamepadInput */ \"./Cameras/Inputs/arcRotateCameraGamepadInput.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"gamepadManager\", {\r\n get: function () {\r\n if (!this._gamepadManager) {\r\n this._gamepadManager = new _gamepadManager__WEBPACK_IMPORTED_MODULE_2__[\"GamepadManager\"](this);\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GAMEPAD);\r\n if (!component) {\r\n component = new GamepadSystemSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n }\r\n return this._gamepadManager;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Adds a gamepad to the free camera inputs manager\r\n */\r\n_Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraInputsManager\"].prototype.addGamepad = function () {\r\n this.add(new _Cameras_Inputs_freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_4__[\"FreeCameraGamepadInput\"]());\r\n return this;\r\n};\r\n/**\r\n * Adds a gamepad to the arc rotate camera inputs manager\r\n */\r\n_Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"ArcRotateCameraInputsManager\"].prototype.addGamepad = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_6__[\"ArcRotateCameraGamepadInput\"]());\r\n return this;\r\n};\r\n/**\r\n * Defines the gamepad scene component responsible to manage gamepads in a given scene\r\n */\r\nvar GamepadSystemSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function GamepadSystemSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GAMEPAD;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n GamepadSystemSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraUpdateStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_BEFORECAMERAUPDATE_GAMEPAD, this, this._beforeCameraUpdate);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n GamepadSystemSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for gamepads\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n GamepadSystemSceneComponent.prototype.dispose = function () {\r\n var gamepadManager = this.scene._gamepadManager;\r\n if (gamepadManager) {\r\n gamepadManager.dispose();\r\n this.scene._gamepadManager = null;\r\n }\r\n };\r\n GamepadSystemSceneComponent.prototype._beforeCameraUpdate = function () {\r\n var gamepadManager = this.scene._gamepadManager;\r\n if (gamepadManager && gamepadManager._isMonitoring) {\r\n gamepadManager._checkGamepadsStatus();\r\n }\r\n };\r\n return GamepadSystemSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/index.ts\":\n/*!***************************!*\\\n !*** ./Gamepads/index.ts ***!\n \\***************************/\n/*! exports provided: StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Controllers_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Controllers/index */ \"./Gamepads/Controllers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"DaydreamController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"GearVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"GenericController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"OculusTouchController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"ViveController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"WebVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"WindowsMotionController\"]; });\n\n/* harmony import */ var _gamepad__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return _gamepad__WEBPACK_IMPORTED_MODULE_1__[\"StickValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return _gamepad__WEBPACK_IMPORTED_MODULE_1__[\"Gamepad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return _gamepad__WEBPACK_IMPORTED_MODULE_1__[\"GenericPad\"]; });\n\n/* harmony import */ var _gamepadManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gamepadManager */ \"./Gamepads/gamepadManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return _gamepadManager__WEBPACK_IMPORTED_MODULE_2__[\"GamepadManager\"]; });\n\n/* harmony import */ var _gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return _gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"GamepadSystemSceneComponent\"]; });\n\n/* harmony import */ var _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./xboxGamepad */ \"./Gamepads/xboxGamepad.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__[\"Xbox360Button\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__[\"Xbox360Dpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__[\"Xbox360Pad\"]; });\n\n/* harmony import */ var _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dualShockGamepad */ \"./Gamepads/dualShockGamepad.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__[\"DualShockButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__[\"DualShockDpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__[\"DualShockPad\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/xboxGamepad.ts\":\n/*!*********************************!*\\\n !*** ./Gamepads/xboxGamepad.ts ***!\n \\*********************************/\n/*! exports provided: Xbox360Button, Xbox360Dpad, Xbox360Pad */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return Xbox360Button; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return Xbox360Dpad; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return Xbox360Pad; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n/**\r\n * Defines supported buttons for XBox360 compatible gamepads\r\n */\r\nvar Xbox360Button;\r\n(function (Xbox360Button) {\r\n /** A */\r\n Xbox360Button[Xbox360Button[\"A\"] = 0] = \"A\";\r\n /** B */\r\n Xbox360Button[Xbox360Button[\"B\"] = 1] = \"B\";\r\n /** X */\r\n Xbox360Button[Xbox360Button[\"X\"] = 2] = \"X\";\r\n /** Y */\r\n Xbox360Button[Xbox360Button[\"Y\"] = 3] = \"Y\";\r\n /** Start */\r\n Xbox360Button[Xbox360Button[\"Start\"] = 4] = \"Start\";\r\n /** Back */\r\n Xbox360Button[Xbox360Button[\"Back\"] = 5] = \"Back\";\r\n /** Left button */\r\n Xbox360Button[Xbox360Button[\"LB\"] = 6] = \"LB\";\r\n /** Right button */\r\n Xbox360Button[Xbox360Button[\"RB\"] = 7] = \"RB\";\r\n /** Left stick */\r\n Xbox360Button[Xbox360Button[\"LeftStick\"] = 8] = \"LeftStick\";\r\n /** Right stick */\r\n Xbox360Button[Xbox360Button[\"RightStick\"] = 9] = \"RightStick\";\r\n})(Xbox360Button || (Xbox360Button = {}));\r\n/** Defines values for XBox360 DPad */\r\nvar Xbox360Dpad;\r\n(function (Xbox360Dpad) {\r\n /** Up */\r\n Xbox360Dpad[Xbox360Dpad[\"Up\"] = 0] = \"Up\";\r\n /** Down */\r\n Xbox360Dpad[Xbox360Dpad[\"Down\"] = 1] = \"Down\";\r\n /** Left */\r\n Xbox360Dpad[Xbox360Dpad[\"Left\"] = 2] = \"Left\";\r\n /** Right */\r\n Xbox360Dpad[Xbox360Dpad[\"Right\"] = 3] = \"Right\";\r\n})(Xbox360Dpad || (Xbox360Dpad = {}));\r\n/**\r\n * Defines a XBox360 gamepad\r\n */\r\nvar Xbox360Pad = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Xbox360Pad, _super);\r\n /**\r\n * Creates a new XBox360 gamepad object\r\n * @param id defines the id of this gamepad\r\n * @param index defines its index\r\n * @param gamepad defines the internal HTML gamepad object\r\n * @param xboxOne defines if it is a XBox One gamepad\r\n */\r\n function Xbox360Pad(id, index, gamepad, xboxOne) {\r\n if (xboxOne === void 0) { xboxOne = false; }\r\n var _this = _super.call(this, id, index, gamepad, 0, 1, 2, 3) || this;\r\n _this._leftTrigger = 0;\r\n _this._rightTrigger = 0;\r\n /** Observable raised when a button is pressed */\r\n _this.onButtonDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a button is released */\r\n _this.onButtonUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is pressed */\r\n _this.onPadDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is released */\r\n _this.onPadUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._buttonA = 0;\r\n _this._buttonB = 0;\r\n _this._buttonX = 0;\r\n _this._buttonY = 0;\r\n _this._buttonBack = 0;\r\n _this._buttonStart = 0;\r\n _this._buttonLB = 0;\r\n _this._buttonRB = 0;\r\n _this._buttonLeftStick = 0;\r\n _this._buttonRightStick = 0;\r\n _this._dPadUp = 0;\r\n _this._dPadDown = 0;\r\n _this._dPadLeft = 0;\r\n _this._dPadRight = 0;\r\n _this._isXboxOnePad = false;\r\n _this.type = _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"].XBOX;\r\n _this._isXboxOnePad = xboxOne;\r\n return _this;\r\n }\r\n /**\r\n * Defines the callback to call when left trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onlefttriggerchanged = function (callback) {\r\n this._onlefttriggerchanged = callback;\r\n };\r\n /**\r\n * Defines the callback to call when right trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onrighttriggerchanged = function (callback) {\r\n this._onrighttriggerchanged = callback;\r\n };\r\n Object.defineProperty(Xbox360Pad.prototype, \"leftTrigger\", {\r\n /**\r\n * Gets the left trigger value\r\n */\r\n get: function () {\r\n return this._leftTrigger;\r\n },\r\n /**\r\n * Sets the left trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onlefttriggerchanged && this._leftTrigger !== newValue) {\r\n this._onlefttriggerchanged(newValue);\r\n }\r\n this._leftTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"rightTrigger\", {\r\n /**\r\n * Gets the right trigger value\r\n */\r\n get: function () {\r\n return this._rightTrigger;\r\n },\r\n /**\r\n * Sets the right trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onrighttriggerchanged && this._rightTrigger !== newValue) {\r\n this._onrighttriggerchanged(newValue);\r\n }\r\n this._rightTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Defines the callback to call when a button is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onbuttondown = function (callback) {\r\n this._onbuttondown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a button is released\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onbuttonup = function (callback) {\r\n this._onbuttonup = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.ondpaddown = function (callback) {\r\n this._ondpaddown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is released\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.ondpadup = function (callback) {\r\n this._ondpadup = callback;\r\n };\r\n Xbox360Pad.prototype._setButtonValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._onbuttondown) {\r\n this._onbuttondown(buttonType);\r\n }\r\n this.onButtonDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._onbuttonup) {\r\n this._onbuttonup(buttonType);\r\n }\r\n this.onButtonUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n Xbox360Pad.prototype._setDPadValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._ondpaddown) {\r\n this._ondpaddown(buttonType);\r\n }\r\n this.onPadDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._ondpadup) {\r\n this._ondpadup(buttonType);\r\n }\r\n this.onPadUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonA\", {\r\n /**\r\n * Gets the value of the `A` button\r\n */\r\n get: function () {\r\n return this._buttonA;\r\n },\r\n /**\r\n * Sets the value of the `A` button\r\n */\r\n set: function (value) {\r\n this._buttonA = this._setButtonValue(value, this._buttonA, Xbox360Button.A);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonB\", {\r\n /**\r\n * Gets the value of the `B` button\r\n */\r\n get: function () {\r\n return this._buttonB;\r\n },\r\n /**\r\n * Sets the value of the `B` button\r\n */\r\n set: function (value) {\r\n this._buttonB = this._setButtonValue(value, this._buttonB, Xbox360Button.B);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonX\", {\r\n /**\r\n * Gets the value of the `X` button\r\n */\r\n get: function () {\r\n return this._buttonX;\r\n },\r\n /**\r\n * Sets the value of the `X` button\r\n */\r\n set: function (value) {\r\n this._buttonX = this._setButtonValue(value, this._buttonX, Xbox360Button.X);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonY\", {\r\n /**\r\n * Gets the value of the `Y` button\r\n */\r\n get: function () {\r\n return this._buttonY;\r\n },\r\n /**\r\n * Sets the value of the `Y` button\r\n */\r\n set: function (value) {\r\n this._buttonY = this._setButtonValue(value, this._buttonY, Xbox360Button.Y);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonStart\", {\r\n /**\r\n * Gets the value of the `Start` button\r\n */\r\n get: function () {\r\n return this._buttonStart;\r\n },\r\n /**\r\n * Sets the value of the `Start` button\r\n */\r\n set: function (value) {\r\n this._buttonStart = this._setButtonValue(value, this._buttonStart, Xbox360Button.Start);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonBack\", {\r\n /**\r\n * Gets the value of the `Back` button\r\n */\r\n get: function () {\r\n return this._buttonBack;\r\n },\r\n /**\r\n * Sets the value of the `Back` button\r\n */\r\n set: function (value) {\r\n this._buttonBack = this._setButtonValue(value, this._buttonBack, Xbox360Button.Back);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonLB\", {\r\n /**\r\n * Gets the value of the `Left` button\r\n */\r\n get: function () {\r\n return this._buttonLB;\r\n },\r\n /**\r\n * Sets the value of the `Left` button\r\n */\r\n set: function (value) {\r\n this._buttonLB = this._setButtonValue(value, this._buttonLB, Xbox360Button.LB);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonRB\", {\r\n /**\r\n * Gets the value of the `Right` button\r\n */\r\n get: function () {\r\n return this._buttonRB;\r\n },\r\n /**\r\n * Sets the value of the `Right` button\r\n */\r\n set: function (value) {\r\n this._buttonRB = this._setButtonValue(value, this._buttonRB, Xbox360Button.RB);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonLeftStick\", {\r\n /**\r\n * Gets the value of the Left joystick\r\n */\r\n get: function () {\r\n return this._buttonLeftStick;\r\n },\r\n /**\r\n * Sets the value of the Left joystick\r\n */\r\n set: function (value) {\r\n this._buttonLeftStick = this._setButtonValue(value, this._buttonLeftStick, Xbox360Button.LeftStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonRightStick\", {\r\n /**\r\n * Gets the value of the Right joystick\r\n */\r\n get: function () {\r\n return this._buttonRightStick;\r\n },\r\n /**\r\n * Sets the value of the Right joystick\r\n */\r\n set: function (value) {\r\n this._buttonRightStick = this._setButtonValue(value, this._buttonRightStick, Xbox360Button.RightStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadUp\", {\r\n /**\r\n * Gets the value of D-pad up\r\n */\r\n get: function () {\r\n return this._dPadUp;\r\n },\r\n /**\r\n * Sets the value of D-pad up\r\n */\r\n set: function (value) {\r\n this._dPadUp = this._setDPadValue(value, this._dPadUp, Xbox360Dpad.Up);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadDown\", {\r\n /**\r\n * Gets the value of D-pad down\r\n */\r\n get: function () {\r\n return this._dPadDown;\r\n },\r\n /**\r\n * Sets the value of D-pad down\r\n */\r\n set: function (value) {\r\n this._dPadDown = this._setDPadValue(value, this._dPadDown, Xbox360Dpad.Down);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadLeft\", {\r\n /**\r\n * Gets the value of D-pad left\r\n */\r\n get: function () {\r\n return this._dPadLeft;\r\n },\r\n /**\r\n * Sets the value of D-pad left\r\n */\r\n set: function (value) {\r\n this._dPadLeft = this._setDPadValue(value, this._dPadLeft, Xbox360Dpad.Left);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadRight\", {\r\n /**\r\n * Gets the value of D-pad right\r\n */\r\n get: function () {\r\n return this._dPadRight;\r\n },\r\n /**\r\n * Sets the value of D-pad right\r\n */\r\n set: function (value) {\r\n this._dPadRight = this._setDPadValue(value, this._dPadRight, Xbox360Dpad.Right);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Force the gamepad to synchronize with device values\r\n */\r\n Xbox360Pad.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n if (this._isXboxOnePad) {\r\n this.buttonA = this.browserGamepad.buttons[0].value;\r\n this.buttonB = this.browserGamepad.buttons[1].value;\r\n this.buttonX = this.browserGamepad.buttons[2].value;\r\n this.buttonY = this.browserGamepad.buttons[3].value;\r\n this.buttonLB = this.browserGamepad.buttons[4].value;\r\n this.buttonRB = this.browserGamepad.buttons[5].value;\r\n this.leftTrigger = this.browserGamepad.buttons[6].value;\r\n this.rightTrigger = this.browserGamepad.buttons[7].value;\r\n this.buttonBack = this.browserGamepad.buttons[8].value;\r\n this.buttonStart = this.browserGamepad.buttons[9].value;\r\n this.buttonLeftStick = this.browserGamepad.buttons[10].value;\r\n this.buttonRightStick = this.browserGamepad.buttons[11].value;\r\n this.dPadUp = this.browserGamepad.buttons[12].value;\r\n this.dPadDown = this.browserGamepad.buttons[13].value;\r\n this.dPadLeft = this.browserGamepad.buttons[14].value;\r\n this.dPadRight = this.browserGamepad.buttons[15].value;\r\n }\r\n else {\r\n this.buttonA = this.browserGamepad.buttons[0].value;\r\n this.buttonB = this.browserGamepad.buttons[1].value;\r\n this.buttonX = this.browserGamepad.buttons[2].value;\r\n this.buttonY = this.browserGamepad.buttons[3].value;\r\n this.buttonLB = this.browserGamepad.buttons[4].value;\r\n this.buttonRB = this.browserGamepad.buttons[5].value;\r\n this.leftTrigger = this.browserGamepad.buttons[6].value;\r\n this.rightTrigger = this.browserGamepad.buttons[7].value;\r\n this.buttonBack = this.browserGamepad.buttons[8].value;\r\n this.buttonStart = this.browserGamepad.buttons[9].value;\r\n this.buttonLeftStick = this.browserGamepad.buttons[10].value;\r\n this.buttonRightStick = this.browserGamepad.buttons[11].value;\r\n this.dPadUp = this.browserGamepad.buttons[12].value;\r\n this.dPadDown = this.browserGamepad.buttons[13].value;\r\n this.dPadLeft = this.browserGamepad.buttons[14].value;\r\n this.dPadRight = this.browserGamepad.buttons[15].value;\r\n }\r\n };\r\n /**\r\n * Disposes the gamepad\r\n */\r\n Xbox360Pad.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onButtonDownObservable.clear();\r\n this.onButtonUpObservable.clear();\r\n this.onPadDownObservable.clear();\r\n this.onPadUpObservable.clear();\r\n };\r\n return Xbox360Pad;\r\n}(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/axisDragGizmo.ts\":\n/*!*********************************!*\\\n !*** ./Gizmos/axisDragGizmo.ts ***!\n \\*********************************/\n/*! exports provided: AxisDragGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return AxisDragGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single axis drag gizmo\r\n */\r\nvar AxisDragGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AxisDragGizmo, _super);\r\n /**\r\n * Creates an AxisDragGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param dragAxis The axis which the gizmo will be able to drag on\r\n * @param color The color of the gizmo\r\n */\r\n function AxisDragGizmo(dragAxis, color, gizmoLayer, parent) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (parent === void 0) { parent = null; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._isEnabled = true;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n _this._coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_8__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._coloredMaterial.diffuseColor = color;\r\n _this._coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"](0.1, 0.1, 0.1));\r\n _this._hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_8__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build mesh on root node\r\n _this._arrow = AxisDragGizmo._CreateArrow(gizmoLayer.utilityLayerScene, _this._coloredMaterial);\r\n _this._arrow.lookAt(_this._rootMesh.position.add(dragAxis));\r\n _this._arrow.scaling.scaleInPlace(1 / 3);\r\n _this._arrow.parent = _this._rootMesh;\r\n var currentSnapDragDistance = 0;\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_5__[\"PointerDragBehavior\"]({ dragAxis: dragAxis });\r\n _this.dragBehavior.moveAttached = false;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var localDelta = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n // Convert delta to local translation if it has a parent\r\n if (_this.attachedMesh.parent) {\r\n _this.attachedMesh.parent.computeWorldMatrix().invertToRef(tmpMatrix);\r\n tmpMatrix.setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(event.delta, tmpMatrix, localDelta);\r\n }\r\n else {\r\n localDelta.copyFrom(event.delta);\r\n }\r\n // Snapping logic\r\n if (_this.snapDistance == 0) {\r\n _this.attachedMesh.position.addInPlace(localDelta);\r\n }\r\n else {\r\n currentSnapDragDistance += event.dragDistance;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n var dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n localDelta.normalizeToRef(tmpVector);\r\n tmpVector.scaleInPlace(_this.snapDistance * dragSteps);\r\n _this.attachedMesh.position.addInPlace(tmpVector);\r\n tmpSnapEvent.snapDistance = _this.snapDistance * dragSteps;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? _this._hoverMaterial : _this._coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n if (m.color) {\r\n m.color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes(false));\r\n return _this;\r\n }\r\n /** @hidden */\r\n AxisDragGizmo._CreateArrow = function (scene, material) {\r\n var arrow = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_3__[\"TransformNode\"](\"arrow\", scene);\r\n var cylinder = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"cylinder\", { diameterTop: 0, height: 0.075, diameterBottom: 0.0375, tessellation: 96 }, scene);\r\n var line = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"cylinder\", { diameterTop: 0.005, height: 0.275, diameterBottom: 0.005, tessellation: 96 }, scene);\r\n line.material = material;\r\n cylinder.parent = arrow;\r\n line.parent = arrow;\r\n // Position arrow pointing in its drag axis\r\n cylinder.material = material;\r\n cylinder.rotation.x = Math.PI / 2;\r\n cylinder.position.z += 0.3;\r\n line.position.z += 0.275 / 2;\r\n line.rotation.x = Math.PI / 2;\r\n return arrow;\r\n };\r\n /** @hidden */\r\n AxisDragGizmo._CreateArrowInstance = function (scene, arrow) {\r\n var instance = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_3__[\"TransformNode\"](\"arrow\", scene);\r\n for (var _i = 0, _a = arrow.getChildMeshes(); _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n var childInstance = mesh.createInstance(mesh.name);\r\n childInstance.parent = instance;\r\n }\r\n return instance;\r\n };\r\n AxisDragGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(AxisDragGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n AxisDragGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n if (this._arrow) {\r\n this._arrow.dispose();\r\n }\r\n [this._coloredMaterial, this._hoverMaterial].forEach(function (matl) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n });\r\n _super.prototype.dispose.call(this);\r\n };\r\n return AxisDragGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_6__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/axisScaleGizmo.ts\":\n/*!**********************************!*\\\n !*** ./Gizmos/axisScaleGizmo.ts ***!\n \\**********************************/\n/*! exports provided: AxisScaleGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return AxisScaleGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single axis scale gizmo\r\n */\r\nvar AxisScaleGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AxisScaleGizmo, _super);\r\n /**\r\n * Creates an AxisScaleGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param dragAxis The axis which the gizmo will be able to scale on\r\n * @param color The color of the gizmo\r\n */\r\n function AxisScaleGizmo(dragAxis, color, gizmoLayer, parent) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (parent === void 0) { parent = null; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Scale distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * If the scaling operation should be done on all axis (default: false)\r\n */\r\n _this.uniformScaling = false;\r\n _this._isEnabled = true;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n _this._coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._coloredMaterial.diffuseColor = color;\r\n _this._coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.1, 0.1, 0.1));\r\n _this._hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build mesh on root node\r\n _this._arrow = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n var arrowMesh = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_4__[\"BoxBuilder\"].CreateBox(\"yPosMesh\", { size: 0.4 }, gizmoLayer.utilityLayerScene);\r\n var arrowTail = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__[\"CylinderBuilder\"].CreateCylinder(\"cylinder\", { diameterTop: 0.005, height: 0.275, diameterBottom: 0.005, tessellation: 96 }, gizmoLayer.utilityLayerScene);\r\n arrowTail.material = _this._coloredMaterial;\r\n _this._arrow.addChild(arrowMesh);\r\n _this._arrow.addChild(arrowTail);\r\n // Position arrow pointing in its drag axis\r\n arrowMesh.scaling.scaleInPlace(0.1);\r\n arrowMesh.material = _this._coloredMaterial;\r\n arrowMesh.rotation.x = Math.PI / 2;\r\n arrowMesh.position.z += 0.3;\r\n arrowTail.position.z += 0.275 / 2;\r\n arrowTail.rotation.x = Math.PI / 2;\r\n _this._arrow.lookAt(_this._rootMesh.position.add(dragAxis));\r\n _this._rootMesh.addChild(_this._arrow);\r\n _this._arrow.scaling.scaleInPlace(1 / 3);\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_7__[\"PointerDragBehavior\"]({ dragAxis: dragAxis });\r\n _this.dragBehavior.moveAttached = false;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var currentSnapDragDistance = 0;\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n // Drag strength is modified by the scale of the gizmo (eg. for small objects like boombox the strength will be increased to match the behavior of larger objects)\r\n var dragStrength = event.dragDistance * ((_this.scaleRatio * 3) / _this._rootMesh.scaling.length());\r\n // Snapping logic\r\n var snapped = false;\r\n var dragSteps = 0;\r\n if (_this.uniformScaling) {\r\n _this.attachedMesh.scaling.normalizeToRef(tmpVector);\r\n if (tmpVector.y < 0) {\r\n tmpVector.scaleInPlace(-1);\r\n }\r\n }\r\n else {\r\n tmpVector.copyFrom(dragAxis);\r\n }\r\n if (_this.snapDistance == 0) {\r\n tmpVector.scaleToRef(dragStrength, tmpVector);\r\n }\r\n else {\r\n currentSnapDragDistance += dragStrength;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n if (currentSnapDragDistance < 0) {\r\n dragSteps *= -1;\r\n }\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n tmpVector.scaleToRef(_this.snapDistance * dragSteps, tmpVector);\r\n snapped = true;\r\n }\r\n else {\r\n tmpVector.scaleInPlace(0);\r\n }\r\n }\r\n _this.attachedMesh.scaling.addInPlace(tmpVector);\r\n if (snapped) {\r\n tmpSnapEvent.snapDistance = _this.snapDistance * dragSteps;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? _this._hoverMaterial : _this._coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n if (m.color) {\r\n m.color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes());\r\n return _this;\r\n }\r\n AxisScaleGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(AxisScaleGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n AxisScaleGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n if (this._arrow) {\r\n this._arrow.dispose();\r\n }\r\n [this._coloredMaterial, this._hoverMaterial].forEach(function (matl) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n });\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n * @param useGizmoMaterial If the gizmo's default material should be used (default: false)\r\n */\r\n AxisScaleGizmo.prototype.setCustomMesh = function (mesh, useGizmoMaterial) {\r\n var _this = this;\r\n if (useGizmoMaterial === void 0) { useGizmoMaterial = false; }\r\n _super.prototype.setCustomMesh.call(this, mesh);\r\n if (useGizmoMaterial) {\r\n this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = _this._coloredMaterial;\r\n if (m.color) {\r\n m.color = _this._coloredMaterial.diffuseColor;\r\n }\r\n });\r\n this._customMeshSet = false;\r\n }\r\n };\r\n return AxisScaleGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_8__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/boundingBoxGizmo.ts\":\n/*!************************************!*\\\n !*** ./Gizmos/boundingBoxGizmo.ts ***!\n \\************************************/\n/*! exports provided: BoundingBoxGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return BoundingBoxGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Misc/pivotTools */ \"./Misc/pivotTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Bounding box gizmo\r\n */\r\nvar BoundingBoxGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BoundingBoxGizmo, _super);\r\n /**\r\n * Creates an BoundingBoxGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param color The color of the gizmo\r\n */\r\n function BoundingBoxGizmo(color, gizmoLayer) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_11__[\"UtilityLayerRenderer\"].DefaultKeepDepthUtilityLayer; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._boundingDimensions = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 1, 1);\r\n _this._renderObserver = null;\r\n _this._pointerObserver = null;\r\n _this._scaleDragSpeed = 0.2;\r\n _this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n _this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n _this._tmpRotationMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n /**\r\n * If child meshes should be ignored when calculating the boudning box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)\r\n */\r\n _this.ignoreChildren = false;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored. (Default: null)\r\n */\r\n _this.includeChildPredicate = null;\r\n /**\r\n * The size of the rotation spheres attached to the bounding box (Default: 0.1)\r\n */\r\n _this.rotationSphereSize = 0.1;\r\n /**\r\n * The size of the scale boxes attached to the bounding box (Default: 0.1)\r\n */\r\n _this.scaleBoxSize = 0.1;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false)\r\n */\r\n _this.fixedDragMeshScreenSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)\r\n */\r\n _this.fixedDragMeshScreenSizeDistanceFactor = 10;\r\n /**\r\n * Fired when a rotation sphere or scale box is dragged\r\n */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a scale box is dragged\r\n */\r\n _this.onScaleBoxDragObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a scale box drag is ended\r\n */\r\n _this.onScaleBoxDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a rotation sphere is dragged\r\n */\r\n _this.onRotationSphereDragObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a rotation sphere drag is ended\r\n */\r\n _this.onRotationSphereDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Relative bounding box pivot used when scaling the attached mesh. When null object with scale from the opposite corner. 0.5,0.5,0.5 for center and 0.5,0,0.5 for bottom (Default: null)\r\n */\r\n _this.scalePivot = null;\r\n _this._existingMeshScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n // Dragging\r\n _this._dragMesh = null;\r\n _this.pointerDragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__[\"PointerDragBehavior\"]();\r\n // Do not update the gizmo's scale so it has a fixed size to the object its attached to\r\n _this.updateScale = false;\r\n _this._anchorMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"anchor\", gizmoLayer.utilityLayerScene);\r\n // Create Materials\r\n _this.coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this.coloredMaterial.disableLighting = true;\r\n _this.hoverColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this.hoverColoredMaterial.disableLighting = true;\r\n // Build bounding box out of lines\r\n _this._lineBoundingBox = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._lineBoundingBox.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n var lines = [];\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.forEach(function (l) {\r\n l.color = color;\r\n l.position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-_this._boundingDimensions.x / 2, -_this._boundingDimensions.y / 2, -_this._boundingDimensions.z / 2));\r\n l.isPickable = false;\r\n _this._lineBoundingBox.addChild(l);\r\n });\r\n _this._rootMesh.addChild(_this._lineBoundingBox);\r\n _this.setColor(color);\r\n // Create rotation spheres\r\n _this._rotateSpheresParent = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._rotateSpheresParent.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n var _loop_1 = function (i_1) {\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__[\"SphereBuilder\"].CreateSphere(\"\", { diameter: 1 }, gizmoLayer.utilityLayerScene);\r\n sphere.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n sphere.material = this_1.coloredMaterial;\r\n // Drag behavior\r\n _dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__[\"PointerDragBehavior\"]({});\r\n _dragBehavior.moveAttached = false;\r\n _dragBehavior.updateDragPlane = false;\r\n sphere.addBehavior(_dragBehavior);\r\n var startingTurnDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0);\r\n var totalTurnAmountOfDrag = 0;\r\n _dragBehavior.onDragStartObservable.add(function () {\r\n startingTurnDirection.copyFrom(sphere.forward);\r\n totalTurnAmountOfDrag = 0;\r\n });\r\n _dragBehavior.onDragObservable.add(function (event) {\r\n _this.onRotationSphereDragObservable.notifyObservers({});\r\n if (_this.attachedMesh) {\r\n var originalParent = _this.attachedMesh.parent;\r\n if (originalParent && (originalParent.scaling && originalParent.scaling.isNonUniformWithinEpsilon(0.001))) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(_this.attachedMesh);\r\n var worldDragDirection = startingTurnDirection;\r\n // Project the world right on to the drag plane\r\n var toSub = event.dragPlaneNormal.scale(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(event.dragPlaneNormal, worldDragDirection));\r\n var dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();\r\n // project drag delta on to the resulting drag axis and rotate based on that\r\n var projectDist = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());\r\n // Make rotation relative to size of mesh.\r\n projectDist = (projectDist / _this._boundingDimensions.length()) * _this._anchorMesh.scaling.length();\r\n // Rotate based on axis\r\n if (!_this.attachedMesh.rotationQuaternion) {\r\n _this.attachedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(_this.attachedMesh.rotation.y, _this.attachedMesh.rotation.x, _this.attachedMesh.rotation.z);\r\n }\r\n if (!_this._anchorMesh.rotationQuaternion) {\r\n _this._anchorMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(_this._anchorMesh.rotation.y, _this._anchorMesh.rotation.x, _this._anchorMesh.rotation.z);\r\n }\r\n // Do not allow the object to turn more than a full circle\r\n totalTurnAmountOfDrag += projectDist;\r\n if (Math.abs(totalTurnAmountOfDrag) <= 2 * Math.PI) {\r\n if (i_1 >= 8) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(0, 0, projectDist, _this._tmpQuaternion);\r\n }\r\n else if (i_1 >= 4) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(projectDist, 0, 0, _this._tmpQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(0, projectDist, 0, _this._tmpQuaternion);\r\n }\r\n // Rotate around center of bounding box\r\n _this._anchorMesh.addChild(_this.attachedMesh);\r\n _this._anchorMesh.rotationQuaternion.multiplyToRef(_this._tmpQuaternion, _this._anchorMesh.rotationQuaternion);\r\n _this._anchorMesh.removeChild(_this.attachedMesh);\r\n _this.attachedMesh.setParent(originalParent);\r\n }\r\n _this.updateBoundingBox();\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(_this.attachedMesh);\r\n }\r\n _this._updateDummy();\r\n });\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n _this._selectNode(sphere);\r\n });\r\n _dragBehavior.onDragEndObservable.add(function () {\r\n _this.onRotationSphereDragEndObservable.notifyObservers({});\r\n _this._selectNode(null);\r\n _this._updateDummy();\r\n });\r\n this_1._rotateSpheresParent.addChild(sphere);\r\n };\r\n var this_1 = this, _dragBehavior;\r\n for (var i_1 = 0; i_1 < 12; i_1++) {\r\n _loop_1(i_1);\r\n }\r\n _this._rootMesh.addChild(_this._rotateSpheresParent);\r\n // Create scale cubes\r\n _this._scaleBoxesParent = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._scaleBoxesParent.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n for (var i = 0; i < 2; i++) {\r\n for (var j = 0; j < 2; j++) {\r\n var _loop_2 = function () {\r\n var box = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_7__[\"BoxBuilder\"].CreateBox(\"\", { size: 1 }, gizmoLayer.utilityLayerScene);\r\n box.material = this_2.coloredMaterial;\r\n // Dragging logic\r\n var dragAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](i == 0 ? -1 : 1, j == 0 ? -1 : 1, k == 0 ? -1 : 1);\r\n _dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__[\"PointerDragBehavior\"]({ dragAxis: dragAxis });\r\n _dragBehavior.moveAttached = false;\r\n box.addBehavior(_dragBehavior);\r\n _dragBehavior.onDragObservable.add(function (event) {\r\n _this.onScaleBoxDragObservable.notifyObservers({});\r\n if (_this.attachedMesh) {\r\n var originalParent = _this.attachedMesh.parent;\r\n if (originalParent && (originalParent.scaling && originalParent.scaling.isNonUniformWithinEpsilon(0.001))) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(_this.attachedMesh);\r\n var relativeDragDistance = (event.dragDistance / _this._boundingDimensions.length()) * _this._anchorMesh.scaling.length();\r\n var deltaScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](relativeDragDistance, relativeDragDistance, relativeDragDistance);\r\n deltaScale.scaleInPlace(_this._scaleDragSpeed);\r\n _this.updateBoundingBox();\r\n if (_this.scalePivot) {\r\n _this.attachedMesh.getWorldMatrix().getRotationMatrixToRef(_this._tmpRotationMatrix);\r\n // Move anchor to desired pivot point (Bottom left corner + dimension/2)\r\n _this._boundingDimensions.scaleToRef(0.5, _this._tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(_this._tmpVector, _this._tmpRotationMatrix, _this._tmpVector);\r\n _this._anchorMesh.position.subtractInPlace(_this._tmpVector);\r\n _this._boundingDimensions.multiplyToRef(_this.scalePivot, _this._tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(_this._tmpVector, _this._tmpRotationMatrix, _this._tmpVector);\r\n _this._anchorMesh.position.addInPlace(_this._tmpVector);\r\n }\r\n else {\r\n // Scale from the position of the opposite corner\r\n box.absolutePosition.subtractToRef(_this._anchorMesh.position, _this._tmpVector);\r\n _this._anchorMesh.position.subtractInPlace(_this._tmpVector);\r\n }\r\n _this._anchorMesh.addChild(_this.attachedMesh);\r\n _this._anchorMesh.scaling.addInPlace(deltaScale);\r\n if (_this._anchorMesh.scaling.x < 0 || _this._anchorMesh.scaling.y < 0 || _this._anchorMesh.scaling.z < 0) {\r\n _this._anchorMesh.scaling.subtractInPlace(deltaScale);\r\n }\r\n _this._anchorMesh.removeChild(_this.attachedMesh);\r\n _this.attachedMesh.setParent(originalParent);\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(_this.attachedMesh);\r\n }\r\n _this._updateDummy();\r\n });\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n _this._selectNode(box);\r\n });\r\n _dragBehavior.onDragEndObservable.add(function () {\r\n _this.onScaleBoxDragEndObservable.notifyObservers({});\r\n _this._selectNode(null);\r\n _this._updateDummy();\r\n });\r\n this_2._scaleBoxesParent.addChild(box);\r\n };\r\n var this_2 = this, _dragBehavior;\r\n for (var k = 0; k < 2; k++) {\r\n _loop_2();\r\n }\r\n }\r\n }\r\n _this._rootMesh.addChild(_this._scaleBoxesParent);\r\n // Hover color change\r\n var pointerIds = new Array();\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (!pointerIds[pointerInfo.event.pointerId]) {\r\n _this._rotateSpheresParent.getChildMeshes().concat(_this._scaleBoxesParent.getChildMeshes()).forEach(function (mesh) {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {\r\n pointerIds[pointerInfo.event.pointerId] = mesh;\r\n mesh.material = _this.hoverColoredMaterial;\r\n }\r\n });\r\n }\r\n else {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[pointerInfo.event.pointerId]) {\r\n pointerIds[pointerInfo.event.pointerId].material = _this.coloredMaterial;\r\n delete pointerIds[pointerInfo.event.pointerId];\r\n }\r\n }\r\n });\r\n // Update bounding box positions\r\n _this._renderObserver = _this.gizmoLayer.originalScene.onBeforeRenderObservable.add(function () {\r\n // Only update the bouding box if scaling has changed\r\n if (_this.attachedMesh && !_this._existingMeshScale.equals(_this.attachedMesh.scaling)) {\r\n _this.updateBoundingBox();\r\n }\r\n else if (_this.fixedDragMeshScreenSize) {\r\n _this._updateRotationSpheres();\r\n _this._updateScaleBoxes();\r\n }\r\n // If dragg mesh is enabled and dragging, update the attached mesh pose to match the drag mesh\r\n if (_this._dragMesh && _this.attachedMesh && _this.pointerDragBehavior.dragging) {\r\n _this._lineBoundingBox.position.rotateByQuaternionToRef(_this._rootMesh.rotationQuaternion, _this._tmpVector);\r\n _this.attachedMesh.setAbsolutePosition(_this._dragMesh.position.add(_this._tmpVector.scale(-1)));\r\n }\r\n });\r\n _this.updateBoundingBox();\r\n return _this;\r\n }\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n BoundingBoxGizmo.prototype.setColor = function (color) {\r\n this.coloredMaterial.emissiveColor = color;\r\n this.hoverColoredMaterial.emissiveColor = color.clone().add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"](0.3, 0.3, 0.3));\r\n this._lineBoundingBox.getChildren().forEach(function (l) {\r\n if (l.color) {\r\n l.color = color;\r\n }\r\n });\r\n };\r\n BoundingBoxGizmo.prototype._attachedMeshChanged = function (value) {\r\n var _this = this;\r\n if (value) {\r\n // Reset anchor mesh to match attached mesh's scale\r\n // This is needed to avoid invalid box/sphere position on first drag\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(value);\r\n var originalParent = value.parent;\r\n this._anchorMesh.addChild(value);\r\n this._anchorMesh.removeChild(value);\r\n value.setParent(originalParent);\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(value);\r\n this.updateBoundingBox();\r\n value.getChildMeshes(false).forEach(function (m) {\r\n m.markAsDirty(\"scaling\");\r\n });\r\n this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function () {\r\n _this._updateDummy();\r\n });\r\n }\r\n };\r\n BoundingBoxGizmo.prototype._selectNode = function (selectedMesh) {\r\n this._rotateSpheresParent.getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes()).forEach(function (m) {\r\n m.isVisible = (!selectedMesh || m == selectedMesh);\r\n });\r\n };\r\n /**\r\n * Updates the bounding box information for the Gizmo\r\n */\r\n BoundingBoxGizmo.prototype.updateBoundingBox = function () {\r\n if (this.attachedMesh) {\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(this.attachedMesh);\r\n // Store original parent\r\n var originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null);\r\n // Store original skelton override mesh\r\n var originalSkeletonOverrideMesh = null;\r\n if (this.attachedMesh.skeleton) {\r\n originalSkeletonOverrideMesh = this.attachedMesh.skeleton.overrideMesh;\r\n this.attachedMesh.skeleton.overrideMesh = null;\r\n }\r\n this._update();\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z);\r\n }\r\n this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n // Update bounding dimensions/positions\r\n var boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n // Update gizmo to match bounding box scaling and rotation\r\n // The position set here is the offset from the origin for the boundingbox when the attached mesh is at the origin\r\n // The position of the gizmo is then set to the attachedMesh in gizmo._update\r\n this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions);\r\n this._lineBoundingBox.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._lineBoundingBox.computeWorldMatrix();\r\n this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition);\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent);\r\n // Restore original skeleton override mesh\r\n if (this.attachedMesh.skeleton) {\r\n this.attachedMesh.skeleton.overrideMesh = originalSkeletonOverrideMesh;\r\n }\r\n }\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n if (this.attachedMesh) {\r\n this._existingMeshScale.copyFrom(this.attachedMesh.scaling);\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(this.attachedMesh);\r\n }\r\n };\r\n BoundingBoxGizmo.prototype._updateRotationSpheres = function () {\r\n var rotateSpheres = this._rotateSpheresParent.getChildMeshes();\r\n for (var i = 0; i < 3; i++) {\r\n for (var j = 0; j < 2; j++) {\r\n for (var k = 0; k < 2; k++) {\r\n var index = ((i * 4) + (j * 2)) + k;\r\n if (i == 0) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Cross(rotateSpheres[index].position.normalizeToNew(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Right()).normalizeToNew().add(rotateSpheres[index].position));\r\n }\r\n if (i == 1) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Cross(rotateSpheres[index].position.normalizeToNew(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up()).normalizeToNew().add(rotateSpheres[index].position));\r\n }\r\n if (i == 2) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);\r\n rotateSpheres[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Cross(rotateSpheres[index].position.normalizeToNew(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Forward()).normalizeToNew().add(rotateSpheres[index].position));\r\n }\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;\r\n rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n else {\r\n rotateSpheres[index].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n BoundingBoxGizmo.prototype._updateScaleBoxes = function () {\r\n var scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n for (var i = 0; i < 2; i++) {\r\n for (var j = 0; j < 2; j++) {\r\n for (var k = 0; k < 2; k++) {\r\n var index = ((i * 4) + (j * 2)) + k;\r\n if (scaleBoxes[index]) {\r\n scaleBoxes[index].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n scaleBoxes[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;\r\n scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n else {\r\n scaleBoxes[index].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n BoundingBoxGizmo.prototype.setEnabledRotationAxis = function (axis) {\r\n this._rotateSpheresParent.getChildMeshes().forEach(function (m, i) {\r\n if (i < 4) {\r\n m.setEnabled(axis.indexOf(\"x\") != -1);\r\n }\r\n else if (i < 8) {\r\n m.setEnabled(axis.indexOf(\"y\") != -1);\r\n }\r\n else {\r\n m.setEnabled(axis.indexOf(\"z\") != -1);\r\n }\r\n });\r\n };\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n */\r\n BoundingBoxGizmo.prototype.setEnabledScaling = function (enable) {\r\n this._scaleBoxesParent.getChildMeshes().forEach(function (m, i) {\r\n m.setEnabled(enable);\r\n });\r\n };\r\n BoundingBoxGizmo.prototype._updateDummy = function () {\r\n if (this._dragMesh) {\r\n this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition());\r\n this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling);\r\n this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion);\r\n }\r\n };\r\n /**\r\n * Enables a pointer drag behavior on the bounding box of the gizmo\r\n */\r\n BoundingBoxGizmo.prototype.enableDragBehavior = function () {\r\n this._dragMesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateBox(\"dummy\", 1, this.gizmoLayer.utilityLayerScene);\r\n this._dragMesh.visibility = 0;\r\n this._dragMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n this.pointerDragBehavior.useObjectOrienationForDragging = false;\r\n this._dragMesh.addBehavior(this.pointerDragBehavior);\r\n };\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n BoundingBoxGizmo.prototype.dispose = function () {\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n this._lineBoundingBox.dispose();\r\n this._rotateSpheresParent.dispose();\r\n this._scaleBoxesParent.dispose();\r\n if (this._dragMesh) {\r\n this._dragMesh.dispose();\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Makes a mesh not pickable and wraps the mesh inside of a bounding box mesh that is pickable. (This is useful to avoid picking within complex geometry)\r\n * @param mesh the mesh to wrap in the bounding box mesh and make not pickable\r\n * @returns the bounding box mesh with the passed in mesh as a child\r\n */\r\n BoundingBoxGizmo.MakeNotPickableAndWrapInBoundingBox = function (mesh) {\r\n var makeNotPickable = function (root) {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach(function (c) {\r\n makeNotPickable(c);\r\n });\r\n };\r\n makeNotPickable(mesh);\r\n // Reset position to get boudning box from origin with no rotation\r\n if (!mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(mesh.rotation.y, mesh.rotation.x, mesh.rotation.z);\r\n }\r\n var oldPos = mesh.position.clone();\r\n var oldRot = mesh.rotationQuaternion.clone();\r\n mesh.rotationQuaternion.set(0, 0, 0, 1);\r\n mesh.position.set(0, 0, 0);\r\n // Update bounding dimensions/positions\r\n var box = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_7__[\"BoxBuilder\"].CreateBox(\"box\", { size: 1 }, mesh.getScene());\r\n var boundingMinMax = mesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);\r\n // Adjust scale to avoid undefined behavior when adding child\r\n if (box.scaling.y === 0) {\r\n box.scaling.y = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n }\r\n if (box.scaling.x === 0) {\r\n box.scaling.x = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n }\r\n if (box.scaling.z === 0) {\r\n box.scaling.z = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n }\r\n box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n // Restore original positions\r\n mesh.addChild(box);\r\n mesh.rotationQuaternion.copyFrom(oldRot);\r\n mesh.position.copyFrom(oldPos);\r\n // Reverse parenting\r\n mesh.removeChild(box);\r\n box.addChild(mesh);\r\n box.visibility = 0;\r\n return box;\r\n };\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n BoundingBoxGizmo.prototype.setCustomMesh = function (mesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Error(\"Custom meshes are not supported on this gizmo\");\r\n };\r\n return BoundingBoxGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_10__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/gizmo.ts\":\n/*!*************************!*\\\n !*** ./Gizmos/gizmo.ts ***!\n \\*************************/\n/*! exports provided: Gizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return Gizmo; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n/**\r\n * Renders gizmos on top of an existing scene which provide controls for position, rotation, etc.\r\n */\r\nvar Gizmo = /** @class */ (function () {\r\n /**\r\n * Creates a gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function Gizmo(\r\n /** The utility layer the gizmo will be added to */\r\n gizmoLayer) {\r\n var _this = this;\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_2__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n this.gizmoLayer = gizmoLayer;\r\n this._attachedMesh = null;\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n this.scaleRatio = 1;\r\n /**\r\n * If a custom mesh has been set (Default: false)\r\n */\r\n this._customMeshSet = false;\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n this.updateGizmoRotationToMatchAttachedMesh = true;\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n this.updateGizmoPositionToMatchAttachedMesh = true;\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n this.updateScale = true;\r\n this._interactionsEnabled = true;\r\n this._tempVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n this._rootMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](\"gizmoRootNode\", gizmoLayer.utilityLayerScene);\r\n this._rootMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Identity();\r\n this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function () {\r\n _this._update();\r\n });\r\n }\r\n Object.defineProperty(Gizmo.prototype, \"attachedMesh\", {\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n get: function () {\r\n return this._attachedMesh;\r\n },\r\n set: function (value) {\r\n this._attachedMesh = value;\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedMeshChanged(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n Gizmo.prototype.setCustomMesh = function (mesh) {\r\n if (mesh.getScene() != this.gizmoLayer.utilityLayerScene) {\r\n throw \"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)\";\r\n }\r\n this._rootMesh.getChildMeshes().forEach(function (c) {\r\n c.dispose();\r\n });\r\n mesh.parent = this._rootMesh;\r\n this._customMeshSet = true;\r\n };\r\n Gizmo.prototype._attachedMeshChanged = function (value) {\r\n };\r\n /**\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n Gizmo.prototype._update = function () {\r\n if (this.attachedMesh) {\r\n var effectiveMesh = this.attachedMesh._effectiveMesh || this.attachedMesh;\r\n // Position\r\n if (this.updateGizmoPositionToMatchAttachedMesh) {\r\n this._rootMesh.position.copyFrom(effectiveMesh.absolutePosition);\r\n }\r\n // Rotation\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n effectiveMesh.getWorldMatrix().decompose(undefined, this._rootMesh.rotationQuaternion);\r\n }\r\n else {\r\n this._rootMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n }\r\n // Scale\r\n if (this.updateScale) {\r\n var activeCamera = this.gizmoLayer.utilityLayerScene.activeCamera;\r\n var cameraPosition = activeCamera.globalPosition;\r\n if (activeCamera.devicePosition) {\r\n cameraPosition = activeCamera.devicePosition;\r\n }\r\n this._rootMesh.position.subtractToRef(cameraPosition, this._tempVector);\r\n var dist = this._tempVector.length() * this.scaleRatio;\r\n this._rootMesh.scaling.set(dist, dist, dist);\r\n // Account for handedness, similar to Matrix.decompose\r\n if (effectiveMesh._getWorldMatrixDeterminant() < 0) {\r\n this._rootMesh.scaling.y *= -1;\r\n }\r\n }\r\n else {\r\n this._rootMesh.scaling.setAll(this.scaleRatio);\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n Gizmo.prototype.dispose = function () {\r\n this._rootMesh.dispose();\r\n if (this._beforeRenderObserver) {\r\n this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n };\r\n return Gizmo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/gizmoManager.ts\":\n/*!********************************!*\\\n !*** ./Gizmos/gizmoManager.ts ***!\n \\********************************/\n/*! exports provided: GizmoManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return GizmoManager; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Behaviors_Meshes_sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Behaviors/Meshes/sixDofDragBehavior */ \"./Behaviors/Meshes/sixDofDragBehavior.ts\");\n/* harmony import */ var _rotationGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./rotationGizmo */ \"./Gizmos/rotationGizmo.ts\");\n/* harmony import */ var _positionGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./positionGizmo */ \"./Gizmos/positionGizmo.ts\");\n/* harmony import */ var _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./scaleGizmo */ \"./Gizmos/scaleGizmo.ts\");\n/* harmony import */ var _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./boundingBoxGizmo */ \"./Gizmos/boundingBoxGizmo.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Helps setup gizmo's in the scene to rotate/scale/position meshes\r\n */\r\nvar GizmoManager = /** @class */ (function () {\r\n /**\r\n * Instatiates a gizmo manager\r\n * @param scene the scene to overlay the gizmos on top of\r\n */\r\n function GizmoManager(scene) {\r\n var _this = this;\r\n this.scene = scene;\r\n /** When true, the gizmo will be detached from the current object when a pointer down occurs with an empty picked mesh */\r\n this.clearGizmoOnEmptyPointerEvent = false;\r\n /** Fires an event when the manager is attached to a mesh */\r\n this.onAttachedToMeshObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._gizmosEnabled = { positionGizmo: false, rotationGizmo: false, scaleGizmo: false, boundingBoxGizmo: false };\r\n this._pointerObserver = null;\r\n this._attachedMesh = null;\r\n this._boundingBoxColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].FromHexString(\"#0984e3\");\r\n /**\r\n * When bounding box gizmo is enabled, this can be used to track drag/end events\r\n */\r\n this.boundingBoxDragBehavior = new _Behaviors_Meshes_sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_5__[\"SixDofDragBehavior\"]();\r\n /**\r\n * Array of meshes which will have the gizmo attached when a pointer selected them. If null, all meshes are attachable. (Default: null)\r\n */\r\n this.attachableMeshes = null;\r\n /**\r\n * If pointer events should perform attaching/detaching a gizmo, if false this can be done manually via attachToMesh. (Default: true)\r\n */\r\n this.usePointerToAttachGizmos = true;\r\n this._defaultKeepDepthUtilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__[\"UtilityLayerRenderer\"](scene);\r\n this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false;\r\n this._defaultUtilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__[\"UtilityLayerRenderer\"](scene);\r\n this.gizmos = { positionGizmo: null, rotationGizmo: null, scaleGizmo: null, boundingBoxGizmo: null };\r\n // Instatiate/dispose gizmos based on pointer actions\r\n this._pointerObserver = scene.onPointerObservable.add(function (pointerInfo) {\r\n if (!_this.usePointerToAttachGizmos) {\r\n return;\r\n }\r\n if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh) {\r\n var node = pointerInfo.pickInfo.pickedMesh;\r\n if (_this.attachableMeshes == null) {\r\n // Attach to the most parent node\r\n while (node && node.parent != null) {\r\n node = node.parent;\r\n }\r\n }\r\n else {\r\n // Attach to the parent node that is an attachableMesh\r\n var found = false;\r\n _this.attachableMeshes.forEach(function (mesh) {\r\n if (node && (node == mesh || node.isDescendantOf(mesh))) {\r\n node = mesh;\r\n found = true;\r\n }\r\n });\r\n if (!found) {\r\n node = null;\r\n }\r\n }\r\n if (node instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"]) {\r\n if (_this._attachedMesh != node) {\r\n _this.attachToMesh(node);\r\n }\r\n }\r\n else {\r\n if (_this.clearGizmoOnEmptyPointerEvent) {\r\n _this.attachToMesh(null);\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.clearGizmoOnEmptyPointerEvent) {\r\n _this.attachToMesh(null);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n Object.defineProperty(GizmoManager.prototype, \"keepDepthUtilityLayer\", {\r\n /**\r\n * Utility layer that the bounding box gizmo belongs to\r\n */\r\n get: function () {\r\n return this._defaultKeepDepthUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"utilityLayer\", {\r\n /**\r\n * Utility layer that all gizmos besides bounding box belong to\r\n */\r\n get: function () {\r\n return this._defaultUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a set of gizmos to the specified mesh\r\n * @param mesh The mesh the gizmo's should be attached to\r\n */\r\n GizmoManager.prototype.attachToMesh = function (mesh) {\r\n if (this._attachedMesh) {\r\n this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior);\r\n }\r\n this._attachedMesh = mesh;\r\n for (var key in this.gizmos) {\r\n var gizmo = (this.gizmos[key]);\r\n if (gizmo && this._gizmosEnabled[key]) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n }\r\n if (this.boundingBoxGizmoEnabled && this._attachedMesh) {\r\n this._attachedMesh.addBehavior(this.boundingBoxDragBehavior);\r\n }\r\n this.onAttachedToMeshObservable.notifyObservers(mesh);\r\n };\r\n Object.defineProperty(GizmoManager.prototype, \"positionGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.positionGizmo;\r\n },\r\n /**\r\n * If the position gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n if (!this.gizmos.positionGizmo) {\r\n this.gizmos.positionGizmo = new _positionGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PositionGizmo\"](this._defaultUtilityLayer);\r\n }\r\n this.gizmos.positionGizmo.attachedMesh = this._attachedMesh;\r\n }\r\n else if (this.gizmos.positionGizmo) {\r\n this.gizmos.positionGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.positionGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"rotationGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.rotationGizmo;\r\n },\r\n /**\r\n * If the rotation gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n if (!this.gizmos.rotationGizmo) {\r\n this.gizmos.rotationGizmo = new _rotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"RotationGizmo\"](this._defaultUtilityLayer);\r\n }\r\n this.gizmos.rotationGizmo.attachedMesh = this._attachedMesh;\r\n }\r\n else if (this.gizmos.rotationGizmo) {\r\n this.gizmos.rotationGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.rotationGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"scaleGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.scaleGizmo;\r\n },\r\n /**\r\n * If the scale gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this.gizmos.scaleGizmo = this.gizmos.scaleGizmo || new _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__[\"ScaleGizmo\"](this._defaultUtilityLayer);\r\n this.gizmos.scaleGizmo.attachedMesh = this._attachedMesh;\r\n }\r\n else if (this.gizmos.scaleGizmo) {\r\n this.gizmos.scaleGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.scaleGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"boundingBoxGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.boundingBoxGizmo;\r\n },\r\n /**\r\n * If the boundingBox gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this.gizmos.boundingBoxGizmo = this.gizmos.boundingBoxGizmo || new _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_9__[\"BoundingBoxGizmo\"](this._boundingBoxColor, this._defaultKeepDepthUtilityLayer);\r\n this.gizmos.boundingBoxGizmo.attachedMesh = this._attachedMesh;\r\n if (this._attachedMesh) {\r\n this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior);\r\n this._attachedMesh.addBehavior(this.boundingBoxDragBehavior);\r\n }\r\n }\r\n else if (this.gizmos.boundingBoxGizmo) {\r\n if (this._attachedMesh) {\r\n this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior);\r\n }\r\n this.gizmos.boundingBoxGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.boundingBoxGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo manager\r\n */\r\n GizmoManager.prototype.dispose = function () {\r\n this.scene.onPointerObservable.remove(this._pointerObserver);\r\n for (var key in this.gizmos) {\r\n var gizmo = (this.gizmos[key]);\r\n if (gizmo) {\r\n gizmo.dispose();\r\n }\r\n }\r\n this._defaultKeepDepthUtilityLayer.dispose();\r\n this._defaultUtilityLayer.dispose();\r\n this.boundingBoxDragBehavior.detach();\r\n this.onAttachedToMeshObservable.clear();\r\n };\r\n return GizmoManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/index.ts\":\n/*!*************************!*\\\n !*** ./Gizmos/index.ts ***!\n \\*************************/\n/*! exports provided: AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _axisDragGizmo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./axisDragGizmo */ \"./Gizmos/axisDragGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return _axisDragGizmo__WEBPACK_IMPORTED_MODULE_0__[\"AxisDragGizmo\"]; });\n\n/* harmony import */ var _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./axisScaleGizmo */ \"./Gizmos/axisScaleGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_1__[\"AxisScaleGizmo\"]; });\n\n/* harmony import */ var _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boundingBoxGizmo */ \"./Gizmos/boundingBoxGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_2__[\"BoundingBoxGizmo\"]; });\n\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return _gizmo__WEBPACK_IMPORTED_MODULE_3__[\"Gizmo\"]; });\n\n/* harmony import */ var _gizmoManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gizmoManager */ \"./Gizmos/gizmoManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return _gizmoManager__WEBPACK_IMPORTED_MODULE_4__[\"GizmoManager\"]; });\n\n/* harmony import */ var _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./planeRotationGizmo */ \"./Gizmos/planeRotationGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_5__[\"PlaneRotationGizmo\"]; });\n\n/* harmony import */ var _positionGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./positionGizmo */ \"./Gizmos/positionGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return _positionGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PositionGizmo\"]; });\n\n/* harmony import */ var _rotationGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rotationGizmo */ \"./Gizmos/rotationGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return _rotationGizmo__WEBPACK_IMPORTED_MODULE_7__[\"RotationGizmo\"]; });\n\n/* harmony import */ var _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./scaleGizmo */ \"./Gizmos/scaleGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__[\"ScaleGizmo\"]; });\n\n/* harmony import */ var _lightGizmo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lightGizmo */ \"./Gizmos/lightGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return _lightGizmo__WEBPACK_IMPORTED_MODULE_9__[\"LightGizmo\"]; });\n\n/* harmony import */ var _planeDragGizmo__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./planeDragGizmo */ \"./Gizmos/planeDragGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return _planeDragGizmo__WEBPACK_IMPORTED_MODULE_10__[\"PlaneDragGizmo\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/lightGizmo.ts\":\n/*!******************************!*\\\n !*** ./Gizmos/lightGizmo.ts ***!\n \\******************************/\n/*! exports provided: LightGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return LightGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _Lights_directionalLight__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Lights/directionalLight */ \"./Lights/directionalLight.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_hemisphereBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Meshes/Builders/hemisphereBuilder */ \"./Meshes/Builders/hemisphereBuilder.ts\");\n/* harmony import */ var _Lights_spotLight__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Lights/spotLight */ \"./Lights/spotLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables viewing a light\r\n */\r\nvar LightGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LightGizmo, _super);\r\n /**\r\n * Creates a LightGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function LightGizmo(gizmoLayer) {\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this.cachedPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]();\r\n _this.cachedForward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 1);\r\n _this._light = null;\r\n _this.attachedMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"](\"\", _this.gizmoLayer.utilityLayerScene);\r\n _this._material = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"](\"light\", _this.gizmoLayer.originalScene);\r\n _this._material.diffuseColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"](0.5, 0.5, 0.5);\r\n _this._material.specularColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"](0.1, 0.1, 0.1);\r\n return _this;\r\n }\r\n Object.defineProperty(LightGizmo.prototype, \"light\", {\r\n get: function () {\r\n return this._light;\r\n },\r\n /**\r\n * The light that the gizmo is attached to\r\n */\r\n set: function (light) {\r\n var _this = this;\r\n this._light = light;\r\n if (light) {\r\n // Create the mesh for the given light type\r\n if (this._lightMesh) {\r\n this._lightMesh.dispose();\r\n }\r\n if (light instanceof _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__[\"HemisphericLight\"]) {\r\n this._lightMesh = LightGizmo._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n else if (light instanceof _Lights_directionalLight__WEBPACK_IMPORTED_MODULE_8__[\"DirectionalLight\"]) {\r\n this._lightMesh = LightGizmo._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n else if (light instanceof _Lights_spotLight__WEBPACK_IMPORTED_MODULE_11__[\"SpotLight\"]) {\r\n this._lightMesh = LightGizmo._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n else {\r\n this._lightMesh = LightGizmo._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n this._lightMesh.getChildMeshes(false).forEach(function (m) {\r\n m.material = _this._material;\r\n });\r\n this._lightMesh.parent = this._rootMesh;\r\n // Add lighting to the light gizmo\r\n var gizmoLight = this.gizmoLayer._getSharedGizmoLight();\r\n gizmoLight.includedOnlyMeshes = gizmoLight.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(false));\r\n this._lightMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n if (!this.attachedMesh.reservedDataStore) {\r\n this.attachedMesh.reservedDataStore = {};\r\n }\r\n this.attachedMesh.reservedDataStore.lightGizmo = this;\r\n // Get update position and direction if the light has it\r\n if (light.position) {\r\n this.attachedMesh.position.copyFrom(light.position);\r\n }\r\n if (light.direction) {\r\n this.attachedMesh.setDirection(light.direction);\r\n }\r\n this._update();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightGizmo.prototype, \"material\", {\r\n /**\r\n * Gets the material used to render the light gizmo\r\n */\r\n get: function () {\r\n return this._material;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @hidden\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n LightGizmo.prototype._update = function () {\r\n _super.prototype._update.call(this);\r\n if (!this._light) {\r\n return;\r\n }\r\n if (this._light.position) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n if (!this.attachedMesh.position.equals(this.cachedPosition)) {\r\n // update light to match gizmo\r\n this._light.position.copyFrom(this.attachedMesh.position);\r\n this.cachedPosition.copyFrom(this.attachedMesh.position);\r\n }\r\n else {\r\n // update gizmo to match light\r\n this.attachedMesh.position.copyFrom(this._light.position);\r\n }\r\n }\r\n if (this._light.direction) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(this.attachedMesh.forward, this.cachedForward) > 0.0001) {\r\n // update light to match gizmo\r\n this._light.direction.copyFrom(this.attachedMesh.forward);\r\n this.cachedForward.copyFrom(this.attachedMesh.forward);\r\n }\r\n else if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(this.attachedMesh.forward, this._light.direction) > 0.0001) {\r\n // update gizmo to match light\r\n this.attachedMesh.setDirection(this._light.direction);\r\n this.cachedForward.copyFrom(this._lightMesh.forward);\r\n }\r\n }\r\n if (!this._light.isEnabled()) {\r\n this._material.diffuseColor.set(0, 0, 0);\r\n }\r\n else {\r\n this._material.diffuseColor.set(this._light.diffuse.r / 3, this._light.diffuse.g / 3, this._light.diffuse.b / 3);\r\n }\r\n };\r\n /**\r\n * Disposes of the light gizmo\r\n */\r\n LightGizmo.prototype.dispose = function () {\r\n this._material.dispose();\r\n _super.prototype.dispose.call(this);\r\n };\r\n LightGizmo._CreateHemisphericLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"hemisphereLight\", scene);\r\n var hemisphere = _Meshes_Builders_hemisphereBuilder__WEBPACK_IMPORTED_MODULE_10__[\"HemisphereBuilder\"].CreateHemisphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n hemisphere.position.z = -0.15;\r\n hemisphere.rotation.x = Math.PI / 2;\r\n hemisphere.parent = root;\r\n var lines = this._createLightLines(3, scene);\r\n lines.parent = root;\r\n lines.position.z - 0.15;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n return root;\r\n };\r\n LightGizmo._CreatePointLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"pointLight\", scene);\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__[\"SphereBuilder\"].CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.rotation.x = Math.PI / 2;\r\n sphere.parent = root;\r\n var lines = this._createLightLines(5, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n return root;\r\n };\r\n LightGizmo._CreateSpotLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"spotLight\", scene);\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__[\"SphereBuilder\"].CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.parent = root;\r\n var hemisphere = _Meshes_Builders_hemisphereBuilder__WEBPACK_IMPORTED_MODULE_10__[\"HemisphereBuilder\"].CreateHemisphere(root.name, { segments: 10, diameter: 2 }, scene);\r\n hemisphere.parent = root;\r\n hemisphere.rotation.x = -Math.PI / 2;\r\n var lines = this._createLightLines(2, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n return root;\r\n };\r\n LightGizmo._CreateDirectionalLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"directionalLight\", scene);\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](root.name, scene);\r\n mesh.parent = root;\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__[\"SphereBuilder\"].CreateSphere(root.name, { diameter: 1.2, segments: 10 }, scene);\r\n sphere.parent = mesh;\r\n var line = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].CreateCylinder(root.name, 6, 0.3, 0.3, 6, 1, scene);\r\n line.parent = mesh;\r\n var left = line.clone(root.name);\r\n left.scaling.y = 0.5;\r\n left.position.x += 1.25;\r\n var right = line.clone(root.name);\r\n right.scaling.y = 0.5;\r\n right.position.x += -1.25;\r\n var arrowHead = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].CreateCylinder(root.name, 1, 0, 0.6, 6, 1, scene);\r\n arrowHead.position.y += 3;\r\n arrowHead.parent = mesh;\r\n var left = arrowHead.clone(root.name);\r\n left.position.y = 1.5;\r\n left.position.x += 1.25;\r\n var right = arrowHead.clone(root.name);\r\n right.position.y = 1.5;\r\n right.position.x += -1.25;\r\n mesh.scaling.scaleInPlace(LightGizmo._Scale);\r\n mesh.rotation.z = Math.PI / 2;\r\n mesh.rotation.y = Math.PI / 2;\r\n return root;\r\n };\r\n // Static helper methods\r\n LightGizmo._Scale = 0.007;\r\n /**\r\n * Creates the lines for a light mesh\r\n */\r\n LightGizmo._createLightLines = function (levels, scene) {\r\n var distFromSphere = 1.2;\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"root\", scene);\r\n root.rotation.x = Math.PI / 2;\r\n // Create the top line, this will be cloned for all other lines\r\n var linePivot = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"linePivot\", scene);\r\n linePivot.parent = root;\r\n var line = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].CreateCylinder(\"line\", 2, 0.2, 0.3, 6, 1, scene);\r\n line.position.y = line.scaling.y / 2 + distFromSphere;\r\n line.parent = linePivot;\r\n if (levels < 2) {\r\n return linePivot;\r\n }\r\n for (var i = 0; i < 4; i++) {\r\n var l = linePivot.clone(\"lineParentClone\");\r\n l.rotation.z = Math.PI / 4;\r\n l.rotation.y = (Math.PI / 2) + (Math.PI / 2 * i);\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n if (levels < 3) {\r\n return root;\r\n }\r\n for (var i = 0; i < 4; i++) {\r\n var l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI / 2;\r\n l.rotation.y = (Math.PI / 2 * i);\r\n }\r\n if (levels < 4) {\r\n return root;\r\n }\r\n for (var i = 0; i < 4; i++) {\r\n var l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI + (Math.PI / 4);\r\n l.rotation.y = (Math.PI / 2) + (Math.PI / 2 * i);\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n if (levels < 5) {\r\n return root;\r\n }\r\n var l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI;\r\n return root;\r\n };\r\n return LightGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_5__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/planeDragGizmo.ts\":\n/*!**********************************!*\\\n !*** ./Gizmos/planeDragGizmo.ts ***!\n \\**********************************/\n/*! exports provided: PlaneDragGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return PlaneDragGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single plane drag gizmo\r\n */\r\nvar PlaneDragGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlaneDragGizmo, _super);\r\n /**\r\n * Creates a PlaneDragGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param dragPlaneNormal The axis normal to which the gizmo will be able to drag on\r\n * @param color The color of the gizmo\r\n */\r\n function PlaneDragGizmo(dragPlaneNormal, color, gizmoLayer, parent) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (parent === void 0) { parent = null; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._isEnabled = false;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n _this._coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._coloredMaterial.diffuseColor = color;\r\n _this._coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.1, 0.1, 0.1));\r\n _this._hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build plane mesh on root node\r\n _this._plane = PlaneDragGizmo._CreatePlane(gizmoLayer.utilityLayerScene, _this._coloredMaterial);\r\n _this._plane.lookAt(_this._rootMesh.position.add(dragPlaneNormal));\r\n _this._plane.scaling.scaleInPlace(1 / 3);\r\n _this._plane.parent = _this._rootMesh;\r\n var currentSnapDragDistance = 0;\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n // Add dragPlaneNormal drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__[\"PointerDragBehavior\"]({ dragPlaneNormal: dragPlaneNormal });\r\n _this.dragBehavior.moveAttached = false;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var localDelta = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n // Convert delta to local translation if it has a parent\r\n if (_this.attachedMesh.parent) {\r\n _this.attachedMesh.parent.computeWorldMatrix().invertToRef(tmpMatrix);\r\n tmpMatrix.setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(event.delta, tmpMatrix, localDelta);\r\n }\r\n else {\r\n localDelta.copyFrom(event.delta);\r\n }\r\n // Snapping logic\r\n if (_this.snapDistance == 0) {\r\n _this.attachedMesh.position.addInPlace(localDelta);\r\n }\r\n else {\r\n currentSnapDragDistance += event.dragDistance;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n var dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n localDelta.normalizeToRef(tmpVector);\r\n tmpVector.scaleInPlace(_this.snapDistance * dragSteps);\r\n _this.attachedMesh.position.addInPlace(tmpVector);\r\n tmpSnapEvent.snapDistance = _this.snapDistance * dragSteps;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? _this._hoverMaterial : _this._coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes(false));\r\n return _this;\r\n }\r\n /** @hidden */\r\n PlaneDragGizmo._CreatePlane = function (scene, material) {\r\n var plane = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_4__[\"TransformNode\"](\"plane\", scene);\r\n //make sure plane is double sided\r\n var dragPlane = _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_5__[\"PlaneBuilder\"].CreatePlane(\"dragPlane\", { width: .1375, height: .1375, sideOrientation: 2 }, scene);\r\n dragPlane.material = material;\r\n dragPlane.parent = plane;\r\n // Position plane pointing normal to dragPlane normal\r\n dragPlane.material = material;\r\n return plane;\r\n };\r\n /** @hidden */\r\n PlaneDragGizmo._CreateArrowInstance = function (scene, arrow) {\r\n var instance = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_4__[\"TransformNode\"](\"arrow\", scene);\r\n for (var _i = 0, _a = arrow.getChildMeshes(); _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n var childInstance = mesh.createInstance(mesh.name);\r\n childInstance.parent = instance;\r\n }\r\n return instance;\r\n };\r\n PlaneDragGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(PlaneDragGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n PlaneDragGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n _super.prototype.dispose.call(this);\r\n if (this._plane) {\r\n this._plane.dispose();\r\n }\r\n [this._coloredMaterial, this._hoverMaterial].forEach(function (matl) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n });\r\n };\r\n return PlaneDragGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_7__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/planeRotationGizmo.ts\":\n/*!**************************************!*\\\n !*** ./Gizmos/planeRotationGizmo.ts ***!\n \\**************************************/\n/*! exports provided: PlaneRotationGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return PlaneRotationGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single plane rotation gizmo\r\n */\r\nvar PlaneRotationGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlaneRotationGizmo, _super);\r\n /**\r\n * Creates a PlaneRotationGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param planeNormal The normal of the plane which the gizmo will be able to rotate on\r\n * @param color The color of the gizmo\r\n * @param tessellation Amount of tessellation to be used when creating rotation circles\r\n * @param useEulerRotation Use and update Euler angle instead of quaternion\r\n */\r\n function PlaneRotationGizmo(planeNormal, color, gizmoLayer, tessellation, parent, useEulerRotation) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (tessellation === void 0) { tessellation = 32; }\r\n if (parent === void 0) { parent = null; }\r\n if (useEulerRotation === void 0) { useEulerRotation = false; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Rotation distance in radians that the gizmo will snap to (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._isEnabled = true;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n var coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n coloredMaterial.diffuseColor = color;\r\n coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.1, 0.1, 0.1));\r\n var hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build mesh on root node\r\n var parentMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n var drag = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateTorus(\"\", 0.6, 0.03, tessellation, gizmoLayer.utilityLayerScene);\r\n drag.visibility = 0;\r\n var rotationMesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateTorus(\"\", 0.6, 0.005, tessellation, gizmoLayer.utilityLayerScene);\r\n rotationMesh.material = coloredMaterial;\r\n // Position arrow pointing in its drag axis\r\n rotationMesh.rotation.x = Math.PI / 2;\r\n drag.rotation.x = Math.PI / 2;\r\n parentMesh.addChild(rotationMesh);\r\n parentMesh.addChild(drag);\r\n parentMesh.lookAt(_this._rootMesh.position.add(planeNormal));\r\n _this._rootMesh.addChild(parentMesh);\r\n parentMesh.scaling.scaleInPlace(1 / 3);\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__[\"PointerDragBehavior\"]({ dragPlaneNormal: planeNormal });\r\n _this.dragBehavior.moveAttached = false;\r\n _this.dragBehavior.maxDragAngle = Math.PI * 9 / 20;\r\n _this.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = true;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var lastDragPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n _this.dragBehavior.onDragStartObservable.add(function (e) {\r\n if (_this.attachedMesh) {\r\n lastDragPosition.copyFrom(e.dragPlanePoint);\r\n }\r\n });\r\n var rotationMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n var planeNormalTowardsCamera = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var localPlaneNormalTowardsCamera = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n var currentSnapDragDistance = 0;\r\n var tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var amountToRotate = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n if (!_this.attachedMesh.rotationQuaternion || useEulerRotation) {\r\n _this.attachedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRoll(_this.attachedMesh.rotation.y, _this.attachedMesh.rotation.x, _this.attachedMesh.rotation.z);\r\n }\r\n // Remove parent priort to rotating\r\n var attachedMeshParent = _this.attachedMesh.parent;\r\n if (attachedMeshParent) {\r\n _this.attachedMesh.setParent(null);\r\n }\r\n // Calc angle over full 360 degree (https://stackoverflow.com/questions/43493711/the-angle-between-two-3d-vectors-with-a-result-range-0-360)\r\n var newVector = event.dragPlanePoint.subtract(_this.attachedMesh.absolutePosition).normalize();\r\n var originalVector = lastDragPosition.subtract(_this.attachedMesh.absolutePosition).normalize();\r\n var cross = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(newVector, originalVector);\r\n var dot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Dot(newVector, originalVector);\r\n var angle = Math.atan2(cross.length(), dot);\r\n planeNormalTowardsCamera.copyFrom(planeNormal);\r\n localPlaneNormalTowardsCamera.copyFrom(planeNormal);\r\n if (_this.updateGizmoRotationToMatchAttachedMesh) {\r\n _this.attachedMesh.rotationQuaternion.toRotationMatrix(rotationMatrix);\r\n localPlaneNormalTowardsCamera = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(planeNormalTowardsCamera, rotationMatrix);\r\n }\r\n // Flip up vector depending on which side the camera is on\r\n if (gizmoLayer.utilityLayerScene.activeCamera) {\r\n var camVec = gizmoLayer.utilityLayerScene.activeCamera.position.subtract(_this.attachedMesh.position);\r\n if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Dot(camVec, localPlaneNormalTowardsCamera) > 0) {\r\n planeNormalTowardsCamera.scaleInPlace(-1);\r\n localPlaneNormalTowardsCamera.scaleInPlace(-1);\r\n }\r\n }\r\n var halfCircleSide = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Dot(localPlaneNormalTowardsCamera, cross) > 0.0;\r\n if (halfCircleSide) {\r\n angle = -angle;\r\n }\r\n // Snapping logic\r\n var snapped = false;\r\n if (_this.snapDistance != 0) {\r\n currentSnapDragDistance += angle;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n var dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n if (currentSnapDragDistance < 0) {\r\n dragSteps *= -1;\r\n }\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n angle = _this.snapDistance * dragSteps;\r\n snapped = true;\r\n }\r\n else {\r\n angle = 0;\r\n }\r\n }\r\n // If the mesh has a parent, convert needed world rotation to local rotation\r\n tmpMatrix.reset();\r\n if (_this.attachedMesh.parent) {\r\n _this.attachedMesh.parent.computeWorldMatrix().invertToRef(tmpMatrix);\r\n tmpMatrix.getRotationMatrixToRef(tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(planeNormalTowardsCamera, tmpMatrix, planeNormalTowardsCamera);\r\n }\r\n // Convert angle and axis to quaternion (http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm)\r\n var quaternionCoefficient = Math.sin(angle / 2);\r\n amountToRotate.set(planeNormalTowardsCamera.x * quaternionCoefficient, planeNormalTowardsCamera.y * quaternionCoefficient, planeNormalTowardsCamera.z * quaternionCoefficient, Math.cos(angle / 2));\r\n // If the meshes local scale is inverted (eg. loaded gltf file parent with z scale of -1) the rotation needs to be inverted on the y axis\r\n if (tmpMatrix.determinant() > 0) {\r\n amountToRotate.toEulerAnglesToRef(tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRollToRef(tmpVector.y, -tmpVector.x, -tmpVector.z, amountToRotate);\r\n }\r\n if (_this.updateGizmoRotationToMatchAttachedMesh) {\r\n // Rotate selected mesh quaternion over fixed axis\r\n _this.attachedMesh.rotationQuaternion.multiplyToRef(amountToRotate, _this.attachedMesh.rotationQuaternion);\r\n }\r\n else {\r\n // Rotate selected mesh quaternion over rotated axis\r\n amountToRotate.multiplyToRef(_this.attachedMesh.rotationQuaternion, _this.attachedMesh.rotationQuaternion);\r\n }\r\n if (useEulerRotation) {\r\n _this.attachedMesh.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n _this.attachedMesh.rotationQuaternion = null;\r\n _this.attachedMesh.rotation.copyFrom(tmpVector);\r\n }\r\n lastDragPosition.copyFrom(event.dragPlanePoint);\r\n if (snapped) {\r\n tmpSnapEvent.snapDistance = angle;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n // Restore parent\r\n if (attachedMeshParent) {\r\n _this.attachedMesh.setParent(attachedMeshParent);\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? hoverMaterial : coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n if (m.color) {\r\n m.color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes(false));\r\n return _this;\r\n }\r\n PlaneRotationGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(PlaneRotationGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n PlaneRotationGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n _super.prototype.dispose.call(this);\r\n };\r\n return PlaneRotationGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_7__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/positionGizmo.ts\":\n/*!*********************************!*\\\n !*** ./Gizmos/positionGizmo.ts ***!\n \\*********************************/\n/*! exports provided: PositionGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return PositionGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./axisDragGizmo */ \"./Gizmos/axisDragGizmo.ts\");\n/* harmony import */ var _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./planeDragGizmo */ \"./Gizmos/planeDragGizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables dragging a mesh along 3 axis\r\n */\r\nvar PositionGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PositionGizmo, _super);\r\n /**\r\n * Creates a PositionGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function PositionGizmo(gizmoLayer) {\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n /**\r\n * private variables\r\n */\r\n _this._meshAttached = null;\r\n /** Fires an event when any of it's sub gizmos are dragged */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** Fires an event when any of it's sub gizmos are released from dragging */\r\n _this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * If set to true, planar drag is enabled\r\n */\r\n _this._planarGizmoEnabled = false;\r\n _this.xGizmo = new _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__[\"AxisDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), gizmoLayer, _this);\r\n _this.yGizmo = new _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__[\"AxisDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), gizmoLayer, _this);\r\n _this.zGizmo = new _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__[\"AxisDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), gizmoLayer, _this);\r\n _this.xPlaneGizmo = new _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PlaneDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), _this.gizmoLayer, _this);\r\n _this.yPlaneGizmo = new _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PlaneDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), _this.gizmoLayer, _this);\r\n _this.zPlaneGizmo = new _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PlaneDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), _this.gizmoLayer, _this);\r\n // Relay drag events\r\n [_this.xGizmo, _this.yGizmo, _this.zGizmo, _this.xPlaneGizmo, _this.yPlaneGizmo, _this.zPlaneGizmo].forEach(function (gizmo) {\r\n gizmo.dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n });\r\n gizmo.dragBehavior.onDragEndObservable.add(function () {\r\n _this.onDragEndObservable.notifyObservers({});\r\n });\r\n });\r\n _this.attachedMesh = null;\r\n return _this;\r\n }\r\n Object.defineProperty(PositionGizmo.prototype, \"attachedMesh\", {\r\n get: function () {\r\n return this._meshAttached;\r\n },\r\n set: function (mesh) {\r\n this._meshAttached = mesh;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo.isEnabled) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n else {\r\n gizmo.attachedMesh = null;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"planarGizmoEnabled\", {\r\n get: function () {\r\n return this._planarGizmoEnabled;\r\n },\r\n /**\r\n * If the planar drag gizmo is enabled\r\n * setting this will enable/disable XY, XZ and YZ planes regardless of individual gizmo settings.\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n this._planarGizmoEnabled = value;\r\n [this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.isEnabled = value;\r\n if (value) {\r\n gizmo.attachedMesh = _this.attachedMesh;\r\n }\r\n }\r\n }, this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"updateGizmoRotationToMatchAttachedMesh\", {\r\n get: function () {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n },\r\n set: function (value) {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"snapDistance\", {\r\n get: function () {\r\n return this._snapDistance;\r\n },\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n set: function (value) {\r\n this._snapDistance = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.snapDistance = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"scaleRatio\", {\r\n get: function () {\r\n return this._scaleRatio;\r\n },\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n set: function (value) {\r\n this._scaleRatio = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.scaleRatio = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n PositionGizmo.prototype.dispose = function () {\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.dispose();\r\n }\r\n });\r\n this.onDragStartObservable.clear();\r\n this.onDragEndObservable.clear();\r\n };\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n PositionGizmo.prototype.setCustomMesh = function (mesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].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,gizmo.xPlaneGizmo, gizmo.yPlaneGizmo, gizmo.zPlaneGizmo)\");\r\n };\r\n return PositionGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_5__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/rotationGizmo.ts\":\n/*!*********************************!*\\\n !*** ./Gizmos/rotationGizmo.ts ***!\n \\*********************************/\n/*! exports provided: RotationGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return RotationGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./planeRotationGizmo */ \"./Gizmos/planeRotationGizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables rotating a mesh along 3 axis\r\n */\r\nvar RotationGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RotationGizmo, _super);\r\n /**\r\n * Creates a RotationGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param tessellation Amount of tessellation to be used when creating rotation circles\r\n * @param useEulerRotation Use and update Euler angle instead of quaternion\r\n */\r\n function RotationGizmo(gizmoLayer, tessellation, useEulerRotation) {\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (tessellation === void 0) { tessellation = 32; }\r\n if (useEulerRotation === void 0) { useEulerRotation = false; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n /** Fires an event when any of it's sub gizmos are dragged */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** Fires an event when any of it's sub gizmos are released from dragging */\r\n _this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this.xGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PlaneRotationGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);\r\n _this.yGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PlaneRotationGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);\r\n _this.zGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PlaneRotationGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);\r\n // Relay drag events\r\n [_this.xGizmo, _this.yGizmo, _this.zGizmo].forEach(function (gizmo) {\r\n gizmo.dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n });\r\n gizmo.dragBehavior.onDragEndObservable.add(function () {\r\n _this.onDragEndObservable.notifyObservers({});\r\n });\r\n });\r\n _this.attachedMesh = null;\r\n return _this;\r\n }\r\n Object.defineProperty(RotationGizmo.prototype, \"attachedMesh\", {\r\n get: function () {\r\n return this._meshAttached;\r\n },\r\n set: function (mesh) {\r\n this._meshAttached = mesh;\r\n [this.xGizmo, this.yGizmo, this.zGizmo].forEach(function (gizmo) {\r\n if (gizmo.isEnabled) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n else {\r\n gizmo.attachedMesh = null;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RotationGizmo.prototype, \"updateGizmoRotationToMatchAttachedMesh\", {\r\n get: function () {\r\n return this.xGizmo.updateGizmoRotationToMatchAttachedMesh;\r\n },\r\n set: function (value) {\r\n if (this.xGizmo) {\r\n this.xGizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n this.yGizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n this.zGizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RotationGizmo.prototype, \"snapDistance\", {\r\n get: function () {\r\n return this.xGizmo.snapDistance;\r\n },\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n set: function (value) {\r\n if (this.xGizmo) {\r\n this.xGizmo.snapDistance = value;\r\n this.yGizmo.snapDistance = value;\r\n this.zGizmo.snapDistance = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RotationGizmo.prototype, \"scaleRatio\", {\r\n get: function () {\r\n return this.xGizmo.scaleRatio;\r\n },\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n set: function (value) {\r\n if (this.xGizmo) {\r\n this.xGizmo.scaleRatio = value;\r\n this.yGizmo.scaleRatio = value;\r\n this.zGizmo.scaleRatio = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n RotationGizmo.prototype.dispose = function () {\r\n this.xGizmo.dispose();\r\n this.yGizmo.dispose();\r\n this.zGizmo.dispose();\r\n this.onDragStartObservable.clear();\r\n this.onDragEndObservable.clear();\r\n };\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n RotationGizmo.prototype.setCustomMesh = function (mesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].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)\");\r\n };\r\n return RotationGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_5__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/scaleGizmo.ts\":\n/*!******************************!*\\\n !*** ./Gizmos/scaleGizmo.ts ***!\n \\******************************/\n/*! exports provided: ScaleGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return ScaleGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/polyhedronBuilder */ \"./Meshes/Builders/polyhedronBuilder.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./axisScaleGizmo */ \"./Gizmos/axisScaleGizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables scaling a mesh along 3 axis\r\n */\r\nvar ScaleGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ScaleGizmo, _super);\r\n /**\r\n * Creates a ScaleGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function ScaleGizmo(gizmoLayer) {\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._meshAttached = null;\r\n /** Fires an event when any of it's sub gizmos are dragged */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** Fires an event when any of it's sub gizmos are released from dragging */\r\n _this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this.xGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), gizmoLayer, _this);\r\n _this.yGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), gizmoLayer, _this);\r\n _this.zGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), gizmoLayer, _this);\r\n // Create uniform scale gizmo\r\n _this.uniformScaleGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Yellow().scale(0.5), gizmoLayer, _this);\r\n _this.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh = false;\r\n _this.uniformScaleGizmo.uniformScaling = true;\r\n _this._uniformScalingMesh = _Meshes_Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_5__[\"PolyhedronBuilder\"].CreatePolyhedron(\"\", { type: 1 }, _this.uniformScaleGizmo.gizmoLayer.utilityLayerScene);\r\n _this._uniformScalingMesh.scaling.scaleInPlace(0.02);\r\n _this._uniformScalingMesh.visibility = 0;\r\n _this._octahedron = _Meshes_Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_5__[\"PolyhedronBuilder\"].CreatePolyhedron(\"\", { type: 1 }, _this.uniformScaleGizmo.gizmoLayer.utilityLayerScene);\r\n _this._octahedron.scaling.scaleInPlace(0.007);\r\n _this._uniformScalingMesh.addChild(_this._octahedron);\r\n _this.uniformScaleGizmo.setCustomMesh(_this._uniformScalingMesh, true);\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._octahedron);\r\n // Relay drag events\r\n [_this.xGizmo, _this.yGizmo, _this.zGizmo, _this.uniformScaleGizmo].forEach(function (gizmo) {\r\n gizmo.dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n });\r\n gizmo.dragBehavior.onDragEndObservable.add(function () {\r\n _this.onDragEndObservable.notifyObservers({});\r\n });\r\n });\r\n _this.attachedMesh = null;\r\n return _this;\r\n }\r\n Object.defineProperty(ScaleGizmo.prototype, \"attachedMesh\", {\r\n get: function () {\r\n return this._meshAttached;\r\n },\r\n set: function (mesh) {\r\n this._meshAttached = mesh;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo.isEnabled) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n else {\r\n gizmo.attachedMesh = null;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleGizmo.prototype, \"updateGizmoRotationToMatchAttachedMesh\", {\r\n get: function () {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n },\r\n set: function (value) {\r\n if (!value) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported.\");\r\n }\r\n else {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleGizmo.prototype, \"snapDistance\", {\r\n get: function () {\r\n return this._snapDistance;\r\n },\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n set: function (value) {\r\n this._snapDistance = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.snapDistance = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleGizmo.prototype, \"scaleRatio\", {\r\n get: function () {\r\n return this._scaleRatio;\r\n },\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n set: function (value) {\r\n this._scaleRatio = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.scaleRatio = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n ScaleGizmo.prototype.dispose = function () {\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.dispose();\r\n }\r\n });\r\n this.onDragStartObservable.clear();\r\n this.onDragEndObservable.clear();\r\n [this._uniformScalingMesh, this._octahedron].forEach(function (msh) {\r\n if (msh) {\r\n msh.dispose();\r\n }\r\n });\r\n };\r\n return ScaleGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_6__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/environmentHelper.ts\":\n/*!**************************************!*\\\n !*** ./Helpers/environmentHelper.ts ***!\n \\**************************************/\n/*! exports provided: EnvironmentHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return EnvironmentHelper; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_mirrorTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/Textures/mirrorTexture */ \"./Materials/Textures/mirrorTexture.ts\");\n/* harmony import */ var _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/Textures/cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Environment helper class can be used to add a fully featuread none expensive background to your scene.\r\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\r\n * It also helps with the default setup of your imageProcessing configuration.\r\n */\r\nvar EnvironmentHelper = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n function EnvironmentHelper(options, scene) {\r\n var _this = this;\r\n this._errorHandler = function (message, exception) {\r\n _this.onErrorObservable.notifyObservers({ message: message, exception: exception });\r\n };\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, EnvironmentHelper._getDefaultOptions(), options);\r\n this._scene = scene;\r\n this.onErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n /**\r\n * Creates the default options for the helper.\r\n */\r\n EnvironmentHelper._getDefaultOptions = function () {\r\n return {\r\n createGround: true,\r\n groundSize: 15,\r\n groundTexture: this._groundTextureCDNUrl,\r\n groundColor: new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.2, 0.2, 0.3).toLinearSpace().scale(3),\r\n groundOpacity: 0.9,\r\n enableGroundShadow: true,\r\n groundShadowLevel: 0.5,\r\n enableGroundMirror: false,\r\n groundMirrorSizeRatio: 0.3,\r\n groundMirrorBlurKernel: 64,\r\n groundMirrorAmount: 1,\r\n groundMirrorFresnelWeight: 1,\r\n groundMirrorFallOffDistance: 0,\r\n groundMirrorTextureType: _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT,\r\n groundYBias: 0.00001,\r\n createSkybox: true,\r\n skyboxSize: 20,\r\n skyboxTexture: this._skyboxTextureCDNUrl,\r\n skyboxColor: new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.2, 0.2, 0.3).toLinearSpace().scale(3),\r\n backgroundYRotation: 0,\r\n sizeAuto: true,\r\n rootPosition: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(),\r\n setupImageProcessing: true,\r\n environmentTexture: this._environmentTextureCDNUrl,\r\n cameraExposure: 0.8,\r\n cameraContrast: 1.2,\r\n toneMappingEnabled: true,\r\n };\r\n };\r\n Object.defineProperty(EnvironmentHelper.prototype, \"rootMesh\", {\r\n /**\r\n * Gets the root mesh created by the helper.\r\n */\r\n get: function () {\r\n return this._rootMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"skybox\", {\r\n /**\r\n * Gets the skybox created by the helper.\r\n */\r\n get: function () {\r\n return this._skybox;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"skyboxTexture\", {\r\n /**\r\n * Gets the skybox texture created by the helper.\r\n */\r\n get: function () {\r\n return this._skyboxTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"skyboxMaterial\", {\r\n /**\r\n * Gets the skybox material created by the helper.\r\n */\r\n get: function () {\r\n return this._skyboxMaterial;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"ground\", {\r\n /**\r\n * Gets the ground mesh created by the helper.\r\n */\r\n get: function () {\r\n return this._ground;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundTexture\", {\r\n /**\r\n * Gets the ground texture created by the helper.\r\n */\r\n get: function () {\r\n return this._groundTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundMirror\", {\r\n /**\r\n * Gets the ground mirror created by the helper.\r\n */\r\n get: function () {\r\n return this._groundMirror;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundMirrorRenderList\", {\r\n /**\r\n * Gets the ground mirror render list to helps pushing the meshes\r\n * you wish in the ground reflection.\r\n */\r\n get: function () {\r\n if (this._groundMirror) {\r\n return this._groundMirror.renderList;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundMaterial\", {\r\n /**\r\n * Gets the ground material created by the helper.\r\n */\r\n get: function () {\r\n return this._groundMaterial;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the background according to the new options\r\n * @param options\r\n */\r\n EnvironmentHelper.prototype.updateOptions = function (options) {\r\n var newOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, this._options, options);\r\n if (this._ground && !newOptions.createGround) {\r\n this._ground.dispose();\r\n this._ground = null;\r\n }\r\n if (this._groundMaterial && !newOptions.createGround) {\r\n this._groundMaterial.dispose();\r\n this._groundMaterial = null;\r\n }\r\n if (this._groundTexture) {\r\n if (this._options.groundTexture != newOptions.groundTexture) {\r\n this._groundTexture.dispose();\r\n this._groundTexture = null;\r\n }\r\n }\r\n if (this._skybox && !newOptions.createSkybox) {\r\n this._skybox.dispose();\r\n this._skybox = null;\r\n }\r\n if (this._skyboxMaterial && !newOptions.createSkybox) {\r\n this._skyboxMaterial.dispose();\r\n this._skyboxMaterial = null;\r\n }\r\n if (this._skyboxTexture) {\r\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\r\n this._skyboxTexture.dispose();\r\n this._skyboxTexture = null;\r\n }\r\n }\r\n if (this._groundMirror && !newOptions.enableGroundMirror) {\r\n this._groundMirror.dispose();\r\n this._groundMirror = null;\r\n }\r\n if (this._scene.environmentTexture) {\r\n if (this._options.environmentTexture != newOptions.environmentTexture) {\r\n this._scene.environmentTexture.dispose();\r\n }\r\n }\r\n this._options = newOptions;\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n };\r\n /**\r\n * Sets the primary color of all the available elements.\r\n * @param color the main color to affect to the ground and the background\r\n */\r\n EnvironmentHelper.prototype.setMainColor = function (color) {\r\n if (this.groundMaterial) {\r\n this.groundMaterial.primaryColor = color;\r\n }\r\n if (this.skyboxMaterial) {\r\n this.skyboxMaterial.primaryColor = color;\r\n }\r\n if (this.groundMirror) {\r\n this.groundMirror.clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](color.r, color.g, color.b, 1.0);\r\n }\r\n };\r\n /**\r\n * Setup the image processing according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupImageProcessing = function () {\r\n if (this._options.setupImageProcessing) {\r\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\r\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\r\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\r\n this._setupEnvironmentTexture();\r\n }\r\n };\r\n /**\r\n * Setup the environment texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupEnvironmentTexture = function () {\r\n if (this._scene.environmentTexture) {\r\n return;\r\n }\r\n if (this._options.environmentTexture instanceof _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__[\"BaseTexture\"]) {\r\n this._scene.environmentTexture = this._options.environmentTexture;\r\n return;\r\n }\r\n var environmentTexture = _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"].CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\r\n this._scene.environmentTexture = environmentTexture;\r\n };\r\n /**\r\n * Setup the background according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupBackground = function () {\r\n if (!this._rootMesh) {\r\n this._rootMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"](\"BackgroundHelper\", this._scene);\r\n }\r\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\r\n var sceneSize = this._getSceneSize();\r\n if (this._options.createGround) {\r\n this._setupGround(sceneSize);\r\n this._setupGroundMaterial();\r\n this._setupGroundDiffuseTexture();\r\n if (this._options.enableGroundMirror) {\r\n this._setupGroundMirrorTexture(sceneSize);\r\n }\r\n this._setupMirrorInGroundMaterial();\r\n }\r\n if (this._options.createSkybox) {\r\n this._setupSkybox(sceneSize);\r\n this._setupSkyboxMaterial();\r\n this._setupSkyboxReflectionTexture();\r\n }\r\n this._rootMesh.position.x = sceneSize.rootPosition.x;\r\n this._rootMesh.position.z = sceneSize.rootPosition.z;\r\n this._rootMesh.position.y = sceneSize.rootPosition.y;\r\n };\r\n /**\r\n * Get the scene sizes according to the setup.\r\n */\r\n EnvironmentHelper.prototype._getSceneSize = function () {\r\n var _this = this;\r\n var groundSize = this._options.groundSize;\r\n var skyboxSize = this._options.skyboxSize;\r\n var rootPosition = this._options.rootPosition;\r\n if (!this._scene.meshes || this._scene.meshes.length === 1) { // 1 only means the root of the helper.\r\n return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };\r\n }\r\n var sceneExtends = this._scene.getWorldExtends(function (mesh) {\r\n return (mesh !== _this._ground && mesh !== _this._rootMesh && mesh !== _this._skybox);\r\n });\r\n var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\r\n if (this._options.sizeAuto) {\r\n if (this._scene.activeCamera instanceof _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"] &&\r\n this._scene.activeCamera.upperRadiusLimit) {\r\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\r\n skyboxSize = groundSize;\r\n }\r\n var sceneDiagonalLenght = sceneDiagonal.length();\r\n if (sceneDiagonalLenght > groundSize) {\r\n groundSize = sceneDiagonalLenght * 2;\r\n skyboxSize = groundSize;\r\n }\r\n // 10 % bigger.\r\n groundSize *= 1.1;\r\n skyboxSize *= 1.5;\r\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\r\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\r\n }\r\n return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };\r\n };\r\n /**\r\n * Setup the ground according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGround = function (sceneSize) {\r\n var _this = this;\r\n if (!this._ground || this._ground.isDisposed()) {\r\n this._ground = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreatePlane(\"BackgroundPlane\", sceneSize.groundSize, this._scene);\r\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\r\n this._ground.parent = this._rootMesh;\r\n this._ground.onDisposeObservable.add(function () { _this._ground = null; });\r\n }\r\n this._ground.receiveShadows = this._options.enableGroundShadow;\r\n };\r\n /**\r\n * Setup the ground material according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGroundMaterial = function () {\r\n if (!this._groundMaterial) {\r\n this._groundMaterial = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_10__[\"BackgroundMaterial\"](\"BackgroundPlaneMaterial\", this._scene);\r\n }\r\n this._groundMaterial.alpha = this._options.groundOpacity;\r\n this._groundMaterial.alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\r\n this._groundMaterial.primaryColor = this._options.groundColor;\r\n this._groundMaterial.useRGBColor = false;\r\n this._groundMaterial.enableNoise = true;\r\n if (this._ground) {\r\n this._ground.material = this._groundMaterial;\r\n }\r\n };\r\n /**\r\n * Setup the ground diffuse texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGroundDiffuseTexture = function () {\r\n if (!this._groundMaterial) {\r\n return;\r\n }\r\n if (this._groundTexture) {\r\n return;\r\n }\r\n if (this._options.groundTexture instanceof _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__[\"BaseTexture\"]) {\r\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\r\n return;\r\n }\r\n var diffuseTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"](this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n diffuseTexture.gammaSpace = false;\r\n diffuseTexture.hasAlpha = true;\r\n this._groundMaterial.diffuseTexture = diffuseTexture;\r\n };\r\n /**\r\n * Setup the ground mirror texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGroundMirrorTexture = function (sceneSize) {\r\n var wrapping = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n if (!this._groundMirror) {\r\n this._groundMirror = new _Materials_Textures_mirrorTexture__WEBPACK_IMPORTED_MODULE_8__[\"MirrorTexture\"](\"BackgroundPlaneMirrorTexture\", { ratio: this._options.groundMirrorSizeRatio }, this._scene, false, this._options.groundMirrorTextureType, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, true);\r\n this._groundMirror.mirrorPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_14__[\"Plane\"](0, -1, 0, sceneSize.rootPosition.y);\r\n this._groundMirror.anisotropicFilteringLevel = 1;\r\n this._groundMirror.wrapU = wrapping;\r\n this._groundMirror.wrapV = wrapping;\r\n this._groundMirror.gammaSpace = false;\r\n if (this._groundMirror.renderList) {\r\n for (var i = 0; i < this._scene.meshes.length; i++) {\r\n var mesh = this._scene.meshes[i];\r\n if (mesh !== this._ground &&\r\n mesh !== this._skybox &&\r\n mesh !== this._rootMesh) {\r\n this._groundMirror.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n }\r\n this._groundMirror.clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](this._options.groundColor.r, this._options.groundColor.g, this._options.groundColor.b, 1);\r\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\r\n };\r\n /**\r\n * Setup the ground to receive the mirror texture.\r\n */\r\n EnvironmentHelper.prototype._setupMirrorInGroundMaterial = function () {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.reflectionTexture = this._groundMirror;\r\n this._groundMaterial.reflectionFresnel = true;\r\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\r\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\r\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\r\n }\r\n };\r\n /**\r\n * Setup the skybox according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupSkybox = function (sceneSize) {\r\n var _this = this;\r\n if (!this._skybox || this._skybox.isDisposed()) {\r\n this._skybox = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateBox(\"BackgroundSkybox\", sceneSize.skyboxSize, this._scene, undefined, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].BACKSIDE);\r\n this._skybox.onDisposeObservable.add(function () { _this._skybox = null; });\r\n }\r\n this._skybox.parent = this._rootMesh;\r\n };\r\n /**\r\n * Setup the skybox material according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupSkyboxMaterial = function () {\r\n if (!this._skybox) {\r\n return;\r\n }\r\n if (!this._skyboxMaterial) {\r\n this._skyboxMaterial = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_10__[\"BackgroundMaterial\"](\"BackgroundSkyboxMaterial\", this._scene);\r\n }\r\n this._skyboxMaterial.useRGBColor = false;\r\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\r\n this._skyboxMaterial.enableNoise = true;\r\n this._skybox.material = this._skyboxMaterial;\r\n };\r\n /**\r\n * Setup the skybox reflection texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupSkyboxReflectionTexture = function () {\r\n if (!this._skyboxMaterial) {\r\n return;\r\n }\r\n if (this._skyboxTexture) {\r\n return;\r\n }\r\n if (this._options.skyboxTexture instanceof _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__[\"BaseTexture\"]) {\r\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\r\n return;\r\n }\r\n this._skyboxTexture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"](this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._skyboxTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].SKYBOX_MODE;\r\n this._skyboxTexture.gammaSpace = false;\r\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\r\n };\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n EnvironmentHelper.prototype.dispose = function () {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.dispose(true, true);\r\n }\r\n if (this._skyboxMaterial) {\r\n this._skyboxMaterial.dispose(true, true);\r\n }\r\n this._rootMesh.dispose(false);\r\n };\r\n /**\r\n * Default ground texture URL.\r\n */\r\n EnvironmentHelper._groundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\r\n /**\r\n * Default skybox texture URL.\r\n */\r\n EnvironmentHelper._skyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\r\n /**\r\n * Default environment texture URL.\r\n */\r\n EnvironmentHelper._environmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\r\n return EnvironmentHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/index.ts\":\n/*!**************************!*\\\n !*** ./Helpers/index.ts ***!\n \\**************************/\n/*! exports provided: EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _environmentHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./environmentHelper */ \"./Helpers/environmentHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return _environmentHelper__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentHelper\"]; });\n\n/* harmony import */ var _photoDome__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./photoDome */ \"./Helpers/photoDome.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return _photoDome__WEBPACK_IMPORTED_MODULE_1__[\"PhotoDome\"]; });\n\n/* harmony import */ var _sceneHelpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sceneHelpers */ \"./Helpers/sceneHelpers.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _sceneHelpers__WEBPACK_IMPORTED_MODULE_2__[\"_forceSceneHelpersToBundle\"]; });\n\n/* harmony import */ var _videoDome__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./videoDome */ \"./Helpers/videoDome.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return _videoDome__WEBPACK_IMPORTED_MODULE_3__[\"VideoDome\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/photoDome.ts\":\n/*!******************************!*\\\n !*** ./Helpers/photoDome.ts ***!\n \\******************************/\n/*! exports provided: PhotoDome */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return PhotoDome; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Display a 360 degree photo on an approximately spherical surface, useful for VR applications or skyboxes.\r\n * As a subclass of TransformNode, this allow parenting to the camera with different locations in the scene.\r\n * This class achieves its effect with a Texture and a correctly configured BackgroundMaterial on an inverted sphere.\r\n * Potential additions to this helper include zoom and and non-infinite distance rendering effects.\r\n */\r\nvar PhotoDome = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PhotoDome, _super);\r\n /**\r\n * Create an instance of this class and pass through the parameters to the relevant classes, Texture, StandardMaterial, and Mesh.\r\n * @param name Element's name, child elements will append suffixes for their own names.\r\n * @param urlsOfPhoto defines the url of the photo to display\r\n * @param options defines an object containing optional or exposed sub element properties\r\n * @param onError defines a callback called when an error occured while loading the texture\r\n */\r\n function PhotoDome(name, urlOfPhoto, options, scene, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._useDirectMapping = false;\r\n /**\r\n * Observable raised when an error occured while loading the 360 image\r\n */\r\n _this.onLoadErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._imageMode = PhotoDome.MODE_MONOSCOPIC;\r\n _this._onBeforeCameraRenderObserver = null;\r\n // set defaults and manage values\r\n name = name || \"photoDome\";\r\n options.resolution = (Math.abs(options.resolution) | 0) || 32;\r\n options.size = Math.abs(options.size) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);\r\n if (options.useDirectMapping === undefined) {\r\n _this._useDirectMapping = true;\r\n }\r\n else {\r\n _this._useDirectMapping = options.useDirectMapping;\r\n }\r\n if (options.faceForward === undefined) {\r\n options.faceForward = true;\r\n }\r\n _this._setReady(false);\r\n // create\r\n var material = _this._material = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__[\"BackgroundMaterial\"](name + \"_material\", scene);\r\n _this._mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"].CreateSphere(name + \"_mesh\", options.resolution, options.size, scene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"].BACKSIDE);\r\n // configure material\r\n material.opacityFresnel = false;\r\n material.useEquirectangularFOV = true;\r\n material.fovMultiplier = 1.0;\r\n _this.photoTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"](urlOfPhoto, scene, true, !_this._useDirectMapping, undefined, undefined, function (message, exception) {\r\n _this.onLoadErrorObservable.notifyObservers(message || \"Unknown error occured\");\r\n if (onError) {\r\n onError(message, exception);\r\n }\r\n });\r\n _this.photoTexture.onLoadObservable.addOnce(function () {\r\n _this._setReady(true);\r\n });\r\n // configure mesh\r\n _this._mesh.material = material;\r\n _this._mesh.parent = _this;\r\n // Initial rotation\r\n if (options.faceForward && scene.activeCamera) {\r\n var camera = scene.activeCamera;\r\n var forward = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Forward();\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].TransformNormal(forward, camera.getViewMatrix());\r\n direction.normalize();\r\n _this.rotation.y = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Dot(forward, direction));\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(PhotoDome.prototype, \"photoTexture\", {\r\n /**\r\n * Gets or sets the texture being displayed on the sphere\r\n */\r\n get: function () {\r\n return this._photoTexture;\r\n },\r\n set: function (value) {\r\n if (this._photoTexture === value) {\r\n return;\r\n }\r\n this._photoTexture = value;\r\n if (this._useDirectMapping) {\r\n this._photoTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._photoTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._material.diffuseTexture = this._photoTexture;\r\n }\r\n else {\r\n this._photoTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation\r\n this._photoTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._material.reflectionTexture = this._photoTexture;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhotoDome.prototype, \"fovMultiplier\", {\r\n /**\r\n * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values \"zoom in\" and higher values \"zoom out\".\r\n * Also see the options.resolution property.\r\n */\r\n get: function () {\r\n return this._material.fovMultiplier;\r\n },\r\n set: function (value) {\r\n this._material.fovMultiplier = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhotoDome.prototype, \"imageMode\", {\r\n /**\r\n * Gets or set the current video mode for the video. It can be:\r\n * * PhotoDome.MODE_MONOSCOPIC : Define the image as a Monoscopic panoramic 360 image.\r\n * * PhotoDome.MODE_TOPBOTTOM : Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.\r\n * * PhotoDome.MODE_SIDEBYSIDE : Define the image as a Stereoscopic Side by Side panoramic 360 image.\r\n */\r\n get: function () {\r\n return this._imageMode;\r\n },\r\n set: function (value) {\r\n if (this._imageMode === value) {\r\n return;\r\n }\r\n this._changeImageMode(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n PhotoDome.prototype._changeImageMode = function (value) {\r\n var _this = this;\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._imageMode = value;\r\n // Default Setup and Reset.\r\n this._photoTexture.uScale = 1;\r\n this._photoTexture.vScale = 1;\r\n this._photoTexture.uOffset = 0;\r\n this._photoTexture.vOffset = 0;\r\n switch (value) {\r\n case PhotoDome.MODE_SIDEBYSIDE:\r\n this._photoTexture.uScale = 0.5;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._photoTexture.uOffset = camera.isRightCamera ? 0.5 : 0.0;\r\n });\r\n break;\r\n case PhotoDome.MODE_TOPBOTTOM:\r\n this._photoTexture.vScale = 0.5;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._photoTexture.vOffset = camera.isRightCamera ? 0.5 : 0.0;\r\n });\r\n break;\r\n }\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n PhotoDome.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this._photoTexture.dispose();\r\n this._mesh.dispose();\r\n this._material.dispose();\r\n this.onLoadErrorObservable.clear();\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Define the image as a Monoscopic panoramic 360 image.\r\n */\r\n PhotoDome.MODE_MONOSCOPIC = 0;\r\n /**\r\n * Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.\r\n */\r\n PhotoDome.MODE_TOPBOTTOM = 1;\r\n /**\r\n * Define the image as a Stereoscopic Side by Side panoramic 360 image.\r\n */\r\n PhotoDome.MODE_SIDEBYSIDE = 2;\r\n return PhotoDome;\r\n}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_2__[\"TransformNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/sceneHelpers.ts\":\n/*!*********************************!*\\\n !*** ./Helpers/sceneHelpers.ts ***!\n \\*********************************/\n/*! exports provided: _forceSceneHelpersToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _forceSceneHelpersToBundle; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/PBR/pbrMaterial */ \"./Materials/PBR/pbrMaterial.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _environmentHelper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./environmentHelper */ \"./Helpers/environmentHelper.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Cameras_VR_vrExperienceHelper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Cameras/VR/vrExperienceHelper */ \"./Cameras/VR/vrExperienceHelper.ts\");\n/* harmony import */ var _Materials_Textures_Loaders_ddsTextureLoader__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/Textures/Loaders/ddsTextureLoader */ \"./Materials/Textures/Loaders/ddsTextureLoader.ts\");\n/* harmony import */ var _Materials_Textures_Loaders_envTextureLoader__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Materials/Textures/Loaders/envTextureLoader */ \"./Materials/Textures/Loaders/envTextureLoader.ts\");\n/* harmony import */ var _Materials_Textures_Loaders_ktxTextureLoader__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Materials/Textures/Loaders/ktxTextureLoader */ \"./Materials/Textures/Loaders/ktxTextureLoader.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Cameras_XR_webXRDefaultExperience__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Cameras/XR/webXRDefaultExperience */ \"./Cameras/XR/webXRDefaultExperience.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _forceSceneHelpersToBundle = true;\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultLight = function (replace) {\r\n if (replace === void 0) { replace = false; }\r\n // Dispose existing light in replace mode.\r\n if (replace) {\r\n if (this.lights) {\r\n for (var i = 0; i < this.lights.length; i++) {\r\n this.lights[i].dispose();\r\n }\r\n }\r\n }\r\n // Light\r\n if (this.lights.length === 0) {\r\n new _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__[\"HemisphericLight\"](\"default light\", _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Up(), this);\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultCamera = function (createArcRotateCamera, replace, attachCameraControls) {\r\n if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }\r\n if (replace === void 0) { replace = false; }\r\n if (attachCameraControls === void 0) { attachCameraControls = false; }\r\n // Dispose existing camera in replace mode.\r\n if (replace) {\r\n if (this.activeCamera) {\r\n this.activeCamera.dispose();\r\n this.activeCamera = null;\r\n }\r\n }\r\n // Camera\r\n if (!this.activeCamera) {\r\n var worldExtends = this.getWorldExtends();\r\n var worldSize = worldExtends.max.subtract(worldExtends.min);\r\n var worldCenter = worldExtends.min.add(worldSize.scale(0.5));\r\n var camera;\r\n var radius = worldSize.length() * 1.5;\r\n // empty scene scenario!\r\n if (!isFinite(radius)) {\r\n radius = 1;\r\n worldCenter.copyFromFloats(0, 0, 0);\r\n }\r\n if (createArcRotateCamera) {\r\n var arcRotateCamera = new _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_10__[\"ArcRotateCamera\"](\"default camera\", -(Math.PI / 2), Math.PI / 2, radius, worldCenter, this);\r\n arcRotateCamera.lowerRadiusLimit = radius * 0.01;\r\n arcRotateCamera.wheelPrecision = 100 / radius;\r\n camera = arcRotateCamera;\r\n }\r\n else {\r\n var freeCamera = new _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_9__[\"FreeCamera\"](\"default camera\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](worldCenter.x, worldCenter.y, -radius), this);\r\n freeCamera.setTarget(worldCenter);\r\n camera = freeCamera;\r\n }\r\n camera.minZ = radius * 0.01;\r\n camera.maxZ = radius * 1000;\r\n camera.speed = radius * 0.2;\r\n this.activeCamera = camera;\r\n var canvas = this.getEngine().getRenderingCanvas();\r\n if (attachCameraControls && canvas) {\r\n camera.attachControl(canvas);\r\n }\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultCameraOrLight = function (createArcRotateCamera, replace, attachCameraControls) {\r\n if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }\r\n if (replace === void 0) { replace = false; }\r\n if (attachCameraControls === void 0) { attachCameraControls = false; }\r\n this.createDefaultLight(replace);\r\n this.createDefaultCamera(createArcRotateCamera, replace, attachCameraControls);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultSkybox = function (environmentTexture, pbr, scale, blur, setGlobalEnvTexture) {\r\n if (pbr === void 0) { pbr = false; }\r\n if (scale === void 0) { scale = 1000; }\r\n if (blur === void 0) { blur = 0; }\r\n if (setGlobalEnvTexture === void 0) { setGlobalEnvTexture = true; }\r\n if (!environmentTexture) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Can not create default skybox without environment texture.\");\r\n return null;\r\n }\r\n if (setGlobalEnvTexture) {\r\n if (environmentTexture) {\r\n this.environmentTexture = environmentTexture;\r\n }\r\n }\r\n // Skybox\r\n var hdrSkybox = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"].CreateBox(\"hdrSkyBox\", scale, this);\r\n if (pbr) {\r\n var hdrSkyboxMaterial = new _Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_6__[\"PBRMaterial\"](\"skyBox\", this);\r\n hdrSkyboxMaterial.backFaceCulling = false;\r\n hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();\r\n if (hdrSkyboxMaterial.reflectionTexture) {\r\n hdrSkyboxMaterial.reflectionTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].SKYBOX_MODE;\r\n }\r\n hdrSkyboxMaterial.microSurface = 1.0 - blur;\r\n hdrSkyboxMaterial.disableLighting = true;\r\n hdrSkyboxMaterial.twoSidedLighting = true;\r\n hdrSkybox.infiniteDistance = true;\r\n hdrSkybox.material = hdrSkyboxMaterial;\r\n }\r\n else {\r\n var skyboxMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__[\"StandardMaterial\"](\"skyBox\", this);\r\n skyboxMaterial.backFaceCulling = false;\r\n skyboxMaterial.reflectionTexture = environmentTexture.clone();\r\n if (skyboxMaterial.reflectionTexture) {\r\n skyboxMaterial.reflectionTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].SKYBOX_MODE;\r\n }\r\n skyboxMaterial.disableLighting = true;\r\n hdrSkybox.infiniteDistance = true;\r\n hdrSkybox.material = skyboxMaterial;\r\n }\r\n hdrSkybox.isPickable = false;\r\n return hdrSkybox;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultEnvironment = function (options) {\r\n if (_environmentHelper__WEBPACK_IMPORTED_MODULE_8__[\"EnvironmentHelper\"]) {\r\n return new _environmentHelper__WEBPACK_IMPORTED_MODULE_8__[\"EnvironmentHelper\"](options, this);\r\n }\r\n return null;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultVRExperience = function (webVROptions) {\r\n if (webVROptions === void 0) { webVROptions = {}; }\r\n return new _Cameras_VR_vrExperienceHelper__WEBPACK_IMPORTED_MODULE_11__[\"VRExperienceHelper\"](this, webVROptions);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultXRExperienceAsync = function (options) {\r\n return _Cameras_XR_webXRDefaultExperience__WEBPACK_IMPORTED_MODULE_16__[\"WebXRDefaultExperience\"].CreateAsync(this, options).then(function (helper) {\r\n return helper;\r\n });\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/videoDome.ts\":\n/*!******************************!*\\\n !*** ./Helpers/videoDome.ts ***!\n \\******************************/\n/*! exports provided: VideoDome */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return VideoDome; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/videoTexture */ \"./Materials/Textures/videoTexture.ts\");\n/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Maths/math */ \"./Maths/math.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Display a 360/180 degree video on an approximately spherical surface, useful for VR applications or skyboxes.\r\n * As a subclass of TransformNode, this allow parenting to the camera or multiple videos with different locations in the scene.\r\n * This class achieves its effect with a VideoTexture and a correctly configured BackgroundMaterial on an inverted sphere.\r\n * Potential additions to this helper include zoom and and non-infinite distance rendering effects.\r\n */\r\nvar VideoDome = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VideoDome, _super);\r\n /**\r\n * Create an instance of this class and pass through the parameters to the relevant classes, VideoTexture, StandardMaterial, and Mesh.\r\n * @param name Element's name, child elements will append suffixes for their own names.\r\n * @param urlsOrVideo defines the url(s) or the video element to use\r\n * @param options An object containing optional or exposed sub element properties\r\n */\r\n function VideoDome(name, urlsOrVideo, options, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._halfDome = false;\r\n _this._useDirectMapping = false;\r\n _this._videoMode = VideoDome.MODE_MONOSCOPIC;\r\n /**\r\n * Oberserver used in Stereoscopic VR Mode.\r\n */\r\n _this._onBeforeCameraRenderObserver = null;\r\n scene = _this.getScene();\r\n // set defaults and manage values\r\n name = name || \"videoDome\";\r\n options.resolution = (Math.abs(options.resolution) | 0) || 32;\r\n options.clickToPlay = Boolean(options.clickToPlay);\r\n options.autoPlay = options.autoPlay === undefined ? true : Boolean(options.autoPlay);\r\n options.loop = options.loop === undefined ? true : Boolean(options.loop);\r\n options.size = Math.abs(options.size) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);\r\n if (options.useDirectMapping === undefined) {\r\n _this._useDirectMapping = true;\r\n }\r\n else {\r\n _this._useDirectMapping = options.useDirectMapping;\r\n }\r\n if (options.faceForward === undefined) {\r\n options.faceForward = true;\r\n }\r\n _this._setReady(false);\r\n // create\r\n var tempOptions = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };\r\n var material = _this._material = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__[\"BackgroundMaterial\"](name + \"_material\", scene);\r\n var texture = _this._videoTexture = new _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_4__[\"VideoTexture\"](name + \"_texture\", urlsOrVideo, scene, false, _this._useDirectMapping, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE, tempOptions);\r\n _this._mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateSphere(name + \"_mesh\", options.resolution, options.size, scene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BACKSIDE);\r\n texture.onLoadObservable.addOnce(function () {\r\n _this._setReady(true);\r\n });\r\n // configure material\r\n material.useEquirectangularFOV = true;\r\n material.fovMultiplier = 1.0;\r\n material.opacityFresnel = false;\r\n if (_this._useDirectMapping) {\r\n texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n material.diffuseTexture = texture;\r\n }\r\n else {\r\n texture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n material.reflectionTexture = texture;\r\n }\r\n // configure mesh\r\n _this._mesh.material = material;\r\n _this._mesh.parent = _this;\r\n // create a (disabled until needed) mask to cover unneeded segments of 180 videos.\r\n _this._halfDomeMask = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__[\"SphereBuilder\"].CreateSphere(\"\", { slice: 0.5, diameter: options.size * 0.99, segments: options.resolution, sideOrientation: _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BACKSIDE }, scene);\r\n _this._halfDomeMask.rotate(_Maths_math__WEBPACK_IMPORTED_MODULE_8__[\"Axis\"].X, -Math.PI / 2);\r\n // set the parent, so it will always be positioned correctly AND will be disposed when the main sphere is disposed\r\n _this._halfDomeMask.parent = _this._mesh;\r\n _this._halfDome = !!options.halfDomeMode;\r\n // enable or disable according to the settings\r\n _this._halfDomeMask.setEnabled(_this._halfDome);\r\n // optional configuration\r\n if (options.clickToPlay) {\r\n scene.onPointerUp = function () {\r\n _this._videoTexture.video.play();\r\n };\r\n }\r\n // Initial rotation\r\n if (options.faceForward && scene.activeCamera) {\r\n var camera = scene.activeCamera;\r\n var forward = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Forward();\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].TransformNormal(forward, camera.getViewMatrix());\r\n direction.normalize();\r\n _this.rotation.y = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Dot(forward, direction));\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(VideoDome.prototype, \"videoTexture\", {\r\n /**\r\n * Gets the video texture being displayed on the sphere\r\n */\r\n get: function () {\r\n return this._videoTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VideoDome.prototype, \"fovMultiplier\", {\r\n /**\r\n * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values \"zoom in\" and higher values \"zoom out\".\r\n * Also see the options.resolution property.\r\n */\r\n get: function () {\r\n return this._material.fovMultiplier;\r\n },\r\n set: function (value) {\r\n this._material.fovMultiplier = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VideoDome.prototype, \"videoMode\", {\r\n /**\r\n * Gets or set the current video mode for the video. It can be:\r\n * * VideoDome.MODE_MONOSCOPIC : Define the video source as a Monoscopic panoramic 360 video.\r\n * * VideoDome.MODE_TOPBOTTOM : Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.\r\n * * VideoDome.MODE_SIDEBYSIDE : Define the video source as a Stereoscopic Side by Side panoramic 360 video.\r\n */\r\n get: function () {\r\n return this._videoMode;\r\n },\r\n set: function (value) {\r\n if (this._videoMode === value) {\r\n return;\r\n }\r\n this._changeVideoMode(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VideoDome.prototype, \"halfDome\", {\r\n /**\r\n * Is the video a 180 degrees video (half dome) or 360 video (full dome)\r\n *\r\n */\r\n get: function () {\r\n return this._halfDome;\r\n },\r\n /**\r\n * Set the halfDome mode. If set, only the front (180 degrees) will be displayed and the back will be blacked out.\r\n */\r\n set: function (enabled) {\r\n this._halfDome = enabled;\r\n this._halfDomeMask.setEnabled(enabled);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VideoDome.prototype._changeVideoMode = function (value) {\r\n var _this = this;\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._videoMode = value;\r\n // Default Setup and Reset.\r\n this._videoTexture.uScale = 1;\r\n this._videoTexture.vScale = 1;\r\n this._videoTexture.uOffset = 0;\r\n this._videoTexture.vOffset = 0;\r\n switch (value) {\r\n case VideoDome.MODE_SIDEBYSIDE:\r\n // in half-dome mode the uScale should be double of 360 videos\r\n // Use 0.99999 to boost perf by not switching program\r\n this._videoTexture.uScale = this._halfDome ? 0.99999 : 0.5;\r\n var rightOffset_1 = this._halfDome ? 0.0 : 0.5;\r\n var leftOffset_1 = this._halfDome ? 0.5 : 0.0;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._videoTexture.uOffset = camera.isRightCamera ? rightOffset_1 : leftOffset_1;\r\n });\r\n break;\r\n case VideoDome.MODE_TOPBOTTOM:\r\n // in half-dome mode the vScale should be double of 360 videos\r\n // Use 0.99999 to boost perf by not switching program\r\n this._videoTexture.vScale = this._halfDome ? 0.99999 : 0.5;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._videoTexture.vOffset = camera.isRightCamera ? 0.5 : 0.0;\r\n });\r\n break;\r\n }\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n VideoDome.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this._videoTexture.dispose();\r\n this._mesh.dispose();\r\n this._material.dispose();\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Define the video source as a Monoscopic panoramic 360 video.\r\n */\r\n VideoDome.MODE_MONOSCOPIC = 0;\r\n /**\r\n * Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.\r\n */\r\n VideoDome.MODE_TOPBOTTOM = 1;\r\n /**\r\n * Define the video source as a Stereoscopic Side by Side panoramic 360 video.\r\n */\r\n VideoDome.MODE_SIDEBYSIDE = 2;\r\n return VideoDome;\r\n}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__[\"TransformNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Inputs/scene.inputManager.ts\":\n/*!**************************************!*\\\n !*** ./Inputs/scene.inputManager.ts ***!\n \\**************************************/\n/*! exports provided: InputManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InputManager\", function() { return InputManager; });\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Actions/abstractActionManager */ \"./Actions/abstractActionManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Actions/actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _ClickInfo = /** @class */ (function () {\r\n function _ClickInfo() {\r\n this._singleClick = false;\r\n this._doubleClick = false;\r\n this._hasSwiped = false;\r\n this._ignore = false;\r\n }\r\n Object.defineProperty(_ClickInfo.prototype, \"singleClick\", {\r\n get: function () {\r\n return this._singleClick;\r\n },\r\n set: function (b) {\r\n this._singleClick = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"doubleClick\", {\r\n get: function () {\r\n return this._doubleClick;\r\n },\r\n set: function (b) {\r\n this._doubleClick = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"hasSwiped\", {\r\n get: function () {\r\n return this._hasSwiped;\r\n },\r\n set: function (b) {\r\n this._hasSwiped = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"ignore\", {\r\n get: function () {\r\n return this._ignore;\r\n },\r\n set: function (b) {\r\n this._ignore = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return _ClickInfo;\r\n}());\r\n/**\r\n * Class used to manage all inputs for the scene.\r\n */\r\nvar InputManager = /** @class */ (function () {\r\n /**\r\n * Creates a new InputManager\r\n * @param scene defines the hosting scene\r\n */\r\n function InputManager(scene) {\r\n // Pointers\r\n this._wheelEventName = \"\";\r\n this._meshPickProceed = false;\r\n this._currentPickResult = null;\r\n this._previousPickResult = null;\r\n this._totalPointersPressed = 0;\r\n this._doubleClickOccured = false;\r\n this._pointerX = 0;\r\n this._pointerY = 0;\r\n this._startingPointerPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 0);\r\n this._previousStartingPointerPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 0);\r\n this._startingPointerTime = 0;\r\n this._previousStartingPointerTime = 0;\r\n this._pointerCaptures = {};\r\n this._scene = scene;\r\n }\r\n Object.defineProperty(InputManager.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._pointerOverMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates in 2D without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerX;\r\n },\r\n set: function (value) {\r\n this._pointerX = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerY;\r\n },\r\n set: function (value) {\r\n this._pointerY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InputManager.prototype._updatePointerPosition = function (evt) {\r\n var canvasRect = this._scene.getEngine().getRenderingCanvasClientRect();\r\n if (!canvasRect) {\r\n return;\r\n }\r\n this._pointerX = evt.clientX - canvasRect.left;\r\n this._pointerY = evt.clientY - canvasRect.top;\r\n this._unTranslatedPointerX = this._pointerX;\r\n this._unTranslatedPointerY = this._pointerY;\r\n };\r\n InputManager.prototype._processPointerMove = function (pickResult, evt) {\r\n var scene = this._scene;\r\n var canvas = scene.getEngine().getRenderingCanvas();\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.tabIndex = 1;\r\n // Restore pointer\r\n canvas.style.cursor = scene.defaultCursor;\r\n var isMeshPicked = (pickResult && pickResult.hit && pickResult.pickedMesh) ? true : false;\r\n if (isMeshPicked) {\r\n scene.setPointerOverMesh(pickResult.pickedMesh);\r\n if (this._pointerOverMesh && this._pointerOverMesh.actionManager && this._pointerOverMesh.actionManager.hasPointerTriggers) {\r\n if (this._pointerOverMesh.actionManager.hoverCursor) {\r\n canvas.style.cursor = this._pointerOverMesh.actionManager.hoverCursor;\r\n }\r\n else {\r\n canvas.style.cursor = scene.hoverCursor;\r\n }\r\n }\r\n }\r\n else {\r\n scene.setPointerOverMesh(null);\r\n }\r\n for (var _i = 0, _a = scene._pointerMoveStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, isMeshPicked, canvas);\r\n }\r\n if (pickResult) {\r\n var type = evt.type === this._wheelEventName ? _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERWHEEL : _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERMOVE;\r\n if (scene.onPointerMove) {\r\n scene.onPointerMove(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n // Pointers handling\r\n InputManager.prototype._setRayOnPointerInfo = function (pointerInfo) {\r\n var scene = this._scene;\r\n if (pointerInfo.pickInfo && !pointerInfo.pickInfo._pickingUnavailable) {\r\n if (!pointerInfo.pickInfo.ray) {\r\n pointerInfo.pickInfo.ray = scene.createPickingRay(pointerInfo.event.offsetX, pointerInfo.event.offsetY, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity(), scene.activeCamera);\r\n }\r\n }\r\n };\r\n InputManager.prototype._checkPrePointerObservable = function (pickResult, evt, type) {\r\n var scene = this._scene;\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfoPre\"](type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n if (pickResult) {\r\n pi.ray = pickResult.ray;\r\n }\r\n scene.onPrePointerObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointermove\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERMOVE)) {\r\n return;\r\n }\r\n this._processPointerMove(pickResult, evt);\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointerdown\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN)) {\r\n return;\r\n }\r\n this._processPointerDown(pickResult, evt);\r\n };\r\n InputManager.prototype._processPointerDown = function (pickResult, evt) {\r\n var _this = this;\r\n var scene = this._scene;\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh) {\r\n this._pickedDownMesh = pickResult.pickedMesh;\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager) {\r\n if (actionManager.hasPickTriggers) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickDownTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n switch (evt.button) {\r\n case 0:\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLeftPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 1:\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnCenterPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 2:\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnRightPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n }\r\n }\r\n if (actionManager.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLongPressTrigger)) {\r\n window.setTimeout(function () {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, function (mesh) { return (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLongPressTrigger) && mesh == _this._pickedDownMesh); }, false, scene.cameraToUseForPointers);\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && actionManager) {\r\n if (_this._totalPointersPressed !== 0 &&\r\n ((Date.now() - _this._startingPointerTime) > InputManager.LongPressDelay) &&\r\n !_this._isPointerSwiping()) {\r\n _this._startingPointerTime = 0;\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLongPressTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }, InputManager.LongPressDelay);\r\n }\r\n }\r\n }\r\n else {\r\n for (var _i = 0, _a = scene._pointerDownStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n if (pickResult) {\r\n var type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN;\r\n if (scene.onPointerDown) {\r\n scene.onPointerDown(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputManager.prototype._isPointerSwiping = function () {\r\n return Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold ||\r\n Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n */\r\n InputManager.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n var evt = new PointerEvent(\"pointerup\", pointerEventInit);\r\n var clickInfo = new _ClickInfo();\r\n if (doubleTap) {\r\n clickInfo.doubleClick = true;\r\n }\r\n else {\r\n clickInfo.singleClick = true;\r\n }\r\n if (this._checkPrePointerObservable(pickResult, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP)) {\r\n return;\r\n }\r\n this._processPointerUp(pickResult, evt, clickInfo);\r\n };\r\n InputManager.prototype._processPointerUp = function (pickResult, evt, clickInfo) {\r\n var scene = this._scene;\r\n if (pickResult && pickResult && pickResult.pickedMesh) {\r\n this._pickedUpMesh = pickResult.pickedMesh;\r\n if (this._pickedDownMesh === this._pickedUpMesh) {\r\n if (scene.onPointerPick) {\r\n scene.onPointerPick(evt, pickResult);\r\n }\r\n if (clickInfo.singleClick && !clickInfo.ignore && scene.onPointerObservable.hasObservers()) {\r\n var type_1 = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERPICK;\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type_1, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type_1);\r\n }\r\n }\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager && !clickInfo.ignore) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickUpTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n if (!clickInfo.hasSwiped && clickInfo.singleClick) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n var doubleClickActionManager = pickResult.pickedMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger);\r\n if (clickInfo.doubleClick && doubleClickActionManager) {\r\n doubleClickActionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }\r\n else {\r\n if (!clickInfo.ignore) {\r\n for (var _i = 0, _a = scene._pointerUpStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n }\r\n if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) {\r\n var pickedDownActionManager = this._pickedDownMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickOutTrigger);\r\n if (pickedDownActionManager) {\r\n pickedDownActionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(this._pickedDownMesh, evt));\r\n }\r\n }\r\n var type = 0;\r\n if (scene.onPointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore && !clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)) {\r\n type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP;\r\n }\r\n else if (clickInfo.doubleClick && scene.onPointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP)) {\r\n type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP;\r\n }\r\n if (type) {\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (!clickInfo.ignore) {\r\n type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP;\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (scene.onPointerUp && !clickInfo.ignore) {\r\n scene.onPointerUp(evt, pickResult, type);\r\n }\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n InputManager.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._pointerCaptures[pointerId];\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n */\r\n InputManager.prototype.attachControl = function (attachUp, attachDown, attachMove) {\r\n var _this = this;\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n var scene = this._scene;\r\n var canvas = scene.getEngine().getRenderingCanvas();\r\n if (!canvas) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n this._initActionManager = function (act, clickInfo) {\r\n if (!_this._meshPickProceed) {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._currentPickResult = pickResult;\r\n if (pickResult) {\r\n act = (pickResult.hit && pickResult.pickedMesh) ? pickResult.pickedMesh._getActionManagerForTrigger() : null;\r\n }\r\n _this._meshPickProceed = true;\r\n }\r\n return act;\r\n };\r\n this._delayedSimpleClick = function (btn, clickInfo, cb) {\r\n // double click delay is over and that no double click has been raised since, or the 2 consecutive keys pressed are different\r\n if ((Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay && !_this._doubleClickOccured) ||\r\n btn !== _this._previousButtonPressed) {\r\n _this._doubleClickOccured = false;\r\n clickInfo.singleClick = true;\r\n clickInfo.ignore = false;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._initClickEvent = function (obs1, obs2, evt, cb) {\r\n var clickInfo = new _ClickInfo();\r\n _this._currentPickResult = null;\r\n var act = null;\r\n var checkPicking = obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERPICK) || obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERPICK)\r\n || obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP) || obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)\r\n || obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP) || obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP);\r\n if (!checkPicking && _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"]) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkPicking = act.hasPickTriggers;\r\n }\r\n }\r\n var needToIgnoreNext = false;\r\n if (checkPicking) {\r\n var btn = evt.button;\r\n clickInfo.hasSwiped = _this._isPointerSwiping();\r\n if (!clickInfo.hasSwiped) {\r\n var checkSingleClickImmediately = !InputManager.ExclusiveDoubleClickMode;\r\n if (!checkSingleClickImmediately) {\r\n checkSingleClickImmediately = !obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP) &&\r\n !obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP);\r\n if (checkSingleClickImmediately && !_Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"].HasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkSingleClickImmediately = !act.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger);\r\n }\r\n }\r\n }\r\n if (checkSingleClickImmediately) {\r\n // single click detected if double click delay is over or two different successive keys pressed without exclusive double click or no double click required\r\n if (Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay ||\r\n btn !== _this._previousButtonPressed) {\r\n clickInfo.singleClick = true;\r\n cb(clickInfo, _this._currentPickResult);\r\n needToIgnoreNext = true;\r\n }\r\n }\r\n // at least one double click is required to be check and exclusive double click is enabled\r\n else {\r\n // wait that no double click has been raised during the double click delay\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n _this._delayedSimpleClickTimeout = window.setTimeout(_this._delayedSimpleClick.bind(_this, btn, clickInfo, cb), InputManager.DoubleClickDelay);\r\n }\r\n var checkDoubleClick = obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP) ||\r\n obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP);\r\n if (!checkDoubleClick && _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"].HasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkDoubleClick = act.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger);\r\n }\r\n }\r\n if (checkDoubleClick) {\r\n // two successive keys pressed are equal, double click delay is not over and double click has not just occurred\r\n if (btn === _this._previousButtonPressed &&\r\n Date.now() - _this._previousStartingPointerTime < InputManager.DoubleClickDelay &&\r\n !_this._doubleClickOccured) {\r\n // pointer has not moved for 2 clicks, it's a double click\r\n if (!clickInfo.hasSwiped &&\r\n !_this._isPointerSwiping()) {\r\n _this._previousStartingPointerTime = 0;\r\n _this._doubleClickOccured = true;\r\n clickInfo.doubleClick = true;\r\n clickInfo.ignore = false;\r\n if (InputManager.ExclusiveDoubleClickMode && _this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n // if the two successive clicks are too far, it's just two simple clicks\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n if (InputManager.ExclusiveDoubleClickMode) {\r\n if (_this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._previousPickResult);\r\n }\r\n else {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n }\r\n needToIgnoreNext = true;\r\n }\r\n // just the first click of the double has been raised\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n }\r\n }\r\n }\r\n }\r\n if (!needToIgnoreNext) {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._onPointerMove = function (evt) {\r\n _this._updatePointerPosition(evt);\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, evt.type === _this._wheelEventName ? _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERWHEEL : _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERMOVE)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerMovePredicate) {\r\n scene.pointerMovePredicate = function (mesh) { return (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (mesh.enablePointerMoveEvents || scene.constantlyUpdateMeshUnderPointer || (mesh._getActionManagerForTrigger() != null)) && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0)); };\r\n }\r\n // Meshes\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerMovePredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerMove(pickResult, evt);\r\n };\r\n this._onPointerDown = function (evt) {\r\n _this._totalPointersPressed++;\r\n _this._pickedDownMesh = null;\r\n _this._meshPickProceed = false;\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerDown && canvas) {\r\n evt.preventDefault();\r\n canvas.focus();\r\n }\r\n _this._startingPointerPosition.x = _this._pointerX;\r\n _this._startingPointerPosition.y = _this._pointerY;\r\n _this._startingPointerTime = Date.now();\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = true;\r\n if (!scene.pointerDownPredicate) {\r\n scene.pointerDownPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n _this._pickedDownMesh = null;\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerDown(pickResult, evt);\r\n };\r\n this._onPointerUp = function (evt) {\r\n if (_this._totalPointersPressed === 0) { // We are attaching the pointer up to windows because of a bug in FF\r\n return; // So we need to test it the pointer down was pressed before.\r\n }\r\n _this._totalPointersPressed--;\r\n _this._pickedUpMesh = null;\r\n _this._meshPickProceed = false;\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerUp && canvas) {\r\n evt.preventDefault();\r\n canvas.focus();\r\n }\r\n _this._initClickEvent(scene.onPrePointerObservable, scene.onPointerObservable, evt, function (clickInfo, pickResult) {\r\n // PreObservable support\r\n if (scene.onPrePointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore) {\r\n if (!clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPrePointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)) {\r\n return;\r\n }\r\n }\r\n if (clickInfo.doubleClick && scene.onPrePointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (!_this._pointerCaptures[evt.pointerId]) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = false;\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerUpPredicate) {\r\n scene.pointerUpPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n if (!_this._meshPickProceed && (_Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"] && _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"].HasTriggers || scene.onPointerObservable.hasObservers())) {\r\n _this._initActionManager(null, clickInfo);\r\n }\r\n if (!pickResult) {\r\n pickResult = _this._currentPickResult;\r\n }\r\n _this._processPointerUp(pickResult, evt, clickInfo);\r\n _this._previousPickResult = _this._currentPickResult;\r\n });\r\n };\r\n this._onKeyDown = function (evt) {\r\n var type = _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardEventTypes\"].KEYDOWN;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfoPre\"](type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfo\"](type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnKeyDownTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n this._onKeyUp = function (evt) {\r\n var type = _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardEventTypes\"].KEYUP;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfoPre\"](type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfo\"](type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnKeyUpTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n // Keyboard events\r\n this._onCanvasFocusObserver = engine.onCanvasFocusObservable.add((function () {\r\n var fn = function () {\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.addEventListener(\"keydown\", _this._onKeyDown, false);\r\n canvas.addEventListener(\"keyup\", _this._onKeyUp, false);\r\n };\r\n if (document.activeElement === canvas) {\r\n fn();\r\n }\r\n return fn;\r\n })());\r\n this._onCanvasBlurObserver = engine.onCanvasBlurObservable.add(function () {\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.removeEventListener(\"keydown\", _this._onKeyDown);\r\n canvas.removeEventListener(\"keyup\", _this._onKeyUp);\r\n });\r\n // Pointer events\r\n var eventPrefix = _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].GetPointerPrefix();\r\n if (attachMove) {\r\n canvas.addEventListener(eventPrefix + \"move\", this._onPointerMove, false);\r\n // Wheel\r\n this._wheelEventName = \"onwheel\" in document.createElement(\"div\") ? \"wheel\" : // Modern browsers support \"wheel\"\r\n document.onmousewheel !== undefined ? \"mousewheel\" : // Webkit and IE support at least \"mousewheel\"\r\n \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n canvas.addEventListener(this._wheelEventName, this._onPointerMove, false);\r\n }\r\n if (attachDown) {\r\n canvas.addEventListener(eventPrefix + \"down\", this._onPointerDown, false);\r\n }\r\n if (attachUp) {\r\n var hostWindow = scene.getEngine().getHostWindow();\r\n hostWindow.addEventListener(eventPrefix + \"up\", this._onPointerUp, false);\r\n }\r\n };\r\n /**\r\n * Detaches all event handlers\r\n */\r\n InputManager.prototype.detachControl = function () {\r\n var eventPrefix = _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].GetPointerPrefix();\r\n var canvas = this._scene.getEngine().getRenderingCanvas();\r\n var engine = this._scene.getEngine();\r\n if (!canvas) {\r\n return;\r\n }\r\n // Pointer\r\n canvas.removeEventListener(eventPrefix + \"move\", this._onPointerMove);\r\n canvas.removeEventListener(this._wheelEventName, this._onPointerMove);\r\n canvas.removeEventListener(eventPrefix + \"down\", this._onPointerDown);\r\n window.removeEventListener(eventPrefix + \"up\", this._onPointerUp);\r\n // Blur / Focus\r\n if (this._onCanvasBlurObserver) {\r\n engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n if (this._onCanvasFocusObserver) {\r\n engine.onCanvasFocusObservable.remove(this._onCanvasFocusObserver);\r\n }\r\n // Keyboard\r\n canvas.removeEventListener(\"keydown\", this._onKeyDown);\r\n canvas.removeEventListener(\"keyup\", this._onKeyUp);\r\n // Cursor\r\n canvas.style.cursor = this._scene.defaultCursor;\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n */\r\n InputManager.prototype.setPointerOverMesh = function (mesh) {\r\n if (this._pointerOverMesh === mesh) {\r\n return;\r\n }\r\n var actionManager;\r\n if (this._pointerOverMesh) {\r\n actionManager = this._pointerOverMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOutTrigger);\r\n if (actionManager) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(this._pointerOverMesh));\r\n }\r\n }\r\n this._pointerOverMesh = mesh;\r\n if (this._pointerOverMesh) {\r\n actionManager = this._pointerOverMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOverTrigger);\r\n if (actionManager) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOverTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(this._pointerOverMesh));\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n InputManager.prototype.getPointerOverMesh = function () {\r\n return this._pointerOverMesh;\r\n };\r\n /** The distance in pixel that you have to move to prevent some events */\r\n InputManager.DragMovementThreshold = 10; // in pixels\r\n /** Time in milliseconds to wait to raise long press events if button is still pressed */\r\n InputManager.LongPressDelay = 500; // in milliseconds\r\n /** Time in milliseconds with two consecutive clicks will be considered as a double click */\r\n InputManager.DoubleClickDelay = 300; // in milliseconds\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n InputManager.ExclusiveDoubleClickMode = false;\r\n return InputManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/engineInstrumentation.ts\":\n/*!**************************************************!*\\\n !*** ./Instrumentation/engineInstrumentation.ts ***!\n \\**************************************************/\n/*! exports provided: EngineInstrumentation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return EngineInstrumentation; });\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n\r\n/**\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n */\r\nvar EngineInstrumentation = /** @class */ (function () {\r\n /**\r\n * Instantiates a new engine instrumentation.\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n * @param engine Defines the engine to instrument\r\n */\r\n function EngineInstrumentation(\r\n /**\r\n * Define the instrumented engine.\r\n */\r\n engine) {\r\n this.engine = engine;\r\n this._captureGPUFrameTime = false;\r\n this._gpuFrameTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_0__[\"PerfCounter\"]();\r\n this._captureShaderCompilationTime = false;\r\n this._shaderCompilationTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_0__[\"PerfCounter\"]();\r\n // Observers\r\n this._onBeginFrameObserver = null;\r\n this._onEndFrameObserver = null;\r\n this._onBeforeShaderCompilationObserver = null;\r\n this._onAfterShaderCompilationObserver = null;\r\n }\r\n Object.defineProperty(EngineInstrumentation.prototype, \"gpuFrameTimeCounter\", {\r\n // Properties\r\n /**\r\n * Gets the perf counter used for GPU frame time\r\n */\r\n get: function () {\r\n return this._gpuFrameTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineInstrumentation.prototype, \"captureGPUFrameTime\", {\r\n /**\r\n * Gets the GPU frame time capture status\r\n */\r\n get: function () {\r\n return this._captureGPUFrameTime;\r\n },\r\n /**\r\n * Enable or disable the GPU frame time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureGPUFrameTime) {\r\n return;\r\n }\r\n this._captureGPUFrameTime = value;\r\n if (value) {\r\n this._onBeginFrameObserver = this.engine.onBeginFrameObservable.add(function () {\r\n if (!_this._gpuFrameTimeToken) {\r\n _this._gpuFrameTimeToken = _this.engine.startTimeQuery();\r\n }\r\n });\r\n this._onEndFrameObserver = this.engine.onEndFrameObservable.add(function () {\r\n if (!_this._gpuFrameTimeToken) {\r\n return;\r\n }\r\n var time = _this.engine.endTimeQuery(_this._gpuFrameTimeToken);\r\n if (time > -1) {\r\n _this._gpuFrameTimeToken = null;\r\n _this._gpuFrameTime.fetchNewFrame();\r\n _this._gpuFrameTime.addCount(time, true);\r\n }\r\n });\r\n }\r\n else {\r\n this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.engine.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineInstrumentation.prototype, \"shaderCompilationTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for shader compilation time\r\n */\r\n get: function () {\r\n return this._shaderCompilationTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineInstrumentation.prototype, \"captureShaderCompilationTime\", {\r\n /**\r\n * Gets the shader compilation time capture status\r\n */\r\n get: function () {\r\n return this._captureShaderCompilationTime;\r\n },\r\n /**\r\n * Enable or disable the shader compilation time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureShaderCompilationTime) {\r\n return;\r\n }\r\n this._captureShaderCompilationTime = value;\r\n if (value) {\r\n this._onBeforeShaderCompilationObserver = this.engine.onBeforeShaderCompilationObservable.add(function () {\r\n _this._shaderCompilationTime.fetchNewFrame();\r\n _this._shaderCompilationTime.beginMonitoring();\r\n });\r\n this._onAfterShaderCompilationObserver = this.engine.onAfterShaderCompilationObservable.add(function () {\r\n _this._shaderCompilationTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\r\n this._onBeforeShaderCompilationObserver = null;\r\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\r\n this._onAfterShaderCompilationObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose and release associated resources.\r\n */\r\n EngineInstrumentation.prototype.dispose = function () {\r\n this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.engine.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\r\n this._onBeforeShaderCompilationObserver = null;\r\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\r\n this._onAfterShaderCompilationObserver = null;\r\n this.engine = null;\r\n };\r\n return EngineInstrumentation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/index.ts\":\n/*!**********************************!*\\\n !*** ./Instrumentation/index.ts ***!\n \\**********************************/\n/*! exports provided: EngineInstrumentation, SceneInstrumentation, _TimeToken */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _engineInstrumentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engineInstrumentation */ \"./Instrumentation/engineInstrumentation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return _engineInstrumentation__WEBPACK_IMPORTED_MODULE_0__[\"EngineInstrumentation\"]; });\n\n/* harmony import */ var _sceneInstrumentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sceneInstrumentation */ \"./Instrumentation/sceneInstrumentation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return _sceneInstrumentation__WEBPACK_IMPORTED_MODULE_1__[\"SceneInstrumentation\"]; });\n\n/* harmony import */ var _timeToken__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./timeToken */ \"./Instrumentation/timeToken.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _timeToken__WEBPACK_IMPORTED_MODULE_2__[\"_TimeToken\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/sceneInstrumentation.ts\":\n/*!*************************************************!*\\\n !*** ./Instrumentation/sceneInstrumentation.ts ***!\n \\*************************************************/\n/*! exports provided: SceneInstrumentation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return SceneInstrumentation; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n\r\n\r\n/**\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#sceneinstrumentation\r\n */\r\nvar SceneInstrumentation = /** @class */ (function () {\r\n /**\r\n * Instantiates a new scene instrumentation.\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#sceneinstrumentation\r\n * @param scene Defines the scene to instrument\r\n */\r\n function SceneInstrumentation(\r\n /**\r\n * Defines the scene to instrument\r\n */\r\n scene) {\r\n var _this = this;\r\n this.scene = scene;\r\n this._captureActiveMeshesEvaluationTime = false;\r\n this._activeMeshesEvaluationTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureRenderTargetsRenderTime = false;\r\n this._renderTargetsRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureFrameTime = false;\r\n this._frameTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureRenderTime = false;\r\n this._renderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureInterFrameTime = false;\r\n this._interFrameTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureParticlesRenderTime = false;\r\n this._particlesRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureSpritesRenderTime = false;\r\n this._spritesRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._capturePhysicsTime = false;\r\n this._physicsTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureAnimationsTime = false;\r\n this._animationsTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureCameraRenderTime = false;\r\n this._cameraRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n // Observers\r\n this._onBeforeActiveMeshesEvaluationObserver = null;\r\n this._onAfterActiveMeshesEvaluationObserver = null;\r\n this._onBeforeRenderTargetsRenderObserver = null;\r\n this._onAfterRenderTargetsRenderObserver = null;\r\n this._onAfterRenderObserver = null;\r\n this._onBeforeDrawPhaseObserver = null;\r\n this._onAfterDrawPhaseObserver = null;\r\n this._onBeforeAnimationsObserver = null;\r\n this._onBeforeParticlesRenderingObserver = null;\r\n this._onAfterParticlesRenderingObserver = null;\r\n this._onBeforeSpritesRenderingObserver = null;\r\n this._onAfterSpritesRenderingObserver = null;\r\n this._onBeforePhysicsObserver = null;\r\n this._onAfterPhysicsObserver = null;\r\n this._onAfterAnimationsObserver = null;\r\n this._onBeforeCameraRenderObserver = null;\r\n this._onAfterCameraRenderObserver = null;\r\n // Before render\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {\r\n if (_this._captureActiveMeshesEvaluationTime) {\r\n _this._activeMeshesEvaluationTime.fetchNewFrame();\r\n }\r\n if (_this._captureRenderTargetsRenderTime) {\r\n _this._renderTargetsRenderTime.fetchNewFrame();\r\n }\r\n if (_this._captureFrameTime) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Scene rendering\");\r\n _this._frameTime.beginMonitoring();\r\n }\r\n if (_this._captureInterFrameTime) {\r\n _this._interFrameTime.endMonitoring();\r\n }\r\n if (_this._captureParticlesRenderTime) {\r\n _this._particlesRenderTime.fetchNewFrame();\r\n }\r\n if (_this._captureSpritesRenderTime) {\r\n _this._spritesRenderTime.fetchNewFrame();\r\n }\r\n if (_this._captureAnimationsTime) {\r\n _this._animationsTime.beginMonitoring();\r\n }\r\n _this.scene.getEngine()._drawCalls.fetchNewFrame();\r\n });\r\n // After render\r\n this._onAfterRenderObserver = scene.onAfterRenderObservable.add(function () {\r\n if (_this._captureFrameTime) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Scene rendering\");\r\n _this._frameTime.endMonitoring();\r\n }\r\n if (_this._captureRenderTime) {\r\n _this._renderTime.endMonitoring(false);\r\n }\r\n if (_this._captureInterFrameTime) {\r\n _this._interFrameTime.beginMonitoring();\r\n }\r\n });\r\n }\r\n Object.defineProperty(SceneInstrumentation.prototype, \"activeMeshesEvaluationTimeCounter\", {\r\n // Properties\r\n /**\r\n * Gets the perf counter used for active meshes evaluation time\r\n */\r\n get: function () {\r\n return this._activeMeshesEvaluationTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureActiveMeshesEvaluationTime\", {\r\n /**\r\n * Gets the active meshes evaluation time capture status\r\n */\r\n get: function () {\r\n return this._captureActiveMeshesEvaluationTime;\r\n },\r\n /**\r\n * Enable or disable the active meshes evaluation time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureActiveMeshesEvaluationTime) {\r\n return;\r\n }\r\n this._captureActiveMeshesEvaluationTime = value;\r\n if (value) {\r\n this._onBeforeActiveMeshesEvaluationObserver = this.scene.onBeforeActiveMeshesEvaluationObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Active meshes evaluation\");\r\n _this._activeMeshesEvaluationTime.beginMonitoring();\r\n });\r\n this._onAfterActiveMeshesEvaluationObserver = this.scene.onAfterActiveMeshesEvaluationObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Active meshes evaluation\");\r\n _this._activeMeshesEvaluationTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver);\r\n this._onBeforeActiveMeshesEvaluationObserver = null;\r\n this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver);\r\n this._onAfterActiveMeshesEvaluationObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"renderTargetsRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for render targets render time\r\n */\r\n get: function () {\r\n return this._renderTargetsRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureRenderTargetsRenderTime\", {\r\n /**\r\n * Gets the render targets render time capture status\r\n */\r\n get: function () {\r\n return this._captureRenderTargetsRenderTime;\r\n },\r\n /**\r\n * Enable or disable the render targets render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureRenderTargetsRenderTime) {\r\n return;\r\n }\r\n this._captureRenderTargetsRenderTime = value;\r\n if (value) {\r\n this._onBeforeRenderTargetsRenderObserver = this.scene.onBeforeRenderTargetsRenderObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Render targets rendering\");\r\n _this._renderTargetsRenderTime.beginMonitoring();\r\n });\r\n this._onAfterRenderTargetsRenderObserver = this.scene.onAfterRenderTargetsRenderObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Render targets rendering\");\r\n _this._renderTargetsRenderTime.endMonitoring(false);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver);\r\n this._onBeforeRenderTargetsRenderObserver = null;\r\n this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver);\r\n this._onAfterRenderTargetsRenderObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"particlesRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for particles render time\r\n */\r\n get: function () {\r\n return this._particlesRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureParticlesRenderTime\", {\r\n /**\r\n * Gets the particles render time capture status\r\n */\r\n get: function () {\r\n return this._captureParticlesRenderTime;\r\n },\r\n /**\r\n * Enable or disable the particles render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureParticlesRenderTime) {\r\n return;\r\n }\r\n this._captureParticlesRenderTime = value;\r\n if (value) {\r\n this._onBeforeParticlesRenderingObserver = this.scene.onBeforeParticlesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Particles\");\r\n _this._particlesRenderTime.beginMonitoring();\r\n });\r\n this._onAfterParticlesRenderingObserver = this.scene.onAfterParticlesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Particles\");\r\n _this._particlesRenderTime.endMonitoring(false);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver);\r\n this._onBeforeParticlesRenderingObserver = null;\r\n this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver);\r\n this._onAfterParticlesRenderingObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"spritesRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for sprites render time\r\n */\r\n get: function () {\r\n return this._spritesRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureSpritesRenderTime\", {\r\n /**\r\n * Gets the sprites render time capture status\r\n */\r\n get: function () {\r\n return this._captureSpritesRenderTime;\r\n },\r\n /**\r\n * Enable or disable the sprites render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureSpritesRenderTime) {\r\n return;\r\n }\r\n this._captureSpritesRenderTime = value;\r\n if (!this.scene.spriteManagers) {\r\n return;\r\n }\r\n if (value) {\r\n this._onBeforeSpritesRenderingObserver = this.scene.onBeforeSpritesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Sprites\");\r\n _this._spritesRenderTime.beginMonitoring();\r\n });\r\n this._onAfterSpritesRenderingObserver = this.scene.onAfterSpritesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Sprites\");\r\n _this._spritesRenderTime.endMonitoring(false);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver);\r\n this._onBeforeSpritesRenderingObserver = null;\r\n this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver);\r\n this._onAfterSpritesRenderingObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"physicsTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for physics time\r\n */\r\n get: function () {\r\n return this._physicsTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"capturePhysicsTime\", {\r\n /**\r\n * Gets the physics time capture status\r\n */\r\n get: function () {\r\n return this._capturePhysicsTime;\r\n },\r\n /**\r\n * Enable or disable the physics time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._capturePhysicsTime) {\r\n return;\r\n }\r\n if (!this.scene.onBeforePhysicsObservable) {\r\n return;\r\n }\r\n this._capturePhysicsTime = value;\r\n if (value) {\r\n this._onBeforePhysicsObserver = this.scene.onBeforePhysicsObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Physics\");\r\n _this._physicsTime.beginMonitoring();\r\n });\r\n this._onAfterPhysicsObserver = this.scene.onAfterPhysicsObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Physics\");\r\n _this._physicsTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);\r\n this._onBeforePhysicsObserver = null;\r\n this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);\r\n this._onAfterPhysicsObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"animationsTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for animations time\r\n */\r\n get: function () {\r\n return this._animationsTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureAnimationsTime\", {\r\n /**\r\n * Gets the animations time capture status\r\n */\r\n get: function () {\r\n return this._captureAnimationsTime;\r\n },\r\n /**\r\n * Enable or disable the animations time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureAnimationsTime) {\r\n return;\r\n }\r\n this._captureAnimationsTime = value;\r\n if (value) {\r\n this._onAfterAnimationsObserver = this.scene.onAfterAnimationsObservable.add(function () {\r\n _this._animationsTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);\r\n this._onAfterAnimationsObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"frameTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for frame time capture\r\n */\r\n get: function () {\r\n return this._frameTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureFrameTime\", {\r\n /**\r\n * Gets the frame time capture status\r\n */\r\n get: function () {\r\n return this._captureFrameTime;\r\n },\r\n /**\r\n * Enable or disable the frame time capture\r\n */\r\n set: function (value) {\r\n this._captureFrameTime = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"interFrameTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for inter-frames time capture\r\n */\r\n get: function () {\r\n return this._interFrameTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureInterFrameTime\", {\r\n /**\r\n * Gets the inter-frames time capture status\r\n */\r\n get: function () {\r\n return this._captureInterFrameTime;\r\n },\r\n /**\r\n * Enable or disable the inter-frames time capture\r\n */\r\n set: function (value) {\r\n this._captureInterFrameTime = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"renderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for render time capture\r\n */\r\n get: function () {\r\n return this._renderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureRenderTime\", {\r\n /**\r\n * Gets the render time capture status\r\n */\r\n get: function () {\r\n return this._captureRenderTime;\r\n },\r\n /**\r\n * Enable or disable the render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureRenderTime) {\r\n return;\r\n }\r\n this._captureRenderTime = value;\r\n if (value) {\r\n this._onBeforeDrawPhaseObserver = this.scene.onBeforeDrawPhaseObservable.add(function () {\r\n _this._renderTime.beginMonitoring();\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Main render\");\r\n });\r\n this._onAfterDrawPhaseObserver = this.scene.onAfterDrawPhaseObservable.add(function () {\r\n _this._renderTime.endMonitoring(false);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Main render\");\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver);\r\n this._onBeforeDrawPhaseObserver = null;\r\n this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver);\r\n this._onAfterDrawPhaseObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"cameraRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for camera render time capture\r\n */\r\n get: function () {\r\n return this._cameraRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureCameraRenderTime\", {\r\n /**\r\n * Gets the camera render time capture status\r\n */\r\n get: function () {\r\n return this._captureCameraRenderTime;\r\n },\r\n /**\r\n * Enable or disable the camera render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureCameraRenderTime) {\r\n return;\r\n }\r\n this._captureCameraRenderTime = value;\r\n if (value) {\r\n this._onBeforeCameraRenderObserver = this.scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._cameraRenderTime.beginMonitoring();\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Rendering camera \" + camera.name);\r\n });\r\n this._onAfterCameraRenderObserver = this.scene.onAfterCameraRenderObservable.add(function (camera) {\r\n _this._cameraRenderTime.endMonitoring(false);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Rendering camera \" + camera.name);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._onBeforeCameraRenderObserver = null;\r\n this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n this._onAfterCameraRenderObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"drawCallsCounter\", {\r\n /**\r\n * Gets the perf counter used for draw calls\r\n */\r\n get: function () {\r\n return this.scene.getEngine()._drawCalls;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose and release associated resources.\r\n */\r\n SceneInstrumentation.prototype.dispose = function () {\r\n this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n this._onAfterRenderObserver = null;\r\n this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver);\r\n this._onBeforeActiveMeshesEvaluationObserver = null;\r\n this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver);\r\n this._onAfterActiveMeshesEvaluationObserver = null;\r\n this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver);\r\n this._onBeforeRenderTargetsRenderObserver = null;\r\n this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver);\r\n this._onAfterRenderTargetsRenderObserver = null;\r\n this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver);\r\n this._onBeforeParticlesRenderingObserver = null;\r\n this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver);\r\n this._onAfterParticlesRenderingObserver = null;\r\n if (this._onBeforeSpritesRenderingObserver) {\r\n this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver);\r\n this._onBeforeSpritesRenderingObserver = null;\r\n }\r\n if (this._onAfterSpritesRenderingObserver) {\r\n this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver);\r\n this._onAfterSpritesRenderingObserver = null;\r\n }\r\n this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver);\r\n this._onBeforeDrawPhaseObserver = null;\r\n this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver);\r\n this._onAfterDrawPhaseObserver = null;\r\n if (this._onBeforePhysicsObserver) {\r\n this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);\r\n this._onBeforePhysicsObserver = null;\r\n }\r\n if (this._onAfterPhysicsObserver) {\r\n this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);\r\n this._onAfterPhysicsObserver = null;\r\n }\r\n this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);\r\n this._onAfterAnimationsObserver = null;\r\n this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._onBeforeCameraRenderObserver = null;\r\n this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n this._onAfterCameraRenderObserver = null;\r\n this.scene = null;\r\n };\r\n return SceneInstrumentation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/timeToken.ts\":\n/*!**************************************!*\\\n !*** ./Instrumentation/timeToken.ts ***!\n \\**************************************/\n/*! exports provided: _TimeToken */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _TimeToken; });\n/**\r\n * @hidden\r\n **/\r\nvar _TimeToken = /** @class */ (function () {\r\n function _TimeToken() {\r\n this._timeElapsedQueryEnded = false;\r\n }\r\n return _TimeToken;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/effectLayer.ts\":\n/*!*******************************!*\\\n !*** ./Layers/effectLayer.ts ***!\n \\*******************************/\n/*! exports provided: EffectLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return EffectLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_glowMapGeneration_fragment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Shaders/glowMapGeneration.fragment */ \"./Shaders/glowMapGeneration.fragment.ts\");\n/* harmony import */ var _Shaders_glowMapGeneration_vertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/glowMapGeneration.vertex */ \"./Shaders/glowMapGeneration.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The effect layer Helps adding post process effect blended with the main pass.\r\n *\r\n * This can be for instance use to generate glow or higlight effects on the scene.\r\n *\r\n * The effect layer class can not be used directly and is intented to inherited from to be\r\n * customized per effects.\r\n */\r\nvar EffectLayer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new effect Layer and references it in the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n */\r\n function EffectLayer(\r\n /** The Friendly of the effect in the scene */\r\n name, scene) {\r\n this._vertexBuffers = {};\r\n this._maxSize = 0;\r\n this._mainTextureDesiredSize = { width: 0, height: 0 };\r\n this._shouldRender = true;\r\n this._postProcesses = [];\r\n this._textures = [];\r\n this._emissiveTextureAndColor = { texture: null, color: new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"]() };\r\n /**\r\n * The clear color of the texture used to generate the glow map.\r\n */\r\n this.neutralColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"]();\r\n /**\r\n * Specifies wether the highlight layer is enabled or not.\r\n */\r\n this.isEnabled = true;\r\n /**\r\n * An event triggered when the effect layer has been disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the effect layer is about rendering the main texture with the glowy parts.\r\n */\r\n this.onBeforeRenderMainTextureObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the generated texture is being merged in the scene.\r\n */\r\n this.onBeforeComposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the generated texture has been merged in the scene.\r\n */\r\n this.onAfterComposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the efffect layer changes its size.\r\n */\r\n this.onSizeChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n this.name = name;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n EffectLayer._SceneComponentInitialization(this._scene);\r\n this._engine = this._scene.getEngine();\r\n this._maxSize = this._engine.getCaps().maxTextureSize;\r\n this._scene.effectLayers.push(this);\r\n // Generate Buffers\r\n this._generateIndexBuffer();\r\n this._generateVertexBuffer();\r\n }\r\n Object.defineProperty(EffectLayer.prototype, \"camera\", {\r\n /**\r\n * Gets the camera attached to the layer.\r\n */\r\n get: function () {\r\n return this._effectLayerOptions.camera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EffectLayer.prototype, \"renderingGroupId\", {\r\n /**\r\n * Gets the rendering group id the layer should render in.\r\n */\r\n get: function () {\r\n return this._effectLayerOptions.renderingGroupId;\r\n },\r\n set: function (renderingGroupId) {\r\n this._effectLayerOptions.renderingGroupId = renderingGroupId;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the effect layer with the required options.\r\n * @param options Sets of none mandatory options to use with the layer (see IEffectLayerOptions for more information)\r\n */\r\n EffectLayer.prototype._init = function (options) {\r\n // Adapt options\r\n this._effectLayerOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ mainTextureRatio: 0.5, alphaBlendingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].ALPHA_COMBINE, camera: null, renderingGroupId: -1 }, options);\r\n this._setMainTextureSize();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n this._mergeEffect = this._createMergeEffect();\r\n };\r\n /**\r\n * Generates the index buffer of the full screen quad blending to the main canvas.\r\n */\r\n EffectLayer.prototype._generateIndexBuffer = function () {\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = this._engine.createIndexBuffer(indices);\r\n };\r\n /**\r\n * Generates the vertex buffer of the full screen quad blending to the main canvas.\r\n */\r\n EffectLayer.prototype._generateVertexBuffer = function () {\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n var vertexBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"](this._engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind] = vertexBuffer;\r\n };\r\n /**\r\n * Sets the main texture desired size which is the closest power of two\r\n * of the engine canvas size.\r\n */\r\n EffectLayer.prototype._setMainTextureSize = function () {\r\n if (this._effectLayerOptions.mainTextureFixedSize) {\r\n this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize;\r\n this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize;\r\n }\r\n else {\r\n this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.width = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize) : this._mainTextureDesiredSize.width;\r\n this._mainTextureDesiredSize.height = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize) : this._mainTextureDesiredSize.height;\r\n }\r\n this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width);\r\n this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);\r\n };\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n EffectLayer.prototype._createMainTexture = function () {\r\n var _this = this;\r\n this._mainTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](\"HighlightLayerMainRTT\", {\r\n width: this._mainTextureDesiredSize.width,\r\n height: this._mainTextureDesiredSize.height\r\n }, this._scene, false, true, _Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._mainTexture.activeCamera = this._effectLayerOptions.camera;\r\n this._mainTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._mainTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._mainTexture.anisotropicFilteringLevel = 1;\r\n this._mainTexture.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._mainTexture.renderParticles = false;\r\n this._mainTexture.renderList = null;\r\n this._mainTexture.ignoreCameraViewport = true;\r\n // Custom render function\r\n this._mainTexture.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n _this.onBeforeRenderMainTextureObservable.notifyObservers(_this);\r\n var index;\r\n var engine = _this._scene.getEngine();\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n _this._renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n _this._renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n _this._renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n var previousAlphaMode = engine.getAlphaMode();\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n _this._renderSubMesh(transparentSubMeshes.data[index], true);\r\n }\r\n engine.setAlphaMode(previousAlphaMode);\r\n };\r\n this._mainTexture.onClearObservable.add(function (engine) {\r\n engine.clear(_this.neutralColor, true, true, true);\r\n });\r\n };\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n EffectLayer.prototype._addCustomEffectDefines = function (defines) {\r\n // Nothing to add by default.\r\n };\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify wether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @return true if ready otherwise, false\r\n */\r\n EffectLayer.prototype._isReady = function (subMesh, useInstances, emissiveTexture) {\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return false;\r\n }\r\n if (!material.isReadyForSubMesh(subMesh.getMesh(), subMesh, useInstances)) {\r\n return false;\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n var mesh = subMesh.getMesh();\r\n var uv1 = false;\r\n var uv2 = false;\r\n // Diffuse\r\n if (material) {\r\n var needAlphaTest = material.needAlphaTesting();\r\n var diffuseTexture = material.getAlphaTestTexture();\r\n var needAlphaBlendFromDiffuse = diffuseTexture && diffuseTexture.hasAlpha &&\r\n (material.useAlphaFromDiffuseTexture || material._useAlphaFromAlbedoTexture);\r\n if (diffuseTexture && (needAlphaTest || needAlphaBlendFromDiffuse)) {\r\n defines.push(\"#define DIFFUSE\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind) &&\r\n diffuseTexture.coordinatesIndex === 1) {\r\n defines.push(\"#define DIFFUSEUV2\");\r\n uv2 = true;\r\n }\r\n else if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind)) {\r\n defines.push(\"#define DIFFUSEUV1\");\r\n uv1 = true;\r\n }\r\n if (needAlphaTest) {\r\n defines.push(\"#define ALPHATEST\");\r\n defines.push(\"#define ALPHATESTVALUE 0.4\");\r\n }\r\n }\r\n var opacityTexture = material.opacityTexture;\r\n if (opacityTexture) {\r\n defines.push(\"#define OPACITY\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind) &&\r\n opacityTexture.coordinatesIndex === 1) {\r\n defines.push(\"#define OPACITYUV2\");\r\n uv2 = true;\r\n }\r\n else if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind)) {\r\n defines.push(\"#define OPACITYUV1\");\r\n uv1 = true;\r\n }\r\n }\r\n }\r\n // Emissive\r\n if (emissiveTexture) {\r\n defines.push(\"#define EMISSIVE\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind) &&\r\n emissiveTexture.coordinatesIndex === 1) {\r\n defines.push(\"#define EMISSIVEUV2\");\r\n uv2 = true;\r\n }\r\n else if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind)) {\r\n defines.push(\"#define EMISSIVEUV1\");\r\n uv1 = true;\r\n }\r\n }\r\n // Vertex\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].ColorKind) && mesh.hasVertexAlpha) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].ColorKind);\r\n defines.push(\"#define VERTEXALPHA\");\r\n }\r\n if (uv1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (uv2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n // Bones\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_10__[\"EffectFallbacks\"]();\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n var skeleton = mesh.skeleton;\r\n if (skeleton && skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton ? (skeleton.bones.length + 1) : 0));\r\n }\r\n if (mesh.numBoneInfluencers > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var manager = mesh.morphTargetManager;\r\n var morphInfluencers = 0;\r\n if (manager) {\r\n if (manager.numInfluencers > 0) {\r\n defines.push(\"#define MORPHTARGETS\");\r\n morphInfluencers = manager.numInfluencers;\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + morphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, morphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n this._addCustomEffectDefines(defines);\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect(\"glowMapGeneration\", attribs, [\"world\", \"mBones\", \"viewProjection\",\r\n \"glowColor\", \"morphTargetInfluences\", \"boneTextureWidth\",\r\n \"diffuseMatrix\", \"emissiveMatrix\", \"opacityMatrix\", \"opacityIntensity\"], [\"diffuseSampler\", \"emissiveSampler\", \"opacitySampler\", \"boneSampler\"], join, fallbacks, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers });\r\n }\r\n return this._effectLayerMapGenerationEffect.isReady();\r\n };\r\n /**\r\n * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.\r\n */\r\n EffectLayer.prototype.render = function () {\r\n var currentEffect = this._mergeEffect;\r\n // Check\r\n if (!currentEffect.isReady()) {\r\n return;\r\n }\r\n for (var i = 0; i < this._postProcesses.length; i++) {\r\n if (!this._postProcesses[i].isReady()) {\r\n return;\r\n }\r\n }\r\n var engine = this._scene.getEngine();\r\n this.onBeforeComposeObservable.notifyObservers(this);\r\n // Render\r\n engine.enableEffect(currentEffect);\r\n engine.setState(false);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);\r\n // Cache\r\n var previousAlphaMode = engine.getAlphaMode();\r\n // Go Blend.\r\n engine.setAlphaMode(this._effectLayerOptions.alphaBlendingMode);\r\n // Blends the map on the main canvas.\r\n this._internalRender(currentEffect);\r\n // Restore Alpha\r\n engine.setAlphaMode(previousAlphaMode);\r\n this.onAfterComposeObservable.notifyObservers(this);\r\n // Handle size changes.\r\n var size = this._mainTexture.getSize();\r\n this._setMainTextureSize();\r\n if (size.width !== this._mainTextureDesiredSize.width || size.height !== this._mainTextureDesiredSize.height) {\r\n // Recreate RTT and post processes on size change.\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n this._disposeTextureAndPostProcesses();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n };\r\n /**\r\n * Determine if a given mesh will be used in the current effect.\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be used\r\n */\r\n EffectLayer.prototype.hasMesh = function (mesh) {\r\n if (this.renderingGroupId === -1 || mesh.renderingGroupId === this.renderingGroupId) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n * @returns true if the glow layer should be rendered\r\n */\r\n EffectLayer.prototype.shouldRender = function () {\r\n return this.isEnabled && this._shouldRender;\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n EffectLayer.prototype._shouldRenderMesh = function (mesh) {\r\n return true;\r\n };\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n EffectLayer.prototype._canRenderMesh = function (mesh, material) {\r\n return !material.needAlphaBlendingForMesh(mesh);\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n EffectLayer.prototype._shouldRenderEmissiveTextureForMesh = function () {\r\n return true;\r\n };\r\n /**\r\n * Renders the submesh passed in parameter to the generation map.\r\n */\r\n EffectLayer.prototype._renderSubMesh = function (subMesh, enableAlphaMode) {\r\n var _this = this;\r\n if (enableAlphaMode === void 0) { enableAlphaMode = false; }\r\n if (!this.shouldRender()) {\r\n return;\r\n }\r\n var material = subMesh.getMaterial();\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = this._scene;\r\n var engine = scene.getEngine();\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n if (!material) {\r\n return;\r\n }\r\n // Do not block in blend mode.\r\n if (!this._canRenderMesh(mesh, material)) {\r\n return;\r\n }\r\n // Culling\r\n engine.setState(material.backFaceCulling);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n // Early Exit per mesh\r\n if (!this._shouldRenderMesh(mesh)) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id];\r\n this._setEmissiveTextureAndColor(mesh, subMesh, material);\r\n if (this._isReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\r\n engine.enableEffect(this._effectLayerMapGenerationEffect);\r\n mesh._bind(subMesh, this._effectLayerMapGenerationEffect, _Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].TriangleFillMode);\r\n this._effectLayerMapGenerationEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n this._effectLayerMapGenerationEffect.setFloat4(\"glowColor\", this._emissiveTextureAndColor.color.r, this._emissiveTextureAndColor.color.g, this._emissiveTextureAndColor.color.b, this._emissiveTextureAndColor.color.a);\r\n var needAlphaTest = material.needAlphaTesting();\r\n var diffuseTexture = material.getAlphaTestTexture();\r\n var needAlphaBlendFromDiffuse = diffuseTexture && diffuseTexture.hasAlpha &&\r\n (material.useAlphaFromDiffuseTexture || material._useAlphaFromAlbedoTexture);\r\n if (diffuseTexture && (needAlphaTest || needAlphaBlendFromDiffuse)) {\r\n this._effectLayerMapGenerationEffect.setTexture(\"diffuseSampler\", diffuseTexture);\r\n var textureMatrix = diffuseTexture.getTextureMatrix();\r\n if (textureMatrix) {\r\n this._effectLayerMapGenerationEffect.setMatrix(\"diffuseMatrix\", textureMatrix);\r\n }\r\n }\r\n var opacityTexture = material.opacityTexture;\r\n if (opacityTexture) {\r\n this._effectLayerMapGenerationEffect.setTexture(\"opacitySampler\", opacityTexture);\r\n this._effectLayerMapGenerationEffect.setFloat(\"opacityIntensity\", opacityTexture.level);\r\n var textureMatrix = opacityTexture.getTextureMatrix();\r\n if (textureMatrix) {\r\n this._effectLayerMapGenerationEffect.setMatrix(\"opacityMatrix\", textureMatrix);\r\n }\r\n }\r\n // Glow emissive only\r\n if (this._emissiveTextureAndColor.texture) {\r\n this._effectLayerMapGenerationEffect.setTexture(\"emissiveSampler\", this._emissiveTextureAndColor.texture);\r\n this._effectLayerMapGenerationEffect.setMatrix(\"emissiveMatrix\", this._emissiveTextureAndColor.texture.getTextureMatrix());\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n if (!boneTexture) {\r\n return;\r\n }\r\n this._effectLayerMapGenerationEffect.setTexture(\"boneSampler\", boneTexture);\r\n this._effectLayerMapGenerationEffect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n this._effectLayerMapGenerationEffect.setMatrices(\"mBones\", skeleton.getTransformMatrices((mesh)));\r\n }\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._effectLayerMapGenerationEffect);\r\n // Alpha mode\r\n if (enableAlphaMode) {\r\n engine.setAlphaMode(material.alphaMode);\r\n }\r\n // Draw\r\n mesh._processRendering(subMesh, this._effectLayerMapGenerationEffect, _Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effectLayerMapGenerationEffect.setMatrix(\"world\", world); });\r\n }\r\n else {\r\n // Need to reset refresh rate of the main map\r\n this._mainTexture.resetRefreshCounter();\r\n }\r\n };\r\n /**\r\n * Rebuild the required buffers.\r\n * @hidden Internal use only.\r\n */\r\n EffectLayer.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._generateIndexBuffer();\r\n };\r\n /**\r\n * Dispose only the render target textures and post process.\r\n */\r\n EffectLayer.prototype._disposeTextureAndPostProcesses = function () {\r\n this._mainTexture.dispose();\r\n for (var i = 0; i < this._postProcesses.length; i++) {\r\n if (this._postProcesses[i]) {\r\n this._postProcesses[i].dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n for (var i = 0; i < this._textures.length; i++) {\r\n if (this._textures[i]) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = [];\r\n };\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n EffectLayer.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n // Clean textures and post processes\r\n this._disposeTextureAndPostProcesses();\r\n // Remove from scene\r\n var index = this._scene.effectLayers.indexOf(this, 0);\r\n if (index > -1) {\r\n this._scene.effectLayers.splice(index, 1);\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderMainTextureObservable.clear();\r\n this.onBeforeComposeObservable.clear();\r\n this.onAfterComposeObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n };\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n EffectLayer.prototype.getClassName = function () {\r\n return \"EffectLayer\";\r\n };\r\n /**\r\n * Creates an effect layer from parsed effect layer data\r\n * @param parsedEffectLayer defines effect layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the effect layer information\r\n * @returns a parsed effect Layer\r\n */\r\n EffectLayer.Parse = function (parsedEffectLayer, scene, rootUrl) {\r\n var effectLayerType = _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Instantiate(parsedEffectLayer.customType);\r\n return effectLayerType.Parse(parsedEffectLayer, scene, rootUrl);\r\n };\r\n /** @hidden */\r\n EffectLayer._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_16__[\"_DevTools\"].WarnImport(\"EffectLayerSceneComponent\");\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], EffectLayer.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor4\"])()\r\n ], EffectLayer.prototype, \"neutralColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], EffectLayer.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsCameraReference\"])()\r\n ], EffectLayer.prototype, \"camera\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], EffectLayer.prototype, \"renderingGroupId\", null);\r\n return EffectLayer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/effectLayerSceneComponent.ts\":\n/*!*********************************************!*\\\n !*** ./Layers/effectLayerSceneComponent.ts ***!\n \\*********************************************/\n/*! exports provided: EffectLayerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return EffectLayerSceneComponent; });\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n\r\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_3__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_EFFECTLAYER, function (parsedData, scene, container, rootUrl) {\r\n if (parsedData.effectLayers) {\r\n if (!container.effectLayers) {\r\n container.effectLayers = new Array();\r\n }\r\n for (var index = 0; index < parsedData.effectLayers.length; index++) {\r\n var effectLayer = _effectLayer__WEBPACK_IMPORTED_MODULE_2__[\"EffectLayer\"].Parse(parsedData.effectLayers[index], scene, rootUrl);\r\n container.effectLayers.push(effectLayer);\r\n }\r\n }\r\n});\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_3__[\"AbstractScene\"].prototype.removeEffectLayer = function (toRemove) {\r\n var index = this.effectLayers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.effectLayers.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_3__[\"AbstractScene\"].prototype.addEffectLayer = function (newEffectLayer) {\r\n this.effectLayers.push(newEffectLayer);\r\n};\r\n/**\r\n * Defines the layer scene component responsible to manage any effect layers\r\n * in a given scene.\r\n */\r\nvar EffectLayerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function EffectLayerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_EFFECTLAYER;\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n this._previousStencilState = false;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n scene.effectLayers = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n EffectLayerSceneComponent.prototype.register = function () {\r\n this.scene._isReadyForMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh);\r\n this.scene._cameraDrawRenderTargetStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture);\r\n this.scene._beforeCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil);\r\n this.scene._afterRenderingGroupDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup);\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack);\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n EffectLayerSceneComponent.prototype.rebuild = function () {\r\n var layers = this.scene.effectLayers;\r\n for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {\r\n var effectLayer = layers_1[_i];\r\n effectLayer._rebuild();\r\n }\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n EffectLayerSceneComponent.prototype.serialize = function (serializationObject) {\r\n // Effect layers\r\n serializationObject.effectLayers = [];\r\n var layers = this.scene.effectLayers;\r\n for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {\r\n var effectLayer = layers_2[_i];\r\n if (effectLayer.serialize) {\r\n serializationObject.effectLayers.push(effectLayer.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n EffectLayerSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach(function (o) {\r\n _this.scene.addEffectLayer(o);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n EffectLayerSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach(function (o) {\r\n _this.scene.removeEffectLayer(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n EffectLayerSceneComponent.prototype.dispose = function () {\r\n var layers = this.scene.effectLayers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._isReadyForMesh = function (mesh, hardwareInstancedRendering) {\r\n var layers = this.scene.effectLayers;\r\n for (var _i = 0, layers_3 = layers; _i < layers_3.length; _i++) {\r\n var layer = layers_3[_i];\r\n if (!layer.hasMesh(mesh)) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (!layer.isReady(subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n EffectLayerSceneComponent.prototype._renderMainTexture = function (camera) {\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n var needRebind = false;\r\n var layers = this.scene.effectLayers;\r\n if (layers && layers.length > 0) {\r\n this._previousStencilState = this._engine.getStencilBuffer();\r\n for (var _i = 0, layers_4 = layers; _i < layers_4.length; _i++) {\r\n var effectLayer = layers_4[_i];\r\n if (effectLayer.shouldRender() &&\r\n (!effectLayer.camera ||\r\n (effectLayer.camera.cameraRigMode === _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_NONE && camera === effectLayer.camera) ||\r\n (effectLayer.camera.cameraRigMode !== _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_NONE && effectLayer.camera._rigCameras.indexOf(camera) > -1))) {\r\n this._renderEffects = true;\r\n this._needStencil = this._needStencil || effectLayer.needStencil();\r\n var renderTarget = effectLayer._mainTexture;\r\n if (renderTarget._shouldRender()) {\r\n this.scene.incrementRenderId();\r\n renderTarget.render(false, false);\r\n needRebind = true;\r\n }\r\n }\r\n }\r\n this.scene.incrementRenderId();\r\n }\r\n return needRebind;\r\n };\r\n EffectLayerSceneComponent.prototype._setStencil = function () {\r\n // Activate effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(true);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._setStencilBack = function () {\r\n // Restore effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(this._previousStencilState);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._draw = function (renderingGroupId) {\r\n if (this._renderEffects) {\r\n this._engine.setDepthBuffer(false);\r\n var layers = this.scene.effectLayers;\r\n for (var i = 0; i < layers.length; i++) {\r\n var effectLayer = layers[i];\r\n if (effectLayer.renderingGroupId === renderingGroupId) {\r\n if (effectLayer.shouldRender()) {\r\n effectLayer.render();\r\n }\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._drawCamera = function () {\r\n if (this._renderEffects) {\r\n this._draw(-1);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._drawRenderingGroup = function (index) {\r\n if (!this.scene._isInIntermediateRendering() && this._renderEffects) {\r\n this._draw(index);\r\n }\r\n };\r\n return EffectLayerSceneComponent;\r\n}());\r\n\r\n_effectLayer__WEBPACK_IMPORTED_MODULE_2__[\"EffectLayer\"]._SceneComponentInitialization = function (scene) {\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_EFFECTLAYER);\r\n if (!component) {\r\n component = new EffectLayerSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Layers/glowLayer.ts\":\n/*!*****************************!*\\\n !*** ./Layers/glowLayer.ts ***!\n \\*****************************/\n/*! exports provided: GlowLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return GlowLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_fragment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Shaders/glowMapMerge.fragment */ \"./Shaders/glowMapMerge.fragment.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_vertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/glowMapMerge.vertex */ \"./Shaders/glowMapMerge.vertex.ts\");\n/* harmony import */ var _Layers_effectLayerSceneComponent__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Layers/effectLayerSceneComponent */ \"./Layers/effectLayerSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_9__[\"AbstractScene\"].prototype.getGlowLayerByName = function (name) {\r\n for (var index = 0; index < this.effectLayers.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {\r\n return this.effectLayers[index];\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\r\n *\r\n * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove\r\n * glowy meshes to your scene.\r\n *\r\n * Documentation: https://doc.babylonjs.com/how_to/glow_layer\r\n */\r\nvar GlowLayer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GlowLayer, _super);\r\n /**\r\n * Instantiates a new glow Layer and references it to the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)\r\n */\r\n function GlowLayer(name, scene, options) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._intensity = 1.0;\r\n _this._includedOnlyMeshes = [];\r\n _this._excludedMeshes = [];\r\n _this.neutralColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color4\"](0, 0, 0, 1);\r\n // Adapt options\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ mainTextureRatio: GlowLayer.DefaultTextureRatio, blurKernelSize: 32, mainTextureFixedSize: undefined, camera: null, mainTextureSamples: 1, renderingGroupId: -1 }, options);\r\n // Initialize the layer\r\n _this._init({\r\n alphaBlendingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].ALPHA_ADD,\r\n camera: _this._options.camera,\r\n mainTextureFixedSize: _this._options.mainTextureFixedSize,\r\n mainTextureRatio: _this._options.mainTextureRatio,\r\n renderingGroupId: _this._options.renderingGroupId\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(GlowLayer.prototype, \"blurKernelSize\", {\r\n /**\r\n * Gets the kernel size of the blur.\r\n */\r\n get: function () {\r\n return this._horizontalBlurPostprocess1.kernel;\r\n },\r\n /**\r\n * Sets the kernel size of the blur.\r\n */\r\n set: function (value) {\r\n this._horizontalBlurPostprocess1.kernel = value;\r\n this._verticalBlurPostprocess1.kernel = value;\r\n this._horizontalBlurPostprocess2.kernel = value;\r\n this._verticalBlurPostprocess2.kernel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GlowLayer.prototype, \"intensity\", {\r\n /**\r\n * Gets the glow intensity.\r\n */\r\n get: function () {\r\n return this._intensity;\r\n },\r\n /**\r\n * Sets the glow intensity.\r\n */\r\n set: function (value) {\r\n this._intensity = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the effect name of the layer.\r\n * @return The effect name\r\n */\r\n GlowLayer.prototype.getEffectName = function () {\r\n return GlowLayer.EffectName;\r\n };\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n GlowLayer.prototype._createMergeEffect = function () {\r\n // Effect\r\n return this._engine.createEffect(\"glowMapMerge\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind], [\"offset\"], [\"textureSampler\", \"textureSampler2\"], \"#define EMISSIVE \\n\");\r\n };\r\n /**\r\n * Creates the render target textures and post processes used in the glow layer.\r\n */\r\n GlowLayer.prototype._createTextureAndPostProcesses = function () {\r\n var _this = this;\r\n var blurTextureWidth = this._mainTextureDesiredSize.width;\r\n var blurTextureHeight = this._mainTextureDesiredSize.height;\r\n blurTextureWidth = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_12__[\"Engine\"].GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_12__[\"Engine\"].GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n var textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n this._blurTexture1 = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_5__[\"RenderTargetTexture\"](\"GlowLayerBlurRTT\", {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, this._scene, false, true, textureType);\r\n this._blurTexture1.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture1.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture1.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._blurTexture1.renderParticles = false;\r\n this._blurTexture1.ignoreCameraViewport = true;\r\n var blurTextureWidth2 = Math.floor(blurTextureWidth / 2);\r\n var blurTextureHeight2 = Math.floor(blurTextureHeight / 2);\r\n this._blurTexture2 = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_5__[\"RenderTargetTexture\"](\"GlowLayerBlurRTT2\", {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2\r\n }, this._scene, false, true, textureType);\r\n this._blurTexture2.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture2.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture2.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._blurTexture2.renderParticles = false;\r\n this._blurTexture2.ignoreCameraViewport = true;\r\n this._textures = [this._blurTexture1, this._blurTexture2];\r\n this._horizontalBlurPostprocess1 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerHBP1\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](1.0, 0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess1.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess1.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess1.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._mainTexture);\r\n });\r\n this._verticalBlurPostprocess1 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerVBP1\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 1.0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess2 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerHBP2\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](1.0, 0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess2.width = blurTextureWidth2;\r\n this._horizontalBlurPostprocess2.height = blurTextureHeight2;\r\n this._horizontalBlurPostprocess2.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._blurTexture1);\r\n });\r\n this._verticalBlurPostprocess2 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerVBP2\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 1.0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1];\r\n this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._mainTexture.samples = this._options.mainTextureSamples;\r\n this._mainTexture.onAfterUnbindObservable.add(function () {\r\n var internalTexture = _this._blurTexture1.getInternalTexture();\r\n if (internalTexture) {\r\n _this._scene.postProcessManager.directRender(_this._postProcesses1, internalTexture, true);\r\n internalTexture = _this._blurTexture2.getInternalTexture();\r\n if (internalTexture) {\r\n _this._scene.postProcessManager.directRender(_this._postProcesses2, internalTexture, true);\r\n }\r\n }\r\n });\r\n // Prevent autoClear.\r\n this._postProcesses.map(function (pp) { pp.autoClear = false; });\r\n };\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify wether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @return true if ready otherwise, false\r\n */\r\n GlowLayer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n var mesh = subMesh.getRenderingMesh();\r\n if (!material || !mesh) {\r\n return false;\r\n }\r\n var emissiveTexture = material.emissiveTexture;\r\n return _super.prototype._isReady.call(this, subMesh, useInstances, emissiveTexture);\r\n };\r\n /**\r\n * Returns wether or nood the layer needs stencil enabled during the mesh rendering.\r\n */\r\n GlowLayer.prototype.needStencil = function () {\r\n return false;\r\n };\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n GlowLayer.prototype._canRenderMesh = function (mesh, material) {\r\n return true;\r\n };\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n GlowLayer.prototype._internalRender = function (effect) {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n effect.setTexture(\"textureSampler2\", this._blurTexture2);\r\n effect.setFloat(\"offset\", this._intensity);\r\n // Cache\r\n var engine = this._engine;\r\n var previousStencilBuffer = engine.getStencilBuffer();\r\n // Draw order\r\n engine.setStencilBuffer(false);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n // Draw order\r\n engine.setStencilBuffer(previousStencilBuffer);\r\n };\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n GlowLayer.prototype._setEmissiveTextureAndColor = function (mesh, subMesh, material) {\r\n var textureLevel = 1.0;\r\n if (this.customEmissiveTextureSelector) {\r\n this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(mesh, subMesh, material);\r\n }\r\n else {\r\n if (material) {\r\n this._emissiveTextureAndColor.texture = material.emissiveTexture;\r\n if (this._emissiveTextureAndColor.texture) {\r\n textureLevel = this._emissiveTextureAndColor.texture.level;\r\n }\r\n }\r\n else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n }\r\n if (this.customEmissiveColorSelector) {\r\n this.customEmissiveColorSelector(mesh, subMesh, material, this._emissiveTextureAndColor.color);\r\n }\r\n else {\r\n if (material.emissiveColor) {\r\n this._emissiveTextureAndColor.color.set(material.emissiveColor.r * textureLevel, material.emissiveColor.g * textureLevel, material.emissiveColor.b * textureLevel, material.alpha);\r\n }\r\n else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n GlowLayer.prototype._shouldRenderMesh = function (mesh) {\r\n return this.hasMesh(mesh);\r\n };\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n GlowLayer.prototype._addCustomEffectDefines = function (defines) {\r\n defines.push(\"#define GLOW\");\r\n };\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to exclude from the glow layer\r\n */\r\n GlowLayer.prototype.addExcludedMesh = function (mesh) {\r\n if (this._excludedMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._excludedMeshes.push(mesh.uniqueId);\r\n }\r\n };\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n GlowLayer.prototype.removeExcludedMesh = function (mesh) {\r\n var index = this._excludedMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._excludedMeshes.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Add a mesh in the inclusion list to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to include in the glow layer\r\n */\r\n GlowLayer.prototype.addIncludedOnlyMesh = function (mesh) {\r\n if (this._includedOnlyMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._includedOnlyMeshes.push(mesh.uniqueId);\r\n }\r\n };\r\n /**\r\n * Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n GlowLayer.prototype.removeIncludedOnlyMesh = function (mesh) {\r\n var index = this._includedOnlyMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._includedOnlyMeshes.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Determine if a given mesh will be used in the glow layer\r\n * @param mesh The mesh to test\r\n * @returns true if the mesh will be highlighted by the current glow layer\r\n */\r\n GlowLayer.prototype.hasMesh = function (mesh) {\r\n if (!_super.prototype.hasMesh.call(this, mesh)) {\r\n return false;\r\n }\r\n // Included Mesh\r\n if (this._includedOnlyMeshes.length) {\r\n return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;\r\n }\r\n // Excluded Mesh\r\n if (this._excludedMeshes.length) {\r\n return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @hidden\r\n */\r\n GlowLayer.prototype._disposeMesh = function (mesh) {\r\n this.removeIncludedOnlyMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n };\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n GlowLayer.prototype.getClassName = function () {\r\n return \"GlowLayer\";\r\n };\r\n /**\r\n * Serializes this glow layer\r\n * @returns a serialized glow layer object\r\n */\r\n GlowLayer.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.GlowLayer\";\r\n var index;\r\n // Included meshes\r\n serializationObject.includedMeshes = [];\r\n if (this._includedOnlyMeshes.length) {\r\n for (index = 0; index < this._includedOnlyMeshes.length; index++) {\r\n var mesh = this._scene.getMeshByUniqueID(this._includedOnlyMeshes[index]);\r\n if (mesh) {\r\n serializationObject.includedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n if (this._excludedMeshes.length) {\r\n for (index = 0; index < this._excludedMeshes.length; index++) {\r\n var mesh = this._scene.getMeshByUniqueID(this._excludedMeshes[index]);\r\n if (mesh) {\r\n serializationObject.excludedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a Glow Layer from parsed glow layer data\r\n * @param parsedGlowLayer defines glow layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the glow layer information\r\n * @returns a parsed Glow Layer\r\n */\r\n GlowLayer.Parse = function (parsedGlowLayer, scene, rootUrl) {\r\n var gl = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new GlowLayer(parsedGlowLayer.name, scene, parsedGlowLayer.options); }, parsedGlowLayer, scene, rootUrl);\r\n var index;\r\n // Excluded meshes\r\n for (index = 0; index < parsedGlowLayer.excludedMeshes.length; index++) {\r\n var mesh = scene.getMeshByID(parsedGlowLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n gl.addExcludedMesh(mesh);\r\n }\r\n }\r\n // Included meshes\r\n for (index = 0; index < parsedGlowLayer.includedMeshes.length; index++) {\r\n var mesh = scene.getMeshByID(parsedGlowLayer.includedMeshes[index]);\r\n if (mesh) {\r\n gl.addIncludedOnlyMesh(mesh);\r\n }\r\n }\r\n return gl;\r\n };\r\n /**\r\n * Effect Name of the layer.\r\n */\r\n GlowLayer.EffectName = \"GlowLayer\";\r\n /**\r\n * The default blur kernel size used for the glow.\r\n */\r\n GlowLayer.DefaultBlurKernelSize = 32;\r\n /**\r\n * The default texture size ratio used for the glow.\r\n */\r\n GlowLayer.DefaultTextureRatio = 0.5;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], GlowLayer.prototype, \"blurKernelSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], GlowLayer.prototype, \"intensity\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"options\")\r\n ], GlowLayer.prototype, \"_options\", void 0);\r\n return GlowLayer;\r\n}(_effectLayer__WEBPACK_IMPORTED_MODULE_8__[\"EffectLayer\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_11__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.GlowLayer\"] = GlowLayer;\r\n\n\n/***/ }),\n\n/***/ \"./Layers/highlightLayer.ts\":\n/*!**********************************!*\\\n !*** ./Layers/highlightLayer.ts ***!\n \\**********************************/\n/*! exports provided: HighlightLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return HighlightLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_fragment__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Shaders/glowMapMerge.fragment */ \"./Shaders/glowMapMerge.fragment.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_vertex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Shaders/glowMapMerge.vertex */ \"./Shaders/glowMapMerge.vertex.ts\");\n/* harmony import */ var _Shaders_glowBlurPostProcess_fragment__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Shaders/glowBlurPostProcess.fragment */ \"./Shaders/glowBlurPostProcess.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_13__[\"AbstractScene\"].prototype.getHighlightLayerByName = function (name) {\r\n for (var index = 0; index < this.effectLayers.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {\r\n return this.effectLayers[index];\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n * Special Glow Blur post process only blurring the alpha channel\r\n * It enforces keeping the most luminous color in the color channel.\r\n */\r\nvar GlowBlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GlowBlurPostProcess, _super);\r\n function GlowBlurPostProcess(name, direction, kernel, options, camera, samplingMode, engine, reusable) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n var _this = _super.call(this, name, \"glowBlurPostProcess\", [\"screenSize\", \"direction\", \"blurWidth\"], null, options, camera, samplingMode, engine, reusable) || this;\r\n _this.direction = direction;\r\n _this.kernel = kernel;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", _this.width, _this.height);\r\n effect.setVector2(\"direction\", _this.direction);\r\n effect.setFloat(\"blurWidth\", _this.kernel);\r\n });\r\n return _this;\r\n }\r\n return GlowBlurPostProcess;\r\n}(_PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_9__[\"PostProcess\"]));\r\n/**\r\n * The highlight layer Helps adding a glow effect around a mesh.\r\n *\r\n * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove\r\n * glowy meshes to your scene.\r\n *\r\n * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!\r\n */\r\nvar HighlightLayer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HighlightLayer, _super);\r\n /**\r\n * Instantiates a new highlight Layer and references it to the scene..\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)\r\n */\r\n function HighlightLayer(name, scene, options) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this.name = name;\r\n /**\r\n * Specifies whether or not the inner glow is ACTIVE in the layer.\r\n */\r\n _this.innerGlow = true;\r\n /**\r\n * Specifies whether or not the outer glow is ACTIVE in the layer.\r\n */\r\n _this.outerGlow = true;\r\n /**\r\n * An event triggered when the highlight layer is being blurred.\r\n */\r\n _this.onBeforeBlurObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * An event triggered when the highlight layer has been blurred.\r\n */\r\n _this.onAfterBlurObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._instanceGlowingMeshStencilReference = HighlightLayer.GlowingMeshStencilReference++;\r\n _this._meshes = {};\r\n _this._excludedMeshes = {};\r\n _this.neutralColor = HighlightLayer.NeutralColor;\r\n // Warn on stencil\r\n if (!_this._engine.isStencilEnable) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_15__[\"Logger\"].Warn(\"Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }\");\r\n }\r\n // Adapt options\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ mainTextureRatio: 0.5, blurTextureSizeRatio: 0.5, blurHorizontalSize: 1.0, blurVerticalSize: 1.0, alphaBlendingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].ALPHA_COMBINE, camera: null, renderingGroupId: -1 }, options);\r\n // Initialize the layer\r\n _this._init({\r\n alphaBlendingMode: _this._options.alphaBlendingMode,\r\n camera: _this._options.camera,\r\n mainTextureFixedSize: _this._options.mainTextureFixedSize,\r\n mainTextureRatio: _this._options.mainTextureRatio,\r\n renderingGroupId: _this._options.renderingGroupId\r\n });\r\n // Do not render as long as no meshes have been added\r\n _this._shouldRender = false;\r\n return _this;\r\n }\r\n Object.defineProperty(HighlightLayer.prototype, \"blurHorizontalSize\", {\r\n /**\r\n * Gets the horizontal size of the blur.\r\n */\r\n get: function () {\r\n return this._horizontalBlurPostprocess.kernel;\r\n },\r\n /**\r\n * Specifies the horizontal size of the blur.\r\n */\r\n set: function (value) {\r\n this._horizontalBlurPostprocess.kernel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HighlightLayer.prototype, \"blurVerticalSize\", {\r\n /**\r\n * Gets the vertical size of the blur.\r\n */\r\n get: function () {\r\n return this._verticalBlurPostprocess.kernel;\r\n },\r\n /**\r\n * Specifies the vertical size of the blur.\r\n */\r\n set: function (value) {\r\n this._verticalBlurPostprocess.kernel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the effect name of the layer.\r\n * @return The effect name\r\n */\r\n HighlightLayer.prototype.getEffectName = function () {\r\n return HighlightLayer.EffectName;\r\n };\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n HighlightLayer.prototype._createMergeEffect = function () {\r\n // Effect\r\n return this._engine.createEffect(\"glowMapMerge\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind], [\"offset\"], [\"textureSampler\"], this._options.isStroke ? \"#define STROKE \\n\" : undefined);\r\n };\r\n /**\r\n * Creates the render target textures and post processes used in the highlight layer.\r\n */\r\n HighlightLayer.prototype._createTextureAndPostProcesses = function () {\r\n var _this = this;\r\n var blurTextureWidth = this._mainTextureDesiredSize.width * this._options.blurTextureSizeRatio;\r\n var blurTextureHeight = this._mainTextureDesiredSize.height * this._options.blurTextureSizeRatio;\r\n blurTextureWidth = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n var textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n this._blurTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_8__[\"RenderTargetTexture\"](\"HighlightLayerBlurRTT\", {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, this._scene, false, true, textureType);\r\n this._blurTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture.anisotropicFilteringLevel = 16;\r\n this._blurTexture.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n this._blurTexture.renderParticles = false;\r\n this._blurTexture.ignoreCameraViewport = true;\r\n this._textures = [this._blurTexture];\r\n if (this._options.alphaBlendingMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].ALPHA_COMBINE) {\r\n this._downSamplePostprocess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"PassPostProcess\"](\"HighlightLayerPPP\", this._options.blurTextureSizeRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine());\r\n this._downSamplePostprocess.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._mainTexture);\r\n });\r\n this._horizontalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerHBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1.0, 0), this._options.blurHorizontalSize, 1, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine());\r\n this._horizontalBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n this._verticalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerVBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 1.0), this._options.blurVerticalSize, 1, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine());\r\n this._verticalBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n this._postProcesses = [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n }\r\n else {\r\n this._horizontalBlurPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](\"HighlightLayerHBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1.0, 0), this._options.blurHorizontalSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._mainTexture);\r\n });\r\n this._verticalBlurPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](\"HighlightLayerVBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 1.0), this._options.blurVerticalSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._postProcesses = [this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n }\r\n this._mainTexture.onAfterUnbindObservable.add(function () {\r\n _this.onBeforeBlurObservable.notifyObservers(_this);\r\n var internalTexture = _this._blurTexture.getInternalTexture();\r\n if (internalTexture) {\r\n _this._scene.postProcessManager.directRender(_this._postProcesses, internalTexture, true);\r\n }\r\n _this.onAfterBlurObservable.notifyObservers(_this);\r\n });\r\n // Prevent autoClear.\r\n this._postProcesses.map(function (pp) { pp.autoClear = false; });\r\n };\r\n /**\r\n * Returns wether or nood the layer needs stencil enabled during the mesh rendering.\r\n */\r\n HighlightLayer.prototype.needStencil = function () {\r\n return true;\r\n };\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify wether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @return true if ready otherwise, false\r\n */\r\n HighlightLayer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n var mesh = subMesh.getRenderingMesh();\r\n if (!material || !mesh || !this._meshes) {\r\n return false;\r\n }\r\n var emissiveTexture = null;\r\n var highlightLayerMesh = this._meshes[mesh.uniqueId];\r\n if (highlightLayerMesh && highlightLayerMesh.glowEmissiveOnly && material) {\r\n emissiveTexture = material.emissiveTexture;\r\n }\r\n return _super.prototype._isReady.call(this, subMesh, useInstances, emissiveTexture);\r\n };\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n HighlightLayer.prototype._internalRender = function (effect) {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture);\r\n // Cache\r\n var engine = this._engine;\r\n engine.cacheStencilState();\r\n // Stencil operations\r\n engine.setStencilOperationPass(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].REPLACE);\r\n engine.setStencilOperationFail(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].KEEP);\r\n engine.setStencilOperationDepthFail(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].KEEP);\r\n // Draw order\r\n engine.setStencilMask(0x00);\r\n engine.setStencilBuffer(true);\r\n engine.setStencilFunctionReference(this._instanceGlowingMeshStencilReference);\r\n // 2 passes inner outer\r\n if (this.outerGlow) {\r\n effect.setFloat(\"offset\", 0);\r\n engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].NOTEQUAL);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n if (this.innerGlow) {\r\n effect.setFloat(\"offset\", 1);\r\n engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].EQUAL);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n // Restore Cache\r\n engine.restoreStencilState();\r\n };\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n */\r\n HighlightLayer.prototype.shouldRender = function () {\r\n if (_super.prototype.shouldRender.call(this)) {\r\n return this._meshes ? true : false;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n HighlightLayer.prototype._shouldRenderMesh = function (mesh) {\r\n // Excluded Mesh\r\n if (this._excludedMeshes && this._excludedMeshes[mesh.uniqueId]) {\r\n return false;\r\n }\r\n if (!_super.prototype.hasMesh.call(this, mesh)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n HighlightLayer.prototype._setEmissiveTextureAndColor = function (mesh, subMesh, material) {\r\n var highlightLayerMesh = this._meshes[mesh.uniqueId];\r\n if (highlightLayerMesh) {\r\n this._emissiveTextureAndColor.color.set(highlightLayerMesh.color.r, highlightLayerMesh.color.g, highlightLayerMesh.color.b, 1.0);\r\n }\r\n else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n if (highlightLayerMesh && highlightLayerMesh.glowEmissiveOnly && material) {\r\n this._emissiveTextureAndColor.texture = material.emissiveTexture;\r\n this._emissiveTextureAndColor.color.set(1.0, 1.0, 1.0, 1.0);\r\n }\r\n else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n };\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.\r\n * @param mesh The mesh to exclude from the highlight layer\r\n */\r\n HighlightLayer.prototype.addExcludedMesh = function (mesh) {\r\n if (!this._excludedMeshes) {\r\n return;\r\n }\r\n var meshExcluded = this._excludedMeshes[mesh.uniqueId];\r\n if (!meshExcluded) {\r\n this._excludedMeshes[mesh.uniqueId] = {\r\n mesh: mesh,\r\n beforeBind: mesh.onBeforeBindObservable.add(function (mesh) {\r\n mesh.getEngine().setStencilBuffer(false);\r\n }),\r\n afterRender: mesh.onAfterRenderObservable.add(function (mesh) {\r\n mesh.getEngine().setStencilBuffer(true);\r\n }),\r\n };\r\n }\r\n };\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.\r\n * @param mesh The mesh to highlight\r\n */\r\n HighlightLayer.prototype.removeExcludedMesh = function (mesh) {\r\n if (!this._excludedMeshes) {\r\n return;\r\n }\r\n var meshExcluded = this._excludedMeshes[mesh.uniqueId];\r\n if (meshExcluded) {\r\n if (meshExcluded.beforeBind) {\r\n mesh.onBeforeBindObservable.remove(meshExcluded.beforeBind);\r\n }\r\n if (meshExcluded.afterRender) {\r\n mesh.onAfterRenderObservable.remove(meshExcluded.afterRender);\r\n }\r\n }\r\n this._excludedMeshes[mesh.uniqueId] = null;\r\n };\r\n /**\r\n * Determine if a given mesh will be highlighted by the current HighlightLayer\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be highlighted by the current HighlightLayer\r\n */\r\n HighlightLayer.prototype.hasMesh = function (mesh) {\r\n if (!this._meshes) {\r\n return false;\r\n }\r\n if (!_super.prototype.hasMesh.call(this, mesh)) {\r\n return false;\r\n }\r\n return this._meshes[mesh.uniqueId] !== undefined && this._meshes[mesh.uniqueId] !== null;\r\n };\r\n /**\r\n * Add a mesh in the highlight layer in order to make it glow with the chosen color.\r\n * @param mesh The mesh to highlight\r\n * @param color The color of the highlight\r\n * @param glowEmissiveOnly Extract the glow from the emissive texture\r\n */\r\n HighlightLayer.prototype.addMesh = function (mesh, color, glowEmissiveOnly) {\r\n var _this = this;\r\n if (glowEmissiveOnly === void 0) { glowEmissiveOnly = false; }\r\n if (!this._meshes) {\r\n return;\r\n }\r\n var meshHighlight = this._meshes[mesh.uniqueId];\r\n if (meshHighlight) {\r\n meshHighlight.color = color;\r\n }\r\n else {\r\n this._meshes[mesh.uniqueId] = {\r\n mesh: mesh,\r\n color: color,\r\n // Lambda required for capture due to Observable this context\r\n observerHighlight: mesh.onBeforeBindObservable.add(function (mesh) {\r\n if (_this.isEnabled) {\r\n if (_this._excludedMeshes && _this._excludedMeshes[mesh.uniqueId]) {\r\n _this._defaultStencilReference(mesh);\r\n }\r\n else {\r\n mesh.getScene().getEngine().setStencilFunctionReference(_this._instanceGlowingMeshStencilReference);\r\n }\r\n }\r\n }),\r\n observerDefault: mesh.onAfterRenderObservable.add(function (mesh) {\r\n if (_this.isEnabled) {\r\n _this._defaultStencilReference(mesh);\r\n }\r\n }),\r\n glowEmissiveOnly: glowEmissiveOnly\r\n };\r\n mesh.onDisposeObservable.add(function () {\r\n _this._disposeMesh(mesh);\r\n });\r\n }\r\n this._shouldRender = true;\r\n };\r\n /**\r\n * Remove a mesh from the highlight layer in order to make it stop glowing.\r\n * @param mesh The mesh to highlight\r\n */\r\n HighlightLayer.prototype.removeMesh = function (mesh) {\r\n if (!this._meshes) {\r\n return;\r\n }\r\n var meshHighlight = this._meshes[mesh.uniqueId];\r\n if (meshHighlight) {\r\n if (meshHighlight.observerHighlight) {\r\n mesh.onBeforeBindObservable.remove(meshHighlight.observerHighlight);\r\n }\r\n if (meshHighlight.observerDefault) {\r\n mesh.onAfterRenderObservable.remove(meshHighlight.observerDefault);\r\n }\r\n delete this._meshes[mesh.uniqueId];\r\n }\r\n this._shouldRender = false;\r\n for (var meshHighlightToCheck in this._meshes) {\r\n if (this._meshes[meshHighlightToCheck]) {\r\n this._shouldRender = true;\r\n break;\r\n }\r\n }\r\n };\r\n /**\r\n * Force the stencil to the normal expected value for none glowing parts\r\n */\r\n HighlightLayer.prototype._defaultStencilReference = function (mesh) {\r\n mesh.getScene().getEngine().setStencilFunctionReference(HighlightLayer.NormalMeshStencilReference);\r\n };\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @hidden\r\n */\r\n HighlightLayer.prototype._disposeMesh = function (mesh) {\r\n this.removeMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n };\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n HighlightLayer.prototype.dispose = function () {\r\n if (this._meshes) {\r\n // Clean mesh references\r\n for (var id in this._meshes) {\r\n var meshHighlight = this._meshes[id];\r\n if (meshHighlight && meshHighlight.mesh) {\r\n if (meshHighlight.observerHighlight) {\r\n meshHighlight.mesh.onBeforeBindObservable.remove(meshHighlight.observerHighlight);\r\n }\r\n if (meshHighlight.observerDefault) {\r\n meshHighlight.mesh.onAfterRenderObservable.remove(meshHighlight.observerDefault);\r\n }\r\n }\r\n }\r\n this._meshes = null;\r\n }\r\n if (this._excludedMeshes) {\r\n for (var id in this._excludedMeshes) {\r\n var meshHighlight = this._excludedMeshes[id];\r\n if (meshHighlight) {\r\n if (meshHighlight.beforeBind) {\r\n meshHighlight.mesh.onBeforeBindObservable.remove(meshHighlight.beforeBind);\r\n }\r\n if (meshHighlight.afterRender) {\r\n meshHighlight.mesh.onAfterRenderObservable.remove(meshHighlight.afterRender);\r\n }\r\n }\r\n }\r\n this._excludedMeshes = null;\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n HighlightLayer.prototype.getClassName = function () {\r\n return \"HighlightLayer\";\r\n };\r\n /**\r\n * Serializes this Highlight layer\r\n * @returns a serialized Highlight layer object\r\n */\r\n HighlightLayer.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.HighlightLayer\";\r\n // Highlighted meshes\r\n serializationObject.meshes = [];\r\n if (this._meshes) {\r\n for (var m in this._meshes) {\r\n var mesh = this._meshes[m];\r\n if (mesh) {\r\n serializationObject.meshes.push({\r\n glowEmissiveOnly: mesh.glowEmissiveOnly,\r\n color: mesh.color.asArray(),\r\n meshId: mesh.mesh.id\r\n });\r\n }\r\n }\r\n }\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n if (this._excludedMeshes) {\r\n for (var e in this._excludedMeshes) {\r\n var excludedMesh = this._excludedMeshes[e];\r\n if (excludedMesh) {\r\n serializationObject.excludedMeshes.push(excludedMesh.mesh.id);\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a Highlight layer from parsed Highlight layer data\r\n * @param parsedHightlightLayer defines the Highlight layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the Highlight layer information\r\n * @returns a parsed Highlight layer\r\n */\r\n HighlightLayer.Parse = function (parsedHightlightLayer, scene, rootUrl) {\r\n var hl = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new HighlightLayer(parsedHightlightLayer.name, scene, parsedHightlightLayer.options); }, parsedHightlightLayer, scene, rootUrl);\r\n var index;\r\n // Excluded meshes\r\n for (index = 0; index < parsedHightlightLayer.excludedMeshes.length; index++) {\r\n var mesh = scene.getMeshByID(parsedHightlightLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n hl.addExcludedMesh(mesh);\r\n }\r\n }\r\n // Included meshes\r\n for (index = 0; index < parsedHightlightLayer.meshes.length; index++) {\r\n var highlightedMesh = parsedHightlightLayer.meshes[index];\r\n var mesh = scene.getMeshByID(highlightedMesh.meshId);\r\n if (mesh) {\r\n hl.addMesh(mesh, _Maths_math_color__WEBPACK_IMPORTED_MODULE_17__[\"Color3\"].FromArray(highlightedMesh.color), highlightedMesh.glowEmissiveOnly);\r\n }\r\n }\r\n return hl;\r\n };\r\n /**\r\n * Effect Name of the highlight layer.\r\n */\r\n HighlightLayer.EffectName = \"HighlightLayer\";\r\n /**\r\n * The neutral color used during the preparation of the glow effect.\r\n * This is black by default as the blend operation is a blend operation.\r\n */\r\n HighlightLayer.NeutralColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_17__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * Stencil value used for glowing meshes.\r\n */\r\n HighlightLayer.GlowingMeshStencilReference = 0x02;\r\n /**\r\n * Stencil value used for the other meshes in the scene.\r\n */\r\n HighlightLayer.NormalMeshStencilReference = 0x01;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"innerGlow\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"outerGlow\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"blurHorizontalSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"blurVerticalSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"options\")\r\n ], HighlightLayer.prototype, \"_options\", void 0);\r\n return HighlightLayer;\r\n}(_effectLayer__WEBPACK_IMPORTED_MODULE_12__[\"EffectLayer\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_16__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.HighlightLayer\"] = HighlightLayer;\r\n\n\n/***/ }),\n\n/***/ \"./Layers/index.ts\":\n/*!*************************!*\\\n !*** ./Layers/index.ts ***!\n \\*************************/\n/*! exports provided: EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return _effectLayer__WEBPACK_IMPORTED_MODULE_0__[\"EffectLayer\"]; });\n\n/* harmony import */ var _effectLayerSceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./effectLayerSceneComponent */ \"./Layers/effectLayerSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return _effectLayerSceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"EffectLayerSceneComponent\"]; });\n\n/* harmony import */ var _glowLayer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glowLayer */ \"./Layers/glowLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return _glowLayer__WEBPACK_IMPORTED_MODULE_2__[\"GlowLayer\"]; });\n\n/* harmony import */ var _highlightLayer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./highlightLayer */ \"./Layers/highlightLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return _highlightLayer__WEBPACK_IMPORTED_MODULE_3__[\"HighlightLayer\"]; });\n\n/* harmony import */ var _layer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./layer */ \"./Layers/layer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return _layer__WEBPACK_IMPORTED_MODULE_4__[\"Layer\"]; });\n\n/* harmony import */ var _layerSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./layerSceneComponent */ \"./Layers/layerSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return _layerSceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"LayerSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/layer.ts\":\n/*!*************************!*\\\n !*** ./Layers/layer.ts ***!\n \\*************************/\n/*! exports provided: Layer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return Layer; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _layerSceneComponent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./layerSceneComponent */ \"./Layers/layerSceneComponent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_layer_fragment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/layer.fragment */ \"./Shaders/layer.fragment.ts\");\n/* harmony import */ var _Shaders_layer_vertex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/layer.vertex */ \"./Shaders/layer.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n */\r\nvar Layer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new layer.\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n * @param name Define the name of the layer in the scene\r\n * @param imgUrl Define the url of the texture to display in the layer\r\n * @param scene Define the scene the layer belongs to\r\n * @param isBackground Defines whether the layer is displayed in front or behind the scene\r\n * @param color Defines a color for the layer\r\n */\r\n function Layer(\r\n /**\r\n * Define the name of the layer.\r\n */\r\n name, imgUrl, scene, isBackground, color) {\r\n this.name = name;\r\n /**\r\n * Define the scale of the layer in order to zoom in out of the texture.\r\n */\r\n this.scale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1, 1);\r\n /**\r\n * Define an offset for the layer in order to shift the texture.\r\n */\r\n this.offset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 0);\r\n /**\r\n * Define the alpha blending mode used in the layer in case the texture or color has an alpha.\r\n */\r\n this.alphaBlendingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_COMBINE;\r\n /**\r\n * Define a mask to restrict the layer to only some of the scene cameras.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * Define the list of render target the layer is visible into.\r\n */\r\n this.renderTargetTextures = [];\r\n /**\r\n * Define if the layer is only used in renderTarget or if it also\r\n * renders in the main frame buffer of the canvas.\r\n */\r\n this.renderOnlyInRenderTargetTextures = false;\r\n this._vertexBuffers = {};\r\n /**\r\n * An event triggered when the layer is disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering the scene\r\n */\r\n this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this.texture = imgUrl ? new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"](imgUrl, scene, true) : null;\r\n this.isBackground = isBackground === undefined ? true : isBackground;\r\n this.color = color === undefined ? new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](1, 1, 1, 1) : color;\r\n this._scene = (scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene);\r\n var layerComponent = this._scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_7__[\"SceneComponentConstants\"].NAME_LAYER);\r\n if (!layerComponent) {\r\n layerComponent = new _layerSceneComponent__WEBPACK_IMPORTED_MODULE_8__[\"LayerSceneComponent\"](this._scene);\r\n this._scene._addComponent(layerComponent);\r\n }\r\n this._scene.layers.push(this);\r\n var engine = this._scene.getEngine();\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n var vertexBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"](engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = vertexBuffer;\r\n this._createIndexBuffer();\r\n // Effects\r\n this._effect = engine.createEffect(\"layer\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind], [\"textureMatrix\", \"color\", \"scale\", \"offset\"], [\"textureSampler\"], \"\");\r\n this._alphaTestEffect = engine.createEffect(\"layer\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind], [\"textureMatrix\", \"color\", \"scale\", \"offset\"], [\"textureSampler\"], \"#define ALPHATEST\");\r\n }\r\n Object.defineProperty(Layer.prototype, \"onDispose\", {\r\n /**\r\n * Back compatibility with callback before the onDisposeObservable existed.\r\n * The set callback will be triggered when the layer has been disposed.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onBeforeRender\", {\r\n /**\r\n * Back compatibility with callback before the onBeforeRenderObservable existed.\r\n * The set callback will be triggered just before rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onAfterRender\", {\r\n /**\r\n * Back compatibility with callback before the onAfterRenderObservable existed.\r\n * The set callback will be triggered just after rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Layer.prototype._createIndexBuffer = function () {\r\n var engine = this._scene.getEngine();\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n };\r\n /** @hidden */\r\n Layer.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n };\r\n /**\r\n * Renders the layer in the scene.\r\n */\r\n Layer.prototype.render = function () {\r\n var currentEffect = this.alphaTest ? this._alphaTestEffect : this._effect;\r\n // Check\r\n if (!currentEffect.isReady() || !this.texture || !this.texture.isReady()) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Render\r\n engine.enableEffect(currentEffect);\r\n engine.setState(false);\r\n // Texture\r\n currentEffect.setTexture(\"textureSampler\", this.texture);\r\n currentEffect.setMatrix(\"textureMatrix\", this.texture.getTextureMatrix());\r\n // Color\r\n currentEffect.setFloat4(\"color\", this.color.r, this.color.g, this.color.b, this.color.a);\r\n // Scale / offset\r\n currentEffect.setVector2(\"offset\", this.offset);\r\n currentEffect.setVector2(\"scale\", this.scale);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);\r\n // Draw order\r\n if (!this.alphaTest) {\r\n engine.setAlphaMode(this.alphaBlendingMode);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n else {\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Disposes and releases the associated ressources.\r\n */\r\n Layer.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (this.texture) {\r\n this.texture.dispose();\r\n this.texture = null;\r\n }\r\n // Clean RTT list\r\n this.renderTargetTextures = [];\r\n // Remove from scene\r\n var index = this._scene.layers.indexOf(this);\r\n this._scene.layers.splice(index, 1);\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n };\r\n return Layer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/layerSceneComponent.ts\":\n/*!***************************************!*\\\n !*** ./Layers/layerSceneComponent.ts ***!\n \\***************************************/\n/*! exports provided: LayerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return LayerSceneComponent; });\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n\r\n/**\r\n * Defines the layer scene component responsible to manage any layers\r\n * in a given scene.\r\n */\r\nvar LayerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function LayerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].NAME_LAYER;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n scene.layers = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n LayerSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_BEFORECAMERADRAW_LAYER, this, this._drawCameraBackground);\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_LAYER, this, this._drawCameraForeground);\r\n this.scene._beforeRenderTargetDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_BEFORERENDERTARGETDRAW_LAYER, this, this._drawRenderTargetBackground);\r\n this.scene._afterRenderTargetDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_AFTERRENDERTARGETDRAW_LAYER, this, this._drawRenderTargetForeground);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n LayerSceneComponent.prototype.rebuild = function () {\r\n var layers = this.scene.layers;\r\n for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {\r\n var layer = layers_1[_i];\r\n layer._rebuild();\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n LayerSceneComponent.prototype.dispose = function () {\r\n var layers = this.scene.layers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n };\r\n LayerSceneComponent.prototype._draw = function (predicate) {\r\n var layers = this.scene.layers;\r\n if (layers.length) {\r\n this._engine.setDepthBuffer(false);\r\n for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {\r\n var layer = layers_2[_i];\r\n if (predicate(layer)) {\r\n layer.render();\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n };\r\n LayerSceneComponent.prototype._drawCameraPredicate = function (layer, isBackground, cameraLayerMask) {\r\n return !layer.renderOnlyInRenderTargetTextures &&\r\n layer.isBackground === isBackground &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawCameraBackground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, true, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawCameraForeground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, false, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetPredicate = function (layer, isBackground, cameraLayerMask, renderTargetTexture) {\r\n return (layer.renderTargetTextures.length > 0) &&\r\n layer.isBackground === isBackground &&\r\n (layer.renderTargetTextures.indexOf(renderTargetTexture) > -1) &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetBackground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, true, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetForeground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, false, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n LayerSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n _this.scene.layers.push(layer);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n LayerSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (dispose === void 0) { dispose = false; }\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n var index = _this.scene.layers.indexOf(layer);\r\n if (index !== -1) {\r\n _this.scene.layers.splice(index, 1);\r\n }\r\n if (dispose) {\r\n layer.dispose();\r\n }\r\n });\r\n };\r\n return LayerSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Legacy/legacy.ts\":\n/*!**************************!*\\\n !*** ./Legacy/legacy.ts ***!\n \\**************************/\n/*! exports provided: Debug, AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Debug\", function() { return Debug; });\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ \"./index.ts\");\n/* harmony import */ var _Debug_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Debug/index */ \"./Debug/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractScene\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractScene\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeepAssets\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeepAssets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetContainer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetContainer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Node\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Node\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scene\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneComponentConstants\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Stage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Stage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Action\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ActionEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Condition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ValueCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PredicateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SwitchBooleanAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SetStateAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SetValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"IncrementValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlayAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StopAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DoNothingAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CombineAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ExecuteCodeAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SetParentAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaySoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StopSoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InterpolateValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Animatable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_IAnimationState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TargetedAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationPropertiesOverride\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EasingFunction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CircleEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BackEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BounceEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubicEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ElasticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ExponentialEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PowerEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"QuadraticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"QuarticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"QuinticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SineEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BezierCurveEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RuntimeAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationKeyInterpolation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationRange\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Analyser\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AudioEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AudioSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SoundTrack\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WeightedSound\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoneIKController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoneLookController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Skeleton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TargetCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TouchCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DeviceOrientationCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcFollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"UniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoysticksCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Collider\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultCollisionCoordinator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PickingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"IntersectionInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_MeshCollisionData\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBox\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingSphere\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Ray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoneAxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DebugLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RayHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SkeletonViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancingAttributeInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthTextureCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EngineCapabilities\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EngineStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NullEngineOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NullEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebGLPipelineContext\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebGL2ShaderProcessor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NativeEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfoBase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ClipboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ClipboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StickValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Gamepad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GenericPad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GamepadManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GamepadSystemSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Xbox360Button\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Xbox360Dpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Xbox360Pad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DualShockButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DualShockDpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DualShockPad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AxisDragGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AxisScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBoxGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Gizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GizmoManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaneRotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PositionGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LightGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaneDragGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhotoDome\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_forceSceneHelpersToBundle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VideoDome\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EngineInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_TimeToken\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectLayerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GlowLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HighlightLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Layer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LayerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlare\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlareSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlareSystemSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Light\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DirectionalLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HemisphericLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpotLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultLoadingScreen\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoaderProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoaderFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectFallbacks\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingConfigurationDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Material\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaterialHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PushMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShaderMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StandardMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StandardMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BaseTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DynamicTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HDRCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InternalTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MirrorTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiRenderTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RawTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderTargetTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"UniformBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaterialFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectWrapper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Axis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TmpColors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Epsilon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Frustum\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Curve3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Plane\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Size\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Viewport\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphericalHarmonics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphericalPolynomial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Buffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CSG\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Geometry\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GroundMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TrailMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancedMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancedLinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_CreationDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_InstancesBatch\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VertexData\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplificationSettings\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplificationQueue\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplificationType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplicationQueueSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Polygon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PolygonMeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BaseSubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshLODLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TransformNode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CylinderBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TorusBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LinesBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GroundBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebGLDataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTargetManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Database\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BaseParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GPUParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Particle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticleHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_IDoNeedToBeInTheBuild\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticleSystemSet\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SolidParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ModelShape\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthSortedParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SolidParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubEmitterType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsEngineSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsRadialExplosionEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsUpdraftEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsVortexEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsRadialImpulseFalloff\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsUpdraftMode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DistanceJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MotorEnabledJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HingeJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Hinge2Joint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BlackAndWhitePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BloomEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BloomMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ChromaticAberrationPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CircleOfConfusionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ConvolutionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldEffectBlurLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldMergePostProcessOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DisplayPassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ExtractHighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FilterPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FxaaPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GrainPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MotionBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PassCubePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RefractionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SharpenPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicInterlacePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TonemappingOperator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TonemapPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VolumetricLightScatteringPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDistortionCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRMultiviewToSingleviewPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ReflectionProbe\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBoxRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LineEdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GeometryBufferRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GeometryBufferRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OutlineRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderingGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderingGroupInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderingManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"UtilityLayerRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Sprite\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpriteManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpritePackedManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpriteSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_AlphaState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_DepthCullingState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_StencilState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AndOrNotEvaluator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetTaskState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetsProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BinaryFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HDRCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EquiRectangularCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DDSTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"expandToProperty\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serialize\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsColor3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsFresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsVector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsVector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsMeshReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsColor4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsQuaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsMatrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsCameraReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SerializationHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Deferred\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshExploder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FilesInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KhronosTextureContainer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EventState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Observer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiObserver\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PerformanceMonitor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RollingAverage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PromisePolyfill\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HardwareScalingOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlaresOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CustomOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticlesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderTargetsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MergeMeshesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneOptimizerOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneSerializer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SmartArrayNoDuplicate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StringDictionary\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TGATools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"className\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AsyncLoop\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VideoRecorder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoystick\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WorkerPool\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_TypeStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FilesInputStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PivotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ScreenshotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebRequest\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InspectableType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BRDFTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RGBDTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Color3Gradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FactorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GradientHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PerfCounter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RetryStrategy\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LoadFileError\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AutoRotationBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BouncingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FramingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AttachToBoxBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FadeInOutBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SixDofDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraTouchInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraVirtualJoystickInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRCameraMetrics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebVRFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXREnterExitUI\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRSessionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Octree\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OctreeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OctreeSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_OcclusionDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_forceTransformFeedbackToBundle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DaydreamController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GearVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GenericController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OculusTouchController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ViveController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WindowsMotionController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGeneratorSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_BabylonLoaderRegistered\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BackgroundMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRBaseMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRSpecularGlossinessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorGradingTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RawCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RawTexture3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RefractionTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VideoTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HtmlElementTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DracoCompression\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TiledBoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DiscBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RibbonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HemisphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TorusKnotBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PolygonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShapeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LatheBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TiledPlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TubeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PolyhedronBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"IcoSphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DecalBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSCrowd\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoxParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ConeParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphereDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CannonJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AmmoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OimoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HDRTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PanoramaToCubeMapTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_BasisTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StandardRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimatedInputBlockTypes\"]; });\n\n\r\n\r\n/**\r\n * Legacy support, defining window.BABYLON (global variable).\r\n *\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nvar globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);\r\nif (typeof globalObject !== \"undefined\") {\r\n globalObject.BABYLON = BABYLON;\r\n globalObject.BABYLON = globalObject.BABYLON || {};\r\n var BABYLON = globalObject.BABYLON;\r\n BABYLON.Debug = BABYLON.Debug || {};\r\n var keys = [];\r\n for (var key in _Debug_index__WEBPACK_IMPORTED_MODULE_1__) {\r\n BABYLON.Debug[key] = _Debug_index__WEBPACK_IMPORTED_MODULE_1__[key];\r\n keys.push(key);\r\n }\r\n for (var key in _index__WEBPACK_IMPORTED_MODULE_0__) {\r\n BABYLON[key] = _index__WEBPACK_IMPORTED_MODULE_0__[key];\r\n }\r\n}\r\n\r\nvar Debug = {\r\n AxesViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"AxesViewer\"],\r\n BoneAxesViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"BoneAxesViewer\"],\r\n PhysicsViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsViewer\"],\r\n SkeletonViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"SkeletonViewer\"],\r\n};\r\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"../node_modules/webpack/buildin/global.js\")))\n\n/***/ }),\n\n/***/ \"./LensFlares/index.ts\":\n/*!*****************************!*\\\n !*** ./LensFlares/index.ts ***!\n \\*****************************/\n/*! exports provided: LensFlare, LensFlareSystem, LensFlareSystemSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _lensFlare__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lensFlare */ \"./LensFlares/lensFlare.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return _lensFlare__WEBPACK_IMPORTED_MODULE_0__[\"LensFlare\"]; });\n\n/* harmony import */ var _lensFlareSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lensFlareSystem */ \"./LensFlares/lensFlareSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return _lensFlareSystem__WEBPACK_IMPORTED_MODULE_1__[\"LensFlareSystem\"]; });\n\n/* harmony import */ var _lensFlareSystemSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lensFlareSystemSceneComponent */ \"./LensFlares/lensFlareSystemSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return _lensFlareSystemSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"LensFlareSystemSceneComponent\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./LensFlares/lensFlare.ts\":\n/*!*********************************!*\\\n !*** ./LensFlares/lensFlare.ts ***!\n \\*********************************/\n/*! exports provided: LensFlare */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return LensFlare; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n/**\r\n * This represents one of the lens effect in a `lensFlareSystem`.\r\n * It controls one of the indiviual texture used in the effect.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\nvar LensFlare = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Lens Flare.\r\n * This represents one of the lens effect in a `lensFlareSystem`.\r\n * It controls one of the indiviual texture used in the effect.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n * @param size Define the size of the lens flare in the system (a floating value between 0 and 1)\r\n * @param position Define the position of the lens flare in the system. (a floating value between -1 and 1). A value of 0 is located on the emitter. A value greater than 0 is beyond the emitter and a value lesser than 0 is behind.\r\n * @param color Define the lens color\r\n * @param imgUrl Define the lens texture url\r\n * @param system Define the `lensFlareSystem` this flare is part of\r\n */\r\n function LensFlare(\r\n /**\r\n * Define the size of the lens flare in the system (a floating value between 0 and 1)\r\n */\r\n size, \r\n /**\r\n * Define the position of the lens flare in the system. (a floating value between -1 and 1). A value of 0 is located on the emitter. A value greater than 0 is beyond the emitter and a value lesser than 0 is behind.\r\n */\r\n position, color, imgUrl, system) {\r\n this.size = size;\r\n this.position = position;\r\n /**\r\n * Define the alpha mode to render this particular lens.\r\n */\r\n this.alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_ONEONE;\r\n this.color = color || new _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color3\"](1, 1, 1);\r\n this.texture = imgUrl ? new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](imgUrl, system.getScene(), true) : null;\r\n this._system = system;\r\n system.lensFlares.push(this);\r\n }\r\n /**\r\n * Creates a new Lens Flare.\r\n * This represents one of the lens effect in a `lensFlareSystem`.\r\n * It controls one of the indiviual texture used in the effect.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n * @param size Define the size of the lens flare (a floating value between 0 and 1)\r\n * @param position Define the position of the lens flare in the system. (a floating value between -1 and 1). A value of 0 is located on the emitter. A value greater than 0 is beyond the emitter and a value lesser than 0 is behind.\r\n * @param color Define the lens color\r\n * @param imgUrl Define the lens texture url\r\n * @param system Define the `lensFlareSystem` this flare is part of\r\n * @returns The newly created Lens Flare\r\n */\r\n LensFlare.AddFlare = function (size, position, color, imgUrl, system) {\r\n return new LensFlare(size, position, color, imgUrl, system);\r\n };\r\n /**\r\n * Dispose and release the lens flare with its associated resources.\r\n */\r\n LensFlare.prototype.dispose = function () {\r\n if (this.texture) {\r\n this.texture.dispose();\r\n }\r\n // Remove from scene\r\n var index = this._system.lensFlares.indexOf(this);\r\n this._system.lensFlares.splice(index, 1);\r\n };\r\n return LensFlare;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./LensFlares/lensFlareSystem.ts\":\n/*!***************************************!*\\\n !*** ./LensFlares/lensFlareSystem.ts ***!\n \\***************************************/\n/*! exports provided: LensFlareSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return LensFlareSystem; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _lensFlare__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lensFlare */ \"./LensFlares/lensFlare.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_lensFlare_fragment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Shaders/lensFlare.fragment */ \"./Shaders/lensFlare.fragment.ts\");\n/* harmony import */ var _Shaders_lensFlare_vertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/lensFlare.vertex */ \"./Shaders/lensFlare.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a Lens Flare System or the shiny effect created by the light reflection on the camera lenses.\r\n * It is usually composed of several `lensFlare`.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\nvar LensFlareSystem = /** @class */ (function () {\r\n /**\r\n * Instantiates a lens flare system.\r\n * This represents a Lens Flare System or the shiny effect created by the light reflection on the camera lenses.\r\n * It is usually composed of several `lensFlare`.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n * @param name Define the name of the lens flare system in the scene\r\n * @param emitter Define the source (the emitter) of the lens flares (it can be a camera, a light or a mesh).\r\n * @param scene Define the scene the lens flare system belongs to\r\n */\r\n function LensFlareSystem(\r\n /**\r\n * Define the name of the lens flare system\r\n */\r\n name, emitter, scene) {\r\n this.name = name;\r\n /**\r\n * List of lens flares used in this system.\r\n */\r\n this.lensFlares = new Array();\r\n /**\r\n * Define a limit from the border the lens flare can be visible.\r\n */\r\n this.borderLimit = 300;\r\n /**\r\n * Define a viewport border we do not want to see the lens flare in.\r\n */\r\n this.viewportBorder = 0;\r\n /**\r\n * Restricts the rendering of the effect to only the camera rendering this layer mask.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n this._vertexBuffers = {};\r\n this._isEnabled = true;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene;\r\n LensFlareSystem._SceneComponentInitialization(this._scene);\r\n this._emitter = emitter;\r\n this.id = name;\r\n scene.lensFlareSystems.push(this);\r\n this.meshesSelectionPredicate = function (m) { return (scene.activeCamera && m.material && m.isVisible && m.isEnabled() && m.isBlocker && ((m.layerMask & scene.activeCamera.layerMask) != 0)); };\r\n var engine = scene.getEngine();\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"](engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n // Effects\r\n this._effect = engine.createEffect(\"lensFlare\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind], [\"color\", \"viewportMatrix\"], [\"textureSampler\"], \"\");\r\n }\r\n Object.defineProperty(LensFlareSystem.prototype, \"isEnabled\", {\r\n /**\r\n * Define if the lens flare system is enabled.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n set: function (value) {\r\n this._isEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the scene the effects belongs to.\r\n * @returns the scene holding the lens flare system\r\n */\r\n LensFlareSystem.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Get the emitter of the lens flare system.\r\n * It defines the source of the lens flares (it can be a camera, a light or a mesh).\r\n * @returns the emitter of the lens flare system\r\n */\r\n LensFlareSystem.prototype.getEmitter = function () {\r\n return this._emitter;\r\n };\r\n /**\r\n * Set the emitter of the lens flare system.\r\n * It defines the source of the lens flares (it can be a camera, a light or a mesh).\r\n * @param newEmitter Define the new emitter of the system\r\n */\r\n LensFlareSystem.prototype.setEmitter = function (newEmitter) {\r\n this._emitter = newEmitter;\r\n };\r\n /**\r\n * Get the lens flare system emitter position.\r\n * The emitter defines the source of the lens flares (it can be a camera, a light or a mesh).\r\n * @returns the position\r\n */\r\n LensFlareSystem.prototype.getEmitterPosition = function () {\r\n return this._emitter.getAbsolutePosition ? this._emitter.getAbsolutePosition() : this._emitter.position;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n LensFlareSystem.prototype.computeEffectivePosition = function (globalViewport) {\r\n var position = this.getEmitterPosition();\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Project(position, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity(), this._scene.getTransformMatrix(), globalViewport);\r\n this._positionX = position.x;\r\n this._positionY = position.y;\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix());\r\n if (this.viewportBorder > 0) {\r\n globalViewport.x -= this.viewportBorder;\r\n globalViewport.y -= this.viewportBorder;\r\n globalViewport.width += this.viewportBorder * 2;\r\n globalViewport.height += this.viewportBorder * 2;\r\n position.x += this.viewportBorder;\r\n position.y += this.viewportBorder;\r\n this._positionX += this.viewportBorder;\r\n this._positionY += this.viewportBorder;\r\n }\r\n if (position.z > 0) {\r\n if ((this._positionX > globalViewport.x) && (this._positionX < globalViewport.x + globalViewport.width)) {\r\n if ((this._positionY > globalViewport.y) && (this._positionY < globalViewport.y + globalViewport.height)) {\r\n return true;\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n LensFlareSystem.prototype._isVisible = function () {\r\n if (!this._isEnabled || !this._scene.activeCamera) {\r\n return false;\r\n }\r\n var emitterPosition = this.getEmitterPosition();\r\n var direction = emitterPosition.subtract(this._scene.activeCamera.globalPosition);\r\n var distance = direction.length();\r\n direction.normalize();\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](this._scene.activeCamera.globalPosition, direction);\r\n var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);\r\n return !pickInfo || !pickInfo.hit || pickInfo.distance > distance;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n LensFlareSystem.prototype.render = function () {\r\n if (!this._effect.isReady() || !this._scene.activeCamera) {\r\n return false;\r\n }\r\n var engine = this._scene.getEngine();\r\n var viewport = this._scene.activeCamera.viewport;\r\n var globalViewport = viewport.toGlobal(engine.getRenderWidth(true), engine.getRenderHeight(true));\r\n // Position\r\n if (!this.computeEffectivePosition(globalViewport)) {\r\n return false;\r\n }\r\n // Visibility\r\n if (!this._isVisible()) {\r\n return false;\r\n }\r\n // Intensity\r\n var awayX;\r\n var awayY;\r\n if (this._positionX < this.borderLimit + globalViewport.x) {\r\n awayX = this.borderLimit + globalViewport.x - this._positionX;\r\n }\r\n else if (this._positionX > globalViewport.x + globalViewport.width - this.borderLimit) {\r\n awayX = this._positionX - globalViewport.x - globalViewport.width + this.borderLimit;\r\n }\r\n else {\r\n awayX = 0;\r\n }\r\n if (this._positionY < this.borderLimit + globalViewport.y) {\r\n awayY = this.borderLimit + globalViewport.y - this._positionY;\r\n }\r\n else if (this._positionY > globalViewport.y + globalViewport.height - this.borderLimit) {\r\n awayY = this._positionY - globalViewport.y - globalViewport.height + this.borderLimit;\r\n }\r\n else {\r\n awayY = 0;\r\n }\r\n var away = (awayX > awayY) ? awayX : awayY;\r\n away -= this.viewportBorder;\r\n if (away > this.borderLimit) {\r\n away = this.borderLimit;\r\n }\r\n var intensity = 1.0 - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Clamp(away / this.borderLimit, 0, 1);\r\n if (intensity < 0) {\r\n return false;\r\n }\r\n if (intensity > 1.0) {\r\n intensity = 1.0;\r\n }\r\n if (this.viewportBorder > 0) {\r\n globalViewport.x += this.viewportBorder;\r\n globalViewport.y += this.viewportBorder;\r\n globalViewport.width -= this.viewportBorder * 2;\r\n globalViewport.height -= this.viewportBorder * 2;\r\n this._positionX -= this.viewportBorder;\r\n this._positionY -= this.viewportBorder;\r\n }\r\n // Position\r\n var centerX = globalViewport.x + globalViewport.width / 2;\r\n var centerY = globalViewport.y + globalViewport.height / 2;\r\n var distX = centerX - this._positionX;\r\n var distY = centerY - this._positionY;\r\n // Effects\r\n engine.enableEffect(this._effect);\r\n engine.setState(false);\r\n engine.setDepthBuffer(false);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);\r\n // Flares\r\n for (var index = 0; index < this.lensFlares.length; index++) {\r\n var flare = this.lensFlares[index];\r\n if (flare.texture && !flare.texture.isReady()) {\r\n continue;\r\n }\r\n engine.setAlphaMode(flare.alphaMode);\r\n var x = centerX - (distX * flare.position);\r\n var y = centerY - (distY * flare.position);\r\n var cw = flare.size;\r\n var ch = flare.size * engine.getAspectRatio(this._scene.activeCamera, true);\r\n var cx = 2 * (x / (globalViewport.width + globalViewport.x * 2)) - 1.0;\r\n var cy = 1.0 - 2 * (y / (globalViewport.height + globalViewport.y * 2));\r\n var viewportMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromValues(cw / 2, 0, 0, 0, 0, ch / 2, 0, 0, 0, 0, 1, 0, cx, cy, 0, 1);\r\n this._effect.setMatrix(\"viewportMatrix\", viewportMatrix);\r\n // Texture\r\n this._effect.setTexture(\"textureSampler\", flare.texture);\r\n // Color\r\n this._effect.setFloat4(\"color\", flare.color.r * intensity, flare.color.g * intensity, flare.color.b * intensity, 1.0);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n engine.setDepthBuffer(true);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].ALPHA_DISABLE);\r\n return true;\r\n };\r\n /**\r\n * Dispose and release the lens flare with its associated resources.\r\n */\r\n LensFlareSystem.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n while (this.lensFlares.length) {\r\n this.lensFlares[0].dispose();\r\n }\r\n // Remove from scene\r\n var index = this._scene.lensFlareSystems.indexOf(this);\r\n this._scene.lensFlareSystems.splice(index, 1);\r\n };\r\n /**\r\n * Parse a lens flare system from a JSON repressentation\r\n * @param parsedLensFlareSystem Define the JSON to parse\r\n * @param scene Define the scene the parsed system should be instantiated in\r\n * @param rootUrl Define the rootUrl of the load sequence to easily find a load relative dependencies such as textures\r\n * @returns the parsed system\r\n */\r\n LensFlareSystem.Parse = function (parsedLensFlareSystem, scene, rootUrl) {\r\n var emitter = scene.getLastEntryByID(parsedLensFlareSystem.emitterId);\r\n var name = parsedLensFlareSystem.name || \"lensFlareSystem#\" + parsedLensFlareSystem.emitterId;\r\n var lensFlareSystem = new LensFlareSystem(name, emitter, scene);\r\n lensFlareSystem.id = parsedLensFlareSystem.id || name;\r\n lensFlareSystem.borderLimit = parsedLensFlareSystem.borderLimit;\r\n for (var index = 0; index < parsedLensFlareSystem.flares.length; index++) {\r\n var parsedFlare = parsedLensFlareSystem.flares[index];\r\n _lensFlare__WEBPACK_IMPORTED_MODULE_7__[\"LensFlare\"].AddFlare(parsedFlare.size, parsedFlare.position, _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__[\"Color3\"].FromArray(parsedFlare.color), parsedFlare.textureName ? rootUrl + parsedFlare.textureName : \"\", lensFlareSystem);\r\n }\r\n return lensFlareSystem;\r\n };\r\n /**\r\n * Serialize the current Lens Flare System into a JSON representation.\r\n * @returns the serialized JSON\r\n */\r\n LensFlareSystem.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.id;\r\n serializationObject.name = this.name;\r\n serializationObject.emitterId = this.getEmitter().id;\r\n serializationObject.borderLimit = this.borderLimit;\r\n serializationObject.flares = [];\r\n for (var index = 0; index < this.lensFlares.length; index++) {\r\n var flare = this.lensFlares[index];\r\n serializationObject.flares.push({\r\n size: flare.size,\r\n position: flare.position,\r\n color: flare.color.asArray(),\r\n textureName: _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetFilename(flare.texture ? flare.texture.name : \"\")\r\n });\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n LensFlareSystem._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_11__[\"_DevTools\"].WarnImport(\"LensFlareSystemSceneComponent\");\r\n };\r\n return LensFlareSystem;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./LensFlares/lensFlareSystemSceneComponent.ts\":\n/*!*****************************************************!*\\\n !*** ./LensFlares/lensFlareSystemSceneComponent.ts ***!\n \\*****************************************************/\n/*! exports provided: LensFlareSystemSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return LensFlareSystemSceneComponent; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _lensFlareSystem__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lensFlareSystem */ \"./LensFlares/lensFlareSystem.ts\");\n\r\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_LENSFLARESYSTEM, function (parsedData, scene, container, rootUrl) {\r\n // Lens flares\r\n if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {\r\n if (!container.lensFlareSystems) {\r\n container.lensFlareSystems = new Array();\r\n }\r\n for (var index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {\r\n var parsedLensFlareSystem = parsedData.lensFlareSystems[index];\r\n var lf = _lensFlareSystem__WEBPACK_IMPORTED_MODULE_3__[\"LensFlareSystem\"].Parse(parsedLensFlareSystem, scene, rootUrl);\r\n container.lensFlareSystems.push(lf);\r\n }\r\n }\r\n});\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.getLensFlareSystemByName = function (name) {\r\n for (var index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].name === name) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n return null;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.getLensFlareSystemByID = function (id) {\r\n for (var index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].id === id) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n return null;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.removeLensFlareSystem = function (toRemove) {\r\n var index = this.lensFlareSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.lensFlareSystems.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.addLensFlareSystem = function (newLensFlareSystem) {\r\n this.lensFlareSystems.push(newLensFlareSystem);\r\n};\r\n/**\r\n * Defines the lens flare scene component responsible to manage any lens flares\r\n * in a given scene.\r\n */\r\nvar LensFlareSystemSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function LensFlareSystemSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_LENSFLARESYSTEM;\r\n this.scene = scene;\r\n scene.lensFlareSystems = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n LensFlareSystemSceneComponent.prototype.register = function () {\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_LENSFLARESYSTEM, this, this._draw);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n LensFlareSystemSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for lens flare\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n LensFlareSystemSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach(function (o) {\r\n _this.scene.addLensFlareSystem(o);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n LensFlareSystemSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach(function (o) {\r\n _this.scene.removeLensFlareSystem(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n LensFlareSystemSceneComponent.prototype.serialize = function (serializationObject) {\r\n // Lens flares\r\n serializationObject.lensFlareSystems = [];\r\n var lensFlareSystems = this.scene.lensFlareSystems;\r\n for (var _i = 0, lensFlareSystems_1 = lensFlareSystems; _i < lensFlareSystems_1.length; _i++) {\r\n var lensFlareSystem = lensFlareSystems_1[_i];\r\n serializationObject.lensFlareSystems.push(lensFlareSystem.serialize());\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n LensFlareSystemSceneComponent.prototype.dispose = function () {\r\n var lensFlareSystems = this.scene.lensFlareSystems;\r\n while (lensFlareSystems.length) {\r\n lensFlareSystems[0].dispose();\r\n }\r\n };\r\n LensFlareSystemSceneComponent.prototype._draw = function (camera) {\r\n // Lens flares\r\n if (this.scene.lensFlaresEnabled) {\r\n var lensFlareSystems = this.scene.lensFlareSystems;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n for (var _i = 0, lensFlareSystems_2 = lensFlareSystems; _i < lensFlareSystems_2.length; _i++) {\r\n var lensFlareSystem = lensFlareSystems_2[_i];\r\n if ((camera.layerMask & lensFlareSystem.layerMask) !== 0) {\r\n lensFlareSystem.render();\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n }\r\n };\r\n return LensFlareSystemSceneComponent;\r\n}());\r\n\r\n_lensFlareSystem__WEBPACK_IMPORTED_MODULE_3__[\"LensFlareSystem\"]._SceneComponentInitialization = function (scene) {\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_LENSFLARESYSTEM);\r\n if (!component) {\r\n component = new LensFlareSystemSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Lights/Shadows/index.ts\":\n/*!*********************************!*\\\n !*** ./Lights/Shadows/index.ts ***!\n \\*********************************/\n/*! exports provided: ShadowGenerator, ShadowGeneratorSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shadowGenerator */ \"./Lights/Shadows/shadowGenerator.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"]; });\n\n/* harmony import */ var _shadowGeneratorSceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shadowGeneratorSceneComponent */ \"./Lights/Shadows/shadowGeneratorSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _shadowGeneratorSceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"ShadowGeneratorSceneComponent\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/Shadows/shadowGenerator.ts\":\n/*!*******************************************!*\\\n !*** ./Lights/Shadows/shadowGenerator.ts ***!\n \\*******************************************/\n/*! exports provided: ShadowGenerator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return ShadowGenerator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_shadowMap_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Shaders/shadowMap.fragment */ \"./Shaders/shadowMap.fragment.ts\");\n/* harmony import */ var _Shaders_shadowMap_vertex__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Shaders/shadowMap.vertex */ \"./Shaders/shadowMap.vertex.ts\");\n/* harmony import */ var _Shaders_depthBoxBlur_fragment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Shaders/depthBoxBlur.fragment */ \"./Shaders/depthBoxBlur.fragment.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default implementation IShadowGenerator.\r\n * This is the main object responsible of generating shadows in the framework.\r\n * Documentation: https://doc.babylonjs.com/babylon101/shadows\r\n */\r\nvar ShadowGenerator = /** @class */ (function () {\r\n /**\r\n * Creates a ShadowGenerator object.\r\n * A ShadowGenerator is the required tool to use the shadows.\r\n * Each light casting shadows needs to use its own ShadowGenerator.\r\n * Documentation : https://doc.babylonjs.com/babylon101/shadows\r\n * @param mapSize The size of the texture what stores the shadows. Example : 1024.\r\n * @param light The light object generating the shadows.\r\n * @param usefulFloatFirst By default the generator will try to use half float textures but if you need precision (for self shadowing for instance), you can use this option to enforce full float texture.\r\n */\r\n function ShadowGenerator(mapSize, light, usefulFloatFirst) {\r\n /**\r\n * Observable triggered before the shadow is rendered. Can be used to update internal effect state\r\n */\r\n this.onBeforeShadowMapRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n /**\r\n * Observable triggered after the shadow is rendered. Can be used to restore internal effect state\r\n */\r\n this.onAfterShadowMapRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n /**\r\n * Observable triggered before a mesh is rendered in the shadow map.\r\n * Can be used to update internal effect state (that you can get from the onBeforeShadowMapRenderObservable)\r\n */\r\n this.onBeforeShadowMapRenderMeshObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n /**\r\n * Observable triggered after a mesh is rendered in the shadow map.\r\n * Can be used to update internal effect state (that you can get from the onAfterShadowMapRenderObservable)\r\n */\r\n this.onAfterShadowMapRenderMeshObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n this._bias = 0.00005;\r\n this._normalBias = 0;\r\n this._blurBoxOffset = 1;\r\n this._blurScale = 2;\r\n this._blurKernel = 1;\r\n this._useKernelBlur = false;\r\n this._filter = ShadowGenerator.FILTER_NONE;\r\n this._filteringQuality = ShadowGenerator.QUALITY_HIGH;\r\n this._contactHardeningLightSizeUVRatio = 0.1;\r\n this._darkness = 0;\r\n this._transparencyShadow = false;\r\n /**\r\n * Controls the extent to which the shadows fade out at the edge of the frustum\r\n * Used only by directionals and spots\r\n */\r\n this.frustumEdgeFalloff = 0;\r\n /**\r\n * If true the shadow map is generated by rendering the back face of the mesh instead of the front face.\r\n * This can help with self-shadowing as the geometry making up the back of objects is slightly offset.\r\n * It might on the other hand introduce peter panning.\r\n */\r\n this.forceBackFacesOnly = false;\r\n this._lightDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._viewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n this._projectionMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n this._cachedPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cachedDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._currentFaceIndex = 0;\r\n this._currentFaceIndexCache = 0;\r\n this._defaultTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n this._mapSize = mapSize;\r\n this._light = light;\r\n this._scene = light.getScene();\r\n light._shadowGenerator = this;\r\n ShadowGenerator._SceneComponentInitialization(this._scene);\r\n // Texture type fallback from float to int if not supported.\r\n var caps = this._scene.getEngine().getCaps();\r\n if (!usefulFloatFirst) {\r\n if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n else {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n }\r\n else {\r\n if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n }\r\n this._initializeGenerator();\r\n this._applyFilterValues();\r\n }\r\n Object.defineProperty(ShadowGenerator.prototype, \"bias\", {\r\n /**\r\n * Gets the bias: offset applied on the depth preventing acnea (in light direction).\r\n */\r\n get: function () {\r\n return this._bias;\r\n },\r\n /**\r\n * Sets the bias: offset applied on the depth preventing acnea (in light direction).\r\n */\r\n set: function (bias) {\r\n this._bias = bias;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"normalBias\", {\r\n /**\r\n * Gets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle).\r\n */\r\n get: function () {\r\n return this._normalBias;\r\n },\r\n /**\r\n * Sets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle).\r\n */\r\n set: function (normalBias) {\r\n this._normalBias = normalBias;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"blurBoxOffset\", {\r\n /**\r\n * Gets the blur box offset: offset applied during the blur pass.\r\n * Only useful if useKernelBlur = false\r\n */\r\n get: function () {\r\n return this._blurBoxOffset;\r\n },\r\n /**\r\n * Sets the blur box offset: offset applied during the blur pass.\r\n * Only useful if useKernelBlur = false\r\n */\r\n set: function (value) {\r\n if (this._blurBoxOffset === value) {\r\n return;\r\n }\r\n this._blurBoxOffset = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"blurScale\", {\r\n /**\r\n * Gets the blur scale: scale of the blurred texture compared to the main shadow map.\r\n * 2 means half of the size.\r\n */\r\n get: function () {\r\n return this._blurScale;\r\n },\r\n /**\r\n * Sets the blur scale: scale of the blurred texture compared to the main shadow map.\r\n * 2 means half of the size.\r\n */\r\n set: function (value) {\r\n if (this._blurScale === value) {\r\n return;\r\n }\r\n this._blurScale = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"blurKernel\", {\r\n /**\r\n * Gets the blur kernel: kernel size of the blur pass.\r\n * Only useful if useKernelBlur = true\r\n */\r\n get: function () {\r\n return this._blurKernel;\r\n },\r\n /**\r\n * Sets the blur kernel: kernel size of the blur pass.\r\n * Only useful if useKernelBlur = true\r\n */\r\n set: function (value) {\r\n if (this._blurKernel === value) {\r\n return;\r\n }\r\n this._blurKernel = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useKernelBlur\", {\r\n /**\r\n * Gets whether the blur pass is a kernel blur (if true) or box blur.\r\n * Only useful in filtered mode (useBlurExponentialShadowMap...)\r\n */\r\n get: function () {\r\n return this._useKernelBlur;\r\n },\r\n /**\r\n * Sets whether the blur pass is a kernel blur (if true) or box blur.\r\n * Only useful in filtered mode (useBlurExponentialShadowMap...)\r\n */\r\n set: function (value) {\r\n if (this._useKernelBlur === value) {\r\n return;\r\n }\r\n this._useKernelBlur = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"depthScale\", {\r\n /**\r\n * Gets the depth scale used in ESM mode.\r\n */\r\n get: function () {\r\n return this._depthScale !== undefined ? this._depthScale : this._light.getDepthScale();\r\n },\r\n /**\r\n * Sets the depth scale used in ESM mode.\r\n * This can override the scale stored on the light.\r\n */\r\n set: function (value) {\r\n this._depthScale = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"filter\", {\r\n /**\r\n * Gets the current mode of the shadow generator (normal, PCF, ESM...).\r\n * The returned value is a number equal to one of the available mode defined in ShadowMap.FILTER_x like _FILTER_NONE\r\n */\r\n get: function () {\r\n return this._filter;\r\n },\r\n /**\r\n * Sets the current mode of the shadow generator (normal, PCF, ESM...).\r\n * The returned value is a number equal to one of the available mode defined in ShadowMap.FILTER_x like _FILTER_NONE\r\n */\r\n set: function (value) {\r\n // Blurring the cubemap is going to be too expensive. Reverting to unblurred version\r\n if (this._light.needCube()) {\r\n if (value === ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP) {\r\n this.useExponentialShadowMap = true;\r\n return;\r\n }\r\n else if (value === ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) {\r\n this.useCloseExponentialShadowMap = true;\r\n return;\r\n }\r\n // PCF on cubemap would also be expensive\r\n else if (value === ShadowGenerator.FILTER_PCF || value === ShadowGenerator.FILTER_PCSS) {\r\n this.usePoissonSampling = true;\r\n return;\r\n }\r\n }\r\n // Weblg1 fallback for PCF.\r\n if (value === ShadowGenerator.FILTER_PCF || value === ShadowGenerator.FILTER_PCSS) {\r\n if (this._scene.getEngine().webGLVersion === 1) {\r\n this.usePoissonSampling = true;\r\n return;\r\n }\r\n }\r\n if (this._filter === value) {\r\n return;\r\n }\r\n this._filter = value;\r\n this._disposeBlurPostProcesses();\r\n this._applyFilterValues();\r\n this._light._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"usePoissonSampling\", {\r\n /**\r\n * Gets if the current filter is set to Poisson Sampling.\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_POISSONSAMPLING;\r\n },\r\n /**\r\n * Sets the current filter to Poisson Sampling.\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_POISSONSAMPLING) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to ESM.\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Sets the current filter is to ESM.\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useBlurExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to filtered ESM.\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Gets if the current filter is set to filtered ESM.\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useCloseExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Sets the current filter to \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useBlurCloseExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to filtered \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Sets the current filter to filtered \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"usePercentageCloserFiltering\", {\r\n /**\r\n * Gets if the current filter is set to \"PCF\" (percentage closer filtering).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_PCF;\r\n },\r\n /**\r\n * Sets the current filter to \"PCF\" (percentage closer filtering).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_PCF) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_PCF : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"filteringQuality\", {\r\n /**\r\n * Gets the PCF or PCSS Quality.\r\n * Only valid if usePercentageCloserFiltering or usePercentageCloserFiltering is true.\r\n */\r\n get: function () {\r\n return this._filteringQuality;\r\n },\r\n /**\r\n * Sets the PCF or PCSS Quality.\r\n * Only valid if usePercentageCloserFiltering or usePercentageCloserFiltering is true.\r\n */\r\n set: function (filteringQuality) {\r\n if (this._filteringQuality === filteringQuality) {\r\n return;\r\n }\r\n this._filteringQuality = filteringQuality;\r\n this._disposeBlurPostProcesses();\r\n this._applyFilterValues();\r\n this._light._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useContactHardeningShadow\", {\r\n /**\r\n * Gets if the current filter is set to \"PCSS\" (contact hardening).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_PCSS;\r\n },\r\n /**\r\n * Sets the current filter to \"PCSS\" (contact hardening).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_PCSS) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_PCSS : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"contactHardeningLightSizeUVRatio\", {\r\n /**\r\n * Gets the Light Size (in shadow map uv unit) used in PCSS to determine the blocker search area and the penumbra size.\r\n * Using a ratio helps keeping shape stability independently of the map size.\r\n *\r\n * It does not account for the light projection as it was having too much\r\n * instability during the light setup or during light position changes.\r\n *\r\n * Only valid if useContactHardeningShadow is true.\r\n */\r\n get: function () {\r\n return this._contactHardeningLightSizeUVRatio;\r\n },\r\n /**\r\n * Sets the Light Size (in shadow map uv unit) used in PCSS to determine the blocker search area and the penumbra size.\r\n * Using a ratio helps keeping shape stability independently of the map size.\r\n *\r\n * It does not account for the light projection as it was having too much\r\n * instability during the light setup or during light position changes.\r\n *\r\n * Only valid if useContactHardeningShadow is true.\r\n */\r\n set: function (contactHardeningLightSizeUVRatio) {\r\n this._contactHardeningLightSizeUVRatio = contactHardeningLightSizeUVRatio;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"darkness\", {\r\n /** Gets or sets the actual darkness of a shadow */\r\n get: function () {\r\n return this._darkness;\r\n },\r\n set: function (value) {\r\n this.setDarkness(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the darkness value (float). This can only decrease the actual darkness of a shadow.\r\n * 0 means strongest and 1 would means no shadow.\r\n * @returns the darkness.\r\n */\r\n ShadowGenerator.prototype.getDarkness = function () {\r\n return this._darkness;\r\n };\r\n /**\r\n * Sets the darkness value (float). This can only decrease the actual darkness of a shadow.\r\n * @param darkness The darkness value 0 means strongest and 1 would means no shadow.\r\n * @returns the shadow generator allowing fluent coding.\r\n */\r\n ShadowGenerator.prototype.setDarkness = function (darkness) {\r\n if (darkness >= 1.0) {\r\n this._darkness = 1.0;\r\n }\r\n else if (darkness <= 0.0) {\r\n this._darkness = 0.0;\r\n }\r\n else {\r\n this._darkness = darkness;\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(ShadowGenerator.prototype, \"transparencyShadow\", {\r\n /** Gets or sets the ability to have transparent shadow */\r\n get: function () {\r\n return this._transparencyShadow;\r\n },\r\n set: function (value) {\r\n this.setTransparencyShadow(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the ability to have transparent shadow (boolean).\r\n * @param transparent True if transparent else False\r\n * @returns the shadow generator allowing fluent coding\r\n */\r\n ShadowGenerator.prototype.setTransparencyShadow = function (transparent) {\r\n this._transparencyShadow = transparent;\r\n return this;\r\n };\r\n /**\r\n * Gets the main RTT containing the shadow map (usually storing depth from the light point of view).\r\n * @returns The render target texture if present otherwise, null\r\n */\r\n ShadowGenerator.prototype.getShadowMap = function () {\r\n return this._shadowMap;\r\n };\r\n /**\r\n * Gets the RTT used during rendering (can be a blurred version of the shadow map or the shadow map itself).\r\n * @returns The render target texture if the shadow map is present otherwise, null\r\n */\r\n ShadowGenerator.prototype.getShadowMapForRendering = function () {\r\n if (this._shadowMap2) {\r\n return this._shadowMap2;\r\n }\r\n return this._shadowMap;\r\n };\r\n /**\r\n * Gets the class name of that object\r\n * @returns \"ShadowGenerator\"\r\n */\r\n ShadowGenerator.prototype.getClassName = function () {\r\n return \"ShadowGenerator\";\r\n };\r\n /**\r\n * Helper function to add a mesh and its descendants to the list of shadow casters.\r\n * @param mesh Mesh to add\r\n * @param includeDescendants boolean indicating if the descendants should be added. Default to true\r\n * @returns the Shadow Generator itself\r\n */\r\n ShadowGenerator.prototype.addShadowCaster = function (mesh, includeDescendants) {\r\n var _a;\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (!this._shadowMap) {\r\n return this;\r\n }\r\n if (!this._shadowMap.renderList) {\r\n this._shadowMap.renderList = [];\r\n }\r\n this._shadowMap.renderList.push(mesh);\r\n if (includeDescendants) {\r\n (_a = this._shadowMap.renderList).push.apply(_a, mesh.getChildMeshes());\r\n }\r\n return this;\r\n };\r\n /**\r\n * Helper function to remove a mesh and its descendants from the list of shadow casters\r\n * @param mesh Mesh to remove\r\n * @param includeDescendants boolean indicating if the descendants should be removed. Default to true\r\n * @returns the Shadow Generator itself\r\n */\r\n ShadowGenerator.prototype.removeShadowCaster = function (mesh, includeDescendants) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (!this._shadowMap || !this._shadowMap.renderList) {\r\n return this;\r\n }\r\n var index = this._shadowMap.renderList.indexOf(mesh);\r\n if (index !== -1) {\r\n this._shadowMap.renderList.splice(index, 1);\r\n }\r\n if (includeDescendants) {\r\n for (var _i = 0, _a = mesh.getChildren(); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n this.removeShadowCaster(child);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the associated light object.\r\n * @returns the light generating the shadow\r\n */\r\n ShadowGenerator.prototype.getLight = function () {\r\n return this._light;\r\n };\r\n ShadowGenerator.prototype._initializeGenerator = function () {\r\n this._light._markMeshesAsLightDirty();\r\n this._initializeShadowMap();\r\n };\r\n ShadowGenerator.prototype._initializeShadowMap = function () {\r\n var _this = this;\r\n // Render target\r\n var engine = this._scene.getEngine();\r\n if (engine.webGLVersion > 1) {\r\n this._shadowMap = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](this._light.name + \"_shadowMap\", this._mapSize, this._scene, false, true, this._textureType, this._light.needCube(), undefined, false, false);\r\n this._shadowMap.createDepthStencilTexture(_Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].LESS, true);\r\n }\r\n else {\r\n this._shadowMap = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](this._light.name + \"_shadowMap\", this._mapSize, this._scene, false, true, this._textureType, this._light.needCube());\r\n }\r\n this._shadowMap.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap.anisotropicFilteringLevel = 1;\r\n this._shadowMap.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._shadowMap.renderParticles = false;\r\n this._shadowMap.ignoreCameraViewport = true;\r\n // Record Face Index before render.\r\n this._shadowMap.onBeforeRenderObservable.add(function (faceIndex) {\r\n _this._currentFaceIndex = faceIndex;\r\n if (_this._filter === ShadowGenerator.FILTER_PCF) {\r\n engine.setColorWrite(false);\r\n }\r\n });\r\n // Custom render function.\r\n this._shadowMap.customRenderFunction = this._renderForShadowMap.bind(this);\r\n // Blur if required afer render.\r\n this._shadowMap.onAfterUnbindObservable.add(function () {\r\n if (_this._filter === ShadowGenerator.FILTER_PCF) {\r\n engine.setColorWrite(true);\r\n }\r\n if (!_this.useBlurExponentialShadowMap && !_this.useBlurCloseExponentialShadowMap) {\r\n return;\r\n }\r\n var shadowMap = _this.getShadowMapForRendering();\r\n if (shadowMap) {\r\n _this._scene.postProcessManager.directRender(_this._blurPostProcesses, shadowMap.getInternalTexture(), true);\r\n }\r\n });\r\n // Clear according to the chosen filter.\r\n var clearZero = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n var clearOne = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n this._shadowMap.onClearObservable.add(function (engine) {\r\n if (_this._filter === ShadowGenerator.FILTER_PCF) {\r\n engine.clear(clearOne, false, true, false);\r\n }\r\n else if (_this.useExponentialShadowMap || _this.useBlurExponentialShadowMap) {\r\n engine.clear(clearZero, true, true, false);\r\n }\r\n else {\r\n engine.clear(clearOne, true, true, false);\r\n }\r\n });\r\n this._shadowMap.onResizeObservable.add(function (RTT) {\r\n _this._mapSize = RTT.getRenderSize();\r\n _this._light._markMeshesAsLightDirty();\r\n _this.recreateShadowMap();\r\n });\r\n };\r\n ShadowGenerator.prototype._initializeBlurRTTAndPostProcesses = function () {\r\n var _this = this;\r\n var engine = this._scene.getEngine();\r\n var targetSize = this._mapSize / this.blurScale;\r\n if (!this.useKernelBlur || this.blurScale !== 1.0) {\r\n this._shadowMap2 = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](this._light.name + \"_shadowMap2\", targetSize, this._scene, false, true, this._textureType);\r\n this._shadowMap2.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap2.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap2.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n }\r\n if (this.useKernelBlur) {\r\n this._kernelBlurXPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](this._light.name + \"KernelBlurX\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1, 0), this.blurKernel, 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._textureType);\r\n this._kernelBlurXPostprocess.width = targetSize;\r\n this._kernelBlurXPostprocess.height = targetSize;\r\n this._kernelBlurXPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._shadowMap);\r\n });\r\n this._kernelBlurYPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](this._light.name + \"KernelBlurY\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1), this.blurKernel, 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._textureType);\r\n this._kernelBlurXPostprocess.autoClear = false;\r\n this._kernelBlurYPostprocess.autoClear = false;\r\n if (this._textureType === _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n this._kernelBlurXPostprocess.packedFloat = true;\r\n this._kernelBlurYPostprocess.packedFloat = true;\r\n }\r\n this._blurPostProcesses = [this._kernelBlurXPostprocess, this._kernelBlurYPostprocess];\r\n }\r\n else {\r\n this._boxBlurPostprocess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_10__[\"PostProcess\"](this._light.name + \"DepthBoxBlur\", \"depthBoxBlur\", [\"screenSize\", \"boxOffset\"], [], 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, \"#define OFFSET \" + this._blurBoxOffset, this._textureType);\r\n this._boxBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", targetSize, targetSize);\r\n effect.setTexture(\"textureSampler\", _this._shadowMap);\r\n });\r\n this._boxBlurPostprocess.autoClear = false;\r\n this._blurPostProcesses = [this._boxBlurPostprocess];\r\n }\r\n };\r\n ShadowGenerator.prototype._renderForShadowMap = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var index;\r\n var engine = this._scene.getEngine();\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(alphaTestSubMeshes.data[index]);\r\n }\r\n if (this._transparencyShadow) {\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(transparentSubMeshes.data[index]);\r\n }\r\n }\r\n };\r\n ShadowGenerator.prototype._renderSubMeshForShadowMap = function (subMesh) {\r\n var _this = this;\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = this._scene;\r\n var engine = scene.getEngine();\r\n var material = subMesh.getMaterial();\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n if (!material || subMesh.verticesCount === 0) {\r\n return;\r\n }\r\n // Culling\r\n engine.setState(material.backFaceCulling);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null) && (batch.visibleInstances[subMesh._id] !== undefined);\r\n if (this.isReady(subMesh, hardwareInstancedRendering)) {\r\n engine.enableEffect(this._effect);\r\n mesh._bind(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode);\r\n this._effect.setFloat3(\"biasAndScale\", this.bias, this.normalBias, this.depthScale);\r\n this._effect.setMatrix(\"viewProjection\", this.getTransformMatrix());\r\n if (this.getLight().getTypeID() === _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n this._effect.setVector3(\"lightData\", this._cachedDirection);\r\n }\r\n else {\r\n this._effect.setVector3(\"lightData\", this._cachedPosition);\r\n }\r\n if (scene.activeCamera) {\r\n this._effect.setFloat2(\"depthValues\", this.getLight().getDepthMinZ(scene.activeCamera), this.getLight().getDepthMinZ(scene.activeCamera) + this.getLight().getDepthMaxZ(scene.activeCamera));\r\n }\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix() || this._defaultTextureMatrix);\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n if (!boneTexture) {\r\n return;\r\n }\r\n this._effect.setTexture(\"boneSampler\", boneTexture);\r\n this._effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n this._effect.setMatrices(\"mBones\", skeleton.getTransformMatrices((mesh)));\r\n }\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._effect);\r\n if (this.forceBackFacesOnly) {\r\n engine.setState(true, 0, false, true);\r\n }\r\n // Observables\r\n this.onBeforeShadowMapRenderMeshObservable.notifyObservers(mesh);\r\n this.onBeforeShadowMapRenderObservable.notifyObservers(this._effect);\r\n // Draw\r\n mesh._processRendering(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix(\"world\", world); });\r\n if (this.forceBackFacesOnly) {\r\n engine.setState(true, 0, false, false);\r\n }\r\n // Observables\r\n this.onAfterShadowMapRenderObservable.notifyObservers(this._effect);\r\n this.onAfterShadowMapRenderMeshObservable.notifyObservers(mesh);\r\n }\r\n else {\r\n // Need to reset refresh rate of the shadowMap\r\n if (this._shadowMap) {\r\n this._shadowMap.resetRefreshCounter();\r\n }\r\n }\r\n };\r\n ShadowGenerator.prototype._applyFilterValues = function () {\r\n if (!this._shadowMap) {\r\n return;\r\n }\r\n if (this.filter === ShadowGenerator.FILTER_NONE || this.filter === ShadowGenerator.FILTER_PCSS) {\r\n this._shadowMap.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n }\r\n else {\r\n this._shadowMap.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n }\r\n };\r\n /**\r\n * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.\r\n * @param onCompiled Callback triggered at the and of the effects compilation\r\n * @param options Sets of optional options forcing the compilation with different modes\r\n */\r\n ShadowGenerator.prototype.forceCompilation = function (onCompiled, options) {\r\n var _this = this;\r\n var localOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ useInstances: false }, options);\r\n var shadowMap = this.getShadowMap();\r\n if (!shadowMap) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n return;\r\n }\r\n var renderList = shadowMap.renderList;\r\n if (!renderList) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n return;\r\n }\r\n var subMeshes = new Array();\r\n for (var _i = 0, renderList_1 = renderList; _i < renderList_1.length; _i++) {\r\n var mesh = renderList_1[_i];\r\n subMeshes.push.apply(subMeshes, mesh.subMeshes);\r\n }\r\n if (subMeshes.length === 0) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n return;\r\n }\r\n var currentIndex = 0;\r\n var checkReady = function () {\r\n if (!_this._scene || !_this._scene.getEngine()) {\r\n return;\r\n }\r\n while (_this.isReady(subMeshes[currentIndex], localOptions.useInstances)) {\r\n currentIndex++;\r\n if (currentIndex >= subMeshes.length) {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n return;\r\n }\r\n }\r\n setTimeout(checkReady, 16);\r\n };\r\n checkReady();\r\n };\r\n /**\r\n * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.\r\n * @param options Sets of optional options forcing the compilation with different modes\r\n * @returns A promise that resolves when the compilation completes\r\n */\r\n ShadowGenerator.prototype.forceCompilationAsync = function (options) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.forceCompilation(function () {\r\n resolve();\r\n }, options);\r\n });\r\n };\r\n /**\r\n * Determine wheter the shadow generator is ready or not (mainly all effects and related post processes needs to be ready).\r\n * @param subMesh The submesh we want to render in the shadow map\r\n * @param useInstances Defines wether will draw in the map using instances\r\n * @returns true if ready otherwise, false\r\n */\r\n ShadowGenerator.prototype.isReady = function (subMesh, useInstances) {\r\n var defines = [];\r\n if (this._textureType !== _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n defines.push(\"#define FLOAT\");\r\n }\r\n if (this.useExponentialShadowMap || this.useBlurExponentialShadowMap) {\r\n defines.push(\"#define ESM\");\r\n }\r\n else if (this.usePercentageCloserFiltering || this.useContactHardeningShadow) {\r\n defines.push(\"#define DEPTHTEXTURE\");\r\n }\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind];\r\n var mesh = subMesh.getMesh();\r\n var material = subMesh.getMaterial();\r\n // Normal bias.\r\n if (this.normalBias && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind);\r\n defines.push(\"#define NORMAL\");\r\n if (mesh.nonUniformScaling) {\r\n defines.push(\"#define NONUNIFORMSCALING\");\r\n }\r\n if (this.getLight().getTypeID() === _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n defines.push(\"#define DIRECTIONINLIGHTDATA\");\r\n }\r\n }\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind)) {\r\n if (alphaTexture.coordinatesIndex === 1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n }\r\n }\r\n // Bones\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_7__[\"EffectFallbacks\"]();\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n var skeleton = mesh.skeleton;\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n if (mesh.numBoneInfluencers > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n if (skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton.bones.length + 1));\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var manager = mesh.morphTargetManager;\r\n var morphInfluencers = 0;\r\n if (manager) {\r\n if (manager.numInfluencers > 0) {\r\n defines.push(\"#define MORPHTARGETS\");\r\n morphInfluencers = manager.numInfluencers;\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + morphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, morphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n if (this.customShaderOptions) {\r\n if (this.customShaderOptions.defines) {\r\n for (var _i = 0, _a = this.customShaderOptions.defines; _i < _a.length; _i++) {\r\n var define = _a[_i];\r\n if (defines.indexOf(define) === -1) {\r\n defines.push(define);\r\n }\r\n }\r\n }\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n var shaderName = \"shadowMap\";\r\n var uniforms = [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"lightData\", \"depthValues\", \"biasAndScale\", \"morphTargetInfluences\", \"boneTextureWidth\"];\r\n var samplers = [\"diffuseSampler\", \"boneSampler\"];\r\n // Custom shader?\r\n if (this.customShaderOptions) {\r\n shaderName = this.customShaderOptions.shaderName;\r\n if (this.customShaderOptions.attributes) {\r\n for (var _b = 0, _c = this.customShaderOptions.attributes; _b < _c.length; _b++) {\r\n var attrib = _c[_b];\r\n if (attribs.indexOf(attrib) === -1) {\r\n attribs.push(attrib);\r\n }\r\n }\r\n }\r\n if (this.customShaderOptions.uniforms) {\r\n for (var _d = 0, _e = this.customShaderOptions.uniforms; _d < _e.length; _d++) {\r\n var uniform = _e[_d];\r\n if (uniforms.indexOf(uniform) === -1) {\r\n uniforms.push(uniform);\r\n }\r\n }\r\n }\r\n if (this.customShaderOptions.samplers) {\r\n for (var _f = 0, _g = this.customShaderOptions.samplers; _f < _g.length; _f++) {\r\n var sampler = _g[_f];\r\n if (samplers.indexOf(sampler) === -1) {\r\n samplers.push(sampler);\r\n }\r\n }\r\n }\r\n }\r\n this._effect = this._scene.getEngine().createEffect(shaderName, attribs, uniforms, samplers, join, fallbacks, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers });\r\n }\r\n if (!this._effect.isReady()) {\r\n return false;\r\n }\r\n if (this.useBlurExponentialShadowMap || this.useBlurCloseExponentialShadowMap) {\r\n if (!this._blurPostProcesses || !this._blurPostProcesses.length) {\r\n this._initializeBlurRTTAndPostProcesses();\r\n }\r\n }\r\n if (this._kernelBlurXPostprocess && !this._kernelBlurXPostprocess.isReady()) {\r\n return false;\r\n }\r\n if (this._kernelBlurYPostprocess && !this._kernelBlurYPostprocess.isReady()) {\r\n return false;\r\n }\r\n if (this._boxBlurPostprocess && !this._boxBlurPostprocess.isReady()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Prepare all the defines in a material relying on a shadow map at the specified light index.\r\n * @param defines Defines of the material we want to update\r\n * @param lightIndex Index of the light in the enabled light list of the material\r\n */\r\n ShadowGenerator.prototype.prepareDefines = function (defines, lightIndex) {\r\n var scene = this._scene;\r\n var light = this._light;\r\n if (!scene.shadowsEnabled || !light.shadowEnabled) {\r\n return;\r\n }\r\n defines[\"SHADOW\" + lightIndex] = true;\r\n if (this.useContactHardeningShadow) {\r\n defines[\"SHADOWPCSS\" + lightIndex] = true;\r\n if (this._filteringQuality === ShadowGenerator.QUALITY_LOW) {\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = true;\r\n }\r\n else if (this._filteringQuality === ShadowGenerator.QUALITY_MEDIUM) {\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = true;\r\n }\r\n // else default to high.\r\n }\r\n if (this.usePercentageCloserFiltering) {\r\n defines[\"SHADOWPCF\" + lightIndex] = true;\r\n if (this._filteringQuality === ShadowGenerator.QUALITY_LOW) {\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = true;\r\n }\r\n else if (this._filteringQuality === ShadowGenerator.QUALITY_MEDIUM) {\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = true;\r\n }\r\n // else default to high.\r\n }\r\n else if (this.usePoissonSampling) {\r\n defines[\"SHADOWPOISSON\" + lightIndex] = true;\r\n }\r\n else if (this.useExponentialShadowMap || this.useBlurExponentialShadowMap) {\r\n defines[\"SHADOWESM\" + lightIndex] = true;\r\n }\r\n else if (this.useCloseExponentialShadowMap || this.useBlurCloseExponentialShadowMap) {\r\n defines[\"SHADOWCLOSEESM\" + lightIndex] = true;\r\n }\r\n if (light.needCube()) {\r\n defines[\"SHADOWCUBE\" + lightIndex] = true;\r\n }\r\n };\r\n /**\r\n * Binds the shadow related information inside of an effect (information like near, far, darkness...\r\n * defined in the generator but impacting the effect).\r\n * @param lightIndex Index of the light in the enabled light list of the material owning the effect\r\n * @param effect The effect we are binfing the information for\r\n */\r\n ShadowGenerator.prototype.bindShadowLight = function (lightIndex, effect) {\r\n var light = this._light;\r\n var scene = this._scene;\r\n if (!scene.shadowsEnabled || !light.shadowEnabled) {\r\n return;\r\n }\r\n var camera = scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n var shadowMap = this.getShadowMap();\r\n if (!shadowMap) {\r\n return;\r\n }\r\n if (!light.needCube()) {\r\n effect.setMatrix(\"lightMatrix\" + lightIndex, this.getTransformMatrix());\r\n }\r\n // Only PCF uses depth stencil texture.\r\n if (this._filter === ShadowGenerator.FILTER_PCF) {\r\n effect.setDepthStencilTexture(\"shadowSampler\" + lightIndex, this.getShadowMapForRendering());\r\n light._uniformBuffer.updateFloat4(\"shadowsInfo\", this.getDarkness(), shadowMap.getSize().width, 1 / shadowMap.getSize().width, this.frustumEdgeFalloff, lightIndex);\r\n }\r\n else if (this._filter === ShadowGenerator.FILTER_PCSS) {\r\n effect.setDepthStencilTexture(\"shadowSampler\" + lightIndex, this.getShadowMapForRendering());\r\n effect.setTexture(\"depthSampler\" + lightIndex, this.getShadowMapForRendering());\r\n light._uniformBuffer.updateFloat4(\"shadowsInfo\", this.getDarkness(), 1 / shadowMap.getSize().width, this._contactHardeningLightSizeUVRatio * shadowMap.getSize().width, this.frustumEdgeFalloff, lightIndex);\r\n }\r\n else {\r\n effect.setTexture(\"shadowSampler\" + lightIndex, this.getShadowMapForRendering());\r\n light._uniformBuffer.updateFloat4(\"shadowsInfo\", this.getDarkness(), this.blurScale / shadowMap.getSize().width, this.depthScale, this.frustumEdgeFalloff, lightIndex);\r\n }\r\n light._uniformBuffer.updateFloat2(\"depthValues\", this.getLight().getDepthMinZ(camera), this.getLight().getDepthMinZ(camera) + this.getLight().getDepthMaxZ(camera), lightIndex);\r\n };\r\n /**\r\n * Gets the transformation matrix used to project the meshes into the map from the light point of view.\r\n * (eq to shadow prjection matrix * light transform matrix)\r\n * @returns The transform matrix used to create the shadow map\r\n */\r\n ShadowGenerator.prototype.getTransformMatrix = function () {\r\n var scene = this._scene;\r\n if (this._currentRenderID === scene.getRenderId() && this._currentFaceIndexCache === this._currentFaceIndex) {\r\n return this._transformMatrix;\r\n }\r\n this._currentRenderID = scene.getRenderId();\r\n this._currentFaceIndexCache = this._currentFaceIndex;\r\n var lightPosition = this._light.position;\r\n if (this._light.computeTransformedInformation()) {\r\n lightPosition = this._light.transformedPosition;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex), this._lightDirection);\r\n if (Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(this._lightDirection, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Up())) === 1.0) {\r\n this._lightDirection.z = 0.0000000000001; // Required to avoid perfectly perpendicular light\r\n }\r\n if (this._light.needProjectionMatrixCompute() || !this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !this._lightDirection.equals(this._cachedDirection)) {\r\n this._cachedPosition.copyFrom(lightPosition);\r\n this._cachedDirection.copyFrom(this._lightDirection);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].LookAtLHToRef(lightPosition, lightPosition.add(this._lightDirection), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Up(), this._viewMatrix);\r\n var shadowMap = this.getShadowMap();\r\n if (shadowMap) {\r\n var renderList = shadowMap.renderList;\r\n if (renderList) {\r\n this._light.setShadowProjectionMatrix(this._projectionMatrix, this._viewMatrix, renderList);\r\n }\r\n }\r\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n }\r\n return this._transformMatrix;\r\n };\r\n /**\r\n * Recreates the shadow map dependencies like RTT and post processes. This can be used during the switch between\r\n * Cube and 2D textures for instance.\r\n */\r\n ShadowGenerator.prototype.recreateShadowMap = function () {\r\n var shadowMap = this._shadowMap;\r\n if (!shadowMap) {\r\n return;\r\n }\r\n // Track render list.\r\n var renderList = shadowMap.renderList;\r\n // Clean up existing data.\r\n this._disposeRTTandPostProcesses();\r\n // Reinitializes.\r\n this._initializeGenerator();\r\n // Reaffect the filter to ensure a correct fallback if necessary.\r\n this.filter = this.filter;\r\n // Reaffect the filter.\r\n this._applyFilterValues();\r\n // Reaffect Render List.\r\n this._shadowMap.renderList = renderList;\r\n };\r\n ShadowGenerator.prototype._disposeBlurPostProcesses = function () {\r\n if (this._shadowMap2) {\r\n this._shadowMap2.dispose();\r\n this._shadowMap2 = null;\r\n }\r\n if (this._boxBlurPostprocess) {\r\n this._boxBlurPostprocess.dispose();\r\n this._boxBlurPostprocess = null;\r\n }\r\n if (this._kernelBlurXPostprocess) {\r\n this._kernelBlurXPostprocess.dispose();\r\n this._kernelBlurXPostprocess = null;\r\n }\r\n if (this._kernelBlurYPostprocess) {\r\n this._kernelBlurYPostprocess.dispose();\r\n this._kernelBlurYPostprocess = null;\r\n }\r\n this._blurPostProcesses = [];\r\n };\r\n ShadowGenerator.prototype._disposeRTTandPostProcesses = function () {\r\n if (this._shadowMap) {\r\n this._shadowMap.dispose();\r\n this._shadowMap = null;\r\n }\r\n this._disposeBlurPostProcesses();\r\n };\r\n /**\r\n * Disposes the ShadowGenerator.\r\n * Returns nothing.\r\n */\r\n ShadowGenerator.prototype.dispose = function () {\r\n this._disposeRTTandPostProcesses();\r\n if (this._light) {\r\n this._light._shadowGenerator = null;\r\n this._light._markMeshesAsLightDirty();\r\n }\r\n this.onBeforeShadowMapRenderMeshObservable.clear();\r\n this.onBeforeShadowMapRenderObservable.clear();\r\n this.onAfterShadowMapRenderMeshObservable.clear();\r\n this.onAfterShadowMapRenderObservable.clear();\r\n };\r\n /**\r\n * Serializes the shadow generator setup to a json object.\r\n * @returns The serialized JSON object\r\n */\r\n ShadowGenerator.prototype.serialize = function () {\r\n var serializationObject = {};\r\n var shadowMap = this.getShadowMap();\r\n if (!shadowMap) {\r\n return serializationObject;\r\n }\r\n serializationObject.lightId = this._light.id;\r\n serializationObject.mapSize = shadowMap.getRenderSize();\r\n serializationObject.useExponentialShadowMap = this.useExponentialShadowMap;\r\n serializationObject.useBlurExponentialShadowMap = this.useBlurExponentialShadowMap;\r\n serializationObject.useCloseExponentialShadowMap = this.useBlurExponentialShadowMap;\r\n serializationObject.useBlurCloseExponentialShadowMap = this.useBlurExponentialShadowMap;\r\n serializationObject.usePoissonSampling = this.usePoissonSampling;\r\n serializationObject.forceBackFacesOnly = this.forceBackFacesOnly;\r\n serializationObject.depthScale = this.depthScale;\r\n serializationObject.darkness = this.getDarkness();\r\n serializationObject.blurBoxOffset = this.blurBoxOffset;\r\n serializationObject.blurKernel = this.blurKernel;\r\n serializationObject.blurScale = this.blurScale;\r\n serializationObject.useKernelBlur = this.useKernelBlur;\r\n serializationObject.transparencyShadow = this._transparencyShadow;\r\n serializationObject.frustumEdgeFalloff = this.frustumEdgeFalloff;\r\n serializationObject.bias = this.bias;\r\n serializationObject.normalBias = this.normalBias;\r\n serializationObject.usePercentageCloserFiltering = this.usePercentageCloserFiltering;\r\n serializationObject.useContactHardeningShadow = this.useContactHardeningShadow;\r\n serializationObject.filteringQuality = this.filteringQuality;\r\n serializationObject.contactHardeningLightSizeUVRatio = this.contactHardeningLightSizeUVRatio;\r\n serializationObject.renderList = [];\r\n if (shadowMap.renderList) {\r\n for (var meshIndex = 0; meshIndex < shadowMap.renderList.length; meshIndex++) {\r\n var mesh = shadowMap.renderList[meshIndex];\r\n serializationObject.renderList.push(mesh.id);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a serialized ShadowGenerator and returns a new ShadowGenerator.\r\n * @param parsedShadowGenerator The JSON object to parse\r\n * @param scene The scene to create the shadow map for\r\n * @returns The parsed shadow generator\r\n */\r\n ShadowGenerator.Parse = function (parsedShadowGenerator, scene) {\r\n var light = scene.getLightByID(parsedShadowGenerator.lightId);\r\n var shadowGenerator = new ShadowGenerator(parsedShadowGenerator.mapSize, light);\r\n var shadowMap = shadowGenerator.getShadowMap();\r\n for (var meshIndex = 0; meshIndex < parsedShadowGenerator.renderList.length; meshIndex++) {\r\n var meshes = scene.getMeshesByID(parsedShadowGenerator.renderList[meshIndex]);\r\n meshes.forEach(function (mesh) {\r\n if (!shadowMap) {\r\n return;\r\n }\r\n if (!shadowMap.renderList) {\r\n shadowMap.renderList = [];\r\n }\r\n shadowMap.renderList.push(mesh);\r\n });\r\n }\r\n if (parsedShadowGenerator.usePoissonSampling) {\r\n shadowGenerator.usePoissonSampling = true;\r\n }\r\n else if (parsedShadowGenerator.useExponentialShadowMap) {\r\n shadowGenerator.useExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useBlurExponentialShadowMap) {\r\n shadowGenerator.useBlurExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useCloseExponentialShadowMap) {\r\n shadowGenerator.useCloseExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useBlurCloseExponentialShadowMap) {\r\n shadowGenerator.useBlurCloseExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.usePercentageCloserFiltering) {\r\n shadowGenerator.usePercentageCloserFiltering = true;\r\n }\r\n else if (parsedShadowGenerator.useContactHardeningShadow) {\r\n shadowGenerator.useContactHardeningShadow = true;\r\n }\r\n if (parsedShadowGenerator.filteringQuality) {\r\n shadowGenerator.filteringQuality = parsedShadowGenerator.filteringQuality;\r\n }\r\n if (parsedShadowGenerator.contactHardeningLightSizeUVRatio) {\r\n shadowGenerator.contactHardeningLightSizeUVRatio = parsedShadowGenerator.contactHardeningLightSizeUVRatio;\r\n }\r\n // Backward compat\r\n else if (parsedShadowGenerator.useVarianceShadowMap) {\r\n shadowGenerator.useExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useBlurVarianceShadowMap) {\r\n shadowGenerator.useBlurExponentialShadowMap = true;\r\n }\r\n if (parsedShadowGenerator.depthScale) {\r\n shadowGenerator.depthScale = parsedShadowGenerator.depthScale;\r\n }\r\n if (parsedShadowGenerator.blurScale) {\r\n shadowGenerator.blurScale = parsedShadowGenerator.blurScale;\r\n }\r\n if (parsedShadowGenerator.blurBoxOffset) {\r\n shadowGenerator.blurBoxOffset = parsedShadowGenerator.blurBoxOffset;\r\n }\r\n if (parsedShadowGenerator.useKernelBlur) {\r\n shadowGenerator.useKernelBlur = parsedShadowGenerator.useKernelBlur;\r\n }\r\n if (parsedShadowGenerator.blurKernel) {\r\n shadowGenerator.blurKernel = parsedShadowGenerator.blurKernel;\r\n }\r\n if (parsedShadowGenerator.bias !== undefined) {\r\n shadowGenerator.bias = parsedShadowGenerator.bias;\r\n }\r\n if (parsedShadowGenerator.normalBias !== undefined) {\r\n shadowGenerator.normalBias = parsedShadowGenerator.normalBias;\r\n }\r\n if (parsedShadowGenerator.frustumEdgeFalloff !== undefined) {\r\n shadowGenerator.frustumEdgeFalloff = parsedShadowGenerator.frustumEdgeFalloff;\r\n }\r\n if (parsedShadowGenerator.darkness) {\r\n shadowGenerator.setDarkness(parsedShadowGenerator.darkness);\r\n }\r\n if (parsedShadowGenerator.transparencyShadow) {\r\n shadowGenerator.setTransparencyShadow(true);\r\n }\r\n shadowGenerator.forceBackFacesOnly = parsedShadowGenerator.forceBackFacesOnly;\r\n return shadowGenerator;\r\n };\r\n /**\r\n * Shadow generator mode None: no filtering applied.\r\n */\r\n ShadowGenerator.FILTER_NONE = 0;\r\n /**\r\n * Shadow generator mode ESM: Exponential Shadow Mapping.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP = 1;\r\n /**\r\n * Shadow generator mode Poisson Sampling: Percentage Closer Filtering.\r\n * (Multiple Tap around evenly distributed around the pixel are used to evaluate the shadow strength)\r\n */\r\n ShadowGenerator.FILTER_POISSONSAMPLING = 2;\r\n /**\r\n * Shadow generator mode ESM: Blurred Exponential Shadow Mapping.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP = 3;\r\n /**\r\n * Shadow generator mode ESM: Exponential Shadow Mapping using the inverse of the exponential preventing\r\n * edge artifacts on steep falloff.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP = 4;\r\n /**\r\n * Shadow generator mode ESM: Blurred Exponential Shadow Mapping using the inverse of the exponential preventing\r\n * edge artifacts on steep falloff.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP = 5;\r\n /**\r\n * Shadow generator mode PCF: Percentage Closer Filtering\r\n * benefits from Webgl 2 shadow samplers. Fallback to Poisson Sampling in Webgl 1\r\n * (https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch11.html)\r\n */\r\n ShadowGenerator.FILTER_PCF = 6;\r\n /**\r\n * Shadow generator mode PCSS: Percentage Closering Soft Shadow.\r\n * benefits from Webgl 2 shadow samplers. Fallback to Poisson Sampling in Webgl 1\r\n * Contact Hardening\r\n */\r\n ShadowGenerator.FILTER_PCSS = 7;\r\n /**\r\n * Reserved for PCF and PCSS\r\n * Highest Quality.\r\n *\r\n * Execute PCF on a 5*5 kernel improving a lot the shadow aliasing artifacts.\r\n *\r\n * Execute PCSS with 32 taps blocker search and 64 taps PCF.\r\n */\r\n ShadowGenerator.QUALITY_HIGH = 0;\r\n /**\r\n * Reserved for PCF and PCSS\r\n * Good tradeoff for quality/perf cross devices\r\n *\r\n * Execute PCF on a 3*3 kernel.\r\n *\r\n * Execute PCSS with 16 taps blocker search and 32 taps PCF.\r\n */\r\n ShadowGenerator.QUALITY_MEDIUM = 1;\r\n /**\r\n * Reserved for PCF and PCSS\r\n * The lowest quality but the fastest.\r\n *\r\n * Execute PCF on a 1*1 kernel.\r\n *\r\n * Execute PCSS with 16 taps blocker search and 16 taps PCF.\r\n */\r\n ShadowGenerator.QUALITY_LOW = 2;\r\n /** @hidden */\r\n ShadowGenerator._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_17__[\"_DevTools\"].WarnImport(\"ShadowGeneratorSceneComponent\");\r\n };\r\n return ShadowGenerator;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/Shadows/shadowGeneratorSceneComponent.ts\":\n/*!*********************************************************!*\\\n !*** ./Lights/Shadows/shadowGeneratorSceneComponent.ts ***!\n \\*********************************************************/\n/*! exports provided: ShadowGeneratorSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return ShadowGeneratorSceneComponent; });\n/* harmony import */ var _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shadowGenerator */ \"./Lights/Shadows/shadowGenerator.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../abstractScene */ \"./abstractScene.ts\");\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_SHADOWGENERATOR, function (parsedData, scene) {\r\n // Shadows\r\n if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {\r\n for (var index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {\r\n var parsedShadowGenerator = parsedData.shadowGenerators[index];\r\n _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"].Parse(parsedShadowGenerator, scene);\r\n // SG would be available on their associated lights\r\n }\r\n }\r\n});\r\n/**\r\n * Defines the shadow generator component responsible to manage any shadow generators\r\n * in a given scene.\r\n */\r\nvar ShadowGeneratorSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function ShadowGeneratorSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_SHADOWGENERATOR;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n ShadowGeneratorSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n ShadowGeneratorSceneComponent.prototype.rebuild = function () {\r\n // Nothing To Do Here.\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n ShadowGeneratorSceneComponent.prototype.serialize = function (serializationObject) {\r\n // Shadows\r\n serializationObject.shadowGenerators = [];\r\n var lights = this.scene.lights;\r\n for (var _i = 0, lights_1 = lights; _i < lights_1.length; _i++) {\r\n var light = lights_1[_i];\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n serializationObject.shadowGenerators.push(shadowGenerator.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n ShadowGeneratorSceneComponent.prototype.addFromContainer = function (container) {\r\n // Nothing To Do Here. (directly attached to a light)\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n ShadowGeneratorSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n // Nothing To Do Here. (directly attached to a light)\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n ShadowGeneratorSceneComponent.prototype.dispose = function () {\r\n // Nothing To Do Here.\r\n };\r\n ShadowGeneratorSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {\r\n // Shadows\r\n var scene = this.scene;\r\n if (this.scene.shadowsEnabled) {\r\n for (var lightIndex = 0; lightIndex < scene.lights.length; lightIndex++) {\r\n var light = scene.lights[lightIndex];\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {\r\n var shadowMap = (shadowGenerator.getShadowMap());\r\n if (scene.textures.indexOf(shadowMap) !== -1) {\r\n renderTargets.push(shadowMap);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n return ShadowGeneratorSceneComponent;\r\n}());\r\n\r\n_shadowGenerator__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"]._SceneComponentInitialization = function (scene) {\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_SHADOWGENERATOR);\r\n if (!component) {\r\n component = new ShadowGeneratorSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Lights/directionalLight.ts\":\n/*!************************************!*\\\n !*** ./Lights/directionalLight.ts ***!\n \\************************************/\n/*! exports provided: DirectionalLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return DirectionalLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"Light_Type_1\", function (name, scene) {\r\n return function () { return new DirectionalLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * A directional light is defined by a direction (what a surprise!).\r\n * The light is emitted from everywhere in the specified direction, and has an infinite range.\r\n * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar DirectionalLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DirectionalLight, _super);\r\n /**\r\n * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).\r\n * The directional light is emitted from everywhere in the given direction.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light\r\n * @param scene The scene the light belongs to\r\n */\r\n function DirectionalLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowFrustumSize = 0;\r\n _this._shadowOrthoScale = 0.1;\r\n /**\r\n * Automatically compute the projection matrix to best fit (including all the casters)\r\n * on each frame.\r\n */\r\n _this.autoUpdateExtends = true;\r\n // Cache\r\n _this._orthoLeft = Number.MAX_VALUE;\r\n _this._orthoRight = Number.MIN_VALUE;\r\n _this._orthoTop = Number.MIN_VALUE;\r\n _this._orthoBottom = Number.MAX_VALUE;\r\n _this.position = direction.scale(-1.0);\r\n _this.direction = direction;\r\n return _this;\r\n }\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowFrustumSize\", {\r\n /**\r\n * Fix frustum size for the shadow generation. This is disabled if the value is 0.\r\n */\r\n get: function () {\r\n return this._shadowFrustumSize;\r\n },\r\n /**\r\n * Specifies a fix frustum size for the shadow generation.\r\n */\r\n set: function (value) {\r\n this._shadowFrustumSize = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowOrthoScale\", {\r\n /**\r\n * Gets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n get: function () {\r\n return this._shadowOrthoScale;\r\n },\r\n /**\r\n * Sets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n set: function (value) {\r\n this._shadowOrthoScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"DirectionalLight\".\r\n * @return The class name\r\n */\r\n DirectionalLight.prototype.getClassName = function () {\r\n return \"DirectionalLight\";\r\n };\r\n /**\r\n * Returns the integer 1.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n DirectionalLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_DIRECTIONALLIGHT;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.shadowFrustumSize > 0) {\r\n this._setDefaultFixedFrustumShadowProjectionMatrix(matrix);\r\n }\r\n else {\r\n this._setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultFixedFrustumShadowProjectionMatrix = function (matrix) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultAutoExtendShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n // Check extends\r\n if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {\r\n var tempVector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._orthoLeft = Number.MAX_VALUE;\r\n this._orthoRight = Number.MIN_VALUE;\r\n this._orthoTop = Number.MIN_VALUE;\r\n this._orthoBottom = Number.MAX_VALUE;\r\n for (var meshIndex = 0; meshIndex < renderList.length; meshIndex++) {\r\n var mesh = renderList[meshIndex];\r\n if (!mesh) {\r\n continue;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n for (var index = 0; index < boundingBox.vectorsWorld.length; index++) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);\r\n if (tempVector3.x < this._orthoLeft) {\r\n this._orthoLeft = tempVector3.x;\r\n }\r\n if (tempVector3.y < this._orthoBottom) {\r\n this._orthoBottom = tempVector3.y;\r\n }\r\n if (tempVector3.x > this._orthoRight) {\r\n this._orthoRight = tempVector3.x;\r\n }\r\n if (tempVector3.y > this._orthoTop) {\r\n this._orthoTop = tempVector3.y;\r\n }\r\n }\r\n }\r\n }\r\n var xOffset = this._orthoRight - this._orthoLeft;\r\n var yOffset = this._orthoTop - this._orthoBottom;\r\n if (this.getScene().useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].OrthoOffCenterRHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n }\r\n };\r\n DirectionalLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The directional light\r\n */\r\n DirectionalLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n if (this.getScene().useRightHandedSystem) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", -this.transformedDirection.x, -this.transformedDirection.y, -this.transformedDirection.z, 1, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);\r\n }\r\n return this;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", -this.direction.x, -this.direction.y, -this.direction.z, 1, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);\r\n }\r\n return this;\r\n };\r\n DirectionalLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -this.transformedDirection.x, -this.transformedDirection.y, -this.transformedDirection.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);\r\n }\r\n return this;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -this.direction.x, -this.direction.y, -this.direction.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n DirectionalLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n DirectionalLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n DirectionalLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"DIRLIGHT\" + lightIndex] = true;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DirectionalLight.prototype, \"shadowFrustumSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DirectionalLight.prototype, \"shadowOrthoScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DirectionalLight.prototype, \"autoUpdateExtends\", void 0);\r\n return DirectionalLight;\r\n}(_shadowLight__WEBPACK_IMPORTED_MODULE_5__[\"ShadowLight\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/hemisphericLight.ts\":\n/*!************************************!*\\\n !*** ./Lights/hemisphericLight.ts ***!\n \\************************************/\n/*! exports provided: HemisphericLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return HemisphericLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"Light_Type_3\", function (name, scene) {\r\n return function () { return new HemisphericLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * The HemisphericLight simulates the ambient environment light,\r\n * so the passed direction is the light reflection direction, not the incoming direction.\r\n */\r\nvar HemisphericLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HemisphericLight, _super);\r\n /**\r\n * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).\r\n * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.\r\n * The HemisphericLight can't cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light reflection\r\n * @param scene The scene the light belongs to\r\n */\r\n function HemisphericLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * The groundColor is the light in the opposite direction to the one specified during creation.\r\n * You can think of the diffuse and specular light as coming from the centre of the object in the given direction and the groundColor light in the opposite direction.\r\n */\r\n _this.groundColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.0, 0.0, 0.0);\r\n _this.direction = direction || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Up();\r\n return _this;\r\n }\r\n HemisphericLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"vLightGround\", 3);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Returns the string \"HemisphericLight\".\r\n * @return The class name\r\n */\r\n HemisphericLight.prototype.getClassName = function () {\r\n return \"HemisphericLight\";\r\n };\r\n /**\r\n * Sets the HemisphericLight direction towards the passed target (Vector3).\r\n * Returns the updated direction.\r\n * @param target The target the direction should point to\r\n * @return The computed direction\r\n */\r\n HemisphericLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(target.subtract(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero()));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the shadow generator associated to the light.\r\n * @returns Always null for hemispheric lights because it does not support shadows.\r\n */\r\n HemisphericLight.prototype.getShadowGenerator = function () {\r\n return null;\r\n };\r\n /**\r\n * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The hemispheric light\r\n */\r\n HemisphericLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n this._uniformBuffer.updateFloat4(\"vLightData\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0.0, lightIndex);\r\n this._uniformBuffer.updateColor3(\"vLightGround\", this.groundColor.scale(this.intensity), lightIndex);\r\n return this;\r\n };\r\n HemisphericLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n return this;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @param useWasUpdatedFlag defines a reserved property\r\n * @returns the world matrix\r\n */\r\n HemisphericLight.prototype.computeWorldMatrix = function () {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Returns the integer 3.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n HemisphericLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_5__[\"Light\"].LIGHTTYPEID_HEMISPHERICLIGHT;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n HemisphericLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"HEMILIGHT\" + lightIndex] = true;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], HemisphericLight.prototype, \"groundColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], HemisphericLight.prototype, \"direction\", void 0);\r\n return HemisphericLight;\r\n}(_light__WEBPACK_IMPORTED_MODULE_5__[\"Light\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/index.ts\":\n/*!*************************!*\\\n !*** ./Lights/index.ts ***!\n \\*************************/\n/*! exports provided: Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, ShadowGenerator, ShadowGeneratorSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return _light__WEBPACK_IMPORTED_MODULE_0__[\"Light\"]; });\n\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return _shadowLight__WEBPACK_IMPORTED_MODULE_1__[\"ShadowLight\"]; });\n\n/* harmony import */ var _Shadows_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Shadows/index */ \"./Lights/Shadows/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _Shadows_index__WEBPACK_IMPORTED_MODULE_2__[\"ShadowGenerator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _Shadows_index__WEBPACK_IMPORTED_MODULE_2__[\"ShadowGeneratorSceneComponent\"]; });\n\n/* harmony import */ var _directionalLight__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./directionalLight */ \"./Lights/directionalLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return _directionalLight__WEBPACK_IMPORTED_MODULE_3__[\"DirectionalLight\"]; });\n\n/* harmony import */ var _hemisphericLight__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return _hemisphericLight__WEBPACK_IMPORTED_MODULE_4__[\"HemisphericLight\"]; });\n\n/* harmony import */ var _pointLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pointLight */ \"./Lights/pointLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return _pointLight__WEBPACK_IMPORTED_MODULE_5__[\"PointLight\"]; });\n\n/* harmony import */ var _spotLight__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./spotLight */ \"./Lights/spotLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return _spotLight__WEBPACK_IMPORTED_MODULE_6__[\"SpotLight\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/light.ts\":\n/*!*************************!*\\\n !*** ./Lights/light.ts ***!\n \\*************************/\n/*! exports provided: Light */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return Light; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class of all the lights in Babylon. It groups all the generic information about lights.\r\n * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour.\r\n * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased.\r\n */\r\nvar Light = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Light, _super);\r\n /**\r\n * Creates a Light object in the scene.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The firendly name of the light\r\n * @param scene The scene the light belongs too\r\n */\r\n function Light(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Diffuse gives the basic color to an object.\r\n */\r\n _this.diffuse = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1.0, 1.0, 1.0);\r\n /**\r\n * Specular produces a highlight color on an object.\r\n * Note: This is note affecting PBR materials.\r\n */\r\n _this.specular = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1.0, 1.0, 1.0);\r\n /**\r\n * Defines the falloff type for this light. This lets overrriding how punctual light are\r\n * falling off base on range or angle.\r\n * This can be set to any values in Light.FALLOFF_x.\r\n *\r\n * Note: This is only useful for PBR Materials at the moment. This could be extended if required to\r\n * other types of materials.\r\n */\r\n _this.falloffType = Light.FALLOFF_DEFAULT;\r\n /**\r\n * Strength of the light.\r\n * Note: By default it is define in the framework own unit.\r\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\r\n */\r\n _this.intensity = 1.0;\r\n _this._range = Number.MAX_VALUE;\r\n _this._inverseSquaredRange = 0;\r\n /**\r\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\r\n * of light.\r\n */\r\n _this._photometricScale = 1.0;\r\n _this._intensityMode = Light.INTENSITYMODE_AUTOMATIC;\r\n _this._radius = 0.00001;\r\n /**\r\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\r\n * exceeding the number allowed of the materials.\r\n */\r\n _this.renderPriority = 0;\r\n _this._shadowEnabled = true;\r\n _this._excludeWithLayerMask = 0;\r\n _this._includeOnlyWithLayerMask = 0;\r\n _this._lightmapMode = 0;\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._excludedMeshesIds = new Array();\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._includedOnlyMeshesIds = new Array();\r\n /** @hidden */\r\n _this._isLight = true;\r\n _this.getScene().addLight(_this);\r\n _this._uniformBuffer = new _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__[\"UniformBuffer\"](_this.getScene().getEngine());\r\n _this._buildUniformLayout();\r\n _this.includedOnlyMeshes = new Array();\r\n _this.excludedMeshes = new Array();\r\n _this._resyncMeshes();\r\n return _this;\r\n }\r\n Object.defineProperty(Light.prototype, \"range\", {\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n get: function () {\r\n return this._range;\r\n },\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n set: function (value) {\r\n this._range = value;\r\n this._inverseSquaredRange = 1.0 / (this.range * this.range);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"intensityMode\", {\r\n /**\r\n * Gets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n get: function () {\r\n return this._intensityMode;\r\n },\r\n /**\r\n * Sets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n set: function (value) {\r\n this._intensityMode = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"radius\", {\r\n /**\r\n * Gets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n get: function () {\r\n return this._radius;\r\n },\r\n /**\r\n * sets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n set: function (value) {\r\n this._radius = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"shadowEnabled\", {\r\n /**\r\n * Gets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n get: function () {\r\n return this._shadowEnabled;\r\n },\r\n /**\r\n * Sets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n set: function (value) {\r\n if (this._shadowEnabled === value) {\r\n return;\r\n }\r\n this._shadowEnabled = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includedOnlyMeshes\", {\r\n /**\r\n * Gets the only meshes impacted by this light.\r\n */\r\n get: function () {\r\n return this._includedOnlyMeshes;\r\n },\r\n /**\r\n * Sets the only meshes impacted by this light.\r\n */\r\n set: function (value) {\r\n this._includedOnlyMeshes = value;\r\n this._hookArrayForIncludedOnly(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludedMeshes\", {\r\n /**\r\n * Gets the meshes not impacted by this light.\r\n */\r\n get: function () {\r\n return this._excludedMeshes;\r\n },\r\n /**\r\n * Sets the meshes not impacted by this light.\r\n */\r\n set: function (value) {\r\n this._excludedMeshes = value;\r\n this._hookArrayForExcluded(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludeWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._excludeWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._excludeWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includeOnlyWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._includeOnlyWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._includeOnlyWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"lightmapMode\", {\r\n /**\r\n * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n get: function () {\r\n return this._lightmapMode;\r\n },\r\n /**\r\n * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n set: function (value) {\r\n if (this._lightmapMode === value) {\r\n return;\r\n }\r\n this._lightmapMode = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"Light\".\r\n * @returns the class name\r\n */\r\n Light.prototype.getClassName = function () {\r\n return \"Light\";\r\n };\r\n /**\r\n * Converts the light information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable light info\r\n */\r\n Light.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + ([\"Point\", \"Directional\", \"Spot\", \"Hemispheric\"])[this.getTypeID()];\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Light.prototype._syncParentEnabledState = function () {\r\n _super.prototype._syncParentEnabledState.call(this);\r\n this._resyncMeshes();\r\n };\r\n /**\r\n * Set the enabled state of this node.\r\n * @param value - the new enabled state\r\n */\r\n Light.prototype.setEnabled = function (value) {\r\n _super.prototype.setEnabled.call(this, value);\r\n this._resyncMeshes();\r\n };\r\n /**\r\n * Returns the Light associated shadow generator if any.\r\n * @return the associated shadow generator.\r\n */\r\n Light.prototype.getShadowGenerator = function () {\r\n return this._shadowGenerator;\r\n };\r\n /**\r\n * Returns a Vector3, the absolute light position in the World.\r\n * @returns the world space position of the light\r\n */\r\n Light.prototype.getAbsolutePosition = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Specifies if the light will affect the passed mesh.\r\n * @param mesh The mesh to test against the light\r\n * @return true the mesh is affected otherwise, false.\r\n */\r\n Light.prototype.canAffectMesh = function (mesh) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {\r\n return false;\r\n }\r\n if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return false;\r\n }\r\n if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {\r\n return false;\r\n }\r\n if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sort function to order lights for rendering.\r\n * @param a First Light object to compare to second.\r\n * @param b Second Light object to compare first.\r\n * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.\r\n */\r\n Light.CompareLightsPriority = function (a, b) {\r\n //shadow-casting lights have priority over non-shadow-casting lights\r\n //the renderPrioirty is a secondary sort criterion\r\n if (a.shadowEnabled !== b.shadowEnabled) {\r\n return (b.shadowEnabled ? 1 : 0) - (a.shadowEnabled ? 1 : 0);\r\n }\r\n return b.renderPriority - a.renderPriority;\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Light.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n if (this._shadowGenerator) {\r\n this._shadowGenerator.dispose();\r\n this._shadowGenerator = null;\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(this, true);\r\n }\r\n this._uniformBuffer.dispose();\r\n // Remove from scene\r\n this.getScene().removeLight(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Returns the light type ID (integer).\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n Light.prototype.getTypeID = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.\r\n * @returns the scaled intensity in intensity mode unit\r\n */\r\n Light.prototype.getScaledIntensity = function () {\r\n return this._photometricScale * this.intensity;\r\n };\r\n /**\r\n * Returns a new Light object, named \"name\", from the current one.\r\n * @param name The name of the cloned light\r\n * @returns the new created light\r\n */\r\n Light.prototype.clone = function (name) {\r\n var constructor = Light.GetConstructorFromName(this.getTypeID(), name, this.getScene());\r\n if (!constructor) {\r\n return null;\r\n }\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(constructor, this);\r\n };\r\n /**\r\n * Serializes the current light into a Serialization object.\r\n * @returns the serialized object.\r\n */\r\n Light.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n // Type\r\n serializationObject.type = this.getTypeID();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Inclusion / exclusions\r\n if (this.excludedMeshes.length > 0) {\r\n serializationObject.excludedMeshesIds = [];\r\n this.excludedMeshes.forEach(function (mesh) {\r\n serializationObject.excludedMeshesIds.push(mesh.id);\r\n });\r\n }\r\n if (this.includedOnlyMeshes.length > 0) {\r\n serializationObject.includedOnlyMeshesIds = [];\r\n this.includedOnlyMeshes.forEach(function (mesh) {\r\n serializationObject.includedOnlyMeshesIds.push(mesh.id);\r\n });\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.\r\n * This new light is named \"name\" and added to the passed scene.\r\n * @param type Type according to the types available in Light.LIGHTTYPEID_x\r\n * @param name The friendly name of the light\r\n * @param scene The scene the new light will belong to\r\n * @returns the constructor function\r\n */\r\n Light.GetConstructorFromName = function (type, name, scene) {\r\n var constructorFunc = _node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].Construct(\"Light_Type_\" + type, name, scene);\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to no light for none present once.\r\n return null;\r\n };\r\n /**\r\n * Parses the passed \"parsedLight\" and returns a new instanced Light from this parsing.\r\n * @param parsedLight The JSON representation of the light\r\n * @param scene The scene to create the parsed light in\r\n * @returns the created light after parsing\r\n */\r\n Light.Parse = function (parsedLight, scene) {\r\n var constructor = Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene);\r\n if (!constructor) {\r\n return null;\r\n }\r\n var light = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(constructor, parsedLight, scene);\r\n // Inclusion / exclusions\r\n if (parsedLight.excludedMeshesIds) {\r\n light._excludedMeshesIds = parsedLight.excludedMeshesIds;\r\n }\r\n if (parsedLight.includedOnlyMeshesIds) {\r\n light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;\r\n }\r\n // Parent\r\n if (parsedLight.parentId) {\r\n light._waitingParentId = parsedLight.parentId;\r\n }\r\n // Falloff\r\n if (parsedLight.falloffType !== undefined) {\r\n light.falloffType = parsedLight.falloffType;\r\n }\r\n // Lightmaps\r\n if (parsedLight.lightmapMode !== undefined) {\r\n light.lightmapMode = parsedLight.lightmapMode;\r\n }\r\n // Animations\r\n if (parsedLight.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedLight.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n light.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].ParseAnimationRanges(light, parsedLight, scene);\r\n }\r\n if (parsedLight.autoAnimate) {\r\n scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);\r\n }\r\n return light;\r\n };\r\n Light.prototype._hookArrayForExcluded = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {\r\n var item = items_1[_a];\r\n item._resyncLighSource(_this);\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n for (var _i = 0, deleted_1 = deleted; _i < deleted_1.length; _i++) {\r\n var item = deleted_1[_i];\r\n item._resyncLighSource(_this);\r\n }\r\n return deleted;\r\n };\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var item = array_1[_i];\r\n item._resyncLighSource(this);\r\n }\r\n };\r\n Light.prototype._hookArrayForIncludedOnly = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._resyncMeshes();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._resyncMeshes();\r\n return deleted;\r\n };\r\n this._resyncMeshes();\r\n };\r\n Light.prototype._resyncMeshes = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._resyncLighSource(this);\r\n }\r\n };\r\n /**\r\n * Forces the meshes to update their light related information in their rendering used effects\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._markMeshesAsLightDirty = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(this) !== -1) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n };\r\n /**\r\n * Recomputes the cached photometric scale if needed.\r\n */\r\n Light.prototype._computePhotometricScale = function () {\r\n this._photometricScale = this._getPhotometricScale();\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Returns the Photometric Scale according to the light type and intensity mode.\r\n */\r\n Light.prototype._getPhotometricScale = function () {\r\n var photometricScale = 0.0;\r\n var lightTypeID = this.getTypeID();\r\n //get photometric mode\r\n var photometricMode = this.intensityMode;\r\n if (photometricMode === Light.INTENSITYMODE_AUTOMATIC) {\r\n if (lightTypeID === Light.LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n photometricMode = Light.INTENSITYMODE_ILLUMINANCE;\r\n }\r\n else {\r\n photometricMode = Light.INTENSITYMODE_LUMINOUSINTENSITY;\r\n }\r\n }\r\n //compute photometric scale\r\n switch (lightTypeID) {\r\n case Light.LIGHTTYPEID_POINTLIGHT:\r\n case Light.LIGHTTYPEID_SPOTLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_LUMINOUSPOWER:\r\n photometricScale = 1.0 / (4.0 * Math.PI);\r\n break;\r\n case Light.INTENSITYMODE_LUMINOUSINTENSITY:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n photometricScale = this.radius * this.radius;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_DIRECTIONALLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_ILLUMINANCE:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n // When radius (and therefore solid angle) is non-zero a directional lights brightness can be specified via central (peak) luminance.\r\n // For a directional light the 'radius' defines the angular radius (in radians) rather than world-space radius (e.g. in metres).\r\n var apexAngleRadians = this.radius;\r\n // Impose a minimum light angular size to avoid the light becoming an infinitely small angular light source (i.e. a dirac delta function).\r\n apexAngleRadians = Math.max(apexAngleRadians, 0.001);\r\n var solidAngle = 2.0 * Math.PI * (1.0 - Math.cos(apexAngleRadians));\r\n photometricScale = solidAngle;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_HEMISPHERICLIGHT:\r\n // No fall off in hemisperic light.\r\n photometricScale = 1.0;\r\n break;\r\n }\r\n return photometricScale;\r\n };\r\n /**\r\n * Reorder the light in the scene according to their defined priority.\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._reorderLightsInScene = function () {\r\n var scene = this.getScene();\r\n if (this._renderPriority != 0) {\r\n scene.requireLightSorting = true;\r\n }\r\n this.getScene().sortLightsByPriority();\r\n };\r\n /**\r\n * Falloff Default: light is falling off following the material specification:\r\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\r\n */\r\n Light.FALLOFF_DEFAULT = 0;\r\n /**\r\n * Falloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n Light.FALLOFF_PHYSICAL = 1;\r\n /**\r\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n Light.FALLOFF_GLTF = 2;\r\n /**\r\n * Falloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n Light.FALLOFF_STANDARD = 3;\r\n //lightmapMode Consts\r\n /**\r\n * If every light affecting the material is in this lightmapMode,\r\n * material.lightmapTexture adds or multiplies\r\n * (depends on material.useLightmapAsShadowmap)\r\n * after every other light calculations.\r\n */\r\n Light.LIGHTMAP_DEFAULT = 0;\r\n /**\r\n * material.lightmapTexture as only diffuse lighting from this light\r\n * adds only specular lighting from this light\r\n * adds dynamic shadows\r\n */\r\n Light.LIGHTMAP_SPECULAR = 1;\r\n /**\r\n * material.lightmapTexture as only lighting\r\n * no light calculation from this light\r\n * only adds dynamic shadows from this light\r\n */\r\n Light.LIGHTMAP_SHADOWSONLY = 2;\r\n // Intensity Mode Consts\r\n /**\r\n * Each light type uses the default quantity according to its type:\r\n * point/spot lights use luminous intensity\r\n * directional lights use illuminance\r\n */\r\n Light.INTENSITYMODE_AUTOMATIC = 0;\r\n /**\r\n * lumen (lm)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSPOWER = 1;\r\n /**\r\n * candela (lm/sr)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSINTENSITY = 2;\r\n /**\r\n * lux (lm/m^2)\r\n */\r\n Light.INTENSITYMODE_ILLUMINANCE = 3;\r\n /**\r\n * nit (cd/m^2)\r\n */\r\n Light.INTENSITYMODE_LUMINANCE = 4;\r\n // Light types ids const.\r\n /**\r\n * Light type const id of the point light.\r\n */\r\n Light.LIGHTTYPEID_POINTLIGHT = 0;\r\n /**\r\n * Light type const id of the directional light.\r\n */\r\n Light.LIGHTTYPEID_DIRECTIONALLIGHT = 1;\r\n /**\r\n * Light type const id of the spot light.\r\n */\r\n Light.LIGHTTYPEID_SPOTLIGHT = 2;\r\n /**\r\n * Light type const id of the hemispheric light.\r\n */\r\n Light.LIGHTTYPEID_HEMISPHERICLIGHT = 3;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], Light.prototype, \"diffuse\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], Light.prototype, \"specular\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"falloffType\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"range\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"intensityMode\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"radius\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"_renderPriority\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_reorderLightsInScene\")\r\n ], Light.prototype, \"renderPriority\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"shadowEnabled\")\r\n ], Light.prototype, \"_shadowEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"excludeWithLayerMask\")\r\n ], Light.prototype, \"_excludeWithLayerMask\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"includeOnlyWithLayerMask\")\r\n ], Light.prototype, \"_includeOnlyWithLayerMask\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"lightmapMode\")\r\n ], Light.prototype, \"_lightmapMode\", void 0);\r\n return Light;\r\n}(_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/pointLight.ts\":\n/*!******************************!*\\\n !*** ./Lights/pointLight.ts ***!\n \\******************************/\n/*! exports provided: PointLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return PointLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"Light_Type_0\", function (name, scene) {\r\n return function () { return new PointLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar PointLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PointLight, _super);\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n function PointLight(name, position, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowAngle = Math.PI / 2;\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(PointLight.prototype, \"shadowAngle\", {\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n get: function () {\r\n return this._shadowAngle;\r\n },\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n set: function (value) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointLight.prototype, \"direction\", {\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n set: function (value) {\r\n var previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerator) {\r\n this._shadowGenerator.recreateShadowMap();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n PointLight.prototype.getClassName = function () {\r\n return \"PointLight\";\r\n };\r\n /**\r\n * Returns the integer 0.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n PointLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_POINTLIGHT;\r\n };\r\n /**\r\n * Specifies wether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n PointLight.prototype.needCube = function () {\r\n return !this.direction;\r\n };\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n PointLight.prototype.getShadowDirection = function (faceIndex) {\r\n if (this.direction) {\r\n return _super.prototype.getShadowDirection.call(this, faceIndex);\r\n }\r\n else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1.0, 0.0, 0.0);\r\n case 1:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](-1.0, 0.0, 0.0);\r\n case 2:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, -1.0, 0.0);\r\n case 3:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, 1.0, 0.0);\r\n case 4:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, 0.0, 1.0);\r\n case 5:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, 0.0, -1.0);\r\n }\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\r\n */\r\n PointLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].PerspectiveFovLHToRef(this.shadowAngle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n PointLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The point light\r\n */\r\n PointLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n };\r\n PointLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n PointLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"POINTLIGHT\" + lightIndex] = true;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PointLight.prototype, \"shadowAngle\", null);\r\n return PointLight;\r\n}(_shadowLight__WEBPACK_IMPORTED_MODULE_5__[\"ShadowLight\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/shadowLight.ts\":\n/*!*******************************!*\\\n !*** ./Lights/shadowLight.ts ***!\n \\*******************************/\n/*! exports provided: ShadowLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return ShadowLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base implementation IShadowLight\r\n * It groups all the common behaviour in order to reduce dupplication and better follow the DRY pattern.\r\n */\r\nvar ShadowLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShadowLight, _super);\r\n function ShadowLight() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._needProjectionMatrixCompute = true;\r\n return _this;\r\n }\r\n ShadowLight.prototype._setPosition = function (value) {\r\n this._position = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"position\", {\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n set: function (value) {\r\n this._setPosition(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ShadowLight.prototype._setDirection = function (value) {\r\n this._direction = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"direction\", {\r\n /**\r\n * In 2d mode (needCube being false), gets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In 2d mode (needCube being false), sets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n set: function (value) {\r\n this._setDirection(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMinZ\", {\r\n /**\r\n * Gets the shadow projection clipping minimum z value.\r\n */\r\n get: function () {\r\n return this._shadowMinZ;\r\n },\r\n /**\r\n * Sets the shadow projection clipping minimum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMinZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMaxZ\", {\r\n /**\r\n * Sets the shadow projection clipping maximum z value.\r\n */\r\n get: function () {\r\n return this._shadowMaxZ;\r\n },\r\n /**\r\n * Gets the shadow projection clipping maximum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMaxZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n ShadowLight.prototype.computeTransformedInformation = function () {\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n if (!this.transformedPosition) {\r\n this.transformedPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);\r\n // In case the direction is present.\r\n if (this.direction) {\r\n if (!this.transformedDirection) {\r\n this.transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Return the depth scale used for the shadow map.\r\n * @returns the depth scale.\r\n */\r\n ShadowLight.prototype.getDepthScale = function () {\r\n return 50.0;\r\n };\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n ShadowLight.prototype.getShadowDirection = function (faceIndex) {\r\n return this.transformedDirection ? this.transformedDirection : this.direction;\r\n };\r\n /**\r\n * Returns the ShadowLight absolute position in the World.\r\n * @returns the position vector in world space\r\n */\r\n ShadowLight.prototype.getAbsolutePosition = function () {\r\n return this.transformedPosition ? this.transformedPosition : this.position;\r\n };\r\n /**\r\n * Sets the ShadowLight direction toward the passed target.\r\n * @param target The point to target in local space\r\n * @returns the updated ShadowLight direction\r\n */\r\n ShadowLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(target.subtract(this.position));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the light rotation in euler definition.\r\n * @returns the x y z rotation in local space.\r\n */\r\n ShadowLight.prototype.getRotation = function () {\r\n this.direction.normalize();\r\n var xaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(this.direction, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Axis\"].Y);\r\n var yaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(xaxis, this.direction);\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].RotationFromAxis(xaxis, yaxis, this.direction);\r\n };\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n ShadowLight.prototype.needCube = function () {\r\n return false;\r\n };\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n ShadowLight.prototype.needProjectionMatrixCompute = function () {\r\n return this._needProjectionMatrixCompute;\r\n };\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n ShadowLight.prototype.forceProjectionMatrixCompute = function () {\r\n this._needProjectionMatrixCompute = true;\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._isSynchronized = function () {\r\n if (!this._cache.position.equals(this.position)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n ShadowLight.prototype.computeWorldMatrix = function (force) {\r\n if (!force && this.isSynchronized()) {\r\n this._currentRenderId = this.getScene().getRenderId();\r\n return this._worldMatrix;\r\n }\r\n this._updateCache();\r\n this._cache.position.copyFrom(this.position);\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);\r\n this._markSyncedWithParent();\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n ShadowLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n ShadowLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n };\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The materix to updated with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n ShadowLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.customProjectionMatrixBuilder) {\r\n this.customProjectionMatrixBuilder(viewMatrix, renderList, matrix);\r\n }\r\n else {\r\n this._setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n return this;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ShadowLight.prototype, \"position\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ShadowLight.prototype, \"direction\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ShadowLight.prototype, \"shadowMinZ\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ShadowLight.prototype, \"shadowMaxZ\", null);\r\n return ShadowLight;\r\n}(_light__WEBPACK_IMPORTED_MODULE_3__[\"Light\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/spotLight.ts\":\n/*!*****************************!*\\\n !*** ./Lights/spotLight.ts ***!\n \\*****************************/\n/*! exports provided: SpotLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return SpotLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"Light_Type_2\", function (name, scene) {\r\n return function () { return new SpotLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), 0, 0, scene); };\r\n});\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar SpotLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SpotLight, _super);\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n */\r\n function SpotLight(name, position, direction, angle, exponent, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._innerAngle = 0;\r\n _this._projectionTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Zero();\r\n _this._projectionTextureLightNear = 1e-6;\r\n _this._projectionTextureLightFar = 1000.0;\r\n _this._projectionTextureUpDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Up();\r\n _this._projectionTextureViewLightDirty = true;\r\n _this._projectionTextureProjectionLightDirty = true;\r\n _this._projectionTextureDirty = true;\r\n _this._projectionTextureViewTargetVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._projectionTextureViewLightMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Zero();\r\n _this._projectionTextureProjectionLightMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Zero();\r\n _this._projectionTextureScalingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n _this.position = position;\r\n _this.direction = direction;\r\n _this.angle = angle;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n Object.defineProperty(SpotLight.prototype, \"angle\", {\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n get: function () {\r\n return this._angle;\r\n },\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n set: function (value) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"innerAngle\", {\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n get: function () {\r\n return this._innerAngle;\r\n },\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n set: function (value) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"shadowAngleScale\", {\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n get: function () {\r\n return this._shadowAngleScale;\r\n },\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n set: function (value) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureMatrix\", {\r\n /**\r\n * Allows reading the projecton texture\r\n */\r\n get: function () {\r\n return this._projectionTextureMatrix;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightNear\", {\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightNear;\r\n },\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightFar\", {\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightFar;\r\n },\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureUpDirection\", {\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureUpDirection;\r\n },\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTexture\", {\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n get: function () {\r\n return this._projectionTexture;\r\n },\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n var texture = this._projectionTexture;\r\n if (texture.onLoadObservable) {\r\n texture.onLoadObservable.addOnce(function () {\r\n _this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n SpotLight.prototype.getClassName = function () {\r\n return \"SpotLight\";\r\n };\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n SpotLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_SPOTLIGHT;\r\n };\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setDirection = function (value) {\r\n _super.prototype._setDirection.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setPosition = function (value) {\r\n _super.prototype._setPosition.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n */\r\n SpotLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n var angle = this._shadowAngleScale * this._angle;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].PerspectiveFovLHToRef(angle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureViewLightMatrix = function () {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n this.position.addToRef(this.direction, this._projectionTextureViewTargetVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureProjectionLightMatrix = function () {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n var light_far = this.projectionTextureLightFar;\r\n var light_near = this.projectionTextureLightNear;\r\n var P = light_far / (light_far - light_near);\r\n var Q = -P * light_near;\r\n var S = 1.0 / Math.tan(this._angle / 2.0);\r\n var A = 1.0;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromValuesToRef(S / A, 0.0, 0.0, 0.0, 0.0, S, 0.0, 0.0, 0.0, 0.0, P, 1.0, 0.0, 0.0, Q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n };\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n SpotLight.prototype._computeProjectionTextureMatrix = function () {\r\n this._projectionTextureDirty = false;\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n };\r\n SpotLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n SpotLight.prototype._computeAngleValues = function () {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, (Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle));\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n };\r\n /**\r\n * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n SpotLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, lightIndex);\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.transformedDirection);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, this.exponent, lightIndex);\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightSampler\" + lightIndex, this.projectionTexture);\r\n }\r\n return this;\r\n };\r\n SpotLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.transformedDirection);\r\n }\r\n else {\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n SpotLight.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n SpotLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"angle\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"innerAngle\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"shadowAngleScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"exponent\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"projectionTextureLightNear\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"projectionTextureLightFar\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"projectionTextureUpDirection\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"projectedLightTexture\")\r\n ], SpotLight.prototype, \"_projectionTexture\", void 0);\r\n return SpotLight;\r\n}(_shadowLight__WEBPACK_IMPORTED_MODULE_5__[\"ShadowLight\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/Plugins/babylonFileLoader.ts\":\n/*!**********************************************!*\\\n !*** ./Loading/Plugins/babylonFileLoader.ts ***!\n \\**********************************************/\n/*! exports provided: _BabylonLoaderRegistered */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _BabylonLoaderRegistered; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_geometry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/geometry */ \"./Meshes/geometry.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Materials/multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony import */ var _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Materials/Textures/cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Materials/Textures/hdrCubeTexture */ \"./Materials/Textures/hdrCubeTexture.ts\");\n/* harmony import */ var _Animations_animationGroup__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Animations/animationGroup */ \"./Animations/animationGroup.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _assetContainer__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../assetContainer */ \"./assetContainer.ts\");\n/* harmony import */ var _Actions_actionManager__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Actions/actionManager */ \"./Actions/actionManager.ts\");\n/* harmony import */ var _Bones_skeleton__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Bones/skeleton */ \"./Bones/skeleton.ts\");\n/* harmony import */ var _Morph_morphTargetManager__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Morph/morphTargetManager */ \"./Morph/morphTargetManager.ts\");\n/* harmony import */ var _Physics_Plugins_cannonJSPlugin__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../Physics/Plugins/cannonJSPlugin */ \"./Physics/Plugins/cannonJSPlugin.ts\");\n/* harmony import */ var _Physics_Plugins_oimoJSPlugin__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../Physics/Plugins/oimoJSPlugin */ \"./Physics/Plugins/oimoJSPlugin.ts\");\n/* harmony import */ var _Physics_Plugins_ammoJSPlugin__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../Physics/Plugins/ammoJSPlugin */ \"./Physics/Plugins/ammoJSPlugin.ts\");\n/* harmony import */ var _Probes_reflectionProbe__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../Probes/reflectionProbe */ \"./Probes/reflectionProbe.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_stringTools__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../Misc/stringTools */ \"./Misc/stringTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _BabylonLoaderRegistered = true;\r\nvar parseMaterialById = function (id, parsedData, scene, rootUrl) {\r\n for (var index = 0, cache = parsedData.materials.length; index < cache; index++) {\r\n var parsedMaterial = parsedData.materials[index];\r\n if (parsedMaterial.id === id) {\r\n return _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].Parse(parsedMaterial, scene, rootUrl);\r\n }\r\n }\r\n return null;\r\n};\r\nvar isDescendantOf = function (mesh, names, hierarchyIds) {\r\n for (var i in names) {\r\n if (mesh.name === names[i]) {\r\n hierarchyIds.push(mesh.id);\r\n return true;\r\n }\r\n }\r\n if (mesh.parentId && hierarchyIds.indexOf(mesh.parentId) !== -1) {\r\n hierarchyIds.push(mesh.id);\r\n return true;\r\n }\r\n return false;\r\n};\r\nvar logOperation = function (operation, producer) {\r\n return operation + \" of \" + (producer ? producer.file + \" from \" + producer.name + \" version: \" + producer.version + \", exporter version: \" + producer.exporter_version : \"unknown\");\r\n};\r\nvar loadDetailLevels = function (scene, mesh) {\r\n var mastermesh = mesh;\r\n // Every value specified in the ids array of the lod data points to another mesh which should be used as the lower LOD level.\r\n // The distances (or coverages) array values specified are used along with the lod mesh ids as a hint to determine the switching threshold for the various LODs.\r\n if (mesh._waitingData.lods) {\r\n if (mesh._waitingData.lods.ids && mesh._waitingData.lods.ids.length > 0) {\r\n var lodmeshes = mesh._waitingData.lods.ids;\r\n var wasenabled = mastermesh.isEnabled(false);\r\n if (mesh._waitingData.lods.distances) {\r\n var distances = mesh._waitingData.lods.distances;\r\n if (distances.length >= lodmeshes.length) {\r\n var culling = (distances.length > lodmeshes.length) ? distances[distances.length - 1] : 0;\r\n mastermesh.setEnabled(false);\r\n for (var index = 0; index < lodmeshes.length; index++) {\r\n var lodid = lodmeshes[index];\r\n var lodmesh = scene.getMeshByID(lodid);\r\n if (lodmesh != null) {\r\n mastermesh.addLODLevel(distances[index], lodmesh);\r\n }\r\n }\r\n if (culling > 0) {\r\n mastermesh.addLODLevel(culling, null);\r\n }\r\n if (wasenabled === true) {\r\n mastermesh.setEnabled(true);\r\n }\r\n }\r\n else {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_25__[\"Tools\"].Warn(\"Invalid level of detail distances for \" + mesh.name);\r\n }\r\n }\r\n }\r\n mesh._waitingData.lods = null;\r\n }\r\n};\r\nvar loadAssetContainer = function (scene, data, rootUrl, onError, addToScene) {\r\n if (addToScene === void 0) { addToScene = false; }\r\n var container = new _assetContainer__WEBPACK_IMPORTED_MODULE_16__[\"AssetContainer\"](scene);\r\n // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details\r\n // when SceneLoader.debugLogging = true (default), or exception encountered.\r\n // Everything stored in var log instead of writing separate lines to support only writing in exception,\r\n // and avoid problems with multiple concurrent .babylon loads.\r\n var log = \"importScene has failed JSON parse\";\r\n try {\r\n var parsedData = JSON.parse(data);\r\n log = \"\";\r\n var fullDetails = _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel === _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].DETAILED_LOGGING;\r\n var index;\r\n var cache;\r\n // Environment texture\r\n if (parsedData.environmentTexture !== undefined && parsedData.environmentTexture !== null) {\r\n // PBR needed for both HDR texture (gamma space) & a sky box\r\n var isPBR = parsedData.isPBR !== undefined ? parsedData.isPBR : true;\r\n if (parsedData.environmentTextureType && parsedData.environmentTextureType === \"BABYLON.HDRCubeTexture\") {\r\n var hdrSize = (parsedData.environmentTextureSize) ? parsedData.environmentTextureSize : 128;\r\n var hdrTexture = new _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_10__[\"HDRCubeTexture\"]((parsedData.environmentTexture.match(/https?:\\/\\//g) ? \"\" : rootUrl) + parsedData.environmentTexture, scene, hdrSize, true, !isPBR);\r\n if (parsedData.environmentTextureRotationY) {\r\n hdrTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = hdrTexture;\r\n }\r\n else {\r\n if (_Misc_stringTools__WEBPACK_IMPORTED_MODULE_26__[\"StringTools\"].EndsWith(parsedData.environmentTexture, \".env\")) {\r\n var compressedTexture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"]((parsedData.environmentTexture.match(/https?:\\/\\//g) ? \"\" : rootUrl) + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n compressedTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = compressedTexture;\r\n }\r\n else {\r\n var cubeTexture = _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"].CreateFromPrefilteredData((parsedData.environmentTexture.match(/https?:\\/\\//g) ? \"\" : rootUrl) + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n cubeTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = cubeTexture;\r\n }\r\n }\r\n if (parsedData.createDefaultSkybox === true) {\r\n var skyboxScale = (scene.activeCamera !== undefined && scene.activeCamera !== null) ? (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2 : 1000;\r\n var skyboxBlurLevel = parsedData.skyboxBlurLevel || 0;\r\n scene.createDefaultSkybox(scene.environmentTexture, isPBR, skyboxScale, skyboxBlurLevel);\r\n }\r\n container.environmentTexture = scene.environmentTexture;\r\n }\r\n // Environment Intensity\r\n if (parsedData.environmentIntensity !== undefined && parsedData.environmentIntensity !== null) {\r\n scene.environmentIntensity = parsedData.environmentIntensity;\r\n }\r\n // Lights\r\n if (parsedData.lights !== undefined && parsedData.lights !== null) {\r\n for (index = 0, cache = parsedData.lights.length; index < cache; index++) {\r\n var parsedLight = parsedData.lights[index];\r\n var light = _Lights_light__WEBPACK_IMPORTED_MODULE_12__[\"Light\"].Parse(parsedLight, scene);\r\n if (light) {\r\n container.lights.push(light);\r\n log += (index === 0 ? \"\\n\\tLights:\" : \"\");\r\n log += \"\\n\\t\\t\" + light.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Reflection probes\r\n if (parsedData.reflectionProbes !== undefined && parsedData.reflectionProbes !== null) {\r\n for (index = 0, cache = parsedData.reflectionProbes.length; index < cache; index++) {\r\n var parsedReflectionProbe = parsedData.reflectionProbes[index];\r\n var reflectionProbe = _Probes_reflectionProbe__WEBPACK_IMPORTED_MODULE_23__[\"ReflectionProbe\"].Parse(parsedReflectionProbe, scene, rootUrl);\r\n if (reflectionProbe) {\r\n container.reflectionProbes.push(reflectionProbe);\r\n log += (index === 0 ? \"\\n\\tReflection Probes:\" : \"\");\r\n log += \"\\n\\t\\t\" + reflectionProbe.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Animations\r\n if (parsedData.animations !== undefined && parsedData.animations !== null) {\r\n for (index = 0, cache = parsedData.animations.length; index < cache; index++) {\r\n var parsedAnimation = parsedData.animations[index];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_24__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n var animation = internalClass.Parse(parsedAnimation);\r\n scene.animations.push(animation);\r\n container.animations.push(animation);\r\n log += (index === 0 ? \"\\n\\tAnimations:\" : \"\");\r\n log += \"\\n\\t\\t\" + animation.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Materials\r\n if (parsedData.materials !== undefined && parsedData.materials !== null) {\r\n for (index = 0, cache = parsedData.materials.length; index < cache; index++) {\r\n var parsedMaterial = parsedData.materials[index];\r\n var mat = _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].Parse(parsedMaterial, scene, rootUrl);\r\n if (mat) {\r\n container.materials.push(mat);\r\n log += (index === 0 ? \"\\n\\tMaterials:\" : \"\");\r\n log += \"\\n\\t\\t\" + mat.toString(fullDetails);\r\n // Textures\r\n var textures = mat.getActiveTextures();\r\n textures.forEach(function (t) {\r\n if (container.textures.indexOf(t) == -1) {\r\n container.textures.push(t);\r\n }\r\n });\r\n }\r\n }\r\n }\r\n if (parsedData.multiMaterials !== undefined && parsedData.multiMaterials !== null) {\r\n for (index = 0, cache = parsedData.multiMaterials.length; index < cache; index++) {\r\n var parsedMultiMaterial = parsedData.multiMaterials[index];\r\n var mmat = _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_8__[\"MultiMaterial\"].ParseMultiMaterial(parsedMultiMaterial, scene);\r\n container.multiMaterials.push(mmat);\r\n log += (index === 0 ? \"\\n\\tMultiMaterials:\" : \"\");\r\n log += \"\\n\\t\\t\" + mmat.toString(fullDetails);\r\n // Textures\r\n var textures = mmat.getActiveTextures();\r\n textures.forEach(function (t) {\r\n if (container.textures.indexOf(t) == -1) {\r\n container.textures.push(t);\r\n }\r\n });\r\n }\r\n }\r\n // Morph targets\r\n if (parsedData.morphTargetManagers !== undefined && parsedData.morphTargetManagers !== null) {\r\n for (var _i = 0, _a = parsedData.morphTargetManagers; _i < _a.length; _i++) {\r\n var managerData = _a[_i];\r\n container.morphTargetManagers.push(_Morph_morphTargetManager__WEBPACK_IMPORTED_MODULE_19__[\"MorphTargetManager\"].Parse(managerData, scene));\r\n }\r\n }\r\n // Skeletons\r\n if (parsedData.skeletons !== undefined && parsedData.skeletons !== null) {\r\n for (index = 0, cache = parsedData.skeletons.length; index < cache; index++) {\r\n var parsedSkeleton = parsedData.skeletons[index];\r\n var skeleton = _Bones_skeleton__WEBPACK_IMPORTED_MODULE_18__[\"Skeleton\"].Parse(parsedSkeleton, scene);\r\n container.skeletons.push(skeleton);\r\n log += (index === 0 ? \"\\n\\tSkeletons:\" : \"\");\r\n log += \"\\n\\t\\t\" + skeleton.toString(fullDetails);\r\n }\r\n }\r\n // Geometries\r\n var geometries = parsedData.geometries;\r\n if (geometries !== undefined && geometries !== null) {\r\n var addedGeometry = new Array();\r\n // VertexData\r\n var vertexData = geometries.vertexData;\r\n if (vertexData !== undefined && vertexData !== null) {\r\n for (index = 0, cache = vertexData.length; index < cache; index++) {\r\n var parsedVertexData = vertexData[index];\r\n addedGeometry.push(_Meshes_geometry__WEBPACK_IMPORTED_MODULE_5__[\"Geometry\"].Parse(parsedVertexData, scene, rootUrl));\r\n }\r\n }\r\n addedGeometry.forEach(function (g) {\r\n if (g) {\r\n container.geometries.push(g);\r\n }\r\n });\r\n }\r\n // Transform nodes\r\n if (parsedData.transformNodes !== undefined && parsedData.transformNodes !== null) {\r\n for (index = 0, cache = parsedData.transformNodes.length; index < cache; index++) {\r\n var parsedTransformNode = parsedData.transformNodes[index];\r\n var node = _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_6__[\"TransformNode\"].Parse(parsedTransformNode, scene, rootUrl);\r\n container.transformNodes.push(node);\r\n }\r\n }\r\n // Meshes\r\n if (parsedData.meshes !== undefined && parsedData.meshes !== null) {\r\n for (index = 0, cache = parsedData.meshes.length; index < cache; index++) {\r\n var parsedMesh = parsedData.meshes[index];\r\n var mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].Parse(parsedMesh, scene, rootUrl);\r\n container.meshes.push(mesh);\r\n log += (index === 0 ? \"\\n\\tMeshes:\" : \"\");\r\n log += \"\\n\\t\\t\" + mesh.toString(fullDetails);\r\n }\r\n }\r\n // Cameras\r\n if (parsedData.cameras !== undefined && parsedData.cameras !== null) {\r\n for (index = 0, cache = parsedData.cameras.length; index < cache; index++) {\r\n var parsedCamera = parsedData.cameras[index];\r\n var camera = _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].Parse(parsedCamera, scene);\r\n container.cameras.push(camera);\r\n log += (index === 0 ? \"\\n\\tCameras:\" : \"\");\r\n log += \"\\n\\t\\t\" + camera.toString(fullDetails);\r\n }\r\n }\r\n // Animation Groups\r\n if (parsedData.animationGroups !== undefined && parsedData.animationGroups !== null) {\r\n for (index = 0, cache = parsedData.animationGroups.length; index < cache; index++) {\r\n var parsedAnimationGroup = parsedData.animationGroups[index];\r\n var animationGroup = _Animations_animationGroup__WEBPACK_IMPORTED_MODULE_11__[\"AnimationGroup\"].Parse(parsedAnimationGroup, scene);\r\n container.animationGroups.push(animationGroup);\r\n log += (index === 0 ? \"\\n\\tAnimationGroups:\" : \"\");\r\n log += \"\\n\\t\\t\" + animationGroup.toString(fullDetails);\r\n }\r\n }\r\n // Browsing all the graph to connect the dots\r\n for (index = 0, cache = scene.cameras.length; index < cache; index++) {\r\n var camera = scene.cameras[index];\r\n if (camera._waitingParentId) {\r\n camera.parent = scene.getLastEntryByID(camera._waitingParentId);\r\n camera._waitingParentId = null;\r\n }\r\n }\r\n for (index = 0, cache = scene.lights.length; index < cache; index++) {\r\n var light_1 = scene.lights[index];\r\n if (light_1 && light_1._waitingParentId) {\r\n light_1.parent = scene.getLastEntryByID(light_1._waitingParentId);\r\n light_1._waitingParentId = null;\r\n }\r\n }\r\n // Connect parents & children and parse actions and lods\r\n for (index = 0, cache = scene.transformNodes.length; index < cache; index++) {\r\n var transformNode = scene.transformNodes[index];\r\n if (transformNode._waitingParentId) {\r\n transformNode.parent = scene.getLastEntryByID(transformNode._waitingParentId);\r\n transformNode._waitingParentId = null;\r\n }\r\n }\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n var mesh = scene.meshes[index];\r\n if (mesh._waitingParentId) {\r\n mesh.parent = scene.getLastEntryByID(mesh._waitingParentId);\r\n mesh._waitingParentId = null;\r\n }\r\n if (mesh._waitingData.lods) {\r\n loadDetailLevels(scene, mesh);\r\n }\r\n }\r\n // link skeleton transform nodes\r\n for (index = 0, cache = scene.skeletons.length; index < cache; index++) {\r\n var skeleton = scene.skeletons[index];\r\n if (skeleton._hasWaitingData) {\r\n if (skeleton.bones != null) {\r\n skeleton.bones.forEach(function (bone) {\r\n if (bone._waitingTransformNodeId) {\r\n var linkTransformNode = scene.getLastEntryByID(bone._waitingTransformNodeId);\r\n if (linkTransformNode) {\r\n bone.linkTransformNode(linkTransformNode);\r\n }\r\n bone._waitingTransformNodeId = null;\r\n }\r\n });\r\n }\r\n skeleton._hasWaitingData = null;\r\n }\r\n }\r\n // freeze world matrix application\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n var currentMesh = scene.meshes[index];\r\n if (currentMesh._waitingData.freezeWorldMatrix) {\r\n currentMesh.freezeWorldMatrix();\r\n currentMesh._waitingData.freezeWorldMatrix = null;\r\n }\r\n else {\r\n currentMesh.computeWorldMatrix(true);\r\n }\r\n }\r\n // Lights exclusions / inclusions\r\n for (index = 0, cache = scene.lights.length; index < cache; index++) {\r\n var light_2 = scene.lights[index];\r\n // Excluded check\r\n if (light_2._excludedMeshesIds.length > 0) {\r\n for (var excludedIndex = 0; excludedIndex < light_2._excludedMeshesIds.length; excludedIndex++) {\r\n var excludedMesh = scene.getMeshByID(light_2._excludedMeshesIds[excludedIndex]);\r\n if (excludedMesh) {\r\n light_2.excludedMeshes.push(excludedMesh);\r\n }\r\n }\r\n light_2._excludedMeshesIds = [];\r\n }\r\n // Included check\r\n if (light_2._includedOnlyMeshesIds.length > 0) {\r\n for (var includedOnlyIndex = 0; includedOnlyIndex < light_2._includedOnlyMeshesIds.length; includedOnlyIndex++) {\r\n var includedOnlyMesh = scene.getMeshByID(light_2._includedOnlyMeshesIds[includedOnlyIndex]);\r\n if (includedOnlyMesh) {\r\n light_2.includedOnlyMeshes.push(includedOnlyMesh);\r\n }\r\n }\r\n light_2._includedOnlyMeshesIds = [];\r\n }\r\n }\r\n _abstractScene__WEBPACK_IMPORTED_MODULE_15__[\"AbstractScene\"].Parse(parsedData, scene, container, rootUrl);\r\n // Actions (scene) Done last as it can access other objects.\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n var mesh = scene.meshes[index];\r\n if (mesh._waitingData.actions) {\r\n _Actions_actionManager__WEBPACK_IMPORTED_MODULE_17__[\"ActionManager\"].Parse(mesh._waitingData.actions, mesh, scene);\r\n mesh._waitingData.actions = null;\r\n }\r\n }\r\n if (parsedData.actions !== undefined && parsedData.actions !== null) {\r\n _Actions_actionManager__WEBPACK_IMPORTED_MODULE_17__[\"ActionManager\"].Parse(parsedData.actions, null, scene);\r\n }\r\n if (!addToScene) {\r\n container.removeAllFromScene();\r\n }\r\n }\r\n catch (err) {\r\n var msg = logOperation(\"loadAssets\", parsedData ? parsedData.producer : \"Unknown\") + log;\r\n if (onError) {\r\n onError(msg, err);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(msg);\r\n throw err;\r\n }\r\n }\r\n finally {\r\n if (log !== null && _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].NO_LOGGING) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(logOperation(\"loadAssets\", parsedData ? parsedData.producer : \"Unknown\") + (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].MINIMAL_LOGGING ? log : \"\"));\r\n }\r\n }\r\n return container;\r\n};\r\n_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].RegisterPlugin({\r\n name: \"babylon.js\",\r\n extensions: \".babylon\",\r\n canDirectLoad: function (data) {\r\n if (data.indexOf(\"babylon\") !== -1) { // We consider that the producer string is filled\r\n return true;\r\n }\r\n return false;\r\n },\r\n importMesh: function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons, onError) {\r\n // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details\r\n // when SceneLoader.debugLogging = true (default), or exception encountered.\r\n // Everything stored in var log instead of writing separate lines to support only writing in exception,\r\n // and avoid problems with multiple concurrent .babylon loads.\r\n var log = \"importMesh has failed JSON parse\";\r\n try {\r\n var parsedData = JSON.parse(data);\r\n log = \"\";\r\n var fullDetails = _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel === _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].DETAILED_LOGGING;\r\n if (!meshesNames) {\r\n meshesNames = null;\r\n }\r\n else if (!Array.isArray(meshesNames)) {\r\n meshesNames = [meshesNames];\r\n }\r\n var hierarchyIds = new Array();\r\n if (parsedData.meshes !== undefined && parsedData.meshes !== null) {\r\n var loadedSkeletonsIds = [];\r\n var loadedMaterialsIds = [];\r\n var index;\r\n var cache;\r\n for (index = 0, cache = parsedData.meshes.length; index < cache; index++) {\r\n var parsedMesh = parsedData.meshes[index];\r\n if (meshesNames === null || isDescendantOf(parsedMesh, meshesNames, hierarchyIds)) {\r\n if (meshesNames !== null) {\r\n // Remove found mesh name from list.\r\n delete meshesNames[meshesNames.indexOf(parsedMesh.name)];\r\n }\r\n //Geometry?\r\n if (parsedMesh.geometryId !== undefined && parsedMesh.geometryId !== null) {\r\n //does the file contain geometries?\r\n if (parsedData.geometries !== undefined && parsedData.geometries !== null) {\r\n //find the correct geometry and add it to the scene\r\n var found = false;\r\n [\"boxes\", \"spheres\", \"cylinders\", \"toruses\", \"grounds\", \"planes\", \"torusKnots\", \"vertexData\"].forEach(function (geometryType) {\r\n if (found === true || !parsedData.geometries[geometryType] || !(Array.isArray(parsedData.geometries[geometryType]))) {\r\n return;\r\n }\r\n else {\r\n parsedData.geometries[geometryType].forEach(function (parsedGeometryData) {\r\n if (parsedGeometryData.id === parsedMesh.geometryId) {\r\n switch (geometryType) {\r\n case \"vertexData\":\r\n _Meshes_geometry__WEBPACK_IMPORTED_MODULE_5__[\"Geometry\"].Parse(parsedGeometryData, scene, rootUrl);\r\n break;\r\n }\r\n found = true;\r\n }\r\n });\r\n }\r\n });\r\n if (found === false) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Geometry not found for mesh \" + parsedMesh.id);\r\n }\r\n }\r\n }\r\n // Material ?\r\n if (parsedMesh.materialId) {\r\n var materialFound = (loadedMaterialsIds.indexOf(parsedMesh.materialId) !== -1);\r\n if (materialFound === false && parsedData.multiMaterials !== undefined && parsedData.multiMaterials !== null) {\r\n for (var multimatIndex = 0, multimatCache = parsedData.multiMaterials.length; multimatIndex < multimatCache; multimatIndex++) {\r\n var parsedMultiMaterial = parsedData.multiMaterials[multimatIndex];\r\n if (parsedMultiMaterial.id === parsedMesh.materialId) {\r\n for (var matIndex = 0, matCache = parsedMultiMaterial.materials.length; matIndex < matCache; matIndex++) {\r\n var subMatId = parsedMultiMaterial.materials[matIndex];\r\n loadedMaterialsIds.push(subMatId);\r\n var mat = parseMaterialById(subMatId, parsedData, scene, rootUrl);\r\n if (mat) {\r\n log += \"\\n\\tMaterial \" + mat.toString(fullDetails);\r\n }\r\n }\r\n loadedMaterialsIds.push(parsedMultiMaterial.id);\r\n var mmat = _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_8__[\"MultiMaterial\"].ParseMultiMaterial(parsedMultiMaterial, scene);\r\n if (mmat) {\r\n materialFound = true;\r\n log += \"\\n\\tMulti-Material \" + mmat.toString(fullDetails);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n if (materialFound === false) {\r\n loadedMaterialsIds.push(parsedMesh.materialId);\r\n var mat = parseMaterialById(parsedMesh.materialId, parsedData, scene, rootUrl);\r\n if (!mat) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Material not found for mesh \" + parsedMesh.id);\r\n }\r\n else {\r\n log += \"\\n\\tMaterial \" + mat.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Skeleton ?\r\n if (parsedMesh.skeletonId > -1 && parsedData.skeletons !== undefined && parsedData.skeletons !== null) {\r\n var skeletonAlreadyLoaded = (loadedSkeletonsIds.indexOf(parsedMesh.skeletonId) > -1);\r\n if (skeletonAlreadyLoaded === false) {\r\n for (var skeletonIndex = 0, skeletonCache = parsedData.skeletons.length; skeletonIndex < skeletonCache; skeletonIndex++) {\r\n var parsedSkeleton = parsedData.skeletons[skeletonIndex];\r\n if (parsedSkeleton.id === parsedMesh.skeletonId) {\r\n var skeleton = _Bones_skeleton__WEBPACK_IMPORTED_MODULE_18__[\"Skeleton\"].Parse(parsedSkeleton, scene);\r\n skeletons.push(skeleton);\r\n loadedSkeletonsIds.push(parsedSkeleton.id);\r\n log += \"\\n\\tSkeleton \" + skeleton.toString(fullDetails);\r\n }\r\n }\r\n }\r\n }\r\n // Morph targets ?\r\n if (parsedData.morphTargetManagers !== undefined && parsedData.morphTargetManagers !== null) {\r\n for (var _i = 0, _a = parsedData.morphTargetManagers; _i < _a.length; _i++) {\r\n var managerData = _a[_i];\r\n _Morph_morphTargetManager__WEBPACK_IMPORTED_MODULE_19__[\"MorphTargetManager\"].Parse(managerData, scene);\r\n }\r\n }\r\n var mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].Parse(parsedMesh, scene, rootUrl);\r\n meshes.push(mesh);\r\n log += \"\\n\\tMesh \" + mesh.toString(fullDetails);\r\n }\r\n }\r\n // Connecting parents and lods\r\n var currentMesh;\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n currentMesh = scene.meshes[index];\r\n if (currentMesh._waitingParentId) {\r\n currentMesh.parent = scene.getLastEntryByID(currentMesh._waitingParentId);\r\n currentMesh._waitingParentId = null;\r\n }\r\n if (currentMesh._waitingData.lods) {\r\n loadDetailLevels(scene, currentMesh);\r\n }\r\n }\r\n // link skeleton transform nodes\r\n for (index = 0, cache = scene.skeletons.length; index < cache; index++) {\r\n var skeleton = scene.skeletons[index];\r\n if (skeleton._hasWaitingData) {\r\n if (skeleton.bones != null) {\r\n skeleton.bones.forEach(function (bone) {\r\n if (bone._waitingTransformNodeId) {\r\n var linkTransformNode = scene.getLastEntryByID(bone._waitingTransformNodeId);\r\n if (linkTransformNode) {\r\n bone.linkTransformNode(linkTransformNode);\r\n }\r\n bone._waitingTransformNodeId = null;\r\n }\r\n });\r\n }\r\n skeleton._hasWaitingData = null;\r\n }\r\n }\r\n // freeze and compute world matrix application\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n currentMesh = scene.meshes[index];\r\n if (currentMesh._waitingData.freezeWorldMatrix) {\r\n currentMesh.freezeWorldMatrix();\r\n currentMesh._waitingData.freezeWorldMatrix = null;\r\n }\r\n else {\r\n currentMesh.computeWorldMatrix(true);\r\n }\r\n }\r\n }\r\n // Particles\r\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\r\n var parser = _abstractScene__WEBPACK_IMPORTED_MODULE_15__[\"AbstractScene\"].GetIndividualParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_13__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM);\r\n if (parser) {\r\n for (index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\r\n var parsedParticleSystem = parsedData.particleSystems[index];\r\n if (hierarchyIds.indexOf(parsedParticleSystem.emitterId) !== -1) {\r\n particleSystems.push(parser(parsedParticleSystem, scene, rootUrl));\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n catch (err) {\r\n var msg = logOperation(\"importMesh\", parsedData ? parsedData.producer : \"Unknown\") + log;\r\n if (onError) {\r\n onError(msg, err);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(msg);\r\n throw err;\r\n }\r\n }\r\n finally {\r\n if (log !== null && _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].NO_LOGGING) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(logOperation(\"importMesh\", parsedData ? parsedData.producer : \"Unknown\") + (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].MINIMAL_LOGGING ? log : \"\"));\r\n }\r\n }\r\n return false;\r\n },\r\n load: function (scene, data, rootUrl, onError) {\r\n // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details\r\n // when SceneLoader.debugLogging = true (default), or exception encountered.\r\n // Everything stored in var log instead of writing separate lines to support only writing in exception,\r\n // and avoid problems with multiple concurrent .babylon loads.\r\n var log = \"importScene has failed JSON parse\";\r\n try {\r\n var parsedData = JSON.parse(data);\r\n log = \"\";\r\n // Scene\r\n if (parsedData.useDelayedTextureLoading !== undefined && parsedData.useDelayedTextureLoading !== null) {\r\n scene.useDelayedTextureLoading = parsedData.useDelayedTextureLoading && !_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].ForceFullSceneLoadingForIncremental;\r\n }\r\n if (parsedData.autoClear !== undefined && parsedData.autoClear !== null) {\r\n scene.autoClear = parsedData.autoClear;\r\n }\r\n if (parsedData.clearColor !== undefined && parsedData.clearColor !== null) {\r\n scene.clearColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"].FromArray(parsedData.clearColor);\r\n }\r\n if (parsedData.ambientColor !== undefined && parsedData.ambientColor !== null) {\r\n scene.ambientColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].FromArray(parsedData.ambientColor);\r\n }\r\n if (parsedData.gravity !== undefined && parsedData.gravity !== null) {\r\n scene.gravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedData.gravity);\r\n }\r\n // Fog\r\n if (parsedData.fogMode && parsedData.fogMode !== 0) {\r\n scene.fogMode = parsedData.fogMode;\r\n scene.fogColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].FromArray(parsedData.fogColor);\r\n scene.fogStart = parsedData.fogStart;\r\n scene.fogEnd = parsedData.fogEnd;\r\n scene.fogDensity = parsedData.fogDensity;\r\n log += \"\\tFog mode for scene: \";\r\n switch (scene.fogMode) {\r\n // getters not compiling, so using hardcoded\r\n case 1:\r\n log += \"exp\\n\";\r\n break;\r\n case 2:\r\n log += \"exp2\\n\";\r\n break;\r\n case 3:\r\n log += \"linear\\n\";\r\n break;\r\n }\r\n }\r\n //Physics\r\n if (parsedData.physicsEnabled) {\r\n var physicsPlugin;\r\n if (parsedData.physicsEngine === \"cannon\") {\r\n physicsPlugin = new _Physics_Plugins_cannonJSPlugin__WEBPACK_IMPORTED_MODULE_20__[\"CannonJSPlugin\"]();\r\n }\r\n else if (parsedData.physicsEngine === \"oimo\") {\r\n physicsPlugin = new _Physics_Plugins_oimoJSPlugin__WEBPACK_IMPORTED_MODULE_21__[\"OimoJSPlugin\"]();\r\n }\r\n else if (parsedData.physicsEngine === \"ammo\") {\r\n physicsPlugin = new _Physics_Plugins_ammoJSPlugin__WEBPACK_IMPORTED_MODULE_22__[\"AmmoJSPlugin\"]();\r\n }\r\n log = \"\\tPhysics engine \" + (parsedData.physicsEngine ? parsedData.physicsEngine : \"oimo\") + \" enabled\\n\";\r\n //else - default engine, which is currently oimo\r\n var physicsGravity = parsedData.physicsGravity ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedData.physicsGravity) : null;\r\n scene.enablePhysics(physicsGravity, physicsPlugin);\r\n }\r\n // Metadata\r\n if (parsedData.metadata !== undefined && parsedData.metadata !== null) {\r\n scene.metadata = parsedData.metadata;\r\n }\r\n //collisions, if defined. otherwise, default is true\r\n if (parsedData.collisionsEnabled !== undefined && parsedData.collisionsEnabled !== null) {\r\n scene.collisionsEnabled = parsedData.collisionsEnabled;\r\n }\r\n var container = loadAssetContainer(scene, data, rootUrl, onError, true);\r\n if (!container) {\r\n return false;\r\n }\r\n if (parsedData.autoAnimate) {\r\n scene.beginAnimation(scene, parsedData.autoAnimateFrom, parsedData.autoAnimateTo, parsedData.autoAnimateLoop, parsedData.autoAnimateSpeed || 1.0);\r\n }\r\n if (parsedData.activeCameraID !== undefined && parsedData.activeCameraID !== null) {\r\n scene.setActiveCameraByID(parsedData.activeCameraID);\r\n }\r\n // Environment texture\r\n if (parsedData.environmentTexture !== undefined && parsedData.environmentTexture !== null) {\r\n // PBR needed for both HDR texture (gamma space) & a sky box\r\n var isPBR = parsedData.isPBR !== undefined ? parsedData.isPBR : true;\r\n if (parsedData.environmentTextureType && parsedData.environmentTextureType === \"BABYLON.HDRCubeTexture\") {\r\n var hdrSize = (parsedData.environmentTextureSize) ? parsedData.environmentTextureSize : 128;\r\n var hdrTexture = new _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_10__[\"HDRCubeTexture\"](rootUrl + parsedData.environmentTexture, scene, hdrSize, true, !isPBR);\r\n if (parsedData.environmentTextureRotationY) {\r\n hdrTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = hdrTexture;\r\n }\r\n else {\r\n if (_Misc_stringTools__WEBPACK_IMPORTED_MODULE_26__[\"StringTools\"].EndsWith(parsedData.environmentTexture, \".env\")) {\r\n var compressedTexture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"](rootUrl + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n compressedTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = compressedTexture;\r\n }\r\n else {\r\n var cubeTexture = _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"].CreateFromPrefilteredData(rootUrl + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n cubeTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = cubeTexture;\r\n }\r\n }\r\n if (parsedData.createDefaultSkybox === true) {\r\n var skyboxScale = (scene.activeCamera !== undefined && scene.activeCamera !== null) ? (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2 : 1000;\r\n var skyboxBlurLevel = parsedData.skyboxBlurLevel || 0;\r\n scene.createDefaultSkybox(scene.environmentTexture, isPBR, skyboxScale, skyboxBlurLevel);\r\n }\r\n }\r\n // Finish\r\n return true;\r\n }\r\n catch (err) {\r\n var msg = logOperation(\"importScene\", parsedData ? parsedData.producer : \"Unknown\") + log;\r\n if (onError) {\r\n onError(msg, err);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(msg);\r\n throw err;\r\n }\r\n }\r\n finally {\r\n if (log !== null && _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].NO_LOGGING) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(logOperation(\"importScene\", parsedData ? parsedData.producer : \"Unknown\") + (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].MINIMAL_LOGGING ? log : \"\"));\r\n }\r\n }\r\n return false;\r\n },\r\n loadAssetContainer: function (scene, data, rootUrl, onError) {\r\n var container = loadAssetContainer(scene, data, rootUrl, onError);\r\n return container;\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Loading/Plugins/index.ts\":\n/*!**********************************!*\\\n !*** ./Loading/Plugins/index.ts ***!\n \\**********************************/\n/*! exports provided: _BabylonLoaderRegistered */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babylonFileLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./babylonFileLoader */ \"./Loading/Plugins/babylonFileLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _babylonFileLoader__WEBPACK_IMPORTED_MODULE_0__[\"_BabylonLoaderRegistered\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/index.ts\":\n/*!**************************!*\\\n !*** ./Loading/index.ts ***!\n \\**************************/\n/*! exports provided: DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, _BabylonLoaderRegistered */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _loadingScreen__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./loadingScreen */ \"./Loading/loadingScreen.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return _loadingScreen__WEBPACK_IMPORTED_MODULE_0__[\"DefaultLoadingScreen\"]; });\n\n/* harmony import */ var _Plugins_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Plugins/index */ \"./Loading/Plugins/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_1__[\"_BabylonLoaderRegistered\"]; });\n\n/* harmony import */ var _sceneLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return _sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoaderProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return _sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoader\"]; });\n\n/* harmony import */ var _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_3__[\"SceneLoaderFlags\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/loadingScreen.ts\":\n/*!**********************************!*\\\n !*** ./Loading/loadingScreen.ts ***!\n \\**********************************/\n/*! exports provided: DefaultLoadingScreen */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return DefaultLoadingScreen; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/**\r\n * Class used for the default loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\nvar DefaultLoadingScreen = /** @class */ (function () {\r\n /**\r\n * Creates a new default loading screen\r\n * @param _renderingCanvas defines the canvas used to render the scene\r\n * @param _loadingText defines the default text to display\r\n * @param _loadingDivBackgroundColor defines the default background color\r\n */\r\n function DefaultLoadingScreen(_renderingCanvas, _loadingText, _loadingDivBackgroundColor) {\r\n var _this = this;\r\n if (_loadingText === void 0) { _loadingText = \"\"; }\r\n if (_loadingDivBackgroundColor === void 0) { _loadingDivBackgroundColor = \"black\"; }\r\n this._renderingCanvas = _renderingCanvas;\r\n this._loadingText = _loadingText;\r\n this._loadingDivBackgroundColor = _loadingDivBackgroundColor;\r\n // Resize\r\n this._resizeLoadingUI = function () {\r\n var canvasRect = _this._renderingCanvas.getBoundingClientRect();\r\n var canvasPositioning = window.getComputedStyle(_this._renderingCanvas).position;\r\n if (!_this._loadingDiv) {\r\n return;\r\n }\r\n _this._loadingDiv.style.position = (canvasPositioning === \"fixed\") ? \"fixed\" : \"absolute\";\r\n _this._loadingDiv.style.left = canvasRect.left + \"px\";\r\n _this._loadingDiv.style.top = canvasRect.top + \"px\";\r\n _this._loadingDiv.style.width = canvasRect.width + \"px\";\r\n _this._loadingDiv.style.height = canvasRect.height + \"px\";\r\n };\r\n }\r\n /**\r\n * Function called to display the loading screen\r\n */\r\n DefaultLoadingScreen.prototype.displayLoadingUI = function () {\r\n if (this._loadingDiv) {\r\n // Do not add a loading screen if there is already one\r\n return;\r\n }\r\n this._loadingDiv = document.createElement(\"div\");\r\n this._loadingDiv.id = \"babylonjsLoadingDiv\";\r\n this._loadingDiv.style.opacity = \"0\";\r\n this._loadingDiv.style.transition = \"opacity 1.5s ease\";\r\n this._loadingDiv.style.pointerEvents = \"none\";\r\n // Loading text\r\n this._loadingTextDiv = document.createElement(\"div\");\r\n this._loadingTextDiv.style.position = \"absolute\";\r\n this._loadingTextDiv.style.left = \"0\";\r\n this._loadingTextDiv.style.top = \"50%\";\r\n this._loadingTextDiv.style.marginTop = \"80px\";\r\n this._loadingTextDiv.style.width = \"100%\";\r\n this._loadingTextDiv.style.height = \"20px\";\r\n this._loadingTextDiv.style.fontFamily = \"Arial\";\r\n this._loadingTextDiv.style.fontSize = \"14px\";\r\n this._loadingTextDiv.style.color = \"white\";\r\n this._loadingTextDiv.style.textAlign = \"center\";\r\n this._loadingTextDiv.innerHTML = \"Loading\";\r\n this._loadingDiv.appendChild(this._loadingTextDiv);\r\n //set the predefined text\r\n this._loadingTextDiv.innerHTML = this._loadingText;\r\n // Generating keyframes\r\n var style = document.createElement('style');\r\n style.type = 'text/css';\r\n var keyFrames = \"@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}\\n 100% { -webkit-transform: rotate(360deg);}\\n } @keyframes spin1 { 0% { transform: rotate(0deg);}\\n 100% { transform: rotate(360deg);}\\n }\";\r\n style.innerHTML = keyFrames;\r\n document.getElementsByTagName('head')[0].appendChild(style);\r\n // Loading img\r\n var imgBack = new Image();\r\n if (!DefaultLoadingScreen.DefaultLogoUrl) {\r\n imgBack.src = \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+\";\r\n }\r\n else {\r\n imgBack.src = DefaultLoadingScreen.DefaultLogoUrl;\r\n }\r\n imgBack.style.position = \"absolute\";\r\n imgBack.style.left = \"40%\";\r\n imgBack.style.top = \"40%\";\r\n imgBack.style.width = \"20%\";\r\n imgBack.style.height = \"20%\";\r\n // Loading spinner\r\n var imgSpinner = new Image();\r\n if (!DefaultLoadingScreen.DefaultSpinnerUrl) {\r\n imgSpinner.src = \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==\";\r\n }\r\n else {\r\n imgSpinner.src = DefaultLoadingScreen.DefaultSpinnerUrl;\r\n }\r\n imgSpinner.style.position = \"absolute\";\r\n imgSpinner.style.left = \"30%\";\r\n imgSpinner.style.top = \"30%\";\r\n imgSpinner.style.width = \"40%\";\r\n imgSpinner.style.height = \"40%\";\r\n imgSpinner.style.animation = \"spin1 0.75s infinite linear\";\r\n imgSpinner.style.webkitAnimation = \"spin1 0.75s infinite linear\";\r\n imgSpinner.style.transformOrigin = \"50% 50%\";\r\n imgSpinner.style.webkitTransformOrigin = \"50% 50%\";\r\n this._loadingDiv.appendChild(imgBack);\r\n this._loadingDiv.appendChild(imgSpinner);\r\n this._resizeLoadingUI();\r\n window.addEventListener(\"resize\", this._resizeLoadingUI);\r\n this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n document.body.appendChild(this._loadingDiv);\r\n this._loadingDiv.style.opacity = \"1\";\r\n };\r\n /**\r\n * Function called to hide the loading screen\r\n */\r\n DefaultLoadingScreen.prototype.hideLoadingUI = function () {\r\n var _this = this;\r\n if (!this._loadingDiv) {\r\n return;\r\n }\r\n var onTransitionEnd = function () {\r\n if (!_this._loadingDiv) {\r\n return;\r\n }\r\n if (_this._loadingDiv.parentElement) {\r\n _this._loadingDiv.parentElement.removeChild(_this._loadingDiv);\r\n }\r\n window.removeEventListener(\"resize\", _this._resizeLoadingUI);\r\n _this._loadingDiv = null;\r\n };\r\n this._loadingDiv.style.opacity = \"0\";\r\n this._loadingDiv.addEventListener(\"transitionend\", onTransitionEnd);\r\n };\r\n Object.defineProperty(DefaultLoadingScreen.prototype, \"loadingUIText\", {\r\n get: function () {\r\n return this._loadingText;\r\n },\r\n /**\r\n * Gets or sets the text to display while loading\r\n */\r\n set: function (text) {\r\n this._loadingText = text;\r\n if (this._loadingTextDiv) {\r\n this._loadingTextDiv.innerHTML = this._loadingText;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultLoadingScreen.prototype, \"loadingUIBackgroundColor\", {\r\n /**\r\n * Gets or sets the color to use for the background\r\n */\r\n get: function () {\r\n return this._loadingDivBackgroundColor;\r\n },\r\n set: function (color) {\r\n this._loadingDivBackgroundColor = color;\r\n if (!this._loadingDiv) {\r\n return;\r\n }\r\n this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Gets or sets the logo url to use for the default loading screen */\r\n DefaultLoadingScreen.DefaultLogoUrl = \"\";\r\n /** Gets or sets the spinner url to use for the default loading screen */\r\n DefaultLoadingScreen.DefaultSpinnerUrl = \"\";\r\n return DefaultLoadingScreen;\r\n}());\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].DefaultLoadingScreenFactory = function (canvas) { return new DefaultLoadingScreen(canvas); };\r\n\n\n/***/ }),\n\n/***/ \"./Loading/sceneLoader.ts\":\n/*!********************************!*\\\n !*** ./Loading/sceneLoader.ts ***!\n \\********************************/\n/*! exports provided: SceneLoaderProgressEvent, SceneLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return SceneLoaderProgressEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return SceneLoader; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_filesInputStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/filesInputStore */ \"./Misc/filesInputStore.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to represent data loading progression\r\n */\r\nvar SceneLoaderProgressEvent = /** @class */ (function () {\r\n /**\r\n * Create a new progress event\r\n * @param lengthComputable defines if data length to load can be evaluated\r\n * @param loaded defines the loaded data length\r\n * @param total defines the data length to load\r\n */\r\n function SceneLoaderProgressEvent(\r\n /** defines if data length to load can be evaluated */\r\n lengthComputable, \r\n /** defines the loaded data length */\r\n loaded, \r\n /** defines the data length to load */\r\n total) {\r\n this.lengthComputable = lengthComputable;\r\n this.loaded = loaded;\r\n this.total = total;\r\n }\r\n /**\r\n * Creates a new SceneLoaderProgressEvent from a ProgressEvent\r\n * @param event defines the source event\r\n * @returns a new SceneLoaderProgressEvent\r\n */\r\n SceneLoaderProgressEvent.FromProgressEvent = function (event) {\r\n return new SceneLoaderProgressEvent(event.lengthComputable, event.loaded, event.total);\r\n };\r\n return SceneLoaderProgressEvent;\r\n}());\r\n\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see http://doc.babylonjs.com/how_to/load_from_any_file_type\r\n */\r\nvar SceneLoader = /** @class */ (function () {\r\n function SceneLoader() {\r\n }\r\n Object.defineProperty(SceneLoader, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ShowLoadingScreen = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].loggingLevel;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].loggingLevel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SceneLoader._getDefaultPlugin = function () {\r\n return SceneLoader._registeredPlugins[\".babylon\"];\r\n };\r\n SceneLoader._getPluginForExtension = function (extension) {\r\n var registeredPlugin = SceneLoader._registeredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Warn(\"Unable to find a plugin to load \" + extension + \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type\");\r\n return SceneLoader._getDefaultPlugin();\r\n };\r\n SceneLoader._getPluginForDirectLoad = function (data) {\r\n for (var extension in SceneLoader._registeredPlugins) {\r\n var plugin = SceneLoader._registeredPlugins[extension].plugin;\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return SceneLoader._registeredPlugins[extension];\r\n }\r\n }\r\n return SceneLoader._getDefaultPlugin();\r\n };\r\n SceneLoader._getPluginForFilename = function (sceneFilename) {\r\n var queryStringPosition = sceneFilename.indexOf(\"?\");\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n var dotPosition = sceneFilename.lastIndexOf(\".\");\r\n var extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n return SceneLoader._getPluginForExtension(extension);\r\n };\r\n // use babylon file loader directly if sceneFilename is prefixed with \"data:\"\r\n SceneLoader._getDirectLoad = function (sceneFilename) {\r\n if (sceneFilename.substr(0, 5) === \"data:\") {\r\n return sceneFilename.substr(5);\r\n }\r\n return null;\r\n };\r\n SceneLoader._loadData = function (fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension) {\r\n var directLoad = SceneLoader._getDirectLoad(fileInfo.name);\r\n var registeredPlugin = pluginExtension ? SceneLoader._getPluginForExtension(pluginExtension) : (directLoad ? SceneLoader._getPluginForDirectLoad(fileInfo.name) : SceneLoader._getPluginForFilename(fileInfo.name));\r\n var plugin;\r\n if (registeredPlugin.plugin.createPlugin) {\r\n plugin = registeredPlugin.plugin.createPlugin();\r\n }\r\n else {\r\n plugin = registeredPlugin.plugin;\r\n }\r\n if (!plugin) {\r\n throw \"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.\";\r\n }\r\n var useArrayBuffer = registeredPlugin.isBinary;\r\n var offlineProvider;\r\n SceneLoader.OnPluginActivatedObservable.notifyObservers(plugin);\r\n var dataCallback = function (data, responseURL) {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n scene.offlineProvider = offlineProvider;\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n var request = null;\r\n var pluginDisposed = false;\r\n var onDisposeObservable = plugin.onDisposeObservable;\r\n if (onDisposeObservable) {\r\n onDisposeObservable.add(function () {\r\n pluginDisposed = true;\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n onDispose();\r\n });\r\n }\r\n var manifestChecked = function () {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n request = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFile(fileInfo.url, dataCallback, onProgress ? function (event) {\r\n onProgress(SceneLoaderProgressEvent.FromProgressEvent(event));\r\n } : undefined, offlineProvider, useArrayBuffer, function (request, exception) {\r\n onError(\"Failed to load scene.\" + (exception ? \" \" + exception.message : \"\"), exception);\r\n });\r\n };\r\n if (directLoad) {\r\n dataCallback(directLoad);\r\n return plugin;\r\n }\r\n var file = fileInfo.file || _Misc_filesInputStore__WEBPACK_IMPORTED_MODULE_2__[\"FilesInputStore\"].FilesToLoad[fileInfo.name.toLowerCase()];\r\n if (fileInfo.rootUrl.indexOf(\"file:\") === -1 || (fileInfo.rootUrl.indexOf(\"file:\") !== -1 && !file)) {\r\n var engine = scene.getEngine();\r\n var canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n var exceptionFound = false;\r\n for (var _i = 0, _a = scene.disableOfflineSupportExceptionRules; _i < _a.length; _i++) {\r\n var regex = _a[_i];\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n if (canUseOfflineSupport && _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n offlineProvider = _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n }\r\n else {\r\n manifestChecked();\r\n }\r\n }\r\n // Loading file from disk via input file or drag'n'drop\r\n else {\r\n if (file) {\r\n request = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].ReadFile(file, dataCallback, onProgress, useArrayBuffer);\r\n }\r\n else {\r\n onError(\"Unable to find file named \" + fileInfo.name);\r\n }\r\n }\r\n return plugin;\r\n };\r\n SceneLoader._getFileInfo = function (rootUrl, sceneFilename) {\r\n var url;\r\n var name;\r\n var file = null;\r\n if (!sceneFilename) {\r\n url = rootUrl;\r\n name = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetFilename(rootUrl);\r\n rootUrl = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetFolderPath(rootUrl);\r\n }\r\n else if (sceneFilename.name) {\r\n var sceneFile = sceneFilename;\r\n url = rootUrl + sceneFile.name;\r\n name = sceneFile.name;\r\n file = sceneFile;\r\n }\r\n else {\r\n var filename = sceneFilename;\r\n if (filename.substr(0, 1) === \"/\") {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n url = rootUrl + filename;\r\n name = filename;\r\n }\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file\r\n };\r\n };\r\n // Public functions\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n SceneLoader.GetPluginForExtension = function (extension) {\r\n return SceneLoader._getPluginForExtension(extension).plugin;\r\n };\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n SceneLoader.IsPluginForExtensionAvailable = function (extension) {\r\n return !!SceneLoader._registeredPlugins[extension];\r\n };\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n SceneLoader.RegisterPlugin = function (plugin) {\r\n if (typeof plugin.extensions === \"string\") {\r\n var extension = plugin.extensions;\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false\r\n };\r\n }\r\n else {\r\n var extensions = plugin.extensions;\r\n Object.keys(extensions).forEach(function (extension) {\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary\r\n };\r\n });\r\n }\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._getFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to import meshes from \" + fileInfo.url + \": \" + message;\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n } : undefined;\r\n var successHandler = function (meshes, particleSystems, skeletons, animationGroups) {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._loadData(fileInfo, scene, function (plugin, data, responseURL) {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n if (plugin.importMesh) {\r\n var syncedPlugin = plugin;\r\n var meshes = new Array();\r\n var particleSystems = new Array();\r\n var skeletons = new Array();\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, []);\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (result) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(result.meshes, result.particleSystems, result.skeletons, result.animationGroups);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.ImportMesh(meshNames, rootUrl, sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups) {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups\r\n });\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Load = function (rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedEngine; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!engine) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].Error(\"No engine available\");\r\n return null;\r\n }\r\n return SceneLoader.Append(rootUrl, sceneFilename, new _scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"](engine), onSuccess, onProgress, onError, pluginExtension);\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded scene\r\n */\r\n SceneLoader.LoadAsync = function (rootUrl, sceneFilename, engine, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedEngine; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Load(rootUrl, sceneFilename, engine, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._getFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n if (SceneLoader.ShowLoadingScreen) {\r\n scene.getEngine().displayLoadingUI();\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n scene.getEngine().hideLoadingUI();\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function () {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._loadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.load) {\r\n var syncedPlugin = plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function () {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n if (SceneLoader.ShowLoadingScreen) {\r\n scene.executeWhenReady(function () {\r\n scene.getEngine().hideLoadingUI();\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The given scene\r\n */\r\n SceneLoader.AppendAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Append(rootUrl, sceneFilename, scene, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._getFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load assets from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function (assets) {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._loadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.loadAssetContainer) {\r\n var syncedPlugin = plugin;\r\n var assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }\r\n else if (plugin.loadAssetContainerAsync) {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (assetContainer) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n if (SceneLoader.ShowLoadingScreen) {\r\n scene.executeWhenReady(function () {\r\n scene.getEngine().hideLoadingUI();\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded asset container\r\n */\r\n SceneLoader.LoadAssetContainerAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.LoadAssetContainer(rootUrl, sceneFilename, scene, function (assetContainer) {\r\n resolve(assetContainer);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * No logging while loading\r\n */\r\n SceneLoader.NO_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_NO_LOGGING;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n SceneLoader.MINIMAL_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_MINIMAL_LOGGING;\r\n /**\r\n * Summary logging while loading\r\n */\r\n SceneLoader.SUMMARY_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_SUMMARY_LOGGING;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n SceneLoader.DETAILED_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_DETAILED_LOGGING;\r\n // Members\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n SceneLoader.OnPluginActivatedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n SceneLoader._registeredPlugins = {};\r\n return SceneLoader;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/sceneLoaderFlags.ts\":\n/*!*************************************!*\\\n !*** ./Loading/sceneLoaderFlags.ts ***!\n \\*************************************/\n/*! exports provided: SceneLoaderFlags */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return SceneLoaderFlags; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n/**\r\n * Class used to represent data loading progression\r\n */\r\nvar SceneLoaderFlags = /** @class */ (function () {\r\n function SceneLoaderFlags() {\r\n }\r\n Object.defineProperty(SceneLoaderFlags, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ShowLoadingScreen = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._loggingLevel;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._loggingLevel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Flags\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = false;\r\n SceneLoaderFlags._ShowLoadingScreen = true;\r\n SceneLoaderFlags._CleanBoneMatrixWeights = false;\r\n SceneLoaderFlags._loggingLevel = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].SCENELOADER_NO_LOGGING;\r\n return SceneLoaderFlags;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Background/backgroundMaterial.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Background/backgroundMaterial.ts ***!\n \\****************************************************/\n/*! exports provided: BackgroundMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return BackgroundMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Materials/pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Shaders_background_fragment__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Shaders/background.fragment */ \"./Shaders/background.fragment.ts\");\n/* harmony import */ var _Shaders_background_vertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Shaders/background.vertex */ \"./Shaders/background.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Background material defines definition.\r\n * @hidden Mainly internal Use\r\n */\r\nvar BackgroundMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BackgroundMaterialDefines, _super);\r\n /**\r\n * Constructor of the defines.\r\n */\r\n function BackgroundMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * True if the diffuse texture is in use.\r\n */\r\n _this.DIFFUSE = false;\r\n /**\r\n * The direct UV channel to use.\r\n */\r\n _this.DIFFUSEDIRECTUV = 0;\r\n /**\r\n * True if the diffuse texture is in gamma space.\r\n */\r\n _this.GAMMADIFFUSE = false;\r\n /**\r\n * True if the diffuse texture has opacity in the alpha channel.\r\n */\r\n _this.DIFFUSEHASALPHA = false;\r\n /**\r\n * True if you want the material to fade to transparent at grazing angle.\r\n */\r\n _this.OPACITYFRESNEL = false;\r\n /**\r\n * True if an extra blur needs to be added in the reflection.\r\n */\r\n _this.REFLECTIONBLUR = false;\r\n /**\r\n * True if you want the material to fade to reflection at grazing angle.\r\n */\r\n _this.REFLECTIONFRESNEL = false;\r\n /**\r\n * True if you want the material to falloff as far as you move away from the scene center.\r\n */\r\n _this.REFLECTIONFALLOFF = false;\r\n /**\r\n * False if the current Webgl implementation does not support the texture lod extension.\r\n */\r\n _this.TEXTURELODSUPPORT = false;\r\n /**\r\n * True to ensure the data are premultiplied.\r\n */\r\n _this.PREMULTIPLYALPHA = false;\r\n /**\r\n * True if the texture contains cooked RGB values and not gray scaled multipliers.\r\n */\r\n _this.USERGBCOLOR = false;\r\n /**\r\n * True if highlight and shadow levels have been specified. It can help ensuring the main perceived color\r\n * stays aligned with the desired configuration.\r\n */\r\n _this.USEHIGHLIGHTANDSHADOWCOLORS = false;\r\n /**\r\n * True to add noise in order to reduce the banding effect.\r\n */\r\n _this.NOISE = false;\r\n /**\r\n * is the reflection texture in BGR color scheme?\r\n * Mainly used to solve a bug in ios10 video tag\r\n */\r\n _this.REFLECTIONBGR = false;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.MULTIVIEW = false;\r\n // Reflection.\r\n _this.REFLECTION = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.REFLECTIONMAP_OPPOSITEZ = false;\r\n _this.LODINREFLECTIONALPHA = false;\r\n _this.GAMMAREFLECTION = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.EQUIRECTANGULAR_RELFECTION_FOV = false;\r\n // Default BJS.\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.NORMAL = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.INSTANCES = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n return BackgroundMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_8__[\"MaterialDefines\"]));\r\n/**\r\n * Background material used to create an efficient environement around your scene.\r\n */\r\nvar BackgroundMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BackgroundMaterial, _super);\r\n /**\r\n * Instantiates a Background Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n function BackgroundMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Key light Color (multiply against the environement texture)\r\n */\r\n _this.primaryColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].White();\r\n _this._primaryColorShadowLevel = 0;\r\n _this._primaryColorHighlightLevel = 0;\r\n /**\r\n * Reflection Texture used in the material.\r\n * Should be author in a specific way for the best result (refer to the documentation).\r\n */\r\n _this.reflectionTexture = null;\r\n /**\r\n * Reflection Texture level of blur.\r\n *\r\n * Can be use to reuse an existing HDR Texture and target a specific LOD to prevent authoring the\r\n * texture twice.\r\n */\r\n _this.reflectionBlur = 0;\r\n /**\r\n * Diffuse Texture used in the material.\r\n * Should be author in a specific way for the best result (refer to the documentation).\r\n */\r\n _this.diffuseTexture = null;\r\n _this._shadowLights = null;\r\n /**\r\n * Specify the list of lights casting shadow on the material.\r\n * All scene shadow lights will be included if null.\r\n */\r\n _this.shadowLights = null;\r\n /**\r\n * Helps adjusting the shadow to a softer level if required.\r\n * 0 means black shadows and 1 means no shadows.\r\n */\r\n _this.shadowLevel = 0;\r\n /**\r\n * In case of opacity Fresnel or reflection falloff, this is use as a scene center.\r\n * It is usually zero but might be interesting to modify according to your setup.\r\n */\r\n _this.sceneCenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n /**\r\n * This helps specifying that the material is falling off to the sky box at grazing angle.\r\n * This helps ensuring a nice transition when the camera goes under the ground.\r\n */\r\n _this.opacityFresnel = true;\r\n /**\r\n * This helps specifying that the material is falling off from diffuse to the reflection texture at grazing angle.\r\n * This helps adding a mirror texture on the ground.\r\n */\r\n _this.reflectionFresnel = false;\r\n /**\r\n * This helps specifying the falloff radius off the reflection texture from the sceneCenter.\r\n * This helps adding a nice falloff effect to the reflection if used as a mirror for instance.\r\n */\r\n _this.reflectionFalloffDistance = 0.0;\r\n /**\r\n * This specifies the weight of the reflection against the background in case of reflection Fresnel.\r\n */\r\n _this.reflectionAmount = 1.0;\r\n /**\r\n * This specifies the weight of the reflection at grazing angle.\r\n */\r\n _this.reflectionReflectance0 = 0.05;\r\n /**\r\n * This specifies the weight of the reflection at a perpendicular point of view.\r\n */\r\n _this.reflectionReflectance90 = 0.5;\r\n /**\r\n * Helps to directly use the maps channels instead of their level.\r\n */\r\n _this.useRGBColor = true;\r\n /**\r\n * This helps reducing the banding effect that could occur on the background.\r\n */\r\n _this.enableNoise = false;\r\n _this._fovMultiplier = 1.0;\r\n /**\r\n * Enable the FOV adjustment feature controlled by fovMultiplier.\r\n */\r\n _this.useEquirectangularFOV = false;\r\n _this._maxSimultaneousLights = 4;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * Keep track of the image processing observer to allow dispose and replace.\r\n */\r\n _this._imageProcessingObserver = null;\r\n /**\r\n * Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB.\r\n * Setting this flag to true (not done automatically!) will convert it back to RGB.\r\n */\r\n _this.switchToBGR = false;\r\n // Temp values kept as cache in the material.\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__[\"SmartArray\"](16);\r\n _this._reflectionControls = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector4\"].Zero();\r\n _this._white = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].White();\r\n _this._primaryShadowColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].Black();\r\n _this._primaryHighlightColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].Black();\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (_this._diffuseTexture && _this._diffuseTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._diffuseTexture);\r\n }\r\n if (_this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n return _this._renderTargets;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(BackgroundMaterial.prototype, \"_perceptualColor\", {\r\n /**\r\n * Experimental Internal Use Only.\r\n *\r\n * Key light Color in \"perceptual value\" meaning the color you would like to see on screen.\r\n * This acts as a helper to set the primary color to a more \"human friendly\" value.\r\n * Conversion to linear space as well as exposure and tone mapping correction will be applied to keep the\r\n * output color as close as possible from the chosen value.\r\n * (This does not account for contrast color grading and color curves as they are considered post effect and not directly\r\n * part of lighting setup.)\r\n */\r\n get: function () {\r\n return this.__perceptualColor;\r\n },\r\n set: function (value) {\r\n this.__perceptualColor = value;\r\n this._computePrimaryColorFromPerceptualColor();\r\n this._markAllSubMeshesAsLightsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"primaryColorShadowLevel\", {\r\n /**\r\n * Defines the level of the shadows (dark area of the reflection map) in order to help scaling the colors.\r\n * The color opposite to the primary color is used at the level chosen to define what the black area would look.\r\n */\r\n get: function () {\r\n return this._primaryColorShadowLevel;\r\n },\r\n set: function (value) {\r\n this._primaryColorShadowLevel = value;\r\n this._computePrimaryColors();\r\n this._markAllSubMeshesAsLightsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"primaryColorHighlightLevel\", {\r\n /**\r\n * Defines the level of the highliights (highlight area of the reflection map) in order to help scaling the colors.\r\n * The primary color is used at the level chosen to define what the white area would look.\r\n */\r\n get: function () {\r\n return this._primaryColorHighlightLevel;\r\n },\r\n set: function (value) {\r\n this._primaryColorHighlightLevel = value;\r\n this._computePrimaryColors();\r\n this._markAllSubMeshesAsLightsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"reflectionStandardFresnelWeight\", {\r\n /**\r\n * Sets the reflection reflectance fresnel values according to the default standard\r\n * empirically know to work well :-)\r\n */\r\n set: function (value) {\r\n var reflectionWeight = value;\r\n if (reflectionWeight < 0.5) {\r\n reflectionWeight = reflectionWeight * 2.0;\r\n this.reflectionReflectance0 = BackgroundMaterial.StandardReflectance0 * reflectionWeight;\r\n this.reflectionReflectance90 = BackgroundMaterial.StandardReflectance90 * reflectionWeight;\r\n }\r\n else {\r\n reflectionWeight = reflectionWeight * 2.0 - 1.0;\r\n this.reflectionReflectance0 = BackgroundMaterial.StandardReflectance0 + (1.0 - BackgroundMaterial.StandardReflectance0) * reflectionWeight;\r\n this.reflectionReflectance90 = BackgroundMaterial.StandardReflectance90 + (1.0 - BackgroundMaterial.StandardReflectance90) * reflectionWeight;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"fovMultiplier\", {\r\n /**\r\n * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values \"zoom in\" and higher values \"zoom out\".\r\n * Best used when trying to implement visual zoom effects like fish-eye or binoculars while not adjusting camera fov.\r\n * Recommended to be keep at 1.0 except for special cases.\r\n */\r\n get: function () {\r\n return this._fovMultiplier;\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n value = 1.0;\r\n }\r\n this._fovMultiplier = Math.max(0.0, Math.min(2.0, value));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration (if null the scene configuration will be use)\r\n */\r\n BackgroundMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._computePrimaryColorFromPerceptualColor();\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(BackgroundMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (this._diffuseTexture && this._diffuseTexture.isRenderTarget) {\r\n return true;\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * The entire material has been created in order to prevent overdraw.\r\n * @returns false\r\n */\r\n BackgroundMaterial.prototype.needAlphaTesting = function () {\r\n return true;\r\n };\r\n /**\r\n * The entire material has been created in order to prevent overdraw.\r\n * @returns true if blending is enable\r\n */\r\n BackgroundMaterial.prototype.needAlphaBlending = function () {\r\n return ((this.alpha < 0) || (this._diffuseTexture != null && this._diffuseTexture.hasAlpha));\r\n };\r\n /**\r\n * Checks wether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @param useInstances Specify wether or not the material is used with instances\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n BackgroundMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n var _this = this;\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new BackgroundMaterialDefines();\r\n }\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var engine = scene.getEngine();\r\n // Lights\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights);\r\n defines._needNormals = true;\r\n // Multiview\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForMultiview(scene, defines);\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (scene.getEngine().getCaps().textureLOD) {\r\n defines.TEXTURELODSUPPORT = true;\r\n }\r\n if (this._diffuseTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._diffuseTexture, defines, \"DIFFUSE\");\r\n defines.DIFFUSEHASALPHA = this._diffuseTexture.hasAlpha;\r\n defines.GAMMADIFFUSE = this._diffuseTexture.gammaSpace;\r\n defines.OPACITYFRESNEL = this._opacityFresnel;\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n defines.DIFFUSEHASALPHA = false;\r\n defines.GAMMADIFFUSE = false;\r\n defines.OPACITYFRESNEL = false;\r\n }\r\n var reflectionTexture = this._reflectionTexture;\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (!reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n defines.REFLECTION = true;\r\n defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;\r\n defines.RGBDREFLECTION = reflectionTexture.isRGBD;\r\n defines.REFLECTIONBLUR = this._reflectionBlur > 0;\r\n defines.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;\r\n defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;\r\n defines.EQUIRECTANGULAR_RELFECTION_FOV = this.useEquirectangularFOV;\r\n defines.REFLECTIONBGR = this.switchToBGR;\r\n if (reflectionTexture.coordinatesMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].INVCUBIC_MODE) {\r\n defines.INVERTCUBICMAP = true;\r\n }\r\n defines.REFLECTIONMAP_3D = reflectionTexture.isCube;\r\n switch (reflectionTexture.coordinatesMode) {\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].EXPLICIT_MODE:\r\n defines.REFLECTIONMAP_EXPLICIT = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].PLANAR_MODE:\r\n defines.REFLECTIONMAP_PLANAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].PROJECTION_MODE:\r\n defines.REFLECTIONMAP_PROJECTION = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].SKYBOX_MODE:\r\n defines.REFLECTIONMAP_SKYBOX = true;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = !reflectionTexture.getReflectionTextureMatrix().isIdentity();\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].SPHERICAL_MODE:\r\n defines.REFLECTIONMAP_SPHERICAL = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].FIXED_EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].CUBIC_MODE:\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].INVCUBIC_MODE:\r\n default:\r\n defines.REFLECTIONMAP_CUBIC = true;\r\n break;\r\n }\r\n if (this.reflectionFresnel) {\r\n defines.REFLECTIONFRESNEL = true;\r\n defines.REFLECTIONFALLOFF = this.reflectionFalloffDistance > 0;\r\n this._reflectionControls.x = this.reflectionAmount;\r\n this._reflectionControls.y = this.reflectionReflectance0;\r\n this._reflectionControls.z = this.reflectionReflectance90;\r\n this._reflectionControls.w = 1 / this.reflectionFalloffDistance;\r\n }\r\n else {\r\n defines.REFLECTIONFRESNEL = false;\r\n defines.REFLECTIONFALLOFF = false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n defines.REFLECTIONFRESNEL = false;\r\n defines.REFLECTIONFALLOFF = false;\r\n defines.REFLECTIONBLUR = false;\r\n defines.REFLECTIONMAP_3D = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.INVERTCUBICMAP = false;\r\n defines.REFLECTIONMAP_OPPOSITEZ = false;\r\n defines.LODINREFLECTIONALPHA = false;\r\n defines.GAMMAREFLECTION = false;\r\n defines.RGBDREFLECTION = false;\r\n }\r\n }\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].ALPHA_PREMULTIPLIED || this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF);\r\n defines.USERGBCOLOR = this._useRGBColor;\r\n defines.NOISE = this._enableNoise;\r\n }\r\n if (defines._areLightsDirty) {\r\n defines.USEHIGHLIGHTANDSHADOWCOLORS = !this._useRGBColor && (this._primaryColorShadowLevel !== 0 || this._primaryColorHighlightLevel !== 0);\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n // Misc.\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n // Values that need to be evaluated on every frame\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);\r\n // Attribs\r\n if (_Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForAttributes(mesh, defines, false, true, false)) {\r\n if (mesh) {\r\n if (!scene.getEngine().getCaps().standardDerivatives && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind)) {\r\n mesh.createNormals(true);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(\"BackgroundMaterial: Normals have been created for the mesh: \" + mesh.name);\r\n }\r\n }\r\n }\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n // Fallbacks\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_6__[\"EffectFallbacks\"]();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(0, \"FOG\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(1, \"POINTSIZE\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);\r\n //Attributes\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareAttributesForInstances(attribs, defines);\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"mBones\",\r\n \"vPrimaryColor\", \"vPrimaryColorShadow\",\r\n \"vReflectionInfos\", \"reflectionMatrix\", \"vReflectionMicrosurfaceInfos\", \"fFovMultiplier\",\r\n \"shadowLevel\", \"alpha\",\r\n \"vBackgroundCenter\", \"vReflectionControl\",\r\n \"vDiffuseInfos\", \"diffuseMatrix\",\r\n ];\r\n var samplers = [\"diffuseSampler\", \"reflectionSampler\", \"reflectionSamplerLow\", \"reflectionSamplerHigh\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, defines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, defines);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n var onCompiled = function (effect) {\r\n if (_this.onCompiled) {\r\n _this.onCompiled(effect);\r\n }\r\n _this.bindSceneUniformBuffer(effect, scene.getSceneUniformBuffer());\r\n };\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(\"background\", {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }\r\n }, engine), defines);\r\n this.buildUniformLayout();\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Compute the primary color according to the chosen perceptual color.\r\n */\r\n BackgroundMaterial.prototype._computePrimaryColorFromPerceptualColor = function () {\r\n if (!this.__perceptualColor) {\r\n return;\r\n }\r\n this._primaryColor.copyFrom(this.__perceptualColor);\r\n // Revert gamma space.\r\n this._primaryColor.toLinearSpaceToRef(this._primaryColor);\r\n // Revert image processing configuration.\r\n if (this._imageProcessingConfiguration) {\r\n // Revert Exposure.\r\n this._primaryColor.scaleToRef(1 / this._imageProcessingConfiguration.exposure, this._primaryColor);\r\n }\r\n this._computePrimaryColors();\r\n };\r\n /**\r\n * Compute the highlights and shadow colors according to their chosen levels.\r\n */\r\n BackgroundMaterial.prototype._computePrimaryColors = function () {\r\n if (this._primaryColorShadowLevel === 0 && this._primaryColorHighlightLevel === 0) {\r\n return;\r\n }\r\n // Find the highlight color based on the configuration.\r\n this._primaryColor.scaleToRef(this._primaryColorShadowLevel, this._primaryShadowColor);\r\n this._primaryColor.subtractToRef(this._primaryShadowColor, this._primaryShadowColor);\r\n // Find the shadow color based on the configuration.\r\n this._white.subtractToRef(this._primaryColor, this._primaryHighlightColor);\r\n this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel, this._primaryHighlightColor);\r\n this._primaryColor.addToRef(this._primaryHighlightColor, this._primaryHighlightColor);\r\n };\r\n /**\r\n * Build the uniform buffer used in the material.\r\n */\r\n BackgroundMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n this._uniformBuffer.addUniform(\"vPrimaryColor\", 4);\r\n this._uniformBuffer.addUniform(\"vPrimaryColorShadow\", 4);\r\n this._uniformBuffer.addUniform(\"vDiffuseInfos\", 2);\r\n this._uniformBuffer.addUniform(\"vReflectionInfos\", 2);\r\n this._uniformBuffer.addUniform(\"diffuseMatrix\", 16);\r\n this._uniformBuffer.addUniform(\"reflectionMatrix\", 16);\r\n this._uniformBuffer.addUniform(\"vReflectionMicrosurfaceInfos\", 3);\r\n this._uniformBuffer.addUniform(\"fFovMultiplier\", 1);\r\n this._uniformBuffer.addUniform(\"pointSize\", 1);\r\n this._uniformBuffer.addUniform(\"shadowLevel\", 1);\r\n this._uniformBuffer.addUniform(\"alpha\", 1);\r\n this._uniformBuffer.addUniform(\"vBackgroundCenter\", 3);\r\n this._uniformBuffer.addUniform(\"vReflectionControl\", 4);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Unbind the material.\r\n */\r\n BackgroundMaterial.prototype.unbind = function () {\r\n if (this._diffuseTexture && this._diffuseTexture.isRenderTarget) {\r\n this._uniformBuffer.setTexture(\"diffuseSampler\", null);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", null);\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Bind only the world matrix to the material.\r\n * @param world The world matrix to bind.\r\n */\r\n BackgroundMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n this._activeEffect.setMatrix(\"world\", world);\r\n };\r\n /**\r\n * Bind the material for a dedicated submeh (every used meshes will be considered opaque).\r\n * @param world The world matrix to bind.\r\n * @param subMesh The submesh to bind for.\r\n */\r\n BackgroundMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n // Bones\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindBonesParameters(mesh, this._activeEffect);\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n if (mustRebind) {\r\n this._uniformBuffer.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n var reflectionTexture = this._reflectionTexture;\r\n if (!this._uniformBuffer.useUbo || !this.isFrozen || !this._uniformBuffer.isSync) {\r\n // Texture uniforms\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n this._uniformBuffer.updateFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindTextureMatrix(this._diffuseTexture, this._uniformBuffer, \"diffuse\");\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n this._uniformBuffer.updateMatrix(\"reflectionMatrix\", reflectionTexture.getReflectionTextureMatrix());\r\n this._uniformBuffer.updateFloat2(\"vReflectionInfos\", reflectionTexture.level, this._reflectionBlur);\r\n this._uniformBuffer.updateFloat3(\"vReflectionMicrosurfaceInfos\", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);\r\n }\r\n }\r\n if (this.shadowLevel > 0) {\r\n this._uniformBuffer.updateFloat(\"shadowLevel\", this.shadowLevel);\r\n }\r\n this._uniformBuffer.updateFloat(\"alpha\", this.alpha);\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._uniformBuffer.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n if (defines.USEHIGHLIGHTANDSHADOWCOLORS) {\r\n this._uniformBuffer.updateColor4(\"vPrimaryColor\", this._primaryHighlightColor, 1.0);\r\n this._uniformBuffer.updateColor4(\"vPrimaryColorShadow\", this._primaryShadowColor, 1.0);\r\n }\r\n else {\r\n this._uniformBuffer.updateColor4(\"vPrimaryColor\", this._primaryColor, 1.0);\r\n }\r\n }\r\n this._uniformBuffer.updateFloat(\"fFovMultiplier\", this._fovMultiplier);\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n this._uniformBuffer.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (defines.REFLECTIONBLUR && defines.TEXTURELODSUPPORT) {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else if (!defines.REFLECTIONBLUR) {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", reflectionTexture._lodTextureMid || reflectionTexture);\r\n this._uniformBuffer.setTexture(\"reflectionSamplerLow\", reflectionTexture._lodTextureLow || reflectionTexture);\r\n this._uniformBuffer.setTexture(\"reflectionSamplerHigh\", reflectionTexture._lodTextureHigh || reflectionTexture);\r\n }\r\n if (defines.REFLECTIONFRESNEL) {\r\n this._uniformBuffer.updateFloat3(\"vBackgroundCenter\", this.sceneCenter.x, this.sceneCenter.y, this.sceneCenter.z);\r\n this._uniformBuffer.updateFloat4(\"vReflectionControl\", this._reflectionControls.x, this._reflectionControls.y, this._reflectionControls.z, this._reflectionControls.w);\r\n }\r\n }\r\n }\r\n // Clip plane\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindClipPlane(this._activeEffect, scene);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindEyePosition(effect, scene);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n if (scene.lightsEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights, false);\r\n }\r\n // View\r\n this.bindView(effect);\r\n // Fog\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindFogParameters(scene, mesh, this._activeEffect, true);\r\n // image processing\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n }\r\n }\r\n this._uniformBuffer.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n BackgroundMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Dispose the material.\r\n * @param forceDisposeEffect Force disposal of the associated effect.\r\n * @param forceDisposeTextures Force disposal of the associated textures.\r\n */\r\n BackgroundMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n if (forceDisposeEffect === void 0) { forceDisposeEffect = false; }\r\n if (forceDisposeTextures === void 0) { forceDisposeTextures = false; }\r\n if (forceDisposeTextures) {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n if (this.reflectionTexture) {\r\n this.reflectionTexture.dispose();\r\n }\r\n }\r\n this._renderTargets.dispose();\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect);\r\n };\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n BackgroundMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new BackgroundMaterial(name, _this.getScene()); }, this);\r\n };\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n BackgroundMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.BackgroundMaterial\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"BackgroundMaterial\"\r\n */\r\n BackgroundMaterial.prototype.getClassName = function () {\r\n return \"BackgroundMaterial\";\r\n };\r\n /**\r\n * Parse a JSON input to create back a background material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated BackgroundMaterial.\r\n */\r\n BackgroundMaterial.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new BackgroundMaterial(source.name, scene); }, source, scene, rootUrl);\r\n };\r\n /**\r\n * Standard reflectance value at parallel view angle.\r\n */\r\n BackgroundMaterial.StandardReflectance0 = 0.05;\r\n /**\r\n * Standard reflectance value at grazing angle.\r\n */\r\n BackgroundMaterial.StandardReflectance90 = 0.5;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], BackgroundMaterial.prototype, \"_primaryColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], BackgroundMaterial.prototype, \"primaryColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], BackgroundMaterial.prototype, \"__perceptualColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_primaryColorShadowLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_primaryColorHighlightLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], BackgroundMaterial.prototype, \"primaryColorHighlightLevel\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])()\r\n ], BackgroundMaterial.prototype, \"_diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"shadowLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_shadowLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"shadowLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], BackgroundMaterial.prototype, \"_sceneCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"sceneCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_opacityFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"opacityFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionFalloffDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionFalloffDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionAmount\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionAmount\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionReflectance0\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionReflectance0\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionReflectance90\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionReflectance90\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_useRGBColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"useRGBColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_enableNoise\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"enableNoise\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsImageProcessingConfiguration\"])()\r\n ], BackgroundMaterial.prototype, \"_imageProcessingConfiguration\", void 0);\r\n return BackgroundMaterial;\r\n}(_Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_9__[\"PushMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.BackgroundMaterial\"] = BackgroundMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Background/index.ts\":\n/*!***************************************!*\\\n !*** ./Materials/Background/index.ts ***!\n \\***************************************/\n/*! exports provided: BackgroundMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _backgroundMaterial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _backgroundMaterial__WEBPACK_IMPORTED_MODULE_0__[\"BackgroundMaterial\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/fogBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/fogBlock.ts ***!\n \\************************************************/\n/*! exports provided: FogBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return FogBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add support for scene fog\r\n */\r\nvar FogBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FogBlock, _super);\r\n /**\r\n * Create a new FogBlock\r\n * @param name defines the block name\r\n */\r\n function FogBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].VertexAndFragment, true) || this;\r\n // Vertex\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"view\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Vertex);\r\n // Fragment\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerInput(\"fogColor\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.input.acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this.fogColor.acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n FogBlock.prototype.getClassName = function () {\r\n return \"FogBlock\";\r\n };\r\n Object.defineProperty(FogBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"view\", {\r\n /**\r\n * Gets the view input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"input\", {\r\n /**\r\n * Gets the color input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"fogColor\", {\r\n /**\r\n * Gets the fog color input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n FogBlock.prototype.autoConfigure = function (material) {\r\n if (!this.view.isConnected) {\r\n var viewInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].View; });\r\n if (!viewInput) {\r\n viewInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"view\");\r\n viewInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].View);\r\n }\r\n viewInput.output.connectTo(this.view);\r\n }\r\n if (!this.fogColor.isConnected) {\r\n var fogColorInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].FogColor; });\r\n if (!fogColorInput) {\r\n fogColorInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"fogColor\", undefined, _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n fogColorInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].FogColor);\r\n }\r\n fogColorInput.output.connectTo(this.fogColor);\r\n }\r\n };\r\n FogBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n var scene = mesh.getScene();\r\n defines.setValue(\"FOG\", nodeMaterial.fogEnabled && _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].GetFogState(mesh, scene));\r\n };\r\n FogBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n effect.setFloat4(this._fogParameters, scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n };\r\n FogBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n state._emitFunctionFromInclude(\"fogFragmentDeclaration\", \"//\" + this.name, {\r\n removeUniforms: true,\r\n removeVaryings: true,\r\n removeIfDef: false,\r\n replaceStrings: [{ search: /float CalcFogFactor\\(\\)/, replace: \"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)\" }]\r\n });\r\n var tempFogVariablename = state._getFreeVariableName(\"fog\");\r\n var color = this.input;\r\n var fogColor = this.fogColor;\r\n this._fogParameters = state._getFreeVariableName(\"fogParameters\");\r\n var output = this._outputs[0];\r\n state._emitUniformFromString(this._fogParameters, \"vec4\");\r\n state.compilationString += \"#ifdef FOG\\r\\n\";\r\n state.compilationString += \"float \" + tempFogVariablename + \" = CalcFogFactor(\" + this._fogDistanceName + \", \" + this._fogParameters + \");\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + tempFogVariablename + \" * \" + color.associatedVariableName + \".rgb + (1.0 - \" + tempFogVariablename + \") * \" + fogColor.associatedVariableName + \".rgb;\\r\\n\");\r\n state.compilationString += \"#else\\r\\n\" + this._declareOutput(output, state) + \" = \" + color.associatedVariableName + \".rgb;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n }\r\n else {\r\n var worldPos = this.worldPosition;\r\n var view = this.view;\r\n this._fogDistanceName = state._getFreeVariableName(\"vFogDistance\");\r\n state._emitVaryingFromString(this._fogDistanceName, \"vec3\");\r\n state.compilationString += this._fogDistanceName + \" = (\" + view.associatedVariableName + \" * \" + worldPos.associatedVariableName + \").xyz;\\r\\n\";\r\n }\r\n return this;\r\n };\r\n return FogBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.FogBlock\"] = FogBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/index.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/index.ts ***!\n \\*********************************************/\n/*! exports provided: FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _fogBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fogBlock */ \"./Materials/Node/Blocks/Dual/fogBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _fogBlock__WEBPACK_IMPORTED_MODULE_0__[\"FogBlock\"]; });\n\n/* harmony import */ var _lightBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lightBlock */ \"./Materials/Node/Blocks/Dual/lightBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _lightBlock__WEBPACK_IMPORTED_MODULE_1__[\"LightBlock\"]; });\n\n/* harmony import */ var _textureBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./textureBlock */ \"./Materials/Node/Blocks/Dual/textureBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _textureBlock__WEBPACK_IMPORTED_MODULE_2__[\"TextureBlock\"]; });\n\n/* harmony import */ var _reflectionTextureBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./reflectionTextureBlock */ \"./Materials/Node/Blocks/Dual/reflectionTextureBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _reflectionTextureBlock__WEBPACK_IMPORTED_MODULE_3__[\"ReflectionTextureBlock\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/lightBlock.ts\":\n/*!**************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/lightBlock.ts ***!\n \\**************************************************/\n/*! exports provided: LightBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return LightBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add light in the fragment shader\r\n */\r\nvar LightBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LightBlock, _super);\r\n /**\r\n * Create a new LightBlock\r\n * @param name defines the block name\r\n */\r\n function LightBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].VertexAndFragment) || this;\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerInput(\"cameraPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"diffuseOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"specularOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n LightBlock.prototype.getClassName = function () {\r\n return \"LightBlock\";\r\n };\r\n Object.defineProperty(LightBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"cameraPosition\", {\r\n /**\r\n * Gets the camera (or eye) position component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"diffuseOutput\", {\r\n /**\r\n * Gets the diffuse output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"specularOutput\", {\r\n /**\r\n * Gets the specular output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n LightBlock.prototype.autoConfigure = function (material) {\r\n if (!this.cameraPosition.isConnected) {\r\n var cameraPositionInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition; });\r\n if (!cameraPositionInput) {\r\n cameraPositionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"cameraPosition\");\r\n cameraPositionInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition);\r\n }\r\n cameraPositionInput.output.connectTo(this.cameraPosition);\r\n }\r\n };\r\n LightBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areLightsDirty) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n if (!this.light) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, true, nodeMaterial.maxSimultaneousLights);\r\n }\r\n else {\r\n var state = {\r\n needNormals: false,\r\n needRebuild: false,\r\n lightmapMode: false,\r\n shadowEnabled: false,\r\n specularEnabled: false\r\n };\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForLight(scene, mesh, this.light, this._lightId, defines, true, state);\r\n if (state.needRebuild) {\r\n defines.rebuild();\r\n }\r\n }\r\n };\r\n LightBlock.prototype.updateUniformsAndSamples = function (state, nodeMaterial, defines) {\r\n for (var lightIndex = 0; lightIndex < nodeMaterial.maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareUniformsAndSamplersForLight(lightIndex, state.uniforms, state.samplers, false, state.uniformBuffers);\r\n }\r\n };\r\n LightBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n if (!this.light) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindLights(scene, mesh, effect, true, nodeMaterial.maxSimultaneousLights, false);\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindLight(this.light, this._lightId, scene, mesh, effect, true, false);\r\n }\r\n };\r\n LightBlock.prototype._injectVertexCode = function (state) {\r\n var worldPos = this.worldPosition;\r\n var comments = \"//\" + this.name;\r\n // Declaration\r\n if (!this.light) { // Emit for all lights\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n this._lightId = 0;\r\n state.sharedData.dynamicUniformBlocks.push(this);\r\n }\r\n else {\r\n this._lightId = (state.counters[\"lightCounter\"] !== undefined ? state.counters[\"lightCounter\"] : -1) + 1;\r\n state.counters[\"lightCounter\"] = this._lightId;\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }]\r\n }, this._lightId.toString());\r\n }\r\n // Inject code in vertex\r\n var worldPosVaryingName = \"v_\" + worldPos.associatedVariableName;\r\n if (state._emitVaryingFromString(worldPosVaryingName, \"vec4\")) {\r\n state.compilationString += worldPosVaryingName + \" = \" + worldPos.associatedVariableName + \";\\r\\n\";\r\n }\r\n if (this.light) {\r\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\r\n replaceStrings: [\r\n { search: /{X}/g, replace: this._lightId.toString() },\r\n { search: /worldPos/g, replace: worldPos.associatedVariableName }\r\n ]\r\n });\r\n }\r\n else {\r\n state.compilationString += \"vec4 worldPos = \" + worldPos.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n }\r\n };\r\n LightBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n // Vertex\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n // Fragment\r\n state.sharedData.bindableBlocks.push(this);\r\n state.sharedData.blocksWithDefines.push(this);\r\n var comments = \"//\" + this.name;\r\n var worldPos = this.worldPosition;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n state._emitFunctionFromInclude(\"lightsFragmentFunctions\", comments, {\r\n replaceStrings: [\r\n { search: /vPositionW/g, replace: \"v_\" + worldPos.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n state._emitFunctionFromInclude(\"shadowsFragmentFunctions\", comments, {\r\n replaceStrings: [\r\n { search: /vPositionW/g, replace: \"v_\" + worldPos.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n if (!this.light) { // Emit for all lights\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n }\r\n else {\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }]\r\n }, this._lightId.toString());\r\n // Uniforms and samplers\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareUniformsAndSamplersForLight(this._lightId, state.uniforms, state.samplers, undefined, state.uniformBuffers);\r\n }\r\n // Code\r\n if (this._lightId === 0) {\r\n if (state._registerTempVariable(\"viewDirectionW\")) {\r\n state.compilationString += \"vec3 viewDirectionW = normalize(\" + this.cameraPosition.associatedVariableName + \" - \" + (\"v_\" + worldPos.associatedVariableName) + \".xyz);\\r\\n\";\r\n }\r\n state.compilationString += \"lightingInfo info;\\r\\n\";\r\n state.compilationString += \"float shadow = 1.;\\r\\n\";\r\n state.compilationString += \"float glossiness = 0.;\\r\\n\";\r\n state.compilationString += \"vec3 diffuseBase = vec3(0., 0., 0.);\\r\\n\";\r\n state.compilationString += \"vec3 specularBase = vec3(0., 0., 0.);\\r\\n\";\r\n state.compilationString += \"vec3 normalW = \" + this.worldNormal.associatedVariableName + \".xyz;\\r\\n\";\r\n }\r\n if (this.light) {\r\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\r\n replaceStrings: [\r\n { search: /{X}/g, replace: this._lightId.toString() }\r\n ]\r\n });\r\n }\r\n else {\r\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n }\r\n var diffuseOutput = this.diffuseOutput;\r\n var specularOutput = this.specularOutput;\r\n state.compilationString += this._declareOutput(diffuseOutput, state) + \" = diffuseBase;\\r\\n\";\r\n if (specularOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(specularOutput, state) + \" = specularBase;\\r\\n\";\r\n }\r\n return this;\r\n };\r\n LightBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.light) {\r\n serializationObject.lightId = this.light.id;\r\n }\r\n return serializationObject;\r\n };\r\n LightBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.lightId) {\r\n this.light = scene.getLightByID(serializationObject.lightId);\r\n }\r\n };\r\n return LightBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.LightBlock\"] = LightBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/reflectionTextureBlock.ts\":\n/*!**************************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/reflectionTextureBlock.ts ***!\n \\**************************************************************/\n/*! exports provided: ReflectionTextureBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return ReflectionTextureBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Textures_texture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to read a reflection texture from a sampler\r\n */\r\nvar ReflectionTextureBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ReflectionTextureBlock, _super);\r\n /**\r\n * Create a new TextureBlock\r\n * @param name defines the block name\r\n */\r\n function ReflectionTextureBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment) || this;\r\n _this.registerInput(\"position\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"world\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"cameraPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerInput(\"view\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ReflectionTextureBlock.prototype.getClassName = function () {\r\n return \"ReflectionTextureBlock\";\r\n };\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"position\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"world\", {\r\n /**\r\n * Gets the world input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"cameraPosition\", {\r\n /**\r\n * Gets the camera (or eye) position component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"view\", {\r\n /**\r\n * Gets the view input component\r\n */\r\n get: function () {\r\n return this._inputs[5];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g output component\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b output component\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ReflectionTextureBlock.prototype.autoConfigure = function (material) {\r\n if (!this.position.isConnected) {\r\n var positionInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"position\"; });\r\n if (!positionInput) {\r\n positionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"position\");\r\n positionInput.setAsAttribute();\r\n }\r\n positionInput.output.connectTo(this.position);\r\n }\r\n if (!this.world.isConnected) {\r\n var worldInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].World; });\r\n if (!worldInput) {\r\n worldInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].World);\r\n }\r\n worldInput.output.connectTo(this.world);\r\n }\r\n if (!this.cameraPosition.isConnected) {\r\n var cameraPositionInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].CameraPosition; });\r\n if (!cameraPositionInput) {\r\n cameraPositionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"cameraPosition\");\r\n cameraPositionInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].CameraPosition);\r\n }\r\n cameraPositionInput.output.connectTo(this.cameraPosition);\r\n }\r\n if (!this.view.isConnected) {\r\n var viewInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].View; });\r\n if (!viewInput) {\r\n viewInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"view\");\r\n viewInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].View);\r\n }\r\n viewInput.output.connectTo(this.view);\r\n }\r\n };\r\n ReflectionTextureBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areTexturesDirty) {\r\n return;\r\n }\r\n if (!this.texture || !this.texture.getTextureMatrix) {\r\n return;\r\n }\r\n defines.setValue(this._define3DName, this.texture.isCube);\r\n defines.setValue(this._defineLocalCubicName, this.texture.boundingBoxSize ? true : false);\r\n defines.setValue(this._defineExplicitName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_EXPLICIT_MODE);\r\n defines.setValue(this._defineSkyboxName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_SKYBOX_MODE);\r\n defines.setValue(this._defineCubicName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_CUBIC_MODE);\r\n defines.setValue(this._defineSphericalName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_SPHERICAL_MODE);\r\n defines.setValue(this._definePlanarName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_PLANAR_MODE);\r\n defines.setValue(this._defineProjectionName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_PROJECTION_MODE);\r\n defines.setValue(this._defineEquirectangularName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_EQUIRECTANGULAR_MODE);\r\n defines.setValue(this._defineEquirectangularFixedName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MODE);\r\n defines.setValue(this._defineMirroredEquirectangularFixedName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE);\r\n };\r\n ReflectionTextureBlock.prototype.isReady = function () {\r\n if (this.texture && !this.texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n ReflectionTextureBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh || !this.texture) {\r\n return;\r\n }\r\n effect.setMatrix(this._reflectionMatrixName, this.texture.getReflectionTextureMatrix());\r\n if (this.texture.isCube) {\r\n effect.setTexture(this._cubeSamplerName, this.texture);\r\n }\r\n else {\r\n effect.setTexture(this._2DSamplerName, this.texture);\r\n }\r\n };\r\n ReflectionTextureBlock.prototype._injectVertexCode = function (state) {\r\n var worldPosVaryingName = \"v_\" + this.worldPosition.associatedVariableName;\r\n if (state._emitVaryingFromString(worldPosVaryingName, \"vec4\")) {\r\n state.compilationString += worldPosVaryingName + \" = \" + this.worldPosition.associatedVariableName + \";\\r\\n\";\r\n }\r\n var worldNormalVaryingName = \"v_\" + this.worldNormal.associatedVariableName;\r\n if (state._emitVaryingFromString(worldNormalVaryingName, \"vec4\")) {\r\n state.compilationString += worldNormalVaryingName + \" = \" + this.worldNormal.associatedVariableName + \";\\r\\n\";\r\n }\r\n this._positionUVWName = state._getFreeVariableName(\"positionUVW\");\r\n this._directionWName = state._getFreeVariableName(\"directionW\");\r\n if (state._emitVaryingFromString(this._positionUVWName, \"vec3\", this._defineSkyboxName)) {\r\n state.compilationString += \"#ifdef \" + this._defineSkyboxName + \"\\r\\n\";\r\n state.compilationString += this._positionUVWName + \" = \" + this.position.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n }\r\n if (state._emitVaryingFromString(this._directionWName, \"vec3\", \"defined(\" + this._defineEquirectangularFixedName + \") || defined(\" + this._defineMirroredEquirectangularFixedName + \")\")) {\r\n state.compilationString += \"#if defined(\" + this._defineEquirectangularFixedName + \") || defined(\" + this._defineMirroredEquirectangularFixedName + \")\\r\\n\";\r\n state.compilationString += this._directionWName + \" = normalize(vec3(\" + this.world.associatedVariableName + \" * vec4(\" + this.position.associatedVariableName + \", 0.0)));\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n }\r\n };\r\n ReflectionTextureBlock.prototype._writeOutput = function (state, output, swizzle) {\r\n state.compilationString += this._declareOutput(output, state) + \" = \" + this._reflectionColorName + \".\" + swizzle + \";\\r\\n\";\r\n };\r\n ReflectionTextureBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n this._define3DName = state._getFreeDefineName(\"REFLECTIONMAP_3D\");\r\n this._defineCubicName = state._getFreeDefineName(\"REFLECTIONMAP_CUBIC\");\r\n this._defineSphericalName = state._getFreeDefineName(\"REFLECTIONMAP_SPHERICAL\");\r\n this._definePlanarName = state._getFreeDefineName(\"REFLECTIONMAP_PLANAR\");\r\n this._defineProjectionName = state._getFreeDefineName(\"REFLECTIONMAP_PROJECTION\");\r\n this._defineExplicitName = state._getFreeDefineName(\"REFLECTIONMAP_EXPLICIT\");\r\n this._defineEquirectangularName = state._getFreeDefineName(\"REFLECTIONMAP_EQUIRECTANGULAR\");\r\n this._defineLocalCubicName = state._getFreeDefineName(\"USE_LOCAL_REFLECTIONMAP_CUBIC\");\r\n this._defineMirroredEquirectangularFixedName = state._getFreeDefineName(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");\r\n this._defineEquirectangularFixedName = state._getFreeDefineName(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");\r\n this._defineSkyboxName = state._getFreeDefineName(\"REFLECTIONMAP_SKYBOX\");\r\n // Vertex\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n state.sharedData.blockingBlocks.push(this);\r\n state.sharedData.textureBlocks.push(this);\r\n // Samplers\r\n this._cubeSamplerName = state._getFreeVariableName(this.name + \"CubeSampler\");\r\n state.samplers.push(this._cubeSamplerName);\r\n this._2DSamplerName = state._getFreeVariableName(this.name + \"2DSampler\");\r\n state.samplers.push(this._2DSamplerName);\r\n state._samplerDeclaration += \"#ifdef \" + this._define3DName + \"\\r\\n\";\r\n state._samplerDeclaration += \"uniform samplerCube \" + this._cubeSamplerName + \";\\r\\n\";\r\n state._samplerDeclaration += \"#else\\r\\n\";\r\n state._samplerDeclaration += \"uniform sampler2D \" + this._2DSamplerName + \";\\r\\n\";\r\n state._samplerDeclaration += \"#endif\\r\\n\";\r\n // Fragment\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n var comments = \"//\" + this.name;\r\n state._emitFunction(\"ReciprocalPI\", \"#define RECIPROCAL_PI2 0.15915494\", \"\");\r\n state._emitFunctionFromInclude(\"reflectionFunction\", comments);\r\n this._reflectionColorName = state._getFreeVariableName(\"reflectionColor\");\r\n this._reflectionCoordsName = state._getFreeVariableName(\"reflectionUVW\");\r\n this._reflection2DCoordsName = state._getFreeVariableName(\"reflectionUV\");\r\n this._reflectionMatrixName = state._getFreeVariableName(\"reflectionMatrix\");\r\n state._emitUniformFromString(this._reflectionMatrixName, \"mat4\");\r\n // Code\r\n var worldPos = \"v_\" + this.worldPosition.associatedVariableName;\r\n var worldNormal = \"v_\" + this.worldNormal.associatedVariableName + \".xyz\";\r\n var reflectionMatrix = this._reflectionMatrixName;\r\n var direction = \"normalize(\" + this._directionWName + \")\";\r\n var positionUVW = \"\" + this._positionUVWName;\r\n var vEyePosition = \"\" + this.cameraPosition.associatedVariableName;\r\n var view = \"\" + this.view.associatedVariableName;\r\n state.compilationString += \"vec3 \" + this._reflectionColorName + \";\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._define3DName + \"\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineMirroredEquirectangularFixedName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeMirroredFixedEquirectangularCoords(\" + worldPos + \", \" + worldNormal + \", \" + direction + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineEquirectangularFixedName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeFixedEquirectangularCoords(\" + worldPos + \", \" + worldNormal + \", \" + direction + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineEquirectangularName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeEquirectangularCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \" #endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineSphericalName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeSphericalCoords(\" + worldPos + \", \" + worldNormal + \", \" + view + \", \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._definePlanarName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computePlanarCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineCubicName + \"\\r\\n\";\r\n state.compilationString += \" #ifdef \" + this._defineLocalCubicName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeCubicLocalCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \", vReflectionSize, vReflectionPosition);\\r\\n\";\r\n state.compilationString += \" #else\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeCubicCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \" #endif\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineProjectionName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeProjectionCoords(\" + worldPos + \", \" + view + \", \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineSkyboxName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeSkyBoxCoords(\" + positionUVW + \", \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineExplicitName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = vec3(0, 0, 0);\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += this._reflectionColorName + \" = textureCube(\" + this._cubeSamplerName + \", \" + this._reflectionCoordsName + \").rgb;\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += \"vec2 \" + this._reflection2DCoordsName + \" = \" + this._reflectionCoordsName + \".xy;\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineProjectionName + \"\\r\\n\";\r\n state.compilationString += this._reflection2DCoordsName + \" /= \" + this._reflectionCoordsName + \".z;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += this._reflection2DCoordsName + \".y = 1.0 - \" + this._reflection2DCoordsName + \".y;\\r\\n\";\r\n state.compilationString += this._reflectionColorName + \" = texture2D(\" + this._2DSamplerName + \", \" + this._reflection2DCoordsName + \").rgb;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n for (var _i = 0, _a = this._outputs; _i < _a.length; _i++) {\r\n var output = _a[_i];\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name);\r\n }\r\n }\r\n return this;\r\n };\r\n ReflectionTextureBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.texture) {\r\n serializationObject.texture = this.texture.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n ReflectionTextureBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.texture) {\r\n this.texture = _Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].Parse(serializationObject.texture, scene, rootUrl);\r\n }\r\n };\r\n return ReflectionTextureBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ReflectionTextureBlock\"] = ReflectionTextureBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/textureBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/textureBlock.ts ***!\n \\****************************************************/\n/*! exports provided: TextureBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return TextureBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to read a texture from a sampler\r\n */\r\nvar TextureBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextureBlock, _super);\r\n /**\r\n * Create a new TextureBlock\r\n * @param name defines the block name\r\n */\r\n function TextureBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment) || this;\r\n _this.registerInput(\"uv\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment);\r\n _this.registerOutput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this._inputs[0].acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this._inputs[0].acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n TextureBlock.prototype.getClassName = function () {\r\n return \"TextureBlock\";\r\n };\r\n Object.defineProperty(TextureBlock.prototype, \"uv\", {\r\n /**\r\n * Gets the uv input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r output component\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g output component\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b output component\r\n */\r\n get: function () {\r\n return this._outputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a output component\r\n */\r\n get: function () {\r\n return this._outputs[5];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"target\", {\r\n get: function () {\r\n // TextureBlock has a special optimizations for uvs that come from the vertex shaders as they can be packed into a single varyings.\r\n // But we need to detect uvs coming from fragment then\r\n if (!this.uv.isConnected) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n }\r\n if (this.uv.sourceBlock.isInput) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n }\r\n var parent = this.uv.connectedPoint;\r\n while (parent) {\r\n if (parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment;\r\n }\r\n if (parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n }\r\n if (parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral || parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment) {\r\n var parentBlock = parent.ownerBlock;\r\n parent = null;\r\n for (var _i = 0, _a = parentBlock.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (input.connectedPoint) {\r\n parent = input.connectedPoint;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TextureBlock.prototype.autoConfigure = function (material) {\r\n if (!this.uv.isConnected) {\r\n var uvInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"uv\"; });\r\n if (!uvInput) {\r\n uvInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_4__[\"InputBlock\"](\"uv\");\r\n uvInput.setAsAttribute();\r\n }\r\n uvInput.output.connectTo(this.uv);\r\n }\r\n };\r\n TextureBlock.prototype.initializeDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (!defines._areTexturesDirty) {\r\n return;\r\n }\r\n defines.setValue(this._mainUVDefineName, false);\r\n };\r\n TextureBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areTexturesDirty) {\r\n return;\r\n }\r\n if (!this.texture || !this.texture.getTextureMatrix) {\r\n return;\r\n }\r\n if (!this.texture.getTextureMatrix().isIdentityAs3x2()) {\r\n defines.setValue(this._defineName, true);\r\n }\r\n else {\r\n defines.setValue(this._defineName, false);\r\n defines.setValue(this._mainUVDefineName, true);\r\n }\r\n };\r\n TextureBlock.prototype.isReady = function () {\r\n if (this.texture && !this.texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n TextureBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh || !this.texture) {\r\n return;\r\n }\r\n if (this._isMixed) {\r\n effect.setFloat(this._textureInfoName, this.texture.level);\r\n effect.setMatrix(this._textureTransformName, this.texture.getTextureMatrix());\r\n }\r\n effect.setTexture(this._samplerName, this.texture);\r\n };\r\n Object.defineProperty(TextureBlock.prototype, \"_isMixed\", {\r\n get: function () {\r\n return this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TextureBlock.prototype._injectVertexCode = function (state) {\r\n var uvInput = this.uv;\r\n // Inject code in vertex\r\n this._defineName = state._getFreeDefineName(\"UVTRANSFORM\");\r\n this._mainUVDefineName = state._getFreeDefineName(\"vMain\" + uvInput.associatedVariableName);\r\n if (uvInput.connectedPoint.ownerBlock.isInput) {\r\n var uvInputOwnerBlock = uvInput.connectedPoint.ownerBlock;\r\n if (!uvInputOwnerBlock.isAttribute) {\r\n state._emitUniformFromString(uvInput.associatedVariableName, \"vec2\");\r\n }\r\n }\r\n this._mainUVName = \"vMain\" + uvInput.associatedVariableName;\r\n this._transformedUVName = state._getFreeVariableName(\"transformedUV\");\r\n this._textureTransformName = state._getFreeVariableName(\"textureTransform\");\r\n this._textureInfoName = state._getFreeVariableName(\"textureInfoName\");\r\n state._emitVaryingFromString(this._transformedUVName, \"vec2\", this._defineName);\r\n state._emitVaryingFromString(this._mainUVName, \"vec2\", this._mainUVDefineName);\r\n state._emitUniformFromString(this._textureTransformName, \"mat4\", this._defineName);\r\n state.compilationString += \"#ifdef \" + this._defineName + \"\\r\\n\";\r\n state.compilationString += this._transformedUVName + \" = vec2(\" + this._textureTransformName + \" * vec4(\" + uvInput.associatedVariableName + \".xy, 1.0, 0.0));\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._mainUVName + \" = \" + uvInput.associatedVariableName + \".xy;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n };\r\n TextureBlock.prototype._writeOutput = function (state, output, swizzle) {\r\n var uvInput = this.uv;\r\n if (this.uv.ownerBlock.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n state.compilationString += this._declareOutput(output, state) + \" = texture2D(\" + this._samplerName + \", \" + uvInput.associatedVariableName + \").\" + swizzle + \";\\r\\n\";\r\n return;\r\n }\r\n var complement = \" * \" + this._textureInfoName;\r\n state.compilationString += \"#ifdef \" + this._defineName + \"\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + \" = texture2D(\" + this._samplerName + \", \" + this._transformedUVName + \").\" + swizzle + complement + \";\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + \" = texture2D(\" + this._samplerName + \", \" + (\"vMain\" + uvInput.associatedVariableName) + \").\" + swizzle + complement + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n };\r\n TextureBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n // Vertex\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n state.sharedData.blockingBlocks.push(this);\r\n state.sharedData.textureBlocks.push(this);\r\n this._samplerName = state._getFreeVariableName(this.name + \"Sampler\");\r\n state.samplers.push(this._samplerName);\r\n state._samplerDeclaration += \"uniform sampler2D \" + this._samplerName + \";\\r\\n\";\r\n // Fragment\r\n state.sharedData.bindableBlocks.push(this);\r\n if (this._isMixed) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n state._emitUniformFromString(this._textureInfoName, \"float\");\r\n }\r\n for (var _i = 0, _a = this._outputs; _i < _a.length; _i++) {\r\n var output = _a[_i];\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name);\r\n }\r\n }\r\n return this;\r\n };\r\n TextureBlock.prototype._dumpPropertiesCode = function () {\r\n if (!this.texture) {\r\n return \"\";\r\n }\r\n var codeString = this._codeVariableName + \".texture = new BABYLON.Texture(\\\"\" + this.texture.name + \"\\\");\\r\\n\";\r\n return codeString;\r\n };\r\n TextureBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.texture) {\r\n serializationObject.texture = this.texture.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n TextureBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.texture) {\r\n this.texture = _Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].Parse(serializationObject.texture, scene, rootUrl);\r\n }\r\n };\r\n return TextureBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.TextureBlock\"] = TextureBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/alphaTestBlock.ts\":\n/*!**********************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/alphaTestBlock.ts ***!\n \\**********************************************************/\n/*! exports provided: AlphaTestBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return AlphaTestBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add an alpha test in the fragment shader\r\n */\r\nvar AlphaTestBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AlphaTestBlock, _super);\r\n /**\r\n * Create a new AlphaTestBlock\r\n * @param name defines the block name\r\n */\r\n function AlphaTestBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n /**\r\n * Gets or sets the alpha value where alpha testing happens\r\n */\r\n _this.alphaCutOff = 0.4;\r\n _this.registerInput(\"color\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, true);\r\n _this.registerInput(\"alpha\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n AlphaTestBlock.prototype.getClassName = function () {\r\n return \"AlphaTestBlock\";\r\n };\r\n Object.defineProperty(AlphaTestBlock.prototype, \"color\", {\r\n /**\r\n * Gets the color input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AlphaTestBlock.prototype, \"alpha\", {\r\n /**\r\n * Gets the alpha input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n AlphaTestBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n state.sharedData.hints.needAlphaTesting = true;\r\n if (this.color.connectedPoint) {\r\n state.compilationString += \"if (\" + this.color.associatedVariableName + \".a < \" + this.alphaCutOff + \") discard;\\r\\n\";\r\n }\r\n else {\r\n state.compilationString += \"if (\" + this.alpha.associatedVariableName + \" < \" + this.alphaCutOff + \") discard;\\r\\n\";\r\n }\r\n return this;\r\n };\r\n AlphaTestBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".alphaCutOff = \" + this.alphaCutOff + \";\\r\\n\";\r\n return codeString;\r\n };\r\n AlphaTestBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.alphaCutOff = this.alphaCutOff;\r\n return serializationObject;\r\n };\r\n AlphaTestBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.alphaCutOff = serializationObject.alphaCutOff;\r\n };\r\n return AlphaTestBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.AlphaTestBlock\"] = AlphaTestBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts\":\n/*!***************************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts ***!\n \\***************************************************************/\n/*! exports provided: FragmentOutputBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return FragmentOutputBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to output the final color\r\n */\r\nvar FragmentOutputBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FragmentOutputBlock, _super);\r\n /**\r\n * Create a new FragmentOutputBlock\r\n * @param name defines the block name\r\n */\r\n function FragmentOutputBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment, true) || this;\r\n _this.registerInput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, true);\r\n _this.registerInput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, true);\r\n _this.registerInput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n FragmentOutputBlock.prototype.getClassName = function () {\r\n return \"FragmentOutputBlock\";\r\n };\r\n Object.defineProperty(FragmentOutputBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FragmentOutputBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FragmentOutputBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n FragmentOutputBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var rgba = this.rgba;\r\n var rgb = this.rgb;\r\n var a = this.a;\r\n state.sharedData.hints.needAlphaBlending = rgba.isConnected || a.isConnected;\r\n if (rgba.connectedPoint) {\r\n state.compilationString += \"gl_FragColor = \" + rgba.associatedVariableName + \";\\r\\n\";\r\n }\r\n else if (rgb.connectedPoint) {\r\n if (a.connectedPoint) {\r\n state.compilationString += \"gl_FragColor = vec4(\" + rgb.associatedVariableName + \", \" + a.associatedVariableName + \");\\r\\n\";\r\n }\r\n else {\r\n state.compilationString += \"gl_FragColor = vec4(\" + rgb.associatedVariableName + \", 1.0);\\r\\n\";\r\n }\r\n }\r\n else {\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(rgba);\r\n }\r\n return this;\r\n };\r\n return FragmentOutputBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.FragmentOutputBlock\"] = FragmentOutputBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/imageProcessingBlock.ts\":\n/*!****************************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/imageProcessingBlock.ts ***!\n \\****************************************************************/\n/*! exports provided: ImageProcessingBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return ImageProcessingBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add image processing support to fragment shader\r\n */\r\nvar ImageProcessingBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageProcessingBlock, _super);\r\n /**\r\n * Create a new ImageProcessingBlock\r\n * @param name defines the block name\r\n */\r\n function ImageProcessingBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"color\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this._inputs[0].acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ImageProcessingBlock.prototype.getClassName = function () {\r\n return \"ImageProcessingBlock\";\r\n };\r\n Object.defineProperty(ImageProcessingBlock.prototype, \"color\", {\r\n /**\r\n * Gets the color input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n ImageProcessingBlock.prototype.initialize = function (state) {\r\n state._excludeVariableName(\"exposureLinear\");\r\n state._excludeVariableName(\"contrast\");\r\n state._excludeVariableName(\"vInverseScreenSize\");\r\n state._excludeVariableName(\"vignetteSettings1\");\r\n state._excludeVariableName(\"vignetteSettings2\");\r\n state._excludeVariableName(\"vCameraColorCurveNegative\");\r\n state._excludeVariableName(\"vCameraColorCurveNeutral\");\r\n state._excludeVariableName(\"vCameraColorCurvePositive\");\r\n state._excludeVariableName(\"txColorTransform\");\r\n state._excludeVariableName(\"colorTransformSettings\");\r\n };\r\n ImageProcessingBlock.prototype.isReady = function (mesh, nodeMaterial, defines) {\r\n if (defines._areImageProcessingDirty && nodeMaterial.imageProcessingConfiguration) {\r\n if (!nodeMaterial.imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n ImageProcessingBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (defines._areImageProcessingDirty && nodeMaterial.imageProcessingConfiguration) {\r\n nodeMaterial.imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n };\r\n ImageProcessingBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n if (!nodeMaterial.imageProcessingConfiguration) {\r\n return;\r\n }\r\n nodeMaterial.imageProcessingConfiguration.bind(effect);\r\n };\r\n ImageProcessingBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Register for blocking\r\n state.sharedData.blockingBlocks.push(this);\r\n // Register for binding\r\n state.sharedData.bindableBlocks.push(this);\r\n // Uniforms\r\n state.uniforms.push(\"exposureLinear\");\r\n state.uniforms.push(\"contrast\");\r\n state.uniforms.push(\"vInverseScreenSize\");\r\n state.uniforms.push(\"vignetteSettings1\");\r\n state.uniforms.push(\"vignetteSettings2\");\r\n state.uniforms.push(\"vCameraColorCurveNegative\");\r\n state.uniforms.push(\"vCameraColorCurveNeutral\");\r\n state.uniforms.push(\"vCameraColorCurvePositive\");\r\n state.uniforms.push(\"txColorTransform\");\r\n state.uniforms.push(\"colorTransformSettings\");\r\n // Emit code\r\n var color = this.color;\r\n var output = this._outputs[0];\r\n var comments = \"//\" + this.name;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n state._emitFunctionFromInclude(\"imageProcessingDeclaration\", comments);\r\n state._emitFunctionFromInclude(\"imageProcessingFunctions\", comments);\r\n if (color.connectedPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4) {\r\n state.compilationString += this._declareOutput(output, state) + \" = \" + color.associatedVariableName + \";\\r\\n\";\r\n }\r\n else {\r\n state.compilationString += this._declareOutput(output, state) + \" = vec4(\" + color.associatedVariableName + \", 1.0);\\r\\n\";\r\n }\r\n state.compilationString += \"#ifdef IMAGEPROCESSINGPOSTPROCESS\\r\\n\";\r\n state.compilationString += output.associatedVariableName + \".rgb = toLinearSpace(\" + color.associatedVariableName + \".rgb);\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += \"#ifdef IMAGEPROCESSING\\r\\n\";\r\n state.compilationString += output.associatedVariableName + \".rgb = toLinearSpace(\" + color.associatedVariableName + \".rgb);\\r\\n\";\r\n state.compilationString += output.associatedVariableName + \" = applyImageProcessing(\" + output.associatedVariableName + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n return this;\r\n };\r\n return ImageProcessingBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ImageProcessingBlock\"] = ImageProcessingBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/index.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/index.ts ***!\n \\*************************************************/\n/*! exports provided: FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fragmentOutputBlock */ \"./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_0__[\"FragmentOutputBlock\"]; });\n\n/* harmony import */ var _alphaTestBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./alphaTestBlock */ \"./Materials/Node/Blocks/Fragment/alphaTestBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _alphaTestBlock__WEBPACK_IMPORTED_MODULE_1__[\"AlphaTestBlock\"]; });\n\n/* harmony import */ var _imageProcessingBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./imageProcessingBlock */ \"./Materials/Node/Blocks/Fragment/imageProcessingBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _imageProcessingBlock__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingBlock\"]; });\n\n/* harmony import */ var _perturbNormalBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./perturbNormalBlock */ \"./Materials/Node/Blocks/Fragment/perturbNormalBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _perturbNormalBlock__WEBPACK_IMPORTED_MODULE_3__[\"PerturbNormalBlock\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/perturbNormalBlock.ts\":\n/*!**************************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/perturbNormalBlock.ts ***!\n \\**************************************************************/\n/*! exports provided: PerturbNormalBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return PerturbNormalBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to pertub normals based on a normal map\r\n */\r\nvar PerturbNormalBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PerturbNormalBlock, _super);\r\n /**\r\n * Create a new PerturbNormalBlock\r\n * @param name defines the block name\r\n */\r\n function PerturbNormalBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this._tangentSpaceParameterName = \"\";\r\n /** Gets or sets a boolean indicating that normal should be inverted on X axis */\r\n _this.invertX = false;\r\n /** Gets or sets a boolean indicating that normal should be inverted on Y axis */\r\n _this.invertY = false;\r\n // Vertex\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false);\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false);\r\n _this.registerInput(\"uv\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2, false);\r\n _this.registerInput(\"normalMapColor\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, false);\r\n _this.registerInput(\"strength\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, false);\r\n // Fragment\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n PerturbNormalBlock.prototype.getClassName = function () {\r\n return \"PerturbNormalBlock\";\r\n };\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"uv\", {\r\n /**\r\n * Gets the uv input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"normalMapColor\", {\r\n /**\r\n * Gets the normal map color input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"strength\", {\r\n /**\r\n * Gets the strength input component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n PerturbNormalBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n defines.setValue(\"BUMP\", true);\r\n };\r\n PerturbNormalBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n effect.setFloat2(this._tangentSpaceParameterName, this.invertX ? -1 : 1, this.invertY ? -1 : 1);\r\n };\r\n PerturbNormalBlock.prototype.autoConfigure = function (material) {\r\n if (!this.uv.isConnected) {\r\n var uvInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"uv\"; });\r\n if (!uvInput) {\r\n uvInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"uv\");\r\n uvInput.setAsAttribute();\r\n }\r\n uvInput.output.connectTo(this.uv);\r\n }\r\n if (!this.strength.isConnected) {\r\n var strengthInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"strength\");\r\n strengthInput.value = 1.0;\r\n strengthInput.output.connectTo(this.strength);\r\n }\r\n };\r\n PerturbNormalBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var comments = \"//\" + this.name;\r\n var uv = this.uv;\r\n var worldPosition = this.worldPosition;\r\n var worldNormal = this.worldNormal;\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n this._tangentSpaceParameterName = state._getFreeDefineName(\"tangentSpaceParameter\");\r\n state._emitUniformFromString(this._tangentSpaceParameterName, \"vec2\");\r\n state._emitExtension(\"bump\", \"#extension GL_OES_standard_derivatives : enable\");\r\n state._emitFunctionFromInclude(\"bumpFragmentFunctions\", comments, {\r\n replaceStrings: [\r\n { search: /vBumpInfos.y/g, replace: \"1.0 / \" + this.strength.associatedVariableName },\r\n { search: /vTangentSpaceParams/g, replace: this._tangentSpaceParameterName },\r\n { search: /vPositionW/g, replace: worldPosition.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n state.compilationString += this._declareOutput(this.output, state) + \" = vec4(0.);\\r\\n\";\r\n state.compilationString += state._emitCodeFromInclude(\"bumpFragment\", comments, {\r\n replaceStrings: [\r\n { search: /perturbNormal\\(TBN,vBumpUV\\+uvOffset\\)/g, replace: \"perturbNormal(TBN, \" + this.normalMapColor.associatedVariableName + \")\" },\r\n { search: /vBumpInfos.y/g, replace: \"1.0 / \" + this.strength.associatedVariableName },\r\n { search: /vBumpUV/g, replace: uv.associatedVariableName },\r\n { search: /vPositionW/g, replace: worldPosition.associatedVariableName + \".xyz\" },\r\n { search: /normalW=/g, replace: this.output.associatedVariableName + \".xyz = \" },\r\n { search: /normalW/g, replace: worldNormal.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n return this;\r\n };\r\n PerturbNormalBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".invertX = \" + this.invertX + \";\\r\\n\";\r\n codeString += this._codeVariableName + \".invertY = \" + this.invertY + \";\\r\\n\";\r\n return codeString;\r\n };\r\n PerturbNormalBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.invertX = this.invertX;\r\n serializationObject.invertY = this.invertY;\r\n return serializationObject;\r\n };\r\n PerturbNormalBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.invertX = serializationObject.invertX;\r\n this.invertY = serializationObject.invertY;\r\n };\r\n return PerturbNormalBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PerturbNormalBlock\"] = PerturbNormalBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts\":\n/*!****************************************************************!*\\\n !*** ./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts ***!\n \\****************************************************************/\n/*! exports provided: AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return AnimatedInputBlockTypes; });\n/**\r\n * Enum defining the type of animations supported by InputBlock\r\n */\r\nvar AnimatedInputBlockTypes;\r\n(function (AnimatedInputBlockTypes) {\r\n /** No animation */\r\n AnimatedInputBlockTypes[AnimatedInputBlockTypes[\"None\"] = 0] = \"None\";\r\n /** Time based animation. Will only work for floats */\r\n AnimatedInputBlockTypes[AnimatedInputBlockTypes[\"Time\"] = 1] = \"Time\";\r\n})(AnimatedInputBlockTypes || (AnimatedInputBlockTypes = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Input/index.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Node/Blocks/Input/index.ts ***!\n \\**********************************************/\n/*! exports provided: InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _inputBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _inputBlock__WEBPACK_IMPORTED_MODULE_0__[\"InputBlock\"]; });\n\n/* harmony import */ var _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./animatedInputBlockTypes */ \"./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_1__[\"AnimatedInputBlockTypes\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Input/inputBlock.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Node/Blocks/Input/inputBlock.ts ***!\n \\***************************************************/\n/*! exports provided: InputBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return InputBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../NodeMaterialBlockConnectionPointMode */ \"./Materials/Node/NodeMaterialBlockConnectionPointMode.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../Maths/math */ \"./Maths/math.ts\");\n/* harmony import */ var _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./animatedInputBlockTypes */ \"./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nvar InputBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InputBlock, _super);\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param target defines the target of that block (Vertex by default)\r\n * @param type defines the type of the input (can be set to NodeMaterialBlockConnectionPointTypes.AutoDetect)\r\n */\r\n function InputBlock(name, target, type) {\r\n if (target === void 0) { target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_6__[\"NodeMaterialBlockTargets\"].Vertex; }\r\n if (type === void 0) { type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect; }\r\n var _this = _super.call(this, name, target, false, true) || this;\r\n _this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n _this._animationType = _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__[\"AnimatedInputBlockTypes\"].None;\r\n /** @hidden */\r\n _this._systemValue = null;\r\n /** Gets or sets a boolean indicating that this input can be edited in the Inspector (false by default) */\r\n _this.visibleInInspector = false;\r\n _this._type = type;\r\n _this.setDefaultValue();\r\n _this.registerOutput(\"output\", type);\r\n return _this;\r\n }\r\n Object.defineProperty(InputBlock.prototype, \"type\", {\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n get: function () {\r\n if (this._type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect) {\r\n if (this.isUniform && this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float;\r\n return this._type;\r\n }\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3;\r\n return this._type;\r\n case \"Vector4\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4;\r\n return this._type;\r\n case \"Color3\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3;\r\n return this._type;\r\n case \"Color4\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4;\r\n return this._type;\r\n }\r\n }\r\n if (this.isAttribute) {\r\n switch (this.name) {\r\n case \"position\":\r\n case \"normal\":\r\n case \"tangent\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3;\r\n return this._type;\r\n case \"uv\":\r\n case \"uv2\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2;\r\n return this._type;\r\n case \"matricesIndices\":\r\n case \"matricesWeights\":\r\n case \"world0\":\r\n case \"world1\":\r\n case \"world2\":\r\n case \"world3\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4;\r\n return this._type;\r\n case \"color\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4;\r\n return this._type;\r\n }\r\n }\r\n if (this.isSystemValue) {\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].View:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].ViewProjection:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].Projection:\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix;\r\n return this._type;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].CameraPosition:\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3;\r\n return this._type;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].FogColor:\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3;\r\n return this._type;\r\n }\r\n }\r\n }\r\n return this._type;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Set the source of this connection point to a vertex attribute\r\n * @param attributeName defines the attribute name (position, uv, normal, etc...). If not specified it will take the connection point name\r\n * @returns the current connection point\r\n */\r\n InputBlock.prototype.setAsAttribute = function (attributeName) {\r\n if (attributeName) {\r\n this.name = attributeName;\r\n }\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Attribute;\r\n return this;\r\n };\r\n /**\r\n * Set the source of this connection point to a system value\r\n * @param value define the system value to use (world, view, etc...) or null to switch to manual value\r\n * @returns the current connection point\r\n */\r\n InputBlock.prototype.setAsSystemValue = function (value) {\r\n this.systemValue = value;\r\n return this;\r\n };\r\n Object.defineProperty(InputBlock.prototype, \"value\", {\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n get: function () {\r\n return this._storedValue;\r\n },\r\n set: function (value) {\r\n this._storedValue = value;\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"valueCallback\", {\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n get: function () {\r\n return this._valueCallback;\r\n },\r\n set: function (value) {\r\n this._valueCallback = value;\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"associatedVariableName\", {\r\n /**\r\n * Gets or sets the associated variable name in the shader\r\n */\r\n get: function () {\r\n return this._associatedVariableName;\r\n },\r\n set: function (value) {\r\n this._associatedVariableName = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"animationType\", {\r\n /** Gets or sets the type of animation applied to the input */\r\n get: function () {\r\n return this._animationType;\r\n },\r\n set: function (value) {\r\n this._animationType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isUndefined\", {\r\n /**\r\n * Gets a boolean indicating that this connection point not defined yet\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isUniform\", {\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is coming from an uniform.\r\n * In this case the connection point name must be the name of the uniform to use.\r\n * Can only be set on inputs\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n },\r\n set: function (value) {\r\n this._mode = value ? _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform : _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n this.associatedVariableName = \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isAttribute\", {\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is coming from an attribute.\r\n * In this case the connection point name must be the name of the attribute to use\r\n * Can only be set on inputs\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Attribute;\r\n },\r\n set: function (value) {\r\n this._mode = value ? _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Attribute : _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n this.associatedVariableName = \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isVarying\", {\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is generating a varying variable.\r\n * Can only be set on exit points\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Varying;\r\n },\r\n set: function (value) {\r\n this._mode = value ? _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Varying : _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n this.associatedVariableName = \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isSystemValue\", {\r\n /**\r\n * Gets a boolean indicating that the current connection point is a system value\r\n */\r\n get: function () {\r\n return this._systemValue != null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"systemValue\", {\r\n /**\r\n * Gets or sets the current well known value or null if not defined as a system value\r\n */\r\n get: function () {\r\n return this._systemValue;\r\n },\r\n set: function (value) {\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n this.associatedVariableName = \"\";\r\n this._systemValue = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n InputBlock.prototype.getClassName = function () {\r\n return \"InputBlock\";\r\n };\r\n /**\r\n * Animate the input if animationType !== None\r\n * @param scene defines the rendering scene\r\n */\r\n InputBlock.prototype.animate = function (scene) {\r\n switch (this._animationType) {\r\n case _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__[\"AnimatedInputBlockTypes\"].Time: {\r\n if (this.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float) {\r\n this.value += scene.getAnimationRatio() * 0.01;\r\n }\r\n break;\r\n }\r\n }\r\n };\r\n InputBlock.prototype._emitDefine = function (define) {\r\n if (define[0] === \"!\") {\r\n return \"#ifndef \" + define.substring(1) + \"\\r\\n\";\r\n }\r\n return \"#ifdef \" + define + \"\\r\\n\";\r\n };\r\n /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n InputBlock.prototype.setDefaultValue = function () {\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n this.value = 0;\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].Zero();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector4\"].Zero();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n this.value = _Maths_math__WEBPACK_IMPORTED_MODULE_8__[\"Color3\"].White();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n this.value = new _Maths_math__WEBPACK_IMPORTED_MODULE_8__[\"Color4\"](1, 1, 1, 1);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n break;\r\n }\r\n };\r\n InputBlock.prototype._dumpPropertiesCode = function () {\r\n if (this.isAttribute) {\r\n return this._codeVariableName + \".setAsAttribute(\\\"\" + this.name + \"\\\");\\r\\n\";\r\n }\r\n if (this.isSystemValue) {\r\n return this._codeVariableName + \".setAsSystemValue(BABYLON.NodeMaterialSystemValues.\" + _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"][this._systemValue] + \");\\r\\n\";\r\n }\r\n if (this.isUniform) {\r\n var valueString = \"\";\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n valueString = this.value.toString();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n valueString = \"new BABYLON.Vector2(\" + this.value.x + \", \" + this.value.y + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n valueString = \"new BABYLON.Vector3(\" + this.value.x + \", \" + this.value.y + \", \" + this.value.z + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n valueString = \"new BABYLON.Vector4(\" + this.value.x + \", \" + this.value.y + \", \" + this.value.z + \", \" + this.value.w + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n valueString = \"new BABYLON.Color3(\" + this.value.r + \", \" + this.value.g + \", \" + this.value.b + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n valueString = \"new BABYLON.Color4(\" + this.value.r + \", \" + this.value.g + \", \" + this.value.b + \", \" + this.value.a + \")\";\r\n break;\r\n }\r\n return this._codeVariableName + \".value = \" + valueString + \";\\r\\n\";\r\n }\r\n return \"\";\r\n };\r\n InputBlock.prototype._emit = function (state, define) {\r\n // Uniforms\r\n if (this.isUniform) {\r\n if (!this.associatedVariableName) {\r\n this.associatedVariableName = state._getFreeVariableName(\"u_\" + this.name);\r\n }\r\n if (state.uniforms.indexOf(this.associatedVariableName) !== -1) {\r\n return;\r\n }\r\n state.uniforms.push(this.associatedVariableName);\r\n if (define) {\r\n state._uniformDeclaration += this._emitDefine(define);\r\n }\r\n state._uniformDeclaration += \"uniform \" + state._getGLType(this.type) + \" \" + this.associatedVariableName + \";\\r\\n\";\r\n if (define) {\r\n state._uniformDeclaration += \"#endif\\r\\n\";\r\n }\r\n // well known\r\n var hints = state.sharedData.hints;\r\n if (this._systemValue !== null && this._systemValue !== undefined) {\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n hints.needWorldViewMatrix = true;\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n hints.needWorldViewProjectionMatrix = true;\r\n break;\r\n }\r\n }\r\n else {\r\n if (this._animationType !== _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__[\"AnimatedInputBlockTypes\"].None) {\r\n state.sharedData.animatedInputs.push(this);\r\n }\r\n }\r\n return;\r\n }\r\n // Attribute\r\n if (this.isAttribute) {\r\n this.associatedVariableName = this.name;\r\n if (this.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_6__[\"NodeMaterialBlockTargets\"].Vertex && state._vertexState) { // Attribute for fragment need to be carried over by varyings\r\n this._emit(state._vertexState, define);\r\n return;\r\n }\r\n if (state.attributes.indexOf(this.associatedVariableName) !== -1) {\r\n return;\r\n }\r\n state.attributes.push(this.associatedVariableName);\r\n if (define) {\r\n state._attributeDeclaration += this._emitDefine(define);\r\n }\r\n state._attributeDeclaration += \"attribute \" + state._getGLType(this.type) + \" \" + this.associatedVariableName + \";\\r\\n\";\r\n if (define) {\r\n state._attributeDeclaration += \"#endif\\r\\n\";\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputBlock.prototype._transmitWorld = function (effect, world, worldView, worldViewProjection) {\r\n if (!this._systemValue) {\r\n return;\r\n }\r\n var variableName = this.associatedVariableName;\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World:\r\n effect.setMatrix(variableName, world);\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n effect.setMatrix(variableName, worldView);\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n effect.setMatrix(variableName, worldViewProjection);\r\n break;\r\n }\r\n };\r\n /** @hidden */\r\n InputBlock.prototype._transmit = function (effect, scene) {\r\n if (this.isAttribute) {\r\n return;\r\n }\r\n var variableName = this.associatedVariableName;\r\n if (this._systemValue) {\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n return;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].View:\r\n effect.setMatrix(variableName, scene.getViewMatrix());\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].Projection:\r\n effect.setMatrix(variableName, scene.getProjectionMatrix());\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].ViewProjection:\r\n effect.setMatrix(variableName, scene.getTransformMatrix());\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].CameraPosition:\r\n effect.setVector3(variableName, scene.activeCamera.globalPosition);\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].FogColor:\r\n effect.setColor3(variableName, scene.fogColor);\r\n break;\r\n }\r\n return;\r\n }\r\n var value = this._valueCallback ? this._valueCallback() : this._storedValue;\r\n if (value === null) {\r\n return;\r\n }\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n effect.setFloat(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Int:\r\n effect.setInt(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n effect.setColor3(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n effect.setDirectColor4(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n effect.setVector2(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n effect.setVector3(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n effect.setVector4(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix:\r\n effect.setMatrix(variableName, value);\r\n break;\r\n }\r\n };\r\n InputBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (this.isUniform || this.isSystemValue) {\r\n state.sharedData.inputBlocks.push(this);\r\n }\r\n this._emit(state);\r\n };\r\n InputBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.type = this.type;\r\n serializationObject.mode = this._mode;\r\n serializationObject.systemValue = this._systemValue;\r\n serializationObject.animationType = this._animationType;\r\n serializationObject.visibleInInspector = this.visibleInInspector;\r\n if (this._storedValue != null && this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n }\r\n else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n InputBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this._type = serializationObject.type;\r\n this._mode = serializationObject.mode;\r\n this._systemValue = serializationObject.systemValue || serializationObject.wellKnownValue;\r\n this._animationType = serializationObject.animationType;\r\n this.visibleInInspector = serializationObject.visibleInInspector;\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n }\r\n else {\r\n var valueType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].GetClass(serializationObject.valueType);\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n };\r\n return InputBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.InputBlock\"] = InputBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/bonesBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/bonesBlock.ts ***!\n \\****************************************************/\n/*! exports provided: BonesBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return BonesBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add support for vertex skinning (bones)\r\n */\r\nvar BonesBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BonesBlock, _super);\r\n /**\r\n * Creates a new BonesBlock\r\n * @param name defines the block name\r\n */\r\n function BonesBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this.registerInput(\"matricesIndices\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"matricesWeights\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"matricesIndicesExtra\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, true);\r\n _this.registerInput(\"matricesWeightsExtra\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, true);\r\n _this.registerInput(\"world\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n return _this;\r\n }\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n BonesBlock.prototype.initialize = function (state) {\r\n state._excludeVariableName(\"boneSampler\");\r\n state._excludeVariableName(\"boneTextureWidth\");\r\n state._excludeVariableName(\"mBones\");\r\n state._excludeVariableName(\"BonesPerMesh\");\r\n };\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n BonesBlock.prototype.getClassName = function () {\r\n return \"BonesBlock\";\r\n };\r\n Object.defineProperty(BonesBlock.prototype, \"matricesIndices\", {\r\n /**\r\n * Gets the matrix indices input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"matricesWeights\", {\r\n /**\r\n * Gets the matrix weights input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"matricesIndicesExtra\", {\r\n /**\r\n * Gets the extra matrix indices input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"matricesWeightsExtra\", {\r\n /**\r\n * Gets the extra matrix weights input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"world\", {\r\n /**\r\n * Gets the world input component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n BonesBlock.prototype.autoConfigure = function (material) {\r\n if (!this.matricesIndices.isConnected) {\r\n var matricesIndicesInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"matricesIndices\"; });\r\n if (!matricesIndicesInput) {\r\n matricesIndicesInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"matricesIndices\");\r\n matricesIndicesInput.setAsAttribute(\"matricesIndices\");\r\n }\r\n matricesIndicesInput.output.connectTo(this.matricesIndices);\r\n }\r\n if (!this.matricesWeights.isConnected) {\r\n var matricesWeightsInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"matricesWeights\"; });\r\n if (!matricesWeightsInput) {\r\n matricesWeightsInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"matricesWeights\");\r\n matricesWeightsInput.setAsAttribute(\"matricesWeights\");\r\n }\r\n matricesWeightsInput.output.connectTo(this.matricesWeights);\r\n }\r\n if (!this.world.isConnected) {\r\n var worldInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].World; });\r\n if (!worldInput) {\r\n worldInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].World);\r\n }\r\n worldInput.output.connectTo(this.world);\r\n }\r\n };\r\n BonesBlock.prototype.provideFallbacks = function (mesh, fallbacks) {\r\n if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n };\r\n BonesBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindBonesParameters(mesh, effect);\r\n };\r\n BonesBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areAttributesDirty) {\r\n return;\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PrepareDefinesForBones(mesh, defines);\r\n };\r\n BonesBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for compilation fallbacks\r\n state.sharedData.blocksWithFallbacks.push(this);\r\n // Register for binding\r\n state.sharedData.bindableBlocks.push(this);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Register internal uniforms and samplers\r\n state.uniforms.push(\"boneTextureWidth\");\r\n state.uniforms.push(\"mBones\");\r\n state.samplers.push(\"boneSampler\");\r\n // Emit code\r\n var comments = \"//\" + this.name;\r\n state._emitFunctionFromInclude(\"bonesDeclaration\", comments, {\r\n removeAttributes: true,\r\n removeUniforms: false,\r\n removeVaryings: true,\r\n removeIfDef: false\r\n });\r\n var influenceVariablename = state._getFreeVariableName(\"influence\");\r\n state.compilationString += state._emitCodeFromInclude(\"bonesVertex\", comments, {\r\n replaceStrings: [\r\n {\r\n search: /finalWorld=finalWorld\\*influence;/,\r\n replace: \"\"\r\n },\r\n {\r\n search: /influence/gm,\r\n replace: influenceVariablename\r\n }\r\n ]\r\n });\r\n var output = this._outputs[0];\r\n var worldInput = this.world;\r\n state.compilationString += \"#if NUM_BONE_INFLUENCERS>0\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + worldInput.associatedVariableName + \" * \" + influenceVariablename + \";\\r\\n\");\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + worldInput.associatedVariableName + \";\\r\\n\");\r\n state.compilationString += \"#endif\\r\\n\";\r\n return this;\r\n };\r\n return BonesBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.BonesBlock\"] = BonesBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/index.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/index.ts ***!\n \\***********************************************/\n/*! exports provided: VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _vertexOutputBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vertexOutputBlock */ \"./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _vertexOutputBlock__WEBPACK_IMPORTED_MODULE_0__[\"VertexOutputBlock\"]; });\n\n/* harmony import */ var _bonesBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bonesBlock */ \"./Materials/Node/Blocks/Vertex/bonesBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _bonesBlock__WEBPACK_IMPORTED_MODULE_1__[\"BonesBlock\"]; });\n\n/* harmony import */ var _instancesBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./instancesBlock */ \"./Materials/Node/Blocks/Vertex/instancesBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _instancesBlock__WEBPACK_IMPORTED_MODULE_2__[\"InstancesBlock\"]; });\n\n/* harmony import */ var _morphTargetsBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./morphTargetsBlock */ \"./Materials/Node/Blocks/Vertex/morphTargetsBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _morphTargetsBlock__WEBPACK_IMPORTED_MODULE_3__[\"MorphTargetsBlock\"]; });\n\n/* harmony import */ var _lightInformationBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lightInformationBlock */ \"./Materials/Node/Blocks/Vertex/lightInformationBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _lightInformationBlock__WEBPACK_IMPORTED_MODULE_4__[\"LightInformationBlock\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/instancesBlock.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/instancesBlock.ts ***!\n \\********************************************************/\n/*! exports provided: InstancesBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return InstancesBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add support for instances\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n */\r\nvar InstancesBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InstancesBlock, _super);\r\n /**\r\n * Creates a new InstancesBlock\r\n * @param name defines the block name\r\n */\r\n function InstancesBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this.registerInput(\"world0\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world1\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world2\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world3\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, true);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n InstancesBlock.prototype.getClassName = function () {\r\n return \"InstancesBlock\";\r\n };\r\n Object.defineProperty(InstancesBlock.prototype, \"world0\", {\r\n /**\r\n * Gets the first world row input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world1\", {\r\n /**\r\n * Gets the second world row input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world2\", {\r\n /**\r\n * Gets the third world row input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world3\", {\r\n /**\r\n * Gets the forth world row input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world\", {\r\n /**\r\n * Gets the world input component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InstancesBlock.prototype.autoConfigure = function (material) {\r\n if (!this.world0.connectedPoint) {\r\n var world0Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world0\"; });\r\n if (!world0Input) {\r\n world0Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world0\");\r\n world0Input.setAsAttribute(\"world0\");\r\n }\r\n world0Input.output.connectTo(this.world0);\r\n }\r\n if (!this.world1.connectedPoint) {\r\n var world1Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world1\"; });\r\n if (!world1Input) {\r\n world1Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world1\");\r\n world1Input.setAsAttribute(\"world1\");\r\n }\r\n world1Input.output.connectTo(this.world1);\r\n }\r\n if (!this.world2.connectedPoint) {\r\n var world2Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world2\"; });\r\n if (!world2Input) {\r\n world2Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world2\");\r\n world2Input.setAsAttribute(\"world2\");\r\n }\r\n world2Input.output.connectTo(this.world2);\r\n }\r\n if (!this.world3.connectedPoint) {\r\n var world3Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world3\"; });\r\n if (!world3Input) {\r\n world3Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world3\");\r\n world3Input.setAsAttribute(\"world3\");\r\n }\r\n world3Input.output.connectTo(this.world3);\r\n }\r\n if (!this.world.connectedPoint) {\r\n var worldInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world\"; });\r\n if (!worldInput) {\r\n worldInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World);\r\n }\r\n worldInput.output.connectTo(this.world);\r\n }\r\n this.world.define = \"!INSTANCES\";\r\n };\r\n InstancesBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n var changed = false;\r\n if (defines[\"INSTANCES\"] !== useInstances) {\r\n defines.setValue(\"INSTANCES\", useInstances);\r\n changed = true;\r\n }\r\n if (changed) {\r\n defines.markAsUnprocessed();\r\n }\r\n };\r\n InstancesBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Emit code\r\n var output = this._outputs[0];\r\n var world0 = this.world0;\r\n var world1 = this.world1;\r\n var world2 = this.world2;\r\n var world3 = this.world3;\r\n state.compilationString += \"#ifdef INSTANCES\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = mat4(\" + world0.associatedVariableName + \", \" + world1.associatedVariableName + \", \" + world2.associatedVariableName + \", \" + world3.associatedVariableName + \");\\r\\n\");\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.world.associatedVariableName + \";\\r\\n\");\r\n state.compilationString += \"#endif\\r\\n\";\r\n return this;\r\n };\r\n return InstancesBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.InstancesBlock\"] = InstancesBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/lightInformationBlock.ts\":\n/*!***************************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/lightInformationBlock.ts ***!\n \\***************************************************************/\n/*! exports provided: LightInformationBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return LightInformationBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Lights_pointLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Lights/pointLight */ \"./Lights/pointLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get data information from a light\r\n */\r\nvar LightInformationBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LightInformationBlock, _super);\r\n /**\r\n * Creates a new LightInformationBlock\r\n * @param name defines the block name\r\n */\r\n function LightInformationBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerOutput(\"direction\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"color\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n LightInformationBlock.prototype.getClassName = function () {\r\n return \"LightInformationBlock\";\r\n };\r\n Object.defineProperty(LightInformationBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightInformationBlock.prototype, \"direction\", {\r\n /**\r\n * Gets the direction output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightInformationBlock.prototype, \"color\", {\r\n /**\r\n * Gets the direction output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n LightInformationBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n if (!this.light || !this.light.isEnabled) {\r\n effect.setFloat3(this._lightDataDefineName, 0, 0, 0);\r\n effect.setFloat3(this._lightColorDefineName, 0, 0, 0);\r\n return;\r\n }\r\n this.light.transferToNodeMaterialEffect(effect, this._lightDataDefineName);\r\n effect.setColor3(this._lightColorDefineName, this.light.diffuse);\r\n };\r\n LightInformationBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n state.sharedData.bindableBlocks.push(this);\r\n var direction = this.direction;\r\n var color = this.color;\r\n if (!this.light) {\r\n state.compilationString += this._declareOutput(direction, state) + \" = vec3(0.);\\r\\n\";\r\n state.compilationString += this._declareOutput(color, state) + \" = vec3(0.);\\r\\n\";\r\n }\r\n else {\r\n this._lightDataDefineName = state._getFreeDefineName(\"lightData\");\r\n state._emitUniformFromString(this._lightDataDefineName, \"vec3\");\r\n this._lightColorDefineName = state._getFreeDefineName(\"lightColor\");\r\n state._emitUniformFromString(this._lightColorDefineName, \"vec3\");\r\n if (this.light instanceof _Lights_pointLight__WEBPACK_IMPORTED_MODULE_5__[\"PointLight\"]) {\r\n state.compilationString += this._declareOutput(direction, state) + (\" = normalize(\" + this._lightDataDefineName + \" - \" + this.worldPosition.associatedVariableName + \".xyz);\\r\\n\");\r\n }\r\n else {\r\n state.compilationString += this._declareOutput(direction, state) + (\" = \" + this._lightDataDefineName + \";\\r\\n\");\r\n }\r\n state.compilationString += this._declareOutput(color, state) + (\" = \" + this._lightColorDefineName + \";\\r\\n\");\r\n }\r\n return this;\r\n };\r\n LightInformationBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.light) {\r\n serializationObject.lightId = this.light.id;\r\n }\r\n return serializationObject;\r\n };\r\n LightInformationBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.lightId) {\r\n this.light = scene.getLightByID(serializationObject.lightId);\r\n }\r\n };\r\n return LightInformationBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.LightInformationBlock\"] = LightInformationBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/morphTargetsBlock.ts\":\n/*!***********************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/morphTargetsBlock.ts ***!\n \\***********************************************************/\n/*! exports provided: MorphTargetsBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return MorphTargetsBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add morph targets support to vertex shader\r\n */\r\nvar MorphTargetsBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MorphTargetsBlock, _super);\r\n /**\r\n * Create a new MorphTargetsBlock\r\n * @param name defines the block name\r\n */\r\n function MorphTargetsBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this._repeatebleContentGenerated = 0;\r\n _this.registerInput(\"position\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"normal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"tangent\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"uv\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n _this.registerOutput(\"positionOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"normalOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"tangentOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"uvOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MorphTargetsBlock.prototype.getClassName = function () {\r\n return \"MorphTargetsBlock\";\r\n };\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"position\", {\r\n /**\r\n * Gets the position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"normal\", {\r\n /**\r\n * Gets the normal input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"tangent\", {\r\n /**\r\n * Gets the tangent input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"uv\", {\r\n /**\r\n * Gets the tangent input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"positionOutput\", {\r\n /**\r\n * Gets the position output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"normalOutput\", {\r\n /**\r\n * Gets the normal output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"tangentOutput\", {\r\n /**\r\n * Gets the tangent output component\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"uvOutput\", {\r\n /**\r\n * Gets the tangent output component\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MorphTargetsBlock.prototype.initialize = function (state) {\r\n state._excludeVariableName(\"morphTargetInfluences\");\r\n };\r\n MorphTargetsBlock.prototype.autoConfigure = function (material) {\r\n if (!this.position.isConnected) {\r\n var positionInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"position\"; });\r\n if (!positionInput) {\r\n positionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"position\");\r\n positionInput.setAsAttribute();\r\n }\r\n positionInput.output.connectTo(this.position);\r\n }\r\n if (!this.normal.isConnected) {\r\n var normalInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"normal\"; });\r\n if (!normalInput) {\r\n normalInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"normal\");\r\n normalInput.setAsAttribute(\"normal\");\r\n }\r\n normalInput.output.connectTo(this.normal);\r\n }\r\n if (!this.tangent.isConnected) {\r\n var tangentInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"tangent\"; });\r\n if (!tangentInput) {\r\n tangentInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"tangent\");\r\n tangentInput.setAsAttribute(\"tangent\");\r\n }\r\n tangentInput.output.connectTo(this.tangent);\r\n }\r\n if (!this.uv.isConnected) {\r\n var uvInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"uv\"; });\r\n if (!uvInput) {\r\n uvInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"uv\");\r\n uvInput.setAsAttribute(\"uv\");\r\n }\r\n uvInput.output.connectTo(this.uv);\r\n }\r\n };\r\n MorphTargetsBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areAttributesDirty) {\r\n return;\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMorphTargets(mesh, defines);\r\n };\r\n MorphTargetsBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (mesh && this._repeatebleContentGenerated) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, effect);\r\n }\r\n };\r\n MorphTargetsBlock.prototype.replaceRepeatableContent = function (vertexShaderState, fragmentShaderState, mesh, defines) {\r\n var position = this.position;\r\n var normal = this.normal;\r\n var tangent = this.tangent;\r\n var uv = this.uv;\r\n var positionOutput = this.positionOutput;\r\n var normalOutput = this.normalOutput;\r\n var tangentOutput = this.tangentOutput;\r\n var uvOutput = this.uvOutput;\r\n var state = vertexShaderState;\r\n var repeatCount = defines.NUM_MORPH_INFLUENCERS;\r\n this._repeatebleContentGenerated = repeatCount;\r\n var manager = mesh.morphTargetManager;\r\n var hasNormals = manager && manager.supportsNormals && defines[\"NORMAL\"];\r\n var hasTangents = manager && manager.supportsTangents && defines[\"TANGENT\"];\r\n var hasUVs = manager && manager.supportsUVs && defines[\"UV1\"];\r\n var injectionCode = \"\";\r\n for (var index = 0; index < repeatCount; index++) {\r\n injectionCode += \"#ifdef MORPHTARGETS\\r\\n\";\r\n injectionCode += positionOutput.associatedVariableName + \" += (position\" + index + \" - \" + position.associatedVariableName + \") * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n if (hasNormals) {\r\n injectionCode += \"#ifdef MORPHTARGETS_NORMAL\\r\\n\";\r\n injectionCode += normalOutput.associatedVariableName + \" += (normal\" + index + \" - \" + normal.associatedVariableName + \") * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n if (hasTangents) {\r\n injectionCode += \"#ifdef MORPHTARGETS_TANGENT\\r\\n\";\r\n injectionCode += tangentOutput.associatedVariableName + \".xyz += (tangent\" + index + \" - \" + tangent.associatedVariableName + \".xyz) * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n if (hasUVs) {\r\n injectionCode += \"#ifdef MORPHTARGETS_UV\\r\\n\";\r\n injectionCode += uvOutput.associatedVariableName + \".xyz += (uv_\" + index + \" - \" + uv.associatedVariableName + \".xyz) * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n state.compilationString = state.compilationString.replace(this._repeatableContentAnchor, injectionCode);\r\n if (repeatCount > 0) {\r\n for (var index = 0; index < repeatCount; index++) {\r\n state.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind + index);\r\n if (hasNormals) {\r\n state.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind + index);\r\n }\r\n if (hasTangents) {\r\n state.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].TangentKind + index);\r\n }\r\n }\r\n }\r\n };\r\n MorphTargetsBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Register for binding\r\n state.sharedData.bindableBlocks.push(this);\r\n // Register for repeatable content generation\r\n state.sharedData.repeatableContentBlocks.push(this);\r\n // Emit code\r\n var position = this.position;\r\n var normal = this.normal;\r\n var tangent = this.tangent;\r\n var uv = this.uv;\r\n var positionOutput = this.positionOutput;\r\n var normalOutput = this.normalOutput;\r\n var tangentOutput = this.tangentOutput;\r\n var uvOutput = this.uvOutput;\r\n var comments = \"//\" + this.name;\r\n state.uniforms.push(\"morphTargetInfluences\");\r\n state._emitFunctionFromInclude(\"morphTargetsVertexGlobalDeclaration\", comments);\r\n state._emitFunctionFromInclude(\"morphTargetsVertexDeclaration\", comments, {\r\n repeatKey: \"maxSimultaneousMorphTargets\"\r\n });\r\n state.compilationString += this._declareOutput(positionOutput, state) + \" = \" + position.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#ifdef NORMAL\\r\\n\";\r\n state.compilationString += this._declareOutput(normalOutput, state) + \" = \" + normal.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef TANGENT\\r\\n\";\r\n state.compilationString += this._declareOutput(tangentOutput, state) + \" = \" + tangent.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef UV1\\r\\n\";\r\n state.compilationString += this._declareOutput(uvOutput, state) + \" = \" + uv.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n // Repeatable content\r\n this._repeatableContentAnchor = state._repeatableContentAnchor;\r\n state.compilationString += this._repeatableContentAnchor;\r\n return this;\r\n };\r\n return MorphTargetsBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MorphTargetsBlock\"] = MorphTargetsBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts\":\n/*!***********************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts ***!\n \\***********************************************************/\n/*! exports provided: VertexOutputBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return VertexOutputBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to output the vertex position\r\n */\r\nvar VertexOutputBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VertexOutputBlock, _super);\r\n /**\r\n * Creates a new VertexOutputBlock\r\n * @param name defines the block name\r\n */\r\n function VertexOutputBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex, true) || this;\r\n _this.registerInput(\"vector\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n VertexOutputBlock.prototype.getClassName = function () {\r\n return \"VertexOutputBlock\";\r\n };\r\n Object.defineProperty(VertexOutputBlock.prototype, \"vector\", {\r\n /**\r\n * Gets the vector input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VertexOutputBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var input = this.vector;\r\n state.compilationString += \"gl_Position = \" + input.associatedVariableName + \";\\r\\n\";\r\n return this;\r\n };\r\n return VertexOutputBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.VertexOutputBlock\"] = VertexOutputBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/addBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/addBlock.ts ***!\n \\*******************************************/\n/*! exports provided: AddBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return AddBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add 2 vectors\r\n */\r\nvar AddBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AddBlock, _super);\r\n /**\r\n * Creates a new AddBlock\r\n * @param name defines the block name\r\n */\r\n function AddBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n AddBlock.prototype.getClassName = function () {\r\n return \"AddBlock\";\r\n };\r\n Object.defineProperty(AddBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AddBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AddBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n AddBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" + \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return AddBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.AddBlock\"] = AddBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/clampBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/clampBlock.ts ***!\n \\*********************************************/\n/*! exports provided: ClampBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return ClampBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to clamp a float\r\n */\r\nvar ClampBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ClampBlock, _super);\r\n /**\r\n * Creates a new ClampBlock\r\n * @param name defines the block name\r\n */\r\n function ClampBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n /** Gets or sets the minimum range */\r\n _this.minimum = 0.0;\r\n /** Gets or sets the maximum range */\r\n _this.maximum = 1.0;\r\n _this.registerInput(\"value\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ClampBlock.prototype.getClassName = function () {\r\n return \"ClampBlock\";\r\n };\r\n Object.defineProperty(ClampBlock.prototype, \"value\", {\r\n /**\r\n * Gets the value input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClampBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ClampBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = clamp(\" + this.value.associatedVariableName + \", \" + this._writeFloat(this.minimum) + \", \" + this._writeFloat(this.maximum) + \");\\r\\n\");\r\n return this;\r\n };\r\n ClampBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".minimum = \" + this.minimum + \";\\r\\n\";\r\n codeString += this._codeVariableName + \".maximum = \" + this.maximum + \";\\r\\n\";\r\n return codeString;\r\n };\r\n ClampBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.minimum = this.minimum;\r\n serializationObject.maximum = this.maximum;\r\n return serializationObject;\r\n };\r\n ClampBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.minimum = serializationObject.minimum;\r\n this.maximum = serializationObject.maximum;\r\n };\r\n return ClampBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ClampBlock\"] = ClampBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/colorMergerBlock.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Node/Blocks/colorMergerBlock.ts ***!\n \\***************************************************/\n/*! exports provided: ColorMergerBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return ColorMergerBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to create a Color3/4 out of individual inputs (one for each component)\r\n */\r\nvar ColorMergerBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorMergerBlock, _super);\r\n /**\r\n * Create a new ColorMergerBlock\r\n * @param name defines the block name\r\n */\r\n function ColorMergerBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerOutput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ColorMergerBlock.prototype.getClassName = function () {\r\n return \"ColorMergerBlock\";\r\n };\r\n Object.defineProperty(ColorMergerBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b component (input)\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a component (input)\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ColorMergerBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var rInput = this.r;\r\n var gInput = this.g;\r\n var bInput = this.b;\r\n var aInput = this.a;\r\n var color4Output = this._outputs[0];\r\n var color3Output = this._outputs[1];\r\n if (color4Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(color4Output, state) + (\" = vec4(\" + (rInput.isConnected ? this._writeVariable(rInput) : \"0.0\") + \", \" + (gInput.isConnected ? this._writeVariable(gInput) : \"0.0\") + \", \" + (bInput.isConnected ? this._writeVariable(bInput) : \"0.0\") + \", \" + (aInput.isConnected ? this._writeVariable(aInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n else if (color3Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(color3Output, state) + (\" = vec3(\" + (rInput.isConnected ? this._writeVariable(rInput) : \"0.0\") + \", \" + (gInput.isConnected ? this._writeVariable(gInput) : \"0.0\") + \", \" + (bInput.isConnected ? this._writeVariable(bInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return ColorMergerBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ColorMergerBlock\"] = ColorMergerBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/colorSplitterBlock.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/Node/Blocks/colorSplitterBlock.ts ***!\n \\*****************************************************/\n/*! exports provided: ColorSplitterBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return ColorSplitterBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to expand a Color3/4 into 4 outputs (one for each component)\r\n */\r\nvar ColorSplitterBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorSplitterBlock, _super);\r\n /**\r\n * Create a new ColorSplitterBlock\r\n * @param name defines the block name\r\n */\r\n function ColorSplitterBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, true);\r\n _this.registerInput(\"rgb \", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, true);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n _this.registerOutput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ColorSplitterBlock.prototype.getClassName = function () {\r\n return \"ColorSplitterBlock\";\r\n };\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"rgbIn\", {\r\n /**\r\n * Gets the rgb component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"rgbOut\", {\r\n /**\r\n * Gets the rgb component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g component (output)\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b component (output)\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a component (output)\r\n */\r\n get: function () {\r\n return this._outputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ColorSplitterBlock.prototype._inputRename = function (name) {\r\n if (name === \"rgb \") {\r\n return \"rgbIn\";\r\n }\r\n return name;\r\n };\r\n ColorSplitterBlock.prototype._outputRename = function (name) {\r\n if (name === \"rgb\") {\r\n return \"rgbOut\";\r\n }\r\n return name;\r\n };\r\n ColorSplitterBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var input = this.rgba.isConnected ? this.rgba : this.rgbIn;\r\n if (!input.isConnected) {\r\n return;\r\n }\r\n var rgbOutput = this._outputs[0];\r\n var rOutput = this._outputs[1];\r\n var gOutput = this._outputs[2];\r\n var bOutput = this._outputs[3];\r\n var aOutput = this._outputs[4];\r\n if (rgbOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(rgbOutput, state) + (\" = \" + input.associatedVariableName + \".rgb;\\r\\n\");\r\n }\r\n if (rOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(rOutput, state) + (\" = \" + input.associatedVariableName + \".r;\\r\\n\");\r\n }\r\n if (gOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(gOutput, state) + (\" = \" + input.associatedVariableName + \".g;\\r\\n\");\r\n }\r\n if (bOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(bOutput, state) + (\" = \" + input.associatedVariableName + \".b;\\r\\n\");\r\n }\r\n if (aOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(aOutput, state) + (\" = \" + input.associatedVariableName + \".a;\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return ColorSplitterBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ColorSplitterBlock\"] = ColorSplitterBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/crossBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/crossBlock.ts ***!\n \\*********************************************/\n/*! exports provided: CrossBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return CrossBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to apply a cross product between 2 vectors\r\n */\r\nvar CrossBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CrossBlock, _super);\r\n /**\r\n * Creates a new CrossBlock\r\n * @param name defines the block name\r\n */\r\n function CrossBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n CrossBlock.prototype.getClassName = function () {\r\n return \"CrossBlock\";\r\n };\r\n Object.defineProperty(CrossBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CrossBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CrossBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n CrossBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = cross(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return CrossBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.CrossBlock\"] = CrossBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/divideBlock.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Node/Blocks/divideBlock.ts ***!\n \\**********************************************/\n/*! exports provided: DivideBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return DivideBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to divide 2 vectors\r\n */\r\nvar DivideBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DivideBlock, _super);\r\n /**\r\n * Creates a new DivideBlock\r\n * @param name defines the block name\r\n */\r\n function DivideBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n DivideBlock.prototype.getClassName = function () {\r\n return \"DivideBlock\";\r\n };\r\n Object.defineProperty(DivideBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DivideBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DivideBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DivideBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" / \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return DivideBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DivideBlock\"] = DivideBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/dotBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/dotBlock.ts ***!\n \\*******************************************/\n/*! exports provided: DotBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return DotBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to apply a dot product between 2 vectors\r\n */\r\nvar DotBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DotBlock, _super);\r\n /**\r\n * Creates a new DotBlock\r\n * @param name defines the block name\r\n */\r\n function DotBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n DotBlock.prototype.getClassName = function () {\r\n return \"DotBlock\";\r\n };\r\n Object.defineProperty(DotBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DotBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DotBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DotBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = dot(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return DotBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DotBlock\"] = DotBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/fresnelBlock.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/Node/Blocks/fresnelBlock.ts ***!\n \\***********************************************/\n/*! exports provided: FresnelBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return FresnelBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to compute fresnel value\r\n */\r\nvar FresnelBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FresnelBlock, _super);\r\n /**\r\n * Create a new FresnelBlock\r\n * @param name defines the block name\r\n */\r\n function FresnelBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"viewDirection\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"bias\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"power\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"fresnel\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n FresnelBlock.prototype.getClassName = function () {\r\n return \"FresnelBlock\";\r\n };\r\n Object.defineProperty(FresnelBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"viewDirection\", {\r\n /**\r\n * Gets the view direction input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"bias\", {\r\n /**\r\n * Gets the bias input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"power\", {\r\n /**\r\n * Gets the camera (or eye) position component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"fresnel\", {\r\n /**\r\n * Gets the fresnel output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n FresnelBlock.prototype.autoConfigure = function (material) {\r\n if (!this.bias.isConnected) {\r\n var biasInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"bias\");\r\n biasInput.value = 0;\r\n biasInput.output.connectTo(this.bias);\r\n }\r\n if (!this.power.isConnected) {\r\n var powerInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"power\");\r\n powerInput.value = 1;\r\n powerInput.output.connectTo(this.power);\r\n }\r\n };\r\n FresnelBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var comments = \"//\" + this.name;\r\n state._emitFunctionFromInclude(\"fresnelFunction\", comments, { removeIfDef: true });\r\n state.compilationString += this._declareOutput(this.fresnel, state) + (\" = computeFresnelTerm(\" + this.viewDirection.associatedVariableName + \", \" + this.worldNormal.associatedVariableName + \", \" + this.bias.associatedVariableName + \", \" + this.power.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return FresnelBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.FresnelBlock\"] = FresnelBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/index.ts\":\n/*!****************************************!*\\\n !*** ./Materials/Node/Blocks/index.ts ***!\n \\****************************************/\n/*! exports provided: MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Vertex_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Vertex/index */ \"./Materials/Node/Blocks/Vertex/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"LightInformationBlock\"]; });\n\n/* harmony import */ var _Fragment_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Fragment/index */ \"./Materials/Node/Blocks/Fragment/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"PerturbNormalBlock\"]; });\n\n/* harmony import */ var _Dual_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Dual/index */ \"./Materials/Node/Blocks/Dual/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"ReflectionTextureBlock\"]; });\n\n/* harmony import */ var _Input_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Input/index */ \"./Materials/Node/Blocks/Input/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Input_index__WEBPACK_IMPORTED_MODULE_3__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Input_index__WEBPACK_IMPORTED_MODULE_3__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _multiplyBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./multiplyBlock */ \"./Materials/Node/Blocks/multiplyBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _multiplyBlock__WEBPACK_IMPORTED_MODULE_4__[\"MultiplyBlock\"]; });\n\n/* harmony import */ var _addBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./addBlock */ \"./Materials/Node/Blocks/addBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _addBlock__WEBPACK_IMPORTED_MODULE_5__[\"AddBlock\"]; });\n\n/* harmony import */ var _scaleBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./scaleBlock */ \"./Materials/Node/Blocks/scaleBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _scaleBlock__WEBPACK_IMPORTED_MODULE_6__[\"ScaleBlock\"]; });\n\n/* harmony import */ var _clampBlock__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./clampBlock */ \"./Materials/Node/Blocks/clampBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _clampBlock__WEBPACK_IMPORTED_MODULE_7__[\"ClampBlock\"]; });\n\n/* harmony import */ var _crossBlock__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./crossBlock */ \"./Materials/Node/Blocks/crossBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _crossBlock__WEBPACK_IMPORTED_MODULE_8__[\"CrossBlock\"]; });\n\n/* harmony import */ var _dotBlock__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./dotBlock */ \"./Materials/Node/Blocks/dotBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _dotBlock__WEBPACK_IMPORTED_MODULE_9__[\"DotBlock\"]; });\n\n/* harmony import */ var _transformBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./transformBlock */ \"./Materials/Node/Blocks/transformBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _transformBlock__WEBPACK_IMPORTED_MODULE_10__[\"TransformBlock\"]; });\n\n/* harmony import */ var _remapBlock__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./remapBlock */ \"./Materials/Node/Blocks/remapBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _remapBlock__WEBPACK_IMPORTED_MODULE_11__[\"RemapBlock\"]; });\n\n/* harmony import */ var _normalizeBlock__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./normalizeBlock */ \"./Materials/Node/Blocks/normalizeBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _normalizeBlock__WEBPACK_IMPORTED_MODULE_12__[\"NormalizeBlock\"]; });\n\n/* harmony import */ var _trigonometryBlock__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./trigonometryBlock */ \"./Materials/Node/Blocks/trigonometryBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _trigonometryBlock__WEBPACK_IMPORTED_MODULE_13__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _trigonometryBlock__WEBPACK_IMPORTED_MODULE_13__[\"TrigonometryBlock\"]; });\n\n/* harmony import */ var _colorMergerBlock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./colorMergerBlock */ \"./Materials/Node/Blocks/colorMergerBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _colorMergerBlock__WEBPACK_IMPORTED_MODULE_14__[\"ColorMergerBlock\"]; });\n\n/* harmony import */ var _vectorMergerBlock__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./vectorMergerBlock */ \"./Materials/Node/Blocks/vectorMergerBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _vectorMergerBlock__WEBPACK_IMPORTED_MODULE_15__[\"VectorMergerBlock\"]; });\n\n/* harmony import */ var _colorSplitterBlock__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./colorSplitterBlock */ \"./Materials/Node/Blocks/colorSplitterBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _colorSplitterBlock__WEBPACK_IMPORTED_MODULE_16__[\"ColorSplitterBlock\"]; });\n\n/* harmony import */ var _vectorSplitterBlock__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./vectorSplitterBlock */ \"./Materials/Node/Blocks/vectorSplitterBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _vectorSplitterBlock__WEBPACK_IMPORTED_MODULE_17__[\"VectorSplitterBlock\"]; });\n\n/* harmony import */ var _lerpBlock__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./lerpBlock */ \"./Materials/Node/Blocks/lerpBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _lerpBlock__WEBPACK_IMPORTED_MODULE_18__[\"LerpBlock\"]; });\n\n/* harmony import */ var _divideBlock__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./divideBlock */ \"./Materials/Node/Blocks/divideBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _divideBlock__WEBPACK_IMPORTED_MODULE_19__[\"DivideBlock\"]; });\n\n/* harmony import */ var _subtractBlock__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./subtractBlock */ \"./Materials/Node/Blocks/subtractBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _subtractBlock__WEBPACK_IMPORTED_MODULE_20__[\"SubtractBlock\"]; });\n\n/* harmony import */ var _stepBlock__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./stepBlock */ \"./Materials/Node/Blocks/stepBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _stepBlock__WEBPACK_IMPORTED_MODULE_21__[\"StepBlock\"]; });\n\n/* harmony import */ var _oppositeBlock__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./oppositeBlock */ \"./Materials/Node/Blocks/oppositeBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _oppositeBlock__WEBPACK_IMPORTED_MODULE_22__[\"OppositeBlock\"]; });\n\n/* harmony import */ var _viewDirectionBlock__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./viewDirectionBlock */ \"./Materials/Node/Blocks/viewDirectionBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _viewDirectionBlock__WEBPACK_IMPORTED_MODULE_23__[\"ViewDirectionBlock\"]; });\n\n/* harmony import */ var _fresnelBlock__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./fresnelBlock */ \"./Materials/Node/Blocks/fresnelBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _fresnelBlock__WEBPACK_IMPORTED_MODULE_24__[\"FresnelBlock\"]; });\n\n/* harmony import */ var _maxBlock__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./maxBlock */ \"./Materials/Node/Blocks/maxBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _maxBlock__WEBPACK_IMPORTED_MODULE_25__[\"MaxBlock\"]; });\n\n/* harmony import */ var _minBlock__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./minBlock */ \"./Materials/Node/Blocks/minBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _minBlock__WEBPACK_IMPORTED_MODULE_26__[\"MinBlock\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/lerpBlock.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Node/Blocks/lerpBlock.ts ***!\n \\********************************************/\n/*! exports provided: LerpBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return LerpBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to lerp 2 values\r\n */\r\nvar LerpBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LerpBlock, _super);\r\n /**\r\n * Creates a new LerpBlock\r\n * @param name defines the block name\r\n */\r\n function LerpBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"gradient\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n LerpBlock.prototype.getClassName = function () {\r\n return \"LerpBlock\";\r\n };\r\n Object.defineProperty(LerpBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LerpBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LerpBlock.prototype, \"gradient\", {\r\n /**\r\n * Gets the gradient operand input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LerpBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n LerpBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = mix(\" + this.left.associatedVariableName + \" , \" + this.right.associatedVariableName + \", \" + this.gradient.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return LerpBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.LerpBlock\"] = LerpBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/maxBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/maxBlock.ts ***!\n \\*******************************************/\n/*! exports provided: MaxBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return MaxBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the max of 2 values\r\n */\r\nvar MaxBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MaxBlock, _super);\r\n /**\r\n * Creates a new MaxBlock\r\n * @param name defines the block name\r\n */\r\n function MaxBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MaxBlock.prototype.getClassName = function () {\r\n return \"MaxBlock\";\r\n };\r\n Object.defineProperty(MaxBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaxBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaxBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MaxBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = max(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return MaxBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MaxBlock\"] = MaxBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/minBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/minBlock.ts ***!\n \\*******************************************/\n/*! exports provided: MinBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return MinBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the min of 2 values\r\n */\r\nvar MinBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MinBlock, _super);\r\n /**\r\n * Creates a new MinBlock\r\n * @param name defines the block name\r\n */\r\n function MinBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MinBlock.prototype.getClassName = function () {\r\n return \"MinBlock\";\r\n };\r\n Object.defineProperty(MinBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MinBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MinBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MinBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = min(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return MinBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MinBlock\"] = MinBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/multiplyBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/multiplyBlock.ts ***!\n \\************************************************/\n/*! exports provided: MultiplyBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return MultiplyBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to multiply 2 values\r\n */\r\nvar MultiplyBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiplyBlock, _super);\r\n /**\r\n * Creates a new MultiplyBlock\r\n * @param name defines the block name\r\n */\r\n function MultiplyBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MultiplyBlock.prototype.getClassName = function () {\r\n return \"MultiplyBlock\";\r\n };\r\n Object.defineProperty(MultiplyBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiplyBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiplyBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MultiplyBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" * \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return MultiplyBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MultiplyBlock\"] = MultiplyBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/normalizeBlock.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Node/Blocks/normalizeBlock.ts ***!\n \\*************************************************/\n/*! exports provided: NormalizeBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return NormalizeBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to normalize a vector\r\n */\r\nvar NormalizeBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NormalizeBlock, _super);\r\n /**\r\n * Creates a new NormalizeBlock\r\n * @param name defines the block name\r\n */\r\n function NormalizeBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n NormalizeBlock.prototype.getClassName = function () {\r\n return \"NormalizeBlock\";\r\n };\r\n Object.defineProperty(NormalizeBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NormalizeBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n NormalizeBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n var input = this._inputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = normalize(\" + input.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return NormalizeBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.NormalizeBlock\"] = NormalizeBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/oppositeBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/oppositeBlock.ts ***!\n \\************************************************/\n/*! exports provided: OppositeBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return OppositeBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the opposite of a value\r\n */\r\nvar OppositeBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](OppositeBlock, _super);\r\n /**\r\n * Creates a new OppositeBlock\r\n * @param name defines the block name\r\n */\r\n function OppositeBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n OppositeBlock.prototype.getClassName = function () {\r\n return \"OppositeBlock\";\r\n };\r\n Object.defineProperty(OppositeBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OppositeBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n OppositeBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = 1. - \" + this.input.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return OppositeBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.OppositeBlock\"] = OppositeBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/remapBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/remapBlock.ts ***!\n \\*********************************************/\n/*! exports provided: RemapBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return RemapBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to remap a float from a range to a new one\r\n */\r\nvar RemapBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RemapBlock, _super);\r\n /**\r\n * Creates a new RemapBlock\r\n * @param name defines the block name\r\n */\r\n function RemapBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n /**\r\n * Gets or sets the source range\r\n */\r\n _this.sourceRange = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](-1, 1);\r\n /**\r\n * Gets or sets the target range\r\n */\r\n _this.targetRange = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](0, 1);\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n RemapBlock.prototype.getClassName = function () {\r\n return \"RemapBlock\";\r\n };\r\n Object.defineProperty(RemapBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RemapBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RemapBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this._writeFloat(this.targetRange.x) + \" + (\" + this._inputs[0].associatedVariableName + \" - \" + this._writeFloat(this.sourceRange.x) + \") * (\" + this._writeFloat(this.targetRange.y) + \" - \" + this._writeFloat(this.targetRange.x) + \") / (\" + this._writeFloat(this.sourceRange.y) + \" - \" + this._writeFloat(this.sourceRange.x) + \");\\r\\n\");\r\n return this;\r\n };\r\n RemapBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".sourceRange = new BABYLON.Vector2(\" + this.sourceRange.x + \", \" + this.sourceRange.y + \");\\r\\n\";\r\n codeString += this._codeVariableName + \".targetRange = new BABYLON.Vector2(\" + this.targetRange.x + \", \" + this.targetRange.y + \");\\r\\n\";\r\n return codeString;\r\n };\r\n RemapBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.sourceRange = this.sourceRange.asArray();\r\n serializationObject.targetRange = this.targetRange.asArray();\r\n return serializationObject;\r\n };\r\n RemapBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.sourceRange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].FromArray(serializationObject.sourceRange);\r\n this.targetRange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].FromArray(serializationObject.targetRange);\r\n };\r\n return RemapBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.RemapBlock\"] = RemapBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/scaleBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/scaleBlock.ts ***!\n \\*********************************************/\n/*! exports provided: ScaleBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return ScaleBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to scale a vector by a float\r\n */\r\nvar ScaleBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ScaleBlock, _super);\r\n /**\r\n * Creates a new ScaleBlock\r\n * @param name defines the block name\r\n */\r\n function ScaleBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"factor\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ScaleBlock.prototype.getClassName = function () {\r\n return \"ScaleBlock\";\r\n };\r\n Object.defineProperty(ScaleBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleBlock.prototype, \"factor\", {\r\n /**\r\n * Gets the factor input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ScaleBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.input.associatedVariableName + \" * \" + this.factor.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return ScaleBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ScaleBlock\"] = ScaleBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/stepBlock.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Node/Blocks/stepBlock.ts ***!\n \\********************************************/\n/*! exports provided: StepBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return StepBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to step a value\r\n */\r\nvar StepBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StepBlock, _super);\r\n /**\r\n * Creates a new AddBlock\r\n * @param name defines the block name\r\n */\r\n function StepBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"value\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"edge\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n StepBlock.prototype.getClassName = function () {\r\n return \"StepBlock\";\r\n };\r\n Object.defineProperty(StepBlock.prototype, \"value\", {\r\n /**\r\n * Gets the value operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StepBlock.prototype, \"edge\", {\r\n /**\r\n * Gets the edge operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StepBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n StepBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = step(\" + this.edge.associatedVariableName + \", \" + this.value.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return StepBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StepBlock\"] = StepBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/subtractBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/subtractBlock.ts ***!\n \\************************************************/\n/*! exports provided: SubtractBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return SubtractBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to subtract 2 vectors\r\n */\r\nvar SubtractBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SubtractBlock, _super);\r\n /**\r\n * Creates a new SubtractBlock\r\n * @param name defines the block name\r\n */\r\n function SubtractBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n SubtractBlock.prototype.getClassName = function () {\r\n return \"SubtractBlock\";\r\n };\r\n Object.defineProperty(SubtractBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SubtractBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SubtractBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SubtractBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" - \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return SubtractBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SubtractBlock\"] = SubtractBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/transformBlock.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Node/Blocks/transformBlock.ts ***!\n \\*************************************************/\n/*! exports provided: TransformBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return TransformBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to transform a vector (2, 3 or 4) with a matrix. It will generate a Vector4\r\n */\r\nvar TransformBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TransformBlock, _super);\r\n /**\r\n * Creates a new TransformBlock\r\n * @param name defines the block name\r\n */\r\n function TransformBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n /**\r\n * Defines the value to use to complement W value to transform it to a Vector4\r\n */\r\n _this.complementW = 1;\r\n /**\r\n * Defines the value to use to complement z value to transform it to a Vector4\r\n */\r\n _this.complementZ = 0;\r\n _this.registerInput(\"vector\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"transform\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n TransformBlock.prototype.getClassName = function () {\r\n return \"TransformBlock\";\r\n };\r\n Object.defineProperty(TransformBlock.prototype, \"vector\", {\r\n /**\r\n * Gets the vector input\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformBlock.prototype, \"transform\", {\r\n /**\r\n * Gets the matrix transform input\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TransformBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n var vector = this.vector;\r\n var transform = this.transform;\r\n if (vector.connectedPoint) {\r\n switch (vector.connectedPoint.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + transform.associatedVariableName + \" * vec4(\" + vector.associatedVariableName + \", \" + this._writeFloat(this.complementZ) + \", \" + this._writeFloat(this.complementW) + \");\\r\\n\");\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + transform.associatedVariableName + \" * vec4(\" + vector.associatedVariableName + \", \" + this._writeFloat(this.complementW) + \");\\r\\n\");\r\n break;\r\n default:\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + transform.associatedVariableName + \" * \" + vector.associatedVariableName + \";\\r\\n\");\r\n break;\r\n }\r\n }\r\n return this;\r\n };\r\n TransformBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.complementZ = this.complementZ;\r\n serializationObject.complementW = this.complementW;\r\n return serializationObject;\r\n };\r\n TransformBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.complementZ = serializationObject.complementZ !== undefined ? serializationObject.complementZ : 0.0;\r\n this.complementW = serializationObject.complementW !== undefined ? serializationObject.complementW : 1.0;\r\n };\r\n TransformBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".complementZ = \" + this.complementZ + \";\\r\\n\";\r\n codeString += this._codeVariableName + \".complementW = \" + this.complementW + \";\\r\\n\";\r\n return codeString;\r\n };\r\n return TransformBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.TransformBlock\"] = TransformBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/trigonometryBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/trigonometryBlock.ts ***!\n \\****************************************************/\n/*! exports provided: TrigonometryBlockOperations, TrigonometryBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return TrigonometryBlockOperations; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return TrigonometryBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nvar TrigonometryBlockOperations;\r\n(function (TrigonometryBlockOperations) {\r\n /** Cos */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Cos\"] = 0] = \"Cos\";\r\n /** Sin */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Sin\"] = 1] = \"Sin\";\r\n /** Abs */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Abs\"] = 2] = \"Abs\";\r\n /** Exp */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Exp\"] = 3] = \"Exp\";\r\n /** Exp2 */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Exp2\"] = 4] = \"Exp2\";\r\n /** Round */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Round\"] = 5] = \"Round\";\r\n /** Floor */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Floor\"] = 6] = \"Floor\";\r\n /** Ceiling */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Ceiling\"] = 7] = \"Ceiling\";\r\n})(TrigonometryBlockOperations || (TrigonometryBlockOperations = {}));\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nvar TrigonometryBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TrigonometryBlock, _super);\r\n /**\r\n * Creates a new TrigonometryBlock\r\n * @param name defines the block name\r\n */\r\n function TrigonometryBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n _this.operation = TrigonometryBlockOperations.Cos;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n TrigonometryBlock.prototype.getClassName = function () {\r\n return \"TrigonometryBlock\";\r\n };\r\n Object.defineProperty(TrigonometryBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TrigonometryBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TrigonometryBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n var operation = \"\";\r\n switch (this.operation) {\r\n case TrigonometryBlockOperations.Cos: {\r\n operation = \"cos\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Sin: {\r\n operation = \"sin\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Abs: {\r\n operation = \"abs\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Exp: {\r\n operation = \"exp\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Exp2: {\r\n operation = \"exp2\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Round: {\r\n operation = \"round\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Floor: {\r\n operation = \"floor\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Ceiling: {\r\n operation = \"ceil\";\r\n break;\r\n }\r\n }\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + operation + \"(\" + this.input.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n TrigonometryBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.operation = this.operation;\r\n return serializationObject;\r\n };\r\n TrigonometryBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.operation = serializationObject.operation;\r\n };\r\n return TrigonometryBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.TrigonometryBlock\"] = TrigonometryBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/vectorMergerBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/vectorMergerBlock.ts ***!\n \\****************************************************/\n/*! exports provided: VectorMergerBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return VectorMergerBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to create a Vector2/3/4 out of individual inputs (one for each component)\r\n */\r\nvar VectorMergerBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VectorMergerBlock, _super);\r\n /**\r\n * Create a new VectorMergerBlock\r\n * @param name defines the block name\r\n */\r\n function VectorMergerBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"x\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"y\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"z\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"w\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerOutput(\"xyzw\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerOutput(\"xyz\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"xy\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n VectorMergerBlock.prototype.getClassName = function () {\r\n return \"VectorMergerBlock\";\r\n };\r\n Object.defineProperty(VectorMergerBlock.prototype, \"x\", {\r\n /**\r\n * Gets the x component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"y\", {\r\n /**\r\n * Gets the y component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"z\", {\r\n /**\r\n * Gets the z component (input)\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"w\", {\r\n /**\r\n * Gets the w component (input)\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"xyzw\", {\r\n /**\r\n * Gets the xyzw component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"xyz\", {\r\n /**\r\n * Gets the xyz component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"xy\", {\r\n /**\r\n * Gets the xy component (output)\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VectorMergerBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var xInput = this.x;\r\n var yInput = this.y;\r\n var zInput = this.z;\r\n var wInput = this.w;\r\n var v4Output = this._outputs[0];\r\n var v3Output = this._outputs[1];\r\n var v2Output = this._outputs[2];\r\n if (v4Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(v4Output, state) + (\" = vec4(\" + this._writeVariable(xInput) + \", \" + this._writeVariable(yInput) + \", \" + (zInput.isConnected ? this._writeVariable(zInput) : \"0.0\") + \", \" + (zInput.isConnected ? this._writeVariable(wInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n else if (v3Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(v3Output, state) + (\" = vec3(\" + this._writeVariable(xInput) + \", \" + this._writeVariable(yInput) + \", \" + (zInput.isConnected ? this._writeVariable(zInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n else if (v2Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(v2Output, state) + (\" = vec2(\" + this._writeVariable(xInput) + \", \" + this._writeVariable(yInput) + \");\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return VectorMergerBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.VectorMergerBlock\"] = VectorMergerBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/vectorSplitterBlock.ts\":\n/*!******************************************************!*\\\n !*** ./Materials/Node/Blocks/vectorSplitterBlock.ts ***!\n \\******************************************************/\n/*! exports provided: VectorSplitterBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return VectorSplitterBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to expand a Vector3/4 into 4 outputs (one for each component)\r\n */\r\nvar VectorSplitterBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VectorSplitterBlock, _super);\r\n /**\r\n * Create a new VectorSplitterBlock\r\n * @param name defines the block name\r\n */\r\n function VectorSplitterBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"xyzw\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, true);\r\n _this.registerInput(\"xyz \", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, true);\r\n _this.registerInput(\"xy \", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2, true);\r\n _this.registerOutput(\"xyz\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"xy\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n _this.registerOutput(\"x\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"y\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"z\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"w\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n VectorSplitterBlock.prototype.getClassName = function () {\r\n return \"VectorSplitterBlock\";\r\n };\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyzw\", {\r\n /**\r\n * Gets the xyzw component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyzIn\", {\r\n /**\r\n * Gets the xyz component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyIn\", {\r\n /**\r\n * Gets the xy component (input)\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyzOut\", {\r\n /**\r\n * Gets the xyz component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyOut\", {\r\n /**\r\n * Gets the xy component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"x\", {\r\n /**\r\n * Gets the x component (output)\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"y\", {\r\n /**\r\n * Gets the y component (output)\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"z\", {\r\n /**\r\n * Gets the z component (output)\r\n */\r\n get: function () {\r\n return this._outputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"w\", {\r\n /**\r\n * Gets the w component (output)\r\n */\r\n get: function () {\r\n return this._outputs[5];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VectorSplitterBlock.prototype._inputRename = function (name) {\r\n switch (name) {\r\n case \"xy \":\r\n return \"xyIn\";\r\n case \"xyz \":\r\n return \"xyzIn\";\r\n default:\r\n return name;\r\n }\r\n };\r\n VectorSplitterBlock.prototype._outputRename = function (name) {\r\n switch (name) {\r\n case \"xy\":\r\n return \"xyOut\";\r\n case \"xyz\":\r\n return \"xyzOut\";\r\n default:\r\n return name;\r\n }\r\n };\r\n VectorSplitterBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var input = this.xyzw.isConnected ? this.xyzw : this.xyzIn.isConnected ? this.xyzIn : this.xyIn;\r\n var xyzOutput = this._outputs[0];\r\n var xyOutput = this._outputs[1];\r\n var xOutput = this._outputs[2];\r\n var yOutput = this._outputs[3];\r\n var zOutput = this._outputs[4];\r\n var wOutput = this._outputs[5];\r\n if (xyzOutput.hasEndpoints) {\r\n if (input === this.xyIn) {\r\n state.compilationString += this._declareOutput(xyzOutput, state) + (\" = vec3(\" + input.associatedVariableName + \", 0.0);\\r\\n\");\r\n }\r\n else {\r\n state.compilationString += this._declareOutput(xyzOutput, state) + (\" = \" + input.associatedVariableName + \".xyz;\\r\\n\");\r\n }\r\n }\r\n if (xyOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(xyOutput, state) + (\" = \" + input.associatedVariableName + \".xy;\\r\\n\");\r\n }\r\n if (xOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(xOutput, state) + (\" = \" + input.associatedVariableName + \".x;\\r\\n\");\r\n }\r\n if (yOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(yOutput, state) + (\" = \" + input.associatedVariableName + \".y;\\r\\n\");\r\n }\r\n if (zOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(zOutput, state) + (\" = \" + input.associatedVariableName + \".z;\\r\\n\");\r\n }\r\n if (wOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(wOutput, state) + (\" = \" + input.associatedVariableName + \".w;\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return VectorSplitterBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.VectorSplitterBlock\"] = VectorSplitterBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/viewDirectionBlock.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/Node/Blocks/viewDirectionBlock.ts ***!\n \\*****************************************************/\n/*! exports provided: ViewDirectionBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return ViewDirectionBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the view direction\r\n */\r\nvar ViewDirectionBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ViewDirectionBlock, _super);\r\n /**\r\n * Creates a new ViewDirectionBlock\r\n * @param name defines the block name\r\n */\r\n function ViewDirectionBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"cameraPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ViewDirectionBlock.prototype.getClassName = function () {\r\n return \"ViewDirectionBlock\";\r\n };\r\n Object.defineProperty(ViewDirectionBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViewDirectionBlock.prototype, \"cameraPosition\", {\r\n /**\r\n * Gets the camera position component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViewDirectionBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ViewDirectionBlock.prototype.autoConfigure = function (material) {\r\n if (!this.cameraPosition.isConnected) {\r\n var cameraPositionInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition; });\r\n if (!cameraPositionInput) {\r\n cameraPositionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"cameraPosition\");\r\n cameraPositionInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition);\r\n }\r\n cameraPositionInput.output.connectTo(this.cameraPosition);\r\n }\r\n };\r\n ViewDirectionBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = normalize(\" + this.cameraPosition.associatedVariableName + \" - \" + this.worldPosition.associatedVariableName + \".xyz);\\r\\n\");\r\n return this;\r\n };\r\n return ViewDirectionBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ViewDirectionBlock\"] = ViewDirectionBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/NodeMaterialBlockConnectionPointMode.ts\":\n/*!****************************************************************!*\\\n !*** ./Materials/Node/NodeMaterialBlockConnectionPointMode.ts ***!\n \\****************************************************************/\n/*! exports provided: NodeMaterialBlockConnectionPointMode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointMode\", function() { return NodeMaterialBlockConnectionPointMode; });\n/**\r\n * Enum defining the mode of a NodeMaterialBlockConnectionPoint\r\n */\r\nvar NodeMaterialBlockConnectionPointMode;\r\n(function (NodeMaterialBlockConnectionPointMode) {\r\n /** Value is an uniform */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Uniform\"] = 0] = \"Uniform\";\r\n /** Value is a mesh attribute */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Attribute\"] = 1] = \"Attribute\";\r\n /** Value is a varying between vertex and fragment shaders */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Varying\"] = 2] = \"Varying\";\r\n /** Mode is undefined */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Undefined\"] = 3] = \"Undefined\";\r\n})(NodeMaterialBlockConnectionPointMode || (NodeMaterialBlockConnectionPointMode = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Optimizers/index.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Node/Optimizers/index.ts ***!\n \\********************************************/\n/*! exports provided: NodeMaterialOptimizer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nodeMaterialOptimizer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialOptimizer */ \"./Materials/Node/Optimizers/nodeMaterialOptimizer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _nodeMaterialOptimizer__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialOptimizer\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Optimizers/nodeMaterialOptimizer.ts\":\n/*!************************************************************!*\\\n !*** ./Materials/Node/Optimizers/nodeMaterialOptimizer.ts ***!\n \\************************************************************/\n/*! exports provided: NodeMaterialOptimizer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return NodeMaterialOptimizer; });\n/**\r\n * Root class for all node material optimizers\r\n */\r\nvar NodeMaterialOptimizer = /** @class */ (function () {\r\n function NodeMaterialOptimizer() {\r\n }\r\n /**\r\n * Function used to optimize a NodeMaterial graph\r\n * @param vertexOutputNodes defines the list of output nodes for the vertex shader\r\n * @param fragmentOutputNodes defines the list of output nodes for the fragment shader\r\n */\r\n NodeMaterialOptimizer.prototype.optimize = function (vertexOutputNodes, fragmentOutputNodes) {\r\n // Do nothing by default\r\n };\r\n return NodeMaterialOptimizer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/index.ts\":\n/*!*********************************!*\\\n !*** ./Materials/Node/index.ts ***!\n \\*********************************/\n/*! exports provided: NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony import */ var _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPoint */ \"./Materials/Node/nodeMaterialBlockConnectionPoint.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlock\"]; });\n\n/* harmony import */ var _nodeMaterial__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nodeMaterial */ \"./Materials/Node/nodeMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _nodeMaterial__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _nodeMaterial__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterial\"]; });\n\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony import */ var _Blocks_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Blocks/index */ \"./Materials/Node/Blocks/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _Optimizers_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Optimizers/index */ \"./Materials/Node/Optimizers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _Optimizers_index__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialOptimizer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterial.ts\":\n/*!****************************************!*\\\n !*** ./Materials/Node/nodeMaterial.ts ***!\n \\****************************************/\n/*! exports provided: NodeMaterialDefines, NodeMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return NodeMaterialDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return NodeMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _pushMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _nodeMaterialBuildState__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nodeMaterialBuildState */ \"./Materials/Node/nodeMaterialBuildState.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBuildStateSharedData__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./nodeMaterialBuildStateSharedData */ \"./Materials/Node/nodeMaterialBuildStateSharedData.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Blocks_transformBlock__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Blocks/transformBlock */ \"./Materials/Node/Blocks/transformBlock.ts\");\n/* harmony import */ var _Blocks_Vertex_vertexOutputBlock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Blocks/Vertex/vertexOutputBlock */ \"./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts\");\n/* harmony import */ var _Blocks_Fragment_fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Blocks/Fragment/fragmentOutputBlock */ \"./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts\");\n/* harmony import */ var _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Blocks/Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar NodeMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NodeMaterialDefines, _super);\r\n function NodeMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n /** BONES */\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n /** MORPH TARGETS */\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n /** IMAGE PROCESSING */\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.EXPOSURE = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n /** MISC. */\r\n _this.BUMPDIRECTUV = 0;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n NodeMaterialDefines.prototype.setValue = function (name, value) {\r\n if (this[name] === undefined) {\r\n this._keys.push(name);\r\n }\r\n this[name] = value;\r\n };\r\n return NodeMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_10__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * Class used to create a node based material built by assembling shader blocks\r\n */\r\nvar NodeMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NodeMaterial, _super);\r\n /**\r\n * Create a new node based material\r\n * @param name defines the material name\r\n * @param scene defines the hosting scene\r\n * @param options defines creation option\r\n */\r\n function NodeMaterial(name, scene, options) {\r\n if (options === void 0) { options = {}; }\r\n var _this = _super.call(this, name, scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].LastCreatedScene) || this;\r\n _this._buildId = NodeMaterial._BuildIdGenerator++;\r\n _this._buildWasSuccessful = false;\r\n _this._cachedWorldViewMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._cachedWorldViewProjectionMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._optimizers = new Array();\r\n _this._animationFrame = -1;\r\n _this.BJSNODEMATERIALEDITOR = _this._getGlobalNodeMaterialEditor();\r\n /**\r\n * Gets or sets a boolean indicating that alpha value must be ignored (This will turn alpha blending off even if an alpha value is produced by the material)\r\n */\r\n _this.ignoreAlpha = false;\r\n /**\r\n * Defines the maximum number of lights that can be used in the material\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * Observable raised when the material is built\r\n */\r\n _this.onBuildObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_7__[\"Observable\"]();\r\n /**\r\n * Gets or sets the root nodes of the material vertex shader\r\n */\r\n _this._vertexOutputNodes = new Array();\r\n /**\r\n * Gets or sets the root nodes of the material fragment (pixel) shader\r\n */\r\n _this._fragmentOutputNodes = new Array();\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n _this.attachedBlocks = new Array();\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ emitComments: false }, options);\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n return _this;\r\n }\r\n /** Get the inspector from bundle or global */\r\n NodeMaterial.prototype._getGlobalNodeMaterialEditor = function () {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEEDITOR !== 'undefined') {\r\n return NODEEDITOR;\r\n }\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== 'undefined' && typeof BABYLON.NodeEditor !== 'undefined') {\r\n return BABYLON;\r\n }\r\n return undefined;\r\n };\r\n Object.defineProperty(NodeMaterial.prototype, \"options\", {\r\n /** Gets or sets options to control the node material overall behavior */\r\n get: function () {\r\n return this._options;\r\n },\r\n set: function (options) {\r\n this._options = options;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"NodeMaterial\"\r\n * @returns the class name\r\n */\r\n NodeMaterial.prototype.getClassName = function () {\r\n return \"NodeMaterial\";\r\n };\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n NodeMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n NodeMaterial.prototype.getBlockByName = function (name) {\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (block.name === name) {\r\n return block;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a block by its name\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n NodeMaterial.prototype.getBlockByPredicate = function (predicate) {\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get an input block by its name\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required input block or null if not found\r\n */\r\n NodeMaterial.prototype.getInputBlockByPredicate = function (predicate) {\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (block.isInput && predicate(block)) {\r\n return block;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n NodeMaterial.prototype.getInputBlocks = function () {\r\n var blocks = [];\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (block.isInput) {\r\n blocks.push(block);\r\n }\r\n }\r\n return blocks;\r\n };\r\n /**\r\n * Adds a new optimizer to the list of optimizers\r\n * @param optimizer defines the optimizers to add\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.registerOptimizer = function (optimizer) {\r\n var index = this._optimizers.indexOf(optimizer);\r\n if (index > -1) {\r\n return;\r\n }\r\n this._optimizers.push(optimizer);\r\n return this;\r\n };\r\n /**\r\n * Remove an optimizer from the list of optimizers\r\n * @param optimizer defines the optimizers to remove\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.unregisterOptimizer = function (optimizer) {\r\n var index = this._optimizers.indexOf(optimizer);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._optimizers.splice(index, 1);\r\n return this;\r\n };\r\n /**\r\n * Add a new block to the list of output nodes\r\n * @param node defines the node to add\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.addOutputNode = function (node) {\r\n if (node.target === null) {\r\n throw \"This node is not meant to be an output node. You may want to explicitly set its target value.\";\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex) !== 0) {\r\n this._addVertexOutputNode(node);\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment) !== 0) {\r\n this._addFragmentOutputNode(node);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Remove a block from the list of root nodes\r\n * @param node defines the node to remove\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.removeOutputNode = function (node) {\r\n if (node.target === null) {\r\n return this;\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex) !== 0) {\r\n this._removeVertexOutputNode(node);\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment) !== 0) {\r\n this._removeFragmentOutputNode(node);\r\n }\r\n return this;\r\n };\r\n NodeMaterial.prototype._addVertexOutputNode = function (node) {\r\n if (this._vertexOutputNodes.indexOf(node) !== -1) {\r\n return;\r\n }\r\n node.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex;\r\n this._vertexOutputNodes.push(node);\r\n return this;\r\n };\r\n NodeMaterial.prototype._removeVertexOutputNode = function (node) {\r\n var index = this._vertexOutputNodes.indexOf(node);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._vertexOutputNodes.splice(index, 1);\r\n return this;\r\n };\r\n NodeMaterial.prototype._addFragmentOutputNode = function (node) {\r\n if (this._fragmentOutputNodes.indexOf(node) !== -1) {\r\n return;\r\n }\r\n node.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment;\r\n this._fragmentOutputNodes.push(node);\r\n return this;\r\n };\r\n NodeMaterial.prototype._removeFragmentOutputNode = function (node) {\r\n var index = this._fragmentOutputNodes.indexOf(node);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._fragmentOutputNodes.splice(index, 1);\r\n return this;\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n NodeMaterial.prototype.needAlphaBlending = function () {\r\n if (this.ignoreAlpha) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._sharedData && this._sharedData.hints.needAlphaBlending);\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n NodeMaterial.prototype.needAlphaTesting = function () {\r\n return this._sharedData && this._sharedData.hints.needAlphaTesting;\r\n };\r\n NodeMaterial.prototype._initializeBlock = function (node, state, nodesToProcessForOtherBuildState) {\r\n node.initialize(state);\r\n node.autoConfigure(this);\r\n node._preparationId = this._buildId;\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n for (var _i = 0, _a = node.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!node.isInput) {\r\n input.associatedVariableName = \"\";\r\n }\r\n var connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n var block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n if (block.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].VertexAndFragment) {\r\n nodesToProcessForOtherBuildState.push(block);\r\n }\r\n else if (state.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment\r\n && block.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex\r\n && block._preparationId !== this._buildId) {\r\n nodesToProcessForOtherBuildState.push(block);\r\n }\r\n this._initializeBlock(block, state, nodesToProcessForOtherBuildState);\r\n }\r\n }\r\n }\r\n for (var _b = 0, _c = node.outputs; _b < _c.length; _b++) {\r\n var output = _c[_b];\r\n output.associatedVariableName = \"\";\r\n }\r\n };\r\n NodeMaterial.prototype._resetDualBlocks = function (node, id) {\r\n if (node.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].VertexAndFragment) {\r\n node.buildId = id;\r\n }\r\n for (var _i = 0, _a = node.inputs; _i < _a.length; _i++) {\r\n var inputs = _a[_i];\r\n var connectedPoint = inputs.connectedPoint;\r\n if (connectedPoint) {\r\n var block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._resetDualBlocks(block, id);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Build the material and generates the inner effect\r\n * @param verbose defines if the build should log activity\r\n */\r\n NodeMaterial.prototype.build = function (verbose) {\r\n if (verbose === void 0) { verbose = false; }\r\n this._buildWasSuccessful = false;\r\n var engine = this.getScene().getEngine();\r\n if (this._vertexOutputNodes.length === 0) {\r\n throw \"You must define at least one vertexOutputNode\";\r\n }\r\n if (this._fragmentOutputNodes.length === 0) {\r\n throw \"You must define at least one fragmentOutputNode\";\r\n }\r\n // Compilation state\r\n this._vertexCompilationState = new _nodeMaterialBuildState__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialBuildState\"]();\r\n this._vertexCompilationState.supportUniformBuffers = engine.supportsUniformBuffers;\r\n this._vertexCompilationState.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex;\r\n this._fragmentCompilationState = new _nodeMaterialBuildState__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialBuildState\"]();\r\n this._fragmentCompilationState.supportUniformBuffers = engine.supportsUniformBuffers;\r\n this._fragmentCompilationState.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment;\r\n // Shared data\r\n this._sharedData = new _nodeMaterialBuildStateSharedData__WEBPACK_IMPORTED_MODULE_9__[\"NodeMaterialBuildStateSharedData\"]();\r\n this._vertexCompilationState.sharedData = this._sharedData;\r\n this._fragmentCompilationState.sharedData = this._sharedData;\r\n this._sharedData.buildId = this._buildId;\r\n this._sharedData.emitComments = this._options.emitComments;\r\n this._sharedData.verbose = verbose;\r\n // Initialize blocks\r\n var vertexNodes = [];\r\n var fragmentNodes = [];\r\n for (var _i = 0, _a = this._vertexOutputNodes; _i < _a.length; _i++) {\r\n var vertexOutputNode = _a[_i];\r\n vertexNodes.push(vertexOutputNode);\r\n this._initializeBlock(vertexOutputNode, this._vertexCompilationState, fragmentNodes);\r\n }\r\n for (var _b = 0, _c = this._fragmentOutputNodes; _b < _c.length; _b++) {\r\n var fragmentOutputNode = _c[_b];\r\n fragmentNodes.push(fragmentOutputNode);\r\n this._initializeBlock(fragmentOutputNode, this._fragmentCompilationState, vertexNodes);\r\n }\r\n // Optimize\r\n this.optimize();\r\n // Vertex\r\n for (var _d = 0, vertexNodes_1 = vertexNodes; _d < vertexNodes_1.length; _d++) {\r\n var vertexOutputNode = vertexNodes_1[_d];\r\n vertexOutputNode.build(this._vertexCompilationState, vertexNodes);\r\n }\r\n // Fragment\r\n this._fragmentCompilationState.uniforms = this._vertexCompilationState.uniforms.slice(0);\r\n this._fragmentCompilationState._uniformDeclaration = this._vertexCompilationState._uniformDeclaration;\r\n this._fragmentCompilationState._vertexState = this._vertexCompilationState;\r\n for (var _e = 0, fragmentNodes_1 = fragmentNodes; _e < fragmentNodes_1.length; _e++) {\r\n var fragmentOutputNode = fragmentNodes_1[_e];\r\n this._resetDualBlocks(fragmentOutputNode, this._buildId - 1);\r\n }\r\n for (var _f = 0, fragmentNodes_2 = fragmentNodes; _f < fragmentNodes_2.length; _f++) {\r\n var fragmentOutputNode = fragmentNodes_2[_f];\r\n fragmentOutputNode.build(this._fragmentCompilationState, fragmentNodes);\r\n }\r\n // Finalize\r\n this._vertexCompilationState.finalize(this._vertexCompilationState);\r\n this._fragmentCompilationState.finalize(this._fragmentCompilationState);\r\n this._buildId = NodeMaterial._BuildIdGenerator++;\r\n // Errors\r\n this._sharedData.emitErrors();\r\n if (verbose) {\r\n console.log(\"Vertex shader:\");\r\n console.log(this._vertexCompilationState.compilationString);\r\n console.log(\"Fragment shader:\");\r\n console.log(this._fragmentCompilationState.compilationString);\r\n }\r\n this._buildWasSuccessful = true;\r\n this.onBuildObservable.notifyObservers(this);\r\n // Wipe defines\r\n var meshes = this.getScene().meshes;\r\n for (var _g = 0, meshes_1 = meshes; _g < meshes_1.length; _g++) {\r\n var mesh = meshes_1[_g];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _h = 0, _j = mesh.subMeshes; _h < _j.length; _h++) {\r\n var subMesh = _j[_h];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh._materialDefines) {\r\n continue;\r\n }\r\n var defines = subMesh._materialDefines;\r\n defines.markAllAsDirty();\r\n defines.reset();\r\n }\r\n }\r\n };\r\n /**\r\n * Runs an otpimization phase to try to improve the shader code\r\n */\r\n NodeMaterial.prototype.optimize = function () {\r\n for (var _i = 0, _a = this._optimizers; _i < _a.length; _i++) {\r\n var optimizer = _a[_i];\r\n optimizer.optimize(this._vertexOutputNodes, this._fragmentOutputNodes);\r\n }\r\n };\r\n NodeMaterial.prototype._prepareDefinesForAttributes = function (mesh, defines) {\r\n if (!defines._areAttributesDirty) {\r\n return;\r\n }\r\n defines[\"NORMAL\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__[\"VertexBuffer\"].NormalKind);\r\n defines[\"TANGENT\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__[\"VertexBuffer\"].TangentKind);\r\n defines[\"UV1\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__[\"VertexBuffer\"].UVKind);\r\n };\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n NodeMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n var _this = this;\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (!this._buildWasSuccessful) {\r\n return false;\r\n }\r\n var scene = this.getScene();\r\n if (this._sharedData.animatedInputs) {\r\n var frameId = scene.getFrameId();\r\n if (this._animationFrame !== frameId) {\r\n for (var _i = 0, _a = this._sharedData.animatedInputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n input.animate(scene);\r\n }\r\n this._animationFrame = frameId;\r\n }\r\n }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new NodeMaterialDefines();\r\n }\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var engine = scene.getEngine();\r\n this._prepareDefinesForAttributes(mesh, defines);\r\n // Check if blocks are ready\r\n if (this._sharedData.blockingBlocks.some(function (b) { return !b.isReady(mesh, _this, defines, useInstances); })) {\r\n return false;\r\n }\r\n // Shared defines\r\n this._sharedData.blocksWithDefines.forEach(function (b) {\r\n b.initializeDefines(mesh, _this, defines, useInstances);\r\n });\r\n this._sharedData.blocksWithDefines.forEach(function (b) {\r\n b.prepareDefines(mesh, _this, defines, useInstances);\r\n });\r\n // Need to recompile?\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n // Repeatable content generators\r\n this._vertexCompilationState.compilationString = this._vertexCompilationState._builtCompilationString;\r\n this._fragmentCompilationState.compilationString = this._fragmentCompilationState._builtCompilationString;\r\n this._sharedData.repeatableContentBlocks.forEach(function (b) {\r\n b.replaceRepeatableContent(_this._vertexCompilationState, _this._fragmentCompilationState, mesh, defines);\r\n });\r\n // Uniforms\r\n this._sharedData.dynamicUniformBlocks.forEach(function (b) {\r\n b.updateUniformsAndSamples(_this._vertexCompilationState, _this, defines);\r\n });\r\n var mergedUniforms_1 = this._vertexCompilationState.uniforms;\r\n this._fragmentCompilationState.uniforms.forEach(function (u) {\r\n var index = mergedUniforms_1.indexOf(u);\r\n if (index === -1) {\r\n mergedUniforms_1.push(u);\r\n }\r\n });\r\n // Uniform buffers\r\n var mergedUniformBuffers_1 = this._vertexCompilationState.uniformBuffers;\r\n this._fragmentCompilationState.uniformBuffers.forEach(function (u) {\r\n var index = mergedUniformBuffers_1.indexOf(u);\r\n if (index === -1) {\r\n mergedUniformBuffers_1.push(u);\r\n }\r\n });\r\n // Samplers\r\n var mergedSamplers_1 = this._vertexCompilationState.samplers;\r\n this._fragmentCompilationState.samplers.forEach(function (s) {\r\n var index = mergedSamplers_1.indexOf(s);\r\n if (index === -1) {\r\n mergedSamplers_1.push(s);\r\n }\r\n });\r\n var fallbacks = new _effect__WEBPACK_IMPORTED_MODULE_6__[\"EffectFallbacks\"]();\r\n this._sharedData.blocksWithFallbacks.forEach(function (b) {\r\n b.provideFallbacks(mesh, fallbacks);\r\n });\r\n var previousEffect = subMesh.effect;\r\n // Compilation\r\n var join = defines.toString();\r\n var effect = engine.createEffect({\r\n vertex: \"nodeMaterial\" + this._buildId,\r\n fragment: \"nodeMaterial\" + this._buildId,\r\n vertexSource: this._vertexCompilationState.compilationString,\r\n fragmentSource: this._fragmentCompilationState.compilationString\r\n }, {\r\n attributes: this._vertexCompilationState.attributes,\r\n uniformsNames: mergedUniforms_1,\r\n uniformBuffersNames: mergedUniformBuffers_1,\r\n samplers: mergedSamplers_1,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS }\r\n }, engine);\r\n if (effect) {\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n defines.markAsUnprocessed();\r\n }\r\n else {\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n }\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n Object.defineProperty(NodeMaterial.prototype, \"compiledShaders\", {\r\n /**\r\n * Get a string representing the shaders built by the current node graph\r\n */\r\n get: function () {\r\n return \"// Vertex shader\\r\\n\" + this._vertexCompilationState.compilationString + \"\\r\\n\\r\\n// Fragment shader\\r\\n\" + this._fragmentCompilationState.compilationString;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n NodeMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n var scene = this.getScene();\r\n if (!this._activeEffect) {\r\n return;\r\n }\r\n var hints = this._sharedData.hints;\r\n if (hints.needWorldViewMatrix) {\r\n world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);\r\n }\r\n if (hints.needWorldViewProjectionMatrix) {\r\n world.multiplyToRef(scene.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);\r\n }\r\n // Connection points\r\n for (var _i = 0, _a = this._sharedData.inputBlocks; _i < _a.length; _i++) {\r\n var inputBlock = _a[_i];\r\n inputBlock._transmitWorld(this._activeEffect, world, this._cachedWorldViewMatrix, this._cachedWorldViewProjectionMatrix);\r\n }\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n NodeMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n if (mustRebind) {\r\n var sharedData = this._sharedData;\r\n if (effect && scene.getCachedMaterial() !== this) {\r\n // Bindable blocks\r\n for (var _i = 0, _a = sharedData.bindableBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n block.bind(effect, this, mesh);\r\n }\r\n // Connection points\r\n for (var _b = 0, _c = sharedData.inputBlocks; _b < _c.length; _b++) {\r\n var inputBlock = _c[_b];\r\n inputBlock._transmit(effect, scene);\r\n }\r\n }\r\n }\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n NodeMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n activeTextures.push.apply(activeTextures, this._sharedData.textureBlocks.filter(function (tb) { return tb.texture; }).map(function (tb) { return tb.texture; }));\r\n return activeTextures;\r\n };\r\n /**\r\n * Gets the list of texture blocks\r\n * @returns an array of texture blocks\r\n */\r\n NodeMaterial.prototype.getTextureBlocks = function () {\r\n if (!this._sharedData) {\r\n return [];\r\n }\r\n return this._sharedData.textureBlocks.filter(function (tb) { return tb.texture; });\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n NodeMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (!this._sharedData) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this._sharedData.textureBlocks; _i < _a.length; _i++) {\r\n var t = _a[_i];\r\n if (t.texture === texture) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n NodeMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n if (forceDisposeTextures) {\r\n for (var _i = 0, _a = this._sharedData.textureBlocks.filter(function (tb) { return tb.texture; }).map(function (tb) { return tb.texture; }); _i < _a.length; _i++) {\r\n var texture = _a[_i];\r\n texture.dispose();\r\n }\r\n }\r\n this.onBuildObservable.clear();\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\r\n };\r\n /** Creates the node editor window. */\r\n NodeMaterial.prototype._createNodeEditor = function () {\r\n this.BJSNODEMATERIALEDITOR = this.BJSNODEMATERIALEDITOR || this._getGlobalNodeMaterialEditor();\r\n this.BJSNODEMATERIALEDITOR.NodeEditor.Show({\r\n nodeMaterial: this\r\n });\r\n };\r\n /**\r\n * Launch the node material editor\r\n * @param config Define the configuration of the editor\r\n * @return a promise fulfilled when the node editor is visible\r\n */\r\n NodeMaterial.prototype.edit = function (config) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (typeof _this.BJSNODEMATERIALEDITOR == 'undefined') {\r\n var editorUrl = config && config.editorURL ? config.editorURL : NodeMaterial.EditorURL;\r\n // Load editor and add it to the DOM\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_12__[\"Tools\"].LoadScript(editorUrl, function () {\r\n _this._createNodeEditor();\r\n resolve();\r\n });\r\n }\r\n else {\r\n // Otherwise creates the editor\r\n _this._createNodeEditor();\r\n resolve();\r\n }\r\n });\r\n };\r\n /**\r\n * Clear the current material\r\n */\r\n NodeMaterial.prototype.clear = function () {\r\n this._vertexOutputNodes = [];\r\n this._fragmentOutputNodes = [];\r\n this.attachedBlocks = [];\r\n };\r\n /**\r\n * Clear the current material and set it to a default state\r\n */\r\n NodeMaterial.prototype.setToDefault = function () {\r\n this.clear();\r\n var positionInput = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"position\");\r\n positionInput.setAsAttribute(\"position\");\r\n var worldInput = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(BABYLON.NodeMaterialSystemValues.World);\r\n var worldPos = new _Blocks_transformBlock__WEBPACK_IMPORTED_MODULE_13__[\"TransformBlock\"](\"worldPos\");\r\n positionInput.connectTo(worldPos);\r\n worldInput.connectTo(worldPos);\r\n var viewProjectionInput = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"viewProjection\");\r\n viewProjectionInput.setAsSystemValue(BABYLON.NodeMaterialSystemValues.ViewProjection);\r\n var worldPosdMultipliedByViewProjection = new _Blocks_transformBlock__WEBPACK_IMPORTED_MODULE_13__[\"TransformBlock\"](\"worldPos * viewProjectionTransform\");\r\n worldPos.connectTo(worldPosdMultipliedByViewProjection);\r\n viewProjectionInput.connectTo(worldPosdMultipliedByViewProjection);\r\n var vertexOutput = new _Blocks_Vertex_vertexOutputBlock__WEBPACK_IMPORTED_MODULE_14__[\"VertexOutputBlock\"](\"vertexOutput\");\r\n worldPosdMultipliedByViewProjection.connectTo(vertexOutput);\r\n // Pixel\r\n var pixelColor = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"color\");\r\n pixelColor.value = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"](0.8, 0.8, 0.8, 1);\r\n var fragmentOutput = new _Blocks_Fragment_fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_15__[\"FragmentOutputBlock\"](\"fragmentOutput\");\r\n pixelColor.connectTo(fragmentOutput);\r\n // Add to nodes\r\n this.addOutputNode(vertexOutput);\r\n this.addOutputNode(fragmentOutput);\r\n };\r\n /**\r\n * Loads the current Node Material from a url pointing to a file save by the Node Material Editor\r\n * @param url defines the url to load from\r\n * @returns a promise that will fullfil when the material is fully loaded\r\n */\r\n NodeMaterial.prototype.loadAsync = function (url) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_19__[\"FileTools\"].LoadFile(url, function (data) {\r\n var serializationObject = JSON.parse(data);\r\n _this.loadFromSerialization(serializationObject, \"\");\r\n resolve();\r\n }, undefined, undefined, false, function (request, exception) {\r\n reject(exception.message);\r\n });\r\n });\r\n };\r\n NodeMaterial.prototype._gatherBlocks = function (rootNode, list) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n for (var _i = 0, _a = rootNode.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n var connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n var block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this material\r\n * @returns a string\r\n */\r\n NodeMaterial.prototype.generateCode = function () {\r\n var alreadyDumped = [];\r\n var vertexBlocks = [];\r\n var uniqueNames = [];\r\n // Gets active blocks\r\n for (var _i = 0, _a = this._vertexOutputNodes; _i < _a.length; _i++) {\r\n var outputNode = _a[_i];\r\n this._gatherBlocks(outputNode, vertexBlocks);\r\n }\r\n var fragmentBlocks = [];\r\n for (var _b = 0, _c = this._fragmentOutputNodes; _b < _c.length; _b++) {\r\n var outputNode = _c[_b];\r\n this._gatherBlocks(outputNode, fragmentBlocks);\r\n }\r\n // Generate vertex shader\r\n var codeString = \"var nodeMaterial = new BABYLON.NodeMaterial(`node material`);\\r\\n\";\r\n for (var _d = 0, vertexBlocks_1 = vertexBlocks; _d < vertexBlocks_1.length; _d++) {\r\n var node = vertexBlocks_1[_d];\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n // Generate fragment shader\r\n for (var _e = 0, fragmentBlocks_1 = fragmentBlocks; _e < fragmentBlocks_1.length; _e++) {\r\n var node = fragmentBlocks_1[_e];\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n for (var _f = 0, _g = this._vertexOutputNodes; _f < _g.length; _f++) {\r\n var node = _g[_f];\r\n codeString += \"nodeMaterial.addOutputNode(\" + node._codeVariableName + \");\\r\\n\";\r\n }\r\n for (var _h = 0, _j = this._fragmentOutputNodes; _h < _j.length; _h++) {\r\n var node = _j[_h];\r\n codeString += \"nodeMaterial.addOutputNode(\" + node._codeVariableName + \");\\r\\n\";\r\n }\r\n codeString += \"nodeMaterial.build();\\r\\n\";\r\n return codeString;\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n NodeMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.NodeMaterial\";\r\n serializationObject.outputNodes = [];\r\n var blocks = [];\r\n // Outputs\r\n for (var _i = 0, _a = this._vertexOutputNodes; _i < _a.length; _i++) {\r\n var outputNode = _a[_i];\r\n this._gatherBlocks(outputNode, blocks);\r\n serializationObject.outputNodes.push(outputNode.uniqueId);\r\n }\r\n for (var _b = 0, _c = this._fragmentOutputNodes; _b < _c.length; _b++) {\r\n var outputNode = _c[_b];\r\n this._gatherBlocks(outputNode, blocks);\r\n if (serializationObject.outputNodes.indexOf(outputNode.uniqueId) === -1) {\r\n serializationObject.outputNodes.push(outputNode.uniqueId);\r\n }\r\n }\r\n // Blocks\r\n serializationObject.blocks = [];\r\n for (var _d = 0, blocks_1 = blocks; _d < blocks_1.length; _d++) {\r\n var block = blocks_1[_d];\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n for (var _e = 0, _f = this.attachedBlocks; _e < _f.length; _e++) {\r\n var block = _f[_e];\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n NodeMaterial.prototype._restoreConnections = function (block, source, map) {\r\n for (var _i = 0, _a = block.outputs; _i < _a.length; _i++) {\r\n var outputPoint = _a[_i];\r\n for (var _b = 0, _c = source.blocks; _b < _c.length; _b++) {\r\n var candidate = _c[_b];\r\n var target = map[candidate.id];\r\n for (var _d = 0, _e = candidate.inputs; _d < _e.length; _d++) {\r\n var input = _e[_d];\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n var inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the material\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n */\r\n NodeMaterial.prototype.loadFromSerialization = function (source, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n this.clear();\r\n var map = {};\r\n // Create blocks\r\n for (var _i = 0, _a = source.blocks; _i < _a.length; _i++) {\r\n var parsedBlock = _a[_i];\r\n var blockType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_17__[\"_TypeStore\"].GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n var block = new blockType();\r\n block._deserialize(parsedBlock, this.getScene(), rootUrl);\r\n map[parsedBlock.id] = block;\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n // Connections\r\n // Starts with input blocks only\r\n for (var blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n var parsedBlock_1 = source.blocks[blockIndex];\r\n var block = map[parsedBlock_1.id];\r\n if (!block.isInput) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n // Outputs\r\n for (var _b = 0, _c = source.outputNodes; _b < _c.length; _b++) {\r\n var outputNodeId = _c[_b];\r\n this.addOutputNode(map[outputNodeId]);\r\n }\r\n // Store map for external uses\r\n source.map = {};\r\n for (var key in map) {\r\n source.map[key] = map[key].uniqueId;\r\n }\r\n };\r\n /**\r\n * Creates a node material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new node material\r\n */\r\n NodeMaterial.Parse = function (source, scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n var nodeMaterial = _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].Parse(function () { return new NodeMaterial(source.name, scene); }, source, scene, rootUrl);\r\n nodeMaterial.loadFromSerialization(source, rootUrl);\r\n return nodeMaterial;\r\n };\r\n /**\r\n * Creates a new node material set to default basic configuration\r\n * @param name defines the name of the material\r\n * @param scene defines the hosting scene\r\n * @returns a new NodeMaterial\r\n */\r\n NodeMaterial.CreateDefault = function (name, scene) {\r\n var newMaterial = new NodeMaterial(name, scene);\r\n newMaterial.setToDefault();\r\n newMaterial.build();\r\n return newMaterial;\r\n };\r\n NodeMaterial._BuildIdGenerator = 0;\r\n /** Define the URl to load node editor script */\r\n NodeMaterial.EditorURL = \"https://unpkg.com/babylonjs-node-editor@\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].Version + \"/babylon.nodeEditor.js\";\r\n return NodeMaterial;\r\n}(_pushMaterial__WEBPACK_IMPORTED_MODULE_1__[\"PushMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_17__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.NodeMaterial\"] = NodeMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlock.ts ***!\n \\*********************************************/\n/*! exports provided: NodeMaterialBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return NodeMaterialBlock; });\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPoint */ \"./Materials/Node/nodeMaterialBlockConnectionPoint.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/uniqueIdGenerator */ \"./Misc/uniqueIdGenerator.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines a block that can be used inside a node based material\r\n */\r\nvar NodeMaterialBlock = /** @class */ (function () {\r\n /**\r\n * Creates a new NodeMaterialBlock\r\n * @param name defines the block name\r\n * @param target defines the target of that block (Vertex by default)\r\n * @param isFinalMerger defines a boolean indicating that this block is an end block (e.g. it is generating a system value). Default is false\r\n * @param isInput defines a boolean indicating that this block is an input (e.g. it sends data to the shader). Default is false\r\n */\r\n function NodeMaterialBlock(name, target, isFinalMerger, isInput) {\r\n if (target === void 0) { target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex; }\r\n if (isFinalMerger === void 0) { isFinalMerger = false; }\r\n if (isInput === void 0) { isInput = false; }\r\n this._isFinalMerger = false;\r\n this._isInput = false;\r\n /** @hidden */\r\n this._codeVariableName = \"\";\r\n /** @hidden */\r\n this._inputs = new Array();\r\n /** @hidden */\r\n this._outputs = new Array();\r\n this.name = name;\r\n this._target = target;\r\n this._isFinalMerger = isFinalMerger;\r\n this._isInput = isInput;\r\n this.uniqueId = _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_3__[\"UniqueIdGenerator\"].UniqueId;\r\n }\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"isFinalMerger\", {\r\n /**\r\n * Gets a boolean indicating that this block is an end block (e.g. it is generating a system value)\r\n */\r\n get: function () {\r\n return this._isFinalMerger;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"isInput\", {\r\n /**\r\n * Gets a boolean indicating that this block is an input (e.g. it sends data to the shader)\r\n */\r\n get: function () {\r\n return this._isInput;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"buildId\", {\r\n /**\r\n * Gets or sets the build Id\r\n */\r\n get: function () {\r\n return this._buildId;\r\n },\r\n set: function (value) {\r\n this._buildId = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"target\", {\r\n /**\r\n * Gets or sets the target of the block\r\n */\r\n get: function () {\r\n return this._target;\r\n },\r\n set: function (value) {\r\n if ((this._target & value) !== 0) {\r\n return;\r\n }\r\n this._target = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"inputs\", {\r\n /**\r\n * Gets the list of input points\r\n */\r\n get: function () {\r\n return this._inputs;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"outputs\", {\r\n /** Gets the list of output points */\r\n get: function () {\r\n return this._outputs;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n NodeMaterialBlock.prototype.getInputByName = function (name) {\r\n var filter = this._inputs.filter(function (e) { return e.name === name; });\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Find an output by its name\r\n * @param name defines the name of the outputto look for\r\n * @returns the output or null if not found\r\n */\r\n NodeMaterialBlock.prototype.getOutputByName = function (name) {\r\n var filter = this._outputs.filter(function (e) { return e.name === name; });\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n NodeMaterialBlock.prototype.initialize = function (state) {\r\n // Do nothing\r\n };\r\n /**\r\n * Bind data to effect. Will only be called for blocks with isBindable === true\r\n * @param effect defines the effect to bind data to\r\n * @param nodeMaterial defines the hosting NodeMaterial\r\n * @param mesh defines the mesh that will be rendered\r\n */\r\n NodeMaterialBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n // Do nothing\r\n };\r\n NodeMaterialBlock.prototype._declareOutput = function (output, state) {\r\n return state._getGLType(output.type) + \" \" + output.associatedVariableName;\r\n };\r\n NodeMaterialBlock.prototype._writeVariable = function (currentPoint) {\r\n var connectionPoint = currentPoint.connectedPoint;\r\n if (connectionPoint) {\r\n return \"\" + currentPoint.associatedVariableName;\r\n }\r\n return \"0.\";\r\n };\r\n NodeMaterialBlock.prototype._writeFloat = function (value) {\r\n var stringVersion = value.toString();\r\n if (stringVersion.indexOf(\".\") === -1) {\r\n stringVersion += \".0\";\r\n }\r\n return \"\" + stringVersion;\r\n };\r\n /**\r\n * Gets the current class name e.g. \"NodeMaterialBlock\"\r\n * @returns the class name\r\n */\r\n NodeMaterialBlock.prototype.getClassName = function () {\r\n return \"NodeMaterialBlock\";\r\n };\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param target defines the target to use to limit the connection point (will be VertexAndFragment by default)\r\n * @returns the current block\r\n */\r\n NodeMaterialBlock.prototype.registerInput = function (name, type, isOptional, target) {\r\n if (isOptional === void 0) { isOptional = false; }\r\n var point = new _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialConnectionPoint\"](name, this);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n if (target) {\r\n point.target = target;\r\n }\r\n this._inputs.push(point);\r\n return this;\r\n };\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param target defines the target to use to limit the connection point (will be VertexAndFragment by default)\r\n * @returns the current block\r\n */\r\n NodeMaterialBlock.prototype.registerOutput = function (name, type, target) {\r\n var point = new _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialConnectionPoint\"](name, this);\r\n point.type = type;\r\n if (target) {\r\n point.target = target;\r\n }\r\n this._outputs.push(point);\r\n return this;\r\n };\r\n /**\r\n * Will return the first available input e.g. the first one which is not an uniform or an attribute\r\n * @param forOutput defines an optional connection point to check compatibility with\r\n * @returns the first available input or null\r\n */\r\n NodeMaterialBlock.prototype.getFirstAvailableInput = function (forOutput) {\r\n if (forOutput === void 0) { forOutput = null; }\r\n for (var _i = 0, _a = this._inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!input.connectedPoint) {\r\n if (!forOutput || (forOutput.type === input.type) || (input.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect)) {\r\n return input;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Will return the first available output e.g. the first one which is not yet connected and not a varying\r\n * @param forBlock defines an optional block to check compatibility with\r\n * @returns the first available input or null\r\n */\r\n NodeMaterialBlock.prototype.getFirstAvailableOutput = function (forBlock) {\r\n if (forBlock === void 0) { forBlock = null; }\r\n for (var _i = 0, _a = this._outputs; _i < _a.length; _i++) {\r\n var output = _a[_i];\r\n if (!forBlock || !forBlock.target || forBlock.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral || (forBlock.target & output.target) !== 0) {\r\n return output;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the sibling of the given output\r\n * @param current defines the current output\r\n * @returns the next output in the list or null\r\n */\r\n NodeMaterialBlock.prototype.getSiblingOutput = function (current) {\r\n var index = this._outputs.indexOf(current);\r\n if (index === -1 || index >= this._outputs.length) {\r\n return null;\r\n }\r\n return this._outputs[index + 1];\r\n };\r\n /**\r\n * Connect current block with another block\r\n * @param other defines the block to connect with\r\n * @param options define the various options to help pick the right connections\r\n * @returns the current block\r\n */\r\n NodeMaterialBlock.prototype.connectTo = function (other, options) {\r\n if (this._outputs.length === 0) {\r\n return;\r\n }\r\n var output = options && options.output ? this.getOutputByName(options.output) : this.getFirstAvailableOutput(other);\r\n var notFound = true;\r\n while (notFound) {\r\n var input = options && options.input ? other.getInputByName(options.input) : other.getFirstAvailableInput(output);\r\n if (output && input && output.canConnectTo(input)) {\r\n output.connectTo(input);\r\n notFound = false;\r\n }\r\n else if (!output) {\r\n throw \"Unable to find a compatible match\";\r\n }\r\n else {\r\n output = this.getSiblingOutput(output);\r\n }\r\n }\r\n return this;\r\n };\r\n NodeMaterialBlock.prototype._buildBlock = function (state) {\r\n // Empty. Must be defined by child nodes\r\n };\r\n /**\r\n * Add uniforms, samplers and uniform buffers at compilation time\r\n * @param state defines the state to update\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to update\r\n */\r\n NodeMaterialBlock.prototype.updateUniformsAndSamples = function (state, nodeMaterial, defines) {\r\n // Do nothing\r\n };\r\n /**\r\n * Add potential fallbacks if shader compilation fails\r\n * @param mesh defines the mesh to be rendered\r\n * @param fallbacks defines the current prioritized list of fallbacks\r\n */\r\n NodeMaterialBlock.prototype.provideFallbacks = function (mesh, fallbacks) {\r\n // Do nothing\r\n };\r\n /**\r\n * Update defines for shader compilation\r\n * @param mesh defines the mesh to be rendered\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to update\r\n * @param useInstances specifies that instances should be used\r\n */\r\n NodeMaterialBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n // Do nothing\r\n };\r\n /**\r\n * Initialize defines for shader compilation\r\n * @param mesh defines the mesh to be rendered\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to be prepared\r\n * @param useInstances specifies that instances should be used\r\n */\r\n NodeMaterialBlock.prototype.initializeDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n // Do nothing\r\n };\r\n /**\r\n * Lets the block try to connect some inputs automatically\r\n * @param material defines the hosting NodeMaterial\r\n */\r\n NodeMaterialBlock.prototype.autoConfigure = function (material) {\r\n // Do nothing\r\n };\r\n /**\r\n * Function called when a block is declared as repeatable content generator\r\n * @param vertexShaderState defines the current compilation state for the vertex shader\r\n * @param fragmentShaderState defines the current compilation state for the fragment shader\r\n * @param mesh defines the mesh to be rendered\r\n * @param defines defines the material defines to update\r\n */\r\n NodeMaterialBlock.prototype.replaceRepeatableContent = function (vertexShaderState, fragmentShaderState, mesh, defines) {\r\n // Do nothing\r\n };\r\n /**\r\n * Checks if the block is ready\r\n * @param mesh defines the mesh to be rendered\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to update\r\n * @param useInstances specifies that instances should be used\r\n * @returns true if the block is ready\r\n */\r\n NodeMaterialBlock.prototype.isReady = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n return true;\r\n };\r\n NodeMaterialBlock.prototype._linkConnectionTypes = function (inputIndex0, inputIndex1) {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n };\r\n NodeMaterialBlock.prototype._processBuild = function (block, state, input, activeBlocks) {\r\n block.build(state, activeBlocks);\r\n var localBlockIsFragment = (state._vertexState != null);\r\n var otherBlockWasGeneratedInVertexShader = block._buildTarget === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex && block.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n if (localBlockIsFragment && (((block.target & input.target) === 0) ||\r\n (this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].VertexAndFragment && otherBlockWasGeneratedInVertexShader))) { // context switch! We need a varying\r\n if ((!block.isInput && state.target !== block._buildTarget) // block was already emitted by vertex shader\r\n || (block.isInput && block.isAttribute) // block is an attribute\r\n ) {\r\n var connectedPoint = input.connectedPoint;\r\n if (state._vertexState._emitVaryingFromString(\"v_\" + connectedPoint.associatedVariableName, state._getGLType(connectedPoint.type))) {\r\n state._vertexState.compilationString += \"v_\" + connectedPoint.associatedVariableName + \" = \" + connectedPoint.associatedVariableName + \";\\r\\n\";\r\n }\r\n input.associatedVariableName = \"v_\" + connectedPoint.associatedVariableName;\r\n input._enforceAssociatedVariableName = true;\r\n }\r\n }\r\n };\r\n /**\r\n * Compile the current node and generate the shader code\r\n * @param state defines the current compilation state (uniforms, samplers, current string)\r\n * @param activeBlocks defines the list of active blocks (i.e. blocks to compile)\r\n * @returns true if already built\r\n */\r\n NodeMaterialBlock.prototype.build = function (state, activeBlocks) {\r\n if (this._buildId === state.sharedData.buildId) {\r\n return true;\r\n }\r\n // Check if \"parent\" blocks are compiled\r\n for (var _i = 0, _a = this._inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) { // Emit a warning\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n if (this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral) {\r\n if ((input.target & this.target) === 0) {\r\n continue;\r\n }\r\n if ((input.target & state.target) === 0) {\r\n continue;\r\n }\r\n }\r\n var block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this) {\r\n this._processBuild(block, state, input, activeBlocks);\r\n }\r\n }\r\n if (this._buildId === state.sharedData.buildId) {\r\n return true; // Need to check again as inputs can be connected multiple time to this endpoint\r\n }\r\n // Logs\r\n if (state.sharedData.verbose) {\r\n console.log((state.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex ? \"Vertex shader\" : \"Fragment shader\") + \": Building \" + this.name + \" [\" + this.getClassName() + \"]\");\r\n }\r\n if (!this.isInput) {\r\n /** Prepare outputs */\r\n for (var _b = 0, _c = this._outputs; _b < _c.length; _b++) {\r\n var output = _c[_b];\r\n if (this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral) {\r\n if ((output.target & this.target) === 0) {\r\n continue;\r\n }\r\n if ((output.target & state.target) === 0) {\r\n continue;\r\n }\r\n }\r\n if (!output.associatedVariableName) {\r\n output.associatedVariableName = state._getFreeVariableName(output.name);\r\n }\r\n }\r\n }\r\n // Checks final outputs\r\n if (this.isFinalMerger) {\r\n switch (state.target) {\r\n case _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex:\r\n state.sharedData.checks.emitVertex = true;\r\n break;\r\n case _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment:\r\n state.sharedData.checks.emitFragment = true;\r\n break;\r\n }\r\n }\r\n if (!this.isInput && state.sharedData.emitComments) {\r\n state.compilationString += \"\\r\\n//\" + this.name + \"\\r\\n\";\r\n }\r\n this._buildBlock(state);\r\n this._buildId = state.sharedData.buildId;\r\n this._buildTarget = state.target;\r\n // Compile connected blocks\r\n for (var _d = 0, _e = this._outputs; _d < _e.length; _d++) {\r\n var output = _e[_d];\r\n if ((output.target & state.target) === 0) {\r\n continue;\r\n }\r\n for (var _f = 0, _g = output.endpoints; _f < _g.length; _f++) {\r\n var endpoint = _g[_f];\r\n var block = endpoint.ownerBlock;\r\n if (block && (block.target & state.target) !== 0 && activeBlocks.indexOf(block) !== -1) {\r\n this._processBuild(block, state, endpoint, activeBlocks);\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n NodeMaterialBlock.prototype._inputRename = function (name) {\r\n return name;\r\n };\r\n NodeMaterialBlock.prototype._outputRename = function (name) {\r\n return name;\r\n };\r\n NodeMaterialBlock.prototype._dumpPropertiesCode = function () {\r\n return \"\";\r\n };\r\n /** @hidden */\r\n NodeMaterialBlock.prototype._dumpCode = function (uniqueNames, alreadyDumped) {\r\n alreadyDumped.push(this);\r\n var codeString;\r\n // Get unique name\r\n var nameAsVariableName = this.name.replace(/[^A-Za-z_]+/g, \"\");\r\n this._codeVariableName = nameAsVariableName;\r\n if (uniqueNames.indexOf(this._codeVariableName) !== -1) {\r\n var index = 0;\r\n do {\r\n index++;\r\n this._codeVariableName = nameAsVariableName + index;\r\n } while (uniqueNames.indexOf(this._codeVariableName) !== -1);\r\n }\r\n uniqueNames.push(this._codeVariableName);\r\n // Declaration\r\n codeString = \"\\r\\nvar \" + this._codeVariableName + \" = new BABYLON.\" + this.getClassName() + \"(\\\"\" + this.name + \"\\\");\\r\\n\";\r\n // Properties\r\n codeString += this._dumpPropertiesCode();\r\n // Inputs\r\n for (var _i = 0, _a = this.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n var connectedOutput = input.connectedPoint;\r\n var connectedBlock = connectedOutput.ownerBlock;\r\n if (alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n codeString += connectedBlock._codeVariableName + \".\" + connectedBlock._outputRename(connectedOutput.name) + \".connectTo(\" + this._codeVariableName + \".\" + this._inputRename(input.name) + \");\\r\\n\";\r\n }\r\n // Outputs\r\n for (var _b = 0, _c = this.outputs; _b < _c.length; _b++) {\r\n var output = _c[_b];\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n for (var _d = 0, _e = output.endpoints; _d < _e.length; _d++) {\r\n var endpoint = _e[_d];\r\n var connectedBlock = endpoint.ownerBlock;\r\n if (connectedBlock && alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n }\r\n return codeString;\r\n };\r\n /**\r\n * Clone the current block to a new identical block\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a copy of the current block\r\n */\r\n NodeMaterialBlock.prototype.clone = function (scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n var serializationObject = this.serialize();\r\n var blockType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].GetClass(serializationObject.customType);\r\n if (blockType) {\r\n var block = new blockType();\r\n block._deserialize(serializationObject, scene, rootUrl);\r\n return block;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n NodeMaterialBlock.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject.inputs = [];\r\n for (var _i = 0, _a = this.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n NodeMaterialBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n this.name = serializationObject.name;\r\n };\r\n return NodeMaterialBlock;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlockConnectionPoint.ts\":\n/*!************************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlockConnectionPoint.ts ***!\n \\************************************************************/\n/*! exports provided: NodeMaterialConnectionPoint */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return NodeMaterialConnectionPoint; });\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nvar NodeMaterialConnectionPoint = /** @class */ (function () {\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n */\r\n function NodeMaterialConnectionPoint(name, ownerBlock) {\r\n /** @hidden */\r\n this._connectedPoint = null;\r\n this._endpoints = new Array();\r\n /** @hidden */\r\n this._typeConnectionSource = null;\r\n /** @hidden */\r\n this._linkedConnectionSource = null;\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Float;\r\n /** @hidden */\r\n this._enforceAssociatedVariableName = false;\r\n /**\r\n * Gets or sets the additional types supported byt this connection point\r\n */\r\n this.acceptedConnectionPointTypes = new Array();\r\n /** Gets or sets the target of that connection point */\r\n this.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n }\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"associatedVariableName\", {\r\n /**\r\n * Gets or sets the associated variable name in the shader\r\n */\r\n get: function () {\r\n if (this._ownerBlock.isInput) {\r\n return this._ownerBlock.associatedVariableName;\r\n }\r\n if ((!this._enforceAssociatedVariableName || !this._associatedVariableName) && this._connectedPoint) {\r\n return this._connectedPoint.associatedVariableName;\r\n }\r\n return this._associatedVariableName;\r\n },\r\n set: function (value) {\r\n this._associatedVariableName = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"type\", {\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n get: function () {\r\n if (this._type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return this._ownerBlock.type;\r\n }\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n }\r\n if (this._type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput && this._typeConnectionSource) {\r\n return this._typeConnectionSource.type;\r\n }\r\n return this._type;\r\n },\r\n set: function (value) {\r\n this._type = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"isConnected\", {\r\n /**\r\n * Gets a boolean indicating that the current point is connected\r\n */\r\n get: function () {\r\n return this.connectedPoint !== null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"isConnectedToInputBlock\", {\r\n /**\r\n * Gets a boolean indicating that the current point is connected to an input block\r\n */\r\n get: function () {\r\n return this.connectedPoint !== null && this.connectedPoint.ownerBlock.isInput;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"connectInputBlock\", {\r\n /**\r\n * Gets a the connected input block (if any)\r\n */\r\n get: function () {\r\n if (!this.isConnectedToInputBlock) {\r\n return null;\r\n }\r\n return this.connectedPoint.ownerBlock;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"connectedPoint\", {\r\n /** Get the other side of the connection (if any) */\r\n get: function () {\r\n return this._connectedPoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"ownerBlock\", {\r\n /** Get the block that owns this connection point */\r\n get: function () {\r\n return this._ownerBlock;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"sourceBlock\", {\r\n /** Get the block connected on the other side of this connection (if any) */\r\n get: function () {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n return this._connectedPoint.ownerBlock;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"connectedBlocks\", {\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n get: function () {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n return this._endpoints.map(function (e) { return e.ownerBlock; });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"endpoints\", {\r\n /** Gets the list of connected endpoints */\r\n get: function () {\r\n return this._endpoints;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"hasEndpoints\", {\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n get: function () {\r\n return this._endpoints && this._endpoints.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name e.g. \"NodeMaterialConnectionPoint\"\r\n * @returns the class name\r\n */\r\n NodeMaterialConnectionPoint.prototype.getClassName = function () {\r\n return \"NodeMaterialConnectionPoint\";\r\n };\r\n /**\r\n * Gets an boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns true if the connection is possible\r\n */\r\n NodeMaterialConnectionPoint.prototype.canConnectTo = function (connectionPoint) {\r\n if (this.type !== connectionPoint.type && connectionPoint.type !== _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect) {\r\n // Equivalents\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color3) {\r\n return true;\r\n }\r\n }\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color4) {\r\n return true;\r\n }\r\n }\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color3: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3) {\r\n return true;\r\n }\r\n }\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color4: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4) {\r\n return true;\r\n }\r\n }\r\n }\r\n // Accepted types\r\n return (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n NodeMaterialConnectionPoint.prototype.connectTo = function (connectionPoint, ignoreConstraints) {\r\n if (ignoreConstraints === void 0) { ignoreConstraints = false; }\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n throw \"Cannot connect two different connection types.\";\r\n }\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n this._enforceAssociatedVariableName = false;\r\n return this;\r\n };\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n NodeMaterialConnectionPoint.prototype.disconnectFrom = function (endpoint) {\r\n var index = this._endpoints.indexOf(endpoint);\r\n if (index === -1) {\r\n return this;\r\n }\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n this._enforceAssociatedVariableName = false;\r\n endpoint._enforceAssociatedVariableName = false;\r\n return this;\r\n };\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @returns the serialized point object\r\n */\r\n NodeMaterialConnectionPoint.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n if (this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n }\r\n return serializationObject;\r\n };\r\n return NodeMaterialConnectionPoint;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\":\n/*!*****************************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts ***!\n \\*****************************************************************/\n/*! exports provided: NodeMaterialBlockConnectionPointTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return NodeMaterialBlockConnectionPointTypes; });\n/**\r\n * Defines the kind of connection point for node based material\r\n */\r\nvar NodeMaterialBlockConnectionPointTypes;\r\n(function (NodeMaterialBlockConnectionPointTypes) {\r\n /** Float */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Float\"] = 1] = \"Float\";\r\n /** Int */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Int\"] = 2] = \"Int\";\r\n /** Vector2 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Vector2\"] = 4] = \"Vector2\";\r\n /** Vector3 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Vector3\"] = 8] = \"Vector3\";\r\n /** Vector4 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Vector4\"] = 16] = \"Vector4\";\r\n /** Color3 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Color3\"] = 32] = \"Color3\";\r\n /** Color4 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Color4\"] = 64] = \"Color4\";\r\n /** Matrix */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Matrix\"] = 128] = \"Matrix\";\r\n /** Detect type based on connection */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"AutoDetect\"] = 1024] = \"AutoDetect\";\r\n /** Output type that will be defined by input type */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"BasedOnInput\"] = 2048] = \"BasedOnInput\";\r\n})(NodeMaterialBlockConnectionPointTypes || (NodeMaterialBlockConnectionPointTypes = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlockTargets.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlockTargets.ts ***!\n \\****************************************************/\n/*! exports provided: NodeMaterialBlockTargets */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return NodeMaterialBlockTargets; });\n/**\r\n * Enum used to define the target of a block\r\n */\r\nvar NodeMaterialBlockTargets;\r\n(function (NodeMaterialBlockTargets) {\r\n /** Vertex shader */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"Vertex\"] = 1] = \"Vertex\";\r\n /** Fragment shader */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"Fragment\"] = 2] = \"Fragment\";\r\n /** Neutral */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"Neutral\"] = 4] = \"Neutral\";\r\n /** Vertex and Fragment */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"VertexAndFragment\"] = 3] = \"VertexAndFragment\";\r\n})(NodeMaterialBlockTargets || (NodeMaterialBlockTargets = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBuildState.ts\":\n/*!**************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBuildState.ts ***!\n \\**************************************************/\n/*! exports provided: NodeMaterialBuildState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBuildState\", function() { return NodeMaterialBuildState; });\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Misc_stringTools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/stringTools */ \"./Misc/stringTools.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store node based material build state\r\n */\r\nvar NodeMaterialBuildState = /** @class */ (function () {\r\n function NodeMaterialBuildState() {\r\n /** Gets or sets a boolean indicating if the current state can emit uniform buffers */\r\n this.supportUniformBuffers = false;\r\n /**\r\n * Gets the list of emitted attributes\r\n */\r\n this.attributes = new Array();\r\n /**\r\n * Gets the list of emitted uniforms\r\n */\r\n this.uniforms = new Array();\r\n /**\r\n * Gets the list of emitted uniform buffers\r\n */\r\n this.uniformBuffers = new Array();\r\n /**\r\n * Gets the list of emitted samplers\r\n */\r\n this.samplers = new Array();\r\n /**\r\n * Gets the list of emitted functions\r\n */\r\n this.functions = {};\r\n /**\r\n * Gets the list of emitted extensions\r\n */\r\n this.extensions = {};\r\n /**\r\n * Gets the list of emitted counters\r\n */\r\n this.counters = {};\r\n /** @hidden */\r\n this._attributeDeclaration = \"\";\r\n /** @hidden */\r\n this._uniformDeclaration = \"\";\r\n /** @hidden */\r\n this._samplerDeclaration = \"\";\r\n /** @hidden */\r\n this._varyingTransfer = \"\";\r\n this._repeatableContentAnchorIndex = 0;\r\n /** @hidden */\r\n this._builtCompilationString = \"\";\r\n /**\r\n * Gets the emitted compilation strings\r\n */\r\n this.compilationString = \"\";\r\n }\r\n /**\r\n * Finalize the compilation strings\r\n * @param state defines the current compilation state\r\n */\r\n NodeMaterialBuildState.prototype.finalize = function (state) {\r\n var emitComments = state.sharedData.emitComments;\r\n var isFragmentMode = (this.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlockTargets\"].Fragment);\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Entry point\\r\\n\" : \"\") + \"void main(void) {\\r\\n\" + this.compilationString;\r\n var functionCode = \"\";\r\n for (var functionName in this.functions) {\r\n functionCode += this.functions[functionName] + \"\\r\\n\";\r\n }\r\n this.compilationString = \"\\r\\n\" + functionCode + \"\\r\\n\" + this.compilationString;\r\n if (!isFragmentMode && this._varyingTransfer) {\r\n this.compilationString = this.compilationString + \"\\r\\n\" + this._varyingTransfer;\r\n }\r\n this.compilationString = this.compilationString + \"\\r\\n}\";\r\n if (this.sharedData.varyingDeclaration) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Varyings\\r\\n\" : \"\") + this.sharedData.varyingDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n if (this._samplerDeclaration) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Samplers\\r\\n\" : \"\") + this._samplerDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n if (this._uniformDeclaration) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Uniforms\\r\\n\" : \"\") + this._uniformDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n if (this._attributeDeclaration && !isFragmentMode) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Attributes\\r\\n\" : \"\") + this._attributeDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n for (var extensionName in this.extensions) {\r\n var extension = this.extensions[extensionName];\r\n this.compilationString = \"\\r\\n\" + extension + \"\\r\\n\" + this.compilationString;\r\n }\r\n this._builtCompilationString = this.compilationString;\r\n };\r\n Object.defineProperty(NodeMaterialBuildState.prototype, \"_repeatableContentAnchor\", {\r\n /** @hidden */\r\n get: function () {\r\n return \"###___ANCHOR\" + this._repeatableContentAnchorIndex++ + \"___###\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._getFreeVariableName = function (prefix) {\r\n prefix = prefix.replace(/[^a-zA-Z_]+/g, \"\");\r\n if (this.sharedData.variableNames[prefix] === undefined) {\r\n this.sharedData.variableNames[prefix] = 0;\r\n // Check reserved words\r\n if (prefix === \"output\" || prefix === \"texture\") {\r\n return prefix + this.sharedData.variableNames[prefix];\r\n }\r\n return prefix;\r\n }\r\n else {\r\n this.sharedData.variableNames[prefix]++;\r\n }\r\n return prefix + this.sharedData.variableNames[prefix];\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._getFreeDefineName = function (prefix) {\r\n if (this.sharedData.defineNames[prefix] === undefined) {\r\n this.sharedData.defineNames[prefix] = 0;\r\n }\r\n else {\r\n this.sharedData.defineNames[prefix]++;\r\n }\r\n return prefix + this.sharedData.defineNames[prefix];\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._excludeVariableName = function (name) {\r\n this.sharedData.variableNames[name] = 0;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._getGLType = function (type) {\r\n switch (type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n return \"float\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Int:\r\n return \"int\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n return \"vec2\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n return \"vec3\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n return \"vec4\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix:\r\n return \"mat4\";\r\n }\r\n return \"\";\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitExtension = function (name, extension) {\r\n if (this.extensions[name]) {\r\n return;\r\n }\r\n this.extensions[name] = extension;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitFunction = function (name, code, comments) {\r\n if (this.functions[name]) {\r\n return;\r\n }\r\n if (this.sharedData.emitComments) {\r\n code = comments + \"\\r\\n\" + code;\r\n }\r\n this.functions[name] = code;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitCodeFromInclude = function (includeName, comments, options) {\r\n if (options && options.repeatKey) {\r\n return \"#include<\" + includeName + \">[0..\" + options.repeatKey + \"]\\r\\n\";\r\n }\r\n var code = _effect__WEBPACK_IMPORTED_MODULE_2__[\"Effect\"].IncludesShadersStore[includeName] + \"\\r\\n\";\r\n if (this.sharedData.emitComments) {\r\n code = comments + \"\\r\\n\" + code;\r\n }\r\n if (!options) {\r\n return code;\r\n }\r\n if (options.replaceStrings) {\r\n for (var index = 0; index < options.replaceStrings.length; index++) {\r\n var replaceString = options.replaceStrings[index];\r\n code = code.replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n return code;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitFunctionFromInclude = function (includeName, comments, options, storeKey) {\r\n if (storeKey === void 0) { storeKey = \"\"; }\r\n var key = includeName + storeKey;\r\n if (this.functions[key]) {\r\n return;\r\n }\r\n if (!options || (!options.removeAttributes && !options.removeUniforms && !options.removeVaryings && !options.removeIfDef && !options.replaceStrings)) {\r\n if (options && options.repeatKey) {\r\n this.functions[key] = \"#include<\" + includeName + \">[0..\" + options.repeatKey + \"]\\r\\n\";\r\n }\r\n else {\r\n this.functions[key] = \"#include<\" + includeName + \">\\r\\n\";\r\n }\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + \"\\r\\n\" + this.functions[key];\r\n }\r\n return;\r\n }\r\n this.functions[key] = _effect__WEBPACK_IMPORTED_MODULE_2__[\"Effect\"].IncludesShadersStore[includeName];\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + \"\\r\\n\" + this.functions[key];\r\n }\r\n if (options.removeIfDef) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#ifdef.+$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#endif.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#else.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#elif.*$/gm, \"\");\r\n }\r\n if (options.removeAttributes) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?attribute.+$/gm, \"\");\r\n }\r\n if (options.removeUniforms) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?uniform.+$/gm, \"\");\r\n }\r\n if (options.removeVaryings) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?varying.+$/gm, \"\");\r\n }\r\n if (options.replaceStrings) {\r\n for (var index = 0; index < options.replaceStrings.length; index++) {\r\n var replaceString = options.replaceStrings[index];\r\n this.functions[key] = this.functions[key].replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._registerTempVariable = function (name) {\r\n if (this.sharedData.temps.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n this.sharedData.temps.push(name);\r\n return true;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitVaryingFromString = function (name, type, define, notDefine) {\r\n if (define === void 0) { define = \"\"; }\r\n if (notDefine === void 0) { notDefine = false; }\r\n if (this.sharedData.varyings.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n this.sharedData.varyings.push(name);\r\n if (define) {\r\n if (_Misc_stringTools__WEBPACK_IMPORTED_MODULE_3__[\"StringTools\"].StartsWith(define, \"defined(\")) {\r\n this.sharedData.varyingDeclaration += \"#if \" + define + \"\\r\\n\";\r\n }\r\n else {\r\n this.sharedData.varyingDeclaration += (notDefine ? \"#ifndef\" : \"#ifdef\") + \" \" + define + \"\\r\\n\";\r\n }\r\n }\r\n this.sharedData.varyingDeclaration += \"varying \" + type + \" \" + name + \";\\r\\n\";\r\n if (define) {\r\n this.sharedData.varyingDeclaration += \"#endif\\r\\n\";\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitUniformFromString = function (name, type, define, notDefine) {\r\n if (define === void 0) { define = \"\"; }\r\n if (notDefine === void 0) { notDefine = false; }\r\n if (this.uniforms.indexOf(name) !== -1) {\r\n return;\r\n }\r\n this.uniforms.push(name);\r\n if (define) {\r\n this._uniformDeclaration += (notDefine ? \"#ifndef\" : \"#ifdef\") + \" \" + define + \"\\r\\n\";\r\n }\r\n this._uniformDeclaration += \"uniform \" + type + \" \" + name + \";\\r\\n\";\r\n if (define) {\r\n this._uniformDeclaration += \"#endif\\r\\n\";\r\n }\r\n };\r\n return NodeMaterialBuildState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBuildStateSharedData.ts\":\n/*!************************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBuildStateSharedData.ts ***!\n \\************************************************************/\n/*! exports provided: NodeMaterialBuildStateSharedData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBuildStateSharedData\", function() { return NodeMaterialBuildStateSharedData; });\n/**\r\n * Class used to store shared data between 2 NodeMaterialBuildState\r\n */\r\nvar NodeMaterialBuildStateSharedData = /** @class */ (function () {\r\n /** Creates a new shared data */\r\n function NodeMaterialBuildStateSharedData() {\r\n /**\r\n * Gets the list of emitted varyings\r\n */\r\n this.temps = new Array();\r\n /**\r\n * Gets the list of emitted varyings\r\n */\r\n this.varyings = new Array();\r\n /**\r\n * Gets the varying declaration string\r\n */\r\n this.varyingDeclaration = \"\";\r\n /**\r\n * Input blocks\r\n */\r\n this.inputBlocks = new Array();\r\n /**\r\n * Input blocks\r\n */\r\n this.textureBlocks = new Array();\r\n /**\r\n * Bindable blocks (Blocks that need to set data to the effect)\r\n */\r\n this.bindableBlocks = new Array();\r\n /**\r\n * List of blocks that can provide a compilation fallback\r\n */\r\n this.blocksWithFallbacks = new Array();\r\n /**\r\n * List of blocks that can provide a define update\r\n */\r\n this.blocksWithDefines = new Array();\r\n /**\r\n * List of blocks that can provide a repeatable content\r\n */\r\n this.repeatableContentBlocks = new Array();\r\n /**\r\n * List of blocks that can provide a dynamic list of uniforms\r\n */\r\n this.dynamicUniformBlocks = new Array();\r\n /**\r\n * List of blocks that can block the isReady function for the material\r\n */\r\n this.blockingBlocks = new Array();\r\n /**\r\n * Gets the list of animated inputs\r\n */\r\n this.animatedInputs = new Array();\r\n /** List of emitted variables */\r\n this.variableNames = {};\r\n /** List of emitted defines */\r\n this.defineNames = {};\r\n /**\r\n * Gets the compilation hints emitted at compilation time\r\n */\r\n this.hints = {\r\n needWorldViewMatrix: false,\r\n needWorldViewProjectionMatrix: false,\r\n needAlphaBlending: false,\r\n needAlphaTesting: false\r\n };\r\n /**\r\n * List of compilation checks\r\n */\r\n this.checks = {\r\n emitVertex: false,\r\n emitFragment: false,\r\n notConnectedNonOptionalInputs: new Array()\r\n };\r\n // Exclude usual attributes from free variable names\r\n this.variableNames[\"position\"] = 0;\r\n this.variableNames[\"normal\"] = 0;\r\n this.variableNames[\"tangent\"] = 0;\r\n this.variableNames[\"uv\"] = 0;\r\n this.variableNames[\"uv2\"] = 0;\r\n this.variableNames[\"uv3\"] = 0;\r\n this.variableNames[\"uv4\"] = 0;\r\n this.variableNames[\"uv4\"] = 0;\r\n this.variableNames[\"uv5\"] = 0;\r\n this.variableNames[\"uv6\"] = 0;\r\n this.variableNames[\"color\"] = 0;\r\n this.variableNames[\"matricesIndices\"] = 0;\r\n this.variableNames[\"matricesWeights\"] = 0;\r\n this.variableNames[\"matricesIndicesExtra\"] = 0;\r\n this.variableNames[\"matricesWeightsExtra\"] = 0;\r\n this.variableNames[\"diffuseBase\"] = 0;\r\n this.variableNames[\"specularBase\"] = 0;\r\n this.variableNames[\"worldPos\"] = 0;\r\n // Exclude known varyings\r\n this.variableNames[\"vTBN\"] = 0;\r\n // Exclude defines\r\n this.defineNames[\"MAINUV0\"] = 0;\r\n this.defineNames[\"MAINUV1\"] = 0;\r\n this.defineNames[\"MAINUV2\"] = 0;\r\n this.defineNames[\"MAINUV3\"] = 0;\r\n this.defineNames[\"MAINUV4\"] = 0;\r\n this.defineNames[\"MAINUV5\"] = 0;\r\n this.defineNames[\"MAINUV6\"] = 0;\r\n this.defineNames[\"MAINUV7\"] = 0;\r\n }\r\n /**\r\n * Emits console errors and exceptions if there is a failing check\r\n */\r\n NodeMaterialBuildStateSharedData.prototype.emitErrors = function () {\r\n var errorMessage = \"\";\r\n if (!this.checks.emitVertex) {\r\n errorMessage += \"NodeMaterial does not have a vertex output. You need to at least add a block that generates a glPosition value.\\r\\n\";\r\n }\r\n if (!this.checks.emitFragment) {\r\n errorMessage += \"NodeMaterial does not have a fragment output. You need to at least add a block that generates a glFragColor value.\\r\\n\";\r\n }\r\n for (var _i = 0, _a = this.checks.notConnectedNonOptionalInputs; _i < _a.length; _i++) {\r\n var notConnectedInput = _a[_i];\r\n errorMessage += \"input \" + notConnectedInput.name + \" from block \" + notConnectedInput.ownerBlock.name + \"[\" + notConnectedInput.ownerBlock.getClassName() + \"] is not connected and is not optional.\\r\\n\";\r\n }\r\n if (errorMessage) {\r\n throw \"Build of NodeMaterial failed:\\r\\n\" + errorMessage;\r\n }\r\n };\r\n return NodeMaterialBuildStateSharedData;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialSystemValues.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/nodeMaterialSystemValues.ts ***!\n \\****************************************************/\n/*! exports provided: NodeMaterialSystemValues */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return NodeMaterialSystemValues; });\n/**\r\n * Enum used to define system values e.g. values automatically provided by the system\r\n */\r\nvar NodeMaterialSystemValues;\r\n(function (NodeMaterialSystemValues) {\r\n /** World */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"World\"] = 1] = \"World\";\r\n /** View */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"View\"] = 2] = \"View\";\r\n /** Projection */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"Projection\"] = 3] = \"Projection\";\r\n /** ViewProjection */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"ViewProjection\"] = 4] = \"ViewProjection\";\r\n /** WorldView */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"WorldView\"] = 5] = \"WorldView\";\r\n /** WorldViewProjection */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"WorldViewProjection\"] = 6] = \"WorldViewProjection\";\r\n /** CameraPosition */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"CameraPosition\"] = 7] = \"CameraPosition\";\r\n /** Fog Color */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"FogColor\"] = 8] = \"FogColor\";\r\n})(NodeMaterialSystemValues || (NodeMaterialSystemValues = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/index.ts\":\n/*!********************************!*\\\n !*** ./Materials/PBR/index.ts ***!\n \\********************************/\n/*! exports provided: PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pbrBaseMaterial */ \"./Materials/PBR/pbrBaseMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_0__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_0__[\"PBRBaseMaterial\"]; });\n\n/* harmony import */ var _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pbrBaseSimpleMaterial */ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_1__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony import */ var _pbrMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pbrMaterial */ \"./Materials/PBR/pbrMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _pbrMaterial__WEBPACK_IMPORTED_MODULE_2__[\"PBRMaterial\"]; });\n\n/* harmony import */ var _pbrMetallicRoughnessMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pbrMetallicRoughnessMaterial */ \"./Materials/PBR/pbrMetallicRoughnessMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _pbrMetallicRoughnessMaterial__WEBPACK_IMPORTED_MODULE_3__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony import */ var _pbrSpecularGlossinessMaterial__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pbrSpecularGlossinessMaterial */ \"./Materials/PBR/pbrSpecularGlossinessMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _pbrSpecularGlossinessMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRSpecularGlossinessMaterial\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrAnisotropicConfiguration.ts\":\n/*!******************************************************!*\\\n !*** ./Materials/PBR/pbrAnisotropicConfiguration.ts ***!\n \\******************************************************/\n/*! exports provided: PBRAnisotropicConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRAnisotropicConfiguration\", function() { return PBRAnisotropicConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the anisotropic parameters of the pbr material.\r\n */\r\nvar PBRAnisotropicConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of anisotropy configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRAnisotropicConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the anisotropy is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the anisotropy strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines if the effect is along the tangents, bitangents or in between.\r\n * By default, the effect is \"strectching\" the highlights along the tangents.\r\n */\r\n this.direction = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1, 0);\r\n this._texture = null;\r\n /**\r\n * Stores the anisotropy values in a texture.\r\n * rg is direction (like normal from -1 to 1)\r\n * b is a intensity\r\n */\r\n this.texture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRAnisotropicConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param mesh the mesh we are preparing the defines for.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRAnisotropicConfiguration.prototype.prepareDefines = function (defines, mesh, scene) {\r\n if (this._isEnabled) {\r\n defines.ANISOTROPIC = this._isEnabled;\r\n if (this._isEnabled && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].TangentKind)) {\r\n defines._needUVs = true;\r\n defines.MAINUV1 = true;\r\n }\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._texture, defines, \"ANISOTROPIC_TEXTURE\");\r\n }\r\n else {\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.ANISOTROPIC = false;\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vAnisotropyInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindTextureMatrix(this._texture, uniformBuffer, \"anisotropy\");\r\n }\r\n // Anisotropy\r\n uniformBuffer.updateFloat3(\"vAnisotropy\", this.direction.x, this.direction.y, this.intensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n uniformBuffer.setTexture(\"anisotropySampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRAnisotropicConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRAnisotropicConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRAnisotropicConfiguration\"\r\n */\r\n PBRAnisotropicConfiguration.prototype.getClassName = function () {\r\n return \"PBRAnisotropicConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRAnisotropicConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.ANISOTROPIC) {\r\n fallbacks.addFallback(currentRank++, \"ANISOTROPIC\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRAnisotropicConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vAnisotropy\", \"vAnisotropyInfos\", \"anisotropyMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRAnisotropicConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vAnisotropy\", 3);\r\n uniformBuffer.addUniform(\"vAnisotropyInfos\", 2);\r\n uniformBuffer.addUniform(\"anisotropyMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRAnisotropicConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"anisotropySampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param anisotropicConfiguration define the config where to copy the info\r\n */\r\n PBRAnisotropicConfiguration.prototype.copyTo = function (anisotropicConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return anisotropicConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this anisotropy configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRAnisotropicConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRAnisotropicConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRAnisotropicConfiguration.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector2\"])()\r\n ], PBRAnisotropicConfiguration.prototype, \"direction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"texture\", void 0);\r\n return PBRAnisotropicConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrBRDFConfiguration.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/PBR/pbrBRDFConfiguration.ts ***!\n \\***********************************************/\n/*! exports provided: PBRBRDFConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRBRDFConfiguration\", function() { return PBRBRDFConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n\r\n\r\n/**\r\n * Define the code related to the BRDF parameters of the pbr material.\r\n */\r\nvar PBRBRDFConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsMiscDirty Callback to flag the material to dirty\r\n */\r\n function PBRBRDFConfiguration(markAllSubMeshesAsMiscDirty) {\r\n this._useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n /**\r\n * Defines if the material uses energy conservation.\r\n */\r\n this.useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n this._useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses height smith correlated visibility term.\r\n * If you intent to not use our default BRDF, you need to load a separate BRDF Texture for the PBR\r\n * You can either load https://assets.babylonjs.com/environments/uncorrelatedBRDF.png\r\n * or https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds to have more precision\r\n * Not relying on height correlated will also disable energy conservation.\r\n */\r\n this.useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n this._useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses spherical harmonics vs spherical polynomials for the\r\n * diffuse part of the IBL.\r\n * The harmonics despite a tiny bigger cost has been proven to provide closer results\r\n * to the ground truth.\r\n */\r\n this.useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n this._internalMarkAllSubMeshesAsMiscDirty = markAllSubMeshesAsMiscDirty;\r\n }\r\n /** @hidden */\r\n PBRBRDFConfiguration.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._internalMarkAllSubMeshesAsMiscDirty();\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n */\r\n PBRBRDFConfiguration.prototype.prepareDefines = function (defines) {\r\n defines.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated;\r\n defines.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated;\r\n defines.SPHERICAL_HARMONICS = this._useSphericalHarmonics;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRBRDFConfiguration.prototype.getClassName = function () {\r\n return \"PBRBRDFConfiguration\";\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param brdfConfiguration define the config where to copy the info\r\n */\r\n PBRBRDFConfiguration.prototype.copyTo = function (brdfConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return brdfConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRBRDFConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRBRDFConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * Default value used for the energy conservation.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION = true;\r\n /**\r\n * Default value used for the Smith Visibility Height Correlated mode.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true;\r\n /**\r\n * Default value used for the IBL diffuse part.\r\n * This can help switching back to the polynomials mode globally which is a tiny bit\r\n * less GPU intensive at the drawback of a lower quality.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS = true;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useEnergyConservation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSmithVisibilityHeightCorrelated\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSphericalHarmonics\", void 0);\r\n return PBRBRDFConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrBaseMaterial.ts\":\n/*!******************************************!*\\\n !*** ./Materials/PBR/pbrBaseMaterial.ts ***!\n \\******************************************/\n/*! exports provided: PBRMaterialDefines, PBRBaseMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return PBRMaterialDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return PBRBaseMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/brdfTextureTools */ \"./Misc/brdfTextureTools.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./pbrClearCoatConfiguration */ \"./Materials/PBR/pbrClearCoatConfiguration.ts\");\n/* harmony import */ var _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./pbrAnisotropicConfiguration */ \"./Materials/PBR/pbrAnisotropicConfiguration.ts\");\n/* harmony import */ var _pbrBRDFConfiguration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pbrBRDFConfiguration */ \"./Materials/PBR/pbrBRDFConfiguration.ts\");\n/* harmony import */ var _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./pbrSheenConfiguration */ \"./Materials/PBR/pbrSheenConfiguration.ts\");\n/* harmony import */ var _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./pbrSubSurfaceConfiguration */ \"./Materials/PBR/pbrSubSurfaceConfiguration.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Materials/pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_pbr_fragment__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../Shaders/pbr.fragment */ \"./Shaders/pbr.fragment.ts\");\n/* harmony import */ var _Shaders_pbr_vertex__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../Shaders/pbr.vertex */ \"./Shaders/pbr.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manages the defines for the PBR Material.\r\n * @hidden\r\n */\r\nvar PBRMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRMaterialDefines, _super);\r\n /**\r\n * Initializes the PBR Material defines.\r\n */\r\n function PBRMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.PBR = true;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.ALBEDO = false;\r\n _this.ALBEDODIRECTUV = 0;\r\n _this.VERTEXCOLOR = false;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.AMBIENTINGRAYSCALE = false;\r\n _this.OPACITY = false;\r\n _this.VERTEXALPHA = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHABLEND = false;\r\n _this.ALPHAFROMALBEDO = false;\r\n _this.ALPHATESTVALUE = \"0.5\";\r\n _this.SPECULAROVERALPHA = false;\r\n _this.RADIANCEOVERALPHA = false;\r\n _this.ALPHAFRESNEL = false;\r\n _this.LINEARALPHAFRESNEL = false;\r\n _this.PREMULTIPLYALPHA = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.REFLECTIVITY = false;\r\n _this.REFLECTIVITYDIRECTUV = 0;\r\n _this.SPECULARTERM = false;\r\n _this.MICROSURFACEFROMREFLECTIVITYMAP = false;\r\n _this.MICROSURFACEAUTOMATIC = false;\r\n _this.LODBASEDMICROSFURACE = false;\r\n _this.MICROSURFACEMAP = false;\r\n _this.MICROSURFACEMAPDIRECTUV = 0;\r\n _this.METALLICWORKFLOW = false;\r\n _this.ROUGHNESSSTOREINMETALMAPALPHA = false;\r\n _this.ROUGHNESSSTOREINMETALMAPGREEN = false;\r\n _this.METALLNESSSTOREINMETALMAPBLUE = false;\r\n _this.AOSTOREINMETALMAPRED = false;\r\n _this.ENVIRONMENTBRDF = false;\r\n _this.ENVIRONMENTBRDF_RGBD = false;\r\n _this.NORMAL = false;\r\n _this.TANGENT = false;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.NORMALXYSCALE = true;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.GAMMALIGHTMAP = false;\r\n _this.RGBDLIGHTMAP = false;\r\n _this.REFLECTION = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.USESPHERICALFROMREFLECTIONMAP = false;\r\n _this.USEIRRADIANCEMAP = false;\r\n _this.SPHERICAL_HARMONICS = false;\r\n _this.USESPHERICALINVERTEX = false;\r\n _this.REFLECTIONMAP_OPPOSITEZ = false;\r\n _this.LODINREFLECTIONALPHA = false;\r\n _this.GAMMAREFLECTION = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.LINEARSPECULARREFLECTION = false;\r\n _this.RADIANCEOCCLUSION = false;\r\n _this.HORIZONOCCLUSION = false;\r\n _this.INSTANCES = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.NONUNIFORMSCALING = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.MULTIVIEW = false;\r\n _this.USEPHYSICALLIGHTFALLOFF = false;\r\n _this.USEGLTFLIGHTFALLOFF = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.FORCENORMALFORWARD = false;\r\n _this.SPECULARAA = false;\r\n _this.CLEARCOAT = false;\r\n _this.CLEARCOAT_DEFAULTIOR = false;\r\n _this.CLEARCOAT_TEXTURE = false;\r\n _this.CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n _this.CLEARCOAT_BUMP = false;\r\n _this.CLEARCOAT_BUMPDIRECTUV = 0;\r\n _this.CLEARCOAT_TINT = false;\r\n _this.CLEARCOAT_TINT_TEXTURE = false;\r\n _this.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n _this.ANISOTROPIC = false;\r\n _this.ANISOTROPIC_TEXTURE = false;\r\n _this.ANISOTROPIC_TEXTUREDIRECTUV = 0;\r\n _this.BRDF_V_HEIGHT_CORRELATED = false;\r\n _this.MS_BRDF_ENERGY_CONSERVATION = false;\r\n _this.SHEEN = false;\r\n _this.SHEEN_TEXTURE = false;\r\n _this.SHEEN_TEXTUREDIRECTUV = 0;\r\n _this.SHEEN_LINKWITHALBEDO = false;\r\n _this.SUBSURFACE = false;\r\n _this.SS_REFRACTION = false;\r\n _this.SS_TRANSLUCENCY = false;\r\n _this.SS_SCATERRING = false;\r\n _this.SS_THICKNESSANDMASK_TEXTURE = false;\r\n _this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0;\r\n _this.SS_REFRACTIONMAP_3D = false;\r\n _this.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n _this.SS_LODINREFRACTIONALPHA = false;\r\n _this.SS_GAMMAREFRACTION = false;\r\n _this.SS_RGBDREFRACTION = false;\r\n _this.SS_LINEARSPECULARREFRACTION = false;\r\n _this.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n _this.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n _this.UNLIT = false;\r\n _this.DEBUGMODE = 0;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n /**\r\n * Resets the PBR Material defines.\r\n */\r\n PBRMaterialDefines.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this.ALPHATESTVALUE = \"0.5\";\r\n this.PBR = true;\r\n };\r\n return PBRMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_16__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * The Physically based material base class of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRBaseMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRBaseMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRBaseMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this._directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this._emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this._environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this._specularIntensity = 1.0;\r\n /**\r\n * This stores the direct, emissive, environment, and specular light intensities into a Vector4.\r\n */\r\n _this._lightingInfos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_6__[\"Vector4\"](_this._directIntensity, _this._emissiveIntensity, _this._environmentIntensity, _this._specularIntensity);\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this._disableBumpMap = false;\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n _this._albedoTexture = null;\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n _this._ambientTexture = null;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this._ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this._ambientTextureImpactOnAnalyticalLights = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * Stores the alpha values in a texture.\r\n */\r\n _this._opacityTexture = null;\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n _this._reflectionTexture = null;\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n _this._emissiveTexture = null;\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n _this._reflectivityTexture = null;\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n _this._metallicTexture = null;\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n _this._metallic = null;\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n _this._roughness = null;\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n _this._microSurfaceTexture = null;\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n _this._bumpTexture = null;\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n _this._lightmapTexture = null;\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this._ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this._albedoColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this._reflectivityColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](1, 1, 1);\r\n /**\r\n * The color applied when light is reflected from a material.\r\n */\r\n _this._reflectionColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](1, 1, 1);\r\n /**\r\n * The color applied when light is emitted from a material.\r\n */\r\n _this._emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this._microSurface = 0.9;\r\n /**\r\n * Specifies that the material will use the light map as a show map.\r\n */\r\n _this._useLightmapAsShadowmap = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this._useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this._useRadianceOcclusion = true;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this._useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this._useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this._useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this._useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this._useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this._useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this._useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Defines the falloff type used in this material.\r\n * It by default is Physical.\r\n */\r\n _this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this._useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this._useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this._useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this._parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this._disableLighting = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this._maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n */\r\n _this._invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n */\r\n _this._invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this._twoSidedLighting = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this._alphaCutOff = 0.4;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this._forceAlphaTest = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this._useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this._useLinearAlphaFresnel = false;\r\n /**\r\n * The transparency mode of the material.\r\n */\r\n _this._transparencyMode = null;\r\n /**\r\n * Specifies the environment BRDF texture used to comput the scale and offset roughness values\r\n * from cos thetav and roughness:\r\n * http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf\r\n */\r\n _this._environmentBRDFTexture = null;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this._forceIrradianceInFragment = false;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this._forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this._enableSpecularAntiAliasing = false;\r\n /**\r\n * Keep track of the image processing observer to allow dispose and replace.\r\n */\r\n _this._imageProcessingObserver = null;\r\n /**\r\n * Stores the available render targets.\r\n */\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_3__[\"SmartArray\"](16);\r\n /**\r\n * Sets the global ambient color for the material used in lighting calculations.\r\n */\r\n _this._globalAmbientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](0, 0, 0);\r\n /**\r\n * Enables the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n _this._useLogarithmicDepth = false;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this._unlit = false;\r\n _this._debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Defines the material debug mode.\r\n * It helps seeing only some components of the material while troubleshooting.\r\n */\r\n _this.debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Specify from where on screen the debug mode should start.\r\n * The value goes from -1 (full screen) to 1 (not visible)\r\n * It helps with side by side comparison against the final render\r\n * This defaults to -1\r\n */\r\n _this.debugLimit = -1;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * As the default viewing range might not be enough (if the ambient is really small for instance)\r\n * You can use the factor to better multiply the final value.\r\n */\r\n _this.debugFactor = 1;\r\n /**\r\n * Defines the clear coat layer parameters for the material.\r\n */\r\n _this.clearCoat = new _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the anisotropic parameters for the material.\r\n */\r\n _this.anisotropy = new _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the BRDF parameters for the material.\r\n */\r\n _this.brdf = new _pbrBRDFConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"PBRBRDFConfiguration\"](_this._markAllSubMeshesAsMiscDirty.bind(_this));\r\n /**\r\n * Defines the Sheen parameters for the material.\r\n */\r\n _this.sheen = new _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the SubSurface parameters for the material.\r\n */\r\n _this.subSurface = new _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n _this.subSurface.fillRenderTargetTextures(_this._renderTargets);\r\n return _this._renderTargets;\r\n };\r\n _this._environmentBRDFTexture = _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_4__[\"BRDFTextureTools\"].GetEnvironmentBRDFTexture(scene);\r\n return _this;\r\n }\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration\r\n */\r\n PBRBaseMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return this.subSurface.hasRenderTargetTextures();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the name of the material class.\r\n */\r\n PBRBaseMaterial.prototype.getClassName = function () {\r\n return \"PBRBaseMaterial\";\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"transparencyMode\", {\r\n /**\r\n * Gets the current transparency mode.\r\n */\r\n get: function () {\r\n return this._transparencyMode;\r\n },\r\n /**\r\n * Sets the transparency mode of the material.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | OPAQUE | |\r\n * | 1 | ALPHATEST | |\r\n * | 2 | ALPHABLEND | |\r\n * | 3 | ALPHATESTANDBLEND | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._transparencyMode === value) {\r\n return;\r\n }\r\n this._transparencyMode = value;\r\n this._forceAlphaTest = (value === PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND);\r\n this._markAllSubMeshesAsTexturesAndMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"_disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return (this.subSurface.disableAlphaBlending ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_OPAQUE ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromAlbedoTexture();\r\n };\r\n /**\r\n * Specifies if the mesh will require alpha blending.\r\n * @param mesh - BJS mesh.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaBlendingForMesh = function (mesh) {\r\n if (this._disableAlphaBlending && mesh.visibility >= 1.0) {\r\n return false;\r\n }\r\n return _super.prototype.needAlphaBlendingForMesh.call(this, mesh);\r\n };\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n if (this.subSurface.disableAlphaBlending) {\r\n return false;\r\n }\r\n return this._albedoTexture != null && this._albedoTexture.hasAlpha && (this._transparencyMode == null || this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n };\r\n /**\r\n * Specifies whether or not the alpha value of the albedo texture should be used for alpha blending.\r\n */\r\n PBRBaseMaterial.prototype._shouldUseAlphaFromAlbedoTexture = function () {\r\n return this._albedoTexture != null && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n };\r\n /**\r\n * Gets the texture used for the alpha test.\r\n */\r\n PBRBaseMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._albedoTexture;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param mesh - BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh. Used to check if it is ready.\r\n * @param useInstances - Specifies that instances should be used.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRBaseMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new PBRMaterialDefines();\r\n }\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === this.getScene().getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (!reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n if (reflectionTexture.irradianceTexture && !reflectionTexture.irradianceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n if (!this._metallicTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n else if (this._reflectivityTexture) {\r\n if (!this._reflectivityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._microSurfaceTexture) {\r\n if (!this._microSurfaceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._environmentBRDFTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n // This is blocking.\r\n if (!this._environmentBRDFTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n if (!this.subSurface.isReadyForSubMesh(defines, scene) ||\r\n !this.clearCoat.isReadyForSubMesh(defines, scene, engine, this._disableBumpMap) ||\r\n !this.sheen.isReadyForSubMesh(defines, scene) ||\r\n !this.anisotropy.isReadyForSubMesh(defines, scene)) {\r\n return false;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (!engine.getCaps().standardDerivatives && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].NormalKind)) {\r\n mesh.createNormals(true);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"PBRMaterial: Normals have been created for the mesh: \" + mesh.name);\r\n }\r\n var previousEffect = subMesh.effect;\r\n var lightDisposed = defines._areLightsDisposed;\r\n var effect = this._prepareEffect(mesh, defines, this.onCompiled, this.onError, useInstances);\r\n if (effect) {\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Specifies if the material uses metallic roughness workflow.\r\n * @returns boolean specifiying if the material uses metallic roughness workflow.\r\n */\r\n PBRBaseMaterial.prototype.isMetallicWorkflow = function () {\r\n if (this._metallic != null || this._roughness != null || this._metallicTexture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n PBRBaseMaterial.prototype._prepareEffect = function (mesh, defines, onCompiled, onError, useInstances, useClipPlane) {\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n this._prepareDefines(mesh, defines, useInstances, useClipPlane);\r\n if (!defines.isDirty) {\r\n return null;\r\n }\r\n defines.markAsProcessed();\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Fallbacks\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_15__[\"EffectFallbacks\"]();\r\n var fallbackRank = 0;\r\n if (defines.USESPHERICALINVERTEX) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALINVERTEX\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(fallbackRank, \"FOG\");\r\n }\r\n if (defines.SPECULARAA) {\r\n fallbacks.addFallback(fallbackRank, \"SPECULARAA\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(fallbackRank, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(fallbackRank, \"LOGARITHMICDEPTH\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(fallbackRank, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(fallbackRank++, \"PARALLAXOCCLUSION\");\r\n }\r\n fallbackRank = _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n if (defines.ENVIRONMENTBRDF) {\r\n fallbacks.addFallback(fallbackRank++, \"ENVIRONMENTBRDF\");\r\n }\r\n if (defines.TANGENT) {\r\n fallbacks.addFallback(fallbackRank++, \"TANGENT\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(fallbackRank++, \"BUMP\");\r\n }\r\n fallbackRank = _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights, fallbackRank++);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(fallbackRank++, \"SPECULARTERM\");\r\n }\r\n if (defines.USESPHERICALFROMREFLECTIONMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALFROMREFLECTIONMAP\");\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USEIRRADIANCEMAP\");\r\n }\r\n if (defines.LIGHTMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"LIGHTMAP\");\r\n }\r\n if (defines.NORMAL) {\r\n fallbacks.addFallback(fallbackRank++, \"NORMAL\");\r\n }\r\n if (defines.AMBIENT) {\r\n fallbacks.addFallback(fallbackRank++, \"AMBIENT\");\r\n }\r\n if (defines.EMISSIVE) {\r\n fallbacks.addFallback(fallbackRank++, \"EMISSIVE\");\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n fallbacks.addFallback(fallbackRank++, \"VERTEXCOLOR\");\r\n }\r\n if (defines.MORPHTARGETS) {\r\n fallbacks.addFallback(fallbackRank++, \"MORPHTARGETS\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].NormalKind);\r\n }\r\n if (defines.TANGENT) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].TangentKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].ColorKind);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareAttributesForInstances(attribs, defines);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"pbr\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vAlbedoColor\", \"vReflectivityColor\", \"vEmissiveColor\", \"visibility\", \"vReflectionColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vAlbedoInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vReflectionPosition\", \"vReflectionSize\", \"vEmissiveInfos\", \"vReflectivityInfos\",\r\n \"vMicroSurfaceSamplerInfos\", \"vBumpInfos\", \"vLightmapInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"albedoMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"reflectivityMatrix\", \"normalMatrix\", \"microSurfaceSamplerMatrix\", \"bumpMatrix\", \"lightmapMatrix\",\r\n \"vLightingIntensity\",\r\n \"logarithmicDepthConstant\",\r\n \"vSphericalX\", \"vSphericalY\", \"vSphericalZ\",\r\n \"vSphericalXX_ZZ\", \"vSphericalYY_ZZ\", \"vSphericalZZ\",\r\n \"vSphericalXY\", \"vSphericalYZ\", \"vSphericalZX\",\r\n \"vSphericalL00\",\r\n \"vSphericalL1_1\", \"vSphericalL10\", \"vSphericalL11\",\r\n \"vSphericalL2_2\", \"vSphericalL2_1\", \"vSphericalL20\", \"vSphericalL21\", \"vSphericalL22\",\r\n \"vReflectionMicrosurfaceInfos\",\r\n \"vTangentSpaceParams\", \"boneTextureWidth\",\r\n \"vDebugMode\"\r\n ];\r\n var samplers = [\"albedoSampler\", \"reflectivitySampler\", \"ambientSampler\", \"emissiveSampler\",\r\n \"bumpSampler\", \"lightmapSampler\", \"opacitySampler\",\r\n \"reflectionSampler\", \"reflectionSamplerLow\", \"reflectionSamplerHigh\", \"irradianceSampler\",\r\n \"microSurfaceSampler\", \"environmentBrdfSampler\", \"boneSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].AddUniforms(uniforms);\r\n _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].AddSamplers(samplers);\r\n _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"].AddUniforms(uniforms);\r\n _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"].AddSamplers(samplers);\r\n _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddUniforms(uniforms);\r\n _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddSamplers(samplers);\r\n _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].AddUniforms(uniforms);\r\n _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].AddSamplers(samplers);\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, defines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, defines);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines);\r\n }\r\n var join = defines.toString();\r\n return engine.createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: onCompiled,\r\n onError: onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS }\r\n }, engine);\r\n };\r\n PBRBaseMaterial.prototype._prepareDefines = function (mesh, defines, useInstances, useClipPlane) {\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Lights\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n defines._needNormals = true;\r\n // Multiview\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMultiview(scene, defines);\r\n // Textures\r\n defines.METALLICWORKFLOW = this.isMetallicWorkflow();\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (scene.getEngine().getCaps().textureLOD) {\r\n defines.LODBASEDMICROSFURACE = true;\r\n }\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._albedoTexture, defines, \"ALBEDO\");\r\n }\r\n else {\r\n defines.ALBEDO = false;\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n defines.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale;\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n defines.REFLECTION = true;\r\n defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;\r\n defines.RGBDREFLECTION = reflectionTexture.isRGBD;\r\n defines.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;\r\n defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;\r\n defines.LINEARSPECULARREFLECTION = reflectionTexture.linearSpecularLOD;\r\n if (reflectionTexture.coordinatesMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].INVCUBIC_MODE) {\r\n defines.INVERTCUBICMAP = true;\r\n }\r\n defines.REFLECTIONMAP_3D = reflectionTexture.isCube;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n switch (reflectionTexture.coordinatesMode) {\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].EXPLICIT_MODE:\r\n defines.REFLECTIONMAP_EXPLICIT = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].PLANAR_MODE:\r\n defines.REFLECTIONMAP_PLANAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].PROJECTION_MODE:\r\n defines.REFLECTIONMAP_PROJECTION = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].SKYBOX_MODE:\r\n defines.REFLECTIONMAP_SKYBOX = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].SPHERICAL_MODE:\r\n defines.REFLECTIONMAP_SPHERICAL = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].FIXED_EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].CUBIC_MODE:\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].INVCUBIC_MODE:\r\n default:\r\n defines.REFLECTIONMAP_CUBIC = true;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = reflectionTexture.boundingBoxSize ? true : false;\r\n break;\r\n }\r\n if (reflectionTexture.coordinatesMode !== _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].SKYBOX_MODE) {\r\n if (reflectionTexture.irradianceTexture) {\r\n defines.USEIRRADIANCEMAP = true;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n }\r\n else if (reflectionTexture.sphericalPolynomial) {\r\n defines.USESPHERICALFROMREFLECTIONMAP = true;\r\n defines.USEIRRADIANCEMAP = false;\r\n if (this._forceIrradianceInFragment || scene.getEngine().getCaps().maxVaryingVectors <= 8) {\r\n defines.USESPHERICALINVERTEX = false;\r\n }\r\n else {\r\n defines.USESPHERICALINVERTEX = true;\r\n }\r\n }\r\n }\r\n else {\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = !reflectionTexture.getReflectionTextureMatrix().isIdentity();\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n defines.REFLECTIONMAP_3D = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.INVERTCUBICMAP = false;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n defines.USEIRRADIANCEMAP = false;\r\n defines.USESPHERICALINVERTEX = false;\r\n defines.REFLECTIONMAP_OPPOSITEZ = false;\r\n defines.LODINREFLECTIONALPHA = false;\r\n defines.GAMMAREFLECTION = false;\r\n defines.RGBDREFLECTION = false;\r\n defines.LINEARSPECULARREFLECTION = false;\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n defines.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace;\r\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._metallicTexture, defines, \"REFLECTIVITY\");\r\n defines.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha;\r\n defines.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen;\r\n defines.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue;\r\n defines.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed;\r\n }\r\n else if (this._reflectivityTexture) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._reflectivityTexture, defines, \"REFLECTIVITY\");\r\n defines.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha;\r\n defines.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap;\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n }\r\n if (this._microSurfaceTexture) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._microSurfaceTexture, defines, \"MICROSURFACEMAP\");\r\n }\r\n else {\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n if (this._useParallax && this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n defines.PARALLAX = true;\r\n defines.PARALLAXOCCLUSION = !!this._useParallaxOcclusion;\r\n }\r\n else {\r\n defines.PARALLAX = false;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._environmentBRDFTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n defines.ENVIRONMENTBRDF = true;\r\n // Not actual true RGBD, only the B chanel is encoded as RGBD for sheen.\r\n defines.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD;\r\n }\r\n else {\r\n defines.ENVIRONMENTBRDF = false;\r\n defines.ENVIRONMENTBRDF_RGBD = false;\r\n }\r\n if (this._shouldUseAlphaFromAlbedoTexture()) {\r\n defines.ALPHAFROMALBEDO = true;\r\n }\r\n else {\r\n defines.ALPHAFROMALBEDO = false;\r\n }\r\n }\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_STANDARD) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n else if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = true;\r\n }\r\n else {\r\n defines.USEPHYSICALLIGHTFALLOFF = true;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n defines.RADIANCEOVERALPHA = this._useRadianceOverAlpha;\r\n if (!this.backFaceCulling && this._twoSidedLighting) {\r\n defines.TWOSIDEDLIGHTING = true;\r\n }\r\n else {\r\n defines.TWOSIDEDLIGHTING = false;\r\n }\r\n defines.SPECULARAA = scene.getEngine().getCaps().standardDerivatives && this._enableSpecularAntiAliasing;\r\n }\r\n if (defines._areTexturesDirty || defines._areMiscDirty) {\r\n defines.ALPHATESTVALUE = \"\" + this._alphaCutOff + (this._alphaCutOff % 1 === 0 ? \".\" : \"\");\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_21__[\"Constants\"].ALPHA_PREMULTIPLIED || this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_21__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF);\r\n defines.ALPHABLEND = this.needAlphaBlendingForMesh(mesh);\r\n defines.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel;\r\n defines.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n defines.FORCENORMALFORWARD = this._forceNormalForward;\r\n defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;\r\n defines.HORIZONOCCLUSION = this._useHorizonOcclusion;\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);\r\n defines.UNLIT = this._unlit || ((this.pointsCloud || this.wireframe) && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].NormalKind));\r\n defines.DEBUGMODE = this._debugMode;\r\n }\r\n // External config\r\n this.subSurface.prepareDefines(defines, scene);\r\n this.clearCoat.prepareDefines(defines, scene);\r\n this.anisotropy.prepareDefines(defines, mesh, scene);\r\n this.brdf.prepareDefines(defines);\r\n this.sheen.prepareDefines(defines, scene);\r\n // Values that need to be evaluated on every frame\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, useClipPlane);\r\n // Attribs\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE);\r\n };\r\n /**\r\n * Force shader compilation\r\n */\r\n PBRBaseMaterial.prototype.forceCompilation = function (mesh, onCompiled, options) {\r\n var _this = this;\r\n var localOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ clipPlane: false }, options);\r\n var defines = new PBRMaterialDefines();\r\n var effect = this._prepareEffect(mesh, defines, undefined, undefined, undefined, localOptions.clipPlane);\r\n if (effect.isReady()) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n }\r\n else {\r\n effect.onCompileObservable.add(function () {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Initializes the uniform buffer layout for the shader.\r\n */\r\n PBRBaseMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"vAlbedoInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 4);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vReflectivityInfos\", 3);\r\n ubo.addUniform(\"vMicroSurfaceSamplerInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"albedoMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"reflectivityMatrix\", 16);\r\n ubo.addUniform(\"microSurfaceSamplerMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"vReflectionColor\", 3);\r\n ubo.addUniform(\"vAlbedoColor\", 4);\r\n ubo.addUniform(\"vLightingIntensity\", 4);\r\n ubo.addUniform(\"vReflectionMicrosurfaceInfos\", 3);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"vReflectivityColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"].PrepareUniformBuffer(ubo);\r\n _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].PrepareUniformBuffer(ubo);\r\n _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].PrepareUniformBuffer(ubo);\r\n _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].PrepareUniformBuffer(ubo);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n PBRBaseMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this.subSurface.unbind(this._activeEffect)) {\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh data.\r\n * @param world - The world matrix.\r\n * @param mesh - The BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh.\r\n */\r\n PBRBaseMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindBonesParameters(mesh, this._activeEffect);\r\n var reflectionTexture = null;\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n var engine = scene.getEngine();\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n reflectionTexture = this._getReflectionTexture();\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n // Texture uniforms\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vAlbedoInfos\", this._albedoTexture.coordinatesIndex, this._albedoTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._albedoTexture, ubo, \"albedo\");\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n ubo.updateFloat4(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n ubo.updateMatrix(\"reflectionMatrix\", reflectionTexture.getReflectionTextureMatrix());\r\n ubo.updateFloat2(\"vReflectionInfos\", reflectionTexture.level, 0);\r\n if (reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n if (!defines.USEIRRADIANCEMAP) {\r\n var polynomials = reflectionTexture.sphericalPolynomial;\r\n if (defines.USESPHERICALFROMREFLECTIONMAP && polynomials) {\r\n if (defines.SPHERICAL_HARMONICS) {\r\n var preScaledHarmonics = polynomials.preScaledHarmonics;\r\n this._activeEffect.setVector3(\"vSphericalL00\", preScaledHarmonics.l00);\r\n this._activeEffect.setVector3(\"vSphericalL1_1\", preScaledHarmonics.l1_1);\r\n this._activeEffect.setVector3(\"vSphericalL10\", preScaledHarmonics.l10);\r\n this._activeEffect.setVector3(\"vSphericalL11\", preScaledHarmonics.l11);\r\n this._activeEffect.setVector3(\"vSphericalL2_2\", preScaledHarmonics.l2_2);\r\n this._activeEffect.setVector3(\"vSphericalL2_1\", preScaledHarmonics.l2_1);\r\n this._activeEffect.setVector3(\"vSphericalL20\", preScaledHarmonics.l20);\r\n this._activeEffect.setVector3(\"vSphericalL21\", preScaledHarmonics.l21);\r\n this._activeEffect.setVector3(\"vSphericalL22\", preScaledHarmonics.l22);\r\n }\r\n else {\r\n this._activeEffect.setFloat3(\"vSphericalX\", polynomials.x.x, polynomials.x.y, polynomials.x.z);\r\n this._activeEffect.setFloat3(\"vSphericalY\", polynomials.y.x, polynomials.y.y, polynomials.y.z);\r\n this._activeEffect.setFloat3(\"vSphericalZ\", polynomials.z.x, polynomials.z.y, polynomials.z.z);\r\n this._activeEffect.setFloat3(\"vSphericalXX_ZZ\", polynomials.xx.x - polynomials.zz.x, polynomials.xx.y - polynomials.zz.y, polynomials.xx.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalYY_ZZ\", polynomials.yy.x - polynomials.zz.x, polynomials.yy.y - polynomials.zz.y, polynomials.yy.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZZ\", polynomials.zz.x, polynomials.zz.y, polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalXY\", polynomials.xy.x, polynomials.xy.y, polynomials.xy.z);\r\n this._activeEffect.setFloat3(\"vSphericalYZ\", polynomials.yz.x, polynomials.yz.y, polynomials.yz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZX\", polynomials.zx.x, polynomials.zx.y, polynomials.zx.z);\r\n }\r\n }\r\n }\r\n ubo.updateFloat3(\"vReflectionMicrosurfaceInfos\", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._metallicTexture, ubo, \"reflectivity\");\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1.0);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._reflectivityTexture, ubo, \"reflectivity\");\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.updateFloat2(\"vMicroSurfaceSamplerInfos\", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._microSurfaceTexture, ubo, \"microSurfaceSampler\");\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n // Colors\r\n if (defines.METALLICWORKFLOW) {\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"TmpColors\"].Color3[0].r = (this._metallic === undefined || this._metallic === null) ? 1 : this._metallic;\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"TmpColors\"].Color3[0].g = (this._roughness === undefined || this._roughness === null) ? 1 : this._roughness;\r\n ubo.updateColor4(\"vReflectivityColor\", _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"TmpColors\"].Color3[0], 0);\r\n }\r\n else {\r\n ubo.updateColor4(\"vReflectivityColor\", this._reflectivityColor, this._microSurface);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled ? this._emissiveColor : _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"].BlackReadOnly);\r\n ubo.updateColor3(\"vReflectionColor\", this._reflectionColor);\r\n if (!defines.SS_REFRACTION && this.subSurface.linkRefractionWithTransparency) {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, 1);\r\n }\r\n else {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, this.alpha);\r\n }\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Misc\r\n this._lightingInfos.x = this._directIntensity;\r\n this._lightingInfos.y = this._emissiveIntensity;\r\n this._lightingInfos.z = this._environmentIntensity * scene.environmentIntensity;\r\n this._lightingInfos.w = this._specularIntensity;\r\n ubo.updateVector4(\"vLightingIntensity\", this._lightingInfos);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n ubo.setTexture(\"albedoSampler\", this._albedoTexture);\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n ubo.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n ubo.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (defines.LODBASEDMICROSFURACE) {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture._lodTextureMid || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerLow\", reflectionTexture._lodTextureLow || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerHigh\", reflectionTexture._lodTextureHigh || reflectionTexture);\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n ubo.setTexture(\"irradianceSampler\", reflectionTexture.irradianceTexture);\r\n }\r\n }\r\n if (defines.ENVIRONMENTBRDF) {\r\n ubo.setTexture(\"environmentBrdfSampler\", this._environmentBRDFTexture);\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n ubo.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n ubo.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._reflectivityTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.setTexture(\"microSurfaceSampler\", this._microSurfaceTexture);\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n }\r\n this.subSurface.bindForSubMesh(ubo, scene, engine, this.isFrozen, defines.LODBASEDMICROSFURACE);\r\n this.clearCoat.bindForSubMesh(ubo, scene, engine, this._disableBumpMap, this.isFrozen, this._invertNormalMapX, this._invertNormalMapY);\r\n this.anisotropy.bindForSubMesh(ubo, scene, this.isFrozen);\r\n this.sheen.bindForSubMesh(ubo, scene, this.isFrozen);\r\n // Clip plane\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindClipPlane(this._activeEffect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor);\r\n var eyePosition = scene._forcedViewPosition ? scene._forcedViewPosition : (scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.globalPosition);\r\n var invertNormal = (scene.useRightHandedSystem === (scene._mirroredCameraPosition != null));\r\n effect.setFloat4(\"vEyePosition\", eyePosition.x, eyePosition.y, eyePosition.z, invertNormal ? -1 : 1);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n effect.setFloat2(\"vDebugMode\", this.debugLimit, this.debugFactor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights, this._lightFalloff !== PBRBaseMaterial.LIGHTFALLOFF_STANDARD, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].FOGMODE_NONE || reflectionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindFogParameters(scene, mesh, this._activeEffect, true);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._activeEffect);\r\n }\r\n // image processing\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n // Log. depth\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindLogDepth(defines, this._activeEffect, scene);\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @returns - Array of animatable textures.\r\n */\r\n PBRBaseMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0) {\r\n results.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0) {\r\n results.push(this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0) {\r\n results.push(this._reflectivityTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n this.subSurface.getAnimatables(results);\r\n this.clearCoat.getAnimatables(results);\r\n this.sheen.getAnimatables(results);\r\n this.anisotropy.getAnimatables(results);\r\n return results;\r\n };\r\n /**\r\n * Returns the texture used for reflections.\r\n * @returns - Reflection texture if present. Otherwise, returns the environment texture.\r\n */\r\n PBRBaseMaterial.prototype._getReflectionTexture = function () {\r\n if (this._reflectionTexture) {\r\n return this._reflectionTexture;\r\n }\r\n return this.getScene().environmentTexture;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @returns - Array of BaseTextures\r\n */\r\n PBRBaseMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._albedoTexture) {\r\n activeTextures.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._reflectivityTexture) {\r\n activeTextures.push(this._reflectivityTexture);\r\n }\r\n if (this._metallicTexture) {\r\n activeTextures.push(this._metallicTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n activeTextures.push(this._microSurfaceTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n this.subSurface.getActiveTextures(activeTextures);\r\n this.clearCoat.getActiveTextures(activeTextures);\r\n this.sheen.getActiveTextures(activeTextures);\r\n this.anisotropy.getActiveTextures(activeTextures);\r\n return activeTextures;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRBaseMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._albedoTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectivityTexture === texture) {\r\n return true;\r\n }\r\n if (this._metallicTexture === texture) {\r\n return true;\r\n }\r\n if (this._microSurfaceTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n return this.subSurface.hasTexture(texture) ||\r\n this.clearCoat.hasTexture(texture) ||\r\n this.sheen.hasTexture(texture) ||\r\n this.anisotropy.hasTexture(texture);\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeEffect - Forces the disposal of effects.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRBaseMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._albedoTexture) {\r\n this._albedoTexture.dispose();\r\n }\r\n if (this._ambientTexture) {\r\n this._ambientTexture.dispose();\r\n }\r\n if (this._opacityTexture) {\r\n this._opacityTexture.dispose();\r\n }\r\n if (this._reflectionTexture) {\r\n this._reflectionTexture.dispose();\r\n }\r\n if (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture) {\r\n this._environmentBRDFTexture.dispose();\r\n }\r\n if (this._emissiveTexture) {\r\n this._emissiveTexture.dispose();\r\n }\r\n if (this._metallicTexture) {\r\n this._metallicTexture.dispose();\r\n }\r\n if (this._reflectivityTexture) {\r\n this._reflectivityTexture.dispose();\r\n }\r\n if (this._bumpTexture) {\r\n this._bumpTexture.dispose();\r\n }\r\n if (this._lightmapTexture) {\r\n this._lightmapTexture.dispose();\r\n }\r\n }\r\n this.subSurface.dispose(forceDisposeTextures);\r\n this.clearCoat.dispose(forceDisposeTextures);\r\n this.sheen.dispose(forceDisposeTextures);\r\n this.anisotropy.dispose(forceDisposeTextures);\r\n this._renderTargets.dispose();\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_OPAQUE = 0;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATEST = 1;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHABLEND = 2;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND = 3;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0;\r\n /**\r\n * PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL = 0;\r\n /**\r\n * PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_GLTF = 1;\r\n /**\r\n * PBRMaterialLightFalloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_STANDARD = 2;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsImageProcessingConfiguration\"])()\r\n ], PBRBaseMaterial.prototype, \"_imageProcessingConfiguration\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBaseMaterial.prototype, \"debugMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRBaseMaterial.prototype, \"useLogarithmicDepth\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRBaseMaterial.prototype, \"transparencyMode\", null);\r\n return PBRBaseMaterial;\r\n}(_Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_17__[\"PushMaterial\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\":\n/*!************************************************!*\\\n !*** ./Materials/PBR/pbrBaseSimpleMaterial.ts ***!\n \\************************************************/\n/*! exports provided: PBRBaseSimpleMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return PBRBaseSimpleMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pbrBaseMaterial */ \"./Materials/PBR/pbrBaseMaterial.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The Physically based simple base material of BJS.\r\n *\r\n * This enables better naming and convention enforcements on top of the pbrMaterial.\r\n * It is used as the base class for both the specGloss and metalRough conventions.\r\n */\r\nvar PBRBaseSimpleMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRBaseSimpleMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRBaseSimpleMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this.disableLighting = false;\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n _this.invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n _this.invertNormalMapY = false;\r\n /**\r\n * Emissivie color used to self-illuminate the model.\r\n */\r\n _this.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"](0, 0, 0);\r\n /**\r\n * Occlusion Channel Strenght.\r\n */\r\n _this.occlusionStrength = 1.0;\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n _this.useLightmapAsShadowmap = false;\r\n _this._useAlphaFromAlbedoTexture = true;\r\n _this._useAmbientInGrayScale = true;\r\n return _this;\r\n }\r\n Object.defineProperty(PBRBaseSimpleMaterial.prototype, \"doubleSided\", {\r\n /**\r\n * Gets the current double sided mode.\r\n */\r\n get: function () {\r\n return this._twoSidedLighting;\r\n },\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n set: function (value) {\r\n if (this._twoSidedLighting === value) {\r\n return;\r\n }\r\n this._twoSidedLighting = value;\r\n this.backFaceCulling = !value;\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n PBRBaseSimpleMaterial.prototype.getClassName = function () {\r\n return \"PBRBaseSimpleMaterial\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectionTexture\")\r\n ], PBRBaseSimpleMaterial.prototype, \"environmentTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_bumpTexture\")\r\n ], PBRBaseSimpleMaterial.prototype, \"normalTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"emissive\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"emissiveColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTextureStrength\")\r\n ], PBRBaseSimpleMaterial.prototype, \"occlusionStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTexture\")\r\n ], PBRBaseSimpleMaterial.prototype, \"occlusionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_alphaCutOff\")\r\n ], PBRBaseSimpleMaterial.prototype, \"alphaCutOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRBaseSimpleMaterial.prototype, \"doubleSided\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n ], PBRBaseSimpleMaterial.prototype, \"lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n return PBRBaseSimpleMaterial;\r\n}(_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_3__[\"PBRBaseMaterial\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrClearCoatConfiguration.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/PBR/pbrClearCoatConfiguration.ts ***!\n \\****************************************************/\n/*! exports provided: PBRClearCoatConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRClearCoatConfiguration\", function() { return PBRClearCoatConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the clear coat parameters of the pbr material.\r\n */\r\nvar PBRClearCoatConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRClearCoatConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the clear coat is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the clear coat layer roughness.\r\n */\r\n this.roughness = 0;\r\n this._indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n /**\r\n * Defines the index of refraction of the clear coat.\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * Changing the default value is more performance intensive.\r\n */\r\n this.indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n this._texture = null;\r\n /**\r\n * Stores the clear coat values in a texture.\r\n */\r\n this.texture = null;\r\n this._bumpTexture = null;\r\n /**\r\n * Define the clear coat specific bump texture.\r\n */\r\n this.bumpTexture = null;\r\n this._isTintEnabled = false;\r\n /**\r\n * Defines if the clear coat tint is enabled in the material.\r\n */\r\n this.isTintEnabled = false;\r\n /**\r\n * Defines the clear coat tint of the material.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the\r\n * clear coat media.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines the clear coat layer thickness.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintThickness = 1;\r\n this._tintTexture = null;\r\n /**\r\n * Stores the clear tint values in a texture.\r\n * rgb is tint\r\n * a is a thickness factor\r\n */\r\n this.tintTexture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRClearCoatConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRClearCoatConfiguration.prototype.isReadyForSubMesh = function (defines, scene, engine, disableBumpMap) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._isTintEnabled && this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n if (!this._tintTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRClearCoatConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (this._isEnabled) {\r\n defines.CLEARCOAT = true;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._texture, defines, \"CLEARCOAT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TEXTURE = false;\r\n }\r\n if (this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatBumpTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._bumpTexture, defines, \"CLEARCOAT_BUMP\");\r\n }\r\n else {\r\n defines.CLEARCOAT_BUMP = false;\r\n }\r\n defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n if (this._isTintEnabled) {\r\n defines.CLEARCOAT_TINT = true;\r\n if (this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._tintTexture, defines, \"CLEARCOAT_TINT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT = false;\r\n defines.CLEARCOAT_TEXTURE = false;\r\n defines.CLEARCOAT_BUMP = false;\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param invertNormalMapX If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n * @param invertNormalMapY If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n */\r\n PBRClearCoatConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, disableBumpMap, isFrozen, invertNormalMapX, invertNormalMapY) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.updateFloat2(\"vClearCoatBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._bumpTexture, uniformBuffer, \"clearCoatBump\");\r\n if (scene._mirroredCameraPosition) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? 1.0 : -1.0, invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? -1.0 : 1.0, invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTintInfos\", this._tintTexture.coordinatesIndex, this._tintTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._tintTexture, uniformBuffer, \"clearCoatTint\");\r\n }\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat2(\"vClearCoatParams\", this.intensity, this.roughness);\r\n // Clear Coat Refraction params\r\n var a = 1 - this._indexOfRefraction;\r\n var b = 1 + this._indexOfRefraction;\r\n var f0 = Math.pow((-a / b), 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\r\n var eta = 1 / this._indexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\r\n if (this._isTintEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatTintParams\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintThickness));\r\n uniformBuffer.updateFloat(\"clearCoatColorAtDistance\", Math.max(0.00001, this.tintColorAtDistance));\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatSampler\", this._texture);\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.setTexture(\"clearCoatBumpSampler\", this._bumpTexture);\r\n }\r\n if (this._isTintEnabled && this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatTintSampler\", this._tintTexture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRClearCoatConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._tintTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRClearCoatConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture) {\r\n activeTextures.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n animatables.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0) {\r\n animatables.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n if (this._bumpTexture) {\r\n this._bumpTexture.dispose();\r\n }\r\n if (this._tintTexture) {\r\n this._tintTexture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRClearCoatConfiguration.prototype.getClassName = function () {\r\n return \"PBRClearCoatConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRClearCoatConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.CLEARCOAT_BUMP) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_BUMP\");\r\n }\r\n if (defines.CLEARCOAT_TINT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_TINT\");\r\n }\r\n if (defines.CLEARCOAT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRClearCoatConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vClearCoatTangentSpaceParams\", \"vClearCoatParams\", \"vClearCoatRefractionParams\", \"vClearCoatTintParams\", \"clearCoatColorAtDistance\", \"clearCoatMatrix\", \"clearCoatBumpMatrix\", \"clearCoatTintMatrix\", \"vClearCoatInfos\", \"vClearCoatBumpInfos\", \"vClearCoatTintInfos\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRClearCoatConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"clearCoatSampler\", \"clearCoatBumpSampler\", \"clearCoatTintSampler\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRClearCoatConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vClearCoatParams\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatRefractionParams\", 4);\r\n uniformBuffer.addUniform(\"vClearCoatInfos\", 2);\r\n uniformBuffer.addUniform(\"clearCoatMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatBumpInfos\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatTangentSpaceParams\", 2);\r\n uniformBuffer.addUniform(\"clearCoatBumpMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatTintParams\", 4);\r\n uniformBuffer.addUniform(\"clearCoatColorAtDistance\", 1);\r\n uniformBuffer.addUniform(\"vClearCoatTintInfos\", 2);\r\n uniformBuffer.addUniform(\"clearCoatTintMatrix\", 16);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param clearCoatConfiguration define the config where to copy the info\r\n */\r\n PBRClearCoatConfiguration.prototype.copyTo = function (clearCoatConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return clearCoatConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this clear coat configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRClearCoatConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRClearCoatConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n */\r\n PBRClearCoatConfiguration._DefaultIndexOfRefraction = 1.5;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"texture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isTintEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"tintThickness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"tintTexture\", void 0);\r\n return PBRClearCoatConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrMaterial.ts\":\n/*!**************************************!*\\\n !*** ./Materials/PBR/pbrMaterial.ts ***!\n \\**************************************/\n/*! exports provided: PBRMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return PBRMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/brdfTextureTools */ \"./Misc/brdfTextureTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pbrBaseMaterial */ \"./Materials/PBR/pbrBaseMaterial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this.directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this.emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this.environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this.specularIntensity = 1.0;\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this.disableBumpMap = false;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this.ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this.ambientTextureImpactOnAnalyticalLights = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this.ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this.albedoColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this.reflectivityColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1, 1, 1);\r\n /**\r\n * The color reflected from the material.\r\n */\r\n _this.reflectionColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1.0, 1.0, 1.0);\r\n /**\r\n * The color emitted from the material.\r\n */\r\n _this.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this.microSurface = 1.0;\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n _this.useLightmapAsShadowmap = false;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this.useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this.forceAlphaTest = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this.useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this.useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this.useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this.useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this.useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this.useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this.useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this.useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this.useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this.useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this.disableLighting = false;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this.forceIrradianceInFragment = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n _this.invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n _this.invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this.twoSidedLighting = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this.useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this.useLinearAlphaFresnel = false;\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n _this.environmentBRDFTexture = null;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this.forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this.enableSpecularAntiAliasing = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this.useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this.useRadianceOcclusion = true;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this.unlit = false;\r\n _this._environmentBRDFTexture = _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_2__[\"BRDFTextureTools\"].GetEnvironmentBRDFTexture(scene);\r\n return _this;\r\n }\r\n Object.defineProperty(PBRMaterial.prototype, \"refractionTexture\", {\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n get: function () {\r\n return this.subSurface.refractionTexture;\r\n },\r\n set: function (value) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"indexOfRefraction\", {\r\n /**\r\n * source material index of refraction (IOR)' / 'destination material IOR.\r\n */\r\n get: function () {\r\n return 1 / this.subSurface.indexOfRefraction;\r\n },\r\n set: function (value) {\r\n this.subSurface.indexOfRefraction = 1 / value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"invertRefractionY\", {\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n get: function () {\r\n return this.subSurface.invertRefractionY;\r\n },\r\n set: function (value) {\r\n this.subSurface.invertRefractionY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"linkRefractionWithTransparency\", {\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n get: function () {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n },\r\n set: function (value) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"usePhysicalLightFalloff\", {\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n get: function () {\r\n return this._lightFalloff === _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_PHYSICAL;\r\n },\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n set: function (value) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_PHYSICAL;\r\n }\r\n else {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"useGLTFLightFalloff\", {\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n get: function () {\r\n return this._lightFalloff === _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_GLTF;\r\n },\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n set: function (value) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_GLTF;\r\n }\r\n else {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the name of this material class.\r\n */\r\n PBRMaterial.prototype.getClassName = function () {\r\n return \"PBRMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n return clone;\r\n };\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n PBRMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n PBRMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new PBRMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRMaterial.PBRMATERIAL_OPAQUE = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_OPAQUE;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATEST = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_ALPHATEST;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHABLEND = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_ALPHABLEND;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_ALPHATESTANDBLEND;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"directIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"specularIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"disableBumpMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureImpactOnAnalyticalLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"opacityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallic\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurfaceTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n ], PBRMaterial.prototype, \"lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"ambient\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"albedo\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"reflectivity\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"reflection\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"emissive\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurface\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFromAlbedoTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"forceAlphaTest\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"alphaCutOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMicroSurfaceFromReflectivityMapAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureGreen\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMetallnessFromMetallicTextureBlue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientOcclusionFromMetallicTextureRed\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientInGrayScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAutoMicroSurfaceFromReflectivityMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRMaterial.prototype, \"usePhysicalLightFalloff\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRMaterial.prototype, \"useGLTFLightFalloff\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallax\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceIrradianceInFragment\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"twoSidedLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLinearAlphaFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentBRDFTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceNormalForward\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"enableSpecularAntiAliasing\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useHorizonOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRMaterial.prototype, \"unlit\", void 0);\r\n return PBRMaterial;\r\n}(_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PBRMaterial\"] = PBRMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrMetallicRoughnessMaterial.ts\":\n/*!*******************************************************!*\\\n !*** ./Materials/PBR/pbrMetallicRoughnessMaterial.ts ***!\n \\*******************************************************/\n/*! exports provided: PBRMetallicRoughnessMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return PBRMetallicRoughnessMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pbrBaseSimpleMaterial */ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The PBR material of BJS following the metal roughness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0\r\n */\r\nvar PBRMetallicRoughnessMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRMetallicRoughnessMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMetalRoughnessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRMetallicRoughnessMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._useRoughnessFromMetallicTextureAlpha = false;\r\n _this._useRoughnessFromMetallicTextureGreen = true;\r\n _this._useMetallnessFromMetallicTextureBlue = true;\r\n _this.metallic = 1.0;\r\n _this.roughness = 1.0;\r\n return _this;\r\n }\r\n /**\r\n * Return the currrent class name of the material.\r\n */\r\n PBRMetallicRoughnessMaterial.prototype.getClassName = function () {\r\n return \"PBRMetallicRoughnessMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRMetallicRoughnessMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new PBRMetallicRoughnessMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n return clone;\r\n };\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n */\r\n PBRMetallicRoughnessMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMetallicRoughnessMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a JSON object correponding to the serialize function.\r\n */\r\n PBRMetallicRoughnessMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new PBRMetallicRoughnessMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"baseColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"baseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"metallic\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_metallicTexture\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"metallicRoughnessTexture\", void 0);\r\n return PBRMetallicRoughnessMaterial;\r\n}(_pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__[\"PBRBaseSimpleMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PBRMetallicRoughnessMaterial\"] = PBRMetallicRoughnessMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrSheenConfiguration.ts\":\n/*!************************************************!*\\\n !*** ./Materials/PBR/pbrSheenConfiguration.ts ***!\n \\************************************************/\n/*! exports provided: PBRSheenConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRSheenConfiguration\", function() { return PBRSheenConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the Sheen parameters of the pbr material.\r\n */\r\nvar PBRSheenConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRSheenConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the material uses sheen.\r\n */\r\n this.isEnabled = false;\r\n this._linkSheenWithAlbedo = false;\r\n /**\r\n * Defines if the sheen is linked to the sheen color.\r\n */\r\n this.linkSheenWithAlbedo = false;\r\n /**\r\n * Defines the sheen intensity.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the sheen color.\r\n */\r\n this.color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n this._texture = null;\r\n /**\r\n * Stores the sheen tint values in a texture.\r\n * rgb is tint\r\n * a is a intensity\r\n */\r\n this.texture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRSheenConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSheenConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRSheenConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (this._isEnabled) {\r\n defines.SHEEN = this._isEnabled;\r\n defines.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._texture, defines, \"SHEEN_TEXTURE\");\r\n }\r\n else {\r\n defines.SHEEN_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.SHEEN = false;\r\n defines.SHEEN_TEXTURE = false;\r\n defines.SHEEN_LINKWITHALBEDO = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n */\r\n PBRSheenConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vSheenInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\r\n }\r\n // Sheen\r\n uniformBuffer.updateFloat4(\"vSheenColor\", this.color.r, this.color.g, this.color.b, this.intensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n uniformBuffer.setTexture(\"sheenSampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSheenConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSheenConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSheenConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSheenConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSheenConfiguration\"\r\n */\r\n PBRSheenConfiguration.prototype.getClassName = function () {\r\n return \"PBRSheenConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSheenConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SHEEN) {\r\n fallbacks.addFallback(currentRank++, \"SHEEN\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSheenConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vSheenColor\", \"vSheenInfos\", \"sheenMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSheenConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vSheenColor\", 4);\r\n uniformBuffer.addUniform(\"vSheenInfos\", 2);\r\n uniformBuffer.addUniform(\"sheenMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSheenConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"sheenSampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param sheenConfiguration define the config where to copy the info\r\n */\r\n PBRSheenConfiguration.prototype.copyTo = function (sheenConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return sheenConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSheenConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSheenConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"linkSheenWithAlbedo\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSheenConfiguration.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRSheenConfiguration.prototype, \"color\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"texture\", void 0);\r\n return PBRSheenConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrSpecularGlossinessMaterial.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/PBR/pbrSpecularGlossinessMaterial.ts ***!\n \\********************************************************/\n/*! exports provided: PBRSpecularGlossinessMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return PBRSpecularGlossinessMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pbrBaseSimpleMaterial */ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The PBR material of BJS following the specular glossiness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness\r\n */\r\nvar PBRSpecularGlossinessMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRSpecularGlossinessMaterial, _super);\r\n /**\r\n * Instantiates a new PBRSpecularGlossinessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRSpecularGlossinessMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._useMicroSurfaceFromReflectivityMapAlpha = true;\r\n return _this;\r\n }\r\n /**\r\n * Return the currrent class name of the material.\r\n */\r\n PBRSpecularGlossinessMaterial.prototype.getClassName = function () {\r\n return \"PBRSpecularGlossinessMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRSpecularGlossinessMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new PBRSpecularGlossinessMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n return clone;\r\n };\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n */\r\n PBRSpecularGlossinessMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRSpecularGlossinessMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a JSON object correponding to the serialize function.\r\n */\r\n PBRSpecularGlossinessMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new PBRSpecularGlossinessMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"diffuse\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"diffuseColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"specular\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityColor\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"specularColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_microSurface\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"glossiness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityTexture\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"specularGlossinessTexture\", void 0);\r\n return PBRSpecularGlossinessMaterial;\r\n}(_pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__[\"PBRBaseSimpleMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PBRSpecularGlossinessMaterial\"] = PBRSpecularGlossinessMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrSubSurfaceConfiguration.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/PBR/pbrSubSurfaceConfiguration.ts ***!\n \\*****************************************************/\n/*! exports provided: PBRSubSurfaceConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRSubSurfaceConfiguration\", function() { return PBRSubSurfaceConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the sub surface parameters of the pbr material.\r\n */\r\nvar PBRSubSurfaceConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of sub surface configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRSubSurfaceConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isRefractionEnabled = false;\r\n /**\r\n * Defines if the refraction is enabled in the material.\r\n */\r\n this.isRefractionEnabled = false;\r\n this._isTranslucencyEnabled = false;\r\n /**\r\n * Defines if the translucency is enabled in the material.\r\n */\r\n this.isTranslucencyEnabled = false;\r\n this._isScatteringEnabled = false;\r\n // /**\r\n // * Defines if the sub surface scattering is enabled in the material.\r\n // */\r\n // @serialize()\r\n // @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n // public isScatteringEnabled = false;\r\n /**\r\n * Defines the refraction intensity of the material.\r\n * The refraction when enabled replaces the Diffuse part of the material.\r\n * The intensity helps transitionning between diffuse and refraction.\r\n */\r\n this.refractionIntensity = 1;\r\n /**\r\n * Defines the translucency intensity of the material.\r\n * When translucency has been enabled, this defines how much of the \"translucency\"\r\n * is addded to the diffuse part of the material.\r\n */\r\n this.translucencyIntensity = 1;\r\n /**\r\n * Defines the scattering intensity of the material.\r\n * When scattering has been enabled, this defines how much of the \"scattered light\"\r\n * is addded to the diffuse part of the material.\r\n */\r\n this.scatteringIntensity = 1;\r\n this._thicknessTexture = null;\r\n /**\r\n * Stores the average thickness of a mesh in a texture (The texture is holding the values linearly).\r\n * The red channel of the texture should contain the thickness remapped between 0 and 1.\r\n * 0 would mean minimumThickness\r\n * 1 would mean maximumThickness\r\n * The other channels might be use as a mask to vary the different effects intensity.\r\n */\r\n this.thicknessTexture = null;\r\n this._refractionTexture = null;\r\n /**\r\n * Defines the texture to use for refraction.\r\n */\r\n this.refractionTexture = null;\r\n this._indexOfRefraction = 1;\r\n /**\r\n * Defines the index of refraction used in the material.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n */\r\n this.indexOfRefraction = 1;\r\n this._invertRefractionY = false;\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n this.invertRefractionY = false;\r\n this._linkRefractionWithTransparency = false;\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n this.linkRefractionWithTransparency = false;\r\n /**\r\n * Defines the minimum thickness stored in the thickness map.\r\n * If no thickness map is defined, this value will be used to simulate thickness.\r\n */\r\n this.minimumThickness = 0;\r\n /**\r\n * Defines the maximum thickness stored in the thickness map.\r\n */\r\n this.maximumThickness = 1;\r\n /**\r\n * Defines the volume tint of the material.\r\n * This is used for both translucency and scattering.\r\n */\r\n this.tintColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the media.\r\n * This is used for refraction only.\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines how far each channel transmit through the media.\r\n * It is defined as a color to simplify it selection.\r\n */\r\n this.diffusionDistance = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n this._useMaskFromThicknessTexture = false;\r\n /**\r\n * Stores the intensity of the different subsurface effects in the thickness texture.\r\n * * the green channel is the translucency intensity.\r\n * * the blue channel is the scattering intensity.\r\n * * the alpha channel is the refraction intensity.\r\n */\r\n this.useMaskFromThicknessTexture = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRSubSurfaceConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n if (!refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n defines.SUBSURFACE = false;\r\n defines.SS_TRANSLUCENCY = this._isTranslucencyEnabled;\r\n defines.SS_SCATERRING = this._isScatteringEnabled;\r\n defines.SS_THICKNESSANDMASK_TEXTURE = false;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n defines.SS_REFRACTION = false;\r\n defines.SS_REFRACTIONMAP_3D = false;\r\n defines.SS_GAMMAREFRACTION = false;\r\n defines.SS_RGBDREFRACTION = false;\r\n defines.SS_LINEARSPECULARREFRACTION = false;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n defines.SS_LODINREFRACTIONALPHA = false;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n if (this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled) {\r\n defines.SUBSURFACE = true;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"SS_THICKNESSANDMASK_TEXTURE\");\r\n }\r\n }\r\n }\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = this._useMaskFromThicknessTexture;\r\n }\r\n if (this._isRefractionEnabled) {\r\n if (scene.texturesEnabled) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n defines.SS_REFRACTION = true;\r\n defines.SS_REFRACTIONMAP_3D = refractionTexture.isCube;\r\n defines.SS_GAMMAREFRACTION = refractionTexture.gammaSpace;\r\n defines.SS_RGBDREFRACTION = refractionTexture.isRGBD;\r\n defines.SS_LINEARSPECULARREFRACTION = refractionTexture.linearSpecularLOD;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = refractionTexture.invertZ;\r\n defines.SS_LODINREFRACTIONALPHA = refractionTexture.lodLevelInAlpha;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param lodBasedMicrosurface defines wether the material relies on lod based microsurface or not.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, isFrozen, lodBasedMicrosurface) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vThicknessInfos\", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"thickness\");\r\n }\r\n uniformBuffer.updateFloat2(\"vThicknessParam\", this.minimumThickness, this.maximumThickness - this.minimumThickness);\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n uniformBuffer.updateMatrix(\"refractionMatrix\", refractionTexture.getReflectionTextureMatrix());\r\n var depth = 1.0;\r\n if (!refractionTexture.isCube) {\r\n if (refractionTexture.depth) {\r\n depth = refractionTexture.depth;\r\n }\r\n }\r\n uniformBuffer.updateFloat4(\"vRefractionInfos\", refractionTexture.level, 1 / this._indexOfRefraction, depth, this._invertRefractionY ? -1 : 1);\r\n uniformBuffer.updateFloat3(\"vRefractionMicrosurfaceInfos\", refractionTexture.getSize().width, refractionTexture.lodGenerationScale, refractionTexture.lodGenerationOffset);\r\n }\r\n uniformBuffer.updateColor3(\"vDiffusionDistance\", this.diffusionDistance);\r\n uniformBuffer.updateFloat4(\"vTintColor\", this.tintColor.r, this.tintColor.g, this.tintColor.b, this.tintColorAtDistance);\r\n uniformBuffer.updateFloat3(\"vSubSurfaceIntensity\", this.refractionIntensity, this.translucencyIntensity, this.scatteringIntensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n uniformBuffer.setTexture(\"thicknessSampler\", this._thicknessTexture);\r\n }\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n if (lodBasedMicrosurface) {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture);\r\n }\r\n else {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture._lodTextureMid || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerLow\", refractionTexture._lodTextureLow || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerHigh\", refractionTexture._lodTextureHigh || refractionTexture);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh.\r\n * @param activeEffect defines the effect that should be unbound from.\r\n * @returns true if unbound, otherwise false\r\n */\r\n PBRSubSurfaceConfiguration.prototype.unbind = function (activeEffect) {\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n activeEffect.setTexture(\"refractionSampler\", null);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns the texture used for refraction or null if none is used.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - Refraction texture if present. If no refraction texture and refraction\r\n * is linked with transparency, returns environment texture. Otherwise, returns null.\r\n */\r\n PBRSubSurfaceConfiguration.prototype._getRefractionTexture = function (scene) {\r\n if (this._refractionTexture) {\r\n return this._refractionTexture;\r\n }\r\n if (this._isRefractionEnabled) {\r\n return scene.environmentTexture;\r\n }\r\n return null;\r\n };\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return this.isRefractionEnabled && this._linkRefractionWithTransparency;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Fills the list of render target textures.\r\n * @param renderTargets the list of render targets to update\r\n */\r\n PBRSubSurfaceConfiguration.prototype.fillRenderTargetTextures = function (renderTargets) {\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n renderTargets.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._thicknessTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n * @returns true if this uses a render target otherwise false.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasRenderTargetTextures = function () {\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._thicknessTexture) {\r\n activeTextures.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\r\n animatables.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n animatables.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._thicknessTexture) {\r\n this._thicknessTexture.dispose();\r\n }\r\n if (this._refractionTexture) {\r\n this._refractionTexture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSubSurfaceConfiguration\"\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getClassName = function () {\r\n return \"PBRSubSurfaceConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSubSurfaceConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SS_SCATERRING) {\r\n fallbacks.addFallback(currentRank++, \"SS_SCATERRING\");\r\n }\r\n if (defines.SS_TRANSLUCENCY) {\r\n fallbacks.addFallback(currentRank++, \"SS_TRANSLUCENCY\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSubSurfaceConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vDiffusionDistance\", \"vTintColor\", \"vSubSurfaceIntensity\", \"vRefractionMicrosurfaceInfos\", \"vRefractionInfos\", \"vThicknessInfos\", \"vThicknessParam\", \"refractionMatrix\", \"thicknessMatrix\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSubSurfaceConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"thicknessSampler\", \"refractionSampler\", \"refractionSamplerLow\", \"refractionSamplerHigh\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSubSurfaceConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vRefractionMicrosurfaceInfos\", 3);\r\n uniformBuffer.addUniform(\"vRefractionInfos\", 4);\r\n uniformBuffer.addUniform(\"refractionMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessInfos\", 2);\r\n uniformBuffer.addUniform(\"thicknessMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessParam\", 2);\r\n uniformBuffer.addUniform(\"vDiffusionDistance\", 3);\r\n uniformBuffer.addUniform(\"vTintColor\", 4);\r\n uniformBuffer.addUniform(\"vSubSurfaceIntensity\", 3);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param configuration define the config where to copy the info\r\n */\r\n PBRSubSurfaceConfiguration.prototype.copyTo = function (configuration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return configuration; }, this);\r\n };\r\n /**\r\n * Serializes this Sub Surface configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSubSurfaceConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isRefractionEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isTranslucencyEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"translucencyIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"scatteringIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"thicknessTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"invertRefractionY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"linkRefractionWithTransparency\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"minimumThickness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"maximumThickness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"diffusionDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"useMaskFromThicknessTexture\", void 0);\r\n return PBRSubSurfaceConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/basisTextureLoader.ts\":\n/*!**********************************************************!*\\\n !*** ./Materials/Textures/Loaders/basisTextureLoader.ts ***!\n \\**********************************************************/\n/*! exports provided: _BasisTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _BasisTextureLoader; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_basis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/basis */ \"./Misc/basis.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/tools */ \"./Misc/tools.ts\");\n\r\n\r\n\r\n/**\r\n * Loader for .basis file format\r\n */\r\nvar _BasisTextureLoader = /** @class */ (function () {\r\n function _BasisTextureLoader() {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = true;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _BasisTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".basis\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _BasisTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _BasisTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has already been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _BasisTextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n var caps = texture.getEngine().getCaps();\r\n var transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false\r\n }\r\n };\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].TranscodeAsync(data, transcodeConfig).then(function (result) {\r\n var hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].LoadTextureFromTranscodeResult(texture, result);\r\n texture.getEngine()._setCubeMapTextureParams(hasMipmap);\r\n texture.isReady = true;\r\n }).catch(function (err) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\");\r\n texture.isReady = true;\r\n });\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _BasisTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n var caps = texture.getEngine().getCaps();\r\n var transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false\r\n }\r\n };\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].TranscodeAsync(data, transcodeConfig).then(function (result) {\r\n var rootImage = result.fileInfo.images[0].levels[0];\r\n var hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n callback(rootImage.width, rootImage.height, hasMipmap, result.format !== -1, function () {\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].LoadTextureFromTranscodeResult(texture, result);\r\n });\r\n }).catch(function (err) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\");\r\n callback(0, 0, false, false, function () {\r\n });\r\n });\r\n };\r\n return _BasisTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"]._TextureLoaders.push(new _BasisTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/ddsTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/ddsTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _DDSTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _DDSTextureLoader; });\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_dds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/dds */ \"./Misc/dds.ts\");\n\r\n\r\n\r\n/**\r\n * Implementation of the DDS Texture Loader.\r\n * @hidden\r\n */\r\nvar _DDSTextureLoader = /** @class */ (function () {\r\n function _DDSTextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = true;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _DDSTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".dds\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _DDSTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _DDSTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _DDSTextureLoader.prototype.loadCubeData = function (imgs, texture, createPolynomials, onLoad, onError) {\r\n var engine = texture.getEngine();\r\n var info;\r\n var loadMipmap = false;\r\n if (Array.isArray(imgs)) {\r\n for (var index = 0; index < imgs.length; index++) {\r\n var data_1 = imgs[index];\r\n info = _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].GetDDSInfo(data_1);\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n engine._unpackFlipY(info.isCompressed);\r\n _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].UploadDDSLevels(engine, texture, data_1, info, loadMipmap, 6, -1, index);\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n engine.generateMipMapsForCubemap(texture);\r\n }\r\n }\r\n }\r\n else {\r\n var data = imgs;\r\n info = _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].GetDDSInfo(data);\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n if (createPolynomials) {\r\n info.sphericalPolynomial = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__[\"SphericalPolynomial\"]();\r\n }\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n engine._unpackFlipY(info.isCompressed);\r\n _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].UploadDDSLevels(engine, texture, data, info, loadMipmap, 6);\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n engine.generateMipMapsForCubemap(texture);\r\n }\r\n }\r\n engine._setCubeMapTextureParams(loadMipmap);\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad({ isDDS: true, width: texture.width, info: info, data: imgs, texture: texture });\r\n }\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _DDSTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n var info = _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].GetDDSInfo(data);\r\n var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps && ((info.width >> (info.mipmapCount - 1)) === 1);\r\n callback(info.width, info.height, loadMipmap, info.isFourCC, function () {\r\n _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].UploadDDSLevels(texture.getEngine(), texture, data, info, loadMipmap, 1);\r\n });\r\n };\r\n return _DDSTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.push(new _DDSTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/envTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/envTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _ENVTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _ENVTextureLoader; });\n/* harmony import */ var _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n/**\r\n * Implementation of the ENV Texture Loader.\r\n * @hidden\r\n */\r\nvar _ENVTextureLoader = /** @class */ (function () {\r\n function _ENVTextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = false;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _ENVTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".env\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _ENVTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _ENVTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _ENVTextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n data = data;\r\n var info = _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"].GetEnvInfo(data);\r\n if (info) {\r\n texture.width = info.width;\r\n texture.height = info.width;\r\n _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"].UploadEnvSpherical(texture, info);\r\n _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"].UploadEnvLevelsAsync(texture, data, info).then(function () {\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n });\r\n }\r\n else if (onError) {\r\n onError(\"Can not parse the environment file\", null);\r\n }\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _ENVTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n throw \".env not supported in 2d.\";\r\n };\r\n return _ENVTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.push(new _ENVTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/index.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Textures/Loaders/index.ts ***!\n \\*********************************************/\n/*! exports provided: _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ddsTextureLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ddsTextureLoader */ \"./Materials/Textures/Loaders/ddsTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _ddsTextureLoader__WEBPACK_IMPORTED_MODULE_0__[\"_DDSTextureLoader\"]; });\n\n/* harmony import */ var _envTextureLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./envTextureLoader */ \"./Materials/Textures/Loaders/envTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _envTextureLoader__WEBPACK_IMPORTED_MODULE_1__[\"_ENVTextureLoader\"]; });\n\n/* harmony import */ var _ktxTextureLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ktxTextureLoader */ \"./Materials/Textures/Loaders/ktxTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _ktxTextureLoader__WEBPACK_IMPORTED_MODULE_2__[\"_KTXTextureLoader\"]; });\n\n/* harmony import */ var _tgaTextureLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tgaTextureLoader */ \"./Materials/Textures/Loaders/tgaTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _tgaTextureLoader__WEBPACK_IMPORTED_MODULE_3__[\"_TGATextureLoader\"]; });\n\n/* harmony import */ var _basisTextureLoader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./basisTextureLoader */ \"./Materials/Textures/Loaders/basisTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _basisTextureLoader__WEBPACK_IMPORTED_MODULE_4__[\"_BasisTextureLoader\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/ktxTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/ktxTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _KTXTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _KTXTextureLoader; });\n/* harmony import */ var _Misc_khronosTextureContainer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/khronosTextureContainer */ \"./Misc/khronosTextureContainer.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n/**\r\n * Implementation of the KTX Texture Loader.\r\n * @hidden\r\n */\r\nvar _KTXTextureLoader = /** @class */ (function () {\r\n function _KTXTextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = false;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _KTXTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n if (textureFormatInUse && !isBase64 && !fallback && !isBuffer) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _KTXTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n if (lastDot != -1 && rootUrl.substring(lastDot + 1) == \"ktx\") {\r\n // Already transformed\r\n return rootUrl;\r\n }\r\n return (lastDot > -1 ? rootUrl.substring(0, lastDot) : rootUrl) + textureFormatInUse;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _KTXTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n // remove the format appended to the rootUrl in the original createCubeTexture call.\r\n var exp = new RegExp(\"\" + textureFormatInUse + \"$\");\r\n return rootUrl.replace(exp, \"\");\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _KTXTextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\r\n texture._invertVScale = !texture.invertY;\r\n var engine = texture.getEngine();\r\n var ktx = new _Misc_khronosTextureContainer__WEBPACK_IMPORTED_MODULE_0__[\"KhronosTextureContainer\"](data, 6);\r\n var loadMipmap = ktx.numberOfMipmapLevels > 1 && texture.generateMipMaps;\r\n engine._unpackFlipY(true);\r\n ktx.uploadLevels(texture, texture.generateMipMaps);\r\n texture.width = ktx.pixelWidth;\r\n texture.height = ktx.pixelHeight;\r\n engine._setCubeMapTextureParams(loadMipmap);\r\n texture.isReady = true;\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _KTXTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\r\n texture._invertVScale = !texture.invertY;\r\n var ktx = new _Misc_khronosTextureContainer__WEBPACK_IMPORTED_MODULE_0__[\"KhronosTextureContainer\"](data, 1);\r\n callback(ktx.pixelWidth, ktx.pixelHeight, false, true, function () {\r\n ktx.uploadLevels(texture, texture.generateMipMaps);\r\n }, ktx.isInvalid);\r\n };\r\n return _KTXTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.unshift(new _KTXTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/tgaTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/tgaTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _TGATextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _TGATextureLoader; });\n/* harmony import */ var _Misc_tga__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/tga */ \"./Misc/tga.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n/**\r\n * Implementation of the TGA Texture Loader.\r\n * @hidden\r\n */\r\nvar _TGATextureLoader = /** @class */ (function () {\r\n function _TGATextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = false;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _TGATextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".tga\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _TGATextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _TGATextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _TGATextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n throw \".env not supported in Cube.\";\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _TGATextureLoader.prototype.loadData = function (data, texture, callback) {\r\n var uintData = new Uint8Array(data);\r\n var header = _Misc_tga__WEBPACK_IMPORTED_MODULE_0__[\"TGATools\"].GetTGAHeader(uintData);\r\n callback(header.width, header.height, texture.generateMipMaps, false, function () {\r\n _Misc_tga__WEBPACK_IMPORTED_MODULE_0__[\"TGATools\"].UploadContent(texture, uintData);\r\n });\r\n };\r\n return _TGATextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.push(new _TGATextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/MultiviewRenderTarget.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/Textures/MultiviewRenderTarget.ts ***!\n \\*****************************************************/\n/*! exports provided: MultiviewRenderTarget */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiviewRenderTarget\", function() { return MultiviewRenderTarget; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n\r\n\r\n\r\n/**\r\n * Renders to multiple views with a single draw call\r\n * @see https://www.khronos.org/registry/webgl/extensions/WEBGL_multiview/\r\n */\r\nvar MultiviewRenderTarget = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiviewRenderTarget, _super);\r\n /**\r\n * Creates a multiview render target\r\n * @param scene scene used with the render target\r\n * @param size the size of the render target (used for each view)\r\n */\r\n function MultiviewRenderTarget(scene, size) {\r\n if (size === void 0) { size = 512; }\r\n var _this = _super.call(this, \"multiview rtt\", size, scene, false, true, _Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_UNKNOWN, false, undefined, false, false, true, undefined, true) || this;\r\n var internalTexture = scene.getEngine().createMultiviewRenderTargetTexture(_this.getRenderWidth(), _this.getRenderHeight());\r\n internalTexture.isMultiview = true;\r\n _this._texture = internalTexture;\r\n return _this;\r\n }\r\n /**\r\n * @hidden\r\n * @param faceIndex the face index, if its a cube texture\r\n */\r\n MultiviewRenderTarget.prototype._bindFrameBuffer = function (faceIndex) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (!this._texture) {\r\n return;\r\n }\r\n this.getScene().getEngine().bindMultiviewFramebuffer(this._texture);\r\n };\r\n /**\r\n * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)\r\n * @returns the view count\r\n */\r\n MultiviewRenderTarget.prototype.getViewCount = function () {\r\n return 2;\r\n };\r\n return MultiviewRenderTarget;\r\n}(_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/customProceduralTexture.ts\":\n/*!*******************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/customProceduralTexture.ts ***!\n \\*******************************************************************/\n/*! exports provided: CustomProceduralTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return CustomProceduralTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _proceduralTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony import */ var _Misc_webRequest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../Misc/webRequest */ \"./Misc/webRequest.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes called 'refMaps' or 'sampler' images.\r\n * Custom Procedural textures are the easiest way to create your own procedural in your application.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures#creating-custom-procedural-textures\r\n */\r\nvar CustomProceduralTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CustomProceduralTexture, _super);\r\n /**\r\n * Instantiates a new Custom Procedural Texture.\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes called 'refMaps' or 'sampler' images.\r\n * Custom Procedural textures are the easiest way to create your own procedural in your application.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures#creating-custom-procedural-textures\r\n * @param name Define the name of the texture\r\n * @param texturePath Define the folder path containing all the cutom texture related files (config, shaders...)\r\n * @param size Define the size of the texture to create\r\n * @param scene Define the scene the texture belongs to\r\n * @param fallbackTexture Define a fallback texture in case there were issues to create the custom texture\r\n * @param generateMipMaps Define if the texture should creates mip maps or not\r\n */\r\n function CustomProceduralTexture(name, texturePath, size, scene, fallbackTexture, generateMipMaps) {\r\n var _this = _super.call(this, name, size, null, scene, fallbackTexture, generateMipMaps) || this;\r\n _this._animate = true;\r\n _this._time = 0;\r\n _this._texturePath = texturePath;\r\n //Try to load json\r\n _this._loadJson(texturePath);\r\n _this.refreshRate = 1;\r\n return _this;\r\n }\r\n CustomProceduralTexture.prototype._loadJson = function (jsonUrl) {\r\n var _this = this;\r\n var noConfigFile = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log(\"No config file found in \" + jsonUrl + \" trying to use ShadersStore or DOM element\");\r\n try {\r\n _this.setFragment(_this._texturePath);\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"No json or ShaderStore or DOM element found for CustomProceduralTexture\");\r\n }\r\n };\r\n var configFileUrl = jsonUrl + \"/config.json\";\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_6__[\"WebRequest\"]();\r\n xhr.open(\"GET\", configFileUrl);\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 || (xhr.responseText && xhr.responseText.length > 0)) {\r\n try {\r\n _this._config = JSON.parse(xhr.response);\r\n _this.updateShaderUniforms();\r\n _this.updateTextures();\r\n _this.setFragment(_this._texturePath + \"/custom\");\r\n _this._animate = _this._config.animate;\r\n _this.refreshRate = _this._config.refreshrate;\r\n }\r\n catch (ex) {\r\n noConfigFile();\r\n }\r\n }\r\n else {\r\n noConfigFile();\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n noConfigFile();\r\n }, false);\r\n try {\r\n xhr.send();\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"CustomProceduralTexture: Error on XHR send request.\");\r\n }\r\n };\r\n /**\r\n * Is the texture ready to be used ? (rendered at least once)\r\n * @returns true if ready, otherwise, false.\r\n */\r\n CustomProceduralTexture.prototype.isReady = function () {\r\n if (!_super.prototype.isReady.call(this)) {\r\n return false;\r\n }\r\n for (var name in this._textures) {\r\n var texture = this._textures[name];\r\n if (!texture.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Render the texture to its associated render target.\r\n * @param useCameraPostProcess Define if camera post process should be applied to the texture\r\n */\r\n CustomProceduralTexture.prototype.render = function (useCameraPostProcess) {\r\n var scene = this.getScene();\r\n if (this._animate && scene) {\r\n this._time += scene.getAnimationRatio() * 0.03;\r\n this.updateShaderUniforms();\r\n }\r\n _super.prototype.render.call(this, useCameraPostProcess);\r\n };\r\n /**\r\n * Update the list of dependant textures samplers in the shader.\r\n */\r\n CustomProceduralTexture.prototype.updateTextures = function () {\r\n for (var i = 0; i < this._config.sampler2Ds.length; i++) {\r\n this.setTexture(this._config.sampler2Ds[i].sample2Dname, new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"](this._texturePath + \"/\" + this._config.sampler2Ds[i].textureRelativeUrl, this.getScene()));\r\n }\r\n };\r\n /**\r\n * Update the uniform values of the procedural texture in the shader.\r\n */\r\n CustomProceduralTexture.prototype.updateShaderUniforms = function () {\r\n if (this._config) {\r\n for (var j = 0; j < this._config.uniforms.length; j++) {\r\n var uniform = this._config.uniforms[j];\r\n switch (uniform.type) {\r\n case \"float\":\r\n this.setFloat(uniform.name, uniform.value);\r\n break;\r\n case \"color3\":\r\n this.setColor3(uniform.name, new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](uniform.r, uniform.g, uniform.b));\r\n break;\r\n case \"color4\":\r\n this.setColor4(uniform.name, new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"](uniform.r, uniform.g, uniform.b, uniform.a));\r\n break;\r\n case \"vector2\":\r\n this.setVector2(uniform.name, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](uniform.x, uniform.y));\r\n break;\r\n case \"vector3\":\r\n this.setVector3(uniform.name, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](uniform.x, uniform.y, uniform.z));\r\n break;\r\n }\r\n }\r\n }\r\n this.setFloat(\"time\", this._time);\r\n };\r\n Object.defineProperty(CustomProceduralTexture.prototype, \"animate\", {\r\n /**\r\n * Define if the texture animates or not.\r\n */\r\n get: function () {\r\n return this._animate;\r\n },\r\n set: function (value) {\r\n this._animate = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CustomProceduralTexture;\r\n}(_proceduralTexture__WEBPACK_IMPORTED_MODULE_5__[\"ProceduralTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/index.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Textures/Procedurals/index.ts ***!\n \\*************************************************/\n/*! exports provided: CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _customProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./customProceduralTexture */ \"./Materials/Textures/Procedurals/customProceduralTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _customProceduralTexture__WEBPACK_IMPORTED_MODULE_0__[\"CustomProceduralTexture\"]; });\n\n/* harmony import */ var _noiseProceduralTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./noiseProceduralTexture */ \"./Materials/Textures/Procedurals/noiseProceduralTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _noiseProceduralTexture__WEBPACK_IMPORTED_MODULE_1__[\"NoiseProceduralTexture\"]; });\n\n/* harmony import */ var _proceduralTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _proceduralTexture__WEBPACK_IMPORTED_MODULE_2__[\"ProceduralTexture\"]; });\n\n/* harmony import */ var _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proceduralTextureSceneComponent */ \"./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"ProceduralTextureSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/noiseProceduralTexture.ts\":\n/*!******************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/noiseProceduralTexture.ts ***!\n \\******************************************************************/\n/*! exports provided: NoiseProceduralTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return NoiseProceduralTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _proceduralTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Shaders_noise_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Shaders/noise.fragment */ \"./Shaders/noise.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to generate noise procedural textures\r\n */\r\nvar NoiseProceduralTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NoiseProceduralTexture, _super);\r\n /**\r\n * Creates a new NoiseProceduralTexture\r\n * @param name defines the name fo the texture\r\n * @param size defines the size of the texture (default is 256)\r\n * @param scene defines the hosting scene\r\n * @param fallbackTexture defines the texture to use if the NoiseProceduralTexture can't be created\r\n * @param generateMipMaps defines if mipmaps must be generated (true by default)\r\n */\r\n function NoiseProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {\r\n if (size === void 0) { size = 256; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__[\"EngineStore\"].LastCreatedScene; }\r\n var _this = _super.call(this, name, size, \"noise\", scene, fallbackTexture, generateMipMaps) || this;\r\n _this._time = 0;\r\n /** Gets or sets a value between 0 and 1 indicating the overall brightness of the texture (default is 0.2) */\r\n _this.brightness = 0.2;\r\n /** Defines the number of octaves to process */\r\n _this.octaves = 3;\r\n /** Defines the level of persistence (0.8 by default) */\r\n _this.persistence = 0.8;\r\n /** Gets or sets animation speed factor (default is 1) */\r\n _this.animationSpeedFactor = 1;\r\n _this.autoClear = false;\r\n _this._updateShaderUniforms();\r\n return _this;\r\n }\r\n NoiseProceduralTexture.prototype._updateShaderUniforms = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._time += scene.getAnimationRatio() * this.animationSpeedFactor * 0.01;\r\n this.setFloat(\"brightness\", this.brightness);\r\n this.setFloat(\"persistence\", this.persistence);\r\n this.setFloat(\"timeScale\", this._time);\r\n };\r\n NoiseProceduralTexture.prototype._getDefines = function () {\r\n return \"#define OCTAVES \" + (this.octaves | 0);\r\n };\r\n /** Generate the current state of the procedural texture */\r\n NoiseProceduralTexture.prototype.render = function (useCameraPostProcess) {\r\n this._updateShaderUniforms();\r\n _super.prototype.render.call(this, useCameraPostProcess);\r\n };\r\n /**\r\n * Serializes this noise procedural texture\r\n * @returns a serialized noise procedural texture object\r\n */\r\n NoiseProceduralTexture.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.customType = \"BABYLON.NoiseProceduralTexture\";\r\n serializationObject.brightness = this.brightness;\r\n serializationObject.octaves = this.octaves;\r\n serializationObject.persistence = this.persistence;\r\n serializationObject.animationSpeedFactor = this.animationSpeedFactor;\r\n serializationObject.size = this.getSize().width;\r\n serializationObject.generateMipMaps = this._generateMipMaps;\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a NoiseProceduralTexture from parsed noise procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing noise procedural texture information\r\n * @returns a parsed NoiseProceduralTexture\r\n */\r\n NoiseProceduralTexture.Parse = function (parsedTexture, scene) {\r\n var texture = new NoiseProceduralTexture(parsedTexture.name, parsedTexture.size, scene, undefined, parsedTexture.generateMipMaps);\r\n texture.brightness = parsedTexture.brightness;\r\n texture.octaves = parsedTexture.octaves;\r\n texture.persistence = parsedTexture.persistence;\r\n texture.animationSpeedFactor = parsedTexture.animationSpeedFactor;\r\n return texture;\r\n };\r\n return NoiseProceduralTexture;\r\n}(_proceduralTexture__WEBPACK_IMPORTED_MODULE_2__[\"ProceduralTexture\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.NoiseProceduralTexture\"] = NoiseProceduralTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/proceduralTexture.ts\":\n/*!*************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/proceduralTexture.ts ***!\n \\*************************************************************/\n/*! exports provided: ProceduralTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return ProceduralTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./proceduralTextureSceneComponent */ \"./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts\");\n/* harmony import */ var _Engines_Extensions_engine_renderTarget__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Engines/Extensions/engine.renderTarget */ \"./Engines/Extensions/engine.renderTarget.ts\");\n/* harmony import */ var _Shaders_procedural_vertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Shaders/procedural.vertex */ \"./Shaders/procedural.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes calmpler' images.\r\n * This is the base class of any Procedural texture and contains most of the shareable code.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures\r\n */\r\nvar ProceduralTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ProceduralTexture, _super);\r\n /**\r\n * Instantiates a new procedural texture.\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes called 'refMaps' or 'sampler' images.\r\n * This is the base class of any Procedural texture and contains most of the shareable code.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the texture to create\r\n * @param fragment Define the fragment shader to use to generate the texture or null if it is defined later\r\n * @param scene Define the scene the texture belongs to\r\n * @param fallbackTexture Define a fallback texture in case there were issues to create the custom texture\r\n * @param generateMipMaps Define if the texture should creates mip maps or not\r\n * @param isCube Define if the texture is a cube texture or not (this will render each faces of the cube)\r\n */\r\n function ProceduralTexture(name, size, fragment, scene, fallbackTexture, generateMipMaps, isCube) {\r\n if (fallbackTexture === void 0) { fallbackTexture = null; }\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (isCube === void 0) { isCube = false; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps) || this;\r\n _this.isCube = isCube;\r\n /**\r\n * Define if the texture is enabled or not (disabled texture will not render)\r\n */\r\n _this.isEnabled = true;\r\n /**\r\n * Define if the texture must be cleared before rendering (default is true)\r\n */\r\n _this.autoClear = true;\r\n /**\r\n * Event raised when the texture is generated\r\n */\r\n _this.onGeneratedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** @hidden */\r\n _this._textures = {};\r\n _this._currentRefreshId = -1;\r\n _this._refreshRate = 1;\r\n _this._vertexBuffers = {};\r\n _this._uniforms = new Array();\r\n _this._samplers = new Array();\r\n _this._floats = {};\r\n _this._ints = {};\r\n _this._floatsArrays = {};\r\n _this._colors3 = {};\r\n _this._colors4 = {};\r\n _this._vectors2 = {};\r\n _this._vectors3 = {};\r\n _this._matrices = {};\r\n _this._fallbackTextureUsed = false;\r\n _this._cachedDefines = \"\";\r\n _this._contentUpdateId = -1;\r\n scene = _this.getScene();\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_PROCEDURALTEXTURE);\r\n if (!component) {\r\n component = new _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_8__[\"ProceduralTextureSceneComponent\"](scene);\r\n scene._addComponent(component);\r\n }\r\n scene.proceduralTextures.push(_this);\r\n _this._engine = scene.getEngine();\r\n _this.name = name;\r\n _this.isRenderTarget = true;\r\n _this._size = size;\r\n _this._generateMipMaps = generateMipMaps;\r\n _this.setFragment(fragment);\r\n _this._fallbackTexture = fallbackTexture;\r\n if (isCube) {\r\n _this._texture = _this._engine.createRenderTargetCubeTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });\r\n _this.setFloat(\"face\", 0);\r\n }\r\n else {\r\n _this._texture = _this._engine.createRenderTargetTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });\r\n }\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n _this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"](_this._engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n _this._createIndexBuffer();\r\n return _this;\r\n }\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the the postprocess.\r\n */\r\n ProceduralTexture.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * Gets texture content (Use this function wisely as reading from a texture can be slow)\r\n * @returns an ArrayBufferView (Uint8Array or Float32Array)\r\n */\r\n ProceduralTexture.prototype.getContent = function () {\r\n if (this._contentData && this._currentRefreshId == this._contentUpdateId) {\r\n return this._contentData;\r\n }\r\n this._contentData = this.readPixels(0, 0, this._contentData);\r\n this._contentUpdateId = this._currentRefreshId;\r\n return this._contentData;\r\n };\r\n ProceduralTexture.prototype._createIndexBuffer = function () {\r\n var engine = this._engine;\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n };\r\n /** @hidden */\r\n ProceduralTexture.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n if (this.refreshRate === _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_7__[\"RenderTargetTexture\"].REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_7__[\"RenderTargetTexture\"].REFRESHRATE_RENDER_ONCE;\r\n }\r\n };\r\n /**\r\n * Resets the texture in order to recreate its associated resources.\r\n * This can be called in case of context loss\r\n */\r\n ProceduralTexture.prototype.reset = function () {\r\n if (this._effect === undefined) {\r\n return;\r\n }\r\n this._effect.dispose();\r\n };\r\n ProceduralTexture.prototype._getDefines = function () {\r\n return \"\";\r\n };\r\n /**\r\n * Is the texture ready to be used ? (rendered at least once)\r\n * @returns true if ready, otherwise, false.\r\n */\r\n ProceduralTexture.prototype.isReady = function () {\r\n var _this = this;\r\n var engine = this._engine;\r\n var shaders;\r\n if (!this._fragment) {\r\n return false;\r\n }\r\n if (this._fallbackTextureUsed) {\r\n return true;\r\n }\r\n var defines = this._getDefines();\r\n if (this._effect && defines === this._cachedDefines && this._effect.isReady()) {\r\n return true;\r\n }\r\n if (this._fragment.fragmentElement !== undefined) {\r\n shaders = { vertex: \"procedural\", fragmentElement: this._fragment.fragmentElement };\r\n }\r\n else {\r\n shaders = { vertex: \"procedural\", fragment: this._fragment };\r\n }\r\n this._cachedDefines = defines;\r\n this._effect = engine.createEffect(shaders, [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind], this._uniforms, this._samplers, defines, undefined, undefined, function () {\r\n _this.releaseInternalTexture();\r\n if (_this._fallbackTexture) {\r\n _this._texture = _this._fallbackTexture._texture;\r\n if (_this._texture) {\r\n _this._texture.incrementReferences();\r\n }\r\n }\r\n _this._fallbackTextureUsed = true;\r\n });\r\n return this._effect.isReady();\r\n };\r\n /**\r\n * Resets the refresh counter of the texture and start bak from scratch.\r\n * Could be useful to regenerate the texture if it is setup to render only once.\r\n */\r\n ProceduralTexture.prototype.resetRefreshCounter = function () {\r\n this._currentRefreshId = -1;\r\n };\r\n /**\r\n * Set the fragment shader to use in order to render the texture.\r\n * @param fragment This can be set to a path (into the shader store) or to a json object containing a fragmentElement property.\r\n */\r\n ProceduralTexture.prototype.setFragment = function (fragment) {\r\n this._fragment = fragment;\r\n };\r\n Object.defineProperty(ProceduralTexture.prototype, \"refreshRate\", {\r\n /**\r\n * Define the refresh rate of the texture or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n get: function () {\r\n return this._refreshRate;\r\n },\r\n set: function (value) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n ProceduralTexture.prototype._shouldRender = function () {\r\n if (!this.isEnabled || !this.isReady() || !this._texture) {\r\n if (this._texture) {\r\n this._texture.isReady = false;\r\n }\r\n return false;\r\n }\r\n if (this._fallbackTextureUsed) {\r\n return false;\r\n }\r\n if (this._currentRefreshId === -1) { // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n this._currentRefreshId++;\r\n return false;\r\n };\r\n /**\r\n * Get the size the texture is rendering at.\r\n * @returns the size (texture is always squared)\r\n */\r\n ProceduralTexture.prototype.getRenderSize = function () {\r\n return this._size;\r\n };\r\n /**\r\n * Resize the texture to new value.\r\n * @param size Define the new size the texture should have\r\n * @param generateMipMaps Define whether the new texture should create mip maps\r\n */\r\n ProceduralTexture.prototype.resize = function (size, generateMipMaps) {\r\n if (this._fallbackTextureUsed) {\r\n return;\r\n }\r\n this.releaseInternalTexture();\r\n this._texture = this._engine.createRenderTargetTexture(size, generateMipMaps);\r\n // Update properties\r\n this._size = size;\r\n this._generateMipMaps = generateMipMaps;\r\n };\r\n ProceduralTexture.prototype._checkUniform = function (uniformName) {\r\n if (this._uniforms.indexOf(uniformName) === -1) {\r\n this._uniforms.push(uniformName);\r\n }\r\n };\r\n /**\r\n * Set a texture in the shader program used to render.\r\n * @param name Define the name of the uniform samplers as defined in the shader\r\n * @param texture Define the texture to bind to this sampler\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setTexture = function (name, texture) {\r\n if (this._samplers.indexOf(name) === -1) {\r\n this._samplers.push(name);\r\n }\r\n this._textures[name] = texture;\r\n return this;\r\n };\r\n /**\r\n * Set a float in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setFloat = function (name, value) {\r\n this._checkUniform(name);\r\n this._floats[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a int in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setInt = function (name, value) {\r\n this._checkUniform(name);\r\n this._ints[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set an array of floats in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setFloats = function (name, value) {\r\n this._checkUniform(name);\r\n this._floatsArrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Color3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setColor3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Color4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setColor4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 in the shader from a Vector2.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setVector2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Vector3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setVector3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat4 in the shader from a MAtrix.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setMatrix = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Render the texture to its associated render target.\r\n * @param useCameraPostProcess Define if camera post process should be applied to the texture\r\n */\r\n ProceduralTexture.prototype.render = function (useCameraPostProcess) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = this._engine;\r\n // Render\r\n engine.enableEffect(this._effect);\r\n engine.setState(false);\r\n // Texture\r\n for (var name in this._textures) {\r\n this._effect.setTexture(name, this._textures[name]);\r\n }\r\n // Float\r\n for (name in this._ints) {\r\n this._effect.setInt(name, this._ints[name]);\r\n }\r\n // Float\r\n for (name in this._floats) {\r\n this._effect.setFloat(name, this._floats[name]);\r\n }\r\n // Floats\r\n for (name in this._floatsArrays) {\r\n this._effect.setArray(name, this._floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in this._colors3) {\r\n this._effect.setColor3(name, this._colors3[name]);\r\n }\r\n // Color4\r\n for (name in this._colors4) {\r\n var color = this._colors4[name];\r\n this._effect.setFloat4(name, color.r, color.g, color.b, color.a);\r\n }\r\n // Vector2\r\n for (name in this._vectors2) {\r\n this._effect.setVector2(name, this._vectors2[name]);\r\n }\r\n // Vector3\r\n for (name in this._vectors3) {\r\n this._effect.setVector3(name, this._vectors3[name]);\r\n }\r\n // Matrix\r\n for (name in this._matrices) {\r\n this._effect.setMatrix(name, this._matrices[name]);\r\n }\r\n if (!this._texture) {\r\n return;\r\n }\r\n if (this.isCube) {\r\n for (var face = 0; face < 6; face++) {\r\n engine.bindFramebuffer(this._texture, face, undefined, undefined, true);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);\r\n this._effect.setFloat(\"face\", face);\r\n // Clear\r\n if (this.autoClear) {\r\n engine.clear(scene.clearColor, true, false, false);\r\n }\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n // Mipmaps\r\n if (face === 5) {\r\n engine.generateMipMapsForCubemap(this._texture);\r\n }\r\n }\r\n }\r\n else {\r\n engine.bindFramebuffer(this._texture, 0, undefined, undefined, true);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);\r\n // Clear\r\n if (this.autoClear) {\r\n engine.clear(scene.clearColor, true, false, false);\r\n }\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n // Unbind\r\n engine.unBindFramebuffer(this._texture, this.isCube);\r\n if (this.onGenerated) {\r\n this.onGenerated();\r\n }\r\n this.onGeneratedObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Clone the texture.\r\n * @returns the cloned texture\r\n */\r\n ProceduralTexture.prototype.clone = function () {\r\n var textureSize = this.getSize();\r\n var newTexture = new ProceduralTexture(this.name, textureSize.width, this._fragment, this.getScene(), this._fallbackTexture, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // RenderTarget Texture\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n return newTexture;\r\n };\r\n /**\r\n * Dispose the texture and release its asoociated resources.\r\n */\r\n ProceduralTexture.prototype.dispose = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var index = scene.proceduralTextures.indexOf(this);\r\n if (index >= 0) {\r\n scene.proceduralTextures.splice(index, 1);\r\n }\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer)) {\r\n this._indexBuffer = null;\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"autoClear\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"_generateMipMaps\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"_size\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"refreshRate\", null);\r\n return ProceduralTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts\":\n/*!***************************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts ***!\n \\***************************************************************************/\n/*! exports provided: ProceduralTextureSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return ProceduralTextureSceneComponent; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../sceneComponent */ \"./sceneComponent.ts\");\n\r\n\r\n/**\r\n * Defines the Procedural Texture scene component responsible to manage any Procedural Texture\r\n * in a given scene.\r\n */\r\nvar ProceduralTextureSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function ProceduralTextureSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_PROCEDURALTEXTURE;\r\n this.scene = scene;\r\n this.scene.proceduralTextures = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n ProceduralTextureSceneComponent.prototype.register = function () {\r\n this.scene._beforeClearStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n ProceduralTextureSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n ProceduralTextureSceneComponent.prototype.dispose = function () {\r\n // Nothing to do here.\r\n };\r\n ProceduralTextureSceneComponent.prototype._beforeClear = function () {\r\n if (this.scene.proceduralTexturesEnabled) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n for (var proceduralIndex = 0; proceduralIndex < this.scene.proceduralTextures.length; proceduralIndex++) {\r\n var proceduralTexture = this.scene.proceduralTextures[proceduralIndex];\r\n if (proceduralTexture._shouldRender()) {\r\n proceduralTexture.render();\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n }\r\n };\r\n return ProceduralTextureSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/baseTexture.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Textures/baseTexture.ts ***!\n \\*******************************************/\n/*! exports provided: BaseTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return BaseTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_guid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/guid */ \"./Misc/guid.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Maths/math.size */ \"./Maths/math.size.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nvar BaseTexture = /** @class */ (function () {\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param scene Define the scene the texture blongs to\r\n */\r\n function BaseTexture(scene) {\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n this._hasAlpha = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n this.getAlphaFromRGB = false;\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n this.level = 1;\r\n /**\r\n * Define the UV chanel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n this.coordinatesIndex = 0;\r\n this._coordinatesMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_EXPLICIT_MODE;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapU = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapV = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapR = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n this.anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n this.gammaSpace = true;\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n this.invertZ = false;\r\n /**\r\n * @hidden\r\n */\r\n this.lodLevelInAlpha = false;\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n this.isRenderTarget = false;\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n this.animations = new Array();\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this._onDisposeObserver = null;\r\n /**\r\n * Define the current state of the loading sequence when in delayed load mode.\r\n */\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n this._scene = null;\r\n /** @hidden */\r\n this._texture = null;\r\n this._uid = null;\r\n this._cachedSize = _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"].Zero();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene;\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n }\r\n this._uid = null;\r\n }\r\n Object.defineProperty(BaseTexture.prototype, \"hasAlpha\", {\r\n get: function () {\r\n return this._hasAlpha;\r\n },\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n set: function (value) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag | _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"coordinatesMode\", {\r\n get: function () {\r\n return this._coordinatesMode;\r\n },\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n set: function (value) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isCube\", {\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.isCube;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.isCube = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"is3D\", {\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is3D;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is3D = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isRGBD\", {\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n get: function () {\r\n return this._texture != null && this._texture._isRGBD;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationOffset\", {\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationScale\", {\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"linearSpecularLOD\", {\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n return false;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"irradianceTexture\", {\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n return null;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"uid\", {\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = _Misc_guid__WEBPACK_IMPORTED_MODULE_7__[\"GUID\"].RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n BaseTexture.prototype.toString = function () {\r\n return this.name;\r\n };\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n BaseTexture.prototype.getClassName = function () {\r\n return \"BaseTexture\";\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"onDispose\", {\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isBlocking\", {\r\n /**\r\n * Define if the texture is preventinga material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n BaseTexture.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for istance.\r\n * @returns the transformation matrix\r\n */\r\n BaseTexture.prototype.getTextureMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].IdentityReadOnly;\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n BaseTexture.prototype.getReflectionTextureMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].IdentityReadOnly;\r\n };\r\n /**\r\n * Get the underlying lower level texture from Babylon.\r\n * @returns the insternal texture\r\n */\r\n BaseTexture.prototype.getInternalTexture = function () {\r\n return this._texture;\r\n };\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready or not blocking\r\n */\r\n BaseTexture.prototype.isReadyOrNotBlocking = function () {\r\n return !this.isBlocking || this.isReady();\r\n };\r\n /**\r\n * Get if the texture is ready to be used (downloaded, converted, mip mapped...).\r\n * @returns true if fully ready\r\n */\r\n BaseTexture.prototype.isReady = function () {\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n this.delayLoad();\r\n return false;\r\n }\r\n if (this._texture) {\r\n return this._texture.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Get the size of the texture.\r\n * @returns the texture size.\r\n */\r\n BaseTexture.prototype.getSize = function () {\r\n if (this._texture) {\r\n if (this._texture.width) {\r\n this._cachedSize.width = this._texture.width;\r\n this._cachedSize.height = this._texture.height;\r\n return this._cachedSize;\r\n }\r\n if (this._texture._size) {\r\n this._cachedSize.width = this._texture._size;\r\n this._cachedSize.height = this._texture._size;\r\n return this._cachedSize;\r\n }\r\n }\r\n return this._cachedSize;\r\n };\r\n /**\r\n * Get the base size of the texture.\r\n * It can be different from the size if the texture has been resized for POT for instance\r\n * @returns the base size\r\n */\r\n BaseTexture.prototype.getBaseSize = function () {\r\n if (!this.isReady() || !this._texture) {\r\n return _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"].Zero();\r\n }\r\n if (this._texture._size) {\r\n return new _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"](this._texture._size, this._texture._size);\r\n }\r\n return new _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"](this._texture.baseWidth, this._texture.baseHeight);\r\n };\r\n /**\r\n * Update the sampling mode of the texture.\r\n * Default is Trilinear mode.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |\r\n * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |\r\n * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |\r\n * | 4 | NEAREST_NEAREST_MIPNEAREST | |\r\n * | 5 | NEAREST_LINEAR_MIPNEAREST | |\r\n * | 6 | NEAREST_LINEAR_MIPLINEAR | |\r\n * | 7 | NEAREST_LINEAR | |\r\n * | 8 | NEAREST_NEAREST | |\r\n * | 9 | LINEAR_NEAREST_MIPNEAREST | |\r\n * | 10 | LINEAR_NEAREST_MIPLINEAR | |\r\n * | 11 | LINEAR_LINEAR | |\r\n * | 12 | LINEAR_NEAREST | |\r\n *\r\n * > _mag_: magnification filter (close to the viewer)\r\n * > _min_: minification filter (far from the viewer)\r\n * > _mip_: filter used between mip map levels\r\n *@param samplingMode Define the new sampling mode of the texture\r\n */\r\n BaseTexture.prototype.updateSamplingMode = function (samplingMode) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);\r\n };\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n BaseTexture.prototype.scale = function (ratio) {\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling, invertY) {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n var texturesCache = this._scene.getEngine().getLoadedTexturesCache();\r\n for (var index = 0; index < texturesCache.length; index++) {\r\n var texturesCacheEntry = texturesCache[index];\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n BaseTexture.prototype._rebuild = function () {\r\n };\r\n /**\r\n * Triggers the load sequence in delayed load mode.\r\n */\r\n BaseTexture.prototype.delayLoad = function () {\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n BaseTexture.prototype.clone = function () {\r\n return null;\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"textureType\", {\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n return (this._texture.type !== undefined) ? this._texture.type : _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"textureFormat\", {\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n }\r\n return (this._texture.format !== undefined) ? this._texture.format : _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @returns The Array buffer containing the pixels data.\r\n */\r\n BaseTexture.prototype.readPixels = function (faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (!this._texture) {\r\n return null;\r\n }\r\n var size = this.getSize();\r\n var width = size.width;\r\n var height = size.height;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return null;\r\n }\r\n var engine = scene.getEngine();\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer);\r\n }\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer);\r\n };\r\n /**\r\n * Release and destroy the underlying lower level texture aka internalTexture.\r\n */\r\n BaseTexture.prototype.releaseInternalTexture = function () {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"sphericalPolynomial\", {\r\n /**\r\n * Get the polynomial representation of the texture data.\r\n * This is mainly use as a fast way to recover IBL Diffuse irradiance data.\r\n * @see https://learnopengl.com/PBR/IBL/Diffuse-irradiance\r\n */\r\n get: function () {\r\n if (!this._texture || !_Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__[\"CubeMapToSphericalPolynomialTools\"] || !this.isReady()) {\r\n return null;\r\n }\r\n if (!this._texture._sphericalPolynomial) {\r\n this._texture._sphericalPolynomial =\r\n _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__[\"CubeMapToSphericalPolynomialTools\"].ConvertCubeMapTextureToSphericalPolynomial(this);\r\n }\r\n return this._texture._sphericalPolynomial;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._sphericalPolynomial = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureHigh\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureMid\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureLow\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n BaseTexture.prototype.dispose = function () {\r\n if (!this._scene) {\r\n return;\r\n }\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n // Remove from scene\r\n this._scene._removePendingData(this);\r\n var index = this._scene.textures.indexOf(this);\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n if (this._texture === undefined) {\r\n return;\r\n }\r\n // Release\r\n this.releaseInternalTexture();\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @returns the JSON representation of the texture\r\n */\r\n BaseTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n BaseTexture.WhenAllReady = function (textures, callback) {\r\n var numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n var _loop_1 = function () {\r\n texture = textures[i];\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n else {\r\n onLoadObservable = texture.onLoadObservable;\r\n var onLoadCallback_1 = function () {\r\n onLoadObservable.removeCallback(onLoadCallback_1);\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n };\r\n onLoadObservable.add(onLoadCallback_1);\r\n }\r\n };\r\n var texture, onLoadObservable;\r\n for (var i = 0; i < textures.length; i++) {\r\n _loop_1();\r\n }\r\n };\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"uniqueId\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"metadata\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"hasAlpha\")\r\n ], BaseTexture.prototype, \"_hasAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"getAlphaFromRGB\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"level\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"coordinatesIndex\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"coordinatesMode\")\r\n ], BaseTexture.prototype, \"_coordinatesMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"wrapU\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"wrapV\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"wrapR\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"anisotropicFilteringLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"isCube\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"is3D\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"gammaSpace\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"invertZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"lodLevelInAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"lodGenerationOffset\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"lodGenerationScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"linearSpecularLOD\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])()\r\n ], BaseTexture.prototype, \"irradianceTexture\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"isRenderTarget\", void 0);\r\n return BaseTexture;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/colorGradingTexture.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Textures/colorGradingTexture.ts ***!\n \\***************************************************/\n/*! exports provided: ColorGradingTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return ColorGradingTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a color grading texture. This acts as a lookup table LUT, useful during post process\r\n * It can help converting any input color in a desired output one. This can then be used to create effects\r\n * from sepia, black and white to sixties or futuristic rendering...\r\n *\r\n * The only supported format is currently 3dl.\r\n * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table\r\n */\r\nvar ColorGradingTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorGradingTexture, _super);\r\n /**\r\n * Instantiates a ColorGradingTexture from the following parameters.\r\n *\r\n * @param url The location of the color gradind data (currently only supporting 3dl)\r\n * @param scene The scene the texture will be used in\r\n */\r\n function ColorGradingTexture(url, scene) {\r\n var _this = _super.call(this, scene) || this;\r\n if (!url) {\r\n return _this;\r\n }\r\n _this._engine = scene.getEngine();\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _this.name = url;\r\n _this.url = url;\r\n _this.hasAlpha = false;\r\n _this.isCube = false;\r\n _this.is3D = _this._engine.webGLVersion > 1;\r\n _this.wrapU = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n _this.wrapR = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n _this.anisotropicFilteringLevel = 1;\r\n _this._texture = _this._getFromCache(url, true);\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n _this.loadTexture();\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Returns the texture matrix used in most of the material.\r\n * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).\r\n */\r\n ColorGradingTexture.prototype.getTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Occurs when the file being loaded is a .3dl LUT file.\r\n */\r\n ColorGradingTexture.prototype.load3dlTexture = function () {\r\n var engine = this._engine;\r\n var texture;\r\n if (engine.webGLVersion === 1) {\r\n texture = engine.createRawTexture(null, 1, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE);\r\n }\r\n else {\r\n texture = engine.createRawTexture3D(null, 1, 1, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE);\r\n }\r\n this._texture = texture;\r\n var callback = function (text) {\r\n if (typeof text !== \"string\") {\r\n return;\r\n }\r\n var data = null;\r\n var tempData = null;\r\n var line;\r\n var lines = text.split('\\n');\r\n var size = 0, pixelIndexW = 0, pixelIndexH = 0, pixelIndexSlice = 0;\r\n var maxColor = 0;\r\n for (var i = 0; i < lines.length; i++) {\r\n line = lines[i];\r\n if (!ColorGradingTexture._noneEmptyLineRegex.test(line)) {\r\n continue;\r\n }\r\n if (line.indexOf('#') === 0) {\r\n continue;\r\n }\r\n var words = line.split(\" \");\r\n if (size === 0) {\r\n // Number of space + one\r\n size = words.length;\r\n data = new Uint8Array(size * size * size * 4); // volume texture of side size and rgb 8\r\n tempData = new Float32Array(size * size * size * 4);\r\n continue;\r\n }\r\n if (size != 0) {\r\n var r = Math.max(parseInt(words[0]), 0);\r\n var g = Math.max(parseInt(words[1]), 0);\r\n var b = Math.max(parseInt(words[2]), 0);\r\n maxColor = Math.max(r, maxColor);\r\n maxColor = Math.max(g, maxColor);\r\n maxColor = Math.max(b, maxColor);\r\n var pixelStorageIndex = (pixelIndexW + pixelIndexSlice * size + pixelIndexH * size * size) * 4;\r\n if (tempData) {\r\n tempData[pixelStorageIndex + 0] = r;\r\n tempData[pixelStorageIndex + 1] = g;\r\n tempData[pixelStorageIndex + 2] = b;\r\n }\r\n // Keep for reference in case of back compat problems.\r\n // pixelIndexSlice++;\r\n // if (pixelIndexSlice % size == 0) {\r\n // pixelIndexH++;\r\n // pixelIndexSlice = 0;\r\n // if (pixelIndexH % size == 0) {\r\n // pixelIndexW++;\r\n // pixelIndexH = 0;\r\n // }\r\n // }\r\n pixelIndexH++;\r\n if (pixelIndexH % size == 0) {\r\n pixelIndexSlice++;\r\n pixelIndexH = 0;\r\n if (pixelIndexSlice % size == 0) {\r\n pixelIndexW++;\r\n pixelIndexSlice = 0;\r\n }\r\n }\r\n }\r\n }\r\n if (tempData && data) {\r\n for (var i = 0; i < tempData.length; i++) {\r\n if (i > 0 && (i + 1) % 4 === 0) {\r\n data[i] = 255;\r\n }\r\n else {\r\n var value = tempData[i];\r\n data[i] = (value / maxColor * 255);\r\n }\r\n }\r\n }\r\n if (texture.is3D) {\r\n texture.updateSize(size, size, size);\r\n engine.updateRawTexture3D(texture, data, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false);\r\n }\r\n else {\r\n texture.updateSize(size * size, size);\r\n engine.updateRawTexture(texture, data, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false);\r\n }\r\n };\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene._loadFile(this.url, callback);\r\n }\r\n else {\r\n this._engine._loadFile(this.url, callback);\r\n }\r\n return this._texture;\r\n };\r\n /**\r\n * Starts the loading process of the texture.\r\n */\r\n ColorGradingTexture.prototype.loadTexture = function () {\r\n if (this.url && this.url.toLocaleLowerCase().indexOf(\".3dl\") == (this.url.length - 4)) {\r\n this.load3dlTexture();\r\n }\r\n };\r\n /**\r\n * Clones the color gradind texture.\r\n */\r\n ColorGradingTexture.prototype.clone = function () {\r\n var newTexture = new ColorGradingTexture(this.url, this.getScene());\r\n // Base texture\r\n newTexture.level = this.level;\r\n return newTexture;\r\n };\r\n /**\r\n * Called during delayed load for textures.\r\n */\r\n ColorGradingTexture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, true);\r\n if (!this._texture) {\r\n this.loadTexture();\r\n }\r\n };\r\n /**\r\n * Parses a color grading texture serialized by Babylon.\r\n * @param parsedTexture The texture information being parsedTexture\r\n * @param scene The scene to load the texture in\r\n * @param rootUrl The root url of the data assets to load\r\n * @return A color gradind texture\r\n */\r\n ColorGradingTexture.Parse = function (parsedTexture, scene) {\r\n var texture = null;\r\n if (parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n texture = new ColorGradingTexture(parsedTexture.name, scene);\r\n texture.name = parsedTexture.name;\r\n texture.level = parsedTexture.level;\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Serializes the LUT texture to json format.\r\n */\r\n ColorGradingTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.level = this.level;\r\n serializationObject.customType = \"BABYLON.ColorGradingTexture\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Empty line regex stored for GC.\r\n */\r\n ColorGradingTexture._noneEmptyLineRegex = /\\S+/;\r\n return ColorGradingTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_2__[\"BaseTexture\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ColorGradingTexture\"] = ColorGradingTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/cubeTexture.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Textures/cubeTexture.ts ***!\n \\*******************************************/\n/*! exports provided: CubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return CubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_Extensions_engine_cubeTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Engines/Extensions/engine.cubeTexture */ \"./Engines/Extensions/engine.cubeTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nvar CubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CubeTexture, _super);\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param scene defines the scene the texture is attached to\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occured\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @return the cube texture\r\n */\r\n function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension, createPolynomials, lodScale, lodOffset) {\r\n if (extensions === void 0) { extensions = null; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (files === void 0) { files = null; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (prefiltered === void 0) { prefiltered = false; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n var _this = _super.call(this, scene) || this;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see http://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n _this.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._rotationY = 0;\r\n /** @hidden */\r\n _this._prefiltered = false;\r\n _this.name = rootUrl;\r\n _this.url = rootUrl;\r\n _this._noMipmap = noMipmap;\r\n _this.hasAlpha = false;\r\n _this._format = format;\r\n _this.isCube = true;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n _this._createPolynomials = createPolynomials;\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].CUBIC_MODE;\r\n if (!rootUrl && !files) {\r\n return _this;\r\n }\r\n var lastDot = rootUrl.lastIndexOf(\".\");\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var isDDS = (extension === \".dds\");\r\n var isEnv = (extension === \".env\");\r\n if (isEnv) {\r\n _this.gammaSpace = false;\r\n _this._prefiltered = false;\r\n }\r\n else {\r\n _this._prefiltered = prefiltered;\r\n if (prefiltered) {\r\n _this.gammaSpace = false;\r\n }\r\n }\r\n _this._texture = _this._getFromCache(rootUrl, noMipmap);\r\n if (!files) {\r\n if (!isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n files = [];\r\n if (extensions) {\r\n for (var index = 0; index < extensions.length; index++) {\r\n files.push(rootUrl + extensions[index]);\r\n }\r\n }\r\n }\r\n _this._files = files;\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n if (prefiltered) {\r\n _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);\r\n }\r\n else {\r\n _this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension, false, lodScale, lodOffset);\r\n }\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n else if (onLoad) {\r\n if (_this._texture.isReady) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetImmediate(function () { return onLoad(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(CubeTexture.prototype, \"boundingBoxSize\", {\r\n /**\r\n * Returns the bounding box size\r\n * @see http://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"rotationY\", {\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n get: function () {\r\n return this._rotationY;\r\n },\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n set: function (value) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationY(this._rotationY));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n CubeTexture.CreateFromImages = function (files, scene, noMipmap) {\r\n var rootUrlKey = \"\";\r\n files.forEach(function (url) { return rootUrlKey += url; });\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n };\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @return the prefiltered texture\r\n */\r\n CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension, createPolynomials) {\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = true; }\r\n return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n };\r\n Object.defineProperty(CubeTexture.prototype, \"isPrefiltered\", {\r\n /**\r\n * Gets a boolean indicating if the cube texture contains prefiltered mips (used to simulate roughness with PBR)\r\n */\r\n get: function () {\r\n return this._prefiltered;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"CubeTexture\"\r\n */\r\n CubeTexture.prototype.getClassName = function () {\r\n return \"CubeTexture\";\r\n };\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n */\r\n CubeTexture.prototype.updateURL = function (url, forcedExtension, onLoad) {\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n this.name = url;\r\n this.url = url;\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n this._prefiltered = false;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad(forcedExtension);\r\n };\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n CubeTexture.prototype.delayLoad = function (forcedExtension) {\r\n if (this.delayLoadState !== _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n if (!this._texture) {\r\n if (this._prefiltered) {\r\n this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);\r\n }\r\n else {\r\n this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n CubeTexture.prototype.getReflectionTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n CubeTexture.prototype.setReflectionTextureMatrix = function (value) {\r\n var _this = this;\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) { return mat.getActiveTextures().indexOf(_this) !== -1; });\r\n }\r\n this._textureMatrix = value;\r\n };\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n CubeTexture.Parse = function (parsedTexture, scene, rootUrl) {\r\n var texture = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () {\r\n var prefiltered = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.extensions, false, parsedTexture.files || null, null, null, undefined, prefiltered);\r\n }, parsedTexture, scene);\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n // Animations\r\n if (parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n CubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n var uniqueId = 0;\r\n var newCubeTexture = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () {\r\n if (!scene) {\r\n return _this;\r\n }\r\n var cubeTexture = new CubeTexture(_this.url, scene, _this._extensions, _this._noMipmap, _this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n return cubeTexture;\r\n }, this);\r\n newCubeTexture.uniqueId = uniqueId;\r\n return newCubeTexture;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"rotationY\")\r\n ], CubeTexture.prototype, \"rotationY\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"files\")\r\n ], CubeTexture.prototype, \"_files\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMatrix\"])(\"textureMatrix\")\r\n ], CubeTexture.prototype, \"_textureMatrix\", void 0);\r\n return CubeTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__[\"BaseTexture\"]));\r\n\r\n_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"]._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.CubeTexture\"] = CubeTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/dynamicTexture.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Textures/dynamicTexture.ts ***!\n \\**********************************************/\n/*! exports provided: DynamicTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return DynamicTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * A class extending Texture allowing drawing on a texture\r\n * @see http://doc.babylonjs.com/how_to/dynamictexture\r\n */\r\nvar DynamicTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DynamicTexture, _super);\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param options provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param scene defines the scene where you want the texture\r\n * @param generateMipMaps defines the use of MinMaps or not (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param format defines the texture format to use (default is Engine.TEXTUREFORMAT_RGBA)\r\n */\r\n function DynamicTexture(name, options, scene, generateMipMaps, samplingMode, format) {\r\n if (scene === void 0) { scene = null; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, undefined, samplingMode, undefined, undefined, undefined, undefined, format) || this;\r\n _this.name = name;\r\n _this._engine = _this.getScene().getEngine();\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this._generateMipMaps = generateMipMaps;\r\n if (options.getContext) {\r\n _this._canvas = options;\r\n _this._texture = _this._engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._canvas = document.createElement(\"canvas\");\r\n if (options.width || options.width === 0) {\r\n _this._texture = _this._engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._texture = _this._engine.createDynamicTexture(options, options, generateMipMaps, samplingMode);\r\n }\r\n }\r\n var textureSize = _this.getSize();\r\n _this._canvas.width = textureSize.width;\r\n _this._canvas.height = textureSize.height;\r\n _this._context = _this._canvas.getContext(\"2d\");\r\n return _this;\r\n }\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"DynamicTexture\"\r\n */\r\n DynamicTexture.prototype.getClassName = function () {\r\n return \"DynamicTexture\";\r\n };\r\n Object.defineProperty(DynamicTexture.prototype, \"canRescale\", {\r\n /**\r\n * Gets the current state of canRescale\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DynamicTexture.prototype._recreate = function (textureSize) {\r\n this._canvas.width = textureSize.width;\r\n this._canvas.height = textureSize.height;\r\n this.releaseInternalTexture();\r\n this._texture = this._engine.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);\r\n };\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n DynamicTexture.prototype.scale = function (ratio) {\r\n var textureSize = this.getSize();\r\n textureSize.width *= ratio;\r\n textureSize.height *= ratio;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n DynamicTexture.prototype.scaleTo = function (width, height) {\r\n var textureSize = this.getSize();\r\n textureSize.width = width;\r\n textureSize.height = height;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Gets the context of the canvas used by the texture\r\n * @returns the canvas context of the dynamic texture\r\n */\r\n DynamicTexture.prototype.getContext = function () {\r\n return this._context;\r\n };\r\n /**\r\n * Clears the texture\r\n */\r\n DynamicTexture.prototype.clear = function () {\r\n var size = this.getSize();\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n };\r\n /**\r\n * Updates the texture\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param premulAlpha defines if alpha is stored as premultiplied (default is false)\r\n */\r\n DynamicTexture.prototype.update = function (invertY, premulAlpha) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n this._engine.updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY, premulAlpha, this._format || undefined);\r\n };\r\n /**\r\n * Draws text onto the texture\r\n * @param text defines the text to be drawn\r\n * @param x defines the placement of the text from the left\r\n * @param y defines the placement of the text from the top when invertY is true and from the bottom when false\r\n * @param font defines the font to be used with font-style, font-size, font-name\r\n * @param color defines the color used for the text\r\n * @param clearColor defines the color for the canvas, use null to not overwrite canvas\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param update defines whether texture is immediately update (default is true)\r\n */\r\n DynamicTexture.prototype.drawText = function (text, x, y, font, color, clearColor, invertY, update) {\r\n if (update === void 0) { update = true; }\r\n var size = this.getSize();\r\n if (clearColor) {\r\n this._context.fillStyle = clearColor;\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n }\r\n this._context.font = font;\r\n if (x === null || x === undefined) {\r\n var textSize = this._context.measureText(text);\r\n x = (size.width - textSize.width) / 2;\r\n }\r\n if (y === null || y === undefined) {\r\n var fontSize = parseInt((font.replace(/\\D/g, '')));\r\n y = (size.height / 2) + (fontSize / 3.65);\r\n }\r\n this._context.fillStyle = color;\r\n this._context.fillText(text, x, y);\r\n if (update) {\r\n this.update(invertY);\r\n }\r\n };\r\n /**\r\n * Clones the texture\r\n * @returns the clone of the texture.\r\n */\r\n DynamicTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new DynamicTexture(this.name, textureSize, scene, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Dynamic Texture\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n return newTexture;\r\n };\r\n /**\r\n * Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized\r\n * @returns a serialized dynamic texture object\r\n */\r\n DynamicTexture.prototype.serialize = function () {\r\n var scene = this.getScene();\r\n if (scene && !scene.isReady()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"The scene must be ready before serializing the dynamic texture\");\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.base64String = this._canvas.toDataURL();\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n DynamicTexture.prototype._rebuild = function () {\r\n this.update();\r\n };\r\n return DynamicTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/equiRectangularCubeTexture.ts\":\n/*!**********************************************************!*\\\n !*** ./Materials/Textures/equiRectangularCubeTexture.ts ***!\n \\**********************************************************/\n/*! exports provided: EquiRectangularCubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return EquiRectangularCubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_HighDynamicRange_panoramaToCubemap__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/panoramaToCubemap */ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _baseTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a texture coming from an equirectangular image supported by the web browser canvas.\r\n */\r\nvar EquiRectangularCubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](EquiRectangularCubeTexture, _super);\r\n /**\r\n * Instantiates an EquiRectangularCubeTexture from the following parameters.\r\n * @param url The location of the image\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @param onLoad — defines a callback called when texture is loaded\r\n * @param onError — defines a callback called if there is an error\r\n */\r\n function EquiRectangularCubeTexture(url, scene, size, noMipmap, gammaSpace, onLoad, onError) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (gammaSpace === void 0) { gammaSpace = true; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n var _this = _super.call(this, scene) || this;\r\n _this._onLoad = null;\r\n _this._onError = null;\r\n /** The texture coordinates mode. As this texture is stored in a cube format, please modify carefully. */\r\n _this.coordinatesMode = _texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CUBIC_MODE;\r\n if (!url) {\r\n throw new Error('Image url is not set');\r\n }\r\n _this.name = url;\r\n _this.url = url;\r\n _this._size = size;\r\n _this._noMipmap = noMipmap;\r\n _this.gammaSpace = gammaSpace;\r\n _this._onLoad = onLoad;\r\n _this._onError = onError;\r\n _this.hasAlpha = false;\r\n _this.isCube = true;\r\n _this._texture = _this._getFromCache(url, _this._noMipmap);\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n _this.loadImage(_this.loadTexture.bind(_this), _this._onError);\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n else if (onLoad) {\r\n if (_this._texture.isReady) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].SetImmediate(function () { return onLoad(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Load the image data, by putting the image on a canvas and extracting its buffer.\r\n */\r\n EquiRectangularCubeTexture.prototype.loadImage = function (loadTextureCallback, onError) {\r\n var _this = this;\r\n var canvas = document.createElement('canvas');\r\n var image = new Image();\r\n image.addEventListener('load', function () {\r\n _this._width = image.width;\r\n _this._height = image.height;\r\n canvas.width = _this._width;\r\n canvas.height = _this._height;\r\n var ctx = canvas.getContext('2d');\r\n ctx.drawImage(image, 0, 0);\r\n var imageData = ctx.getImageData(0, 0, image.width, image.height);\r\n _this._buffer = imageData.data.buffer;\r\n canvas.remove();\r\n loadTextureCallback();\r\n });\r\n image.addEventListener('error', function (error) {\r\n if (onError) {\r\n onError(_this.getClassName() + \" could not be loaded\", error);\r\n }\r\n });\r\n image.src = this.url;\r\n };\r\n /**\r\n * Convert the image buffer into a cubemap and create a CubeTexture.\r\n */\r\n EquiRectangularCubeTexture.prototype.loadTexture = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n var callback = function () {\r\n var imageData = _this.getFloat32ArrayFromArrayBuffer(_this._buffer);\r\n // Extract the raw linear data.\r\n var data = _Misc_HighDynamicRange_panoramaToCubemap__WEBPACK_IMPORTED_MODULE_1__[\"PanoramaToCubeMapTools\"].ConvertPanoramaToCubemap(imageData, _this._width, _this._height, _this._size);\r\n var results = [];\r\n // Push each faces.\r\n for (var i = 0; i < 6; i++) {\r\n var dataFace = data[EquiRectangularCubeTexture._FacesMapping[i]];\r\n results.push(dataFace);\r\n }\r\n return results;\r\n };\r\n if (!scene) {\r\n return;\r\n }\r\n this._texture = scene\r\n .getEngine()\r\n .createRawCubeTextureFromUrl(this.url, scene, this._size, _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTUREFORMAT_RGB, scene.getEngine().getCaps().textureFloat\r\n ? _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_FLOAT\r\n : _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_UNSIGNED_INTEGER, this._noMipmap, callback, null, this._onLoad, this._onError);\r\n };\r\n /**\r\n * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.\r\n * @param buffer The ArrayBuffer that should be converted.\r\n * @returns The buffer as Float32Array.\r\n */\r\n EquiRectangularCubeTexture.prototype.getFloat32ArrayFromArrayBuffer = function (buffer) {\r\n var dataView = new DataView(buffer);\r\n var floatImageData = new Float32Array((buffer.byteLength * 3) / 4);\r\n var k = 0;\r\n for (var i = 0; i < buffer.byteLength; i++) {\r\n // We drop the transparency channel, because we do not need/want it\r\n if ((i + 1) % 4 !== 0) {\r\n floatImageData[k++] = dataView.getUint8(i) / 255;\r\n }\r\n }\r\n return floatImageData;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"EquiRectangularCubeTexture\"\r\n */\r\n EquiRectangularCubeTexture.prototype.getClassName = function () {\r\n return \"EquiRectangularCubeTexture\";\r\n };\r\n /**\r\n * Create a clone of the current EquiRectangularCubeTexture and return it.\r\n * @returns A clone of the current EquiRectangularCubeTexture.\r\n */\r\n EquiRectangularCubeTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var newTexture = new EquiRectangularCubeTexture(this.url, scene, this._size, this._noMipmap, this.gammaSpace);\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n return newTexture;\r\n };\r\n /** The six faces of the cube. */\r\n EquiRectangularCubeTexture._FacesMapping = ['right', 'left', 'up', 'down', 'front', 'back'];\r\n return EquiRectangularCubeTexture;\r\n}(_baseTexture__WEBPACK_IMPORTED_MODULE_3__[\"BaseTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/hdrCubeTexture.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Textures/hdrCubeTexture.ts ***!\n \\**********************************************/\n/*! exports provided: HDRCubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return HDRCubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_hdr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/hdr */ \"./Misc/HighDynamicRange/hdr.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a texture coming from an HDR input.\r\n *\r\n * The only supported format is currently panorama picture stored in RGBE format.\r\n * Example of such files can be found on HDRLib: http://hdrlib.com/\r\n */\r\nvar HDRCubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HDRCubeTexture, _super);\r\n /**\r\n * Instantiates an HDRTexture from the following parameters.\r\n *\r\n * @param url The location of the HDR raw data (Panorama stored in RGBE format)\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process\r\n * @param gammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * @param reserved Reserved flag for internal use.\r\n */\r\n function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, gammaSpace, reserved, onLoad, onError) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (generateHarmonics === void 0) { generateHarmonics = true; }\r\n if (gammaSpace === void 0) { gammaSpace = false; }\r\n if (reserved === void 0) { reserved = false; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n var _this = _super.call(this, scene) || this;\r\n _this._generateHarmonics = true;\r\n _this._onLoad = null;\r\n _this._onError = null;\r\n /**\r\n * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.\r\n */\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CUBIC_MODE;\r\n _this._isBlocking = true;\r\n _this._rotationY = 0;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture\r\n * It must define where the camera used to render the texture was set\r\n */\r\n _this.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n if (!url) {\r\n return _this;\r\n }\r\n _this.name = url;\r\n _this.url = url;\r\n _this.hasAlpha = false;\r\n _this.isCube = true;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _this._onLoad = onLoad;\r\n _this._onError = onError;\r\n _this.gammaSpace = gammaSpace;\r\n _this._noMipmap = noMipmap;\r\n _this._size = size;\r\n _this._texture = _this._getFromCache(url, _this._noMipmap);\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n _this.loadTexture();\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n else if (onLoad) {\r\n if (_this._texture.isReady) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_9__[\"Tools\"].SetImmediate(function () { return onLoad(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(HDRCubeTexture.prototype, \"isBlocking\", {\r\n /**\r\n * Gets wether or not the texture is blocking during loading.\r\n */\r\n get: function () {\r\n return this._isBlocking;\r\n },\r\n /**\r\n * Sets wether or not the texture is blocking during loading.\r\n */\r\n set: function (value) {\r\n this._isBlocking = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HDRCubeTexture.prototype, \"rotationY\", {\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n get: function () {\r\n return this._rotationY;\r\n },\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n set: function (value) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationY(this._rotationY));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HDRCubeTexture.prototype, \"boundingBoxSize\", {\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"HDRCubeTexture\"\r\n */\r\n HDRCubeTexture.prototype.getClassName = function () {\r\n return \"HDRCubeTexture\";\r\n };\r\n /**\r\n * Occurs when the file is raw .hdr file.\r\n */\r\n HDRCubeTexture.prototype.loadTexture = function () {\r\n var _this = this;\r\n var callback = function (buffer) {\r\n _this.lodGenerationOffset = 0.0;\r\n _this.lodGenerationScale = 0.8;\r\n var scene = _this.getScene();\r\n if (!scene) {\r\n return null;\r\n }\r\n // Extract the raw linear data.\r\n var data = _Misc_HighDynamicRange_hdr__WEBPACK_IMPORTED_MODULE_6__[\"HDRTools\"].GetCubeMapTextureData(buffer, _this._size);\r\n // Generate harmonics if needed.\r\n if (_this._generateHarmonics) {\r\n var sphericalPolynomial = _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_7__[\"CubeMapToSphericalPolynomialTools\"].ConvertCubeMapToSphericalPolynomial(data);\r\n _this.sphericalPolynomial = sphericalPolynomial;\r\n }\r\n var results = [];\r\n var byteArray = null;\r\n // Push each faces.\r\n for (var j = 0; j < 6; j++) {\r\n // Create uintarray fallback.\r\n if (!scene.getEngine().getCaps().textureFloat) {\r\n // 3 channels of 1 bytes per pixel in bytes.\r\n var byteBuffer = new ArrayBuffer(_this._size * _this._size * 3);\r\n byteArray = new Uint8Array(byteBuffer);\r\n }\r\n var dataFace = (data[HDRCubeTexture._facesMapping[j]]);\r\n // If special cases.\r\n if (_this.gammaSpace || byteArray) {\r\n for (var i = 0; i < _this._size * _this._size; i++) {\r\n // Put in gamma space if requested.\r\n if (_this.gammaSpace) {\r\n dataFace[(i * 3) + 0] = Math.pow(dataFace[(i * 3) + 0], _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__[\"ToGammaSpace\"]);\r\n dataFace[(i * 3) + 1] = Math.pow(dataFace[(i * 3) + 1], _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__[\"ToGammaSpace\"]);\r\n dataFace[(i * 3) + 2] = Math.pow(dataFace[(i * 3) + 2], _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__[\"ToGammaSpace\"]);\r\n }\r\n // Convert to int texture for fallback.\r\n if (byteArray) {\r\n var r = Math.max(dataFace[(i * 3) + 0] * 255, 0);\r\n var g = Math.max(dataFace[(i * 3) + 1] * 255, 0);\r\n var b = Math.max(dataFace[(i * 3) + 2] * 255, 0);\r\n // May use luminance instead if the result is not accurate.\r\n var max = Math.max(Math.max(r, g), b);\r\n if (max > 255) {\r\n var scale = 255 / max;\r\n r *= scale;\r\n g *= scale;\r\n b *= scale;\r\n }\r\n byteArray[(i * 3) + 0] = r;\r\n byteArray[(i * 3) + 1] = g;\r\n byteArray[(i * 3) + 2] = b;\r\n }\r\n }\r\n }\r\n if (byteArray) {\r\n results.push(byteArray);\r\n }\r\n else {\r\n results.push(dataFace);\r\n }\r\n }\r\n return results;\r\n };\r\n var scene = this.getScene();\r\n if (scene) {\r\n this._texture = scene.getEngine().createRawCubeTextureFromUrl(this.url, scene, this._size, _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTUREFORMAT_RGB, scene.getEngine().getCaps().textureFloat ? _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_FLOAT : _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT, this._noMipmap, callback, null, this._onLoad, this._onError);\r\n }\r\n };\r\n HDRCubeTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var newTexture = new HDRCubeTexture(this.url, scene, this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n return newTexture;\r\n };\r\n // Methods\r\n HDRCubeTexture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n if (!this._texture) {\r\n this.loadTexture();\r\n }\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n HDRCubeTexture.prototype.getReflectionTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Set the texture reflection matrix used to rotate/transform the reflection.\r\n * @param value Define the reflection matrix to set\r\n */\r\n HDRCubeTexture.prototype.setReflectionTextureMatrix = function (value) {\r\n var _this = this;\r\n this._textureMatrix = value;\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) { return mat.getActiveTextures().indexOf(_this) !== -1; });\r\n }\r\n };\r\n /**\r\n * Parses a JSON representation of an HDR Texture in order to create the texture\r\n * @param parsedTexture Define the JSON representation\r\n * @param scene Define the scene the texture should be created in\r\n * @param rootUrl Define the root url in case we need to load relative dependencies\r\n * @returns the newly created texture after parsing\r\n */\r\n HDRCubeTexture.Parse = function (parsedTexture, scene, rootUrl) {\r\n var texture = null;\r\n if (parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n texture = new HDRCubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace);\r\n texture.name = parsedTexture.name;\r\n texture.hasAlpha = parsedTexture.hasAlpha;\r\n texture.level = parsedTexture.level;\r\n texture.coordinatesMode = parsedTexture.coordinatesMode;\r\n texture.isBlocking = parsedTexture.isBlocking;\r\n }\r\n if (texture) {\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n if (parsedTexture.rotationY) {\r\n texture.rotationY = parsedTexture.rotationY;\r\n }\r\n }\r\n return texture;\r\n };\r\n HDRCubeTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.hasAlpha = this.hasAlpha;\r\n serializationObject.isCube = true;\r\n serializationObject.level = this.level;\r\n serializationObject.size = this._size;\r\n serializationObject.coordinatesMode = this.coordinatesMode;\r\n serializationObject.useInGammaSpace = this.gammaSpace;\r\n serializationObject.generateHarmonics = this._generateHarmonics;\r\n serializationObject.customType = \"BABYLON.HDRCubeTexture\";\r\n serializationObject.noMipmap = this._noMipmap;\r\n serializationObject.isBlocking = this._isBlocking;\r\n serializationObject.rotationY = this._rotationY;\r\n return serializationObject;\r\n };\r\n HDRCubeTexture._facesMapping = [\r\n \"right\",\r\n \"left\",\r\n \"up\",\r\n \"down\",\r\n \"front\",\r\n \"back\"\r\n ];\r\n return HDRCubeTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_3__[\"BaseTexture\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.HDRCubeTexture\"] = HDRCubeTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/htmlElementTexture.ts\":\n/*!**************************************************!*\\\n !*** ./Materials/Textures/htmlElementTexture.ts ***!\n \\**************************************************/\n/*! exports provided: HtmlElementTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return HtmlElementTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This represents the smallest workload to use an already existing element (Canvas or Video) as a texture.\r\n * To be as efficient as possible depending on your constraints nothing aside the first upload\r\n * is automatically managed.\r\n * It is a cheap VideoTexture or DynamicTexture if you prefer to keep full control of the elements\r\n * in your application.\r\n *\r\n * As the update is not automatic, you need to call them manually.\r\n */\r\nvar HtmlElementTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HtmlElementTexture, _super);\r\n /**\r\n * Instantiates a HtmlElementTexture from the following parameters.\r\n *\r\n * @param name Defines the name of the texture\r\n * @param element Defines the video or canvas the texture is filled with\r\n * @param options Defines the other none mandatory texture creation options\r\n */\r\n function HtmlElementTexture(name, element, options) {\r\n var _this = _super.call(this, options.scene) || this;\r\n if (!element || (!options.engine && !options.scene)) {\r\n return _this;\r\n }\r\n options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, HtmlElementTexture.DefaultOptions, options);\r\n _this._engine = options.engine || options.scene.getEngine();\r\n _this._generateMipMaps = options.generateMipMaps;\r\n _this._samplingMode = options.samplingMode;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n _this.name = name;\r\n _this.element = element;\r\n _this._isVideo = (element instanceof HTMLVideoElement);\r\n _this.anisotropicFilteringLevel = 1;\r\n _this._createInternalTexture();\r\n return _this;\r\n }\r\n HtmlElementTexture.prototype._createInternalTexture = function () {\r\n var width = 0;\r\n var height = 0;\r\n if (this._isVideo) {\r\n width = this.element.videoWidth;\r\n height = this.element.videoHeight;\r\n }\r\n else {\r\n width = this.element.width;\r\n height = this.element.height;\r\n }\r\n this._texture = this._engine.createDynamicTexture(width, height, this._generateMipMaps, this._samplingMode);\r\n this.update();\r\n };\r\n /**\r\n * Returns the texture matrix used in most of the material.\r\n */\r\n HtmlElementTexture.prototype.getTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Updates the content of the texture.\r\n * @param invertY Defines wether the texture should be inverted on Y (false by default on video and true on canvas)\r\n */\r\n HtmlElementTexture.prototype.update = function (invertY) {\r\n if (invertY === void 0) { invertY = null; }\r\n if (this._texture == null) {\r\n return;\r\n }\r\n if (this._isVideo) {\r\n var videoElement = this.element;\r\n if (videoElement.readyState < videoElement.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n this._engine.updateVideoTexture(this._texture, videoElement, invertY === null ? true : invertY);\r\n }\r\n else {\r\n var canvasElement = this.element;\r\n this._engine.updateDynamicTexture(this._texture, canvasElement, invertY === null ? true : invertY, false);\r\n }\r\n };\r\n HtmlElementTexture.DefaultOptions = {\r\n generateMipMaps: false,\r\n samplingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE,\r\n engine: null,\r\n scene: null\r\n };\r\n return HtmlElementTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_1__[\"BaseTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/index.ts\":\n/*!*************************************!*\\\n !*** ./Materials/Textures/index.ts ***!\n \\*************************************/\n/*! exports provided: BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _baseTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _baseTexture__WEBPACK_IMPORTED_MODULE_0__[\"BaseTexture\"]; });\n\n/* harmony import */ var _colorGradingTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colorGradingTexture */ \"./Materials/Textures/colorGradingTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _colorGradingTexture__WEBPACK_IMPORTED_MODULE_1__[\"ColorGradingTexture\"]; });\n\n/* harmony import */ var _cubeTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _cubeTexture__WEBPACK_IMPORTED_MODULE_2__[\"CubeTexture\"]; });\n\n/* harmony import */ var _dynamicTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _dynamicTexture__WEBPACK_IMPORTED_MODULE_3__[\"DynamicTexture\"]; });\n\n/* harmony import */ var _equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./equiRectangularCubeTexture */ \"./Materials/Textures/equiRectangularCubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_4__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony import */ var _hdrCubeTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hdrCubeTexture */ \"./Materials/Textures/hdrCubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _hdrCubeTexture__WEBPACK_IMPORTED_MODULE_5__[\"HDRCubeTexture\"]; });\n\n/* harmony import */ var _internalTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _internalTexture__WEBPACK_IMPORTED_MODULE_6__[\"InternalTexture\"]; });\n\n/* harmony import */ var _Loaders_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Loaders/index */ \"./Materials/Textures/Loaders/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_BasisTextureLoader\"]; });\n\n/* harmony import */ var _mirrorTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./mirrorTexture */ \"./Materials/Textures/mirrorTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _mirrorTexture__WEBPACK_IMPORTED_MODULE_8__[\"MirrorTexture\"]; });\n\n/* harmony import */ var _multiRenderTarget__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./multiRenderTarget */ \"./Materials/Textures/multiRenderTarget.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _multiRenderTarget__WEBPACK_IMPORTED_MODULE_9__[\"MultiRenderTarget\"]; });\n\n/* harmony import */ var _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Procedurals/index */ \"./Materials/Textures/Procedurals/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony import */ var _rawCubeTexture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./rawCubeTexture */ \"./Materials/Textures/rawCubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _rawCubeTexture__WEBPACK_IMPORTED_MODULE_11__[\"RawCubeTexture\"]; });\n\n/* harmony import */ var _rawTexture__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _rawTexture__WEBPACK_IMPORTED_MODULE_12__[\"RawTexture\"]; });\n\n/* harmony import */ var _rawTexture3D__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./rawTexture3D */ \"./Materials/Textures/rawTexture3D.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _rawTexture3D__WEBPACK_IMPORTED_MODULE_13__[\"RawTexture3D\"]; });\n\n/* harmony import */ var _refractionTexture__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./refractionTexture */ \"./Materials/Textures/refractionTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _refractionTexture__WEBPACK_IMPORTED_MODULE_14__[\"RefractionTexture\"]; });\n\n/* harmony import */ var _renderTargetTexture__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _renderTargetTexture__WEBPACK_IMPORTED_MODULE_15__[\"RenderTargetTexture\"]; });\n\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _texture__WEBPACK_IMPORTED_MODULE_16__[\"Texture\"]; });\n\n/* harmony import */ var _videoTexture__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./videoTexture */ \"./Materials/Textures/videoTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _videoTexture__WEBPACK_IMPORTED_MODULE_17__[\"VideoTexture\"]; });\n\n/* harmony import */ var _htmlElementTexture__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./htmlElementTexture */ \"./Materials/Textures/htmlElementTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _htmlElementTexture__WEBPACK_IMPORTED_MODULE_18__[\"HtmlElementTexture\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/internalTexture.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/Textures/internalTexture.ts ***!\n \\***********************************************/\n/*! exports provided: InternalTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return InternalTexture; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nvar InternalTexture = /** @class */ (function () {\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param dataSource defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function InternalTexture(engine, dataSource, delayAllocation) {\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n this.isReady = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n this.isCube = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n this.is3D = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n this.isMultiview = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n this.url = \"\";\r\n /**\r\n * Gets the sampling mode of the texture\r\n */\r\n this.samplingMode = -1;\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n this.generateMipMaps = false;\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n this.samples = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n this.type = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n this.format = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n this.onLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Gets the width of the texture\r\n */\r\n this.width = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n this.height = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n this.depth = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseWidth = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseHeight = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseDepth = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n this.invertY = false;\r\n // Private\r\n /** @hidden */\r\n this._invertVScale = false;\r\n /** @hidden */\r\n this._associatedChannel = -1;\r\n /** @hidden */\r\n this._dataSource = InternalTexture.DATASOURCE_UNKNOWN;\r\n /** @hidden */\r\n this._buffer = null;\r\n /** @hidden */\r\n this._bufferView = null;\r\n /** @hidden */\r\n this._bufferViewArray = null;\r\n /** @hidden */\r\n this._bufferViewArrayArray = null;\r\n /** @hidden */\r\n this._size = 0;\r\n /** @hidden */\r\n this._extension = \"\";\r\n /** @hidden */\r\n this._files = null;\r\n /** @hidden */\r\n this._workingCanvas = null;\r\n /** @hidden */\r\n this._workingContext = null;\r\n /** @hidden */\r\n this._framebuffer = null;\r\n /** @hidden */\r\n this._depthStencilBuffer = null;\r\n /** @hidden */\r\n this._MSAAFramebuffer = null;\r\n /** @hidden */\r\n this._MSAARenderBuffer = null;\r\n /** @hidden */\r\n this._attachments = null;\r\n /** @hidden */\r\n this._cachedCoordinatesMode = null;\r\n /** @hidden */\r\n this._cachedWrapU = null;\r\n /** @hidden */\r\n this._cachedWrapV = null;\r\n /** @hidden */\r\n this._cachedWrapR = null;\r\n /** @hidden */\r\n this._cachedAnisotropicFilteringLevel = null;\r\n /** @hidden */\r\n this._isDisabled = false;\r\n /** @hidden */\r\n this._compression = null;\r\n /** @hidden */\r\n this._generateStencilBuffer = false;\r\n /** @hidden */\r\n this._generateDepthBuffer = false;\r\n /** @hidden */\r\n this._comparisonFunction = 0;\r\n /** @hidden */\r\n this._sphericalPolynomial = null;\r\n /** @hidden */\r\n this._lodGenerationScale = 0;\r\n /** @hidden */\r\n this._lodGenerationOffset = 0;\r\n // Multiview\r\n /** @hidden */\r\n this._colorTextureArray = null;\r\n /** @hidden */\r\n this._depthStencilTextureArray = null;\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @hidden */\r\n this._lodTextureHigh = null;\r\n /** @hidden */\r\n this._lodTextureMid = null;\r\n /** @hidden */\r\n this._lodTextureLow = null;\r\n /** @hidden */\r\n this._isRGBD = false;\r\n /** @hidden */\r\n this._linearSpecularLOD = false;\r\n /** @hidden */\r\n this._irradianceTexture = null;\r\n /** @hidden */\r\n this._webGLTexture = null;\r\n /** @hidden */\r\n this._references = 1;\r\n this._engine = engine;\r\n this._dataSource = dataSource;\r\n if (!delayAllocation) {\r\n this._webGLTexture = engine._createTexture();\r\n }\r\n }\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n InternalTexture.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n Object.defineProperty(InternalTexture.prototype, \"dataSource\", {\r\n /**\r\n * Gets the data source type of the texture (can be one of the InternalTexture.DATASOURCE_XXXX)\r\n */\r\n get: function () {\r\n return this._dataSource;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n InternalTexture.prototype.incrementReferences = function () {\r\n this._references++;\r\n };\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n InternalTexture.prototype.updateSize = function (width, height, depth) {\r\n if (depth === void 0) { depth = 1; }\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n this._size = width * height * depth;\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._rebuild = function () {\r\n var _this = this;\r\n var proxy;\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n switch (this._dataSource) {\r\n case InternalTexture.DATASOURCE_TEMP:\r\n return;\r\n case InternalTexture.DATASOURCE_URL:\r\n proxy = this._engine.createTexture(this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this._buffer, undefined, this.format);\r\n return;\r\n case InternalTexture.DATASOURCE_RAW:\r\n proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_RAW3D:\r\n proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_DYNAMIC:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this);\r\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, undefined, undefined, true);\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n return;\r\n case InternalTexture.DATASOURCE_RENDERTARGET:\r\n var options = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetCreationOptions\"]();\r\n options.generateDepthBuffer = this._generateDepthBuffer;\r\n options.generateMipMaps = this.generateMipMaps;\r\n options.generateStencilBuffer = this._generateStencilBuffer;\r\n options.samplingMode = this.samplingMode;\r\n options.type = this.type;\r\n if (this.isCube) {\r\n proxy = this._engine.createRenderTargetCubeTexture(this.width, options);\r\n }\r\n else {\r\n var size = {\r\n width: this.width,\r\n height: this.height\r\n };\r\n proxy = this._engine.createRenderTargetTexture(size, options);\r\n }\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_DEPTHTEXTURE:\r\n var depthTextureOptions = {\r\n bilinearFiltering: this.samplingMode !== _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE,\r\n comparisonFunction: this._comparisonFunction,\r\n generateStencil: this._generateStencilBuffer,\r\n isCube: this.isCube\r\n };\r\n proxy = this._engine.createDepthStencilTexture({ width: this.width, height: this.height }, depthTextureOptions);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_CUBE:\r\n proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n return;\r\n case InternalTexture.DATASOURCE_CUBERAW:\r\n proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_CUBERAW_RGBD:\r\n proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n InternalTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n });\r\n return;\r\n case InternalTexture.DATASOURCE_CUBEPREFILTERED:\r\n proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {\r\n if (proxy) {\r\n proxy._swapAndDie(_this);\r\n }\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._swapAndDie = function (target) {\r\n target._webGLTexture = this._webGLTexture;\r\n target._isRGBD = this._isRGBD;\r\n if (this._framebuffer) {\r\n target._framebuffer = this._framebuffer;\r\n }\r\n if (this._depthStencilBuffer) {\r\n target._depthStencilBuffer = this._depthStencilBuffer;\r\n }\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n var cache = this._engine.getLoadedTexturesCache();\r\n var index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n var index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n };\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n InternalTexture.prototype.dispose = function () {\r\n if (!this._webGLTexture) {\r\n return;\r\n }\r\n this._references--;\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._webGLTexture = null;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__[\"_DevTools\"].WarnImport(\"environmentTextureTools\");\r\n };\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n InternalTexture.DATASOURCE_UNKNOWN = 0;\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n InternalTexture.DATASOURCE_URL = 1;\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n InternalTexture.DATASOURCE_TEMP = 2;\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n InternalTexture.DATASOURCE_RAW = 3;\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n InternalTexture.DATASOURCE_DYNAMIC = 4;\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n InternalTexture.DATASOURCE_RENDERTARGET = 5;\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n InternalTexture.DATASOURCE_MULTIRENDERTARGET = 6;\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n InternalTexture.DATASOURCE_CUBE = 7;\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n InternalTexture.DATASOURCE_CUBERAW = 8;\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n InternalTexture.DATASOURCE_CUBEPREFILTERED = 9;\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n InternalTexture.DATASOURCE_RAW3D = 10;\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n InternalTexture.DATASOURCE_DEPTHTEXTURE = 11;\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n InternalTexture.DATASOURCE_CUBERAW_RGBD = 12;\r\n return InternalTexture;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/mirrorTexture.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Textures/mirrorTexture.ts ***!\n \\*********************************************/\n/*! exports provided: MirrorTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return MirrorTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\nvar MirrorTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MirrorTexture, _super);\r\n /**\r\n * Instantiates a Mirror Texture.\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n * @param name\r\n * @param size\r\n * @param scene\r\n * @param generateMipMaps\r\n * @param type\r\n * @param samplingMode\r\n * @param generateDepthBuffer\r\n */\r\n function MirrorTexture(name, size, scene, generateMipMaps, type, samplingMode, generateDepthBuffer) {\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n if (generateDepthBuffer === void 0) { generateDepthBuffer = true; }\r\n var _this = _super.call(this, name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer) || this;\r\n _this.scene = scene;\r\n /**\r\n * Define the reflection plane we want to use. The mirrorPlane is usually set to the constructed reflector.\r\n * It is possible to directly set the mirrorPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the mirrorPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the reflector as stated in the doc.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\n _this.mirrorPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_6__[\"Plane\"](0, 1, 0, 1);\r\n _this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n _this._mirrorMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n _this._adaptiveBlurKernel = 0;\r\n _this._blurKernelX = 0;\r\n _this._blurKernelY = 0;\r\n _this._blurRatio = 1.0;\r\n _this.ignoreCameraViewport = true;\r\n _this._updateGammaSpace();\r\n _this._imageProcessingConfigChangeObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._updateGammaSpace;\r\n });\r\n _this.onBeforeRenderObservable.add(function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ReflectionToRef(_this.mirrorPlane, _this._mirrorMatrix);\r\n _this._savedViewMatrix = scene.getViewMatrix();\r\n _this._mirrorMatrix.multiplyToRef(_this._savedViewMatrix, _this._transformMatrix);\r\n scene.setTransformMatrix(_this._transformMatrix, scene.getProjectionMatrix());\r\n scene.clipPlane = _this.mirrorPlane;\r\n scene.getEngine().cullBackFaces = false;\r\n scene._mirroredCameraPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(scene.activeCamera.globalPosition, _this._mirrorMatrix);\r\n });\r\n _this.onAfterRenderObservable.add(function () {\r\n scene.setTransformMatrix(_this._savedViewMatrix, scene.getProjectionMatrix());\r\n scene.getEngine().cullBackFaces = true;\r\n scene._mirroredCameraPosition = null;\r\n scene.clipPlane = null;\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(MirrorTexture.prototype, \"blurRatio\", {\r\n get: function () {\r\n return this._blurRatio;\r\n },\r\n /**\r\n * Define the blur ratio used to blur the reflection if needed.\r\n */\r\n set: function (value) {\r\n if (this._blurRatio === value) {\r\n return;\r\n }\r\n this._blurRatio = value;\r\n this._preparePostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"adaptiveBlurKernel\", {\r\n /**\r\n * Define the adaptive blur kernel used to blur the reflection if needed.\r\n * This will autocompute the closest best match for the `blurKernel`\r\n */\r\n set: function (value) {\r\n this._adaptiveBlurKernel = value;\r\n this._autoComputeBlurKernel();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"blurKernel\", {\r\n /**\r\n * Define the blur kernel used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n set: function (value) {\r\n this.blurKernelX = value;\r\n this.blurKernelY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"blurKernelX\", {\r\n get: function () {\r\n return this._blurKernelX;\r\n },\r\n /**\r\n * Define the blur kernel on the X Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n set: function (value) {\r\n if (this._blurKernelX === value) {\r\n return;\r\n }\r\n this._blurKernelX = value;\r\n this._preparePostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"blurKernelY\", {\r\n get: function () {\r\n return this._blurKernelY;\r\n },\r\n /**\r\n * Define the blur kernel on the Y Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n set: function (value) {\r\n if (this._blurKernelY === value) {\r\n return;\r\n }\r\n this._blurKernelY = value;\r\n this._preparePostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MirrorTexture.prototype._autoComputeBlurKernel = function () {\r\n var engine = this.getScene().getEngine();\r\n var dw = this.getRenderWidth() / engine.getRenderWidth();\r\n var dh = this.getRenderHeight() / engine.getRenderHeight();\r\n this.blurKernelX = this._adaptiveBlurKernel * dw;\r\n this.blurKernelY = this._adaptiveBlurKernel * dh;\r\n };\r\n MirrorTexture.prototype._onRatioRescale = function () {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n if (!this._adaptiveBlurKernel) {\r\n this._preparePostProcesses();\r\n }\r\n }\r\n if (this._adaptiveBlurKernel) {\r\n this._autoComputeBlurKernel();\r\n }\r\n };\r\n MirrorTexture.prototype._updateGammaSpace = function () {\r\n this.gammaSpace = !this.scene.imageProcessingConfiguration.isEnabled || !this.scene.imageProcessingConfiguration.applyByPostProcess;\r\n };\r\n MirrorTexture.prototype._preparePostProcesses = function () {\r\n this.clearPostProcesses(true);\r\n if (this._blurKernelX && this._blurKernelY) {\r\n var engine = this.getScene().getEngine();\r\n var textureType = engine.getCaps().textureFloatRender ? _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n this._blurX = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BlurPostProcess\"](\"horizontal blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1.0, 0), this._blurKernelX, this._blurRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, textureType);\r\n this._blurX.autoClear = false;\r\n if (this._blurRatio === 1 && this.samples < 2 && this._texture) {\r\n this._blurX.inputTexture = this._texture;\r\n }\r\n else {\r\n this._blurX.alwaysForcePOT = true;\r\n }\r\n this._blurY = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BlurPostProcess\"](\"vertical blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1.0), this._blurKernelY, this._blurRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, textureType);\r\n this._blurY.autoClear = false;\r\n this._blurY.alwaysForcePOT = this._blurRatio !== 1;\r\n this.addPostProcess(this._blurX);\r\n this.addPostProcess(this._blurY);\r\n }\r\n else {\r\n if (this._blurY) {\r\n this.removePostProcess(this._blurY);\r\n this._blurY.dispose();\r\n this._blurY = null;\r\n }\r\n if (this._blurX) {\r\n this.removePostProcess(this._blurX);\r\n this._blurX.dispose();\r\n this._blurX = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Clone the mirror texture.\r\n * @returns the cloned texture\r\n */\r\n MirrorTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new MirrorTexture(this.name, textureSize.width, scene, this._renderTargetOptions.generateMipMaps, this._renderTargetOptions.type, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Mirror Texture\r\n newTexture.mirrorPlane = this.mirrorPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n MirrorTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.mirrorPlane = this.mirrorPlane.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n MirrorTexture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver);\r\n };\r\n return MirrorTexture;\r\n}(_Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetTexture\"]));\r\n\r\n_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"]._CreateMirror = function (name, renderTargetSize, scene, generateMipMaps) {\r\n return new MirrorTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/multiRenderTarget.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Textures/multiRenderTarget.ts ***!\n \\*************************************************/\n/*! exports provided: MultiRenderTarget */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return MultiRenderTarget; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_multiRender__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Engines/Extensions/engine.multiRender */ \"./Engines/Extensions/engine.multiRender.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n */\r\nvar MultiRenderTarget = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiRenderTarget, _super);\r\n /**\r\n * Instantiate a new multi render target texture.\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the buffers to render to\r\n * @param count Define the number of target we are rendering into\r\n * @param scene Define the scene the texture belongs to\r\n * @param options Define the options used to create the multi render target\r\n */\r\n function MultiRenderTarget(name, size, count, scene, options) {\r\n var _this = this;\r\n var generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;\r\n var generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;\r\n var doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;\r\n _this = _super.call(this, name, size, scene, generateMipMaps, doNotChangeAspectRatio) || this;\r\n _this._engine = scene.getEngine();\r\n if (!_this.isSupported) {\r\n _this.dispose();\r\n return;\r\n }\r\n var types = [];\r\n var samplingModes = [];\r\n for (var i = 0; i < count; i++) {\r\n if (options && options.types && options.types[i] !== undefined) {\r\n types.push(options.types[i]);\r\n }\r\n else {\r\n types.push(options && options.defaultType ? options.defaultType : _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n }\r\n if (options && options.samplingModes && options.samplingModes[i] !== undefined) {\r\n samplingModes.push(options.samplingModes[i]);\r\n }\r\n else {\r\n samplingModes.push(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n }\r\n }\r\n var generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n var generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n _this._size = size;\r\n _this._multiRenderTargetOptions = {\r\n samplingModes: samplingModes,\r\n generateMipMaps: generateMipMaps,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer,\r\n generateDepthTexture: generateDepthTexture,\r\n types: types,\r\n textureCount: count\r\n };\r\n _this._createInternalTextures();\r\n _this._createTextures();\r\n return _this;\r\n }\r\n Object.defineProperty(MultiRenderTarget.prototype, \"isSupported\", {\r\n /**\r\n * Get if draw buffers are currently supported by the used hardware and browser.\r\n */\r\n get: function () {\r\n return this._engine.webGLVersion > 1 || this._engine.getCaps().drawBuffersExtension;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"textures\", {\r\n /**\r\n * Get the list of textures generated by the multi render target.\r\n */\r\n get: function () {\r\n return this._textures;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"depthTexture\", {\r\n /**\r\n * Get the depth texture generated by the multi render target if options.generateDepthTexture has been set\r\n */\r\n get: function () {\r\n return this._textures[this._textures.length - 1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"wrapU\", {\r\n /**\r\n * Set the wrapping mode on U of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n set: function (wrap) {\r\n if (this._textures) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapU = wrap;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"wrapV\", {\r\n /**\r\n * Set the wrapping mode on V of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n set: function (wrap) {\r\n if (this._textures) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapV = wrap;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n MultiRenderTarget.prototype._rebuild = function () {\r\n this.releaseInternalTextures();\r\n this._createInternalTextures();\r\n for (var i = 0; i < this._internalTextures.length; i++) {\r\n var texture = this._textures[i];\r\n texture._texture = this._internalTextures[i];\r\n }\r\n // Keeps references to frame buffer and stencil/depth buffer\r\n this._texture = this._internalTextures[0];\r\n };\r\n MultiRenderTarget.prototype._createInternalTextures = function () {\r\n this._internalTextures = this._engine.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions);\r\n };\r\n MultiRenderTarget.prototype._createTextures = function () {\r\n this._textures = [];\r\n for (var i = 0; i < this._internalTextures.length; i++) {\r\n var texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](null, this.getScene());\r\n texture._texture = this._internalTextures[i];\r\n this._textures.push(texture);\r\n }\r\n // Keeps references to frame buffer and stencil/depth buffer\r\n this._texture = this._internalTextures[0];\r\n };\r\n Object.defineProperty(MultiRenderTarget.prototype, \"samples\", {\r\n /**\r\n * Define the number of samples used if MSAA is enabled.\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (value) {\r\n if (this._samples === value) {\r\n return;\r\n }\r\n this._samples = this._engine.updateMultipleRenderTargetTextureSampleCount(this._internalTextures, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resize all the textures in the multi render target.\r\n * Be carrefull as it will recreate all the data in the new texture.\r\n * @param size Define the new size\r\n */\r\n MultiRenderTarget.prototype.resize = function (size) {\r\n this.releaseInternalTextures();\r\n this._internalTextures = this._engine.createMultipleRenderTarget(size, this._multiRenderTargetOptions);\r\n this._createInternalTextures();\r\n };\r\n MultiRenderTarget.prototype.unbindFrameBuffer = function (engine, faceIndex) {\r\n var _this = this;\r\n engine.unBindMultiColorAttachmentFramebuffer(this._internalTextures, this.isCube, function () {\r\n _this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n };\r\n /**\r\n * Dispose the render targets and their associated resources\r\n */\r\n MultiRenderTarget.prototype.dispose = function () {\r\n this.releaseInternalTextures();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Release all the underlying texture used as draw buffers.\r\n */\r\n MultiRenderTarget.prototype.releaseInternalTextures = function () {\r\n if (!this._internalTextures) {\r\n return;\r\n }\r\n for (var i = this._internalTextures.length - 1; i >= 0; i--) {\r\n if (this._internalTextures[i] !== undefined) {\r\n this._internalTextures[i].dispose();\r\n this._internalTextures.splice(i, 1);\r\n }\r\n }\r\n };\r\n return MultiRenderTarget;\r\n}(_Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__[\"RenderTargetTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/rawCubeTexture.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Textures/rawCubeTexture.ts ***!\n \\**********************************************/\n/*! exports provided: RawCubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return RawCubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony import */ var _internalTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _cubeTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Raw cube texture where the raw buffers are passed in\r\n */\r\nvar RawCubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RawCubeTexture, _super);\r\n /**\r\n * Creates a cube texture where the raw buffers are passed in.\r\n * @param scene defines the scene the texture is attached to\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n */\r\n function RawCubeTexture(scene, data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (compression === void 0) { compression = null; }\r\n var _this = _super.call(this, \"\", scene) || this;\r\n _this._texture = scene.getEngine().createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression);\r\n return _this;\r\n }\r\n /**\r\n * Updates the raw cube texture.\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n RawCubeTexture.prototype.update = function (data, format, type, invertY, compression) {\r\n if (compression === void 0) { compression = null; }\r\n this._texture.getEngine().updateRawCubeTexture(this._texture, data, format, type, invertY, compression);\r\n };\r\n /**\r\n * Updates a raw cube texture with RGBD encoded data.\r\n * @param data defines the array of data [mipmap][face] to use to create each face\r\n * @param sphericalPolynomial defines the spherical polynomial for irradiance\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns a promsie that resolves when the operation is complete\r\n */\r\n RawCubeTexture.prototype.updateRGBDAsync = function (data, sphericalPolynomial, lodScale, lodOffset) {\r\n if (sphericalPolynomial === void 0) { sphericalPolynomial = null; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n return RawCubeTexture._UpdateRGBDAsync(this._texture, data, sphericalPolynomial, lodScale, lodOffset);\r\n };\r\n /**\r\n * Clones the raw cube texture.\r\n * @return a new cube texture\r\n */\r\n RawCubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () {\r\n var scene = _this.getScene();\r\n var internalTexture = _this._texture;\r\n var texture = new RawCubeTexture(scene, internalTexture._bufferViewArray, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);\r\n if (internalTexture.dataSource === _internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"].DATASOURCE_CUBERAW_RGBD) {\r\n texture.updateRGBDAsync(internalTexture._bufferViewArrayArray, internalTexture._sphericalPolynomial, internalTexture._lodGenerationScale, internalTexture._lodGenerationOffset);\r\n }\r\n return texture;\r\n }, this);\r\n };\r\n /** @hidden */\r\n RawCubeTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._dataSource = _internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"].DATASOURCE_CUBERAW_RGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_2__[\"EnvironmentTextureTools\"].UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n return RawCubeTexture;\r\n}(_cubeTexture__WEBPACK_IMPORTED_MODULE_4__[\"CubeTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/rawTexture.ts\":\n/*!******************************************!*\\\n !*** ./Materials/Textures/rawTexture.ts ***!\n \\******************************************/\n/*! exports provided: RawTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return RawTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nvar RawTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RawTexture, _super);\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param scene define the scene the texture belongs to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n */\r\n function RawTexture(data, width, height, \r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n format, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;\r\n _this.format = format;\r\n _this._engine = scene.getEngine();\r\n _this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);\r\n _this.wrapU = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n return _this;\r\n }\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n RawTexture.prototype.update = function (data) {\r\n this._engine.updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);\r\n };\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n RawTexture.CreateLuminanceTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_LUMINANCE, scene, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n RawTexture.CreateLuminanceAlphaTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_LUMINANCE_ALPHA, scene, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n RawTexture.CreateAlphaTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGB alpha texture\r\n */\r\n RawTexture.CreateRGBTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGBA texture\r\n */\r\n RawTexture.CreateRGBATexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n RawTexture.CreateRTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_R, scene, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n return RawTexture;\r\n}(_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/rawTexture3D.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Textures/rawTexture3D.ts ***!\n \\********************************************/\n/*! exports provided: RawTexture3D */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return RawTexture3D; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store 3D textures containing user data\r\n */\r\nvar RawTexture3D = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RawTexture3D, _super);\r\n /**\r\n * Create a new RawTexture3D\r\n * @param data defines the data of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the texture format to use\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)\r\n * @param invertY defines if texture must be stored with Y axis inverted\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n function RawTexture3D(data, width, height, depth, \r\n /** Gets or sets the texture format to use */\r\n format, scene, generateMipMaps, invertY, samplingMode, textureType) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;\r\n _this.format = format;\r\n _this._engine = scene.getEngine();\r\n _this._texture = scene.getEngine().createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, undefined, textureType);\r\n _this.is3D = true;\r\n return _this;\r\n }\r\n /**\r\n * Update the texture with new data\r\n * @param data defines the data to store in the texture\r\n */\r\n RawTexture3D.prototype.update = function (data) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._engine.updateRawTexture3D(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);\r\n };\r\n return RawTexture3D;\r\n}(_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/refractionTexture.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Textures/refractionTexture.ts ***!\n \\*************************************************/\n/*! exports provided: RefractionTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return RefractionTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.plane */ \"./Maths/math.plane.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n\r\n\r\n\r\n/**\r\n * Creates a refraction texture used by refraction channel of the standard material.\r\n * It is like a mirror but to see through a material.\r\n * @see https://doc.babylonjs.com/how_to/reflect#refraction\r\n */\r\nvar RefractionTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RefractionTexture, _super);\r\n /**\r\n * Creates a refraction texture used by refraction channel of the standard material.\r\n * It is like a mirror but to see through a material.\r\n * @see https://doc.babylonjs.com/how_to/reflect#refraction\r\n * @param name Define the texture name\r\n * @param size Define the size of the underlying texture\r\n * @param scene Define the scene the refraction belongs to\r\n * @param generateMipMaps Define if we need to generate mips level for the refraction\r\n */\r\n function RefractionTexture(name, size, scene, generateMipMaps) {\r\n var _this = _super.call(this, name, size, scene, generateMipMaps, true) || this;\r\n /**\r\n * Define the reflection plane we want to use. The refractionPlane is usually set to the constructed refractor.\r\n * It is possible to directly set the refractionPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the refractionPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the refractor as stated in the doc.\r\n * @see https://doc.babylonjs.com/how_to/reflect#refraction\r\n */\r\n _this.refractionPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"](0, 1, 0, 1);\r\n /**\r\n * Define how deep under the surface we should see.\r\n */\r\n _this.depth = 2.0;\r\n _this.onBeforeRenderObservable.add(function () {\r\n scene.clipPlane = _this.refractionPlane;\r\n });\r\n _this.onAfterRenderObservable.add(function () {\r\n scene.clipPlane = null;\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Clone the refraction texture.\r\n * @returns the cloned texture\r\n */\r\n RefractionTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new RefractionTexture(this.name, textureSize.width, scene, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Refraction Texture\r\n newTexture.refractionPlane = this.refractionPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n newTexture.depth = this.depth;\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n RefractionTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.mirrorPlane = this.refractionPlane.asArray();\r\n serializationObject.depth = this.depth;\r\n return serializationObject;\r\n };\r\n return RefractionTexture;\r\n}(_Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__[\"RenderTargetTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/renderTargetCreationOptions.ts\":\n/*!***********************************************************!*\\\n !*** ./Materials/Textures/renderTargetCreationOptions.ts ***!\n \\***********************************************************/\n/*! exports provided: RenderTargetCreationOptions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetCreationOptions\", function() { return RenderTargetCreationOptions; });\n/**\r\n * Define options used to create a render target texture\r\n */\r\nvar RenderTargetCreationOptions = /** @class */ (function () {\r\n function RenderTargetCreationOptions() {\r\n }\r\n return RenderTargetCreationOptions;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/renderTargetTexture.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Textures/renderTargetTexture.ts ***!\n \\***************************************************/\n/*! exports provided: RenderTargetTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return RenderTargetTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../PostProcesses/postProcessManager */ \"./PostProcesses/postProcessManager.ts\");\n/* harmony import */ var _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Rendering/renderingManager */ \"./Rendering/renderingManager.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_renderTarget__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Engines/Extensions/engine.renderTarget */ \"./Engines/Extensions/engine.renderTarget.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This Helps creating a texture that will be created from a camera in your scene.\r\n * It is basically a dynamic texture that could be used to create special effects for instance.\r\n * Actually, It is the base of lot of effects in the framework like post process, shadows, effect layers and rendering pipelines...\r\n */\r\nvar RenderTargetTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RenderTargetTexture, _super);\r\n /**\r\n * Instantiate a render target texture. This is mainly used to render of screen the scene to for instance apply post processse\r\n * or used a shadow, depth texture...\r\n * @param name The friendly name of the texture\r\n * @param size The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)\r\n * @param scene The scene the RTT belongs to. The latest created scene will be used if not precised.\r\n * @param generateMipMaps True if mip maps need to be generated after render.\r\n * @param doNotChangeAspectRatio True to not change the aspect ratio of the scene in the RTT\r\n * @param type The type of the buffer in the RTT (int, half float, float...)\r\n * @param isCube True if a cube texture needs to be created\r\n * @param samplingMode The sampling mode to be usedwith the render target (Linear, Nearest...)\r\n * @param generateDepthBuffer True to generate a depth buffer\r\n * @param generateStencilBuffer True to generate a stencil buffer\r\n * @param isMulti True if multiple textures need to be created (Draw Buffers)\r\n * @param format The internal format of the buffer in the RTT (RED, RG, RGB, RGBA, ALPHA...)\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function RenderTargetTexture(name, size, scene, generateMipMaps, doNotChangeAspectRatio, type, isCube, samplingMode, generateDepthBuffer, generateStencilBuffer, isMulti, format, delayAllocation) {\r\n if (doNotChangeAspectRatio === void 0) { doNotChangeAspectRatio = true; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (isCube === void 0) { isCube = false; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (generateDepthBuffer === void 0) { generateDepthBuffer = true; }\r\n if (generateStencilBuffer === void 0) { generateStencilBuffer = false; }\r\n if (isMulti === void 0) { isMulti = false; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps) || this;\r\n _this.isCube = isCube;\r\n /**\r\n * Define if particles should be rendered in your texture.\r\n */\r\n _this.renderParticles = true;\r\n /**\r\n * Define if sprites should be rendered in your texture.\r\n */\r\n _this.renderSprites = false;\r\n /**\r\n * Override the default coordinates mode to projection for RTT as it is the most common case for rendered textures.\r\n */\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].PROJECTION_MODE;\r\n /**\r\n * Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.\r\n */\r\n _this.ignoreCameraViewport = false;\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onBeforeBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onAfterUnbindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering the texture\r\n */\r\n _this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the texture\r\n */\r\n _this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered after the texture clear\r\n */\r\n _this.onClearObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the texture is resized.\r\n */\r\n _this.onResizeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._currentRefreshId = -1;\r\n _this._refreshRate = 1;\r\n _this._samples = 1;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the texture (when in cube mode)\r\n * It must define where the camera used to render the texture is set\r\n */\r\n _this.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n scene = _this.getScene();\r\n if (!scene) {\r\n return _this;\r\n }\r\n _this.renderList = new Array();\r\n _this._engine = scene.getEngine();\r\n _this.name = name;\r\n _this.isRenderTarget = true;\r\n _this._initialSizeParameter = size;\r\n _this._processSizeParameter(size);\r\n _this._resizeObserver = _this.getScene().getEngine().onResizeObservable.add(function () {\r\n });\r\n _this._generateMipMaps = generateMipMaps ? true : false;\r\n _this._doNotChangeAspectRatio = doNotChangeAspectRatio;\r\n // Rendering groups\r\n _this._renderingManager = new _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_6__[\"RenderingManager\"](scene);\r\n _this._renderingManager._useSceneAutoClearSetup = true;\r\n if (isMulti) {\r\n return _this;\r\n }\r\n _this._renderTargetOptions = {\r\n generateMipMaps: generateMipMaps,\r\n type: type,\r\n format: format,\r\n samplingMode: samplingMode,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer\r\n };\r\n if (samplingMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].NEAREST_SAMPLINGMODE) {\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n }\r\n if (!delayAllocation) {\r\n if (isCube) {\r\n _this._texture = scene.getEngine().createRenderTargetCubeTexture(_this.getRenderSize(), _this._renderTargetOptions);\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].INVCUBIC_MODE;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n }\r\n else {\r\n _this._texture = scene.getEngine().createRenderTargetTexture(_this._size, _this._renderTargetOptions);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderList\", {\r\n /**\r\n * Use this list to define the list of mesh you want to render.\r\n */\r\n get: function () {\r\n return this._renderList;\r\n },\r\n set: function (value) {\r\n this._renderList = value;\r\n if (this._renderList) {\r\n this._hookArray(this._renderList);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var wasEmpty = array.length === 0;\r\n var result = oldPush.apply(array, items);\r\n if (wasEmpty) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n if (array.length === 0) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return deleted;\r\n };\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterUnbind\", {\r\n /**\r\n * Set a after unbind callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterUnbindObserver) {\r\n this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n }\r\n this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onBeforeRender\", {\r\n /**\r\n * Set a before render callback in the texture.\r\n * This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterRender\", {\r\n /**\r\n * Set a after render callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onClear\", {\r\n /**\r\n * Set a clear callback in the texture.\r\n * This has been kept for backward compatibility and use of onClearObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onClearObserver) {\r\n this.onClearObservable.remove(this._onClearObserver);\r\n }\r\n this._onClearObserver = this.onClearObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderTargetOptions\", {\r\n /**\r\n * Gets render target creation options that were used.\r\n */\r\n get: function () {\r\n return this._renderTargetOptions;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._onRatioRescale = function () {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"boundingBoxSize\", {\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the texture (when in cube mode)\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param comparisonFunction Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode\r\n * @param bilinearFiltering Specifies whether or not bilinear filtering is enable on the texture\r\n * @param generateStencil Specifies whether or not a stencil should be allocated in the texture\r\n */\r\n RenderTargetTexture.prototype.createDepthStencilTexture = function (comparisonFunction, bilinearFiltering, generateStencil) {\r\n if (comparisonFunction === void 0) { comparisonFunction = 0; }\r\n if (bilinearFiltering === void 0) { bilinearFiltering = true; }\r\n if (generateStencil === void 0) { generateStencil = false; }\r\n if (!this.getScene()) {\r\n return;\r\n }\r\n var engine = this.getScene().getEngine();\r\n this.depthStencilTexture = engine.createDepthStencilTexture(this._size, {\r\n bilinearFiltering: bilinearFiltering,\r\n comparisonFunction: comparisonFunction,\r\n generateStencil: generateStencil,\r\n isCube: this.isCube\r\n });\r\n engine.setFrameBufferDepthStencilTexture(this);\r\n };\r\n RenderTargetTexture.prototype._processSizeParameter = function (size) {\r\n if (size.ratio) {\r\n this._sizeRatio = size.ratio;\r\n this._size = {\r\n width: this._bestReflectionRenderTargetDimension(this._engine.getRenderWidth(), this._sizeRatio),\r\n height: this._bestReflectionRenderTargetDimension(this._engine.getRenderHeight(), this._sizeRatio)\r\n };\r\n }\r\n else {\r\n this._size = size;\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"samples\", {\r\n /**\r\n * Define the number of samples to use in case of MSAA.\r\n * It defaults to one meaning no MSAA has been enabled.\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (value) {\r\n if (this._samples === value) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._samples = scene.getEngine().updateRenderTargetTextureSampleCount(this._texture, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the refresh counter of the texture and start bak from scratch.\r\n * Could be useful to regenerate the texture if it is setup to render only once.\r\n */\r\n RenderTargetTexture.prototype.resetRefreshCounter = function () {\r\n this._currentRefreshId = -1;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"refreshRate\", {\r\n /**\r\n * Define the refresh rate of the texture or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n get: function () {\r\n return this._refreshRate;\r\n },\r\n set: function (value) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a post process to the render target rendering passes.\r\n * @param postProcess define the post process to add\r\n */\r\n RenderTargetTexture.prototype.addPostProcess = function (postProcess) {\r\n if (!this._postProcessManager) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._postProcessManager = new _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessManager\"](scene);\r\n this._postProcesses = new Array();\r\n }\r\n this._postProcesses.push(postProcess);\r\n this._postProcesses[0].autoClear = false;\r\n };\r\n /**\r\n * Clear all the post processes attached to the render target\r\n * @param dispose define if the cleared post processesshould also be disposed (false by default)\r\n */\r\n RenderTargetTexture.prototype.clearPostProcesses = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n if (dispose) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var postProcess = _a[_i];\r\n postProcess.dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n };\r\n /**\r\n * Remove one of the post process from the list of attached post processes to the texture\r\n * @param postProcess define the post process to remove from the list\r\n */\r\n RenderTargetTexture.prototype.removePostProcess = function (postProcess) {\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n var index = this._postProcesses.indexOf(postProcess);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._postProcesses.splice(index, 1);\r\n if (this._postProcesses.length > 0) {\r\n this._postProcesses[0].autoClear = false;\r\n }\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._shouldRender = function () {\r\n if (this._currentRefreshId === -1) { // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n this._currentRefreshId++;\r\n return false;\r\n };\r\n /**\r\n * Gets the actual render size of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderSize = function () {\r\n return this.getRenderWidth();\r\n };\r\n /**\r\n * Gets the actual render width of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderWidth = function () {\r\n if (this._size.width) {\r\n return this._size.width;\r\n }\r\n return this._size;\r\n };\r\n /**\r\n * Gets the actual render height of the texture.\r\n * @returns the height of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderHeight = function () {\r\n if (this._size.width) {\r\n return this._size.height;\r\n }\r\n return this._size;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can be rescaled or not.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resize the texture using a ratio.\r\n * @param ratio the ratio to apply to the texture size in order to compute the new target size\r\n */\r\n RenderTargetTexture.prototype.scale = function (ratio) {\r\n var newSize = this.getRenderSize() * ratio;\r\n this.resize(newSize);\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n RenderTargetTexture.prototype.getReflectionTextureMatrix = function () {\r\n if (this.isCube) {\r\n return this._textureMatrix;\r\n }\r\n return _super.prototype.getReflectionTextureMatrix.call(this);\r\n };\r\n /**\r\n * Resize the texture to a new desired size.\r\n * Be carrefull as it will recreate all the data in the new texture.\r\n * @param size Define the new size. It can be:\r\n * - a number for squared texture,\r\n * - an object containing { width: number, height: number }\r\n * - or an object containing a ratio { ratio: number }\r\n */\r\n RenderTargetTexture.prototype.resize = function (size) {\r\n var wasCube = this.isCube;\r\n this.releaseInternalTexture();\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._processSizeParameter(size);\r\n if (wasCube) {\r\n this._texture = scene.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions);\r\n }\r\n else {\r\n this._texture = scene.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions);\r\n }\r\n if (this.onResizeObservable.hasObservers()) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Renders all the objects from the render list into the texture.\r\n * @param useCameraPostProcess Define if camera post processes should be used during the rendering\r\n * @param dumpForDebug Define if the rendering result should be dumped (copied) for debugging purpose\r\n */\r\n RenderTargetTexture.prototype.render = function (useCameraPostProcess, dumpForDebug) {\r\n if (useCameraPostProcess === void 0) { useCameraPostProcess = false; }\r\n if (dumpForDebug === void 0) { dumpForDebug = false; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this.useCameraPostProcesses !== undefined) {\r\n useCameraPostProcess = this.useCameraPostProcesses;\r\n }\r\n if (this._waitingRenderList) {\r\n this.renderList = [];\r\n for (var index = 0; index < this._waitingRenderList.length; index++) {\r\n var id = this._waitingRenderList[index];\r\n var mesh_1 = scene.getMeshByID(id);\r\n if (mesh_1) {\r\n this.renderList.push(mesh_1);\r\n }\r\n }\r\n delete this._waitingRenderList;\r\n }\r\n // Is predicate defined?\r\n if (this.renderListPredicate) {\r\n if (this.renderList) {\r\n this.renderList.length = 0; // Clear previous renderList\r\n }\r\n else {\r\n this.renderList = [];\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var sceneMeshes = scene.meshes;\r\n for (var index = 0; index < sceneMeshes.length; index++) {\r\n var mesh = sceneMeshes[index];\r\n if (this.renderListPredicate(mesh)) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n this.onBeforeBindObservable.notifyObservers(this);\r\n // Set custom projection.\r\n // Needs to be before binding to prevent changing the aspect ratio.\r\n var camera;\r\n if (this.activeCamera) {\r\n camera = this.activeCamera;\r\n engine.setViewport(this.activeCamera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n if (this.activeCamera !== scene.activeCamera) {\r\n scene.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true));\r\n }\r\n }\r\n else {\r\n camera = scene.activeCamera;\r\n if (camera) {\r\n engine.setViewport(camera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n }\r\n }\r\n // Prepare renderingManager\r\n this._renderingManager.reset();\r\n var currentRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;\r\n var currentRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;\r\n var sceneRenderId = scene.getRenderId();\r\n for (var meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {\r\n var mesh = currentRenderList[meshIndex];\r\n if (mesh) {\r\n if (!mesh.isReady(this.refreshRate === 0)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n mesh._preActivateForIntermediateRendering(sceneRenderId);\r\n var isMasked = void 0;\r\n if (!this.renderList && camera) {\r\n isMasked = ((mesh.layerMask & camera.layerMask) === 0);\r\n }\r\n else {\r\n isMasked = false;\r\n }\r\n if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {\r\n if (mesh._activate(sceneRenderId, true)) {\r\n if (!mesh.isAnInstance) {\r\n mesh._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;\r\n }\r\n else {\r\n mesh = mesh.sourceMesh;\r\n }\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = true;\r\n for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n var subMesh = mesh.subMeshes[subIndex];\r\n scene._activeIndices.addCount(subMesh.indexCount, false);\r\n this._renderingManager.dispatch(subMesh, mesh);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n for (var particleIndex = 0; particleIndex < scene.particleSystems.length; particleIndex++) {\r\n var particleSystem = scene.particleSystems[particleIndex];\r\n var emitter = particleSystem.emitter;\r\n if (!particleSystem.isStarted() || !emitter || !emitter.position || !emitter.isEnabled()) {\r\n continue;\r\n }\r\n if (currentRenderList.indexOf(emitter) >= 0) {\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n if (this.isCube) {\r\n for (var face = 0; face < 6; face++) {\r\n this.renderToTarget(face, currentRenderList, useCameraPostProcess, dumpForDebug);\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n else {\r\n this.renderToTarget(0, currentRenderList, useCameraPostProcess, dumpForDebug);\r\n }\r\n this.onAfterUnbindObservable.notifyObservers(this);\r\n if (scene.activeCamera) {\r\n // Do not avoid setting uniforms when multiple scenes are active as another camera may have overwrite these\r\n if (scene.getEngine().scenes.length > 1 || (this.activeCamera && this.activeCamera !== scene.activeCamera)) {\r\n scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));\r\n }\r\n engine.setViewport(scene.activeCamera.viewport);\r\n }\r\n scene.resetCachedMaterial();\r\n };\r\n RenderTargetTexture.prototype._bestReflectionRenderTargetDimension = function (renderDimension, scale) {\r\n var minimum = 128;\r\n var x = renderDimension * scale;\r\n var curved = _Engines_engine__WEBPACK_IMPORTED_MODULE_9__[\"Engine\"].NearestPOT(x + (minimum * minimum / (minimum + x)));\r\n // Ensure we don't exceed the render dimension (while staying POT)\r\n return Math.min(_Engines_engine__WEBPACK_IMPORTED_MODULE_9__[\"Engine\"].FloorPOT(renderDimension), curved);\r\n };\r\n /**\r\n * @hidden\r\n * @param faceIndex face index to bind to if this is a cubetexture\r\n */\r\n RenderTargetTexture.prototype._bindFrameBuffer = function (faceIndex) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this._texture) {\r\n engine.bindFramebuffer(this._texture, this.isCube ? faceIndex : undefined, undefined, undefined, this.ignoreCameraViewport, this.depthStencilTexture ? this.depthStencilTexture : undefined);\r\n }\r\n };\r\n RenderTargetTexture.prototype.unbindFrameBuffer = function (engine, faceIndex) {\r\n var _this = this;\r\n if (!this._texture) {\r\n return;\r\n }\r\n engine.unBindFramebuffer(this._texture, this.isCube, function () {\r\n _this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n };\r\n RenderTargetTexture.prototype.renderToTarget = function (faceIndex, currentRenderList, useCameraPostProcess, dumpForDebug) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (!this._texture) {\r\n return;\r\n }\r\n // Bind\r\n if (this._postProcessManager) {\r\n this._postProcessManager._prepareFrame(this._texture, this._postProcesses);\r\n }\r\n else if (!useCameraPostProcess || !scene.postProcessManager._prepareFrame(this._texture)) {\r\n this._bindFrameBuffer(faceIndex);\r\n }\r\n this.onBeforeRenderObservable.notifyObservers(faceIndex);\r\n // Clear\r\n if (this.onClearObservable.hasObservers()) {\r\n this.onClearObservable.notifyObservers(engine);\r\n }\r\n else {\r\n engine.clear(this.clearColor || scene.clearColor, true, true, true);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Before Camera Draw\r\n for (var _i = 0, _a = scene._beforeRenderTargetDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this);\r\n }\r\n // Render\r\n this._renderingManager.render(this.customRenderFunction, currentRenderList, this.renderParticles, this.renderSprites);\r\n // After Camera Draw\r\n for (var _b = 0, _c = scene._afterRenderTargetDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this);\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._finalizeFrame(false, this._texture, faceIndex, this._postProcesses, this.ignoreCameraViewport);\r\n }\r\n else if (useCameraPostProcess) {\r\n scene.postProcessManager._finalizeFrame(false, this._texture, faceIndex);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Dump ?\r\n if (dumpForDebug) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), engine);\r\n }\r\n // Unbind\r\n if (!this.isCube || faceIndex === 5) {\r\n if (this.isCube) {\r\n if (faceIndex === 5) {\r\n engine.generateMipMapsForCubemap(this._texture);\r\n }\r\n }\r\n this.unbindFrameBuffer(engine, faceIndex);\r\n }\r\n else {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n }\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderTargetTexture.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n */\r\n RenderTargetTexture.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);\r\n this._renderingManager._useSceneAutoClearSetup = false;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n RenderTargetTexture.prototype.clone = function () {\r\n var textureSize = this.getSize();\r\n var newTexture = new RenderTargetTexture(this.name, textureSize, this.getScene(), this._renderTargetOptions.generateMipMaps, this._doNotChangeAspectRatio, this._renderTargetOptions.type, this.isCube, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer, this._renderTargetOptions.generateStencilBuffer);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // RenderTarget Texture\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n RenderTargetTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.renderTargetSize = this.getRenderSize();\r\n serializationObject.renderList = [];\r\n if (this.renderList) {\r\n for (var index = 0; index < this.renderList.length; index++) {\r\n serializationObject.renderList.push(this.renderList[index].id);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore\r\n */\r\n RenderTargetTexture.prototype.disposeFramebufferObjects = function () {\r\n var objBuffer = this.getInternalTexture();\r\n var scene = this.getScene();\r\n if (objBuffer && scene) {\r\n scene.getEngine()._releaseFramebufferObjects(objBuffer);\r\n }\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n RenderTargetTexture.prototype.dispose = function () {\r\n this.onResizeObservable.clear();\r\n this.onClearObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onAfterUnbindObservable.clear();\r\n this.onBeforeBindObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n if (this._postProcessManager) {\r\n this._postProcessManager.dispose();\r\n this._postProcessManager = null;\r\n }\r\n this.clearPostProcesses(true);\r\n if (this._resizeObserver) {\r\n this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver);\r\n this._resizeObserver = null;\r\n }\r\n this.renderList = null;\r\n // Remove from custom render targets\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var index = scene.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n scene.customRenderTargets.splice(index, 1);\r\n }\r\n for (var _i = 0, _a = scene.cameras; _i < _a.length; _i++) {\r\n var camera = _a[_i];\r\n index = camera.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n camera.customRenderTargets.splice(index, 1);\r\n }\r\n }\r\n if (this.depthStencilTexture) {\r\n this.getScene().getEngine()._releaseTexture(this.depthStencilTexture);\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._rebuild = function () {\r\n if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._rebuild();\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention point in material dispose.\r\n */\r\n RenderTargetTexture.prototype.freeRenderingGroups = function () {\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n };\r\n /**\r\n * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)\r\n * @returns the view count\r\n */\r\n RenderTargetTexture.prototype.getViewCount = function () {\r\n return 1;\r\n };\r\n /**\r\n * The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONCE = 0;\r\n /**\r\n * The texture will only be rendered rendered every frame and is recomended for dynamic contents.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME = 1;\r\n /**\r\n * The texture will be rendered every 2 frames which could be enough if your dynamic objects are not\r\n * the central point of your effect and can save a lot of performances.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;\r\n return RenderTargetTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"]));\r\n\r\n_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"]._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n return new RenderTargetTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/texture.ts\":\n/*!***************************************!*\\\n !*** ./Materials/Textures/texture.ts ***!\n \\***************************************/\n/*! exports provided: Texture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return Texture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Misc_timingTools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Misc/timingTools */ \"./Misc/timingTools.ts\");\n/* harmony import */ var _Misc_instantiationTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Misc/instantiationTools */ \"./Misc/instantiationTools.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see http://doc.babylonjs.com/babylon101/materials#texture\r\n */\r\nvar Texture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Texture, _super);\r\n /**\r\n * Instantiates a new texture.\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see http://doc.babylonjs.com/babylon101/materials#texture\r\n * @param url define the url of the picture to load as a texture\r\n * @param scene define the scene or engine the texture will belong to\r\n * @param noMipmap define if the texture will require mip maps or not\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n */\r\n function Texture(url, sceneOrEngine, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n var _this = _super.call(this, (sceneOrEngine && sceneOrEngine.getClassName() === \"Scene\") ? sceneOrEngine : null) || this;\r\n /**\r\n * Define the url of the texture.\r\n */\r\n _this.url = null;\r\n /**\r\n * Define an offset on the texture to offset the u coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.uOffset = 0;\r\n /**\r\n * Define an offset on the texture to offset the v coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.vOffset = 0;\r\n /**\r\n * Define an offset on the texture to scale the u coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.uScale = 1.0;\r\n /**\r\n * Define an offset on the texture to scale the v coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.vScale = 1.0;\r\n /**\r\n * Define an offset on the texture to rotate around the u coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.uAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the v coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.vAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)\r\n * @see http://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.wAng = 0;\r\n /**\r\n * Defines the center of rotation (U)\r\n */\r\n _this.uRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (V)\r\n */\r\n _this.vRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (W)\r\n */\r\n _this.wRotationCenter = 0.5;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility\r\n */\r\n _this.inspectableCustomProperties = null;\r\n _this._noMipmap = false;\r\n /** @hidden */\r\n _this._invertY = false;\r\n _this._rowGenerationMatrix = null;\r\n _this._cachedTextureMatrix = null;\r\n _this._projectionModeMatrix = null;\r\n _this._t0 = null;\r\n _this._t1 = null;\r\n _this._t2 = null;\r\n _this._cachedUOffset = -1;\r\n _this._cachedVOffset = -1;\r\n _this._cachedUScale = 0;\r\n _this._cachedVScale = 0;\r\n _this._cachedUAng = -1;\r\n _this._cachedVAng = -1;\r\n _this._cachedWAng = -1;\r\n _this._cachedProjectionMatrixId = -1;\r\n _this._cachedCoordinatesMode = -1;\r\n /** @hidden */\r\n _this._initialSamplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n /** @hidden */\r\n _this._buffer = null;\r\n _this._deleteBuffer = false;\r\n _this._format = null;\r\n _this._delayedOnLoad = null;\r\n _this._delayedOnError = null;\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n _this.onLoadObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._isBlocking = true;\r\n _this.name = url || \"\";\r\n _this.url = url;\r\n _this._noMipmap = noMipmap;\r\n _this._invertY = invertY;\r\n _this._initialSamplingMode = samplingMode;\r\n _this._buffer = buffer;\r\n _this._deleteBuffer = deleteBuffer;\r\n if (format) {\r\n _this._format = format;\r\n }\r\n var scene = _this.getScene();\r\n var engine = (sceneOrEngine && sceneOrEngine.getCaps) ? sceneOrEngine : (scene ? scene.getEngine() : null);\r\n if (!engine) {\r\n return _this;\r\n }\r\n engine.onBeforeTextureInitObservable.notifyObservers(_this);\r\n var load = function () {\r\n if (_this._texture) {\r\n if (_this._texture._invertVScale) {\r\n _this.vScale *= -1;\r\n _this.vOffset += 1;\r\n }\r\n // Update texutre to match internal texture's wrapping\r\n if (_this._texture._cachedWrapU !== null) {\r\n _this.wrapU = _this._texture._cachedWrapU;\r\n _this._texture._cachedWrapU = null;\r\n }\r\n if (_this._texture._cachedWrapV !== null) {\r\n _this.wrapV = _this._texture._cachedWrapV;\r\n _this._texture._cachedWrapV = null;\r\n }\r\n if (_this._texture._cachedWrapR !== null) {\r\n _this.wrapR = _this._texture._cachedWrapR;\r\n _this._texture._cachedWrapR = null;\r\n }\r\n }\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n if (!_this.isBlocking && scene) {\r\n scene.resetCachedMaterial();\r\n }\r\n };\r\n if (!_this.url) {\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n return _this;\r\n }\r\n _this._texture = _this._getFromCache(_this.url, noMipmap, samplingMode, invertY);\r\n if (!_this._texture) {\r\n if (!scene || !scene.useDelayedTextureLoading) {\r\n _this._texture = engine.createTexture(_this.url, noMipmap, invertY, scene, samplingMode, load, onError, _this._buffer, undefined, _this._format);\r\n if (deleteBuffer) {\r\n delete _this._buffer;\r\n }\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n }\r\n }\r\n else {\r\n if (_this._texture.isReady) {\r\n _Misc_timingTools__WEBPACK_IMPORTED_MODULE_8__[\"TimingTools\"].SetImmediate(function () { return load(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(load);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Texture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"isBlocking\", {\r\n get: function () {\r\n return this._isBlocking;\r\n },\r\n /**\r\n * Is the texture preventing material to render while loading.\r\n * If false, a default texture will be used instead of the loading one during the preparation step.\r\n */\r\n set: function (value) {\r\n this._isBlocking = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"samplingMode\", {\r\n /**\r\n * Get the current sampling mode associated with the texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._initialSamplingMode;\r\n }\r\n return this._texture.samplingMode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"invertY\", {\r\n /**\r\n * Gets a boolean indicating if the texture needs to be inverted on the y axis during loading\r\n */\r\n get: function () {\r\n return this._invertY;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param buffer the buffer of the texture (defaults to null)\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n */\r\n Texture.prototype.updateURL = function (url, buffer, onLoad) {\r\n if (buffer === void 0) { buffer = null; }\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n this.name = url;\r\n this.url = url;\r\n this._buffer = buffer;\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad();\r\n };\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @hidden\r\n */\r\n Texture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY);\r\n if (!this._texture) {\r\n this._texture = scene.getEngine().createTexture(this.url, this._noMipmap, this._invertY, scene, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format);\r\n if (this._deleteBuffer) {\r\n delete this._buffer;\r\n }\r\n }\r\n else {\r\n if (this._delayedOnLoad) {\r\n if (this._texture.isReady) {\r\n _Misc_timingTools__WEBPACK_IMPORTED_MODULE_8__[\"TimingTools\"].SetImmediate(this._delayedOnLoad);\r\n }\r\n else {\r\n this._texture.onLoadedObservable.add(this._delayedOnLoad);\r\n }\r\n }\r\n }\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {\r\n x *= this.uScale;\r\n y *= this.vScale;\r\n x -= this.uRotationCenter * this.uScale;\r\n y -= this.vRotationCenter * this.vScale;\r\n z -= this.wRotationCenter;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix, t);\r\n t.x += this.uRotationCenter * this.uScale + this.uOffset;\r\n t.y += this.vRotationCenter * this.vScale + this.vOffset;\r\n t.z += this.wRotationCenter;\r\n };\r\n /**\r\n * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.\r\n * @returns the transform matrix of the texture.\r\n */\r\n Texture.prototype.getTextureMatrix = function () {\r\n var _this = this;\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.uAng === this._cachedUAng &&\r\n this.vAng === this._cachedVAng &&\r\n this.wAng === this._cachedWAng) {\r\n return this._cachedTextureMatrix;\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale;\r\n this._cachedVScale = this.vScale;\r\n this._cachedUAng = this.uAng;\r\n this._cachedVAng = this.vAng;\r\n this._cachedWAng = this.wAng;\r\n if (!this._cachedTextureMatrix) {\r\n this._cachedTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n this._rowGenerationMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n this._t0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._t1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._t2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix);\r\n this._prepareRowForTextureGeneration(0, 0, 0, this._t0);\r\n this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1);\r\n this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2);\r\n this._t1.subtractInPlace(this._t0);\r\n this._t2.subtractInPlace(this._t0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValuesToRef(this._t1.x, this._t1.y, this._t1.z, 0.0, this._t2.x, this._t2.y, this._t2.z, 0.0, this._t0.x, this._t0.y, this._t0.z, 0.0, 0.0, 0.0, 0.0, 1.0, this._cachedTextureMatrix);\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) {\r\n return mat.hasTexture(_this);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.\r\n * @returns The reflection texture transform\r\n */\r\n Texture.prototype.getReflectionTextureMatrix = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.coordinatesMode === this._cachedCoordinatesMode) {\r\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\r\n if (this._cachedProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n else {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n if (!this._cachedTextureMatrix) {\r\n this._cachedTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n }\r\n if (!this._projectionModeMatrix) {\r\n this._projectionModeMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale;\r\n this._cachedVScale = this.vScale;\r\n this._cachedCoordinatesMode = this.coordinatesMode;\r\n switch (this.coordinatesMode) {\r\n case Texture.PLANAR_MODE:\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].IdentityToRef(this._cachedTextureMatrix);\r\n this._cachedTextureMatrix[0] = this.uScale;\r\n this._cachedTextureMatrix[5] = this.vScale;\r\n this._cachedTextureMatrix[12] = this.uOffset;\r\n this._cachedTextureMatrix[13] = this.vOffset;\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValuesToRef(0.5, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 1.0, this._projectionModeMatrix);\r\n var projectionMatrix = scene.getProjectionMatrix();\r\n this._cachedProjectionMatrixId = projectionMatrix.updateFlag;\r\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix);\r\n break;\r\n default:\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].IdentityToRef(this._cachedTextureMatrix);\r\n break;\r\n }\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) {\r\n return (mat.getActiveTextures().indexOf(_this) !== -1);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n Texture.prototype.clone = function () {\r\n var _this = this;\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () {\r\n return new Texture(_this._texture ? _this._texture.url : null, _this.getScene(), _this._noMipmap, _this._invertY, _this.samplingMode, undefined, undefined, _this._texture ? _this._texture._buffer : undefined);\r\n }, this);\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n Texture.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (!serializationObject) {\r\n return null;\r\n }\r\n if (typeof this._buffer === \"string\" && this._buffer.substr(0, 5) === \"data:\") {\r\n serializationObject.base64String = this._buffer;\r\n serializationObject.name = serializationObject.name.replace(\"data:\", \"\");\r\n }\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n return serializationObject;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"Texture\"\r\n */\r\n Texture.prototype.getClassName = function () {\r\n return \"Texture\";\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n Texture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onLoadObservable.clear();\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n /**\r\n * Parse the JSON representation of a texture in order to recreate the texture in the given scene.\r\n * @param parsedTexture Define the JSON representation of the texture\r\n * @param scene Define the scene the parsed texture should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed texture if successful\r\n */\r\n Texture.Parse = function (parsedTexture, scene, rootUrl) {\r\n if (parsedTexture.customType) {\r\n var customTexture = _Misc_instantiationTools__WEBPACK_IMPORTED_MODULE_9__[\"InstantiationTools\"].Instantiate(parsedTexture.customType);\r\n // Update Sampling Mode\r\n var parsedCustomTexture = customTexture.Parse(parsedTexture, scene, rootUrl);\r\n if (parsedTexture.samplingMode && parsedCustomTexture.updateSamplingMode && parsedCustomTexture._samplingMode) {\r\n if (parsedCustomTexture._samplingMode !== parsedTexture.samplingMode) {\r\n parsedCustomTexture.updateSamplingMode(parsedTexture.samplingMode);\r\n }\r\n }\r\n return parsedCustomTexture;\r\n }\r\n if (parsedTexture.isCube && !parsedTexture.isRenderTarget) {\r\n return Texture._CubeTextureParser(parsedTexture, scene, rootUrl);\r\n }\r\n if (!parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n return null;\r\n }\r\n var texture = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () {\r\n var generateMipMaps = true;\r\n if (parsedTexture.noMipmap) {\r\n generateMipMaps = false;\r\n }\r\n if (parsedTexture.mirrorPlane) {\r\n var mirrorTexture = Texture._CreateMirror(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n mirrorTexture._waitingRenderList = parsedTexture.renderList;\r\n mirrorTexture.mirrorPlane = _Maths_math_plane__WEBPACK_IMPORTED_MODULE_10__[\"Plane\"].FromArray(parsedTexture.mirrorPlane);\r\n return mirrorTexture;\r\n }\r\n else if (parsedTexture.isRenderTarget) {\r\n var renderTargetTexture = null;\r\n if (parsedTexture.isCube) {\r\n // Search for an existing reflection probe (which contains a cube render target texture)\r\n if (scene.reflectionProbes) {\r\n for (var index = 0; index < scene.reflectionProbes.length; index++) {\r\n var probe = scene.reflectionProbes[index];\r\n if (probe.name === parsedTexture.name) {\r\n return probe.cubeTexture;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n renderTargetTexture = Texture._CreateRenderTargetTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n renderTargetTexture._waitingRenderList = parsedTexture.renderList;\r\n }\r\n return renderTargetTexture;\r\n }\r\n else {\r\n var texture;\r\n if (parsedTexture.base64String) {\r\n texture = Texture.CreateFromBase64String(parsedTexture.base64String, parsedTexture.name, scene, !generateMipMaps);\r\n }\r\n else {\r\n var url = rootUrl + parsedTexture.name;\r\n if (Texture.UseSerializedUrlIfAny && parsedTexture.url) {\r\n url = parsedTexture.url;\r\n }\r\n texture = new Texture(url, scene, !generateMipMaps, parsedTexture.invertY);\r\n }\r\n return texture;\r\n }\r\n }, parsedTexture, scene);\r\n // Update Sampling Mode\r\n if (parsedTexture.samplingMode) {\r\n var sampling = parsedTexture.samplingMode;\r\n if (texture && texture.samplingMode !== sampling) {\r\n texture.updateSamplingMode(sampling);\r\n }\r\n }\r\n // Animations\r\n if (texture && parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Creates a texture from its base 64 representation.\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param scene Define the scene the texture should belong to\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n return new Texture(\"data:\" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);\r\n };\r\n /**\r\n * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param scene Define the scene the texture should belong to\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.LoadFromDataString = function (name, buffer, scene, deleteBuffer, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n return new Texture(name, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format);\r\n };\r\n /** @hidden */\r\n Texture._CubeTextureParser = function (jsonTexture, scene, rootUrl) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__[\"_DevTools\"].WarnImport(\"CubeTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateMirror = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__[\"_DevTools\"].WarnImport(\"MirrorTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__[\"_DevTools\"].WarnImport(\"RenderTargetTexture\");\r\n };\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_SAMPLINGMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_NEAREST_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.BILINEAR_SAMPLINGMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.LINEAR_LINEAR_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.TRILINEAR_SAMPLINGMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.LINEAR_LINEAR_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Texture.NEAREST_NEAREST_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Texture.NEAREST_LINEAR_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Texture.NEAREST_LINEAR_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = linear and mip = none */\r\n Texture.NEAREST_LINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_LINEAR;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Texture.NEAREST_NEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_NEAREST;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Texture.LINEAR_NEAREST_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Texture.LINEAR_NEAREST_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n /** mag = linear and min = linear and mip = none */\r\n Texture.LINEAR_LINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_LINEAR;\r\n /** mag = linear and min = nearest and mip = none */\r\n Texture.LINEAR_NEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_NEAREST;\r\n /** Explicit coordinates mode */\r\n Texture.EXPLICIT_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_EXPLICIT_MODE;\r\n /** Spherical coordinates mode */\r\n Texture.SPHERICAL_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_SPHERICAL_MODE;\r\n /** Planar coordinates mode */\r\n Texture.PLANAR_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_PLANAR_MODE;\r\n /** Cubic coordinates mode */\r\n Texture.CUBIC_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_CUBIC_MODE;\r\n /** Projection coordinates mode */\r\n Texture.PROJECTION_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_PROJECTION_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.SKYBOX_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_SKYBOX_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.INVCUBIC_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_INVCUBIC_MODE;\r\n /** Equirectangular coordinates mode */\r\n Texture.EQUIRECTANGULAR_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Texture.CLAMP_ADDRESSMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Texture.WRAP_ADDRESSMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /** Texture is repeating and mirrored */\r\n Texture.MIRROR_ADDRESSMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_MIRROR_ADDRESSMODE;\r\n /**\r\n * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file\r\n */\r\n Texture.UseSerializedUrlIfAny = false;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"url\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uAng\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vAng\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"wAng\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uRotationCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vRotationCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"wRotationCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"isBlocking\", null);\r\n return Texture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__[\"BaseTexture\"]));\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"]._TextureParser = Texture.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/videoTexture.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Textures/videoTexture.ts ***!\n \\********************************************/\n/*! exports provided: VideoTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return VideoTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/how_to/video_texture\r\n */\r\nvar VideoTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VideoTexture, _super);\r\n /**\r\n * Creates a video texture.\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/how_to/video_texture\r\n * @param name optional name, will detect from video source, if not defined\r\n * @param src can be used to provide an url, array of urls or an already setup HTML video element.\r\n * @param scene is obviously the current scene.\r\n * @param generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).\r\n * @param invertY is false by default but can be used to invert video on Y axis\r\n * @param samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default\r\n * @param settings allows finer control over video usage\r\n */\r\n function VideoTexture(name, src, scene, generateMipMaps, invertY, samplingMode, settings) {\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (settings === void 0) { settings = {\r\n autoPlay: true,\r\n loop: true,\r\n autoUpdateTexture: true,\r\n }; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;\r\n _this._onUserActionRequestedObservable = null;\r\n _this._stillImageCaptured = false;\r\n _this._displayingPosterTexture = false;\r\n _this._frameId = -1;\r\n _this._createInternalTexture = function () {\r\n if (_this._texture != null) {\r\n if (_this._displayingPosterTexture) {\r\n _this._texture.dispose();\r\n _this._displayingPosterTexture = false;\r\n }\r\n else {\r\n return;\r\n }\r\n }\r\n if (!_this._engine.needPOTTextures ||\r\n (_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].IsExponentOfTwo(_this.video.videoWidth) && _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].IsExponentOfTwo(_this.video.videoHeight))) {\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n }\r\n else {\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this._generateMipMaps = false;\r\n }\r\n _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this.samplingMode);\r\n if (!_this.video.autoplay && !_this._settings.poster) {\r\n var oldHandler_1 = _this.video.onplaying;\r\n var error_1 = false;\r\n var oldMuted_1 = _this.video.muted;\r\n _this.video.muted = true;\r\n _this.video.onplaying = function () {\r\n _this.video.muted = oldMuted_1;\r\n _this.video.onplaying = oldHandler_1;\r\n _this._texture.isReady = true;\r\n _this._updateInternalTexture();\r\n if (!error_1) {\r\n _this.video.pause();\r\n }\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n };\r\n var playing = _this.video.play();\r\n if (playing) {\r\n playing.then(function () {\r\n // Everything is good.\r\n })\r\n .catch(function () {\r\n error_1 = true;\r\n // On Chrome for instance, new policies might prevent playing without user interaction.\r\n if (_this._onUserActionRequestedObservable && _this._onUserActionRequestedObservable.hasObservers()) {\r\n _this._onUserActionRequestedObservable.notifyObservers(_this);\r\n }\r\n });\r\n }\r\n else {\r\n _this.video.onplaying = oldHandler_1;\r\n _this._texture.isReady = true;\r\n _this._updateInternalTexture();\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n }\r\n }\r\n else {\r\n _this._texture.isReady = true;\r\n _this._updateInternalTexture();\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n }\r\n };\r\n _this.reset = function () {\r\n if (_this._texture == null) {\r\n return;\r\n }\r\n if (!_this._displayingPosterTexture) {\r\n _this._texture.dispose();\r\n _this._texture = null;\r\n }\r\n };\r\n _this._updateInternalTexture = function () {\r\n if (_this._texture == null || !_this._texture.isReady) {\r\n return;\r\n }\r\n if (_this.video.readyState < _this.video.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n if (_this._displayingPosterTexture) {\r\n return;\r\n }\r\n var frameId = _this.getScene().getFrameId();\r\n if (_this._frameId === frameId) {\r\n return;\r\n }\r\n _this._frameId = frameId;\r\n _this._engine.updateVideoTexture(_this._texture, _this.video, _this._invertY);\r\n };\r\n _this._engine = _this.getScene().getEngine();\r\n _this._generateMipMaps = generateMipMaps;\r\n _this._initialSamplingMode = samplingMode;\r\n _this.autoUpdateTexture = settings.autoUpdateTexture;\r\n _this.name = name || _this._getName(src);\r\n _this.video = _this._getVideo(src);\r\n _this._settings = settings;\r\n if (settings.poster) {\r\n _this.video.poster = settings.poster;\r\n }\r\n if (settings.autoPlay !== undefined) {\r\n _this.video.autoplay = settings.autoPlay;\r\n }\r\n if (settings.loop !== undefined) {\r\n _this.video.loop = settings.loop;\r\n }\r\n _this.video.setAttribute(\"playsinline\", \"\");\r\n _this.video.addEventListener(\"paused\", _this._updateInternalTexture);\r\n _this.video.addEventListener(\"seeked\", _this._updateInternalTexture);\r\n _this.video.addEventListener(\"emptied\", _this.reset);\r\n _this._createInternalTextureOnEvent = (settings.poster && !settings.autoPlay) ? \"play\" : \"canplay\";\r\n _this.video.addEventListener(_this._createInternalTextureOnEvent, _this._createInternalTexture);\r\n var videoHasEnoughData = (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA);\r\n if (settings.poster &&\r\n (!settings.autoPlay || !videoHasEnoughData)) {\r\n _this._texture = _this._engine.createTexture(settings.poster, false, true, scene);\r\n _this._displayingPosterTexture = true;\r\n }\r\n else if (videoHasEnoughData) {\r\n _this._createInternalTexture();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(VideoTexture.prototype, \"onUserActionRequestedObservable\", {\r\n /**\r\n * Event triggerd when a dom action is required by the user to play the video.\r\n * This happens due to recent changes in browser policies preventing video to auto start.\r\n */\r\n get: function () {\r\n if (!this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._onUserActionRequestedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VideoTexture.prototype._getName = function (src) {\r\n if (src instanceof HTMLVideoElement) {\r\n return src.currentSrc;\r\n }\r\n if (typeof src === \"object\") {\r\n return src.toString();\r\n }\r\n return src;\r\n };\r\n VideoTexture.prototype._getVideo = function (src) {\r\n if (src instanceof HTMLVideoElement) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(src.currentSrc, src);\r\n return src;\r\n }\r\n var video = document.createElement(\"video\");\r\n if (typeof src === \"string\") {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(src, video);\r\n video.src = src;\r\n }\r\n else {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(src[0], video);\r\n src.forEach(function (url) {\r\n var source = document.createElement(\"source\");\r\n source.src = url;\r\n video.appendChild(source);\r\n });\r\n }\r\n return video;\r\n };\r\n /**\r\n * @hidden Internal method to initiate `update`.\r\n */\r\n VideoTexture.prototype._rebuild = function () {\r\n this.update();\r\n };\r\n /**\r\n * Update Texture in the `auto` mode. Does not do anything if `settings.autoUpdateTexture` is false.\r\n */\r\n VideoTexture.prototype.update = function () {\r\n if (!this.autoUpdateTexture) {\r\n // Expecting user to call `updateTexture` manually\r\n return;\r\n }\r\n this.updateTexture(true);\r\n };\r\n /**\r\n * Update Texture in `manual` mode. Does not do anything if not visible or paused.\r\n * @param isVisible Visibility state, detected by user using `scene.getActiveMeshes()` or othervise.\r\n */\r\n VideoTexture.prototype.updateTexture = function (isVisible) {\r\n if (!isVisible) {\r\n return;\r\n }\r\n if (this.video.paused && this._stillImageCaptured) {\r\n return;\r\n }\r\n this._stillImageCaptured = true;\r\n this._updateInternalTexture();\r\n };\r\n /**\r\n * Change video content. Changing video instance or setting multiple urls (as in constructor) is not supported.\r\n * @param url New url.\r\n */\r\n VideoTexture.prototype.updateURL = function (url) {\r\n this.video.src = url;\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n VideoTexture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable.clear();\r\n this._onUserActionRequestedObservable = null;\r\n }\r\n this.video.removeEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);\r\n this.video.removeEventListener(\"paused\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"seeked\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"emptied\", this.reset);\r\n this.video.pause();\r\n };\r\n /**\r\n * Creates a video texture straight from a stream.\r\n * @param scene Define the scene the texture should be created in\r\n * @param stream Define the stream the texture should be created from\r\n * @returns The created video texture as a promise\r\n */\r\n VideoTexture.CreateFromStreamAsync = function (scene, stream) {\r\n var video = document.createElement(\"video\");\r\n video.setAttribute('autoplay', '');\r\n video.setAttribute('muted', 'true');\r\n video.setAttribute('playsinline', '');\r\n video.muted = true;\r\n if (video.mozSrcObject !== undefined) {\r\n // hack for Firefox < 19\r\n video.mozSrcObject = stream;\r\n }\r\n else {\r\n if (typeof video.srcObject == \"object\") {\r\n video.srcObject = stream;\r\n }\r\n else {\r\n window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;\r\n video.src = (window.URL && window.URL.createObjectURL(stream));\r\n }\r\n }\r\n return new Promise(function (resolve) {\r\n var onPlaying = function () {\r\n resolve(new VideoTexture(\"video\", video, scene, true, true));\r\n video.removeEventListener(\"playing\", onPlaying);\r\n };\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.play();\r\n });\r\n };\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Define the scene the texture should be created in\r\n * @param constraints Define the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Define the audio constraints to use to create the web cam feed from WebRTC\r\n * @returns The created video texture as a promise\r\n */\r\n VideoTexture.CreateFromWebCamAsync = function (scene, constraints, audioConstaints) {\r\n var _this = this;\r\n if (audioConstaints === void 0) { audioConstaints = false; }\r\n var constraintsDeviceId;\r\n if (constraints && constraints.deviceId) {\r\n constraintsDeviceId = {\r\n exact: constraints.deviceId,\r\n };\r\n }\r\n if (navigator.mediaDevices) {\r\n return navigator.mediaDevices.getUserMedia({\r\n video: constraints,\r\n audio: audioConstaints\r\n })\r\n .then(function (stream) {\r\n return _this.CreateFromStreamAsync(scene, stream);\r\n });\r\n }\r\n else {\r\n navigator.getUserMedia =\r\n navigator.getUserMedia ||\r\n navigator.webkitGetUserMedia ||\r\n navigator.mozGetUserMedia ||\r\n navigator.msGetUserMedia;\r\n if (navigator.getUserMedia) {\r\n navigator.getUserMedia({\r\n video: {\r\n deviceId: constraintsDeviceId,\r\n width: {\r\n min: (constraints && constraints.minWidth) || 256,\r\n max: (constraints && constraints.maxWidth) || 640,\r\n },\r\n height: {\r\n min: (constraints && constraints.minHeight) || 256,\r\n max: (constraints && constraints.maxHeight) || 480,\r\n },\r\n },\r\n audio: audioConstaints\r\n }, function (stream) {\r\n return _this.CreateFromStreamAsync(scene, stream);\r\n }, function (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(e.name);\r\n });\r\n }\r\n }\r\n return Promise.reject(\"No support for userMedia on this device\");\r\n };\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Define the scene the texture should be created in\r\n * @param onReady Define a callback to triggered once the texture will be ready\r\n * @param constraints Define the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Define the audio constraints to use to create the web cam feed from WebRTC\r\n */\r\n VideoTexture.CreateFromWebCam = function (scene, onReady, constraints, audioConstaints) {\r\n if (audioConstaints === void 0) { audioConstaints = false; }\r\n this.CreateFromWebCamAsync(scene, constraints, audioConstaints)\r\n .then(function (videoTexture) {\r\n if (onReady) {\r\n onReady(videoTexture);\r\n }\r\n })\r\n .catch(function (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(err.name);\r\n });\r\n };\r\n return VideoTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/colorCurves.ts\":\n/*!**********************************!*\\\n !*** ./Materials/colorCurves.ts ***!\n \\**********************************/\n/*! exports provided: ColorCurves */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return ColorCurves; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n/**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\nvar ColorCurves = /** @class */ (function () {\r\n function ColorCurves() {\r\n this._dirty = true;\r\n this._tempColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._globalCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._highlightsCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._midtonesCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._shadowsCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._positiveCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._negativeCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._globalHue = 30;\r\n this._globalDensity = 0;\r\n this._globalSaturation = 0;\r\n this._globalExposure = 0;\r\n this._highlightsHue = 30;\r\n this._highlightsDensity = 0;\r\n this._highlightsSaturation = 0;\r\n this._highlightsExposure = 0;\r\n this._midtonesHue = 30;\r\n this._midtonesDensity = 0;\r\n this._midtonesSaturation = 0;\r\n this._midtonesExposure = 0;\r\n this._shadowsHue = 30;\r\n this._shadowsDensity = 0;\r\n this._shadowsSaturation = 0;\r\n this._shadowsExposure = 0;\r\n }\r\n Object.defineProperty(ColorCurves.prototype, \"globalHue\", {\r\n /**\r\n * Gets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._globalHue;\r\n },\r\n /**\r\n * Sets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._globalHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalDensity\", {\r\n /**\r\n * Gets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._globalDensity;\r\n },\r\n /**\r\n * Sets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._globalDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalSaturation\", {\r\n /**\r\n * Gets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._globalSaturation;\r\n },\r\n /**\r\n * Sets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._globalSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalExposure\", {\r\n /**\r\n * Gets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._globalExposure;\r\n },\r\n /**\r\n * Sets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._globalExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsHue\", {\r\n /**\r\n * Gets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._highlightsHue;\r\n },\r\n /**\r\n * Sets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._highlightsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsDensity\", {\r\n /**\r\n * Gets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._highlightsDensity;\r\n },\r\n /**\r\n * Sets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._highlightsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsSaturation\", {\r\n /**\r\n * Gets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._highlightsSaturation;\r\n },\r\n /**\r\n * Sets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._highlightsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsExposure\", {\r\n /**\r\n * Gets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._highlightsExposure;\r\n },\r\n /**\r\n * Sets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._highlightsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesHue\", {\r\n /**\r\n * Gets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._midtonesHue;\r\n },\r\n /**\r\n * Sets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._midtonesHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesDensity\", {\r\n /**\r\n * Gets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._midtonesDensity;\r\n },\r\n /**\r\n * Sets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._midtonesDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesSaturation\", {\r\n /**\r\n * Gets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._midtonesSaturation;\r\n },\r\n /**\r\n * Sets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._midtonesSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesExposure\", {\r\n /**\r\n * Gets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._midtonesExposure;\r\n },\r\n /**\r\n * Sets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._midtonesExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsHue\", {\r\n /**\r\n * Gets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._shadowsHue;\r\n },\r\n /**\r\n * Sets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._shadowsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsDensity\", {\r\n /**\r\n * Gets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._shadowsDensity;\r\n },\r\n /**\r\n * Sets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._shadowsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsSaturation\", {\r\n /**\r\n * Gets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._shadowsSaturation;\r\n },\r\n /**\r\n * Sets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._shadowsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsExposure\", {\r\n /**\r\n * Gets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._shadowsExposure;\r\n },\r\n /**\r\n * Sets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._shadowsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the class name\r\n * @returns The class name\r\n */\r\n ColorCurves.prototype.getClassName = function () {\r\n return \"ColorCurves\";\r\n };\r\n /**\r\n * Binds the color curves to the shader.\r\n * @param colorCurves The color curve to bind\r\n * @param effect The effect to bind to\r\n * @param positiveUniform The positive uniform shader parameter\r\n * @param neutralUniform The neutral uniform shader parameter\r\n * @param negativeUniform The negative uniform shader parameter\r\n */\r\n ColorCurves.Bind = function (colorCurves, effect, positiveUniform, neutralUniform, negativeUniform) {\r\n if (positiveUniform === void 0) { positiveUniform = \"vCameraColorCurvePositive\"; }\r\n if (neutralUniform === void 0) { neutralUniform = \"vCameraColorCurveNeutral\"; }\r\n if (negativeUniform === void 0) { negativeUniform = \"vCameraColorCurveNegative\"; }\r\n if (colorCurves._dirty) {\r\n colorCurves._dirty = false;\r\n // Fill in global info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);\r\n // Compute highlights info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._highlightsHue, colorCurves._highlightsDensity, colorCurves._highlightsSaturation, colorCurves._highlightsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._highlightsCurve);\r\n // Compute midtones info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._midtonesHue, colorCurves._midtonesDensity, colorCurves._midtonesSaturation, colorCurves._midtonesExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);\r\n // Compute shadows info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._shadowsHue, colorCurves._shadowsDensity, colorCurves._shadowsSaturation, colorCurves._shadowsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);\r\n // Compute deltas (neutral is midtones).\r\n colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);\r\n colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);\r\n }\r\n if (effect) {\r\n effect.setFloat4(positiveUniform, colorCurves._positiveCurve.r, colorCurves._positiveCurve.g, colorCurves._positiveCurve.b, colorCurves._positiveCurve.a);\r\n effect.setFloat4(neutralUniform, colorCurves._midtonesCurve.r, colorCurves._midtonesCurve.g, colorCurves._midtonesCurve.b, colorCurves._midtonesCurve.a);\r\n effect.setFloat4(negativeUniform, colorCurves._negativeCurve.r, colorCurves._negativeCurve.g, colorCurves._negativeCurve.b, colorCurves._negativeCurve.a);\r\n }\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the ColorCurves effects.\r\n * @param uniformsList The list of uniforms used in the effect\r\n */\r\n ColorCurves.PrepareUniforms = function (uniformsList) {\r\n uniformsList.push(\"vCameraColorCurveNeutral\", \"vCameraColorCurvePositive\", \"vCameraColorCurveNegative\");\r\n };\r\n /**\r\n * Returns color grading data based on a hue, density, saturation and exposure value.\r\n * @param filterHue The hue of the color filter.\r\n * @param filterDensity The density of the color filter.\r\n * @param saturation The saturation.\r\n * @param exposure The exposure.\r\n * @param result The result data container.\r\n */\r\n ColorCurves.prototype.getColorGradingDataToRef = function (hue, density, saturation, exposure, result) {\r\n if (hue == null) {\r\n return;\r\n }\r\n hue = ColorCurves.clamp(hue, 0, 360);\r\n density = ColorCurves.clamp(density, -100, 100);\r\n saturation = ColorCurves.clamp(saturation, -100, 100);\r\n exposure = ColorCurves.clamp(exposure, -100, 100);\r\n // Remap the slider/config filter density with non-linear mapping and also scale by half\r\n // so that the maximum filter density is only 50% control. This provides fine control\r\n // for small values and reasonable range.\r\n density = ColorCurves.applyColorGradingSliderNonlinear(density);\r\n density *= 0.5;\r\n exposure = ColorCurves.applyColorGradingSliderNonlinear(exposure);\r\n if (density < 0) {\r\n density *= -1;\r\n hue = (hue + 180) % 360;\r\n }\r\n ColorCurves.fromHSBToRef(hue, density, 50 + 0.25 * exposure, result);\r\n result.scaleToRef(2, result);\r\n result.a = 1 + 0.01 * saturation;\r\n };\r\n /**\r\n * Takes an input slider value and returns an adjusted value that provides extra control near the centre.\r\n * @param value The input slider value in range [-100,100].\r\n * @returns Adjusted value.\r\n */\r\n ColorCurves.applyColorGradingSliderNonlinear = function (value) {\r\n value /= 100;\r\n var x = Math.abs(value);\r\n x = Math.pow(x, 2);\r\n if (value < 0) {\r\n x *= -1;\r\n }\r\n x *= 100;\r\n return x;\r\n };\r\n /**\r\n * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).\r\n * @param hue The hue (H) input.\r\n * @param saturation The saturation (S) input.\r\n * @param brightness The brightness (B) input.\r\n * @result An RGBA color represented as Vector4.\r\n */\r\n ColorCurves.fromHSBToRef = function (hue, saturation, brightness, result) {\r\n var h = ColorCurves.clamp(hue, 0, 360);\r\n var s = ColorCurves.clamp(saturation / 100, 0, 1);\r\n var v = ColorCurves.clamp(brightness / 100, 0, 1);\r\n if (s === 0) {\r\n result.r = v;\r\n result.g = v;\r\n result.b = v;\r\n }\r\n else {\r\n // sector 0 to 5\r\n h /= 60;\r\n var i = Math.floor(h);\r\n // fractional part of h\r\n var f = h - i;\r\n var p = v * (1 - s);\r\n var q = v * (1 - s * f);\r\n var t = v * (1 - s * (1 - f));\r\n switch (i) {\r\n case 0:\r\n result.r = v;\r\n result.g = t;\r\n result.b = p;\r\n break;\r\n case 1:\r\n result.r = q;\r\n result.g = v;\r\n result.b = p;\r\n break;\r\n case 2:\r\n result.r = p;\r\n result.g = v;\r\n result.b = t;\r\n break;\r\n case 3:\r\n result.r = p;\r\n result.g = q;\r\n result.b = v;\r\n break;\r\n case 4:\r\n result.r = t;\r\n result.g = p;\r\n result.b = v;\r\n break;\r\n default: // case 5:\r\n result.r = v;\r\n result.g = p;\r\n result.b = q;\r\n break;\r\n }\r\n }\r\n result.a = 1;\r\n };\r\n /**\r\n * Returns a value clamped between min and max\r\n * @param value The value to clamp\r\n * @param min The minimum of value\r\n * @param max The maximum of value\r\n * @returns The clamped value.\r\n */\r\n ColorCurves.clamp = function (value, min, max) {\r\n return Math.min(Math.max(value, min), max);\r\n };\r\n /**\r\n * Clones the current color curve instance.\r\n * @return The cloned curves\r\n */\r\n ColorCurves.prototype.clone = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new ColorCurves(); }, this);\r\n };\r\n /**\r\n * Serializes the current color curve instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ColorCurves.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses the color curve from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed curves\r\n */\r\n ColorCurves.Parse = function (source) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new ColorCurves(); }, source, null, null);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalHue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalDensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalSaturation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalExposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsHue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsDensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsSaturation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsExposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesHue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesDensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesSaturation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesExposure\", void 0);\r\n return ColorCurves;\r\n}());\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"]._ColorCurvesParser = ColorCurves.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/effect.ts\":\n/*!*****************************!*\\\n !*** ./Materials/effect.ts ***!\n \\*****************************/\n/*! exports provided: EffectFallbacks, EffectCreationOptions, Effect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return EffectFallbacks; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return EffectCreationOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return Effect; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_Processors_shaderProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/Processors/shaderProcessor */ \"./Engines/Processors/shaderProcessor.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * EffectFallbacks can be used to add fallbacks (properties to disable) to certain properties when desired to improve performance.\r\n * (Eg. Start at high quality with reflection and fog, if fps is low, remove reflection, if still low remove fog)\r\n */\r\nvar EffectFallbacks = /** @class */ (function () {\r\n function EffectFallbacks() {\r\n this._defines = {};\r\n this._currentRank = 32;\r\n this._maxRank = -1;\r\n this._mesh = null;\r\n }\r\n /**\r\n * Removes the fallback from the bound mesh.\r\n */\r\n EffectFallbacks.prototype.unBindMesh = function () {\r\n this._mesh = null;\r\n };\r\n /**\r\n * Adds a fallback on the specified property.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param define The name of the define in the shader\r\n */\r\n EffectFallbacks.prototype.addFallback = function (rank, define) {\r\n if (!this._defines[rank]) {\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n this._defines[rank] = new Array();\r\n }\r\n this._defines[rank].push(define);\r\n };\r\n /**\r\n * Sets the mesh to use CPU skinning when needing to fallback.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param mesh The mesh to use the fallbacks.\r\n */\r\n EffectFallbacks.prototype.addCPUSkinningFallback = function (rank, mesh) {\r\n this._mesh = mesh;\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n };\r\n Object.defineProperty(EffectFallbacks.prototype, \"hasMoreFallbacks\", {\r\n /**\r\n * Checks to see if more fallbacks are still availible.\r\n */\r\n get: function () {\r\n return this._currentRank <= this._maxRank;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Removes the defines that should be removed when falling back.\r\n * @param currentDefines defines the current define statements for the shader.\r\n * @param effect defines the current effect we try to compile\r\n * @returns The resulting defines with defines of the current rank removed.\r\n */\r\n EffectFallbacks.prototype.reduce = function (currentDefines, effect) {\r\n // First we try to switch to CPU skinning\r\n if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {\r\n this._mesh.computeBonesUsingShaders = false;\r\n currentDefines = currentDefines.replace(\"#define NUM_BONE_INFLUENCERS \" + this._mesh.numBoneInfluencers, \"#define NUM_BONE_INFLUENCERS 0\");\r\n effect._bonesComputationForcedToCPU = true;\r\n var scene = this._mesh.getScene();\r\n for (var index = 0; index < scene.meshes.length; index++) {\r\n var otherMesh = scene.meshes[index];\r\n if (!otherMesh.material) {\r\n if (!this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n continue;\r\n }\r\n if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {\r\n continue;\r\n }\r\n if (otherMesh.material.getEffect() === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n else if (otherMesh.subMeshes) {\r\n for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var subMeshEffect = subMesh.effect;\r\n if (subMeshEffect === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var currentFallbacks = this._defines[this._currentRank];\r\n if (currentFallbacks) {\r\n for (var index = 0; index < currentFallbacks.length; index++) {\r\n currentDefines = currentDefines.replace(\"#define \" + currentFallbacks[index], \"\");\r\n }\r\n }\r\n this._currentRank++;\r\n }\r\n return currentDefines;\r\n };\r\n return EffectFallbacks;\r\n}());\r\n\r\n/**\r\n * Options to be used when creating an effect.\r\n */\r\nvar EffectCreationOptions = /** @class */ (function () {\r\n function EffectCreationOptions() {\r\n }\r\n return EffectCreationOptions;\r\n}());\r\n\r\n/**\r\n * Effect containing vertex and fragment shader that can be executed on an object.\r\n */\r\nvar Effect = /** @class */ (function () {\r\n /**\r\n * Instantiates an effect.\r\n * An effect can be used to create/manage/execute vertex and fragment shaders.\r\n * @param baseName Name of the effect.\r\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\r\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\r\n * @param samplers List of sampler variables that will be passed to the shader.\r\n * @param engine Engine to be used to render the effect\r\n * @param defines Define statements to be added to the shader.\r\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\r\n * @param onCompiled Callback that will be called when the shader is compiled.\r\n * @param onError Callback that will be called if an error occurs during shader compilation.\r\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. {lights: 10})\r\n */\r\n function Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var _this = this;\r\n if (samplers === void 0) { samplers = null; }\r\n if (defines === void 0) { defines = null; }\r\n if (fallbacks === void 0) { fallbacks = null; }\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n /**\r\n * Name of the effect.\r\n */\r\n this.name = null;\r\n /**\r\n * String container all the define statements that should be set on the shader.\r\n */\r\n this.defines = \"\";\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback that will be called when effect is bound.\r\n */\r\n this.onBind = null;\r\n /**\r\n * Unique ID of the effect.\r\n */\r\n this.uniqueId = 0;\r\n /**\r\n * Observable that will be called when the shader is compiled.\r\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\r\n */\r\n this.onCompileObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Observable that will be called if an error occurs during shader compilation.\r\n */\r\n this.onErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /** @hidden */\r\n this._onBindObservable = null;\r\n /** @hidden */\r\n this._bonesComputationForcedToCPU = false;\r\n this._uniformBuffersNames = {};\r\n this._samplers = {};\r\n this._isReady = false;\r\n this._compilationError = \"\";\r\n this._uniforms = {};\r\n /**\r\n * Key for the effect.\r\n * @hidden\r\n */\r\n this._key = \"\";\r\n this._fallbacks = null;\r\n this._vertexSourceCode = \"\";\r\n this._fragmentSourceCode = \"\";\r\n this._vertexSourceCodeOverride = \"\";\r\n this._fragmentSourceCodeOverride = \"\";\r\n this._transformFeedbackVaryings = null;\r\n /**\r\n * Compiled shader to webGL program.\r\n * @hidden\r\n */\r\n this._pipelineContext = null;\r\n this._valueCache = {};\r\n this.name = baseName;\r\n if (attributesNamesOrOptions.attributes) {\r\n var options = attributesNamesOrOptions;\r\n this._engine = uniformsNamesOrEngine;\r\n this._attributesNames = options.attributes;\r\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\r\n this._samplerList = options.samplers.slice();\r\n this.defines = options.defines;\r\n this.onError = options.onError;\r\n this.onCompiled = options.onCompiled;\r\n this._fallbacks = options.fallbacks;\r\n this._indexParameters = options.indexParameters;\r\n this._transformFeedbackVaryings = options.transformFeedbackVaryings;\r\n if (options.uniformBuffersNames) {\r\n for (var i = 0; i < options.uniformBuffersNames.length; i++) {\r\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\r\n }\r\n }\r\n }\r\n else {\r\n this._engine = engine;\r\n this.defines = (defines == null ? \"\" : defines);\r\n this._uniformsNames = uniformsNamesOrEngine.concat(samplers);\r\n this._samplerList = samplers ? samplers.slice() : [];\r\n this._attributesNames = attributesNamesOrOptions;\r\n this.onError = onError;\r\n this.onCompiled = onCompiled;\r\n this._indexParameters = indexParameters;\r\n this._fallbacks = fallbacks;\r\n }\r\n this.uniqueId = Effect._uniqueIdSeed++;\r\n var vertexSource;\r\n var fragmentSource;\r\n if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n }\r\n else if (baseName.vertexElement) {\r\n vertexSource = document.getElementById(baseName.vertexElement);\r\n if (!vertexSource) {\r\n vertexSource = baseName.vertexElement;\r\n }\r\n }\r\n else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n }\r\n else if (baseName.fragmentElement) {\r\n fragmentSource = document.getElementById(baseName.fragmentElement);\r\n if (!fragmentSource) {\r\n fragmentSource = baseName.fragmentElement;\r\n }\r\n }\r\n else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n var processorOptions = {\r\n defines: this.defines.split(\"\\n\"),\r\n indexParameters: this._indexParameters,\r\n isFragment: false,\r\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\r\n processor: this._engine._shaderProcessor,\r\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\r\n shadersRepository: Effect.ShadersRepository,\r\n includesShadersStore: Effect.IncludesShadersStore,\r\n version: (this._engine.webGLVersion * 100).toString(),\r\n platformName: this._engine.webGLVersion >= 2 ? \"WEBGL2\" : \"WEBGL1\"\r\n };\r\n this._loadVertexShader(vertexSource, function (vertexCode) {\r\n _this._loadFragmentShader(fragmentSource, function (fragmentCode) {\r\n _Engines_Processors_shaderProcessor__WEBPACK_IMPORTED_MODULE_4__[\"ShaderProcessor\"].Process(vertexCode, processorOptions, function (migratedVertexCode) {\r\n processorOptions.isFragment = true;\r\n _Engines_Processors_shaderProcessor__WEBPACK_IMPORTED_MODULE_4__[\"ShaderProcessor\"].Process(fragmentCode, processorOptions, function (migratedFragmentCode) {\r\n _this._useFinalCode(migratedVertexCode, migratedFragmentCode, baseName);\r\n });\r\n });\r\n });\r\n });\r\n }\r\n Object.defineProperty(Effect.prototype, \"onBindObservable\", {\r\n /**\r\n * Observable that will be called when effect is bound.\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Effect.prototype._useFinalCode = function (migratedVertexCode, migratedFragmentCode, baseName) {\r\n if (baseName) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n this._vertexSourceCode = \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\r\n this._fragmentSourceCode = \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\r\n }\r\n else {\r\n this._vertexSourceCode = migratedVertexCode;\r\n this._fragmentSourceCode = migratedFragmentCode;\r\n }\r\n this._prepareEffect();\r\n };\r\n Object.defineProperty(Effect.prototype, \"key\", {\r\n /**\r\n * Unique key for this effect\r\n */\r\n get: function () {\r\n return this._key;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * If the effect has been compiled and prepared.\r\n * @returns if the effect is compiled and prepared.\r\n */\r\n Effect.prototype.isReady = function () {\r\n try {\r\n return this._isReadyInternal();\r\n }\r\n catch (_a) {\r\n return false;\r\n }\r\n };\r\n Effect.prototype._isReadyInternal = function () {\r\n if (this._isReady) {\r\n return true;\r\n }\r\n if (this._pipelineContext) {\r\n return this._pipelineContext.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * The engine the effect was initialized with.\r\n * @returns the engine.\r\n */\r\n Effect.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The pipeline context for this effect\r\n * @returns the associated pipeline context\r\n */\r\n Effect.prototype.getPipelineContext = function () {\r\n return this._pipelineContext;\r\n };\r\n /**\r\n * The set of names of attribute variables for the shader.\r\n * @returns An array of attribute names.\r\n */\r\n Effect.prototype.getAttributesNames = function () {\r\n return this._attributesNames;\r\n };\r\n /**\r\n * Returns the attribute at the given index.\r\n * @param index The index of the attribute.\r\n * @returns The location of the attribute.\r\n */\r\n Effect.prototype.getAttributeLocation = function (index) {\r\n return this._attributes[index];\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param name of the attribute to look up.\r\n * @returns the attribute location.\r\n */\r\n Effect.prototype.getAttributeLocationByName = function (name) {\r\n var index = this._attributesNames.indexOf(name);\r\n return this._attributes[index];\r\n };\r\n /**\r\n * The number of attributes.\r\n * @returns the numnber of attributes.\r\n */\r\n Effect.prototype.getAttributesCount = function () {\r\n return this._attributes.length;\r\n };\r\n /**\r\n * Gets the index of a uniform variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the index.\r\n */\r\n Effect.prototype.getUniformIndex = function (uniformName) {\r\n return this._uniformsNames.indexOf(uniformName);\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the location of the uniform.\r\n */\r\n Effect.prototype.getUniform = function (uniformName) {\r\n return this._uniforms[uniformName];\r\n };\r\n /**\r\n * Returns an array of sampler variable names\r\n * @returns The array of sampler variable neames.\r\n */\r\n Effect.prototype.getSamplers = function () {\r\n return this._samplerList;\r\n };\r\n /**\r\n * The error from the last compilation.\r\n * @returns the error string.\r\n */\r\n Effect.prototype.getCompilationError = function () {\r\n return this._compilationError;\r\n };\r\n /**\r\n * Adds a callback to the onCompiled observable and call the callback imediatly if already ready.\r\n * @param func The callback to be used.\r\n */\r\n Effect.prototype.executeWhenCompiled = function (func) {\r\n var _this = this;\r\n if (this.isReady()) {\r\n func(this);\r\n return;\r\n }\r\n this.onCompileObservable.add(function (effect) {\r\n func(effect);\r\n });\r\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\r\n setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 16);\r\n }\r\n };\r\n Effect.prototype._checkIsReady = function () {\r\n var _this = this;\r\n try {\r\n if (this._isReadyInternal()) {\r\n return;\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e);\r\n return;\r\n }\r\n setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 16);\r\n };\r\n /** @hidden */\r\n Effect.prototype._loadVertexShader = function (vertex, callback) {\r\n if (typeof (HTMLElement) !== \"undefined\") {\r\n // DOM element ?\r\n if (vertex instanceof HTMLElement) {\r\n var vertexCode = _Misc_domManagement__WEBPACK_IMPORTED_MODULE_2__[\"DomManagement\"].GetDOMTextContent(vertex);\r\n callback(vertexCode);\r\n return;\r\n }\r\n }\r\n // Direct source ?\r\n if (vertex.substr(0, 7) === \"source:\") {\r\n callback(vertex.substr(7));\r\n return;\r\n }\r\n // Base64 encoded ?\r\n if (vertex.substr(0, 7) === \"base64:\") {\r\n var vertexBinary = window.atob(vertex.substr(7));\r\n callback(vertexBinary);\r\n return;\r\n }\r\n // Is in local store ?\r\n if (Effect.ShadersStore[vertex + \"VertexShader\"]) {\r\n callback(Effect.ShadersStore[vertex + \"VertexShader\"]);\r\n return;\r\n }\r\n var vertexShaderUrl;\r\n if (vertex[0] === \".\" || vertex[0] === \"/\" || vertex.indexOf(\"http\") > -1) {\r\n vertexShaderUrl = vertex;\r\n }\r\n else {\r\n vertexShaderUrl = Effect.ShadersRepository + vertex;\r\n }\r\n // Vertex shader\r\n this._engine._loadFile(vertexShaderUrl + \".vertex.fx\", callback);\r\n };\r\n /** @hidden */\r\n Effect.prototype._loadFragmentShader = function (fragment, callback) {\r\n if (typeof (HTMLElement) !== \"undefined\") {\r\n // DOM element ?\r\n if (fragment instanceof HTMLElement) {\r\n var fragmentCode = _Misc_domManagement__WEBPACK_IMPORTED_MODULE_2__[\"DomManagement\"].GetDOMTextContent(fragment);\r\n callback(fragmentCode);\r\n return;\r\n }\r\n }\r\n // Direct source ?\r\n if (fragment.substr(0, 7) === \"source:\") {\r\n callback(fragment.substr(7));\r\n return;\r\n }\r\n // Base64 encoded ?\r\n if (fragment.substr(0, 7) === \"base64:\") {\r\n var fragmentBinary = window.atob(fragment.substr(7));\r\n callback(fragmentBinary);\r\n return;\r\n }\r\n // Is in local store ?\r\n if (Effect.ShadersStore[fragment + \"PixelShader\"]) {\r\n callback(Effect.ShadersStore[fragment + \"PixelShader\"]);\r\n return;\r\n }\r\n if (Effect.ShadersStore[fragment + \"FragmentShader\"]) {\r\n callback(Effect.ShadersStore[fragment + \"FragmentShader\"]);\r\n return;\r\n }\r\n var fragmentShaderUrl;\r\n if (fragment[0] === \".\" || fragment[0] === \"/\" || fragment.indexOf(\"http\") > -1) {\r\n fragmentShaderUrl = fragment;\r\n }\r\n else {\r\n fragmentShaderUrl = Effect.ShadersRepository + fragment;\r\n }\r\n // Fragment shader\r\n this._engine._loadFile(fragmentShaderUrl + \".fragment.fx\", callback);\r\n };\r\n /** @hidden */\r\n Effect.prototype._dumpShadersSource = function (vertexCode, fragmentCode, defines) {\r\n // Rebuild shaders source code\r\n var shaderVersion = (this._engine.webGLVersion > 1) ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n var prefix = shaderVersion + (defines ? defines + \"\\n\" : \"\");\r\n vertexCode = prefix + vertexCode;\r\n fragmentCode = prefix + fragmentCode;\r\n // Number lines of shaders source code\r\n var i = 2;\r\n var regex = /\\n/gm;\r\n var formattedVertexCode = \"\\n1\\t\" + vertexCode.replace(regex, function () { return \"\\n\" + (i++) + \"\\t\"; });\r\n i = 2;\r\n var formattedFragmentCode = \"\\n1\\t\" + fragmentCode.replace(regex, function () { return \"\\n\" + (i++) + \"\\t\"; });\r\n // Dump shaders name and formatted source code\r\n if (this.name.vertexElement) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Vertex shader: \" + this.name.vertexElement + formattedVertexCode);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Fragment shader: \" + this.name.fragmentElement + formattedFragmentCode);\r\n }\r\n else if (this.name.vertex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Vertex shader: \" + this.name.vertex + formattedVertexCode);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Fragment shader: \" + this.name.fragment + formattedFragmentCode);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Vertex shader: \" + this.name + formattedVertexCode);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Fragment shader: \" + this.name + formattedFragmentCode);\r\n }\r\n };\r\n /**\r\n * Recompiles the webGL program\r\n * @param vertexSourceCode The source code for the vertex shader.\r\n * @param fragmentSourceCode The source code for the fragment shader.\r\n * @param onCompiled Callback called when completed.\r\n * @param onError Callback called on error.\r\n * @hidden\r\n */\r\n Effect.prototype._rebuildProgram = function (vertexSourceCode, fragmentSourceCode, onCompiled, onError) {\r\n var _this = this;\r\n this._isReady = false;\r\n this._vertexSourceCodeOverride = vertexSourceCode;\r\n this._fragmentSourceCodeOverride = fragmentSourceCode;\r\n this.onError = function (effect, error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n };\r\n this.onCompiled = function () {\r\n var scenes = _this.getEngine().scenes;\r\n for (var i = 0; i < scenes.length; i++) {\r\n scenes[i].markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_AllDirtyFlag);\r\n }\r\n _this._pipelineContext._handlesSpectorRebuildCallback(onCompiled);\r\n };\r\n this._fallbacks = null;\r\n this._prepareEffect();\r\n };\r\n /**\r\n * Prepares the effect\r\n * @hidden\r\n */\r\n Effect.prototype._prepareEffect = function () {\r\n var _this = this;\r\n var attributesNames = this._attributesNames;\r\n var defines = this.defines;\r\n this._valueCache = {};\r\n var previousPipelineContext = this._pipelineContext;\r\n try {\r\n var engine_1 = this._engine;\r\n this._pipelineContext = engine_1.createPipelineContext();\r\n var rebuildRebind = this._rebuildProgram.bind(this);\r\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, true, rebuildRebind, null, this._transformFeedbackVaryings);\r\n }\r\n else {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, false, rebuildRebind, defines, this._transformFeedbackVaryings);\r\n }\r\n engine_1._executeWhenRenderingStateIsCompiled(this._pipelineContext, function () {\r\n if (engine_1.supportsUniformBuffers) {\r\n for (var name in _this._uniformBuffersNames) {\r\n _this.bindUniformBlock(name, _this._uniformBuffersNames[name]);\r\n }\r\n }\r\n var uniforms = engine_1.getUniforms(_this._pipelineContext, _this._uniformsNames);\r\n uniforms.forEach(function (uniform, index) {\r\n _this._uniforms[_this._uniformsNames[index]] = uniform;\r\n });\r\n _this._attributes = engine_1.getAttributes(_this._pipelineContext, attributesNames);\r\n var index;\r\n for (index = 0; index < _this._samplerList.length; index++) {\r\n var sampler = _this.getUniform(_this._samplerList[index]);\r\n if (sampler == null) {\r\n _this._samplerList.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n _this._samplerList.forEach(function (name, index) {\r\n _this._samplers[name] = index;\r\n });\r\n engine_1.bindSamplers(_this);\r\n _this._compilationError = \"\";\r\n _this._isReady = true;\r\n if (_this.onCompiled) {\r\n _this.onCompiled(_this);\r\n }\r\n _this.onCompileObservable.notifyObservers(_this);\r\n _this.onCompileObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (_this._fallbacks) {\r\n _this._fallbacks.unBindMesh();\r\n }\r\n if (previousPipelineContext) {\r\n _this.getEngine()._deletePipelineContext(previousPipelineContext);\r\n }\r\n });\r\n if (this._pipelineContext.isAsync) {\r\n this._checkIsReady();\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n }\r\n };\r\n Effect.prototype._processCompilationErrors = function (e, previousPipelineContext) {\r\n if (previousPipelineContext === void 0) { previousPipelineContext = null; }\r\n this._compilationError = e.message;\r\n var attributesNames = this._attributesNames;\r\n var fallbacks = this._fallbacks;\r\n // Let's go through fallbacks then\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Unable to compile effect:\");\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Uniforms: \" + this._uniformsNames.map(function (uniform) {\r\n return \" \" + uniform;\r\n }));\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Attributes: \" + attributesNames.map(function (attribute) {\r\n return \" \" + attribute;\r\n }));\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Defines:\\r\\n\" + this.defines);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Error: \" + this._compilationError);\r\n if (previousPipelineContext) {\r\n this._pipelineContext = previousPipelineContext;\r\n this._isReady = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n }\r\n if (fallbacks) {\r\n this._pipelineContext = null;\r\n if (fallbacks.hasMoreFallbacks) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Trying next fallback.\");\r\n this.defines = fallbacks.reduce(this.defines, this);\r\n this._prepareEffect();\r\n }\r\n else { // Sorry we did everything we can\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n this.onErrorObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n }\r\n }\r\n };\r\n Object.defineProperty(Effect.prototype, \"isSupported\", {\r\n /**\r\n * Checks if the effect is supported. (Must be called after compilation)\r\n */\r\n get: function () {\r\n return this._compilationError === \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Binds a texture to the engine to be used as output of the shader.\r\n * @param channel Name of the output variable.\r\n * @param texture Texture to bind.\r\n * @hidden\r\n */\r\n Effect.prototype._bindTexture = function (channel, texture) {\r\n this._engine._bindTexture(this._samplers[channel], texture);\r\n };\r\n /**\r\n * Sets a texture on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setTexture = function (channel, texture) {\r\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setDepthStencilTexture = function (channel, texture) {\r\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets an array of textures on the engine to be used in the shader.\r\n * @param channel Name of the variable.\r\n * @param textures Textures to set.\r\n */\r\n Effect.prototype.setTextureArray = function (channel, textures) {\r\n var exName = channel + \"Ex\";\r\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\r\n var initialPos = this._samplerList.indexOf(channel);\r\n for (var index = 1; index < textures.length; index++) {\r\n var currentExName = exName + (index - 1).toString();\r\n this._samplerList.splice(initialPos + index, 0, currentExName);\r\n }\r\n // Reset every channels\r\n var channelIndex = 0;\r\n for (var _i = 0, _a = this._samplerList; _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n this._samplers[key] = channelIndex;\r\n channelIndex += 1;\r\n }\r\n }\r\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures);\r\n };\r\n /**\r\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the input texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess);\r\n };\r\n /**\r\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\r\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the output texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess);\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheMatrix = function (uniformName, matrix) {\r\n var cache = this._valueCache[uniformName];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[uniformName] = flag;\r\n return true;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat2 = function (uniformName, x, y) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat3 = function (uniformName, x, y, z) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y, z];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat4 = function (uniformName, x, y, z, w) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y, z, w];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n if (cache[3] !== w) {\r\n cache[3] = w;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /**\r\n * Binds a buffer to a uniform.\r\n * @param buffer Buffer to bind.\r\n * @param name Name of the uniform variable to bind to.\r\n */\r\n Effect.prototype.bindUniformBuffer = function (buffer, name) {\r\n var bufferName = this._uniformBuffersNames[name];\r\n if (bufferName === undefined || Effect._baseCache[bufferName] === buffer) {\r\n return;\r\n }\r\n Effect._baseCache[bufferName] = buffer;\r\n this._engine.bindUniformBufferBase(buffer, bufferName);\r\n };\r\n /**\r\n * Binds block to a uniform.\r\n * @param blockName Name of the block to bind.\r\n * @param index Index to bind.\r\n */\r\n Effect.prototype.bindUniformBlock = function (blockName, index) {\r\n this._engine.bindUniformBlock(this._pipelineContext, blockName, index);\r\n };\r\n /**\r\n * Sets an interger value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setInt = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = value;\r\n this._engine.setInt(this._uniforms[uniformName], value);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets matrices on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrices matrices to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrices = function (uniformName, matrices) {\r\n if (!matrices) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrices(this._uniforms[uniformName], matrices);\r\n return this;\r\n };\r\n /**\r\n * Sets matrix on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix = function (uniformName, matrix) {\r\n if (this._cacheMatrix(uniformName, matrix)) {\r\n this._engine.setMatrices(this._uniforms[uniformName], matrix.toArray());\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a 3x3 matrix on a uniform variable. (Speicified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix3x3 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix3x3(this._uniforms[uniformName], matrix);\r\n return this;\r\n };\r\n /**\r\n * Sets a 2x2 matrix on a uniform variable. (Speicified as [1,2,3,4] will result in [1,2][3,4] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix2x2 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix2x2(this._uniforms[uniformName], matrix);\r\n return this;\r\n };\r\n /**\r\n * Sets a float on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = value;\r\n this._engine.setFloat(this._uniforms[uniformName], value);\r\n return this;\r\n };\r\n /**\r\n * Sets a boolean on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param bool value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setBool = function (uniformName, bool) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === bool) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = bool;\r\n this._engine.setBool(this._uniforms[uniformName], bool ? 1 : 0);\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector2 vector2 to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector2 = function (uniformName, vector2) {\r\n if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {\r\n this._engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float2.\r\n * @param y Second float in float2.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat2 = function (uniformName, x, y) {\r\n if (this._cacheFloat2(uniformName, x, y)) {\r\n this._engine.setFloat2(this._uniforms[uniformName], x, y);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector3 = function (uniformName, vector3) {\r\n if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float3.\r\n * @param y Second float in float3.\r\n * @param z Third float in float3.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat3 = function (uniformName, x, y, z) {\r\n if (this._cacheFloat3(uniformName, x, y, z)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], x, y, z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector4 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector4 = function (uniformName, vector4) {\r\n if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float4.\r\n * @param y Second float in float4.\r\n * @param z Third float in float4.\r\n * @param w Fourth float in float4.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat4 = function (uniformName, x, y, z, w) {\r\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], x, y, z, w);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor3 = function (uniformName, color3) {\r\n if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @param alpha Alpha value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor4 = function (uniformName, color3, alpha) {\r\n if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniformName defines the name of the variable\r\n * @param color4 defines the value to be set\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setDirectColor4 = function (uniformName, color4) {\r\n if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {\r\n this._engine.setDirectColor4(this._uniforms[uniformName], color4);\r\n }\r\n return this;\r\n };\r\n /** Release all associated resources */\r\n Effect.prototype.dispose = function () {\r\n this._engine._releaseEffect(this);\r\n };\r\n /**\r\n * This function will add a new shader to the shader store\r\n * @param name the name of the shader\r\n * @param pixelShader optional pixel shader content\r\n * @param vertexShader optional vertex shader content\r\n */\r\n Effect.RegisterShader = function (name, pixelShader, vertexShader) {\r\n if (pixelShader) {\r\n Effect.ShadersStore[name + \"PixelShader\"] = pixelShader;\r\n }\r\n if (vertexShader) {\r\n Effect.ShadersStore[name + \"VertexShader\"] = vertexShader;\r\n }\r\n };\r\n /**\r\n * Resets the cache of effects.\r\n */\r\n Effect.ResetCache = function () {\r\n Effect._baseCache = {};\r\n };\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n Effect.ShadersRepository = \"src/Shaders/\";\r\n Effect._uniqueIdSeed = 0;\r\n Effect._baseCache = {};\r\n /**\r\n * Store of each shader (The can be looked up using effect.key)\r\n */\r\n Effect.ShadersStore = {};\r\n /**\r\n * Store of each included file for a shader (The can be looked up using effect.key)\r\n */\r\n Effect.IncludesShadersStore = {};\r\n return Effect;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/effectRenderer.ts\":\n/*!*************************************!*\\\n !*** ./Materials/effectRenderer.ts ***!\n \\*************************************/\n/*! exports provided: EffectRenderer, EffectWrapper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return EffectRenderer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return EffectWrapper; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Shaders_postprocess_vertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/postprocess.vertex */ \"./Shaders/postprocess.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Prevents ES6 Crash if not imported.\r\n\r\n/**\r\n * Helper class to render one or more effects\r\n */\r\nvar EffectRenderer = /** @class */ (function () {\r\n /**\r\n * Creates an effect renderer\r\n * @param engine the engine to use for rendering\r\n * @param options defines the options of the effect renderer\r\n */\r\n function EffectRenderer(engine, options) {\r\n var _a;\r\n if (options === void 0) { options = EffectRenderer._DefaultOptions; }\r\n this.engine = engine;\r\n this._ringBufferIndex = 0;\r\n this._ringScreenBuffer = null;\r\n this._fullscreenViewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_3__[\"Viewport\"](0, 0, 1, 1);\r\n options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, EffectRenderer._DefaultOptions, options);\r\n this._vertexBuffers = (_a = {},\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"](engine, options.positions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, false, false, 2),\r\n _a);\r\n this._indexBuffer = engine.createIndexBuffer(options.indices);\r\n // No need here for full screen render.\r\n engine.setDepthBuffer(false);\r\n engine.setStencilBuffer(false);\r\n }\r\n EffectRenderer.prototype._getNextFrameBuffer = function (incrementIndex) {\r\n if (incrementIndex === void 0) { incrementIndex = true; }\r\n if (!this._ringScreenBuffer) {\r\n this._ringScreenBuffer = [];\r\n for (var i = 0; i < 2; i++) {\r\n var internalTexture = this.engine.createRenderTargetTexture({\r\n width: this.engine.getRenderWidth(true),\r\n height: this.engine.getRenderHeight(true),\r\n }, {\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n generateMipMaps: false,\r\n samplingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURE_NEAREST_NEAREST,\r\n });\r\n var texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](\"\", null);\r\n texture._texture = internalTexture;\r\n this._ringScreenBuffer.push(texture);\r\n }\r\n }\r\n var ret = this._ringScreenBuffer[this._ringBufferIndex];\r\n if (incrementIndex) {\r\n this._ringBufferIndex = (this._ringBufferIndex + 1) % 2;\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Sets the current viewport in normalized coordinates 0-1\r\n * @param viewport Defines the viewport to set (defaults to 0 0 1 1)\r\n */\r\n EffectRenderer.prototype.setViewport = function (viewport) {\r\n if (viewport === void 0) { viewport = this._fullscreenViewport; }\r\n this.engine.setViewport(viewport);\r\n };\r\n /**\r\n * Binds the embedded attributes buffer to the effect.\r\n * @param effect Defines the effect to bind the attributes for\r\n */\r\n EffectRenderer.prototype.bindBuffers = function (effect) {\r\n this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n };\r\n /**\r\n * Sets the current effect wrapper to use during draw.\r\n * The effect needs to be ready before calling this api.\r\n * This also sets the default full screen position attribute.\r\n * @param effectWrapper Defines the effect to draw with\r\n */\r\n EffectRenderer.prototype.applyEffectWrapper = function (effectWrapper) {\r\n this.engine.enableEffect(effectWrapper.effect);\r\n this.bindBuffers(effectWrapper.effect);\r\n effectWrapper.onApplyObservable.notifyObservers({});\r\n };\r\n /**\r\n * Draws a full screen quad.\r\n */\r\n EffectRenderer.prototype.draw = function () {\r\n this.engine.drawElementsType(_Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_TriangleFillMode, 0, 6);\r\n };\r\n /**\r\n * renders one or more effects to a specified texture\r\n * @param effectWrappers list of effects to renderer\r\n * @param outputTexture texture to draw to, if null it will render to the screen\r\n */\r\n EffectRenderer.prototype.render = function (effectWrappers, outputTexture) {\r\n var _this = this;\r\n if (outputTexture === void 0) { outputTexture = null; }\r\n if (!Array.isArray(effectWrappers)) {\r\n effectWrappers = [effectWrappers];\r\n }\r\n // Ensure all effects are ready\r\n for (var _i = 0, effectWrappers_1 = effectWrappers; _i < effectWrappers_1.length; _i++) {\r\n var wrapper = effectWrappers_1[_i];\r\n if (!wrapper.effect.isReady()) {\r\n return;\r\n }\r\n }\r\n effectWrappers.forEach(function (effectWrapper, i) {\r\n var renderTo = outputTexture;\r\n // for any next effect make it's input the output of the previous effect\r\n if (i !== 0) {\r\n effectWrapper.effect.onBindObservable.addOnce(function () {\r\n effectWrapper.effect.setTexture(\"textureSampler\", _this._getNextFrameBuffer(false));\r\n });\r\n }\r\n // Set the output to the next screenbuffer\r\n if (effectWrappers.length > 1 && i != effectWrappers.length - 1) {\r\n renderTo = _this._getNextFrameBuffer();\r\n }\r\n else {\r\n renderTo = outputTexture;\r\n }\r\n // Reset state\r\n _this.setViewport();\r\n _this.applyEffectWrapper(effectWrapper);\r\n if (renderTo) {\r\n _this.engine.bindFramebuffer(renderTo.getInternalTexture());\r\n }\r\n _this.draw();\r\n if (renderTo) {\r\n _this.engine.unBindFramebuffer(renderTo.getInternalTexture());\r\n }\r\n });\r\n };\r\n /**\r\n * Disposes of the effect renderer\r\n */\r\n EffectRenderer.prototype.dispose = function () {\r\n if (this._ringScreenBuffer) {\r\n this._ringScreenBuffer.forEach(function (b) {\r\n b.dispose();\r\n });\r\n this._ringScreenBuffer = null;\r\n }\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n delete this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind];\r\n }\r\n if (this._indexBuffer) {\r\n this.engine._releaseBuffer(this._indexBuffer);\r\n }\r\n };\r\n // Fullscreen quad buffers by default.\r\n EffectRenderer._DefaultOptions = {\r\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\r\n indices: [0, 1, 2, 0, 2, 3]\r\n };\r\n return EffectRenderer;\r\n}());\r\n\r\n/**\r\n * Wraps an effect to be used for rendering\r\n */\r\nvar EffectWrapper = /** @class */ (function () {\r\n /**\r\n * Creates an effect to be renderer\r\n * @param creationOptions options to create the effect\r\n */\r\n function EffectWrapper(creationOptions) {\r\n var _this = this;\r\n /**\r\n * Event that is fired right before the effect is drawn (should be used to update uniforms)\r\n */\r\n this.onApplyObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_5__[\"Observable\"]();\r\n var effectCreationOptions;\r\n var uniformNames = creationOptions.uniformNames || [];\r\n if (creationOptions.vertexShader) {\r\n effectCreationOptions = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertexSource: creationOptions.vertexShader,\r\n spectorName: creationOptions.name || \"effectWrapper\"\r\n };\r\n }\r\n else {\r\n // Default scale to use in post process vertex shader.\r\n uniformNames.push(\"scale\");\r\n effectCreationOptions = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertex: \"postprocess\",\r\n spectorName: creationOptions.name || \"effectWrapper\"\r\n };\r\n // Sets the default scale to identity for the post process vertex shader.\r\n this.onApplyObservable.add(function () {\r\n _this.effect.setFloat2(\"scale\", 1, 1);\r\n });\r\n }\r\n this.effect = new _effect__WEBPACK_IMPORTED_MODULE_6__[\"Effect\"](effectCreationOptions, creationOptions.attributeNames || [\"position\"], uniformNames, creationOptions.samplerNames, creationOptions.engine);\r\n }\r\n /**\r\n * Disposes of the effect wrapper\r\n */\r\n EffectWrapper.prototype.dispose = function () {\r\n this.effect.dispose();\r\n };\r\n return EffectWrapper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/fresnelParameters.ts\":\n/*!****************************************!*\\\n !*** ./Materials/fresnelParameters.ts ***!\n \\****************************************/\n/*! exports provided: FresnelParameters */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return FresnelParameters; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents all the required information to add a fresnel effect on a material:\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_fresnelparameters\r\n */\r\nvar FresnelParameters = /** @class */ (function () {\r\n function FresnelParameters() {\r\n this._isEnabled = true;\r\n /**\r\n * Define the color used on edges (grazing angle)\r\n */\r\n this.leftColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].White();\r\n /**\r\n * Define the color used on center\r\n */\r\n this.rightColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].Black();\r\n /**\r\n * Define bias applied to computed fresnel term\r\n */\r\n this.bias = 0;\r\n /**\r\n * Defined the power exponent applied to fresnel term\r\n */\r\n this.power = 1;\r\n }\r\n Object.defineProperty(FresnelParameters.prototype, \"isEnabled\", {\r\n /**\r\n * Define if the fresnel effect is enable or not.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_FresnelDirtyFlag | _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clones the current fresnel and its valuues\r\n * @returns a clone fresnel configuration\r\n */\r\n FresnelParameters.prototype.clone = function () {\r\n var newFresnelParameters = new FresnelParameters();\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newFresnelParameters);\r\n return newFresnelParameters;\r\n };\r\n /**\r\n * Serializes the current fresnel parameters to a JSON representation.\r\n * @return the JSON serialization\r\n */\r\n FresnelParameters.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.isEnabled = this.isEnabled;\r\n serializationObject.leftColor = this.leftColor.asArray();\r\n serializationObject.rightColor = this.rightColor.asArray();\r\n serializationObject.bias = this.bias;\r\n serializationObject.power = this.power;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse a JSON object and deserialize it to a new Fresnel parameter object.\r\n * @param parsedFresnelParameters Define the JSON representation\r\n * @returns the parsed parameters\r\n */\r\n FresnelParameters.Parse = function (parsedFresnelParameters) {\r\n var fresnelParameters = new FresnelParameters();\r\n fresnelParameters.isEnabled = parsedFresnelParameters.isEnabled;\r\n fresnelParameters.leftColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].FromArray(parsedFresnelParameters.leftColor);\r\n fresnelParameters.rightColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].FromArray(parsedFresnelParameters.rightColor);\r\n fresnelParameters.bias = parsedFresnelParameters.bias;\r\n fresnelParameters.power = parsedFresnelParameters.power || 1.0;\r\n return fresnelParameters;\r\n };\r\n return FresnelParameters;\r\n}());\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"]._FresnelParametersParser = FresnelParameters.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/imageProcessingConfiguration.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/imageProcessingConfiguration.ts ***!\n \\***************************************************/\n/*! exports provided: ImageProcessingConfigurationDefines, ImageProcessingConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return ImageProcessingConfigurationDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return ImageProcessingConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/colorCurves */ \"./Materials/colorCurves.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar ImageProcessingConfigurationDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageProcessingConfigurationDefines, _super);\r\n function ImageProcessingConfigurationDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n return ImageProcessingConfigurationDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_5__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * This groups together the common properties used for image processing either in direct forward pass\r\n * or through post processing effect depending on the use of the image processing pipeline in your scene\r\n * or not.\r\n */\r\nvar ImageProcessingConfiguration = /** @class */ (function () {\r\n function ImageProcessingConfiguration() {\r\n /**\r\n * Color curves setup used in the effect if colorCurvesEnabled is set to true\r\n */\r\n this.colorCurves = new _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__[\"ColorCurves\"]();\r\n this._colorCurvesEnabled = false;\r\n this._colorGradingEnabled = false;\r\n this._colorGradingWithGreenDepth = true;\r\n this._colorGradingBGR = true;\r\n /** @hidden */\r\n this._exposure = 1.0;\r\n this._toneMappingEnabled = false;\r\n this._toneMappingType = ImageProcessingConfiguration.TONEMAPPING_STANDARD;\r\n this._contrast = 1.0;\r\n /**\r\n * Vignette stretch size.\r\n */\r\n this.vignetteStretch = 0;\r\n /**\r\n * Vignette centre X Offset.\r\n */\r\n this.vignetteCentreX = 0;\r\n /**\r\n * Vignette centre Y Offset.\r\n */\r\n this.vignetteCentreY = 0;\r\n /**\r\n * Vignette weight or intensity of the vignette effect.\r\n */\r\n this.vignetteWeight = 1.5;\r\n /**\r\n * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n this.vignetteColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * Camera field of view used by the Vignette effect.\r\n */\r\n this.vignetteCameraFov = 0.5;\r\n this._vignetteBlendMode = ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;\r\n this._vignetteEnabled = false;\r\n this._applyByPostProcess = false;\r\n this._isEnabled = true;\r\n /**\r\n * An event triggered when the configuration changes and requires Shader to Update some parameters.\r\n */\r\n this.onUpdateParameters = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n }\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorCurvesEnabled === value) {\r\n return;\r\n }\r\n this._colorCurvesEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingTexture\", {\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n get: function () {\r\n return this._colorGradingTexture;\r\n },\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n set: function (value) {\r\n if (this._colorGradingTexture === value) {\r\n return;\r\n }\r\n this._colorGradingTexture = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorGradingEnabled;\r\n },\r\n /**\r\n * Sets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingEnabled === value) {\r\n return;\r\n }\r\n this._colorGradingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingWithGreenDepth\", {\r\n /**\r\n * Gets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n get: function () {\r\n return this._colorGradingWithGreenDepth;\r\n },\r\n /**\r\n * Sets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingWithGreenDepth === value) {\r\n return;\r\n }\r\n this._colorGradingWithGreenDepth = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingBGR\", {\r\n /**\r\n * Gets wether the color grading texture contains BGR values.\r\n */\r\n get: function () {\r\n return this._colorGradingBGR;\r\n },\r\n /**\r\n * Sets wether the color grading texture contains BGR values.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingBGR === value) {\r\n return;\r\n }\r\n this._colorGradingBGR = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"exposure\", {\r\n /**\r\n * Gets the Exposure used in the effect.\r\n */\r\n get: function () {\r\n return this._exposure;\r\n },\r\n /**\r\n * Sets the Exposure used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._exposure === value) {\r\n return;\r\n }\r\n this._exposure = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingEnabled\", {\r\n /**\r\n * Gets wether the tone mapping effect is enabled.\r\n */\r\n get: function () {\r\n return this._toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether the tone mapping effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingEnabled === value) {\r\n return;\r\n }\r\n this._toneMappingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingType\", {\r\n /**\r\n * Gets the type of tone mapping effect.\r\n */\r\n get: function () {\r\n return this._toneMappingType;\r\n },\r\n /**\r\n * Sets the type of tone mapping effect used in BabylonJS.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingType === value) {\r\n return;\r\n }\r\n this._toneMappingType = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"contrast\", {\r\n /**\r\n * Gets the contrast used in the effect.\r\n */\r\n get: function () {\r\n return this._contrast;\r\n },\r\n /**\r\n * Sets the contrast used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._contrast === value) {\r\n return;\r\n }\r\n this._contrast = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteBlendMode\", {\r\n /**\r\n * Gets the vignette blend mode allowing different kind of effect.\r\n */\r\n get: function () {\r\n return this._vignetteBlendMode;\r\n },\r\n /**\r\n * Sets the vignette blend mode allowing different kind of effect.\r\n */\r\n set: function (value) {\r\n if (this._vignetteBlendMode === value) {\r\n return;\r\n }\r\n this._vignetteBlendMode = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteEnabled\", {\r\n /**\r\n * Gets wether the vignette effect is enabled.\r\n */\r\n get: function () {\r\n return this._vignetteEnabled;\r\n },\r\n /**\r\n * Sets wether the vignette effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._vignetteEnabled === value) {\r\n return;\r\n }\r\n this._vignetteEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"applyByPostProcess\", {\r\n /**\r\n * Gets wether the image processing is applied through a post process or not.\r\n */\r\n get: function () {\r\n return this._applyByPostProcess;\r\n },\r\n /**\r\n * Sets wether the image processing is applied through a post process or not.\r\n */\r\n set: function (value) {\r\n if (this._applyByPostProcess === value) {\r\n return;\r\n }\r\n this._applyByPostProcess = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"isEnabled\", {\r\n /**\r\n * Gets wether the image processing is enabled or not.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * Sets wether the image processing is enabled or not.\r\n */\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Method called each time the image processing information changes requires to recompile the effect.\r\n */\r\n ImageProcessingConfiguration.prototype._updateParameters = function () {\r\n this.onUpdateParameters.notifyObservers(this);\r\n };\r\n /**\r\n * Gets the current class name.\r\n * @return \"ImageProcessingConfiguration\"\r\n */\r\n ImageProcessingConfiguration.prototype.getClassName = function () {\r\n return \"ImageProcessingConfiguration\";\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the Image Processing effects.\r\n * @param uniforms The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareUniforms = function (uniforms, defines) {\r\n if (defines.EXPOSURE) {\r\n uniforms.push(\"exposureLinear\");\r\n }\r\n if (defines.CONTRAST) {\r\n uniforms.push(\"contrast\");\r\n }\r\n if (defines.COLORGRADING) {\r\n uniforms.push(\"colorTransformSettings\");\r\n }\r\n if (defines.VIGNETTE) {\r\n uniforms.push(\"vInverseScreenSize\");\r\n uniforms.push(\"vignetteSettings1\");\r\n uniforms.push(\"vignetteSettings2\");\r\n }\r\n if (defines.COLORCURVES) {\r\n _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__[\"ColorCurves\"].PrepareUniforms(uniforms);\r\n }\r\n };\r\n /**\r\n * Prepare the list of samplers associated with the Image Processing effects.\r\n * @param samplersList The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareSamplers = function (samplersList, defines) {\r\n if (defines.COLORGRADING) {\r\n samplersList.push(\"txColorTransform\");\r\n }\r\n };\r\n /**\r\n * Prepare the list of defines associated to the shader.\r\n * @param defines the list of defines to complete\r\n * @param forPostProcess Define if we are currently in post process mode or not\r\n */\r\n ImageProcessingConfiguration.prototype.prepareDefines = function (defines, forPostProcess) {\r\n if (forPostProcess === void 0) { forPostProcess = false; }\r\n if (forPostProcess !== this.applyByPostProcess || !this._isEnabled) {\r\n defines.VIGNETTE = false;\r\n defines.TONEMAPPING = false;\r\n defines.TONEMAPPING_ACES = false;\r\n defines.CONTRAST = false;\r\n defines.EXPOSURE = false;\r\n defines.COLORCURVES = false;\r\n defines.COLORGRADING = false;\r\n defines.COLORGRADING3D = false;\r\n defines.IMAGEPROCESSING = false;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess && this._isEnabled;\r\n return;\r\n }\r\n defines.VIGNETTE = this.vignetteEnabled;\r\n defines.VIGNETTEBLENDMODEMULTIPLY = (this.vignetteBlendMode === ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY);\r\n defines.VIGNETTEBLENDMODEOPAQUE = !defines.VIGNETTEBLENDMODEMULTIPLY;\r\n defines.TONEMAPPING = this.toneMappingEnabled;\r\n switch (this._toneMappingType) {\r\n case ImageProcessingConfiguration.TONEMAPPING_ACES:\r\n defines.TONEMAPPING_ACES = true;\r\n break;\r\n default:\r\n defines.TONEMAPPING_ACES = false;\r\n break;\r\n }\r\n defines.CONTRAST = (this.contrast !== 1.0);\r\n defines.EXPOSURE = (this.exposure !== 1.0);\r\n defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);\r\n defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);\r\n if (defines.COLORGRADING) {\r\n defines.COLORGRADING3D = this.colorGradingTexture.is3D;\r\n }\r\n else {\r\n defines.COLORGRADING3D = false;\r\n }\r\n defines.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth;\r\n defines.SAMPLER3DBGRMAP = this.colorGradingBGR;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess;\r\n defines.IMAGEPROCESSING = defines.VIGNETTE || defines.TONEMAPPING || defines.CONTRAST || defines.EXPOSURE || defines.COLORCURVES || defines.COLORGRADING;\r\n };\r\n /**\r\n * Returns true if all the image processing information are ready.\r\n * @returns True if ready, otherwise, false\r\n */\r\n ImageProcessingConfiguration.prototype.isReady = function () {\r\n // Color Grading texure can not be none blocking.\r\n return !this.colorGradingEnabled || !this.colorGradingTexture || this.colorGradingTexture.isReady();\r\n };\r\n /**\r\n * Binds the image processing to the shader.\r\n * @param effect The effect to bind to\r\n * @param aspectRatio Define the current aspect ratio of the effect\r\n */\r\n ImageProcessingConfiguration.prototype.bind = function (effect, aspectRatio) {\r\n if (aspectRatio === void 0) { aspectRatio = 1; }\r\n // Color Curves\r\n if (this._colorCurvesEnabled && this.colorCurves) {\r\n _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__[\"ColorCurves\"].Bind(this.colorCurves, effect);\r\n }\r\n // Vignette\r\n if (this._vignetteEnabled) {\r\n var inverseWidth = 1 / effect.getEngine().getRenderWidth();\r\n var inverseHeight = 1 / effect.getEngine().getRenderHeight();\r\n effect.setFloat2(\"vInverseScreenSize\", inverseWidth, inverseHeight);\r\n var vignetteScaleY = Math.tan(this.vignetteCameraFov * 0.5);\r\n var vignetteScaleX = vignetteScaleY * aspectRatio;\r\n var vignetteScaleGeometricMean = Math.sqrt(vignetteScaleX * vignetteScaleY);\r\n vignetteScaleX = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].Mix(vignetteScaleX, vignetteScaleGeometricMean, this.vignetteStretch);\r\n vignetteScaleY = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].Mix(vignetteScaleY, vignetteScaleGeometricMean, this.vignetteStretch);\r\n effect.setFloat4(\"vignetteSettings1\", vignetteScaleX, vignetteScaleY, -vignetteScaleX * this.vignetteCentreX, -vignetteScaleY * this.vignetteCentreY);\r\n var vignettePower = -2.0 * this.vignetteWeight;\r\n effect.setFloat4(\"vignetteSettings2\", this.vignetteColor.r, this.vignetteColor.g, this.vignetteColor.b, vignettePower);\r\n }\r\n // Exposure\r\n effect.setFloat(\"exposureLinear\", this.exposure);\r\n // Contrast\r\n effect.setFloat(\"contrast\", this.contrast);\r\n // Color transform settings\r\n if (this.colorGradingTexture) {\r\n effect.setTexture(\"txColorTransform\", this.colorGradingTexture);\r\n var textureSize = this.colorGradingTexture.getSize().height;\r\n effect.setFloat4(\"colorTransformSettings\", (textureSize - 1) / textureSize, // textureScale\r\n 0.5 / textureSize, // textureOffset\r\n textureSize, // textureSize\r\n this.colorGradingTexture.level // weight\r\n );\r\n }\r\n };\r\n /**\r\n * Clones the current image processing instance.\r\n * @return The cloned image processing\r\n */\r\n ImageProcessingConfiguration.prototype.clone = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new ImageProcessingConfiguration(); }, this);\r\n };\r\n /**\r\n * Serializes the current image processing instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ImageProcessingConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses the image processing from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed image processing\r\n */\r\n ImageProcessingConfiguration.Parse = function (source) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new ImageProcessingConfiguration(); }, source, null, null);\r\n };\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_MULTIPLY\", {\r\n /**\r\n * Used to apply the vignette as a mix with the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_MULTIPLY;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_OPAQUE\", {\r\n /**\r\n * Used to apply the vignette as a replacement of the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_OPAQUE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Default tone mapping applied in BabylonJS.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_STANDARD = 0;\r\n /**\r\n * ACES Tone mapping (used by default in unreal and unity). This can help getting closer\r\n * to other engines rendering to increase portability.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_ACES = 1;\r\n // Static constants associated to the image processing.\r\n ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY = 0;\r\n ImageProcessingConfiguration._VIGNETTEMODE_OPAQUE = 1;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColorCurves\"])()\r\n ], ImageProcessingConfiguration.prototype, \"colorCurves\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorCurvesEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"colorGradingTexture\")\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingWithGreenDepth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingBGR\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_exposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingType\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_contrast\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteStretch\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteWeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor4\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCameraFov\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteBlendMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_applyByPostProcess\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_isEnabled\", void 0);\r\n return ImageProcessingConfiguration;\r\n}());\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"]._ImageProcessingConfigurationParser = ImageProcessingConfiguration.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/index.ts\":\n/*!****************************!*\\\n !*** ./Materials/index.ts ***!\n \\****************************/\n/*! exports provided: ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Background_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Background/index */ \"./Materials/Background/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _Background_index__WEBPACK_IMPORTED_MODULE_0__[\"BackgroundMaterial\"]; });\n\n/* harmony import */ var _colorCurves__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colorCurves */ \"./Materials/colorCurves.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return _colorCurves__WEBPACK_IMPORTED_MODULE_1__[\"ColorCurves\"]; });\n\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return _effect__WEBPACK_IMPORTED_MODULE_2__[\"EffectFallbacks\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return _effect__WEBPACK_IMPORTED_MODULE_2__[\"EffectCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return _effect__WEBPACK_IMPORTED_MODULE_2__[\"Effect\"]; });\n\n/* harmony import */ var _fresnelParameters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fresnelParameters */ \"./Materials/fresnelParameters.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return _fresnelParameters__WEBPACK_IMPORTED_MODULE_3__[\"FresnelParameters\"]; });\n\n/* harmony import */ var _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_4__[\"ImageProcessingConfigurationDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_4__[\"ImageProcessingConfiguration\"]; });\n\n/* harmony import */ var _material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./material */ \"./Materials/material.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return _material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"]; });\n\n/* harmony import */ var _materialDefines__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return _materialDefines__WEBPACK_IMPORTED_MODULE_6__[\"MaterialDefines\"]; });\n\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return _materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"]; });\n\n/* harmony import */ var _multiMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return _multiMaterial__WEBPACK_IMPORTED_MODULE_8__[\"MultiMaterial\"]; });\n\n/* harmony import */ var _PBR_index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./PBR/index */ \"./Materials/PBR/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRBaseMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRSpecularGlossinessMaterial\"]; });\n\n/* harmony import */ var _pushMaterial__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return _pushMaterial__WEBPACK_IMPORTED_MODULE_10__[\"PushMaterial\"]; });\n\n/* harmony import */ var _shaderMaterial__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return _shaderMaterial__WEBPACK_IMPORTED_MODULE_11__[\"ShaderMaterial\"]; });\n\n/* harmony import */ var _standardMaterial__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return _standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return _standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterial\"]; });\n\n/* harmony import */ var _Textures_index__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Textures/index */ \"./Materials/Textures/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"BaseTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"CubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"DynamicTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"HDRCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"InternalTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"MirrorTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"MultiRenderTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RawTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RenderTargetTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"Texture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"ColorGradingTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RawCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RawTexture3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RefractionTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"VideoTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"HtmlElementTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_BasisTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony import */ var _uniformBuffer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return _uniformBuffer__WEBPACK_IMPORTED_MODULE_14__[\"UniformBuffer\"]; });\n\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return _materialFlags__WEBPACK_IMPORTED_MODULE_15__[\"MaterialFlags\"]; });\n\n/* harmony import */ var _Node_index__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Node/index */ \"./Materials/Node/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _effectRenderer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./effectRenderer */ \"./Materials/effectRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return _effectRenderer__WEBPACK_IMPORTED_MODULE_17__[\"EffectRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return _effectRenderer__WEBPACK_IMPORTED_MODULE_17__[\"EffectWrapper\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/material.ts\":\n/*!*******************************!*\\\n !*** ./Materials/material.ts ***!\n \\*******************************/\n/*! exports provided: Material */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return Material; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _uniformBuffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class for the main features of a material in Babylon.js\r\n */\r\nvar Material = /** @class */ (function () {\r\n /**\r\n * Creates a material instance\r\n * @param name defines the name of the material\r\n * @param scene defines the scene to reference\r\n * @param doNotAdd specifies if the material should be added to the scene\r\n */\r\n function Material(name, scene, doNotAdd) {\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n /**\r\n * Specifies if the ready state should be checked on each call\r\n */\r\n this.checkReadyOnEveryCall = false;\r\n /**\r\n * Specifies if the ready state should be checked once\r\n */\r\n this.checkReadyOnlyOnce = false;\r\n /**\r\n * The state of the material\r\n */\r\n this.state = \"\";\r\n /**\r\n * The alpha value of the material\r\n */\r\n this._alpha = 1.0;\r\n /**\r\n * Specifies if back face culling is enabled\r\n */\r\n this._backFaceCulling = true;\r\n /**\r\n * Callback triggered when the material is compiled\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback triggered when an error occurs\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback triggered to get the render target textures\r\n */\r\n this.getRenderTargetTextures = null;\r\n /**\r\n * Specifies if the material should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n /**\r\n * @hidden\r\n */\r\n this._storeEffectOnSubMeshes = false;\r\n /**\r\n * Stores the animations for the material\r\n */\r\n this.animations = null;\r\n /**\r\n * An event triggered when the material is disposed\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An observer which watches for dispose events\r\n */\r\n this._onDisposeObserver = null;\r\n this._onUnBindObservable = null;\r\n /**\r\n * An observer which watches for bind events\r\n */\r\n this._onBindObserver = null;\r\n /**\r\n * Stores the value of the alpha mode\r\n */\r\n this._alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_COMBINE;\r\n /**\r\n * Stores the state of the need depth pre-pass value\r\n */\r\n this._needDepthPrePass = false;\r\n /**\r\n * Specifies if depth writing should be disabled\r\n */\r\n this.disableDepthWrite = false;\r\n /**\r\n * Specifies if depth writing should be forced\r\n */\r\n this.forceDepthWrite = false;\r\n /**\r\n * Specifies if there should be a separate pass for culling\r\n */\r\n this.separateCullingPass = false;\r\n /**\r\n * Stores the state specifing if fog should be enabled\r\n */\r\n this._fogEnabled = true;\r\n /**\r\n * Stores the size of points\r\n */\r\n this.pointSize = 1.0;\r\n /**\r\n * Stores the z offset value\r\n */\r\n this.zOffset = 0;\r\n /**\r\n * @hidden\r\n * Stores the effects for the material\r\n */\r\n this._effect = null;\r\n /**\r\n * @hidden\r\n * Specifies if the material was previously ready\r\n */\r\n this._wasPreviouslyReady = false;\r\n /**\r\n * Specifies if uniform buffers should be used\r\n */\r\n this._useUBO = false;\r\n /**\r\n * Stores the fill mode state\r\n */\r\n this._fillMode = Material.TriangleFillMode;\r\n /**\r\n * Specifies if the depth write state should be cached\r\n */\r\n this._cachedDepthWriteState = false;\r\n /** @hidden */\r\n this._indexInSceneMaterialArray = -1;\r\n /** @hidden */\r\n this.meshMap = null;\r\n this.name = name;\r\n this.id = name || _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].RandomId();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene;\r\n this.uniqueId = this._scene.getUniqueId();\r\n if (this._scene.useRightHandedSystem) {\r\n this.sideOrientation = Material.ClockWiseSideOrientation;\r\n }\r\n else {\r\n this.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n }\r\n this._uniformBuffer = new _uniformBuffer__WEBPACK_IMPORTED_MODULE_6__[\"UniformBuffer\"](this._scene.getEngine());\r\n this._useUBO = this.getScene().getEngine().supportsUniformBuffers;\r\n if (!doNotAdd) {\r\n this._scene.addMaterial(this);\r\n }\r\n if (this._scene.useMaterialMeshMap) {\r\n this.meshMap = {};\r\n }\r\n }\r\n Object.defineProperty(Material.prototype, \"alpha\", {\r\n /**\r\n * Gets the alpha value of the material\r\n */\r\n get: function () {\r\n return this._alpha;\r\n },\r\n /**\r\n * Sets the alpha value of the material\r\n */\r\n set: function (value) {\r\n if (this._alpha === value) {\r\n return;\r\n }\r\n this._alpha = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"backFaceCulling\", {\r\n /**\r\n * Gets the back-face culling state\r\n */\r\n get: function () {\r\n return this._backFaceCulling;\r\n },\r\n /**\r\n * Sets the back-face culling state\r\n */\r\n set: function (value) {\r\n if (this._backFaceCulling === value) {\r\n return;\r\n }\r\n this._backFaceCulling = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onDispose\", {\r\n /**\r\n * Called during a dispose event\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBindObservable\", {\r\n /**\r\n * An event triggered when the material is bound\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBind\", {\r\n /**\r\n * Called during a bind event\r\n */\r\n set: function (callback) {\r\n if (this._onBindObserver) {\r\n this.onBindObservable.remove(this._onBindObserver);\r\n }\r\n this._onBindObserver = this.onBindObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onUnBindObservable\", {\r\n /**\r\n * An event triggered when the material is unbound\r\n */\r\n get: function () {\r\n if (!this._onUnBindObservable) {\r\n this._onUnBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n }\r\n return this._onUnBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"alphaMode\", {\r\n /**\r\n * Gets the value of the alpha mode\r\n */\r\n get: function () {\r\n return this._alphaMode;\r\n },\r\n /**\r\n * Sets the value of the alpha mode.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | ALPHA_DISABLE | |\r\n * | 1 | ALPHA_ADD | |\r\n * | 2 | ALPHA_COMBINE | |\r\n * | 3 | ALPHA_SUBTRACT | |\r\n * | 4 | ALPHA_MULTIPLY | |\r\n * | 5 | ALPHA_MAXIMIZED | |\r\n * | 6 | ALPHA_ONEONE | |\r\n * | 7 | ALPHA_PREMULTIPLIED | |\r\n * | 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |\r\n * | 9 | ALPHA_INTERPOLATE | |\r\n * | 10 | ALPHA_SCREENMODE | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._alphaMode === value) {\r\n return;\r\n }\r\n this._alphaMode = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"needDepthPrePass\", {\r\n /**\r\n * Gets the depth pre-pass value\r\n */\r\n get: function () {\r\n return this._needDepthPrePass;\r\n },\r\n /**\r\n * Sets the need depth pre-pass value\r\n */\r\n set: function (value) {\r\n if (this._needDepthPrePass === value) {\r\n return;\r\n }\r\n this._needDepthPrePass = value;\r\n if (this._needDepthPrePass) {\r\n this.checkReadyOnEveryCall = true;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fogEnabled\", {\r\n /**\r\n * Gets the value of the fog enabled state\r\n */\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Sets the state for enabling fog\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"wireframe\", {\r\n /**\r\n * Gets a value specifying if wireframe mode is enabled\r\n */\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.WireFrameFillMode:\r\n case Material.LineListDrawMode:\r\n case Material.LineLoopDrawMode:\r\n case Material.LineStripDrawMode:\r\n return true;\r\n }\r\n return this._scene.forceWireframe;\r\n },\r\n /**\r\n * Sets the state of wireframe mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.WireFrameFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"pointsCloud\", {\r\n /**\r\n * Gets the value specifying if point clouds are enabled\r\n */\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.PointFillMode:\r\n case Material.PointListDrawMode:\r\n return true;\r\n }\r\n return this._scene.forcePointsCloud;\r\n },\r\n /**\r\n * Sets the state of point cloud mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.PointFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fillMode\", {\r\n /**\r\n * Gets the material fill mode\r\n */\r\n get: function () {\r\n return this._fillMode;\r\n },\r\n /**\r\n * Sets the material fill mode\r\n */\r\n set: function (value) {\r\n if (this._fillMode === value) {\r\n return;\r\n }\r\n this._fillMode = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a string representation of the current material\r\n * @param fullDetails defines a boolean indicating which levels of logging is desired\r\n * @returns a string with material information\r\n */\r\n Material.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the class name of the material\r\n * @returns a string with the class name of the material\r\n */\r\n Material.prototype.getClassName = function () {\r\n return \"Material\";\r\n };\r\n Object.defineProperty(Material.prototype, \"isFrozen\", {\r\n /**\r\n * Specifies if updates for the material been locked\r\n */\r\n get: function () {\r\n return this.checkReadyOnlyOnce;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Locks updates for the material\r\n */\r\n Material.prototype.freeze = function () {\r\n this.checkReadyOnlyOnce = true;\r\n };\r\n /**\r\n * Unlocks updates for the material\r\n */\r\n Material.prototype.unfreeze = function () {\r\n this.checkReadyOnlyOnce = false;\r\n };\r\n /**\r\n * Specifies if the material is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param useInstances specifies if instances should be used\r\n * @returns a boolean indicating if the material is ready to be used\r\n */\r\n Material.prototype.isReady = function (mesh, useInstances) {\r\n return true;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n Material.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return false;\r\n };\r\n /**\r\n * Returns the material effect\r\n * @returns the effect associated with the material\r\n */\r\n Material.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * Returns the current scene\r\n * @returns a Scene\r\n */\r\n Material.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n Material.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0);\r\n };\r\n /**\r\n * Specifies if the mesh will require alpha blending\r\n * @param mesh defines the mesh to check\r\n * @returns a boolean specifying if alpha blending is needed for the mesh\r\n */\r\n Material.prototype.needAlphaBlendingForMesh = function (mesh) {\r\n return this.needAlphaBlending() || (mesh.visibility < 1.0) || mesh.hasVertexAlpha;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n Material.prototype.needAlphaTesting = function () {\r\n return false;\r\n };\r\n /**\r\n * Gets the texture used for the alpha test\r\n * @returns the texture to use for alpha testing\r\n */\r\n Material.prototype.getAlphaTestTexture = function () {\r\n return null;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n Material.prototype.markDirty = function () {\r\n this._wasPreviouslyReady = false;\r\n };\r\n /** @hidden */\r\n Material.prototype._preBind = function (effect, overrideOrientation) {\r\n if (overrideOrientation === void 0) { overrideOrientation = null; }\r\n var engine = this._scene.getEngine();\r\n var orientation = (overrideOrientation == null) ? this.sideOrientation : overrideOrientation;\r\n var reverse = orientation === Material.ClockWiseSideOrientation;\r\n engine.enableEffect(effect ? effect : this._effect);\r\n engine.setState(this.backFaceCulling, this.zOffset, false, reverse);\r\n return reverse;\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n */\r\n Material.prototype.bind = function (world, mesh) {\r\n };\r\n /**\r\n * Binds the submesh to the material\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n Material.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n Material.prototype.bindOnlyWorldMatrix = function (world) {\r\n };\r\n /**\r\n * Binds the scene's uniform buffer to the effect.\r\n * @param effect defines the effect to bind to the scene uniform buffer\r\n * @param sceneUbo defines the uniform buffer storing scene data\r\n */\r\n Material.prototype.bindSceneUniformBuffer = function (effect, sceneUbo) {\r\n sceneUbo.bindToEffect(effect, \"Scene\");\r\n };\r\n /**\r\n * Binds the view matrix to the effect\r\n * @param effect defines the effect to bind the view matrix to\r\n */\r\n Material.prototype.bindView = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Binds the view projection matrix to the effect\r\n * @param effect defines the effect to bind the view projection matrix to\r\n */\r\n Material.prototype.bindViewProjection = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Specifies if material alpha testing should be turned on for the mesh\r\n * @param mesh defines the mesh to check\r\n */\r\n Material.prototype._shouldTurnAlphaTestOn = function (mesh) {\r\n return (!this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting());\r\n };\r\n /**\r\n * Processes to execute after binding the material to a mesh\r\n * @param mesh defines the rendered mesh\r\n */\r\n Material.prototype._afterBind = function (mesh) {\r\n this._scene._cachedMaterial = this;\r\n if (mesh) {\r\n this._scene._cachedVisibility = mesh.visibility;\r\n }\r\n else {\r\n this._scene._cachedVisibility = 1;\r\n }\r\n if (this._onBindObservable && mesh) {\r\n this._onBindObservable.notifyObservers(mesh);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n this._cachedDepthWriteState = engine.getDepthWrite();\r\n engine.setDepthWrite(false);\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n Material.prototype.unbind = function () {\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.notifyObservers(this);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n engine.setDepthWrite(this._cachedDepthWriteState);\r\n }\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n Material.prototype.getActiveTextures = function () {\r\n return [];\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n Material.prototype.hasTexture = function (texture) {\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n Material.prototype.clone = function (name) {\r\n return null;\r\n };\r\n /**\r\n * Gets the meshes bound to the material\r\n * @returns an array of meshes bound to the material\r\n */\r\n Material.prototype.getBindedMeshes = function () {\r\n var _this = this;\r\n if (this.meshMap) {\r\n var result = new Array();\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n result.push(mesh);\r\n }\r\n }\r\n return result;\r\n }\r\n else {\r\n var meshes = this._scene.meshes;\r\n return meshes.filter(function (mesh) { return mesh.material === _this; });\r\n }\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh associated with this material\r\n * @param onCompiled defines a function to execute once the material is compiled\r\n * @param options defines the options to configure the compilation\r\n */\r\n Material.prototype.forceCompilation = function (mesh, onCompiled, options) {\r\n var _this = this;\r\n var localOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ clipPlane: false }, options);\r\n var subMesh = new _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_5__[\"BaseSubMesh\"]();\r\n var scene = this.getScene();\r\n var checkReady = function () {\r\n if (!_this._scene || !_this._scene.getEngine()) {\r\n return;\r\n }\r\n if (subMesh._materialDefines) {\r\n subMesh._materialDefines._renderId = -1;\r\n }\r\n var clipPlaneState = scene.clipPlane;\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_9__[\"Plane\"](0, 0, 0, 1);\r\n }\r\n if (_this._storeEffectOnSubMeshes) {\r\n if (_this.isReadyForSubMesh(mesh, subMesh)) {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n else {\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n else {\r\n if (_this.isReady()) {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n else {\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = clipPlaneState;\r\n }\r\n };\r\n checkReady();\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh that will use this material\r\n * @param options defines additional options for compiling the shaders\r\n * @returns a promise that resolves when the compilation completes\r\n */\r\n Material.prototype.forceCompilationAsync = function (mesh, options) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.forceCompilation(mesh, function () {\r\n resolve();\r\n }, options);\r\n });\r\n };\r\n /**\r\n * Marks a define in the material to indicate that it needs to be re-computed\r\n * @param flag defines a flag used to determine which parts of the material have to be marked as dirty\r\n */\r\n Material.prototype.markAsDirty = function (flag) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n Material._DirtyCallbackArray.length = 0;\r\n if (flag & Material.TextureDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._TextureDirtyCallBack);\r\n }\r\n if (flag & Material.LightDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._LightsDirtyCallBack);\r\n }\r\n if (flag & Material.FresnelDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._FresnelDirtyCallBack);\r\n }\r\n if (flag & Material.AttributesDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._AttributeDirtyCallBack);\r\n }\r\n if (flag & Material.MiscDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._MiscDirtyCallBack);\r\n }\r\n if (Material._DirtyCallbackArray.length) {\r\n this._markAllSubMeshesAsDirty(Material._RunDirtyCallBacks);\r\n }\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Marks all submeshes of a material to indicate that their material defines need to be re-calculated\r\n * @param func defines a function which checks material defines against the submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsDirty = function (func) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh._materialDefines) {\r\n continue;\r\n }\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /**\r\n * Indicates that we need to re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAllDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AllDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that image processing needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsImageProcessingDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._ImageProcessingDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that lights need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsLightsDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._LightsDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that attributes need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAttributesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AttributeDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that misc needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n var scene = this.getScene();\r\n // Animations\r\n scene.stopAnimation(this);\r\n scene.freeProcessedMaterials();\r\n // Remove from scene\r\n scene.removeMaterial(this);\r\n if (notBoundToMesh !== true) {\r\n // Remove from meshes\r\n if (this.meshMap) {\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n mesh.material = null; // will set the entry in the map to undefined\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n else {\r\n var meshes = scene.meshes;\r\n for (var _i = 0, meshes_2 = meshes; _i < meshes_2.length; _i++) {\r\n var mesh = meshes_2[_i];\r\n if (mesh.material === this && !mesh.sourceMesh) {\r\n mesh.material = null;\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n }\r\n this._uniformBuffer.dispose();\r\n // Shader are kept in cache for further use but we can get rid of this by using forceDisposeEffect\r\n if (forceDisposeEffect && this._effect) {\r\n if (!this._storeEffectOnSubMeshes) {\r\n this._effect.dispose();\r\n }\r\n this._effect = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n if (this._onBindObservable) {\r\n this._onBindObservable.clear();\r\n }\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.clear();\r\n }\r\n };\r\n /** @hidden */\r\n Material.prototype.releaseVertexArrayObject = function (mesh, forceDisposeEffect) {\r\n if (mesh.geometry) {\r\n var geometry = (mesh.geometry);\r\n if (this._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _a = mesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n geometry._releaseVertexArrayObject(subMesh._materialEffect);\r\n if (forceDisposeEffect && subMesh._materialEffect) {\r\n subMesh._materialEffect.dispose();\r\n }\r\n }\r\n }\r\n else {\r\n geometry._releaseVertexArrayObject(this._effect);\r\n }\r\n }\r\n };\r\n /**\r\n * Serializes this material\r\n * @returns the serialized material object\r\n */\r\n Material.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedMaterial defines parsed material data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new material\r\n */\r\n Material.Parse = function (parsedMaterial, scene, rootUrl) {\r\n if (!parsedMaterial.customType) {\r\n parsedMaterial.customType = \"BABYLON.StandardMaterial\";\r\n }\r\n else if (parsedMaterial.customType === \"BABYLON.PBRMaterial\" && parsedMaterial.overloadedAlbedo) {\r\n parsedMaterial.customType = \"BABYLON.LegacyPBRMaterial\";\r\n if (!BABYLON.LegacyPBRMaterial) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Error(\"Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library.\");\r\n return null;\r\n }\r\n }\r\n var materialType = _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Instantiate(parsedMaterial.customType);\r\n return materialType.Parse(parsedMaterial, scene, rootUrl);\r\n };\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Material.TriangleFillMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Material.WireFrameFillMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Material.PointFillMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointFillMode;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Material.PointListDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointListDrawMode;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Material.LineListDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineListDrawMode;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Material.LineLoopDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineLoopDrawMode;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Material.LineStripDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineStripDrawMode;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Material.TriangleStripDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleStripDrawMode;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Material.TriangleFanDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFanDrawMode;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Material.ClockWiseSideOrientation = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_ClockWiseSideOrientation;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Material.CounterClockWiseSideOrientation = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_CounterClockWiseSideOrientation;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Material.TextureDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TextureDirtyFlag;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Material.LightDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LightDirtyFlag;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Material.FresnelDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_FresnelDirtyFlag;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Material.AttributesDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_AttributesDirtyFlag;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Material.MiscDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_MiscDirtyFlag;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Material.AllDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_AllDirtyFlag;\r\n Material._AllDirtyCallBack = function (defines) { return defines.markAllAsDirty(); };\r\n Material._ImageProcessingDirtyCallBack = function (defines) { return defines.markAsImageProcessingDirty(); };\r\n Material._TextureDirtyCallBack = function (defines) { return defines.markAsTexturesDirty(); };\r\n Material._FresnelDirtyCallBack = function (defines) { return defines.markAsFresnelDirty(); };\r\n Material._MiscDirtyCallBack = function (defines) { return defines.markAsMiscDirty(); };\r\n Material._LightsDirtyCallBack = function (defines) { return defines.markAsLightDirty(); };\r\n Material._AttributeDirtyCallBack = function (defines) { return defines.markAsAttributesDirty(); };\r\n Material._FresnelAndMiscDirtyCallBack = function (defines) {\r\n Material._FresnelDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._TextureAndMiscDirtyCallBack = function (defines) {\r\n Material._TextureDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._DirtyCallbackArray = [];\r\n Material._RunDirtyCallBacks = function (defines) {\r\n for (var _i = 0, _a = Material._DirtyCallbackArray; _i < _a.length; _i++) {\r\n var cb = _a[_i];\r\n cb(defines);\r\n }\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"id\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"uniqueId\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"checkReadyOnEveryCall\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"checkReadyOnlyOnce\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"state\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"alpha\")\r\n ], Material.prototype, \"_alpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"backFaceCulling\")\r\n ], Material.prototype, \"_backFaceCulling\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"sideOrientation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"alphaMode\")\r\n ], Material.prototype, \"_alphaMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"_needDepthPrePass\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"disableDepthWrite\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"forceDepthWrite\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"separateCullingPass\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"fogEnabled\")\r\n ], Material.prototype, \"_fogEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"pointSize\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"zOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"wireframe\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"pointsCloud\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"fillMode\", null);\r\n return Material;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/materialDefines.ts\":\n/*!**************************************!*\\\n !*** ./Materials/materialDefines.ts ***!\n \\**************************************/\n/*! exports provided: MaterialDefines */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return MaterialDefines; });\n/**\r\n * Manages the defines for the Material\r\n */\r\nvar MaterialDefines = /** @class */ (function () {\r\n function MaterialDefines() {\r\n this._isDirty = true;\r\n /** @hidden */\r\n this._areLightsDirty = true;\r\n /** @hidden */\r\n this._areLightsDisposed = false;\r\n /** @hidden */\r\n this._areAttributesDirty = true;\r\n /** @hidden */\r\n this._areTexturesDirty = true;\r\n /** @hidden */\r\n this._areFresnelDirty = true;\r\n /** @hidden */\r\n this._areMiscDirty = true;\r\n /** @hidden */\r\n this._areImageProcessingDirty = true;\r\n /** @hidden */\r\n this._normals = false;\r\n /** @hidden */\r\n this._uvs = false;\r\n /** @hidden */\r\n this._needNormals = false;\r\n /** @hidden */\r\n this._needUVs = false;\r\n }\r\n Object.defineProperty(MaterialDefines.prototype, \"isDirty\", {\r\n /**\r\n * Specifies if the material needs to be re-calculated\r\n */\r\n get: function () {\r\n return this._isDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Marks the material to indicate that it has been re-calculated\r\n */\r\n MaterialDefines.prototype.markAsProcessed = function () {\r\n this._isDirty = false;\r\n this._areAttributesDirty = false;\r\n this._areTexturesDirty = false;\r\n this._areFresnelDirty = false;\r\n this._areLightsDirty = false;\r\n this._areLightsDisposed = false;\r\n this._areMiscDirty = false;\r\n this._areImageProcessingDirty = false;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsUnprocessed = function () {\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate all of its defines need to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAllAsDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._areAttributesDirty = true;\r\n this._areLightsDirty = true;\r\n this._areFresnelDirty = true;\r\n this._areMiscDirty = true;\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate that image processing needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsImageProcessingDirty = function () {\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate the lights need to be re-calculated\r\n * @param disposed Defines whether the light is dirty due to dispose or not\r\n */\r\n MaterialDefines.prototype.markAsLightDirty = function (disposed) {\r\n if (disposed === void 0) { disposed = false; }\r\n this._areLightsDirty = true;\r\n this._areLightsDisposed = this._areLightsDisposed || disposed;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the attribute state as changed\r\n */\r\n MaterialDefines.prototype.markAsAttributesDirty = function () {\r\n this._areAttributesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the texture state as changed\r\n */\r\n MaterialDefines.prototype.markAsTexturesDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the fresnel state as changed\r\n */\r\n MaterialDefines.prototype.markAsFresnelDirty = function () {\r\n this._areFresnelDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the misc state as changed\r\n */\r\n MaterialDefines.prototype.markAsMiscDirty = function () {\r\n this._areMiscDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Rebuilds the material defines\r\n */\r\n MaterialDefines.prototype.rebuild = function () {\r\n if (this._keys) {\r\n delete this._keys;\r\n }\r\n this._keys = [];\r\n for (var _i = 0, _a = Object.keys(this); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n if (key[0] === \"_\") {\r\n continue;\r\n }\r\n this._keys.push(key);\r\n }\r\n };\r\n /**\r\n * Specifies if two material defines are equal\r\n * @param other - A material define instance to compare to\r\n * @returns - Boolean indicating if the material defines are equal (true) or not (false)\r\n */\r\n MaterialDefines.prototype.isEqual = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n return false;\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n if (this[prop] !== other[prop]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones this instance's defines to another instance\r\n * @param other - material defines to clone values to\r\n */\r\n MaterialDefines.prototype.cloneTo = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n other._keys = this._keys.slice(0);\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n other[prop] = this[prop];\r\n }\r\n };\r\n /**\r\n * Resets the material define values\r\n */\r\n MaterialDefines.prototype.reset = function () {\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var type = typeof this[prop];\r\n switch (type) {\r\n case \"number\":\r\n this[prop] = 0;\r\n break;\r\n case \"string\":\r\n this[prop] = \"\";\r\n break;\r\n default:\r\n this[prop] = false;\r\n break;\r\n }\r\n }\r\n };\r\n /**\r\n * Converts the material define values to a string\r\n * @returns - String of material define information\r\n */\r\n MaterialDefines.prototype.toString = function () {\r\n var result = \"\";\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var value = this[prop];\r\n var type = typeof value;\r\n switch (type) {\r\n case \"number\":\r\n case \"string\":\r\n result += \"#define \" + prop + \" \" + value + \"\\n\";\r\n break;\r\n default:\r\n if (value) {\r\n result += \"#define \" + prop + \"\\n\";\r\n }\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n return MaterialDefines;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/materialFlags.ts\":\n/*!************************************!*\\\n !*** ./Materials/materialFlags.ts ***!\n \\************************************/\n/*! exports provided: MaterialFlags */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return MaterialFlags; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n/**\r\n * This groups all the flags used to control the materials channel.\r\n */\r\nvar MaterialFlags = /** @class */ (function () {\r\n function MaterialFlags() {\r\n }\r\n Object.defineProperty(MaterialFlags, \"DiffuseTextureEnabled\", {\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._DiffuseTextureEnabled === value) {\r\n return;\r\n }\r\n this._DiffuseTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AmbientTextureEnabled === value) {\r\n return;\r\n }\r\n this._AmbientTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._OpacityTextureEnabled === value) {\r\n return;\r\n }\r\n this._OpacityTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ReflectionTextureEnabled === value) {\r\n return;\r\n }\r\n this._ReflectionTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._EmissiveTextureEnabled === value) {\r\n return;\r\n }\r\n this._EmissiveTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SpecularTextureEnabled === value) {\r\n return;\r\n }\r\n this._SpecularTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._BumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._BumpTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._LightmapTextureEnabled === value) {\r\n return;\r\n }\r\n this._LightmapTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._RefractionTextureEnabled === value) {\r\n return;\r\n }\r\n this._RefractionTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ColorGradingTextureEnabled === value) {\r\n return;\r\n }\r\n this._ColorGradingTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return this._FresnelEnabled;\r\n },\r\n set: function (value) {\r\n if (this._FresnelEnabled === value) {\r\n return;\r\n }\r\n this._FresnelEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_FresnelDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTextureEnabled\", {\r\n /**\r\n * Are clear coat textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatBumpTextureEnabled\", {\r\n /**\r\n * Are clear coat bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatBumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatBumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatBumpTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTintTextureEnabled\", {\r\n /**\r\n * Are clear coat tint textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTintTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTintTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTintTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SheenTextureEnabled\", {\r\n /**\r\n * Are sheen textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SheenTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SheenTextureEnabled === value) {\r\n return;\r\n }\r\n this._SheenTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AnisotropicTextureEnabled\", {\r\n /**\r\n * Are anisotropic textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AnisotropicTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AnisotropicTextureEnabled === value) {\r\n return;\r\n }\r\n this._AnisotropicTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ThicknessTextureEnabled\", {\r\n /**\r\n * Are thickness textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ThicknessTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ThicknessTextureEnabled === value) {\r\n return;\r\n }\r\n this._ThicknessTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n MaterialFlags._DiffuseTextureEnabled = true;\r\n MaterialFlags._AmbientTextureEnabled = true;\r\n MaterialFlags._OpacityTextureEnabled = true;\r\n MaterialFlags._ReflectionTextureEnabled = true;\r\n MaterialFlags._EmissiveTextureEnabled = true;\r\n MaterialFlags._SpecularTextureEnabled = true;\r\n MaterialFlags._BumpTextureEnabled = true;\r\n MaterialFlags._LightmapTextureEnabled = true;\r\n MaterialFlags._RefractionTextureEnabled = true;\r\n MaterialFlags._ColorGradingTextureEnabled = true;\r\n MaterialFlags._FresnelEnabled = true;\r\n MaterialFlags._ClearCoatTextureEnabled = true;\r\n MaterialFlags._ClearCoatBumpTextureEnabled = true;\r\n MaterialFlags._ClearCoatTintTextureEnabled = true;\r\n MaterialFlags._SheenTextureEnabled = true;\r\n MaterialFlags._AnisotropicTextureEnabled = true;\r\n MaterialFlags._ThicknessTextureEnabled = true;\r\n return MaterialFlags;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/materialHelper.ts\":\n/*!*************************************!*\\\n !*** ./Materials/materialHelper.ts ***!\n \\*************************************/\n/*! exports provided: MaterialHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return MaterialHelper; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * \"Static Class\" containing the most commonly used helper while dealing with material for\r\n * rendering purpose.\r\n *\r\n * It contains the basic tools to help defining defines, binding uniform for the common part of the materials.\r\n *\r\n * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions.\r\n */\r\nvar MaterialHelper = /** @class */ (function () {\r\n function MaterialHelper() {\r\n }\r\n /**\r\n * Bind the current view position to an effect.\r\n * @param effect The effect to be bound\r\n * @param scene The scene the eyes position is used from\r\n */\r\n MaterialHelper.BindEyePosition = function (effect, scene) {\r\n if (scene._forcedViewPosition) {\r\n effect.setVector3(\"vEyePosition\", scene._forcedViewPosition);\r\n return;\r\n }\r\n var globalPosition = scene.activeCamera.globalPosition;\r\n if (!globalPosition) {\r\n // Use WebVRFreecamera's device position as global position is not it's actual position in babylon space\r\n globalPosition = scene.activeCamera.devicePosition;\r\n }\r\n effect.setVector3(\"vEyePosition\", scene._mirroredCameraPosition ? scene._mirroredCameraPosition : globalPosition);\r\n };\r\n /**\r\n * Helps preparing the defines values about the UVs in used in the effect.\r\n * UVs are shared as much as we can accross channels in the shaders.\r\n * @param texture The texture we are preparing the UVs for\r\n * @param defines The defines to update\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.PrepareDefinesForMergedUV = function (texture, defines, key) {\r\n defines._needUVs = true;\r\n defines[key] = true;\r\n if (texture.getTextureMatrix().isIdentityAs3x2()) {\r\n defines[key + \"DIRECTUV\"] = texture.coordinatesIndex + 1;\r\n if (texture.coordinatesIndex === 0) {\r\n defines[\"MAINUV1\"] = true;\r\n }\r\n else {\r\n defines[\"MAINUV2\"] = true;\r\n }\r\n }\r\n else {\r\n defines[key + \"DIRECTUV\"] = 0;\r\n }\r\n };\r\n /**\r\n * Binds a texture matrix value to its corrsponding uniform\r\n * @param texture The texture to bind the matrix for\r\n * @param uniformBuffer The uniform buffer receivin the data\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.BindTextureMatrix = function (texture, uniformBuffer, key) {\r\n var matrix = texture.getTextureMatrix();\r\n uniformBuffer.updateMatrix(key + \"Matrix\", matrix);\r\n };\r\n /**\r\n * Gets the current status of the fog (should it be enabled?)\r\n * @param mesh defines the mesh to evaluate for fog support\r\n * @param scene defines the hosting scene\r\n * @returns true if fog must be enabled\r\n */\r\n MaterialHelper.GetFogState = function (mesh, scene) {\r\n return (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].FOGMODE_NONE);\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with misc. values for shader compilation\r\n * @param mesh defines the current mesh\r\n * @param scene defines the current scene\r\n * @param useLogarithmicDepth defines if logarithmic depth has to be turned on\r\n * @param pointsCloud defines if point cloud rendering has to be turned on\r\n * @param fogEnabled defines if fog has to be turned on\r\n * @param alphaTest defines if alpha testing has to be turned on\r\n * @param defines defines the current list of defines\r\n */\r\n MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, alphaTest, defines) {\r\n if (defines._areMiscDirty) {\r\n defines[\"LOGARITHMICDEPTH\"] = useLogarithmicDepth;\r\n defines[\"POINTSIZE\"] = pointsCloud;\r\n defines[\"FOG\"] = fogEnabled && this.GetFogState(mesh, scene);\r\n defines[\"NONUNIFORMSCALING\"] = mesh.nonUniformScaling;\r\n defines[\"ALPHATEST\"] = alphaTest;\r\n }\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with frame values for shader compilation\r\n * @param scene defines the current scene\r\n * @param engine defines the current engine\r\n * @param defines specifies the list of active defines\r\n * @param useInstances defines if instances have to be turned on\r\n * @param useClipPlane defines if clip plane have to be turned on\r\n */\r\n MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances, useClipPlane) {\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n var changed = false;\r\n var useClipPlane1 = false;\r\n var useClipPlane2 = false;\r\n var useClipPlane3 = false;\r\n var useClipPlane4 = false;\r\n useClipPlane1 = useClipPlane == null ? (scene.clipPlane !== undefined && scene.clipPlane !== null) : useClipPlane;\r\n useClipPlane2 = useClipPlane == null ? (scene.clipPlane2 !== undefined && scene.clipPlane2 !== null) : useClipPlane;\r\n useClipPlane3 = useClipPlane == null ? (scene.clipPlane3 !== undefined && scene.clipPlane3 !== null) : useClipPlane;\r\n useClipPlane4 = useClipPlane == null ? (scene.clipPlane4 !== undefined && scene.clipPlane4 !== null) : useClipPlane;\r\n if (defines[\"CLIPPLANE\"] !== useClipPlane1) {\r\n defines[\"CLIPPLANE\"] = useClipPlane1;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE2\"] !== useClipPlane2) {\r\n defines[\"CLIPPLANE2\"] = useClipPlane2;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE3\"] !== useClipPlane3) {\r\n defines[\"CLIPPLANE3\"] = useClipPlane3;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE4\"] !== useClipPlane4) {\r\n defines[\"CLIPPLANE4\"] = useClipPlane4;\r\n changed = true;\r\n }\r\n if (defines[\"DEPTHPREPASS\"] !== !engine.getColorWrite()) {\r\n defines[\"DEPTHPREPASS\"] = !defines[\"DEPTHPREPASS\"];\r\n changed = true;\r\n }\r\n if (defines[\"INSTANCES\"] !== useInstances) {\r\n defines[\"INSTANCES\"] = useInstances;\r\n changed = true;\r\n }\r\n if (changed) {\r\n defines.markAsUnprocessed();\r\n }\r\n };\r\n /**\r\n * Prepares the defines for bones\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForBones = function (mesh, defines) {\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = mesh.numBoneInfluencers;\r\n var materialSupportsBoneTexture = defines[\"BONETEXTURE\"] !== undefined;\r\n if (mesh.skeleton.isUsingTextureForMatrices && materialSupportsBoneTexture) {\r\n defines[\"BONETEXTURE\"] = true;\r\n }\r\n else {\r\n defines[\"BonesPerMesh\"] = (mesh.skeleton.bones.length + 1);\r\n defines[\"BONETEXTURE\"] = materialSupportsBoneTexture ? false : undefined;\r\n }\r\n }\r\n else {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = 0;\r\n defines[\"BonesPerMesh\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines for morph targets\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMorphTargets = function (mesh, defines) {\r\n var manager = mesh.morphTargetManager;\r\n if (manager) {\r\n defines[\"MORPHTARGETS_UV\"] = manager.supportsUVs && defines[\"UV1\"];\r\n defines[\"MORPHTARGETS_TANGENT\"] = manager.supportsTangents && defines[\"TANGENT\"];\r\n defines[\"MORPHTARGETS_NORMAL\"] = manager.supportsNormals && defines[\"NORMAL\"];\r\n defines[\"MORPHTARGETS\"] = (manager.numInfluencers > 0);\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = manager.numInfluencers;\r\n }\r\n else {\r\n defines[\"MORPHTARGETS_UV\"] = false;\r\n defines[\"MORPHTARGETS_TANGENT\"] = false;\r\n defines[\"MORPHTARGETS_NORMAL\"] = false;\r\n defines[\"MORPHTARGETS\"] = false;\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines used in the shader depending on the attributes data available in the mesh\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n * @param useVertexColor Precise whether vertex colors should be used or not (override mesh info)\r\n * @param useBones Precise whether bones should be used or not (override mesh info)\r\n * @param useMorphTargets Precise whether morph targets should be used or not (override mesh info)\r\n * @param useVertexAlpha Precise whether vertex alpha should be used or not (override mesh info)\r\n * @returns false if defines are considered not dirty and have not been checked\r\n */\r\n MaterialHelper.PrepareDefinesForAttributes = function (mesh, defines, useVertexColor, useBones, useMorphTargets, useVertexAlpha) {\r\n if (useMorphTargets === void 0) { useMorphTargets = false; }\r\n if (useVertexAlpha === void 0) { useVertexAlpha = true; }\r\n if (!defines._areAttributesDirty && defines._needNormals === defines._normals && defines._needUVs === defines._uvs) {\r\n return false;\r\n }\r\n defines._normals = defines._needNormals;\r\n defines._uvs = defines._needUVs;\r\n defines[\"NORMAL\"] = (defines._needNormals && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind));\r\n if (defines._needNormals && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n defines[\"TANGENT\"] = true;\r\n }\r\n if (defines._needUVs) {\r\n defines[\"UV1\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind);\r\n defines[\"UV2\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n else {\r\n defines[\"UV1\"] = false;\r\n defines[\"UV2\"] = false;\r\n }\r\n if (useVertexColor) {\r\n var hasVertexColors = mesh.useVertexColors && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind);\r\n defines[\"VERTEXCOLOR\"] = hasVertexColors;\r\n defines[\"VERTEXALPHA\"] = mesh.hasVertexAlpha && hasVertexColors && useVertexAlpha;\r\n }\r\n if (useBones) {\r\n this.PrepareDefinesForBones(mesh, defines);\r\n }\r\n if (useMorphTargets) {\r\n this.PrepareDefinesForMorphTargets(mesh, defines);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Prepares the defines related to multiview\r\n * @param scene The scene we are intending to draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMultiview = function (scene, defines) {\r\n if (scene.activeCamera) {\r\n var previousMultiview = defines.MULTIVIEW;\r\n defines.MULTIVIEW = (scene.activeCamera.outputRenderTarget !== null && scene.activeCamera.outputRenderTarget.getViewCount() > 1);\r\n if (defines.MULTIVIEW != previousMultiview) {\r\n defines.markAsUnprocessed();\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param light The light the effect is compiling for\r\n * @param lightIndex The index of the light\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param state Defines the current state regarding what is needed (normals, etc...)\r\n */\r\n MaterialHelper.PrepareDefinesForLight = function (scene, mesh, light, lightIndex, defines, specularSupported, state) {\r\n state.needNormals = true;\r\n if (defines[\"LIGHT\" + lightIndex] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"LIGHT\" + lightIndex] = true;\r\n defines[\"SPOTLIGHT\" + lightIndex] = false;\r\n defines[\"HEMILIGHT\" + lightIndex] = false;\r\n defines[\"POINTLIGHT\" + lightIndex] = false;\r\n defines[\"DIRLIGHT\" + lightIndex] = false;\r\n light.prepareLightSpecificDefines(defines, lightIndex);\r\n // FallOff.\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = false;\r\n switch (light.falloffType) {\r\n case _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].FALLOFF_GLTF:\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = true;\r\n break;\r\n case _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].FALLOFF_PHYSICAL:\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = true;\r\n break;\r\n case _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].FALLOFF_STANDARD:\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = true;\r\n break;\r\n }\r\n // Specular\r\n if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {\r\n state.specularEnabled = true;\r\n }\r\n // Shadows\r\n defines[\"SHADOW\" + lightIndex] = false;\r\n defines[\"SHADOWPCF\" + lightIndex] = false;\r\n defines[\"SHADOWPCSS\" + lightIndex] = false;\r\n defines[\"SHADOWPOISSON\" + lightIndex] = false;\r\n defines[\"SHADOWESM\" + lightIndex] = false;\r\n defines[\"SHADOWCUBE\" + lightIndex] = false;\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = false;\r\n if (mesh && mesh.receiveShadows && scene.shadowsEnabled && light.shadowEnabled) {\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n var shadowMap = shadowGenerator.getShadowMap();\r\n if (shadowMap) {\r\n if (shadowMap.renderList && shadowMap.renderList.length > 0) {\r\n state.shadowEnabled = true;\r\n shadowGenerator.prepareDefines(defines, lightIndex);\r\n }\r\n }\r\n }\r\n }\r\n if (light.lightmapMode != _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTMAP_DEFAULT) {\r\n state.lightmapMode = true;\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = true;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = (light.lightmapMode == _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTMAP_SHADOWSONLY);\r\n }\r\n else {\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = false;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = false;\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param maxSimultaneousLights Specfies how manuy lights can be added to the effect at max\r\n * @param disableLighting Specifies whether the lighting is disabled (override scene and light)\r\n * @returns true if normals will be required for the rest of the effect\r\n */\r\n MaterialHelper.PrepareDefinesForLights = function (scene, mesh, defines, specularSupported, maxSimultaneousLights, disableLighting) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (disableLighting === void 0) { disableLighting = false; }\r\n if (!defines._areLightsDirty) {\r\n return defines._needNormals;\r\n }\r\n var lightIndex = 0;\r\n var state = {\r\n needNormals: false,\r\n needRebuild: false,\r\n lightmapMode: false,\r\n shadowEnabled: false,\r\n specularEnabled: false\r\n };\r\n if (scene.lightsEnabled && !disableLighting) {\r\n for (var _i = 0, _a = mesh.lightSources; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n this.PrepareDefinesForLight(scene, mesh, light, lightIndex, defines, specularSupported, state);\r\n lightIndex++;\r\n if (lightIndex === maxSimultaneousLights) {\r\n break;\r\n }\r\n }\r\n }\r\n defines[\"SPECULARTERM\"] = state.specularEnabled;\r\n defines[\"SHADOWS\"] = state.shadowEnabled;\r\n // Resetting all other lights if any\r\n for (var index = lightIndex; index < maxSimultaneousLights; index++) {\r\n if (defines[\"LIGHT\" + index] !== undefined) {\r\n defines[\"LIGHT\" + index] = false;\r\n defines[\"HEMILIGHT\" + index] = false;\r\n defines[\"POINTLIGHT\" + index] = false;\r\n defines[\"DIRLIGHT\" + index] = false;\r\n defines[\"SPOTLIGHT\" + index] = false;\r\n defines[\"SHADOW\" + index] = false;\r\n defines[\"SHADOWPCF\" + index] = false;\r\n defines[\"SHADOWPCSS\" + index] = false;\r\n defines[\"SHADOWPOISSON\" + index] = false;\r\n defines[\"SHADOWESM\" + index] = false;\r\n defines[\"SHADOWCUBE\" + index] = false;\r\n defines[\"SHADOWLOWQUALITY\" + index] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + index] = false;\r\n }\r\n }\r\n var caps = scene.getEngine().getCaps();\r\n if (defines[\"SHADOWFLOAT\"] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"SHADOWFLOAT\"] = state.shadowEnabled &&\r\n ((caps.textureFloatRender && caps.textureFloatLinearFiltering) ||\r\n (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering));\r\n defines[\"LIGHTMAPEXCLUDED\"] = state.lightmapMode;\r\n if (state.needRebuild) {\r\n defines.rebuild();\r\n }\r\n return state.needNormals;\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect (for a specific light)\r\n * @param lightIndex defines the light index\r\n * @param uniformsList The uniform list\r\n * @param samplersList The sampler list\r\n * @param projectedLightTexture defines if projected texture must be used\r\n * @param uniformBuffersList defines an optional list of uniform buffers\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersForLight = function (lightIndex, uniformsList, samplersList, projectedLightTexture, uniformBuffersList) {\r\n if (uniformBuffersList === void 0) { uniformBuffersList = null; }\r\n uniformsList.push(\"vLightData\" + lightIndex, \"vLightDiffuse\" + lightIndex, \"vLightSpecular\" + lightIndex, \"vLightDirection\" + lightIndex, \"vLightFalloff\" + lightIndex, \"vLightGround\" + lightIndex, \"lightMatrix\" + lightIndex, \"shadowsInfo\" + lightIndex, \"depthValues\" + lightIndex);\r\n if (uniformBuffersList) {\r\n uniformBuffersList.push(\"Light\" + lightIndex);\r\n }\r\n samplersList.push(\"shadowSampler\" + lightIndex);\r\n samplersList.push(\"depthSampler\" + lightIndex);\r\n if (projectedLightTexture) {\r\n samplersList.push(\"projectionLightSampler\" + lightIndex);\r\n uniformsList.push(\"textureProjectionMatrix\" + lightIndex);\r\n }\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect\r\n * @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the liist and extra information\r\n * @param samplersList The sampler list\r\n * @param defines The defines helping in the list generation\r\n * @param maxSimultaneousLights The maximum number of simultanous light allowed in the effect\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersList = function (uniformsListOrOptions, samplersList, defines, maxSimultaneousLights) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n var uniformsList;\r\n var uniformBuffersList = null;\r\n if (uniformsListOrOptions.uniformsNames) {\r\n var options = uniformsListOrOptions;\r\n uniformsList = options.uniformsNames;\r\n uniformBuffersList = options.uniformBuffersNames;\r\n samplersList = options.samplers;\r\n defines = options.defines;\r\n maxSimultaneousLights = options.maxSimultaneousLights;\r\n }\r\n else {\r\n uniformsList = uniformsListOrOptions;\r\n if (!samplersList) {\r\n samplersList = [];\r\n }\r\n }\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n this.PrepareUniformsAndSamplersForLight(lightIndex, uniformsList, samplersList, defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex], uniformBuffersList);\r\n }\r\n if (defines[\"NUM_MORPH_INFLUENCERS\"]) {\r\n uniformsList.push(\"morphTargetInfluences\");\r\n }\r\n };\r\n /**\r\n * This helps decreasing rank by rank the shadow quality (0 being the highest rank and quality)\r\n * @param defines The defines to update while falling back\r\n * @param fallbacks The authorized effect fallbacks\r\n * @param maxSimultaneousLights The maximum number of lights allowed\r\n * @param rank the current rank of the Effect\r\n * @returns The newly affected rank\r\n */\r\n MaterialHelper.HandleFallbacksForShadows = function (defines, fallbacks, maxSimultaneousLights, rank) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (rank === void 0) { rank = 0; }\r\n var lightFallbackRank = 0;\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n if (lightIndex > 0) {\r\n lightFallbackRank = rank + lightIndex;\r\n fallbacks.addFallback(lightFallbackRank, \"LIGHT\" + lightIndex);\r\n }\r\n if (!defines[\"SHADOWS\"]) {\r\n if (defines[\"SHADOW\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOW\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCF\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCF\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCSS\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCSS\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPOISSON\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPOISSON\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWESM\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWESM\" + lightIndex);\r\n }\r\n }\r\n }\r\n return lightFallbackRank++;\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param influencers The number of influencers\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargetsInfluencers = function (attribs, mesh, influencers) {\r\n this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS = influencers;\r\n this.PrepareAttributesForMorphTargets(attribs, mesh, this._TmpMorphInfluencers);\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param defines The current Defines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargets = function (attribs, mesh, defines) {\r\n var influencers = defines[\"NUM_MORPH_INFLUENCERS\"];\r\n if (influencers > 0 && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedEngine) {\r\n var maxAttributesCount = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedEngine.getCaps().maxVertexAttribs;\r\n var manager = mesh.morphTargetManager;\r\n var normal = manager && manager.supportsNormals && defines[\"NORMAL\"];\r\n var tangent = manager && manager.supportsTangents && defines[\"TANGENT\"];\r\n var uv = manager && manager.supportsUVs && defines[\"UV1\"];\r\n for (var index = 0; index < influencers; index++) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind + index);\r\n if (normal) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind + index);\r\n }\r\n if (tangent) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind + index);\r\n }\r\n if (uv) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind + \"_\" + index);\r\n }\r\n if (attribs.length > maxAttributesCount) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Cannot add more vertex attributes for mesh \" + mesh.name);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the list of attributes required for bones according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the bones attributes for\r\n * @param defines The current Defines of the effect\r\n * @param fallbacks The current efffect fallback strategy\r\n */\r\n MaterialHelper.PrepareAttributesForBones = function (attribs, mesh, defines, fallbacks) {\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n }\r\n };\r\n /**\r\n * Check and prepare the list of attributes required for instances according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param defines The current MaterialDefines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForInstances = function (attribs, defines) {\r\n if (defines[\"INSTANCES\"]) {\r\n this.PushAttributesForInstances(attribs);\r\n }\r\n };\r\n /**\r\n * Add the list of attributes required for instances to the attribs array.\r\n * @param attribs The current list of supported attribs\r\n */\r\n MaterialHelper.PushAttributesForInstances = function (attribs) {\r\n attribs.push(\"world0\");\r\n attribs.push(\"world1\");\r\n attribs.push(\"world2\");\r\n attribs.push(\"world3\");\r\n };\r\n /**\r\n * Binds the light shadow information to the effect for the given mesh.\r\n * @param light The light containing the generator\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param lightIndex The light index in the effect used to render the mesh\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindLightShadow = function (light, mesh, lightIndex, effect) {\r\n if (light.shadowEnabled && mesh.receiveShadows) {\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n shadowGenerator.bindShadowLight(lightIndex, effect);\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the light information to the effect.\r\n * @param light The light containing the generator\r\n * @param effect The effect we are binding the data to\r\n * @param lightIndex The light index in the effect used to render\r\n */\r\n MaterialHelper.BindLightProperties = function (light, effect, lightIndex) {\r\n light.transferToEffect(effect, lightIndex + \"\");\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param light Light to bind\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param usePhysicalLightFalloff Specifies whether the light falloff is defined physically or not\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLight = function (light, lightIndex, scene, mesh, effect, useSpecular, usePhysicalLightFalloff, rebuildInParallel) {\r\n if (usePhysicalLightFalloff === void 0) { usePhysicalLightFalloff = false; }\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var iAsString = lightIndex.toString();\r\n var scaledIntensity = light.getScaledIntensity();\r\n if (!rebuildInParallel) {\r\n light._uniformBuffer.bindToEffect(effect, \"Light\" + iAsString);\r\n }\r\n MaterialHelper.BindLightProperties(light, effect, lightIndex);\r\n light.diffuse.scaleToRef(scaledIntensity, _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[0]);\r\n light._uniformBuffer.updateColor4(\"vLightDiffuse\", _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[0], usePhysicalLightFalloff ? light.radius : light.range, iAsString);\r\n if (useSpecular) {\r\n light.specular.scaleToRef(scaledIntensity, _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[1]);\r\n light._uniformBuffer.updateColor3(\"vLightSpecular\", _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[1], iAsString);\r\n }\r\n // Shadows\r\n if (scene.shadowsEnabled) {\r\n this.BindLightShadow(light, mesh, iAsString, effect);\r\n }\r\n light._uniformBuffer.update();\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param defines The generated defines for the effect\r\n * @param maxSimultaneousLights The maximum number of light that can be bound to the effect\r\n * @param usePhysicalLightFalloff Specifies whether the light falloff is defined physically or not\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLights = function (scene, mesh, effect, defines, maxSimultaneousLights, usePhysicalLightFalloff, rebuildInParallel) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (usePhysicalLightFalloff === void 0) { usePhysicalLightFalloff = false; }\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var len = Math.min(mesh.lightSources.length, maxSimultaneousLights);\r\n for (var i = 0; i < len; i++) {\r\n var light = mesh.lightSources[i];\r\n this.BindLight(light, i, scene, mesh, effect, typeof defines === \"boolean\" ? defines : defines[\"SPECULARTERM\"], usePhysicalLightFalloff, rebuildInParallel);\r\n }\r\n };\r\n /**\r\n * Binds the fog information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param linearSpace Defines if the fog effect is applied in linear space\r\n */\r\n MaterialHelper.BindFogParameters = function (scene, mesh, effect, linearSpace) {\r\n if (linearSpace === void 0) { linearSpace = false; }\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].FOGMODE_NONE) {\r\n effect.setFloat4(\"vFogInfos\", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n // Convert fog color to linear space if used in a linear space computed shader.\r\n if (linearSpace) {\r\n scene.fogColor.toLinearSpaceToRef(this._tempFogColor);\r\n effect.setColor3(\"vFogColor\", this._tempFogColor);\r\n }\r\n else {\r\n effect.setColor3(\"vFogColor\", scene.fogColor);\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the bones information from the mesh to the effect.\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindBonesParameters = function (mesh, effect) {\r\n if (!effect || !mesh) {\r\n return;\r\n }\r\n if (mesh.computeBonesUsingShaders && effect._bonesComputationForcedToCPU) {\r\n mesh.computeBonesUsingShaders = false;\r\n }\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex(\"boneTextureWidth\") > -1) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n effect.setTexture(\"boneSampler\", boneTexture);\r\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n var matrices = skeleton.getTransformMatrices(mesh);\r\n if (matrices) {\r\n effect.setMatrices(\"mBones\", matrices);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the morph targets information from the mesh to the effect.\r\n * @param abstractMesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindMorphTargetParameters = function (abstractMesh, effect) {\r\n var manager = abstractMesh.morphTargetManager;\r\n if (!abstractMesh || !manager) {\r\n return;\r\n }\r\n effect.setFloatArray(\"morphTargetInfluences\", manager.influences);\r\n };\r\n /**\r\n * Binds the logarithmic depth information from the scene to the effect for the given defines.\r\n * @param defines The generated defines used in the effect\r\n * @param effect The effect we are binding the data to\r\n * @param scene The scene we are willing to render with logarithmic scale for\r\n */\r\n MaterialHelper.BindLogDepth = function (defines, effect, scene) {\r\n if (defines[\"LOGARITHMICDEPTH\"]) {\r\n effect.setFloat(\"logarithmicDepthConstant\", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));\r\n }\r\n };\r\n /**\r\n * Binds the clip plane information from the scene to the effect.\r\n * @param scene The scene the clip plane information are extracted from\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindClipPlane = function (effect, scene) {\r\n if (scene.clipPlane) {\r\n var clipPlane = scene.clipPlane;\r\n effect.setFloat4(\"vClipPlane\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (scene.clipPlane2) {\r\n var clipPlane = scene.clipPlane2;\r\n effect.setFloat4(\"vClipPlane2\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (scene.clipPlane3) {\r\n var clipPlane = scene.clipPlane3;\r\n effect.setFloat4(\"vClipPlane3\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (scene.clipPlane4) {\r\n var clipPlane = scene.clipPlane4;\r\n effect.setFloat4(\"vClipPlane4\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n };\r\n MaterialHelper._TmpMorphInfluencers = { \"NUM_MORPH_INFLUENCERS\": 0 };\r\n MaterialHelper._tempFogColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"].Black();\r\n return MaterialHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/multiMaterial.ts\":\n/*!************************************!*\\\n !*** ./Materials/multiMaterial.ts ***!\n \\************************************/\n/*! exports provided: MultiMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return MultiMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see http://doc.babylonjs.com/how_to/multi_materials\r\n */\r\nvar MultiMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiMaterial, _super);\r\n /**\r\n * Instantiates a new Multi Material\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see http://doc.babylonjs.com/how_to/multi_materials\r\n * @param name Define the name in the scene\r\n * @param scene Define the scene the material belongs to\r\n */\r\n function MultiMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene, true) || this;\r\n scene.multiMaterials.push(_this);\r\n _this.subMaterials = new Array();\r\n _this._storeEffectOnSubMeshes = true; // multimaterial is considered like a push material\r\n return _this;\r\n }\r\n Object.defineProperty(MultiMaterial.prototype, \"subMaterials\", {\r\n /**\r\n * Gets or Sets the list of Materials used within the multi material.\r\n * They need to be ordered according to the submeshes order in the associated mesh\r\n */\r\n get: function () {\r\n return this._subMaterials;\r\n },\r\n set: function (value) {\r\n this._subMaterials = value;\r\n this._hookArray(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Function used to align with Node.getChildren()\r\n * @returns the list of Materials used within the multi material\r\n */\r\n MultiMaterial.prototype.getChildren = function () {\r\n return this.subMaterials;\r\n };\r\n MultiMaterial.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return deleted;\r\n };\r\n };\r\n /**\r\n * Get one of the submaterial by its index in the submaterials array\r\n * @param index The index to look the sub material at\r\n * @returns The Material if the index has been defined\r\n */\r\n MultiMaterial.prototype.getSubMaterial = function (index) {\r\n if (index < 0 || index >= this.subMaterials.length) {\r\n return this.getScene().defaultMaterial;\r\n }\r\n return this.subMaterials[index];\r\n };\r\n /**\r\n * Get the list of active textures for the whole sub materials list.\r\n * @returns All the textures that will be used during the rendering\r\n */\r\n MultiMaterial.prototype.getActiveTextures = function () {\r\n var _a;\r\n return (_a = _super.prototype.getActiveTextures.call(this)).concat.apply(_a, this.subMaterials.map(function (subMaterial) {\r\n if (subMaterial) {\r\n return subMaterial.getActiveTextures();\r\n }\r\n else {\r\n return [];\r\n }\r\n }));\r\n };\r\n /**\r\n * Gets the current class name of the material e.g. \"MultiMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n MultiMaterial.prototype.getClassName = function () {\r\n return \"MultiMaterial\";\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested sub mesh\r\n * @param mesh Define the mesh the submesh belongs to\r\n * @param subMesh Define the sub mesh to look readyness for\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n MultiMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n if (subMaterial._storeEffectOnSubMeshes) {\r\n if (!subMaterial.isReadyForSubMesh(mesh, subMesh, useInstances)) {\r\n return false;\r\n }\r\n continue;\r\n }\r\n if (!subMaterial.isReady(mesh)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones the current material and its related sub materials\r\n * @param name Define the name of the newly cloned material\r\n * @param cloneChildren Define if submaterial will be cloned or shared with the parent instance\r\n * @returns the cloned material\r\n */\r\n MultiMaterial.prototype.clone = function (name, cloneChildren) {\r\n var newMultiMaterial = new MultiMaterial(name, this.getScene());\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = null;\r\n var current = this.subMaterials[index];\r\n if (cloneChildren && current) {\r\n subMaterial = current.clone(name + \"-\" + current.name);\r\n }\r\n else {\r\n subMaterial = this.subMaterials[index];\r\n }\r\n newMultiMaterial.subMaterials.push(subMaterial);\r\n }\r\n return newMultiMaterial;\r\n };\r\n /**\r\n * Serializes the materials into a JSON representation.\r\n * @returns the JSON representation\r\n */\r\n MultiMaterial.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"]) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"].GetTags(this);\r\n }\r\n serializationObject.materials = [];\r\n for (var matIndex = 0; matIndex < this.subMaterials.length; matIndex++) {\r\n var subMat = this.subMaterials[matIndex];\r\n if (subMat) {\r\n serializationObject.materials.push(subMat.id);\r\n }\r\n else {\r\n serializationObject.materials.push(null);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Dispose the material and release its associated resources\r\n * @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on)\r\n * @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app)\r\n * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app)\r\n */\r\n MultiMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, forceDisposeChildren) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n if (forceDisposeChildren) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n subMaterial.dispose(forceDisposeEffect, forceDisposeTextures);\r\n }\r\n }\r\n }\r\n var index = scene.multiMaterials.indexOf(this);\r\n if (index >= 0) {\r\n scene.multiMaterials.splice(index, 1);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Creates a MultiMaterial from parsed MultiMaterial data.\r\n * @param parsedMultiMaterial defines parsed MultiMaterial data.\r\n * @param scene defines the hosting scene\r\n * @returns a new MultiMaterial\r\n */\r\n MultiMaterial.ParseMultiMaterial = function (parsedMultiMaterial, scene) {\r\n var multiMaterial = new MultiMaterial(parsedMultiMaterial.name, scene);\r\n multiMaterial.id = parsedMultiMaterial.id;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"].AddTagsTo(multiMaterial, parsedMultiMaterial.tags);\r\n }\r\n for (var matIndex = 0; matIndex < parsedMultiMaterial.materials.length; matIndex++) {\r\n var subMatId = parsedMultiMaterial.materials[matIndex];\r\n if (subMatId) {\r\n // If the same multimaterial is loaded twice, the 2nd multimaterial needs to reference the latest material by that id which\r\n // is why this lookup should use getLastMaterialByID instead of getMaterialByID\r\n multiMaterial.subMaterials.push(scene.getLastMaterialByID(subMatId));\r\n }\r\n else {\r\n multiMaterial.subMaterials.push(null);\r\n }\r\n }\r\n return multiMaterial;\r\n };\r\n return MultiMaterial;\r\n}(_Materials_material__WEBPACK_IMPORTED_MODULE_1__[\"Material\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MultiMaterial\"] = MultiMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/pushMaterial.ts\":\n/*!***********************************!*\\\n !*** ./Materials/pushMaterial.ts ***!\n \\***********************************/\n/*! exports provided: PushMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return PushMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n\r\n\r\n\r\n/**\r\n * Base class of materials working in push mode in babylon JS\r\n * @hidden\r\n */\r\nvar PushMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PushMaterial, _super);\r\n function PushMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._normalMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n /**\r\n * Gets or sets a boolean indicating that the material is allowed to do shader hot swapping.\r\n * This means that the material can keep using a previous shader while a new one is being compiled.\r\n * This is mostly used when shader parallel compilation is supported (true by default)\r\n */\r\n _this.allowShaderHotSwapping = true;\r\n _this._storeEffectOnSubMeshes = true;\r\n return _this;\r\n }\r\n PushMaterial.prototype.getEffect = function () {\r\n return this._activeEffect;\r\n };\r\n PushMaterial.prototype.isReady = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return false;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n return true;\r\n }\r\n return this.isReadyForSubMesh(mesh, mesh.subMeshes[0], useInstances);\r\n };\r\n /**\r\n * Binds the given world matrix to the active effect\r\n *\r\n * @param world the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n this._activeEffect.setMatrix(\"world\", world);\r\n };\r\n /**\r\n * Binds the given normal matrix to the active effect\r\n *\r\n * @param normalMatrix the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyNormalMatrix = function (normalMatrix) {\r\n this._activeEffect.setMatrix(\"normalMatrix\", normalMatrix);\r\n };\r\n PushMaterial.prototype.bind = function (world, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n this.bindForSubMesh(world, mesh, mesh.subMeshes[0]);\r\n };\r\n PushMaterial.prototype._afterBind = function (mesh, effect) {\r\n if (effect === void 0) { effect = null; }\r\n _super.prototype._afterBind.call(this, mesh);\r\n this.getScene()._cachedEffect = effect;\r\n };\r\n PushMaterial.prototype._mustRebind = function (scene, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return scene.isCachedMaterialInvalid(this, effect, visibility);\r\n };\r\n return PushMaterial;\r\n}(_Materials_material__WEBPACK_IMPORTED_MODULE_2__[\"Material\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/shaderMaterial.ts\":\n/*!*************************************!*\\\n !*** ./Materials/shaderMaterial.ts ***!\n \\*************************************/\n/*! exports provided: ShaderMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return ShaderMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./material */ \"./Materials/material.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n *\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n *\r\n * @see http://doc.babylonjs.com/how_to/shader_material\r\n */\r\nvar ShaderMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderMaterial, _super);\r\n /**\r\n * Instantiate a new shader material.\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n * @see http://doc.babylonjs.com/how_to/shader_material\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belongs to\r\n * @param shaderPath Defines the route to the shader code in one of three ways:\r\n * * object: { vertex: \"custom\", fragment: \"custom\" }, used with Effect.ShadersStore[\"customVertexShader\"] and Effect.ShadersStore[\"customFragmentShader\"]\r\n * * object: { vertexElement: \"vertexShaderCode\", fragmentElement: \"fragmentShaderCode\" }, used with shader code in script tags\r\n * * object: { vertexSource: \"vertex shader code string\", fragmentSource: \"fragment shader code string\" } using with strings containing the shaders code\r\n * * string: \"./COMMON_NAME\", used with external files COMMON_NAME.vertex.fx and COMMON_NAME.fragment.fx in index.html folder.\r\n * @param options Define the options used to create the shader\r\n */\r\n function ShaderMaterial(name, scene, shaderPath, options) {\r\n if (options === void 0) { options = {}; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._textures = {};\r\n _this._textureArrays = {};\r\n _this._floats = {};\r\n _this._ints = {};\r\n _this._floatsArrays = {};\r\n _this._colors3 = {};\r\n _this._colors3Arrays = {};\r\n _this._colors4 = {};\r\n _this._colors4Arrays = {};\r\n _this._vectors2 = {};\r\n _this._vectors3 = {};\r\n _this._vectors4 = {};\r\n _this._matrices = {};\r\n _this._matrices3x3 = {};\r\n _this._matrices2x2 = {};\r\n _this._vectors2Arrays = {};\r\n _this._vectors3Arrays = {};\r\n _this._vectors4Arrays = {};\r\n _this._cachedWorldViewMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._cachedWorldViewProjectionMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._shaderPath = shaderPath;\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ needAlphaBlending: false, needAlphaTesting: false, attributes: [\"position\", \"normal\", \"uv\"], uniforms: [\"worldViewProjection\"], uniformBuffers: [], samplers: [], defines: [] }, options);\r\n return _this;\r\n }\r\n Object.defineProperty(ShaderMaterial.prototype, \"options\", {\r\n /**\r\n * Gets the options used to compile the shader.\r\n * They can be modified to trigger a new compilation\r\n */\r\n get: function () {\r\n return this._options;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"ShaderMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n ShaderMaterial.prototype.getClassName = function () {\r\n return \"ShaderMaterial\";\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n ShaderMaterial.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0) || this._options.needAlphaBlending;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n ShaderMaterial.prototype.needAlphaTesting = function () {\r\n return this._options.needAlphaTesting;\r\n };\r\n ShaderMaterial.prototype._checkUniform = function (uniformName) {\r\n if (this._options.uniforms.indexOf(uniformName) === -1) {\r\n this._options.uniforms.push(uniformName);\r\n }\r\n };\r\n /**\r\n * Set a texture in the shader.\r\n * @param name Define the name of the uniform samplers as defined in the shader\r\n * @param texture Define the texture to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTexture = function (name, texture) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._textures[name] = texture;\r\n return this;\r\n };\r\n /**\r\n * Set a texture array in the shader.\r\n * @param name Define the name of the uniform sampler array as defined in the shader\r\n * @param textures Define the list of textures to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTextureArray = function (name, textures) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._checkUniform(name);\r\n this._textureArrays[name] = textures;\r\n return this;\r\n };\r\n /**\r\n * Set a float in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloat = function (name, value) {\r\n this._checkUniform(name);\r\n this._floats[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a int in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setInt = function (name, value) {\r\n this._checkUniform(name);\r\n this._ints[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set an array of floats in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloats = function (name, value) {\r\n this._checkUniform(name);\r\n this._floatsArrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Color3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a Color3 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Color4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a Color4 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 in the shader from a Vector2.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Vector3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Vector4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat4 in the shader from a Matrix.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat3 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix3x3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices3x3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat2 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix2x2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices2x2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4Arrays[name] = value;\r\n return this;\r\n };\r\n ShaderMaterial.prototype._checkCache = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this._effect && (this._effect.defines.indexOf(\"#define INSTANCES\") !== -1) !== useInstances) {\r\n return false;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n ShaderMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return this.isReady(mesh, useInstances);\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested mesh\r\n * @param mesh Define the mesh to render\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n ShaderMaterial.prototype.isReady = function (mesh, useInstances) {\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (!this.checkReadyOnEveryCall) {\r\n if (this._renderId === scene.getRenderId()) {\r\n if (this._checkCache(mesh, useInstances)) {\r\n return true;\r\n }\r\n }\r\n }\r\n // Instances\r\n var defines = [];\r\n var attribs = [];\r\n var fallbacks = new _effect__WEBPACK_IMPORTED_MODULE_6__[\"EffectFallbacks\"]();\r\n for (var index = 0; index < this._options.defines.length; index++) {\r\n defines.push(this._options.defines[index]);\r\n }\r\n for (var index = 0; index < this._options.attributes.length; index++) {\r\n attribs.push(this._options.attributes[index]);\r\n }\r\n if (mesh && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind);\r\n defines.push(\"#define VERTEXCOLOR\");\r\n }\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Bones\r\n if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n var skeleton = mesh.skeleton;\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n if (skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n if (this._options.uniforms.indexOf(\"boneTextureWidth\") === -1) {\r\n this._options.uniforms.push(\"boneTextureWidth\");\r\n }\r\n if (this._options.samplers.indexOf(\"boneSampler\") === -1) {\r\n this._options.samplers.push(\"boneSampler\");\r\n }\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton.bones.length + 1));\r\n if (this._options.uniforms.indexOf(\"mBones\") === -1) {\r\n this._options.uniforms.push(\"mBones\");\r\n }\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Textures\r\n for (var name in this._textures) {\r\n if (!this._textures[name].isReady()) {\r\n return false;\r\n }\r\n }\r\n // Alpha test\r\n if (mesh && this._shouldTurnAlphaTestOn(mesh)) {\r\n defines.push(\"#define ALPHATEST\");\r\n }\r\n var previousEffect = this._effect;\r\n var join = defines.join(\"\\n\");\r\n this._effect = engine.createEffect(this._shaderPath, {\r\n attributes: attribs,\r\n uniformsNames: this._options.uniforms,\r\n uniformBuffersNames: this._options.uniformBuffers,\r\n samplers: this._options.samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError\r\n }, engine);\r\n if (!this._effect.isReady()) {\r\n return false;\r\n }\r\n if (previousEffect !== this._effect) {\r\n scene.resetCachedMaterial();\r\n }\r\n this._renderId = scene.getRenderId();\r\n return true;\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n ShaderMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n var scene = this.getScene();\r\n if (!this._effect) {\r\n return;\r\n }\r\n if (this._options.uniforms.indexOf(\"world\") !== -1) {\r\n this._effect.setMatrix(\"world\", world);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldView\") !== -1) {\r\n world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);\r\n this._effect.setMatrix(\"worldView\", this._cachedWorldViewMatrix);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldViewProjection\") !== -1) {\r\n world.multiplyToRef(scene.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);\r\n this._effect.setMatrix(\"worldViewProjection\", this._cachedWorldViewProjectionMatrix);\r\n }\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n */\r\n ShaderMaterial.prototype.bind = function (world, mesh) {\r\n // Std values\r\n this.bindOnlyWorldMatrix(world);\r\n if (this._effect && this.getScene().getCachedMaterial() !== this) {\r\n if (this._options.uniforms.indexOf(\"view\") !== -1) {\r\n this._effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"projection\") !== -1) {\r\n this._effect.setMatrix(\"projection\", this.getScene().getProjectionMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"viewProjection\") !== -1) {\r\n this._effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n }\r\n // Bones\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindBonesParameters(mesh, this._effect);\r\n var name;\r\n // Texture\r\n for (name in this._textures) {\r\n this._effect.setTexture(name, this._textures[name]);\r\n }\r\n // Texture arrays\r\n for (name in this._textureArrays) {\r\n this._effect.setTextureArray(name, this._textureArrays[name]);\r\n }\r\n // Int\r\n for (name in this._ints) {\r\n this._effect.setInt(name, this._ints[name]);\r\n }\r\n // Float\r\n for (name in this._floats) {\r\n this._effect.setFloat(name, this._floats[name]);\r\n }\r\n // Floats\r\n for (name in this._floatsArrays) {\r\n this._effect.setArray(name, this._floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in this._colors3) {\r\n this._effect.setColor3(name, this._colors3[name]);\r\n }\r\n // Color3Array\r\n for (name in this._colors3Arrays) {\r\n this._effect.setArray3(name, this._colors3Arrays[name]);\r\n }\r\n // Color4\r\n for (name in this._colors4) {\r\n var color = this._colors4[name];\r\n this._effect.setFloat4(name, color.r, color.g, color.b, color.a);\r\n }\r\n // Color4Array\r\n for (name in this._colors4Arrays) {\r\n this._effect.setArray4(name, this._colors4Arrays[name]);\r\n }\r\n // Vector2\r\n for (name in this._vectors2) {\r\n this._effect.setVector2(name, this._vectors2[name]);\r\n }\r\n // Vector3\r\n for (name in this._vectors3) {\r\n this._effect.setVector3(name, this._vectors3[name]);\r\n }\r\n // Vector4\r\n for (name in this._vectors4) {\r\n this._effect.setVector4(name, this._vectors4[name]);\r\n }\r\n // Matrix\r\n for (name in this._matrices) {\r\n this._effect.setMatrix(name, this._matrices[name]);\r\n }\r\n // Matrix 3x3\r\n for (name in this._matrices3x3) {\r\n this._effect.setMatrix3x3(name, this._matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in this._matrices2x2) {\r\n this._effect.setMatrix2x2(name, this._matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in this._vectors2Arrays) {\r\n this._effect.setArray2(name, this._vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in this._vectors3Arrays) {\r\n this._effect.setArray3(name, this._vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in this._vectors4Arrays) {\r\n this._effect.setArray4(name, this._vectors4Arrays[name]);\r\n }\r\n }\r\n this._afterBind(mesh);\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n ShaderMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n for (var name in this._textures) {\r\n activeTextures.push(this._textures[name]);\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n activeTextures.push(array[index]);\r\n }\r\n }\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n ShaderMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n for (var name in this._textures) {\r\n if (this._textures[name] === texture) {\r\n return true;\r\n }\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n if (array[index] === texture) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n ShaderMaterial.prototype.clone = function (name) {\r\n var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);\r\n return newShaderMaterial;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n ShaderMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n if (forceDisposeTextures) {\r\n var name;\r\n for (name in this._textures) {\r\n this._textures[name].dispose();\r\n }\r\n for (name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n array[index].dispose();\r\n }\r\n }\r\n }\r\n this._textures = {};\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n ShaderMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.ShaderMaterial\";\r\n serializationObject.options = this._options;\r\n serializationObject.shaderPath = this._shaderPath;\r\n var name;\r\n // Texture\r\n serializationObject.textures = {};\r\n for (name in this._textures) {\r\n serializationObject.textures[name] = this._textures[name].serialize();\r\n }\r\n // Texture arrays\r\n serializationObject.textureArrays = {};\r\n for (name in this._textureArrays) {\r\n serializationObject.textureArrays[name] = [];\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n serializationObject.textureArrays[name].push(array[index].serialize());\r\n }\r\n }\r\n // Float\r\n serializationObject.floats = {};\r\n for (name in this._floats) {\r\n serializationObject.floats[name] = this._floats[name];\r\n }\r\n // Float s\r\n serializationObject.FloatArrays = {};\r\n for (name in this._floatsArrays) {\r\n serializationObject.FloatArrays[name] = this._floatsArrays[name];\r\n }\r\n // Color3\r\n serializationObject.colors3 = {};\r\n for (name in this._colors3) {\r\n serializationObject.colors3[name] = this._colors3[name].asArray();\r\n }\r\n // Color3 array\r\n serializationObject.colors3Arrays = {};\r\n for (name in this._colors3Arrays) {\r\n serializationObject.colors3Arrays[name] = this._colors3Arrays[name];\r\n }\r\n // Color4\r\n serializationObject.colors4 = {};\r\n for (name in this._colors4) {\r\n serializationObject.colors4[name] = this._colors4[name].asArray();\r\n }\r\n // Color4 array\r\n serializationObject.colors4Arrays = {};\r\n for (name in this._colors4Arrays) {\r\n serializationObject.colors4Arrays[name] = this._colors4Arrays[name];\r\n }\r\n // Vector2\r\n serializationObject.vectors2 = {};\r\n for (name in this._vectors2) {\r\n serializationObject.vectors2[name] = this._vectors2[name].asArray();\r\n }\r\n // Vector3\r\n serializationObject.vectors3 = {};\r\n for (name in this._vectors3) {\r\n serializationObject.vectors3[name] = this._vectors3[name].asArray();\r\n }\r\n // Vector4\r\n serializationObject.vectors4 = {};\r\n for (name in this._vectors4) {\r\n serializationObject.vectors4[name] = this._vectors4[name].asArray();\r\n }\r\n // Matrix\r\n serializationObject.matrices = {};\r\n for (name in this._matrices) {\r\n serializationObject.matrices[name] = this._matrices[name].asArray();\r\n }\r\n // Matrix 3x3\r\n serializationObject.matrices3x3 = {};\r\n for (name in this._matrices3x3) {\r\n serializationObject.matrices3x3[name] = this._matrices3x3[name];\r\n }\r\n // Matrix 2x2\r\n serializationObject.matrices2x2 = {};\r\n for (name in this._matrices2x2) {\r\n serializationObject.matrices2x2[name] = this._matrices2x2[name];\r\n }\r\n // Vector2Array\r\n serializationObject.vectors2Arrays = {};\r\n for (name in this._vectors2Arrays) {\r\n serializationObject.vectors2Arrays[name] = this._vectors2Arrays[name];\r\n }\r\n // Vector3Array\r\n serializationObject.vectors3Arrays = {};\r\n for (name in this._vectors3Arrays) {\r\n serializationObject.vectors3Arrays[name] = this._vectors3Arrays[name];\r\n }\r\n // Vector4Array\r\n serializationObject.vectors4Arrays = {};\r\n for (name in this._vectors4Arrays) {\r\n serializationObject.vectors4Arrays[name] = this._vectors4Arrays[name];\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a shader material from parsed shader material data\r\n * @param source defines the JSON represnetation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new material\r\n */\r\n ShaderMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new ShaderMaterial(source.name, scene, source.shaderPath, source.options); }, source, scene, rootUrl);\r\n var name;\r\n // Texture\r\n for (name in source.textures) {\r\n material.setTexture(name, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].Parse(source.textures[name], scene, rootUrl));\r\n }\r\n // Texture arrays\r\n for (name in source.textureArrays) {\r\n var array = source.textureArrays[name];\r\n var textureArray = new Array();\r\n for (var index = 0; index < array.length; index++) {\r\n textureArray.push(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].Parse(array[index], scene, rootUrl));\r\n }\r\n material.setTextureArray(name, textureArray);\r\n }\r\n // Float\r\n for (name in source.floats) {\r\n material.setFloat(name, source.floats[name]);\r\n }\r\n // Float s\r\n for (name in source.floatsArrays) {\r\n material.setFloats(name, source.floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in source.colors3) {\r\n material.setColor3(name, _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"].FromArray(source.colors3[name]));\r\n }\r\n // Color3 arrays\r\n for (name in source.colors3Arrays) {\r\n var colors = source.colors3Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 3 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"].FromArray(color); });\r\n material.setColor3Array(name, colors);\r\n }\r\n // Color4\r\n for (name in source.colors4) {\r\n material.setColor4(name, _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color4\"].FromArray(source.colors4[name]));\r\n }\r\n // Color4 arrays\r\n for (name in source.colors4Arrays) {\r\n var colors = source.colors4Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 4 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color4\"].FromArray(color); });\r\n material.setColor4Array(name, colors);\r\n }\r\n // Vector2\r\n for (name in source.vectors2) {\r\n material.setVector2(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"].FromArray(source.vectors2[name]));\r\n }\r\n // Vector3\r\n for (name in source.vectors3) {\r\n material.setVector3(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(source.vectors3[name]));\r\n }\r\n // Vector4\r\n for (name in source.vectors4) {\r\n material.setVector4(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector4\"].FromArray(source.vectors4[name]));\r\n }\r\n // Matrix\r\n for (name in source.matrices) {\r\n material.setMatrix(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromArray(source.matrices[name]));\r\n }\r\n // Matrix 3x3\r\n for (name in source.matrices3x3) {\r\n material.setMatrix3x3(name, source.matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in source.matrices2x2) {\r\n material.setMatrix2x2(name, source.matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in source.vectors2Arrays) {\r\n material.setArray2(name, source.vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in source.vectors3Arrays) {\r\n material.setArray3(name, source.vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in source.vectors4Arrays) {\r\n material.setArray4(name, source.vectors4Arrays[name]);\r\n }\r\n return material;\r\n };\r\n return ShaderMaterial;\r\n}(_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ShaderMaterial\"] = ShaderMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/standardMaterial.ts\":\n/*!***************************************!*\\\n !*** ./Materials/standardMaterial.ts ***!\n \\***************************************/\n/*! exports provided: StandardMaterialDefines, StandardMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return StandardMaterialDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return StandardMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _pushMaterial__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Shaders_default_fragment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/default.fragment */ \"./Shaders/default.fragment.ts\");\n/* harmony import */ var _Shaders_default_vertex__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Shaders/default.vertex */ \"./Shaders/default.vertex.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar StandardMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StandardMaterialDefines, _super);\r\n function StandardMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.DIFFUSE = false;\r\n _this.DIFFUSEDIRECTUV = 0;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.OPACITY = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.REFLECTION = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.SPECULAR = false;\r\n _this.SPECULARDIRECTUV = 0;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.SPECULAROVERALPHA = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHAFROMDIFFUSE = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.SPECULARTERM = false;\r\n _this.DIFFUSEFRESNEL = false;\r\n _this.OPACITYFRESNEL = false;\r\n _this.REFLECTIONFRESNEL = false;\r\n _this.REFRACTIONFRESNEL = false;\r\n _this.EMISSIVEFRESNEL = false;\r\n _this.FRESNEL = false;\r\n _this.NORMAL = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.VERTEXCOLOR = false;\r\n _this.VERTEXALPHA = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.INSTANCES = false;\r\n _this.GLOSSINESS = false;\r\n _this.ROUGHNESS = false;\r\n _this.EMISSIVEASILLUMINATION = false;\r\n _this.LINKEMISSIVEWITHDIFFUSE = false;\r\n _this.REFLECTIONFRESNELFROMSPECULAR = false;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.REFRACTION = false;\r\n _this.REFRACTIONMAP_3D = false;\r\n _this.REFLECTIONOVERALPHA = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.NONUNIFORMSCALING = false; // https://playground.babylonjs.com#V6DWIH\r\n _this.PREMULTIPLYALPHA = false; // https://playground.babylonjs.com#LNVJJ7\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.MULTIVIEW = false;\r\n /**\r\n * If the reflection texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFLECTION_LINEAR = false;\r\n /**\r\n * If the refraction texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFRACTION_LINEAR = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n StandardMaterialDefines.prototype.setReflectionMode = function (modeToEnable) {\r\n var modes = [\r\n \"REFLECTIONMAP_CUBIC\", \"REFLECTIONMAP_EXPLICIT\", \"REFLECTIONMAP_PLANAR\",\r\n \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_SKYBOX\",\r\n \"REFLECTIONMAP_SPHERICAL\", \"REFLECTIONMAP_EQUIRECTANGULAR\", \"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\",\r\n \"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\"\r\n ];\r\n for (var _i = 0, modes_1 = modes; _i < modes_1.length; _i++) {\r\n var mode = modes_1[_i];\r\n this[mode] = (mode === modeToEnable);\r\n }\r\n };\r\n return StandardMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_9__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see http://doc.babylonjs.com/babylon101/materials\r\n */\r\nvar StandardMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StandardMaterial, _super);\r\n /**\r\n * Instantiates a new standard material.\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see http://doc.babylonjs.com/babylon101/materials\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n function StandardMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._diffuseTexture = null;\r\n _this._ambientTexture = null;\r\n _this._opacityTexture = null;\r\n _this._reflectionTexture = null;\r\n _this._emissiveTexture = null;\r\n _this._specularTexture = null;\r\n _this._bumpTexture = null;\r\n _this._lightmapTexture = null;\r\n _this._refractionTexture = null;\r\n /**\r\n * The color of the material lit by the environmental background lighting.\r\n * @see http://doc.babylonjs.com/babylon101/materials#ambient-color-example\r\n */\r\n _this.ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](0, 0, 0);\r\n /**\r\n * The basic color of the material as viewed under a light.\r\n */\r\n _this.diffuseColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Define how the color and intensity of the highlight given by the light in the material.\r\n */\r\n _this.specularColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Define the color of the material as if self lit.\r\n * This will be mixed in the final result even in the absence of light.\r\n */\r\n _this.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](0, 0, 0);\r\n /**\r\n * Defines how sharp are the highlights in the material.\r\n * The bigger the value the sharper giving a more glossy feeling to the result.\r\n * Reversely, the smaller the value the blurrier giving a more rough feeling to the result.\r\n */\r\n _this.specularPower = 64;\r\n _this._useAlphaFromDiffuseTexture = false;\r\n _this._useEmissiveAsIllumination = false;\r\n _this._linkEmissiveWithDiffuse = false;\r\n _this._useSpecularOverAlpha = false;\r\n _this._useReflectionOverAlpha = false;\r\n _this._disableLighting = false;\r\n _this._useObjectSpaceNormalMap = false;\r\n _this._useParallax = false;\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Apply a scaling factor that determine which \"depth\" the height map should reprensent. A value between 0.05 and 0.1 is reasonnable in Parallax, you can reach 0.2 using Parallax Occlusion.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n _this._roughness = 0;\r\n /**\r\n * In case of refraction, define the value of the index of refraction.\r\n * @see http://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.indexOfRefraction = 0.98;\r\n /**\r\n * Invert the refraction texture alongside the y axis.\r\n * It can be useful with procedural textures or probe for instance.\r\n * @see http://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.invertRefractionY = true;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n _this._useLightmapAsShadowmap = false;\r\n _this._useReflectionFresnelFromSpecular = false;\r\n _this._useGlossinessFromSpecularMapAlpha = false;\r\n _this._maxSimultaneousLights = 4;\r\n _this._invertNormalMapX = false;\r\n _this._invertNormalMapY = false;\r\n _this._twoSidedLighting = false;\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__[\"SmartArray\"](16);\r\n _this._worldViewProjectionMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Zero();\r\n _this._globalAmbientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](0, 0, 0);\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (StandardMaterial.ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && _this._refractionTexture && _this._refractionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._refractionTexture);\r\n }\r\n return _this._renderTargets;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(StandardMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n StandardMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (StandardMaterial.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"StandardMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n StandardMaterial.prototype.getClassName = function () {\r\n return \"StandardMaterial\";\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes)\r\n * You can try switching to logarithmic depth.\r\n * @see http://doc.babylonjs.com/how_to/using_logarithmic_depth_buffer\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n this._markAllSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n StandardMaterial.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture() || this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n StandardMaterial.prototype.needAlphaTesting = function () {\r\n return this._diffuseTexture != null && this._diffuseTexture.hasAlpha;\r\n };\r\n StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function () {\r\n return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture;\r\n };\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns the diffuse texture in case of the standard material.\r\n */\r\n StandardMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._diffuseTexture;\r\n };\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n StandardMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new StandardMaterialDefines();\r\n }\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var engine = scene.getEngine();\r\n // Lights\r\n defines._needNormals = _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n // Multiview\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMultiview(scene, defines);\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n defines.MAINUV1 = false;\r\n defines.MAINUV2 = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._diffuseTexture, defines, \"DIFFUSE\");\r\n }\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n }\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (!this._reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needNormals = true;\r\n defines.REFLECTION = true;\r\n defines.ROUGHNESS = (this._roughness > 0);\r\n defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;\r\n defines.INVERTCUBICMAP = (this._reflectionTexture.coordinatesMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].INVCUBIC_MODE);\r\n defines.REFLECTIONMAP_3D = this._reflectionTexture.isCube;\r\n switch (this._reflectionTexture.coordinatesMode) {\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].EXPLICIT_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EXPLICIT\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].PLANAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PLANAR\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].PROJECTION_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PROJECTION\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].SKYBOX_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SKYBOX\");\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = !this._reflectionTexture.getReflectionTextureMatrix().isIdentity();\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].SPHERICAL_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SPHERICAL\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].FIXED_EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].CUBIC_MODE:\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].INVCUBIC_MODE:\r\n default:\r\n defines.setReflectionMode(\"REFLECTIONMAP_CUBIC\");\r\n break;\r\n }\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = this._reflectionTexture.boundingBoxSize ? true : false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n }\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n if (!this._specularTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._specularTexture, defines, \"SPECULAR\");\r\n defines.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha;\r\n }\r\n }\r\n else {\r\n defines.SPECULAR = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && StandardMaterial.BumpTextureEnabled) {\r\n // Bump texure can not be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n defines.PARALLAX = this._useParallax;\r\n defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n if (!this._refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needUVs = true;\r\n defines.REFRACTION = true;\r\n defines.REFRACTIONMAP_3D = this._refractionTexture.isCube;\r\n }\r\n }\r\n else {\r\n defines.REFRACTION = false;\r\n }\r\n defines.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting;\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n defines.AMBIENT = false;\r\n defines.OPACITY = false;\r\n defines.REFLECTION = false;\r\n defines.EMISSIVE = false;\r\n defines.LIGHTMAP = false;\r\n defines.BUMP = false;\r\n defines.REFRACTION = false;\r\n }\r\n defines.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture();\r\n defines.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination;\r\n defines.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse;\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].ALPHA_PREMULTIPLIED || this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF);\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\r\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\r\n }\r\n if (defines._areFresnelDirty) {\r\n if (StandardMaterial.FresnelEnabled) {\r\n // Fresnel\r\n if (this._diffuseFresnelParameters || this._opacityFresnelParameters ||\r\n this._emissiveFresnelParameters || this._refractionFresnelParameters ||\r\n this._reflectionFresnelParameters) {\r\n defines.DIFFUSEFRESNEL = (this._diffuseFresnelParameters && this._diffuseFresnelParameters.isEnabled);\r\n defines.OPACITYFRESNEL = (this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNEL = (this._reflectionFresnelParameters && this._reflectionFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNELFROMSPECULAR = this._useReflectionFresnelFromSpecular;\r\n defines.REFRACTIONFRESNEL = (this._refractionFresnelParameters && this._refractionFresnelParameters.isEnabled);\r\n defines.EMISSIVEFRESNEL = (this._emissiveFresnelParameters && this._emissiveFresnelParameters.isEnabled);\r\n defines._needNormals = true;\r\n defines.FRESNEL = true;\r\n }\r\n }\r\n else {\r\n defines.FRESNEL = false;\r\n }\r\n }\r\n // Misc.\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n // Attribs\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForAttributes(mesh, defines, true, true, true);\r\n // Values that need to be evaluated on every frame\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n var lightDisposed = defines._areLightsDisposed;\r\n defines.markAsProcessed();\r\n // Fallbacks\r\n var fallbacks = new _effect__WEBPACK_IMPORTED_MODULE_8__[\"EffectFallbacks\"]();\r\n if (defines.REFLECTION) {\r\n fallbacks.addFallback(0, \"REFLECTION\");\r\n }\r\n if (defines.SPECULAR) {\r\n fallbacks.addFallback(0, \"SPECULAR\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(0, \"BUMP\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(1, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(0, \"PARALLAXOCCLUSION\");\r\n }\r\n if (defines.SPECULAROVERALPHA) {\r\n fallbacks.addFallback(0, \"SPECULAROVERALPHA\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(0, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(0, \"SPECULARTERM\");\r\n }\r\n if (defines.DIFFUSEFRESNEL) {\r\n fallbacks.addFallback(1, \"DIFFUSEFRESNEL\");\r\n }\r\n if (defines.OPACITYFRESNEL) {\r\n fallbacks.addFallback(2, \"OPACITYFRESNEL\");\r\n }\r\n if (defines.REFLECTIONFRESNEL) {\r\n fallbacks.addFallback(3, \"REFLECTIONFRESNEL\");\r\n }\r\n if (defines.EMISSIVEFRESNEL) {\r\n fallbacks.addFallback(4, \"EMISSIVEFRESNEL\");\r\n }\r\n if (defines.FRESNEL) {\r\n fallbacks.addFallback(4, \"FRESNEL\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].NormalKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].ColorKind);\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareAttributesForInstances(attribs, defines);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"default\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vDiffuseColor\", \"vSpecularColor\", \"vEmissiveColor\", \"visibility\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vEmissiveInfos\", \"vSpecularInfos\", \"vBumpInfos\", \"vLightmapInfos\", \"vRefractionInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"specularMatrix\", \"bumpMatrix\", \"normalMatrix\", \"lightmapMatrix\", \"refractionMatrix\",\r\n \"diffuseLeftColor\", \"diffuseRightColor\", \"opacityParts\", \"reflectionLeftColor\", \"reflectionRightColor\", \"emissiveLeftColor\", \"emissiveRightColor\", \"refractionLeftColor\", \"refractionRightColor\",\r\n \"vReflectionPosition\", \"vReflectionSize\",\r\n \"logarithmicDepthConstant\", \"vTangentSpaceParams\", \"alphaCutOff\", \"boneTextureWidth\"\r\n ];\r\n var samplers = [\"diffuseSampler\", \"ambientSampler\", \"opacitySampler\", \"reflectionCubeSampler\",\r\n \"reflection2DSampler\", \"emissiveSampler\", \"specularSampler\", \"bumpSampler\", \"lightmapSampler\",\r\n \"refractionCubeSampler\", \"refraction2DSampler\", \"boneSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n if (_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingConfiguration\"]) {\r\n _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, defines);\r\n _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, defines);\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines);\r\n }\r\n var join = defines.toString();\r\n var previousEffect = subMesh.effect;\r\n var effect = scene.getEngine().createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS }\r\n }, engine);\r\n if (effect) {\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Builds the material UBO layouts.\r\n * Used internally during the effect preparation.\r\n */\r\n StandardMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"diffuseLeftColor\", 4);\r\n ubo.addUniform(\"diffuseRightColor\", 4);\r\n ubo.addUniform(\"opacityParts\", 4);\r\n ubo.addUniform(\"reflectionLeftColor\", 4);\r\n ubo.addUniform(\"reflectionRightColor\", 4);\r\n ubo.addUniform(\"refractionLeftColor\", 4);\r\n ubo.addUniform(\"refractionRightColor\", 4);\r\n ubo.addUniform(\"emissiveLeftColor\", 4);\r\n ubo.addUniform(\"emissiveRightColor\", 4);\r\n ubo.addUniform(\"vDiffuseInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 2);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vSpecularInfos\", 2);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"diffuseMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"specularMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"refractionMatrix\", 16);\r\n ubo.addUniform(\"vRefractionInfos\", 4);\r\n ubo.addUniform(\"vSpecularColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n ubo.addUniform(\"vDiffuseColor\", 4);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n StandardMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"refraction2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n StandardMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindBonesParameters(mesh, effect);\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n if (StandardMaterial.FresnelEnabled && defines.FRESNEL) {\r\n // Fresnel\r\n if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"diffuseLeftColor\", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);\r\n ubo.updateColor4(\"diffuseRightColor\", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);\r\n }\r\n if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"opacityParts\", new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);\r\n }\r\n if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"reflectionLeftColor\", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);\r\n ubo.updateColor4(\"reflectionRightColor\", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);\r\n }\r\n if (this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"refractionLeftColor\", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power);\r\n ubo.updateColor4(\"refractionRightColor\", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias);\r\n }\r\n if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"emissiveLeftColor\", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);\r\n ubo.updateColor4(\"emissiveRightColor\", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._diffuseTexture, ubo, \"diffuse\");\r\n if (this._diffuseTexture.hasAlpha) {\r\n effect.setFloat(\"alphaCutOff\", this.alphaCutOff);\r\n }\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n ubo.updateFloat2(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n ubo.updateFloat2(\"vReflectionInfos\", this._reflectionTexture.level, this.roughness);\r\n ubo.updateMatrix(\"reflectionMatrix\", this._reflectionTexture.getReflectionTextureMatrix());\r\n if (this._reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = this._reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n ubo.updateFloat2(\"vSpecularInfos\", this._specularTexture.coordinatesIndex, this._specularTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._specularTexture, ubo, \"specular\");\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level, this.parallaxScaleBias);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (!this._refractionTexture.isCube) {\r\n ubo.updateMatrix(\"refractionMatrix\", this._refractionTexture.getReflectionTextureMatrix());\r\n if (this._refractionTexture.depth) {\r\n depth = this._refractionTexture.depth;\r\n }\r\n }\r\n ubo.updateFloat4(\"vRefractionInfos\", this._refractionTexture.level, this.indexOfRefraction, depth, this.invertRefractionY ? -1 : 1);\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n if (defines.SPECULARTERM) {\r\n ubo.updateColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", StandardMaterial.EmissiveTextureEnabled ? this.emissiveColor : _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"].BlackReadOnly);\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Diffuse\r\n ubo.updateColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n effect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n effect.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n effect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (this._reflectionTexture.isCube) {\r\n effect.setTexture(\"reflectionCubeSampler\", this._reflectionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"reflection2DSampler\", this._reflectionTexture);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n effect.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n effect.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n effect.setTexture(\"specularSampler\", this._specularTexture);\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n effect.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (this._refractionTexture.isCube) {\r\n effect.setTexture(\"refractionCubeSampler\", this._refractionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"refraction2DSampler\", this._refractionTexture);\r\n }\r\n }\r\n }\r\n // Clip plane\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindClipPlane(effect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindEyePosition(effect, scene);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindLights(scene, mesh, effect, defines, this._maxSimultaneousLights, false, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindFogParameters(scene, mesh, effect);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, effect);\r\n }\r\n // Log. depth\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindLogDepth(defines, effect, scene);\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n }\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n StandardMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture && this._specularTexture.animations && this._specularTexture.animations.length > 0) {\r\n results.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n results.push(this._refractionTexture);\r\n }\r\n return results;\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n StandardMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture) {\r\n activeTextures.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n StandardMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._emissiveTexture === texture) {\r\n return true;\r\n }\r\n if (this._specularTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n */\r\n StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._ambientTexture) {\r\n this._ambientTexture.dispose();\r\n }\r\n if (this._opacityTexture) {\r\n this._opacityTexture.dispose();\r\n }\r\n if (this._reflectionTexture) {\r\n this._reflectionTexture.dispose();\r\n }\r\n if (this._emissiveTexture) {\r\n this._emissiveTexture.dispose();\r\n }\r\n if (this._specularTexture) {\r\n this._specularTexture.dispose();\r\n }\r\n if (this._bumpTexture) {\r\n this._bumpTexture.dispose();\r\n }\r\n if (this._lightmapTexture) {\r\n this._lightmapTexture.dispose();\r\n }\r\n if (this._refractionTexture) {\r\n this._refractionTexture.dispose();\r\n }\r\n }\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n StandardMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var result = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new StandardMaterial(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n return result;\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n StandardMaterial.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Creates a standard material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new standard material\r\n */\r\n StandardMaterial.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new StandardMaterial(source.name, scene); }, source, scene, rootUrl);\r\n };\r\n Object.defineProperty(StandardMaterial, \"DiffuseTextureEnabled\", {\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].AmbientTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].OpacityTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].EmissiveTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].SpecularTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].BumpTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].LightmapTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].RefractionTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ColorGradingTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].FresnelEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].FresnelEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"diffuseTexture\")\r\n ], StandardMaterial.prototype, \"_diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"ambientTexture\")\r\n ], StandardMaterial.prototype, \"_ambientTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"ambientTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"opacityTexture\")\r\n ], StandardMaterial.prototype, \"_opacityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"reflectionTexture\")\r\n ], StandardMaterial.prototype, \"_reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"emissiveTexture\")\r\n ], StandardMaterial.prototype, \"_emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"specularTexture\")\r\n ], StandardMaterial.prototype, \"_specularTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"specularTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"bumpTexture\")\r\n ], StandardMaterial.prototype, \"_bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lightmapTexture\")\r\n ], StandardMaterial.prototype, \"_lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"refractionTexture\")\r\n ], StandardMaterial.prototype, \"_refractionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"refractionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"ambient\")\r\n ], StandardMaterial.prototype, \"ambientColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"diffuse\")\r\n ], StandardMaterial.prototype, \"diffuseColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"specular\")\r\n ], StandardMaterial.prototype, \"specularColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"emissive\")\r\n ], StandardMaterial.prototype, \"emissiveColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"specularPower\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useAlphaFromDiffuseTexture\")\r\n ], StandardMaterial.prototype, \"_useAlphaFromDiffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useAlphaFromDiffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useEmissiveAsIllumination\")\r\n ], StandardMaterial.prototype, \"_useEmissiveAsIllumination\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useEmissiveAsIllumination\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"linkEmissiveWithDiffuse\")\r\n ], StandardMaterial.prototype, \"_linkEmissiveWithDiffuse\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"linkEmissiveWithDiffuse\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useSpecularOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useSpecularOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useReflectionOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useReflectionOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"disableLighting\")\r\n ], StandardMaterial.prototype, \"_disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useObjectSpaceNormalMap\")\r\n ], StandardMaterial.prototype, \"_useObjectSpaceNormalMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useParallax\")\r\n ], StandardMaterial.prototype, \"_useParallax\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallax\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useParallaxOcclusion\")\r\n ], StandardMaterial.prototype, \"_useParallaxOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"roughness\")\r\n ], StandardMaterial.prototype, \"_roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"indexOfRefraction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"invertRefractionY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"alphaCutOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useLightmapAsShadowmap\")\r\n ], StandardMaterial.prototype, \"_useLightmapAsShadowmap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"diffuseFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_diffuseFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"diffuseFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"opacityFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_opacityFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"reflectionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_reflectionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"reflectionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"refractionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_refractionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"refractionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"emissiveFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_emissiveFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"emissiveFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useReflectionFresnelFromSpecular\")\r\n ], StandardMaterial.prototype, \"_useReflectionFresnelFromSpecular\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionFresnelFromSpecular\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useGlossinessFromSpecularMapAlpha\")\r\n ], StandardMaterial.prototype, \"_useGlossinessFromSpecularMapAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useGlossinessFromSpecularMapAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"maxSimultaneousLights\")\r\n ], StandardMaterial.prototype, \"_maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"invertNormalMapX\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"invertNormalMapY\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"twoSidedLighting\")\r\n ], StandardMaterial.prototype, \"_twoSidedLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"twoSidedLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"useLogarithmicDepth\", null);\r\n return StandardMaterial;\r\n}(_pushMaterial__WEBPACK_IMPORTED_MODULE_10__[\"PushMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StandardMaterial\"] = StandardMaterial;\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].DefaultMaterialFactory = function (scene) {\r\n return new StandardMaterial(\"default material\", scene);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Materials/uniformBuffer.ts\":\n/*!************************************!*\\\n !*** ./Materials/uniformBuffer.ts ***!\n \\************************************/\n/*! exports provided: UniformBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return UniformBuffer; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n */\r\nvar UniformBuffer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * @see https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n * @param engine Define the engine the buffer is associated with\r\n * @param data Define the data contained in the buffer\r\n * @param dynamic Define if the buffer is updatable\r\n */\r\n function UniformBuffer(engine, data, dynamic) {\r\n // Matrix cache\r\n this._valueCache = {};\r\n this._engine = engine;\r\n this._noUBO = !engine.supportsUniformBuffers;\r\n this._dynamic = dynamic;\r\n this._data = data || [];\r\n this._uniformLocations = {};\r\n this._uniformSizes = {};\r\n this._uniformLocationPointer = 0;\r\n this._needSync = false;\r\n if (this._noUBO) {\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForEffect;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForEffect;\r\n this.updateFloat = this._updateFloatForEffect;\r\n this.updateFloat2 = this._updateFloat2ForEffect;\r\n this.updateFloat3 = this._updateFloat3ForEffect;\r\n this.updateFloat4 = this._updateFloat4ForEffect;\r\n this.updateMatrix = this._updateMatrixForEffect;\r\n this.updateVector3 = this._updateVector3ForEffect;\r\n this.updateVector4 = this._updateVector4ForEffect;\r\n this.updateColor3 = this._updateColor3ForEffect;\r\n this.updateColor4 = this._updateColor4ForEffect;\r\n }\r\n else {\r\n this._engine._uniformBuffers.push(this);\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForUniform;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForUniform;\r\n this.updateFloat = this._updateFloatForUniform;\r\n this.updateFloat2 = this._updateFloat2ForUniform;\r\n this.updateFloat3 = this._updateFloat3ForUniform;\r\n this.updateFloat4 = this._updateFloat4ForUniform;\r\n this.updateMatrix = this._updateMatrixForUniform;\r\n this.updateVector3 = this._updateVector3ForUniform;\r\n this.updateVector4 = this._updateVector4ForUniform;\r\n this.updateColor3 = this._updateColor3ForUniform;\r\n this.updateColor4 = this._updateColor4ForUniform;\r\n }\r\n }\r\n Object.defineProperty(UniformBuffer.prototype, \"useUbo\", {\r\n /**\r\n * Indicates if the buffer is using the WebGL2 UBO implementation,\r\n * or just falling back on setUniformXXX calls.\r\n */\r\n get: function () {\r\n return !this._noUBO;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UniformBuffer.prototype, \"isSync\", {\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is in sync\r\n * with the javascript cache data.\r\n */\r\n get: function () {\r\n return !this._needSync;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is dynamic.\r\n * Also, a dynamic UniformBuffer will disable cache verification and always\r\n * update the underlying WebGL uniform buffer to the GPU.\r\n * @returns if Dynamic, otherwise false\r\n */\r\n UniformBuffer.prototype.isDynamic = function () {\r\n return this._dynamic !== undefined;\r\n };\r\n /**\r\n * The data cache on JS side.\r\n * @returns the underlying data as a float array\r\n */\r\n UniformBuffer.prototype.getData = function () {\r\n return this._bufferData;\r\n };\r\n /**\r\n * The underlying WebGL Uniform buffer.\r\n * @returns the webgl buffer\r\n */\r\n UniformBuffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * std140 layout specifies how to align data within an UBO structure.\r\n * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159\r\n * for specs.\r\n */\r\n UniformBuffer.prototype._fillAlignment = function (size) {\r\n // This code has been simplified because we only use floats, vectors of 1, 2, 3, 4 components\r\n // and 4x4 matrices\r\n // TODO : change if other types are used\r\n var alignment;\r\n if (size <= 2) {\r\n alignment = size;\r\n }\r\n else {\r\n alignment = 4;\r\n }\r\n if ((this._uniformLocationPointer % alignment) !== 0) {\r\n var oldPointer = this._uniformLocationPointer;\r\n this._uniformLocationPointer += alignment - (this._uniformLocationPointer % alignment);\r\n var diff = this._uniformLocationPointer - oldPointer;\r\n for (var i = 0; i < diff; i++) {\r\n this._data.push(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Adds an uniform in the buffer.\r\n * Warning : the subsequents calls of this function must be in the same order as declared in the shader\r\n * for the layout to be correct !\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param size Data size, or data directly.\r\n */\r\n UniformBuffer.prototype.addUniform = function (name, size) {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._uniformLocations[name] !== undefined) {\r\n // Already existing uniform\r\n return;\r\n }\r\n // This function must be called in the order of the shader layout !\r\n // size can be the size of the uniform, or data directly\r\n var data;\r\n if (size instanceof Array) {\r\n data = size;\r\n size = data.length;\r\n }\r\n else {\r\n size = size;\r\n data = [];\r\n // Fill with zeros\r\n for (var i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n }\r\n this._fillAlignment(size);\r\n this._uniformSizes[name] = size;\r\n this._uniformLocations[name] = this._uniformLocationPointer;\r\n this._uniformLocationPointer += size;\r\n for (var i = 0; i < size; i++) {\r\n this._data.push(data[i]);\r\n }\r\n this._needSync = true;\r\n };\r\n /**\r\n * Adds a Matrix 4x4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param mat A 4x4 matrix.\r\n */\r\n UniformBuffer.prototype.addMatrix = function (name, mat) {\r\n this.addUniform(name, Array.prototype.slice.call(mat.toArray()));\r\n };\r\n /**\r\n * Adds a vec2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec2\r\n * @param y Define the y component value of the vec2\r\n */\r\n UniformBuffer.prototype.addFloat2 = function (name, x, y) {\r\n var temp = [x, y];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec3\r\n * @param y Define the y component value of the vec3\r\n * @param z Define the z component value of the vec3\r\n */\r\n UniformBuffer.prototype.addFloat3 = function (name, x, y, z) {\r\n var temp = [x, y, z];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the vec3 from a Color\r\n */\r\n UniformBuffer.prototype.addColor3 = function (name, color) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the rgb components from a Color\r\n * @param alpha Define the a component of the vec4\r\n */\r\n UniformBuffer.prototype.addColor4 = function (name, color, alpha) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n temp.push(alpha);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param vector Define the vec3 components from a Vector\r\n */\r\n UniformBuffer.prototype.addVector3 = function (name, vector) {\r\n var temp = new Array();\r\n vector.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a Matrix 3x3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix3x3 = function (name) {\r\n this.addUniform(name, 12);\r\n };\r\n /**\r\n * Adds a Matrix 2x2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix2x2 = function (name) {\r\n this.addUniform(name, 8);\r\n };\r\n /**\r\n * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.\r\n */\r\n UniformBuffer.prototype.create = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._buffer) {\r\n return; // nothing to do\r\n }\r\n // See spec, alignment must be filled as a vec4\r\n this._fillAlignment(4);\r\n this._bufferData = new Float32Array(this._data);\r\n this._rebuild();\r\n this._needSync = true;\r\n };\r\n /** @hidden */\r\n UniformBuffer.prototype._rebuild = function () {\r\n if (this._noUBO || !this._bufferData) {\r\n return;\r\n }\r\n if (this._dynamic) {\r\n this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData);\r\n }\r\n else {\r\n this._buffer = this._engine.createUniformBuffer(this._bufferData);\r\n }\r\n };\r\n /**\r\n * Updates the WebGL Uniform Buffer on the GPU.\r\n * If the `dynamic` flag is set to true, no cache comparison is done.\r\n * Otherwise, the buffer will be updated only if the cache differs.\r\n */\r\n UniformBuffer.prototype.update = function () {\r\n if (!this._buffer) {\r\n this.create();\r\n return;\r\n }\r\n if (!this._dynamic && !this._needSync) {\r\n return;\r\n }\r\n this._engine.updateUniformBuffer(this._buffer, this._bufferData);\r\n this._needSync = false;\r\n };\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n UniformBuffer.prototype.updateUniform = function (uniformName, data, size) {\r\n var location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n if (this._buffer) {\r\n // Cannot add an uniform if the buffer is already created\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Cannot add an uniform after UBO has been created.\");\r\n return;\r\n }\r\n this.addUniform(uniformName, size);\r\n location = this._uniformLocations[uniformName];\r\n }\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n var changed = false;\r\n for (var i = 0; i < size; i++) {\r\n if (size === 16 || this._bufferData[location + i] !== data[i]) {\r\n changed = true;\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n this._needSync = this._needSync || changed;\r\n }\r\n else {\r\n // No cache for dynamic\r\n for (var i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n };\r\n UniformBuffer.prototype._cacheMatrix = function (name, matrix) {\r\n var cache = this._valueCache[name];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[name] = flag;\r\n return true;\r\n };\r\n // Update methods\r\n UniformBuffer.prototype._updateMatrix3x3ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 3; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 3];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 3 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = matrix[i * 3 + 2];\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 12);\r\n };\r\n UniformBuffer.prototype._updateMatrix3x3ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix3x3(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix2x2(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 2; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 2];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 2 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = 0.0;\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 8);\r\n };\r\n UniformBuffer.prototype._updateFloatForEffect = function (name, x) {\r\n this._currentEffect.setFloat(name, x);\r\n };\r\n UniformBuffer.prototype._updateFloatForUniform = function (name, x) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 1);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForEffect = function (name, x, y, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat2(name + suffix, x, y);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForUniform = function (name, x, y) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 2);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForEffect = function (name, x, y, z, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat3(name + suffix, x, y, z);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForUniform = function (name, x, y, z) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForEffect = function (name, x, y, z, w, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat4(name + suffix, x, y, z, w);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForUniform = function (name, x, y, z, w) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n UniformBuffer._tempBuffer[3] = w;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateMatrixForEffect = function (name, mat) {\r\n this._currentEffect.setMatrix(name, mat);\r\n };\r\n UniformBuffer.prototype._updateMatrixForUniform = function (name, mat) {\r\n if (this._cacheMatrix(name, mat)) {\r\n this.updateUniform(name, mat.toArray(), 16);\r\n }\r\n };\r\n UniformBuffer.prototype._updateVector3ForEffect = function (name, vector) {\r\n this._currentEffect.setVector3(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector3ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateVector4ForEffect = function (name, vector) {\r\n this._currentEffect.setVector4(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector4ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateColor3ForEffect = function (name, color, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor3(name + suffix, color);\r\n };\r\n UniformBuffer.prototype._updateColor3ForUniform = function (name, color) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateColor4ForEffect = function (name, color, alpha, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor4(name + suffix, color, alpha);\r\n };\r\n UniformBuffer.prototype._updateColor4ForUniform = function (name, color, alpha) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n UniformBuffer._tempBuffer[3] = alpha;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the texture to set in the sampler\r\n */\r\n UniformBuffer.prototype.setTexture = function (name, texture) {\r\n this._currentEffect.setTexture(name, texture);\r\n };\r\n /**\r\n * Directly updates the value of the uniform in the cache AND on the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n */\r\n UniformBuffer.prototype.updateUniformDirectly = function (uniformName, data) {\r\n this.updateUniform(uniformName, data, data.length);\r\n this.update();\r\n };\r\n /**\r\n * Binds this uniform buffer to an effect.\r\n * @param effect Define the effect to bind the buffer to\r\n * @param name Name of the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.bindToEffect = function (effect, name) {\r\n this._currentEffect = effect;\r\n if (this._noUBO || !this._buffer) {\r\n return;\r\n }\r\n effect.bindUniformBuffer(this._buffer, name);\r\n };\r\n /**\r\n * Disposes the uniform buffer.\r\n */\r\n UniformBuffer.prototype.dispose = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n var uniformBuffers = this._engine._uniformBuffers;\r\n var index = uniformBuffers.indexOf(this);\r\n if (index !== -1) {\r\n uniformBuffers[index] = uniformBuffers[uniformBuffers.length - 1];\r\n uniformBuffers.pop();\r\n }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n // Pool for avoiding memory leaks\r\n UniformBuffer._MAX_UNIFORM_SIZE = 256;\r\n UniformBuffer._tempBuffer = new Float32Array(UniformBuffer._MAX_UNIFORM_SIZE);\r\n return UniformBuffer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/index.ts\":\n/*!************************!*\\\n !*** ./Maths/index.ts ***!\n \\************************/\n/*! exports provided: Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, PositionNormalVertex, PositionNormalTextureVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"]; });\n\n/* harmony import */ var _math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math */ \"./Maths/math.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Axis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"TmpColors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Frustum\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Curve3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Size\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Viewport\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony import */ var _sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return _sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalHarmonics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return _sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalPolynomial\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.axis.ts\":\n/*!****************************!*\\\n !*** ./Maths/math.axis.ts ***!\n \\****************************/\n/*! exports provided: Space, Axis */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return Space; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return Axis; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/** Defines supported spaces */\r\nvar Space;\r\n(function (Space) {\r\n /** Local (object) space */\r\n Space[Space[\"LOCAL\"] = 0] = \"LOCAL\";\r\n /** World space */\r\n Space[Space[\"WORLD\"] = 1] = \"WORLD\";\r\n /** Bone space */\r\n Space[Space[\"BONE\"] = 2] = \"BONE\";\r\n})(Space || (Space = {}));\r\n/** Defines the 3 main axes */\r\nvar Axis = /** @class */ (function () {\r\n function Axis() {\r\n }\r\n /** X axis */\r\n Axis.X = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 0.0, 0.0);\r\n /** Y axis */\r\n Axis.Y = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0.0, 1.0, 0.0);\r\n /** Z axis */\r\n Axis.Z = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0.0, 0.0, 1.0);\r\n return Axis;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.color.ts\":\n/*!*****************************!*\\\n !*** ./Maths/math.color.ts ***!\n \\*****************************/\n/*! exports provided: Color3, Color4, TmpColors */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return Color3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return Color4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return TmpColors; });\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to hold a RBG color\r\n */\r\nvar Color3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color3 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n */\r\n function Color3(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n }\r\n /**\r\n * Creates a string with the Color3 current values\r\n * @returns the string representation of the Color3 object\r\n */\r\n Color3.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color3\"\r\n * @returns \"Color3\"\r\n */\r\n Color3.prototype.getClassName = function () {\r\n return \"Color3\";\r\n };\r\n /**\r\n * Compute the Color3 hash code\r\n * @returns an unique number that can be used to hash Color3 objects\r\n */\r\n Color3.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Stores in the given array from the given starting index the red, green, blue values as successive elements\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color4 object from the current Color3 and the given alpha\r\n * @param alpha defines the alpha component on the new Color4 object (default is 1)\r\n * @returns a new Color4 object\r\n */\r\n Color3.prototype.toColor4 = function (alpha) {\r\n if (alpha === void 0) { alpha = 1; }\r\n return new Color4(this.r, this.g, this.b, alpha);\r\n };\r\n /**\r\n * Returns a new array populated with 3 numeric elements : red, green and blue values\r\n * @returns the new array\r\n */\r\n Color3.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Returns the luminance value\r\n * @returns a float value\r\n */\r\n Color3.prototype.toLuminance = function () {\r\n return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;\r\n };\r\n /**\r\n * Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3 object\r\n */\r\n Color3.prototype.multiply = function (otherColor) {\r\n return new Color3(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);\r\n };\r\n /**\r\n * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the current Color3\r\n */\r\n Color3.prototype.multiplyToRef = function (otherColor, result) {\r\n result.r = this.r * otherColor.r;\r\n result.g = this.g * otherColor.g;\r\n result.b = this.b * otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color3 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b;\r\n };\r\n /**\r\n * Determines equality between the current Color3 object and a set of r,b,g values\r\n * @param r defines the red component to check\r\n * @param g defines the green component to check\r\n * @param b defines the blue component to check\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equalsFloats = function (r, g, b) {\r\n return this.r === r && this.g === g && this.b === b;\r\n };\r\n /**\r\n * Multiplies in place each rgb value by scale\r\n * @param scale defines the scaling factor\r\n * @returns the updated Color3\r\n */\r\n Color3.prototype.scale = function (scale) {\r\n return new Color3(this.r * scale, this.g * scale, this.b * scale);\r\n };\r\n /**\r\n * Multiplies the rgb values by scale and stores the result into \"result\"\r\n * @param scale defines the scaling factor\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color3 values by a factor and add the result to a given Color3\r\n * @param scale defines the scale factor\r\n * @param result defines color to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into\r\n * @returns the original Color3\r\n */\r\n Color3.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.r, min, max);\r\n result.g = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.g, min, max);\r\n result.b = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.b, min, max);\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color3 set with the added values of the current Color3 and of the given one\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.add = function (otherColor) {\r\n return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the addition of the current Color3 and given one rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.addToRef = function (otherColor, result) {\r\n result.r = this.r + otherColor.r;\r\n result.g = this.g + otherColor.g;\r\n result.b = this.b + otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color3 set with the subtracted values of the given one from the current Color3\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.subtract = function (otherColor) {\r\n return new Color3(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the subtraction of given one from the current Color3 rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.subtractToRef = function (otherColor, result) {\r\n result.r = this.r - otherColor.r;\r\n result.g = this.g - otherColor.g;\r\n result.b = this.b - otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Copy the current object\r\n * @returns a new Color3 copied the current one\r\n */\r\n Color3.prototype.clone = function () {\r\n return new Color3(this.r, this.g, this.b);\r\n };\r\n /**\r\n * Copies the rgb values from the source in the current Color3\r\n * @param source defines the source Color3 object\r\n * @returns the updated Color3 object\r\n */\r\n Color3.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.copyFromFloats = function (r, g, b) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.set = function (r, g, b) {\r\n return this.copyFromFloats(r, g, b);\r\n };\r\n /**\r\n * Compute the Color3 hexadecimal code as a string\r\n * @returns a string containing the hexadecimal representation of the Color3 object\r\n */\r\n Color3.prototype.toHexString = function () {\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n return \"#\" + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intR) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intG) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intB);\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to linear space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @returns a new color3 representing the HSV values\r\n */\r\n Color3.prototype.toHSV = function () {\r\n var result = new Color3();\r\n this.toHSVToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @param result defines the Color3 where to store the HSV values\r\n */\r\n Color3.prototype.toHSVToRef = function (result) {\r\n var r = this.r;\r\n var g = this.g;\r\n var b = this.b;\r\n var max = Math.max(r, g, b);\r\n var min = Math.min(r, g, b);\r\n var h = 0;\r\n var s = 0;\r\n var v = max;\r\n var dm = max - min;\r\n if (max !== 0) {\r\n s = dm / max;\r\n }\r\n if (max != min) {\r\n if (max == r) {\r\n h = (g - b) / dm;\r\n if (g < b) {\r\n h += 6;\r\n }\r\n }\r\n else if (max == g) {\r\n h = (b - r) / dm + 2;\r\n }\r\n else if (max == b) {\r\n h = (r - g) / dm + 4;\r\n }\r\n h *= 60;\r\n }\r\n result.r = h;\r\n result.g = s;\r\n result.b = v;\r\n };\r\n /**\r\n * Converts the Color3 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the linear space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to gamma space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color3 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the gamma space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n return this;\r\n };\r\n /**\r\n * Convert Hue, saturation and value to a Color3 (RGB)\r\n * @param hue defines the hue\r\n * @param saturation defines the saturation\r\n * @param value defines the value\r\n * @param result defines the Color3 where to store the RGB values\r\n */\r\n Color3.HSVtoRGBToRef = function (hue, saturation, value, result) {\r\n var chroma = value * saturation;\r\n var h = hue / 60;\r\n var x = chroma * (1 - Math.abs((h % 2) - 1));\r\n var r = 0;\r\n var g = 0;\r\n var b = 0;\r\n if (h >= 0 && h <= 1) {\r\n r = chroma;\r\n g = x;\r\n }\r\n else if (h >= 1 && h <= 2) {\r\n r = x;\r\n g = chroma;\r\n }\r\n else if (h >= 2 && h <= 3) {\r\n g = chroma;\r\n b = x;\r\n }\r\n else if (h >= 3 && h <= 4) {\r\n g = x;\r\n b = chroma;\r\n }\r\n else if (h >= 4 && h <= 5) {\r\n r = x;\r\n b = chroma;\r\n }\r\n else if (h >= 5 && h <= 6) {\r\n r = chroma;\r\n b = x;\r\n }\r\n var m = value - chroma;\r\n result.set((r + m), (g + m), (b + m));\r\n };\r\n /**\r\n * Creates a new Color3 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 7) {\r\n return new Color3(0, 0, 0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n return Color3.FromInts(r, g, b);\r\n };\r\n /**\r\n * Creates a new Color3 from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromInts = function (r, g, b) {\r\n return new Color3(r / 255.0, g / 255.0, b / 255.0);\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param start defines the start Color3 value\r\n * @param end defines the end Color3 value\r\n * @param amount defines the gradient value between start and end\r\n * @returns a new Color3 object\r\n */\r\n Color3.Lerp = function (start, end, amount) {\r\n var result = new Color3(0.0, 0.0, 0.0);\r\n Color3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color3 object where to store the result\r\n */\r\n Color3.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + ((right.r - left.r) * amount);\r\n result.g = left.g + ((right.g - left.g) * amount);\r\n result.b = left.b + ((right.b - left.b) * amount);\r\n };\r\n /**\r\n * Returns a Color3 value containing a red color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Red = function () { return new Color3(1, 0, 0); };\r\n /**\r\n * Returns a Color3 value containing a green color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Green = function () { return new Color3(0, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a blue color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Blue = function () { return new Color3(0, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a black color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Black = function () { return new Color3(0, 0, 0); };\r\n Object.defineProperty(Color3, \"BlackReadOnly\", {\r\n /**\r\n * Gets a Color3 value containing a black color that must not be updated\r\n */\r\n get: function () {\r\n return Color3._BlackReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a Color3 value containing a white color\r\n * @returns a new Color3 object\r\n */\r\n Color3.White = function () { return new Color3(1, 1, 1); };\r\n /**\r\n * Returns a Color3 value containing a purple color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Purple = function () { return new Color3(0.5, 0, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a magenta color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Magenta = function () { return new Color3(1, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a yellow color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Yellow = function () { return new Color3(1, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a gray color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Gray = function () { return new Color3(0.5, 0.5, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a teal color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Teal = function () { return new Color3(0, 1.0, 1.0); };\r\n /**\r\n * Returns a Color3 value containing a random color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Random = function () { return new Color3(Math.random(), Math.random(), Math.random()); };\r\n // Statics\r\n Color3._BlackReadOnly = Color3.Black();\r\n return Color3;\r\n}());\r\n\r\n/**\r\n * Class used to hold a RBGA color\r\n */\r\nvar Color4 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color4 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n * @param a defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n function Color4(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b, \r\n /**\r\n * Defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n a) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n if (a === void 0) { a = 1; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n }\r\n // Operators\r\n /**\r\n * Adds in place the given Color4 values to the current Color4 object\r\n * @param right defines the second operand\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.addInPlace = function (right) {\r\n this.r += right.r;\r\n this.g += right.g;\r\n this.b += right.b;\r\n this.a += right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new array populated with 4 numeric elements : red, green, blue, alpha values\r\n * @returns the new array\r\n */\r\n Color4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Stores from the starting index in the given array the Color4 successive values\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n array[index + 3] = this.a;\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color4 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgba values are equal to the given ones\r\n */\r\n Color4.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b && this.a === otherColor.a;\r\n };\r\n /**\r\n * Creates a new Color4 set with the added values of the current Color4 and of the given one\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.add = function (right) {\r\n return new Color4(this.r + right.r, this.g + right.g, this.b + right.b, this.a + right.a);\r\n };\r\n /**\r\n * Creates a new Color4 set with the subtracted values of the given one from the current Color4\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.subtract = function (right) {\r\n return new Color4(this.r - right.r, this.g - right.g, this.b - right.b, this.a - right.a);\r\n };\r\n /**\r\n * Subtracts the given ones from the current Color4 values and stores the results in \"result\"\r\n * @param right defines the second operand\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.subtractToRef = function (right, result) {\r\n result.r = this.r - right.r;\r\n result.g = this.g - right.g;\r\n result.b = this.b - right.b;\r\n result.a = this.a - right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color4 with the current Color4 values multiplied by scale\r\n * @param scale defines the scaling factor to apply\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.scale = function (scale) {\r\n return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);\r\n };\r\n /**\r\n * Multiplies the current Color4 values by scale and stores the result in \"result\"\r\n * @param scale defines the scaling factor to apply\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current unmodified Color4\r\n */\r\n Color4.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n result.a = this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color4 values by a factor and add the result to a given Color4\r\n * @param scale defines the scale factor\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the unmodified current Color4\r\n */\r\n Color4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n result.a += this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into.\r\n * @returns the cuurent Color4\r\n */\r\n Color4.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.r, min, max);\r\n result.g = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.g, min, max);\r\n result.b = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.b, min, max);\r\n result.a = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.a, min, max);\r\n return this;\r\n };\r\n /**\r\n * Multipy an Color4 value by another and return a new Color4 object\r\n * @param color defines the Color4 value to multiply by\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.multiply = function (color) {\r\n return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);\r\n };\r\n /**\r\n * Multipy a Color4 value by another and push the result in a reference value\r\n * @param color defines the Color4 value to multiply by\r\n * @param result defines the Color4 to fill the result in\r\n * @returns the result Color4\r\n */\r\n Color4.prototype.multiplyToRef = function (color, result) {\r\n result.r = this.r * color.r;\r\n result.g = this.g * color.g;\r\n result.b = this.b * color.b;\r\n result.a = this.a * color.a;\r\n return result;\r\n };\r\n /**\r\n * Creates a string with the Color4 current values\r\n * @returns the string representation of the Color4 object\r\n */\r\n Color4.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \" A:\" + this.a + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color4\"\r\n * @returns \"Color4\"\r\n */\r\n Color4.prototype.getClassName = function () {\r\n return \"Color4\";\r\n };\r\n /**\r\n * Compute the Color4 hash code\r\n * @returns an unique number that can be used to hash Color4 objects\r\n */\r\n Color4.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n hash = (hash * 397) ^ ((this.a * 255) | 0);\r\n return hash;\r\n };\r\n /**\r\n * Creates a new Color4 copied from the current one\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.clone = function () {\r\n return new Color4(this.r, this.g, this.b, this.a);\r\n };\r\n /**\r\n * Copies the given Color4 values into the current one\r\n * @param source defines the source Color4 object\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n this.a = source.a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFromFloats = function (r, g, b, a) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.set = function (r, g, b, a) {\r\n return this.copyFromFloats(r, g, b, a);\r\n };\r\n /**\r\n * Compute the Color4 hexadecimal code as a string\r\n * @returns a string containing the hexadecimal representation of the Color4 object\r\n */\r\n Color4.prototype.toHexString = function () {\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n var intA = (this.a * 255) | 0;\r\n return \"#\" + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intR) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intG) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intB) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intA);\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to linear space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the linear space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to gamma space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the gamma space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new Color4 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 9) {\r\n return new Color4(0.0, 0.0, 0.0, 0.0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n var a = parseInt(hex.substring(7, 9), 16);\r\n return Color4.FromInts(r, g, b, a);\r\n };\r\n /**\r\n * Creates a new Color4 object set with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @returns a new Color4 object\r\n */\r\n Color4.Lerp = function (left, right, amount) {\r\n var result = new Color4(0.0, 0.0, 0.0, 0.0);\r\n Color4.LerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given \"result\" with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color4 object where to store data\r\n */\r\n Color4.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + (right.r - left.r) * amount;\r\n result.g = left.g + (right.g - left.g) * amount;\r\n result.b = left.b + (right.b - left.b) * amount;\r\n result.a = left.a + (right.a - left.a) * amount;\r\n };\r\n /**\r\n * Creates a new Color4 from a Color3 and an alpha value\r\n * @param color3 defines the source Color3 to read from\r\n * @param alpha defines the alpha component (1.0 by default)\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromColor3 = function (color3, alpha) {\r\n if (alpha === void 0) { alpha = 1.0; }\r\n return new Color4(color3.r, color3.g, color3.b, alpha);\r\n };\r\n /**\r\n * Creates a new Color4 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @param a defines the alpha component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color4.FromInts = function (r, g, b, a) {\r\n return new Color4(r / 255.0, g / 255.0, b / 255.0, a / 255.0);\r\n };\r\n /**\r\n * Check the content of a given array and convert it to an array containing RGBA data\r\n * If the original array was already containing count * 4 values then it is returned directly\r\n * @param colors defines the array to check\r\n * @param count defines the number of RGBA data to expect\r\n * @returns an array containing count * 4 values (RGBA)\r\n */\r\n Color4.CheckColors4 = function (colors, count) {\r\n // Check if color3 was used\r\n if (colors.length === count * 3) {\r\n var colors4 = [];\r\n for (var index = 0; index < colors.length; index += 3) {\r\n var newIndex = (index / 3) * 4;\r\n colors4[newIndex] = colors[index];\r\n colors4[newIndex + 1] = colors[index + 1];\r\n colors4[newIndex + 2] = colors[index + 2];\r\n colors4[newIndex + 3] = 1.0;\r\n }\r\n return colors4;\r\n }\r\n return colors;\r\n };\r\n return Color4;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar TmpColors = /** @class */ (function () {\r\n function TmpColors() {\r\n }\r\n TmpColors.Color3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Color3.Black);\r\n TmpColors.Color4 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, function () { return new Color4(0, 0, 0, 0); });\r\n return TmpColors;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Color3\"] = Color3;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Color4\"] = Color4;\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.constants.ts\":\n/*!*********************************!*\\\n !*** ./Maths/math.constants.ts ***!\n \\*********************************/\n/*! exports provided: ToGammaSpace, ToLinearSpace, Epsilon */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return ToGammaSpace; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return ToLinearSpace; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return Epsilon; });\n/**\r\n * Constant used to convert a value to gamma space\r\n * @ignorenaming\r\n */\r\nvar ToGammaSpace = 1 / 2.2;\r\n/**\r\n * Constant used to convert a value to linear space\r\n * @ignorenaming\r\n */\r\nvar ToLinearSpace = 2.2;\r\n/**\r\n * Constant used to define the minimal number value in Babylon.js\r\n * @ignorenaming\r\n */\r\nvar Epsilon = 0.001;\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.frustum.ts\":\n/*!*******************************!*\\\n !*** ./Maths/math.frustum.ts ***!\n \\*******************************/\n/*! exports provided: Frustum */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return Frustum; });\n/* harmony import */ var _math_plane__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.plane */ \"./Maths/math.plane.ts\");\n\r\n/**\r\n * Reprasents a camera frustum\r\n */\r\nvar Frustum = /** @class */ (function () {\r\n function Frustum() {\r\n }\r\n /**\r\n * Gets the planes representing the frustum\r\n * @param transform matrix to be applied to the returned planes\r\n * @returns a new array of 6 Frustum planes computed by the given transformation matrix.\r\n */\r\n Frustum.GetPlanes = function (transform) {\r\n var frustumPlanes = [];\r\n for (var index = 0; index < 6; index++) {\r\n frustumPlanes.push(new _math_plane__WEBPACK_IMPORTED_MODULE_0__[\"Plane\"](0.0, 0.0, 0.0, 0.0));\r\n }\r\n Frustum.GetPlanesToRef(transform, frustumPlanes);\r\n return frustumPlanes;\r\n };\r\n /**\r\n * Gets the near frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetNearPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[2];\r\n frustumPlane.normal.y = m[7] + m[6];\r\n frustumPlane.normal.z = m[11] + m[10];\r\n frustumPlane.d = m[15] + m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the far frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetFarPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[2];\r\n frustumPlane.normal.y = m[7] - m[6];\r\n frustumPlane.normal.z = m[11] - m[10];\r\n frustumPlane.d = m[15] - m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the left frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetLeftPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[0];\r\n frustumPlane.normal.y = m[7] + m[4];\r\n frustumPlane.normal.z = m[11] + m[8];\r\n frustumPlane.d = m[15] + m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the right frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetRightPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[0];\r\n frustumPlane.normal.y = m[7] - m[4];\r\n frustumPlane.normal.z = m[11] - m[8];\r\n frustumPlane.d = m[15] - m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the top frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetTopPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[1];\r\n frustumPlane.normal.y = m[7] - m[5];\r\n frustumPlane.normal.z = m[11] - m[9];\r\n frustumPlane.d = m[15] - m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the bottom frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetBottomPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[1];\r\n frustumPlane.normal.y = m[7] + m[5];\r\n frustumPlane.normal.z = m[11] + m[9];\r\n frustumPlane.d = m[15] + m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Sets the given array \"frustumPlanes\" with the 6 Frustum planes computed by the given transformation matrix.\r\n * @param transform transformation matrix to be applied to the resulting frustum planes\r\n * @param frustumPlanes the resuling frustum planes\r\n */\r\n Frustum.GetPlanesToRef = function (transform, frustumPlanes) {\r\n // Near\r\n Frustum.GetNearPlaneToRef(transform, frustumPlanes[0]);\r\n // Far\r\n Frustum.GetFarPlaneToRef(transform, frustumPlanes[1]);\r\n // Left\r\n Frustum.GetLeftPlaneToRef(transform, frustumPlanes[2]);\r\n // Right\r\n Frustum.GetRightPlaneToRef(transform, frustumPlanes[3]);\r\n // Top\r\n Frustum.GetTopPlaneToRef(transform, frustumPlanes[4]);\r\n // Bottom\r\n Frustum.GetBottomPlaneToRef(transform, frustumPlanes[5]);\r\n };\r\n return Frustum;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.functions.ts\":\n/*!*********************************!*\\\n !*** ./Maths/math.functions.ts ***!\n \\*********************************/\n/*! exports provided: extractMinAndMaxIndexed, extractMinAndMax */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractMinAndMaxIndexed\", function() { return extractMinAndMaxIndexed; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractMinAndMax\", function() { return extractMinAndMax; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Extracts minimum and maximum values from a list of indexed positions\r\n * @param positions defines the positions to use\r\n * @param indices defines the indices to the positions\r\n * @param indexStart defines the start index\r\n * @param indexCount defines the end index\r\n * @param bias defines bias value to add to the result\r\n * @return minimum and maximum values\r\n */\r\nfunction extractMinAndMaxIndexed(positions, indices, indexStart, indexCount, bias) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var index = indexStart; index < indexStart + indexCount; index++) {\r\n var offset = indices[index] * 3;\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n/**\r\n * Extracts minimum and maximum values from a list of positions\r\n * @param positions defines the positions to use\r\n * @param start defines the start index in the positions array\r\n * @param count defines the number of positions to handle\r\n * @param bias defines bias value to add to the result\r\n * @param stride defines the stride size to use (distance between two positions in the positions array)\r\n * @return minimum and maximum values\r\n */\r\nfunction extractMinAndMax(positions, start, count, bias, stride) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n if (!stride) {\r\n stride = 3;\r\n }\r\n for (var index = start, offset = start * stride; index < start + count; index++, offset += stride) {\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.path.ts\":\n/*!****************************!*\\\n !*** ./Maths/math.path.ts ***!\n \\****************************/\n/*! exports provided: Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return Orientation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return BezierCurve; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return Angle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return Arc2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return Path2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return Path3D; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return Curve3; });\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n/**\r\n * Defines potential orientation for back face culling\r\n */\r\nvar Orientation;\r\n(function (Orientation) {\r\n /**\r\n * Clockwise\r\n */\r\n Orientation[Orientation[\"CW\"] = 0] = \"CW\";\r\n /** Counter clockwise */\r\n Orientation[Orientation[\"CCW\"] = 1] = \"CCW\";\r\n})(Orientation || (Orientation = {}));\r\n/** Class used to represent a Bezier curve */\r\nvar BezierCurve = /** @class */ (function () {\r\n function BezierCurve() {\r\n }\r\n /**\r\n * Returns the cubic Bezier interpolated value (float) at \"t\" (float) from the given x1, y1, x2, y2 floats\r\n * @param t defines the time\r\n * @param x1 defines the left coordinate on X axis\r\n * @param y1 defines the left coordinate on Y axis\r\n * @param x2 defines the right coordinate on X axis\r\n * @param y2 defines the right coordinate on Y axis\r\n * @returns the interpolated value\r\n */\r\n BezierCurve.Interpolate = function (t, x1, y1, x2, y2) {\r\n // Extract X (which is equal to time here)\r\n var f0 = 1 - 3 * x2 + 3 * x1;\r\n var f1 = 3 * x2 - 6 * x1;\r\n var f2 = 3 * x1;\r\n var refinedT = t;\r\n for (var i = 0; i < 5; i++) {\r\n var refinedT2 = refinedT * refinedT;\r\n var refinedT3 = refinedT2 * refinedT;\r\n var x = f0 * refinedT3 + f1 * refinedT2 + f2 * refinedT;\r\n var slope = 1.0 / (3.0 * f0 * refinedT2 + 2.0 * f1 * refinedT + f2);\r\n refinedT -= (x - t) * slope;\r\n refinedT = Math.min(1, Math.max(0, refinedT));\r\n }\r\n // Resolve cubic bezier for the given x\r\n return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 +\r\n 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 +\r\n Math.pow(refinedT, 3);\r\n };\r\n return BezierCurve;\r\n}());\r\n\r\n/**\r\n * Defines angle representation\r\n */\r\nvar Angle = /** @class */ (function () {\r\n /**\r\n * Creates an Angle object of \"radians\" radians (float).\r\n * @param radians the angle in radians\r\n */\r\n function Angle(radians) {\r\n this._radians = radians;\r\n if (this._radians < 0.0) {\r\n this._radians += (2.0 * Math.PI);\r\n }\r\n }\r\n /**\r\n * Get value in degrees\r\n * @returns the Angle value in degrees (float)\r\n */\r\n Angle.prototype.degrees = function () {\r\n return this._radians * 180.0 / Math.PI;\r\n };\r\n /**\r\n * Get value in radians\r\n * @returns the Angle value in radians (float)\r\n */\r\n Angle.prototype.radians = function () {\r\n return this._radians;\r\n };\r\n /**\r\n * Gets a new Angle object valued with the angle value in radians between the two given vectors\r\n * @param a defines first vector\r\n * @param b defines second vector\r\n * @returns a new Angle\r\n */\r\n Angle.BetweenTwoPoints = function (a, b) {\r\n var delta = b.subtract(a);\r\n var theta = Math.atan2(delta.y, delta.x);\r\n return new Angle(theta);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in radians\r\n * @param radians defines the angle value in radians\r\n * @returns a new Angle\r\n */\r\n Angle.FromRadians = function (radians) {\r\n return new Angle(radians);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in degrees\r\n * @param degrees defines the angle value in degrees\r\n * @returns a new Angle\r\n */\r\n Angle.FromDegrees = function (degrees) {\r\n return new Angle(degrees * Math.PI / 180.0);\r\n };\r\n return Angle;\r\n}());\r\n\r\n/**\r\n * This represents an arc in a 2d space.\r\n */\r\nvar Arc2 = /** @class */ (function () {\r\n /**\r\n * Creates an Arc object from the three given points : start, middle and end.\r\n * @param startPoint Defines the start point of the arc\r\n * @param midPoint Defines the midlle point of the arc\r\n * @param endPoint Defines the end point of the arc\r\n */\r\n function Arc2(\r\n /** Defines the start point of the arc */\r\n startPoint, \r\n /** Defines the mid point of the arc */\r\n midPoint, \r\n /** Defines the end point of the arc */\r\n endPoint) {\r\n this.startPoint = startPoint;\r\n this.midPoint = midPoint;\r\n this.endPoint = endPoint;\r\n var temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);\r\n var startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2.;\r\n var midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2.;\r\n var det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);\r\n this.centerPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"]((startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det, ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det);\r\n this.radius = this.centerPoint.subtract(this.startPoint).length();\r\n this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);\r\n var a1 = this.startAngle.degrees();\r\n var a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();\r\n var a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();\r\n // angles correction\r\n if (a2 - a1 > +180.0) {\r\n a2 -= 360.0;\r\n }\r\n if (a2 - a1 < -180.0) {\r\n a2 += 360.0;\r\n }\r\n if (a3 - a2 > +180.0) {\r\n a3 -= 360.0;\r\n }\r\n if (a3 - a2 < -180.0) {\r\n a3 += 360.0;\r\n }\r\n this.orientation = (a2 - a1) < 0 ? Orientation.CW : Orientation.CCW;\r\n this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);\r\n }\r\n return Arc2;\r\n}());\r\n\r\n/**\r\n * Represents a 2D path made up of multiple 2D points\r\n */\r\nvar Path2 = /** @class */ (function () {\r\n /**\r\n * Creates a Path2 object from the starting 2D coordinates x and y.\r\n * @param x the starting points x value\r\n * @param y the starting points y value\r\n */\r\n function Path2(x, y) {\r\n this._points = new Array();\r\n this._length = 0.0;\r\n /**\r\n * If the path start and end point are the same\r\n */\r\n this.closed = false;\r\n this._points.push(new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](x, y));\r\n }\r\n /**\r\n * Adds a new segment until the given coordinates (x, y) to the current Path2.\r\n * @param x the added points x value\r\n * @param y the added points y value\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addLineTo = function (x, y) {\r\n if (this.closed) {\r\n return this;\r\n }\r\n var newPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](x, y);\r\n var previousPoint = this._points[this._points.length - 1];\r\n this._points.push(newPoint);\r\n this._length += newPoint.subtract(previousPoint).length();\r\n return this;\r\n };\r\n /**\r\n * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.\r\n * @param midX middle point x value\r\n * @param midY middle point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {\r\n if (numberOfSegments === void 0) { numberOfSegments = 36; }\r\n if (this.closed) {\r\n return this;\r\n }\r\n var startPoint = this._points[this._points.length - 1];\r\n var midPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](midX, midY);\r\n var endPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](endX, endY);\r\n var arc = new Arc2(startPoint, midPoint, endPoint);\r\n var increment = arc.angle.radians() / numberOfSegments;\r\n if (arc.orientation === Orientation.CW) {\r\n increment *= -1;\r\n }\r\n var currentAngle = arc.startAngle.radians() + increment;\r\n for (var i = 0; i < numberOfSegments; i++) {\r\n var x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;\r\n var y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;\r\n this.addLineTo(x, y);\r\n currentAngle += increment;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Closes the Path2.\r\n * @returns the Path2.\r\n */\r\n Path2.prototype.close = function () {\r\n this.closed = true;\r\n return this;\r\n };\r\n /**\r\n * Gets the sum of the distance between each sequential point in the path\r\n * @returns the Path2 total length (float).\r\n */\r\n Path2.prototype.length = function () {\r\n var result = this._length;\r\n if (!this.closed) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var firstPoint = this._points[0];\r\n result += (firstPoint.subtract(lastPoint).length());\r\n }\r\n return result;\r\n };\r\n /**\r\n * Gets the points which construct the path\r\n * @returns the Path2 internal array of points.\r\n */\r\n Path2.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * Retreives the point at the distance aways from the starting point\r\n * @param normalizedLengthPosition the length along the path to retreive the point from\r\n * @returns a new Vector2 located at a percentage of the Path2 total length on this path.\r\n */\r\n Path2.prototype.getPointAtLengthPosition = function (normalizedLengthPosition) {\r\n if (normalizedLengthPosition < 0 || normalizedLengthPosition > 1) {\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].Zero();\r\n }\r\n var lengthPosition = normalizedLengthPosition * this.length();\r\n var previousOffset = 0;\r\n for (var i = 0; i < this._points.length; i++) {\r\n var j = (i + 1) % this._points.length;\r\n var a = this._points[i];\r\n var b = this._points[j];\r\n var bToA = b.subtract(a);\r\n var nextOffset = (bToA.length() + previousOffset);\r\n if (lengthPosition >= previousOffset && lengthPosition <= nextOffset) {\r\n var dir = bToA.normalize();\r\n var localOffset = lengthPosition - previousOffset;\r\n return new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](a.x + (dir.x * localOffset), a.y + (dir.y * localOffset));\r\n }\r\n previousOffset = nextOffset;\r\n }\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].Zero();\r\n };\r\n /**\r\n * Creates a new path starting from an x and y position\r\n * @param x starting x value\r\n * @param y starting y value\r\n * @returns a new Path2 starting at the coordinates (x, y).\r\n */\r\n Path2.StartingAt = function (x, y) {\r\n return new Path2(x, y);\r\n };\r\n return Path2;\r\n}());\r\n\r\n/**\r\n * Represents a 3D path made up of multiple 3D points\r\n */\r\nvar Path3D = /** @class */ (function () {\r\n /**\r\n * new Path3D(path, normal, raw)\r\n * Creates a Path3D. A Path3D is a logical math object, so not a mesh.\r\n * please read the description in the tutorial : https://doc.babylonjs.com/how_to/how_to_use_path3d\r\n * @param path an array of Vector3, the curve axis of the Path3D\r\n * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.\r\n * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.\r\n */\r\n function Path3D(\r\n /**\r\n * an array of Vector3, the curve axis of the Path3D\r\n */\r\n path, firstNormal, raw) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n this.path = path;\r\n this._curve = new Array();\r\n this._distances = new Array();\r\n this._tangents = new Array();\r\n this._normals = new Array();\r\n this._binormals = new Array();\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p] = path[p].clone(); // hard copy\r\n }\r\n this._raw = raw || false;\r\n this._compute(firstNormal);\r\n }\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n Path3D.prototype.getCurve = function () {\r\n return this._curve;\r\n };\r\n /**\r\n * Returns an array populated with tangent vectors on each Path3D curve point.\r\n * @returns an array populated with tangent vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Returns an array populated with normal vectors on each Path3D curve point.\r\n * @returns an array populated with normal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Returns an array populated with binormal vectors on each Path3D curve point.\r\n * @returns an array populated with binormal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getBinormals = function () {\r\n return this._binormals;\r\n };\r\n /**\r\n * Returns an array populated with distances (float) of the i-th point from the first curve point.\r\n * @returns an array populated with distances (float) of the i-th point from the first curve point.\r\n */\r\n Path3D.prototype.getDistances = function () {\r\n return this._distances;\r\n };\r\n /**\r\n * Forces the Path3D tangent, normal, binormal and distance recomputation.\r\n * @param path path which all values are copied into the curves points\r\n * @param firstNormal which should be projected onto the curve\r\n * @returns the same object updated.\r\n */\r\n Path3D.prototype.update = function (path, firstNormal) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p].x = path[p].x;\r\n this._curve[p].y = path[p].y;\r\n this._curve[p].z = path[p].z;\r\n }\r\n this._compute(firstNormal);\r\n return this;\r\n };\r\n // private function compute() : computes tangents, normals and binormals\r\n Path3D.prototype._compute = function (firstNormal) {\r\n var l = this._curve.length;\r\n // first and last tangents\r\n this._tangents[0] = this._getFirstNonNullVector(0);\r\n if (!this._raw) {\r\n this._tangents[0].normalize();\r\n }\r\n this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);\r\n if (!this._raw) {\r\n this._tangents[l - 1].normalize();\r\n }\r\n // normals and binormals at first point : arbitrary vector with _normalVector()\r\n var tg0 = this._tangents[0];\r\n var pp0 = this._normalVector(tg0, firstNormal);\r\n this._normals[0] = pp0;\r\n if (!this._raw) {\r\n this._normals[0].normalize();\r\n }\r\n this._binormals[0] = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(tg0, this._normals[0]);\r\n if (!this._raw) {\r\n this._binormals[0].normalize();\r\n }\r\n this._distances[0] = 0.0;\r\n // normals and binormals : next points\r\n var prev; // previous vector (segment)\r\n var cur; // current vector (segment)\r\n var curTang; // current tangent\r\n // previous normal\r\n var prevBinor; // previous binormal\r\n for (var i = 1; i < l; i++) {\r\n // tangents\r\n prev = this._getLastNonNullVector(i);\r\n if (i < l - 1) {\r\n cur = this._getFirstNonNullVector(i);\r\n this._tangents[i] = prev.add(cur);\r\n this._tangents[i].normalize();\r\n }\r\n this._distances[i] = this._distances[i - 1] + prev.length();\r\n // normals and binormals\r\n // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html\r\n curTang = this._tangents[i];\r\n prevBinor = this._binormals[i - 1];\r\n this._normals[i] = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(prevBinor, curTang);\r\n if (!this._raw) {\r\n this._normals[i].normalize();\r\n }\r\n this._binormals[i] = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(curTang, this._normals[i]);\r\n if (!this._raw) {\r\n this._binormals[i].normalize();\r\n }\r\n }\r\n };\r\n // private function getFirstNonNullVector(index)\r\n // returns the first non null vector from index : curve[index + N].subtract(curve[index])\r\n Path3D.prototype._getFirstNonNullVector = function (index) {\r\n var i = 1;\r\n var nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n while (nNVector.length() === 0 && index + i + 1 < this._curve.length) {\r\n i++;\r\n nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n }\r\n return nNVector;\r\n };\r\n // private function getLastNonNullVector(index)\r\n // returns the last non null vector from index : curve[index].subtract(curve[index - N])\r\n Path3D.prototype._getLastNonNullVector = function (index) {\r\n var i = 1;\r\n var nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n while (nLVector.length() === 0 && index > i + 1) {\r\n i++;\r\n nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n }\r\n return nLVector;\r\n };\r\n // private function normalVector(v0, vt, va) :\r\n // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane\r\n // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0\r\n Path3D.prototype._normalVector = function (vt, va) {\r\n var normal0;\r\n var tgl = vt.length();\r\n if (tgl === 0.0) {\r\n tgl = 1.0;\r\n }\r\n if (va === undefined || va === null) {\r\n var point;\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"])) { // search for a point in the plane\r\n point = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.0, -1.0, 0.0);\r\n }\r\n else if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"])) {\r\n point = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](1.0, 0.0, 0.0);\r\n }\r\n else if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"])) {\r\n point = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.0, 0.0, 1.0);\r\n }\r\n else {\r\n point = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n }\r\n normal0 = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(vt, point);\r\n }\r\n else {\r\n normal0 = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(vt, va);\r\n _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(normal0, vt, normal0);\r\n }\r\n normal0.normalize();\r\n return normal0;\r\n };\r\n return Path3D;\r\n}());\r\n\r\n/**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_curve3\r\n */\r\nvar Curve3 = /** @class */ (function () {\r\n /**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * Tuto : https://doc.babylonjs.com/how_to/how_to_use_curve3#curve3-object\r\n * @param points points which make up the curve\r\n */\r\n function Curve3(points) {\r\n this._length = 0.0;\r\n this._points = points;\r\n this._length = this._computeLength(points);\r\n }\r\n /**\r\n * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#quadratic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Quadratic Bezier\r\n * @param v1 (Vector3) the control point\r\n * @param v2 (Vector3) the end point of the Quadratic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateQuadraticBezier = function (v0, v1, v2, nbPoints) {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2) {\r\n var res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](equation(i / nbPoints, v0.x, v1.x, v2.x), equation(i / nbPoints, v0.y, v1.y, v2.y), equation(i / nbPoints, v0.z, v1.z, v2.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#cubic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Cubic Bezier\r\n * @param v1 (Vector3) the first control point\r\n * @param v2 (Vector3) the second control point\r\n * @param v3 (Vector3) the end point of the Cubic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCubicBezier = function (v0, v1, v2, v3, nbPoints) {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2, val3) {\r\n var res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x), equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y), equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#hermite-spline\r\n * @param p1 (Vector3) the origin point of the Hermite Spline\r\n * @param t1 (Vector3) the tangent vector at the origin point\r\n * @param p2 (Vector3) the end point of the Hermite Spline\r\n * @param t2 (Vector3) the tangent vector at the end point\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateHermiteSpline = function (p1, t1, p2, t2, nbPoints) {\r\n var hermite = new Array();\r\n var step = 1.0 / nbPoints;\r\n for (var i = 0; i <= nbPoints; i++) {\r\n hermite.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n return new Curve3(hermite);\r\n };\r\n /**\r\n * Returns a Curve3 object along a CatmullRom Spline curve :\r\n * @param points (array of Vector3) the points the spline must pass through. At least, four points required\r\n * @param nbPoints (integer) the wanted number of points between each curve control points\r\n * @param closed (boolean) optional with default false, when true forms a closed loop from the points\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCatmullRomSpline = function (points, nbPoints, closed) {\r\n var catmullRom = new Array();\r\n var step = 1.0 / nbPoints;\r\n var amount = 0.0;\r\n if (closed) {\r\n var pointsCount = points.length;\r\n for (var i = 0; i < pointsCount; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CatmullRom(points[i % pointsCount], points[(i + 1) % pointsCount], points[(i + 2) % pointsCount], points[(i + 3) % pointsCount], amount));\r\n amount += step;\r\n }\r\n }\r\n catmullRom.push(catmullRom[0]);\r\n }\r\n else {\r\n var totalPoints = new Array();\r\n totalPoints.push(points[0].clone());\r\n Array.prototype.push.apply(totalPoints, points);\r\n totalPoints.push(points[points.length - 1].clone());\r\n for (var i = 0; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n amount += step;\r\n }\r\n }\r\n i--;\r\n catmullRom.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n return new Curve3(catmullRom);\r\n };\r\n /**\r\n * @returns the Curve3 stored array of successive Vector3\r\n */\r\n Curve3.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * @returns the computed length (float) of the curve.\r\n */\r\n Curve3.prototype.length = function () {\r\n return this._length;\r\n };\r\n /**\r\n * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);\r\n * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.\r\n * curveA and curveB keep unchanged.\r\n * @param curve the curve to continue from this curve\r\n * @returns the newly constructed curve\r\n */\r\n Curve3.prototype.continue = function (curve) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var continuedPoints = this._points.slice();\r\n var curvePoints = curve.getPoints();\r\n for (var i = 1; i < curvePoints.length; i++) {\r\n continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));\r\n }\r\n var continuedCurve = new Curve3(continuedPoints);\r\n return continuedCurve;\r\n };\r\n Curve3.prototype._computeLength = function (path) {\r\n var l = 0;\r\n for (var i = 1; i < path.length; i++) {\r\n l += (path[i].subtract(path[i - 1])).length();\r\n }\r\n return l;\r\n };\r\n return Curve3;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.plane.ts\":\n/*!*****************************!*\\\n !*** ./Maths/math.plane.ts ***!\n \\*****************************/\n/*! exports provided: Plane */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return Plane; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Represens a plane by the equation ax + by + cz + d = 0\r\n */\r\nvar Plane = /** @class */ (function () {\r\n /**\r\n * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0\r\n * @param a a component of the plane\r\n * @param b b component of the plane\r\n * @param c c component of the plane\r\n * @param d d component of the plane\r\n */\r\n function Plane(a, b, c, d) {\r\n this.normal = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](a, b, c);\r\n this.d = d;\r\n }\r\n /**\r\n * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].\r\n */\r\n Plane.prototype.asArray = function () {\r\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\r\n };\r\n // Methods\r\n /**\r\n * @returns a new plane copied from the current Plane.\r\n */\r\n Plane.prototype.clone = function () {\r\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\r\n };\r\n /**\r\n * @returns the string \"Plane\".\r\n */\r\n Plane.prototype.getClassName = function () {\r\n return \"Plane\";\r\n };\r\n /**\r\n * @returns the Plane hash code.\r\n */\r\n Plane.prototype.getHashCode = function () {\r\n var hash = this.normal.getHashCode();\r\n hash = (hash * 397) ^ (this.d | 0);\r\n return hash;\r\n };\r\n /**\r\n * Normalize the current Plane in place.\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.normalize = function () {\r\n var norm = (Math.sqrt((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y) + (this.normal.z * this.normal.z)));\r\n var magnitude = 0.0;\r\n if (norm !== 0) {\r\n magnitude = 1.0 / norm;\r\n }\r\n this.normal.x *= magnitude;\r\n this.normal.y *= magnitude;\r\n this.normal.z *= magnitude;\r\n this.d *= magnitude;\r\n return this;\r\n };\r\n /**\r\n * Applies a transformation the plane and returns the result\r\n * @param transformation the transformation matrix to be applied to the plane\r\n * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.\r\n */\r\n Plane.prototype.transform = function (transformation) {\r\n var transposedMatrix = Plane._TmpMatrix;\r\n _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].TransposeToRef(transformation, transposedMatrix);\r\n var m = transposedMatrix.m;\r\n var x = this.normal.x;\r\n var y = this.normal.y;\r\n var z = this.normal.z;\r\n var d = this.d;\r\n var normalX = x * m[0] + y * m[1] + z * m[2] + d * m[3];\r\n var normalY = x * m[4] + y * m[5] + z * m[6] + d * m[7];\r\n var normalZ = x * m[8] + y * m[9] + z * m[10] + d * m[11];\r\n var finalD = x * m[12] + y * m[13] + z * m[14] + d * m[15];\r\n return new Plane(normalX, normalY, normalZ, finalD);\r\n };\r\n /**\r\n * Calcualtte the dot product between the point and the plane normal\r\n * @param point point to calculate the dot product with\r\n * @returns the dot product (float) of the point coordinates and the plane normal.\r\n */\r\n Plane.prototype.dotCoordinate = function (point) {\r\n return ((((this.normal.x * point.x) + (this.normal.y * point.y)) + (this.normal.z * point.z)) + this.d);\r\n };\r\n /**\r\n * Updates the current Plane from the plane defined by the three given points.\r\n * @param point1 one of the points used to contruct the plane\r\n * @param point2 one of the points used to contruct the plane\r\n * @param point3 one of the points used to contruct the plane\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.copyFromPoints = function (point1, point2, point3) {\r\n var x1 = point2.x - point1.x;\r\n var y1 = point2.y - point1.y;\r\n var z1 = point2.z - point1.z;\r\n var x2 = point3.x - point1.x;\r\n var y2 = point3.y - point1.y;\r\n var z2 = point3.z - point1.z;\r\n var yz = (y1 * z2) - (z1 * y2);\r\n var xz = (z1 * x2) - (x1 * z2);\r\n var xy = (x1 * y2) - (y1 * x2);\r\n var pyth = (Math.sqrt((yz * yz) + (xz * xz) + (xy * xy)));\r\n var invPyth;\r\n if (pyth !== 0) {\r\n invPyth = 1.0 / pyth;\r\n }\r\n else {\r\n invPyth = 0.0;\r\n }\r\n this.normal.x = yz * invPyth;\r\n this.normal.y = xz * invPyth;\r\n this.normal.z = xy * invPyth;\r\n this.d = -((this.normal.x * point1.x) + (this.normal.y * point1.y) + (this.normal.z * point1.z));\r\n return this;\r\n };\r\n /**\r\n * Checks if the plane is facing a given direction\r\n * @param direction the direction to check if the plane is facing\r\n * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)\r\n * @returns True is the vector \"direction\" is the same side than the plane normal.\r\n */\r\n Plane.prototype.isFrontFacingTo = function (direction, epsilon) {\r\n var dot = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, direction);\r\n return (dot <= epsilon);\r\n };\r\n /**\r\n * Calculates the distance to a point\r\n * @param point point to calculate distance to\r\n * @returns the signed distance (float) from the given point to the Plane.\r\n */\r\n Plane.prototype.signedDistanceTo = function (point) {\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(point, this.normal) + this.d;\r\n };\r\n // Statics\r\n /**\r\n * Creates a plane from an array\r\n * @param array the array to create a plane from\r\n * @returns a new Plane from the given array.\r\n */\r\n Plane.FromArray = function (array) {\r\n return new Plane(array[0], array[1], array[2], array[3]);\r\n };\r\n /**\r\n * Creates a plane from three points\r\n * @param point1 point used to create the plane\r\n * @param point2 point used to create the plane\r\n * @param point3 point used to create the plane\r\n * @returns a new Plane defined by the three given points.\r\n */\r\n Plane.FromPoints = function (point1, point2, point3) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n result.copyFromPoints(point1, point2, point3);\r\n return result;\r\n };\r\n /**\r\n * Creates a plane from an origin point and a normal\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @returns a new Plane the normal vector to this plane at the given origin point.\r\n * Note : the vector \"normal\" is updated because normalized.\r\n */\r\n Plane.FromPositionAndNormal = function (origin, normal) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n normal.normalize();\r\n result.normal = normal;\r\n result.d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return result;\r\n };\r\n /**\r\n * Calculates the distance from a plane and a point\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @param point point to calculate distance to\r\n * @returns the signed distance between the plane defined by the normal vector at the \"origin\"\" point and the given other point.\r\n */\r\n Plane.SignedDistanceToPlaneFromPositionAndNormal = function (origin, normal, point) {\r\n var d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(point, normal) + d;\r\n };\r\n Plane._TmpMatrix = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity();\r\n return Plane;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.scalar.ts\":\n/*!******************************!*\\\n !*** ./Maths/math.scalar.ts ***!\n \\******************************/\n/*! exports provided: Scalar */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return Scalar; });\n/**\r\n * Scalar computation library\r\n */\r\nvar Scalar = /** @class */ (function () {\r\n function Scalar() {\r\n }\r\n /**\r\n * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n * @param a number\r\n * @param b number\r\n * @param epsilon (default = 1.401298E-45)\r\n * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n */\r\n Scalar.WithinEpsilon = function (a, b, epsilon) {\r\n if (epsilon === void 0) { epsilon = 1.401298E-45; }\r\n var num = a - b;\r\n return -epsilon <= num && num <= epsilon;\r\n };\r\n /**\r\n * Returns a string : the upper case translation of the number i to hexadecimal.\r\n * @param i number\r\n * @returns the upper case translation of the number i to hexadecimal.\r\n */\r\n Scalar.ToHex = function (i) {\r\n var str = i.toString(16);\r\n if (i <= 15) {\r\n return (\"0\" + str).toUpperCase();\r\n }\r\n return str.toUpperCase();\r\n };\r\n /**\r\n * Returns -1 if value is negative and +1 is value is positive.\r\n * @param value the value\r\n * @returns the value itself if it's equal to zero.\r\n */\r\n Scalar.Sign = function (value) {\r\n value = +value; // convert to a number\r\n if (value === 0 || isNaN(value)) {\r\n return value;\r\n }\r\n return value > 0 ? 1 : -1;\r\n };\r\n /**\r\n * Returns the value itself if it's between min and max.\r\n * Returns min if the value is lower than min.\r\n * Returns max if the value is greater than max.\r\n * @param value the value to clmap\r\n * @param min the min value to clamp to (default: 0)\r\n * @param max the max value to clamp to (default: 1)\r\n * @returns the clamped value\r\n */\r\n Scalar.Clamp = function (value, min, max) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n return Math.min(max, Math.max(min, value));\r\n };\r\n /**\r\n * the log2 of value.\r\n * @param value the value to compute log2 of\r\n * @returns the log2 of value.\r\n */\r\n Scalar.Log2 = function (value) {\r\n return Math.log(value) * Math.LOG2E;\r\n };\r\n /**\r\n * Loops the value, so that it is never larger than length and never smaller than 0.\r\n *\r\n * This is similar to the modulo operator but it works with floating point numbers.\r\n * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.\r\n * With t = 5 and length = 2.5, the result would be 0.0.\r\n * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator\r\n * @param value the value\r\n * @param length the length\r\n * @returns the looped value\r\n */\r\n Scalar.Repeat = function (value, length) {\r\n return value - Math.floor(value / length) * length;\r\n };\r\n /**\r\n * Normalize the value between 0.0 and 1.0 using min and max values\r\n * @param value value to normalize\r\n * @param min max to normalize between\r\n * @param max min to normalize between\r\n * @returns the normalized value\r\n */\r\n Scalar.Normalize = function (value, min, max) {\r\n return (value - min) / (max - min);\r\n };\r\n /**\r\n * Denormalize the value from 0.0 and 1.0 using min and max values\r\n * @param normalized value to denormalize\r\n * @param min max to denormalize between\r\n * @param max min to denormalize between\r\n * @returns the denormalized value\r\n */\r\n Scalar.Denormalize = function (normalized, min, max) {\r\n return (normalized * (max - min) + min);\r\n };\r\n /**\r\n * Calculates the shortest difference between two given angles given in degrees.\r\n * @param current current angle in degrees\r\n * @param target target angle in degrees\r\n * @returns the delta\r\n */\r\n Scalar.DeltaAngle = function (current, target) {\r\n var num = Scalar.Repeat(target - current, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return num;\r\n };\r\n /**\r\n * PingPongs the value t, so that it is never larger than length and never smaller than 0.\r\n * @param tx value\r\n * @param length length\r\n * @returns The returned value will move back and forth between 0 and length\r\n */\r\n Scalar.PingPong = function (tx, length) {\r\n var t = Scalar.Repeat(tx, length * 2.0);\r\n return length - Math.abs(t - length);\r\n };\r\n /**\r\n * Interpolates between min and max with smoothing at the limits.\r\n *\r\n * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up\r\n * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.\r\n * @param from from\r\n * @param to to\r\n * @param tx value\r\n * @returns the smooth stepped value\r\n */\r\n Scalar.SmoothStep = function (from, to, tx) {\r\n var t = Scalar.Clamp(tx);\r\n t = -2.0 * t * t * t + 3.0 * t * t;\r\n return to * t + from * (1.0 - t);\r\n };\r\n /**\r\n * Moves a value current towards target.\r\n *\r\n * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.\r\n * Negative values of maxDelta pushes the value away from target.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting value\r\n */\r\n Scalar.MoveTowards = function (current, target, maxDelta) {\r\n var result = 0;\r\n if (Math.abs(target - current) <= maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n result = current + Scalar.Sign(target - current) * maxDelta;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n *\r\n * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta\r\n * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting angle\r\n */\r\n Scalar.MoveTowardsAngle = function (current, target, maxDelta) {\r\n var num = Scalar.DeltaAngle(current, target);\r\n var result = 0;\r\n if (-maxDelta < num && num < maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n target = current + num;\r\n result = Scalar.MoveTowards(current, target, maxDelta);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a new scalar with values linearly interpolated of \"amount\" between the start scalar and the end scalar.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.Lerp = function (start, end, amount) {\r\n return start + ((end - start) * amount);\r\n };\r\n /**\r\n * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.LerpAngle = function (start, end, amount) {\r\n var num = Scalar.Repeat(end - start, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return start + num * Scalar.Clamp(amount);\r\n };\r\n /**\r\n * Calculates the linear parameter t that produces the interpolant value within the range [a, b].\r\n * @param a start value\r\n * @param b target value\r\n * @param value value between a and b\r\n * @returns the inverseLerp value\r\n */\r\n Scalar.InverseLerp = function (a, b, value) {\r\n var result = 0;\r\n if (a != b) {\r\n result = Scalar.Clamp((value - a) / (b - a));\r\n }\r\n else {\r\n result = 0.0;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Returns a new scalar located for \"amount\" (float) on the Hermite spline defined by the scalars \"value1\", \"value3\", \"tangent1\", \"tangent2\".\r\n * @see http://mathworld.wolfram.com/HermitePolynomial.html\r\n * @param value1 spline value\r\n * @param tangent1 spline value\r\n * @param value2 spline value\r\n * @param tangent2 spline value\r\n * @param amount input value\r\n * @returns hermite result\r\n */\r\n Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);\r\n };\r\n /**\r\n * Returns a random float number between and min and max values\r\n * @param min min value of random\r\n * @param max max value of random\r\n * @returns random value\r\n */\r\n Scalar.RandomRange = function (min, max) {\r\n if (min === max) {\r\n return min;\r\n }\r\n return ((Math.random() * (max - min)) + min);\r\n };\r\n /**\r\n * This function returns percentage of a number in a given range.\r\n *\r\n * RangeToPercent(40,20,60) will return 0.5 (50%)\r\n * RangeToPercent(34,0,100) will return 0.34 (34%)\r\n * @param number to convert to percentage\r\n * @param min min range\r\n * @param max max range\r\n * @returns the percentage\r\n */\r\n Scalar.RangeToPercent = function (number, min, max) {\r\n return ((number - min) / (max - min));\r\n };\r\n /**\r\n * This function returns number that corresponds to the percentage in a given range.\r\n *\r\n * PercentToRange(0.34,0,100) will return 34.\r\n * @param percent to convert to number\r\n * @param min min range\r\n * @param max max range\r\n * @returns the number\r\n */\r\n Scalar.PercentToRange = function (percent, min, max) {\r\n return ((max - min) * percent + min);\r\n };\r\n /**\r\n * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.\r\n * @param angle The angle to normalize in radian.\r\n * @return The converted angle.\r\n */\r\n Scalar.NormalizeRadians = function (angle) {\r\n // More precise but slower version kept for reference.\r\n // angle = angle % Tools.TwoPi;\r\n // angle = (angle + Tools.TwoPi) % Tools.TwoPi;\r\n //if (angle > Math.PI) {\r\n //\tangle -= Tools.TwoPi;\r\n //}\r\n angle -= (Scalar.TwoPi * Math.floor((angle + Math.PI) / Scalar.TwoPi));\r\n return angle;\r\n };\r\n /**\r\n * Two pi constants convenient for computation.\r\n */\r\n Scalar.TwoPi = Math.PI * 2;\r\n return Scalar;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.size.ts\":\n/*!****************************!*\\\n !*** ./Maths/math.size.ts ***!\n \\****************************/\n/*! exports provided: Size */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return Size; });\n/**\r\n * Size containing widht and height\r\n */\r\nvar Size = /** @class */ (function () {\r\n /**\r\n * Creates a Size object from the given width and height (floats).\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n */\r\n function Size(width, height) {\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Returns a string with the Size width and height\r\n * @returns a string with the Size width and height\r\n */\r\n Size.prototype.toString = function () {\r\n return \"{W: \" + this.width + \", H: \" + this.height + \"}\";\r\n };\r\n /**\r\n * \"Size\"\r\n * @returns the string \"Size\"\r\n */\r\n Size.prototype.getClassName = function () {\r\n return \"Size\";\r\n };\r\n /**\r\n * Returns the Size hash code.\r\n * @returns a hash code for a unique width and height\r\n */\r\n Size.prototype.getHashCode = function () {\r\n var hash = this.width | 0;\r\n hash = (hash * 397) ^ (this.height | 0);\r\n return hash;\r\n };\r\n /**\r\n * Updates the current size from the given one.\r\n * @param src the given size\r\n */\r\n Size.prototype.copyFrom = function (src) {\r\n this.width = src.width;\r\n this.height = src.height;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.copyFromFloats = function (width, height) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width to set\r\n * @param height height to set\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.set = function (width, height) {\r\n return this.copyFromFloats(width, height);\r\n };\r\n /**\r\n * Multiplies the width and height by numbers\r\n * @param w factor to multiple the width by\r\n * @param h factor to multiple the height by\r\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\r\n */\r\n Size.prototype.multiplyByFloats = function (w, h) {\r\n return new Size(this.width * w, this.height * h);\r\n };\r\n /**\r\n * Clones the size\r\n * @returns a new Size copied from the given one.\r\n */\r\n Size.prototype.clone = function () {\r\n return new Size(this.width, this.height);\r\n };\r\n /**\r\n * True if the current Size and the given one width and height are strictly equal.\r\n * @param other the other size to compare against\r\n * @returns True if the current Size and the given one width and height are strictly equal.\r\n */\r\n Size.prototype.equals = function (other) {\r\n if (!other) {\r\n return false;\r\n }\r\n return (this.width === other.width) && (this.height === other.height);\r\n };\r\n Object.defineProperty(Size.prototype, \"surface\", {\r\n /**\r\n * The surface of the Size : width * height (float).\r\n */\r\n get: function () {\r\n return this.width * this.height;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new size of zero\r\n * @returns a new Size set to (0.0, 0.0)\r\n */\r\n Size.Zero = function () {\r\n return new Size(0.0, 0.0);\r\n };\r\n /**\r\n * Sums the width and height of two sizes\r\n * @param otherSize size to add to this size\r\n * @returns a new Size set as the addition result of the current Size and the given one.\r\n */\r\n Size.prototype.add = function (otherSize) {\r\n var r = new Size(this.width + otherSize.width, this.height + otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Subtracts the width and height of two\r\n * @param otherSize size to subtract to this size\r\n * @returns a new Size set as the subtraction result of the given one from the current Size.\r\n */\r\n Size.prototype.subtract = function (otherSize) {\r\n var r = new Size(this.width - otherSize.width, this.height - otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Creates a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n * @param start starting size to lerp between\r\n * @param end end size to lerp between\r\n * @param amount amount to lerp between the start and end values\r\n * @returns a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n */\r\n Size.Lerp = function (start, end, amount) {\r\n var w = start.width + ((end.width - start.width) * amount);\r\n var h = start.height + ((end.height - start.height) * amount);\r\n return new Size(w, h);\r\n };\r\n return Size;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.ts\":\n/*!***********************!*\\\n !*** ./Maths/math.ts ***!\n \\***********************/\n/*! exports provided: Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, PositionNormalVertex, PositionNormalTextureVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _math_axis__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.axis */ \"./Maths/math.axis.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _math_axis__WEBPACK_IMPORTED_MODULE_0__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _math_axis__WEBPACK_IMPORTED_MODULE_0__[\"Axis\"]; });\n\n/* harmony import */ var _math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.color */ \"./Maths/math.color.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _math_color__WEBPACK_IMPORTED_MODULE_1__[\"TmpColors\"]; });\n\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"]; });\n\n/* harmony import */ var _math_frustum__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./math.frustum */ \"./Maths/math.frustum.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _math_frustum__WEBPACK_IMPORTED_MODULE_3__[\"Frustum\"]; });\n\n/* harmony import */ var _math_path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./math.path */ \"./Maths/math.path.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Curve3\"]; });\n\n/* harmony import */ var _math_plane__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./math.plane */ \"./Maths/math.plane.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _math_plane__WEBPACK_IMPORTED_MODULE_5__[\"Plane\"]; });\n\n/* harmony import */ var _math_size__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./math.size */ \"./Maths/math.size.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _math_size__WEBPACK_IMPORTED_MODULE_6__[\"Size\"]; });\n\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"TmpVectors\"]; });\n\n/* harmony import */ var _math_vertexFormat__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./math.vertexFormat */ \"./Maths/math.vertexFormat.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _math_vertexFormat__WEBPACK_IMPORTED_MODULE_8__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _math_vertexFormat__WEBPACK_IMPORTED_MODULE_8__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony import */ var _math_viewport__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./math.viewport */ \"./Maths/math.viewport.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _math_viewport__WEBPACK_IMPORTED_MODULE_9__[\"Viewport\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.vector.ts\":\n/*!******************************!*\\\n !*** ./Maths/math.vector.ts ***!\n \\******************************/\n/*! exports provided: Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return Vector2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return Vector3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return Vector4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return Quaternion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return Matrix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return TmpVectors; });\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class representing a vector containing 2 coordinates\r\n */\r\nvar Vector2 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector2 from the given x and y coordinates\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n */\r\n function Vector2(\r\n /** defines the first coordinate */\r\n x, \r\n /** defines the second coordinate */\r\n y) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /**\r\n * Gets a string with the Vector2 coordinates\r\n * @returns a string with the Vector2 coordinates\r\n */\r\n Vector2.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \"}\";\r\n };\r\n /**\r\n * Gets class name\r\n * @returns the string \"Vector2\"\r\n */\r\n Vector2.prototype.getClassName = function () {\r\n return \"Vector2\";\r\n };\r\n /**\r\n * Gets current vector hash code\r\n * @returns the Vector2 hash code as a number\r\n */\r\n Vector2.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Sets the Vector2 coordinates in the given array or Float32Array from the given index.\r\n * @param array defines the source array\r\n * @param index defines the offset in source array\r\n * @returns the current Vector2\r\n */\r\n Vector2.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n return this;\r\n };\r\n /**\r\n * Copy the current vector to an array\r\n * @returns a new array with 2 elements: the Vector2 coordinates.\r\n */\r\n Vector2.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given Vector2 coordinates\r\n * @param source defines the source Vector2\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFromFloats = function (x, y) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.set = function (x, y) {\r\n return this.copyFromFloats(x, y);\r\n };\r\n /**\r\n * Add another vector with the current one\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2 set with the addition of the current Vector2 and the given one coordinates\r\n */\r\n Vector2.prototype.add = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the addition of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Set the Vector2 coordinates by adding the given Vector2 coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.addVector3 = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.subtract = function (otherVector) {\r\n return new Vector2(this.x - otherVector.x, this.y - otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the subtraction of the given one from the current Vector2 coordinates.\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the current Vector2 coordinates by subtracting from it the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiply = function (otherVector) {\r\n return new Vector2(this.x * otherVector.x, this.y * otherVector.y);\r\n };\r\n /**\r\n * Sets \"result\" coordinates with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiplyByFloats = function (x, y) {\r\n return new Vector2(this.x * x, this.y * y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.divide = function (otherVector) {\r\n return new Vector2(this.x / otherVector.x, this.y / otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the Vector2 divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Gets a new Vector2 with current Vector2 negated coordinates\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.negate = function () {\r\n return new Vector2(-this.x, -this.y);\r\n };\r\n /**\r\n * Multiply the Vector2 coordinates by scale\r\n * @param scale defines the scaling factor\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 scaled by \"scale\" from the current Vector2\r\n * @param scale defines the scaling factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.scale = function (scale) {\r\n var result = new Vector2(0, 0);\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor and add the result to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals\r\n * @param otherVector defines the other vector\r\n * @returns true if the given vector coordinates strictly equal the current Vector2 ones\r\n */\r\n Vector2.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals (using an epsilon value)\r\n * @param otherVector defines the other vector\r\n * @param epsilon defines the minimal distance to consider equality\r\n * @returns true if the given vector coordinates are close to the current ones by a distance of epsilon.\r\n */\r\n Vector2.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; }\r\n return otherVector && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.x, otherVector.x, epsilon) && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.y, otherVector.y, epsilon);\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.floor = function () {\r\n return new Vector2(Math.floor(this.x), Math.floor(this.y));\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.fract = function () {\r\n return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the vector\r\n * @returns the vector length (float)\r\n */\r\n Vector2.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n };\r\n /**\r\n * Gets the vector squared length\r\n * @returns the vector squared length (float)\r\n */\r\n Vector2.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y);\r\n };\r\n // Methods\r\n /**\r\n * Normalize the vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n var num = 1.0 / len;\r\n this.x *= num;\r\n this.y *= num;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 copied from the Vector2\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.clone = function () {\r\n return new Vector2(this.x, this.y);\r\n };\r\n // Statics\r\n /**\r\n * Gets a new Vector2(0, 0)\r\n * @returns a new Vector2\r\n */\r\n Vector2.Zero = function () {\r\n return new Vector2(0, 0);\r\n };\r\n /**\r\n * Gets a new Vector2(1, 1)\r\n * @returns a new Vector2\r\n */\r\n Vector2.One = function () {\r\n return new Vector2(1, 1);\r\n };\r\n /**\r\n * Gets a new Vector2 set from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @returns a new Vector2\r\n */\r\n Vector2.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector2(array[offset], array[offset + 1]);\r\n };\r\n /**\r\n * Sets \"result\" from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @param result defines the target vector\r\n */\r\n Vector2.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n };\r\n /**\r\n * Gets a new Vector2 located for \"amount\" (float) on the CatmullRom spline defined by the given four Vector2\r\n * @param value1 defines 1st point of control\r\n * @param value2 defines 2nd point of control\r\n * @param value3 defines 3rd point of control\r\n * @param value4 defines 4th point of control\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +\r\n (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +\r\n ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +\r\n (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +\r\n ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with same the coordinates than \"value\" ones if the vector \"value\" is in the square defined by \"min\" and \"max\".\r\n * If a coordinate of \"value\" is lower than \"min\" coordinates, the returned Vector2 is given this \"min\" coordinate.\r\n * If a coordinate of \"value\" is greater than \"max\" coordinates, the returned Vector2 is given this \"max\" coordinate\r\n * @param value defines the value to clamp\r\n * @param min defines the lower limit\r\n * @param max defines the upper limit\r\n * @returns a new Vector2\r\n */\r\n Vector2.Clamp = function (value, min, max) {\r\n var x = value.x;\r\n x = (x > max.x) ? max.x : x;\r\n x = (x < min.x) ? min.x : x;\r\n var y = value.y;\r\n y = (y > max.y) ? max.y : y;\r\n y = (y < min.y) ? min.y : y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the Hermite spline defined by the vectors \"value1\", \"value3\", \"tangent1\", \"tangent2\"\r\n * @param value1 defines the 1st control point\r\n * @param tangent1 defines the outgoing tangent\r\n * @param value2 defines the 2nd control point\r\n * @param tangent2 defines the incoming tangent\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the linear interpolation between the vector \"start\" adn the vector \"end\".\r\n * @param start defines the start vector\r\n * @param end defines the end vector\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Lerp = function (start, end, amount) {\r\n var x = start.x + ((end.x - start.x) * amount);\r\n var y = start.y + ((end.y - start.y) * amount);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets the dot product of the vector \"left\" and the vector \"right\"\r\n * @param left defines first vector\r\n * @param right defines second vector\r\n * @returns the dot product (float)\r\n */\r\n Vector2.Dot = function (left, right) {\r\n return left.x * right.x + left.y * right.y;\r\n };\r\n /**\r\n * Returns a new Vector2 equal to the normalized given vector\r\n * @param vector defines the vector to normalize\r\n * @returns a new Vector2\r\n */\r\n Vector2.Normalize = function (vector) {\r\n var newVector = vector.clone();\r\n newVector.normalize();\r\n return newVector;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the minimal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Minimize = function (left, right) {\r\n var x = (left.x < right.x) ? left.x : right.x;\r\n var y = (left.y < right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vecto2 set with the maximal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Maximize = function (left, right) {\r\n var x = (left.x > right.x) ? left.x : right.x;\r\n var y = (left.y > right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @returns a new Vector2\r\n */\r\n Vector2.Transform = function (vector, transformation) {\r\n var r = Vector2.Zero();\r\n Vector2.TransformToRef(vector, transformation, r);\r\n return r;\r\n };\r\n /**\r\n * Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector \"result\" coordinates\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @param result defines the target vector\r\n */\r\n Vector2.TransformToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + m[12];\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + m[13];\r\n result.x = x;\r\n result.y = y;\r\n };\r\n /**\r\n * Determines if a given vector is included in a triangle\r\n * @param p defines the vector to test\r\n * @param p0 defines 1st triangle point\r\n * @param p1 defines 2nd triangle point\r\n * @param p2 defines 3rd triangle point\r\n * @returns true if the point \"p\" is in the triangle defined by the vertors \"p0\", \"p1\", \"p2\"\r\n */\r\n Vector2.PointInTriangle = function (p, p0, p1, p2) {\r\n var a = 1 / 2 * (-p1.y * p2.x + p0.y * (-p1.x + p2.x) + p0.x * (p1.y - p2.y) + p1.x * p2.y);\r\n var sign = a < 0 ? -1 : 1;\r\n var s = (p0.y * p2.x - p0.x * p2.y + (p2.y - p0.y) * p.x + (p0.x - p2.x) * p.y) * sign;\r\n var t = (p0.x * p1.y - p0.y * p1.x + (p0.y - p1.y) * p.x + (p1.x - p0.x) * p.y) * sign;\r\n return s > 0 && t > 0 && (s + t) < 2 * a * sign;\r\n };\r\n /**\r\n * Gets the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the distance between vectors\r\n */\r\n Vector2.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector2.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the squared distance between vectors\r\n */\r\n Vector2.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n return (x * x) + (y * y);\r\n };\r\n /**\r\n * Gets a new Vector2 located at the center of the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Gets the shortest distance (float) between the point \"p\" and the segment defined by the two points \"segA\" and \"segB\".\r\n * @param p defines the middle point\r\n * @param segA defines one point of the segment\r\n * @param segB defines the other point of the segment\r\n * @returns the shortest distance\r\n */\r\n Vector2.DistanceOfPointFromSegment = function (p, segA, segB) {\r\n var l2 = Vector2.DistanceSquared(segA, segB);\r\n if (l2 === 0.0) {\r\n return Vector2.Distance(p, segA);\r\n }\r\n var v = segB.subtract(segA);\r\n var t = Math.max(0, Math.min(1, Vector2.Dot(p.subtract(segA), v) / l2));\r\n var proj = segA.add(v.multiplyByFloats(t, t));\r\n return Vector2.Distance(p, proj);\r\n };\r\n return Vector2;\r\n}());\r\n\r\n/**\r\n * Classed used to store (x,y,z) vector representation\r\n * A Vector3 is the main object used in 3D geometry\r\n * It can represent etiher the coordinates of a point the space, either a direction\r\n * Reminder: js uses a left handed forward facing system\r\n */\r\nvar Vector3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector3 object from the given x, y, z (floats) coordinates.\r\n * @param x defines the first coordinates (on X axis)\r\n * @param y defines the second coordinates (on Y axis)\r\n * @param z defines the third coordinates (on Z axis)\r\n */\r\n function Vector3(\r\n /**\r\n * Defines the first coordinates (on X axis)\r\n */\r\n x, \r\n /**\r\n * Defines the second coordinates (on Y axis)\r\n */\r\n y, \r\n /**\r\n * Defines the third coordinates (on Z axis)\r\n */\r\n z) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n if (z === void 0) { z = 0; }\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n }\r\n /**\r\n * Creates a string representation of the Vector3\r\n * @returns a string with the Vector3 coordinates.\r\n */\r\n Vector3.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \"}\";\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Vector3\"\r\n */\r\n Vector3.prototype.getClassName = function () {\r\n return \"Vector3\";\r\n };\r\n /**\r\n * Creates the Vector3 hash code\r\n * @returns a number which tends to be unique between Vector3 instances\r\n */\r\n Vector3.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Creates an array containing three elements : the coordinates of the Vector3\r\n * @returns a new array of numbers\r\n */\r\n Vector3.prototype.asArray = function () {\r\n var result = [];\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n array[index + 2] = this.z;\r\n return this;\r\n };\r\n /**\r\n * Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation)\r\n * @returns a new Quaternion object, computed from the Vector3 coordinates\r\n */\r\n Vector3.prototype.toQuaternion = function () {\r\n return Quaternion.RotationYawPitchRoll(this.y, this.x, this.z);\r\n };\r\n /**\r\n * Adds the given vector to the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlace = function (otherVector) {\r\n return this.addInPlaceFromFloats(otherVector.x, otherVector.y, otherVector.z);\r\n };\r\n /**\r\n * Adds the given coordinates to the current Vector3\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlaceFromFloats = function (x, y, z) {\r\n this.x += x;\r\n this.y += y;\r\n this.z += z;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector3, result of the addition the current Vector3 and the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.add = function (otherVector) {\r\n return new Vector3(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z);\r\n };\r\n /**\r\n * Adds the current Vector3 to the given one and stores the result in the vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.addToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z);\r\n };\r\n /**\r\n * Subtract the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n this.z -= otherVector.z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the subtraction of the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtract = function (otherVector) {\r\n return new Vector3(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z);\r\n };\r\n /**\r\n * Subtracts the given vector from the current Vector3 and stores the result in the vector \"result\".\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractToRef = function (otherVector, result) {\r\n return this.subtractFromFloatsToRef(otherVector.x, otherVector.y, otherVector.z, result);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtractFromFloats = function (x, y, z) {\r\n return new Vector3(this.x - x, this.y - y, this.z - z);\r\n };\r\n /**\r\n * Subtracts the given floats from the current Vector3 coordinates and set the given vector \"result\" with this result\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractFromFloatsToRef = function (x, y, z, result) {\r\n return result.copyFromFloats(this.x - x, this.y - y, this.z - z);\r\n };\r\n /**\r\n * Gets a new Vector3 set with the current Vector3 negated coordinates\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.negate = function () {\r\n return new Vector3(-this.x, -this.y, -this.z);\r\n };\r\n /**\r\n * Multiplies the Vector3 coordinates by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.scale = function (scale) {\r\n return new Vector3(this.x * scale, this.y * scale, this.z * scale);\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the float \"scale\" and stores the result in the given vector \"result\" coordinates\r\n * @param scale defines the multiplier factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.scaleToRef = function (scale, result) {\r\n return result.copyFromFloats(this.x * scale, this.y * scale, this.z * scale);\r\n };\r\n /**\r\n * Scale the current Vector3 values by a factor and add the result to a given Vector3\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the unmodified current Vector3\r\n */\r\n Vector3.prototype.scaleAndAddToRef = function (scale, result) {\r\n return result.addInPlaceFromFloats(this.x * scale, this.y * scale, this.z * scale);\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are strictly equal\r\n * @param otherVector defines the second operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z;\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon\r\n * @param otherVector defines the second operand\r\n * @param epsilon defines the minimal distance to define values as equals\r\n * @returns true if both vectors are distant less than epsilon\r\n */\r\n Vector3.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; }\r\n return otherVector && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.x, otherVector.x, epsilon) && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.y, otherVector.y, epsilon) && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.z, otherVector.z, epsilon);\r\n };\r\n /**\r\n * Returns true if the current Vector3 coordinates equals the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equalsToFloats = function (x, y, z) {\r\n return this.x === x && this.y === y && this.z === z;\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n this.z *= otherVector.z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiply = function (otherVector) {\r\n return this.multiplyByFloats(otherVector.x, otherVector.y, otherVector.z);\r\n };\r\n /**\r\n * Multiplies the current Vector3 by the given one and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.multiplyToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiplyByFloats = function (x, y, z) {\r\n return new Vector3(this.x * x, this.y * y, this.z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.divide = function (otherVector) {\r\n return new Vector3(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.divideToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlace = function (other) {\r\n return this.minimizeInPlaceFromFloats(other.x, other.y, other.z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given vector ones.\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlace = function (other) {\r\n return this.maximizeInPlaceFromFloats(other.x, other.y, other.z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlaceFromFloats = function (x, y, z) {\r\n if (x < this.x) {\r\n this.x = x;\r\n }\r\n if (y < this.y) {\r\n this.y = y;\r\n }\r\n if (z < this.z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given coordinates.\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlaceFromFloats = function (x, y, z) {\r\n if (x > this.x) {\r\n this.x = x;\r\n }\r\n if (y > this.y) {\r\n this.y = y;\r\n }\r\n if (z > this.z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Due to float precision, scale of a mesh could be uniform but float values are off by a small fraction\r\n * Check if is non uniform within a certain amount of decimal places to account for this\r\n * @param epsilon the amount the values can differ\r\n * @returns if the the vector is non uniform to a certain number of decimal places\r\n */\r\n Vector3.prototype.isNonUniformWithinEpsilon = function (epsilon) {\r\n var absX = Math.abs(this.x);\r\n var absY = Math.abs(this.y);\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(absX, absY, epsilon)) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this.z);\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(absX, absZ, epsilon)) {\r\n return true;\r\n }\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(absY, absZ, epsilon)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(Vector3.prototype, \"isNonUniform\", {\r\n /**\r\n * Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same\r\n */\r\n get: function () {\r\n var absX = Math.abs(this.x);\r\n var absY = Math.abs(this.y);\r\n if (absX !== absY) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this.z);\r\n if (absX !== absZ) {\r\n return true;\r\n }\r\n if (absY !== absZ) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.floor = function () {\r\n return new Vector3(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));\r\n };\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.fract = function () {\r\n return new Vector3(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the Vector3\r\n * @returns the length of the Vector3\r\n */\r\n Vector3.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\r\n };\r\n /**\r\n * Gets the squared length of the Vector3\r\n * @returns squared length of the Vector3\r\n */\r\n Vector3.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y + this.z * this.z);\r\n };\r\n /**\r\n * Normalize the current Vector3.\r\n * Please note that this is an in place operation.\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalize = function () {\r\n return this.normalizeFromLength(this.length());\r\n };\r\n /**\r\n * Reorders the x y z properties of the vector in place\r\n * @param order new ordering of the properties (eg. for vector 1,2,3 with \"ZYX\" will produce 3,2,1)\r\n * @returns the current updated vector\r\n */\r\n Vector3.prototype.reorderInPlace = function (order) {\r\n var _this = this;\r\n order = order.toLowerCase();\r\n if (order === \"xyz\") {\r\n return this;\r\n }\r\n MathTmp.Vector3[0].copyFrom(this);\r\n [\"x\", \"y\", \"z\"].forEach(function (val, i) {\r\n _this[val] = MathTmp.Vector3[0][order[i]];\r\n });\r\n return this;\r\n };\r\n /**\r\n * Rotates the vector around 0,0,0 by a quaternion\r\n * @param quaternion the rotation quaternion\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionToRef = function (quaternion, result) {\r\n quaternion.toRotationMatrix(MathTmp.Matrix[0]);\r\n Vector3.TransformCoordinatesToRef(this, MathTmp.Matrix[0], result);\r\n return result;\r\n };\r\n /**\r\n * Rotates a vector around a given point\r\n * @param quaternion the rotation quaternion\r\n * @param point the point to rotate around\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionAroundPointToRef = function (quaternion, point, result) {\r\n this.subtractToRef(point, MathTmp.Vector3[0]);\r\n MathTmp.Vector3[0].rotateByQuaternionToRef(quaternion, MathTmp.Vector3[0]);\r\n point.addToRef(MathTmp.Vector3[0], result);\r\n return result;\r\n };\r\n /**\r\n * Normalize the current Vector3 with the given input length.\r\n * Please note that this is an in place operation.\r\n * @param len the length of the vector\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalizeFromLength = function (len) {\r\n if (len === 0 || len === 1.0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Normalize the current Vector3 to a new vector\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.normalizeToNew = function () {\r\n var normalized = new Vector3(0, 0, 0);\r\n this.normalizeToRef(normalized);\r\n return normalized;\r\n };\r\n /**\r\n * Normalize the current Vector3 to the reference\r\n * @param reference define the Vector3 to update\r\n * @returns the updated Vector3\r\n */\r\n Vector3.prototype.normalizeToRef = function (reference) {\r\n var len = this.length();\r\n if (len === 0 || len === 1.0) {\r\n return reference.copyFromFloats(this.x, this.y, this.z);\r\n }\r\n return this.scaleToRef(1.0 / len, reference);\r\n };\r\n /**\r\n * Creates a new Vector3 copied from the current Vector3\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.clone = function () {\r\n return new Vector3(this.x, this.y, this.z);\r\n };\r\n /**\r\n * Copies the given vector coordinates to the current Vector3 ones\r\n * @param source defines the source Vector3\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFrom = function (source) {\r\n return this.copyFromFloats(source.x, source.y, source.z);\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFromFloats = function (x, y, z) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n return this;\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.set = function (x, y, z) {\r\n return this.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y and z coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Get the clip factor between two vectors\r\n * @param vector0 defines the first operand\r\n * @param vector1 defines the second operand\r\n * @param axis defines the axis to use\r\n * @param size defines the size along the axis\r\n * @returns the clip factor\r\n */\r\n Vector3.GetClipFactor = function (vector0, vector1, axis, size) {\r\n var d0 = Vector3.Dot(vector0, axis) - size;\r\n var d1 = Vector3.Dot(vector1, axis) - size;\r\n var s = d0 / (d0 - d1);\r\n return s;\r\n };\r\n /**\r\n * Get angle between two vectors\r\n * @param vector0 angle between vector0 and vector1\r\n * @param vector1 angle between vector0 and vector1\r\n * @param normal direction of the normal\r\n * @return the angle between vector0 and vector1\r\n */\r\n Vector3.GetAngleBetweenVectors = function (vector0, vector1, normal) {\r\n var v0 = vector0.normalizeToRef(MathTmp.Vector3[1]);\r\n var v1 = vector1.normalizeToRef(MathTmp.Vector3[2]);\r\n var dot = Vector3.Dot(v0, v1);\r\n var n = MathTmp.Vector3[3];\r\n Vector3.CrossToRef(v0, v1, n);\r\n if (Vector3.Dot(n, normal) > 0) {\r\n return Math.acos(dot);\r\n }\r\n return -Math.acos(dot);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n */\r\n Vector3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given Float32Array\r\n * This function is deprecated. Use FromArray instead\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n */\r\n Vector3.FromFloatArray = function (array, offset) {\r\n return Vector3.FromArray(array, offset);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given Float32Array\r\n * This function is deprecated. Use FromArrayToRef instead.\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromFloatArrayToRef = function (array, offset, result) {\r\n return Vector3.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the given floats.\r\n * @param x defines the x coordinate of the source\r\n * @param y defines the y coordinate of the source\r\n * @param z defines the z coordinate of the source\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromFloatsToRef = function (x, y, z, result) {\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 0.0)\r\n * @returns a new empty Vector3\r\n */\r\n Vector3.Zero = function () {\r\n return new Vector3(0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 1.0, 1.0)\r\n * @returns a new unit Vector3\r\n */\r\n Vector3.One = function () {\r\n return new Vector3(1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 1.0, 0.0)\r\n * @returns a new up Vector3\r\n */\r\n Vector3.Up = function () {\r\n return new Vector3(0.0, 1.0, 0.0);\r\n };\r\n Object.defineProperty(Vector3, \"UpReadOnly\", {\r\n /**\r\n * Gets a up Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._UpReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3, \"ZeroReadOnly\", {\r\n /**\r\n * Gets a zero Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._ZeroReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new Vector3 set to (0.0, -1.0, 0.0)\r\n * @returns a new down Vector3\r\n */\r\n Vector3.Down = function () {\r\n return new Vector3(0.0, -1.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 1.0)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Forward = function () {\r\n return new Vector3(0.0, 0.0, 1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, -1.0)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Backward = function () {\r\n return new Vector3(0.0, 0.0, -1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 0.0, 0.0)\r\n * @returns a new right Vector3\r\n */\r\n Vector3.Right = function () {\r\n return new Vector3(1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (-1.0, 0.0, 0.0)\r\n * @returns a new left Vector3\r\n */\r\n Vector3.Left = function () {\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector.\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the transformed Vector3\r\n */\r\n Vector3.TransformCoordinates = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given vector\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesToRef = function (vector, transformation, result) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(vector.x, vector.y, vector.z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z)\r\n * This method computes tranformed coordinates only, not transformed direction vectors\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n var rx = x * m[0] + y * m[4] + z * m[8] + m[12];\r\n var ry = x * m[1] + y * m[5] + z * m[9] + m[13];\r\n var rz = x * m[2] + y * m[6] + z * m[10] + m[14];\r\n var rw = 1 / (x * m[3] + y * m[7] + z * m[11] + m[15]);\r\n result.x = rx * rw;\r\n result.y = ry * rw;\r\n result.z = rz * rw;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the new Vector3\r\n */\r\n Vector3.TransformNormal = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalToRef = function (vector, transformation, result) {\r\n this.TransformNormalFromFloatsToRef(vector.x, vector.y, vector.z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z)\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n result.x = x * m[0] + y * m[4] + z * m[8];\r\n result.y = x * m[1] + y * m[5] + z * m[9];\r\n result.z = x * m[2] + y * m[6] + z * m[10];\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" on the CatmullRom interpolation spline defined by the vectors \"value1\", \"value2\", \"value3\", \"value4\"\r\n * @param value1 defines the first control point\r\n * @param value2 defines the second control point\r\n * @param value3 defines the third control point\r\n * @param value4 defines the fourth control point\r\n * @param amount defines the amount on the spline to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +\r\n (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +\r\n ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +\r\n (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +\r\n ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));\r\n var z = 0.5 * ((((2.0 * value2.z) + ((-value1.z + value3.z) * amount)) +\r\n (((((2.0 * value1.z) - (5.0 * value2.z)) + (4.0 * value3.z)) - value4.z) * squared)) +\r\n ((((-value1.z + (3.0 * value2.z)) - (3.0 * value3.z)) + value4.z) * cubed));\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @returns the new Vector3\r\n */\r\n Vector3.Clamp = function (value, min, max) {\r\n var v = new Vector3();\r\n Vector3.ClampToRef(value, min, max, v);\r\n return v;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.ClampToRef = function (value, min, max, result) {\r\n var x = value.x;\r\n x = (x > max.x) ? max.x : x;\r\n x = (x < min.x) ? min.x : x;\r\n var y = value.y;\r\n y = (y > max.y) ? max.y : y;\r\n y = (y < min.y) ? min.y : y;\r\n var z = value.z;\r\n z = (z > max.z) ? max.z : z;\r\n z = (z < min.z) ? min.z : z;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Checks if a given vector is inside a specific range\r\n * @param v defines the vector to test\r\n * @param min defines the minimum range\r\n * @param max defines the maximum range\r\n */\r\n Vector3.CheckExtends = function (v, min, max) {\r\n min.minimizeInPlace(v);\r\n max.maximizeInPlace(v);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the Hermite interpolation spline defined by the vectors \"value1\", \"tangent1\", \"value2\", \"tangent2\"\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent vector\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent vector\r\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n var z = (((value1.z * part1) + (value2.z * part2)) + (tangent1.z * part3)) + (tangent2.z * part4);\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the linear interpolation between the vectors \"start\" and \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Lerp = function (start, end, amount) {\r\n var result = new Vector3(0, 0, 0);\r\n Vector3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the linear interpolation from the vector \"start\" for \"amount\" to the vector \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.LerpToRef = function (start, end, amount, result) {\r\n result.x = start.x + ((end.x - start.x) * amount);\r\n result.y = start.y + ((end.y - start.y) * amount);\r\n result.z = start.z + ((end.z - start.z) * amount);\r\n };\r\n /**\r\n * Returns the dot product (float) between the vectors \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Vector3.Dot = function (left, right) {\r\n return (left.x * right.x + left.y * right.y + left.z * right.z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the cross product of the vectors \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the cross product\r\n */\r\n Vector3.Cross = function (left, right) {\r\n var result = Vector3.Zero();\r\n Vector3.CrossToRef(left, right, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the cross product of \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.CrossToRef = function (left, right, result) {\r\n var x = left.y * right.z - left.z * right.y;\r\n var y = left.z * right.x - left.x * right.z;\r\n var z = left.x * right.y - left.y * right.x;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the normalization of the given vector\r\n * @param vector defines the Vector3 to normalize\r\n * @returns the new Vector3\r\n */\r\n Vector3.Normalize = function (vector) {\r\n var result = Vector3.Zero();\r\n Vector3.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the normalization of the given first vector\r\n * @param vector defines the Vector3 to normalize\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.NormalizeToRef = function (vector, result) {\r\n vector.normalizeToRef(result);\r\n };\r\n /**\r\n * Project a Vector3 onto screen space\r\n * @param vector defines the Vector3 to project\r\n * @param world defines the world matrix to use\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @param viewport defines the screen viewport to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Project = function (vector, world, transform, viewport) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = MathTmp.Matrix[1];\r\n Matrix.FromValuesToRef(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 0.5, 0, cx + cw / 2.0, ch / 2.0 + cy, 0.5, 1, viewportMatrix);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.multiplyToRef(viewportMatrix, matrix);\r\n return Vector3.TransformCoordinates(vector, matrix);\r\n };\r\n /** @hidden */\r\n Vector3._UnprojectFromInvertedMatrixToRef = function (source, matrix, result) {\r\n Vector3.TransformCoordinatesToRef(source, matrix, result);\r\n var m = matrix.m;\r\n var num = source.x * m[3] + source.y * m[7] + source.z * m[11] + m[15];\r\n if (_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(num, 1.0)) {\r\n result.scaleInPlace(1.0 / num);\r\n }\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.UnprojectFromTransform = function (source, viewportWidth, viewportHeight, world, transform) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.invert();\r\n source.x = source.x / viewportWidth * 2 - 1;\r\n source.y = -(source.y / viewportHeight * 2 - 1);\r\n var vector = new Vector3();\r\n Vector3._UnprojectFromInvertedMatrixToRef(source, matrix, vector);\r\n return vector;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Unproject = function (source, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Vector3.Zero();\r\n Vector3.UnprojectToRef(source, viewportWidth, viewportHeight, world, view, projection, result);\r\n return result;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectToRef = function (source, viewportWidth, viewportHeight, world, view, projection, result) {\r\n Vector3.UnprojectFloatsToRef(source.x, source.y, source.z, viewportWidth, viewportHeight, world, view, projection, result);\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param sourceZ defines the screen space z coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectFloatsToRef = function (sourceX, sourceY, sourceZ, viewportWidth, viewportHeight, world, view, projection, result) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var screenSource = MathTmp.Vector3[0];\r\n screenSource.x = sourceX / viewportWidth * 2 - 1;\r\n screenSource.y = -(sourceY / viewportHeight * 2 - 1);\r\n screenSource.z = 2 * sourceZ - 1.0;\r\n Vector3._UnprojectFromInvertedMatrixToRef(screenSource, matrix, result);\r\n };\r\n /**\r\n * Gets the minimal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Gets the maximal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the distance\r\n */\r\n Vector3.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector3.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the squared distance\r\n */\r\n Vector3.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n var z = value1.z - value2.z;\r\n return (x * x) + (y * y) + (z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 located at the center between \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),\r\n * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply\r\n * to something in order to rotate it from its local system to the given target system\r\n * Note: axis1, axis2 and axis3 are normalized during this operation\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns a new Vector3\r\n */\r\n Vector3.RotationFromAxis = function (axis1, axis2, axis3) {\r\n var rotation = Vector3.Zero();\r\n Vector3.RotationFromAxisToRef(axis1, axis2, axis3, rotation);\r\n return rotation;\r\n };\r\n /**\r\n * The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the Vector3 where to store the result\r\n */\r\n Vector3.RotationFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var quat = MathTmp.Quaternion[0];\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n quat.toEulerAnglesToRef(ref);\r\n };\r\n Vector3._UpReadOnly = Vector3.Up();\r\n Vector3._ZeroReadOnly = Vector3.Zero();\r\n return Vector3;\r\n}());\r\n\r\n/**\r\n * Vector4 class created for EulerAngle class conversion to Quaternion\r\n */\r\nvar Vector4 = /** @class */ (function () {\r\n /**\r\n * Creates a Vector4 object from the given floats.\r\n * @param x x value of the vector\r\n * @param y y value of the vector\r\n * @param z z value of the vector\r\n * @param w w value of the vector\r\n */\r\n function Vector4(\r\n /** x value of the vector */\r\n x, \r\n /** y value of the vector */\r\n y, \r\n /** z value of the vector */\r\n z, \r\n /** w value of the vector */\r\n w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n }\r\n /**\r\n * Returns the string with the Vector4 coordinates.\r\n * @returns a string containing all the vector values\r\n */\r\n Vector4.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \" W:\" + this.w + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Vector4\".\r\n * @returns \"Vector4\"\r\n */\r\n Vector4.prototype.getClassName = function () {\r\n return \"Vector4\";\r\n };\r\n /**\r\n * Returns the Vector4 hash code.\r\n * @returns a unique hash code\r\n */\r\n Vector4.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n hash = (hash * 397) ^ (this.w | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Returns a new array populated with 4 elements : the Vector4 coordinates.\r\n * @returns the resulting array\r\n */\r\n Vector4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array from the given index with the Vector4 coordinates.\r\n * @param array array to populate\r\n * @param index index of the array to start at (default: 0)\r\n * @returns the Vector4.\r\n */\r\n Vector4.prototype.toArray = function (array, index) {\r\n if (index === undefined) {\r\n index = 0;\r\n }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n array[index + 2] = this.z;\r\n array[index + 3] = this.w;\r\n return this;\r\n };\r\n /**\r\n * Adds the given vector to the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n this.z += otherVector.z;\r\n this.w += otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 as the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @returns the resulting vector\r\n */\r\n Vector4.prototype.add = function (otherVector) {\r\n return new Vector4(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n result.z = this.z + otherVector.z;\r\n result.w = this.w + otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Subtract in place the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n this.z -= otherVector.z;\r\n this.w -= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the new vector with the result\r\n */\r\n Vector4.prototype.subtract = function (otherVector) {\r\n return new Vector4(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n result.z = this.z - otherVector.z;\r\n result.w = this.w - otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n */\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @returns new vector containing the result\r\n */\r\n Vector4.prototype.subtractFromFloats = function (x, y, z, w) {\r\n return new Vector4(this.x - x, this.y - y, this.z - z, this.w - w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @param result the vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractFromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = this.x - x;\r\n result.y = this.y - y;\r\n result.z = this.z - z;\r\n result.w = this.w - w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 negated coordinates.\r\n * @returns a new vector with the negated values\r\n */\r\n Vector4.prototype.negate = function () {\r\n return new Vector4(-this.x, -this.y, -this.z, -this.w);\r\n };\r\n /**\r\n * Multiplies the current Vector4 coordinates by scale (float).\r\n * @param scale the number to scale with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n this.w *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @returns a new vector with the result\r\n */\r\n Vector4.prototype.scale = function (scale) {\r\n return new Vector4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @param result a vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n result.z = this.z * scale;\r\n result.w = this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector4 values by a factor and add the result to a given Vector4\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector4 object where to store the result\r\n * @returns the unmodified current Vector4\r\n */\r\n Vector4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n result.z += this.z * scale;\r\n result.w += this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are stricly equal to the given ones.\r\n * @param otherVector the vector to compare against\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are each beneath the distance \"epsilon\" from the given vector ones.\r\n * @param otherVector vector to compare against\r\n * @param epsilon (Default: very small number)\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; }\r\n return otherVector\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.x, otherVector.x, epsilon)\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.y, otherVector.y, epsilon)\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.z, otherVector.z, epsilon)\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.w, otherVector.w, epsilon);\r\n };\r\n /**\r\n * Boolean : True if the given floats are strictly equal to the current Vector4 coordinates.\r\n * @param x x value to compare against\r\n * @param y y value to compare against\r\n * @param z z value to compare against\r\n * @param w w value to compare against\r\n * @returns true if equal\r\n */\r\n Vector4.prototype.equalsToFloats = function (x, y, z, w) {\r\n return this.x === x && this.y === y && this.z === z && this.w === w;\r\n };\r\n /**\r\n * Multiplies in place the current Vector4 by the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n this.z *= otherVector.z;\r\n this.w *= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiply = function (otherVector) {\r\n return new Vector4(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n result.z = this.z * otherVector.z;\r\n result.w = this.w * otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates.\r\n * @param x x value multiply with\r\n * @param y y value multiply with\r\n * @param z z value multiply with\r\n * @param w w value multiply with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiplyByFloats = function (x, y, z, w) {\r\n return new Vector4(this.x * x, this.y * y, this.z * z, this.w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 set with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.divide = function (otherVector) {\r\n return new Vector4(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n result.z = this.z / otherVector.z;\r\n result.w = this.w / otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector vector to devide with\r\n * @returns the updated Vector3.\r\n */\r\n Vector4.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the minimum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.minimizeInPlace = function (other) {\r\n if (other.x < this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y < this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z < this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w < this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the maximum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.maximizeInPlace = function (other) {\r\n if (other.x > this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y > this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z > this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w > this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector4 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.floor = function () {\r\n return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector3 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.fract = function () {\r\n return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));\r\n };\r\n // Properties\r\n /**\r\n * Returns the Vector4 length (float).\r\n * @returns the length\r\n */\r\n Vector4.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n /**\r\n * Returns the Vector4 squared length (float).\r\n * @returns the length squared\r\n */\r\n Vector4.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n // Methods\r\n /**\r\n * Normalizes in place the Vector4.\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.\r\n * @returns this converted to a new vector3\r\n */\r\n Vector4.prototype.toVector3 = function () {\r\n return new Vector3(this.x, this.y, this.z);\r\n };\r\n /**\r\n * Returns a new Vector4 copied from the current one.\r\n * @returns the new cloned vector\r\n */\r\n Vector4.prototype.clone = function () {\r\n return new Vector4(this.x, this.y, this.z, this.w);\r\n };\r\n /**\r\n * Updates the current Vector4 with the given one coordinates.\r\n * @param source the source vector to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n this.z = source.z;\r\n this.w = source.w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to copy from\r\n * @param y float to copy from\r\n * @param z float to copy from\r\n * @param w float to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y, z and w coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector4.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = this.w = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new Vector4 set from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @returns the new vector\r\n */\r\n Vector4.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Vector4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n result.w = array[offset + 3];\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given Float32Array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromFloatArrayToRef = function (array, offset, result) {\r\n Vector4.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Updates the given vector \"result\" coordinates from the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @param result the vector to the floats in\r\n */\r\n Vector4.FromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = w;\r\n };\r\n /**\r\n * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)\r\n * @returns the new vector\r\n */\r\n Vector4.Zero = function () {\r\n return new Vector4(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)\r\n * @returns the new vector\r\n */\r\n Vector4.One = function () {\r\n return new Vector4(1.0, 1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new normalized Vector4 from the given one.\r\n * @param vector the vector to normalize\r\n * @returns the vector\r\n */\r\n Vector4.Normalize = function (vector) {\r\n var result = Vector4.Zero();\r\n Vector4.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the normalization of the given one.\r\n * @param vector the vector to normalize\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.NormalizeToRef = function (vector, result) {\r\n result.copyFrom(vector);\r\n result.normalize();\r\n };\r\n /**\r\n * Returns a vector with the minimum values from the left and right vectors\r\n * @param left left vector to minimize\r\n * @param right right vector to minimize\r\n * @returns a new vector with the minimum of the left and right vector values\r\n */\r\n Vector4.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Returns a vector with the maximum values from the left and right vectors\r\n * @param left left vector to maximize\r\n * @param right right vector to maximize\r\n * @returns a new vector with the maximum of the left and right vector values\r\n */\r\n Vector4.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors\r\n */\r\n Vector4.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector4.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors squared\r\n */\r\n Vector4.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n var z = value1.z - value2.z;\r\n var w = value1.w - value2.w;\r\n return (x * x) + (y * y) + (z * z) + (w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 located at the center between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the center between\r\n * @param value2 value to calulate the center between\r\n * @return the center between the two vectors\r\n */\r\n Vector4.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @returns the new vector\r\n */\r\n Vector4.TransformNormal = function (vector, transformation) {\r\n var result = Vector4.Zero();\r\n Vector4.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.TransformNormalToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + (vector.z * m[8]);\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + (vector.z * m[9]);\r\n var z = (vector.x * m[2]) + (vector.y * m[6]) + (vector.z * m[10]);\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = vector.w;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z, w).\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param x value to transform\r\n * @param y value to transform\r\n * @param z value to transform\r\n * @param w value to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the results in\r\n */\r\n Vector4.TransformNormalFromFloatsToRef = function (x, y, z, w, transformation, result) {\r\n var m = transformation.m;\r\n result.x = (x * m[0]) + (y * m[4]) + (z * m[8]);\r\n result.y = (x * m[1]) + (y * m[5]) + (z * m[9]);\r\n result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);\r\n result.w = w;\r\n };\r\n /**\r\n * Creates a new Vector4 from a Vector3\r\n * @param source defines the source data\r\n * @param w defines the 4th component (default is 0)\r\n * @returns a new Vector4\r\n */\r\n Vector4.FromVector3 = function (source, w) {\r\n if (w === void 0) { w = 0; }\r\n return new Vector4(source.x, source.y, source.z, w);\r\n };\r\n return Vector4;\r\n}());\r\n\r\n/**\r\n * Class used to store quaternion data\r\n * @see https://en.wikipedia.org/wiki/Quaternion\r\n * @see http://doc.babylonjs.com/features/position,_rotation,_scaling\r\n */\r\nvar Quaternion = /** @class */ (function () {\r\n /**\r\n * Creates a new Quaternion from the given floats\r\n * @param x defines the first component (0 by default)\r\n * @param y defines the second component (0 by default)\r\n * @param z defines the third component (0 by default)\r\n * @param w defines the fourth component (1.0 by default)\r\n */\r\n function Quaternion(\r\n /** defines the first component (0 by default) */\r\n x, \r\n /** defines the second component (0 by default) */\r\n y, \r\n /** defines the third component (0 by default) */\r\n z, \r\n /** defines the fourth component (1.0 by default) */\r\n w) {\r\n if (x === void 0) { x = 0.0; }\r\n if (y === void 0) { y = 0.0; }\r\n if (z === void 0) { z = 0.0; }\r\n if (w === void 0) { w = 1.0; }\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n }\r\n /**\r\n * Gets a string representation for the current quaternion\r\n * @returns a string with the Quaternion coordinates\r\n */\r\n Quaternion.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \" W:\" + this.w + \"}\";\r\n };\r\n /**\r\n * Gets the class name of the quaternion\r\n * @returns the string \"Quaternion\"\r\n */\r\n Quaternion.prototype.getClassName = function () {\r\n return \"Quaternion\";\r\n };\r\n /**\r\n * Gets a hash code for this quaternion\r\n * @returns the quaternion hash code\r\n */\r\n Quaternion.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n hash = (hash * 397) ^ (this.w | 0);\r\n return hash;\r\n };\r\n /**\r\n * Copy the quaternion to an array\r\n * @returns a new array populated with 4 elements from the quaternion coordinates\r\n */\r\n Quaternion.prototype.asArray = function () {\r\n return [this.x, this.y, this.z, this.w];\r\n };\r\n /**\r\n * Check if two quaternions are equals\r\n * @param otherQuaternion defines the second operand\r\n * @return true if the current quaternion and the given one coordinates are strictly equals\r\n */\r\n Quaternion.prototype.equals = function (otherQuaternion) {\r\n return otherQuaternion && this.x === otherQuaternion.x && this.y === otherQuaternion.y && this.z === otherQuaternion.z && this.w === otherQuaternion.w;\r\n };\r\n /**\r\n * Clone the current quaternion\r\n * @returns a new quaternion copied from the current one\r\n */\r\n Quaternion.prototype.clone = function () {\r\n return new Quaternion(this.x, this.y, this.z, this.w);\r\n };\r\n /**\r\n * Copy a quaternion to the current one\r\n * @param other defines the other quaternion\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFrom = function (other) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n this.z = other.z;\r\n this.w = other.w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Adds two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the addition result of the given one and the current quaternion\r\n */\r\n Quaternion.prototype.add = function (other) {\r\n return new Quaternion(this.x + other.x, this.y + other.y, this.z + other.z, this.w + other.w);\r\n };\r\n /**\r\n * Add a quaternion to the current one\r\n * @param other defines the quaternion to add\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.addInPlace = function (other) {\r\n this.x += other.x;\r\n this.y += other.y;\r\n this.z += other.z;\r\n this.w += other.w;\r\n return this;\r\n };\r\n /**\r\n * Subtract two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the subtraction result of the given one from the current one\r\n */\r\n Quaternion.prototype.subtract = function (other) {\r\n return new Quaternion(this.x - other.x, this.y - other.y, this.z - other.z, this.w - other.w);\r\n };\r\n /**\r\n * Multiplies the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns a new quaternion set by multiplying the current quaternion coordinates by the float \"scale\"\r\n */\r\n Quaternion.prototype.scale = function (value) {\r\n return new Quaternion(this.x * value, this.y * value, this.z * value, this.w * value);\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and stores the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n result.z = this.z * scale;\r\n result.w = this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns the current modified quaternion\r\n */\r\n Quaternion.prototype.scaleInPlace = function (value) {\r\n this.x *= value;\r\n this.y *= value;\r\n this.z *= value;\r\n this.w *= value;\r\n return this;\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and add the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n result.z += this.z * scale;\r\n result.w += this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies two quaternions\r\n * @param q1 defines the second operand\r\n * @returns a new quaternion set as the multiplication result of the current one with the given one \"q1\"\r\n */\r\n Quaternion.prototype.multiply = function (q1) {\r\n var result = new Quaternion(0, 0, 0, 1.0);\r\n this.multiplyToRef(q1, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" as the the multiplication result of the current one with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @param result defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.multiplyToRef = function (q1, result) {\r\n var x = this.x * q1.w + this.y * q1.z - this.z * q1.y + this.w * q1.x;\r\n var y = -this.x * q1.z + this.y * q1.w + this.z * q1.x + this.w * q1.y;\r\n var z = this.x * q1.y - this.y * q1.x + this.z * q1.w + this.w * q1.z;\r\n var w = -this.x * q1.x - this.y * q1.y - this.z * q1.z + this.w * q1.w;\r\n result.copyFromFloats(x, y, z, w);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the multiplication of itself with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @returns the currentupdated quaternion\r\n */\r\n Quaternion.prototype.multiplyInPlace = function (q1) {\r\n this.multiplyToRef(q1, this);\r\n return this;\r\n };\r\n /**\r\n * Conjugates (1-q) the current quaternion and stores the result in the given quaternion\r\n * @param ref defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.conjugateToRef = function (ref) {\r\n ref.copyFromFloats(-this.x, -this.y, -this.z, this.w);\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.conjugateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns a new quaternion\r\n */\r\n Quaternion.prototype.conjugate = function () {\r\n var result = new Quaternion(-this.x, -this.y, -this.z, this.w);\r\n return result;\r\n };\r\n /**\r\n * Gets length of current quaternion\r\n * @returns the quaternion length (float)\r\n */\r\n Quaternion.prototype.length = function () {\r\n return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z) + (this.w * this.w));\r\n };\r\n /**\r\n * Normalize in place the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n var inv = 1.0 / len;\r\n this.x *= inv;\r\n this.y *= inv;\r\n this.z *= inv;\r\n this.w *= inv;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the Euler angles translated from the current quaternion\r\n * @param order is a reserved parameter and is ignore for now\r\n * @returns a new Vector3 containing the Euler angles\r\n */\r\n Quaternion.prototype.toEulerAngles = function (order) {\r\n if (order === void 0) { order = \"YZX\"; }\r\n var result = Vector3.Zero();\r\n this.toEulerAnglesToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector3 \"result\" with the Euler angles translated from the current quaternion\r\n * @param result defines the vector which will be filled with the Euler angles\r\n * @param order is a reserved parameter and is ignore for now\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toEulerAnglesToRef = function (result) {\r\n var qz = this.z;\r\n var qx = this.x;\r\n var qy = this.y;\r\n var qw = this.w;\r\n var sqw = qw * qw;\r\n var sqz = qz * qz;\r\n var sqx = qx * qx;\r\n var sqy = qy * qy;\r\n var zAxisY = qy * qz - qx * qw;\r\n var limit = .4999999;\r\n if (zAxisY < -limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else if (zAxisY > limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = -Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else {\r\n result.z = Math.atan2(2.0 * (qx * qy + qz * qw), (-sqz - sqx + sqy + sqw));\r\n result.x = Math.asin(-2.0 * (qz * qy - qx * qw));\r\n result.y = Math.atan2(2.0 * (qz * qx + qy * qw), (sqz - sqx - sqy + sqw));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the given rotation matrix with the current quaternion values\r\n * @param result defines the target matrix\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toRotationMatrix = function (result) {\r\n Matrix.FromQuaternionToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.fromRotationMatrix = function (matrix) {\r\n Quaternion.FromRotationMatrixToRef(matrix, this);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new quaternion from a rotation matrix\r\n * @param matrix defines the source matrix\r\n * @returns a new quaternion created from the given rotation matrix values\r\n */\r\n Quaternion.FromRotationMatrix = function (matrix) {\r\n var result = new Quaternion();\r\n Quaternion.FromRotationMatrixToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given quaternion with the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.FromRotationMatrixToRef = function (matrix, result) {\r\n var data = matrix.m;\r\n var m11 = data[0], m12 = data[4], m13 = data[8];\r\n var m21 = data[1], m22 = data[5], m23 = data[9];\r\n var m31 = data[2], m32 = data[6], m33 = data[10];\r\n var trace = m11 + m22 + m33;\r\n var s;\r\n if (trace > 0) {\r\n s = 0.5 / Math.sqrt(trace + 1.0);\r\n result.w = 0.25 / s;\r\n result.x = (m32 - m23) * s;\r\n result.y = (m13 - m31) * s;\r\n result.z = (m21 - m12) * s;\r\n }\r\n else if (m11 > m22 && m11 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\r\n result.w = (m32 - m23) / s;\r\n result.x = 0.25 * s;\r\n result.y = (m12 + m21) / s;\r\n result.z = (m13 + m31) / s;\r\n }\r\n else if (m22 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\r\n result.w = (m13 - m31) / s;\r\n result.x = (m12 + m21) / s;\r\n result.y = 0.25 * s;\r\n result.z = (m23 + m32) / s;\r\n }\r\n else {\r\n s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\r\n result.w = (m21 - m12) / s;\r\n result.x = (m13 + m31) / s;\r\n result.y = (m23 + m32) / s;\r\n result.z = 0.25 * s;\r\n }\r\n };\r\n /**\r\n * Returns the dot product (float) between the quaternions \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Quaternion.Dot = function (left, right) {\r\n return (left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w);\r\n };\r\n /**\r\n * Checks if the two quaternions are close to each other\r\n * @param quat0 defines the first quaternion to check\r\n * @param quat1 defines the second quaternion to check\r\n * @returns true if the two quaternions are close to each other\r\n */\r\n Quaternion.AreClose = function (quat0, quat1) {\r\n var dot = Quaternion.Dot(quat0, quat1);\r\n return dot >= 0;\r\n };\r\n /**\r\n * Creates an empty quaternion\r\n * @returns a new quaternion set to (0.0, 0.0, 0.0)\r\n */\r\n Quaternion.Zero = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @returns a new quaternion as the inverted current quaternion\r\n */\r\n Quaternion.Inverse = function (q) {\r\n return new Quaternion(-q.x, -q.y, -q.z, q.w);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @param result the quaternion the result will be stored in\r\n * @returns the result quaternion\r\n */\r\n Quaternion.InverseToRef = function (q, result) {\r\n result.set(-q.x, -q.y, -q.z, q.w);\r\n return result;\r\n };\r\n /**\r\n * Creates an identity quaternion\r\n * @returns the identity quaternion\r\n */\r\n Quaternion.Identity = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 1.0);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given quaternion is identity\r\n * @param quaternion defines the quaternion to check\r\n * @returns true if the quaternion is identity\r\n */\r\n Quaternion.IsIdentity = function (quaternion) {\r\n return quaternion && quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\r\n };\r\n /**\r\n * Creates a quaternion from a rotation around an axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @returns a new quaternion created from the given axis (Vector3) and angle in radians (float)\r\n */\r\n Quaternion.RotationAxis = function (axis, angle) {\r\n return Quaternion.RotationAxisToRef(axis, angle, new Quaternion());\r\n };\r\n /**\r\n * Creates a rotation around an axis and stores it into the given quaternion\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\n Quaternion.RotationAxisToRef = function (axis, angle, result) {\r\n var sin = Math.sin(angle / 2);\r\n axis.normalize();\r\n result.w = Math.cos(angle / 2);\r\n result.x = axis.x * sin;\r\n result.y = axis.y * sin;\r\n result.z = axis.z * sin;\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from data stored into an array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the source array where the data starts\r\n * @returns a new quaternion\r\n */\r\n Quaternion.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Quaternion(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerAngles = function (x, y, z) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerAnglesToRef = function (x, y, z, result) {\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, result);\r\n return result;\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerVector = function (vec) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(vec.y, vec.x, vec.z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerVectorToRef = function (vec, result) {\r\n Quaternion.RotationYawPitchRollToRef(vec.y, vec.x, vec.z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles (y, x, z)\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, q);\r\n return q;\r\n };\r\n /**\r\n * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n // Produces a quaternion from Euler angles in the z-y-x orientation (Tait-Bryan angles)\r\n var halfRoll = roll * 0.5;\r\n var halfPitch = pitch * 0.5;\r\n var halfYaw = yaw * 0.5;\r\n var sinRoll = Math.sin(halfRoll);\r\n var cosRoll = Math.cos(halfRoll);\r\n var sinPitch = Math.sin(halfPitch);\r\n var cosPitch = Math.cos(halfPitch);\r\n var sinYaw = Math.sin(halfYaw);\r\n var cosYaw = Math.cos(halfYaw);\r\n result.x = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);\r\n result.y = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll);\r\n result.z = (cosYaw * cosPitch * sinRoll) - (sinYaw * sinPitch * cosRoll);\r\n result.w = (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll);\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGamma = function (alpha, beta, gamma) {\r\n var result = new Quaternion();\r\n Quaternion.RotationAlphaBetaGammaToRef(alpha, beta, gamma, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGammaToRef = function (alpha, beta, gamma, result) {\r\n // Produces a quaternion from Euler angles in the z-x-z orientation\r\n var halfGammaPlusAlpha = (gamma + alpha) * 0.5;\r\n var halfGammaMinusAlpha = (gamma - alpha) * 0.5;\r\n var halfBeta = beta * 0.5;\r\n result.x = Math.cos(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.y = Math.sin(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.z = Math.sin(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n result.w = Math.cos(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n };\r\n /**\r\n * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxis = function (axis1, axis2, axis3) {\r\n var quat = new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n return quat;\r\n };\r\n /**\r\n * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the target quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var rotMat = MathTmp.Matrix[0];\r\n Matrix.FromXYZAxesToRef(axis1.normalize(), axis2.normalize(), axis3.normalize(), rotMat);\r\n Quaternion.FromRotationMatrixToRef(rotMat, ref);\r\n };\r\n /**\r\n * Interpolates between two quaternions\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Slerp = function (left, right, amount) {\r\n var result = Quaternion.Identity();\r\n Quaternion.SlerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Interpolates between two quaternions and stores it into a target quaternion\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.SlerpToRef = function (left, right, amount, result) {\r\n var num2;\r\n var num3;\r\n var num4 = (((left.x * right.x) + (left.y * right.y)) + (left.z * right.z)) + (left.w * right.w);\r\n var flag = false;\r\n if (num4 < 0) {\r\n flag = true;\r\n num4 = -num4;\r\n }\r\n if (num4 > 0.999999) {\r\n num3 = 1 - amount;\r\n num2 = flag ? -amount : amount;\r\n }\r\n else {\r\n var num5 = Math.acos(num4);\r\n var num6 = (1.0 / Math.sin(num5));\r\n num3 = (Math.sin((1.0 - amount) * num5)) * num6;\r\n num2 = flag ? ((-Math.sin(amount * num5)) * num6) : ((Math.sin(amount * num5)) * num6);\r\n }\r\n result.x = (num3 * left.x) + (num2 * right.x);\r\n result.y = (num3 * left.y) + (num2 * right.y);\r\n result.z = (num3 * left.z) + (num2 * right.z);\r\n result.w = (num3 * left.w) + (num2 * right.w);\r\n };\r\n /**\r\n * Interpolate between two quaternions using Hermite interpolation\r\n * @param value1 defines first quaternion\r\n * @param tangent1 defines the incoming tangent\r\n * @param value2 defines second quaternion\r\n * @param tangent2 defines the outgoing tangent\r\n * @param amount defines the target quaternion\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n var z = (((value1.z * part1) + (value2.z * part2)) + (tangent1.z * part3)) + (tangent2.z * part4);\r\n var w = (((value1.w * part1) + (value2.w * part2)) + (tangent1.w * part3)) + (tangent2.w * part4);\r\n return new Quaternion(x, y, z, w);\r\n };\r\n return Quaternion;\r\n}());\r\n\r\n/**\r\n * Class used to store matrix data (4x4)\r\n */\r\nvar Matrix = /** @class */ (function () {\r\n /**\r\n * Creates an empty matrix (filled with zeros)\r\n */\r\n function Matrix() {\r\n this._isIdentity = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2 = true;\r\n this._isIdentity3x2Dirty = true;\r\n /**\r\n * Gets the update flag of the matrix which is an unique number for the matrix.\r\n * It will be incremented every time the matrix data change.\r\n * You can use it to speed the comparison between two versions of the same matrix.\r\n */\r\n this.updateFlag = -1;\r\n this._m = new Float32Array(16);\r\n this._updateIdentityStatus(false);\r\n }\r\n Object.defineProperty(Matrix.prototype, \"m\", {\r\n /**\r\n * Gets the internal data of the matrix\r\n */\r\n get: function () { return this._m; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Matrix.prototype._markAsUpdated = function () {\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = false;\r\n this._isIdentity3x2 = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2Dirty = true;\r\n };\r\n /** @hidden */\r\n Matrix.prototype._updateIdentityStatus = function (isIdentity, isIdentityDirty, isIdentity3x2, isIdentity3x2Dirty) {\r\n if (isIdentityDirty === void 0) { isIdentityDirty = false; }\r\n if (isIdentity3x2 === void 0) { isIdentity3x2 = false; }\r\n if (isIdentity3x2Dirty === void 0) { isIdentity3x2Dirty = true; }\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = isIdentity;\r\n this._isIdentity3x2 = isIdentity || isIdentity3x2;\r\n this._isIdentityDirty = this._isIdentity ? false : isIdentityDirty;\r\n this._isIdentity3x2Dirty = this._isIdentity3x2 ? false : isIdentity3x2Dirty;\r\n };\r\n // Properties\r\n /**\r\n * Check if the current matrix is identity\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentity = function () {\r\n if (this._isIdentityDirty) {\r\n this._isIdentityDirty = false;\r\n var m = this._m;\r\n this._isIdentity = (m[0] === 1.0 && m[1] === 0.0 && m[2] === 0.0 && m[3] === 0.0 &&\r\n m[4] === 0.0 && m[5] === 1.0 && m[6] === 0.0 && m[7] === 0.0 &&\r\n m[8] === 0.0 && m[9] === 0.0 && m[10] === 1.0 && m[11] === 0.0 &&\r\n m[12] === 0.0 && m[13] === 0.0 && m[14] === 0.0 && m[15] === 1.0);\r\n }\r\n return this._isIdentity;\r\n };\r\n /**\r\n * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentityAs3x2 = function () {\r\n if (this._isIdentity3x2Dirty) {\r\n this._isIdentity3x2Dirty = false;\r\n if (this._m[0] !== 1.0 || this._m[5] !== 1.0 || this._m[15] !== 1.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else if (this._m[1] !== 0.0 || this._m[2] !== 0.0 || this._m[3] !== 0.0 ||\r\n this._m[4] !== 0.0 || this._m[6] !== 0.0 || this._m[7] !== 0.0 ||\r\n this._m[8] !== 0.0 || this._m[9] !== 0.0 || this._m[10] !== 0.0 || this._m[11] !== 0.0 ||\r\n this._m[12] !== 0.0 || this._m[13] !== 0.0 || this._m[14] !== 0.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else {\r\n this._isIdentity3x2 = true;\r\n }\r\n }\r\n return this._isIdentity3x2;\r\n };\r\n /**\r\n * Gets the determinant of the matrix\r\n * @returns the matrix determinant\r\n */\r\n Matrix.prototype.determinant = function () {\r\n if (this._isIdentity === true) {\r\n return 1;\r\n }\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n // https://en.wikipedia.org/wiki/Laplace_expansion\r\n // to compute the deterrminant of a 4x4 Matrix we compute the cofactors of any row or column,\r\n // then we multiply each Cofactor by its corresponding matrix value and sum them all to get the determinant\r\n // Cofactor(i, j) = sign(i,j) * det(Minor(i, j))\r\n // where\r\n // - sign(i,j) = (i+j) % 2 === 0 ? 1 : -1\r\n // - Minor(i, j) is the 3x3 matrix we get by removing row i and column j from current Matrix\r\n //\r\n // Here we do that for the 1st row.\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n return m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n };\r\n // Methods\r\n /**\r\n * Returns the matrix as a Float32Array\r\n * @returns the matrix underlying array\r\n */\r\n Matrix.prototype.toArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Returns the matrix as a Float32Array\r\n * @returns the matrix underlying array.\r\n */\r\n Matrix.prototype.asArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Inverts the current matrix in place\r\n * @returns the current inverted matrix\r\n */\r\n Matrix.prototype.invert = function () {\r\n this.invertToRef(this);\r\n return this;\r\n };\r\n /**\r\n * Sets all the matrix elements to zero\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.reset = function () {\r\n Matrix.FromValuesToRef(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, this);\r\n this._updateIdentityStatus(false);\r\n return this;\r\n };\r\n /**\r\n * Adds the current matrix with a second one\r\n * @param other defines the matrix to add\r\n * @returns a new matrix as the addition of the current matrix and the given one\r\n */\r\n Matrix.prototype.add = function (other) {\r\n var result = new Matrix();\r\n this.addToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" to the addition of the current matrix and the given one\r\n * @param other defines the matrix to add\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.addToRef = function (other, result) {\r\n var m = this._m;\r\n var resultM = result._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = m[index] + otherM[index];\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds in place the given matrix to the current matrix\r\n * @param other defines the second operand\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addToSelf = function (other) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n m[index] += otherM[index];\r\n }\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix to the current inverted Matrix\r\n * @param other defines the target matrix\r\n * @returns the unmodified current matrix\r\n */\r\n Matrix.prototype.invertToRef = function (other) {\r\n if (this._isIdentity === true) {\r\n Matrix.IdentityToRef(other);\r\n return this;\r\n }\r\n // the inverse of a Matrix is the transpose of cofactor matrix divided by the determinant\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n var det = m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n if (det === 0) {\r\n // not invertible\r\n other.copyFrom(this);\r\n return this;\r\n }\r\n var detInv = 1 / det;\r\n var det_12_33 = m12 * m33 - m32 * m13;\r\n var det_11_33 = m11 * m33 - m31 * m13;\r\n var det_11_32 = m11 * m32 - m31 * m12;\r\n var det_10_33 = m10 * m33 - m30 * m13;\r\n var det_10_32 = m10 * m32 - m30 * m12;\r\n var det_10_31 = m10 * m31 - m30 * m11;\r\n var det_12_23 = m12 * m23 - m22 * m13;\r\n var det_11_23 = m11 * m23 - m21 * m13;\r\n var det_11_22 = m11 * m22 - m21 * m12;\r\n var det_10_23 = m10 * m23 - m20 * m13;\r\n var det_10_22 = m10 * m22 - m20 * m12;\r\n var det_10_21 = m10 * m21 - m20 * m11;\r\n var cofact_10 = -(m01 * det_22_33 - m02 * det_21_33 + m03 * det_21_32);\r\n var cofact_11 = +(m00 * det_22_33 - m02 * det_20_33 + m03 * det_20_32);\r\n var cofact_12 = -(m00 * det_21_33 - m01 * det_20_33 + m03 * det_20_31);\r\n var cofact_13 = +(m00 * det_21_32 - m01 * det_20_32 + m02 * det_20_31);\r\n var cofact_20 = +(m01 * det_12_33 - m02 * det_11_33 + m03 * det_11_32);\r\n var cofact_21 = -(m00 * det_12_33 - m02 * det_10_33 + m03 * det_10_32);\r\n var cofact_22 = +(m00 * det_11_33 - m01 * det_10_33 + m03 * det_10_31);\r\n var cofact_23 = -(m00 * det_11_32 - m01 * det_10_32 + m02 * det_10_31);\r\n var cofact_30 = -(m01 * det_12_23 - m02 * det_11_23 + m03 * det_11_22);\r\n var cofact_31 = +(m00 * det_12_23 - m02 * det_10_23 + m03 * det_10_22);\r\n var cofact_32 = -(m00 * det_11_23 - m01 * det_10_23 + m03 * det_10_21);\r\n var cofact_33 = +(m00 * det_11_22 - m01 * det_10_22 + m02 * det_10_21);\r\n Matrix.FromValuesToRef(cofact_00 * detInv, cofact_10 * detInv, cofact_20 * detInv, cofact_30 * detInv, cofact_01 * detInv, cofact_11 * detInv, cofact_21 * detInv, cofact_31 * detInv, cofact_02 * detInv, cofact_12 * detInv, cofact_22 * detInv, cofact_32 * detInv, cofact_03 * detInv, cofact_13 * detInv, cofact_23 * detInv, cofact_33 * detInv, other);\r\n return this;\r\n };\r\n /**\r\n * add a value at the specified position in the current Matrix\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addAtIndex = function (index, value) {\r\n this._m[index] += value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * mutiply the specified position in the current Matrix by a value\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.multiplyAtIndex = function (index, value) {\r\n this._m[index] *= value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslationFromFloats = function (x, y, z) {\r\n this._m[12] = x;\r\n this._m[13] = y;\r\n this._m[14] = z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addTranslationFromFloats = function (x, y, z) {\r\n this._m[12] += x;\r\n this._m[13] += y;\r\n this._m[14] += z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector in the current matrix\r\n * @param vector3 defines the translation to insert\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslation = function (vector3) {\r\n return this.setTranslationFromFloats(vector3.x, vector3.y, vector3.z);\r\n };\r\n /**\r\n * Gets the translation value of the current matrix\r\n * @returns a new Vector3 as the extracted translation from the matrix\r\n */\r\n Matrix.prototype.getTranslation = function () {\r\n return new Vector3(this._m[12], this._m[13], this._m[14]);\r\n };\r\n /**\r\n * Fill a Vector3 with the extracted translation from the matrix\r\n * @param result defines the Vector3 where to store the translation\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getTranslationToRef = function (result) {\r\n result.x = this._m[12];\r\n result.y = this._m[13];\r\n result.z = this._m[14];\r\n return this;\r\n };\r\n /**\r\n * Remove rotation and scaling part from the matrix\r\n * @returns the updated matrix\r\n */\r\n Matrix.prototype.removeRotationAndScaling = function () {\r\n var m = this.m;\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, m[12], m[13], m[14], m[15], this);\r\n this._updateIdentityStatus(m[12] === 0 && m[13] === 0 && m[14] === 0 && m[15] === 1);\r\n return this;\r\n };\r\n /**\r\n * Multiply two matrices\r\n * @param other defines the second operand\r\n * @returns a new matrix set with the multiplication result of the current Matrix and the given one\r\n */\r\n Matrix.prototype.multiply = function (other) {\r\n var result = new Matrix();\r\n this.multiplyToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the current matrix from the given one\r\n * @param other defines the source matrix\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.copyFrom = function (other) {\r\n other.copyToArray(this._m);\r\n var o = other;\r\n this._updateIdentityStatus(o._isIdentity, o._isIdentityDirty, o._isIdentity3x2, o._isIdentity3x2Dirty);\r\n return this;\r\n };\r\n /**\r\n * Populates the given array from the starting index with the current matrix values\r\n * @param array defines the target array\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.copyToArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n for (var index = 0; index < 16; index++) {\r\n array[offset + index] = this._m[index];\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" with the multiplication result of the current Matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the matrix where to store the multiplication\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToRef = function (other, result) {\r\n if (this._isIdentity) {\r\n result.copyFrom(other);\r\n return this;\r\n }\r\n if (other._isIdentity) {\r\n result.copyFrom(this);\r\n return this;\r\n }\r\n this.multiplyToArray(other, result._m, 0);\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the Float32Array \"result\" from the given index \"offset\" with the multiplication of the current matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the array where to store the multiplication\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToArray = function (other, result, offset) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n var tm0 = m[0], tm1 = m[1], tm2 = m[2], tm3 = m[3];\r\n var tm4 = m[4], tm5 = m[5], tm6 = m[6], tm7 = m[7];\r\n var tm8 = m[8], tm9 = m[9], tm10 = m[10], tm11 = m[11];\r\n var tm12 = m[12], tm13 = m[13], tm14 = m[14], tm15 = m[15];\r\n var om0 = otherM[0], om1 = otherM[1], om2 = otherM[2], om3 = otherM[3];\r\n var om4 = otherM[4], om5 = otherM[5], om6 = otherM[6], om7 = otherM[7];\r\n var om8 = otherM[8], om9 = otherM[9], om10 = otherM[10], om11 = otherM[11];\r\n var om12 = otherM[12], om13 = otherM[13], om14 = otherM[14], om15 = otherM[15];\r\n result[offset] = tm0 * om0 + tm1 * om4 + tm2 * om8 + tm3 * om12;\r\n result[offset + 1] = tm0 * om1 + tm1 * om5 + tm2 * om9 + tm3 * om13;\r\n result[offset + 2] = tm0 * om2 + tm1 * om6 + tm2 * om10 + tm3 * om14;\r\n result[offset + 3] = tm0 * om3 + tm1 * om7 + tm2 * om11 + tm3 * om15;\r\n result[offset + 4] = tm4 * om0 + tm5 * om4 + tm6 * om8 + tm7 * om12;\r\n result[offset + 5] = tm4 * om1 + tm5 * om5 + tm6 * om9 + tm7 * om13;\r\n result[offset + 6] = tm4 * om2 + tm5 * om6 + tm6 * om10 + tm7 * om14;\r\n result[offset + 7] = tm4 * om3 + tm5 * om7 + tm6 * om11 + tm7 * om15;\r\n result[offset + 8] = tm8 * om0 + tm9 * om4 + tm10 * om8 + tm11 * om12;\r\n result[offset + 9] = tm8 * om1 + tm9 * om5 + tm10 * om9 + tm11 * om13;\r\n result[offset + 10] = tm8 * om2 + tm9 * om6 + tm10 * om10 + tm11 * om14;\r\n result[offset + 11] = tm8 * om3 + tm9 * om7 + tm10 * om11 + tm11 * om15;\r\n result[offset + 12] = tm12 * om0 + tm13 * om4 + tm14 * om8 + tm15 * om12;\r\n result[offset + 13] = tm12 * om1 + tm13 * om5 + tm14 * om9 + tm15 * om13;\r\n result[offset + 14] = tm12 * om2 + tm13 * om6 + tm14 * om10 + tm15 * om14;\r\n result[offset + 15] = tm12 * om3 + tm13 * om7 + tm14 * om11 + tm15 * om15;\r\n return this;\r\n };\r\n /**\r\n * Check equality between this matrix and a second one\r\n * @param value defines the second matrix to compare\r\n * @returns true is the current matrix and the given one values are strictly equal\r\n */\r\n Matrix.prototype.equals = function (value) {\r\n var other = value;\r\n if (!other) {\r\n return false;\r\n }\r\n if (this._isIdentity || other._isIdentity) {\r\n if (!this._isIdentityDirty && !other._isIdentityDirty) {\r\n return this._isIdentity && other._isIdentity;\r\n }\r\n }\r\n var m = this.m;\r\n var om = other.m;\r\n return (m[0] === om[0] && m[1] === om[1] && m[2] === om[2] && m[3] === om[3] &&\r\n m[4] === om[4] && m[5] === om[5] && m[6] === om[6] && m[7] === om[7] &&\r\n m[8] === om[8] && m[9] === om[9] && m[10] === om[10] && m[11] === om[11] &&\r\n m[12] === om[12] && m[13] === om[13] && m[14] === om[14] && m[15] === om[15]);\r\n };\r\n /**\r\n * Clone the current matrix\r\n * @returns a new matrix from the current matrix\r\n */\r\n Matrix.prototype.clone = function () {\r\n var matrix = new Matrix();\r\n matrix.copyFrom(this);\r\n return matrix;\r\n };\r\n /**\r\n * Returns the name of the current matrix class\r\n * @returns the string \"Matrix\"\r\n */\r\n Matrix.prototype.getClassName = function () {\r\n return \"Matrix\";\r\n };\r\n /**\r\n * Gets the hash code of the current matrix\r\n * @returns the hash code\r\n */\r\n Matrix.prototype.getHashCode = function () {\r\n var hash = this._m[0] | 0;\r\n for (var i = 1; i < 16; i++) {\r\n hash = (hash * 397) ^ (this._m[i] | 0);\r\n }\r\n return hash;\r\n };\r\n /**\r\n * Decomposes the current Matrix into a translation, rotation and scaling components\r\n * @param scale defines the scale vector3 given as a reference to update\r\n * @param rotation defines the rotation quaternion given as a reference to update\r\n * @param translation defines the translation vector3 given as a reference to update\r\n * @returns true if operation was successful\r\n */\r\n Matrix.prototype.decompose = function (scale, rotation, translation) {\r\n if (this._isIdentity) {\r\n if (translation) {\r\n translation.setAll(0);\r\n }\r\n if (scale) {\r\n scale.setAll(1);\r\n }\r\n if (rotation) {\r\n rotation.copyFromFloats(0, 0, 0, 1);\r\n }\r\n return true;\r\n }\r\n var m = this._m;\r\n if (translation) {\r\n translation.copyFromFloats(m[12], m[13], m[14]);\r\n }\r\n scale = scale || MathTmp.Vector3[0];\r\n scale.x = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);\r\n scale.y = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);\r\n scale.z = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);\r\n if (this.determinant() <= 0) {\r\n scale.y *= -1;\r\n }\r\n if (scale.x === 0 || scale.y === 0 || scale.z === 0) {\r\n if (rotation) {\r\n rotation.copyFromFloats(0.0, 0.0, 0.0, 1.0);\r\n }\r\n return false;\r\n }\r\n if (rotation) {\r\n var sx = 1 / scale.x, sy = 1 / scale.y, sz = 1 / scale.z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, MathTmp.Matrix[0]);\r\n Quaternion.FromRotationMatrixToRef(MathTmp.Matrix[0], rotation);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets specific row of the matrix\r\n * @param index defines the number of the row to get\r\n * @returns the index-th row of the current matrix as a new Vector4\r\n */\r\n Matrix.prototype.getRow = function (index) {\r\n if (index < 0 || index > 3) {\r\n return null;\r\n }\r\n var i = index * 4;\r\n return new Vector4(this._m[i + 0], this._m[i + 1], this._m[i + 2], this._m[i + 3]);\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix to the vector4 values\r\n * @param index defines the number of the row to set\r\n * @param row defines the target vector4\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRow = function (index, row) {\r\n return this.setRowFromFloats(index, row.x, row.y, row.z, row.w);\r\n };\r\n /**\r\n * Compute the transpose of the matrix\r\n * @returns the new transposed matrix\r\n */\r\n Matrix.prototype.transpose = function () {\r\n return Matrix.Transpose(this);\r\n };\r\n /**\r\n * Compute the transpose of the matrix and store it in a given matrix\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.transposeToRef = function (result) {\r\n Matrix.TransposeToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix with the given 4 x float values\r\n * @param index defines the row index\r\n * @param x defines the x component to set\r\n * @param y defines the y component to set\r\n * @param z defines the z component to set\r\n * @param w defines the w component to set\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {\r\n if (index < 0 || index > 3) {\r\n return this;\r\n }\r\n var i = index * 4;\r\n this._m[i + 0] = x;\r\n this._m[i + 1] = y;\r\n this._m[i + 2] = z;\r\n this._m[i + 3] = w;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Compute a new matrix set with the current matrix values multiplied by scale (float)\r\n * @param scale defines the scale factor\r\n * @returns a new matrix\r\n */\r\n Matrix.prototype.scale = function (scale) {\r\n var result = new Matrix();\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor to a given result matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor and add the result to a given matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the Matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleAndAddToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] += this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).\r\n * @param ref matrix to store the result\r\n */\r\n Matrix.prototype.toNormalMatrix = function (ref) {\r\n var tmp = MathTmp.Matrix[0];\r\n this.invertToRef(tmp);\r\n tmp.transposeToRef(ref);\r\n var m = ref._m;\r\n Matrix.FromValuesToRef(m[0], m[1], m[2], 0.0, m[4], m[5], m[6], 0.0, m[8], m[9], m[10], 0.0, 0.0, 0.0, 0.0, 1.0, ref);\r\n };\r\n /**\r\n * Gets only rotation part of the current matrix\r\n * @returns a new matrix sets to the extracted rotation matrix from the current one\r\n */\r\n Matrix.prototype.getRotationMatrix = function () {\r\n var result = new Matrix();\r\n this.getRotationMatrixToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Extracts the rotation matrix from the current one and sets it as the given \"result\"\r\n * @param result defines the target matrix to store data to\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getRotationMatrixToRef = function (result) {\r\n var scale = MathTmp.Vector3[0];\r\n if (!this.decompose(scale)) {\r\n Matrix.IdentityToRef(result);\r\n return this;\r\n }\r\n var m = this._m;\r\n var sx = 1 / scale.x, sy = 1 / scale.y, sz = 1 / scale.z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n return this;\r\n };\r\n /**\r\n * Toggles model matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleModelMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[2] *= -1;\r\n m[6] *= -1;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[14] *= -1;\r\n this._markAsUpdated();\r\n };\r\n /**\r\n * Toggles projection matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleProjectionMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[10] *= -1;\r\n m[11] *= -1;\r\n this._markAsUpdated();\r\n };\r\n // Statics\r\n /**\r\n * Creates a matrix from an array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Matrix set from the starting index of the given array\r\n */\r\n Matrix.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var result = new Matrix();\r\n Matrix.FromArrayToRef(array, offset, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the content of an array into a given matrix\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromArrayToRef = function (array, offset, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset];\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Stores an array into a matrix after having multiplied each component by a given factor\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param scale defines the scaling factor\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromFloat32ArrayToRefScaled = function (array, offset, scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset] * scale;\r\n }\r\n result._markAsUpdated();\r\n };\r\n Object.defineProperty(Matrix, \"IdentityReadOnly\", {\r\n /**\r\n * Gets an identity matrix that must not be updated\r\n */\r\n get: function () {\r\n return Matrix._identityReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stores a list of values (16) inside a given matrix\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromValuesToRef = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44, result) {\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates new matrix from a list of values (16)\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @returns the new matrix\r\n */\r\n Matrix.FromValues = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44) {\r\n var result = new Matrix();\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @returns a new matrix\r\n */\r\n Matrix.Compose = function (scale, rotation, translation) {\r\n var result = new Matrix();\r\n Matrix.ComposeToRef(scale, rotation, translation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ComposeToRef = function (scale, rotation, translation, result) {\r\n var m = result._m;\r\n var x = rotation.x, y = rotation.y, z = rotation.z, w = rotation.w;\r\n var x2 = x + x, y2 = y + y, z2 = z + z;\r\n var xx = x * x2, xy = x * y2, xz = x * z2;\r\n var yy = y * y2, yz = y * z2, zz = z * z2;\r\n var wx = w * x2, wy = w * y2, wz = w * z2;\r\n var sx = scale.x, sy = scale.y, sz = scale.z;\r\n m[0] = (1 - (yy + zz)) * sx;\r\n m[1] = (xy + wz) * sx;\r\n m[2] = (xz - wy) * sx;\r\n m[3] = 0;\r\n m[4] = (xy - wz) * sy;\r\n m[5] = (1 - (xx + zz)) * sy;\r\n m[6] = (yz + wx) * sy;\r\n m[7] = 0;\r\n m[8] = (xz + wy) * sz;\r\n m[9] = (yz - wx) * sz;\r\n m[10] = (1 - (xx + yy)) * sz;\r\n m[11] = 0;\r\n m[12] = translation.x;\r\n m[13] = translation.y;\r\n m[14] = translation.z;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a new identity matrix\r\n * @returns a new identity matrix\r\n */\r\n Matrix.Identity = function () {\r\n var identity = Matrix.FromValues(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n identity._updateIdentityStatus(true);\r\n return identity;\r\n };\r\n /**\r\n * Creates a new identity matrix and stores the result in a given matrix\r\n * @param result defines the target matrix\r\n */\r\n Matrix.IdentityToRef = function (result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(true);\r\n };\r\n /**\r\n * Creates a new zero matrix\r\n * @returns a new zero matrix\r\n */\r\n Matrix.Zero = function () {\r\n var zero = Matrix.FromValues(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);\r\n zero._updateIdentityStatus(false);\r\n return zero;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationX = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationXToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix as the invert of a given matrix\r\n * @param source defines the source matrix\r\n * @returns the new matrix\r\n */\r\n Matrix.Invert = function (source) {\r\n var result = new Matrix();\r\n source.invertToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationXToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationY = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationYToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, 0.0, -s, 0.0, 0.0, 1.0, 0.0, 0.0, s, 0.0, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationZ = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationZToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationZToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationAxis = function (axis, angle) {\r\n var result = new Matrix();\r\n Matrix.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis and stores it in a given matrix\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAxisToRef = function (axis, angle, result) {\r\n var s = Math.sin(-angle);\r\n var c = Math.cos(-angle);\r\n var c1 = 1 - c;\r\n axis.normalize();\r\n var m = result._m;\r\n m[0] = (axis.x * axis.x) * c1 + c;\r\n m[1] = (axis.x * axis.y) * c1 - (axis.z * s);\r\n m[2] = (axis.x * axis.z) * c1 + (axis.y * s);\r\n m[3] = 0.0;\r\n m[4] = (axis.y * axis.x) * c1 + (axis.z * s);\r\n m[5] = (axis.y * axis.y) * c1 + c;\r\n m[6] = (axis.y * axis.z) * c1 - (axis.x * s);\r\n m[7] = 0.0;\r\n m[8] = (axis.z * axis.x) * c1 - (axis.y * s);\r\n m[9] = (axis.z * axis.y) * c1 + (axis.x * s);\r\n m[10] = (axis.z * axis.z) * c1 + c;\r\n m[11] = 0.0;\r\n m[12] = 0.0;\r\n m[13] = 0.0;\r\n m[14] = 0.0;\r\n m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Takes normalised vectors and returns a rotation matrix to align \"from\" with \"to\".\r\n * Taken from http://www.iquilezles.org/www/articles/noacos/noacos.htm\r\n * @param from defines the vector to align\r\n * @param to defines the vector to align to\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAlignToRef = function (from, to, result) {\r\n var v = Vector3.Cross(to, from);\r\n var c = Vector3.Dot(to, from);\r\n var k = 1 / (1 + c);\r\n var m = result._m;\r\n m[0] = v.x * v.x * k + c;\r\n m[1] = v.y * v.x * k - v.z;\r\n m[2] = v.z * v.x * k + v.y;\r\n m[3] = 0;\r\n m[4] = v.x * v.y * k + v.z;\r\n m[5] = v.y * v.y * k + c;\r\n m[6] = v.z * v.y * k - v.x;\r\n m[7] = 0;\r\n m[8] = v.x * v.z * k - v.y;\r\n m[9] = v.y * v.z * k + v.x;\r\n m[10] = v.z * v.z * k + c;\r\n m[11] = 0;\r\n m[12] = 0;\r\n m[13] = 0;\r\n m[14] = 0;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a rotation matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (X axis)\r\n * @returns the new rotation matrix\r\n */\r\n Matrix.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var result = new Matrix();\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a rotation matrix and stores it in a given matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (X axis)\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);\r\n MathTmp.Quaternion[0].toRotationMatrix(result);\r\n };\r\n /**\r\n * Creates a scaling matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Scaling = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.ScalingToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a scaling matrix and stores it in a given matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ScalingToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(x, 0.0, 0.0, 0.0, 0.0, y, 0.0, 0.0, 0.0, 0.0, z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(x === 1 && y === 1 && z === 1);\r\n };\r\n /**\r\n * Creates a translation matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Translation = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.TranslationToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a translation matrix and stores it in a given matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TranslationToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0, result);\r\n result._updateIdentityStatus(x === 0 && y === 0 && z === 0);\r\n };\r\n /**\r\n * Returns a new Matrix whose values are the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @returns the new matrix\r\n */\r\n Matrix.Lerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given matrix \"result\" as the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @param result defines the Matrix object where to store data\r\n */\r\n Matrix.LerpToRef = function (startValue, endValue, gradient, result) {\r\n var resultM = result._m;\r\n var startM = startValue.m;\r\n var endM = endValue.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Builds a new matrix whose values are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @returns the new matrix\r\n */\r\n Matrix.DecomposeLerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Update a matrix to values which are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @param result defines the target matrix\r\n */\r\n Matrix.DecomposeLerpToRef = function (startValue, endValue, gradient, result) {\r\n var startScale = MathTmp.Vector3[0];\r\n var startRotation = MathTmp.Quaternion[0];\r\n var startTranslation = MathTmp.Vector3[1];\r\n startValue.decompose(startScale, startRotation, startTranslation);\r\n var endScale = MathTmp.Vector3[2];\r\n var endRotation = MathTmp.Quaternion[1];\r\n var endTranslation = MathTmp.Vector3[3];\r\n endValue.decompose(endScale, endRotation, endTranslation);\r\n var resultScale = MathTmp.Vector3[4];\r\n Vector3.LerpToRef(startScale, endScale, gradient, resultScale);\r\n var resultRotation = MathTmp.Quaternion[2];\r\n Quaternion.SlerpToRef(startRotation, endRotation, gradient, resultRotation);\r\n var resultTranslation = MathTmp.Vector3[5];\r\n Vector3.LerpToRef(startTranslation, endTranslation, gradient, resultTranslation);\r\n Matrix.ComposeToRef(resultScale, resultRotation, resultTranslation, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtLH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtLHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtLHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n target.subtractToRef(eye, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis.x, yAxis.x, zAxis.x, 0.0, xAxis.y, yAxis.y, zAxis.y, 0.0, xAxis.z, yAxis.z, zAxis.z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtRH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtRHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtRHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n eye.subtractToRef(target, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis.x, yAxis.x, zAxis.x, 0.0, xAxis.y, yAxis.y, zAxis.y, 0.0, xAxis.z, yAxis.z, zAxis.z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoLHToRef(width, height, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Store a left-handed orthographic projection to a given matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoLHToRef = function (width, height, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / width;\r\n var b = 2.0 / height;\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, 0.0, 0.0, d, 1.0, result);\r\n result._updateIdentityStatus(a === 1 && b === 1 && c === 1 && d === 0);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterLH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterLHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / (right - left);\r\n var b = 2.0 / (top - bottom);\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n var i0 = (left + right) / (left - right);\r\n var i1 = (top + bottom) / (bottom - top);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, i0, i1, d, 1.0, result);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a right-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterRH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterRHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterRHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, result);\r\n result._m[10] *= -1; // No need to call _markAsUpdated as previous function already called it and let _isIdentityDirty to true\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 * n / width;\r\n var b = 2.0 * n / height;\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, matrix);\r\n matrix._updateIdentityStatus(false);\r\n return matrix;\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovLH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovLHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovLHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Creates a right-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovRH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovRHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovRHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n //alternatively this could be expressed as:\r\n // m = PerspectiveFovLHToRef\r\n // m[10] *= -1.0;\r\n // m[11] *= -1.0;\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = -(f + n) / (f - n);\r\n var d = -2 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, -1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a perspective projection for WebVR info a given matrix\r\n * @param fov defines the field of view\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param rightHanded defines if the matrix must be in right-handed mode (false by default)\r\n */\r\n Matrix.PerspectiveFovWebVRToRef = function (fov, znear, zfar, result, rightHanded) {\r\n if (rightHanded === void 0) { rightHanded = false; }\r\n var rightHandedFactor = rightHanded ? -1 : 1;\r\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\r\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\r\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\r\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\r\n var xScale = 2.0 / (leftTan + rightTan);\r\n var yScale = 2.0 / (upTan + downTan);\r\n var m = result._m;\r\n m[0] = xScale;\r\n m[1] = m[2] = m[3] = m[4] = 0.0;\r\n m[5] = yScale;\r\n m[6] = m[7] = 0.0;\r\n m[8] = ((leftTan - rightTan) * xScale * 0.5);\r\n m[9] = -((upTan - downTan) * yScale * 0.5);\r\n m[10] = -zfar / (znear - zfar);\r\n m[11] = 1.0 * rightHandedFactor;\r\n m[12] = m[13] = m[15] = 0.0;\r\n m[14] = -(2.0 * zfar * znear) / (zfar - znear);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Computes a complete transformation matrix\r\n * @param viewport defines the viewport to use\r\n * @param world defines the world matrix\r\n * @param view defines the view matrix\r\n * @param projection defines the projection matrix\r\n * @param zmin defines the near clip plane\r\n * @param zmax defines the far clip plane\r\n * @returns the transformation matrix\r\n */\r\n Matrix.GetFinalMatrix = function (viewport, world, view, projection, zmin, zmax) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = Matrix.FromValues(cw / 2.0, 0.0, 0.0, 0.0, 0.0, -ch / 2.0, 0.0, 0.0, 0.0, 0.0, zmax - zmin, 0.0, cx + cw / 2.0, ch / 2.0 + cy, zmin, 1.0);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n return matrix.multiply(viewportMatrix);\r\n };\r\n /**\r\n * Extracts a 2x2 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix2x2 = function (matrix) {\r\n var m = matrix.m;\r\n return new Float32Array([m[0], m[1], m[4], m[5]]);\r\n };\r\n /**\r\n * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix3x3 = function (matrix) {\r\n var m = matrix.m;\r\n return new Float32Array([\r\n m[0], m[1], m[2],\r\n m[4], m[5], m[6],\r\n m[8], m[9], m[10]\r\n ]);\r\n };\r\n /**\r\n * Compute the transpose of a given matrix\r\n * @param matrix defines the matrix to transpose\r\n * @returns the new matrix\r\n */\r\n Matrix.Transpose = function (matrix) {\r\n var result = new Matrix();\r\n Matrix.TransposeToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Compute the transpose of a matrix and store it in a target matrix\r\n * @param matrix defines the matrix to transpose\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TransposeToRef = function (matrix, result) {\r\n var rm = result._m;\r\n var mm = matrix.m;\r\n rm[0] = mm[0];\r\n rm[1] = mm[4];\r\n rm[2] = mm[8];\r\n rm[3] = mm[12];\r\n rm[4] = mm[1];\r\n rm[5] = mm[5];\r\n rm[6] = mm[9];\r\n rm[7] = mm[13];\r\n rm[8] = mm[2];\r\n rm[9] = mm[6];\r\n rm[10] = mm[10];\r\n rm[11] = mm[14];\r\n rm[12] = mm[3];\r\n rm[13] = mm[7];\r\n rm[14] = mm[11];\r\n rm[15] = mm[15];\r\n // identity-ness does not change when transposing\r\n result._updateIdentityStatus(matrix._isIdentity, matrix._isIdentityDirty);\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @returns a new matrix\r\n */\r\n Matrix.Reflection = function (plane) {\r\n var matrix = new Matrix();\r\n Matrix.ReflectionToRef(plane, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ReflectionToRef = function (plane, result) {\r\n plane.normalize();\r\n var x = plane.normal.x;\r\n var y = plane.normal.y;\r\n var z = plane.normal.z;\r\n var temp = -2 * x;\r\n var temp2 = -2 * y;\r\n var temp3 = -2 * z;\r\n Matrix.FromValuesToRef(temp * x + 1, temp2 * x, temp3 * x, 0.0, temp * y, temp2 * y + 1, temp3 * y, 0.0, temp * z, temp2 * z, temp3 * z + 1, 0.0, temp * plane.d, temp2 * plane.d, temp3 * plane.d, 1.0, result);\r\n };\r\n /**\r\n * Sets the given matrix as a rotation matrix composed from the 3 left handed axes\r\n * @param xaxis defines the value of the 1st axis\r\n * @param yaxis defines the value of the 2nd axis\r\n * @param zaxis defines the value of the 3rd axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromXYZAxesToRef = function (xaxis, yaxis, zaxis, result) {\r\n Matrix.FromValuesToRef(xaxis.x, xaxis.y, xaxis.z, 0.0, yaxis.x, yaxis.y, yaxis.z, 0.0, zaxis.x, zaxis.y, zaxis.z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n };\r\n /**\r\n * Creates a rotation matrix from a quaternion and stores it in a target matrix\r\n * @param quat defines the quaternion to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromQuaternionToRef = function (quat, result) {\r\n var xx = quat.x * quat.x;\r\n var yy = quat.y * quat.y;\r\n var zz = quat.z * quat.z;\r\n var xy = quat.x * quat.y;\r\n var zw = quat.z * quat.w;\r\n var zx = quat.z * quat.x;\r\n var yw = quat.y * quat.w;\r\n var yz = quat.y * quat.z;\r\n var xw = quat.x * quat.w;\r\n result._m[0] = 1.0 - (2.0 * (yy + zz));\r\n result._m[1] = 2.0 * (xy + zw);\r\n result._m[2] = 2.0 * (zx - yw);\r\n result._m[3] = 0.0;\r\n result._m[4] = 2.0 * (xy - zw);\r\n result._m[5] = 1.0 - (2.0 * (zz + xx));\r\n result._m[6] = 2.0 * (yz + xw);\r\n result._m[7] = 0.0;\r\n result._m[8] = 2.0 * (zx + yw);\r\n result._m[9] = 2.0 * (yz - xw);\r\n result._m[10] = 1.0 - (2.0 * (yy + xx));\r\n result._m[11] = 0.0;\r\n result._m[12] = 0.0;\r\n result._m[13] = 0.0;\r\n result._m[14] = 0.0;\r\n result._m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n Matrix._updateFlagSeed = 0;\r\n Matrix._identityReadOnly = Matrix.Identity();\r\n return Matrix;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n * Same as Tmp but not exported to keep it only for math functions to avoid conflicts\r\n */\r\nvar MathTmp = /** @class */ (function () {\r\n function MathTmp() {\r\n }\r\n MathTmp.Vector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(6, Vector3.Zero);\r\n MathTmp.Matrix = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(2, Matrix.Identity);\r\n MathTmp.Quaternion = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Quaternion.Zero);\r\n return MathTmp;\r\n}());\r\n/**\r\n * @hidden\r\n */\r\nvar TmpVectors = /** @class */ (function () {\r\n function TmpVectors() {\r\n }\r\n TmpVectors.Vector2 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Vector2.Zero); // 3 temp Vector2 at once should be enough\r\n TmpVectors.Vector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(13, Vector3.Zero); // 13 temp Vector3 at once should be enough\r\n TmpVectors.Vector4 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Vector4.Zero); // 3 temp Vector4 at once should be enough\r\n TmpVectors.Quaternion = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(2, Quaternion.Zero); // 2 temp Quaternion at once should be enough\r\n TmpVectors.Matrix = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(8, Matrix.Identity); // 8 temp Matrices at once should be enough\r\n return TmpVectors;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Vector2\"] = Vector2;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Vector3\"] = Vector3;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Vector4\"] = Vector4;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Matrix\"] = Matrix;\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.vertexFormat.ts\":\n/*!************************************!*\\\n !*** ./Maths/math.vertexFormat.ts ***!\n \\************************************/\n/*! exports provided: PositionNormalVertex, PositionNormalTextureVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return PositionNormalVertex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return PositionNormalTextureVertex; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Contains position and normal vectors for a vertex\r\n */\r\nvar PositionNormalVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n */\r\n function PositionNormalVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal) {\r\n if (position === void 0) { position = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n if (normal === void 0) { normal = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(); }\r\n this.position = position;\r\n this.normal = normal;\r\n }\r\n /**\r\n * Clones the PositionNormalVertex\r\n * @returns the cloned PositionNormalVertex\r\n */\r\n PositionNormalVertex.prototype.clone = function () {\r\n return new PositionNormalVertex(this.position.clone(), this.normal.clone());\r\n };\r\n return PositionNormalVertex;\r\n}());\r\n\r\n/**\r\n * Contains position, normal and uv vectors for a vertex\r\n */\r\nvar PositionNormalTextureVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalTextureVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n * @param uv the uv of the vertex (default: 0,0)\r\n */\r\n function PositionNormalTextureVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal, \r\n /** the uv of the vertex (default: 0,0) */\r\n uv) {\r\n if (position === void 0) { position = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n if (normal === void 0) { normal = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(); }\r\n if (uv === void 0) { uv = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero(); }\r\n this.position = position;\r\n this.normal = normal;\r\n this.uv = uv;\r\n }\r\n /**\r\n * Clones the PositionNormalTextureVertex\r\n * @returns the cloned PositionNormalTextureVertex\r\n */\r\n PositionNormalTextureVertex.prototype.clone = function () {\r\n return new PositionNormalTextureVertex(this.position.clone(), this.normal.clone(), this.uv.clone());\r\n };\r\n return PositionNormalTextureVertex;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.viewport.ts\":\n/*!********************************!*\\\n !*** ./Maths/math.viewport.ts ***!\n \\********************************/\n/*! exports provided: Viewport */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return Viewport; });\n/**\r\n * Class used to represent a viewport on screen\r\n */\r\nvar Viewport = /** @class */ (function () {\r\n /**\r\n * Creates a Viewport object located at (x, y) and sized (width, height)\r\n * @param x defines viewport left coordinate\r\n * @param y defines viewport top coordinate\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n */\r\n function Viewport(\r\n /** viewport left coordinate */\r\n x, \r\n /** viewport top coordinate */\r\n y, \r\n /**viewport width */\r\n width, \r\n /** viewport height */\r\n height) {\r\n this.x = x;\r\n this.y = y;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.toGlobal = function (renderWidth, renderHeight) {\r\n return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);\r\n };\r\n /**\r\n * Stores absolute viewport value into a target viewport (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @param ref defines the target viewport\r\n * @returns the current viewport\r\n */\r\n Viewport.prototype.toGlobalToRef = function (renderWidth, renderHeight, ref) {\r\n ref.x = this.x * renderWidth;\r\n ref.y = this.y * renderHeight;\r\n ref.width = this.width * renderWidth;\r\n ref.height = this.height * renderHeight;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Viewport copied from the current one\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.clone = function () {\r\n return new Viewport(this.x, this.y, this.width, this.height);\r\n };\r\n return Viewport;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/sphericalPolynomial.ts\":\n/*!**************************************!*\\\n !*** ./Maths/sphericalPolynomial.ts ***!\n \\**************************************/\n/*! exports provided: SphericalHarmonics, SphericalPolynomial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return SphericalHarmonics; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return SphericalPolynomial; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n// https://dickyjim.wordpress.com/2013/09/04/spherical-harmonics-for-beginners/\r\n// http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf\r\n// https://www.ppsloan.org/publications/StupidSH36.pdf\r\n// http://cseweb.ucsd.edu/~ravir/papers/envmap/envmap.pdf\r\n// https://www.ppsloan.org/publications/SHJCGT.pdf\r\n// https://www.ppsloan.org/publications/shdering.pdf\r\n// https://google.github.io/filament/Filament.md.html#annex/sphericalharmonics\r\n// https://patapom.com/blog/SHPortal/\r\n// https://imdoingitwrong.wordpress.com/2011/04/14/spherical-harmonics-wtf/\r\n// Using real SH basis:\r\n// m>0 m m\r\n// y = sqrt(2) * K * P * cos(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m<0 m |m|\r\n// y = sqrt(2) * K * P * sin(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m=0 0 0\r\n// y = K * P * trigono terms\r\n// l l l\r\n//\r\n// m (2l + 1)(l - |m|)!\r\n// K = sqrt(------------------)\r\n// l 4pi(l + |m|)!\r\n//\r\n// and P by recursion:\r\n//\r\n// P00(x) = 1\r\n// P01(x) = x\r\n// Pll(x) = (-1^l)(2l - 1)!!(1-x*x)^(1/2)\r\n// ((2l - 1)x[Pl-1/m]-(l + m - 1)[Pl-2/m])\r\n// Plm(x) = ---------------------------------------\r\n// l - m\r\n// Leaving the trigonometric terms aside we can precompute the constants to :\r\nvar SH3ylmBasisConstants = [\r\n Math.sqrt(1 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(3 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(15 / (4 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(5 / (16 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(15 / (16 * Math.PI)),\r\n];\r\n// cm = cos(m * phi)\r\n// sm = sin(m * phi)\r\n// {x,y,z} = {cos(phi)sin(theta), sin(phi)sin(theta), cos(theta)}\r\n// By recursion on using trigo identities:\r\nvar SH3ylmBasisTrigonometricTerms = [\r\n function (direction) { return 1; },\r\n function (direction) { return direction.y; },\r\n function (direction) { return direction.z; },\r\n function (direction) { return direction.x; },\r\n function (direction) { return direction.x * direction.y; },\r\n function (direction) { return direction.y * direction.z; },\r\n function (direction) { return 3 * direction.z * direction.z - 1; },\r\n function (direction) { return direction.x * direction.z; },\r\n function (direction) { return direction.x * direction.x - direction.y * direction.y; },\r\n];\r\n// Wrap the full compute\r\nvar applySH3 = function (lm, direction) {\r\n return SH3ylmBasisConstants[lm] * SH3ylmBasisTrigonometricTerms[lm](direction);\r\n};\r\n// Derived from the integration of the a kernel convolution to SH.\r\n// Great explanation here: https://patapom.com/blog/SHPortal/#about-distant-radiance-and-irradiance-environments\r\nvar SHCosKernelConvolution = [\r\n Math.PI,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n];\r\n/**\r\n * Class representing spherical harmonics coefficients to the 3rd degree\r\n */\r\nvar SphericalHarmonics = /** @class */ (function () {\r\n function SphericalHarmonics() {\r\n /**\r\n * Defines whether or not the harmonics have been prescaled for rendering.\r\n */\r\n this.preScaled = false;\r\n /**\r\n * The l0,0 coefficients of the spherical harmonics\r\n */\r\n this.l00 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l1,-1 coefficients of the spherical harmonics\r\n */\r\n this.l1_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l1,0 coefficients of the spherical harmonics\r\n */\r\n this.l10 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l1,1 coefficients of the spherical harmonics\r\n */\r\n this.l11 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,-2 coefficients of the spherical harmonics\r\n */\r\n this.l2_2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,-1 coefficients of the spherical harmonics\r\n */\r\n this.l2_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,0 coefficients of the spherical harmonics\r\n */\r\n this.l20 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,1 coefficients of the spherical harmonics\r\n */\r\n this.l21 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,2 coefficients of the spherical harmonics\r\n */\r\n this.l22 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n /**\r\n * Adds a light to the spherical harmonics\r\n * @param direction the direction of the light\r\n * @param color the color of the light\r\n * @param deltaSolidAngle the delta solid angle of the light\r\n */\r\n SphericalHarmonics.prototype.addLight = function (direction, color, deltaSolidAngle) {\r\n var colorVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](color.r, color.g, color.b);\r\n var c = colorVector.scale(deltaSolidAngle);\r\n this.l00 = this.l00.add(c.scale(applySH3(0, direction)));\r\n this.l1_1 = this.l1_1.add(c.scale(applySH3(1, direction)));\r\n this.l10 = this.l10.add(c.scale(applySH3(2, direction)));\r\n this.l11 = this.l11.add(c.scale(applySH3(3, direction)));\r\n this.l2_2 = this.l2_2.add(c.scale(applySH3(4, direction)));\r\n this.l2_1 = this.l2_1.add(c.scale(applySH3(5, direction)));\r\n this.l20 = this.l20.add(c.scale(applySH3(6, direction)));\r\n this.l21 = this.l21.add(c.scale(applySH3(7, direction)));\r\n this.l22 = this.l22.add(c.scale(applySH3(8, direction)));\r\n };\r\n /**\r\n * Scales the spherical harmonics by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalHarmonics.prototype.scaleInPlace = function (scale) {\r\n this.l00.scaleInPlace(scale);\r\n this.l1_1.scaleInPlace(scale);\r\n this.l10.scaleInPlace(scale);\r\n this.l11.scaleInPlace(scale);\r\n this.l2_2.scaleInPlace(scale);\r\n this.l2_1.scaleInPlace(scale);\r\n this.l20.scaleInPlace(scale);\r\n this.l21.scaleInPlace(scale);\r\n this.l22.scaleInPlace(scale);\r\n };\r\n /**\r\n * Convert from incident radiance (Li) to irradiance (E) by applying convolution with the cosine-weighted hemisphere.\r\n *\r\n * ```\r\n * E_lm = A_l * L_lm\r\n * ```\r\n *\r\n * In spherical harmonics this convolution amounts to scaling factors for each frequency band.\r\n * This corresponds to equation 5 in \"An Efficient Representation for Irradiance Environment Maps\", where\r\n * the scaling factors are given in equation 9.\r\n */\r\n SphericalHarmonics.prototype.convertIncidentRadianceToIrradiance = function () {\r\n // Constant (Band 0)\r\n this.l00.scaleInPlace(SHCosKernelConvolution[0]);\r\n // Linear (Band 1)\r\n this.l1_1.scaleInPlace(SHCosKernelConvolution[1]);\r\n this.l10.scaleInPlace(SHCosKernelConvolution[2]);\r\n this.l11.scaleInPlace(SHCosKernelConvolution[3]);\r\n // Quadratic (Band 2)\r\n this.l2_2.scaleInPlace(SHCosKernelConvolution[4]);\r\n this.l2_1.scaleInPlace(SHCosKernelConvolution[5]);\r\n this.l20.scaleInPlace(SHCosKernelConvolution[6]);\r\n this.l21.scaleInPlace(SHCosKernelConvolution[7]);\r\n this.l22.scaleInPlace(SHCosKernelConvolution[8]);\r\n };\r\n /**\r\n * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.\r\n *\r\n * ```\r\n * L = (1/pi) * E * rho\r\n * ```\r\n *\r\n * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.\r\n */\r\n SphericalHarmonics.prototype.convertIrradianceToLambertianRadiance = function () {\r\n this.scaleInPlace(1.0 / Math.PI);\r\n // The resultant SH now represents outgoing radiance, so includes the Lambert 1/pi normalisation factor but without albedo (rho) applied\r\n // (The pixel shader must apply albedo after texture fetches, etc).\r\n };\r\n /**\r\n * Integrates the reconstruction coefficients directly in to the SH preventing further\r\n * required operations at run time.\r\n *\r\n * This is simply done by scaling back the SH with Ylm constants parameter.\r\n * The trigonometric part being applied by the shader at run time.\r\n */\r\n SphericalHarmonics.prototype.preScaleForRendering = function () {\r\n this.preScaled = true;\r\n this.l00.scaleInPlace(SH3ylmBasisConstants[0]);\r\n this.l1_1.scaleInPlace(SH3ylmBasisConstants[1]);\r\n this.l10.scaleInPlace(SH3ylmBasisConstants[2]);\r\n this.l11.scaleInPlace(SH3ylmBasisConstants[3]);\r\n this.l2_2.scaleInPlace(SH3ylmBasisConstants[4]);\r\n this.l2_1.scaleInPlace(SH3ylmBasisConstants[5]);\r\n this.l20.scaleInPlace(SH3ylmBasisConstants[6]);\r\n this.l21.scaleInPlace(SH3ylmBasisConstants[7]);\r\n this.l22.scaleInPlace(SH3ylmBasisConstants[8]);\r\n };\r\n /**\r\n * Constructs a spherical harmonics from an array.\r\n * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromArray = function (data) {\r\n var sh = new SphericalHarmonics();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[0], 0, sh.l00);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[1], 0, sh.l1_1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[2], 0, sh.l10);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[3], 0, sh.l11);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[4], 0, sh.l2_2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[5], 0, sh.l2_1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[6], 0, sh.l20);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[7], 0, sh.l21);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[8], 0, sh.l22);\r\n return sh;\r\n };\r\n // Keep for references.\r\n /**\r\n * Gets the spherical harmonics from polynomial\r\n * @param polynomial the spherical polynomial\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromPolynomial = function (polynomial) {\r\n var result = new SphericalHarmonics();\r\n result.l00 = polynomial.xx.scale(0.376127).add(polynomial.yy.scale(0.376127)).add(polynomial.zz.scale(0.376126));\r\n result.l1_1 = polynomial.y.scale(0.977204);\r\n result.l10 = polynomial.z.scale(0.977204);\r\n result.l11 = polynomial.x.scale(0.977204);\r\n result.l2_2 = polynomial.xy.scale(1.16538);\r\n result.l2_1 = polynomial.yz.scale(1.16538);\r\n result.l20 = polynomial.zz.scale(1.34567).subtract(polynomial.xx.scale(0.672834)).subtract(polynomial.yy.scale(0.672834));\r\n result.l21 = polynomial.zx.scale(1.16538);\r\n result.l22 = polynomial.xx.scale(1.16538).subtract(polynomial.yy.scale(1.16538));\r\n result.l1_1.scaleInPlace(-1);\r\n result.l11.scaleInPlace(-1);\r\n result.l2_1.scaleInPlace(-1);\r\n result.l21.scaleInPlace(-1);\r\n result.scaleInPlace(Math.PI);\r\n return result;\r\n };\r\n return SphericalHarmonics;\r\n}());\r\n\r\n/**\r\n * Class representing spherical polynomial coefficients to the 3rd degree\r\n */\r\nvar SphericalPolynomial = /** @class */ (function () {\r\n function SphericalPolynomial() {\r\n /**\r\n * The x coefficients of the spherical polynomial\r\n */\r\n this.x = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The y coefficients of the spherical polynomial\r\n */\r\n this.y = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The z coefficients of the spherical polynomial\r\n */\r\n this.z = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The xx coefficients of the spherical polynomial\r\n */\r\n this.xx = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The yy coefficients of the spherical polynomial\r\n */\r\n this.yy = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The zz coefficients of the spherical polynomial\r\n */\r\n this.zz = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The xy coefficients of the spherical polynomial\r\n */\r\n this.xy = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The yz coefficients of the spherical polynomial\r\n */\r\n this.yz = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The zx coefficients of the spherical polynomial\r\n */\r\n this.zx = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n Object.defineProperty(SphericalPolynomial.prototype, \"preScaledHarmonics\", {\r\n /**\r\n * The spherical harmonics used to create the polynomials.\r\n */\r\n get: function () {\r\n if (!this._harmonics) {\r\n this._harmonics = SphericalHarmonics.FromPolynomial(this);\r\n }\r\n if (!this._harmonics.preScaled) {\r\n this._harmonics.preScaleForRendering();\r\n }\r\n return this._harmonics;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds an ambient color to the spherical polynomial\r\n * @param color the color to add\r\n */\r\n SphericalPolynomial.prototype.addAmbient = function (color) {\r\n var colorVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](color.r, color.g, color.b);\r\n this.xx = this.xx.add(colorVector);\r\n this.yy = this.yy.add(colorVector);\r\n this.zz = this.zz.add(colorVector);\r\n };\r\n /**\r\n * Scales the spherical polynomial by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalPolynomial.prototype.scaleInPlace = function (scale) {\r\n this.x.scaleInPlace(scale);\r\n this.y.scaleInPlace(scale);\r\n this.z.scaleInPlace(scale);\r\n this.xx.scaleInPlace(scale);\r\n this.yy.scaleInPlace(scale);\r\n this.zz.scaleInPlace(scale);\r\n this.yz.scaleInPlace(scale);\r\n this.zx.scaleInPlace(scale);\r\n this.xy.scaleInPlace(scale);\r\n };\r\n /**\r\n * Gets the spherical polynomial from harmonics\r\n * @param harmonics the spherical harmonics\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromHarmonics = function (harmonics) {\r\n var result = new SphericalPolynomial();\r\n result._harmonics = harmonics;\r\n result.x = harmonics.l11.scale(1.02333).scale(-1);\r\n result.y = harmonics.l1_1.scale(1.02333).scale(-1);\r\n result.z = harmonics.l10.scale(1.02333);\r\n result.xx = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).add(harmonics.l22.scale(0.429043));\r\n result.yy = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).subtract(harmonics.l22.scale(0.429043));\r\n result.zz = harmonics.l00.scale(0.886277).add(harmonics.l20.scale(0.495417));\r\n result.yz = harmonics.l2_1.scale(0.858086).scale(-1);\r\n result.zx = harmonics.l21.scale(0.858086).scale(-1);\r\n result.xy = harmonics.l2_2.scale(0.858086);\r\n result.scaleInPlace(1.0 / Math.PI);\r\n return result;\r\n };\r\n /**\r\n * Constructs a spherical polynomial from an array.\r\n * @param data defines the 9x3 coefficients (x, y, z, xx, yy, zz, yz, zx, xy)\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromArray = function (data) {\r\n var sp = new SphericalPolynomial();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[0], 0, sp.x);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[1], 0, sp.y);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[2], 0, sp.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[3], 0, sp.xx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[4], 0, sp.yy);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[5], 0, sp.zz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[6], 0, sp.yz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[7], 0, sp.zx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[8], 0, sp.xy);\r\n return sp;\r\n };\r\n return SphericalPolynomial;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/boxBuilder.ts\":\n/*!***************************************!*\\\n !*** ./Meshes/Builders/boxBuilder.ts ***!\n \\***************************************/\n/*! exports provided: BoxBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return BoxBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateBox = function (options) {\r\n var nbFaces = 6;\r\n var indices = [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];\r\n var normals = [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];\r\n var uvs = [];\r\n var positions = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var wrap = options.wrap || false;\r\n var topBaseAt = (options.topBaseAt === void 0) ? 1 : options.topBaseAt;\r\n var bottomBaseAt = (options.bottomBaseAt === void 0) ? 0 : options.bottomBaseAt;\r\n topBaseAt = (topBaseAt + 4) % 4; // places values as 0 to 3\r\n bottomBaseAt = (bottomBaseAt + 4) % 4; // places values as 0 to 3\r\n var topOrder = [2, 0, 3, 1];\r\n var bottomOrder = [2, 0, 1, 3];\r\n var topIndex = topOrder[topBaseAt];\r\n var bottomIndex = bottomOrder[bottomBaseAt];\r\n var basePositions = [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];\r\n if (wrap) {\r\n indices = [2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, 14, 15, 12, 13, 14];\r\n basePositions = [-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];\r\n var topFaceBase = [[1, 1, 1], [-1, 1, 1], [-1, 1, -1], [1, 1, -1]];\r\n var bottomFaceBase = [[-1, -1, 1], [1, -1, 1], [1, -1, -1], [-1, -1, -1]];\r\n var topFaceOrder = [17, 18, 19, 16];\r\n var bottomFaceOrder = [22, 23, 20, 21];\r\n while (topIndex > 0) {\r\n topFaceBase.unshift(topFaceBase.pop());\r\n topFaceOrder.unshift(topFaceOrder.pop());\r\n topIndex--;\r\n }\r\n while (bottomIndex > 0) {\r\n bottomFaceBase.unshift(bottomFaceBase.pop());\r\n bottomFaceOrder.unshift(bottomFaceOrder.pop());\r\n bottomIndex--;\r\n }\r\n topFaceBase = topFaceBase.flat();\r\n bottomFaceBase = bottomFaceBase.flat();\r\n basePositions = basePositions.concat(topFaceBase).concat(bottomFaceBase);\r\n indices.push(topFaceOrder[0], topFaceOrder[2], topFaceOrder[3], topFaceOrder[0], topFaceOrder[1], topFaceOrder[2]);\r\n indices.push(bottomFaceOrder[0], bottomFaceOrder[2], bottomFaceOrder[3], bottomFaceOrder[0], bottomFaceOrder[1], bottomFaceOrder[2]);\r\n }\r\n var scaleArray = [width / 2, height / 2, depth / 2];\r\n positions = basePositions.reduce(function (accumulator, currentValue, currentIndex) { return accumulator.concat(currentValue * scaleArray[currentIndex % 3]); }, []);\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(6);\r\n var faceColors = options.faceColors;\r\n var colors = [];\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < 6; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n // Create each face in turn.\r\n for (var index = 0; index < nbFaces; index++) {\r\n uvs.push(faceUV[index].z, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].y);\r\n uvs.push(faceUV[index].z, faceUV[index].y);\r\n if (faceColors) {\r\n for (var c = 0; c < 4; c++) {\r\n colors.push(faceColors[index].r, faceColors[index].g, faceColors[index].b, faceColors[index].a);\r\n }\r\n }\r\n }\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n size: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return BoxBuilder.CreateBox(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar BoxBuilder = /** @class */ (function () {\r\n function BoxBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * * The parameter `size` sets the size (float) of each box side (default 1)\r\n * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n BoxBuilder.CreateBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var box = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateBox(options);\r\n vertexData.applyToMesh(box, options.updatable);\r\n return box;\r\n };\r\n return BoxBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/cylinderBuilder.ts\":\n/*!********************************************!*\\\n !*** ./Meshes/Builders/cylinderBuilder.ts ***!\n \\********************************************/\n/*! exports provided: CylinderBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return CylinderBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateCylinder = function (options) {\r\n var height = options.height || 2;\r\n var diameterTop = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation = options.tessellation || 24;\r\n var subdivisions = options.subdivisions || 1;\r\n var hasRings = options.hasRings ? true : false;\r\n var enclose = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_ALL;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb = (hasRings) ? subdivisions : 1;\r\n var surfaceNb = 2 + (1 + quadNb) * ringNb;\r\n var f;\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n }\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle;\r\n var h;\r\n var radius;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var ringNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var ringFirstVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var ringFirstNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var quadNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var Y = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y;\r\n // positions, normals, uvs\r\n var i;\r\n var j;\r\n var r;\r\n var ringIdx = 1;\r\n var s = 1; // surface index\r\n var cs = 0;\r\n var v = 0;\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n }\r\n else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n }\r\n else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n }\r\n else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n }\r\n }\r\n // indices\r\n var e = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n var i0 = 0;\r\n var i1 = 0;\r\n var i2 = 0;\r\n var i3 = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n // Caps\r\n var createCylinderCap = function (isTop) {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i;\r\n var u = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n var textureScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](cos * radius, offset, sin * radius);\r\n var textureCoordinate = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n // add caps to geometry based on cap parameter\r\n if ((cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_START)\r\n || (cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_END)\r\n || (cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n if (scene === undefined || !(scene instanceof _scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"])) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = subdivisions;\r\n subdivisions = 1;\r\n }\r\n var options = {\r\n height: height,\r\n diameterTop: diameterTop,\r\n diameterBottom: diameterBottom,\r\n tessellation: tessellation,\r\n subdivisions: subdivisions,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return CylinderBuilder.CreateCylinder(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar CylinderBuilder = /** @class */ (function () {\r\n function CylinderBuilder() {\r\n }\r\n /**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\n CylinderBuilder.CreateCylinder = function (name, options, scene) {\r\n var cylinder = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateCylinder(options);\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n return cylinder;\r\n };\r\n return CylinderBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/decalBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/decalBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: DecalBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return DecalBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Maths_math_vertexFormat__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vertexFormat */ \"./Maths/math.vertexFormat.ts\");\n\r\n\r\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateDecal = function (name, sourceMesh, position, normal, size, angle) {\r\n var options = {\r\n position: position,\r\n normal: normal,\r\n size: size,\r\n angle: angle\r\n };\r\n return DecalBuilder.CreateDecal(name, sourceMesh, options);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar DecalBuilder = /** @class */ (function () {\r\n function DecalBuilder() {\r\n }\r\n /**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/how_to/decals\r\n */\r\n DecalBuilder.CreateDecal = function (name, sourceMesh, options) {\r\n var indices = sourceMesh.getIndices();\r\n var positions = sourceMesh.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n var normals = sourceMesh.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var position = options.position || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var normal = options.normal || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up();\r\n var size = options.size || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].One();\r\n var angle = options.angle || 0;\r\n // Getting correct rotation\r\n if (!normal) {\r\n var target = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1);\r\n var camera = sourceMesh.getScene().activeCamera;\r\n var cameraWorldTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(target, camera.getWorldMatrix());\r\n normal = camera.globalPosition.subtract(cameraWorldTarget);\r\n }\r\n var yaw = -Math.atan2(normal.z, normal.x) - Math.PI / 2;\r\n var len = Math.sqrt(normal.x * normal.x + normal.z * normal.z);\r\n var pitch = Math.atan2(normal.y, len);\r\n // Matrix\r\n var decalWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationYawPitchRoll(yaw, pitch, angle).multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(position.x, position.y, position.z));\r\n var inverseDecalWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Invert(decalWorldMatrix);\r\n var meshWorldMatrix = sourceMesh.getWorldMatrix();\r\n var transformMatrix = meshWorldMatrix.multiply(inverseDecalWorldMatrix);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = [];\r\n vertexData.positions = [];\r\n vertexData.normals = [];\r\n vertexData.uvs = [];\r\n var currentVertexDataIndex = 0;\r\n var extractDecalVector3 = function (indexId) {\r\n var result = new _Maths_math_vertexFormat__WEBPACK_IMPORTED_MODULE_4__[\"PositionNormalVertex\"]();\r\n if (!indices || !positions || !normals) {\r\n return result;\r\n }\r\n var vertexId = indices[indexId];\r\n result.position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](positions[vertexId * 3], positions[vertexId * 3 + 1], positions[vertexId * 3 + 2]);\r\n // Send vector to decal local world\r\n result.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(result.position, transformMatrix);\r\n // Get normal\r\n result.normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](normals[vertexId * 3], normals[vertexId * 3 + 1], normals[vertexId * 3 + 2]);\r\n result.normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(result.normal, transformMatrix);\r\n return result;\r\n }; // Inspired by https://github.com/mrdoob/three.js/blob/eee231960882f6f3b6113405f524956145148146/examples/js/geometries/DecalGeometry.js\r\n var clip = function (vertices, axis) {\r\n if (vertices.length === 0) {\r\n return vertices;\r\n }\r\n var clipSize = 0.5 * Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(size, axis));\r\n var clipVertices = function (v0, v1) {\r\n var clipFactor = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].GetClipFactor(v0.position, v1.position, axis, clipSize);\r\n return new _Maths_math_vertexFormat__WEBPACK_IMPORTED_MODULE_4__[\"PositionNormalVertex\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(v0.position, v1.position, clipFactor), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(v0.normal, v1.normal, clipFactor));\r\n };\r\n var result = new Array();\r\n for (var index = 0; index < vertices.length; index += 3) {\r\n var v1Out;\r\n var v2Out;\r\n var v3Out;\r\n var total = 0;\r\n var nV1 = null;\r\n var nV2 = null;\r\n var nV3 = null;\r\n var nV4 = null;\r\n var d1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(vertices[index].position, axis) - clipSize;\r\n var d2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(vertices[index + 1].position, axis) - clipSize;\r\n var d3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(vertices[index + 2].position, axis) - clipSize;\r\n v1Out = d1 > 0;\r\n v2Out = d2 > 0;\r\n v3Out = d3 > 0;\r\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\r\n switch (total) {\r\n case 0:\r\n result.push(vertices[index]);\r\n result.push(vertices[index + 1]);\r\n result.push(vertices[index + 2]);\r\n break;\r\n case 1:\r\n if (v1Out) {\r\n nV1 = vertices[index + 1];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index], nV1);\r\n nV4 = clipVertices(vertices[index], nV2);\r\n }\r\n if (v2Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index + 1], nV1);\r\n nV4 = clipVertices(vertices[index + 1], nV2);\r\n result.push(nV3);\r\n result.push(nV2.clone());\r\n result.push(nV1.clone());\r\n result.push(nV2.clone());\r\n result.push(nV3.clone());\r\n result.push(nV4);\r\n break;\r\n }\r\n if (v3Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 1];\r\n nV3 = clipVertices(vertices[index + 2], nV1);\r\n nV4 = clipVertices(vertices[index + 2], nV2);\r\n }\r\n if (nV1 && nV2 && nV3 && nV4) {\r\n result.push(nV1.clone());\r\n result.push(nV2.clone());\r\n result.push(nV3);\r\n result.push(nV4);\r\n result.push(nV3.clone());\r\n result.push(nV2.clone());\r\n }\r\n break;\r\n case 2:\r\n if (!v1Out) {\r\n nV1 = vertices[index].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 1]);\r\n nV3 = clipVertices(nV1, vertices[index + 2]);\r\n result.push(nV1);\r\n result.push(nV2);\r\n result.push(nV3);\r\n }\r\n if (!v2Out) {\r\n nV1 = vertices[index + 1].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 2]);\r\n nV3 = clipVertices(nV1, vertices[index]);\r\n result.push(nV1);\r\n result.push(nV2);\r\n result.push(nV3);\r\n }\r\n if (!v3Out) {\r\n nV1 = vertices[index + 2].clone();\r\n nV2 = clipVertices(nV1, vertices[index]);\r\n nV3 = clipVertices(nV1, vertices[index + 1]);\r\n result.push(nV1);\r\n result.push(nV2);\r\n result.push(nV3);\r\n }\r\n break;\r\n case 3:\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n for (var index = 0; index < indices.length; index += 3) {\r\n var faceVertices = new Array();\r\n faceVertices.push(extractDecalVector3(index));\r\n faceVertices.push(extractDecalVector3(index + 1));\r\n faceVertices.push(extractDecalVector3(index + 2));\r\n // Clip\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1, 0, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1));\r\n if (faceVertices.length === 0) {\r\n continue;\r\n }\r\n // Add UVs and get back to world\r\n for (var vIndex = 0; vIndex < faceVertices.length; vIndex++) {\r\n var vertex = faceVertices[vIndex];\r\n //TODO check for Int32Array | Uint32Array | Uint16Array\r\n vertexData.indices.push(currentVertexDataIndex);\r\n vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);\r\n vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);\r\n vertexData.uvs.push(0.5 + vertex.position.x / size.x);\r\n vertexData.uvs.push(0.5 + vertex.position.y / size.y);\r\n currentVertexDataIndex++;\r\n }\r\n }\r\n // Return mesh\r\n var decal = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, sourceMesh.getScene());\r\n vertexData.applyToMesh(decal);\r\n decal.position = position.clone();\r\n decal.rotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](pitch, yaw, angle);\r\n return decal;\r\n };\r\n return DecalBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/discBuilder.ts\":\n/*!****************************************!*\\\n !*** ./Meshes/Builders/discBuilder.ts ***!\n \\****************************************/\n/*! exports provided: DiscBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return DiscBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateDisc = function (options) {\r\n var positions = new Array();\r\n var indices = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var radius = options.radius || 0.5;\r\n var tessellation = options.tessellation || 64;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DEFAULTSIDE;\r\n // positions and uvs\r\n positions.push(0, 0, 0); // disc center first\r\n uvs.push(0.5, 0.5);\r\n var theta = Math.PI * 2 * arc;\r\n var step = theta / tessellation;\r\n for (var a = 0; a < theta; a += step) {\r\n var x = Math.cos(a);\r\n var y = Math.sin(a);\r\n var u = (x + 1) / 2;\r\n var v = (1 - y) / 2;\r\n positions.push(radius * x, radius * y, 0);\r\n uvs.push(u, v);\r\n }\r\n if (arc === 1) {\r\n positions.push(positions[3], positions[4], positions[5]); // close the circle\r\n uvs.push(uvs[2], uvs[3]);\r\n }\r\n //indices\r\n var vertexNb = positions.length / 3;\r\n for (var i = 1; i < vertexNb - 1; i++) {\r\n indices.push(i + 1, 0, i);\r\n }\r\n // result\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreateDisc = function (name, radius, tessellation, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n radius: radius,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return DiscBuilder.CreateDisc(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar DiscBuilder = /** @class */ (function () {\r\n function DiscBuilder() {\r\n }\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc\r\n * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)\r\n * * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane polygonal mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#disc-or-regular-polygon\r\n */\r\n DiscBuilder.CreateDisc = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var disc = new _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n disc._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateDisc(options);\r\n vertexData.applyToMesh(disc, options.updatable);\r\n return disc;\r\n };\r\n return DiscBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/groundBuilder.ts\":\n/*!******************************************!*\\\n !*** ./Meshes/Builders/groundBuilder.ts ***!\n \\******************************************/\n/*! exports provided: GroundBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return GroundBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _groundMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../groundMesh */ \"./Meshes/groundMesh.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGround = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var row, col;\r\n var width = options.width || 1;\r\n var height = options.height || 1;\r\n var subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n var subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n var position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]((col * width) / subdivisionsX - (width / 2.0), 0, ((subdivisionsY - row) * height) / subdivisionsY - (height / 2.0));\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0);\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledGround = function (options) {\r\n var xmin = (options.xmin !== undefined && options.xmin !== null) ? options.xmin : -1.0;\r\n var zmin = (options.zmin !== undefined && options.zmin !== null) ? options.zmin : -1.0;\r\n var xmax = (options.xmax !== undefined && options.xmax !== null) ? options.xmax : 1.0;\r\n var zmax = (options.zmax !== undefined && options.zmax !== null) ? options.zmax : 1.0;\r\n var subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n var precision = options.precision || { w: 1, h: 1 };\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var row, col, tileRow, tileCol;\r\n subdivisions.h = (subdivisions.h < 1) ? 1 : subdivisions.h;\r\n subdivisions.w = (subdivisions.w < 1) ? 1 : subdivisions.w;\r\n precision.w = (precision.w < 1) ? 1 : precision.w;\r\n precision.h = (precision.h < 1) ? 1 : precision.h;\r\n var tileSize = {\r\n 'w': (xmax - xmin) / subdivisions.w,\r\n 'h': (zmax - zmin) / subdivisions.h\r\n };\r\n function applyTile(xTileMin, zTileMin, xTileMax, zTileMax) {\r\n // Indices\r\n var base = positions.length / 3;\r\n var rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n var square = [\r\n base + col + row * rowLength,\r\n base + (col + 1) + row * rowLength,\r\n base + (col + 1) + (row + 1) * rowLength,\r\n base + col + (row + 1) * rowLength\r\n ];\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n // Position, normals and uvs\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGroundFromHeightMap = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var row, col;\r\n var filter = options.colorFilter || new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"](0.3, 0.59, 0.11);\r\n var alphaFilter = options.alphaFilter || 0.0;\r\n var invert = false;\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n var temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n var position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]((col * options.width) / options.subdivisions - (options.width / 2.0), 0, ((options.subdivisions - row) * options.height) / options.subdivisions - (options.height / 2.0));\r\n // Compute height\r\n var heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n var heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n var pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n var r = options.buffer[pos] / 255.0;\r\n var g = options.buffer[pos + 1] / 255.0;\r\n var b = options.buffer[pos + 2] / 255.0;\r\n var a = options.buffer[pos + 3] / 255.0;\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n var gradient = r * filter.r + g * filter.g + b * filter.b;\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n }\r\n else {\r\n position.y = options.minHeight - _Maths_math_constants__WEBPACK_IMPORTED_MODULE_7__[\"Epsilon\"]; // We can't have a height below minHeight, normally.\r\n }\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n var idx1 = (col + 1 + (row + 1) * (options.subdivisions + 1));\r\n var idx2 = (col + 1 + row * (options.subdivisions + 1));\r\n var idx3 = (col + row * (options.subdivisions + 1));\r\n var idx4 = (col + (row + 1) * (options.subdivisions + 1));\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n var isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n var isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n var isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n var isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n // Normals\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateGround = function (name, width, height, subdivisions, scene, updatable) {\r\n var options = {\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n updatable: updatable\r\n };\r\n return GroundBuilder.CreateGround(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateTiledGround = function (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\r\n var options = {\r\n xmin: xmin,\r\n zmin: zmin,\r\n xmax: xmax,\r\n zmax: zmax,\r\n subdivisions: subdivisions,\r\n precision: precision,\r\n updatable: updatable\r\n };\r\n return GroundBuilder.CreateTiledGround(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\r\n var options = {\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n updatable: updatable,\r\n onReady: onReady,\r\n alphaFilter: alphaFilter\r\n };\r\n return GroundBuilder.CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar GroundBuilder = /** @class */ (function () {\r\n function GroundBuilder() {\r\n }\r\n /**\r\n * Creates a ground mesh\r\n * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground\r\n * * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground\r\n */\r\n GroundBuilder.CreateGround = function (name, options, scene) {\r\n var ground = new _groundMesh__WEBPACK_IMPORTED_MODULE_4__[\"GroundMesh\"](name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGround(options);\r\n vertexData.applyToMesh(ground, options.updatable);\r\n ground._setReady(true);\r\n return ground;\r\n };\r\n /**\r\n * Creates a tiled ground mesh\r\n * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates\r\n * * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates\r\n * * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tiled-ground\r\n */\r\n GroundBuilder.CreateTiledGround = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var tiledGround = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledGround(options);\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n return tiledGround;\r\n };\r\n /**\r\n * Creates a ground mesh from a height map\r\n * * The parameter `url` sets the URL of the height map image resource.\r\n * * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.\r\n * * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.\r\n * * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.\r\n * * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.\r\n * * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.\r\n * * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).\r\n * * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param url defines the url to the height map\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map\r\n */\r\n GroundBuilder.CreateGroundFromHeightMap = function (name, url, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var width = options.width || 10.0;\r\n var height = options.height || 10.0;\r\n var subdivisions = options.subdivisions || 1 | 0;\r\n var minHeight = options.minHeight || 0.0;\r\n var maxHeight = options.maxHeight || 1.0;\r\n var filter = options.colorFilter || new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"](0.3, 0.59, 0.11);\r\n var alphaFilter = options.alphaFilter || 0.0;\r\n var updatable = options.updatable;\r\n var onReady = options.onReady;\r\n scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n var ground = new _groundMesh__WEBPACK_IMPORTED_MODULE_4__[\"GroundMesh\"](name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n ground._setReady(false);\r\n var onload = function (img) {\r\n // Getting height map data\r\n var canvas = document.createElement(\"canvas\");\r\n var context = canvas.getContext(\"2d\");\r\n if (!context) {\r\n throw new Error(\"Unable to get 2d context for CreateGroundFromHeightMap\");\r\n }\r\n if (scene.isDisposed) {\r\n return;\r\n }\r\n var bufferWidth = img.width;\r\n var bufferHeight = img.height;\r\n canvas.width = bufferWidth;\r\n canvas.height = bufferHeight;\r\n context.drawImage(img, 0, 0);\r\n // Create VertexData from map data\r\n // Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\r\n var buffer = context.getImageData(0, 0, bufferWidth, bufferHeight).data;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGroundFromHeightMap({\r\n width: width, height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight, maxHeight: maxHeight, colorFilter: filter,\r\n buffer: buffer, bufferWidth: bufferWidth, bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter\r\n });\r\n vertexData.applyToMesh(ground, updatable);\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground);\r\n }\r\n ground._setReady(true);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].LoadImage(url, onload, function () { }, scene.offlineProvider);\r\n return ground;\r\n };\r\n return GroundBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/hemisphereBuilder.ts\":\n/*!**********************************************!*\\\n !*** ./Meshes/Builders/hemisphereBuilder.ts ***!\n \\**********************************************/\n/*! exports provided: HemisphereBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return HemisphereBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n\r\n\r\n/**\r\n * Creates a hemispheric light\r\n */\r\n_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreateHemisphere = function (name, segments, diameter, scene) {\r\n var options = {\r\n segments: segments,\r\n diameter: diameter\r\n };\r\n return HemisphereBuilder.CreateHemisphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar HemisphereBuilder = /** @class */ (function () {\r\n function HemisphereBuilder() {\r\n }\r\n /**\r\n * Creates a hemisphere mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the hemisphere mesh\r\n */\r\n HemisphereBuilder.CreateHemisphere = function (name, options, scene) {\r\n if (!options.diameter) {\r\n options.diameter = 1;\r\n }\r\n if (!options.segments) {\r\n options.segments = 16;\r\n }\r\n var halfSphere = _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__[\"SphereBuilder\"].CreateSphere(\"\", { slice: 0.5, diameter: options.diameter, segments: options.segments }, scene);\r\n var disc = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreateDisc(\"\", options.diameter / 2, (options.segments * 3) + (4 - options.segments), scene);\r\n disc.rotation.x = -Math.PI / 2;\r\n disc.parent = halfSphere;\r\n var merged = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].MergeMeshes([disc, halfSphere], true);\r\n merged.name = name;\r\n return merged;\r\n };\r\n return HemisphereBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/icoSphereBuilder.ts\":\n/*!*********************************************!*\\\n !*** ./Meshes/Builders/icoSphereBuilder.ts ***!\n \\*********************************************/\n/*! exports provided: IcoSphereBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return IcoSphereBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateIcoSphere = function (options) {\r\n var sideOrientation = options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n var radius = options.radius || 1;\r\n var flat = (options.flat === undefined) ? true : options.flat;\r\n var subdivisions = options.subdivisions || 4;\r\n var radiusX = options.radiusX || radius;\r\n var radiusY = options.radiusY || radius;\r\n var radiusZ = options.radiusZ || radius;\r\n var t = (1 + Math.sqrt(5)) / 2;\r\n // 12 vertex x,y,z\r\n var ico_vertices = [\r\n -1, t, -0, 1, t, 0, -1, -t, 0, 1, -t, 0,\r\n 0, -1, -t, 0, 1, -t, 0, -1, t, 0, 1, t,\r\n t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, -1 // v8-11\r\n ];\r\n // index of 3 vertex makes a face of icopshere\r\n var ico_indices = [\r\n 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 12, 22, 23,\r\n 1, 5, 20, 5, 11, 4, 23, 22, 13, 22, 18, 6, 7, 1, 8,\r\n 14, 21, 4, 14, 4, 2, 16, 13, 6, 15, 6, 19, 3, 8, 9,\r\n 4, 21, 5, 13, 17, 23, 6, 13, 22, 19, 6, 18, 9, 8, 1\r\n ];\r\n // vertex for uv have aliased position, not for UV\r\n var vertices_unalias_id = [\r\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r\n // vertex alias\r\n 0,\r\n 2,\r\n 3,\r\n 3,\r\n 3,\r\n 4,\r\n 7,\r\n 8,\r\n 9,\r\n 9,\r\n 10,\r\n 11 // 23: B + 12\r\n ];\r\n // uv as integer step (not pixels !)\r\n var ico_vertexuv = [\r\n 5, 1, 3, 1, 6, 4, 0, 0,\r\n 5, 3, 4, 2, 2, 2, 4, 0,\r\n 2, 0, 1, 1, 6, 0, 6, 2,\r\n // vertex alias (for same vertex on different faces)\r\n 0, 4,\r\n 3, 3,\r\n 4, 4,\r\n 3, 1,\r\n 4, 2,\r\n 4, 4,\r\n 0, 2,\r\n 1, 1,\r\n 2, 2,\r\n 3, 3,\r\n 1, 3,\r\n 2, 4 // 23: B + 12\r\n ];\r\n // Vertices[0, 1, ...9, A, B] : position on UV plane\r\n // '+' indicate duplicate position to be fixed (3,9:0,2,3,4,7,8,A,B)\r\n // First island of uv mapping\r\n // v = 4h 3+ 2\r\n // v = 3h 9+ 4\r\n // v = 2h 9+ 5 B\r\n // v = 1h 9 1 0\r\n // v = 0h 3 8 7 A\r\n // u = 0 1 2 3 4 5 6 *a\r\n // Second island of uv mapping\r\n // v = 4h 0+ B+ 4+\r\n // v = 3h A+ 2+\r\n // v = 2h 7+ 6 3+\r\n // v = 1h 8+ 3+\r\n // v = 0h\r\n // u = 0 1 2 3 4 5 6 *a\r\n // Face layout on texture UV mapping\r\n // ============\r\n // \\ 4 /\\ 16 / ======\r\n // \\ / \\ / /\\ 11 /\r\n // \\/ 7 \\/ / \\ /\r\n // ======= / 10 \\/\r\n // /\\ 17 /\\ =======\r\n // / \\ / \\ \\ 15 /\\\r\n // / 8 \\/ 12 \\ \\ / \\\r\n // ============ \\/ 6 \\\r\n // \\ 18 /\\ ============\r\n // \\ / \\ \\ 5 /\\ 0 /\r\n // \\/ 13 \\ \\ / \\ /\r\n // ======= \\/ 1 \\/\r\n // =============\r\n // /\\ 19 /\\ 2 /\\\r\n // / \\ / \\ / \\\r\n // / 14 \\/ 9 \\/ 3 \\\r\n // ===================\r\n // uv step is u:1 or 0.5, v:cos(30)=sqrt(3)/2, ratio approx is 84/97\r\n var ustep = 138 / 1024;\r\n var vstep = 239 / 1024;\r\n var uoffset = 60 / 1024;\r\n var voffset = 26 / 1024;\r\n // Second island should have margin, not to touch the first island\r\n // avoid any borderline artefact in pixel rounding\r\n var island_u_offset = -40 / 1024;\r\n var island_v_offset = +20 / 1024;\r\n // face is either island 0 or 1 :\r\n // second island is for faces : [4, 7, 8, 12, 13, 16, 17, 18]\r\n var island = [\r\n 0, 0, 0, 0, 1,\r\n 0, 0, 1, 1, 0,\r\n 0, 0, 1, 1, 0,\r\n 0, 1, 1, 1, 0 // 15 - 19\r\n ];\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var current_indice = 0;\r\n // prepare array of 3 vector (empty) (to be worked in place, shared for each face)\r\n var face_vertex_pos = new Array(3);\r\n var face_vertex_uv = new Array(3);\r\n var v012;\r\n for (v012 = 0; v012 < 3; v012++) {\r\n face_vertex_pos[v012] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n face_vertex_uv[v012] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero();\r\n }\r\n // create all with normals\r\n for (var face = 0; face < 20; face++) {\r\n // 3 vertex per face\r\n for (v012 = 0; v012 < 3; v012++) {\r\n // look up vertex 0,1,2 to its index in 0 to 11 (or 23 including alias)\r\n var v_id = ico_indices[3 * face + v012];\r\n // vertex have 3D position (x,y,z)\r\n face_vertex_pos[v012].copyFromFloats(ico_vertices[3 * vertices_unalias_id[v_id]], ico_vertices[3 * vertices_unalias_id[v_id] + 1], ico_vertices[3 * vertices_unalias_id[v_id] + 2]);\r\n // Normalize to get normal, then scale to radius\r\n face_vertex_pos[v012].normalize().scaleInPlace(radius);\r\n // uv Coordinates from vertex ID\r\n face_vertex_uv[v012].copyFromFloats(ico_vertexuv[2 * v_id] * ustep + uoffset + island[face] * island_u_offset, ico_vertexuv[2 * v_id + 1] * vstep + voffset + island[face] * island_v_offset);\r\n }\r\n // Subdivide the face (interpolate pos, norm, uv)\r\n // - pos is linear interpolation, then projected to sphere (converge polyhedron to sphere)\r\n // - norm is linear interpolation of vertex corner normal\r\n // (to be checked if better to re-calc from face vertex, or if approximation is OK ??? )\r\n // - uv is linear interpolation\r\n //\r\n // Topology is as below for sub-divide by 2\r\n // vertex shown as v0,v1,v2\r\n // interp index is i1 to progress in range [v0,v1[\r\n // interp index is i2 to progress in range [v0,v2[\r\n // face index as (i1,i2) for /\\ : (i1,i2),(i1+1,i2),(i1,i2+1)\r\n // and (i1,i2)' for \\/ : (i1+1,i2),(i1+1,i2+1),(i1,i2+1)\r\n //\r\n //\r\n // i2 v2\r\n // ^ ^\r\n // / / \\\r\n // / / \\\r\n // / / \\\r\n // / / (0,1) \\\r\n // / #---------\\\r\n // / / \\ (0,0)'/ \\\r\n // / / \\ / \\\r\n // / / \\ / \\\r\n // / / (0,0) \\ / (1,0) \\\r\n // / #---------#---------\\\r\n // v0 v1\r\n //\r\n // --------------------> i1\r\n //\r\n // interp of (i1,i2):\r\n // along i2 : x0=lerp(v0,v2, i2/S) <---> x1=lerp(v1,v2, i2/S)\r\n // along i1 : lerp(x0,x1, i1/(S-i2))\r\n //\r\n // centroid of triangle is needed to get help normal computation\r\n // (c1,c2) are used for centroid location\r\n var interp_vertex = function (i1, i2, c1, c2) {\r\n // vertex is interpolated from\r\n // - face_vertex_pos[0..2]\r\n // - face_vertex_uv[0..2]\r\n var pos_x0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[0], face_vertex_pos[2], i2 / subdivisions);\r\n var pos_x1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[1], face_vertex_pos[2], i2 / subdivisions);\r\n var pos_interp = (subdivisions === i2) ? face_vertex_pos[2] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(pos_x0, pos_x1, i1 / (subdivisions - i2));\r\n pos_interp.normalize();\r\n var vertex_normal;\r\n if (flat) {\r\n // in flat mode, recalculate normal as face centroid normal\r\n var centroid_x0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[0], face_vertex_pos[2], c2 / subdivisions);\r\n var centroid_x1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[1], face_vertex_pos[2], c2 / subdivisions);\r\n vertex_normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(centroid_x0, centroid_x1, c1 / (subdivisions - c2));\r\n }\r\n else {\r\n // in smooth mode, recalculate normal from each single vertex position\r\n vertex_normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](pos_interp.x, pos_interp.y, pos_interp.z);\r\n }\r\n // Vertex normal need correction due to X,Y,Z radius scaling\r\n vertex_normal.x /= radiusX;\r\n vertex_normal.y /= radiusY;\r\n vertex_normal.z /= radiusZ;\r\n vertex_normal.normalize();\r\n var uv_x0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(face_vertex_uv[0], face_vertex_uv[2], i2 / subdivisions);\r\n var uv_x1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(face_vertex_uv[1], face_vertex_uv[2], i2 / subdivisions);\r\n var uv_interp = (subdivisions === i2) ? face_vertex_uv[2] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(uv_x0, uv_x1, i1 / (subdivisions - i2));\r\n positions.push(pos_interp.x * radiusX, pos_interp.y * radiusY, pos_interp.z * radiusZ);\r\n normals.push(vertex_normal.x, vertex_normal.y, vertex_normal.z);\r\n uvs.push(uv_interp.x, uv_interp.y);\r\n // push each vertex has member of a face\r\n // Same vertex can bleong to multiple face, it is pushed multiple time (duplicate vertex are present)\r\n indices.push(current_indice);\r\n current_indice++;\r\n };\r\n for (var i2 = 0; i2 < subdivisions; i2++) {\r\n for (var i1 = 0; i1 + i2 < subdivisions; i1++) {\r\n // face : (i1,i2) for /\\ :\r\n // interp for : (i1,i2),(i1+1,i2),(i1,i2+1)\r\n interp_vertex(i1, i2, i1 + 1.0 / 3, i2 + 1.0 / 3);\r\n interp_vertex(i1 + 1, i2, i1 + 1.0 / 3, i2 + 1.0 / 3);\r\n interp_vertex(i1, i2 + 1, i1 + 1.0 / 3, i2 + 1.0 / 3);\r\n if (i1 + i2 + 1 < subdivisions) {\r\n // face : (i1,i2)' for \\/ :\r\n // interp for (i1+1,i2),(i1+1,i2+1),(i1,i2+1)\r\n interp_vertex(i1 + 1, i2, i1 + 2.0 / 3, i2 + 2.0 / 3);\r\n interp_vertex(i1 + 1, i2 + 1, i1 + 2.0 / 3, i2 + 2.0 / 3);\r\n interp_vertex(i1, i2 + 1, i1 + 2.0 / 3, i2 + 2.0 / 3);\r\n }\r\n }\r\n }\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateIcoSphere = function (name, options, scene) {\r\n return IcoSphereBuilder.CreateIcoSphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar IcoSphereBuilder = /** @class */ (function () {\r\n function IcoSphereBuilder() {\r\n }\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value of `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the icosahedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n IcoSphereBuilder.CreateIcoSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var sphere = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateIcoSphere(options);\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n return sphere;\r\n };\r\n return IcoSphereBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/index.ts\":\n/*!**********************************!*\\\n !*** ./Meshes/Builders/index.ts ***!\n \\**********************************/\n/*! exports provided: BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boxBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _boxBuilder__WEBPACK_IMPORTED_MODULE_0__[\"BoxBuilder\"]; });\n\n/* harmony import */ var _tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tiledBoxBuilder */ \"./Meshes/Builders/tiledBoxBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_1__[\"TiledBoxBuilder\"]; });\n\n/* harmony import */ var _discBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./discBuilder */ \"./Meshes/Builders/discBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _discBuilder__WEBPACK_IMPORTED_MODULE_2__[\"DiscBuilder\"]; });\n\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _ribbonBuilder__WEBPACK_IMPORTED_MODULE_3__[\"RibbonBuilder\"]; });\n\n/* harmony import */ var _sphereBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _sphereBuilder__WEBPACK_IMPORTED_MODULE_4__[\"SphereBuilder\"]; });\n\n/* harmony import */ var _hemisphereBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hemisphereBuilder */ \"./Meshes/Builders/hemisphereBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _hemisphereBuilder__WEBPACK_IMPORTED_MODULE_5__[\"HemisphereBuilder\"]; });\n\n/* harmony import */ var _cylinderBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _cylinderBuilder__WEBPACK_IMPORTED_MODULE_6__[\"CylinderBuilder\"]; });\n\n/* harmony import */ var _torusBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./torusBuilder */ \"./Meshes/Builders/torusBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _torusBuilder__WEBPACK_IMPORTED_MODULE_7__[\"TorusBuilder\"]; });\n\n/* harmony import */ var _torusKnotBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./torusKnotBuilder */ \"./Meshes/Builders/torusKnotBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _torusKnotBuilder__WEBPACK_IMPORTED_MODULE_8__[\"TorusKnotBuilder\"]; });\n\n/* harmony import */ var _linesBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _linesBuilder__WEBPACK_IMPORTED_MODULE_9__[\"LinesBuilder\"]; });\n\n/* harmony import */ var _polygonBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./polygonBuilder */ \"./Meshes/Builders/polygonBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _polygonBuilder__WEBPACK_IMPORTED_MODULE_10__[\"PolygonBuilder\"]; });\n\n/* harmony import */ var _shapeBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./shapeBuilder */ \"./Meshes/Builders/shapeBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _shapeBuilder__WEBPACK_IMPORTED_MODULE_11__[\"ShapeBuilder\"]; });\n\n/* harmony import */ var _latheBuilder__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./latheBuilder */ \"./Meshes/Builders/latheBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _latheBuilder__WEBPACK_IMPORTED_MODULE_12__[\"LatheBuilder\"]; });\n\n/* harmony import */ var _planeBuilder__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _planeBuilder__WEBPACK_IMPORTED_MODULE_13__[\"PlaneBuilder\"]; });\n\n/* harmony import */ var _tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tiledPlaneBuilder */ \"./Meshes/Builders/tiledPlaneBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_14__[\"TiledPlaneBuilder\"]; });\n\n/* harmony import */ var _groundBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./groundBuilder */ \"./Meshes/Builders/groundBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _groundBuilder__WEBPACK_IMPORTED_MODULE_15__[\"GroundBuilder\"]; });\n\n/* harmony import */ var _tubeBuilder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./tubeBuilder */ \"./Meshes/Builders/tubeBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _tubeBuilder__WEBPACK_IMPORTED_MODULE_16__[\"TubeBuilder\"]; });\n\n/* harmony import */ var _polyhedronBuilder__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./polyhedronBuilder */ \"./Meshes/Builders/polyhedronBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _polyhedronBuilder__WEBPACK_IMPORTED_MODULE_17__[\"PolyhedronBuilder\"]; });\n\n/* harmony import */ var _icoSphereBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./icoSphereBuilder */ \"./Meshes/Builders/icoSphereBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _icoSphereBuilder__WEBPACK_IMPORTED_MODULE_18__[\"IcoSphereBuilder\"]; });\n\n/* harmony import */ var _decalBuilder__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./decalBuilder */ \"./Meshes/Builders/decalBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _decalBuilder__WEBPACK_IMPORTED_MODULE_19__[\"DecalBuilder\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/latheBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/latheBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: LatheBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return LatheBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLathe = function (name, shape, radius, tessellation, scene, updatable, sideOrientation) {\r\n var options = {\r\n shape: shape,\r\n radius: radius,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return LatheBuilder.CreateLathe(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar LatheBuilder = /** @class */ (function () {\r\n function LatheBuilder() {\r\n }\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * * The parameter `radius` (positive float, default 1) is the radius value of the lathe\r\n * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe\r\n * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides\r\n * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape\r\n * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter \"arc\"\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the lathe mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lathe\r\n */\r\n LatheBuilder.CreateLathe = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var arc = options.arc ? ((options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc) : 1.0;\r\n var closed = (options.closed === undefined) ? true : options.closed;\r\n var shape = options.shape;\r\n var radius = options.radius || 1;\r\n var tessellation = options.tessellation || 64;\r\n var clip = options.clip || 0;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var cap = options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var pi2 = Math.PI * 2;\r\n var paths = new Array();\r\n var invertUV = options.invertUV || false;\r\n var i = 0;\r\n var p = 0;\r\n var step = pi2 / tessellation * arc;\r\n var rotated;\r\n var path = new Array();\r\n for (i = 0; i <= tessellation - clip; i++) {\r\n var path = [];\r\n if (cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_START || cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL) {\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, shape[0].y, 0));\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Math.cos(i * step) * shape[0].x * radius, shape[0].y, Math.sin(i * step) * shape[0].x * radius));\r\n }\r\n for (p = 0; p < shape.length; p++) {\r\n rotated = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Math.cos(i * step) * shape[p].x * radius, shape[p].y, Math.sin(i * step) * shape[p].x * radius);\r\n path.push(rotated);\r\n }\r\n if (cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END || cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL) {\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Math.cos(i * step) * shape[shape.length - 1].x * radius, shape[shape.length - 1].y, Math.sin(i * step) * shape[shape.length - 1].x * radius));\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, shape[shape.length - 1].y, 0));\r\n }\r\n paths.push(path);\r\n }\r\n // lathe ribbon\r\n var lathe = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(name, { pathArray: paths, closeArray: closed, sideOrientation: sideOrientation, updatable: updatable, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);\r\n return lathe;\r\n };\r\n return LatheBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/linesBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/linesBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: LinesBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return LinesBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Meshes/linesMesh */ \"./Meshes/linesMesh.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateLineSystem = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateDashedLines = function (options) {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n var positions = new Array();\r\n var indices = new Array();\r\n var curvect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n var options = {\r\n points: points,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateLines(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n points: points,\r\n dashSize: dashSize,\r\n gapSize: gapSize,\r\n dashNb: dashNb,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateDashedLines(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar LinesBuilder = /** @class */ (function () {\r\n function LinesBuilder() {\r\n }\r\n /**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\n LinesBuilder.CreateLineSystem = function (name, options, scene) {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind);\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"](name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha);\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateLineSystem(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n };\r\n /**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\n LinesBuilder.CreateLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = LinesBuilder.CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha }, scene);\r\n return lines;\r\n };\r\n /**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\n LinesBuilder.CreateDashedLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n if (instance) { // dashed lines update\r\n var positionFunction = function (positions) {\r\n var curvect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n var dashSize = instance._creationDataStorage.dashSize;\r\n var gapSize = instance._creationDataStorage.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"](name, scene);\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateDashedLines(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n dashedLines._creationDataStorage = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"_CreationDataStorage\"]();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n };\r\n return LinesBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/planeBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/planeBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: PlaneBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return PlaneBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreatePlane = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DEFAULTSIDE;\r\n // Vertices\r\n var halfWidth = width / 2.0;\r\n var halfHeight = height / 2.0;\r\n positions.push(-halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 0.0);\r\n positions.push(halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 0.0);\r\n positions.push(halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 1.0);\r\n positions.push(-halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 1.0);\r\n // Indices\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n var options = {\r\n size: size,\r\n width: size,\r\n height: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return PlaneBuilder.CreatePlane(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PlaneBuilder = /** @class */ (function () {\r\n function PlaneBuilder() {\r\n }\r\n /**\r\n * Creates a plane mesh\r\n * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)\r\n * * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value of `size`)\r\n * * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n PlaneBuilder.CreatePlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var plane = new _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n plane._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreatePlane(options);\r\n vertexData.applyToMesh(plane, options.updatable);\r\n if (options.sourcePlane) {\r\n plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);\r\n plane.setDirection(options.sourcePlane.normal.scale(-1));\r\n }\r\n return plane;\r\n };\r\n return PlaneBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/polygonBuilder.ts\":\n/*!*******************************************!*\\\n !*** ./Meshes/Builders/polygonBuilder.ts ***!\n \\*******************************************/\n/*! exports provided: PolygonBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return PolygonBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _polygonMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../polygonMesh */ \"./Meshes/polygonMesh.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolygon = function (polygon, sideOrientation, fUV, fColors, frontUVs, backUVs) {\r\n var faceUV = fUV || new Array(3);\r\n var faceColors = fColors;\r\n var colors = [];\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < 3; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n var positions = polygon.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n var normals = polygon.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n var uvs = polygon.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].UVKind);\r\n var indices = polygon.getIndices();\r\n // set face colours and textures\r\n var idx = 0;\r\n var face = 0;\r\n for (var index = 0; index < normals.length; index += 3) {\r\n //Edge Face no. 1\r\n if (Math.abs(normals[index + 1]) < 0.001) {\r\n face = 1;\r\n }\r\n //Top Face no. 0\r\n if (Math.abs(normals[index + 1] - 1) < 0.001) {\r\n face = 0;\r\n }\r\n //Bottom Face no. 2\r\n if (Math.abs(normals[index + 1] + 1) < 0.001) {\r\n face = 2;\r\n }\r\n idx = index / 3;\r\n uvs[2 * idx] = (1 - uvs[2 * idx]) * faceUV[face].x + uvs[2 * idx] * faceUV[face].z;\r\n uvs[2 * idx + 1] = (1 - uvs[2 * idx + 1]) * faceUV[face].y + uvs[2 * idx + 1] * faceUV[face].w;\r\n if (faceColors) {\r\n colors.push(faceColors[face].r, faceColors[face].g, faceColors[face].b, faceColors[face].a);\r\n }\r\n }\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreatePolygon = function (name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n var options = {\r\n shape: shape,\r\n holes: holes,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation\r\n };\r\n return PolygonBuilder.CreatePolygon(name, options, scene, earcutInjection);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].ExtrudePolygon = function (name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n var options = {\r\n shape: shape,\r\n holes: holes,\r\n depth: depth,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation\r\n };\r\n return PolygonBuilder.ExtrudePolygon(name, options, scene, earcutInjection);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PolygonBuilder = /** @class */ (function () {\r\n function PolygonBuilder() {\r\n }\r\n /**\r\n * Creates a polygon mesh\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh\r\n * * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4)\r\n * * Remember you can only change the shape positions, not their number when updating a polygon\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n PolygonBuilder.CreatePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var shape = options.shape;\r\n var holes = options.holes || [];\r\n var depth = options.depth || 0;\r\n var contours = [];\r\n var hole = [];\r\n for (var i = 0; i < shape.length; i++) {\r\n contours[i] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](shape[i].x, shape[i].z);\r\n }\r\n var epsilon = 0.00000001;\r\n if (contours[0].equalsWithEpsilon(contours[contours.length - 1], epsilon)) {\r\n contours.pop();\r\n }\r\n var polygonTriangulation = new _polygonMesh__WEBPACK_IMPORTED_MODULE_4__[\"PolygonMeshBuilder\"](name, contours, scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene, earcutInjection);\r\n for (var hNb = 0; hNb < holes.length; hNb++) {\r\n hole = [];\r\n for (var hPoint = 0; hPoint < holes[hNb].length; hPoint++) {\r\n hole.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](holes[hNb][hPoint].x, holes[hNb][hPoint].z));\r\n }\r\n polygonTriangulation.addHole(hole);\r\n }\r\n var polygon = polygonTriangulation.build(options.updatable, depth);\r\n polygon._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolygon(polygon, options.sideOrientation, options.faceUV, options.faceColors, options.frontUVs, options.backUVs);\r\n vertexData.applyToMesh(polygon, options.updatable);\r\n return polygon;\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction.\r\n * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)\r\n * @see https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n PolygonBuilder.ExtrudePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n return PolygonBuilder.CreatePolygon(name, options, scene, earcutInjection);\r\n };\r\n return PolygonBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/polyhedronBuilder.ts\":\n/*!**********************************************!*\\\n !*** ./Meshes/Builders/polyhedronBuilder.ts ***!\n \\**********************************************/\n/*! exports provided: PolyhedronBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return PolyhedronBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolyhedron = function (options) {\r\n // provided polyhedron types :\r\n // 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\r\n // 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\r\n var polyhedra = [];\r\n polyhedra[0] = { vertex: [[0, 0, 1.732051], [1.632993, 0, -0.5773503], [-0.8164966, 1.414214, -0.5773503], [-0.8164966, -1.414214, -0.5773503]], face: [[0, 1, 2], [0, 2, 3], [0, 3, 1], [1, 3, 2]] };\r\n polyhedra[1] = { vertex: [[0, 0, 1.414214], [1.414214, 0, 0], [0, 1.414214, 0], [-1.414214, 0, 0], [0, -1.414214, 0], [0, 0, -1.414214]], face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [3, 5, 4]] };\r\n polyhedra[2] = {\r\n vertex: [[0, 0, 1.070466], [0.7136442, 0, 0.7978784], [-0.3568221, 0.618034, 0.7978784], [-0.3568221, -0.618034, 0.7978784], [0.7978784, 0.618034, 0.3568221], [0.7978784, -0.618034, 0.3568221], [-0.9341724, 0.381966, 0.3568221], [0.1362939, 1, 0.3568221], [0.1362939, -1, 0.3568221], [-0.9341724, -0.381966, 0.3568221], [0.9341724, 0.381966, -0.3568221], [0.9341724, -0.381966, -0.3568221], [-0.7978784, 0.618034, -0.3568221], [-0.1362939, 1, -0.3568221], [-0.1362939, -1, -0.3568221], [-0.7978784, -0.618034, -0.3568221], [0.3568221, 0.618034, -0.7978784], [0.3568221, -0.618034, -0.7978784], [-0.7136442, 0, -0.7978784], [0, 0, -1.070466]],\r\n face: [[0, 1, 4, 7, 2], [0, 2, 6, 9, 3], [0, 3, 8, 5, 1], [1, 5, 11, 10, 4], [2, 7, 13, 12, 6], [3, 9, 15, 14, 8], [4, 10, 16, 13, 7], [5, 8, 14, 17, 11], [6, 12, 18, 15, 9], [10, 11, 17, 19, 16], [12, 13, 16, 19, 18], [14, 15, 18, 19, 17]]\r\n };\r\n polyhedra[3] = {\r\n vertex: [[0, 0, 1.175571], [1.051462, 0, 0.5257311], [0.3249197, 1, 0.5257311], [-0.8506508, 0.618034, 0.5257311], [-0.8506508, -0.618034, 0.5257311], [0.3249197, -1, 0.5257311], [0.8506508, 0.618034, -0.5257311], [0.8506508, -0.618034, -0.5257311], [-0.3249197, 1, -0.5257311], [-1.051462, 0, -0.5257311], [-0.3249197, -1, -0.5257311], [0, 0, -1.175571]],\r\n face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1], [1, 5, 7], [1, 7, 6], [1, 6, 2], [2, 6, 8], [2, 8, 3], [3, 8, 9], [3, 9, 4], [4, 9, 10], [4, 10, 5], [5, 10, 7], [6, 7, 11], [6, 11, 8], [7, 10, 11], [8, 11, 9], [9, 11, 10]]\r\n };\r\n polyhedra[4] = {\r\n vertex: [[0, 0, 1.070722], [0.7148135, 0, 0.7971752], [-0.104682, 0.7071068, 0.7971752], [-0.6841528, 0.2071068, 0.7971752], [-0.104682, -0.7071068, 0.7971752], [0.6101315, 0.7071068, 0.5236279], [1.04156, 0.2071068, 0.1367736], [0.6101315, -0.7071068, 0.5236279], [-0.3574067, 1, 0.1367736], [-0.7888348, -0.5, 0.5236279], [-0.9368776, 0.5, 0.1367736], [-0.3574067, -1, 0.1367736], [0.3574067, 1, -0.1367736], [0.9368776, -0.5, -0.1367736], [0.7888348, 0.5, -0.5236279], [0.3574067, -1, -0.1367736], [-0.6101315, 0.7071068, -0.5236279], [-1.04156, -0.2071068, -0.1367736], [-0.6101315, -0.7071068, -0.5236279], [0.104682, 0.7071068, -0.7971752], [0.6841528, -0.2071068, -0.7971752], [0.104682, -0.7071068, -0.7971752], [-0.7148135, 0, -0.7971752], [0, 0, -1.070722]],\r\n face: [[0, 2, 3], [1, 6, 5], [4, 9, 11], [7, 15, 13], [8, 16, 10], [12, 14, 19], [17, 22, 18], [20, 21, 23], [0, 1, 5, 2], [0, 3, 9, 4], [0, 4, 7, 1], [1, 7, 13, 6], [2, 5, 12, 8], [2, 8, 10, 3], [3, 10, 17, 9], [4, 11, 15, 7], [5, 6, 14, 12], [6, 13, 20, 14], [8, 12, 19, 16], [9, 17, 18, 11], [10, 16, 22, 17], [11, 18, 21, 15], [13, 15, 21, 20], [14, 20, 23, 19], [16, 19, 23, 22], [18, 22, 23, 21]]\r\n };\r\n polyhedra[5] = { vertex: [[0, 0, 1.322876], [1.309307, 0, 0.1889822], [-0.9819805, 0.8660254, 0.1889822], [0.1636634, -1.299038, 0.1889822], [0.3273268, 0.8660254, -0.9449112], [-0.8183171, -0.4330127, -0.9449112]], face: [[0, 3, 1], [2, 4, 5], [0, 1, 4, 2], [0, 2, 5, 3], [1, 3, 5, 4]] };\r\n polyhedra[6] = { vertex: [[0, 0, 1.159953], [1.013464, 0, 0.5642542], [-0.3501431, 0.9510565, 0.5642542], [-0.7715208, -0.6571639, 0.5642542], [0.6633206, 0.9510565, -0.03144481], [0.8682979, -0.6571639, -0.3996071], [-1.121664, 0.2938926, -0.03144481], [-0.2348831, -1.063314, -0.3996071], [0.5181548, 0.2938926, -0.9953061], [-0.5850262, -0.112257, -0.9953061]], face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 9, 7], [5, 7, 9, 8], [0, 3, 7, 5, 1], [2, 4, 8, 9, 6]] };\r\n polyhedra[7] = { vertex: [[0, 0, 1.118034], [0.8944272, 0, 0.6708204], [-0.2236068, 0.8660254, 0.6708204], [-0.7826238, -0.4330127, 0.6708204], [0.6708204, 0.8660254, 0.2236068], [1.006231, -0.4330127, -0.2236068], [-1.006231, 0.4330127, 0.2236068], [-0.6708204, -0.8660254, -0.2236068], [0.7826238, 0.4330127, -0.6708204], [0.2236068, -0.8660254, -0.6708204], [-0.8944272, 0, -0.6708204], [0, 0, -1.118034]], face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 10, 7], [5, 9, 11, 8], [7, 10, 11, 9], [0, 3, 7, 9, 5, 1], [2, 4, 8, 11, 10, 6]] };\r\n polyhedra[8] = { vertex: [[-0.729665, 0.670121, 0.319155], [-0.655235, -0.29213, -0.754096], [-0.093922, -0.607123, 0.537818], [0.702196, 0.595691, 0.485187], [0.776626, -0.36656, -0.588064]], face: [[1, 4, 2], [0, 1, 2], [3, 0, 2], [4, 3, 2], [4, 1, 0, 3]] };\r\n polyhedra[9] = { vertex: [[-0.868849, -0.100041, 0.61257], [-0.329458, 0.976099, 0.28078], [-0.26629, -0.013796, -0.477654], [-0.13392, -1.034115, 0.229829], [0.738834, 0.707117, -0.307018], [0.859683, -0.535264, -0.338508]], face: [[3, 0, 2], [5, 3, 2], [4, 5, 2], [1, 4, 2], [0, 1, 2], [0, 3, 5, 4, 1]] };\r\n polyhedra[10] = { vertex: [[-0.610389, 0.243975, 0.531213], [-0.187812, -0.48795, -0.664016], [-0.187812, 0.9759, -0.664016], [0.187812, -0.9759, 0.664016], [0.798201, 0.243975, 0.132803]], face: [[1, 3, 0], [3, 4, 0], [3, 1, 4], [0, 2, 1], [0, 4, 2], [2, 4, 1]] };\r\n polyhedra[11] = { vertex: [[-1.028778, 0.392027, -0.048786], [-0.640503, -0.646161, 0.621837], [-0.125162, -0.395663, -0.540059], [0.004683, 0.888447, -0.651988], [0.125161, 0.395663, 0.540059], [0.632925, -0.791376, 0.433102], [1.031672, 0.157063, -0.354165]], face: [[3, 2, 0], [2, 1, 0], [2, 5, 1], [0, 4, 3], [0, 1, 4], [4, 1, 5], [2, 3, 6], [3, 4, 6], [5, 2, 6], [4, 5, 6]] };\r\n polyhedra[12] = { vertex: [[-0.669867, 0.334933, -0.529576], [-0.669867, 0.334933, 0.529577], [-0.4043, 1.212901, 0], [-0.334933, -0.669867, -0.529576], [-0.334933, -0.669867, 0.529577], [0.334933, 0.669867, -0.529576], [0.334933, 0.669867, 0.529577], [0.4043, -1.212901, 0], [0.669867, -0.334933, -0.529576], [0.669867, -0.334933, 0.529577]], face: [[8, 9, 7], [6, 5, 2], [3, 8, 7], [5, 0, 2], [4, 3, 7], [0, 1, 2], [9, 4, 7], [1, 6, 2], [9, 8, 5, 6], [8, 3, 0, 5], [3, 4, 1, 0], [4, 9, 6, 1]] };\r\n polyhedra[13] = { vertex: [[-0.931836, 0.219976, -0.264632], [-0.636706, 0.318353, 0.692816], [-0.613483, -0.735083, -0.264632], [-0.326545, 0.979634, 0], [-0.318353, -0.636706, 0.692816], [-0.159176, 0.477529, -0.856368], [0.159176, -0.477529, -0.856368], [0.318353, 0.636706, 0.692816], [0.326545, -0.979634, 0], [0.613482, 0.735082, -0.264632], [0.636706, -0.318353, 0.692816], [0.931835, -0.219977, -0.264632]], face: [[11, 10, 8], [7, 9, 3], [6, 11, 8], [9, 5, 3], [2, 6, 8], [5, 0, 3], [4, 2, 8], [0, 1, 3], [10, 4, 8], [1, 7, 3], [10, 11, 9, 7], [11, 6, 5, 9], [6, 2, 0, 5], [2, 4, 1, 0], [4, 10, 7, 1]] };\r\n polyhedra[14] = {\r\n vertex: [[-0.93465, 0.300459, -0.271185], [-0.838689, -0.260219, -0.516017], [-0.711319, 0.717591, 0.128359], [-0.710334, -0.156922, 0.080946], [-0.599799, 0.556003, -0.725148], [-0.503838, -0.004675, -0.969981], [-0.487004, 0.26021, 0.48049], [-0.460089, -0.750282, -0.512622], [-0.376468, 0.973135, -0.325605], [-0.331735, -0.646985, 0.084342], [-0.254001, 0.831847, 0.530001], [-0.125239, -0.494738, -0.966586], [0.029622, 0.027949, 0.730817], [0.056536, -0.982543, -0.262295], [0.08085, 1.087391, 0.076037], [0.125583, -0.532729, 0.485984], [0.262625, 0.599586, 0.780328], [0.391387, -0.726999, -0.716259], [0.513854, -0.868287, 0.139347], [0.597475, 0.85513, 0.326364], [0.641224, 0.109523, 0.783723], [0.737185, -0.451155, 0.538891], [0.848705, -0.612742, -0.314616], [0.976075, 0.365067, 0.32976], [1.072036, -0.19561, 0.084927]],\r\n face: [[15, 18, 21], [12, 20, 16], [6, 10, 2], [3, 0, 1], [9, 7, 13], [2, 8, 4, 0], [0, 4, 5, 1], [1, 5, 11, 7], [7, 11, 17, 13], [13, 17, 22, 18], [18, 22, 24, 21], [21, 24, 23, 20], [20, 23, 19, 16], [16, 19, 14, 10], [10, 14, 8, 2], [15, 9, 13, 18], [12, 15, 21, 20], [6, 12, 16, 10], [3, 6, 2, 0], [9, 3, 1, 7], [9, 15, 12, 6, 3], [22, 17, 11, 5, 4, 8, 14, 19, 23, 24]]\r\n };\r\n var type = options.type && (options.type < 0 || options.type >= polyhedra.length) ? 0 : options.type || 0;\r\n var size = options.size;\r\n var sizeX = options.sizeX || size || 1;\r\n var sizeY = options.sizeY || size || 1;\r\n var sizeZ = options.sizeZ || size || 1;\r\n var data = options.custom || polyhedra[type];\r\n var nbfaces = data.face.length;\r\n var faceUV = options.faceUV || new Array(nbfaces);\r\n var faceColors = options.faceColors;\r\n var flat = (options.flat === undefined) ? true : options.flat;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var positions = new Array();\r\n var indices = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var index = 0;\r\n var faceIdx = 0; // face cursor in the array \"indexes\"\r\n var indexes = new Array();\r\n var i = 0;\r\n var f = 0;\r\n var u, v, ang, x, y, tmp;\r\n // default face colors and UV if undefined\r\n if (flat) {\r\n for (f = 0; f < nbfaces; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n }\r\n }\r\n if (!flat) {\r\n for (i = 0; i < data.vertex.length; i++) {\r\n positions.push(data.vertex[i][0] * sizeX, data.vertex[i][1] * sizeY, data.vertex[i][2] * sizeZ);\r\n uvs.push(0, 0);\r\n }\r\n for (f = 0; f < nbfaces; f++) {\r\n for (i = 0; i < data.face[f].length - 2; i++) {\r\n indices.push(data.face[f][0], data.face[f][i + 2], data.face[f][i + 1]);\r\n }\r\n }\r\n }\r\n else {\r\n for (f = 0; f < nbfaces; f++) {\r\n var fl = data.face[f].length; // number of vertices of the current face\r\n ang = 2 * Math.PI / fl;\r\n x = 0.5 * Math.tan(ang / 2);\r\n y = 0.5;\r\n // positions, uvs, colors\r\n for (i = 0; i < fl; i++) {\r\n // positions\r\n positions.push(data.vertex[data.face[f][i]][0] * sizeX, data.vertex[data.face[f][i]][1] * sizeY, data.vertex[data.face[f][i]][2] * sizeZ);\r\n indexes.push(index);\r\n index++;\r\n // uvs\r\n u = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * (0.5 + x);\r\n v = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * (y - 0.5);\r\n uvs.push(u, v);\r\n tmp = x * Math.cos(ang) - y * Math.sin(ang);\r\n y = x * Math.sin(ang) + y * Math.cos(ang);\r\n x = tmp;\r\n // colors\r\n if (faceColors) {\r\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\r\n }\r\n }\r\n // indices from indexes\r\n for (i = 0; i < fl - 2; i++) {\r\n indices.push(indexes[0 + faceIdx], indexes[i + 2 + faceIdx], indexes[i + 1 + faceIdx]);\r\n }\r\n faceIdx += fl;\r\n }\r\n }\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors && flat) {\r\n vertexData.colors = colors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreatePolyhedron = function (name, options, scene) {\r\n return PolyhedronBuilder.CreatePolyhedron(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PolyhedronBuilder = /** @class */ (function () {\r\n function PolyhedronBuilder() {\r\n }\r\n /**\r\n * Creates a polyhedron mesh\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the polyhedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes\r\n */\r\n PolyhedronBuilder.CreatePolyhedron = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var polyhedron = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n polyhedron._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolyhedron(options);\r\n vertexData.applyToMesh(polyhedron, options.updatable);\r\n return polyhedron;\r\n };\r\n return PolyhedronBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/ribbonBuilder.ts\":\n/*!******************************************!*\\\n !*** ./Meshes/Builders/ribbonBuilder.ts ***!\n \\******************************************/\n/*! exports provided: RibbonBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return RibbonBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateRibbon = function (options) {\r\n var pathArray = options.pathArray;\r\n var closeArray = options.closeArray || false;\r\n var closePath = options.closePath || false;\r\n var invertUV = options.invertUV || false;\r\n var defaultOffset = Math.floor(pathArray[0].length / 2);\r\n var offset = options.offset || defaultOffset;\r\n offset = offset > defaultOffset ? defaultOffset : Math.floor(offset); // offset max allowed : defaultOffset\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var customUV = options.uvs;\r\n var customColors = options.colors;\r\n var positions = [];\r\n var indices = [];\r\n var normals = [];\r\n var uvs = [];\r\n var us = []; // us[path_id] = [uDist1, uDist2, uDist3 ... ] distances between points on path path_id\r\n var vs = []; // vs[i] = [vDist1, vDist2, vDist3, ... ] distances between points i of consecutives paths from pathArray\r\n var uTotalDistance = []; // uTotalDistance[p] : total distance of path p\r\n var vTotalDistance = []; // vTotalDistance[i] : total distance between points i of first and last path from pathArray\r\n var minlg; // minimal length among all paths from pathArray\r\n var lg = []; // array of path lengths : nb of vertex per path\r\n var idx = []; // array of path indexes : index of each path (first vertex) in the total vertex number\r\n var p; // path iterator\r\n var i; // point iterator\r\n var j; // point iterator\r\n // if single path in pathArray\r\n if (pathArray.length < 2) {\r\n var ar1 = [];\r\n var ar2 = [];\r\n for (i = 0; i < pathArray[0].length - offset; i++) {\r\n ar1.push(pathArray[0][i]);\r\n ar2.push(pathArray[0][i + offset]);\r\n }\r\n pathArray = [ar1, ar2];\r\n }\r\n // positions and horizontal distances (u)\r\n var idc = 0;\r\n var closePathCorr = (closePath) ? 1 : 0; // the final index will be +1 if closePath\r\n var path;\r\n var l;\r\n minlg = pathArray[0].length;\r\n var vectlg;\r\n var dist;\r\n for (p = 0; p < pathArray.length; p++) {\r\n uTotalDistance[p] = 0;\r\n us[p] = [0];\r\n path = pathArray[p];\r\n l = path.length;\r\n minlg = (minlg < l) ? minlg : l;\r\n j = 0;\r\n while (j < l) {\r\n positions.push(path[j].x, path[j].y, path[j].z);\r\n if (j > 0) {\r\n vectlg = path[j].subtract(path[j - 1]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n j++;\r\n }\r\n if (closePath) { // an extra hidden vertex is added in the \"positions\" array\r\n j--;\r\n positions.push(path[0].x, path[0].y, path[0].z);\r\n vectlg = path[j].subtract(path[0]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n lg[p] = l + closePathCorr;\r\n idx[p] = idc;\r\n idc += (l + closePathCorr);\r\n }\r\n // vertical distances (v)\r\n var path1;\r\n var path2;\r\n var vertex1 = null;\r\n var vertex2 = null;\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n vTotalDistance[i] = 0;\r\n vs[i] = [0];\r\n for (p = 0; p < pathArray.length - 1; p++) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[p + 1];\r\n if (i === minlg) { // closePath\r\n vertex1 = path1[0];\r\n vertex2 = path2[0];\r\n }\r\n else {\r\n vertex1 = path1[i];\r\n vertex2 = path2[i];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vs[i].push(dist);\r\n vTotalDistance[i] = dist;\r\n }\r\n if (closeArray && vertex2 && vertex1) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[0];\r\n if (i === minlg) { // closePath\r\n vertex2 = path2[0];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vTotalDistance[i] = dist;\r\n }\r\n }\r\n // uvs\r\n var u;\r\n var v;\r\n if (customUV) {\r\n for (p = 0; p < customUV.length; p++) {\r\n uvs.push(customUV[p].x, customUV[p].y);\r\n }\r\n }\r\n else {\r\n for (p = 0; p < pathArray.length; p++) {\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n u = (uTotalDistance[p] != 0.0) ? us[p][i] / uTotalDistance[p] : 0.0;\r\n v = (vTotalDistance[i] != 0.0) ? vs[i][p] / vTotalDistance[i] : 0.0;\r\n if (invertUV) {\r\n uvs.push(v, u);\r\n }\r\n else {\r\n uvs.push(u, v);\r\n }\r\n }\r\n }\r\n }\r\n // indices\r\n p = 0; // path index\r\n var pi = 0; // positions array index\r\n var l1 = lg[p] - 1; // path1 length\r\n var l2 = lg[p + 1] - 1; // path2 length\r\n var min = (l1 < l2) ? l1 : l2; // current path stop index\r\n var shft = idx[1] - idx[0]; // shift\r\n var path1nb = closeArray ? lg.length : lg.length - 1; // number of path1 to iterate\ton\r\n while (pi <= min && p < path1nb) { // stay under min and don't go over next to last path\r\n // draw two triangles between path1 (p1) and path2 (p2) : (p1.pi, p2.pi, p1.pi+1) and (p2.pi+1, p1.pi+1, p2.pi) clockwise\r\n indices.push(pi, pi + shft, pi + 1);\r\n indices.push(pi + shft + 1, pi + 1, pi + shft);\r\n pi += 1;\r\n if (pi === min) { // if end of one of two consecutive paths reached, go to next existing path\r\n p++;\r\n if (p === lg.length - 1) { // last path of pathArray reached <=> closeArray == true\r\n shft = idx[0] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[0] - 1;\r\n }\r\n else {\r\n shft = idx[p + 1] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[p + 1] - 1;\r\n }\r\n pi = idx[p];\r\n min = (l1 < l2) ? l1 + pi : l2 + pi;\r\n }\r\n }\r\n // normals\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n if (closePath) { // update both the first and last vertex normals to their average value\r\n var indexFirst = 0;\r\n var indexLast = 0;\r\n for (p = 0; p < pathArray.length; p++) {\r\n indexFirst = idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (idx[p + 1] - 1) * 3;\r\n }\r\n else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Colors\r\n var colors = null;\r\n if (customColors) {\r\n colors = new Float32Array(customColors.length * 4);\r\n for (var c = 0; c < customColors.length; c++) {\r\n colors[c * 4] = customColors[c].r;\r\n colors[c * 4 + 1] = customColors[c].g;\r\n colors[c * 4 + 2] = customColors[c].b;\r\n colors[c * 4 + 3] = customColors[c].a;\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n var positions32 = new Float32Array(positions);\r\n var normals32 = new Float32Array(normals);\r\n var uvs32 = new Float32Array(uvs);\r\n vertexData.indices = indices;\r\n vertexData.positions = positions32;\r\n vertexData.normals = normals32;\r\n vertexData.uvs = uvs32;\r\n if (colors) {\r\n vertexData.set(colors, _buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n }\r\n if (closePath) {\r\n vertexData._idx = idx;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateRibbon = function (name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\r\n if (closeArray === void 0) { closeArray = false; }\r\n if (updatable === void 0) { updatable = false; }\r\n return RibbonBuilder.CreateRibbon(name, {\r\n pathArray: pathArray,\r\n closeArray: closeArray,\r\n closePath: closePath,\r\n offset: offset,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance\r\n }, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar RibbonBuilder = /** @class */ (function () {\r\n function RibbonBuilder() {\r\n }\r\n /**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#ribbon\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ribbon mesh\r\n * @see https://doc.babylonjs.com/how_to/ribbon_tutorial\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n */\r\n RibbonBuilder.CreateRibbon = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var pathArray = options.pathArray;\r\n var closeArray = options.closeArray;\r\n var closePath = options.closePath;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var instance = options.instance;\r\n var updatable = options.updatable;\r\n if (instance) { // existing ribbon instance update\r\n // positionFunction : ribbon case\r\n // only pathArray and sideOrientation parameters are taken into account for positions update\r\n var minimum_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0].setAll(Number.MAX_VALUE);\r\n var maximum_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[1].setAll(-Number.MAX_VALUE);\r\n var positionFunction = function (positions) {\r\n var minlg = pathArray[0].length;\r\n var mesh = instance;\r\n var i = 0;\r\n var ns = (mesh._originalBuilderSideOrientation === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].DOUBLESIDE) ? 2 : 1;\r\n for (var si = 1; si <= ns; ++si) {\r\n for (var p = 0; p < pathArray.length; ++p) {\r\n var path = pathArray[p];\r\n var l = path.length;\r\n minlg = (minlg < l) ? minlg : l;\r\n for (var j = 0; j < minlg; ++j) {\r\n var pathPoint = path[j];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n minimum_1.minimizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n maximum_1.maximizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n i += 3;\r\n }\r\n if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {\r\n var pathPoint = path[0];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n i += 3;\r\n }\r\n }\r\n }\r\n };\r\n var positions = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n positionFunction(positions);\r\n if (instance._boundingInfo) {\r\n instance._boundingInfo.reConstruct(minimum_1, maximum_1, instance._worldMatrix);\r\n }\r\n else {\r\n instance._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_4__[\"BoundingInfo\"](minimum_1, maximum_1, instance._worldMatrix);\r\n }\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, positions, false, false);\r\n if (options.colors) {\r\n var colors = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n for (var c = 0, colorIndex = 0; c < options.colors.length; c++, colorIndex += 4) {\r\n var color = options.colors[c];\r\n colors[colorIndex] = color.r;\r\n colors[colorIndex + 1] = color.g;\r\n colors[colorIndex + 2] = color.b;\r\n colors[colorIndex + 3] = color.a;\r\n }\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind, colors, false, false);\r\n }\r\n if (options.uvs) {\r\n var uvs = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n for (var i = 0; i < options.uvs.length; i++) {\r\n uvs[i * 2] = options.uvs[i].x;\r\n uvs[i * 2 + 1] = options.uvs[i].y;\r\n }\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind, uvs, false, false);\r\n }\r\n if (!instance.areNormalsFrozen || instance.isFacetDataEnabled) {\r\n var indices = instance.getIndices();\r\n var normals = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals, params);\r\n if (instance._creationDataStorage && instance._creationDataStorage.closePath) {\r\n var indexFirst = 0;\r\n var indexLast = 0;\r\n for (var p = 0; p < pathArray.length; p++) {\r\n indexFirst = instance._creationDataStorage.idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (instance._creationDataStorage.idx[p + 1] - 1) * 3;\r\n }\r\n else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n if (!(instance.areNormalsFrozen)) {\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind, normals, false, false);\r\n }\r\n }\r\n return instance;\r\n }\r\n else { // new ribbon creation\r\n var ribbon = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n ribbon._originalBuilderSideOrientation = sideOrientation;\r\n ribbon._creationDataStorage = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"_CreationDataStorage\"]();\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateRibbon(options);\r\n if (closePath) {\r\n ribbon._creationDataStorage.idx = vertexData._idx;\r\n }\r\n ribbon._creationDataStorage.closePath = closePath;\r\n ribbon._creationDataStorage.closeArray = closeArray;\r\n vertexData.applyToMesh(ribbon, updatable);\r\n return ribbon;\r\n }\r\n };\r\n return RibbonBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/shapeBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/shapeBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: ShapeBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return ShapeBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].ExtrudeShape = function (name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n shape: shape,\r\n path: path,\r\n scale: scale,\r\n rotation: rotation,\r\n cap: (cap === 0) ? 0 : cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable\r\n };\r\n return ShapeBuilder.ExtrudeShape(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].ExtrudeShapeCustom = function (name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\r\n var options = {\r\n shape: shape,\r\n path: path,\r\n scaleFunction: scaleFunction,\r\n rotationFunction: rotationFunction,\r\n ribbonCloseArray: ribbonCloseArray,\r\n ribbonClosePath: ribbonClosePath,\r\n cap: (cap === 0) ? 0 : cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable\r\n };\r\n return ShapeBuilder.ExtrudeShapeCustom(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar ShapeBuilder = /** @class */ (function () {\r\n function ShapeBuilder() {\r\n }\r\n /**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n ShapeBuilder.ExtrudeShape = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var path = options.path;\r\n var shape = options.shape;\r\n var scale = options.scale || 1;\r\n var rotation = options.rotation || 0;\r\n var cap = (options.cap === 0) ? 0 : options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var instance = options.instance || null;\r\n var invertUV = options.invertUV || false;\r\n return ShapeBuilder._ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, false, false, cap, false, scene, updatable ? true : false, sideOrientation, instance, invertUV, options.frontUVs || null, options.backUVs || null);\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n ShapeBuilder.ExtrudeShapeCustom = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var path = options.path;\r\n var shape = options.shape;\r\n var scaleFunction = options.scaleFunction || (function () { return 1; });\r\n var rotationFunction = options.rotationFunction || (function () { return 0; });\r\n var ribbonCloseArray = options.ribbonCloseArray || false;\r\n var ribbonClosePath = options.ribbonClosePath || false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var instance = options.instance;\r\n var invertUV = options.invertUV || false;\r\n return ShapeBuilder._ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable ? true : false, sideOrientation, instance || null, invertUV, options.frontUVs || null, options.backUVs || null);\r\n };\r\n ShapeBuilder._ExtrudeShapeGeneric = function (name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV, frontUVs, backUVs) {\r\n // extrusion geometry\r\n var extrusionPathArray = function (shape, curve, path3D, shapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom) {\r\n var tangents = path3D.getTangents();\r\n var normals = path3D.getNormals();\r\n var binormals = path3D.getBinormals();\r\n var distances = path3D.getDistances();\r\n var angle = 0;\r\n var returnScale = function () { return scale !== null ? scale : 1; };\r\n var returnRotation = function () { return rotation !== null ? rotation : 0; };\r\n var rotate = custom && rotateFunction ? rotateFunction : returnRotation;\r\n var scl = custom && scaleFunction ? scaleFunction : returnScale;\r\n var index = (cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP || cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END) ? 0 : 2;\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n for (var i = 0; i < curve.length; i++) {\r\n var shapePath = new Array();\r\n var angleStep = rotate(i, distances[i]);\r\n var scaleRatio = scl(i, distances[i]);\r\n for (var p = 0; p < shape.length; p++) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(tangents[i], angle, rotationMatrix);\r\n var planed = ((tangents[i].scale(shape[p].z)).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y)));\r\n var rotated = shapePath[p] ? shapePath[p] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(planed, rotationMatrix, rotated);\r\n rotated.scaleInPlace(scaleRatio).addInPlace(curve[i]);\r\n shapePath[p] = rotated;\r\n }\r\n shapePaths[index] = shapePath;\r\n angle += angleStep;\r\n index++;\r\n }\r\n // cap\r\n var capPath = function (shapePath) {\r\n var pointCap = Array();\r\n var barycenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var i;\r\n for (i = 0; i < shapePath.length; i++) {\r\n barycenter.addInPlace(shapePath[i]);\r\n }\r\n barycenter.scaleInPlace(1.0 / shapePath.length);\r\n for (i = 0; i < shapePath.length; i++) {\r\n pointCap.push(barycenter);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP:\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_START:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END:\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n default:\r\n break;\r\n }\r\n return shapePaths;\r\n };\r\n var path3D;\r\n var pathArray;\r\n if (instance) { // instance update\r\n var storage = instance._creationDataStorage;\r\n path3D = storage.path3D.update(curve);\r\n pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom);\r\n instance = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateRibbon(\"\", pathArray, false, false, 0, scene || undefined, false, 0, instance);\r\n return instance;\r\n }\r\n // extruded shape creation\r\n path3D = new _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__[\"Path3D\"](curve);\r\n var newShapePaths = new Array();\r\n cap = (cap < 0 || cap > 3) ? 0 : cap;\r\n pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom);\r\n var extrudedGeneric = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(name, { pathArray: pathArray, closeArray: rbCA, closePath: rbCP, updatable: updtbl, sideOrientation: side, invertUV: invertUV, frontUVs: frontUVs || undefined, backUVs: backUVs || undefined }, scene);\r\n extrudedGeneric._creationDataStorage.pathArray = pathArray;\r\n extrudedGeneric._creationDataStorage.path3D = path3D;\r\n extrudedGeneric._creationDataStorage.cap = cap;\r\n return extrudedGeneric;\r\n };\r\n return ShapeBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/sphereBuilder.ts\":\n/*!******************************************!*\\\n !*** ./Meshes/Builders/sphereBuilder.ts ***!\n \\******************************************/\n/*! exports provided: SphereBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return SphereBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateSphere = function (options) {\r\n var segments = options.segments || 32;\r\n var diameterX = options.diameterX || options.diameter || 1;\r\n var diameterY = options.diameterY || options.diameter || 1;\r\n var diameterZ = options.diameterZ || options.diameter || 1;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var slice = options.slice && (options.slice <= 0) ? 1.0 : options.slice || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n var radius = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](diameterX / 2, diameterY / 2, diameterZ / 2);\r\n var totalZRotationSteps = 2 + segments;\r\n var totalYRotationSteps = 2 * totalZRotationSteps;\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n for (var zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {\r\n var normalizedZ = zRotationStep / totalZRotationSteps;\r\n var angleZ = normalizedZ * Math.PI * slice;\r\n for (var yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {\r\n var normalizedY = yRotationStep / totalYRotationSteps;\r\n var angleY = normalizedY * Math.PI * 2 * arc;\r\n var rotationZ = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationZ(-angleZ);\r\n var rotationY = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(angleY);\r\n var afterRotZ = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(), rotationZ);\r\n var complete = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(afterRotZ, rotationY);\r\n var vertex = complete.multiply(radius);\r\n var normal = complete.divide(radius).normalize();\r\n positions.push(vertex.x, vertex.y, vertex.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(normalizedY, normalizedZ);\r\n }\r\n if (zRotationStep > 0) {\r\n var verticesCount = positions.length / 3;\r\n for (var firstIndex = verticesCount - 2 * (totalYRotationSteps + 1); (firstIndex + totalYRotationSteps + 2) < verticesCount; firstIndex++) {\r\n indices.push((firstIndex));\r\n indices.push((firstIndex + 1));\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push((firstIndex + totalYRotationSteps + 1));\r\n indices.push((firstIndex + 1));\r\n indices.push((firstIndex + totalYRotationSteps + 2));\r\n }\r\n }\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n var options = {\r\n segments: segments,\r\n diameterX: diameter,\r\n diameterY: diameter,\r\n diameterZ: diameter,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return SphereBuilder.CreateSphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar SphereBuilder = /** @class */ (function () {\r\n function SphereBuilder() {\r\n }\r\n /**\r\n * Creates a sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the sphere mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#sphere\r\n */\r\n SphereBuilder.CreateSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var sphere = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateSphere(options);\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n return sphere;\r\n };\r\n return SphereBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/tiledBoxBuilder.ts\":\n/*!********************************************!*\\\n !*** ./Meshes/Builders/tiledBoxBuilder.ts ***!\n \\********************************************/\n/*! exports provided: TiledBoxBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return TiledBoxBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledBox = function (options) {\r\n var nbFaces = 6;\r\n var faceUV = options.faceUV || new Array(6);\r\n var faceColors = options.faceColors;\r\n var flipTile = options.pattern || _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].NO_FLIP;\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var tileWidth = options.tileWidth || options.tileSize || 1;\r\n var tileHeight = options.tileHeight || options.tileSize || 1;\r\n var alignH = options.alignHorizontal || 0;\r\n var alignV = options.alignVertical || 0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < nbFaces; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n var halfWidth = width / 2;\r\n var halfHeight = height / 2;\r\n var halfDepth = depth / 2;\r\n var faceVertexData = [];\r\n for (var f = 0; f < 2; f++) { //front and back\r\n faceVertexData[f] = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledPlane({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation\r\n });\r\n }\r\n for (var f = 2; f < 4; f++) { //sides\r\n faceVertexData[f] = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledPlane({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: depth,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation\r\n });\r\n }\r\n var baseAlignV = alignV;\r\n if (alignV === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BOTTOM) {\r\n baseAlignV = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].TOP;\r\n }\r\n else if (alignV === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].TOP) {\r\n baseAlignV = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BOTTOM;\r\n }\r\n for (var f = 4; f < 6; f++) { //top and bottom\r\n faceVertexData[f] = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledPlane({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: depth,\r\n alignVertical: baseAlignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation\r\n });\r\n }\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var indices = [];\r\n var colors = [];\r\n var facePositions = [];\r\n var faceNormals = [];\r\n var newFaceUV = [];\r\n var len = 0;\r\n var lu = 0;\r\n var li = 0;\r\n for (var f = 0; f < nbFaces; f++) {\r\n var len = faceVertexData[f].positions.length;\r\n facePositions[f] = [];\r\n faceNormals[f] = [];\r\n for (var p = 0; p < len / 3; p++) {\r\n facePositions[f].push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](faceVertexData[f].positions[3 * p], faceVertexData[f].positions[3 * p + 1], faceVertexData[f].positions[3 * p + 2]));\r\n faceNormals[f].push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](faceVertexData[f].normals[3 * p], faceVertexData[f].normals[3 * p + 1], faceVertexData[f].normals[3 * p + 2]));\r\n }\r\n // uvs\r\n lu = faceVertexData[f].uvs.length;\r\n newFaceUV[f] = [];\r\n for (var i = 0; i < lu; i += 2) {\r\n newFaceUV[f][i] = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * faceVertexData[f].uvs[i];\r\n newFaceUV[f][i + 1] = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * faceVertexData[f].uvs[i + 1];\r\n }\r\n uvs = uvs.concat(newFaceUV[f]);\r\n indices = indices.concat(faceVertexData[f].indices.map(function (x) { return x + li; }));\r\n li += facePositions[f].length;\r\n if (faceColors) {\r\n for (var c = 0; c < 4; c++) {\r\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\r\n }\r\n }\r\n }\r\n var vec0 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, halfDepth);\r\n var mtrx0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(Math.PI);\r\n positions = facePositions[0].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx0).add(vec0); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []);\r\n normals = faceNormals[0].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx0); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []);\r\n positions = positions.concat(facePositions[1].map(function (entry) { return entry.subtract(vec0); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[1].map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var vec2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](halfWidth, 0, 0);\r\n var mtrx2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(-Math.PI / 2);\r\n positions = positions.concat(facePositions[2].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx2).add(vec2); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[2].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx2); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var mtrx3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(Math.PI / 2);\r\n positions = positions.concat(facePositions[3].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx3).subtract(vec2); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[3].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx3); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var vec4 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, halfHeight, 0);\r\n var mtrx4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationX(Math.PI / 2);\r\n positions = positions.concat(facePositions[4].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx4).add(vec4); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[4].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx4); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var mtrx5 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationX(-Math.PI / 2);\r\n positions = positions.concat(facePositions[5].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx5).subtract(vec4); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[5].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx5); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TiledBoxBuilder = /** @class */ (function () {\r\n function TiledBoxBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * faceTiles sets the pattern, tile size and number of tiles for a face * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n TiledBoxBuilder.CreateTiledBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var box = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledBox(options);\r\n vertexData.applyToMesh(box, options.updatable);\r\n return box;\r\n };\r\n return TiledBoxBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/tiledPlaneBuilder.ts\":\n/*!**********************************************!*\\\n !*** ./Meshes/Builders/tiledPlaneBuilder.ts ***!\n \\**********************************************/\n/*! exports provided: TiledPlaneBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return TiledPlaneBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateTiledPlane = function (options) {\r\n var flipTile = options.pattern || _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].NO_FLIP;\r\n var tileWidth = options.tileWidth || options.tileSize || 1;\r\n var tileHeight = options.tileHeight || options.tileSize || 1;\r\n var alignH = options.alignHorizontal || 0;\r\n var alignV = options.alignVertical || 0;\r\n var width = options.width || options.size || 1;\r\n var tilesX = Math.floor(width / tileWidth);\r\n var offsetX = width - tilesX * tileWidth;\r\n var height = options.height || options.size || 1;\r\n var tilesY = Math.floor(height / tileHeight);\r\n var offsetY = height - tilesY * tileHeight;\r\n var halfWidth = tileWidth * tilesX / 2;\r\n var halfHeight = tileHeight * tilesY / 2;\r\n var adjustX = 0;\r\n var adjustY = 0;\r\n var startX = 0;\r\n var startY = 0;\r\n var endX = 0;\r\n var endY = 0;\r\n //Part Tiles\r\n if (offsetX > 0 || offsetY > 0) {\r\n startX = -halfWidth;\r\n startY = -halfHeight;\r\n var endX = halfWidth;\r\n var endY = halfHeight;\r\n switch (alignH) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER:\r\n offsetX /= 2;\r\n startX -= offsetX;\r\n endX += offsetX;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].LEFT:\r\n endX += offsetX;\r\n adjustX = -offsetX / 2;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].RIGHT:\r\n startX -= offsetX;\r\n adjustX = offsetX / 2;\r\n break;\r\n }\r\n switch (alignV) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER:\r\n offsetY /= 2;\r\n startY -= offsetY;\r\n endY += offsetY;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].BOTTOM:\r\n endY += offsetY;\r\n adjustY = -offsetY / 2;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].TOP:\r\n startY -= offsetY;\r\n adjustY = offsetY / 2;\r\n break;\r\n }\r\n }\r\n var positions = [];\r\n var normals = [];\r\n var uvBase = [];\r\n uvBase[0] = [0, 0, 1, 0, 1, 1, 0, 1];\r\n uvBase[1] = [0, 0, 1, 0, 1, 1, 0, 1];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBase[1] = [1, 1, 0, 1, 0, 0, 1, 0];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBase[1] = [1, 0, 0, 0, 0, 1, 1, 1];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBase[1] = [0, 1, 1, 1, 1, 0, 0, 0];\r\n }\r\n var uvs = [];\r\n var colors = [];\r\n var indices = [];\r\n var index = 0;\r\n for (var y = 0; y < tilesY; y++) {\r\n for (var x = 0; x < tilesX; x++) {\r\n positions.push(-halfWidth + x * tileWidth + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n positions.push(-halfWidth + x * tileWidth + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBase[(x % 2 + y % 2) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBase[y % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBase[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n index += 4;\r\n }\r\n }\r\n //Part Tiles\r\n if (offsetX > 0 || offsetY > 0) {\r\n var partialBottomRow = (offsetY > 0 && (alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].TOP));\r\n var partialTopRow = (offsetY > 0 && (alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].BOTTOM));\r\n var partialLeftCol = (offsetX > 0 && (alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].RIGHT));\r\n var partialRightCol = (offsetX > 0 && (alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].LEFT));\r\n var uvPart = [];\r\n var a, b, c, d;\r\n //corners\r\n if (partialBottomRow && partialLeftCol) { //bottom left corner\r\n positions.push(startX + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, startY + offsetY + adjustY, 0);\r\n positions.push(startX + adjustX, startY + offsetY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 1 - offsetX / tileWidth;\r\n b = 1 - offsetY / tileHeight;\r\n c = 1;\r\n d = 1;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n if (partialBottomRow && partialRightCol) { //bottom right corner\r\n positions.push(halfWidth + adjustX, startY + adjustY, 0);\r\n positions.push(endX + adjustX, startY + adjustY, 0);\r\n positions.push(endX + adjustX, startY + offsetY + adjustY, 0);\r\n positions.push(halfWidth + adjustX, startY + offsetY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 0,\r\n b = 1 - offsetY / tileHeight;\r\n c = offsetX / tileWidth;\r\n d = 1;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE && (tilesX % 2) === 0)) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE && (tilesX % 2) === 0)) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE && (tilesX % 2) === 0)) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n if (partialTopRow && partialLeftCol) { //top left corner\r\n positions.push(startX + adjustX, halfHeight + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, halfHeight + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, endY + adjustY, 0);\r\n positions.push(startX + adjustX, endY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 1 - offsetX / tileWidth;\r\n b = 0;\r\n c = 1;\r\n d = offsetY / tileHeight;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE && (tilesY % 1) === 0)) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE && (tilesY % 2) === 0)) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE && (tilesY % 2) === 0)) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n if (partialTopRow && partialRightCol) { //top right corner\r\n positions.push(halfWidth + adjustX, halfHeight + adjustY, 0);\r\n positions.push(endX + adjustX, halfHeight + adjustY, 0);\r\n positions.push(endX + adjustX, endY + adjustY, 0);\r\n positions.push(halfWidth + adjustX, endY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 0,\r\n b = 0;\r\n c = offsetX / tileWidth;\r\n d = offsetY / tileHeight;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE && (tilesY + tilesX) % 2 === 1)) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE && (tilesY + tilesX) % 2 === 1)) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE && (tilesY + tilesX) % 2 === 1)) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n //part rows\r\n if (partialBottomRow) {\r\n var uvBaseBR = [];\r\n a = 0;\r\n b = 1 - offsetY / tileHeight;\r\n c = 1;\r\n d = 1;\r\n uvBaseBR[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseBR[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseBR[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseBR[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseBR[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var x = 0; x < tilesX; x++) {\r\n positions.push(-halfWidth + x * tileWidth + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, startY + offsetY + adjustY, 0);\r\n positions.push(-halfWidth + x * tileWidth + adjustX, startY + offsetY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseBR[(x + 1) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseBR[1]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseBR[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n if (partialTopRow) {\r\n var uvBaseTR = [];\r\n a = 0;\r\n b = 0;\r\n c = 1;\r\n d = offsetY / tileHeight;\r\n uvBaseTR[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseTR[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseTR[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseTR[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseTR[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var x = 0; x < tilesX; x++) {\r\n positions.push(-halfWidth + x * tileWidth + adjustX, endY - offsetY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, endY - offsetY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, endY + adjustY, 0);\r\n positions.push(-halfWidth + x * tileWidth + adjustX, endY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseTR[(x + tilesY) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseTR[tilesY % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseTR[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n if (partialLeftCol) {\r\n var uvBaseLC = [];\r\n a = 1 - offsetX / tileWidth;\r\n b = 0;\r\n c = 1;\r\n d = 1;\r\n uvBaseLC[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseLC[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseLC[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseLC[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseLC[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var y = 0; y < tilesY; y++) {\r\n positions.push(startX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(startX + offsetX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(startX + offsetX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n positions.push(startX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseLC[(y + 1) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseLC[y % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseLC[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n if (partialRightCol) {\r\n var uvBaseRC = [];\r\n a = 0;\r\n b = 0;\r\n c = offsetX / tileHeight;\r\n d = 1;\r\n uvBaseRC[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseRC[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseRC[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseRC[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseRC[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var y = 0; y < tilesY; y++) {\r\n positions.push(endX - offsetX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(endX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(endX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n positions.push(endX - offsetX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseRC[(y + tilesX) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseRC[y % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseRC[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n }\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DEFAULTSIDE;\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n return vertexData;\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TiledPlaneBuilder = /** @class */ (function () {\r\n function TiledPlaneBuilder() {\r\n }\r\n /**\r\n * Creates a tiled plane mesh\r\n * * The parameter `pattern` will, depending on value, do nothing or\r\n * * * flip (reflect about central vertical) alternate tiles across and up\r\n * * * flip every tile on alternate rows\r\n * * * rotate (180 degs) alternate tiles across and up\r\n * * * rotate every tile on alternate rows\r\n * * * flip and rotate alternate tiles across and up\r\n * * * flip and rotate every tile on alternate rows\r\n * * The parameter `tileSize` sets the size (float) of each tile side (default 1)\r\n * * You can set some different tile dimensions by using the parameters `tileWidth` and `tileHeight` (both by default have the same value of `tileSize`)\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n TiledPlaneBuilder.CreateTiledPlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var plane = new _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n plane._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateTiledPlane(options);\r\n vertexData.applyToMesh(plane, options.updatable);\r\n return plane;\r\n };\r\n return TiledPlaneBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/torusBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/torusBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: TorusBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return TorusBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorus = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var diameter = options.diameter || 1;\r\n var thickness = options.thickness || 0.5;\r\n var tessellation = options.tessellation || 16;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n var stride = tessellation + 1;\r\n for (var i = 0; i <= tessellation; i++) {\r\n var u = i / tessellation;\r\n var outerAngle = i * Math.PI * 2.0 / tessellation - Math.PI / 2.0;\r\n var transform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(diameter / 2.0, 0, 0).multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(outerAngle));\r\n for (var j = 0; j <= tessellation; j++) {\r\n var v = 1 - j / tessellation;\r\n var innerAngle = j * Math.PI * 2.0 / tessellation + Math.PI;\r\n var dx = Math.cos(innerAngle);\r\n var dy = Math.sin(innerAngle);\r\n // Create a vertex.\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](dx, dy, 0);\r\n var position = normal.scale(thickness / 2);\r\n var textureCoordinate = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](u, v);\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(position, transform);\r\n normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(normal, transform);\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(textureCoordinate.x, textureCoordinate.y);\r\n // And create indices for two triangles.\r\n var nextI = (i + 1) % stride;\r\n var nextJ = (j + 1) % stride;\r\n indices.push(i * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n }\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n var options = {\r\n diameter: diameter,\r\n thickness: thickness,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return TorusBuilder.CreateTorus(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TorusBuilder = /** @class */ (function () {\r\n function TorusBuilder() {\r\n }\r\n /**\r\n * Creates a torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (postive integer, default 16)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus\r\n */\r\n TorusBuilder.CreateTorus = function (name, options, scene) {\r\n var torus = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n torus._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorus(options);\r\n vertexData.applyToMesh(torus, options.updatable);\r\n return torus;\r\n };\r\n return TorusBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/torusKnotBuilder.ts\":\n/*!*********************************************!*\\\n !*** ./Meshes/Builders/torusKnotBuilder.ts ***!\n \\*********************************************/\n/*! exports provided: TorusKnotBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return TorusKnotBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorusKnot = function (options) {\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var radius = options.radius || 2;\r\n var tube = options.tube || 0.5;\r\n var radialSegments = options.radialSegments || 32;\r\n var tubularSegments = options.tubularSegments || 32;\r\n var p = options.p || 2;\r\n var q = options.q || 3;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n // Helper\r\n var getPos = function (angle) {\r\n var cu = Math.cos(angle);\r\n var su = Math.sin(angle);\r\n var quOverP = q / p * angle;\r\n var cs = Math.cos(quOverP);\r\n var tx = radius * (2 + cs) * 0.5 * cu;\r\n var ty = radius * (2 + cs) * su * 0.5;\r\n var tz = radius * Math.sin(quOverP) * 0.5;\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](tx, ty, tz);\r\n };\r\n // Vertices\r\n var i;\r\n var j;\r\n for (i = 0; i <= radialSegments; i++) {\r\n var modI = i % radialSegments;\r\n var u = modI / radialSegments * 2 * p * Math.PI;\r\n var p1 = getPos(u);\r\n var p2 = getPos(u + 0.01);\r\n var tang = p2.subtract(p1);\r\n var n = p2.add(p1);\r\n var bitan = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(tang, n);\r\n n = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(bitan, tang);\r\n bitan.normalize();\r\n n.normalize();\r\n for (j = 0; j < tubularSegments; j++) {\r\n var modJ = j % tubularSegments;\r\n var v = modJ / tubularSegments * 2 * Math.PI;\r\n var cx = -tube * Math.cos(v);\r\n var cy = tube * Math.sin(v);\r\n positions.push(p1.x + cx * n.x + cy * bitan.x);\r\n positions.push(p1.y + cx * n.y + cy * bitan.y);\r\n positions.push(p1.z + cx * n.z + cy * bitan.z);\r\n uvs.push(i / radialSegments);\r\n uvs.push(j / tubularSegments);\r\n }\r\n }\r\n for (i = 0; i < radialSegments; i++) {\r\n for (j = 0; j < tubularSegments; j++) {\r\n var jNext = (j + 1) % tubularSegments;\r\n var a = i * tubularSegments + j;\r\n var b = (i + 1) * tubularSegments + j;\r\n var c = (i + 1) * tubularSegments + jNext;\r\n var d = i * tubularSegments + jNext;\r\n indices.push(d);\r\n indices.push(b);\r\n indices.push(a);\r\n indices.push(d);\r\n indices.push(c);\r\n indices.push(b);\r\n }\r\n }\r\n // Normals\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorusKnot = function (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\r\n var options = {\r\n radius: radius,\r\n tube: tube,\r\n radialSegments: radialSegments,\r\n tubularSegments: tubularSegments,\r\n p: p,\r\n q: q,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return TorusKnotBuilder.CreateTorusKnot(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TorusKnotBuilder = /** @class */ (function () {\r\n function TorusKnotBuilder() {\r\n }\r\n /**\r\n * Creates a torus knot mesh\r\n * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)\r\n * * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32)\r\n * * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus knot mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus-knot\r\n */\r\n TorusKnotBuilder.CreateTorusKnot = function (name, options, scene) {\r\n var torusKnot = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n torusKnot._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorusKnot(options);\r\n vertexData.applyToMesh(torusKnot, options.updatable);\r\n return torusKnot;\r\n };\r\n return TorusKnotBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/tubeBuilder.ts\":\n/*!****************************************!*\\\n !*** ./Meshes/Builders/tubeBuilder.ts ***!\n \\****************************************/\n/*! exports provided: TubeBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return TubeBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\r\n var options = {\r\n path: path,\r\n radius: radius,\r\n tessellation: tessellation,\r\n radiusFunction: radiusFunction,\r\n arc: 1,\r\n cap: cap,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance\r\n };\r\n return TubeBuilder.CreateTube(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TubeBuilder = /** @class */ (function () {\r\n function TubeBuilder() {\r\n }\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * * The parameter `radius` (positive float, default 1) sets the tube radius size\r\n * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface\r\n * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`\r\n * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)\r\n * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#tube\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tube mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tube\r\n */\r\n TubeBuilder.CreateTube = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var path = options.path;\r\n var instance = options.instance;\r\n var radius = 1.0;\r\n if (options.radius !== undefined) {\r\n radius = options.radius;\r\n }\r\n else if (instance) {\r\n radius = instance._creationDataStorage.radius;\r\n }\r\n var tessellation = options.tessellation || 64 | 0;\r\n var radiusFunction = options.radiusFunction || null;\r\n var cap = options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var invertUV = options.invertUV || false;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n options.arc = options.arc && (options.arc <= 0.0 || options.arc > 1.0) ? 1.0 : options.arc || 1.0;\r\n // tube geometry\r\n var tubePathArray = function (path, path3D, circlePaths, radius, tessellation, radiusFunction, cap, arc) {\r\n var tangents = path3D.getTangents();\r\n var normals = path3D.getNormals();\r\n var distances = path3D.getDistances();\r\n var pi2 = Math.PI * 2;\r\n var step = pi2 / tessellation * arc;\r\n var returnRadius = function () { return radius; };\r\n var radiusFunctionFinal = radiusFunction || returnRadius;\r\n var circlePath;\r\n var rad;\r\n var normal;\r\n var rotated;\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var index = (cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP || cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END) ? 0 : 2;\r\n for (var i = 0; i < path.length; i++) {\r\n rad = radiusFunctionFinal(i, distances[i]); // current radius\r\n circlePath = Array(); // current circle array\r\n normal = normals[i]; // current normal\r\n for (var t = 0; t < tessellation; t++) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(tangents[i], step * t, rotationMatrix);\r\n rotated = circlePath[t] ? circlePath[t] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(normal, rotationMatrix, rotated);\r\n rotated.scaleInPlace(rad).addInPlace(path[i]);\r\n circlePath[t] = rotated;\r\n }\r\n circlePaths[index] = circlePath;\r\n index++;\r\n }\r\n // cap\r\n var capPath = function (nbPoints, pathIndex) {\r\n var pointCap = Array();\r\n for (var i = 0; i < nbPoints; i++) {\r\n pointCap.push(path[pathIndex]);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP:\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_START:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END:\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n default:\r\n break;\r\n }\r\n return circlePaths;\r\n };\r\n var path3D;\r\n var pathArray;\r\n if (instance) { // tube update\r\n var storage = instance._creationDataStorage;\r\n var arc = options.arc || storage.arc;\r\n path3D = storage.path3D.update(path);\r\n pathArray = tubePathArray(path, path3D, storage.pathArray, radius, storage.tessellation, radiusFunction, storage.cap, arc);\r\n instance = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(\"\", { pathArray: pathArray, instance: instance });\r\n // Update mode, no need to recreate the storage.\r\n storage.path3D = path3D;\r\n storage.pathArray = pathArray;\r\n storage.arc = arc;\r\n storage.radius = radius;\r\n return instance;\r\n }\r\n // tube creation\r\n path3D = new _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__[\"Path3D\"](path);\r\n var newPathArray = new Array();\r\n cap = (cap < 0 || cap > 3) ? 0 : cap;\r\n pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);\r\n var tube = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(name, { pathArray: pathArray, closePath: true, closeArray: false, updatable: updatable, sideOrientation: sideOrientation, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);\r\n tube._creationDataStorage.pathArray = pathArray;\r\n tube._creationDataStorage.path3D = path3D;\r\n tube._creationDataStorage.tessellation = tessellation;\r\n tube._creationDataStorage.cap = cap;\r\n tube._creationDataStorage.arc = options.arc;\r\n tube._creationDataStorage.radius = radius;\r\n return tube;\r\n };\r\n return TubeBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Compression/dracoCompression.ts\":\n/*!************************************************!*\\\n !*** ./Meshes/Compression/dracoCompression.ts ***!\n \\************************************************/\n/*! exports provided: DracoCompression */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return DracoCompression; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_workerPool__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/workerPool */ \"./Misc/workerPool.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\nfunction loadScriptAsync(url) {\r\n if (typeof importScripts === \"function\") {\r\n importScripts(url);\r\n return Promise.resolve();\r\n }\r\n else {\r\n return new Promise(function (resolve, reject) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadScript(url, function () {\r\n resolve();\r\n }, function (message) {\r\n reject(new Error(message));\r\n });\r\n });\r\n }\r\n}\r\nfunction loadFileAsync(url) {\r\n return new Promise(function (resolve, reject) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, undefined, true, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n}\r\nfunction createDecoderAsync(wasmUrl, wasmBinary, fallbackUrl) {\r\n var decoderUrl = (wasmBinary && wasmUrl) || fallbackUrl;\r\n if (decoderUrl) {\r\n return loadScriptAsync(decoderUrl).then(function () {\r\n return new Promise(function (resolve) {\r\n DracoDecoderModule({ wasmBinary: wasmBinary }).then(function (module) {\r\n resolve({ module: module });\r\n });\r\n });\r\n });\r\n }\r\n return undefined;\r\n}\r\nfunction decodeMesh(decoderModule, dataView, attributes, onIndicesData, onAttributeData) {\r\n var buffer = new decoderModule.DecoderBuffer();\r\n buffer.Init(dataView, dataView.byteLength);\r\n var decoder = new decoderModule.Decoder();\r\n var geometry;\r\n var status;\r\n try {\r\n var type = decoder.GetEncodedGeometryType(buffer);\r\n switch (type) {\r\n case decoderModule.TRIANGULAR_MESH:\r\n geometry = new decoderModule.Mesh();\r\n status = decoder.DecodeBufferToMesh(buffer, geometry);\r\n break;\r\n case decoderModule.POINT_CLOUD:\r\n geometry = new decoderModule.PointCloud();\r\n status = decoder.DecodeBufferToPointCloud(buffer, geometry);\r\n break;\r\n default:\r\n throw new Error(\"Invalid geometry type \" + type);\r\n }\r\n if (!status.ok() || !geometry.ptr) {\r\n throw new Error(status.error_msg());\r\n }\r\n var numPoints_1 = geometry.num_points();\r\n if (type === decoderModule.TRIANGULAR_MESH) {\r\n var numFaces = geometry.num_faces();\r\n var faceIndices = new decoderModule.DracoInt32Array();\r\n try {\r\n var indices = new Uint32Array(numFaces * 3);\r\n for (var i = 0; i < numFaces; i++) {\r\n decoder.GetFaceFromMesh(geometry, i, faceIndices);\r\n var offset = i * 3;\r\n indices[offset + 0] = faceIndices.GetValue(0);\r\n indices[offset + 1] = faceIndices.GetValue(1);\r\n indices[offset + 2] = faceIndices.GetValue(2);\r\n }\r\n onIndicesData(indices);\r\n }\r\n finally {\r\n decoderModule.destroy(faceIndices);\r\n }\r\n }\r\n var processAttribute = function (kind, attribute) {\r\n var dracoData = new decoderModule.DracoFloat32Array();\r\n try {\r\n decoder.GetAttributeFloatForAllPoints(geometry, attribute, dracoData);\r\n var babylonData = new Float32Array(numPoints_1 * attribute.num_components());\r\n for (var i = 0; i < babylonData.length; i++) {\r\n babylonData[i] = dracoData.GetValue(i);\r\n }\r\n onAttributeData(kind, babylonData);\r\n }\r\n finally {\r\n decoderModule.destroy(dracoData);\r\n }\r\n };\r\n if (attributes) {\r\n for (var kind in attributes) {\r\n var id = attributes[kind];\r\n var attribute = decoder.GetAttributeByUniqueId(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n else {\r\n var nativeAttributeTypes = {\r\n \"position\": \"POSITION\",\r\n \"normal\": \"NORMAL\",\r\n \"color\": \"COLOR\",\r\n \"uv\": \"TEX_COORD\"\r\n };\r\n for (var kind in nativeAttributeTypes) {\r\n var id = decoder.GetAttributeId(geometry, decoderModule[nativeAttributeTypes[kind]]);\r\n if (id !== -1) {\r\n var attribute = decoder.GetAttribute(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n if (geometry) {\r\n decoderModule.destroy(geometry);\r\n }\r\n decoderModule.destroy(decoder);\r\n decoderModule.destroy(buffer);\r\n }\r\n}\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction worker() {\r\n var decoderPromise;\r\n onmessage = function (event) {\r\n var data = event.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n var decoder = data.decoder;\r\n decoderPromise = createDecoderAsync(decoder.wasmUrl, decoder.wasmBinary, decoder.fallbackUrl);\r\n postMessage(\"done\");\r\n break;\r\n }\r\n case \"decodeMesh\": {\r\n if (!decoderPromise) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n decoderPromise.then(function (decoder) {\r\n decodeMesh(decoder.module, data.dataView, data.attributes, function (indices) {\r\n postMessage({ id: \"indices\", value: indices }, [indices.buffer]);\r\n }, function (kind, data) {\r\n postMessage({ id: kind, value: data }, [data.buffer]);\r\n });\r\n postMessage(\"done\");\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n}\r\nfunction getAbsoluteUrl(url) {\r\n if (typeof document !== \"object\" || typeof url !== \"string\") {\r\n return url;\r\n }\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetAbsoluteUrl(url);\r\n}\r\n/**\r\n * Draco compression (https://google.github.io/draco/)\r\n *\r\n * This class wraps the Draco module.\r\n *\r\n * **Encoder**\r\n *\r\n * The encoder is not currently implemented.\r\n *\r\n * **Decoder**\r\n *\r\n * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js.\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * DracoCompression.Configuration = {\r\n * decoder: {\r\n * wasmUrl: \"\",\r\n * wasmBinaryUrl: \"\",\r\n * fallbackUrl: \"\",\r\n * }\r\n * };\r\n * ```\r\n *\r\n * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version.\r\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\r\n * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context.\r\n *\r\n * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshAsync:\r\n * ```javascript\r\n * var vertexData = await DracoCompression.Default.decodeMeshAsync(data);\r\n * ```\r\n *\r\n * @see https://www.babylonjs-playground.com/#N3EK4B#0\r\n */\r\nvar DracoCompression = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\r\n */\r\n function DracoCompression(numWorkers) {\r\n if (numWorkers === void 0) { numWorkers = DracoCompression.DefaultNumWorkers; }\r\n var decoder = DracoCompression.Configuration.decoder;\r\n var decoderWasmBinaryPromise = (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\")\r\n ? loadFileAsync(getAbsoluteUrl(decoder.wasmBinaryUrl))\r\n : Promise.resolve(undefined);\r\n if (numWorkers && typeof Worker === \"function\") {\r\n this._workerPoolPromise = decoderWasmBinaryPromise.then(function (decoderWasmBinary) {\r\n var workerContent = \"\" + loadScriptAsync + createDecoderAsync + decodeMesh + \"(\" + worker + \")()\";\r\n var workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n var workerPromises = new Array(numWorkers);\r\n for (var i = 0; i < workerPromises.length; i++) {\r\n workerPromises[i] = new Promise(function (resolve, reject) {\r\n var worker = new Worker(workerBlobUrl);\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(worker);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n worker.postMessage({\r\n id: \"init\",\r\n decoder: {\r\n wasmUrl: getAbsoluteUrl(decoder.wasmUrl),\r\n wasmBinary: decoderWasmBinary,\r\n fallbackUrl: getAbsoluteUrl(decoder.fallbackUrl)\r\n }\r\n });\r\n });\r\n }\r\n return Promise.all(workerPromises).then(function (workers) {\r\n return new _Misc_workerPool__WEBPACK_IMPORTED_MODULE_1__[\"WorkerPool\"](workers);\r\n });\r\n });\r\n }\r\n else {\r\n this._decoderModulePromise = decoderWasmBinaryPromise.then(function (decoderWasmBinary) {\r\n return createDecoderAsync(decoder.wasmUrl, decoderWasmBinary, decoder.fallbackUrl);\r\n });\r\n }\r\n }\r\n Object.defineProperty(DracoCompression, \"DecoderAvailable\", {\r\n /**\r\n * Returns true if the decoder configuration is available.\r\n */\r\n get: function () {\r\n var decoder = DracoCompression.Configuration.decoder;\r\n return !!((decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") || decoder.fallbackUrl);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DracoCompression.GetDefaultNumWorkers = function () {\r\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\r\n return 1;\r\n }\r\n // Use 50% of the available logical processors but capped at 4.\r\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\r\n };\r\n Object.defineProperty(DracoCompression, \"Default\", {\r\n /**\r\n * Default instance for the draco compression object.\r\n */\r\n get: function () {\r\n if (!DracoCompression._Default) {\r\n DracoCompression._Default = new DracoCompression();\r\n }\r\n return DracoCompression._Default;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stop all async operations and release resources.\r\n */\r\n DracoCompression.prototype.dispose = function () {\r\n if (this._workerPoolPromise) {\r\n this._workerPoolPromise.then(function (workerPool) {\r\n workerPool.dispose();\r\n });\r\n }\r\n delete this._workerPoolPromise;\r\n delete this._decoderModulePromise;\r\n };\r\n /**\r\n * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use.\r\n * @returns a promise that resolves when ready\r\n */\r\n DracoCompression.prototype.whenReadyAsync = function () {\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function () { });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function () { });\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Decode Draco compressed mesh data to vertex data.\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded vertex data\r\n */\r\n DracoCompression.prototype.decodeMeshAsync = function (data, attributes) {\r\n var dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function (workerPool) {\r\n return new Promise(function (resolve, reject) {\r\n workerPool.push(function (worker, onComplete) {\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n onComplete();\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(vertexData);\r\n onComplete();\r\n }\r\n else if (message.data.id === \"indices\") {\r\n vertexData.indices = message.data.value;\r\n }\r\n else {\r\n vertexData.set(message.data.value, message.data.id);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n var dataViewCopy = new Uint8Array(dataView.byteLength);\r\n dataViewCopy.set(new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength));\r\n worker.postMessage({ id: \"decodeMesh\", dataView: dataViewCopy, attributes: attributes }, [dataViewCopy.buffer]);\r\n });\r\n });\r\n });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function (decoder) {\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n decodeMesh(decoder.module, dataView, attributes, function (indices) {\r\n vertexData.indices = indices;\r\n }, function (kind, data) {\r\n vertexData.set(data, kind);\r\n });\r\n return vertexData;\r\n });\r\n }\r\n throw new Error(\"Draco decoder module is not available\");\r\n };\r\n /**\r\n * The configuration. Defaults to the following urls:\r\n * - wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\"\r\n * - wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\"\r\n * - fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n */\r\n DracoCompression.Configuration = {\r\n decoder: {\r\n wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\",\r\n wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\",\r\n fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n }\r\n };\r\n /**\r\n * Default number of workers to create when creating the draco compression object.\r\n */\r\n DracoCompression.DefaultNumWorkers = DracoCompression.GetDefaultNumWorkers();\r\n DracoCompression._Default = null;\r\n return DracoCompression;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Compression/index.ts\":\n/*!*************************************!*\\\n !*** ./Meshes/Compression/index.ts ***!\n \\*************************************/\n/*! exports provided: DracoCompression */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _dracoCompression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dracoCompression */ \"./Meshes/Compression/dracoCompression.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _dracoCompression__WEBPACK_IMPORTED_MODULE_0__[\"DracoCompression\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/WebGL/webGLDataBuffer.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/WebGL/webGLDataBuffer.ts ***!\n \\*****************************************/\n/*! exports provided: WebGLDataBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return WebGLDataBuffer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _dataBuffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dataBuffer */ \"./Meshes/dataBuffer.ts\");\n\r\n\r\n/** @hidden */\r\nvar WebGLDataBuffer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebGLDataBuffer, _super);\r\n function WebGLDataBuffer(resource) {\r\n var _this = _super.call(this) || this;\r\n _this._buffer = resource;\r\n return _this;\r\n }\r\n Object.defineProperty(WebGLDataBuffer.prototype, \"underlyingResource\", {\r\n get: function () {\r\n return this._buffer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return WebGLDataBuffer;\r\n}(_dataBuffer__WEBPACK_IMPORTED_MODULE_1__[\"DataBuffer\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/abstractMesh.ts\":\n/*!********************************!*\\\n !*** ./Meshes/abstractMesh.ts ***!\n \\********************************/\n/*! exports provided: AbstractMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return AbstractMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Collisions_meshCollisionData__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Collisions/meshCollisionData */ \"./Collisions/meshCollisionData.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_functions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Maths/math.functions */ \"./Maths/math.functions.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _FacetDataStorage = /** @class */ (function () {\r\n function _FacetDataStorage() {\r\n this.facetNb = 0; // facet number\r\n this.partitioningSubdivisions = 10; // number of subdivisions per axis in the partioning space\r\n this.partitioningBBoxRatio = 1.01; // the partioning array space is by default 1% bigger than the bounding box\r\n this.facetDataEnabled = false; // is the facet data feature enabled on this mesh ?\r\n this.facetParameters = {}; // keep a reference to the object parameters to avoid memory re-allocation\r\n this.bbSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(); // bbox size approximated for facet data\r\n this.subDiv = {\r\n max: 1,\r\n X: 1,\r\n Y: 1,\r\n Z: 1\r\n };\r\n this.facetDepthSort = false; // is the facet depth sort to be computed\r\n this.facetDepthSortEnabled = false; // is the facet depth sort initialized\r\n }\r\n return _FacetDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalAbstractMeshDataInfo = /** @class */ (function () {\r\n function _InternalAbstractMeshDataInfo() {\r\n this._hasVertexAlpha = false;\r\n this._useVertexColors = true;\r\n this._numBoneInfluencers = 4;\r\n this._applyFog = true;\r\n this._receiveShadows = false;\r\n this._facetData = new _FacetDataStorage();\r\n this._visibility = 1.0;\r\n this._skeleton = null;\r\n this._layerMask = 0x0FFFFFFF;\r\n this._computeBonesUsingShaders = true;\r\n this._isActive = false;\r\n this._onlyForInstances = false;\r\n this._isActiveIntermediate = false;\r\n this._onlyForInstancesIntermediate = false;\r\n }\r\n return _InternalAbstractMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to store all common mesh properties\r\n */\r\nvar AbstractMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AbstractMesh, _super);\r\n // Constructor\r\n /**\r\n * Creates a new AbstractMesh\r\n * @param name defines the name of the mesh\r\n * @param scene defines the hosting scene\r\n */\r\n function AbstractMesh(name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var _this = _super.call(this, name, scene, false) || this;\r\n // Internal data\r\n /** @hidden */\r\n _this._internalAbstractMeshDataInfo = new _InternalAbstractMeshDataInfo();\r\n /**\r\n * The culling strategy to use to check whether the mesh must be rendered or not.\r\n * This value can be changed at any time and will be used on the next render mesh selection.\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * Please read each static variable documentation to get details about the culling process.\r\n * */\r\n _this.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_STANDARD;\r\n // Events\r\n /**\r\n * An event triggered when this mesh collides with another one\r\n */\r\n _this.onCollideObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * An event triggered when the collision's position changes\r\n */\r\n _this.onCollisionPositionChangeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * An event triggered when material is changed\r\n */\r\n _this.onMaterialChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n // Properties\r\n /**\r\n * Gets or sets the orientation for POV movement & rotation\r\n */\r\n _this.definedFacingForward = true;\r\n /** @hidden */\r\n _this._occlusionQuery = null;\r\n /** @hidden */\r\n _this._renderingGroup = null;\r\n /** Gets or sets the alpha index used to sort transparent meshes\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index\r\n */\r\n _this.alphaIndex = Number.MAX_VALUE;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true\r\n */\r\n _this.isVisible = true;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true\r\n */\r\n _this.isPickable = true;\r\n /** Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default) */\r\n _this.showSubMeshesBoundingBox = false;\r\n /** Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\n _this.isBlocker = false;\r\n /**\r\n * Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)\r\n */\r\n _this.enablePointerMoveEvents = false;\r\n /**\r\n * Specifies the rendering group id for this mesh (0 by default)\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#rendering-groups\r\n */\r\n _this.renderingGroupId = 0;\r\n _this._material = null;\r\n /** Defines color to use when rendering outline */\r\n _this.outlineColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"].Red();\r\n /** Define width to use when rendering outline */\r\n _this.outlineWidth = 0.02;\r\n /** Defines color to use when rendering overlay */\r\n _this.overlayColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"].Red();\r\n /** Defines alpha to use when rendering overlay */\r\n _this.overlayAlpha = 0.5;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default) */\r\n _this.useOctreeForRenderingSelection = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default) */\r\n _this.useOctreeForPicking = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default) */\r\n _this.useOctreeForCollisions = true;\r\n /**\r\n * True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)\r\n */\r\n _this.alwaysSelectAsActiveMesh = false;\r\n /**\r\n * Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)\r\n */\r\n _this.doNotSyncBoundingInfo = false;\r\n /**\r\n * Gets or sets the current action manager\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\n _this.actionManager = null;\r\n // Collisions\r\n _this._meshCollisionData = new _Collisions_meshCollisionData__WEBPACK_IMPORTED_MODULE_11__[\"_MeshCollisionData\"]();\r\n /**\r\n * Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoid = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0.5, 1, 0.5);\r\n /**\r\n * Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoidOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n // Edges\r\n /**\r\n * Defines edge width used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesWidth = 1;\r\n /**\r\n * Defines edge color used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color4\"](1, 0, 0, 1);\r\n /** @hidden */\r\n _this._edgesRenderer = null;\r\n /** @hidden */\r\n _this._masterMesh = null;\r\n /** @hidden */\r\n _this._boundingInfo = null;\r\n /** @hidden */\r\n _this._renderId = 0;\r\n /** @hidden */\r\n _this._intersectionsInProgress = new Array();\r\n /** @hidden */\r\n _this._unIndexed = false;\r\n /** @hidden */\r\n _this._lightSources = new Array();\r\n // Loading properties\r\n /** @hidden */\r\n _this._waitingData = {\r\n lods: null,\r\n actions: null,\r\n freezeWorldMatrix: null\r\n };\r\n /** @hidden */\r\n _this._bonesTransformMatrices = null;\r\n /** @hidden */\r\n _this._transformMatrixTexture = null;\r\n /**\r\n * An event triggered when the mesh is rebuilt.\r\n */\r\n _this.onRebuildObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n newPosition.subtractToRef(_this._meshCollisionData._oldPositionForCollisions, _this._meshCollisionData._diffPositionForCollisions);\r\n if (_this._meshCollisionData._diffPositionForCollisions.length() > _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._meshCollisionData._diffPositionForCollisions);\r\n }\r\n if (collidedMesh) {\r\n _this.onCollideObservable.notifyObservers(collidedMesh);\r\n }\r\n _this.onCollisionPositionChangeObservable.notifyObservers(_this.position);\r\n };\r\n _this.getScene().addMesh(_this);\r\n _this._resyncLightSources();\r\n return _this;\r\n }\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_NONE\", {\r\n /**\r\n * No billboard\r\n */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_NONE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_X\", {\r\n /** Billboard on X axis */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_X;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Y\", {\r\n /** Billboard on Y axis */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_Y;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Z\", {\r\n /** Billboard on Z axis */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_Z;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_ALL\", {\r\n /** Billboard on all axes */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_ALL;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_USE_POSITION\", {\r\n /** Billboard on using position instead of orientation */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_USE_POSITION;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetNb\", {\r\n /**\r\n * Gets the number of facets in the mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetNb;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningSubdivisions\", {\r\n /**\r\n * Gets or set the number (integer) of subdivisions per axis in the partioning space\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions;\r\n },\r\n set: function (nb) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = nb;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningBBoxRatio\", {\r\n /**\r\n * The ratio (float) to apply to the bouding box size to set to the partioning space.\r\n * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio;\r\n },\r\n set: function (ratio) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = ratio;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"mustDepthSortFacets\", {\r\n /**\r\n * Gets or sets a boolean indicating that the facets must be depth sorted on next call to `updateFacetData()`.\r\n * Works only for updatable meshes.\r\n * Doesn't work with multi-materials\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSort;\r\n },\r\n set: function (sort) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSort = sort;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetDepthSortFrom\", {\r\n /**\r\n * The location (Vector3) where the facet depth sort must be computed from.\r\n * By default, the active camera position.\r\n * Used only when facet depth sort is enabled\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom;\r\n },\r\n set: function (location) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = location;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isFacetDataEnabled\", {\r\n /**\r\n * gets a boolean indicating if facetData is enabled\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._updateNonUniformScalingState = function (value) {\r\n if (!_super.prototype._updateNonUniformScalingState.call(this, value)) {\r\n return false;\r\n }\r\n this._markSubMeshesAsMiscDirty();\r\n return true;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollide\", {\r\n /** Set a function to call when this mesh collides with another one */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollideObserver) {\r\n this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver);\r\n }\r\n this._meshCollisionData._onCollideObserver = this.onCollideObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollisionPositionChange\", {\r\n /** Set a function to call when the collision's position changes */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollisionPositionChangeObserver) {\r\n this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver);\r\n }\r\n this._meshCollisionData._onCollisionPositionChangeObserver = this.onCollisionPositionChangeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"visibility\", {\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._visibility;\r\n },\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._visibility === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._visibility = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"material\", {\r\n /** Gets or sets current material */\r\n get: function () {\r\n return this._material;\r\n },\r\n set: function (value) {\r\n if (this._material === value) {\r\n return;\r\n }\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n this._material = value;\r\n if (value && value.meshMap) {\r\n value.meshMap[this.uniqueId] = this;\r\n }\r\n if (this.onMaterialChangedObservable.hasObservers) {\r\n this.onMaterialChangedObservable.notifyObservers(this);\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n this._unBindEffect();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"receiveShadows\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can receive realtime shadows\r\n * @see http://doc.babylonjs.com/babylon101/shadows\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._receiveShadows;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._receiveShadows === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._receiveShadows = value;\r\n this._markSubMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasVertexAlpha\", {\r\n /** Gets or sets a boolean indicating that this mesh contains vertex color data with alpha values */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._hasVertexAlpha;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._hasVertexAlpha === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._hasVertexAlpha = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"useVertexColors\", {\r\n /** Gets or sets a boolean indicating that this mesh needs to use vertex color data to render (if this kind of vertex data is available in the geometry) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._useVertexColors;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._useVertexColors === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._useVertexColors = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"computeBonesUsingShaders\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone animations must be computed by the CPU (false by default)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"numBoneInfluencers\", {\r\n /** Gets or sets the number of allowed bone influences per vertex (4 by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._numBoneInfluencers;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._numBoneInfluencers === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._numBoneInfluencers = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"applyFog\", {\r\n /** Gets or sets a boolean indicating that this mesh will allow fog to be rendered on it (true by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._applyFog;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._applyFog === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._applyFog = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"layerMask\", {\r\n /**\r\n * Gets or sets the current layer mask (default is 0x0FFFFFFF)\r\n * @see http://doc.babylonjs.com/how_to/layermasks_and_multi-cam_textures\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._layerMask;\r\n },\r\n set: function (value) {\r\n if (value === this._internalAbstractMeshDataInfo._layerMask) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._layerMask = value;\r\n this._resyncLightSources();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionMask\", {\r\n /**\r\n * Gets or sets a collision mask used to mask collisions (default is -1).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionGroup\", {\r\n /**\r\n * Gets or sets the current collision group mask (-1 by default).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionGroup;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionGroup = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._lightSources;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"_positions\", {\r\n /** @hidden */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"skeleton\", {\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._skeleton;\r\n },\r\n /**\r\n * Gets or sets a skeleton to apply skining transformations\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\n set: function (value) {\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton && skeleton.needInitialSkinMatrix) {\r\n skeleton._unregisterMeshWithPoseMatrix(this);\r\n }\r\n if (value && value.needInitialSkinMatrix) {\r\n value._registerMeshWithPoseMatrix(this);\r\n }\r\n this._internalAbstractMeshDataInfo._skeleton = value;\r\n if (!this._internalAbstractMeshDataInfo._skeleton) {\r\n this._bonesTransformMatrices = null;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"AbstractMesh\"\r\n * @returns \"AbstractMesh\"\r\n */\r\n AbstractMesh.prototype.getClassName = function () {\r\n return \"AbstractMesh\";\r\n };\r\n /**\r\n * Gets a string representation of the current mesh\r\n * @param fullDetails defines a boolean indicating if full details must be included\r\n * @returns a string representation of the current mesh\r\n */\r\n AbstractMesh.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", isInstance: \" + (this.getClassName() !== \"InstancedMesh\" ? \"YES\" : \"NO\");\r\n ret += \", # of submeshes: \" + (this.subMeshes ? this.subMeshes.length : 0);\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton) {\r\n ret += \", skeleton: \" + skeleton.name;\r\n }\r\n if (fullDetails) {\r\n ret += \", billboard mode: \" + ([\"NONE\", \"X\", \"Y\", null, \"Z\", null, null, \"ALL\"])[this.billboardMode];\r\n ret += \", freeze wrld mat: \" + (this._isWorldMatrixFrozen || this._waitingData.freezeWorldMatrix ? \"YES\" : \"NO\");\r\n }\r\n return ret;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n AbstractMesh.prototype._getEffectiveParent = function () {\r\n if (this._masterMesh && this.billboardMode !== _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_NONE) {\r\n return this._masterMesh;\r\n }\r\n return _super.prototype._getEffectiveParent.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getActionManagerForTrigger = function (trigger, initialCall) {\r\n if (initialCall === void 0) { initialCall = true; }\r\n if (this.actionManager && (initialCall || this.actionManager.isRecursive)) {\r\n if (trigger) {\r\n if (this.actionManager.hasSpecificTrigger(trigger)) {\r\n return this.actionManager;\r\n }\r\n }\r\n else {\r\n return this.actionManager;\r\n }\r\n }\r\n if (!this.parent) {\r\n return null;\r\n }\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._rebuild = function () {\r\n this.onRebuildObservable.notifyObservers(this);\r\n if (this._occlusionQuery) {\r\n this._occlusionQuery = null;\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh._rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLightSources = function () {\r\n this._lightSources.length = 0;\r\n for (var _i = 0, _a = this.getScene().lights; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n if (!light.isEnabled()) {\r\n continue;\r\n }\r\n if (light.canAffectMesh(this)) {\r\n this._lightSources.push(light);\r\n }\r\n }\r\n this._markSubMeshesAsLightDirty();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLighSource = function (light) {\r\n var isIn = light.isEnabled() && light.canAffectMesh(this);\r\n var index = this._lightSources.indexOf(light);\r\n if (index === -1) {\r\n if (!isIn) {\r\n return;\r\n }\r\n this._lightSources.push(light);\r\n }\r\n else {\r\n if (isIn) {\r\n return;\r\n }\r\n this._lightSources.splice(index, 1);\r\n }\r\n this._markSubMeshesAsLightDirty();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unBindEffect = function () {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh.setEffect(null);\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._removeLightSource = function (light, dispose) {\r\n var index = this._lightSources.indexOf(light);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._lightSources.splice(index, 1);\r\n this._markSubMeshesAsLightDirty(dispose);\r\n };\r\n AbstractMesh.prototype._markSubMeshesAsDirty = function (func) {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n if (subMesh._materialDefines) {\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsLightDirty = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(dispose); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsAttributesDirty = function () {\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsAttributesDirty(); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsMiscDirty = function () {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var material = subMesh.getMaterial();\r\n if (material) {\r\n material.markAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n }\r\n }\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets a Vector3 depicting the mesh scaling along each local axis X, Y, Z. Default is (1.0, 1.0, 1.0)\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isBlocked\", {\r\n // Methods\r\n /**\r\n * Returns true if the mesh is blocked. Implemented by child classes\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the mesh itself by default. Implemented by child classes\r\n * @param camera defines the camera to use to pick the right LOD level\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.getLOD = function (camera) {\r\n return this;\r\n };\r\n /**\r\n * Returns 0 by default. Implemented by child classes\r\n * @returns an integer\r\n */\r\n AbstractMesh.prototype.getTotalVertices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n AbstractMesh.prototype.getTotalIndices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns null by default. Implemented by child classes\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getIndices = function () {\r\n return null;\r\n };\r\n /**\r\n * Returns the array of the requested vertex data kind. Implemented by child classes\r\n * @param kind defines the vertex data kind to use\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getVerticesData = function (kind) {\r\n return null;\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the data must be flagged as updatable (or static)\r\n * @param stride defines the vertex stride (size of an entire vertex). Can be null and in this case will be deduced from vertex data kind\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n return this;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends If `kind` is `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed\r\n * @param makeItUnique If true, a new global geometry is created from this data and is set to the mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh indices,\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * @param indices Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)\r\n * @param totalVertices Defines the total number of vertices\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setIndices = function (indices, totalVertices) {\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex data is present\r\n * @param kind defines the vertex data kind to use\r\n * @returns true is data kind is present\r\n */\r\n AbstractMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return false;\r\n };\r\n /**\r\n * Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined.\r\n * Note that it returns a shallow bounding of the mesh (i.e. it does not include children).\r\n * To get the full bounding of all children, call `getHierarchyBoundingVectors` instead.\r\n * @returns a BoundingInfo\r\n */\r\n AbstractMesh.prototype.getBoundingInfo = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh.getBoundingInfo();\r\n }\r\n if (!this._boundingInfo) {\r\n // this._boundingInfo is being created here\r\n this._updateBoundingInfo();\r\n }\r\n // cannot be null.\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n return _super.prototype.normalizeToUnitCube.call(this, includeDescendants, ignoreRotation, predicate);\r\n };\r\n /**\r\n * Overwrite the current bounding info\r\n * @param boundingInfo defines the new bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"useBones\", {\r\n /** Gets a boolean indicating if this mesh has skinning data and an attached skeleton */\r\n get: function () {\r\n return (this.skeleton && this.getScene().skeletonsEnabled && this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesIndicesKind) && this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesWeightsKind));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivate = function () {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n this._renderId = renderId;\r\n return true;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._postActivate = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._freeze = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unFreeze = function () {\r\n // Do nothing\r\n };\r\n /**\r\n * Gets the current world matrix\r\n * @returns a Matrix\r\n */\r\n AbstractMesh.prototype.getWorldMatrix = function () {\r\n if (this._masterMesh && this.billboardMode === _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_NONE) {\r\n return this._masterMesh.getWorldMatrix();\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getWorldMatrixDeterminant = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh._getWorldMatrixDeterminant();\r\n }\r\n return _super.prototype._getWorldMatrixDeterminant.call(this);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"isAnInstance\", {\r\n /**\r\n * Gets a boolean indicating if this mesh is an instance or a regular mesh\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasInstances\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has instances\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // ================================== Point of View Movement =================================\r\n /**\r\n * Perform relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.movePOV = function (amountRight, amountUp, amountForward) {\r\n this.position.addInPlace(this.calcMovePOV(amountRight, amountUp, amountForward));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the new displacement vector\r\n */\r\n AbstractMesh.prototype.calcMovePOV = function (amountRight, amountUp, amountForward) {\r\n var rotMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n var rotQuaternion = (this.rotationQuaternion) ? this.rotationQuaternion : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n rotQuaternion.toRotationMatrix(rotMatrix);\r\n var translationDelta = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var defForwardMult = this.definedFacingForward ? -1 : 1;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(amountRight * defForwardMult, amountUp, amountForward * defForwardMult, rotMatrix, translationDelta);\r\n return translationDelta;\r\n };\r\n // ================================== Point of View Rotation =================================\r\n /**\r\n * Perform relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.rotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n this.rotation.addInPlace(this.calcRotatePOV(flipBack, twirlClockwise, tiltRight));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward.\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the new rotation vector\r\n */\r\n AbstractMesh.prototype.calcRotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n var defForwardMult = this.definedFacingForward ? 1 : -1;\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](flipBack * defForwardMult, twirlClockwise, tiltRight * defForwardMult);\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), null);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._refreshBoundingInfo = function (data, bias) {\r\n if (data) {\r\n var extend = Object(_Maths_math_functions__WEBPACK_IMPORTED_MODULE_13__[\"extractMinAndMax\"])(data, 0, this.getTotalVertices(), bias);\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_9__[\"BoundingInfo\"](extend.minimum, extend.maximum);\r\n }\r\n }\r\n if (this.subMeshes) {\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this.subMeshes[index].refreshBoundingInfo(data);\r\n }\r\n }\r\n this._updateBoundingInfo();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getPositionData = function (applySkeleton) {\r\n var data = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n if (data && applySkeleton && this.skeleton) {\r\n data = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].Slice(data);\r\n this._generatePointsArray();\r\n var matricesIndicesData = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (matricesWeightsData && matricesIndicesData) {\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesWeightsExtraKind) : null;\r\n this.skeleton.prepare();\r\n var skeletonMatrices = this.skeleton.getTransformMatrices(this);\r\n var tempVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var finalMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n var tempMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n var matWeightIdx = 0;\r\n for (var index = 0; index < data.length; index += 3, matWeightIdx += 4) {\r\n finalMatrix.reset();\r\n var inf;\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);\r\n tempVector.toArray(data, index);\r\n if (this._positions) {\r\n this._positions[index / 3].copyFrom(tempVector);\r\n }\r\n }\r\n }\r\n }\r\n return data;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateBoundingInfo = function () {\r\n var effectiveMesh = this._effectiveMesh;\r\n if (this._boundingInfo) {\r\n this._boundingInfo.update(effectiveMesh.worldMatrixFromCache);\r\n }\r\n else {\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_9__[\"BoundingInfo\"](this.absolutePosition, this.absolutePosition, effectiveMesh.worldMatrixFromCache);\r\n }\r\n this._updateSubMeshesBoundingInfo(effectiveMesh.worldMatrixFromCache);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {\r\n if (!this.subMeshes) {\r\n return this;\r\n }\r\n var count = this.subMeshes.length;\r\n for (var subIndex = 0; subIndex < count; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n if (count > 1 || !subMesh.IsGlobal) {\r\n subMesh.updateBoundingInfo(matrix);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._afterComputeWorldMatrix = function () {\r\n if (this.doNotSyncBoundingInfo) {\r\n return;\r\n }\r\n // Bounding info\r\n this._updateBoundingInfo();\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"_effectiveMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return (this.skeleton && this.skeleton.overrideMesh) || this;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n AbstractMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n };\r\n /**\r\n * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.\r\n * A mesh is completely in the frustum if its bounding box it completely inside the frustum.\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is completely in the frustum planes\r\n */\r\n AbstractMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * True if the mesh intersects another mesh or a SolidParticle object\r\n * @param mesh defines a target mesh or SolidParticle to test\r\n * @param precise Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)\r\n * @param includeDescendants Can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsMesh = function (mesh, precise, includeDescendants) {\r\n if (precise === void 0) { precise = false; }\r\n if (!this._boundingInfo || !mesh._boundingInfo) {\r\n return false;\r\n }\r\n if (this._boundingInfo.intersects(mesh._boundingInfo, precise)) {\r\n return true;\r\n }\r\n if (includeDescendants) {\r\n for (var _i = 0, _a = this.getChildMeshes(); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.intersectsMesh(mesh, precise, true)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the passed point (Vector3) is inside the mesh bounding box\r\n * @param point defines the point to test\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsPoint = function (point) {\r\n if (!this._boundingInfo) {\r\n return false;\r\n }\r\n return this._boundingInfo.intersectsPoint(point);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"checkCollisions\", {\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can be used in the collision engine\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._checkCollisions;\r\n },\r\n set: function (collisionEnabled) {\r\n this._meshCollisionData._checkCollisions = collisionEnabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collider\", {\r\n /**\r\n * Gets Collider object used to compute collisions (not physics)\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collider;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Move the mesh using collision engine\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n * @param displacement defines the requested displacement vector\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.moveWithCollisions = function (displacement) {\r\n var globalPosition = this.getAbsolutePosition();\r\n globalPosition.addToRef(this.ellipsoidOffset, this._meshCollisionData._oldPositionForCollisions);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._meshCollisionData._collider) {\r\n this._meshCollisionData._collider = coordinator.createCollider();\r\n }\r\n this._meshCollisionData._collider._radius = this.ellipsoid;\r\n coordinator.getNewPosition(this._meshCollisionData._oldPositionForCollisions, displacement, this._meshCollisionData._collider, 3, this, this._onCollisionPositionChange, this.uniqueId);\r\n return this;\r\n };\r\n // Collisions\r\n /** @hidden */\r\n AbstractMesh.prototype._collideForSubMesh = function (subMesh, transformMatrix, collider) {\r\n this._generatePointsArray();\r\n if (!this._positions) {\r\n return this;\r\n }\r\n // Transformation\r\n if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix.equals(transformMatrix)) {\r\n subMesh._lastColliderTransformMatrix = transformMatrix.clone();\r\n subMesh._lastColliderWorldVertices = [];\r\n subMesh._trianglePlanes = [];\r\n var start = subMesh.verticesStart;\r\n var end = (subMesh.verticesStart + subMesh.verticesCount);\r\n for (var i = start; i < end; i++) {\r\n subMesh._lastColliderWorldVertices.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(this._positions[i], transformMatrix));\r\n }\r\n }\r\n // Collide\r\n collider._collide(subMesh._trianglePlanes, subMesh._lastColliderWorldVertices, this.getIndices(), subMesh.indexStart, subMesh.indexStart + subMesh.indexCount, subMesh.verticesStart, !!subMesh.getMaterial(), this);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._processCollisionsForSubMeshes = function (collider, transformMatrix) {\r\n var subMeshes = this._scene.getCollidingSubMeshCandidates(this, collider);\r\n var len = subMeshes.length;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh._checkCollision(collider)) {\r\n continue;\r\n }\r\n this._collideForSubMesh(subMesh, transformMatrix, collider);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkCollision = function (collider) {\r\n // Bounding box test\r\n if (!this._boundingInfo || !this._boundingInfo._checkCollision(collider)) {\r\n return this;\r\n }\r\n // Transformation matrix\r\n var collisionsScalingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n var collisionsTransformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ScalingToRef(1.0 / collider._radius.x, 1.0 / collider._radius.y, 1.0 / collider._radius.z, collisionsScalingMatrix);\r\n this.worldMatrixFromCache.multiplyToRef(collisionsScalingMatrix, collisionsTransformMatrix);\r\n this._processCollisionsForSubMeshes(collider, collisionsTransformMatrix);\r\n return this;\r\n };\r\n // Picking\r\n /** @hidden */\r\n AbstractMesh.prototype._generatePointsArray = function () {\r\n return false;\r\n };\r\n /**\r\n * Checks if the passed Ray intersects with the mesh\r\n * @param ray defines the ray to use\r\n * @param fastCheck defines if fast mode (but less precise) must be used (false by default)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns the picking info\r\n * @see http://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n */\r\n AbstractMesh.prototype.intersects = function (ray, fastCheck, trianglePredicate) {\r\n var pickingInfo = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_8__[\"PickingInfo\"]();\r\n var intersectionThreshold = this.getClassName() === \"InstancedLinesMesh\" || this.getClassName() === \"LinesMesh\" ? this.intersectionThreshold : 0;\r\n var boundingInfo = this._boundingInfo;\r\n if (!this.subMeshes || !boundingInfo || !ray.intersectsSphere(boundingInfo.boundingSphere, intersectionThreshold) || !ray.intersectsBox(boundingInfo.boundingBox, intersectionThreshold)) {\r\n return pickingInfo;\r\n }\r\n if (!this._generatePointsArray()) {\r\n return pickingInfo;\r\n }\r\n var intersectInfo = null;\r\n var subMeshes = this._scene.getIntersectingSubMeshCandidates(this, ray);\r\n var len = subMeshes.length;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh.canIntersects(ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = subMesh.intersects(ray, this._positions, this.getIndices(), fastCheck, trianglePredicate);\r\n if (currentIntersectInfo) {\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.subMeshId = index;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (intersectInfo) {\r\n // Get picked point\r\n var world = this.getWorldMatrix();\r\n var worldOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(ray.origin, world, worldOrigin);\r\n ray.direction.scaleToRef(intersectInfo.distance, direction);\r\n var worldDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(direction, world);\r\n var pickedPoint = worldDirection.addInPlace(worldOrigin);\r\n // Return result\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(worldOrigin, pickedPoint);\r\n pickingInfo.pickedPoint = pickedPoint;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.bu = intersectInfo.bu || 0;\r\n pickingInfo.bv = intersectInfo.bv || 0;\r\n pickingInfo.faceId = intersectInfo.faceId;\r\n pickingInfo.subMeshId = intersectInfo.subMeshId;\r\n return pickingInfo;\r\n }\r\n return pickingInfo;\r\n };\r\n /**\r\n * Clones the current mesh\r\n * @param name defines the mesh name\r\n * @param newParent defines the new mesh parent\r\n * @param doNotCloneChildren defines a boolean indicating that children must not be cloned (false by default)\r\n * @returns the new mesh\r\n */\r\n AbstractMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n return null;\r\n };\r\n /**\r\n * Disposes all the submeshes of the current meshnp\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.releaseSubMeshes = function () {\r\n if (this.subMeshes) {\r\n while (this.subMeshes.length) {\r\n this.subMeshes[0].dispose();\r\n }\r\n }\r\n else {\r\n this.subMeshes = new Array();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Releases resources associated with this abstract mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n AbstractMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n var _this = this;\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n var index;\r\n // mesh map release.\r\n if (this._scene.useMaterialMeshMap) {\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n // Smart Array Retainers.\r\n this.getScene().freeActiveMeshes();\r\n this.getScene().freeRenderingGroups();\r\n // Action manager\r\n if (this.actionManager !== undefined && this.actionManager !== null) {\r\n this.actionManager.dispose();\r\n this.actionManager = null;\r\n }\r\n // Skeleton\r\n this._internalAbstractMeshDataInfo._skeleton = null;\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n // Intersections in progress\r\n for (index = 0; index < this._intersectionsInProgress.length; index++) {\r\n var other = this._intersectionsInProgress[index];\r\n var pos = other._intersectionsInProgress.indexOf(this);\r\n other._intersectionsInProgress.splice(pos, 1);\r\n }\r\n this._intersectionsInProgress = [];\r\n // Lights\r\n var lights = this.getScene().lights;\r\n lights.forEach(function (light) {\r\n var meshIndex = light.includedOnlyMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.includedOnlyMeshes.splice(meshIndex, 1);\r\n }\r\n meshIndex = light.excludedMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.excludedMeshes.splice(meshIndex, 1);\r\n }\r\n // Shadow generators\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n var shadowMap = generator.getShadowMap();\r\n if (shadowMap && shadowMap.renderList) {\r\n meshIndex = shadowMap.renderList.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n shadowMap.renderList.splice(meshIndex, 1);\r\n }\r\n }\r\n }\r\n });\r\n // SubMeshes\r\n if (this.getClassName() !== \"InstancedMesh\" || this.getClassName() !== \"InstancedLinesMesh\") {\r\n this.releaseSubMeshes();\r\n }\r\n // Query\r\n var engine = this.getScene().getEngine();\r\n if (this._occlusionQuery) {\r\n this.isOcclusionQueryInProgress = false;\r\n engine.deleteQuery(this._occlusionQuery);\r\n this._occlusionQuery = null;\r\n }\r\n // Engine\r\n engine.wipeCaches();\r\n // Remove from scene\r\n this.getScene().removeMesh(this);\r\n if (disposeMaterialAndTextures) {\r\n if (this.material) {\r\n if (this.material.getClassName() === \"MultiMaterial\") {\r\n this.material.dispose(false, true, true);\r\n }\r\n else {\r\n this.material.dispose(false, true);\r\n }\r\n }\r\n }\r\n if (!doNotRecurse) {\r\n // Particles\r\n for (index = 0; index < this.getScene().particleSystems.length; index++) {\r\n if (this.getScene().particleSystems[index].emitter === this) {\r\n this.getScene().particleSystems[index].dispose();\r\n index--;\r\n }\r\n }\r\n }\r\n // facet data\r\n if (this._internalAbstractMeshDataInfo._facetData.facetDataEnabled) {\r\n this.disableFacetData();\r\n }\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n this.onCollideObservable.clear();\r\n this.onCollisionPositionChangeObservable.clear();\r\n this.onRebuildObservable.clear();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Adds the passed mesh as a child to the current mesh\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.addChild = function (mesh) {\r\n mesh.setParent(this);\r\n return this;\r\n };\r\n /**\r\n * Removes the passed mesh from the current mesh children list\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.removeChild = function (mesh) {\r\n mesh.setParent(null);\r\n return this;\r\n };\r\n // Facet data\r\n /** @hidden */\r\n AbstractMesh.prototype._initFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetNormals) {\r\n data.facetNormals = new Array();\r\n }\r\n if (!data.facetPositions) {\r\n data.facetPositions = new Array();\r\n }\r\n if (!data.facetPartitioning) {\r\n data.facetPartitioning = new Array();\r\n }\r\n data.facetNb = (this.getIndices().length / 3) | 0;\r\n data.partitioningSubdivisions = (data.partitioningSubdivisions) ? data.partitioningSubdivisions : 10; // default nb of partitioning subdivisions = 10\r\n data.partitioningBBoxRatio = (data.partitioningBBoxRatio) ? data.partitioningBBoxRatio : 1.01; // default ratio 1.01 = the partitioning is 1% bigger than the bounding box\r\n for (var f = 0; f < data.facetNb; f++) {\r\n data.facetNormals[f] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n data.facetPositions[f] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n data.facetDataEnabled = true;\r\n return this;\r\n };\r\n /**\r\n * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.\r\n * This method can be called within the render loop.\r\n * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.updateFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetDataEnabled) {\r\n this._initFacetData();\r\n }\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n var bInfo = this.getBoundingInfo();\r\n if (data.facetDepthSort && !data.facetDepthSortEnabled) {\r\n // init arrays, matrix and sort function on first call\r\n data.facetDepthSortEnabled = true;\r\n if (indices instanceof Uint16Array) {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n else if (indices instanceof Uint32Array) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n var needs32bits = false;\r\n for (var i = 0; i < indices.length; i++) {\r\n if (indices[i] > 65535) {\r\n needs32bits = true;\r\n break;\r\n }\r\n }\r\n if (needs32bits) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n }\r\n data.facetDepthSortFunction = function (f1, f2) {\r\n return (f2.sqDistance - f1.sqDistance);\r\n };\r\n if (!data.facetDepthSortFrom) {\r\n var camera = this.getScene().activeCamera;\r\n data.facetDepthSortFrom = (camera) ? camera.position : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n data.depthSortedFacets = [];\r\n for (var f = 0; f < data.facetNb; f++) {\r\n var depthSortedFacet = { ind: f * 3, sqDistance: 0.0 };\r\n data.depthSortedFacets.push(depthSortedFacet);\r\n }\r\n data.invertedMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n data.facetDepthSortOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n data.bbSize.x = (bInfo.maximum.x - bInfo.minimum.x > _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"]) ? bInfo.maximum.x - bInfo.minimum.x : _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n data.bbSize.y = (bInfo.maximum.y - bInfo.minimum.y > _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"]) ? bInfo.maximum.y - bInfo.minimum.y : _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n data.bbSize.z = (bInfo.maximum.z - bInfo.minimum.z > _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"]) ? bInfo.maximum.z - bInfo.minimum.z : _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n var bbSizeMax = (data.bbSize.x > data.bbSize.y) ? data.bbSize.x : data.bbSize.y;\r\n bbSizeMax = (bbSizeMax > data.bbSize.z) ? bbSizeMax : data.bbSize.z;\r\n data.subDiv.max = data.partitioningSubdivisions;\r\n data.subDiv.X = Math.floor(data.subDiv.max * data.bbSize.x / bbSizeMax); // adjust the number of subdivisions per axis\r\n data.subDiv.Y = Math.floor(data.subDiv.max * data.bbSize.y / bbSizeMax); // according to each bbox size per axis\r\n data.subDiv.Z = Math.floor(data.subDiv.max * data.bbSize.z / bbSizeMax);\r\n data.subDiv.X = data.subDiv.X < 1 ? 1 : data.subDiv.X; // at least one subdivision\r\n data.subDiv.Y = data.subDiv.Y < 1 ? 1 : data.subDiv.Y;\r\n data.subDiv.Z = data.subDiv.Z < 1 ? 1 : data.subDiv.Z;\r\n // set the parameters for ComputeNormals()\r\n data.facetParameters.facetNormals = this.getFacetLocalNormals();\r\n data.facetParameters.facetPositions = this.getFacetLocalPositions();\r\n data.facetParameters.facetPartitioning = this.getFacetLocalPartitioning();\r\n data.facetParameters.bInfo = bInfo;\r\n data.facetParameters.bbSize = data.bbSize;\r\n data.facetParameters.subDiv = data.subDiv;\r\n data.facetParameters.ratio = this.partitioningBBoxRatio;\r\n data.facetParameters.depthSort = data.facetDepthSort;\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n this.computeWorldMatrix(true);\r\n this._worldMatrix.invertToRef(data.invertedMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(data.facetDepthSortFrom, data.invertedMatrix, data.facetDepthSortOrigin);\r\n data.facetParameters.distanceTo = data.facetDepthSortOrigin;\r\n }\r\n data.facetParameters.depthSortedFacets = data.depthSortedFacets;\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_6__[\"VertexData\"].ComputeNormals(positions, indices, normals, data.facetParameters);\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n data.depthSortedFacets.sort(data.facetDepthSortFunction);\r\n var l = (data.depthSortedIndices.length / 3) | 0;\r\n for (var f = 0; f < l; f++) {\r\n var sind = data.depthSortedFacets[f].ind;\r\n data.depthSortedIndices[f * 3] = indices[sind];\r\n data.depthSortedIndices[f * 3 + 1] = indices[sind + 1];\r\n data.depthSortedIndices[f * 3 + 2] = indices[sind + 2];\r\n }\r\n this.updateIndices(data.depthSortedIndices, undefined, true);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the facetLocalNormals array.\r\n * The normals are expressed in the mesh local spac\r\n * @returns an array of Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalNormals = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetNormals) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetNormals;\r\n };\r\n /**\r\n * Returns the facetLocalPositions array.\r\n * The facet positions are expressed in the mesh local space\r\n * @returns an array of Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPositions = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPositions) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPositions;\r\n };\r\n /**\r\n * Returns the facetLocalPartioning array\r\n * @returns an array of array of numbers\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPartitioning = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPartitioning) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPartitioning;\r\n };\r\n /**\r\n * Returns the i-th facet position in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPosition = function (i) {\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getFacetPositionToRef(i, pos);\r\n return pos;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet position in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPositionToRef = function (i, ref) {\r\n var localPos = (this.getFacetLocalPositions())[i];\r\n var world = this.getWorldMatrix();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(localPos, world, ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the i-th facet normal in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormal = function (i) {\r\n var norm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getFacetNormalToRef(i, norm);\r\n return norm;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet normal in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormalToRef = function (i, ref) {\r\n var localNorm = (this.getFacetLocalNormals())[i];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(localNorm, this.getWorldMatrix(), ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system)\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the array of facet indexes\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetsAtLocalCoordinates = function (x, y, z) {\r\n var bInfo = this.getBoundingInfo();\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n var ox = Math.floor((x - bInfo.minimum.x * data.partitioningBBoxRatio) * data.subDiv.X * data.partitioningBBoxRatio / data.bbSize.x);\r\n var oy = Math.floor((y - bInfo.minimum.y * data.partitioningBBoxRatio) * data.subDiv.Y * data.partitioningBBoxRatio / data.bbSize.y);\r\n var oz = Math.floor((z - bInfo.minimum.z * data.partitioningBBoxRatio) * data.subDiv.Z * data.partitioningBBoxRatio / data.bbSize.z);\r\n if (ox < 0 || ox > data.subDiv.max || oy < 0 || oy > data.subDiv.max || oz < 0 || oz > data.subDiv.max) {\r\n return null;\r\n }\r\n return data.facetPartitioning[ox + data.subDiv.max * oy + data.subDiv.max * data.subDiv.max * oz];\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found\r\n * @param projected sets as the (x,y,z) world projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var world = this.getWorldMatrix();\r\n var invMat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[5];\r\n world.invertToRef(invMat);\r\n var invVect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[8];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, y, z, invMat, invVect); // transform (x,y,z) to coordinates in the mesh local space\r\n var closest = this.getClosestFacetAtLocalCoordinates(invVect.x, invVect.y, invVect.z, projected, checkFace, facing);\r\n if (projected) {\r\n // tranform the local computed projected vector to world coordinates\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(projected.x, projected.y, projected.z, world, projected);\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found\r\n * @param projected sets as the (x,y,z) local projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtLocalCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var closest = null;\r\n var tmpx = 0.0;\r\n var tmpy = 0.0;\r\n var tmpz = 0.0;\r\n var d = 0.0; // tmp dot facet normal * facet position\r\n var t0 = 0.0;\r\n var projx = 0.0;\r\n var projy = 0.0;\r\n var projz = 0.0;\r\n // Get all the facets in the same partitioning block than (x, y, z)\r\n var facetPositions = this.getFacetLocalPositions();\r\n var facetNormals = this.getFacetLocalNormals();\r\n var facetsInBlock = this.getFacetsAtLocalCoordinates(x, y, z);\r\n if (!facetsInBlock) {\r\n return null;\r\n }\r\n // Get the closest facet to (x, y, z)\r\n var shortest = Number.MAX_VALUE; // init distance vars\r\n var tmpDistance = shortest;\r\n var fib; // current facet in the block\r\n var norm; // current facet normal\r\n var p0; // current facet barycenter position\r\n // loop on all the facets in the current partitioning block\r\n for (var idx = 0; idx < facetsInBlock.length; idx++) {\r\n fib = facetsInBlock[idx];\r\n norm = facetNormals[fib];\r\n p0 = facetPositions[fib];\r\n d = (x - p0.x) * norm.x + (y - p0.y) * norm.y + (z - p0.z) * norm.z;\r\n if (!checkFace || (checkFace && facing && d >= 0.0) || (checkFace && !facing && d <= 0.0)) {\r\n // compute (x,y,z) projection on the facet = (projx, projy, projz)\r\n d = norm.x * p0.x + norm.y * p0.y + norm.z * p0.z;\r\n t0 = -(norm.x * x + norm.y * y + norm.z * z - d) / (norm.x * norm.x + norm.y * norm.y + norm.z * norm.z);\r\n projx = x + norm.x * t0;\r\n projy = y + norm.y * t0;\r\n projz = z + norm.z * t0;\r\n tmpx = projx - x;\r\n tmpy = projy - y;\r\n tmpz = projz - z;\r\n tmpDistance = tmpx * tmpx + tmpy * tmpy + tmpz * tmpz; // compute length between (x, y, z) and its projection on the facet\r\n if (tmpDistance < shortest) { // just keep the closest facet to (x, y, z)\r\n shortest = tmpDistance;\r\n closest = fib;\r\n if (projected) {\r\n projected.x = projx;\r\n projected.y = projy;\r\n projected.z = projz;\r\n }\r\n }\r\n }\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the object \"parameter\" set with all the expected parameters for facetData computation by ComputeNormals()\r\n * @returns the parameters\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetDataParameters = function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetParameters;\r\n };\r\n /**\r\n * Disables the feature FacetData and frees the related memory\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.disableFacetData = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (facetData.facetDataEnabled) {\r\n facetData.facetDataEnabled = false;\r\n facetData.facetPositions = new Array();\r\n facetData.facetNormals = new Array();\r\n facetData.facetPartitioning = new Array();\r\n facetData.facetParameters = null;\r\n facetData.depthSortedIndices = new Uint32Array(0);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the AbstractMesh indices array\r\n * @param indices defines the data source\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n return this;\r\n };\r\n /**\r\n * Creates new normals data for the mesh\r\n * @param updatable defines if the normal vertex buffer must be flagged as updatable\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.createNormals = function (updatable) {\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n var indices = this.getIndices();\r\n var normals;\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind)) {\r\n normals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n }\r\n else {\r\n normals = [];\r\n }\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_6__[\"VertexData\"].ComputeNormals(positions, indices, normals, { useRightHandedSystem: this.getScene().useRightHandedSystem });\r\n this.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind, normals, updatable);\r\n return this;\r\n };\r\n /**\r\n * Align the mesh with a normal\r\n * @param normal defines the normal to use\r\n * @param upDirection can be used to redefined the up vector to use (will use the (0, 1, 0) by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.alignWithNormal = function (normal, upDirection) {\r\n if (!upDirection) {\r\n upDirection = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_16__[\"Axis\"].Y;\r\n }\r\n var axisX = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var axisZ = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(upDirection, normal, axisZ);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(normal, axisZ, axisX);\r\n if (this.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationQuaternionFromAxisToRef(axisX, normal, axisZ, this.rotationQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].RotationFromAxisToRef(axisX, normal, axisZ, this.rotation);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkOcclusionQuery = function () {\r\n return false;\r\n };\r\n /**\r\n * Disables the mesh edge rendering mode\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.disableEdgesRendering = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"EdgesRenderer\");\r\n };\r\n /**\r\n * Enables the edge rendering mode on the mesh.\r\n * This mode makes the mesh edges visible\r\n * @param epsilon defines the maximal distance between two angles to detect a face\r\n * @param checkVerticesInsteadOfIndices indicates that we should check vertex list directly instead of faces\r\n * @returns the currentAbstractMesh\r\n * @see https://www.babylonjs-playground.com/#19O9TU#0\r\n */\r\n AbstractMesh.prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"EdgesRenderer\");\r\n };\r\n /** No occlusion */\r\n AbstractMesh.OCCLUSION_TYPE_NONE = 0;\r\n /** Occlusion set to optimisitic */\r\n AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC = 1;\r\n /** Occlusion set to strict */\r\n AbstractMesh.OCCLUSION_TYPE_STRICT = 2;\r\n /** Use an accurante occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0;\r\n /** Use a conservative occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1;\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_STANDARD = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_STANDARD;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY;\r\n return AbstractMesh;\r\n}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/buffer.ts\":\n/*!**************************!*\\\n !*** ./Meshes/buffer.ts ***!\n \\**************************/\n/*! exports provided: Buffer, VertexBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return Buffer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return VertexBuffer; });\n/**\r\n * Class used to store data that will be store in GPU memory\r\n */\r\nvar Buffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this buffer\r\n * @param updatable whether the data is updatable\r\n * @param stride the stride (optional)\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param useBytes set to true if the stride in in bytes (optional)\r\n */\r\n function Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes) {\r\n if (stride === void 0) { stride = 0; }\r\n if (postponeInternalCreation === void 0) { postponeInternalCreation = false; }\r\n if (instanced === void 0) { instanced = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (engine.getScene) { // old versions of VertexBuffer accepted 'mesh' instead of 'engine'\r\n this._engine = engine.getScene().getEngine();\r\n }\r\n else {\r\n this._engine = engine;\r\n }\r\n this._updatable = updatable;\r\n this._instanced = instanced;\r\n this._data = data;\r\n this.byteStride = useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT;\r\n if (!postponeInternalCreation) { // by default\r\n this.create();\r\n }\r\n }\r\n /**\r\n * Create a new VertexBuffer based on the current buffer\r\n * @param kind defines the vertex buffer kind (position, normal, etc.)\r\n * @param offset defines offset in the buffer (0 by default)\r\n * @param size defines the size in floats of attributes (position is 3 for instance)\r\n * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)\r\n * @param instanced defines if the vertex buffer contains indexed data\r\n * @param useBytes defines if the offset and stride are in bytes\r\n * @returns the new vertex buffer\r\n */\r\n Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride, instanced, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var byteOffset = useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT;\r\n var byteStride = stride ? (useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT) : this.byteStride;\r\n // a lot of these parameters are ignored as they are overriden by the buffer\r\n return new VertexBuffer(this._engine, this, kind, this._updatable, true, byteStride, instanced === undefined ? this._instanced : instanced, byteOffset, size, undefined, undefined, true);\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the Buffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n Buffer.prototype.isUpdatable = function () {\r\n return this._updatable;\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n Buffer.prototype.getData = function () {\r\n return this._data;\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n Buffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * DEPRECATED. Use byteStride instead.\r\n * @returns the stride in float32 units\r\n */\r\n Buffer.prototype.getStrideSize = function () {\r\n return this.byteStride / Float32Array.BYTES_PER_ELEMENT;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.create = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (!data && this._buffer) {\r\n return; // nothing to do\r\n }\r\n data = data || this._data;\r\n if (!data) {\r\n return;\r\n }\r\n if (!this._buffer) { // create buffer\r\n if (this._updatable) {\r\n this._buffer = this._engine.createDynamicVertexBuffer(data);\r\n this._data = data;\r\n }\r\n else {\r\n this._buffer = this._engine.createVertexBuffer(data);\r\n }\r\n }\r\n else if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data);\r\n this._data = data;\r\n }\r\n };\r\n /** @hidden */\r\n Buffer.prototype._rebuild = function () {\r\n this._buffer = null;\r\n this.create(this._data);\r\n };\r\n /**\r\n * Update current buffer data\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.update = function (data) {\r\n this.create(data);\r\n };\r\n /**\r\n * Updates the data directly.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param vertexCount the vertex count (optional)\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Buffer.prototype.updateDirectly = function (data, offset, vertexCount, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data, useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT, (vertexCount ? vertexCount * this.byteStride : undefined));\r\n this._data = null;\r\n }\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n Buffer.prototype.dispose = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n return Buffer;\r\n}());\r\n\r\n/**\r\n * Specialized buffer used to store vertex data\r\n */\r\nvar VertexBuffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param updatable whether the data is updatable\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param stride the stride (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param offset the offset of the data (optional)\r\n * @param size the number of components (optional)\r\n * @param type the type of the component (optional)\r\n * @param normalized whether the data contains normalized data (optional)\r\n * @param useBytes set to true if stride and offset are in bytes (optional)\r\n */\r\n function VertexBuffer(engine, data, kind, updatable, postponeInternalCreation, stride, instanced, offset, size, type, normalized, useBytes) {\r\n if (normalized === void 0) { normalized = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (data instanceof Buffer) {\r\n this._buffer = data;\r\n this._ownsBuffer = false;\r\n }\r\n else {\r\n this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes);\r\n this._ownsBuffer = true;\r\n }\r\n this._kind = kind;\r\n if (type == undefined) {\r\n var data_1 = this.getData();\r\n this.type = VertexBuffer.FLOAT;\r\n if (data_1 instanceof Int8Array) {\r\n this.type = VertexBuffer.BYTE;\r\n }\r\n else if (data_1 instanceof Uint8Array) {\r\n this.type = VertexBuffer.UNSIGNED_BYTE;\r\n }\r\n else if (data_1 instanceof Int16Array) {\r\n this.type = VertexBuffer.SHORT;\r\n }\r\n else if (data_1 instanceof Uint16Array) {\r\n this.type = VertexBuffer.UNSIGNED_SHORT;\r\n }\r\n else if (data_1 instanceof Int32Array) {\r\n this.type = VertexBuffer.INT;\r\n }\r\n else if (data_1 instanceof Uint32Array) {\r\n this.type = VertexBuffer.UNSIGNED_INT;\r\n }\r\n }\r\n else {\r\n this.type = type;\r\n }\r\n var typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\r\n if (useBytes) {\r\n this._size = size || (stride ? (stride / typeByteLength) : VertexBuffer.DeduceStride(kind));\r\n this.byteStride = stride || this._buffer.byteStride || (this._size * typeByteLength);\r\n this.byteOffset = offset || 0;\r\n }\r\n else {\r\n this._size = size || stride || VertexBuffer.DeduceStride(kind);\r\n this.byteStride = stride ? (stride * typeByteLength) : (this._buffer.byteStride || (this._size * typeByteLength));\r\n this.byteOffset = (offset || 0) * typeByteLength;\r\n }\r\n this.normalized = normalized;\r\n this._instanced = instanced !== undefined ? instanced : false;\r\n this._instanceDivisor = instanced ? 1 : 0;\r\n }\r\n Object.defineProperty(VertexBuffer.prototype, \"instanceDivisor\", {\r\n /**\r\n * Gets or sets the instance divisor when in instanced mode\r\n */\r\n get: function () {\r\n return this._instanceDivisor;\r\n },\r\n set: function (value) {\r\n this._instanceDivisor = value;\r\n if (value == 0) {\r\n this._instanced = false;\r\n }\r\n else {\r\n this._instanced = true;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n VertexBuffer.prototype._rebuild = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n this._buffer._rebuild();\r\n };\r\n /**\r\n * Returns the kind of the VertexBuffer (string)\r\n * @returns a string\r\n */\r\n VertexBuffer.prototype.getKind = function () {\r\n return this._kind;\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the VertexBuffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n VertexBuffer.prototype.isUpdatable = function () {\r\n return this._buffer.isUpdatable();\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n VertexBuffer.prototype.getData = function () {\r\n return this._buffer.getData();\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n VertexBuffer.prototype.getBuffer = function () {\r\n return this._buffer.getBuffer();\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * DEPRECATED. Use byteStride instead.\r\n * @returns the stride in float32 units\r\n */\r\n VertexBuffer.prototype.getStrideSize = function () {\r\n return this.byteStride / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the offset as a multiple of the type byte length.\r\n * DEPRECATED. Use byteOffset instead.\r\n * @returns the offset in bytes\r\n */\r\n VertexBuffer.prototype.getOffset = function () {\r\n return this.byteOffset / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the number of components per vertex attribute (integer)\r\n * @returns the size in float\r\n */\r\n VertexBuffer.prototype.getSize = function () {\r\n return this._size;\r\n };\r\n /**\r\n * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced\r\n * @returns true if this buffer is instanced\r\n */\r\n VertexBuffer.prototype.getIsInstanced = function () {\r\n return this._instanced;\r\n };\r\n /**\r\n * Returns the instancing divisor, zero for non-instanced (integer).\r\n * @returns a number\r\n */\r\n VertexBuffer.prototype.getInstanceDivisor = function () {\r\n return this._instanceDivisor;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.create = function (data) {\r\n this._buffer.create(data);\r\n };\r\n /**\r\n * Updates the underlying buffer according to the passed numeric array or Float32Array.\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.update = function (data) {\r\n this._buffer.update(data);\r\n };\r\n /**\r\n * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.\r\n * Returns the directly updated WebGLBuffer.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n VertexBuffer.prototype.updateDirectly = function (data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n this._buffer.updateDirectly(data, offset, undefined, useBytes);\r\n };\r\n /**\r\n * Disposes the VertexBuffer and the underlying WebGLBuffer.\r\n */\r\n VertexBuffer.prototype.dispose = function () {\r\n if (this._ownsBuffer) {\r\n this._buffer.dispose();\r\n }\r\n };\r\n /**\r\n * Enumerates each value of this vertex buffer as numbers.\r\n * @param count the number of values to enumerate\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.prototype.forEach = function (count, callback) {\r\n VertexBuffer.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);\r\n };\r\n /**\r\n * Deduces the stride given a kind.\r\n * @param kind The kind string to deduce\r\n * @returns The deduced stride\r\n */\r\n VertexBuffer.DeduceStride = function (kind) {\r\n switch (kind) {\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind:\r\n case VertexBuffer.UV3Kind:\r\n case VertexBuffer.UV4Kind:\r\n case VertexBuffer.UV5Kind:\r\n case VertexBuffer.UV6Kind:\r\n return 2;\r\n case VertexBuffer.NormalKind:\r\n case VertexBuffer.PositionKind:\r\n return 3;\r\n case VertexBuffer.ColorKind:\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n case VertexBuffer.TangentKind:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid kind '\" + kind + \"'\");\r\n }\r\n };\r\n /**\r\n * Gets the byte length of the given type.\r\n * @param type the type\r\n * @returns the number of bytes\r\n */\r\n VertexBuffer.GetTypeByteLength = function (type) {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return 1;\r\n case VertexBuffer.SHORT:\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return 2;\r\n case VertexBuffer.INT:\r\n case VertexBuffer.UNSIGNED_INT:\r\n case VertexBuffer.FLOAT:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid type '\" + type + \"'\");\r\n }\r\n };\r\n /**\r\n * Enumerates each value of the given parameters as numbers.\r\n * @param data the data to enumerate\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param componentCount the number of components per element\r\n * @param componentType the type of the component\r\n * @param count the number of values to enumerate\r\n * @param normalized whether the data is normalized\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.ForEach = function (data, byteOffset, byteStride, componentCount, componentType, count, normalized, callback) {\r\n if (data instanceof Array) {\r\n var offset = byteOffset / 4;\r\n var stride = byteStride / 4;\r\n for (var index = 0; index < count; index += componentCount) {\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n callback(data[offset + componentIndex], index + componentIndex);\r\n }\r\n offset += stride;\r\n }\r\n }\r\n else {\r\n var dataView = data instanceof ArrayBuffer ? new DataView(data) : new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n var componentByteLength = VertexBuffer.GetTypeByteLength(componentType);\r\n for (var index = 0; index < count; index += componentCount) {\r\n var componentByteOffset = byteOffset;\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n var value = VertexBuffer._GetFloatValue(dataView, componentType, componentByteOffset, normalized);\r\n callback(value, index + componentIndex);\r\n componentByteOffset += componentByteLength;\r\n }\r\n byteOffset += byteStride;\r\n }\r\n }\r\n };\r\n VertexBuffer._GetFloatValue = function (dataView, type, byteOffset, normalized) {\r\n switch (type) {\r\n case VertexBuffer.BYTE: {\r\n var value = dataView.getInt8(byteOffset);\r\n if (normalized) {\r\n value = Math.max(value / 127, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_BYTE: {\r\n var value = dataView.getUint8(byteOffset);\r\n if (normalized) {\r\n value = value / 255;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.SHORT: {\r\n var value = dataView.getInt16(byteOffset, true);\r\n if (normalized) {\r\n value = Math.max(value / 32767, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_SHORT: {\r\n var value = dataView.getUint16(byteOffset, true);\r\n if (normalized) {\r\n value = value / 65535;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.INT: {\r\n return dataView.getInt32(byteOffset, true);\r\n }\r\n case VertexBuffer.UNSIGNED_INT: {\r\n return dataView.getUint32(byteOffset, true);\r\n }\r\n case VertexBuffer.FLOAT: {\r\n return dataView.getFloat32(byteOffset, true);\r\n }\r\n default: {\r\n throw new Error(\"Invalid component type \" + type);\r\n }\r\n }\r\n };\r\n /**\r\n * The byte type.\r\n */\r\n VertexBuffer.BYTE = 5120;\r\n /**\r\n * The unsigned byte type.\r\n */\r\n VertexBuffer.UNSIGNED_BYTE = 5121;\r\n /**\r\n * The short type.\r\n */\r\n VertexBuffer.SHORT = 5122;\r\n /**\r\n * The unsigned short type.\r\n */\r\n VertexBuffer.UNSIGNED_SHORT = 5123;\r\n /**\r\n * The integer type.\r\n */\r\n VertexBuffer.INT = 5124;\r\n /**\r\n * The unsigned integer type.\r\n */\r\n VertexBuffer.UNSIGNED_INT = 5125;\r\n /**\r\n * The float type.\r\n */\r\n VertexBuffer.FLOAT = 5126;\r\n // Enums\r\n /**\r\n * Positions\r\n */\r\n VertexBuffer.PositionKind = \"position\";\r\n /**\r\n * Normals\r\n */\r\n VertexBuffer.NormalKind = \"normal\";\r\n /**\r\n * Tangents\r\n */\r\n VertexBuffer.TangentKind = \"tangent\";\r\n /**\r\n * Texture coordinates\r\n */\r\n VertexBuffer.UVKind = \"uv\";\r\n /**\r\n * Texture coordinates 2\r\n */\r\n VertexBuffer.UV2Kind = \"uv2\";\r\n /**\r\n * Texture coordinates 3\r\n */\r\n VertexBuffer.UV3Kind = \"uv3\";\r\n /**\r\n * Texture coordinates 4\r\n */\r\n VertexBuffer.UV4Kind = \"uv4\";\r\n /**\r\n * Texture coordinates 5\r\n */\r\n VertexBuffer.UV5Kind = \"uv5\";\r\n /**\r\n * Texture coordinates 6\r\n */\r\n VertexBuffer.UV6Kind = \"uv6\";\r\n /**\r\n * Colors\r\n */\r\n VertexBuffer.ColorKind = \"color\";\r\n /**\r\n * Matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesKind = \"matricesIndices\";\r\n /**\r\n * Matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsKind = \"matricesWeights\";\r\n /**\r\n * Additional matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesExtraKind = \"matricesIndicesExtra\";\r\n /**\r\n * Additional matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsExtraKind = \"matricesWeightsExtra\";\r\n return VertexBuffer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/csg.ts\":\n/*!***********************!*\\\n !*** ./Meshes/csg.ts ***!\n \\***********************/\n/*! exports provided: CSG */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return CSG; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Unique ID when we import meshes from Babylon to CSG\r\n */\r\nvar currentCSGMeshId = 0;\r\n/**\r\n * Represents a vertex of a polygon. Use your own vertex class instead of this\r\n * one to provide additional features like texture coordinates and vertex\r\n * colors. Custom vertex classes need to provide a `pos` property and `clone()`,\r\n * `flip()`, and `interpolate()` methods that behave analogous to the ones\r\n * defined by `BABYLON.CSG.Vertex`. This class provides `normal` so convenience\r\n * functions like `BABYLON.CSG.sphere()` can return a smooth vertex normal, but `normal`\r\n * is not used anywhere else.\r\n * Same goes for uv, it allows to keep the original vertex uv coordinates of the 2 meshes\r\n */\r\nvar Vertex = /** @class */ (function () {\r\n /**\r\n * Initializes the vertex\r\n * @param pos The position of the vertex\r\n * @param normal The normal of the vertex\r\n * @param uv The texture coordinate of the vertex\r\n */\r\n function Vertex(\r\n /**\r\n * The position of the vertex\r\n */\r\n pos, \r\n /**\r\n * The normal of the vertex\r\n */\r\n normal, \r\n /**\r\n * The texture coordinate of the vertex\r\n */\r\n uv) {\r\n this.pos = pos;\r\n this.normal = normal;\r\n this.uv = uv;\r\n }\r\n /**\r\n * Make a clone, or deep copy, of the vertex\r\n * @returns A new Vertex\r\n */\r\n Vertex.prototype.clone = function () {\r\n return new Vertex(this.pos.clone(), this.normal.clone(), this.uv.clone());\r\n };\r\n /**\r\n * Invert all orientation-specific data (e.g. vertex normal). Called when the\r\n * orientation of a polygon is flipped.\r\n */\r\n Vertex.prototype.flip = function () {\r\n this.normal = this.normal.scale(-1);\r\n };\r\n /**\r\n * Create a new vertex between this vertex and `other` by linearly\r\n * interpolating all properties using a parameter of `t`. Subclasses should\r\n * override this to interpolate additional properties.\r\n * @param other the vertex to interpolate against\r\n * @param t The factor used to linearly interpolate between the vertices\r\n */\r\n Vertex.prototype.interpolate = function (other, t) {\r\n return new Vertex(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(this.pos, other.pos, t), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(this.normal, other.normal, t), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(this.uv, other.uv, t));\r\n };\r\n return Vertex;\r\n}());\r\n/**\r\n * Represents a plane in 3D space.\r\n */\r\nvar Plane = /** @class */ (function () {\r\n /**\r\n * Initializes the plane\r\n * @param normal The normal for the plane\r\n * @param w\r\n */\r\n function Plane(normal, w) {\r\n this.normal = normal;\r\n this.w = w;\r\n }\r\n /**\r\n * Construct a plane from three points\r\n * @param a Point a\r\n * @param b Point b\r\n * @param c Point c\r\n */\r\n Plane.FromPoints = function (a, b, c) {\r\n var v0 = c.subtract(a);\r\n var v1 = b.subtract(a);\r\n if (v0.lengthSquared() === 0 || v1.lengthSquared() === 0) {\r\n return null;\r\n }\r\n var n = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(v0, v1));\r\n return new Plane(n, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(n, a));\r\n };\r\n /**\r\n * Clone, or make a deep copy of the plane\r\n * @returns a new Plane\r\n */\r\n Plane.prototype.clone = function () {\r\n return new Plane(this.normal.clone(), this.w);\r\n };\r\n /**\r\n * Flip the face of the plane\r\n */\r\n Plane.prototype.flip = function () {\r\n this.normal.scaleInPlace(-1);\r\n this.w = -this.w;\r\n };\r\n /**\r\n * Split `polygon` by this plane if needed, then put the polygon or polygon\r\n * fragments in the appropriate lists. Coplanar polygons go into either\r\n `* coplanarFront` or `coplanarBack` depending on their orientation with\r\n * respect to this plane. Polygons in front or in back of this plane go into\r\n * either `front` or `back`\r\n * @param polygon The polygon to be split\r\n * @param coplanarFront Will contain polygons coplanar with the plane that are oriented to the front of the plane\r\n * @param coplanarBack Will contain polygons coplanar with the plane that are oriented to the back of the plane\r\n * @param front Will contain the polygons in front of the plane\r\n * @param back Will contain the polygons begind the plane\r\n */\r\n Plane.prototype.splitPolygon = function (polygon, coplanarFront, coplanarBack, front, back) {\r\n var COPLANAR = 0;\r\n var FRONT = 1;\r\n var BACK = 2;\r\n var SPANNING = 3;\r\n // Classify each point as well as the entire polygon into one of the above\r\n // four classes.\r\n var polygonType = 0;\r\n var types = [];\r\n var i;\r\n var t;\r\n for (i = 0; i < polygon.vertices.length; i++) {\r\n t = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, polygon.vertices[i].pos) - this.w;\r\n var type = (t < -Plane.EPSILON) ? BACK : (t > Plane.EPSILON) ? FRONT : COPLANAR;\r\n polygonType |= type;\r\n types.push(type);\r\n }\r\n // Put the polygon in the correct list, splitting it when necessary\r\n switch (polygonType) {\r\n case COPLANAR:\r\n (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, polygon.plane.normal) > 0 ? coplanarFront : coplanarBack).push(polygon);\r\n break;\r\n case FRONT:\r\n front.push(polygon);\r\n break;\r\n case BACK:\r\n back.push(polygon);\r\n break;\r\n case SPANNING:\r\n var f = [], b = [];\r\n for (i = 0; i < polygon.vertices.length; i++) {\r\n var j = (i + 1) % polygon.vertices.length;\r\n var ti = types[i], tj = types[j];\r\n var vi = polygon.vertices[i], vj = polygon.vertices[j];\r\n if (ti !== BACK) {\r\n f.push(vi);\r\n }\r\n if (ti !== FRONT) {\r\n b.push(ti !== BACK ? vi.clone() : vi);\r\n }\r\n if ((ti | tj) === SPANNING) {\r\n t = (this.w - _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, vi.pos)) / _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, vj.pos.subtract(vi.pos));\r\n var v = vi.interpolate(vj, t);\r\n f.push(v);\r\n b.push(v.clone());\r\n }\r\n }\r\n var poly;\r\n if (f.length >= 3) {\r\n poly = new Polygon(f, polygon.shared);\r\n if (poly.plane) {\r\n front.push(poly);\r\n }\r\n }\r\n if (b.length >= 3) {\r\n poly = new Polygon(b, polygon.shared);\r\n if (poly.plane) {\r\n back.push(poly);\r\n }\r\n }\r\n break;\r\n }\r\n };\r\n /**\r\n * `CSG.Plane.EPSILON` is the tolerance used by `splitPolygon()` to decide if a\r\n * point is on the plane\r\n */\r\n Plane.EPSILON = 1e-5;\r\n return Plane;\r\n}());\r\n/**\r\n * Represents a convex polygon. The vertices used to initialize a polygon must\r\n * be coplanar and form a convex loop.\r\n *\r\n * Each convex polygon has a `shared` property, which is shared between all\r\n * polygons that are clones of each other or were split from the same polygon.\r\n * This can be used to define per-polygon properties (such as surface color)\r\n */\r\nvar Polygon = /** @class */ (function () {\r\n /**\r\n * Initializes the polygon\r\n * @param vertices The vertices of the polygon\r\n * @param shared The properties shared across all polygons\r\n */\r\n function Polygon(vertices, shared) {\r\n this.vertices = vertices;\r\n this.shared = shared;\r\n this.plane = Plane.FromPoints(vertices[0].pos, vertices[1].pos, vertices[2].pos);\r\n }\r\n /**\r\n * Clones, or makes a deep copy, or the polygon\r\n */\r\n Polygon.prototype.clone = function () {\r\n var vertices = this.vertices.map(function (v) { return v.clone(); });\r\n return new Polygon(vertices, this.shared);\r\n };\r\n /**\r\n * Flips the faces of the polygon\r\n */\r\n Polygon.prototype.flip = function () {\r\n this.vertices.reverse().map(function (v) { v.flip(); });\r\n this.plane.flip();\r\n };\r\n return Polygon;\r\n}());\r\n/**\r\n * Holds a node in a BSP tree. A BSP tree is built from a collection of polygons\r\n * by picking a polygon to split along. That polygon (and all other coplanar\r\n * polygons) are added directly to that node and the other polygons are added to\r\n * the front and/or back subtrees. This is not a leafy BSP tree since there is\r\n * no distinction between internal and leaf nodes\r\n */\r\nvar Node = /** @class */ (function () {\r\n /**\r\n * Initializes the node\r\n * @param polygons A collection of polygons held in the node\r\n */\r\n function Node(polygons) {\r\n this.plane = null;\r\n this.front = null;\r\n this.back = null;\r\n this.polygons = new Array();\r\n if (polygons) {\r\n this.build(polygons);\r\n }\r\n }\r\n /**\r\n * Clones, or makes a deep copy, of the node\r\n * @returns The cloned node\r\n */\r\n Node.prototype.clone = function () {\r\n var node = new Node();\r\n node.plane = this.plane && this.plane.clone();\r\n node.front = this.front && this.front.clone();\r\n node.back = this.back && this.back.clone();\r\n node.polygons = this.polygons.map(function (p) { return p.clone(); });\r\n return node;\r\n };\r\n /**\r\n * Convert solid space to empty space and empty space to solid space\r\n */\r\n Node.prototype.invert = function () {\r\n for (var i = 0; i < this.polygons.length; i++) {\r\n this.polygons[i].flip();\r\n }\r\n if (this.plane) {\r\n this.plane.flip();\r\n }\r\n if (this.front) {\r\n this.front.invert();\r\n }\r\n if (this.back) {\r\n this.back.invert();\r\n }\r\n var temp = this.front;\r\n this.front = this.back;\r\n this.back = temp;\r\n };\r\n /**\r\n * Recursively remove all polygons in `polygons` that are inside this BSP\r\n * tree.\r\n * @param polygons Polygons to remove from the BSP\r\n * @returns Polygons clipped from the BSP\r\n */\r\n Node.prototype.clipPolygons = function (polygons) {\r\n if (!this.plane) {\r\n return polygons.slice();\r\n }\r\n var front = new Array(), back = new Array();\r\n for (var i = 0; i < polygons.length; i++) {\r\n this.plane.splitPolygon(polygons[i], front, back, front, back);\r\n }\r\n if (this.front) {\r\n front = this.front.clipPolygons(front);\r\n }\r\n if (this.back) {\r\n back = this.back.clipPolygons(back);\r\n }\r\n else {\r\n back = [];\r\n }\r\n return front.concat(back);\r\n };\r\n /**\r\n * Remove all polygons in this BSP tree that are inside the other BSP tree\r\n * `bsp`.\r\n * @param bsp BSP containing polygons to remove from this BSP\r\n */\r\n Node.prototype.clipTo = function (bsp) {\r\n this.polygons = bsp.clipPolygons(this.polygons);\r\n if (this.front) {\r\n this.front.clipTo(bsp);\r\n }\r\n if (this.back) {\r\n this.back.clipTo(bsp);\r\n }\r\n };\r\n /**\r\n * Return a list of all polygons in this BSP tree\r\n * @returns List of all polygons in this BSP tree\r\n */\r\n Node.prototype.allPolygons = function () {\r\n var polygons = this.polygons.slice();\r\n if (this.front) {\r\n polygons = polygons.concat(this.front.allPolygons());\r\n }\r\n if (this.back) {\r\n polygons = polygons.concat(this.back.allPolygons());\r\n }\r\n return polygons;\r\n };\r\n /**\r\n * Build a BSP tree out of `polygons`. When called on an existing tree, the\r\n * new polygons are filtered down to the bottom of the tree and become new\r\n * nodes there. Each set of polygons is partitioned using the first polygon\r\n * (no heuristic is used to pick a good split)\r\n * @param polygons Polygons used to construct the BSP tree\r\n */\r\n Node.prototype.build = function (polygons) {\r\n if (!polygons.length) {\r\n return;\r\n }\r\n if (!this.plane) {\r\n this.plane = polygons[0].plane.clone();\r\n }\r\n var front = new Array(), back = new Array();\r\n for (var i = 0; i < polygons.length; i++) {\r\n this.plane.splitPolygon(polygons[i], this.polygons, this.polygons, front, back);\r\n }\r\n if (front.length) {\r\n if (!this.front) {\r\n this.front = new Node();\r\n }\r\n this.front.build(front);\r\n }\r\n if (back.length) {\r\n if (!this.back) {\r\n this.back = new Node();\r\n }\r\n this.back.build(back);\r\n }\r\n };\r\n return Node;\r\n}());\r\n/**\r\n * Class for building Constructive Solid Geometry\r\n */\r\nvar CSG = /** @class */ (function () {\r\n function CSG() {\r\n this.polygons = new Array();\r\n }\r\n /**\r\n * Convert the Mesh to CSG\r\n * @param mesh The Mesh to convert to CSG\r\n * @returns A new CSG from the Mesh\r\n */\r\n CSG.FromMesh = function (mesh) {\r\n var vertex, normal, uv, position, polygon, polygons = new Array(), vertices;\r\n var matrix, meshPosition, meshRotation, meshRotationQuaternion = null, meshScaling;\r\n if (mesh instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]) {\r\n mesh.computeWorldMatrix(true);\r\n matrix = mesh.getWorldMatrix();\r\n meshPosition = mesh.position.clone();\r\n meshRotation = mesh.rotation.clone();\r\n if (mesh.rotationQuaternion) {\r\n meshRotationQuaternion = mesh.rotationQuaternion.clone();\r\n }\r\n meshScaling = mesh.scaling.clone();\r\n }\r\n else {\r\n throw 'BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh';\r\n }\r\n var indices = mesh.getIndices(), positions = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind), normals = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind), uvs = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n var subMeshes = mesh.subMeshes;\r\n for (var sm = 0, sml = subMeshes.length; sm < sml; sm++) {\r\n for (var i = subMeshes[sm].indexStart, il = subMeshes[sm].indexCount + subMeshes[sm].indexStart; i < il; i += 3) {\r\n vertices = [];\r\n for (var j = 0; j < 3; j++) {\r\n var sourceNormal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](normals[indices[i + j] * 3], normals[indices[i + j] * 3 + 1], normals[indices[i + j] * 3 + 2]);\r\n uv = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](uvs[indices[i + j] * 2], uvs[indices[i + j] * 2 + 1]);\r\n var sourcePosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](positions[indices[i + j] * 3], positions[indices[i + j] * 3 + 1], positions[indices[i + j] * 3 + 2]);\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(sourcePosition, matrix);\r\n normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(sourceNormal, matrix);\r\n vertex = new Vertex(position, normal, uv);\r\n vertices.push(vertex);\r\n }\r\n polygon = new Polygon(vertices, { subMeshId: sm, meshId: currentCSGMeshId, materialIndex: subMeshes[sm].materialIndex });\r\n // To handle the case of degenerated triangle\r\n // polygon.plane == null <=> the polygon does not represent 1 single plane <=> the triangle is degenerated\r\n if (polygon.plane) {\r\n polygons.push(polygon);\r\n }\r\n }\r\n }\r\n var csg = CSG.FromPolygons(polygons);\r\n csg.matrix = matrix;\r\n csg.position = meshPosition;\r\n csg.rotation = meshRotation;\r\n csg.scaling = meshScaling;\r\n csg.rotationQuaternion = meshRotationQuaternion;\r\n currentCSGMeshId++;\r\n return csg;\r\n };\r\n /**\r\n * Construct a CSG solid from a list of `CSG.Polygon` instances.\r\n * @param polygons Polygons used to construct a CSG solid\r\n */\r\n CSG.FromPolygons = function (polygons) {\r\n var csg = new CSG();\r\n csg.polygons = polygons;\r\n return csg;\r\n };\r\n /**\r\n * Clones, or makes a deep copy, of the CSG\r\n * @returns A new CSG\r\n */\r\n CSG.prototype.clone = function () {\r\n var csg = new CSG();\r\n csg.polygons = this.polygons.map(function (p) { return p.clone(); });\r\n csg.copyTransformAttributes(this);\r\n return csg;\r\n };\r\n /**\r\n * Unions this CSG with another CSG\r\n * @param csg The CSG to union against this CSG\r\n * @returns The unioned CSG\r\n */\r\n CSG.prototype.union = function (csg) {\r\n var a = new Node(this.clone().polygons);\r\n var b = new Node(csg.clone().polygons);\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n return CSG.FromPolygons(a.allPolygons()).copyTransformAttributes(this);\r\n };\r\n /**\r\n * Unions this CSG with another CSG in place\r\n * @param csg The CSG to union against this CSG\r\n */\r\n CSG.prototype.unionInPlace = function (csg) {\r\n var a = new Node(this.polygons);\r\n var b = new Node(csg.polygons);\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n this.polygons = a.allPolygons();\r\n };\r\n /**\r\n * Subtracts this CSG with another CSG\r\n * @param csg The CSG to subtract against this CSG\r\n * @returns A new CSG\r\n */\r\n CSG.prototype.subtract = function (csg) {\r\n var a = new Node(this.clone().polygons);\r\n var b = new Node(csg.clone().polygons);\r\n a.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n a.invert();\r\n return CSG.FromPolygons(a.allPolygons()).copyTransformAttributes(this);\r\n };\r\n /**\r\n * Subtracts this CSG with another CSG in place\r\n * @param csg The CSG to subtact against this CSG\r\n */\r\n CSG.prototype.subtractInPlace = function (csg) {\r\n var a = new Node(this.polygons);\r\n var b = new Node(csg.polygons);\r\n a.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n a.invert();\r\n this.polygons = a.allPolygons();\r\n };\r\n /**\r\n * Intersect this CSG with another CSG\r\n * @param csg The CSG to intersect against this CSG\r\n * @returns A new CSG\r\n */\r\n CSG.prototype.intersect = function (csg) {\r\n var a = new Node(this.clone().polygons);\r\n var b = new Node(csg.clone().polygons);\r\n a.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n a.build(b.allPolygons());\r\n a.invert();\r\n return CSG.FromPolygons(a.allPolygons()).copyTransformAttributes(this);\r\n };\r\n /**\r\n * Intersects this CSG with another CSG in place\r\n * @param csg The CSG to intersect against this CSG\r\n */\r\n CSG.prototype.intersectInPlace = function (csg) {\r\n var a = new Node(this.polygons);\r\n var b = new Node(csg.polygons);\r\n a.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n a.build(b.allPolygons());\r\n a.invert();\r\n this.polygons = a.allPolygons();\r\n };\r\n /**\r\n * Return a new CSG solid with solid and empty space switched. This solid is\r\n * not modified.\r\n * @returns A new CSG solid with solid and empty space switched\r\n */\r\n CSG.prototype.inverse = function () {\r\n var csg = this.clone();\r\n csg.inverseInPlace();\r\n return csg;\r\n };\r\n /**\r\n * Inverses the CSG in place\r\n */\r\n CSG.prototype.inverseInPlace = function () {\r\n this.polygons.map(function (p) { p.flip(); });\r\n };\r\n /**\r\n * This is used to keep meshes transformations so they can be restored\r\n * when we build back a Babylon Mesh\r\n * NB : All CSG operations are performed in world coordinates\r\n * @param csg The CSG to copy the transform attributes from\r\n * @returns This CSG\r\n */\r\n CSG.prototype.copyTransformAttributes = function (csg) {\r\n this.matrix = csg.matrix;\r\n this.position = csg.position;\r\n this.rotation = csg.rotation;\r\n this.scaling = csg.scaling;\r\n this.rotationQuaternion = csg.rotationQuaternion;\r\n return this;\r\n };\r\n /**\r\n * Build Raw mesh from CSG\r\n * Coordinates here are in world space\r\n * @param name The name of the mesh geometry\r\n * @param scene The Scene\r\n * @param keepSubMeshes Specifies if the submeshes should be kept\r\n * @returns A new Mesh\r\n */\r\n CSG.prototype.buildMeshGeometry = function (name, scene, keepSubMeshes) {\r\n var matrix = this.matrix.clone();\r\n matrix.invert();\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"](name, scene), vertices = [], indices = [], normals = [], uvs = [], vertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), uv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero(), polygons = this.polygons, polygonIndices = [0, 0, 0], polygon, vertice_dict = {}, vertex_idx, currentIndex = 0, subMesh_dict = {}, subMesh_obj;\r\n if (keepSubMeshes) {\r\n // Sort Polygons, since subMeshes are indices range\r\n polygons.sort(function (a, b) {\r\n if (a.shared.meshId === b.shared.meshId) {\r\n return a.shared.subMeshId - b.shared.subMeshId;\r\n }\r\n else {\r\n return a.shared.meshId - b.shared.meshId;\r\n }\r\n });\r\n }\r\n for (var i = 0, il = polygons.length; i < il; i++) {\r\n polygon = polygons[i];\r\n // Building SubMeshes\r\n if (!subMesh_dict[polygon.shared.meshId]) {\r\n subMesh_dict[polygon.shared.meshId] = {};\r\n }\r\n if (!subMesh_dict[polygon.shared.meshId][polygon.shared.subMeshId]) {\r\n subMesh_dict[polygon.shared.meshId][polygon.shared.subMeshId] = {\r\n indexStart: +Infinity,\r\n indexEnd: -Infinity,\r\n materialIndex: polygon.shared.materialIndex\r\n };\r\n }\r\n subMesh_obj = subMesh_dict[polygon.shared.meshId][polygon.shared.subMeshId];\r\n for (var j = 2, jl = polygon.vertices.length; j < jl; j++) {\r\n polygonIndices[0] = 0;\r\n polygonIndices[1] = j - 1;\r\n polygonIndices[2] = j;\r\n for (var k = 0; k < 3; k++) {\r\n vertex.copyFrom(polygon.vertices[polygonIndices[k]].pos);\r\n normal.copyFrom(polygon.vertices[polygonIndices[k]].normal);\r\n uv.copyFrom(polygon.vertices[polygonIndices[k]].uv);\r\n var localVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(vertex, matrix);\r\n var localNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(normal, matrix);\r\n vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z];\r\n // Check if 2 points can be merged\r\n if (!(typeof vertex_idx !== 'undefined' &&\r\n normals[vertex_idx * 3] === localNormal.x &&\r\n normals[vertex_idx * 3 + 1] === localNormal.y &&\r\n normals[vertex_idx * 3 + 2] === localNormal.z &&\r\n uvs[vertex_idx * 2] === uv.x &&\r\n uvs[vertex_idx * 2 + 1] === uv.y)) {\r\n vertices.push(localVertex.x, localVertex.y, localVertex.z);\r\n uvs.push(uv.x, uv.y);\r\n normals.push(normal.x, normal.y, normal.z);\r\n vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z] = (vertices.length / 3) - 1;\r\n }\r\n indices.push(vertex_idx);\r\n subMesh_obj.indexStart = Math.min(currentIndex, subMesh_obj.indexStart);\r\n subMesh_obj.indexEnd = Math.max(currentIndex, subMesh_obj.indexEnd);\r\n currentIndex++;\r\n }\r\n }\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, vertices);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, normals);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, uvs);\r\n mesh.setIndices(indices, null);\r\n if (keepSubMeshes) {\r\n // We offset the materialIndex by the previous number of materials in the CSG mixed meshes\r\n var materialIndexOffset = 0, materialMaxIndex;\r\n mesh.subMeshes = new Array();\r\n for (var m in subMesh_dict) {\r\n materialMaxIndex = -1;\r\n for (var sm in subMesh_dict[m]) {\r\n subMesh_obj = subMesh_dict[m][sm];\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__[\"SubMesh\"].CreateFromIndices(subMesh_obj.materialIndex + materialIndexOffset, subMesh_obj.indexStart, subMesh_obj.indexEnd - subMesh_obj.indexStart + 1, mesh);\r\n materialMaxIndex = Math.max(subMesh_obj.materialIndex, materialMaxIndex);\r\n }\r\n materialIndexOffset += ++materialMaxIndex;\r\n }\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Build Mesh from CSG taking material and transforms into account\r\n * @param name The name of the Mesh\r\n * @param material The material of the Mesh\r\n * @param scene The Scene\r\n * @param keepSubMeshes Specifies if submeshes should be kept\r\n * @returns The new Mesh\r\n */\r\n CSG.prototype.toMesh = function (name, material, scene, keepSubMeshes) {\r\n if (material === void 0) { material = null; }\r\n var mesh = this.buildMeshGeometry(name, scene, keepSubMeshes);\r\n mesh.material = material;\r\n mesh.position.copyFrom(this.position);\r\n mesh.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n mesh.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n mesh.scaling.copyFrom(this.scaling);\r\n mesh.computeWorldMatrix(true);\r\n return mesh;\r\n };\r\n return CSG;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/dataBuffer.ts\":\n/*!******************************!*\\\n !*** ./Meshes/dataBuffer.ts ***!\n \\******************************/\n/*! exports provided: DataBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return DataBuffer; });\n/**\r\n * Class used to store gfx data (like WebGLBuffer)\r\n */\r\nvar DataBuffer = /** @class */ (function () {\r\n function DataBuffer() {\r\n /**\r\n * Gets or sets the number of objects referencing this buffer\r\n */\r\n this.references = 0;\r\n /** Gets or sets the size of the underlying buffer */\r\n this.capacity = 0;\r\n /**\r\n * Gets or sets a boolean indicating if the buffer contains 32bits indices\r\n */\r\n this.is32Bits = false;\r\n }\r\n Object.defineProperty(DataBuffer.prototype, \"underlyingResource\", {\r\n /**\r\n * Gets the underlying buffer\r\n */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DataBuffer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/geometry.ts\":\n/*!****************************!*\\\n !*** ./Meshes/geometry.ts ***!\n \\****************************/\n/*! exports provided: Geometry */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return Geometry; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Loading/sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_functions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.functions */ \"./Maths/math.functions.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nvar Geometry = /** @class */ (function () {\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n */\r\n function Geometry(id, scene, vertexData, updatable, mesh) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (mesh === void 0) { mesh = null; }\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n this._totalVertices = 0;\r\n this._isDisposed = false;\r\n this._indexBufferIsUpdatable = false;\r\n this.id = id;\r\n this.uniqueId = scene.getUniqueId();\r\n this._engine = scene.getEngine();\r\n this._meshes = [];\r\n this._scene = scene;\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n }\r\n else {\r\n this._totalVertices = 0;\r\n this._indices = [];\r\n }\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n Object.defineProperty(Geometry.prototype, \"boundingBias\", {\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n get: function () {\r\n return this._boundingBias;\r\n },\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n set: function (value) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n }\r\n else {\r\n this._boundingBias = value.clone();\r\n }\r\n this._updateBoundingInfo(true, null);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n Geometry.CreateGeometryForMesh = function (mesh) {\r\n var geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n geometry.applyToMesh(mesh);\r\n return geometry;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"extend\", {\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n get: function () {\r\n return this._extend;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n Geometry.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n Geometry.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n Geometry.prototype.isReady = function () {\r\n return this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADED || this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"doNotSerialize\", {\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n get: function () {\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Geometry.prototype._rebuild = function () {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n // Vertex buffers\r\n for (var key in this._vertexBuffers) {\r\n var vertexBuffer = this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n };\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n Geometry.prototype.setAllVerticesData = function (vertexData, updatable) {\r\n vertexData.applyToGeometry(this, updatable);\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n Geometry.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n var buffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"](this._engine, data, kind, updatable, this._meshes.length === 0, stride);\r\n this.setVerticesBuffer(buffer);\r\n };\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n Geometry.prototype.removeVerticesData = function (kind) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n };\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n */\r\n Geometry.prototype.setVerticesBuffer = function (buffer, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n var kind = buffer.getKind();\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers[kind] = buffer;\r\n if (kind === _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind) {\r\n var data = buffer.getData();\r\n if (totalVertices != null) {\r\n this._totalVertices = totalVertices;\r\n }\r\n else {\r\n if (data != null) {\r\n this._totalVertices = data.length / (buffer.byteStride / 4);\r\n }\r\n }\r\n this._updateExtend(data);\r\n this._resetPointsArrayCache();\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n var mesh = meshes[index];\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n this.notifyUpdate(kind);\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n }\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Geometry.prototype.updateVerticesDataDirectly = function (kind, data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this.notifyUpdate(kind);\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n Geometry.prototype.updateVerticesData = function (kind, data, updateExtends) {\r\n if (updateExtends === void 0) { updateExtends = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.update(data);\r\n if (kind === _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this.notifyUpdate(kind);\r\n };\r\n Geometry.prototype._updateBoundingInfo = function (updateExtends, data) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n this._resetPointsArrayCache();\r\n if (updateExtends) {\r\n var meshes = this._meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (mesh._boundingInfo) {\r\n mesh._boundingInfo.reConstruct(this._extend.minimum, this._extend.maximum);\r\n }\r\n else {\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n }\r\n var subMeshes = mesh.subMeshes;\r\n for (var _a = 0, subMeshes_1 = subMeshes; _a < subMeshes_1.length; _a++) {\r\n var subMesh = subMeshes_1[_a];\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Geometry.prototype._bind = function (effect, indexToBind) {\r\n if (!effect) {\r\n return;\r\n }\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n var vbs = this.getVertexBuffers();\r\n if (!vbs) {\r\n return;\r\n }\r\n if (indexToBind != this._indexBuffer || !this._vertexArrayObjects) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect);\r\n return;\r\n }\r\n // Using VAO\r\n if (!this._vertexArrayObjects[effect.key]) {\r\n this._vertexArrayObjects[effect.key] = this._engine.recordVertexArrayObject(vbs, indexToBind, effect);\r\n }\r\n this._engine.bindVertexArrayObject(this._vertexArrayObjects[effect.key], indexToBind);\r\n };\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n Geometry.prototype.getTotalVertices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._totalVertices;\r\n };\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n Geometry.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n var data = vertexBuffer.getData();\r\n if (!data) {\r\n return null;\r\n }\r\n var tightlyPackedByteStride = vertexBuffer.getSize() * _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].GetTypeByteLength(vertexBuffer.type);\r\n var count = this._totalVertices * vertexBuffer.getSize();\r\n if (vertexBuffer.type !== _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {\r\n var copy_1 = [];\r\n vertexBuffer.forEach(count, function (value) { return copy_1.push(value); });\r\n return copy_1;\r\n }\r\n if (!((data instanceof Array) || (data instanceof Float32Array)) || vertexBuffer.byteOffset !== 0 || data.length !== count) {\r\n if (data instanceof Array) {\r\n var offset = vertexBuffer.byteOffset / 4;\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_8__[\"Tools\"].Slice(data, offset, offset + count);\r\n }\r\n else if (data instanceof ArrayBuffer) {\r\n return new Float32Array(data, vertexBuffer.byteOffset, count);\r\n }\r\n else {\r\n var offset = data.byteOffset + vertexBuffer.byteOffset;\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n var result = new Float32Array(count);\r\n var source = new Float32Array(data.buffer, offset, count);\r\n result.set(source);\r\n return result;\r\n }\r\n return new Float32Array(data.buffer, offset, count);\r\n }\r\n }\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_8__[\"Tools\"].Slice(data);\r\n }\r\n return data;\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n Geometry.prototype.isVertexBufferUpdatable = function (kind) {\r\n var vb = this._vertexBuffers[kind];\r\n if (!vb) {\r\n return false;\r\n }\r\n return vb.isUpdatable();\r\n };\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n Geometry.prototype.getVertexBuffer = function (kind) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n };\r\n /**\r\n * Returns all vertex buffers\r\n * @return an object holding all vertex buffers indexed by kind\r\n */\r\n Geometry.prototype.getVertexBuffers = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n Geometry.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n };\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n Geometry.prototype.getVerticesDataKinds = function () {\r\n var result = [];\r\n var kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n }\r\n else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n Geometry.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n }\r\n else {\r\n var needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n */\r\n Geometry.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._disposeVertexArrayObjects();\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable);\r\n }\r\n if (totalVertices != undefined) { // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n Geometry.prototype.getTotalIndices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._indices.length;\r\n };\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n Geometry.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n var orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n }\r\n else {\r\n var len = orig.length;\r\n var copy = [];\r\n for (var i = 0; i < len; i++) {\r\n copy.push(orig[i]);\r\n }\r\n return copy;\r\n }\r\n };\r\n /**\r\n * Gets the index buffer\r\n * @return the index buffer\r\n */\r\n Geometry.prototype.getIndexBuffer = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._releaseVertexArrayObject = function (effect) {\r\n if (effect === void 0) { effect = null; }\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n if (this._vertexArrayObjects[effect.key]) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n };\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n Geometry.prototype.releaseForMesh = function (mesh, shouldDispose) {\r\n var meshes = this._meshes;\r\n var index = meshes.indexOf(mesh);\r\n if (index === -1) {\r\n return;\r\n }\r\n meshes.splice(index, 1);\r\n mesh._geometry = null;\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n };\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n Geometry.prototype.applyToMesh = function (mesh) {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n var previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n var meshes = this._meshes;\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n this._scene.pushGeometry(this);\r\n meshes.push(mesh);\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n }\r\n else {\r\n mesh._boundingInfo = this._boundingInfo;\r\n }\r\n };\r\n Geometry.prototype._updateExtend = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (!data) {\r\n data = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind);\r\n }\r\n this._extend = Object(_Maths_math_functions__WEBPACK_IMPORTED_MODULE_10__[\"extractMinAndMax\"])(data, 0, this._totalVertices, this.boundingBias, 3);\r\n };\r\n Geometry.prototype._applyToMesh = function (mesh) {\r\n var numOfMeshes = this._meshes.length;\r\n // vertexBuffers\r\n for (var kind in this._vertexBuffers) {\r\n if (numOfMeshes === 1) {\r\n this._vertexBuffers[kind].create();\r\n }\r\n var buffer = this._vertexBuffers[kind].getBuffer();\r\n if (buffer) {\r\n buffer.references = numOfMeshes;\r\n }\r\n if (kind === _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n // indexBuffer\r\n if (numOfMeshes === 1 && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n if (this._indexBuffer) {\r\n this._indexBuffer.references = numOfMeshes;\r\n }\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n // instances\r\n mesh.synchronizeInstances();\r\n };\r\n Geometry.prototype.notifyUpdate = function (kind) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n };\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n Geometry.prototype.load = function (scene, onLoaded) {\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return;\r\n }\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADING;\r\n this._queueLoad(scene, onLoaded);\r\n };\r\n Geometry.prototype._queueLoad = function (scene, onLoaded) {\r\n var _this = this;\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n scene._addPendingData(this);\r\n scene._loadFile(this.delayLoadingFile, function (data) {\r\n if (!_this._delayLoadingFunction) {\r\n return;\r\n }\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n _this._delayInfo = [];\r\n scene._removePendingData(_this);\r\n var meshes = _this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n _this._applyToMesh(meshes[index]);\r\n }\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n }, undefined, true);\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n Geometry.prototype.toLeftHanded = function () {\r\n // Flip faces\r\n var tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (var i = 0; i < tIndices.length; i += 3) {\r\n var tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n // Negate position.z\r\n var tPositions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (var i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, tPositions, false);\r\n }\r\n // Negate normal.z\r\n var tNormals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (var i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, tNormals, false);\r\n }\r\n };\r\n // Cache\r\n /** @hidden */\r\n Geometry.prototype._resetPointsArrayCache = function () {\r\n this._positions = null;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._generatePointsArray = function () {\r\n if (this._positions) {\r\n return true;\r\n }\r\n var data = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind);\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n this._positions = [];\r\n for (var index = 0; index < data.length; index += 3) {\r\n this._positions.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(data, index));\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n Geometry.prototype.isDisposed = function () {\r\n return this._isDisposed;\r\n };\r\n Geometry.prototype._disposeVertexArrayObjects = function () {\r\n if (this._vertexArrayObjects) {\r\n for (var kind in this._vertexArrayObjects) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {};\r\n }\r\n };\r\n /**\r\n * Free all associated resources\r\n */\r\n Geometry.prototype.dispose = function () {\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n var index;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes = [];\r\n this._disposeVertexArrayObjects();\r\n for (var kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n this._boundingInfo = null;\r\n this._scene.removeGeometry(this);\r\n this._isDisposed = true;\r\n };\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n Geometry.prototype.copy = function (id) {\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = [];\r\n var indices = this.getIndices();\r\n if (indices) {\r\n for (var index = 0; index < indices.length; index++) {\r\n vertexData.indices.push(indices[index]);\r\n }\r\n }\r\n var updatable = false;\r\n var stopChecking = false;\r\n var kind;\r\n for (kind in this._vertexBuffers) {\r\n // using slice() to make a copy of the array and not just reference it\r\n var data = this.getVerticesData(kind);\r\n if (data) {\r\n if (data instanceof Float32Array) {\r\n vertexData.set(new Float32Array(data), kind);\r\n }\r\n else {\r\n vertexData.set(data.slice(0), kind);\r\n }\r\n if (!stopChecking) {\r\n var vb = this.getVertexBuffer(kind);\r\n if (vb) {\r\n updatable = vb.isUpdatable();\r\n stopChecking = !updatable;\r\n }\r\n }\r\n }\r\n }\r\n var geometry = new Geometry(id, this._scene, vertexData, updatable);\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n // Bounding info\r\n geometry._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n return geometry;\r\n };\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @return a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n Geometry.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.id;\r\n serializationObject.updatable = this._updatable;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"].HasTags(this)) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"].GetTags(this);\r\n }\r\n return serializationObject;\r\n };\r\n Geometry.prototype.toNumberArray = function (origin) {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n }\r\n else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n };\r\n /**\r\n * Serialize all vertices data into a JSON oject\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n Geometry.prototype.serializeVerticeData = function () {\r\n var serializationObject = this.serialize();\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind)) {\r\n serializationObject.positions = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind)) {\r\n serializationObject.positions._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n serializationObject.normals = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n serializationObject.normals._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n serializationObject.tangets = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n serializationObject.tangets._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n serializationObject.uvs = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n serializationObject.uvs._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind)) {\r\n serializationObject.uv2s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind)) {\r\n serializationObject.uv2s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind)) {\r\n serializationObject.uv3s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind)) {\r\n serializationObject.uv3s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind)) {\r\n serializationObject.uv4s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind)) {\r\n serializationObject.uv4s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind)) {\r\n serializationObject.uv5s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind)) {\r\n serializationObject.uv5s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind)) {\r\n serializationObject.uv6s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind)) {\r\n serializationObject.uv6s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind)) {\r\n serializationObject.colors = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind)) {\r\n serializationObject.colors._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind));\r\n serializationObject.matricesIndices._isExpanded = true;\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n serializationObject.matricesIndices._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n serializationObject.matricesWeights._updatable = true;\r\n }\r\n }\r\n serializationObject.indices = this.toNumberArray(this.getIndices());\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n Geometry.ExtractFromMesh = function (mesh, id) {\r\n var geometry = mesh._geometry;\r\n if (!geometry) {\r\n return null;\r\n }\r\n return geometry.copy(id);\r\n };\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n Geometry.RandomId = function () {\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_8__[\"Tools\"].RandomId();\r\n };\r\n /** @hidden */\r\n Geometry._ImportGeometry = function (parsedGeometry, mesh) {\r\n var scene = mesh.getScene();\r\n // Geometry\r\n var geometryId = parsedGeometry.geometryId;\r\n if (geometryId) {\r\n var geometry = scene.getGeometryByID(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n }\r\n else if (parsedGeometry instanceof ArrayBuffer) {\r\n var binaryInfo = mesh._binaryInfo;\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n var positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, positionsData, false);\r\n }\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n var normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, normalsData, false);\r\n }\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n var tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind, tangentsData, false);\r\n }\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n var uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind, uvsData, false);\r\n }\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n var uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind, uvs2Data, false);\r\n }\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n var uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind, uvs3Data, false);\r\n }\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n var uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind, uvs4Data, false);\r\n }\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n var uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind, uvs5Data, false);\r\n }\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n var uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind, uvs6Data, false);\r\n }\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n var colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n var matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n var floatIndices = [];\r\n for (var i = 0; i < matricesIndicesData.length; i++) {\r\n var index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000FF);\r\n floatIndices.push((index & 0x0000FF00) >> 8);\r\n floatIndices.push((index & 0x00FF0000) >> 16);\r\n floatIndices.push(index >> 24);\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, floatIndices, false);\r\n }\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n var matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n var indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n var subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n mesh.subMeshes = [];\r\n for (var i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n var materialIndex = subMeshesData[(i * 5) + 0];\r\n var verticesStart = subMeshesData[(i * 5) + 1];\r\n var verticesCount = subMeshesData[(i * 5) + 2];\r\n var indexStart = subMeshesData[(i * 5) + 3];\r\n var indexCount = subMeshesData[(i * 5) + 4];\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_4__[\"SubMesh\"].AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh);\r\n }\r\n }\r\n }\r\n else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable);\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable);\r\n }\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable);\r\n }\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable);\r\n }\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable);\r\n }\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable);\r\n }\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable);\r\n }\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable);\r\n }\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind, _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"].CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndices[i];\r\n floatIndices.push(matricesIndex & 0x000000FF);\r\n floatIndices.push((matricesIndex & 0x0000FF00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00FF0000) >> 16);\r\n floatIndices.push(matricesIndex >> 24);\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!parsedGeometry.matricesIndicesExtra._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n floatIndices.push(matricesIndex & 0x000000FF);\r\n floatIndices.push((matricesIndex & 0x0000FF00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00FF0000) >> 16);\r\n floatIndices.push(matricesIndex >> 24);\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (var subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n var parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_4__[\"SubMesh\"].AddToMesh(parsedSubMesh.materialIndex, parsedSubMesh.verticesStart, parsedSubMesh.verticesCount, parsedSubMesh.indexStart, parsedSubMesh.indexCount, mesh);\r\n }\r\n }\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n delete mesh._shouldGenerateFlatShading;\r\n }\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n scene.onMeshImportedObservable.notifyObservers(mesh);\r\n };\r\n Geometry._CleanMatricesWeights = function (parsedGeometry, mesh) {\r\n var epsilon = 1e-3;\r\n if (!_Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_5__[\"SceneLoaderFlags\"].CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n var noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n var skeleton = mesh.getScene().getLastSkeletonByID(parsedGeometry.skeletonId);\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n }\r\n else {\r\n return;\r\n }\r\n var matricesIndices = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesIndicesExtra = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n var matricesWeights = parsedGeometry.matricesWeights;\r\n var matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n var influencers = parsedGeometry.numBoneInfluencer;\r\n var size = matricesWeights.length;\r\n for (var i = 0; i < size; i += 4) {\r\n var weight = 0.0;\r\n var firstZeroWeight = -1;\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > (influencers - 1)) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n var mweight = 1.0 / weight;\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n }\r\n else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n }\r\n else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n };\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n Geometry.Parse = function (parsedVertexData, scene, rootUrl) {\r\n if (scene.getGeometryByID(parsedVertexData.id)) {\r\n return null; // null since geometry could be something else than a box...\r\n }\r\n var geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"].AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(parsedVertexData.boundingBoxMinimum), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(parsedVertexData.boundingBoxMaximum));\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind);\r\n }\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind);\r\n }\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind);\r\n }\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind);\r\n }\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind);\r\n }\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n }\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n }\r\n geometry._delayLoadingFunction = _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].ImportVertexData;\r\n }\r\n else {\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].ImportVertexData(parsedVertexData, geometry);\r\n }\r\n scene.pushGeometry(geometry, true);\r\n return geometry;\r\n };\r\n return Geometry;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/groundMesh.ts\":\n/*!******************************!*\\\n !*** ./Meshes/groundMesh.ts ***!\n \\******************************/\n/*! exports provided: GroundMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return GroundMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n\r\n\r\n\r\n\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]._GroundMeshParser = function (parsedMesh, scene) {\r\n return GroundMesh.Parse(parsedMesh, scene);\r\n};\r\n/**\r\n * Mesh representing the gorund\r\n */\r\nvar GroundMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GroundMesh, _super);\r\n function GroundMesh(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /** If octree should be generated */\r\n _this.generateOctree = false;\r\n return _this;\r\n }\r\n /**\r\n * \"GroundMesh\"\r\n * @returns \"GroundMesh\"\r\n */\r\n GroundMesh.prototype.getClassName = function () {\r\n return \"GroundMesh\";\r\n };\r\n Object.defineProperty(GroundMesh.prototype, \"subdivisions\", {\r\n /**\r\n * The minimum of x and y subdivisions\r\n */\r\n get: function () {\r\n return Math.min(this._subdivisionsX, this._subdivisionsY);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GroundMesh.prototype, \"subdivisionsX\", {\r\n /**\r\n * X subdivisions\r\n */\r\n get: function () {\r\n return this._subdivisionsX;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GroundMesh.prototype, \"subdivisionsY\", {\r\n /**\r\n * Y subdivisions\r\n */\r\n get: function () {\r\n return this._subdivisionsY;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This function will update an octree to help to select the right submeshes for rendering, picking and collision computations.\r\n * Please note that you must have a decent number of submeshes to get performance improvements when using an octree\r\n * @param chunksCount the number of subdivisions for x and y\r\n * @param octreeBlocksSize (Default: 32)\r\n */\r\n GroundMesh.prototype.optimize = function (chunksCount, octreeBlocksSize) {\r\n if (octreeBlocksSize === void 0) { octreeBlocksSize = 32; }\r\n this._subdivisionsX = chunksCount;\r\n this._subdivisionsY = chunksCount;\r\n this.subdivide(chunksCount);\r\n // Call the octree system optimization if it is defined.\r\n var thisAsAny = this;\r\n if (thisAsAny.createOrUpdateSubmeshesOctree) {\r\n thisAsAny.createOrUpdateSubmeshesOctree(octreeBlocksSize);\r\n }\r\n };\r\n /**\r\n * Returns a height (y) value in the Worl system :\r\n * the ground altitude at the coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns the ground y position if (x, z) are outside the ground surface.\r\n */\r\n GroundMesh.prototype.getHeightAtCoordinates = function (x, z) {\r\n var world = this.getWorldMatrix();\r\n var invMat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[5];\r\n world.invertToRef(invMat);\r\n var tmpVect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[8];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, 0.0, z, invMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\r\n return this.position.y;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n var facet = this._getFacetAt(x, z);\r\n var y = -(facet.x * x + facet.z * z + facet.w) / facet.y;\r\n // return y in the World system\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(0.0, y, 0.0, world, tmpVect);\r\n return tmpVect.y;\r\n };\r\n /**\r\n * Returns a normalized vector (Vector3) orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.\r\n */\r\n GroundMesh.prototype.getNormalAtCoordinates = function (x, z) {\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.0, 1.0, 0.0);\r\n this.getNormalAtCoordinatesToRef(x, z, normal);\r\n return normal;\r\n };\r\n /**\r\n * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @param ref vector to store the result\r\n * @returns the GroundMesh.\r\n */\r\n GroundMesh.prototype.getNormalAtCoordinatesToRef = function (x, z, ref) {\r\n var world = this.getWorldMatrix();\r\n var tmpMat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[5];\r\n world.invertToRef(tmpMat);\r\n var tmpVect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[8];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, 0.0, z, tmpMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\r\n return this;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n var facet = this._getFacetAt(x, z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(facet.x, facet.y, facet.z, world, ref);\r\n return this;\r\n };\r\n /**\r\n * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()\r\n * if the ground has been updated.\r\n * This can be used in the render loop.\r\n * @returns the GroundMesh.\r\n */\r\n GroundMesh.prototype.updateCoordinateHeights = function () {\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n }\r\n this._computeHeightQuads();\r\n return this;\r\n };\r\n // Returns the element \"facet\" from the heightQuads array relative to (x, z) local coordinates\r\n GroundMesh.prototype._getFacetAt = function (x, z) {\r\n // retrieve col and row from x, z coordinates in the ground local system\r\n var col = Math.floor((x + this._maxX) * this._subdivisionsX / this._width);\r\n var row = Math.floor(-(z + this._maxZ) * this._subdivisionsY / this._height + this._subdivisionsY);\r\n var quad = this._heightQuads[row * this._subdivisionsX + col];\r\n var facet;\r\n if (z < quad.slope.x * x + quad.slope.y) {\r\n facet = quad.facet1;\r\n }\r\n else {\r\n facet = quad.facet2;\r\n }\r\n return facet;\r\n };\r\n // Creates and populates the heightMap array with \"facet\" elements :\r\n // a quad is two triangular facets separated by a slope, so a \"facet\" element is 1 slope + 2 facets\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting appart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n GroundMesh.prototype._initHeightQuads = function () {\r\n var subdivisionsX = this._subdivisionsX;\r\n var subdivisionsY = this._subdivisionsY;\r\n this._heightQuads = new Array();\r\n for (var row = 0; row < subdivisionsY; row++) {\r\n for (var col = 0; col < subdivisionsX; col++) {\r\n var quad = { slope: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].Zero(), facet1: new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"](0.0, 0.0, 0.0, 0.0), facet2: new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"](0.0, 0.0, 0.0, 0.0) };\r\n this._heightQuads[row * subdivisionsX + col] = quad;\r\n }\r\n }\r\n return this;\r\n };\r\n // Compute each quad element values and update the the heightMap array :\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting appart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n GroundMesh.prototype._computeHeightQuads = function () {\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n if (!positions) {\r\n return this;\r\n }\r\n var v1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[3];\r\n var v2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[2];\r\n var v3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[1];\r\n var v4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[0];\r\n var v1v2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[4];\r\n var v1v3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[5];\r\n var v1v4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[6];\r\n var norm1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[7];\r\n var norm2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[8];\r\n var i = 0;\r\n var j = 0;\r\n var k = 0;\r\n var cd = 0; // 2D slope coefficient : z = cd * x + h\r\n var h = 0;\r\n var d1 = 0; // facet plane equation : ax + by + cz + d = 0\r\n var d2 = 0;\r\n var subdivisionsX = this._subdivisionsX;\r\n var subdivisionsY = this._subdivisionsY;\r\n for (var row = 0; row < subdivisionsY; row++) {\r\n for (var col = 0; col < subdivisionsX; col++) {\r\n i = col * 3;\r\n j = row * (subdivisionsX + 1) * 3;\r\n k = (row + 1) * (subdivisionsX + 1) * 3;\r\n v1.x = positions[j + i];\r\n v1.y = positions[j + i + 1];\r\n v1.z = positions[j + i + 2];\r\n v2.x = positions[j + i + 3];\r\n v2.y = positions[j + i + 4];\r\n v2.z = positions[j + i + 5];\r\n v3.x = positions[k + i];\r\n v3.y = positions[k + i + 1];\r\n v3.z = positions[k + i + 2];\r\n v4.x = positions[k + i + 3];\r\n v4.y = positions[k + i + 4];\r\n v4.z = positions[k + i + 5];\r\n // 2D slope V1V4\r\n cd = (v4.z - v1.z) / (v4.x - v1.x);\r\n h = v1.z - cd * v1.x; // v1 belongs to the slope\r\n // facet equations :\r\n // we compute each facet normal vector\r\n // the equation of the facet plane is : norm.x * x + norm.y * y + norm.z * z + d = 0\r\n // we compute the value d by applying the equation to v1 which belongs to the plane\r\n // then we store the facet equation in a Vector4\r\n v2.subtractToRef(v1, v1v2);\r\n v3.subtractToRef(v1, v1v3);\r\n v4.subtractToRef(v1, v1v4);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(v1v4, v1v3, norm1); // caution : CrossToRef uses the Tmp class\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(v1v2, v1v4, norm2);\r\n norm1.normalize();\r\n norm2.normalize();\r\n d1 = -(norm1.x * v1.x + norm1.y * v1.y + norm1.z * v1.z);\r\n d2 = -(norm2.x * v2.x + norm2.y * v2.y + norm2.z * v2.z);\r\n var quad = this._heightQuads[row * subdivisionsX + col];\r\n quad.slope.copyFromFloats(cd, h);\r\n quad.facet1.copyFromFloats(norm1.x, norm1.y, norm1.z, d1);\r\n quad.facet2.copyFromFloats(norm2.x, norm2.y, norm2.z, d2);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Serializes this ground mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n GroundMesh.prototype.serialize = function (serializationObject) {\r\n _super.prototype.serialize.call(this, serializationObject);\r\n serializationObject.subdivisionsX = this._subdivisionsX;\r\n serializationObject.subdivisionsY = this._subdivisionsY;\r\n serializationObject.minX = this._minX;\r\n serializationObject.maxX = this._maxX;\r\n serializationObject.minZ = this._minZ;\r\n serializationObject.maxZ = this._maxZ;\r\n serializationObject.width = this._width;\r\n serializationObject.height = this._height;\r\n };\r\n /**\r\n * Parses a serialized ground mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the ground mesh in\r\n * @returns the created ground mesh\r\n */\r\n GroundMesh.Parse = function (parsedMesh, scene) {\r\n var result = new GroundMesh(parsedMesh.name, scene);\r\n result._subdivisionsX = parsedMesh.subdivisionsX || 1;\r\n result._subdivisionsY = parsedMesh.subdivisionsY || 1;\r\n result._minX = parsedMesh.minX;\r\n result._maxX = parsedMesh.maxX;\r\n result._minZ = parsedMesh.minZ;\r\n result._maxZ = parsedMesh.maxZ;\r\n result._width = parsedMesh.width;\r\n result._height = parsedMesh.height;\r\n return result;\r\n };\r\n return GroundMesh;\r\n}(_Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/index.ts\":\n/*!*************************!*\\\n !*** ./Meshes/index.ts ***!\n \\*************************/\n/*! exports provided: AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _abstractMesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return _abstractMesh__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"]; });\n\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buffer */ \"./Meshes/buffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return _buffer__WEBPACK_IMPORTED_MODULE_1__[\"Buffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return _buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"]; });\n\n/* harmony import */ var _Compression_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Compression/index */ \"./Meshes/Compression/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _Compression_index__WEBPACK_IMPORTED_MODULE_2__[\"DracoCompression\"]; });\n\n/* harmony import */ var _csg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./csg */ \"./Meshes/csg.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return _csg__WEBPACK_IMPORTED_MODULE_3__[\"CSG\"]; });\n\n/* harmony import */ var _geometry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./geometry */ \"./Meshes/geometry.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return _geometry__WEBPACK_IMPORTED_MODULE_4__[\"Geometry\"]; });\n\n/* harmony import */ var _groundMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./groundMesh */ \"./Meshes/groundMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return _groundMesh__WEBPACK_IMPORTED_MODULE_5__[\"GroundMesh\"]; });\n\n/* harmony import */ var _trailMesh__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./trailMesh */ \"./Meshes/trailMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return _trailMesh__WEBPACK_IMPORTED_MODULE_6__[\"TrailMesh\"]; });\n\n/* harmony import */ var _instancedMesh__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./instancedMesh */ \"./Meshes/instancedMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return _instancedMesh__WEBPACK_IMPORTED_MODULE_7__[\"InstancedMesh\"]; });\n\n/* harmony import */ var _linesMesh__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./linesMesh */ \"./Meshes/linesMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return _linesMesh__WEBPACK_IMPORTED_MODULE_8__[\"LinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return _linesMesh__WEBPACK_IMPORTED_MODULE_8__[\"InstancedLinesMesh\"]; });\n\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./mesh */ \"./Meshes/mesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _mesh__WEBPACK_IMPORTED_MODULE_9__[\"_CreationDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _mesh__WEBPACK_IMPORTED_MODULE_9__[\"_InstancesBatch\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return _mesh__WEBPACK_IMPORTED_MODULE_9__[\"Mesh\"]; });\n\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return _mesh_vertexData__WEBPACK_IMPORTED_MODULE_10__[\"VertexData\"]; });\n\n/* harmony import */ var _meshBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./meshBuilder */ \"./Meshes/meshBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return _meshBuilder__WEBPACK_IMPORTED_MODULE_11__[\"MeshBuilder\"]; });\n\n/* harmony import */ var _meshSimplification__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./meshSimplification */ \"./Meshes/meshSimplification.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return _meshSimplification__WEBPACK_IMPORTED_MODULE_12__[\"SimplificationSettings\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return _meshSimplification__WEBPACK_IMPORTED_MODULE_12__[\"SimplificationQueue\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return _meshSimplification__WEBPACK_IMPORTED_MODULE_12__[\"SimplificationType\"]; });\n\n/* harmony import */ var _meshSimplificationSceneComponent__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./meshSimplificationSceneComponent */ \"./Meshes/meshSimplificationSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return _meshSimplificationSceneComponent__WEBPACK_IMPORTED_MODULE_13__[\"SimplicationQueueSceneComponent\"]; });\n\n/* harmony import */ var _polygonMesh__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./polygonMesh */ \"./Meshes/polygonMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return _polygonMesh__WEBPACK_IMPORTED_MODULE_14__[\"Polygon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return _polygonMesh__WEBPACK_IMPORTED_MODULE_14__[\"PolygonMeshBuilder\"]; });\n\n/* harmony import */ var _subMesh__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return _subMesh__WEBPACK_IMPORTED_MODULE_15__[\"BaseSubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return _subMesh__WEBPACK_IMPORTED_MODULE_15__[\"SubMesh\"]; });\n\n/* harmony import */ var _meshLODLevel__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./meshLODLevel */ \"./Meshes/meshLODLevel.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return _meshLODLevel__WEBPACK_IMPORTED_MODULE_16__[\"MeshLODLevel\"]; });\n\n/* harmony import */ var _transformNode__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return _transformNode__WEBPACK_IMPORTED_MODULE_17__[\"TransformNode\"]; });\n\n/* harmony import */ var _Builders_index__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Builders/index */ \"./Meshes/Builders/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"BoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"SphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"CylinderBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TorusBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"LinesBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"PlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"GroundBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TiledBoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"DiscBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"RibbonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"HemisphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TorusKnotBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"PolygonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"ShapeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"LatheBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TiledPlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TubeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"PolyhedronBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"IcoSphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"DecalBuilder\"]; });\n\n/* harmony import */ var _dataBuffer__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./dataBuffer */ \"./Meshes/dataBuffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return _dataBuffer__WEBPACK_IMPORTED_MODULE_19__[\"DataBuffer\"]; });\n\n/* harmony import */ var _WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./WebGL/webGLDataBuffer */ \"./Meshes/WebGL/webGLDataBuffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return _WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_20__[\"WebGLDataBuffer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/instancedMesh.ts\":\n/*!*********************************!*\\\n !*** ./Meshes/instancedMesh.ts ***!\n \\*********************************/\n/*! exports provided: InstancedMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return InstancedMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _transformNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transformNode */ \"./Meshes/transformNode.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"]._instancedMeshFactory = function (name, mesh) {\r\n return new InstancedMesh(name, mesh);\r\n};\r\n/**\r\n * Creates an instance based on a source mesh.\r\n */\r\nvar InstancedMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InstancedMesh, _super);\r\n function InstancedMesh(name, source) {\r\n var _this = _super.call(this, name, source.getScene()) || this;\r\n /** @hidden */\r\n _this._indexInSourceMeshInstanceArray = -1;\r\n source.addInstance(_this);\r\n _this._sourceMesh = source;\r\n _this._unIndexed = source._unIndexed;\r\n _this.position.copyFrom(source.position);\r\n _this.rotation.copyFrom(source.rotation);\r\n _this.scaling.copyFrom(source.scaling);\r\n if (source.rotationQuaternion) {\r\n _this.rotationQuaternion = source.rotationQuaternion.clone();\r\n }\r\n _this.infiniteDistance = source.infiniteDistance;\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.refreshBoundingInfo();\r\n _this._syncSubMeshes();\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedMesh\".\r\n */\r\n InstancedMesh.prototype.getClassName = function () {\r\n return \"InstancedMesh\";\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._sourceMesh._lightSources;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InstancedMesh.prototype._resyncLightSources = function () {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._resyncLighSource = function (light) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._removeLightSource = function (light, dispose) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"receiveShadows\", {\r\n // Methods\r\n /**\r\n * If the source mesh receives shadows\r\n */\r\n get: function () {\r\n return this._sourceMesh.receiveShadows;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"material\", {\r\n /**\r\n * The material of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.material;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"visibility\", {\r\n /**\r\n * Visibility of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.visibility;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"skeleton\", {\r\n /**\r\n * Skeleton of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.skeleton;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"renderingGroupId\", {\r\n /**\r\n * Rendering ground id of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.renderingGroupId;\r\n },\r\n set: function (value) {\r\n if (!this._sourceMesh || value === this._sourceMesh.renderingGroupId) {\r\n return;\r\n }\r\n //no-op with warning\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Note - setting renderingGroupId of an instanced mesh has no effect on the scene\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices (integer).\r\n */\r\n InstancedMesh.prototype.getTotalVertices = function () {\r\n return this._sourceMesh ? this._sourceMesh.getTotalVertices() : 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n InstancedMesh.prototype.getTotalIndices = function () {\r\n return this._sourceMesh.getTotalIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"sourceMesh\", {\r\n /**\r\n * The source mesh of the instance\r\n */\r\n get: function () {\r\n return this._sourceMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return {boolean} is it ready\r\n */\r\n InstancedMesh.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n return this._sourceMesh.isReady(completeCheck, true);\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param kind kind of verticies to retreive (eg. positons, normals, uvs, etc.)\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc.\r\n */\r\n InstancedMesh.prototype.getVerticesData = function (kind, copyWhenShared) {\r\n return this._sourceMesh.getVerticesData(kind, copyWhenShared);\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.\r\n * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * No new underlying VertexBuffer object is created.\r\n * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.updateVerticesData(kind, data, updateExtends, makeItUnique);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Sets the mesh indices.\r\n * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * This method creates a new index buffer each call.\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setIndices = function (indices, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setIndices(indices, totalVertices);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Boolean : True if the mesh owns the requested kind of data.\r\n */\r\n InstancedMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return this._sourceMesh.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns an array of indices (IndicesArray).\r\n */\r\n InstancedMesh.prototype.getIndices = function () {\r\n return this._sourceMesh.getIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"_positions\", {\r\n get: function () {\r\n return this._sourceMesh._positions;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n InstancedMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this._sourceMesh.geometry ? this._sourceMesh.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._sourceMesh._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._preActivate = function () {\r\n if (this._currentLOD) {\r\n this._currentLOD._preActivate();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n if (!this._sourceMesh.subMeshes) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Instances should only be created for meshes with geometry.\");\r\n }\r\n if (this._currentLOD) {\r\n this._currentLOD._registerInstanceForRenderId(this, renderId);\r\n if (intermediateRendering) {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true;\r\n return true;\r\n }\r\n }\r\n else {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._postActivate = function () {\r\n if (this._edgesRenderer && this._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\r\n this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer);\r\n }\r\n };\r\n InstancedMesh.prototype.getWorldMatrix = function () {\r\n if (this._currentLOD && this._currentLOD.billboardMode !== _transformNode__WEBPACK_IMPORTED_MODULE_6__[\"TransformNode\"].BILLBOARDMODE_NONE && this._currentLOD._masterMesh !== this) {\r\n var tempMaster = this._currentLOD._masterMesh;\r\n this._currentLOD._masterMesh = this;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(true));\r\n this._currentLOD._masterMesh = tempMaster;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0];\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"isAnInstance\", {\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the current associated LOD AbstractMesh.\r\n */\r\n InstancedMesh.prototype.getLOD = function (camera) {\r\n if (!camera) {\r\n return this;\r\n }\r\n var boundingInfo = this.getBoundingInfo();\r\n this._currentLOD = this.sourceMesh.getLOD(camera, boundingInfo.boundingSphere);\r\n if (this._currentLOD === this.sourceMesh) {\r\n return this.sourceMesh;\r\n }\r\n return this._currentLOD;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._syncSubMeshes = function () {\r\n this.releaseSubMeshes();\r\n if (this._sourceMesh.subMeshes) {\r\n for (var index = 0; index < this._sourceMesh.subMeshes.length; index++) {\r\n this._sourceMesh.subMeshes[index].clone(this, this._sourceMesh);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._generatePointsArray = function () {\r\n return this._sourceMesh._generatePointsArray();\r\n };\r\n /**\r\n * Creates a new InstancedMesh from the current mesh.\r\n * - name (string) : the cloned mesh name\r\n * - newParent (optional Node) : the optional Node to parent the clone to.\r\n * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned.\r\n *\r\n * Returns the clone.\r\n */\r\n InstancedMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n var result = this._sourceMesh.createInstance(name);\r\n // Deep copy\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_5__[\"DeepCopier\"].DeepCopy(this, result, [\"name\", \"subMeshes\", \"uniqueId\"], []);\r\n // Bounding info\r\n this.refreshBoundingInfo();\r\n // Parent\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n for (var index = 0; index < this.getScene().meshes.length; index++) {\r\n var mesh = this.getScene().meshes[index];\r\n if (mesh.parent === this) {\r\n mesh.clone(mesh.name, result);\r\n }\r\n }\r\n }\r\n result.computeWorldMatrix(true);\r\n return result;\r\n };\r\n /**\r\n * Disposes the InstancedMesh.\r\n * Returns nothing.\r\n */\r\n InstancedMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Remove from mesh\r\n this._sourceMesh.removeInstance(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n return InstancedMesh;\r\n}(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/linesMesh.ts\":\n/*!*****************************!*\\\n !*** ./Meshes/linesMesh.ts ***!\n \\*****************************/\n/*! exports provided: LinesMesh, InstancedLinesMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return LinesMesh; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return InstancedLinesMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_instancedMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/instancedMesh */ \"./Meshes/instancedMesh.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Shaders_color_fragment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/color.fragment */ \"./Shaders/color.fragment.ts\");\n/* harmony import */ var _Shaders_color_vertex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Shaders/color.vertex */ \"./Shaders/color.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Line mesh\r\n * @see https://doc.babylonjs.com/babylon101/parametric_shapes\r\n */\r\nvar LinesMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LinesMesh, _super);\r\n /**\r\n * Creates a new LinesMesh\r\n * @param name defines the name\r\n * @param scene defines the hosting scene\r\n * @param parent defines the parent mesh if any\r\n * @param source defines the optional source LinesMesh used to clone data from\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param useVertexColor defines if this LinesMesh supports vertex color\r\n * @param useVertexAlpha defines if this LinesMesh supports vertex alpha\r\n */\r\n function LinesMesh(name, scene, parent, source, doNotCloneChildren, \r\n /**\r\n * If vertex color should be applied to the mesh\r\n */\r\n useVertexColor, \r\n /**\r\n * If vertex alpha should be applied to the mesh\r\n */\r\n useVertexAlpha) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n var _this = _super.call(this, name, scene, parent, source, doNotCloneChildren) || this;\r\n _this.useVertexColor = useVertexColor;\r\n _this.useVertexAlpha = useVertexAlpha;\r\n /**\r\n * Color of the line (Default: White)\r\n */\r\n _this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Alpha of the line (Default: 1)\r\n */\r\n _this.alpha = 1;\r\n if (source) {\r\n _this.color = source.color.clone();\r\n _this.alpha = source.alpha;\r\n _this.useVertexColor = source.useVertexColor;\r\n _this.useVertexAlpha = source.useVertexAlpha;\r\n }\r\n _this.intersectionThreshold = 0.1;\r\n var defines = [];\r\n var options = {\r\n attributes: [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, \"world0\", \"world1\", \"world2\", \"world3\"],\r\n uniforms: [\"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"world\", \"viewProjection\"],\r\n needAlphaBlending: true,\r\n defines: defines\r\n };\r\n if (useVertexAlpha === false) {\r\n options.needAlphaBlending = false;\r\n }\r\n if (!useVertexColor) {\r\n options.uniforms.push(\"color\");\r\n _this.color4 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"]();\r\n }\r\n else {\r\n options.defines.push(\"#define VERTEXCOLOR\");\r\n options.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n }\r\n _this._colorShader = new _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__[\"ShaderMaterial\"](\"colorShader\", _this.getScene(), \"color\", options);\r\n return _this;\r\n }\r\n LinesMesh.prototype._addClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index !== -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.push(define);\r\n };\r\n LinesMesh.prototype._removeClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.splice(index, 1);\r\n };\r\n LinesMesh.prototype.isReady = function () {\r\n var scene = this.getScene();\r\n // Clip planes\r\n scene.clipPlane ? this._addClipPlaneDefine(\"CLIPPLANE\") : this._removeClipPlaneDefine(\"CLIPPLANE\");\r\n scene.clipPlane2 ? this._addClipPlaneDefine(\"CLIPPLANE2\") : this._removeClipPlaneDefine(\"CLIPPLANE2\");\r\n scene.clipPlane3 ? this._addClipPlaneDefine(\"CLIPPLANE3\") : this._removeClipPlaneDefine(\"CLIPPLANE3\");\r\n scene.clipPlane4 ? this._addClipPlaneDefine(\"CLIPPLANE4\") : this._removeClipPlaneDefine(\"CLIPPLANE4\");\r\n if (!this._colorShader.isReady()) {\r\n return false;\r\n }\r\n return _super.prototype.isReady.call(this);\r\n };\r\n /**\r\n * Returns the string \"LineMesh\"\r\n */\r\n LinesMesh.prototype.getClassName = function () {\r\n return \"LinesMesh\";\r\n };\r\n Object.defineProperty(LinesMesh.prototype, \"material\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return this._colorShader;\r\n },\r\n /**\r\n * @hidden\r\n */\r\n set: function (value) {\r\n // Do nothing\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LinesMesh.prototype, \"checkCollisions\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var colorEffect = this._colorShader.getEffect();\r\n // VBOs\r\n var indexToBind = this.isUnIndexed ? null : this._geometry.getIndexBuffer();\r\n this._geometry._bind(colorEffect, indexToBind);\r\n // Color\r\n if (!this.useVertexColor) {\r\n var _a = this.color, r = _a.r, g = _a.g, b = _a.b;\r\n this.color4.set(r, g, b, this.alpha);\r\n this._colorShader.setColor4(\"color\", this.color4);\r\n }\r\n // Clip planes\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindClipPlane(colorEffect, this.getScene());\r\n return this;\r\n };\r\n /** @hidden */\r\n LinesMesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Draw order\r\n if (this._unIndexed) {\r\n engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].LineListDrawMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes of the line mesh\r\n * @param doNotRecurse If children should be disposed\r\n */\r\n LinesMesh.prototype.dispose = function (doNotRecurse) {\r\n this._colorShader.dispose(false, false, true);\r\n _super.prototype.dispose.call(this, doNotRecurse);\r\n };\r\n /**\r\n * Returns a new LineMesh object cloned from the current one.\r\n */\r\n LinesMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n return new LinesMesh(name, this.getScene(), newParent, this, doNotCloneChildren);\r\n };\r\n /**\r\n * Creates a new InstancedLinesMesh object from the mesh model.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedLinesMesh\r\n */\r\n LinesMesh.prototype.createInstance = function (name) {\r\n return new InstancedLinesMesh(name, this);\r\n };\r\n return LinesMesh;\r\n}(_Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]));\r\n\r\n/**\r\n * Creates an instance based on a source LinesMesh\r\n */\r\nvar InstancedLinesMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InstancedLinesMesh, _super);\r\n function InstancedLinesMesh(name, source) {\r\n var _this = _super.call(this, name, source) || this;\r\n _this.intersectionThreshold = source.intersectionThreshold;\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedLinesMesh\".\r\n */\r\n InstancedLinesMesh.prototype.getClassName = function () {\r\n return \"InstancedLinesMesh\";\r\n };\r\n return InstancedLinesMesh;\r\n}(_Meshes_instancedMesh__WEBPACK_IMPORTED_MODULE_4__[\"InstancedMesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/mesh.ts\":\n/*!************************!*\\\n !*** ./Meshes/mesh.ts ***!\n \\************************/\n/*! exports provided: _CreationDataStorage, _InstancesBatch, Mesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _CreationDataStorage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _InstancesBatch; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return Mesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _geometry__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./geometry */ \"./Meshes/geometry.ts\");\n/* harmony import */ var _abstractMesh__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _subMesh__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Materials/multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony import */ var _Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Loading/sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _meshLODLevel__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./meshLODLevel */ \"./Meshes/meshLODLevel.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _CreationDataStorage = /** @class */ (function () {\r\n function _CreationDataStorage() {\r\n }\r\n return _CreationDataStorage;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstanceDataStorage = /** @class */ (function () {\r\n function _InstanceDataStorage() {\r\n this.visibleInstances = {};\r\n this.batchCache = new _InstancesBatch();\r\n this.instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances\r\n }\r\n return _InstanceDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstancesBatch = /** @class */ (function () {\r\n function _InstancesBatch() {\r\n this.mustReturn = false;\r\n this.visibleInstances = new Array();\r\n this.renderSelf = new Array();\r\n this.hardwareInstancedRendering = new Array();\r\n }\r\n return _InstancesBatch;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalMeshDataInfo = /** @class */ (function () {\r\n function _InternalMeshDataInfo() {\r\n this._areNormalsFrozen = false; // Will be used by ribbons mainly\r\n // Will be used to save a source mesh reference, If any\r\n this._source = null;\r\n // Will be used to for fast cloned mesh lookup\r\n this.meshMap = null;\r\n this._preActivateId = -1;\r\n this._LODLevels = new Array();\r\n // Morph\r\n this._morphTargetManager = null;\r\n }\r\n return _InternalMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to represent renderable models\r\n */\r\nvar Mesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Mesh, _super);\r\n /**\r\n * @constructor\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param scene The scene to add this mesh to.\r\n * @param parent The parent of this mesh, if it has one\r\n * @param source An optional Mesh from which geometry is shared, cloned.\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.\r\n */\r\n function Mesh(name, scene, parent, source, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n // Internal data\r\n _this._internalMeshDataInfo = new _InternalMeshDataInfo();\r\n // Members\r\n /**\r\n * Gets the delay loading state of the mesh (when delay loading is turned on)\r\n * @see http://doc.babylonjs.com/how_to/using_the_incremental_loading_system\r\n */\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n /**\r\n * Gets the list of instances created from this mesh\r\n * it is not supposed to be modified manually.\r\n * Note also that the order of the InstancedMesh wihin the array is not significant and might change.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_instances\r\n */\r\n _this.instances = new Array();\r\n // Private\r\n /** @hidden */\r\n _this._creationDataStorage = null;\r\n /** @hidden */\r\n _this._geometry = null;\r\n /** @hidden */\r\n _this._instanceDataStorage = new _InstanceDataStorage();\r\n _this._effectiveMaterial = null;\r\n /** @hidden */\r\n _this._shouldGenerateFlatShading = false;\r\n // Use by builder only to know what orientation were the mesh build in.\r\n /** @hidden */\r\n _this._originalBuilderSideOrientation = Mesh.DEFAULTSIDE;\r\n /**\r\n * Use this property to change the original side orientation defined at construction time\r\n */\r\n _this.overrideMaterialSideOrientation = null;\r\n scene = _this.getScene();\r\n if (source) {\r\n // Geometry\r\n if (source._geometry) {\r\n source._geometry.applyToMesh(_this);\r\n }\r\n // Deep copy\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(source, _this, [\"name\", \"material\", \"skeleton\", \"instances\", \"parent\", \"uniqueId\",\r\n \"source\", \"metadata\", \"hasLODLevels\", \"geometry\", \"isBlocked\", \"areNormalsFrozen\",\r\n \"onBeforeDrawObservable\", \"onBeforeRenderObservable\", \"onAfterRenderObservable\", \"onBeforeDraw\",\r\n \"onAfterWorldMatrixUpdateObservable\", \"onCollideObservable\", \"onCollisionPositionChangeObservable\", \"onRebuildObservable\",\r\n \"onDisposeObservable\", \"lightSources\"\r\n ], [\"_poseMatrix\"]);\r\n // Source mesh\r\n _this._internalMeshDataInfo._source = source;\r\n if (scene.useClonedMeshhMap) {\r\n if (!source._internalMeshDataInfo.meshMap) {\r\n source._internalMeshDataInfo.meshMap = {};\r\n }\r\n source._internalMeshDataInfo.meshMap[_this.uniqueId] = _this;\r\n }\r\n // Construction Params\r\n // Clone parameters allowing mesh to be updated in case of parametric shapes.\r\n _this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;\r\n _this._creationDataStorage = source._creationDataStorage;\r\n // Animation ranges\r\n if (source._ranges) {\r\n var ranges = source._ranges;\r\n for (var name in ranges) {\r\n if (!ranges.hasOwnProperty(name)) {\r\n continue;\r\n }\r\n if (!ranges[name]) {\r\n continue;\r\n }\r\n _this.createAnimationRange(name, ranges[name].from, ranges[name].to);\r\n }\r\n }\r\n // Metadata\r\n if (source.metadata && source.metadata.clone) {\r\n _this.metadata = source.metadata.clone();\r\n }\r\n else {\r\n _this.metadata = source.metadata;\r\n }\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].HasTags(source)) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(_this, _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].GetTags(source, true));\r\n }\r\n // Parent\r\n _this.parent = source.parent;\r\n // Pivot\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.id = name + \".\" + source.id;\r\n // Material\r\n _this.material = source.material;\r\n var index;\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = source.getDescendants(true);\r\n for (var index_1 = 0; index_1 < directDescendants.length; index_1++) {\r\n var child = directDescendants[index_1];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, _this);\r\n }\r\n }\r\n }\r\n // Physics clone\r\n if (scene.getPhysicsEngine) {\r\n var physicsEngine = scene.getPhysicsEngine();\r\n if (clonePhysicsImpostor && physicsEngine) {\r\n var impostor = physicsEngine.getImpostorForPhysicsObject(source);\r\n if (impostor) {\r\n _this.physicsImpostor = impostor.clone(_this);\r\n }\r\n }\r\n }\r\n // Particles\r\n for (index = 0; index < scene.particleSystems.length; index++) {\r\n var system = scene.particleSystems[index];\r\n if (system.emitter === source) {\r\n system.clone(system.name, _this);\r\n }\r\n }\r\n _this.refreshBoundingInfo();\r\n _this.computeWorldMatrix(true);\r\n }\r\n // Parent\r\n if (parent !== null) {\r\n _this.parent = parent;\r\n }\r\n _this._instanceDataStorage.hardwareInstancedRendering = _this.getEngine().getCaps().instancedArrays;\r\n return _this;\r\n }\r\n /**\r\n * Gets the default side orientation.\r\n * @param orientation the orientation to value to attempt to get\r\n * @returns the default orientation\r\n * @hidden\r\n */\r\n Mesh._GetDefaultSideOrientation = function (orientation) {\r\n return orientation || Mesh.FRONTSIDE; // works as Mesh.FRONTSIDE is 0\r\n };\r\n Object.defineProperty(Mesh.prototype, \"onBeforeRenderObservable\", {\r\n /**\r\n * An event triggered before rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onBeforeRenderObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeBindObservable\", {\r\n /**\r\n * An event triggered before binding the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onBeforeBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onAfterRenderObservable\", {\r\n /**\r\n * An event triggered after rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onAfterRenderObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDrawObservable\", {\r\n /**\r\n * An event triggered before drawing the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onBeforeDrawObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDraw\", {\r\n /**\r\n * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeDrawObserver) {\r\n this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);\r\n }\r\n this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"hasInstances\", {\r\n get: function () {\r\n return this.instances.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"morphTargetManager\", {\r\n /**\r\n * Gets or sets the morph target manager\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._morphTargetManager;\r\n },\r\n set: function (value) {\r\n if (this._internalMeshDataInfo._morphTargetManager === value) {\r\n return;\r\n }\r\n this._internalMeshDataInfo._morphTargetManager = value;\r\n this._syncGeometryWithMorphTargetManager();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"source\", {\r\n /**\r\n * Gets the source mesh (the one used to clone this one from)\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._source;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"isUnIndexed\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh does not use index buffer\r\n */\r\n get: function () {\r\n return this._unIndexed;\r\n },\r\n set: function (value) {\r\n if (this._unIndexed !== value) {\r\n this._unIndexed = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n Mesh.prototype.instantiateHierarychy = function (newParent) {\r\n if (newParent === void 0) { newParent = null; }\r\n var instance = this.createInstance(\"instance of \" + (this.name || this.id));\r\n instance.parent = newParent || this.parent;\r\n instance.position = this.position.clone();\r\n instance.scaling = this.scaling.clone();\r\n if (this.rotationQuaternion) {\r\n instance.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n else {\r\n instance.rotation = this.rotation.clone();\r\n }\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarychy(instance);\r\n }\r\n return instance;\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Mesh\".\r\n */\r\n Mesh.prototype.getClassName = function () {\r\n return \"Mesh\";\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_isMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a description of this mesh\r\n * @param fullDetails define if full details about this mesh must be used\r\n * @returns a descriptive string representing this mesh\r\n */\r\n Mesh.prototype.toString = function (fullDetails) {\r\n var ret = _super.prototype.toString.call(this, fullDetails);\r\n ret += \", n vertices: \" + this.getTotalVertices();\r\n ret += \", parent: \" + (this._waitingParentId ? this._waitingParentId : (this.parent ? this.parent.name : \"NONE\"));\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n if (this._geometry) {\r\n var ib = this.getIndices();\r\n var vb = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (vb && ib) {\r\n ret += \", flat shading: \" + (vb.length / 3 === ib.length ? \"YES\" : \"NO\");\r\n }\r\n }\r\n else {\r\n ret += \", flat shading: UNKNOWN\";\r\n }\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unBindEffect = function () {\r\n _super.prototype._unBindEffect.call(this);\r\n for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {\r\n var instance = _a[_i];\r\n instance._unBindEffect();\r\n }\r\n };\r\n Object.defineProperty(Mesh.prototype, \"hasLODLevels\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has LOD\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._LODLevels.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of MeshLODLevel associated with the current mesh\r\n * @returns an array of MeshLODLevel\r\n */\r\n Mesh.prototype.getLODLevels = function () {\r\n return this._internalMeshDataInfo._LODLevels;\r\n };\r\n Mesh.prototype._sortLODLevels = function () {\r\n this._internalMeshDataInfo._LODLevels.sort(function (a, b) {\r\n if (a.distance < b.distance) {\r\n return 1;\r\n }\r\n if (a.distance > b.distance) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n };\r\n /**\r\n * Add a mesh as LOD level triggered at the given distance.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @param mesh The mesh to be added as LOD level (can be null)\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.addLODLevel = function (distance, mesh) {\r\n if (mesh && mesh._masterMesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"You cannot use a mesh as LOD level twice\");\r\n return this;\r\n }\r\n var level = new _meshLODLevel__WEBPACK_IMPORTED_MODULE_23__[\"MeshLODLevel\"](distance, mesh);\r\n this._internalMeshDataInfo._LODLevels.push(level);\r\n if (mesh) {\r\n mesh._masterMesh = this;\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the LOD level mesh at the passed distance or null if not found.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @returns a Mesh or `null`\r\n */\r\n Mesh.prototype.getLODLevelAtDistance = function (distance) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance === distance) {\r\n return level.mesh;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Remove a mesh from the LOD array\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param mesh defines the mesh to be removed\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.removeLODLevel = function (mesh) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n if (internalDataInfo._LODLevels[index].mesh === mesh) {\r\n internalDataInfo._LODLevels.splice(index, 1);\r\n if (mesh) {\r\n mesh._masterMesh = null;\r\n }\r\n }\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param camera defines the camera to use to compute distance\r\n * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.getLOD = function (camera, boundingSphere) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._LODLevels || internalDataInfo._LODLevels.length === 0) {\r\n return this;\r\n }\r\n var bSphere;\r\n if (boundingSphere) {\r\n bSphere = boundingSphere;\r\n }\r\n else {\r\n var boundingInfo = this.getBoundingInfo();\r\n bSphere = boundingInfo.boundingSphere;\r\n }\r\n var distanceToCamera = bSphere.centerWorld.subtract(camera.globalPosition).length();\r\n if (internalDataInfo._LODLevels[internalDataInfo._LODLevels.length - 1].distance > distanceToCamera) {\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n }\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance < distanceToCamera) {\r\n if (level.mesh) {\r\n level.mesh._preActivate();\r\n level.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, level.mesh);\r\n }\r\n return level.mesh;\r\n }\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"geometry\", {\r\n /**\r\n * Gets the mesh internal Geometry object\r\n */\r\n get: function () {\r\n return this._geometry;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.\r\n * @returns the total number of vertices\r\n */\r\n Mesh.prototype.getTotalVertices = function () {\r\n if (this._geometry === null || this._geometry === undefined) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalVertices();\r\n };\r\n /**\r\n * Returns the content of an associated vertex buffer\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one\r\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\r\n * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Returns the mesh VertexBuffer object from the requested `kind`\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVertexBuffer = function (kind) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVertexBuffer(kind);\r\n };\r\n /**\r\n * Tests if a specific vertex buffer is associated with this mesh\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable.\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVertexBufferUpdatable = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVertexBufferUpdatable(kind);\r\n };\r\n /**\r\n * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns an array of strings\r\n */\r\n Mesh.prototype.getVerticesDataKinds = function () {\r\n if (!this._geometry) {\r\n var result = new Array();\r\n if (this._delayInfo) {\r\n this._delayInfo.forEach(function (kind) {\r\n result.push(kind);\r\n });\r\n }\r\n return result;\r\n }\r\n return this._geometry.getVerticesDataKinds();\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n Mesh.prototype.getTotalIndices = function () {\r\n if (!this._geometry) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalIndices();\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the indices array or an empty array if the mesh has no geometry\r\n */\r\n Mesh.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return [];\r\n }\r\n return this._geometry.getIndices(copyWhenShared, forceCopy);\r\n };\r\n Object.defineProperty(Mesh.prototype, \"isBlocked\", {\r\n get: function () {\r\n return this._masterMesh !== null && this._masterMesh !== undefined;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Determine if the current mesh is ready to be rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)\r\n * @returns true if all associated assets are ready (material, textures, shaders)\r\n */\r\n Mesh.prototype.isReady = function (completeCheck, forceInstanceSupport) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (forceInstanceSupport === void 0) { forceInstanceSupport = false; }\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return false;\r\n }\r\n if (!_super.prototype.isReady.call(this, completeCheck)) {\r\n return false;\r\n }\r\n if (!this.subMeshes || this.subMeshes.length === 0) {\r\n return true;\r\n }\r\n if (!completeCheck) {\r\n return true;\r\n }\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n var hardwareInstancedRendering = forceInstanceSupport || engine.getCaps().instancedArrays && this.instances.length > 0;\r\n this.computeWorldMatrix();\r\n var mat = this.material || scene.defaultMaterial;\r\n if (mat) {\r\n if (mat._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var effectiveMaterial = subMesh.getMaterial();\r\n if (effectiveMaterial) {\r\n if (effectiveMaterial._storeEffectOnSubMeshes) {\r\n if (!effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n else {\r\n if (!effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (!mat.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Shadows\r\n for (var _b = 0, _c = this.lightSources; _b < _c.length; _b++) {\r\n var light = _c[_b];\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n for (var _d = 0, _e = this.subMeshes; _d < _e.length; _d++) {\r\n var subMesh = _e[_d];\r\n if (!generator.isReady(subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n // LOD\r\n for (var _f = 0, _g = this._internalMeshDataInfo._LODLevels; _f < _g.length; _f++) {\r\n var lod = _g[_f];\r\n if (lod.mesh && !lod.mesh.isReady(hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"areNormalsFrozen\", {\r\n /**\r\n * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._areNormalsFrozen;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.freezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unfreezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = false;\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"overridenInstanceCount\", {\r\n /**\r\n * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs\r\n */\r\n set: function (count) {\r\n this._instanceDataStorage.overridenInstanceCount = count;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /** @hidden */\r\n Mesh.prototype._preActivate = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n var sceneRenderId = this.getScene().getRenderId();\r\n if (internalDataInfo._preActivateId === sceneRenderId) {\r\n return this;\r\n }\r\n internalDataInfo._preActivateId = sceneRenderId;\r\n this._instanceDataStorage.visibleInstances = null;\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n if (this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._registerInstanceForRenderId = function (instance, renderId) {\r\n if (!this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances = {\r\n defaultRenderId: renderId,\r\n selfDefaultRenderId: this._renderId\r\n };\r\n }\r\n if (!this._instanceDataStorage.visibleInstances[renderId]) {\r\n this._instanceDataStorage.visibleInstances[renderId] = new Array();\r\n }\r\n this._instanceDataStorage.visibleInstances[renderId].push(instance);\r\n return this;\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this.geometry ? this.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._createGlobalSubMesh = function (force) {\r\n var totalVertices = this.getTotalVertices();\r\n if (!totalVertices || !this.getIndices()) {\r\n return null;\r\n }\r\n // Check if we need to recreate the submeshes\r\n if (this.subMeshes && this.subMeshes.length > 0) {\r\n var ib = this.getIndices();\r\n if (!ib) {\r\n return null;\r\n }\r\n var totalIndices = ib.length;\r\n var needToRecreate = false;\r\n if (force) {\r\n needToRecreate = true;\r\n }\r\n else {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var submesh = _a[_i];\r\n if (submesh.indexStart + submesh.indexCount >= totalIndices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n }\r\n }\r\n if (!needToRecreate) {\r\n return this.subMeshes[0];\r\n }\r\n }\r\n this.releaseSubMeshes();\r\n return new _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"](0, 0, totalVertices, 0, this.getTotalIndices(), this);\r\n };\r\n /**\r\n * This function will subdivide the mesh into multiple submeshes\r\n * @param count defines the expected number of submeshes\r\n */\r\n Mesh.prototype.subdivide = function (count) {\r\n if (count < 1) {\r\n return;\r\n }\r\n var totalIndices = this.getTotalIndices();\r\n var subdivisionSize = (totalIndices / count) | 0;\r\n var offset = 0;\r\n // Ensure that subdivisionSize is a multiple of 3\r\n while (subdivisionSize % 3 !== 0) {\r\n subdivisionSize++;\r\n }\r\n this.releaseSubMeshes();\r\n for (var index = 0; index < count; index++) {\r\n if (offset >= totalIndices) {\r\n break;\r\n }\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].CreateFromIndices(0, offset, Math.min(subdivisionSize, totalIndices - offset), this);\r\n offset += subdivisionSize;\r\n }\r\n this.synchronizeInstances();\r\n };\r\n /**\r\n * Copy a FloatArray into a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n * @param stride defines the data stride size (can be null)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"]();\r\n vertexData.set(data, kind);\r\n var scene = this.getScene();\r\n new _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"](_geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Flags an associated vertex buffer as updatable\r\n * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n */\r\n Mesh.prototype.markVerticesDataAsUpdatable = function (kind, updatable) {\r\n if (updatable === void 0) { updatable = true; }\r\n var vb = this.getVertexBuffer(kind);\r\n if (!vb || vb.isUpdatable() === updatable) {\r\n return;\r\n }\r\n this.setVerticesData(kind, this.getVerticesData(kind), updatable);\r\n };\r\n /**\r\n * Sets the mesh global Vertex Buffer\r\n * @param buffer defines the buffer to use\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesBuffer = function (buffer) {\r\n if (!this._geometry) {\r\n this._geometry = _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].CreateGeometryForMesh(this);\r\n }\r\n this._geometry.setVerticesBuffer(buffer);\r\n return this;\r\n };\r\n /**\r\n * Update a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for \"position\" kind\r\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n if (!makeItUnique) {\r\n this._geometry.updateVerticesData(kind, data, updateExtends);\r\n }\r\n else {\r\n this.makeGeometryUnique();\r\n this.updateVerticesData(kind, data, updateExtends, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.\r\n * @see http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions\r\n * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything\r\n * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateMeshPositions = function (positionFunction, computeNormals) {\r\n if (computeNormals === void 0) { computeNormals = true; }\r\n var positions = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!positions) {\r\n return this;\r\n }\r\n positionFunction(positions);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positions, false, false);\r\n if (computeNormals) {\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n if (!normals) {\r\n return this;\r\n }\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals, false, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Creates a un-shared specific occurence of the geometry for the mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.makeGeometryUnique = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var oldGeometry = this._geometry;\r\n var geometry = this._geometry.copy(_geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].RandomId());\r\n oldGeometry.releaseForMesh(this, true);\r\n geometry.applyToMesh(this);\r\n return this;\r\n };\r\n /**\r\n * Set the index buffer of this mesh\r\n * @param indices defines the source data\r\n * @param totalVertices defines the total number of vertices referenced by this index data (can be null)\r\n * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n var scene = this.getScene();\r\n new _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"](_geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setIndices(indices, totalVertices, updatable);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Update the current index buffer\r\n * @param indices defines the source data\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.updateIndices(indices, offset, gpuMemoryOnly);\r\n return this;\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.toLeftHanded = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.toLeftHanded();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Wireframe\r\n var indexToBind;\r\n if (this._unIndexed) {\r\n indexToBind = null;\r\n }\r\n else {\r\n switch (fillMode) {\r\n case _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].PointFillMode:\r\n indexToBind = null;\r\n break;\r\n case _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].WireFrameFillMode:\r\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\r\n break;\r\n default:\r\n case _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].TriangleFillMode:\r\n indexToBind = this._geometry.getIndexBuffer();\r\n break;\r\n }\r\n }\r\n // VBOs\r\n this._geometry._bind(effect, indexToBind);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (this._unIndexed || fillMode == _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].PointFillMode) {\r\n // or triangles as points\r\n engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else if (fillMode == _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].WireFrameFillMode) {\r\n // Triangles as wireframe\r\n engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just before the rendering process\r\n * @param func defines the function to call before rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called before the rendering\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just after the rendering is complete\r\n * @param func defines the function to call after rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called after the rendering.\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._getInstancesRenderList = function (subMeshId) {\r\n if (this._instanceDataStorage.isFrozen && this._instanceDataStorage.previousBatch) {\r\n return this._instanceDataStorage.previousBatch;\r\n }\r\n var scene = this.getScene();\r\n var isInIntermediateRendering = scene._isInIntermediateRendering();\r\n var onlyForInstances = isInIntermediateRendering ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate : this._internalAbstractMeshDataInfo._onlyForInstances;\r\n var batchCache = this._instanceDataStorage.batchCache;\r\n batchCache.mustReturn = false;\r\n batchCache.renderSelf[subMeshId] = !onlyForInstances && this.isEnabled() && this.isVisible;\r\n batchCache.visibleInstances[subMeshId] = null;\r\n if (this._instanceDataStorage.visibleInstances) {\r\n var visibleInstances = this._instanceDataStorage.visibleInstances;\r\n var currentRenderId = scene.getRenderId();\r\n var defaultRenderId = (isInIntermediateRendering ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId);\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];\r\n if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];\r\n }\r\n }\r\n batchCache.hardwareInstancedRendering[subMeshId] = this._instanceDataStorage.hardwareInstancedRendering && (batchCache.visibleInstances[subMeshId] !== null) && (batchCache.visibleInstances[subMeshId] !== undefined);\r\n this._instanceDataStorage.previousBatch = batchCache;\r\n return batchCache;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._renderWithInstances = function (subMesh, fillMode, batch, effect, engine) {\r\n var visibleInstances = batch.visibleInstances[subMesh._id];\r\n if (!visibleInstances) {\r\n return this;\r\n }\r\n var instanceStorage = this._instanceDataStorage;\r\n var currentInstancesBufferSize = instanceStorage.instancesBufferSize;\r\n var instancesBuffer = instanceStorage.instancesBuffer;\r\n var matricesCount = visibleInstances.length + 1;\r\n var bufferSize = matricesCount * 16 * 4;\r\n while (instanceStorage.instancesBufferSize < bufferSize) {\r\n instanceStorage.instancesBufferSize *= 2;\r\n }\r\n if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\r\n instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);\r\n }\r\n var offset = 0;\r\n var instancesCount = 0;\r\n var world = this._effectiveMesh.getWorldMatrix();\r\n if (batch.renderSelf[subMesh._id]) {\r\n world.copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n if (visibleInstances) {\r\n for (var instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\r\n var instance = visibleInstances[instanceIndex];\r\n instance.getWorldMatrix().copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n }\r\n if (!instancesBuffer || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\r\n if (instancesBuffer) {\r\n instancesBuffer.dispose();\r\n }\r\n instancesBuffer = new _buffer__WEBPACK_IMPORTED_MODULE_8__[\"Buffer\"](engine, instanceStorage.instancesData, true, 16, false, true);\r\n instanceStorage.instancesBuffer = instancesBuffer;\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n }\r\n else {\r\n instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\r\n }\r\n this._bind(subMesh, effect, fillMode);\r\n this._draw(subMesh, fillMode, instancesCount);\r\n engine.unbindInstanceAttributes();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._processRendering = function (subMesh, effect, fillMode, batch, hardwareInstancedRendering, onBeforeDraw, effectiveMaterial) {\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (hardwareInstancedRendering) {\r\n this._renderWithInstances(subMesh, fillMode, batch, effect, engine);\r\n }\r\n else {\r\n if (batch.renderSelf[subMesh._id]) {\r\n // Draw\r\n if (onBeforeDraw) {\r\n onBeforeDraw(false, this._effectiveMesh.getWorldMatrix(), effectiveMaterial);\r\n }\r\n this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);\r\n }\r\n var visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];\r\n if (visibleInstancesForSubMesh) {\r\n for (var instanceIndex = 0; instanceIndex < visibleInstancesForSubMesh.length; instanceIndex++) {\r\n var instance = visibleInstancesForSubMesh[instanceIndex];\r\n // World\r\n var world = instance.getWorldMatrix();\r\n if (onBeforeDraw) {\r\n onBeforeDraw(true, world, effectiveMaterial);\r\n }\r\n // Draw\r\n this._draw(subMesh, fillMode);\r\n }\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._rebuild = function () {\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n _super.prototype._rebuild.call(this);\r\n };\r\n /** @hidden */\r\n Mesh.prototype._freeze = function () {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n // Prepare batches\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this._getInstancesRenderList(index);\r\n }\r\n this._effectiveMaterial = null;\r\n this._instanceDataStorage.isFrozen = true;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unFreeze = function () {\r\n this._instanceDataStorage.isFrozen = false;\r\n this._instanceDataStorage.previousBatch = null;\r\n };\r\n /**\r\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\r\n * @param subMesh defines the subMesh to render\r\n * @param enableAlphaMode defines if alpha mode can be changed\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.render = function (subMesh, enableAlphaMode) {\r\n var scene = this.getScene();\r\n if (scene._isInIntermediateRendering()) {\r\n this._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n }\r\n else {\r\n this._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n if (this._checkOcclusionQuery()) {\r\n return this;\r\n }\r\n // Managing instances\r\n var batch = this._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return this;\r\n }\r\n // Checking geometry state\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);\r\n }\r\n var engine = scene.getEngine();\r\n var hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id];\r\n var instanceDataStorage = this._instanceDataStorage;\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return this;\r\n }\r\n // Material\r\n if (!instanceDataStorage.isFrozen || !this._effectiveMaterial || this._effectiveMaterial !== material) {\r\n this._effectiveMaterial = material;\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n if (!this._effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n }\r\n else if (!this._effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n }\r\n // Alpha mode\r\n if (enableAlphaMode) {\r\n engine.setAlphaMode(this._effectiveMaterial.alphaMode);\r\n }\r\n for (var _i = 0, _a = scene._beforeRenderingMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this, subMesh, batch);\r\n }\r\n var effect;\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n effect = subMesh.effect;\r\n }\r\n else {\r\n effect = this._effectiveMaterial.getEffect();\r\n }\r\n if (!effect) {\r\n return this;\r\n }\r\n var effectiveMesh = this._effectiveMesh;\r\n var sideOrientation;\r\n if (!instanceDataStorage.isFrozen) {\r\n sideOrientation = this.overrideMaterialSideOrientation;\r\n if (sideOrientation == null) {\r\n sideOrientation = this._effectiveMaterial.sideOrientation;\r\n }\r\n if (effectiveMesh._getWorldMatrixDeterminant() < 0) {\r\n sideOrientation = (sideOrientation === _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].ClockWiseSideOrientation ? _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].CounterClockWiseSideOrientation : _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].ClockWiseSideOrientation);\r\n }\r\n instanceDataStorage.sideOrientation = sideOrientation;\r\n }\r\n else {\r\n sideOrientation = instanceDataStorage.sideOrientation;\r\n }\r\n var reverse = this._effectiveMaterial._preBind(effect, sideOrientation);\r\n if (this._effectiveMaterial.forceDepthWrite) {\r\n engine.setDepthWrite(true);\r\n }\r\n // Bind\r\n var fillMode = scene.forcePointsCloud ? _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].PointFillMode : (scene.forceWireframe ? _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].WireFrameFillMode : this._effectiveMaterial.fillMode);\r\n if (this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this);\r\n }\r\n if (!hardwareInstancedRendering) { // Binding will be done later because we need to add more info to the VB\r\n this._bind(subMesh, effect, fillMode);\r\n }\r\n var world = effectiveMesh.getWorldMatrix();\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n this._effectiveMaterial.bindForSubMesh(world, this, subMesh);\r\n }\r\n else {\r\n this._effectiveMaterial.bind(world, this);\r\n }\r\n if (!this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass) {\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, !reverse);\r\n this._processRendering(subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, reverse);\r\n }\r\n // Draw\r\n this._processRendering(subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n // Unbind\r\n this._effectiveMaterial.unbind();\r\n for (var _b = 0, _c = scene._afterRenderingMeshStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this, subMesh, batch);\r\n }\r\n if (this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._onBeforeDraw = function (isInstance, world, effectiveMaterial) {\r\n if (isInstance && effectiveMaterial) {\r\n effectiveMaterial.bindOnlyWorldMatrix(world);\r\n }\r\n };\r\n /**\r\n * Renormalize the mesh and patch it up if there are no weights\r\n * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.\r\n * However in the case of zero weights then we set just a single influence to 1.\r\n * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.\r\n */\r\n Mesh.prototype.cleanMatrixWeights = function () {\r\n if (this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n if (this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind)) {\r\n this.normalizeSkinWeightsAndExtra();\r\n }\r\n else {\r\n this.normalizeSkinFourWeights();\r\n }\r\n }\r\n };\r\n // faster 4 weight version.\r\n Mesh.prototype.normalizeSkinFourWeights = function () {\r\n var matricesWeights = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeights);\r\n };\r\n // handle special case of extra verts. (in theory gltf can handle 12 influences)\r\n Mesh.prototype.normalizeSkinWeightsAndExtra = function () {\r\n var matricesWeightsExtra = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n t += matricesWeightsExtra[a] + matricesWeightsExtra[a + 1] + matricesWeightsExtra[a + 2] + matricesWeightsExtra[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n // same goes for extras\r\n matricesWeightsExtra[a] *= recip;\r\n matricesWeightsExtra[a + 1] *= recip;\r\n matricesWeightsExtra[a + 2] *= recip;\r\n matricesWeightsExtra[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeights);\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeightsExtra);\r\n };\r\n /**\r\n * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,\r\n * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let\r\n * the user know there was an issue with importing the mesh\r\n * @returns a validation object with skinned, valid and report string\r\n */\r\n Mesh.prototype.validateSkinning = function () {\r\n var matricesWeightsExtra = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (matricesWeights === null || this.skeleton == null) {\r\n return { skinned: false, valid: true, report: \"not skinned\" };\r\n }\r\n var numWeights = matricesWeights.length;\r\n var numberNotSorted = 0;\r\n var missingWeights = 0;\r\n var maxUsedWeights = 0;\r\n var numberNotNormalized = 0;\r\n var numInfluences = matricesWeightsExtra === null ? 4 : 8;\r\n var usedWeightCounts = new Array();\r\n for (var a = 0; a <= numInfluences; a++) {\r\n usedWeightCounts[a] = 0;\r\n }\r\n var toleranceEpsilon = 0.001;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n var lastWeight = matricesWeights[a];\r\n var t = lastWeight;\r\n var usedWeights = t === 0 ? 0 : 1;\r\n for (var b = 1; b < numInfluences; b++) {\r\n var d = b < 4 ? matricesWeights[a + b] : matricesWeightsExtra[a + b - 4];\r\n if (d > lastWeight) {\r\n numberNotSorted++;\r\n }\r\n if (d !== 0) {\r\n usedWeights++;\r\n }\r\n t += d;\r\n lastWeight = d;\r\n }\r\n // count the buffer weights usage\r\n usedWeightCounts[usedWeights]++;\r\n // max influences\r\n if (usedWeights > maxUsedWeights) {\r\n maxUsedWeights = usedWeights;\r\n }\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n missingWeights++;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n var tolerance = 0;\r\n for (b = 0; b < numInfluences; b++) {\r\n if (b < 4) {\r\n tolerance += Math.abs(matricesWeights[a + b] - (matricesWeights[a + b] * recip));\r\n }\r\n else {\r\n tolerance += Math.abs(matricesWeightsExtra[a + b - 4] - (matricesWeightsExtra[a + b - 4] * recip));\r\n }\r\n }\r\n // arbitary epsilon value for dicdating not normalized\r\n if (tolerance > toleranceEpsilon) {\r\n numberNotNormalized++;\r\n }\r\n }\r\n }\r\n // validate bone indices are in range of the skeleton\r\n var numBones = this.skeleton.bones.length;\r\n var matricesIndices = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesIndicesExtra = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n var numBadBoneIndices = 0;\r\n for (var a = 0; a < numWeights; a++) {\r\n for (var b = 0; b < numInfluences; b++) {\r\n var index = b < 4 ? matricesIndices[b] : matricesIndicesExtra[b - 4];\r\n if (index >= numBones || index < 0) {\r\n numBadBoneIndices++;\r\n }\r\n }\r\n }\r\n // log mesh stats\r\n var output = \"Number of Weights = \" + numWeights / 4 + \"\\nMaximum influences = \" + maxUsedWeights +\r\n \"\\nMissing Weights = \" + missingWeights + \"\\nNot Sorted = \" + numberNotSorted +\r\n \"\\nNot Normalized = \" + numberNotNormalized + \"\\nWeightCounts = [\" + usedWeightCounts + \"]\" +\r\n \"\\nNumber of bones = \" + numBones + \"\\nBad Bone Indices = \" + numBadBoneIndices;\r\n return { skinned: true, valid: missingWeights === 0 && numberNotNormalized === 0 && numBadBoneIndices === 0, report: output };\r\n };\r\n /** @hidden */\r\n Mesh.prototype._checkDelayState = function () {\r\n var scene = this.getScene();\r\n if (this._geometry) {\r\n this._geometry.load(scene);\r\n }\r\n else if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADING;\r\n this._queueLoad(scene);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._queueLoad = function (scene) {\r\n var _this = this;\r\n scene._addPendingData(this);\r\n var getBinaryData = (this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\") !== -1);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].LoadFile(this.delayLoadingFile, function (data) {\r\n if (data instanceof ArrayBuffer) {\r\n _this._delayLoadingFunction(data, _this);\r\n }\r\n else {\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n }\r\n _this.instances.forEach(function (instance) {\r\n instance.refreshBoundingInfo();\r\n instance._syncSubMeshes();\r\n });\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n scene._removePendingData(_this);\r\n }, function () { }, scene.offlineProvider, getBinaryData);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n Mesh.prototype.isInFrustum = function (frustumPlanes) {\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return false;\r\n }\r\n if (!_super.prototype.isInFrustum.call(this, frustumPlanes)) {\r\n return false;\r\n }\r\n this._checkDelayState();\r\n return true;\r\n };\r\n /**\r\n * Sets the mesh material by the material or multiMaterial `id` property\r\n * @param id is a string identifying the material or the multiMaterial\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setMaterialByID = function (id) {\r\n var materials = this.getScene().materials;\r\n var index;\r\n for (index = materials.length - 1; index > -1; index--) {\r\n if (materials[index].id === id) {\r\n this.material = materials[index];\r\n return this;\r\n }\r\n }\r\n // Multi\r\n var multiMaterials = this.getScene().multiMaterials;\r\n for (index = multiMaterials.length - 1; index > -1; index--) {\r\n if (multiMaterials[index].id === id) {\r\n this.material = multiMaterials[index];\r\n return this;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns as a new array populated with the mesh material and/or skeleton, if any.\r\n * @returns an array of IAnimatable\r\n */\r\n Mesh.prototype.getAnimatables = function () {\r\n var results = new Array();\r\n if (this.material) {\r\n results.push(this.material);\r\n }\r\n if (this.skeleton) {\r\n results.push(this.skeleton);\r\n }\r\n return results;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to the passed transformation matrix.\r\n * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.\r\n * The mesh normals are modified using the same transformation.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @param transform defines the transform matrix to use\r\n * @see http://doc.babylonjs.com/resources/baking_transformations\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeTransformIntoVertices = function (transform) {\r\n // Position\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)) {\r\n return this;\r\n }\r\n var submeshes = this.subMeshes.splice(0);\r\n this._resetPointsArrayCache();\r\n var data = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < data.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(data, index), transform).toArray(temp, index);\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, temp, this.getVertexBuffer(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind).isUpdatable());\r\n // Normals\r\n if (this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)) {\r\n data = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n temp = [];\r\n for (index = 0; index < data.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformNormal(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(data, index), transform).normalize().toArray(temp, index);\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, temp, this.getVertexBuffer(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind).isUpdatable());\r\n }\r\n // flip faces?\r\n if (transform.m[0] * transform.m[5] * transform.m[10] < 0) {\r\n this.flipFaces();\r\n }\r\n // Restore submeshes\r\n this.releaseSubMeshes();\r\n this.subMeshes = submeshes;\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to its own current World Matrix.\r\n * The mesh World Matrix is then reset.\r\n * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @see http://doc.babylonjs.com/resources/baking_transformations\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeCurrentTransformIntoVertices = function () {\r\n this.bakeTransformIntoVertices(this.computeWorldMatrix(true));\r\n this.scaling.copyFromFloats(1, 1, 1);\r\n this.position.copyFromFloats(0, 0, 0);\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n //only if quaternion is already set\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"].Identity();\r\n }\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_positions\", {\r\n // Cache\r\n /** @hidden */\r\n get: function () {\r\n if (this._geometry) {\r\n return this._geometry._positions;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Mesh.prototype._resetPointsArrayCache = function () {\r\n if (this._geometry) {\r\n this._geometry._resetPointsArrayCache();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._generatePointsArray = function () {\r\n if (this._geometry) {\r\n return this._geometry._generatePointsArray();\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns a new Mesh object generated from the current mesh properties.\r\n * This method must not get confused with createInstance()\r\n * @param name is a string, the name given to the new mesh\r\n * @param newParent can be any Node object (default `null`)\r\n * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)\r\n * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)\r\n * @returns a new mesh\r\n */\r\n Mesh.prototype.clone = function (name, newParent, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (name === void 0) { name = \"\"; }\r\n if (newParent === void 0) { newParent = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n return new Mesh(name, this.getScene(), newParent, this, doNotCloneChildren, clonePhysicsImpostor);\r\n };\r\n /**\r\n * Releases resources associated with this mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Mesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this.morphTargetManager = null;\r\n if (this._geometry) {\r\n this._geometry.releaseForMesh(this, true);\r\n }\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (internalDataInfo._onBeforeDrawObservable) {\r\n internalDataInfo._onBeforeDrawObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeBindObservable) {\r\n internalDataInfo._onBeforeBindObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeRenderObservable) {\r\n internalDataInfo._onBeforeRenderObservable.clear();\r\n }\r\n if (internalDataInfo._onAfterRenderObservable) {\r\n internalDataInfo._onAfterRenderObservable.clear();\r\n }\r\n // Sources\r\n if (this._scene.useClonedMeshhMap) {\r\n if (internalDataInfo.meshMap) {\r\n for (var uniqueId in internalDataInfo.meshMap) {\r\n var mesh = internalDataInfo.meshMap[uniqueId];\r\n if (mesh) {\r\n mesh._internalMeshDataInfo._source = null;\r\n internalDataInfo.meshMap[uniqueId] = undefined;\r\n }\r\n }\r\n }\r\n if (internalDataInfo._source && internalDataInfo._source._internalMeshDataInfo.meshMap) {\r\n internalDataInfo._source._internalMeshDataInfo.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n else {\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var abstractMesh = meshes_1[_i];\r\n var mesh = abstractMesh;\r\n if (mesh._internalMeshDataInfo && mesh._internalMeshDataInfo._source && mesh._internalMeshDataInfo._source === this) {\r\n mesh._internalMeshDataInfo._source = null;\r\n }\r\n }\r\n }\r\n internalDataInfo._source = null;\r\n // Instances\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n while (this.instances.length) {\r\n this.instances[0].dispose();\r\n }\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacement map.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param url is a string, the URL from the image file is to be downloaded.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMap = function (url, minHeight, maxHeight, onSuccess, uvOffset, uvScale, forceUpdate) {\r\n var _this = this;\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var scene = this.getScene();\r\n var onload = function (img) {\r\n // Getting height map data\r\n var canvas = document.createElement(\"canvas\");\r\n var context = canvas.getContext(\"2d\");\r\n var heightMapWidth = img.width;\r\n var heightMapHeight = img.height;\r\n canvas.width = heightMapWidth;\r\n canvas.height = heightMapHeight;\r\n context.drawImage(img, 0, 0);\r\n // Create VertexData from map data\r\n //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\r\n var buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;\r\n _this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);\r\n //execute success callback, if set\r\n if (onSuccess) {\r\n onSuccess(_this);\r\n }\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].LoadImage(url, onload, function () { }, scene.offlineProvider);\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacementMap buffer.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.\r\n * @param heightMapWidth is the width of the buffer image.\r\n * @param heightMapHeight is the height of the buffer image.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMapFromBuffer = function (buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)\r\n || !this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)\r\n || !this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind)) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing\");\r\n return this;\r\n }\r\n var positions = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, true, true);\r\n var normals = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n var uvs = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind);\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n var uv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].Zero();\r\n uvOffset = uvOffset || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].Zero();\r\n uvScale = uvScale || new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](1, 1);\r\n for (var index = 0; index < positions.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArrayToRef(positions, index, position);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArrayToRef(normals, index, normal);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].FromArrayToRef(uvs, (index / 3) * 2, uv);\r\n // Compute height\r\n var u = ((Math.abs(uv.x * uvScale.x + uvOffset.x) * heightMapWidth) % heightMapWidth) | 0;\r\n var v = ((Math.abs(uv.y * uvScale.y + uvOffset.y) * heightMapHeight) % heightMapHeight) | 0;\r\n var pos = (u + v * heightMapWidth) * 4;\r\n var r = buffer[pos] / 255.0;\r\n var g = buffer[pos + 1] / 255.0;\r\n var b = buffer[pos + 2] / 255.0;\r\n var gradient = r * 0.3 + g * 0.59 + b * 0.11;\r\n normal.normalize();\r\n normal.scaleInPlace(minHeight + (maxHeight - minHeight) * gradient);\r\n position = position.add(normal);\r\n position.toArray(positions, index);\r\n }\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ComputeNormals(positions, this.getIndices(), normals);\r\n if (forceUpdate) {\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positions);\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals);\r\n }\r\n else {\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positions);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Modify the mesh to get a flat shading rendering.\r\n * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.\r\n * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToFlatShadedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var updatableNormals = false;\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (kind === _buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind) {\r\n updatableNormals = vertexBuffer.isUpdatable();\r\n kinds.splice(kindIndex, 1);\r\n kindIndex--;\r\n continue;\r\n }\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating faces & normal\r\n var normals = [];\r\n var positions = newdata[_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind];\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n var p1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, index * 3);\r\n var p2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, (index + 1) * 3);\r\n var p3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, (index + 2) * 3);\r\n var p1p2 = p1.subtract(p2);\r\n var p3p2 = p3.subtract(p2);\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Cross(p1p2, p3p2));\r\n // Store same normals for every vertex\r\n for (var localIndex = 0; localIndex < 3; localIndex++) {\r\n normals.push(normal.x);\r\n normals.push(normal.y);\r\n normals.push(normal.z);\r\n }\r\n }\r\n this.setIndices(indices);\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals, updatableNormals);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.\r\n * In other words, more vertices, no more indices and a single bigger VBO.\r\n * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToUnIndexedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating indices\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n }\r\n this.setIndices(indices);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this._unIndexed = true;\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * Inverses facet orientations.\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param flipNormals will also inverts the normals\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.flipFaces = function (flipNormals) {\r\n if (flipNormals === void 0) { flipNormals = false; }\r\n var vertex_data = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(this);\r\n var i;\r\n if (flipNormals && this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind) && vertex_data.normals) {\r\n for (i = 0; i < vertex_data.normals.length; i++) {\r\n vertex_data.normals[i] *= -1;\r\n }\r\n }\r\n if (vertex_data.indices) {\r\n var temp;\r\n for (i = 0; i < vertex_data.indices.length; i += 3) {\r\n // reassign indices\r\n temp = vertex_data.indices[i + 1];\r\n vertex_data.indices[i + 1] = vertex_data.indices[i + 2];\r\n vertex_data.indices[i + 2] = temp;\r\n }\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind));\r\n return this;\r\n };\r\n /**\r\n * Increase the number of facets and hence vertices in a mesh\r\n * Vertex normals are interpolated from existing vertex normals\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1\r\n */\r\n Mesh.prototype.increaseVertices = function (numberPerEdge) {\r\n var vertex_data = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(this);\r\n var uvs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var positions = vertex_data.positions;\r\n var normals = vertex_data.normals;\r\n if (currentIndices === null || positions === null || normals === null || uvs === null) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"VertexData contains null entries\");\r\n }\r\n else {\r\n var segments = numberPerEdge + 1; //segments per current facet edge, become sides of new facets\r\n var tempIndices = new Array();\r\n for (var i = 0; i < segments + 1; i++) {\r\n tempIndices[i] = new Array();\r\n }\r\n var a; //vertex index of one end of a side\r\n var b; //vertex index of other end of the side\r\n var deltaPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](0, 0, 0);\r\n var deltaNormal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](0, 0, 0);\r\n var deltaUV = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](0, 0);\r\n var indices = new Array();\r\n var vertexIndex = new Array();\r\n var side = new Array();\r\n var len;\r\n var positionPtr = positions.length;\r\n var uvPtr = uvs.length;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n vertexIndex[0] = currentIndices[i];\r\n vertexIndex[1] = currentIndices[i + 1];\r\n vertexIndex[2] = currentIndices[i + 2];\r\n for (var j = 0; j < 3; j++) {\r\n a = vertexIndex[j];\r\n b = vertexIndex[(j + 1) % 3];\r\n if (side[a] === undefined && side[b] === undefined) {\r\n side[a] = new Array();\r\n side[b] = new Array();\r\n }\r\n else {\r\n if (side[a] === undefined) {\r\n side[a] = new Array();\r\n }\r\n if (side[b] === undefined) {\r\n side[b] = new Array();\r\n }\r\n }\r\n if (side[a][b] === undefined && side[b][a] === undefined) {\r\n side[a][b] = [];\r\n deltaPosition.x = (positions[3 * b] - positions[3 * a]) / segments;\r\n deltaPosition.y = (positions[3 * b + 1] - positions[3 * a + 1]) / segments;\r\n deltaPosition.z = (positions[3 * b + 2] - positions[3 * a + 2]) / segments;\r\n deltaNormal.x = (normals[3 * b] - normals[3 * a]) / segments;\r\n deltaNormal.y = (normals[3 * b + 1] - normals[3 * a + 1]) / segments;\r\n deltaNormal.z = (normals[3 * b + 2] - normals[3 * a + 2]) / segments;\r\n deltaUV.x = (uvs[2 * b] - uvs[2 * a]) / segments;\r\n deltaUV.y = (uvs[2 * b + 1] - uvs[2 * a + 1]) / segments;\r\n side[a][b].push(a);\r\n for (var k = 1; k < segments; k++) {\r\n side[a][b].push(positions.length / 3);\r\n positions[positionPtr] = positions[3 * a] + k * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * a] + k * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * a + 1] + k * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * a + 1] + k * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * a + 2] + k * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * a + 2] + k * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * a] + k * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * a + 1] + k * deltaUV.y;\r\n }\r\n side[a][b].push(b);\r\n side[b][a] = new Array();\r\n len = side[a][b].length;\r\n for (var idx = 0; idx < len; idx++) {\r\n side[b][a][idx] = side[a][b][len - 1 - idx];\r\n }\r\n }\r\n }\r\n //Calculate positions, normals and uvs of new internal vertices\r\n tempIndices[0][0] = currentIndices[i];\r\n tempIndices[1][0] = side[currentIndices[i]][currentIndices[i + 1]][1];\r\n tempIndices[1][1] = side[currentIndices[i]][currentIndices[i + 2]][1];\r\n for (var k = 2; k < segments; k++) {\r\n tempIndices[k][0] = side[currentIndices[i]][currentIndices[i + 1]][k];\r\n tempIndices[k][k] = side[currentIndices[i]][currentIndices[i + 2]][k];\r\n deltaPosition.x = (positions[3 * tempIndices[k][k]] - positions[3 * tempIndices[k][0]]) / k;\r\n deltaPosition.y = (positions[3 * tempIndices[k][k] + 1] - positions[3 * tempIndices[k][0] + 1]) / k;\r\n deltaPosition.z = (positions[3 * tempIndices[k][k] + 2] - positions[3 * tempIndices[k][0] + 2]) / k;\r\n deltaNormal.x = (normals[3 * tempIndices[k][k]] - normals[3 * tempIndices[k][0]]) / k;\r\n deltaNormal.y = (normals[3 * tempIndices[k][k] + 1] - normals[3 * tempIndices[k][0] + 1]) / k;\r\n deltaNormal.z = (normals[3 * tempIndices[k][k] + 2] - normals[3 * tempIndices[k][0] + 2]) / k;\r\n deltaUV.x = (uvs[2 * tempIndices[k][k]] - uvs[2 * tempIndices[k][0]]) / k;\r\n deltaUV.y = (uvs[2 * tempIndices[k][k] + 1] - uvs[2 * tempIndices[k][0] + 1]) / k;\r\n for (var j = 1; j < k; j++) {\r\n tempIndices[k][j] = positions.length / 3;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0]] + j * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0]] + j * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 1] + j * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 1] + j * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 2] + j * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 2] + j * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0]] + j * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0] + 1] + j * deltaUV.y;\r\n }\r\n }\r\n tempIndices[segments] = side[currentIndices[i + 1]][currentIndices[i + 2]];\r\n // reform indices\r\n indices.push(tempIndices[0][0], tempIndices[1][0], tempIndices[1][1]);\r\n for (var k = 1; k < segments; k++) {\r\n for (var j = 0; j < k; j++) {\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j + 1], tempIndices[k][j + 1]);\r\n }\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n }\r\n }\r\n vertex_data.indices = indices;\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind));\r\n }\r\n };\r\n /**\r\n * Force adjacent facets to share vertices and remove any facets that have all vertices in a line\r\n * This will undo any application of covertToFlatShadedMesh\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n */\r\n Mesh.prototype.forceSharedVertices = function () {\r\n var vertex_data = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(this);\r\n var currentUVs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var currentPositions = vertex_data.positions;\r\n var currentColors = vertex_data.colors;\r\n if (currentIndices === void 0 || currentPositions === void 0 || currentIndices === null || currentPositions === null) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"VertexData contains empty entries\");\r\n }\r\n else {\r\n var positions = new Array();\r\n var indices = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var pstring = new Array(); //lists facet vertex positions (a,b,c) as string \"a|b|c\"\r\n var indexPtr = 0; // pointer to next available index value\r\n var uniquePositions = new Array(); // unique vertex positions\r\n var ptr; // pointer to element in uniquePositions\r\n var facet;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n facet = [currentIndices[i], currentIndices[i + 1], currentIndices[i + 2]]; //facet vertex indices\r\n pstring = new Array();\r\n for (var j = 0; j < 3; j++) {\r\n pstring[j] = \"\";\r\n for (var k = 0; k < 3; k++) {\r\n //small values make 0\r\n if (Math.abs(currentPositions[3 * facet[j] + k]) < 0.00000001) {\r\n currentPositions[3 * facet[j] + k] = 0;\r\n }\r\n pstring[j] += currentPositions[3 * facet[j] + k] + \"|\";\r\n }\r\n pstring[j] = pstring[j].slice(0, -1);\r\n }\r\n //check facet vertices to see that none are repeated\r\n // do not process any facet that has a repeated vertex, ie is a line\r\n if (!(pstring[0] == pstring[1] || pstring[0] == pstring[2] || pstring[1] == pstring[2])) {\r\n //for each facet position check if already listed in uniquePositions\r\n // if not listed add to uniquePositions and set index pointer\r\n // if listed use its index in uniquePositions and new index pointer\r\n for (var j = 0; j < 3; j++) {\r\n ptr = uniquePositions.indexOf(pstring[j]);\r\n if (ptr < 0) {\r\n uniquePositions.push(pstring[j]);\r\n ptr = indexPtr++;\r\n //not listed so add individual x, y, z coordinates to positions\r\n for (var k = 0; k < 3; k++) {\r\n positions.push(currentPositions[3 * facet[j] + k]);\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n for (var k = 0; k < 4; k++) {\r\n colors.push(currentColors[4 * facet[j] + k]);\r\n }\r\n }\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n for (var k = 0; k < 2; k++) {\r\n uvs.push(currentUVs[2 * facet[j] + k]);\r\n }\r\n }\r\n }\r\n // add new index pointer to indices array\r\n indices.push(ptr);\r\n }\r\n }\r\n }\r\n var normals = new Array();\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n //create new vertex data object and update\r\n vertex_data.positions = positions;\r\n vertex_data.indices = indices;\r\n vertex_data.normals = normals;\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n vertex_data.uvs = uvs;\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n vertex_data.colors = colors;\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind));\r\n }\r\n };\r\n // Instances\r\n /** @hidden */\r\n Mesh._instancedMeshFactory = function (name, mesh) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"InstancedMesh\");\r\n };\r\n /** @hidden */\r\n Mesh._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"PhysicsImpostor\");\r\n };\r\n /**\r\n * Creates a new InstancedMesh object from the mesh model.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedMesh\r\n */\r\n Mesh.prototype.createInstance = function (name) {\r\n return Mesh._instancedMeshFactory(name, this);\r\n };\r\n /**\r\n * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.\r\n * After this call, all the mesh instances have the same submeshes than the current mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.synchronizeInstances = function () {\r\n for (var instanceIndex = 0; instanceIndex < this.instances.length; instanceIndex++) {\r\n var instance = this.instances[instanceIndex];\r\n instance._syncSubMeshes();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Optimization of the mesh's indices, in case a mesh has duplicated vertices.\r\n * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.\r\n * This should be used together with the simplification to avoid disappearing triangles.\r\n * @param successCallback an optional success callback to be called after the optimization finished.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.optimizeIndices = function (successCallback) {\r\n var _this = this;\r\n var indices = this.getIndices();\r\n var positions = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!positions || !indices) {\r\n return this;\r\n }\r\n var vectorPositions = new Array();\r\n for (var pos = 0; pos < positions.length; pos = pos + 3) {\r\n vectorPositions.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, pos));\r\n }\r\n var dupes = new Array();\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"AsyncLoop\"].SyncAsyncForLoop(vectorPositions.length, 40, function (iteration) {\r\n var realPos = vectorPositions.length - 1 - iteration;\r\n var testedPosition = vectorPositions[realPos];\r\n for (var j = 0; j < realPos; ++j) {\r\n var againstPosition = vectorPositions[j];\r\n if (testedPosition.equals(againstPosition)) {\r\n dupes[realPos] = j;\r\n break;\r\n }\r\n }\r\n }, function () {\r\n for (var i = 0; i < indices.length; ++i) {\r\n indices[i] = dupes[indices[i]] || indices[i];\r\n }\r\n //indices are now reordered\r\n var originalSubMeshes = _this.subMeshes.slice(0);\r\n _this.setIndices(indices);\r\n _this.subMeshes = originalSubMeshes;\r\n if (successCallback) {\r\n successCallback(_this);\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Serialize current mesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n */\r\n Mesh.prototype.serialize = function (serializationObject) {\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n serializationObject.type = this.getClassName();\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].HasTags(this)) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].GetTags(this);\r\n }\r\n serializationObject.position = this.position.asArray();\r\n if (this.rotationQuaternion) {\r\n serializationObject.rotationQuaternion = this.rotationQuaternion.asArray();\r\n }\r\n else if (this.rotation) {\r\n serializationObject.rotation = this.rotation.asArray();\r\n }\r\n serializationObject.scaling = this.scaling.asArray();\r\n if (this._postMultiplyPivotMatrix) {\r\n serializationObject.pivotMatrix = this.getPivotMatrix().asArray();\r\n }\r\n else {\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n }\r\n serializationObject.isEnabled = this.isEnabled(false);\r\n serializationObject.isVisible = this.isVisible;\r\n serializationObject.infiniteDistance = this.infiniteDistance;\r\n serializationObject.pickable = this.isPickable;\r\n serializationObject.receiveShadows = this.receiveShadows;\r\n serializationObject.billboardMode = this.billboardMode;\r\n serializationObject.visibility = this.visibility;\r\n serializationObject.checkCollisions = this.checkCollisions;\r\n serializationObject.isBlocker = this.isBlocker;\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Geometry\r\n serializationObject.isUnIndexed = this.isUnIndexed;\r\n var geometry = this._geometry;\r\n if (geometry) {\r\n var geometryId = geometry.id;\r\n serializationObject.geometryId = geometryId;\r\n // SubMeshes\r\n serializationObject.subMeshes = [];\r\n for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n serializationObject.subMeshes.push({\r\n materialIndex: subMesh.materialIndex,\r\n verticesStart: subMesh.verticesStart,\r\n verticesCount: subMesh.verticesCount,\r\n indexStart: subMesh.indexStart,\r\n indexCount: subMesh.indexCount\r\n });\r\n }\r\n }\r\n // Material\r\n if (this.material) {\r\n if (!this.material.doNotSerialize) {\r\n serializationObject.materialId = this.material.id;\r\n }\r\n }\r\n else {\r\n this.material = null;\r\n }\r\n // Morph targets\r\n if (this.morphTargetManager) {\r\n serializationObject.morphTargetManagerId = this.morphTargetManager.uniqueId;\r\n }\r\n // Skeleton\r\n if (this.skeleton) {\r\n serializationObject.skeletonId = this.skeleton.id;\r\n }\r\n // Physics\r\n //TODO implement correct serialization for physics impostors.\r\n if (this.getScene()._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_22__[\"SceneComponentConstants\"].NAME_PHYSICSENGINE)) {\r\n var impostor = this.getPhysicsImpostor();\r\n if (impostor) {\r\n serializationObject.physicsMass = impostor.getParam(\"mass\");\r\n serializationObject.physicsFriction = impostor.getParam(\"friction\");\r\n serializationObject.physicsRestitution = impostor.getParam(\"mass\");\r\n serializationObject.physicsImpostor = impostor.type;\r\n }\r\n }\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n // Instances\r\n serializationObject.instances = [];\r\n for (var index = 0; index < this.instances.length; index++) {\r\n var instance = this.instances[index];\r\n if (instance.doNotSerialize) {\r\n continue;\r\n }\r\n var serializationInstance = {\r\n name: instance.name,\r\n id: instance.id,\r\n position: instance.position.asArray(),\r\n scaling: instance.scaling.asArray()\r\n };\r\n if (instance.parent) {\r\n serializationInstance.parentId = instance.parent.id;\r\n }\r\n if (instance.rotationQuaternion) {\r\n serializationInstance.rotationQuaternion = instance.rotationQuaternion.asArray();\r\n }\r\n else if (instance.rotation) {\r\n serializationInstance.rotation = instance.rotation.asArray();\r\n }\r\n serializationObject.instances.push(serializationInstance);\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].AppendSerializedAnimations(instance, serializationInstance);\r\n serializationInstance.ranges = instance.serializeAnimationRanges();\r\n }\r\n //\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n // Layer mask\r\n serializationObject.layerMask = this.layerMask;\r\n // Alpha\r\n serializationObject.alphaIndex = this.alphaIndex;\r\n serializationObject.hasVertexAlpha = this.hasVertexAlpha;\r\n // Overlay\r\n serializationObject.overlayAlpha = this.overlayAlpha;\r\n serializationObject.overlayColor = this.overlayColor.asArray();\r\n serializationObject.renderOverlay = this.renderOverlay;\r\n // Fog\r\n serializationObject.applyFog = this.applyFog;\r\n // Action Manager\r\n if (this.actionManager) {\r\n serializationObject.actions = this.actionManager.serialize(this.name);\r\n }\r\n };\r\n /** @hidden */\r\n Mesh.prototype._syncGeometryWithMorphTargetManager = function () {\r\n if (!this.geometry) {\r\n return;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n var morphTargetManager = this._internalMeshDataInfo._morphTargetManager;\r\n if (morphTargetManager && morphTargetManager.vertexCount) {\r\n if (morphTargetManager.vertexCount !== this.getTotalVertices()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Error(\"Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count.\");\r\n this.morphTargetManager = null;\r\n return;\r\n }\r\n for (var index = 0; index < morphTargetManager.numInfluencers; index++) {\r\n var morphTarget = morphTargetManager.getActiveTarget(index);\r\n var positions = morphTarget.getPositions();\r\n if (!positions) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Error(\"Invalid morph target. Target must have positions.\");\r\n return;\r\n }\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind + index, positions, false, 3);\r\n var normals = morphTarget.getNormals();\r\n if (normals) {\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind + index, normals, false, 3);\r\n }\r\n var tangents = morphTarget.getTangents();\r\n if (tangents) {\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].TangentKind + index, tangents, false, 3);\r\n }\r\n var uvs = morphTarget.getUVs();\r\n if (uvs) {\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind + \"_\" + index, uvs, false, 2);\r\n }\r\n }\r\n }\r\n else {\r\n var index = 0;\r\n // Positions\r\n while (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind + index);\r\n if (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].TangentKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].TangentKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind + \"_\" + index);\r\n }\r\n index++;\r\n }\r\n }\r\n };\r\n /**\r\n * Returns a new Mesh object parsed from the source provided.\r\n * @param parsedMesh is the source\r\n * @param scene defines the hosting scene\r\n * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new Mesh\r\n */\r\n Mesh.Parse = function (parsedMesh, scene, rootUrl) {\r\n var mesh;\r\n if (parsedMesh.type && parsedMesh.type === \"GroundMesh\") {\r\n mesh = Mesh._GroundMeshParser(parsedMesh, scene);\r\n }\r\n else {\r\n mesh = new Mesh(parsedMesh.name, scene);\r\n }\r\n mesh.id = parsedMesh.id;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(mesh, parsedMesh.tags);\r\n }\r\n mesh.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.position);\r\n if (parsedMesh.metadata !== undefined) {\r\n mesh.metadata = parsedMesh.metadata;\r\n }\r\n if (parsedMesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"].FromArray(parsedMesh.rotationQuaternion);\r\n }\r\n else if (parsedMesh.rotation) {\r\n mesh.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.rotation);\r\n }\r\n mesh.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.scaling);\r\n if (parsedMesh.localMatrix) {\r\n mesh.setPreTransformMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromArray(parsedMesh.localMatrix));\r\n }\r\n else if (parsedMesh.pivotMatrix) {\r\n mesh.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromArray(parsedMesh.pivotMatrix));\r\n }\r\n mesh.setEnabled(parsedMesh.isEnabled);\r\n mesh.isVisible = parsedMesh.isVisible;\r\n mesh.infiniteDistance = parsedMesh.infiniteDistance;\r\n mesh.showBoundingBox = parsedMesh.showBoundingBox;\r\n mesh.showSubMeshesBoundingBox = parsedMesh.showSubMeshesBoundingBox;\r\n if (parsedMesh.applyFog !== undefined) {\r\n mesh.applyFog = parsedMesh.applyFog;\r\n }\r\n if (parsedMesh.pickable !== undefined) {\r\n mesh.isPickable = parsedMesh.pickable;\r\n }\r\n if (parsedMesh.alphaIndex !== undefined) {\r\n mesh.alphaIndex = parsedMesh.alphaIndex;\r\n }\r\n mesh.receiveShadows = parsedMesh.receiveShadows;\r\n mesh.billboardMode = parsedMesh.billboardMode;\r\n if (parsedMesh.visibility !== undefined) {\r\n mesh.visibility = parsedMesh.visibility;\r\n }\r\n mesh.checkCollisions = parsedMesh.checkCollisions;\r\n if (parsedMesh.isBlocker !== undefined) {\r\n mesh.isBlocker = parsedMesh.isBlocker;\r\n }\r\n mesh._shouldGenerateFlatShading = parsedMesh.useFlatShading;\r\n // freezeWorldMatrix\r\n if (parsedMesh.freezeWorldMatrix) {\r\n mesh._waitingData.freezeWorldMatrix = parsedMesh.freezeWorldMatrix;\r\n }\r\n // Parent\r\n if (parsedMesh.parentId) {\r\n mesh._waitingParentId = parsedMesh.parentId;\r\n }\r\n // Actions\r\n if (parsedMesh.actions !== undefined) {\r\n mesh._waitingData.actions = parsedMesh.actions;\r\n }\r\n // Overlay\r\n if (parsedMesh.overlayAlpha !== undefined) {\r\n mesh.overlayAlpha = parsedMesh.overlayAlpha;\r\n }\r\n if (parsedMesh.overlayColor !== undefined) {\r\n mesh.overlayColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__[\"Color3\"].FromArray(parsedMesh.overlayColor);\r\n }\r\n if (parsedMesh.renderOverlay !== undefined) {\r\n mesh.renderOverlay = parsedMesh.renderOverlay;\r\n }\r\n // Geometry\r\n mesh.isUnIndexed = !!parsedMesh.isUnIndexed;\r\n mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;\r\n if (parsedMesh.delayLoadingFile) {\r\n mesh.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_13__[\"BoundingInfo\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.boundingBoxMinimum), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.boundingBoxMaximum));\r\n if (parsedMesh._binaryInfo) {\r\n mesh._binaryInfo = parsedMesh._binaryInfo;\r\n }\r\n mesh._delayInfo = [];\r\n if (parsedMesh.hasUVs) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (parsedMesh.hasUVs2) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (parsedMesh.hasUVs3) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV3Kind);\r\n }\r\n if (parsedMesh.hasUVs4) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV4Kind);\r\n }\r\n if (parsedMesh.hasUVs5) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV5Kind);\r\n }\r\n if (parsedMesh.hasUVs6) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV6Kind);\r\n }\r\n if (parsedMesh.hasColors) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].ColorKind);\r\n }\r\n if (parsedMesh.hasMatricesIndices) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind);\r\n }\r\n if (parsedMesh.hasMatricesWeights) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n }\r\n mesh._delayLoadingFunction = _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"]._ImportGeometry;\r\n if (_Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_16__[\"SceneLoaderFlags\"].ForceFullSceneLoadingForIncremental) {\r\n mesh._checkDelayState();\r\n }\r\n }\r\n else {\r\n _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"]._ImportGeometry(parsedMesh, mesh);\r\n }\r\n // Material\r\n if (parsedMesh.materialId) {\r\n mesh.setMaterialByID(parsedMesh.materialId);\r\n }\r\n else {\r\n mesh.material = null;\r\n }\r\n // Morph targets\r\n if (parsedMesh.morphTargetManagerId > -1) {\r\n mesh.morphTargetManager = scene.getMorphTargetManagerById(parsedMesh.morphTargetManagerId);\r\n }\r\n // Skeleton\r\n if (parsedMesh.skeletonId > -1) {\r\n mesh.skeleton = scene.getLastSkeletonByID(parsedMesh.skeletonId);\r\n if (parsedMesh.numBoneInfluencers) {\r\n mesh.numBoneInfluencers = parsedMesh.numBoneInfluencers;\r\n }\r\n }\r\n // Animations\r\n if (parsedMesh.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedMesh.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedMesh.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_20__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n mesh.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].ParseAnimationRanges(mesh, parsedMesh, scene);\r\n }\r\n if (parsedMesh.autoAnimate) {\r\n scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);\r\n }\r\n // Layer Mask\r\n if (parsedMesh.layerMask && (!isNaN(parsedMesh.layerMask))) {\r\n mesh.layerMask = Math.abs(parseInt(parsedMesh.layerMask));\r\n }\r\n else {\r\n mesh.layerMask = 0x0FFFFFFF;\r\n }\r\n // Physics\r\n if (parsedMesh.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, mesh, parsedMesh);\r\n }\r\n // Levels\r\n if (parsedMesh.lodMeshIds) {\r\n mesh._waitingData.lods = {\r\n ids: parsedMesh.lodMeshIds,\r\n distances: (parsedMesh.lodDistances) ? parsedMesh.lodDistances : null,\r\n coverages: (parsedMesh.lodCoverages) ? parsedMesh.lodCoverages : null\r\n };\r\n }\r\n // Instances\r\n if (parsedMesh.instances) {\r\n for (var index = 0; index < parsedMesh.instances.length; index++) {\r\n var parsedInstance = parsedMesh.instances[index];\r\n var instance = mesh.createInstance(parsedInstance.name);\r\n if (parsedInstance.id) {\r\n instance.id = parsedInstance.id;\r\n }\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"]) {\r\n if (parsedInstance.tags) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(instance, parsedInstance.tags);\r\n }\r\n else {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(instance, parsedMesh.tags);\r\n }\r\n }\r\n instance.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedInstance.position);\r\n if (parsedInstance.metadata !== undefined) {\r\n instance.metadata = parsedInstance.metadata;\r\n }\r\n if (parsedInstance.parentId) {\r\n instance._waitingParentId = parsedInstance.parentId;\r\n }\r\n if (parsedInstance.rotationQuaternion) {\r\n instance.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"].FromArray(parsedInstance.rotationQuaternion);\r\n }\r\n else if (parsedInstance.rotation) {\r\n instance.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedInstance.rotation);\r\n }\r\n instance.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedInstance.scaling);\r\n if (parsedInstance.checkCollisions != undefined && parsedInstance.checkCollisions != null) {\r\n instance.checkCollisions = parsedInstance.checkCollisions;\r\n }\r\n if (parsedInstance.pickable != undefined && parsedInstance.pickable != null) {\r\n instance.isPickable = parsedInstance.pickable;\r\n }\r\n if (parsedInstance.showBoundingBox != undefined && parsedInstance.showBoundingBox != null) {\r\n instance.showBoundingBox = parsedInstance.showBoundingBox;\r\n }\r\n if (parsedInstance.showSubMeshesBoundingBox != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.showSubMeshesBoundingBox = parsedInstance.showSubMeshesBoundingBox;\r\n }\r\n if (parsedInstance.alphaIndex != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.alphaIndex = parsedInstance.alphaIndex;\r\n }\r\n // Physics\r\n if (parsedInstance.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, instance, parsedInstance);\r\n }\r\n // Animation\r\n if (parsedInstance.animations) {\r\n for (animationIndex = 0; animationIndex < parsedInstance.animations.length; animationIndex++) {\r\n parsedAnimation = parsedInstance.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_20__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n instance.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].ParseAnimationRanges(instance, parsedInstance, scene);\r\n if (parsedInstance.autoAnimate) {\r\n scene.beginAnimation(instance, parsedInstance.autoAnimateFrom, parsedInstance.autoAnimateTo, parsedInstance.autoAnimateLoop, parsedInstance.autoAnimateSpeed || 1.0);\r\n }\r\n }\r\n }\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Creates a ribbon mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\r\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\r\n * @param closePath creates a seam between the first and the last points of each path of the path array\r\n * @param offset is taken in account only if the `pathArray` is containing a single path\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateRibbon = function (name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the radius size (float) of the polygon (default 0.5)\r\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDisc = function (name, radius, tessellation, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a box mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of each box side (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateHemisphere = function (name, segments, diameter, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\r\n * @param diameterTop set the top cap diameter (floats, default 1)\r\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\r\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\r\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n // Torus (Code from SharpDX.org)\r\n /**\r\n * Creates a torus mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param diameter sets the diameter size (float) of the torus (default 1)\r\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param tessellation sets the number of torus sides (postive integer, default 16)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a torus knot mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the global radius size (float) of the torus knot (default 2)\r\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\r\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * @param p the number of windings on X axis (positive integers, default 2)\r\n * @param q the number of windings on Y axis (positive integers, default 3)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorusKnot = function (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a line mesh. Please consider using the same method from the MeshBuilder class instead.\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a dashed line mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\r\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\r\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\r\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * Remember you can only change the shape positions, not their number when updating a polygon.\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolygon = function (name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction. Please consider using the same method from the MeshBuilder class instead.\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param depth defines the height of extrusion\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudePolygon = function (name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded shape mesh.\r\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters. Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scale is the value to scale the shape\r\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShape = function (name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scaleFunction is a custom Javascript function called on each path point\r\n * @param rotationFunction is a custom Javascript function called on each path point\r\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShapeCustom = function (name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * @param radius is the radius value of the lathe\r\n * @param tessellation is the side number of the lathe.\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLathe = function (name, shape, radius, tessellation, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of both sides of the plane at once (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param width set the width of the ground\r\n * @param height set the height of the ground\r\n * @param subdivisions sets the number of subdivisions per side\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGround = function (name, width, height, subdivisions, scene, updatable) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tiled ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param xmin set the ground minimum X coordinate\r\n * @param zmin set the ground minimum Y coordinate\r\n * @param xmax set the ground maximum X coordinate\r\n * @param zmax set the ground maximum Z coordinate\r\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTiledGround = function (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh from a height map.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/babylon101/height_map\r\n * @param name defines the name of the mesh to create\r\n * @param url sets the URL of the height map image resource\r\n * @param width set the ground width size\r\n * @param height set the ground height size\r\n * @param subdivisions sets the number of subdivision per side\r\n * @param minHeight is the minimum altitude on the ground\r\n * @param maxHeight is the maximum altitude on the ground\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\r\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * @param radius sets the tube radius size\r\n * @param tessellation is the number of sides on the tubular surface\r\n * @param radiusFunction is a custom function. If it is not null, it overwrittes the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polyhedron mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh to create\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolyhedron = function (name, options, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @see http://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n Mesh.CreateIcoSphere = function (name, options, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a decal mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh receiving the decal\r\n * @param position sets the position of the decal in world coordinates\r\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\r\n * @param size sets the decal scaling\r\n * @param angle sets the angle to rotate the decal\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDecal = function (name, sourceMesh, position, normal, size, angle) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n // Skeletons\r\n /**\r\n * Prepare internal position array for software CPU skinning\r\n * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh\r\n */\r\n Mesh.prototype.setPositionsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var source = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!source) {\r\n return internalDataInfo._sourcePositions;\r\n }\r\n internalDataInfo._sourcePositions = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)) {\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourcePositions;\r\n };\r\n /**\r\n * Prepare internal normal array for software CPU skinning\r\n * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.\r\n */\r\n Mesh.prototype.setNormalsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourceNormals) {\r\n var source = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n if (!source) {\r\n return internalDataInfo._sourceNormals;\r\n }\r\n internalDataInfo._sourceNormals = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)) {\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourceNormals;\r\n };\r\n /**\r\n * Updates the vertex buffer by applying transformation from the bones\r\n * @param skeleton defines the skeleton to apply to current mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.applySkeleton = function (skeleton) {\r\n if (!this.geometry) {\r\n return this;\r\n }\r\n if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) {\r\n return this;\r\n }\r\n this.geometry._softwareSkinningFrameId = this.getScene().getFrameId();\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n return this;\r\n }\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var submeshes = this.subMeshes.slice();\r\n this.setPositionsForCPUSkinning();\r\n this.subMeshes = submeshes;\r\n }\r\n if (!internalDataInfo._sourceNormals) {\r\n this.setNormalsForCPUSkinning();\r\n }\r\n // positionsData checks for not being Float32Array will only pass at most once\r\n var positionsData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!positionsData) {\r\n return this;\r\n }\r\n if (!(positionsData instanceof Float32Array)) {\r\n positionsData = new Float32Array(positionsData);\r\n }\r\n // normalsData checks for not being Float32Array will only pass at most once\r\n var normalsData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n if (!normalsData) {\r\n return this;\r\n }\r\n if (!(normalsData instanceof Float32Array)) {\r\n normalsData = new Float32Array(normalsData);\r\n }\r\n var matricesIndicesData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (!matricesWeightsData || !matricesIndicesData) {\r\n return this;\r\n }\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind) : null;\r\n var skeletonMatrices = skeleton.getTransformMatrices(this);\r\n var tempVector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n var finalMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]();\r\n var tempMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]();\r\n var matWeightIdx = 0;\r\n var inf;\r\n for (var index = 0; index < positionsData.length; index += 3, matWeightIdx += 4) {\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(internalDataInfo._sourcePositions[index], internalDataInfo._sourcePositions[index + 1], internalDataInfo._sourcePositions[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(positionsData, index);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformNormalFromFloatsToRef(internalDataInfo._sourceNormals[index], internalDataInfo._sourceNormals[index + 1], internalDataInfo._sourceNormals[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(normalsData, index);\r\n finalMatrix.reset();\r\n }\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positionsData);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normalsData);\r\n return this;\r\n };\r\n // Tools\r\n /**\r\n * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates\r\n * @param meshes defines the list of meshes to scan\r\n * @returns an object `{min:` Vector3`, max:` Vector3`}`\r\n */\r\n Mesh.MinMax = function (meshes) {\r\n var minVector = null;\r\n var maxVector = null;\r\n meshes.forEach(function (mesh) {\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n if (!minVector || !maxVector) {\r\n minVector = boundingBox.minimumWorld;\r\n maxVector = boundingBox.maximumWorld;\r\n }\r\n else {\r\n minVector.minimizeInPlace(boundingBox.minimumWorld);\r\n maxVector.maximizeInPlace(boundingBox.maximumWorld);\r\n }\r\n });\r\n if (!minVector || !maxVector) {\r\n return {\r\n min: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero(),\r\n max: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero()\r\n };\r\n }\r\n return {\r\n min: minVector,\r\n max: maxVector\r\n };\r\n };\r\n /**\r\n * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array\r\n * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object\r\n * @returns a vector3\r\n */\r\n Mesh.Center = function (meshesOrMinMaxVector) {\r\n var minMaxVector = (meshesOrMinMaxVector instanceof Array) ? Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Center(minMaxVector.min, minMaxVector.max);\r\n };\r\n /**\r\n * Merge the array of meshes into a single mesh for performance reasons.\r\n * @param meshes defines he vertices source. They should all be of the same material. Entries can empty\r\n * @param disposeSource when true (default), dispose of the vertices from the source meshes\r\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true\r\n * @param meshSubclass when set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.\r\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh to his subMesh array with meshes source.\r\n * @param multiMultiMaterials when true (false default), subdivide mesh and accept multiple multi materials, ignores subdivideWithSubMeshes.\r\n * @returns a new mesh\r\n */\r\n Mesh.MergeMeshes = function (meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\r\n if (disposeSource === void 0) { disposeSource = true; }\r\n var index;\r\n if (!allow32BitsIndices) {\r\n var totalVertices = 0;\r\n // Counting vertices\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n totalVertices += meshes[index].getTotalVertices();\r\n if (totalVertices >= 65536) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\");\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n var newMultiMaterial = null;\r\n var subIndex;\r\n var matIndex;\r\n subdivideWithSubMeshes = false;\r\n }\r\n var materialArray = new Array();\r\n var materialIndexArray = new Array();\r\n // Merge\r\n var vertexData = null;\r\n var otherVertexData;\r\n var indiceArray = new Array();\r\n var source = null;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n var mesh = meshes[index];\r\n if (mesh.isAnInstance) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"Cannot merge instance meshes.\");\r\n return null;\r\n }\r\n var wm = mesh.computeWorldMatrix(true);\r\n otherVertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(mesh, true, true);\r\n otherVertexData.transform(wm);\r\n if (vertexData) {\r\n vertexData.merge(otherVertexData, allow32BitsIndices);\r\n }\r\n else {\r\n vertexData = otherVertexData;\r\n source = mesh;\r\n }\r\n if (subdivideWithSubMeshes) {\r\n indiceArray.push(mesh.getTotalIndices());\r\n }\r\n if (multiMultiMaterials) {\r\n if (mesh.material) {\r\n var material = mesh.material;\r\n if (material instanceof _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_15__[\"MultiMaterial\"]) {\r\n for (matIndex = 0; matIndex < material.subMaterials.length; matIndex++) {\r\n if (materialArray.indexOf(material.subMaterials[matIndex]) < 0) {\r\n materialArray.push(material.subMaterials[matIndex]);\r\n }\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material.subMaterials[mesh.subMeshes[subIndex].materialIndex]));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n else {\r\n if (materialArray.indexOf(material) < 0) {\r\n materialArray.push(material);\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n else {\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(0);\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n source = source;\r\n if (!meshSubclass) {\r\n meshSubclass = new Mesh(source.name + \"_merged\", source.getScene());\r\n }\r\n vertexData.applyToMesh(meshSubclass);\r\n // Setting properties\r\n meshSubclass.checkCollisions = source.checkCollisions;\r\n // Cleaning\r\n if (disposeSource) {\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n meshes[index].dispose();\r\n }\r\n }\r\n }\r\n // Subdivide\r\n if (subdivideWithSubMeshes || multiMultiMaterials) {\r\n //-- removal of global submesh\r\n meshSubclass.releaseSubMeshes();\r\n index = 0;\r\n var offset = 0;\r\n //-- apply subdivision according to index table\r\n while (index < indiceArray.length) {\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].CreateFromIndices(0, offset, indiceArray[index], meshSubclass);\r\n offset += indiceArray[index];\r\n index++;\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n newMultiMaterial = new _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_15__[\"MultiMaterial\"](source.name + \"_merged\", source.getScene());\r\n newMultiMaterial.subMaterials = materialArray;\r\n for (subIndex = 0; subIndex < meshSubclass.subMeshes.length; subIndex++) {\r\n meshSubclass.subMeshes[subIndex].materialIndex = materialIndexArray[subIndex];\r\n }\r\n meshSubclass.material = newMultiMaterial;\r\n }\r\n else {\r\n meshSubclass.material = source.material;\r\n }\r\n return meshSubclass;\r\n };\r\n /** @hidden */\r\n Mesh.prototype.addInstance = function (instance) {\r\n instance._indexInSourceMeshInstanceArray = this.instances.length;\r\n this.instances.push(instance);\r\n };\r\n /** @hidden */\r\n Mesh.prototype.removeInstance = function (instance) {\r\n // Remove from mesh\r\n var index = instance._indexInSourceMeshInstanceArray;\r\n if (index != -1) {\r\n if (index !== this.instances.length - 1) {\r\n var last = this.instances[this.instances.length - 1];\r\n this.instances[index] = last;\r\n last._indexInSourceMeshInstanceArray = index;\r\n }\r\n instance._indexInSourceMeshInstanceArray = -1;\r\n this.instances.pop();\r\n }\r\n };\r\n // Consts\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n Mesh.FRONTSIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].FRONTSIDE;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n Mesh.BACKSIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].BACKSIDE;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n Mesh.DOUBLESIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].DOUBLESIDE;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n Mesh.DEFAULTSIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].DEFAULTSIDE;\r\n /**\r\n * Mesh cap setting : no cap\r\n */\r\n Mesh.NO_CAP = 0;\r\n /**\r\n * Mesh cap setting : one cap at the beginning of the mesh\r\n */\r\n Mesh.CAP_START = 1;\r\n /**\r\n * Mesh cap setting : one cap at the end of the mesh\r\n */\r\n Mesh.CAP_END = 2;\r\n /**\r\n * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh\r\n */\r\n Mesh.CAP_ALL = 3;\r\n /**\r\n * Mesh pattern setting : no flip or rotate\r\n */\r\n Mesh.NO_FLIP = 0;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_TILE = 1;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column\r\n */\r\n Mesh.ROTATE_TILE = 2;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows\r\n */\r\n Mesh.FLIP_ROW = 3;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) all tiles on alternate rows\r\n */\r\n Mesh.ROTATE_ROW = 4;\r\n /**\r\n * Mesh pattern setting : flip and rotate alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_N_ROTATE_TILE = 5;\r\n /**\r\n * Mesh pattern setting : rotate pattern and rotate\r\n */\r\n Mesh.FLIP_N_ROTATE_ROW = 6;\r\n /**\r\n * Mesh tile positioning : part tiles same on left/right or top/bottom\r\n */\r\n Mesh.CENTER = 0;\r\n /**\r\n * Mesh tile positioning : part tiles on left\r\n */\r\n Mesh.LEFT = 1;\r\n /**\r\n * Mesh tile positioning : part tiles on right\r\n */\r\n Mesh.RIGHT = 2;\r\n /**\r\n * Mesh tile positioning : part tiles on top\r\n */\r\n Mesh.TOP = 3;\r\n /**\r\n * Mesh tile positioning : part tiles on bottom\r\n */\r\n Mesh.BOTTOM = 4;\r\n // Statics\r\n /** @hidden */\r\n Mesh._GroundMeshParser = function (parsedMesh, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"GroundMesh\");\r\n };\r\n return Mesh;\r\n}(_abstractMesh__WEBPACK_IMPORTED_MODULE_11__[\"AbstractMesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/mesh.vertexData.ts\":\n/*!***********************************!*\\\n !*** ./Meshes/mesh.vertexData.ts ***!\n \\***********************************/\n/*! exports provided: VertexData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return VertexData; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This class contains the various kinds of data on every vertex of a mesh used in determining its shape and appearance\r\n */\r\nvar VertexData = /** @class */ (function () {\r\n function VertexData() {\r\n }\r\n /**\r\n * Uses the passed data array to set the set the values for the specified kind of data\r\n * @param data a linear array of floating numbers\r\n * @param kind the type of data that is being set, eg positions, colors etc\r\n */\r\n VertexData.prototype.set = function (data, kind) {\r\n switch (kind) {\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind:\r\n this.positions = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind:\r\n this.normals = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind:\r\n this.tangents = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind:\r\n this.uvs = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind:\r\n this.uvs2 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind:\r\n this.uvs3 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind:\r\n this.uvs4 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind:\r\n this.uvs5 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind:\r\n this.uvs6 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind:\r\n this.colors = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind:\r\n this.matricesIndices = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind:\r\n this.matricesWeights = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind:\r\n this.matricesIndicesExtra = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind:\r\n this.matricesWeightsExtra = data;\r\n break;\r\n }\r\n };\r\n /**\r\n * Associates the vertexData to the passed Mesh.\r\n * Sets it as updatable or not (default `false`)\r\n * @param mesh the mesh the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.applyToMesh = function (mesh, updatable) {\r\n this._applyTo(mesh, updatable);\r\n return this;\r\n };\r\n /**\r\n * Associates the vertexData to the passed Geometry.\r\n * Sets it as updatable or not (default `false`)\r\n * @param geometry the geometry the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.applyToGeometry = function (geometry, updatable) {\r\n this._applyTo(geometry, updatable);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated mesh\r\n * @param mesh the mesh to be updated\r\n * @param updateExtends when true the mesh BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.updateMesh = function (mesh) {\r\n this._update(mesh);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated geometry\r\n * @param geometry the geometry to be updated\r\n * @param updateExtends when true BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData.\r\n */\r\n VertexData.prototype.updateGeometry = function (geometry) {\r\n this._update(geometry);\r\n return this;\r\n };\r\n VertexData.prototype._applyTo = function (meshOrGeometry, updatable) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (this.positions) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, this.positions, updatable);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, this.normals, updatable);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, this.tangents, updatable);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, this.uvs, updatable);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, this.uvs2, updatable);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, this.uvs3, updatable);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, this.uvs4, updatable);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, this.uvs5, updatable);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, this.uvs6, updatable);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, this.colors, updatable);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, this.matricesIndices, updatable);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, this.matricesWeights, updatable);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, this.matricesIndicesExtra, updatable);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, this.matricesWeightsExtra, updatable);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null, updatable);\r\n }\r\n else {\r\n meshOrGeometry.setIndices([], null);\r\n }\r\n return this;\r\n };\r\n VertexData.prototype._update = function (meshOrGeometry, updateExtends, makeItUnique) {\r\n if (this.positions) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, this.positions, updateExtends, makeItUnique);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, this.normals, updateExtends, makeItUnique);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, this.tangents, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, this.uvs, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, this.uvs2, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, this.uvs3, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, this.uvs4, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, this.uvs5, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, this.uvs6, updateExtends, makeItUnique);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, this.colors, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, this.matricesIndices, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, this.matricesWeights, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, this.matricesIndicesExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, this.matricesWeightsExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Transforms each position and each normal of the vertexData according to the passed Matrix\r\n * @param matrix the transforming matrix\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.transform = function (matrix) {\r\n var flip = matrix.m[0] * matrix.m[5] * matrix.m[10] < 0;\r\n var transformed = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var index;\r\n if (this.positions) {\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n for (index = 0; index < this.positions.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(this.positions, index, position);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(position, matrix, transformed);\r\n this.positions[index] = transformed.x;\r\n this.positions[index + 1] = transformed.y;\r\n this.positions[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.normals) {\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n for (index = 0; index < this.normals.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(this.normals, index, normal);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalToRef(normal, matrix, transformed);\r\n this.normals[index] = transformed.x;\r\n this.normals[index + 1] = transformed.y;\r\n this.normals[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.tangents) {\r\n var tangent = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].Zero();\r\n var tangentTransformed = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].Zero();\r\n for (index = 0; index < this.tangents.length; index += 4) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].FromArrayToRef(this.tangents, index, tangent);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].TransformNormalToRef(tangent, matrix, tangentTransformed);\r\n this.tangents[index] = tangentTransformed.x;\r\n this.tangents[index + 1] = tangentTransformed.y;\r\n this.tangents[index + 2] = tangentTransformed.z;\r\n this.tangents[index + 3] = tangentTransformed.w;\r\n }\r\n }\r\n if (flip && this.indices) {\r\n for (index = 0; index < this.indices.length; index += 3) {\r\n var tmp = this.indices[index + 1];\r\n this.indices[index + 1] = this.indices[index + 2];\r\n this.indices[index + 2] = tmp;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Merges the passed VertexData into the current one\r\n * @param other the VertexData to be merged into the current one\r\n * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array\r\n * @returns the modified VertexData\r\n */\r\n VertexData.prototype.merge = function (other, use32BitsIndices) {\r\n if (use32BitsIndices === void 0) { use32BitsIndices = false; }\r\n this._validate();\r\n other._validate();\r\n if (!this.normals !== !other.normals ||\r\n !this.tangents !== !other.tangents ||\r\n !this.uvs !== !other.uvs ||\r\n !this.uvs2 !== !other.uvs2 ||\r\n !this.uvs3 !== !other.uvs3 ||\r\n !this.uvs4 !== !other.uvs4 ||\r\n !this.uvs5 !== !other.uvs5 ||\r\n !this.uvs6 !== !other.uvs6 ||\r\n !this.colors !== !other.colors ||\r\n !this.matricesIndices !== !other.matricesIndices ||\r\n !this.matricesWeights !== !other.matricesWeights ||\r\n !this.matricesIndicesExtra !== !other.matricesIndicesExtra ||\r\n !this.matricesWeightsExtra !== !other.matricesWeightsExtra) {\r\n throw new Error(\"Cannot merge vertex data that do not have the same set of attributes\");\r\n }\r\n if (other.indices) {\r\n if (!this.indices) {\r\n this.indices = [];\r\n }\r\n var offset = this.positions ? this.positions.length / 3 : 0;\r\n var isSrcTypedArray = this.indices.BYTES_PER_ELEMENT !== undefined;\r\n if (isSrcTypedArray) {\r\n var len = this.indices.length + other.indices.length;\r\n var temp = use32BitsIndices || this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);\r\n temp.set(this.indices);\r\n var decal = this.indices.length;\r\n for (var index = 0; index < other.indices.length; index++) {\r\n temp[decal + index] = other.indices[index] + offset;\r\n }\r\n this.indices = temp;\r\n }\r\n else {\r\n for (var index = 0; index < other.indices.length; index++) {\r\n this.indices.push(other.indices[index] + offset);\r\n }\r\n }\r\n }\r\n this.positions = this._mergeElement(this.positions, other.positions);\r\n this.normals = this._mergeElement(this.normals, other.normals);\r\n this.tangents = this._mergeElement(this.tangents, other.tangents);\r\n this.uvs = this._mergeElement(this.uvs, other.uvs);\r\n this.uvs2 = this._mergeElement(this.uvs2, other.uvs2);\r\n this.uvs3 = this._mergeElement(this.uvs3, other.uvs3);\r\n this.uvs4 = this._mergeElement(this.uvs4, other.uvs4);\r\n this.uvs5 = this._mergeElement(this.uvs5, other.uvs5);\r\n this.uvs6 = this._mergeElement(this.uvs6, other.uvs6);\r\n this.colors = this._mergeElement(this.colors, other.colors);\r\n this.matricesIndices = this._mergeElement(this.matricesIndices, other.matricesIndices);\r\n this.matricesWeights = this._mergeElement(this.matricesWeights, other.matricesWeights);\r\n this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, other.matricesIndicesExtra);\r\n this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, other.matricesWeightsExtra);\r\n return this;\r\n };\r\n VertexData.prototype._mergeElement = function (source, other) {\r\n if (!source) {\r\n return other;\r\n }\r\n if (!other) {\r\n return source;\r\n }\r\n var len = other.length + source.length;\r\n var isSrcTypedArray = source instanceof Float32Array;\r\n var isOthTypedArray = other instanceof Float32Array;\r\n // use non-loop method when the source is Float32Array\r\n if (isSrcTypedArray) {\r\n var ret32 = new Float32Array(len);\r\n ret32.set(source);\r\n ret32.set(other, source.length);\r\n return ret32;\r\n // source is number[], when other is also use concat\r\n }\r\n else if (!isOthTypedArray) {\r\n return source.concat(other);\r\n // source is a number[], but other is a Float32Array, loop required\r\n }\r\n else {\r\n var ret = source.slice(0); // copy source to a separate array\r\n for (var i = 0, len = other.length; i < len; i++) {\r\n ret.push(other[i]);\r\n }\r\n return ret;\r\n }\r\n };\r\n VertexData.prototype._validate = function () {\r\n if (!this.positions) {\r\n throw new Error(\"Positions are required\");\r\n }\r\n var getElementCount = function (kind, values) {\r\n var stride = _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].DeduceStride(kind);\r\n if ((values.length % stride) !== 0) {\r\n throw new Error(\"The \" + kind + \"s array count must be a multiple of \" + stride);\r\n }\r\n return values.length / stride;\r\n };\r\n var positionsElementCount = getElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, this.positions);\r\n var validateElementCount = function (kind, values) {\r\n var elementCount = getElementCount(kind, values);\r\n if (elementCount !== positionsElementCount) {\r\n throw new Error(\"The \" + kind + \"s element count (\" + elementCount + \") does not match the positions count (\" + positionsElementCount + \")\");\r\n }\r\n };\r\n if (this.normals) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, this.normals);\r\n }\r\n if (this.tangents) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, this.tangents);\r\n }\r\n if (this.uvs) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, this.uvs);\r\n }\r\n if (this.uvs2) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, this.uvs2);\r\n }\r\n if (this.uvs3) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, this.uvs3);\r\n }\r\n if (this.uvs4) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, this.uvs4);\r\n }\r\n if (this.uvs5) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, this.uvs5);\r\n }\r\n if (this.uvs6) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, this.uvs6);\r\n }\r\n if (this.colors) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, this.colors);\r\n }\r\n if (this.matricesIndices) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, this.matricesIndices);\r\n }\r\n if (this.matricesWeights) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, this.matricesWeights);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, this.matricesIndicesExtra);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, this.matricesWeightsExtra);\r\n }\r\n };\r\n /**\r\n * Serializes the VertexData\r\n * @returns a serialized object\r\n */\r\n VertexData.prototype.serialize = function () {\r\n var serializationObject = this.serialize();\r\n if (this.positions) {\r\n serializationObject.positions = this.positions;\r\n }\r\n if (this.normals) {\r\n serializationObject.normals = this.normals;\r\n }\r\n if (this.tangents) {\r\n serializationObject.tangents = this.tangents;\r\n }\r\n if (this.uvs) {\r\n serializationObject.uvs = this.uvs;\r\n }\r\n if (this.uvs2) {\r\n serializationObject.uvs2 = this.uvs2;\r\n }\r\n if (this.uvs3) {\r\n serializationObject.uvs3 = this.uvs3;\r\n }\r\n if (this.uvs4) {\r\n serializationObject.uvs4 = this.uvs4;\r\n }\r\n if (this.uvs5) {\r\n serializationObject.uvs5 = this.uvs5;\r\n }\r\n if (this.uvs6) {\r\n serializationObject.uvs6 = this.uvs6;\r\n }\r\n if (this.colors) {\r\n serializationObject.colors = this.colors;\r\n }\r\n if (this.matricesIndices) {\r\n serializationObject.matricesIndices = this.matricesIndices;\r\n serializationObject.matricesIndices._isExpanded = true;\r\n }\r\n if (this.matricesWeights) {\r\n serializationObject.matricesWeights = this.matricesWeights;\r\n }\r\n if (this.matricesIndicesExtra) {\r\n serializationObject.matricesIndicesExtra = this.matricesIndicesExtra;\r\n serializationObject.matricesIndicesExtra._isExpanded = true;\r\n }\r\n if (this.matricesWeightsExtra) {\r\n serializationObject.matricesWeightsExtra = this.matricesWeightsExtra;\r\n }\r\n serializationObject.indices = this.indices;\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts the vertexData from a mesh\r\n * @param mesh the mesh from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromMesh = function (mesh, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(mesh, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Extracts the vertexData from the geometry\r\n * @param geometry the geometry from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when the geometrty is shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromGeometry = function (geometry, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(geometry, copyWhenShared, forceCopy);\r\n };\r\n VertexData._ExtractFrom = function (meshOrGeometry, copyWhenShared, forceCopy) {\r\n var result = new VertexData();\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind)) {\r\n result.positions = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind)) {\r\n result.normals = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind)) {\r\n result.tangents = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n result.uvs = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind)) {\r\n result.uvs2 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind)) {\r\n result.uvs3 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind)) {\r\n result.uvs4 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind)) {\r\n result.uvs5 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind)) {\r\n result.uvs6 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind)) {\r\n result.colors = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n result.matricesIndices = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n result.matricesWeights = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind)) {\r\n result.matricesIndicesExtra = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind)) {\r\n result.matricesWeightsExtra = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, copyWhenShared, forceCopy);\r\n }\r\n result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);\r\n return result;\r\n };\r\n /**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @returns the VertexData of the ribbon\r\n */\r\n VertexData.CreateRibbon = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"ribbonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * size sets the width, height and depth of the box to the value of size, optional default 1\r\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\r\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateBox = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"boxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * faceTiles sets the pattern, tile size and number of tiles for a face\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateTiledBox = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"tiledBoxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled plane\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * pattern a limited pattern arrangement depending on the number\r\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\r\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\r\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the tiled plane\r\n */\r\n VertexData.CreateTiledPlane = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"tiledPlaneBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an ellipsoid, defaults to a sphere\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * segments sets the number of horizontal strips optional, default 32\r\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\r\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\r\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\r\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\r\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\r\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the ellipsoid\r\n */\r\n VertexData.CreateSphere = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"sphereBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\n VertexData.CreateCylinder = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"cylinderBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a torus\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * diameter the diameter of the torus, optional default 1\r\n * * thickness the diameter of the tube forming the torus, optional default 0.5\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the torus\r\n */\r\n VertexData.CreateTorus = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"torusBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\n VertexData.CreateLineSystem = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\n VertexData.CreateDashedLines = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * - width the width (x direction) of the ground, optional, default 1\r\n * - height the height (z direction) of the ground, optional, default 1\r\n * - subdivisions the number of subdivisions per side, optional, default 1\r\n * @returns the VertexData of the Ground\r\n */\r\n VertexData.CreateGround = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * * xmin the ground minimum X coordinate, optional, default -1\r\n * * zmin the ground minimum Z coordinate, optional, default -1\r\n * * xmax the ground maximum X coordinate, optional, default 1\r\n * * zmax the ground maximum Z coordinate, optional, default 1\r\n * * subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * * precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @returns the VertexData of the TiledGround\r\n */\r\n VertexData.CreateTiledGround = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by MeshBuilder.CreateGroundFromHeightMap\r\n * * width the width (x direction) of the ground\r\n * * height the height (z direction) of the ground\r\n * * subdivisions the number of subdivisions per side\r\n * * minHeight the minimum altitude on the ground, optional, default 0\r\n * * maxHeight the maximum altitude on the ground, optional default 1\r\n * * colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * * buffer the array holding the image color data\r\n * * bufferWidth the width of image\r\n * * bufferHeight the height of image\r\n * * alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\n VertexData.CreateGroundFromHeightMap = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Plane\r\n * @param options an object used to set the following optional parameters for the plane, required but can be empty\r\n * * size sets the width and height of the plane to the value of size, optional default 1\r\n * * width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreatePlane = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"planeBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Disc or regular Polygon\r\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\r\n * * radius the radius of the disc, optional default 0.5\r\n * * tessellation the number of polygon sides, optional, default 64\r\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateDisc = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"discBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build()\r\n * All parameters are provided by MeshBuilder.CreatePolygon as needed\r\n * @param polygon a mesh built from polygonTriangulation.build()\r\n * @param sideOrientation takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @param fUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * @param fColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * @param frontUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * @param backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Polygon\r\n */\r\n VertexData.CreatePolygon = function (polygon, sideOrientation, fUV, fColors, frontUVs, backUVs) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"polygonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the IcoSphere\r\n * @param options an object used to set the following optional parameters for the IcoSphere, required but can be empty\r\n * * radius the radius of the IcoSphere, optional default 1\r\n * * radiusX allows stretching in the x direction, optional, default radius\r\n * * radiusY allows stretching in the y direction, optional, default radius\r\n * * radiusZ allows stretching in the z direction, optional, default radius\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the IcoSphere\r\n */\r\n VertexData.CreateIcoSphere = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"icoSphereBuilder\");\r\n };\r\n // inspired from // http://stemkoski.github.io/Three.js/Polyhedra.html\r\n /**\r\n * Creates the VertexData for a Polyhedron\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * type provided types are:\r\n * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\r\n * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\r\n * * size the size of the IcoSphere, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Polyhedron\r\n */\r\n VertexData.CreatePolyhedron = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"polyhedronBuilder\");\r\n };\r\n // based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n /**\r\n * Creates the VertexData for a TorusKnot\r\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\r\n * * radius the radius of the torus knot, optional, default 2\r\n * * tube the thickness of the tube, optional, default 0.5\r\n * * radialSegments the number of sides on each tube segments, optional, default 32\r\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\r\n * * p the number of windings around the z axis, optional, default 2\r\n * * q the number of windings around the x axis, optional, default 3\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Torus Knot\r\n */\r\n VertexData.CreateTorusKnot = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"torusKnotBuilder\");\r\n };\r\n // Tools\r\n /**\r\n * Compute normals for given positions and indices\r\n * @param positions an array of vertex positions, [...., x, y, z, ......]\r\n * @param indices an array of indices in groups of three for each triangular facet, [...., i, j, k, ......]\r\n * @param normals an array of vertex normals, [...., x, y, z, ......]\r\n * @param options an object used to set the following optional parameters for the TorusKnot, optional\r\n * * facetNormals : optional array of facet normals (vector3)\r\n * * facetPositions : optional array of facet positions (vector3)\r\n * * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation\r\n * * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation\r\n * * bInfo : optional bounding info, required for facetPartitioning computation\r\n * * bbSize : optional bounding box size data, required for facetPartitioning computation\r\n * * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation\r\n * * useRightHandedSystem: optional boolean to for right handed system computation\r\n * * depthSort : optional boolean to enable the facet depth sort computation\r\n * * distanceTo : optional Vector3 to compute the facet depth from this location\r\n * * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location\r\n */\r\n VertexData.ComputeNormals = function (positions, indices, normals, options) {\r\n // temporary scalar variables\r\n var index = 0; // facet index\r\n var p1p2x = 0.0; // p1p2 vector x coordinate\r\n var p1p2y = 0.0; // p1p2 vector y coordinate\r\n var p1p2z = 0.0; // p1p2 vector z coordinate\r\n var p3p2x = 0.0; // p3p2 vector x coordinate\r\n var p3p2y = 0.0; // p3p2 vector y coordinate\r\n var p3p2z = 0.0; // p3p2 vector z coordinate\r\n var faceNormalx = 0.0; // facet normal x coordinate\r\n var faceNormaly = 0.0; // facet normal y coordinate\r\n var faceNormalz = 0.0; // facet normal z coordinate\r\n var length = 0.0; // facet normal length before normalization\r\n var v1x = 0; // vector1 x index in the positions array\r\n var v1y = 0; // vector1 y index in the positions array\r\n var v1z = 0; // vector1 z index in the positions array\r\n var v2x = 0; // vector2 x index in the positions array\r\n var v2y = 0; // vector2 y index in the positions array\r\n var v2z = 0; // vector2 z index in the positions array\r\n var v3x = 0; // vector3 x index in the positions array\r\n var v3y = 0; // vector3 y index in the positions array\r\n var v3z = 0; // vector3 z index in the positions array\r\n var computeFacetNormals = false;\r\n var computeFacetPositions = false;\r\n var computeFacetPartitioning = false;\r\n var computeDepthSort = false;\r\n var faceNormalSign = 1;\r\n var ratio = 0;\r\n var distanceTo = null;\r\n if (options) {\r\n computeFacetNormals = (options.facetNormals) ? true : false;\r\n computeFacetPositions = (options.facetPositions) ? true : false;\r\n computeFacetPartitioning = (options.facetPartitioning) ? true : false;\r\n faceNormalSign = (options.useRightHandedSystem === true) ? -1 : 1;\r\n ratio = options.ratio || 0;\r\n computeDepthSort = (options.depthSort) ? true : false;\r\n distanceTo = (options.distanceTo);\r\n if (computeDepthSort) {\r\n if (distanceTo === undefined) {\r\n distanceTo = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n var depthSortedFacets = options.depthSortedFacets;\r\n }\r\n }\r\n // facetPartitioning reinit if needed\r\n var xSubRatio = 0;\r\n var ySubRatio = 0;\r\n var zSubRatio = 0;\r\n var subSq = 0;\r\n if (computeFacetPartitioning && options && options.bbSize) {\r\n var ox = 0; // X partitioning index for facet position\r\n var oy = 0; // Y partinioning index for facet position\r\n var oz = 0; // Z partinioning index for facet position\r\n var b1x = 0; // X partitioning index for facet v1 vertex\r\n var b1y = 0; // Y partitioning index for facet v1 vertex\r\n var b1z = 0; // z partitioning index for facet v1 vertex\r\n var b2x = 0; // X partitioning index for facet v2 vertex\r\n var b2y = 0; // Y partitioning index for facet v2 vertex\r\n var b2z = 0; // Z partitioning index for facet v2 vertex\r\n var b3x = 0; // X partitioning index for facet v3 vertex\r\n var b3y = 0; // Y partitioning index for facet v3 vertex\r\n var b3z = 0; // Z partitioning index for facet v3 vertex\r\n var block_idx_o = 0; // facet barycenter block index\r\n var block_idx_v1 = 0; // v1 vertex block index\r\n var block_idx_v2 = 0; // v2 vertex block index\r\n var block_idx_v3 = 0; // v3 vertex block index\r\n var bbSizeMax = (options.bbSize.x > options.bbSize.y) ? options.bbSize.x : options.bbSize.y;\r\n bbSizeMax = (bbSizeMax > options.bbSize.z) ? bbSizeMax : options.bbSize.z;\r\n xSubRatio = options.subDiv.X * ratio / options.bbSize.x;\r\n ySubRatio = options.subDiv.Y * ratio / options.bbSize.y;\r\n zSubRatio = options.subDiv.Z * ratio / options.bbSize.z;\r\n subSq = options.subDiv.max * options.subDiv.max;\r\n options.facetPartitioning.length = 0;\r\n }\r\n // reset the normals\r\n for (index = 0; index < positions.length; index++) {\r\n normals[index] = 0.0;\r\n }\r\n // Loop : 1 indice triplet = 1 facet\r\n var nbFaces = (indices.length / 3) | 0;\r\n for (index = 0; index < nbFaces; index++) {\r\n // get the indexes of the coordinates of each vertex of the facet\r\n v1x = indices[index * 3] * 3;\r\n v1y = v1x + 1;\r\n v1z = v1x + 2;\r\n v2x = indices[index * 3 + 1] * 3;\r\n v2y = v2x + 1;\r\n v2z = v2x + 2;\r\n v3x = indices[index * 3 + 2] * 3;\r\n v3y = v3x + 1;\r\n v3z = v3x + 2;\r\n p1p2x = positions[v1x] - positions[v2x]; // compute two vectors per facet : p1p2 and p3p2\r\n p1p2y = positions[v1y] - positions[v2y];\r\n p1p2z = positions[v1z] - positions[v2z];\r\n p3p2x = positions[v3x] - positions[v2x];\r\n p3p2y = positions[v3y] - positions[v2y];\r\n p3p2z = positions[v3z] - positions[v2z];\r\n // compute the face normal with the cross product\r\n faceNormalx = faceNormalSign * (p1p2y * p3p2z - p1p2z * p3p2y);\r\n faceNormaly = faceNormalSign * (p1p2z * p3p2x - p1p2x * p3p2z);\r\n faceNormalz = faceNormalSign * (p1p2x * p3p2y - p1p2y * p3p2x);\r\n // normalize this normal and store it in the array facetData\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n if (computeFacetNormals && options) {\r\n options.facetNormals[index].x = faceNormalx;\r\n options.facetNormals[index].y = faceNormaly;\r\n options.facetNormals[index].z = faceNormalz;\r\n }\r\n if (computeFacetPositions && options) {\r\n // compute and the facet barycenter coordinates in the array facetPositions\r\n options.facetPositions[index].x = (positions[v1x] + positions[v2x] + positions[v3x]) / 3.0;\r\n options.facetPositions[index].y = (positions[v1y] + positions[v2y] + positions[v3y]) / 3.0;\r\n options.facetPositions[index].z = (positions[v1z] + positions[v2z] + positions[v3z]) / 3.0;\r\n }\r\n if (computeFacetPartitioning && options) {\r\n // store the facet indexes in arrays in the main facetPartitioning array :\r\n // compute each facet vertex (+ facet barycenter) index in the partiniong array\r\n ox = Math.floor((options.facetPositions[index].x - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n oy = Math.floor((options.facetPositions[index].y - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n oz = Math.floor((options.facetPositions[index].z - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b1x = Math.floor((positions[v1x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b1y = Math.floor((positions[v1y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b1z = Math.floor((positions[v1z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b2x = Math.floor((positions[v2x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b2y = Math.floor((positions[v2y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b2z = Math.floor((positions[v2z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b3x = Math.floor((positions[v3x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b3y = Math.floor((positions[v3y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b3z = Math.floor((positions[v3z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n block_idx_v1 = b1x + options.subDiv.max * b1y + subSq * b1z;\r\n block_idx_v2 = b2x + options.subDiv.max * b2y + subSq * b2z;\r\n block_idx_v3 = b3x + options.subDiv.max * b3y + subSq * b3z;\r\n block_idx_o = ox + options.subDiv.max * oy + subSq * oz;\r\n options.facetPartitioning[block_idx_o] = options.facetPartitioning[block_idx_o] ? options.facetPartitioning[block_idx_o] : new Array();\r\n options.facetPartitioning[block_idx_v1] = options.facetPartitioning[block_idx_v1] ? options.facetPartitioning[block_idx_v1] : new Array();\r\n options.facetPartitioning[block_idx_v2] = options.facetPartitioning[block_idx_v2] ? options.facetPartitioning[block_idx_v2] : new Array();\r\n options.facetPartitioning[block_idx_v3] = options.facetPartitioning[block_idx_v3] ? options.facetPartitioning[block_idx_v3] : new Array();\r\n // push each facet index in each block containing the vertex\r\n options.facetPartitioning[block_idx_v1].push(index);\r\n if (block_idx_v2 != block_idx_v1) {\r\n options.facetPartitioning[block_idx_v2].push(index);\r\n }\r\n if (!(block_idx_v3 == block_idx_v2 || block_idx_v3 == block_idx_v1)) {\r\n options.facetPartitioning[block_idx_v3].push(index);\r\n }\r\n if (!(block_idx_o == block_idx_v1 || block_idx_o == block_idx_v2 || block_idx_o == block_idx_v3)) {\r\n options.facetPartitioning[block_idx_o].push(index);\r\n }\r\n }\r\n if (computeDepthSort && options && options.facetPositions) {\r\n var dsf = depthSortedFacets[index];\r\n dsf.ind = index * 3;\r\n dsf.sqDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].DistanceSquared(options.facetPositions[index], distanceTo);\r\n }\r\n // compute the normals anyway\r\n normals[v1x] += faceNormalx; // accumulate all the normals per face\r\n normals[v1y] += faceNormaly;\r\n normals[v1z] += faceNormalz;\r\n normals[v2x] += faceNormalx;\r\n normals[v2y] += faceNormaly;\r\n normals[v2z] += faceNormalz;\r\n normals[v3x] += faceNormalx;\r\n normals[v3y] += faceNormaly;\r\n normals[v3z] += faceNormalz;\r\n }\r\n // last normalization of each normal\r\n for (index = 0; index < normals.length / 3; index++) {\r\n faceNormalx = normals[index * 3];\r\n faceNormaly = normals[index * 3 + 1];\r\n faceNormalz = normals[index * 3 + 2];\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n normals[index * 3] = faceNormalx;\r\n normals[index * 3 + 1] = faceNormaly;\r\n normals[index * 3 + 2] = faceNormalz;\r\n }\r\n };\r\n /** @hidden */\r\n VertexData._ComputeSides = function (sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs) {\r\n var li = indices.length;\r\n var ln = normals.length;\r\n var i;\r\n var n;\r\n sideOrientation = sideOrientation || VertexData.DEFAULTSIDE;\r\n switch (sideOrientation) {\r\n case VertexData.FRONTSIDE:\r\n // nothing changed\r\n break;\r\n case VertexData.BACKSIDE:\r\n var tmp;\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n tmp = indices[i];\r\n indices[i] = indices[i + 2];\r\n indices[i + 2] = tmp;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[n] = -normals[n];\r\n }\r\n break;\r\n case VertexData.DOUBLESIDE:\r\n // positions\r\n var lp = positions.length;\r\n var l = lp / 3;\r\n for (var p = 0; p < lp; p++) {\r\n positions[lp + p] = positions[p];\r\n }\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n indices[i + li] = indices[i + 2] + l;\r\n indices[i + 1 + li] = indices[i + 1] + l;\r\n indices[i + 2 + li] = indices[i] + l;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[ln + n] = -normals[n];\r\n }\r\n // uvs\r\n var lu = uvs.length;\r\n var u = 0;\r\n for (u = 0; u < lu; u++) {\r\n uvs[u + lu] = uvs[u];\r\n }\r\n frontUVs = frontUVs ? frontUVs : new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0.0, 0.0, 1.0, 1.0);\r\n backUVs = backUVs ? backUVs : new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0.0, 0.0, 1.0, 1.0);\r\n u = 0;\r\n for (i = 0; i < lu / 2; i++) {\r\n uvs[u] = frontUVs.x + (frontUVs.z - frontUVs.x) * uvs[u];\r\n uvs[u + 1] = frontUVs.y + (frontUVs.w - frontUVs.y) * uvs[u + 1];\r\n uvs[u + lu] = backUVs.x + (backUVs.z - backUVs.x) * uvs[u + lu];\r\n uvs[u + lu + 1] = backUVs.y + (backUVs.w - backUVs.y) * uvs[u + lu + 1];\r\n u += 2;\r\n }\r\n break;\r\n }\r\n };\r\n /**\r\n * Applies VertexData created from the imported parameters to the geometry\r\n * @param parsedVertexData the parsed data from an imported file\r\n * @param geometry the geometry to apply the VertexData to\r\n */\r\n VertexData.ImportVertexData = function (parsedVertexData, geometry) {\r\n var vertexData = new VertexData();\r\n // positions\r\n var positions = parsedVertexData.positions;\r\n if (positions) {\r\n vertexData.set(positions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n }\r\n // normals\r\n var normals = parsedVertexData.normals;\r\n if (normals) {\r\n vertexData.set(normals, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind);\r\n }\r\n // tangents\r\n var tangents = parsedVertexData.tangents;\r\n if (tangents) {\r\n vertexData.set(tangents, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind);\r\n }\r\n // uvs\r\n var uvs = parsedVertexData.uvs;\r\n if (uvs) {\r\n vertexData.set(uvs, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n }\r\n // uv2s\r\n var uv2s = parsedVertexData.uv2s;\r\n if (uv2s) {\r\n vertexData.set(uv2s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n // uv3s\r\n var uv3s = parsedVertexData.uv3s;\r\n if (uv3s) {\r\n vertexData.set(uv3s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind);\r\n }\r\n // uv4s\r\n var uv4s = parsedVertexData.uv4s;\r\n if (uv4s) {\r\n vertexData.set(uv4s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind);\r\n }\r\n // uv5s\r\n var uv5s = parsedVertexData.uv5s;\r\n if (uv5s) {\r\n vertexData.set(uv5s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind);\r\n }\r\n // uv6s\r\n var uv6s = parsedVertexData.uv6s;\r\n if (uv6s) {\r\n vertexData.set(uv6s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind);\r\n }\r\n // colors\r\n var colors = parsedVertexData.colors;\r\n if (colors) {\r\n vertexData.set(_Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"].CheckColors4(colors, positions.length / 3), _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind);\r\n }\r\n // matricesIndices\r\n var matricesIndices = parsedVertexData.matricesIndices;\r\n if (matricesIndices) {\r\n vertexData.set(matricesIndices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind);\r\n }\r\n // matricesWeights\r\n var matricesWeights = parsedVertexData.matricesWeights;\r\n if (matricesWeights) {\r\n vertexData.set(matricesWeights, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind);\r\n }\r\n // indices\r\n var indices = parsedVertexData.indices;\r\n if (indices) {\r\n vertexData.indices = indices;\r\n }\r\n geometry.setAllVerticesData(vertexData, parsedVertexData.updatable);\r\n };\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n VertexData.FRONTSIDE = 0;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n VertexData.BACKSIDE = 1;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n VertexData.DOUBLESIDE = 2;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n VertexData.DEFAULTSIDE = 0;\r\n return VertexData;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshBuilder.ts\":\n/*!*******************************!*\\\n !*** ./Meshes/meshBuilder.ts ***!\n \\*******************************/\n/*! exports provided: MeshBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return MeshBuilder; });\n/* harmony import */ var _Builders_ribbonBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Builders/ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony import */ var _Builders_discBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Builders/discBuilder */ \"./Meshes/Builders/discBuilder.ts\");\n/* harmony import */ var _Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Builders_tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Builders/tiledBoxBuilder */ \"./Meshes/Builders/tiledBoxBuilder.ts\");\n/* harmony import */ var _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Builders_torusBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Builders/torusBuilder */ \"./Meshes/Builders/torusBuilder.ts\");\n/* harmony import */ var _Builders_torusKnotBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Builders/torusKnotBuilder */ \"./Meshes/Builders/torusKnotBuilder.ts\");\n/* harmony import */ var _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Builders/polygonBuilder */ \"./Meshes/Builders/polygonBuilder.ts\");\n/* harmony import */ var _Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Builders/shapeBuilder */ \"./Meshes/Builders/shapeBuilder.ts\");\n/* harmony import */ var _Builders_latheBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Builders/latheBuilder */ \"./Meshes/Builders/latheBuilder.ts\");\n/* harmony import */ var _Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Builders_tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Builders/tiledPlaneBuilder */ \"./Meshes/Builders/tiledPlaneBuilder.ts\");\n/* harmony import */ var _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Builders/groundBuilder */ \"./Meshes/Builders/groundBuilder.ts\");\n/* harmony import */ var _Builders_tubeBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Builders/tubeBuilder */ \"./Meshes/Builders/tubeBuilder.ts\");\n/* harmony import */ var _Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Builders/polyhedronBuilder */ \"./Meshes/Builders/polyhedronBuilder.ts\");\n/* harmony import */ var _Builders_icoSphereBuilder__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Builders/icoSphereBuilder */ \"./Meshes/Builders/icoSphereBuilder.ts\");\n/* harmony import */ var _Builders_decalBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Builders/decalBuilder */ \"./Meshes/Builders/decalBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar MeshBuilder = /** @class */ (function () {\r\n function MeshBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * * The parameter `size` sets the size (float) of each box side (default 1)\r\n * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n MeshBuilder.CreateBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_2__[\"BoxBuilder\"].CreateBox(name, options, scene);\r\n };\r\n /**\r\n * Creates a tiled box mesh\r\n * * faceTiles sets the pattern, tile size and number of tiles for a face\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tiled box mesh\r\n */\r\n MeshBuilder.CreateTiledBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_3__[\"TiledBoxBuilder\"].CreateTiledBox(name, options, scene);\r\n };\r\n /**\r\n * Creates a sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the sphere mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#sphere\r\n */\r\n MeshBuilder.CreateSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_4__[\"SphereBuilder\"].CreateSphere(name, options, scene);\r\n };\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc\r\n * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)\r\n * * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane polygonal mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#disc-or-regular-polygon\r\n */\r\n MeshBuilder.CreateDisc = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_discBuilder__WEBPACK_IMPORTED_MODULE_1__[\"DiscBuilder\"].CreateDisc(name, options, scene);\r\n };\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value of `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the icosahedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n MeshBuilder.CreateIcoSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_icoSphereBuilder__WEBPACK_IMPORTED_MODULE_17__[\"IcoSphereBuilder\"].CreateIcoSphere(name, options, scene);\r\n };\r\n /**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#ribbon\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ribbon mesh\r\n * @see https://doc.babylonjs.com/how_to/ribbon_tutorial\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n */\r\n MeshBuilder.CreateRibbon = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_ribbonBuilder__WEBPACK_IMPORTED_MODULE_0__[\"RibbonBuilder\"].CreateRibbon(name, options, scene);\r\n };\r\n /**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\n MeshBuilder.CreateCylinder = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__[\"CylinderBuilder\"].CreateCylinder(name, options, scene);\r\n };\r\n /**\r\n * Creates a torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (postive integer, default 16)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus\r\n */\r\n MeshBuilder.CreateTorus = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_torusBuilder__WEBPACK_IMPORTED_MODULE_6__[\"TorusBuilder\"].CreateTorus(name, options, scene);\r\n };\r\n /**\r\n * Creates a torus knot mesh\r\n * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)\r\n * * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32)\r\n * * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus knot mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus-knot\r\n */\r\n MeshBuilder.CreateTorusKnot = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_torusKnotBuilder__WEBPACK_IMPORTED_MODULE_7__[\"TorusKnotBuilder\"].CreateTorusKnot(name, options, scene);\r\n };\r\n /**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\n MeshBuilder.CreateLineSystem = function (name, options, scene) {\r\n return _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLineSystem(name, options, scene);\r\n };\r\n /**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\n MeshBuilder.CreateLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(name, options, scene);\r\n };\r\n /**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\n MeshBuilder.CreateDashedLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateDashedLines(name, options, scene);\r\n };\r\n /**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n MeshBuilder.ExtrudeShape = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_10__[\"ShapeBuilder\"].ExtrudeShape(name, options, scene);\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n MeshBuilder.ExtrudeShapeCustom = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_10__[\"ShapeBuilder\"].ExtrudeShapeCustom(name, options, scene);\r\n };\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * * The parameter `radius` (positive float, default 1) is the radius value of the lathe\r\n * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe\r\n * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides\r\n * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape\r\n * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter \"arc\"\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the lathe mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lathe\r\n */\r\n MeshBuilder.CreateLathe = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_latheBuilder__WEBPACK_IMPORTED_MODULE_11__[\"LatheBuilder\"].CreateLathe(name, options, scene);\r\n };\r\n /**\r\n * Creates a tiled plane mesh\r\n * * You can set a limited pattern arrangement with the tiles\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n MeshBuilder.CreateTiledPlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_13__[\"TiledPlaneBuilder\"].CreateTiledPlane(name, options, scene);\r\n };\r\n /**\r\n * Creates a plane mesh\r\n * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)\r\n * * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value of `size`)\r\n * * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n MeshBuilder.CreatePlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_12__[\"PlaneBuilder\"].CreatePlane(name, options, scene);\r\n };\r\n /**\r\n * Creates a ground mesh\r\n * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground\r\n * * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground\r\n */\r\n MeshBuilder.CreateGround = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__[\"GroundBuilder\"].CreateGround(name, options, scene);\r\n };\r\n /**\r\n * Creates a tiled ground mesh\r\n * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates\r\n * * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates\r\n * * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tiled-ground\r\n */\r\n MeshBuilder.CreateTiledGround = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__[\"GroundBuilder\"].CreateTiledGround(name, options, scene);\r\n };\r\n /**\r\n * Creates a ground mesh from a height map\r\n * * The parameter `url` sets the URL of the height map image resource.\r\n * * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.\r\n * * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.\r\n * * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.\r\n * * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.\r\n * * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.\r\n * * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).\r\n * * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param url defines the url to the height map\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map\r\n */\r\n MeshBuilder.CreateGroundFromHeightMap = function (name, url, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__[\"GroundBuilder\"].CreateGroundFromHeightMap(name, url, options, scene);\r\n };\r\n /**\r\n * Creates a polygon mesh\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh\r\n * * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4)\r\n * * Remember you can only change the shape positions, not their number when updating a polygon\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n MeshBuilder.CreatePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n return _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_9__[\"PolygonBuilder\"].CreatePolygon(name, options, scene, earcutInjection);\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction.\r\n * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)\r\n * @see https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n MeshBuilder.ExtrudePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n return _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_9__[\"PolygonBuilder\"].ExtrudePolygon(name, options, scene, earcutInjection);\r\n };\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * * The parameter `radius` (positive float, default 1) sets the tube radius size\r\n * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface\r\n * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`\r\n * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)\r\n * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#tube\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tube mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tube\r\n */\r\n MeshBuilder.CreateTube = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_tubeBuilder__WEBPACK_IMPORTED_MODULE_15__[\"TubeBuilder\"].CreateTube(name, options, scene);\r\n };\r\n /**\r\n * Creates a polyhedron mesh\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the polyhedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes\r\n */\r\n MeshBuilder.CreatePolyhedron = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_16__[\"PolyhedronBuilder\"].CreatePolyhedron(name, options, scene);\r\n };\r\n /**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/how_to/decals\r\n */\r\n MeshBuilder.CreateDecal = function (name, sourceMesh, options) {\r\n return _Builders_decalBuilder__WEBPACK_IMPORTED_MODULE_18__[\"DecalBuilder\"].CreateDecal(name, sourceMesh, options);\r\n };\r\n return MeshBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshLODLevel.ts\":\n/*!********************************!*\\\n !*** ./Meshes/meshLODLevel.ts ***!\n \\********************************/\n/*! exports provided: MeshLODLevel */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return MeshLODLevel; });\n/**\r\n * Class used to represent a specific level of detail of a mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lod\r\n */\r\nvar MeshLODLevel = /** @class */ (function () {\r\n /**\r\n * Creates a new LOD level\r\n * @param distance defines the distance where this level should star being displayed\r\n * @param mesh defines the mesh to use to render this level\r\n */\r\n function MeshLODLevel(\r\n /** Defines the distance where this level should start being displayed */\r\n distance, \r\n /** Defines the mesh to use to render this level */\r\n mesh) {\r\n this.distance = distance;\r\n this.mesh = mesh;\r\n }\r\n return MeshLODLevel;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshSimplification.ts\":\n/*!**************************************!*\\\n !*** ./Meshes/meshSimplification.ts ***!\n \\**************************************/\n/*! exports provided: SimplificationSettings, SimplificationQueue, SimplificationType */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return SimplificationSettings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return SimplificationQueue; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return SimplificationType; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to specify simplification options\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar SimplificationSettings = /** @class */ (function () {\r\n /**\r\n * Creates a SimplificationSettings\r\n * @param quality expected quality\r\n * @param distance distance when this optimized version should be used\r\n * @param optimizeMesh already optimized mesh\r\n */\r\n function SimplificationSettings(\r\n /** expected quality */\r\n quality, \r\n /** distance when this optimized version should be used */\r\n distance, \r\n /** already optimized mesh */\r\n optimizeMesh) {\r\n this.quality = quality;\r\n this.distance = distance;\r\n this.optimizeMesh = optimizeMesh;\r\n }\r\n return SimplificationSettings;\r\n}());\r\n\r\n/**\r\n * Queue used to order the simplification tasks\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar SimplificationQueue = /** @class */ (function () {\r\n /**\r\n * Creates a new queue\r\n */\r\n function SimplificationQueue() {\r\n this.running = false;\r\n this._simplificationArray = [];\r\n }\r\n /**\r\n * Adds a new simplification task\r\n * @param task defines a task to add\r\n */\r\n SimplificationQueue.prototype.addTask = function (task) {\r\n this._simplificationArray.push(task);\r\n };\r\n /**\r\n * Execute next task\r\n */\r\n SimplificationQueue.prototype.executeNext = function () {\r\n var task = this._simplificationArray.pop();\r\n if (task) {\r\n this.running = true;\r\n this.runSimplification(task);\r\n }\r\n else {\r\n this.running = false;\r\n }\r\n };\r\n /**\r\n * Execute a simplification task\r\n * @param task defines the task to run\r\n */\r\n SimplificationQueue.prototype.runSimplification = function (task) {\r\n var _this = this;\r\n if (task.parallelProcessing) {\r\n //parallel simplifier\r\n task.settings.forEach(function (setting) {\r\n var simplifier = _this.getSimplifier(task);\r\n simplifier.simplify(setting, function (newMesh) {\r\n task.mesh.addLODLevel(setting.distance, newMesh);\r\n newMesh.isVisible = true;\r\n //check if it is the last\r\n if (setting.quality === task.settings[task.settings.length - 1].quality && task.successCallback) {\r\n //all done, run the success callback.\r\n task.successCallback();\r\n }\r\n _this.executeNext();\r\n });\r\n });\r\n }\r\n else {\r\n //single simplifier.\r\n var simplifier = this.getSimplifier(task);\r\n var runDecimation = function (setting, callback) {\r\n simplifier.simplify(setting, function (newMesh) {\r\n task.mesh.addLODLevel(setting.distance, newMesh);\r\n newMesh.isVisible = true;\r\n //run the next quality level\r\n callback();\r\n });\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].Run(task.settings.length, function (loop) {\r\n runDecimation(task.settings[loop.index], function () {\r\n loop.executeNext();\r\n });\r\n }, function () {\r\n //execution ended, run the success callback.\r\n if (task.successCallback) {\r\n task.successCallback();\r\n }\r\n _this.executeNext();\r\n });\r\n }\r\n };\r\n SimplificationQueue.prototype.getSimplifier = function (task) {\r\n switch (task.simplificationType) {\r\n case SimplificationType.QUADRATIC:\r\n default:\r\n return new QuadraticErrorSimplification(task.mesh);\r\n }\r\n };\r\n return SimplificationQueue;\r\n}());\r\n\r\n/**\r\n * The implemented types of simplification\r\n * At the moment only Quadratic Error Decimation is implemented\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar SimplificationType;\r\n(function (SimplificationType) {\r\n /** Quadratic error decimation */\r\n SimplificationType[SimplificationType[\"QUADRATIC\"] = 0] = \"QUADRATIC\";\r\n})(SimplificationType || (SimplificationType = {}));\r\nvar DecimationTriangle = /** @class */ (function () {\r\n function DecimationTriangle(vertices) {\r\n this.vertices = vertices;\r\n this.error = new Array(4);\r\n this.deleted = false;\r\n this.isDirty = false;\r\n this.deletePending = false;\r\n this.borderFactor = 0;\r\n }\r\n return DecimationTriangle;\r\n}());\r\nvar DecimationVertex = /** @class */ (function () {\r\n function DecimationVertex(position, id) {\r\n this.position = position;\r\n this.id = id;\r\n this.isBorder = true;\r\n this.q = new QuadraticMatrix();\r\n this.triangleCount = 0;\r\n this.triangleStart = 0;\r\n this.originalOffsets = [];\r\n }\r\n DecimationVertex.prototype.updatePosition = function (newPosition) {\r\n this.position.copyFrom(newPosition);\r\n };\r\n return DecimationVertex;\r\n}());\r\nvar QuadraticMatrix = /** @class */ (function () {\r\n function QuadraticMatrix(data) {\r\n this.data = new Array(10);\r\n for (var i = 0; i < 10; ++i) {\r\n if (data && data[i]) {\r\n this.data[i] = data[i];\r\n }\r\n else {\r\n this.data[i] = 0;\r\n }\r\n }\r\n }\r\n QuadraticMatrix.prototype.det = function (a11, a12, a13, a21, a22, a23, a31, a32, a33) {\r\n var det = this.data[a11] * this.data[a22] * this.data[a33] + this.data[a13] * this.data[a21] * this.data[a32] +\r\n this.data[a12] * this.data[a23] * this.data[a31] - this.data[a13] * this.data[a22] * this.data[a31] -\r\n this.data[a11] * this.data[a23] * this.data[a32] - this.data[a12] * this.data[a21] * this.data[a33];\r\n return det;\r\n };\r\n QuadraticMatrix.prototype.addInPlace = function (matrix) {\r\n for (var i = 0; i < 10; ++i) {\r\n this.data[i] += matrix.data[i];\r\n }\r\n };\r\n QuadraticMatrix.prototype.addArrayInPlace = function (data) {\r\n for (var i = 0; i < 10; ++i) {\r\n this.data[i] += data[i];\r\n }\r\n };\r\n QuadraticMatrix.prototype.add = function (matrix) {\r\n var m = new QuadraticMatrix();\r\n for (var i = 0; i < 10; ++i) {\r\n m.data[i] = this.data[i] + matrix.data[i];\r\n }\r\n return m;\r\n };\r\n QuadraticMatrix.FromData = function (a, b, c, d) {\r\n return new QuadraticMatrix(QuadraticMatrix.DataFromNumbers(a, b, c, d));\r\n };\r\n //returning an array to avoid garbage collection\r\n QuadraticMatrix.DataFromNumbers = function (a, b, c, d) {\r\n return [a * a, a * b, a * c, a * d, b * b, b * c, b * d, c * c, c * d, d * d];\r\n };\r\n return QuadraticMatrix;\r\n}());\r\nvar Reference = /** @class */ (function () {\r\n function Reference(vertexId, triangleId) {\r\n this.vertexId = vertexId;\r\n this.triangleId = triangleId;\r\n }\r\n return Reference;\r\n}());\r\n/**\r\n * An implementation of the Quadratic Error simplification algorithm.\r\n * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf\r\n * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS\r\n * @author RaananW\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar QuadraticErrorSimplification = /** @class */ (function () {\r\n function QuadraticErrorSimplification(_mesh) {\r\n this._mesh = _mesh;\r\n this.syncIterations = 5000;\r\n this.aggressiveness = 7;\r\n this.decimationIterations = 100;\r\n this.boundingBoxEpsilon = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_5__[\"Epsilon\"];\r\n }\r\n QuadraticErrorSimplification.prototype.simplify = function (settings, successCallback) {\r\n var _this = this;\r\n this.initDecimatedMesh();\r\n //iterating through the submeshes array, one after the other.\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].Run(this._mesh.subMeshes.length, function (loop) {\r\n _this.initWithMesh(loop.index, function () {\r\n _this.runDecimation(settings, loop.index, function () {\r\n loop.executeNext();\r\n });\r\n }, settings.optimizeMesh);\r\n }, function () {\r\n setTimeout(function () {\r\n successCallback(_this._reconstructedMesh);\r\n }, 0);\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.runDecimation = function (settings, submeshIndex, successCallback) {\r\n var _this = this;\r\n var targetCount = ~~(this.triangles.length * settings.quality);\r\n var deletedTriangles = 0;\r\n var triangleCount = this.triangles.length;\r\n var iterationFunction = function (iteration, callback) {\r\n setTimeout(function () {\r\n if (iteration % 5 === 0) {\r\n _this.updateMesh(iteration === 0);\r\n }\r\n for (var i = 0; i < _this.triangles.length; ++i) {\r\n _this.triangles[i].isDirty = false;\r\n }\r\n var threshold = 0.000000001 * Math.pow((iteration + 3), _this.aggressiveness);\r\n var trianglesIterator = function (i) {\r\n var tIdx = ~~(((_this.triangles.length / 2) + i) % _this.triangles.length);\r\n var t = _this.triangles[tIdx];\r\n if (!t) {\r\n return;\r\n }\r\n if (t.error[3] > threshold || t.deleted || t.isDirty) {\r\n return;\r\n }\r\n for (var j = 0; j < 3; ++j) {\r\n if (t.error[j] < threshold) {\r\n var deleted0 = [];\r\n var deleted1 = [];\r\n var v0 = t.vertices[j];\r\n var v1 = t.vertices[(j + 1) % 3];\r\n if (v0.isBorder || v1.isBorder) {\r\n continue;\r\n }\r\n var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n // var n = Vector3.Zero();\r\n // var uv = Vector2.Zero();\r\n // var color = new Color4(0, 0, 0, 1);\r\n _this.calculateError(v0, v1, p);\r\n var delTr = new Array();\r\n if (_this.isFlipped(v0, v1, p, deleted0, delTr)) {\r\n continue;\r\n }\r\n if (_this.isFlipped(v1, v0, p, deleted1, delTr)) {\r\n continue;\r\n }\r\n if (deleted0.indexOf(true) < 0 || deleted1.indexOf(true) < 0) {\r\n continue;\r\n }\r\n var uniqueArray = new Array();\r\n delTr.forEach(function (deletedT) {\r\n if (uniqueArray.indexOf(deletedT) === -1) {\r\n deletedT.deletePending = true;\r\n uniqueArray.push(deletedT);\r\n }\r\n });\r\n if (uniqueArray.length % 2 !== 0) {\r\n continue;\r\n }\r\n v0.q = v1.q.add(v0.q);\r\n v0.updatePosition(p);\r\n var tStart = _this.references.length;\r\n deletedTriangles = _this.updateTriangles(v0, v0, deleted0, deletedTriangles);\r\n deletedTriangles = _this.updateTriangles(v0, v1, deleted1, deletedTriangles);\r\n var tCount = _this.references.length - tStart;\r\n if (tCount <= v0.triangleCount) {\r\n if (tCount) {\r\n for (var c = 0; c < tCount; c++) {\r\n _this.references[v0.triangleStart + c] = _this.references[tStart + c];\r\n }\r\n }\r\n }\r\n else {\r\n v0.triangleStart = tStart;\r\n }\r\n v0.triangleCount = tCount;\r\n break;\r\n }\r\n }\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, trianglesIterator, callback, function () { return (triangleCount - deletedTriangles <= targetCount); });\r\n }, 0);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].Run(this.decimationIterations, function (loop) {\r\n if (triangleCount - deletedTriangles <= targetCount) {\r\n loop.breakLoop();\r\n }\r\n else {\r\n iterationFunction(loop.index, function () {\r\n loop.executeNext();\r\n });\r\n }\r\n }, function () {\r\n setTimeout(function () {\r\n //reconstruct this part of the mesh\r\n _this.reconstructMesh(submeshIndex);\r\n successCallback();\r\n }, 0);\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.initWithMesh = function (submeshIndex, callback, optimizeMesh) {\r\n var _this = this;\r\n this.vertices = [];\r\n this.triangles = [];\r\n var positionData = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var indices = this._mesh.getIndices();\r\n var submesh = this._mesh.subMeshes[submeshIndex];\r\n var findInVertices = function (positionToSearch) {\r\n if (optimizeMesh) {\r\n for (var ii = 0; ii < _this.vertices.length; ++ii) {\r\n if (_this.vertices[ii].position.equals(positionToSearch)) {\r\n return _this.vertices[ii];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n var vertexReferences = [];\r\n var vertexInit = function (i) {\r\n if (!positionData) {\r\n return;\r\n }\r\n var offset = i + submesh.verticesStart;\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positionData, offset * 3);\r\n var vertex = findInVertices(position) || new DecimationVertex(position, _this.vertices.length);\r\n vertex.originalOffsets.push(offset);\r\n if (vertex.id === _this.vertices.length) {\r\n _this.vertices.push(vertex);\r\n }\r\n vertexReferences.push(vertex.id);\r\n };\r\n //var totalVertices = mesh.getTotalVertices();\r\n var totalVertices = submesh.verticesCount;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(totalVertices, (this.syncIterations / 4) >> 0, vertexInit, function () {\r\n var indicesInit = function (i) {\r\n if (!indices) {\r\n return;\r\n }\r\n var offset = (submesh.indexStart / 3) + i;\r\n var pos = (offset * 3);\r\n var i0 = indices[pos + 0];\r\n var i1 = indices[pos + 1];\r\n var i2 = indices[pos + 2];\r\n var v0 = _this.vertices[vertexReferences[i0 - submesh.verticesStart]];\r\n var v1 = _this.vertices[vertexReferences[i1 - submesh.verticesStart]];\r\n var v2 = _this.vertices[vertexReferences[i2 - submesh.verticesStart]];\r\n var triangle = new DecimationTriangle([v0, v1, v2]);\r\n triangle.originalOffset = pos;\r\n _this.triangles.push(triangle);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(submesh.indexCount / 3, _this.syncIterations, indicesInit, function () {\r\n _this.init(callback);\r\n });\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.init = function (callback) {\r\n var _this = this;\r\n var triangleInit1 = function (i) {\r\n var t = _this.triangles[i];\r\n t.normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(t.vertices[1].position.subtract(t.vertices[0].position), t.vertices[2].position.subtract(t.vertices[0].position)).normalize();\r\n for (var j = 0; j < 3; j++) {\r\n t.vertices[j].q.addArrayInPlace(QuadraticMatrix.DataFromNumbers(t.normal.x, t.normal.y, t.normal.z, -(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(t.normal, t.vertices[0].position))));\r\n }\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(this.triangles.length, this.syncIterations, triangleInit1, function () {\r\n var triangleInit2 = function (i) {\r\n var t = _this.triangles[i];\r\n for (var j = 0; j < 3; ++j) {\r\n t.error[j] = _this.calculateError(t.vertices[j], t.vertices[(j + 1) % 3]);\r\n }\r\n t.error[3] = Math.min(t.error[0], t.error[1], t.error[2]);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, triangleInit2, function () {\r\n callback();\r\n });\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.reconstructMesh = function (submeshIndex) {\r\n var newTriangles = [];\r\n var i;\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n this.vertices[i].triangleCount = 0;\r\n }\r\n var t;\r\n var j;\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n if (!this.triangles[i].deleted) {\r\n t = this.triangles[i];\r\n for (j = 0; j < 3; ++j) {\r\n t.vertices[j].triangleCount = 1;\r\n }\r\n newTriangles.push(t);\r\n }\r\n }\r\n var newPositionData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind) || []);\r\n var newNormalData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind) || []);\r\n var newUVsData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind) || []);\r\n var newColorsData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind) || []);\r\n var normalData = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind);\r\n var uvs = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n var colorsData = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind);\r\n var vertexCount = 0;\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n var vertex = this.vertices[i];\r\n vertex.id = vertexCount;\r\n if (vertex.triangleCount) {\r\n vertex.originalOffsets.forEach(function (originalOffset) {\r\n if (!normalData) {\r\n return;\r\n }\r\n newPositionData.push(vertex.position.x);\r\n newPositionData.push(vertex.position.y);\r\n newPositionData.push(vertex.position.z);\r\n newNormalData.push(normalData[originalOffset * 3]);\r\n newNormalData.push(normalData[(originalOffset * 3) + 1]);\r\n newNormalData.push(normalData[(originalOffset * 3) + 2]);\r\n if (uvs && uvs.length) {\r\n newUVsData.push(uvs[(originalOffset * 2)]);\r\n newUVsData.push(uvs[(originalOffset * 2) + 1]);\r\n }\r\n if (colorsData && colorsData.length) {\r\n newColorsData.push(colorsData[(originalOffset * 4)]);\r\n newColorsData.push(colorsData[(originalOffset * 4) + 1]);\r\n newColorsData.push(colorsData[(originalOffset * 4) + 2]);\r\n newColorsData.push(colorsData[(originalOffset * 4) + 3]);\r\n }\r\n ++vertexCount;\r\n });\r\n }\r\n }\r\n var startingIndex = this._reconstructedMesh.getTotalIndices();\r\n var startingVertex = this._reconstructedMesh.getTotalVertices();\r\n var submeshesArray = this._reconstructedMesh.subMeshes;\r\n this._reconstructedMesh.subMeshes = [];\r\n var newIndicesArray = this._reconstructedMesh.getIndices(); //[];\r\n var originalIndices = this._mesh.getIndices();\r\n for (i = 0; i < newTriangles.length; ++i) {\r\n t = newTriangles[i]; //now get the new referencing point for each vertex\r\n [0, 1, 2].forEach(function (idx) {\r\n var id = originalIndices[t.originalOffset + idx];\r\n var offset = t.vertices[idx].originalOffsets.indexOf(id);\r\n if (offset < 0) {\r\n offset = 0;\r\n }\r\n newIndicesArray.push(t.vertices[idx].id + offset + startingVertex);\r\n });\r\n }\r\n //overwriting the old vertex buffers and indices.\r\n this._reconstructedMesh.setIndices(newIndicesArray);\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, newPositionData);\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, newNormalData);\r\n if (newUVsData.length > 0) {\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, newUVsData);\r\n }\r\n if (newColorsData.length > 0) {\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, newColorsData);\r\n }\r\n //create submesh\r\n var originalSubmesh = this._mesh.subMeshes[submeshIndex];\r\n if (submeshIndex > 0) {\r\n this._reconstructedMesh.subMeshes = [];\r\n submeshesArray.forEach(function (submesh) {\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__[\"SubMesh\"].AddToMesh(submesh.materialIndex, submesh.verticesStart, submesh.verticesCount, /* 0, newPositionData.length/3, */ submesh.indexStart, submesh.indexCount, submesh.getMesh());\r\n });\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__[\"SubMesh\"].AddToMesh(originalSubmesh.materialIndex, startingVertex, vertexCount, /* 0, newPositionData.length / 3, */ startingIndex, newTriangles.length * 3, this._reconstructedMesh);\r\n }\r\n };\r\n QuadraticErrorSimplification.prototype.initDecimatedMesh = function () {\r\n this._reconstructedMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"](this._mesh.name + \"Decimated\", this._mesh.getScene());\r\n this._reconstructedMesh.material = this._mesh.material;\r\n this._reconstructedMesh.parent = this._mesh.parent;\r\n this._reconstructedMesh.isVisible = false;\r\n this._reconstructedMesh.renderingGroupId = this._mesh.renderingGroupId;\r\n };\r\n QuadraticErrorSimplification.prototype.isFlipped = function (vertex1, vertex2, point, deletedArray, delTr) {\r\n for (var i = 0; i < vertex1.triangleCount; ++i) {\r\n var t = this.triangles[this.references[vertex1.triangleStart + i].triangleId];\r\n if (t.deleted) {\r\n continue;\r\n }\r\n var s = this.references[vertex1.triangleStart + i].vertexId;\r\n var v1 = t.vertices[(s + 1) % 3];\r\n var v2 = t.vertices[(s + 2) % 3];\r\n if ((v1 === vertex2 || v2 === vertex2)) {\r\n deletedArray[i] = true;\r\n delTr.push(t);\r\n continue;\r\n }\r\n var d1 = v1.position.subtract(point);\r\n d1 = d1.normalize();\r\n var d2 = v2.position.subtract(point);\r\n d2 = d2.normalize();\r\n if (Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(d1, d2)) > 0.999) {\r\n return true;\r\n }\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(d1, d2).normalize();\r\n deletedArray[i] = false;\r\n if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(normal, t.normal) < 0.2) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n QuadraticErrorSimplification.prototype.updateTriangles = function (origVertex, vertex, deletedArray, deletedTriangles) {\r\n var newDeleted = deletedTriangles;\r\n for (var i = 0; i < vertex.triangleCount; ++i) {\r\n var ref = this.references[vertex.triangleStart + i];\r\n var t = this.triangles[ref.triangleId];\r\n if (t.deleted) {\r\n continue;\r\n }\r\n if (deletedArray[i] && t.deletePending) {\r\n t.deleted = true;\r\n newDeleted++;\r\n continue;\r\n }\r\n t.vertices[ref.vertexId] = origVertex;\r\n t.isDirty = true;\r\n t.error[0] = this.calculateError(t.vertices[0], t.vertices[1]) + (t.borderFactor / 2);\r\n t.error[1] = this.calculateError(t.vertices[1], t.vertices[2]) + (t.borderFactor / 2);\r\n t.error[2] = this.calculateError(t.vertices[2], t.vertices[0]) + (t.borderFactor / 2);\r\n t.error[3] = Math.min(t.error[0], t.error[1], t.error[2]);\r\n this.references.push(ref);\r\n }\r\n return newDeleted;\r\n };\r\n QuadraticErrorSimplification.prototype.identifyBorder = function () {\r\n for (var i = 0; i < this.vertices.length; ++i) {\r\n var vCount = [];\r\n var vId = [];\r\n var v = this.vertices[i];\r\n var j;\r\n for (j = 0; j < v.triangleCount; ++j) {\r\n var triangle = this.triangles[this.references[v.triangleStart + j].triangleId];\r\n for (var ii = 0; ii < 3; ii++) {\r\n var ofs = 0;\r\n var vv = triangle.vertices[ii];\r\n while (ofs < vCount.length) {\r\n if (vId[ofs] === vv.id) {\r\n break;\r\n }\r\n ++ofs;\r\n }\r\n if (ofs === vCount.length) {\r\n vCount.push(1);\r\n vId.push(vv.id);\r\n }\r\n else {\r\n vCount[ofs]++;\r\n }\r\n }\r\n }\r\n for (j = 0; j < vCount.length; ++j) {\r\n if (vCount[j] === 1) {\r\n this.vertices[vId[j]].isBorder = true;\r\n }\r\n else {\r\n this.vertices[vId[j]].isBorder = false;\r\n }\r\n }\r\n }\r\n };\r\n QuadraticErrorSimplification.prototype.updateMesh = function (identifyBorders) {\r\n if (identifyBorders === void 0) { identifyBorders = false; }\r\n var i;\r\n if (!identifyBorders) {\r\n var newTrianglesVector = [];\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n if (!this.triangles[i].deleted) {\r\n newTrianglesVector.push(this.triangles[i]);\r\n }\r\n }\r\n this.triangles = newTrianglesVector;\r\n }\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n this.vertices[i].triangleCount = 0;\r\n this.vertices[i].triangleStart = 0;\r\n }\r\n var t;\r\n var j;\r\n var v;\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n t = this.triangles[i];\r\n for (j = 0; j < 3; ++j) {\r\n v = t.vertices[j];\r\n v.triangleCount++;\r\n }\r\n }\r\n var tStart = 0;\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n this.vertices[i].triangleStart = tStart;\r\n tStart += this.vertices[i].triangleCount;\r\n this.vertices[i].triangleCount = 0;\r\n }\r\n var newReferences = new Array(this.triangles.length * 3);\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n t = this.triangles[i];\r\n for (j = 0; j < 3; ++j) {\r\n v = t.vertices[j];\r\n newReferences[v.triangleStart + v.triangleCount] = new Reference(j, i);\r\n v.triangleCount++;\r\n }\r\n }\r\n this.references = newReferences;\r\n if (identifyBorders) {\r\n this.identifyBorder();\r\n }\r\n };\r\n QuadraticErrorSimplification.prototype.vertexError = function (q, point) {\r\n var x = point.x;\r\n var y = point.y;\r\n var z = point.z;\r\n return q.data[0] * x * x + 2 * q.data[1] * x * y + 2 * q.data[2] * x * z + 2 * q.data[3] * x + q.data[4] * y * y\r\n + 2 * q.data[5] * y * z + 2 * q.data[6] * y + q.data[7] * z * z + 2 * q.data[8] * z + q.data[9];\r\n };\r\n QuadraticErrorSimplification.prototype.calculateError = function (vertex1, vertex2, pointResult) {\r\n var q = vertex1.q.add(vertex2.q);\r\n var border = vertex1.isBorder && vertex2.isBorder;\r\n var error = 0;\r\n var qDet = q.det(0, 1, 2, 1, 4, 5, 2, 5, 7);\r\n if (qDet !== 0 && !border) {\r\n if (!pointResult) {\r\n pointResult = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n pointResult.x = -1 / qDet * (q.det(1, 2, 3, 4, 5, 6, 5, 7, 8));\r\n pointResult.y = 1 / qDet * (q.det(0, 2, 3, 1, 5, 6, 2, 7, 8));\r\n pointResult.z = -1 / qDet * (q.det(0, 1, 3, 1, 4, 6, 2, 5, 8));\r\n error = this.vertexError(q, pointResult);\r\n }\r\n else {\r\n var p3 = (vertex1.position.add(vertex2.position)).divide(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](2, 2, 2));\r\n //var norm3 = (vertex1.normal.add(vertex2.normal)).divide(new Vector3(2, 2, 2)).normalize();\r\n var error1 = this.vertexError(q, vertex1.position);\r\n var error2 = this.vertexError(q, vertex2.position);\r\n var error3 = this.vertexError(q, p3);\r\n error = Math.min(error1, error2, error3);\r\n if (error === error1) {\r\n if (pointResult) {\r\n pointResult.copyFrom(vertex1.position);\r\n }\r\n }\r\n else if (error === error2) {\r\n if (pointResult) {\r\n pointResult.copyFrom(vertex2.position);\r\n }\r\n }\r\n else {\r\n if (pointResult) {\r\n pointResult.copyFrom(p3);\r\n }\r\n }\r\n }\r\n return error;\r\n };\r\n return QuadraticErrorSimplification;\r\n}());\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshSimplificationSceneComponent.ts\":\n/*!****************************************************!*\\\n !*** ./Meshes/meshSimplificationSceneComponent.ts ***!\n \\****************************************************/\n/*! exports provided: SimplicationQueueSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return SimplicationQueueSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _meshSimplification__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./meshSimplification */ \"./Meshes/meshSimplification.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"simplificationQueue\", {\r\n get: function () {\r\n if (!this._simplificationQueue) {\r\n this._simplificationQueue = new _meshSimplification__WEBPACK_IMPORTED_MODULE_2__[\"SimplificationQueue\"]();\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_SIMPLIFICATIONQUEUE);\r\n if (!component) {\r\n component = new SimplicationQueueSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n }\r\n return this._simplificationQueue;\r\n },\r\n set: function (value) {\r\n this._simplificationQueue = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].prototype.simplify = function (settings, parallelProcessing, simplificationType, successCallback) {\r\n if (parallelProcessing === void 0) { parallelProcessing = true; }\r\n if (simplificationType === void 0) { simplificationType = _meshSimplification__WEBPACK_IMPORTED_MODULE_2__[\"SimplificationType\"].QUADRATIC; }\r\n this.getScene().simplificationQueue.addTask({\r\n settings: settings,\r\n parallelProcessing: parallelProcessing,\r\n mesh: this,\r\n simplificationType: simplificationType,\r\n successCallback: successCallback\r\n });\r\n return this;\r\n};\r\n/**\r\n * Defines the simplification queue scene component responsible to help scheduling the various simplification task\r\n * created in a scene\r\n */\r\nvar SimplicationQueueSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function SimplicationQueueSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_SIMPLIFICATIONQUEUE;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n SimplicationQueueSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraUpdateStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE, this, this._beforeCameraUpdate);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n SimplicationQueueSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n SimplicationQueueSceneComponent.prototype.dispose = function () {\r\n // Nothing to do for this component\r\n };\r\n SimplicationQueueSceneComponent.prototype._beforeCameraUpdate = function () {\r\n if (this.scene._simplificationQueue && !this.scene._simplificationQueue.running) {\r\n this.scene._simplificationQueue.executeNext();\r\n }\r\n };\r\n return SimplicationQueueSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/polygonMesh.ts\":\n/*!*******************************!*\\\n !*** ./Meshes/polygonMesh.ts ***!\n \\*******************************/\n/*! exports provided: Polygon, PolygonMeshBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return Polygon; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return PolygonMeshBuilder; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Vector2 wth index property\r\n */\r\nvar IndexedVector2 = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](IndexedVector2, _super);\r\n function IndexedVector2(original, \r\n /** Index of the vector2 */\r\n index) {\r\n var _this = _super.call(this, original.x, original.y) || this;\r\n _this.index = index;\r\n return _this;\r\n }\r\n return IndexedVector2;\r\n}(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"]));\r\n/**\r\n * Defines points to create a polygon\r\n */\r\nvar PolygonPoints = /** @class */ (function () {\r\n function PolygonPoints() {\r\n this.elements = new Array();\r\n }\r\n PolygonPoints.prototype.add = function (originalPoints) {\r\n var _this = this;\r\n var result = new Array();\r\n originalPoints.forEach(function (point) {\r\n if (result.length === 0 || !point.equalsWithEpsilon(result[0])) {\r\n var newPoint = new IndexedVector2(point, _this.elements.length);\r\n result.push(newPoint);\r\n _this.elements.push(newPoint);\r\n }\r\n });\r\n return result;\r\n };\r\n PolygonPoints.prototype.computeBounds = function () {\r\n var lmin = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](this.elements[0].x, this.elements[0].y);\r\n var lmax = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](this.elements[0].x, this.elements[0].y);\r\n this.elements.forEach(function (point) {\r\n // x\r\n if (point.x < lmin.x) {\r\n lmin.x = point.x;\r\n }\r\n else if (point.x > lmax.x) {\r\n lmax.x = point.x;\r\n }\r\n // y\r\n if (point.y < lmin.y) {\r\n lmin.y = point.y;\r\n }\r\n else if (point.y > lmax.y) {\r\n lmax.y = point.y;\r\n }\r\n });\r\n return {\r\n min: lmin,\r\n max: lmax,\r\n width: lmax.x - lmin.x,\r\n height: lmax.y - lmin.y\r\n };\r\n };\r\n return PolygonPoints;\r\n}());\r\n/**\r\n * Polygon\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n */\r\nvar Polygon = /** @class */ (function () {\r\n function Polygon() {\r\n }\r\n /**\r\n * Creates a rectangle\r\n * @param xmin bottom X coord\r\n * @param ymin bottom Y coord\r\n * @param xmax top X coord\r\n * @param ymax top Y coord\r\n * @returns points that make the resulting rectation\r\n */\r\n Polygon.Rectangle = function (xmin, ymin, xmax, ymax) {\r\n return [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmin, ymin),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmax, ymin),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmax, ymax),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmin, ymax)\r\n ];\r\n };\r\n /**\r\n * Creates a circle\r\n * @param radius radius of circle\r\n * @param cx scale in x\r\n * @param cy scale in y\r\n * @param numberOfSides number of sides that make up the circle\r\n * @returns points that make the resulting circle\r\n */\r\n Polygon.Circle = function (radius, cx, cy, numberOfSides) {\r\n if (cx === void 0) { cx = 0; }\r\n if (cy === void 0) { cy = 0; }\r\n if (numberOfSides === void 0) { numberOfSides = 32; }\r\n var result = new Array();\r\n var angle = 0;\r\n var increment = (Math.PI * 2) / numberOfSides;\r\n for (var i = 0; i < numberOfSides; i++) {\r\n result.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](cx + Math.cos(angle) * radius, cy + Math.sin(angle) * radius));\r\n angle -= increment;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a polygon from input string\r\n * @param input Input polygon data\r\n * @returns the parsed points\r\n */\r\n Polygon.Parse = function (input) {\r\n var floats = input.split(/[^-+eE\\.\\d]+/).map(parseFloat).filter(function (val) { return (!isNaN(val)); });\r\n var i, result = [];\r\n for (i = 0; i < (floats.length & 0x7FFFFFFE); i += 2) {\r\n result.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](floats[i], floats[i + 1]));\r\n }\r\n return result;\r\n };\r\n /**\r\n * Starts building a polygon from x and y coordinates\r\n * @param x x coordinate\r\n * @param y y coordinate\r\n * @returns the started path2\r\n */\r\n Polygon.StartingAt = function (x, y) {\r\n return _Maths_math_path__WEBPACK_IMPORTED_MODULE_7__[\"Path2\"].StartingAt(x, y);\r\n };\r\n return Polygon;\r\n}());\r\n\r\n/**\r\n * Builds a polygon\r\n * @see https://doc.babylonjs.com/how_to/polygonmeshbuilder\r\n */\r\nvar PolygonMeshBuilder = /** @class */ (function () {\r\n /**\r\n * Creates a PolygonMeshBuilder\r\n * @param name name of the builder\r\n * @param contours Path of the polygon\r\n * @param scene scene to add to when creating the mesh\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n */\r\n function PolygonMeshBuilder(name, contours, scene, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n this._points = new PolygonPoints();\r\n this._outlinepoints = new PolygonPoints();\r\n this._holes = new Array();\r\n this._epoints = new Array();\r\n this._eholes = new Array();\r\n this.bjsEarcut = earcutInjection;\r\n this._name = name;\r\n this._scene = scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_6__[\"Engine\"].LastCreatedScene;\r\n var points;\r\n if (contours instanceof _Maths_math_path__WEBPACK_IMPORTED_MODULE_7__[\"Path2\"]) {\r\n points = contours.getPoints();\r\n }\r\n else {\r\n points = contours;\r\n }\r\n this._addToepoint(points);\r\n this._points.add(points);\r\n this._outlinepoints.add(points);\r\n if (typeof this.bjsEarcut === 'undefined') {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Earcut was not found, the polygon will not be built.\");\r\n }\r\n }\r\n PolygonMeshBuilder.prototype._addToepoint = function (points) {\r\n for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {\r\n var p = points_1[_i];\r\n this._epoints.push(p.x, p.y);\r\n }\r\n };\r\n /**\r\n * Adds a whole within the polygon\r\n * @param hole Array of points defining the hole\r\n * @returns this\r\n */\r\n PolygonMeshBuilder.prototype.addHole = function (hole) {\r\n this._points.add(hole);\r\n var holepoints = new PolygonPoints();\r\n holepoints.add(hole);\r\n this._holes.push(holepoints);\r\n this._eholes.push(this._epoints.length / 2);\r\n this._addToepoint(hole);\r\n return this;\r\n };\r\n /**\r\n * Creates the polygon\r\n * @param updatable If the mesh should be updatable\r\n * @param depth The depth of the mesh created\r\n * @returns the created mesh\r\n */\r\n PolygonMeshBuilder.prototype.build = function (updatable, depth) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (depth === void 0) { depth = 0; }\r\n var result = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](this._name, this._scene);\r\n var vertexData = this.buildVertexData(depth);\r\n result.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, vertexData.positions, updatable);\r\n result.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, vertexData.normals, updatable);\r\n result.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind, vertexData.uvs, updatable);\r\n result.setIndices(vertexData.indices);\r\n return result;\r\n };\r\n /**\r\n * Creates the polygon\r\n * @param depth The depth of the mesh created\r\n * @returns the created VertexData\r\n */\r\n PolygonMeshBuilder.prototype.buildVertexData = function (depth) {\r\n var _this = this;\r\n if (depth === void 0) { depth = 0; }\r\n var result = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"]();\r\n var normals = new Array();\r\n var positions = new Array();\r\n var uvs = new Array();\r\n var bounds = this._points.computeBounds();\r\n this._points.elements.forEach(function (p) {\r\n normals.push(0, 1.0, 0);\r\n positions.push(p.x, 0, p.y);\r\n uvs.push((p.x - bounds.min.x) / bounds.width, (p.y - bounds.min.y) / bounds.height);\r\n });\r\n var indices = new Array();\r\n var res = this.bjsEarcut(this._epoints, this._eholes, 2);\r\n for (var i = 0; i < res.length; i++) {\r\n indices.push(res[i]);\r\n }\r\n if (depth > 0) {\r\n var positionscount = (positions.length / 3); //get the current pointcount\r\n this._points.elements.forEach(function (p) {\r\n normals.push(0, -1.0, 0);\r\n positions.push(p.x, -depth, p.y);\r\n uvs.push(1 - (p.x - bounds.min.x) / bounds.width, 1 - (p.y - bounds.min.y) / bounds.height);\r\n });\r\n var totalCount = indices.length;\r\n for (var i = 0; i < totalCount; i += 3) {\r\n var i0 = indices[i + 0];\r\n var i1 = indices[i + 1];\r\n var i2 = indices[i + 2];\r\n indices.push(i2 + positionscount);\r\n indices.push(i1 + positionscount);\r\n indices.push(i0 + positionscount);\r\n }\r\n //Add the sides\r\n this.addSide(positions, normals, uvs, indices, bounds, this._outlinepoints, depth, false);\r\n this._holes.forEach(function (hole) {\r\n _this.addSide(positions, normals, uvs, indices, bounds, hole, depth, true);\r\n });\r\n }\r\n result.indices = indices;\r\n result.positions = positions;\r\n result.normals = normals;\r\n result.uvs = uvs;\r\n return result;\r\n };\r\n /**\r\n * Adds a side to the polygon\r\n * @param positions points that make the polygon\r\n * @param normals normals of the polygon\r\n * @param uvs uvs of the polygon\r\n * @param indices indices of the polygon\r\n * @param bounds bounds of the polygon\r\n * @param points points of the polygon\r\n * @param depth depth of the polygon\r\n * @param flip flip of the polygon\r\n */\r\n PolygonMeshBuilder.prototype.addSide = function (positions, normals, uvs, indices, bounds, points, depth, flip) {\r\n var StartIndex = positions.length / 3;\r\n var ulength = 0;\r\n for (var i = 0; i < points.elements.length; i++) {\r\n var p = points.elements[i];\r\n var p1;\r\n if ((i + 1) > points.elements.length - 1) {\r\n p1 = points.elements[0];\r\n }\r\n else {\r\n p1 = points.elements[i + 1];\r\n }\r\n positions.push(p.x, 0, p.y);\r\n positions.push(p.x, -depth, p.y);\r\n positions.push(p1.x, 0, p1.y);\r\n positions.push(p1.x, -depth, p1.y);\r\n var v1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](p.x, 0, p.y);\r\n var v2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](p1.x, 0, p1.y);\r\n var v3 = v2.subtract(v1);\r\n var v4 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 1, 0);\r\n var vn = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(v3, v4);\r\n vn = vn.normalize();\r\n uvs.push(ulength / bounds.width, 0);\r\n uvs.push(ulength / bounds.width, 1);\r\n ulength += v3.length();\r\n uvs.push((ulength / bounds.width), 0);\r\n uvs.push((ulength / bounds.width), 1);\r\n if (!flip) {\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n indices.push(StartIndex);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 2);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 3);\r\n indices.push(StartIndex + 2);\r\n }\r\n else {\r\n normals.push(vn.x, vn.y, vn.z);\r\n normals.push(vn.x, vn.y, vn.z);\r\n normals.push(vn.x, vn.y, vn.z);\r\n normals.push(vn.x, vn.y, vn.z);\r\n indices.push(StartIndex);\r\n indices.push(StartIndex + 2);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 2);\r\n indices.push(StartIndex + 3);\r\n }\r\n StartIndex += 4;\r\n }\r\n };\r\n return PolygonMeshBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/subMesh.ts\":\n/*!***************************!*\\\n !*** ./Meshes/subMesh.ts ***!\n \\***************************/\n/*! exports provided: BaseSubMesh, SubMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return BaseSubMesh; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return SubMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Collisions/intersectionInfo */ \"./Collisions/intersectionInfo.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_functions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.functions */ \"./Maths/math.functions.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class for submeshes\r\n */\r\nvar BaseSubMesh = /** @class */ (function () {\r\n function BaseSubMesh() {\r\n /** @hidden */\r\n this._materialDefines = null;\r\n /** @hidden */\r\n this._materialEffect = null;\r\n }\r\n Object.defineProperty(BaseSubMesh.prototype, \"effect\", {\r\n /**\r\n * Gets associated effect\r\n */\r\n get: function () {\r\n return this._materialEffect;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets associated effect (effect used to render this submesh)\r\n * @param effect defines the effect to associate with\r\n * @param defines defines the set of defines used to compile this effect\r\n */\r\n BaseSubMesh.prototype.setEffect = function (effect, defines) {\r\n if (defines === void 0) { defines = null; }\r\n if (this._materialEffect === effect) {\r\n if (!effect) {\r\n this._materialDefines = null;\r\n }\r\n return;\r\n }\r\n this._materialDefines = defines;\r\n this._materialEffect = effect;\r\n };\r\n return BaseSubMesh;\r\n}());\r\n\r\n/**\r\n * Defines a subdivision inside a mesh\r\n */\r\nvar SubMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SubMesh, _super);\r\n /**\r\n * Creates a new submesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n */\r\n function SubMesh(\r\n /** the material index to use */\r\n materialIndex, \r\n /** vertex index start */\r\n verticesStart, \r\n /** vertices count */\r\n verticesCount, \r\n /** index start */\r\n indexStart, \r\n /** indices count */\r\n indexCount, mesh, renderingMesh, createBoundingBox) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n var _this = _super.call(this) || this;\r\n _this.materialIndex = materialIndex;\r\n _this.verticesStart = verticesStart;\r\n _this.verticesCount = verticesCount;\r\n _this.indexStart = indexStart;\r\n _this.indexCount = indexCount;\r\n /** @hidden */\r\n _this._linesIndexCount = 0;\r\n _this._linesIndexBuffer = null;\r\n /** @hidden */\r\n _this._lastColliderWorldVertices = null;\r\n /** @hidden */\r\n _this._lastColliderTransformMatrix = null;\r\n /** @hidden */\r\n _this._renderId = 0;\r\n /** @hidden */\r\n _this._alphaIndex = 0;\r\n /** @hidden */\r\n _this._distanceToCamera = 0;\r\n _this._currentMaterial = null;\r\n _this._mesh = mesh;\r\n _this._renderingMesh = renderingMesh || mesh;\r\n mesh.subMeshes.push(_this);\r\n _this._trianglePlanes = [];\r\n _this._id = mesh.subMeshes.length - 1;\r\n if (createBoundingBox) {\r\n _this.refreshBoundingInfo();\r\n mesh.computeWorldMatrix(true);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Add a new submesh to a mesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.AddToMesh = function (materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);\r\n };\r\n Object.defineProperty(SubMesh.prototype, \"IsGlobal\", {\r\n /**\r\n * Returns true if this submesh covers the entire parent mesh\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the submesh BoudingInfo object\r\n * @returns current bounding info (or mesh's one if the submesh is global)\r\n */\r\n SubMesh.prototype.getBoundingInfo = function () {\r\n if (this.IsGlobal) {\r\n return this._mesh.getBoundingInfo();\r\n }\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Sets the submesh BoundingInfo\r\n * @param boundingInfo defines the new bounding info to use\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh of the current submesh\r\n * @return the parent mesh\r\n */\r\n SubMesh.prototype.getMesh = function () {\r\n return this._mesh;\r\n };\r\n /**\r\n * Returns the rendering mesh of the submesh\r\n * @returns the rendering mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getRenderingMesh = function () {\r\n return this._renderingMesh;\r\n };\r\n /**\r\n * Returns the submesh material\r\n * @returns null or the current material\r\n */\r\n SubMesh.prototype.getMaterial = function () {\r\n var rootMaterial = this._renderingMesh.material;\r\n if (rootMaterial === null || rootMaterial === undefined) {\r\n return this._mesh.getScene().defaultMaterial;\r\n }\r\n else if (rootMaterial.getSubMaterial) {\r\n var multiMaterial = rootMaterial;\r\n var effectiveMaterial = multiMaterial.getSubMaterial(this.materialIndex);\r\n if (this._currentMaterial !== effectiveMaterial) {\r\n this._currentMaterial = effectiveMaterial;\r\n this._materialDefines = null;\r\n }\r\n return effectiveMaterial;\r\n }\r\n return rootMaterial;\r\n };\r\n // Methods\r\n /**\r\n * Sets a new updated BoundingInfo object to the submesh\r\n * @param data defines an optional position array to use to determine the bounding info\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.refreshBoundingInfo = function (data) {\r\n if (data === void 0) { data = null; }\r\n this._lastColliderWorldVertices = null;\r\n if (this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) {\r\n return this;\r\n }\r\n if (!data) {\r\n data = this._renderingMesh.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n }\r\n if (!data) {\r\n this._boundingInfo = this._mesh.getBoundingInfo();\r\n return this;\r\n }\r\n var indices = this._renderingMesh.getIndices();\r\n var extend;\r\n //is this the only submesh?\r\n if (this.indexStart === 0 && this.indexCount === indices.length) {\r\n var boundingInfo = this._renderingMesh.getBoundingInfo();\r\n //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.\r\n extend = { minimum: boundingInfo.minimum.clone(), maximum: boundingInfo.maximum.clone() };\r\n }\r\n else {\r\n extend = Object(_Maths_math_functions__WEBPACK_IMPORTED_MODULE_5__[\"extractMinAndMaxIndexed\"])(data, indices, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);\r\n }\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_3__[\"BoundingInfo\"](extend.minimum, extend.maximum);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._checkCollision = function (collider) {\r\n var boundingInfo = this.getBoundingInfo();\r\n return boundingInfo._checkCollision(collider);\r\n };\r\n /**\r\n * Updates the submesh BoundingInfo\r\n * @param world defines the world matrix to use to update the bounding info\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.updateBoundingInfo = function (world) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n this.refreshBoundingInfo();\r\n boundingInfo = this.getBoundingInfo();\r\n }\r\n boundingInfo.update(world);\r\n return this;\r\n };\r\n /**\r\n * True is the submesh bounding box intersects the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is intersecting with the frustum\r\n */\r\n SubMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isInFrustum(frustumPlanes, this._mesh.cullingStrategy);\r\n };\r\n /**\r\n * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is inside the frustum\r\n */\r\n SubMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * Renders the submesh\r\n * @param enableAlphaMode defines if alpha needs to be used\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.render = function (enableAlphaMode) {\r\n this._renderingMesh.render(this, enableAlphaMode);\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n SubMesh.prototype._getLinesIndexBuffer = function (indices, engine) {\r\n if (!this._linesIndexBuffer) {\r\n var linesIndices = [];\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n linesIndices.push(indices[index], indices[index + 1], indices[index + 1], indices[index + 2], indices[index + 2], indices[index]);\r\n }\r\n this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);\r\n this._linesIndexCount = linesIndices.length;\r\n }\r\n return this._linesIndexBuffer;\r\n };\r\n /**\r\n * Checks if the submesh intersects with a ray\r\n * @param ray defines the ray to test\r\n * @returns true is the passed ray intersects the submesh bounding box\r\n */\r\n SubMesh.prototype.canIntersects = function (ray) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return ray.intersectsBox(boundingInfo.boundingBox);\r\n };\r\n /**\r\n * Intersects current submesh with a ray\r\n * @param ray defines the ray to test\r\n * @param positions defines mesh's positions array\r\n * @param indices defines mesh's indices array\r\n * @param fastCheck defines if only bounding info should be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns intersection info or null if no intersection\r\n */\r\n SubMesh.prototype.intersects = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var material = this.getMaterial();\r\n if (!material) {\r\n return null;\r\n }\r\n switch (material.fillMode) {\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_PointListDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_LineListDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_LineLoopDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_LineStripDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_TriangleFanDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_TriangleStripDrawMode:\r\n return null;\r\n }\r\n // LineMesh first as it's also a Mesh...\r\n if (this._mesh.getClassName() === \"InstancedLinesMesh\" || this._mesh.getClassName() === \"LinesMesh\") {\r\n // Check if mesh is unindexed\r\n if (!indices.length) {\r\n return this._intersectUnIndexedLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n return this._intersectLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n else {\r\n // Check if mesh is unindexed\r\n if (!indices.length && this._mesh._unIndexed) {\r\n return this._intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n return this._intersectTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 2) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_2__[\"IntersectionInfo\"](null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 2) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_2__[\"IntersectionInfo\"](null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectTriangles = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n var p2 = positions[indices[index + 2]];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedTriangles = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 3) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var p2 = positions[index + 2];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._rebuild = function () {\r\n if (this._linesIndexBuffer) {\r\n this._linesIndexBuffer = null;\r\n }\r\n };\r\n // Clone\r\n /**\r\n * Creates a new submesh from the passed mesh\r\n * @param newMesh defines the new hosting mesh\r\n * @param newRenderingMesh defines an optional rendering mesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.prototype.clone = function (newMesh, newRenderingMesh) {\r\n var result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);\r\n if (!this.IsGlobal) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return result;\r\n }\r\n result._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_3__[\"BoundingInfo\"](boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n return result;\r\n };\r\n // Dispose\r\n /**\r\n * Release associated resources\r\n */\r\n SubMesh.prototype.dispose = function () {\r\n if (this._linesIndexBuffer) {\r\n this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer);\r\n this._linesIndexBuffer = null;\r\n }\r\n // Remove from mesh\r\n var index = this._mesh.subMeshes.indexOf(this);\r\n this._mesh.subMeshes.splice(index, 1);\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"SubMesh\".\r\n */\r\n SubMesh.prototype.getClassName = function () {\r\n return \"SubMesh\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new submesh from indices data\r\n * @param materialIndex the index of the main mesh material\r\n * @param startIndex the index where to start the copy in the mesh indices array\r\n * @param indexCount the number of indices to copy then from the startIndex\r\n * @param mesh the main mesh to create the submesh from\r\n * @param renderingMesh the optional rendering mesh\r\n * @returns a new submesh\r\n */\r\n SubMesh.CreateFromIndices = function (materialIndex, startIndex, indexCount, mesh, renderingMesh) {\r\n var minVertexIndex = Number.MAX_VALUE;\r\n var maxVertexIndex = -Number.MAX_VALUE;\r\n var whatWillRender = (renderingMesh || mesh);\r\n var indices = whatWillRender.getIndices();\r\n for (var index = startIndex; index < startIndex + indexCount; index++) {\r\n var vertexIndex = indices[index];\r\n if (vertexIndex < minVertexIndex) {\r\n minVertexIndex = vertexIndex;\r\n }\r\n if (vertexIndex > maxVertexIndex) {\r\n maxVertexIndex = vertexIndex;\r\n }\r\n }\r\n return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh);\r\n };\r\n return SubMesh;\r\n}(BaseSubMesh));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/trailMesh.ts\":\n/*!*****************************!*\\\n !*** ./Meshes/trailMesh.ts ***!\n \\*****************************/\n/*! exports provided: TrailMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return TrailMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to create a trail following a mesh\r\n */\r\nvar TrailMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TrailMesh, _super);\r\n /**\r\n * @constructor\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param generator The mesh to generate a trail.\r\n * @param scene The scene to add this mesh to.\r\n * @param diameter Diameter of trailing mesh. Default is 1.\r\n * @param length Length of trailing mesh. Default is 60.\r\n * @param autoStart Automatically start trailing mesh. Default true.\r\n */\r\n function TrailMesh(name, generator, scene, diameter, length, autoStart) {\r\n if (diameter === void 0) { diameter = 1; }\r\n if (length === void 0) { length = 60; }\r\n if (autoStart === void 0) { autoStart = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._sectionPolygonPointsCount = 4;\r\n _this._running = false;\r\n _this._autoStart = autoStart;\r\n _this._generator = generator;\r\n _this._diameter = diameter;\r\n _this._length = length;\r\n _this._sectionVectors = [];\r\n _this._sectionNormalVectors = [];\r\n for (var i = 0; i < _this._sectionPolygonPointsCount; i++) {\r\n _this._sectionVectors[i] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._sectionNormalVectors[i] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n _this._createMesh();\r\n return _this;\r\n }\r\n /**\r\n * \"TrailMesh\"\r\n * @returns \"TrailMesh\"\r\n */\r\n TrailMesh.prototype.getClassName = function () {\r\n return \"TrailMesh\";\r\n };\r\n TrailMesh.prototype._createMesh = function () {\r\n var data = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_4__[\"VertexData\"]();\r\n var positions = [];\r\n var normals = [];\r\n var indices = [];\r\n var meshCenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n if (this._generator._boundingInfo) {\r\n meshCenter = this._generator._boundingInfo.boundingBox.centerWorld;\r\n }\r\n var alpha = 2 * Math.PI / this._sectionPolygonPointsCount;\r\n for (var i = 0; i < this._sectionPolygonPointsCount; i++) {\r\n positions.push(meshCenter.x + Math.cos(i * alpha) * this._diameter, meshCenter.y + Math.sin(i * alpha) * this._diameter, meshCenter.z);\r\n }\r\n for (var i = 1; i <= this._length; i++) {\r\n for (var j = 0; j < this._sectionPolygonPointsCount; j++) {\r\n positions.push(meshCenter.x + Math.cos(j * alpha) * this._diameter, meshCenter.y + Math.sin(j * alpha) * this._diameter, meshCenter.z);\r\n }\r\n var l = positions.length / 3 - 2 * this._sectionPolygonPointsCount;\r\n for (var j = 0; j < this._sectionPolygonPointsCount - 1; j++) {\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount, l + j + this._sectionPolygonPointsCount + 1);\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount + 1, l + j + 1);\r\n }\r\n indices.push(l + this._sectionPolygonPointsCount - 1, l + this._sectionPolygonPointsCount - 1 + this._sectionPolygonPointsCount, l + this._sectionPolygonPointsCount);\r\n indices.push(l + this._sectionPolygonPointsCount - 1, l + this._sectionPolygonPointsCount, l);\r\n }\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_4__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n data.positions = positions;\r\n data.normals = normals;\r\n data.indices = indices;\r\n data.applyToMesh(this, true);\r\n if (this._autoStart) {\r\n this.start();\r\n }\r\n };\r\n /**\r\n * Start trailing mesh.\r\n */\r\n TrailMesh.prototype.start = function () {\r\n var _this = this;\r\n if (!this._running) {\r\n this._running = true;\r\n this._beforeRenderObserver = this.getScene().onBeforeRenderObservable.add(function () {\r\n _this.update();\r\n });\r\n }\r\n };\r\n /**\r\n * Stop trailing mesh.\r\n */\r\n TrailMesh.prototype.stop = function () {\r\n if (this._beforeRenderObserver && this._running) {\r\n this._running = false;\r\n this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n };\r\n /**\r\n * Update trailing mesh geometry.\r\n */\r\n TrailMesh.prototype.update = function () {\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind);\r\n var normals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind);\r\n var wm = this._generator.getWorldMatrix();\r\n if (positions && normals) {\r\n for (var i = 3 * this._sectionPolygonPointsCount; i < positions.length; i++) {\r\n positions[i - 3 * this._sectionPolygonPointsCount] = positions[i] - normals[i] / this._length * this._diameter;\r\n }\r\n for (var i = 3 * this._sectionPolygonPointsCount; i < normals.length; i++) {\r\n normals[i - 3 * this._sectionPolygonPointsCount] = normals[i];\r\n }\r\n var l = positions.length - 3 * this._sectionPolygonPointsCount;\r\n var alpha = 2 * Math.PI / this._sectionPolygonPointsCount;\r\n for (var i = 0; i < this._sectionPolygonPointsCount; i++) {\r\n this._sectionVectors[i].copyFromFloats(Math.cos(i * alpha) * this._diameter, Math.sin(i * alpha) * this._diameter, 0);\r\n this._sectionNormalVectors[i].copyFromFloats(Math.cos(i * alpha), Math.sin(i * alpha), 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(this._sectionVectors[i], wm, this._sectionVectors[i]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormalToRef(this._sectionNormalVectors[i], wm, this._sectionNormalVectors[i]);\r\n }\r\n for (var i = 0; i < this._sectionPolygonPointsCount; i++) {\r\n positions[l + 3 * i] = this._sectionVectors[i].x;\r\n positions[l + 3 * i + 1] = this._sectionVectors[i].y;\r\n positions[l + 3 * i + 2] = this._sectionVectors[i].z;\r\n normals[l + 3 * i] = this._sectionNormalVectors[i].x;\r\n normals[l + 3 * i + 1] = this._sectionNormalVectors[i].y;\r\n normals[l + 3 * i + 2] = this._sectionNormalVectors[i].z;\r\n }\r\n this.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, positions, true, false);\r\n this.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, normals, true, false);\r\n }\r\n };\r\n /**\r\n * Returns a new TrailMesh object.\r\n * @param name is a string, the name given to the new mesh\r\n * @param newGenerator use new generator object for cloned trail mesh\r\n * @returns a new mesh\r\n */\r\n TrailMesh.prototype.clone = function (name, newGenerator) {\r\n if (name === void 0) { name = \"\"; }\r\n return new TrailMesh(name, (newGenerator === undefined ? this._generator : newGenerator), this.getScene(), this._diameter, this._length, this._autoStart);\r\n };\r\n /**\r\n * Serializes this trail mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n TrailMesh.prototype.serialize = function (serializationObject) {\r\n _super.prototype.serialize.call(this, serializationObject);\r\n };\r\n /**\r\n * Parses a serialized trail mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the trail mesh in\r\n * @returns the created trail mesh\r\n */\r\n TrailMesh.Parse = function (parsedMesh, scene) {\r\n return new TrailMesh(parsedMesh.name, parsedMesh._generator, scene, parsedMesh._diameter, parsedMesh._length, parsedMesh._autoStart);\r\n };\r\n return TrailMesh;\r\n}(_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/transformNode.ts\":\n/*!*********************************!*\\\n !*** ./Meshes/transformNode.ts ***!\n \\*********************************/\n/*! exports provided: TransformNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return TransformNode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.\r\n * @see https://doc.babylonjs.com/how_to/transformnode\r\n */\r\nvar TransformNode = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TransformNode, _super);\r\n function TransformNode(name, scene, isPure) {\r\n if (scene === void 0) { scene = null; }\r\n if (isPure === void 0) { isPure = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._forward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1);\r\n _this._forwardInverted = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, -1);\r\n _this._up = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0);\r\n _this._right = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0);\r\n _this._rightInverted = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-1, 0, 0);\r\n // Properties\r\n _this._position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._rotationQuaternion = null;\r\n _this._scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].One();\r\n _this._isDirty = false;\r\n _this._transformToBoneReferal = null;\r\n _this._isAbsoluteSynced = false;\r\n _this._billboardMode = TransformNode.BILLBOARDMODE_NONE;\r\n _this._preserveParentRotationForBillboard = false;\r\n /**\r\n * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube\r\n */\r\n _this.scalingDeterminant = 1;\r\n _this._infiniteDistance = false;\r\n /**\r\n * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.\r\n * By default the system will update normals to compensate\r\n */\r\n _this.ignoreNonUniformScaling = false;\r\n /**\r\n * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both\r\n */\r\n _this.reIntegrateRotationIntoRotationQuaternion = false;\r\n // Cache\r\n /** @hidden */\r\n _this._poseMatrix = null;\r\n /** @hidden */\r\n _this._localMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n _this._usePivotMatrix = false;\r\n _this._absolutePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._absoluteScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._absoluteRotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n _this._pivotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n _this._postMultiplyPivotMatrix = false;\r\n _this._isWorldMatrixFrozen = false;\r\n /** @hidden */\r\n _this._indexInSceneTransformNodesArray = -1;\r\n /**\r\n * An event triggered after the world matrix is updated\r\n */\r\n _this.onAfterWorldMatrixUpdateObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._nonUniformScaling = false;\r\n if (isPure) {\r\n _this.getScene().addTransformNode(_this);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(TransformNode.prototype, \"billboardMode\", {\r\n /**\r\n * Gets or sets the billboard mode. Default is 0.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | BILLBOARDMODE_NONE | |\r\n * | 1 | BILLBOARDMODE_X | |\r\n * | 2 | BILLBOARDMODE_Y | |\r\n * | 4 | BILLBOARDMODE_Z | |\r\n * | 7 | BILLBOARDMODE_ALL | |\r\n *\r\n */\r\n get: function () {\r\n return this._billboardMode;\r\n },\r\n set: function (value) {\r\n if (this._billboardMode === value) {\r\n return;\r\n }\r\n this._billboardMode = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"preserveParentRotationForBillboard\", {\r\n /**\r\n * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.\r\n * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed\r\n */\r\n get: function () {\r\n return this._preserveParentRotationForBillboard;\r\n },\r\n set: function (value) {\r\n if (value === this._preserveParentRotationForBillboard) {\r\n return;\r\n }\r\n this._preserveParentRotationForBillboard = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"infiniteDistance\", {\r\n /**\r\n * Gets or sets the distance of the object to max, often used by skybox\r\n */\r\n get: function () {\r\n return this._infiniteDistance;\r\n },\r\n set: function (value) {\r\n if (this._infiniteDistance === value) {\r\n return;\r\n }\r\n this._infiniteDistance = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"TransformNode\" string\r\n */\r\n TransformNode.prototype.getClassName = function () {\r\n return \"TransformNode\";\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"position\", {\r\n /**\r\n * Gets or set the node position (default is (0.0, 0.0, 0.0))\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotation\", {\r\n /**\r\n * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion\r\n */\r\n get: function () {\r\n return this._rotation;\r\n },\r\n set: function (newRotation) {\r\n this._rotation = newRotation;\r\n this._rotationQuaternion = null;\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotationQuaternion\", {\r\n /**\r\n * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).\r\n * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)\r\n */\r\n get: function () {\r\n return this._rotationQuaternion;\r\n },\r\n set: function (quaternion) {\r\n this._rotationQuaternion = quaternion;\r\n //reset the rotation vector.\r\n if (quaternion) {\r\n this._rotation.setAll(0.0);\r\n }\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"forward\", {\r\n /**\r\n * The forward direction of that transform in world space.\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this.getScene().useRightHandedSystem ? this._forwardInverted : this._forward, this.getWorldMatrix()));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"up\", {\r\n /**\r\n * The up direction of that transform in world space.\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this._up, this.getWorldMatrix()));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"right\", {\r\n /**\r\n * The right direction of that transform in world space.\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this.getScene().useRightHandedSystem ? this._rightInverted : this._right, this.getWorldMatrix()));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies the parameter passed Matrix into the mesh Pose matrix.\r\n * @param matrix the matrix to copy the pose from\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.updatePoseMatrix = function (matrix) {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = matrix.clone();\r\n return this;\r\n }\r\n this._poseMatrix.copyFrom(matrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh Pose matrix.\r\n * @returns the pose matrix\r\n */\r\n TransformNode.prototype.getPoseMatrix = function () {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n }\r\n return this._poseMatrix;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._isSynchronized = function () {\r\n var cache = this._cache;\r\n if (this.billboardMode !== cache.billboardMode || this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n return false;\r\n }\r\n if (cache.pivotMatrixUpdated) {\r\n return false;\r\n }\r\n if (this.infiniteDistance) {\r\n return false;\r\n }\r\n if (!cache.position.equals(this._position)) {\r\n return false;\r\n }\r\n if (this._rotationQuaternion) {\r\n if (!cache.rotationQuaternion.equals(this._rotationQuaternion)) {\r\n return false;\r\n }\r\n }\r\n else if (!cache.rotation.equals(this._rotation)) {\r\n return false;\r\n }\r\n if (!cache.scaling.equals(this._scaling)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n var cache = this._cache;\r\n cache.localMatrixUpdated = false;\r\n cache.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n cache.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n cache.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n cache.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"](0, 0, 0, 0);\r\n cache.billboardMode = -1;\r\n cache.infiniteDistance = false;\r\n };\r\n /**\r\n * Flag the transform node as dirty (Forcing it to update everything)\r\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\r\n * @returns this transform node\r\n */\r\n TransformNode.prototype.markAsDirty = function (property) {\r\n this._currentRenderId = Number.MAX_VALUE;\r\n this._isDirty = true;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"absolutePosition\", {\r\n /**\r\n * Returns the current mesh absolute position.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n return this._absolutePosition;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteScaling\", {\r\n /**\r\n * Returns the current mesh absolute scaling.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteScaling;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteRotationQuaternion\", {\r\n /**\r\n * Returns the current mesh absolute rotation.\r\n * Returns a Quaternion.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteRotationQuaternion;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets a new matrix to apply before all other transformation\r\n * @param matrix defines the transform matrix\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPreTransformMatrix = function (matrix) {\r\n return this.setPivotMatrix(matrix, false);\r\n };\r\n /**\r\n * Sets a new pivot matrix to the current node\r\n * @param matrix defines the new pivot matrix to use\r\n * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {\r\n if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = true; }\r\n this._pivotMatrix.copyFrom(matrix);\r\n this._usePivotMatrix = !this._pivotMatrix.isIdentity();\r\n this._cache.pivotMatrixUpdated = true;\r\n this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;\r\n if (this._postMultiplyPivotMatrix) {\r\n if (!this._pivotMatrixInverse) {\r\n this._pivotMatrixInverse = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(this._pivotMatrix);\r\n }\r\n else {\r\n this._pivotMatrix.invertToRef(this._pivotMatrixInverse);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh pivot matrix.\r\n * Default : Identity.\r\n * @returns the matrix\r\n */\r\n TransformNode.prototype.getPivotMatrix = function () {\r\n return this._pivotMatrix;\r\n };\r\n /**\r\n * Instantiate (when possible) or clone that node with its hierarchy\r\n * @param newParent defines the new parent to use for the instance (or clone)\r\n * @returns an instance (or a clone) of the current node with its hiearchy\r\n */\r\n TransformNode.prototype.instantiateHierarychy = function (newParent) {\r\n if (newParent === void 0) { newParent = null; }\r\n var clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarychy(clone);\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Prevents the World matrix to be computed any longer\r\n * @param newWorldMatrix defines an optional matrix to use as world matrix\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.freezeWorldMatrix = function (newWorldMatrix) {\r\n if (newWorldMatrix === void 0) { newWorldMatrix = null; }\r\n if (newWorldMatrix) {\r\n this._worldMatrix = this._worldMatrix;\r\n }\r\n else {\r\n this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily\r\n this.computeWorldMatrix(true);\r\n }\r\n this._isWorldMatrixFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * Allows back the World matrix computation.\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unfreezeWorldMatrix = function () {\r\n this._isWorldMatrixFrozen = false;\r\n this.computeWorldMatrix(true);\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"isWorldMatrixFrozen\", {\r\n /**\r\n * True if the World matrix has been frozen.\r\n */\r\n get: function () {\r\n return this._isWorldMatrixFrozen;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Retuns the mesh absolute position in the World.\r\n * @returns a Vector3.\r\n */\r\n TransformNode.prototype.getAbsolutePosition = function () {\r\n this.computeWorldMatrix();\r\n return this._absolutePosition;\r\n };\r\n /**\r\n * Sets the mesh absolute position in the World from a Vector3 or an Array(3).\r\n * @param absolutePosition the absolute position to set\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setAbsolutePosition = function (absolutePosition) {\r\n if (!absolutePosition) {\r\n return this;\r\n }\r\n var absolutePositionX;\r\n var absolutePositionY;\r\n var absolutePositionZ;\r\n if (absolutePosition.x === undefined) {\r\n if (arguments.length < 3) {\r\n return this;\r\n }\r\n absolutePositionX = arguments[0];\r\n absolutePositionY = arguments[1];\r\n absolutePositionZ = arguments[2];\r\n }\r\n else {\r\n absolutePositionX = absolutePosition.x;\r\n absolutePositionY = absolutePosition.y;\r\n absolutePositionZ = absolutePosition.z;\r\n }\r\n if (this.parent) {\r\n var invertParentWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);\r\n }\r\n else {\r\n this.position.x = absolutePositionX;\r\n this.position.y = absolutePositionY;\r\n this.position.z = absolutePositionZ;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh position in its local space.\r\n * @param vector3 the position to set in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setPositionWithLocalVector = function (vector3) {\r\n this.computeWorldMatrix();\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh position in the local space from the current World matrix values.\r\n * @returns a new Vector3.\r\n */\r\n TransformNode.prototype.getPositionExpressedInLocalSpace = function () {\r\n this.computeWorldMatrix();\r\n var invLocalWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this._localMatrix.invertToRef(invLocalWorldMatrix);\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this.position, invLocalWorldMatrix);\r\n };\r\n /**\r\n * Translates the mesh along the passed Vector3 in its local space.\r\n * @param vector3 the distance to translate in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.locallyTranslate = function (vector3) {\r\n this.computeWorldMatrix(true);\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Orients a mesh towards a target point. Mesh must be drawn facing user.\r\n * @param targetPoint the position (must be in same space as current mesh) to look at\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @param space the choosen space of the target\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.lookAt = function (targetPoint, yawCor, pitchCor, rollCor, space) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL; }\r\n var dv = TransformNode._lookAtVectorCache;\r\n var pos = space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL ? this.position : this.getAbsolutePosition();\r\n targetPoint.subtractToRef(pos, dv);\r\n this.setDirection(dv, yawCor, pitchCor, rollCor);\r\n // Correct for parent's rotation offset\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].WORLD && this.parent) {\r\n if (this.rotationQuaternion) {\r\n // Get local rotation matrix of the looking object\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this.rotationQuaternion.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n this.rotationQuaternion.fromRotationMatrix(rotationMatrix);\r\n }\r\n else {\r\n // Get local rotation matrix of the looking object\r\n var quaternionRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].FromEulerVectorToRef(this.rotation, quaternionRotation);\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n quaternionRotation.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n quaternionRotation.fromRotationMatrix(rotationMatrix);\r\n quaternionRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n * This Vector3 is expressed in the World space.\r\n * @param localAxis axis to rotate\r\n * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n */\r\n TransformNode.prototype.getDirection = function (localAxis) {\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" as the rotated Vector3 \"localAxis\" in the same rotation than the mesh.\r\n * localAxis is expressed in the mesh local space.\r\n * result is computed in the Wordl space from the mesh World matrix.\r\n * @param localAxis axis to rotate\r\n * @param result the resulting transformnode\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getDirectionToRef = function (localAxis, result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Sets this transform node rotation to the given local axis.\r\n * @param localAxis the axis in local space\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @returns this TransformNode\r\n */\r\n TransformNode.prototype.setDirection = function (localAxis, yawCor, pitchCor, rollCor) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;\r\n var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);\r\n var pitch = -Math.atan2(localAxis.y, len);\r\n if (this.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);\r\n }\r\n else {\r\n this.rotation.x = pitch + pitchCor;\r\n this.rotation.y = yaw + yawCor;\r\n this.rotation.z = rollCor;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a new pivot point to the current node\r\n * @param point defines the new pivot point to use\r\n * @param space defines if the point is in world or local space (local by default)\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotPoint = function (point, space) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL; }\r\n if (this.getScene().getRenderId() == 0) {\r\n this.computeWorldMatrix(true);\r\n }\r\n var wm = this.getWorldMatrix();\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].WORLD) {\r\n var tmat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n wm.invertToRef(tmat);\r\n point = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(point, tmat);\r\n }\r\n return this.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Translation(-point.x, -point.y, -point.z), true);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.\r\n * @returns the pivot point\r\n */\r\n TransformNode.prototype.getPivotPoint = function () {\r\n var point = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getPivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the passed Vector3 \"result\" with the coordinates of the mesh pivot point in the local space.\r\n * @param result the vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getPivotPointToRef = function (result) {\r\n result.x = -this._pivotMatrix.m[12];\r\n result.y = -this._pivotMatrix.m[13];\r\n result.z = -this._pivotMatrix.m[14];\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point World coordinates.\r\n * @returns a new Vector3 set with the mesh pivot point World coordinates.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPoint = function () {\r\n var point = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getAbsolutePivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" coordinates with the mesh pivot point World coordinates.\r\n * @param result vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPointToRef = function (result) {\r\n result.x = this._pivotMatrix.m[12];\r\n result.y = this._pivotMatrix.m[13];\r\n result.z = this._pivotMatrix.m[14];\r\n this.getPivotPointToRef(result);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(result, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Defines the passed node as the parent of the current node.\r\n * The node will remain exactly where it is and its position / rotation will be updated accordingly\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n * @param node the node ot set as the parent\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.setParent = function (node) {\r\n if (!node && !this.parent) {\r\n return this;\r\n }\r\n var quatRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var scale = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n if (!node) {\r\n this.computeWorldMatrix(true);\r\n this.getWorldMatrix().decompose(scale, quatRotation, position);\r\n }\r\n else {\r\n var diffMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n var invParentMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n this.computeWorldMatrix(true);\r\n node.computeWorldMatrix(true);\r\n node.getWorldMatrix().invertToRef(invParentMatrix);\r\n this.getWorldMatrix().multiplyToRef(invParentMatrix, diffMatrix);\r\n diffMatrix.decompose(scale, quatRotation, position);\r\n }\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(quatRotation);\r\n }\r\n else {\r\n quatRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n this.scaling.copyFrom(scale);\r\n this.position.copyFrom(position);\r\n this.parent = node;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"nonUniformScaling\", {\r\n /**\r\n * True if the scaling property of this object is non uniform eg. (1,2,1)\r\n */\r\n get: function () {\r\n return this._nonUniformScaling;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n TransformNode.prototype._updateNonUniformScalingState = function (value) {\r\n if (this._nonUniformScaling === value) {\r\n return false;\r\n }\r\n this._nonUniformScaling = value;\r\n return true;\r\n };\r\n /**\r\n * Attach the current TransformNode to another TransformNode associated with a bone\r\n * @param bone Bone affecting the TransformNode\r\n * @param affectedTransformNode TransformNode associated with the bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.attachToBone = function (bone, affectedTransformNode) {\r\n this._transformToBoneReferal = affectedTransformNode;\r\n this.parent = bone;\r\n if (bone.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Detach the transform node if its associated with a bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.detachFromBone = function () {\r\n if (!this.parent) {\r\n return this;\r\n }\r\n if (this.parent.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n this._transformToBoneReferal = null;\r\n this.parent = null;\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized.\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.rotate = function (axis, amount, space) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = this.rotation.toQuaternion();\r\n this.rotation.setAll(0);\r\n }\r\n var rotationQuaternion;\r\n if (!space || space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL) {\r\n rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);\r\n }\r\n else {\r\n if (this.parent) {\r\n var invertParentWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n axis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(axis, invertParentWorldMatrix);\r\n }\r\n rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized. .\r\n * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm\r\n * @param point the point to rotate around\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @returns the TransformNode\r\n */\r\n TransformNode.prototype.rotateAround = function (point, axis, amount) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n this.rotation.setAll(0);\r\n }\r\n var tmpVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var finalScale = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n var finalTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[2];\r\n var finalRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n var translationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]; // T\r\n var translationMatrixInv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1]; // T'\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[2]; // R\r\n var finalMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[3]; // T' x R x T\r\n point.subtractToRef(this.position, tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationAxisToRef(axis, amount, rotationMatrix); // R\r\n translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R\r\n finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T\r\n finalMatrix.decompose(finalScale, finalRotation, finalTranslation);\r\n this.position.addInPlace(finalTranslation);\r\n finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n return this;\r\n };\r\n /**\r\n * Translates the mesh along the axis vector for the passed distance in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * @param axis the axis to translate in\r\n * @param distance the distance to translate\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.translate = function (axis, distance, space) {\r\n var displacementVector = axis.scale(distance);\r\n if (!space || space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL) {\r\n var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);\r\n this.setPositionWithLocalVector(tempV3);\r\n }\r\n else {\r\n this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds a rotation step to the mesh current rotation.\r\n * x, y, z are Euler angles expressed in radians.\r\n * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.\r\n * This means this rotation is made in the mesh local space only.\r\n * It's useful to set a custom rotation order different from the BJS standard one YXZ.\r\n * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.\r\n * ```javascript\r\n * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);\r\n * ```\r\n * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.\r\n * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.\r\n * @param x Rotation to add\r\n * @param y Rotation to add\r\n * @param z Rotation to add\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.addRotation = function (x, y, z) {\r\n var rotationQuaternion;\r\n if (this.rotationQuaternion) {\r\n rotationQuaternion = this.rotationQuaternion;\r\n }\r\n else {\r\n rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);\r\n }\r\n var accumulation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(y, x, z, accumulation);\r\n rotationQuaternion.multiplyInPlace(accumulation);\r\n if (!this.rotationQuaternion) {\r\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n }\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TransformNode.prototype._getEffectiveParent = function () {\r\n return this.parent;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n TransformNode.prototype.computeWorldMatrix = function (force) {\r\n if (this._isWorldMatrixFrozen && !this._isDirty) {\r\n return this._worldMatrix;\r\n }\r\n var currentRenderId = this.getScene().getRenderId();\r\n if (!this._isDirty && !force && this.isSynchronized()) {\r\n this._currentRenderId = currentRenderId;\r\n return this._worldMatrix;\r\n }\r\n var camera = this.getScene().activeCamera;\r\n var useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;\r\n var useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\r\n // Billboarding based on camera position\r\n if (useBillboardPath && camera && useBillboardPosition) {\r\n this.lookAt(camera.position);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n this.rotation.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n this.rotation.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n this.rotation.z = 0;\r\n }\r\n }\r\n this._updateCache();\r\n var cache = this._cache;\r\n cache.pivotMatrixUpdated = false;\r\n cache.billboardMode = this.billboardMode;\r\n cache.infiniteDistance = this.infiniteDistance;\r\n this._currentRenderId = currentRenderId;\r\n this._childUpdateId++;\r\n this._isDirty = false;\r\n var parent = this._getEffectiveParent();\r\n // Scaling\r\n var scaling = cache.scaling;\r\n var translation = cache.position;\r\n // Translation\r\n if (this._infiniteDistance) {\r\n if (!this.parent && camera) {\r\n var cameraWorldMatrix = camera.getWorldMatrix();\r\n var cameraGlobalPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);\r\n translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);\r\n }\r\n else {\r\n translation.copyFrom(this._position);\r\n }\r\n }\r\n else {\r\n translation.copyFrom(this._position);\r\n }\r\n // Scaling\r\n scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);\r\n // Rotation\r\n var rotation = cache.rotationQuaternion;\r\n if (this._rotationQuaternion) {\r\n if (this.reIntegrateRotationIntoRotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n this._rotationQuaternion.multiplyInPlace(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));\r\n this._rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n rotation.copyFrom(this._rotationQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);\r\n cache.rotation.copyFrom(this._rotation);\r\n }\r\n // Compose\r\n if (this._usePivotMatrix) {\r\n var scaleMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);\r\n // Rotation\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n rotation.toRotationMatrix(rotationMatrix);\r\n // Composing transformations\r\n this._pivotMatrix.multiplyToRef(scaleMatrix, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[4]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);\r\n // Post multiply inverse of pivotMatrix\r\n if (this._postMultiplyPivotMatrix) {\r\n this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);\r\n }\r\n this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ComposeToRef(scaling, rotation, translation, this._localMatrix);\r\n }\r\n // Parent\r\n if (parent && parent.getWorldMatrix) {\r\n if (force) {\r\n parent.computeWorldMatrix();\r\n }\r\n if (useBillboardPath) {\r\n if (this._transformToBoneReferal) {\r\n parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7]);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7].copyFrom(parent.getWorldMatrix());\r\n }\r\n // Extract scaling and translation from parent\r\n var translation_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[5];\r\n var scale = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[6];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7].decompose(scale, undefined, translation_1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ScalingToRef(scale.x, scale.y, scale.z, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7].setTranslation(translation_1);\r\n this._localMatrix.multiplyToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7], this._worldMatrix);\r\n }\r\n else {\r\n if (this._transformToBoneReferal) {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[6]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);\r\n }\r\n else {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);\r\n }\r\n }\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._worldMatrix.copyFrom(this._localMatrix);\r\n }\r\n // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)\r\n if (useBillboardPath && camera && this.billboardMode && !useBillboardPosition) {\r\n var storedTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation\r\n // Cancel camera rotation\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1].copyFrom(camera.getViewMatrix());\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1].setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1].invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0].decompose(undefined, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0], undefined);\r\n var eulerAngles = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0].toEulerAnglesToRef(eulerAngles);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n eulerAngles.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n eulerAngles.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n eulerAngles.z = 0;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n }\r\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\r\n this._worldMatrix.multiplyToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0], this._worldMatrix);\r\n // Restore translation\r\n this._worldMatrix.setTranslation(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0]);\r\n }\r\n // Normal matrix\r\n if (!this.ignoreNonUniformScaling) {\r\n if (this._scaling.isNonUniform) {\r\n this._updateNonUniformScalingState(true);\r\n }\r\n else if (parent && parent._nonUniformScaling) {\r\n this._updateNonUniformScalingState(parent._nonUniformScaling);\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n this._afterComputeWorldMatrix();\r\n // Absolute position\r\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\r\n this._isAbsoluteSynced = false;\r\n // Callbacks\r\n this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(this._worldMatrix);\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n TransformNode.prototype._afterComputeWorldMatrix = function () {\r\n };\r\n /**\r\n * If you'd like to be called back after the mesh position, rotation or scaling has been updated.\r\n * @param func callback function to add\r\n *\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.registerAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Removes a registered callback function.\r\n * @param func callback function to remove\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unregisterAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Gets the position of the current mesh in camera space\r\n * @param camera defines the camera to use\r\n * @returns a position\r\n */\r\n TransformNode.prototype.getPositionInCameraSpace = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(this.absolutePosition, camera.getViewMatrix());\r\n };\r\n /**\r\n * Returns the distance from the mesh to the active camera\r\n * @param camera defines the camera to use\r\n * @returns the distance\r\n */\r\n TransformNode.prototype.getDistanceToCamera = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return this.absolutePosition.subtract(camera.globalPosition).length();\r\n };\r\n /**\r\n * Clone the current transform node\r\n * @param name Name of the new clone\r\n * @param newParent New parent for the clone\r\n * @param doNotCloneChildren Do not clone children hierarchy\r\n * @returns the new transform node\r\n */\r\n TransformNode.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n var _this = this;\r\n var result = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new TransformNode(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = this.getDescendants(true);\r\n for (var index = 0; index < directDescendants.length; index++) {\r\n var child = directDescendants[index];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, result);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the objects information.\r\n * @param currentSerializationObject defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n TransformNode.prototype.serialize = function (currentSerializationObject) {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this, currentSerializationObject);\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n serializationObject.isEnabled = this.isEnabled();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new TransformNode object parsed from the source provided.\r\n * @param parsedTransformNode is the source.\r\n * @param scene the scne the object belongs to\r\n * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new TransformNode object parsed from the source provided.\r\n */\r\n TransformNode.Parse = function (parsedTransformNode, scene, rootUrl) {\r\n var transformNode = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new TransformNode(parsedTransformNode.name, scene); }, parsedTransformNode, scene, rootUrl);\r\n if (parsedTransformNode.localMatrix) {\r\n transformNode.setPreTransformMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromArray(parsedTransformNode.localMatrix));\r\n }\r\n else if (parsedTransformNode.pivotMatrix) {\r\n transformNode.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromArray(parsedTransformNode.pivotMatrix));\r\n }\r\n transformNode.setEnabled(parsedTransformNode.isEnabled);\r\n // Parent\r\n if (parsedTransformNode.parentId) {\r\n transformNode._waitingParentId = parsedTransformNode.parentId;\r\n }\r\n return transformNode;\r\n };\r\n /**\r\n * Get all child-transformNodes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of TransformNode\r\n */\r\n TransformNode.prototype.getChildTransformNodes = function (directDescendantsOnly, predicate) {\r\n var results = [];\r\n this._getDescendants(results, directDescendantsOnly, function (node) {\r\n return ((!predicate || predicate(node)) && (node instanceof TransformNode));\r\n });\r\n return results;\r\n };\r\n /**\r\n * Releases resources associated with this transform node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n TransformNode.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeTransformNode(this);\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n if (doNotRecurse) {\r\n var transformNodes = this.getChildTransformNodes(true);\r\n for (var _i = 0, transformNodes_1 = transformNodes; _i < transformNodes_1.length; _i++) {\r\n var transformNode = transformNodes_1[_i];\r\n transformNode.parent = null;\r\n transformNode.computeWorldMatrix(true);\r\n }\r\n }\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n TransformNode.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n var storedRotation = null;\r\n var storedRotationQuaternion = null;\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion) {\r\n storedRotationQuaternion = this.rotationQuaternion.clone();\r\n this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);\r\n }\r\n else if (this.rotation) {\r\n storedRotation = this.rotation.clone();\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n var boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);\r\n var sizeVec = boundingVectors.max.subtract(boundingVectors.min);\r\n var maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);\r\n if (maxDimension === 0) {\r\n return this;\r\n }\r\n var scale = 1 / maxDimension;\r\n this.scaling.scaleInPlace(scale);\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion && storedRotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(storedRotationQuaternion);\r\n }\r\n else if (this.rotation && storedRotation) {\r\n this.rotation.copyFrom(storedRotation);\r\n }\r\n }\r\n return this;\r\n };\r\n TransformNode.prototype._syncAbsoluteScalingAndRotation = function () {\r\n if (!this._isAbsoluteSynced) {\r\n this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);\r\n this._isAbsoluteSynced = true;\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Object will not rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_NONE = 0;\r\n /**\r\n * Object will rotate to face the camera but only on the x axis\r\n */\r\n TransformNode.BILLBOARDMODE_X = 1;\r\n /**\r\n * Object will rotate to face the camera but only on the y axis\r\n */\r\n TransformNode.BILLBOARDMODE_Y = 2;\r\n /**\r\n * Object will rotate to face the camera but only on the z axis\r\n */\r\n TransformNode.BILLBOARDMODE_Z = 4;\r\n /**\r\n * Object will rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Object will rotate to face the camera's position instead of orientation\r\n */\r\n TransformNode.BILLBOARDMODE_USE_POSITION = 128;\r\n TransformNode._lookAtVectorCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n TransformNode._rotationAxisCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"position\")\r\n ], TransformNode.prototype, \"_position\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"rotation\")\r\n ], TransformNode.prototype, \"_rotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsQuaternion\"])(\"rotationQuaternion\")\r\n ], TransformNode.prototype, \"_rotationQuaternion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"scaling\")\r\n ], TransformNode.prototype, \"_scaling\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"billboardMode\")\r\n ], TransformNode.prototype, \"_billboardMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TransformNode.prototype, \"scalingDeterminant\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"infiniteDistance\")\r\n ], TransformNode.prototype, \"_infiniteDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TransformNode.prototype, \"ignoreNonUniformScaling\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TransformNode.prototype, \"reIntegrateRotationIntoRotationQuaternion\", void 0);\r\n return TransformNode;\r\n}(_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\":\n/*!***************************************************************!*\\\n !*** ./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts ***!\n \\***************************************************************/\n/*! exports provided: CubeMapToSphericalPolynomialTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return CubeMapToSphericalPolynomialTools; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\nvar FileFaceOrientation = /** @class */ (function () {\r\n function FileFaceOrientation(name, worldAxisForNormal, worldAxisForFileX, worldAxisForFileY) {\r\n this.name = name;\r\n this.worldAxisForNormal = worldAxisForNormal;\r\n this.worldAxisForFileX = worldAxisForFileX;\r\n this.worldAxisForFileY = worldAxisForFileY;\r\n }\r\n return FileFaceOrientation;\r\n}());\r\n/**\r\n * Helper class dealing with the extraction of spherical polynomial dataArray\r\n * from a cube map.\r\n */\r\nvar CubeMapToSphericalPolynomialTools = /** @class */ (function () {\r\n function CubeMapToSphericalPolynomialTools() {\r\n }\r\n /**\r\n * Converts a texture to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param texture The texture to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial = function (texture) {\r\n if (!texture.isCube) {\r\n // Only supports cube Textures currently.\r\n return null;\r\n }\r\n var size = texture.getSize().width;\r\n var right = texture.readPixels(0);\r\n var left = texture.readPixels(1);\r\n var up;\r\n var down;\r\n if (texture.isRenderTarget) {\r\n up = texture.readPixels(3);\r\n down = texture.readPixels(2);\r\n }\r\n else {\r\n up = texture.readPixels(2);\r\n down = texture.readPixels(3);\r\n }\r\n var front = texture.readPixels(4);\r\n var back = texture.readPixels(5);\r\n var gammaSpace = texture.gammaSpace;\r\n // Always read as RGBA.\r\n var format = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n var type = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n if (texture.textureType && texture.textureType !== _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n type = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n var cubeInfo = {\r\n size: size,\r\n right: right,\r\n left: left,\r\n up: up,\r\n down: down,\r\n front: front,\r\n back: back,\r\n format: format,\r\n type: type,\r\n gammaSpace: gammaSpace,\r\n };\r\n return this.ConvertCubeMapToSphericalPolynomial(cubeInfo);\r\n };\r\n /**\r\n * Converts a cubemap to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param cubeInfo The Cube map to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial = function (cubeInfo) {\r\n var sphericalHarmonics = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalHarmonics\"]();\r\n var totalSolidAngle = 0.0;\r\n // The (u,v) range is [-1,+1], so the distance between each texel is 2/Size.\r\n var du = 2.0 / cubeInfo.size;\r\n var dv = du;\r\n // The (u,v) of the first texel is half a texel from the corner (-1,-1).\r\n var minUV = du * 0.5 - 1.0;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var fileFace = this.FileFaces[faceIndex];\r\n var dataArray = cubeInfo[fileFace.name];\r\n var v = minUV;\r\n // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).\r\n // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.\r\n // Because SP is still linear, so summation is fine in that basis.\r\n var stride = cubeInfo.format === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA ? 4 : 3;\r\n for (var y = 0; y < cubeInfo.size; y++) {\r\n var u = minUV;\r\n for (var x = 0; x < cubeInfo.size; x++) {\r\n // World direction (not normalised)\r\n var worldDirection = fileFace.worldAxisForFileX.scale(u).add(fileFace.worldAxisForFileY.scale(v)).add(fileFace.worldAxisForNormal);\r\n worldDirection.normalize();\r\n var deltaSolidAngle = Math.pow(1.0 + u * u + v * v, -3.0 / 2.0);\r\n var r = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 0];\r\n var g = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 1];\r\n var b = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 2];\r\n // Prevent NaN harmonics with extreme HDRI data.\r\n if (isNaN(r)) {\r\n r = 0;\r\n }\r\n if (isNaN(g)) {\r\n g = 0;\r\n }\r\n if (isNaN(b)) {\r\n b = 0;\r\n }\r\n // Handle Integer types.\r\n if (cubeInfo.type === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n r /= 255;\r\n g /= 255;\r\n b /= 255;\r\n }\r\n // Handle Gamma space textures.\r\n if (cubeInfo.gammaSpace) {\r\n r = Math.pow(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(r), _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"ToLinearSpace\"]);\r\n g = Math.pow(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(g), _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"ToLinearSpace\"]);\r\n b = Math.pow(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(b), _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"ToLinearSpace\"]);\r\n }\r\n // Prevent to explode in case of really high dynamic ranges.\r\n // sh 3 would not be enough to accurately represent it.\r\n var max = 4096;\r\n r = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(r, 0, max);\r\n g = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(g, 0, max);\r\n b = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(b, 0, max);\r\n var color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](r, g, b);\r\n sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);\r\n totalSolidAngle += deltaSolidAngle;\r\n u += du;\r\n }\r\n v += dv;\r\n }\r\n }\r\n // Solid angle for entire sphere is 4*pi\r\n var sphereSolidAngle = 4.0 * Math.PI;\r\n // Adjust the solid angle to allow for how many faces we processed.\r\n var facesProcessed = 6.0;\r\n var expectedSolidAngle = sphereSolidAngle * facesProcessed / 6.0;\r\n // Adjust the harmonics so that the accumulated solid angle matches the expected solid angle.\r\n // This is needed because the numerical integration over the cube uses a\r\n // small angle approximation of solid angle for each texel (see deltaSolidAngle),\r\n // and also to compensate for accumulative error due to float precision in the summation.\r\n var correctionFactor = expectedSolidAngle / totalSolidAngle;\r\n sphericalHarmonics.scaleInPlace(correctionFactor);\r\n sphericalHarmonics.convertIncidentRadianceToIrradiance();\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n return _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalPolynomial\"].FromHarmonics(sphericalHarmonics);\r\n };\r\n CubeMapToSphericalPolynomialTools.FileFaces = [\r\n new FileFaceOrientation(\"right\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)),\r\n new FileFaceOrientation(\"left\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)),\r\n new FileFaceOrientation(\"up\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1)),\r\n new FileFaceOrientation(\"down\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1)),\r\n new FileFaceOrientation(\"front\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)),\r\n new FileFaceOrientation(\"back\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)) // -Z bottom\r\n ];\r\n return CubeMapToSphericalPolynomialTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/hdr.ts\":\n/*!**************************************!*\\\n !*** ./Misc/HighDynamicRange/hdr.ts ***!\n \\**************************************/\n/*! exports provided: HDRTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return HDRTools; });\n/* harmony import */ var _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./panoramaToCubemap */ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\");\n\r\n/**\r\n * This groups tools to convert HDR texture to native colors array.\r\n */\r\nvar HDRTools = /** @class */ (function () {\r\n function HDRTools() {\r\n }\r\n HDRTools.Ldexp = function (mantissa, exponent) {\r\n if (exponent > 1023) {\r\n return mantissa * Math.pow(2, 1023) * Math.pow(2, exponent - 1023);\r\n }\r\n if (exponent < -1074) {\r\n return mantissa * Math.pow(2, -1074) * Math.pow(2, exponent + 1074);\r\n }\r\n return mantissa * Math.pow(2, exponent);\r\n };\r\n HDRTools.Rgbe2float = function (float32array, red, green, blue, exponent, index) {\r\n if (exponent > 0) { /*nonzero pixel*/\r\n exponent = this.Ldexp(1.0, exponent - (128 + 8));\r\n float32array[index + 0] = red * exponent;\r\n float32array[index + 1] = green * exponent;\r\n float32array[index + 2] = blue * exponent;\r\n }\r\n else {\r\n float32array[index + 0] = 0;\r\n float32array[index + 1] = 0;\r\n float32array[index + 2] = 0;\r\n }\r\n };\r\n HDRTools.readStringLine = function (uint8array, startIndex) {\r\n var line = \"\";\r\n var character = \"\";\r\n for (var i = startIndex; i < uint8array.length - startIndex; i++) {\r\n character = String.fromCharCode(uint8array[i]);\r\n if (character == \"\\n\") {\r\n break;\r\n }\r\n line += character;\r\n }\r\n return line;\r\n };\r\n /**\r\n * Reads header information from an RGBE texture stored in a native array.\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in native array.\r\n * @return The header information.\r\n */\r\n HDRTools.RGBE_ReadHeader = function (uint8array) {\r\n var height = 0;\r\n var width = 0;\r\n var line = this.readStringLine(uint8array, 0);\r\n if (line[0] != '#' || line[1] != '?') {\r\n throw \"Bad HDR Format.\";\r\n }\r\n var endOfHeader = false;\r\n var findFormat = false;\r\n var lineIndex = 0;\r\n do {\r\n lineIndex += (line.length + 1);\r\n line = this.readStringLine(uint8array, lineIndex);\r\n if (line == \"FORMAT=32-bit_rle_rgbe\") {\r\n findFormat = true;\r\n }\r\n else if (line.length == 0) {\r\n endOfHeader = true;\r\n }\r\n } while (!endOfHeader);\r\n if (!findFormat) {\r\n throw \"HDR Bad header format, unsupported FORMAT\";\r\n }\r\n lineIndex += (line.length + 1);\r\n line = this.readStringLine(uint8array, lineIndex);\r\n var sizeRegexp = /^\\-Y (.*) \\+X (.*)$/g;\r\n var match = sizeRegexp.exec(line);\r\n // TODO. Support +Y and -X if needed.\r\n if (!match || match.length < 3) {\r\n throw \"HDR Bad header format, no size\";\r\n }\r\n width = parseInt(match[2]);\r\n height = parseInt(match[1]);\r\n if (width < 8 || width > 0x7fff) {\r\n throw \"HDR Bad header format, unsupported size\";\r\n }\r\n lineIndex += (line.length + 1);\r\n return {\r\n height: height,\r\n width: width,\r\n dataPosition: lineIndex\r\n };\r\n };\r\n /**\r\n * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.\r\n * This RGBE texture needs to store the information as a panorama.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param buffer The binary file stored in an array buffer.\r\n * @param size The expected size of the extracted cubemap.\r\n * @return The Cube Map information.\r\n */\r\n HDRTools.GetCubeMapTextureData = function (buffer, size) {\r\n var uint8array = new Uint8Array(buffer);\r\n var hdrInfo = this.RGBE_ReadHeader(uint8array);\r\n var data = this.RGBE_ReadPixels_RLE(uint8array, hdrInfo);\r\n var cubeMapData = _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_0__[\"PanoramaToCubeMapTools\"].ConvertPanoramaToCubemap(data, hdrInfo.width, hdrInfo.height, size);\r\n return cubeMapData;\r\n };\r\n /**\r\n * Returns the pixels data extracted from an RGBE texture.\r\n * This pixels will be stored left to right up to down in the R G B order in one array.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in an array buffer.\r\n * @param hdrInfo The header information of the file.\r\n * @return The pixels data in RGB right to left up to down order.\r\n */\r\n HDRTools.RGBE_ReadPixels = function (uint8array, hdrInfo) {\r\n // Keep for multi format supports.\r\n return this.RGBE_ReadPixels_RLE(uint8array, hdrInfo);\r\n };\r\n HDRTools.RGBE_ReadPixels_RLE = function (uint8array, hdrInfo) {\r\n var num_scanlines = hdrInfo.height;\r\n var scanline_width = hdrInfo.width;\r\n var a, b, c, d, count;\r\n var dataIndex = hdrInfo.dataPosition;\r\n var index = 0, endIndex = 0, i = 0;\r\n var scanLineArrayBuffer = new ArrayBuffer(scanline_width * 4); // four channel R G B E\r\n var scanLineArray = new Uint8Array(scanLineArrayBuffer);\r\n // 3 channels of 4 bytes per pixel in float.\r\n var resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\r\n var resultArray = new Float32Array(resultBuffer);\r\n // read in each successive scanline\r\n while (num_scanlines > 0) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n c = uint8array[dataIndex++];\r\n d = uint8array[dataIndex++];\r\n if (a != 2 || b != 2 || (c & 0x80)) {\r\n // this file is not run length encoded\r\n throw \"HDR Bad header format, not RLE\";\r\n }\r\n if (((c << 8) | d) != scanline_width) {\r\n throw \"HDR Bad header format, wrong scan line width\";\r\n }\r\n index = 0;\r\n // read each of the four channels for the scanline into the buffer\r\n for (i = 0; i < 4; i++) {\r\n endIndex = (i + 1) * scanline_width;\r\n while (index < endIndex) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n if (a > 128) {\r\n // a run of the same value\r\n count = a - 128;\r\n if ((count == 0) || (count > endIndex - index)) {\r\n throw \"HDR Bad Format, bad scanline data (run)\";\r\n }\r\n while (count-- > 0) {\r\n scanLineArray[index++] = b;\r\n }\r\n }\r\n else {\r\n // a non-run\r\n count = a;\r\n if ((count == 0) || (count > endIndex - index)) {\r\n throw \"HDR Bad Format, bad scanline data (non-run)\";\r\n }\r\n scanLineArray[index++] = b;\r\n if (--count > 0) {\r\n for (var j = 0; j < count; j++) {\r\n scanLineArray[index++] = uint8array[dataIndex++];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // now convert data from buffer into floats\r\n for (i = 0; i < scanline_width; i++) {\r\n a = scanLineArray[i];\r\n b = scanLineArray[i + scanline_width];\r\n c = scanLineArray[i + 2 * scanline_width];\r\n d = scanLineArray[i + 3 * scanline_width];\r\n this.Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\r\n }\r\n num_scanlines--;\r\n }\r\n return resultArray;\r\n };\r\n return HDRTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/index.ts\":\n/*!****************************************!*\\\n !*** ./Misc/HighDynamicRange/index.ts ***!\n \\****************************************/\n/*! exports provided: CubeMapToSphericalPolynomialTools, HDRTools, PanoramaToCubeMapTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony import */ var _hdr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hdr */ \"./Misc/HighDynamicRange/hdr.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _hdr__WEBPACK_IMPORTED_MODULE_1__[\"HDRTools\"]; });\n\n/* harmony import */ var _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./panoramaToCubemap */ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_2__[\"PanoramaToCubeMapTools\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\":\n/*!****************************************************!*\\\n !*** ./Misc/HighDynamicRange/panoramaToCubemap.ts ***!\n \\****************************************************/\n/*! exports provided: PanoramaToCubeMapTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return PanoramaToCubeMapTools; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n/**\r\n * Helper class useful to convert panorama picture to their cubemap representation in 6 faces.\r\n */\r\nvar PanoramaToCubeMapTools = /** @class */ (function () {\r\n function PanoramaToCubeMapTools() {\r\n }\r\n /**\r\n * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).\r\n *\r\n * @param float32Array The source data.\r\n * @param inputWidth The width of the input panorama.\r\n * @param inputHeight The height of the input panorama.\r\n * @param size The willing size of the generated cubemap (each faces will be size * size pixels)\r\n * @return The cubemap data\r\n */\r\n PanoramaToCubeMapTools.ConvertPanoramaToCubemap = function (float32Array, inputWidth, inputHeight, size) {\r\n if (!float32Array) {\r\n throw \"ConvertPanoramaToCubemap: input cannot be null\";\r\n }\r\n if (float32Array.length != inputWidth * inputHeight * 3) {\r\n throw \"ConvertPanoramaToCubemap: input size is wrong\";\r\n }\r\n var textureFront = this.CreateCubemapTexture(size, this.FACE_FRONT, float32Array, inputWidth, inputHeight);\r\n var textureBack = this.CreateCubemapTexture(size, this.FACE_BACK, float32Array, inputWidth, inputHeight);\r\n var textureLeft = this.CreateCubemapTexture(size, this.FACE_LEFT, float32Array, inputWidth, inputHeight);\r\n var textureRight = this.CreateCubemapTexture(size, this.FACE_RIGHT, float32Array, inputWidth, inputHeight);\r\n var textureUp = this.CreateCubemapTexture(size, this.FACE_UP, float32Array, inputWidth, inputHeight);\r\n var textureDown = this.CreateCubemapTexture(size, this.FACE_DOWN, float32Array, inputWidth, inputHeight);\r\n return {\r\n front: textureFront,\r\n back: textureBack,\r\n left: textureLeft,\r\n right: textureRight,\r\n up: textureUp,\r\n down: textureDown,\r\n size: size,\r\n type: _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTURETYPE_FLOAT,\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTUREFORMAT_RGB,\r\n gammaSpace: false,\r\n };\r\n };\r\n PanoramaToCubeMapTools.CreateCubemapTexture = function (texSize, faceData, float32Array, inputWidth, inputHeight) {\r\n var buffer = new ArrayBuffer(texSize * texSize * 4 * 3);\r\n var textureArray = new Float32Array(buffer);\r\n var rotDX1 = faceData[1].subtract(faceData[0]).scale(1 / texSize);\r\n var rotDX2 = faceData[3].subtract(faceData[2]).scale(1 / texSize);\r\n var dy = 1 / texSize;\r\n var fy = 0;\r\n for (var y = 0; y < texSize; y++) {\r\n var xv1 = faceData[0];\r\n var xv2 = faceData[2];\r\n for (var x = 0; x < texSize; x++) {\r\n var v = xv2.subtract(xv1).scale(fy).add(xv1);\r\n v.normalize();\r\n var color = this.CalcProjectionSpherical(v, float32Array, inputWidth, inputHeight);\r\n // 3 channels per pixels\r\n textureArray[y * texSize * 3 + (x * 3) + 0] = color.r;\r\n textureArray[y * texSize * 3 + (x * 3) + 1] = color.g;\r\n textureArray[y * texSize * 3 + (x * 3) + 2] = color.b;\r\n xv1 = xv1.add(rotDX1);\r\n xv2 = xv2.add(rotDX2);\r\n }\r\n fy += dy;\r\n }\r\n return textureArray;\r\n };\r\n PanoramaToCubeMapTools.CalcProjectionSpherical = function (vDir, float32Array, inputWidth, inputHeight) {\r\n var theta = Math.atan2(vDir.z, vDir.x);\r\n var phi = Math.acos(vDir.y);\r\n while (theta < -Math.PI) {\r\n theta += 2 * Math.PI;\r\n }\r\n while (theta > Math.PI) {\r\n theta -= 2 * Math.PI;\r\n }\r\n var dx = theta / Math.PI;\r\n var dy = phi / Math.PI;\r\n // recenter.\r\n dx = dx * 0.5 + 0.5;\r\n var px = Math.round(dx * inputWidth);\r\n if (px < 0) {\r\n px = 0;\r\n }\r\n else if (px >= inputWidth) {\r\n px = inputWidth - 1;\r\n }\r\n var py = Math.round(dy * inputHeight);\r\n if (py < 0) {\r\n py = 0;\r\n }\r\n else if (py >= inputHeight) {\r\n py = inputHeight - 1;\r\n }\r\n var inputY = (inputHeight - py - 1);\r\n var r = float32Array[inputY * inputWidth * 3 + (px * 3) + 0];\r\n var g = float32Array[inputY * inputWidth * 3 + (px * 3) + 1];\r\n var b = float32Array[inputY * inputWidth * 3 + (px * 3) + 2];\r\n return {\r\n r: r,\r\n g: g,\r\n b: b\r\n };\r\n };\r\n PanoramaToCubeMapTools.FACE_FRONT = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, -1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_BACK = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, 1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_RIGHT = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, 1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_LEFT = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, -1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_DOWN = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, 1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_UP = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, -1.0)\r\n ];\r\n return PanoramaToCubeMapTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/andOrNotEvaluator.ts\":\n/*!***********************************!*\\\n !*** ./Misc/andOrNotEvaluator.ts ***!\n \\***********************************/\n/*! exports provided: AndOrNotEvaluator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return AndOrNotEvaluator; });\n/**\r\n * Class used to evalaute queries containing `and` and `or` operators\r\n */\r\nvar AndOrNotEvaluator = /** @class */ (function () {\r\n function AndOrNotEvaluator() {\r\n }\r\n /**\r\n * Evaluate a query\r\n * @param query defines the query to evaluate\r\n * @param evaluateCallback defines the callback used to filter result\r\n * @returns true if the query matches\r\n */\r\n AndOrNotEvaluator.Eval = function (query, evaluateCallback) {\r\n if (!query.match(/\\([^\\(\\)]*\\)/g)) {\r\n query = AndOrNotEvaluator._HandleParenthesisContent(query, evaluateCallback);\r\n }\r\n else {\r\n query = query.replace(/\\([^\\(\\)]*\\)/g, function (r) {\r\n // remove parenthesis\r\n r = r.slice(1, r.length - 1);\r\n return AndOrNotEvaluator._HandleParenthesisContent(r, evaluateCallback);\r\n });\r\n }\r\n if (query === \"true\") {\r\n return true;\r\n }\r\n if (query === \"false\") {\r\n return false;\r\n }\r\n return AndOrNotEvaluator.Eval(query, evaluateCallback);\r\n };\r\n AndOrNotEvaluator._HandleParenthesisContent = function (parenthesisContent, evaluateCallback) {\r\n evaluateCallback = evaluateCallback || (function (r) {\r\n return r === \"true\" ? true : false;\r\n });\r\n var result;\r\n var or = parenthesisContent.split(\"||\");\r\n for (var i in or) {\r\n if (or.hasOwnProperty(i)) {\r\n var ori = AndOrNotEvaluator._SimplifyNegation(or[i].trim());\r\n var and = ori.split(\"&&\");\r\n if (and.length > 1) {\r\n for (var j = 0; j < and.length; ++j) {\r\n var andj = AndOrNotEvaluator._SimplifyNegation(and[j].trim());\r\n if (andj !== \"true\" && andj !== \"false\") {\r\n if (andj[0] === \"!\") {\r\n result = !evaluateCallback(andj.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(andj);\r\n }\r\n }\r\n else {\r\n result = andj === \"true\" ? true : false;\r\n }\r\n if (!result) { // no need to continue since 'false && ... && ...' will always return false\r\n ori = \"false\";\r\n break;\r\n }\r\n }\r\n }\r\n if (result || ori === \"true\") { // no need to continue since 'true || ... || ...' will always return true\r\n result = true;\r\n break;\r\n }\r\n // result equals false (or undefined)\r\n if (ori !== \"true\" && ori !== \"false\") {\r\n if (ori[0] === \"!\") {\r\n result = !evaluateCallback(ori.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(ori);\r\n }\r\n }\r\n else {\r\n result = ori === \"true\" ? true : false;\r\n }\r\n }\r\n }\r\n // the whole parenthesis scope is replaced by 'true' or 'false'\r\n return result ? \"true\" : \"false\";\r\n };\r\n AndOrNotEvaluator._SimplifyNegation = function (booleanString) {\r\n booleanString = booleanString.replace(/^[\\s!]+/, function (r) {\r\n // remove whitespaces\r\n r = r.replace(/[\\s]/g, function () { return \"\"; });\r\n return r.length % 2 ? \"!\" : \"\";\r\n });\r\n booleanString = booleanString.trim();\r\n if (booleanString === \"!true\") {\r\n booleanString = \"false\";\r\n }\r\n else if (booleanString === \"!false\") {\r\n booleanString = \"true\";\r\n }\r\n return booleanString;\r\n };\r\n return AndOrNotEvaluator;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/arrayTools.ts\":\n/*!****************************!*\\\n !*** ./Misc/arrayTools.ts ***!\n \\****************************/\n/*! exports provided: ArrayTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArrayTools\", function() { return ArrayTools; });\n/**\r\n * Class containing a set of static utilities functions for arrays.\r\n */\r\nvar ArrayTools = /** @class */ (function () {\r\n function ArrayTools() {\r\n }\r\n /**\r\n * Returns an array of the given size filled with element built from the given constructor and the paramters\r\n * @param size the number of element to construct and put in the array\r\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per array entry.\r\n * @returns a new array filled with new objects\r\n */\r\n ArrayTools.BuildArray = function (size, itemBuilder) {\r\n var a = [];\r\n for (var i = 0; i < size; ++i) {\r\n a.push(itemBuilder());\r\n }\r\n return a;\r\n };\r\n return ArrayTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/assetsManager.ts\":\n/*!*******************************!*\\\n !*** ./Misc/assetsManager.ts ***!\n \\*******************************/\n/*! exports provided: AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return AssetTaskState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return AbstractAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return AssetsProgressEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return MeshAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return TextFileAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return BinaryFileAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return ImageAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return TextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return CubeTextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return HDRCubeTextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return EquiRectangularCubeTextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return AssetsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/hdrCubeTexture */ \"./Materials/Textures/hdrCubeTexture.ts\");\n/* harmony import */ var _Materials_Textures_equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/equiRectangularCubeTexture */ \"./Materials/Textures/equiRectangularCubeTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines the list of states available for a task inside a AssetsManager\r\n */\r\nvar AssetTaskState;\r\n(function (AssetTaskState) {\r\n /**\r\n * Initialization\r\n */\r\n AssetTaskState[AssetTaskState[\"INIT\"] = 0] = \"INIT\";\r\n /**\r\n * Running\r\n */\r\n AssetTaskState[AssetTaskState[\"RUNNING\"] = 1] = \"RUNNING\";\r\n /**\r\n * Done\r\n */\r\n AssetTaskState[AssetTaskState[\"DONE\"] = 2] = \"DONE\";\r\n /**\r\n * Error\r\n */\r\n AssetTaskState[AssetTaskState[\"ERROR\"] = 3] = \"ERROR\";\r\n})(AssetTaskState || (AssetTaskState = {}));\r\n/**\r\n * Define an abstract asset task used with a AssetsManager class to load assets into a scene\r\n */\r\nvar AbstractAssetTask = /** @class */ (function () {\r\n /**\r\n * Creates a new AssetsManager\r\n * @param name defines the name of the task\r\n */\r\n function AbstractAssetTask(\r\n /**\r\n * Task name\r\n */ name) {\r\n this.name = name;\r\n this._isCompleted = false;\r\n this._taskState = AssetTaskState.INIT;\r\n }\r\n Object.defineProperty(AbstractAssetTask.prototype, \"isCompleted\", {\r\n /**\r\n * Get if the task is completed\r\n */\r\n get: function () {\r\n return this._isCompleted;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractAssetTask.prototype, \"taskState\", {\r\n /**\r\n * Gets the current state of the task\r\n */\r\n get: function () {\r\n return this._taskState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractAssetTask.prototype, \"errorObject\", {\r\n /**\r\n * Gets the current error object (if task is in error)\r\n */\r\n get: function () {\r\n return this._errorObject;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n AbstractAssetTask.prototype._setErrorObject = function (message, exception) {\r\n if (this._errorObject) {\r\n return;\r\n }\r\n this._errorObject = {\r\n message: message,\r\n exception: exception\r\n };\r\n };\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n AbstractAssetTask.prototype.run = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n this._taskState = AssetTaskState.RUNNING;\r\n this.runTask(scene, function () {\r\n _this.onDoneCallback(onSuccess, onError);\r\n }, function (msg, exception) {\r\n _this.onErrorCallback(onError, msg, exception);\r\n });\r\n };\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n AbstractAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n throw new Error(\"runTask is not implemented\");\r\n };\r\n /**\r\n * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\r\n * This can be used with failed tasks that have the reason for failure fixed.\r\n */\r\n AbstractAssetTask.prototype.reset = function () {\r\n this._taskState = AssetTaskState.INIT;\r\n };\r\n AbstractAssetTask.prototype.onErrorCallback = function (onError, message, exception) {\r\n this._taskState = AssetTaskState.ERROR;\r\n this._errorObject = {\r\n message: message,\r\n exception: exception\r\n };\r\n if (this.onError) {\r\n this.onError(this, message, exception);\r\n }\r\n onError();\r\n };\r\n AbstractAssetTask.prototype.onDoneCallback = function (onSuccess, onError) {\r\n try {\r\n this._taskState = AssetTaskState.DONE;\r\n this._isCompleted = true;\r\n if (this.onSuccess) {\r\n this.onSuccess(this);\r\n }\r\n onSuccess();\r\n }\r\n catch (e) {\r\n this.onErrorCallback(onError, \"Task is done, error executing success callback(s)\", e);\r\n }\r\n };\r\n return AbstractAssetTask;\r\n}());\r\n\r\n/**\r\n * Class used to share progress information about assets loading\r\n */\r\nvar AssetsProgressEvent = /** @class */ (function () {\r\n /**\r\n * Creates a AssetsProgressEvent\r\n * @param remainingCount defines the number of remaining tasks to process\r\n * @param totalCount defines the total number of tasks\r\n * @param task defines the task that was just processed\r\n */\r\n function AssetsProgressEvent(remainingCount, totalCount, task) {\r\n this.remainingCount = remainingCount;\r\n this.totalCount = totalCount;\r\n this.task = task;\r\n }\r\n return AssetsProgressEvent;\r\n}());\r\n\r\n/**\r\n * Define a task used by AssetsManager to load meshes\r\n */\r\nvar MeshAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MeshAssetTask, _super);\r\n /**\r\n * Creates a new MeshAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename of the scene to load from\r\n */\r\n function MeshAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n meshesNames, \r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n rootUrl, \r\n /**\r\n * Defines the filename of the scene to load from\r\n */\r\n sceneFilename) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.meshesNames = meshesNames;\r\n _this.rootUrl = rootUrl;\r\n _this.sceneFilename = sceneFilename;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__[\"SceneLoader\"].ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups) {\r\n _this.loadedMeshes = meshes;\r\n _this.loadedParticleSystems = particleSystems;\r\n _this.loadedSkeletons = skeletons;\r\n _this.loadedAnimationGroups = animationGroups;\r\n onSuccess();\r\n }, null, function (scene, message, exception) {\r\n onError(message, exception);\r\n });\r\n };\r\n return MeshAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load text content\r\n */\r\nvar TextFileAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextFileAssetTask, _super);\r\n /**\r\n * Creates a new TextFileAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n */\r\n function TextFileAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n TextFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n scene._loadFile(this.url, function (data) {\r\n _this.text = data;\r\n onSuccess();\r\n }, undefined, false, false, function (request, exception) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n });\r\n };\r\n return TextFileAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load binary data\r\n */\r\nvar BinaryFileAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BinaryFileAssetTask, _super);\r\n /**\r\n * Creates a new BinaryFileAssetTask object\r\n * @param name defines the name of the new task\r\n * @param url defines the location of the file to load\r\n */\r\n function BinaryFileAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n BinaryFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n scene._loadFile(this.url, function (data) {\r\n _this.data = data;\r\n onSuccess();\r\n }, undefined, true, true, function (request, exception) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n });\r\n };\r\n return BinaryFileAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load images\r\n */\r\nvar ImageAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageAssetTask, _super);\r\n /**\r\n * Creates a new ImageAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the image to load\r\n */\r\n function ImageAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the image to load\r\n */\r\n url) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n ImageAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n var img = new Image();\r\n _tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(this.url, img);\r\n img.onload = function () {\r\n _this.image = img;\r\n onSuccess();\r\n };\r\n img.onerror = function (err) {\r\n onError(\"Error loading image\", err);\r\n };\r\n img.src = this.url;\r\n };\r\n return ImageAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load 2D textures\r\n */\r\nvar TextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextureAssetTask, _super);\r\n /**\r\n * Creates a new TextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param noMipmap defines if mipmap should not be generated (default is false)\r\n * @param invertY defines if texture must be inverted on Y axis (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n function TextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url, \r\n /**\r\n * Defines if mipmap should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Defines if texture must be inverted on Y axis (default is false)\r\n */\r\n invertY, \r\n /**\r\n * Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n samplingMode) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.noMipmap = noMipmap;\r\n _this.invertY = invertY;\r\n _this.samplingMode = samplingMode;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n TextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"](this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);\r\n };\r\n return TextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load cube textures\r\n */\r\nvar CubeTextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CubeTextureAssetTask, _super);\r\n /**\r\n * Creates a new CubeTextureAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n * @param extensions defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param files defines the explicit list of files (undefined by default)\r\n */\r\n function CubeTextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n */\r\n url, \r\n /**\r\n * Defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n */\r\n extensions, \r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Defines the explicit list of files (undefined by default)\r\n */\r\n files) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.extensions = extensions;\r\n _this.noMipmap = noMipmap;\r\n _this.files = files;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n CubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_5__[\"CubeTexture\"](this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror);\r\n };\r\n return CubeTextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load HDR cube textures\r\n */\r\nvar HDRCubeTextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HDRCubeTextureAssetTask, _super);\r\n /**\r\n * Creates a new HDRCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n */\r\n function HDRCubeTextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url, \r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n size, \r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n */\r\n generateHarmonics, \r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n */\r\n gammaSpace, \r\n /**\r\n * Internal Use Only\r\n */\r\n reserved) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (generateHarmonics === void 0) { generateHarmonics = true; }\r\n if (gammaSpace === void 0) { gammaSpace = false; }\r\n if (reserved === void 0) { reserved = false; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.size = size;\r\n _this.noMipmap = noMipmap;\r\n _this.generateHarmonics = generateHarmonics;\r\n _this.gammaSpace = gammaSpace;\r\n _this.reserved = reserved;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n HDRCubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_6__[\"HDRCubeTexture\"](this.url, scene, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, onload, onerror);\r\n };\r\n return HDRCubeTextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load Equirectangular cube textures\r\n */\r\nvar EquiRectangularCubeTextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](EquiRectangularCubeTextureAssetTask, _super);\r\n /**\r\n * Creates a new EquiRectangularCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be)\r\n * If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param gammaSpace specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * (default is true)\r\n */\r\n function EquiRectangularCubeTextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url, \r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n size, \r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space,\r\n * but the standard material would require them in Gamma space) (default is true)\r\n */\r\n gammaSpace) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (gammaSpace === void 0) { gammaSpace = true; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.size = size;\r\n _this.noMipmap = noMipmap;\r\n _this.gammaSpace = gammaSpace;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n EquiRectangularCubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_7__[\"EquiRectangularCubeTexture\"](this.url, scene, this.size, this.noMipmap, this.gammaSpace, onload, onerror);\r\n };\r\n return EquiRectangularCubeTextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * This class can be used to easily import assets into a scene\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager\r\n */\r\nvar AssetsManager = /** @class */ (function () {\r\n /**\r\n * Creates a new AssetsManager\r\n * @param scene defines the scene to work on\r\n */\r\n function AssetsManager(scene) {\r\n this._isLoading = false;\r\n this._tasks = new Array();\r\n this._waitingTasksCount = 0;\r\n this._totalTasksCount = 0;\r\n /**\r\n * Observable called when all tasks are processed\r\n */\r\n this.onTaskSuccessObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable called when a task had an error\r\n */\r\n this.onTaskErrorObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable called when all tasks were executed\r\n */\r\n this.onTasksDoneObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable called when a task is done (whatever the result is)\r\n */\r\n this.onProgressObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should use the default loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n this.useDefaultLoadingScreen = true;\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen\r\n * when all assets have been downloaded.\r\n * If set to false, you need to manually call in hideLoadingUI() once your scene is ready.\r\n */\r\n this.autoHideLoadingUI = true;\r\n this._scene = scene;\r\n }\r\n /**\r\n * Add a MeshAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file\r\n * @returns a new MeshAssetTask object\r\n */\r\n AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {\r\n var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a TextFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new TextFileAssetTask object\r\n */\r\n AssetsManager.prototype.addTextFileTask = function (taskName, url) {\r\n var task = new TextFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a BinaryFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new BinaryFileAssetTask object\r\n */\r\n AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {\r\n var task = new BinaryFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a ImageAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new ImageAssetTask object\r\n */\r\n AssetsManager.prototype.addImageTask = function (taskName, url) {\r\n var task = new ImageAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a TextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @returns a new TextureAssetTask object\r\n */\r\n AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a CubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param extensions defines the extension to use to load the cube map (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param files defines the list of files to load (can be null)\r\n * @returns a new CubeTextureAssetTask object\r\n */\r\n AssetsManager.prototype.addCubeTextureTask = function (taskName, url, extensions, noMipmap, files) {\r\n var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n *\r\n * Add a HDRCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param generateHarmonics defines if you want to automatically generate (true by default)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n * @returns a new HDRCubeTextureAssetTask object\r\n */\r\n AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (generateHarmonics === void 0) { generateHarmonics = true; }\r\n if (gammaSpace === void 0) { gammaSpace = false; }\r\n if (reserved === void 0) { reserved = false; }\r\n var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n *\r\n * Add a EquiRectangularCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @returns a new EquiRectangularCubeTextureAssetTask object\r\n */\r\n AssetsManager.prototype.addEquiRectangularCubeTextureAssetTask = function (taskName, url, size, noMipmap, gammaSpace) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (gammaSpace === void 0) { gammaSpace = true; }\r\n var task = new EquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap, gammaSpace);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Remove a task from the assets manager.\r\n * @param task the task to remove\r\n */\r\n AssetsManager.prototype.removeTask = function (task) {\r\n var index = this._tasks.indexOf(task);\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n };\r\n AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {\r\n this._waitingTasksCount--;\r\n try {\r\n if (this.onProgress) {\r\n this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);\r\n }\r\n this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Error(\"Error running progress callbacks.\");\r\n console.log(e);\r\n }\r\n if (this._waitingTasksCount === 0) {\r\n try {\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n // Let's remove successfull tasks\r\n var currentTasks = this._tasks.slice();\r\n for (var _i = 0, currentTasks_1 = currentTasks; _i < currentTasks_1.length; _i++) {\r\n var task = currentTasks_1[_i];\r\n if (task.taskState === AssetTaskState.DONE) {\r\n var index = this._tasks.indexOf(task);\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Error(\"Error running tasks-done callbacks.\");\r\n console.log(e);\r\n }\r\n this._isLoading = false;\r\n if (this.autoHideLoadingUI) {\r\n this._scene.getEngine().hideLoadingUI();\r\n }\r\n }\r\n };\r\n AssetsManager.prototype._runTask = function (task) {\r\n var _this = this;\r\n var done = function () {\r\n try {\r\n if (_this.onTaskSuccess) {\r\n _this.onTaskSuccess(task);\r\n }\r\n _this.onTaskSuccessObservable.notifyObservers(task);\r\n _this._decreaseWaitingTasksCount(task);\r\n }\r\n catch (e) {\r\n error(\"Error executing task success callbacks\", e);\r\n }\r\n };\r\n var error = function (message, exception) {\r\n task._setErrorObject(message, exception);\r\n if (_this.onTaskError) {\r\n _this.onTaskError(task);\r\n }\r\n _this.onTaskErrorObservable.notifyObservers(task);\r\n _this._decreaseWaitingTasksCount(task);\r\n };\r\n task.run(this._scene, done, error);\r\n };\r\n /**\r\n * Reset the AssetsManager and remove all tasks\r\n * @return the current instance of the AssetsManager\r\n */\r\n AssetsManager.prototype.reset = function () {\r\n this._isLoading = false;\r\n this._tasks = new Array();\r\n return this;\r\n };\r\n /**\r\n * Start the loading process\r\n * @return the current instance of the AssetsManager\r\n */\r\n AssetsManager.prototype.load = function () {\r\n if (this._isLoading) {\r\n return this;\r\n }\r\n this._isLoading = true;\r\n this._waitingTasksCount = this._tasks.length;\r\n this._totalTasksCount = this._tasks.length;\r\n if (this._waitingTasksCount === 0) {\r\n this._isLoading = false;\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n return this;\r\n }\r\n if (this.useDefaultLoadingScreen) {\r\n this._scene.getEngine().displayLoadingUI();\r\n }\r\n for (var index = 0; index < this._tasks.length; index++) {\r\n var task = this._tasks[index];\r\n if (task.taskState === AssetTaskState.INIT) {\r\n this._runTask(task);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Start the loading process as an async operation\r\n * @return a promise returning the list of failed tasks\r\n */\r\n AssetsManager.prototype.loadAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (_this._isLoading) {\r\n resolve();\r\n return;\r\n }\r\n _this.onTasksDoneObservable.addOnce(function (remainingTasks) {\r\n if (remainingTasks && remainingTasks.length) {\r\n reject(remainingTasks);\r\n }\r\n else {\r\n resolve();\r\n }\r\n });\r\n _this.load();\r\n });\r\n };\r\n return AssetsManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/basis.ts\":\n/*!***********************!*\\\n !*** ./Misc/basis.ts ***!\n \\***********************/\n/*! exports provided: BasisTranscodeConfiguration, BasisTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BasisTranscodeConfiguration\", function() { return BasisTranscodeConfiguration; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BasisTools\", function() { return BasisTools; });\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Info about the .basis files\r\n */\r\nvar BasisFileInfo = /** @class */ (function () {\r\n function BasisFileInfo() {\r\n }\r\n return BasisFileInfo;\r\n}());\r\n/**\r\n * Result of transcoding a basis file\r\n */\r\nvar TranscodeResult = /** @class */ (function () {\r\n function TranscodeResult() {\r\n }\r\n return TranscodeResult;\r\n}());\r\n/**\r\n * Configuration options for the Basis transcoder\r\n */\r\nvar BasisTranscodeConfiguration = /** @class */ (function () {\r\n function BasisTranscodeConfiguration() {\r\n }\r\n return BasisTranscodeConfiguration;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n * Enum of basis transcoder formats\r\n */\r\nvar BASIS_FORMATS;\r\n(function (BASIS_FORMATS) {\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC1\"] = 0] = \"cTFETC1\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC1\"] = 1] = \"cTFBC1\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC4\"] = 2] = \"cTFBC4\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFPVRTC1_4_OPAQUE_ONLY\"] = 3] = \"cTFPVRTC1_4_OPAQUE_ONLY\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC7_M6_OPAQUE_ONLY\"] = 4] = \"cTFBC7_M6_OPAQUE_ONLY\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC2\"] = 5] = \"cTFETC2\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC3\"] = 6] = \"cTFBC3\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC5\"] = 7] = \"cTFBC5\";\r\n})(BASIS_FORMATS || (BASIS_FORMATS = {}));\r\n/**\r\n * Used to load .Basis files\r\n * See https://github.com/BinomialLLC/basis_universal/tree/master/webgl\r\n */\r\nvar BasisTools = /** @class */ (function () {\r\n function BasisTools() {\r\n }\r\n /**\r\n * Get the internal format to be passed to texImage2D corresponding to the .basis format value\r\n * @param basisFormat format chosen from GetSupportedTranscodeFormat\r\n * @returns internal format corresponding to the Basis format\r\n */\r\n BasisTools.GetInternalFormatFromBasisFormat = function (basisFormat) {\r\n // Corrisponding internal formats\r\n var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;\r\n var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;\r\n var RGB_ETC1_Format = 36196;\r\n if (basisFormat === BASIS_FORMATS.cTFETC1) {\r\n return RGB_ETC1_Format;\r\n }\r\n else if (basisFormat === BASIS_FORMATS.cTFBC1) {\r\n return COMPRESSED_RGB_S3TC_DXT1_EXT;\r\n }\r\n else if (basisFormat === BASIS_FORMATS.cTFBC3) {\r\n return COMPRESSED_RGBA_S3TC_DXT5_EXT;\r\n }\r\n else {\r\n throw \"The chosen Basis transcoder format is not currently supported\";\r\n }\r\n };\r\n BasisTools._CreateWorkerAsync = function () {\r\n var _this = this;\r\n if (!this._WorkerPromise) {\r\n this._WorkerPromise = new Promise(function (res) {\r\n if (_this._Worker) {\r\n res(_this._Worker);\r\n }\r\n else {\r\n _tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFileAsync(BasisTools.WasmModuleURL).then(function (wasmBinary) {\r\n var workerBlobUrl = URL.createObjectURL(new Blob([\"(\" + workerFunc + \")()\"], { type: \"application/javascript\" }));\r\n _this._Worker = new Worker(workerBlobUrl);\r\n var initHandler = function (msg) {\r\n if (msg.data.action === \"init\") {\r\n _this._Worker.removeEventListener(\"message\", initHandler);\r\n res(_this._Worker);\r\n }\r\n };\r\n _this._Worker.addEventListener(\"message\", initHandler);\r\n _this._Worker.postMessage({ action: \"init\", url: BasisTools.JSModuleURL, wasmBinary: wasmBinary });\r\n });\r\n }\r\n });\r\n }\r\n return this._WorkerPromise;\r\n };\r\n /**\r\n * Transcodes a loaded image file to compressed pixel data\r\n * @param imageData image data to transcode\r\n * @param config configuration options for the transcoding\r\n * @returns a promise resulting in the transcoded image\r\n */\r\n BasisTools.TranscodeAsync = function (imageData, config) {\r\n var _this = this;\r\n return new Promise(function (res, rej) {\r\n _this._CreateWorkerAsync().then(function () {\r\n var actionId = _this._actionId++;\r\n var messageHandler = function (msg) {\r\n if (msg.data.action === \"transcode\" && msg.data.id === actionId) {\r\n _this._Worker.removeEventListener(\"message\", messageHandler);\r\n if (!msg.data.success) {\r\n rej(\"Transcode is not supported on this device\");\r\n }\r\n else {\r\n res(msg.data);\r\n }\r\n }\r\n };\r\n _this._Worker.addEventListener(\"message\", messageHandler);\r\n _this._Worker.postMessage({ action: \"transcode\", id: actionId, imageData: imageData, config: config, ignoreSupportedFormats: _this._IgnoreSupportedFormats }, [imageData]);\r\n });\r\n });\r\n };\r\n /**\r\n * Loads a texture from the transcode result\r\n * @param texture texture load to\r\n * @param transcodeResult the result of transcoding the basis file to load from\r\n */\r\n BasisTools.LoadTextureFromTranscodeResult = function (texture, transcodeResult) {\r\n var _loop_1 = function () {\r\n rootImage = transcodeResult.fileInfo.images[i].levels[0];\r\n texture._invertVScale = texture.invertY;\r\n if (transcodeResult.format === -1) {\r\n // No compatable compressed format found, fallback to RGB\r\n texture.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURETYPE_UNSIGNED_SHORT_5_6_5;\r\n texture.format = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB;\r\n if (texture.getEngine().webGLVersion < 2 && (_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(rootImage.width) % 1 !== 0 || _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(rootImage.height) % 1 !== 0)) {\r\n // Create non power of two texture\r\n var source_1 = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](texture.getEngine(), _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n texture._invertVScale = texture.invertY;\r\n source_1.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURETYPE_UNSIGNED_SHORT_5_6_5;\r\n source_1.format = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB;\r\n // Fallback requires aligned width/height\r\n source_1.width = (rootImage.width + 3) & ~3;\r\n source_1.height = (rootImage.height + 3) & ~3;\r\n texture.getEngine()._bindTextureDirectly(source_1.getEngine()._gl.TEXTURE_2D, source_1, true);\r\n texture.getEngine()._uploadDataToTextureDirectly(source_1, rootImage.transcodedPixels, i, 0, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB, true);\r\n // Resize to power of two\r\n source_1.getEngine()._rescaleTexture(source_1, texture, texture.getEngine().scenes[0], source_1.getEngine()._getInternalFormat(_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB), function () {\r\n source_1.getEngine()._releaseTexture(source_1);\r\n source_1.getEngine()._bindTextureDirectly(source_1.getEngine()._gl.TEXTURE_2D, texture, true);\r\n });\r\n }\r\n else {\r\n // Fallback is already inverted\r\n texture._invertVScale = !texture.invertY;\r\n // Upload directly\r\n texture.width = (rootImage.width + 3) & ~3;\r\n texture.height = (rootImage.height + 3) & ~3;\r\n texture.getEngine()._uploadDataToTextureDirectly(texture, rootImage.transcodedPixels, i, 0, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB, true);\r\n }\r\n }\r\n else {\r\n texture.width = rootImage.width;\r\n texture.height = rootImage.height;\r\n // Upload all mip levels in the file\r\n transcodeResult.fileInfo.images[i].levels.forEach(function (level, index) {\r\n texture.getEngine()._uploadCompressedDataToTextureDirectly(texture, BasisTools.GetInternalFormatFromBasisFormat(transcodeResult.format), level.width, level.height, level.transcodedPixels, i, index);\r\n });\r\n if (texture.getEngine().webGLVersion < 2 && (_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(texture.width) % 1 !== 0 || _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(texture.height) % 1 !== 0)) {\r\n _tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].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.\");\r\n texture._cachedWrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n }\r\n }\r\n };\r\n var rootImage;\r\n for (var i = 0; i < transcodeResult.fileInfo.images.length; i++) {\r\n _loop_1();\r\n }\r\n };\r\n BasisTools._IgnoreSupportedFormats = false;\r\n /**\r\n * URL to use when loading the basis transcoder\r\n */\r\n BasisTools.JSModuleURL = \"https://preview.babylonjs.com/basisTranscoder/basis_transcoder.js\";\r\n /**\r\n * URL to use when loading the wasm module for the transcoder\r\n */\r\n BasisTools.WasmModuleURL = \"https://preview.babylonjs.com/basisTranscoder/basis_transcoder.wasm\";\r\n BasisTools._WorkerPromise = null;\r\n BasisTools._Worker = null;\r\n BasisTools._actionId = 0;\r\n return BasisTools;\r\n}());\r\n\r\nfunction workerFunc() {\r\n var _BASIS_FORMAT = {\r\n cTFETC1: 0,\r\n cTFBC1: 1,\r\n cTFBC4: 2,\r\n cTFPVRTC1_4_OPAQUE_ONLY: 3,\r\n cTFBC7_M6_OPAQUE_ONLY: 4,\r\n cTFETC2: 5,\r\n cTFBC3: 6,\r\n cTFBC5: 7,\r\n };\r\n var transcoderModulePromise = null;\r\n onmessage = function (event) {\r\n if (event.data.action === \"init\") {\r\n // Load the transcoder if it hasn't been yet\r\n if (!transcoderModulePromise) {\r\n // Override wasm binary\r\n Module = { wasmBinary: (event.data.wasmBinary) };\r\n importScripts(event.data.url);\r\n transcoderModulePromise = new Promise(function (res) {\r\n Module.onRuntimeInitialized = function () {\r\n Module.initializeBasis();\r\n res();\r\n };\r\n });\r\n }\r\n transcoderModulePromise.then(function () {\r\n postMessage({ action: \"init\" });\r\n });\r\n }\r\n else if (event.data.action === \"transcode\") {\r\n // Transcode the basis image and return the resulting pixels\r\n var config = event.data.config;\r\n var imgData = event.data.imageData;\r\n var loadedFile = new Module.BasisFile(new Uint8Array(imgData));\r\n var fileInfo = GetFileInfo(loadedFile);\r\n var format = event.data.ignoreSupportedFormats ? null : GetSupportedTranscodeFormat(event.data.config, fileInfo);\r\n var needsConversion = false;\r\n if (format === null) {\r\n needsConversion = true;\r\n format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFBC3 : _BASIS_FORMAT.cTFBC1;\r\n }\r\n // Begin transcode\r\n var success = true;\r\n if (!loadedFile.startTranscoding()) {\r\n success = false;\r\n }\r\n var buffers = [];\r\n for (var imageIndex = 0; imageIndex < fileInfo.images.length; imageIndex++) {\r\n if (!success) {\r\n break;\r\n }\r\n var image = fileInfo.images[imageIndex];\r\n if (config.loadSingleImage === undefined || config.loadSingleImage === imageIndex) {\r\n var mipCount = image.levels.length;\r\n if (config.loadMipmapLevels === false) {\r\n mipCount = 1;\r\n }\r\n for (var levelIndex = 0; levelIndex < mipCount; levelIndex++) {\r\n var levelInfo = image.levels[levelIndex];\r\n var pixels = TranscodeLevel(loadedFile, imageIndex, levelIndex, format, needsConversion);\r\n if (!pixels) {\r\n success = false;\r\n break;\r\n }\r\n levelInfo.transcodedPixels = pixels;\r\n buffers.push(levelInfo.transcodedPixels.buffer);\r\n }\r\n }\r\n }\r\n // Close file\r\n loadedFile.close();\r\n loadedFile.delete();\r\n if (needsConversion) {\r\n format = -1;\r\n }\r\n if (!success) {\r\n postMessage({ action: \"transcode\", success: success, id: event.data.id });\r\n }\r\n else {\r\n postMessage({ action: \"transcode\", success: success, id: event.data.id, fileInfo: fileInfo, format: format }, buffers);\r\n }\r\n }\r\n };\r\n /**\r\n * Detects the supported transcode format for the file\r\n * @param config transcode config\r\n * @param fileInfo info about the file\r\n * @returns the chosed format or null if none are supported\r\n */\r\n function GetSupportedTranscodeFormat(config, fileInfo) {\r\n var format = null;\r\n if (config.supportedCompressionFormats) {\r\n if (config.supportedCompressionFormats.etc1) {\r\n format = _BASIS_FORMAT.cTFETC1;\r\n }\r\n else if (config.supportedCompressionFormats.s3tc) {\r\n format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFBC3 : _BASIS_FORMAT.cTFBC1;\r\n }\r\n else if (config.supportedCompressionFormats.pvrtc) {\r\n // TODO uncomment this after pvrtc bug is fixed is basis transcoder\r\n // See discussion here: https://github.com/mrdoob/three.js/issues/16524#issuecomment-498929924\r\n // format = _BASIS_FORMAT.cTFPVRTC1_4_OPAQUE_ONLY;\r\n }\r\n else if (config.supportedCompressionFormats.etc2) {\r\n format = _BASIS_FORMAT.cTFETC2;\r\n }\r\n }\r\n return format;\r\n }\r\n /**\r\n * Retreives information about the basis file eg. dimensions\r\n * @param basisFile the basis file to get the info from\r\n * @returns information about the basis file\r\n */\r\n function GetFileInfo(basisFile) {\r\n var hasAlpha = basisFile.getHasAlpha();\r\n var imageCount = basisFile.getNumImages();\r\n var images = [];\r\n for (var i = 0; i < imageCount; i++) {\r\n var imageInfo = {\r\n levels: []\r\n };\r\n var levelCount = basisFile.getNumLevels(i);\r\n for (var level = 0; level < levelCount; level++) {\r\n var levelInfo = {\r\n width: basisFile.getImageWidth(i, level),\r\n height: basisFile.getImageHeight(i, level)\r\n };\r\n imageInfo.levels.push(levelInfo);\r\n }\r\n images.push(imageInfo);\r\n }\r\n var info = { hasAlpha: hasAlpha, images: images };\r\n return info;\r\n }\r\n function TranscodeLevel(loadedFile, imageIndex, levelIndex, format, convertToRgb565) {\r\n var dstSize = loadedFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, format);\r\n var dst = new Uint8Array(dstSize);\r\n if (!loadedFile.transcodeImage(dst, imageIndex, levelIndex, format, 1, 0)) {\r\n return null;\r\n }\r\n // If no supported format is found, load as dxt and convert to rgb565\r\n if (convertToRgb565) {\r\n var alignedWidth = (loadedFile.getImageWidth(imageIndex, levelIndex) + 3) & ~3;\r\n var alignedHeight = (loadedFile.getImageHeight(imageIndex, levelIndex) + 3) & ~3;\r\n dst = ConvertDxtToRgb565(dst, 0, alignedWidth, alignedHeight);\r\n }\r\n return dst;\r\n }\r\n /**\r\n * From https://github.com/BinomialLLC/basis_universal/blob/master/webgl/texture/dxt-to-rgb565.js\r\n * An unoptimized version of dxtToRgb565. Also, the floating\r\n * point math used to compute the colors actually results in\r\n * slightly different colors compared to hardware DXT decoders.\r\n * @param src dxt src pixels\r\n * @param srcByteOffset offset for the start of src\r\n * @param width aligned width of the image\r\n * @param height aligned height of the image\r\n * @return the converted pixels\r\n */\r\n function ConvertDxtToRgb565(src, srcByteOffset, width, height) {\r\n var c = new Uint16Array(4);\r\n var dst = new Uint16Array(width * height);\r\n var blockWidth = width / 4;\r\n var blockHeight = height / 4;\r\n for (var blockY = 0; blockY < blockHeight; blockY++) {\r\n for (var blockX = 0; blockX < blockWidth; blockX++) {\r\n var i = srcByteOffset + 8 * (blockY * blockWidth + blockX);\r\n c[0] = src[i] | (src[i + 1] << 8);\r\n c[1] = src[i + 2] | (src[i + 3] << 8);\r\n c[2] = (2 * (c[0] & 0x1f) + 1 * (c[1] & 0x1f)) / 3\r\n | (((2 * (c[0] & 0x7e0) + 1 * (c[1] & 0x7e0)) / 3) & 0x7e0)\r\n | (((2 * (c[0] & 0xf800) + 1 * (c[1] & 0xf800)) / 3) & 0xf800);\r\n c[3] = (2 * (c[1] & 0x1f) + 1 * (c[0] & 0x1f)) / 3\r\n | (((2 * (c[1] & 0x7e0) + 1 * (c[0] & 0x7e0)) / 3) & 0x7e0)\r\n | (((2 * (c[1] & 0xf800) + 1 * (c[0] & 0xf800)) / 3) & 0xf800);\r\n for (var row = 0; row < 4; row++) {\r\n var m = src[i + 4 + row];\r\n var dstI = (blockY * 4 + row) * width + blockX * 4;\r\n dst[dstI++] = c[m & 0x3];\r\n dst[dstI++] = c[(m >> 2) & 0x3];\r\n dst[dstI++] = c[(m >> 4) & 0x3];\r\n dst[dstI++] = c[(m >> 6) & 0x3];\r\n }\r\n }\r\n }\r\n return dst;\r\n }\r\n}\r\n\n\n/***/ }),\n\n/***/ \"./Misc/brdfTextureTools.ts\":\n/*!**********************************!*\\\n !*** ./Misc/brdfTextureTools.ts ***!\n \\**********************************/\n/*! exports provided: BRDFTextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return BRDFTextureTools; });\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rgbdTextureTools */ \"./Misc/rgbdTextureTools.ts\");\n\r\n\r\n/**\r\n * Class used to host texture specific utilities\r\n */\r\nvar BRDFTextureTools = /** @class */ (function () {\r\n function BRDFTextureTools() {\r\n }\r\n /**\r\n * Gets a default environment BRDF for MS-BRDF Height Correlated BRDF\r\n * @param scene defines the hosting scene\r\n * @returns the environment BRDF texture\r\n */\r\n BRDFTextureTools.GetEnvironmentBRDFTexture = function (scene) {\r\n if (!scene.environmentBRDFTexture) {\r\n // Forces Delayed Texture Loading to prevent undefined error whilst setting RGBD values.\r\n var useDelayedTextureLoading = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n var texture = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CreateFromBase64String(this._environmentBRDFBase64Texture, \"EnvironmentBRDFTexture\", scene, true, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n texture.isRGBD = true;\r\n texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n scene.environmentBRDFTexture = texture;\r\n scene.useDelayedTextureLoading = useDelayedTextureLoading;\r\n _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_1__[\"RGBDTextureTools\"].ExpandRGBDTexture(texture);\r\n }\r\n return scene.environmentBRDFTexture;\r\n };\r\n BRDFTextureTools._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==\";\r\n return BRDFTextureTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/dds.ts\":\n/*!*********************!*\\\n !*** ./Misc/dds.ts ***!\n \\*********************/\n/*! exports provided: DDSTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return DDSTools; });\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/HighDynamicRange/cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_Extensions_engine_cubeTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Engines/Extensions/engine.cubeTexture */ \"./Engines/Extensions/engine.cubeTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html\r\n// All values and structures referenced from:\r\n// http://msdn.microsoft.com/en-us/library/bb943991.aspx/\r\nvar DDS_MAGIC = 0x20534444;\r\nvar \r\n//DDSD_CAPS = 0x1,\r\n//DDSD_HEIGHT = 0x2,\r\n//DDSD_WIDTH = 0x4,\r\n//DDSD_PITCH = 0x8,\r\n//DDSD_PIXELFORMAT = 0x1000,\r\nDDSD_MIPMAPCOUNT = 0x20000;\r\n//DDSD_LINEARSIZE = 0x80000,\r\n//DDSD_DEPTH = 0x800000;\r\n// var DDSCAPS_COMPLEX = 0x8,\r\n// DDSCAPS_MIPMAP = 0x400000,\r\n// DDSCAPS_TEXTURE = 0x1000;\r\nvar DDSCAPS2_CUBEMAP = 0x200;\r\n// DDSCAPS2_CUBEMAP_POSITIVEX = 0x400,\r\n// DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800,\r\n// DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000,\r\n// DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000,\r\n// DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000,\r\n// DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000,\r\n// DDSCAPS2_VOLUME = 0x200000;\r\nvar \r\n//DDPF_ALPHAPIXELS = 0x1,\r\n//DDPF_ALPHA = 0x2,\r\nDDPF_FOURCC = 0x4, DDPF_RGB = 0x40, \r\n//DDPF_YUV = 0x200,\r\nDDPF_LUMINANCE = 0x20000;\r\nfunction FourCCToInt32(value) {\r\n return value.charCodeAt(0) +\r\n (value.charCodeAt(1) << 8) +\r\n (value.charCodeAt(2) << 16) +\r\n (value.charCodeAt(3) << 24);\r\n}\r\nfunction Int32ToFourCC(value) {\r\n return String.fromCharCode(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, (value >> 24) & 0xff);\r\n}\r\nvar FOURCC_DXT1 = FourCCToInt32(\"DXT1\");\r\nvar FOURCC_DXT3 = FourCCToInt32(\"DXT3\");\r\nvar FOURCC_DXT5 = FourCCToInt32(\"DXT5\");\r\nvar FOURCC_DX10 = FourCCToInt32(\"DX10\");\r\nvar FOURCC_D3DFMT_R16G16B16A16F = 113;\r\nvar FOURCC_D3DFMT_R32G32B32A32F = 116;\r\nvar DXGI_FORMAT_R32G32B32A32_FLOAT = 2;\r\nvar DXGI_FORMAT_R16G16B16A16_FLOAT = 10;\r\nvar DXGI_FORMAT_B8G8R8X8_UNORM = 88;\r\nvar headerLengthInt = 31; // The header length in 32 bit ints\r\n// Offsets into the header array\r\nvar off_magic = 0;\r\nvar off_size = 1;\r\nvar off_flags = 2;\r\nvar off_height = 3;\r\nvar off_width = 4;\r\nvar off_mipmapCount = 7;\r\nvar off_pfFlags = 20;\r\nvar off_pfFourCC = 21;\r\nvar off_RGBbpp = 22;\r\nvar off_RMask = 23;\r\nvar off_GMask = 24;\r\nvar off_BMask = 25;\r\nvar off_AMask = 26;\r\n// var off_caps1 = 27;\r\nvar off_caps2 = 28;\r\n// var off_caps3 = 29;\r\n// var off_caps4 = 30;\r\nvar off_dxgiFormat = 32;\r\n/**\r\n * Class used to provide DDS decompression tools\r\n */\r\nvar DDSTools = /** @class */ (function () {\r\n function DDSTools() {\r\n }\r\n /**\r\n * Gets DDS information from an array buffer\r\n * @param arrayBuffer defines the array buffer to read data from\r\n * @returns the DDS information\r\n */\r\n DDSTools.GetDDSInfo = function (arrayBuffer) {\r\n var header = new Int32Array(arrayBuffer, 0, headerLengthInt);\r\n var extendedHeader = new Int32Array(arrayBuffer, 0, headerLengthInt + 4);\r\n var mipmapCount = 1;\r\n if (header[off_flags] & DDSD_MIPMAPCOUNT) {\r\n mipmapCount = Math.max(1, header[off_mipmapCount]);\r\n }\r\n var fourCC = header[off_pfFourCC];\r\n var dxgiFormat = (fourCC === FOURCC_DX10) ? extendedHeader[off_dxgiFormat] : 0;\r\n var textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n switch (fourCC) {\r\n case FOURCC_D3DFMT_R16G16B16A16F:\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n break;\r\n case FOURCC_D3DFMT_R32G32B32A32F:\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n break;\r\n case FOURCC_DX10:\r\n if (dxgiFormat === DXGI_FORMAT_R16G16B16A16_FLOAT) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n break;\r\n }\r\n if (dxgiFormat === DXGI_FORMAT_R32G32B32A32_FLOAT) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n break;\r\n }\r\n }\r\n return {\r\n width: header[off_width],\r\n height: header[off_height],\r\n mipmapCount: mipmapCount,\r\n isFourCC: (header[off_pfFlags] & DDPF_FOURCC) === DDPF_FOURCC,\r\n isRGB: (header[off_pfFlags] & DDPF_RGB) === DDPF_RGB,\r\n isLuminance: (header[off_pfFlags] & DDPF_LUMINANCE) === DDPF_LUMINANCE,\r\n isCube: (header[off_caps2] & DDSCAPS2_CUBEMAP) === DDSCAPS2_CUBEMAP,\r\n isCompressed: (fourCC === FOURCC_DXT1 || fourCC === FOURCC_DXT3 || fourCC === FOURCC_DXT5),\r\n dxgiFormat: dxgiFormat,\r\n textureType: textureType\r\n };\r\n };\r\n DDSTools._ToHalfFloat = function (value) {\r\n if (!DDSTools._FloatView) {\r\n DDSTools._FloatView = new Float32Array(1);\r\n DDSTools._Int32View = new Int32Array(DDSTools._FloatView.buffer);\r\n }\r\n DDSTools._FloatView[0] = value;\r\n var x = DDSTools._Int32View[0];\r\n var bits = (x >> 16) & 0x8000; /* Get the sign */\r\n var m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */\r\n var e = (x >> 23) & 0xff; /* Using int is faster here */\r\n /* If zero, or denormal, or exponent underflows too much for a denormal\r\n * half, return signed zero. */\r\n if (e < 103) {\r\n return bits;\r\n }\r\n /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */\r\n if (e > 142) {\r\n bits |= 0x7c00;\r\n /* If exponent was 0xff and one mantissa bit was set, it means NaN,\r\n * not Inf, so make sure we set one mantissa bit too. */\r\n bits |= ((e == 255) ? 0 : 1) && (x & 0x007fffff);\r\n return bits;\r\n }\r\n /* If exponent underflows but not too much, return a denormal */\r\n if (e < 113) {\r\n m |= 0x0800;\r\n /* Extra rounding may overflow and set mantissa to 0 and exponent\r\n * to 1, which is OK. */\r\n bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1);\r\n return bits;\r\n }\r\n bits |= ((e - 112) << 10) | (m >> 1);\r\n bits += m & 1;\r\n return bits;\r\n };\r\n DDSTools._FromHalfFloat = function (value) {\r\n var s = (value & 0x8000) >> 15;\r\n var e = (value & 0x7C00) >> 10;\r\n var f = value & 0x03FF;\r\n if (e === 0) {\r\n return (s ? -1 : 1) * Math.pow(2, -14) * (f / Math.pow(2, 10));\r\n }\r\n else if (e == 0x1F) {\r\n return f ? NaN : ((s ? -1 : 1) * Infinity);\r\n }\r\n return (s ? -1 : 1) * Math.pow(2, e - 15) * (1 + (f / Math.pow(2, 10)));\r\n };\r\n DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n var destArray = new Float32Array(dataLength);\r\n var srcData = new Uint16Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = DDSTools._FromHalfFloat(srcData[srcPos]);\r\n destArray[index + 1] = DDSTools._FromHalfFloat(srcData[srcPos + 1]);\r\n destArray[index + 2] = DDSTools._FromHalfFloat(srcData[srcPos + 2]);\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n destArray[index + 3] = lod;\r\n }\r\n else {\r\n destArray[index + 3] = DDSTools._FromHalfFloat(srcData[srcPos + 3]);\r\n }\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n };\r\n DDSTools._GetHalfFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n var destArray = new Uint16Array(dataLength);\r\n var srcData = new Uint16Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = srcData[srcPos];\r\n destArray[index + 1] = srcData[srcPos + 1];\r\n destArray[index + 2] = srcData[srcPos + 2];\r\n destArray[index + 3] = DDSTools._ToHalfFloat(lod);\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n }\r\n return new Uint16Array(arrayBuffer, dataOffset, dataLength);\r\n };\r\n DDSTools._GetFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n var destArray = new Float32Array(dataLength);\r\n var srcData = new Float32Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = srcData[srcPos];\r\n destArray[index + 1] = srcData[srcPos + 1];\r\n destArray[index + 2] = srcData[srcPos + 2];\r\n destArray[index + 3] = lod;\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n }\r\n return new Float32Array(arrayBuffer, dataOffset, dataLength);\r\n };\r\n DDSTools._GetFloatAsUIntRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n var destArray = new Uint8Array(dataLength);\r\n var srcData = new Float32Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos]) * 255;\r\n destArray[index + 1] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos + 1]) * 255;\r\n destArray[index + 2] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos + 2]) * 255;\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n destArray[index + 3] = lod;\r\n }\r\n else {\r\n destArray[index + 3] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos + 3]) * 255;\r\n }\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n };\r\n DDSTools._GetHalfFloatAsUIntRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n var destArray = new Uint8Array(dataLength);\r\n var srcData = new Uint16Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos])) * 255;\r\n destArray[index + 1] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 1])) * 255;\r\n destArray[index + 2] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 2])) * 255;\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n destArray[index + 3] = lod;\r\n }\r\n else {\r\n destArray[index + 3] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 3])) * 255;\r\n }\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n };\r\n DDSTools._GetRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset) {\r\n var byteArray = new Uint8Array(dataLength);\r\n var srcData = new Uint8Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n byteArray[index] = srcData[srcPos + rOffset];\r\n byteArray[index + 1] = srcData[srcPos + gOffset];\r\n byteArray[index + 2] = srcData[srcPos + bOffset];\r\n byteArray[index + 3] = srcData[srcPos + aOffset];\r\n index += 4;\r\n }\r\n }\r\n return byteArray;\r\n };\r\n DDSTools._ExtractLongWordOrder = function (value) {\r\n if (value === 0 || value === 255 || value === -16777216) {\r\n return 0;\r\n }\r\n return 1 + DDSTools._ExtractLongWordOrder(value >> 8);\r\n };\r\n DDSTools._GetRGBArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset) {\r\n var byteArray = new Uint8Array(dataLength);\r\n var srcData = new Uint8Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 3;\r\n byteArray[index] = srcData[srcPos + rOffset];\r\n byteArray[index + 1] = srcData[srcPos + gOffset];\r\n byteArray[index + 2] = srcData[srcPos + bOffset];\r\n index += 3;\r\n }\r\n }\r\n return byteArray;\r\n };\r\n DDSTools._GetLuminanceArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {\r\n var byteArray = new Uint8Array(dataLength);\r\n var srcData = new Uint8Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width);\r\n byteArray[index] = srcData[srcPos];\r\n index++;\r\n }\r\n }\r\n return byteArray;\r\n };\r\n /**\r\n * Uploads DDS Levels to a Babylon Texture\r\n * @hidden\r\n */\r\n DDSTools.UploadDDSLevels = function (engine, texture, arrayBuffer, info, loadMipmaps, faces, lodIndex, currentFace) {\r\n if (lodIndex === void 0) { lodIndex = -1; }\r\n var sphericalPolynomialFaces = null;\r\n if (info.sphericalPolynomial) {\r\n sphericalPolynomialFaces = new Array();\r\n }\r\n var ext = engine.getCaps().s3tc;\r\n var header = new Int32Array(arrayBuffer, 0, headerLengthInt);\r\n var fourCC, width, height, dataLength = 0, dataOffset;\r\n var byteArray, mipmapCount, mip;\r\n var internalCompressedFormat = 0;\r\n var blockBytes = 1;\r\n if (header[off_magic] !== DDS_MAGIC) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Error(\"Invalid magic number in DDS header\");\r\n return;\r\n }\r\n if (!info.isFourCC && !info.isRGB && !info.isLuminance) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Error(\"Unsupported format, must contain a FourCC, RGB or LUMINANCE code\");\r\n return;\r\n }\r\n if (info.isCompressed && !ext) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Error(\"Compressed textures are not supported on this platform.\");\r\n return;\r\n }\r\n var bpp = header[off_RGBbpp];\r\n dataOffset = header[off_size] + 4;\r\n var computeFormats = false;\r\n if (info.isFourCC) {\r\n fourCC = header[off_pfFourCC];\r\n switch (fourCC) {\r\n case FOURCC_DXT1:\r\n blockBytes = 8;\r\n internalCompressedFormat = ext.COMPRESSED_RGBA_S3TC_DXT1_EXT;\r\n break;\r\n case FOURCC_DXT3:\r\n blockBytes = 16;\r\n internalCompressedFormat = ext.COMPRESSED_RGBA_S3TC_DXT3_EXT;\r\n break;\r\n case FOURCC_DXT5:\r\n blockBytes = 16;\r\n internalCompressedFormat = ext.COMPRESSED_RGBA_S3TC_DXT5_EXT;\r\n break;\r\n case FOURCC_D3DFMT_R16G16B16A16F:\r\n computeFormats = true;\r\n break;\r\n case FOURCC_D3DFMT_R32G32B32A32F:\r\n computeFormats = true;\r\n break;\r\n case FOURCC_DX10:\r\n // There is an additionnal header so dataOffset need to be changed\r\n dataOffset += 5 * 4; // 5 uints\r\n var supported = false;\r\n switch (info.dxgiFormat) {\r\n case DXGI_FORMAT_R16G16B16A16_FLOAT:\r\n case DXGI_FORMAT_R32G32B32A32_FLOAT:\r\n computeFormats = true;\r\n supported = true;\r\n break;\r\n case DXGI_FORMAT_B8G8R8X8_UNORM:\r\n info.isRGB = true;\r\n info.isFourCC = false;\r\n bpp = 32;\r\n supported = true;\r\n break;\r\n }\r\n if (supported) {\r\n break;\r\n }\r\n default:\r\n console.error(\"Unsupported FourCC code:\", Int32ToFourCC(fourCC));\r\n return;\r\n }\r\n }\r\n var rOffset = DDSTools._ExtractLongWordOrder(header[off_RMask]);\r\n var gOffset = DDSTools._ExtractLongWordOrder(header[off_GMask]);\r\n var bOffset = DDSTools._ExtractLongWordOrder(header[off_BMask]);\r\n var aOffset = DDSTools._ExtractLongWordOrder(header[off_AMask]);\r\n if (computeFormats) {\r\n internalCompressedFormat = engine._getRGBABufferInternalSizedFormat(info.textureType);\r\n }\r\n mipmapCount = 1;\r\n if (header[off_flags] & DDSD_MIPMAPCOUNT && loadMipmaps !== false) {\r\n mipmapCount = Math.max(1, header[off_mipmapCount]);\r\n }\r\n var startFace = currentFace || 0;\r\n for (var face = startFace; face < faces; face++) {\r\n width = header[off_width];\r\n height = header[off_height];\r\n for (mip = 0; mip < mipmapCount; ++mip) {\r\n if (lodIndex === -1 || lodIndex === mip) {\r\n // In case of fixed LOD, if the lod has just been uploaded, early exit.\r\n var i = (lodIndex === -1) ? mip : 0;\r\n if (!info.isCompressed && info.isFourCC) {\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n dataLength = width * height * 4;\r\n var floatArray = null;\r\n if (engine._badOS || engine._badDesktopOS || (!engine.getCaps().textureHalfFloat && !engine.getCaps().textureFloat)) { // Required because iOS has many issues with float and half float generation\r\n if (bpp === 128) {\r\n floatArray = DDSTools._GetFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));\r\n }\r\n }\r\n else if (bpp === 64) {\r\n floatArray = DDSTools._GetHalfFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));\r\n }\r\n }\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n else {\r\n if (bpp === 128) {\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n floatArray = DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(floatArray);\r\n }\r\n }\r\n else if (bpp === 64 && !engine.getCaps().textureHalfFloat) {\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n floatArray = DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(floatArray);\r\n }\r\n }\r\n else { // 64\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n floatArray = DDSTools._GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));\r\n }\r\n }\r\n }\r\n if (floatArray) {\r\n engine._uploadDataToTextureDirectly(texture, floatArray, face, i);\r\n }\r\n }\r\n else if (info.isRGB) {\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n if (bpp === 24) {\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGB;\r\n dataLength = width * height * 3;\r\n byteArray = DDSTools._GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset);\r\n engine._uploadDataToTextureDirectly(texture, byteArray, face, i);\r\n }\r\n else { // 32\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n dataLength = width * height * 4;\r\n byteArray = DDSTools._GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset);\r\n engine._uploadDataToTextureDirectly(texture, byteArray, face, i);\r\n }\r\n }\r\n else if (info.isLuminance) {\r\n var unpackAlignment = engine._getUnpackAlignement();\r\n var unpaddedRowSize = width;\r\n var paddedRowSize = Math.floor((width + unpackAlignment - 1) / unpackAlignment) * unpackAlignment;\r\n dataLength = paddedRowSize * (height - 1) + unpaddedRowSize;\r\n byteArray = DDSTools._GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_LUMINANCE;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n engine._uploadDataToTextureDirectly(texture, byteArray, face, i);\r\n }\r\n else {\r\n dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;\r\n byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n engine._uploadCompressedDataToTextureDirectly(texture, internalCompressedFormat, width, height, byteArray, face, i);\r\n }\r\n }\r\n dataOffset += bpp ? (width * height * (bpp / 8)) : dataLength;\r\n width *= 0.5;\r\n height *= 0.5;\r\n width = Math.max(1.0, width);\r\n height = Math.max(1.0, height);\r\n }\r\n if (currentFace !== undefined) {\r\n // Loading a single face\r\n break;\r\n }\r\n }\r\n if (sphericalPolynomialFaces && sphericalPolynomialFaces.length > 0) {\r\n info.sphericalPolynomial = _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_6__[\"CubeMapToSphericalPolynomialTools\"].ConvertCubeMapToSphericalPolynomial({\r\n size: header[off_width],\r\n right: sphericalPolynomialFaces[0],\r\n left: sphericalPolynomialFaces[1],\r\n up: sphericalPolynomialFaces[2],\r\n down: sphericalPolynomialFaces[3],\r\n front: sphericalPolynomialFaces[4],\r\n back: sphericalPolynomialFaces[5],\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA,\r\n type: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT,\r\n gammaSpace: false,\r\n });\r\n }\r\n else {\r\n info.sphericalPolynomial = undefined;\r\n }\r\n };\r\n /**\r\n * Gets or sets a boolean indicating that LOD info is stored in alpha channel (false by default)\r\n */\r\n DDSTools.StoreLODInAlphaChannel = false;\r\n return DDSTools;\r\n}());\r\n\r\n/**\r\n * Create a cube texture from prefiltered data (ie. the mipmaps contain ready to use data for PBR reflection)\r\n * @param rootUrl defines the url where the file to load is located\r\n * @param scene defines the current scene\r\n * @param lodScale defines scale to apply to the mip map selection\r\n * @param lodOffset defines offset to apply to the mip map selection\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].prototype.createPrefilteredCubeTexture = function (rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, createPolynomials) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = true; }\r\n var callback = function (loadData) {\r\n if (!loadData) {\r\n if (onLoad) {\r\n onLoad(null);\r\n }\r\n return;\r\n }\r\n var texture = loadData.texture;\r\n if (!createPolynomials) {\r\n texture._sphericalPolynomial = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_1__[\"SphericalPolynomial\"]();\r\n }\r\n else if (loadData.info.sphericalPolynomial) {\r\n texture._sphericalPolynomial = loadData.info.sphericalPolynomial;\r\n }\r\n texture._dataSource = _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_CUBEPREFILTERED;\r\n if (_this.getCaps().textureLOD) {\r\n // Do not add extra process if texture lod is supported.\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n return;\r\n }\r\n var mipSlices = 3;\r\n var gl = _this._gl;\r\n var width = loadData.width;\r\n if (!width) {\r\n return;\r\n }\r\n var textures = [];\r\n for (var i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n var smoothness = i / (mipSlices - 1);\r\n var roughness = 1 - smoothness;\r\n var minLODIndex = lodOffset; // roughness = 0\r\n var maxLODIndex = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Log2(width) * lodScale + lodOffset; // roughness = 1\r\n var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n var mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n var glTextureFromLod = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](_this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n glTextureFromLod.type = texture.type;\r\n glTextureFromLod.format = texture.format;\r\n glTextureFromLod.width = Math.pow(2, Math.max(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Log2(width) - mipmapIndex, 0));\r\n glTextureFromLod.height = glTextureFromLod.width;\r\n glTextureFromLod.isCube = true;\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, glTextureFromLod, true);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n if (loadData.isDDS) {\r\n var info = loadData.info;\r\n var data = loadData.data;\r\n _this._unpackFlipY(info.isCompressed);\r\n DDSTools.UploadDDSLevels(_this, glTextureFromLod, data, info, true, 6, mipmapIndex);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Warn(\"DDS is the only prefiltered cube map supported so far.\");\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n // Wrap in a base texture for easy binding.\r\n var lodTexture = new _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_7__[\"BaseTexture\"](scene);\r\n lodTexture.isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n glTextureFromLod.isReady = true;\r\n textures.push(lodTexture);\r\n }\r\n texture._lodTextureHigh = textures[2];\r\n texture._lodTextureMid = textures[1];\r\n texture._lodTextureLow = textures[0];\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n };\r\n return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Misc/decorators.ts\":\n/*!****************************!*\\\n !*** ./Misc/decorators.ts ***!\n \\****************************/\n/*! exports provided: expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return expandToProperty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return serialize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return serializeAsTexture; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return serializeAsColor3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return serializeAsFresnelParameters; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return serializeAsVector2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return serializeAsVector3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return serializeAsMeshReference; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return serializeAsColorCurves; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return serializeAsColor4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return serializeAsImageProcessingConfiguration; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return serializeAsQuaternion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return serializeAsMatrix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return serializeAsCameraReference; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return SerializationHelper; });\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _devTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\nvar __decoratorInitialStore = {};\r\nvar __mergedStore = {};\r\nvar _copySource = function (creationFunction, source, instanciate) {\r\n var destination = creationFunction();\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"].AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 11: // Camera reference\r\n destination[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n destination[property] = (instanciate || sourceProperty.isRenderTarget) ? sourceProperty : sourceProperty.clone();\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n destination[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n};\r\nfunction getDirectStore(target) {\r\n var classKey = target.getClassName();\r\n if (!__decoratorInitialStore[classKey]) {\r\n __decoratorInitialStore[classKey] = {};\r\n }\r\n return __decoratorInitialStore[classKey];\r\n}\r\n/**\r\n * Return the list of properties flagged as serializable\r\n * @param target: host object\r\n */\r\nfunction getMergedStore(target) {\r\n var classKey = target.getClassName();\r\n if (__mergedStore[classKey]) {\r\n return __mergedStore[classKey];\r\n }\r\n __mergedStore[classKey] = {};\r\n var store = __mergedStore[classKey];\r\n var currentTarget = target;\r\n var currentKey = classKey;\r\n while (currentKey) {\r\n var initialStore = __decoratorInitialStore[currentKey];\r\n for (var property in initialStore) {\r\n store[property] = initialStore[property];\r\n }\r\n var parent_1 = void 0;\r\n var done = false;\r\n do {\r\n parent_1 = Object.getPrototypeOf(currentTarget);\r\n if (!parent_1.getClassName) {\r\n done = true;\r\n break;\r\n }\r\n if (parent_1.getClassName() !== currentKey) {\r\n break;\r\n }\r\n currentTarget = parent_1;\r\n } while (parent_1);\r\n if (done) {\r\n break;\r\n }\r\n currentKey = parent_1.getClassName();\r\n currentTarget = parent_1;\r\n }\r\n return store;\r\n}\r\nfunction generateSerializableMember(type, sourceName) {\r\n return function (target, propertyKey) {\r\n var classStore = getDirectStore(target);\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\nfunction generateExpandMember(setCallback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return function (target, propertyKey) {\r\n var key = targetKey || (\"_\" + propertyKey);\r\n Object.defineProperty(target, propertyKey, {\r\n get: function () {\r\n return this[key];\r\n },\r\n set: function (value) {\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n };\r\n}\r\nfunction expandToProperty(callback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return generateExpandMember(callback, targetKey);\r\n}\r\nfunction serialize(sourceName) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\nfunction serializeAsTexture(sourceName) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\nfunction serializeAsColor3(sourceName) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\nfunction serializeAsFresnelParameters(sourceName) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\nfunction serializeAsVector2(sourceName) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\nfunction serializeAsVector3(sourceName) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\nfunction serializeAsMeshReference(sourceName) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\nfunction serializeAsColorCurves(sourceName) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\nfunction serializeAsColor4(sourceName) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\nfunction serializeAsImageProcessingConfiguration(sourceName) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\nfunction serializeAsQuaternion(sourceName) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\nfunction serializeAsMatrix(sourceName) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n */\r\nfunction serializeAsCameraReference(sourceName) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\r\n}\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nvar SerializationHelper = /** @class */ (function () {\r\n function SerializationHelper() {\r\n }\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n SerializationHelper.AppendSerializedAnimations = function (source, destination) {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (var animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n var animation = source.animations[animationIndex];\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target obecjt where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n SerializationHelper.Serialize = function (entity, serializationObject) {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"].GetTags(entity);\r\n }\r\n var serializedProperties = getMergedStore(entity);\r\n // Properties\r\n for (var property in serializedProperties) {\r\n var propertyDescriptor = serializedProperties[property];\r\n var targetPropertyName = propertyDescriptor.sourceName || property;\r\n var propertyType = propertyDescriptor.type;\r\n var sourceProperty = entity[property];\r\n if (sourceProperty !== undefined && sourceProperty !== null) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n SerializationHelper.Parse = function (creationFunction, source, scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = null; }\r\n var destination = creationFunction();\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"].AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[propertyDescriptor.sourceName || property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null) {\r\n var dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshByID(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"].FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraByID(sourceProperty);\r\n }\r\n case 12: // Matrix\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n };\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the cloned object\r\n */\r\n SerializationHelper.Clone = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, false);\r\n };\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n SerializationHelper.Instanciate = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, true);\r\n };\r\n /** @hidden */\r\n SerializationHelper._ImageProcessingConfigurationParser = function (sourceProperty) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._FresnelParametersParser = function (sourceProperty) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"FresnelParameters\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._ColorCurvesParser = function (sourceProperty) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"ColorCurves\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._TextureParser = function (sourceProperty, scene, rootUrl) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"Texture\");\r\n };\r\n return SerializationHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/deepCopier.ts\":\n/*!****************************!*\\\n !*** ./Misc/deepCopier.ts ***!\n \\****************************/\n/*! exports provided: DeepCopier */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return DeepCopier; });\nvar cloneValue = function (source, destinationObject) {\r\n if (!source) {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"Mesh\") {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"SubMesh\") {\r\n return source.clone(destinationObject);\r\n }\r\n else if (source.clone) {\r\n return source.clone();\r\n }\r\n return null;\r\n};\r\n/**\r\n * Class containing a set of static utilities functions for deep copy.\r\n */\r\nvar DeepCopier = /** @class */ (function () {\r\n function DeepCopier() {\r\n }\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n DeepCopier.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n for (var prop in source) {\r\n if (prop[0] === \"_\" && (!mustCopyList || mustCopyList.indexOf(prop) === -1)) {\r\n continue;\r\n }\r\n if (doNotCopyList && doNotCopyList.indexOf(prop) !== -1) {\r\n continue;\r\n }\r\n var sourceValue = source[prop];\r\n var typeOfSourceValue = typeof sourceValue;\r\n if (typeOfSourceValue === \"function\") {\r\n continue;\r\n }\r\n try {\r\n if (typeOfSourceValue === \"object\") {\r\n if (sourceValue instanceof Array) {\r\n destination[prop] = [];\r\n if (sourceValue.length > 0) {\r\n if (typeof sourceValue[0] == \"object\") {\r\n for (var index = 0; index < sourceValue.length; index++) {\r\n var clonedValue = cloneValue(sourceValue[index], destination);\r\n if (destination[prop].indexOf(clonedValue) === -1) { // Test if auto inject was not done\r\n destination[prop].push(clonedValue);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue.slice(0);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = cloneValue(sourceValue, destination);\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue;\r\n }\r\n }\r\n catch (e) {\r\n // Just ignore error (it could be because of a read-only property)\r\n }\r\n }\r\n };\r\n return DeepCopier;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/deferred.ts\":\n/*!**************************!*\\\n !*** ./Misc/deferred.ts ***!\n \\**************************/\n/*! exports provided: Deferred */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return Deferred; });\n/**\r\n * Wrapper class for promise with external resolve and reject.\r\n */\r\nvar Deferred = /** @class */ (function () {\r\n /**\r\n * Constructor for this deferred object.\r\n */\r\n function Deferred() {\r\n var _this = this;\r\n this.promise = new Promise(function (resolve, reject) {\r\n _this._resolve = resolve;\r\n _this._reject = reject;\r\n });\r\n }\r\n Object.defineProperty(Deferred.prototype, \"resolve\", {\r\n /**\r\n * The resolve method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._resolve;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Deferred.prototype, \"reject\", {\r\n /**\r\n * The reject method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._reject;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Deferred;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/devTools.ts\":\n/*!**************************!*\\\n !*** ./Misc/devTools.ts ***!\n \\**************************/\n/*! exports provided: _DevTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_DevTools\", function() { return _DevTools; });\n/** @hidden */\r\nvar _DevTools = /** @class */ (function () {\r\n function _DevTools() {\r\n }\r\n _DevTools.WarnImport = function (name) {\r\n return name + \" needs to be imported before as it contains a side-effect required by your code.\";\r\n };\r\n return _DevTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/domManagement.ts\":\n/*!*******************************!*\\\n !*** ./Misc/domManagement.ts ***!\n \\*******************************/\n/*! exports provided: DomManagement */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DomManagement\", function() { return DomManagement; });\n/**\r\n * Sets of helpers dealing with the DOM and some of the recurrent functions needed in\r\n * Babylon.js\r\n */\r\nvar DomManagement = /** @class */ (function () {\r\n function DomManagement() {\r\n }\r\n /**\r\n * Checks if the window object exists\r\n * @returns true if the window object exists\r\n */\r\n DomManagement.IsWindowObjectExist = function () {\r\n return (typeof window) !== \"undefined\";\r\n };\r\n /**\r\n * Checks if the navigator object exists\r\n * @returns true if the navigator object exists\r\n */\r\n DomManagement.IsNavigatorAvailable = function () {\r\n return (typeof navigator) !== \"undefined\";\r\n };\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * @param element defines the root element\r\n * @returns a string\r\n */\r\n DomManagement.GetDOMTextContent = function (element) {\r\n var result = \"\";\r\n var child = element.firstChild;\r\n while (child) {\r\n if (child.nodeType === 3) {\r\n result += child.textContent;\r\n }\r\n child = (child.nextSibling);\r\n }\r\n return result;\r\n };\r\n return DomManagement;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/environmentTextureTools.ts\":\n/*!*****************************************!*\\\n !*** ./Misc/environmentTextureTools.ts ***!\n \\*****************************************/\n/*! exports provided: EnvironmentTextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return EnvironmentTextureTools; });\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_Extensions_engine_renderTarget__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/Extensions/engine.renderTarget */ \"./Engines/Extensions/engine.renderTarget.ts\");\n/* harmony import */ var _Shaders_rgbdEncode_fragment__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/rgbdEncode.fragment */ \"./Shaders/rgbdEncode.fragment.ts\");\n/* harmony import */ var _Shaders_rgbdDecode_fragment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Shaders/rgbdDecode.fragment */ \"./Shaders/rgbdDecode.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Sets of helpers addressing the serialization and deserialization of environment texture\r\n * stored in a BabylonJS env file.\r\n * Those files are usually stored as .env files.\r\n */\r\nvar EnvironmentTextureTools = /** @class */ (function () {\r\n function EnvironmentTextureTools() {\r\n }\r\n /**\r\n * Gets the environment info from an env file.\r\n * @param data The array buffer containing the .env bytes.\r\n * @returns the environment file info (the json header) if successfully parsed.\r\n */\r\n EnvironmentTextureTools.GetEnvInfo = function (data) {\r\n var dataView = new DataView(data);\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n if (dataView.getUint8(pos++) !== EnvironmentTextureTools._MagicBytes[i]) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Error('Not a babylon environment map');\r\n return null;\r\n }\r\n }\r\n // Read json manifest - collect characters up to null terminator\r\n var manifestString = '';\r\n var charCode = 0x00;\r\n while ((charCode = dataView.getUint8(pos++))) {\r\n manifestString += String.fromCharCode(charCode);\r\n }\r\n var manifest = JSON.parse(manifestString);\r\n if (manifest.specular) {\r\n // Extend the header with the position of the payload.\r\n manifest.specular.specularDataPosition = pos;\r\n // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.\r\n manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;\r\n }\r\n return manifest;\r\n };\r\n /**\r\n * Creates an environment texture from a loaded cube texture.\r\n * @param texture defines the cube texture to convert in env file\r\n * @return a promise containing the environment data if succesfull.\r\n */\r\n EnvironmentTextureTools.CreateEnvTextureAsync = function (texture) {\r\n var _this = this;\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return Promise.reject(\"The cube texture is invalid.\");\r\n }\r\n if (!texture._prefiltered) {\r\n return Promise.reject(\"The cube texture is invalid (not prefiltered).\");\r\n }\r\n var engine = internalTexture.getEngine();\r\n if (engine && engine.premultipliedAlpha) {\r\n return Promise.reject(\"Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.\");\r\n }\r\n if (texture.textureType === _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n return Promise.reject(\"The cube texture should allow HDR (Full Float or Half Float).\");\r\n }\r\n var canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n return Promise.reject(\"Env texture can only be created when the engine is associated to a canvas.\");\r\n }\r\n var textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n if (!engine.getCaps().textureFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n if (!engine.getCaps().textureHalfFloatRender) {\r\n return Promise.reject(\"Env texture can only be created when the browser supports half float or full float rendering.\");\r\n }\r\n }\r\n var cubeWidth = internalTexture.width;\r\n var hostingScene = new _scene__WEBPACK_IMPORTED_MODULE_7__[\"Scene\"](engine);\r\n var specularTextures = {};\r\n var promises = [];\r\n // Read and collect all mipmaps data from the cube.\r\n var mipmapsCount = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Log2(internalTexture.width);\r\n mipmapsCount = Math.round(mipmapsCount);\r\n var _loop_1 = function (i) {\r\n var faceWidth = Math.pow(2, mipmapsCount - i);\r\n var _loop_2 = function (face) {\r\n var data = texture.readPixels(face, i);\r\n // Creates a temp texture with the face data.\r\n var tempTexture = engine.createRawTexture(data, faceWidth, faceWidth, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, null, textureType);\r\n // And rgbdEncode them.\r\n var promise = new Promise(function (resolve, reject) {\r\n var rgbdPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_8__[\"PostProcess\"](\"rgbdEncode\", \"rgbdEncode\", null, null, 1, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, engine, false, undefined, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, undefined, null, false);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture);\r\n };\r\n // As the process needs to happen on the main canvas, keep track of the current size\r\n var currentW = engine.getRenderWidth();\r\n var currentH = engine.getRenderHeight();\r\n // Set the desired size for the texture\r\n engine.setSize(faceWidth, faceWidth);\r\n hostingScene.postProcessManager.directRender([rgbdPostProcess], null);\r\n // Reading datas from WebGL\r\n _tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].ToBlob(canvas, function (blob) {\r\n var fileReader = new FileReader();\r\n fileReader.onload = function (event) {\r\n var arrayBuffer = event.target.result;\r\n specularTextures[i * 6 + face] = arrayBuffer;\r\n resolve();\r\n };\r\n fileReader.readAsArrayBuffer(blob);\r\n });\r\n // Reapply the previous canvas size\r\n engine.setSize(currentW, currentH);\r\n });\r\n });\r\n promises.push(promise);\r\n };\r\n // All faces of the cube.\r\n for (var face = 0; face < 6; face++) {\r\n _loop_2(face);\r\n }\r\n };\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n _loop_1(i);\r\n }\r\n // Once all the textures haves been collected as RGBD stored in PNGs\r\n return Promise.all(promises).then(function () {\r\n // We can delete the hosting scene keeping track of all the creation objects\r\n hostingScene.dispose();\r\n // Creates the json header for the env texture\r\n var info = {\r\n version: 1,\r\n width: cubeWidth,\r\n irradiance: _this._CreateEnvTextureIrradiance(texture),\r\n specular: {\r\n mipmaps: [],\r\n lodGenerationScale: texture.lodGenerationScale\r\n }\r\n };\r\n // Sets the specular image data information\r\n var position = 0;\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var byteLength = specularTextures[i * 6 + face].byteLength;\r\n info.specular.mipmaps.push({\r\n length: byteLength,\r\n position: position\r\n });\r\n position += byteLength;\r\n }\r\n }\r\n // Encode the JSON as an array buffer\r\n var infoString = JSON.stringify(info);\r\n var infoBuffer = new ArrayBuffer(infoString.length + 1);\r\n var infoView = new Uint8Array(infoBuffer); // Limited to ascii subset matching unicode.\r\n for (var i = 0, strLen = infoString.length; i < strLen; i++) {\r\n infoView[i] = infoString.charCodeAt(i);\r\n }\r\n // Ends up with a null terminator for easier parsing\r\n infoView[infoString.length] = 0x00;\r\n // Computes the final required size and creates the storage\r\n var totalSize = EnvironmentTextureTools._MagicBytes.length + position + infoBuffer.byteLength;\r\n var finalBuffer = new ArrayBuffer(totalSize);\r\n var finalBufferView = new Uint8Array(finalBuffer);\r\n var dataView = new DataView(finalBuffer);\r\n // Copy the magic bytes identifying the file in\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n dataView.setUint8(pos++, EnvironmentTextureTools._MagicBytes[i]);\r\n }\r\n // Add the json info\r\n finalBufferView.set(new Uint8Array(infoBuffer), pos);\r\n pos += infoBuffer.byteLength;\r\n // Finally inserts the texture data\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var dataBuffer = specularTextures[i * 6 + face];\r\n finalBufferView.set(new Uint8Array(dataBuffer), pos);\r\n pos += dataBuffer.byteLength;\r\n }\r\n }\r\n // Voila\r\n return finalBuffer;\r\n });\r\n };\r\n /**\r\n * Creates a JSON representation of the spherical data.\r\n * @param texture defines the texture containing the polynomials\r\n * @return the JSON representation of the spherical info\r\n */\r\n EnvironmentTextureTools._CreateEnvTextureIrradiance = function (texture) {\r\n var polynmials = texture.sphericalPolynomial;\r\n if (polynmials == null) {\r\n return null;\r\n }\r\n return {\r\n x: [polynmials.x.x, polynmials.x.y, polynmials.x.z],\r\n y: [polynmials.y.x, polynmials.y.y, polynmials.y.z],\r\n z: [polynmials.z.x, polynmials.z.y, polynmials.z.z],\r\n xx: [polynmials.xx.x, polynmials.xx.y, polynmials.xx.z],\r\n yy: [polynmials.yy.x, polynmials.yy.y, polynmials.yy.z],\r\n zz: [polynmials.zz.x, polynmials.zz.y, polynmials.zz.z],\r\n yz: [polynmials.yz.x, polynmials.yz.y, polynmials.yz.z],\r\n zx: [polynmials.zx.x, polynmials.zx.y, polynmials.zx.z],\r\n xy: [polynmials.xy.x, polynmials.xy.y, polynmials.xy.z]\r\n };\r\n };\r\n /**\r\n * Creates the ArrayBufferViews used for initializing environment texture image data.\r\n * @param arrayBuffer the underlying ArrayBuffer to which the views refer\r\n * @param info parameters that determine what views will be created for accessing the underlying buffer\r\n * @return the views described by info providing access to the underlying buffer\r\n */\r\n EnvironmentTextureTools.CreateImageDataArrayBufferViews = function (arrayBuffer, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n // Double checks the enclosed info\r\n var mipmapsCount = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Log2(info.width);\r\n mipmapsCount = Math.round(mipmapsCount) + 1;\r\n if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {\r\n throw new Error(\"Unsupported specular mipmaps number \\\"\" + specularInfo.mipmaps.length + \"\\\"\");\r\n }\r\n var imageData = new Array(mipmapsCount);\r\n for (var i = 0; i < mipmapsCount; i++) {\r\n imageData[i] = new Array(6);\r\n for (var face = 0; face < 6; face++) {\r\n var imageInfo = specularInfo.mipmaps[i * 6 + face];\r\n imageData[i][face] = new Uint8Array(arrayBuffer, specularInfo.specularDataPosition + imageInfo.position, imageInfo.length);\r\n }\r\n }\r\n return imageData;\r\n };\r\n /**\r\n * Uploads the texture info contained in the env file to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param arrayBuffer defines the buffer cotaining the data to load\r\n * @param info defines the texture info retrieved through the GetEnvInfo method\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, arrayBuffer, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n if (!specularInfo) {\r\n // Nothing else parsed so far\r\n return Promise.resolve();\r\n }\r\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\r\n var imageData = EnvironmentTextureTools.CreateImageDataArrayBufferViews(arrayBuffer, info);\r\n return EnvironmentTextureTools.UploadLevelsAsync(texture, imageData);\r\n };\r\n /**\r\n * Uploads the levels of image data to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param imageData defines the array buffer views of image data [mipmap][face]\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {\r\n if (!_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].IsExponentOfTwo(texture.width)) {\r\n throw new Error(\"Texture size must be a power of two\");\r\n }\r\n var mipmapsCount = Math.round(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Log2(texture.width)) + 1;\r\n // Gets everything ready.\r\n var engine = texture.getEngine();\r\n var expandTexture = false;\r\n var generateNonLODTextures = false;\r\n var rgbdPostProcess = null;\r\n var cubeRtt = null;\r\n var lodTextures = null;\r\n var caps = engine.getCaps();\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n texture.generateMipMaps = true;\r\n engine.updateTextureSamplingMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE, texture);\r\n // Add extra process if texture lod is not supported\r\n if (!caps.textureLOD) {\r\n expandTexture = false;\r\n generateNonLODTextures = true;\r\n lodTextures = {};\r\n }\r\n // in webgl 1 there are no ways to either render or copy lod level information for float textures.\r\n else if (engine.webGLVersion < 2) {\r\n expandTexture = false;\r\n }\r\n // If half float available we can uncompress the texture\r\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Simply run through the decode PP\r\n rgbdPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_8__[\"PostProcess\"](\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE, engine, false, undefined, texture.type, undefined, null, false);\r\n texture._isRGBD = false;\r\n texture.invertY = false;\r\n cubeRtt = engine.createRenderTargetCubeTexture(texture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: true,\r\n generateStencilBuffer: false,\r\n samplingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: texture.type,\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA\r\n });\r\n }\r\n else {\r\n texture._isRGBD = true;\r\n texture.invertY = true;\r\n // In case of missing support, applies the same patch than DDS files.\r\n if (generateNonLODTextures) {\r\n var mipSlices = 3;\r\n var scale = texture._lodGenerationScale;\r\n var offset = texture._lodGenerationOffset;\r\n for (var i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n var smoothness = i / (mipSlices - 1);\r\n var roughness = 1 - smoothness;\r\n var minLODIndex = offset; // roughness = 0\r\n var maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1 (mipmaps start from 0)\r\n var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n var mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n var glTextureFromLod = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](engine, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n glTextureFromLod.isCube = true;\r\n glTextureFromLod.invertY = true;\r\n glTextureFromLod.generateMipMaps = false;\r\n engine.updateTextureSamplingMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_LINEAR_LINEAR, glTextureFromLod);\r\n // Wrap in a base texture for easy binding.\r\n var lodTexture = new _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_5__[\"BaseTexture\"](null);\r\n lodTexture.isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n lodTextures[mipmapIndex] = lodTexture;\r\n switch (i) {\r\n case 0:\r\n texture._lodTextureLow = lodTexture;\r\n break;\r\n case 1:\r\n texture._lodTextureMid = lodTexture;\r\n break;\r\n case 2:\r\n texture._lodTextureHigh = lodTexture;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n var promises = [];\r\n var _loop_3 = function (i) {\r\n var _loop_4 = function (face) {\r\n // Constructs an image element from image data\r\n var bytes = imageData[i][face];\r\n var blob = new Blob([bytes], { type: 'image/png' });\r\n var url = URL.createObjectURL(blob);\r\n var image = new Image();\r\n image.src = url;\r\n // Enqueue promise to upload to the texture.\r\n var promise = new Promise(function (resolve, reject) {\r\n image.onload = function () {\r\n if (expandTexture) {\r\n var tempTexture_1 = engine.createTexture(null, true, true, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, null, function (message) {\r\n reject(message);\r\n }, image);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n // Uncompress the data to a RTT\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture_1);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess], cubeRtt, true, face, i);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n tempTexture_1.dispose();\r\n window.URL.revokeObjectURL(url);\r\n resolve();\r\n });\r\n }\r\n else {\r\n engine._uploadImageToTexture(texture, image, face, i);\r\n // Upload the face to the non lod texture support\r\n if (generateNonLODTextures) {\r\n var lodTexture = lodTextures[i];\r\n if (lodTexture) {\r\n engine._uploadImageToTexture(lodTexture._texture, image, face, 0);\r\n }\r\n }\r\n resolve();\r\n }\r\n };\r\n image.onerror = function (error) {\r\n reject(error);\r\n };\r\n });\r\n promises.push(promise);\r\n };\r\n // All faces\r\n for (var face = 0; face < 6; face++) {\r\n _loop_4(face);\r\n }\r\n };\r\n // All mipmaps up to provided number of images\r\n for (var i = 0; i < imageData.length; i++) {\r\n _loop_3(i);\r\n }\r\n // Fill remaining mipmaps with black textures.\r\n if (imageData.length < mipmapsCount) {\r\n var data = void 0;\r\n var size = Math.pow(2, mipmapsCount - 1 - imageData.length);\r\n var dataLength = size * size * 4;\r\n switch (texture.type) {\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT: {\r\n data = new Uint8Array(dataLength);\r\n break;\r\n }\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_HALF_FLOAT: {\r\n data = new Uint16Array(dataLength);\r\n break;\r\n }\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT: {\r\n data = new Float32Array(dataLength);\r\n break;\r\n }\r\n }\r\n for (var i = imageData.length; i < mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n engine._uploadArrayBufferViewToTexture(texture, data, face, i);\r\n }\r\n }\r\n }\r\n // Once all done, finishes the cleanup and return\r\n return Promise.all(promises).then(function () {\r\n // Release temp RTT.\r\n if (cubeRtt) {\r\n engine._releaseFramebufferObjects(cubeRtt);\r\n engine._releaseTexture(texture);\r\n cubeRtt._swapAndDie(texture);\r\n }\r\n // Release temp Post Process.\r\n if (rgbdPostProcess) {\r\n rgbdPostProcess.dispose();\r\n }\r\n // Flag internal texture as ready in case they are in use.\r\n if (generateNonLODTextures) {\r\n if (texture._lodTextureHigh && texture._lodTextureHigh._texture) {\r\n texture._lodTextureHigh._texture.isReady = true;\r\n }\r\n if (texture._lodTextureMid && texture._lodTextureMid._texture) {\r\n texture._lodTextureMid._texture.isReady = true;\r\n }\r\n if (texture._lodTextureLow && texture._lodTextureLow._texture) {\r\n texture._lodTextureLow._texture.isReady = true;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Uploads spherical polynomials information to the texture.\r\n * @param texture defines the texture we are trying to upload the information to\r\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\r\n */\r\n EnvironmentTextureTools.UploadEnvSpherical = function (texture, info) {\r\n if (info.version !== 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn('Unsupported babylon environment map version \"' + info.version + '\"');\r\n }\r\n var irradianceInfo = info.irradiance;\r\n if (!irradianceInfo) {\r\n return;\r\n }\r\n var sp = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__[\"SphericalPolynomial\"]();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.x, 0, sp.x);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.y, 0, sp.y);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.z, 0, sp.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.xx, 0, sp.xx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.yy, 0, sp.yy);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.zz, 0, sp.zz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.yz, 0, sp.yz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.zx, 0, sp.zx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.xy, 0, sp.xy);\r\n texture._sphericalPolynomial = sp;\r\n };\r\n /** @hidden */\r\n EnvironmentTextureTools._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._dataSource = _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_CUBERAW_RGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return EnvironmentTextureTools.UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n /**\r\n * Magic number identifying the env file.\r\n */\r\n EnvironmentTextureTools._MagicBytes = [0x86, 0x16, 0x87, 0x96, 0xf6, 0xd6, 0x96, 0x36];\r\n return EnvironmentTextureTools;\r\n}());\r\n\r\n// References the dependencies.\r\n_Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"]._UpdateRGBDAsync = EnvironmentTextureTools._UpdateRGBDAsync;\r\n\n\n/***/ }),\n\n/***/ \"./Misc/fileTools.ts\":\n/*!***************************!*\\\n !*** ./Misc/fileTools.ts ***!\n \\***************************/\n/*! exports provided: FileTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FileTools\", function() { return FileTools; });\n/* harmony import */ var _webRequest__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webRequest */ \"./Misc/webRequest.ts\");\n/* harmony import */ var _loadFileError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./loadFileError */ \"./Misc/loadFileError.ts\");\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _filesInputStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./filesInputStore */ \"./Misc/filesInputStore.ts\");\n/* harmony import */ var _retryStrategy__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./retryStrategy */ \"./Misc/retryStrategy.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar FileTools = /** @class */ (function () {\r\n function FileTools() {\r\n }\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n FileTools._CleanUrl = function (url) {\r\n url = url.replace(/#/mg, \"%23\");\r\n return url;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n FileTools.SetCorsBehavior = function (url, element) {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n if (this.CorsBehavior) {\r\n if (typeof (this.CorsBehavior) === 'string' || this.CorsBehavior instanceof String) {\r\n element.crossOrigin = this.CorsBehavior;\r\n }\r\n else {\r\n var result = this.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n FileTools.LoadImage = function (input, onLoad, onError, offlineProvider) {\r\n var url;\r\n var usingObjectURL = false;\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n url = URL.createObjectURL(new Blob([input]));\r\n usingObjectURL = true;\r\n }\r\n else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = this._CleanUrl(input);\r\n url = this.PreprocessUrl(input);\r\n }\r\n var img = new Image();\r\n this.SetCorsBehavior(url, img);\r\n var loadHandler = function () {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n onLoad(img);\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n var errorHandler = function (err) {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, err);\r\n }\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n img.addEventListener(\"load\", loadHandler);\r\n img.addEventListener(\"error\", errorHandler);\r\n var noOfflineSupport = function () {\r\n img.src = url;\r\n };\r\n var loadFromOfflineSupport = function () {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n if (url.substr(0, 5) !== \"data:\" && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n }\r\n else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[textureName]) {\r\n try {\r\n var blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[textureName]);\r\n }\r\n catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n }\r\n catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n noOfflineSupport();\r\n }\r\n return img;\r\n };\r\n /**\r\n * Loads a file\r\n * @param fileToLoad defines the file to load\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallBack defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @returns a file request object\r\n */\r\n FileTools.ReadFile = function (fileToLoad, callback, progressCallBack, useArrayBuffer) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"](),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) { return request.onCompleteObservable.notifyObservers(request); };\r\n reader.onerror = function (e) {\r\n callback(JSON.stringify({ autoClear: true, clearColor: [1, 0, 0], ambientColor: [0, 0, 0], gravity: [0, -9.807, 0], meshes: [], cameras: [], lights: [] }));\r\n };\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n callback(e.target['result']);\r\n };\r\n if (progressCallBack) {\r\n reader.onprogress = progressCallBack;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(fileToLoad);\r\n }\r\n else {\r\n reader.readAsArrayBuffer(fileToLoad);\r\n }\r\n return request;\r\n };\r\n /**\r\n * Loads a file\r\n * @param url url string, ArrayBuffer, or Blob to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n FileTools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n var _this = this;\r\n url = this._CleanUrl(url);\r\n url = this.PreprocessUrl(url);\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[fileName]) {\r\n return this.ReadFile(_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[fileName], onSuccess, onProgress, useArrayBuffer);\r\n }\r\n }\r\n var loadUrl = this.BaseUrl + url;\r\n var aborted = false;\r\n var fileRequest = {\r\n onCompleteObservable: new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"](),\r\n abort: function () { return aborted = true; },\r\n };\r\n var requestFile = function () {\r\n var request = new _webRequest__WEBPACK_IMPORTED_MODULE_0__[\"WebRequest\"]();\r\n var retryHandle = null;\r\n fileRequest.abort = function () {\r\n aborted = true;\r\n if (request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n };\r\n var retryLoop = function (retryIndex) {\r\n request.open('GET', loadUrl);\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n var onLoadEnd = function () {\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n };\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n var onReadyStateChange = function () {\r\n if (aborted) {\r\n return;\r\n }\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!_domManagement__WEBPACK_IMPORTED_MODULE_2__[\"DomManagement\"].IsWindowObjectExist() || _this.IsFileURL()))) {\r\n onSuccess(!useArrayBuffer ? request.responseText : request.response, request.responseURL);\r\n return;\r\n }\r\n var retryStrategy = _this.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n var waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n request = new _webRequest__WEBPACK_IMPORTED_MODULE_0__[\"WebRequest\"]();\r\n retryHandle = setTimeout(function () { return retryLoop(retryIndex + 1); }, waitTime);\r\n return;\r\n }\r\n }\r\n var e = new _loadFileError__WEBPACK_IMPORTED_MODULE_1__[\"LoadFileError\"](\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(request, e);\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n };\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n request.send();\r\n };\r\n retryLoop(0);\r\n };\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline) {\r\n var noOfflineSupport_1 = function (request) {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n }\r\n else {\r\n if (!aborted) {\r\n requestFile();\r\n }\r\n }\r\n };\r\n var loadFromOfflineSupport = function () {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n if (aborted) {\r\n return;\r\n }\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(url, function (data) {\r\n if (!aborted) {\r\n onSuccess(data);\r\n }\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n }, onProgress ? function (event) {\r\n if (!aborted) {\r\n onProgress(event);\r\n }\r\n } : undefined, noOfflineSupport_1, useArrayBuffer);\r\n }\r\n };\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport_1);\r\n }\r\n else {\r\n requestFile();\r\n }\r\n return fileRequest;\r\n };\r\n /**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n */\r\n FileTools.IsFileURL = function () {\r\n return location.protocol === \"file:\";\r\n };\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n FileTools.DefaultRetryStrategy = _retryStrategy__WEBPACK_IMPORTED_MODULE_5__[\"RetryStrategy\"].ExponentialBackoff();\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n FileTools.BaseUrl = \"\";\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n FileTools.CorsBehavior = \"anonymous\";\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n FileTools.PreprocessUrl = function (url) {\r\n return url;\r\n };\r\n return FileTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/filesInput.ts\":\n/*!****************************!*\\\n !*** ./Misc/filesInput.ts ***!\n \\****************************/\n/*! exports provided: FilesInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return FilesInput; });\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _filesInputStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filesInputStore */ \"./Misc/filesInputStore.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to help managing file picking and drag'n'drop\r\n */\r\nvar FilesInput = /** @class */ (function () {\r\n /**\r\n * Creates a new FilesInput\r\n * @param engine defines the rendering engine\r\n * @param scene defines the hosting scene\r\n * @param sceneLoadedCallback callback called when scene is loaded\r\n * @param progressCallback callback called to track progress\r\n * @param additionalRenderLoopLogicCallback callback called to add user logic to the rendering loop\r\n * @param textureLoadingCallback callback called when a texture is loading\r\n * @param startingProcessingFilesCallback callback called when the system is about to process all files\r\n * @param onReloadCallback callback called when a reload is requested\r\n * @param errorCallback callback call if an error occurs\r\n */\r\n function FilesInput(engine, scene, sceneLoadedCallback, progressCallback, additionalRenderLoopLogicCallback, textureLoadingCallback, startingProcessingFilesCallback, onReloadCallback, errorCallback) {\r\n /**\r\n * Callback called when a file is processed\r\n */\r\n this.onProcessFileCallback = function () { return true; };\r\n this._engine = engine;\r\n this._currentScene = scene;\r\n this._sceneLoadedCallback = sceneLoadedCallback;\r\n this._progressCallback = progressCallback;\r\n this._additionalRenderLoopLogicCallback = additionalRenderLoopLogicCallback;\r\n this._textureLoadingCallback = textureLoadingCallback;\r\n this._startingProcessingFilesCallback = startingProcessingFilesCallback;\r\n this._onReloadCallback = onReloadCallback;\r\n this._errorCallback = errorCallback;\r\n }\r\n Object.defineProperty(FilesInput, \"FilesToLoad\", {\r\n /**\r\n * List of files ready to be loaded\r\n */\r\n get: function () {\r\n return _filesInputStore__WEBPACK_IMPORTED_MODULE_2__[\"FilesInputStore\"].FilesToLoad;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Calls this function to listen to drag'n'drop events on a specific DOM element\r\n * @param elementToMonitor defines the DOM element to track\r\n */\r\n FilesInput.prototype.monitorElementForDragNDrop = function (elementToMonitor) {\r\n var _this = this;\r\n if (elementToMonitor) {\r\n this._elementToMonitor = elementToMonitor;\r\n this._dragEnterHandler = function (e) { _this.drag(e); };\r\n this._dragOverHandler = function (e) { _this.drag(e); };\r\n this._dropHandler = function (e) { _this.drop(e); };\r\n this._elementToMonitor.addEventListener(\"dragenter\", this._dragEnterHandler, false);\r\n this._elementToMonitor.addEventListener(\"dragover\", this._dragOverHandler, false);\r\n this._elementToMonitor.addEventListener(\"drop\", this._dropHandler, false);\r\n }\r\n };\r\n /**\r\n * Release all associated resources\r\n */\r\n FilesInput.prototype.dispose = function () {\r\n if (!this._elementToMonitor) {\r\n return;\r\n }\r\n this._elementToMonitor.removeEventListener(\"dragenter\", this._dragEnterHandler);\r\n this._elementToMonitor.removeEventListener(\"dragover\", this._dragOverHandler);\r\n this._elementToMonitor.removeEventListener(\"drop\", this._dropHandler);\r\n };\r\n FilesInput.prototype.renderFunction = function () {\r\n if (this._additionalRenderLoopLogicCallback) {\r\n this._additionalRenderLoopLogicCallback();\r\n }\r\n if (this._currentScene) {\r\n if (this._textureLoadingCallback) {\r\n var remaining = this._currentScene.getWaitingItemsCount();\r\n if (remaining > 0) {\r\n this._textureLoadingCallback(remaining);\r\n }\r\n }\r\n this._currentScene.render();\r\n }\r\n };\r\n FilesInput.prototype.drag = function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n };\r\n FilesInput.prototype.drop = function (eventDrop) {\r\n eventDrop.stopPropagation();\r\n eventDrop.preventDefault();\r\n this.loadFiles(eventDrop);\r\n };\r\n FilesInput.prototype._traverseFolder = function (folder, files, remaining, callback) {\r\n var _this = this;\r\n var reader = folder.createReader();\r\n var relativePath = folder.fullPath.replace(/^\\//, \"\").replace(/(.+?)\\/?$/, \"$1/\");\r\n reader.readEntries(function (entries) {\r\n remaining.count += entries.length;\r\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\r\n var entry = entries_1[_i];\r\n if (entry.isFile) {\r\n entry.file(function (file) {\r\n file.correctName = relativePath + file.name;\r\n files.push(file);\r\n if (--remaining.count === 0) {\r\n callback();\r\n }\r\n });\r\n }\r\n else if (entry.isDirectory) {\r\n _this._traverseFolder(entry, files, remaining, callback);\r\n }\r\n }\r\n if (--remaining.count) {\r\n callback();\r\n }\r\n });\r\n };\r\n FilesInput.prototype._processFiles = function (files) {\r\n for (var i = 0; i < files.length; i++) {\r\n var name = files[i].correctName.toLowerCase();\r\n var extension = name.split('.').pop();\r\n if (!this.onProcessFileCallback(files[i], name, extension)) {\r\n continue;\r\n }\r\n if ((extension === \"babylon\" || extension === \"stl\" || extension === \"obj\" || extension === \"gltf\" || extension === \"glb\")\r\n && name.indexOf(\".binary.babylon\") === -1 && name.indexOf(\".incremental.babylon\") === -1) {\r\n this._sceneFileToLoad = files[i];\r\n }\r\n FilesInput.FilesToLoad[name] = files[i];\r\n }\r\n };\r\n /**\r\n * Load files from a drop event\r\n * @param event defines the drop event to use as source\r\n */\r\n FilesInput.prototype.loadFiles = function (event) {\r\n var _this = this;\r\n // Handling data transfer via drag'n'drop\r\n if (event && event.dataTransfer && event.dataTransfer.files) {\r\n this._filesToLoad = event.dataTransfer.files;\r\n }\r\n // Handling files from input files\r\n if (event && event.target && event.target.files) {\r\n this._filesToLoad = event.target.files;\r\n }\r\n if (!this._filesToLoad || this._filesToLoad.length === 0) {\r\n return;\r\n }\r\n if (this._startingProcessingFilesCallback) {\r\n this._startingProcessingFilesCallback(this._filesToLoad);\r\n }\r\n if (this._filesToLoad && this._filesToLoad.length > 0) {\r\n var files_1 = new Array();\r\n var folders = [];\r\n var items = event.dataTransfer ? event.dataTransfer.items : null;\r\n for (var i = 0; i < this._filesToLoad.length; i++) {\r\n var fileToLoad = this._filesToLoad[i];\r\n var name_1 = fileToLoad.name.toLowerCase();\r\n var entry = void 0;\r\n fileToLoad.correctName = name_1;\r\n if (items) {\r\n var item = items[i];\r\n if (item.getAsEntry) {\r\n entry = item.getAsEntry();\r\n }\r\n else if (item.webkitGetAsEntry) {\r\n entry = item.webkitGetAsEntry();\r\n }\r\n }\r\n if (!entry) {\r\n files_1.push(fileToLoad);\r\n }\r\n else {\r\n if (entry.isDirectory) {\r\n folders.push(entry);\r\n }\r\n else {\r\n files_1.push(fileToLoad);\r\n }\r\n }\r\n }\r\n if (folders.length === 0) {\r\n this._processFiles(files_1);\r\n this._processReload();\r\n }\r\n else {\r\n var remaining = { count: folders.length };\r\n for (var _i = 0, folders_1 = folders; _i < folders_1.length; _i++) {\r\n var folder = folders_1[_i];\r\n this._traverseFolder(folder, files_1, remaining, function () {\r\n _this._processFiles(files_1);\r\n if (remaining.count === 0) {\r\n _this._processReload();\r\n }\r\n });\r\n }\r\n }\r\n }\r\n };\r\n FilesInput.prototype._processReload = function () {\r\n if (this._onReloadCallback) {\r\n this._onReloadCallback(this._sceneFileToLoad);\r\n }\r\n else {\r\n this.reload();\r\n }\r\n };\r\n /**\r\n * Reload the current scene from the loaded files\r\n */\r\n FilesInput.prototype.reload = function () {\r\n var _this = this;\r\n // If a scene file has been provided\r\n if (this._sceneFileToLoad) {\r\n if (this._currentScene) {\r\n if (_Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].errorsCount > 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].ClearLogCache();\r\n }\r\n this._engine.stopRenderLoop();\r\n }\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoader\"].LoadAsync(\"file:\", this._sceneFileToLoad, this._engine, function (progress) {\r\n if (_this._progressCallback) {\r\n _this._progressCallback(progress);\r\n }\r\n }).then(function (scene) {\r\n if (_this._currentScene) {\r\n _this._currentScene.dispose();\r\n }\r\n _this._currentScene = scene;\r\n if (_this._sceneLoadedCallback) {\r\n _this._sceneLoadedCallback(_this._sceneFileToLoad, _this._currentScene);\r\n }\r\n // Wait for textures and shaders to be ready\r\n _this._currentScene.executeWhenReady(function () {\r\n _this._engine.runRenderLoop(function () {\r\n _this.renderFunction();\r\n });\r\n });\r\n }).catch(function (error) {\r\n if (_this._errorCallback) {\r\n _this._errorCallback(_this._sceneFileToLoad, _this._currentScene, error.message);\r\n }\r\n });\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Please provide a valid .babylon file.\");\r\n }\r\n };\r\n return FilesInput;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/filesInputStore.ts\":\n/*!*********************************!*\\\n !*** ./Misc/filesInputStore.ts ***!\n \\*********************************/\n/*! exports provided: FilesInputStore */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return FilesInputStore; });\n/**\r\n * Class used to help managing file picking and drag'n'drop\r\n * File Storage\r\n */\r\nvar FilesInputStore = /** @class */ (function () {\r\n function FilesInputStore() {\r\n }\r\n /**\r\n * List of files ready to be loaded\r\n */\r\n FilesInputStore.FilesToLoad = {};\r\n return FilesInputStore;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/gradients.ts\":\n/*!***************************!*\\\n !*** ./Misc/gradients.ts ***!\n \\***************************/\n/*! exports provided: ColorGradient, Color3Gradient, FactorGradient, GradientHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return ColorGradient; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return Color3Gradient; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return FactorGradient; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return GradientHelper; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n/** Class used to store color4 gradient */\r\nvar ColorGradient = /** @class */ (function () {\r\n function ColorGradient() {\r\n }\r\n /**\r\n * Will get a color picked randomly between color1 and color2.\r\n * If color2 is undefined then color1 will be used\r\n * @param result defines the target Color4 to store the result in\r\n */\r\n ColorGradient.prototype.getColorToRef = function (result) {\r\n if (!this.color2) {\r\n result.copyFrom(this.color1);\r\n return;\r\n }\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"].LerpToRef(this.color1, this.color2, Math.random(), result);\r\n };\r\n return ColorGradient;\r\n}());\r\n\r\n/** Class used to store color 3 gradient */\r\nvar Color3Gradient = /** @class */ (function () {\r\n function Color3Gradient() {\r\n }\r\n return Color3Gradient;\r\n}());\r\n\r\n/** Class used to store factor gradient */\r\nvar FactorGradient = /** @class */ (function () {\r\n function FactorGradient() {\r\n }\r\n /**\r\n * Will get a number picked randomly between factor1 and factor2.\r\n * If factor2 is undefined then factor1 will be used\r\n * @returns the picked number\r\n */\r\n FactorGradient.prototype.getFactor = function () {\r\n if (this.factor2 === undefined) {\r\n return this.factor1;\r\n }\r\n return this.factor1 + ((this.factor2 - this.factor1) * Math.random());\r\n };\r\n return FactorGradient;\r\n}());\r\n\r\n/**\r\n * Helper used to simplify some generic gradient tasks\r\n */\r\nvar GradientHelper = /** @class */ (function () {\r\n function GradientHelper() {\r\n }\r\n /**\r\n * Gets the current gradient from an array of IValueGradient\r\n * @param ratio defines the current ratio to get\r\n * @param gradients defines the array of IValueGradient\r\n * @param updateFunc defines the callback function used to get the final value from the selected gradients\r\n */\r\n GradientHelper.GetCurrentGradient = function (ratio, gradients, updateFunc) {\r\n for (var gradientIndex = 0; gradientIndex < gradients.length - 1; gradientIndex++) {\r\n var currentGradient = gradients[gradientIndex];\r\n var nextGradient = gradients[gradientIndex + 1];\r\n if (ratio >= currentGradient.gradient && ratio <= nextGradient.gradient) {\r\n var scale = (ratio - currentGradient.gradient) / (nextGradient.gradient - currentGradient.gradient);\r\n updateFunc(currentGradient, nextGradient, scale);\r\n return;\r\n }\r\n }\r\n // Use last index if over\r\n var lastIndex = gradients.length - 1;\r\n updateFunc(gradients[lastIndex], gradients[lastIndex], 1.0);\r\n };\r\n return GradientHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/guid.ts\":\n/*!**********************!*\\\n !*** ./Misc/guid.ts ***!\n \\**********************/\n/*! exports provided: GUID */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GUID\", function() { return GUID; });\n/**\r\n * Class used to manipulate GUIDs\r\n */\r\nvar GUID = /** @class */ (function () {\r\n function GUID() {\r\n }\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n GUID.RandomId = function () {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n };\r\n return GUID;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/iInspectable.ts\":\n/*!******************************!*\\\n !*** ./Misc/iInspectable.ts ***!\n \\******************************/\n/*! exports provided: InspectableType */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return InspectableType; });\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nvar InspectableType;\r\n(function (InspectableType) {\r\n /**\r\n * Checkbox for booleans\r\n */\r\n InspectableType[InspectableType[\"Checkbox\"] = 0] = \"Checkbox\";\r\n /**\r\n * Sliders for numbers\r\n */\r\n InspectableType[InspectableType[\"Slider\"] = 1] = \"Slider\";\r\n /**\r\n * Vector3\r\n */\r\n InspectableType[InspectableType[\"Vector3\"] = 2] = \"Vector3\";\r\n /**\r\n * Quaternions\r\n */\r\n InspectableType[InspectableType[\"Quaternion\"] = 3] = \"Quaternion\";\r\n /**\r\n * Color3\r\n */\r\n InspectableType[InspectableType[\"Color3\"] = 4] = \"Color3\";\r\n /**\r\n * String\r\n */\r\n InspectableType[InspectableType[\"String\"] = 5] = \"String\";\r\n})(InspectableType || (InspectableType = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Misc/index.ts\":\n/*!***********************!*\\\n !*** ./Misc/index.ts ***!\n \\***********************/\n/*! exports provided: AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, HDRTools, PanoramaToCubeMapTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./andOrNotEvaluator */ \"./Misc/andOrNotEvaluator.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__[\"AndOrNotEvaluator\"]; });\n\n/* harmony import */ var _assetsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assetsManager */ \"./Misc/assetsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AssetTaskState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AssetsProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"MeshAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"TextFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"BinaryFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"ImageAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"TextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"CubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"HDRCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"EquiRectangularCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AssetsManager\"]; });\n\n/* harmony import */ var _dds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dds */ \"./Misc/dds.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return _dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"]; });\n\n/* harmony import */ var _decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./decorators */ \"./Misc/decorators.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"expandToProperty\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serialize\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsColor3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsFresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsVector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsVector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsMeshReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsColor4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsQuaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsMatrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsCameraReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"]; });\n\n/* harmony import */ var _deferred__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./deferred */ \"./Misc/deferred.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return _deferred__WEBPACK_IMPORTED_MODULE_4__[\"Deferred\"]; });\n\n/* harmony import */ var _environmentTextureTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return _environmentTextureTools__WEBPACK_IMPORTED_MODULE_5__[\"EnvironmentTextureTools\"]; });\n\n/* harmony import */ var _meshExploder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./meshExploder */ \"./Misc/meshExploder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return _meshExploder__WEBPACK_IMPORTED_MODULE_6__[\"MeshExploder\"]; });\n\n/* harmony import */ var _filesInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./filesInput */ \"./Misc/filesInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return _filesInput__WEBPACK_IMPORTED_MODULE_7__[\"FilesInput\"]; });\n\n/* harmony import */ var _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./HighDynamicRange/index */ \"./Misc/HighDynamicRange/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__[\"HDRTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__[\"PanoramaToCubeMapTools\"]; });\n\n/* harmony import */ var _khronosTextureContainer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./khronosTextureContainer */ \"./Misc/khronosTextureContainer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return _khronosTextureContainer__WEBPACK_IMPORTED_MODULE_9__[\"KhronosTextureContainer\"]; });\n\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"EventState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"Observer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"MultiObserver\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"Observable\"]; });\n\n/* harmony import */ var _performanceMonitor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./performanceMonitor */ \"./Misc/performanceMonitor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return _performanceMonitor__WEBPACK_IMPORTED_MODULE_11__[\"PerformanceMonitor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return _performanceMonitor__WEBPACK_IMPORTED_MODULE_11__[\"RollingAverage\"]; });\n\n/* harmony import */ var _promise__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./promise */ \"./Misc/promise.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return _promise__WEBPACK_IMPORTED_MODULE_12__[\"PromisePolyfill\"]; });\n\n/* harmony import */ var _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./sceneOptimizer */ \"./Misc/sceneOptimizer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"SceneOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"TextureOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"HardwareScalingOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"ShadowsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"PostProcessesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"LensFlaresOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"CustomOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"ParticlesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"RenderTargetsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"MergeMeshesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"SceneOptimizerOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"SceneOptimizer\"]; });\n\n/* harmony import */ var _sceneSerializer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sceneSerializer */ \"./Misc/sceneSerializer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return _sceneSerializer__WEBPACK_IMPORTED_MODULE_14__[\"SceneSerializer\"]; });\n\n/* harmony import */ var _smartArray__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./smartArray */ \"./Misc/smartArray.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return _smartArray__WEBPACK_IMPORTED_MODULE_15__[\"SmartArray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return _smartArray__WEBPACK_IMPORTED_MODULE_15__[\"SmartArrayNoDuplicate\"]; });\n\n/* harmony import */ var _stringDictionary__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./stringDictionary */ \"./Misc/stringDictionary.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return _stringDictionary__WEBPACK_IMPORTED_MODULE_16__[\"StringDictionary\"]; });\n\n/* harmony import */ var _tags__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./tags */ \"./Misc/tags.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return _tags__WEBPACK_IMPORTED_MODULE_17__[\"Tags\"]; });\n\n/* harmony import */ var _textureTools__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./textureTools */ \"./Misc/textureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return _textureTools__WEBPACK_IMPORTED_MODULE_18__[\"TextureTools\"]; });\n\n/* harmony import */ var _tga__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./tga */ \"./Misc/tga.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return _tga__WEBPACK_IMPORTED_MODULE_19__[\"TGATools\"]; });\n\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return _tools__WEBPACK_IMPORTED_MODULE_20__[\"Tools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return _tools__WEBPACK_IMPORTED_MODULE_20__[\"className\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return _tools__WEBPACK_IMPORTED_MODULE_20__[\"AsyncLoop\"]; });\n\n/* harmony import */ var _videoRecorder__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./videoRecorder */ \"./Misc/videoRecorder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return _videoRecorder__WEBPACK_IMPORTED_MODULE_21__[\"VideoRecorder\"]; });\n\n/* harmony import */ var _virtualJoystick__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./virtualJoystick */ \"./Misc/virtualJoystick.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return _virtualJoystick__WEBPACK_IMPORTED_MODULE_22__[\"JoystickAxis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return _virtualJoystick__WEBPACK_IMPORTED_MODULE_22__[\"VirtualJoystick\"]; });\n\n/* harmony import */ var _workerPool__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./workerPool */ \"./Misc/workerPool.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return _workerPool__WEBPACK_IMPORTED_MODULE_23__[\"WorkerPool\"]; });\n\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return _logger__WEBPACK_IMPORTED_MODULE_24__[\"Logger\"]; });\n\n/* harmony import */ var _typeStore__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./typeStore */ \"./Misc/typeStore.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _typeStore__WEBPACK_IMPORTED_MODULE_25__[\"_TypeStore\"]; });\n\n/* harmony import */ var _filesInputStore__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./filesInputStore */ \"./Misc/filesInputStore.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return _filesInputStore__WEBPACK_IMPORTED_MODULE_26__[\"FilesInputStore\"]; });\n\n/* harmony import */ var _deepCopier__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return _deepCopier__WEBPACK_IMPORTED_MODULE_27__[\"DeepCopier\"]; });\n\n/* harmony import */ var _pivotTools__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./pivotTools */ \"./Misc/pivotTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return _pivotTools__WEBPACK_IMPORTED_MODULE_28__[\"PivotTools\"]; });\n\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return _precisionDate__WEBPACK_IMPORTED_MODULE_29__[\"PrecisionDate\"]; });\n\n/* harmony import */ var _screenshotTools__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./screenshotTools */ \"./Misc/screenshotTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return _screenshotTools__WEBPACK_IMPORTED_MODULE_30__[\"ScreenshotTools\"]; });\n\n/* empty/unused harmony star reexport *//* harmony import */ var _webRequest__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./webRequest */ \"./Misc/webRequest.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return _webRequest__WEBPACK_IMPORTED_MODULE_31__[\"WebRequest\"]; });\n\n/* harmony import */ var _iInspectable__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./iInspectable */ \"./Misc/iInspectable.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return _iInspectable__WEBPACK_IMPORTED_MODULE_32__[\"InspectableType\"]; });\n\n/* harmony import */ var _brdfTextureTools__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./brdfTextureTools */ \"./Misc/brdfTextureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return _brdfTextureTools__WEBPACK_IMPORTED_MODULE_33__[\"BRDFTextureTools\"]; });\n\n/* harmony import */ var _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./rgbdTextureTools */ \"./Misc/rgbdTextureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_34__[\"RGBDTextureTools\"]; });\n\n/* harmony import */ var _gradients__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./gradients */ \"./Misc/gradients.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"ColorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"Color3Gradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"FactorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"GradientHelper\"]; });\n\n/* harmony import */ var _perfCounter__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./perfCounter */ \"./Misc/perfCounter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return _perfCounter__WEBPACK_IMPORTED_MODULE_36__[\"PerfCounter\"]; });\n\n/* harmony import */ var _retryStrategy__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./retryStrategy */ \"./Misc/retryStrategy.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return _retryStrategy__WEBPACK_IMPORTED_MODULE_37__[\"RetryStrategy\"]; });\n\n/* harmony import */ var _loadFileError__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./loadFileError */ \"./Misc/loadFileError.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return _loadFileError__WEBPACK_IMPORTED_MODULE_38__[\"LoadFileError\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/instantiationTools.ts\":\n/*!************************************!*\\\n !*** ./Misc/instantiationTools.ts ***!\n \\************************************/\n/*! exports provided: InstantiationTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstantiationTools\", function() { return InstantiationTools; });\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _typeStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n/**\r\n * Class used to enable instatition of objects by class name\r\n */\r\nvar InstantiationTools = /** @class */ (function () {\r\n function InstantiationTools() {\r\n }\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n InstantiationTools.Instantiate = function (className) {\r\n if (this.RegisteredExternalClasses && this.RegisteredExternalClasses[className]) {\r\n return this.RegisteredExternalClasses[className];\r\n }\r\n var internalClass = _typeStore__WEBPACK_IMPORTED_MODULE_1__[\"_TypeStore\"].GetClass(className);\r\n if (internalClass) {\r\n return internalClass;\r\n }\r\n _logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(className + \" not found, you may have missed an import.\");\r\n var arr = className.split(\".\");\r\n var fn = (window || this);\r\n for (var i = 0, len = arr.length; i < len; i++) {\r\n fn = fn[arr[i]];\r\n }\r\n if (typeof fn !== \"function\") {\r\n return null;\r\n }\r\n return fn;\r\n };\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n InstantiationTools.RegisteredExternalClasses = {};\r\n return InstantiationTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/khronosTextureContainer.ts\":\n/*!*****************************************!*\\\n !*** ./Misc/khronosTextureContainer.ts ***!\n \\*****************************************/\n/*! exports provided: KhronosTextureContainer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return KhronosTextureContainer; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\r\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\r\n */\r\nvar KhronosTextureContainer = /** @class */ (function () {\r\n /**\r\n * Creates a new KhronosTextureContainer\r\n * @param arrayBuffer contents of the KTX container file\r\n * @param facesExpected should be either 1 or 6, based whether a cube texture or or\r\n * @param threeDExpected provision for indicating that data should be a 3D texture, not implemented\r\n * @param textureArrayExpected provision for indicating that data should be a texture array, not implemented\r\n */\r\n function KhronosTextureContainer(\r\n /** contents of the KTX container file */\r\n arrayBuffer, facesExpected, threeDExpected, textureArrayExpected) {\r\n this.arrayBuffer = arrayBuffer;\r\n /**\r\n * If the container has been made invalid (eg. constructor failed to correctly load array buffer)\r\n */\r\n this.isInvalid = false;\r\n // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is:\r\n // '�', 'K', 'T', 'X', ' ', '1', '1', '�', '\\r', '\\n', '\\x1A', '\\n'\r\n // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A\r\n var identifier = new Uint8Array(this.arrayBuffer, 0, 12);\r\n if (identifier[0] !== 0xAB || identifier[1] !== 0x4B || identifier[2] !== 0x54 || identifier[3] !== 0x58 || identifier[4] !== 0x20 || identifier[5] !== 0x31 ||\r\n identifier[6] !== 0x31 || identifier[7] !== 0xBB || identifier[8] !== 0x0D || identifier[9] !== 0x0A || identifier[10] !== 0x1A || identifier[11] !== 0x0A) {\r\n this.isInvalid = true;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"texture missing KTX identifier\");\r\n return;\r\n }\r\n // load the reset of the header in native 32 bit uint\r\n var dataSize = Uint32Array.BYTES_PER_ELEMENT;\r\n var headerDataView = new DataView(this.arrayBuffer, 12, 13 * dataSize);\r\n var endianness = headerDataView.getUint32(0, true);\r\n var littleEndian = endianness === 0x04030201;\r\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures\r\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures\r\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures\r\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\r\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\r\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\r\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\r\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\r\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays\r\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6\r\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures\r\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data\r\n // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing.\r\n if (this.glType !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"only compressed formats currently supported\");\r\n return;\r\n }\r\n else {\r\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\r\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);\r\n }\r\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"only 2D textures currently supported\");\r\n return;\r\n }\r\n if (this.numberOfArrayElements !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"texture arrays not currently supported\");\r\n return;\r\n }\r\n if (this.numberOfFaces !== facesExpected) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"number of faces expected\" + facesExpected + \", but found \" + this.numberOfFaces);\r\n return;\r\n }\r\n // we now have a completely validated file, so could use existence of loadType as success\r\n // would need to make this more elaborate & adjust checks above to support more than one load type\r\n this.loadType = KhronosTextureContainer.COMPRESSED_2D;\r\n }\r\n /**\r\n * Uploads KTX content to a Babylon Texture.\r\n * It is assumed that the texture has already been created & is currently bound\r\n * @hidden\r\n */\r\n KhronosTextureContainer.prototype.uploadLevels = function (texture, loadMipmaps) {\r\n switch (this.loadType) {\r\n case KhronosTextureContainer.COMPRESSED_2D:\r\n this._upload2DCompressedLevels(texture, loadMipmaps);\r\n break;\r\n case KhronosTextureContainer.TEX_2D:\r\n case KhronosTextureContainer.COMPRESSED_3D:\r\n case KhronosTextureContainer.TEX_3D:\r\n }\r\n };\r\n KhronosTextureContainer.prototype._upload2DCompressedLevels = function (texture, loadMipmaps) {\r\n // initialize width & height for level 1\r\n var dataOffset = KhronosTextureContainer.HEADER_LEN + this.bytesOfKeyValueData;\r\n var width = this.pixelWidth;\r\n var height = this.pixelHeight;\r\n var mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;\r\n for (var level = 0; level < mipmapCount; level++) {\r\n var imageSize = new Int32Array(this.arrayBuffer, dataOffset, 1)[0]; // size per face, since not supporting array cubemaps\r\n dataOffset += 4; //image data starts from next multiple of 4 offset. Each face refers to same imagesize field above.\r\n for (var face = 0; face < this.numberOfFaces; face++) {\r\n var byteArray = new Uint8Array(this.arrayBuffer, dataOffset, imageSize);\r\n var engine = texture.getEngine();\r\n engine._uploadCompressedDataToTextureDirectly(texture, this.glInternalFormat, width, height, byteArray, face, level);\r\n dataOffset += imageSize; // add size of the image for the next face/mipmap\r\n dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image\r\n }\r\n width = Math.max(1.0, width * 0.5);\r\n height = Math.max(1.0, height * 0.5);\r\n }\r\n };\r\n KhronosTextureContainer.HEADER_LEN = 12 + (13 * 4); // identifier + header elements (not including key value meta-data pairs)\r\n // load types\r\n KhronosTextureContainer.COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()\r\n KhronosTextureContainer.COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\r\n KhronosTextureContainer.TEX_2D = 2; // uses a gl.texImage2D()\r\n KhronosTextureContainer.TEX_3D = 3; // uses a gl.texImage3D()\r\n return KhronosTextureContainer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/loadFileError.ts\":\n/*!*******************************!*\\\n !*** ./Misc/loadFileError.ts ***!\n \\*******************************/\n/*! exports provided: LoadFileError */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return LoadFileError; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * @ignore\r\n * Application error to support additional information when loading a file\r\n */\r\nvar LoadFileError = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LoadFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n function LoadFileError(message, \r\n /** defines the optional web request */\r\n request) {\r\n var _this = _super.call(this, message) || this;\r\n _this.request = request;\r\n _this.name = \"LoadFileError\";\r\n LoadFileError._setPrototypeOf(_this, LoadFileError.prototype);\r\n return _this;\r\n }\r\n // See https://stackoverflow.com/questions/12915412/how-do-i-extend-a-host-object-e-g-error-in-typescript\r\n // and https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n // Polyfill for Object.setPrototypeOf if necessary.\r\n LoadFileError._setPrototypeOf = Object.setPrototypeOf || (function (o, proto) { o.__proto__ = proto; return o; });\r\n return LoadFileError;\r\n}(Error));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/logger.ts\":\n/*!************************!*\\\n !*** ./Misc/logger.ts ***!\n \\************************/\n/*! exports provided: Logger */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return Logger; });\n/**\r\n * Logger used througouht the application to allow configuration of\r\n * the log level required for the messages.\r\n */\r\nvar Logger = /** @class */ (function () {\r\n function Logger() {\r\n }\r\n Logger._AddLogEntry = function (entry) {\r\n Logger._LogCache = entry + Logger._LogCache;\r\n if (Logger.OnNewCacheEntry) {\r\n Logger.OnNewCacheEntry(entry);\r\n }\r\n };\r\n Logger._FormatMessage = function (message) {\r\n var padStr = function (i) { return (i < 10) ? \"0\" + i : \"\" + i; };\r\n var date = new Date();\r\n return \"[\" + padStr(date.getHours()) + \":\" + padStr(date.getMinutes()) + \":\" + padStr(date.getSeconds()) + \"]: \" + message;\r\n };\r\n Logger._LogDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._LogEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.log(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._WarnDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._WarnEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.warn(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._ErrorDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._ErrorEnabled = function (message) {\r\n Logger.errorsCount++;\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.error(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Object.defineProperty(Logger, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return Logger._LogCache;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Logger.ClearLogCache = function () {\r\n Logger._LogCache = \"\";\r\n Logger.errorsCount = 0;\r\n };\r\n Object.defineProperty(Logger, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n if ((level & Logger.MessageLogLevel) === Logger.MessageLogLevel) {\r\n Logger.Log = Logger._LogEnabled;\r\n }\r\n else {\r\n Logger.Log = Logger._LogDisabled;\r\n }\r\n if ((level & Logger.WarningLogLevel) === Logger.WarningLogLevel) {\r\n Logger.Warn = Logger._WarnEnabled;\r\n }\r\n else {\r\n Logger.Warn = Logger._WarnDisabled;\r\n }\r\n if ((level & Logger.ErrorLogLevel) === Logger.ErrorLogLevel) {\r\n Logger.Error = Logger._ErrorEnabled;\r\n }\r\n else {\r\n Logger.Error = Logger._ErrorDisabled;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * No log\r\n */\r\n Logger.NoneLogLevel = 0;\r\n /**\r\n * Only message logs\r\n */\r\n Logger.MessageLogLevel = 1;\r\n /**\r\n * Only warning logs\r\n */\r\n Logger.WarningLogLevel = 2;\r\n /**\r\n * Only error logs\r\n */\r\n Logger.ErrorLogLevel = 4;\r\n /**\r\n * All logs\r\n */\r\n Logger.AllLogLevel = 7;\r\n Logger._LogCache = \"\";\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n Logger.errorsCount = 0;\r\n /**\r\n * Log a message to the console\r\n */\r\n Logger.Log = Logger._LogEnabled;\r\n /**\r\n * Write a warning message to the console\r\n */\r\n Logger.Warn = Logger._WarnEnabled;\r\n /**\r\n * Write an error message to the console\r\n */\r\n Logger.Error = Logger._ErrorEnabled;\r\n return Logger;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/meshExploder.ts\":\n/*!******************************!*\\\n !*** ./Misc/meshExploder.ts ***!\n \\******************************/\n/*! exports provided: MeshExploder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return MeshExploder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)\r\n */\r\nvar MeshExploder = /** @class */ (function () {\r\n /**\r\n * Explodes meshes from a center mesh.\r\n * @param meshes The meshes to explode.\r\n * @param centerMesh The mesh to be center of explosion.\r\n */\r\n function MeshExploder(meshes, centerMesh) {\r\n this._meshesOrigins = [];\r\n this._toCenterVectors = [];\r\n this._scaledDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._centerPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._meshes = meshes.slice();\r\n if (centerMesh) {\r\n this._centerMesh = centerMesh;\r\n }\r\n else {\r\n this._setCenterMesh();\r\n }\r\n var centerMeshIndex = this._meshes.indexOf(this._centerMesh);\r\n if (centerMeshIndex >= 0) {\r\n this._meshes.splice(centerMeshIndex, 1);\r\n }\r\n this._centerPosition = this._centerMesh.getAbsolutePosition().clone();\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index]) {\r\n var mesh = this._meshes[index];\r\n this._meshesOrigins[index] = mesh.getAbsolutePosition().clone();\r\n this._toCenterVectors[index] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n if (mesh._boundingInfo && this._centerMesh._boundingInfo) {\r\n mesh._boundingInfo.boundingBox.centerWorld.subtractToRef(this._centerMesh._boundingInfo.boundingBox.centerWorld, this._toCenterVectors[index]);\r\n }\r\n }\r\n }\r\n }\r\n MeshExploder.prototype._setCenterMesh = function () {\r\n var averageCenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var totalCenters = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var shortestToCenter = Number.MAX_VALUE;\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index]) {\r\n var mesh = this._meshes[index];\r\n var boundingInfo = mesh.getBoundingInfo();\r\n if (boundingInfo) {\r\n totalCenters.addInPlace(boundingInfo.boundingBox.centerWorld);\r\n }\r\n }\r\n }\r\n averageCenter = totalCenters.scale(1 / this._meshes.length);\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index]) {\r\n var mesh = this._meshes[index];\r\n var boundingInfo = mesh.getBoundingInfo();\r\n if (boundingInfo) {\r\n var distanceToCenter = boundingInfo.boundingBox.centerWorld.subtract(averageCenter).lengthSquared();\r\n if (distanceToCenter < shortestToCenter) {\r\n this._centerMesh = mesh;\r\n shortestToCenter = distanceToCenter;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Get class name\r\n * @returns \"MeshExploder\"\r\n */\r\n MeshExploder.prototype.getClassName = function () {\r\n return \"MeshExploder\";\r\n };\r\n /**\r\n * \"Exploded meshes\"\r\n * @returns Array of meshes with the centerMesh at index 0.\r\n */\r\n MeshExploder.prototype.getMeshes = function () {\r\n var meshArray = this._meshes.slice();\r\n meshArray.unshift(this._centerMesh);\r\n return meshArray;\r\n };\r\n /**\r\n * Explodes meshes giving a specific direction\r\n * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.\r\n */\r\n MeshExploder.prototype.explode = function (direction) {\r\n if (direction === void 0) { direction = 1.0; }\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index] && this._meshesOrigins[index] && this._toCenterVectors[index]) {\r\n this._toCenterVectors[index].scaleToRef(direction, this._scaledDirection);\r\n this._meshesOrigins[index].addToRef(this._scaledDirection, this._newPosition);\r\n this._meshes[index].setAbsolutePosition(this._newPosition);\r\n }\r\n }\r\n this._centerMesh.setAbsolutePosition(this._centerPosition);\r\n };\r\n return MeshExploder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/observable.ts\":\n/*!****************************!*\\\n !*** ./Misc/observable.ts ***!\n \\****************************/\n/*! exports provided: EventState, Observer, MultiObserver, Observable */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return EventState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return Observer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return MultiObserver; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return Observable; });\n/**\r\n * A class serves as a medium between the observable and its observers\r\n */\r\nvar EventState = /** @class */ (function () {\r\n /**\r\n * Create a new EventState\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n */\r\n function EventState(mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.initalize(mask, skipNextObservers, target, currentTarget);\r\n }\r\n /**\r\n * Initialize the current event state\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @returns the current event state\r\n */\r\n EventState.prototype.initalize = function (mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.mask = mask;\r\n this.skipNextObservers = skipNextObservers;\r\n this.target = target;\r\n this.currentTarget = currentTarget;\r\n return this;\r\n };\r\n return EventState;\r\n}());\r\n\r\n/**\r\n * Represent an Observer registered to a given Observable object.\r\n */\r\nvar Observer = /** @class */ (function () {\r\n /**\r\n * Creates a new observer\r\n * @param callback defines the callback to call when the observer is notified\r\n * @param mask defines the mask of the observer (used to filter notifications)\r\n * @param scope defines the current scope used to restore the JS context\r\n */\r\n function Observer(\r\n /**\r\n * Defines the callback to call when the observer is notified\r\n */\r\n callback, \r\n /**\r\n * Defines the mask of the observer (used to filter notifications)\r\n */\r\n mask, \r\n /**\r\n * Defines the current scope used to restore the JS context\r\n */\r\n scope) {\r\n if (scope === void 0) { scope = null; }\r\n this.callback = callback;\r\n this.mask = mask;\r\n this.scope = scope;\r\n /** @hidden */\r\n this._willBeUnregistered = false;\r\n /**\r\n * Gets or sets a property defining that the observer as to be unregistered after the next notification\r\n */\r\n this.unregisterOnNextCall = false;\r\n }\r\n return Observer;\r\n}());\r\n\r\n/**\r\n * Represent a list of observers registered to multiple Observables object.\r\n */\r\nvar MultiObserver = /** @class */ (function () {\r\n function MultiObserver() {\r\n }\r\n /**\r\n * Release associated resources\r\n */\r\n MultiObserver.prototype.dispose = function () {\r\n if (this._observers && this._observables) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n this._observables[index].remove(this._observers[index]);\r\n }\r\n }\r\n this._observers = null;\r\n this._observables = null;\r\n };\r\n /**\r\n * Raise a callback when one of the observable will notify\r\n * @param observables defines a list of observables to watch\r\n * @param callback defines the callback to call on notification\r\n * @param mask defines the mask used to filter notifications\r\n * @param scope defines the current scope used to restore the JS context\r\n * @returns the new MultiObserver\r\n */\r\n MultiObserver.Watch = function (observables, callback, mask, scope) {\r\n if (mask === void 0) { mask = -1; }\r\n if (scope === void 0) { scope = null; }\r\n var result = new MultiObserver();\r\n result._observers = new Array();\r\n result._observables = observables;\r\n for (var _i = 0, observables_1 = observables; _i < observables_1.length; _i++) {\r\n var observable = observables_1[_i];\r\n var observer = observable.add(callback, mask, false, scope);\r\n if (observer) {\r\n result._observers.push(observer);\r\n }\r\n }\r\n return result;\r\n };\r\n return MultiObserver;\r\n}());\r\n\r\n/**\r\n * The Observable class is a simple implementation of the Observable pattern.\r\n *\r\n * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.\r\n * This enable a more fine grained execution without having to rely on multiple different Observable objects.\r\n * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).\r\n * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.\r\n */\r\nvar Observable = /** @class */ (function () {\r\n /**\r\n * Creates a new observable\r\n * @param onObserverAdded defines a callback to call when a new observer is added\r\n */\r\n function Observable(onObserverAdded) {\r\n this._observers = new Array();\r\n this._eventState = new EventState(0);\r\n if (onObserverAdded) {\r\n this._onObserverAdded = onObserverAdded;\r\n }\r\n }\r\n Object.defineProperty(Observable.prototype, \"observers\", {\r\n /**\r\n * Gets the list of observers\r\n */\r\n get: function () {\r\n return this._observers;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new Observer with the specified callback\r\n * @param callback the callback that will be executed for that Observer\r\n * @param mask the mask used to filter observers\r\n * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.\r\n * @param scope optional scope for the callback to be called from\r\n * @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.add = function (callback, mask, insertFirst, scope, unregisterOnFirstCall) {\r\n if (mask === void 0) { mask = -1; }\r\n if (insertFirst === void 0) { insertFirst = false; }\r\n if (scope === void 0) { scope = null; }\r\n if (unregisterOnFirstCall === void 0) { unregisterOnFirstCall = false; }\r\n if (!callback) {\r\n return null;\r\n }\r\n var observer = new Observer(callback, mask, scope);\r\n observer.unregisterOnNextCall = unregisterOnFirstCall;\r\n if (insertFirst) {\r\n this._observers.unshift(observer);\r\n }\r\n else {\r\n this._observers.push(observer);\r\n }\r\n if (this._onObserverAdded) {\r\n this._onObserverAdded(observer);\r\n }\r\n return observer;\r\n };\r\n /**\r\n * Create a new Observer with the specified callback and unregisters after the next notification\r\n * @param callback the callback that will be executed for that Observer\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.addOnce = function (callback) {\r\n return this.add(callback, undefined, undefined, undefined, true);\r\n };\r\n /**\r\n * Remove an Observer from the Observable object\r\n * @param observer the instance of the Observer to remove\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Remove a callback from the Observable object\r\n * @param callback the callback to remove\r\n * @param scope optional scope. If used only the callbacks with this scope will be removed\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.removeCallback = function (callback, scope) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n var observer = this._observers[index];\r\n if (observer._willBeUnregistered) {\r\n continue;\r\n }\r\n if (observer.callback === callback && (!scope || scope === observer.scope)) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Observable.prototype._deferUnregister = function (observer) {\r\n var _this = this;\r\n observer.unregisterOnNextCall = false;\r\n observer._willBeUnregistered = true;\r\n setTimeout(function () {\r\n _this._remove(observer);\r\n }, 0);\r\n };\r\n // This should only be called when not iterating over _observers to avoid callback skipping.\r\n // Removes an observer from the _observer Array.\r\n Observable.prototype._remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._observers.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Moves the observable to the top of the observer list making it get called first when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverTopPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.unshift(observer);\r\n };\r\n /**\r\n * Moves the observable to the bottom of the observer list making it get called last when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverBottomPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.push(observer);\r\n };\r\n /**\r\n * Notify all Observers by calling their respective callback with the given data\r\n * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute\r\n * @param eventData defines the data to send to all observers\r\n * @param mask defines the mask of the current notification (observers with incompatible mask (ie mask & observer.mask === 0) will not be notified)\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true)\r\n */\r\n Observable.prototype.notifyObservers = function (eventData, mask, target, currentTarget) {\r\n if (mask === void 0) { mask = -1; }\r\n if (!this._observers.length) {\r\n return true;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n state.lastReturnValue = eventData;\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs._willBeUnregistered) {\r\n continue;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n state.lastReturnValue = obs.callback.apply(obs.scope, [eventData, state]);\r\n }\r\n else {\r\n state.lastReturnValue = obs.callback(eventData, state);\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n this._deferUnregister(obs);\r\n }\r\n }\r\n if (state.skipNextObservers) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Calling this will execute each callback, expecting it to be a promise or return a value.\r\n * If at any point in the chain one function fails, the promise will fail and the execution will not continue.\r\n * This is useful when a chain of events (sometimes async events) is needed to initialize a certain object\r\n * and it is crucial that all callbacks will be executed.\r\n * The order of the callbacks is kept, callbacks are not executed parallel.\r\n *\r\n * @param eventData The data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n * @param target defines the callback target (see EventState)\r\n * @param currentTarget defines he current object in the bubbling phase\r\n * @returns {Promise} will return a Promise than resolves when all callbacks executed successfully.\r\n */\r\n Observable.prototype.notifyObserversWithPromise = function (eventData, mask, target, currentTarget) {\r\n var _this = this;\r\n if (mask === void 0) { mask = -1; }\r\n // create an empty promise\r\n var p = Promise.resolve(eventData);\r\n // no observers? return this promise.\r\n if (!this._observers.length) {\r\n return p;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n // execute one callback after another (not using Promise.all, the order is important)\r\n this._observers.forEach(function (obs) {\r\n if (state.skipNextObservers) {\r\n return;\r\n }\r\n if (obs._willBeUnregistered) {\r\n return;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback.apply(obs.scope, [eventData, state]);\r\n });\r\n }\r\n else {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback(eventData, state);\r\n });\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n _this._deferUnregister(obs);\r\n }\r\n }\r\n });\r\n // return the eventData\r\n return p.then(function () { return eventData; });\r\n };\r\n /**\r\n * Notify a specific observer\r\n * @param observer defines the observer to notify\r\n * @param eventData defines the data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n */\r\n Observable.prototype.notifyObserver = function (observer, eventData, mask) {\r\n if (mask === void 0) { mask = -1; }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.skipNextObservers = false;\r\n observer.callback(eventData, state);\r\n };\r\n /**\r\n * Gets a boolean indicating if the observable has at least one observer\r\n * @returns true is the Observable has at least one Observer registered\r\n */\r\n Observable.prototype.hasObservers = function () {\r\n return this._observers.length > 0;\r\n };\r\n /**\r\n * Clear the list of observers\r\n */\r\n Observable.prototype.clear = function () {\r\n this._observers = new Array();\r\n this._onObserverAdded = null;\r\n };\r\n /**\r\n * Clone the current observable\r\n * @returns a new observable\r\n */\r\n Observable.prototype.clone = function () {\r\n var result = new Observable();\r\n result._observers = this._observers.slice(0);\r\n return result;\r\n };\r\n /**\r\n * Does this observable handles observer registered with a given mask\r\n * @param mask defines the mask to be tested\r\n * @return whether or not one observer registered with the given mask is handeled\r\n **/\r\n Observable.prototype.hasSpecificMask = function (mask) {\r\n if (mask === void 0) { mask = -1; }\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs.mask & mask || obs.mask === mask) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n return Observable;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/perfCounter.ts\":\n/*!*****************************!*\\\n !*** ./Misc/perfCounter.ts ***!\n \\*****************************/\n/*! exports provided: PerfCounter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return PerfCounter; });\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n\r\n/**\r\n * This class is used to track a performance counter which is number based.\r\n * The user has access to many properties which give statistics of different nature.\r\n *\r\n * The implementer can track two kinds of Performance Counter: time and count.\r\n * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.\r\n * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.\r\n */\r\nvar PerfCounter = /** @class */ (function () {\r\n /**\r\n * Creates a new counter\r\n */\r\n function PerfCounter() {\r\n this._startMonitoringTime = 0;\r\n this._min = 0;\r\n this._max = 0;\r\n this._average = 0;\r\n this._lastSecAverage = 0;\r\n this._current = 0;\r\n this._totalValueCount = 0;\r\n this._totalAccumulated = 0;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecTime = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n Object.defineProperty(PerfCounter.prototype, \"min\", {\r\n /**\r\n * Returns the smallest value ever\r\n */\r\n get: function () {\r\n return this._min;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"max\", {\r\n /**\r\n * Returns the biggest value ever\r\n */\r\n get: function () {\r\n return this._max;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"average\", {\r\n /**\r\n * Returns the average value since the performance counter is running\r\n */\r\n get: function () {\r\n return this._average;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"lastSecAverage\", {\r\n /**\r\n * Returns the average value of the last second the counter was monitored\r\n */\r\n get: function () {\r\n return this._lastSecAverage;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"current\", {\r\n /**\r\n * Returns the current value\r\n */\r\n get: function () {\r\n return this._current;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"total\", {\r\n /**\r\n * Gets the accumulated total\r\n */\r\n get: function () {\r\n return this._totalAccumulated;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"count\", {\r\n /**\r\n * Gets the total value count\r\n */\r\n get: function () {\r\n return this._totalValueCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Call this method to start monitoring a new frame.\r\n * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.\r\n */\r\n PerfCounter.prototype.fetchNewFrame = function () {\r\n this._totalValueCount++;\r\n this._current = 0;\r\n this._lastSecValueCount++;\r\n };\r\n /**\r\n * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)\r\n * @param newCount the count value to add to the monitored count\r\n * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.\r\n */\r\n PerfCounter.prototype.addCount = function (newCount, fetchResult) {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._current += newCount;\r\n if (fetchResult) {\r\n this._fetchResult();\r\n }\r\n };\r\n /**\r\n * Start monitoring this performance counter\r\n */\r\n PerfCounter.prototype.beginMonitoring = function () {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._startMonitoringTime = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now;\r\n };\r\n /**\r\n * Compute the time lapsed since the previous beginMonitoring() call.\r\n * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter\r\n */\r\n PerfCounter.prototype.endMonitoring = function (newFrame) {\r\n if (newFrame === void 0) { newFrame = true; }\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n if (newFrame) {\r\n this.fetchNewFrame();\r\n }\r\n var currentTime = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now;\r\n this._current = currentTime - this._startMonitoringTime;\r\n if (newFrame) {\r\n this._fetchResult();\r\n }\r\n };\r\n PerfCounter.prototype._fetchResult = function () {\r\n this._totalAccumulated += this._current;\r\n this._lastSecAccumulated += this._current;\r\n // Min/Max update\r\n this._min = Math.min(this._min, this._current);\r\n this._max = Math.max(this._max, this._current);\r\n this._average = this._totalAccumulated / this._totalValueCount;\r\n // Reset last sec?\r\n var now = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now;\r\n if ((now - this._lastSecTime) > 1000) {\r\n this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount;\r\n this._lastSecTime = now;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n };\r\n /**\r\n * Gets or sets a global boolean to turn on and off all the counters\r\n */\r\n PerfCounter.Enabled = true;\r\n return PerfCounter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/performanceMonitor.ts\":\n/*!************************************!*\\\n !*** ./Misc/performanceMonitor.ts ***!\n \\************************************/\n/*! exports provided: PerformanceMonitor, RollingAverage */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return PerformanceMonitor; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return RollingAverage; });\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n\r\n/**\r\n * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window\r\n */\r\nvar PerformanceMonitor = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param frameSampleSize The number of samples required to saturate the sliding window\r\n */\r\n function PerformanceMonitor(frameSampleSize) {\r\n if (frameSampleSize === void 0) { frameSampleSize = 30; }\r\n this._enabled = true;\r\n this._rollingFrameTime = new RollingAverage(frameSampleSize);\r\n }\r\n /**\r\n * Samples current frame\r\n * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames\r\n */\r\n PerformanceMonitor.prototype.sampleFrame = function (timeMs) {\r\n if (timeMs === void 0) { timeMs = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now; }\r\n if (!this._enabled) {\r\n return;\r\n }\r\n if (this._lastFrameTimeMs != null) {\r\n var dt = timeMs - this._lastFrameTimeMs;\r\n this._rollingFrameTime.add(dt);\r\n }\r\n this._lastFrameTimeMs = timeMs;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTime\", {\r\n /**\r\n * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.average;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTimeVariance\", {\r\n /**\r\n * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.variance;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFrameTime\", {\r\n /**\r\n * Returns the frame time of the most recent frame\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.history(0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return 1000.0 / this._rollingFrameTime.average;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second using the most recent frame time\r\n */\r\n get: function () {\r\n var history = this._rollingFrameTime.history(0);\r\n if (history === 0) {\r\n return 0;\r\n }\r\n return 1000.0 / history;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isSaturated\", {\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.isSaturated();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Enables contributions to the sliding window sample set\r\n */\r\n PerformanceMonitor.prototype.enable = function () {\r\n this._enabled = true;\r\n };\r\n /**\r\n * Disables contributions to the sliding window sample set\r\n * Samples will not be interpolated over the disabled period\r\n */\r\n PerformanceMonitor.prototype.disable = function () {\r\n this._enabled = false;\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isEnabled\", {\r\n /**\r\n * Returns true if sampling is enabled\r\n */\r\n get: function () {\r\n return this._enabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets performance monitor\r\n */\r\n PerformanceMonitor.prototype.reset = function () {\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n //wipe record\r\n this._rollingFrameTime.reset();\r\n };\r\n return PerformanceMonitor;\r\n}());\r\n\r\n/**\r\n * RollingAverage\r\n *\r\n * Utility to efficiently compute the rolling average and variance over a sliding window of samples\r\n */\r\nvar RollingAverage = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param length The number of samples required to saturate the sliding window\r\n */\r\n function RollingAverage(length) {\r\n this._samples = new Array(length);\r\n this.reset();\r\n }\r\n /**\r\n * Adds a sample to the sample set\r\n * @param v The sample value\r\n */\r\n RollingAverage.prototype.add = function (v) {\r\n //http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance\r\n var delta;\r\n //we need to check if we've already wrapped round\r\n if (this.isSaturated()) {\r\n //remove bottom of stack from mean\r\n var bottomValue = this._samples[this._pos];\r\n delta = bottomValue - this.average;\r\n this.average -= delta / (this._sampleCount - 1);\r\n this._m2 -= delta * (bottomValue - this.average);\r\n }\r\n else {\r\n this._sampleCount++;\r\n }\r\n //add new value to mean\r\n delta = v - this.average;\r\n this.average += delta / (this._sampleCount);\r\n this._m2 += delta * (v - this.average);\r\n //set the new variance\r\n this.variance = this._m2 / (this._sampleCount - 1);\r\n this._samples[this._pos] = v;\r\n this._pos++;\r\n this._pos %= this._samples.length; //positive wrap around\r\n };\r\n /**\r\n * Returns previously added values or null if outside of history or outside the sliding window domain\r\n * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that\r\n * @return Value previously recorded with add() or null if outside of range\r\n */\r\n RollingAverage.prototype.history = function (i) {\r\n if ((i >= this._sampleCount) || (i >= this._samples.length)) {\r\n return 0;\r\n }\r\n var i0 = this._wrapPosition(this._pos - 1.0);\r\n return this._samples[this._wrapPosition(i0 - i)];\r\n };\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n * @return true if sample-set saturated\r\n */\r\n RollingAverage.prototype.isSaturated = function () {\r\n return this._sampleCount >= this._samples.length;\r\n };\r\n /**\r\n * Resets the rolling average (equivalent to 0 samples taken so far)\r\n */\r\n RollingAverage.prototype.reset = function () {\r\n this.average = 0;\r\n this.variance = 0;\r\n this._sampleCount = 0;\r\n this._pos = 0;\r\n this._m2 = 0;\r\n };\r\n /**\r\n * Wraps a value around the sample range boundaries\r\n * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.\r\n * @return Wrapped position in sample range\r\n */\r\n RollingAverage.prototype._wrapPosition = function (i) {\r\n var max = this._samples.length;\r\n return ((i % max) + max) % max;\r\n };\r\n return RollingAverage;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/pivotTools.ts\":\n/*!****************************!*\\\n !*** ./Misc/pivotTools.ts ***!\n \\****************************/\n/*! exports provided: PivotTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return PivotTools; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Class containing a set of static utilities functions for managing Pivots\r\n * @hidden\r\n */\r\nvar PivotTools = /** @class */ (function () {\r\n function PivotTools() {\r\n }\r\n /** @hidden */\r\n PivotTools._RemoveAndStorePivotPoint = function (mesh) {\r\n if (mesh && PivotTools._PivotCached === 0) {\r\n // Save old pivot and set pivot to 0,0,0\r\n mesh.getPivotPointToRef(PivotTools._OldPivotPoint);\r\n if (!PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0)) {\r\n mesh.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].IdentityReadOnly);\r\n PivotTools._OldPivotPoint.subtractToRef(mesh.getPivotPoint(), PivotTools._PivotTranslation);\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.addInPlace(PivotTools._PivotTmpVector);\r\n }\r\n }\r\n PivotTools._PivotCached++;\r\n };\r\n /** @hidden */\r\n PivotTools._RestorePivotPoint = function (mesh) {\r\n if (mesh && !PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0) && PivotTools._PivotCached === 1) {\r\n mesh.setPivotPoint(PivotTools._OldPivotPoint);\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.subtractInPlace(PivotTools._PivotTmpVector);\r\n }\r\n this._PivotCached--;\r\n };\r\n // Stores the state of the pivot cache (_oldPivotPoint, _pivotTranslation)\r\n // store/remove pivot point should only be applied during their outermost calls\r\n PivotTools._PivotCached = 0;\r\n PivotTools._OldPivotPoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n PivotTools._PivotTranslation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n PivotTools._PivotTmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n return PivotTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/precisionDate.ts\":\n/*!*******************************!*\\\n !*** ./Misc/precisionDate.ts ***!\n \\*******************************/\n/*! exports provided: PrecisionDate */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return PrecisionDate; });\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n\r\n/**\r\n * Class containing a set of static utilities functions for precision date\r\n */\r\nvar PrecisionDate = /** @class */ (function () {\r\n function PrecisionDate() {\r\n }\r\n Object.defineProperty(PrecisionDate, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n if (_domManagement__WEBPACK_IMPORTED_MODULE_0__[\"DomManagement\"].IsWindowObjectExist() && window.performance && window.performance.now) {\r\n return window.performance.now();\r\n }\r\n return Date.now();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PrecisionDate;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/promise.ts\":\n/*!*************************!*\\\n !*** ./Misc/promise.ts ***!\n \\*************************/\n/*! exports provided: PromisePolyfill */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return PromisePolyfill; });\nvar PromiseStates;\r\n(function (PromiseStates) {\r\n PromiseStates[PromiseStates[\"Pending\"] = 0] = \"Pending\";\r\n PromiseStates[PromiseStates[\"Fulfilled\"] = 1] = \"Fulfilled\";\r\n PromiseStates[PromiseStates[\"Rejected\"] = 2] = \"Rejected\";\r\n})(PromiseStates || (PromiseStates = {}));\r\nvar FulFillmentAgregator = /** @class */ (function () {\r\n function FulFillmentAgregator() {\r\n this.count = 0;\r\n this.target = 0;\r\n this.results = [];\r\n }\r\n return FulFillmentAgregator;\r\n}());\r\nvar InternalPromise = /** @class */ (function () {\r\n function InternalPromise(resolver) {\r\n var _this = this;\r\n this._state = PromiseStates.Pending;\r\n this._children = new Array();\r\n this._rejectWasConsumed = false;\r\n if (!resolver) {\r\n return;\r\n }\r\n try {\r\n resolver(function (value) {\r\n _this._resolve(value);\r\n }, function (reason) {\r\n _this._reject(reason);\r\n });\r\n }\r\n catch (e) {\r\n this._reject(e);\r\n }\r\n }\r\n Object.defineProperty(InternalPromise.prototype, \"_result\", {\r\n get: function () {\r\n return this._resultValue;\r\n },\r\n set: function (value) {\r\n this._resultValue = value;\r\n if (this._parent && this._parent._result === undefined) {\r\n this._parent._result = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InternalPromise.prototype.catch = function (onRejected) {\r\n return this.then(undefined, onRejected);\r\n };\r\n InternalPromise.prototype.then = function (onFulfilled, onRejected) {\r\n var _this = this;\r\n var newPromise = new InternalPromise();\r\n newPromise._onFulfilled = onFulfilled;\r\n newPromise._onRejected = onRejected;\r\n // Composition\r\n this._children.push(newPromise);\r\n newPromise._parent = this;\r\n if (this._state !== PromiseStates.Pending) {\r\n setTimeout(function () {\r\n if (_this._state === PromiseStates.Fulfilled || _this._rejectWasConsumed) {\r\n var returnedValue = newPromise._resolve(_this._result);\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n var returnedPromise = returnedValue;\r\n newPromise._children.push(returnedPromise);\r\n returnedPromise._parent = newPromise;\r\n newPromise = returnedPromise;\r\n }\r\n else {\r\n newPromise._result = returnedValue;\r\n }\r\n }\r\n }\r\n else {\r\n newPromise._reject(_this._reason);\r\n }\r\n });\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.prototype._moveChildren = function (children) {\r\n var _a;\r\n var _this = this;\r\n (_a = this._children).push.apply(_a, children.splice(0, children.length));\r\n this._children.forEach(function (child) {\r\n child._parent = _this;\r\n });\r\n if (this._state === PromiseStates.Fulfilled) {\r\n for (var _i = 0, _b = this._children; _i < _b.length; _i++) {\r\n var child = _b[_i];\r\n child._resolve(this._result);\r\n }\r\n }\r\n else if (this._state === PromiseStates.Rejected) {\r\n for (var _c = 0, _d = this._children; _c < _d.length; _c++) {\r\n var child = _d[_c];\r\n child._reject(this._reason);\r\n }\r\n }\r\n };\r\n InternalPromise.prototype._resolve = function (value) {\r\n try {\r\n this._state = PromiseStates.Fulfilled;\r\n var returnedValue = null;\r\n if (this._onFulfilled) {\r\n returnedValue = this._onFulfilled(value);\r\n }\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n // Transmit children\r\n var returnedPromise = returnedValue;\r\n returnedPromise._parent = this;\r\n returnedPromise._moveChildren(this._children);\r\n value = returnedPromise._result;\r\n }\r\n else {\r\n value = returnedValue;\r\n }\r\n }\r\n this._result = value;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._resolve(value);\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n }\r\n catch (e) {\r\n this._reject(e, true);\r\n }\r\n };\r\n InternalPromise.prototype._reject = function (reason, onLocalThrow) {\r\n if (onLocalThrow === void 0) { onLocalThrow = false; }\r\n this._state = PromiseStates.Rejected;\r\n this._reason = reason;\r\n if (this._onRejected && !onLocalThrow) {\r\n try {\r\n this._onRejected(reason);\r\n this._rejectWasConsumed = true;\r\n }\r\n catch (e) {\r\n reason = e;\r\n }\r\n }\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (this._rejectWasConsumed) {\r\n child._resolve(null);\r\n }\r\n else {\r\n child._reject(reason);\r\n }\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n };\r\n InternalPromise.resolve = function (value) {\r\n var newPromise = new InternalPromise();\r\n newPromise._resolve(value);\r\n return newPromise;\r\n };\r\n InternalPromise._RegisterForFulfillment = function (promise, agregator, index) {\r\n promise.then(function (value) {\r\n agregator.results[index] = value;\r\n agregator.count++;\r\n if (agregator.count === agregator.target) {\r\n agregator.rootPromise._resolve(agregator.results);\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (agregator.rootPromise._state !== PromiseStates.Rejected) {\r\n agregator.rootPromise._reject(reason);\r\n }\r\n });\r\n };\r\n InternalPromise.all = function (promises) {\r\n var newPromise = new InternalPromise();\r\n var agregator = new FulFillmentAgregator();\r\n agregator.target = promises.length;\r\n agregator.rootPromise = newPromise;\r\n if (promises.length) {\r\n for (var index = 0; index < promises.length; index++) {\r\n InternalPromise._RegisterForFulfillment(promises[index], agregator, index);\r\n }\r\n }\r\n else {\r\n newPromise._resolve([]);\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.race = function (promises) {\r\n var newPromise = new InternalPromise();\r\n if (promises.length) {\r\n for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {\r\n var promise = promises_1[_i];\r\n promise.then(function (value) {\r\n if (newPromise) {\r\n newPromise._resolve(value);\r\n newPromise = null;\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (newPromise) {\r\n newPromise._reject(reason);\r\n newPromise = null;\r\n }\r\n });\r\n }\r\n }\r\n return newPromise;\r\n };\r\n return InternalPromise;\r\n}());\r\n/**\r\n * Helper class that provides a small promise polyfill\r\n */\r\nvar PromisePolyfill = /** @class */ (function () {\r\n function PromisePolyfill() {\r\n }\r\n /**\r\n * Static function used to check if the polyfill is required\r\n * If this is the case then the function will inject the polyfill to window.Promise\r\n * @param force defines a boolean used to force the injection (mostly for testing purposes)\r\n */\r\n PromisePolyfill.Apply = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (force || typeof Promise === 'undefined') {\r\n var root = window;\r\n root.Promise = InternalPromise;\r\n }\r\n };\r\n return PromisePolyfill;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/retryStrategy.ts\":\n/*!*******************************!*\\\n !*** ./Misc/retryStrategy.ts ***!\n \\*******************************/\n/*! exports provided: RetryStrategy */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return RetryStrategy; });\n/**\r\n * Class used to define a retry strategy when error happens while loading assets\r\n */\r\nvar RetryStrategy = /** @class */ (function () {\r\n function RetryStrategy() {\r\n }\r\n /**\r\n * Function used to defines an exponential back off strategy\r\n * @param maxRetries defines the maximum number of retries (3 by default)\r\n * @param baseInterval defines the interval between retries\r\n * @returns the strategy function to use\r\n */\r\n RetryStrategy.ExponentialBackoff = function (maxRetries, baseInterval) {\r\n if (maxRetries === void 0) { maxRetries = 3; }\r\n if (baseInterval === void 0) { baseInterval = 500; }\r\n return function (url, request, retryIndex) {\r\n if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf(\"file:\") !== -1) {\r\n return -1;\r\n }\r\n return Math.pow(2, retryIndex) * baseInterval;\r\n };\r\n };\r\n return RetryStrategy;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/rgbdTextureTools.ts\":\n/*!**********************************!*\\\n !*** ./Misc/rgbdTextureTools.ts ***!\n \\**********************************/\n/*! exports provided: RGBDTextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return RGBDTextureTools; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_rgbdDecode_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/rgbdDecode.fragment */ \"./Shaders/rgbdDecode.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to host RGBD texture specific utilities\r\n */\r\nvar RGBDTextureTools = /** @class */ (function () {\r\n function RGBDTextureTools() {\r\n }\r\n /**\r\n * Expand the RGBD Texture from RGBD to Half Float if possible.\r\n * @param texture the texture to expand.\r\n */\r\n RGBDTextureTools.ExpandRGBDTexture = function (texture) {\r\n var internalTexture = texture._texture;\r\n if (!internalTexture || !texture.isRGBD) {\r\n return;\r\n }\r\n texture.onLoadObservable.addOnce(function () {\r\n // Gets everything ready.\r\n var engine = internalTexture.getEngine();\r\n var caps = engine.getCaps();\r\n var expandTexture = false;\r\n // If half float available we can uncompress the texture\r\n if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Do not use during decode.\r\n internalTexture.isReady = false;\r\n // Simply run through the decode PP.\r\n var rgbdPostProcess_1 = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"](\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE, engine, false, undefined, internalTexture.type, undefined, null, false);\r\n internalTexture._isRGBD = false;\r\n internalTexture.invertY = false;\r\n // Hold the output of the decoding.\r\n var expandedTexture_1 = engine.createRenderTargetTexture(internalTexture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n generateStencilBuffer: false,\r\n samplingMode: internalTexture.samplingMode,\r\n type: internalTexture.type,\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTUREFORMAT_RGBA\r\n });\r\n rgbdPostProcess_1.getEffect().executeWhenCompiled(function () {\r\n // PP Render Pass\r\n rgbdPostProcess_1.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", internalTexture);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess_1], expandedTexture_1, true);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n engine._releaseTexture(internalTexture);\r\n engine._releaseFramebufferObjects(expandedTexture_1);\r\n if (rgbdPostProcess_1) {\r\n rgbdPostProcess_1.dispose();\r\n }\r\n // Internal Swap\r\n expandedTexture_1._swapAndDie(internalTexture);\r\n // Ready to get rolling again.\r\n internalTexture.isReady = true;\r\n });\r\n }\r\n });\r\n };\r\n return RGBDTextureTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/sceneOptimizer.ts\":\n/*!********************************!*\\\n !*** ./Misc/sceneOptimizer.ts ***!\n \\********************************/\n/*! exports provided: SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return SceneOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return TextureOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return HardwareScalingOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return ShadowsOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return PostProcessesOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return LensFlaresOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return CustomOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return ParticlesOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return RenderTargetsOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return MergeMeshesOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return SceneOptimizerOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return SceneOptimizer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Defines the root class used to create scene optimization to use with SceneOptimizer\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar SceneOptimization = /** @class */ (function () {\r\n /**\r\n * Creates the SceneOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param desc defines the description associated with the optimization\r\n */\r\n function SceneOptimization(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n priority) {\r\n if (priority === void 0) { priority = 0; }\r\n this.priority = priority;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n SceneOptimization.prototype.getDescription = function () {\r\n return \"\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n SceneOptimization.prototype.apply = function (scene, optimizer) {\r\n return true;\r\n };\r\n return SceneOptimization;\r\n}());\r\n\r\n/**\r\n * Defines an optimization used to reduce the size of render target textures\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar TextureOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextureOptimization, _super);\r\n /**\r\n * Creates the TextureOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumSize defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n * @param step defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n function TextureOptimization(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n priority, \r\n /**\r\n * Defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n */\r\n maximumSize, \r\n /**\r\n * Defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n step) {\r\n if (priority === void 0) { priority = 0; }\r\n if (maximumSize === void 0) { maximumSize = 1024; }\r\n if (step === void 0) { step = 0.5; }\r\n var _this = _super.call(this, priority) || this;\r\n _this.priority = priority;\r\n _this.maximumSize = maximumSize;\r\n _this.step = step;\r\n return _this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n TextureOptimization.prototype.getDescription = function () {\r\n return \"Reducing render target texture size to \" + this.maximumSize;\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n TextureOptimization.prototype.apply = function (scene, optimizer) {\r\n var allDone = true;\r\n for (var index = 0; index < scene.textures.length; index++) {\r\n var texture = scene.textures[index];\r\n if (!texture.canRescale || texture.getContext) {\r\n continue;\r\n }\r\n var currentSize = texture.getSize();\r\n var maxDimension = Math.max(currentSize.width, currentSize.height);\r\n if (maxDimension > this.maximumSize) {\r\n texture.scale(this.step);\r\n allDone = false;\r\n }\r\n }\r\n return allDone;\r\n };\r\n return TextureOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to increase or decrease the rendering resolution\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar HardwareScalingOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HardwareScalingOptimization, _super);\r\n /**\r\n * Creates the HardwareScalingOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumScale defines the maximum scale to use (2 by default)\r\n * @param step defines the step to use between two passes (0.5 by default)\r\n */\r\n function HardwareScalingOptimization(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n priority, \r\n /**\r\n * Defines the maximum scale to use (2 by default)\r\n */\r\n maximumScale, \r\n /**\r\n * Defines the step to use between two passes (0.5 by default)\r\n */\r\n step) {\r\n if (priority === void 0) { priority = 0; }\r\n if (maximumScale === void 0) { maximumScale = 2; }\r\n if (step === void 0) { step = 0.25; }\r\n var _this = _super.call(this, priority) || this;\r\n _this.priority = priority;\r\n _this.maximumScale = maximumScale;\r\n _this.step = step;\r\n _this._currentScale = -1;\r\n _this._directionOffset = 1;\r\n return _this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n HardwareScalingOptimization.prototype.getDescription = function () {\r\n return \"Setting hardware scaling level to \" + this._currentScale;\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n HardwareScalingOptimization.prototype.apply = function (scene, optimizer) {\r\n if (this._currentScale === -1) {\r\n this._currentScale = scene.getEngine().getHardwareScalingLevel();\r\n if (this._currentScale > this.maximumScale) {\r\n this._directionOffset = -1;\r\n }\r\n }\r\n this._currentScale += this._directionOffset * this.step;\r\n scene.getEngine().setHardwareScalingLevel(this._currentScale);\r\n return this._directionOffset === 1 ? this._currentScale >= this.maximumScale : this._currentScale <= this.maximumScale;\r\n };\r\n return HardwareScalingOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to remove shadows\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar ShadowsOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShadowsOptimization, _super);\r\n function ShadowsOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n ShadowsOptimization.prototype.getDescription = function () {\r\n return \"Turning shadows on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n ShadowsOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.shadowsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return ShadowsOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn post-processes off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar PostProcessesOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PostProcessesOptimization, _super);\r\n function PostProcessesOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n PostProcessesOptimization.prototype.getDescription = function () {\r\n return \"Turning post-processes on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n PostProcessesOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.postProcessesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return PostProcessesOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn lens flares off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar LensFlaresOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LensFlaresOptimization, _super);\r\n function LensFlaresOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n LensFlaresOptimization.prototype.getDescription = function () {\r\n return \"Turning lens flares on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n LensFlaresOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.lensFlaresEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return LensFlaresOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization based on user defined callback.\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar CustomOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CustomOptimization, _super);\r\n function CustomOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n CustomOptimization.prototype.getDescription = function () {\r\n if (this.onGetDescription) {\r\n return this.onGetDescription();\r\n }\r\n return \"Running user defined callback\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n CustomOptimization.prototype.apply = function (scene, optimizer) {\r\n if (this.onApply) {\r\n return this.onApply(scene, optimizer);\r\n }\r\n return true;\r\n };\r\n return CustomOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn particles off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar ParticlesOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ParticlesOptimization, _super);\r\n function ParticlesOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n ParticlesOptimization.prototype.getDescription = function () {\r\n return \"Turning particles on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n ParticlesOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.particlesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return ParticlesOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn render targets off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar RenderTargetsOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RenderTargetsOptimization, _super);\r\n function RenderTargetsOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n RenderTargetsOptimization.prototype.getDescription = function () {\r\n return \"Turning render targets off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n RenderTargetsOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.renderTargetsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return RenderTargetsOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to merge meshes with compatible materials\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar MergeMeshesOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MergeMeshesOptimization, _super);\r\n function MergeMeshesOptimization() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._canBeMerged = function (abstractMesh) {\r\n if (!(abstractMesh instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"])) {\r\n return false;\r\n }\r\n var mesh = abstractMesh;\r\n if (mesh.isDisposed()) {\r\n return false;\r\n }\r\n if (!mesh.isVisible || !mesh.isEnabled()) {\r\n return false;\r\n }\r\n if (mesh.instances.length > 0) {\r\n return false;\r\n }\r\n if (mesh.skeleton || mesh.hasLODLevels) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(MergeMeshesOptimization, \"UpdateSelectionTree\", {\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n get: function () {\r\n return MergeMeshesOptimization._UpdateSelectionTree;\r\n },\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n set: function (value) {\r\n MergeMeshesOptimization._UpdateSelectionTree = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n MergeMeshesOptimization.prototype.getDescription = function () {\r\n return \"Merging similar meshes together\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @param updateSelectionTree defines that the selection octree has to be updated (false by default)\r\n * @returns true if everything that can be done was applied\r\n */\r\n MergeMeshesOptimization.prototype.apply = function (scene, optimizer, updateSelectionTree) {\r\n var globalPool = scene.meshes.slice(0);\r\n var globalLength = globalPool.length;\r\n for (var index = 0; index < globalLength; index++) {\r\n var currentPool = new Array();\r\n var current = globalPool[index];\r\n // Checks\r\n if (!this._canBeMerged(current)) {\r\n continue;\r\n }\r\n currentPool.push(current);\r\n // Find compatible meshes\r\n for (var subIndex = index + 1; subIndex < globalLength; subIndex++) {\r\n var otherMesh = globalPool[subIndex];\r\n if (!this._canBeMerged(otherMesh)) {\r\n continue;\r\n }\r\n if (otherMesh.material !== current.material) {\r\n continue;\r\n }\r\n if (otherMesh.checkCollisions !== current.checkCollisions) {\r\n continue;\r\n }\r\n currentPool.push(otherMesh);\r\n globalLength--;\r\n globalPool.splice(subIndex, 1);\r\n subIndex--;\r\n }\r\n if (currentPool.length < 2) {\r\n continue;\r\n }\r\n // Merge meshes\r\n _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].MergeMeshes(currentPool, undefined, true);\r\n }\r\n // Call the octree system optimization if it is defined.\r\n var sceneAsAny = scene;\r\n if (sceneAsAny.createOrUpdateSelectionOctree) {\r\n if (updateSelectionTree != undefined) {\r\n if (updateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n else if (MergeMeshesOptimization.UpdateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n return true;\r\n };\r\n MergeMeshesOptimization._UpdateSelectionTree = false;\r\n return MergeMeshesOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines a list of options used by SceneOptimizer\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar SceneOptimizerOptions = /** @class */ (function () {\r\n /**\r\n * Creates a new list of options used by SceneOptimizer\r\n * @param targetFrameRate defines the target frame rate to reach (60 by default)\r\n * @param trackerDuration defines the interval between two checkes (2000ms by default)\r\n */\r\n function SceneOptimizerOptions(\r\n /**\r\n * Defines the target frame rate to reach (60 by default)\r\n */\r\n targetFrameRate, \r\n /**\r\n * Defines the interval between two checkes (2000ms by default)\r\n */\r\n trackerDuration) {\r\n if (targetFrameRate === void 0) { targetFrameRate = 60; }\r\n if (trackerDuration === void 0) { trackerDuration = 2000; }\r\n this.targetFrameRate = targetFrameRate;\r\n this.trackerDuration = trackerDuration;\r\n /**\r\n * Gets the list of optimizations to apply\r\n */\r\n this.optimizations = new Array();\r\n }\r\n /**\r\n * Add a new optimization\r\n * @param optimization defines the SceneOptimization to add to the list of active optimizations\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n SceneOptimizerOptions.prototype.addOptimization = function (optimization) {\r\n this.optimizations.push(optimization);\r\n return this;\r\n };\r\n /**\r\n * Add a new custom optimization\r\n * @param onApply defines the callback called to apply the custom optimization (true if everything that can be done was applied)\r\n * @param onGetDescription defines the callback called to get the description attached with the optimization.\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n SceneOptimizerOptions.prototype.addCustomOptimization = function (onApply, onGetDescription, priority) {\r\n if (priority === void 0) { priority = 0; }\r\n var optimization = new CustomOptimization(priority);\r\n optimization.onApply = onApply;\r\n optimization.onGetDescription = onGetDescription;\r\n this.optimizations.push(optimization);\r\n return this;\r\n };\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to reduce the visual impact on the scene\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n SceneOptimizerOptions.LowDegradationAllowed = function (targetFrameRate) {\r\n var result = new SceneOptimizerOptions(targetFrameRate);\r\n var priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 1024));\r\n return result;\r\n };\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a moderate impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n SceneOptimizerOptions.ModerateDegradationAllowed = function (targetFrameRate) {\r\n var result = new SceneOptimizerOptions(targetFrameRate);\r\n var priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 512));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 2));\r\n return result;\r\n };\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a big impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n SceneOptimizerOptions.HighDegradationAllowed = function (targetFrameRate) {\r\n var result = new SceneOptimizerOptions(targetFrameRate);\r\n var priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 256));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 4));\r\n return result;\r\n };\r\n return SceneOptimizerOptions;\r\n}());\r\n\r\n/**\r\n * Class used to run optimizations in order to reach a target frame rate\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar SceneOptimizer = /** @class */ (function () {\r\n /**\r\n * Creates a new SceneOptimizer\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param autoGeneratePriorities defines if priorities must be generated and not read from SceneOptimization property (true by default)\r\n * @param improvementMode defines if the scene optimizer must run the maximum optimization while staying over a target frame instead of trying to reach the target framerate (false by default)\r\n */\r\n function SceneOptimizer(scene, options, autoGeneratePriorities, improvementMode) {\r\n var _this = this;\r\n if (autoGeneratePriorities === void 0) { autoGeneratePriorities = true; }\r\n if (improvementMode === void 0) { improvementMode = false; }\r\n this._isRunning = false;\r\n this._currentPriorityLevel = 0;\r\n this._targetFrameRate = 60;\r\n this._trackerDuration = 2000;\r\n this._currentFrameRate = 0;\r\n this._improvementMode = false;\r\n /**\r\n * Defines an observable called when the optimizer reaches the target frame rate\r\n */\r\n this.onSuccessObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Defines an observable called when the optimizer enables an optimization\r\n */\r\n this.onNewOptimizationAppliedObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Defines an observable called when the optimizer is not able to reach the target frame rate\r\n */\r\n this.onFailureObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n if (!options) {\r\n this._options = new SceneOptimizerOptions();\r\n }\r\n else {\r\n this._options = options;\r\n }\r\n if (this._options.targetFrameRate) {\r\n this._targetFrameRate = this._options.targetFrameRate;\r\n }\r\n if (this._options.trackerDuration) {\r\n this._trackerDuration = this._options.trackerDuration;\r\n }\r\n if (autoGeneratePriorities) {\r\n var priority = 0;\r\n for (var _i = 0, _a = this._options.optimizations; _i < _a.length; _i++) {\r\n var optim = _a[_i];\r\n optim.priority = priority++;\r\n }\r\n }\r\n this._improvementMode = improvementMode;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__[\"EngineStore\"].LastCreatedScene;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(function () {\r\n _this._sceneDisposeObserver = null;\r\n _this.dispose();\r\n });\r\n }\r\n Object.defineProperty(SceneOptimizer.prototype, \"isInImprovementMode\", {\r\n /**\r\n * Gets a boolean indicating if the optimizer is in improvement mode\r\n */\r\n get: function () {\r\n return this._improvementMode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"currentPriorityLevel\", {\r\n /**\r\n * Gets the current priority level (0 at start)\r\n */\r\n get: function () {\r\n return this._currentPriorityLevel;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"currentFrameRate\", {\r\n /**\r\n * Gets the current frame rate checked by the SceneOptimizer\r\n */\r\n get: function () {\r\n return this._currentFrameRate;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"targetFrameRate\", {\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n get: function () {\r\n return this._targetFrameRate;\r\n },\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n set: function (value) {\r\n this._targetFrameRate = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"trackerDuration\", {\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n get: function () {\r\n return this._trackerDuration;\r\n },\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n set: function (value) {\r\n this._trackerDuration = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"optimizations\", {\r\n /**\r\n * Gets the list of active optimizations\r\n */\r\n get: function () {\r\n return this._options.optimizations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stops the current optimizer\r\n */\r\n SceneOptimizer.prototype.stop = function () {\r\n this._isRunning = false;\r\n };\r\n /**\r\n * Reset the optimizer to initial step (current priority level = 0)\r\n */\r\n SceneOptimizer.prototype.reset = function () {\r\n this._currentPriorityLevel = 0;\r\n };\r\n /**\r\n * Start the optimizer. By default it will try to reach a specific framerate\r\n * but if the optimizer is set with improvementMode === true then it will run all optimiatiation while frame rate is above the target frame rate\r\n */\r\n SceneOptimizer.prototype.start = function () {\r\n var _this = this;\r\n if (this._isRunning) {\r\n return;\r\n }\r\n this._isRunning = true;\r\n // Let's wait for the scene to be ready before running our check\r\n this._scene.executeWhenReady(function () {\r\n setTimeout(function () {\r\n _this._checkCurrentState();\r\n }, _this._trackerDuration);\r\n });\r\n };\r\n SceneOptimizer.prototype._checkCurrentState = function () {\r\n var _this = this;\r\n if (!this._isRunning) {\r\n return;\r\n }\r\n var scene = this._scene;\r\n var options = this._options;\r\n this._currentFrameRate = Math.round(scene.getEngine().getFps());\r\n if (this._improvementMode && this._currentFrameRate <= this._targetFrameRate ||\r\n !this._improvementMode && this._currentFrameRate >= this._targetFrameRate) {\r\n this._isRunning = false;\r\n this.onSuccessObservable.notifyObservers(this);\r\n return;\r\n }\r\n // Apply current level of optimizations\r\n var allDone = true;\r\n var noOptimizationApplied = true;\r\n for (var index = 0; index < options.optimizations.length; index++) {\r\n var optimization = options.optimizations[index];\r\n if (optimization.priority === this._currentPriorityLevel) {\r\n noOptimizationApplied = false;\r\n allDone = allDone && optimization.apply(scene, this);\r\n this.onNewOptimizationAppliedObservable.notifyObservers(optimization);\r\n }\r\n }\r\n // If no optimization was applied, this is a failure :(\r\n if (noOptimizationApplied) {\r\n this._isRunning = false;\r\n this.onFailureObservable.notifyObservers(this);\r\n return;\r\n }\r\n // If all optimizations were done, move to next level\r\n if (allDone) {\r\n this._currentPriorityLevel++;\r\n }\r\n // Let's the system running for a specific amount of time before checking FPS\r\n scene.executeWhenReady(function () {\r\n setTimeout(function () {\r\n _this._checkCurrentState();\r\n }, _this._trackerDuration);\r\n });\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n SceneOptimizer.prototype.dispose = function () {\r\n this.stop();\r\n this.onSuccessObservable.clear();\r\n this.onFailureObservable.clear();\r\n this.onNewOptimizationAppliedObservable.clear();\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n };\r\n /**\r\n * Helper function to create a SceneOptimizer with one single line of code\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param onSuccess defines a callback to call on success\r\n * @param onFailure defines a callback to call on failure\r\n * @returns the new SceneOptimizer object\r\n */\r\n SceneOptimizer.OptimizeAsync = function (scene, options, onSuccess, onFailure) {\r\n var optimizer = new SceneOptimizer(scene, options || SceneOptimizerOptions.ModerateDegradationAllowed(), false);\r\n if (onSuccess) {\r\n optimizer.onSuccessObservable.add(function () {\r\n onSuccess();\r\n });\r\n }\r\n if (onFailure) {\r\n optimizer.onFailureObservable.add(function () {\r\n onFailure();\r\n });\r\n }\r\n optimizer.start();\r\n return optimizer;\r\n };\r\n return SceneOptimizer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/sceneSerializer.ts\":\n/*!*********************************!*\\\n !*** ./Misc/sceneSerializer.ts ***!\n \\*********************************/\n/*! exports provided: SceneSerializer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return SceneSerializer; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony import */ var _decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./decorators */ \"./Misc/decorators.ts\");\n\r\n\r\n\r\n\r\nvar serializedGeometries = [];\r\nvar serializeGeometry = function (geometry, serializationGeometries) {\r\n if (serializedGeometries[geometry.id]) {\r\n return;\r\n }\r\n if (geometry.doNotSerialize) {\r\n return;\r\n }\r\n serializationGeometries.vertexData.push(geometry.serializeVerticeData());\r\n serializedGeometries[geometry.id] = true;\r\n};\r\nvar serializeMesh = function (mesh, serializationScene) {\r\n var serializationObject = {};\r\n // Geometry\r\n var geometry = mesh._geometry;\r\n if (geometry) {\r\n if (!mesh.getScene().getGeometryByID(geometry.id)) {\r\n // Geometry was in the memory but not added to the scene, nevertheless it's better to serialize to be able to reload the mesh with its geometry\r\n serializeGeometry(geometry, serializationScene.geometries);\r\n }\r\n }\r\n // Custom\r\n if (mesh.serialize) {\r\n mesh.serialize(serializationObject);\r\n }\r\n return serializationObject;\r\n};\r\nvar finalizeSingleMesh = function (mesh, serializationObject) {\r\n //only works if the mesh is already loaded\r\n if (mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_LOADED || mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_NONE) {\r\n //serialize material\r\n if (mesh.material && !mesh.material.doNotSerialize) {\r\n if (mesh.material instanceof _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_2__[\"MultiMaterial\"]) {\r\n serializationObject.multiMaterials = serializationObject.multiMaterials || [];\r\n serializationObject.materials = serializationObject.materials || [];\r\n if (!serializationObject.multiMaterials.some(function (mat) { return (mat.id === mesh.material.id); })) {\r\n serializationObject.multiMaterials.push(mesh.material.serialize());\r\n var _loop_1 = function (submaterial) {\r\n if (submaterial) {\r\n if (!serializationObject.materials.some(function (mat) { return (mat.id === submaterial.id); })) {\r\n serializationObject.materials.push(submaterial.serialize());\r\n }\r\n }\r\n };\r\n for (var _i = 0, _a = mesh.material.subMaterials; _i < _a.length; _i++) {\r\n var submaterial = _a[_i];\r\n _loop_1(submaterial);\r\n }\r\n }\r\n }\r\n else {\r\n serializationObject.materials = serializationObject.materials || [];\r\n if (!serializationObject.materials.some(function (mat) { return (mat.id === mesh.material.id); })) {\r\n serializationObject.materials.push(mesh.material.serialize());\r\n }\r\n }\r\n }\r\n //serialize geometry\r\n var geometry = mesh._geometry;\r\n if (geometry) {\r\n if (!serializationObject.geometries) {\r\n serializationObject.geometries = {};\r\n serializationObject.geometries.boxes = [];\r\n serializationObject.geometries.spheres = [];\r\n serializationObject.geometries.cylinders = [];\r\n serializationObject.geometries.toruses = [];\r\n serializationObject.geometries.grounds = [];\r\n serializationObject.geometries.planes = [];\r\n serializationObject.geometries.torusKnots = [];\r\n serializationObject.geometries.vertexData = [];\r\n }\r\n serializeGeometry(geometry, serializationObject.geometries);\r\n }\r\n // Skeletons\r\n if (mesh.skeleton && !mesh.skeleton.doNotSerialize) {\r\n serializationObject.skeletons = serializationObject.skeletons || [];\r\n serializationObject.skeletons.push(mesh.skeleton.serialize());\r\n }\r\n //serialize the actual mesh\r\n serializationObject.meshes = serializationObject.meshes || [];\r\n serializationObject.meshes.push(serializeMesh(mesh, serializationObject));\r\n }\r\n};\r\n/**\r\n * Class used to serialize a scene into a string\r\n */\r\nvar SceneSerializer = /** @class */ (function () {\r\n function SceneSerializer() {\r\n }\r\n /**\r\n * Clear cache used by a previous serialization\r\n */\r\n SceneSerializer.ClearCache = function () {\r\n serializedGeometries = [];\r\n };\r\n /**\r\n * Serialize a scene into a JSON compatible object\r\n * @param scene defines the scene to serialize\r\n * @returns a JSON compatible object\r\n */\r\n SceneSerializer.Serialize = function (scene) {\r\n var serializationObject = {};\r\n SceneSerializer.ClearCache();\r\n // Scene\r\n serializationObject.useDelayedTextureLoading = scene.useDelayedTextureLoading;\r\n serializationObject.autoClear = scene.autoClear;\r\n serializationObject.clearColor = scene.clearColor.asArray();\r\n serializationObject.ambientColor = scene.ambientColor.asArray();\r\n serializationObject.gravity = scene.gravity.asArray();\r\n serializationObject.collisionsEnabled = scene.collisionsEnabled;\r\n // Fog\r\n if (scene.fogMode && scene.fogMode !== 0) {\r\n serializationObject.fogMode = scene.fogMode;\r\n serializationObject.fogColor = scene.fogColor.asArray();\r\n serializationObject.fogStart = scene.fogStart;\r\n serializationObject.fogEnd = scene.fogEnd;\r\n serializationObject.fogDensity = scene.fogDensity;\r\n }\r\n //Physics\r\n if (scene.isPhysicsEnabled()) {\r\n var physicEngine = scene.getPhysicsEngine();\r\n if (physicEngine) {\r\n serializationObject.physicsEnabled = true;\r\n serializationObject.physicsGravity = physicEngine.gravity.asArray();\r\n serializationObject.physicsEngine = physicEngine.getPhysicsPluginName();\r\n }\r\n }\r\n // Metadata\r\n if (scene.metadata) {\r\n serializationObject.metadata = scene.metadata;\r\n }\r\n // Morph targets\r\n serializationObject.morphTargetManagers = [];\r\n for (var _i = 0, _a = scene.meshes; _i < _a.length; _i++) {\r\n var abstractMesh = _a[_i];\r\n var manager = abstractMesh.morphTargetManager;\r\n if (manager) {\r\n serializationObject.morphTargetManagers.push(manager.serialize());\r\n }\r\n }\r\n // Lights\r\n serializationObject.lights = [];\r\n var index;\r\n var light;\r\n for (index = 0; index < scene.lights.length; index++) {\r\n light = scene.lights[index];\r\n if (!light.doNotSerialize) {\r\n serializationObject.lights.push(light.serialize());\r\n }\r\n }\r\n // Cameras\r\n serializationObject.cameras = [];\r\n for (index = 0; index < scene.cameras.length; index++) {\r\n var camera = scene.cameras[index];\r\n if (!camera.doNotSerialize) {\r\n serializationObject.cameras.push(camera.serialize());\r\n }\r\n }\r\n if (scene.activeCamera) {\r\n serializationObject.activeCameraID = scene.activeCamera.id;\r\n }\r\n // Animations\r\n _decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"].AppendSerializedAnimations(scene, serializationObject);\r\n // Animation Groups\r\n if (scene.animationGroups && scene.animationGroups.length > 0) {\r\n serializationObject.animationGroups = [];\r\n for (var animationGroupIndex = 0; animationGroupIndex < scene.animationGroups.length; animationGroupIndex++) {\r\n var animationGroup = scene.animationGroups[animationGroupIndex];\r\n serializationObject.animationGroups.push(animationGroup.serialize());\r\n }\r\n }\r\n // Reflection probes\r\n if (scene.reflectionProbes && scene.reflectionProbes.length > 0) {\r\n serializationObject.reflectionProbes = [];\r\n for (index = 0; index < scene.reflectionProbes.length; index++) {\r\n var reflectionProbe = scene.reflectionProbes[index];\r\n serializationObject.reflectionProbes.push(reflectionProbe.serialize());\r\n }\r\n }\r\n // Materials\r\n serializationObject.materials = [];\r\n serializationObject.multiMaterials = [];\r\n var material;\r\n for (index = 0; index < scene.materials.length; index++) {\r\n material = scene.materials[index];\r\n if (!material.doNotSerialize) {\r\n serializationObject.materials.push(material.serialize());\r\n }\r\n }\r\n // MultiMaterials\r\n serializationObject.multiMaterials = [];\r\n for (index = 0; index < scene.multiMaterials.length; index++) {\r\n var multiMaterial = scene.multiMaterials[index];\r\n serializationObject.multiMaterials.push(multiMaterial.serialize());\r\n }\r\n // Environment texture\r\n if (scene.environmentTexture) {\r\n serializationObject.environmentTexture = scene.environmentTexture.name;\r\n }\r\n // Environment Intensity\r\n serializationObject.environmentIntensity = scene.environmentIntensity;\r\n // Skeletons\r\n serializationObject.skeletons = [];\r\n for (index = 0; index < scene.skeletons.length; index++) {\r\n var skeleton = scene.skeletons[index];\r\n if (!skeleton.doNotSerialize) {\r\n serializationObject.skeletons.push(skeleton.serialize());\r\n }\r\n }\r\n // Transform nodes\r\n serializationObject.transformNodes = [];\r\n for (index = 0; index < scene.transformNodes.length; index++) {\r\n serializationObject.transformNodes.push(scene.transformNodes[index].serialize());\r\n }\r\n // Geometries\r\n serializationObject.geometries = {};\r\n serializationObject.geometries.boxes = [];\r\n serializationObject.geometries.spheres = [];\r\n serializationObject.geometries.cylinders = [];\r\n serializationObject.geometries.toruses = [];\r\n serializationObject.geometries.grounds = [];\r\n serializationObject.geometries.planes = [];\r\n serializationObject.geometries.torusKnots = [];\r\n serializationObject.geometries.vertexData = [];\r\n serializedGeometries = [];\r\n var geometries = scene.getGeometries();\r\n for (index = 0; index < geometries.length; index++) {\r\n var geometry = geometries[index];\r\n if (geometry.isReady()) {\r\n serializeGeometry(geometry, serializationObject.geometries);\r\n }\r\n }\r\n // Meshes\r\n serializationObject.meshes = [];\r\n for (index = 0; index < scene.meshes.length; index++) {\r\n var abstractMesh = scene.meshes[index];\r\n if (abstractMesh instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]) {\r\n var mesh = abstractMesh;\r\n if (!mesh.doNotSerialize) {\r\n if (mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_LOADED || mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_NONE) {\r\n serializationObject.meshes.push(serializeMesh(mesh, serializationObject));\r\n }\r\n }\r\n }\r\n }\r\n // Particles Systems\r\n serializationObject.particleSystems = [];\r\n for (index = 0; index < scene.particleSystems.length; index++) {\r\n serializationObject.particleSystems.push(scene.particleSystems[index].serialize());\r\n }\r\n // Action Manager\r\n if (scene.actionManager) {\r\n serializationObject.actions = scene.actionManager.serialize(\"scene\");\r\n }\r\n // Components\r\n for (var _b = 0, _c = scene._serializableComponents; _b < _c.length; _b++) {\r\n var component = _c[_b];\r\n component.serialize(serializationObject);\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Serialize a mesh into a JSON compatible object\r\n * @param toSerialize defines the mesh to serialize\r\n * @param withParents defines if parents must be serialized as well\r\n * @param withChildren defines if children must be serialized as well\r\n * @returns a JSON compatible object\r\n */\r\n SceneSerializer.SerializeMesh = function (toSerialize /* Mesh || Mesh[] */, withParents, withChildren) {\r\n if (withParents === void 0) { withParents = false; }\r\n if (withChildren === void 0) { withChildren = false; }\r\n var serializationObject = {};\r\n SceneSerializer.ClearCache();\r\n toSerialize = (toSerialize instanceof Array) ? toSerialize : [toSerialize];\r\n if (withParents || withChildren) {\r\n //deliberate for loop! not for each, appended should be processed as well.\r\n for (var i = 0; i < toSerialize.length; ++i) {\r\n if (withChildren) {\r\n toSerialize[i].getDescendants().forEach(function (node) {\r\n if (node instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"] && (toSerialize.indexOf(node) < 0) && !node.doNotSerialize) {\r\n toSerialize.push(node);\r\n }\r\n });\r\n }\r\n //make sure the array doesn't contain the object already\r\n if (withParents && toSerialize[i].parent && (toSerialize.indexOf(toSerialize[i].parent) < 0) && !toSerialize[i].parent.doNotSerialize) {\r\n toSerialize.push(toSerialize[i].parent);\r\n }\r\n }\r\n }\r\n toSerialize.forEach(function (mesh) {\r\n finalizeSingleMesh(mesh, serializationObject);\r\n });\r\n return serializationObject;\r\n };\r\n return SceneSerializer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/screenshotTools.ts\":\n/*!*********************************!*\\\n !*** ./Misc/screenshotTools.ts ***!\n \\*********************************/\n/*! exports provided: ScreenshotTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return ScreenshotTools; });\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../PostProcesses/fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nvar ScreenshotTools = /** @class */ (function () {\r\n function ScreenshotTools() {\r\n }\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n ScreenshotTools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n if (!(height && width)) {\r\n _logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n if (!_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas) {\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas = document.createElement('canvas');\r\n }\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas.width = width;\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas.height = height;\r\n var renderContext = _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas.getContext(\"2d\");\r\n var ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n var newWidth = width;\r\n var newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n var offsetX = Math.max(0, width - newWidth) / 2;\r\n var offsetY = Math.max(0, height - newHeight) / 2;\r\n var renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].EncodeScreenshotCanvasData(successCallback, mimeType);\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshot(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType);\r\n });\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n var targetTextureSize = { width: width, height: height };\r\n if (!(height && width)) {\r\n _logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n var scene = camera.getScene();\r\n var previousCamera = null;\r\n if (scene.activeCamera !== camera) {\r\n previousCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n var renderCanvas = engine.getRenderingCanvas();\r\n if (!renderCanvas) {\r\n _logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"No rendering canvas found !\");\r\n return;\r\n }\r\n var originalSize = { width: renderCanvas.width, height: renderCanvas.height };\r\n engine.setSize(width, height);\r\n scene.render();\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n var texture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetTexture\"](\"screenShot\", targetTextureSize, scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n texture.renderList = null;\r\n texture.samples = samples;\r\n if (antialiasing) {\r\n texture.addPostProcess(new _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"FxaaPostProcess\"]('antialiasing', 1.0, scene.activeCamera));\r\n }\r\n texture.onAfterRenderObservable.add(function () {\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].DumpFramebuffer(width, height, engine, successCallback, mimeType, fileName);\r\n });\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n texture.dispose();\r\n if (previousCamera) {\r\n scene.activeCamera = previousCamera;\r\n }\r\n engine.setSize(originalSize.width, originalSize.height);\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType, samples, antialiasing, fileName);\r\n });\r\n };\r\n /**\r\n * Gets height and width for screenshot size\r\n * @private\r\n */\r\n ScreenshotTools._getScreenshotSize = function (engine, camera, size) {\r\n var height = 0;\r\n var width = 0;\r\n //If a size value defined as object\r\n if (typeof (size) === 'object') {\r\n var precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n }\r\n else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n }\r\n return { height: height, width: width };\r\n };\r\n return ScreenshotTools;\r\n}());\r\n\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshot = ScreenshotTools.CreateScreenshot;\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshotAsync = ScreenshotTools.CreateScreenshotAsync;\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshotUsingRenderTarget = ScreenshotTools.CreateScreenshotUsingRenderTarget;\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshotUsingRenderTargetAsync = ScreenshotTools.CreateScreenshotUsingRenderTargetAsync;\r\n\n\n/***/ }),\n\n/***/ \"./Misc/smartArray.ts\":\n/*!****************************!*\\\n !*** ./Misc/smartArray.ts ***!\n \\****************************/\n/*! exports provided: SmartArray, SmartArrayNoDuplicate */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return SmartArray; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return SmartArrayNoDuplicate; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n */\r\nvar SmartArray = /** @class */ (function () {\r\n /**\r\n * Instantiates a Smart Array.\r\n * @param capacity defines the default capacity of the array.\r\n */\r\n function SmartArray(capacity) {\r\n /**\r\n * The active length of the array.\r\n */\r\n this.length = 0;\r\n this.data = new Array(capacity);\r\n this._id = SmartArray._GlobalId++;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArray.prototype.push = function (value) {\r\n this.data[this.length++] = value;\r\n if (this.length > this.data.length) {\r\n this.data.length *= 2;\r\n }\r\n };\r\n /**\r\n * Iterates over the active data and apply the lambda to them.\r\n * @param func defines the action to apply on each value.\r\n */\r\n SmartArray.prototype.forEach = function (func) {\r\n for (var index = 0; index < this.length; index++) {\r\n func(this.data[index]);\r\n }\r\n };\r\n /**\r\n * Sorts the full sets of data.\r\n * @param compareFn defines the comparison function to apply.\r\n */\r\n SmartArray.prototype.sort = function (compareFn) {\r\n this.data.sort(compareFn);\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArray.prototype.reset = function () {\r\n this.length = 0;\r\n };\r\n /**\r\n * Releases all the data from the array as well as the array.\r\n */\r\n SmartArray.prototype.dispose = function () {\r\n this.reset();\r\n if (this.data) {\r\n this.data.length = 0;\r\n this.data = [];\r\n }\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArray.prototype.concat = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n this.data[this.length++] = (array.data || array)[index];\r\n }\r\n };\r\n /**\r\n * Returns the position of a value in the active data.\r\n * @param value defines the value to find the index for\r\n * @returns the index if found in the active data otherwise -1\r\n */\r\n SmartArray.prototype.indexOf = function (value) {\r\n var position = this.data.indexOf(value);\r\n if (position >= this.length) {\r\n return -1;\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns whether an element is part of the active data.\r\n * @param value defines the value to look for\r\n * @returns true if found in the active data otherwise false\r\n */\r\n SmartArray.prototype.contains = function (value) {\r\n return this.indexOf(value) !== -1;\r\n };\r\n // Statics\r\n SmartArray._GlobalId = 0;\r\n return SmartArray;\r\n}());\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n * The data in this array can only be present once\r\n */\r\nvar SmartArrayNoDuplicate = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SmartArrayNoDuplicate, _super);\r\n function SmartArrayNoDuplicate() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._duplicateId = 0;\r\n return _this;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * THIS DOES NOT PREVENT DUPPLICATE DATA\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArrayNoDuplicate.prototype.push = function (value) {\r\n _super.prototype.push.call(this, value);\r\n if (!value.__smartArrayFlags) {\r\n value.__smartArrayFlags = {};\r\n }\r\n value.__smartArrayFlags[this._id] = this._duplicateId;\r\n };\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * If the data is already present, it won t be added again\r\n * @param value defines the object to push in the array.\r\n * @returns true if added false if it was already present\r\n */\r\n SmartArrayNoDuplicate.prototype.pushNoDuplicate = function (value) {\r\n if (value.__smartArrayFlags && value.__smartArrayFlags[this._id] === this._duplicateId) {\r\n return false;\r\n }\r\n this.push(value);\r\n return true;\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArrayNoDuplicate.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this._duplicateId++;\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * This ensures no dupplicate will be present in the result.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArrayNoDuplicate.prototype.concatWithNoDuplicate = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n var item = (array.data || array)[index];\r\n this.pushNoDuplicate(item);\r\n }\r\n };\r\n return SmartArrayNoDuplicate;\r\n}(SmartArray));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/stringDictionary.ts\":\n/*!**********************************!*\\\n !*** ./Misc/stringDictionary.ts ***!\n \\**********************************/\n/*! exports provided: StringDictionary */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return StringDictionary; });\n/**\r\n * This class implement a typical dictionary using a string as key and the generic type T as value.\r\n * The underlying implementation relies on an associative array to ensure the best performances.\r\n * The value can be anything including 'null' but except 'undefined'\r\n */\r\nvar StringDictionary = /** @class */ (function () {\r\n function StringDictionary() {\r\n this._count = 0;\r\n this._data = {};\r\n }\r\n /**\r\n * This will clear this dictionary and copy the content from the 'source' one.\r\n * If the T value is a custom object, it won't be copied/cloned, the same object will be used\r\n * @param source the dictionary to take the content from and copy to this dictionary\r\n */\r\n StringDictionary.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n this.clear();\r\n source.forEach(function (t, v) { return _this.add(t, v); });\r\n };\r\n /**\r\n * Get a value based from its key\r\n * @param key the given key to get the matching value from\r\n * @return the value if found, otherwise undefined is returned\r\n */\r\n StringDictionary.prototype.get = function (key) {\r\n var val = this._data[key];\r\n if (val !== undefined) {\r\n return val;\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Get a value from its key or add it if it doesn't exist.\r\n * This method will ensure you that a given key/data will be present in the dictionary.\r\n * @param key the given key to get the matching value from\r\n * @param factory the factory that will create the value if the key is not present in the dictionary.\r\n * The factory will only be invoked if there's no data for the given key.\r\n * @return the value corresponding to the key.\r\n */\r\n StringDictionary.prototype.getOrAddWithFactory = function (key, factory) {\r\n var val = this.get(key);\r\n if (val !== undefined) {\r\n return val;\r\n }\r\n val = factory(key);\r\n if (val) {\r\n this.add(key, val);\r\n }\r\n return val;\r\n };\r\n /**\r\n * Get a value from its key if present in the dictionary otherwise add it\r\n * @param key the key to get the value from\r\n * @param val if there's no such key/value pair in the dictionary add it with this value\r\n * @return the value corresponding to the key\r\n */\r\n StringDictionary.prototype.getOrAdd = function (key, val) {\r\n var curVal = this.get(key);\r\n if (curVal !== undefined) {\r\n return curVal;\r\n }\r\n this.add(key, val);\r\n return val;\r\n };\r\n /**\r\n * Check if there's a given key in the dictionary\r\n * @param key the key to check for\r\n * @return true if the key is present, false otherwise\r\n */\r\n StringDictionary.prototype.contains = function (key) {\r\n return this._data[key] !== undefined;\r\n };\r\n /**\r\n * Add a new key and its corresponding value\r\n * @param key the key to add\r\n * @param value the value corresponding to the key\r\n * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary\r\n */\r\n StringDictionary.prototype.add = function (key, value) {\r\n if (this._data[key] !== undefined) {\r\n return false;\r\n }\r\n this._data[key] = value;\r\n ++this._count;\r\n return true;\r\n };\r\n /**\r\n * Update a specific value associated to a key\r\n * @param key defines the key to use\r\n * @param value defines the value to store\r\n * @returns true if the value was updated (or false if the key was not found)\r\n */\r\n StringDictionary.prototype.set = function (key, value) {\r\n if (this._data[key] === undefined) {\r\n return false;\r\n }\r\n this._data[key] = value;\r\n return true;\r\n };\r\n /**\r\n * Get the element of the given key and remove it from the dictionary\r\n * @param key defines the key to search\r\n * @returns the value associated with the key or null if not found\r\n */\r\n StringDictionary.prototype.getAndRemove = function (key) {\r\n var val = this.get(key);\r\n if (val !== undefined) {\r\n delete this._data[key];\r\n --this._count;\r\n return val;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Remove a key/value from the dictionary.\r\n * @param key the key to remove\r\n * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary\r\n */\r\n StringDictionary.prototype.remove = function (key) {\r\n if (this.contains(key)) {\r\n delete this._data[key];\r\n --this._count;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Clear the whole content of the dictionary\r\n */\r\n StringDictionary.prototype.clear = function () {\r\n this._data = {};\r\n this._count = 0;\r\n };\r\n Object.defineProperty(StringDictionary.prototype, \"count\", {\r\n /**\r\n * Gets the current count\r\n */\r\n get: function () {\r\n return this._count;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Execute a callback on each key/val of the dictionary.\r\n * Note that you can remove any element in this dictionary in the callback implementation\r\n * @param callback the callback to execute on a given key/value pair\r\n */\r\n StringDictionary.prototype.forEach = function (callback) {\r\n for (var cur in this._data) {\r\n var val = this._data[cur];\r\n callback(cur, val);\r\n }\r\n };\r\n /**\r\n * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.\r\n * If the callback returns null or undefined the method will iterate to the next key/value pair\r\n * Note that you can remove any element in this dictionary in the callback implementation\r\n * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned\r\n * @returns the first item\r\n */\r\n StringDictionary.prototype.first = function (callback) {\r\n for (var cur in this._data) {\r\n var val = this._data[cur];\r\n var res = callback(cur, val);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return null;\r\n };\r\n return StringDictionary;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/stringTools.ts\":\n/*!*****************************!*\\\n !*** ./Misc/stringTools.ts ***!\n \\*****************************/\n/*! exports provided: StringTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StringTools\", function() { return StringTools; });\n/**\r\n * Helper to manipulate strings\r\n */\r\nvar StringTools = /** @class */ (function () {\r\n function StringTools() {\r\n }\r\n /**\r\n * Checks for a matching suffix at the end of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.EndsWith = function (str, suffix) {\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n };\r\n /**\r\n * Checks for a matching suffix at the beginning of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.StartsWith = function (str, suffix) {\r\n return str.indexOf(suffix) === 0;\r\n };\r\n return StringTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/tags.ts\":\n/*!**********************!*\\\n !*** ./Misc/tags.ts ***!\n \\**********************/\n/*! exports provided: Tags */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return Tags; });\n/* harmony import */ var _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./andOrNotEvaluator */ \"./Misc/andOrNotEvaluator.ts\");\n\r\n/**\r\n * Class used to store custom tags\r\n */\r\nvar Tags = /** @class */ (function () {\r\n function Tags() {\r\n }\r\n /**\r\n * Adds support for tags on the given object\r\n * @param obj defines the object to use\r\n */\r\n Tags.EnableFor = function (obj) {\r\n obj._tags = obj._tags || {};\r\n obj.hasTags = function () {\r\n return Tags.HasTags(obj);\r\n };\r\n obj.addTags = function (tagsString) {\r\n return Tags.AddTagsTo(obj, tagsString);\r\n };\r\n obj.removeTags = function (tagsString) {\r\n return Tags.RemoveTagsFrom(obj, tagsString);\r\n };\r\n obj.matchesTagsQuery = function (tagsQuery) {\r\n return Tags.MatchesQuery(obj, tagsQuery);\r\n };\r\n };\r\n /**\r\n * Removes tags support\r\n * @param obj defines the object to use\r\n */\r\n Tags.DisableFor = function (obj) {\r\n delete obj._tags;\r\n delete obj.hasTags;\r\n delete obj.addTags;\r\n delete obj.removeTags;\r\n delete obj.matchesTagsQuery;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has tags\r\n * @param obj defines the object to use\r\n * @returns a boolean\r\n */\r\n Tags.HasTags = function (obj) {\r\n if (!obj._tags) {\r\n return false;\r\n }\r\n var tags = obj._tags;\r\n for (var i in tags) {\r\n if (tags.hasOwnProperty(i)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the tags available on a given object\r\n * @param obj defines the object to use\r\n * @param asString defines if the tags must be returned as a string instead of an array of strings\r\n * @returns the tags\r\n */\r\n Tags.GetTags = function (obj, asString) {\r\n if (asString === void 0) { asString = true; }\r\n if (!obj._tags) {\r\n return null;\r\n }\r\n if (asString) {\r\n var tagsArray = [];\r\n for (var tag in obj._tags) {\r\n if (obj._tags.hasOwnProperty(tag) && obj._tags[tag] === true) {\r\n tagsArray.push(tag);\r\n }\r\n }\r\n return tagsArray.join(\" \");\r\n }\r\n else {\r\n return obj._tags;\r\n }\r\n };\r\n /**\r\n * Adds tags to an object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tag string. The tags 'true' and 'false' are reserved and cannot be used as tags.\r\n * A tag cannot start with '||', '&&', and '!'. It cannot contain whitespaces\r\n */\r\n Tags.AddTagsTo = function (obj, tagsString) {\r\n if (!tagsString) {\r\n return;\r\n }\r\n if (typeof tagsString !== \"string\") {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n tags.forEach(function (tag, index, array) {\r\n Tags._AddTagTo(obj, tag);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._AddTagTo = function (obj, tag) {\r\n tag = tag.trim();\r\n if (tag === \"\" || tag === \"true\" || tag === \"false\") {\r\n return;\r\n }\r\n if (tag.match(/[\\s]/) || tag.match(/^([!]|([|]|[&]){2})/)) {\r\n return;\r\n }\r\n Tags.EnableFor(obj);\r\n obj._tags[tag] = true;\r\n };\r\n /**\r\n * Removes specific tags from a specific object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tags to remove\r\n */\r\n Tags.RemoveTagsFrom = function (obj, tagsString) {\r\n if (!Tags.HasTags(obj)) {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n for (var t in tags) {\r\n Tags._RemoveTagFrom(obj, tags[t]);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._RemoveTagFrom = function (obj, tag) {\r\n delete obj._tags[tag];\r\n };\r\n /**\r\n * Defines if tags hosted on an object match a given query\r\n * @param obj defines the object to use\r\n * @param tagsQuery defines the tag query\r\n * @returns a boolean\r\n */\r\n Tags.MatchesQuery = function (obj, tagsQuery) {\r\n if (tagsQuery === undefined) {\r\n return true;\r\n }\r\n if (tagsQuery === \"\") {\r\n return Tags.HasTags(obj);\r\n }\r\n return _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__[\"AndOrNotEvaluator\"].Eval(tagsQuery, function (r) { return Tags.HasTags(obj) && obj._tags[r]; });\r\n };\r\n return Tags;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/textureTools.ts\":\n/*!******************************!*\\\n !*** ./Misc/textureTools.ts ***!\n \\******************************/\n/*! exports provided: TextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return TextureTools; });\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to host texture specific utilities\r\n */\r\nvar TextureTools = /** @class */ (function () {\r\n function TextureTools() {\r\n }\r\n /**\r\n * Uses the GPU to create a copy texture rescaled at a given size\r\n * @param texture Texture to copy from\r\n * @param width defines the desired width\r\n * @param height defines the desired height\r\n * @param useBilinearMode defines if bilinear mode has to be used\r\n * @return the generated texture\r\n */\r\n TextureTools.CreateResizedCopy = function (texture, width, height, useBilinearMode) {\r\n if (useBilinearMode === void 0) { useBilinearMode = true; }\r\n var scene = texture.getScene();\r\n var engine = scene.getEngine();\r\n var rtt = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetTexture\"]('resized' + texture.name, { width: width, height: height }, scene, !texture.noMipmap, true, texture._texture.type, false, texture.samplingMode, false);\r\n rtt.wrapU = texture.wrapU;\r\n rtt.wrapV = texture.wrapV;\r\n rtt.uOffset = texture.uOffset;\r\n rtt.vOffset = texture.vOffset;\r\n rtt.uScale = texture.uScale;\r\n rtt.vScale = texture.vScale;\r\n rtt.uAng = texture.uAng;\r\n rtt.vAng = texture.vAng;\r\n rtt.wAng = texture.wAng;\r\n rtt.coordinatesIndex = texture.coordinatesIndex;\r\n rtt.level = texture.level;\r\n rtt.anisotropicFilteringLevel = texture.anisotropicFilteringLevel;\r\n rtt._texture.isReady = false;\r\n texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n var passPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"PassPostProcess\"](\"pass\", 1, null, useBilinearMode ? _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].BILINEAR_SAMPLINGMODE : _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].NEAREST_SAMPLINGMODE, engine, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n passPostProcess.getEffect().executeWhenCompiled(function () {\r\n passPostProcess.onApply = function (effect) {\r\n effect.setTexture(\"textureSampler\", texture);\r\n };\r\n var internalTexture = rtt.getInternalTexture();\r\n if (internalTexture) {\r\n scene.postProcessManager.directRender([passPostProcess], internalTexture);\r\n engine.unBindFramebuffer(internalTexture);\r\n rtt.disposeFramebufferObjects();\r\n passPostProcess.dispose();\r\n internalTexture.isReady = true;\r\n }\r\n });\r\n return rtt;\r\n };\r\n return TextureTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/tga.ts\":\n/*!*********************!*\\\n !*** ./Misc/tga.ts ***!\n \\*********************/\n/*! exports provided: TGATools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return TGATools; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * Based on jsTGALoader - Javascript loader for TGA file\r\n * By Vincent Thibault\r\n * @see http://blog.robrowser.com/javascript-tga-loader.html\r\n */\r\nvar TGATools = /** @class */ (function () {\r\n function TGATools() {\r\n }\r\n /**\r\n * Gets the header of a TGA file\r\n * @param data defines the TGA data\r\n * @returns the header\r\n */\r\n TGATools.GetTGAHeader = function (data) {\r\n var offset = 0;\r\n var header = {\r\n id_length: data[offset++],\r\n colormap_type: data[offset++],\r\n image_type: data[offset++],\r\n colormap_index: data[offset++] | data[offset++] << 8,\r\n colormap_length: data[offset++] | data[offset++] << 8,\r\n colormap_size: data[offset++],\r\n origin: [\r\n data[offset++] | data[offset++] << 8,\r\n data[offset++] | data[offset++] << 8\r\n ],\r\n width: data[offset++] | data[offset++] << 8,\r\n height: data[offset++] | data[offset++] << 8,\r\n pixel_size: data[offset++],\r\n flags: data[offset++]\r\n };\r\n return header;\r\n };\r\n /**\r\n * Uploads TGA content to a Babylon Texture\r\n * @hidden\r\n */\r\n TGATools.UploadContent = function (texture, data) {\r\n // Not enough data to contain header ?\r\n if (data.length < 19) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Unable to load TGA file - Not enough data to contain header\");\r\n return;\r\n }\r\n // Read Header\r\n var offset = 18;\r\n var header = TGATools.GetTGAHeader(data);\r\n // Assume it's a valid Targa file.\r\n if (header.id_length + offset > data.length) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Unable to load TGA file - Not enough data\");\r\n return;\r\n }\r\n // Skip not needed data\r\n offset += header.id_length;\r\n var use_rle = false;\r\n var use_pal = false;\r\n var use_grey = false;\r\n // Get some informations.\r\n switch (header.image_type) {\r\n case TGATools._TYPE_RLE_INDEXED:\r\n use_rle = true;\r\n case TGATools._TYPE_INDEXED:\r\n use_pal = true;\r\n break;\r\n case TGATools._TYPE_RLE_RGB:\r\n use_rle = true;\r\n case TGATools._TYPE_RGB:\r\n // use_rgb = true;\r\n break;\r\n case TGATools._TYPE_RLE_GREY:\r\n use_rle = true;\r\n case TGATools._TYPE_GREY:\r\n use_grey = true;\r\n break;\r\n }\r\n var pixel_data;\r\n // var numAlphaBits = header.flags & 0xf;\r\n var pixel_size = header.pixel_size >> 3;\r\n var pixel_total = header.width * header.height * pixel_size;\r\n // Read palettes\r\n var palettes;\r\n if (use_pal) {\r\n palettes = data.subarray(offset, offset += header.colormap_length * (header.colormap_size >> 3));\r\n }\r\n // Read LRE\r\n if (use_rle) {\r\n pixel_data = new Uint8Array(pixel_total);\r\n var c, count, i;\r\n var localOffset = 0;\r\n var pixels = new Uint8Array(pixel_size);\r\n while (offset < pixel_total && localOffset < pixel_total) {\r\n c = data[offset++];\r\n count = (c & 0x7f) + 1;\r\n // RLE pixels\r\n if (c & 0x80) {\r\n // Bind pixel tmp array\r\n for (i = 0; i < pixel_size; ++i) {\r\n pixels[i] = data[offset++];\r\n }\r\n // Copy pixel array\r\n for (i = 0; i < count; ++i) {\r\n pixel_data.set(pixels, localOffset + i * pixel_size);\r\n }\r\n localOffset += pixel_size * count;\r\n }\r\n // Raw pixels\r\n else {\r\n count *= pixel_size;\r\n for (i = 0; i < count; ++i) {\r\n pixel_data[localOffset + i] = data[offset++];\r\n }\r\n localOffset += count;\r\n }\r\n }\r\n }\r\n // RAW Pixels\r\n else {\r\n pixel_data = data.subarray(offset, offset += (use_pal ? header.width * header.height : pixel_total));\r\n }\r\n // Load to texture\r\n var x_start, y_start, x_step, y_step, y_end, x_end;\r\n switch ((header.flags & TGATools._ORIGIN_MASK) >> TGATools._ORIGIN_SHIFT) {\r\n default:\r\n case TGATools._ORIGIN_UL:\r\n x_start = 0;\r\n x_step = 1;\r\n x_end = header.width;\r\n y_start = 0;\r\n y_step = 1;\r\n y_end = header.height;\r\n break;\r\n case TGATools._ORIGIN_BL:\r\n x_start = 0;\r\n x_step = 1;\r\n x_end = header.width;\r\n y_start = header.height - 1;\r\n y_step = -1;\r\n y_end = -1;\r\n break;\r\n case TGATools._ORIGIN_UR:\r\n x_start = header.width - 1;\r\n x_step = -1;\r\n x_end = -1;\r\n y_start = 0;\r\n y_step = 1;\r\n y_end = header.height;\r\n break;\r\n case TGATools._ORIGIN_BR:\r\n x_start = header.width - 1;\r\n x_step = -1;\r\n x_end = -1;\r\n y_start = header.height - 1;\r\n y_step = -1;\r\n y_end = -1;\r\n break;\r\n }\r\n // Load the specify method\r\n var func = '_getImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits';\r\n var imageData = TGATools[func](header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end);\r\n var engine = texture.getEngine();\r\n engine._uploadDataToTextureDirectly(texture, imageData);\r\n };\r\n /** @hidden */\r\n TGATools._getImageData8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data, colormap = palettes;\r\n var width = header.width, height = header.height;\r\n var color, i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i++) {\r\n color = image[i];\r\n imageData[(x + width * y) * 4 + 3] = 255;\r\n imageData[(x + width * y) * 4 + 2] = colormap[(color * 3) + 0];\r\n imageData[(x + width * y) * 4 + 1] = colormap[(color * 3) + 1];\r\n imageData[(x + width * y) * 4 + 0] = colormap[(color * 3) + 2];\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageData16bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var color, i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 2) {\r\n color = image[i + 0] + (image[i + 1] << 8); // Inversed ?\r\n var r = (((color & 0x7C00) >> 10) * 255) / 0x1F | 0;\r\n var g = (((color & 0x03E0) >> 5) * 255) / 0x1F | 0;\r\n var b = ((color & 0x001F) * 255) / 0x1F | 0;\r\n imageData[(x + width * y) * 4 + 0] = r;\r\n imageData[(x + width * y) * 4 + 1] = g;\r\n imageData[(x + width * y) * 4 + 2] = b;\r\n imageData[(x + width * y) * 4 + 3] = (color & 0x8000) ? 0 : 255;\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageData24bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 3) {\r\n imageData[(x + width * y) * 4 + 3] = 255;\r\n imageData[(x + width * y) * 4 + 2] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 1] = image[i + 1];\r\n imageData[(x + width * y) * 4 + 0] = image[i + 2];\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageData32bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 4) {\r\n imageData[(x + width * y) * 4 + 2] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 1] = image[i + 1];\r\n imageData[(x + width * y) * 4 + 0] = image[i + 2];\r\n imageData[(x + width * y) * 4 + 3] = image[i + 3];\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageDataGrey8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var color, i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i++) {\r\n color = image[i];\r\n imageData[(x + width * y) * 4 + 0] = color;\r\n imageData[(x + width * y) * 4 + 1] = color;\r\n imageData[(x + width * y) * 4 + 2] = color;\r\n imageData[(x + width * y) * 4 + 3] = 255;\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageDataGrey16bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 2) {\r\n imageData[(x + width * y) * 4 + 0] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 1] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 2] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 3] = image[i + 1];\r\n }\r\n }\r\n return imageData;\r\n };\r\n //private static _TYPE_NO_DATA = 0;\r\n TGATools._TYPE_INDEXED = 1;\r\n TGATools._TYPE_RGB = 2;\r\n TGATools._TYPE_GREY = 3;\r\n TGATools._TYPE_RLE_INDEXED = 9;\r\n TGATools._TYPE_RLE_RGB = 10;\r\n TGATools._TYPE_RLE_GREY = 11;\r\n TGATools._ORIGIN_MASK = 0x30;\r\n TGATools._ORIGIN_SHIFT = 0x04;\r\n TGATools._ORIGIN_BL = 0x00;\r\n TGATools._ORIGIN_BR = 0x01;\r\n TGATools._ORIGIN_UL = 0x02;\r\n TGATools._ORIGIN_UR = 0x03;\r\n return TGATools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/timingTools.ts\":\n/*!*****************************!*\\\n !*** ./Misc/timingTools.ts ***!\n \\*****************************/\n/*! exports provided: TimingTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TimingTools\", function() { return TimingTools; });\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n\r\n/**\r\n * Class used to provide helper for timing\r\n */\r\nvar TimingTools = /** @class */ (function () {\r\n function TimingTools() {\r\n }\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n TimingTools.SetImmediate = function (action) {\r\n if (_domManagement__WEBPACK_IMPORTED_MODULE_0__[\"DomManagement\"].IsWindowObjectExist() && window.setImmediate) {\r\n window.setImmediate(action);\r\n }\r\n else {\r\n setTimeout(action, 1);\r\n }\r\n };\r\n return TimingTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/tools.ts\":\n/*!***********************!*\\\n !*** ./Misc/tools.ts ***!\n \\***********************/\n/*! exports provided: Tools, className, AsyncLoop */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return Tools; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return className; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return AsyncLoop; });\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _devTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _webRequest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webRequest */ \"./Misc/webRequest.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _fileTools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fileTools */ \"./Misc/fileTools.ts\");\n/* harmony import */ var _promise__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./promise */ \"./Misc/promise.ts\");\n/* harmony import */ var _timingTools__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./timingTools */ \"./Misc/timingTools.ts\");\n/* harmony import */ var _instantiationTools__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./instantiationTools */ \"./Misc/instantiationTools.ts\");\n/* harmony import */ var _guid__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./guid */ \"./Misc/guid.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing a set of static utilities functions\r\n */\r\nvar Tools = /** @class */ (function () {\r\n function Tools() {\r\n }\r\n Object.defineProperty(Tools, \"BaseUrl\", {\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n get: function () {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].BaseUrl;\r\n },\r\n set: function (value) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].BaseUrl = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"DefaultRetryStrategy\", {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n get: function () {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].DefaultRetryStrategy;\r\n },\r\n set: function (strategy) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].DefaultRetryStrategy = strategy;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"UseFallbackTexture\", {\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].UseFallbackTexture;\r\n },\r\n set: function (value) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].UseFallbackTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"RegisteredExternalClasses\", {\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n get: function () {\r\n return _instantiationTools__WEBPACK_IMPORTED_MODULE_11__[\"InstantiationTools\"].RegisteredExternalClasses;\r\n },\r\n set: function (classes) {\r\n _instantiationTools__WEBPACK_IMPORTED_MODULE_11__[\"InstantiationTools\"].RegisteredExternalClasses = classes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"fallbackTexture\", {\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].FallbackTexture;\r\n },\r\n set: function (value) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].FallbackTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Read the content of a byte array at a specified coordinates (taking in account wrapping)\r\n * @param u defines the coordinate on X axis\r\n * @param v defines the coordinate on Y axis\r\n * @param width defines the width of the source data\r\n * @param height defines the height of the source data\r\n * @param pixels defines the source byte array\r\n * @param color defines the output color\r\n */\r\n Tools.FetchToRef = function (u, v, width, height, pixels, color) {\r\n var wrappedU = ((Math.abs(u) * width) % width) | 0;\r\n var wrappedV = ((Math.abs(v) * height) % height) | 0;\r\n var position = (wrappedU + wrappedV * width) * 4;\r\n color.r = pixels[position] / 255;\r\n color.g = pixels[position + 1] / 255;\r\n color.b = pixels[position + 2] / 255;\r\n color.a = pixels[position + 3] / 255;\r\n };\r\n /**\r\n * Interpolates between a and b via alpha\r\n * @param a The lower value (returned when alpha = 0)\r\n * @param b The upper value (returned when alpha = 1)\r\n * @param alpha The interpolation-factor\r\n * @return The mixed value\r\n */\r\n Tools.Mix = function (a, b, alpha) {\r\n return a * (1 - alpha) + b * alpha;\r\n };\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n Tools.Instantiate = function (className) {\r\n return _instantiationTools__WEBPACK_IMPORTED_MODULE_11__[\"InstantiationTools\"].Instantiate(className);\r\n };\r\n /**\r\n * Provides a slice function that will work even on IE\r\n * @param data defines the array to slice\r\n * @param start defines the start of the data (optional)\r\n * @param end defines the end of the data (optional)\r\n * @returns the new sliced array\r\n */\r\n Tools.Slice = function (data, start, end) {\r\n if (data.slice) {\r\n return data.slice(start, end);\r\n }\r\n return Array.prototype.slice.call(data, start, end);\r\n };\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n Tools.SetImmediate = function (action) {\r\n _timingTools__WEBPACK_IMPORTED_MODULE_10__[\"TimingTools\"].SetImmediate(action);\r\n };\r\n /**\r\n * Function indicating if a number is an exponent of 2\r\n * @param value defines the value to test\r\n * @returns true if the value is an exponent of 2\r\n */\r\n Tools.IsExponentOfTwo = function (value) {\r\n var count = 1;\r\n do {\r\n count *= 2;\r\n } while (count < value);\r\n return count === value;\r\n };\r\n /**\r\n * Returns the nearest 32-bit single precision float representation of a Number\r\n * @param value A Number. If the parameter is of a different type, it will get converted\r\n * to a number or to NaN if it cannot be converted\r\n * @returns number\r\n */\r\n Tools.FloatRound = function (value) {\r\n if (Math.fround) {\r\n return Math.fround(value);\r\n }\r\n return (Tools._tmpFloatArray[0] = value);\r\n };\r\n /**\r\n * Extracts the filename from a path\r\n * @param path defines the path to use\r\n * @returns the filename\r\n */\r\n Tools.GetFilename = function (path) {\r\n var index = path.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n return path;\r\n }\r\n return path.substring(index + 1);\r\n };\r\n /**\r\n * Extracts the \"folder\" part of a path (everything before the filename).\r\n * @param uri The URI to extract the info from\r\n * @param returnUnchangedIfNoSlash Do not touch the URI if no slashes are present\r\n * @returns The \"folder\" part of the path\r\n */\r\n Tools.GetFolderPath = function (uri, returnUnchangedIfNoSlash) {\r\n if (returnUnchangedIfNoSlash === void 0) { returnUnchangedIfNoSlash = false; }\r\n var index = uri.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n if (returnUnchangedIfNoSlash) {\r\n return uri;\r\n }\r\n return \"\";\r\n }\r\n return uri.substring(0, index + 1);\r\n };\r\n /**\r\n * Convert an angle in radians to degrees\r\n * @param angle defines the angle to convert\r\n * @returns the angle in degrees\r\n */\r\n Tools.ToDegrees = function (angle) {\r\n return angle * 180 / Math.PI;\r\n };\r\n /**\r\n * Convert an angle in degrees to radians\r\n * @param angle defines the angle to convert\r\n * @returns the angle in radians\r\n */\r\n Tools.ToRadians = function (angle) {\r\n return angle * Math.PI / 180;\r\n };\r\n /**\r\n * Encode a buffer to a base64 string\r\n * @param buffer defines the buffer to encode\r\n * @returns the encoded string\r\n */\r\n Tools.EncodeArrayBufferTobase64 = function (buffer) {\r\n var keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n var output = \"\";\r\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\r\n var i = 0;\r\n var bytes = new Uint8Array(buffer);\r\n while (i < bytes.length) {\r\n chr1 = bytes[i++];\r\n chr2 = i < bytes.length ? bytes[i++] : Number.NaN; // Not sure if the index\r\n chr3 = i < bytes.length ? bytes[i++] : Number.NaN; // checks are needed here\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n }\r\n else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n output += keyStr.charAt(enc1) + keyStr.charAt(enc2) +\r\n keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n return \"data:image/png;base64,\" + output;\r\n };\r\n /**\r\n * Returns an array if obj is not an array\r\n * @param obj defines the object to evaluate as an array\r\n * @param allowsNullUndefined defines a boolean indicating if obj is allowed to be null or undefined\r\n * @returns either obj directly if obj is an array or a new array containing obj\r\n */\r\n Tools.MakeArray = function (obj, allowsNullUndefined) {\r\n if (allowsNullUndefined !== true && (obj === undefined || obj == null)) {\r\n return null;\r\n }\r\n return Array.isArray(obj) ? obj : [obj];\r\n };\r\n /**\r\n * Gets the pointer prefix to use\r\n * @returns \"pointer\" if touch is enabled. Else returns \"mouse\"\r\n */\r\n Tools.GetPointerPrefix = function () {\r\n var eventPrefix = \"pointer\";\r\n // Check if pointer events are supported\r\n if (_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist() && !window.PointerEvent && _domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsNavigatorAvailable() && !navigator.pointerEnabled) {\r\n eventPrefix = \"mouse\";\r\n }\r\n return eventPrefix;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n Tools.SetCorsBehavior = function (url, element) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].SetCorsBehavior(url, element);\r\n };\r\n // External files\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n Tools.CleanUrl = function (url) {\r\n url = url.replace(/#/mg, \"%23\");\r\n return url;\r\n };\r\n Object.defineProperty(Tools, \"PreprocessUrl\", {\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n get: function () {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].PreprocessUrl;\r\n },\r\n set: function (processor) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].PreprocessUrl = processor;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n Tools.LoadImage = function (input, onLoad, onError, offlineProvider) {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadImage(input, onLoad, onError, offlineProvider);\r\n };\r\n /**\r\n * Loads a file\r\n * @param url url string, ArrayBuffer, or Blob to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n Tools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url the file url to load\r\n * @returns a promise containing an ArrayBuffer corrisponding to the loaded file\r\n */\r\n Tools.LoadFileAsync = function (url) {\r\n return new Promise(function (resolve, reject) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, undefined, true, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Load a script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param onSuccess defines the callback called when the script is loaded\r\n * @param onError defines the callback to call if an error occurs\r\n * @param scriptId defines the id of the script element\r\n */\r\n Tools.LoadScript = function (scriptUrl, onSuccess, onError, scriptId) {\r\n if (!_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n var head = document.getElementsByTagName('head')[0];\r\n var script = document.createElement('script');\r\n script.setAttribute('type', 'text/javascript');\r\n script.setAttribute('src', scriptUrl);\r\n if (scriptId) {\r\n script.id = scriptId;\r\n }\r\n script.onload = function () {\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n };\r\n script.onerror = function (e) {\r\n if (onError) {\r\n onError(\"Unable to load script '\" + scriptUrl + \"'\", e);\r\n }\r\n };\r\n head.appendChild(script);\r\n };\r\n /**\r\n * Load an asynchronous script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param scriptId defines the id of the script element\r\n * @returns a promise request object\r\n */\r\n Tools.LoadScriptAsync = function (scriptUrl, scriptId) {\r\n return new Promise(function (resolve, reject) {\r\n if (!_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n resolve(false);\r\n return;\r\n }\r\n var head = document.getElementsByTagName('head')[0];\r\n var script = document.createElement('script');\r\n script.setAttribute('type', 'text/javascript');\r\n script.setAttribute('src', scriptUrl);\r\n if (scriptId) {\r\n script.id = scriptId;\r\n }\r\n script.onload = function () {\r\n resolve(true);\r\n };\r\n script.onerror = function (e) {\r\n resolve(false);\r\n };\r\n head.appendChild(script);\r\n });\r\n };\r\n /**\r\n * Loads a file from a blob\r\n * @param fileToLoad defines the blob to use\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallback defines the callback to call during loading process\r\n * @returns a file request object\r\n */\r\n Tools.ReadFileAsDataURL = function (fileToLoad, callback, progressCallback) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new _observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"](),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) {\r\n request.onCompleteObservable.notifyObservers(request);\r\n };\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n callback(e.target['result']);\r\n };\r\n reader.onprogress = progressCallback;\r\n reader.readAsDataURL(fileToLoad);\r\n return request;\r\n };\r\n /**\r\n * Loads a file\r\n * @param fileToLoad defines the file to load\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallBack defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @returns a file request object\r\n */\r\n Tools.ReadFile = function (fileToLoad, callback, progressCallBack, useArrayBuffer) {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].ReadFile(fileToLoad, callback, progressCallBack, useArrayBuffer);\r\n };\r\n /**\r\n * Creates a data url from a given string content\r\n * @param content defines the content to convert\r\n * @returns the new data url link\r\n */\r\n Tools.FileAsURL = function (content) {\r\n var fileBlob = new Blob([content]);\r\n var url = window.URL || window.webkitURL;\r\n var link = url.createObjectURL(fileBlob);\r\n return link;\r\n };\r\n /**\r\n * Format the given number to a specific decimal format\r\n * @param value defines the number to format\r\n * @param decimals defines the number of decimals to use\r\n * @returns the formatted string\r\n */\r\n Tools.Format = function (value, decimals) {\r\n if (decimals === void 0) { decimals = 2; }\r\n return value.toFixed(decimals);\r\n };\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n Tools.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n _deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(source, destination, doNotCopyList, mustCopyList);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has no own property\r\n * @param obj defines the object to test\r\n * @returns true if object has no own property\r\n */\r\n Tools.IsEmpty = function (obj) {\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Function used to register events at window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to register\r\n */\r\n Tools.RegisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.addEventListener(event.name, event.handler, false);\r\n try {\r\n if (window.parent) {\r\n window.parent.addEventListener(event.name, event.handler, false);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Function used to unregister events from window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to unregister\r\n */\r\n Tools.UnregisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.removeEventListener(event.name, event.handler);\r\n try {\r\n if (windowElement.parent) {\r\n windowElement.parent.removeEventListener(event.name, event.handler);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.DumpFramebuffer = function (width, height, engine, successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // Read the contents of the framebuffer\r\n var numberOfChannelsByLine = width * 4;\r\n var halfHeight = height / 2;\r\n //Reading datas from WebGL\r\n var data = engine.readPixels(0, 0, width, height);\r\n //To flip image on Y axis.\r\n for (var i = 0; i < halfHeight; i++) {\r\n for (var j = 0; j < numberOfChannelsByLine; j++) {\r\n var currentCell = j + i * numberOfChannelsByLine;\r\n var targetLine = height - i - 1;\r\n var targetCell = j + targetLine * numberOfChannelsByLine;\r\n var temp = data[currentCell];\r\n data[currentCell] = data[targetCell];\r\n data[targetCell] = temp;\r\n }\r\n }\r\n // Create a 2D canvas to store the result\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement('canvas');\r\n }\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n var context = Tools._ScreenshotCanvas.getContext('2d');\r\n if (context) {\r\n // Copy the pixels to a 2D canvas\r\n var imageData = context.createImageData(width, height);\r\n var castData = (imageData.data);\r\n castData.set(data);\r\n context.putImageData(imageData, 0, 0);\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType, fileName);\r\n }\r\n };\r\n /**\r\n * Converts the canvas data to blob.\r\n * This acts as a polyfill for browsers not supporting the to blob function.\r\n * @param canvas Defines the canvas to extract the data from\r\n * @param successCallback Defines the callback triggered once the data are available\r\n * @param mimeType Defines the mime type of the result\r\n */\r\n Tools.ToBlob = function (canvas, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // We need HTMLCanvasElement.toBlob for HD screenshots\r\n if (!canvas.toBlob) {\r\n // low performance polyfill based on toDataURL (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)\r\n canvas.toBlob = function (callback, type, quality) {\r\n var _this = this;\r\n setTimeout(function () {\r\n var binStr = atob(_this.toDataURL(type, quality).split(',')[1]), len = binStr.length, arr = new Uint8Array(len);\r\n for (var i = 0; i < len; i++) {\r\n arr[i] = binStr.charCodeAt(i);\r\n }\r\n callback(new Blob([arr]));\r\n });\r\n };\r\n }\r\n canvas.toBlob(function (blob) {\r\n successCallback(blob);\r\n }, mimeType);\r\n };\r\n /**\r\n * Encodes the canvas data to base 64 or automatically download the result if filename is defined\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines he filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.EncodeScreenshotCanvasData = function (successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (successCallback) {\r\n var base64Image = Tools._ScreenshotCanvas.toDataURL(mimeType);\r\n successCallback(base64Image);\r\n }\r\n else {\r\n this.ToBlob(Tools._ScreenshotCanvas, function (blob) {\r\n //Creating a link if the browser have the download attribute on the a tag, to automatically start download generated image.\r\n if ((\"download\" in document.createElement(\"a\"))) {\r\n if (!fileName) {\r\n var date = new Date();\r\n var stringDate = (date.getFullYear() + \"-\" + (date.getMonth() + 1)).slice(2) + \"-\" + date.getDate() + \"_\" + date.getHours() + \"-\" + ('0' + date.getMinutes()).slice(-2);\r\n fileName = \"screenshot_\" + stringDate + \".png\";\r\n }\r\n Tools.Download(blob, fileName);\r\n }\r\n else {\r\n var url = URL.createObjectURL(blob);\r\n var newWindow = window.open(\"\");\r\n if (!newWindow) {\r\n return;\r\n }\r\n var img = newWindow.document.createElement(\"img\");\r\n img.onload = function () {\r\n // no longer need to read the blob so it's revoked\r\n URL.revokeObjectURL(url);\r\n };\r\n img.src = url;\r\n newWindow.document.body.appendChild(img);\r\n }\r\n }, mimeType);\r\n }\r\n };\r\n /**\r\n * Downloads a blob in the browser\r\n * @param blob defines the blob to download\r\n * @param fileName defines the name of the downloaded file\r\n */\r\n Tools.Download = function (blob, fileName) {\r\n if (navigator && navigator.msSaveBlob) {\r\n navigator.msSaveBlob(blob, fileName);\r\n return;\r\n }\r\n var url = window.URL.createObjectURL(blob);\r\n var a = document.createElement(\"a\");\r\n document.body.appendChild(a);\r\n a.style.display = \"none\";\r\n a.href = url;\r\n a.download = fileName;\r\n a.addEventListener(\"click\", function () {\r\n if (a.parentElement) {\r\n a.parentElement.removeChild(a);\r\n }\r\n });\r\n a.click();\r\n window.URL.revokeObjectURL(url);\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n Tools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n */\r\n Tools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n Tools.RandomId = function () {\r\n return _guid__WEBPACK_IMPORTED_MODULE_12__[\"GUID\"].RandomId();\r\n };\r\n /**\r\n * Test if the given uri is a base64 string\r\n * @param uri The uri to test\r\n * @return True if the uri is a base64 string or false otherwise\r\n */\r\n Tools.IsBase64 = function (uri) {\r\n return uri.length < 5 ? false : uri.substr(0, 5) === \"data:\";\r\n };\r\n /**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @return The decoded base64 data.\r\n */\r\n Tools.DecodeBase64 = function (uri) {\r\n var decodedString = atob(uri.split(\",\")[1]);\r\n var bufferLength = decodedString.length;\r\n var bufferView = new Uint8Array(new ArrayBuffer(bufferLength));\r\n for (var i = 0; i < bufferLength; i++) {\r\n bufferView[i] = decodedString.charCodeAt(i);\r\n }\r\n return bufferView.buffer;\r\n };\r\n /**\r\n * Gets the absolute url.\r\n * @param url the input url\r\n * @return the absolute url\r\n */\r\n Tools.GetAbsoluteUrl = function (url) {\r\n var a = document.createElement(\"a\");\r\n a.href = url;\r\n return a.href;\r\n };\r\n Object.defineProperty(Tools, \"errorsCount\", {\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].errorsCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Log a message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Log = function (message) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Log(message);\r\n };\r\n /**\r\n * Write a warning message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Warn = function (message) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(message);\r\n };\r\n /**\r\n * Write an error message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Error = function (message) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Error(message);\r\n };\r\n Object.defineProperty(Tools, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].LogCache;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Tools.ClearLogCache = function () {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].ClearLogCache();\r\n };\r\n Object.defineProperty(Tools, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].LogLevels = level;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"PerformanceLogLevel\", {\r\n /**\r\n * Sets the current performance log level\r\n */\r\n set: function (level) {\r\n if ((level & Tools.PerformanceUserMarkLogLevel) === Tools.PerformanceUserMarkLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartUserMark;\r\n Tools.EndPerformanceCounter = Tools._EndUserMark;\r\n return;\r\n }\r\n if ((level & Tools.PerformanceConsoleLogLevel) === Tools.PerformanceConsoleLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceConsole;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceConsole;\r\n return;\r\n }\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Tools._StartPerformanceCounterDisabled = function (counterName, condition) {\r\n };\r\n Tools._EndPerformanceCounterDisabled = function (counterName, condition) {\r\n };\r\n Tools._StartUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!Tools._performance) {\r\n if (!_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n Tools._performance = window.performance;\r\n }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-Begin\");\r\n };\r\n Tools._EndUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-End\");\r\n Tools._performance.measure(counterName, counterName + \"-Begin\", counterName + \"-End\");\r\n };\r\n Tools._StartPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._StartUserMark(counterName, condition);\r\n if (console.time) {\r\n console.time(counterName);\r\n }\r\n };\r\n Tools._EndPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._EndUserMark(counterName, condition);\r\n if (console.time) {\r\n console.timeEnd(counterName);\r\n }\r\n };\r\n Object.defineProperty(Tools, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n return _precisionDate__WEBPACK_IMPORTED_MODULE_4__[\"PrecisionDate\"].Now;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This method will return the name of the class used to create the instance of the given object.\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @returns the name of the class, will be \"object\" for a custom data type not using the @className decorator\r\n */\r\n Tools.GetClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var name = null;\r\n if (!isType && object.getClassName) {\r\n name = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n name = classObj.constructor[\"__bjsclassName__\"];\r\n }\r\n if (!name) {\r\n name = typeof object;\r\n }\r\n }\r\n return name;\r\n };\r\n /**\r\n * Gets the first element of an array satisfying a given predicate\r\n * @param array defines the array to browse\r\n * @param predicate defines the predicate to use\r\n * @returns null if not found or the element\r\n */\r\n Tools.First = function (array, predicate) {\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var el = array_1[_i];\r\n if (predicate(el)) {\r\n return el;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * This method will return the name of the full name of the class, including its owning module (if any).\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @return a string that can have two forms: \"moduleName.className\" if module was specified when the class' Name was registered or \"className\" if there was not module specified.\r\n * @ignorenaming\r\n */\r\n Tools.getFullClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var className = null;\r\n var moduleName = null;\r\n if (!isType && object.getClassName) {\r\n className = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n className = classObj.constructor[\"__bjsclassName__\"];\r\n moduleName = classObj.constructor[\"__bjsmoduleName__\"];\r\n }\r\n if (!className) {\r\n className = typeof object;\r\n }\r\n }\r\n if (!className) {\r\n return null;\r\n }\r\n return ((moduleName != null) ? (moduleName + \".\") : \"\") + className;\r\n };\r\n /**\r\n * Returns a promise that resolves after the given amount of time.\r\n * @param delay Number of milliseconds to delay\r\n * @returns Promise that resolves after the given amount of time\r\n */\r\n Tools.DelayAsync = function (delay) {\r\n return new Promise(function (resolve) {\r\n setTimeout(function () {\r\n resolve();\r\n }, delay);\r\n });\r\n };\r\n /**\r\n * Enable/Disable Custom HTTP Request Headers globally.\r\n * default = false\r\n * @see CustomRequestHeaders\r\n */\r\n Tools.UseCustomRequestHeaders = false;\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n Tools.CustomRequestHeaders = _webRequest__WEBPACK_IMPORTED_MODULE_6__[\"WebRequest\"].CustomRequestHeaders;\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n Tools.CorsBehavior = \"anonymous\";\r\n Tools._tmpFloatArray = new Float32Array(1);\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * Back Compat only, please use DomManagement.GetDOMTextContent instead.\r\n */\r\n Tools.GetDOMTextContent = _domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].GetDOMTextContent;\r\n // Logs\r\n /**\r\n * No log\r\n */\r\n Tools.NoneLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].NoneLogLevel;\r\n /**\r\n * Only message logs\r\n */\r\n Tools.MessageLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].MessageLogLevel;\r\n /**\r\n * Only warning logs\r\n */\r\n Tools.WarningLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].WarningLogLevel;\r\n /**\r\n * Only error logs\r\n */\r\n Tools.ErrorLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].ErrorLogLevel;\r\n /**\r\n * All logs\r\n */\r\n Tools.AllLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].AllLogLevel;\r\n /**\r\n * Checks if the window object exists\r\n * Back Compat only, please use DomManagement.IsWindowObjectExist instead.\r\n */\r\n Tools.IsWindowObjectExist = _domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist;\r\n // Performances\r\n /**\r\n * No performance log\r\n */\r\n Tools.PerformanceNoneLogLevel = 0;\r\n /**\r\n * Use user marks to log performance\r\n */\r\n Tools.PerformanceUserMarkLogLevel = 1;\r\n /**\r\n * Log performance to the console\r\n */\r\n Tools.PerformanceConsoleLogLevel = 2;\r\n /**\r\n * Starts a performance counter\r\n */\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n /**\r\n * Ends a specific performance coutner\r\n */\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n return Tools;\r\n}());\r\n\r\n/**\r\n * Use this className as a decorator on a given class definition to add it a name and optionally its module.\r\n * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.\r\n * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified\r\n * @param name The name of the class, case should be preserved\r\n * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.\r\n */\r\nfunction className(name, module) {\r\n return function (target) {\r\n target[\"__bjsclassName__\"] = name;\r\n target[\"__bjsmoduleName__\"] = (module != null) ? module : null;\r\n };\r\n}\r\n/**\r\n * An implementation of a loop for asynchronous functions.\r\n */\r\nvar AsyncLoop = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n * @param iterations the number of iterations.\r\n * @param func the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n */\r\n function AsyncLoop(\r\n /**\r\n * Defines the number of iterations for the loop\r\n */\r\n iterations, func, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n this.iterations = iterations;\r\n this.index = offset - 1;\r\n this._done = false;\r\n this._fn = func;\r\n this._successCallback = successCallback;\r\n }\r\n /**\r\n * Execute the next iteration. Must be called after the last iteration was finished.\r\n */\r\n AsyncLoop.prototype.executeNext = function () {\r\n if (!this._done) {\r\n if (this.index + 1 < this.iterations) {\r\n ++this.index;\r\n this._fn(this);\r\n }\r\n else {\r\n this.breakLoop();\r\n }\r\n }\r\n };\r\n /**\r\n * Break the loop and run the success callback.\r\n */\r\n AsyncLoop.prototype.breakLoop = function () {\r\n this._done = true;\r\n this._successCallback();\r\n };\r\n /**\r\n * Create and run an async loop.\r\n * @param iterations the number of iterations.\r\n * @param fn the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.Run = function (iterations, fn, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var loop = new AsyncLoop(iterations, fn, successCallback, offset);\r\n loop.executeNext();\r\n return loop;\r\n };\r\n /**\r\n * A for-loop that will run a given number of iterations synchronous and the rest async.\r\n * @param iterations total number of iterations\r\n * @param syncedIterations number of synchronous iterations in each async iteration.\r\n * @param fn the function to call each iteration.\r\n * @param callback a success call back that will be called when iterating stops.\r\n * @param breakFunction a break condition (optional)\r\n * @param timeout timeout settings for the setTimeout function. default - 0.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.SyncAsyncForLoop = function (iterations, syncedIterations, fn, callback, breakFunction, timeout) {\r\n if (timeout === void 0) { timeout = 0; }\r\n return AsyncLoop.Run(Math.ceil(iterations / syncedIterations), function (loop) {\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n }\r\n else {\r\n setTimeout(function () {\r\n for (var i = 0; i < syncedIterations; ++i) {\r\n var iteration = (loop.index * syncedIterations) + i;\r\n if (iteration >= iterations) {\r\n break;\r\n }\r\n fn(iteration);\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n break;\r\n }\r\n }\r\n loop.executeNext();\r\n }, timeout);\r\n }\r\n }, callback);\r\n };\r\n return AsyncLoop;\r\n}());\r\n\r\n// Will only be define if Tools is imported freeing up some space when only engine is required\r\n_Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].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\";\r\n// Register promise fallback for IE\r\n_promise__WEBPACK_IMPORTED_MODULE_9__[\"PromisePolyfill\"].Apply();\r\n\n\n/***/ }),\n\n/***/ \"./Misc/typeStore.ts\":\n/*!***************************!*\\\n !*** ./Misc/typeStore.ts ***!\n \\***************************/\n/*! exports provided: _TypeStore */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _TypeStore; });\n/** @hidden */\r\nvar _TypeStore = /** @class */ (function () {\r\n function _TypeStore() {\r\n }\r\n /** @hidden */\r\n _TypeStore.GetClass = function (fqdn) {\r\n if (this.RegisteredTypes && this.RegisteredTypes[fqdn]) {\r\n return this.RegisteredTypes[fqdn];\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n _TypeStore.RegisteredTypes = {};\r\n return _TypeStore;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/uniqueIdGenerator.ts\":\n/*!***********************************!*\\\n !*** ./Misc/uniqueIdGenerator.ts ***!\n \\***********************************/\n/*! exports provided: UniqueIdGenerator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UniqueIdGenerator\", function() { return UniqueIdGenerator; });\n/**\r\n * Helper class used to generate session unique ID\r\n */\r\nvar UniqueIdGenerator = /** @class */ (function () {\r\n function UniqueIdGenerator() {\r\n }\r\n Object.defineProperty(UniqueIdGenerator, \"UniqueId\", {\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n */\r\n get: function () {\r\n var result = this._UniqueIdCounter;\r\n this._UniqueIdCounter++;\r\n return result;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Statics\r\n UniqueIdGenerator._UniqueIdCounter = 0;\r\n return UniqueIdGenerator;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/videoRecorder.ts\":\n/*!*******************************!*\\\n !*** ./Misc/videoRecorder.ts ***!\n \\*******************************/\n/*! exports provided: VideoRecorder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return VideoRecorder; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n\r\n\r\n/**\r\n * This can help with recording videos from BabylonJS.\r\n * This is based on the available WebRTC functionalities of the browser.\r\n *\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_video\r\n */\r\nvar VideoRecorder = /** @class */ (function () {\r\n /**\r\n * Create a new VideoCapture object which can help converting what you see in Babylon to a video file.\r\n * @param engine Defines the BabylonJS Engine you wish to record.\r\n * @param options Defines options that can be used to customize the capture.\r\n */\r\n function VideoRecorder(engine, options) {\r\n if (options === void 0) { options = null; }\r\n if (!VideoRecorder.IsSupported(engine)) {\r\n throw \"Your browser does not support recording so far.\";\r\n }\r\n var canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n throw \"The babylon engine must have a canvas to be recorded\";\r\n }\r\n this._canvas = canvas;\r\n this._canvas.isRecording = false;\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, VideoRecorder._defaultOptions, options);\r\n var stream = this._canvas.captureStream(this._options.fps);\r\n if (this._options.audioTracks) {\r\n for (var _i = 0, _a = this._options.audioTracks; _i < _a.length; _i++) {\r\n var track = _a[_i];\r\n stream.addTrack(track);\r\n }\r\n }\r\n this._mediaRecorder = new MediaRecorder(stream, { mimeType: this._options.mimeType });\r\n this._mediaRecorder.ondataavailable = this._handleDataAvailable.bind(this);\r\n this._mediaRecorder.onerror = this._handleError.bind(this);\r\n this._mediaRecorder.onstop = this._handleStop.bind(this);\r\n }\r\n /**\r\n * Returns whether or not the VideoRecorder is available in your browser.\r\n * @param engine Defines the Babylon Engine.\r\n * @returns true if supported otherwise false.\r\n */\r\n VideoRecorder.IsSupported = function (engine) {\r\n var canvas = engine.getRenderingCanvas();\r\n return (!!canvas && typeof canvas.captureStream === \"function\");\r\n };\r\n Object.defineProperty(VideoRecorder.prototype, \"isRecording\", {\r\n /**\r\n * True when a recording is already in progress.\r\n */\r\n get: function () {\r\n return !!this._canvas && this._canvas.isRecording;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stops the current recording before the default capture timeout passed in the startRecording function.\r\n */\r\n VideoRecorder.prototype.stopRecording = function () {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n return;\r\n }\r\n if (!this.isRecording) {\r\n return;\r\n }\r\n this._canvas.isRecording = false;\r\n this._mediaRecorder.stop();\r\n };\r\n /**\r\n * Starts recording the canvas for a max duration specified in parameters.\r\n * @param fileName Defines the name of the file to be downloaded when the recording stop.\r\n * If null no automatic download will start and you can rely on the promise to get the data back.\r\n * @param maxDuration Defines the maximum recording time in seconds.\r\n * It defaults to 7 seconds. A value of zero will not stop automatically, you would need to call stopRecording manually.\r\n * @return A promise callback at the end of the recording with the video data in Blob.\r\n */\r\n VideoRecorder.prototype.startRecording = function (fileName, maxDuration) {\r\n var _this = this;\r\n if (fileName === void 0) { fileName = \"babylonjs.webm\"; }\r\n if (maxDuration === void 0) { maxDuration = 7; }\r\n if (!this._canvas || !this._mediaRecorder) {\r\n throw \"Recorder has already been disposed\";\r\n }\r\n if (this.isRecording) {\r\n throw \"Recording already in progress\";\r\n }\r\n if (maxDuration > 0) {\r\n setTimeout(function () {\r\n _this.stopRecording();\r\n }, maxDuration * 1000);\r\n }\r\n this._fileName = fileName;\r\n this._recordedChunks = [];\r\n this._resolve = null;\r\n this._reject = null;\r\n this._canvas.isRecording = true;\r\n this._mediaRecorder.start(this._options.recordChunckSize);\r\n return new Promise(function (resolve, reject) {\r\n _this._resolve = resolve;\r\n _this._reject = reject;\r\n });\r\n };\r\n /**\r\n * Releases internal resources used during the recording.\r\n */\r\n VideoRecorder.prototype.dispose = function () {\r\n this._canvas = null;\r\n this._mediaRecorder = null;\r\n this._recordedChunks = [];\r\n this._fileName = null;\r\n this._resolve = null;\r\n this._reject = null;\r\n };\r\n VideoRecorder.prototype._handleDataAvailable = function (event) {\r\n if (event.data.size > 0) {\r\n this._recordedChunks.push(event.data);\r\n }\r\n };\r\n VideoRecorder.prototype._handleError = function (event) {\r\n this.stopRecording();\r\n if (this._reject) {\r\n this._reject(event.error);\r\n }\r\n else {\r\n throw new event.error();\r\n }\r\n };\r\n VideoRecorder.prototype._handleStop = function () {\r\n this.stopRecording();\r\n var superBuffer = new Blob(this._recordedChunks);\r\n if (this._resolve) {\r\n this._resolve(superBuffer);\r\n }\r\n window.URL.createObjectURL(superBuffer);\r\n if (this._fileName) {\r\n _tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].Download(superBuffer, this._fileName);\r\n }\r\n };\r\n VideoRecorder._defaultOptions = {\r\n mimeType: \"video/webm\",\r\n fps: 25,\r\n recordChunckSize: 3000\r\n };\r\n return VideoRecorder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/virtualJoystick.ts\":\n/*!*********************************!*\\\n !*** ./Misc/virtualJoystick.ts ***!\n \\*********************************/\n/*! exports provided: JoystickAxis, VirtualJoystick */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return JoystickAxis; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return VirtualJoystick; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _stringDictionary__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringDictionary */ \"./Misc/stringDictionary.ts\");\n\r\n\r\n// Mainly based on these 2 articles :\r\n// Creating an universal virtual touch joystick working for all Touch models thanks to Hand.JS : http://blogs.msdn.com/b/davrous/archive/2013/02/22/creating-an-universal-virtual-touch-joystick-working-for-all-touch-models-thanks-to-hand-js.aspx\r\n// & on Seb Lee-Delisle original work: http://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/\r\n/**\r\n * Defines the potential axis of a Joystick\r\n */\r\nvar JoystickAxis;\r\n(function (JoystickAxis) {\r\n /** X axis */\r\n JoystickAxis[JoystickAxis[\"X\"] = 0] = \"X\";\r\n /** Y axis */\r\n JoystickAxis[JoystickAxis[\"Y\"] = 1] = \"Y\";\r\n /** Z axis */\r\n JoystickAxis[JoystickAxis[\"Z\"] = 2] = \"Z\";\r\n})(JoystickAxis || (JoystickAxis = {}));\r\n/**\r\n * Class used to define virtual joystick (used in touch mode)\r\n */\r\nvar VirtualJoystick = /** @class */ (function () {\r\n /**\r\n * Creates a new virtual joystick\r\n * @param leftJoystick defines that the joystick is for left hand (false by default)\r\n */\r\n function VirtualJoystick(leftJoystick) {\r\n var _this = this;\r\n if (leftJoystick) {\r\n this._leftJoystick = true;\r\n }\r\n else {\r\n this._leftJoystick = false;\r\n }\r\n VirtualJoystick._globalJoystickIndex++;\r\n // By default left & right arrow keys are moving the X\r\n // and up & down keys are moving the Y\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n this.reverseLeftRight = false;\r\n this.reverseUpDown = false;\r\n // collections of pointers\r\n this._touches = new _stringDictionary__WEBPACK_IMPORTED_MODULE_1__[\"StringDictionary\"]();\r\n this.deltaPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._joystickSensibility = 25;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n this._onResize = function (evt) {\r\n VirtualJoystick.vjCanvasWidth = window.innerWidth;\r\n VirtualJoystick.vjCanvasHeight = window.innerHeight;\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.width = VirtualJoystick.vjCanvasWidth;\r\n VirtualJoystick.Canvas.height = VirtualJoystick.vjCanvasHeight;\r\n }\r\n VirtualJoystick.halfWidth = VirtualJoystick.vjCanvasWidth / 2;\r\n };\r\n // injecting a canvas element on top of the canvas 3D game\r\n if (!VirtualJoystick.Canvas) {\r\n window.addEventListener(\"resize\", this._onResize, false);\r\n VirtualJoystick.Canvas = document.createElement(\"canvas\");\r\n VirtualJoystick.vjCanvasWidth = window.innerWidth;\r\n VirtualJoystick.vjCanvasHeight = window.innerHeight;\r\n VirtualJoystick.Canvas.width = window.innerWidth;\r\n VirtualJoystick.Canvas.height = window.innerHeight;\r\n VirtualJoystick.Canvas.style.width = \"100%\";\r\n VirtualJoystick.Canvas.style.height = \"100%\";\r\n VirtualJoystick.Canvas.style.position = \"absolute\";\r\n VirtualJoystick.Canvas.style.backgroundColor = \"transparent\";\r\n VirtualJoystick.Canvas.style.top = \"0px\";\r\n VirtualJoystick.Canvas.style.left = \"0px\";\r\n VirtualJoystick.Canvas.style.zIndex = \"5\";\r\n VirtualJoystick.Canvas.style.msTouchAction = \"none\";\r\n // Support for jQuery PEP polyfill\r\n VirtualJoystick.Canvas.setAttribute(\"touch-action\", \"none\");\r\n var context = VirtualJoystick.Canvas.getContext('2d');\r\n if (!context) {\r\n throw new Error(\"Unable to create canvas for virtual joystick\");\r\n }\r\n VirtualJoystick.vjCanvasContext = context;\r\n VirtualJoystick.vjCanvasContext.strokeStyle = \"#ffffff\";\r\n VirtualJoystick.vjCanvasContext.lineWidth = 2;\r\n document.body.appendChild(VirtualJoystick.Canvas);\r\n }\r\n VirtualJoystick.halfWidth = VirtualJoystick.Canvas.width / 2;\r\n this.pressed = false;\r\n // default joystick color\r\n this._joystickColor = \"cyan\";\r\n this._joystickPointerID = -1;\r\n // current joystick position\r\n this._joystickPointerPos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n this._joystickPreviousPointerPos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n // origin joystick position\r\n this._joystickPointerStartPos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n this._deltaJoystickVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n this._onPointerDownHandlerRef = function (evt) {\r\n _this._onPointerDown(evt);\r\n };\r\n this._onPointerMoveHandlerRef = function (evt) {\r\n _this._onPointerMove(evt);\r\n };\r\n this._onPointerUpHandlerRef = function (evt) {\r\n _this._onPointerUp(evt);\r\n };\r\n VirtualJoystick.Canvas.addEventListener('pointerdown', this._onPointerDownHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener('pointermove', this._onPointerMoveHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener('pointerup', this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener('pointerout', this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"contextmenu\", function (evt) {\r\n evt.preventDefault(); // Disables system menu\r\n }, false);\r\n requestAnimationFrame(function () { _this._drawVirtualJoystick(); });\r\n }\r\n /**\r\n * Defines joystick sensibility (ie. the ratio beteen a physical move and virtual joystick position change)\r\n * @param newJoystickSensibility defines the new sensibility\r\n */\r\n VirtualJoystick.prototype.setJoystickSensibility = function (newJoystickSensibility) {\r\n this._joystickSensibility = newJoystickSensibility;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n };\r\n VirtualJoystick.prototype._onPointerDown = function (e) {\r\n var positionOnScreenCondition;\r\n e.preventDefault();\r\n if (this._leftJoystick === true) {\r\n positionOnScreenCondition = (e.clientX < VirtualJoystick.halfWidth);\r\n }\r\n else {\r\n positionOnScreenCondition = (e.clientX > VirtualJoystick.halfWidth);\r\n }\r\n if (positionOnScreenCondition && this._joystickPointerID < 0) {\r\n // First contact will be dedicated to the virtual joystick\r\n this._joystickPointerID = e.pointerId;\r\n this._joystickPointerStartPos.x = e.clientX;\r\n this._joystickPointerStartPos.y = e.clientY;\r\n this._joystickPointerPos = this._joystickPointerStartPos.clone();\r\n this._joystickPreviousPointerPos = this._joystickPointerStartPos.clone();\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n this.pressed = true;\r\n this._touches.add(e.pointerId.toString(), e);\r\n }\r\n else {\r\n // You can only trigger the action buttons with a joystick declared\r\n if (VirtualJoystick._globalJoystickIndex < 2 && this._action) {\r\n this._action();\r\n this._touches.add(e.pointerId.toString(), { x: e.clientX, y: e.clientY, prevX: e.clientX, prevY: e.clientY });\r\n }\r\n }\r\n };\r\n VirtualJoystick.prototype._onPointerMove = function (e) {\r\n // If the current pointer is the one associated to the joystick (first touch contact)\r\n if (this._joystickPointerID == e.pointerId) {\r\n this._joystickPointerPos.x = e.clientX;\r\n this._joystickPointerPos.y = e.clientY;\r\n this._deltaJoystickVector = this._joystickPointerPos.clone();\r\n this._deltaJoystickVector = this._deltaJoystickVector.subtract(this._joystickPointerStartPos);\r\n var directionLeftRight = this.reverseLeftRight ? -1 : 1;\r\n var deltaJoystickX = directionLeftRight * this._deltaJoystickVector.x / this._inversedSensibility;\r\n switch (this._axisTargetedByLeftAndRight) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n }\r\n var directionUpDown = this.reverseUpDown ? 1 : -1;\r\n var deltaJoystickY = directionUpDown * this._deltaJoystickVector.y / this._inversedSensibility;\r\n switch (this._axisTargetedByUpAndDown) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n }\r\n }\r\n else {\r\n var data = this._touches.get(e.pointerId.toString());\r\n if (data) {\r\n data.x = e.clientX;\r\n data.y = e.clientY;\r\n }\r\n }\r\n };\r\n VirtualJoystick.prototype._onPointerUp = function (e) {\r\n if (this._joystickPointerID == e.pointerId) {\r\n VirtualJoystick.vjCanvasContext.clearRect(this._joystickPointerStartPos.x - 64, this._joystickPointerStartPos.y - 64, 128, 128);\r\n VirtualJoystick.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x - 42, this._joystickPreviousPointerPos.y - 42, 84, 84);\r\n this._joystickPointerID = -1;\r\n this.pressed = false;\r\n }\r\n else {\r\n var touch = this._touches.get(e.pointerId.toString());\r\n if (touch) {\r\n VirtualJoystick.vjCanvasContext.clearRect(touch.prevX - 44, touch.prevY - 44, 88, 88);\r\n }\r\n }\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n this._touches.remove(e.pointerId.toString());\r\n };\r\n /**\r\n * Change the color of the virtual joystick\r\n * @param newColor a string that must be a CSS color value (like \"red\") or the hexa value (like \"#FF0000\")\r\n */\r\n VirtualJoystick.prototype.setJoystickColor = function (newColor) {\r\n this._joystickColor = newColor;\r\n };\r\n /**\r\n * Defines a callback to call when the joystick is touched\r\n * @param action defines the callback\r\n */\r\n VirtualJoystick.prototype.setActionOnTouch = function (action) {\r\n this._action = action;\r\n };\r\n /**\r\n * Defines which axis you'd like to control for left & right\r\n * @param axis defines the axis to use\r\n */\r\n VirtualJoystick.prototype.setAxisForLeftRight = function (axis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByLeftAndRight = axis;\r\n break;\r\n default:\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n break;\r\n }\r\n };\r\n /**\r\n * Defines which axis you'd like to control for up & down\r\n * @param axis defines the axis to use\r\n */\r\n VirtualJoystick.prototype.setAxisForUpDown = function (axis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByUpAndDown = axis;\r\n break;\r\n default:\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n break;\r\n }\r\n };\r\n VirtualJoystick.prototype._drawVirtualJoystick = function () {\r\n var _this = this;\r\n if (this.pressed) {\r\n this._touches.forEach(function (key, touch) {\r\n if (touch.pointerId === _this._joystickPointerID) {\r\n VirtualJoystick.vjCanvasContext.clearRect(_this._joystickPointerStartPos.x - 64, _this._joystickPointerStartPos.y - 64, 128, 128);\r\n VirtualJoystick.vjCanvasContext.clearRect(_this._joystickPreviousPointerPos.x - 42, _this._joystickPreviousPointerPos.y - 42, 84, 84);\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.lineWidth = 6;\r\n VirtualJoystick.vjCanvasContext.strokeStyle = _this._joystickColor;\r\n VirtualJoystick.vjCanvasContext.arc(_this._joystickPointerStartPos.x, _this._joystickPointerStartPos.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.strokeStyle = _this._joystickColor;\r\n VirtualJoystick.vjCanvasContext.lineWidth = 2;\r\n VirtualJoystick.vjCanvasContext.arc(_this._joystickPointerStartPos.x, _this._joystickPointerStartPos.y, 60, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.strokeStyle = _this._joystickColor;\r\n VirtualJoystick.vjCanvasContext.arc(_this._joystickPointerPos.x, _this._joystickPointerPos.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n _this._joystickPreviousPointerPos = _this._joystickPointerPos.clone();\r\n }\r\n else {\r\n VirtualJoystick.vjCanvasContext.clearRect(touch.prevX - 44, touch.prevY - 44, 88, 88);\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.fillStyle = \"white\";\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.strokeStyle = \"red\";\r\n VirtualJoystick.vjCanvasContext.lineWidth = 6;\r\n VirtualJoystick.vjCanvasContext.arc(touch.x, touch.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n touch.prevX = touch.x;\r\n touch.prevY = touch.y;\r\n }\r\n });\r\n }\r\n requestAnimationFrame(function () { _this._drawVirtualJoystick(); });\r\n };\r\n /**\r\n * Release internal HTML canvas\r\n */\r\n VirtualJoystick.prototype.releaseCanvas = function () {\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.removeEventListener('pointerdown', this._onPointerDownHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener('pointermove', this._onPointerMoveHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener('pointerup', this._onPointerUpHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener('pointerout', this._onPointerUpHandlerRef);\r\n window.removeEventListener(\"resize\", this._onResize);\r\n document.body.removeChild(VirtualJoystick.Canvas);\r\n VirtualJoystick.Canvas = null;\r\n }\r\n };\r\n // Used to draw the virtual joystick inside a 2D canvas on top of the WebGL rendering canvas\r\n VirtualJoystick._globalJoystickIndex = 0;\r\n return VirtualJoystick;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/webRequest.ts\":\n/*!****************************!*\\\n !*** ./Misc/webRequest.ts ***!\n \\****************************/\n/*! exports provided: WebRequest */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return WebRequest; });\n/**\r\n * Extended version of XMLHttpRequest with support for customizations (headers, ...)\r\n */\r\nvar WebRequest = /** @class */ (function () {\r\n function WebRequest() {\r\n this._xhr = new XMLHttpRequest();\r\n }\r\n WebRequest.prototype._injectCustomRequestHeaders = function () {\r\n for (var key in WebRequest.CustomRequestHeaders) {\r\n var val = WebRequest.CustomRequestHeaders[key];\r\n if (val) {\r\n this._xhr.setRequestHeader(key, val);\r\n }\r\n }\r\n };\r\n Object.defineProperty(WebRequest.prototype, \"onprogress\", {\r\n /**\r\n * Gets or sets a function to be called when loading progress changes\r\n */\r\n get: function () {\r\n return this._xhr.onprogress;\r\n },\r\n set: function (value) {\r\n this._xhr.onprogress = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"readyState\", {\r\n /**\r\n * Returns client's state\r\n */\r\n get: function () {\r\n return this._xhr.readyState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"status\", {\r\n /**\r\n * Returns client's status\r\n */\r\n get: function () {\r\n return this._xhr.status;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"statusText\", {\r\n /**\r\n * Returns client's status as a text\r\n */\r\n get: function () {\r\n return this._xhr.statusText;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"response\", {\r\n /**\r\n * Returns client's response\r\n */\r\n get: function () {\r\n return this._xhr.response;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseURL\", {\r\n /**\r\n * Returns client's response url\r\n */\r\n get: function () {\r\n return this._xhr.responseURL;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseText\", {\r\n /**\r\n * Returns client's response as text\r\n */\r\n get: function () {\r\n return this._xhr.responseText;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseType\", {\r\n /**\r\n * Gets or sets the expected response type\r\n */\r\n get: function () {\r\n return this._xhr.responseType;\r\n },\r\n set: function (value) {\r\n this._xhr.responseType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WebRequest.prototype.addEventListener = function (type, listener, options) {\r\n this._xhr.addEventListener(type, listener, options);\r\n };\r\n WebRequest.prototype.removeEventListener = function (type, listener, options) {\r\n this._xhr.removeEventListener(type, listener, options);\r\n };\r\n /**\r\n * Cancels any network activity\r\n */\r\n WebRequest.prototype.abort = function () {\r\n this._xhr.abort();\r\n };\r\n /**\r\n * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD\r\n * @param body defines an optional request body\r\n */\r\n WebRequest.prototype.send = function (body) {\r\n if (WebRequest.CustomRequestHeaders) {\r\n this._injectCustomRequestHeaders();\r\n }\r\n this._xhr.send(body);\r\n };\r\n /**\r\n * Sets the request method, request URL\r\n * @param method defines the method to use (GET, POST, etc..)\r\n * @param url defines the url to connect with\r\n */\r\n WebRequest.prototype.open = function (method, url) {\r\n for (var _i = 0, _a = WebRequest.CustomRequestModifiers; _i < _a.length; _i++) {\r\n var update = _a[_i];\r\n update(this._xhr, url);\r\n }\r\n // Clean url\r\n url = url.replace(\"file:http:\", \"http:\");\r\n url = url.replace(\"file:https:\", \"https:\");\r\n return this._xhr.open(method, url, true);\r\n };\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n WebRequest.CustomRequestHeaders = {};\r\n /**\r\n * Add callback functions in this array to update all the requests before they get sent to the network\r\n */\r\n WebRequest.CustomRequestModifiers = new Array();\r\n return WebRequest;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/workerPool.ts\":\n/*!****************************!*\\\n !*** ./Misc/workerPool.ts ***!\n \\****************************/\n/*! exports provided: WorkerPool */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return WorkerPool; });\n/**\r\n * Helper class to push actions to a pool of workers.\r\n */\r\nvar WorkerPool = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param workers Array of workers to use for actions\r\n */\r\n function WorkerPool(workers) {\r\n this._pendingActions = new Array();\r\n this._workerInfos = workers.map(function (worker) { return ({\r\n worker: worker,\r\n active: false\r\n }); });\r\n }\r\n /**\r\n * Terminates all workers and clears any pending actions.\r\n */\r\n WorkerPool.prototype.dispose = function () {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n workerInfo.worker.terminate();\r\n }\r\n delete this._workerInfos;\r\n delete this._pendingActions;\r\n };\r\n /**\r\n * Pushes an action to the worker pool. If all the workers are active, the action will be\r\n * pended until a worker has completed its action.\r\n * @param action The action to perform. Call onComplete when the action is complete.\r\n */\r\n WorkerPool.prototype.push = function (action) {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n if (!workerInfo.active) {\r\n this._execute(workerInfo, action);\r\n return;\r\n }\r\n }\r\n this._pendingActions.push(action);\r\n };\r\n WorkerPool.prototype._execute = function (workerInfo, action) {\r\n var _this = this;\r\n workerInfo.active = true;\r\n action(workerInfo.worker, function () {\r\n workerInfo.active = false;\r\n var nextAction = _this._pendingActions.shift();\r\n if (nextAction) {\r\n _this._execute(workerInfo, nextAction);\r\n }\r\n });\r\n };\r\n return WorkerPool;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Morph/index.ts\":\n/*!************************!*\\\n !*** ./Morph/index.ts ***!\n \\************************/\n/*! exports provided: MorphTarget, MorphTargetManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _morphTarget__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./morphTarget */ \"./Morph/morphTarget.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return _morphTarget__WEBPACK_IMPORTED_MODULE_0__[\"MorphTarget\"]; });\n\n/* harmony import */ var _morphTargetManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./morphTargetManager */ \"./Morph/morphTargetManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return _morphTargetManager__WEBPACK_IMPORTED_MODULE_1__[\"MorphTargetManager\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Morph/morphTarget.ts\":\n/*!******************************!*\\\n !*** ./Morph/morphTarget.ts ***!\n \\******************************/\n/*! exports provided: MorphTarget */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return MorphTarget; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines a target to use with MorphTargetManager\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTarget = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTarget\r\n * @param name defines the name of the target\r\n * @param influence defines the influence to use\r\n * @param scene defines the scene the morphtarget belongs to\r\n */\r\n function MorphTarget(\r\n /** defines the name of the target */\r\n name, influence, scene) {\r\n if (influence === void 0) { influence = 0; }\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n /**\r\n * Gets or sets the list of animations\r\n */\r\n this.animations = new Array();\r\n this._positions = null;\r\n this._normals = null;\r\n this._tangents = null;\r\n this._uvs = null;\r\n /**\r\n * Observable raised when the influence changes\r\n */\r\n this.onInfluenceChanged = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** @hidden */\r\n this._onDataLayoutChanged = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._animationPropertiesOverride = null;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedScene;\r\n this.influence = influence;\r\n }\r\n Object.defineProperty(MorphTarget.prototype, \"influence\", {\r\n /**\r\n * Gets or sets the influence of this target (ie. its weight in the overall morphing)\r\n */\r\n get: function () {\r\n return this._influence;\r\n },\r\n set: function (influence) {\r\n if (this._influence === influence) {\r\n return;\r\n }\r\n var previous = this._influence;\r\n this._influence = influence;\r\n if (this.onInfluenceChanged.hasObservers) {\r\n this.onInfluenceChanged.notifyObservers(previous === 0 || influence === 0);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride && this._scene) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasPositions\", {\r\n /**\r\n * Gets a boolean defining if the target contains position data\r\n */\r\n get: function () {\r\n return !!this._positions;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasNormals\", {\r\n /**\r\n * Gets a boolean defining if the target contains normal data\r\n */\r\n get: function () {\r\n return !!this._normals;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasTangents\", {\r\n /**\r\n * Gets a boolean defining if the target contains tangent data\r\n */\r\n get: function () {\r\n return !!this._tangents;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasUVs\", {\r\n /**\r\n * Gets a boolean defining if the target contains texture coordinates data\r\n */\r\n get: function () {\r\n return !!this._uvs;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Affects position data to this target\r\n * @param data defines the position data to use\r\n */\r\n MorphTarget.prototype.setPositions = function (data) {\r\n var hadPositions = this.hasPositions;\r\n this._positions = data;\r\n if (hadPositions !== this.hasPositions) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the position data stored in this target\r\n * @returns a FloatArray containing the position data (or null if not present)\r\n */\r\n MorphTarget.prototype.getPositions = function () {\r\n return this._positions;\r\n };\r\n /**\r\n * Affects normal data to this target\r\n * @param data defines the normal data to use\r\n */\r\n MorphTarget.prototype.setNormals = function (data) {\r\n var hadNormals = this.hasNormals;\r\n this._normals = data;\r\n if (hadNormals !== this.hasNormals) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the normal data stored in this target\r\n * @returns a FloatArray containing the normal data (or null if not present)\r\n */\r\n MorphTarget.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Affects tangent data to this target\r\n * @param data defines the tangent data to use\r\n */\r\n MorphTarget.prototype.setTangents = function (data) {\r\n var hadTangents = this.hasTangents;\r\n this._tangents = data;\r\n if (hadTangents !== this.hasTangents) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the tangent data stored in this target\r\n * @returns a FloatArray containing the tangent data (or null if not present)\r\n */\r\n MorphTarget.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Affects texture coordinates data to this target\r\n * @param data defines the texture coordinates data to use\r\n */\r\n MorphTarget.prototype.setUVs = function (data) {\r\n var hadUVs = this.hasUVs;\r\n this._uvs = data;\r\n if (hadUVs !== this.hasUVs) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the texture coordinates data stored in this target\r\n * @returns a FloatArray containing the texture coordinates data (or null if not present)\r\n */\r\n MorphTarget.prototype.getUVs = function () {\r\n return this._uvs;\r\n };\r\n /**\r\n * Serializes the current target into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTarget.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.influence = this.influence;\r\n serializationObject.positions = Array.prototype.slice.call(this.getPositions());\r\n if (this.id != null) {\r\n serializationObject.id = this.id;\r\n }\r\n if (this.hasNormals) {\r\n serializationObject.normals = Array.prototype.slice.call(this.getNormals());\r\n }\r\n if (this.hasTangents) {\r\n serializationObject.tangents = Array.prototype.slice.call(this.getTangents());\r\n }\r\n if (this.hasUVs) {\r\n serializationObject.uvs = Array.prototype.slice.call(this.getUVs());\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_4__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Returns the string \"MorphTarget\"\r\n * @returns \"MorphTarget\"\r\n */\r\n MorphTarget.prototype.getClassName = function () {\r\n return \"MorphTarget\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new target from serialized data\r\n * @param serializationObject defines the serialized data to use\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.Parse = function (serializationObject) {\r\n var result = new MorphTarget(serializationObject.name, serializationObject.influence);\r\n result.setPositions(serializationObject.positions);\r\n if (serializationObject.id != null) {\r\n result.id = serializationObject.id;\r\n }\r\n if (serializationObject.normals) {\r\n result.setNormals(serializationObject.normals);\r\n }\r\n if (serializationObject.tangents) {\r\n result.setTangents(serializationObject.tangents);\r\n }\r\n if (serializationObject.uvs) {\r\n result.setUVs(serializationObject.uvs);\r\n }\r\n // Animations\r\n if (serializationObject.animations) {\r\n for (var animationIndex = 0; animationIndex < serializationObject.animations.length; animationIndex++) {\r\n var parsedAnimation = serializationObject.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n result.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a MorphTarget from mesh data\r\n * @param mesh defines the source mesh\r\n * @param name defines the name to use for the new target\r\n * @param influence defines the influence to attach to the target\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.FromMesh = function (mesh, name, influence) {\r\n if (!name) {\r\n name = mesh.name;\r\n }\r\n var result = new MorphTarget(name, influence, mesh.getScene());\r\n result.setPositions(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind));\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n result.setNormals(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind));\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n result.setTangents(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind));\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n result.setUVs(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind));\r\n }\r\n return result;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_4__[\"serialize\"])()\r\n ], MorphTarget.prototype, \"id\", void 0);\r\n return MorphTarget;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Morph/morphTargetManager.ts\":\n/*!*************************************!*\\\n !*** ./Morph/morphTargetManager.ts ***!\n \\*************************************/\n/*! exports provided: MorphTargetManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return MorphTargetManager; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _morphTarget__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./morphTarget */ \"./Morph/morphTarget.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This class is used to deform meshes using morphing between different targets\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTargetManager = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTargetManager\r\n * @param scene defines the current scene\r\n */\r\n function MorphTargetManager(scene) {\r\n if (scene === void 0) { scene = null; }\r\n this._targets = new Array();\r\n this._targetInfluenceChangedObservers = new Array();\r\n this._targetDataLayoutChangedObservers = new Array();\r\n this._activeTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](16);\r\n this._supportsNormals = false;\r\n this._supportsTangents = false;\r\n this._supportsUVs = false;\r\n this._vertexCount = 0;\r\n this._uniqueId = 0;\r\n this._tempInfluences = new Array();\r\n /**\r\n * Gets or sets a boolean indicating if normals must be morphed\r\n */\r\n this.enableNormalMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if tangents must be morphed\r\n */\r\n this.enableTangentMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if UV must be morphed\r\n */\r\n this.enableUVMorphing = true;\r\n if (!scene) {\r\n scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedScene;\r\n }\r\n this._scene = scene;\r\n if (this._scene) {\r\n this._scene.morphTargetManagers.push(this);\r\n this._uniqueId = this._scene.getUniqueId();\r\n }\r\n }\r\n Object.defineProperty(MorphTargetManager.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"vertexCount\", {\r\n /**\r\n * Gets the number of vertices handled by this manager\r\n */\r\n get: function () {\r\n return this._vertexCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsNormals\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of normals\r\n */\r\n get: function () {\r\n return this._supportsNormals && this.enableNormalMorphing;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsTangents\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of tangents\r\n */\r\n get: function () {\r\n return this._supportsTangents && this.enableTangentMorphing;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsUVs\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates\r\n */\r\n get: function () {\r\n return this._supportsUVs && this.enableUVMorphing;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numTargets\", {\r\n /**\r\n * Gets the number of targets stored in this manager\r\n */\r\n get: function () {\r\n return this._targets.length;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numInfluencers\", {\r\n /**\r\n * Gets the number of influencers (ie. the number of targets with influences > 0)\r\n */\r\n get: function () {\r\n return this._activeTargets.length;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"influences\", {\r\n /**\r\n * Gets the list of influences (one per target)\r\n */\r\n get: function () {\r\n return this._influences;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the active target at specified index. An active target is a target with an influence > 0\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getActiveTarget = function (index) {\r\n return this._activeTargets.data[index];\r\n };\r\n /**\r\n * Gets the target at specified index\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getTarget = function (index) {\r\n return this._targets[index];\r\n };\r\n /**\r\n * Add a new target to this manager\r\n * @param target defines the target to add\r\n */\r\n MorphTargetManager.prototype.addTarget = function (target) {\r\n var _this = this;\r\n this._targets.push(target);\r\n this._targetInfluenceChangedObservers.push(target.onInfluenceChanged.add(function (needUpdate) {\r\n _this._syncActiveTargets(needUpdate);\r\n }));\r\n this._targetDataLayoutChangedObservers.push(target._onDataLayoutChanged.add(function () {\r\n _this._syncActiveTargets(true);\r\n }));\r\n this._syncActiveTargets(true);\r\n };\r\n /**\r\n * Removes a target from the manager\r\n * @param target defines the target to remove\r\n */\r\n MorphTargetManager.prototype.removeTarget = function (target) {\r\n var index = this._targets.indexOf(target);\r\n if (index >= 0) {\r\n this._targets.splice(index, 1);\r\n target.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(index, 1)[0]);\r\n target._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(index, 1)[0]);\r\n this._syncActiveTargets(true);\r\n }\r\n };\r\n /**\r\n * Serializes the current manager into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTargetManager.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.targets = [];\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n serializationObject.targets.push(target.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n MorphTargetManager.prototype._syncActiveTargets = function (needUpdate) {\r\n var influenceCount = 0;\r\n this._activeTargets.reset();\r\n this._supportsNormals = true;\r\n this._supportsTangents = true;\r\n this._supportsUVs = true;\r\n this._vertexCount = 0;\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (target.influence === 0) {\r\n continue;\r\n }\r\n this._activeTargets.push(target);\r\n this._tempInfluences[influenceCount++] = target.influence;\r\n this._supportsNormals = this._supportsNormals && target.hasNormals;\r\n this._supportsTangents = this._supportsTangents && target.hasTangents;\r\n this._supportsUVs = this._supportsUVs && target.hasUVs;\r\n var positions = target.getPositions();\r\n if (positions) {\r\n var vertexCount = positions.length / 3;\r\n if (this._vertexCount === 0) {\r\n this._vertexCount = vertexCount;\r\n }\r\n else if (this._vertexCount !== vertexCount) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Incompatible target. Targets must all have the same vertices count.\");\r\n return;\r\n }\r\n }\r\n }\r\n if (!this._influences || this._influences.length !== influenceCount) {\r\n this._influences = new Float32Array(influenceCount);\r\n }\r\n for (var index = 0; index < influenceCount; index++) {\r\n this._influences[index] = this._tempInfluences[index];\r\n }\r\n if (needUpdate) {\r\n this.synchronize();\r\n }\r\n };\r\n /**\r\n * Syncrhonize the targets with all the meshes using this morph target manager\r\n */\r\n MorphTargetManager.prototype.synchronize = function () {\r\n if (!this._scene) {\r\n return;\r\n }\r\n // Flag meshes as dirty to resync with the active targets\r\n for (var _i = 0, _a = this._scene.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.morphTargetManager === this) {\r\n mesh._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Creates a new MorphTargetManager from serialized data\r\n * @param serializationObject defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns the new MorphTargetManager\r\n */\r\n MorphTargetManager.Parse = function (serializationObject, scene) {\r\n var result = new MorphTargetManager(scene);\r\n result._uniqueId = serializationObject.id;\r\n for (var _i = 0, _a = serializationObject.targets; _i < _a.length; _i++) {\r\n var targetData = _a[_i];\r\n result.addTarget(_morphTarget__WEBPACK_IMPORTED_MODULE_3__[\"MorphTarget\"].Parse(targetData));\r\n }\r\n return result;\r\n };\r\n return MorphTargetManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Navigation/Plugins/index.ts\":\n/*!*************************************!*\\\n !*** ./Navigation/Plugins/index.ts ***!\n \\*************************************/\n/*! exports provided: RecastJSPlugin, RecastJSCrowd */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _recastJSPlugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./recastJSPlugin */ \"./Navigation/Plugins/recastJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _recastJSPlugin__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _recastJSPlugin__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSCrowd\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Navigation/Plugins/recastJSPlugin.ts\":\n/*!**********************************************!*\\\n !*** ./Navigation/Plugins/recastJSPlugin.ts ***!\n \\**********************************************/\n/*! exports provided: RecastJSPlugin, RecastJSCrowd */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return RecastJSPlugin; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return RecastJSCrowd; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math */ \"./Maths/math.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * RecastJS navigation plugin\r\n */\r\nvar RecastJSPlugin = /** @class */ (function () {\r\n /**\r\n * Initializes the recastJS plugin\r\n * @param recastInjection can be used to inject your own recast reference\r\n */\r\n function RecastJSPlugin(recastInjection) {\r\n if (recastInjection === void 0) { recastInjection = Recast; }\r\n /**\r\n * Reference to the Recast library\r\n */\r\n this.bjsRECAST = {};\r\n /**\r\n * plugin name\r\n */\r\n this.name = \"RecastJSPlugin\";\r\n if (typeof recastInjection === \"function\") {\r\n recastInjection(this.bjsRECAST);\r\n }\r\n else {\r\n this.bjsRECAST = recastInjection;\r\n }\r\n if (!this.isSupported()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"RecastJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n }\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigatio mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n RecastJSPlugin.prototype.createMavMesh = function (meshes, parameters) {\r\n var rc = new this.bjsRECAST.rcConfig();\r\n rc.cs = parameters.cs;\r\n rc.ch = parameters.ch;\r\n rc.borderSize = 0;\r\n rc.tileSize = 0;\r\n rc.walkableSlopeAngle = parameters.walkableSlopeAngle;\r\n rc.walkableHeight = parameters.walkableHeight;\r\n rc.walkableClimb = parameters.walkableClimb;\r\n rc.walkableRadius = parameters.walkableRadius;\r\n rc.maxEdgeLen = parameters.maxEdgeLen;\r\n rc.maxSimplificationError = parameters.maxSimplificationError;\r\n rc.minRegionArea = parameters.minRegionArea;\r\n rc.mergeRegionArea = parameters.mergeRegionArea;\r\n rc.maxVertsPerPoly = parameters.maxVertsPerPoly;\r\n rc.detailSampleDist = parameters.detailSampleDist;\r\n rc.detailSampleMaxError = parameters.detailSampleMaxError;\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n var index;\r\n var tri;\r\n var pt;\r\n var indices = [];\r\n var positions = [];\r\n var offset = 0;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n var mesh = meshes[index];\r\n var meshIndices = mesh.getIndices();\r\n if (!meshIndices) {\r\n continue;\r\n }\r\n var meshPositions = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, false, false);\r\n if (!meshPositions) {\r\n continue;\r\n }\r\n var wm = mesh.computeWorldMatrix(false);\r\n for (tri = 0; tri < meshIndices.length; tri++) {\r\n indices.push(meshIndices[tri] + offset);\r\n }\r\n var transformed = _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var position = _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n for (pt = 0; pt < meshPositions.length; pt += 3) {\r\n _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArrayToRef(meshPositions, pt, position);\r\n _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(position, wm, transformed);\r\n positions.push(transformed.x, transformed.y, transformed.z);\r\n }\r\n offset += meshPositions.length / 3;\r\n }\r\n }\r\n this.navMesh.build(positions, offset, indices, indices.length, rc);\r\n };\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n RecastJSPlugin.prototype.createDebugNavMesh = function (scene) {\r\n var tri;\r\n var pt;\r\n var debugNavMesh = this.navMesh.getDebugNavMesh();\r\n var triangleCount = debugNavMesh.getTriangleCount();\r\n var indices = [];\r\n var positions = [];\r\n for (tri = 0; tri < triangleCount * 3; tri++) {\r\n indices.push(tri);\r\n }\r\n for (tri = 0; tri < triangleCount; tri++) {\r\n for (pt = 0; pt < 3; pt++) {\r\n var point = debugNavMesh.getTriangle(tri).getPoint(pt);\r\n positions.push(point.x, point.y, point.z);\r\n }\r\n }\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"NavMeshDebug\", scene);\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.applyToMesh(mesh, false);\r\n return mesh;\r\n };\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n RecastJSPlugin.prototype.getClosestPoint = function (position) {\r\n var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);\r\n var ret = this.navMesh.getClosestPoint(p);\r\n var pr = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](ret.x, ret.y, ret.z);\r\n return pr;\r\n };\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n RecastJSPlugin.prototype.getRandomPointAround = function (position, maxRadius) {\r\n var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);\r\n var ret = this.navMesh.getRandomPointAround(p, maxRadius);\r\n var pr = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](ret.x, ret.y, ret.z);\r\n return pr;\r\n };\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n RecastJSPlugin.prototype.moveAlong = function (position, destination) {\r\n var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);\r\n var d = new this.bjsRECAST.Vec3(destination.x, destination.y, destination.z);\r\n var ret = this.navMesh.moveAlong(p, d);\r\n var pr = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](ret.x, ret.y, ret.z);\r\n return pr;\r\n };\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n RecastJSPlugin.prototype.computePath = function (start, end) {\r\n var pt;\r\n var startPos = new this.bjsRECAST.Vec3(start.x, start.y, start.z);\r\n var endPos = new this.bjsRECAST.Vec3(end.x, end.y, end.z);\r\n var navPath = this.navMesh.computePath(startPos, endPos);\r\n var pointCount = navPath.getPointCount();\r\n var positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n var p = navPath.getPoint(pt);\r\n positions.push(new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](p.x, p.y, p.z));\r\n }\r\n return positions;\r\n };\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n RecastJSPlugin.prototype.createCrowd = function (maxAgents, maxAgentRadius, scene) {\r\n var crowd = new RecastJSCrowd(this, maxAgents, maxAgentRadius, scene);\r\n return crowd;\r\n };\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n RecastJSPlugin.prototype.setDefaultQueryExtent = function (extent) {\r\n var ext = new this.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.navMesh.setDefaultQueryExtent(ext);\r\n };\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n RecastJSPlugin.prototype.getDefaultQueryExtent = function () {\r\n var p = this.navMesh.getDefaultQueryExtent();\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](p.x, p.y, p.z);\r\n };\r\n /**\r\n * Disposes\r\n */\r\n RecastJSPlugin.prototype.dispose = function () {\r\n };\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n RecastJSPlugin.prototype.isSupported = function () {\r\n return this.bjsRECAST !== undefined;\r\n };\r\n return RecastJSPlugin;\r\n}());\r\n\r\n/**\r\n * Recast detour crowd implementation\r\n */\r\nvar RecastJSCrowd = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param plugin recastJS plugin\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n function RecastJSCrowd(plugin, maxAgents, maxAgentRadius, scene) {\r\n var _this = this;\r\n /**\r\n * Link to the detour crowd\r\n */\r\n this.recastCrowd = {};\r\n /**\r\n * One transform per agent\r\n */\r\n this.transforms = new Array();\r\n /**\r\n * All agents created\r\n */\r\n this.agents = new Array();\r\n /**\r\n * Observer for crowd updates\r\n */\r\n this._onBeforeAnimationsObserver = null;\r\n this.bjsRECASTPlugin = plugin;\r\n this.recastCrowd = new this.bjsRECASTPlugin.bjsRECAST.Crowd(maxAgents, maxAgentRadius, this.bjsRECASTPlugin.navMesh.getNavMesh());\r\n this._scene = scene;\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {\r\n _this.update(scene.getEngine().getDeltaTime() * 0.001);\r\n });\r\n }\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n RecastJSCrowd.prototype.addAgent = function (pos, parameters, transform) {\r\n var agentParams = new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams();\r\n agentParams.radius = parameters.radius;\r\n agentParams.height = parameters.height;\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n agentParams.separationWeight = parameters.separationWeight;\r\n agentParams.updateFlags = 7;\r\n agentParams.obstacleAvoidanceType = 0;\r\n agentParams.queryFilterType = 0;\r\n agentParams.userData = 0;\r\n var agentIndex = this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(pos.x, pos.y, pos.z), agentParams);\r\n this.transforms.push(transform);\r\n this.agents.push(agentIndex);\r\n return agentIndex;\r\n };\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n RecastJSCrowd.prototype.getAgentPosition = function (index) {\r\n var agentPos = this.recastCrowd.getAgentPosition(index);\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](agentPos.x, agentPos.y, agentPos.z);\r\n };\r\n /**\r\n * Returns the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n RecastJSCrowd.prototype.getAgentVelocity = function (index) {\r\n var agentVel = this.recastCrowd.getAgentVelocity(index);\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](agentVel.x, agentVel.y, agentVel.z);\r\n };\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n RecastJSCrowd.prototype.agentGoto = function (index, destination) {\r\n this.recastCrowd.agentGoto(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n };\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n RecastJSCrowd.prototype.removeAgent = function (index) {\r\n this.recastCrowd.removeAgent(index);\r\n var item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this.agents.splice(item, 1);\r\n this.transforms.splice(item, 1);\r\n }\r\n };\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n RecastJSCrowd.prototype.getAgents = function () {\r\n return this.agents;\r\n };\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n RecastJSCrowd.prototype.update = function (deltaTime) {\r\n // update crowd\r\n this.recastCrowd.update(deltaTime);\r\n // update transforms\r\n for (var index = 0; index < this.agents.length; index++) {\r\n this.transforms[index].position = this.getAgentPosition(this.agents[index]);\r\n }\r\n };\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n RecastJSCrowd.prototype.setDefaultQueryExtent = function (extent) {\r\n var ext = new this.bjsRECASTPlugin.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.recastCrowd.setDefaultQueryExtent(ext);\r\n };\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n RecastJSCrowd.prototype.getDefaultQueryExtent = function () {\r\n var p = this.recastCrowd.getDefaultQueryExtent();\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](p.x, p.y, p.z);\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n RecastJSCrowd.prototype.dispose = function () {\r\n this.recastCrowd.destroy();\r\n this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n };\r\n return RecastJSCrowd;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Navigation/index.ts\":\n/*!*****************************!*\\\n !*** ./Navigation/index.ts ***!\n \\*****************************/\n/*! exports provided: RecastJSPlugin, RecastJSCrowd */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Plugins_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Plugins/index */ \"./Navigation/Plugins/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSCrowd\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Offline/database.ts\":\n/*!*****************************!*\\\n !*** ./Offline/database.ts ***!\n \\*****************************/\n/*! exports provided: Database */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return Database; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_tga__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tga */ \"./Misc/tga.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/webRequest */ \"./Misc/webRequest.ts\");\n\r\n\r\n\r\n\r\n\r\n// Sets the default offline provider to Babylon.js\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].OfflineProviderFactory = function (urlToScene, callbackManifestChecked, disableManifestCheck) {\r\n if (disableManifestCheck === void 0) { disableManifestCheck = false; }\r\n return new Database(urlToScene, callbackManifestChecked, disableManifestCheck);\r\n};\r\n/**\r\n * Class used to enable access to IndexedDB\r\n * @see http://doc.babylonjs.com/how_to/caching_resources_in_indexeddb\r\n */\r\nvar Database = /** @class */ (function () {\r\n /**\r\n * Creates a new Database\r\n * @param urlToScene defines the url to load the scene\r\n * @param callbackManifestChecked defines the callback to use when manifest is checked\r\n * @param disableManifestCheck defines a boolean indicating that we want to skip the manifest validation (it will be considered validated and up to date)\r\n */\r\n function Database(urlToScene, callbackManifestChecked, disableManifestCheck) {\r\n var _this = this;\r\n if (disableManifestCheck === void 0) { disableManifestCheck = false; }\r\n // Handling various flavors of prefixed version of IndexedDB\r\n this._idbFactory = (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB);\r\n this._callbackManifestChecked = callbackManifestChecked;\r\n this._currentSceneUrl = Database._ReturnFullUrlLocation(urlToScene);\r\n this._db = null;\r\n this._enableSceneOffline = false;\r\n this._enableTexturesOffline = false;\r\n this._manifestVersionFound = 0;\r\n this._mustUpdateRessources = false;\r\n this._hasReachedQuota = false;\r\n if (!Database.IDBStorageEnabled) {\r\n this._callbackManifestChecked(true);\r\n }\r\n else {\r\n if (disableManifestCheck) {\r\n this._enableSceneOffline = true;\r\n this._enableTexturesOffline = true;\r\n this._manifestVersionFound = 1;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].SetImmediate(function () {\r\n _this._callbackManifestChecked(true);\r\n });\r\n }\r\n else {\r\n this._checkManifestFile();\r\n }\r\n }\r\n }\r\n Object.defineProperty(Database.prototype, \"enableSceneOffline\", {\r\n /**\r\n * Gets a boolean indicating if scene must be saved in the database\r\n */\r\n get: function () {\r\n return this._enableSceneOffline;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Database.prototype, \"enableTexturesOffline\", {\r\n /**\r\n * Gets a boolean indicating if textures must be saved in the database\r\n */\r\n get: function () {\r\n return this._enableTexturesOffline;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Database.prototype._checkManifestFile = function () {\r\n var _this = this;\r\n var noManifestFile = function () {\r\n _this._enableSceneOffline = false;\r\n _this._enableTexturesOffline = false;\r\n _this._callbackManifestChecked(false);\r\n };\r\n var timeStampUsed = false;\r\n var manifestURL = this._currentSceneUrl + \".manifest\";\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__[\"WebRequest\"]();\r\n if (navigator.onLine) {\r\n // Adding a timestamp to by-pass browsers' cache\r\n timeStampUsed = true;\r\n manifestURL = manifestURL + (manifestURL.match(/\\?/) == null ? \"?\" : \"&\") + Date.now();\r\n }\r\n xhr.open(\"GET\", manifestURL);\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 || Database._ValidateXHRData(xhr, 1)) {\r\n try {\r\n var manifestFile = JSON.parse(xhr.response);\r\n _this._enableSceneOffline = manifestFile.enableSceneOffline;\r\n _this._enableTexturesOffline = manifestFile.enableTexturesOffline && Database.IsUASupportingBlobStorage;\r\n if (manifestFile.version && !isNaN(parseInt(manifestFile.version))) {\r\n _this._manifestVersionFound = manifestFile.version;\r\n }\r\n if (_this._callbackManifestChecked) {\r\n _this._callbackManifestChecked(true);\r\n }\r\n }\r\n catch (ex) {\r\n noManifestFile();\r\n }\r\n }\r\n else {\r\n noManifestFile();\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n if (timeStampUsed) {\r\n timeStampUsed = false;\r\n // Let's retry without the timeStamp\r\n // It could fail when coupled with HTML5 Offline API\r\n var retryManifestURL = _this._currentSceneUrl + \".manifest\";\r\n xhr.open(\"GET\", retryManifestURL);\r\n xhr.send();\r\n }\r\n else {\r\n noManifestFile();\r\n }\r\n }, false);\r\n try {\r\n xhr.send();\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error on XHR send request.\");\r\n this._callbackManifestChecked(false);\r\n }\r\n };\r\n /**\r\n * Open the database and make it available\r\n * @param successCallback defines the callback to call on success\r\n * @param errorCallback defines the callback to call on error\r\n */\r\n Database.prototype.open = function (successCallback, errorCallback) {\r\n var _this = this;\r\n var handleError = function () {\r\n _this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n };\r\n if (!this._idbFactory || !(this._enableSceneOffline || this._enableTexturesOffline)) {\r\n // Your browser doesn't support IndexedDB\r\n this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n }\r\n else {\r\n // If the DB hasn't been opened or created yet\r\n if (!this._db) {\r\n this._hasReachedQuota = false;\r\n this._isSupported = true;\r\n var request = this._idbFactory.open(\"babylonjs\", 1);\r\n // Could occur if user is blocking the quota for the DB and/or doesn't grant access to IndexedDB\r\n request.onerror = function () {\r\n handleError();\r\n };\r\n // executes when a version change transaction cannot complete due to other active transactions\r\n request.onblocked = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"IDB request blocked. Please reload the page.\");\r\n handleError();\r\n };\r\n // DB has been opened successfully\r\n request.onsuccess = function () {\r\n _this._db = request.result;\r\n successCallback();\r\n };\r\n // Initialization of the DB. Creating Scenes & Textures stores\r\n request.onupgradeneeded = function (event) {\r\n _this._db = (event.target).result;\r\n if (_this._db) {\r\n try {\r\n _this._db.createObjectStore(\"scenes\", { keyPath: \"sceneUrl\" });\r\n _this._db.createObjectStore(\"versions\", { keyPath: \"sceneUrl\" });\r\n _this._db.createObjectStore(\"textures\", { keyPath: \"textureUrl\" });\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error while creating object stores. Exception: \" + ex.message);\r\n handleError();\r\n }\r\n }\r\n };\r\n }\r\n // DB has already been created and opened\r\n else {\r\n if (successCallback) {\r\n successCallback();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Loads an image from the database\r\n * @param url defines the url to load from\r\n * @param image defines the target DOM image\r\n */\r\n Database.prototype.loadImage = function (url, image) {\r\n var _this = this;\r\n var completeURL = Database._ReturnFullUrlLocation(url);\r\n var saveAndLoadImage = function () {\r\n if (!_this._hasReachedQuota && _this._db !== null) {\r\n // the texture is not yet in the DB, let's try to save it\r\n _this._saveImageIntoDBAsync(completeURL, image);\r\n }\r\n // If the texture is not in the DB and we've reached the DB quota limit\r\n // let's load it directly from the web\r\n else {\r\n image.src = url;\r\n }\r\n };\r\n if (!this._mustUpdateRessources) {\r\n this._loadImageFromDBAsync(completeURL, image, saveAndLoadImage);\r\n }\r\n // First time we're download the images or update requested in the manifest file by a version change\r\n else {\r\n saveAndLoadImage();\r\n }\r\n };\r\n Database.prototype._loadImageFromDBAsync = function (url, image, notInDBCallback) {\r\n if (this._isSupported && this._db !== null) {\r\n var texture;\r\n var transaction = this._db.transaction([\"textures\"]);\r\n transaction.onabort = function () {\r\n image.src = url;\r\n };\r\n transaction.oncomplete = function () {\r\n var blobTextureURL;\r\n if (texture) {\r\n var URL = window.URL || window.webkitURL;\r\n blobTextureURL = URL.createObjectURL(texture.data);\r\n image.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading image from blob URL: \" + blobTextureURL + \" switching back to web url: \" + url);\r\n image.src = url;\r\n };\r\n image.src = blobTextureURL;\r\n }\r\n else {\r\n notInDBCallback();\r\n }\r\n };\r\n var getRequest = transaction.objectStore(\"textures\").get(url);\r\n getRequest.onsuccess = function (event) {\r\n texture = (event.target).result;\r\n };\r\n getRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading texture \" + url + \" from DB.\");\r\n image.src = url;\r\n };\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n image.src = url;\r\n }\r\n };\r\n Database.prototype._saveImageIntoDBAsync = function (url, image) {\r\n var _this = this;\r\n if (this._isSupported) {\r\n // In case of error (type not supported or quota exceeded), we're at least sending back XHR data to allow texture loading later on\r\n var generateBlobUrl = function () {\r\n var blobTextureURL;\r\n if (blob) {\r\n var URL = window.URL || window.webkitURL;\r\n try {\r\n blobTextureURL = URL.createObjectURL(blob);\r\n }\r\n // Chrome is raising a type error if we're setting the oneTimeOnly parameter\r\n catch (ex) {\r\n blobTextureURL = URL.createObjectURL(blob);\r\n }\r\n }\r\n if (blobTextureURL) {\r\n image.src = blobTextureURL;\r\n }\r\n };\r\n if (Database.IsUASupportingBlobStorage) { // Create XHR\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__[\"WebRequest\"](), blob;\r\n xhr.open(\"GET\", url);\r\n xhr.responseType = \"blob\";\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 && _this._db) {\r\n // Blob as response (XHR2)\r\n blob = xhr.response;\r\n var transaction = _this._db.transaction([\"textures\"], \"readwrite\");\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = function (event) {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n var srcElement = (event.srcElement || event.target);\r\n var error = srcElement.error;\r\n if (error && error.name === \"QuotaExceededError\") {\r\n _this._hasReachedQuota = true;\r\n }\r\n }\r\n catch (ex) { }\r\n generateBlobUrl();\r\n };\r\n transaction.oncomplete = function () {\r\n generateBlobUrl();\r\n };\r\n var newTexture = { textureUrl: url, data: blob };\r\n try {\r\n // Put the blob into the dabase\r\n var addRequest = transaction.objectStore(\"textures\").put(newTexture);\r\n addRequest.onsuccess = function () {\r\n };\r\n addRequest.onerror = function () {\r\n generateBlobUrl();\r\n };\r\n }\r\n catch (ex) {\r\n // \"DataCloneError\" generated by Chrome when you try to inject blob into IndexedDB\r\n if (ex.code === 25) {\r\n Database.IsUASupportingBlobStorage = false;\r\n _this._enableTexturesOffline = false;\r\n }\r\n image.src = url;\r\n }\r\n }\r\n else {\r\n image.src = url;\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error in XHR request in BABYLON.Database.\");\r\n image.src = url;\r\n }, false);\r\n xhr.send();\r\n }\r\n else {\r\n image.src = url;\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n image.src = url;\r\n }\r\n };\r\n Database.prototype._checkVersionFromDB = function (url, versionLoaded) {\r\n var _this = this;\r\n var updateVersion = function () {\r\n // the version is not yet in the DB or we need to update it\r\n _this._saveVersionIntoDBAsync(url, versionLoaded);\r\n };\r\n this._loadVersionFromDBAsync(url, versionLoaded, updateVersion);\r\n };\r\n Database.prototype._loadVersionFromDBAsync = function (url, callback, updateInDBCallback) {\r\n var _this = this;\r\n if (this._isSupported && this._db) {\r\n var version;\r\n try {\r\n var transaction = this._db.transaction([\"versions\"]);\r\n transaction.oncomplete = function () {\r\n if (version) {\r\n // If the version in the JSON file is different from the version in DB\r\n if (_this._manifestVersionFound !== version.data) {\r\n _this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n }\r\n else {\r\n callback(version.data);\r\n }\r\n }\r\n // version was not found in DB\r\n else {\r\n _this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n }\r\n };\r\n transaction.onabort = function () {\r\n callback(-1);\r\n };\r\n var getRequest = transaction.objectStore(\"versions\").get(url);\r\n getRequest.onsuccess = function (event) {\r\n version = (event.target).result;\r\n };\r\n getRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading version for scene \" + url + \" from DB.\");\r\n callback(-1);\r\n };\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error while accessing 'versions' object store (READ OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n callback(-1);\r\n }\r\n };\r\n Database.prototype._saveVersionIntoDBAsync = function (url, callback) {\r\n var _this = this;\r\n if (this._isSupported && !this._hasReachedQuota && this._db) {\r\n try {\r\n // Open a transaction to the database\r\n var transaction = this._db.transaction([\"versions\"], \"readwrite\");\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = function (event) {\r\n try { //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n var error = event.srcElement['error'];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n _this._hasReachedQuota = true;\r\n }\r\n }\r\n catch (ex) { }\r\n callback(-1);\r\n };\r\n transaction.oncomplete = function () {\r\n callback(_this._manifestVersionFound);\r\n };\r\n var newVersion = { sceneUrl: url, data: this._manifestVersionFound };\r\n // Put the scene into the database\r\n var addRequest = transaction.objectStore(\"versions\").put(newVersion);\r\n addRequest.onsuccess = function () {\r\n };\r\n addRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error in DB add version request in BABYLON.Database.\");\r\n };\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error while accessing 'versions' object store (WRITE OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n }\r\n else {\r\n callback(-1);\r\n }\r\n };\r\n /**\r\n * Loads a file from database\r\n * @param url defines the URL to load from\r\n * @param sceneLoaded defines a callback to call on success\r\n * @param progressCallBack defines a callback to call when progress changed\r\n * @param errorCallback defines a callback to call on error\r\n * @param useArrayBuffer defines a boolean to use array buffer instead of text string\r\n */\r\n Database.prototype.loadFile = function (url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer) {\r\n var _this = this;\r\n var completeUrl = Database._ReturnFullUrlLocation(url);\r\n var saveAndLoadFile = function () {\r\n // the scene is not yet in the DB, let's try to save it\r\n _this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n };\r\n this._checkVersionFromDB(completeUrl, function (version) {\r\n if (version !== -1) {\r\n if (!_this._mustUpdateRessources) {\r\n _this._loadFileAsync(completeUrl, sceneLoaded, saveAndLoadFile);\r\n }\r\n else {\r\n _this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n }\r\n }\r\n else {\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n }\r\n });\r\n };\r\n Database.prototype._loadFileAsync = function (url, callback, notInDBCallback) {\r\n if (this._isSupported && this._db) {\r\n var targetStore;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n }\r\n else {\r\n targetStore = \"textures\";\r\n }\r\n var file;\r\n var transaction = this._db.transaction([targetStore]);\r\n transaction.oncomplete = function () {\r\n if (file) {\r\n callback(file.data);\r\n }\r\n // file was not found in DB\r\n else {\r\n notInDBCallback();\r\n }\r\n };\r\n transaction.onabort = function () {\r\n notInDBCallback();\r\n };\r\n var getRequest = transaction.objectStore(targetStore).get(url);\r\n getRequest.onsuccess = function (event) {\r\n file = (event.target).result;\r\n };\r\n getRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading file \" + url + \" from DB.\");\r\n notInDBCallback();\r\n };\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n callback();\r\n }\r\n };\r\n Database.prototype._saveFileAsync = function (url, callback, progressCallback, useArrayBuffer, errorCallback) {\r\n var _this = this;\r\n if (this._isSupported) {\r\n var targetStore;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n }\r\n else {\r\n targetStore = \"textures\";\r\n }\r\n // Create XHR\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__[\"WebRequest\"]();\r\n var fileData;\r\n xhr.open(\"GET\", url + \"?\" + Date.now());\r\n if (useArrayBuffer) {\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n if (progressCallback) {\r\n xhr.onprogress = progressCallback;\r\n }\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 || (xhr.status < 400 && Database._ValidateXHRData(xhr, !useArrayBuffer ? 1 : 6))) {\r\n // Blob as response (XHR2)\r\n fileData = !useArrayBuffer ? xhr.responseText : xhr.response;\r\n if (!_this._hasReachedQuota && _this._db) {\r\n // Open a transaction to the database\r\n var transaction = _this._db.transaction([targetStore], \"readwrite\");\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = function (event) {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n var error = event.srcElement['error'];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n _this._hasReachedQuota = true;\r\n }\r\n }\r\n catch (ex) { }\r\n callback(fileData);\r\n };\r\n transaction.oncomplete = function () {\r\n callback(fileData);\r\n };\r\n var newFile;\r\n if (targetStore === \"scenes\") {\r\n newFile = { sceneUrl: url, data: fileData, version: _this._manifestVersionFound };\r\n }\r\n else {\r\n newFile = { textureUrl: url, data: fileData };\r\n }\r\n try {\r\n // Put the scene into the database\r\n var addRequest = transaction.objectStore(targetStore).put(newFile);\r\n addRequest.onsuccess = function () {\r\n };\r\n addRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error in DB add file request in BABYLON.Database.\");\r\n };\r\n }\r\n catch (ex) {\r\n callback(fileData);\r\n }\r\n }\r\n else {\r\n callback(fileData);\r\n }\r\n }\r\n else {\r\n if (xhr.status >= 400 && errorCallback) {\r\n errorCallback(xhr);\r\n }\r\n else {\r\n callback();\r\n }\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"error on XHR request.\");\r\n callback();\r\n }, false);\r\n xhr.send();\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or Babylon.js Database is not open.\");\r\n callback();\r\n }\r\n };\r\n /**\r\n * Validates if xhr data is correct\r\n * @param xhr defines the request to validate\r\n * @param dataType defines the expected data type\r\n * @returns true if data is correct\r\n */\r\n Database._ValidateXHRData = function (xhr, dataType) {\r\n // 1 for text (.babylon, manifest and shaders), 2 for TGA, 4 for DDS, 7 for all\r\n if (dataType === void 0) { dataType = 7; }\r\n try {\r\n if (dataType & 1) {\r\n if (xhr.responseText && xhr.responseText.length > 0) {\r\n return true;\r\n }\r\n else if (dataType === 1) {\r\n return false;\r\n }\r\n }\r\n if (dataType & 2) {\r\n // Check header width and height since there is no \"TGA\" magic number\r\n var tgaHeader = _Misc_tga__WEBPACK_IMPORTED_MODULE_2__[\"TGATools\"].GetTGAHeader(xhr.response);\r\n if (tgaHeader.width && tgaHeader.height && tgaHeader.width > 0 && tgaHeader.height > 0) {\r\n return true;\r\n }\r\n else if (dataType === 2) {\r\n return false;\r\n }\r\n }\r\n if (dataType & 4) {\r\n // Check for the \"DDS\" magic number\r\n var ddsHeader = new Uint8Array(xhr.response, 0, 3);\r\n if (ddsHeader[0] === 68 && ddsHeader[1] === 68 && ddsHeader[2] === 83) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Global protection\r\n }\r\n return false;\r\n };\r\n /** Gets a boolean indicating if the user agent supports blob storage (this value will be updated after creating the first Database object) */\r\n Database.IsUASupportingBlobStorage = true;\r\n /**\r\n * Gets a boolean indicating if Database storate is enabled (off by default)\r\n */\r\n Database.IDBStorageEnabled = false;\r\n Database._ParseURL = function (url) {\r\n var a = document.createElement('a');\r\n a.href = url;\r\n var urlWithoutHash = url.substring(0, url.lastIndexOf(\"#\"));\r\n var fileName = url.substring(urlWithoutHash.lastIndexOf(\"/\") + 1, url.length);\r\n var absLocation = url.substring(0, url.indexOf(fileName, 0));\r\n return absLocation;\r\n };\r\n Database._ReturnFullUrlLocation = function (url) {\r\n if (url.indexOf(\"http:/\") === -1 && url.indexOf(\"https:/\") === -1) {\r\n return (Database._ParseURL(window.location.href) + url);\r\n }\r\n else {\r\n return url;\r\n }\r\n };\r\n return Database;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Offline/index.ts\":\n/*!**************************!*\\\n !*** ./Offline/index.ts ***!\n \\**************************/\n/*! exports provided: Database */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _database__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./database */ \"./Offline/database.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return _database__WEBPACK_IMPORTED_MODULE_0__[\"Database\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/boxParticleEmitter.ts\":\n/*!******************************************************!*\\\n !*** ./Particles/EmitterTypes/boxParticleEmitter.ts ***!\n \\******************************************************/\n/*! exports provided: BoxParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return BoxParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a box.\r\n * It emits the particles randomly between 2 given directions.\r\n */\r\nvar BoxParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance BoxParticleEmitter\r\n */\r\n function BoxParticleEmitter() {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n /**\r\n * Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n */\r\n this.minEmitBox = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](-0.5, -0.5, -0.5);\r\n /**\r\n * Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n */\r\n this.maxEmitBox = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.5, 0.5, 0.5);\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n BoxParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n BoxParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.minEmitBox.x, this.maxEmitBox.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.minEmitBox.y, this.maxEmitBox.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.minEmitBox.z, this.maxEmitBox.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n BoxParticleEmitter.prototype.clone = function () {\r\n var newOne = new BoxParticleEmitter();\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n BoxParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n effect.setVector3(\"minEmitBox\", this.minEmitBox);\r\n effect.setVector3(\"maxEmitBox\", this.maxEmitBox);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n BoxParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define BOXEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"BoxParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n BoxParticleEmitter.prototype.getClassName = function () {\r\n return \"BoxParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n BoxParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n serializationObject.minEmitBox = this.minEmitBox.asArray();\r\n serializationObject.maxEmitBox = this.maxEmitBox.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n BoxParticleEmitter.prototype.parse = function (serializationObject) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction1, 0, this.direction1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction2, 0, this.direction2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.minEmitBox, 0, this.minEmitBox);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.maxEmitBox, 0, this.maxEmitBox);\r\n };\r\n return BoxParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/coneParticleEmitter.ts\":\n/*!*******************************************************!*\\\n !*** ./Particles/EmitterTypes/coneParticleEmitter.ts ***!\n \\*******************************************************/\n/*! exports provided: ConeParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return ConeParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cone.\r\n * It emits the particles alongside the cone volume from the base to the particle.\r\n * The emission direction might be randomized.\r\n */\r\nvar ConeParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance ConeParticleEmitter\r\n * @param radius the radius of the emission cone (1 by default)\r\n * @param angle the cone base angle (PI by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1] (default is 0)\r\n */\r\n function ConeParticleEmitter(radius, angle, \r\n /** defines how much to randomize the particle direction [0-1] (default is 0) */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (angle === void 0) { angle = Math.PI; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.directionRandomizer = directionRandomizer;\r\n /**\r\n * Gets or sets a value indicating where on the radius the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n this.radiusRange = 1;\r\n /**\r\n * Gets or sets a value indicating where on the height the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n this.heightRange = 1;\r\n /**\r\n * Gets or sets a value indicating if all the particles should be emitted from the spawn point only (the base of the cone)\r\n */\r\n this.emitFromSpawnPointOnly = false;\r\n this.angle = angle;\r\n this.radius = radius;\r\n }\r\n Object.defineProperty(ConeParticleEmitter.prototype, \"radius\", {\r\n /**\r\n * Gets or sets the radius of the emission cone\r\n */\r\n get: function () {\r\n return this._radius;\r\n },\r\n set: function (value) {\r\n this._radius = value;\r\n this._buildHeight();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ConeParticleEmitter.prototype, \"angle\", {\r\n /**\r\n * Gets or sets the angle of the emission cone\r\n */\r\n get: function () {\r\n return this._angle;\r\n },\r\n set: function (value) {\r\n this._angle = value;\r\n this._buildHeight();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ConeParticleEmitter.prototype._buildHeight = function () {\r\n if (this._angle !== 0) {\r\n this._height = this._radius / Math.tan(this._angle / 2);\r\n }\r\n else {\r\n this._height = 1;\r\n }\r\n };\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n ConeParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n if (Math.abs(Math.cos(this._angle)) === 1.0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(0, 1.0, 0, worldMatrix, directionToUpdate);\r\n }\r\n else {\r\n // measure the direction Vector from the emitter to the particle.\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n }\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n ConeParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var s = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, Math.PI * 2);\r\n var h;\r\n if (!this.emitFromSpawnPointOnly) {\r\n h = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.heightRange);\r\n // Better distribution in a cone at normal angles.\r\n h = 1 - h * h;\r\n }\r\n else {\r\n h = 0.0001;\r\n }\r\n var radius = this._radius - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this._radius * this.radiusRange);\r\n radius = radius * h;\r\n var randX = radius * Math.sin(s);\r\n var randZ = radius * Math.cos(s);\r\n var randY = h * this._height;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n ConeParticleEmitter.prototype.clone = function () {\r\n var newOne = new ConeParticleEmitter(this._radius, this._angle, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n ConeParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat2(\"radius\", this._radius, this.radiusRange);\r\n effect.setFloat(\"coneAngle\", this._angle);\r\n effect.setFloat2(\"height\", this._height, this.heightRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n ConeParticleEmitter.prototype.getEffectDefines = function () {\r\n var defines = \"#define CONEEMITTER\";\r\n if (this.emitFromSpawnPointOnly) {\r\n defines += \"\\n#define CONEEMITTERSPAWNPOINT\";\r\n }\r\n return defines;\r\n };\r\n /**\r\n * Returns the string \"ConeParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n ConeParticleEmitter.prototype.getClassName = function () {\r\n return \"ConeParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n ConeParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this._radius;\r\n serializationObject.angle = this._angle;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n ConeParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.angle = serializationObject.angle;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return ConeParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/cylinderParticleEmitter.ts\":\n/*!***********************************************************!*\\\n !*** ./Particles/EmitterTypes/cylinderParticleEmitter.ts ***!\n \\***********************************************************/\n/*! exports provided: CylinderParticleEmitter, CylinderDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return CylinderParticleEmitter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return CylinderDirectedParticleEmitter; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles alongside the cylinder radius. The emission direction might be randomized.\r\n */\r\nvar CylinderParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance CylinderParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n function CylinderParticleEmitter(\r\n /**\r\n * The radius of the emission cylinder.\r\n */\r\n radius, \r\n /**\r\n * The height of the emission cylinder.\r\n */\r\n height, \r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n radiusRange, \r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.radius = radius;\r\n this.height = height;\r\n this.radiusRange = radiusRange;\r\n this.directionRandomizer = directionRandomizer;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n CylinderParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(-this.directionRandomizer / 2, this.directionRandomizer / 2);\r\n var angle = Math.atan2(direction.x, direction.z);\r\n angle += _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(-Math.PI / 2, Math.PI / 2) * this.directionRandomizer;\r\n direction.y = randY; // set direction y to rand y to mirror normal of cylinder surface\r\n direction.x = Math.sin(angle);\r\n direction.z = Math.cos(angle);\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n CylinderParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var yPos = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(-this.height / 2, this.height / 2);\r\n var angle = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 2 * Math.PI);\r\n // Pick a properly distributed point within the circle https://programming.guide/random-point-within-circle.html\r\n var radiusDistribution = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange((1 - this.radiusRange) * (1 - this.radiusRange), 1);\r\n var positionRadius = Math.sqrt(radiusDistribution) * this.radius;\r\n var xPos = positionRadius * Math.cos(angle);\r\n var zPos = positionRadius * Math.sin(angle);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n CylinderParticleEmitter.prototype.clone = function () {\r\n var newOne = new CylinderParticleEmitter(this.radius, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n CylinderParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"height\", this.height);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n CylinderParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define CYLINDEREMITTER\";\r\n };\r\n /**\r\n * Returns the string \"CylinderParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n CylinderParticleEmitter.prototype.getClassName = function () {\r\n return \"CylinderParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n CylinderParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.height = this.height;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n CylinderParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.height = serializationObject.height;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return CylinderParticleEmitter;\r\n}());\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nvar CylinderDirectedParticleEmitter = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CylinderDirectedParticleEmitter, _super);\r\n /**\r\n * Creates a new instance CylinderDirectedParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n function CylinderDirectedParticleEmitter(radius, height, radiusRange, \r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n direction1, \r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n var _this = _super.call(this, radius, height, radiusRange) || this;\r\n _this.direction1 = direction1;\r\n _this.direction2 = direction2;\r\n return _this;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n CylinderDirectedParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n CylinderDirectedParticleEmitter.prototype.clone = function () {\r\n var newOne = new CylinderDirectedParticleEmitter(this.radius, this.height, this.radiusRange, this.direction1, this.direction2);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n CylinderDirectedParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"height\", this.height);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n CylinderDirectedParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define CYLINDEREMITTER\\n#define DIRECTEDCYLINDEREMITTER\";\r\n };\r\n /**\r\n * Returns the string \"CylinderDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n CylinderDirectedParticleEmitter.prototype.getClassName = function () {\r\n return \"CylinderDirectedParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n CylinderDirectedParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n CylinderDirectedParticleEmitter.prototype.parse = function (serializationObject) {\r\n _super.prototype.parse.call(this, serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n };\r\n return CylinderDirectedParticleEmitter;\r\n}(CylinderParticleEmitter));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/hemisphericParticleEmitter.ts\":\n/*!**************************************************************!*\\\n !*** ./Particles/EmitterTypes/hemisphericParticleEmitter.ts ***!\n \\**************************************************************/\n/*! exports provided: HemisphericParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return HemisphericParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a hemisphere.\r\n * It emits the particles alongside the hemisphere radius. The emission direction might be randomized.\r\n */\r\nvar HemisphericParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance HemisphericParticleEmitter\r\n * @param radius the radius of the emission hemisphere (1 by default)\r\n * @param radiusRange the range of the emission hemisphere [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n function HemisphericParticleEmitter(\r\n /**\r\n * The radius of the emission hemisphere.\r\n */\r\n radius, \r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n radiusRange, \r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.radius = radius;\r\n this.radiusRange = radiusRange;\r\n this.directionRandomizer = directionRandomizer;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n HemisphericParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n HemisphericParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var randRadius = this.radius - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.radius * this.radiusRange);\r\n var v = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 1.0);\r\n var phi = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 2 * Math.PI);\r\n var theta = Math.acos(2 * v - 1);\r\n var randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n var randY = randRadius * Math.cos(theta);\r\n var randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, Math.abs(randY), randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n HemisphericParticleEmitter.prototype.clone = function () {\r\n var newOne = new HemisphericParticleEmitter(this.radius, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n HemisphericParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n HemisphericParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define HEMISPHERICEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"HemisphericParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n HemisphericParticleEmitter.prototype.getClassName = function () {\r\n return \"HemisphericParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n HemisphericParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n HemisphericParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return HemisphericParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/index.ts\":\n/*!*****************************************!*\\\n !*** ./Particles/EmitterTypes/index.ts ***!\n \\*****************************************/\n/*! exports provided: BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boxParticleEmitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boxParticleEmitter */ \"./Particles/EmitterTypes/boxParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _boxParticleEmitter__WEBPACK_IMPORTED_MODULE_0__[\"BoxParticleEmitter\"]; });\n\n/* harmony import */ var _coneParticleEmitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coneParticleEmitter */ \"./Particles/EmitterTypes/coneParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _coneParticleEmitter__WEBPACK_IMPORTED_MODULE_1__[\"ConeParticleEmitter\"]; });\n\n/* harmony import */ var _cylinderParticleEmitter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cylinderParticleEmitter */ \"./Particles/EmitterTypes/cylinderParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _cylinderParticleEmitter__WEBPACK_IMPORTED_MODULE_2__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _cylinderParticleEmitter__WEBPACK_IMPORTED_MODULE_2__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony import */ var _hemisphericParticleEmitter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hemisphericParticleEmitter */ \"./Particles/EmitterTypes/hemisphericParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _hemisphericParticleEmitter__WEBPACK_IMPORTED_MODULE_3__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony import */ var _pointParticleEmitter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pointParticleEmitter */ \"./Particles/EmitterTypes/pointParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _pointParticleEmitter__WEBPACK_IMPORTED_MODULE_4__[\"PointParticleEmitter\"]; });\n\n/* harmony import */ var _sphereParticleEmitter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sphereParticleEmitter */ \"./Particles/EmitterTypes/sphereParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _sphereParticleEmitter__WEBPACK_IMPORTED_MODULE_5__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _sphereParticleEmitter__WEBPACK_IMPORTED_MODULE_5__[\"SphereDirectedParticleEmitter\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/pointParticleEmitter.ts\":\n/*!********************************************************!*\\\n !*** ./Particles/EmitterTypes/pointParticleEmitter.ts ***!\n \\********************************************************/\n/*! exports provided: PointParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return PointParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from a point.\r\n * It emits the particles randomly between 2 given directions.\r\n */\r\nvar PointParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PointParticleEmitter\r\n */\r\n function PointParticleEmitter() {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n PointParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n PointParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(0, 0, 0, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n PointParticleEmitter.prototype.clone = function () {\r\n var newOne = new PointParticleEmitter();\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n PointParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n PointParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define POINTEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"PointParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n PointParticleEmitter.prototype.getClassName = function () {\r\n return \"PointParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n PointParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n PointParticleEmitter.prototype.parse = function (serializationObject) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction1, 0, this.direction1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction2, 0, this.direction2);\r\n };\r\n return PointParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/sphereParticleEmitter.ts\":\n/*!*********************************************************!*\\\n !*** ./Particles/EmitterTypes/sphereParticleEmitter.ts ***!\n \\*********************************************************/\n/*! exports provided: SphereParticleEmitter, SphereDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return SphereParticleEmitter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return SphereDirectedParticleEmitter; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles alongside the sphere radius. The emission direction might be randomized.\r\n */\r\nvar SphereParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance SphereParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param radiusRange the range of the emission sphere [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n function SphereParticleEmitter(\r\n /**\r\n * The radius of the emission sphere.\r\n */\r\n radius, \r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n radiusRange, \r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.radius = radius;\r\n this.radiusRange = radiusRange;\r\n this.directionRandomizer = directionRandomizer;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n SphereParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n SphereParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var randRadius = this.radius - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.radius * this.radiusRange);\r\n var v = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 1.0);\r\n var phi = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 2 * Math.PI);\r\n var theta = Math.acos(2 * v - 1);\r\n var randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n var randY = randRadius * Math.cos(theta);\r\n var randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n SphereParticleEmitter.prototype.clone = function () {\r\n var newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n SphereParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n SphereParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define SPHEREEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"SphereParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n SphereParticleEmitter.prototype.getClassName = function () {\r\n return \"SphereParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n SphereParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n SphereParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return SphereParticleEmitter;\r\n}());\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nvar SphereDirectedParticleEmitter = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SphereDirectedParticleEmitter, _super);\r\n /**\r\n * Creates a new instance SphereDirectedParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n function SphereDirectedParticleEmitter(radius, \r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n direction1, \r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n var _this = _super.call(this, radius) || this;\r\n _this.direction1 = direction1;\r\n _this.direction2 = direction2;\r\n return _this;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n SphereDirectedParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n SphereDirectedParticleEmitter.prototype.clone = function () {\r\n var newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n SphereDirectedParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n SphereDirectedParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define SPHEREEMITTER\\n#define DIRECTEDSPHEREEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"SphereDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n SphereDirectedParticleEmitter.prototype.getClassName = function () {\r\n return \"SphereDirectedParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n SphereDirectedParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n SphereDirectedParticleEmitter.prototype.parse = function (serializationObject) {\r\n _super.prototype.parse.call(this, serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n };\r\n return SphereDirectedParticleEmitter;\r\n}(SphereParticleEmitter));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/baseParticleSystem.ts\":\n/*!*****************************************!*\\\n !*** ./Particles/baseParticleSystem.ts ***!\n \\*****************************************/\n/*! exports provided: BaseParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return BaseParticleSystem; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Particles/EmitterTypes/index */ \"./Particles/EmitterTypes/index.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents the base class for particle system in Babylon.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.\r\n * @example https://doc.babylonjs.com/babylon101/particles\r\n */\r\nvar BaseParticleSystem = /** @class */ (function () {\r\n /**\r\n * Instantiates a particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n */\r\n function BaseParticleSystem(name) {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n this.animations = [];\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n this.renderingGroupId = 0;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n this.emitter = null;\r\n /**\r\n * The maximum number of particles to emit per frame\r\n */\r\n this.emitRate = 10;\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n this.manualEmitCount = -1;\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n this.updateSpeed = 0.01;\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n this.targetStopDuration = 0;\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n this.disposeOnStop = false;\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n this.minEmitPower = 1;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n this.maxEmitPower = 1;\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n this.minLifeTime = 1;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n this.maxLifeTime = 1;\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n this.minSize = 1;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n this.maxSize = 1;\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n this.minScaleX = 1;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n this.maxScaleX = 1;\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n this.minScaleY = 1;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n this.maxScaleY = 1;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n this.minInitialRotation = 0;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n this.maxInitialRotation = 0;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n this.minAngularSpeed = 0;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n this.maxAngularSpeed = 0;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * This can help using your own shader to render the particle system.\r\n * The according effect will be created\r\n */\r\n this.customShader = null;\r\n /**\r\n * By default particle system starts as soon as they are created. This prevents the\r\n * automatic start to happen and let you decide when to start emitting particles.\r\n */\r\n this.preventAutoStart = false;\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n this.noiseStrength = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](10, 10, 10);\r\n /**\r\n * Callback triggered when the particle animation is ending.\r\n */\r\n this.onAnimationEnd = null;\r\n /**\r\n * Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE or ParticleSystem.BLENDMODE_STANDARD.\r\n */\r\n this.blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n /**\r\n * Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls\r\n * to override the particles.\r\n */\r\n this.forceDepthWrite = false;\r\n /** Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0 */\r\n this.preWarmCycles = 0;\r\n /** Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1) */\r\n this.preWarmStepOffset = 1;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n this.spriteCellChangeSpeed = 1;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n this.startSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n this.endSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n this.spriteCellWidth = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n this.spriteCellHeight = 0;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n this.spriteRandomStartCell = false;\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n this.translationPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n this.beginAnimationOnStart = false;\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n this.beginAnimationFrom = 0;\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n this.beginAnimationTo = 60;\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n this.beginAnimationLoop = false;\r\n /**\r\n * Gets or sets a world offset applied to all particles\r\n */\r\n this.worldOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n this.gravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._colorGradients = null;\r\n this._sizeGradients = null;\r\n this._lifeTimeGradients = null;\r\n this._angularSpeedGradients = null;\r\n this._velocityGradients = null;\r\n this._limitVelocityGradients = null;\r\n this._dragGradients = null;\r\n this._emitRateGradients = null;\r\n this._startSizeGradients = null;\r\n this._rampGradients = null;\r\n this._colorRemapGradients = null;\r\n this._alphaRemapGradients = null;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n this.startDelay = 0;\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n this.limitVelocityDamping = 0.4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n this.color1 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n this.color2 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Color the particle will have at the end of its lifetime\r\n */\r\n this.colorDead = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](0, 0, 0, 1.0);\r\n /**\r\n * An optional mask to filter some colors out of the texture, or filter a part of the alpha channel\r\n */\r\n this.textureMask = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /** @hidden */\r\n this._isSubEmitter = false;\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n this.billboardMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].PARTICLES_BILLBOARDMODE_ALL;\r\n this._isBillboardBased = true;\r\n /**\r\n * Local cache of defines for image processing.\r\n */\r\n this._imageProcessingConfigurationDefines = new _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_1__[\"ImageProcessingConfigurationDefines\"]();\r\n this.id = name;\r\n this.name = name;\r\n }\r\n Object.defineProperty(BaseParticleSystem.prototype, \"noiseTexture\", {\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n get: function () {\r\n return this._noiseTexture;\r\n },\r\n set: function (value) {\r\n if (this._noiseTexture === value) {\r\n return;\r\n }\r\n this._noiseTexture = value;\r\n this._reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"isAnimationSheetEnabled\", {\r\n /**\r\n * Gets or sets whether an animation sprite sheet is enabled or not on the particle system\r\n */\r\n get: function () {\r\n return this._isAnimationSheetEnabled;\r\n },\r\n set: function (value) {\r\n if (this._isAnimationSheetEnabled == value) {\r\n return;\r\n }\r\n this._isAnimationSheetEnabled = value;\r\n this._reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n BaseParticleSystem.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n BaseParticleSystem.prototype._hasTargetStopDurationDependantGradient = function () {\r\n return (this._startSizeGradients && this._startSizeGradients.length > 0)\r\n || (this._emitRateGradients && this._emitRateGradients.length > 0)\r\n || (this._lifeTimeGradients && this._lifeTimeGradients.length > 0);\r\n };\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to udpate this list\r\n * @returns the list of drag gradients\r\n */\r\n BaseParticleSystem.prototype.getDragGradients = function () {\r\n return this._dragGradients;\r\n };\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to udpate this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n BaseParticleSystem.prototype.getLimitVelocityGradients = function () {\r\n return this._limitVelocityGradients;\r\n };\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to udpate this list\r\n * @returns the list of color gradients\r\n */\r\n BaseParticleSystem.prototype.getColorGradients = function () {\r\n return this._colorGradients;\r\n };\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to udpate this list\r\n * @returns the list of size gradients\r\n */\r\n BaseParticleSystem.prototype.getSizeGradients = function () {\r\n return this._sizeGradients;\r\n };\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to udpate this list\r\n * @returns the list of color remap gradients\r\n */\r\n BaseParticleSystem.prototype.getColorRemapGradients = function () {\r\n return this._colorRemapGradients;\r\n };\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to udpate this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n BaseParticleSystem.prototype.getAlphaRemapGradients = function () {\r\n return this._alphaRemapGradients;\r\n };\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to udpate this list\r\n * @returns the list of life time gradients\r\n */\r\n BaseParticleSystem.prototype.getLifeTimeGradients = function () {\r\n return this._lifeTimeGradients;\r\n };\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to udpate this list\r\n * @returns the list of angular speed gradients\r\n */\r\n BaseParticleSystem.prototype.getAngularSpeedGradients = function () {\r\n return this._angularSpeedGradients;\r\n };\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to udpate this list\r\n * @returns the list of velocity gradients\r\n */\r\n BaseParticleSystem.prototype.getVelocityGradients = function () {\r\n return this._velocityGradients;\r\n };\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to udpate this list\r\n * @returns the list of start size gradients\r\n */\r\n BaseParticleSystem.prototype.getStartSizeGradients = function () {\r\n return this._startSizeGradients;\r\n };\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to udpate this list\r\n * @returns the list of emit rate gradients\r\n */\r\n BaseParticleSystem.prototype.getEmitRateGradients = function () {\r\n return this._emitRateGradients;\r\n };\r\n Object.defineProperty(BaseParticleSystem.prototype, \"direction1\", {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.direction1) {\r\n return this.particleEmitterType.direction1;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.direction1) {\r\n this.particleEmitterType.direction1 = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"direction2\", {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.direction2) {\r\n return this.particleEmitterType.direction2;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.direction2) {\r\n this.particleEmitterType.direction2 = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"minEmitBox\", {\r\n /**\r\n * Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.minEmitBox) {\r\n return this.particleEmitterType.minEmitBox;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.minEmitBox) {\r\n this.particleEmitterType.minEmitBox = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"maxEmitBox\", {\r\n /**\r\n * Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.maxEmitBox) {\r\n return this.particleEmitterType.maxEmitBox;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.maxEmitBox) {\r\n this.particleEmitterType.maxEmitBox = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"isBillboardBased\", {\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n get: function () {\r\n return this._isBillboardBased;\r\n },\r\n set: function (value) {\r\n if (this._isBillboardBased === value) {\r\n return;\r\n }\r\n this._isBillboardBased = value;\r\n this._reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n BaseParticleSystem.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this._scene.imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n };\r\n /** @hidden */\r\n BaseParticleSystem.prototype._reset = function () {\r\n };\r\n /** @hidden */\r\n BaseParticleSystem.prototype._removeGradientAndTexture = function (gradient, gradients, texture) {\r\n if (!gradients) {\r\n return this;\r\n }\r\n var index = 0;\r\n for (var _i = 0, gradients_1 = gradients; _i < gradients_1.length; _i++) {\r\n var valueGradient = gradients_1[_i];\r\n if (valueGradient.gradient === gradient) {\r\n gradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n if (texture) {\r\n texture.dispose();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createPointEmitter = function (direction1, direction2) {\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"PointParticleEmitter\"]();\r\n particleEmitter.direction1 = direction1;\r\n particleEmitter.direction2 = direction2;\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createHemisphericEmitter = function (radius, radiusRange) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"HemisphericParticleEmitter\"](radius, radiusRange);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createSphereEmitter = function (radius, radiusRange) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"SphereParticleEmitter\"](radius, radiusRange);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createDirectedSphereEmitter = function (radius, direction1, direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"SphereDirectedParticleEmitter\"](radius, direction1, direction2);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createCylinderEmitter = function (radius, height, radiusRange, directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"CylinderParticleEmitter\"](radius, height, radiusRange, directionRandomizer);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createDirectedCylinderEmitter = function (radius, height, radiusRange, direction1, direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"CylinderDirectedParticleEmitter\"](radius, height, radiusRange, direction1, direction2);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createConeEmitter = function (radius, angle) {\r\n if (radius === void 0) { radius = 1; }\r\n if (angle === void 0) { angle = Math.PI / 4; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"ConeParticleEmitter\"](radius, angle);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createBoxEmitter = function (direction1, direction2, minEmitBox, maxEmitBox) {\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"BoxParticleEmitter\"]();\r\n this.particleEmitterType = particleEmitter;\r\n this.direction1 = direction1;\r\n this.direction2 = direction2;\r\n this.minEmitBox = minEmitBox;\r\n this.maxEmitBox = maxEmitBox;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Source color is added to the destination color without alpha affecting the result\r\n */\r\n BaseParticleSystem.BLENDMODE_ONEONE = 0;\r\n /**\r\n * Blend current color and particle color using particle’s alpha\r\n */\r\n BaseParticleSystem.BLENDMODE_STANDARD = 1;\r\n /**\r\n * Add current color and particle color multiplied by particle’s alpha\r\n */\r\n BaseParticleSystem.BLENDMODE_ADD = 2;\r\n /**\r\n * Multiply current color with particle color\r\n */\r\n BaseParticleSystem.BLENDMODE_MULTIPLY = 3;\r\n /**\r\n * Multiply current color with particle color then add current color and particle color multiplied by particle’s alpha\r\n */\r\n BaseParticleSystem.BLENDMODE_MULTIPLYADD = 4;\r\n return BaseParticleSystem;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/gpuParticleSystem.ts\":\n/*!****************************************!*\\\n !*** ./Particles/gpuParticleSystem.ts ***!\n \\****************************************/\n/*! exports provided: GPUParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return GPUParticleSystem; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/gradients */ \"./Misc/gradients.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _baseParticleSystem__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./baseParticleSystem */ \"./Particles/baseParticleSystem.ts\");\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _Particles_EmitterTypes_boxParticleEmitter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Particles/EmitterTypes/boxParticleEmitter */ \"./Particles/EmitterTypes/boxParticleEmitter.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Materials/Textures/rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Shaders_gpuUpdateParticles_fragment__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Shaders/gpuUpdateParticles.fragment */ \"./Shaders/gpuUpdateParticles.fragment.ts\");\n/* harmony import */ var _Shaders_gpuUpdateParticles_vertex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Shaders/gpuUpdateParticles.vertex */ \"./Shaders/gpuUpdateParticles.vertex.ts\");\n/* harmony import */ var _Shaders_gpuRenderParticles_fragment__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../Shaders/gpuRenderParticles.fragment */ \"./Shaders/gpuRenderParticles.fragment.ts\");\n/* harmony import */ var _Shaders_gpuRenderParticles_vertex__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../Shaders/gpuRenderParticles.vertex */ \"./Shaders/gpuRenderParticles.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a GPU particle system in Babylon\r\n * This is the fastest particle system in Babylon as it uses the GPU to update the individual particle data\r\n * @see https://www.babylonjs-playground.com/#PU4WYI#4\r\n */\r\nvar GPUParticleSystem = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GPUParticleSystem, _super);\r\n /**\r\n * Instantiates a GPU particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n * @param options The options used to create the system\r\n * @param scene The scene the particle system belongs to\r\n * @param isAnimationSheetEnabled Must be true if using a spritesheet to animate the particles texture\r\n */\r\n function GPUParticleSystem(name, options, scene, isAnimationSheetEnabled) {\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n var _this = _super.call(this, name) || this;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n _this.layerMask = 0x0FFFFFFF;\r\n _this._accumulatedCount = 0;\r\n _this._targetIndex = 0;\r\n _this._currentRenderId = -1;\r\n _this._started = false;\r\n _this._stopped = false;\r\n _this._timeDelta = 0;\r\n _this._actualFrame = 0;\r\n _this._rawTextureWidth = 256;\r\n /**\r\n * An event triggered when the system is disposed.\r\n */\r\n _this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls\r\n * to override the particles.\r\n */\r\n _this.forceDepthWrite = false;\r\n _this._preWarmDone = false;\r\n _this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__[\"EngineStore\"].LastCreatedScene;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this._engine = _this._scene.getEngine();\r\n if (!options.randomTextureSize) {\r\n delete options.randomTextureSize;\r\n }\r\n var fullOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ capacity: 50000, randomTextureSize: _this._engine.getCaps().maxTextureSize }, options);\r\n var optionsAsNumber = options;\r\n if (isFinite(optionsAsNumber)) {\r\n fullOptions.capacity = optionsAsNumber;\r\n }\r\n _this._capacity = fullOptions.capacity;\r\n _this._activeCount = fullOptions.capacity;\r\n _this._currentActiveCount = 0;\r\n _this._isAnimationSheetEnabled = isAnimationSheetEnabled;\r\n _this._scene.particleSystems.push(_this);\r\n _this._updateEffectOptions = {\r\n attributes: [\"position\", \"age\", \"life\", \"seed\", \"size\", \"color\", \"direction\", \"initialDirection\", \"angle\", \"cellIndex\", \"cellStartOffset\", \"noiseCoordinates1\", \"noiseCoordinates2\"],\r\n uniformsNames: [\"currentCount\", \"timeDelta\", \"emitterWM\", \"lifeTime\", \"color1\", \"color2\", \"sizeRange\", \"scaleRange\", \"gravity\", \"emitPower\",\r\n \"direction1\", \"direction2\", \"minEmitBox\", \"maxEmitBox\", \"radius\", \"directionRandomizer\", \"height\", \"coneAngle\", \"stopFactor\",\r\n \"angleRange\", \"radiusRange\", \"cellInfos\", \"noiseStrength\", \"limitVelocityDamping\"],\r\n uniformBuffersNames: [],\r\n samplers: [\"randomSampler\", \"randomSampler2\", \"sizeGradientSampler\", \"angularSpeedGradientSampler\", \"velocityGradientSampler\", \"limitVelocityGradientSampler\", \"noiseSampler\", \"dragGradientSampler\"],\r\n defines: \"\",\r\n fallbacks: null,\r\n onCompiled: null,\r\n onError: null,\r\n indexParameters: null,\r\n maxSimultaneousLights: 0,\r\n transformFeedbackVaryings: []\r\n };\r\n _this.particleEmitterType = new _Particles_EmitterTypes_boxParticleEmitter__WEBPACK_IMPORTED_MODULE_9__[\"BoxParticleEmitter\"]();\r\n // Random data\r\n var maxTextureSize = Math.min(_this._engine.getCaps().maxTextureSize, fullOptions.randomTextureSize);\r\n var d = [];\r\n for (var i = 0; i < maxTextureSize; ++i) {\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n }\r\n _this._randomTexture = new _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"](new Float32Array(d), maxTextureSize, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTUREFORMAT_RGBA, _this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n _this._randomTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this._randomTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n d = [];\r\n for (var i = 0; i < maxTextureSize; ++i) {\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n }\r\n _this._randomTexture2 = new _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"](new Float32Array(d), maxTextureSize, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTUREFORMAT_RGBA, _this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n _this._randomTexture2.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this._randomTexture2.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this._randomTextureSize = maxTextureSize;\r\n return _this;\r\n }\r\n Object.defineProperty(GPUParticleSystem, \"IsSupported\", {\r\n /**\r\n * Gets a boolean indicating if the GPU particles can be rendered on current browser\r\n */\r\n get: function () {\r\n if (!_Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__[\"EngineStore\"].LastCreatedEngine) {\r\n return false;\r\n }\r\n return _Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__[\"EngineStore\"].LastCreatedEngine.webGLVersion > 1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n GPUParticleSystem.prototype.getCapacity = function () {\r\n return this._capacity;\r\n };\r\n Object.defineProperty(GPUParticleSystem.prototype, \"activeParticleCount\", {\r\n /**\r\n * Gets or set the number of active particles\r\n */\r\n get: function () {\r\n return this._activeCount;\r\n },\r\n set: function (value) {\r\n this._activeCount = Math.min(value, this._capacity);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @return true if the system is ready\r\n */\r\n GPUParticleSystem.prototype.isReady = function () {\r\n if (!this._updateEffect) {\r\n this._recreateUpdateEffect();\r\n this._recreateRenderEffect();\r\n return false;\r\n }\r\n if (!this.emitter || !this._updateEffect.isReady() || !this._imageProcessingConfiguration.isReady() || !this._renderEffect.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n GPUParticleSystem.prototype.isStarted = function () {\r\n return this._started;\r\n };\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (this.startDelay by default)\r\n */\r\n GPUParticleSystem.prototype.start = function (delay) {\r\n var _this = this;\r\n if (delay === void 0) { delay = this.startDelay; }\r\n if (!this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) {\r\n throw \"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set\";\r\n }\r\n if (delay) {\r\n setTimeout(function () {\r\n _this.start(0);\r\n }, delay);\r\n return;\r\n }\r\n this._started = true;\r\n this._stopped = false;\r\n this._preWarmDone = false;\r\n // Animations\r\n if (this.beginAnimationOnStart && this.animations && this.animations.length > 0) {\r\n this.getScene().beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop);\r\n }\r\n };\r\n /**\r\n * Stops the particle system.\r\n */\r\n GPUParticleSystem.prototype.stop = function () {\r\n this._stopped = true;\r\n };\r\n /**\r\n * Remove all active particles\r\n */\r\n GPUParticleSystem.prototype.reset = function () {\r\n this._releaseBuffers();\r\n this._releaseVAOs();\r\n this._currentActiveCount = 0;\r\n this._targetIndex = 0;\r\n };\r\n /**\r\n * Returns the string \"GPUParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n GPUParticleSystem.prototype.getClassName = function () {\r\n return \"GPUParticleSystem\";\r\n };\r\n GPUParticleSystem.prototype._removeGradientAndTexture = function (gradient, gradients, texture) {\r\n _super.prototype._removeGradientAndTexture.call(this, gradient, gradients, texture);\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addColorGradient = function (gradient, color1, color2) {\r\n if (!this._colorGradients) {\r\n this._colorGradients = [];\r\n }\r\n var colorGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"ColorGradient\"]();\r\n colorGradient.gradient = gradient;\r\n colorGradient.color1 = color1;\r\n this._colorGradients.push(colorGradient);\r\n this._colorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n if (this._colorGradientsTexture) {\r\n this._colorGradientsTexture.dispose();\r\n this._colorGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeColorGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._colorGradients, this._colorGradientsTexture);\r\n this._colorGradientsTexture = null;\r\n return this;\r\n };\r\n GPUParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor) {\r\n var valueGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"FactorGradient\"]();\r\n valueGradient.gradient = gradient;\r\n valueGradient.factor1 = factor;\r\n factorGradients.push(valueGradient);\r\n factorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n this._releaseBuffers();\r\n };\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addSizeGradient = function (gradient, factor) {\r\n if (!this._sizeGradients) {\r\n this._sizeGradients = [];\r\n }\r\n this._addFactorGradient(this._sizeGradients, gradient, factor);\r\n if (this._sizeGradientsTexture) {\r\n this._sizeGradientsTexture.dispose();\r\n this._sizeGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeSizeGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._sizeGradients, this._sizeGradientsTexture);\r\n this._sizeGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addAngularSpeedGradient = function (gradient, factor) {\r\n if (!this._angularSpeedGradients) {\r\n this._angularSpeedGradients = [];\r\n }\r\n this._addFactorGradient(this._angularSpeedGradients, gradient, factor);\r\n if (this._angularSpeedGradientsTexture) {\r\n this._angularSpeedGradientsTexture.dispose();\r\n this._angularSpeedGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeAngularSpeedGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._angularSpeedGradients, this._angularSpeedGradientsTexture);\r\n this._angularSpeedGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addVelocityGradient = function (gradient, factor) {\r\n if (!this._velocityGradients) {\r\n this._velocityGradients = [];\r\n }\r\n this._addFactorGradient(this._velocityGradients, gradient, factor);\r\n if (this._velocityGradientsTexture) {\r\n this._velocityGradientsTexture.dispose();\r\n this._velocityGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeVelocityGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._velocityGradients, this._velocityGradientsTexture);\r\n this._velocityGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity value to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addLimitVelocityGradient = function (gradient, factor) {\r\n if (!this._limitVelocityGradients) {\r\n this._limitVelocityGradients = [];\r\n }\r\n this._addFactorGradient(this._limitVelocityGradients, gradient, factor);\r\n if (this._limitVelocityGradientsTexture) {\r\n this._limitVelocityGradientsTexture.dispose();\r\n this._limitVelocityGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeLimitVelocityGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._limitVelocityGradients, this._limitVelocityGradientsTexture);\r\n this._limitVelocityGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag value to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addDragGradient = function (gradient, factor) {\r\n if (!this._dragGradients) {\r\n this._dragGradients = [];\r\n }\r\n this._addFactorGradient(this._dragGradients, gradient, factor);\r\n if (this._dragGradientsTexture) {\r\n this._dragGradientsTexture.dispose();\r\n this._dragGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeDragGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._dragGradients, this._dragGradientsTexture);\r\n this._dragGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addEmitRateGradient = function (gradient, factor, factor2) {\r\n // Do nothing as emit rate is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeEmitRateGradient = function (gradient) {\r\n // Do nothing as emit rate is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addStartSizeGradient = function (gradient, factor, factor2) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeStartSizeGradient = function (gradient) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addColorRemapGradient = function (gradient, min, max) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeColorRemapGradient = function () {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addAlphaRemapGradient = function (gradient, min, max) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeAlphaRemapGradient = function () {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addRampGradient = function (gradient, color) {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeRampGradient = function () {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @returns the list of ramp gradients\r\n */\r\n GPUParticleSystem.prototype.getRampGradients = function () {\r\n return null;\r\n };\r\n Object.defineProperty(GPUParticleSystem.prototype, \"useRampGradients\", {\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see http://doc.babylonjs.com/babylon101/particles#ramp-gradients\r\n */\r\n get: function () {\r\n //Not supported by GPUParticleSystem\r\n return false;\r\n },\r\n set: function (value) {\r\n //Not supported by GPUParticleSystem\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addLifeTimeGradient = function (gradient, factor, factor2) {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeLifeTimeGradient = function (gradient) {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n GPUParticleSystem.prototype._reset = function () {\r\n this._releaseBuffers();\r\n };\r\n GPUParticleSystem.prototype._createUpdateVAO = function (source) {\r\n var updateVertexBuffers = {};\r\n updateVertexBuffers[\"position\"] = source.createVertexBuffer(\"position\", 0, 3);\r\n updateVertexBuffers[\"age\"] = source.createVertexBuffer(\"age\", 3, 1);\r\n updateVertexBuffers[\"life\"] = source.createVertexBuffer(\"life\", 4, 1);\r\n updateVertexBuffers[\"seed\"] = source.createVertexBuffer(\"seed\", 5, 4);\r\n updateVertexBuffers[\"size\"] = source.createVertexBuffer(\"size\", 9, 3);\r\n var offset = 12;\r\n if (!this._colorGradientsTexture) {\r\n updateVertexBuffers[\"color\"] = source.createVertexBuffer(\"color\", offset, 4);\r\n offset += 4;\r\n }\r\n updateVertexBuffers[\"direction\"] = source.createVertexBuffer(\"direction\", offset, 3);\r\n offset += 3;\r\n if (!this._isBillboardBased) {\r\n updateVertexBuffers[\"initialDirection\"] = source.createVertexBuffer(\"initialDirection\", offset, 3);\r\n offset += 3;\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n updateVertexBuffers[\"angle\"] = source.createVertexBuffer(\"angle\", offset, 1);\r\n offset += 1;\r\n }\r\n else {\r\n updateVertexBuffers[\"angle\"] = source.createVertexBuffer(\"angle\", offset, 2);\r\n offset += 2;\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n updateVertexBuffers[\"cellIndex\"] = source.createVertexBuffer(\"cellIndex\", offset, 1);\r\n offset += 1;\r\n if (this.spriteRandomStartCell) {\r\n updateVertexBuffers[\"cellStartOffset\"] = source.createVertexBuffer(\"cellStartOffset\", offset, 1);\r\n offset += 1;\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n updateVertexBuffers[\"noiseCoordinates1\"] = source.createVertexBuffer(\"noiseCoordinates1\", offset, 3);\r\n offset += 3;\r\n updateVertexBuffers[\"noiseCoordinates2\"] = source.createVertexBuffer(\"noiseCoordinates2\", offset, 3);\r\n offset += 3;\r\n }\r\n var vao = this._engine.recordVertexArrayObject(updateVertexBuffers, null, this._updateEffect);\r\n this._engine.bindArrayBuffer(null);\r\n return vao;\r\n };\r\n GPUParticleSystem.prototype._createRenderVAO = function (source, spriteSource) {\r\n var renderVertexBuffers = {};\r\n renderVertexBuffers[\"position\"] = source.createVertexBuffer(\"position\", 0, 3, this._attributesStrideSize, true);\r\n renderVertexBuffers[\"age\"] = source.createVertexBuffer(\"age\", 3, 1, this._attributesStrideSize, true);\r\n renderVertexBuffers[\"life\"] = source.createVertexBuffer(\"life\", 4, 1, this._attributesStrideSize, true);\r\n renderVertexBuffers[\"size\"] = source.createVertexBuffer(\"size\", 9, 3, this._attributesStrideSize, true);\r\n var offset = 12;\r\n if (!this._colorGradientsTexture) {\r\n renderVertexBuffers[\"color\"] = source.createVertexBuffer(\"color\", offset, 4, this._attributesStrideSize, true);\r\n offset += 4;\r\n }\r\n if (this.billboardMode === _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_STRETCHED) {\r\n renderVertexBuffers[\"direction\"] = source.createVertexBuffer(\"direction\", offset, 3, this._attributesStrideSize, true);\r\n }\r\n offset += 3; // Direction\r\n if (!this._isBillboardBased) {\r\n renderVertexBuffers[\"initialDirection\"] = source.createVertexBuffer(\"initialDirection\", offset, 3, this._attributesStrideSize, true);\r\n offset += 3;\r\n }\r\n renderVertexBuffers[\"angle\"] = source.createVertexBuffer(\"angle\", offset, 1, this._attributesStrideSize, true);\r\n if (this._angularSpeedGradientsTexture) {\r\n offset++;\r\n }\r\n else {\r\n offset += 2;\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n renderVertexBuffers[\"cellIndex\"] = source.createVertexBuffer(\"cellIndex\", offset, 1, this._attributesStrideSize, true);\r\n offset += 1;\r\n if (this.spriteRandomStartCell) {\r\n renderVertexBuffers[\"cellStartOffset\"] = source.createVertexBuffer(\"cellStartOffset\", offset, 1, this._attributesStrideSize, true);\r\n offset += 1;\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n renderVertexBuffers[\"noiseCoordinates1\"] = source.createVertexBuffer(\"noiseCoordinates1\", offset, 3, this._attributesStrideSize, true);\r\n offset += 3;\r\n renderVertexBuffers[\"noiseCoordinates2\"] = source.createVertexBuffer(\"noiseCoordinates2\", offset, 3, this._attributesStrideSize, true);\r\n offset += 3;\r\n }\r\n renderVertexBuffers[\"offset\"] = spriteSource.createVertexBuffer(\"offset\", 0, 2);\r\n renderVertexBuffers[\"uv\"] = spriteSource.createVertexBuffer(\"uv\", 2, 2);\r\n var vao = this._engine.recordVertexArrayObject(renderVertexBuffers, null, this._renderEffect);\r\n this._engine.bindArrayBuffer(null);\r\n return vao;\r\n };\r\n GPUParticleSystem.prototype._initialize = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (this._buffer0 && !force) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n var data = new Array();\r\n this._attributesStrideSize = 21;\r\n this._targetIndex = 0;\r\n if (!this.isBillboardBased) {\r\n this._attributesStrideSize += 3;\r\n }\r\n if (this._colorGradientsTexture) {\r\n this._attributesStrideSize -= 4;\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n this._attributesStrideSize -= 1;\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n this._attributesStrideSize += 1;\r\n if (this.spriteRandomStartCell) {\r\n this._attributesStrideSize += 1;\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n this._attributesStrideSize += 6;\r\n }\r\n for (var particleIndex = 0; particleIndex < this._capacity; particleIndex++) {\r\n // position\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n // Age and life\r\n data.push(0.0); // create the particle as a dead one to create a new one at start\r\n data.push(0.0);\r\n // Seed\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n // Size\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n if (!this._colorGradientsTexture) {\r\n // color\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n }\r\n // direction\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n if (!this.isBillboardBased) {\r\n // initialDirection\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n }\r\n // angle\r\n data.push(0.0);\r\n if (!this._angularSpeedGradientsTexture) {\r\n data.push(0.0);\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n data.push(0.0);\r\n if (this.spriteRandomStartCell) {\r\n data.push(0.0);\r\n }\r\n }\r\n if (this.noiseTexture) { // Random coordinates for reading into noise texture\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n }\r\n }\r\n // Sprite data\r\n var spriteData = new Float32Array([0.5, 0.5, 1, 1,\r\n -0.5, 0.5, 0, 1,\r\n -0.5, -0.5, 0, 0,\r\n 0.5, -0.5, 1, 0]);\r\n // Buffers\r\n this._buffer0 = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"Buffer\"](engine, data, false, this._attributesStrideSize);\r\n this._buffer1 = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"Buffer\"](engine, data, false, this._attributesStrideSize);\r\n this._spriteBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"Buffer\"](engine, spriteData, false, 4);\r\n // Update VAO\r\n this._updateVAO = [];\r\n this._updateVAO.push(this._createUpdateVAO(this._buffer0));\r\n this._updateVAO.push(this._createUpdateVAO(this._buffer1));\r\n // Render VAO\r\n this._renderVAO = [];\r\n this._renderVAO.push(this._createRenderVAO(this._buffer1, this._spriteBuffer));\r\n this._renderVAO.push(this._createRenderVAO(this._buffer0, this._spriteBuffer));\r\n // Links\r\n this._sourceBuffer = this._buffer0;\r\n this._targetBuffer = this._buffer1;\r\n };\r\n /** @hidden */\r\n GPUParticleSystem.prototype._recreateUpdateEffect = function () {\r\n var defines = this.particleEmitterType ? this.particleEmitterType.getEffectDefines() : \"\";\r\n if (this._isBillboardBased) {\r\n defines += \"\\n#define BILLBOARD\";\r\n }\r\n if (this._colorGradientsTexture) {\r\n defines += \"\\n#define COLORGRADIENTS\";\r\n }\r\n if (this._sizeGradientsTexture) {\r\n defines += \"\\n#define SIZEGRADIENTS\";\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n defines += \"\\n#define ANGULARSPEEDGRADIENTS\";\r\n }\r\n if (this._velocityGradientsTexture) {\r\n defines += \"\\n#define VELOCITYGRADIENTS\";\r\n }\r\n if (this._limitVelocityGradientsTexture) {\r\n defines += \"\\n#define LIMITVELOCITYGRADIENTS\";\r\n }\r\n if (this._dragGradientsTexture) {\r\n defines += \"\\n#define DRAGGRADIENTS\";\r\n }\r\n if (this.isAnimationSheetEnabled) {\r\n defines += \"\\n#define ANIMATESHEET\";\r\n if (this.spriteRandomStartCell) {\r\n defines += \"\\n#define ANIMATESHEETRANDOMSTART\";\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n defines += \"\\n#define NOISE\";\r\n }\r\n if (this._updateEffect && this._updateEffectOptions.defines === defines) {\r\n return;\r\n }\r\n this._updateEffectOptions.transformFeedbackVaryings = [\"outPosition\", \"outAge\", \"outLife\", \"outSeed\", \"outSize\"];\r\n if (!this._colorGradientsTexture) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outColor\");\r\n }\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outDirection\");\r\n if (!this._isBillboardBased) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outInitialDirection\");\r\n }\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outAngle\");\r\n if (this.isAnimationSheetEnabled) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outCellIndex\");\r\n if (this.spriteRandomStartCell) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outCellStartOffset\");\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outNoiseCoordinates1\");\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outNoiseCoordinates2\");\r\n }\r\n this._updateEffectOptions.defines = defines;\r\n this._updateEffect = new _Materials_effect__WEBPACK_IMPORTED_MODULE_10__[\"Effect\"](\"gpuUpdateParticles\", this._updateEffectOptions, this._scene.getEngine());\r\n };\r\n /** @hidden */\r\n GPUParticleSystem.prototype._recreateRenderEffect = function () {\r\n var defines = \"\";\r\n if (this._scene.clipPlane) {\r\n defines = \"\\n#define CLIPPLANE\";\r\n }\r\n if (this._scene.clipPlane2) {\r\n defines = \"\\n#define CLIPPLANE2\";\r\n }\r\n if (this._scene.clipPlane3) {\r\n defines = \"\\n#define CLIPPLANE3\";\r\n }\r\n if (this._scene.clipPlane4) {\r\n defines = \"\\n#define CLIPPLANE4\";\r\n }\r\n if (this.blendMode === _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_MULTIPLY) {\r\n defines = \"\\n#define BLENDMULTIPLYMODE\";\r\n }\r\n if (this._isBillboardBased) {\r\n defines += \"\\n#define BILLBOARD\";\r\n switch (this.billboardMode) {\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_Y:\r\n defines += \"\\n#define BILLBOARDY\";\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_STRETCHED:\r\n defines += \"\\n#define BILLBOARDSTRETCHED\";\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_ALL:\r\n default:\r\n break;\r\n }\r\n }\r\n if (this._colorGradientsTexture) {\r\n defines += \"\\n#define COLORGRADIENTS\";\r\n }\r\n if (this.isAnimationSheetEnabled) {\r\n defines += \"\\n#define ANIMATESHEET\";\r\n }\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines);\r\n defines += \"\\n\" + this._imageProcessingConfigurationDefines.toString();\r\n }\r\n if (this._renderEffect && this._renderEffect.defines === defines) {\r\n return;\r\n }\r\n var uniforms = [\"worldOffset\", \"view\", \"projection\", \"colorDead\", \"invView\", \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"sheetInfos\", \"translationPivot\", \"eyePosition\"];\r\n var samplers = [\"textureSampler\", \"colorGradientSampler\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, this._imageProcessingConfigurationDefines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, this._imageProcessingConfigurationDefines);\r\n }\r\n this._renderEffect = new _Materials_effect__WEBPACK_IMPORTED_MODULE_10__[\"Effect\"](\"gpuRenderParticles\", [\"position\", \"age\", \"life\", \"size\", \"color\", \"offset\", \"uv\", \"direction\", \"initialDirection\", \"angle\", \"cellIndex\"], uniforms, samplers, this._scene.getEngine(), defines);\r\n };\r\n /**\r\n * Animates the particle system for the current frame by emitting new particles and or animating the living ones.\r\n * @param preWarm defines if we are in the pre-warmimg phase\r\n */\r\n GPUParticleSystem.prototype.animate = function (preWarm) {\r\n if (preWarm === void 0) { preWarm = false; }\r\n this._timeDelta = this.updateSpeed * (preWarm ? this.preWarmStepOffset : this._scene.getAnimationRatio());\r\n this._actualFrame += this._timeDelta;\r\n if (!this._stopped) {\r\n if (this.targetStopDuration && this._actualFrame >= this.targetStopDuration) {\r\n this.stop();\r\n }\r\n }\r\n };\r\n GPUParticleSystem.prototype._createFactorGradientTexture = function (factorGradients, textureName) {\r\n var texture = this[textureName];\r\n if (!factorGradients || !factorGradients.length || texture) {\r\n return;\r\n }\r\n var data = new Float32Array(this._rawTextureWidth);\r\n for (var x = 0; x < this._rawTextureWidth; x++) {\r\n var ratio = x / this._rawTextureWidth;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, factorGradients, function (currentGradient, nextGradient, scale) {\r\n data[x] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_5__[\"Scalar\"].Lerp(currentGradient.factor1, nextGradient.factor1, scale);\r\n });\r\n }\r\n this[textureName] = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"].CreateRTexture(data, this._rawTextureWidth, 1, this._scene, false, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n };\r\n GPUParticleSystem.prototype._createSizeGradientTexture = function () {\r\n this._createFactorGradientTexture(this._sizeGradients, \"_sizeGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createAngularSpeedGradientTexture = function () {\r\n this._createFactorGradientTexture(this._angularSpeedGradients, \"_angularSpeedGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createVelocityGradientTexture = function () {\r\n this._createFactorGradientTexture(this._velocityGradients, \"_velocityGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createLimitVelocityGradientTexture = function () {\r\n this._createFactorGradientTexture(this._limitVelocityGradients, \"_limitVelocityGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createDragGradientTexture = function () {\r\n this._createFactorGradientTexture(this._dragGradients, \"_dragGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createColorGradientTexture = function () {\r\n if (!this._colorGradients || !this._colorGradients.length || this._colorGradientsTexture) {\r\n return;\r\n }\r\n var data = new Uint8Array(this._rawTextureWidth * 4);\r\n var tmpColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"TmpColors\"].Color4[0];\r\n for (var x = 0; x < this._rawTextureWidth; x++) {\r\n var ratio = x / this._rawTextureWidth;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this._colorGradients, function (currentGradient, nextGradient, scale) {\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"].LerpToRef(currentGradient.color1, nextGradient.color1, scale, tmpColor);\r\n data[x * 4] = tmpColor.r * 255;\r\n data[x * 4 + 1] = tmpColor.g * 255;\r\n data[x * 4 + 2] = tmpColor.b * 255;\r\n data[x * 4 + 3] = tmpColor.a * 255;\r\n });\r\n }\r\n this._colorGradientsTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"].CreateRGBATexture(data, this._rawTextureWidth, 1, this._scene, false, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n };\r\n /**\r\n * Renders the particle system in its current state\r\n * @param preWarm defines if the system should only update the particles but not render them\r\n * @returns the current number of particles\r\n */\r\n GPUParticleSystem.prototype.render = function (preWarm) {\r\n if (preWarm === void 0) { preWarm = false; }\r\n if (!this._started) {\r\n return 0;\r\n }\r\n this._createColorGradientTexture();\r\n this._createSizeGradientTexture();\r\n this._createAngularSpeedGradientTexture();\r\n this._createVelocityGradientTexture();\r\n this._createLimitVelocityGradientTexture();\r\n this._createDragGradientTexture();\r\n this._recreateUpdateEffect();\r\n this._recreateRenderEffect();\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n if (!preWarm) {\r\n if (!this._preWarmDone && this.preWarmCycles) {\r\n for (var index = 0; index < this.preWarmCycles; index++) {\r\n this.animate(true);\r\n this.render(true);\r\n }\r\n this._preWarmDone = true;\r\n }\r\n if (this._currentRenderId === this._scene.getFrameId()) {\r\n return 0;\r\n }\r\n this._currentRenderId = this._scene.getFrameId();\r\n }\r\n // Get everything ready to render\r\n this._initialize();\r\n this._accumulatedCount += this.emitRate * this._timeDelta;\r\n if (this._accumulatedCount > 1) {\r\n var intPart = this._accumulatedCount | 0;\r\n this._accumulatedCount -= intPart;\r\n this._currentActiveCount = Math.min(this._activeCount, this._currentActiveCount + intPart);\r\n }\r\n if (!this._currentActiveCount) {\r\n return 0;\r\n }\r\n // Enable update effect\r\n this._engine.enableEffect(this._updateEffect);\r\n this._engine.setState(false);\r\n this._updateEffect.setFloat(\"currentCount\", this._currentActiveCount);\r\n this._updateEffect.setFloat(\"timeDelta\", this._timeDelta);\r\n this._updateEffect.setFloat(\"stopFactor\", this._stopped ? 0 : 1);\r\n this._updateEffect.setTexture(\"randomSampler\", this._randomTexture);\r\n this._updateEffect.setTexture(\"randomSampler2\", this._randomTexture2);\r\n this._updateEffect.setFloat2(\"lifeTime\", this.minLifeTime, this.maxLifeTime);\r\n this._updateEffect.setFloat2(\"emitPower\", this.minEmitPower, this.maxEmitPower);\r\n if (!this._colorGradientsTexture) {\r\n this._updateEffect.setDirectColor4(\"color1\", this.color1);\r\n this._updateEffect.setDirectColor4(\"color2\", this.color2);\r\n }\r\n this._updateEffect.setFloat2(\"sizeRange\", this.minSize, this.maxSize);\r\n this._updateEffect.setFloat4(\"scaleRange\", this.minScaleX, this.maxScaleX, this.minScaleY, this.maxScaleY);\r\n this._updateEffect.setFloat4(\"angleRange\", this.minAngularSpeed, this.maxAngularSpeed, this.minInitialRotation, this.maxInitialRotation);\r\n this._updateEffect.setVector3(\"gravity\", this.gravity);\r\n if (this._sizeGradientsTexture) {\r\n this._updateEffect.setTexture(\"sizeGradientSampler\", this._sizeGradientsTexture);\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n this._updateEffect.setTexture(\"angularSpeedGradientSampler\", this._angularSpeedGradientsTexture);\r\n }\r\n if (this._velocityGradientsTexture) {\r\n this._updateEffect.setTexture(\"velocityGradientSampler\", this._velocityGradientsTexture);\r\n }\r\n if (this._limitVelocityGradientsTexture) {\r\n this._updateEffect.setTexture(\"limitVelocityGradientSampler\", this._limitVelocityGradientsTexture);\r\n this._updateEffect.setFloat(\"limitVelocityDamping\", this.limitVelocityDamping);\r\n }\r\n if (this._dragGradientsTexture) {\r\n this._updateEffect.setTexture(\"dragGradientSampler\", this._dragGradientsTexture);\r\n }\r\n if (this.particleEmitterType) {\r\n this.particleEmitterType.applyToShader(this._updateEffect);\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n this._updateEffect.setFloat3(\"cellInfos\", this.startSpriteCellID, this.endSpriteCellID, this.spriteCellChangeSpeed);\r\n }\r\n if (this.noiseTexture) {\r\n this._updateEffect.setTexture(\"noiseSampler\", this.noiseTexture);\r\n this._updateEffect.setVector3(\"noiseStrength\", this.noiseStrength);\r\n }\r\n var emitterWM;\r\n if (this.emitter.position) {\r\n var emitterMesh = this.emitter;\r\n emitterWM = emitterMesh.getWorldMatrix();\r\n }\r\n else {\r\n var emitterPosition = this.emitter;\r\n emitterWM = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Translation(emitterPosition.x, emitterPosition.y, emitterPosition.z);\r\n }\r\n this._updateEffect.setMatrix(\"emitterWM\", emitterWM);\r\n // Bind source VAO\r\n this._engine.bindVertexArrayObject(this._updateVAO[this._targetIndex], null);\r\n // Update\r\n this._engine.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer());\r\n this._engine.setRasterizerState(false);\r\n this._engine.beginTransformFeedback(true);\r\n this._engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].PointListDrawMode, 0, this._currentActiveCount);\r\n this._engine.endTransformFeedback();\r\n this._engine.setRasterizerState(true);\r\n this._engine.bindTransformFeedbackBuffer(null);\r\n if (!preWarm) {\r\n // Enable render effect\r\n this._engine.enableEffect(this._renderEffect);\r\n var viewMatrix = this._scene.getViewMatrix();\r\n this._renderEffect.setMatrix(\"view\", viewMatrix);\r\n this._renderEffect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\r\n this._renderEffect.setTexture(\"textureSampler\", this.particleTexture);\r\n this._renderEffect.setVector2(\"translationPivot\", this.translationPivot);\r\n this._renderEffect.setVector3(\"worldOffset\", this.worldOffset);\r\n if (this._colorGradientsTexture) {\r\n this._renderEffect.setTexture(\"colorGradientSampler\", this._colorGradientsTexture);\r\n }\r\n else {\r\n this._renderEffect.setDirectColor4(\"colorDead\", this.colorDead);\r\n }\r\n if (this._isAnimationSheetEnabled && this.particleTexture) {\r\n var baseSize = this.particleTexture.getBaseSize();\r\n this._renderEffect.setFloat3(\"sheetInfos\", this.spriteCellWidth / baseSize.width, this.spriteCellHeight / baseSize.height, baseSize.width / this.spriteCellWidth);\r\n }\r\n if (this._isBillboardBased) {\r\n var camera = this._scene.activeCamera;\r\n this._renderEffect.setVector3(\"eyePosition\", camera.globalPosition);\r\n }\r\n if (this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4) {\r\n var invView = viewMatrix.clone();\r\n invView.invert();\r\n this._renderEffect.setMatrix(\"invView\", invView);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].BindClipPlane(this._renderEffect, this._scene);\r\n }\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(this._renderEffect);\r\n }\r\n // Draw order\r\n switch (this.blendMode) {\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_ADD:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_ADD);\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_ONEONE:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_ONEONE);\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_STANDARD:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_COMBINE);\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_MULTIPLY:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_MULTIPLY);\r\n break;\r\n }\r\n if (this.forceDepthWrite) {\r\n this._engine.setDepthWrite(true);\r\n }\r\n // Bind source VAO\r\n this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex], null);\r\n // Render\r\n this._engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].TriangleFanDrawMode, 0, 4, this._currentActiveCount);\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // Switch VAOs\r\n this._targetIndex++;\r\n if (this._targetIndex === 2) {\r\n this._targetIndex = 0;\r\n }\r\n // Switch buffers\r\n var tmpBuffer = this._sourceBuffer;\r\n this._sourceBuffer = this._targetBuffer;\r\n this._targetBuffer = tmpBuffer;\r\n return this._currentActiveCount;\r\n };\r\n /**\r\n * Rebuilds the particle system\r\n */\r\n GPUParticleSystem.prototype.rebuild = function () {\r\n this._initialize(true);\r\n };\r\n GPUParticleSystem.prototype._releaseBuffers = function () {\r\n if (this._buffer0) {\r\n this._buffer0.dispose();\r\n this._buffer0 = null;\r\n }\r\n if (this._buffer1) {\r\n this._buffer1.dispose();\r\n this._buffer1 = null;\r\n }\r\n if (this._spriteBuffer) {\r\n this._spriteBuffer.dispose();\r\n this._spriteBuffer = null;\r\n }\r\n };\r\n GPUParticleSystem.prototype._releaseVAOs = function () {\r\n if (!this._updateVAO) {\r\n return;\r\n }\r\n for (var index = 0; index < this._updateVAO.length; index++) {\r\n this._engine.releaseVertexArrayObject(this._updateVAO[index]);\r\n }\r\n this._updateVAO = [];\r\n for (var index = 0; index < this._renderVAO.length; index++) {\r\n this._engine.releaseVertexArrayObject(this._renderVAO[index]);\r\n }\r\n this._renderVAO = [];\r\n };\r\n /**\r\n * Disposes the particle system and free the associated resources\r\n * @param disposeTexture defines if the particule texture must be disposed as well (true by default)\r\n */\r\n GPUParticleSystem.prototype.dispose = function (disposeTexture) {\r\n if (disposeTexture === void 0) { disposeTexture = true; }\r\n var index = this._scene.particleSystems.indexOf(this);\r\n if (index > -1) {\r\n this._scene.particleSystems.splice(index, 1);\r\n }\r\n this._releaseBuffers();\r\n this._releaseVAOs();\r\n if (this._colorGradientsTexture) {\r\n this._colorGradientsTexture.dispose();\r\n this._colorGradientsTexture = null;\r\n }\r\n if (this._sizeGradientsTexture) {\r\n this._sizeGradientsTexture.dispose();\r\n this._sizeGradientsTexture = null;\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n this._angularSpeedGradientsTexture.dispose();\r\n this._angularSpeedGradientsTexture = null;\r\n }\r\n if (this._velocityGradientsTexture) {\r\n this._velocityGradientsTexture.dispose();\r\n this._velocityGradientsTexture = null;\r\n }\r\n if (this._limitVelocityGradientsTexture) {\r\n this._limitVelocityGradientsTexture.dispose();\r\n this._limitVelocityGradientsTexture = null;\r\n }\r\n if (this._dragGradientsTexture) {\r\n this._dragGradientsTexture.dispose();\r\n this._dragGradientsTexture = null;\r\n }\r\n if (this._randomTexture) {\r\n this._randomTexture.dispose();\r\n this._randomTexture = null;\r\n }\r\n if (this._randomTexture2) {\r\n this._randomTexture2.dispose();\r\n this._randomTexture2 = null;\r\n }\r\n if (disposeTexture && this.particleTexture) {\r\n this.particleTexture.dispose();\r\n this.particleTexture = null;\r\n }\r\n if (disposeTexture && this.noiseTexture) {\r\n this.noiseTexture.dispose();\r\n this.noiseTexture = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n GPUParticleSystem.prototype.clone = function (name, newEmitter) {\r\n var result = new GPUParticleSystem(name, { capacity: this._capacity, randomTextureSize: this._randomTextureSize }, this._scene);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_18__[\"DeepCopier\"].DeepCopy(this, result, [\"particles\", \"customShader\", \"noiseTexture\", \"particleTexture\", \"onDisposeObservable\"]);\r\n if (newEmitter === undefined) {\r\n newEmitter = this.emitter;\r\n }\r\n result.emitter = newEmitter;\r\n if (this.particleTexture) {\r\n result.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"](this.particleTexture.url, this._scene);\r\n }\r\n result.noiseTexture = this.noiseTexture;\r\n result.emitter = newEmitter;\r\n if (this.particleTexture) {\r\n result.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"](this.particleTexture.url, this._scene);\r\n }\r\n // Clone gradients\r\n if (this._colorGradients) {\r\n this._colorGradients.forEach(function (v) {\r\n result.addColorGradient(v.gradient, v.color1, v.color2);\r\n });\r\n }\r\n if (this._dragGradients) {\r\n this._dragGradients.forEach(function (v) {\r\n result.addDragGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._angularSpeedGradients) {\r\n this._angularSpeedGradients.forEach(function (v) {\r\n result.addAngularSpeedGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._emitRateGradients) {\r\n this._emitRateGradients.forEach(function (v) {\r\n result.addEmitRateGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._lifeTimeGradients) {\r\n this._lifeTimeGradients.forEach(function (v) {\r\n result.addLifeTimeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._limitVelocityGradients) {\r\n this._limitVelocityGradients.forEach(function (v) {\r\n result.addLimitVelocityGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._sizeGradients) {\r\n this._sizeGradients.forEach(function (v) {\r\n result.addSizeGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._startSizeGradients) {\r\n this._startSizeGradients.forEach(function (v) {\r\n result.addStartSizeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._velocityGradients) {\r\n this._velocityGradients.forEach(function (v) {\r\n result.addVelocityGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._rampGradients) {\r\n this._rampGradients.forEach(function (v) {\r\n result.addRampGradient(v.gradient, v.color);\r\n });\r\n }\r\n if (this._colorRemapGradients) {\r\n this._colorRemapGradients.forEach(function (v) {\r\n result.addColorRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._alphaRemapGradients) {\r\n this._alphaRemapGradients.forEach(function (v) {\r\n result.addAlphaRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n GPUParticleSystem.prototype.serialize = function () {\r\n var serializationObject = {};\r\n _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"]._Serialize(serializationObject, this);\r\n serializationObject.activeParticleCount = this.activeParticleCount;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a JSON object to create a GPU particle system.\r\n * @param parsedParticleSystem The JSON object to parse\r\n * @param scene The scene to create the particle system in\r\n * @param rootUrl The root url to use to load external dependencies like texture\r\n * @param doNotStart Ignore the preventAutoStart attribute and does not start\r\n * @returns the parsed GPU particle system\r\n */\r\n GPUParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl, doNotStart) {\r\n if (doNotStart === void 0) { doNotStart = false; }\r\n var name = parsedParticleSystem.name;\r\n var particleSystem = new GPUParticleSystem(name, { capacity: parsedParticleSystem.capacity, randomTextureSize: parsedParticleSystem.randomTextureSize }, scene);\r\n if (parsedParticleSystem.activeParticleCount) {\r\n particleSystem.activeParticleCount = parsedParticleSystem.activeParticleCount;\r\n }\r\n _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"]._Parse(parsedParticleSystem, particleSystem, scene, rootUrl);\r\n // Auto start\r\n if (parsedParticleSystem.preventAutoStart) {\r\n particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;\r\n }\r\n if (!doNotStart && !particleSystem.preventAutoStart) {\r\n particleSystem.start();\r\n }\r\n return particleSystem;\r\n };\r\n return GPUParticleSystem;\r\n}(_baseParticleSystem__WEBPACK_IMPORTED_MODULE_7__[\"BaseParticleSystem\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/index.ts\":\n/*!****************************!*\\\n !*** ./Particles/index.ts ***!\n \\****************************/\n/*! exports provided: BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _baseParticleSystem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseParticleSystem */ \"./Particles/baseParticleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return _baseParticleSystem__WEBPACK_IMPORTED_MODULE_0__[\"BaseParticleSystem\"]; });\n\n/* harmony import */ var _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmitterTypes/index */ \"./Particles/EmitterTypes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"BoxParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"ConeParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"PointParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"SphereDirectedParticleEmitter\"]; });\n\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__[\"GPUParticleSystem\"]; });\n\n/* harmony import */ var _particle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./particle */ \"./Particles/particle.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return _particle__WEBPACK_IMPORTED_MODULE_3__[\"Particle\"]; });\n\n/* harmony import */ var _particleHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./particleHelper */ \"./Particles/particleHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return _particleHelper__WEBPACK_IMPORTED_MODULE_4__[\"ParticleHelper\"]; });\n\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return _particleSystem__WEBPACK_IMPORTED_MODULE_5__[\"ParticleSystem\"]; });\n\n/* harmony import */ var _particleSystemComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./particleSystemComponent */ \"./Particles/particleSystemComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _particleSystemComponent__WEBPACK_IMPORTED_MODULE_6__[\"_IDoNeedToBeInTheBuild\"]; });\n\n/* harmony import */ var _particleSystemSet__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./particleSystemSet */ \"./Particles/particleSystemSet.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return _particleSystemSet__WEBPACK_IMPORTED_MODULE_7__[\"ParticleSystemSet\"]; });\n\n/* harmony import */ var _solidParticle__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./solidParticle */ \"./Particles/solidParticle.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return _solidParticle__WEBPACK_IMPORTED_MODULE_8__[\"SolidParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return _solidParticle__WEBPACK_IMPORTED_MODULE_8__[\"ModelShape\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return _solidParticle__WEBPACK_IMPORTED_MODULE_8__[\"DepthSortedParticle\"]; });\n\n/* harmony import */ var _solidParticleSystem__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./solidParticleSystem */ \"./Particles/solidParticleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return _solidParticleSystem__WEBPACK_IMPORTED_MODULE_9__[\"SolidParticleSystem\"]; });\n\n/* harmony import */ var _subEmitter__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./subEmitter */ \"./Particles/subEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return _subEmitter__WEBPACK_IMPORTED_MODULE_10__[\"SubEmitterType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return _subEmitter__WEBPACK_IMPORTED_MODULE_10__[\"SubEmitter\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particle.ts\":\n/*!*******************************!*\\\n !*** ./Particles/particle.ts ***!\n \\*******************************/\n/*! exports provided: Particle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return Particle; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * A particle represents one of the element emitted by a particle system.\r\n * This is mainly define by its coordinates, direction, velocity and age.\r\n */\r\nvar Particle = /** @class */ (function () {\r\n /**\r\n * Creates a new instance Particle\r\n * @param particleSystem the particle system the particle belongs to\r\n */\r\n function Particle(\r\n /**\r\n * The particle system the particle belongs to.\r\n */\r\n particleSystem) {\r\n this.particleSystem = particleSystem;\r\n /**\r\n * The world position of the particle in the scene.\r\n */\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The world direction of the particle in the scene.\r\n */\r\n this.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The color of the particle.\r\n */\r\n this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * The color change of the particle per step.\r\n */\r\n this.colorStep = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * Defines how long will the life of the particle be.\r\n */\r\n this.lifeTime = 1.0;\r\n /**\r\n * The current age of the particle.\r\n */\r\n this.age = 0;\r\n /**\r\n * The current size of the particle.\r\n */\r\n this.size = 0;\r\n /**\r\n * The current scale of the particle.\r\n */\r\n this.scale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](1, 1);\r\n /**\r\n * The current angle of the particle.\r\n */\r\n this.angle = 0;\r\n /**\r\n * Defines how fast is the angle changing.\r\n */\r\n this.angularSpeed = 0;\r\n /**\r\n * Defines the cell index used by the particle to be rendered from a sprite.\r\n */\r\n this.cellIndex = 0;\r\n /** @hidden */\r\n this._attachedSubEmitters = null;\r\n /** @hidden */\r\n this._currentColor1 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /** @hidden */\r\n this._currentColor2 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /** @hidden */\r\n this._currentSize1 = 0;\r\n /** @hidden */\r\n this._currentSize2 = 0;\r\n /** @hidden */\r\n this._currentAngularSpeed1 = 0;\r\n /** @hidden */\r\n this._currentAngularSpeed2 = 0;\r\n /** @hidden */\r\n this._currentVelocity1 = 0;\r\n /** @hidden */\r\n this._currentVelocity2 = 0;\r\n /** @hidden */\r\n this._currentLimitVelocity1 = 0;\r\n /** @hidden */\r\n this._currentLimitVelocity2 = 0;\r\n /** @hidden */\r\n this._currentDrag1 = 0;\r\n /** @hidden */\r\n this._currentDrag2 = 0;\r\n this.id = Particle._Count++;\r\n if (!this.particleSystem.isAnimationSheetEnabled) {\r\n return;\r\n }\r\n this.updateCellInfoFromSystem();\r\n }\r\n Particle.prototype.updateCellInfoFromSystem = function () {\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n };\r\n /**\r\n * Defines how the sprite cell index is updated for the particle\r\n */\r\n Particle.prototype.updateCellIndex = function () {\r\n var offsetAge = this.age;\r\n var changeSpeed = this.particleSystem.spriteCellChangeSpeed;\r\n if (this.particleSystem.spriteRandomStartCell) {\r\n if (this._randomCellOffset === undefined) {\r\n this._randomCellOffset = Math.random() * this.lifeTime;\r\n }\r\n if (changeSpeed === 0) { // Special case when speed = 0 meaning we want to stay on initial cell\r\n changeSpeed = 1;\r\n offsetAge = this._randomCellOffset;\r\n }\r\n else {\r\n offsetAge += this._randomCellOffset;\r\n }\r\n }\r\n var dist = (this._initialEndSpriteCellID - this._initialStartSpriteCellID);\r\n var ratio = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Clamp(((offsetAge * changeSpeed) % this.lifeTime) / this.lifeTime);\r\n this.cellIndex = this._initialStartSpriteCellID + (ratio * dist) | 0;\r\n };\r\n /** @hidden */\r\n Particle.prototype._inheritParticleInfoToSubEmitter = function (subEmitter) {\r\n if (subEmitter.particleSystem.emitter.position) {\r\n var emitterMesh = subEmitter.particleSystem.emitter;\r\n emitterMesh.position.copyFrom(this.position);\r\n if (subEmitter.inheritDirection) {\r\n emitterMesh.position.subtractToRef(this.direction, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0]);\r\n // Look at using Y as forward\r\n emitterMesh.lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0], 0, Math.PI / 2);\r\n }\r\n }\r\n else {\r\n var emitterPosition = subEmitter.particleSystem.emitter;\r\n emitterPosition.copyFrom(this.position);\r\n }\r\n // Set inheritedVelocityOffset to be used when new particles are created\r\n this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0]);\r\n subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0]);\r\n };\r\n /** @hidden */\r\n Particle.prototype._inheritParticleInfoToSubEmitters = function () {\r\n var _this = this;\r\n if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {\r\n this._attachedSubEmitters.forEach(function (subEmitter) {\r\n _this._inheritParticleInfoToSubEmitter(subEmitter);\r\n });\r\n }\r\n };\r\n /** @hidden */\r\n Particle.prototype._reset = function () {\r\n this.age = 0;\r\n this._currentColorGradient = null;\r\n this._currentSizeGradient = null;\r\n this._currentAngularSpeedGradient = null;\r\n this._currentVelocityGradient = null;\r\n this._currentLimitVelocityGradient = null;\r\n this._currentDragGradient = null;\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n this._randomCellOffset = undefined;\r\n };\r\n /**\r\n * Copy the properties of particle to another one.\r\n * @param other the particle to copy the information to.\r\n */\r\n Particle.prototype.copyTo = function (other) {\r\n other.position.copyFrom(this.position);\r\n if (this._initialDirection) {\r\n if (other._initialDirection) {\r\n other._initialDirection.copyFrom(this._initialDirection);\r\n }\r\n else {\r\n other._initialDirection = this._initialDirection.clone();\r\n }\r\n }\r\n else {\r\n other._initialDirection = null;\r\n }\r\n other.direction.copyFrom(this.direction);\r\n other.color.copyFrom(this.color);\r\n other.colorStep.copyFrom(this.colorStep);\r\n other.lifeTime = this.lifeTime;\r\n other.age = this.age;\r\n other._randomCellOffset = this._randomCellOffset;\r\n other.size = this.size;\r\n other.scale.copyFrom(this.scale);\r\n other.angle = this.angle;\r\n other.angularSpeed = this.angularSpeed;\r\n other.particleSystem = this.particleSystem;\r\n other.cellIndex = this.cellIndex;\r\n other.id = this.id;\r\n other._attachedSubEmitters = this._attachedSubEmitters;\r\n if (this._currentColorGradient) {\r\n other._currentColorGradient = this._currentColorGradient;\r\n other._currentColor1.copyFrom(this._currentColor1);\r\n other._currentColor2.copyFrom(this._currentColor2);\r\n }\r\n if (this._currentSizeGradient) {\r\n other._currentSizeGradient = this._currentSizeGradient;\r\n other._currentSize1 = this._currentSize1;\r\n other._currentSize2 = this._currentSize2;\r\n }\r\n if (this._currentAngularSpeedGradient) {\r\n other._currentAngularSpeedGradient = this._currentAngularSpeedGradient;\r\n other._currentAngularSpeed1 = this._currentAngularSpeed1;\r\n other._currentAngularSpeed2 = this._currentAngularSpeed2;\r\n }\r\n if (this._currentVelocityGradient) {\r\n other._currentVelocityGradient = this._currentVelocityGradient;\r\n other._currentVelocity1 = this._currentVelocity1;\r\n other._currentVelocity2 = this._currentVelocity2;\r\n }\r\n if (this._currentLimitVelocityGradient) {\r\n other._currentLimitVelocityGradient = this._currentLimitVelocityGradient;\r\n other._currentLimitVelocity1 = this._currentLimitVelocity1;\r\n other._currentLimitVelocity2 = this._currentLimitVelocity2;\r\n }\r\n if (this._currentDragGradient) {\r\n other._currentDragGradient = this._currentDragGradient;\r\n other._currentDrag1 = this._currentDrag1;\r\n other._currentDrag2 = this._currentDrag2;\r\n }\r\n if (this.particleSystem.isAnimationSheetEnabled) {\r\n other._initialStartSpriteCellID = this._initialStartSpriteCellID;\r\n other._initialEndSpriteCellID = this._initialEndSpriteCellID;\r\n }\r\n if (this.particleSystem.useRampGradients) {\r\n other.remapData.copyFrom(this.remapData);\r\n }\r\n if (this._randomNoiseCoordinates1) {\r\n if (other._randomNoiseCoordinates1) {\r\n other._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1);\r\n other._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2);\r\n }\r\n else {\r\n other._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone();\r\n other._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone();\r\n }\r\n }\r\n };\r\n Particle._Count = 0;\r\n return Particle;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleHelper.ts\":\n/*!*************************************!*\\\n !*** ./Particles/particleHelper.ts ***!\n \\*************************************/\n/*! exports provided: ParticleHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return ParticleHelper; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony import */ var _particleSystemSet__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./particleSystemSet */ \"./Particles/particleSystemSet.ts\");\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This class is made for on one-liner static method to help creating particle system set.\r\n */\r\nvar ParticleHelper = /** @class */ (function () {\r\n function ParticleHelper() {\r\n }\r\n /**\r\n * Create a default particle system that you can tweak\r\n * @param emitter defines the emitter to use\r\n * @param capacity defines the system capacity (default is 500 particles)\r\n * @param scene defines the hosting scene\r\n * @param useGPU defines if a GPUParticleSystem must be created (default is false)\r\n * @returns the new Particle system\r\n */\r\n ParticleHelper.CreateDefault = function (emitter, capacity, scene, useGPU) {\r\n if (capacity === void 0) { capacity = 500; }\r\n if (useGPU === void 0) { useGPU = false; }\r\n var system;\r\n if (useGPU) {\r\n system = new _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_4__[\"GPUParticleSystem\"](\"default system\", { capacity: capacity }, scene);\r\n }\r\n else {\r\n system = new _particleSystem__WEBPACK_IMPORTED_MODULE_6__[\"ParticleSystem\"](\"default system\", capacity, scene);\r\n }\r\n system.emitter = emitter;\r\n system.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"](\"https://www.babylonjs.com/assets/Flare.png\", system.getScene());\r\n system.createConeEmitter(0.1, Math.PI / 4);\r\n // Particle color\r\n system.color1 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n system.color2 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n system.colorDead = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 0.0);\r\n // Particle Size\r\n system.minSize = 0.1;\r\n system.maxSize = 0.1;\r\n // Emission speed\r\n system.minEmitPower = 2;\r\n system.maxEmitPower = 2;\r\n // Update speed\r\n system.updateSpeed = 1 / 60;\r\n system.emitRate = 30;\r\n return system;\r\n };\r\n /**\r\n * This is the main static method (one-liner) of this helper to create different particle systems\r\n * @param type This string represents the type to the particle system to create\r\n * @param scene The scene where the particle system should live\r\n * @param gpu If the system will use gpu\r\n * @returns the ParticleSystemSet created\r\n */\r\n ParticleHelper.CreateAsync = function (type, scene, gpu) {\r\n if (gpu === void 0) { gpu = false; }\r\n if (!scene) {\r\n scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene;\r\n }\r\n var token = {};\r\n scene._addPendingData(token);\r\n return new Promise(function (resolve, reject) {\r\n if (gpu && !_gpuParticleSystem__WEBPACK_IMPORTED_MODULE_4__[\"GPUParticleSystem\"].IsSupported) {\r\n scene._removePendingData(token);\r\n return reject(\"Particle system with GPU is not supported.\");\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFile(ParticleHelper.BaseAssetsUrl + \"/systems/\" + type + \".json\", function (data) {\r\n scene._removePendingData(token);\r\n var newData = JSON.parse(data.toString());\r\n return resolve(_particleSystemSet__WEBPACK_IMPORTED_MODULE_5__[\"ParticleSystemSet\"].Parse(newData, scene, gpu));\r\n }, undefined, undefined, undefined, function () {\r\n scene._removePendingData(token);\r\n return reject(\"An error occured while the creation of your particle system. Check if your type '\" + type + \"' exists.\");\r\n });\r\n });\r\n };\r\n /**\r\n * Static function used to export a particle system to a ParticleSystemSet variable.\r\n * Please note that the emitter shape is not exported\r\n * @param systems defines the particle systems to export\r\n * @returns the created particle system set\r\n */\r\n ParticleHelper.ExportSet = function (systems) {\r\n var set = new _particleSystemSet__WEBPACK_IMPORTED_MODULE_5__[\"ParticleSystemSet\"]();\r\n for (var _i = 0, systems_1 = systems; _i < systems_1.length; _i++) {\r\n var system = systems_1[_i];\r\n set.systems.push(system);\r\n }\r\n return set;\r\n };\r\n /**\r\n * Gets or sets base Assets URL\r\n */\r\n ParticleHelper.BaseAssetsUrl = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].PARTICLES_BaseAssetsUrl;\r\n return ParticleHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleSystem.ts\":\n/*!*************************************!*\\\n !*** ./Particles/particleSystem.ts ***!\n \\*************************************/\n/*! exports provided: ParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return ParticleSystem; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/gradients */ \"./Misc/gradients.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/Textures/rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony import */ var _Materials_Textures_Procedurals_proceduralTexture__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/Textures/Procedurals/proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Particles/EmitterTypes/index */ \"./Particles/EmitterTypes/index.ts\");\n/* harmony import */ var _baseParticleSystem__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./baseParticleSystem */ \"./Particles/baseParticleSystem.ts\");\n/* harmony import */ var _particle__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./particle */ \"./Particles/particle.ts\");\n/* harmony import */ var _subEmitter__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./subEmitter */ \"./Particles/subEmitter.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Shaders_particles_fragment__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../Shaders/particles.fragment */ \"./Shaders/particles.fragment.ts\");\n/* harmony import */ var _Shaders_particles_vertex__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../Shaders/particles.vertex */ \"./Shaders/particles.vertex.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a particle system in Babylon.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.\r\n * @example https://doc.babylonjs.com/babylon101/particles\r\n */\r\nvar ParticleSystem = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ParticleSystem, _super);\r\n /**\r\n * Instantiates a particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n * @param capacity The max number of particles alive at the same time\r\n * @param scene The scene the particle system belongs to\r\n * @param customEffect a custom effect used to change the way particles are rendered by default\r\n * @param isAnimationSheetEnabled Must be true if using a spritesheet to animate the particles texture\r\n * @param epsilon Offset used to render the particles\r\n */\r\n function ParticleSystem(name, capacity, scene, customEffect, isAnimationSheetEnabled, epsilon) {\r\n if (customEffect === void 0) { customEffect = null; }\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n if (epsilon === void 0) { epsilon = 0.01; }\r\n var _this = _super.call(this, name) || this;\r\n /**\r\n * @hidden\r\n */\r\n _this._inheritedVelocityOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n _this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._particles = new Array();\r\n _this._stockParticles = new Array();\r\n _this._newPartsExcess = 0;\r\n _this._vertexBuffers = {};\r\n _this._scaledColorStep = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"](0, 0, 0, 0);\r\n _this._colorDiff = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"](0, 0, 0, 0);\r\n _this._scaledDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._scaledGravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._currentRenderId = -1;\r\n _this._useInstancing = false;\r\n _this._started = false;\r\n _this._stopped = false;\r\n _this._actualFrame = 0;\r\n /** @hidden */\r\n _this._currentEmitRate1 = 0;\r\n /** @hidden */\r\n _this._currentEmitRate2 = 0;\r\n /** @hidden */\r\n _this._currentStartSize1 = 0;\r\n /** @hidden */\r\n _this._currentStartSize2 = 0;\r\n _this._rawTextureWidth = 256;\r\n _this._useRampGradients = false;\r\n /**\r\n * @hidden\r\n * If the particle systems emitter should be disposed when the particle system is disposed\r\n */\r\n _this._disposeEmitterOnDispose = false;\r\n // start of sub system methods\r\n /**\r\n * \"Recycles\" one of the particle by copying it back to the \"stock\" of particles and removing it from the active list.\r\n * Its lifetime will start back at 0.\r\n */\r\n _this.recycleParticle = function (particle) {\r\n // move particle from activeParticle list to stock particles\r\n var lastParticle = _this._particles.pop();\r\n if (lastParticle !== particle) {\r\n lastParticle.copyTo(particle);\r\n }\r\n _this._stockParticles.push(lastParticle);\r\n };\r\n _this._createParticle = function () {\r\n var particle;\r\n if (_this._stockParticles.length !== 0) {\r\n particle = _this._stockParticles.pop();\r\n particle._reset();\r\n }\r\n else {\r\n particle = new _particle__WEBPACK_IMPORTED_MODULE_16__[\"Particle\"](_this);\r\n }\r\n // Attach emitters\r\n if (_this._subEmitters && _this._subEmitters.length > 0) {\r\n var subEmitters = _this._subEmitters[Math.floor(Math.random() * _this._subEmitters.length)];\r\n particle._attachedSubEmitters = [];\r\n subEmitters.forEach(function (subEmitter) {\r\n if (subEmitter.type === _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitterType\"].ATTACHED) {\r\n var newEmitter = subEmitter.clone();\r\n particle._attachedSubEmitters.push(newEmitter);\r\n newEmitter.particleSystem.start();\r\n }\r\n });\r\n }\r\n return particle;\r\n };\r\n _this._emitFromParticle = function (particle) {\r\n if (!_this._subEmitters || _this._subEmitters.length === 0) {\r\n return;\r\n }\r\n var templateIndex = Math.floor(Math.random() * _this._subEmitters.length);\r\n _this._subEmitters[templateIndex].forEach(function (subEmitter) {\r\n if (subEmitter.type === _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitterType\"].END) {\r\n var subSystem = subEmitter.clone();\r\n particle._inheritParticleInfoToSubEmitter(subSystem);\r\n subSystem.particleSystem._rootParticleSystem = _this;\r\n _this.activeSubSystems.push(subSystem.particleSystem);\r\n subSystem.particleSystem.start();\r\n }\r\n });\r\n };\r\n _this._capacity = capacity;\r\n _this._epsilon = epsilon;\r\n _this._isAnimationSheetEnabled = isAnimationSheetEnabled;\r\n _this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_13__[\"EngineStore\"].LastCreatedScene;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this._customEffect = customEffect;\r\n _this._scene.particleSystems.push(_this);\r\n _this._useInstancing = _this._scene.getEngine().getCaps().instancedArrays;\r\n _this._createIndexBuffer();\r\n _this._createVertexBuffers();\r\n // Default emitter type\r\n _this.particleEmitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"BoxParticleEmitter\"]();\r\n // Update\r\n _this.updateFunction = function (particles) {\r\n var noiseTextureSize = null;\r\n var noiseTextureData = null;\r\n if (_this.noiseTexture) { // We need to get texture data back to CPU\r\n noiseTextureSize = _this.noiseTexture.getSize();\r\n noiseTextureData = (_this.noiseTexture.getContent());\r\n }\r\n var _loop_1 = function () {\r\n particle = particles[index];\r\n var scaledUpdateSpeed = _this._scaledUpdateSpeed;\r\n var previousAge = particle.age;\r\n particle.age += scaledUpdateSpeed;\r\n // Evaluate step to death\r\n if (particle.age > particle.lifeTime) {\r\n var diff = particle.age - previousAge;\r\n var oldDiff = particle.lifeTime - previousAge;\r\n scaledUpdateSpeed = (oldDiff * scaledUpdateSpeed) / diff;\r\n particle.age = particle.lifeTime;\r\n }\r\n var ratio = particle.age / particle.lifeTime;\r\n // Color\r\n if (_this._colorGradients && _this._colorGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._colorGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentColorGradient) {\r\n particle._currentColor1.copyFrom(particle._currentColor2);\r\n nextGradient.getColorToRef(particle._currentColor2);\r\n particle._currentColorGradient = currentGradient;\r\n }\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].LerpToRef(particle._currentColor1, particle._currentColor2, scale, particle.color);\r\n });\r\n }\r\n else {\r\n particle.colorStep.scaleToRef(scaledUpdateSpeed, _this._scaledColorStep);\r\n particle.color.addInPlace(_this._scaledColorStep);\r\n if (particle.color.a < 0) {\r\n particle.color.a = 0;\r\n }\r\n }\r\n // Angular speed\r\n if (_this._angularSpeedGradients && _this._angularSpeedGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._angularSpeedGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentAngularSpeedGradient) {\r\n particle._currentAngularSpeed1 = particle._currentAngularSpeed2;\r\n particle._currentAngularSpeed2 = nextGradient.getFactor();\r\n particle._currentAngularSpeedGradient = currentGradient;\r\n }\r\n particle.angularSpeed = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentAngularSpeed1, particle._currentAngularSpeed2, scale);\r\n });\r\n }\r\n particle.angle += particle.angularSpeed * scaledUpdateSpeed;\r\n // Direction\r\n var directionScale = scaledUpdateSpeed;\r\n /// Velocity\r\n if (_this._velocityGradients && _this._velocityGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._velocityGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentVelocityGradient) {\r\n particle._currentVelocity1 = particle._currentVelocity2;\r\n particle._currentVelocity2 = nextGradient.getFactor();\r\n particle._currentVelocityGradient = currentGradient;\r\n }\r\n directionScale *= _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentVelocity1, particle._currentVelocity2, scale);\r\n });\r\n }\r\n particle.direction.scaleToRef(directionScale, _this._scaledDirection);\r\n /// Limit velocity\r\n if (_this._limitVelocityGradients && _this._limitVelocityGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._limitVelocityGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentLimitVelocityGradient) {\r\n particle._currentLimitVelocity1 = particle._currentLimitVelocity2;\r\n particle._currentLimitVelocity2 = nextGradient.getFactor();\r\n particle._currentLimitVelocityGradient = currentGradient;\r\n }\r\n var limitVelocity = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentLimitVelocity1, particle._currentLimitVelocity2, scale);\r\n var currentVelocity = particle.direction.length();\r\n if (currentVelocity > limitVelocity) {\r\n particle.direction.scaleInPlace(_this.limitVelocityDamping);\r\n }\r\n });\r\n }\r\n /// Drag\r\n if (_this._dragGradients && _this._dragGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._dragGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentDragGradient) {\r\n particle._currentDrag1 = particle._currentDrag2;\r\n particle._currentDrag2 = nextGradient.getFactor();\r\n particle._currentDragGradient = currentGradient;\r\n }\r\n var drag = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentDrag1, particle._currentDrag2, scale);\r\n _this._scaledDirection.scaleInPlace(1.0 - drag);\r\n });\r\n }\r\n particle.position.addInPlace(_this._scaledDirection);\r\n // Noise\r\n if (noiseTextureData && noiseTextureSize && particle._randomNoiseCoordinates1) {\r\n var fetchedColorR = _this._fetchR(particle._randomNoiseCoordinates1.x, particle._randomNoiseCoordinates1.y, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);\r\n var fetchedColorG = _this._fetchR(particle._randomNoiseCoordinates1.z, particle._randomNoiseCoordinates2.x, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);\r\n var fetchedColorB = _this._fetchR(particle._randomNoiseCoordinates2.y, particle._randomNoiseCoordinates2.z, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);\r\n var force = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var scaledForce = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n force.copyFromFloats((2 * fetchedColorR - 1) * _this.noiseStrength.x, (2 * fetchedColorG - 1) * _this.noiseStrength.y, (2 * fetchedColorB - 1) * _this.noiseStrength.z);\r\n force.scaleToRef(scaledUpdateSpeed, scaledForce);\r\n particle.direction.addInPlace(scaledForce);\r\n }\r\n // Gravity\r\n _this.gravity.scaleToRef(scaledUpdateSpeed, _this._scaledGravity);\r\n particle.direction.addInPlace(_this._scaledGravity);\r\n // Size\r\n if (_this._sizeGradients && _this._sizeGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._sizeGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentSizeGradient) {\r\n particle._currentSize1 = particle._currentSize2;\r\n particle._currentSize2 = nextGradient.getFactor();\r\n particle._currentSizeGradient = currentGradient;\r\n }\r\n particle.size = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentSize1, particle._currentSize2, scale);\r\n });\r\n }\r\n // Remap data\r\n if (_this._useRampGradients) {\r\n if (_this._colorRemapGradients && _this._colorRemapGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._colorRemapGradients, function (currentGradient, nextGradient, scale) {\r\n var min = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor1, nextGradient.factor1, scale);\r\n var max = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor2, nextGradient.factor2, scale);\r\n particle.remapData.x = min;\r\n particle.remapData.y = max - min;\r\n });\r\n }\r\n if (_this._alphaRemapGradients && _this._alphaRemapGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._alphaRemapGradients, function (currentGradient, nextGradient, scale) {\r\n var min = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor1, nextGradient.factor1, scale);\r\n var max = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor2, nextGradient.factor2, scale);\r\n particle.remapData.z = min;\r\n particle.remapData.w = max - min;\r\n });\r\n }\r\n }\r\n if (_this._isAnimationSheetEnabled) {\r\n particle.updateCellIndex();\r\n }\r\n // Update the position of the attached sub-emitters to match their attached particle\r\n particle._inheritParticleInfoToSubEmitters();\r\n if (particle.age >= particle.lifeTime) { // Recycle by swapping with last particle\r\n _this._emitFromParticle(particle);\r\n if (particle._attachedSubEmitters) {\r\n particle._attachedSubEmitters.forEach(function (subEmitter) {\r\n subEmitter.particleSystem.disposeOnStop = true;\r\n subEmitter.particleSystem.stop();\r\n });\r\n particle._attachedSubEmitters = null;\r\n }\r\n _this.recycleParticle(particle);\r\n index--;\r\n return \"continue\";\r\n }\r\n };\r\n var particle;\r\n for (var index = 0; index < particles.length; index++) {\r\n _loop_1();\r\n }\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(ParticleSystem.prototype, \"onDispose\", {\r\n /**\r\n * Sets a callback that will be triggered when the system is disposed\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ParticleSystem.prototype, \"useRampGradients\", {\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see http://doc.babylonjs.com/babylon101/particles#ramp-gradients\r\n */\r\n get: function () {\r\n return this._useRampGradients;\r\n },\r\n set: function (value) {\r\n if (this._useRampGradients === value) {\r\n return;\r\n }\r\n this._useRampGradients = value;\r\n this._resetEffect();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ParticleSystem.prototype, \"particles\", {\r\n //end of Sub-emitter\r\n /**\r\n * Gets the current list of active particles\r\n */\r\n get: function () {\r\n return this._particles;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n ParticleSystem.prototype.getClassName = function () {\r\n return \"ParticleSystem\";\r\n };\r\n ParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor, factor2) {\r\n var newGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"FactorGradient\"]();\r\n newGradient.gradient = gradient;\r\n newGradient.factor1 = factor;\r\n newGradient.factor2 = factor2;\r\n factorGradients.push(newGradient);\r\n factorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n };\r\n ParticleSystem.prototype._removeFactorGradient = function (factorGradients, gradient) {\r\n if (!factorGradients) {\r\n return;\r\n }\r\n var index = 0;\r\n for (var _i = 0, factorGradients_1 = factorGradients; _i < factorGradients_1.length; _i++) {\r\n var factorGradient = factorGradients_1[_i];\r\n if (factorGradient.gradient === gradient) {\r\n factorGradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n };\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addLifeTimeGradient = function (gradient, factor, factor2) {\r\n if (!this._lifeTimeGradients) {\r\n this._lifeTimeGradients = [];\r\n }\r\n this._addFactorGradient(this._lifeTimeGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeLifeTimeGradient = function (gradient) {\r\n this._removeFactorGradient(this._lifeTimeGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addSizeGradient = function (gradient, factor, factor2) {\r\n if (!this._sizeGradients) {\r\n this._sizeGradients = [];\r\n }\r\n this._addFactorGradient(this._sizeGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeSizeGradient = function (gradient) {\r\n this._removeFactorGradient(this._sizeGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addColorRemapGradient = function (gradient, min, max) {\r\n if (!this._colorRemapGradients) {\r\n this._colorRemapGradients = [];\r\n }\r\n this._addFactorGradient(this._colorRemapGradients, gradient, min, max);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific color remap gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeColorRemapGradient = function (gradient) {\r\n this._removeFactorGradient(this._colorRemapGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addAlphaRemapGradient = function (gradient, min, max) {\r\n if (!this._alphaRemapGradients) {\r\n this._alphaRemapGradients = [];\r\n }\r\n this._addFactorGradient(this._alphaRemapGradients, gradient, min, max);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific alpha remap gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeAlphaRemapGradient = function (gradient) {\r\n this._removeFactorGradient(this._alphaRemapGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addAngularSpeedGradient = function (gradient, factor, factor2) {\r\n if (!this._angularSpeedGradients) {\r\n this._angularSpeedGradients = [];\r\n }\r\n this._addFactorGradient(this._angularSpeedGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeAngularSpeedGradient = function (gradient) {\r\n this._removeFactorGradient(this._angularSpeedGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addVelocityGradient = function (gradient, factor, factor2) {\r\n if (!this._velocityGradients) {\r\n this._velocityGradients = [];\r\n }\r\n this._addFactorGradient(this._velocityGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeVelocityGradient = function (gradient) {\r\n this._removeFactorGradient(this._velocityGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addLimitVelocityGradient = function (gradient, factor, factor2) {\r\n if (!this._limitVelocityGradients) {\r\n this._limitVelocityGradients = [];\r\n }\r\n this._addFactorGradient(this._limitVelocityGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeLimitVelocityGradient = function (gradient) {\r\n this._removeFactorGradient(this._limitVelocityGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addDragGradient = function (gradient, factor, factor2) {\r\n if (!this._dragGradients) {\r\n this._dragGradients = [];\r\n }\r\n this._addFactorGradient(this._dragGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeDragGradient = function (gradient) {\r\n this._removeFactorGradient(this._dragGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addEmitRateGradient = function (gradient, factor, factor2) {\r\n if (!this._emitRateGradients) {\r\n this._emitRateGradients = [];\r\n }\r\n this._addFactorGradient(this._emitRateGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeEmitRateGradient = function (gradient) {\r\n this._removeFactorGradient(this._emitRateGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addStartSizeGradient = function (gradient, factor, factor2) {\r\n if (!this._startSizeGradients) {\r\n this._startSizeGradients = [];\r\n }\r\n this._addFactorGradient(this._startSizeGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeStartSizeGradient = function (gradient) {\r\n this._removeFactorGradient(this._emitRateGradients, gradient);\r\n return this;\r\n };\r\n ParticleSystem.prototype._createRampGradientTexture = function () {\r\n if (!this._rampGradients || !this._rampGradients.length || this._rampGradientsTexture) {\r\n return;\r\n }\r\n var data = new Uint8Array(this._rawTextureWidth * 4);\r\n var tmpColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"TmpColors\"].Color3[0];\r\n for (var x = 0; x < this._rawTextureWidth; x++) {\r\n var ratio = x / this._rawTextureWidth;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this._rampGradients, function (currentGradient, nextGradient, scale) {\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color3\"].LerpToRef(currentGradient.color, nextGradient.color, scale, tmpColor);\r\n data[x * 4] = tmpColor.r * 255;\r\n data[x * 4 + 1] = tmpColor.g * 255;\r\n data[x * 4 + 2] = tmpColor.b * 255;\r\n data[x * 4 + 3] = 255;\r\n });\r\n }\r\n this._rampGradientsTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_11__[\"RawTexture\"].CreateRGBATexture(data, this._rawTextureWidth, 1, this._scene, false, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n };\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to udpate this list\r\n * @returns the list of ramp gradients\r\n */\r\n ParticleSystem.prototype.getRampGradients = function () {\r\n return this._rampGradients;\r\n };\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addRampGradient = function (gradient, color) {\r\n if (!this._rampGradients) {\r\n this._rampGradients = [];\r\n }\r\n var rampGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"Color3Gradient\"]();\r\n rampGradient.gradient = gradient;\r\n rampGradient.color = color;\r\n this._rampGradients.push(rampGradient);\r\n this._rampGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n if (this._rampGradientsTexture) {\r\n this._rampGradientsTexture.dispose();\r\n this._rampGradientsTexture = null;\r\n }\r\n this._createRampGradientTexture();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific ramp gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeRampGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._rampGradients, this._rampGradientsTexture);\r\n this._rampGradientsTexture = null;\r\n if (this._rampGradients && this._rampGradients.length > 0) {\r\n this._createRampGradientTexture();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns this particle system\r\n */\r\n ParticleSystem.prototype.addColorGradient = function (gradient, color1, color2) {\r\n if (!this._colorGradients) {\r\n this._colorGradients = [];\r\n }\r\n var colorGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"ColorGradient\"]();\r\n colorGradient.gradient = gradient;\r\n colorGradient.color1 = color1;\r\n colorGradient.color2 = color2;\r\n this._colorGradients.push(colorGradient);\r\n this._colorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n return this;\r\n };\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns this particle system\r\n */\r\n ParticleSystem.prototype.removeColorGradient = function (gradient) {\r\n if (!this._colorGradients) {\r\n return this;\r\n }\r\n var index = 0;\r\n for (var _i = 0, _a = this._colorGradients; _i < _a.length; _i++) {\r\n var colorGradient = _a[_i];\r\n if (colorGradient.gradient === gradient) {\r\n this._colorGradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n return this;\r\n };\r\n ParticleSystem.prototype._fetchR = function (u, v, width, height, pixels) {\r\n u = Math.abs(u) * 0.5 + 0.5;\r\n v = Math.abs(v) * 0.5 + 0.5;\r\n var wrappedU = ((u * width) % width) | 0;\r\n var wrappedV = ((v * height) % height) | 0;\r\n var position = (wrappedU + wrappedV * width) * 4;\r\n return pixels[position] / 255;\r\n };\r\n ParticleSystem.prototype._reset = function () {\r\n this._resetEffect();\r\n };\r\n ParticleSystem.prototype._resetEffect = function () {\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer.dispose();\r\n this._vertexBuffer = null;\r\n }\r\n if (this._spriteBuffer) {\r\n this._spriteBuffer.dispose();\r\n this._spriteBuffer = null;\r\n }\r\n this._createVertexBuffers();\r\n };\r\n ParticleSystem.prototype._createVertexBuffers = function () {\r\n this._vertexBufferSize = this._useInstancing ? 10 : 12;\r\n if (this._isAnimationSheetEnabled) {\r\n this._vertexBufferSize += 1;\r\n }\r\n if (!this._isBillboardBased || this.billboardMode === ParticleSystem.BILLBOARDMODE_STRETCHED) {\r\n this._vertexBufferSize += 3;\r\n }\r\n if (this._useRampGradients) {\r\n this._vertexBufferSize += 4;\r\n }\r\n var engine = this._scene.getEngine();\r\n this._vertexData = new Float32Array(this._capacity * this._vertexBufferSize * (this._useInstancing ? 1 : 4));\r\n this._vertexBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"Buffer\"](engine, this._vertexData, true, this._vertexBufferSize);\r\n var dataOffset = 0;\r\n var positions = this._vertexBuffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind, dataOffset, 3, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind] = positions;\r\n dataOffset += 3;\r\n var colors = this._vertexBuffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].ColorKind, dataOffset, 4, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].ColorKind] = colors;\r\n dataOffset += 4;\r\n var options = this._vertexBuffer.createVertexBuffer(\"angle\", dataOffset, 1, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"angle\"] = options;\r\n dataOffset += 1;\r\n var size = this._vertexBuffer.createVertexBuffer(\"size\", dataOffset, 2, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"size\"] = size;\r\n dataOffset += 2;\r\n if (this._isAnimationSheetEnabled) {\r\n var cellIndexBuffer = this._vertexBuffer.createVertexBuffer(\"cellIndex\", dataOffset, 1, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"cellIndex\"] = cellIndexBuffer;\r\n dataOffset += 1;\r\n }\r\n if (!this._isBillboardBased || this.billboardMode === ParticleSystem.BILLBOARDMODE_STRETCHED) {\r\n var directionBuffer = this._vertexBuffer.createVertexBuffer(\"direction\", dataOffset, 3, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"direction\"] = directionBuffer;\r\n dataOffset += 3;\r\n }\r\n if (this._useRampGradients) {\r\n var rampDataBuffer = this._vertexBuffer.createVertexBuffer(\"remapData\", dataOffset, 4, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"remapData\"] = rampDataBuffer;\r\n dataOffset += 4;\r\n }\r\n var offsets;\r\n if (this._useInstancing) {\r\n var spriteData = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);\r\n this._spriteBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"Buffer\"](engine, spriteData, false, 2);\r\n offsets = this._spriteBuffer.createVertexBuffer(\"offset\", 0, 2);\r\n }\r\n else {\r\n offsets = this._vertexBuffer.createVertexBuffer(\"offset\", dataOffset, 2, this._vertexBufferSize, this._useInstancing);\r\n dataOffset += 2;\r\n }\r\n this._vertexBuffers[\"offset\"] = offsets;\r\n };\r\n ParticleSystem.prototype._createIndexBuffer = function () {\r\n if (this._useInstancing) {\r\n return;\r\n }\r\n var indices = [];\r\n var index = 0;\r\n for (var count = 0; count < this._capacity; count++) {\r\n indices.push(index);\r\n indices.push(index + 1);\r\n indices.push(index + 2);\r\n indices.push(index);\r\n indices.push(index + 2);\r\n indices.push(index + 3);\r\n index += 4;\r\n }\r\n this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);\r\n };\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n ParticleSystem.prototype.getCapacity = function () {\r\n return this._capacity;\r\n };\r\n /**\r\n * Gets whether there are still active particles in the system.\r\n * @returns True if it is alive, otherwise false.\r\n */\r\n ParticleSystem.prototype.isAlive = function () {\r\n return this._alive;\r\n };\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n ParticleSystem.prototype.isStarted = function () {\r\n return this._started;\r\n };\r\n ParticleSystem.prototype._prepareSubEmitterInternalArray = function () {\r\n var _this = this;\r\n this._subEmitters = new Array();\r\n if (this.subEmitters) {\r\n this.subEmitters.forEach(function (subEmitter) {\r\n if (subEmitter instanceof ParticleSystem) {\r\n _this._subEmitters.push([new _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"](subEmitter)]);\r\n }\r\n else if (subEmitter instanceof _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"]) {\r\n _this._subEmitters.push([subEmitter]);\r\n }\r\n else if (subEmitter instanceof Array) {\r\n _this._subEmitters.push(subEmitter);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (this.startDelay by default)\r\n */\r\n ParticleSystem.prototype.start = function (delay) {\r\n var _this = this;\r\n if (delay === void 0) { delay = this.startDelay; }\r\n if (!this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) {\r\n throw \"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set\";\r\n }\r\n if (delay) {\r\n setTimeout(function () {\r\n _this.start(0);\r\n }, delay);\r\n return;\r\n }\r\n // Convert the subEmitters field to the constant type field _subEmitters\r\n this._prepareSubEmitterInternalArray();\r\n this._started = true;\r\n this._stopped = false;\r\n this._actualFrame = 0;\r\n if (this._subEmitters && this._subEmitters.length != 0) {\r\n this.activeSubSystems = new Array();\r\n }\r\n // Reset emit gradient so it acts the same on every start\r\n if (this._emitRateGradients) {\r\n if (this._emitRateGradients.length > 0) {\r\n this._currentEmitRateGradient = this._emitRateGradients[0];\r\n this._currentEmitRate1 = this._currentEmitRateGradient.getFactor();\r\n this._currentEmitRate2 = this._currentEmitRate1;\r\n }\r\n if (this._emitRateGradients.length > 1) {\r\n this._currentEmitRate2 = this._emitRateGradients[1].getFactor();\r\n }\r\n }\r\n // Reset start size gradient so it acts the same on every start\r\n if (this._startSizeGradients) {\r\n if (this._startSizeGradients.length > 0) {\r\n this._currentStartSizeGradient = this._startSizeGradients[0];\r\n this._currentStartSize1 = this._currentStartSizeGradient.getFactor();\r\n this._currentStartSize2 = this._currentStartSize1;\r\n }\r\n if (this._startSizeGradients.length > 1) {\r\n this._currentStartSize2 = this._startSizeGradients[1].getFactor();\r\n }\r\n }\r\n if (this.preWarmCycles) {\r\n if (this.emitter instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_6__[\"AbstractMesh\"]) {\r\n this.emitter.computeWorldMatrix(true);\r\n }\r\n var noiseTextureAsProcedural_1 = this.noiseTexture;\r\n if (noiseTextureAsProcedural_1 && noiseTextureAsProcedural_1.onGeneratedObservable) {\r\n noiseTextureAsProcedural_1.onGeneratedObservable.addOnce(function () {\r\n setTimeout(function () {\r\n for (var index = 0; index < _this.preWarmCycles; index++) {\r\n _this.animate(true);\r\n noiseTextureAsProcedural_1.render();\r\n }\r\n });\r\n });\r\n }\r\n else {\r\n for (var index = 0; index < this.preWarmCycles; index++) {\r\n this.animate(true);\r\n }\r\n }\r\n }\r\n // Animations\r\n if (this.beginAnimationOnStart && this.animations && this.animations.length > 0) {\r\n this.getScene().beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop);\r\n }\r\n };\r\n /**\r\n * Stops the particle system.\r\n * @param stopSubEmitters if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.\r\n */\r\n ParticleSystem.prototype.stop = function (stopSubEmitters) {\r\n if (stopSubEmitters === void 0) { stopSubEmitters = true; }\r\n this._stopped = true;\r\n if (stopSubEmitters) {\r\n this._stopSubEmitters();\r\n }\r\n };\r\n // animation sheet\r\n /**\r\n * Remove all active particles\r\n */\r\n ParticleSystem.prototype.reset = function () {\r\n this._stockParticles = [];\r\n this._particles = [];\r\n };\r\n /**\r\n * @hidden (for internal use only)\r\n */\r\n ParticleSystem.prototype._appendParticleVertex = function (index, particle, offsetX, offsetY) {\r\n var offset = index * this._vertexBufferSize;\r\n this._vertexData[offset++] = particle.position.x + this.worldOffset.x;\r\n this._vertexData[offset++] = particle.position.y + this.worldOffset.y;\r\n this._vertexData[offset++] = particle.position.z + this.worldOffset.z;\r\n this._vertexData[offset++] = particle.color.r;\r\n this._vertexData[offset++] = particle.color.g;\r\n this._vertexData[offset++] = particle.color.b;\r\n this._vertexData[offset++] = particle.color.a;\r\n this._vertexData[offset++] = particle.angle;\r\n this._vertexData[offset++] = particle.scale.x * particle.size;\r\n this._vertexData[offset++] = particle.scale.y * particle.size;\r\n if (this._isAnimationSheetEnabled) {\r\n this._vertexData[offset++] = particle.cellIndex;\r\n }\r\n if (!this._isBillboardBased) {\r\n if (particle._initialDirection) {\r\n this._vertexData[offset++] = particle._initialDirection.x;\r\n this._vertexData[offset++] = particle._initialDirection.y;\r\n this._vertexData[offset++] = particle._initialDirection.z;\r\n }\r\n else {\r\n this._vertexData[offset++] = particle.direction.x;\r\n this._vertexData[offset++] = particle.direction.y;\r\n this._vertexData[offset++] = particle.direction.z;\r\n }\r\n }\r\n else if (this.billboardMode === ParticleSystem.BILLBOARDMODE_STRETCHED) {\r\n this._vertexData[offset++] = particle.direction.x;\r\n this._vertexData[offset++] = particle.direction.y;\r\n this._vertexData[offset++] = particle.direction.z;\r\n }\r\n if (this._useRampGradients) {\r\n this._vertexData[offset++] = particle.remapData.x;\r\n this._vertexData[offset++] = particle.remapData.y;\r\n this._vertexData[offset++] = particle.remapData.z;\r\n this._vertexData[offset++] = particle.remapData.w;\r\n }\r\n if (!this._useInstancing) {\r\n if (this._isAnimationSheetEnabled) {\r\n if (offsetX === 0) {\r\n offsetX = this._epsilon;\r\n }\r\n else if (offsetX === 1) {\r\n offsetX = 1 - this._epsilon;\r\n }\r\n if (offsetY === 0) {\r\n offsetY = this._epsilon;\r\n }\r\n else if (offsetY === 1) {\r\n offsetY = 1 - this._epsilon;\r\n }\r\n }\r\n this._vertexData[offset++] = offsetX;\r\n this._vertexData[offset++] = offsetY;\r\n }\r\n };\r\n ParticleSystem.prototype._stopSubEmitters = function () {\r\n if (!this.activeSubSystems) {\r\n return;\r\n }\r\n this.activeSubSystems.forEach(function (subSystem) {\r\n subSystem.stop(true);\r\n });\r\n this.activeSubSystems = new Array();\r\n };\r\n ParticleSystem.prototype._removeFromRoot = function () {\r\n if (!this._rootParticleSystem) {\r\n return;\r\n }\r\n var index = this._rootParticleSystem.activeSubSystems.indexOf(this);\r\n if (index !== -1) {\r\n this._rootParticleSystem.activeSubSystems.splice(index, 1);\r\n }\r\n this._rootParticleSystem = null;\r\n };\r\n // End of sub system methods\r\n ParticleSystem.prototype._update = function (newParticles) {\r\n var _this = this;\r\n // Update current\r\n this._alive = this._particles.length > 0;\r\n if (this.emitter.position) {\r\n var emitterMesh = this.emitter;\r\n this._emitterWorldMatrix = emitterMesh.getWorldMatrix();\r\n }\r\n else {\r\n var emitterPosition = this.emitter;\r\n this._emitterWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Translation(emitterPosition.x, emitterPosition.y, emitterPosition.z);\r\n }\r\n this.updateFunction(this._particles);\r\n // Add new ones\r\n var particle;\r\n var _loop_2 = function () {\r\n if (this_1._particles.length === this_1._capacity) {\r\n return \"break\";\r\n }\r\n particle = this_1._createParticle();\r\n this_1._particles.push(particle);\r\n // Emitter\r\n var emitPower = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minEmitPower, this_1.maxEmitPower);\r\n if (this_1.startPositionFunction) {\r\n this_1.startPositionFunction(this_1._emitterWorldMatrix, particle.position, particle);\r\n }\r\n else {\r\n this_1.particleEmitterType.startPositionFunction(this_1._emitterWorldMatrix, particle.position, particle);\r\n }\r\n if (this_1.startDirectionFunction) {\r\n this_1.startDirectionFunction(this_1._emitterWorldMatrix, particle.direction, particle);\r\n }\r\n else {\r\n this_1.particleEmitterType.startDirectionFunction(this_1._emitterWorldMatrix, particle.direction, particle);\r\n }\r\n if (emitPower === 0) {\r\n if (!particle._initialDirection) {\r\n particle._initialDirection = particle.direction.clone();\r\n }\r\n else {\r\n particle._initialDirection.copyFrom(particle.direction);\r\n }\r\n }\r\n else {\r\n particle._initialDirection = null;\r\n }\r\n particle.direction.scaleInPlace(emitPower);\r\n // Life time\r\n if (this_1.targetStopDuration && this_1._lifeTimeGradients && this_1._lifeTimeGradients.length > 0) {\r\n var ratio_1 = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Clamp(this_1._actualFrame / this_1.targetStopDuration);\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio_1, this_1._lifeTimeGradients, function (currentGradient, nextGradient) {\r\n var factorGradient1 = currentGradient;\r\n var factorGradient2 = nextGradient;\r\n var lifeTime1 = factorGradient1.getFactor();\r\n var lifeTime2 = factorGradient2.getFactor();\r\n var gradient = (ratio_1 - factorGradient1.gradient) / (factorGradient2.gradient - factorGradient1.gradient);\r\n particle.lifeTime = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(lifeTime1, lifeTime2, gradient);\r\n });\r\n }\r\n else {\r\n particle.lifeTime = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minLifeTime, this_1.maxLifeTime);\r\n }\r\n // Size\r\n if (!this_1._sizeGradients || this_1._sizeGradients.length === 0) {\r\n particle.size = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minSize, this_1.maxSize);\r\n }\r\n else {\r\n particle._currentSizeGradient = this_1._sizeGradients[0];\r\n particle._currentSize1 = particle._currentSizeGradient.getFactor();\r\n particle.size = particle._currentSize1;\r\n if (this_1._sizeGradients.length > 1) {\r\n particle._currentSize2 = this_1._sizeGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentSize2 = particle._currentSize1;\r\n }\r\n }\r\n // Size and scale\r\n particle.scale.copyFromFloats(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minScaleX, this_1.maxScaleX), _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minScaleY, this_1.maxScaleY));\r\n // Adjust scale by start size\r\n if (this_1._startSizeGradients && this_1._startSizeGradients[0] && this_1.targetStopDuration) {\r\n var ratio = this_1._actualFrame / this_1.targetStopDuration;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this_1._startSizeGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== _this._currentStartSizeGradient) {\r\n _this._currentStartSize1 = _this._currentStartSize2;\r\n _this._currentStartSize2 = nextGradient.getFactor();\r\n _this._currentStartSizeGradient = currentGradient;\r\n }\r\n var value = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(_this._currentStartSize1, _this._currentStartSize2, scale);\r\n particle.scale.scaleInPlace(value);\r\n });\r\n }\r\n // Angle\r\n if (!this_1._angularSpeedGradients || this_1._angularSpeedGradients.length === 0) {\r\n particle.angularSpeed = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minAngularSpeed, this_1.maxAngularSpeed);\r\n }\r\n else {\r\n particle._currentAngularSpeedGradient = this_1._angularSpeedGradients[0];\r\n particle.angularSpeed = particle._currentAngularSpeedGradient.getFactor();\r\n particle._currentAngularSpeed1 = particle.angularSpeed;\r\n if (this_1._angularSpeedGradients.length > 1) {\r\n particle._currentAngularSpeed2 = this_1._angularSpeedGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentAngularSpeed2 = particle._currentAngularSpeed1;\r\n }\r\n }\r\n particle.angle = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minInitialRotation, this_1.maxInitialRotation);\r\n // Velocity\r\n if (this_1._velocityGradients && this_1._velocityGradients.length > 0) {\r\n particle._currentVelocityGradient = this_1._velocityGradients[0];\r\n particle._currentVelocity1 = particle._currentVelocityGradient.getFactor();\r\n if (this_1._velocityGradients.length > 1) {\r\n particle._currentVelocity2 = this_1._velocityGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentVelocity2 = particle._currentVelocity1;\r\n }\r\n }\r\n // Limit velocity\r\n if (this_1._limitVelocityGradients && this_1._limitVelocityGradients.length > 0) {\r\n particle._currentLimitVelocityGradient = this_1._limitVelocityGradients[0];\r\n particle._currentLimitVelocity1 = particle._currentLimitVelocityGradient.getFactor();\r\n if (this_1._limitVelocityGradients.length > 1) {\r\n particle._currentLimitVelocity2 = this_1._limitVelocityGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentLimitVelocity2 = particle._currentLimitVelocity1;\r\n }\r\n }\r\n // Drag\r\n if (this_1._dragGradients && this_1._dragGradients.length > 0) {\r\n particle._currentDragGradient = this_1._dragGradients[0];\r\n particle._currentDrag1 = particle._currentDragGradient.getFactor();\r\n if (this_1._dragGradients.length > 1) {\r\n particle._currentDrag2 = this_1._dragGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentDrag2 = particle._currentDrag1;\r\n }\r\n }\r\n // Color\r\n if (!this_1._colorGradients || this_1._colorGradients.length === 0) {\r\n step = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(0, 1.0);\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].LerpToRef(this_1.color1, this_1.color2, step, particle.color);\r\n this_1.colorDead.subtractToRef(particle.color, this_1._colorDiff);\r\n this_1._colorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);\r\n }\r\n else {\r\n particle._currentColorGradient = this_1._colorGradients[0];\r\n particle._currentColorGradient.getColorToRef(particle.color);\r\n particle._currentColor1.copyFrom(particle.color);\r\n if (this_1._colorGradients.length > 1) {\r\n this_1._colorGradients[1].getColorToRef(particle._currentColor2);\r\n }\r\n else {\r\n particle._currentColor2.copyFrom(particle.color);\r\n }\r\n }\r\n // Sheet\r\n if (this_1._isAnimationSheetEnabled) {\r\n particle._initialStartSpriteCellID = this_1.startSpriteCellID;\r\n particle._initialEndSpriteCellID = this_1.endSpriteCellID;\r\n }\r\n // Inherited Velocity\r\n particle.direction.addInPlace(this_1._inheritedVelocityOffset);\r\n // Ramp\r\n if (this_1._useRampGradients) {\r\n particle.remapData = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector4\"](0, 1, 0, 1);\r\n }\r\n // Noise texture coordinates\r\n if (this_1.noiseTexture) {\r\n if (particle._randomNoiseCoordinates1) {\r\n particle._randomNoiseCoordinates1.copyFromFloats(Math.random(), Math.random(), Math.random());\r\n particle._randomNoiseCoordinates2.copyFromFloats(Math.random(), Math.random(), Math.random());\r\n }\r\n else {\r\n particle._randomNoiseCoordinates1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Math.random(), Math.random(), Math.random());\r\n particle._randomNoiseCoordinates2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Math.random(), Math.random(), Math.random());\r\n }\r\n }\r\n // Update the position of the attached sub-emitters to match their attached particle\r\n particle._inheritParticleInfoToSubEmitters();\r\n };\r\n var this_1 = this, step;\r\n for (var index = 0; index < newParticles; index++) {\r\n var state_1 = _loop_2();\r\n if (state_1 === \"break\")\r\n break;\r\n }\r\n };\r\n /** @hidden */\r\n ParticleSystem._GetAttributeNamesOrOptions = function (isAnimationSheetEnabled, isBillboardBased, useRampGradients) {\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n if (isBillboardBased === void 0) { isBillboardBased = false; }\r\n if (useRampGradients === void 0) { useRampGradients = false; }\r\n var attributeNamesOrOptions = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].ColorKind, \"angle\", \"offset\", \"size\"];\r\n if (isAnimationSheetEnabled) {\r\n attributeNamesOrOptions.push(\"cellIndex\");\r\n }\r\n if (!isBillboardBased) {\r\n attributeNamesOrOptions.push(\"direction\");\r\n }\r\n if (useRampGradients) {\r\n attributeNamesOrOptions.push(\"remapData\");\r\n }\r\n return attributeNamesOrOptions;\r\n };\r\n /** @hidden */\r\n ParticleSystem._GetEffectCreationOptions = function (isAnimationSheetEnabled) {\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n var effectCreationOption = [\"invView\", \"view\", \"projection\", \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"textureMask\", \"translationPivot\", \"eyePosition\"];\r\n if (isAnimationSheetEnabled) {\r\n effectCreationOption.push(\"particlesInfos\");\r\n }\r\n return effectCreationOption;\r\n };\r\n /** @hidden */\r\n ParticleSystem.prototype._getEffect = function (blendMode) {\r\n if (this._customEffect) {\r\n return this._customEffect;\r\n }\r\n var defines = [];\r\n if (this._scene.clipPlane) {\r\n defines.push(\"#define CLIPPLANE\");\r\n }\r\n if (this._scene.clipPlane2) {\r\n defines.push(\"#define CLIPPLANE2\");\r\n }\r\n if (this._scene.clipPlane3) {\r\n defines.push(\"#define CLIPPLANE3\");\r\n }\r\n if (this._scene.clipPlane4) {\r\n defines.push(\"#define CLIPPLANE4\");\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n defines.push(\"#define ANIMATESHEET\");\r\n }\r\n if (blendMode === ParticleSystem.BLENDMODE_MULTIPLY) {\r\n defines.push(\"#define BLENDMULTIPLYMODE\");\r\n }\r\n if (this._useRampGradients) {\r\n defines.push(\"#define RAMPGRADIENT\");\r\n }\r\n if (this._isBillboardBased) {\r\n defines.push(\"#define BILLBOARD\");\r\n switch (this.billboardMode) {\r\n case ParticleSystem.BILLBOARDMODE_Y:\r\n defines.push(\"#define BILLBOARDY\");\r\n break;\r\n case ParticleSystem.BILLBOARDMODE_STRETCHED:\r\n defines.push(\"#define BILLBOARDSTRETCHED\");\r\n break;\r\n case ParticleSystem.BILLBOARDMODE_ALL:\r\n default:\r\n break;\r\n }\r\n }\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines);\r\n defines.push(this._imageProcessingConfigurationDefines.toString());\r\n }\r\n // Effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n var attributesNamesOrOptions = ParticleSystem._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled, this._isBillboardBased && this.billboardMode !== ParticleSystem.BILLBOARDMODE_STRETCHED, this._useRampGradients);\r\n var effectCreationOption = ParticleSystem._GetEffectCreationOptions(this._isAnimationSheetEnabled);\r\n var samplers = [\"diffuseSampler\", \"rampSampler\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"ImageProcessingConfiguration\"].PrepareUniforms(effectCreationOption, this._imageProcessingConfigurationDefines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, this._imageProcessingConfigurationDefines);\r\n }\r\n this._effect = this._scene.getEngine().createEffect(\"particles\", attributesNamesOrOptions, effectCreationOption, samplers, join);\r\n }\r\n return this._effect;\r\n };\r\n /**\r\n * Animates the particle system for the current frame by emitting new particles and or animating the living ones.\r\n * @param preWarmOnly will prevent the system from updating the vertex buffer (default is false)\r\n */\r\n ParticleSystem.prototype.animate = function (preWarmOnly) {\r\n var _this = this;\r\n if (preWarmOnly === void 0) { preWarmOnly = false; }\r\n if (!this._started) {\r\n return;\r\n }\r\n if (!preWarmOnly) {\r\n // Check\r\n if (!this.isReady()) {\r\n return;\r\n }\r\n if (this._currentRenderId === this._scene.getFrameId()) {\r\n return;\r\n }\r\n this._currentRenderId = this._scene.getFrameId();\r\n }\r\n this._scaledUpdateSpeed = this.updateSpeed * (preWarmOnly ? this.preWarmStepOffset : this._scene.getAnimationRatio());\r\n // Determine the number of particles we need to create\r\n var newParticles;\r\n if (this.manualEmitCount > -1) {\r\n newParticles = this.manualEmitCount;\r\n this._newPartsExcess = 0;\r\n this.manualEmitCount = 0;\r\n }\r\n else {\r\n var rate_1 = this.emitRate;\r\n if (this._emitRateGradients && this._emitRateGradients.length > 0 && this.targetStopDuration) {\r\n var ratio = this._actualFrame / this.targetStopDuration;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this._emitRateGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== _this._currentEmitRateGradient) {\r\n _this._currentEmitRate1 = _this._currentEmitRate2;\r\n _this._currentEmitRate2 = nextGradient.getFactor();\r\n _this._currentEmitRateGradient = currentGradient;\r\n }\r\n rate_1 = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(_this._currentEmitRate1, _this._currentEmitRate2, scale);\r\n });\r\n }\r\n newParticles = ((rate_1 * this._scaledUpdateSpeed) >> 0);\r\n this._newPartsExcess += rate_1 * this._scaledUpdateSpeed - newParticles;\r\n }\r\n if (this._newPartsExcess > 1.0) {\r\n newParticles += this._newPartsExcess >> 0;\r\n this._newPartsExcess -= this._newPartsExcess >> 0;\r\n }\r\n this._alive = false;\r\n if (!this._stopped) {\r\n this._actualFrame += this._scaledUpdateSpeed;\r\n if (this.targetStopDuration && this._actualFrame >= this.targetStopDuration) {\r\n this.stop();\r\n }\r\n }\r\n else {\r\n newParticles = 0;\r\n }\r\n this._update(newParticles);\r\n // Stopped?\r\n if (this._stopped) {\r\n if (!this._alive) {\r\n this._started = false;\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n if (this.disposeOnStop) {\r\n this._scene._toBeDisposed.push(this);\r\n }\r\n }\r\n }\r\n if (!preWarmOnly) {\r\n // Update VBO\r\n var offset = 0;\r\n for (var index = 0; index < this._particles.length; index++) {\r\n var particle = this._particles[index];\r\n this._appendParticleVertices(offset, particle);\r\n offset += this._useInstancing ? 1 : 4;\r\n }\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer.update(this._vertexData);\r\n }\r\n }\r\n if (this.manualEmitCount === 0 && this.disposeOnStop) {\r\n this.stop();\r\n }\r\n };\r\n ParticleSystem.prototype._appendParticleVertices = function (offset, particle) {\r\n this._appendParticleVertex(offset++, particle, 0, 0);\r\n if (!this._useInstancing) {\r\n this._appendParticleVertex(offset++, particle, 1, 0);\r\n this._appendParticleVertex(offset++, particle, 1, 1);\r\n this._appendParticleVertex(offset++, particle, 0, 1);\r\n }\r\n };\r\n /**\r\n * Rebuilds the particle system.\r\n */\r\n ParticleSystem.prototype.rebuild = function () {\r\n this._createIndexBuffer();\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer._rebuild();\r\n }\r\n for (var key in this._vertexBuffers) {\r\n this._vertexBuffers[key]._rebuild();\r\n }\r\n };\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @return true if the system is ready\r\n */\r\n ParticleSystem.prototype.isReady = function () {\r\n if (!this.emitter || !this._imageProcessingConfiguration.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {\r\n return false;\r\n }\r\n if (this.blendMode !== ParticleSystem.BLENDMODE_MULTIPLYADD) {\r\n if (!this._getEffect(this.blendMode).isReady()) {\r\n return false;\r\n }\r\n }\r\n else {\r\n if (!this._getEffect(ParticleSystem.BLENDMODE_MULTIPLY).isReady()) {\r\n return false;\r\n }\r\n if (!this._getEffect(ParticleSystem.BLENDMODE_ADD).isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n ParticleSystem.prototype._render = function (blendMode) {\r\n var effect = this._getEffect(blendMode);\r\n var engine = this._scene.getEngine();\r\n // Render\r\n engine.enableEffect(effect);\r\n var viewMatrix = this._scene.getViewMatrix();\r\n effect.setTexture(\"diffuseSampler\", this.particleTexture);\r\n effect.setMatrix(\"view\", viewMatrix);\r\n effect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\r\n if (this._isAnimationSheetEnabled && this.particleTexture) {\r\n var baseSize = this.particleTexture.getBaseSize();\r\n effect.setFloat3(\"particlesInfos\", this.spriteCellWidth / baseSize.width, this.spriteCellHeight / baseSize.height, baseSize.width / this.spriteCellWidth);\r\n }\r\n effect.setVector2(\"translationPivot\", this.translationPivot);\r\n effect.setFloat4(\"textureMask\", this.textureMask.r, this.textureMask.g, this.textureMask.b, this.textureMask.a);\r\n if (this._isBillboardBased) {\r\n var camera = this._scene.activeCamera;\r\n effect.setVector3(\"eyePosition\", camera.globalPosition);\r\n }\r\n if (this._rampGradientsTexture) {\r\n effect.setTexture(\"rampSampler\", this._rampGradientsTexture);\r\n }\r\n if (this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4) {\r\n var invView = viewMatrix.clone();\r\n invView.invert();\r\n effect.setMatrix(\"invView\", invView);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__[\"MaterialHelper\"].BindClipPlane(effect, this._scene);\r\n }\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(effect);\r\n }\r\n // Draw order\r\n switch (blendMode) {\r\n case ParticleSystem.BLENDMODE_ADD:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_ADD);\r\n break;\r\n case ParticleSystem.BLENDMODE_ONEONE:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_ONEONE);\r\n break;\r\n case ParticleSystem.BLENDMODE_STANDARD:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_COMBINE);\r\n break;\r\n case ParticleSystem.BLENDMODE_MULTIPLY:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_MULTIPLY);\r\n break;\r\n }\r\n if (this._useInstancing) {\r\n engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFanDrawMode, 0, 4, this._particles.length);\r\n }\r\n else {\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, this._particles.length * 6);\r\n }\r\n return this._particles.length;\r\n };\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n ParticleSystem.prototype.render = function () {\r\n // Check\r\n if (!this.isReady() || !this._particles.length) {\r\n return 0;\r\n }\r\n var engine = this._scene.getEngine();\r\n engine.setState(false);\r\n if (this.forceDepthWrite) {\r\n engine.setDepthWrite(true);\r\n }\r\n var outparticles = 0;\r\n if (this.blendMode === ParticleSystem.BLENDMODE_MULTIPLYADD) {\r\n outparticles = this._render(ParticleSystem.BLENDMODE_MULTIPLY) + this._render(ParticleSystem.BLENDMODE_ADD);\r\n }\r\n outparticles = this._render(this.blendMode);\r\n engine.unbindInstanceAttributes();\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_DISABLE);\r\n return outparticles;\r\n };\r\n /**\r\n * Disposes the particle system and free the associated resources\r\n * @param disposeTexture defines if the particule texture must be disposed as well (true by default)\r\n */\r\n ParticleSystem.prototype.dispose = function (disposeTexture) {\r\n if (disposeTexture === void 0) { disposeTexture = true; }\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer.dispose();\r\n this._vertexBuffer = null;\r\n }\r\n if (this._spriteBuffer) {\r\n this._spriteBuffer.dispose();\r\n this._spriteBuffer = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (disposeTexture && this.particleTexture) {\r\n this.particleTexture.dispose();\r\n this.particleTexture = null;\r\n }\r\n if (disposeTexture && this.noiseTexture) {\r\n this.noiseTexture.dispose();\r\n this.noiseTexture = null;\r\n }\r\n if (this._rampGradientsTexture) {\r\n this._rampGradientsTexture.dispose();\r\n this._rampGradientsTexture = null;\r\n }\r\n this._removeFromRoot();\r\n if (this._subEmitters && this._subEmitters.length) {\r\n for (var index = 0; index < this._subEmitters.length; index++) {\r\n for (var _i = 0, _a = this._subEmitters[index]; _i < _a.length; _i++) {\r\n var subEmitter = _a[_i];\r\n subEmitter.dispose();\r\n }\r\n }\r\n this._subEmitters = [];\r\n this.subEmitters = [];\r\n }\r\n if (this._disposeEmitterOnDispose && this.emitter && this.emitter.dispose) {\r\n this.emitter.dispose(true);\r\n }\r\n // Remove from scene\r\n var index = this._scene.particleSystems.indexOf(this);\r\n if (index > -1) {\r\n this._scene.particleSystems.splice(index, 1);\r\n }\r\n this._scene._activeParticleSystems.dispose();\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.reset();\r\n };\r\n // Clone\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n ParticleSystem.prototype.clone = function (name, newEmitter) {\r\n var custom = null;\r\n var program = null;\r\n if (this.customShader != null) {\r\n program = this.customShader;\r\n var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join(\"\\n\") : \"\";\r\n custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);\r\n }\r\n else if (this._customEffect) {\r\n custom = this._customEffect;\r\n }\r\n var result = new ParticleSystem(name, this._capacity, this._scene, custom);\r\n result.customShader = program;\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_20__[\"DeepCopier\"].DeepCopy(this, result, [\"particles\", \"customShader\", \"noiseTexture\", \"particleTexture\", \"onDisposeObservable\"]);\r\n if (newEmitter === undefined) {\r\n newEmitter = this.emitter;\r\n }\r\n result.noiseTexture = this.noiseTexture;\r\n result.emitter = newEmitter;\r\n if (this.particleTexture) {\r\n result.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"](this.particleTexture.url, this._scene);\r\n }\r\n // Clone gradients\r\n if (this._colorGradients) {\r\n this._colorGradients.forEach(function (v) {\r\n result.addColorGradient(v.gradient, v.color1, v.color2);\r\n });\r\n }\r\n if (this._dragGradients) {\r\n this._dragGradients.forEach(function (v) {\r\n result.addDragGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._angularSpeedGradients) {\r\n this._angularSpeedGradients.forEach(function (v) {\r\n result.addAngularSpeedGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._emitRateGradients) {\r\n this._emitRateGradients.forEach(function (v) {\r\n result.addEmitRateGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._lifeTimeGradients) {\r\n this._lifeTimeGradients.forEach(function (v) {\r\n result.addLifeTimeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._limitVelocityGradients) {\r\n this._limitVelocityGradients.forEach(function (v) {\r\n result.addLimitVelocityGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._sizeGradients) {\r\n this._sizeGradients.forEach(function (v) {\r\n result.addSizeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._startSizeGradients) {\r\n this._startSizeGradients.forEach(function (v) {\r\n result.addStartSizeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._velocityGradients) {\r\n this._velocityGradients.forEach(function (v) {\r\n result.addVelocityGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._rampGradients) {\r\n this._rampGradients.forEach(function (v) {\r\n result.addRampGradient(v.gradient, v.color);\r\n });\r\n }\r\n if (this._colorRemapGradients) {\r\n this._colorRemapGradients.forEach(function (v) {\r\n result.addColorRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._alphaRemapGradients) {\r\n this._alphaRemapGradients.forEach(function (v) {\r\n result.addAlphaRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (!this.preventAutoStart) {\r\n result.start();\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n ParticleSystem.prototype.serialize = function () {\r\n var serializationObject = {};\r\n ParticleSystem._Serialize(serializationObject, this);\r\n serializationObject.textureMask = this.textureMask.asArray();\r\n serializationObject.customShader = this.customShader;\r\n serializationObject.preventAutoStart = this.preventAutoStart;\r\n // SubEmitters\r\n if (this.subEmitters) {\r\n serializationObject.subEmitters = [];\r\n if (!this._subEmitters) {\r\n this._prepareSubEmitterInternalArray();\r\n }\r\n for (var _i = 0, _a = this._subEmitters; _i < _a.length; _i++) {\r\n var subs = _a[_i];\r\n var cell = [];\r\n for (var _b = 0, subs_1 = subs; _b < subs_1.length; _b++) {\r\n var sub = subs_1[_b];\r\n cell.push(sub.serialize());\r\n }\r\n serializationObject.subEmitters.push(cell);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n ParticleSystem._Serialize = function (serializationObject, particleSystem) {\r\n serializationObject.name = particleSystem.name;\r\n serializationObject.id = particleSystem.id;\r\n serializationObject.capacity = particleSystem.getCapacity();\r\n // Emitter\r\n if (particleSystem.emitter.position) {\r\n var emitterMesh = particleSystem.emitter;\r\n serializationObject.emitterId = emitterMesh.id;\r\n }\r\n else {\r\n var emitterPosition = particleSystem.emitter;\r\n serializationObject.emitter = emitterPosition.asArray();\r\n }\r\n // Emitter\r\n if (particleSystem.particleEmitterType) {\r\n serializationObject.particleEmitterType = particleSystem.particleEmitterType.serialize();\r\n }\r\n if (particleSystem.particleTexture) {\r\n serializationObject.textureName = particleSystem.particleTexture.name;\r\n serializationObject.invertY = particleSystem.particleTexture._invertY;\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_19__[\"SerializationHelper\"].AppendSerializedAnimations(particleSystem, serializationObject);\r\n serializationObject.beginAnimationOnStart = particleSystem.beginAnimationOnStart;\r\n serializationObject.beginAnimationFrom = particleSystem.beginAnimationFrom;\r\n serializationObject.beginAnimationTo = particleSystem.beginAnimationTo;\r\n serializationObject.beginAnimationLoop = particleSystem.beginAnimationLoop;\r\n // Particle system\r\n serializationObject.startDelay = particleSystem.startDelay;\r\n serializationObject.renderingGroupId = particleSystem.renderingGroupId;\r\n serializationObject.isBillboardBased = particleSystem.isBillboardBased;\r\n serializationObject.billboardMode = particleSystem.billboardMode;\r\n serializationObject.minAngularSpeed = particleSystem.minAngularSpeed;\r\n serializationObject.maxAngularSpeed = particleSystem.maxAngularSpeed;\r\n serializationObject.minSize = particleSystem.minSize;\r\n serializationObject.maxSize = particleSystem.maxSize;\r\n serializationObject.minScaleX = particleSystem.minScaleX;\r\n serializationObject.maxScaleX = particleSystem.maxScaleX;\r\n serializationObject.minScaleY = particleSystem.minScaleY;\r\n serializationObject.maxScaleY = particleSystem.maxScaleY;\r\n serializationObject.minEmitPower = particleSystem.minEmitPower;\r\n serializationObject.maxEmitPower = particleSystem.maxEmitPower;\r\n serializationObject.minLifeTime = particleSystem.minLifeTime;\r\n serializationObject.maxLifeTime = particleSystem.maxLifeTime;\r\n serializationObject.emitRate = particleSystem.emitRate;\r\n serializationObject.gravity = particleSystem.gravity.asArray();\r\n serializationObject.noiseStrength = particleSystem.noiseStrength.asArray();\r\n serializationObject.color1 = particleSystem.color1.asArray();\r\n serializationObject.color2 = particleSystem.color2.asArray();\r\n serializationObject.colorDead = particleSystem.colorDead.asArray();\r\n serializationObject.updateSpeed = particleSystem.updateSpeed;\r\n serializationObject.targetStopDuration = particleSystem.targetStopDuration;\r\n serializationObject.blendMode = particleSystem.blendMode;\r\n serializationObject.preWarmCycles = particleSystem.preWarmCycles;\r\n serializationObject.preWarmStepOffset = particleSystem.preWarmStepOffset;\r\n serializationObject.minInitialRotation = particleSystem.minInitialRotation;\r\n serializationObject.maxInitialRotation = particleSystem.maxInitialRotation;\r\n serializationObject.startSpriteCellID = particleSystem.startSpriteCellID;\r\n serializationObject.endSpriteCellID = particleSystem.endSpriteCellID;\r\n serializationObject.spriteCellChangeSpeed = particleSystem.spriteCellChangeSpeed;\r\n serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;\r\n serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;\r\n serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;\r\n serializationObject.isAnimationSheetEnabled = particleSystem.isAnimationSheetEnabled;\r\n var colorGradients = particleSystem.getColorGradients();\r\n if (colorGradients) {\r\n serializationObject.colorGradients = [];\r\n for (var _i = 0, colorGradients_1 = colorGradients; _i < colorGradients_1.length; _i++) {\r\n var colorGradient = colorGradients_1[_i];\r\n var serializedGradient = {\r\n gradient: colorGradient.gradient,\r\n color1: colorGradient.color1.asArray()\r\n };\r\n if (colorGradient.color2) {\r\n serializedGradient.color2 = colorGradient.color2.asArray();\r\n }\r\n serializationObject.colorGradients.push(serializedGradient);\r\n }\r\n }\r\n var rampGradients = particleSystem.getRampGradients();\r\n if (rampGradients) {\r\n serializationObject.rampGradients = [];\r\n for (var _a = 0, rampGradients_1 = rampGradients; _a < rampGradients_1.length; _a++) {\r\n var rampGradient = rampGradients_1[_a];\r\n var serializedGradient = {\r\n gradient: rampGradient.gradient,\r\n color: rampGradient.color.asArray()\r\n };\r\n serializationObject.rampGradients.push(serializedGradient);\r\n }\r\n serializationObject.useRampGradients = particleSystem.useRampGradients;\r\n }\r\n var colorRemapGradients = particleSystem.getColorRemapGradients();\r\n if (colorRemapGradients) {\r\n serializationObject.colorRemapGradients = [];\r\n for (var _b = 0, colorRemapGradients_1 = colorRemapGradients; _b < colorRemapGradients_1.length; _b++) {\r\n var colorRemapGradient = colorRemapGradients_1[_b];\r\n var serializedGradient = {\r\n gradient: colorRemapGradient.gradient,\r\n factor1: colorRemapGradient.factor1\r\n };\r\n if (colorRemapGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = colorRemapGradient.factor2;\r\n }\r\n serializationObject.colorRemapGradients.push(serializedGradient);\r\n }\r\n }\r\n var alphaRemapGradients = particleSystem.getAlphaRemapGradients();\r\n if (alphaRemapGradients) {\r\n serializationObject.alphaRemapGradients = [];\r\n for (var _c = 0, alphaRemapGradients_1 = alphaRemapGradients; _c < alphaRemapGradients_1.length; _c++) {\r\n var alphaRemapGradient = alphaRemapGradients_1[_c];\r\n var serializedGradient = {\r\n gradient: alphaRemapGradient.gradient,\r\n factor1: alphaRemapGradient.factor1\r\n };\r\n if (alphaRemapGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = alphaRemapGradient.factor2;\r\n }\r\n serializationObject.alphaRemapGradients.push(serializedGradient);\r\n }\r\n }\r\n var sizeGradients = particleSystem.getSizeGradients();\r\n if (sizeGradients) {\r\n serializationObject.sizeGradients = [];\r\n for (var _d = 0, sizeGradients_1 = sizeGradients; _d < sizeGradients_1.length; _d++) {\r\n var sizeGradient = sizeGradients_1[_d];\r\n var serializedGradient = {\r\n gradient: sizeGradient.gradient,\r\n factor1: sizeGradient.factor1\r\n };\r\n if (sizeGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = sizeGradient.factor2;\r\n }\r\n serializationObject.sizeGradients.push(serializedGradient);\r\n }\r\n }\r\n var angularSpeedGradients = particleSystem.getAngularSpeedGradients();\r\n if (angularSpeedGradients) {\r\n serializationObject.angularSpeedGradients = [];\r\n for (var _e = 0, angularSpeedGradients_1 = angularSpeedGradients; _e < angularSpeedGradients_1.length; _e++) {\r\n var angularSpeedGradient = angularSpeedGradients_1[_e];\r\n var serializedGradient = {\r\n gradient: angularSpeedGradient.gradient,\r\n factor1: angularSpeedGradient.factor1\r\n };\r\n if (angularSpeedGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = angularSpeedGradient.factor2;\r\n }\r\n serializationObject.angularSpeedGradients.push(serializedGradient);\r\n }\r\n }\r\n var velocityGradients = particleSystem.getVelocityGradients();\r\n if (velocityGradients) {\r\n serializationObject.velocityGradients = [];\r\n for (var _f = 0, velocityGradients_1 = velocityGradients; _f < velocityGradients_1.length; _f++) {\r\n var velocityGradient = velocityGradients_1[_f];\r\n var serializedGradient = {\r\n gradient: velocityGradient.gradient,\r\n factor1: velocityGradient.factor1\r\n };\r\n if (velocityGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = velocityGradient.factor2;\r\n }\r\n serializationObject.velocityGradients.push(serializedGradient);\r\n }\r\n }\r\n var dragGradients = particleSystem.getDragGradients();\r\n if (dragGradients) {\r\n serializationObject.dragGradients = [];\r\n for (var _g = 0, dragGradients_1 = dragGradients; _g < dragGradients_1.length; _g++) {\r\n var dragGradient = dragGradients_1[_g];\r\n var serializedGradient = {\r\n gradient: dragGradient.gradient,\r\n factor1: dragGradient.factor1\r\n };\r\n if (dragGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = dragGradient.factor2;\r\n }\r\n serializationObject.dragGradients.push(serializedGradient);\r\n }\r\n }\r\n var emitRateGradients = particleSystem.getEmitRateGradients();\r\n if (emitRateGradients) {\r\n serializationObject.emitRateGradients = [];\r\n for (var _h = 0, emitRateGradients_1 = emitRateGradients; _h < emitRateGradients_1.length; _h++) {\r\n var emitRateGradient = emitRateGradients_1[_h];\r\n var serializedGradient = {\r\n gradient: emitRateGradient.gradient,\r\n factor1: emitRateGradient.factor1\r\n };\r\n if (emitRateGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = emitRateGradient.factor2;\r\n }\r\n serializationObject.emitRateGradients.push(serializedGradient);\r\n }\r\n }\r\n var startSizeGradients = particleSystem.getStartSizeGradients();\r\n if (startSizeGradients) {\r\n serializationObject.startSizeGradients = [];\r\n for (var _j = 0, startSizeGradients_1 = startSizeGradients; _j < startSizeGradients_1.length; _j++) {\r\n var startSizeGradient = startSizeGradients_1[_j];\r\n var serializedGradient = {\r\n gradient: startSizeGradient.gradient,\r\n factor1: startSizeGradient.factor1\r\n };\r\n if (startSizeGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = startSizeGradient.factor2;\r\n }\r\n serializationObject.startSizeGradients.push(serializedGradient);\r\n }\r\n }\r\n var lifeTimeGradients = particleSystem.getLifeTimeGradients();\r\n if (lifeTimeGradients) {\r\n serializationObject.lifeTimeGradients = [];\r\n for (var _k = 0, lifeTimeGradients_1 = lifeTimeGradients; _k < lifeTimeGradients_1.length; _k++) {\r\n var lifeTimeGradient = lifeTimeGradients_1[_k];\r\n var serializedGradient = {\r\n gradient: lifeTimeGradient.gradient,\r\n factor1: lifeTimeGradient.factor1\r\n };\r\n if (lifeTimeGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = lifeTimeGradient.factor2;\r\n }\r\n serializationObject.lifeTimeGradients.push(serializedGradient);\r\n }\r\n }\r\n var limitVelocityGradients = particleSystem.getLimitVelocityGradients();\r\n if (limitVelocityGradients) {\r\n serializationObject.limitVelocityGradients = [];\r\n for (var _l = 0, limitVelocityGradients_1 = limitVelocityGradients; _l < limitVelocityGradients_1.length; _l++) {\r\n var limitVelocityGradient = limitVelocityGradients_1[_l];\r\n var serializedGradient = {\r\n gradient: limitVelocityGradient.gradient,\r\n factor1: limitVelocityGradient.factor1\r\n };\r\n if (limitVelocityGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = limitVelocityGradient.factor2;\r\n }\r\n serializationObject.limitVelocityGradients.push(serializedGradient);\r\n }\r\n serializationObject.limitVelocityDamping = particleSystem.limitVelocityDamping;\r\n }\r\n if (particleSystem.noiseTexture) {\r\n serializationObject.noiseTexture = particleSystem.noiseTexture.serialize();\r\n }\r\n };\r\n /** @hidden */\r\n ParticleSystem._Parse = function (parsedParticleSystem, particleSystem, scene, rootUrl) {\r\n // Texture\r\n if (parsedParticleSystem.textureName) {\r\n particleSystem.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"](rootUrl + parsedParticleSystem.textureName, scene, false, parsedParticleSystem.invertY !== undefined ? parsedParticleSystem.invertY : true);\r\n particleSystem.particleTexture.name = parsedParticleSystem.textureName;\r\n }\r\n // Emitter\r\n if (!parsedParticleSystem.emitterId && parsedParticleSystem.emitterId !== 0 && parsedParticleSystem.emitter === undefined) {\r\n particleSystem.emitter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n else if (parsedParticleSystem.emitterId) {\r\n particleSystem.emitter = scene.getLastMeshByID(parsedParticleSystem.emitterId);\r\n }\r\n else {\r\n particleSystem.emitter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedParticleSystem.emitter);\r\n }\r\n // Misc.\r\n if (parsedParticleSystem.renderingGroupId !== undefined) {\r\n particleSystem.renderingGroupId = parsedParticleSystem.renderingGroupId;\r\n }\r\n if (parsedParticleSystem.isBillboardBased !== undefined) {\r\n particleSystem.isBillboardBased = parsedParticleSystem.isBillboardBased;\r\n }\r\n if (parsedParticleSystem.billboardMode !== undefined) {\r\n particleSystem.billboardMode = parsedParticleSystem.billboardMode;\r\n }\r\n // Animations\r\n if (parsedParticleSystem.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedParticleSystem.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_21__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n particleSystem.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n particleSystem.beginAnimationOnStart = parsedParticleSystem.beginAnimationOnStart;\r\n particleSystem.beginAnimationFrom = parsedParticleSystem.beginAnimationFrom;\r\n particleSystem.beginAnimationTo = parsedParticleSystem.beginAnimationTo;\r\n particleSystem.beginAnimationLoop = parsedParticleSystem.beginAnimationLoop;\r\n }\r\n if (parsedParticleSystem.autoAnimate) {\r\n scene.beginAnimation(particleSystem, parsedParticleSystem.autoAnimateFrom, parsedParticleSystem.autoAnimateTo, parsedParticleSystem.autoAnimateLoop, parsedParticleSystem.autoAnimateSpeed || 1.0);\r\n }\r\n // Particle system\r\n particleSystem.startDelay = parsedParticleSystem.startDelay | 0;\r\n particleSystem.minAngularSpeed = parsedParticleSystem.minAngularSpeed;\r\n particleSystem.maxAngularSpeed = parsedParticleSystem.maxAngularSpeed;\r\n particleSystem.minSize = parsedParticleSystem.minSize;\r\n particleSystem.maxSize = parsedParticleSystem.maxSize;\r\n if (parsedParticleSystem.minScaleX) {\r\n particleSystem.minScaleX = parsedParticleSystem.minScaleX;\r\n particleSystem.maxScaleX = parsedParticleSystem.maxScaleX;\r\n particleSystem.minScaleY = parsedParticleSystem.minScaleY;\r\n particleSystem.maxScaleY = parsedParticleSystem.maxScaleY;\r\n }\r\n if (parsedParticleSystem.preWarmCycles !== undefined) {\r\n particleSystem.preWarmCycles = parsedParticleSystem.preWarmCycles;\r\n particleSystem.preWarmStepOffset = parsedParticleSystem.preWarmStepOffset;\r\n }\r\n if (parsedParticleSystem.minInitialRotation !== undefined) {\r\n particleSystem.minInitialRotation = parsedParticleSystem.minInitialRotation;\r\n particleSystem.maxInitialRotation = parsedParticleSystem.maxInitialRotation;\r\n }\r\n particleSystem.minLifeTime = parsedParticleSystem.minLifeTime;\r\n particleSystem.maxLifeTime = parsedParticleSystem.maxLifeTime;\r\n particleSystem.minEmitPower = parsedParticleSystem.minEmitPower;\r\n particleSystem.maxEmitPower = parsedParticleSystem.maxEmitPower;\r\n particleSystem.emitRate = parsedParticleSystem.emitRate;\r\n particleSystem.gravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedParticleSystem.gravity);\r\n if (parsedParticleSystem.noiseStrength) {\r\n particleSystem.noiseStrength = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedParticleSystem.noiseStrength);\r\n }\r\n particleSystem.color1 = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.color1);\r\n particleSystem.color2 = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.color2);\r\n particleSystem.colorDead = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.colorDead);\r\n particleSystem.updateSpeed = parsedParticleSystem.updateSpeed;\r\n particleSystem.targetStopDuration = parsedParticleSystem.targetStopDuration;\r\n particleSystem.blendMode = parsedParticleSystem.blendMode;\r\n if (parsedParticleSystem.colorGradients) {\r\n for (var _i = 0, _a = parsedParticleSystem.colorGradients; _i < _a.length; _i++) {\r\n var colorGradient = _a[_i];\r\n particleSystem.addColorGradient(colorGradient.gradient, _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(colorGradient.color1), colorGradient.color2 ? _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(colorGradient.color2) : undefined);\r\n }\r\n }\r\n if (parsedParticleSystem.rampGradients) {\r\n for (var _b = 0, _c = parsedParticleSystem.rampGradients; _b < _c.length; _b++) {\r\n var rampGradient = _c[_b];\r\n particleSystem.addRampGradient(rampGradient.gradient, _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color3\"].FromArray(rampGradient.color));\r\n }\r\n particleSystem.useRampGradients = parsedParticleSystem.useRampGradients;\r\n }\r\n if (parsedParticleSystem.colorRemapGradients) {\r\n for (var _d = 0, _e = parsedParticleSystem.colorRemapGradients; _d < _e.length; _d++) {\r\n var colorRemapGradient = _e[_d];\r\n particleSystem.addColorRemapGradient(colorRemapGradient.gradient, colorRemapGradient.factor1 !== undefined ? colorRemapGradient.factor1 : colorRemapGradient.factor, colorRemapGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.alphaRemapGradients) {\r\n for (var _f = 0, _g = parsedParticleSystem.alphaRemapGradients; _f < _g.length; _f++) {\r\n var alphaRemapGradient = _g[_f];\r\n particleSystem.addAlphaRemapGradient(alphaRemapGradient.gradient, alphaRemapGradient.factor1 !== undefined ? alphaRemapGradient.factor1 : alphaRemapGradient.factor, alphaRemapGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.sizeGradients) {\r\n for (var _h = 0, _j = parsedParticleSystem.sizeGradients; _h < _j.length; _h++) {\r\n var sizeGradient = _j[_h];\r\n particleSystem.addSizeGradient(sizeGradient.gradient, sizeGradient.factor1 !== undefined ? sizeGradient.factor1 : sizeGradient.factor, sizeGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.angularSpeedGradients) {\r\n for (var _k = 0, _l = parsedParticleSystem.angularSpeedGradients; _k < _l.length; _k++) {\r\n var angularSpeedGradient = _l[_k];\r\n particleSystem.addAngularSpeedGradient(angularSpeedGradient.gradient, angularSpeedGradient.factor1 !== undefined ? angularSpeedGradient.factor1 : angularSpeedGradient.factor, angularSpeedGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.velocityGradients) {\r\n for (var _m = 0, _o = parsedParticleSystem.velocityGradients; _m < _o.length; _m++) {\r\n var velocityGradient = _o[_m];\r\n particleSystem.addVelocityGradient(velocityGradient.gradient, velocityGradient.factor1 !== undefined ? velocityGradient.factor1 : velocityGradient.factor, velocityGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.dragGradients) {\r\n for (var _p = 0, _q = parsedParticleSystem.dragGradients; _p < _q.length; _p++) {\r\n var dragGradient = _q[_p];\r\n particleSystem.addDragGradient(dragGradient.gradient, dragGradient.factor1 !== undefined ? dragGradient.factor1 : dragGradient.factor, dragGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.emitRateGradients) {\r\n for (var _r = 0, _s = parsedParticleSystem.emitRateGradients; _r < _s.length; _r++) {\r\n var emitRateGradient = _s[_r];\r\n particleSystem.addEmitRateGradient(emitRateGradient.gradient, emitRateGradient.factor1 !== undefined ? emitRateGradient.factor1 : emitRateGradient.factor, emitRateGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.startSizeGradients) {\r\n for (var _t = 0, _u = parsedParticleSystem.startSizeGradients; _t < _u.length; _t++) {\r\n var startSizeGradient = _u[_t];\r\n particleSystem.addStartSizeGradient(startSizeGradient.gradient, startSizeGradient.factor1 !== undefined ? startSizeGradient.factor1 : startSizeGradient.factor, startSizeGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.lifeTimeGradients) {\r\n for (var _v = 0, _w = parsedParticleSystem.lifeTimeGradients; _v < _w.length; _v++) {\r\n var lifeTimeGradient = _w[_v];\r\n particleSystem.addLifeTimeGradient(lifeTimeGradient.gradient, lifeTimeGradient.factor1 !== undefined ? lifeTimeGradient.factor1 : lifeTimeGradient.factor, lifeTimeGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.limitVelocityGradients) {\r\n for (var _x = 0, _y = parsedParticleSystem.limitVelocityGradients; _x < _y.length; _x++) {\r\n var limitVelocityGradient = _y[_x];\r\n particleSystem.addLimitVelocityGradient(limitVelocityGradient.gradient, limitVelocityGradient.factor1 !== undefined ? limitVelocityGradient.factor1 : limitVelocityGradient.factor, limitVelocityGradient.factor2);\r\n }\r\n particleSystem.limitVelocityDamping = parsedParticleSystem.limitVelocityDamping;\r\n }\r\n if (parsedParticleSystem.noiseTexture) {\r\n particleSystem.noiseTexture = _Materials_Textures_Procedurals_proceduralTexture__WEBPACK_IMPORTED_MODULE_12__[\"ProceduralTexture\"].Parse(parsedParticleSystem.noiseTexture, scene, rootUrl);\r\n }\r\n // Emitter\r\n var emitterType;\r\n if (parsedParticleSystem.particleEmitterType) {\r\n switch (parsedParticleSystem.particleEmitterType.type) {\r\n case \"SphereParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"SphereParticleEmitter\"]();\r\n break;\r\n case \"SphereDirectedParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"SphereDirectedParticleEmitter\"]();\r\n break;\r\n case \"ConeEmitter\":\r\n case \"ConeParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"ConeParticleEmitter\"]();\r\n break;\r\n case \"CylinderParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"CylinderParticleEmitter\"]();\r\n break;\r\n case \"HemisphericParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"HemisphericParticleEmitter\"]();\r\n break;\r\n case \"BoxEmitter\":\r\n case \"BoxParticleEmitter\":\r\n default:\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"BoxParticleEmitter\"]();\r\n break;\r\n }\r\n emitterType.parse(parsedParticleSystem.particleEmitterType);\r\n }\r\n else {\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"BoxParticleEmitter\"]();\r\n emitterType.parse(parsedParticleSystem);\r\n }\r\n particleSystem.particleEmitterType = emitterType;\r\n // Animation sheet\r\n particleSystem.startSpriteCellID = parsedParticleSystem.startSpriteCellID;\r\n particleSystem.endSpriteCellID = parsedParticleSystem.endSpriteCellID;\r\n particleSystem.spriteCellWidth = parsedParticleSystem.spriteCellWidth;\r\n particleSystem.spriteCellHeight = parsedParticleSystem.spriteCellHeight;\r\n particleSystem.spriteCellChangeSpeed = parsedParticleSystem.spriteCellChangeSpeed;\r\n particleSystem.spriteRandomStartCell = parsedParticleSystem.spriteRandomStartCell;\r\n };\r\n /**\r\n * Parses a JSON object to create a particle system.\r\n * @param parsedParticleSystem The JSON object to parse\r\n * @param scene The scene to create the particle system in\r\n * @param rootUrl The root url to use to load external dependencies like texture\r\n * @param doNotStart Ignore the preventAutoStart attribute and does not start\r\n * @returns the Parsed particle system\r\n */\r\n ParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl, doNotStart) {\r\n if (doNotStart === void 0) { doNotStart = false; }\r\n var name = parsedParticleSystem.name;\r\n var custom = null;\r\n var program = null;\r\n if (parsedParticleSystem.customShader) {\r\n program = parsedParticleSystem.customShader;\r\n var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join(\"\\n\") : \"\";\r\n custom = scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);\r\n }\r\n var particleSystem = new ParticleSystem(name, parsedParticleSystem.capacity, scene, custom, parsedParticleSystem.isAnimationSheetEnabled);\r\n particleSystem.customShader = program;\r\n if (parsedParticleSystem.id) {\r\n particleSystem.id = parsedParticleSystem.id;\r\n }\r\n // SubEmitters\r\n if (parsedParticleSystem.subEmitters) {\r\n particleSystem.subEmitters = [];\r\n for (var _i = 0, _a = parsedParticleSystem.subEmitters; _i < _a.length; _i++) {\r\n var cell = _a[_i];\r\n var cellArray = [];\r\n for (var _b = 0, cell_1 = cell; _b < cell_1.length; _b++) {\r\n var sub = cell_1[_b];\r\n cellArray.push(_subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"].Parse(sub, scene, rootUrl));\r\n }\r\n particleSystem.subEmitters.push(cellArray);\r\n }\r\n }\r\n ParticleSystem._Parse(parsedParticleSystem, particleSystem, scene, rootUrl);\r\n particleSystem.textureMask = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.textureMask);\r\n // Auto start\r\n if (parsedParticleSystem.preventAutoStart) {\r\n particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;\r\n }\r\n if (!doNotStart && !particleSystem.preventAutoStart) {\r\n particleSystem.start();\r\n }\r\n return particleSystem;\r\n };\r\n /**\r\n * Billboard mode will only apply to Y axis\r\n */\r\n ParticleSystem.BILLBOARDMODE_Y = _Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].PARTICLES_BILLBOARDMODE_Y;\r\n /**\r\n * Billboard mode will apply to all axes\r\n */\r\n ParticleSystem.BILLBOARDMODE_ALL = _Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].PARTICLES_BILLBOARDMODE_ALL;\r\n /**\r\n * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction\r\n */\r\n ParticleSystem.BILLBOARDMODE_STRETCHED = _Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].PARTICLES_BILLBOARDMODE_STRETCHED;\r\n return ParticleSystem;\r\n}(_baseParticleSystem__WEBPACK_IMPORTED_MODULE_15__[\"BaseParticleSystem\"]));\r\n\r\n_subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"]._ParseParticleSystem = ParticleSystem.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleSystemComponent.ts\":\n/*!**********************************************!*\\\n !*** ./Particles/particleSystemComponent.ts ***!\n \\**********************************************/\n/*! exports provided: _IDoNeedToBeInTheBuild */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _IDoNeedToBeInTheBuild; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Shaders_particles_vertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Shaders/particles.vertex */ \"./Shaders/particles.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Adds the parsers to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {\r\n var individualParser = _abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].GetIndividualParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM);\r\n if (!individualParser) {\r\n return;\r\n }\r\n // Particles Systems\r\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\r\n for (var index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\r\n var parsedParticleSystem = parsedData.particleSystems[index];\r\n container.particleSystems.push(individualParser(parsedParticleSystem, scene, rootUrl));\r\n }\r\n }\r\n});\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddIndividualParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM, function (parsedParticleSystem, scene, rootUrl) {\r\n if (parsedParticleSystem.activeParticleCount) {\r\n var ps = _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_1__[\"GPUParticleSystem\"].Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n }\r\n else {\r\n var ps = _particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"].Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n }\r\n});\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].prototype.createEffectForParticles = function (fragmentName, uniformsNames, samplers, defines, fallbacks, onCompiled, onError) {\r\n if (uniformsNames === void 0) { uniformsNames = []; }\r\n if (samplers === void 0) { samplers = []; }\r\n if (defines === void 0) { defines = \"\"; }\r\n var attributesNamesOrOptions = _particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"]._GetAttributeNamesOrOptions();\r\n var effectCreationOption = _particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"]._GetEffectCreationOptions();\r\n if (defines.indexOf(\" BILLBOARD\") === -1) {\r\n defines += \"\\n#define BILLBOARD\\n\";\r\n }\r\n if (samplers.indexOf(\"diffuseSampler\") === -1) {\r\n samplers.push(\"diffuseSampler\");\r\n }\r\n return this.createEffect({\r\n vertex: \"particles\",\r\n fragmentElement: fragmentName\r\n }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), samplers, defines, fallbacks, onCompiled, onError);\r\n};\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].prototype.getEmittedParticleSystems = function () {\r\n var results = new Array();\r\n for (var index = 0; index < this.getScene().particleSystems.length; index++) {\r\n var particleSystem = this.getScene().particleSystems[index];\r\n if (particleSystem.emitter === this) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n return results;\r\n};\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].prototype.getHierarchyEmittedParticleSystems = function () {\r\n var results = new Array();\r\n var descendants = this.getDescendants();\r\n descendants.push(this);\r\n for (var index = 0; index < this.getScene().particleSystems.length; index++) {\r\n var particleSystem = this.getScene().particleSystems[index];\r\n var emitter = particleSystem.emitter;\r\n if (emitter.position && descendants.indexOf(emitter) !== -1) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n return results;\r\n};\r\n/**\r\n * @hidden\r\n */\r\nvar _IDoNeedToBeInTheBuild = 42;\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleSystemSet.ts\":\n/*!****************************************!*\\\n !*** ./Particles/particleSystemSet.ts ***!\n \\****************************************/\n/*! exports provided: ParticleSystemSet */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return ParticleSystemSet; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Particles_particleSystem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Particles/particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** Internal class used to store shapes for emitters */\r\nvar ParticleSystemSetEmitterCreationOptions = /** @class */ (function () {\r\n function ParticleSystemSetEmitterCreationOptions() {\r\n }\r\n return ParticleSystemSetEmitterCreationOptions;\r\n}());\r\n/**\r\n * Represents a set of particle systems working together to create a specific effect\r\n */\r\nvar ParticleSystemSet = /** @class */ (function () {\r\n function ParticleSystemSet() {\r\n /**\r\n * Gets the particle system list\r\n */\r\n this.systems = new Array();\r\n }\r\n Object.defineProperty(ParticleSystemSet.prototype, \"emitterNode\", {\r\n /**\r\n * Gets the emitter node used with this set\r\n */\r\n get: function () {\r\n return this._emitterNode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a new emitter mesh as a sphere\r\n * @param options defines the options used to create the sphere\r\n * @param renderingGroupId defines the renderingGroupId to use for the sphere\r\n * @param scene defines the hosting scene\r\n */\r\n ParticleSystemSet.prototype.setEmitterAsSphere = function (options, renderingGroupId, scene) {\r\n if (this._emitterNode) {\r\n this._emitterNode.dispose();\r\n }\r\n this._emitterCreationOptions = {\r\n kind: \"Sphere\",\r\n options: options,\r\n renderingGroupId: renderingGroupId\r\n };\r\n var emitterMesh = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__[\"SphereBuilder\"].CreateSphere(\"emitterSphere\", { diameter: options.diameter, segments: options.segments }, scene);\r\n emitterMesh.renderingGroupId = renderingGroupId;\r\n var material = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__[\"StandardMaterial\"](\"emitterSphereMaterial\", scene);\r\n material.emissiveColor = options.color;\r\n emitterMesh.material = material;\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n system.emitter = emitterMesh;\r\n }\r\n this._emitterNode = emitterMesh;\r\n };\r\n /**\r\n * Starts all particle systems of the set\r\n * @param emitter defines an optional mesh to use as emitter for the particle systems\r\n */\r\n ParticleSystemSet.prototype.start = function (emitter) {\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n if (emitter) {\r\n system.emitter = emitter;\r\n }\r\n system.start();\r\n }\r\n };\r\n /**\r\n * Release all associated resources\r\n */\r\n ParticleSystemSet.prototype.dispose = function () {\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n system.dispose();\r\n }\r\n this.systems = [];\r\n if (this._emitterNode) {\r\n this._emitterNode.dispose();\r\n this._emitterNode = null;\r\n }\r\n };\r\n /**\r\n * Serialize the set into a JSON compatible object\r\n * @returns a JSON compatible representation of the set\r\n */\r\n ParticleSystemSet.prototype.serialize = function () {\r\n var result = {};\r\n result.systems = [];\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n result.systems.push(system.serialize());\r\n }\r\n if (this._emitterNode) {\r\n result.emitter = this._emitterCreationOptions;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Parse a new ParticleSystemSet from a serialized source\r\n * @param data defines a JSON compatible representation of the set\r\n * @param scene defines the hosting scene\r\n * @param gpu defines if we want GPU particles or CPU particles\r\n * @returns a new ParticleSystemSet\r\n */\r\n ParticleSystemSet.Parse = function (data, scene, gpu) {\r\n if (gpu === void 0) { gpu = false; }\r\n var result = new ParticleSystemSet();\r\n var rootUrl = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].PARTICLES_BaseAssetsUrl + \"/textures/\";\r\n scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene;\r\n for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n result.systems.push(gpu ? _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__[\"GPUParticleSystem\"].Parse(system, scene, rootUrl, true) : _Particles_particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"].Parse(system, scene, rootUrl, true));\r\n }\r\n if (data.emitter) {\r\n var options = data.emitter.options;\r\n switch (data.emitter.kind) {\r\n case \"Sphere\":\r\n result.setEmitterAsSphere({\r\n diameter: options.diameter,\r\n segments: options.segments,\r\n color: _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color3\"].FromArray(options.color)\r\n }, data.emitter.renderingGroupId, scene);\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n return ParticleSystemSet;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/solidParticle.ts\":\n/*!************************************!*\\\n !*** ./Particles/solidParticle.ts ***!\n \\************************************/\n/*! exports provided: SolidParticle, ModelShape, DepthSortedParticle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return SolidParticle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return ModelShape; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return DepthSortedParticle; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Culling_boundingSphere__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Culling/boundingSphere */ \"./Culling/boundingSphere.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Represents one particle of a solid particle system.\r\n */\r\nvar SolidParticle = /** @class */ (function () {\r\n /**\r\n * Creates a Solid Particle object.\r\n * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()\r\n * @param particleIndex (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.\r\n * @param positionIndex (integer) is the starting index of the particle vertices in the SPS \"positions\" array.\r\n * @param indiceIndex (integer) is the starting index of the particle indices in the SPS \"indices\" array.\r\n * @param model (ModelShape) is a reference to the model shape on what the particle is designed.\r\n * @param shapeId (integer) is the model shape identifier in the SPS.\r\n * @param idxInShape (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))\r\n * @param sps defines the sps it is associated to\r\n * @param modelBoundingInfo is the reference to the model BoundingInfo used for intersection computations.\r\n */\r\n function SolidParticle(particleIndex, positionIndex, indiceIndex, model, shapeId, idxInShape, sps, modelBoundingInfo) {\r\n if (modelBoundingInfo === void 0) { modelBoundingInfo = null; }\r\n /**\r\n * particle global index\r\n */\r\n this.idx = 0;\r\n /**\r\n * The color of the particle\r\n */\r\n this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * The world space position of the particle.\r\n */\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The world space rotation of the particle. (Not use if rotationQuaternion is set)\r\n */\r\n this.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The scaling of the particle.\r\n */\r\n this.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].One();\r\n /**\r\n * The uvs of the particle.\r\n */\r\n this.uvs = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0.0, 0.0, 1.0, 1.0);\r\n /**\r\n * The current speed of the particle.\r\n */\r\n this.velocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The pivot point in the particle local space.\r\n */\r\n this.pivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Must the particle be translated from its pivot point in its local space ?\r\n * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.\r\n * Default : false\r\n */\r\n this.translateFromPivot = false;\r\n /**\r\n * Is the particle active or not ?\r\n */\r\n this.alive = true;\r\n /**\r\n * Is the particle visible or not ?\r\n */\r\n this.isVisible = true;\r\n /**\r\n * Index of this particle in the global \"positions\" array (Internal use)\r\n * @hidden\r\n */\r\n this._pos = 0;\r\n /**\r\n * @hidden Index of this particle in the global \"indices\" array (Internal use)\r\n */\r\n this._ind = 0;\r\n /**\r\n * ModelShape id of this particle\r\n */\r\n this.shapeId = 0;\r\n /**\r\n * Index of the particle in its shape id\r\n */\r\n this.idxInShape = 0;\r\n /**\r\n * @hidden Still set as invisible in order to skip useless computations (Internal use)\r\n */\r\n this._stillInvisible = false;\r\n /**\r\n * @hidden Last computed particle rotation matrix\r\n */\r\n this._rotationMatrix = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];\r\n /**\r\n * Parent particle Id, if any.\r\n * Default null.\r\n */\r\n this.parentId = null;\r\n /**\r\n * The culling strategy to use to check whether the solid particle must be culled or not when using isInFrustum().\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * The default value for solid particles is AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * Please read each static variable documentation in the class AbstractMesh to get details about the culling process.\r\n * */\r\n this.cullingStrategy = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"].CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n /**\r\n * @hidden Internal global position in the SPS.\r\n */\r\n this._globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this.idx = particleIndex;\r\n this._pos = positionIndex;\r\n this._ind = indiceIndex;\r\n this._model = model;\r\n this.shapeId = shapeId;\r\n this.idxInShape = idxInShape;\r\n this._sps = sps;\r\n if (modelBoundingInfo) {\r\n this._modelBoundingInfo = modelBoundingInfo;\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_2__[\"BoundingInfo\"](modelBoundingInfo.minimum, modelBoundingInfo.maximum);\r\n }\r\n }\r\n Object.defineProperty(SolidParticle.prototype, \"scale\", {\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n get: function () {\r\n return this.scaling;\r\n },\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n set: function (scale) {\r\n this.scaling = scale;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticle.prototype, \"quaternion\", {\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n get: function () {\r\n return this.rotationQuaternion;\r\n },\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n set: function (q) {\r\n this.rotationQuaternion = q;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a boolean. True if the particle intersects another particle or another mesh, else false.\r\n * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)\r\n * @param target is the object (solid particle or mesh) what the intersection is computed against.\r\n * @returns true if it intersects\r\n */\r\n SolidParticle.prototype.intersectsMesh = function (target) {\r\n if (!this._boundingInfo || !target._boundingInfo) {\r\n return false;\r\n }\r\n if (this._sps._bSphereOnly) {\r\n return _Culling_boundingSphere__WEBPACK_IMPORTED_MODULE_3__[\"BoundingSphere\"].Intersects(this._boundingInfo.boundingSphere, target._boundingInfo.boundingSphere);\r\n }\r\n return this._boundingInfo.intersects(target._boundingInfo, false);\r\n };\r\n /**\r\n * Returns `true` if the solid particle is within the frustum defined by the passed array of planes.\r\n * A particle is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the particle is in the frustum planes\r\n */\r\n SolidParticle.prototype.isInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n };\r\n /**\r\n * get the rotation matrix of the particle\r\n * @hidden\r\n */\r\n SolidParticle.prototype.getRotationMatrix = function (m) {\r\n var quaternion;\r\n if (this.rotationQuaternion) {\r\n quaternion = this.rotationQuaternion;\r\n }\r\n else {\r\n quaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Quaternion[0];\r\n var rotation = this.rotation;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n }\r\n quaternion.toRotationMatrix(m);\r\n };\r\n return SolidParticle;\r\n}());\r\n\r\n/**\r\n * Represents the shape of the model used by one particle of a solid particle system.\r\n * SPS internal tool, don't use it manually.\r\n */\r\nvar ModelShape = /** @class */ (function () {\r\n /**\r\n * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.\r\n * SPS internal tool, don't use it manually.\r\n * @hidden\r\n */\r\n function ModelShape(id, shape, indicesLength, shapeUV, posFunction, vtxFunction) {\r\n /**\r\n * length of the shape in the model indices array (internal use)\r\n * @hidden\r\n */\r\n this._indicesLength = 0;\r\n this.shapeID = id;\r\n this._shape = shape;\r\n this._indicesLength = indicesLength;\r\n this._shapeUV = shapeUV;\r\n this._positionFunction = posFunction;\r\n this._vertexFunction = vtxFunction;\r\n }\r\n return ModelShape;\r\n}());\r\n\r\n/**\r\n * Represents a Depth Sorted Particle in the solid particle system.\r\n */\r\nvar DepthSortedParticle = /** @class */ (function () {\r\n function DepthSortedParticle() {\r\n /**\r\n * Index of the particle in the \"indices\" array\r\n */\r\n this.ind = 0;\r\n /**\r\n * Length of the particle shape in the \"indices\" array\r\n */\r\n this.indicesLength = 0;\r\n /**\r\n * Squared distance from the particle to the camera\r\n */\r\n this.sqDistance = 0.0;\r\n }\r\n return DepthSortedParticle;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/solidParticleSystem.ts\":\n/*!******************************************!*\\\n !*** ./Particles/solidParticleSystem.ts ***!\n \\******************************************/\n/*! exports provided: SolidParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return SolidParticleSystem; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_discBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/discBuilder */ \"./Meshes/Builders/discBuilder.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _solidParticle__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./solidParticle */ \"./Particles/solidParticle.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar depthSortFunction = function (p1, p2) { return p2.sqDistance - p1.sqDistance; };\r\n/**\r\n * The SPS is a single updatable mesh. The solid particles are simply separate parts or faces fo this big mesh.\r\n *As it is just a mesh, the SPS has all the same properties than any other BJS mesh : not more, not less. It can be scaled, rotated, translated, enlighted, textured, moved, etc.\r\n\r\n * The SPS is also a particle system. It provides some methods to manage the particles.\r\n * However it is behavior agnostic. This means it has no emitter, no particle physics, no particle recycler. You have to implement your own behavior.\r\n *\r\n * Full documentation here : http://doc.babylonjs.com/how_to/Solid_Particle_System\r\n */\r\nvar SolidParticleSystem = /** @class */ (function () {\r\n /**\r\n * Creates a SPS (Solid Particle System) object.\r\n * @param name (String) is the SPS name, this will be the underlying mesh name.\r\n * @param scene (Scene) is the scene in which the SPS is added.\r\n * @param options defines the options of the sps e.g.\r\n * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.\r\n * * isPickable (optional boolean, default false) : if the solid particles must be pickable.\r\n * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.\r\n * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.\r\n * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).\r\n * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.\r\n * @example bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.\r\n */\r\n function SolidParticleSystem(name, scene, options) {\r\n /**\r\n * The SPS array of Solid Particle objects. Just access each particle as with any classic array.\r\n * Example : var p = SPS.particles[i];\r\n */\r\n this.particles = new Array();\r\n /**\r\n * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.\r\n */\r\n this.nbParticles = 0;\r\n /**\r\n * If the particles must ever face the camera (default false). Useful for planar particles.\r\n */\r\n this.billboard = false;\r\n /**\r\n * Recompute normals when adding a shape\r\n */\r\n this.recomputeNormals = true;\r\n /**\r\n * This a counter ofr your own usage. It's not set by any SPS functions.\r\n */\r\n this.counter = 0;\r\n /**\r\n * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.\r\n * Please read : http://doc.babylonjs.com/how_to/Solid_Particle_System#garbage-collector-concerns\r\n */\r\n this.vars = {};\r\n /**\r\n * If the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster). (Internal use only)\r\n * @hidden\r\n */\r\n this._bSphereOnly = false;\r\n /**\r\n * A number to multiply the boundind sphere radius by in order to reduce it for instance. (Internal use only)\r\n * @hidden\r\n */\r\n this._bSphereRadiusFactor = 1.0;\r\n this._positions = new Array();\r\n this._indices = new Array();\r\n this._normals = new Array();\r\n this._colors = new Array();\r\n this._uvs = new Array();\r\n this._index = 0; // indices index\r\n this._updatable = true;\r\n this._pickable = false;\r\n this._isVisibilityBoxLocked = false;\r\n this._alwaysVisible = false;\r\n this._depthSort = false;\r\n this._shapeCounter = 0;\r\n this._copy = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"SolidParticle\"](0, 0, 0, null, 0, 0, this);\r\n this._color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n this._computeParticleColor = true;\r\n this._computeParticleTexture = true;\r\n this._computeParticleRotation = true;\r\n this._computeParticleVertex = false;\r\n this._computeBoundingBox = false;\r\n this._depthSortParticles = true;\r\n this._mustUnrotateFixedNormals = false;\r\n this._particlesIntersect = false;\r\n this._needs32Bits = false;\r\n this.name = name;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n this._camera = scene.activeCamera;\r\n this._pickable = options ? options.isPickable : false;\r\n this._depthSort = options ? options.enableDepthSort : false;\r\n this._particlesIntersect = options ? options.particleIntersection : false;\r\n this._bSphereOnly = options ? options.boundingSphereOnly : false;\r\n this._bSphereRadiusFactor = (options && options.bSphereRadiusFactor) ? options.bSphereRadiusFactor : 1.0;\r\n if (options && options.updatable !== undefined) {\r\n this._updatable = options.updatable;\r\n }\r\n else {\r\n this._updatable = true;\r\n }\r\n if (this._pickable) {\r\n this.pickedParticles = [];\r\n }\r\n if (this._depthSort) {\r\n this.depthSortedParticles = [];\r\n }\r\n }\r\n /**\r\n * Builds the SPS underlying mesh. Returns a standard Mesh.\r\n * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.\r\n * @returns the created mesh\r\n */\r\n SolidParticleSystem.prototype.buildMesh = function () {\r\n if (this.nbParticles === 0) {\r\n var triangle = _Meshes_Builders_discBuilder__WEBPACK_IMPORTED_MODULE_5__[\"DiscBuilder\"].CreateDisc(\"\", { radius: 1, tessellation: 3 }, this._scene);\r\n this.addShape(triangle, 1);\r\n triangle.dispose();\r\n }\r\n this._indices32 = (this._needs32Bits) ? new Uint32Array(this._indices) : new Uint16Array(this._indices);\r\n this._positions32 = new Float32Array(this._positions);\r\n this._uvs32 = new Float32Array(this._uvs);\r\n this._colors32 = new Float32Array(this._colors);\r\n if (this.recomputeNormals) {\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(this._positions32, this._indices32, this._normals);\r\n }\r\n this._normals32 = new Float32Array(this._normals);\r\n this._fixedNormal32 = new Float32Array(this._normals);\r\n if (this._mustUnrotateFixedNormals) { // the particles could be created already rotated in the mesh with a positionFunction\r\n this._unrotateFixedNormals();\r\n }\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = (this._depthSort) ? this._indices : this._indices32;\r\n vertexData.set(this._positions32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n vertexData.set(this._normals32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n if (this._uvs32.length > 0) {\r\n vertexData.set(this._uvs32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (this._colors32.length > 0) {\r\n vertexData.set(this._colors32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n }\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](this.name, this._scene);\r\n vertexData.applyToMesh(mesh, this._updatable);\r\n this.mesh = mesh;\r\n this.mesh.isPickable = this._pickable;\r\n // free memory\r\n if (!this._depthSort) {\r\n this._indices = null;\r\n }\r\n this._positions = null;\r\n this._normals = null;\r\n this._uvs = null;\r\n this._colors = null;\r\n if (!this._updatable) {\r\n this.particles.length = 0;\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.\r\n * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.\r\n * Thus the particles generated from `digest()` have their property `position` set yet.\r\n * @param mesh ( Mesh ) is the mesh to be digested\r\n * @param options {facetNb} (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any\r\n * {delta} (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets\r\n * {number} (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets\r\n * @returns the current SPS\r\n */\r\n SolidParticleSystem.prototype.digest = function (mesh, options) {\r\n var size = (options && options.facetNb) || 1;\r\n var number = (options && options.number) || 0;\r\n var delta = (options && options.delta) || 0;\r\n var meshPos = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n var meshInd = mesh.getIndices();\r\n var meshUV = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n var meshCol = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n var meshNor = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var f = 0; // facet counter\r\n var totalFacets = meshInd.length / 3; // a facet is a triangle, so 3 indices\r\n // compute size from number\r\n if (number) {\r\n number = (number > totalFacets) ? totalFacets : number;\r\n size = Math.round(totalFacets / number);\r\n delta = 0;\r\n }\r\n else {\r\n size = (size > totalFacets) ? totalFacets : size;\r\n }\r\n var facetPos = []; // submesh positions\r\n var facetInd = []; // submesh indices\r\n var facetUV = []; // submesh UV\r\n var facetCol = []; // submesh colors\r\n var barycenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var sizeO = size;\r\n while (f < totalFacets) {\r\n size = sizeO + Math.floor((1 + delta) * Math.random());\r\n if (f > totalFacets - size) {\r\n size = totalFacets - f;\r\n }\r\n // reset temp arrays\r\n facetPos.length = 0;\r\n facetInd.length = 0;\r\n facetUV.length = 0;\r\n facetCol.length = 0;\r\n // iterate over \"size\" facets\r\n var fi = 0;\r\n for (var j = f * 3; j < (f + size) * 3; j++) {\r\n facetInd.push(fi);\r\n var i = meshInd[j];\r\n facetPos.push(meshPos[i * 3], meshPos[i * 3 + 1], meshPos[i * 3 + 2]);\r\n if (meshUV) {\r\n facetUV.push(meshUV[i * 2], meshUV[i * 2 + 1]);\r\n }\r\n if (meshCol) {\r\n facetCol.push(meshCol[i * 4], meshCol[i * 4 + 1], meshCol[i * 4 + 2], meshCol[i * 4 + 3]);\r\n }\r\n fi++;\r\n }\r\n // create a model shape for each single particle\r\n var idx = this.nbParticles;\r\n var shape = this._posToShape(facetPos);\r\n var shapeUV = this._uvsToShapeUV(facetUV);\r\n // compute the barycenter of the shape\r\n barycenter.copyFromFloats(0, 0, 0);\r\n var v;\r\n for (v = 0; v < shape.length; v++) {\r\n barycenter.addInPlace(shape[v]);\r\n }\r\n barycenter.scaleInPlace(1 / shape.length);\r\n // shift the shape from its barycenter to the origin\r\n // and compute the BBox required for intersection.\r\n var minimum = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Infinity, Infinity, Infinity);\r\n var maximum = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-Infinity, -Infinity, -Infinity);\r\n for (v = 0; v < shape.length; v++) {\r\n shape[v].subtractInPlace(barycenter);\r\n minimum.minimizeInPlaceFromFloats(shape[v].x, shape[v].y, shape[v].z);\r\n maximum.maximizeInPlaceFromFloats(shape[v].x, shape[v].y, shape[v].z);\r\n }\r\n var bInfo;\r\n if (this._particlesIntersect) {\r\n bInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__[\"BoundingInfo\"](minimum, maximum);\r\n }\r\n var modelShape = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"ModelShape\"](this._shapeCounter, shape, size * 3, shapeUV, null, null);\r\n // add the particle in the SPS\r\n var currentPos = this._positions.length;\r\n var currentInd = this._indices.length;\r\n this._meshBuilder(this._index, shape, this._positions, facetInd, this._indices, facetUV, this._uvs, facetCol, this._colors, meshNor, this._normals, idx, 0, null);\r\n this._addParticle(idx, currentPos, currentInd, modelShape, this._shapeCounter, 0, bInfo);\r\n // initialize the particle position\r\n this.particles[this.nbParticles].position.addInPlace(barycenter);\r\n this._index += shape.length;\r\n idx++;\r\n this.nbParticles++;\r\n this._shapeCounter++;\r\n f += size;\r\n }\r\n return this;\r\n };\r\n // unrotate the fixed normals in case the mesh was built with pre-rotated particles, ex : use of positionFunction in addShape()\r\n SolidParticleSystem.prototype._unrotateFixedNormals = function () {\r\n var index = 0;\r\n var idx = 0;\r\n var tmpNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0];\r\n var quaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Quaternion[0];\r\n var invertedRotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n for (var p = 0; p < this.particles.length; p++) {\r\n var particle = this.particles[p];\r\n var shape = particle._model._shape;\r\n // computing the inverse of the rotation matrix from the quaternion\r\n // is equivalent to computing the matrix of the inverse quaternion, i.e of the conjugate quaternion\r\n if (particle.rotationQuaternion) {\r\n particle.rotationQuaternion.conjugateToRef(quaternion);\r\n }\r\n else {\r\n var rotation = particle.rotation;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n quaternion.conjugateInPlace();\r\n }\r\n quaternion.toRotationMatrix(invertedRotMatrix);\r\n for (var pt = 0; pt < shape.length; pt++) {\r\n idx = index + pt * 3;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalFromFloatsToRef(this._normals32[idx], this._normals32[idx + 1], this._normals32[idx + 2], invertedRotMatrix, tmpNormal);\r\n tmpNormal.toArray(this._fixedNormal32, idx);\r\n }\r\n index = idx + 3;\r\n }\r\n };\r\n //reset copy\r\n SolidParticleSystem.prototype._resetCopy = function () {\r\n var copy = this._copy;\r\n copy.position.setAll(0);\r\n copy.rotation.setAll(0);\r\n copy.rotationQuaternion = null;\r\n copy.scaling.setAll(1);\r\n copy.uvs.copyFromFloats(0.0, 0.0, 1.0, 1.0);\r\n copy.color = null;\r\n copy.translateFromPivot = false;\r\n };\r\n // _meshBuilder : inserts the shape model in the global SPS mesh\r\n SolidParticleSystem.prototype._meshBuilder = function (p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, meshNor, normals, idx, idxInShape, options) {\r\n var i;\r\n var u = 0;\r\n var c = 0;\r\n var n = 0;\r\n this._resetCopy();\r\n var copy = this._copy;\r\n copy.idx = idx;\r\n copy.idxInShape = idxInShape;\r\n if (options && options.positionFunction) { // call to custom positionFunction\r\n options.positionFunction(copy, idx, idxInShape);\r\n this._mustUnrotateFixedNormals = true;\r\n }\r\n var rotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var tmpVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0];\r\n var tmpRotated = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[1];\r\n var pivotBackTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[2];\r\n var scaledPivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[3];\r\n copy.getRotationMatrix(rotMatrix);\r\n copy.pivot.multiplyToRef(copy.scaling, scaledPivot);\r\n if (copy.translateFromPivot) {\r\n pivotBackTranslation.setAll(0.0);\r\n }\r\n else {\r\n pivotBackTranslation.copyFrom(scaledPivot);\r\n }\r\n for (i = 0; i < shape.length; i++) {\r\n tmpVertex.copyFrom(shape[i]);\r\n if (options && options.vertexFunction) {\r\n options.vertexFunction(copy, tmpVertex, i);\r\n }\r\n tmpVertex.multiplyInPlace(copy.scaling).subtractInPlace(scaledPivot);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(tmpVertex, rotMatrix, tmpRotated);\r\n tmpRotated.addInPlace(pivotBackTranslation).addInPlace(copy.position);\r\n positions.push(tmpRotated.x, tmpRotated.y, tmpRotated.z);\r\n if (meshUV) {\r\n var copyUvs = copy.uvs;\r\n uvs.push((copyUvs.z - copyUvs.x) * meshUV[u] + copyUvs.x, (copyUvs.w - copyUvs.y) * meshUV[u + 1] + copyUvs.y);\r\n u += 2;\r\n }\r\n if (copy.color) {\r\n this._color = copy.color;\r\n }\r\n else {\r\n var color = this._color;\r\n if (meshCol && meshCol[c] !== undefined) {\r\n color.r = meshCol[c];\r\n color.g = meshCol[c + 1];\r\n color.b = meshCol[c + 2];\r\n color.a = meshCol[c + 3];\r\n }\r\n else {\r\n color.r = 1.0;\r\n color.g = 1.0;\r\n color.b = 1.0;\r\n color.a = 1.0;\r\n }\r\n }\r\n colors.push(this._color.r, this._color.g, this._color.b, this._color.a);\r\n c += 4;\r\n if (!this.recomputeNormals && meshNor) {\r\n tmpVertex.x = meshNor[n];\r\n tmpVertex.y = meshNor[n + 1];\r\n tmpVertex.z = meshNor[n + 2];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalToRef(tmpVertex, rotMatrix, tmpVertex);\r\n normals.push(tmpVertex.x, tmpVertex.y, tmpVertex.z);\r\n n += 3;\r\n }\r\n }\r\n for (i = 0; i < meshInd.length; i++) {\r\n var current_ind = p + meshInd[i];\r\n indices.push(current_ind);\r\n if (current_ind > 65535) {\r\n this._needs32Bits = true;\r\n }\r\n }\r\n if (this._pickable) {\r\n var nbfaces = meshInd.length / 3;\r\n for (i = 0; i < nbfaces; i++) {\r\n this.pickedParticles.push({ idx: idx, faceId: i });\r\n }\r\n }\r\n if (this._depthSort) {\r\n this.depthSortedParticles.push(new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"DepthSortedParticle\"]());\r\n }\r\n return copy;\r\n };\r\n // returns a shape array from positions array\r\n SolidParticleSystem.prototype._posToShape = function (positions) {\r\n var shape = [];\r\n for (var i = 0; i < positions.length; i += 3) {\r\n shape.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, i));\r\n }\r\n return shape;\r\n };\r\n // returns a shapeUV array from a Vector4 uvs\r\n SolidParticleSystem.prototype._uvsToShapeUV = function (uvs) {\r\n var shapeUV = [];\r\n if (uvs) {\r\n for (var i = 0; i < uvs.length; i++) {\r\n shapeUV.push(uvs[i]);\r\n }\r\n }\r\n return shapeUV;\r\n };\r\n // adds a new particle object in the particles array\r\n SolidParticleSystem.prototype._addParticle = function (idx, idxpos, idxind, model, shapeId, idxInShape, bInfo) {\r\n if (bInfo === void 0) { bInfo = null; }\r\n var sp = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"SolidParticle\"](idx, idxpos, idxind, model, shapeId, idxInShape, this, bInfo);\r\n this.particles.push(sp);\r\n return sp;\r\n };\r\n /**\r\n * Adds some particles to the SPS from the model shape. Returns the shape id.\r\n * Please read the doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#create-an-immutable-sps\r\n * @param mesh is any Mesh object that will be used as a model for the solid particles.\r\n * @param nb (positive integer) the number of particles to be created from this model\r\n * @param options {positionFunction} is an optional javascript function to called for each particle on SPS creation.\r\n * {vertexFunction} is an optional javascript function to called for each vertex of each particle on SPS creation\r\n * @returns the number of shapes in the system\r\n */\r\n SolidParticleSystem.prototype.addShape = function (mesh, nb, options) {\r\n var meshPos = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n var meshInd = mesh.getIndices();\r\n var meshUV = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n var meshCol = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n var meshNor = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var bbInfo;\r\n if (this._particlesIntersect) {\r\n bbInfo = mesh.getBoundingInfo();\r\n }\r\n var shape = this._posToShape(meshPos);\r\n var shapeUV = this._uvsToShapeUV(meshUV);\r\n var posfunc = options ? options.positionFunction : null;\r\n var vtxfunc = options ? options.vertexFunction : null;\r\n var modelShape = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"ModelShape\"](this._shapeCounter, shape, meshInd.length, shapeUV, posfunc, vtxfunc);\r\n // particles\r\n var sp;\r\n var currentCopy;\r\n var idx = this.nbParticles;\r\n for (var i = 0; i < nb; i++) {\r\n var currentPos = this._positions.length;\r\n var currentInd = this._indices.length;\r\n currentCopy = this._meshBuilder(this._index, shape, this._positions, meshInd, this._indices, meshUV, this._uvs, meshCol, this._colors, meshNor, this._normals, idx, i, options);\r\n if (this._updatable) {\r\n sp = this._addParticle(idx, currentPos, currentInd, modelShape, this._shapeCounter, i, bbInfo);\r\n sp.position.copyFrom(currentCopy.position);\r\n sp.rotation.copyFrom(currentCopy.rotation);\r\n if (currentCopy.rotationQuaternion && sp.rotationQuaternion) {\r\n sp.rotationQuaternion.copyFrom(currentCopy.rotationQuaternion);\r\n }\r\n if (currentCopy.color && sp.color) {\r\n sp.color.copyFrom(currentCopy.color);\r\n }\r\n sp.scaling.copyFrom(currentCopy.scaling);\r\n sp.uvs.copyFrom(currentCopy.uvs);\r\n }\r\n this._index += shape.length;\r\n idx++;\r\n }\r\n this.nbParticles += nb;\r\n this._shapeCounter++;\r\n return this._shapeCounter - 1;\r\n };\r\n // rebuilds a particle back to its just built status : if needed, recomputes the custom positions and vertices\r\n SolidParticleSystem.prototype._rebuildParticle = function (particle) {\r\n this._resetCopy();\r\n var copy = this._copy;\r\n if (particle._model._positionFunction) { // recall to stored custom positionFunction\r\n particle._model._positionFunction(copy, particle.idx, particle.idxInShape);\r\n }\r\n var rotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var tmpVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0];\r\n var tmpRotated = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[1];\r\n var pivotBackTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[2];\r\n var scaledPivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[3];\r\n copy.getRotationMatrix(rotMatrix);\r\n particle.pivot.multiplyToRef(particle.scaling, scaledPivot);\r\n if (copy.translateFromPivot) {\r\n pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);\r\n }\r\n else {\r\n pivotBackTranslation.copyFrom(scaledPivot);\r\n }\r\n var shape = particle._model._shape;\r\n for (var pt = 0; pt < shape.length; pt++) {\r\n tmpVertex.copyFrom(shape[pt]);\r\n if (particle._model._vertexFunction) {\r\n particle._model._vertexFunction(copy, tmpVertex, pt); // recall to stored vertexFunction\r\n }\r\n tmpVertex.multiplyInPlace(copy.scaling).subtractInPlace(scaledPivot);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(tmpVertex, rotMatrix, tmpRotated);\r\n tmpRotated.addInPlace(pivotBackTranslation).addInPlace(copy.position).toArray(this._positions32, particle._pos + pt * 3);\r\n }\r\n particle.position.setAll(0.0);\r\n particle.rotation.setAll(0.0);\r\n particle.rotationQuaternion = null;\r\n particle.scaling.setAll(1.0);\r\n particle.uvs.setAll(0.0);\r\n particle.pivot.setAll(0.0);\r\n particle.translateFromPivot = false;\r\n particle.parentId = null;\r\n };\r\n /**\r\n * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.\r\n * @returns the SPS.\r\n */\r\n SolidParticleSystem.prototype.rebuildMesh = function () {\r\n for (var p = 0; p < this.particles.length; p++) {\r\n this._rebuildParticle(this.particles[p]);\r\n }\r\n this.mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, this._positions32, false, false);\r\n return this;\r\n };\r\n /**\r\n * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.\r\n * This method calls `updateParticle()` for each particle of the SPS.\r\n * For an animated SPS, it is usually called within the render loop.\r\n * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_\r\n * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_\r\n * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_\r\n * @returns the SPS.\r\n */\r\n SolidParticleSystem.prototype.setParticles = function (start, end, update) {\r\n if (start === void 0) { start = 0; }\r\n if (end === void 0) { end = this.nbParticles - 1; }\r\n if (update === void 0) { update = true; }\r\n if (!this._updatable) {\r\n return this;\r\n }\r\n // custom beforeUpdate\r\n this.beforeUpdateParticles(start, end, update);\r\n var rotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var invertedMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1];\r\n var mesh = this.mesh;\r\n var colors32 = this._colors32;\r\n var positions32 = this._positions32;\r\n var normals32 = this._normals32;\r\n var uvs32 = this._uvs32;\r\n var indices32 = this._indices32;\r\n var indices = this._indices;\r\n var fixedNormal32 = this._fixedNormal32;\r\n var tempVectors = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3;\r\n var camAxisX = tempVectors[5].copyFromFloats(1.0, 0.0, 0.0);\r\n var camAxisY = tempVectors[6].copyFromFloats(0.0, 1.0, 0.0);\r\n var camAxisZ = tempVectors[7].copyFromFloats(0.0, 0.0, 1.0);\r\n var minimum = tempVectors[8].setAll(Number.MAX_VALUE);\r\n var maximum = tempVectors[9].setAll(-Number.MAX_VALUE);\r\n var camInvertedPosition = tempVectors[10].setAll(0);\r\n // cases when the World Matrix is to be computed first\r\n if (this.billboard || this._depthSort) {\r\n this.mesh.computeWorldMatrix(true);\r\n this.mesh._worldMatrix.invertToRef(invertedMatrix);\r\n }\r\n // if the particles will always face the camera\r\n if (this.billboard) {\r\n // compute the camera position and un-rotate it by the current mesh rotation\r\n var tmpVertex = tempVectors[0];\r\n this._camera.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_9__[\"Axis\"].Z, tmpVertex);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalToRef(tmpVertex, invertedMatrix, camAxisZ);\r\n camAxisZ.normalize();\r\n // same for camera up vector extracted from the cam view matrix\r\n var view = this._camera.getViewMatrix(true);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalFromFloatsToRef(view.m[1], view.m[5], view.m[9], invertedMatrix, camAxisY);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(camAxisY, camAxisZ, camAxisX);\r\n camAxisY.normalize();\r\n camAxisX.normalize();\r\n }\r\n // if depthSort, compute the camera global position in the mesh local system\r\n if (this._depthSort) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(this._camera.globalPosition, invertedMatrix, camInvertedPosition); // then un-rotate the camera\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].IdentityToRef(rotMatrix);\r\n var idx = 0; // current position index in the global array positions32\r\n var index = 0; // position start index in the global array positions32 of the current particle\r\n var colidx = 0; // current color index in the global array colors32\r\n var colorIndex = 0; // color start index in the global array colors32 of the current particle\r\n var uvidx = 0; // current uv index in the global array uvs32\r\n var uvIndex = 0; // uv start index in the global array uvs32 of the current particle\r\n var pt = 0; // current index in the particle model shape\r\n if (this.mesh.isFacetDataEnabled) {\r\n this._computeBoundingBox = true;\r\n }\r\n end = (end >= this.nbParticles) ? this.nbParticles - 1 : end;\r\n if (this._computeBoundingBox) {\r\n if (start != 0 || end != this.nbParticles - 1) { // only some particles are updated, then use the current existing BBox basis. Note : it can only increase.\r\n var boundingInfo = this.mesh._boundingInfo;\r\n if (boundingInfo) {\r\n minimum.copyFrom(boundingInfo.minimum);\r\n maximum.copyFrom(boundingInfo.maximum);\r\n }\r\n }\r\n }\r\n // particle loop\r\n index = this.particles[start]._pos;\r\n var vpos = (index / 3) | 0;\r\n colorIndex = vpos * 4;\r\n uvIndex = vpos * 2;\r\n for (var p = start; p <= end; p++) {\r\n var particle = this.particles[p];\r\n // call to custom user function to update the particle properties\r\n this.updateParticle(particle);\r\n var shape = particle._model._shape;\r\n var shapeUV = particle._model._shapeUV;\r\n var particleRotationMatrix = particle._rotationMatrix;\r\n var particlePosition = particle.position;\r\n var particleRotation = particle.rotation;\r\n var particleScaling = particle.scaling;\r\n var particleGlobalPosition = particle._globalPosition;\r\n // camera-particle distance for depth sorting\r\n if (this._depthSort && this._depthSortParticles) {\r\n var dsp = this.depthSortedParticles[p];\r\n dsp.ind = particle._ind;\r\n dsp.indicesLength = particle._model._indicesLength;\r\n dsp.sqDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].DistanceSquared(particle.position, camInvertedPosition);\r\n }\r\n // skip the computations for inactive or already invisible particles\r\n if (!particle.alive || (particle._stillInvisible && !particle.isVisible)) {\r\n // increment indexes for the next particle\r\n pt = shape.length;\r\n index += pt * 3;\r\n colorIndex += pt * 4;\r\n uvIndex += pt * 2;\r\n continue;\r\n }\r\n if (particle.isVisible) {\r\n particle._stillInvisible = false; // un-mark permanent invisibility\r\n var scaledPivot = tempVectors[12];\r\n particle.pivot.multiplyToRef(particleScaling, scaledPivot);\r\n // particle rotation matrix\r\n if (this.billboard) {\r\n particleRotation.x = 0.0;\r\n particleRotation.y = 0.0;\r\n }\r\n if (this._computeParticleRotation || this.billboard) {\r\n particle.getRotationMatrix(rotMatrix);\r\n }\r\n var particleHasParent = (particle.parentId !== null);\r\n if (particleHasParent) {\r\n var parent_1 = this.particles[particle.parentId];\r\n var parentRotationMatrix = parent_1._rotationMatrix;\r\n var parentGlobalPosition = parent_1._globalPosition;\r\n var rotatedY = particlePosition.x * parentRotationMatrix[1] + particlePosition.y * parentRotationMatrix[4] + particlePosition.z * parentRotationMatrix[7];\r\n var rotatedX = particlePosition.x * parentRotationMatrix[0] + particlePosition.y * parentRotationMatrix[3] + particlePosition.z * parentRotationMatrix[6];\r\n var rotatedZ = particlePosition.x * parentRotationMatrix[2] + particlePosition.y * parentRotationMatrix[5] + particlePosition.z * parentRotationMatrix[8];\r\n particleGlobalPosition.x = parentGlobalPosition.x + rotatedX;\r\n particleGlobalPosition.y = parentGlobalPosition.y + rotatedY;\r\n particleGlobalPosition.z = parentGlobalPosition.z + rotatedZ;\r\n if (this._computeParticleRotation || this.billboard) {\r\n var rotMatrixValues = rotMatrix.m;\r\n particleRotationMatrix[0] = rotMatrixValues[0] * parentRotationMatrix[0] + rotMatrixValues[1] * parentRotationMatrix[3] + rotMatrixValues[2] * parentRotationMatrix[6];\r\n particleRotationMatrix[1] = rotMatrixValues[0] * parentRotationMatrix[1] + rotMatrixValues[1] * parentRotationMatrix[4] + rotMatrixValues[2] * parentRotationMatrix[7];\r\n particleRotationMatrix[2] = rotMatrixValues[0] * parentRotationMatrix[2] + rotMatrixValues[1] * parentRotationMatrix[5] + rotMatrixValues[2] * parentRotationMatrix[8];\r\n particleRotationMatrix[3] = rotMatrixValues[4] * parentRotationMatrix[0] + rotMatrixValues[5] * parentRotationMatrix[3] + rotMatrixValues[6] * parentRotationMatrix[6];\r\n particleRotationMatrix[4] = rotMatrixValues[4] * parentRotationMatrix[1] + rotMatrixValues[5] * parentRotationMatrix[4] + rotMatrixValues[6] * parentRotationMatrix[7];\r\n particleRotationMatrix[5] = rotMatrixValues[4] * parentRotationMatrix[2] + rotMatrixValues[5] * parentRotationMatrix[5] + rotMatrixValues[6] * parentRotationMatrix[8];\r\n particleRotationMatrix[6] = rotMatrixValues[8] * parentRotationMatrix[0] + rotMatrixValues[9] * parentRotationMatrix[3] + rotMatrixValues[10] * parentRotationMatrix[6];\r\n particleRotationMatrix[7] = rotMatrixValues[8] * parentRotationMatrix[1] + rotMatrixValues[9] * parentRotationMatrix[4] + rotMatrixValues[10] * parentRotationMatrix[7];\r\n particleRotationMatrix[8] = rotMatrixValues[8] * parentRotationMatrix[2] + rotMatrixValues[9] * parentRotationMatrix[5] + rotMatrixValues[10] * parentRotationMatrix[8];\r\n }\r\n }\r\n else {\r\n particleGlobalPosition.x = particlePosition.x;\r\n particleGlobalPosition.y = particlePosition.y;\r\n particleGlobalPosition.z = particlePosition.z;\r\n if (this._computeParticleRotation || this.billboard) {\r\n var rotMatrixValues = rotMatrix.m;\r\n particleRotationMatrix[0] = rotMatrixValues[0];\r\n particleRotationMatrix[1] = rotMatrixValues[1];\r\n particleRotationMatrix[2] = rotMatrixValues[2];\r\n particleRotationMatrix[3] = rotMatrixValues[4];\r\n particleRotationMatrix[4] = rotMatrixValues[5];\r\n particleRotationMatrix[5] = rotMatrixValues[6];\r\n particleRotationMatrix[6] = rotMatrixValues[8];\r\n particleRotationMatrix[7] = rotMatrixValues[9];\r\n particleRotationMatrix[8] = rotMatrixValues[10];\r\n }\r\n }\r\n var pivotBackTranslation = tempVectors[11];\r\n if (particle.translateFromPivot) {\r\n pivotBackTranslation.setAll(0.0);\r\n }\r\n else {\r\n pivotBackTranslation.copyFrom(scaledPivot);\r\n }\r\n // particle vertex loop\r\n for (pt = 0; pt < shape.length; pt++) {\r\n idx = index + pt * 3;\r\n colidx = colorIndex + pt * 4;\r\n uvidx = uvIndex + pt * 2;\r\n var tmpVertex = tempVectors[0];\r\n tmpVertex.copyFrom(shape[pt]);\r\n if (this._computeParticleVertex) {\r\n this.updateParticleVertex(particle, tmpVertex, pt);\r\n }\r\n // positions\r\n var vertexX = tmpVertex.x * particleScaling.x - scaledPivot.x;\r\n var vertexY = tmpVertex.y * particleScaling.y - scaledPivot.y;\r\n var vertexZ = tmpVertex.z * particleScaling.z - scaledPivot.z;\r\n var rotatedX = vertexX * particleRotationMatrix[0] + vertexY * particleRotationMatrix[3] + vertexZ * particleRotationMatrix[6];\r\n var rotatedY = vertexX * particleRotationMatrix[1] + vertexY * particleRotationMatrix[4] + vertexZ * particleRotationMatrix[7];\r\n var rotatedZ = vertexX * particleRotationMatrix[2] + vertexY * particleRotationMatrix[5] + vertexZ * particleRotationMatrix[8];\r\n rotatedX += pivotBackTranslation.x;\r\n rotatedY += pivotBackTranslation.y;\r\n rotatedZ += pivotBackTranslation.z;\r\n var px = positions32[idx] = particleGlobalPosition.x + camAxisX.x * rotatedX + camAxisY.x * rotatedY + camAxisZ.x * rotatedZ;\r\n var py = positions32[idx + 1] = particleGlobalPosition.y + camAxisX.y * rotatedX + camAxisY.y * rotatedY + camAxisZ.y * rotatedZ;\r\n var pz = positions32[idx + 2] = particleGlobalPosition.z + camAxisX.z * rotatedX + camAxisY.z * rotatedY + camAxisZ.z * rotatedZ;\r\n if (this._computeBoundingBox) {\r\n minimum.minimizeInPlaceFromFloats(px, py, pz);\r\n maximum.maximizeInPlaceFromFloats(px, py, pz);\r\n }\r\n // normals : if the particles can't be morphed then just rotate the normals, what is much more faster than ComputeNormals()\r\n if (!this._computeParticleVertex) {\r\n var normalx = fixedNormal32[idx];\r\n var normaly = fixedNormal32[idx + 1];\r\n var normalz = fixedNormal32[idx + 2];\r\n var rotatedx = normalx * particleRotationMatrix[0] + normaly * particleRotationMatrix[3] + normalz * particleRotationMatrix[6];\r\n var rotatedy = normalx * particleRotationMatrix[1] + normaly * particleRotationMatrix[4] + normalz * particleRotationMatrix[7];\r\n var rotatedz = normalx * particleRotationMatrix[2] + normaly * particleRotationMatrix[5] + normalz * particleRotationMatrix[8];\r\n normals32[idx] = camAxisX.x * rotatedx + camAxisY.x * rotatedy + camAxisZ.x * rotatedz;\r\n normals32[idx + 1] = camAxisX.y * rotatedx + camAxisY.y * rotatedy + camAxisZ.y * rotatedz;\r\n normals32[idx + 2] = camAxisX.z * rotatedx + camAxisY.z * rotatedy + camAxisZ.z * rotatedz;\r\n }\r\n if (this._computeParticleColor && particle.color) {\r\n var color = particle.color;\r\n var colors32_1 = this._colors32;\r\n colors32_1[colidx] = color.r;\r\n colors32_1[colidx + 1] = color.g;\r\n colors32_1[colidx + 2] = color.b;\r\n colors32_1[colidx + 3] = color.a;\r\n }\r\n if (this._computeParticleTexture) {\r\n var uvs = particle.uvs;\r\n uvs32[uvidx] = shapeUV[pt * 2] * (uvs.z - uvs.x) + uvs.x;\r\n uvs32[uvidx + 1] = shapeUV[pt * 2 + 1] * (uvs.w - uvs.y) + uvs.y;\r\n }\r\n }\r\n }\r\n // particle just set invisible : scaled to zero and positioned at the origin\r\n else {\r\n particle._stillInvisible = true; // mark the particle as invisible\r\n for (pt = 0; pt < shape.length; pt++) {\r\n idx = index + pt * 3;\r\n colidx = colorIndex + pt * 4;\r\n uvidx = uvIndex + pt * 2;\r\n positions32[idx] = positions32[idx + 1] = positions32[idx + 2] = 0;\r\n normals32[idx] = normals32[idx + 1] = normals32[idx + 2] = 0;\r\n if (this._computeParticleColor && particle.color) {\r\n var color = particle.color;\r\n colors32[colidx] = color.r;\r\n colors32[colidx + 1] = color.g;\r\n colors32[colidx + 2] = color.b;\r\n colors32[colidx + 3] = color.a;\r\n }\r\n if (this._computeParticleTexture) {\r\n var uvs = particle.uvs;\r\n uvs32[uvidx] = shapeUV[pt * 2] * (uvs.z - uvs.x) + uvs.x;\r\n uvs32[uvidx + 1] = shapeUV[pt * 2 + 1] * (uvs.w - uvs.y) + uvs.y;\r\n }\r\n }\r\n }\r\n // if the particle intersections must be computed : update the bbInfo\r\n if (this._particlesIntersect) {\r\n var bInfo = particle._boundingInfo;\r\n var bBox = bInfo.boundingBox;\r\n var bSphere = bInfo.boundingSphere;\r\n var modelBoundingInfo = particle._modelBoundingInfo;\r\n if (!this._bSphereOnly) {\r\n // place, scale and rotate the particle bbox within the SPS local system, then update it\r\n var modelBoundingInfoVectors = modelBoundingInfo.boundingBox.vectors;\r\n var tempMin = tempVectors[1];\r\n var tempMax = tempVectors[2];\r\n tempMin.setAll(Number.MAX_VALUE);\r\n tempMax.setAll(-Number.MAX_VALUE);\r\n for (var b = 0; b < 8; b++) {\r\n var scaledX = modelBoundingInfoVectors[b].x * particleScaling.x;\r\n var scaledY = modelBoundingInfoVectors[b].y * particleScaling.y;\r\n var scaledZ = modelBoundingInfoVectors[b].z * particleScaling.z;\r\n var rotatedX = scaledX * particleRotationMatrix[0] + scaledY * particleRotationMatrix[3] + scaledZ * particleRotationMatrix[6];\r\n var rotatedY = scaledX * particleRotationMatrix[1] + scaledY * particleRotationMatrix[4] + scaledZ * particleRotationMatrix[7];\r\n var rotatedZ = scaledX * particleRotationMatrix[2] + scaledY * particleRotationMatrix[5] + scaledZ * particleRotationMatrix[8];\r\n var x = particlePosition.x + camAxisX.x * rotatedX + camAxisY.x * rotatedY + camAxisZ.x * rotatedZ;\r\n var y = particlePosition.y + camAxisX.y * rotatedX + camAxisY.y * rotatedY + camAxisZ.y * rotatedZ;\r\n var z = particlePosition.z + camAxisX.z * rotatedX + camAxisY.z * rotatedY + camAxisZ.z * rotatedZ;\r\n tempMin.minimizeInPlaceFromFloats(x, y, z);\r\n tempMax.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n bBox.reConstruct(tempMin, tempMax, mesh._worldMatrix);\r\n }\r\n // place and scale the particle bouding sphere in the SPS local system, then update it\r\n var minBbox = modelBoundingInfo.minimum.multiplyToRef(particleScaling, tempVectors[1]);\r\n var maxBbox = modelBoundingInfo.maximum.multiplyToRef(particleScaling, tempVectors[2]);\r\n var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5).addInPlace(particleGlobalPosition);\r\n var halfDiag = maxBbox.subtractToRef(minBbox, tempVectors[4]).scaleInPlace(0.5 * this._bSphereRadiusFactor);\r\n var bSphereMinBbox = bSphereCenter.subtractToRef(halfDiag, tempVectors[1]);\r\n var bSphereMaxBbox = bSphereCenter.addToRef(halfDiag, tempVectors[2]);\r\n bSphere.reConstruct(bSphereMinBbox, bSphereMaxBbox, mesh._worldMatrix);\r\n }\r\n // increment indexes for the next particle\r\n index = idx + 3;\r\n colorIndex = colidx + 4;\r\n uvIndex = uvidx + 2;\r\n }\r\n // if the VBO must be updated\r\n if (update) {\r\n if (this._computeParticleColor) {\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind, colors32, false, false);\r\n }\r\n if (this._computeParticleTexture) {\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind, uvs32, false, false);\r\n }\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, positions32, false, false);\r\n if (!mesh.areNormalsFrozen || mesh.isFacetDataEnabled) {\r\n if (this._computeParticleVertex || mesh.isFacetDataEnabled) {\r\n // recompute the normals only if the particles can be morphed, update then also the normal reference array _fixedNormal32[]\r\n var params = mesh.isFacetDataEnabled ? mesh.getFacetDataParameters() : null;\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions32, indices32, normals32, params);\r\n for (var i = 0; i < normals32.length; i++) {\r\n fixedNormal32[i] = normals32[i];\r\n }\r\n }\r\n if (!mesh.areNormalsFrozen) {\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind, normals32, false, false);\r\n }\r\n }\r\n if (this._depthSort && this._depthSortParticles) {\r\n var depthSortedParticles = this.depthSortedParticles;\r\n depthSortedParticles.sort(depthSortFunction);\r\n var dspl = depthSortedParticles.length;\r\n var sid = 0;\r\n for (var sorted = 0; sorted < dspl; sorted++) {\r\n var lind = depthSortedParticles[sorted].indicesLength;\r\n var sind = depthSortedParticles[sorted].ind;\r\n for (var i = 0; i < lind; i++) {\r\n indices32[sid] = indices[sind + i];\r\n sid++;\r\n }\r\n }\r\n mesh.updateIndices(indices32);\r\n }\r\n }\r\n if (this._computeBoundingBox) {\r\n if (mesh._boundingInfo) {\r\n mesh._boundingInfo.reConstruct(minimum, maximum, mesh._worldMatrix);\r\n }\r\n else {\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__[\"BoundingInfo\"](minimum, maximum, mesh._worldMatrix);\r\n }\r\n }\r\n this.afterUpdateParticles(start, end, update);\r\n return this;\r\n };\r\n /**\r\n * Disposes the SPS.\r\n */\r\n SolidParticleSystem.prototype.dispose = function () {\r\n this.mesh.dispose();\r\n this.vars = null;\r\n // drop references to internal big arrays for the GC\r\n this._positions = null;\r\n this._indices = null;\r\n this._normals = null;\r\n this._uvs = null;\r\n this._colors = null;\r\n this._indices32 = null;\r\n this._positions32 = null;\r\n this._normals32 = null;\r\n this._fixedNormal32 = null;\r\n this._uvs32 = null;\r\n this._colors32 = null;\r\n this.pickedParticles = null;\r\n };\r\n /**\r\n * Visibilty helper : Recomputes the visible size according to the mesh bounding box\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n * @returns the SPS.\r\n */\r\n SolidParticleSystem.prototype.refreshVisibleSize = function () {\r\n if (!this._isVisibilityBoxLocked) {\r\n this.mesh.refreshBoundingInfo();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.\r\n * @param size the size (float) of the visibility box\r\n * note : this doesn't lock the SPS mesh bounding box.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n SolidParticleSystem.prototype.setVisibilityBox = function (size) {\r\n var vis = size / 2;\r\n this.mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__[\"BoundingInfo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-vis, -vis, -vis), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vis, vis, vis));\r\n };\r\n Object.defineProperty(SolidParticleSystem.prototype, \"isAlwaysVisible\", {\r\n /**\r\n * Gets whether the SPS as always visible or not\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n get: function () {\r\n return this._alwaysVisible;\r\n },\r\n /**\r\n * Sets the SPS as always visible or not\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n set: function (val) {\r\n this._alwaysVisible = val;\r\n this.mesh.alwaysSelectAsActiveMesh = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"isVisibilityBoxLocked\", {\r\n /**\r\n * Gets if the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n get: function () {\r\n return this._isVisibilityBoxLocked;\r\n },\r\n /**\r\n * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n set: function (val) {\r\n this._isVisibilityBoxLocked = val;\r\n var boundingInfo = this.mesh.getBoundingInfo();\r\n boundingInfo.isLocked = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleRotation\", {\r\n /**\r\n * Gets if `setParticles()` computes the particle rotations or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.\r\n */\r\n get: function () {\r\n return this._computeParticleRotation;\r\n },\r\n /**\r\n * Tells to `setParticles()` to compute the particle rotations or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.\r\n */\r\n set: function (val) {\r\n this._computeParticleRotation = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleColor\", {\r\n /**\r\n * Gets if `setParticles()` computes the particle colors or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.\r\n */\r\n get: function () {\r\n return this._computeParticleColor;\r\n },\r\n /**\r\n * Tells to `setParticles()` to compute the particle colors or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.\r\n */\r\n set: function (val) {\r\n this._computeParticleColor = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleTexture\", {\r\n /**\r\n * Gets if `setParticles()` computes the particle textures or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.\r\n */\r\n get: function () {\r\n return this._computeParticleTexture;\r\n },\r\n set: function (val) {\r\n this._computeParticleTexture = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleVertex\", {\r\n /**\r\n * Gets if `setParticles()` calls the vertex function for each vertex of each particle, or not.\r\n * Default value : false. The SPS is faster when it's set to false.\r\n * Note : the particle custom vertex positions aren't stored values.\r\n */\r\n get: function () {\r\n return this._computeParticleVertex;\r\n },\r\n /**\r\n * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.\r\n * Default value : false. The SPS is faster when it's set to false.\r\n * Note : the particle custom vertex positions aren't stored values.\r\n */\r\n set: function (val) {\r\n this._computeParticleVertex = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeBoundingBox\", {\r\n /**\r\n * Gets if `setParticles()` computes or not the mesh bounding box when computing the particle positions.\r\n */\r\n get: function () {\r\n return this._computeBoundingBox;\r\n },\r\n /**\r\n * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.\r\n */\r\n set: function (val) {\r\n this._computeBoundingBox = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"depthSortParticles\", {\r\n /**\r\n * Gets if `setParticles()` sorts or not the distance between each particle and the camera.\r\n * Skipped when `enableDepthSort` is set to `false` (default) at construction time.\r\n * Default : `true`\r\n */\r\n get: function () {\r\n return this._depthSortParticles;\r\n },\r\n /**\r\n * Tells to `setParticles()` to sort or not the distance between each particle and the camera.\r\n * Skipped when `enableDepthSort` is set to `false` (default) at construction time.\r\n * Default : `true`\r\n */\r\n set: function (val) {\r\n this._depthSortParticles = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // =======================================================================\r\n // Particle behavior logic\r\n // these following methods may be overwritten by the user to fit his needs\r\n /**\r\n * This function does nothing. It may be overwritten to set all the particle first values.\r\n * The SPS doesn't call this function, you may have to call it by your own.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management\r\n */\r\n SolidParticleSystem.prototype.initParticles = function () {\r\n };\r\n /**\r\n * This function does nothing. It may be overwritten to recycle a particle.\r\n * The SPS doesn't call this function, you may have to call it by your own.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management\r\n * @param particle The particle to recycle\r\n * @returns the recycled particle\r\n */\r\n SolidParticleSystem.prototype.recycleParticle = function (particle) {\r\n return particle;\r\n };\r\n /**\r\n * Updates a particle : this function should be overwritten by the user.\r\n * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management\r\n * @example : just set a particle position or velocity and recycle conditions\r\n * @param particle The particle to update\r\n * @returns the updated particle\r\n */\r\n SolidParticleSystem.prototype.updateParticle = function (particle) {\r\n return particle;\r\n };\r\n /**\r\n * Updates a vertex of a particle : it can be overwritten by the user.\r\n * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.\r\n * @param particle the current particle\r\n * @param vertex the current index of the current particle\r\n * @param pt the index of the current vertex in the particle shape\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#update-each-particle-shape\r\n * @example : just set a vertex particle position\r\n * @returns the updated vertex\r\n */\r\n SolidParticleSystem.prototype.updateParticleVertex = function (particle, vertex, pt) {\r\n return vertex;\r\n };\r\n /**\r\n * This will be called before any other treatment by `setParticles()` and will be passed three parameters.\r\n * This does nothing and may be overwritten by the user.\r\n * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param update the boolean update value actually passed to setParticles()\r\n */\r\n SolidParticleSystem.prototype.beforeUpdateParticles = function (start, stop, update) {\r\n };\r\n /**\r\n * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.\r\n * This will be passed three parameters.\r\n * This does nothing and may be overwritten by the user.\r\n * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param update the boolean update value actually passed to setParticles()\r\n */\r\n SolidParticleSystem.prototype.afterUpdateParticles = function (start, stop, update) {\r\n };\r\n return SolidParticleSystem;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/subEmitter.ts\":\n/*!*********************************!*\\\n !*** ./Particles/subEmitter.ts ***!\n \\*********************************/\n/*! exports provided: SubEmitterType, SubEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return SubEmitterType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return SubEmitter; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Type of sub emitter\r\n */\r\nvar SubEmitterType;\r\n(function (SubEmitterType) {\r\n /**\r\n * Attached to the particle over it's lifetime\r\n */\r\n SubEmitterType[SubEmitterType[\"ATTACHED\"] = 0] = \"ATTACHED\";\r\n /**\r\n * Created when the particle dies\r\n */\r\n SubEmitterType[SubEmitterType[\"END\"] = 1] = \"END\";\r\n})(SubEmitterType || (SubEmitterType = {}));\r\n/**\r\n * Sub emitter class used to emit particles from an existing particle\r\n */\r\nvar SubEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a sub emitter\r\n * @param particleSystem the particle system to be used by the sub emitter\r\n */\r\n function SubEmitter(\r\n /**\r\n * the particle system to be used by the sub emitter\r\n */\r\n particleSystem) {\r\n this.particleSystem = particleSystem;\r\n /**\r\n * Type of the submitter (Default: END)\r\n */\r\n this.type = SubEmitterType.END;\r\n /**\r\n * If the particle should inherit the direction from the particle it's attached to. (+Y will face the direction the particle is moving) (Default: false)\r\n * Note: This only is supported when using an emitter of type Mesh\r\n */\r\n this.inheritDirection = false;\r\n /**\r\n * How much of the attached particles speed should be added to the sub emitted particle (default: 0)\r\n */\r\n this.inheritedVelocityAmount = 0;\r\n // Create mesh as emitter to support rotation\r\n if (!particleSystem.emitter || !particleSystem.emitter.dispose) {\r\n particleSystem.emitter = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"](\"SubemitterSystemEmitter\", particleSystem.getScene());\r\n }\r\n // Automatically dispose of subemitter when system is disposed\r\n particleSystem.onDisposeObservable.add(function () {\r\n if (particleSystem.emitter && particleSystem.emitter.dispose) {\r\n particleSystem.emitter.dispose();\r\n }\r\n });\r\n }\r\n /**\r\n * Clones the sub emitter\r\n * @returns the cloned sub emitter\r\n */\r\n SubEmitter.prototype.clone = function () {\r\n // Clone particle system\r\n var emitter = this.particleSystem.emitter;\r\n if (!emitter) {\r\n emitter = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n }\r\n else if (emitter instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]) {\r\n emitter = emitter.clone();\r\n }\r\n else if (emitter instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"]) {\r\n emitter = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"\", emitter.getScene());\r\n emitter.isVisible = false;\r\n }\r\n var clone = new SubEmitter(this.particleSystem.clone(\"\", emitter));\r\n // Clone properties\r\n clone.particleSystem.name += \"Clone\";\r\n clone.type = this.type;\r\n clone.inheritDirection = this.inheritDirection;\r\n clone.inheritedVelocityAmount = this.inheritedVelocityAmount;\r\n clone.particleSystem._disposeEmitterOnDispose = true;\r\n clone.particleSystem.disposeOnStop = true;\r\n return clone;\r\n };\r\n /**\r\n * Serialize current object to a JSON object\r\n * @returns the serialized object\r\n */\r\n SubEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.type;\r\n serializationObject.inheritDirection = this.inheritDirection;\r\n serializationObject.inheritedVelocityAmount = this.inheritedVelocityAmount;\r\n serializationObject.particleSystem = this.particleSystem.serialize();\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n SubEmitter._ParseParticleSystem = function (system, scene, rootUrl) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__[\"_DevTools\"].WarnImport(\"ParseParticle\");\r\n };\r\n /**\r\n * Creates a new SubEmitter from a serialized JSON version\r\n * @param serializationObject defines the JSON object to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the rootUrl for data loading\r\n * @returns a new SubEmitter\r\n */\r\n SubEmitter.Parse = function (serializationObject, scene, rootUrl) {\r\n var system = serializationObject.particleSystem;\r\n var subEmitter = new SubEmitter(SubEmitter._ParseParticleSystem(system, scene, rootUrl));\r\n subEmitter.type = serializationObject.type;\r\n subEmitter.inheritDirection = serializationObject.inheritDirection;\r\n subEmitter.inheritedVelocityAmount = serializationObject.inheritedVelocityAmount;\r\n subEmitter.particleSystem._isSubEmitter = true;\r\n return subEmitter;\r\n };\r\n /** Release associated resources */\r\n SubEmitter.prototype.dispose = function () {\r\n this.particleSystem.dispose();\r\n };\r\n return SubEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/ammoJSPlugin.ts\":\n/*!*****************************************!*\\\n !*** ./Physics/Plugins/ammoJSPlugin.ts ***!\n \\*****************************************/\n/*! exports provided: AmmoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return AmmoJSPlugin; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Physics/physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Meshes/Builders/shapeBuilder */ \"./Meshes/Builders/shapeBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../physicsRaycastResult */ \"./Physics/physicsRaycastResult.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * AmmoJS Physics plugin\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n * @see https://github.com/kripken/ammo.js/\r\n */\r\nvar AmmoJSPlugin = /** @class */ (function () {\r\n /**\r\n * Initializes the ammoJS plugin\r\n * @param _useDeltaForWorldStep if the time between frames should be used when calculating physics steps (Default: true)\r\n * @param ammoInjection can be used to inject your own ammo reference\r\n * @param overlappingPairCache can be used to specify your own overlapping pair cache\r\n */\r\n function AmmoJSPlugin(_useDeltaForWorldStep, ammoInjection, overlappingPairCache) {\r\n var _this = this;\r\n if (_useDeltaForWorldStep === void 0) { _useDeltaForWorldStep = true; }\r\n if (ammoInjection === void 0) { ammoInjection = Ammo; }\r\n if (overlappingPairCache === void 0) { overlappingPairCache = null; }\r\n this._useDeltaForWorldStep = _useDeltaForWorldStep;\r\n /**\r\n * Reference to the Ammo library\r\n */\r\n this.bjsAMMO = {};\r\n /**\r\n * Name of the plugin\r\n */\r\n this.name = \"AmmoJSPlugin\";\r\n this._timeStep = 1 / 60;\r\n this._fixedTimeStep = 1 / 60;\r\n this._maxSteps = 5;\r\n this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]();\r\n this._tmpContactCallbackResult = false;\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]();\r\n if (typeof ammoInjection === \"function\") {\r\n ammoInjection(this.bjsAMMO);\r\n }\r\n else {\r\n this.bjsAMMO = ammoInjection;\r\n }\r\n if (!this.isSupported()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"AmmoJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n // Initialize the physics world\r\n this._collisionConfiguration = new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration();\r\n this._dispatcher = new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration);\r\n this._overlappingPairCache = overlappingPairCache || new this.bjsAMMO.btDbvtBroadphase();\r\n this._solver = new this.bjsAMMO.btSequentialImpulseConstraintSolver();\r\n this._softBodySolver = new this.bjsAMMO.btDefaultSoftBodySolver();\r\n this.world = new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher, this._overlappingPairCache, this._solver, this._collisionConfiguration, this._softBodySolver);\r\n this._tmpAmmoConcreteContactResultCallback = new this.bjsAMMO.ConcreteContactResultCallback();\r\n this._tmpAmmoConcreteContactResultCallback.addSingleResult = function () { _this._tmpContactCallbackResult = true; };\r\n this._raycastResult = new _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_8__[\"PhysicsRaycastResult\"]();\r\n // Create temp ammo variables\r\n this._tmpAmmoTransform = new this.bjsAMMO.btTransform();\r\n this._tmpAmmoTransform.setIdentity();\r\n this._tmpAmmoQuaternion = new this.bjsAMMO.btQuaternion(0, 0, 0, 1);\r\n this._tmpAmmoVectorA = new this.bjsAMMO.btVector3(0, 0, 0);\r\n this._tmpAmmoVectorB = new this.bjsAMMO.btVector3(0, 0, 0);\r\n this._tmpAmmoVectorC = new this.bjsAMMO.btVector3(0, 0, 0);\r\n this._tmpAmmoVectorD = new this.bjsAMMO.btVector3(0, 0, 0);\r\n }\r\n /**\r\n * Sets the gravity of the physics world (m/(s^2))\r\n * @param gravity Gravity to set\r\n */\r\n AmmoJSPlugin.prototype.setGravity = function (gravity) {\r\n this._tmpAmmoVectorA.setValue(gravity.x, gravity.y, gravity.z);\r\n this.world.setGravity(this._tmpAmmoVectorA);\r\n this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA);\r\n };\r\n /**\r\n * Amount of time to step forward on each frame (only used if useDeltaForWorldStep is false in the constructor)\r\n * @param timeStep timestep to use in seconds\r\n */\r\n AmmoJSPlugin.prototype.setTimeStep = function (timeStep) {\r\n this._timeStep = timeStep;\r\n };\r\n /**\r\n * Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)\r\n * @param fixedTimeStep fixedTimeStep to use in seconds\r\n */\r\n AmmoJSPlugin.prototype.setFixedTimeStep = function (fixedTimeStep) {\r\n this._fixedTimeStep = fixedTimeStep;\r\n };\r\n /**\r\n * Sets the maximum number of steps by the physics engine per frame (Default: 5)\r\n * @param maxSteps the maximum number of steps by the physics engine per frame\r\n */\r\n AmmoJSPlugin.prototype.setMaxSteps = function (maxSteps) {\r\n this._maxSteps = maxSteps;\r\n };\r\n /**\r\n * Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)\r\n * @returns the current timestep in seconds\r\n */\r\n AmmoJSPlugin.prototype.getTimeStep = function () {\r\n return this._timeStep;\r\n };\r\n // Ammo's contactTest and contactPairTest take a callback that runs synchronously, wrap them so that they are easier to consume\r\n AmmoJSPlugin.prototype._isImpostorInContact = function (impostor) {\r\n this._tmpContactCallbackResult = false;\r\n this.world.contactTest(impostor.physicsBody, this._tmpAmmoConcreteContactResultCallback);\r\n return this._tmpContactCallbackResult;\r\n };\r\n // Ammo's collision events have some weird quirks\r\n // contactPairTest fires too many events as it fires events even when objects are close together but contactTest does not\r\n // so only fire event if both contactTest and contactPairTest have a hit\r\n AmmoJSPlugin.prototype._isImpostorPairInContact = function (impostorA, impostorB) {\r\n this._tmpContactCallbackResult = false;\r\n this.world.contactPairTest(impostorA.physicsBody, impostorB.physicsBody, this._tmpAmmoConcreteContactResultCallback);\r\n return this._tmpContactCallbackResult;\r\n };\r\n // Ammo's behavior when maxSteps > 0 does not behave as described in docs\r\n // @see http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World\r\n //\r\n // When maxSteps is 0 do the entire simulation in one step\r\n // When maxSteps is > 0, run up to maxStep times, if on the last step the (remaining step - fixedTimeStep) is < fixedTimeStep, the remainder will be used for the step. (eg. if remainder is 1.001 and fixedTimeStep is 1 the last step will be 1.001, if instead it did 2 steps (1, 0.001) issues occuered when having a tiny step in ammo)\r\n // Note: To get deterministic physics, timeStep would always need to be divisible by fixedTimeStep\r\n AmmoJSPlugin.prototype._stepSimulation = function (timeStep, maxSteps, fixedTimeStep) {\r\n if (timeStep === void 0) { timeStep = 1 / 60; }\r\n if (maxSteps === void 0) { maxSteps = 10; }\r\n if (fixedTimeStep === void 0) { fixedTimeStep = 1 / 60; }\r\n if (maxSteps == 0) {\r\n this.world.stepSimulation(timeStep, 0);\r\n }\r\n else {\r\n while (maxSteps > 0 && timeStep > 0) {\r\n if (timeStep - fixedTimeStep < fixedTimeStep) {\r\n this.world.stepSimulation(timeStep, 0);\r\n timeStep = 0;\r\n }\r\n else {\r\n timeStep -= fixedTimeStep;\r\n this.world.stepSimulation(fixedTimeStep, 0);\r\n }\r\n maxSteps--;\r\n }\r\n }\r\n };\r\n /**\r\n * Moves the physics simulation forward delta seconds and updates the given physics imposters\r\n * Prior to the step the imposters physics location is set to the position of the babylon meshes\r\n * After the step the babylon meshes are set to the position of the physics imposters\r\n * @param delta amount of time to step forward\r\n * @param impostors array of imposters to update before/after the step\r\n */\r\n AmmoJSPlugin.prototype.executeStep = function (delta, impostors) {\r\n for (var _i = 0, impostors_1 = impostors; _i < impostors_1.length; _i++) {\r\n var impostor = impostors_1[_i];\r\n // Update physics world objects to match babylon world\r\n if (!impostor.soft) {\r\n impostor.beforeStep();\r\n }\r\n }\r\n this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps, this._fixedTimeStep);\r\n for (var _a = 0, impostors_2 = impostors; _a < impostors_2.length; _a++) {\r\n var mainImpostor = impostors_2[_a];\r\n // After physics update make babylon world objects match physics world objects\r\n if (mainImpostor.soft) {\r\n this._afterSoftStep(mainImpostor);\r\n }\r\n else {\r\n mainImpostor.afterStep();\r\n }\r\n // Handle collision event\r\n if (mainImpostor._onPhysicsCollideCallbacks.length > 0) {\r\n if (this._isImpostorInContact(mainImpostor)) {\r\n for (var _b = 0, _c = mainImpostor._onPhysicsCollideCallbacks; _b < _c.length; _b++) {\r\n var collideCallback = _c[_b];\r\n for (var _d = 0, _e = collideCallback.otherImpostors; _d < _e.length; _d++) {\r\n var otherImpostor = _e[_d];\r\n if (mainImpostor.physicsBody.isActive() || otherImpostor.physicsBody.isActive()) {\r\n if (this._isImpostorPairInContact(mainImpostor, otherImpostor)) {\r\n mainImpostor.onCollide({ body: otherImpostor.physicsBody });\r\n otherImpostor.onCollide({ body: mainImpostor.physicsBody });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Update babylon mesh to match physics world object\r\n * @param impostor imposter to match\r\n */\r\n AmmoJSPlugin.prototype._afterSoftStep = function (impostor) {\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].RopeImpostor) {\r\n this._ropeStep(impostor);\r\n }\r\n else {\r\n this._softbodyOrClothStep(impostor);\r\n }\r\n };\r\n /**\r\n * Update babylon mesh vertices vertices to match physics world softbody or cloth\r\n * @param impostor imposter to match\r\n */\r\n AmmoJSPlugin.prototype._ropeStep = function (impostor) {\r\n var bodyVertices = impostor.physicsBody.get_m_nodes();\r\n var nbVertices = bodyVertices.size();\r\n var node;\r\n var nodePositions;\r\n var x, y, z;\r\n var path = new Array();\r\n for (var n = 0; n < nbVertices; n++) {\r\n node = bodyVertices.at(n);\r\n nodePositions = node.get_m_x();\r\n x = nodePositions.x();\r\n y = nodePositions.y();\r\n z = nodePositions.z();\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](x, y, z));\r\n }\r\n var object = impostor.object;\r\n var shape = impostor.getParam(\"shape\");\r\n if (impostor._isFromLine) {\r\n impostor.object = _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_7__[\"LinesBuilder\"].CreateLines(\"lines\", { points: path, instance: object });\r\n }\r\n else {\r\n impostor.object = _Meshes_Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_6__[\"ShapeBuilder\"].ExtrudeShape(\"ext\", { shape: shape, path: path, instance: object });\r\n }\r\n };\r\n /**\r\n * Update babylon mesh vertices vertices to match physics world softbody or cloth\r\n * @param impostor imposter to match\r\n */\r\n AmmoJSPlugin.prototype._softbodyOrClothStep = function (impostor) {\r\n var normalDirection = (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].ClothImpostor) ? 1 : -1;\r\n var object = impostor.object;\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n var vertexNormals = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].NormalKind);\r\n if (!vertexNormals) {\r\n vertexNormals = [];\r\n }\r\n var nbVertices = vertexPositions.length / 3;\r\n var bodyVertices = impostor.physicsBody.get_m_nodes();\r\n var node;\r\n var nodePositions;\r\n var nodeNormals;\r\n var x, y, z;\r\n var nx, ny, nz;\r\n for (var n = 0; n < nbVertices; n++) {\r\n node = bodyVertices.at(n);\r\n nodePositions = node.get_m_x();\r\n x = nodePositions.x();\r\n y = nodePositions.y();\r\n z = nodePositions.z() * normalDirection;\r\n var nodeNormals = node.get_m_n();\r\n nx = nodeNormals.x();\r\n ny = nodeNormals.y();\r\n nz = nodeNormals.z() * normalDirection;\r\n vertexPositions[3 * n] = x;\r\n vertexPositions[3 * n + 1] = y;\r\n vertexPositions[3 * n + 2] = z;\r\n vertexNormals[3 * n] = nx;\r\n vertexNormals[3 * n + 1] = ny;\r\n vertexNormals[3 * n + 2] = nz;\r\n }\r\n var vertex_data = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"]();\r\n vertex_data.positions = vertexPositions;\r\n vertex_data.normals = vertexNormals;\r\n vertex_data.uvs = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind);\r\n vertex_data.colors = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind);\r\n if (object && object.getIndices) {\r\n vertex_data.indices = object.getIndices();\r\n }\r\n vertex_data.applyToMesh(object);\r\n };\r\n /**\r\n * Applies an impulse on the imposter\r\n * @param impostor imposter to apply impulse to\r\n * @param force amount of force to be applied to the imposter\r\n * @param contactPoint the location to apply the impulse on the imposter\r\n */\r\n AmmoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {\r\n if (!impostor.soft) {\r\n impostor.physicsBody.activate();\r\n var worldPoint = this._tmpAmmoVectorA;\r\n var impulse = this._tmpAmmoVectorB;\r\n // Convert contactPoint into world space\r\n if (impostor.object && impostor.object.getWorldMatrix) {\r\n impostor.object.getWorldMatrix().invertToRef(this._tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(contactPoint, this._tmpMatrix, this._tmpVector);\r\n contactPoint = this._tmpVector;\r\n }\r\n worldPoint.setValue(contactPoint.x, contactPoint.y, contactPoint.z);\r\n impulse.setValue(force.x, force.y, force.z);\r\n impostor.physicsBody.applyImpulse(impulse, worldPoint);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Cannot be applied to a soft body\");\r\n }\r\n };\r\n /**\r\n * Applies a force on the imposter\r\n * @param impostor imposter to apply force\r\n * @param force amount of force to be applied to the imposter\r\n * @param contactPoint the location to apply the force on the imposter\r\n */\r\n AmmoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {\r\n if (!impostor.soft) {\r\n impostor.physicsBody.activate();\r\n var worldPoint = this._tmpAmmoVectorA;\r\n var impulse = this._tmpAmmoVectorB;\r\n // Convert contactPoint into world space\r\n if (impostor.object && impostor.object.getWorldMatrix) {\r\n impostor.object.getWorldMatrix().invertToRef(this._tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(contactPoint, this._tmpMatrix, this._tmpVector);\r\n contactPoint = this._tmpVector;\r\n }\r\n worldPoint.setValue(contactPoint.x, contactPoint.y, contactPoint.z);\r\n impulse.setValue(force.x, force.y, force.z);\r\n impostor.physicsBody.applyForce(impulse, worldPoint);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Cannot be applied to a soft body\");\r\n }\r\n };\r\n /**\r\n * Creates a physics body using the plugin\r\n * @param impostor the imposter to create the physics body on\r\n */\r\n AmmoJSPlugin.prototype.generatePhysicsBody = function (impostor) {\r\n // Note: this method will not be called on child imposotrs for compound impostors\r\n impostor._pluginData.toDispose = [];\r\n //parent-child relationship\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n if (impostor.isBodyInitRequired()) {\r\n var colShape = this._createShape(impostor);\r\n var mass = impostor.getParam(\"mass\");\r\n impostor._pluginData.mass = mass;\r\n if (impostor.soft) {\r\n colShape.get_m_cfg().set_collisions(0x11);\r\n colShape.get_m_cfg().set_kDP(impostor.getParam(\"damping\"));\r\n Ammo.castObject(colShape, Ammo.btCollisionObject).getCollisionShape().setMargin(impostor.getParam(\"margin\"));\r\n colShape.setActivationState(AmmoJSPlugin.DISABLE_DEACTIVATION_FLAG);\r\n this.world.addSoftBody(colShape, 1, -1);\r\n impostor.physicsBody = colShape;\r\n impostor._pluginData.toDispose.push(colShape);\r\n this.setBodyPressure(impostor, 0);\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SoftbodyImpostor) {\r\n this.setBodyPressure(impostor, impostor.getParam(\"pressure\"));\r\n }\r\n this.setBodyStiffness(impostor, impostor.getParam(\"stiffness\"));\r\n this.setBodyVelocityIterations(impostor, impostor.getParam(\"velocityIterations\"));\r\n this.setBodyPositionIterations(impostor, impostor.getParam(\"positionIterations\"));\r\n }\r\n else {\r\n var localInertia = new Ammo.btVector3(0, 0, 0);\r\n var startTransform = new Ammo.btTransform();\r\n startTransform.setIdentity();\r\n if (mass !== 0) {\r\n colShape.calculateLocalInertia(mass, localInertia);\r\n }\r\n this._tmpAmmoVectorA.setValue(impostor.object.position.x, impostor.object.position.y, impostor.object.position.z);\r\n this._tmpAmmoQuaternion.setValue(impostor.object.rotationQuaternion.x, impostor.object.rotationQuaternion.y, impostor.object.rotationQuaternion.z, impostor.object.rotationQuaternion.w);\r\n startTransform.setOrigin(this._tmpAmmoVectorA);\r\n startTransform.setRotation(this._tmpAmmoQuaternion);\r\n var myMotionState = new Ammo.btDefaultMotionState(startTransform);\r\n var rbInfo = new Ammo.btRigidBodyConstructionInfo(mass, myMotionState, colShape, localInertia);\r\n var body = new Ammo.btRigidBody(rbInfo);\r\n // Make objects kinematic if it's mass is 0\r\n if (mass === 0) {\r\n body.setCollisionFlags(body.getCollisionFlags() | AmmoJSPlugin.KINEMATIC_FLAG);\r\n body.setActivationState(AmmoJSPlugin.DISABLE_DEACTIVATION_FLAG);\r\n }\r\n // Disable collision if NoImpostor, but keep collision if shape is btCompoundShape\r\n if (impostor.type == _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].NoImpostor && !colShape.getChildShape) {\r\n body.setCollisionFlags(body.getCollisionFlags() | AmmoJSPlugin.DISABLE_COLLISION_FLAG);\r\n }\r\n this.world.addRigidBody(body);\r\n impostor.physicsBody = body;\r\n impostor._pluginData.toDispose = impostor._pluginData.toDispose.concat([body, rbInfo, myMotionState, startTransform, localInertia, colShape]);\r\n }\r\n this.setBodyRestitution(impostor, impostor.getParam(\"restitution\"));\r\n this.setBodyFriction(impostor, impostor.getParam(\"friction\"));\r\n }\r\n };\r\n /**\r\n * Removes the physics body from the imposter and disposes of the body's memory\r\n * @param impostor imposter to remove the physics body from\r\n */\r\n AmmoJSPlugin.prototype.removePhysicsBody = function (impostor) {\r\n var _this = this;\r\n if (this.world) {\r\n if (impostor.soft) {\r\n this.world.removeSoftBody(impostor.physicsBody);\r\n }\r\n else {\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n }\r\n if (impostor._pluginData) {\r\n impostor._pluginData.toDispose.forEach(function (d) {\r\n _this.bjsAMMO.destroy(d);\r\n });\r\n impostor._pluginData.toDispose = [];\r\n }\r\n }\r\n };\r\n /**\r\n * Generates a joint\r\n * @param impostorJoint the imposter joint to create the joint with\r\n */\r\n AmmoJSPlugin.prototype.generateJoint = function (impostorJoint) {\r\n var mainBody = impostorJoint.mainImpostor.physicsBody;\r\n var connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n var jointData = impostorJoint.joint.jointData;\r\n if (!jointData.mainPivot) {\r\n jointData.mainPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n if (!jointData.connectedPivot) {\r\n jointData.connectedPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n var joint;\r\n switch (impostorJoint.joint.type) {\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsJoint\"].DistanceJoint:\r\n var distance = jointData.maxDistance;\r\n if (distance) {\r\n jointData.mainPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -distance / 2, 0);\r\n jointData.connectedPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, distance / 2, 0);\r\n }\r\n joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsJoint\"].HingeJoint:\r\n if (!jointData.mainAxis) {\r\n jointData.mainAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n if (!jointData.connectedAxis) {\r\n jointData.connectedAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n var mainAxis = new Ammo.btVector3(jointData.mainAxis.x, jointData.mainAxis.y, jointData.mainAxis.z);\r\n var connectedAxis = new Ammo.btVector3(jointData.connectedAxis.x, jointData.connectedAxis.y, jointData.connectedAxis.z);\r\n joint = new Ammo.btHingeConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z), mainAxis, connectedAxis);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsJoint\"].BallAndSocketJoint:\r\n joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));\r\n break;\r\n default:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint\");\r\n joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));\r\n break;\r\n }\r\n this.world.addConstraint(joint, !impostorJoint.joint.jointData.collision);\r\n impostorJoint.joint.physicsJoint = joint;\r\n };\r\n /**\r\n * Removes a joint\r\n * @param impostorJoint the imposter joint to remove the joint from\r\n */\r\n AmmoJSPlugin.prototype.removeJoint = function (impostorJoint) {\r\n if (this.world) {\r\n this.world.removeConstraint(impostorJoint.joint.physicsJoint);\r\n }\r\n };\r\n // adds all verticies (including child verticies) to the triangle mesh\r\n AmmoJSPlugin.prototype._addMeshVerts = function (btTriangleMesh, topLevelObject, object) {\r\n var _this = this;\r\n var triangleCount = 0;\r\n if (object && object.getIndices && object.getWorldMatrix && object.getChildMeshes) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n object.computeWorldMatrix(false);\r\n var faceCount = indices.length / 3;\r\n for (var i = 0; i < faceCount; i++) {\r\n var triPoints = [];\r\n for (var point = 0; point < 3; point++) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[(indices[(i * 3) + point] * 3) + 0], vertexPositions[(indices[(i * 3) + point] * 3) + 1], vertexPositions[(indices[(i * 3) + point] * 3) + 2]);\r\n // Adjust for initial scaling\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].ScalingToRef(object.scaling.x, object.scaling.y, object.scaling.z, this._tmpMatrix);\r\n v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(v, this._tmpMatrix);\r\n var vec;\r\n if (point == 0) {\r\n vec = this._tmpAmmoVectorA;\r\n }\r\n else if (point == 1) {\r\n vec = this._tmpAmmoVectorB;\r\n }\r\n else {\r\n vec = this._tmpAmmoVectorC;\r\n }\r\n vec.setValue(v.x, v.y, v.z);\r\n triPoints.push(vec);\r\n }\r\n btTriangleMesh.addTriangle(triPoints[0], triPoints[1], triPoints[2]);\r\n triangleCount++;\r\n }\r\n object.getChildMeshes().forEach(function (m) {\r\n triangleCount += _this._addMeshVerts(btTriangleMesh, topLevelObject, m);\r\n });\r\n }\r\n return triangleCount;\r\n };\r\n /**\r\n * Initialise the soft body vertices to match its object's (mesh) vertices\r\n * Softbody vertices (nodes) are in world space and to match this\r\n * The object's position and rotation is set to zero and so its vertices are also then set in world space\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._softVertexData = function (impostor) {\r\n var object = impostor.object;\r\n if (object && object.getIndices && object.getWorldMatrix && object.getChildMeshes) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n var vertexNormals = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].NormalKind);\r\n if (!vertexNormals) {\r\n vertexNormals = [];\r\n }\r\n object.computeWorldMatrix(false);\r\n var newPoints = [];\r\n var newNorms = [];\r\n for (var i = 0; i < vertexPositions.length; i += 3) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[i], vertexPositions[i + 1], vertexPositions[i + 2]);\r\n var n = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexNormals[i], vertexNormals[i + 1], vertexNormals[i + 2]);\r\n v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(v, object.getWorldMatrix());\r\n n = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(n, object.getWorldMatrix());\r\n newPoints.push(v.x, v.y, v.z);\r\n newNorms.push(n.x, n.y, n.z);\r\n }\r\n var vertex_data = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"]();\r\n vertex_data.positions = newPoints;\r\n vertex_data.normals = newNorms;\r\n vertex_data.uvs = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind);\r\n vertex_data.colors = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind);\r\n if (object && object.getIndices) {\r\n vertex_data.indices = object.getIndices();\r\n }\r\n vertex_data.applyToMesh(object);\r\n object.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n object.rotationQuaternion = null;\r\n object.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n object.computeWorldMatrix(true);\r\n return vertex_data;\r\n }\r\n return _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"].ExtractFromMesh(object);\r\n };\r\n /**\r\n * Create an impostor's soft body\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._createSoftbody = function (impostor) {\r\n var object = impostor.object;\r\n if (object && object.getIndices) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertex_data = this._softVertexData(impostor);\r\n var vertexPositions = vertex_data.positions;\r\n var vertexNormals = vertex_data.normals;\r\n if (vertexPositions === null || vertexNormals === null) {\r\n return new Ammo.btCompoundShape();\r\n }\r\n else {\r\n var triPoints = [];\r\n var triNorms = [];\r\n for (var i = 0; i < vertexPositions.length; i += 3) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[i], vertexPositions[i + 1], vertexPositions[i + 2]);\r\n var n = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexNormals[i], vertexNormals[i + 1], vertexNormals[i + 2]);\r\n triPoints.push(v.x, v.y, -v.z);\r\n triNorms.push(n.x, n.y, -n.z);\r\n }\r\n var softBody = new Ammo.btSoftBodyHelpers().CreateFromTriMesh(this.world.getWorldInfo(), triPoints, object.getIndices(), indices.length / 3, true);\r\n var nbVertices = vertexPositions.length / 3;\r\n var bodyVertices = softBody.get_m_nodes();\r\n var node;\r\n var nodeNormals;\r\n for (var i = 0; i < nbVertices; i++) {\r\n node = bodyVertices.at(i);\r\n var nodeNormals = node.get_m_n();\r\n nodeNormals.setX(triNorms[3 * i]);\r\n nodeNormals.setY(triNorms[3 * i + 1]);\r\n nodeNormals.setZ(triNorms[3 * i + 2]);\r\n }\r\n return softBody;\r\n }\r\n }\r\n };\r\n /**\r\n * Create cloth for an impostor\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._createCloth = function (impostor) {\r\n var object = impostor.object;\r\n if (object && object.getIndices) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertex_data = this._softVertexData(impostor);\r\n var vertexPositions = vertex_data.positions;\r\n var vertexNormals = vertex_data.normals;\r\n if (vertexPositions === null || vertexNormals === null) {\r\n return new Ammo.btCompoundShape();\r\n }\r\n else {\r\n var len = vertexPositions.length;\r\n var segments = Math.sqrt(len / 3);\r\n impostor.segments = segments;\r\n var segs = segments - 1;\r\n this._tmpAmmoVectorA.setValue(vertexPositions[0], vertexPositions[1], vertexPositions[2]);\r\n this._tmpAmmoVectorB.setValue(vertexPositions[3 * segs], vertexPositions[3 * segs + 1], vertexPositions[3 * segs + 2]);\r\n this._tmpAmmoVectorD.setValue(vertexPositions[len - 3], vertexPositions[len - 2], vertexPositions[len - 1]);\r\n this._tmpAmmoVectorC.setValue(vertexPositions[len - 3 - 3 * segs], vertexPositions[len - 2 - 3 * segs], vertexPositions[len - 1 - 3 * segs]);\r\n var clothBody = new Ammo.btSoftBodyHelpers().CreatePatch(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, this._tmpAmmoVectorC, this._tmpAmmoVectorD, segments, segments, impostor.getParam(\"fixedPoints\"), true);\r\n return clothBody;\r\n }\r\n }\r\n };\r\n /**\r\n * Create rope for an impostor\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._createRope = function (impostor) {\r\n var len;\r\n var segments;\r\n var vertex_data = this._softVertexData(impostor);\r\n var vertexPositions = vertex_data.positions;\r\n var vertexNormals = vertex_data.normals;\r\n if (vertexPositions === null || vertexNormals === null) {\r\n return new Ammo.btCompoundShape();\r\n }\r\n //force the mesh to be updatable\r\n vertex_data.applyToMesh(impostor.object, true);\r\n impostor._isFromLine = true;\r\n // If in lines mesh all normals will be zero\r\n var vertexSquared = vertexNormals.map(function (x) { return x * x; });\r\n var reducer = function (accumulator, currentValue) { return accumulator + currentValue; };\r\n var reduced = vertexSquared.reduce(reducer);\r\n if (reduced === 0) { // line mesh\r\n len = vertexPositions.length;\r\n segments = len / 3 - 1;\r\n this._tmpAmmoVectorA.setValue(vertexPositions[0], vertexPositions[1], vertexPositions[2]);\r\n this._tmpAmmoVectorB.setValue(vertexPositions[len - 3], vertexPositions[len - 2], vertexPositions[len - 1]);\r\n }\r\n else { //extruded mesh\r\n impostor._isFromLine = false;\r\n var pathVectors = impostor.getParam(\"path\");\r\n var shape = impostor.getParam(\"shape\");\r\n if (shape === null) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"No shape available for extruded mesh\");\r\n return new Ammo.btCompoundShape();\r\n }\r\n if ((vertexPositions.length % (3 * pathVectors.length)) !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Path does not match extrusion\");\r\n return new Ammo.btCompoundShape();\r\n }\r\n len = pathVectors.length;\r\n segments = len - 1;\r\n this._tmpAmmoVectorA.setValue(pathVectors[0].x, pathVectors[0].y, pathVectors[0].z);\r\n this._tmpAmmoVectorB.setValue(pathVectors[len - 1].x, pathVectors[len - 1].y, pathVectors[len - 1].z);\r\n }\r\n impostor.segments = segments;\r\n var fixedPoints = impostor.getParam(\"fixedPoints\");\r\n fixedPoints = (fixedPoints > 3) ? 3 : fixedPoints;\r\n var ropeBody = new Ammo.btSoftBodyHelpers().CreateRope(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, segments - 1, fixedPoints);\r\n ropeBody.get_m_cfg().set_collisions(0x11);\r\n return ropeBody;\r\n };\r\n // adds all verticies (including child verticies) to the convex hull shape\r\n AmmoJSPlugin.prototype._addHullVerts = function (btConvexHullShape, topLevelObject, object) {\r\n var _this = this;\r\n var triangleCount = 0;\r\n if (object && object.getIndices && object.getWorldMatrix && object.getChildMeshes) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n object.computeWorldMatrix(false);\r\n var faceCount = indices.length / 3;\r\n for (var i = 0; i < faceCount; i++) {\r\n var triPoints = [];\r\n for (var point = 0; point < 3; point++) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[(indices[(i * 3) + point] * 3) + 0], vertexPositions[(indices[(i * 3) + point] * 3) + 1], vertexPositions[(indices[(i * 3) + point] * 3) + 2]);\r\n // Adjust for initial scaling\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].ScalingToRef(object.scaling.x, object.scaling.y, object.scaling.z, this._tmpMatrix);\r\n v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(v, this._tmpMatrix);\r\n var vec;\r\n if (point == 0) {\r\n vec = this._tmpAmmoVectorA;\r\n }\r\n else if (point == 1) {\r\n vec = this._tmpAmmoVectorB;\r\n }\r\n else {\r\n vec = this._tmpAmmoVectorC;\r\n }\r\n vec.setValue(v.x, v.y, v.z);\r\n triPoints.push(vec);\r\n }\r\n btConvexHullShape.addPoint(triPoints[0], true);\r\n btConvexHullShape.addPoint(triPoints[1], true);\r\n btConvexHullShape.addPoint(triPoints[2], true);\r\n triangleCount++;\r\n }\r\n object.getChildMeshes().forEach(function (m) {\r\n triangleCount += _this._addHullVerts(btConvexHullShape, topLevelObject, m);\r\n });\r\n }\r\n return triangleCount;\r\n };\r\n AmmoJSPlugin.prototype._createShape = function (impostor, ignoreChildren) {\r\n var _this = this;\r\n if (ignoreChildren === void 0) { ignoreChildren = false; }\r\n var object = impostor.object;\r\n var returnValue;\r\n var extendSize = impostor.getObjectExtendSize();\r\n if (!ignoreChildren) {\r\n var meshChildren = impostor.object.getChildMeshes ? impostor.object.getChildMeshes(true) : [];\r\n returnValue = new Ammo.btCompoundShape();\r\n // Add shape of all children to the compound shape\r\n var childrenAdded = 0;\r\n meshChildren.forEach(function (childMesh) {\r\n var childImpostor = childMesh.getPhysicsImpostor();\r\n if (childImpostor) {\r\n if (childImpostor.type == _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].MeshImpostor) {\r\n throw \"A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)\";\r\n }\r\n var shape = _this._createShape(childImpostor);\r\n // Position needs to be scaled based on parent's scaling\r\n var parentMat = childMesh.parent.getWorldMatrix().clone();\r\n var s = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n parentMat.decompose(s);\r\n _this._tmpAmmoTransform.getOrigin().setValue(childMesh.position.x * s.x, childMesh.position.y * s.y, childMesh.position.z * s.z);\r\n _this._tmpAmmoQuaternion.setValue(childMesh.rotationQuaternion.x, childMesh.rotationQuaternion.y, childMesh.rotationQuaternion.z, childMesh.rotationQuaternion.w);\r\n _this._tmpAmmoTransform.setRotation(_this._tmpAmmoQuaternion);\r\n returnValue.addChildShape(_this._tmpAmmoTransform, shape);\r\n childImpostor.dispose();\r\n childrenAdded++;\r\n }\r\n });\r\n if (childrenAdded > 0) {\r\n // Add parents shape as a child if present\r\n if (impostor.type != _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].NoImpostor) {\r\n var shape = this._createShape(impostor, true);\r\n if (shape) {\r\n this._tmpAmmoTransform.getOrigin().setValue(0, 0, 0);\r\n this._tmpAmmoQuaternion.setValue(0, 0, 0, 1);\r\n this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion);\r\n returnValue.addChildShape(this._tmpAmmoTransform, shape);\r\n }\r\n }\r\n return returnValue;\r\n }\r\n else {\r\n // If no children with impostors create the actual shape below instead\r\n Ammo.destroy(returnValue);\r\n returnValue = null;\r\n }\r\n }\r\n switch (impostor.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SphereImpostor:\r\n // Is there a better way to compare floats number? With an epsylon or with a Math function\r\n if (_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_9__[\"Scalar\"].WithinEpsilon(extendSize.x, extendSize.y, 0.0001) && _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_9__[\"Scalar\"].WithinEpsilon(extendSize.x, extendSize.z, 0.0001)) {\r\n returnValue = new Ammo.btSphereShape(extendSize.x / 2);\r\n }\r\n else {\r\n // create a btMultiSphereShape because it's not possible to set a local scaling on a btSphereShape\r\n var positions = [new Ammo.btVector3(0, 0, 0)];\r\n var radii = [1];\r\n returnValue = new Ammo.btMultiSphereShape(positions, radii, 1);\r\n returnValue.setLocalScaling(new Ammo.btVector3(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2));\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].CapsuleImpostor:\r\n returnValue = new Ammo.btCapsuleShape(extendSize.x / 2, extendSize.y / 2);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].CylinderImpostor:\r\n this._tmpAmmoVectorA.setValue(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2);\r\n returnValue = new Ammo.btCylinderShape(this._tmpAmmoVectorA);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].PlaneImpostor:\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].BoxImpostor:\r\n this._tmpAmmoVectorA.setValue(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2);\r\n returnValue = new Ammo.btBoxShape(this._tmpAmmoVectorA);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].MeshImpostor:\r\n if (impostor.getParam(\"mass\") == 0) {\r\n // Only create btBvhTriangleMeshShape impostor is static\r\n // See https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=7283\r\n var tetraMesh = new Ammo.btTriangleMesh();\r\n impostor._pluginData.toDispose.push(tetraMesh);\r\n var triangeCount = this._addMeshVerts(tetraMesh, object, object);\r\n if (triangeCount == 0) {\r\n returnValue = new Ammo.btCompoundShape();\r\n }\r\n else {\r\n returnValue = new Ammo.btBvhTriangleMeshShape(tetraMesh);\r\n }\r\n break;\r\n }\r\n // Otherwise create convexHullImpostor\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].ConvexHullImpostor:\r\n var convexMesh = new Ammo.btConvexHullShape();\r\n var triangeCount = this._addHullVerts(convexMesh, object, object);\r\n if (triangeCount == 0) {\r\n // Cleanup Unused Convex Hull Shape\r\n impostor._pluginData.toDispose.push(convexMesh);\r\n returnValue = new Ammo.btCompoundShape();\r\n }\r\n else {\r\n returnValue = convexMesh;\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].NoImpostor:\r\n // Fill with sphere but collision is disabled on the rigid body in generatePhysicsBody, using an empty shape caused unexpected movement with joints\r\n returnValue = new Ammo.btSphereShape(extendSize.x / 2);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SoftbodyImpostor:\r\n // Only usable with a mesh that has sufficient and shared vertices\r\n returnValue = this._createSoftbody(impostor);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].ClothImpostor:\r\n // Only usable with a ground mesh that has sufficient and shared vertices\r\n returnValue = this._createCloth(impostor);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].RopeImpostor:\r\n // Only usable with a line mesh or an extruded mesh that is updatable\r\n returnValue = this._createRope(impostor);\r\n break;\r\n default:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"The impostor type is not currently supported by the ammo plugin.\");\r\n break;\r\n }\r\n return returnValue;\r\n };\r\n /**\r\n * Sets the physics body position/rotation from the babylon mesh's position/rotation\r\n * @param impostor imposter containing the physics body and babylon object\r\n */\r\n AmmoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {\r\n impostor.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform);\r\n impostor.object.position.set(this._tmpAmmoTransform.getOrigin().x(), this._tmpAmmoTransform.getOrigin().y(), this._tmpAmmoTransform.getOrigin().z());\r\n if (!impostor.object.rotationQuaternion) {\r\n if (impostor.object.rotation) {\r\n this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w());\r\n this._tmpQuaternion.toEulerAnglesToRef(impostor.object.rotation);\r\n }\r\n }\r\n else {\r\n impostor.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w());\r\n }\r\n };\r\n /**\r\n * Sets the babylon object's position/rotation from the physics body's position/rotation\r\n * @param impostor imposter containing the physics body and babylon object\r\n * @param newPosition new position\r\n * @param newRotation new rotation\r\n */\r\n AmmoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {\r\n var trans = impostor.physicsBody.getWorldTransform();\r\n // If rotation/position has changed update and activate riged body\r\n if (trans.getOrigin().x() != newPosition.x ||\r\n trans.getOrigin().y() != newPosition.y ||\r\n trans.getOrigin().z() != newPosition.z ||\r\n trans.getRotation().x() != newRotation.x ||\r\n trans.getRotation().y() != newRotation.y ||\r\n trans.getRotation().z() != newRotation.z ||\r\n trans.getRotation().w() != newRotation.w) {\r\n this._tmpAmmoVectorA.setValue(newPosition.x, newPosition.y, newPosition.z);\r\n trans.setOrigin(this._tmpAmmoVectorA);\r\n this._tmpAmmoQuaternion.setValue(newRotation.x, newRotation.y, newRotation.z, newRotation.w);\r\n trans.setRotation(this._tmpAmmoQuaternion);\r\n impostor.physicsBody.setWorldTransform(trans);\r\n if (impostor.mass == 0) {\r\n // Kinematic objects must be updated using motion state\r\n var motionState = impostor.physicsBody.getMotionState();\r\n if (motionState) {\r\n motionState.setWorldTransform(trans);\r\n }\r\n }\r\n else {\r\n impostor.physicsBody.activate();\r\n }\r\n }\r\n };\r\n /**\r\n * If this plugin is supported\r\n * @returns true if its supported\r\n */\r\n AmmoJSPlugin.prototype.isSupported = function () {\r\n return this.bjsAMMO !== undefined;\r\n };\r\n /**\r\n * Sets the linear velocity of the physics body\r\n * @param impostor imposter to set the velocity on\r\n * @param velocity velocity to set\r\n */\r\n AmmoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {\r\n this._tmpAmmoVectorA.setValue(velocity.x, velocity.y, velocity.z);\r\n if (impostor.soft) {\r\n impostor.physicsBody.linearVelocity(this._tmpAmmoVectorA);\r\n }\r\n else {\r\n impostor.physicsBody.setLinearVelocity(this._tmpAmmoVectorA);\r\n }\r\n };\r\n /**\r\n * Sets the angular velocity of the physics body\r\n * @param impostor imposter to set the velocity on\r\n * @param velocity velocity to set\r\n */\r\n AmmoJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {\r\n this._tmpAmmoVectorA.setValue(velocity.x, velocity.y, velocity.z);\r\n if (impostor.soft) {\r\n impostor.physicsBody.angularVelocity(this._tmpAmmoVectorA);\r\n }\r\n else {\r\n impostor.physicsBody.setAngularVelocity(this._tmpAmmoVectorA);\r\n }\r\n };\r\n /**\r\n * gets the linear velocity\r\n * @param impostor imposter to get linear velocity from\r\n * @returns linear velocity\r\n */\r\n AmmoJSPlugin.prototype.getLinearVelocity = function (impostor) {\r\n if (impostor.soft) {\r\n var v = impostor.physicsBody.linearVelocity();\r\n }\r\n else {\r\n var v = impostor.physicsBody.getLinearVelocity();\r\n }\r\n if (!v) {\r\n return null;\r\n }\r\n var result = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](v.x(), v.y(), v.z());\r\n Ammo.destroy(v);\r\n return result;\r\n };\r\n /**\r\n * gets the angular velocity\r\n * @param impostor imposter to get angular velocity from\r\n * @returns angular velocity\r\n */\r\n AmmoJSPlugin.prototype.getAngularVelocity = function (impostor) {\r\n if (impostor.soft) {\r\n var v = impostor.physicsBody.angularVelocity();\r\n }\r\n else {\r\n var v = impostor.physicsBody.getAngularVelocity();\r\n }\r\n if (!v) {\r\n return null;\r\n }\r\n var result = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](v.x(), v.y(), v.z());\r\n Ammo.destroy(v);\r\n return result;\r\n };\r\n /**\r\n * Sets the mass of physics body\r\n * @param impostor imposter to set the mass on\r\n * @param mass mass to set\r\n */\r\n AmmoJSPlugin.prototype.setBodyMass = function (impostor, mass) {\r\n if (impostor.soft) {\r\n impostor.physicsBody.setTotalMass(mass, false);\r\n }\r\n else {\r\n impostor.physicsBody.setMassProps(mass);\r\n }\r\n impostor._pluginData.mass = mass;\r\n };\r\n /**\r\n * Gets the mass of the physics body\r\n * @param impostor imposter to get the mass from\r\n * @returns mass\r\n */\r\n AmmoJSPlugin.prototype.getBodyMass = function (impostor) {\r\n return impostor._pluginData.mass || 0;\r\n };\r\n /**\r\n * Gets friction of the impostor\r\n * @param impostor impostor to get friction from\r\n * @returns friction value\r\n */\r\n AmmoJSPlugin.prototype.getBodyFriction = function (impostor) {\r\n return impostor._pluginData.friction || 0;\r\n };\r\n /**\r\n * Sets friction of the impostor\r\n * @param impostor impostor to set friction on\r\n * @param friction friction value\r\n */\r\n AmmoJSPlugin.prototype.setBodyFriction = function (impostor, friction) {\r\n if (impostor.soft) {\r\n impostor.physicsBody.get_m_cfg().set_kDF(friction);\r\n }\r\n else {\r\n impostor.physicsBody.setFriction(friction);\r\n }\r\n impostor._pluginData.friction = friction;\r\n };\r\n /**\r\n * Gets restitution of the impostor\r\n * @param impostor impostor to get restitution from\r\n * @returns restitution value\r\n */\r\n AmmoJSPlugin.prototype.getBodyRestitution = function (impostor) {\r\n return impostor._pluginData.restitution || 0;\r\n };\r\n /**\r\n * Sets resitution of the impostor\r\n * @param impostor impostor to set resitution on\r\n * @param restitution resitution value\r\n */\r\n AmmoJSPlugin.prototype.setBodyRestitution = function (impostor, restitution) {\r\n impostor.physicsBody.setRestitution(restitution);\r\n impostor._pluginData.restitution = restitution;\r\n };\r\n /**\r\n * Gets pressure inside the impostor\r\n * @param impostor impostor to get pressure from\r\n * @returns pressure value\r\n */\r\n AmmoJSPlugin.prototype.getBodyPressure = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Pressure is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.pressure || 0;\r\n };\r\n /**\r\n * Sets pressure inside a soft body impostor\r\n * Cloth and rope must remain 0 pressure\r\n * @param impostor impostor to set pressure on\r\n * @param pressure pressure value\r\n */\r\n AmmoJSPlugin.prototype.setBodyPressure = function (impostor, pressure) {\r\n if (impostor.soft) {\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SoftbodyImpostor) {\r\n impostor.physicsBody.get_m_cfg().set_kPR(pressure);\r\n impostor._pluginData.pressure = pressure;\r\n }\r\n else {\r\n impostor.physicsBody.get_m_cfg().set_kPR(0);\r\n impostor._pluginData.pressure = 0;\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Pressure can only be applied to a softbody\");\r\n }\r\n };\r\n /**\r\n * Gets stiffness of the impostor\r\n * @param impostor impostor to get stiffness from\r\n * @returns pressure value\r\n */\r\n AmmoJSPlugin.prototype.getBodyStiffness = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Stiffness is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.stiffness || 0;\r\n };\r\n /**\r\n * Sets stiffness of the impostor\r\n * @param impostor impostor to set stiffness on\r\n * @param stiffness stiffness value from 0 to 1\r\n */\r\n AmmoJSPlugin.prototype.setBodyStiffness = function (impostor, stiffness) {\r\n if (impostor.soft) {\r\n stiffness = stiffness < 0 ? 0 : stiffness;\r\n stiffness = stiffness > 1 ? 1 : stiffness;\r\n impostor.physicsBody.get_m_materials().at(0).set_m_kLST(stiffness);\r\n impostor._pluginData.stiffness = stiffness;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Stiffness cannot be applied to a rigid body\");\r\n }\r\n };\r\n /**\r\n * Gets velocityIterations of the impostor\r\n * @param impostor impostor to get velocity iterations from\r\n * @returns velocityIterations value\r\n */\r\n AmmoJSPlugin.prototype.getBodyVelocityIterations = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Velocity iterations is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.velocityIterations || 0;\r\n };\r\n /**\r\n * Sets velocityIterations of the impostor\r\n * @param impostor impostor to set velocity iterations on\r\n * @param velocityIterations velocityIterations value\r\n */\r\n AmmoJSPlugin.prototype.setBodyVelocityIterations = function (impostor, velocityIterations) {\r\n if (impostor.soft) {\r\n velocityIterations = velocityIterations < 0 ? 0 : velocityIterations;\r\n impostor.physicsBody.get_m_cfg().set_viterations(velocityIterations);\r\n impostor._pluginData.velocityIterations = velocityIterations;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Velocity iterations cannot be applied to a rigid body\");\r\n }\r\n };\r\n /**\r\n * Gets positionIterations of the impostor\r\n * @param impostor impostor to get position iterations from\r\n * @returns positionIterations value\r\n */\r\n AmmoJSPlugin.prototype.getBodyPositionIterations = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Position iterations is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.positionIterations || 0;\r\n };\r\n /**\r\n * Sets positionIterations of the impostor\r\n * @param impostor impostor to set position on\r\n * @param positionIterations positionIterations value\r\n */\r\n AmmoJSPlugin.prototype.setBodyPositionIterations = function (impostor, positionIterations) {\r\n if (impostor.soft) {\r\n positionIterations = positionIterations < 0 ? 0 : positionIterations;\r\n impostor.physicsBody.get_m_cfg().set_piterations(positionIterations);\r\n impostor._pluginData.positionIterations = positionIterations;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Position iterations cannot be applied to a rigid body\");\r\n }\r\n };\r\n /**\r\n * Append an anchor to a cloth object\r\n * @param impostor is the cloth impostor to add anchor to\r\n * @param otherImpostor is the rigid impostor to anchor to\r\n * @param width ratio across width from 0 to 1\r\n * @param height ratio up height from 0 to 1\r\n * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n */\r\n AmmoJSPlugin.prototype.appendAnchor = function (impostor, otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies) {\r\n if (influence === void 0) { influence = 1; }\r\n if (noCollisionBetweenLinkedBodies === void 0) { noCollisionBetweenLinkedBodies = false; }\r\n var segs = impostor.segments;\r\n var nbAcross = Math.round((segs - 1) * width);\r\n var nbUp = Math.round((segs - 1) * height);\r\n var nbDown = segs - 1 - nbUp;\r\n var node = nbAcross + segs * nbDown;\r\n impostor.physicsBody.appendAnchor(node, otherImpostor.physicsBody, noCollisionBetweenLinkedBodies, influence);\r\n };\r\n /**\r\n * Append an hook to a rope object\r\n * @param impostor is the rope impostor to add hook to\r\n * @param otherImpostor is the rigid impostor to hook to\r\n * @param length ratio along the rope from 0 to 1\r\n * @param influence the elasticity between soft impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n */\r\n AmmoJSPlugin.prototype.appendHook = function (impostor, otherImpostor, length, influence, noCollisionBetweenLinkedBodies) {\r\n if (influence === void 0) { influence = 1; }\r\n if (noCollisionBetweenLinkedBodies === void 0) { noCollisionBetweenLinkedBodies = false; }\r\n var node = Math.round(impostor.segments * length);\r\n impostor.physicsBody.appendAnchor(node, otherImpostor.physicsBody, noCollisionBetweenLinkedBodies, influence);\r\n };\r\n /**\r\n * Sleeps the physics body and stops it from being active\r\n * @param impostor impostor to sleep\r\n */\r\n AmmoJSPlugin.prototype.sleepBody = function (impostor) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"sleepBody is not currently supported by the Ammo physics plugin\");\r\n };\r\n /**\r\n * Activates the physics body\r\n * @param impostor impostor to activate\r\n */\r\n AmmoJSPlugin.prototype.wakeUpBody = function (impostor) {\r\n impostor.physicsBody.activate();\r\n };\r\n /**\r\n * Updates the distance parameters of the joint\r\n * @param joint joint to update\r\n * @param maxDistance maximum distance of the joint\r\n * @param minDistance minimum distance of the joint\r\n */\r\n AmmoJSPlugin.prototype.updateDistanceJoint = function (joint, maxDistance, minDistance) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"updateDistanceJoint is not currently supported by the Ammo physics plugin\");\r\n };\r\n /**\r\n * Sets a motor on the joint\r\n * @param joint joint to set motor on\r\n * @param speed speed of the motor\r\n * @param maxForce maximum force of the motor\r\n * @param motorIndex index of the motor\r\n */\r\n AmmoJSPlugin.prototype.setMotor = function (joint, speed, maxForce, motorIndex) {\r\n joint.physicsJoint.enableAngularMotor(true, speed, maxForce);\r\n };\r\n /**\r\n * Sets the motors limit\r\n * @param joint joint to set limit on\r\n * @param upperLimit upper limit\r\n * @param lowerLimit lower limit\r\n */\r\n AmmoJSPlugin.prototype.setLimit = function (joint, upperLimit, lowerLimit) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"setLimit is not currently supported by the Ammo physics plugin\");\r\n };\r\n /**\r\n * Syncs the position and rotation of a mesh with the impostor\r\n * @param mesh mesh to sync\r\n * @param impostor impostor to update the mesh with\r\n */\r\n AmmoJSPlugin.prototype.syncMeshWithImpostor = function (mesh, impostor) {\r\n var body = impostor.physicsBody;\r\n body.getMotionState().getWorldTransform(this._tmpAmmoTransform);\r\n mesh.position.x = this._tmpAmmoTransform.getOrigin().x();\r\n mesh.position.y = this._tmpAmmoTransform.getOrigin().y();\r\n mesh.position.z = this._tmpAmmoTransform.getOrigin().z();\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = this._tmpAmmoTransform.getRotation().x();\r\n mesh.rotationQuaternion.y = this._tmpAmmoTransform.getRotation().y();\r\n mesh.rotationQuaternion.z = this._tmpAmmoTransform.getRotation().z();\r\n mesh.rotationQuaternion.w = this._tmpAmmoTransform.getRotation().w();\r\n }\r\n };\r\n /**\r\n * Gets the radius of the impostor\r\n * @param impostor impostor to get radius from\r\n * @returns the radius\r\n */\r\n AmmoJSPlugin.prototype.getRadius = function (impostor) {\r\n var exntend = impostor.getObjectExtendSize();\r\n return exntend.x / 2;\r\n };\r\n /**\r\n * Gets the box size of the impostor\r\n * @param impostor impostor to get box size from\r\n * @param result the resulting box size\r\n */\r\n AmmoJSPlugin.prototype.getBoxSizeToRef = function (impostor, result) {\r\n var exntend = impostor.getObjectExtendSize();\r\n result.x = exntend.x;\r\n result.y = exntend.y;\r\n result.z = exntend.z;\r\n };\r\n /**\r\n * Disposes of the impostor\r\n */\r\n AmmoJSPlugin.prototype.dispose = function () {\r\n // Dispose of world\r\n Ammo.destroy(this.world);\r\n Ammo.destroy(this._solver);\r\n Ammo.destroy(this._overlappingPairCache);\r\n Ammo.destroy(this._dispatcher);\r\n Ammo.destroy(this._collisionConfiguration);\r\n // Dispose of tmp variables\r\n Ammo.destroy(this._tmpAmmoVectorA);\r\n Ammo.destroy(this._tmpAmmoVectorB);\r\n Ammo.destroy(this._tmpAmmoVectorC);\r\n Ammo.destroy(this._tmpAmmoTransform);\r\n Ammo.destroy(this._tmpAmmoQuaternion);\r\n Ammo.destroy(this._tmpAmmoConcreteContactResultCallback);\r\n this.world = null;\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n AmmoJSPlugin.prototype.raycast = function (from, to) {\r\n this._tmpAmmoVectorRCA = new this.bjsAMMO.btVector3(from.x, from.y, from.z);\r\n this._tmpAmmoVectorRCB = new this.bjsAMMO.btVector3(to.x, to.y, to.z);\r\n var rayCallback = new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA, this._tmpAmmoVectorRCB);\r\n this.world.rayTest(this._tmpAmmoVectorRCA, this._tmpAmmoVectorRCB, rayCallback);\r\n this._raycastResult.reset(from, to);\r\n if (rayCallback.hasHit()) {\r\n // TODO: do we want/need the body? If so, set all the data\r\n /*\r\n var rigidBody = this.bjsAMMO.btRigidBody.prototype.upcast(\r\n rayCallback.get_m_collisionObject()\r\n );\r\n var body = {};\r\n */\r\n this._raycastResult.setHitData({\r\n x: rayCallback.get_m_hitNormalWorld().x(),\r\n y: rayCallback.get_m_hitNormalWorld().y(),\r\n z: rayCallback.get_m_hitNormalWorld().z(),\r\n }, {\r\n x: rayCallback.get_m_hitPointWorld().x(),\r\n y: rayCallback.get_m_hitPointWorld().y(),\r\n z: rayCallback.get_m_hitPointWorld().z(),\r\n });\r\n this._raycastResult.calculateHitDistance();\r\n }\r\n Ammo.destroy(rayCallback);\r\n Ammo.destroy(this._tmpAmmoVectorRCA);\r\n Ammo.destroy(this._tmpAmmoVectorRCB);\r\n return this._raycastResult;\r\n };\r\n AmmoJSPlugin.DISABLE_COLLISION_FLAG = 4;\r\n AmmoJSPlugin.KINEMATIC_FLAG = 2;\r\n AmmoJSPlugin.DISABLE_DEACTIVATION_FLAG = 4;\r\n return AmmoJSPlugin;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/cannonJSPlugin.ts\":\n/*!*******************************************!*\\\n !*** ./Physics/Plugins/cannonJSPlugin.ts ***!\n \\*******************************************/\n/*! exports provided: CannonJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return CannonJSPlugin; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Physics/physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Physics/physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony import */ var _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../physicsRaycastResult */ \"./Physics/physicsRaycastResult.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar CannonJSPlugin = /** @class */ (function () {\r\n function CannonJSPlugin(_useDeltaForWorldStep, iterations, cannonInjection) {\r\n if (_useDeltaForWorldStep === void 0) { _useDeltaForWorldStep = true; }\r\n if (iterations === void 0) { iterations = 10; }\r\n if (cannonInjection === void 0) { cannonInjection = CANNON; }\r\n this._useDeltaForWorldStep = _useDeltaForWorldStep;\r\n this.name = \"CannonJSPlugin\";\r\n this._physicsMaterials = new Array();\r\n this._fixedTimeStep = 1 / 60;\r\n this._physicsBodysToRemoveAfterStep = new Array();\r\n this._minus90X = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"](-0.7071067811865475, 0, 0, 0.7071067811865475);\r\n this._plus90X = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"](0.7071067811865475, 0, 0, 0.7071067811865475);\r\n this._tmpPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._tmpDeltaPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._tmpUnityRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n this.BJSCANNON = cannonInjection;\r\n if (!this.isSupported()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"CannonJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n this._extendNamespace();\r\n this.world = new this.BJSCANNON.World();\r\n this.world.broadphase = new this.BJSCANNON.NaiveBroadphase();\r\n this.world.solver.iterations = iterations;\r\n this._cannonRaycastResult = new this.BJSCANNON.RaycastResult();\r\n this._raycastResult = new _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_6__[\"PhysicsRaycastResult\"]();\r\n }\r\n CannonJSPlugin.prototype.setGravity = function (gravity) {\r\n this.world.gravity.copy(gravity);\r\n };\r\n CannonJSPlugin.prototype.setTimeStep = function (timeStep) {\r\n this._fixedTimeStep = timeStep;\r\n };\r\n CannonJSPlugin.prototype.getTimeStep = function () {\r\n return this._fixedTimeStep;\r\n };\r\n CannonJSPlugin.prototype.executeStep = function (delta) {\r\n this.world.step(this._fixedTimeStep, this._useDeltaForWorldStep ? delta : 0, 3);\r\n this._removeMarkedPhysicsBodiesFromWorld();\r\n };\r\n CannonJSPlugin.prototype._removeMarkedPhysicsBodiesFromWorld = function () {\r\n var _this = this;\r\n if (this._physicsBodysToRemoveAfterStep.length > 0) {\r\n this._physicsBodysToRemoveAfterStep.forEach(function (physicsBody) {\r\n _this.world.remove(physicsBody);\r\n });\r\n this._physicsBodysToRemoveAfterStep = [];\r\n }\r\n };\r\n CannonJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {\r\n var worldPoint = new this.BJSCANNON.Vec3(contactPoint.x, contactPoint.y, contactPoint.z);\r\n var impulse = new this.BJSCANNON.Vec3(force.x, force.y, force.z);\r\n impostor.physicsBody.applyImpulse(impulse, worldPoint);\r\n };\r\n CannonJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {\r\n var worldPoint = new this.BJSCANNON.Vec3(contactPoint.x, contactPoint.y, contactPoint.z);\r\n var impulse = new this.BJSCANNON.Vec3(force.x, force.y, force.z);\r\n impostor.physicsBody.applyForce(impulse, worldPoint);\r\n };\r\n CannonJSPlugin.prototype.generatePhysicsBody = function (impostor) {\r\n // When calling forceUpdate generatePhysicsBody is called again, ensure that the updated body does not instantly collide with removed body\r\n this._removeMarkedPhysicsBodiesFromWorld();\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n //should a new body be created for this impostor?\r\n if (impostor.isBodyInitRequired()) {\r\n var shape = this._createShape(impostor);\r\n //unregister events, if body is being changed\r\n var oldBody = impostor.physicsBody;\r\n if (oldBody) {\r\n this.removePhysicsBody(impostor);\r\n }\r\n //create the body and material\r\n var material = this._addMaterial(\"mat-\" + impostor.uniqueId, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\"));\r\n var bodyCreationObject = {\r\n mass: impostor.getParam(\"mass\"),\r\n material: material\r\n };\r\n // A simple extend, in case native options were used.\r\n var nativeOptions = impostor.getParam(\"nativeOptions\");\r\n for (var key in nativeOptions) {\r\n if (nativeOptions.hasOwnProperty(key)) {\r\n bodyCreationObject[key] = nativeOptions[key];\r\n }\r\n }\r\n impostor.physicsBody = new this.BJSCANNON.Body(bodyCreationObject);\r\n impostor.physicsBody.addEventListener(\"collide\", impostor.onCollide);\r\n this.world.addEventListener(\"preStep\", impostor.beforeStep);\r\n this.world.addEventListener(\"postStep\", impostor.afterStep);\r\n impostor.physicsBody.addShape(shape);\r\n this.world.add(impostor.physicsBody);\r\n //try to keep the body moving in the right direction by taking old properties.\r\n //Should be tested!\r\n if (oldBody) {\r\n ['force', 'torque', 'velocity', 'angularVelocity'].forEach(function (param) {\r\n impostor.physicsBody[param].copy(oldBody[param]);\r\n });\r\n }\r\n this._processChildMeshes(impostor);\r\n }\r\n //now update the body's transformation\r\n this._updatePhysicsBodyTransformation(impostor);\r\n };\r\n CannonJSPlugin.prototype._processChildMeshes = function (mainImpostor) {\r\n var _this = this;\r\n var meshChildren = mainImpostor.object.getChildMeshes ? mainImpostor.object.getChildMeshes(true) : [];\r\n var currentRotation = mainImpostor.object.rotationQuaternion;\r\n if (meshChildren.length) {\r\n var processMesh = function (localPosition, mesh) {\r\n if (!currentRotation || !mesh.rotationQuaternion) {\r\n return;\r\n }\r\n var childImpostor = mesh.getPhysicsImpostor();\r\n if (childImpostor) {\r\n var parent = childImpostor.parent;\r\n if (parent !== mainImpostor) {\r\n var pPosition = mesh.getAbsolutePosition().subtract(mainImpostor.object.getAbsolutePosition());\r\n var localRotation = mesh.rotationQuaternion.multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Inverse(currentRotation));\r\n if (childImpostor.physicsBody) {\r\n _this.removePhysicsBody(childImpostor);\r\n childImpostor.physicsBody = null;\r\n }\r\n childImpostor.parent = mainImpostor;\r\n childImpostor.resetUpdateFlags();\r\n mainImpostor.physicsBody.addShape(_this._createShape(childImpostor), new _this.BJSCANNON.Vec3(pPosition.x, pPosition.y, pPosition.z), new _this.BJSCANNON.Quaternion(localRotation.x, localRotation.y, localRotation.z, localRotation.w));\r\n //Add the mass of the children.\r\n mainImpostor.physicsBody.mass += childImpostor.getParam(\"mass\");\r\n }\r\n }\r\n currentRotation.multiplyInPlace(mesh.rotationQuaternion);\r\n mesh.getChildMeshes(true).filter(function (m) { return !!m.physicsImpostor; }).forEach(processMesh.bind(_this, mesh.getAbsolutePosition()));\r\n };\r\n meshChildren.filter(function (m) { return !!m.physicsImpostor; }).forEach(processMesh.bind(this, mainImpostor.object.getAbsolutePosition()));\r\n }\r\n };\r\n CannonJSPlugin.prototype.removePhysicsBody = function (impostor) {\r\n impostor.physicsBody.removeEventListener(\"collide\", impostor.onCollide);\r\n this.world.removeEventListener(\"preStep\", impostor.beforeStep);\r\n this.world.removeEventListener(\"postStep\", impostor.afterStep);\r\n // Only remove the physics body after the physics step to avoid disrupting cannon's internal state\r\n if (this._physicsBodysToRemoveAfterStep.indexOf(impostor.physicsBody) === -1) {\r\n this._physicsBodysToRemoveAfterStep.push(impostor.physicsBody);\r\n }\r\n };\r\n CannonJSPlugin.prototype.generateJoint = function (impostorJoint) {\r\n var mainBody = impostorJoint.mainImpostor.physicsBody;\r\n var connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n var constraint;\r\n var jointData = impostorJoint.joint.jointData;\r\n //TODO - https://github.com/schteppe/this.BJSCANNON.js/blob/gh-pages/demos/collisionFilter.html\r\n var constraintData = {\r\n pivotA: jointData.mainPivot ? new this.BJSCANNON.Vec3().copy(jointData.mainPivot) : null,\r\n pivotB: jointData.connectedPivot ? new this.BJSCANNON.Vec3().copy(jointData.connectedPivot) : null,\r\n axisA: jointData.mainAxis ? new this.BJSCANNON.Vec3().copy(jointData.mainAxis) : null,\r\n axisB: jointData.connectedAxis ? new this.BJSCANNON.Vec3().copy(jointData.connectedAxis) : null,\r\n maxForce: jointData.nativeParams.maxForce,\r\n collideConnected: !!jointData.collision\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].HingeJoint:\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].Hinge2Joint:\r\n constraint = new this.BJSCANNON.HingeConstraint(mainBody, connectedBody, constraintData);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].DistanceJoint:\r\n constraint = new this.BJSCANNON.DistanceConstraint(mainBody, connectedBody, jointData.maxDistance || 2);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].SpringJoint:\r\n var springData = jointData;\r\n constraint = new this.BJSCANNON.Spring(mainBody, connectedBody, {\r\n restLength: springData.length,\r\n stiffness: springData.stiffness,\r\n damping: springData.damping,\r\n localAnchorA: constraintData.pivotA,\r\n localAnchorB: constraintData.pivotB\r\n });\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].LockJoint:\r\n constraint = new this.BJSCANNON.LockConstraint(mainBody, connectedBody, constraintData);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].PointToPointJoint:\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].BallAndSocketJoint:\r\n default:\r\n constraint = new this.BJSCANNON.PointToPointConstraint(mainBody, constraintData.pivotA, connectedBody, constraintData.pivotB, constraintData.maxForce);\r\n break;\r\n }\r\n //set the collideConnected flag after the creation, since DistanceJoint ignores it.\r\n constraint.collideConnected = !!jointData.collision;\r\n impostorJoint.joint.physicsJoint = constraint;\r\n //don't add spring as constraint, as it is not one.\r\n if (impostorJoint.joint.type !== _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].SpringJoint) {\r\n this.world.addConstraint(constraint);\r\n }\r\n else {\r\n impostorJoint.joint.jointData.forceApplicationCallback = impostorJoint.joint.jointData.forceApplicationCallback || function () {\r\n constraint.applyForce();\r\n };\r\n impostorJoint.mainImpostor.registerAfterPhysicsStep(impostorJoint.joint.jointData.forceApplicationCallback);\r\n }\r\n };\r\n CannonJSPlugin.prototype.removeJoint = function (impostorJoint) {\r\n if (impostorJoint.joint.type !== _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].SpringJoint) {\r\n this.world.removeConstraint(impostorJoint.joint.physicsJoint);\r\n }\r\n else {\r\n impostorJoint.mainImpostor.unregisterAfterPhysicsStep(impostorJoint.joint.jointData.forceApplicationCallback);\r\n }\r\n };\r\n CannonJSPlugin.prototype._addMaterial = function (name, friction, restitution) {\r\n var index;\r\n var mat;\r\n for (index = 0; index < this._physicsMaterials.length; index++) {\r\n mat = this._physicsMaterials[index];\r\n if (mat.friction === friction && mat.restitution === restitution) {\r\n return mat;\r\n }\r\n }\r\n var currentMat = new this.BJSCANNON.Material(name);\r\n currentMat.friction = friction;\r\n currentMat.restitution = restitution;\r\n this._physicsMaterials.push(currentMat);\r\n return currentMat;\r\n };\r\n CannonJSPlugin.prototype._checkWithEpsilon = function (value) {\r\n return value < _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"].Epsilon ? _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"].Epsilon : value;\r\n };\r\n CannonJSPlugin.prototype._createShape = function (impostor) {\r\n var object = impostor.object;\r\n var returnValue;\r\n var extendSize = impostor.getObjectExtendSize();\r\n switch (impostor.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].SphereImpostor:\r\n var radiusX = extendSize.x;\r\n var radiusY = extendSize.y;\r\n var radiusZ = extendSize.z;\r\n returnValue = new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(radiusX), this._checkWithEpsilon(radiusY), this._checkWithEpsilon(radiusZ)) / 2);\r\n break;\r\n //TMP also for cylinder - TODO Cannon supports cylinder natively.\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].CylinderImpostor:\r\n var nativeParams = impostor.getParam(\"nativeOptions\");\r\n if (!nativeParams) {\r\n nativeParams = {};\r\n }\r\n var radiusTop = nativeParams.radiusTop !== undefined ? nativeParams.radiusTop : this._checkWithEpsilon(extendSize.x) / 2;\r\n var radiusBottom = nativeParams.radiusBottom !== undefined ? nativeParams.radiusBottom : this._checkWithEpsilon(extendSize.x) / 2;\r\n var height = nativeParams.height !== undefined ? nativeParams.height : this._checkWithEpsilon(extendSize.y);\r\n var numSegments = nativeParams.numSegments !== undefined ? nativeParams.numSegments : 16;\r\n returnValue = new this.BJSCANNON.Cylinder(radiusTop, radiusBottom, height, numSegments);\r\n // Rotate 90 degrees as this shape is horizontal in cannon\r\n var quat = new this.BJSCANNON.Quaternion();\r\n quat.setFromAxisAngle(new this.BJSCANNON.Vec3(1, 0, 0), -Math.PI / 2);\r\n var translation = new this.BJSCANNON.Vec3(0, 0, 0);\r\n returnValue.transformAllPoints(translation, quat);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].BoxImpostor:\r\n var box = extendSize.scale(0.5);\r\n returnValue = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(box.x), this._checkWithEpsilon(box.y), this._checkWithEpsilon(box.z)));\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].PlaneImpostor:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead\");\r\n returnValue = new this.BJSCANNON.Plane();\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].MeshImpostor:\r\n // should transform the vertex data to world coordinates!!\r\n var rawVerts = object.getVerticesData ? object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind) : [];\r\n var rawFaces = object.getIndices ? object.getIndices() : [];\r\n if (!rawVerts) {\r\n return;\r\n }\r\n // get only scale! so the object could transform correctly.\r\n var oldPosition = object.position.clone();\r\n var oldRotation = object.rotation && object.rotation.clone();\r\n var oldQuaternion = object.rotationQuaternion && object.rotationQuaternion.clone();\r\n object.position.copyFromFloats(0, 0, 0);\r\n object.rotation && object.rotation.copyFromFloats(0, 0, 0);\r\n object.rotationQuaternion && object.rotationQuaternion.copyFrom(impostor.getParentsRotation());\r\n object.rotationQuaternion && object.parent && object.rotationQuaternion.conjugateInPlace();\r\n var transform = object.computeWorldMatrix(true);\r\n // convert rawVerts to object space\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < rawVerts.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(rawVerts, index), transform).toArray(temp, index);\r\n }\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"MeshImpostor only collides against spheres.\");\r\n returnValue = new this.BJSCANNON.Trimesh(temp, rawFaces);\r\n //now set back the transformation!\r\n object.position.copyFrom(oldPosition);\r\n oldRotation && object.rotation && object.rotation.copyFrom(oldRotation);\r\n oldQuaternion && object.rotationQuaternion && object.rotationQuaternion.copyFrom(oldQuaternion);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].HeightmapImpostor:\r\n var oldPosition2 = object.position.clone();\r\n var oldRotation2 = object.rotation && object.rotation.clone();\r\n var oldQuaternion2 = object.rotationQuaternion && object.rotationQuaternion.clone();\r\n object.position.copyFromFloats(0, 0, 0);\r\n object.rotation && object.rotation.copyFromFloats(0, 0, 0);\r\n object.rotationQuaternion && object.rotationQuaternion.copyFrom(impostor.getParentsRotation());\r\n object.rotationQuaternion && object.parent && object.rotationQuaternion.conjugateInPlace();\r\n object.rotationQuaternion && object.rotationQuaternion.multiplyInPlace(this._minus90X);\r\n returnValue = this._createHeightmap(object);\r\n object.position.copyFrom(oldPosition2);\r\n oldRotation2 && object.rotation && object.rotation.copyFrom(oldRotation2);\r\n oldQuaternion2 && object.rotationQuaternion && object.rotationQuaternion.copyFrom(oldQuaternion2);\r\n object.computeWorldMatrix(true);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].ParticleImpostor:\r\n returnValue = new this.BJSCANNON.Particle();\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].NoImpostor:\r\n returnValue = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(0, 0, 0));\r\n break;\r\n }\r\n return returnValue;\r\n };\r\n CannonJSPlugin.prototype._createHeightmap = function (object, pointDepth) {\r\n var pos = (object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind));\r\n var transform = object.computeWorldMatrix(true);\r\n // convert rawVerts to object space\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < pos.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(pos, index), transform).toArray(temp, index);\r\n }\r\n pos = temp;\r\n var matrix = new Array();\r\n //For now pointDepth will not be used and will be automatically calculated.\r\n //Future reference - try and find the best place to add a reference to the pointDepth variable.\r\n var arraySize = pointDepth || ~~(Math.sqrt(pos.length / 3) - 1);\r\n var boundingInfo = object.getBoundingInfo();\r\n var dim = Math.min(boundingInfo.boundingBox.extendSizeWorld.x, boundingInfo.boundingBox.extendSizeWorld.y);\r\n var minY = boundingInfo.boundingBox.extendSizeWorld.z;\r\n var elementSize = dim * 2 / arraySize;\r\n for (var i = 0; i < pos.length; i = i + 3) {\r\n var x = Math.round((pos[i + 0]) / elementSize + arraySize / 2);\r\n var z = Math.round(((pos[i + 1]) / elementSize - arraySize / 2) * -1);\r\n var y = -pos[i + 2] + minY;\r\n if (!matrix[x]) {\r\n matrix[x] = [];\r\n }\r\n if (!matrix[x][z]) {\r\n matrix[x][z] = y;\r\n }\r\n matrix[x][z] = Math.max(y, matrix[x][z]);\r\n }\r\n for (var x = 0; x <= arraySize; ++x) {\r\n if (!matrix[x]) {\r\n var loc = 1;\r\n while (!matrix[(x + loc) % arraySize]) {\r\n loc++;\r\n }\r\n matrix[x] = matrix[(x + loc) % arraySize].slice();\r\n //console.log(\"missing x\", x);\r\n }\r\n for (var z = 0; z <= arraySize; ++z) {\r\n if (!matrix[x][z]) {\r\n var loc = 1;\r\n var newValue;\r\n while (newValue === undefined) {\r\n newValue = matrix[x][(z + loc++) % arraySize];\r\n }\r\n matrix[x][z] = newValue;\r\n }\r\n }\r\n }\r\n var shape = new this.BJSCANNON.Heightfield(matrix, {\r\n elementSize: elementSize\r\n });\r\n //For future reference, needed for body transformation\r\n shape.minY = minY;\r\n return shape;\r\n };\r\n CannonJSPlugin.prototype._updatePhysicsBodyTransformation = function (impostor) {\r\n var object = impostor.object;\r\n //make sure it is updated...\r\n object.computeWorldMatrix && object.computeWorldMatrix(true);\r\n // The delta between the mesh position and the mesh bounding box center\r\n var bInfo = object.getBoundingInfo();\r\n if (!bInfo) {\r\n return;\r\n }\r\n var center = impostor.getObjectCenter();\r\n //m.getAbsolutePosition().subtract(m.getBoundingInfo().boundingBox.centerWorld)\r\n this._tmpDeltaPosition.copyFrom(object.getAbsolutePivotPoint().subtract(center));\r\n this._tmpDeltaPosition.divideInPlace(impostor.object.scaling);\r\n this._tmpPosition.copyFrom(center);\r\n var quaternion = object.rotationQuaternion;\r\n if (!quaternion) {\r\n return;\r\n }\r\n //is shape is a plane or a heightmap, it must be rotated 90 degs in the X axis.\r\n //ideally these would be rotated at time of creation like cylinder but they dont extend ConvexPolyhedron\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].PlaneImpostor || impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].HeightmapImpostor) {\r\n //-90 DEG in X, precalculated\r\n quaternion = quaternion.multiply(this._minus90X);\r\n //Invert! (Precalculated, 90 deg in X)\r\n //No need to clone. this will never change.\r\n impostor.setDeltaRotation(this._plus90X);\r\n }\r\n //If it is a heightfield, if should be centered.\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].HeightmapImpostor) {\r\n var mesh = object;\r\n var boundingInfo = mesh.getBoundingInfo();\r\n //calculate the correct body position:\r\n var rotationQuaternion = mesh.rotationQuaternion;\r\n mesh.rotationQuaternion = this._tmpUnityRotation;\r\n mesh.computeWorldMatrix(true);\r\n //get original center with no rotation\r\n var c = center.clone();\r\n var oldPivot = mesh.getPivotMatrix();\r\n if (oldPivot) {\r\n // create a copy the pivot Matrix as it is modified in place\r\n oldPivot = oldPivot.clone();\r\n }\r\n else {\r\n oldPivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n //calculate the new center using a pivot (since this.BJSCANNON.js doesn't center height maps)\r\n var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Translation(boundingInfo.boundingBox.extendSizeWorld.x, 0, -boundingInfo.boundingBox.extendSizeWorld.z);\r\n mesh.setPreTransformMatrix(p);\r\n mesh.computeWorldMatrix(true);\r\n //calculate the translation\r\n var translation = boundingInfo.boundingBox.centerWorld.subtract(center).subtract(mesh.position).negate();\r\n this._tmpPosition.copyFromFloats(translation.x, translation.y - boundingInfo.boundingBox.extendSizeWorld.y, translation.z);\r\n //add it inverted to the delta\r\n this._tmpDeltaPosition.copyFrom(boundingInfo.boundingBox.centerWorld.subtract(c));\r\n this._tmpDeltaPosition.y += boundingInfo.boundingBox.extendSizeWorld.y;\r\n //rotation is back\r\n mesh.rotationQuaternion = rotationQuaternion;\r\n mesh.setPreTransformMatrix(oldPivot);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n else if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].MeshImpostor) {\r\n this._tmpDeltaPosition.copyFromFloats(0, 0, 0);\r\n //this._tmpPosition.copyFrom(object.position);\r\n }\r\n impostor.setDeltaPosition(this._tmpDeltaPosition);\r\n //Now update the impostor object\r\n impostor.physicsBody.position.copy(this._tmpPosition);\r\n impostor.physicsBody.quaternion.copy(quaternion);\r\n };\r\n CannonJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {\r\n impostor.object.position.copyFrom(impostor.physicsBody.position);\r\n if (impostor.object.rotationQuaternion) {\r\n impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.quaternion);\r\n }\r\n };\r\n CannonJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {\r\n impostor.physicsBody.position.copy(newPosition);\r\n impostor.physicsBody.quaternion.copy(newRotation);\r\n };\r\n CannonJSPlugin.prototype.isSupported = function () {\r\n return this.BJSCANNON !== undefined;\r\n };\r\n CannonJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.velocity.copy(velocity);\r\n };\r\n CannonJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.angularVelocity.copy(velocity);\r\n };\r\n CannonJSPlugin.prototype.getLinearVelocity = function (impostor) {\r\n var v = impostor.physicsBody.velocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n CannonJSPlugin.prototype.getAngularVelocity = function (impostor) {\r\n var v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n CannonJSPlugin.prototype.setBodyMass = function (impostor, mass) {\r\n impostor.physicsBody.mass = mass;\r\n impostor.physicsBody.updateMassProperties();\r\n };\r\n CannonJSPlugin.prototype.getBodyMass = function (impostor) {\r\n return impostor.physicsBody.mass;\r\n };\r\n CannonJSPlugin.prototype.getBodyFriction = function (impostor) {\r\n return impostor.physicsBody.material.friction;\r\n };\r\n CannonJSPlugin.prototype.setBodyFriction = function (impostor, friction) {\r\n impostor.physicsBody.material.friction = friction;\r\n };\r\n CannonJSPlugin.prototype.getBodyRestitution = function (impostor) {\r\n return impostor.physicsBody.material.restitution;\r\n };\r\n CannonJSPlugin.prototype.setBodyRestitution = function (impostor, restitution) {\r\n impostor.physicsBody.material.restitution = restitution;\r\n };\r\n CannonJSPlugin.prototype.sleepBody = function (impostor) {\r\n impostor.physicsBody.sleep();\r\n };\r\n CannonJSPlugin.prototype.wakeUpBody = function (impostor) {\r\n impostor.physicsBody.wakeUp();\r\n };\r\n CannonJSPlugin.prototype.updateDistanceJoint = function (joint, maxDistance) {\r\n joint.physicsJoint.distance = maxDistance;\r\n };\r\n // private enableMotor(joint: IMotorEnabledJoint, motorIndex?: number) {\r\n // if (!motorIndex) {\r\n // joint.physicsJoint.enableMotor();\r\n // }\r\n // }\r\n // private disableMotor(joint: IMotorEnabledJoint, motorIndex?: number) {\r\n // if (!motorIndex) {\r\n // joint.physicsJoint.disableMotor();\r\n // }\r\n // }\r\n CannonJSPlugin.prototype.setMotor = function (joint, speed, maxForce, motorIndex) {\r\n if (!motorIndex) {\r\n joint.physicsJoint.enableMotor();\r\n joint.physicsJoint.setMotorSpeed(speed);\r\n if (maxForce) {\r\n this.setLimit(joint, maxForce);\r\n }\r\n }\r\n };\r\n CannonJSPlugin.prototype.setLimit = function (joint, upperLimit, lowerLimit) {\r\n joint.physicsJoint.motorEquation.maxForce = upperLimit;\r\n joint.physicsJoint.motorEquation.minForce = lowerLimit === void 0 ? -upperLimit : lowerLimit;\r\n };\r\n CannonJSPlugin.prototype.syncMeshWithImpostor = function (mesh, impostor) {\r\n var body = impostor.physicsBody;\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.quaternion.x;\r\n mesh.rotationQuaternion.y = body.quaternion.y;\r\n mesh.rotationQuaternion.z = body.quaternion.z;\r\n mesh.rotationQuaternion.w = body.quaternion.w;\r\n }\r\n };\r\n CannonJSPlugin.prototype.getRadius = function (impostor) {\r\n var shape = impostor.physicsBody.shapes[0];\r\n return shape.boundingSphereRadius;\r\n };\r\n CannonJSPlugin.prototype.getBoxSizeToRef = function (impostor, result) {\r\n var shape = impostor.physicsBody.shapes[0];\r\n result.x = shape.halfExtents.x * 2;\r\n result.y = shape.halfExtents.y * 2;\r\n result.z = shape.halfExtents.z * 2;\r\n };\r\n CannonJSPlugin.prototype.dispose = function () {\r\n };\r\n CannonJSPlugin.prototype._extendNamespace = function () {\r\n //this will force cannon to execute at least one step when using interpolation\r\n var step_tmp1 = new this.BJSCANNON.Vec3();\r\n var Engine = this.BJSCANNON;\r\n this.BJSCANNON.World.prototype.step = function (dt, timeSinceLastCalled, maxSubSteps) {\r\n maxSubSteps = maxSubSteps || 10;\r\n timeSinceLastCalled = timeSinceLastCalled || 0;\r\n if (timeSinceLastCalled === 0) {\r\n this.internalStep(dt);\r\n this.time += dt;\r\n }\r\n else {\r\n var internalSteps = Math.floor((this.time + timeSinceLastCalled) / dt) - Math.floor(this.time / dt);\r\n internalSteps = Math.min(internalSteps, maxSubSteps) || 1;\r\n var t0 = performance.now();\r\n for (var i = 0; i !== internalSteps; i++) {\r\n this.internalStep(dt);\r\n if (performance.now() - t0 > dt * 1000) {\r\n break;\r\n }\r\n }\r\n this.time += timeSinceLastCalled;\r\n var h = this.time % dt;\r\n var h_div_dt = h / dt;\r\n var interpvelo = step_tmp1;\r\n var bodies = this.bodies;\r\n for (var j = 0; j !== bodies.length; j++) {\r\n var b = bodies[j];\r\n if (b.type !== Engine.Body.STATIC && b.sleepState !== Engine.Body.SLEEPING) {\r\n b.position.vsub(b.previousPosition, interpvelo);\r\n interpvelo.scale(h_div_dt, interpvelo);\r\n b.position.vadd(interpvelo, b.interpolatedPosition);\r\n }\r\n else {\r\n b.interpolatedPosition.copy(b.position);\r\n b.interpolatedQuaternion.copy(b.quaternion);\r\n }\r\n }\r\n }\r\n };\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n CannonJSPlugin.prototype.raycast = function (from, to) {\r\n this._cannonRaycastResult.reset();\r\n this.world.raycastClosest(from, to, {}, this._cannonRaycastResult);\r\n this._raycastResult.reset(from, to);\r\n if (this._cannonRaycastResult.hasHit) {\r\n // TODO: do we also want to get the body it hit?\r\n this._raycastResult.setHitData({\r\n x: this._cannonRaycastResult.hitNormalWorld.x,\r\n y: this._cannonRaycastResult.hitNormalWorld.y,\r\n z: this._cannonRaycastResult.hitNormalWorld.z,\r\n }, {\r\n x: this._cannonRaycastResult.hitPointWorld.x,\r\n y: this._cannonRaycastResult.hitPointWorld.y,\r\n z: this._cannonRaycastResult.hitPointWorld.z,\r\n });\r\n this._raycastResult.setHitDistance(this._cannonRaycastResult.distance);\r\n }\r\n return this._raycastResult;\r\n };\r\n return CannonJSPlugin;\r\n}());\r\n\r\n_Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"].DefaultPluginFactory = function () { return new CannonJSPlugin(); };\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/index.ts\":\n/*!**********************************!*\\\n !*** ./Physics/Plugins/index.ts ***!\n \\**********************************/\n/*! exports provided: CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _cannonJSPlugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cannonJSPlugin */ \"./Physics/Plugins/cannonJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _cannonJSPlugin__WEBPACK_IMPORTED_MODULE_0__[\"CannonJSPlugin\"]; });\n\n/* harmony import */ var _ammoJSPlugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ammoJSPlugin */ \"./Physics/Plugins/ammoJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _ammoJSPlugin__WEBPACK_IMPORTED_MODULE_1__[\"AmmoJSPlugin\"]; });\n\n/* harmony import */ var _oimoJSPlugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./oimoJSPlugin */ \"./Physics/Plugins/oimoJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _oimoJSPlugin__WEBPACK_IMPORTED_MODULE_2__[\"OimoJSPlugin\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/oimoJSPlugin.ts\":\n/*!*****************************************!*\\\n !*** ./Physics/Plugins/oimoJSPlugin.ts ***!\n \\*****************************************/\n/*! exports provided: OimoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return OimoJSPlugin; });\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Physics/physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Physics/physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../physicsRaycastResult */ \"./Physics/physicsRaycastResult.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar OimoJSPlugin = /** @class */ (function () {\r\n function OimoJSPlugin(iterations, oimoInjection) {\r\n if (oimoInjection === void 0) { oimoInjection = OIMO; }\r\n this.name = \"OimoJSPlugin\";\r\n this._tmpImpostorsArray = [];\r\n this._tmpPositionVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.BJSOIMO = oimoInjection;\r\n this.world = new this.BJSOIMO.World({\r\n iterations: iterations\r\n });\r\n this.world.clear();\r\n this._raycastResult = new _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsRaycastResult\"]();\r\n }\r\n OimoJSPlugin.prototype.setGravity = function (gravity) {\r\n this.world.gravity.copy(gravity);\r\n };\r\n OimoJSPlugin.prototype.setTimeStep = function (timeStep) {\r\n this.world.timeStep = timeStep;\r\n };\r\n OimoJSPlugin.prototype.getTimeStep = function () {\r\n return this.world.timeStep;\r\n };\r\n OimoJSPlugin.prototype.executeStep = function (delta, impostors) {\r\n var _this = this;\r\n impostors.forEach(function (impostor) {\r\n impostor.beforeStep();\r\n });\r\n this.world.step();\r\n impostors.forEach(function (impostor) {\r\n impostor.afterStep();\r\n //update the ordered impostors array\r\n _this._tmpImpostorsArray[impostor.uniqueId] = impostor;\r\n });\r\n //check for collisions\r\n var contact = this.world.contacts;\r\n while (contact !== null) {\r\n if (contact.touching && !contact.body1.sleeping && !contact.body2.sleeping) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n //is this body colliding with any other? get the impostor\r\n var mainImpostor = this._tmpImpostorsArray[+contact.body1.name];\r\n var collidingImpostor = this._tmpImpostorsArray[+contact.body2.name];\r\n if (!mainImpostor || !collidingImpostor) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n mainImpostor.onCollide({ body: collidingImpostor.physicsBody });\r\n collidingImpostor.onCollide({ body: mainImpostor.physicsBody });\r\n contact = contact.next;\r\n }\r\n };\r\n OimoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {\r\n var mass = impostor.physicsBody.mass;\r\n impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));\r\n };\r\n OimoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"Oimo doesn't support applying force. Using impule instead.\");\r\n this.applyImpulse(impostor, force, contactPoint);\r\n };\r\n OimoJSPlugin.prototype.generatePhysicsBody = function (impostor) {\r\n var _this = this;\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n if (impostor.isBodyInitRequired()) {\r\n var bodyConfig = {\r\n name: impostor.uniqueId,\r\n //Oimo must have mass, also for static objects.\r\n config: [impostor.getParam(\"mass\") || 1, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\")],\r\n size: [],\r\n type: [],\r\n pos: [],\r\n posShape: [],\r\n rot: [],\r\n rotShape: [],\r\n move: impostor.getParam(\"mass\") !== 0,\r\n density: impostor.getParam(\"mass\"),\r\n friction: impostor.getParam(\"friction\"),\r\n restitution: impostor.getParam(\"restitution\"),\r\n //Supporting older versions of Oimo\r\n world: this.world\r\n };\r\n var impostors = [impostor];\r\n var addToArray = function (parent) {\r\n if (!parent.getChildMeshes) {\r\n return;\r\n }\r\n parent.getChildMeshes().forEach(function (m) {\r\n if (m.physicsImpostor) {\r\n impostors.push(m.physicsImpostor);\r\n //m.physicsImpostor._init();\r\n }\r\n });\r\n };\r\n addToArray(impostor.object);\r\n var checkWithEpsilon_1 = function (value) {\r\n return Math.max(value, _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsEngine\"].Epsilon);\r\n };\r\n var globalQuaternion_1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n impostors.forEach(function (i) {\r\n if (!i.object.rotationQuaternion) {\r\n return;\r\n }\r\n //get the correct bounding box\r\n var oldQuaternion = i.object.rotationQuaternion;\r\n globalQuaternion_1 = oldQuaternion.clone();\r\n var rot = oldQuaternion.toEulerAngles();\r\n var extendSize = i.getObjectExtendSize();\r\n var radToDeg = 57.295779513082320876;\r\n if (i === impostor) {\r\n var center = impostor.getObjectCenter();\r\n impostor.object.getAbsolutePivotPoint().subtractToRef(center, _this._tmpPositionVector);\r\n _this._tmpPositionVector.divideInPlace(impostor.object.scaling);\r\n //Can also use Array.prototype.push.apply\r\n bodyConfig.pos.push(center.x);\r\n bodyConfig.pos.push(center.y);\r\n bodyConfig.pos.push(center.z);\r\n bodyConfig.posShape.push(0, 0, 0);\r\n bodyConfig.rotShape.push(0, 0, 0);\r\n }\r\n else {\r\n var localPosition = i.object.getAbsolutePosition().subtract(impostor.object.getAbsolutePosition());\r\n bodyConfig.posShape.push(localPosition.x);\r\n bodyConfig.posShape.push(localPosition.y);\r\n bodyConfig.posShape.push(localPosition.z);\r\n bodyConfig.pos.push(0, 0, 0);\r\n bodyConfig.rotShape.push(rot.x * radToDeg);\r\n bodyConfig.rotShape.push(rot.y * radToDeg);\r\n bodyConfig.rotShape.push(rot.z * radToDeg);\r\n }\r\n // register mesh\r\n switch (i.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].ParticleImpostor:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"No Particle support in OIMO.js. using SphereImpostor instead\");\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].SphereImpostor:\r\n var radiusX = extendSize.x;\r\n var radiusY = extendSize.y;\r\n var radiusZ = extendSize.z;\r\n var size = Math.max(checkWithEpsilon_1(radiusX), checkWithEpsilon_1(radiusY), checkWithEpsilon_1(radiusZ)) / 2;\r\n bodyConfig.type.push('sphere');\r\n //due to the way oimo works with compounds, add 3 times\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].CylinderImpostor:\r\n var sizeX = checkWithEpsilon_1(extendSize.x) / 2;\r\n var sizeY = checkWithEpsilon_1(extendSize.y);\r\n bodyConfig.type.push('cylinder');\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n //due to the way oimo works with compounds, add one more value.\r\n bodyConfig.size.push(sizeY);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].PlaneImpostor:\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].BoxImpostor:\r\n default:\r\n var sizeX = checkWithEpsilon_1(extendSize.x);\r\n var sizeY = checkWithEpsilon_1(extendSize.y);\r\n var sizeZ = checkWithEpsilon_1(extendSize.z);\r\n bodyConfig.type.push('box');\r\n //if (i === impostor) {\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n bodyConfig.size.push(sizeZ);\r\n //} else {\r\n // bodyConfig.size.push(0,0,0);\r\n //}\r\n break;\r\n }\r\n //actually not needed, but hey...\r\n i.object.rotationQuaternion = oldQuaternion;\r\n });\r\n impostor.physicsBody = this.world.add(bodyConfig);\r\n // set the quaternion, ignoring the previously defined (euler) rotation\r\n impostor.physicsBody.resetQuaternion(globalQuaternion_1);\r\n // update with delta 0, so the body will reveive the new rotation.\r\n impostor.physicsBody.updatePosition(0);\r\n }\r\n else {\r\n this._tmpPositionVector.copyFromFloats(0, 0, 0);\r\n }\r\n impostor.setDeltaPosition(this._tmpPositionVector);\r\n //this._tmpPositionVector.addInPlace(impostor.mesh.getBoundingInfo().boundingBox.center);\r\n //this.setPhysicsBodyTransformation(impostor, this._tmpPositionVector, impostor.mesh.rotationQuaternion);\r\n };\r\n OimoJSPlugin.prototype.removePhysicsBody = function (impostor) {\r\n //impostor.physicsBody.dispose();\r\n //Same as : (older oimo versions)\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n };\r\n OimoJSPlugin.prototype.generateJoint = function (impostorJoint) {\r\n var mainBody = impostorJoint.mainImpostor.physicsBody;\r\n var connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n var jointData = impostorJoint.joint.jointData;\r\n var options = jointData.nativeParams || {};\r\n var type;\r\n var nativeJointData = {\r\n body1: mainBody,\r\n body2: connectedBody,\r\n axe1: options.axe1 || (jointData.mainAxis ? jointData.mainAxis.asArray() : null),\r\n axe2: options.axe2 || (jointData.connectedAxis ? jointData.connectedAxis.asArray() : null),\r\n pos1: options.pos1 || (jointData.mainPivot ? jointData.mainPivot.asArray() : null),\r\n pos2: options.pos2 || (jointData.connectedPivot ? jointData.connectedPivot.asArray() : null),\r\n min: options.min,\r\n max: options.max,\r\n collision: options.collision || jointData.collision,\r\n spring: options.spring,\r\n //supporting older version of Oimo\r\n world: this.world\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].BallAndSocketJoint:\r\n type = \"jointBall\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].SpringJoint:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead\");\r\n var springData = jointData;\r\n nativeJointData.min = springData.length || nativeJointData.min;\r\n //Max should also be set, just make sure it is at least min\r\n nativeJointData.max = Math.max(nativeJointData.min, nativeJointData.max);\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].DistanceJoint:\r\n type = \"jointDistance\";\r\n nativeJointData.max = jointData.maxDistance;\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].PrismaticJoint:\r\n type = \"jointPrisme\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].SliderJoint:\r\n type = \"jointSlide\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].WheelJoint:\r\n type = \"jointWheel\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].HingeJoint:\r\n default:\r\n type = \"jointHinge\";\r\n break;\r\n }\r\n nativeJointData.type = type;\r\n impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);\r\n };\r\n OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {\r\n //Bug in Oimo prevents us from disposing a joint in the playground\r\n //joint.joint.physicsJoint.dispose();\r\n //So we will bruteforce it!\r\n try {\r\n this.world.removeJoint(impostorJoint.joint.physicsJoint);\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(e);\r\n }\r\n };\r\n OimoJSPlugin.prototype.isSupported = function () {\r\n return this.BJSOIMO !== undefined;\r\n };\r\n OimoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {\r\n if (!impostor.physicsBody.sleeping) {\r\n //TODO check that\r\n /*if (impostor.physicsBody.shapes.next) {\r\n var parentShape = this._getLastShape(impostor.physicsBody);\r\n impostor.object.position.copyFrom(parentShape.position);\r\n console.log(parentShape.position);\r\n } else {*/\r\n impostor.object.position.copyFrom(impostor.physicsBody.getPosition());\r\n //}\r\n if (impostor.object.rotationQuaternion) {\r\n impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.getQuaternion());\r\n }\r\n }\r\n };\r\n OimoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {\r\n var body = impostor.physicsBody;\r\n body.position.copy(newPosition);\r\n body.orientation.copy(newRotation);\r\n body.syncShapes();\r\n body.awake();\r\n };\r\n /*private _getLastShape(body: any): any {\r\n var lastShape = body.shapes;\r\n while (lastShape.next) {\r\n lastShape = lastShape.next;\r\n }\r\n return lastShape;\r\n }*/\r\n OimoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.linearVelocity.copy(velocity);\r\n };\r\n OimoJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.angularVelocity.copy(velocity);\r\n };\r\n OimoJSPlugin.prototype.getLinearVelocity = function (impostor) {\r\n var v = impostor.physicsBody.linearVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n OimoJSPlugin.prototype.getAngularVelocity = function (impostor) {\r\n var v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n OimoJSPlugin.prototype.setBodyMass = function (impostor, mass) {\r\n var staticBody = mass === 0;\r\n //this will actually set the body's density and not its mass.\r\n //But this is how oimo treats the mass variable.\r\n impostor.physicsBody.shapes.density = staticBody ? 1 : mass;\r\n impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);\r\n };\r\n OimoJSPlugin.prototype.getBodyMass = function (impostor) {\r\n return impostor.physicsBody.shapes.density;\r\n };\r\n OimoJSPlugin.prototype.getBodyFriction = function (impostor) {\r\n return impostor.physicsBody.shapes.friction;\r\n };\r\n OimoJSPlugin.prototype.setBodyFriction = function (impostor, friction) {\r\n impostor.physicsBody.shapes.friction = friction;\r\n };\r\n OimoJSPlugin.prototype.getBodyRestitution = function (impostor) {\r\n return impostor.physicsBody.shapes.restitution;\r\n };\r\n OimoJSPlugin.prototype.setBodyRestitution = function (impostor, restitution) {\r\n impostor.physicsBody.shapes.restitution = restitution;\r\n };\r\n OimoJSPlugin.prototype.sleepBody = function (impostor) {\r\n impostor.physicsBody.sleep();\r\n };\r\n OimoJSPlugin.prototype.wakeUpBody = function (impostor) {\r\n impostor.physicsBody.awake();\r\n };\r\n OimoJSPlugin.prototype.updateDistanceJoint = function (joint, maxDistance, minDistance) {\r\n joint.physicsJoint.limitMotor.upperLimit = maxDistance;\r\n if (minDistance !== void 0) {\r\n joint.physicsJoint.limitMotor.lowerLimit = minDistance;\r\n }\r\n };\r\n OimoJSPlugin.prototype.setMotor = function (joint, speed, force, motorIndex) {\r\n if (force !== undefined) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"OimoJS plugin currently has unexpected behavior when using setMotor with force parameter\");\r\n }\r\n else {\r\n force = 1e6;\r\n }\r\n speed *= -1;\r\n //TODO separate rotational and transational motors.\r\n var motor = motorIndex ? joint.physicsJoint.rotationalLimitMotor2 : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setMotor(speed, force);\r\n }\r\n };\r\n OimoJSPlugin.prototype.setLimit = function (joint, upperLimit, lowerLimit, motorIndex) {\r\n //TODO separate rotational and transational motors.\r\n var motor = motorIndex ? joint.physicsJoint.rotationalLimitMotor2 : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setLimit(upperLimit, lowerLimit === void 0 ? -upperLimit : lowerLimit);\r\n }\r\n };\r\n OimoJSPlugin.prototype.syncMeshWithImpostor = function (mesh, impostor) {\r\n var body = impostor.physicsBody;\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.orientation.x;\r\n mesh.rotationQuaternion.y = body.orientation.y;\r\n mesh.rotationQuaternion.z = body.orientation.z;\r\n mesh.rotationQuaternion.w = body.orientation.s;\r\n }\r\n };\r\n OimoJSPlugin.prototype.getRadius = function (impostor) {\r\n return impostor.physicsBody.shapes.radius;\r\n };\r\n OimoJSPlugin.prototype.getBoxSizeToRef = function (impostor, result) {\r\n var shape = impostor.physicsBody.shapes;\r\n result.x = shape.halfWidth * 2;\r\n result.y = shape.halfHeight * 2;\r\n result.z = shape.halfDepth * 2;\r\n };\r\n OimoJSPlugin.prototype.dispose = function () {\r\n this.world.clear();\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n OimoJSPlugin.prototype.raycast = function (from, to) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n this._raycastResult.reset(from, to);\r\n return this._raycastResult;\r\n };\r\n return OimoJSPlugin;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/index.ts\":\n/*!**************************!*\\\n !*** ./Physics/index.ts ***!\n \\**************************/\n/*! exports provided: PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _physicsEngine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return _physicsEngine__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsEngine\"]; });\n\n/* harmony import */ var _physicsEngineComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./physicsEngineComponent */ \"./Physics/physicsEngineComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return _physicsEngineComponent__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsEngineSceneComponent\"]; });\n\n/* harmony import */ var _physicsHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./physicsHelper */ \"./Physics/physicsHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsRadialExplosionEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsUpdraftEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsVortexEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsRadialImpulseFalloff\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsUpdraftMode\"]; });\n\n/* harmony import */ var _physicsImpostor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return _physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"]; });\n\n/* harmony import */ var _physicsJoint__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"DistanceJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"MotorEnabledJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"HingeJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"Hinge2Joint\"]; });\n\n/* harmony import */ var _Plugins_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Plugins/index */ \"./Physics/Plugins/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_5__[\"CannonJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_5__[\"AmmoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_5__[\"OimoJSPlugin\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsEngine.ts\":\n/*!**********************************!*\\\n !*** ./Physics/physicsEngine.ts ***!\n \\**********************************/\n/*! exports provided: PhysicsEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return PhysicsEngine; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n/**\r\n * Class used to control physics engine\r\n * @see http://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsEngine = /** @class */ (function () {\r\n /**\r\n * Creates a new Physics Engine\r\n * @param gravity defines the gravity vector used by the simulation\r\n * @param _physicsPlugin defines the plugin to use (CannonJS by default)\r\n */\r\n function PhysicsEngine(gravity, _physicsPlugin) {\r\n if (_physicsPlugin === void 0) { _physicsPlugin = PhysicsEngine.DefaultPluginFactory(); }\r\n this._physicsPlugin = _physicsPlugin;\r\n this._impostors = [];\r\n this._joints = [];\r\n if (!this._physicsPlugin.isSupported()) {\r\n throw new Error(\"Physics Engine \" + this._physicsPlugin.name + \" cannot be found. \"\r\n + \"Please make sure it is included.\");\r\n }\r\n gravity = gravity || new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -9.807, 0);\r\n this.setGravity(gravity);\r\n this.setTimeStep();\r\n }\r\n /**\r\n * Factory used to create the default physics plugin.\r\n * @returns The default physics plugin\r\n */\r\n PhysicsEngine.DefaultPluginFactory = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_1__[\"_DevTools\"].WarnImport(\"CannonJSPlugin\");\r\n };\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n PhysicsEngine.prototype.setGravity = function (gravity) {\r\n this.gravity = gravity;\r\n this._physicsPlugin.setGravity(this.gravity);\r\n };\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * @param newTimeStep defines the new timestep to apply to this world.\r\n */\r\n PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {\r\n if (newTimeStep === void 0) { newTimeStep = 1 / 60; }\r\n this._physicsPlugin.setTimeStep(newTimeStep);\r\n };\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n PhysicsEngine.prototype.getTimeStep = function () {\r\n return this._physicsPlugin.getTimeStep();\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n PhysicsEngine.prototype.dispose = function () {\r\n this._impostors.forEach(function (impostor) {\r\n impostor.dispose();\r\n });\r\n this._physicsPlugin.dispose();\r\n };\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n PhysicsEngine.prototype.getPhysicsPluginName = function () {\r\n return this._physicsPlugin.name;\r\n };\r\n /**\r\n * Adding a new impostor for the impostor tracking.\r\n * This will be done by the impostor itself.\r\n * @param impostor the impostor to add\r\n */\r\n PhysicsEngine.prototype.addImpostor = function (impostor) {\r\n impostor.uniqueId = this._impostors.push(impostor);\r\n //if no parent, generate the body\r\n if (!impostor.parent) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n };\r\n /**\r\n * Remove an impostor from the engine.\r\n * This impostor and its mesh will not longer be updated by the physics engine.\r\n * @param impostor the impostor to remove\r\n */\r\n PhysicsEngine.prototype.removeImpostor = function (impostor) {\r\n var index = this._impostors.indexOf(impostor);\r\n if (index > -1) {\r\n var removed = this._impostors.splice(index, 1);\r\n //Is it needed?\r\n if (removed.length) {\r\n this.getPhysicsPlugin().removePhysicsBody(impostor);\r\n }\r\n }\r\n };\r\n /**\r\n * Add a joint to the physics engine\r\n * @param mainImpostor defines the main impostor to which the joint is added.\r\n * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint\r\n * @param joint defines the joint that will connect both impostors.\r\n */\r\n PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {\r\n var impostorJoint = {\r\n mainImpostor: mainImpostor,\r\n connectedImpostor: connectedImpostor,\r\n joint: joint\r\n };\r\n joint.physicsPlugin = this._physicsPlugin;\r\n this._joints.push(impostorJoint);\r\n this._physicsPlugin.generateJoint(impostorJoint);\r\n };\r\n /**\r\n * Removes a joint from the simulation\r\n * @param mainImpostor defines the impostor used with the joint\r\n * @param connectedImpostor defines the other impostor connected to the main one by the joint\r\n * @param joint defines the joint to remove\r\n */\r\n PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {\r\n var matchingJoints = this._joints.filter(function (impostorJoint) {\r\n return (impostorJoint.connectedImpostor === connectedImpostor\r\n && impostorJoint.joint === joint\r\n && impostorJoint.mainImpostor === mainImpostor);\r\n });\r\n if (matchingJoints.length) {\r\n this._physicsPlugin.removeJoint(matchingJoints[0]);\r\n //TODO remove it from the list as well\r\n }\r\n };\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespam between frames\r\n */\r\n PhysicsEngine.prototype._step = function (delta) {\r\n var _this = this;\r\n //check if any mesh has no body / requires an update\r\n this._impostors.forEach(function (impostor) {\r\n if (impostor.isBodyInitRequired()) {\r\n _this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n });\r\n if (delta > 0.1) {\r\n delta = 0.1;\r\n }\r\n else if (delta <= 0) {\r\n delta = 1.0 / 60.0;\r\n }\r\n this._physicsPlugin.executeStep(delta, this._impostors);\r\n };\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n PhysicsEngine.prototype.getPhysicsPlugin = function () {\r\n return this._physicsPlugin;\r\n };\r\n /**\r\n * Gets the list of physic impostors\r\n * @returns an array of PhysicsImpostor\r\n */\r\n PhysicsEngine.prototype.getImpostors = function () {\r\n return this._impostors;\r\n };\r\n /**\r\n * Gets the impostor for a physics enabled object\r\n * @param object defines the object impersonated by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {\r\n for (var i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].object === object) {\r\n return this._impostors[i];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the impostor for a physics body object\r\n * @param body defines physics body used by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {\r\n for (var i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].physicsBody === body) {\r\n return this._impostors[i];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n PhysicsEngine.prototype.raycast = function (from, to) {\r\n return this._physicsPlugin.raycast(from, to);\r\n };\r\n /**\r\n * Global value used to control the smallest number supported by the simulation\r\n */\r\n PhysicsEngine.Epsilon = 0.001;\r\n return PhysicsEngine;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsEngineComponent.ts\":\n/*!*******************************************!*\\\n !*** ./Physics/physicsEngineComponent.ts ***!\n \\*******************************************/\n/*! exports provided: PhysicsEngineSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return PhysicsEngineSceneComponent; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _physicsEngine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony import */ var _physicsJoint__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./physicsJoint */ \"./Physics/physicsJoint.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gets the current physics engine\r\n * @returns a IPhysicsEngine or null if none attached\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.getPhysicsEngine = function () {\r\n return this._physicsEngine;\r\n};\r\n/**\r\n * Enables physics to the current scene\r\n * @param gravity defines the scene's gravity for the physics engine\r\n * @param plugin defines the physics engine to be used. defaults to OimoJS.\r\n * @return a boolean indicating if the physics engine was initialized\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.enablePhysics = function (gravity, plugin) {\r\n if (gravity === void 0) { gravity = null; }\r\n if (this._physicsEngine) {\r\n return true;\r\n }\r\n // Register the component to the scene\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_PHYSICSENGINE);\r\n if (!component) {\r\n component = new PhysicsEngineSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n try {\r\n this._physicsEngine = new _physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"](gravity, plugin);\r\n return true;\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(e.message);\r\n return false;\r\n }\r\n};\r\n/**\r\n * Disables and disposes the physics engine associated with the scene\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.disablePhysicsEngine = function () {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.dispose();\r\n this._physicsEngine = null;\r\n};\r\n/**\r\n * Gets a boolean indicating if there is an active physics engine\r\n * @returns a boolean indicating if there is an active physics engine\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.isPhysicsEnabled = function () {\r\n return this._physicsEngine !== undefined;\r\n};\r\n/**\r\n * Deletes a physics compound impostor\r\n * @param compound defines the compound to delete\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.deleteCompoundImpostor = function (compound) {\r\n var mesh = compound.parts[0].mesh;\r\n if (mesh.physicsImpostor) {\r\n mesh.physicsImpostor.dispose( /*true*/);\r\n mesh.physicsImpostor = null;\r\n }\r\n};\r\n/** @hidden */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype._advancePhysicsEngineStep = function (step) {\r\n if (this._physicsEngine) {\r\n this.onBeforePhysicsObservable.notifyObservers(this);\r\n this._physicsEngine._step(step / 1000);\r\n this.onAfterPhysicsObservable.notifyObservers(this);\r\n }\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype, \"physicsImpostor\", {\r\n get: function () {\r\n return this._physicsImpostor;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._physicsImpostor === value) {\r\n return;\r\n }\r\n if (this._disposePhysicsObserver) {\r\n this.onDisposeObservable.remove(this._disposePhysicsObserver);\r\n }\r\n this._physicsImpostor = value;\r\n if (value) {\r\n this._disposePhysicsObserver = this.onDisposeObservable.add(function () {\r\n // Physics\r\n if (_this.physicsImpostor) {\r\n _this.physicsImpostor.dispose( /*!doNotRecurse*/);\r\n _this.physicsImpostor = null;\r\n }\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Gets the current physics impostor\r\n * @see http://doc.babylonjs.com/features/physics_engine\r\n * @returns a physics impostor or null\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.getPhysicsImpostor = function () {\r\n return this.physicsImpostor;\r\n};\r\n/**\r\n * Apply a physic impulse to the mesh\r\n * @param force defines the force to apply\r\n * @param contactPoint defines where to apply the force\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.applyImpulse = function (force, contactPoint) {\r\n if (!this.physicsImpostor) {\r\n return this;\r\n }\r\n this.physicsImpostor.applyImpulse(force, contactPoint);\r\n return this;\r\n};\r\n/**\r\n * Creates a physic joint between two meshes\r\n * @param otherMesh defines the other mesh to use\r\n * @param pivot1 defines the pivot to use on this mesh\r\n * @param pivot2 defines the pivot to use on the other mesh\r\n * @param options defines additional options (can be plugin dependent)\r\n * @returns the current mesh\r\n * @see https://www.babylonjs-playground.com/#0BS5U0#0\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.setPhysicsLinkWith = function (otherMesh, pivot1, pivot2, options) {\r\n if (!this.physicsImpostor || !otherMesh.physicsImpostor) {\r\n return this;\r\n }\r\n this.physicsImpostor.createJoint(otherMesh.physicsImpostor, _physicsJoint__WEBPACK_IMPORTED_MODULE_6__[\"PhysicsJoint\"].HingeJoint, {\r\n mainPivot: pivot1,\r\n connectedPivot: pivot2,\r\n nativeParams: options\r\n });\r\n return this;\r\n};\r\n/**\r\n * Defines the physics engine scene component responsible to manage a physics engine\r\n */\r\nvar PhysicsEngineSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function PhysicsEngineSceneComponent(scene) {\r\n var _this = this;\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_PHYSICSENGINE;\r\n this.scene = scene;\r\n this.scene.onBeforePhysicsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this.scene.onAfterPhysicsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n // Replace the function used to get the deterministic frame time\r\n this.scene.getDeterministicFrameTime = function () {\r\n if (_this.scene._physicsEngine) {\r\n return _this.scene._physicsEngine.getTimeStep() * 1000;\r\n }\r\n return 1000.0 / 60.0;\r\n };\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n PhysicsEngineSceneComponent.prototype.register = function () {\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n PhysicsEngineSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n PhysicsEngineSceneComponent.prototype.dispose = function () {\r\n this.scene.onBeforePhysicsObservable.clear();\r\n this.scene.onAfterPhysicsObservable.clear();\r\n if (this.scene._physicsEngine) {\r\n this.scene.disablePhysicsEngine();\r\n }\r\n };\r\n return PhysicsEngineSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsHelper.ts\":\n/*!**********************************!*\\\n !*** ./Physics/physicsHelper.ts ***!\n \\**********************************/\n/*! exports provided: PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return PhysicsHelper; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return PhysicsRadialExplosionEventOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return PhysicsUpdraftEventOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return PhysicsVortexEventOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return PhysicsRadialImpulseFalloff; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return PhysicsUpdraftMode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Culling/ray */ \"./Culling/ray.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A helper for physics simulations\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsHelper = /** @class */ (function () {\r\n /**\r\n * Initializes the Physics helper\r\n * @param scene Babylon.js scene\r\n */\r\n function PhysicsHelper(scene) {\r\n this._scene = scene;\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you can use the methods.');\r\n return;\r\n }\r\n }\r\n /**\r\n * Applies a radial explosion impulse\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n PhysicsHelper.prototype.applyRadialExplosionImpulse = function (origin, radiusOrEventOptions, strength, falloff) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call this method.');\r\n return null;\r\n }\r\n var impostors = this._physicsEngine.getImpostors();\r\n if (impostors.length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff || radiusOrEventOptions.falloff;\r\n }\r\n var event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n var affectedImpostorsWithData = Array();\r\n impostors.forEach(function (impostor) {\r\n var impostorHitData = event.getImpostorHitData(impostor, origin);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyImpulse(impostorHitData.force, impostorHitData.contactPoint);\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: impostorHitData,\r\n });\r\n });\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Applies a radial explosion force\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n PhysicsHelper.prototype.applyRadialExplosionForce = function (origin, radiusOrEventOptions, strength, falloff) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n var impostors = this._physicsEngine.getImpostors();\r\n if (impostors.length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff || radiusOrEventOptions.falloff;\r\n }\r\n var event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n var affectedImpostorsWithData = Array();\r\n impostors.forEach(function (impostor) {\r\n var impostorHitData = event.getImpostorHitData(impostor, origin);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyForce(impostorHitData.force, impostorHitData.contactPoint);\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: impostorHitData,\r\n });\r\n });\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Creates a gravitational field\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics gravitational field event, or null\r\n */\r\n PhysicsHelper.prototype.gravitationalField = function (origin, radiusOrEventOptions, strength, falloff) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n var impostors = this._physicsEngine.getImpostors();\r\n if (impostors.length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff || radiusOrEventOptions.falloff;\r\n }\r\n var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radiusOrEventOptions);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Creates a physics updraft event\r\n * @param origin the origin of the updraft\r\n * @param radiusOrEventOptions the radius or the options of the updraft\r\n * @param strength the strength of the updraft\r\n * @param height the height of the updraft\r\n * @param updraftMode possible options: Center & Perpendicular. Defaults to Center\r\n * @returns A physics updraft event, or null\r\n */\r\n PhysicsHelper.prototype.updraft = function (origin, radiusOrEventOptions, strength, height, updraftMode) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n if (this._physicsEngine.getImpostors().length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsUpdraftEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height || radiusOrEventOptions.height;\r\n radiusOrEventOptions.updraftMode = updraftMode || radiusOrEventOptions.updraftMode;\r\n }\r\n var event = new PhysicsUpdraftEvent(this._scene, origin, radiusOrEventOptions);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Creates a physics vortex event\r\n * @param origin the of the vortex\r\n * @param radiusOrEventOptions the radius or the options of the vortex\r\n * @param strength the strength of the vortex\r\n * @param height the height of the vortex\r\n * @returns a Physics vortex event, or null\r\n * A physics vortex event or null\r\n */\r\n PhysicsHelper.prototype.vortex = function (origin, radiusOrEventOptions, strength, height) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n if (this._physicsEngine.getImpostors().length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsVortexEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height || radiusOrEventOptions.height;\r\n }\r\n var event = new PhysicsVortexEvent(this._scene, origin, radiusOrEventOptions);\r\n event.dispose(false);\r\n return event;\r\n };\r\n return PhysicsHelper;\r\n}());\r\n\r\n/**\r\n * Represents a physics radial explosion event\r\n */\r\nvar PhysicsRadialExplosionEvent = /** @class */ (function () {\r\n /**\r\n * Initializes a radial explosioin event\r\n * @param _scene BabylonJS scene\r\n * @param _options The options for the vortex event\r\n */\r\n function PhysicsRadialExplosionEvent(_scene, _options) {\r\n this._scene = _scene;\r\n this._options = _options;\r\n this._dataFetched = false; // check if the data has been fetched. If not, do cleanup\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsRadialExplosionEventOptions()), this._options);\r\n }\r\n /**\r\n * Returns the data related to the radial explosion event (sphere).\r\n * @returns The radial explosion event data\r\n */\r\n PhysicsRadialExplosionEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n sphere: this._sphere,\r\n };\r\n };\r\n /**\r\n * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.\r\n * @param impostor A physics imposter\r\n * @param origin the origin of the explosion\r\n * @returns {Nullable} A physics force and contact point, or null\r\n */\r\n PhysicsRadialExplosionEvent.prototype.getImpostorHitData = function (impostor, origin) {\r\n if (impostor.mass === 0) {\r\n return null;\r\n }\r\n if (!this._intersectsWithSphere(impostor, origin, this._options.radius)) {\r\n return null;\r\n }\r\n if (impostor.object.getClassName() !== 'Mesh' && impostor.object.getClassName() !== 'InstancedMesh') {\r\n return null;\r\n }\r\n var impostorObjectCenter = impostor.getObjectCenter();\r\n var direction = impostorObjectCenter.subtract(origin);\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](origin, direction, this._options.radius);\r\n var hit = ray.intersectsMesh(impostor.object);\r\n var contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return null;\r\n }\r\n var distanceFromOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Distance(origin, contactPoint);\r\n if (distanceFromOrigin > this._options.radius) {\r\n return null;\r\n }\r\n var multiplier = this._options.falloff === PhysicsRadialImpulseFalloff.Constant\r\n ? this._options.strength\r\n : this._options.strength * (1 - (distanceFromOrigin / this._options.radius));\r\n var force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n return { force: force, contactPoint: contactPoint, distanceFromOrigin: distanceFromOrigin };\r\n };\r\n /**\r\n * Triggers affecterd impostors callbacks\r\n * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)\r\n */\r\n PhysicsRadialExplosionEvent.prototype.triggerAffectedImpostorsCallback = function (affectedImpostorsWithData) {\r\n if (this._options.affectedImpostorsCallback) {\r\n this._options.affectedImpostorsCallback(affectedImpostorsWithData);\r\n }\r\n };\r\n /**\r\n * Disposes the sphere.\r\n * @param force Specifies if the sphere should be disposed by force\r\n */\r\n PhysicsRadialExplosionEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (force) {\r\n this._sphere.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n /*** Helpers ***/\r\n PhysicsRadialExplosionEvent.prototype._prepareSphere = function () {\r\n if (!this._sphere) {\r\n this._sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_3__[\"SphereBuilder\"].CreateSphere(\"radialExplosionEventSphere\", this._options.sphere, this._scene);\r\n this._sphere.isVisible = false;\r\n }\r\n };\r\n PhysicsRadialExplosionEvent.prototype._intersectsWithSphere = function (impostor, origin, radius) {\r\n var impostorObject = impostor.object;\r\n this._prepareSphere();\r\n this._sphere.position = origin;\r\n this._sphere.scaling = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](radius * 2, radius * 2, radius * 2);\r\n this._sphere._updateBoundingInfo();\r\n this._sphere.computeWorldMatrix(true);\r\n return this._sphere.intersectsMesh(impostorObject, true);\r\n };\r\n return PhysicsRadialExplosionEvent;\r\n}());\r\n/**\r\n * Represents a gravitational field event\r\n */\r\nvar PhysicsGravitationalFieldEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the physics gravitational field event\r\n * @param _physicsHelper A physics helper\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the gravitational field event\r\n * @param _options The options for the vortex event\r\n */\r\n function PhysicsGravitationalFieldEvent(_physicsHelper, _scene, _origin, _options) {\r\n this._physicsHelper = _physicsHelper;\r\n this._scene = _scene;\r\n this._origin = _origin;\r\n this._options = _options;\r\n this._dataFetched = false; // check if the has been fetched the data. If not, do cleanup\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsRadialExplosionEventOptions()), this._options);\r\n this._tickCallback = this._tick.bind(this);\r\n this._options.strength = this._options.strength * -1;\r\n }\r\n /**\r\n * Returns the data related to the gravitational field event (sphere).\r\n * @returns A gravitational field event\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n sphere: this._sphere,\r\n };\r\n };\r\n /**\r\n * Enables the gravitational field.\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.enable = function () {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disables the gravitational field.\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.disable = function () {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disposes the sphere.\r\n * @param force The force to dispose from the gravitational field event\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (force) {\r\n this._sphere.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n PhysicsGravitationalFieldEvent.prototype._tick = function () {\r\n // Since the params won't change, we fetch the event only once\r\n if (this._sphere) {\r\n this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n }\r\n else {\r\n var radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n if (radialExplosionEvent) {\r\n this._sphere = radialExplosionEvent.getData().sphere.clone('radialExplosionEventSphereClone');\r\n }\r\n }\r\n };\r\n return PhysicsGravitationalFieldEvent;\r\n}());\r\n/**\r\n * Represents a physics updraft event\r\n */\r\nvar PhysicsUpdraftEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the physics updraft event\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the updraft\r\n * @param _options The options for the updraft event\r\n */\r\n function PhysicsUpdraftEvent(_scene, _origin, _options) {\r\n this._scene = _scene;\r\n this._origin = _origin;\r\n this._options = _options;\r\n this._originTop = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // the most upper part of the cylinder\r\n this._originDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // used if the updraftMode is perpendicular\r\n this._cylinderPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n this._dataFetched = false; // check if the has been fetched the data. If not, do cleanup\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsUpdraftEventOptions()), this._options);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height, 0), this._originTop);\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n this._originDirection = this._origin.subtract(this._originTop).normalize();\r\n }\r\n this._tickCallback = this._tick.bind(this);\r\n this._prepareCylinder();\r\n }\r\n /**\r\n * Returns the data related to the updraft event (cylinder).\r\n * @returns A physics updraft event\r\n */\r\n PhysicsUpdraftEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n };\r\n /**\r\n * Enables the updraft.\r\n */\r\n PhysicsUpdraftEvent.prototype.enable = function () {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disables the updraft.\r\n */\r\n PhysicsUpdraftEvent.prototype.disable = function () {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disposes the cylinder.\r\n * @param force Specifies if the updraft should be disposed by force\r\n */\r\n PhysicsUpdraftEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n PhysicsUpdraftEvent.prototype.getImpostorHitData = function (impostor) {\r\n if (impostor.mass === 0) {\r\n return null;\r\n }\r\n if (!this._intersectsWithCylinder(impostor)) {\r\n return null;\r\n }\r\n var impostorObjectCenter = impostor.getObjectCenter();\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n var direction = this._originDirection;\r\n }\r\n else {\r\n var direction = impostorObjectCenter.subtract(this._originTop);\r\n }\r\n var distanceFromOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Distance(this._origin, impostorObjectCenter);\r\n var multiplier = this._options.strength * -1;\r\n var force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n return { force: force, contactPoint: impostorObjectCenter, distanceFromOrigin: distanceFromOrigin };\r\n };\r\n PhysicsUpdraftEvent.prototype._tick = function () {\r\n var _this = this;\r\n this._physicsEngine.getImpostors().forEach(function (impostor) {\r\n var impostorHitData = _this.getImpostorHitData(impostor);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyForce(impostorHitData.force, impostorHitData.contactPoint);\r\n });\r\n };\r\n /*** Helpers ***/\r\n PhysicsUpdraftEvent.prototype._prepareCylinder = function () {\r\n if (!this._cylinder) {\r\n this._cylinder = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"updraftEventCylinder\", {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n }, this._scene);\r\n this._cylinder.isVisible = false;\r\n }\r\n };\r\n PhysicsUpdraftEvent.prototype._intersectsWithCylinder = function (impostor) {\r\n var impostorObject = impostor.object;\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(impostorObject, true);\r\n };\r\n return PhysicsUpdraftEvent;\r\n}());\r\n/**\r\n * Represents a physics vortex event\r\n */\r\nvar PhysicsVortexEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the physics vortex event\r\n * @param _scene The BabylonJS scene\r\n * @param _origin The origin position of the vortex\r\n * @param _options The options for the vortex event\r\n */\r\n function PhysicsVortexEvent(_scene, _origin, _options) {\r\n this._scene = _scene;\r\n this._origin = _origin;\r\n this._options = _options;\r\n this._originTop = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // the most upper part of the cylinder\r\n this._cylinderPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n this._dataFetched = false; // check if the has been fetched the data. If not, do cleanup\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsVortexEventOptions()), this._options);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height, 0), this._originTop);\r\n this._tickCallback = this._tick.bind(this);\r\n this._prepareCylinder();\r\n }\r\n /**\r\n * Returns the data related to the vortex event (cylinder).\r\n * @returns The physics vortex event data\r\n */\r\n PhysicsVortexEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n };\r\n /**\r\n * Enables the vortex.\r\n */\r\n PhysicsVortexEvent.prototype.enable = function () {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disables the cortex.\r\n */\r\n PhysicsVortexEvent.prototype.disable = function () {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disposes the sphere.\r\n * @param force\r\n */\r\n PhysicsVortexEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (force) {\r\n this._cylinder.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n PhysicsVortexEvent.prototype.getImpostorHitData = function (impostor) {\r\n if (impostor.mass === 0) {\r\n return null;\r\n }\r\n if (!this._intersectsWithCylinder(impostor)) {\r\n return null;\r\n }\r\n if (impostor.object.getClassName() !== 'Mesh' && impostor.object.getClassName() !== 'InstancedMesh') {\r\n return null;\r\n }\r\n var impostorObjectCenter = impostor.getObjectCenter();\r\n var originOnPlane = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](this._origin.x, impostorObjectCenter.y, this._origin.z); // the distance to the origin as if both objects were on a plane (Y-axis)\r\n var originToImpostorDirection = impostorObjectCenter.subtract(originOnPlane);\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](originOnPlane, originToImpostorDirection, this._options.radius);\r\n var hit = ray.intersectsMesh(impostor.object);\r\n var contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return null;\r\n }\r\n var absoluteDistanceFromOrigin = hit.distance / this._options.radius;\r\n var directionToOrigin = contactPoint.normalize();\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin = directionToOrigin.negate();\r\n }\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n var forceX = directionToOrigin.x * this._options.centripetalForceMultiplier;\r\n var forceY = directionToOrigin.y * this._options.updraftForceMultiplier;\r\n var forceZ = directionToOrigin.z * this._options.centripetalForceMultiplier;\r\n }\r\n else {\r\n var perpendicularDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(originOnPlane, impostorObjectCenter).normalize();\r\n var forceX = (perpendicularDirection.x + directionToOrigin.x) * this._options.centrifugalForceMultiplier;\r\n var forceY = this._originTop.y * this._options.updraftForceMultiplier;\r\n var forceZ = (perpendicularDirection.z + directionToOrigin.z) * this._options.centrifugalForceMultiplier;\r\n }\r\n var force = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](forceX, forceY, forceZ);\r\n force = force.multiplyByFloats(this._options.strength, this._options.strength, this._options.strength);\r\n return { force: force, contactPoint: impostorObjectCenter, distanceFromOrigin: absoluteDistanceFromOrigin };\r\n };\r\n PhysicsVortexEvent.prototype._tick = function () {\r\n var _this = this;\r\n this._physicsEngine.getImpostors().forEach(function (impostor) {\r\n var impostorHitData = _this.getImpostorHitData(impostor);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyForce(impostorHitData.force, impostorHitData.contactPoint);\r\n });\r\n };\r\n /*** Helpers ***/\r\n PhysicsVortexEvent.prototype._prepareCylinder = function () {\r\n if (!this._cylinder) {\r\n this._cylinder = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"vortexEventCylinder\", {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n }, this._scene);\r\n this._cylinder.isVisible = false;\r\n }\r\n };\r\n PhysicsVortexEvent.prototype._intersectsWithCylinder = function (impostor) {\r\n var impostorObject = impostor.object;\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(impostorObject, true);\r\n };\r\n return PhysicsVortexEvent;\r\n}());\r\n/**\r\n * Options fot the radial explosion event\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsRadialExplosionEventOptions = /** @class */ (function () {\r\n function PhysicsRadialExplosionEventOptions() {\r\n /**\r\n * The radius of the sphere for the radial explosion.\r\n */\r\n this.radius = 5;\r\n /**\r\n * The strenth of the explosion.\r\n */\r\n this.strength = 10;\r\n /**\r\n * The strenght of the force in correspondence to the distance of the affected object\r\n */\r\n this.falloff = PhysicsRadialImpulseFalloff.Constant;\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n this.sphere = { segments: 32, diameter: 1 };\r\n }\r\n return PhysicsRadialExplosionEventOptions;\r\n}());\r\n\r\n/**\r\n * Options fot the updraft event\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsUpdraftEventOptions = /** @class */ (function () {\r\n function PhysicsUpdraftEventOptions() {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n this.radius = 5;\r\n /**\r\n * The strenth of the updraft.\r\n */\r\n this.strength = 10;\r\n /**\r\n * The height of the cylinder for the updraft.\r\n */\r\n this.height = 10;\r\n /**\r\n * The mode for the the updraft.\r\n */\r\n this.updraftMode = PhysicsUpdraftMode.Center;\r\n }\r\n return PhysicsUpdraftEventOptions;\r\n}());\r\n\r\n/**\r\n * Options fot the vortex event\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsVortexEventOptions = /** @class */ (function () {\r\n function PhysicsVortexEventOptions() {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n this.radius = 5;\r\n /**\r\n * The strenth of the vortex.\r\n */\r\n this.strength = 10;\r\n /**\r\n * The height of the cylinder for the vortex.\r\n */\r\n this.height = 10;\r\n /**\r\n * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1\r\n */\r\n this.centripetalForceThreshold = 0.7;\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the treshold.\r\n */\r\n this.centripetalForceMultiplier = 5;\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the treshold.\r\n */\r\n this.centrifugalForceMultiplier = 0.5;\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.\r\n */\r\n this.updraftForceMultiplier = 0.02;\r\n }\r\n return PhysicsVortexEventOptions;\r\n}());\r\n\r\n/**\r\n* The strenght of the force in correspondence to the distance of the affected object\r\n* @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n*/\r\nvar PhysicsRadialImpulseFalloff;\r\n(function (PhysicsRadialImpulseFalloff) {\r\n /** Defines that impulse is constant in strength across it's whole radius */\r\n PhysicsRadialImpulseFalloff[PhysicsRadialImpulseFalloff[\"Constant\"] = 0] = \"Constant\";\r\n /** Defines that impulse gets weaker if it's further from the origin */\r\n PhysicsRadialImpulseFalloff[PhysicsRadialImpulseFalloff[\"Linear\"] = 1] = \"Linear\";\r\n})(PhysicsRadialImpulseFalloff || (PhysicsRadialImpulseFalloff = {}));\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsUpdraftMode;\r\n(function (PhysicsUpdraftMode) {\r\n /** Defines that the upstream forces will pull towards the top center of the cylinder */\r\n PhysicsUpdraftMode[PhysicsUpdraftMode[\"Center\"] = 0] = \"Center\";\r\n /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */\r\n PhysicsUpdraftMode[PhysicsUpdraftMode[\"Perpendicular\"] = 1] = \"Perpendicular\";\r\n})(PhysicsUpdraftMode || (PhysicsUpdraftMode = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsImpostor.ts\":\n/*!************************************!*\\\n !*** ./Physics/physicsImpostor.ts ***!\n \\************************************/\n/*! exports provided: PhysicsImpostor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return PhysicsImpostor; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _physicsJoint__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"]._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {\r\n return new PhysicsImpostor(physicObject, jsonObject.physicsImpostor, {\r\n mass: jsonObject.physicsMass,\r\n friction: jsonObject.physicsFriction,\r\n restitution: jsonObject.physicsRestitution\r\n }, scene);\r\n};\r\n/**\r\n * Represents a physics imposter\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsImpostor = /** @class */ (function () {\r\n /**\r\n * Initializes the physics imposter\r\n * @param object The physics-enabled object used as the physics imposter\r\n * @param type The type of the physics imposter\r\n * @param _options The options for the physics imposter\r\n * @param _scene The Babylon scene\r\n */\r\n function PhysicsImpostor(\r\n /**\r\n * The physics-enabled object used as the physics imposter\r\n */\r\n object, \r\n /**\r\n * The type of the physics imposter\r\n */\r\n type, _options, _scene) {\r\n var _this = this;\r\n if (_options === void 0) { _options = { mass: 0 }; }\r\n this.object = object;\r\n this.type = type;\r\n this._options = _options;\r\n this._scene = _scene;\r\n /** @hidden */\r\n this._pluginData = {};\r\n this._bodyUpdateRequired = false;\r\n this._onBeforePhysicsStepCallbacks = new Array();\r\n this._onAfterPhysicsStepCallbacks = new Array();\r\n /** @hidden */\r\n this._onPhysicsCollideCallbacks = [];\r\n this._deltaPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._isDisposed = false;\r\n /**\r\n * @hidden\r\n */\r\n this.soft = false;\r\n /**\r\n * @hidden\r\n */\r\n this.segments = 0;\r\n //temp variables for parent rotation calculations\r\n //private _mats: Array = [new Matrix(), new Matrix()];\r\n this._tmpQuat = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n this._tmpQuat2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * this function is executed by the physics engine.\r\n */\r\n this.beforeStep = function () {\r\n if (!_this._physicsEngine) {\r\n return;\r\n }\r\n _this.object.translate(_this._deltaPosition, -1);\r\n _this._deltaRotationConjugated && _this.object.rotationQuaternion && _this.object.rotationQuaternion.multiplyToRef(_this._deltaRotationConjugated, _this.object.rotationQuaternion);\r\n _this.object.computeWorldMatrix(false);\r\n if (_this.object.parent && _this.object.rotationQuaternion) {\r\n _this.getParentsRotation();\r\n _this._tmpQuat.multiplyToRef(_this.object.rotationQuaternion, _this._tmpQuat);\r\n }\r\n else {\r\n _this._tmpQuat.copyFrom(_this.object.rotationQuaternion || new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]());\r\n }\r\n if (!_this._options.disableBidirectionalTransformation) {\r\n _this.object.rotationQuaternion && _this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(_this, /*bInfo.boundingBox.centerWorld*/ _this.object.getAbsolutePosition(), _this._tmpQuat);\r\n }\r\n _this._onBeforePhysicsStepCallbacks.forEach(function (func) {\r\n func(_this);\r\n });\r\n };\r\n /**\r\n * this function is executed by the physics engine\r\n */\r\n this.afterStep = function () {\r\n if (!_this._physicsEngine) {\r\n return;\r\n }\r\n _this._onAfterPhysicsStepCallbacks.forEach(function (func) {\r\n func(_this);\r\n });\r\n _this._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(_this);\r\n // object has now its world rotation. needs to be converted to local.\r\n if (_this.object.parent && _this.object.rotationQuaternion) {\r\n _this.getParentsRotation();\r\n _this._tmpQuat.conjugateInPlace();\r\n _this._tmpQuat.multiplyToRef(_this.object.rotationQuaternion, _this.object.rotationQuaternion);\r\n }\r\n // take the position set and make it the absolute position of this object.\r\n _this.object.setAbsolutePosition(_this.object.position);\r\n _this._deltaRotation && _this.object.rotationQuaternion && _this.object.rotationQuaternion.multiplyToRef(_this._deltaRotation, _this.object.rotationQuaternion);\r\n _this.object.translate(_this._deltaPosition, 1);\r\n };\r\n /**\r\n * Legacy collision detection event support\r\n */\r\n this.onCollideEvent = null;\r\n /**\r\n * event and body object due to cannon's event-based architecture.\r\n */\r\n this.onCollide = function (e) {\r\n if (!_this._onPhysicsCollideCallbacks.length && !_this.onCollideEvent) {\r\n return;\r\n }\r\n if (!_this._physicsEngine) {\r\n return;\r\n }\r\n var otherImpostor = _this._physicsEngine.getImpostorWithPhysicsBody(e.body);\r\n if (otherImpostor) {\r\n // Legacy collision detection event support\r\n if (_this.onCollideEvent) {\r\n _this.onCollideEvent(_this, otherImpostor);\r\n }\r\n _this._onPhysicsCollideCallbacks.filter(function (obj) {\r\n return obj.otherImpostors.indexOf(otherImpostor) !== -1;\r\n }).forEach(function (obj) {\r\n obj.callback(_this, otherImpostor);\r\n });\r\n }\r\n };\r\n //sanity check!\r\n if (!this.object) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n if (this.object.parent && _options.mass !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur.\");\r\n }\r\n // Legacy support for old syntax.\r\n if (!this._scene && object.getScene) {\r\n this._scene = object.getScene();\r\n }\r\n if (!this._scene) {\r\n return;\r\n }\r\n if (this.type > 100) {\r\n this.soft = true;\r\n }\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Physics not enabled. Please use scene.enablePhysics(...) before creating impostors.\");\r\n }\r\n else {\r\n //set the object's quaternion, if not set\r\n if (!this.object.rotationQuaternion) {\r\n if (this.object.rotation) {\r\n this.object.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRoll(this.object.rotation.y, this.object.rotation.x, this.object.rotation.z);\r\n }\r\n else {\r\n this.object.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n }\r\n //default options params\r\n this._options.mass = (_options.mass === void 0) ? 0 : _options.mass;\r\n this._options.friction = (_options.friction === void 0) ? 0.2 : _options.friction;\r\n this._options.restitution = (_options.restitution === void 0) ? 0.2 : _options.restitution;\r\n if (this.soft) {\r\n //softbody mass must be above 0;\r\n this._options.mass = this._options.mass > 0 ? this._options.mass : 1;\r\n this._options.pressure = (_options.pressure === void 0) ? 200 : _options.pressure;\r\n this._options.stiffness = (_options.stiffness === void 0) ? 1 : _options.stiffness;\r\n this._options.velocityIterations = (_options.velocityIterations === void 0) ? 20 : _options.velocityIterations;\r\n this._options.positionIterations = (_options.positionIterations === void 0) ? 20 : _options.positionIterations;\r\n this._options.fixedPoints = (_options.fixedPoints === void 0) ? 0 : _options.fixedPoints;\r\n this._options.margin = (_options.margin === void 0) ? 0 : _options.margin;\r\n this._options.damping = (_options.damping === void 0) ? 0 : _options.damping;\r\n this._options.path = (_options.path === void 0) ? null : _options.path;\r\n this._options.shape = (_options.shape === void 0) ? null : _options.shape;\r\n }\r\n this._joints = [];\r\n //If the mesh has a parent, don't initialize the physicsBody. Instead wait for the parent to do that.\r\n if (!this.object.parent || this._options.ignoreParent) {\r\n this._init();\r\n }\r\n else if (this.object.parent.physicsImpostor) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"You must affect impostors to children before affecting impostor to parent.\");\r\n }\r\n }\r\n }\r\n Object.defineProperty(PhysicsImpostor.prototype, \"isDisposed\", {\r\n /**\r\n * Specifies if the physics imposter is disposed\r\n */\r\n get: function () {\r\n return this._isDisposed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"mass\", {\r\n /**\r\n * Gets the mass of the physics imposter\r\n */\r\n get: function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;\r\n },\r\n set: function (value) {\r\n this.setMass(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"friction\", {\r\n /**\r\n * Gets the coefficient of friction\r\n */\r\n get: function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;\r\n },\r\n /**\r\n * Sets the coefficient of friction\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"restitution\", {\r\n /**\r\n * Gets the coefficient of restitution\r\n */\r\n get: function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;\r\n },\r\n /**\r\n * Sets the coefficient of restitution\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"pressure\", {\r\n /**\r\n * Gets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return 0;\r\n }\r\n return plugin.getBodyPressure(this);\r\n },\r\n /**\r\n * Sets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return;\r\n }\r\n plugin.setBodyPressure(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"stiffness\", {\r\n /**\r\n * Gets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyStiffness) {\r\n return 0;\r\n }\r\n return plugin.getBodyStiffness(this);\r\n },\r\n /**\r\n * Sets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyStiffness) {\r\n return;\r\n }\r\n plugin.setBodyStiffness(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"velocityIterations\", {\r\n /**\r\n * Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyVelocityIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyVelocityIterations(this);\r\n },\r\n /**\r\n * Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyVelocityIterations) {\r\n return;\r\n }\r\n plugin.setBodyVelocityIterations(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"positionIterations\", {\r\n /**\r\n * Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyPositionIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyPositionIterations(this);\r\n },\r\n /**\r\n * Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPositionIterations) {\r\n return;\r\n }\r\n plugin.setBodyPositionIterations(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This function will completly initialize this impostor.\r\n * It will create a new body - but only if this mesh has no parent.\r\n * If it has, this impostor will not be used other than to define the impostor\r\n * of the child mesh.\r\n * @hidden\r\n */\r\n PhysicsImpostor.prototype._init = function () {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.removeImpostor(this);\r\n this.physicsBody = null;\r\n this._parent = this._parent || this._getPhysicsParent();\r\n if (!this._isDisposed && (!this.parent || this._options.ignoreParent)) {\r\n this._physicsEngine.addImpostor(this);\r\n }\r\n };\r\n PhysicsImpostor.prototype._getPhysicsParent = function () {\r\n if (this.object.parent instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"]) {\r\n var parentMesh = this.object.parent;\r\n return parentMesh.physicsImpostor;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Should a new body be generated.\r\n * @returns boolean specifying if body initialization is required\r\n */\r\n PhysicsImpostor.prototype.isBodyInitRequired = function () {\r\n return this._bodyUpdateRequired || (!this._physicsBody && !this._parent);\r\n };\r\n /**\r\n * Sets the updated scaling\r\n * @param updated Specifies if the scaling is updated\r\n */\r\n PhysicsImpostor.prototype.setScalingUpdated = function () {\r\n this.forceUpdate();\r\n };\r\n /**\r\n * Force a regeneration of this or the parent's impostor's body.\r\n * Use under cautious - This will remove all joints already implemented.\r\n */\r\n PhysicsImpostor.prototype.forceUpdate = function () {\r\n this._init();\r\n if (this.parent && !this._options.ignoreParent) {\r\n this.parent.forceUpdate();\r\n }\r\n };\r\n Object.defineProperty(PhysicsImpostor.prototype, \"physicsBody\", {\r\n /*public get mesh(): AbstractMesh {\r\n return this._mesh;\r\n }*/\r\n /**\r\n * Gets the body that holds this impostor. Either its own, or its parent.\r\n */\r\n get: function () {\r\n return (this._parent && !this._options.ignoreParent) ? this._parent.physicsBody : this._physicsBody;\r\n },\r\n /**\r\n * Set the physics body. Used mainly by the physics engine/plugin\r\n */\r\n set: function (physicsBody) {\r\n if (this._physicsBody && this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this);\r\n }\r\n this._physicsBody = physicsBody;\r\n this.resetUpdateFlags();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"parent\", {\r\n /**\r\n * Get the parent of the physics imposter\r\n * @returns Physics imposter or null\r\n */\r\n get: function () {\r\n return !this._options.ignoreParent && this._parent ? this._parent : null;\r\n },\r\n /**\r\n * Sets the parent of the physics imposter\r\n */\r\n set: function (value) {\r\n this._parent = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the update flags\r\n */\r\n PhysicsImpostor.prototype.resetUpdateFlags = function () {\r\n this._bodyUpdateRequired = false;\r\n };\r\n /**\r\n * Gets the object extend size\r\n * @returns the object extend size\r\n */\r\n PhysicsImpostor.prototype.getObjectExtendSize = function () {\r\n if (this.object.getBoundingInfo) {\r\n var q = this.object.rotationQuaternion;\r\n //reset rotation\r\n this.object.rotationQuaternion = PhysicsImpostor.IDENTITY_QUATERNION;\r\n //calculate the world matrix with no rotation\r\n this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);\r\n var boundingInfo = this.object.getBoundingInfo();\r\n var size = boundingInfo.boundingBox.extendSizeWorld.scale(2);\r\n //bring back the rotation\r\n this.object.rotationQuaternion = q;\r\n //calculate the world matrix with the new rotation\r\n this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);\r\n return size;\r\n }\r\n else {\r\n return PhysicsImpostor.DEFAULT_OBJECT_SIZE;\r\n }\r\n };\r\n /**\r\n * Gets the object center\r\n * @returns The object center\r\n */\r\n PhysicsImpostor.prototype.getObjectCenter = function () {\r\n if (this.object.getBoundingInfo) {\r\n var boundingInfo = this.object.getBoundingInfo();\r\n return boundingInfo.boundingBox.centerWorld;\r\n }\r\n else {\r\n return this.object.position;\r\n }\r\n };\r\n /**\r\n * Get a specific parametes from the options parameter\r\n * @param paramName The object parameter name\r\n * @returns The object parameter\r\n */\r\n PhysicsImpostor.prototype.getParam = function (paramName) {\r\n return this._options[paramName];\r\n };\r\n /**\r\n * Sets a specific parameter in the options given to the physics plugin\r\n * @param paramName The parameter name\r\n * @param value The value of the parameter\r\n */\r\n PhysicsImpostor.prototype.setParam = function (paramName, value) {\r\n this._options[paramName] = value;\r\n this._bodyUpdateRequired = true;\r\n };\r\n /**\r\n * Specifically change the body's mass option. Won't recreate the physics body object\r\n * @param mass The mass of the physics imposter\r\n */\r\n PhysicsImpostor.prototype.setMass = function (mass) {\r\n if (this.getParam(\"mass\") !== mass) {\r\n this.setParam(\"mass\", mass);\r\n }\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setBodyMass(this, mass);\r\n }\r\n };\r\n /**\r\n * Gets the linear velocity\r\n * @returns linear velocity or null\r\n */\r\n PhysicsImpostor.prototype.getLinearVelocity = function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this) : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Sets the linear velocity\r\n * @param velocity linear velocity or null\r\n */\r\n PhysicsImpostor.prototype.setLinearVelocity = function (velocity) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this, velocity);\r\n }\r\n };\r\n /**\r\n * Gets the angular velocity\r\n * @returns angular velocity or null\r\n */\r\n PhysicsImpostor.prototype.getAngularVelocity = function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this) : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Sets the angular velocity\r\n * @param velocity The velocity or null\r\n */\r\n PhysicsImpostor.prototype.setAngularVelocity = function (velocity) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this, velocity);\r\n }\r\n };\r\n /**\r\n * Execute a function with the physics plugin native code\r\n * Provide a function the will have two variables - the world object and the physics body object\r\n * @param func The function to execute with the physics plugin native code\r\n */\r\n PhysicsImpostor.prototype.executeNativeFunction = function (func) {\r\n if (this._physicsEngine) {\r\n func(this._physicsEngine.getPhysicsPlugin().world, this.physicsBody);\r\n }\r\n };\r\n /**\r\n * Register a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n PhysicsImpostor.prototype.registerBeforePhysicsStep = function (func) {\r\n this._onBeforePhysicsStepCallbacks.push(func);\r\n };\r\n /**\r\n * Unregister a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n PhysicsImpostor.prototype.unregisterBeforePhysicsStep = function (func) {\r\n var index = this._onBeforePhysicsStepCallbacks.indexOf(func);\r\n if (index > -1) {\r\n this._onBeforePhysicsStepCallbacks.splice(index, 1);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Function to remove was not found\");\r\n }\r\n };\r\n /**\r\n * Register a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n PhysicsImpostor.prototype.registerAfterPhysicsStep = function (func) {\r\n this._onAfterPhysicsStepCallbacks.push(func);\r\n };\r\n /**\r\n * Unregisters a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n PhysicsImpostor.prototype.unregisterAfterPhysicsStep = function (func) {\r\n var index = this._onAfterPhysicsStepCallbacks.indexOf(func);\r\n if (index > -1) {\r\n this._onAfterPhysicsStepCallbacks.splice(index, 1);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Function to remove was not found\");\r\n }\r\n };\r\n /**\r\n * register a function that will be executed when this impostor collides against a different body\r\n * @param collideAgainst Physics imposter, or array of physics imposters to collide against\r\n * @param func Callback that is executed on collision\r\n */\r\n PhysicsImpostor.prototype.registerOnPhysicsCollide = function (collideAgainst, func) {\r\n var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n this._onPhysicsCollideCallbacks.push({ callback: func, otherImpostors: collidedAgainstList });\r\n };\r\n /**\r\n * Unregisters the physics imposter on contact\r\n * @param collideAgainst The physics object to collide against\r\n * @param func Callback to execute on collision\r\n */\r\n PhysicsImpostor.prototype.unregisterOnPhysicsCollide = function (collideAgainst, func) {\r\n var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n var index = -1;\r\n var found = this._onPhysicsCollideCallbacks.some(function (cbDef, idx) {\r\n if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) {\r\n // chcek the arrays match\r\n var sameList = cbDef.otherImpostors.every(function (impostor) {\r\n return collidedAgainstList.indexOf(impostor) > -1;\r\n });\r\n if (sameList) {\r\n index = idx;\r\n }\r\n return sameList;\r\n }\r\n return false;\r\n });\r\n if (found) {\r\n this._onPhysicsCollideCallbacks.splice(index, 1);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Function to remove was not found\");\r\n }\r\n };\r\n /**\r\n * Get the parent rotation\r\n * @returns The parent rotation\r\n */\r\n PhysicsImpostor.prototype.getParentsRotation = function () {\r\n var parent = this.object.parent;\r\n this._tmpQuat.copyFromFloats(0, 0, 0, 1);\r\n while (parent) {\r\n if (parent.rotationQuaternion) {\r\n this._tmpQuat2.copyFrom(parent.rotationQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRollToRef(parent.rotation.y, parent.rotation.x, parent.rotation.z, this._tmpQuat2);\r\n }\r\n this._tmpQuat.multiplyToRef(this._tmpQuat2, this._tmpQuat);\r\n parent = parent.parent;\r\n }\r\n return this._tmpQuat;\r\n };\r\n /**\r\n * Apply a force\r\n * @param force The force to apply\r\n * @param contactPoint The contact point for the force\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.applyForce = function (force, contactPoint) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyForce(this, force, contactPoint);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Apply an impulse\r\n * @param force The impulse force\r\n * @param contactPoint The contact point for the impulse force\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.applyImpulse = function (force, contactPoint) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyImpulse(this, force, contactPoint);\r\n }\r\n return this;\r\n };\r\n /**\r\n * A help function to create a joint\r\n * @param otherImpostor A physics imposter used to create a joint\r\n * @param jointType The type of joint\r\n * @param jointData The data for the joint\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.createJoint = function (otherImpostor, jointType, jointData) {\r\n var joint = new _physicsJoint__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsJoint\"](jointType, jointData);\r\n this.addJoint(otherImpostor, joint);\r\n return this;\r\n };\r\n /**\r\n * Add a joint to this impostor with a different impostor\r\n * @param otherImpostor A physics imposter used to add a joint\r\n * @param joint The joint to add\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.addJoint = function (otherImpostor, joint) {\r\n this._joints.push({\r\n otherImpostor: otherImpostor,\r\n joint: joint\r\n });\r\n if (this._physicsEngine) {\r\n this._physicsEngine.addJoint(this, otherImpostor, joint);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add an anchor to a cloth impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param width ratio across width from 0 to 1\r\n * @param height ratio up height from 0 to 1\r\n * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between cloth impostor and anchor are ignored; default false\r\n * @returns impostor the soft imposter\r\n */\r\n PhysicsImpostor.prototype.addAnchor = function (otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies) {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendAnchor(this, otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add a hook to a rope impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param length ratio across rope from 0 to 1\r\n * @param influence the elasticity between rope impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n * @returns impostor the rope imposter\r\n */\r\n PhysicsImpostor.prototype.addHook = function (otherImpostor, length, influence, noCollisionBetweenLinkedBodies) {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendHook(this, otherImpostor, length, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Will keep this body still, in a sleep mode.\r\n * @returns the physics imposter\r\n */\r\n PhysicsImpostor.prototype.sleep = function () {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().sleepBody(this);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Wake the body up.\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.wakeUp = function () {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().wakeUpBody(this);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Clones the physics imposter\r\n * @param newObject The physics imposter clones to this physics-enabled object\r\n * @returns A nullable physics imposter\r\n */\r\n PhysicsImpostor.prototype.clone = function (newObject) {\r\n if (!newObject) {\r\n return null;\r\n }\r\n return new PhysicsImpostor(newObject, this.type, this._options, this._scene);\r\n };\r\n /**\r\n * Disposes the physics imposter\r\n */\r\n PhysicsImpostor.prototype.dispose = function ( /*disposeChildren: boolean = true*/) {\r\n var _this = this;\r\n //no dispose if no physics engine is available.\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._joints.forEach(function (j) {\r\n if (_this._physicsEngine) {\r\n _this._physicsEngine.removeJoint(_this, j.otherImpostor, j.joint);\r\n }\r\n });\r\n //dispose the physics body\r\n this._physicsEngine.removeImpostor(this);\r\n if (this.parent) {\r\n this.parent.forceUpdate();\r\n }\r\n else {\r\n /*this._object.getChildMeshes().forEach(function(mesh) {\r\n if (mesh.physicsImpostor) {\r\n if (disposeChildren) {\r\n mesh.physicsImpostor.dispose();\r\n mesh.physicsImpostor = null;\r\n }\r\n }\r\n })*/\r\n }\r\n this._isDisposed = true;\r\n };\r\n /**\r\n * Sets the delta position\r\n * @param position The delta position amount\r\n */\r\n PhysicsImpostor.prototype.setDeltaPosition = function (position) {\r\n this._deltaPosition.copyFrom(position);\r\n };\r\n /**\r\n * Sets the delta rotation\r\n * @param rotation The delta rotation amount\r\n */\r\n PhysicsImpostor.prototype.setDeltaRotation = function (rotation) {\r\n if (!this._deltaRotation) {\r\n this._deltaRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._deltaRotation.copyFrom(rotation);\r\n this._deltaRotationConjugated = this._deltaRotation.conjugate();\r\n };\r\n /**\r\n * Gets the box size of the physics imposter and stores the result in the input parameter\r\n * @param result Stores the box size\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.getBoxSizeToRef = function (result) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this, result);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the radius of the physics imposter\r\n * @returns Radius of the physics imposter\r\n */\r\n PhysicsImpostor.prototype.getRadius = function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getRadius(this) : 0;\r\n };\r\n /**\r\n * Sync a bone with this impostor\r\n * @param bone The bone to sync to the impostor.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n */\r\n PhysicsImpostor.prototype.syncBoneWithImpostor = function (bone, boneMesh, jointPivot, distToJoint, adjustRotation) {\r\n var tempVec = PhysicsImpostor._tmpVecs[0];\r\n var mesh = this.object;\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n var tempQuat = PhysicsImpostor._tmpQuat;\r\n mesh.rotationQuaternion.multiplyToRef(adjustRotation, tempQuat);\r\n bone.setRotationQuaternion(tempQuat, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh);\r\n }\r\n else {\r\n bone.setRotationQuaternion(mesh.rotationQuaternion, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh);\r\n }\r\n }\r\n tempVec.x = 0;\r\n tempVec.y = 0;\r\n tempVec.z = 0;\r\n if (jointPivot) {\r\n tempVec.x = jointPivot.x;\r\n tempVec.y = jointPivot.y;\r\n tempVec.z = jointPivot.z;\r\n bone.getDirectionToRef(tempVec, boneMesh, tempVec);\r\n if (distToJoint === undefined || distToJoint === null) {\r\n distToJoint = jointPivot.length();\r\n }\r\n tempVec.x *= distToJoint;\r\n tempVec.y *= distToJoint;\r\n tempVec.z *= distToJoint;\r\n }\r\n if (bone.getParent()) {\r\n tempVec.addInPlace(mesh.getAbsolutePosition());\r\n bone.setAbsolutePosition(tempVec, boneMesh);\r\n }\r\n else {\r\n boneMesh.setAbsolutePosition(mesh.getAbsolutePosition());\r\n boneMesh.position.x -= tempVec.x;\r\n boneMesh.position.y -= tempVec.y;\r\n boneMesh.position.z -= tempVec.z;\r\n }\r\n };\r\n /**\r\n * Sync impostor to a bone\r\n * @param bone The bone that the impostor will be synced to.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n * @param boneAxis Optional vector3 axis the bone is aligned with\r\n */\r\n PhysicsImpostor.prototype.syncImpostorWithBone = function (bone, boneMesh, jointPivot, distToJoint, adjustRotation, boneAxis) {\r\n var mesh = this.object;\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n var tempQuat = PhysicsImpostor._tmpQuat;\r\n bone.getRotationQuaternionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh, tempQuat);\r\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\r\n }\r\n else {\r\n bone.getRotationQuaternionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh, mesh.rotationQuaternion);\r\n }\r\n }\r\n var pos = PhysicsImpostor._tmpVecs[0];\r\n var boneDir = PhysicsImpostor._tmpVecs[1];\r\n if (!boneAxis) {\r\n boneAxis = PhysicsImpostor._tmpVecs[2];\r\n boneAxis.x = 0;\r\n boneAxis.y = 1;\r\n boneAxis.z = 0;\r\n }\r\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\r\n bone.getAbsolutePositionToRef(boneMesh, pos);\r\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\r\n distToJoint = jointPivot.length();\r\n }\r\n if (distToJoint !== undefined && distToJoint !== null) {\r\n pos.x += boneDir.x * distToJoint;\r\n pos.y += boneDir.y * distToJoint;\r\n pos.z += boneDir.z * distToJoint;\r\n }\r\n mesh.setAbsolutePosition(pos);\r\n };\r\n /**\r\n * The default object size of the imposter\r\n */\r\n PhysicsImpostor.DEFAULT_OBJECT_SIZE = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1, 1, 1);\r\n /**\r\n * The identity quaternion of the imposter\r\n */\r\n PhysicsImpostor.IDENTITY_QUATERNION = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].Identity();\r\n PhysicsImpostor._tmpVecs = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_1__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero);\r\n PhysicsImpostor._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].Identity();\r\n //Impostor types\r\n /**\r\n * No-Imposter type\r\n */\r\n PhysicsImpostor.NoImpostor = 0;\r\n /**\r\n * Sphere-Imposter type\r\n */\r\n PhysicsImpostor.SphereImpostor = 1;\r\n /**\r\n * Box-Imposter type\r\n */\r\n PhysicsImpostor.BoxImpostor = 2;\r\n /**\r\n * Plane-Imposter type\r\n */\r\n PhysicsImpostor.PlaneImpostor = 3;\r\n /**\r\n * Mesh-imposter type\r\n */\r\n PhysicsImpostor.MeshImpostor = 4;\r\n /**\r\n * Capsule-Impostor type (Ammo.js plugin only)\r\n */\r\n PhysicsImpostor.CapsuleImpostor = 6;\r\n /**\r\n * Cylinder-Imposter type\r\n */\r\n PhysicsImpostor.CylinderImpostor = 7;\r\n /**\r\n * Particle-Imposter type\r\n */\r\n PhysicsImpostor.ParticleImpostor = 8;\r\n /**\r\n * Heightmap-Imposter type\r\n */\r\n PhysicsImpostor.HeightmapImpostor = 9;\r\n /**\r\n * ConvexHull-Impostor type (Ammo.js plugin only)\r\n */\r\n PhysicsImpostor.ConvexHullImpostor = 10;\r\n /**\r\n * Rope-Imposter type\r\n */\r\n PhysicsImpostor.RopeImpostor = 101;\r\n /**\r\n * Cloth-Imposter type\r\n */\r\n PhysicsImpostor.ClothImpostor = 102;\r\n /**\r\n * Softbody-Imposter type\r\n */\r\n PhysicsImpostor.SoftbodyImpostor = 103;\r\n return PhysicsImpostor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsJoint.ts\":\n/*!*********************************!*\\\n !*** ./Physics/physicsJoint.ts ***!\n \\*********************************/\n/*! exports provided: PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return PhysicsJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return DistanceJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return MotorEnabledJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return HingeJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return Hinge2Joint; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * This is a holder class for the physics joint created by the physics plugin\r\n * It holds a set of functions to control the underlying joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsJoint = /** @class */ (function () {\r\n /**\r\n * Initializes the physics joint\r\n * @param type The type of the physics joint\r\n * @param jointData The data for the physics joint\r\n */\r\n function PhysicsJoint(\r\n /**\r\n * The type of the physics joint\r\n */\r\n type, \r\n /**\r\n * The data for the physics joint\r\n */\r\n jointData) {\r\n this.type = type;\r\n this.jointData = jointData;\r\n jointData.nativeParams = jointData.nativeParams || {};\r\n }\r\n Object.defineProperty(PhysicsJoint.prototype, \"physicsJoint\", {\r\n /**\r\n * Gets the physics joint\r\n */\r\n get: function () {\r\n return this._physicsJoint;\r\n },\r\n /**\r\n * Sets the physics joint\r\n */\r\n set: function (newJoint) {\r\n if (this._physicsJoint) {\r\n //remove from the wolrd\r\n }\r\n this._physicsJoint = newJoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsJoint.prototype, \"physicsPlugin\", {\r\n /**\r\n * Sets the physics plugin\r\n */\r\n set: function (physicsPlugin) {\r\n this._physicsPlugin = physicsPlugin;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Execute a function that is physics-plugin specific.\r\n * @param {Function} func the function that will be executed.\r\n * It accepts two parameters: the physics world and the physics joint\r\n */\r\n PhysicsJoint.prototype.executeNativeFunction = function (func) {\r\n func(this._physicsPlugin.world, this._physicsJoint);\r\n };\r\n //TODO check if the native joints are the same\r\n //Joint Types\r\n /**\r\n * Distance-Joint type\r\n */\r\n PhysicsJoint.DistanceJoint = 0;\r\n /**\r\n * Hinge-Joint type\r\n */\r\n PhysicsJoint.HingeJoint = 1;\r\n /**\r\n * Ball-and-Socket joint type\r\n */\r\n PhysicsJoint.BallAndSocketJoint = 2;\r\n /**\r\n * Wheel-Joint type\r\n */\r\n PhysicsJoint.WheelJoint = 3;\r\n /**\r\n * Slider-Joint type\r\n */\r\n PhysicsJoint.SliderJoint = 4;\r\n //OIMO\r\n /**\r\n * Prismatic-Joint type\r\n */\r\n PhysicsJoint.PrismaticJoint = 5;\r\n //\r\n /**\r\n * Universal-Joint type\r\n * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)\r\n */\r\n PhysicsJoint.UniversalJoint = 6;\r\n /**\r\n * Hinge-Joint 2 type\r\n */\r\n PhysicsJoint.Hinge2Joint = PhysicsJoint.WheelJoint;\r\n //Cannon\r\n /**\r\n * Point to Point Joint type. Similar to a Ball-Joint. Different in parameters\r\n */\r\n PhysicsJoint.PointToPointJoint = 8;\r\n //Cannon only at the moment\r\n /**\r\n * Spring-Joint type\r\n */\r\n PhysicsJoint.SpringJoint = 9;\r\n /**\r\n * Lock-Joint type\r\n */\r\n PhysicsJoint.LockJoint = 10;\r\n return PhysicsJoint;\r\n}());\r\n\r\n/**\r\n * A class representing a physics distance joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar DistanceJoint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DistanceJoint, _super);\r\n /**\r\n *\r\n * @param jointData The data for the Distance-Joint\r\n */\r\n function DistanceJoint(jointData) {\r\n return _super.call(this, PhysicsJoint.DistanceJoint, jointData) || this;\r\n }\r\n /**\r\n * Update the predefined distance.\r\n * @param maxDistance The maximum preferred distance\r\n * @param minDistance The minimum preferred distance\r\n */\r\n DistanceJoint.prototype.updateDistance = function (maxDistance, minDistance) {\r\n this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);\r\n };\r\n return DistanceJoint;\r\n}(PhysicsJoint));\r\n\r\n/**\r\n * Represents a Motor-Enabled Joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar MotorEnabledJoint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MotorEnabledJoint, _super);\r\n /**\r\n * Initializes the Motor-Enabled Joint\r\n * @param type The type of the joint\r\n * @param jointData The physica joint data for the joint\r\n */\r\n function MotorEnabledJoint(type, jointData) {\r\n return _super.call(this, type, jointData) || this;\r\n }\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param force the force to apply\r\n * @param maxForce max force for this motor.\r\n */\r\n MotorEnabledJoint.prototype.setMotor = function (force, maxForce) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n };\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n MotorEnabledJoint.prototype.setLimit = function (upperLimit, lowerLimit) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n };\r\n return MotorEnabledJoint;\r\n}(PhysicsJoint));\r\n\r\n/**\r\n * This class represents a single physics Hinge-Joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar HingeJoint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HingeJoint, _super);\r\n /**\r\n * Initializes the Hinge-Joint\r\n * @param jointData The joint data for the Hinge-Joint\r\n */\r\n function HingeJoint(jointData) {\r\n return _super.call(this, PhysicsJoint.HingeJoint, jointData) || this;\r\n }\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} force the force to apply\r\n * @param {number} maxForce max force for this motor.\r\n */\r\n HingeJoint.prototype.setMotor = function (force, maxForce) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n };\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n HingeJoint.prototype.setLimit = function (upperLimit, lowerLimit) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n };\r\n return HingeJoint;\r\n}(MotorEnabledJoint));\r\n\r\n/**\r\n * This class represents a dual hinge physics joint (same as wheel joint)\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar Hinge2Joint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Hinge2Joint, _super);\r\n /**\r\n * Initializes the Hinge2-Joint\r\n * @param jointData The joint data for the Hinge2-Joint\r\n */\r\n function Hinge2Joint(jointData) {\r\n return _super.call(this, PhysicsJoint.Hinge2Joint, jointData) || this;\r\n }\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} targetSpeed the speed the motor is to reach\r\n * @param {number} maxForce max force for this motor.\r\n * @param {motorIndex} the motor's index, 0 or 1.\r\n */\r\n Hinge2Joint.prototype.setMotor = function (targetSpeed, maxForce, motorIndex) {\r\n if (motorIndex === void 0) { motorIndex = 0; }\r\n this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);\r\n };\r\n /**\r\n * Set the motor limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} upperLimit the upper limit\r\n * @param {number} lowerLimit lower limit\r\n * @param {motorIndex} the motor's index, 0 or 1.\r\n */\r\n Hinge2Joint.prototype.setLimit = function (upperLimit, lowerLimit, motorIndex) {\r\n if (motorIndex === void 0) { motorIndex = 0; }\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);\r\n };\r\n return Hinge2Joint;\r\n}(MotorEnabledJoint));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsRaycastResult.ts\":\n/*!*****************************************!*\\\n !*** ./Physics/physicsRaycastResult.ts ***!\n \\*****************************************/\n/*! exports provided: PhysicsRaycastResult */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRaycastResult\", function() { return PhysicsRaycastResult; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Holds the data for the raycast result\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsRaycastResult = /** @class */ (function () {\r\n function PhysicsRaycastResult() {\r\n this._hasHit = false;\r\n this._hitDistance = 0;\r\n this._hitNormalWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._hitPointWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._rayFromWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._rayToWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hasHit\", {\r\n /**\r\n * Gets if there was a hit\r\n */\r\n get: function () {\r\n return this._hasHit;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hitDistance\", {\r\n /**\r\n * Gets the distance from the hit\r\n */\r\n get: function () {\r\n return this._hitDistance;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hitNormalWorld\", {\r\n /**\r\n * Gets the hit normal/direction in the world\r\n */\r\n get: function () {\r\n return this._hitNormalWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hitPointWorld\", {\r\n /**\r\n * Gets the hit point in the world\r\n */\r\n get: function () {\r\n return this._hitPointWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"rayFromWorld\", {\r\n /**\r\n * Gets the ray \"start point\" of the ray in the world\r\n */\r\n get: function () {\r\n return this._rayFromWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"rayToWorld\", {\r\n /**\r\n * Gets the ray \"end point\" of the ray in the world\r\n */\r\n get: function () {\r\n return this._rayToWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the hit data (normal & point in world space)\r\n * @param hitNormalWorld defines the normal in world space\r\n * @param hitPointWorld defines the point in world space\r\n */\r\n PhysicsRaycastResult.prototype.setHitData = function (hitNormalWorld, hitPointWorld) {\r\n this._hasHit = true;\r\n this._hitNormalWorld = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](hitNormalWorld.x, hitNormalWorld.y, hitNormalWorld.z);\r\n this._hitPointWorld = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](hitPointWorld.x, hitPointWorld.y, hitPointWorld.z);\r\n };\r\n /**\r\n * Sets the distance from the start point to the hit point\r\n * @param distance\r\n */\r\n PhysicsRaycastResult.prototype.setHitDistance = function (distance) {\r\n this._hitDistance = distance;\r\n };\r\n /**\r\n * Calculates the distance manually\r\n */\r\n PhysicsRaycastResult.prototype.calculateHitDistance = function () {\r\n this._hitDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(this._rayFromWorld, this._hitPointWorld);\r\n };\r\n /**\r\n * Resets all the values to default\r\n * @param from The from point on world space\r\n * @param to The to point on world space\r\n */\r\n PhysicsRaycastResult.prototype.reset = function (from, to) {\r\n if (from === void 0) { from = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n if (to === void 0) { to = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n this._rayFromWorld = from;\r\n this._rayToWorld = to;\r\n this._hasHit = false;\r\n this._hitDistance = 0;\r\n this._hitNormalWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._hitPointWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n };\r\n return PhysicsRaycastResult;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.ts\":\n/*!****************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.ts ***!\n \\****************************************************************************/\n/*! exports provided: DefaultRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return DefaultRenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Layers_glowLayer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Layers/glowLayer */ \"./Layers/glowLayer.ts\");\n/* harmony import */ var _PostProcesses_sharpenPostProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/sharpenPostProcess */ \"./PostProcesses/sharpenPostProcess.ts\");\n/* harmony import */ var _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/imageProcessingPostProcess */ \"./PostProcesses/imageProcessingPostProcess.ts\");\n/* harmony import */ var _PostProcesses_chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/chromaticAberrationPostProcess */ \"./PostProcesses/chromaticAberrationPostProcess.ts\");\n/* harmony import */ var _PostProcesses_grainPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../PostProcesses/grainPostProcess */ \"./PostProcesses/grainPostProcess.ts\");\n/* harmony import */ var _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../PostProcesses/fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../PostProcesses/depthOfFieldEffect */ \"./PostProcesses/depthOfFieldEffect.ts\");\n/* harmony import */ var _PostProcesses_bloomEffect__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../PostProcesses/bloomEffect */ \"./PostProcesses/bloomEffect.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The default rendering pipeline can be added to a scene to apply common post processing effects such as anti-aliasing or depth of field.\r\n * See https://doc.babylonjs.com/how_to/using_default_rendering_pipeline\r\n */\r\nvar DefaultRenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DefaultRenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n * @param name - The rendering pipeline name (default: \"\")\r\n * @param hdr - If high dynamic range textures should be used (default: true)\r\n * @param scene - The scene linked to this pipeline (default: the last created scene)\r\n * @param cameras - The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)\r\n * @param automaticBuild - if false, you will have to manually call prepare() to update the pipeline (default: true)\r\n */\r\n function DefaultRenderingPipeline(name, hdr, scene, cameras, automaticBuild) {\r\n if (name === void 0) { name = \"\"; }\r\n if (hdr === void 0) { hdr = true; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_16__[\"EngineStore\"].LastCreatedScene; }\r\n if (automaticBuild === void 0) { automaticBuild = true; }\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n _this._camerasToBeAttached = [];\r\n /**\r\n * ID of the sharpen post process,\r\n */\r\n _this.SharpenPostProcessId = \"SharpenPostProcessEffect\";\r\n /**\r\n * @ignore\r\n * ID of the image processing post process;\r\n */\r\n _this.ImageProcessingPostProcessId = \"ImageProcessingPostProcessEffect\";\r\n /**\r\n * @ignore\r\n * ID of the Fast Approximate Anti-Aliasing post process;\r\n */\r\n _this.FxaaPostProcessId = \"FxaaPostProcessEffect\";\r\n /**\r\n * ID of the chromatic aberration post process,\r\n */\r\n _this.ChromaticAberrationPostProcessId = \"ChromaticAberrationPostProcessEffect\";\r\n /**\r\n * ID of the grain post process\r\n */\r\n _this.GrainPostProcessId = \"GrainPostProcessEffect\";\r\n /**\r\n * Glow post process which adds a glow to emissive areas of the image\r\n */\r\n _this._glowLayer = null;\r\n /**\r\n * Animations which can be used to tweak settings over a period of time\r\n */\r\n _this.animations = [];\r\n _this._imageProcessingConfigurationObserver = null;\r\n // Values\r\n _this._sharpenEnabled = false;\r\n _this._bloomEnabled = false;\r\n _this._depthOfFieldEnabled = false;\r\n _this._depthOfFieldBlurLevel = _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__[\"DepthOfFieldEffectBlurLevel\"].Low;\r\n _this._fxaaEnabled = false;\r\n _this._imageProcessingEnabled = true;\r\n _this._bloomScale = 0.5;\r\n _this._chromaticAberrationEnabled = false;\r\n _this._grainEnabled = false;\r\n _this._buildAllowed = true;\r\n _this._resizeObserver = null;\r\n _this._hardwareScaleLevel = 1.0;\r\n _this._bloomKernel = 64;\r\n /**\r\n * Specifies the weight of the bloom in the final rendering\r\n */\r\n _this._bloomWeight = 0.15;\r\n /**\r\n * Specifies the luma threshold for the area that will be blurred by the bloom\r\n */\r\n _this._bloomThreshold = 0.9;\r\n _this._samples = 1;\r\n _this._hasCleared = false;\r\n _this._prevPostProcess = null;\r\n _this._prevPrevPostProcess = null;\r\n _this._depthOfFieldSceneObserver = null;\r\n _this._cameras = cameras || scene.cameras;\r\n _this._cameras = _this._cameras.slice();\r\n _this._camerasToBeAttached = _this._cameras.slice();\r\n _this._buildAllowed = automaticBuild;\r\n // Initialize\r\n _this._scene = scene;\r\n var caps = _this._scene.getEngine().getCaps();\r\n _this._hdr = hdr && (caps.textureHalfFloatRender || caps.textureFloatRender);\r\n // Misc\r\n if (_this._hdr) {\r\n if (caps.textureHalfFloatRender) {\r\n _this._defaultPipelineTextureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else if (caps.textureFloatRender) {\r\n _this._defaultPipelineTextureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n }\r\n else {\r\n _this._defaultPipelineTextureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n // Attach\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n var engine = _this._scene.getEngine();\r\n // Create post processes before hand so they can be modified before enabled.\r\n // Block compilation flag is set to true to avoid compilation prior to use, these will be updated on first use in build pipeline.\r\n _this.sharpen = new _PostProcesses_sharpenPostProcess__WEBPACK_IMPORTED_MODULE_6__[\"SharpenPostProcess\"](\"sharpen\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, _this._defaultPipelineTextureType, true);\r\n _this._sharpenEffect = new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, _this.SharpenPostProcessId, function () { return _this.sharpen; }, true);\r\n _this.depthOfField = new _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__[\"DepthOfFieldEffect\"](_this._scene, null, _this._depthOfFieldBlurLevel, _this._defaultPipelineTextureType, true);\r\n _this.bloom = new _PostProcesses_bloomEffect__WEBPACK_IMPORTED_MODULE_14__[\"BloomEffect\"](_this._scene, _this._bloomScale, _this._bloomWeight, _this.bloomKernel, _this._defaultPipelineTextureType, true);\r\n _this.chromaticAberration = new _PostProcesses_chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"ChromaticAberrationPostProcess\"](\"ChromaticAberration\", engine.getRenderWidth(), engine.getRenderHeight(), 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, _this._defaultPipelineTextureType, true);\r\n _this._chromaticAberrationEffect = new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, _this.ChromaticAberrationPostProcessId, function () { return _this.chromaticAberration; }, true);\r\n _this.grain = new _PostProcesses_grainPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"GrainPostProcess\"](\"Grain\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, _this._defaultPipelineTextureType, true);\r\n _this._grainEffect = new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, _this.GrainPostProcessId, function () { return _this.grain; }, true);\r\n _this._resizeObserver = engine.onResizeObservable.add(function () {\r\n _this._hardwareScaleLevel = engine.getHardwareScalingLevel();\r\n _this.bloomKernel = _this.bloomKernel;\r\n });\r\n _this._imageProcessingConfigurationObserver = _this._scene.imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this.bloom._downscale._exposure = _this._scene.imageProcessingConfiguration.exposure;\r\n });\r\n _this._buildPipeline();\r\n return _this;\r\n }\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"scene\", {\r\n /**\r\n * Gets active scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"sharpenEnabled\", {\r\n get: function () {\r\n return this._sharpenEnabled;\r\n },\r\n /**\r\n * Enable or disable the sharpen process from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._sharpenEnabled === enabled) {\r\n return;\r\n }\r\n this._sharpenEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomKernel\", {\r\n /**\r\n * Specifies the size of the bloom blur kernel, relative to the final output size\r\n */\r\n get: function () {\r\n return this._bloomKernel;\r\n },\r\n set: function (value) {\r\n this._bloomKernel = value;\r\n this.bloom.kernel = value / this._hardwareScaleLevel;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomWeight\", {\r\n get: function () {\r\n return this._bloomWeight;\r\n },\r\n /**\r\n * The strength of the bloom.\r\n */\r\n set: function (value) {\r\n if (this._bloomWeight === value) {\r\n return;\r\n }\r\n this.bloom.weight = value;\r\n this._bloomWeight = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomThreshold\", {\r\n get: function () {\r\n return this._bloomThreshold;\r\n },\r\n /**\r\n * The strength of the bloom.\r\n */\r\n set: function (value) {\r\n if (this._bloomThreshold === value) {\r\n return;\r\n }\r\n this.bloom.threshold = value;\r\n this._bloomThreshold = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomScale\", {\r\n get: function () {\r\n return this._bloomScale;\r\n },\r\n /**\r\n * The scale of the bloom, lower value will provide better performance.\r\n */\r\n set: function (value) {\r\n if (this._bloomScale === value) {\r\n return;\r\n }\r\n this._bloomScale = value;\r\n // recreate bloom and dispose old as this setting is not dynamic\r\n this._rebuildBloom();\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomEnabled\", {\r\n get: function () {\r\n return this._bloomEnabled;\r\n },\r\n /**\r\n * Enable or disable the bloom from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._bloomEnabled === enabled) {\r\n return;\r\n }\r\n this._bloomEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DefaultRenderingPipeline.prototype._rebuildBloom = function () {\r\n // recreate bloom and dispose old as this setting is not dynamic\r\n var oldBloom = this.bloom;\r\n this.bloom = new _PostProcesses_bloomEffect__WEBPACK_IMPORTED_MODULE_14__[\"BloomEffect\"](this._scene, this.bloomScale, this._bloomWeight, this.bloomKernel, this._defaultPipelineTextureType, false);\r\n this.bloom.threshold = oldBloom.threshold;\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n oldBloom.disposeEffects(this._cameras[i]);\r\n }\r\n };\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"depthOfFieldEnabled\", {\r\n /**\r\n * If the depth of field is enabled.\r\n */\r\n get: function () {\r\n return this._depthOfFieldEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._depthOfFieldEnabled === enabled) {\r\n return;\r\n }\r\n this._depthOfFieldEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"depthOfFieldBlurLevel\", {\r\n /**\r\n * Blur level of the depth of field effect. (Higher blur will effect performance)\r\n */\r\n get: function () {\r\n return this._depthOfFieldBlurLevel;\r\n },\r\n set: function (value) {\r\n if (this._depthOfFieldBlurLevel === value) {\r\n return;\r\n }\r\n this._depthOfFieldBlurLevel = value;\r\n // recreate dof and dispose old as this setting is not dynamic\r\n var oldDof = this.depthOfField;\r\n this.depthOfField = new _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__[\"DepthOfFieldEffect\"](this._scene, null, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType, false);\r\n this.depthOfField.focalLength = oldDof.focalLength;\r\n this.depthOfField.focusDistance = oldDof.focusDistance;\r\n this.depthOfField.fStop = oldDof.fStop;\r\n this.depthOfField.lensSize = oldDof.lensSize;\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n oldDof.disposeEffects(this._cameras[i]);\r\n }\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"fxaaEnabled\", {\r\n get: function () {\r\n return this._fxaaEnabled;\r\n },\r\n /**\r\n * If the anti aliasing is enabled.\r\n */\r\n set: function (enabled) {\r\n if (this._fxaaEnabled === enabled) {\r\n return;\r\n }\r\n this._fxaaEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"samples\", {\r\n get: function () {\r\n return this._samples;\r\n },\r\n /**\r\n * MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)\r\n */\r\n set: function (sampleCount) {\r\n if (this._samples === sampleCount) {\r\n return;\r\n }\r\n this._samples = sampleCount;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"imageProcessingEnabled\", {\r\n get: function () {\r\n return this._imageProcessingEnabled;\r\n },\r\n /**\r\n * If image processing is enabled.\r\n */\r\n set: function (enabled) {\r\n if (this._imageProcessingEnabled === enabled) {\r\n return;\r\n }\r\n this._imageProcessingEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"glowLayerEnabled\", {\r\n get: function () {\r\n return this._glowLayer != null;\r\n },\r\n /**\r\n * If glow layer is enabled. (Adds a glow effect to emmissive materials)\r\n */\r\n set: function (enabled) {\r\n if (enabled && !this._glowLayer) {\r\n this._glowLayer = new _Layers_glowLayer__WEBPACK_IMPORTED_MODULE_5__[\"GlowLayer\"](\"\", this._scene);\r\n }\r\n else if (!enabled && this._glowLayer) {\r\n this._glowLayer.dispose();\r\n this._glowLayer = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"glowLayer\", {\r\n /**\r\n * Gets the glow layer (or null if not defined)\r\n */\r\n get: function () {\r\n return this._glowLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"chromaticAberrationEnabled\", {\r\n get: function () {\r\n return this._chromaticAberrationEnabled;\r\n },\r\n /**\r\n * Enable or disable the chromaticAberration process from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._chromaticAberrationEnabled === enabled) {\r\n return;\r\n }\r\n this._chromaticAberrationEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"grainEnabled\", {\r\n get: function () {\r\n return this._grainEnabled;\r\n },\r\n /**\r\n * Enable or disable the grain process from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._grainEnabled === enabled) {\r\n return;\r\n }\r\n this._grainEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the class name\r\n * @returns \"DefaultRenderingPipeline\"\r\n */\r\n DefaultRenderingPipeline.prototype.getClassName = function () {\r\n return \"DefaultRenderingPipeline\";\r\n };\r\n /**\r\n * Force the compilation of the entire pipeline.\r\n */\r\n DefaultRenderingPipeline.prototype.prepare = function () {\r\n var previousState = this._buildAllowed;\r\n this._buildAllowed = true;\r\n this._buildPipeline();\r\n this._buildAllowed = previousState;\r\n };\r\n DefaultRenderingPipeline.prototype._setAutoClearAndTextureSharing = function (postProcess, skipTextureSharing) {\r\n if (skipTextureSharing === void 0) { skipTextureSharing = false; }\r\n if (this._hasCleared) {\r\n postProcess.autoClear = false;\r\n }\r\n else {\r\n postProcess.autoClear = true;\r\n this._scene.autoClear = false;\r\n this._hasCleared = true;\r\n }\r\n if (!skipTextureSharing) {\r\n if (this._prevPrevPostProcess) {\r\n postProcess.shareOutputWith(this._prevPrevPostProcess);\r\n }\r\n else {\r\n postProcess.useOwnOutput();\r\n }\r\n if (this._prevPostProcess) {\r\n this._prevPrevPostProcess = this._prevPostProcess;\r\n }\r\n this._prevPostProcess = postProcess;\r\n }\r\n };\r\n DefaultRenderingPipeline.prototype._buildPipeline = function () {\r\n var _this = this;\r\n if (!this._buildAllowed) {\r\n return;\r\n }\r\n this._scene.autoClear = true;\r\n var engine = this._scene.getEngine();\r\n this._disposePostProcesses();\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n // get back cameras to be used to reattach pipeline\r\n this._cameras = this._camerasToBeAttached.slice();\r\n }\r\n this._reset();\r\n this._prevPostProcess = null;\r\n this._prevPrevPostProcess = null;\r\n this._hasCleared = false;\r\n if (this.depthOfFieldEnabled) {\r\n // Multi camera suport\r\n if (this._cameras.length > 1) {\r\n for (var _i = 0, _a = this._cameras; _i < _a.length; _i++) {\r\n var camera = _a[_i];\r\n var depthRenderer = this._scene.enableDepthRenderer(camera);\r\n depthRenderer.useOnlyInActiveCamera = true;\r\n }\r\n this._depthOfFieldSceneObserver = this._scene.onAfterRenderTargetsRenderObservable.add(function (scene) {\r\n if (_this._cameras.indexOf(scene.activeCamera) > -1) {\r\n _this.depthOfField.depthTexture = scene.enableDepthRenderer(scene.activeCamera).getDepthMap();\r\n }\r\n });\r\n }\r\n else {\r\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\r\n var depthRenderer = this._scene.enableDepthRenderer(this._cameras[0]);\r\n this.depthOfField.depthTexture = depthRenderer.getDepthMap();\r\n }\r\n if (!this.depthOfField._isReady()) {\r\n this.depthOfField._updateEffects();\r\n }\r\n this.addEffect(this.depthOfField);\r\n this._setAutoClearAndTextureSharing(this.depthOfField._effects[0], true);\r\n }\r\n else {\r\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\r\n }\r\n if (this.bloomEnabled) {\r\n if (!this.bloom._isReady()) {\r\n this.bloom._updateEffects();\r\n }\r\n this.addEffect(this.bloom);\r\n this._setAutoClearAndTextureSharing(this.bloom._effects[0], true);\r\n }\r\n if (this._imageProcessingEnabled) {\r\n this.imageProcessing = new _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingPostProcess\"](\"imageProcessing\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType);\r\n if (this._hdr) {\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, this.ImageProcessingPostProcessId, function () { return _this.imageProcessing; }, true));\r\n this._setAutoClearAndTextureSharing(this.imageProcessing);\r\n }\r\n else {\r\n this._scene.imageProcessingConfiguration.applyByPostProcess = false;\r\n }\r\n }\r\n if (this.sharpenEnabled) {\r\n if (!this.sharpen.isReady()) {\r\n this.sharpen.updateEffect();\r\n }\r\n this.addEffect(this._sharpenEffect);\r\n this._setAutoClearAndTextureSharing(this.sharpen);\r\n }\r\n if (this.grainEnabled) {\r\n if (!this.grain.isReady()) {\r\n this.grain.updateEffect();\r\n }\r\n this.addEffect(this._grainEffect);\r\n this._setAutoClearAndTextureSharing(this.grain);\r\n }\r\n if (this.chromaticAberrationEnabled) {\r\n if (!this.chromaticAberration.isReady()) {\r\n this.chromaticAberration.updateEffect();\r\n }\r\n this.addEffect(this._chromaticAberrationEffect);\r\n this._setAutoClearAndTextureSharing(this.chromaticAberration);\r\n }\r\n if (this.fxaaEnabled) {\r\n this.fxaa = new _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"FxaaPostProcess\"](\"fxaa\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, this.FxaaPostProcessId, function () { return _this.fxaa; }, true));\r\n this._setAutoClearAndTextureSharing(this.fxaa, true);\r\n }\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\r\n }\r\n // In multicamera mode, the scene needs to autoclear in between cameras.\r\n if (this._scene.activeCameras && this._scene.activeCameras.length > 1) {\r\n this._scene.autoClear = true;\r\n }\r\n if (!this._enableMSAAOnFirstPostProcess(this.samples) && this.samples > 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\");\r\n }\r\n };\r\n DefaultRenderingPipeline.prototype._disposePostProcesses = function (disposeNonRecreated) {\r\n if (disposeNonRecreated === void 0) { disposeNonRecreated = false; }\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n var camera = this._cameras[i];\r\n if (this.imageProcessing) {\r\n this.imageProcessing.dispose(camera);\r\n }\r\n if (this.fxaa) {\r\n this.fxaa.dispose(camera);\r\n }\r\n // These are created in the constructor and should not be disposed on every pipeline change\r\n if (disposeNonRecreated) {\r\n if (this.sharpen) {\r\n this.sharpen.dispose(camera);\r\n }\r\n if (this.depthOfField) {\r\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\r\n this.depthOfField.disposeEffects(camera);\r\n }\r\n if (this.bloom) {\r\n this.bloom.disposeEffects(camera);\r\n }\r\n if (this.chromaticAberration) {\r\n this.chromaticAberration.dispose(camera);\r\n }\r\n if (this.grain) {\r\n this.grain.dispose(camera);\r\n }\r\n if (this._glowLayer) {\r\n this._glowLayer.dispose();\r\n }\r\n }\r\n }\r\n this.imageProcessing = null;\r\n this.fxaa = null;\r\n if (disposeNonRecreated) {\r\n this.sharpen = null;\r\n this._sharpenEffect = null;\r\n this.depthOfField = null;\r\n this.bloom = null;\r\n this.chromaticAberration = null;\r\n this._chromaticAberrationEffect = null;\r\n this.grain = null;\r\n this._grainEffect = null;\r\n this._glowLayer = null;\r\n }\r\n };\r\n /**\r\n * Adds a camera to the pipeline\r\n * @param camera the camera to be added\r\n */\r\n DefaultRenderingPipeline.prototype.addCamera = function (camera) {\r\n this._camerasToBeAttached.push(camera);\r\n this._buildPipeline();\r\n };\r\n /**\r\n * Removes a camera from the pipeline\r\n * @param camera the camera to remove\r\n */\r\n DefaultRenderingPipeline.prototype.removeCamera = function (camera) {\r\n var index = this._camerasToBeAttached.indexOf(camera);\r\n this._camerasToBeAttached.splice(index, 1);\r\n this._buildPipeline();\r\n };\r\n /**\r\n * Dispose of the pipeline and stop all post processes\r\n */\r\n DefaultRenderingPipeline.prototype.dispose = function () {\r\n this._disposePostProcesses(true);\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n this._scene.autoClear = true;\r\n if (this._resizeObserver) {\r\n this._scene.getEngine().onResizeObservable.remove(this._resizeObserver);\r\n this._resizeObserver = null;\r\n }\r\n this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver);\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Serialize the rendering pipeline (Used when exporting)\r\n * @returns the serialized object\r\n */\r\n DefaultRenderingPipeline.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"DefaultRenderingPipeline\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the serialized pipeline\r\n * @param source Source pipeline.\r\n * @param scene The scene to load the pipeline to.\r\n * @param rootUrl The URL of the serialized pipeline.\r\n * @returns An instantiated pipeline from the serialized object.\r\n */\r\n DefaultRenderingPipeline.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new DefaultRenderingPipeline(source._name, source._name._hdr, scene); }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"sharpenEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomKernel\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"_bloomWeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"_bloomThreshold\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"_hdr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomWeight\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomThreshold\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"depthOfFieldEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"depthOfFieldBlurLevel\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"fxaaEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"samples\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"imageProcessingEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"glowLayerEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"chromaticAberrationEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"grainEnabled\", null);\r\n return DefaultRenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_11__[\"PostProcessRenderPipeline\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_15__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DefaultRenderingPipeline\"] = DefaultRenderingPipeline;\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/index.ts\":\n/*!*********************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/index.ts ***!\n \\*********************************************************/\n/*! exports provided: DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _defaultRenderingPipeline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _defaultRenderingPipeline__WEBPACK_IMPORTED_MODULE_0__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony import */ var _lensRenderingPipeline__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lensRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _lensRenderingPipeline__WEBPACK_IMPORTED_MODULE_1__[\"LensRenderingPipeline\"]; });\n\n/* harmony import */ var _ssao2RenderingPipeline__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ssao2RenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _ssao2RenderingPipeline__WEBPACK_IMPORTED_MODULE_2__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony import */ var _ssaoRenderingPipeline__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ssaoRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _ssaoRenderingPipeline__WEBPACK_IMPORTED_MODULE_3__[\"SSAORenderingPipeline\"]; });\n\n/* harmony import */ var _standardRenderingPipeline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./standardRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _standardRenderingPipeline__WEBPACK_IMPORTED_MODULE_4__[\"StandardRenderingPipeline\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.ts\":\n/*!*************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.ts ***!\n \\*************************************************************************/\n/*! exports provided: LensRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return LensRenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_chromaticAberration_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../Shaders/chromaticAberration.fragment */ \"./Shaders/chromaticAberration.fragment.ts\");\n/* harmony import */ var _Shaders_lensHighlights_fragment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../Shaders/lensHighlights.fragment */ \"./Shaders/lensHighlights.fragment.ts\");\n/* harmony import */ var _Shaders_depthOfField_fragment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Shaders/depthOfField.fragment */ \"./Shaders/depthOfField.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * BABYLON.JS Chromatic Aberration GLSL Shader\r\n * Author: Olivier Guyot\r\n * Separates very slightly R, G and B colors on the edges of the screen\r\n * Inspired by Francois Tarlier & Martins Upitis\r\n */\r\nvar LensRenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LensRenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n *\r\n * Effect parameters are as follow:\r\n * {\r\n * chromatic_aberration: number; // from 0 to x (1 for realism)\r\n * edge_blur: number; // from 0 to x (1 for realism)\r\n * distortion: number; // from 0 to x (1 for realism)\r\n * grain_amount: number; // from 0 to 1\r\n * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise\r\n * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)\r\n * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)\r\n * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)\r\n * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like \"bokeh\" effect\r\n * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)\r\n * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)\r\n * blur_noise: boolean; // add a little bit of noise to the blur (default: true)\r\n * }\r\n * Note: if an effect parameter is unset, effect is disabled\r\n *\r\n * @param name The rendering pipeline name\r\n * @param parameters - An object containing all parameters (see above)\r\n * @param scene The scene linked to this pipeline\r\n * @param ratio The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)\r\n * @param cameras The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function LensRenderingPipeline(name, parameters, scene, ratio, cameras) {\r\n if (ratio === void 0) { ratio = 1.0; }\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n // Lens effects can be of the following:\r\n // - chromatic aberration (slight shift of RGB colors)\r\n // - blur on the edge of the lens\r\n // - lens distortion\r\n // - depth-of-field blur & highlights enhancing\r\n // - depth-of-field 'bokeh' effect (shapes appearing in blurred areas)\r\n // - grain effect (noise or custom texture)\r\n // Two additional texture samplers are needed:\r\n // - depth map (for depth-of-field)\r\n // - grain texture\r\n /**\r\n * @ignore\r\n * The chromatic aberration PostProcess id in the pipeline\r\n */\r\n _this.LensChromaticAberrationEffect = \"LensChromaticAberrationEffect\";\r\n /**\r\n * @ignore\r\n * The highlights enhancing PostProcess id in the pipeline\r\n */\r\n _this.HighlightsEnhancingEffect = \"HighlightsEnhancingEffect\";\r\n /**\r\n * @ignore\r\n * The depth-of-field PostProcess id in the pipeline\r\n */\r\n _this.LensDepthOfFieldEffect = \"LensDepthOfFieldEffect\";\r\n _this._pentagonBokehIsEnabled = false;\r\n _this._scene = scene;\r\n // Fetch texture samplers\r\n _this._depthTexture = scene.enableDepthRenderer().getDepthMap(); // Force depth renderer \"on\"\r\n if (parameters.grain_texture) {\r\n _this._grainTexture = parameters.grain_texture;\r\n }\r\n else {\r\n _this._createGrainTexture();\r\n }\r\n // save parameters\r\n _this._edgeBlur = parameters.edge_blur ? parameters.edge_blur : 0;\r\n _this._grainAmount = parameters.grain_amount ? parameters.grain_amount : 0;\r\n _this._chromaticAberration = parameters.chromatic_aberration ? parameters.chromatic_aberration : 0;\r\n _this._distortion = parameters.distortion ? parameters.distortion : 0;\r\n _this._highlightsGain = parameters.dof_gain !== undefined ? parameters.dof_gain : -1;\r\n _this._highlightsThreshold = parameters.dof_threshold ? parameters.dof_threshold : 1;\r\n _this._dofDistance = parameters.dof_focus_distance !== undefined ? parameters.dof_focus_distance : -1;\r\n _this._dofAperture = parameters.dof_aperture ? parameters.dof_aperture : 1;\r\n _this._dofDarken = parameters.dof_darken ? parameters.dof_darken : 0;\r\n _this._dofPentagon = parameters.dof_pentagon !== undefined ? parameters.dof_pentagon : true;\r\n _this._blurNoise = parameters.blur_noise !== undefined ? parameters.blur_noise : true;\r\n // Create effects\r\n _this._createChromaticAberrationPostProcess(ratio);\r\n _this._createHighlightsPostProcess(ratio);\r\n _this._createDepthOfFieldPostProcess(ratio / 4);\r\n // Set up pipeline\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.LensChromaticAberrationEffect, function () { return _this._chromaticAberrationPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.HighlightsEnhancingEffect, function () { return _this._highlightsPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.LensDepthOfFieldEffect, function () { return _this._depthOfFieldPostProcess; }, true));\r\n if (_this._highlightsGain === -1) {\r\n _this._disableEffect(_this.HighlightsEnhancingEffect, null);\r\n }\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n if (cameras) {\r\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Get the class name\r\n * @returns \"LensRenderingPipeline\"\r\n */\r\n LensRenderingPipeline.prototype.getClassName = function () {\r\n return \"LensRenderingPipeline\";\r\n };\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"scene\", {\r\n // Properties\r\n /**\r\n * Gets associated scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"edgeBlur\", {\r\n /**\r\n * Gets or sets the edge blur\r\n */\r\n get: function () {\r\n return this._edgeBlur;\r\n },\r\n set: function (value) {\r\n this.setEdgeBlur(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"grainAmount\", {\r\n /**\r\n * Gets or sets the grain amount\r\n */\r\n get: function () {\r\n return this._grainAmount;\r\n },\r\n set: function (value) {\r\n this.setGrainAmount(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"chromaticAberration\", {\r\n /**\r\n * Gets or sets the chromatic aberration amount\r\n */\r\n get: function () {\r\n return this._chromaticAberration;\r\n },\r\n set: function (value) {\r\n this.setChromaticAberration(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"dofAperture\", {\r\n /**\r\n * Gets or sets the depth of field aperture\r\n */\r\n get: function () {\r\n return this._dofAperture;\r\n },\r\n set: function (value) {\r\n this.setAperture(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"edgeDistortion\", {\r\n /**\r\n * Gets or sets the edge distortion\r\n */\r\n get: function () {\r\n return this._distortion;\r\n },\r\n set: function (value) {\r\n this.setEdgeDistortion(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"dofDistortion\", {\r\n /**\r\n * Gets or sets the depth of field distortion\r\n */\r\n get: function () {\r\n return this._dofDistance;\r\n },\r\n set: function (value) {\r\n this.setFocusDistance(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"darkenOutOfFocus\", {\r\n /**\r\n * Gets or sets the darken out of focus amount\r\n */\r\n get: function () {\r\n return this._dofDarken;\r\n },\r\n set: function (value) {\r\n this.setDarkenOutOfFocus(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"blurNoise\", {\r\n /**\r\n * Gets or sets a boolean indicating if blur noise is enabled\r\n */\r\n get: function () {\r\n return this._blurNoise;\r\n },\r\n set: function (value) {\r\n this._blurNoise = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"pentagonBokeh\", {\r\n /**\r\n * Gets or sets a boolean indicating if pentagon bokeh is enabled\r\n */\r\n get: function () {\r\n return this._pentagonBokehIsEnabled;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n this.enablePentagonBokeh();\r\n }\r\n else {\r\n this.disablePentagonBokeh();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"highlightsGain\", {\r\n /**\r\n * Gets or sets the highlight grain amount\r\n */\r\n get: function () {\r\n return this._highlightsGain;\r\n },\r\n set: function (value) {\r\n this.setHighlightsGain(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"highlightsThreshold\", {\r\n /**\r\n * Gets or sets the highlight threshold\r\n */\r\n get: function () {\r\n return this._highlightsThreshold;\r\n },\r\n set: function (value) {\r\n this.setHighlightsThreshold(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // public methods (self explanatory)\r\n /**\r\n * Sets the amount of blur at the edges\r\n * @param amount blur amount\r\n */\r\n LensRenderingPipeline.prototype.setEdgeBlur = function (amount) { this._edgeBlur = amount; };\r\n /**\r\n * Sets edge blur to 0\r\n */\r\n LensRenderingPipeline.prototype.disableEdgeBlur = function () { this._edgeBlur = 0; };\r\n /**\r\n * Sets the amout of grain\r\n * @param amount Amount of grain\r\n */\r\n LensRenderingPipeline.prototype.setGrainAmount = function (amount) { this._grainAmount = amount; };\r\n /**\r\n * Set grain amount to 0\r\n */\r\n LensRenderingPipeline.prototype.disableGrain = function () { this._grainAmount = 0; };\r\n /**\r\n * Sets the chromatic aberration amount\r\n * @param amount amount of chromatic aberration\r\n */\r\n LensRenderingPipeline.prototype.setChromaticAberration = function (amount) { this._chromaticAberration = amount; };\r\n /**\r\n * Sets chromatic aberration amount to 0\r\n */\r\n LensRenderingPipeline.prototype.disableChromaticAberration = function () { this._chromaticAberration = 0; };\r\n /**\r\n * Sets the EdgeDistortion amount\r\n * @param amount amount of EdgeDistortion\r\n */\r\n LensRenderingPipeline.prototype.setEdgeDistortion = function (amount) { this._distortion = amount; };\r\n /**\r\n * Sets edge distortion to 0\r\n */\r\n LensRenderingPipeline.prototype.disableEdgeDistortion = function () { this._distortion = 0; };\r\n /**\r\n * Sets the FocusDistance amount\r\n * @param amount amount of FocusDistance\r\n */\r\n LensRenderingPipeline.prototype.setFocusDistance = function (amount) { this._dofDistance = amount; };\r\n /**\r\n * Disables depth of field\r\n */\r\n LensRenderingPipeline.prototype.disableDepthOfField = function () { this._dofDistance = -1; };\r\n /**\r\n * Sets the Aperture amount\r\n * @param amount amount of Aperture\r\n */\r\n LensRenderingPipeline.prototype.setAperture = function (amount) { this._dofAperture = amount; };\r\n /**\r\n * Sets the DarkenOutOfFocus amount\r\n * @param amount amount of DarkenOutOfFocus\r\n */\r\n LensRenderingPipeline.prototype.setDarkenOutOfFocus = function (amount) { this._dofDarken = amount; };\r\n /**\r\n * Creates a pentagon bokeh effect\r\n */\r\n LensRenderingPipeline.prototype.enablePentagonBokeh = function () {\r\n this._highlightsPostProcess.updateEffect(\"#define PENTAGON\\n\");\r\n this._pentagonBokehIsEnabled = true;\r\n };\r\n /**\r\n * Disables the pentagon bokeh effect\r\n */\r\n LensRenderingPipeline.prototype.disablePentagonBokeh = function () {\r\n this._pentagonBokehIsEnabled = false;\r\n this._highlightsPostProcess.updateEffect();\r\n };\r\n /**\r\n * Enables noise blur\r\n */\r\n LensRenderingPipeline.prototype.enableNoiseBlur = function () { this._blurNoise = true; };\r\n /**\r\n * Disables noise blur\r\n */\r\n LensRenderingPipeline.prototype.disableNoiseBlur = function () { this._blurNoise = false; };\r\n /**\r\n * Sets the HighlightsGain amount\r\n * @param amount amount of HighlightsGain\r\n */\r\n LensRenderingPipeline.prototype.setHighlightsGain = function (amount) {\r\n this._highlightsGain = amount;\r\n };\r\n /**\r\n * Sets the HighlightsThreshold amount\r\n * @param amount amount of HighlightsThreshold\r\n */\r\n LensRenderingPipeline.prototype.setHighlightsThreshold = function (amount) {\r\n if (this._highlightsGain === -1) {\r\n this._highlightsGain = 1.0;\r\n }\r\n this._highlightsThreshold = amount;\r\n };\r\n /**\r\n * Disables highlights\r\n */\r\n LensRenderingPipeline.prototype.disableHighlights = function () {\r\n this._highlightsGain = -1;\r\n };\r\n /**\r\n * Removes the internal pipeline assets and detaches the pipeline from the scene cameras\r\n * @param disableDepthRender If the scens depth rendering should be disabled (default: false)\r\n */\r\n LensRenderingPipeline.prototype.dispose = function (disableDepthRender) {\r\n if (disableDepthRender === void 0) { disableDepthRender = false; }\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\r\n this._chromaticAberrationPostProcess = null;\r\n this._highlightsPostProcess = null;\r\n this._depthOfFieldPostProcess = null;\r\n this._grainTexture.dispose();\r\n if (disableDepthRender) {\r\n this._scene.disableDepthRenderer();\r\n }\r\n };\r\n // colors shifting and distortion\r\n LensRenderingPipeline.prototype._createChromaticAberrationPostProcess = function (ratio) {\r\n var _this = this;\r\n this._chromaticAberrationPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"](\"LensChromaticAberration\", \"chromaticAberration\", [\"chromatic_aberration\", \"screen_width\", \"screen_height\", \"direction\", \"radialIntensity\", \"centerPosition\"], // uniforms\r\n [], // samplers\r\n ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._chromaticAberrationPostProcess.onApply = function (effect) {\r\n effect.setFloat('chromatic_aberration', _this._chromaticAberration);\r\n effect.setFloat('screen_width', _this._scene.getEngine().getRenderWidth());\r\n effect.setFloat('screen_height', _this._scene.getEngine().getRenderHeight());\r\n effect.setFloat('radialIntensity', 1);\r\n effect.setFloat2('direction', 17, 17);\r\n effect.setFloat2('centerPosition', 0.5, 0.5);\r\n };\r\n };\r\n // highlights enhancing\r\n LensRenderingPipeline.prototype._createHighlightsPostProcess = function (ratio) {\r\n var _this = this;\r\n this._highlightsPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"](\"LensHighlights\", \"lensHighlights\", [\"gain\", \"threshold\", \"screen_width\", \"screen_height\"], // uniforms\r\n [], // samplers\r\n ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, this._dofPentagon ? \"#define PENTAGON\\n\" : \"\");\r\n this._highlightsPostProcess.onApply = function (effect) {\r\n effect.setFloat('gain', _this._highlightsGain);\r\n effect.setFloat('threshold', _this._highlightsThreshold);\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._chromaticAberrationPostProcess);\r\n effect.setFloat('screen_width', _this._scene.getEngine().getRenderWidth());\r\n effect.setFloat('screen_height', _this._scene.getEngine().getRenderHeight());\r\n };\r\n };\r\n // colors shifting and distortion\r\n LensRenderingPipeline.prototype._createDepthOfFieldPostProcess = function (ratio) {\r\n var _this = this;\r\n this._depthOfFieldPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"](\"LensDepthOfField\", \"depthOfField\", [\r\n \"grain_amount\", \"blur_noise\", \"screen_width\", \"screen_height\", \"distortion\", \"dof_enabled\",\r\n \"screen_distance\", \"aperture\", \"darken\", \"edge_blur\", \"highlights\", \"near\", \"far\"\r\n ], [\"depthSampler\", \"grainSampler\", \"highlightsSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._depthOfFieldPostProcess.onApply = function (effect) {\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n effect.setTexture(\"grainSampler\", _this._grainTexture);\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._highlightsPostProcess);\r\n effect.setTextureFromPostProcess(\"highlightsSampler\", _this._depthOfFieldPostProcess);\r\n effect.setFloat('grain_amount', _this._grainAmount);\r\n effect.setBool('blur_noise', _this._blurNoise);\r\n effect.setFloat('screen_width', _this._scene.getEngine().getRenderWidth());\r\n effect.setFloat('screen_height', _this._scene.getEngine().getRenderHeight());\r\n effect.setFloat('distortion', _this._distortion);\r\n effect.setBool('dof_enabled', (_this._dofDistance !== -1));\r\n effect.setFloat('screen_distance', 1.0 / (0.1 - 1.0 / _this._dofDistance));\r\n effect.setFloat('aperture', _this._dofAperture);\r\n effect.setFloat('darken', _this._dofDarken);\r\n effect.setFloat('edge_blur', _this._edgeBlur);\r\n effect.setBool('highlights', (_this._highlightsGain !== -1));\r\n if (_this._scene.activeCamera) {\r\n effect.setFloat('near', _this._scene.activeCamera.minZ);\r\n effect.setFloat('far', _this._scene.activeCamera.maxZ);\r\n }\r\n };\r\n };\r\n // creates a black and white random noise texture, 512x512\r\n LensRenderingPipeline.prototype._createGrainTexture = function () {\r\n var size = 512;\r\n this._grainTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_2__[\"DynamicTexture\"](\"LensNoiseTexture\", size, this._scene, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._grainTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].WRAP_ADDRESSMODE;\r\n this._grainTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].WRAP_ADDRESSMODE;\r\n var context = this._grainTexture.getContext();\r\n var rand = function (min, max) {\r\n return Math.random() * (max - min) + min;\r\n };\r\n var value;\r\n for (var x = 0; x < size; x++) {\r\n for (var y = 0; y < size; y++) {\r\n value = Math.floor(rand(0.42, 0.58) * 255);\r\n context.fillStyle = 'rgb(' + value + ', ' + value + ', ' + value + ')';\r\n context.fillRect(x, y, 1, 1);\r\n }\r\n }\r\n this._grainTexture.update(false);\r\n };\r\n return LensRenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_4__[\"PostProcessRenderPipeline\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.ts\":\n/*!**************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.ts ***!\n \\**************************************************************************/\n/*! exports provided: SSAO2RenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return SSAO2RenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_ssao2_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../Shaders/ssao2.fragment */ \"./Shaders/ssao2.fragment.ts\");\n/* harmony import */ var _Shaders_ssaoCombine_fragment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../Shaders/ssaoCombine.fragment */ \"./Shaders/ssaoCombine.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Render pipeline to produce ssao effect\r\n */\r\nvar SSAO2RenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SSAO2RenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n * @param name The rendering pipeline name\r\n * @param scene The scene linked to this pipeline\r\n * @param ratio The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, blurRatio: 1.0 }\r\n * @param cameras The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function SSAO2RenderingPipeline(name, scene, ratio, cameras) {\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n // Members\r\n /**\r\n * @ignore\r\n * The PassPostProcess id in the pipeline that contains the original scene color\r\n */\r\n _this.SSAOOriginalSceneColorEffect = \"SSAOOriginalSceneColorEffect\";\r\n /**\r\n * @ignore\r\n * The SSAO PostProcess id in the pipeline\r\n */\r\n _this.SSAORenderEffect = \"SSAORenderEffect\";\r\n /**\r\n * @ignore\r\n * The horizontal blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurHRenderEffect = \"SSAOBlurHRenderEffect\";\r\n /**\r\n * @ignore\r\n * The vertical blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurVRenderEffect = \"SSAOBlurVRenderEffect\";\r\n /**\r\n * @ignore\r\n * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)\r\n */\r\n _this.SSAOCombineRenderEffect = \"SSAOCombineRenderEffect\";\r\n /**\r\n * The output strength of the SSAO post-process. Default value is 1.0.\r\n */\r\n _this.totalStrength = 1.0;\r\n /**\r\n * Maximum depth value to still render AO. A smooth falloff makes the dimming more natural, so there will be no abrupt shading change.\r\n */\r\n _this.maxZ = 100.0;\r\n /**\r\n * In order to save performances, SSAO radius is clamped on close geometry. This ratio changes by how much\r\n */\r\n _this.minZAspect = 0.2;\r\n _this._samples = 8;\r\n _this._textureSamples = 1;\r\n _this._expensiveBlur = true;\r\n /**\r\n * The radius around the analyzed pixel used by the SSAO post-process. Default value is 2.0\r\n */\r\n _this.radius = 2.0;\r\n /**\r\n * The base color of the SSAO post-process\r\n * The final result is \"base + ssao\" between [0, 1]\r\n */\r\n _this.base = 0;\r\n _this._firstUpdate = true;\r\n _this._bits = new Uint32Array(1);\r\n _this._scene = scene;\r\n _this._ratio = ratio;\r\n if (!_this.isSupported) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"SSAO 2 needs WebGL 2 support.\");\r\n return _this;\r\n }\r\n var ssaoRatio = _this._ratio.ssaoRatio || ratio;\r\n var blurRatio = _this._ratio.blurRatio || ratio;\r\n // Set up assets\r\n var geometryBufferRenderer = scene.enableGeometryBufferRenderer();\r\n _this._createRandomTexture();\r\n _this._depthTexture = geometryBufferRenderer.getGBuffer().textures[0];\r\n _this._normalTexture = geometryBufferRenderer.getGBuffer().textures[1];\r\n _this._originalColorPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"PassPostProcess\"](\"SSAOOriginalSceneColor\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false);\r\n _this._originalColorPostProcess.samples = _this.textureSamples;\r\n _this._createSSAOPostProcess(1.0);\r\n _this._createBlurPostProcess(ssaoRatio, blurRatio);\r\n _this._createSSAOCombinePostProcess(blurRatio);\r\n // Set up pipeline\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOOriginalSceneColorEffect, function () { return _this._originalColorPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAORenderEffect, function () { return _this._ssaoPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurHRenderEffect, function () { return _this._blurHPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurVRenderEffect, function () { return _this._blurVPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOCombineRenderEffect, function () { return _this._ssaoCombinePostProcess; }, true));\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n if (cameras) {\r\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"samples\", {\r\n get: function () {\r\n return this._samples;\r\n },\r\n /**\r\n * Number of samples used for the SSAO calculations. Default value is 8\r\n */\r\n set: function (n) {\r\n this._ssaoPostProcess.updateEffect(\"#define SAMPLES \" + n + \"\\n#define SSAO\");\r\n this._samples = n;\r\n this._sampleSphere = this._generateHemisphere();\r\n this._firstUpdate = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"textureSamples\", {\r\n get: function () {\r\n return this._textureSamples;\r\n },\r\n /**\r\n * Number of samples to use for antialiasing\r\n */\r\n set: function (n) {\r\n this._textureSamples = n;\r\n this._originalColorPostProcess.samples = n;\r\n this._blurHPostProcess.samples = n;\r\n this._blurVPostProcess.samples = n;\r\n this._ssaoPostProcess.samples = n;\r\n this._ssaoCombinePostProcess.samples = n;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"expensiveBlur\", {\r\n get: function () {\r\n return this._expensiveBlur;\r\n },\r\n /**\r\n * If bilateral blur should be used\r\n */\r\n set: function (b) {\r\n this._blurHPostProcess.updateEffect(\"#define BILATERAL_BLUR\\n#define BILATERAL_BLUR_H\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (b ? \"1\" : \"0\") + \"\\n\", null, [\"textureSampler\", \"depthSampler\"]);\r\n this._blurVPostProcess.updateEffect(\"#define BILATERAL_BLUR\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (b ? \"1\" : \"0\") + \"\\n\", null, [\"textureSampler\", \"depthSampler\"]);\r\n this._expensiveBlur = b;\r\n this._firstUpdate = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline, \"IsSupported\", {\r\n /**\r\n * Support test.\r\n */\r\n get: function () {\r\n var engine = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_11__[\"EngineStore\"].LastCreatedEngine;\r\n if (!engine) {\r\n return false;\r\n }\r\n return engine.getCaps().drawBuffersExtension;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"scene\", {\r\n /**\r\n * Gets active scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Public Methods\r\n /**\r\n * Get the class name\r\n * @returns \"SSAO2RenderingPipeline\"\r\n */\r\n SSAO2RenderingPipeline.prototype.getClassName = function () {\r\n return \"SSAO2RenderingPipeline\";\r\n };\r\n /**\r\n * Removes the internal pipeline assets and detatches the pipeline from the scene cameras\r\n */\r\n SSAO2RenderingPipeline.prototype.dispose = function (disableGeometryBufferRenderer) {\r\n if (disableGeometryBufferRenderer === void 0) { disableGeometryBufferRenderer = false; }\r\n for (var i = 0; i < this._scene.cameras.length; i++) {\r\n var camera = this._scene.cameras[i];\r\n this._originalColorPostProcess.dispose(camera);\r\n this._ssaoPostProcess.dispose(camera);\r\n this._blurHPostProcess.dispose(camera);\r\n this._blurVPostProcess.dispose(camera);\r\n this._ssaoCombinePostProcess.dispose(camera);\r\n }\r\n this._randomTexture.dispose();\r\n if (disableGeometryBufferRenderer) {\r\n this._scene.disableGeometryBufferRenderer();\r\n }\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\r\n _super.prototype.dispose.call(this);\r\n };\r\n // Private Methods\r\n SSAO2RenderingPipeline.prototype._createBlurPostProcess = function (ssaoRatio, blurRatio) {\r\n var _this = this;\r\n this._samplerOffsets = [];\r\n var expensive = this.expensiveBlur;\r\n for (var i = -8; i < 8; i++) {\r\n this._samplerOffsets.push(i * 2 + 0.5);\r\n }\r\n this._blurHPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"BlurH\", \"ssao2\", [\"outSize\", \"samplerOffsets\", \"near\", \"far\", \"radius\"], [\"depthSampler\"], ssaoRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define BILATERAL_BLUR\\n#define BILATERAL_BLUR_H\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (expensive ? \"1\" : \"0\") + \"\\n\");\r\n this._blurHPostProcess.onApply = function (effect) {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setFloat(\"outSize\", _this._ssaoCombinePostProcess.width > 0 ? _this._ssaoCombinePostProcess.width : _this._originalColorPostProcess.width);\r\n effect.setFloat(\"near\", _this._scene.activeCamera.minZ);\r\n effect.setFloat(\"far\", _this._scene.activeCamera.maxZ);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n if (_this._firstUpdate) {\r\n effect.setArray(\"samplerOffsets\", _this._samplerOffsets);\r\n }\r\n };\r\n this._blurVPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"BlurV\", \"ssao2\", [\"outSize\", \"samplerOffsets\", \"near\", \"far\", \"radius\"], [\"depthSampler\"], blurRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define BILATERAL_BLUR\\n#define BILATERAL_BLUR_V\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (expensive ? \"1\" : \"0\") + \"\\n\");\r\n this._blurVPostProcess.onApply = function (effect) {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setFloat(\"outSize\", _this._ssaoCombinePostProcess.height > 0 ? _this._ssaoCombinePostProcess.height : _this._originalColorPostProcess.height);\r\n effect.setFloat(\"near\", _this._scene.activeCamera.minZ);\r\n effect.setFloat(\"far\", _this._scene.activeCamera.maxZ);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n if (_this._firstUpdate) {\r\n effect.setArray(\"samplerOffsets\", _this._samplerOffsets);\r\n _this._firstUpdate = false;\r\n }\r\n };\r\n this._blurHPostProcess.samples = this.textureSamples;\r\n this._blurVPostProcess.samples = this.textureSamples;\r\n };\r\n /** @hidden */\r\n SSAO2RenderingPipeline.prototype._rebuild = function () {\r\n this._firstUpdate = true;\r\n _super.prototype._rebuild.call(this);\r\n };\r\n //Van der Corput radical inverse\r\n SSAO2RenderingPipeline.prototype._radicalInverse_VdC = function (i) {\r\n this._bits[0] = i;\r\n this._bits[0] = ((this._bits[0] << 16) | (this._bits[0] >> 16)) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x55555555) << 1) | ((this._bits[0] & 0xAAAAAAAA) >>> 1) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x33333333) << 2) | ((this._bits[0] & 0xCCCCCCCC) >>> 2) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x0F0F0F0F) << 4) | ((this._bits[0] & 0xF0F0F0F0) >>> 4) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x00FF00FF) << 8) | ((this._bits[0] & 0xFF00FF00) >>> 8) >>> 0;\r\n return this._bits[0] * 2.3283064365386963e-10; // / 0x100000000 or / 4294967296\r\n };\r\n SSAO2RenderingPipeline.prototype._hammersley = function (i, n) {\r\n return [i / n, this._radicalInverse_VdC(i)];\r\n };\r\n SSAO2RenderingPipeline.prototype._hemisphereSample_uniform = function (u, v) {\r\n var phi = v * 2.0 * Math.PI;\r\n // rejecting samples that are close to tangent plane to avoid z-fighting artifacts\r\n var cosTheta = 1.0 - (u * 0.85 + 0.15);\r\n var sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta);\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Math.cos(phi) * sinTheta, Math.sin(phi) * sinTheta, cosTheta);\r\n };\r\n SSAO2RenderingPipeline.prototype._generateHemisphere = function () {\r\n var numSamples = this.samples;\r\n var result = [];\r\n var vector;\r\n var i = 0;\r\n while (i < numSamples) {\r\n if (numSamples < 16) {\r\n vector = this._hemisphereSample_uniform(Math.random(), Math.random());\r\n }\r\n else {\r\n var rand = this._hammersley(i, numSamples);\r\n vector = this._hemisphereSample_uniform(rand[0], rand[1]);\r\n }\r\n result.push(vector.x, vector.y, vector.z);\r\n i++;\r\n }\r\n return result;\r\n };\r\n SSAO2RenderingPipeline.prototype._createSSAOPostProcess = function (ratio) {\r\n var _this = this;\r\n var numSamples = this.samples;\r\n this._sampleSphere = this._generateHemisphere();\r\n this._ssaoPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"ssao2\", \"ssao2\", [\r\n \"sampleSphere\", \"samplesFactor\", \"randTextureTiles\", \"totalStrength\", \"radius\",\r\n \"base\", \"range\", \"projection\", \"near\", \"far\", \"texelSize\",\r\n \"xViewport\", \"yViewport\", \"maxZ\", \"minZAspect\"\r\n ], [\"randomSampler\", \"normalSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define SAMPLES \" + numSamples + \"\\n#define SSAO\");\r\n this._ssaoPostProcess.onApply = function (effect) {\r\n if (_this._firstUpdate) {\r\n effect.setArray3(\"sampleSphere\", _this._sampleSphere);\r\n effect.setFloat(\"randTextureTiles\", 32.0);\r\n }\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setFloat(\"samplesFactor\", 1 / _this.samples);\r\n effect.setFloat(\"totalStrength\", _this.totalStrength);\r\n effect.setFloat2(\"texelSize\", 1 / _this._ssaoPostProcess.width, 1 / _this._ssaoPostProcess.height);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setFloat(\"maxZ\", _this.maxZ);\r\n effect.setFloat(\"minZAspect\", _this.minZAspect);\r\n effect.setFloat(\"base\", _this.base);\r\n effect.setFloat(\"near\", _this._scene.activeCamera.minZ);\r\n effect.setFloat(\"far\", _this._scene.activeCamera.maxZ);\r\n effect.setFloat(\"xViewport\", Math.tan(_this._scene.activeCamera.fov / 2) * _this._scene.getEngine().getAspectRatio(_this._scene.activeCamera, true));\r\n effect.setFloat(\"yViewport\", Math.tan(_this._scene.activeCamera.fov / 2));\r\n effect.setMatrix(\"projection\", _this._scene.getProjectionMatrix());\r\n effect.setTexture(\"textureSampler\", _this._depthTexture);\r\n effect.setTexture(\"normalSampler\", _this._normalTexture);\r\n effect.setTexture(\"randomSampler\", _this._randomTexture);\r\n };\r\n this._ssaoPostProcess.samples = this.textureSamples;\r\n };\r\n SSAO2RenderingPipeline.prototype._createSSAOCombinePostProcess = function (ratio) {\r\n var _this = this;\r\n this._ssaoCombinePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"ssaoCombine\", \"ssaoCombine\", [], [\"originalColor\", \"viewport\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._ssaoCombinePostProcess.onApply = function (effect) {\r\n var viewport = _this._scene.activeCamera.viewport;\r\n effect.setVector4(\"viewport\", _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector4[0].copyFromFloats(viewport.x, viewport.y, viewport.width, viewport.height));\r\n effect.setTextureFromPostProcess(\"originalColor\", _this._originalColorPostProcess);\r\n };\r\n this._ssaoCombinePostProcess.samples = this.textureSamples;\r\n };\r\n SSAO2RenderingPipeline.prototype._createRandomTexture = function () {\r\n var size = 128;\r\n this._randomTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_5__[\"DynamicTexture\"](\"SSAORandomTexture\", size, this._scene, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n this._randomTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n this._randomTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n var context = this._randomTexture.getContext();\r\n var rand = function (min, max) {\r\n return Math.random() * (max - min) + min;\r\n };\r\n var randVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n for (var x = 0; x < size; x++) {\r\n for (var y = 0; y < size; y++) {\r\n randVector.x = rand(0.0, 1.0);\r\n randVector.y = rand(0.0, 1.0);\r\n randVector.z = 0.0;\r\n randVector.normalize();\r\n randVector.scaleInPlace(255);\r\n randVector.x = Math.floor(randVector.x);\r\n randVector.y = Math.floor(randVector.y);\r\n context.fillStyle = 'rgb(' + randVector.x + ', ' + randVector.y + ', ' + randVector.z + ')';\r\n context.fillRect(x, y, 1, 1);\r\n }\r\n }\r\n this._randomTexture.update(false);\r\n };\r\n /**\r\n * Serialize the rendering pipeline (Used when exporting)\r\n * @returns the serialized object\r\n */\r\n SSAO2RenderingPipeline.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"SSAO2RenderingPipeline\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the serialized pipeline\r\n * @param source Source pipeline.\r\n * @param scene The scene to load the pipeline to.\r\n * @param rootUrl The URL of the serialized pipeline.\r\n * @returns An instantiated pipeline from the serialized object.\r\n */\r\n SSAO2RenderingPipeline.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"SerializationHelper\"].Parse(function () { return new SSAO2RenderingPipeline(source._name, scene, source._ratio); }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"totalStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"maxZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"minZAspect\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])(\"samples\")\r\n ], SSAO2RenderingPipeline.prototype, \"_samples\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])(\"textureSamples\")\r\n ], SSAO2RenderingPipeline.prototype, \"_textureSamples\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"_ratio\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])(\"expensiveBlur\")\r\n ], SSAO2RenderingPipeline.prototype, \"_expensiveBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"base\", void 0);\r\n return SSAO2RenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__[\"PostProcessRenderPipeline\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_10__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SSAO2RenderingPipeline\"] = SSAO2RenderingPipeline;\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts\":\n/*!*************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts ***!\n \\*************************************************************************/\n/*! exports provided: SSAORenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return SSAORenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_ssao_fragment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../Shaders/ssao.fragment */ \"./Shaders/ssao.fragment.ts\");\n/* harmony import */ var _Shaders_ssaoCombine_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../Shaders/ssaoCombine.fragment */ \"./Shaders/ssaoCombine.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Render pipeline to produce ssao effect\r\n */\r\nvar SSAORenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SSAORenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n * @param name - The rendering pipeline name\r\n * @param scene - The scene linked to this pipeline\r\n * @param ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 }\r\n * @param cameras - The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function SSAORenderingPipeline(name, scene, ratio, cameras) {\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n // Members\r\n /**\r\n * @ignore\r\n * The PassPostProcess id in the pipeline that contains the original scene color\r\n */\r\n _this.SSAOOriginalSceneColorEffect = \"SSAOOriginalSceneColorEffect\";\r\n /**\r\n * @ignore\r\n * The SSAO PostProcess id in the pipeline\r\n */\r\n _this.SSAORenderEffect = \"SSAORenderEffect\";\r\n /**\r\n * @ignore\r\n * The horizontal blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurHRenderEffect = \"SSAOBlurHRenderEffect\";\r\n /**\r\n * @ignore\r\n * The vertical blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurVRenderEffect = \"SSAOBlurVRenderEffect\";\r\n /**\r\n * @ignore\r\n * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)\r\n */\r\n _this.SSAOCombineRenderEffect = \"SSAOCombineRenderEffect\";\r\n /**\r\n * The output strength of the SSAO post-process. Default value is 1.0.\r\n */\r\n _this.totalStrength = 1.0;\r\n /**\r\n * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006\r\n */\r\n _this.radius = 0.0001;\r\n /**\r\n * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel\r\n * Must not be equal to fallOff and superior to fallOff.\r\n * Default value is 0.0075\r\n */\r\n _this.area = 0.0075;\r\n /**\r\n * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel\r\n * Must not be equal to area and inferior to area.\r\n * Default value is 0.000001\r\n */\r\n _this.fallOff = 0.000001;\r\n /**\r\n * The base color of the SSAO post-process\r\n * The final result is \"base + ssao\" between [0, 1]\r\n */\r\n _this.base = 0.5;\r\n _this._firstUpdate = true;\r\n _this._scene = scene;\r\n // Set up assets\r\n _this._createRandomTexture();\r\n _this._depthTexture = scene.enableDepthRenderer().getDepthMap(); // Force depth renderer \"on\"\r\n var ssaoRatio = ratio.ssaoRatio || ratio;\r\n var combineRatio = ratio.combineRatio || ratio;\r\n _this._originalColorPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"PassPostProcess\"](\"SSAOOriginalSceneColor\", combineRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false);\r\n _this._createSSAOPostProcess(ssaoRatio);\r\n _this._createBlurPostProcess(ssaoRatio);\r\n _this._createSSAOCombinePostProcess(combineRatio);\r\n // Set up pipeline\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOOriginalSceneColorEffect, function () { return _this._originalColorPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAORenderEffect, function () { return _this._ssaoPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurHRenderEffect, function () { return _this._blurHPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurVRenderEffect, function () { return _this._blurVPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOCombineRenderEffect, function () { return _this._ssaoCombinePostProcess; }, true));\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n if (cameras) {\r\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(SSAORenderingPipeline.prototype, \"scene\", {\r\n /**\r\n * Gets active scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Public Methods\r\n /**\r\n * Get the class name\r\n * @returns \"SSAORenderingPipeline\"\r\n */\r\n SSAORenderingPipeline.prototype.getClassName = function () {\r\n return \"SSAORenderingPipeline\";\r\n };\r\n /**\r\n * Removes the internal pipeline assets and detatches the pipeline from the scene cameras\r\n */\r\n SSAORenderingPipeline.prototype.dispose = function (disableDepthRender) {\r\n if (disableDepthRender === void 0) { disableDepthRender = false; }\r\n for (var i = 0; i < this._scene.cameras.length; i++) {\r\n var camera = this._scene.cameras[i];\r\n this._originalColorPostProcess.dispose(camera);\r\n this._ssaoPostProcess.dispose(camera);\r\n this._blurHPostProcess.dispose(camera);\r\n this._blurVPostProcess.dispose(camera);\r\n this._ssaoCombinePostProcess.dispose(camera);\r\n }\r\n this._randomTexture.dispose();\r\n if (disableDepthRender) {\r\n this._scene.disableDepthRenderer();\r\n }\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\r\n _super.prototype.dispose.call(this);\r\n };\r\n // Private Methods\r\n SSAORenderingPipeline.prototype._createBlurPostProcess = function (ratio) {\r\n var _this = this;\r\n var size = 16;\r\n this._blurHPostProcess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"BlurPostProcess\"](\"BlurH\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1, 0), size, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._blurVPostProcess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"BlurPostProcess\"](\"BlurV\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1), size, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._blurHPostProcess.onActivateObservable.add(function () {\r\n var dw = _this._blurHPostProcess.width / _this._scene.getEngine().getRenderWidth();\r\n _this._blurHPostProcess.kernel = size * dw;\r\n });\r\n this._blurVPostProcess.onActivateObservable.add(function () {\r\n var dw = _this._blurVPostProcess.height / _this._scene.getEngine().getRenderHeight();\r\n _this._blurVPostProcess.kernel = size * dw;\r\n });\r\n };\r\n /** @hidden */\r\n SSAORenderingPipeline.prototype._rebuild = function () {\r\n this._firstUpdate = true;\r\n _super.prototype._rebuild.call(this);\r\n };\r\n SSAORenderingPipeline.prototype._createSSAOPostProcess = function (ratio) {\r\n var _this = this;\r\n var numSamples = 16;\r\n var sampleSphere = [\r\n 0.5381, 0.1856, -0.4319,\r\n 0.1379, 0.2486, 0.4430,\r\n 0.3371, 0.5679, -0.0057,\r\n -0.6999, -0.0451, -0.0019,\r\n 0.0689, -0.1598, -0.8547,\r\n 0.0560, 0.0069, -0.1843,\r\n -0.0146, 0.1402, 0.0762,\r\n 0.0100, -0.1924, -0.0344,\r\n -0.3577, -0.5301, -0.4358,\r\n -0.3169, 0.1063, 0.0158,\r\n 0.0103, -0.5869, 0.0046,\r\n -0.0897, -0.4940, 0.3287,\r\n 0.7119, -0.0154, -0.0918,\r\n -0.0533, 0.0596, -0.5411,\r\n 0.0352, -0.0631, 0.5460,\r\n -0.4776, 0.2847, -0.0271\r\n ];\r\n var samplesFactor = 1.0 / numSamples;\r\n this._ssaoPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_4__[\"PostProcess\"](\"ssao\", \"ssao\", [\r\n \"sampleSphere\", \"samplesFactor\", \"randTextureTiles\", \"totalStrength\", \"radius\",\r\n \"area\", \"fallOff\", \"base\", \"range\", \"viewport\"\r\n ], [\"randomSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define SAMPLES \" + numSamples + \"\\n#define SSAO\");\r\n this._ssaoPostProcess.onApply = function (effect) {\r\n if (_this._firstUpdate) {\r\n effect.setArray3(\"sampleSphere\", sampleSphere);\r\n effect.setFloat(\"samplesFactor\", samplesFactor);\r\n effect.setFloat(\"randTextureTiles\", 4.0);\r\n }\r\n effect.setFloat(\"totalStrength\", _this.totalStrength);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setFloat(\"area\", _this.area);\r\n effect.setFloat(\"fallOff\", _this.fallOff);\r\n effect.setFloat(\"base\", _this.base);\r\n effect.setTexture(\"textureSampler\", _this._depthTexture);\r\n effect.setTexture(\"randomSampler\", _this._randomTexture);\r\n };\r\n };\r\n SSAORenderingPipeline.prototype._createSSAOCombinePostProcess = function (ratio) {\r\n var _this = this;\r\n this._ssaoCombinePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_4__[\"PostProcess\"](\"ssaoCombine\", \"ssaoCombine\", [], [\"originalColor\", \"viewport\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._ssaoCombinePostProcess.onApply = function (effect) {\r\n effect.setVector4(\"viewport\", _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector4[0].copyFromFloats(0, 0, 1.0, 1.0));\r\n effect.setTextureFromPostProcess(\"originalColor\", _this._originalColorPostProcess);\r\n };\r\n };\r\n SSAORenderingPipeline.prototype._createRandomTexture = function () {\r\n var size = 512;\r\n this._randomTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_3__[\"DynamicTexture\"](\"SSAORandomTexture\", size, this._scene, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n this._randomTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].WRAP_ADDRESSMODE;\r\n this._randomTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].WRAP_ADDRESSMODE;\r\n var context = this._randomTexture.getContext();\r\n var rand = function (min, max) {\r\n return Math.random() * (max - min) + min;\r\n };\r\n var randVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n for (var x = 0; x < size; x++) {\r\n for (var y = 0; y < size; y++) {\r\n randVector.x = Math.floor(rand(-1.0, 1.0) * 255);\r\n randVector.y = Math.floor(rand(-1.0, 1.0) * 255);\r\n randVector.z = Math.floor(rand(-1.0, 1.0) * 255);\r\n context.fillStyle = 'rgb(' + randVector.x + ', ' + randVector.y + ', ' + randVector.z + ')';\r\n context.fillRect(x, y, 1, 1);\r\n }\r\n }\r\n this._randomTexture.update(false);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"totalStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"area\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"fallOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"base\", void 0);\r\n return SSAORenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderPipeline\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts\":\n/*!*****************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts ***!\n \\*****************************************************************************/\n/*! exports provided: StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return StandardRenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../PostProcesses/fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../motionBlurPostProcess */ \"./PostProcesses/motionBlurPostProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_standard_fragment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../Shaders/standard.fragment */ \"./Shaders/standard.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Standard rendering pipeline\r\n * Default pipeline should be used going forward but the standard pipeline will be kept for backwards compatibility.\r\n * @see https://doc.babylonjs.com/how_to/using_standard_rendering_pipeline\r\n */\r\nvar StandardRenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StandardRenderingPipeline, _super);\r\n /**\r\n * Default pipeline should be used going forward but the standard pipeline will be kept for backwards compatibility.\r\n * @constructor\r\n * @param name The rendering pipeline name\r\n * @param scene The scene linked to this pipeline\r\n * @param ratio The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)\r\n * @param originalPostProcess the custom original color post-process. Must be \"reusable\". Can be null.\r\n * @param cameras The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function StandardRenderingPipeline(name, scene, ratio, originalPostProcess, cameras) {\r\n if (originalPostProcess === void 0) { originalPostProcess = null; }\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n /**\r\n * Post-process used to down scale an image x4\r\n */\r\n _this.downSampleX4PostProcess = null;\r\n /**\r\n * Post-process used to calculate the illuminated surfaces controlled by a threshold\r\n */\r\n _this.brightPassPostProcess = null;\r\n /**\r\n * Post-process array storing all the horizontal blur post-processes used by the pipeline\r\n */\r\n _this.blurHPostProcesses = [];\r\n /**\r\n * Post-process array storing all the vertical blur post-processes used by the pipeline\r\n */\r\n _this.blurVPostProcesses = [];\r\n /**\r\n * Post-process used to add colors of 2 textures (typically brightness + real scene color)\r\n */\r\n _this.textureAdderPostProcess = null;\r\n /**\r\n * Post-process used to create volumetric lighting effect\r\n */\r\n _this.volumetricLightPostProcess = null;\r\n /**\r\n * Post-process used to smooth the previous volumetric light post-process on the X axis\r\n */\r\n _this.volumetricLightSmoothXPostProcess = null;\r\n /**\r\n * Post-process used to smooth the previous volumetric light post-process on the Y axis\r\n */\r\n _this.volumetricLightSmoothYPostProcess = null;\r\n /**\r\n * Post-process used to merge the volumetric light effect and the real scene color\r\n */\r\n _this.volumetricLightMergePostProces = null;\r\n /**\r\n * Post-process used to store the final volumetric light post-process (attach/detach for debug purpose)\r\n */\r\n _this.volumetricLightFinalPostProcess = null;\r\n /**\r\n * Base post-process used to calculate the average luminance of the final image for HDR\r\n */\r\n _this.luminancePostProcess = null;\r\n /**\r\n * Post-processes used to create down sample post-processes in order to get\r\n * the average luminance of the final image for HDR\r\n * Array of length \"StandardRenderingPipeline.LuminanceSteps\"\r\n */\r\n _this.luminanceDownSamplePostProcesses = [];\r\n /**\r\n * Post-process used to create a HDR effect (light adaptation)\r\n */\r\n _this.hdrPostProcess = null;\r\n /**\r\n * Post-process used to store the final texture adder post-process (attach/detach for debug purpose)\r\n */\r\n _this.textureAdderFinalPostProcess = null;\r\n /**\r\n * Post-process used to store the final lens flare post-process (attach/detach for debug purpose)\r\n */\r\n _this.lensFlareFinalPostProcess = null;\r\n /**\r\n * Post-process used to merge the final HDR post-process and the real scene color\r\n */\r\n _this.hdrFinalPostProcess = null;\r\n /**\r\n * Post-process used to create a lens flare effect\r\n */\r\n _this.lensFlarePostProcess = null;\r\n /**\r\n * Post-process that merges the result of the lens flare post-process and the real scene color\r\n */\r\n _this.lensFlareComposePostProcess = null;\r\n /**\r\n * Post-process used to create a motion blur effect\r\n */\r\n _this.motionBlurPostProcess = null;\r\n /**\r\n * Post-process used to create a depth of field effect\r\n */\r\n _this.depthOfFieldPostProcess = null;\r\n /**\r\n * The Fast Approximate Anti-Aliasing post process which attemps to remove aliasing from an image.\r\n */\r\n _this.fxaaPostProcess = null;\r\n // Values\r\n /**\r\n * Represents the brightness threshold in order to configure the illuminated surfaces\r\n */\r\n _this.brightThreshold = 1.0;\r\n /**\r\n * Configures the blur intensity used for surexposed surfaces are highlighted surfaces (light halo)\r\n */\r\n _this.blurWidth = 512.0;\r\n /**\r\n * Sets if the blur for highlighted surfaces must be only horizontal\r\n */\r\n _this.horizontalBlur = false;\r\n /**\r\n * Texture used typically to simulate \"dirty\" on camera lens\r\n */\r\n _this.lensTexture = null;\r\n /**\r\n * Represents the offset coefficient based on Rayleigh principle. Typically in interval [-0.2, 0.2]\r\n */\r\n _this.volumetricLightCoefficient = 0.2;\r\n /**\r\n * The overall power of volumetric lights, typically in interval [0, 10] maximum\r\n */\r\n _this.volumetricLightPower = 4.0;\r\n /**\r\n * Used the set the blur intensity to smooth the volumetric lights\r\n */\r\n _this.volumetricLightBlurScale = 64.0;\r\n /**\r\n * Light (spot or directional) used to generate the volumetric lights rays\r\n * The source light must have a shadow generate so the pipeline can get its\r\n * depth map\r\n */\r\n _this.sourceLight = null;\r\n /**\r\n * For eye adaptation, represents the minimum luminance the eye can see\r\n */\r\n _this.hdrMinimumLuminance = 1.0;\r\n /**\r\n * For eye adaptation, represents the decrease luminance speed\r\n */\r\n _this.hdrDecreaseRate = 0.5;\r\n /**\r\n * For eye adaptation, represents the increase luminance speed\r\n */\r\n _this.hdrIncreaseRate = 0.5;\r\n /**\r\n * Lens color texture used by the lens flare effect. Mandatory if lens flare effect enabled\r\n */\r\n _this.lensColorTexture = null;\r\n /**\r\n * The overall strengh for the lens flare effect\r\n */\r\n _this.lensFlareStrength = 20.0;\r\n /**\r\n * Dispersion coefficient for lens flare ghosts\r\n */\r\n _this.lensFlareGhostDispersal = 1.4;\r\n /**\r\n * Main lens flare halo width\r\n */\r\n _this.lensFlareHaloWidth = 0.7;\r\n /**\r\n * Based on the lens distortion effect, defines how much the lens flare result\r\n * is distorted\r\n */\r\n _this.lensFlareDistortionStrength = 16.0;\r\n /**\r\n * Configures the blur intensity used for for lens flare (halo)\r\n */\r\n _this.lensFlareBlurWidth = 512.0;\r\n /**\r\n * Lens star texture must be used to simulate rays on the flares and is available\r\n * in the documentation\r\n */\r\n _this.lensStarTexture = null;\r\n /**\r\n * As the \"lensTexture\" (can be the same texture or different), it is used to apply the lens\r\n * flare effect by taking account of the dirt texture\r\n */\r\n _this.lensFlareDirtTexture = null;\r\n /**\r\n * Represents the focal length for the depth of field effect\r\n */\r\n _this.depthOfFieldDistance = 10.0;\r\n /**\r\n * Represents the blur intensity for the blurred part of the depth of field effect\r\n */\r\n _this.depthOfFieldBlurWidth = 64.0;\r\n /**\r\n * List of animations for the pipeline (IAnimatable implementation)\r\n */\r\n _this.animations = [];\r\n _this._currentDepthOfFieldSource = null;\r\n _this._fixedExposure = 1.0;\r\n _this._currentExposure = 1.0;\r\n _this._hdrAutoExposure = false;\r\n _this._hdrCurrentLuminance = 1.0;\r\n _this._motionStrength = 1.0;\r\n _this._isObjectBasedMotionBlur = false;\r\n _this._camerasToBeAttached = [];\r\n // Getters and setters\r\n _this._bloomEnabled = false;\r\n _this._depthOfFieldEnabled = false;\r\n _this._vlsEnabled = false;\r\n _this._lensFlareEnabled = false;\r\n _this._hdrEnabled = false;\r\n _this._motionBlurEnabled = false;\r\n _this._fxaaEnabled = false;\r\n _this._motionBlurSamples = 64.0;\r\n _this._volumetricLightStepsCount = 50.0;\r\n _this._samples = 1;\r\n _this._cameras = cameras || scene.cameras;\r\n _this._cameras = _this._cameras.slice();\r\n _this._camerasToBeAttached = _this._cameras.slice();\r\n // Initialize\r\n _this._scene = scene;\r\n _this._basePostProcess = originalPostProcess;\r\n _this._ratio = ratio;\r\n // Misc\r\n _this._floatTextureType = scene.getEngine().getCaps().textureFloatRender ? _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n _this._buildPipeline();\r\n return _this;\r\n }\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"exposure\", {\r\n /**\r\n * Gets the overall exposure used by the pipeline\r\n */\r\n get: function () {\r\n return this._fixedExposure;\r\n },\r\n /**\r\n * Sets the overall exposure used by the pipeline\r\n */\r\n set: function (value) {\r\n this._fixedExposure = value;\r\n this._currentExposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"hdrAutoExposure\", {\r\n /**\r\n * Gets wether or not the exposure of the overall pipeline should be automatically adjusted by the HDR post-process\r\n */\r\n get: function () {\r\n return this._hdrAutoExposure;\r\n },\r\n /**\r\n * Sets wether or not the exposure of the overall pipeline should be automatically adjusted by the HDR post-process\r\n */\r\n set: function (value) {\r\n this._hdrAutoExposure = value;\r\n if (this.hdrPostProcess) {\r\n var defines = [\"#define HDR\"];\r\n if (value) {\r\n defines.push(\"#define AUTO_EXPOSURE\");\r\n }\r\n this.hdrPostProcess.updateEffect(defines.join(\"\\n\"));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"motionStrength\", {\r\n /**\r\n * Gets how much the image is blurred by the movement while using the motion blur post-process\r\n */\r\n get: function () {\r\n return this._motionStrength;\r\n },\r\n /**\r\n * Sets how much the image is blurred by the movement while using the motion blur post-process\r\n */\r\n set: function (strength) {\r\n this._motionStrength = strength;\r\n if (this._isObjectBasedMotionBlur && this.motionBlurPostProcess) {\r\n this.motionBlurPostProcess.motionStrength = strength;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"objectBasedMotionBlur\", {\r\n /**\r\n * Gets wether or not the motion blur post-process is object based or screen based.\r\n */\r\n get: function () {\r\n return this._isObjectBasedMotionBlur;\r\n },\r\n /**\r\n * Sets wether or not the motion blur post-process should be object based or screen based\r\n */\r\n set: function (value) {\r\n var shouldRebuild = this._isObjectBasedMotionBlur !== value;\r\n this._isObjectBasedMotionBlur = value;\r\n if (shouldRebuild) {\r\n this._buildPipeline();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"BloomEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the bloom pipeline is enabled\r\n */\r\n get: function () {\r\n return this._bloomEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._bloomEnabled === enabled) {\r\n return;\r\n }\r\n this._bloomEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"DepthOfFieldEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the depth of field pipeline is enabed\r\n */\r\n get: function () {\r\n return this._depthOfFieldEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._depthOfFieldEnabled === enabled) {\r\n return;\r\n }\r\n this._depthOfFieldEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"LensFlareEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the lens flare pipeline is enabed\r\n */\r\n get: function () {\r\n return this._lensFlareEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._lensFlareEnabled === enabled) {\r\n return;\r\n }\r\n this._lensFlareEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"HDREnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the HDR pipeline is enabled\r\n */\r\n get: function () {\r\n return this._hdrEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._hdrEnabled === enabled) {\r\n return;\r\n }\r\n this._hdrEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"VLSEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the volumetric lights scattering effect is enabled\r\n */\r\n get: function () {\r\n return this._vlsEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._vlsEnabled === enabled) {\r\n return;\r\n }\r\n if (enabled) {\r\n var geometry = this._scene.enableGeometryBufferRenderer();\r\n if (!geometry) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline\");\r\n return;\r\n }\r\n }\r\n this._vlsEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"MotionBlurEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the motion blur effect is enabled\r\n */\r\n get: function () {\r\n return this._motionBlurEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._motionBlurEnabled === enabled) {\r\n return;\r\n }\r\n this._motionBlurEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"fxaaEnabled\", {\r\n /**\r\n * Specifies if anti-aliasing is enabled\r\n */\r\n get: function () {\r\n return this._fxaaEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._fxaaEnabled === enabled) {\r\n return;\r\n }\r\n this._fxaaEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"volumetricLightStepsCount\", {\r\n /**\r\n * Specifies the number of steps used to calculate the volumetric lights\r\n * Typically in interval [50, 200]\r\n */\r\n get: function () {\r\n return this._volumetricLightStepsCount;\r\n },\r\n set: function (count) {\r\n if (this.volumetricLightPostProcess) {\r\n this.volumetricLightPostProcess.updateEffect(\"#define VLS\\n#define NB_STEPS \" + count.toFixed(1));\r\n }\r\n this._volumetricLightStepsCount = count;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"motionBlurSamples\", {\r\n /**\r\n * Specifies the number of samples used for the motion blur effect\r\n * Typically in interval [16, 64]\r\n */\r\n get: function () {\r\n return this._motionBlurSamples;\r\n },\r\n set: function (samples) {\r\n if (this.motionBlurPostProcess) {\r\n if (this._isObjectBasedMotionBlur) {\r\n this.motionBlurPostProcess.motionBlurSamples = samples;\r\n }\r\n else {\r\n this.motionBlurPostProcess.updateEffect(\"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \" + samples.toFixed(1));\r\n }\r\n }\r\n this._motionBlurSamples = samples;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"samples\", {\r\n /**\r\n * Specifies MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (sampleCount) {\r\n if (this._samples === sampleCount) {\r\n return;\r\n }\r\n this._samples = sampleCount;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n StandardRenderingPipeline.prototype._buildPipeline = function () {\r\n var _this = this;\r\n var ratio = this._ratio;\r\n var scene = this._scene;\r\n this._disposePostProcesses();\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n // get back cameras to be used to reattach pipeline\r\n this._cameras = this._camerasToBeAttached.slice();\r\n }\r\n this._reset();\r\n // Create pass post-process\r\n if (!this._basePostProcess) {\r\n this.originalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRPass\", \"standard\", [], [], ratio, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", this._floatTextureType);\r\n this.originalPostProcess.onApply = function () {\r\n _this._currentDepthOfFieldSource = _this.originalPostProcess;\r\n };\r\n }\r\n else {\r\n this.originalPostProcess = this._basePostProcess;\r\n }\r\n if (this._bloomEnabled || this._vlsEnabled || this._lensFlareEnabled || this._depthOfFieldEnabled || this._motionBlurEnabled) {\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRPassPostProcess\", function () { return _this.originalPostProcess; }, true));\r\n }\r\n this._currentDepthOfFieldSource = this.originalPostProcess;\r\n if (this._bloomEnabled) {\r\n // Create down sample X4 post-process\r\n this._createDownSampleX4PostProcess(scene, ratio / 2);\r\n // Create bright pass post-process\r\n this._createBrightPassPostProcess(scene, ratio / 2);\r\n // Create gaussian blur post-processes (down sampling blurs)\r\n this._createBlurPostProcesses(scene, ratio / 4, 1);\r\n // Create texture adder post-process\r\n this._createTextureAdderPostProcess(scene, ratio);\r\n // Create depth-of-field source post-process\r\n this.textureAdderFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRDepthOfFieldSource\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBaseDepthOfFieldSource\", function () { return _this.textureAdderFinalPostProcess; }, true));\r\n }\r\n if (this._vlsEnabled) {\r\n // Create volumetric light\r\n this._createVolumetricLightPostProcess(scene, ratio);\r\n // Create volumetric light final post-process\r\n this.volumetricLightFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRVLSFinal\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRVLSFinal\", function () { return _this.volumetricLightFinalPostProcess; }, true));\r\n }\r\n if (this._lensFlareEnabled) {\r\n // Create lens flare post-process\r\n this._createLensFlarePostProcess(scene, ratio);\r\n // Create depth-of-field source post-process post lens-flare and disable it now\r\n this.lensFlareFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRPostLensFlareDepthOfFieldSource\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRPostLensFlareDepthOfFieldSource\", function () { return _this.lensFlareFinalPostProcess; }, true));\r\n }\r\n if (this._hdrEnabled) {\r\n // Create luminance\r\n this._createLuminancePostProcesses(scene, this._floatTextureType);\r\n // Create HDR\r\n this._createHdrPostProcess(scene, ratio);\r\n // Create depth-of-field source post-process post hdr and disable it now\r\n this.hdrFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRPostHDReDepthOfFieldSource\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRPostHDReDepthOfFieldSource\", function () { return _this.hdrFinalPostProcess; }, true));\r\n }\r\n if (this._depthOfFieldEnabled) {\r\n // Create gaussian blur used by depth-of-field\r\n this._createBlurPostProcesses(scene, ratio / 2, 3, \"depthOfFieldBlurWidth\");\r\n // Create depth-of-field post-process\r\n this._createDepthOfFieldPostProcess(scene, ratio);\r\n }\r\n if (this._motionBlurEnabled) {\r\n // Create motion blur post-process\r\n this._createMotionBlurPostProcess(scene, ratio);\r\n }\r\n if (this._fxaaEnabled) {\r\n // Create fxaa post-process\r\n this.fxaaPostProcess = new _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"FxaaPostProcess\"](\"fxaa\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRFxaa\", function () { return _this.fxaaPostProcess; }, true));\r\n }\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\r\n }\r\n if (!this._enableMSAAOnFirstPostProcess(this._samples) && this._samples > 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\");\r\n }\r\n };\r\n // Down Sample X4 Post-Processs\r\n StandardRenderingPipeline.prototype._createDownSampleX4PostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var downSampleX4Offsets = new Array(32);\r\n this.downSampleX4PostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRDownSampleX4\", \"standard\", [\"dsOffsets\"], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define DOWN_SAMPLE_X4\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.downSampleX4PostProcess.onApply = function (effect) {\r\n var id = 0;\r\n var width = _this.downSampleX4PostProcess.width;\r\n var height = _this.downSampleX4PostProcess.height;\r\n for (var i = -2; i < 2; i++) {\r\n for (var j = -2; j < 2; j++) {\r\n downSampleX4Offsets[id] = (i + 0.5) * (1.0 / width);\r\n downSampleX4Offsets[id + 1] = (j + 0.5) * (1.0 / height);\r\n id += 2;\r\n }\r\n }\r\n effect.setArray2(\"dsOffsets\", downSampleX4Offsets);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRDownSampleX4\", function () { return _this.downSampleX4PostProcess; }, true));\r\n };\r\n // Brightpass Post-Process\r\n StandardRenderingPipeline.prototype._createBrightPassPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var brightOffsets = new Array(8);\r\n this.brightPassPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRBrightPass\", \"standard\", [\"dsOffsets\", \"brightThreshold\"], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define BRIGHT_PASS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.brightPassPostProcess.onApply = function (effect) {\r\n var sU = (1.0 / _this.brightPassPostProcess.width);\r\n var sV = (1.0 / _this.brightPassPostProcess.height);\r\n brightOffsets[0] = -0.5 * sU;\r\n brightOffsets[1] = 0.5 * sV;\r\n brightOffsets[2] = 0.5 * sU;\r\n brightOffsets[3] = 0.5 * sV;\r\n brightOffsets[4] = -0.5 * sU;\r\n brightOffsets[5] = -0.5 * sV;\r\n brightOffsets[6] = 0.5 * sU;\r\n brightOffsets[7] = -0.5 * sV;\r\n effect.setArray2(\"dsOffsets\", brightOffsets);\r\n effect.setFloat(\"brightThreshold\", _this.brightThreshold);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBrightPass\", function () { return _this.brightPassPostProcess; }, true));\r\n };\r\n // Create blur H&V post-processes\r\n StandardRenderingPipeline.prototype._createBlurPostProcesses = function (scene, ratio, indice, blurWidthKey) {\r\n var _this = this;\r\n if (blurWidthKey === void 0) { blurWidthKey = \"blurWidth\"; }\r\n var engine = scene.getEngine();\r\n var blurX = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"BlurPostProcess\"](\"HDRBlurH\" + \"_\" + indice, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1, 0), this[blurWidthKey], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n var blurY = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"BlurPostProcess\"](\"HDRBlurV\" + \"_\" + indice, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 1), this[blurWidthKey], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n blurX.onActivateObservable.add(function () {\r\n var dw = blurX.width / engine.getRenderWidth();\r\n blurX.kernel = _this[blurWidthKey] * dw;\r\n });\r\n blurY.onActivateObservable.add(function () {\r\n var dw = blurY.height / engine.getRenderHeight();\r\n blurY.kernel = _this.horizontalBlur ? 64 * dw : _this[blurWidthKey] * dw;\r\n });\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBlurH\" + indice, function () { return blurX; }, true));\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBlurV\" + indice, function () { return blurY; }, true));\r\n this.blurHPostProcesses.push(blurX);\r\n this.blurVPostProcesses.push(blurY);\r\n };\r\n // Create texture adder post-process\r\n StandardRenderingPipeline.prototype._createTextureAdderPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n this.textureAdderPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRTextureAdder\", \"standard\", [\"exposure\"], [\"otherSampler\", \"lensSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define TEXTURE_ADDER\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.textureAdderPostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"otherSampler\", _this._vlsEnabled ? _this._currentDepthOfFieldSource : _this.originalPostProcess);\r\n effect.setTexture(\"lensSampler\", _this.lensTexture);\r\n effect.setFloat(\"exposure\", _this._currentExposure);\r\n _this._currentDepthOfFieldSource = _this.textureAdderFinalPostProcess;\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRTextureAdder\", function () { return _this.textureAdderPostProcess; }, true));\r\n };\r\n StandardRenderingPipeline.prototype._createVolumetricLightPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var geometryRenderer = scene.enableGeometryBufferRenderer();\r\n geometryRenderer.enablePosition = true;\r\n var geometry = geometryRenderer.getGBuffer();\r\n // Base post-process\r\n this.volumetricLightPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRVLS\", \"standard\", [\"shadowViewProjection\", \"cameraPosition\", \"sunDirection\", \"sunColor\", \"scatteringCoefficient\", \"scatteringPower\", \"depthValues\"], [\"shadowMapSampler\", \"positionSampler\"], ratio / 8, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define VLS\\n#define NB_STEPS \" + this._volumetricLightStepsCount.toFixed(1));\r\n var depthValues = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n this.volumetricLightPostProcess.onApply = function (effect) {\r\n if (_this.sourceLight && _this.sourceLight.getShadowGenerator() && _this._scene.activeCamera) {\r\n var generator = _this.sourceLight.getShadowGenerator();\r\n effect.setTexture(\"shadowMapSampler\", generator.getShadowMap());\r\n effect.setTexture(\"positionSampler\", geometry.textures[2]);\r\n effect.setColor3(\"sunColor\", _this.sourceLight.diffuse);\r\n effect.setVector3(\"sunDirection\", _this.sourceLight.getShadowDirection());\r\n effect.setVector3(\"cameraPosition\", _this._scene.activeCamera.globalPosition);\r\n effect.setMatrix(\"shadowViewProjection\", generator.getTransformMatrix());\r\n effect.setFloat(\"scatteringCoefficient\", _this.volumetricLightCoefficient);\r\n effect.setFloat(\"scatteringPower\", _this.volumetricLightPower);\r\n depthValues.x = _this.sourceLight.getDepthMinZ(_this._scene.activeCamera);\r\n depthValues.y = _this.sourceLight.getDepthMaxZ(_this._scene.activeCamera);\r\n effect.setVector2(\"depthValues\", depthValues);\r\n }\r\n };\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRVLS\", function () { return _this.volumetricLightPostProcess; }, true));\r\n // Smooth\r\n this._createBlurPostProcesses(scene, ratio / 4, 0, \"volumetricLightBlurScale\");\r\n // Merge\r\n this.volumetricLightMergePostProces = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRVLSMerge\", \"standard\", [], [\"originalSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define VLSMERGE\");\r\n this.volumetricLightMergePostProces.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"originalSampler\", _this._bloomEnabled ? _this.textureAdderFinalPostProcess : _this.originalPostProcess);\r\n _this._currentDepthOfFieldSource = _this.volumetricLightFinalPostProcess;\r\n };\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRVLSMerge\", function () { return _this.volumetricLightMergePostProces; }, true));\r\n };\r\n // Create luminance\r\n StandardRenderingPipeline.prototype._createLuminancePostProcesses = function (scene, textureType) {\r\n var _this = this;\r\n // Create luminance\r\n var size = Math.pow(3, StandardRenderingPipeline.LuminanceSteps);\r\n this.luminancePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLuminance\", \"standard\", [\"lumOffsets\"], [], { width: size, height: size }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LUMINANCE\", textureType);\r\n var offsets = [];\r\n this.luminancePostProcess.onApply = function (effect) {\r\n var sU = (1.0 / _this.luminancePostProcess.width);\r\n var sV = (1.0 / _this.luminancePostProcess.height);\r\n offsets[0] = -0.5 * sU;\r\n offsets[1] = 0.5 * sV;\r\n offsets[2] = 0.5 * sU;\r\n offsets[3] = 0.5 * sV;\r\n offsets[4] = -0.5 * sU;\r\n offsets[5] = -0.5 * sV;\r\n offsets[6] = 0.5 * sU;\r\n offsets[7] = -0.5 * sV;\r\n effect.setArray2(\"lumOffsets\", offsets);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLuminance\", function () { return _this.luminancePostProcess; }, true));\r\n // Create down sample luminance\r\n for (var i = StandardRenderingPipeline.LuminanceSteps - 1; i >= 0; i--) {\r\n var size = Math.pow(3, i);\r\n var defines = \"#define LUMINANCE_DOWN_SAMPLE\\n\";\r\n if (i === 0) {\r\n defines += \"#define FINAL_DOWN_SAMPLER\";\r\n }\r\n var postProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLuminanceDownSample\" + i, \"standard\", [\"dsOffsets\", \"halfDestPixelSize\"], [], { width: size, height: size }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, defines, textureType);\r\n this.luminanceDownSamplePostProcesses.push(postProcess);\r\n }\r\n // Create callbacks and add effects\r\n var lastLuminance = this.luminancePostProcess;\r\n this.luminanceDownSamplePostProcesses.forEach(function (pp, index) {\r\n var downSampleOffsets = new Array(18);\r\n pp.onApply = function (effect) {\r\n if (!lastLuminance) {\r\n return;\r\n }\r\n var id = 0;\r\n for (var x = -1; x < 2; x++) {\r\n for (var y = -1; y < 2; y++) {\r\n downSampleOffsets[id] = x / lastLuminance.width;\r\n downSampleOffsets[id + 1] = y / lastLuminance.height;\r\n id += 2;\r\n }\r\n }\r\n effect.setArray2(\"dsOffsets\", downSampleOffsets);\r\n effect.setFloat(\"halfDestPixelSize\", 0.5 / lastLuminance.width);\r\n if (index === _this.luminanceDownSamplePostProcesses.length - 1) {\r\n lastLuminance = _this.luminancePostProcess;\r\n }\r\n else {\r\n lastLuminance = pp;\r\n }\r\n };\r\n if (index === _this.luminanceDownSamplePostProcesses.length - 1) {\r\n pp.onAfterRender = function () {\r\n var pixel = scene.getEngine().readPixels(0, 0, 1, 1);\r\n var bit_shift = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector4\"](1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);\r\n _this._hdrCurrentLuminance = (pixel[0] * bit_shift.x + pixel[1] * bit_shift.y + pixel[2] * bit_shift.z + pixel[3] * bit_shift.w) / 100.0;\r\n };\r\n }\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLuminanceDownSample\" + index, function () { return pp; }, true));\r\n });\r\n };\r\n // Create HDR post-process\r\n StandardRenderingPipeline.prototype._createHdrPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var defines = [\"#define HDR\"];\r\n if (this._hdrAutoExposure) {\r\n defines.push(\"#define AUTO_EXPOSURE\");\r\n }\r\n this.hdrPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDR\", \"standard\", [\"averageLuminance\"], [\"textureAdderSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, defines.join(\"\\n\"), _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n var outputLiminance = 1;\r\n var time = 0;\r\n var lastTime = 0;\r\n this.hdrPostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"textureAdderSampler\", _this._currentDepthOfFieldSource);\r\n time += scene.getEngine().getDeltaTime();\r\n if (outputLiminance < 0) {\r\n outputLiminance = _this._hdrCurrentLuminance;\r\n }\r\n else {\r\n var dt = (lastTime - time) / 1000.0;\r\n if (_this._hdrCurrentLuminance < outputLiminance + _this.hdrDecreaseRate * dt) {\r\n outputLiminance += _this.hdrDecreaseRate * dt;\r\n }\r\n else if (_this._hdrCurrentLuminance > outputLiminance - _this.hdrIncreaseRate * dt) {\r\n outputLiminance -= _this.hdrIncreaseRate * dt;\r\n }\r\n else {\r\n outputLiminance = _this._hdrCurrentLuminance;\r\n }\r\n }\r\n if (_this.hdrAutoExposure) {\r\n _this._currentExposure = _this._fixedExposure / outputLiminance;\r\n }\r\n else {\r\n outputLiminance = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Clamp(outputLiminance, _this.hdrMinimumLuminance, 1e20);\r\n effect.setFloat(\"averageLuminance\", outputLiminance);\r\n }\r\n lastTime = time;\r\n _this._currentDepthOfFieldSource = _this.hdrFinalPostProcess;\r\n };\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDR\", function () { return _this.hdrPostProcess; }, true));\r\n };\r\n // Create lens flare post-process\r\n StandardRenderingPipeline.prototype._createLensFlarePostProcess = function (scene, ratio) {\r\n var _this = this;\r\n this.lensFlarePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLensFlare\", \"standard\", [\"strength\", \"ghostDispersal\", \"haloWidth\", \"resolution\", \"distortionStrength\"], [\"lensColorSampler\"], ratio / 2, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LENS_FLARE\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLensFlare\", function () { return _this.lensFlarePostProcess; }, true));\r\n this._createBlurPostProcesses(scene, ratio / 4, 2, \"lensFlareBlurWidth\");\r\n this.lensFlareComposePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLensFlareCompose\", \"standard\", [\"lensStarMatrix\"], [\"otherSampler\", \"lensDirtSampler\", \"lensStarSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LENS_FLARE_COMPOSE\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLensFlareCompose\", function () { return _this.lensFlareComposePostProcess; }, true));\r\n var resolution = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 0);\r\n // Lens flare\r\n this.lensFlarePostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._bloomEnabled ? _this.blurHPostProcesses[0] : _this.originalPostProcess);\r\n effect.setTexture(\"lensColorSampler\", _this.lensColorTexture);\r\n effect.setFloat(\"strength\", _this.lensFlareStrength);\r\n effect.setFloat(\"ghostDispersal\", _this.lensFlareGhostDispersal);\r\n effect.setFloat(\"haloWidth\", _this.lensFlareHaloWidth);\r\n // Shift\r\n resolution.x = _this.lensFlarePostProcess.width;\r\n resolution.y = _this.lensFlarePostProcess.height;\r\n effect.setVector2(\"resolution\", resolution);\r\n effect.setFloat(\"distortionStrength\", _this.lensFlareDistortionStrength);\r\n };\r\n // Compose\r\n var scaleBias1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValues(2.0, 0.0, -1.0, 0.0, 0.0, 2.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n var scaleBias2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValues(0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n this.lensFlareComposePostProcess.onApply = function (effect) {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setTextureFromPostProcess(\"otherSampler\", _this._currentDepthOfFieldSource);\r\n effect.setTexture(\"lensDirtSampler\", _this.lensFlareDirtTexture);\r\n effect.setTexture(\"lensStarSampler\", _this.lensStarTexture);\r\n // Lens start rotation matrix\r\n var camerax = _this._scene.activeCamera.getViewMatrix().getRow(0);\r\n var cameraz = _this._scene.activeCamera.getViewMatrix().getRow(2);\r\n var camRot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(camerax.toVector3(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1.0, 0.0, 0.0)) + _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(cameraz.toVector3(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0.0, 0.0, 1.0));\r\n camRot *= 4.0;\r\n var starRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValues(Math.cos(camRot) * 0.5, -Math.sin(camRot), 0.0, 0.0, Math.sin(camRot), Math.cos(camRot) * 0.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n var lensStarMatrix = scaleBias2.multiply(starRotation).multiply(scaleBias1);\r\n effect.setMatrix(\"lensStarMatrix\", lensStarMatrix);\r\n _this._currentDepthOfFieldSource = _this.lensFlareFinalPostProcess;\r\n };\r\n };\r\n // Create depth-of-field post-process\r\n StandardRenderingPipeline.prototype._createDepthOfFieldPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n this.depthOfFieldPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRDepthOfField\", \"standard\", [\"distance\"], [\"otherSampler\", \"depthSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define DEPTH_OF_FIELD\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.depthOfFieldPostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"otherSampler\", _this._currentDepthOfFieldSource);\r\n effect.setTexture(\"depthSampler\", _this._getDepthTexture());\r\n effect.setFloat(\"distance\", _this.depthOfFieldDistance);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRDepthOfField\", function () { return _this.depthOfFieldPostProcess; }, true));\r\n };\r\n // Create motion blur post-process\r\n StandardRenderingPipeline.prototype._createMotionBlurPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n if (this._isObjectBasedMotionBlur) {\r\n var mb = new _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_13__[\"MotionBlurPostProcess\"](\"HDRMotionBlur\", scene, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n mb.motionStrength = this.motionStrength;\r\n mb.motionBlurSamples = this.motionBlurSamples;\r\n this.motionBlurPostProcess = mb;\r\n }\r\n else {\r\n this.motionBlurPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRMotionBlur\", \"standard\", [\"inverseViewProjection\", \"prevViewProjection\", \"screenSize\", \"motionScale\", \"motionStrength\"], [\"depthSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \" + this.motionBlurSamples.toFixed(1), _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n var motionScale = 0;\r\n var prevViewProjection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n var invViewProjection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n var viewProjection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n var screenSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n this.motionBlurPostProcess.onApply = function (effect) {\r\n viewProjection = scene.getProjectionMatrix().multiply(scene.getViewMatrix());\r\n viewProjection.invertToRef(invViewProjection);\r\n effect.setMatrix(\"inverseViewProjection\", invViewProjection);\r\n effect.setMatrix(\"prevViewProjection\", prevViewProjection);\r\n prevViewProjection = viewProjection;\r\n screenSize.x = _this.motionBlurPostProcess.width;\r\n screenSize.y = _this.motionBlurPostProcess.height;\r\n effect.setVector2(\"screenSize\", screenSize);\r\n motionScale = scene.getEngine().getFps() / 60.0;\r\n effect.setFloat(\"motionScale\", motionScale);\r\n effect.setFloat(\"motionStrength\", _this.motionStrength);\r\n effect.setTexture(\"depthSampler\", _this._getDepthTexture());\r\n };\r\n }\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRMotionBlur\", function () { return _this.motionBlurPostProcess; }, true));\r\n };\r\n StandardRenderingPipeline.prototype._getDepthTexture = function () {\r\n if (this._scene.getEngine().getCaps().drawBuffersExtension) {\r\n var renderer = this._scene.enableGeometryBufferRenderer();\r\n return renderer.getGBuffer().textures[0];\r\n }\r\n return this._scene.enableDepthRenderer().getDepthMap();\r\n };\r\n StandardRenderingPipeline.prototype._disposePostProcesses = function () {\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n var camera = this._cameras[i];\r\n if (this.originalPostProcess) {\r\n this.originalPostProcess.dispose(camera);\r\n }\r\n if (this.downSampleX4PostProcess) {\r\n this.downSampleX4PostProcess.dispose(camera);\r\n }\r\n if (this.brightPassPostProcess) {\r\n this.brightPassPostProcess.dispose(camera);\r\n }\r\n if (this.textureAdderPostProcess) {\r\n this.textureAdderPostProcess.dispose(camera);\r\n }\r\n if (this.textureAdderFinalPostProcess) {\r\n this.textureAdderFinalPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightPostProcess) {\r\n this.volumetricLightPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightSmoothXPostProcess) {\r\n this.volumetricLightSmoothXPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightSmoothYPostProcess) {\r\n this.volumetricLightSmoothYPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightMergePostProces) {\r\n this.volumetricLightMergePostProces.dispose(camera);\r\n }\r\n if (this.volumetricLightFinalPostProcess) {\r\n this.volumetricLightFinalPostProcess.dispose(camera);\r\n }\r\n if (this.lensFlarePostProcess) {\r\n this.lensFlarePostProcess.dispose(camera);\r\n }\r\n if (this.lensFlareComposePostProcess) {\r\n this.lensFlareComposePostProcess.dispose(camera);\r\n }\r\n for (var j = 0; j < this.luminanceDownSamplePostProcesses.length; j++) {\r\n this.luminanceDownSamplePostProcesses[j].dispose(camera);\r\n }\r\n if (this.luminancePostProcess) {\r\n this.luminancePostProcess.dispose(camera);\r\n }\r\n if (this.hdrPostProcess) {\r\n this.hdrPostProcess.dispose(camera);\r\n }\r\n if (this.hdrFinalPostProcess) {\r\n this.hdrFinalPostProcess.dispose(camera);\r\n }\r\n if (this.depthOfFieldPostProcess) {\r\n this.depthOfFieldPostProcess.dispose(camera);\r\n }\r\n if (this.motionBlurPostProcess) {\r\n this.motionBlurPostProcess.dispose(camera);\r\n }\r\n if (this.fxaaPostProcess) {\r\n this.fxaaPostProcess.dispose(camera);\r\n }\r\n for (var j = 0; j < this.blurHPostProcesses.length; j++) {\r\n this.blurHPostProcesses[j].dispose(camera);\r\n }\r\n for (var j = 0; j < this.blurVPostProcesses.length; j++) {\r\n this.blurVPostProcesses[j].dispose(camera);\r\n }\r\n }\r\n this.originalPostProcess = null;\r\n this.downSampleX4PostProcess = null;\r\n this.brightPassPostProcess = null;\r\n this.textureAdderPostProcess = null;\r\n this.textureAdderFinalPostProcess = null;\r\n this.volumetricLightPostProcess = null;\r\n this.volumetricLightSmoothXPostProcess = null;\r\n this.volumetricLightSmoothYPostProcess = null;\r\n this.volumetricLightMergePostProces = null;\r\n this.volumetricLightFinalPostProcess = null;\r\n this.lensFlarePostProcess = null;\r\n this.lensFlareComposePostProcess = null;\r\n this.luminancePostProcess = null;\r\n this.hdrPostProcess = null;\r\n this.hdrFinalPostProcess = null;\r\n this.depthOfFieldPostProcess = null;\r\n this.motionBlurPostProcess = null;\r\n this.fxaaPostProcess = null;\r\n this.luminanceDownSamplePostProcesses = [];\r\n this.blurHPostProcesses = [];\r\n this.blurVPostProcesses = [];\r\n };\r\n /**\r\n * Dispose of the pipeline and stop all post processes\r\n */\r\n StandardRenderingPipeline.prototype.dispose = function () {\r\n this._disposePostProcesses();\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Serialize the rendering pipeline (Used when exporting)\r\n * @returns the serialized object\r\n */\r\n StandardRenderingPipeline.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n if (this.sourceLight) {\r\n serializationObject.sourceLightId = this.sourceLight.id;\r\n }\r\n serializationObject.customType = \"StandardRenderingPipeline\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the serialized pipeline\r\n * @param source Source pipeline.\r\n * @param scene The scene to load the pipeline to.\r\n * @param rootUrl The URL of the serialized pipeline.\r\n * @returns An instantiated pipeline from the serialized object.\r\n */\r\n StandardRenderingPipeline.Parse = function (source, scene, rootUrl) {\r\n var p = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new StandardRenderingPipeline(source._name, scene, source._ratio); }, source, scene, rootUrl);\r\n if (source.sourceLightId) {\r\n p.sourceLight = scene.getLightByID(source.sourceLightId);\r\n }\r\n return p;\r\n };\r\n /**\r\n * Luminance steps\r\n */\r\n StandardRenderingPipeline.LuminanceSteps = 6;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"brightThreshold\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"blurWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"horizontalBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"exposure\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightCoefficient\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightPower\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightBlurScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrMinimumLuminance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrDecreaseRate\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrIncreaseRate\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrAutoExposure\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensColorTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensColorTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareGhostDispersal\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareHaloWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareDistortionStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareBlurWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensStarTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensStarTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensFlareDirtTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensFlareDirtTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"depthOfFieldDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"depthOfFieldBlurWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"motionStrength\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"objectBasedMotionBlur\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"_ratio\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"BloomEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"DepthOfFieldEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"LensFlareEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"HDREnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"VLSEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"MotionBlurEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"fxaaEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightStepsCount\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"motionBlurSamples\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"samples\", null);\r\n return StandardRenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__[\"PostProcessRenderPipeline\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_12__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StandardRenderingPipeline\"] = StandardRenderingPipeline;\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/index.ts\":\n/*!***********************************************!*\\\n !*** ./PostProcesses/RenderPipeline/index.ts ***!\n \\***********************************************/\n/*! exports provided: PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Pipelines/index */ \"./PostProcesses/RenderPipeline/Pipelines/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"StandardRenderingPipeline\"]; });\n\n/* harmony import */ var _postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__[\"PostProcessRenderEffect\"]; });\n\n/* harmony import */ var _postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_2__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony import */ var _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcessRenderPipelineManager */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_3__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony import */ var _postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\":\n/*!*****************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderEffect.ts ***!\n \\*****************************************************************/\n/*! exports provided: PostProcessRenderEffect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return PostProcessRenderEffect; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n\r\n/**\r\n * This represents a set of one or more post processes in Babylon.\r\n * A post process can be used to apply a shader to a texture after it is rendered.\r\n * @example https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\nvar PostProcessRenderEffect = /** @class */ (function () {\r\n /**\r\n * Instantiates a post process render effect.\r\n * A post process can be used to apply a shader to a texture after it is rendered.\r\n * @param engine The engine the effect is tied to\r\n * @param name The name of the effect\r\n * @param getPostProcesses A function that returns a set of post processes which the effect will run in order to be run.\r\n * @param singleInstance False if this post process can be run on multiple cameras. (default: true)\r\n */\r\n function PostProcessRenderEffect(engine, name, getPostProcesses, singleInstance) {\r\n this._name = name;\r\n this._singleInstance = singleInstance || true;\r\n this._getPostProcesses = getPostProcesses;\r\n this._cameras = {};\r\n this._indicesForCamera = {};\r\n this._postProcesses = {};\r\n }\r\n Object.defineProperty(PostProcessRenderEffect.prototype, \"isSupported\", {\r\n /**\r\n * Checks if all the post processes in the effect are supported.\r\n */\r\n get: function () {\r\n for (var index in this._postProcesses) {\r\n if (this._postProcesses.hasOwnProperty(index)) {\r\n var pps = this._postProcesses[index];\r\n for (var ppIndex = 0; ppIndex < pps.length; ppIndex++) {\r\n if (!pps[ppIndex].isSupported) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the current state of the effect\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._update = function () {\r\n };\r\n /**\r\n * Attaches the effect on cameras\r\n * @param cameras The camera to attach to.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._attachCameras = function (cameras) {\r\n var _this = this;\r\n var cameraKey;\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n if (this._singleInstance) {\r\n cameraKey = 0;\r\n }\r\n else {\r\n cameraKey = cameraName;\r\n }\r\n if (!this._postProcesses[cameraKey]) {\r\n var postProcess = this._getPostProcesses();\r\n if (postProcess) {\r\n this._postProcesses[cameraKey] = Array.isArray(postProcess) ? postProcess : [postProcess];\r\n }\r\n }\r\n if (!this._indicesForCamera[cameraName]) {\r\n this._indicesForCamera[cameraName] = [];\r\n }\r\n this._postProcesses[cameraKey].forEach(function (postProcess) {\r\n var index = camera.attachPostProcess(postProcess);\r\n _this._indicesForCamera[cameraName].push(index);\r\n });\r\n if (!this._cameras[cameraName]) {\r\n this._cameras[cameraName] = camera;\r\n }\r\n }\r\n };\r\n /**\r\n * Detatches the effect on cameras\r\n * @param cameras The camera to detatch from.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._detachCameras = function (cameras) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n var postProcesses = this._postProcesses[this._singleInstance ? 0 : cameraName];\r\n if (postProcesses) {\r\n postProcesses.forEach(function (postProcess) {\r\n camera.detachPostProcess(postProcess);\r\n });\r\n }\r\n if (this._cameras[cameraName]) {\r\n this._cameras[cameraName] = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Enables the effect on given cameras\r\n * @param cameras The camera to enable.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._enable = function (cameras) {\r\n var _this = this;\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n for (var j = 0; j < this._indicesForCamera[cameraName].length; j++) {\r\n if (camera._postProcesses[this._indicesForCamera[cameraName][j]] === undefined || camera._postProcesses[this._indicesForCamera[cameraName][j]] === null) {\r\n this._postProcesses[this._singleInstance ? 0 : cameraName].forEach(function (postProcess) {\r\n cams[i].attachPostProcess(postProcess, _this._indicesForCamera[cameraName][j]);\r\n });\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Disables the effect on the given cameras\r\n * @param cameras The camera to disable.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._disable = function (cameras) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n this._postProcesses[this._singleInstance ? 0 : cameraName].forEach(function (postProcess) {\r\n camera.detachPostProcess(postProcess);\r\n });\r\n }\r\n };\r\n /**\r\n * Gets a list of the post processes contained in the effect.\r\n * @param camera The camera to get the post processes on.\r\n * @returns The list of the post processes in the effect.\r\n */\r\n PostProcessRenderEffect.prototype.getPostProcesses = function (camera) {\r\n if (this._singleInstance) {\r\n return this._postProcesses[0];\r\n }\r\n else {\r\n if (!camera) {\r\n return null;\r\n }\r\n return this._postProcesses[camera.name];\r\n }\r\n };\r\n return PostProcessRenderEffect;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\":\n/*!*******************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts ***!\n \\*******************************************************************/\n/*! exports provided: PostProcessRenderPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return PostProcessRenderPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n\r\n\r\n\r\n/**\r\n * PostProcessRenderPipeline\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\nvar PostProcessRenderPipeline = /** @class */ (function () {\r\n /**\r\n * Initializes a PostProcessRenderPipeline\r\n * @param engine engine to add the pipeline to\r\n * @param name name of the pipeline\r\n */\r\n function PostProcessRenderPipeline(engine, name) {\r\n this.engine = engine;\r\n this._name = name;\r\n this._renderEffects = {};\r\n this._renderEffectsForIsolatedPass = new Array();\r\n this._cameras = [];\r\n }\r\n Object.defineProperty(PostProcessRenderPipeline.prototype, \"name\", {\r\n /**\r\n * Gets pipeline name\r\n */\r\n get: function () {\r\n return this._name;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the class name\r\n * @returns \"PostProcessRenderPipeline\"\r\n */\r\n PostProcessRenderPipeline.prototype.getClassName = function () {\r\n return \"PostProcessRenderPipeline\";\r\n };\r\n Object.defineProperty(PostProcessRenderPipeline.prototype, \"isSupported\", {\r\n /**\r\n * If all the render effects in the pipeline are supported\r\n */\r\n get: function () {\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n if (!this._renderEffects[renderEffectName].isSupported) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds an effect to the pipeline\r\n * @param renderEffect the effect to add\r\n */\r\n PostProcessRenderPipeline.prototype.addEffect = function (renderEffect) {\r\n this._renderEffects[renderEffect._name] = renderEffect;\r\n };\r\n // private\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._rebuild = function () {\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._enableEffect = function (renderEffectName, cameras) {\r\n var renderEffects = this._renderEffects[renderEffectName];\r\n if (!renderEffects) {\r\n return;\r\n }\r\n renderEffects._enable(_Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras));\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._disableEffect = function (renderEffectName, cameras) {\r\n var renderEffects = this._renderEffects[renderEffectName];\r\n if (!renderEffects) {\r\n return;\r\n }\r\n renderEffects._disable(_Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras));\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._attachCameras = function (cameras, unique) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n var indicesToDelete = [];\r\n var i;\r\n for (i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n if (this._cameras.indexOf(camera) === -1) {\r\n this._cameras[cameraName] = camera;\r\n }\r\n else if (unique) {\r\n indicesToDelete.push(i);\r\n }\r\n }\r\n for (i = 0; i < indicesToDelete.length; i++) {\r\n cameras.splice(indicesToDelete[i], 1);\r\n }\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n this._renderEffects[renderEffectName]._attachCameras(cams);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._detachCameras = function (cameras) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n this._renderEffects[renderEffectName]._detachCameras(cams);\r\n }\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n this._cameras.splice(this._cameras.indexOf(cams[i]), 1);\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._update = function () {\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n this._renderEffects[renderEffectName]._update();\r\n }\r\n }\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n var cameraName = this._cameras[i].name;\r\n if (this._renderEffectsForIsolatedPass[cameraName]) {\r\n this._renderEffectsForIsolatedPass[cameraName]._update();\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._reset = function () {\r\n this._renderEffects = {};\r\n this._renderEffectsForIsolatedPass = new Array();\r\n };\r\n PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function (sampleCount) {\r\n if (this.engine.webGLVersion === 1) {\r\n return false;\r\n }\r\n // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)\r\n var effectKeys = Object.keys(this._renderEffects);\r\n if (effectKeys.length > 0) {\r\n var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();\r\n if (postProcesses) {\r\n postProcesses[0].samples = sampleCount;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Disposes of the pipeline\r\n */\r\n PostProcessRenderPipeline.prototype.dispose = function () {\r\n // Must be implemented by children\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], PostProcessRenderPipeline.prototype, \"_name\", void 0);\r\n return PostProcessRenderPipeline;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts\":\n/*!**************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts ***!\n \\**************************************************************************/\n/*! exports provided: PostProcessRenderPipelineManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return PostProcessRenderPipelineManager; });\n/**\r\n * PostProcessRenderPipelineManager class\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\nvar PostProcessRenderPipelineManager = /** @class */ (function () {\r\n /**\r\n * Initializes a PostProcessRenderPipelineManager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\n function PostProcessRenderPipelineManager() {\r\n this._renderPipelines = {};\r\n }\r\n Object.defineProperty(PostProcessRenderPipelineManager.prototype, \"supportedPipelines\", {\r\n /**\r\n * Gets the list of supported render pipelines\r\n */\r\n get: function () {\r\n var result = [];\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n if (pipeline.isSupported) {\r\n result.push(pipeline);\r\n }\r\n }\r\n }\r\n return result;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a pipeline to the manager\r\n * @param renderPipeline The pipeline to add\r\n */\r\n PostProcessRenderPipelineManager.prototype.addPipeline = function (renderPipeline) {\r\n this._renderPipelines[renderPipeline._name] = renderPipeline;\r\n };\r\n /**\r\n * Attaches a camera to the pipeline\r\n * @param renderPipelineName The name of the pipeline to attach to\r\n * @param cameras the camera to attach\r\n * @param unique if the camera can be attached multiple times to the pipeline\r\n */\r\n PostProcessRenderPipelineManager.prototype.attachCamerasToRenderPipeline = function (renderPipelineName, cameras, unique) {\r\n if (unique === void 0) { unique = false; }\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._attachCameras(cameras, unique);\r\n };\r\n /**\r\n * Detaches a camera from the pipeline\r\n * @param renderPipelineName The name of the pipeline to detach from\r\n * @param cameras the camera to detach\r\n */\r\n PostProcessRenderPipelineManager.prototype.detachCamerasFromRenderPipeline = function (renderPipelineName, cameras) {\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._detachCameras(cameras);\r\n };\r\n /**\r\n * Enables an effect by name on a pipeline\r\n * @param renderPipelineName the name of the pipeline to enable the effect in\r\n * @param renderEffectName the name of the effect to enable\r\n * @param cameras the cameras that the effect should be enabled on\r\n */\r\n PostProcessRenderPipelineManager.prototype.enableEffectInPipeline = function (renderPipelineName, renderEffectName, cameras) {\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._enableEffect(renderEffectName, cameras);\r\n };\r\n /**\r\n * Disables an effect by name on a pipeline\r\n * @param renderPipelineName the name of the pipeline to disable the effect in\r\n * @param renderEffectName the name of the effect to disable\r\n * @param cameras the cameras that the effect should be disabled on\r\n */\r\n PostProcessRenderPipelineManager.prototype.disableEffectInPipeline = function (renderPipelineName, renderEffectName, cameras) {\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._disableEffect(renderEffectName, cameras);\r\n };\r\n /**\r\n * Updates the state of all contained render pipelines and disposes of any non supported pipelines\r\n */\r\n PostProcessRenderPipelineManager.prototype.update = function () {\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n if (!pipeline.isSupported) {\r\n pipeline.dispose();\r\n delete this._renderPipelines[renderPipelineName];\r\n }\r\n else {\r\n pipeline._update();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipelineManager.prototype._rebuild = function () {\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n pipeline._rebuild();\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes of the manager and pipelines\r\n */\r\n PostProcessRenderPipelineManager.prototype.dispose = function () {\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n pipeline.dispose();\r\n }\r\n }\r\n };\r\n return PostProcessRenderPipelineManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\":\n/*!****************************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts ***!\n \\****************************************************************************************/\n/*! exports provided: PostProcessRenderPipelineManagerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return PostProcessRenderPipelineManagerSceneComponent; });\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcessRenderPipelineManager */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype, \"postProcessRenderPipelineManager\", {\r\n get: function () {\r\n if (!this._postProcessRenderPipelineManager) {\r\n // Register the G Buffer component to the scene.\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].NAME_POSTPROCESSRENDERPIPELINEMANAGER);\r\n if (!component) {\r\n component = new PostProcessRenderPipelineManagerSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n this._postProcessRenderPipelineManager = new _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_1__[\"PostProcessRenderPipelineManager\"]();\r\n }\r\n return this._postProcessRenderPipelineManager;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Defines the Render Pipeline scene component responsible to rendering pipelines\r\n */\r\nvar PostProcessRenderPipelineManagerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function PostProcessRenderPipelineManagerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].NAME_POSTPROCESSRENDERPIPELINEMANAGER;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n PostProcessRenderPipelineManagerSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER, this, this._gatherRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n PostProcessRenderPipelineManagerSceneComponent.prototype.rebuild = function () {\r\n if (this.scene._postProcessRenderPipelineManager) {\r\n this.scene._postProcessRenderPipelineManager._rebuild();\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n PostProcessRenderPipelineManagerSceneComponent.prototype.dispose = function () {\r\n if (this.scene._postProcessRenderPipelineManager) {\r\n this.scene._postProcessRenderPipelineManager.dispose();\r\n }\r\n };\r\n PostProcessRenderPipelineManagerSceneComponent.prototype._gatherRenderTargets = function () {\r\n if (this.scene._postProcessRenderPipelineManager) {\r\n this.scene._postProcessRenderPipelineManager.update();\r\n }\r\n };\r\n return PostProcessRenderPipelineManagerSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/anaglyphPostProcess.ts\":\n/*!**********************************************!*\\\n !*** ./PostProcesses/anaglyphPostProcess.ts ***!\n \\**********************************************/\n/*! exports provided: AnaglyphPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return AnaglyphPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_anaglyph_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/anaglyph.fragment */ \"./Shaders/anaglyph.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Postprocess used to generate anaglyphic rendering\r\n */\r\nvar AnaglyphPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphPostProcess, _super);\r\n /**\r\n * Creates a new AnaglyphPostProcess\r\n * @param name defines postprocess name\r\n * @param options defines creation options or target ratio scale\r\n * @param rigCameras defines cameras using this postprocess\r\n * @param samplingMode defines required sampling mode (BABYLON.Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param engine defines hosting engine\r\n * @param reusable defines if the postprocess will be reused multiple times per frame\r\n */\r\n function AnaglyphPostProcess(name, options, rigCameras, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"anaglyph\", null, [\"leftSampler\"], options, rigCameras[1], samplingMode, engine, reusable) || this;\r\n _this._passedProcess = rigCameras[0]._rigPostProcess;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"leftSampler\", _this._passedProcess);\r\n });\r\n return _this;\r\n }\r\n return AnaglyphPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/blackAndWhitePostProcess.ts\":\n/*!***************************************************!*\\\n !*** ./PostProcesses/blackAndWhitePostProcess.ts ***!\n \\***************************************************/\n/*! exports provided: BlackAndWhitePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return BlackAndWhitePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_blackAndWhite_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/blackAndWhite.fragment */ \"./Shaders/blackAndWhite.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Post process used to render in black and white\r\n */\r\nvar BlackAndWhitePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BlackAndWhitePostProcess, _super);\r\n /**\r\n * Creates a black and white post process\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#black-and-white\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function BlackAndWhitePostProcess(name, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"blackAndWhite\", [\"degree\"], null, options, camera, samplingMode, engine, reusable) || this;\r\n /**\r\n * Linear about to convert he result to black and white (default: 1)\r\n */\r\n _this.degree = 1;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat(\"degree\", _this.degree);\r\n });\r\n return _this;\r\n }\r\n return BlackAndWhitePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/bloomEffect.ts\":\n/*!**************************************!*\\\n !*** ./PostProcesses/bloomEffect.ts ***!\n \\**************************************/\n/*! exports provided: BloomEffect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return BloomEffect; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extractHighlightsPostProcess */ \"./PostProcesses/extractHighlightsPostProcess.ts\");\n/* harmony import */ var _blurPostProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bloomMergePostProcess */ \"./PostProcesses/bloomMergePostProcess.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The bloom effect spreads bright areas of an image to simulate artifacts seen in cameras\r\n */\r\nvar BloomEffect = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BloomEffect, _super);\r\n /**\r\n * Creates a new instance of @see BloomEffect\r\n * @param scene The scene the effect belongs to.\r\n * @param bloomScale The ratio of the blur texture to the input texture that should be used to compute the bloom.\r\n * @param bloomKernel The size of the kernel to be used when applying the blur.\r\n * @param bloomWeight The the strength of bloom.\r\n * @param pipelineTextureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function BloomEffect(scene, bloomScale, bloomWeight, bloomKernel, pipelineTextureType, blockCompilation) {\r\n if (pipelineTextureType === void 0) { pipelineTextureType = 0; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, scene.getEngine(), \"bloom\", function () {\r\n return _this._effects;\r\n }, true) || this;\r\n _this.bloomScale = bloomScale;\r\n /**\r\n * @hidden Internal\r\n */\r\n _this._effects = [];\r\n _this._downscale = new _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"ExtractHighlightsPostProcess\"](\"highlights\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n _this._blurX = new _blurPostProcess__WEBPACK_IMPORTED_MODULE_3__[\"BlurPostProcess\"](\"horizontal blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](1.0, 0), 10.0, bloomScale, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, undefined, blockCompilation);\r\n _this._blurX.alwaysForcePOT = true;\r\n _this._blurX.autoClear = false;\r\n _this._blurY = new _blurPostProcess__WEBPACK_IMPORTED_MODULE_3__[\"BlurPostProcess\"](\"vertical blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](0, 1.0), 10.0, bloomScale, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, undefined, blockCompilation);\r\n _this._blurY.alwaysForcePOT = true;\r\n _this._blurY.autoClear = false;\r\n _this.kernel = bloomKernel;\r\n _this._effects = [_this._downscale, _this._blurX, _this._blurY];\r\n _this._merge = new _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BloomMergePostProcess\"](\"bloomMerge\", _this._downscale, _this._blurY, bloomWeight, bloomScale, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n _this._merge.autoClear = false;\r\n _this._effects.push(_this._merge);\r\n return _this;\r\n }\r\n Object.defineProperty(BloomEffect.prototype, \"threshold\", {\r\n /**\r\n * The luminance threshold to find bright areas of the image to bloom.\r\n */\r\n get: function () {\r\n return this._downscale.threshold;\r\n },\r\n set: function (value) {\r\n this._downscale.threshold = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BloomEffect.prototype, \"weight\", {\r\n /**\r\n * The strength of the bloom.\r\n */\r\n get: function () {\r\n return this._merge.weight;\r\n },\r\n set: function (value) {\r\n this._merge.weight = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BloomEffect.prototype, \"kernel\", {\r\n /**\r\n * Specifies the size of the bloom blur kernel, relative to the final output size\r\n */\r\n get: function () {\r\n return this._blurX.kernel / this.bloomScale;\r\n },\r\n set: function (value) {\r\n this._blurX.kernel = value * this.bloomScale;\r\n this._blurY.kernel = value * this.bloomScale;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes each of the internal effects for a given camera.\r\n * @param camera The camera to dispose the effect on.\r\n */\r\n BloomEffect.prototype.disposeEffects = function (camera) {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].dispose(camera);\r\n }\r\n };\r\n /**\r\n * @hidden Internal\r\n */\r\n BloomEffect.prototype._updateEffects = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].updateEffect();\r\n }\r\n };\r\n /**\r\n * Internal\r\n * @returns if all the contained post processes are ready.\r\n * @hidden\r\n */\r\n BloomEffect.prototype._isReady = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n if (!this._effects[effectIndex].isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n return BloomEffect;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__[\"PostProcessRenderEffect\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/bloomMergePostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/bloomMergePostProcess.ts ***!\n \\************************************************/\n/*! exports provided: BloomMergePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return BloomMergePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_bloomMerge_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/bloomMerge.fragment */ \"./Shaders/bloomMerge.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The BloomMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\r\n */\r\nvar BloomMergePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BloomMergePostProcess, _super);\r\n /**\r\n * Creates a new instance of @see BloomMergePostProcess\r\n * @param name The name of the effect.\r\n * @param originalFromInput Post process which's input will be used for the merge.\r\n * @param blurred Blurred highlights post process which's output will be used.\r\n * @param weight Weight of the bloom to be added to the original input.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function BloomMergePostProcess(name, originalFromInput, blurred, \r\n /** Weight of the bloom to be added to the original input. */\r\n weight, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"bloomMerge\", [\"bloomWeight\"], [\"circleOfConfusionSampler\", \"blurStep0\", \"blurStep1\", \"blurStep2\", \"bloomBlur\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true) || this;\r\n _this.weight = weight;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\r\n effect.setTextureFromPostProcessOutput(\"bloomBlur\", blurred);\r\n effect.setFloat(\"bloomWeight\", _this.weight);\r\n });\r\n if (!blockCompilation) {\r\n _this.updateEffect();\r\n }\r\n return _this;\r\n }\r\n return BloomMergePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/blurPostProcess.ts\":\n/*!******************************************!*\\\n !*** ./PostProcesses/blurPostProcess.ts ***!\n \\******************************************/\n/*! exports provided: BlurPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return BlurPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_kernelBlur_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/kernelBlur.fragment */ \"./Shaders/kernelBlur.fragment.ts\");\n/* harmony import */ var _Shaders_kernelBlur_vertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Shaders/kernelBlur.vertex */ \"./Shaders/kernelBlur.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Blur Post Process which blurs an image based on a kernel and direction.\r\n * Can be used twice in x and y directions to perform a guassian blur in two passes.\r\n */\r\nvar BlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BlurPostProcess, _super);\r\n /**\r\n * Creates a new instance BlurPostProcess\r\n * @param name The name of the effect.\r\n * @param direction The direction in which to blur the image.\r\n * @param kernel The size of the kernel to be used when computing the blur. eg. Size of 3 will blur the center pixel by 2 pixels surrounding it.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function BlurPostProcess(name, \r\n /** The direction in which to blur the image. */\r\n direction, kernel, options, camera, samplingMode, engine, reusable, textureType, defines, blockCompilation) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (defines === void 0) { defines = \"\"; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"kernelBlur\", [\"delta\", \"direction\", \"cameraMinMaxZ\"], [\"circleOfConfusionSampler\"], options, camera, samplingMode, engine, reusable, null, textureType, \"kernelBlur\", { varyingCount: 0, depCount: 0 }, true) || this;\r\n _this.direction = direction;\r\n _this.blockCompilation = blockCompilation;\r\n _this._packedFloat = false;\r\n _this._staticDefines = \"\";\r\n _this._staticDefines = defines;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (_this._outputTexture) {\r\n effect.setFloat2('delta', (1 / _this._outputTexture.width) * _this.direction.x, (1 / _this._outputTexture.height) * _this.direction.y);\r\n }\r\n else {\r\n effect.setFloat2('delta', (1 / _this.width) * _this.direction.x, (1 / _this.height) * _this.direction.y);\r\n }\r\n });\r\n _this.kernel = kernel;\r\n return _this;\r\n }\r\n Object.defineProperty(BlurPostProcess.prototype, \"kernel\", {\r\n /**\r\n * Gets the length in pixels of the blur sample region\r\n */\r\n get: function () {\r\n return this._idealKernel;\r\n },\r\n /**\r\n * Sets the length in pixels of the blur sample region\r\n */\r\n set: function (v) {\r\n if (this._idealKernel === v) {\r\n return;\r\n }\r\n v = Math.max(v, 1);\r\n this._idealKernel = v;\r\n this._kernel = this._nearestBestKernel(v);\r\n if (!this.blockCompilation) {\r\n this._updateParameters();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BlurPostProcess.prototype, \"packedFloat\", {\r\n /**\r\n * Gets wether or not the blur is unpacking/repacking floats\r\n */\r\n get: function () {\r\n return this._packedFloat;\r\n },\r\n /**\r\n * Sets wether or not the blur needs to unpack/repack floats\r\n */\r\n set: function (v) {\r\n if (this._packedFloat === v) {\r\n return;\r\n }\r\n this._packedFloat = v;\r\n if (!this.blockCompilation) {\r\n this._updateParameters();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n */\r\n BlurPostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n this._updateParameters(onCompiled, onError);\r\n };\r\n BlurPostProcess.prototype._updateParameters = function (onCompiled, onError) {\r\n // Generate sampling offsets and weights\r\n var N = this._kernel;\r\n var centerIndex = (N - 1) / 2;\r\n // Generate Gaussian sampling weights over kernel\r\n var offsets = [];\r\n var weights = [];\r\n var totalWeight = 0;\r\n for (var i = 0; i < N; i++) {\r\n var u = i / (N - 1);\r\n var w = this._gaussianWeight(u * 2.0 - 1);\r\n offsets[i] = (i - centerIndex);\r\n weights[i] = w;\r\n totalWeight += w;\r\n }\r\n // Normalize weights\r\n for (var i = 0; i < weights.length; i++) {\r\n weights[i] /= totalWeight;\r\n }\r\n // Optimize: combine samples to take advantage of hardware linear sampling\r\n // Walk from left to center, combining pairs (symmetrically)\r\n var linearSamplingWeights = [];\r\n var linearSamplingOffsets = [];\r\n var linearSamplingMap = [];\r\n for (var i = 0; i <= centerIndex; i += 2) {\r\n var j = Math.min(i + 1, Math.floor(centerIndex));\r\n var singleCenterSample = i === j;\r\n if (singleCenterSample) {\r\n linearSamplingMap.push({ o: offsets[i], w: weights[i] });\r\n }\r\n else {\r\n var sharedCell = j === centerIndex;\r\n var weightLinear = (weights[i] + weights[j] * (sharedCell ? .5 : 1.));\r\n var offsetLinear = offsets[i] + 1 / (1 + weights[i] / weights[j]);\r\n if (offsetLinear === 0) {\r\n linearSamplingMap.push({ o: offsets[i], w: weights[i] });\r\n linearSamplingMap.push({ o: offsets[i + 1], w: weights[i + 1] });\r\n }\r\n else {\r\n linearSamplingMap.push({ o: offsetLinear, w: weightLinear });\r\n linearSamplingMap.push({ o: -offsetLinear, w: weightLinear });\r\n }\r\n }\r\n }\r\n for (var i = 0; i < linearSamplingMap.length; i++) {\r\n linearSamplingOffsets[i] = linearSamplingMap[i].o;\r\n linearSamplingWeights[i] = linearSamplingMap[i].w;\r\n }\r\n // Replace with optimized\r\n offsets = linearSamplingOffsets;\r\n weights = linearSamplingWeights;\r\n // Generate shaders\r\n var maxVaryingRows = this.getEngine().getCaps().maxVaryingVectors;\r\n var freeVaryingVec2 = Math.max(maxVaryingRows, 0.) - 1; // Because of sampleCenter\r\n var varyingCount = Math.min(offsets.length, freeVaryingVec2);\r\n var defines = \"\";\r\n defines += this._staticDefines;\r\n // The DOF fragment should ignore the center pixel when looping as it is handled manualy in the fragment shader.\r\n if (this._staticDefines.indexOf(\"DOF\") != -1) {\r\n defines += \"#define CENTER_WEIGHT \" + this._glslFloat(weights[varyingCount - 1]) + \"\\r\\n\";\r\n varyingCount--;\r\n }\r\n for (var i = 0; i < varyingCount; i++) {\r\n defines += \"#define KERNEL_OFFSET\" + i + \" \" + this._glslFloat(offsets[i]) + \"\\r\\n\";\r\n defines += \"#define KERNEL_WEIGHT\" + i + \" \" + this._glslFloat(weights[i]) + \"\\r\\n\";\r\n }\r\n var depCount = 0;\r\n for (var i = freeVaryingVec2; i < offsets.length; i++) {\r\n defines += \"#define KERNEL_DEP_OFFSET\" + depCount + \" \" + this._glslFloat(offsets[i]) + \"\\r\\n\";\r\n defines += \"#define KERNEL_DEP_WEIGHT\" + depCount + \" \" + this._glslFloat(weights[i]) + \"\\r\\n\";\r\n depCount++;\r\n }\r\n if (this.packedFloat) {\r\n defines += \"#define PACKEDFLOAT 1\";\r\n }\r\n this.blockCompilation = false;\r\n _super.prototype.updateEffect.call(this, defines, null, null, {\r\n varyingCount: varyingCount,\r\n depCount: depCount\r\n }, onCompiled, onError);\r\n };\r\n /**\r\n * Best kernels are odd numbers that when divided by 2, their integer part is even, so 5, 9 or 13.\r\n * Other odd kernels optimize correctly but require proportionally more samples, even kernels are\r\n * possible but will produce minor visual artifacts. Since each new kernel requires a new shader we\r\n * want to minimize kernel changes, having gaps between physical kernels is helpful in that regard.\r\n * The gaps between physical kernels are compensated for in the weighting of the samples\r\n * @param idealKernel Ideal blur kernel.\r\n * @return Nearest best kernel.\r\n */\r\n BlurPostProcess.prototype._nearestBestKernel = function (idealKernel) {\r\n var v = Math.round(idealKernel);\r\n for (var _i = 0, _a = [v, v - 1, v + 1, v - 2, v + 2]; _i < _a.length; _i++) {\r\n var k = _a[_i];\r\n if (((k % 2) !== 0) && ((Math.floor(k / 2) % 2) === 0) && k > 0) {\r\n return Math.max(k, 3);\r\n }\r\n }\r\n return Math.max(v, 3);\r\n };\r\n /**\r\n * Calculates the value of a Gaussian distribution with sigma 3 at a given point.\r\n * @param x The point on the Gaussian distribution to sample.\r\n * @return the value of the Gaussian function at x.\r\n */\r\n BlurPostProcess.prototype._gaussianWeight = function (x) {\r\n //reference: Engines/ImageProcessingBlur.cpp #dcc760\r\n // We are evaluating the Gaussian (normal) distribution over a kernel parameter space of [-1,1],\r\n // so we truncate at three standard deviations by setting stddev (sigma) to 1/3.\r\n // The choice of 3-sigma truncation is common but arbitrary, and means that the signal is\r\n // truncated at around 1.3% of peak strength.\r\n //the distribution is scaled to account for the difference between the actual kernel size and the requested kernel size\r\n var sigma = (1 / 3);\r\n var denominator = Math.sqrt(2.0 * Math.PI) * sigma;\r\n var exponent = -((x * x) / (2.0 * sigma * sigma));\r\n var weight = (1.0 / denominator) * Math.exp(exponent);\r\n return weight;\r\n };\r\n /**\r\n * Generates a string that can be used as a floating point number in GLSL.\r\n * @param x Value to print.\r\n * @param decimalFigures Number of decimal places to print the number to (excluding trailing 0s).\r\n * @return GLSL float string.\r\n */\r\n BlurPostProcess.prototype._glslFloat = function (x, decimalFigures) {\r\n if (decimalFigures === void 0) { decimalFigures = 8; }\r\n return x.toFixed(decimalFigures).replace(/0+$/, '');\r\n };\r\n return BlurPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/chromaticAberrationPostProcess.ts\":\n/*!*********************************************************!*\\\n !*** ./PostProcesses/chromaticAberrationPostProcess.ts ***!\n \\*********************************************************/\n/*! exports provided: ChromaticAberrationPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return ChromaticAberrationPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_chromaticAberration_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/chromaticAberration.fragment */ \"./Shaders/chromaticAberration.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen\r\n */\r\nvar ChromaticAberrationPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ChromaticAberrationPostProcess, _super);\r\n /**\r\n * Creates a new instance ChromaticAberrationPostProcess\r\n * @param name The name of the effect.\r\n * @param screenWidth The width of the screen to apply the effect on.\r\n * @param screenHeight The height of the screen to apply the effect on.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function ChromaticAberrationPostProcess(name, screenWidth, screenHeight, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"chromaticAberration\", [\"chromatic_aberration\", \"screen_width\", \"screen_height\", \"direction\", \"radialIntensity\", \"centerPosition\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * The amount of seperation of rgb channels (default: 30)\r\n */\r\n _this.aberrationAmount = 30;\r\n /**\r\n * The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)\r\n */\r\n _this.radialIntensity = 0;\r\n /**\r\n * The normilized direction in which the rgb channels should be seperated. If set to 0,0 radial direction will be used. (default: Vector2(0.707,0.707))\r\n */\r\n _this.direction = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0.707, 0.707);\r\n /**\r\n * The center position where the radialIntensity should be around. [0.5,0.5 is center of screen, 1,1 is top right corder] (default: Vector2(0.5 ,0.5))\r\n */\r\n _this.centerPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0.5, 0.5);\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat('chromatic_aberration', _this.aberrationAmount);\r\n effect.setFloat('screen_width', screenWidth);\r\n effect.setFloat('screen_height', screenHeight);\r\n effect.setFloat('radialIntensity', _this.radialIntensity);\r\n effect.setFloat2('direction', _this.direction.x, _this.direction.y);\r\n effect.setFloat2('centerPosition', _this.centerPosition.x, _this.centerPosition.y);\r\n });\r\n return _this;\r\n }\r\n return ChromaticAberrationPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/circleOfConfusionPostProcess.ts\":\n/*!*******************************************************!*\\\n !*** ./PostProcesses/circleOfConfusionPostProcess.ts ***!\n \\*******************************************************/\n/*! exports provided: CircleOfConfusionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return CircleOfConfusionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_circleOfConfusion_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/circleOfConfusion.fragment */ \"./Shaders/circleOfConfusion.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The CircleOfConfusionPostProcess computes the circle of confusion value for each pixel given required lens parameters. See https://en.wikipedia.org/wiki/Circle_of_confusion\r\n */\r\nvar CircleOfConfusionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CircleOfConfusionPostProcess, _super);\r\n /**\r\n * Creates a new instance CircleOfConfusionPostProcess\r\n * @param name The name of the effect.\r\n * @param depthTexture The depth texture of the scene to compute the circle of confusion. This must be set in order for this to function but may be set after initialization if needed.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function CircleOfConfusionPostProcess(name, depthTexture, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"circleOfConfusion\", [\"cameraMinMaxZ\", \"focusDistance\", \"cocPrecalculation\"], [\"depthSampler\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diamater of the resulting aperture can be computed by lensSize/fStop.\r\n */\r\n _this.lensSize = 50;\r\n /**\r\n * F-Stop of the effect's camera. The diamater of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\r\n */\r\n _this.fStop = 1.4;\r\n /**\r\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\r\n */\r\n _this.focusDistance = 2000;\r\n /**\r\n * Focal length of the effect's camera in scene units/1000 (eg. millimeter). (default: 50)\r\n */\r\n _this.focalLength = 50;\r\n _this._depthTexture = null;\r\n _this._depthTexture = depthTexture;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (!_this._depthTexture) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"No depth texture set on CircleOfConfusionPostProcess\");\r\n return;\r\n }\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n // Circle of confusion calculation, See https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch23.html\r\n var aperture = _this.lensSize / _this.fStop;\r\n var cocPrecalculation = ((aperture * _this.focalLength) / ((_this.focusDistance - _this.focalLength))); // * ((this.focusDistance - pixelDistance)/pixelDistance) [This part is done in shader]\r\n effect.setFloat('focusDistance', _this.focusDistance);\r\n effect.setFloat('cocPrecalculation', cocPrecalculation);\r\n effect.setFloat2('cameraMinMaxZ', _this._depthTexture.activeCamera.minZ, _this._depthTexture.activeCamera.maxZ);\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(CircleOfConfusionPostProcess.prototype, \"depthTexture\", {\r\n /**\r\n * Depth texture to be used to compute the circle of confusion. This must be set here or in the constructor in order for the post process to function.\r\n */\r\n set: function (value) {\r\n this._depthTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CircleOfConfusionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/colorCorrectionPostProcess.ts\":\n/*!*****************************************************!*\\\n !*** ./PostProcesses/colorCorrectionPostProcess.ts ***!\n \\*****************************************************/\n/*! exports provided: ColorCorrectionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return ColorCorrectionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Shaders_colorCorrection_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/colorCorrection.fragment */ \"./Shaders/colorCorrection.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n *\r\n * This post-process allows the modification of rendered colors by using\r\n * a 'look-up table' (LUT). This effect is also called Color Grading.\r\n *\r\n * The object needs to be provided an url to a texture containing the color\r\n * look-up table: the texture must be 256 pixels wide and 16 pixels high.\r\n * Use an image editing software to tweak the LUT to match your needs.\r\n *\r\n * For an example of a color LUT, see here:\r\n * @see http://udn.epicgames.com/Three/rsrc/Three/ColorGrading/RGBTable16x1.png\r\n * For explanations on color grading, see here:\r\n * @see http://udn.epicgames.com/Three/ColorGrading.html\r\n *\r\n */\r\nvar ColorCorrectionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorCorrectionPostProcess, _super);\r\n function ColorCorrectionPostProcess(name, colorTableUrl, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, 'colorCorrection', null, ['colorTable'], options, camera, samplingMode, engine, reusable) || this;\r\n _this._colorTableTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"](colorTableUrl, camera.getScene(), true, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n _this._colorTableTexture.anisotropicFilteringLevel = 1;\r\n _this._colorTableTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this._colorTableTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.onApply = function (effect) {\r\n effect.setTexture(\"colorTable\", _this._colorTableTexture);\r\n };\r\n return _this;\r\n }\r\n return ColorCorrectionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/convolutionPostProcess.ts\":\n/*!*************************************************!*\\\n !*** ./PostProcesses/convolutionPostProcess.ts ***!\n \\*************************************************/\n/*! exports provided: ConvolutionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return ConvolutionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_convolution_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/convolution.fragment */ \"./Shaders/convolution.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The ConvolutionPostProcess applies a 3x3 kernel to every pixel of the\r\n * input texture to perform effects such as edge detection or sharpening\r\n * See http://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\nvar ConvolutionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ConvolutionPostProcess, _super);\r\n /**\r\n * Creates a new instance ConvolutionPostProcess\r\n * @param name The name of the effect.\r\n * @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n */\r\n function ConvolutionPostProcess(name, \r\n /** Array of 9 values corresponding to the 3x3 kernel to be applied */\r\n kernel, options, camera, samplingMode, engine, reusable, textureType) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"convolution\", [\"kernel\", \"screenSize\"], null, options, camera, samplingMode, engine, reusable, null, textureType) || this;\r\n _this.kernel = kernel;\r\n _this.onApply = function (effect) {\r\n effect.setFloat2(\"screenSize\", _this.width, _this.height);\r\n effect.setArray(\"kernel\", _this.kernel);\r\n };\r\n return _this;\r\n }\r\n // Statics\r\n /**\r\n * Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1];\r\n /**\r\n * Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0];\r\n /**\r\n * Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1];\r\n /**\r\n * Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0];\r\n /**\r\n * Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2];\r\n /**\r\n * Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0];\r\n return ConvolutionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/depthOfFieldBlurPostProcess.ts\":\n/*!******************************************************!*\\\n !*** ./PostProcesses/depthOfFieldBlurPostProcess.ts ***!\n \\******************************************************/\n/*! exports provided: DepthOfFieldBlurPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return DepthOfFieldBlurPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _blurPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The DepthOfFieldBlurPostProcess applied a blur in a give direction.\r\n * This blur differs from the standard BlurPostProcess as it attempts to avoid blurring pixels\r\n * based on samples that have a large difference in distance than the center pixel.\r\n * See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\r\n */\r\nvar DepthOfFieldBlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DepthOfFieldBlurPostProcess, _super);\r\n /**\r\n * Creates a new instance CircleOfConfusionPostProcess\r\n * @param name The name of the effect.\r\n * @param scene The scene the effect belongs to.\r\n * @param direction The direction the blur should be applied.\r\n * @param kernel The size of the kernel used to blur.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param circleOfConfusion The circle of confusion + depth map to be used to avoid blurring accross edges\r\n * @param imageToBlur The image to apply the blur to (default: Current rendered frame)\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function DepthOfFieldBlurPostProcess(name, scene, direction, kernel, options, camera, circleOfConfusion, imageToBlur, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (imageToBlur === void 0) { imageToBlur = null; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, direction, kernel, options, camera, samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE, engine, reusable, textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, \"#define DOF 1\\r\\n\", blockCompilation) || this;\r\n _this.direction = direction;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (imageToBlur != null) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", imageToBlur);\r\n }\r\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\r\n if (scene.activeCamera) {\r\n effect.setFloat2('cameraMinMaxZ', scene.activeCamera.minZ, scene.activeCamera.maxZ);\r\n }\r\n });\r\n return _this;\r\n }\r\n return DepthOfFieldBlurPostProcess;\r\n}(_blurPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"BlurPostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/depthOfFieldEffect.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/depthOfFieldEffect.ts ***!\n \\*********************************************/\n/*! exports provided: DepthOfFieldEffectBlurLevel, DepthOfFieldEffect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return DepthOfFieldEffectBlurLevel; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return DepthOfFieldEffect; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./circleOfConfusionPostProcess */ \"./PostProcesses/circleOfConfusionPostProcess.ts\");\n/* harmony import */ var _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./depthOfFieldBlurPostProcess */ \"./PostProcesses/depthOfFieldBlurPostProcess.ts\");\n/* harmony import */ var _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./depthOfFieldMergePostProcess */ \"./PostProcesses/depthOfFieldMergePostProcess.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Specifies the level of max blur that should be applied when using the depth of field effect\r\n */\r\nvar DepthOfFieldEffectBlurLevel;\r\n(function (DepthOfFieldEffectBlurLevel) {\r\n /**\r\n * Subtle blur\r\n */\r\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"Low\"] = 0] = \"Low\";\r\n /**\r\n * Medium blur\r\n */\r\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"Medium\"] = 1] = \"Medium\";\r\n /**\r\n * Large blur\r\n */\r\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"High\"] = 2] = \"High\";\r\n})(DepthOfFieldEffectBlurLevel || (DepthOfFieldEffectBlurLevel = {}));\r\n/**\r\n * The depth of field effect applies a blur to objects that are closer or further from where the camera is focusing.\r\n */\r\nvar DepthOfFieldEffect = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DepthOfFieldEffect, _super);\r\n /**\r\n * Creates a new instance DepthOfFieldEffect\r\n * @param scene The scene the effect belongs to.\r\n * @param depthTexture The depth texture of the scene to compute the circle of confusion.This must be set in order for this to function but may be set after initialization if needed.\r\n * @param pipelineTextureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function DepthOfFieldEffect(scene, depthTexture, blurLevel, pipelineTextureType, blockCompilation) {\r\n if (blurLevel === void 0) { blurLevel = DepthOfFieldEffectBlurLevel.Low; }\r\n if (pipelineTextureType === void 0) { pipelineTextureType = 0; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, scene.getEngine(), \"depth of field\", function () {\r\n return _this._effects;\r\n }, true) || this;\r\n /**\r\n * @hidden Internal post processes in depth of field effect\r\n */\r\n _this._effects = [];\r\n // Circle of confusion value for each pixel is used to determine how much to blur that pixel\r\n _this._circleOfConfusion = new _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"CircleOfConfusionPostProcess\"](\"circleOfConfusion\", depthTexture, 1, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n // Create a pyramid of blurred images (eg. fullSize 1/4 blur, half size 1/2 blur, quarter size 3/4 blur, eith size 4/4 blur)\r\n // Blur the image but do not blur on sharp far to near distance changes to avoid bleeding artifacts\r\n // See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\r\n _this._depthOfFieldBlurY = [];\r\n _this._depthOfFieldBlurX = [];\r\n var blurCount = 1;\r\n var kernelSize = 15;\r\n switch (blurLevel) {\r\n case DepthOfFieldEffectBlurLevel.High: {\r\n blurCount = 3;\r\n kernelSize = 51;\r\n break;\r\n }\r\n case DepthOfFieldEffectBlurLevel.Medium: {\r\n blurCount = 2;\r\n kernelSize = 31;\r\n break;\r\n }\r\n default: {\r\n kernelSize = 15;\r\n blurCount = 1;\r\n break;\r\n }\r\n }\r\n var adjustedKernelSize = kernelSize / Math.pow(2, blurCount - 1);\r\n var ratio = 1.0;\r\n for (var i = 0; i < blurCount; i++) {\r\n var blurY = new _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_5__[\"DepthOfFieldBlurPostProcess\"](\"verticle blur\", scene, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1.0), adjustedKernelSize, ratio, null, _this._circleOfConfusion, i == 0 ? _this._circleOfConfusion : null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n blurY.autoClear = false;\r\n ratio = 0.75 / Math.pow(2, i);\r\n var blurX = new _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_5__[\"DepthOfFieldBlurPostProcess\"](\"horizontal blur\", scene, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1.0, 0), adjustedKernelSize, ratio, null, _this._circleOfConfusion, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n blurX.autoClear = false;\r\n _this._depthOfFieldBlurY.push(blurY);\r\n _this._depthOfFieldBlurX.push(blurX);\r\n }\r\n // Set all post processes on the effect.\r\n _this._effects = [_this._circleOfConfusion];\r\n for (var i = 0; i < _this._depthOfFieldBlurX.length; i++) {\r\n _this._effects.push(_this._depthOfFieldBlurY[i]);\r\n _this._effects.push(_this._depthOfFieldBlurX[i]);\r\n }\r\n // Merge blurred images with original image based on circleOfConfusion\r\n _this._dofMerge = new _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_6__[\"DepthOfFieldMergePostProcess\"](\"dofMerge\", _this._circleOfConfusion, _this._circleOfConfusion, _this._depthOfFieldBlurX, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n _this._dofMerge.autoClear = false;\r\n _this._effects.push(_this._dofMerge);\r\n return _this;\r\n }\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"focalLength\", {\r\n get: function () {\r\n return this._circleOfConfusion.focalLength;\r\n },\r\n /**\r\n * The focal the length of the camera used in the effect in scene units/1000 (eg. millimeter)\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.focalLength = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"fStop\", {\r\n get: function () {\r\n return this._circleOfConfusion.fStop;\r\n },\r\n /**\r\n * F-Stop of the effect's camera. The diameter of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.fStop = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"focusDistance\", {\r\n get: function () {\r\n return this._circleOfConfusion.focusDistance;\r\n },\r\n /**\r\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.focusDistance = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"lensSize\", {\r\n get: function () {\r\n return this._circleOfConfusion.lensSize;\r\n },\r\n /**\r\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diamater of the resulting aperture can be computed by lensSize/fStop.\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.lensSize = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the current effet\r\n * @returns \"DepthOfFieldEffect\"\r\n */\r\n DepthOfFieldEffect.prototype.getClassName = function () {\r\n return \"DepthOfFieldEffect\";\r\n };\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"depthTexture\", {\r\n /**\r\n * Depth texture to be used to compute the circle of confusion. This must be set here or in the constructor in order for the post process to function.\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.depthTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes each of the internal effects for a given camera.\r\n * @param camera The camera to dispose the effect on.\r\n */\r\n DepthOfFieldEffect.prototype.disposeEffects = function (camera) {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].dispose(camera);\r\n }\r\n };\r\n /**\r\n * @hidden Internal\r\n */\r\n DepthOfFieldEffect.prototype._updateEffects = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].updateEffect();\r\n }\r\n };\r\n /**\r\n * Internal\r\n * @returns if all the contained post processes are ready.\r\n * @hidden\r\n */\r\n DepthOfFieldEffect.prototype._isReady = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n if (!this._effects[effectIndex].isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n return DepthOfFieldEffect;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_3__[\"PostProcessRenderEffect\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/depthOfFieldMergePostProcess.ts\":\n/*!*******************************************************!*\\\n !*** ./PostProcesses/depthOfFieldMergePostProcess.ts ***!\n \\*******************************************************/\n/*! exports provided: DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return DepthOfFieldMergePostProcessOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return DepthOfFieldMergePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_depthOfFieldMerge_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/depthOfFieldMerge.fragment */ \"./Shaders/depthOfFieldMerge.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Options to be set when merging outputs from the default pipeline.\r\n */\r\nvar DepthOfFieldMergePostProcessOptions = /** @class */ (function () {\r\n function DepthOfFieldMergePostProcessOptions() {\r\n }\r\n return DepthOfFieldMergePostProcessOptions;\r\n}());\r\n\r\n/**\r\n * The DepthOfFieldMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\r\n */\r\nvar DepthOfFieldMergePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DepthOfFieldMergePostProcess, _super);\r\n /**\r\n * Creates a new instance of DepthOfFieldMergePostProcess\r\n * @param name The name of the effect.\r\n * @param originalFromInput Post process which's input will be used for the merge.\r\n * @param circleOfConfusion Circle of confusion post process which's output will be used to blur each pixel.\r\n * @param blurSteps Blur post processes from low to high which will be mixed with the original image.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function DepthOfFieldMergePostProcess(name, originalFromInput, circleOfConfusion, blurSteps, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"depthOfFieldMerge\", [], [\"circleOfConfusionSampler\", \"blurStep0\", \"blurStep1\", \"blurStep2\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true) || this;\r\n _this.blurSteps = blurSteps;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\r\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\r\n blurSteps.forEach(function (step, index) {\r\n effect.setTextureFromPostProcessOutput(\"blurStep\" + (blurSteps.length - index - 1), step);\r\n });\r\n });\r\n if (!blockCompilation) {\r\n _this.updateEffect();\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n */\r\n DepthOfFieldMergePostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n if (!defines) {\r\n defines = \"\";\r\n defines += \"#define BLUR_LEVEL \" + (this.blurSteps.length - 1) + \"\\n\";\r\n }\r\n _super.prototype.updateEffect.call(this, defines, uniforms, samplers, indexParameters, onCompiled, onError);\r\n };\r\n return DepthOfFieldMergePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/displayPassPostProcess.ts\":\n/*!*************************************************!*\\\n !*** ./PostProcesses/displayPassPostProcess.ts ***!\n \\*************************************************/\n/*! exports provided: DisplayPassPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return DisplayPassPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_displayPass_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/displayPass.fragment */ \"./Shaders/displayPass.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * DisplayPassPostProcess which produces an output the same as it's input\r\n */\r\nvar DisplayPassPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DisplayPassPostProcess, _super);\r\n /**\r\n * Creates the DisplayPassPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function DisplayPassPostProcess(name, options, camera, samplingMode, engine, reusable) {\r\n return _super.call(this, name, \"displayPass\", [\"passSampler\"], [\"passSampler\"], options, camera, samplingMode, engine, reusable) || this;\r\n }\r\n return DisplayPassPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/extractHighlightsPostProcess.ts\":\n/*!*******************************************************!*\\\n !*** ./PostProcesses/extractHighlightsPostProcess.ts ***!\n \\*******************************************************/\n/*! exports provided: ExtractHighlightsPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return ExtractHighlightsPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_extractHighlights_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/extractHighlights.fragment */ \"./Shaders/extractHighlights.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The extract highlights post process sets all pixels to black except pixels above the specified luminance threshold. Used as the first step for a bloom effect.\r\n */\r\nvar ExtractHighlightsPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ExtractHighlightsPostProcess, _super);\r\n function ExtractHighlightsPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"extractHighlights\", [\"threshold\", \"exposure\"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * The luminance threshold, pixels below this value will be set to black.\r\n */\r\n _this.threshold = 0.9;\r\n /** @hidden */\r\n _this._exposure = 1;\r\n /**\r\n * Post process which has the input texture to be used when performing highlight extraction\r\n * @hidden\r\n */\r\n _this._inputPostProcess = null;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (_this._inputPostProcess) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._inputPostProcess);\r\n }\r\n effect.setFloat('threshold', Math.pow(_this.threshold, _Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__[\"ToGammaSpace\"]));\r\n effect.setFloat('exposure', _this._exposure);\r\n });\r\n return _this;\r\n }\r\n return ExtractHighlightsPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/filterPostProcess.ts\":\n/*!********************************************!*\\\n !*** ./PostProcesses/filterPostProcess.ts ***!\n \\********************************************/\n/*! exports provided: FilterPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return FilterPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_filter_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/filter.fragment */ \"./Shaders/filter.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Applies a kernel filter to the image\r\n */\r\nvar FilterPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FilterPostProcess, _super);\r\n /**\r\n *\r\n * @param name The name of the effect.\r\n * @param kernelMatrix The matrix to be applied to the image\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function FilterPostProcess(name, \r\n /** The matrix to be applied to the image */\r\n kernelMatrix, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"filter\", [\"kernelMatrix\"], null, options, camera, samplingMode, engine, reusable) || this;\r\n _this.kernelMatrix = kernelMatrix;\r\n _this.onApply = function (effect) {\r\n effect.setMatrix(\"kernelMatrix\", _this.kernelMatrix);\r\n };\r\n return _this;\r\n }\r\n return FilterPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/fxaaPostProcess.ts\":\n/*!******************************************!*\\\n !*** ./PostProcesses/fxaaPostProcess.ts ***!\n \\******************************************/\n/*! exports provided: FxaaPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return FxaaPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_fxaa_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/fxaa.fragment */ \"./Shaders/fxaa.fragment.ts\");\n/* harmony import */ var _Shaders_fxaa_vertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Shaders/fxaa.vertex */ \"./Shaders/fxaa.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Fxaa post process\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#fxaa\r\n */\r\nvar FxaaPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FxaaPostProcess, _super);\r\n function FxaaPostProcess(name, options, camera, samplingMode, engine, reusable, textureType) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"fxaa\", [\"texelSize\"], null, options, camera, samplingMode || _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, reusable, null, textureType, \"fxaa\", undefined, true) || this;\r\n var defines = _this._getDefines();\r\n _this.updateEffect(defines);\r\n _this.onApplyObservable.add(function (effect) {\r\n var texelSize = _this.texelSize;\r\n effect.setFloat2(\"texelSize\", texelSize.x, texelSize.y);\r\n });\r\n return _this;\r\n }\r\n FxaaPostProcess.prototype._getDefines = function () {\r\n var engine = this.getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n var glInfo = engine.getGlInfo();\r\n if (glInfo && glInfo.renderer && glInfo.renderer.toLowerCase().indexOf(\"mali\") > -1) {\r\n return \"#define MALI 1\\n\";\r\n }\r\n return null;\r\n };\r\n return FxaaPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/grainPostProcess.ts\":\n/*!*******************************************!*\\\n !*** ./PostProcesses/grainPostProcess.ts ***!\n \\*******************************************/\n/*! exports provided: GrainPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return GrainPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_grain_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/grain.fragment */ \"./Shaders/grain.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The GrainPostProcess adds noise to the image at mid luminance levels\r\n */\r\nvar GrainPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GrainPostProcess, _super);\r\n /**\r\n * Creates a new instance of @see GrainPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function GrainPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"grain\", [\"intensity\", \"animatedSeed\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * The intensity of the grain added (default: 30)\r\n */\r\n _this.intensity = 30;\r\n /**\r\n * If the grain should be randomized on every frame\r\n */\r\n _this.animated = false;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat('intensity', _this.intensity);\r\n effect.setFloat('animatedSeed', _this.animated ? Math.random() + 1 : 1);\r\n });\r\n return _this;\r\n }\r\n return GrainPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/highlightsPostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/highlightsPostProcess.ts ***!\n \\************************************************/\n/*! exports provided: HighlightsPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return HighlightsPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_highlights_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/highlights.fragment */ \"./Shaders/highlights.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Extracts highlights from the image\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar HighlightsPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HighlightsPostProcess, _super);\r\n /**\r\n * Extracts highlights from the image\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of texture for the post process (default: Engine.TEXTURETYPE_UNSIGNED_INT)\r\n */\r\n function HighlightsPostProcess(name, options, camera, samplingMode, engine, reusable, textureType) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n return _super.call(this, name, \"highlights\", null, null, options, camera, samplingMode, engine, reusable, null, textureType) || this;\r\n }\r\n return HighlightsPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/imageProcessingPostProcess.ts\":\n/*!*****************************************************!*\\\n !*** ./PostProcesses/imageProcessingPostProcess.ts ***!\n \\*****************************************************/\n/*! exports provided: ImageProcessingPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return ImageProcessingPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_imageProcessing_fragment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Shaders/imageProcessing.fragment */ \"./Shaders/imageProcessing.fragment.ts\");\n/* harmony import */ var _Shaders_postprocess_vertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/postprocess.vertex */ \"./Shaders/postprocess.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * ImageProcessingPostProcess\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#imageprocessing\r\n */\r\nvar ImageProcessingPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageProcessingPostProcess, _super);\r\n function ImageProcessingPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, imageProcessingConfiguration) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"imageProcessing\", [], [], options, camera, samplingMode, engine, reusable, null, textureType, \"postprocess\", null, true) || this;\r\n _this._fromLinearSpace = true;\r\n /**\r\n * Defines cache preventing GC.\r\n */\r\n _this._defines = {\r\n IMAGEPROCESSING: false,\r\n VIGNETTE: false,\r\n VIGNETTEBLENDMODEMULTIPLY: false,\r\n VIGNETTEBLENDMODEOPAQUE: false,\r\n TONEMAPPING: false,\r\n TONEMAPPING_ACES: false,\r\n CONTRAST: false,\r\n COLORCURVES: false,\r\n COLORGRADING: false,\r\n COLORGRADING3D: false,\r\n FROMLINEARSPACE: false,\r\n SAMPLER3DGREENDEPTH: false,\r\n SAMPLER3DBGRMAP: false,\r\n IMAGEPROCESSINGPOSTPROCESS: false,\r\n EXPOSURE: false,\r\n };\r\n // Setup the configuration as forced by the constructor. This would then not force the\r\n // scene materials output in linear space and let untouched the default forward pass.\r\n if (imageProcessingConfiguration) {\r\n imageProcessingConfiguration.applyByPostProcess = true;\r\n _this._attachImageProcessingConfiguration(imageProcessingConfiguration, true);\r\n // This will cause the shader to be compiled\r\n _this.fromLinearSpace = false;\r\n }\r\n // Setup the default processing configuration to the scene.\r\n else {\r\n _this._attachImageProcessingConfiguration(null, true);\r\n _this.imageProcessingConfiguration.applyByPostProcess = true;\r\n }\r\n _this.onApply = function (effect) {\r\n _this.imageProcessingConfiguration.bind(effect, _this.aspectRatio);\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n // We are almost sure it is applied by post process as\r\n // We are in the post process :-)\r\n value.applyByPostProcess = true;\r\n this._attachImageProcessingConfiguration(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration\r\n */\r\n ImageProcessingPostProcess.prototype._attachImageProcessingConfiguration = function (configuration, doNotBuild) {\r\n var _this = this;\r\n if (doNotBuild === void 0) { doNotBuild = false; }\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n var scene = null;\r\n var engine = this.getEngine();\r\n var camera = this.getCamera();\r\n if (camera) {\r\n scene = camera.getScene();\r\n }\r\n else if (engine && engine.scenes) {\r\n var scenes = engine.scenes;\r\n scene = scenes[scenes.length - 1];\r\n }\r\n else {\r\n scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene;\r\n }\r\n this._imageProcessingConfiguration = scene.imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._updateParameters();\r\n });\r\n }\r\n // Ensure the effect will be rebuilt.\r\n if (!doNotBuild) {\r\n this._updateParameters();\r\n }\r\n };\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorCurves\", {\r\n /**\r\n * Gets Color curves setup used in the effect if colorCurvesEnabled is set to true .\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * Sets Color curves setup used in the effect if colorCurvesEnabled is set to true .\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorGradingTexture\", {\r\n /**\r\n * Gets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"exposure\", {\r\n /**\r\n * Gets exposure used in the effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * Sets exposure used in the effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"toneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"toneMappingType\", {\r\n /**\r\n * Gets the type of tone mapping effect.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingType;\r\n },\r\n /**\r\n * Sets the type of tone mapping effect.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"contrast\", {\r\n /**\r\n * Gets contrast used in the effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets contrast used in the effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteStretch\", {\r\n /**\r\n * Gets Vignette stretch size.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteStretch;\r\n },\r\n /**\r\n * Sets Vignette stretch size.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteStretch = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteCentreX\", {\r\n /**\r\n * Gets Vignette centre X Offset.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteCentreX;\r\n },\r\n /**\r\n * Sets Vignette centre X Offset.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteCentreX = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteCentreY\", {\r\n /**\r\n * Gets Vignette centre Y Offset.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteCentreY;\r\n },\r\n /**\r\n * Sets Vignette centre Y Offset.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteCentreY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteWeight\", {\r\n /**\r\n * Gets Vignette weight or intensity of the vignette effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteWeight;\r\n },\r\n /**\r\n * Sets Vignette weight or intensity of the vignette effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteWeight = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteColor\", {\r\n /**\r\n * Gets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteColor;\r\n },\r\n /**\r\n * Sets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteColor = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteCameraFov\", {\r\n /**\r\n * Gets Camera field of view used by the Vignette effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteCameraFov;\r\n },\r\n /**\r\n * Sets Camera field of view used by the Vignette effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteCameraFov = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteBlendMode\", {\r\n /**\r\n * Gets the vignette blend mode allowing different kind of effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteBlendMode;\r\n },\r\n /**\r\n * Sets the vignette blend mode allowing different kind of effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteBlendMode = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteEnabled\", {\r\n /**\r\n * Gets wether the vignette effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteEnabled;\r\n },\r\n /**\r\n * Sets wether the vignette effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"fromLinearSpace\", {\r\n /**\r\n * Gets wether the input of the processing is in Gamma or Linear Space.\r\n */\r\n get: function () {\r\n return this._fromLinearSpace;\r\n },\r\n /**\r\n * Sets wether the input of the processing is in Gamma or Linear Space.\r\n */\r\n set: function (value) {\r\n if (this._fromLinearSpace === value) {\r\n return;\r\n }\r\n this._fromLinearSpace = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * \"ImageProcessingPostProcess\"\r\n * @returns \"ImageProcessingPostProcess\"\r\n */\r\n ImageProcessingPostProcess.prototype.getClassName = function () {\r\n return \"ImageProcessingPostProcess\";\r\n };\r\n ImageProcessingPostProcess.prototype._updateParameters = function () {\r\n this._defines.FROMLINEARSPACE = this._fromLinearSpace;\r\n this.imageProcessingConfiguration.prepareDefines(this._defines, true);\r\n var defines = \"\";\r\n for (var define in this._defines) {\r\n if (this._defines[define]) {\r\n defines += \"#define \" + define + \";\\r\\n\";\r\n }\r\n }\r\n var samplers = [\"textureSampler\"];\r\n var uniforms = [\"scale\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, this._defines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, this._defines);\r\n }\r\n this.updateEffect(defines, uniforms, samplers);\r\n };\r\n ImageProcessingPostProcess.prototype.dispose = function (camera) {\r\n _super.prototype.dispose.call(this, camera);\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n if (this._imageProcessingConfiguration) {\r\n this.imageProcessingConfiguration.applyByPostProcess = false;\r\n }\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingPostProcess.prototype, \"_fromLinearSpace\", void 0);\r\n return ImageProcessingPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/index.ts\":\n/*!********************************!*\\\n !*** ./PostProcesses/index.ts ***!\n \\********************************/\n/*! exports provided: AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./anaglyphPostProcess */ \"./PostProcesses/anaglyphPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return _anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphPostProcess\"]; });\n\n/* harmony import */ var _blackAndWhitePostProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./blackAndWhitePostProcess */ \"./PostProcesses/blackAndWhitePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return _blackAndWhitePostProcess__WEBPACK_IMPORTED_MODULE_1__[\"BlackAndWhitePostProcess\"]; });\n\n/* harmony import */ var _bloomEffect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bloomEffect */ \"./PostProcesses/bloomEffect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return _bloomEffect__WEBPACK_IMPORTED_MODULE_2__[\"BloomEffect\"]; });\n\n/* harmony import */ var _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bloomMergePostProcess */ \"./PostProcesses/bloomMergePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_3__[\"BloomMergePostProcess\"]; });\n\n/* harmony import */ var _blurPostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return _blurPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BlurPostProcess\"]; });\n\n/* harmony import */ var _chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./chromaticAberrationPostProcess */ \"./PostProcesses/chromaticAberrationPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return _chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_5__[\"ChromaticAberrationPostProcess\"]; });\n\n/* harmony import */ var _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./circleOfConfusionPostProcess */ \"./PostProcesses/circleOfConfusionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_6__[\"CircleOfConfusionPostProcess\"]; });\n\n/* harmony import */ var _colorCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./colorCorrectionPostProcess */ \"./PostProcesses/colorCorrectionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return _colorCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"ColorCorrectionPostProcess\"]; });\n\n/* harmony import */ var _convolutionPostProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./convolutionPostProcess */ \"./PostProcesses/convolutionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return _convolutionPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"ConvolutionPostProcess\"]; });\n\n/* harmony import */ var _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./depthOfFieldBlurPostProcess */ \"./PostProcesses/depthOfFieldBlurPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"DepthOfFieldBlurPostProcess\"]; });\n\n/* harmony import */ var _depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./depthOfFieldEffect */ \"./PostProcesses/depthOfFieldEffect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return _depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_10__[\"DepthOfFieldEffectBlurLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return _depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_10__[\"DepthOfFieldEffect\"]; });\n\n/* harmony import */ var _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./depthOfFieldMergePostProcess */ \"./PostProcesses/depthOfFieldMergePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_11__[\"DepthOfFieldMergePostProcessOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_11__[\"DepthOfFieldMergePostProcess\"]; });\n\n/* harmony import */ var _displayPassPostProcess__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./displayPassPostProcess */ \"./PostProcesses/displayPassPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return _displayPassPostProcess__WEBPACK_IMPORTED_MODULE_12__[\"DisplayPassPostProcess\"]; });\n\n/* harmony import */ var _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./extractHighlightsPostProcess */ \"./PostProcesses/extractHighlightsPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_13__[\"ExtractHighlightsPostProcess\"]; });\n\n/* harmony import */ var _filterPostProcess__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./filterPostProcess */ \"./PostProcesses/filterPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return _filterPostProcess__WEBPACK_IMPORTED_MODULE_14__[\"FilterPostProcess\"]; });\n\n/* harmony import */ var _fxaaPostProcess__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return _fxaaPostProcess__WEBPACK_IMPORTED_MODULE_15__[\"FxaaPostProcess\"]; });\n\n/* harmony import */ var _grainPostProcess__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./grainPostProcess */ \"./PostProcesses/grainPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return _grainPostProcess__WEBPACK_IMPORTED_MODULE_16__[\"GrainPostProcess\"]; });\n\n/* harmony import */ var _highlightsPostProcess__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./highlightsPostProcess */ \"./PostProcesses/highlightsPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return _highlightsPostProcess__WEBPACK_IMPORTED_MODULE_17__[\"HighlightsPostProcess\"]; });\n\n/* harmony import */ var _imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./imageProcessingPostProcess */ \"./PostProcesses/imageProcessingPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return _imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_18__[\"ImageProcessingPostProcess\"]; });\n\n/* harmony import */ var _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./motionBlurPostProcess */ \"./PostProcesses/motionBlurPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_19__[\"MotionBlurPostProcess\"]; });\n\n/* harmony import */ var _passPostProcess__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return _passPostProcess__WEBPACK_IMPORTED_MODULE_20__[\"PassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return _passPostProcess__WEBPACK_IMPORTED_MODULE_20__[\"PassCubePostProcess\"]; });\n\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return _postProcess__WEBPACK_IMPORTED_MODULE_21__[\"PostProcess\"]; });\n\n/* harmony import */ var _postProcessManager__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./postProcessManager */ \"./PostProcesses/postProcessManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return _postProcessManager__WEBPACK_IMPORTED_MODULE_22__[\"PostProcessManager\"]; });\n\n/* harmony import */ var _refractionPostProcess__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./refractionPostProcess */ \"./PostProcesses/refractionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return _refractionPostProcess__WEBPACK_IMPORTED_MODULE_23__[\"RefractionPostProcess\"]; });\n\n/* harmony import */ var _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./RenderPipeline/index */ \"./PostProcesses/RenderPipeline/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"StandardRenderingPipeline\"]; });\n\n/* harmony import */ var _sharpenPostProcess__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./sharpenPostProcess */ \"./PostProcesses/sharpenPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return _sharpenPostProcess__WEBPACK_IMPORTED_MODULE_25__[\"SharpenPostProcess\"]; });\n\n/* harmony import */ var _stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./stereoscopicInterlacePostProcess */ \"./PostProcesses/stereoscopicInterlacePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return _stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_26__[\"StereoscopicInterlacePostProcess\"]; });\n\n/* harmony import */ var _tonemapPostProcess__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./tonemapPostProcess */ \"./PostProcesses/tonemapPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return _tonemapPostProcess__WEBPACK_IMPORTED_MODULE_27__[\"TonemappingOperator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return _tonemapPostProcess__WEBPACK_IMPORTED_MODULE_27__[\"TonemapPostProcess\"]; });\n\n/* harmony import */ var _volumetricLightScatteringPostProcess__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./volumetricLightScatteringPostProcess */ \"./PostProcesses/volumetricLightScatteringPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return _volumetricLightScatteringPostProcess__WEBPACK_IMPORTED_MODULE_28__[\"VolumetricLightScatteringPostProcess\"]; });\n\n/* harmony import */ var _vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./vrDistortionCorrectionPostProcess */ \"./PostProcesses/vrDistortionCorrectionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return _vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_29__[\"VRDistortionCorrectionPostProcess\"]; });\n\n/* harmony import */ var _vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./vrMultiviewToSingleviewPostProcess */ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return _vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_30__[\"VRMultiviewToSingleviewPostProcess\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/motionBlurPostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/motionBlurPostProcess.ts ***!\n \\************************************************/\n/*! exports provided: MotionBlurPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return MotionBlurPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Rendering_geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Rendering/geometryBufferRenderer */ \"./Rendering/geometryBufferRenderer.ts\");\n/* harmony import */ var _Animations_animatable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Animations/animatable */ \"./Animations/animatable.ts\");\n/* harmony import */ var _Rendering_geometryBufferRendererSceneComponent__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Rendering/geometryBufferRendererSceneComponent */ \"./Rendering/geometryBufferRendererSceneComponent.ts\");\n/* harmony import */ var _Shaders_motionBlur_fragment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/motionBlur.fragment */ \"./Shaders/motionBlur.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Motion Blur Post Process which blurs an image based on the objects velocity in scene.\r\n * Velocity can be affected by each object's rotation, position and scale depending on the transformation speed.\r\n * As an example, all you have to do is to create the post-process:\r\n * var mb = new BABYLON.MotionBlurPostProcess(\r\n * 'mb', // The name of the effect.\r\n * scene, // The scene containing the objects to blur according to their velocity.\r\n * 1.0, // The required width/height ratio to downsize to before computing the render pass.\r\n * camera // The camera to apply the render pass to.\r\n * );\r\n * Then, all objects moving, rotating and/or scaling will be blurred depending on the transformation speed.\r\n */\r\nvar MotionBlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MotionBlurPostProcess, _super);\r\n /**\r\n * Creates a new instance MotionBlurPostProcess\r\n * @param name The name of the effect.\r\n * @param scene The scene containing the objects to blur according to their velocity.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function MotionBlurPostProcess(name, scene, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"motionBlur\", [\"motionStrength\", \"motionScale\", \"screenSize\"], [\"velocitySampler\"], options, camera, samplingMode, engine, reusable, \"#define GEOMETRY_SUPPORTED\\n#define SAMPLES 64.0\", textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * Defines how much the image is blurred by the movement. Default value is equal to 1\r\n */\r\n _this.motionStrength = 1;\r\n _this._motionBlurSamples = 32;\r\n _this._geometryBufferRenderer = scene.enableGeometryBufferRenderer();\r\n if (!_this._geometryBufferRenderer) {\r\n // Geometry buffer renderer is not supported. So, work as a passthrough.\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Multiple Render Target support needed to compute object based motion blur\");\r\n _this.updateEffect();\r\n }\r\n else {\r\n // Geometry buffer renderer is supported.\r\n _this._geometryBufferRenderer.enableVelocity = true;\r\n _this.onApply = function (effect) {\r\n effect.setVector2(\"screenSize\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](_this.width, _this.height));\r\n effect.setFloat(\"motionScale\", scene.getAnimationRatio());\r\n effect.setFloat(\"motionStrength\", _this.motionStrength);\r\n if (_this._geometryBufferRenderer) {\r\n var velocityIndex = _this._geometryBufferRenderer.getTextureIndex(_Rendering_geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_5__[\"GeometryBufferRenderer\"].VELOCITY_TEXTURE_TYPE);\r\n effect.setTexture(\"velocitySampler\", _this._geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\r\n }\r\n };\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(MotionBlurPostProcess.prototype, \"motionBlurSamples\", {\r\n /**\r\n * Gets the number of iterations are used for motion blur quality. Default value is equal to 32\r\n */\r\n get: function () {\r\n return this._motionBlurSamples;\r\n },\r\n /**\r\n * Sets the number of iterations to be used for motion blur quality\r\n */\r\n set: function (samples) {\r\n this._motionBlurSamples = samples;\r\n if (this._geometryBufferRenderer) {\r\n this.updateEffect(\"#define GEOMETRY_SUPPORTED\\n#define SAMPLES \" + samples.toFixed(1));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Excludes the given skinned mesh from computing bones velocities.\r\n * Computing bones velocities can have a cost and that cost. The cost can be saved by calling this function and by passing the skinned mesh reference to ignore.\r\n * @param skinnedMesh The mesh containing the skeleton to ignore when computing the velocity map.\r\n */\r\n MotionBlurPostProcess.prototype.excludeSkinnedMesh = function (skinnedMesh) {\r\n if (this._geometryBufferRenderer && skinnedMesh.skeleton) {\r\n this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.push(skinnedMesh);\r\n }\r\n };\r\n /**\r\n * Removes the given skinned mesh from the excluded meshes to integrate bones velocities while rendering the velocity map.\r\n * @param skinnedMesh The mesh containing the skeleton that has been ignored previously.\r\n * @see excludeSkinnedMesh to exclude a skinned mesh from bones velocity computation.\r\n */\r\n MotionBlurPostProcess.prototype.removeExcludedSkinnedMesh = function (skinnedMesh) {\r\n if (this._geometryBufferRenderer && skinnedMesh.skeleton) {\r\n var index = this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.indexOf(skinnedMesh);\r\n if (index !== -1) {\r\n this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.splice(index, 1);\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n MotionBlurPostProcess.prototype.dispose = function (camera) {\r\n if (this._geometryBufferRenderer) {\r\n // Clear previous transformation matrices dictionary used to compute objects velocities\r\n this._geometryBufferRenderer._previousTransformationMatrices = {};\r\n this._geometryBufferRenderer._previousBonesTransformationMatrices = {};\r\n this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity = [];\r\n }\r\n _super.prototype.dispose.call(this, camera);\r\n };\r\n return MotionBlurPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/passPostProcess.ts\":\n/*!******************************************!*\\\n !*** ./PostProcesses/passPostProcess.ts ***!\n \\******************************************/\n/*! exports provided: PassPostProcess, PassCubePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return PassPostProcess; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return PassCubePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Shaders_pass_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/pass.fragment */ \"./Shaders/pass.fragment.ts\");\n/* harmony import */ var _Shaders_passCube_fragment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Shaders/passCube.fragment */ \"./Shaders/passCube.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * PassPostProcess which produces an output the same as it's input\r\n */\r\nvar PassPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PassPostProcess, _super);\r\n /**\r\n * Creates the PassPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function PassPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n return _super.call(this, name, \"pass\", null, null, options, camera, samplingMode, engine, reusable, undefined, textureType, undefined, null, blockCompilation) || this;\r\n }\r\n return PassPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n/**\r\n * PassCubePostProcess which produces an output the same as it's input (which must be a cube texture)\r\n */\r\nvar PassCubePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PassCubePostProcess, _super);\r\n /**\r\n * Creates the PassCubePostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function PassCubePostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"passCube\", null, null, options, camera, samplingMode, engine, reusable, \"#define POSITIVEX\", textureType, undefined, null, blockCompilation) || this;\r\n _this._face = 0;\r\n return _this;\r\n }\r\n Object.defineProperty(PassCubePostProcess.prototype, \"face\", {\r\n /**\r\n * Gets or sets the cube face to display.\r\n * * 0 is +X\r\n * * 1 is -X\r\n * * 2 is +Y\r\n * * 3 is -Y\r\n * * 4 is +Z\r\n * * 5 is -Z\r\n */\r\n get: function () {\r\n return this._face;\r\n },\r\n set: function (value) {\r\n if (value < 0 || value > 5) {\r\n return;\r\n }\r\n this._face = value;\r\n switch (this._face) {\r\n case 0:\r\n this.updateEffect(\"#define POSITIVEX\");\r\n break;\r\n case 1:\r\n this.updateEffect(\"#define NEGATIVEX\");\r\n break;\r\n case 2:\r\n this.updateEffect(\"#define POSITIVEY\");\r\n break;\r\n case 3:\r\n this.updateEffect(\"#define NEGATIVEY\");\r\n break;\r\n case 4:\r\n this.updateEffect(\"#define POSITIVEZ\");\r\n break;\r\n case 5:\r\n this.updateEffect(\"#define NEGATIVEZ\");\r\n break;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PassCubePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"]._RescalePostProcessFactory = function (engine) {\r\n return new PassPostProcess(\"rescale\", 1, null, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURE_BILINEAR_SAMPLINGMODE, engine, false, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/postProcess.ts\":\n/*!**************************************!*\\\n !*** ./PostProcesses/postProcess.ts ***!\n \\**************************************/\n/*! exports provided: PostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return PostProcess; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_postprocess_vertex__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/postprocess.vertex */ \"./Shaders/postprocess.vertex.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * PostProcess can be used to apply a shader to a texture after it has been rendered\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcess = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param name The name of the PostProcess.\r\n * @param fragmentUrl The url of the fragment shader to be used.\r\n * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.\r\n * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param defines String of defines that will be set when running the fragment shader. (default: null)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param vertexUrl The url of the vertex shader to be used. (default: \"postprocess\")\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param blockCompilation If the shader should not be compiled imediatly. (default: false)\r\n */\r\n function PostProcess(\r\n /** Name of the PostProcess. */\r\n name, fragmentUrl, parameters, samplers, options, camera, samplingMode, engine, reusable, defines, textureType, vertexUrl, indexParameters, blockCompilation) {\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE; }\r\n if (defines === void 0) { defines = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (vertexUrl === void 0) { vertexUrl = \"postprocess\"; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n this.name = name;\r\n /**\r\n * Width of the texture to apply the post process on\r\n */\r\n this.width = -1;\r\n /**\r\n * Height of the texture to apply the post process on\r\n */\r\n this.height = -1;\r\n /**\r\n * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)\r\n * @hidden\r\n */\r\n this._outputTexture = null;\r\n /**\r\n * If the buffer needs to be cleared before applying the post process. (default: true)\r\n * Should be set to false if shader will overwrite all previous pixels.\r\n */\r\n this.autoClear = true;\r\n /**\r\n * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)\r\n */\r\n this.alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALPHA_DISABLE;\r\n /**\r\n * Animations to be used for the post processing\r\n */\r\n this.animations = new Array();\r\n /**\r\n * Enable Pixel Perfect mode where texture is not scaled to be power of 2.\r\n * Can only be used on a single postprocess or on the last one of a chain. (default: false)\r\n */\r\n this.enablePixelPerfectMode = false;\r\n /**\r\n * Force the postprocess to be applied without taking in account viewport\r\n */\r\n this.forceFullscreenViewport = true;\r\n /**\r\n * Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 1 | SCALEMODE_FLOOR | [engine.scalemode_floor](http://doc.babylonjs.com/api/classes/babylon.engine#scalemode_floor) |\r\n * | 2 | SCALEMODE_NEAREST | [engine.scalemode_nearest](http://doc.babylonjs.com/api/classes/babylon.engine#scalemode_nearest) |\r\n * | 3 | SCALEMODE_CEILING | [engine.scalemode_ceiling](http://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |\r\n *\r\n */\r\n this.scaleMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].SCALEMODE_FLOOR;\r\n /**\r\n * Force textures to be a power of two (default: false)\r\n */\r\n this.alwaysForcePOT = false;\r\n this._samples = 1;\r\n /**\r\n * Modify the scale of the post process to be the same as the viewport (default: false)\r\n */\r\n this.adaptScaleToCurrentViewport = false;\r\n this._reusable = false;\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @hidden\r\n */\r\n this._textures = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](2);\r\n /**\r\n * The index in _textures that corresponds to the output texture.\r\n * @hidden\r\n */\r\n this._currentRenderTextureInd = 0;\r\n this._scaleRatio = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](1, 1);\r\n this._texelSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"].Zero();\r\n // Events\r\n /**\r\n * An event triggered when the postprocess is activated.\r\n */\r\n this.onActivateObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the postprocess changes its size.\r\n */\r\n this.onSizeChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the postprocess applies its effect.\r\n */\r\n this.onApplyObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering the postprocess\r\n */\r\n this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the postprocess\r\n */\r\n this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n if (camera != null) {\r\n this._camera = camera;\r\n this._scene = camera.getScene();\r\n camera.attachPostProcess(this);\r\n this._engine = this._scene.getEngine();\r\n this._scene.postProcesses.push(this);\r\n this.uniqueId = this._scene.getUniqueId();\r\n }\r\n else if (engine) {\r\n this._engine = engine;\r\n this._engine.postProcesses.push(this);\r\n }\r\n this._options = options;\r\n this.renderTargetSamplingMode = samplingMode ? samplingMode : _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n this._reusable = reusable || false;\r\n this._textureType = textureType;\r\n this._samplers = samplers || [];\r\n this._samplers.push(\"textureSampler\");\r\n this._fragmentUrl = fragmentUrl;\r\n this._vertexUrl = vertexUrl;\r\n this._parameters = parameters || [];\r\n this._parameters.push(\"scale\");\r\n this._indexParameters = indexParameters;\r\n if (!blockCompilation) {\r\n this.updateEffect(defines);\r\n }\r\n }\r\n Object.defineProperty(PostProcess.prototype, \"samples\", {\r\n /**\r\n * Number of sample textures (default: 1)\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (n) {\r\n var _this = this;\r\n this._samples = Math.min(n, this._engine.getCaps().maxMSAASamples);\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this._samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this._samples);\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the fragment url or shader name used in the post process.\r\n * @returns the fragment url or name in the shader store.\r\n */\r\n PostProcess.prototype.getEffectName = function () {\r\n return this._fragmentUrl;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"onActivate\", {\r\n /**\r\n * A function that is added to the onActivateObservable\r\n */\r\n set: function (callback) {\r\n if (this._onActivateObserver) {\r\n this.onActivateObservable.remove(this._onActivateObserver);\r\n }\r\n if (callback) {\r\n this._onActivateObserver = this.onActivateObservable.add(callback);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onSizeChanged\", {\r\n /**\r\n * A function that is added to the onSizeChangedObservable\r\n */\r\n set: function (callback) {\r\n if (this._onSizeChangedObserver) {\r\n this.onSizeChangedObservable.remove(this._onSizeChangedObserver);\r\n }\r\n this._onSizeChangedObserver = this.onSizeChangedObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onApply\", {\r\n /**\r\n * A function that is added to the onApplyObservable\r\n */\r\n set: function (callback) {\r\n if (this._onApplyObserver) {\r\n this.onApplyObservable.remove(this._onApplyObserver);\r\n }\r\n this._onApplyObserver = this.onApplyObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onBeforeRender\", {\r\n /**\r\n * A function that is added to the onBeforeRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onAfterRender\", {\r\n /**\r\n * A function that is added to the onAfterRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"inputTexture\", {\r\n /**\r\n * The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will\r\n * render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.\r\n */\r\n get: function () {\r\n return this._textures.data[this._currentRenderTextureInd];\r\n },\r\n set: function (value) {\r\n this._forcedOutputTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the camera which post process is applied to.\r\n * @returns The camera the post process is applied to.\r\n */\r\n PostProcess.prototype.getCamera = function () {\r\n return this._camera;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"texelSize\", {\r\n /**\r\n * Gets the texel size of the postprocess.\r\n * See https://en.wikipedia.org/wiki/Texel_(graphics)\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.texelSize;\r\n }\r\n if (this._forcedOutputTexture) {\r\n this._texelSize.copyFromFloats(1.0 / this._forcedOutputTexture.width, 1.0 / this._forcedOutputTexture.height);\r\n }\r\n return this._texelSize;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"PostProcess\" string\r\n */\r\n PostProcess.prototype.getClassName = function () {\r\n return \"PostProcess\";\r\n };\r\n /**\r\n * Gets the engine which this post process belongs to.\r\n * @returns The engine the post process was enabled with.\r\n */\r\n PostProcess.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the the postprocess.\r\n */\r\n PostProcess.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.\r\n * @param postProcess The post process to share the output with.\r\n * @returns This post process.\r\n */\r\n PostProcess.prototype.shareOutputWith = function (postProcess) {\r\n this._disposeTextures();\r\n this._shareOutputWithPostProcess = postProcess;\r\n return this;\r\n };\r\n /**\r\n * Reverses the effect of calling shareOutputWith and returns the post process back to its original state.\r\n * This should be called if the post process that shares output with this post process is disabled/disposed.\r\n */\r\n PostProcess.prototype.useOwnOutput = function () {\r\n if (this._textures.length == 0) {\r\n this._textures = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](2);\r\n }\r\n this._shareOutputWithPostProcess = null;\r\n };\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n */\r\n PostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n this._effect = this._engine.createEffect({ vertex: this._vertexUrl, fragment: this._fragmentUrl }, [\"position\"], uniforms || this._parameters, samplers || this._samplers, defines !== null ? defines : \"\", undefined, onCompiled, onError, indexParameters || this._indexParameters);\r\n };\r\n /**\r\n * The post process is reusable if it can be used multiple times within one frame.\r\n * @returns If the post process is reusable\r\n */\r\n PostProcess.prototype.isReusable = function () {\r\n return this._reusable;\r\n };\r\n /** invalidate frameBuffer to hint the postprocess to create a depth buffer */\r\n PostProcess.prototype.markTextureDirty = function () {\r\n this.width = -1;\r\n };\r\n /**\r\n * Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable.\r\n * When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.\r\n * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.\r\n * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)\r\n * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)\r\n * @returns The target texture that was bound to be written to.\r\n */\r\n PostProcess.prototype.activate = function (camera, sourceTexture, forceDepthStencil) {\r\n var _this = this;\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n camera = camera || this._camera;\r\n var scene = camera.getScene();\r\n var engine = scene.getEngine();\r\n var maxSize = engine.getCaps().maxTextureSize;\r\n var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;\r\n var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;\r\n // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen\r\n var webVRCamera = camera.parent;\r\n if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {\r\n requiredWidth /= 2;\r\n }\r\n var desiredWidth = (this._options.width || requiredWidth);\r\n var desiredHeight = this._options.height || requiredHeight;\r\n if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {\r\n if (this.adaptScaleToCurrentViewport) {\r\n var currentViewport = engine.currentViewport;\r\n if (currentViewport) {\r\n desiredWidth *= currentViewport.width;\r\n desiredHeight *= currentViewport.height;\r\n }\r\n }\r\n if (this.renderTargetSamplingMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE || this.alwaysForcePOT) {\r\n if (!this._options.width) {\r\n desiredWidth = engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;\r\n }\r\n if (!this._options.height) {\r\n desiredHeight = engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(desiredHeight, maxSize, this.scaleMode) : desiredHeight;\r\n }\r\n }\r\n if (this.width !== desiredWidth || this.height !== desiredHeight) {\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n this._textures.reset();\r\n }\r\n this.width = desiredWidth;\r\n this.height = desiredHeight;\r\n var textureSize = { width: this.width, height: this.height };\r\n var textureOptions = {\r\n generateMipMaps: false,\r\n generateDepthBuffer: forceDepthStencil || camera._postProcesses.indexOf(this) === 0,\r\n generateStencilBuffer: (forceDepthStencil || camera._postProcesses.indexOf(this) === 0) && this._engine.isStencilEnable,\r\n samplingMode: this.renderTargetSamplingMode,\r\n type: this._textureType\r\n };\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n if (this._reusable) {\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n }\r\n this._texelSize.copyFromFloats(1.0 / this.width, 1.0 / this.height);\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n }\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this.samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this.samples);\r\n }\r\n });\r\n }\r\n var target;\r\n if (this._shareOutputWithPostProcess) {\r\n target = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n target = this._forcedOutputTexture;\r\n this.width = this._forcedOutputTexture.width;\r\n this.height = this._forcedOutputTexture.height;\r\n }\r\n else {\r\n target = this.inputTexture;\r\n }\r\n // Bind the input of this post process to be used as the output of the previous post process.\r\n if (this.enablePixelPerfectMode) {\r\n this._scaleRatio.copyFromFloats(requiredWidth / desiredWidth, requiredHeight / desiredHeight);\r\n this._engine.bindFramebuffer(target, 0, requiredWidth, requiredHeight, this.forceFullscreenViewport);\r\n }\r\n else {\r\n this._scaleRatio.copyFromFloats(1, 1);\r\n this._engine.bindFramebuffer(target, 0, undefined, undefined, this.forceFullscreenViewport);\r\n }\r\n this.onActivateObservable.notifyObservers(camera);\r\n // Clear\r\n if (this.autoClear && this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALPHA_DISABLE) {\r\n this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);\r\n }\r\n if (this._reusable) {\r\n this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;\r\n }\r\n return target;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"isSupported\", {\r\n /**\r\n * If the post process is supported.\r\n */\r\n get: function () {\r\n return this._effect.isSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"aspectRatio\", {\r\n /**\r\n * The aspect ratio of the output texture.\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.aspectRatio;\r\n }\r\n if (this._forcedOutputTexture) {\r\n return this._forcedOutputTexture.width / this._forcedOutputTexture.height;\r\n }\r\n return this.width / this.height;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get a value indicating if the post-process is ready to be used\r\n * @returns true if the post-process is ready (shader is compiled)\r\n */\r\n PostProcess.prototype.isReady = function () {\r\n return this._effect && this._effect.isReady();\r\n };\r\n /**\r\n * Binds all textures and uniforms to the shader, this will be run on every pass.\r\n * @returns the effect corresponding to this post process. Null if not compiled or not ready.\r\n */\r\n PostProcess.prototype.apply = function () {\r\n // Check\r\n if (!this._effect || !this._effect.isReady()) {\r\n return null;\r\n }\r\n // States\r\n this._engine.enableEffect(this._effect);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n // Alpha\r\n this._engine.setAlphaMode(this.alphaMode);\r\n if (this.alphaConstants) {\r\n this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a);\r\n }\r\n // Bind the output texture of the preivous post process as the input to this post process.\r\n var source;\r\n if (this._shareOutputWithPostProcess) {\r\n source = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n source = this._forcedOutputTexture;\r\n }\r\n else {\r\n source = this.inputTexture;\r\n }\r\n this._effect._bindTexture(\"textureSampler\", source);\r\n // Parameters\r\n this._effect.setVector2(\"scale\", this._scaleRatio);\r\n this.onApplyObservable.notifyObservers(this._effect);\r\n return this._effect;\r\n };\r\n PostProcess.prototype._disposeTextures = function () {\r\n if (this._shareOutputWithPostProcess || this._forcedOutputTexture) {\r\n return;\r\n }\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n }\r\n this._textures.dispose();\r\n };\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n PostProcess.prototype.dispose = function (camera) {\r\n camera = camera || this._camera;\r\n this._disposeTextures();\r\n if (this._scene) {\r\n var index_1 = this._scene.postProcesses.indexOf(this);\r\n if (index_1 !== -1) {\r\n this._scene.postProcesses.splice(index_1, 1);\r\n }\r\n }\r\n else {\r\n var index_2 = this._engine.postProcesses.indexOf(this);\r\n if (index_2 !== -1) {\r\n this._engine.postProcesses.splice(index_2, 1);\r\n }\r\n }\r\n if (!camera) {\r\n return;\r\n }\r\n camera.detachPostProcess(this);\r\n var index = camera._postProcesses.indexOf(this);\r\n if (index === 0 && camera._postProcesses.length > 0) {\r\n var firstPostProcess = this._camera._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n }\r\n this.onActivateObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onApplyObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n };\r\n return PostProcess;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/postProcessManager.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/postProcessManager.ts ***!\n \\*********************************************/\n/*! exports provided: PostProcessManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return PostProcessManager; });\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n/**\r\n * PostProcessManager is used to manage one or more post processes or post process pipelines\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcessManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param scene The scene that the post process is associated with.\r\n */\r\n function PostProcessManager(scene) {\r\n this._vertexBuffers = {};\r\n this._scene = scene;\r\n }\r\n PostProcessManager.prototype._prepareBuffers = function () {\r\n if (this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind]) {\r\n return;\r\n }\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](this._scene.getEngine(), vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n this._buildIndexBuffer();\r\n };\r\n PostProcessManager.prototype._buildIndexBuffer = function () {\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);\r\n };\r\n /**\r\n * Rebuilds the vertex buffers of the manager.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (!vb) {\r\n return;\r\n }\r\n vb._rebuild();\r\n this._buildIndexBuffer();\r\n };\r\n // Methods\r\n /**\r\n * Prepares a frame to be run through a post process.\r\n * @param sourceTexture The input texture to the post procesess. (default: null)\r\n * @param postProcesses An array of post processes to be run. (default: null)\r\n * @returns True if the post processes were able to be run.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._prepareFrame = function (sourceTexture, postProcesses) {\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n if (postProcesses === void 0) { postProcesses = null; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return false;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (!postProcesses || postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return false;\r\n }\r\n postProcesses[0].activate(camera, sourceTexture, postProcesses !== null && postProcesses !== undefined);\r\n return true;\r\n };\r\n /**\r\n * Manually render a set of post processes to a texture.\r\n * @param postProcesses An array of post processes to be run.\r\n * @param targetTexture The target texture to render to.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight\r\n * @param faceIndex defines the face to render to if a cubemap is defined as the target\r\n * @param lodLevel defines which lod of the texture to render to\r\n */\r\n PostProcessManager.prototype.directRender = function (postProcesses, targetTexture, forceFullscreenViewport, faceIndex, lodLevel) {\r\n if (targetTexture === void 0) { targetTexture = null; }\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0; index < postProcesses.length; index++) {\r\n if (index < postProcesses.length - 1) {\r\n postProcesses[index + 1].activate(this._scene.activeCamera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport, undefined, lodLevel);\r\n }\r\n else {\r\n engine.restoreDefaultFramebuffer();\r\n }\r\n }\r\n var pp = postProcesses[index];\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_0__[\"Material\"].TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore depth buffer\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n };\r\n /**\r\n * Finalize the result of the output of the postprocesses.\r\n * @param doNotPresent If true the result will not be displayed to the screen.\r\n * @param targetTexture The target texture to render to.\r\n * @param faceIndex The index of the face to bind the target texture to.\r\n * @param postProcesses The array of post processes to render.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight (default: false)\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._finalizeFrame = function (doNotPresent, targetTexture, faceIndex, postProcesses, forceFullscreenViewport) {\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0, len = postProcesses.length; index < len; index++) {\r\n var pp = postProcesses[index];\r\n if (index < len - 1) {\r\n pp._outputTexture = postProcesses[index + 1].activate(camera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport);\r\n pp._outputTexture = targetTexture;\r\n }\r\n else {\r\n engine.restoreDefaultFramebuffer();\r\n pp._outputTexture = null;\r\n }\r\n }\r\n if (doNotPresent) {\r\n break;\r\n }\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_0__[\"Material\"].TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore states\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n };\r\n /**\r\n * Disposes of the post process manager.\r\n */\r\n PostProcessManager.prototype.dispose = function () {\r\n var buffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n };\r\n return PostProcessManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/refractionPostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/refractionPostProcess.ts ***!\n \\************************************************/\n/*! exports provided: RefractionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return RefractionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_refraction_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/refraction.fragment */ \"./Shaders/refraction.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Post process which applies a refractin texture\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#refraction\r\n */\r\nvar RefractionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RefractionPostProcess, _super);\r\n /**\r\n * Initializes the RefractionPostProcess\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#refraction\r\n * @param name The name of the effect.\r\n * @param refractionTextureUrl Url of the refraction texture to use\r\n * @param color the base color of the refraction (used to taint the rendering)\r\n * @param depth simulated refraction depth\r\n * @param colorLevel the coefficient of the base color (0 to remove base color tainting)\r\n * @param camera The camera to apply the render pass to.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function RefractionPostProcess(name, refractionTextureUrl, \r\n /** the base color of the refraction (used to taint the rendering) */\r\n color, \r\n /** simulated refraction depth */\r\n depth, \r\n /** the coefficient of the base color (0 to remove base color tainting) */\r\n colorLevel, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"refraction\", [\"baseColor\", \"depth\", \"colorLevel\"], [\"refractionSampler\"], options, camera, samplingMode, engine, reusable) || this;\r\n _this.color = color;\r\n _this.depth = depth;\r\n _this.colorLevel = colorLevel;\r\n _this._ownRefractionTexture = true;\r\n _this.onActivateObservable.add(function (cam) {\r\n _this._refTexture = _this._refTexture || new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](refractionTextureUrl, cam.getScene());\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setColor3(\"baseColor\", _this.color);\r\n effect.setFloat(\"depth\", _this.depth);\r\n effect.setFloat(\"colorLevel\", _this.colorLevel);\r\n effect.setTexture(\"refractionSampler\", _this._refTexture);\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(RefractionPostProcess.prototype, \"refractionTexture\", {\r\n /**\r\n * Gets or sets the refraction texture\r\n * Please note that you are responsible for disposing the texture if you set it manually\r\n */\r\n get: function () {\r\n return this._refTexture;\r\n },\r\n set: function (value) {\r\n if (this._refTexture && this._ownRefractionTexture) {\r\n this._refTexture.dispose();\r\n }\r\n this._refTexture = value;\r\n this._ownRefractionTexture = false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Disposes of the post process\r\n * @param camera Camera to dispose post process on\r\n */\r\n RefractionPostProcess.prototype.dispose = function (camera) {\r\n if (this._refTexture && this._ownRefractionTexture) {\r\n this._refTexture.dispose();\r\n this._refTexture = null;\r\n }\r\n _super.prototype.dispose.call(this, camera);\r\n };\r\n return RefractionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/sharpenPostProcess.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/sharpenPostProcess.ts ***!\n \\*********************************************/\n/*! exports provided: SharpenPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return SharpenPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_sharpen_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/sharpen.fragment */ \"./Shaders/sharpen.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The SharpenPostProcess applies a sharpen kernel to every pixel\r\n * See http://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\nvar SharpenPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SharpenPostProcess, _super);\r\n /**\r\n * Creates a new instance ConvolutionPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function SharpenPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"sharpen\", [\"sharpnessAmounts\", \"screenSize\"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * How much of the original color should be applied. Setting this to 0 will display edge detection. (default: 1)\r\n */\r\n _this.colorAmount = 1.0;\r\n /**\r\n * How much sharpness should be applied (default: 0.3)\r\n */\r\n _this.edgeAmount = 0.3;\r\n _this.onApply = function (effect) {\r\n effect.setFloat2(\"screenSize\", _this.width, _this.height);\r\n effect.setFloat2(\"sharpnessAmounts\", _this.edgeAmount, _this.colorAmount);\r\n };\r\n return _this;\r\n }\r\n return SharpenPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/stereoscopicInterlacePostProcess.ts\":\n/*!***********************************************************!*\\\n !*** ./PostProcesses/stereoscopicInterlacePostProcess.ts ***!\n \\***********************************************************/\n/*! exports provided: StereoscopicInterlacePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return StereoscopicInterlacePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_stereoscopicInterlace_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/stereoscopicInterlace.fragment */ \"./Shaders/stereoscopicInterlace.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * StereoscopicInterlacePostProcess used to render stereo views from a rigged camera\r\n */\r\nvar StereoscopicInterlacePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicInterlacePostProcess, _super);\r\n /**\r\n * Initializes a StereoscopicInterlacePostProcess\r\n * @param name The name of the effect.\r\n * @param rigCameras The rig cameras to be appled to the post process\r\n * @param isStereoscopicHoriz If the rendered results are horizontal or verticle\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function StereoscopicInterlacePostProcess(name, rigCameras, isStereoscopicHoriz, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"stereoscopicInterlace\", ['stepSize'], ['camASampler'], 1, rigCameras[1], samplingMode, engine, reusable, isStereoscopicHoriz ? \"#define IS_STEREOSCOPIC_HORIZ 1\" : undefined) || this;\r\n _this._passedProcess = rigCameras[0]._rigPostProcess;\r\n _this._stepSize = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1 / _this.width, 1 / _this.height);\r\n _this.onSizeChangedObservable.add(function () {\r\n _this._stepSize = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1 / _this.width, 1 / _this.height);\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"camASampler\", _this._passedProcess);\r\n effect.setFloat2(\"stepSize\", _this._stepSize.x, _this._stepSize.y);\r\n });\r\n return _this;\r\n }\r\n return StereoscopicInterlacePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/tonemapPostProcess.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/tonemapPostProcess.ts ***!\n \\*********************************************/\n/*! exports provided: TonemappingOperator, TonemapPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return TonemappingOperator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return TonemapPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_tonemap_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/tonemap.fragment */ \"./Shaders/tonemap.fragment.ts\");\n\r\n\r\n\r\n\r\n/** Defines operator used for tonemapping */\r\nvar TonemappingOperator;\r\n(function (TonemappingOperator) {\r\n /** Hable */\r\n TonemappingOperator[TonemappingOperator[\"Hable\"] = 0] = \"Hable\";\r\n /** Reinhard */\r\n TonemappingOperator[TonemappingOperator[\"Reinhard\"] = 1] = \"Reinhard\";\r\n /** HejiDawson */\r\n TonemappingOperator[TonemappingOperator[\"HejiDawson\"] = 2] = \"HejiDawson\";\r\n /** Photographic */\r\n TonemappingOperator[TonemappingOperator[\"Photographic\"] = 3] = \"Photographic\";\r\n})(TonemappingOperator || (TonemappingOperator = {}));\r\n/**\r\n * Defines a post process to apply tone mapping\r\n */\r\nvar TonemapPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TonemapPostProcess, _super);\r\n /**\r\n * Creates a new TonemapPostProcess\r\n * @param name defines the name of the postprocess\r\n * @param _operator defines the operator to use\r\n * @param exposureAdjustment defines the required exposure adjustement\r\n * @param camera defines the camera to use (can be null)\r\n * @param samplingMode defines the required sampling mode (BABYLON.Texture.BILINEAR_SAMPLINGMODE by default)\r\n * @param engine defines the hosting engine (can be ignore if camera is set)\r\n * @param textureFormat defines the texture format to use (BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n */\r\n function TonemapPostProcess(name, _operator, \r\n /** Defines the required exposure adjustement */\r\n exposureAdjustment, camera, samplingMode, engine, textureFormat) {\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE; }\r\n if (textureFormat === void 0) { textureFormat = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"tonemap\", [\"_ExposureAdjustment\"], null, 1.0, camera, samplingMode, engine, true, null, textureFormat) || this;\r\n _this._operator = _operator;\r\n _this.exposureAdjustment = exposureAdjustment;\r\n var defines = \"#define \";\r\n if (_this._operator === TonemappingOperator.Hable) {\r\n defines += \"HABLE_TONEMAPPING\";\r\n }\r\n else if (_this._operator === TonemappingOperator.Reinhard) {\r\n defines += \"REINHARD_TONEMAPPING\";\r\n }\r\n else if (_this._operator === TonemappingOperator.HejiDawson) {\r\n defines += \"OPTIMIZED_HEJIDAWSON_TONEMAPPING\";\r\n }\r\n else if (_this._operator === TonemappingOperator.Photographic) {\r\n defines += \"PHOTOGRAPHIC_TONEMAPPING\";\r\n }\r\n //sadly a second call to create the effect.\r\n _this.updateEffect(defines);\r\n _this.onApply = function (effect) {\r\n effect.setFloat(\"_ExposureAdjustment\", _this.exposureAdjustment);\r\n };\r\n return _this;\r\n }\r\n return TonemapPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/volumetricLightScatteringPostProcess.ts\":\n/*!***************************************************************!*\\\n !*** ./PostProcesses/volumetricLightScatteringPostProcess.ts ***!\n \\***************************************************************/\n/*! exports provided: VolumetricLightScatteringPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return VolumetricLightScatteringPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Shaders_depth_vertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/depth.vertex */ \"./Shaders/depth.vertex.ts\");\n/* harmony import */ var _Shaders_volumetricLightScattering_fragment__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Shaders/volumetricLightScattering.fragment */ \"./Shaders/volumetricLightScattering.fragment.ts\");\n/* harmony import */ var _Shaders_volumetricLightScatteringPass_vertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Shaders/volumetricLightScatteringPass.vertex */ \"./Shaders/volumetricLightScatteringPass.vertex.ts\");\n/* harmony import */ var _Shaders_volumetricLightScatteringPass_fragment__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Shaders/volumetricLightScatteringPass.fragment */ \"./Shaders/volumetricLightScatteringPass.fragment.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Inspired by http://http.developer.nvidia.com/GPUGems3/gpugems3_ch13.html\r\n */\r\nvar VolumetricLightScatteringPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VolumetricLightScatteringPostProcess, _super);\r\n /**\r\n * @constructor\r\n * @param name The post-process name\r\n * @param ratio The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)\r\n * @param camera The camera that the post-process will be attached to\r\n * @param mesh The mesh used to create the light scattering\r\n * @param samples The post-process quality, default 100\r\n * @param samplingModeThe post-process filtering mode\r\n * @param engine The babylon engine\r\n * @param reusable If the post-process is reusable\r\n * @param scene The constructor needs a scene reference to initialize internal components. If \"camera\" is null a \"scene\" must be provided\r\n */\r\n function VolumetricLightScatteringPostProcess(name, ratio, camera, mesh, samples, samplingMode, engine, reusable, scene) {\r\n if (samples === void 0) { samples = 100; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n var _this = _super.call(this, name, \"volumetricLightScattering\", [\"decay\", \"exposure\", \"weight\", \"meshPositionOnScreen\", \"density\"], [\"lightScatteringSampler\"], ratio.postProcessRatio || ratio, camera, samplingMode, engine, reusable, \"#define NUM_SAMPLES \" + samples) || this;\r\n _this._screenCoordinates = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n /**\r\n * Custom position of the mesh. Used if \"useCustomMeshPosition\" is set to \"true\"\r\n */\r\n _this.customMeshPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n /**\r\n * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)\r\n */\r\n _this.useCustomMeshPosition = false;\r\n /**\r\n * If the post-process should inverse the light scattering direction\r\n */\r\n _this.invert = true;\r\n /**\r\n * Array containing the excluded meshes not rendered in the internal pass\r\n */\r\n _this.excludedMeshes = new Array();\r\n /**\r\n * Controls the overall intensity of the post-process\r\n */\r\n _this.exposure = 0.3;\r\n /**\r\n * Dissipates each sample's contribution in range [0, 1]\r\n */\r\n _this.decay = 0.96815;\r\n /**\r\n * Controls the overall intensity of each sample\r\n */\r\n _this.weight = 0.58767;\r\n /**\r\n * Controls the density of each sample\r\n */\r\n _this.density = 0.926;\r\n scene = ((camera === null) ? scene : camera.getScene()); // parameter \"scene\" can be null.\r\n engine = scene.getEngine();\r\n _this._viewPort = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_20__[\"Viewport\"](0, 0, 1, 1).toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n // Configure mesh\r\n _this.mesh = ((mesh !== null) ? mesh : VolumetricLightScatteringPostProcess.CreateDefaultMesh(\"VolumetricLightScatteringMesh\", scene));\r\n // Configure\r\n _this._createPass(scene, ratio.passRatio || ratio);\r\n _this.onActivate = function (camera) {\r\n if (!_this.isSupported) {\r\n _this.dispose(camera);\r\n }\r\n _this.onActivate = null;\r\n };\r\n _this.onApplyObservable.add(function (effect) {\r\n _this._updateMeshScreenCoordinates(scene);\r\n effect.setTexture(\"lightScatteringSampler\", _this._volumetricLightScatteringRTT);\r\n effect.setFloat(\"exposure\", _this.exposure);\r\n effect.setFloat(\"decay\", _this.decay);\r\n effect.setFloat(\"weight\", _this.weight);\r\n effect.setFloat(\"density\", _this.density);\r\n effect.setVector2(\"meshPositionOnScreen\", _this._screenCoordinates);\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(VolumetricLightScatteringPostProcess.prototype, \"useDiffuseColor\", {\r\n /**\r\n * @hidden\r\n * VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\r\n */\r\n get: function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\");\r\n return false;\r\n },\r\n set: function (useDiffuseColor) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"VolumetricLightScatteringPostProcess\"\r\n * @returns \"VolumetricLightScatteringPostProcess\"\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.getClassName = function () {\r\n return \"VolumetricLightScatteringPostProcess\";\r\n };\r\n VolumetricLightScatteringPostProcess.prototype._isReady = function (subMesh, useInstances) {\r\n var mesh = subMesh.getMesh();\r\n // Render this.mesh as default\r\n if (mesh === this.mesh && mesh.material) {\r\n return mesh.material.isReady(mesh);\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n var material = subMesh.getMaterial();\r\n // Alpha test\r\n if (material) {\r\n if (material.needAlphaTesting()) {\r\n defines.push(\"#define ALPHATEST\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].MatricesWeightsKind);\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? (mesh.skeleton.bones.length + 1) : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._volumetricLightScatteringPass = mesh.getScene().getEngine().createEffect(\"volumetricLightScatteringPass\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { maxSimultaneousMorphTargets: mesh.numBoneInfluencers });\r\n }\r\n return this._volumetricLightScatteringPass.isReady();\r\n };\r\n /**\r\n * Sets the new light position for light scattering effect\r\n * @param position The new custom light position\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.setCustomMeshPosition = function (position) {\r\n this.customMeshPosition = position;\r\n };\r\n /**\r\n * Returns the light position for light scattering effect\r\n * @return Vector3 The custom light position\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.getCustomMeshPosition = function () {\r\n return this.customMeshPosition;\r\n };\r\n /**\r\n * Disposes the internal assets and detaches the post-process from the camera\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.dispose = function (camera) {\r\n var rttIndex = camera.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);\r\n if (rttIndex !== -1) {\r\n camera.getScene().customRenderTargets.splice(rttIndex, 1);\r\n }\r\n this._volumetricLightScatteringRTT.dispose();\r\n _super.prototype.dispose.call(this, camera);\r\n };\r\n /**\r\n * Returns the render target texture used by the post-process\r\n * @return the render target texture used by the post-process\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.getPass = function () {\r\n return this._volumetricLightScatteringRTT;\r\n };\r\n // Private methods\r\n VolumetricLightScatteringPostProcess.prototype._meshExcluded = function (mesh) {\r\n if (this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n VolumetricLightScatteringPostProcess.prototype._createPass = function (scene, ratio) {\r\n var _this = this;\r\n var engine = scene.getEngine();\r\n this._volumetricLightScatteringRTT = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_11__[\"RenderTargetTexture\"](\"volumetricLightScatteringMap\", { width: engine.getRenderWidth() * ratio, height: engine.getRenderHeight() * ratio }, scene, false, true, _Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._volumetricLightScatteringRTT.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._volumetricLightScatteringRTT.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._volumetricLightScatteringRTT.renderList = null;\r\n this._volumetricLightScatteringRTT.renderParticles = false;\r\n this._volumetricLightScatteringRTT.ignoreCameraViewport = true;\r\n var camera = this.getCamera();\r\n if (camera) {\r\n camera.customRenderTargets.push(this._volumetricLightScatteringRTT);\r\n }\r\n else {\r\n scene.customRenderTargets.push(this._volumetricLightScatteringRTT);\r\n }\r\n // Custom render function for submeshes\r\n var renderSubMesh = function (subMesh) {\r\n var mesh = subMesh.getRenderingMesh();\r\n if (_this._meshExcluded(mesh)) {\r\n return;\r\n }\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n var engine = scene.getEngine();\r\n // Culling\r\n engine.setState(material.backFaceCulling);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);\r\n if (_this._isReady(subMesh, hardwareInstancedRendering)) {\r\n var effect = _this._volumetricLightScatteringPass;\r\n if (mesh === _this.mesh) {\r\n if (subMesh.effect) {\r\n effect = subMesh.effect;\r\n }\r\n else {\r\n effect = material.getEffect();\r\n }\r\n }\r\n engine.enableEffect(effect);\r\n mesh._bind(subMesh, effect, _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode);\r\n if (mesh === _this.mesh) {\r\n material.bind(mesh.getWorldMatrix(), mesh);\r\n }\r\n else {\r\n _this._volumetricLightScatteringPass.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n _this._volumetricLightScatteringPass.setTexture(\"diffuseSampler\", alphaTexture);\r\n if (alphaTexture) {\r\n _this._volumetricLightScatteringPass.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n _this._volumetricLightScatteringPass.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n }\r\n }\r\n // Draw\r\n mesh._processRendering(subMesh, _this._volumetricLightScatteringPass, _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return effect.setMatrix(\"world\", world); });\r\n }\r\n };\r\n // Render target texture callbacks\r\n var savedSceneClearColor;\r\n var sceneClearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_19__[\"Color4\"](0.0, 0.0, 0.0, 1.0);\r\n this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function () {\r\n savedSceneClearColor = scene.clearColor;\r\n scene.clearColor = sceneClearColor;\r\n });\r\n this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function () {\r\n scene.clearColor = savedSceneClearColor;\r\n });\r\n this._volumetricLightScatteringRTT.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var engine = scene.getEngine();\r\n var index;\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n if (transparentSubMeshes.length) {\r\n // Sort sub meshes\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n var submesh = transparentSubMeshes.data[index];\r\n var boundingInfo = submesh.getBoundingInfo();\r\n if (boundingInfo && scene.activeCamera) {\r\n submesh._alphaIndex = submesh.getMesh().alphaIndex;\r\n submesh._distanceToCamera = boundingInfo.boundingSphere.centerWorld.subtract(scene.activeCamera.position).length();\r\n }\r\n }\r\n var sortedArray = transparentSubMeshes.data.slice(0, transparentSubMeshes.length);\r\n sortedArray.sort(function (a, b) {\r\n // Alpha index first\r\n if (a._alphaIndex > b._alphaIndex) {\r\n return 1;\r\n }\r\n if (a._alphaIndex < b._alphaIndex) {\r\n return -1;\r\n }\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return 1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n // Render sub meshes\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].ALPHA_COMBINE);\r\n for (index = 0; index < sortedArray.length; index++) {\r\n renderSubMesh(sortedArray[index]);\r\n }\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n };\r\n };\r\n VolumetricLightScatteringPostProcess.prototype._updateMeshScreenCoordinates = function (scene) {\r\n var transform = scene.getTransformMatrix();\r\n var meshPosition;\r\n if (this.useCustomMeshPosition) {\r\n meshPosition = this.customMeshPosition;\r\n }\r\n else if (this.attachedNode) {\r\n meshPosition = this.attachedNode.position;\r\n }\r\n else {\r\n meshPosition = this.mesh.parent ? this.mesh.getAbsolutePosition() : this.mesh.position;\r\n }\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Project(meshPosition, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity(), transform, this._viewPort);\r\n this._screenCoordinates.x = pos.x / this._viewPort.width;\r\n this._screenCoordinates.y = pos.y / this._viewPort.height;\r\n if (this.invert) {\r\n this._screenCoordinates.y = 1.0 - this._screenCoordinates.y;\r\n }\r\n };\r\n // Static methods\r\n /**\r\n * Creates a default mesh for the Volumeric Light Scattering post-process\r\n * @param name The mesh name\r\n * @param scene The scene where to create the mesh\r\n * @return the default mesh\r\n */\r\n VolumetricLightScatteringPostProcess.CreateDefaultMesh = function (name, scene) {\r\n var mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_6__[\"Mesh\"].CreatePlane(name, 1, scene);\r\n mesh.billboardMode = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_5__[\"AbstractMesh\"].BILLBOARDMODE_ALL;\r\n var material = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](name + \"Material\", scene);\r\n material.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_19__[\"Color3\"](1, 1, 1);\r\n mesh.material = material;\r\n return mesh;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"customMeshPosition\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"useCustomMeshPosition\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"invert\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"mesh\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"excludedMeshes\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"exposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"decay\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"weight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"density\", void 0);\r\n return VolumetricLightScatteringPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_12__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/vrDistortionCorrectionPostProcess.ts\":\n/*!************************************************************!*\\\n !*** ./PostProcesses/vrDistortionCorrectionPostProcess.ts ***!\n \\************************************************************/\n/*! exports provided: VRDistortionCorrectionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return VRDistortionCorrectionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_vrDistortionCorrection_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/vrDistortionCorrection.fragment */ \"./Shaders/vrDistortionCorrection.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * VRDistortionCorrectionPostProcess used for mobile VR\r\n */\r\nvar VRDistortionCorrectionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDistortionCorrectionPostProcess, _super);\r\n /**\r\n * Initializes the VRDistortionCorrectionPostProcess\r\n * @param name The name of the effect.\r\n * @param camera The camera to apply the render pass to.\r\n * @param isRightEye If this is for the right eye distortion\r\n * @param vrMetrics All the required metrics for the VR camera\r\n */\r\n function VRDistortionCorrectionPostProcess(name, camera, isRightEye, vrMetrics) {\r\n var _this = _super.call(this, name, \"vrDistortionCorrection\", [\r\n 'LensCenter',\r\n 'Scale',\r\n 'ScaleIn',\r\n 'HmdWarpParam'\r\n ], null, vrMetrics.postProcessScaleFactor, camera, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE) || this;\r\n _this._isRightEye = isRightEye;\r\n _this._distortionFactors = vrMetrics.distortionK;\r\n _this._postProcessScaleFactor = vrMetrics.postProcessScaleFactor;\r\n _this._lensCenterOffset = vrMetrics.lensCenterOffset;\r\n _this.adaptScaleToCurrentViewport = true;\r\n _this.onSizeChangedObservable.add(function () {\r\n _this._scaleIn = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](2, 2 / _this.aspectRatio);\r\n _this._scaleFactor = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](.5 * (1 / _this._postProcessScaleFactor), .5 * (1 / _this._postProcessScaleFactor) * _this.aspectRatio);\r\n _this._lensCenter = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](_this._isRightEye ? 0.5 - _this._lensCenterOffset * 0.5 : 0.5 + _this._lensCenterOffset * 0.5, 0.5);\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"LensCenter\", _this._lensCenter.x, _this._lensCenter.y);\r\n effect.setFloat2(\"Scale\", _this._scaleFactor.x, _this._scaleFactor.y);\r\n effect.setFloat2(\"ScaleIn\", _this._scaleIn.x, _this._scaleIn.y);\r\n effect.setFloat4(\"HmdWarpParam\", _this._distortionFactors[0], _this._distortionFactors[1], _this._distortionFactors[2], _this._distortionFactors[3]);\r\n });\r\n return _this;\r\n }\r\n return VRDistortionCorrectionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\":\n/*!*************************************************************!*\\\n !*** ./PostProcesses/vrMultiviewToSingleviewPostProcess.ts ***!\n \\*************************************************************/\n/*! exports provided: VRMultiviewToSingleviewPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return VRMultiviewToSingleviewPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_vrMultiviewToSingleview_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/vrMultiviewToSingleview.fragment */ \"./Shaders/vrMultiviewToSingleview.fragment.ts\");\n/* harmony import */ var _Engines_Extensions_engine_multiview__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/Extensions/engine.multiview */ \"./Engines/Extensions/engine.multiview.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * VRMultiviewToSingleview used to convert multiview texture arrays to standard textures for scenarios such as webVR\r\n * This will not be used for webXR as it supports displaying texture arrays directly\r\n */\r\nvar VRMultiviewToSingleviewPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRMultiviewToSingleviewPostProcess, _super);\r\n /**\r\n * Initializes a VRMultiviewToSingleview\r\n * @param name name of the post process\r\n * @param camera camera to be applied to\r\n * @param scaleFactor scaling factor to the size of the output texture\r\n */\r\n function VRMultiviewToSingleviewPostProcess(name, camera, scaleFactor) {\r\n var _this = _super.call(this, name, \"vrMultiviewToSingleview\", [\"imageIndex\"], [\"multiviewSampler\"], scaleFactor, camera, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE) || this;\r\n _this.onSizeChangedObservable.add(function () {\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n if (camera._scene.activeCamera && camera._scene.activeCamera.isLeftCamera) {\r\n effect.setInt(\"imageIndex\", 0);\r\n }\r\n else {\r\n effect.setInt(\"imageIndex\", 1);\r\n }\r\n effect.setTexture(\"multiviewSampler\", camera._multiviewTexture);\r\n });\r\n return _this;\r\n }\r\n return VRMultiviewToSingleviewPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Probes/index.ts\":\n/*!*************************!*\\\n !*** ./Probes/index.ts ***!\n \\*************************/\n/*! exports provided: ReflectionProbe */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _reflectionProbe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reflectionProbe */ \"./Probes/reflectionProbe.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return _reflectionProbe__WEBPACK_IMPORTED_MODULE_0__[\"ReflectionProbe\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Probes/reflectionProbe.ts\":\n/*!***********************************!*\\\n !*** ./Probes/reflectionProbe.ts ***!\n \\***********************************/\n/*! exports provided: ReflectionProbe */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return ReflectionProbe; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_4__[\"AbstractScene\"].prototype.removeReflectionProbe = function (toRemove) {\r\n if (!this.reflectionProbes) {\r\n return -1;\r\n }\r\n var index = this.reflectionProbes.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.reflectionProbes.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_4__[\"AbstractScene\"].prototype.addReflectionProbe = function (newReflectionProbe) {\r\n if (!this.reflectionProbes) {\r\n this.reflectionProbes = [];\r\n }\r\n this.reflectionProbes.push(newReflectionProbe);\r\n};\r\n/**\r\n * Class used to generate realtime reflection / refraction cube textures\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_reflection_probes\r\n */\r\nvar ReflectionProbe = /** @class */ (function () {\r\n /**\r\n * Creates a new reflection probe\r\n * @param name defines the name of the probe\r\n * @param size defines the texture resolution (for each face)\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines if mip maps should be generated automatically (true by default)\r\n * @param useFloat defines if HDR data (flaot data) should be used to store colors (false by default)\r\n */\r\n function ReflectionProbe(\r\n /** defines the name of the probe */\r\n name, size, scene, generateMipMaps, useFloat) {\r\n var _this = this;\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (useFloat === void 0) { useFloat = false; }\r\n this.name = name;\r\n this._viewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n this._target = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._add = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._invertYAxis = false;\r\n /** Gets or sets probe position (center of the cube map) */\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._scene = scene;\r\n // Create the scene field if not exist.\r\n if (!this._scene.reflectionProbes) {\r\n this._scene.reflectionProbes = new Array();\r\n }\r\n this._scene.reflectionProbes.push(this);\r\n this._renderTargetTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__[\"RenderTargetTexture\"](name, size, scene, generateMipMaps, true, useFloat ? _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, true);\r\n this._renderTargetTexture.onBeforeRenderObservable.add(function (faceIndex) {\r\n switch (faceIndex) {\r\n case 0:\r\n _this._add.copyFromFloats(1, 0, 0);\r\n break;\r\n case 1:\r\n _this._add.copyFromFloats(-1, 0, 0);\r\n break;\r\n case 2:\r\n _this._add.copyFromFloats(0, _this._invertYAxis ? 1 : -1, 0);\r\n break;\r\n case 3:\r\n _this._add.copyFromFloats(0, _this._invertYAxis ? -1 : 1, 0);\r\n break;\r\n case 4:\r\n _this._add.copyFromFloats(0, 0, 1);\r\n break;\r\n case 5:\r\n _this._add.copyFromFloats(0, 0, -1);\r\n break;\r\n }\r\n if (_this._attachedMesh) {\r\n _this.position.copyFrom(_this._attachedMesh.getAbsolutePosition());\r\n }\r\n _this.position.addToRef(_this._add, _this._target);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtLHToRef(_this.position, _this._target, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up(), _this._viewMatrix);\r\n if (scene.activeCamera) {\r\n _this._projectionMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].PerspectiveFovLH(Math.PI / 2, 1, scene.activeCamera.minZ, scene.activeCamera.maxZ);\r\n scene.setTransformMatrix(_this._viewMatrix, _this._projectionMatrix);\r\n }\r\n scene._forcedViewPosition = _this.position;\r\n });\r\n this._renderTargetTexture.onAfterUnbindObservable.add(function () {\r\n scene._forcedViewPosition = null;\r\n scene.updateTransformMatrix(true);\r\n });\r\n }\r\n Object.defineProperty(ReflectionProbe.prototype, \"samples\", {\r\n /** Gets or sets the number of samples to use for multi-sampling (0 by default). Required WebGL2 */\r\n get: function () {\r\n return this._renderTargetTexture.samples;\r\n },\r\n set: function (value) {\r\n this._renderTargetTexture.samples = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionProbe.prototype, \"refreshRate\", {\r\n /** Gets or sets the refresh rate to use (on every frame by default) */\r\n get: function () {\r\n return this._renderTargetTexture.refreshRate;\r\n },\r\n set: function (value) {\r\n this._renderTargetTexture.refreshRate = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the hosting scene\r\n * @returns a Scene\r\n */\r\n ReflectionProbe.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n Object.defineProperty(ReflectionProbe.prototype, \"cubeTexture\", {\r\n /** Gets the internal CubeTexture used to render to */\r\n get: function () {\r\n return this._renderTargetTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionProbe.prototype, \"renderList\", {\r\n /** Gets the list of meshes to render */\r\n get: function () {\r\n return this._renderTargetTexture.renderList;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach the probe to a specific mesh (Rendering will be done from attached mesh's position)\r\n * @param mesh defines the mesh to attach to\r\n */\r\n ReflectionProbe.prototype.attachToMesh = function (mesh) {\r\n this._attachedMesh = mesh;\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n */\r\n ReflectionProbe.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {\r\n this._renderTargetTexture.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);\r\n };\r\n /**\r\n * Clean all associated resources\r\n */\r\n ReflectionProbe.prototype.dispose = function () {\r\n var index = this._scene.reflectionProbes.indexOf(this);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this._scene.reflectionProbes.splice(index, 1);\r\n }\r\n if (this._renderTargetTexture) {\r\n this._renderTargetTexture.dispose();\r\n this._renderTargetTexture = null;\r\n }\r\n };\r\n /**\r\n * Converts the reflection probe information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable reflection probe info\r\n */\r\n ReflectionProbe.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n if (fullDetails) {\r\n ret += \", position: \" + this.position.toString();\r\n if (this._attachedMesh) {\r\n ret += \", attached mesh: \" + this._attachedMesh.name;\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Get the class name of the relfection probe.\r\n * @returns \"ReflectionProbe\"\r\n */\r\n ReflectionProbe.prototype.getClassName = function () {\r\n return \"ReflectionProbe\";\r\n };\r\n /**\r\n * Serialize the reflection probe to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n ReflectionProbe.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this, this._renderTargetTexture.serialize());\r\n serializationObject.isReflectionProbe = true;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the JSON representation of a reflection probe in order to recreate the reflection probe in the given scene.\r\n * @param parsedReflectionProbe Define the JSON representation of the reflection probe\r\n * @param scene Define the scene the parsed reflection probe should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed reflection probe if successful\r\n */\r\n ReflectionProbe.Parse = function (parsedReflectionProbe, scene, rootUrl) {\r\n var reflectionProbe = null;\r\n if (scene.reflectionProbes) {\r\n for (var index = 0; index < scene.reflectionProbes.length; index++) {\r\n var rp = scene.reflectionProbes[index];\r\n if (rp.name === parsedReflectionProbe.name) {\r\n reflectionProbe = rp;\r\n break;\r\n }\r\n }\r\n }\r\n reflectionProbe = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return reflectionProbe || new ReflectionProbe(parsedReflectionProbe.name, parsedReflectionProbe.renderTargetSize, scene, parsedReflectionProbe._generateMipMaps); }, parsedReflectionProbe, scene, rootUrl);\r\n reflectionProbe.cubeTexture._waitingRenderList = parsedReflectionProbe.renderList;\r\n if (parsedReflectionProbe._attachedMesh) {\r\n reflectionProbe.attachToMesh(scene.getMeshByID(parsedReflectionProbe._attachedMesh));\r\n }\r\n return reflectionProbe;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])()\r\n ], ReflectionProbe.prototype, \"_attachedMesh\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ReflectionProbe.prototype, \"position\", void 0);\r\n return ReflectionProbe;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/boundingBoxRenderer.ts\":\n/*!******************************************!*\\\n !*** ./Rendering/boundingBoxRenderer.ts ***!\n \\******************************************/\n/*! exports provided: BoundingBoxRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return BoundingBoxRenderer; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Shaders_color_fragment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/color.fragment */ \"./Shaders/color.fragment.ts\");\n/* harmony import */ var _Shaders_color_vertex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/color.vertex */ \"./Shaders/color.vertex.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"forceShowBoundingBoxes\", {\r\n get: function () {\r\n return this._forceShowBoundingBoxes || false;\r\n },\r\n set: function (value) {\r\n this._forceShowBoundingBoxes = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.getBoundingBoxRenderer = function () {\r\n if (!this._boundingBoxRenderer) {\r\n this._boundingBoxRenderer = new BoundingBoxRenderer(this);\r\n }\r\n return this._boundingBoxRenderer;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype, \"showBoundingBox\", {\r\n get: function () {\r\n return this._showBoundingBox || false;\r\n },\r\n set: function (value) {\r\n this._showBoundingBox = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getScene().getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Component responsible of rendering the bounding box of the meshes in a scene.\r\n * This is usually used through the mesh.showBoundingBox or the scene.forceShowBoundingBoxes properties\r\n */\r\nvar BoundingBoxRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new bounding box renderer in a scene.\r\n * @param scene the scene the renderer renders in\r\n */\r\n function BoundingBoxRenderer(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].NAME_BOUNDINGBOXRENDERER;\r\n /**\r\n * Color of the bounding box lines placed in front of an object\r\n */\r\n this.frontColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Color of the bounding box lines placed behind an object\r\n */\r\n this.backColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__[\"Color3\"](0.1, 0.1, 0.1);\r\n /**\r\n * Defines if the renderer should show the back lines or not\r\n */\r\n this.showBackLines = true;\r\n /**\r\n * @hidden\r\n */\r\n this.renderList = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_5__[\"SmartArray\"](32);\r\n this._vertexBuffers = {};\r\n this._fillIndexBuffer = null;\r\n this._fillIndexData = null;\r\n this.scene = scene;\r\n scene._addComponent(this);\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n BoundingBoxRenderer.prototype.register = function () {\r\n this.scene._beforeEvaluateActiveMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, this, this.reset);\r\n this.scene._activeMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_ACTIVEMESH_BOUNDINGBOXRENDERER, this, this._activeMesh);\r\n this.scene._evaluateSubMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, this, this._evaluateSubMesh);\r\n this.scene._afterRenderingGroupDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER, this, this.render);\r\n };\r\n BoundingBoxRenderer.prototype._evaluateSubMesh = function (mesh, subMesh) {\r\n if (mesh.showSubMeshesBoundingBox) {\r\n var boundingInfo = subMesh.getBoundingInfo();\r\n if (boundingInfo !== null && boundingInfo !== undefined) {\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n }\r\n };\r\n BoundingBoxRenderer.prototype._activeMesh = function (sourceMesh, mesh) {\r\n if (sourceMesh.showBoundingBox || this.scene.forceShowBoundingBoxes) {\r\n var boundingInfo = sourceMesh.getBoundingInfo();\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n };\r\n BoundingBoxRenderer.prototype._prepareRessources = function () {\r\n if (this._colorShader) {\r\n return;\r\n }\r\n this._colorShader = new _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_8__[\"ShaderMaterial\"](\"colorShader\", this.scene, \"color\", {\r\n attributes: [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind],\r\n uniforms: [\"world\", \"viewProjection\", \"color\"]\r\n });\r\n var engine = this.scene.getEngine();\r\n var boxdata = _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateBox({ size: 1.0 });\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, boxdata.positions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false);\r\n this._createIndexBuffer();\r\n this._fillIndexData = boxdata.indices;\r\n };\r\n BoundingBoxRenderer.prototype._createIndexBuffer = function () {\r\n var engine = this.scene.getEngine();\r\n this._indexBuffer = engine.createIndexBuffer([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, 6, 2, 5, 3, 4]);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n BoundingBoxRenderer.prototype.rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n };\r\n /**\r\n * @hidden\r\n */\r\n BoundingBoxRenderer.prototype.reset = function () {\r\n this.renderList.reset();\r\n };\r\n /**\r\n * Render the bounding boxes of a specific rendering group\r\n * @param renderingGroupId defines the rendering group to render\r\n */\r\n BoundingBoxRenderer.prototype.render = function (renderingGroupId) {\r\n if (this.renderList.length === 0) {\r\n return;\r\n }\r\n this._prepareRessources();\r\n if (!this._colorShader.isReady()) {\r\n return;\r\n }\r\n var engine = this.scene.getEngine();\r\n engine.setDepthWrite(false);\r\n this._colorShader._preBind();\r\n for (var boundingBoxIndex = 0; boundingBoxIndex < this.renderList.length; boundingBoxIndex++) {\r\n var boundingBox = this.renderList.data[boundingBoxIndex];\r\n if (boundingBox._tag !== renderingGroupId) {\r\n continue;\r\n }\r\n var min = boundingBox.minimum;\r\n var max = boundingBox.maximum;\r\n var diff = max.subtract(min);\r\n var median = min.add(diff.scale(0.5));\r\n var worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Scaling(diff.x, diff.y, diff.z)\r\n .multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._colorShader.getEffect());\r\n if (this.showBackLines) {\r\n // Back\r\n engine.setDepthFunctionToGreaterOrEqual();\r\n this.scene.resetCachedMaterial();\r\n this._colorShader.setColor4(\"color\", this.backColor.toColor4());\r\n this._colorShader.bind(worldMatrix);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].LineListDrawMode, 0, 24);\r\n }\r\n // Front\r\n engine.setDepthFunctionToLess();\r\n this.scene.resetCachedMaterial();\r\n this._colorShader.setColor4(\"color\", this.frontColor.toColor4());\r\n this._colorShader.bind(worldMatrix);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].LineListDrawMode, 0, 24);\r\n }\r\n this._colorShader.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n };\r\n /**\r\n * In case of occlusion queries, we can render the occlusion bounding box through this method\r\n * @param mesh Define the mesh to render the occlusion bounding box for\r\n */\r\n BoundingBoxRenderer.prototype.renderOcclusionBoundingBox = function (mesh) {\r\n this._prepareRessources();\r\n if (!this._colorShader.isReady() || !mesh._boundingInfo) {\r\n return;\r\n }\r\n var engine = this.scene.getEngine();\r\n if (!this._fillIndexBuffer) {\r\n this._fillIndexBuffer = engine.createIndexBuffer(this._fillIndexData);\r\n }\r\n engine.setDepthWrite(false);\r\n engine.setColorWrite(false);\r\n this._colorShader._preBind();\r\n var boundingBox = mesh._boundingInfo.boundingBox;\r\n var min = boundingBox.minimum;\r\n var max = boundingBox.maximum;\r\n var diff = max.subtract(min);\r\n var median = min.add(diff.scale(0.5));\r\n var worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Scaling(diff.x, diff.y, diff.z)\r\n .multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n engine.bindBuffers(this._vertexBuffers, this._fillIndexBuffer, this._colorShader.getEffect());\r\n engine.setDepthFunctionToLess();\r\n this.scene.resetCachedMaterial();\r\n this._colorShader.bind(worldMatrix);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, 36);\r\n this._colorShader.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n engine.setColorWrite(true);\r\n };\r\n /**\r\n * Dispose and release the resources attached to this renderer.\r\n */\r\n BoundingBoxRenderer.prototype.dispose = function () {\r\n if (!this._colorShader) {\r\n return;\r\n }\r\n this.renderList.dispose();\r\n this._colorShader.dispose();\r\n var buffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n this.scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n if (this._fillIndexBuffer) {\r\n this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer);\r\n this._fillIndexBuffer = null;\r\n }\r\n };\r\n return BoundingBoxRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/depthRenderer.ts\":\n/*!************************************!*\\\n !*** ./Rendering/depthRenderer.ts ***!\n \\************************************/\n/*! exports provided: DepthRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return DepthRenderer; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_depth_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/depth.fragment */ \"./Shaders/depth.fragment.ts\");\n/* harmony import */ var _Shaders_depth_vertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/depth.vertex */ \"./Shaders/depth.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a depth renderer in Babylon.\r\n * A depth renderer will render to it's depth map every frame which can be displayed or used in post processing\r\n */\r\nvar DepthRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a depth renderer\r\n * @param scene The scene the renderer belongs to\r\n * @param type The texture type of the depth map (default: Engine.TEXTURETYPE_FLOAT)\r\n * @param camera The camera to be used to render the depth map (default: scene's active camera)\r\n * @param storeNonLinearDepth Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z\r\n */\r\n function DepthRenderer(scene, type, camera, storeNonLinearDepth) {\r\n var _this = this;\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT; }\r\n if (camera === void 0) { camera = null; }\r\n if (storeNonLinearDepth === void 0) { storeNonLinearDepth = false; }\r\n /**\r\n * Specifiess that the depth renderer will only be used within\r\n * the camera it is created for.\r\n * This can help forcing its rendering during the camera processing.\r\n */\r\n this.useOnlyInActiveCamera = false;\r\n this._scene = scene;\r\n this._storeNonLinearDepth = storeNonLinearDepth;\r\n this.isPacked = type === _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this.isPacked) {\r\n this._clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n }\r\n else {\r\n this._clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"](1.0, 0.0, 0.0, 1.0);\r\n }\r\n DepthRenderer._SceneComponentInitialization(this._scene);\r\n this._camera = camera;\r\n var engine = scene.getEngine();\r\n // Render target\r\n var format = (this.isPacked || engine.webGLVersion === 1) ? _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA : _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_R;\r\n this._depthMap = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetTexture\"](\"depthMap\", { width: engine.getRenderWidth(), height: engine.getRenderHeight() }, this._scene, false, true, type, false, undefined, undefined, undefined, undefined, format);\r\n this._depthMap.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._depthMap.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._depthMap.refreshRate = 1;\r\n this._depthMap.renderParticles = false;\r\n this._depthMap.renderList = null;\r\n // Camera to get depth map from to support multiple concurrent cameras\r\n this._depthMap.activeCamera = this._camera;\r\n this._depthMap.ignoreCameraViewport = true;\r\n this._depthMap.useCameraPostProcesses = false;\r\n // set default depth value to 1.0 (far away)\r\n this._depthMap.onClearObservable.add(function (engine) {\r\n engine.clear(_this._clearColor, true, true, true);\r\n });\r\n // Custom render function\r\n var renderSubMesh = function (subMesh) {\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = _this._scene;\r\n var engine = scene.getEngine();\r\n var material = subMesh.getMaterial();\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n if (!material) {\r\n return;\r\n }\r\n // Culling and reverse (right handed system)\r\n engine.setState(material.backFaceCulling, 0, false, scene.useRightHandedSystem);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);\r\n var camera = _this._camera || scene.activeCamera;\r\n if (_this.isReady(subMesh, hardwareInstancedRendering) && camera) {\r\n engine.enableEffect(_this._effect);\r\n mesh._bind(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_4__[\"Material\"].TriangleFillMode);\r\n _this._effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n _this._effect.setFloat2(\"depthValues\", camera.minZ, camera.minZ + camera.maxZ);\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n _this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n _this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n _this._effect.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, _this._effect);\r\n // Draw\r\n mesh._processRendering(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_4__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix(\"world\", world); });\r\n }\r\n };\r\n this._depthMap.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var index;\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n };\r\n }\r\n /**\r\n * Creates the depth rendering effect and checks if the effect is ready.\r\n * @param subMesh The submesh to be used to render the depth map of\r\n * @param useInstances If multiple world instances should be used\r\n * @returns if the depth renderer is ready to render the depth map\r\n */\r\n DepthRenderer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n if (material.disableDepthWrite) {\r\n return false;\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n var mesh = subMesh.getMesh();\r\n // Alpha test\r\n if (material && material.needAlphaTesting() && material.getAlphaTestTexture()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var morphTargetManager = mesh.morphTargetManager;\r\n var numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n if (morphTargetManager.numInfluencers > 0) {\r\n numMorphInfluencers = morphTargetManager.numInfluencers;\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // None linear depth\r\n if (this._storeNonLinearDepth) {\r\n defines.push(\"#define NONLINEARDEPTH\");\r\n }\r\n // Float Mode\r\n if (this.isPacked) {\r\n defines.push(\"#define PACKED\");\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = this._scene.getEngine().createEffect(\"depth\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"depthValues\", \"morphTargetInfluences\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { maxSimultaneousMorphTargets: numMorphInfluencers });\r\n }\r\n return this._effect.isReady();\r\n };\r\n /**\r\n * Gets the texture which the depth map will be written to.\r\n * @returns The depth map texture\r\n */\r\n DepthRenderer.prototype.getDepthMap = function () {\r\n return this._depthMap;\r\n };\r\n /**\r\n * Disposes of the depth renderer.\r\n */\r\n DepthRenderer.prototype.dispose = function () {\r\n this._depthMap.dispose();\r\n };\r\n /** @hidden */\r\n DepthRenderer._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"DepthRendererSceneComponent\");\r\n };\r\n return DepthRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/depthRendererSceneComponent.ts\":\n/*!**************************************************!*\\\n !*** ./Rendering/depthRendererSceneComponent.ts ***!\n \\**************************************************/\n/*! exports provided: DepthRendererSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return DepthRendererSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _depthRenderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./depthRenderer */ \"./Rendering/depthRenderer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n\r\n\r\n\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.enableDepthRenderer = function (camera, storeNonLinearDepth) {\r\n if (storeNonLinearDepth === void 0) { storeNonLinearDepth = false; }\r\n camera = camera || this.activeCamera;\r\n if (!camera) {\r\n throw \"No camera available to enable depth renderer\";\r\n }\r\n if (!this._depthRenderer) {\r\n this._depthRenderer = {};\r\n }\r\n if (!this._depthRenderer[camera.id]) {\r\n var textureType = 0;\r\n if (this.getEngine().getCaps().textureHalfFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else if (this.getEngine().getCaps().textureFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n else {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n this._depthRenderer[camera.id] = new _depthRenderer__WEBPACK_IMPORTED_MODULE_1__[\"DepthRenderer\"](this, textureType, camera, storeNonLinearDepth);\r\n }\r\n return this._depthRenderer[camera.id];\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.disableDepthRenderer = function (camera) {\r\n camera = camera || this.activeCamera;\r\n if (!camera || !this._depthRenderer || !this._depthRenderer[camera.id]) {\r\n return;\r\n }\r\n this._depthRenderer[camera.id].dispose();\r\n delete this._depthRenderer[camera.id];\r\n};\r\n/**\r\n * Defines the Depth Renderer scene component responsible to manage a depth buffer useful\r\n * in several rendering techniques.\r\n */\r\nvar DepthRendererSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function DepthRendererSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_DEPTHRENDERER;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n DepthRendererSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_DEPTHRENDERER, this, this._gatherRenderTargets);\r\n this.scene._gatherActiveCameraRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER, this, this._gatherActiveCameraRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n DepthRendererSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n DepthRendererSceneComponent.prototype.dispose = function () {\r\n for (var key in this.scene._depthRenderer) {\r\n this.scene._depthRenderer[key].dispose();\r\n }\r\n };\r\n DepthRendererSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {\r\n if (this.scene._depthRenderer) {\r\n for (var key in this.scene._depthRenderer) {\r\n var depthRenderer = this.scene._depthRenderer[key];\r\n if (!depthRenderer.useOnlyInActiveCamera) {\r\n renderTargets.push(depthRenderer.getDepthMap());\r\n }\r\n }\r\n }\r\n };\r\n DepthRendererSceneComponent.prototype._gatherActiveCameraRenderTargets = function (renderTargets) {\r\n if (this.scene._depthRenderer) {\r\n for (var key in this.scene._depthRenderer) {\r\n var depthRenderer = this.scene._depthRenderer[key];\r\n if (depthRenderer.useOnlyInActiveCamera && this.scene.activeCamera.id === key) {\r\n renderTargets.push(depthRenderer.getDepthMap());\r\n }\r\n }\r\n }\r\n };\r\n return DepthRendererSceneComponent;\r\n}());\r\n\r\n_depthRenderer__WEBPACK_IMPORTED_MODULE_1__[\"DepthRenderer\"]._SceneComponentInitialization = function (scene) {\r\n // Register the G Buffer component to the scene.\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_DEPTHRENDERER);\r\n if (!component) {\r\n component = new DepthRendererSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/edgesRenderer.ts\":\n/*!************************************!*\\\n !*** ./Rendering/edgesRenderer.ts ***!\n \\************************************/\n/*! exports provided: EdgesRenderer, LineEdgesRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return EdgesRenderer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return LineEdgesRenderer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/linesMesh */ \"./Meshes/linesMesh.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_line_fragment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Shaders/line.fragment */ \"./Shaders/line.fragment.ts\");\n/* harmony import */ var _Shaders_line_vertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/line.vertex */ \"./Shaders/line.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.disableEdgesRendering = function () {\r\n if (this._edgesRenderer) {\r\n this._edgesRenderer.dispose();\r\n this._edgesRenderer = null;\r\n }\r\n return this;\r\n};\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n this.disableEdgesRendering();\r\n this._edgesRenderer = new EdgesRenderer(this, epsilon, checkVerticesInsteadOfIndices);\r\n return this;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype, \"edgesRenderer\", {\r\n get: function () {\r\n return this._edgesRenderer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"].prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n this.disableEdgesRendering();\r\n this._edgesRenderer = new LineEdgesRenderer(this, epsilon, checkVerticesInsteadOfIndices);\r\n return this;\r\n};\r\n_Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"InstancedLinesMesh\"].prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"].prototype.enableEdgesRendering.apply(this, arguments);\r\n return this;\r\n};\r\n/**\r\n * FaceAdjacencies Helper class to generate edges\r\n */\r\nvar FaceAdjacencies = /** @class */ (function () {\r\n function FaceAdjacencies() {\r\n this.edges = new Array();\r\n this.edgesConnectedCount = 0;\r\n }\r\n return FaceAdjacencies;\r\n}());\r\n/**\r\n * This class is used to generate edges of the mesh that could then easily be rendered in a scene.\r\n */\r\nvar EdgesRenderer = /** @class */ (function () {\r\n /**\r\n * Creates an instance of the EdgesRenderer. It is primarily use to display edges of a mesh.\r\n * Beware when you use this class with complex objects as the adjacencies computation can be really long\r\n * @param source Mesh used to create edges\r\n * @param epsilon sum of angles in adjacency to check for edge\r\n * @param checkVerticesInsteadOfIndices bases the edges detection on vertices vs indices\r\n * @param generateEdgesLines - should generate Lines or only prepare resources.\r\n */\r\n function EdgesRenderer(source, epsilon, checkVerticesInsteadOfIndices, generateEdgesLines) {\r\n var _this = this;\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n if (generateEdgesLines === void 0) { generateEdgesLines = true; }\r\n /**\r\n * Define the size of the edges with an orthographic camera\r\n */\r\n this.edgesWidthScalerForOrthographic = 1000.0;\r\n /**\r\n * Define the size of the edges with a perspective camera\r\n */\r\n this.edgesWidthScalerForPerspective = 50.0;\r\n this._linesPositions = new Array();\r\n this._linesNormals = new Array();\r\n this._linesIndices = new Array();\r\n this._buffers = {};\r\n this._checkVerticesInsteadOfIndices = false;\r\n /** Gets or sets a boolean indicating if the edgesRenderer is active */\r\n this.isEnabled = true;\r\n this._source = source;\r\n this._checkVerticesInsteadOfIndices = checkVerticesInsteadOfIndices;\r\n this._epsilon = epsilon;\r\n this._prepareRessources();\r\n if (generateEdgesLines) {\r\n this._generateEdgesLines();\r\n }\r\n this._meshRebuildObserver = this._source.onRebuildObservable.add(function () {\r\n _this._rebuild();\r\n });\r\n this._meshDisposeObserver = this._source.onDisposeObservable.add(function () {\r\n _this.dispose();\r\n });\r\n }\r\n EdgesRenderer.prototype._prepareRessources = function () {\r\n if (this._lineShader) {\r\n return;\r\n }\r\n this._lineShader = new _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__[\"ShaderMaterial\"](\"lineShader\", this._source.getScene(), \"line\", {\r\n attributes: [\"position\", \"normal\"],\r\n uniforms: [\"worldViewProjection\", \"color\", \"width\", \"aspectRatio\"]\r\n });\r\n this._lineShader.disableDepthWrite = true;\r\n this._lineShader.backFaceCulling = false;\r\n };\r\n /** @hidden */\r\n EdgesRenderer.prototype._rebuild = function () {\r\n var buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer._rebuild();\r\n }\r\n buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind];\r\n if (buffer) {\r\n buffer._rebuild();\r\n }\r\n var scene = this._source.getScene();\r\n var engine = scene.getEngine();\r\n this._ib = engine.createIndexBuffer(this._linesIndices);\r\n };\r\n /**\r\n * Releases the required resources for the edges renderer\r\n */\r\n EdgesRenderer.prototype.dispose = function () {\r\n this._source.onRebuildObservable.remove(this._meshRebuildObserver);\r\n this._source.onDisposeObservable.remove(this._meshDisposeObserver);\r\n var buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind] = null;\r\n }\r\n if (this._ib) {\r\n this._source.getScene().getEngine()._releaseBuffer(this._ib);\r\n }\r\n this._lineShader.dispose();\r\n };\r\n EdgesRenderer.prototype._processEdgeForAdjacencies = function (pa, pb, p0, p1, p2) {\r\n if (pa === p0 && pb === p1 || pa === p1 && pb === p0) {\r\n return 0;\r\n }\r\n if (pa === p1 && pb === p2 || pa === p2 && pb === p1) {\r\n return 1;\r\n }\r\n if (pa === p2 && pb === p0 || pa === p0 && pb === p2) {\r\n return 2;\r\n }\r\n return -1;\r\n };\r\n EdgesRenderer.prototype._processEdgeForAdjacenciesWithVertices = function (pa, pb, p0, p1, p2) {\r\n if (pa.equalsWithEpsilon(p0) && pb.equalsWithEpsilon(p1) || pa.equalsWithEpsilon(p1) && pb.equalsWithEpsilon(p0)) {\r\n return 0;\r\n }\r\n if (pa.equalsWithEpsilon(p1) && pb.equalsWithEpsilon(p2) || pa.equalsWithEpsilon(p2) && pb.equalsWithEpsilon(p1)) {\r\n return 1;\r\n }\r\n if (pa.equalsWithEpsilon(p2) && pb.equalsWithEpsilon(p0) || pa.equalsWithEpsilon(p0) && pb.equalsWithEpsilon(p2)) {\r\n return 2;\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Checks if the pair of p0 and p1 is en edge\r\n * @param faceIndex\r\n * @param edge\r\n * @param faceNormals\r\n * @param p0\r\n * @param p1\r\n * @private\r\n */\r\n EdgesRenderer.prototype._checkEdge = function (faceIndex, edge, faceNormals, p0, p1) {\r\n var needToCreateLine;\r\n if (edge === undefined) {\r\n needToCreateLine = true;\r\n }\r\n else {\r\n var dotProduct = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Dot(faceNormals[faceIndex], faceNormals[edge]);\r\n needToCreateLine = dotProduct < this._epsilon;\r\n }\r\n if (needToCreateLine) {\r\n this.createLine(p0, p1, this._linesPositions.length / 3);\r\n }\r\n };\r\n /**\r\n * push line into the position, normal and index buffer\r\n * @protected\r\n */\r\n EdgesRenderer.prototype.createLine = function (p0, p1, offset) {\r\n // Positions\r\n this._linesPositions.push(p0.x, p0.y, p0.z, p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, p1.x, p1.y, p1.z);\r\n // Normals\r\n this._linesNormals.push(p1.x, p1.y, p1.z, -1, p1.x, p1.y, p1.z, 1, p0.x, p0.y, p0.z, -1, p0.x, p0.y, p0.z, 1);\r\n // Indices\r\n this._linesIndices.push(offset, offset + 1, offset + 2, offset, offset + 2, offset + 3);\r\n };\r\n /**\r\n * Generates lines edges from adjacencjes\r\n * @private\r\n */\r\n EdgesRenderer.prototype._generateEdgesLines = function () {\r\n var positions = this._source.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var indices = this._source.getIndices();\r\n if (!indices || !positions) {\r\n return;\r\n }\r\n // First let's find adjacencies\r\n var adjacencies = new Array();\r\n var faceNormals = new Array();\r\n var index;\r\n var faceAdjacencies;\r\n // Prepare faces\r\n for (index = 0; index < indices.length; index += 3) {\r\n faceAdjacencies = new FaceAdjacencies();\r\n var p0Index = indices[index];\r\n var p1Index = indices[index + 1];\r\n var p2Index = indices[index + 2];\r\n faceAdjacencies.p0 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](positions[p0Index * 3], positions[p0Index * 3 + 1], positions[p0Index * 3 + 2]);\r\n faceAdjacencies.p1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](positions[p1Index * 3], positions[p1Index * 3 + 1], positions[p1Index * 3 + 2]);\r\n faceAdjacencies.p2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](positions[p2Index * 3], positions[p2Index * 3 + 1], positions[p2Index * 3 + 2]);\r\n var faceNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Cross(faceAdjacencies.p1.subtract(faceAdjacencies.p0), faceAdjacencies.p2.subtract(faceAdjacencies.p1));\r\n faceNormal.normalize();\r\n faceNormals.push(faceNormal);\r\n adjacencies.push(faceAdjacencies);\r\n }\r\n // Scan\r\n for (index = 0; index < adjacencies.length; index++) {\r\n faceAdjacencies = adjacencies[index];\r\n for (var otherIndex = index + 1; otherIndex < adjacencies.length; otherIndex++) {\r\n var otherFaceAdjacencies = adjacencies[otherIndex];\r\n if (faceAdjacencies.edgesConnectedCount === 3) { // Full\r\n break;\r\n }\r\n if (otherFaceAdjacencies.edgesConnectedCount === 3) { // Full\r\n continue;\r\n }\r\n var otherP0 = indices[otherIndex * 3];\r\n var otherP1 = indices[otherIndex * 3 + 1];\r\n var otherP2 = indices[otherIndex * 3 + 2];\r\n for (var edgeIndex = 0; edgeIndex < 3; edgeIndex++) {\r\n var otherEdgeIndex = 0;\r\n if (faceAdjacencies.edges[edgeIndex] !== undefined) {\r\n continue;\r\n }\r\n switch (edgeIndex) {\r\n case 0:\r\n if (this._checkVerticesInsteadOfIndices) {\r\n otherEdgeIndex = this._processEdgeForAdjacenciesWithVertices(faceAdjacencies.p0, faceAdjacencies.p1, otherFaceAdjacencies.p0, otherFaceAdjacencies.p1, otherFaceAdjacencies.p2);\r\n }\r\n else {\r\n otherEdgeIndex = this._processEdgeForAdjacencies(indices[index * 3], indices[index * 3 + 1], otherP0, otherP1, otherP2);\r\n }\r\n break;\r\n case 1:\r\n if (this._checkVerticesInsteadOfIndices) {\r\n otherEdgeIndex = this._processEdgeForAdjacenciesWithVertices(faceAdjacencies.p1, faceAdjacencies.p2, otherFaceAdjacencies.p0, otherFaceAdjacencies.p1, otherFaceAdjacencies.p2);\r\n }\r\n else {\r\n otherEdgeIndex = this._processEdgeForAdjacencies(indices[index * 3 + 1], indices[index * 3 + 2], otherP0, otherP1, otherP2);\r\n }\r\n break;\r\n case 2:\r\n if (this._checkVerticesInsteadOfIndices) {\r\n otherEdgeIndex = this._processEdgeForAdjacenciesWithVertices(faceAdjacencies.p2, faceAdjacencies.p0, otherFaceAdjacencies.p0, otherFaceAdjacencies.p1, otherFaceAdjacencies.p2);\r\n }\r\n else {\r\n otherEdgeIndex = this._processEdgeForAdjacencies(indices[index * 3 + 2], indices[index * 3], otherP0, otherP1, otherP2);\r\n }\r\n break;\r\n }\r\n if (otherEdgeIndex === -1) {\r\n continue;\r\n }\r\n faceAdjacencies.edges[edgeIndex] = otherIndex;\r\n otherFaceAdjacencies.edges[otherEdgeIndex] = index;\r\n faceAdjacencies.edgesConnectedCount++;\r\n otherFaceAdjacencies.edgesConnectedCount++;\r\n if (faceAdjacencies.edgesConnectedCount === 3) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n // Create lines\r\n for (index = 0; index < adjacencies.length; index++) {\r\n // We need a line when a face has no adjacency on a specific edge or if all the adjacencies has an angle greater than epsilon\r\n var current = adjacencies[index];\r\n this._checkEdge(index, current.edges[0], faceNormals, current.p0, current.p1);\r\n this._checkEdge(index, current.edges[1], faceNormals, current.p1, current.p2);\r\n this._checkEdge(index, current.edges[2], faceNormals, current.p2, current.p0);\r\n }\r\n // Merge into a single mesh\r\n var engine = this._source.getScene().getEngine();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesPositions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false);\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesNormals, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, false, false, 4);\r\n this._ib = engine.createIndexBuffer(this._linesIndices);\r\n this._indicesCount = this._linesIndices.length;\r\n };\r\n /**\r\n * Checks wether or not the edges renderer is ready to render.\r\n * @return true if ready, otherwise false.\r\n */\r\n EdgesRenderer.prototype.isReady = function () {\r\n return this._lineShader.isReady();\r\n };\r\n /**\r\n * Renders the edges of the attached mesh,\r\n */\r\n EdgesRenderer.prototype.render = function () {\r\n var scene = this._source.getScene();\r\n if (!this.isReady() || !scene.activeCamera) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n this._lineShader._preBind();\r\n if (this._source.edgesColor.a !== 1) {\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].ALPHA_COMBINE);\r\n }\r\n else {\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // VBOs\r\n engine.bindBuffers(this._buffers, this._ib, this._lineShader.getEffect());\r\n scene.resetCachedMaterial();\r\n this._lineShader.setColor4(\"color\", this._source.edgesColor);\r\n if (scene.activeCamera.mode === _Cameras_camera__WEBPACK_IMPORTED_MODULE_7__[\"Camera\"].ORTHOGRAPHIC_CAMERA) {\r\n this._lineShader.setFloat(\"width\", this._source.edgesWidth / this.edgesWidthScalerForOrthographic);\r\n }\r\n else {\r\n this._lineShader.setFloat(\"width\", this._source.edgesWidth / this.edgesWidthScalerForPerspective);\r\n }\r\n this._lineShader.setFloat(\"aspectRatio\", engine.getAspectRatio(scene.activeCamera));\r\n this._lineShader.bind(this._source.getWorldMatrix());\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, this._indicesCount);\r\n this._lineShader.unbind();\r\n };\r\n return EdgesRenderer;\r\n}());\r\n\r\n/**\r\n * LineEdgesRenderer for LineMeshes to remove unnecessary triangulation\r\n */\r\nvar LineEdgesRenderer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LineEdgesRenderer, _super);\r\n /**\r\n * This constructor turns off auto generating edges line in Edges Renderer to make it here.\r\n * @param source LineMesh used to generate edges\r\n * @param epsilon not important (specified angle for edge detection)\r\n * @param checkVerticesInsteadOfIndices not important for LineMesh\r\n */\r\n function LineEdgesRenderer(source, epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n var _this = _super.call(this, source, epsilon, checkVerticesInsteadOfIndices, false) || this;\r\n _this._generateEdgesLines();\r\n return _this;\r\n }\r\n /**\r\n * Generate edges for each line in LinesMesh. Every Line should be rendered as edge.\r\n */\r\n LineEdgesRenderer.prototype._generateEdgesLines = function () {\r\n var positions = this._source.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var indices = this._source.getIndices();\r\n if (!indices || !positions) {\r\n return;\r\n }\r\n var p0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[0];\r\n var p1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[1];\r\n var len = indices.length - 1;\r\n for (var i = 0, offset = 0; i < len; i += 2, offset += 4) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].FromArrayToRef(positions, 3 * indices[i], p0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].FromArrayToRef(positions, 3 * indices[i + 1], p1);\r\n this.createLine(p0, p1, offset);\r\n }\r\n // Merge into a single mesh\r\n var engine = this._source.getScene().getEngine();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesPositions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false);\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesNormals, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, false, false, 4);\r\n this._ib = engine.createIndexBuffer(this._linesIndices);\r\n this._indicesCount = this._linesIndices.length;\r\n };\r\n return LineEdgesRenderer;\r\n}(EdgesRenderer));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/geometryBufferRenderer.ts\":\n/*!*********************************************!*\\\n !*** ./Rendering/geometryBufferRenderer.ts ***!\n \\*********************************************/\n/*! exports provided: GeometryBufferRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return GeometryBufferRenderer; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_multiRenderTarget__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/multiRenderTarget */ \"./Materials/Textures/multiRenderTarget.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Shaders_geometry_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/geometry.fragment */ \"./Shaders/geometry.fragment.ts\");\n/* harmony import */ var _Shaders_geometry_vertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/geometry.vertex */ \"./Shaders/geometry.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This renderer is helpfull to fill one of the render target with a geometry buffer.\r\n */\r\nvar GeometryBufferRenderer = /** @class */ (function () {\r\n /**\r\n * Creates a new G Buffer for the scene\r\n * @param scene The scene the buffer belongs to\r\n * @param ratio How big is the buffer related to the main canvas.\r\n */\r\n function GeometryBufferRenderer(scene, ratio) {\r\n if (ratio === void 0) { ratio = 1; }\r\n /**\r\n * Dictionary used to store the previous transformation matrices of each rendered mesh\r\n * in order to compute objects velocities when enableVelocity is set to \"true\"\r\n * @hidden\r\n */\r\n this._previousTransformationMatrices = {};\r\n /**\r\n * Dictionary used to store the previous bones transformation matrices of each rendered mesh\r\n * in order to compute objects velocities when enableVelocity is set to \"true\"\r\n * @hidden\r\n */\r\n this._previousBonesTransformationMatrices = {};\r\n /**\r\n * Array used to store the ignored skinned meshes while computing velocity map (typically used by the motion blur post-process).\r\n * Avoids computing bones velocities and computes only mesh's velocity itself (position, rotation, scaling).\r\n */\r\n this.excludedSkinnedMeshesFromVelocity = [];\r\n this._enablePosition = false;\r\n this._enableVelocity = false;\r\n this._positionIndex = -1;\r\n this._velocityIndex = -1;\r\n this._scene = scene;\r\n this._ratio = ratio;\r\n GeometryBufferRenderer._SceneComponentInitialization(this._scene);\r\n // Render target\r\n this._createRenderTargets();\r\n }\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"renderList\", {\r\n /**\r\n * Set the render list (meshes to be rendered) used in the G buffer.\r\n */\r\n set: function (meshes) {\r\n this._multiRenderTarget.renderList = meshes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"isSupported\", {\r\n /**\r\n * Gets wether or not G buffer are supported by the running hardware.\r\n * This requires draw buffer supports\r\n */\r\n get: function () {\r\n return this._multiRenderTarget.isSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the index of the given texture type in the G-Buffer textures array\r\n * @param textureType The texture type constant. For example GeometryBufferRenderer.POSITION_TEXTURE_INDEX\r\n * @returns the index of the given texture type in the G-Buffer textures array\r\n */\r\n GeometryBufferRenderer.prototype.getTextureIndex = function (textureType) {\r\n switch (textureType) {\r\n case GeometryBufferRenderer.POSITION_TEXTURE_TYPE: return this._positionIndex;\r\n case GeometryBufferRenderer.VELOCITY_TEXTURE_TYPE: return this._velocityIndex;\r\n default: return -1;\r\n }\r\n };\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"enablePosition\", {\r\n /**\r\n * Gets a boolean indicating if objects positions are enabled for the G buffer.\r\n */\r\n get: function () {\r\n return this._enablePosition;\r\n },\r\n /**\r\n * Sets whether or not objects positions are enabled for the G buffer.\r\n */\r\n set: function (enable) {\r\n this._enablePosition = enable;\r\n this.dispose();\r\n this._createRenderTargets();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"enableVelocity\", {\r\n /**\r\n * Gets a boolean indicating if objects velocities are enabled for the G buffer.\r\n */\r\n get: function () {\r\n return this._enableVelocity;\r\n },\r\n /**\r\n * Sets wether or not objects velocities are enabled for the G buffer.\r\n */\r\n set: function (enable) {\r\n this._enableVelocity = enable;\r\n if (!enable) {\r\n this._previousTransformationMatrices = {};\r\n }\r\n this.dispose();\r\n this._createRenderTargets();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"scene\", {\r\n /**\r\n * Gets the scene associated with the buffer.\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"ratio\", {\r\n /**\r\n * Gets the ratio used by the buffer during its creation.\r\n * How big is the buffer related to the main canvas.\r\n */\r\n get: function () {\r\n return this._ratio;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Checks wether everything is ready to render a submesh to the G buffer.\r\n * @param subMesh the submesh to check readiness for\r\n * @param useInstances is the mesh drawn using instance or not\r\n * @returns true if ready otherwise false\r\n */\r\n GeometryBufferRenderer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.disableDepthWrite) {\r\n return false;\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind];\r\n var mesh = subMesh.getMesh();\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n // Buffers\r\n if (this._enablePosition) {\r\n defines.push(\"#define POSITION\");\r\n defines.push(\"#define POSITION_INDEX \" + this._positionIndex);\r\n }\r\n if (this._enableVelocity) {\r\n defines.push(\"#define VELOCITY\");\r\n defines.push(\"#define VELOCITY_INDEX \" + this._velocityIndex);\r\n if (this.excludedSkinnedMeshesFromVelocity.indexOf(mesh) === -1) {\r\n defines.push(\"#define BONES_VELOCITY_ENABLED\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var morphTargetManager = mesh.morphTargetManager;\r\n var numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n if (morphTargetManager.numInfluencers > 0) {\r\n numMorphInfluencers = morphTargetManager.numInfluencers;\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Setup textures count\r\n defines.push(\"#define RENDER_TARGET_COUNT \" + this._multiRenderTarget.textures.length);\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = this._scene.getEngine().createEffect(\"geometry\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"view\", \"previousWorld\", \"previousViewProjection\", \"mPreviousBones\", \"morphTargetInfluences\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { buffersCount: this._enablePosition ? 3 : 2, maxSimultaneousMorphTargets: numMorphInfluencers });\r\n }\r\n return this._effect.isReady();\r\n };\r\n /**\r\n * Gets the current underlying G Buffer.\r\n * @returns the buffer\r\n */\r\n GeometryBufferRenderer.prototype.getGBuffer = function () {\r\n return this._multiRenderTarget;\r\n };\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"samples\", {\r\n /**\r\n * Gets the number of samples used to render the buffer (anti aliasing).\r\n */\r\n get: function () {\r\n return this._multiRenderTarget.samples;\r\n },\r\n /**\r\n * Sets the number of samples used to render the buffer (anti aliasing).\r\n */\r\n set: function (value) {\r\n this._multiRenderTarget.samples = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes the renderer and frees up associated resources.\r\n */\r\n GeometryBufferRenderer.prototype.dispose = function () {\r\n this.getGBuffer().dispose();\r\n };\r\n GeometryBufferRenderer.prototype._createRenderTargets = function () {\r\n var _this = this;\r\n var engine = this._scene.getEngine();\r\n var count = 2;\r\n if (this._enablePosition) {\r\n this._positionIndex = count;\r\n count++;\r\n }\r\n if (this._enableVelocity) {\r\n this._velocityIndex = count;\r\n count++;\r\n }\r\n this._multiRenderTarget = new _Materials_Textures_multiRenderTarget__WEBPACK_IMPORTED_MODULE_4__[\"MultiRenderTarget\"](\"gBuffer\", { width: engine.getRenderWidth() * this._ratio, height: engine.getRenderHeight() * this._ratio }, count, this._scene, { generateMipMaps: false, generateDepthTexture: true, defaultType: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT });\r\n if (!this.isSupported) {\r\n return;\r\n }\r\n this._multiRenderTarget.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._multiRenderTarget.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._multiRenderTarget.refreshRate = 1;\r\n this._multiRenderTarget.renderParticles = false;\r\n this._multiRenderTarget.renderList = null;\r\n // set default depth value to 1.0 (far away)\r\n this._multiRenderTarget.onClearObservable.add(function (engine) {\r\n engine.clear(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color4\"](0.0, 0.0, 0.0, 1.0), true, true, true);\r\n });\r\n // Custom render function\r\n var renderSubMesh = function (subMesh) {\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = _this._scene;\r\n var engine = scene.getEngine();\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return;\r\n }\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n // Velocity\r\n if (_this._enableVelocity && !_this._previousTransformationMatrices[mesh.uniqueId]) {\r\n _this._previousTransformationMatrices[mesh.uniqueId] = {\r\n world: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity(),\r\n viewProjection: scene.getTransformMatrix()\r\n };\r\n if (mesh.skeleton) {\r\n var bonesTransformations = mesh.skeleton.getTransformMatrices(mesh);\r\n _this._previousBonesTransformationMatrices[mesh.uniqueId] = _this._copyBonesTransformationMatrices(bonesTransformations, new Float32Array(bonesTransformations.length));\r\n }\r\n }\r\n // Culling\r\n engine.setState(material.backFaceCulling, 0, false, scene.useRightHandedSystem);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);\r\n if (_this.isReady(subMesh, hardwareInstancedRendering)) {\r\n engine.enableEffect(_this._effect);\r\n mesh._bind(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode);\r\n _this._effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n _this._effect.setMatrix(\"view\", scene.getViewMatrix());\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n _this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n _this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n _this._effect.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n if (_this._enableVelocity) {\r\n _this._effect.setMatrices(\"mPreviousBones\", _this._previousBonesTransformationMatrices[mesh.uniqueId]);\r\n }\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, _this._effect);\r\n // Velocity\r\n if (_this._enableVelocity) {\r\n _this._effect.setMatrix(\"previousWorld\", _this._previousTransformationMatrices[mesh.uniqueId].world);\r\n _this._effect.setMatrix(\"previousViewProjection\", _this._previousTransformationMatrices[mesh.uniqueId].viewProjection);\r\n }\r\n // Draw\r\n mesh._processRendering(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix(\"world\", world); });\r\n }\r\n // Velocity\r\n if (_this._enableVelocity) {\r\n _this._previousTransformationMatrices[mesh.uniqueId].world = mesh.getWorldMatrix().clone();\r\n _this._previousTransformationMatrices[mesh.uniqueId].viewProjection = _this._scene.getTransformMatrix().clone();\r\n if (mesh.skeleton) {\r\n _this._copyBonesTransformationMatrices(mesh.skeleton.getTransformMatrices(mesh), _this._previousBonesTransformationMatrices[mesh.uniqueId]);\r\n }\r\n }\r\n };\r\n this._multiRenderTarget.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var index;\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n };\r\n };\r\n // Copies the bones transformation matrices into the target array and returns the target's reference\r\n GeometryBufferRenderer.prototype._copyBonesTransformationMatrices = function (source, target) {\r\n for (var i = 0; i < source.length; i++) {\r\n target[i] = source[i];\r\n }\r\n return target;\r\n };\r\n /**\r\n * Constant used to retrieve the position texture index in the G-Buffer textures array\r\n * using getIndex(GeometryBufferRenderer.POSITION_TEXTURE_INDEX)\r\n */\r\n GeometryBufferRenderer.POSITION_TEXTURE_TYPE = 1;\r\n /**\r\n * Constant used to retrieve the velocity texture index in the G-Buffer textures array\r\n * using getIndex(GeometryBufferRenderer.VELOCITY_TEXTURE_INDEX)\r\n */\r\n GeometryBufferRenderer.VELOCITY_TEXTURE_TYPE = 2;\r\n /** @hidden */\r\n GeometryBufferRenderer._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"GeometryBufferRendererSceneComponent\");\r\n };\r\n return GeometryBufferRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/geometryBufferRendererSceneComponent.ts\":\n/*!***********************************************************!*\\\n !*** ./Rendering/geometryBufferRendererSceneComponent.ts ***!\n \\***********************************************************/\n/*! exports provided: GeometryBufferRendererSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return GeometryBufferRendererSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./geometryBufferRenderer */ \"./Rendering/geometryBufferRenderer.ts\");\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"geometryBufferRenderer\", {\r\n get: function () {\r\n this._geometryBufferRenderer;\r\n },\r\n set: function (value) {\r\n if (value && value.isSupported) {\r\n this._geometryBufferRenderer = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.enableGeometryBufferRenderer = function (ratio) {\r\n if (ratio === void 0) { ratio = 1; }\r\n if (this._geometryBufferRenderer) {\r\n return this._geometryBufferRenderer;\r\n }\r\n this._geometryBufferRenderer = new _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_2__[\"GeometryBufferRenderer\"](this, ratio);\r\n if (!this._geometryBufferRenderer.isSupported) {\r\n this._geometryBufferRenderer = null;\r\n }\r\n return this._geometryBufferRenderer;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.disableGeometryBufferRenderer = function () {\r\n if (!this._geometryBufferRenderer) {\r\n return;\r\n }\r\n this._geometryBufferRenderer.dispose();\r\n this._geometryBufferRenderer = null;\r\n};\r\n/**\r\n * Defines the Geometry Buffer scene component responsible to manage a G-Buffer useful\r\n * in several rendering techniques.\r\n */\r\nvar GeometryBufferRendererSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function GeometryBufferRendererSceneComponent(scene) {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GEOMETRYBUFFERRENDERER;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n GeometryBufferRendererSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n GeometryBufferRendererSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n GeometryBufferRendererSceneComponent.prototype.dispose = function () {\r\n // Nothing to do for this component\r\n };\r\n GeometryBufferRendererSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {\r\n if (this.scene._geometryBufferRenderer) {\r\n renderTargets.push(this.scene._geometryBufferRenderer.getGBuffer());\r\n }\r\n };\r\n return GeometryBufferRendererSceneComponent;\r\n}());\r\n\r\n_geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_2__[\"GeometryBufferRenderer\"]._SceneComponentInitialization = function (scene) {\r\n // Register the G Buffer component to the scene.\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GEOMETRYBUFFERRENDERER);\r\n if (!component) {\r\n component = new GeometryBufferRendererSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/index.ts\":\n/*!****************************!*\\\n !*** ./Rendering/index.ts ***!\n \\****************************/\n/*! exports provided: BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boundingBoxRenderer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boundingBoxRenderer */ \"./Rendering/boundingBoxRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return _boundingBoxRenderer__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBoxRenderer\"]; });\n\n/* harmony import */ var _depthRenderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./depthRenderer */ \"./Rendering/depthRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return _depthRenderer__WEBPACK_IMPORTED_MODULE_1__[\"DepthRenderer\"]; });\n\n/* harmony import */ var _depthRendererSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./depthRendererSceneComponent */ \"./Rendering/depthRendererSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return _depthRendererSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"DepthRendererSceneComponent\"]; });\n\n/* harmony import */ var _edgesRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edgesRenderer */ \"./Rendering/edgesRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return _edgesRenderer__WEBPACK_IMPORTED_MODULE_3__[\"EdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return _edgesRenderer__WEBPACK_IMPORTED_MODULE_3__[\"LineEdgesRenderer\"]; });\n\n/* harmony import */ var _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./geometryBufferRenderer */ \"./Rendering/geometryBufferRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_4__[\"GeometryBufferRenderer\"]; });\n\n/* harmony import */ var _geometryBufferRendererSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./geometryBufferRendererSceneComponent */ \"./Rendering/geometryBufferRendererSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return _geometryBufferRendererSceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"GeometryBufferRendererSceneComponent\"]; });\n\n/* harmony import */ var _outlineRenderer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./outlineRenderer */ \"./Rendering/outlineRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return _outlineRenderer__WEBPACK_IMPORTED_MODULE_6__[\"OutlineRenderer\"]; });\n\n/* harmony import */ var _renderingGroup__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./renderingGroup */ \"./Rendering/renderingGroup.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return _renderingGroup__WEBPACK_IMPORTED_MODULE_7__[\"RenderingGroup\"]; });\n\n/* harmony import */ var _renderingManager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./renderingManager */ \"./Rendering/renderingManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return _renderingManager__WEBPACK_IMPORTED_MODULE_8__[\"RenderingGroupInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return _renderingManager__WEBPACK_IMPORTED_MODULE_8__[\"RenderingManager\"]; });\n\n/* harmony import */ var _utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return _utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__[\"UtilityLayerRenderer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/outlineRenderer.ts\":\n/*!**************************************!*\\\n !*** ./Rendering/outlineRenderer.ts ***!\n \\**************************************/\n/*! exports provided: OutlineRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return OutlineRenderer; });\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Shaders_outline_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/outline.fragment */ \"./Shaders/outline.fragment.ts\");\n/* harmony import */ var _Shaders_outline_vertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/outline.vertex */ \"./Shaders/outline.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gets the outline renderer associated with the scene\r\n * @returns a OutlineRenderer\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype.getOutlineRenderer = function () {\r\n if (!this._outlineRenderer) {\r\n this._outlineRenderer = new OutlineRenderer(this);\r\n }\r\n return this._outlineRenderer;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"renderOutline\", {\r\n get: function () {\r\n return this._renderOutline;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n // Lazy Load the component.\r\n this.getScene().getOutlineRenderer();\r\n }\r\n this._renderOutline = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"renderOverlay\", {\r\n get: function () {\r\n return this._renderOverlay;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n // Lazy Load the component.\r\n this.getScene().getOutlineRenderer();\r\n }\r\n this._renderOverlay = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * This class is responsible to draw bothe outline/overlay of meshes.\r\n * It should not be used directly but through the available method on mesh.\r\n */\r\nvar OutlineRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new outline renderer. (There could be only one per scene).\r\n * @param scene Defines the scene it belongs to\r\n */\r\n function OutlineRenderer(scene) {\r\n /**\r\n * The name of the component. Each component must have a unique name.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OUTLINERENDERER;\r\n /**\r\n * Defines a zOffset to prevent zFighting between the overlay and the mesh.\r\n */\r\n this.zOffset = 1;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n this.scene._addComponent(this);\r\n }\r\n /**\r\n * Register the component to one instance of a scene.\r\n */\r\n OutlineRenderer.prototype.register = function () {\r\n this.scene._beforeRenderingMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_BEFORERENDERINGMESH_OUTLINE, this, this._beforeRenderingMesh);\r\n this.scene._afterRenderingMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_AFTERRENDERINGMESH_OUTLINE, this, this._afterRenderingMesh);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n OutlineRenderer.prototype.rebuild = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n OutlineRenderer.prototype.dispose = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Renders the outline in the canvas.\r\n * @param subMesh Defines the sumesh to render\r\n * @param batch Defines the batch of meshes in case of instances\r\n * @param useOverlay Defines if the rendering is for the overlay or the outline\r\n */\r\n OutlineRenderer.prototype.render = function (subMesh, batch, useOverlay) {\r\n var _this = this;\r\n if (useOverlay === void 0) { useOverlay = false; }\r\n var scene = this.scene;\r\n var engine = scene.getEngine();\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null) && (batch.visibleInstances[subMesh._id] !== undefined);\r\n if (!this.isReady(subMesh, hardwareInstancedRendering)) {\r\n return;\r\n }\r\n var mesh = subMesh.getRenderingMesh();\r\n var material = subMesh.getMaterial();\r\n if (!material || !scene.activeCamera) {\r\n return;\r\n }\r\n engine.enableEffect(this._effect);\r\n // Logarithmic depth\r\n if (material.useLogarithmicDepth) {\r\n this._effect.setFloat(\"logarithmicDepthConstant\", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));\r\n }\r\n this._effect.setFloat(\"offset\", useOverlay ? 0 : mesh.outlineWidth);\r\n this._effect.setColor4(\"color\", useOverlay ? mesh.overlayColor : mesh.outlineColor, useOverlay ? mesh.overlayAlpha : material.alpha);\r\n this._effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n this._effect.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._effect);\r\n mesh._bind(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode);\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n engine.setZOffset(-this.zOffset);\r\n mesh._processRendering(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { _this._effect.setMatrix(\"world\", world); });\r\n engine.setZOffset(0);\r\n };\r\n /**\r\n * Returns whether or not the outline renderer is ready for a given submesh.\r\n * All the dependencies e.g. submeshes, texture, effect... mus be ready\r\n * @param subMesh Defines the submesh to check readyness for\r\n * @param useInstances Defines wheter wee are trying to render instances or not\r\n * @returns true if ready otherwise false\r\n */\r\n OutlineRenderer.prototype.isReady = function (subMesh, useInstances) {\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].PositionKind, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].NormalKind];\r\n var mesh = subMesh.getMesh();\r\n var material = subMesh.getMaterial();\r\n if (material) {\r\n // Alpha test\r\n if (material.needAlphaTesting()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n //Logarithmic depth\r\n if (material.useLogarithmicDepth) {\r\n defines.push(\"#define LOGARITHMICDEPTH\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var morphTargetManager = mesh.morphTargetManager;\r\n var numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n if (morphTargetManager.numInfluencers > 0) {\r\n numMorphInfluencers = morphTargetManager.numInfluencers;\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = this.scene.getEngine().createEffect(\"outline\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"offset\", \"color\", \"logarithmicDepthConstant\", \"morphTargetInfluences\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { maxSimultaneousMorphTargets: numMorphInfluencers });\r\n }\r\n return this._effect.isReady();\r\n };\r\n OutlineRenderer.prototype._beforeRenderingMesh = function (mesh, subMesh, batch) {\r\n // Outline - step 1\r\n this._savedDepthWrite = this._engine.getDepthWrite();\r\n if (mesh.renderOutline) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.needAlphaBlending()) {\r\n this._engine.cacheStencilState();\r\n // Draw only to stencil buffer for the original mesh\r\n // The resulting stencil buffer will be used so the outline is not visible inside the mesh when the mesh is transparent\r\n this._engine.setDepthWrite(false);\r\n this._engine.setColorWrite(false);\r\n this._engine.setStencilBuffer(true);\r\n this._engine.setStencilOperationPass(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].REPLACE);\r\n this._engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALWAYS);\r\n this._engine.setStencilMask(OutlineRenderer._StencilReference);\r\n this._engine.setStencilFunctionReference(OutlineRenderer._StencilReference);\r\n this.render(subMesh, batch, /* This sets offset to 0 */ true);\r\n this._engine.setColorWrite(true);\r\n this._engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].NOTEQUAL);\r\n }\r\n // Draw the outline using the above stencil if needed to avoid drawing within the mesh\r\n this._engine.setDepthWrite(false);\r\n this.render(subMesh, batch);\r\n this._engine.setDepthWrite(this._savedDepthWrite);\r\n if (material && material.needAlphaBlending()) {\r\n this._engine.restoreStencilState();\r\n }\r\n }\r\n };\r\n OutlineRenderer.prototype._afterRenderingMesh = function (mesh, subMesh, batch) {\r\n // Overlay\r\n if (mesh.renderOverlay) {\r\n var currentMode = this._engine.getAlphaMode();\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALPHA_COMBINE);\r\n this.render(subMesh, batch, true);\r\n this._engine.setAlphaMode(currentMode);\r\n }\r\n // Outline - step 2\r\n if (mesh.renderOutline && this._savedDepthWrite) {\r\n this._engine.setDepthWrite(true);\r\n this._engine.setColorWrite(false);\r\n this.render(subMesh, batch);\r\n this._engine.setColorWrite(true);\r\n }\r\n };\r\n /**\r\n * Stencil value used to avoid outline being seen within the mesh when the mesh is transparent\r\n */\r\n OutlineRenderer._StencilReference = 0x04;\r\n return OutlineRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/renderingGroup.ts\":\n/*!*************************************!*\\\n !*** ./Rendering/renderingGroup.ts ***!\n \\*************************************/\n/*! exports provided: RenderingGroup */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return RenderingGroup; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n/**\r\n * This represents the object necessary to create a rendering group.\r\n * This is exclusively used and created by the rendering manager.\r\n * To modify the behavior, you use the available helpers in your scene or meshes.\r\n * @hidden\r\n */\r\nvar RenderingGroup = /** @class */ (function () {\r\n /**\r\n * Creates a new rendering group.\r\n * @param index The rendering group index\r\n * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied\r\n * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied\r\n * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied\r\n */\r\n function RenderingGroup(index, scene, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this.index = index;\r\n this._opaqueSubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._transparentSubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._alphaTestSubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._depthOnlySubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._particleSystems = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._spriteManagers = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n /** @hidden */\r\n this._edgesRenderers = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](16);\r\n this._scene = scene;\r\n this.opaqueSortCompareFn = opaqueSortCompareFn;\r\n this.alphaTestSortCompareFn = alphaTestSortCompareFn;\r\n this.transparentSortCompareFn = transparentSortCompareFn;\r\n }\r\n Object.defineProperty(RenderingGroup.prototype, \"opaqueSortCompareFn\", {\r\n /**\r\n * Set the opaque sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._opaqueSortCompareFn = value;\r\n if (value) {\r\n this._renderOpaque = this.renderOpaqueSorted;\r\n }\r\n else {\r\n this._renderOpaque = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"alphaTestSortCompareFn\", {\r\n /**\r\n * Set the alpha test sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._alphaTestSortCompareFn = value;\r\n if (value) {\r\n this._renderAlphaTest = this.renderAlphaTestSorted;\r\n }\r\n else {\r\n this._renderAlphaTest = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"transparentSortCompareFn\", {\r\n /**\r\n * Set the transparent sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this._transparentSortCompareFn = value;\r\n }\r\n else {\r\n this._transparentSortCompareFn = RenderingGroup.defaultTransparentSortCompare;\r\n }\r\n this._renderTransparent = this.renderTransparentSorted;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Render all the sub meshes contained in the group.\r\n * @param customRenderFunction Used to override the default render behaviour of the group.\r\n * @returns true if rendered some submeshes.\r\n */\r\n RenderingGroup.prototype.render = function (customRenderFunction, renderSprites, renderParticles, activeMeshes) {\r\n if (customRenderFunction) {\r\n customRenderFunction(this._opaqueSubMeshes, this._alphaTestSubMeshes, this._transparentSubMeshes, this._depthOnlySubMeshes);\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n // Depth only\r\n if (this._depthOnlySubMeshes.length !== 0) {\r\n engine.setColorWrite(false);\r\n this._renderAlphaTest(this._depthOnlySubMeshes);\r\n engine.setColorWrite(true);\r\n }\r\n // Opaque\r\n if (this._opaqueSubMeshes.length !== 0) {\r\n this._renderOpaque(this._opaqueSubMeshes);\r\n }\r\n // Alpha test\r\n if (this._alphaTestSubMeshes.length !== 0) {\r\n this._renderAlphaTest(this._alphaTestSubMeshes);\r\n }\r\n var stencilState = engine.getStencilBuffer();\r\n engine.setStencilBuffer(false);\r\n // Sprites\r\n if (renderSprites) {\r\n this._renderSprites();\r\n }\r\n // Particles\r\n if (renderParticles) {\r\n this._renderParticles(activeMeshes);\r\n }\r\n if (this.onBeforeTransparentRendering) {\r\n this.onBeforeTransparentRendering();\r\n }\r\n // Transparent\r\n if (this._transparentSubMeshes.length !== 0) {\r\n this._renderTransparent(this._transparentSubMeshes);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // Set back stencil to false in case it changes before the edge renderer.\r\n engine.setStencilBuffer(false);\r\n // Edges\r\n if (this._edgesRenderers.length) {\r\n for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {\r\n this._edgesRenderers.data[edgesRendererIndex].render();\r\n }\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // Restore Stencil state.\r\n engine.setStencilBuffer(stencilState);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the opaqueSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderOpaqueSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._opaqueSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the alphatestSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderAlphaTestSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._alphaTestSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the transparentSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderTransparentSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._transparentSortCompareFn, this._scene.activeCamera, true);\r\n };\r\n /**\r\n * Renders the submeshes in a specified order.\r\n * @param subMeshes The submeshes to sort before render\r\n * @param sortCompareFn The comparison function use to sort\r\n * @param cameraPosition The camera position use to preprocess the submeshes to help sorting\r\n * @param transparent Specifies to activate blending if true\r\n */\r\n RenderingGroup.renderSorted = function (subMeshes, sortCompareFn, camera, transparent) {\r\n var subIndex = 0;\r\n var subMesh;\r\n var cameraPosition = camera ? camera.globalPosition : RenderingGroup._zeroVector;\r\n for (; subIndex < subMeshes.length; subIndex++) {\r\n subMesh = subMeshes.data[subIndex];\r\n subMesh._alphaIndex = subMesh.getMesh().alphaIndex;\r\n subMesh._distanceToCamera = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Distance(subMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\r\n }\r\n var sortedArray = subMeshes.data.slice(0, subMeshes.length);\r\n if (sortCompareFn) {\r\n sortedArray.sort(sortCompareFn);\r\n }\r\n for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {\r\n subMesh = sortedArray[subIndex];\r\n if (transparent) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.needDepthPrePass) {\r\n var engine = material.getScene().getEngine();\r\n engine.setColorWrite(false);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n subMesh.render(false);\r\n engine.setColorWrite(true);\r\n }\r\n }\r\n subMesh.render(transparent);\r\n }\r\n };\r\n /**\r\n * Renders the submeshes in the order they were dispatched (no sort applied).\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.renderUnsorted = function (subMeshes) {\r\n for (var subIndex = 0; subIndex < subMeshes.length; subIndex++) {\r\n var submesh = subMeshes.data[subIndex];\r\n submesh.render(false);\r\n }\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front if in the same alpha index.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.defaultTransparentSortCompare = function (a, b) {\r\n // Alpha index first\r\n if (a._alphaIndex > b._alphaIndex) {\r\n return 1;\r\n }\r\n if (a._alphaIndex < b._alphaIndex) {\r\n return -1;\r\n }\r\n // Then distance to camera\r\n return RenderingGroup.backToFrontSortCompare(a, b);\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.backToFrontSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return 1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return -1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered front to back (prevent overdraw).\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.frontToBackSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return -1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return 1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Resets the different lists of submeshes to prepare a new frame.\r\n */\r\n RenderingGroup.prototype.prepare = function () {\r\n this._opaqueSubMeshes.reset();\r\n this._transparentSubMeshes.reset();\r\n this._alphaTestSubMeshes.reset();\r\n this._depthOnlySubMeshes.reset();\r\n this._particleSystems.reset();\r\n this._spriteManagers.reset();\r\n this._edgesRenderers.reset();\r\n };\r\n RenderingGroup.prototype.dispose = function () {\r\n this._opaqueSubMeshes.dispose();\r\n this._transparentSubMeshes.dispose();\r\n this._alphaTestSubMeshes.dispose();\r\n this._depthOnlySubMeshes.dispose();\r\n this._particleSystems.dispose();\r\n this._spriteManagers.dispose();\r\n this._edgesRenderers.dispose();\r\n };\r\n /**\r\n * Inserts the submesh in its correct queue depending on its material.\r\n * @param subMesh The submesh to dispatch\r\n * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingGroup.prototype.dispatch = function (subMesh, mesh, material) {\r\n // Get mesh and materials if not provided\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n if (material === undefined) {\r\n material = subMesh.getMaterial();\r\n }\r\n if (material === null || material === undefined) {\r\n return;\r\n }\r\n if (material.needAlphaBlendingForMesh(mesh)) { // Transparent\r\n this._transparentSubMeshes.push(subMesh);\r\n }\r\n else if (material.needAlphaTesting()) { // Alpha test\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._alphaTestSubMeshes.push(subMesh);\r\n }\r\n else {\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._opaqueSubMeshes.push(subMesh); // Opaque\r\n }\r\n mesh._renderingGroup = this;\r\n if (mesh._edgesRenderer && mesh._edgesRenderer.isEnabled) {\r\n this._edgesRenderers.push(mesh._edgesRenderer);\r\n }\r\n };\r\n RenderingGroup.prototype.dispatchSprites = function (spriteManager) {\r\n this._spriteManagers.push(spriteManager);\r\n };\r\n RenderingGroup.prototype.dispatchParticles = function (particleSystem) {\r\n this._particleSystems.push(particleSystem);\r\n };\r\n RenderingGroup.prototype._renderParticles = function (activeMeshes) {\r\n if (this._particleSystems.length === 0) {\r\n return;\r\n }\r\n // Particles\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);\r\n for (var particleIndex = 0; particleIndex < this._particleSystems.length; particleIndex++) {\r\n var particleSystem = this._particleSystems.data[particleIndex];\r\n if ((activeCamera && activeCamera.layerMask & particleSystem.layerMask) === 0) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || !activeMeshes || activeMeshes.indexOf(emitter) !== -1) {\r\n this._scene._activeParticles.addCount(particleSystem.render(), false);\r\n }\r\n }\r\n this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup.prototype._renderSprites = function () {\r\n if (!this._scene.spritesEnabled || this._spriteManagers.length === 0) {\r\n return;\r\n }\r\n // Sprites\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);\r\n for (var id = 0; id < this._spriteManagers.length; id++) {\r\n var spriteManager = this._spriteManagers.data[id];\r\n if (((activeCamera && activeCamera.layerMask & spriteManager.layerMask) !== 0)) {\r\n spriteManager.render();\r\n }\r\n }\r\n this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup._zeroVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n return RenderingGroup;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/renderingManager.ts\":\n/*!***************************************!*\\\n !*** ./Rendering/renderingManager.ts ***!\n \\***************************************/\n/*! exports provided: RenderingGroupInfo, RenderingManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return RenderingGroupInfo; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return RenderingManager; });\n/* harmony import */ var _renderingGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./renderingGroup */ \"./Rendering/renderingGroup.ts\");\n\r\n/**\r\n * This class is used by the onRenderingGroupObservable\r\n */\r\nvar RenderingGroupInfo = /** @class */ (function () {\r\n function RenderingGroupInfo() {\r\n }\r\n return RenderingGroupInfo;\r\n}());\r\n\r\n/**\r\n * This is the manager responsible of all the rendering for meshes sprites and particles.\r\n * It is enable to manage the different groups as well as the different necessary sort functions.\r\n * This should not be used directly aside of the few static configurations\r\n */\r\nvar RenderingManager = /** @class */ (function () {\r\n /**\r\n * Instantiates a new rendering group for a particular scene\r\n * @param scene Defines the scene the groups belongs to\r\n */\r\n function RenderingManager(scene) {\r\n /**\r\n * @hidden\r\n */\r\n this._useSceneAutoClearSetup = false;\r\n this._renderingGroups = new Array();\r\n this._autoClearDepthStencil = {};\r\n this._customOpaqueSortCompareFn = {};\r\n this._customAlphaTestSortCompareFn = {};\r\n this._customTransparentSortCompareFn = {};\r\n this._renderingGroupInfo = new RenderingGroupInfo();\r\n this._scene = scene;\r\n for (var i = RenderingManager.MIN_RENDERINGGROUPS; i < RenderingManager.MAX_RENDERINGGROUPS; i++) {\r\n this._autoClearDepthStencil[i] = { autoClear: true, depth: true, stencil: true };\r\n }\r\n }\r\n RenderingManager.prototype._clearDepthStencilBuffer = function (depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n if (this._depthStencilBufferAlreadyCleaned) {\r\n return;\r\n }\r\n this._scene.getEngine().clear(null, false, depth, stencil);\r\n this._depthStencilBufferAlreadyCleaned = true;\r\n };\r\n /**\r\n * Renders the entire managed groups. This is used by the scene or the different rennder targets.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.render = function (customRenderFunction, activeMeshes, renderParticles, renderSprites) {\r\n // Update the observable context (not null as it only goes away on dispose)\r\n var info = this._renderingGroupInfo;\r\n info.scene = this._scene;\r\n info.camera = this._scene.activeCamera;\r\n // Dispatch sprites\r\n if (this._scene.spriteManagers && renderSprites) {\r\n for (var index = 0; index < this._scene.spriteManagers.length; index++) {\r\n var manager = this._scene.spriteManagers[index];\r\n this.dispatchSprites(manager);\r\n }\r\n }\r\n // Render\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n this._depthStencilBufferAlreadyCleaned = index === RenderingManager.MIN_RENDERINGGROUPS;\r\n var renderingGroup = this._renderingGroups[index];\r\n if (!renderingGroup) {\r\n continue;\r\n }\r\n var renderingGroupMask = Math.pow(2, index);\r\n info.renderingGroupId = index;\r\n // Before Observable\r\n this._scene.onBeforeRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n // Clear depth/stencil if needed\r\n if (RenderingManager.AUTOCLEAR) {\r\n var autoClear = this._useSceneAutoClearSetup ?\r\n this._scene.getAutoClearDepthStencilSetup(index) :\r\n this._autoClearDepthStencil[index];\r\n if (autoClear && autoClear.autoClear) {\r\n this._clearDepthStencilBuffer(autoClear.depth, autoClear.stencil);\r\n }\r\n }\r\n // Render\r\n for (var _i = 0, _a = this._scene._beforeRenderingGroupDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(index);\r\n }\r\n renderingGroup.render(customRenderFunction, renderSprites, renderParticles, activeMeshes);\r\n for (var _b = 0, _c = this._scene._afterRenderingGroupDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(index);\r\n }\r\n // After Observable\r\n this._scene.onAfterRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n }\r\n };\r\n /**\r\n * Resets the different information of the group to prepare a new frame\r\n * @hidden\r\n */\r\n RenderingManager.prototype.reset = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepare();\r\n }\r\n }\r\n };\r\n /**\r\n * Dispose and release the group and its associated resources.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.dispose = function () {\r\n this.freeRenderingGroups();\r\n this._renderingGroups.length = 0;\r\n this._renderingGroupInfo = null;\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n RenderingManager.prototype.freeRenderingGroups = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.dispose();\r\n }\r\n }\r\n };\r\n RenderingManager.prototype._prepareRenderingGroup = function (renderingGroupId) {\r\n if (this._renderingGroups[renderingGroupId] === undefined) {\r\n this._renderingGroups[renderingGroupId] = new _renderingGroup__WEBPACK_IMPORTED_MODULE_0__[\"RenderingGroup\"](renderingGroupId, this._scene, this._customOpaqueSortCompareFn[renderingGroupId], this._customAlphaTestSortCompareFn[renderingGroupId], this._customTransparentSortCompareFn[renderingGroupId]);\r\n }\r\n };\r\n /**\r\n * Add a sprite manager to the rendering manager in order to render it this frame.\r\n * @param spriteManager Define the sprite manager to render\r\n */\r\n RenderingManager.prototype.dispatchSprites = function (spriteManager) {\r\n var renderingGroupId = spriteManager.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchSprites(spriteManager);\r\n };\r\n /**\r\n * Add a particle system to the rendering manager in order to render it this frame.\r\n * @param particleSystem Define the particle system to render\r\n */\r\n RenderingManager.prototype.dispatchParticles = function (particleSystem) {\r\n var renderingGroupId = particleSystem.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchParticles(particleSystem);\r\n };\r\n /**\r\n * Add a submesh to the manager in order to render it this frame\r\n * @param subMesh The submesh to dispatch\r\n * @param mesh Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param material Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingManager.prototype.dispatch = function (subMesh, mesh, material) {\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n var renderingGroupId = mesh.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatch(subMesh, mesh, material);\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderingManager.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._customOpaqueSortCompareFn[renderingGroupId] = opaqueSortCompareFn;\r\n this._customAlphaTestSortCompareFn[renderingGroupId] = alphaTestSortCompareFn;\r\n this._customTransparentSortCompareFn[renderingGroupId] = transparentSortCompareFn;\r\n if (this._renderingGroups[renderingGroupId]) {\r\n var group = this._renderingGroups[renderingGroupId];\r\n group.opaqueSortCompareFn = this._customOpaqueSortCompareFn[renderingGroupId];\r\n group.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[renderingGroupId];\r\n group.transparentSortCompareFn = this._customTransparentSortCompareFn[renderingGroupId];\r\n }\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n RenderingManager.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._autoClearDepthStencil[renderingGroupId] = {\r\n autoClear: autoClearDepthStencil,\r\n depth: depth,\r\n stencil: stencil\r\n };\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n RenderingManager.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._autoClearDepthStencil[index];\r\n };\r\n /**\r\n * The max id used for rendering groups (not included)\r\n */\r\n RenderingManager.MAX_RENDERINGGROUPS = 4;\r\n /**\r\n * The min id used for rendering groups (included)\r\n */\r\n RenderingManager.MIN_RENDERINGGROUPS = 0;\r\n /**\r\n * Used to globally prevent autoclearing scenes.\r\n */\r\n RenderingManager.AUTOCLEAR = true;\r\n return RenderingManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/utilityLayerRenderer.ts\":\n/*!*******************************************!*\\\n !*** ./Rendering/utilityLayerRenderer.ts ***!\n \\*******************************************/\n/*! exports provided: UtilityLayerRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return UtilityLayerRenderer; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Renders a layer on top of an existing scene\r\n */\r\nvar UtilityLayerRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a UtilityLayerRenderer\r\n * @param originalScene the original scene that will be rendered on top of\r\n * @param handleEvents boolean indicating if the utility layer should handle events\r\n */\r\n function UtilityLayerRenderer(\r\n /** the original scene that will be rendered on top of */\r\n originalScene, handleEvents) {\r\n var _this = this;\r\n if (handleEvents === void 0) { handleEvents = true; }\r\n this.originalScene = originalScene;\r\n this._pointerCaptures = {};\r\n this._lastPointerEvents = {};\r\n this._sharedGizmoLight = null;\r\n this._renderCamera = null;\r\n /**\r\n * If the picking should be done on the utility layer prior to the actual scene (Default: true)\r\n */\r\n this.pickUtilitySceneFirst = true;\r\n /**\r\n * If the utility layer should automatically be rendered on top of existing scene\r\n */\r\n this.shouldRender = true;\r\n /**\r\n * If set to true, only pointer down onPointerObservable events will be blocked when picking is occluded by original scene\r\n */\r\n this.onlyCheckPointerDownEvents = true;\r\n /**\r\n * If set to false, only pointerUp, pointerDown and pointerMove will be sent to the utilityLayerScene (false by default)\r\n */\r\n this.processAllEvents = false;\r\n /**\r\n * Observable raised when the pointer move from the utility layer scene to the main scene\r\n */\r\n this.onPointerOutObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n // Create scene which will be rendered in the foreground and remove it from being referenced by engine to avoid interfering with existing app\r\n this.utilityLayerScene = new _scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"](originalScene.getEngine(), { virtual: true });\r\n this.utilityLayerScene.useRightHandedSystem = originalScene.useRightHandedSystem;\r\n this.utilityLayerScene._allowPostProcessClearColor = false;\r\n // Detach controls on utility scene, events will be fired by logic below to handle picking priority\r\n this.utilityLayerScene.detachControl();\r\n if (handleEvents) {\r\n this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {\r\n if (!_this.utilityLayerScene.activeCamera) {\r\n return;\r\n }\r\n if (!_this.processAllEvents) {\r\n if (prePointerInfo.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERMOVE\r\n && prePointerInfo.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP\r\n && prePointerInfo.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n return;\r\n }\r\n }\r\n _this.utilityLayerScene.pointerX = originalScene.pointerX;\r\n _this.utilityLayerScene.pointerY = originalScene.pointerY;\r\n var pointerEvent = (prePointerInfo.event);\r\n if (originalScene.isPointerCaptured(pointerEvent.pointerId)) {\r\n _this._pointerCaptures[pointerEvent.pointerId] = false;\r\n return;\r\n }\r\n var utilityScenePick = prePointerInfo.ray ? _this.utilityLayerScene.pickWithRay(prePointerInfo.ray) : _this.utilityLayerScene.pick(originalScene.pointerX, originalScene.pointerY);\r\n if (!prePointerInfo.ray && utilityScenePick) {\r\n prePointerInfo.ray = utilityScenePick.ray;\r\n }\r\n // always fire the prepointer oversvable\r\n _this.utilityLayerScene.onPrePointerObservable.notifyObservers(prePointerInfo);\r\n // allow every non pointer down event to flow to the utility layer\r\n if (_this.onlyCheckPointerDownEvents && prePointerInfo.type != _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerInfo\"](prePointerInfo.type, prePointerInfo.event, utilityScenePick));\r\n }\r\n if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP && _this._pointerCaptures[pointerEvent.pointerId]) {\r\n _this._pointerCaptures[pointerEvent.pointerId] = false;\r\n }\r\n return;\r\n }\r\n if (_this.utilityLayerScene.autoClearDepthAndStencil || _this.pickUtilitySceneFirst) {\r\n // If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene\r\n if (utilityScenePick && utilityScenePick.hit) {\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerInfo\"](prePointerInfo.type, prePointerInfo.event, utilityScenePick));\r\n }\r\n prePointerInfo.skipOnPointerObservable = true;\r\n }\r\n }\r\n else {\r\n var originalScenePick = prePointerInfo.ray ? originalScene.pickWithRay(prePointerInfo.ray) : originalScene.pick(originalScene.pointerX, originalScene.pointerY);\r\n var pointerEvent_1 = (prePointerInfo.event);\r\n // If the layer can be occluded by the original scene, only fire pointer events to the first layer that hit they ray\r\n if (originalScenePick && utilityScenePick) {\r\n // No pick in utility scene\r\n if (utilityScenePick.distance === 0 && originalScenePick.pickedMesh) {\r\n if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {\r\n // We touched an utility mesh present in the main scene\r\n _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);\r\n prePointerInfo.skipOnPointerObservable = true;\r\n }\r\n else if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._pointerCaptures[pointerEvent_1.pointerId] = true;\r\n }\r\n else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {\r\n // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete\r\n _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);\r\n delete _this._lastPointerEvents[pointerEvent_1.pointerId];\r\n }\r\n }\r\n else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance < originalScenePick.distance || originalScenePick.distance === 0)) {\r\n // We pick something in utility scene or the pick in utility is closer than the one in main scene\r\n _this._notifyObservers(prePointerInfo, utilityScenePick, pointerEvent_1);\r\n // If a previous utility layer set this, do not unset this\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n prePointerInfo.skipOnPointerObservable = utilityScenePick.distance > 0;\r\n }\r\n }\r\n else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance > originalScenePick.distance)) {\r\n // We have a pick in both scenes but main is closer than utility\r\n // We touched an utility mesh present in the main scene\r\n if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {\r\n _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);\r\n prePointerInfo.skipOnPointerObservable = true;\r\n }\r\n else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {\r\n // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete\r\n _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);\r\n delete _this._lastPointerEvents[pointerEvent_1.pointerId];\r\n }\r\n }\r\n if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP && _this._pointerCaptures[pointerEvent_1.pointerId]) {\r\n _this._pointerCaptures[pointerEvent_1.pointerId] = false;\r\n }\r\n }\r\n }\r\n });\r\n // As a newly added utility layer will be rendered over the screen last, it's pointer events should be processed first\r\n if (this._originalPointerObserver) {\r\n originalScene.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver);\r\n }\r\n }\r\n // Render directly on top of existing scene without clearing\r\n this.utilityLayerScene.autoClear = false;\r\n this._afterRenderObserver = this.originalScene.onAfterCameraRenderObservable.add(function (camera) {\r\n // Only render when the render camera finishes rendering\r\n if (_this.shouldRender && camera == _this.getRenderCamera()) {\r\n _this.render();\r\n }\r\n });\r\n this._sceneDisposeObserver = this.originalScene.onDisposeObservable.add(function () {\r\n _this.dispose();\r\n });\r\n this._updateCamera();\r\n }\r\n /**\r\n * Gets the camera that is used to render the utility layer (when not set, this will be the last active camera)\r\n * @returns the camera that is used when rendering the utility layer\r\n */\r\n UtilityLayerRenderer.prototype.getRenderCamera = function () {\r\n if (this._renderCamera) {\r\n return this._renderCamera;\r\n }\r\n else if (this.originalScene.activeCameras.length > 1) {\r\n return this.originalScene.activeCameras[this.originalScene.activeCameras.length - 1];\r\n }\r\n else {\r\n return this.originalScene.activeCamera;\r\n }\r\n };\r\n /**\r\n * Sets the camera that should be used when rendering the utility layer (If set to null the last active camera will be used)\r\n * @param cam the camera that should be used when rendering the utility layer\r\n */\r\n UtilityLayerRenderer.prototype.setRenderCamera = function (cam) {\r\n this._renderCamera = cam;\r\n };\r\n /**\r\n * @hidden\r\n * Light which used by gizmos to get light shading\r\n */\r\n UtilityLayerRenderer.prototype._getSharedGizmoLight = function () {\r\n if (!this._sharedGizmoLight) {\r\n this._sharedGizmoLight = new _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_4__[\"HemisphericLight\"](\"shared gizmo light\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](0, 1, 0), this.utilityLayerScene);\r\n this._sharedGizmoLight.intensity = 2;\r\n this._sharedGizmoLight.groundColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__[\"Color3\"].Gray();\r\n }\r\n return this._sharedGizmoLight;\r\n };\r\n Object.defineProperty(UtilityLayerRenderer, \"DefaultUtilityLayer\", {\r\n /**\r\n * A shared utility layer that can be used to overlay objects into a scene (Depth map of the previous scene is cleared before drawing on top of it)\r\n */\r\n get: function () {\r\n if (UtilityLayerRenderer._DefaultUtilityLayer == null) {\r\n UtilityLayerRenderer._DefaultUtilityLayer = new UtilityLayerRenderer(_Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene);\r\n UtilityLayerRenderer._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(function () {\r\n UtilityLayerRenderer._DefaultUtilityLayer = null;\r\n });\r\n }\r\n return UtilityLayerRenderer._DefaultUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UtilityLayerRenderer, \"DefaultKeepDepthUtilityLayer\", {\r\n /**\r\n * A shared utility layer that can be used to embed objects into a scene (Depth map of the previous scene is not cleared before drawing on top of it)\r\n */\r\n get: function () {\r\n if (UtilityLayerRenderer._DefaultKeepDepthUtilityLayer == null) {\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = new UtilityLayerRenderer(_Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene);\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false;\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function () {\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;\r\n });\r\n }\r\n return UtilityLayerRenderer._DefaultKeepDepthUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n UtilityLayerRenderer.prototype._notifyObservers = function (prePointerInfo, pickInfo, pointerEvent) {\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerInfo\"](prePointerInfo.type, prePointerInfo.event, pickInfo));\r\n this._lastPointerEvents[pointerEvent.pointerId] = true;\r\n }\r\n };\r\n /**\r\n * Renders the utility layers scene on top of the original scene\r\n */\r\n UtilityLayerRenderer.prototype.render = function () {\r\n this._updateCamera();\r\n if (this.utilityLayerScene.activeCamera) {\r\n // Set the camera's scene to utility layers scene\r\n var oldScene = this.utilityLayerScene.activeCamera.getScene();\r\n var camera = this.utilityLayerScene.activeCamera;\r\n camera._scene = this.utilityLayerScene;\r\n if (camera.leftCamera) {\r\n camera.leftCamera._scene = this.utilityLayerScene;\r\n }\r\n if (camera.rightCamera) {\r\n camera.rightCamera._scene = this.utilityLayerScene;\r\n }\r\n this.utilityLayerScene.render(false);\r\n // Reset camera's scene back to original\r\n camera._scene = oldScene;\r\n if (camera.leftCamera) {\r\n camera.leftCamera._scene = oldScene;\r\n }\r\n if (camera.rightCamera) {\r\n camera.rightCamera._scene = oldScene;\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes of the renderer\r\n */\r\n UtilityLayerRenderer.prototype.dispose = function () {\r\n this.onPointerOutObservable.clear();\r\n if (this._afterRenderObserver) {\r\n this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver);\r\n }\r\n if (this._sceneDisposeObserver) {\r\n this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n if (this._originalPointerObserver) {\r\n this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver);\r\n }\r\n this.utilityLayerScene.dispose();\r\n };\r\n UtilityLayerRenderer.prototype._updateCamera = function () {\r\n this.utilityLayerScene.cameraToUseForPointers = this.getRenderCamera();\r\n this.utilityLayerScene.activeCamera = this.getRenderCamera();\r\n };\r\n UtilityLayerRenderer._DefaultUtilityLayer = null;\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;\r\n return UtilityLayerRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/backgroundFragmentDeclaration.ts\":\n/*!*****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/backgroundFragmentDeclaration.ts ***!\n \\*****************************************************************/\n/*! exports provided: backgroundFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundFragmentDeclaration\", function() { return backgroundFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'backgroundFragmentDeclaration';\r\nvar shader = \" uniform vec4 vPrimaryColor;\\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\\nuniform vec4 vPrimaryColorShadow;\\n#endif\\nuniform float shadowLevel;\\nuniform float alpha;\\n#ifdef DIFFUSE\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\n#endif\\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\\nuniform vec3 vBackgroundCenter;\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nuniform vec4 vReflectionControl;\\n#endif\\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\\nuniform mat4 view;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/backgroundUboDeclaration.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/backgroundUboDeclaration.ts ***!\n \\************************************************************/\n/*! exports provided: backgroundUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundUboDeclaration\", function() { return backgroundUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'backgroundUboDeclaration';\r\nvar shader = \"layout(std140,column_major) uniform;\\nuniform Material\\n{\\nuniform vec4 vPrimaryColor;\\nuniform vec4 vPrimaryColorShadow;\\nuniform vec2 vDiffuseInfos;\\nuniform vec2 vReflectionInfos;\\nuniform mat4 diffuseMatrix;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\nuniform float fFovMultiplier;\\nuniform float pointSize;\\nuniform float shadowLevel;\\nuniform float alpha;\\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\\nuniform vec3 vBackgroundCenter;\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nuniform vec4 vReflectionControl;\\n#endif\\n};\\nuniform Scene {\\nmat4 viewProjection;\\n#ifdef MULTIVIEW\\nmat4 viewProjectionR;\\n#endif\\nmat4 view;\\n};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/backgroundVertexDeclaration.ts\":\n/*!***************************************************************!*\\\n !*** ./Shaders/ShadersInclude/backgroundVertexDeclaration.ts ***!\n \\***************************************************************/\n/*! exports provided: backgroundVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundVertexDeclaration\", function() { return backgroundVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'backgroundVertexDeclaration';\r\nvar shader = \"uniform mat4 view;\\nuniform mat4 viewProjection;\\nuniform float shadowLevel;\\n#ifdef DIFFUSE\\nuniform mat4 diffuseMatrix;\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\nuniform float fFovMultiplier;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bonesDeclaration.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/bonesDeclaration.ts ***!\n \\****************************************************/\n/*! exports provided: bonesDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bonesDeclaration\", function() { return bonesDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bonesDeclaration';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\n#ifdef BONETEXTURE\\nuniform sampler2D boneSampler;\\nuniform float boneTextureWidth;\\n#else\\nuniform mat4 mBones[BonesPerMesh];\\n#endif\\nattribute vec4 matricesIndices;\\nattribute vec4 matricesWeights;\\n#if NUM_BONE_INFLUENCERS>4\\nattribute vec4 matricesIndicesExtra;\\nattribute vec4 matricesWeightsExtra;\\n#endif\\n#ifdef BONETEXTURE\\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\\n{\\nfloat offset=index*4.0;\\nfloat dx=1.0/boneTextureWidth;\\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\\nreturn mat4(m0,m1,m2,m3);\\n}\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bonesDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bonesVertex.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/ShadersInclude/bonesVertex.ts ***!\n \\***********************************************/\n/*! exports provided: bonesVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bonesVertex\", function() { return bonesVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bonesVertex';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\nmat4 influence;\\n#ifdef BONETEXTURE\\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\\n#endif\\n#else\\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\n#endif\\nfinalWorld=finalWorld*influence;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bonesVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpFragment.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpFragment.ts ***!\n \\************************************************/\n/*! exports provided: bumpFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpFragment\", function() { return bumpFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpFragment';\r\nvar shader = \"vec2 uvOffset=vec2(0.0,0.0);\\n#if defined(BUMP) || defined(PARALLAX)\\n#ifdef NORMALXYSCALE\\nfloat normalScale=1.0;\\n#else\\nfloat normalScale=vBumpInfos.y;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#else\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\\n#endif\\n#elif defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#else\\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\\n#endif\\n#endif\\n#ifdef PARALLAX\\nmat3 invTBN=transposeMat3(TBN);\\n#ifdef PARALLAXOCCLUSION\\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\\n#else\\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\\n#endif\\n#endif\\n#ifdef BUMP\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\\nnormalW=normalize(mat3(normalMatrix)*normalW);\\n#else\\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpFragmentFunctions.ts\":\n/*!*********************************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpFragmentFunctions.ts ***!\n \\*********************************************************/\n/*! exports provided: bumpFragmentFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpFragmentFunctions\", function() { return bumpFragmentFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpFragmentFunctions';\r\nvar shader = \"#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nuniform mat4 normalMatrix;\\n#endif\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\\n{\\ntextureSample=textureSample*2.0-1.0;\\n#ifdef NORMALXYSCALE\\ntextureSample=normalize(textureSample*vec3(scale,scale,1.0));\\n#endif\\nreturn normalize(cotangentFrame*textureSample);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\\n{\\n\\nuv=gl_FrontFacing ? uv : -uv;\\n\\nvec3 dp1=dFdx(p);\\nvec3 dp2=dFdy(p);\\nvec2 duv1=dFdx(uv);\\nvec2 duv2=dFdy(uv);\\n\\nvec3 dp2perp=cross(dp2,normal);\\nvec3 dp1perp=cross(normal,dp1);\\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\\n\\ntangent*=tangentSpaceParams.x;\\nbitangent*=tangentSpaceParams.y;\\n\\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\\n}\\n#endif\\n#ifdef BUMP\\n#if BUMPDIRECTUV == 1\\n#define vBumpUV vMainUV1\\n#elif BUMPDIRECTUV == 2\\n#define vBumpUV vMainUV2\\n#else\\nvarying vec2 vBumpUV;\\n#endif\\nuniform sampler2D bumpSampler;\\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\\n{\\nreturn perturbNormal(cotangentFrame,texture2D(bumpSampler,uv).xyz,vBumpInfos.y);\\n}\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 color)\\n{\\nreturn perturbNormal(cotangentFrame,color,vBumpInfos.y);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\\n{\\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\\n}\\n#endif\\n#if defined(BUMP) && defined(PARALLAX)\\nconst float minSamples=4.;\\nconst float maxSamples=15.;\\nconst int iMaxSamples=15;\\n\\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\\nparallaxLimit*=parallaxScale;\\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\\nfloat stepSize=1.0/numSamples;\\n\\nfloat currRayHeight=1.0;\\nvec2 vCurrOffset=vec2(0,0);\\nvec2 vLastOffset=vec2(0,0);\\nfloat lastSampledHeight=1.0;\\nfloat currSampledHeight=1.0;\\nfor (int i=0; icurrRayHeight)\\n{\\nfloat delta1=currSampledHeight-currRayHeight;\\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\\nfloat ratio=delta1/(delta1+delta2);\\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\\n\\nbreak;\\n}\\nelse\\n{\\ncurrRayHeight-=stepSize;\\nvLastOffset=vCurrOffset;\\nvCurrOffset+=stepSize*vMaxOffset;\\nlastSampledHeight=currSampledHeight;\\n}\\n}\\nreturn vCurrOffset;\\n}\\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\\n{\\n\\nfloat height=texture2D(bumpSampler,vBumpUV).w;\\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\\nreturn -texCoordOffset;\\n}\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpFragmentFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpVertex.ts\":\n/*!**********************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpVertex.ts ***!\n \\**********************************************/\n/*! exports provided: bumpVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpVertex\", function() { return bumpVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpVertex';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP)\\n#if defined(TANGENT) && defined(NORMAL)\\nvec3 tbnNormal=normalize(normalUpdated);\\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpVertexDeclaration.ts\":\n/*!*********************************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpVertexDeclaration.ts ***!\n \\*********************************************************/\n/*! exports provided: bumpVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpVertexDeclaration\", function() { return bumpVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpVertexDeclaration';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\":\n/*!*****************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneFragment.ts ***!\n \\*****************************************************/\n/*! exports provided: clipPlaneFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneFragment\", function() { return clipPlaneFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneFragment';\r\nvar shader = \"#ifdef CLIPPLANE\\nif (fClipDistance>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE2\\nif (fClipDistance2>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE3\\nif (fClipDistance3>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE4\\nif (fClipDistance4>0.0)\\n{\\ndiscard;\\n}\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\":\n/*!****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts ***!\n \\****************************************************************/\n/*! exports provided: clipPlaneFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneFragmentDeclaration\", function() { return clipPlaneFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneFragmentDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nvarying float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration2.ts\":\n/*!*****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneFragmentDeclaration2.ts ***!\n \\*****************************************************************/\n/*! exports provided: clipPlaneFragmentDeclaration2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneFragmentDeclaration2\", function() { return clipPlaneFragmentDeclaration2; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneFragmentDeclaration2';\r\nvar shader = \"#ifdef CLIPPLANE\\nin float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nin float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nin float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nin float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneFragmentDeclaration2 = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneVertex.ts ***!\n \\***************************************************/\n/*! exports provided: clipPlaneVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneVertex\", function() { return clipPlaneVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneVertex';\r\nvar shader = \"#ifdef CLIPPLANE\\nfClipDistance=dot(worldPos,vClipPlane);\\n#endif\\n#ifdef CLIPPLANE2\\nfClipDistance2=dot(worldPos,vClipPlane2);\\n#endif\\n#ifdef CLIPPLANE3\\nfClipDistance3=dot(worldPos,vClipPlane3);\\n#endif\\n#ifdef CLIPPLANE4\\nfClipDistance4=dot(worldPos,vClipPlane4);\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts ***!\n \\**************************************************************/\n/*! exports provided: clipPlaneVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneVertexDeclaration\", function() { return clipPlaneVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneVertexDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nvarying float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration2.ts\":\n/*!***************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneVertexDeclaration2.ts ***!\n \\***************************************************************/\n/*! exports provided: clipPlaneVertexDeclaration2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneVertexDeclaration2\", function() { return clipPlaneVertexDeclaration2; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneVertexDeclaration2';\r\nvar shader = \"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nout float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nout float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nout float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nout float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneVertexDeclaration2 = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/defaultFragmentDeclaration.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/defaultFragmentDeclaration.ts ***!\n \\**************************************************************/\n/*! exports provided: defaultFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultFragmentDeclaration\", function() { return defaultFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'defaultFragmentDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/defaultUboDeclaration.ts\":\n/*!*********************************************************!*\\\n !*** ./Shaders/ShadersInclude/defaultUboDeclaration.ts ***!\n \\*********************************************************/\n/*! exports provided: defaultUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultUboDeclaration\", function() { return defaultUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'defaultUboDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/defaultVertexDeclaration.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/defaultVertexDeclaration.ts ***!\n \\************************************************************/\n/*! exports provided: defaultVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultVertexDeclaration\", function() { return defaultVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'defaultVertexDeclaration';\r\nvar shader = \"\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/depthPrePass.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/ShadersInclude/depthPrePass.ts ***!\n \\************************************************/\n/*! exports provided: depthPrePass */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthPrePass\", function() { return depthPrePass; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthPrePass';\r\nvar shader = \"#ifdef DEPTHPREPASS\\ngl_FragColor=vec4(0.,0.,0.,1.0);\\nreturn;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthPrePass = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogFragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/ShadersInclude/fogFragment.ts ***!\n \\***********************************************/\n/*! exports provided: fogFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogFragment\", function() { return fogFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogFragment';\r\nvar shader = \"#ifdef FOG\\nfloat fog=CalcFogFactor();\\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\":\n/*!**********************************************************!*\\\n !*** ./Shaders/ShadersInclude/fogFragmentDeclaration.ts ***!\n \\**********************************************************/\n/*! exports provided: fogFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogFragmentDeclaration\", function() { return fogFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogFragmentDeclaration';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogVertex.ts\":\n/*!*********************************************!*\\\n !*** ./Shaders/ShadersInclude/fogVertex.ts ***!\n \\*********************************************/\n/*! exports provided: fogVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogVertex\", function() { return fogVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogVertex';\r\nvar shader = \"#ifdef FOG\\nvFogDistance=(view*worldPos).xyz;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\":\n/*!********************************************************!*\\\n !*** ./Shaders/ShadersInclude/fogVertexDeclaration.ts ***!\n \\********************************************************/\n/*! exports provided: fogVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogVertexDeclaration\", function() { return fogVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogVertexDeclaration';\r\nvar shader = \"#ifdef FOG\\nvarying vec3 vFogDistance;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fresnelFunction.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/fresnelFunction.ts ***!\n \\***************************************************/\n/*! exports provided: fresnelFunction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fresnelFunction\", function() { return fresnelFunction; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fresnelFunction';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fresnelFunction = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/harmonicsFunctions.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/harmonicsFunctions.ts ***!\n \\******************************************************/\n/*! exports provided: harmonicsFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"harmonicsFunctions\", function() { return harmonicsFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'harmonicsFunctions';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar harmonicsFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/helperFunctions.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/helperFunctions.ts ***!\n \\***************************************************/\n/*! exports provided: helperFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"helperFunctions\", function() { return helperFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'helperFunctions';\r\nvar shader = \"const float PI=3.1415926535897932384626433832795;\\nconst float LinearEncodePowerApprox=2.2;\\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\\nconst float Epsilon=0.0000001;\\n#define saturate(x) clamp(x,0.0,1.0)\\n#define absEps(x) abs(x)+Epsilon\\n#define maxEps(x) max(x,Epsilon)\\n#define saturateEps(x) clamp(x,Epsilon,1.0)\\nmat3 transposeMat3(mat3 inMatrix) {\\nvec3 i0=inMatrix[0];\\nvec3 i1=inMatrix[1];\\nvec3 i2=inMatrix[2];\\nmat3 outMatrix=mat3(\\nvec3(i0.x,i1.x,i2.x),\\nvec3(i0.y,i1.y,i2.y),\\nvec3(i0.z,i1.z,i2.z)\\n);\\nreturn outMatrix;\\n}\\n\\nmat3 inverseMat3(mat3 inMatrix) {\\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\\nfloat b01=a22*a11-a12*a21;\\nfloat b11=-a22*a10+a12*a20;\\nfloat b21=a21*a10-a11*a20;\\nfloat det=a00*b01+a01*b11+a02*b21;\\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\\n}\\nvec3 toLinearSpace(vec3 color)\\n{\\nreturn pow(color,vec3(LinearEncodePowerApprox));\\n}\\nvec3 toGammaSpace(vec3 color)\\n{\\nreturn pow(color,vec3(GammaEncodePowerApprox));\\n}\\nfloat square(float value)\\n{\\nreturn value*value;\\n}\\nfloat pow5(float value) {\\nfloat sq=value*value;\\nreturn sq*sq*value;\\n}\\nfloat getLuminance(vec3 color)\\n{\\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\\n}\\n\\nfloat getRand(vec2 seed) {\\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\\n}\\nfloat dither(vec2 seed,float varianceAmount) {\\nfloat rand=getRand(seed);\\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\\nreturn dither;\\n}\\n\\nconst float rgbdMaxRange=255.0;\\nvec4 toRGBD(vec3 color) {\\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\\nfloat D=max(rgbdMaxRange/maxRGB,1.);\\nD=clamp(floor(D)/255.0,0.,1.);\\n\\nvec3 rgb=color.rgb*D;\\n\\nrgb=toGammaSpace(rgb);\\nreturn vec4(rgb,D);\\n}\\nvec3 fromRGBD(vec4 rgbd) {\\n\\nrgbd.rgb=toLinearSpace(rgbd.rgb);\\n\\nreturn rgbd.rgb/rgbd.a;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar helperFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/imageProcessingDeclaration.ts ***!\n \\**************************************************************/\n/*! exports provided: imageProcessingDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"imageProcessingDeclaration\", function() { return imageProcessingDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'imageProcessingDeclaration';\r\nvar shader = \"#ifdef EXPOSURE\\nuniform float exposureLinear;\\n#endif\\n#ifdef CONTRAST\\nuniform float contrast;\\n#endif\\n#ifdef VIGNETTE\\nuniform vec2 vInverseScreenSize;\\nuniform vec4 vignetteSettings1;\\nuniform vec4 vignetteSettings2;\\n#endif\\n#ifdef COLORCURVES\\nuniform vec4 vCameraColorCurveNegative;\\nuniform vec4 vCameraColorCurveNeutral;\\nuniform vec4 vCameraColorCurvePositive;\\n#endif\\n#ifdef COLORGRADING\\n#ifdef COLORGRADING3D\\nuniform highp sampler3D txColorTransform;\\n#else\\nuniform sampler2D txColorTransform;\\n#endif\\nuniform vec4 colorTransformSettings;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar imageProcessingDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/imageProcessingFunctions.ts ***!\n \\************************************************************/\n/*! exports provided: imageProcessingFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"imageProcessingFunctions\", function() { return imageProcessingFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'imageProcessingFunctions';\r\nvar shader = \"#if defined(COLORGRADING) && !defined(COLORGRADING3D)\\n\\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\\n{\\nfloat sliceSize=2.0*sampler3dSetting.x;\\n#ifdef SAMPLER3DGREENDEPTH\\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\\n#else\\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\\n#endif\\nfloat sliceInteger=floor(sliceContinuous);\\n\\n\\nfloat sliceFraction=sliceContinuous-sliceInteger;\\n#ifdef SAMPLER3DGREENDEPTH\\nvec2 sliceUV=color.rb;\\n#else\\nvec2 sliceUV=color.rg;\\n#endif\\nsliceUV.x*=sliceSize;\\nsliceUV.x+=sliceInteger*sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\\nsliceUV.x+=sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\\n#ifdef SAMPLER3DBGRMAP\\ncolor.rgb=result.rgb;\\n#else\\ncolor.rgb=result.bgr;\\n#endif\\nreturn color;\\n}\\n#endif\\n#ifdef TONEMAPPING_ACES\\n\\n\\n\\n\\n\\nconst mat3 ACESInputMat=mat3(\\nvec3(0.59719,0.07600,0.02840),\\nvec3(0.35458,0.90834,0.13383),\\nvec3(0.04823,0.01566,0.83777)\\n);\\n\\nconst mat3 ACESOutputMat=mat3(\\nvec3( 1.60475,-0.10208,-0.00327),\\nvec3(-0.53108,1.10813,-0.07276),\\nvec3(-0.07367,-0.00605,1.07602)\\n);\\nvec3 RRTAndODTFit(vec3 v)\\n{\\nvec3 a=v*(v+0.0245786)-0.000090537;\\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\\nreturn a/b;\\n}\\nvec3 ACESFitted(vec3 color)\\n{\\ncolor=ACESInputMat*color;\\n\\ncolor=RRTAndODTFit(color);\\ncolor=ACESOutputMat*color;\\n\\ncolor=saturate(color);\\nreturn color;\\n}\\n#endif\\nvec4 applyImageProcessing(vec4 result) {\\n#ifdef EXPOSURE\\nresult.rgb*=exposureLinear;\\n#endif\\n#ifdef VIGNETTE\\n\\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\\nviewportXY=viewportXY*2.0-1.0;\\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\\n\\nvec3 vignetteColor=vignetteSettings2.rgb;\\n#ifdef VIGNETTEBLENDMODEMULTIPLY\\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\\nresult.rgb*=vignetteColorMultiplier;\\n#endif\\n#ifdef VIGNETTEBLENDMODEOPAQUE\\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\\n#endif\\n#endif\\n#ifdef TONEMAPPING\\n#ifdef TONEMAPPING_ACES\\nresult.rgb=ACESFitted(result.rgb);\\n#else\\nconst float tonemappingCalibration=1.590579;\\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\\n#endif\\n#endif\\n\\nresult.rgb=toGammaSpace(result.rgb);\\nresult.rgb=saturate(result.rgb);\\n#ifdef CONTRAST\\n\\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\\nif (contrast<1.0) {\\n\\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\\n} else {\\n\\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\\n}\\n#endif\\n\\n#ifdef COLORGRADING\\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\\n#ifdef COLORGRADING3D\\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\\n#else\\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\\n#endif\\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\\n#endif\\n#ifdef COLORCURVES\\n\\nfloat luma=getLuminance(result.rgb);\\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\\nresult.rgb*=colorCurve.rgb;\\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\\n#endif\\nreturn result;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar imageProcessingFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/instancesDeclaration.ts\":\n/*!********************************************************!*\\\n !*** ./Shaders/ShadersInclude/instancesDeclaration.ts ***!\n \\********************************************************/\n/*! exports provided: instancesDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"instancesDeclaration\", function() { return instancesDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'instancesDeclaration';\r\nvar shader = \"#ifdef INSTANCES\\nattribute vec4 world0;\\nattribute vec4 world1;\\nattribute vec4 world2;\\nattribute vec4 world3;\\n#else\\nuniform mat4 world;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar instancesDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/instancesVertex.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/instancesVertex.ts ***!\n \\***************************************************/\n/*! exports provided: instancesVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"instancesVertex\", function() { return instancesVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'instancesVertex';\r\nvar shader = \"#ifdef INSTANCES\\nmat4 finalWorld=mat4(world0,world1,world2,world3);\\n#else\\nmat4 finalWorld=world;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar instancesVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurFragment.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurFragment.ts ***!\n \\******************************************************/\n/*! exports provided: kernelBlurFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurFragment\", function() { return kernelBlurFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurFragment';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurFragment2.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurFragment2.ts ***!\n \\*******************************************************/\n/*! exports provided: kernelBlurFragment2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurFragment2\", function() { return kernelBlurFragment2; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurFragment2';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurFragment2 = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts\":\n/*!****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts ***!\n \\****************************************************************/\n/*! exports provided: kernelBlurVaryingDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurVaryingDeclaration\", function() { return kernelBlurVaryingDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurVaryingDeclaration';\r\nvar shader = \"varying vec2 sampleCoord{X};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurVaryingDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurVertex.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurVertex.ts ***!\n \\****************************************************/\n/*! exports provided: kernelBlurVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurVertex\", function() { return kernelBlurVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurVertex';\r\nvar shader = \"sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightFragment.ts\":\n/*!*************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightFragment.ts ***!\n \\*************************************************/\n/*! exports provided: lightFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightFragment\", function() { return lightFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightFragment';\r\nvar shader = \"#ifdef LIGHT{X}\\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\\n\\n#else\\n#ifdef PBR\\n\\n#ifdef SPOTLIGHT{X}\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(POINTLIGHT{X})\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(HEMILIGHT{X})\\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(DIRLIGHT{X})\\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#endif\\npreInfo.NdotV=NdotV;\\n\\n#ifdef SPOTLIGHT{X}\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#endif\\n#elif defined(POINTLIGHT{X})\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\n#endif\\n#else\\npreInfo.attenuation=1.0;\\n#endif\\n\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=roughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightDiffuse.a,preInfo.lightDistance);\\n#endif\\n\\n#ifdef HEMILIGHT{X}\\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\\n#elif defined(SS_TRANSLUCENCY)\\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,transmittance);\\n#else\\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef SPECULARTERM\\n#ifdef ANISOTROPIC\\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicTangent,anisotropicBitangent,anisotropy,specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#else\\ninfo.specular=computeSpecularLighting(preInfo,normalW,specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#ifdef SHEEN_LINKWITHALBEDO\\n\\npreInfo.roughness=sheenIntensity;\\n#endif\\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef CLEARCOAT\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=clearCoatRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(clearCoatRoughness,light{X}.vLightDiffuse.a,preInfo.lightDistance);\\n#endif\\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearCoatNormalW,clearCoatAARoughnessFactors.x,clearCoatIntensity,light{X}.vLightDiffuse.rgb);\\n#ifdef CLEARCOAT_TINT\\n\\nabsorption=computeClearCoatLightingAbsorption(clearCoatNdotVRefract,preInfo.L,clearCoatNormalW,clearCoatColor,clearCoatThickness,clearCoatIntensity);\\ninfo.diffuse*=absorption;\\n#ifdef SPECULARTERM\\ninfo.specular*=absorption;\\n#endif\\n#endif\\n\\ninfo.diffuse*=info.clearCoat.w;\\n#ifdef SPECULARTERM\\ninfo.specular*=info.clearCoat.w*info.clearCoat.w;\\n#endif\\n#ifdef SHEEN\\ninfo.sheen*=info.clearCoat.w*info.clearCoat.w;\\n#endif\\n#endif\\n#else\\n#ifdef SPOTLIGHT{X}\\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\\n#elif defined(HEMILIGHT{X})\\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,glossiness);\\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\\n#endif\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\\n#endif\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCLOSEESM{X}\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPOISSON{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#else\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#endif\\n#ifdef SHADOWONLY\\n#ifndef SHADOWINUSE\\n#define SHADOWINUSE\\n#endif\\nglobalShadow+=shadow;\\nshadowLightCount+=1.0;\\n#endif\\n#else\\nshadow=1.;\\n#endif\\n#ifndef SHADOWONLY\\n#ifdef CUSTOMUSERLIGHTING\\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\\n#ifdef SPECULARTERM\\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\\n#endif\\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\\ndiffuseBase+=lightmapColor.rgb*shadow;\\n#ifdef SPECULARTERM\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef CLEARCOAT\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#else\\ndiffuseBase+=info.diffuse*shadow;\\n#ifdef SPECULARTERM\\nspecularBase+=info.specular*shadow;\\n#endif\\n#ifdef CLEARCOAT\\nclearCoatBase+=info.clearCoat.rgb*shadow;\\n#endif\\n#ifdef SHEEN\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightFragmentDeclaration.ts ***!\n \\************************************************************/\n/*! exports provided: lightFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightFragmentDeclaration\", function() { return lightFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightFragmentDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform vec4 vLightData{X};\\nuniform vec4 vLightDiffuse{X};\\n#ifdef SPECULARTERM\\nuniform vec3 vLightSpecular{X};\\n#else\\nvec3 vLightSpecular{X}=vec3(0.);\\n#endif\\n#ifdef SHADOW{X}\\n#if defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\nuniform vec4 shadowsInfo{X};\\nuniform vec2 depthValues{X};\\n#endif\\n#ifdef SPOTLIGHT{X}\\nuniform vec4 vLightDirection{X};\\nuniform vec4 vLightFalloff{X};\\n#elif defined(POINTLIGHT{X})\\nuniform vec4 vLightFalloff{X};\\n#elif defined(HEMILIGHT{X})\\nuniform vec3 vLightGround{X};\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightUboDeclaration.ts ***!\n \\*******************************************************/\n/*! exports provided: lightUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightUboDeclaration\", function() { return lightUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightUboDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform Light{X}\\n{\\nvec4 vLightData;\\nvec4 vLightDiffuse;\\nvec3 vLightSpecular;\\n#ifdef SPOTLIGHT{X}\\nvec4 vLightDirection;\\nvec4 vLightFalloff;\\n#elif defined(POINTLIGHT{X})\\nvec4 vLightFalloff;\\n#elif defined(HEMILIGHT{X})\\nvec3 vLightGround;\\n#endif\\nvec4 shadowsInfo;\\nvec2 depthValues;\\n} light{X};\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#ifdef SHADOW{X}\\n#if defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightsFragmentFunctions.ts\":\n/*!***********************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightsFragmentFunctions.ts ***!\n \\***********************************************************/\n/*! exports provided: lightsFragmentFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightsFragmentFunctions\", function() { return lightsFragmentFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightsFragmentFunctions';\r\nvar shader = \"\\nstruct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef NDOTL\\nfloat ndl;\\n#endif\\n};\\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 lightVectorW;\\nfloat attenuation=1.0;\\nif (lightData.w == 0.)\\n{\\nvec3 direction=lightData.xyz-vPositionW;\\nattenuation=max(0.,1.0-length(direction)/range);\\nlightVectorW=normalize(direction);\\n}\\nelse\\n{\\nlightVectorW=normalize(-lightData.xyz);\\n}\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 direction=lightData.xyz-vPositionW;\\nvec3 lightVectorW=normalize(direction);\\nfloat attenuation=max(0.,1.0-length(direction)/range);\\n\\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\\nif (cosAngle>=lightDirection.w)\\n{\\ncosAngle=max(0.,pow(cosAngle,lightData.w));\\nattenuation*=cosAngle;\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nresult.diffuse=vec3(0.);\\n#ifdef SPECULARTERM\\nresult.specular=vec3(0.);\\n#endif\\n#ifdef NDOTL\\nresult.ndl=0.;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\\nlightingInfo result;\\n\\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor;\\n#endif\\nreturn result;\\n}\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn textureColor;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightsFragmentFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/ShadersInclude/logDepthDeclaration.ts ***!\n \\*******************************************************/\n/*! exports provided: logDepthDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logDepthDeclaration\", function() { return logDepthDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'logDepthDeclaration';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nuniform float logarithmicDepthConstant;\\nvarying float vFragmentDepth;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar logDepthDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/logDepthFragment.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/logDepthFragment.ts ***!\n \\****************************************************/\n/*! exports provided: logDepthFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logDepthFragment\", function() { return logDepthFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'logDepthFragment';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar logDepthFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/logDepthVertex.ts\":\n/*!**************************************************!*\\\n !*** ./Shaders/ShadersInclude/logDepthVertex.ts ***!\n \\**************************************************/\n/*! exports provided: logDepthVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logDepthVertex\", function() { return logDepthVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'logDepthVertex';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nvFragmentDepth=1.0+gl_Position.w;\\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar logDepthVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/morphTargetsVertex.ts ***!\n \\******************************************************/\n/*! exports provided: morphTargetsVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"morphTargetsVertex\", function() { return morphTargetsVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'morphTargetsVertex';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar morphTargetsVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\":\n/*!*****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts ***!\n \\*****************************************************************/\n/*! exports provided: morphTargetsVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"morphTargetsVertexDeclaration\", function() { return morphTargetsVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'morphTargetsVertexDeclaration';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar morphTargetsVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\":\n/*!***********************************************************************!*\\\n !*** ./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts ***!\n \\***********************************************************************/\n/*! exports provided: morphTargetsVertexGlobalDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"morphTargetsVertexGlobalDeclaration\", function() { return morphTargetsVertexGlobalDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'morphTargetsVertexGlobalDeclaration';\r\nvar shader = \"#ifdef MORPHTARGETS\\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar morphTargetsVertexGlobalDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/mrtFragmentDeclaration.ts\":\n/*!**********************************************************!*\\\n !*** ./Shaders/ShadersInclude/mrtFragmentDeclaration.ts ***!\n \\**********************************************************/\n/*! exports provided: mrtFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mrtFragmentDeclaration\", function() { return mrtFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'mrtFragmentDeclaration';\r\nvar shader = \"#if __VERSION__>=200\\nlayout(location=0) out vec4 glFragData[{X}];\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar mrtFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/packingFunctions.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/packingFunctions.ts ***!\n \\****************************************************/\n/*! exports provided: packingFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"packingFunctions\", function() { return packingFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'packingFunctions';\r\nvar shader = \"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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar packingFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrBRDFFunctions.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrBRDFFunctions.ts ***!\n \\****************************************************/\n/*! exports provided: pbrBRDFFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrBRDFFunctions\", function() { return pbrBRDFFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrBRDFFunctions';\r\nvar shader = \"\\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) {\\n\\nvec2 UV=vec2(NdotV,perceptualRoughness);\\n\\nvec4 brdfLookup=texture2D(environmentBrdfSampler,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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrBRDFFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrDebug.ts\":\n/*!********************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrDebug.ts ***!\n \\********************************************/\n/*! exports provided: pbrDebug */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrDebug\", function() { return pbrDebug; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrDebug';\r\nvar shader = \"#if DEBUGMODE>0\\nif (vClipSpacePosition.x/vClipSpacePosition.w=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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrDirectLightingFalloffFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrDirectLightingFunctions.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrDirectLightingFunctions.ts ***!\n \\**************************************************************/\n/*! exports provided: pbrDirectLightingFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrDirectLightingFunctions\", function() { return pbrDirectLightingFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrDirectLightingFunctions';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrDirectLightingFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.ts\":\n/*!*******************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.ts ***!\n \\*******************************************************************/\n/*! exports provided: pbrDirectLightingSetupFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrDirectLightingSetupFunctions\", function() { return pbrDirectLightingSetupFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrDirectLightingSetupFunctions';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrDirectLightingSetupFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrFragmentDeclaration.ts\":\n/*!**********************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrFragmentDeclaration.ts ***!\n \\**********************************************************/\n/*! exports provided: pbrFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrFragmentDeclaration\", function() { return pbrFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrFragmentDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrFragmentExtraDeclaration.ts\":\n/*!***************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrFragmentExtraDeclaration.ts ***!\n \\***************************************************************/\n/*! exports provided: pbrFragmentExtraDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrFragmentExtraDeclaration\", function() { return pbrFragmentExtraDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrFragmentExtraDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrFragmentExtraDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.ts\":\n/*!******************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.ts ***!\n \\******************************************************************/\n/*! exports provided: pbrFragmentSamplersDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrFragmentSamplersDeclaration\", function() { return pbrFragmentSamplersDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrFragmentSamplersDeclaration';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrFragmentSamplersDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrHelperFunctions.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrHelperFunctions.ts ***!\n \\******************************************************/\n/*! exports provided: pbrHelperFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrHelperFunctions\", function() { return pbrHelperFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrHelperFunctions';\r\nvar shader = \"\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrHelperFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrIBLFunctions.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrIBLFunctions.ts ***!\n \\***************************************************/\n/*! exports provided: pbrIBLFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrIBLFunctions\", function() { return pbrIBLFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrIBLFunctions';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrIBLFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrUboDeclaration.ts\":\n/*!*****************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrUboDeclaration.ts ***!\n \\*****************************************************/\n/*! exports provided: pbrUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrUboDeclaration\", function() { return pbrUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrUboDeclaration';\r\nvar shader = \"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};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrVertexDeclaration.ts\":\n/*!********************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrVertexDeclaration.ts ***!\n \\********************************************************/\n/*! exports provided: pbrVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrVertexDeclaration\", function() { return pbrVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrVertexDeclaration';\r\nvar shader = \"uniform mat4 view;\\nuniform mat4 viewProjection;\\n#ifdef ALBEDO\\nuniform mat4 albedoMatrix;\\nuniform vec2 vAlbedoInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec4 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#ifdef REFLECTIVITY\\nuniform vec3 vReflectivityInfos;\\nuniform mat4 reflectivityMatrix;\\n#endif\\n#ifdef MICROSURFACEMAP\\nuniform vec2 vMicroSurfaceSamplerInfos;\\nuniform mat4 microSurfaceSamplerMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\n#endif\\n\\n#ifdef CLEARCOAT\\n#ifdef CLEARCOAT_TEXTURE\\nuniform vec2 vClearCoatInfos;\\nuniform mat4 clearCoatMatrix;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nuniform vec2 vClearCoatBumpInfos;\\nuniform mat4 clearCoatBumpMatrix;\\n#endif\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\n#endif\\n#endif\\n\\n#ifdef ANISOTROPIC\\n#ifdef ANISOTROPIC_TEXTURE\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#ifdef SHEEN_TEXTURE\\nuniform vec2 vSheenInfos;\\nuniform mat4 sheenMatrix;\\n#endif\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;;\\n#endif\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pointCloudVertex.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/pointCloudVertex.ts ***!\n \\****************************************************/\n/*! exports provided: pointCloudVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pointCloudVertex\", function() { return pointCloudVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pointCloudVertex';\r\nvar shader = \"#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pointCloudVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/reflectionFunction.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/reflectionFunction.ts ***!\n \\******************************************************/\n/*! exports provided: reflectionFunction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"reflectionFunction\", function() { return reflectionFunction; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'reflectionFunction';\r\nvar shader = \"vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\\n\\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\\nvec3 halfSize=cubeSize*0.5;\\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\\n\\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\\n\\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\\n\\nvec3 intersectPositionWS=vertexPos+origVec*distance;\\n\\nreturn intersectPositionWS-cubePos;\\n}\\nvec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(1.0-s,t,0);\\n}\\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);\\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\\nr=vec3(reflectionMatrix*vec4(r,0));\\nfloat lon=atan(r.z,r.x);\\nfloat lat=acos(r.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(vec3(view*worldPos));\\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\\nvec3 r=reflect(viewDir,viewNormal);\\nr=vec3(reflectionMatrix*vec4(r,0));\\nr.z=r.z-1.0;\\nfloat m=2.0*length(r);\\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\\n}\\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=worldPos.xyz-eyePosition;\\nvec3 coords=normalize(reflect(viewDir,worldNormal));\\nreturn vec3(reflectionMatrix*vec4(coords,1));\\n}\\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*(view*worldPos));\\n}\\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*vec4(positionW,0));\\n}\\n#ifdef REFLECTION\\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\\n{\\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SPHERICAL\\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_PLANAR\\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_CUBIC\\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\\n#else\\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_PROJECTION\\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_EXPLICIT\\nreturn vec3(0,0,0);\\n#endif\\n}\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar reflectionFunction = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/shadowsFragmentFunctions.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/shadowsFragmentFunctions.ts ***!\n \\************************************************************/\n/*! exports provided: shadowsFragmentFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shadowsFragmentFunctions\", function() { return shadowsFragmentFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'shadowsFragmentFunctions';\r\nvar shader = \"#ifdef SHADOWS\\n#ifndef SHADOWFLOAT\\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}\\n#endif\\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\\n{\\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.0,clamp(dot(clipSpace,clipSpace),0.,1.));\\nreturn mix(value,1.0,mask);\\n}\\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\\n#else\\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\\n#endif\\nif (depth>shadow)\\n{\\nreturn darkness;\\n}\\nreturn 1.0;\\n}\\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\nfloat visibility=1.;\\nvec3 poissonDisk[4];\\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadow=texture2D(shadowSampler,uv).x;\\n#endif\\nif (shadowPixelDepth>shadow)\\n{\\nreturn computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff);\\n}\\nreturn 1.;\\n}\\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\nfloat visibility=1.;\\nvec2 poissonDisk[4];\\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\\npoissonDisk[3]=vec2(0.34495938,0.29387760);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n#ifdef WEBGL2\\n\\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat shadow=texture2D(shadowSampler,uvDepth);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\n\\n\\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\nconst vec3 PoissonSamplers32[64]=vec3[64](\\nvec3(0.06407013,0.05409927,0.),\\nvec3(0.7366577,0.5789394,0.),\\nvec3(-0.6270542,-0.5320278,0.),\\nvec3(-0.4096107,0.8411095,0.),\\nvec3(0.6849564,-0.4990818,0.),\\nvec3(-0.874181,-0.04579735,0.),\\nvec3(0.9989998,0.0009880066,0.),\\nvec3(-0.004920578,-0.9151649,0.),\\nvec3(0.1805763,0.9747483,0.),\\nvec3(-0.2138451,0.2635818,0.),\\nvec3(0.109845,0.3884785,0.),\\nvec3(0.06876755,-0.3581074,0.),\\nvec3(0.374073,-0.7661266,0.),\\nvec3(0.3079132,-0.1216763,0.),\\nvec3(-0.3794335,-0.8271583,0.),\\nvec3(-0.203878,-0.07715034,0.),\\nvec3(0.5912697,0.1469799,0.),\\nvec3(-0.88069,0.3031784,0.),\\nvec3(0.5040108,0.8283722,0.),\\nvec3(-0.5844124,0.5494877,0.),\\nvec3(0.6017799,-0.1726654,0.),\\nvec3(-0.5554981,0.1559997,0.),\\nvec3(-0.3016369,-0.3900928,0.),\\nvec3(-0.5550632,-0.1723762,0.),\\nvec3(0.925029,0.2995041,0.),\\nvec3(-0.2473137,0.5538505,0.),\\nvec3(0.9183037,-0.2862392,0.),\\nvec3(0.2469421,0.6718712,0.),\\nvec3(0.3916397,-0.4328209,0.),\\nvec3(-0.03576927,-0.6220032,0.),\\nvec3(-0.04661255,0.7995201,0.),\\nvec3(0.4402924,0.3640312,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.)\\n);\\nconst vec3 PoissonSamplers64[64]=vec3[64](\\nvec3(-0.613392,0.617481,0.),\\nvec3(0.170019,-0.040254,0.),\\nvec3(-0.299417,0.791925,0.),\\nvec3(0.645680,0.493210,0.),\\nvec3(-0.651784,0.717887,0.),\\nvec3(0.421003,0.027070,0.),\\nvec3(-0.817194,-0.271096,0.),\\nvec3(-0.705374,-0.668203,0.),\\nvec3(0.977050,-0.108615,0.),\\nvec3(0.063326,0.142369,0.),\\nvec3(0.203528,0.214331,0.),\\nvec3(-0.667531,0.326090,0.),\\nvec3(-0.098422,-0.295755,0.),\\nvec3(-0.885922,0.215369,0.),\\nvec3(0.566637,0.605213,0.),\\nvec3(0.039766,-0.396100,0.),\\nvec3(0.751946,0.453352,0.),\\nvec3(0.078707,-0.715323,0.),\\nvec3(-0.075838,-0.529344,0.),\\nvec3(0.724479,-0.580798,0.),\\nvec3(0.222999,-0.215125,0.),\\nvec3(-0.467574,-0.405438,0.),\\nvec3(-0.248268,-0.814753,0.),\\nvec3(0.354411,-0.887570,0.),\\nvec3(0.175817,0.382366,0.),\\nvec3(0.487472,-0.063082,0.),\\nvec3(-0.084078,0.898312,0.),\\nvec3(0.488876,-0.783441,0.),\\nvec3(0.470016,0.217933,0.),\\nvec3(-0.696890,-0.549791,0.),\\nvec3(-0.149693,0.605762,0.),\\nvec3(0.034211,0.979980,0.),\\nvec3(0.503098,-0.308878,0.),\\nvec3(-0.016205,-0.872921,0.),\\nvec3(0.385784,-0.393902,0.),\\nvec3(-0.146886,-0.859249,0.),\\nvec3(0.643361,0.164098,0.),\\nvec3(0.634388,-0.049471,0.),\\nvec3(-0.688894,0.007843,0.),\\nvec3(0.464034,-0.188818,0.),\\nvec3(-0.440840,0.137486,0.),\\nvec3(0.364483,0.511704,0.),\\nvec3(0.034028,0.325968,0.),\\nvec3(0.099094,-0.308023,0.),\\nvec3(0.693960,-0.366253,0.),\\nvec3(0.678884,-0.204688,0.),\\nvec3(0.001801,0.780328,0.),\\nvec3(0.145177,-0.898984,0.),\\nvec3(0.062655,-0.611866,0.),\\nvec3(0.315226,-0.604297,0.),\\nvec3(-0.780145,0.486251,0.),\\nvec3(-0.371868,0.882138,0.),\\nvec3(0.200476,0.494430,0.),\\nvec3(-0.494552,-0.711051,0.),\\nvec3(0.612476,0.705252,0.),\\nvec3(-0.578845,-0.768792,0.),\\nvec3(-0.772454,-0.090976,0.),\\nvec3(0.504440,0.372295,0.),\\nvec3(0.155736,0.065157,0.),\\nvec3(0.391522,0.849605,0.),\\nvec3(-0.620106,-0.328104,0.),\\nvec3(0.789239,-0.419965,0.),\\nvec3(-0.545396,0.538133,0.),\\nvec3(-0.178564,-0.596057,0.)\\n);\\n\\n\\n\\n\\n\\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i\\n#define RECIPROCAL_PI2 0.15915494\\n\\nuniform vec3 vEyePosition;\\n\\nvarying vec3 vPositionW;\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\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\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\n#define sampleReflection(s,c) textureCube(s,c)\\nuniform samplerCube reflectionSampler;\\n#ifdef TEXTURELODSUPPORT\\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\n#endif\\n#else\\n#define sampleReflection(s,c) texture2D(s,c)\\nuniform sampler2D reflectionSampler;\\n#ifdef TEXTURELODSUPPORT\\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\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#include\\n#endif\\n\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE;\\n#endif\\n\\n#ifndef SHADOWONLY\\n#define SHADOWONLY;\\n#endif\\n#include\\n\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\n#include\\n#ifdef REFLECTIONFRESNEL\\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\\nvec3 fresnelSchlickEnvironmentGGX(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\\nvoid main(void) {\\n#include\\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\\n\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=vec3(0.0,1.0,0.0);\\n#endif\\n\\nfloat shadow=1.;\\nfloat globalShadow=0.;\\nfloat shadowLightCount=0.;\\n#include[0..maxSimultaneousLights]\\n#ifdef SHADOWINUSE\\nglobalShadow/=shadowLightCount;\\n#else\\nglobalShadow=1.0;\\n#endif\\n\\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\\n#ifdef REFLECTION\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\n\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords=reflectionVector;\\n#else\\nvec2 reflectionCoords=reflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nreflectionCoords/=reflectionVector.z;\\n#endif\\nreflectionCoords.y=1.0-reflectionCoords.y;\\n#endif\\n#ifdef REFLECTIONBLUR\\nfloat reflectionLOD=vReflectionInfos.y;\\n#ifdef TEXTURELODSUPPORT\\n\\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\\n#else\\nfloat lodReflectionNormalized=saturate(reflectionLOD);\\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\\nif(lodReflectionNormalizedDoubled<1.0){\\nreflectionColor=mix(\\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\\nreflectionSpecularMid,\\nlodReflectionNormalizedDoubled\\n);\\n} else {\\nreflectionColor=mix(\\nreflectionSpecularMid,\\nsampleReflection(reflectionSamplerLow,reflectionCoords),\\nlodReflectionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#else\\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\\nreflectionColor=reflectionSample;\\n#endif\\n#ifdef RGBDREFLECTION\\nreflectionColor.rgb=fromRGBD(reflectionColor);\\n#endif\\n#ifdef GAMMAREFLECTION\\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\\n#endif\\n#ifdef REFLECTIONBGR\\nreflectionColor.rgb=reflectionColor.bgr;\\n#endif\\n\\nreflectionColor.rgb*=vReflectionInfos.x;\\n#endif\\n\\nvec3 diffuseColor=vec3(1.,1.,1.);\\nfloat finalAlpha=alpha;\\n#ifdef DIFFUSE\\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\\n#ifdef GAMMADIFFUSE\\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\\n#endif\\n\\ndiffuseMap.rgb*=vDiffuseInfos.y;\\n#ifdef DIFFUSEHASALPHA\\nfinalAlpha*=diffuseMap.a;\\n#endif\\ndiffuseColor=diffuseMap.rgb;\\n#endif\\n\\n#ifdef REFLECTIONFRESNEL\\nvec3 colorBase=diffuseColor;\\n#else\\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\\n#endif\\ncolorBase=max(colorBase,0.0);\\n\\n#ifdef USERGBCOLOR\\nvec3 finalColor=colorBase;\\n#else\\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\\n#else\\nvec3 mainColor=vPrimaryColor.rgb;\\n#endif\\nvec3 finalColor=colorBase*mainColor;\\n#endif\\n\\n#ifdef REFLECTIONFRESNEL\\nvec3 reflectionAmount=vReflectionControl.xxx;\\nvec3 reflectionReflectance0=vReflectionControl.yyy;\\nvec3 reflectionReflectance90=vReflectionControl.zzz;\\nfloat VdotN=dot(normalize(vEyePosition),normalW);\\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\\nreflectionAmount*=planarReflectionFresnel;\\n#ifdef REFLECTIONFALLOFF\\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);\\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\\nreflectionAmount*=reflectionDistanceFalloff;\\n#endif\\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\\n#endif\\n#ifdef OPACITYFRESNEL\\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition-vBackgroundCenter));\\n\\nconst float startAngle=0.1;\\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\\nfinalAlpha*=fadeFactor*fadeFactor;\\n#endif\\n\\n#ifdef SHADOWINUSE\\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\\n#endif\\n\\nvec4 color=vec4(finalColor,finalAlpha);\\n#include\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\n\\n\\ncolor.rgb=clamp(color.rgb,0.,30.0);\\n#else\\n\\ncolor=applyImageProcessing(color);\\n#endif\\n#ifdef PREMULTIPLYALPHA\\n\\ncolor.rgb*=color.a;\\n#endif\\n#ifdef NOISE\\ncolor.rgb+=dither(vPositionW.xy,0.5);\\ncolor=max(color,0.0);\\n#endif\\ngl_FragColor=color;\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/background.vertex.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/background.vertex.ts ***!\n \\**************************************/\n/*! exports provided: backgroundVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundVertexShader\", function() { return backgroundVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_backgroundVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/backgroundVertexDeclaration */ \"./Shaders/ShadersInclude/backgroundVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_backgroundUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/backgroundUboDeclaration */ \"./Shaders/ShadersInclude/backgroundUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n/* harmony import */ var _ShadersInclude_fogVertex__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/fogVertex */ \"./Shaders/ShadersInclude/fogVertex.ts\");\n/* harmony import */ var _ShadersInclude_shadowsVertex__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/shadowsVertex */ \"./Shaders/ShadersInclude/shadowsVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'backgroundVertexShader';\r\nvar shader = \"precision highp float;\\n#include<__decl__backgroundVertex>\\n#include\\n\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#include\\n\\n#include\\n\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\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#include\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\nvoid main(void) {\\n#ifdef REFLECTIONMAP_SKYBOX\\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\\n#else\\nvPositionUVW=position;\\n#endif\\n#endif\\n#include\\n#include\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n} else {\\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\\n}\\n#else\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n#endif\\nvec4 worldPos=finalWorld*vec4(position,1.0);\\nvPositionW=vec3(worldPos);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normal);\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\\nif (fFovMultiplier<=1.0) {\\nvDirectionW=normalize(segment);\\n} else {\\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\\n}\\n#endif\\n#endif\\n#ifndef UV1\\nvec2 uv=vec2(0.,0.);\\n#endif\\n#ifndef UV2\\nvec2 uv2=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uv;\\n#endif\\n#ifdef MAINUV2\\nvMainUV2=uv2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\\nif (vDiffuseInfos.x == 0.)\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\\n}\\nelse\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n\\n#include\\n\\n#include\\n\\n#include[0..maxSimultaneousLights]\\n\\n#ifdef VERTEXCOLOR\\nvColor=color;\\n#endif\\n\\n#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/blackAndWhite.fragment.ts\":\n/*!*******************************************!*\\\n !*** ./Shaders/blackAndWhite.fragment.ts ***!\n \\*******************************************/\n/*! exports provided: blackAndWhitePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"blackAndWhitePixelShader\", function() { return blackAndWhitePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'blackAndWhitePixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar blackAndWhitePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/bloomMerge.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/bloomMerge.fragment.ts ***!\n \\****************************************/\n/*! exports provided: bloomMergePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bloomMergePixelShader\", function() { return bloomMergePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bloomMergePixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform sampler2D bloomBlur;\\nvarying vec2 vUV;\\nuniform float bloomWeight;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight);\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bloomMergePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/chromaticAberration.fragment.ts\":\n/*!*************************************************!*\\\n !*** ./Shaders/chromaticAberration.fragment.ts ***!\n \\*************************************************/\n/*! exports provided: chromaticAberrationPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"chromaticAberrationPixelShader\", function() { return chromaticAberrationPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'chromaticAberrationPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\n\\nuniform float chromatic_aberration;\\nuniform float radialIntensity;\\nuniform vec2 direction;\\nuniform vec2 centerPosition;\\nuniform float screen_width;\\nuniform float screen_height;\\n\\nvarying vec2 vUV;\\nvoid main(void)\\n{\\nvec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);\\nvec2 directionOfEffect=direction;\\nif(directionOfEffect.x == 0. && directionOfEffect.y == 0.){\\ndirectionOfEffect=normalize(centered_screen_pos);\\n}\\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\\n+centered_screen_pos.y*centered_screen_pos.y;\\nfloat radius=sqrt(radius2);\\nvec4 original=texture2D(textureSampler,vUV);\\n\\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\\nfloat ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;\\nfloat ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;\\n\\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\\noriginal.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);\\ngl_FragColor=original;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar chromaticAberrationPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/circleOfConfusion.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/circleOfConfusion.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: circleOfConfusionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"circleOfConfusionPixelShader\", function() { return circleOfConfusionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'circleOfConfusionPixelShader';\r\nvar shader = \"\\nuniform sampler2D depthSampler;\\n\\nvarying vec2 vUV;\\n\\nuniform vec2 cameraMinMaxZ;\\n\\nuniform float focusDistance;\\nuniform float cocPrecalculation;\\nvoid main(void)\\n{\\nfloat depth=texture2D(depthSampler,vUV).r;\\nfloat pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0;\\nfloat coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));\\ncoc=clamp(coc,0.0,1.0);\\ngl_FragColor=vec4(coc,depth,coc,1.0);\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar circleOfConfusionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/color.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/color.fragment.ts ***!\n \\***********************************/\n/*! exports provided: colorPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"colorPixelShader\", function() { return colorPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n\r\n\r\n\r\nvar name = 'colorPixelShader';\r\nvar shader = \"#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#else\\nuniform vec4 color;\\n#endif\\n#include\\nvoid main(void) {\\n#include\\n#ifdef VERTEXCOLOR\\ngl_FragColor=vColor;\\n#else\\ngl_FragColor=color;\\n#endif\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar colorPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/color.vertex.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/color.vertex.ts ***!\n \\*********************************/\n/*! exports provided: colorVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"colorVertexShader\", function() { return colorVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'colorVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar colorVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/colorCorrection.fragment.ts\":\n/*!*********************************************!*\\\n !*** ./Shaders/colorCorrection.fragment.ts ***!\n \\*********************************************/\n/*! exports provided: colorCorrectionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"colorCorrectionPixelShader\", function() { return colorCorrectionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'colorCorrectionPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\nuniform sampler2D colorTable;\\n\\nvarying vec2 vUV;\\n\\nconst float SLICE_COUNT=16.0;\\n\\nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\\nfloat sliceSize=1.0/width;\\nfloat slicePixelSize=sliceSize/width;\\nfloat sliceInnerSize=slicePixelSize*(width-1.0);\\nfloat zSlice0=min(floor(uv.z*width),width-1.0);\\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\\nfloat s0=xOffset+(zSlice0*sliceSize);\\nfloat s1=xOffset+(zSlice1*sliceSize);\\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\\nfloat zOffset=mod(uv.z*width,1.0);\\nvec4 result=mix(slice0Color,slice1Color,zOffset);\\nreturn result;\\n}\\nvoid main(void)\\n{\\nvec4 screen_color=texture2D(textureSampler,vUV);\\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar colorCorrectionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/convolution.fragment.ts\":\n/*!*****************************************!*\\\n !*** ./Shaders/convolution.fragment.ts ***!\n \\*****************************************/\n/*! exports provided: convolutionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"convolutionPixelShader\", function() { return convolutionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'convolutionPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec2 screenSize;\\nuniform float kernel[9];\\nvoid main(void)\\n{\\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\\nvec4 colorSum =\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\\nfloat kernelWeight =\\nkernel[0] +\\nkernel[1] +\\nkernel[2] +\\nkernel[3] +\\nkernel[4] +\\nkernel[5] +\\nkernel[6] +\\nkernel[7] +\\nkernel[8];\\nif (kernelWeight<=0.0) {\\nkernelWeight=1.0;\\n}\\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar convolutionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/default.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/default.fragment.ts ***!\n \\*************************************/\n/*! exports provided: defaultPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultPixelShader\", function() { return defaultPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_defaultFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/defaultFragmentDeclaration */ \"./Shaders/ShadersInclude/defaultFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_defaultUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/defaultUboDeclaration */ \"./Shaders/ShadersInclude/defaultUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightsFragmentFunctions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/lightsFragmentFunctions */ \"./Shaders/ShadersInclude/lightsFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_shadowsFragmentFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/shadowsFragmentFunctions */ \"./Shaders/ShadersInclude/shadowsFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_fresnelFunction__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/fresnelFunction */ \"./Shaders/ShadersInclude/fresnelFunction.ts\");\n/* harmony import */ var _ShadersInclude_reflectionFunction__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/reflectionFunction */ \"./Shaders/ShadersInclude/reflectionFunction.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragmentFunctions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/bumpFragmentFunctions */ \"./Shaders/ShadersInclude/bumpFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogFragmentDeclaration__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/fogFragmentDeclaration */ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragment__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/bumpFragment */ \"./Shaders/ShadersInclude/bumpFragment.ts\");\n/* harmony import */ var _ShadersInclude_depthPrePass__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/depthPrePass */ \"./Shaders/ShadersInclude/depthPrePass.ts\");\n/* harmony import */ var _ShadersInclude_lightFragment__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/lightFragment */ \"./Shaders/ShadersInclude/lightFragment.ts\");\n/* harmony import */ var _ShadersInclude_logDepthFragment__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/logDepthFragment */ \"./Shaders/ShadersInclude/logDepthFragment.ts\");\n/* harmony import */ var _ShadersInclude_fogFragment__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/fogFragment */ \"./Shaders/ShadersInclude/fogFragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'defaultPixelShader';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/default.vertex.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/default.vertex.ts ***!\n \\***********************************/\n/*! exports provided: defaultVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultVertexShader\", function() { return defaultVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_defaultVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/defaultVertexDeclaration */ \"./Shaders/ShadersInclude/defaultVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_defaultUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/defaultUboDeclaration */ \"./Shaders/ShadersInclude/defaultUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertexDeclaration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/bumpVertexDeclaration */ \"./Shaders/ShadersInclude/bumpVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/bumpVertex */ \"./Shaders/ShadersInclude/bumpVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n/* harmony import */ var _ShadersInclude_fogVertex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/fogVertex */ \"./Shaders/ShadersInclude/fogVertex.ts\");\n/* harmony import */ var _ShadersInclude_shadowsVertex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/shadowsVertex */ \"./Shaders/ShadersInclude/shadowsVertex.ts\");\n/* harmony import */ var _ShadersInclude_pointCloudVertex__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/pointCloudVertex */ \"./Shaders/ShadersInclude/pointCloudVertex.ts\");\n/* harmony import */ var _ShadersInclude_logDepthVertex__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ShadersInclude/logDepthVertex */ \"./Shaders/ShadersInclude/logDepthVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'defaultVertexShader';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depth.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/depth.fragment.ts ***!\n \\***********************************/\n/*! exports provided: depthPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthPixelShader\", function() { return depthPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_packingFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/packingFunctions */ \"./Shaders/ShadersInclude/packingFunctions.ts\");\n\r\n\r\nvar name = 'depthPixelShader';\r\nvar shader = \"#ifdef ALPHATEST\\nvarying vec2 vUV;\\nuniform sampler2D diffuseSampler;\\n#endif\\nvarying float vDepthMetric;\\n#ifdef PACKED\\n#include\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depth.vertex.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/depth.vertex.ts ***!\n \\*********************************/\n/*! exports provided: depthVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthVertexShader\", function() { return depthVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'depthVertexShader';\r\nvar shader = \"\\nattribute vec3 position;\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n\\n#include\\nuniform mat4 viewProjection;\\nuniform vec2 depthValues;\\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\\nvarying float vDepthMetric;\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depthBoxBlur.fragment.ts\":\n/*!******************************************!*\\\n !*** ./Shaders/depthBoxBlur.fragment.ts ***!\n \\******************************************/\n/*! exports provided: depthBoxBlurPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthBoxBlurPixelShader\", function() { return depthBoxBlurPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthBoxBlurPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthBoxBlurPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depthOfField.fragment.ts\":\n/*!******************************************!*\\\n !*** ./Shaders/depthOfField.fragment.ts ***!\n \\******************************************/\n/*! exports provided: depthOfFieldPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthOfFieldPixelShader\", function() { return depthOfFieldPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthOfFieldPixelShader';\r\nvar shader = \"\\n\\n\\n\\n\\nuniform sampler2D textureSampler;\\nuniform sampler2D highlightsSampler;\\nuniform sampler2D depthSampler;\\nuniform sampler2D grainSampler;\\n\\nuniform float grain_amount;\\nuniform bool blur_noise;\\nuniform float screen_width;\\nuniform float screen_height;\\nuniform float distortion;\\nuniform bool dof_enabled;\\n\\nuniform float screen_distance;\\nuniform float aperture;\\nuniform float darken;\\nuniform float edge_blur;\\nuniform bool highlights;\\n\\nuniform float near;\\nuniform float far;\\n\\nvarying vec2 vUV;\\n\\n#define PI 3.14159265\\n#define TWOPI 6.28318530\\n#define inverse_focal_length 0.1\\n\\nvec2 centered_screen_pos;\\nvec2 distorted_coords;\\nfloat radius2;\\nfloat radius;\\n\\nvec2 rand(vec2 co)\\n{\\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\\n}\\n\\nvec2 getDistortedCoords(vec2 coords) {\\nif (distortion == 0.0) { return coords; }\\nvec2 direction=1.0*normalize(centered_screen_pos);\\nvec2 dist_coords=vec2(0.5,0.5);\\ndist_coords.x=0.5+direction.x*radius2*1.0;\\ndist_coords.y=0.5+direction.y*radius2*1.0;\\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\\ndist_coords=mix(coords,dist_coords,dist_amount);\\nreturn dist_coords;\\n}\\n\\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\\n\\nvec2 coords=distorted_coords;\\nfloat angle=rand(coords*100.0).x*TWOPI;\\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\\ncolor+=texture2D(textureSampler,coords)*weight;\\nreturn weight;\\n}\\n\\nfloat getBlurLevel(float size) {\\nreturn min(3.0,ceil(size/1.0));\\n}\\n\\nvec4 getBlurColor(float size) {\\nvec4 col=texture2D(textureSampler,distorted_coords);\\nif (size == 0.0) { return col; }\\n\\n\\nfloat blur_level=getBlurLevel(size);\\nfloat w=(size/screen_width);\\nfloat h=(size/screen_height);\\nfloat total_weight=1.0;\\nvec2 sample_coords;\\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\\nif (blur_level>1.0) {\\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\\n}\\nif (blur_level>2.0) {\\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\\n}\\ncol/=total_weight;\\n\\nif (darken>0.0) {\\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\\n}\\n\\n\\n\\n\\nreturn col;\\n}\\nvoid main(void)\\n{\\n\\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\\nradius=sqrt(radius2);\\ndistorted_coords=getDistortedCoords(vUV);\\nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height);\\nfloat depth=texture2D(depthSampler,distorted_coords).r;\\nfloat distance=near+(far-near)*depth;\\nvec4 color=texture2D(textureSampler,vUV);\\n\\n\\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\\n\\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\\n\\nfloat edge_blur_amount=0.0;\\nif (edge_blur>0.0) {\\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\\n}\\n\\nfloat blur_amount=max(edge_blur_amount,coc);\\n\\nif (blur_amount == 0.0) {\\ngl_FragColor=texture2D(textureSampler,distorted_coords);\\n}\\nelse {\\n\\ngl_FragColor=getBlurColor(blur_amount*1.7);\\n\\nif (highlights) {\\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\\n}\\nif (blur_noise) {\\n\\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\\n}\\n}\\n\\nif (grain_amount>0.0) {\\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\\n}\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthOfFieldPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depthOfFieldMerge.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/depthOfFieldMerge.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: depthOfFieldMergePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthOfFieldMergePixelShader\", function() { return depthOfFieldMergePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthOfFieldMergePixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nvarying vec2 vUV;\\nuniform sampler2D circleOfConfusionSampler;\\nuniform sampler2D blurStep0;\\n#if BLUR_LEVEL>0\\nuniform sampler2D blurStep1;\\n#endif\\n#if BLUR_LEVEL>1\\nuniform sampler2D blurStep2;\\n#endif\\nvoid main(void)\\n{\\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\\n#if BLUR_LEVEL == 0\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred0=texture2D(blurStep0,vUV);\\ngl_FragColor=mix(original,blurred0,coc);\\n#endif\\n#if BLUR_LEVEL == 1\\nif(coc<0.5){\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(original,blurred1,coc/0.5);\\n}else{\\nvec4 blurred0=texture2D(blurStep0,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\\n}\\n#endif\\n#if BLUR_LEVEL == 2\\nif(coc<0.33){\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred2=texture2D(blurStep2,vUV);\\ngl_FragColor=mix(original,blurred2,coc/0.33);\\n}else if(coc<0.66){\\nvec4 blurred1=texture2D(blurStep1,vUV);\\nvec4 blurred2=texture2D(blurStep2,vUV);\\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\\n}else{\\nvec4 blurred0=texture2D(blurStep0,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\\n}\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthOfFieldMergePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/displayPass.fragment.ts\":\n/*!*****************************************!*\\\n !*** ./Shaders/displayPass.fragment.ts ***!\n \\*****************************************/\n/*! exports provided: displayPassPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"displayPassPixelShader\", function() { return displayPassPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'displayPassPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D passSampler;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(passSampler,vUV);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar displayPassPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/extractHighlights.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/extractHighlights.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: extractHighlightsPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractHighlightsPixelShader\", function() { return extractHighlightsPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'extractHighlightsPixelShader';\r\nvar shader = \"#include\\n\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform float threshold;\\nuniform float exposure;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\nfloat luma=getLuminance(gl_FragColor.rgb*exposure);\\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar extractHighlightsPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/filter.fragment.ts\":\n/*!************************************!*\\\n !*** ./Shaders/filter.fragment.ts ***!\n \\************************************/\n/*! exports provided: filterPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterPixelShader\", function() { return filterPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'filterPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform mat4 kernelMatrix;\\nvoid main(void)\\n{\\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\\ngl_FragColor=vec4(updatedColor,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar filterPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/fxaa.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/fxaa.fragment.ts ***!\n \\**********************************/\n/*! exports provided: fxaaPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fxaaPixelShader\", function() { return fxaaPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fxaaPixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform vec2 texelSize;\\nvarying vec2 vUV;\\nvarying vec2 sampleCoordS;\\nvarying vec2 sampleCoordE;\\nvarying vec2 sampleCoordN;\\nvarying vec2 sampleCoordW;\\nvarying vec2 sampleCoordNW;\\nvarying vec2 sampleCoordSE;\\nvarying vec2 sampleCoordNE;\\nvarying vec2 sampleCoordSW;\\nconst float fxaaQualitySubpix=1.0;\\nconst float fxaaQualityEdgeThreshold=0.166;\\nconst float fxaaQualityEdgeThresholdMin=0.0833;\\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\\nvoid main(){\\nvec2 posM;\\nposM.x=vUV.x;\\nposM.y=vUV.y;\\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\\nfloat lumaM=FxaaLuma(rgbyM);\\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\\nfloat maxSM=max(lumaS,lumaM);\\nfloat minSM=min(lumaS,lumaM);\\nfloat maxESM=max(lumaE,maxSM);\\nfloat minESM=min(lumaE,minSM);\\nfloat maxWN=max(lumaN,lumaW);\\nfloat minWN=min(lumaN,lumaW);\\nfloat rangeMax=max(maxWN,maxESM);\\nfloat rangeMin=min(minWN,minESM);\\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\\nfloat range=rangeMax-rangeMin;\\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\\n#ifndef MALI\\nif(range=edgeVert;\\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\\nif (!horzSpan)\\n{\\nlumaN=lumaW;\\n}\\nif (!horzSpan)\\n{\\nlumaS=lumaE;\\n}\\nif (horzSpan)\\n{\\nlengthSign=texelSize.y;\\n}\\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\\nfloat gradientN=lumaN-lumaM;\\nfloat gradientS=lumaS-lumaM;\\nfloat lumaNN=lumaN+lumaM;\\nfloat lumaSS=lumaS+lumaM;\\nbool pairN=abs(gradientN)>=abs(gradientS);\\nfloat gradient=max(abs(gradientN),abs(gradientS));\\nif (pairN)\\n{\\nlengthSign=-lengthSign;\\n}\\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\\nvec2 posB;\\nposB.x=posM.x;\\nposB.y=posM.y;\\nvec2 offNP;\\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\\nif (!horzSpan)\\n{\\nposB.x+=lengthSign*0.5;\\n}\\nif (horzSpan)\\n{\\nposB.y+=lengthSign*0.5;\\n}\\nvec2 posN;\\nposN.x=posB.x-offNP.x*1.5;\\nposN.y=posB.y-offNP.y*1.5;\\nvec2 posP;\\nposP.x=posB.x+offNP.x*1.5;\\nposP.y=posB.y+offNP.y*1.5;\\nfloat subpixD=((-2.0)*subpixC)+3.0;\\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\\nfloat subpixE=subpixC*subpixC;\\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\\nif (!pairN)\\n{\\nlumaNN=lumaSS;\\n}\\nfloat gradientScaled=gradient*1.0/4.0;\\nfloat lumaMM=lumaM-lumaNN*0.5;\\nfloat subpixF=subpixD*subpixE;\\nbool lumaMLTZero=lumaMM<0.0;\\nlumaEndN-=lumaNN*0.5;\\nlumaEndP-=lumaNN*0.5;\\nbool doneN=abs(lumaEndN)>=gradientScaled;\\nbool doneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN)\\n{\\nposN.x-=offNP.x*3.0;\\n}\\nif (!doneN)\\n{\\nposN.y-=offNP.y*3.0;\\n}\\nbool doneNP=(!doneN) || (!doneP);\\nif (!doneP)\\n{\\nposP.x+=offNP.x*3.0;\\n}\\nif (!doneP)\\n{\\nposP.y+=offNP.y*3.0;\\n}\\nif (doneNP)\\n{\\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\\ndoneN=abs(lumaEndN)>=gradientScaled;\\ndoneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN) posN.x-=offNP.x*12.0;\\nif (!doneN) posN.y-=offNP.y*12.0;\\ndoneNP=(!doneN) || (!doneP);\\nif (!doneP) posP.x+=offNP.x*12.0;\\nif (!doneP) posP.y+=offNP.y*12.0;\\n}\\nfloat dstN=posM.x-posN.x;\\nfloat dstP=posP.x-posM.x;\\nif (!horzSpan)\\n{\\ndstN=posM.y-posN.y;\\n}\\nif (!horzSpan)\\n{\\ndstP=posP.y-posM.y;\\n}\\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\\nfloat spanLength=(dstP+dstN);\\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\\nfloat spanLengthRcp=1.0/spanLength;\\nbool directionN=dstN[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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar geometryPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/geometry.vertex.ts\":\n/*!************************************!*\\\n !*** ./Shaders/geometry.vertex.ts ***!\n \\************************************/\n/*! exports provided: geometryVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"geometryVertexShader\", function() { return geometryVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'geometryVertexShader';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar geometryVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowBlurPostProcess.fragment.ts\":\n/*!*************************************************!*\\\n !*** ./Shaders/glowBlurPostProcess.fragment.ts ***!\n \\*************************************************/\n/*! exports provided: glowBlurPostProcessPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowBlurPostProcessPixelShader\", function() { return glowBlurPostProcessPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowBlurPostProcessPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform vec2 screenSize;\\nuniform vec2 direction;\\nuniform float blurWidth;\\n\\nfloat getLuminance(vec3 color)\\n{\\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\\n}\\nvoid main(void)\\n{\\nfloat weights[7];\\nweights[0]=0.05;\\nweights[1]=0.1;\\nweights[2]=0.2;\\nweights[3]=0.3;\\nweights[4]=0.2;\\nweights[5]=0.1;\\nweights[6]=0.05;\\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\\nvec2 texelStep=texelSize*direction*blurWidth;\\nvec2 start=vUV-3.0*texelStep;\\nvec4 baseColor=vec4(0.,0.,0.,0.);\\nvec2 texelOffset=vec2(0.,0.);\\nfor (int i=0; i<7; i++)\\n{\\n\\nvec4 texel=texture2D(textureSampler,start+texelOffset);\\nbaseColor.a+=texel.a*weights[i];\\n\\nfloat luminance=getLuminance(baseColor.rgb);\\nfloat luminanceTexel=getLuminance(texel.rgb);\\nfloat choice=step(luminanceTexel,luminance);\\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\\ntexelOffset+=texelStep;\\n}\\ngl_FragColor=baseColor;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowBlurPostProcessPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowMapGeneration.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/glowMapGeneration.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: glowMapGenerationPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowMapGenerationPixelShader\", function() { return glowMapGenerationPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowMapGenerationPixelShader';\r\nvar shader = \"#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.a\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n\\n#include\\nuniform mat4 viewProjection;\\nvarying vec4 vPosition;\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef DIFFUSE\\nvarying vec2 vUVDiffuse;\\nuniform mat4 diffuseMatrix;\\n#endif\\n#ifdef OPACITY\\nvarying vec2 vUVOpacity;\\nuniform mat4 opacityMatrix;\\n#endif\\n#ifdef EMISSIVE\\nvarying vec2 vUVEmissive;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef VERTEXALPHA\\nattribute vec4 color;\\nvarying vec4 vColor;\\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\\n#ifdef CUBEMAP\\nvPosition=finalWorld*vec4(positionUpdated,1.0);\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n#else\\nvPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\ngl_Position=vPosition;\\n#endif\\n#ifdef DIFFUSE\\n#ifdef DIFFUSEUV1\\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef DIFFUSEUV2\\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef OPACITY\\n#ifdef OPACITYUV1\\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef OPACITYUV2\\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef EMISSIVE\\n#ifdef EMISSIVEUV1\\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef EMISSIVEUV2\\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef VERTEXALPHA\\nvColor=color;\\n#endif\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowMapGenerationVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowMapMerge.fragment.ts\":\n/*!******************************************!*\\\n !*** ./Shaders/glowMapMerge.fragment.ts ***!\n \\******************************************/\n/*! exports provided: glowMapMergePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowMapMergePixelShader\", function() { return glowMapMergePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowMapMergePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#ifdef EMISSIVE\\nuniform sampler2D textureSampler2;\\n#endif\\n\\nuniform float offset;\\nvoid main(void) {\\nvec4 baseColor=texture2D(textureSampler,vUV);\\n#ifdef EMISSIVE\\nbaseColor+=texture2D(textureSampler2,vUV);\\nbaseColor*=offset;\\n#else\\nbaseColor.a=abs(offset-baseColor.a);\\n#ifdef STROKE\\nfloat alpha=smoothstep(.0,.1,baseColor.a);\\nbaseColor.a=alpha;\\nbaseColor.rgb=baseColor.rgb*alpha;\\n#endif\\n#endif\\ngl_FragColor=baseColor;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowMapMergePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowMapMerge.vertex.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/glowMapMerge.vertex.ts ***!\n \\****************************************/\n/*! exports provided: glowMapMergeVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowMapMergeVertexShader\", function() { return glowMapMergeVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowMapMergeVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvUV=position*madd+madd;\\ngl_Position=vec4(position,0.0,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowMapMergeVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuRenderParticles.fragment.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/gpuRenderParticles.fragment.ts ***!\n \\************************************************/\n/*! exports provided: gpuRenderParticlesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuRenderParticlesPixelShader\", function() { return gpuRenderParticlesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration2 */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration2.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'gpuRenderParticlesPixelShader';\r\nvar shader = \"#version 300 es\\nuniform sampler2D textureSampler;\\nin vec2 vUV;\\nin vec4 vColor;\\nout vec4 outFragColor;\\n#include\\n#include\\n#include\\n#include\\nvoid main() {\\n#include\\nvec4 textureColor=texture(textureSampler,vUV);\\noutFragColor=textureColor*vColor;\\n#ifdef BLENDMULTIPLYMODE\\nfloat alpha=vColor.a*textureColor.a;\\noutFragColor.rgb=outFragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\\n#endif\\n\\n\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\\n#else\\n#ifdef IMAGEPROCESSING\\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\\noutFragColor=applyImageProcessing(outFragColor);\\n#endif\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuRenderParticlesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuRenderParticles.vertex.ts\":\n/*!**********************************************!*\\\n !*** ./Shaders/gpuRenderParticles.vertex.ts ***!\n \\**********************************************/\n/*! exports provided: gpuRenderParticlesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuRenderParticlesVertexShader\", function() { return gpuRenderParticlesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration2 */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration2.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n\r\n\r\n\r\nvar name = 'gpuRenderParticlesVertexShader';\r\nvar shader = \"#version 300 es\\nuniform mat4 view;\\nuniform mat4 projection;\\nuniform vec2 translationPivot;\\nuniform vec3 worldOffset;\\n\\nin vec3 position;\\nin float age;\\nin float life;\\nin vec3 size;\\n#ifndef BILLBOARD\\nin vec3 initialDirection;\\n#endif\\n#ifdef BILLBOARDSTRETCHED\\nin vec3 direction;\\n#endif\\nin float angle;\\n#ifdef ANIMATESHEET\\nin float cellIndex;\\n#endif\\nin vec2 offset;\\nin vec2 uv;\\nout vec2 vUV;\\nout vec4 vColor;\\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\\nuniform mat4 invView;\\n#endif\\n#include\\n#ifdef COLORGRADIENTS\\nuniform sampler2D colorGradientSampler;\\n#else\\nuniform vec4 colorDead;\\nin vec4 color;\\n#endif\\n#ifdef ANIMATESHEET\\nuniform vec3 sheetInfos;\\n#endif\\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+worldOffset)+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+worldOffset)+alignedCorner;\\n}\\n#endif\\nvoid main() {\\n#ifdef ANIMATESHEET\\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\\nvec2 uvScale=sheetInfos.xy;\\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\\n#else\\nvUV=uv;\\n#endif\\nfloat ratio=age/life;\\n#ifdef COLORGRADIENTS\\nvColor=texture(colorGradientSampler,vec2(ratio,0));\\n#else\\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\\n#endif\\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\\n#ifdef BILLBOARD\\nvec4 rotatedCorner;\\nrotatedCorner.w=0.;\\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+worldOffset)-eyePosition;\\nyaxis.y=0.;\\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner.xyz);\\nvec4 viewPosition=(view*vec4(worldPos,1.0));\\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+worldOffset)-eyePosition;\\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner.xyz);\\nvec4 viewPosition=(view*vec4(worldPos,1.0));\\n#else\\n\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.z=0.;\\n\\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\\n#endif\\n#else\\n\\nvec3 rotatedCorner;\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=0.;\\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nvec3 yaxis=normalize(initialDirection);\\nvec3 worldPos=rotate(yaxis,rotatedCorner);\\n\\nvec4 viewPosition=view*vec4(worldPos,1.0);\\n#endif\\ngl_Position=projection*viewPosition;\\n\\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\\nvec4 worldPos=invView*viewPosition;\\n#endif\\n#include\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuRenderParticlesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuUpdateParticles.fragment.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/gpuUpdateParticles.fragment.ts ***!\n \\************************************************/\n/*! exports provided: gpuUpdateParticlesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuUpdateParticlesPixelShader\", function() { return gpuUpdateParticlesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'gpuUpdateParticlesPixelShader';\r\nvar shader = \"#version 300 es\\nvoid main() {\\ndiscard;\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuUpdateParticlesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuUpdateParticles.vertex.ts\":\n/*!**********************************************!*\\\n !*** ./Shaders/gpuUpdateParticles.vertex.ts ***!\n \\**********************************************/\n/*! exports provided: gpuUpdateParticlesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuUpdateParticlesVertexShader\", function() { return gpuUpdateParticlesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'gpuUpdateParticlesVertexShader';\r\nvar shader = \"#version 300 es\\n#define PI 3.14159\\nuniform float currentCount;\\nuniform float timeDelta;\\nuniform float stopFactor;\\nuniform mat4 emitterWM;\\nuniform vec2 lifeTime;\\nuniform vec2 emitPower;\\nuniform vec2 sizeRange;\\nuniform vec4 scaleRange;\\n#ifndef COLORGRADIENTS\\nuniform vec4 color1;\\nuniform vec4 color2;\\n#endif\\nuniform vec3 gravity;\\nuniform sampler2D randomSampler;\\nuniform sampler2D randomSampler2;\\nuniform vec4 angleRange;\\n#ifdef BOXEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\nuniform vec3 minEmitBox;\\nuniform vec3 maxEmitBox;\\n#endif\\n#ifdef POINTEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#endif\\n#ifdef HEMISPHERICEMITTER\\nuniform float radius;\\nuniform float radiusRange;\\nuniform float directionRandomizer;\\n#endif\\n#ifdef SPHEREEMITTER\\nuniform float radius;\\nuniform float radiusRange;\\n#ifdef DIRECTEDSPHEREEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#else\\nuniform float directionRandomizer;\\n#endif\\n#endif\\n#ifdef CYLINDEREMITTER\\nuniform float radius;\\nuniform float height;\\nuniform float radiusRange;\\n#ifdef DIRECTEDCYLINDEREMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#else\\nuniform float directionRandomizer;\\n#endif\\n#endif\\n#ifdef CONEEMITTER\\nuniform vec2 radius;\\nuniform float coneAngle;\\nuniform vec2 height;\\nuniform float directionRandomizer;\\n#endif\\n\\nin vec3 position;\\nin float age;\\nin float life;\\nin vec4 seed;\\nin vec3 size;\\n#ifndef COLORGRADIENTS\\nin vec4 color;\\n#endif\\nin vec3 direction;\\n#ifndef BILLBOARD\\nin vec3 initialDirection;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nin float angle;\\n#else\\nin vec2 angle;\\n#endif\\n#ifdef ANIMATESHEET\\nin float cellIndex;\\n#ifdef ANIMATESHEETRANDOMSTART\\nin float cellStartOffset;\\n#endif\\n#endif\\n#ifdef NOISE\\nin vec3 noiseCoordinates1;\\nin vec3 noiseCoordinates2;\\n#endif\\n\\nout vec3 outPosition;\\nout float outAge;\\nout float outLife;\\nout vec4 outSeed;\\nout vec3 outSize;\\n#ifndef COLORGRADIENTS\\nout vec4 outColor;\\n#endif\\nout vec3 outDirection;\\n#ifndef BILLBOARD\\nout vec3 outInitialDirection;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nout float outAngle;\\n#else\\nout vec2 outAngle;\\n#endif\\n#ifdef ANIMATESHEET\\nout float outCellIndex;\\n#ifdef ANIMATESHEETRANDOMSTART\\nout float outCellStartOffset;\\n#endif\\n#endif\\n#ifdef NOISE\\nout vec3 outNoiseCoordinates1;\\nout vec3 outNoiseCoordinates2;\\n#endif\\n#ifdef SIZEGRADIENTS\\nuniform sampler2D sizeGradientSampler;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nuniform sampler2D angularSpeedGradientSampler;\\n#endif\\n#ifdef VELOCITYGRADIENTS\\nuniform sampler2D velocityGradientSampler;\\n#endif\\n#ifdef LIMITVELOCITYGRADIENTS\\nuniform sampler2D limitVelocityGradientSampler;\\nuniform float limitVelocityDamping;\\n#endif\\n#ifdef DRAGGRADIENTS\\nuniform sampler2D dragGradientSampler;\\n#endif\\n#ifdef NOISE\\nuniform vec3 noiseStrength;\\nuniform sampler2D noiseSampler;\\n#endif\\n#ifdef ANIMATESHEET\\nuniform vec3 cellInfos;\\n#endif\\nvec3 getRandomVec3(float offset) {\\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\\n}\\nvec4 getRandomVec4(float offset) {\\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\\n}\\nvoid main() {\\nfloat newAge=age+timeDelta;\\n\\nif (newAge>=life && stopFactor != 0.) {\\nvec3 position;\\nvec3 direction;\\n\\nvec4 randoms=getRandomVec4(seed.x);\\n\\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\\noutAge=mod(newAge,outLife);\\n\\noutSeed=seed;\\n\\n#ifdef SIZEGRADIENTS\\noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\\n#else\\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\\n#endif\\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a;\\n#ifndef COLORGRADIENTS\\n\\noutColor=color1+(color2-color1)*randoms.b;\\n#endif\\n\\n#ifndef ANGULARSPEEDGRADIENTS\\noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\\n#else\\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\\n#endif\\n\\n#ifdef POINTEMITTER\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nposition=vec3(0,0,0);\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#elif defined(BOXEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nposition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#elif defined(HEMISPHERICEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\n\\nfloat phi=2.0*PI*randoms2.x;\\nfloat theta=acos(2.0*randoms2.y-1.0);\\nfloat randX=cos(phi)*sin(theta);\\nfloat randY=cos(theta);\\nfloat randZ=sin(phi)*sin(theta);\\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\\ndirection=position+directionRandomizer*randoms3;\\n#elif defined(SPHEREEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\n\\nfloat phi=2.0*PI*randoms2.x;\\nfloat theta=acos(2.0*randoms2.y-1.0);\\nfloat randX=cos(phi)*sin(theta);\\nfloat randY=cos(theta);\\nfloat randZ=sin(phi)*sin(theta);\\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\\n#ifdef DIRECTEDSPHEREEMITTER\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#else\\n\\ndirection=position+directionRandomizer*randoms3;\\n#endif\\n#elif defined(CYLINDEREMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\n\\nfloat yPos=(randoms2.x-0.5)*height;\\nfloat angle=randoms2.y*PI*2.;\\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\\nfloat xPos=positionRadius*cos(angle);\\nfloat zPos=positionRadius*sin(angle);\\nposition=vec3(xPos,yPos,zPos);\\n#ifdef DIRECTEDCYLINDEREMITTER\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#else\\n\\nangle=angle+((randoms3.x-0.5)*PI);\\ndirection=vec3(cos(angle),randoms3.y-0.5,sin(angle));\\ndirection=normalize(direction);\\n#endif\\n#elif defined(CONEEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nfloat s=2.0*PI*randoms2.x;\\n#ifdef CONEEMITTERSPAWNPOINT\\nfloat h=0.0001;\\n#else\\nfloat h=randoms2.y*height.y;\\n\\nh=1.-h*h;\\n#endif\\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\\nlRadius=lRadius*h;\\nfloat randX=lRadius*sin(s);\\nfloat randZ=lRadius*cos(s);\\nfloat randY=h*height.x;\\nposition=vec3(randX,randY,randZ);\\n\\nif (abs(cos(coneAngle)) == 1.0) {\\ndirection=vec3(0.,1.0,0.);\\n} else {\\nvec3 randoms3=getRandomVec3(seed.z);\\ndirection=normalize(position+directionRandomizer*randoms3);\\n}\\n#else\\n\\nposition=vec3(0.,0.,0.);\\n\\ndirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\\n#endif\\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\\noutPosition=(emitterWM*vec4(position,1.)).xyz;\\nvec3 initial=(emitterWM*vec4(direction,0.)).xyz;\\noutDirection=initial*power;\\n#ifndef BILLBOARD\\noutInitialDirection=initial;\\n#endif\\n#ifdef ANIMATESHEET\\noutCellIndex=cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\noutCellStartOffset=randoms.a*outLife;\\n#endif\\n#endif\\n#ifdef NOISE\\noutNoiseCoordinates1=noiseCoordinates1;\\noutNoiseCoordinates2=noiseCoordinates2;\\n#endif\\n} else {\\nfloat directionScale=timeDelta;\\noutAge=newAge;\\nfloat ageGradient=newAge/life;\\n#ifdef VELOCITYGRADIENTS\\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\\n#endif\\n#ifdef DRAGGRADIENTS\\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\\n#endif\\noutPosition=position+direction*directionScale;\\noutLife=life;\\noutSeed=seed;\\n#ifndef COLORGRADIENTS\\noutColor=color;\\n#endif\\n#ifdef SIZEGRADIENTS\\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\\noutSize.yz=size.yz;\\n#else\\noutSize=size;\\n#endif\\n#ifndef BILLBOARD\\noutInitialDirection=initialDirection;\\n#endif\\nvec3 updatedDirection=direction+gravity*timeDelta;\\n#ifdef LIMITVELOCITYGRADIENTS\\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\\nfloat currentVelocity=length(updatedDirection);\\nif (currentVelocity>limitVelocity) {\\nupdatedDirection=updatedDirection*limitVelocityDamping;\\n}\\n#endif\\noutDirection=updatedDirection;\\n#ifdef NOISE\\nvec3 localPosition=outPosition-emitterWM[3].xyz;\\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\\noutDirection=outDirection+force*timeDelta;\\noutNoiseCoordinates1=noiseCoordinates1;\\noutNoiseCoordinates2=noiseCoordinates2;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\\noutAngle=angle+angularSpeed*timeDelta;\\n#else\\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\\n#endif\\n#ifdef ANIMATESHEET\\nfloat offsetAge=outAge;\\nfloat dist=cellInfos.y-cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\noutCellStartOffset=cellStartOffset;\\noffsetAge+=cellStartOffset;\\n#endif\\nfloat ratio=clamp(mod(offsetAge*cellInfos.z,life)/life,0.,1.0);\\noutCellIndex=float(int(cellInfos.x+ratio*dist));\\n#endif\\n}\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuUpdateParticlesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/grain.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/grain.fragment.ts ***!\n \\***********************************/\n/*! exports provided: grainPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"grainPixelShader\", function() { return grainPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'grainPixelShader';\r\nvar shader = \"#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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar grainPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/highlights.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/highlights.fragment.ts ***!\n \\****************************************/\n/*! exports provided: highlightsPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"highlightsPixelShader\", function() { return highlightsPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'highlightsPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar highlightsPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/imageProcessing.fragment.ts\":\n/*!*********************************************!*\\\n !*** ./Shaders/imageProcessing.fragment.ts ***!\n \\*********************************************/\n/*! exports provided: imageProcessingPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"imageProcessingPixelShader\", function() { return imageProcessingPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n\r\n\r\n\r\n\r\nvar name = 'imageProcessingPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar imageProcessingPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/kernelBlur.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/kernelBlur.fragment.ts ***!\n \\****************************************/\n/*! exports provided: kernelBlurPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurPixelShader\", function() { return kernelBlurPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurVaryingDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurVaryingDeclaration */ \"./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_packingFunctions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/packingFunctions */ \"./Shaders/ShadersInclude/packingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurFragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurFragment */ \"./Shaders/ShadersInclude/kernelBlurFragment.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurFragment2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurFragment2 */ \"./Shaders/ShadersInclude/kernelBlurFragment2.ts\");\n\r\n\r\n\r\n\r\n\r\nvar name = 'kernelBlurPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/kernelBlur.vertex.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/kernelBlur.vertex.ts ***!\n \\**************************************/\n/*! exports provided: kernelBlurVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurVertexShader\", function() { return kernelBlurVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurVaryingDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurVaryingDeclaration */ \"./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurVertex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurVertex */ \"./Shaders/ShadersInclude/kernelBlurVertex.ts\");\n\r\n\r\n\r\nvar name = 'kernelBlurVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/layer.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/layer.fragment.ts ***!\n \\***********************************/\n/*! exports provided: layerPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"layerPixelShader\", function() { return layerPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'layerPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar layerPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/layer.vertex.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/layer.vertex.ts ***!\n \\*********************************/\n/*! exports provided: layerVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"layerVertexShader\", function() { return layerVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'layerVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar layerVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/lensFlare.fragment.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/lensFlare.fragment.ts ***!\n \\***************************************/\n/*! exports provided: lensFlarePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lensFlarePixelShader\", function() { return lensFlarePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lensFlarePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform vec4 color;\\nvoid main(void) {\\nvec4 baseColor=texture2D(textureSampler,vUV);\\ngl_FragColor=baseColor*color;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lensFlarePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/lensFlare.vertex.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/lensFlare.vertex.ts ***!\n \\*************************************/\n/*! exports provided: lensFlareVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lensFlareVertexShader\", function() { return lensFlareVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lensFlareVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lensFlareVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/lensHighlights.fragment.ts\":\n/*!********************************************!*\\\n !*** ./Shaders/lensHighlights.fragment.ts ***!\n \\********************************************/\n/*! exports provided: lensHighlightsPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lensHighlightsPixelShader\", function() { return lensHighlightsPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lensHighlightsPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\n\\nuniform float gain;\\nuniform float threshold;\\nuniform float screen_width;\\nuniform float screen_height;\\n\\nvarying vec2 vUV;\\n\\nvec4 highlightColor(vec4 color) {\\nvec4 highlight=color;\\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\\nfloat lum_threshold;\\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\\nelse { lum_threshold=0.5+0.44*threshold; }\\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\\nhighlight*=luminance*gain;\\nhighlight.a=1.0;\\nreturn highlight;\\n}\\nvoid main(void)\\n{\\nvec4 original=texture2D(textureSampler,vUV);\\n\\nif (gain == -1.0) {\\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\\nreturn;\\n}\\nfloat w=2.0/screen_width;\\nfloat h=2.0/screen_height;\\nfloat weight=1.0;\\n\\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\\n#ifdef PENTAGON\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\\n#else\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\\n#endif\\nblurred/=39.0;\\ngl_FragColor=blurred;\\n\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lensHighlightsPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/line.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/line.fragment.ts ***!\n \\**********************************/\n/*! exports provided: linePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"linePixelShader\", function() { return linePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'linePixelShader';\r\nvar shader = \"uniform vec4 color;\\nvoid main(void) {\\ngl_FragColor=color;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar linePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/line.vertex.ts\":\n/*!********************************!*\\\n !*** ./Shaders/line.vertex.ts ***!\n \\********************************/\n/*! exports provided: lineVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lineVertexShader\", function() { return lineVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lineVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lineVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/motionBlur.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/motionBlur.fragment.ts ***!\n \\****************************************/\n/*! exports provided: motionBlurPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"motionBlurPixelShader\", function() { return motionBlurPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'motionBlurPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D velocitySampler;\\nuniform float motionStrength;\\nuniform float motionScale;\\nuniform vec2 screenSize;\\nvoid main(void)\\n{\\n#ifdef GEOMETRY_SUPPORTED\\nvec2 texelSize=1.0/screenSize;\\nvec2 velocityColor=texture2D(velocitySampler,vUV).rg*2.0-1.0;\\nvec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0));\\nvelocity*=motionScale*motionStrength;\\nfloat speed=length(velocity/texelSize);\\nint samplesCount=int(clamp(speed,1.0,SAMPLES));\\nvelocity=normalize(velocity)*texelSize;\\nfloat hlim=float(-samplesCount)*0.5+0.5;\\nvec4 result=texture2D(textureSampler,vUV);\\nfor (int i=1; i=samplesCount)\\nbreak;\\nvec2 offset=vUV+velocity*(hlim+float(i));\\nresult+=texture2D(textureSampler,offset);\\n}\\ngl_FragColor=result/float(samplesCount);\\ngl_FragColor.a=1.0;\\n#else\\ngl_FragColor=texture2D(textureSampler,vUV);\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar motionBlurPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/noise.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/noise.fragment.ts ***!\n \\***********************************/\n/*! exports provided: noisePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"noisePixelShader\", function() { return noisePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'noisePixelShader';\r\nvar shader = \"\\n\\nuniform float brightness;\\nuniform float persistence;\\nuniform float timeScale;\\n\\nvarying vec2 vUV;\\n\\nvec2 hash22(vec2 p)\\n{\\np=p*mat2(127.1,311.7,269.5,183.3);\\np=-1.0+2.0*fract(sin(p)*43758.5453123);\\nreturn sin(p*6.283+timeScale);\\n}\\nfloat interpolationNoise(vec2 p)\\n{\\nvec2 pi=floor(p);\\nvec2 pf=p-pi;\\nvec2 w=pf*pf*(3.-2.*pf);\\nfloat f00=dot(hash22(pi+vec2(.0,.0)),pf-vec2(.0,.0));\\nfloat f01=dot(hash22(pi+vec2(.0,1.)),pf-vec2(.0,1.));\\nfloat f10=dot(hash22(pi+vec2(1.0,0.)),pf-vec2(1.0,0.));\\nfloat f11=dot(hash22(pi+vec2(1.0,1.)),pf-vec2(1.0,1.));\\nfloat xm1=mix(f00,f10,w.x);\\nfloat xm2=mix(f01,f11,w.x);\\nfloat ym=mix(xm1,xm2,w.y);\\nreturn ym;\\n}\\nfloat perlinNoise2D(float x,float y)\\n{\\nfloat sum=0.0;\\nfloat frequency=0.0;\\nfloat amplitude=0.0;\\nfor(int i=0; i\\nvoid main(void) {\\n#ifdef ALPHATEST\\nif (texture2D(diffuseSampler,vUV).a<0.4)\\ndiscard;\\n#endif\\n#include\\ngl_FragColor=color;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar outlinePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/outline.vertex.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/outline.vertex.ts ***!\n \\***********************************/\n/*! exports provided: outlineVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"outlineVertexShader\", function() { return outlineVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_logDepthVertex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/logDepthVertex */ \"./Shaders/ShadersInclude/logDepthVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'outlineVertexShader';\r\nvar shader = \"\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar outlineVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/particles.fragment.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/particles.fragment.ts ***!\n \\***************************************/\n/*! exports provided: particlesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"particlesPixelShader\", function() { return particlesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'particlesPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar particlesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/particles.vertex.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/particles.vertex.ts ***!\n \\*************************************/\n/*! exports provided: particlesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"particlesVertexShader\", function() { return particlesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n\r\n\r\n\r\nvar name = 'particlesVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar particlesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/pass.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/pass.fragment.ts ***!\n \\**********************************/\n/*! exports provided: passPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"passPixelShader\", function() { return passPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'passPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar passPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/passCube.fragment.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/passCube.fragment.ts ***!\n \\**************************************/\n/*! exports provided: passCubePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"passCubePixelShader\", function() { return passCubePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'passCubePixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar passCubePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/pbr.fragment.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/pbr.fragment.ts ***!\n \\*********************************/\n/*! exports provided: pbrPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrPixelShader\", function() { return pbrPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_pbrFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/pbrFragmentDeclaration */ \"./Shaders/ShadersInclude/pbrFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/pbrUboDeclaration */ \"./Shaders/ShadersInclude/pbrUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrFragmentExtraDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/pbrFragmentExtraDeclaration */ \"./Shaders/ShadersInclude/pbrFragmentExtraDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrFragmentSamplersDeclaration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/pbrFragmentSamplersDeclaration */ \"./Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogFragmentDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/fogFragmentDeclaration */ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrHelperFunctions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/pbrHelperFunctions */ \"./Shaders/ShadersInclude/pbrHelperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_shadowsFragmentFunctions__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/shadowsFragmentFunctions */ \"./Shaders/ShadersInclude/shadowsFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_harmonicsFunctions__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/harmonicsFunctions */ \"./Shaders/ShadersInclude/harmonicsFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrDirectLightingSetupFunctions__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/pbrDirectLightingSetupFunctions */ \"./Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrDirectLightingFalloffFunctions__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/pbrDirectLightingFalloffFunctions */ \"./Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrBRDFFunctions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/pbrBRDFFunctions */ \"./Shaders/ShadersInclude/pbrBRDFFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrDirectLightingFunctions__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/pbrDirectLightingFunctions */ \"./Shaders/ShadersInclude/pbrDirectLightingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrIBLFunctions__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/pbrIBLFunctions */ \"./Shaders/ShadersInclude/pbrIBLFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragmentFunctions__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/bumpFragmentFunctions */ \"./Shaders/ShadersInclude/bumpFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_reflectionFunction__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ShadersInclude/reflectionFunction */ \"./Shaders/ShadersInclude/reflectionFunction.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragment__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./ShadersInclude/bumpFragment */ \"./Shaders/ShadersInclude/bumpFragment.ts\");\n/* harmony import */ var _ShadersInclude_depthPrePass__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./ShadersInclude/depthPrePass */ \"./Shaders/ShadersInclude/depthPrePass.ts\");\n/* harmony import */ var _ShadersInclude_lightFragment__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./ShadersInclude/lightFragment */ \"./Shaders/ShadersInclude/lightFragment.ts\");\n/* harmony import */ var _ShadersInclude_logDepthFragment__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./ShadersInclude/logDepthFragment */ \"./Shaders/ShadersInclude/logDepthFragment.ts\");\n/* harmony import */ var _ShadersInclude_fogFragment__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./ShadersInclude/fogFragment */ \"./Shaders/ShadersInclude/fogFragment.ts\");\n/* harmony import */ var _ShadersInclude_pbrDebug__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./ShadersInclude/pbrDebug */ \"./Shaders/ShadersInclude/pbrDebug.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'pbrPixelShader';\r\nvar shader = \"#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n#extension GL_EXT_shader_texture_lod : enable\\n#endif\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\nprecision highp float;\\n\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE\\n#endif\\n\\n#include<__decl__pbrFragment>\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#ifdef REFLECTION\\n#include\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\n\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\n\\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#endif\\n#ifdef CLEARCOAT\\n\\nvec3 clearCoatNormalW=normalW;\\n#endif\\n#include\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#if defined(TWOSIDEDLIGHTING)\\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\\n#endif\\nnormalW*=sign(dot(normalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n\\n\\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\\n\\nfloat alpha=vAlbedoColor.a;\\n#ifdef ALBEDO\\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\\nalpha*=albedoTexture.a;\\n#endif\\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\\nsurfaceAlbedo*=vAlbedoInfos.y;\\n#endif\\n#ifdef VERTEXCOLOR\\nsurfaceAlbedo*=vColor.rgb;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\\n\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#ifdef OPACITYRGB\\nalpha=getLuminance(opacityMap.rgb);\\n#else\\nalpha*=opacityMap.a;\\n#endif\\nalpha*=vOpacityInfos.y;\\n#endif\\n#ifdef VERTEXALPHA\\nalpha*=vColor.a;\\n#endif\\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\\n#ifdef ALPHATEST\\nif (alpha\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\n\\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\\n#ifdef AMBIENTINGRAYSCALE\\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\\n#endif\\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\\n#endif\\n#ifdef UNLIT\\nvec3 diffuseBase=vec3(1.,1.,1.);\\n#else\\n\\nfloat microSurface=vReflectivityColor.a;\\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\\n#ifdef REFLECTIVITY\\nvec4 surfaceMetallicColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\\n#ifdef AOSTOREINMETALMAPRED\\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicColorMap.r,surfaceMetallicColorMap.r,surfaceMetallicColorMap.r);\\nambientOcclusionColor=mix(ambientOcclusionColor,aoStoreInMetalMap,vReflectivityInfos.z);\\n#endif\\n#ifdef METALLNESSSTOREINMETALMAPBLUE\\nmetallicRoughness.r*=surfaceMetallicColorMap.b;\\n#else\\nmetallicRoughness.r*=surfaceMetallicColorMap.r;\\n#endif\\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\\nmetallicRoughness.g*=surfaceMetallicColorMap.a;\\n#else\\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\\nmetallicRoughness.g*=surfaceMetallicColorMap.g;\\n#endif\\n#endif\\n#endif\\n#ifdef MICROSURFACEMAP\\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\\nmetallicRoughness.g*=microSurfaceTexel.r;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\\n\\nmicroSurface=1.0-metallicRoughness.g;\\n\\nvec3 baseColor=surfaceAlbedo;\\n#ifdef REFLECTANCE\\n\\n\\n\\n\\n\\nsurfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\\n#else\\n\\n\\n\\nconst vec3 DefaultSpecularReflectanceDielectric=vec3(0.04,0.04,0.04);\\n\\nsurfaceAlbedo=mix(baseColor.rgb*(1.0-DefaultSpecularReflectanceDielectric.r),vec3(0.,0.,0.),metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(DefaultSpecularReflectanceDielectric,baseColor,metallicRoughness.r);\\n#endif\\n#else\\n#ifdef REFLECTIVITY\\nvec4 surfaceReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\\nsurfaceReflectivityColor*=toLinearSpace(surfaceReflectivityColorMap.rgb);\\nsurfaceReflectivityColor*=vReflectivityInfos.y;\\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\\nmicroSurface*=surfaceReflectivityColorMap.a;\\nmicroSurface*=vReflectivityInfos.z;\\n#else\\n#ifdef MICROSURFACEAUTOMATIC\\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\\n#endif\\n#ifdef MICROSURFACEMAP\\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\\nmicroSurface*=microSurfaceTexel.r;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\\n#endif\\n#endif\\n#endif\\n\\nmicroSurface=saturate(microSurface);\\n\\nfloat roughness=1.-microSurface;\\n\\n#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\n\\n\\n\\nfloat opacityPerceptual=alpha;\\n#ifdef LINEARALPHAFRESNEL\\nfloat opacity0=opacityPerceptual;\\n#else\\nfloat opacity0=opacityPerceptual*opacityPerceptual;\\n#endif\\nfloat opacity90=fresnelGrazingReflectance(opacity0);\\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\\n\\nalpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\\n#ifdef ALPHATEST\\nif (alpha[0..maxSimultaneousLights]\\n\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(specularEnvironmentR0,environmentBrdf);\\n#ifdef RADIANCEOCCLUSION\\n#ifdef AMBIENTINGRAYSCALE\\nfloat ambientMonochrome=ambientOcclusionColor.r;\\n#else\\nfloat ambientMonochrome=getLuminance(ambientOcclusionColor);\\n#endif\\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\\nspecularEnvironmentReflectance*=seo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW);\\nspecularEnvironmentReflectance*=eho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\\n#endif\\n\\n#if defined(SHEEN) && defined(REFLECTION)\\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentBrdf);\\n#ifdef RADIANCEOCCLUSION\\nsheenEnvironmentReflectance*=seo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nsheenEnvironmentReflectance*=eho;\\n#endif\\n#endif\\n#endif\\n#endif\\n\\n#ifdef CLEARCOAT\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n\\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\\n#ifdef RADIANCEOCCLUSION\\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\\nclearCoatEnvironmentReflectance*=clearCoatSeo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW);\\nclearCoatEnvironmentReflectance*=clearCoatEho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\\n#endif\\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\\n#if defined(REFLECTION) && defined(CLEARCOAT_TINT)\\n\\nabsorption=computeClearCoatAbsorption(clearCoatNdotVRefract,clearCoatNdotVRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\\n#ifdef REFLECTION\\nenvironmentIrradiance*=absorption;\\n#endif\\n#ifdef SHEEN\\nsheenEnvironmentReflectance*=absorption;\\n#endif\\nspecularEnvironmentReflectance*=absorption;\\n#endif\\n\\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnelIBLClearCoat*=clearCoatIntensity;\\nfloat conservationFactor=(1.-fresnelIBLClearCoat);\\n#ifdef REFLECTION\\nenvironmentIrradiance*=conservationFactor;\\n#endif\\n#ifdef SHEEN\\nsheenEnvironmentReflectance*=(conservationFactor*conservationFactor);\\n#endif\\nspecularEnvironmentReflectance*=(conservationFactor*conservationFactor);\\n#endif\\n\\n#ifdef SS_REFRACTION\\nvec3 refractionTransmittance=vec3(refractionIntensity);\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\n\\n\\n\\n\\n\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\\n\\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\\n\\nenvironmentRefraction.rgb*=volumeAlbedo;\\n#else\\n\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\\n#endif\\n\\nsurfaceAlbedo*=(1.-refractionIntensity);\\n#ifdef REFLECTION\\n\\nenvironmentIrradiance*=(1.-refractionIntensity);\\n#endif\\n\\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\\nspecularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\\n\\nrefractionTransmittance*=1.0-specularEnvironmentReflectance;\\n#endif\\n\\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\\n#if defined(USESPHERICALINVERTEX)\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP)\\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\\n#elif defined(USEIRRADIANCEMAP)\\nvec3 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceVector).rgb;\\n#ifdef RGBDREFLECTION\\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\\n#endif\\n#else\\nvec3 refractionIrradiance=vec3(0.);\\n#endif\\nrefractionIrradiance*=transmittance;\\n#endif\\n\\n\\n\\n#ifndef METALLICWORKFLOW\\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalIrradiance=environmentIrradiance;\\n#if defined(SS_TRANSLUCENCY)\\nfinalIrradiance+=refractionIrradiance;\\n#endif\\nfinalIrradiance*=surfaceAlbedo.rgb;\\n#endif\\n\\n#ifdef SPECULARTERM\\nvec3 finalSpecular=specularBase;\\nfinalSpecular=max(finalSpecular,0.0);\\n\\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalSpecularScaled*=energyConservationFactor;\\n#endif\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalRadiance=environmentRadiance.rgb;\\nfinalRadiance*=specularEnvironmentReflectance;\\n\\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalRadianceScaled*=energyConservationFactor;\\n#endif\\n#endif\\n\\n#ifdef SS_REFRACTION\\nvec3 finalRefraction=environmentRefraction.rgb;\\nfinalRefraction*=refractionTransmittance;\\n#endif\\n\\n#ifdef CLEARCOAT\\nvec3 finalClearCoat=clearCoatBase;\\nfinalClearCoat=max(finalClearCoat,0.0);\\n\\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalClearCoatScaled*=energyConservationFactor;\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalClearCoatRadiance=environmentClearCoatRadiance.rgb;\\nfinalClearCoatRadiance*=clearCoatEnvironmentReflectance;\\n\\nvec3 finalClearCoatRadianceScaled=finalClearCoatRadiance*vLightingIntensity.z;\\n#endif\\n#ifdef SS_REFRACTION\\nfinalRefraction*=(conservationFactor*conservationFactor);\\n#ifdef CLEARCOAT_TINT\\nfinalRefraction*=absorption;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\nvec3 finalSheen=sheenBase*sheenColor;\\nfinalSheen=max(finalSheen,0.0);\\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\\n\\n\\n\\n\\n\\n#ifdef REFLECTION\\nvec3 finalSheenRadiance=environmentSheenRadiance.rgb;\\nfinalSheenRadiance*=sheenEnvironmentReflectance;\\n\\nvec3 finalSheenRadianceScaled=finalSheenRadiance*vLightingIntensity.z;\\n#endif\\n#endif\\n\\n#ifdef ALPHABLEND\\nfloat luminanceOverAlpha=0.0;\\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\\n#if defined(CLEARCOAT)\\nluminanceOverAlpha+=getLuminance(finalClearCoatRadianceScaled);\\n#endif\\n#endif\\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\\n#endif\\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\\n#endif\\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA)\\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\\n#endif\\n#endif\\n#endif\\n\\n\\nvec3 finalDiffuse=diffuseBase;\\nfinalDiffuse*=surfaceAlbedo.rgb;\\nfinalDiffuse=max(finalDiffuse,0.0);\\n\\nvec3 finalAmbient=vAmbientColor;\\nfinalAmbient*=surfaceAlbedo.rgb;\\n\\nvec3 finalEmissive=vEmissiveColor;\\n#ifdef EMISSIVE\\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\\nfinalEmissive*=vEmissiveInfos.y;\\n#endif\\n\\n#ifdef AMBIENT\\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),ambientOcclusionColor,vAmbientInfos.w);\\n#else\\nvec3 ambientOcclusionForDirectDiffuse=ambientOcclusionColor;\\n#endif\\n\\n\\n\\nvec4 finalColor=vec4(\\nfinalAmbient*ambientOcclusionColor +\\nfinalDiffuse*ambientOcclusionForDirectDiffuse*vLightingIntensity.x +\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nfinalIrradiance*ambientOcclusionColor*vLightingIntensity.z +\\n#endif\\n#ifdef SPECULARTERM\\n\\n\\nfinalSpecularScaled +\\n#endif\\n#ifdef CLEARCOAT\\n\\n\\nfinalClearCoatScaled +\\n#endif\\n#ifdef SHEEN\\n\\n\\nfinalSheenScaled +\\n#endif\\n#ifdef REFLECTION\\n\\n\\nfinalRadianceScaled +\\n#ifdef CLEARCOAT\\n\\n\\nfinalClearCoatRadianceScaled +\\n#endif\\n#ifdef SHEEN\\n\\n\\nfinalSheenRadianceScaled +\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nfinalRefraction*vLightingIntensity.z +\\n#endif\\n#endif\\nfinalEmissive*vLightingIntensity.y,\\nalpha);\\n\\n#ifdef LIGHTMAP\\n#ifndef LIGHTMAPEXCLUDED\\n#ifdef USELIGHTMAPASSHADOWMAP\\nfinalColor.rgb*=lightmapColor.rgb;\\n#else\\nfinalColor.rgb+=lightmapColor.rgb;\\n#endif\\n#endif\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FOG\\n\\nfinalColor=max(finalColor,0.0);\\n#include\\n#include(color,finalColor)\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\n\\n\\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\\n#else\\n\\nfinalColor=applyImageProcessing(finalColor);\\n#endif\\nfinalColor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\n\\nfinalColor.rgb*=finalColor.a;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\ngl_FragColor=finalColor;\\n#include\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/pbr.vertex.ts\":\n/*!*******************************!*\\\n !*** ./Shaders/pbr.vertex.ts ***!\n \\*******************************/\n/*! exports provided: pbrVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrVertexShader\", function() { return pbrVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_pbrVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/pbrVertexDeclaration */ \"./Shaders/ShadersInclude/pbrVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/pbrUboDeclaration */ \"./Shaders/ShadersInclude/pbrUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_harmonicsFunctions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/harmonicsFunctions */ \"./Shaders/ShadersInclude/harmonicsFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertexDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/bumpVertexDeclaration */ \"./Shaders/ShadersInclude/bumpVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertex__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/bumpVertex */ \"./Shaders/ShadersInclude/bumpVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n/* harmony import */ var _ShadersInclude_fogVertex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/fogVertex */ \"./Shaders/ShadersInclude/fogVertex.ts\");\n/* harmony import */ var _ShadersInclude_shadowsVertex__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/shadowsVertex */ \"./Shaders/ShadersInclude/shadowsVertex.ts\");\n/* harmony import */ var _ShadersInclude_logDepthVertex__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ShadersInclude/logDepthVertex */ \"./Shaders/ShadersInclude/logDepthVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'pbrVertexShader';\r\nvar shader = \"precision highp float;\\n#include<__decl__pbrVertex>\\n#define CUSTOM_VERTEX_BEGIN\\n\\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 MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\\nvarying vec2 vAlbedoUV;\\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(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nvarying vec2 vReflectivityUV;\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nvarying vec2 vMicroSurfaceSamplerUV;\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nvarying vec2 vBumpUV;\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatUV;\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nvarying vec2 vClearCoatBumpUV;\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatTintUV;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nvarying vec2 vSheenUV;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nvarying vec2 vAnisotropyUV;\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nvarying vec2 vThicknessUV;\\n#endif\\n#endif\\n\\nvarying vec3 vPositionW;\\n#if DEBUGMODE>0\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#include\\n#endif\\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\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\n} else {\\ngl_Position=viewProjectionR*finalWorld*vec4(positionUpdated,1.0);\\n}\\n#else\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\n#endif\\n#if DEBUGMODE>0\\nvClipSpacePosition=gl_Position;\\n#endif\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\nvPositionW=vec3(worldPos);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\\n#endif\\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(ALBEDO) && ALBEDODIRECTUV == 0\\nif (vAlbedoInfos.x == 0.)\\n{\\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAlbedoUV=vec2(albedoMatrix*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(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nif (vReflectivityInfos.x == 0.)\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nif (vMicroSurfaceSamplerInfos.x == 0.)\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*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#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nif (vClearCoatInfos.x == 0.)\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nif (vClearCoatBumpInfos.x == 0.)\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nif (vClearCoatTintInfos.x == 0.)\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nif (vSheenInfos.x == 0.)\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nif (vAnisotropyInfos.x == 0.)\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nif (vThicknessInfos.x == 0.)\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n\\n#include\\n\\n#include\\n\\n#include\\n\\n#include[0..maxSimultaneousLights]\\n\\n#ifdef VERTEXCOLOR\\nvColor=color;\\n#endif\\n\\n#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\\n\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/postprocess.vertex.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/postprocess.vertex.ts ***!\n \\***************************************/\n/*! exports provided: postprocessVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"postprocessVertexShader\", function() { return postprocessVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'postprocessVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\nuniform vec2 scale;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvUV=(position*madd+madd)*scale;\\ngl_Position=vec4(position,0.0,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar postprocessVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/procedural.vertex.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/procedural.vertex.ts ***!\n \\**************************************/\n/*! exports provided: proceduralVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"proceduralVertexShader\", function() { return proceduralVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'proceduralVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar proceduralVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/refraction.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/refraction.fragment.ts ***!\n \\****************************************/\n/*! exports provided: refractionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"refractionPixelShader\", function() { return refractionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'refractionPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D refractionSampler;\\n\\nuniform vec3 baseColor;\\nuniform float depth;\\nuniform float colorLevel;\\nvoid main() {\\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\\nvec2 uv=vUV-vec2(0.5);\\nvec2 offset=uv*depth*ref;\\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar refractionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/rgbdDecode.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/rgbdDecode.fragment.ts ***!\n \\****************************************/\n/*! exports provided: rgbdDecodePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rgbdDecodePixelShader\", function() { return rgbdDecodePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'rgbdDecodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar rgbdDecodePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/rgbdEncode.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/rgbdEncode.fragment.ts ***!\n \\****************************************/\n/*! exports provided: rgbdEncodePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rgbdEncodePixelShader\", function() { return rgbdEncodePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'rgbdEncodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar rgbdEncodePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/shadowMap.fragment.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/shadowMap.fragment.ts ***!\n \\***************************************/\n/*! exports provided: shadowMapPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shadowMapPixelShader\", function() { return shadowMapPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_packingFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/packingFunctions */ \"./Shaders/ShadersInclude/packingFunctions.ts\");\n\r\n\r\nvar name = 'shadowMapPixelShader';\r\nvar shader = \"#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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar shadowMapPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/shadowMap.vertex.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/shadowMap.vertex.ts ***!\n \\*************************************/\n/*! exports provided: shadowMapVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shadowMapVertexShader\", function() { return shadowMapVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'shadowMapVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar shadowMapVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/sharpen.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/sharpen.fragment.ts ***!\n \\*************************************/\n/*! exports provided: sharpenPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sharpenPixelShader\", function() { return sharpenPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'sharpenPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec2 screenSize;\\nuniform vec2 sharpnessAmounts;\\nvoid main(void)\\n{\\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\\nvec4 color=texture2D(textureSampler,vUV);\\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\\ncolor*4.0;\\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar sharpenPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/sprites.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/sprites.fragment.ts ***!\n \\*************************************/\n/*! exports provided: spritesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"spritesPixelShader\", function() { return spritesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_fogFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/fogFragmentDeclaration */ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogFragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/fogFragment */ \"./Shaders/ShadersInclude/fogFragment.ts\");\n\r\n\r\n\r\nvar name = 'spritesPixelShader';\r\nvar shader = \"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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar spritesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/sprites.vertex.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/sprites.vertex.ts ***!\n \\***********************************/\n/*! exports provided: spritesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"spritesVertexShader\", function() { return spritesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n\r\n\r\nvar name = 'spritesVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar spritesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ssao.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/ssao.fragment.ts ***!\n \\**********************************/\n/*! exports provided: ssaoPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ssaoPixelShader\", function() { return ssaoPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'ssaoPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\nvarying vec2 vUV;\\n#ifdef SSAO\\nuniform sampler2D randomSampler;\\nuniform float randTextureTiles;\\nuniform float samplesFactor;\\nuniform vec3 sampleSphere[SAMPLES];\\nuniform float totalStrength;\\nuniform float radius;\\nuniform float area;\\nuniform float fallOff;\\nuniform float base;\\nvec3 normalFromDepth(float depth,vec2 coords)\\n{\\nvec2 offset1=vec2(0.0,radius);\\nvec2 offset2=vec2(radius,0.0);\\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\\nvec3 p1=vec3(offset1,depth1-depth);\\nvec3 p2=vec3(offset2,depth2-depth);\\nvec3 normal=cross(p1,p2);\\nnormal.z=-normal.z;\\nreturn normalize(normal);\\n}\\nvoid main()\\n{\\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\\nfloat depth=texture2D(textureSampler,vUV).r;\\nvec3 position=vec3(vUV,depth);\\nvec3 normal=normalFromDepth(depth,vUV);\\nfloat radiusDepth=radius/depth;\\nfloat occlusion=0.0;\\nvec3 ray;\\nvec3 hemiRay;\\nfloat occlusionDepth;\\nfloat difference;\\nfor (int i=0; i1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\\nvec3 bitangent=cross(normal,tangent);\\nmat3 tbn=mat3(tangent,bitangent,normal);\\nfloat difference;\\nfor (int i=0; i1.0 || offset.y>1.0) {\\ncontinue;\\n}\\n\\nfloat sampleDepth=abs(texture2D(textureSampler,offset.xy).r);\\n\\ndifference=depthSign*samplePosition.z-sampleDepth;\\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\\n}\\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\\nfloat result=clamp(ao+base,0.0,1.0);\\ngl_FragColor=vec4(vec3(result),1.0);\\n}\\n#endif\\n#ifdef BILATERAL_BLUR\\nuniform sampler2D depthSampler;\\nuniform float outSize;\\nuniform float samplerOffsets[SAMPLES];\\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.3846153846)*direction;\\nvec2 off2=vec2(3.2307692308)*direction;\\ncolor+=texture2D(image,uv)*0.2270270270;\\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\\nreturn color;\\n}\\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.411764705882353)*direction;\\nvec2 off2=vec2(3.2941176470588234)*direction;\\nvec2 off3=vec2(5.176470588235294)*direction;\\ncolor+=texture2D(image,uv)*0.1964825501511404;\\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\\nreturn color;\\n}\\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.411764705882353)*direction;\\nvec2 off2=vec2(3.2941176470588234)*direction;\\nvec2 off3=vec2(5.176470588235294)*direction;\\nfloat compareDepth=abs(texture2D(depthSampler,uv).r);\\nfloat sampleDepth;\\nfloat weight;\\nfloat weightSum=30.0;\\ncolor+=texture2D(image,uv)*30.0;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off1/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off1/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off2/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off2/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off3/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off3/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\\nreturn color/weightSum;\\n}\\nvoid main()\\n{\\n#if EXPENSIVE\\nfloat compareDepth=abs(texture2D(depthSampler,vUV).r);\\nfloat texelsize=1.0/outSize;\\nfloat result=0.0;\\nfloat weightSum=0.0;\\nfor (int i=0; ishadowPixelDepth)\\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\\ncurrentPosition+=stepL;\\n}\\naccumFog/=NB_STEPS;\\nvec3 color=accumFog*scatteringPower;\\ngl_FragColor=vec4(color*exp(color) ,1.0);\\n}\\n#endif\\n#if defined(VLSMERGE)\\nuniform sampler2D originalSampler;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\\n}\\n#endif\\n#if defined(LUMINANCE)\\nuniform vec2 lumOffsets[4];\\nvoid main()\\n{\\nfloat average=0.0;\\nvec4 color=vec4(0.0);\\nfloat maximum=-1e20;\\nvec3 weight=vec3(0.299,0.587,0.114);\\nfor (int i=0; i<4; i++)\\n{\\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\\n\\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\\n\\n#ifdef WEIGHTED_AVERAGE\\nfloat GreyValue=dot(color.rgb,weight);\\n#endif\\n#ifdef BRIGHTNESS\\nfloat GreyValue=max(color.r,max(color.g,color.b));\\n#endif\\n#ifdef HSL_COMPONENT\\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\\n#endif\\n#ifdef MAGNITUDE\\nfloat GreyValue=length(color.rgb);\\n#endif\\nmaximum=max(maximum,GreyValue);\\naverage+=(0.25*log(1e-5+GreyValue));\\n}\\naverage=exp(average);\\ngl_FragColor=vec4(average,maximum,0.0,1.0);\\n}\\n#endif\\n#if defined(LUMINANCE_DOWN_SAMPLE)\\nuniform vec2 dsOffsets[9];\\nuniform float halfDestPixelSize;\\n#ifdef FINAL_DOWN_SAMPLER\\n#include\\n#endif\\nvoid main()\\n{\\nvec4 color=vec4(0.0);\\nfloat average=0.0;\\nfor (int i=0; i<9; i++)\\n{\\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\\naverage+=color.r;\\n}\\naverage/=9.0;\\n#ifdef FINAL_DOWN_SAMPLER\\ngl_FragColor=pack(average);\\n#else\\ngl_FragColor=vec4(average,average,0.0,1.0);\\n#endif\\n}\\n#endif\\n#if defined(HDR)\\nuniform sampler2D textureAdderSampler;\\nuniform float averageLuminance;\\nvoid main()\\n{\\nvec4 color=texture2D(textureAdderSampler,vUV);\\n#ifndef AUTO_EXPOSURE\\nvec4 adjustedColor=color/averageLuminance;\\ncolor=adjustedColor;\\ncolor.a=1.0;\\n#endif\\ngl_FragColor=color;\\n}\\n#endif\\n#if defined(LENS_FLARE)\\n#define GHOSTS 3\\nuniform sampler2D lensColorSampler;\\nuniform float strength;\\nuniform float ghostDispersal;\\nuniform float haloWidth;\\nuniform vec2 resolution;\\nuniform float distortionStrength;\\nfloat hash(vec2 p)\\n{\\nfloat h=dot(p,vec2(127.1,311.7));\\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\\n}\\nfloat noise(in vec2 p)\\n{\\nvec2 i=floor(p);\\nvec2 f=fract(p);\\nvec2 u=f*f*(3.0-2.0*f);\\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\\nhash(i+vec2(1.0,0.0)),u.x),\\nmix(hash(i+vec2(0.0,1.0)),\\nhash(i+vec2(1.0,1.0)),u.x),u.y);\\n}\\nfloat fbm(vec2 p)\\n{\\nfloat f=0.0;\\nf+=0.5000*noise(p); p*=2.02;\\nf+=0.2500*noise(p); p*=2.03;\\nf+=0.1250*noise(p); p*=2.01;\\nf+=0.0625*noise(p); p*=2.04;\\nf/=0.9375;\\nreturn f;\\n}\\nvec3 pattern(vec2 uv)\\n{\\nvec2 p=-1.0+2.0*uv;\\nfloat p2=dot(p,p);\\nfloat f=fbm(vec2(15.0*p2))/2.0;\\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\\nreturn (1.0-f)*vec3(r,g,b);\\n}\\nfloat luminance(vec3 color)\\n{\\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\\n}\\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\\n{\\nreturn vec4(\\ntexture2D(tex,texcoord+direction*distortion.r).r,\\ntexture2D(tex,texcoord+direction*distortion.g).g,\\ntexture2D(tex,texcoord+direction*distortion.b).b,\\n1.0\\n);\\n}\\nvoid main(void)\\n{\\nvec2 uv=-vUV+vec2(1.0);\\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\\nvec2 texelSize=1.0/resolution;\\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\\nvec4 result=vec4(0.0);\\nfloat ghostIndice=1.0;\\nfor (int i=0; i=nSamples)\\nbreak;\\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\\nresult+=texture2D(textureSampler,offset1);\\n}\\ngl_FragColor=result/float(nSamples);\\n}\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar standardPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/stereoscopicInterlace.fragment.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/stereoscopicInterlace.fragment.ts ***!\n \\***************************************************/\n/*! exports provided: stereoscopicInterlacePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"stereoscopicInterlacePixelShader\", function() { return stereoscopicInterlacePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'stereoscopicInterlacePixelShader';\r\nvar shader = \"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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar stereoscopicInterlacePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/tonemap.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/tonemap.fragment.ts ***!\n \\*************************************/\n/*! exports provided: tonemapPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"tonemapPixelShader\", function() { return tonemapPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'tonemapPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform float _ExposureAdjustment;\\n#if defined(HABLE_TONEMAPPING)\\nconst float A=0.15;\\nconst float B=0.50;\\nconst float C=0.10;\\nconst float D=0.20;\\nconst float E=0.02;\\nconst float F=0.30;\\nconst float W=11.2;\\n#endif\\nfloat Luminance(vec3 c)\\n{\\nreturn dot(c,vec3(0.22,0.707,0.071));\\n}\\nvoid main(void)\\n{\\nvec3 colour=texture2D(textureSampler,vUV).rgb;\\n#if defined(REINHARD_TONEMAPPING)\\nfloat lum=Luminance(colour.rgb);\\nfloat lumTm=lum*_ExposureAdjustment;\\nfloat scale=lumTm/(1.0+lumTm);\\ncolour*=scale/lum;\\n#elif defined(HABLE_TONEMAPPING)\\ncolour*=_ExposureAdjustment;\\nconst float ExposureBias=2.0;\\nvec3 x=ExposureBias*colour;\\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\\nx=vec3(W,W,W);\\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\\ncolour=curr*whiteScale;\\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\\ncolour*=_ExposureAdjustment;\\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\\ncolour=retColor*retColor;\\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\\n#endif\\ngl_FragColor=vec4(colour.rgb,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar tonemapPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/volumetricLightScattering.fragment.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/volumetricLightScattering.fragment.ts ***!\n \\*******************************************************/\n/*! exports provided: volumetricLightScatteringPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"volumetricLightScatteringPixelShader\", function() { return volumetricLightScatteringPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'volumetricLightScatteringPixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform sampler2D lightScatteringSampler;\\nuniform float decay;\\nuniform float exposure;\\nuniform float weight;\\nuniform float density;\\nuniform vec2 meshPositionOnScreen;\\nvarying vec2 vUV;\\nvoid main(void) {\\nvec2 tc=vUV;\\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\\nfloat illuminationDecay=1.0;\\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\\nfor(int i=0; i\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n\\n#include\\nuniform mat4 viewProjection;\\nuniform vec2 depthValues;\\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\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#if (defined(ALPHATEST) || defined(NEED_UV)) && defined(UV1)\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar volumetricLightScatteringPassVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/vrDistortionCorrection.fragment.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/vrDistortionCorrection.fragment.ts ***!\n \\****************************************************/\n/*! exports provided: vrDistortionCorrectionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"vrDistortionCorrectionPixelShader\", function() { return vrDistortionCorrectionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'vrDistortionCorrectionPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar vrDistortionCorrectionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/vrMultiviewToSingleview.fragment.ts\":\n/*!*****************************************************!*\\\n !*** ./Shaders/vrMultiviewToSingleview.fragment.ts ***!\n \\*****************************************************/\n/*! exports provided: vrMultiviewToSingleviewPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"vrMultiviewToSingleviewPixelShader\", function() { return vrMultiviewToSingleviewPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'vrMultiviewToSingleviewPixelShader';\r\nvar shader = \"precision mediump sampler2DArray;\\nvarying vec2 vUV;\\nuniform sampler2DArray multiviewSampler;\\nuniform int imageIndex;\\nvoid main(void)\\n{\\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar vrMultiviewToSingleviewPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/index.ts\":\n/*!**************************!*\\\n !*** ./Sprites/index.ts ***!\n \\**************************/\n/*! exports provided: Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _sprite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sprite */ \"./Sprites/sprite.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return _sprite__WEBPACK_IMPORTED_MODULE_0__[\"Sprite\"]; });\n\n/* harmony import */ var _spriteManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./spriteManager */ \"./Sprites/spriteManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return _spriteManager__WEBPACK_IMPORTED_MODULE_1__[\"SpriteManager\"]; });\n\n/* harmony import */ var _spritePackedManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./spritePackedManager */ \"./Sprites/spritePackedManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return _spritePackedManager__WEBPACK_IMPORTED_MODULE_2__[\"SpritePackedManager\"]; });\n\n/* harmony import */ var _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./spriteSceneComponent */ \"./Sprites/spriteSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SpriteSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/sprite.ts\":\n/*!***************************!*\\\n !*** ./Sprites/sprite.ts ***!\n \\***************************/\n/*! exports provided: Sprite */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return Sprite; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n/**\r\n * Class used to represent a sprite\r\n * @see http://doc.babylonjs.com/babylon101/sprites\r\n */\r\nvar Sprite = /** @class */ (function () {\r\n /**\r\n * Creates a new Sprite\r\n * @param name defines the name\r\n * @param manager defines the manager\r\n */\r\n function Sprite(\r\n /** defines the name */\r\n name, manager) {\r\n this.name = name;\r\n /** Gets or sets the main color */\r\n this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /** Gets or sets the width */\r\n this.width = 1.0;\r\n /** Gets or sets the height */\r\n this.height = 1.0;\r\n /** Gets or sets rotation angle */\r\n this.angle = 0;\r\n /** Gets or sets a boolean indicating if UV coordinates should be inverted in U axis */\r\n this.invertU = 0;\r\n /** Gets or sets a boolean indicating if UV coordinates should be inverted in B axis */\r\n this.invertV = 0;\r\n /** Gets the list of attached animations */\r\n this.animations = new Array();\r\n /** Gets or sets a boolean indicating if the sprite can be picked */\r\n this.isPickable = false;\r\n this._animationStarted = false;\r\n this._loopAnimation = false;\r\n this._fromIndex = 0;\r\n this._toIndex = 0;\r\n this._delay = 0;\r\n this._direction = 1;\r\n this._time = 0;\r\n /**\r\n * Gets or sets a boolean indicating if the sprite is visible (renderable). Default is true\r\n */\r\n this.isVisible = true;\r\n this._manager = manager;\r\n this._manager.sprites.push(this);\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n Object.defineProperty(Sprite.prototype, \"size\", {\r\n /**\r\n * Gets or sets the sprite size\r\n */\r\n get: function () {\r\n return this.width;\r\n },\r\n set: function (value) {\r\n this.width = value;\r\n this.height = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Starts an animation\r\n * @param from defines the initial key\r\n * @param to defines the end key\r\n * @param loop defines if the animation must loop\r\n * @param delay defines the start delay (in ms)\r\n * @param onAnimationEnd defines a callback to call when animation ends\r\n */\r\n Sprite.prototype.playAnimation = function (from, to, loop, delay, onAnimationEnd) {\r\n this._fromIndex = from;\r\n this._toIndex = to;\r\n this._loopAnimation = loop;\r\n this._delay = delay;\r\n this._animationStarted = true;\r\n if (from < to) {\r\n this._direction = 1;\r\n }\r\n else {\r\n this._direction = -1;\r\n this._toIndex = from;\r\n this._fromIndex = to;\r\n }\r\n this.cellIndex = from;\r\n this._time = 0;\r\n this._onAnimationEnd = onAnimationEnd;\r\n };\r\n /** Stops current animation (if any) */\r\n Sprite.prototype.stopAnimation = function () {\r\n this._animationStarted = false;\r\n };\r\n /** @hidden */\r\n Sprite.prototype._animate = function (deltaTime) {\r\n if (!this._animationStarted) {\r\n return;\r\n }\r\n this._time += deltaTime;\r\n if (this._time > this._delay) {\r\n this._time = this._time % this._delay;\r\n this.cellIndex += this._direction;\r\n if (this._direction > 0 && this.cellIndex > this._toIndex || this._direction < 0 && this.cellIndex < this._fromIndex) {\r\n if (this._loopAnimation) {\r\n this.cellIndex = this._direction > 0 ? this._fromIndex : this._toIndex;\r\n }\r\n else {\r\n this.cellIndex = this._toIndex;\r\n this._animationStarted = false;\r\n if (this._onAnimationEnd) {\r\n this._onAnimationEnd();\r\n }\r\n if (this.disposeWhenFinishedAnimating) {\r\n this.dispose();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /** Release associated resources */\r\n Sprite.prototype.dispose = function () {\r\n for (var i = 0; i < this._manager.sprites.length; i++) {\r\n if (this._manager.sprites[i] == this) {\r\n this._manager.sprites.splice(i, 1);\r\n }\r\n }\r\n };\r\n return Sprite;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/spriteManager.ts\":\n/*!**********************************!*\\\n !*** ./Sprites/spriteManager.ts ***!\n \\**********************************/\n/*! exports provided: SpriteManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return SpriteManager; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./spriteSceneComponent */ \"./Sprites/spriteSceneComponent.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Shaders_sprites_fragment__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/sprites.fragment */ \"./Shaders/sprites.fragment.ts\");\n/* harmony import */ var _Shaders_sprites_vertex__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Shaders/sprites.vertex */ \"./Shaders/sprites.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to manage multiple sprites on the same spritesheet\r\n * @see http://doc.babylonjs.com/babylon101/sprites\r\n */\r\nvar SpriteManager = /** @class */ (function () {\r\n /**\r\n * Creates a new sprite manager\r\n * @param name defines the manager's name\r\n * @param imgUrl defines the sprite sheet url\r\n * @param capacity defines the maximum allowed number of sprites\r\n * @param cellSize defines the size of a sprite cell\r\n * @param scene defines the hosting scene\r\n * @param epsilon defines the epsilon value to align texture (0.01 by default)\r\n * @param samplingMode defines the smapling mode to use with spritesheet\r\n * @param fromPacked set to false; do not alter\r\n * @param spriteJSON null otherwise a JSON object defining sprite sheet data; do not alter\r\n */\r\n function SpriteManager(\r\n /** defines the manager's name */\r\n name, imgUrl, capacity, cellSize, scene, epsilon, samplingMode, fromPacked, spriteJSON) {\r\n if (epsilon === void 0) { epsilon = 0.01; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (fromPacked === void 0) { fromPacked = false; }\r\n if (spriteJSON === void 0) { spriteJSON = null; }\r\n this.name = name;\r\n /** Gets the list of sprites */\r\n this.sprites = new Array();\r\n /** Gets or sets the rendering group id (0 by default) */\r\n this.renderingGroupId = 0;\r\n /** Gets or sets camera layer mask */\r\n this.layerMask = 0x0FFFFFFF;\r\n /** Gets or sets a boolean indicating if the manager must consider scene fog when rendering */\r\n this.fogEnabled = true;\r\n /** Gets or sets a boolean indicating if the sprites are pickable */\r\n this.isPickable = false;\r\n /** True when packed cell data from JSON file is ready*/\r\n this._packedAndReady = false;\r\n /**\r\n * An event triggered when the manager is disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._vertexBuffers = {};\r\n if (!scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_8__[\"SceneComponentConstants\"].NAME_SPRITE)) {\r\n scene._addComponent(new _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SpriteSceneComponent\"](scene));\r\n }\r\n this._capacity = capacity;\r\n this._fromPacked = fromPacked;\r\n this._spriteTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"](imgUrl, scene, true, false, samplingMode);\r\n this._spriteTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._spriteTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n if (cellSize.width && cellSize.height) {\r\n this.cellWidth = cellSize.width;\r\n this.cellHeight = cellSize.height;\r\n }\r\n else if (cellSize !== undefined) {\r\n this.cellWidth = cellSize;\r\n this.cellHeight = cellSize;\r\n }\r\n else {\r\n return;\r\n }\r\n this._epsilon = epsilon;\r\n this._scene = scene;\r\n this._scene.spriteManagers.push(this);\r\n var indices = [];\r\n var index = 0;\r\n for (var count = 0; count < capacity; count++) {\r\n indices.push(index);\r\n indices.push(index + 1);\r\n indices.push(index + 2);\r\n indices.push(index);\r\n indices.push(index + 2);\r\n indices.push(index + 3);\r\n index += 4;\r\n }\r\n this._indexBuffer = scene.getEngine().createIndexBuffer(indices);\r\n // VBO\r\n // 18 floats per sprite (x, y, z, angle, sizeX, sizeY, offsetX, offsetY, invertU, invertV, cellLeft, cellTop, cellWidth, cellHeight, color r, color g, color b, color a)\r\n this._vertexData = new Float32Array(capacity * 18 * 4);\r\n this._buffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"Buffer\"](scene.getEngine(), this._vertexData, true, 18);\r\n var positions = this._buffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, 0, 4);\r\n var options = this._buffer.createVertexBuffer(\"options\", 4, 4);\r\n var inverts = this._buffer.createVertexBuffer(\"inverts\", 8, 2);\r\n var cellInfo = this._buffer.createVertexBuffer(\"cellInfo\", 10, 4);\r\n var colors = this._buffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind, 14, 4);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind] = positions;\r\n this._vertexBuffers[\"options\"] = options;\r\n this._vertexBuffers[\"inverts\"] = inverts;\r\n this._vertexBuffers[\"cellInfo\"] = cellInfo;\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind] = colors;\r\n // Effects\r\n this._effectBase = this._scene.getEngine().createEffect(\"sprites\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, \"options\", \"inverts\", \"cellInfo\", _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind], [\"view\", \"projection\", \"textureInfos\", \"alphaTest\"], [\"diffuseSampler\"], \"\");\r\n this._effectFog = this._scene.getEngine().createEffect(\"sprites\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, \"options\", \"inverts\", \"cellInfo\", _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind], [\"view\", \"projection\", \"textureInfos\", \"alphaTest\", \"vFogInfos\", \"vFogColor\"], [\"diffuseSampler\"], \"#define FOG\");\r\n if (this._fromPacked) {\r\n this._makePacked(imgUrl, spriteJSON);\r\n }\r\n }\r\n Object.defineProperty(SpriteManager.prototype, \"onDispose\", {\r\n /**\r\n * Callback called when the manager is disposed\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpriteManager.prototype, \"texture\", {\r\n /**\r\n * Gets or sets the spritesheet texture\r\n */\r\n get: function () {\r\n return this._spriteTexture;\r\n },\r\n set: function (value) {\r\n this._spriteTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SpriteManager.prototype._makePacked = function (imgUrl, spriteJSON) {\r\n var _this = this;\r\n if (spriteJSON !== null) {\r\n try {\r\n var celldata = JSON.parse(spriteJSON);\r\n var spritemap = Reflect.ownKeys(celldata.frames);\r\n this._spriteMap = spritemap;\r\n this._packedAndReady = true;\r\n this._cellData = celldata.frames;\r\n }\r\n catch (e) {\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON from string. Spritesheet managed with constant cell size.\");\r\n }\r\n }\r\n else {\r\n var re = /\\./g;\r\n var li = void 0;\r\n do {\r\n li = re.lastIndex;\r\n re.test(imgUrl);\r\n } while (re.lastIndex > 0);\r\n var jsonUrl = imgUrl.substring(0, li - 1) + \".json\";\r\n var xmlhttp_1 = new XMLHttpRequest();\r\n xmlhttp_1.open(\"GET\", jsonUrl, true);\r\n xmlhttp_1.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_10__[\"Logger\"].Error(\"Unable to Load Sprite JSON Data. Spritesheet managed with constant cell size.\");\r\n _this._fromPacked = false;\r\n _this._packedAndReady = false;\r\n };\r\n xmlhttp_1.onload = function () {\r\n try {\r\n var celldata = JSON.parse(xmlhttp_1.response);\r\n var spritemap = Reflect.ownKeys(celldata.frames);\r\n _this._spriteMap = spritemap;\r\n _this._packedAndReady = true;\r\n _this._cellData = celldata.frames;\r\n }\r\n catch (e) {\r\n _this._fromPacked = false;\r\n _this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON from file. Spritesheet managed with constant cell size.\");\r\n }\r\n };\r\n xmlhttp_1.send();\r\n }\r\n };\r\n SpriteManager.prototype._appendSpriteVertex = function (index, sprite, offsetX, offsetY, baseSize) {\r\n var arrayOffset = index * 18;\r\n if (offsetX === 0) {\r\n offsetX = this._epsilon;\r\n }\r\n else if (offsetX === 1) {\r\n offsetX = 1 - this._epsilon;\r\n }\r\n if (offsetY === 0) {\r\n offsetY = this._epsilon;\r\n }\r\n else if (offsetY === 1) {\r\n offsetY = 1 - this._epsilon;\r\n }\r\n // Positions\r\n this._vertexData[arrayOffset] = sprite.position.x;\r\n this._vertexData[arrayOffset + 1] = sprite.position.y;\r\n this._vertexData[arrayOffset + 2] = sprite.position.z;\r\n this._vertexData[arrayOffset + 3] = sprite.angle;\r\n // Options\r\n this._vertexData[arrayOffset + 4] = sprite.width;\r\n this._vertexData[arrayOffset + 5] = sprite.height;\r\n this._vertexData[arrayOffset + 6] = offsetX;\r\n this._vertexData[arrayOffset + 7] = offsetY;\r\n // Inverts\r\n this._vertexData[arrayOffset + 8] = sprite.invertU ? 1 : 0;\r\n this._vertexData[arrayOffset + 9] = sprite.invertV ? 1 : 0;\r\n // CellIfo\r\n if (this._packedAndReady) {\r\n if (!sprite.cellRef) {\r\n sprite.cellIndex = 0;\r\n }\r\n var num = sprite.cellIndex;\r\n if (typeof (num) === \"number\" && isFinite(num) && Math.floor(num) === num) {\r\n sprite.cellRef = this._spriteMap[sprite.cellIndex];\r\n }\r\n this._vertexData[arrayOffset + 10] = this._cellData[sprite.cellRef].frame.x / baseSize.width;\r\n this._vertexData[arrayOffset + 11] = this._cellData[sprite.cellRef].frame.y / baseSize.height;\r\n this._vertexData[arrayOffset + 12] = this._cellData[sprite.cellRef].frame.w / baseSize.width;\r\n this._vertexData[arrayOffset + 13] = this._cellData[sprite.cellRef].frame.h / baseSize.height;\r\n }\r\n else {\r\n if (!sprite.cellIndex) {\r\n sprite.cellIndex = 0;\r\n }\r\n var rowSize = baseSize.width / this.cellWidth;\r\n var offset = (sprite.cellIndex / rowSize) >> 0;\r\n this._vertexData[arrayOffset + 10] = (sprite.cellIndex - offset * rowSize) * this.cellWidth / baseSize.width;\r\n this._vertexData[arrayOffset + 11] = offset * this.cellHeight / baseSize.height;\r\n this._vertexData[arrayOffset + 12] = this.cellWidth / baseSize.width;\r\n this._vertexData[arrayOffset + 13] = this.cellHeight / baseSize.height;\r\n }\r\n // Color\r\n this._vertexData[arrayOffset + 14] = sprite.color.r;\r\n this._vertexData[arrayOffset + 15] = sprite.color.g;\r\n this._vertexData[arrayOffset + 16] = sprite.color.b;\r\n this._vertexData[arrayOffset + 17] = sprite.color.a;\r\n };\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @param fastCheck defines if a fast check only must be done (the first potential sprite is will be used and not the closer)\r\n * @returns null if no hit or a PickingInfo\r\n */\r\n SpriteManager.prototype.intersects = function (ray, camera, predicate, fastCheck) {\r\n var count = Math.min(this._capacity, this.sprites.length);\r\n var min = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var max = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var distance = Number.MAX_VALUE;\r\n var currentSprite = null;\r\n var pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var cameraSpacePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n var cameraView = camera.getViewMatrix();\r\n for (var index = 0; index < count; index++) {\r\n var sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n }\r\n else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n if (ray.intersectsBoxMinMax(min, max)) {\r\n var currentDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(cameraSpacePosition, ray.origin);\r\n if (distance > currentDistance) {\r\n distance = currentDistance;\r\n currentSprite = sprite;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (currentSprite) {\r\n var result = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_5__[\"PickingInfo\"]();\r\n cameraView.invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = currentSprite;\r\n result.distance = distance;\r\n // Get picked point\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[2];\r\n direction.copyFrom(ray.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n ray.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(pickedPoint, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n return result;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @returns null if no hit or a PickingInfo array\r\n */\r\n SpriteManager.prototype.multiIntersects = function (ray, camera, predicate) {\r\n var count = Math.min(this._capacity, this.sprites.length);\r\n var min = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var max = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var distance;\r\n var results = [];\r\n var pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0].copyFromFloats(0, 0, 0);\r\n var cameraSpacePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1].copyFromFloats(0, 0, 0);\r\n var cameraView = camera.getViewMatrix();\r\n for (var index = 0; index < count; index++) {\r\n var sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n }\r\n else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n if (ray.intersectsBoxMinMax(min, max)) {\r\n distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(cameraSpacePosition, ray.origin);\r\n var result = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_5__[\"PickingInfo\"]();\r\n results.push(result);\r\n cameraView.invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = sprite;\r\n result.distance = distance;\r\n // Get picked point\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[2];\r\n direction.copyFrom(ray.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n ray.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(pickedPoint, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n }\r\n }\r\n return results;\r\n };\r\n /**\r\n * Render all child sprites\r\n */\r\n SpriteManager.prototype.render = function () {\r\n // Check\r\n if (!this._effectBase.isReady() || !this._effectFog.isReady() || !this._spriteTexture\r\n || !this._spriteTexture.isReady() || !this.sprites.length) {\r\n return;\r\n }\r\n if (this._fromPacked && (!this._packedAndReady || !this._spriteMap || !this._cellData)) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n var baseSize = this._spriteTexture.getBaseSize();\r\n // Sprites\r\n var deltaTime = engine.getDeltaTime();\r\n var max = Math.min(this._capacity, this.sprites.length);\r\n var offset = 0;\r\n var noSprite = true;\r\n for (var index = 0; index < max; index++) {\r\n var sprite = this.sprites[index];\r\n if (!sprite || !sprite.isVisible) {\r\n continue;\r\n }\r\n noSprite = false;\r\n sprite._animate(deltaTime);\r\n this._appendSpriteVertex(offset++, sprite, 0, 0, baseSize);\r\n this._appendSpriteVertex(offset++, sprite, 1, 0, baseSize);\r\n this._appendSpriteVertex(offset++, sprite, 1, 1, baseSize);\r\n this._appendSpriteVertex(offset++, sprite, 0, 1, baseSize);\r\n }\r\n if (noSprite) {\r\n return;\r\n }\r\n this._buffer.update(this._vertexData);\r\n // Render\r\n var effect = this._effectBase;\r\n if (this._scene.fogEnabled && this._scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].FOGMODE_NONE && this.fogEnabled) {\r\n effect = this._effectFog;\r\n }\r\n engine.enableEffect(effect);\r\n var viewMatrix = this._scene.getViewMatrix();\r\n effect.setTexture(\"diffuseSampler\", this._spriteTexture);\r\n effect.setMatrix(\"view\", viewMatrix);\r\n effect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\r\n // Fog\r\n if (this._scene.fogEnabled && this._scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].FOGMODE_NONE && this.fogEnabled) {\r\n effect.setFloat4(\"vFogInfos\", this._scene.fogMode, this._scene.fogStart, this._scene.fogEnd, this._scene.fogDensity);\r\n effect.setColor3(\"vFogColor\", this._scene.fogColor);\r\n }\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.setDepthFunctionToLessOrEqual();\r\n effect.setBool(\"alphaTest\", true);\r\n engine.setColorWrite(false);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, (offset / 4) * 6);\r\n engine.setColorWrite(true);\r\n effect.setBool(\"alphaTest\", false);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_COMBINE);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, (offset / 4) * 6);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_DISABLE);\r\n };\r\n /**\r\n * Release associated resources\r\n */\r\n SpriteManager.prototype.dispose = function () {\r\n if (this._buffer) {\r\n this._buffer.dispose();\r\n this._buffer = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (this._spriteTexture) {\r\n this._spriteTexture.dispose();\r\n this._spriteTexture = null;\r\n }\r\n // Remove from scene\r\n var index = this._scene.spriteManagers.indexOf(this);\r\n this._scene.spriteManagers.splice(index, 1);\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n return SpriteManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/spritePackedManager.ts\":\n/*!****************************************!*\\\n !*** ./Sprites/spritePackedManager.ts ***!\n \\****************************************/\n/*! exports provided: SpritePackedManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return SpritePackedManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _spriteManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./spriteManager */ \"./Sprites/spriteManager.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to manage multiple sprites of different sizes on the same spritesheet\r\n * @see http://doc.babylonjs.com/babylon101/sprites\r\n */\r\nvar SpritePackedManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SpritePackedManager, _super);\r\n /**\r\n * Creates a new sprite manager from a packed sprite sheet\r\n * @param name defines the manager's name\r\n * @param imgUrl defines the sprite sheet url\r\n * @param capacity defines the maximum allowed number of sprites\r\n * @param scene defines the hosting scene\r\n * @param spriteJSON null otherwise a JSON object defining sprite sheet data\r\n * @param epsilon defines the epsilon value to align texture (0.01 by default)\r\n * @param samplingMode defines the smapling mode to use with spritesheet\r\n * @param fromPacked set to true; do not alter\r\n */\r\n function SpritePackedManager(\r\n /** defines the packed manager's name */\r\n name, imgUrl, capacity, scene, spriteJSON, epsilon, samplingMode) {\r\n if (spriteJSON === void 0) { spriteJSON = null; }\r\n if (epsilon === void 0) { epsilon = 0.01; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n var _this = \r\n //the cellSize parameter is not used when built from JSON which provides individual cell data, defaults to 64 if JSON load fails\r\n _super.call(this, name, imgUrl, capacity, 64, scene, epsilon, samplingMode, true, spriteJSON) || this;\r\n _this.name = name;\r\n return _this;\r\n }\r\n return SpritePackedManager;\r\n}(_spriteManager__WEBPACK_IMPORTED_MODULE_1__[\"SpriteManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/spriteSceneComponent.ts\":\n/*!*****************************************!*\\\n !*** ./Sprites/spriteSceneComponent.ts ***!\n \\*****************************************/\n/*! exports provided: SpriteSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return SpriteSceneComponent; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Actions/actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype._internalPickSprites = function (ray, predicate, fastCheck, camera) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfo = null;\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n if (this.spriteManagers.length > 0) {\r\n for (var spriteIndex = 0; spriteIndex < this.spriteManagers.length; spriteIndex++) {\r\n var spriteManager = this.spriteManagers[spriteIndex];\r\n if (!spriteManager.isPickable) {\r\n continue;\r\n }\r\n var result = spriteManager.intersects(ray, camera, predicate, fastCheck);\r\n if (!result || !result.hit) {\r\n continue;\r\n }\r\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\r\n continue;\r\n }\r\n pickingInfo = result;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return pickingInfo || new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__[\"PickingInfo\"]();\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype._internalMultiPickSprites = function (ray, predicate, camera) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfos = new Array();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n if (this.spriteManagers.length > 0) {\r\n for (var spriteIndex = 0; spriteIndex < this.spriteManagers.length; spriteIndex++) {\r\n var spriteManager = this.spriteManagers[spriteIndex];\r\n if (!spriteManager.isPickable) {\r\n continue;\r\n }\r\n var results = spriteManager.multiIntersects(ray, camera, predicate);\r\n if (results !== null) {\r\n pickingInfos = pickingInfos.concat(results);\r\n }\r\n }\r\n }\r\n return pickingInfos;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.pickSprite = function (x, y, predicate, fastCheck, camera) {\r\n this.createPickingRayInCameraSpaceToRef(x, y, this._tempSpritePickingRay, camera);\r\n return this._internalPickSprites(this._tempSpritePickingRay, predicate, fastCheck, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.pickSpriteWithRay = function (ray, predicate, fastCheck, camera) {\r\n if (!this._tempSpritePickingRay) {\r\n return null;\r\n }\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"].TransformToRef(ray, camera.getViewMatrix(), this._tempSpritePickingRay);\r\n return this._internalPickSprites(this._tempSpritePickingRay, predicate, fastCheck, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.multiPickSprite = function (x, y, predicate, camera) {\r\n this.createPickingRayInCameraSpaceToRef(x, y, this._tempSpritePickingRay, camera);\r\n return this._internalMultiPickSprites(this._tempSpritePickingRay, predicate, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.multiPickSpriteWithRay = function (ray, predicate, camera) {\r\n if (!this._tempSpritePickingRay) {\r\n return null;\r\n }\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"].TransformToRef(ray, camera.getViewMatrix(), this._tempSpritePickingRay);\r\n return this._internalMultiPickSprites(this._tempSpritePickingRay, predicate, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.setPointerOverSprite = function (sprite) {\r\n if (this._pointerOverSprite === sprite) {\r\n return;\r\n }\r\n if (this._pointerOverSprite && this._pointerOverSprite.actionManager) {\r\n this._pointerOverSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPointerOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(this._pointerOverSprite, this));\r\n }\r\n this._pointerOverSprite = sprite;\r\n if (this._pointerOverSprite && this._pointerOverSprite.actionManager) {\r\n this._pointerOverSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPointerOverTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(this._pointerOverSprite, this));\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.getPointerOverSprite = function () {\r\n return this._pointerOverSprite;\r\n};\r\n/**\r\n * Defines the sprite scene component responsible to manage sprites\r\n * in a given scene.\r\n */\r\nvar SpriteSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function SpriteSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_SPRITE;\r\n this.scene = scene;\r\n this.scene.spriteManagers = new Array();\r\n this.scene._tempSpritePickingRay = _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"] ? _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"].Zero() : null;\r\n this.scene.onBeforeSpritesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this.scene.onAfterSpritesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._spritePredicate = function (sprite) {\r\n if (!sprite.actionManager) {\r\n return false;\r\n }\r\n return sprite.isPickable && sprite.actionManager.hasPointerTriggers;\r\n };\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n SpriteSceneComponent.prototype.register = function () {\r\n this.scene._pointerMoveStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_POINTERMOVE_SPRITE, this, this._pointerMove);\r\n this.scene._pointerDownStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_POINTERDOWN_SPRITE, this, this._pointerDown);\r\n this.scene._pointerUpStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_POINTERUP_SPRITE, this, this._pointerUp);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n SpriteSceneComponent.prototype.rebuild = function () {\r\n /** Nothing to do for sprites */\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n SpriteSceneComponent.prototype.dispose = function () {\r\n this.scene.onBeforeSpritesRenderingObservable.clear();\r\n this.scene.onAfterSpritesRenderingObservable.clear();\r\n var spriteManagers = this.scene.spriteManagers;\r\n while (spriteManagers.length) {\r\n spriteManagers[0].dispose();\r\n }\r\n };\r\n SpriteSceneComponent.prototype._pickSpriteButKeepRay = function (originalPointerInfo, x, y, fastCheck, camera) {\r\n var result = this.scene.pickSprite(x, y, this._spritePredicate, fastCheck, camera);\r\n if (result) {\r\n result.ray = originalPointerInfo ? originalPointerInfo.ray : null;\r\n }\r\n return result;\r\n };\r\n SpriteSceneComponent.prototype._pointerMove = function (unTranslatedPointerX, unTranslatedPointerY, pickResult, isMeshPicked, canvas) {\r\n var scene = this.scene;\r\n if (isMeshPicked) {\r\n scene.setPointerOverSprite(null);\r\n }\r\n else {\r\n pickResult = this._pickSpriteButKeepRay(pickResult, unTranslatedPointerX, unTranslatedPointerY, false, scene.cameraToUseForPointers || undefined);\r\n if (pickResult && pickResult.hit && pickResult.pickedSprite) {\r\n scene.setPointerOverSprite(pickResult.pickedSprite);\r\n if (scene._pointerOverSprite && scene._pointerOverSprite.actionManager && scene._pointerOverSprite.actionManager.hoverCursor) {\r\n canvas.style.cursor = scene._pointerOverSprite.actionManager.hoverCursor;\r\n }\r\n else {\r\n canvas.style.cursor = scene.hoverCursor;\r\n }\r\n }\r\n else {\r\n scene.setPointerOverSprite(null);\r\n }\r\n }\r\n return pickResult;\r\n };\r\n SpriteSceneComponent.prototype._pointerDown = function (unTranslatedPointerX, unTranslatedPointerY, pickResult, evt) {\r\n var scene = this.scene;\r\n scene._pickedDownSprite = null;\r\n if (scene.spriteManagers.length > 0) {\r\n pickResult = scene.pickSprite(unTranslatedPointerX, unTranslatedPointerY, this._spritePredicate, false, scene.cameraToUseForPointers || undefined);\r\n if (pickResult && pickResult.hit && pickResult.pickedSprite) {\r\n if (pickResult.pickedSprite.actionManager) {\r\n scene._pickedDownSprite = pickResult.pickedSprite;\r\n switch (evt.button) {\r\n case 0:\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnLeftPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n break;\r\n case 1:\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnCenterPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n break;\r\n case 2:\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnRightPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n break;\r\n }\r\n if (pickResult.pickedSprite.actionManager) {\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickDownTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n }\r\n }\r\n }\r\n }\r\n return pickResult;\r\n };\r\n SpriteSceneComponent.prototype._pointerUp = function (unTranslatedPointerX, unTranslatedPointerY, pickResult, evt) {\r\n var scene = this.scene;\r\n if (scene.spriteManagers.length > 0) {\r\n var spritePickResult = scene.pickSprite(unTranslatedPointerX, unTranslatedPointerY, this._spritePredicate, false, scene.cameraToUseForPointers || undefined);\r\n if (spritePickResult) {\r\n if (spritePickResult.hit && spritePickResult.pickedSprite) {\r\n if (spritePickResult.pickedSprite.actionManager) {\r\n spritePickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickUpTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(spritePickResult.pickedSprite, scene, evt));\r\n if (spritePickResult.pickedSprite.actionManager) {\r\n if (!this.scene._inputManager._isPointerSwiping()) {\r\n spritePickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(spritePickResult.pickedSprite, scene, evt));\r\n }\r\n }\r\n }\r\n }\r\n if (scene._pickedDownSprite && scene._pickedDownSprite.actionManager && scene._pickedDownSprite !== spritePickResult.pickedSprite) {\r\n scene._pickedDownSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(scene._pickedDownSprite, scene, evt));\r\n }\r\n }\r\n }\r\n return pickResult;\r\n };\r\n return SpriteSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/alphaCullingState.ts\":\n/*!*************************************!*\\\n !*** ./States/alphaCullingState.ts ***!\n \\*************************************/\n/*! exports provided: _AlphaState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _AlphaState; });\n/**\r\n * @hidden\r\n **/\r\nvar _AlphaState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function _AlphaState() {\r\n this._isAlphaBlendDirty = false;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters = new Array(4);\r\n this._blendEquationParameters = new Array(2);\r\n this._blendConstants = new Array(4);\r\n this.reset();\r\n }\r\n Object.defineProperty(_AlphaState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isAlphaBlendDirty || this._isBlendFunctionParametersDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_AlphaState.prototype, \"alphaBlend\", {\r\n get: function () {\r\n return this._alphaBlend;\r\n },\r\n set: function (value) {\r\n if (this._alphaBlend === value) {\r\n return;\r\n }\r\n this._alphaBlend = value;\r\n this._isAlphaBlendDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n _AlphaState.prototype.setAlphaBlendConstants = function (r, g, b, a) {\r\n if (this._blendConstants[0] === r &&\r\n this._blendConstants[1] === g &&\r\n this._blendConstants[2] === b &&\r\n this._blendConstants[3] === a) {\r\n return;\r\n }\r\n this._blendConstants[0] = r;\r\n this._blendConstants[1] = g;\r\n this._blendConstants[2] = b;\r\n this._blendConstants[3] = a;\r\n this._isBlendConstantsDirty = true;\r\n };\r\n _AlphaState.prototype.setAlphaBlendFunctionParameters = function (value0, value1, value2, value3) {\r\n if (this._blendFunctionParameters[0] === value0 &&\r\n this._blendFunctionParameters[1] === value1 &&\r\n this._blendFunctionParameters[2] === value2 &&\r\n this._blendFunctionParameters[3] === value3) {\r\n return;\r\n }\r\n this._blendFunctionParameters[0] = value0;\r\n this._blendFunctionParameters[1] = value1;\r\n this._blendFunctionParameters[2] = value2;\r\n this._blendFunctionParameters[3] = value3;\r\n this._isBlendFunctionParametersDirty = true;\r\n };\r\n _AlphaState.prototype.setAlphaEquationParameters = function (rgb, alpha) {\r\n if (this._blendEquationParameters[0] === rgb &&\r\n this._blendEquationParameters[1] === alpha) {\r\n return;\r\n }\r\n this._blendEquationParameters[0] = rgb;\r\n this._blendEquationParameters[1] = alpha;\r\n this._isBlendEquationParametersDirty = true;\r\n };\r\n _AlphaState.prototype.reset = function () {\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters[0] = null;\r\n this._blendFunctionParameters[1] = null;\r\n this._blendFunctionParameters[2] = null;\r\n this._blendFunctionParameters[3] = null;\r\n this._blendEquationParameters[0] = null;\r\n this._blendEquationParameters[1] = null;\r\n this._blendConstants[0] = null;\r\n this._blendConstants[1] = null;\r\n this._blendConstants[2] = null;\r\n this._blendConstants[3] = null;\r\n this._isAlphaBlendDirty = true;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n };\r\n _AlphaState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Alpha blend\r\n if (this._isAlphaBlendDirty) {\r\n if (this._alphaBlend) {\r\n gl.enable(gl.BLEND);\r\n }\r\n else {\r\n gl.disable(gl.BLEND);\r\n }\r\n this._isAlphaBlendDirty = false;\r\n }\r\n // Alpha function\r\n if (this._isBlendFunctionParametersDirty) {\r\n gl.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]);\r\n this._isBlendFunctionParametersDirty = false;\r\n }\r\n // Alpha equation\r\n if (this._isBlendEquationParametersDirty) {\r\n gl.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]);\r\n this._isBlendEquationParametersDirty = false;\r\n }\r\n // Constants\r\n if (this._isBlendConstantsDirty) {\r\n gl.blendColor(this._blendConstants[0], this._blendConstants[1], this._blendConstants[2], this._blendConstants[3]);\r\n this._isBlendConstantsDirty = false;\r\n }\r\n };\r\n return _AlphaState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/depthCullingState.ts\":\n/*!*************************************!*\\\n !*** ./States/depthCullingState.ts ***!\n \\*************************************/\n/*! exports provided: _DepthCullingState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _DepthCullingState; });\n/**\r\n * @hidden\r\n **/\r\nvar _DepthCullingState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function _DepthCullingState() {\r\n this._isDepthTestDirty = false;\r\n this._isDepthMaskDirty = false;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(_DepthCullingState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isDepthFuncDirty || this._isDepthTestDirty || this._isDepthMaskDirty || this._isCullFaceDirty || this._isCullDirty || this._isZOffsetDirty || this._isFrontFaceDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"zOffset\", {\r\n get: function () {\r\n return this._zOffset;\r\n },\r\n set: function (value) {\r\n if (this._zOffset === value) {\r\n return;\r\n }\r\n this._zOffset = value;\r\n this._isZOffsetDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"cullFace\", {\r\n get: function () {\r\n return this._cullFace;\r\n },\r\n set: function (value) {\r\n if (this._cullFace === value) {\r\n return;\r\n }\r\n this._cullFace = value;\r\n this._isCullFaceDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"cull\", {\r\n get: function () {\r\n return this._cull;\r\n },\r\n set: function (value) {\r\n if (this._cull === value) {\r\n return;\r\n }\r\n this._cull = value;\r\n this._isCullDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"depthFunc\", {\r\n get: function () {\r\n return this._depthFunc;\r\n },\r\n set: function (value) {\r\n if (this._depthFunc === value) {\r\n return;\r\n }\r\n this._depthFunc = value;\r\n this._isDepthFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"depthMask\", {\r\n get: function () {\r\n return this._depthMask;\r\n },\r\n set: function (value) {\r\n if (this._depthMask === value) {\r\n return;\r\n }\r\n this._depthMask = value;\r\n this._isDepthMaskDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"depthTest\", {\r\n get: function () {\r\n return this._depthTest;\r\n },\r\n set: function (value) {\r\n if (this._depthTest === value) {\r\n return;\r\n }\r\n this._depthTest = value;\r\n this._isDepthTestDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"frontFace\", {\r\n get: function () {\r\n return this._frontFace;\r\n },\r\n set: function (value) {\r\n if (this._frontFace === value) {\r\n return;\r\n }\r\n this._frontFace = value;\r\n this._isFrontFaceDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n _DepthCullingState.prototype.reset = function () {\r\n this._depthMask = true;\r\n this._depthTest = true;\r\n this._depthFunc = null;\r\n this._cullFace = null;\r\n this._cull = null;\r\n this._zOffset = 0;\r\n this._frontFace = null;\r\n this._isDepthTestDirty = true;\r\n this._isDepthMaskDirty = true;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n };\r\n _DepthCullingState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Cull\r\n if (this._isCullDirty) {\r\n if (this.cull) {\r\n gl.enable(gl.CULL_FACE);\r\n }\r\n else {\r\n gl.disable(gl.CULL_FACE);\r\n }\r\n this._isCullDirty = false;\r\n }\r\n // Cull face\r\n if (this._isCullFaceDirty) {\r\n gl.cullFace(this.cullFace);\r\n this._isCullFaceDirty = false;\r\n }\r\n // Depth mask\r\n if (this._isDepthMaskDirty) {\r\n gl.depthMask(this.depthMask);\r\n this._isDepthMaskDirty = false;\r\n }\r\n // Depth test\r\n if (this._isDepthTestDirty) {\r\n if (this.depthTest) {\r\n gl.enable(gl.DEPTH_TEST);\r\n }\r\n else {\r\n gl.disable(gl.DEPTH_TEST);\r\n }\r\n this._isDepthTestDirty = false;\r\n }\r\n // Depth func\r\n if (this._isDepthFuncDirty) {\r\n gl.depthFunc(this.depthFunc);\r\n this._isDepthFuncDirty = false;\r\n }\r\n // zOffset\r\n if (this._isZOffsetDirty) {\r\n if (this.zOffset) {\r\n gl.enable(gl.POLYGON_OFFSET_FILL);\r\n gl.polygonOffset(this.zOffset, 0);\r\n }\r\n else {\r\n gl.disable(gl.POLYGON_OFFSET_FILL);\r\n }\r\n this._isZOffsetDirty = false;\r\n }\r\n // Front face\r\n if (this._isFrontFaceDirty) {\r\n gl.frontFace(this.frontFace);\r\n this._isFrontFaceDirty = false;\r\n }\r\n };\r\n return _DepthCullingState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/index.ts\":\n/*!*************************!*\\\n !*** ./States/index.ts ***!\n \\*************************/\n/*! exports provided: _AlphaState, _DepthCullingState, _StencilState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _alphaCullingState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alphaCullingState */ \"./States/alphaCullingState.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _alphaCullingState__WEBPACK_IMPORTED_MODULE_0__[\"_AlphaState\"]; });\n\n/* harmony import */ var _depthCullingState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./depthCullingState */ \"./States/depthCullingState.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _depthCullingState__WEBPACK_IMPORTED_MODULE_1__[\"_DepthCullingState\"]; });\n\n/* harmony import */ var _stencilState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stencilState */ \"./States/stencilState.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _stencilState__WEBPACK_IMPORTED_MODULE_2__[\"_StencilState\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/stencilState.ts\":\n/*!********************************!*\\\n !*** ./States/stencilState.ts ***!\n \\********************************/\n/*! exports provided: _StencilState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _StencilState; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _StencilState = /** @class */ (function () {\r\n function _StencilState() {\r\n this._isStencilTestDirty = false;\r\n this._isStencilMaskDirty = false;\r\n this._isStencilFuncDirty = false;\r\n this._isStencilOpDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(_StencilState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilFunc\", {\r\n get: function () {\r\n return this._stencilFunc;\r\n },\r\n set: function (value) {\r\n if (this._stencilFunc === value) {\r\n return;\r\n }\r\n this._stencilFunc = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilFuncRef\", {\r\n get: function () {\r\n return this._stencilFuncRef;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncRef === value) {\r\n return;\r\n }\r\n this._stencilFuncRef = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilFuncMask\", {\r\n get: function () {\r\n return this._stencilFuncMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncMask === value) {\r\n return;\r\n }\r\n this._stencilFuncMask = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilOpStencilFail\", {\r\n get: function () {\r\n return this._stencilOpStencilFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilFail === value) {\r\n return;\r\n }\r\n this._stencilOpStencilFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilOpDepthFail\", {\r\n get: function () {\r\n return this._stencilOpDepthFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpDepthFail === value) {\r\n return;\r\n }\r\n this._stencilOpDepthFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilOpStencilDepthPass\", {\r\n get: function () {\r\n return this._stencilOpStencilDepthPass;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilDepthPass === value) {\r\n return;\r\n }\r\n this._stencilOpStencilDepthPass = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilMask\", {\r\n get: function () {\r\n return this._stencilMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilMask === value) {\r\n return;\r\n }\r\n this._stencilMask = value;\r\n this._isStencilMaskDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilTest\", {\r\n get: function () {\r\n return this._stencilTest;\r\n },\r\n set: function (value) {\r\n if (this._stencilTest === value) {\r\n return;\r\n }\r\n this._stencilTest = value;\r\n this._isStencilTestDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n _StencilState.prototype.reset = function () {\r\n this._stencilTest = false;\r\n this._stencilMask = 0xFF;\r\n this._stencilFunc = _StencilState.ALWAYS;\r\n this._stencilFuncRef = 1;\r\n this._stencilFuncMask = 0xFF;\r\n this._stencilOpStencilFail = _StencilState.KEEP;\r\n this._stencilOpDepthFail = _StencilState.KEEP;\r\n this._stencilOpStencilDepthPass = _StencilState.REPLACE;\r\n this._isStencilTestDirty = true;\r\n this._isStencilMaskDirty = true;\r\n this._isStencilFuncDirty = true;\r\n this._isStencilOpDirty = true;\r\n };\r\n _StencilState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Stencil test\r\n if (this._isStencilTestDirty) {\r\n if (this.stencilTest) {\r\n gl.enable(gl.STENCIL_TEST);\r\n }\r\n else {\r\n gl.disable(gl.STENCIL_TEST);\r\n }\r\n this._isStencilTestDirty = false;\r\n }\r\n // Stencil mask\r\n if (this._isStencilMaskDirty) {\r\n gl.stencilMask(this.stencilMask);\r\n this._isStencilMaskDirty = false;\r\n }\r\n // Stencil func\r\n if (this._isStencilFuncDirty) {\r\n gl.stencilFunc(this.stencilFunc, this.stencilFuncRef, this.stencilFuncMask);\r\n this._isStencilFuncDirty = false;\r\n }\r\n // Stencil op\r\n if (this._isStencilOpDirty) {\r\n gl.stencilOp(this.stencilOpStencilFail, this.stencilOpDepthFail, this.stencilOpStencilDepthPass);\r\n this._isStencilOpDirty = false;\r\n }\r\n };\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n _StencilState.ALWAYS = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].ALWAYS;\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n _StencilState.KEEP = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].KEEP;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n _StencilState.REPLACE = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].REPLACE;\r\n return _StencilState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./abstractScene.ts\":\n/*!**************************!*\\\n !*** ./abstractScene.ts ***!\n \\**************************/\n/*! exports provided: AbstractScene */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractScene\", function() { return AbstractScene; });\n/**\r\n * Base class of the scene acting as a container for the different elements composing a scene.\r\n * This class is dynamically extended by the different components of the scene increasing\r\n * flexibility and reducing coupling\r\n */\r\nvar AbstractScene = /** @class */ (function () {\r\n function AbstractScene() {\r\n /**\r\n * Gets the list of root nodes (ie. nodes with no parent)\r\n */\r\n this.rootNodes = new Array();\r\n /** All of the cameras added to this scene\r\n * @see http://doc.babylonjs.com/babylon101/cameras\r\n */\r\n this.cameras = new Array();\r\n /**\r\n * All of the lights added to this scene\r\n * @see http://doc.babylonjs.com/babylon101/lights\r\n */\r\n this.lights = new Array();\r\n /**\r\n * All of the (abstract) meshes added to this scene\r\n */\r\n this.meshes = new Array();\r\n /**\r\n * The list of skeletons added to the scene\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\n this.skeletons = new Array();\r\n /**\r\n * All of the particle systems added to this scene\r\n * @see http://doc.babylonjs.com/babylon101/particles\r\n */\r\n this.particleSystems = new Array();\r\n /**\r\n * Gets a list of Animations associated with the scene\r\n */\r\n this.animations = [];\r\n /**\r\n * All of the animation groups added to this scene\r\n * @see http://doc.babylonjs.com/how_to/group\r\n */\r\n this.animationGroups = new Array();\r\n /**\r\n * All of the multi-materials added to this scene\r\n * @see http://doc.babylonjs.com/how_to/multi_materials\r\n */\r\n this.multiMaterials = new Array();\r\n /**\r\n * All of the materials added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addMaterial and removeMAterial Scene methods.\r\n * Note also that the order of the Material wihin the array is not significant and might change.\r\n * @see http://doc.babylonjs.com/babylon101/materials\r\n */\r\n this.materials = new Array();\r\n /**\r\n * The list of morph target managers added to the scene\r\n * @see http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh\r\n */\r\n this.morphTargetManagers = new Array();\r\n /**\r\n * The list of geometries used in the scene.\r\n */\r\n this.geometries = new Array();\r\n /**\r\n * All of the tranform nodes added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\r\n * Note also that the order of the TransformNode wihin the array is not significant and might change.\r\n * @see http://doc.babylonjs.com/how_to/transformnode\r\n */\r\n this.transformNodes = new Array();\r\n /**\r\n * ActionManagers available on the scene.\r\n */\r\n this.actionManagers = new Array();\r\n /**\r\n * Textures to keep.\r\n */\r\n this.textures = new Array();\r\n /**\r\n * Environment texture for the scene\r\n */\r\n this.environmentTexture = null;\r\n }\r\n /**\r\n * Adds a parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n AbstractScene.AddParser = function (name, parser) {\r\n this._BabylonFileParsers[name] = parser;\r\n };\r\n /**\r\n * Gets a general parser from the list of avaialble ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n AbstractScene.GetParser = function (name) {\r\n if (this._BabylonFileParsers[name]) {\r\n return this._BabylonFileParsers[name];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Adds n individual parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n AbstractScene.AddIndividualParser = function (name, parser) {\r\n this._IndividualBabylonFileParsers[name] = parser;\r\n };\r\n /**\r\n * Gets an individual parser from the list of avaialble ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n AbstractScene.GetIndividualParser = function (name) {\r\n if (this._IndividualBabylonFileParsers[name]) {\r\n return this._IndividualBabylonFileParsers[name];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Parser json data and populate both a scene and its associated container object\r\n * @param jsonData Defines the data to parse\r\n * @param scene Defines the scene to parse the data for\r\n * @param container Defines the container attached to the parsing sequence\r\n * @param rootUrl Defines the root url of the data\r\n */\r\n AbstractScene.Parse = function (jsonData, scene, container, rootUrl) {\r\n for (var parserName in this._BabylonFileParsers) {\r\n if (this._BabylonFileParsers.hasOwnProperty(parserName)) {\r\n this._BabylonFileParsers[parserName](jsonData, scene, container, rootUrl);\r\n }\r\n }\r\n };\r\n /**\r\n * Stores the list of available parsers in the application.\r\n */\r\n AbstractScene._BabylonFileParsers = {};\r\n /**\r\n * Stores the list of available individual parsers in the application.\r\n */\r\n AbstractScene._IndividualBabylonFileParsers = {};\r\n return AbstractScene;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./assetContainer.ts\":\n/*!***************************!*\\\n !*** ./assetContainer.ts ***!\n \\***************************/\n/*! exports provided: KeepAssets, AssetContainer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeepAssets\", function() { return KeepAssets; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetContainer\", function() { return AssetContainer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Meshes/mesh */ \"./Meshes/mesh.ts\");\n\r\n\r\n\r\n/**\r\n * Set of assets to keep when moving a scene into an asset container.\r\n */\r\nvar KeepAssets = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](KeepAssets, _super);\r\n function KeepAssets() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return KeepAssets;\r\n}(_abstractScene__WEBPACK_IMPORTED_MODULE_1__[\"AbstractScene\"]));\r\n\r\n/**\r\n * Container with a set of assets that can be added or removed from a scene.\r\n */\r\nvar AssetContainer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AssetContainer, _super);\r\n /**\r\n * Instantiates an AssetContainer.\r\n * @param scene The scene the AssetContainer belongs to.\r\n */\r\n function AssetContainer(scene) {\r\n var _this = _super.call(this) || this;\r\n _this.scene = scene;\r\n _this[\"sounds\"] = [];\r\n _this[\"effectLayers\"] = [];\r\n _this[\"layers\"] = [];\r\n _this[\"lensFlareSystems\"] = [];\r\n _this[\"proceduralTextures\"] = [];\r\n _this[\"reflectionProbes\"] = [];\r\n return _this;\r\n }\r\n /**\r\n * Adds all the assets from the container to the scene.\r\n */\r\n AssetContainer.prototype.addAllToScene = function () {\r\n var _this = this;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.addCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.addLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.addMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.addSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.addAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.addAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.addMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.addMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.addMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.addGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.addTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.addActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.addTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.addReflectionProbe(o);\r\n });\r\n if (this.environmentTexture) {\r\n this.scene.environmentTexture = this.environmentTexture;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.addFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Removes all the assets in the container from the scene\r\n */\r\n AssetContainer.prototype.removeAllFromScene = function () {\r\n var _this = this;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.removeCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.removeLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.removeMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.removeSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.removeAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.removeAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.removeMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.removeMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.removeMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.removeGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.removeTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.removeActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.removeTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.removeReflectionProbe(o);\r\n });\r\n if (this.environmentTexture === this.scene.environmentTexture) {\r\n this.scene.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Disposes all the assets in the container\r\n */\r\n AssetContainer.prototype.dispose = function () {\r\n this.cameras.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.cameras = [];\r\n this.lights.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.lights = [];\r\n this.meshes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.meshes = [];\r\n this.skeletons.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.skeletons = [];\r\n this.animationGroups.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.animationGroups = [];\r\n this.multiMaterials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.multiMaterials = [];\r\n this.materials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.materials = [];\r\n this.geometries.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.geometries = [];\r\n this.transformNodes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.transformNodes = [];\r\n this.actionManagers.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.actionManagers = [];\r\n this.textures.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.textures = [];\r\n this.reflectionProbes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.reflectionProbes = [];\r\n if (this.environmentTexture) {\r\n this.environmentTexture.dispose();\r\n this.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this, true);\r\n }\r\n };\r\n AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {\r\n if (!sourceAssets) {\r\n return;\r\n }\r\n for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {\r\n var asset = sourceAssets_1[_i];\r\n var move = true;\r\n if (keepAssets) {\r\n for (var _a = 0, keepAssets_1 = keepAssets; _a < keepAssets_1.length; _a++) {\r\n var keepAsset = keepAssets_1[_a];\r\n if (asset === keepAsset) {\r\n move = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (move) {\r\n targetAssets.push(asset);\r\n }\r\n }\r\n };\r\n /**\r\n * Removes all the assets contained in the scene and adds them to the container.\r\n * @param keepAssets Set of assets to keep in the scene. (default: empty)\r\n */\r\n AssetContainer.prototype.moveAllFromScene = function (keepAssets) {\r\n if (keepAssets === undefined) {\r\n keepAssets = new KeepAssets();\r\n }\r\n for (var key in this) {\r\n if (this.hasOwnProperty(key)) {\r\n this[key] = this[key] || (key === \"environmentTexture\" ? null : []);\r\n this._moveAssets(this.scene[key], this[key], keepAssets[key]);\r\n }\r\n }\r\n this.removeAllFromScene();\r\n };\r\n /**\r\n * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.\r\n * @returns the root mesh\r\n */\r\n AssetContainer.prototype.createRootMesh = function () {\r\n var rootMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"assetContainerRootMesh\", this.scene);\r\n this.meshes.forEach(function (m) {\r\n if (!m.parent) {\r\n rootMesh.addChild(m);\r\n }\r\n });\r\n this.meshes.unshift(rootMesh);\r\n return rootMesh;\r\n };\r\n return AssetContainer;\r\n}(_abstractScene__WEBPACK_IMPORTED_MODULE_1__[\"AbstractScene\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./index.ts\":\n/*!******************!*\\\n !*** ./index.ts ***!\n \\******************/\n/*! exports provided: AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AutoRotationBehavior, BouncingBehavior, FramingBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, PointerDragBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstractScene */ \"./abstractScene.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractScene\", function() { return _abstractScene__WEBPACK_IMPORTED_MODULE_0__[\"AbstractScene\"]; });\n\n/* harmony import */ var _Actions_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Actions/index */ \"./Actions/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ActionEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"Condition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ValueCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"PredicateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"StateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SwitchBooleanAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SetStateAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SetValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"IncrementValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"PlayAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"StopAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"DoNothingAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"CombineAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ExecuteCodeAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SetParentAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"PlaySoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"StopSoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"InterpolateValueAction\"]; });\n\n/* harmony import */ var _Animations_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Animations/index */ \"./Animations/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"Animatable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"_IAnimationState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"TargetedAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationPropertiesOverride\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"EasingFunction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"CircleEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"BackEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"BounceEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"CubicEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"ElasticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"ExponentialEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"PowerEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"QuadraticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"QuarticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"QuinticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"SineEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"BezierCurveEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"RuntimeAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationKeyInterpolation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationRange\"]; });\n\n/* harmony import */ var _assetContainer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./assetContainer */ \"./assetContainer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeepAssets\", function() { return _assetContainer__WEBPACK_IMPORTED_MODULE_3__[\"KeepAssets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetContainer\", function() { return _assetContainer__WEBPACK_IMPORTED_MODULE_3__[\"AssetContainer\"]; });\n\n/* harmony import */ var _Audio_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Audio/index */ \"./Audio/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"Analyser\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"AudioEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"AudioSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"Sound\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"SoundTrack\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"WeightedSound\"]; });\n\n/* harmony import */ var _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Behaviors/index */ \"./Behaviors/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"AutoRotationBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"BouncingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"FramingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"AttachToBoxBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"FadeInOutBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"PointerDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"SixDofDragBehavior\"]; });\n\n/* harmony import */ var _Bones_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Bones/index */ \"./Bones/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"Bone\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"BoneIKController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"BoneLookController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"Skeleton\"]; });\n\n/* harmony import */ var _Cameras_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Cameras/index */ \"./Cameras/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"CameraInputTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"CameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"Camera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"TargetCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"TouchCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"DeviceOrientationCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcFollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"GamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"UniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VirtualJoysticksCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraTouchInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraVirtualJoystickInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRCameraMetrics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebVRFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXREnterExitUI\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRSessionManager\"]; });\n\n/* harmony import */ var _Collisions_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Collisions/index */ \"./Collisions/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"Collider\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"DefaultCollisionCoordinator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"PickingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"IntersectionInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"_MeshCollisionData\"]; });\n\n/* harmony import */ var _Culling_index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Culling/index */ \"./Culling/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"BoundingBox\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"BoundingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"BoundingSphere\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"Ray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"Octree\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"OctreeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"OctreeSceneComponent\"]; });\n\n/* harmony import */ var _Debug_index__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Debug/index */ \"./Debug/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"AxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"BoneAxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"DebugLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"PhysicsViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"RayHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"SkeletonViewer\"]; });\n\n/* harmony import */ var _Engines_index__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Engines/index */ \"./Engines/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"InstancingAttributeInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"DepthTextureCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"EngineCapabilities\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"Engine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"EngineStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"NullEngineOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"NullEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"WebGLPipelineContext\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"WebGL2ShaderProcessor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"NativeEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"_OcclusionDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"_forceTransformFeedbackToBundle\"]; });\n\n/* harmony import */ var _Events_index__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Events/index */ \"./Events/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"KeyboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"KeyboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"KeyboardInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerInfoBase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"ClipboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"ClipboardInfo\"]; });\n\n/* harmony import */ var _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Gamepads/index */ \"./Gamepads/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"StickValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Gamepad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GenericPad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GamepadManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GamepadSystemSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Xbox360Button\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Xbox360Dpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Xbox360Pad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DualShockButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DualShockDpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DualShockPad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DaydreamController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GearVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GenericController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"OculusTouchController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"PoseEnabledController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"ViveController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"WebVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"WindowsMotionController\"]; });\n\n/* harmony import */ var _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Gizmos/index */ \"./Gizmos/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"AxisDragGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"AxisScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"BoundingBoxGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"Gizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"GizmoManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"PlaneRotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"PositionGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"RotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"ScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"LightGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"PlaneDragGizmo\"]; });\n\n/* harmony import */ var _Helpers_index__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Helpers/index */ \"./Helpers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"EnvironmentHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"PhotoDome\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"_forceSceneHelpersToBundle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"VideoDome\"]; });\n\n/* harmony import */ var _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Instrumentation/index */ \"./Instrumentation/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__[\"EngineInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__[\"SceneInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__[\"_TimeToken\"]; });\n\n/* harmony import */ var _Layers_index__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Layers/index */ \"./Layers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"EffectLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"EffectLayerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"GlowLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"HighlightLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"Layer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"LayerSceneComponent\"]; });\n\n/* harmony import */ var _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./LensFlares/index */ \"./LensFlares/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__[\"LensFlare\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__[\"LensFlareSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__[\"LensFlareSystemSceneComponent\"]; });\n\n/* harmony import */ var _Lights_index__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Lights/index */ \"./Lights/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"Light\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"ShadowLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"DirectionalLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"HemisphericLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"PointLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"SpotLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"ShadowGenerator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"ShadowGeneratorSceneComponent\"]; });\n\n/* harmony import */ var _Loading_index__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Loading/index */ \"./Loading/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"DefaultLoadingScreen\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"SceneLoaderProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"SceneLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"SceneLoaderFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"_BabylonLoaderRegistered\"]; });\n\n/* harmony import */ var _Materials_index__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Materials/index */ \"./Materials/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectFallbacks\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"Effect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ImageProcessingConfigurationDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"Material\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaterialHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MultiMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PushMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ShaderMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"StandardMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"StandardMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"BaseTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"CubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"DynamicTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"HDRCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"InternalTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MirrorTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MultiRenderTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RawTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RenderTargetTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"Texture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"UniformBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaterialFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectWrapper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"BackgroundMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRBaseMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRSpecularGlossinessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorGradingTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RawCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RawTexture3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RefractionTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VideoTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"HtmlElementTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_BasisTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _Maths_index__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Maths/index */ \"./Maths/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Scalar\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Axis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"TmpColors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Epsilon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Frustum\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Curve3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Plane\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Size\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"TmpVectors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Viewport\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"SphericalHarmonics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"SphericalPolynomial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony import */ var _Meshes_index__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Meshes/index */ \"./Meshes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"AbstractMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Buffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"VertexBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"CSG\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Geometry\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"GroundMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TrailMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"InstancedMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"LinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"InstancedLinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"_CreationDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"_InstancesBatch\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Mesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"VertexData\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"MeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplificationSettings\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplificationQueue\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplificationType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplicationQueueSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Polygon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PolygonMeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"BaseSubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"MeshLODLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TransformNode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"BoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"CylinderBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TorusBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"LinesBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"GroundBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"WebGLDataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DracoCompression\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TiledBoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DiscBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"RibbonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"HemisphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TorusKnotBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PolygonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"ShapeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"LatheBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TiledPlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TubeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PolyhedronBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"IcoSphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DecalBuilder\"]; });\n\n/* harmony import */ var _Morph_index__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Morph/index */ \"./Morph/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return _Morph_index__WEBPACK_IMPORTED_MODULE_24__[\"MorphTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return _Morph_index__WEBPACK_IMPORTED_MODULE_24__[\"MorphTargetManager\"]; });\n\n/* harmony import */ var _Navigation_index__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Navigation/index */ \"./Navigation/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _Navigation_index__WEBPACK_IMPORTED_MODULE_25__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _Navigation_index__WEBPACK_IMPORTED_MODULE_25__[\"RecastJSCrowd\"]; });\n\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./node */ \"./node.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Node\", function() { return _node__WEBPACK_IMPORTED_MODULE_26__[\"Node\"]; });\n\n/* harmony import */ var _Offline_index__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Offline/index */ \"./Offline/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return _Offline_index__WEBPACK_IMPORTED_MODULE_27__[\"Database\"]; });\n\n/* harmony import */ var _Particles_index__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Particles/index */ \"./Particles/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"BaseParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"GPUParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"Particle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ParticleHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"_IDoNeedToBeInTheBuild\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ParticleSystemSet\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SolidParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ModelShape\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"DepthSortedParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SolidParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SubEmitterType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SubEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"BoxParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ConeParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"PointParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SphereDirectedParticleEmitter\"]; });\n\n/* harmony import */ var _Physics_index__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Physics/index */ \"./Physics/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsEngineSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsRadialExplosionEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsUpdraftEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsVortexEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsRadialImpulseFalloff\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsUpdraftMode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsImpostor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"DistanceJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"MotorEnabledJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"HingeJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"Hinge2Joint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"CannonJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"AmmoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"OimoJSPlugin\"]; });\n\n/* harmony import */ var _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./PostProcesses/index */ \"./PostProcesses/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"AnaglyphPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BlackAndWhitePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BloomEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BloomMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ChromaticAberrationPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"CircleOfConfusionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ColorCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ConvolutionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldEffectBlurLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldMergePostProcessOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DisplayPassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ExtractHighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"FilterPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"FxaaPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"GrainPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"HighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ImageProcessingPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"MotionBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PassCubePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"RefractionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"SharpenPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"StereoscopicInterlacePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"TonemappingOperator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"TonemapPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"VolumetricLightScatteringPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"VRDistortionCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"VRMultiviewToSingleviewPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"StandardRenderingPipeline\"]; });\n\n/* harmony import */ var _Probes_index__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Probes/index */ \"./Probes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return _Probes_index__WEBPACK_IMPORTED_MODULE_31__[\"ReflectionProbe\"]; });\n\n/* harmony import */ var _Rendering_index__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./Rendering/index */ \"./Rendering/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"BoundingBoxRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"DepthRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"DepthRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"EdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"LineEdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"GeometryBufferRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"GeometryBufferRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"OutlineRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"RenderingGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"RenderingGroupInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"RenderingManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"UtilityLayerRenderer\"]; });\n\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./scene */ \"./scene.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scene\", function() { return _scene__WEBPACK_IMPORTED_MODULE_33__[\"Scene\"]; });\n\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./sceneComponent */ \"./sceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneComponentConstants\", function() { return _sceneComponent__WEBPACK_IMPORTED_MODULE_34__[\"SceneComponentConstants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Stage\", function() { return _sceneComponent__WEBPACK_IMPORTED_MODULE_34__[\"Stage\"]; });\n\n/* harmony import */ var _Sprites_index__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./Sprites/index */ \"./Sprites/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"Sprite\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"SpriteManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"SpritePackedManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"SpriteSceneComponent\"]; });\n\n/* harmony import */ var _States_index__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./States/index */ \"./States/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _States_index__WEBPACK_IMPORTED_MODULE_36__[\"_AlphaState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _States_index__WEBPACK_IMPORTED_MODULE_36__[\"_DepthCullingState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _States_index__WEBPACK_IMPORTED_MODULE_36__[\"_StencilState\"]; });\n\n/* harmony import */ var _Misc_index__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./Misc/index */ \"./Misc/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AndOrNotEvaluator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AssetTaskState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AbstractAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AssetsProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MeshAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"BinaryFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ImageAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"CubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"HDRCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"EquiRectangularCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AssetsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"DDSTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"expandToProperty\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serialize\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsColor3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsFresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsVector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsVector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsMeshReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsColor4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsQuaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsMatrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsCameraReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SerializationHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Deferred\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"EnvironmentTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MeshExploder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"FilesInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"KhronosTextureContainer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"EventState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Observer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MultiObserver\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Observable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PerformanceMonitor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RollingAverage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PromisePolyfill\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextureOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"HardwareScalingOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ShadowsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PostProcessesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"LensFlaresOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"CustomOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ParticlesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RenderTargetsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MergeMeshesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneOptimizerOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneSerializer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SmartArray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SmartArrayNoDuplicate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"StringDictionary\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Tags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TGATools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Tools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"className\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AsyncLoop\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"VideoRecorder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"JoystickAxis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"VirtualJoystick\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"WorkerPool\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Logger\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"_TypeStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"FilesInputStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"DeepCopier\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PivotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PrecisionDate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ScreenshotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"WebRequest\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"InspectableType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"BRDFTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RGBDTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ColorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Color3Gradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"FactorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"GradientHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PerfCounter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RetryStrategy\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"LoadFileError\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"HDRTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PanoramaToCubeMapTools\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./node.ts\":\n/*!*****************!*\\\n !*** ./node.ts ***!\n \\*****************/\n/*! exports provided: Node */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Node\", function() { return Node; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Node is the basic class for all scene objects (Mesh, Light, Camera.)\r\n */\r\nvar Node = /** @class */ (function () {\r\n /**\r\n * Creates a new Node\r\n * @param name the name and id to be given to this node\r\n * @param scene the scene this node will be added to\r\n * @param addToRootNodes the node will be added to scene.rootNodes\r\n */\r\n function Node(name, scene, addToRootNodes) {\r\n if (scene === void 0) { scene = null; }\r\n if (addToRootNodes === void 0) { addToRootNodes = true; }\r\n /**\r\n * Gets or sets a string used to store user defined state for the node\r\n */\r\n this.state = \"\";\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n /**\r\n * Gets or sets a boolean used to define if the node must be serialized\r\n */\r\n this.doNotSerialize = false;\r\n /** @hidden */\r\n this._isDisposed = false;\r\n /**\r\n * Gets a list of Animations associated with the node\r\n */\r\n this.animations = new Array();\r\n this._ranges = {};\r\n /**\r\n * Callback raised when the node is ready to be used\r\n */\r\n this.onReady = null;\r\n this._isEnabled = true;\r\n this._isParentEnabled = true;\r\n this._isReady = true;\r\n /** @hidden */\r\n this._currentRenderId = -1;\r\n this._parentUpdateId = -1;\r\n /** @hidden */\r\n this._childUpdateId = -1;\r\n /** @hidden */\r\n this._waitingParentId = null;\r\n /** @hidden */\r\n this._cache = {};\r\n this._parentNode = null;\r\n this._children = null;\r\n /** @hidden */\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n /** @hidden */\r\n this._worldMatrixDeterminant = 0;\r\n /** @hidden */\r\n this._worldMatrixDeterminantIsDirty = true;\r\n /** @hidden */\r\n this._sceneRootNodesIndex = -1;\r\n this._animationPropertiesOverride = null;\r\n /** @hidden */\r\n this._isNode = true;\r\n /**\r\n * An event triggered when the mesh is disposed\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n this._onDisposeObserver = null;\r\n // Behaviors\r\n this._behaviors = new Array();\r\n this.name = name;\r\n this.id = name;\r\n this._scene = (scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene);\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._initCache();\r\n if (addToRootNodes) {\r\n this.addToSceneRootNodes();\r\n }\r\n }\r\n /**\r\n * Add a new node constructor\r\n * @param type defines the type name of the node to construct\r\n * @param constructorFunc defines the constructor function\r\n */\r\n Node.AddNodeConstructor = function (type, constructorFunc) {\r\n this._NodeConstructors[type] = constructorFunc;\r\n };\r\n /**\r\n * Returns a node constructor based on type name\r\n * @param type defines the type name\r\n * @param name defines the new node name\r\n * @param scene defines the hosting scene\r\n * @param options defines optional options to transmit to constructors\r\n * @returns the new constructor or null\r\n */\r\n Node.Construct = function (type, name, scene, options) {\r\n var constructorFunc = this._NodeConstructors[type];\r\n if (!constructorFunc) {\r\n return null;\r\n }\r\n return constructorFunc(name, scene, options);\r\n };\r\n /**\r\n * Gets a boolean indicating if the node has been disposed\r\n * @returns true if the node was disposed\r\n */\r\n Node.prototype.isDisposed = function () {\r\n return this._isDisposed;\r\n };\r\n Object.defineProperty(Node.prototype, \"parent\", {\r\n get: function () {\r\n return this._parentNode;\r\n },\r\n /**\r\n * Gets or sets the parent of the node (without keeping the current position in the scene)\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n */\r\n set: function (parent) {\r\n if (this._parentNode === parent) {\r\n return;\r\n }\r\n var previousParentNode = this._parentNode;\r\n // Remove self from list of children of parent\r\n if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {\r\n var index = this._parentNode._children.indexOf(this);\r\n if (index !== -1) {\r\n this._parentNode._children.splice(index, 1);\r\n }\r\n if (!parent && !this._isDisposed) {\r\n this.addToSceneRootNodes();\r\n }\r\n }\r\n // Store new parent\r\n this._parentNode = parent;\r\n // Add as child to new parent\r\n if (this._parentNode) {\r\n if (this._parentNode._children === undefined || this._parentNode._children === null) {\r\n this._parentNode._children = new Array();\r\n }\r\n this._parentNode._children.push(this);\r\n if (!previousParentNode) {\r\n this.removeFromSceneRootNodes();\r\n }\r\n }\r\n // Enabled state\r\n this._syncParentEnabledState();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Node.prototype.addToSceneRootNodes = function () {\r\n if (this._sceneRootNodesIndex === -1) {\r\n this._sceneRootNodesIndex = this._scene.rootNodes.length;\r\n this._scene.rootNodes.push(this);\r\n }\r\n };\r\n Node.prototype.removeFromSceneRootNodes = function () {\r\n if (this._sceneRootNodesIndex !== -1) {\r\n var rootNodes = this._scene.rootNodes;\r\n var lastIdx = rootNodes.length - 1;\r\n rootNodes[this._sceneRootNodesIndex] = rootNodes[lastIdx];\r\n rootNodes[this._sceneRootNodesIndex]._sceneRootNodesIndex = this._sceneRootNodesIndex;\r\n this._scene.rootNodes.pop();\r\n this._sceneRootNodesIndex = -1;\r\n }\r\n };\r\n Object.defineProperty(Node.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"Node\" string\r\n */\r\n Node.prototype.getClassName = function () {\r\n return \"Node\";\r\n };\r\n Object.defineProperty(Node.prototype, \"onDispose\", {\r\n /**\r\n * Sets a callback that will be raised when the node will be disposed\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the scene of the node\r\n * @returns a scene\r\n */\r\n Node.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Gets the engine of the node\r\n * @returns a Engine\r\n */\r\n Node.prototype.getEngine = function () {\r\n return this._scene.getEngine();\r\n };\r\n /**\r\n * Attach a behavior to the node\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @param attachImmediately defines that the behavior must be attached even if the scene is still loading\r\n * @returns the current Node\r\n */\r\n Node.prototype.addBehavior = function (behavior, attachImmediately) {\r\n var _this = this;\r\n if (attachImmediately === void 0) { attachImmediately = false; }\r\n var index = this._behaviors.indexOf(behavior);\r\n if (index !== -1) {\r\n return this;\r\n }\r\n behavior.init();\r\n if (this._scene.isLoading && !attachImmediately) {\r\n // We defer the attach when the scene will be loaded\r\n this._scene.onDataLoadedObservable.addOnce(function () {\r\n behavior.attach(_this);\r\n });\r\n }\r\n else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n return this;\r\n };\r\n /**\r\n * Remove an attached behavior\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @returns the current Node\r\n */\r\n Node.prototype.removeBehavior = function (behavior) {\r\n var index = this._behaviors.indexOf(behavior);\r\n if (index === -1) {\r\n return this;\r\n }\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n return this;\r\n };\r\n Object.defineProperty(Node.prototype, \"behaviors\", {\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n */\r\n get: function () {\r\n return this._behaviors;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n Node.prototype.getBehaviorByName = function (name) {\r\n for (var _i = 0, _a = this._behaviors; _i < _a.length; _i++) {\r\n var behavior = _a[_i];\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Returns the latest update of the World matrix\r\n * @returns a Matrix\r\n */\r\n Node.prototype.getWorldMatrix = function () {\r\n if (this._currentRenderId !== this._scene.getRenderId()) {\r\n this.computeWorldMatrix();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n Node.prototype._getWorldMatrixDeterminant = function () {\r\n if (this._worldMatrixDeterminantIsDirty) {\r\n this._worldMatrixDeterminantIsDirty = false;\r\n this._worldMatrixDeterminant = this._worldMatrix.determinant();\r\n }\r\n return this._worldMatrixDeterminant;\r\n };\r\n Object.defineProperty(Node.prototype, \"worldMatrixFromCache\", {\r\n /**\r\n * Returns directly the latest state of the mesh World matrix.\r\n * A Matrix is returned.\r\n */\r\n get: function () {\r\n return this._worldMatrix;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method\r\n /** @hidden */\r\n Node.prototype._initCache = function () {\r\n this._cache = {};\r\n this._cache.parent = undefined;\r\n };\r\n /** @hidden */\r\n Node.prototype.updateCache = function (force) {\r\n if (!force && this.isSynchronized()) {\r\n return;\r\n }\r\n this._cache.parent = this.parent;\r\n this._updateCache();\r\n };\r\n /** @hidden */\r\n Node.prototype._getActionManagerForTrigger = function (trigger, initialCall) {\r\n if (initialCall === void 0) { initialCall = true; }\r\n if (!this.parent) {\r\n return null;\r\n }\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n };\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method if !ignoreParentClass\r\n /** @hidden */\r\n Node.prototype._updateCache = function (ignoreParentClass) {\r\n };\r\n // override it in derived class if you add new variables to the cache\r\n /** @hidden */\r\n Node.prototype._isSynchronized = function () {\r\n return true;\r\n };\r\n /** @hidden */\r\n Node.prototype._markSyncedWithParent = function () {\r\n if (this._parentNode) {\r\n this._parentUpdateId = this._parentNode._childUpdateId;\r\n }\r\n };\r\n /** @hidden */\r\n Node.prototype.isSynchronizedWithParent = function () {\r\n if (!this._parentNode) {\r\n return true;\r\n }\r\n if (this._parentUpdateId !== this._parentNode._childUpdateId) {\r\n return false;\r\n }\r\n return this._parentNode.isSynchronized();\r\n };\r\n /** @hidden */\r\n Node.prototype.isSynchronized = function () {\r\n if (this._cache.parent != this._parentNode) {\r\n this._cache.parent = this._parentNode;\r\n return false;\r\n }\r\n if (this._parentNode && !this.isSynchronizedWithParent()) {\r\n return false;\r\n }\r\n return this._isSynchronized();\r\n };\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return true if the node is ready\r\n */\r\n Node.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n return this._isReady;\r\n };\r\n /**\r\n * Is this node enabled?\r\n * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true\r\n * @param checkAncestors indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors\r\n * @return whether this node (and its parent) is enabled\r\n */\r\n Node.prototype.isEnabled = function (checkAncestors) {\r\n if (checkAncestors === void 0) { checkAncestors = true; }\r\n if (checkAncestors === false) {\r\n return this._isEnabled;\r\n }\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n return this._isParentEnabled;\r\n };\r\n /** @hidden */\r\n Node.prototype._syncParentEnabledState = function () {\r\n this._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;\r\n if (this._children) {\r\n this._children.forEach(function (c) {\r\n c._syncParentEnabledState(); // Force children to update accordingly\r\n });\r\n }\r\n };\r\n /**\r\n * Set the enabled state of this node\r\n * @param value defines the new enabled state\r\n */\r\n Node.prototype.setEnabled = function (value) {\r\n this._isEnabled = value;\r\n this._syncParentEnabledState();\r\n };\r\n /**\r\n * Is this node a descendant of the given node?\r\n * The function will iterate up the hierarchy until the ancestor was found or no more parents defined\r\n * @param ancestor defines the parent node to inspect\r\n * @returns a boolean indicating if this node is a descendant of the given node\r\n */\r\n Node.prototype.isDescendantOf = function (ancestor) {\r\n if (this.parent) {\r\n if (this.parent === ancestor) {\r\n return true;\r\n }\r\n return this.parent.isDescendantOf(ancestor);\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n Node.prototype._getDescendants = function (results, directDescendantsOnly, predicate) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }\r\n if (!this._children) {\r\n return;\r\n }\r\n for (var index = 0; index < this._children.length; index++) {\r\n var item = this._children[index];\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n if (!directDescendantsOnly) {\r\n item._getDescendants(results, false, predicate);\r\n }\r\n }\r\n };\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n Node.prototype.getDescendants = function (directDescendantsOnly, predicate) {\r\n var results = new Array();\r\n this._getDescendants(results, directDescendantsOnly, predicate);\r\n return results;\r\n };\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n Node.prototype.getChildMeshes = function (directDescendantsOnly, predicate) {\r\n var results = [];\r\n this._getDescendants(results, directDescendantsOnly, function (node) {\r\n return ((!predicate || predicate(node)) && (node.cullingStrategy !== undefined));\r\n });\r\n return results;\r\n };\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n Node.prototype.getChildren = function (predicate, directDescendantsOnly) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = true; }\r\n return this.getDescendants(directDescendantsOnly, predicate);\r\n };\r\n /** @hidden */\r\n Node.prototype._setReady = function (state) {\r\n if (state === this._isReady) {\r\n return;\r\n }\r\n if (!state) {\r\n this._isReady = false;\r\n return;\r\n }\r\n if (this.onReady) {\r\n this.onReady(this);\r\n }\r\n this._isReady = true;\r\n };\r\n /**\r\n * Get an animation by name\r\n * @param name defines the name of the animation to look for\r\n * @returns null if not found else the requested animation\r\n */\r\n Node.prototype.getAnimationByName = function (name) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n var animation = this.animations[i];\r\n if (animation.name === name) {\r\n return animation;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Creates an animation range for this node\r\n * @param name defines the name of the range\r\n * @param from defines the starting key\r\n * @param to defines the end key\r\n */\r\n Node.prototype.createAnimationRange = function (name, from, to) {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = Node._AnimationRangeFactory(name, from, to);\r\n for (var i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range to delete\r\n * @param deleteFrames defines if animation frames from the range must be deleted as well\r\n */\r\n Node.prototype.deleteAnimationRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n for (var i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Get an animation range by name\r\n * @param name defines the name of the animation range to look for\r\n * @returns null if not found else the requested animation range\r\n */\r\n Node.prototype.getAnimationRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the list of all animation ranges defined on this node\r\n * @returns an array\r\n */\r\n Node.prototype.getAnimationRanges = function () {\r\n var animationRanges = [];\r\n var name;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n };\r\n /**\r\n * Will start the animation sequence\r\n * @param name defines the range frames for animation sequence\r\n * @param loop defines if the animation should loop (false by default)\r\n * @param speedRatio defines the speed factor in which to run the animation (1 by default)\r\n * @param onAnimationEnd defines a function to be executed when the animation ended (undefined by default)\r\n * @returns the object created for this animation. If range does not exist, it will return null\r\n */\r\n Node.prototype.beginAnimation = function (name, loop, speedRatio, onAnimationEnd) {\r\n var range = this.getAnimationRange(name);\r\n if (!range) {\r\n return null;\r\n }\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n };\r\n /**\r\n * Serialize animation ranges into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n Node.prototype.serializeAnimationRanges = function () {\r\n var serializationRanges = [];\r\n for (var name in this._ranges) {\r\n var localRange = this._ranges[name];\r\n if (!localRange) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = localRange.from;\r\n range.to = localRange.to;\r\n serializationRanges.push(range);\r\n }\r\n return serializationRanges;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n Node.prototype.computeWorldMatrix = function (force) {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Node.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this._isDisposed = true;\r\n if (!doNotRecurse) {\r\n var nodes = this.getDescendants(true);\r\n for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\r\n var node = nodes_1[_i];\r\n node.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n }\r\n if (!this.parent) {\r\n this.removeFromSceneRootNodes();\r\n }\r\n else {\r\n this.parent = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n // Behaviors\r\n for (var _a = 0, _b = this._behaviors; _a < _b.length; _a++) {\r\n var behavior = _b[_a];\r\n behavior.detach();\r\n }\r\n this._behaviors = [];\r\n };\r\n /**\r\n * Parse animation range data from a serialization object and store them into a given node\r\n * @param node defines where to store the animation ranges\r\n * @param parsedNode defines the serialization object to read data from\r\n * @param scene defines the hosting scene\r\n */\r\n Node.ParseAnimationRanges = function (node, parsedNode, scene) {\r\n if (parsedNode.ranges) {\r\n for (var index = 0; index < parsedNode.ranges.length; index++) {\r\n var data = parsedNode.ranges[index];\r\n node.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n };\r\n /**\r\n * Return the minimum and maximum world vectors of the entire hierarchy under current node\r\n * @param includeDescendants Include bounding info from descendants as well (true by default)\r\n * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors\r\n * @returns the new bounding vectors\r\n */\r\n Node.prototype.getHierarchyBoundingVectors = function (includeDescendants, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (predicate === void 0) { predicate = null; }\r\n // Ensures that all world matrix will be recomputed.\r\n this.getScene().incrementRenderId();\r\n this.computeWorldMatrix(true);\r\n var min;\r\n var max;\r\n var thisAbstractMesh = this;\r\n if (thisAbstractMesh.getBoundingInfo && thisAbstractMesh.subMeshes) {\r\n // If this is an abstract mesh get its bounding info\r\n var boundingInfo = thisAbstractMesh.getBoundingInfo();\r\n min = boundingInfo.boundingBox.minimumWorld.clone();\r\n max = boundingInfo.boundingBox.maximumWorld.clone();\r\n }\r\n else {\r\n min = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n max = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n }\r\n if (includeDescendants) {\r\n var descendants = this.getDescendants(false);\r\n for (var _i = 0, descendants_1 = descendants; _i < descendants_1.length; _i++) {\r\n var descendant = descendants_1[_i];\r\n var childMesh = descendant;\r\n childMesh.computeWorldMatrix(true);\r\n // Filters meshes based on custom predicate function.\r\n if (predicate && !predicate(childMesh)) {\r\n continue;\r\n }\r\n //make sure we have the needed params to get mix and max\r\n if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {\r\n continue;\r\n }\r\n var childBoundingInfo = childMesh.getBoundingInfo();\r\n var boundingBox = childBoundingInfo.boundingBox;\r\n var minBox = boundingBox.minimumWorld;\r\n var maxBox = boundingBox.maximumWorld;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CheckExtends(minBox, min, max);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CheckExtends(maxBox, min, max);\r\n }\r\n }\r\n return {\r\n min: min,\r\n max: max\r\n };\r\n };\r\n /** @hidden */\r\n Node._AnimationRangeFactory = function (name, from, to) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"AnimationRange\");\r\n };\r\n Node._NodeConstructors = {};\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"id\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"uniqueId\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"state\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"metadata\", void 0);\r\n return Node;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./scene.ts\":\n/*!******************!*\\\n !*** ./scene.ts ***!\n \\******************/\n/*! exports provided: Scene */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Scene\", function() { return Scene; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Misc/stringDictionary */ \"./Misc/stringDictionary.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Materials/uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Actions/actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony import */ var _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./PostProcesses/postProcessManager */ \"./PostProcesses/postProcessManager.ts\");\n/* harmony import */ var _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Rendering/renderingManager */ \"./Rendering/renderingManager.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Inputs/scene.inputManager */ \"./Inputs/scene.inputManager.ts\");\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Maths/math.frustum */ \"./Maths/math.frustum.ts\");\n/* harmony import */ var _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Misc/uniqueIdGenerator */ \"./Misc/uniqueIdGenerator.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Represents a scene to be rendered by the engine.\r\n * @see http://doc.babylonjs.com/features/scene\r\n */\r\nvar Scene = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Scene, _super);\r\n /**\r\n * Creates a new Scene\r\n * @param engine defines the engine to use to render this scene\r\n * @param options defines the scene options\r\n */\r\n function Scene(engine, options) {\r\n var _this = _super.call(this) || this;\r\n // Members\r\n /** @hidden */\r\n _this._inputManager = new _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"](_this);\r\n /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */\r\n _this.cameraToUseForPointers = null;\r\n /** @hidden */\r\n _this._isScene = true;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame\r\n */\r\n _this.autoClear = true;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame\r\n */\r\n _this.autoClearDepthAndStencil = true;\r\n /**\r\n * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))\r\n */\r\n _this.clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__[\"Color4\"](0.2, 0.2, 0.3, 1.0);\r\n /**\r\n * Defines the color used to simulate the ambient color (Default is (0, 0, 0))\r\n */\r\n _this.ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__[\"Color3\"](0, 0, 0);\r\n /** @hidden */\r\n _this._environmentIntensity = 1;\r\n _this._forceWireframe = false;\r\n _this._forcePointsCloud = false;\r\n /**\r\n * Gets or sets a boolean indicating if animations are enabled\r\n */\r\n _this.animationsEnabled = true;\r\n _this._animationPropertiesOverride = null;\r\n /**\r\n * Gets or sets a boolean indicating if a constant deltatime has to be used\r\n * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate\r\n */\r\n _this.useConstantAnimationDeltaTime = false;\r\n /**\r\n * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated\r\n * Please note that it requires to run a ray cast through the scene on every frame\r\n */\r\n _this.constantlyUpdateMeshUnderPointer = false;\r\n /**\r\n * Defines the HTML cursor to use when hovering over interactive elements\r\n */\r\n _this.hoverCursor = \"pointer\";\r\n /**\r\n * Defines the HTML default cursor to use (empty by default)\r\n */\r\n _this.defaultCursor = \"\";\r\n /**\r\n * This is used to call preventDefault() on pointer down\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerDown = true;\r\n /**\r\n * This is used to call preventDefault() on pointer up\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerUp = true;\r\n // Metadata\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n _this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n _this.reservedDataStore = null;\r\n /**\r\n * Use this array to add regular expressions used to disable offline support for specific urls\r\n */\r\n _this.disableOfflineSupportExceptionRules = new Array();\r\n /**\r\n * An event triggered when the scene is disposed.\r\n */\r\n _this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onDisposeObserver = null;\r\n /**\r\n * An event triggered before rendering the scene (right after animations and physics)\r\n */\r\n _this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onBeforeRenderObserver = null;\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n _this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera)\r\n */\r\n _this.onAfterRenderCameraObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onAfterRenderObserver = null;\r\n /**\r\n * An event triggered before animating the scene\r\n */\r\n _this.onBeforeAnimationsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after animations processing\r\n */\r\n _this.onAfterAnimationsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered before draw calls are ready to be sent\r\n */\r\n _this.onBeforeDrawPhaseObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after draw calls have been sent\r\n */\r\n _this.onAfterDrawPhaseObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the scene is ready\r\n */\r\n _this.onReadyObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering a camera\r\n */\r\n _this.onBeforeCameraRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onBeforeCameraRenderObserver = null;\r\n /**\r\n * An event triggered after rendering a camera\r\n */\r\n _this.onAfterCameraRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onAfterCameraRenderObserver = null;\r\n /**\r\n * An event triggered when active meshes evaluation is about to start\r\n */\r\n _this.onBeforeActiveMeshesEvaluationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when active meshes evaluation is done\r\n */\r\n _this.onAfterActiveMeshesEvaluationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when particles rendering is about to start\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onBeforeParticlesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when particles rendering is done\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onAfterParticlesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed\r\n */\r\n _this.onDataLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a camera is created\r\n */\r\n _this.onNewCameraAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a camera is removed\r\n */\r\n _this.onCameraRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a light is created\r\n */\r\n _this.onNewLightAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a light is removed\r\n */\r\n _this.onLightRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a geometry is created\r\n */\r\n _this.onNewGeometryAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a geometry is removed\r\n */\r\n _this.onGeometryRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a transform node is created\r\n */\r\n _this.onNewTransformNodeAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a transform node is removed\r\n */\r\n _this.onTransformNodeRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a mesh is created\r\n */\r\n _this.onNewMeshAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a mesh is removed\r\n */\r\n _this.onMeshRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a skeleton is created\r\n */\r\n _this.onNewSkeletonAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a skeleton is removed\r\n */\r\n _this.onSkeletonRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a material is created\r\n */\r\n _this.onNewMaterialAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a material is removed\r\n */\r\n _this.onMaterialRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a texture is created\r\n */\r\n _this.onNewTextureAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a texture is removed\r\n */\r\n _this.onTextureRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when render targets are about to be rendered\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onBeforeRenderTargetsRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when render targets were rendered.\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onAfterRenderTargetsRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered before calculating deterministic simulation step\r\n */\r\n _this.onBeforeStepObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after calculating deterministic simulation step\r\n */\r\n _this.onAfterStepObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the activeCamera property is updated\r\n */\r\n _this.onActiveCameraChanged = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * This Observable will be triggered before rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onBeforeRenderingGroupObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * This Observable will be triggered after rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onAfterRenderingGroupObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * This Observable will when a mesh has been imported into the scene.\r\n */\r\n _this.onMeshImportedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n // Animations\r\n /** @hidden */\r\n _this._registeredForLateAnimationBindings = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](256);\r\n /**\r\n * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).\r\n * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPrePointerObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time an input event is received from the rendering canvas\r\n */\r\n _this.onPointerObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n // Keyboard\r\n /**\r\n * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()\r\n * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPreKeyboardObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time an keyboard event is received from the hosting window\r\n */\r\n _this.onKeyboardObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n // Coordinates system\r\n _this._useRightHandedSystem = false;\r\n // Deterministic lockstep\r\n _this._timeAccumulator = 0;\r\n _this._currentStepId = 0;\r\n _this._currentInternalStep = 0;\r\n // Fog\r\n _this._fogEnabled = true;\r\n _this._fogMode = Scene.FOGMODE_NONE;\r\n /**\r\n * Gets or sets the fog color to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is Color3(0.2, 0.2, 0.3))\r\n */\r\n _this.fogColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__[\"Color3\"](0.2, 0.2, 0.3);\r\n /**\r\n * Gets or sets the fog density to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0.1)\r\n */\r\n _this.fogDensity = 0.1;\r\n /**\r\n * Gets or sets the fog start distance to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0)\r\n */\r\n _this.fogStart = 0;\r\n /**\r\n * Gets or sets the fog end distance to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 1000)\r\n */\r\n _this.fogEnd = 1000.0;\r\n // Lights\r\n _this._shadowsEnabled = true;\r\n _this._lightsEnabled = true;\r\n /** All of the active cameras added to this scene. */\r\n _this.activeCameras = new Array();\r\n // Textures\r\n _this._texturesEnabled = true;\r\n // Particles\r\n /**\r\n * Gets or sets a boolean indicating if particles are enabled on this scene\r\n */\r\n _this.particlesEnabled = true;\r\n // Sprites\r\n /**\r\n * Gets or sets a boolean indicating if sprites are enabled on this scene\r\n */\r\n _this.spritesEnabled = true;\r\n // Skeletons\r\n _this._skeletonsEnabled = true;\r\n // Lens flares\r\n /**\r\n * Gets or sets a boolean indicating if lens flares are enabled on this scene\r\n */\r\n _this.lensFlaresEnabled = true;\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating if collisions are enabled on this scene\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.collisionsEnabled = true;\r\n /**\r\n * Defines the gravity applied to this scene (used only for collisions)\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.gravity = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"](0, -9.807, 0);\r\n // Postprocesses\r\n /**\r\n * Gets or sets a boolean indicating if postprocesses are enabled on this scene\r\n */\r\n _this.postProcessesEnabled = true;\r\n /**\r\n * The list of postprocesses added to the scene\r\n */\r\n _this.postProcesses = new Array();\r\n // Customs render targets\r\n /**\r\n * Gets or sets a boolean indicating if render targets are enabled on this scene\r\n */\r\n _this.renderTargetsEnabled = true;\r\n /**\r\n * Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes\r\n * We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com\r\n */\r\n _this.dumpNextRenderTargets = false;\r\n /**\r\n * The list of user defined render targets added to the scene\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * Gets the list of meshes imported to the scene through SceneLoader\r\n */\r\n _this.importedMeshesFiles = new Array();\r\n // Probes\r\n /**\r\n * Gets or sets a boolean indicating if probes are enabled on this scene\r\n */\r\n _this.probesEnabled = true;\r\n _this._meshesForIntersections = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](256);\r\n // Procedural textures\r\n /**\r\n * Gets or sets a boolean indicating if procedural textures are enabled on this scene\r\n */\r\n _this.proceduralTexturesEnabled = true;\r\n // Performance counters\r\n _this._totalVertices = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._activeIndices = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._activeParticles = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._activeBones = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._animationTime = 0;\r\n /**\r\n * Gets or sets a general scale for animation speed\r\n * @see https://www.babylonjs-playground.com/#IBU2W7#3\r\n */\r\n _this.animationTimeScale = 1;\r\n _this._renderId = 0;\r\n _this._frameId = 0;\r\n _this._executeWhenReadyTimeoutId = -1;\r\n _this._intermediateRendering = false;\r\n _this._viewUpdateFlag = -1;\r\n _this._projectionUpdateFlag = -1;\r\n /** @hidden */\r\n _this._toBeDisposed = new Array(256);\r\n _this._activeRequests = new Array();\r\n /** @hidden */\r\n _this._pendingData = new Array();\r\n _this._isDisposed = false;\r\n /**\r\n * Gets or sets a boolean indicating that all submeshes of active meshes must be rendered\r\n * Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)\r\n */\r\n _this.dispatchAllSubMeshesOfActiveMeshes = false;\r\n _this._activeMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArray\"](256);\r\n _this._processedMaterials = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArray\"](256);\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](256);\r\n /** @hidden */\r\n _this._activeParticleSystems = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArray\"](256);\r\n _this._activeSkeletons = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](32);\r\n _this._softwareSkinnedMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](32);\r\n /** @hidden */\r\n _this._activeAnimatables = new Array();\r\n _this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Matrix\"].Zero();\r\n /**\r\n * Gets or sets a boolean indicating if lights must be sorted by priority (off by default)\r\n * This is useful if there are more lights that the maximum simulteanous authorized\r\n */\r\n _this.requireLightSorting = false;\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._components = [];\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._serializableComponents = [];\r\n /**\r\n * List of components to register on the next registration step.\r\n */\r\n _this._transientComponents = [];\r\n /**\r\n * @hidden\r\n * Defines the actions happening before camera updates.\r\n */\r\n _this._beforeCameraUpdateStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before clear the canvas.\r\n */\r\n _this._beforeClearStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions when collecting render targets for the frame.\r\n */\r\n _this._gatherRenderTargetsStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening for one camera in the frame.\r\n */\r\n _this._gatherActiveCameraRenderTargetsStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per mesh ready checks.\r\n */\r\n _this._isReadyForMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before evaluate active mesh checks.\r\n */\r\n _this._beforeEvaluateActiveMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the evaluate sub mesh checks.\r\n */\r\n _this._evaluateSubMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the active mesh stage.\r\n */\r\n _this._activeMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per camera render target step.\r\n */\r\n _this._cameraDrawRenderTargetStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before the active camera is drawing.\r\n */\r\n _this._beforeCameraDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a render target is drawing.\r\n */\r\n _this._beforeRenderTargetDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a rendering group is drawing.\r\n */\r\n _this._beforeRenderingGroupDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a mesh is drawing.\r\n */\r\n _this._beforeRenderingMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a mesh has been drawn.\r\n */\r\n _this._afterRenderingMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a rendering group has been drawn.\r\n */\r\n _this._afterRenderingGroupDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after the active camera has been drawn.\r\n */\r\n _this._afterCameraDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a render target has been drawn.\r\n */\r\n _this._afterRenderTargetDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after rendering all cameras and computing intersections.\r\n */\r\n _this._afterRenderStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer move event happens.\r\n */\r\n _this._pointerMoveStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer down event happens.\r\n */\r\n _this._pointerDownStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer up event happens.\r\n */\r\n _this._pointerUpStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * an optional map from Geometry Id to Geometry index in the 'geometries' array\r\n */\r\n _this.geometriesByUniqueId = null;\r\n _this._defaultMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._defaultSubMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._preventFreeActiveMeshesAndRenderingGroups = false;\r\n _this._activeMeshesFrozen = false;\r\n /** @hidden */\r\n _this._allowPostProcessClearColor = true;\r\n /**\r\n * User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode\r\n */\r\n _this.getDeterministicFrameTime = function () {\r\n return 1000.0 / 60.0; // frame time in ms\r\n };\r\n _this._blockMaterialDirtyMechanism = false;\r\n _this._engine = engine || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"].LastCreatedEngine;\r\n if (!options || !options.virtual) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"]._LastCreatedScene = _this;\r\n _this._engine.scenes.push(_this);\r\n }\r\n _this._uid = null;\r\n _this._renderingManager = new _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_18__[\"RenderingManager\"](_this);\r\n if (_PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_17__[\"PostProcessManager\"]) {\r\n _this.postProcessManager = new _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_17__[\"PostProcessManager\"](_this);\r\n }\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_21__[\"DomManagement\"].IsWindowObjectExist()) {\r\n _this.attachControl();\r\n }\r\n // Uniform Buffer\r\n _this._createUbo();\r\n // Default Image processing definition\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"ImageProcessingConfiguration\"]) {\r\n _this._imageProcessingConfiguration = new _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"ImageProcessingConfiguration\"]();\r\n }\r\n _this.setDefaultCandidateProviders();\r\n if (options && options.useGeometryUniqueIdsMap === true) {\r\n _this.geometriesByUniqueId = {};\r\n }\r\n _this.useMaterialMeshMap = options && options.useGeometryUniqueIdsMap || false;\r\n _this.useClonedMeshhMap = options && options.useClonedMeshhMap || false;\r\n if (!options || !options.virtual) {\r\n _this._engine.onNewSceneAddedObservable.notifyObservers(_this);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Factory used to create the default material.\r\n * @param name The name of the material to create\r\n * @param scene The scene to create the material for\r\n * @returns The default material\r\n */\r\n Scene.DefaultMaterialFactory = function (scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"StandardMaterial\");\r\n };\r\n /**\r\n * Factory used to create the a collision coordinator.\r\n * @returns The collision coordinator\r\n */\r\n Scene.CollisionCoordinatorFactory = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"DefaultCollisionCoordinator\");\r\n };\r\n Object.defineProperty(Scene.prototype, \"environmentTexture\", {\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentTexture;\r\n },\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentTexture === value) {\r\n return;\r\n }\r\n this._environmentTexture = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"environmentIntensity\", {\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentIntensity;\r\n },\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentIntensity === value) {\r\n return;\r\n }\r\n this._environmentIntensity = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Default image processing configuration used either in the rendering\r\n * Forward main pass or through the imageProcessingPostProcess if present.\r\n * As in the majority of the scene they are the same (exception for multi camera),\r\n * this is easier to reference from here than from all the materials and post process.\r\n *\r\n * No setter as we it is a shared configuration, you can set the values instead.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forceWireframe\", {\r\n get: function () {\r\n return this._forceWireframe;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in wireframe\r\n */\r\n set: function (value) {\r\n if (this._forceWireframe === value) {\r\n return;\r\n }\r\n this._forceWireframe = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forcePointsCloud\", {\r\n get: function () {\r\n return this._forcePointsCloud;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in point cloud\r\n */\r\n set: function (value) {\r\n if (this._forcePointsCloud === value) {\r\n return;\r\n }\r\n this._forcePointsCloud = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"onDispose\", {\r\n /** Sets a function to be executed when this scene is disposed. */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeRender\", {\r\n /** Sets a function to be executed before rendering this scene */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n if (callback) {\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterRender\", {\r\n /** Sets a function to be executed after rendering this scene */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n if (callback) {\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeCameraRender\", {\r\n /** Sets a function to be executed before rendering a camera*/\r\n set: function (callback) {\r\n if (this._onBeforeCameraRenderObserver) {\r\n this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n }\r\n this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterCameraRender\", {\r\n /** Sets a function to be executed after rendering a camera*/\r\n set: function (callback) {\r\n if (this._onAfterCameraRenderObserver) {\r\n this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n }\r\n this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return this._inputManager.unTranslatedPointer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DragMovementThreshold\", {\r\n /**\r\n * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels\r\n */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DragMovementThreshold;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DragMovementThreshold = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"LongPressDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms\r\n */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].LongPressDelay;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].LongPressDelay = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DoubleClickDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms\r\n */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DoubleClickDelay;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DoubleClickDelay = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"ExclusiveDoubleClickMode\", {\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].ExclusiveDoubleClickMode;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].ExclusiveDoubleClickMode = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"useRightHandedSystem\", {\r\n get: function () {\r\n return this._useRightHandedSystem;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if the scene must use right-handed coordinates system\r\n */\r\n set: function (value) {\r\n if (this._useRightHandedSystem === value) {\r\n return;\r\n }\r\n this._useRightHandedSystem = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the step Id used by deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @param newStepId defines the step Id\r\n */\r\n Scene.prototype.setStepId = function (newStepId) {\r\n this._currentStepId = newStepId;\r\n };\r\n /**\r\n * Gets the step Id used by deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the step Id\r\n */\r\n Scene.prototype.getStepId = function () {\r\n return this._currentStepId;\r\n };\r\n /**\r\n * Gets the internal step used by deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the internal step\r\n */\r\n Scene.prototype.getInternalStep = function () {\r\n return this._currentInternalStep;\r\n };\r\n Object.defineProperty(Scene.prototype, \"fogEnabled\", {\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if fog is enabled on this scene\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is true)\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"fogMode\", {\r\n get: function () {\r\n return this._fogMode;\r\n },\r\n /**\r\n * Gets or sets the fog mode to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * | mode | value |\r\n * | --- | --- |\r\n * | FOGMODE_NONE | 0 |\r\n * | FOGMODE_EXP | 1 |\r\n * | FOGMODE_EXP2 | 2 |\r\n * | FOGMODE_LINEAR | 3 |\r\n */\r\n set: function (value) {\r\n if (this._fogMode === value) {\r\n return;\r\n }\r\n this._fogMode = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"shadowsEnabled\", {\r\n get: function () {\r\n return this._shadowsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if shadows are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._shadowsEnabled === value) {\r\n return;\r\n }\r\n this._shadowsEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_LightDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"lightsEnabled\", {\r\n get: function () {\r\n return this._lightsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if lights are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._lightsEnabled === value) {\r\n return;\r\n }\r\n this._lightsEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_LightDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"activeCamera\", {\r\n /** Gets or sets the current active camera */\r\n get: function () {\r\n return this._activeCamera;\r\n },\r\n set: function (value) {\r\n if (value === this._activeCamera) {\r\n return;\r\n }\r\n this._activeCamera = value;\r\n this.onActiveCameraChanged.notifyObservers(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"defaultMaterial\", {\r\n /** The default material used on meshes when no material is affected */\r\n get: function () {\r\n if (!this._defaultMaterial) {\r\n this._defaultMaterial = Scene.DefaultMaterialFactory(this);\r\n }\r\n return this._defaultMaterial;\r\n },\r\n /** The default material used on meshes when no material is affected */\r\n set: function (value) {\r\n this._defaultMaterial = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"texturesEnabled\", {\r\n get: function () {\r\n return this._texturesEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if textures are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._texturesEnabled === value) {\r\n return;\r\n }\r\n this._texturesEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"skeletonsEnabled\", {\r\n get: function () {\r\n return this._skeletonsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if skeletons are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._skeletonsEnabled === value) {\r\n return;\r\n }\r\n this._skeletonsEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_AttributesDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"collisionCoordinator\", {\r\n /** @hidden */\r\n get: function () {\r\n if (!this._collisionCoordinator) {\r\n this._collisionCoordinator = Scene.CollisionCoordinatorFactory();\r\n this._collisionCoordinator.init(this);\r\n }\r\n return this._collisionCoordinator;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"frustumPlanes\", {\r\n /**\r\n * Gets the list of frustum planes (built from the active camera)\r\n */\r\n get: function () {\r\n return this._frustumPlanes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers the transient components if needed.\r\n */\r\n Scene.prototype._registerTransientComponents = function () {\r\n // Register components that have been associated lately to the scene.\r\n if (this._transientComponents.length > 0) {\r\n for (var _i = 0, _a = this._transientComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.register();\r\n }\r\n this._transientComponents = [];\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Add a component to the scene.\r\n * Note that the ccomponent could be registered on th next frame if this is called after\r\n * the register component stage.\r\n * @param component Defines the component to add to the scene\r\n */\r\n Scene.prototype._addComponent = function (component) {\r\n this._components.push(component);\r\n this._transientComponents.push(component);\r\n var serializableComponent = component;\r\n if (serializableComponent.addFromContainer && serializableComponent.serialize) {\r\n this._serializableComponents.push(serializableComponent);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Gets a component from the scene.\r\n * @param name defines the name of the component to retrieve\r\n * @returns the component or null if not present\r\n */\r\n Scene.prototype._getComponent = function (name) {\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n if (component.name === name) {\r\n return component;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"Scene\" string\r\n */\r\n Scene.prototype.getClassName = function () {\r\n return \"Scene\";\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultMeshCandidates = function () {\r\n this._defaultMeshCandidates.data = this.meshes;\r\n this._defaultMeshCandidates.length = this.meshes.length;\r\n return this._defaultMeshCandidates;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultSubMeshCandidates = function (mesh) {\r\n this._defaultSubMeshCandidates.data = mesh.subMeshes;\r\n this._defaultSubMeshCandidates.length = mesh.subMeshes.length;\r\n return this._defaultSubMeshCandidates;\r\n };\r\n /**\r\n * Sets the default candidate providers for the scene.\r\n * This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates\r\n * and getCollidingSubMeshCandidates to their default function\r\n */\r\n Scene.prototype.setDefaultCandidateProviders = function () {\r\n this.getActiveMeshCandidates = this._getDefaultMeshCandidates.bind(this);\r\n this.getActiveSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getIntersectingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getCollidingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n };\r\n Object.defineProperty(Scene.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.meshUnderPointer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerX;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerX = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerY;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the cached material (ie. the latest rendered one)\r\n * @returns the cached material\r\n */\r\n Scene.prototype.getCachedMaterial = function () {\r\n return this._cachedMaterial;\r\n };\r\n /**\r\n * Gets the cached effect (ie. the latest rendered one)\r\n * @returns the cached effect\r\n */\r\n Scene.prototype.getCachedEffect = function () {\r\n return this._cachedEffect;\r\n };\r\n /**\r\n * Gets the cached visibility state (ie. the latest rendered one)\r\n * @returns the cached visibility state\r\n */\r\n Scene.prototype.getCachedVisibility = function () {\r\n return this._cachedVisibility;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current material / effect / visibility must be bind again\r\n * @param material defines the current material\r\n * @param effect defines the current effect\r\n * @param visibility defines the current visibility state\r\n * @returns true if one parameter is not cached\r\n */\r\n Scene.prototype.isCachedMaterialInvalid = function (material, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return this._cachedEffect !== effect || this._cachedMaterial !== material || this._cachedVisibility !== visibility;\r\n };\r\n /**\r\n * Gets the engine associated with the scene\r\n * @returns an Engine\r\n */\r\n Scene.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Gets the total number of vertices rendered per frame\r\n * @returns the total number of vertices rendered per frame\r\n */\r\n Scene.prototype.getTotalVertices = function () {\r\n return this._totalVertices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalVerticesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for total vertices\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._totalVertices;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)\r\n * @returns the total number of active indices rendered per frame\r\n */\r\n Scene.prototype.getActiveIndices = function () {\r\n return this._activeIndices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalActiveIndicesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active indices\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeIndices;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active particles rendered per frame\r\n * @returns the total number of active particles rendered per frame\r\n */\r\n Scene.prototype.getActiveParticles = function () {\r\n return this._activeParticles.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeParticlesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active particles\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeParticles;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active bones rendered per frame\r\n * @returns the total number of active bones rendered per frame\r\n */\r\n Scene.prototype.getActiveBones = function () {\r\n return this._activeBones.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeBonesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active bones\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeBones;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the array of active meshes\r\n * @returns an array of AbstractMesh\r\n */\r\n Scene.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)\r\n * @returns a number\r\n */\r\n Scene.prototype.getAnimationRatio = function () {\r\n return this._animationRatio !== undefined ? this._animationRatio : 1;\r\n };\r\n /**\r\n * Gets an unique Id for the current render phase\r\n * @returns a number\r\n */\r\n Scene.prototype.getRenderId = function () {\r\n return this._renderId;\r\n };\r\n /**\r\n * Gets an unique Id for the current frame\r\n * @returns a number\r\n */\r\n Scene.prototype.getFrameId = function () {\r\n return this._frameId;\r\n };\r\n /** Call this function if you want to manually increment the render Id*/\r\n Scene.prototype.incrementRenderId = function () {\r\n this._renderId++;\r\n };\r\n Scene.prototype._createUbo = function () {\r\n this._sceneUbo = new _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_13__[\"UniformBuffer\"](this._engine, undefined, true);\r\n this._sceneUbo.addUniform(\"viewProjection\", 16);\r\n this._sceneUbo.addUniform(\"view\", 16);\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerMove(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerDown(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n this._inputManager.simulatePointerUp(pickResult, pointerEventInit, doubleTap);\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n Scene.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._inputManager.isPointerCaptured(pointerId);\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n */\r\n Scene.prototype.attachControl = function (attachUp, attachDown, attachMove) {\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n this._inputManager.attachControl(attachUp, attachDown, attachMove);\r\n };\r\n /** Detaches all event handlers*/\r\n Scene.prototype.detachControl = function () {\r\n this._inputManager.detachControl();\r\n };\r\n /**\r\n * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)\r\n * Delay loaded resources are not taking in account\r\n * @return true if all required resources are ready\r\n */\r\n Scene.prototype.isReady = function () {\r\n if (this._isDisposed) {\r\n return false;\r\n }\r\n var index;\r\n var engine = this.getEngine();\r\n // Effects\r\n if (!engine.areAllEffectsReady()) {\r\n return false;\r\n }\r\n // Pending data\r\n if (this._pendingData.length > 0) {\r\n return false;\r\n }\r\n // Meshes\r\n for (index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (!mesh.isEnabled()) {\r\n continue;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n continue;\r\n }\r\n if (!mesh.isReady(true)) {\r\n return false;\r\n }\r\n var hardwareInstancedRendering = mesh.getClassName() === \"InstancedMesh\" || mesh.getClassName() === \"InstancedLinesMesh\" || engine.getCaps().instancedArrays && mesh.instances.length > 0;\r\n // Is Ready For Mesh\r\n for (var _i = 0, _a = this._isReadyForMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n if (!step.action(mesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Geometries\r\n for (index = 0; index < this.geometries.length; index++) {\r\n var geometry = this.geometries[index];\r\n if (geometry.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return false;\r\n }\r\n }\r\n // Post-processes\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var _b = 0, _c = this.activeCameras; _b < _c.length; _b++) {\r\n var camera = _c[_b];\r\n if (!camera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n if (!this.activeCamera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n // Particles\r\n for (var _d = 0, _e = this.particleSystems; _d < _e.length; _d++) {\r\n var particleSystem = _e[_d];\r\n if (!particleSystem.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /** Resets all cached information relative to material (including effect and visibility) */\r\n Scene.prototype.resetCachedMaterial = function () {\r\n this._cachedMaterial = null;\r\n this._cachedEffect = null;\r\n this._cachedVisibility = null;\r\n };\r\n /**\r\n * Registers a function to be called before every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called before every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n };\r\n /**\r\n * Registers a function to be called after every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called after every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n };\r\n Scene.prototype._executeOnceBeforeRender = function (func) {\r\n var _this = this;\r\n var execFunc = function () {\r\n func();\r\n setTimeout(function () {\r\n _this.unregisterBeforeRender(execFunc);\r\n });\r\n };\r\n this.registerBeforeRender(execFunc);\r\n };\r\n /**\r\n * The provided function will run before render once and will be disposed afterwards.\r\n * A timeout delay can be provided so that the function will be executed in N ms.\r\n * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.\r\n * @param func The function to be executed.\r\n * @param timeout optional delay in ms\r\n */\r\n Scene.prototype.executeOnceBeforeRender = function (func, timeout) {\r\n var _this = this;\r\n if (timeout !== undefined) {\r\n setTimeout(function () {\r\n _this._executeOnceBeforeRender(func);\r\n }, timeout);\r\n }\r\n else {\r\n this._executeOnceBeforeRender(func);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._addPendingData = function (data) {\r\n this._pendingData.push(data);\r\n };\r\n /** @hidden */\r\n Scene.prototype._removePendingData = function (data) {\r\n var wasLoading = this.isLoading;\r\n var index = this._pendingData.indexOf(data);\r\n if (index !== -1) {\r\n this._pendingData.splice(index, 1);\r\n }\r\n if (wasLoading && !this.isLoading) {\r\n this.onDataLoadedObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Returns the number of items waiting to be loaded\r\n * @returns the number of items waiting to be loaded\r\n */\r\n Scene.prototype.getWaitingItemsCount = function () {\r\n return this._pendingData.length;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isLoading\", {\r\n /**\r\n * Returns a boolean indicating if the scene is still loading data\r\n */\r\n get: function () {\r\n return this._pendingData.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers a function to be executed when the scene is ready\r\n * @param {Function} func - the function to be executed\r\n */\r\n Scene.prototype.executeWhenReady = function (func) {\r\n var _this = this;\r\n this.onReadyObservable.add(func);\r\n if (this._executeWhenReadyTimeoutId !== -1) {\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n /**\r\n * Returns a promise that resolves when the scene is ready\r\n * @returns A promise that resolves when the scene is ready\r\n */\r\n Scene.prototype.whenReadyAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.executeWhenReady(function () {\r\n resolve();\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._checkIsReady = function () {\r\n var _this = this;\r\n this._registerTransientComponents();\r\n if (this.isReady()) {\r\n this.onReadyObservable.notifyObservers(this);\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n if (this._isDisposed) {\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n Object.defineProperty(Scene.prototype, \"animatables\", {\r\n /**\r\n * Gets all animatable attached to the scene\r\n */\r\n get: function () {\r\n return this._activeAnimatables;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the last animation time frame.\r\n * Useful to override when animations start running when loading a scene for the first time.\r\n */\r\n Scene.prototype.resetLastAnimationTimeFrame = function () {\r\n this._animationTimeLast = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__[\"PrecisionDate\"].Now;\r\n };\r\n // Matrix\r\n /**\r\n * Gets the current view matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getViewMatrix = function () {\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Gets the current projection matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getProjectionMatrix = function () {\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the current transform matrix\r\n * @returns a Matrix made of View * Projection\r\n */\r\n Scene.prototype.getTransformMatrix = function () {\r\n return this._transformMatrix;\r\n };\r\n /**\r\n * Sets the current transform matrix\r\n * @param viewL defines the View matrix to use\r\n * @param projectionL defines the Projection matrix to use\r\n * @param viewR defines the right View matrix to use (if provided)\r\n * @param projectionR defines the right Projection matrix to use (if provided)\r\n */\r\n Scene.prototype.setTransformMatrix = function (viewL, projectionL, viewR, projectionR) {\r\n if (this._viewUpdateFlag === viewL.updateFlag && this._projectionUpdateFlag === projectionL.updateFlag) {\r\n return;\r\n }\r\n this._viewUpdateFlag = viewL.updateFlag;\r\n this._projectionUpdateFlag = projectionL.updateFlag;\r\n this._viewMatrix = viewL;\r\n this._projectionMatrix = projectionL;\r\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n // Update frustum\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_28__[\"Frustum\"].GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_28__[\"Frustum\"].GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n if (this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo) {\r\n this._updateMultiviewUbo(viewR, projectionR);\r\n }\r\n else if (this._sceneUbo.useUbo) {\r\n this._sceneUbo.updateMatrix(\"viewProjection\", this._transformMatrix);\r\n this._sceneUbo.updateMatrix(\"view\", this._viewMatrix);\r\n this._sceneUbo.update();\r\n }\r\n };\r\n /**\r\n * Gets the uniform buffer used to store scene data\r\n * @returns a UniformBuffer\r\n */\r\n Scene.prototype.getSceneUniformBuffer = function () {\r\n return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;\r\n };\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n * @returns an unique number for the scene\r\n */\r\n Scene.prototype.getUniqueId = function () {\r\n return _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_29__[\"UniqueIdGenerator\"].UniqueId;\r\n };\r\n /**\r\n * Add a mesh to the list of scene's meshes\r\n * @param newMesh defines the mesh to add\r\n * @param recursive if all child meshes should also be added to the scene\r\n */\r\n Scene.prototype.addMesh = function (newMesh, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n this.meshes.push(newMesh);\r\n newMesh._resyncLightSources();\r\n this.onNewMeshAddedObservable.notifyObservers(newMesh);\r\n if (recursive) {\r\n newMesh.getChildMeshes().forEach(function (m) {\r\n _this.addMesh(m);\r\n });\r\n }\r\n };\r\n /**\r\n * Remove a mesh for the list of scene's meshes\r\n * @param toRemove defines the mesh to remove\r\n * @param recursive if all child meshes should also be removed from the scene\r\n * @returns the index where the mesh was in the mesh list\r\n */\r\n Scene.prototype.removeMesh = function (toRemove, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n var index = this.meshes.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.meshes[index] = this.meshes[this.meshes.length - 1];\r\n this.meshes.pop();\r\n }\r\n this.onMeshRemovedObservable.notifyObservers(toRemove);\r\n if (recursive) {\r\n toRemove.getChildMeshes().forEach(function (m) {\r\n _this.removeMesh(m);\r\n });\r\n }\r\n return index;\r\n };\r\n /**\r\n * Add a transform node to the list of scene's transform nodes\r\n * @param newTransformNode defines the transform node to add\r\n */\r\n Scene.prototype.addTransformNode = function (newTransformNode) {\r\n newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;\r\n this.transformNodes.push(newTransformNode);\r\n this.onNewTransformNodeAddedObservable.notifyObservers(newTransformNode);\r\n };\r\n /**\r\n * Remove a transform node for the list of scene's transform nodes\r\n * @param toRemove defines the transform node to remove\r\n * @returns the index where the transform node was in the transform node list\r\n */\r\n Scene.prototype.removeTransformNode = function (toRemove) {\r\n var index = toRemove._indexInSceneTransformNodesArray;\r\n if (index !== -1) {\r\n if (index !== this.transformNodes.length - 1) {\r\n var lastNode = this.transformNodes[this.transformNodes.length - 1];\r\n this.transformNodes[index] = lastNode;\r\n lastNode._indexInSceneTransformNodesArray = index;\r\n }\r\n toRemove._indexInSceneTransformNodesArray = -1;\r\n this.transformNodes.pop();\r\n }\r\n this.onTransformNodeRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a skeleton for the list of scene's skeletons\r\n * @param toRemove defines the skeleton to remove\r\n * @returns the index where the skeleton was in the skeleton list\r\n */\r\n Scene.prototype.removeSkeleton = function (toRemove) {\r\n var index = this.skeletons.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.skeletons.splice(index, 1);\r\n this.onSkeletonRemovedObservable.notifyObservers(toRemove);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a morph target for the list of scene's morph targets\r\n * @param toRemove defines the morph target to remove\r\n * @returns the index where the morph target was in the morph target list\r\n */\r\n Scene.prototype.removeMorphTargetManager = function (toRemove) {\r\n var index = this.morphTargetManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.morphTargetManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a light for the list of scene's lights\r\n * @param toRemove defines the light to remove\r\n * @returns the index where the light was in the light list\r\n */\r\n Scene.prototype.removeLight = function (toRemove) {\r\n var index = this.lights.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(toRemove, false);\r\n }\r\n // Remove from the scene if mesh found\r\n this.lights.splice(index, 1);\r\n this.sortLightsByPriority();\r\n }\r\n this.onLightRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a camera for the list of scene's cameras\r\n * @param toRemove defines the camera to remove\r\n * @returns the index where the camera was in the camera list\r\n */\r\n Scene.prototype.removeCamera = function (toRemove) {\r\n var index = this.cameras.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.cameras.splice(index, 1);\r\n }\r\n // Remove from activeCameras\r\n var index2 = this.activeCameras.indexOf(toRemove);\r\n if (index2 !== -1) {\r\n // Remove from the scene if mesh found\r\n this.activeCameras.splice(index2, 1);\r\n }\r\n // Reset the activeCamera\r\n if (this.activeCamera === toRemove) {\r\n if (this.cameras.length > 0) {\r\n this.activeCamera = this.cameras[0];\r\n }\r\n else {\r\n this.activeCamera = null;\r\n }\r\n }\r\n this.onCameraRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a particle system for the list of scene's particle systems\r\n * @param toRemove defines the particle system to remove\r\n * @returns the index where the particle system was in the particle system list\r\n */\r\n Scene.prototype.removeParticleSystem = function (toRemove) {\r\n var index = this.particleSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.particleSystems.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a animation for the list of scene's animations\r\n * @param toRemove defines the animation to remove\r\n * @returns the index where the animation was in the animation list\r\n */\r\n Scene.prototype.removeAnimation = function (toRemove) {\r\n var index = this.animations.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animations.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Scene.prototype.stopAnimation = function (target, animationName, targetMask) {\r\n // Do nothing as code will be provided by animation component\r\n };\r\n /**\r\n * Removes the given animation group from this scene.\r\n * @param toRemove The animation group to remove\r\n * @returns The index of the removed animation group\r\n */\r\n Scene.prototype.removeAnimationGroup = function (toRemove) {\r\n var index = this.animationGroups.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animationGroups.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given multi-material from this scene.\r\n * @param toRemove The multi-material to remove\r\n * @returns The index of the removed multi-material\r\n */\r\n Scene.prototype.removeMultiMaterial = function (toRemove) {\r\n var index = this.multiMaterials.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.multiMaterials.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given material from this scene.\r\n * @param toRemove The material to remove\r\n * @returns The index of the removed material\r\n */\r\n Scene.prototype.removeMaterial = function (toRemove) {\r\n var index = toRemove._indexInSceneMaterialArray;\r\n if (index !== -1 && index < this.materials.length) {\r\n if (index !== this.materials.length - 1) {\r\n var lastMaterial = this.materials[this.materials.length - 1];\r\n this.materials[index] = lastMaterial;\r\n lastMaterial._indexInSceneMaterialArray = index;\r\n }\r\n toRemove._indexInSceneMaterialArray = -1;\r\n this.materials.pop();\r\n }\r\n this.onMaterialRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Removes the given action manager from this scene.\r\n * @param toRemove The action manager to remove\r\n * @returns The index of the removed action manager\r\n */\r\n Scene.prototype.removeActionManager = function (toRemove) {\r\n var index = this.actionManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.actionManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given texture from this scene.\r\n * @param toRemove The texture to remove\r\n * @returns The index of the removed texture\r\n */\r\n Scene.prototype.removeTexture = function (toRemove) {\r\n var index = this.textures.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.textures.splice(index, 1);\r\n }\r\n this.onTextureRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Adds the given light to this scene\r\n * @param newLight The light to add\r\n */\r\n Scene.prototype.addLight = function (newLight) {\r\n this.lights.push(newLight);\r\n this.sortLightsByPriority();\r\n // Add light to all meshes (To support if the light is removed and then readded)\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(newLight) === -1) {\r\n mesh.lightSources.push(newLight);\r\n mesh._resyncLightSources();\r\n }\r\n }\r\n this.onNewLightAddedObservable.notifyObservers(newLight);\r\n };\r\n /**\r\n * Sorts the list list based on light priorities\r\n */\r\n Scene.prototype.sortLightsByPriority = function () {\r\n if (this.requireLightSorting) {\r\n this.lights.sort(_Lights_light__WEBPACK_IMPORTED_MODULE_14__[\"Light\"].CompareLightsPriority);\r\n }\r\n };\r\n /**\r\n * Adds the given camera to this scene\r\n * @param newCamera The camera to add\r\n */\r\n Scene.prototype.addCamera = function (newCamera) {\r\n this.cameras.push(newCamera);\r\n this.onNewCameraAddedObservable.notifyObservers(newCamera);\r\n };\r\n /**\r\n * Adds the given skeleton to this scene\r\n * @param newSkeleton The skeleton to add\r\n */\r\n Scene.prototype.addSkeleton = function (newSkeleton) {\r\n this.skeletons.push(newSkeleton);\r\n this.onNewSkeletonAddedObservable.notifyObservers(newSkeleton);\r\n };\r\n /**\r\n * Adds the given particle system to this scene\r\n * @param newParticleSystem The particle system to add\r\n */\r\n Scene.prototype.addParticleSystem = function (newParticleSystem) {\r\n this.particleSystems.push(newParticleSystem);\r\n };\r\n /**\r\n * Adds the given animation to this scene\r\n * @param newAnimation The animation to add\r\n */\r\n Scene.prototype.addAnimation = function (newAnimation) {\r\n this.animations.push(newAnimation);\r\n };\r\n /**\r\n * Adds the given animation group to this scene.\r\n * @param newAnimationGroup The animation group to add\r\n */\r\n Scene.prototype.addAnimationGroup = function (newAnimationGroup) {\r\n this.animationGroups.push(newAnimationGroup);\r\n };\r\n /**\r\n * Adds the given multi-material to this scene\r\n * @param newMultiMaterial The multi-material to add\r\n */\r\n Scene.prototype.addMultiMaterial = function (newMultiMaterial) {\r\n this.multiMaterials.push(newMultiMaterial);\r\n };\r\n /**\r\n * Adds the given material to this scene\r\n * @param newMaterial The material to add\r\n */\r\n Scene.prototype.addMaterial = function (newMaterial) {\r\n newMaterial._indexInSceneMaterialArray = this.materials.length;\r\n this.materials.push(newMaterial);\r\n this.onNewMaterialAddedObservable.notifyObservers(newMaterial);\r\n };\r\n /**\r\n * Adds the given morph target to this scene\r\n * @param newMorphTargetManager The morph target to add\r\n */\r\n Scene.prototype.addMorphTargetManager = function (newMorphTargetManager) {\r\n this.morphTargetManagers.push(newMorphTargetManager);\r\n };\r\n /**\r\n * Adds the given geometry to this scene\r\n * @param newGeometry The geometry to add\r\n */\r\n Scene.prototype.addGeometry = function (newGeometry) {\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;\r\n }\r\n this.geometries.push(newGeometry);\r\n };\r\n /**\r\n * Adds the given action manager to this scene\r\n * @param newActionManager The action manager to add\r\n */\r\n Scene.prototype.addActionManager = function (newActionManager) {\r\n this.actionManagers.push(newActionManager);\r\n };\r\n /**\r\n * Adds the given texture to this scene.\r\n * @param newTexture The texture to add\r\n */\r\n Scene.prototype.addTexture = function (newTexture) {\r\n this.textures.push(newTexture);\r\n this.onNewTextureAddedObservable.notifyObservers(newTexture);\r\n };\r\n /**\r\n * Switch active camera\r\n * @param newCamera defines the new active camera\r\n * @param attachControl defines if attachControl must be called for the new active camera (default: true)\r\n */\r\n Scene.prototype.switchActiveCamera = function (newCamera, attachControl) {\r\n if (attachControl === void 0) { attachControl = true; }\r\n var canvas = this._engine.getRenderingCanvas();\r\n if (!canvas) {\r\n return;\r\n }\r\n if (this.activeCamera) {\r\n this.activeCamera.detachControl(canvas);\r\n }\r\n this.activeCamera = newCamera;\r\n if (attachControl) {\r\n newCamera.attachControl(canvas);\r\n }\r\n };\r\n /**\r\n * sets the active camera of the scene using its ID\r\n * @param id defines the camera's ID\r\n * @return the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByID = function (id) {\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * sets the active camera of the scene using its name\r\n * @param name defines the camera's name\r\n * @returns the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByName = function (name) {\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * get an animation group using its name\r\n * @param name defines the material's name\r\n * @return the animation group or null if none found.\r\n */\r\n Scene.prototype.getAnimationGroupByName = function (name) {\r\n for (var index = 0; index < this.animationGroups.length; index++) {\r\n if (this.animationGroups[index].name === name) {\r\n return this.animationGroups[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a material using its unique id\r\n * @param uniqueId defines the material's unique id\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].uniqueId === uniqueId) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * get a material using its id\r\n * @param id defines the material's ID\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByID = function (id) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added material using a given id\r\n * @param id defines the material's ID\r\n * @return the last material with the given id or null if none found.\r\n */\r\n Scene.prototype.getLastMaterialByID = function (id) {\r\n for (var index = this.materials.length - 1; index >= 0; index--) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a material using its name\r\n * @param name defines the material's name\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByName = function (name) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].name === name) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a texture using its unique id\r\n * @param uniqueId defines the texture's unique id\r\n * @return the texture or null if none found.\r\n */\r\n Scene.prototype.getTextureByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.textures.length; index++) {\r\n if (this.textures[index].uniqueId === uniqueId) {\r\n return this.textures[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its id\r\n * @param id defines the id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByID = function (id) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its unique id\r\n * @param uniqueId defines the unique id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].uniqueId === uniqueId) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its name\r\n * @param name defines the camera's name\r\n * @return the camera or null if none found.\r\n */\r\n Scene.prototype.getCameraByName = function (name) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].name === name) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param id defines the bone's id\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByID = function (id) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].id === id) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param name defines the bone's name\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByName = function (name) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].name === name) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its name\r\n * @param name defines the the light's name\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByName = function (name) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].name === name) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its id\r\n * @param id defines the light's id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByID = function (id) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its scene-generated unique ID\r\n * @param uniqueId defines the light's unique id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].uniqueId === uniqueId) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a particle system by id\r\n * @param id defines the particle system id\r\n * @return the corresponding system or null if none found\r\n */\r\n Scene.prototype.getParticleSystemByID = function (id) {\r\n for (var index = 0; index < this.particleSystems.length; index++) {\r\n if (this.particleSystems[index].id === id) {\r\n return this.particleSystems[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a geometry using its ID\r\n * @param id defines the geometry's id\r\n * @return the geometry or null if none found.\r\n */\r\n Scene.prototype.getGeometryByID = function (id) {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].id === id) {\r\n return this.geometries[index];\r\n }\r\n }\r\n return null;\r\n };\r\n Scene.prototype._getGeometryByUniqueID = function (uniqueId) {\r\n if (this.geometriesByUniqueId) {\r\n var index_1 = this.geometriesByUniqueId[uniqueId];\r\n if (index_1 !== undefined) {\r\n return this.geometries[index_1];\r\n }\r\n }\r\n else {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].uniqueId === uniqueId) {\r\n return this.geometries[index];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Add a new geometry to this scene\r\n * @param geometry defines the geometry to be added to the scene.\r\n * @param force defines if the geometry must be pushed even if a geometry with this id already exists\r\n * @return a boolean defining if the geometry was added or not\r\n */\r\n Scene.prototype.pushGeometry = function (geometry, force) {\r\n if (!force && this._getGeometryByUniqueID(geometry.uniqueId)) {\r\n return false;\r\n }\r\n this.addGeometry(geometry);\r\n this.onNewGeometryAddedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Removes an existing geometry\r\n * @param geometry defines the geometry to be removed from the scene\r\n * @return a boolean defining if the geometry was removed or not\r\n */\r\n Scene.prototype.removeGeometry = function (geometry) {\r\n var index;\r\n if (this.geometriesByUniqueId) {\r\n index = this.geometriesByUniqueId[geometry.uniqueId];\r\n if (index === undefined) {\r\n return false;\r\n }\r\n }\r\n else {\r\n index = this.geometries.indexOf(geometry);\r\n if (index < 0) {\r\n return false;\r\n }\r\n }\r\n if (index !== this.geometries.length - 1) {\r\n var lastGeometry = this.geometries[this.geometries.length - 1];\r\n this.geometries[index] = lastGeometry;\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[lastGeometry.uniqueId] = index;\r\n this.geometriesByUniqueId[geometry.uniqueId] = undefined;\r\n }\r\n }\r\n this.geometries.pop();\r\n this.onGeometryRemovedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Gets the list of geometries attached to the scene\r\n * @returns an array of Geometry\r\n */\r\n Scene.prototype.getGeometries = function () {\r\n return this.geometries;\r\n };\r\n /**\r\n * Gets the first added mesh found of a given ID\r\n * @param id defines the id to search for\r\n * @return the mesh found or null if not found at all\r\n */\r\n Scene.prototype.getMeshByID = function (id) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of meshes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of meshes\r\n */\r\n Scene.prototype.getMeshesByID = function (id) {\r\n return this.meshes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets the first added transform node found of a given ID\r\n * @param id defines the id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByID = function (id) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node with its auto-generated unique id\r\n * @param uniqueId efines the unique id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].uniqueId === uniqueId) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of transform nodes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of transform nodes\r\n */\r\n Scene.prototype.getTransformNodesByID = function (id) {\r\n return this.transformNodes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets a mesh with its auto-generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].uniqueId === uniqueId) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added mesh using a given id\r\n * @param id defines the id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getLastMeshByID = function (id) {\r\n for (var index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getLastEntryByID = function (id) {\r\n var index;\r\n for (index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n for (index = this.transformNodes.length - 1; index >= 0; index--) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n for (index = this.cameras.length - 1; index >= 0; index--) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n for (index = this.lights.length - 1; index >= 0; index--) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getNodeByID = function (id) {\r\n var mesh = this.getMeshByID(id);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByID(id);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByID(id);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByID(id);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given name\r\n * @param name defines the name to search for\r\n * @return the found node or null if not found at all.\r\n */\r\n Scene.prototype.getNodeByName = function (name) {\r\n var mesh = this.getMeshByName(name);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByName(name);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByName(name);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByName(name);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a mesh using a given name\r\n * @param name defines the name to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByName = function (name) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].name === name) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node using a given name\r\n * @param name defines the name to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByName = function (name) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].name === name) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getLastSkeletonByID = function (id) {\r\n for (var index = this.skeletons.length - 1; index >= 0; index--) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given auto generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByUniqueId = function (uniqueId) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].uniqueId === uniqueId) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonById = function (id) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given name\r\n * @param name defines the name to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByName = function (name) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].name === name) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target manager using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found morph target manager or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetManagerById = function (id) {\r\n for (var index = 0; index < this.morphTargetManagers.length; index++) {\r\n if (this.morphTargetManagers[index].uniqueId === id) {\r\n return this.morphTargetManagers[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found morph target or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetById = function (id) {\r\n for (var managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\r\n var morphTargetManager = this.morphTargetManagers[managerIndex];\r\n for (var index = 0; index < morphTargetManager.numTargets; ++index) {\r\n var target = morphTargetManager.getTarget(index);\r\n if (target.id === id) {\r\n return target;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given mesh is active\r\n * @param mesh defines the mesh to look for\r\n * @returns true if the mesh is in the active list\r\n */\r\n Scene.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n Object.defineProperty(Scene.prototype, \"uid\", {\r\n /**\r\n * Return a unique id as a string which can serve as an identifier for the scene\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Add an externaly attached data from its key.\r\n * This method call will fail and return false, if such key already exists.\r\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\r\n * @param key the unique key that identifies the data\r\n * @param data the data object to associate to the key for this Engine instance\r\n * @return true if no such key were already present and the data was added successfully, false otherwise\r\n */\r\n Scene.prototype.addExternalData = function (key, data) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_5__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.add(key, data);\r\n };\r\n /**\r\n * Get an externaly attached data from its key\r\n * @param key the unique key that identifies the data\r\n * @return the associated data, if present (can be null), or undefined if not present\r\n */\r\n Scene.prototype.getExternalData = function (key) {\r\n if (!this._externalData) {\r\n return null;\r\n }\r\n return this._externalData.get(key);\r\n };\r\n /**\r\n * Get an externaly attached data from its key, create it using a factory if it's not already present\r\n * @param key the unique key that identifies the data\r\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\r\n * @return the associated data, can be null if the factory returned null.\r\n */\r\n Scene.prototype.getOrAddExternalDataWithFactory = function (key, factory) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_5__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.getOrAddWithFactory(key, factory);\r\n };\r\n /**\r\n * Remove an externaly attached data from the Engine instance\r\n * @param key the unique key that identifies the data\r\n * @return true if the data was successfully removed, false if it doesn't exist\r\n */\r\n Scene.prototype.removeExternalData = function (key) {\r\n return this._externalData.remove(key);\r\n };\r\n Scene.prototype._evaluateSubMesh = function (subMesh, mesh, initialMesh) {\r\n if (initialMesh.hasInstances || initialMesh.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || mesh.alwaysSelectAsActiveMesh || mesh.subMeshes.length === 1 || subMesh.isInFrustum(this._frustumPlanes)) {\r\n for (var _i = 0, _a = this._evaluateSubMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(mesh, subMesh);\r\n }\r\n var material = subMesh.getMaterial();\r\n if (material !== null && material !== undefined) {\r\n // Render targets\r\n if (material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\r\n if (this._processedMaterials.indexOf(material) === -1) {\r\n this._processedMaterials.push(material);\r\n this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\r\n }\r\n }\r\n // Dispatch\r\n this._activeIndices.addCount(subMesh.indexCount, false);\r\n this._renderingManager.dispatch(subMesh, mesh, material);\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the processed materials smart array preventing retention point in material dispose.\r\n */\r\n Scene.prototype.freeProcessedMaterials = function () {\r\n this._processedMaterials.dispose();\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockfreeActiveMeshesAndRenderingGroups\", {\r\n /** Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups\r\n * It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance\r\n * when disposing several meshes in a row or a hierarchy of meshes.\r\n * When used, it is the responsability of the user to blockfreeActiveMeshesAndRenderingGroups back to false.\r\n */\r\n get: function () {\r\n return this._preventFreeActiveMeshesAndRenderingGroups;\r\n },\r\n set: function (value) {\r\n if (this._preventFreeActiveMeshesAndRenderingGroups === value) {\r\n return;\r\n }\r\n if (value) {\r\n this.freeActiveMeshes();\r\n this.freeRenderingGroups();\r\n }\r\n this._preventFreeActiveMeshesAndRenderingGroups = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clear the active meshes smart array preventing retention point in mesh dispose.\r\n */\r\n Scene.prototype.freeActiveMeshes = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n this._activeMeshes.dispose();\r\n if (this.activeCamera && this.activeCamera._activeMeshes) {\r\n this.activeCamera._activeMeshes.dispose();\r\n }\r\n if (this.activeCameras) {\r\n for (var i = 0; i < this.activeCameras.length; i++) {\r\n var activeCamera = this.activeCameras[i];\r\n if (activeCamera && activeCamera._activeMeshes) {\r\n activeCamera._activeMeshes.dispose();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n Scene.prototype.freeRenderingGroups = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n if (this.textures) {\r\n for (var i = 0; i < this.textures.length; i++) {\r\n var texture = this.textures[i];\r\n if (texture && texture.renderList) {\r\n texture.freeRenderingGroups();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._isInIntermediateRendering = function () {\r\n return this._intermediateRendering;\r\n };\r\n /**\r\n * Use this function to stop evaluating active meshes. The current list will be keep alive between frames\r\n * @returns the current scene\r\n */\r\n Scene.prototype.freezeActiveMeshes = function () {\r\n if (!this.activeCamera) {\r\n return this;\r\n }\r\n if (!this._frustumPlanes) {\r\n this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());\r\n }\r\n this._evaluateActiveMeshes();\r\n this._activeMeshesFrozen = true;\r\n for (var index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._freeze();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Use this function to restart evaluating active meshes on every frame\r\n * @returns the current scene\r\n */\r\n Scene.prototype.unfreezeActiveMeshes = function () {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (mesh._internalAbstractMeshDataInfo) {\r\n mesh._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n }\r\n for (var index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._unFreeze();\r\n }\r\n this._activeMeshesFrozen = false;\r\n return this;\r\n };\r\n Scene.prototype._evaluateActiveMeshes = function () {\r\n if (this._activeMeshesFrozen && this._activeMeshes.length) {\r\n var len_1 = this._activeMeshes.length;\r\n for (var i = 0; i < len_1; i++) {\r\n var mesh = this._activeMeshes.data[i];\r\n mesh.computeWorldMatrix();\r\n }\r\n return;\r\n }\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this);\r\n this.activeCamera._activeMeshes.reset();\r\n this._activeMeshes.reset();\r\n this._renderingManager.reset();\r\n this._processedMaterials.reset();\r\n this._activeParticleSystems.reset();\r\n this._activeSkeletons.reset();\r\n this._softwareSkinnedMeshes.reset();\r\n for (var _i = 0, _a = this._beforeEvaluateActiveMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Determine mesh candidates\r\n var meshes = this.getActiveMeshCandidates();\r\n // Check each mesh\r\n var len = meshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var mesh = meshes.data[i];\r\n if (mesh.isBlocked) {\r\n continue;\r\n }\r\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\r\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.lengthSquared() === 0) {\r\n continue;\r\n }\r\n mesh.computeWorldMatrix();\r\n // Intersections\r\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionEnterTrigger, _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger)) {\r\n this._meshesForIntersections.pushNoDuplicate(mesh);\r\n }\r\n // Switch to current LOD\r\n var meshToRender = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);\r\n if (meshToRender === undefined || meshToRender === null) {\r\n continue;\r\n }\r\n // Compute world matrix if LOD is billboard\r\n if (meshToRender !== mesh && meshToRender.billboardMode !== _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_8__[\"TransformNode\"].BILLBOARDMODE_NONE) {\r\n meshToRender.computeWorldMatrix();\r\n }\r\n mesh._preActivate();\r\n if (mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) !== 0) && (mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(this._frustumPlanes))) {\r\n this._activeMeshes.push(mesh);\r\n this.activeCamera._activeMeshes.push(mesh);\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(this._renderId, false);\r\n }\r\n if (mesh._activate(this._renderId, false)) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstances = false;\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActive = true;\r\n this._activeMesh(mesh, meshToRender);\r\n }\r\n mesh._postActivate();\r\n }\r\n }\r\n this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this);\r\n // Particle systems\r\n if (this.particlesEnabled) {\r\n this.onBeforeParticlesRenderingObservable.notifyObservers(this);\r\n for (var particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\r\n var particleSystem = this.particleSystems[particleIndex];\r\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || emitter.isEnabled()) {\r\n this._activeParticleSystems.push(particleSystem);\r\n particleSystem.animate();\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n this.onAfterParticlesRenderingObservable.notifyObservers(this);\r\n }\r\n };\r\n Scene.prototype._activeMesh = function (sourceMesh, mesh) {\r\n if (this._skeletonsEnabled && mesh.skeleton !== null && mesh.skeleton !== undefined) {\r\n if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {\r\n mesh.skeleton.prepare();\r\n }\r\n if (!mesh.computeBonesUsingShaders) {\r\n this._softwareSkinnedMeshes.pushNoDuplicate(mesh);\r\n }\r\n }\r\n for (var _i = 0, _a = this._activeMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(sourceMesh, mesh);\r\n }\r\n if (mesh !== undefined && mesh !== null\r\n && mesh.subMeshes !== undefined && mesh.subMeshes !== null && mesh.subMeshes.length > 0) {\r\n var subMeshes = this.getActiveSubMeshCandidates(mesh);\r\n var len = subMeshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var subMesh = subMeshes.data[i];\r\n this._evaluateSubMesh(subMesh, mesh, sourceMesh);\r\n }\r\n }\r\n };\r\n /**\r\n * Update the transform matrix to update from the current active camera\r\n * @param force defines a boolean used to force the update even if cache is up to date\r\n */\r\n Scene.prototype.updateTransformMatrix = function (force) {\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(force));\r\n };\r\n Scene.prototype._bindFrameBuffer = function () {\r\n if (this.activeCamera && this.activeCamera._multiviewTexture) {\r\n this.activeCamera._multiviewTexture._bindFrameBuffer();\r\n }\r\n else if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n var useMultiview = this.getEngine().getCaps().multiview && this.activeCamera.outputRenderTarget && this.activeCamera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.activeCamera.outputRenderTarget._bindFrameBuffer();\r\n }\r\n else {\r\n var internalTexture = this.activeCamera.outputRenderTarget.getInternalTexture();\r\n if (internalTexture) {\r\n this.getEngine().bindFramebuffer(internalTexture);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_22__[\"Logger\"].Error(\"Camera contains invalid customDefaultRenderTarget\");\r\n }\r\n }\r\n }\r\n else {\r\n this.getEngine().restoreDefaultFramebuffer(); // Restore back buffer if needed\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._renderForCamera = function (camera, rigParent) {\r\n if (camera && camera._skipRendering) {\r\n return;\r\n }\r\n var engine = this._engine;\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.resetCachedMaterial();\r\n this._renderId++;\r\n var useMultiview = this.getEngine().getCaps().multiview && camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.setTransformMatrix(camera._rigCameras[0].getViewMatrix(), camera._rigCameras[0].getProjectionMatrix(), camera._rigCameras[1].getViewMatrix(), camera._rigCameras[1].getProjectionMatrix());\r\n }\r\n else {\r\n this.updateTransformMatrix();\r\n }\r\n this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera);\r\n // Meshes\r\n this._evaluateActiveMeshes();\r\n // Software skinning\r\n for (var softwareSkinnedMeshIndex = 0; softwareSkinnedMeshIndex < this._softwareSkinnedMeshes.length; softwareSkinnedMeshIndex++) {\r\n var mesh = this._softwareSkinnedMeshes.data[softwareSkinnedMeshIndex];\r\n mesh.applySkeleton(mesh.skeleton);\r\n }\r\n // Render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n if (camera.customRenderTargets && camera.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(camera.customRenderTargets);\r\n }\r\n if (rigParent && rigParent.customRenderTargets && rigParent.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(rigParent.customRenderTargets);\r\n }\r\n // Collects render targets from external components.\r\n for (var _i = 0, _a = this._gatherActiveCameraRenderTargetsStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this._renderTargets);\r\n }\r\n if (this.renderTargetsEnabled) {\r\n this._intermediateRendering = true;\r\n var needRebind = false;\r\n if (this._renderTargets.length > 0) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].StartPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n for (var renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {\r\n var renderTarget = this._renderTargets.data[renderIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n var hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;\r\n renderTarget.render(hasSpecialRenderTargetCamera, this.dumpNextRenderTargets);\r\n needRebind = true;\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].EndPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n this._renderId++;\r\n }\r\n for (var _b = 0, _c = this._cameraDrawRenderTargetStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n needRebind = step.action(this.activeCamera) || needRebind;\r\n }\r\n this._intermediateRendering = false;\r\n // Need to bind if sub-camera has an outputRenderTarget eg. for webXR\r\n if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n needRebind = true;\r\n }\r\n // Restore framebuffer after rendering to targets\r\n if (needRebind) {\r\n this._bindFrameBuffer();\r\n }\r\n }\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n // Prepare Frame\r\n if (this.postProcessManager && !camera._multiviewTexture) {\r\n this.postProcessManager._prepareFrame();\r\n }\r\n // Before Camera Draw\r\n for (var _d = 0, _e = this._beforeCameraDrawStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this.activeCamera);\r\n }\r\n // Render\r\n this.onBeforeDrawPhaseObservable.notifyObservers(this);\r\n this._renderingManager.render(null, null, true, true);\r\n this.onAfterDrawPhaseObservable.notifyObservers(this);\r\n // After Camera Draw\r\n for (var _f = 0, _g = this._afterCameraDrawStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action(this.activeCamera);\r\n }\r\n // Finalize frame\r\n if (this.postProcessManager && !camera._multiviewTexture) {\r\n this.postProcessManager._finalizeFrame(camera.isIntermediate);\r\n }\r\n // Reset some special arrays\r\n this._renderTargets.reset();\r\n this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);\r\n };\r\n Scene.prototype._processSubCameras = function (camera) {\r\n if (camera.cameraRigMode === _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__[\"Camera\"].RIG_MODE_NONE || (camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1 && this.getEngine().getCaps().multiview)) {\r\n this._renderForCamera(camera);\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n return;\r\n }\r\n if (camera._useMultiviewToSingleView) {\r\n this._renderMultiviewToSingleView(camera);\r\n }\r\n else {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n this._renderForCamera(camera._rigCameras[index], camera);\r\n }\r\n }\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n this.setTransformMatrix(this._activeCamera.getViewMatrix(), this._activeCamera.getProjectionMatrix());\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n };\r\n Scene.prototype._checkIntersections = function () {\r\n for (var index = 0; index < this._meshesForIntersections.length; index++) {\r\n var sourceMesh = this._meshesForIntersections.data[index];\r\n if (!sourceMesh.actionManager) {\r\n continue;\r\n }\r\n for (var actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {\r\n var action = sourceMesh.actionManager.actions[actionIndex];\r\n if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionEnterTrigger || action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n var parameters = action.getTriggerParameter();\r\n var otherMesh = parameters instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_9__[\"AbstractMesh\"] ? parameters : parameters.mesh;\r\n var areIntersecting = otherMesh.intersectsMesh(sourceMesh, parameters.usePreciseIntersection);\r\n var currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);\r\n if (areIntersecting && currentIntersectionInProgress === -1) {\r\n if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionEnterTrigger) {\r\n action._executeCurrent(_Actions_actionEvent__WEBPACK_IMPORTED_MODULE_16__[\"ActionEvent\"].CreateNew(sourceMesh, undefined, otherMesh));\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n else if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n }\r\n else if (!areIntersecting && currentIntersectionInProgress > -1) {\r\n //They intersected, and now they don't.\r\n //is this trigger an exit trigger? execute an event.\r\n if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n action._executeCurrent(_Actions_actionEvent__WEBPACK_IMPORTED_MODULE_16__[\"ActionEvent\"].CreateNew(sourceMesh, undefined, otherMesh));\r\n }\r\n //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.\r\n if (!sourceMesh.actionManager.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger, function (parameter) {\r\n var parameterMesh = parameter instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_9__[\"AbstractMesh\"] ? parameter : parameter.mesh;\r\n return otherMesh === parameterMesh;\r\n }) || action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n sourceMesh._intersectionsInProgress.splice(currentIntersectionInProgress, 1);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._advancePhysicsEngineStep = function (step) {\r\n // Do nothing. Code will be replaced if physics engine component is referenced\r\n };\r\n /** @hidden */\r\n Scene.prototype._animate = function () {\r\n // Nothing to do as long as Animatable have not been imported.\r\n };\r\n /** Execute all animations (for a frame) */\r\n Scene.prototype.animate = function () {\r\n if (this._engine.isDeterministicLockStep()) {\r\n var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime)) + this._timeAccumulator;\r\n var defaultFPS = (60.0 / 1000.0);\r\n var defaultFrameTime = this.getDeterministicFrameTime();\r\n var stepsTaken = 0;\r\n var maxSubSteps = this._engine.getLockstepMaxSteps();\r\n var internalSteps = Math.floor(deltaTime / (1000 * defaultFPS));\r\n internalSteps = Math.min(internalSteps, maxSubSteps);\r\n do {\r\n this.onBeforeStepObservable.notifyObservers(this);\r\n // Animations\r\n this._animationRatio = defaultFrameTime * defaultFPS;\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n this._advancePhysicsEngineStep(defaultFrameTime);\r\n this.onAfterStepObservable.notifyObservers(this);\r\n this._currentStepId++;\r\n stepsTaken++;\r\n deltaTime -= defaultFrameTime;\r\n } while (deltaTime > 0 && stepsTaken < internalSteps);\r\n this._timeAccumulator = deltaTime < 0 ? 0 : deltaTime;\r\n }\r\n else {\r\n // Animations\r\n var deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));\r\n this._animationRatio = deltaTime * (60.0 / 1000.0);\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n this._advancePhysicsEngineStep(deltaTime);\r\n }\r\n };\r\n /**\r\n * Render the scene\r\n * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)\r\n * @param ignoreAnimations defines a boolean indicating if animations should not be executed (false by default)\r\n */\r\n Scene.prototype.render = function (updateCameras, ignoreAnimations) {\r\n if (updateCameras === void 0) { updateCameras = true; }\r\n if (ignoreAnimations === void 0) { ignoreAnimations = false; }\r\n if (this.isDisposed) {\r\n return;\r\n }\r\n this._frameId++;\r\n // Register components that have been associated lately to the scene.\r\n this._registerTransientComponents();\r\n this._activeParticles.fetchNewFrame();\r\n this._totalVertices.fetchNewFrame();\r\n this._activeIndices.fetchNewFrame();\r\n this._activeBones.fetchNewFrame();\r\n this._meshesForIntersections.reset();\r\n this.resetCachedMaterial();\r\n this.onBeforeAnimationsObservable.notifyObservers(this);\r\n // Actions\r\n if (this.actionManager) {\r\n this.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnEveryFrameTrigger);\r\n }\r\n // Animations\r\n if (!ignoreAnimations) {\r\n this.animate();\r\n }\r\n // Before camera update steps\r\n for (var _i = 0, _a = this._beforeCameraUpdateStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Update Cameras\r\n if (updateCameras) {\r\n if (this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n var camera = this.activeCameras[cameraIndex];\r\n camera.update();\r\n if (camera.cameraRigMode !== _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__[\"Camera\"].RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n camera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n this.activeCamera.update();\r\n if (this.activeCamera.cameraRigMode !== _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__[\"Camera\"].RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {\r\n this.activeCamera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n // Before render\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Customs render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n var engine = this.getEngine();\r\n var currentActiveCamera = this.activeCamera;\r\n if (this.renderTargetsEnabled) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].StartPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = true;\r\n for (var customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {\r\n var renderTarget = this.customRenderTargets[customIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n this.activeCamera = renderTarget.activeCamera || this.activeCamera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.updateTransformMatrix();\r\n renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].EndPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = false;\r\n this._renderId++;\r\n }\r\n // Restore back buffer\r\n this.activeCamera = currentActiveCamera;\r\n this._bindFrameBuffer();\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n for (var _b = 0, _c = this._beforeClearStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action();\r\n }\r\n // Clear\r\n if (this.autoClearDepthAndStencil || this.autoClear) {\r\n this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);\r\n }\r\n // Collects render targets from external components.\r\n for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this._renderTargets);\r\n }\r\n // Multi-cameras?\r\n if (this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n if (cameraIndex > 0) {\r\n this._engine.clear(null, false, true, true);\r\n }\r\n this._processSubCameras(this.activeCameras[cameraIndex]);\r\n }\r\n }\r\n else {\r\n if (!this.activeCamera) {\r\n throw new Error(\"No camera defined\");\r\n }\r\n this._processSubCameras(this.activeCamera);\r\n }\r\n // Intersection checks\r\n this._checkIntersections();\r\n // Executes the after render stage actions.\r\n for (var _f = 0, _g = this._afterRenderStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action();\r\n }\r\n // After render\r\n if (this.afterRender) {\r\n this.afterRender();\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n // Cleaning\r\n if (this._toBeDisposed.length) {\r\n for (var index = 0; index < this._toBeDisposed.length; index++) {\r\n var data = this._toBeDisposed[index];\r\n if (data) {\r\n data.dispose();\r\n }\r\n }\r\n this._toBeDisposed = [];\r\n }\r\n if (this.dumpNextRenderTargets) {\r\n this.dumpNextRenderTargets = false;\r\n }\r\n this._activeBones.addCount(0, true);\r\n this._activeIndices.addCount(0, true);\r\n this._activeParticles.addCount(0, true);\r\n };\r\n /**\r\n * Freeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.freezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].freeze();\r\n }\r\n };\r\n /**\r\n * Unfreeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.unfreezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].unfreeze();\r\n }\r\n };\r\n /**\r\n * Releases all held ressources\r\n */\r\n Scene.prototype.dispose = function () {\r\n this.beforeRender = null;\r\n this.afterRender = null;\r\n if (_Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"]._LastCreatedScene === this) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"]._LastCreatedScene = null;\r\n }\r\n this.skeletons = [];\r\n this.morphTargetManagers = [];\r\n this._transientComponents = [];\r\n this._isReadyForMeshStage.clear();\r\n this._beforeEvaluateActiveMeshStage.clear();\r\n this._evaluateSubMeshStage.clear();\r\n this._activeMeshStage.clear();\r\n this._cameraDrawRenderTargetStage.clear();\r\n this._beforeCameraDrawStage.clear();\r\n this._beforeRenderTargetDrawStage.clear();\r\n this._beforeRenderingGroupDrawStage.clear();\r\n this._beforeRenderingMeshStage.clear();\r\n this._afterRenderingMeshStage.clear();\r\n this._afterRenderingGroupDrawStage.clear();\r\n this._afterCameraDrawStage.clear();\r\n this._afterRenderTargetDrawStage.clear();\r\n this._afterRenderStage.clear();\r\n this._beforeCameraUpdateStage.clear();\r\n this._beforeClearStage.clear();\r\n this._gatherRenderTargetsStage.clear();\r\n this._gatherActiveCameraRenderTargetsStage.clear();\r\n this._pointerMoveStage.clear();\r\n this._pointerDownStage.clear();\r\n this._pointerUpStage.clear();\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.dispose();\r\n }\r\n this.importedMeshesFiles = new Array();\r\n if (this.stopAllAnimations) {\r\n this.stopAllAnimations();\r\n }\r\n this.resetCachedMaterial();\r\n // Smart arrays\r\n if (this.activeCamera) {\r\n this.activeCamera._activeMeshes.dispose();\r\n this.activeCamera = null;\r\n }\r\n this._activeMeshes.dispose();\r\n this._renderingManager.dispose();\r\n this._processedMaterials.dispose();\r\n this._activeParticleSystems.dispose();\r\n this._activeSkeletons.dispose();\r\n this._softwareSkinnedMeshes.dispose();\r\n this._renderTargets.dispose();\r\n this._registeredForLateAnimationBindings.dispose();\r\n this._meshesForIntersections.dispose();\r\n this._toBeDisposed = [];\r\n // Abort active requests\r\n for (var _b = 0, _c = this._activeRequests; _b < _c.length; _b++) {\r\n var request = _c[_b];\r\n request.abort();\r\n }\r\n // Events\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderTargetsRenderObservable.clear();\r\n this.onAfterRenderTargetsRenderObservable.clear();\r\n this.onAfterStepObservable.clear();\r\n this.onBeforeStepObservable.clear();\r\n this.onBeforeActiveMeshesEvaluationObservable.clear();\r\n this.onAfterActiveMeshesEvaluationObservable.clear();\r\n this.onBeforeParticlesRenderingObservable.clear();\r\n this.onAfterParticlesRenderingObservable.clear();\r\n this.onBeforeDrawPhaseObservable.clear();\r\n this.onAfterDrawPhaseObservable.clear();\r\n this.onBeforeAnimationsObservable.clear();\r\n this.onAfterAnimationsObservable.clear();\r\n this.onDataLoadedObservable.clear();\r\n this.onBeforeRenderingGroupObservable.clear();\r\n this.onAfterRenderingGroupObservable.clear();\r\n this.onMeshImportedObservable.clear();\r\n this.onBeforeCameraRenderObservable.clear();\r\n this.onAfterCameraRenderObservable.clear();\r\n this.onReadyObservable.clear();\r\n this.onNewCameraAddedObservable.clear();\r\n this.onCameraRemovedObservable.clear();\r\n this.onNewLightAddedObservable.clear();\r\n this.onLightRemovedObservable.clear();\r\n this.onNewGeometryAddedObservable.clear();\r\n this.onGeometryRemovedObservable.clear();\r\n this.onNewTransformNodeAddedObservable.clear();\r\n this.onTransformNodeRemovedObservable.clear();\r\n this.onNewMeshAddedObservable.clear();\r\n this.onMeshRemovedObservable.clear();\r\n this.onNewSkeletonAddedObservable.clear();\r\n this.onSkeletonRemovedObservable.clear();\r\n this.onNewMaterialAddedObservable.clear();\r\n this.onMaterialRemovedObservable.clear();\r\n this.onNewTextureAddedObservable.clear();\r\n this.onTextureRemovedObservable.clear();\r\n this.onPrePointerObservable.clear();\r\n this.onPointerObservable.clear();\r\n this.onPreKeyboardObservable.clear();\r\n this.onKeyboardObservable.clear();\r\n this.onActiveCameraChanged.clear();\r\n this.detachControl();\r\n // Detach cameras\r\n var canvas = this._engine.getRenderingCanvas();\r\n if (canvas) {\r\n var index;\r\n for (index = 0; index < this.cameras.length; index++) {\r\n this.cameras[index].detachControl(canvas);\r\n }\r\n }\r\n // Release animation groups\r\n while (this.animationGroups.length) {\r\n this.animationGroups[0].dispose();\r\n }\r\n // Release lights\r\n while (this.lights.length) {\r\n this.lights[0].dispose();\r\n }\r\n // Release meshes\r\n while (this.meshes.length) {\r\n this.meshes[0].dispose(true);\r\n }\r\n while (this.transformNodes.length) {\r\n this.transformNodes[0].dispose(true);\r\n }\r\n // Release cameras\r\n while (this.cameras.length) {\r\n this.cameras[0].dispose();\r\n }\r\n // Release materials\r\n if (this._defaultMaterial) {\r\n this._defaultMaterial.dispose();\r\n }\r\n while (this.multiMaterials.length) {\r\n this.multiMaterials[0].dispose();\r\n }\r\n while (this.materials.length) {\r\n this.materials[0].dispose();\r\n }\r\n // Release particles\r\n while (this.particleSystems.length) {\r\n this.particleSystems[0].dispose();\r\n }\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Release textures\r\n while (this.textures.length) {\r\n this.textures[0].dispose();\r\n }\r\n // Release UBO\r\n this._sceneUbo.dispose();\r\n if (this._multiviewSceneUbo) {\r\n this._multiviewSceneUbo.dispose();\r\n }\r\n // Post-processes\r\n this.postProcessManager.dispose();\r\n // Remove from engine\r\n index = this._engine.scenes.indexOf(this);\r\n if (index > -1) {\r\n this._engine.scenes.splice(index, 1);\r\n }\r\n this._engine.wipeCaches(true);\r\n this._isDisposed = true;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isDisposed\", {\r\n /**\r\n * Gets if the scene is already disposed\r\n */\r\n get: function () {\r\n return this._isDisposed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Call this function to reduce memory footprint of the scene.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n Scene.prototype.clearCachedVertexData = function () {\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n var geometry = mesh.geometry;\r\n if (geometry) {\r\n geometry._indices = [];\r\n for (var vbName in geometry._vertexBuffers) {\r\n if (!geometry._vertexBuffers.hasOwnProperty(vbName)) {\r\n continue;\r\n }\r\n geometry._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * This function will remove the local cached buffer data from texture.\r\n * It will save memory but will prevent the texture from being rebuilt\r\n */\r\n Scene.prototype.cleanCachedTextureBuffer = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var baseTexture = _a[_i];\r\n var buffer = baseTexture._buffer;\r\n if (buffer) {\r\n baseTexture._buffer = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Get the world extend vectors with an optional filter\r\n *\r\n * @param filterPredicate the predicate - which meshes should be included when calculating the world size\r\n * @returns {{ min: Vector3; max: Vector3 }} min and max vectors\r\n */\r\n Scene.prototype.getWorldExtends = function (filterPredicate) {\r\n var min = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n filterPredicate = filterPredicate || (function () { return true; });\r\n this.meshes.filter(filterPredicate).forEach(function (mesh) {\r\n mesh.computeWorldMatrix(true);\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {\r\n return;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var minBox = boundingInfo.boundingBox.minimumWorld;\r\n var maxBox = boundingInfo.boundingBox.maximumWorld;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].CheckExtends(minBox, min, max);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].CheckExtends(maxBox, min, max);\r\n });\r\n return {\r\n min: min,\r\n max: max\r\n };\r\n };\r\n // Picking\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param camera defines the camera to use for the picking\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /** Launch a ray to try to pick a mesh in the scene\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n // Dummy info if picking as not been imported\r\n var pi = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_15__[\"PickingInfo\"]();\r\n pi._pickingUnavailable = true;\r\n return pi;\r\n };\r\n /** Use the given ray to pick a mesh in the scene\r\n * @param ray The ray to use to pick meshes\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true\r\n * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param x X position on screen\r\n * @param y Y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param ray Ray to use\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n */\r\n Scene.prototype.setPointerOverMesh = function (mesh) {\r\n this._inputManager.setPointerOverMesh(mesh);\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n Scene.prototype.getPointerOverMesh = function () {\r\n return this._inputManager.getPointerOverMesh();\r\n };\r\n // Misc.\r\n /** @hidden */\r\n Scene.prototype._rebuildGeometries = function () {\r\n for (var _i = 0, _a = this.geometries; _i < _a.length; _i++) {\r\n var geometry = _a[_i];\r\n geometry._rebuild();\r\n }\r\n for (var _b = 0, _c = this.meshes; _b < _c.length; _b++) {\r\n var mesh = _c[_b];\r\n mesh._rebuild();\r\n }\r\n if (this.postProcessManager) {\r\n this.postProcessManager._rebuild();\r\n }\r\n for (var _d = 0, _e = this._components; _d < _e.length; _d++) {\r\n var component = _e[_d];\r\n component.rebuild();\r\n }\r\n for (var _f = 0, _g = this.particleSystems; _f < _g.length; _f++) {\r\n var system = _g[_f];\r\n system.rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._rebuildTextures = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var texture = _a[_i];\r\n texture._rebuild();\r\n }\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n };\r\n // Tags\r\n Scene.prototype._getByTags = function (list, tagsQuery, forEach) {\r\n if (tagsQuery === undefined) {\r\n // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)\r\n return list;\r\n }\r\n var listByTags = [];\r\n forEach = forEach || (function (item) { return; });\r\n for (var i in list) {\r\n var item = list[i];\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_6__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_6__[\"Tags\"].MatchesQuery(item, tagsQuery)) {\r\n listByTags.push(item);\r\n forEach(item);\r\n }\r\n }\r\n return listByTags;\r\n };\r\n /**\r\n * Get a list of meshes by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Mesh\r\n */\r\n Scene.prototype.getMeshesByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.meshes, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of cameras by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Camera\r\n */\r\n Scene.prototype.getCamerasByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.cameras, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of lights by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Light\r\n */\r\n Scene.prototype.getLightsByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.lights, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of materials by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Material\r\n */\r\n Scene.prototype.getMaterialByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n Scene.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n Scene.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n Scene.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._renderingManager.getAutoClearDepthStencilSetup(index);\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockMaterialDirtyMechanism\", {\r\n /** Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync) */\r\n get: function () {\r\n return this._blockMaterialDirtyMechanism;\r\n },\r\n set: function (value) {\r\n if (this._blockMaterialDirtyMechanism === value) {\r\n return;\r\n }\r\n this._blockMaterialDirtyMechanism = value;\r\n if (!value) { // Do a complete update\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_AllDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials as dirty to trigger new shader compilation\r\n * @param flag defines the flag used to specify which material part must be marked as dirty\r\n * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty\r\n */\r\n Scene.prototype.markAllMaterialsAsDirty = function (flag, predicate) {\r\n if (this._blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.materials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (predicate && !predicate(material)) {\r\n continue;\r\n }\r\n material.markAsDirty(flag);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFile = function (url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].LoadFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFileAsync = function (url, useOfflineSupport, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, useOfflineSupport, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /** The fog is deactivated */\r\n Scene.FOGMODE_NONE = 0;\r\n /** The fog density is following an exponential function */\r\n Scene.FOGMODE_EXP = 1;\r\n /** The fog density is following an exponential function faster than FOGMODE_EXP */\r\n Scene.FOGMODE_EXP2 = 2;\r\n /** The fog density is following a linear function. */\r\n Scene.FOGMODE_LINEAR = 3;\r\n /**\r\n * Gets or sets the minimum deltatime when deterministic lock step is enabled\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MinDeltaTime = 1.0;\r\n /**\r\n * Gets or sets the maximum deltatime when deterministic lock step is enabled\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MaxDeltaTime = 1000.0;\r\n return Scene;\r\n}(_abstractScene__WEBPACK_IMPORTED_MODULE_11__[\"AbstractScene\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./sceneComponent.ts\":\n/*!***************************!*\\\n !*** ./sceneComponent.ts ***!\n \\***************************/\n/*! exports provided: SceneComponentConstants, Stage */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneComponentConstants\", function() { return SceneComponentConstants; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Stage\", function() { return Stage; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * Groups all the scene component constants in one place to ease maintenance.\r\n * @hidden\r\n */\r\nvar SceneComponentConstants = /** @class */ (function () {\r\n function SceneComponentConstants() {\r\n }\r\n SceneComponentConstants.NAME_EFFECTLAYER = \"EffectLayer\";\r\n SceneComponentConstants.NAME_LAYER = \"Layer\";\r\n SceneComponentConstants.NAME_LENSFLARESYSTEM = \"LensFlareSystem\";\r\n SceneComponentConstants.NAME_BOUNDINGBOXRENDERER = \"BoundingBoxRenderer\";\r\n SceneComponentConstants.NAME_PARTICLESYSTEM = \"ParticleSystem\";\r\n SceneComponentConstants.NAME_GAMEPAD = \"Gamepad\";\r\n SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE = \"SimplificationQueue\";\r\n SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER = \"GeometryBufferRenderer\";\r\n SceneComponentConstants.NAME_DEPTHRENDERER = \"DepthRenderer\";\r\n SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER = \"PostProcessRenderPipelineManager\";\r\n SceneComponentConstants.NAME_SPRITE = \"Sprite\";\r\n SceneComponentConstants.NAME_OUTLINERENDERER = \"Outline\";\r\n SceneComponentConstants.NAME_PROCEDURALTEXTURE = \"ProceduralTexture\";\r\n SceneComponentConstants.NAME_SHADOWGENERATOR = \"ShadowGenerator\";\r\n SceneComponentConstants.NAME_OCTREE = \"Octree\";\r\n SceneComponentConstants.NAME_PHYSICSENGINE = \"PhysicsEngine\";\r\n SceneComponentConstants.NAME_AUDIO = \"Audio\";\r\n SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER = 1;\r\n SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_BEFORERENDERINGMESH_OUTLINE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGMESH_OUTLINE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1;\r\n SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 2;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 3;\r\n SceneComponentConstants.STEP_AFTERRENDER_AUDIO = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;\r\n SceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0;\r\n SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERUP_SPRITE = 0;\r\n return SceneComponentConstants;\r\n}());\r\n\r\n/**\r\n * Repressentation of a stage in the scene (Basically a list of ordered steps)\r\n * @hidden\r\n */\r\nvar Stage = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Stage, _super);\r\n /**\r\n * Hide ctor from the rest of the world.\r\n * @param items The items to add.\r\n */\r\n function Stage(items) {\r\n return _super.apply(this, items) || this;\r\n }\r\n /**\r\n * Creates a new Stage.\r\n * @returns A new instance of a Stage\r\n */\r\n Stage.Create = function () {\r\n return Object.create(Stage.prototype);\r\n };\r\n /**\r\n * Registers a step in an ordered way in the targeted stage.\r\n * @param index Defines the position to register the step in\r\n * @param component Defines the component attached to the step\r\n * @param action Defines the action to launch during the step\r\n */\r\n Stage.prototype.registerStep = function (index, component, action) {\r\n var i = 0;\r\n var maxIndex = Number.MAX_VALUE;\r\n for (; i < this.length; i++) {\r\n var step = this[i];\r\n maxIndex = step.index;\r\n if (index < maxIndex) {\r\n break;\r\n }\r\n }\r\n this.splice(i, 0, { index: index, component: component, action: action.bind(component) });\r\n };\r\n /**\r\n * Clears all the steps from the stage.\r\n */\r\n Stage.prototype.clear = function () {\r\n this.length = 0;\r\n };\r\n return Stage;\r\n}(Array));\r\n\r\n\n\n/***/ })\n\n/******/ });\n});\n//# sourceMappingURL=babylon.max.js.map\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"../node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack://BabylonViewer/../dist/preview_release/babylon.max.js?"); +eval("/* WEBPACK VAR INJECTION */(function(global) {(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse {}\n})((typeof self !== \"undefined\" ? self : typeof global !== \"undefined\" ? global : this), function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./Legacy/legacy.ts\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"../node_modules/tslib/tslib.es6.js\":\n/*!******************************************!*\\\n !*** ../node_modules/tslib/tslib.es6.js ***!\n \\******************************************/\n/*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__extends\", function() { return __extends; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__assign\", function() { return __assign; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__rest\", function() { return __rest; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__decorate\", function() { return __decorate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__param\", function() { return __param; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__metadata\", function() { return __metadata; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__awaiter\", function() { return __awaiter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__generator\", function() { return __generator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__exportStar\", function() { return __exportStar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__values\", function() { return __values; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__read\", function() { return __read; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__spread\", function() { return __spread; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__await\", function() { return __await; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncGenerator\", function() { return __asyncGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncDelegator\", function() { return __asyncDelegator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncValues\", function() { return __asyncValues; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__makeTemplateObject\", function() { return __makeTemplateObject; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__importStar\", function() { return __importStar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__importDefault\", function() { return __importDefault; });\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nfunction __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nfunction __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nfunction __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nfunction __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nfunction __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nfunction __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nfunction __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nfunction __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nfunction __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n/***/ }),\n\n/***/ \"../node_modules/webpack/buildin/global.js\":\n/*!*************************************************!*\\\n !*** ../node_modules/webpack/buildin/global.js ***!\n \\*************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n/***/ }),\n\n/***/ \"./Actions/abstractActionManager.ts\":\n/*!******************************************!*\\\n !*** ./Actions/abstractActionManager.ts ***!\n \\******************************************/\n/*! exports provided: AbstractActionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return AbstractActionManager; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n/**\r\n * Abstract class used to decouple action Manager from scene and meshes.\r\n * Do not instantiate.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar AbstractActionManager = /** @class */ (function () {\r\n function AbstractActionManager() {\r\n /** Gets the cursor to use when hovering items */\r\n this.hoverCursor = '';\r\n /** Gets the list of actions */\r\n this.actions = new Array();\r\n /**\r\n * Gets or sets a boolean indicating that the manager is recursive meaning that it can trigger action from children\r\n */\r\n this.isRecursive = false;\r\n }\r\n Object.defineProperty(AbstractActionManager, \"HasTriggers\", {\r\n /**\r\n * Does exist one action manager with at least one trigger\r\n **/\r\n get: function () {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractActionManager, \"HasPickTriggers\", {\r\n /**\r\n * Does exist one action manager with at least one pick trigger\r\n **/\r\n get: function () {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n var t_int = parseInt(t);\r\n if (t_int >= _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].ACTION_OnPickTrigger && t_int <= _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].ACTION_OnPickUpTrigger) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Does exist one action manager that handles actions of a given trigger\r\n * @param trigger defines the trigger to be tested\r\n * @return a boolean indicating whether the trigger is handeled by at least one action manager\r\n **/\r\n AbstractActionManager.HasSpecificTrigger = function (trigger) {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n var t_int = parseInt(t);\r\n if (t_int === trigger) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** Gets the list of active triggers */\r\n AbstractActionManager.Triggers = {};\r\n return AbstractActionManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/action.ts\":\n/*!***************************!*\\\n !*** ./Actions/action.ts ***!\n \\***************************/\n/*! exports provided: Action */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return Action; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The action to be carried out following a trigger\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#available-actions\r\n */\r\nvar Action = /** @class */ (function () {\r\n /**\r\n * Creates a new Action\r\n * @param triggerOptions the trigger, with or without parameters, for the action\r\n * @param condition an optional determinant of action\r\n */\r\n function Action(\r\n /** the trigger, with or without parameters, for the action */\r\n triggerOptions, condition) {\r\n this.triggerOptions = triggerOptions;\r\n /**\r\n * An event triggered prior to action being executed.\r\n */\r\n this.onBeforeExecuteObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n if (triggerOptions.parameter) {\r\n this.trigger = triggerOptions.trigger;\r\n this._triggerParameter = triggerOptions.parameter;\r\n }\r\n else if (triggerOptions.trigger) {\r\n this.trigger = triggerOptions.trigger;\r\n }\r\n else {\r\n this.trigger = triggerOptions;\r\n }\r\n this._nextActiveAction = this;\r\n this._condition = condition;\r\n }\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action.prototype._prepare = function () {\r\n };\r\n /**\r\n * Gets the trigger parameters\r\n * @returns the trigger parameters\r\n */\r\n Action.prototype.getTriggerParameter = function () {\r\n return this._triggerParameter;\r\n };\r\n /**\r\n * Internal only - executes current action event\r\n * @hidden\r\n */\r\n Action.prototype._executeCurrent = function (evt) {\r\n if (this._nextActiveAction._condition) {\r\n var condition = this._nextActiveAction._condition;\r\n var currentRenderId = this._actionManager.getScene().getRenderId();\r\n // We cache the current evaluation for the current frame\r\n if (condition._evaluationId === currentRenderId) {\r\n if (!condition._currentResult) {\r\n return;\r\n }\r\n }\r\n else {\r\n condition._evaluationId = currentRenderId;\r\n if (!condition.isValid()) {\r\n condition._currentResult = false;\r\n return;\r\n }\r\n condition._currentResult = true;\r\n }\r\n }\r\n this.onBeforeExecuteObservable.notifyObservers(this);\r\n this._nextActiveAction.execute(evt);\r\n this.skipToNextActiveAction();\r\n };\r\n /**\r\n * Execute placeholder for child classes\r\n * @param evt optional action event\r\n */\r\n Action.prototype.execute = function (evt) {\r\n };\r\n /**\r\n * Skips to next active action\r\n */\r\n Action.prototype.skipToNextActiveAction = function () {\r\n if (this._nextActiveAction._child) {\r\n if (!this._nextActiveAction._child._actionManager) {\r\n this._nextActiveAction._child._actionManager = this._actionManager;\r\n }\r\n this._nextActiveAction = this._nextActiveAction._child;\r\n }\r\n else {\r\n this._nextActiveAction = this;\r\n }\r\n };\r\n /**\r\n * Adds action to chain of actions, may be a DoNothingAction\r\n * @param action defines the next action to execute\r\n * @returns The action passed in\r\n * @see https://www.babylonjs-playground.com/#1T30HR#0\r\n */\r\n Action.prototype.then = function (action) {\r\n this._child = action;\r\n action._actionManager = this._actionManager;\r\n action._prepare();\r\n return action;\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action.prototype._getProperty = function (propertyPath) {\r\n return this._actionManager._getProperty(propertyPath);\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action.prototype._getEffectiveTarget = function (target, propertyPath) {\r\n return this._actionManager._getEffectiveTarget(target, propertyPath);\r\n };\r\n /**\r\n * Serialize placeholder for child classes\r\n * @param parent of child\r\n * @returns the serialized object\r\n */\r\n Action.prototype.serialize = function (parent) {\r\n };\r\n /**\r\n * Internal only called by serialize\r\n * @hidden\r\n */\r\n Action.prototype._serialize = function (serializedAction, parent) {\r\n var serializationObject = {\r\n type: 1,\r\n children: [],\r\n name: serializedAction.name,\r\n properties: serializedAction.properties || []\r\n };\r\n // Serialize child\r\n if (this._child) {\r\n this._child.serialize(serializationObject);\r\n }\r\n // Check if \"this\" has a condition\r\n if (this._condition) {\r\n var serializedCondition = this._condition.serialize();\r\n serializedCondition.children.push(serializationObject);\r\n if (parent) {\r\n parent.children.push(serializedCondition);\r\n }\r\n return serializedCondition;\r\n }\r\n if (parent) {\r\n parent.children.push(serializationObject);\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action._SerializeValueAsString = function (value) {\r\n if (typeof value === \"number\") {\r\n return value.toString();\r\n }\r\n if (typeof value === \"boolean\") {\r\n return value ? \"true\" : \"false\";\r\n }\r\n if (value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"]) {\r\n return value.x + \", \" + value.y;\r\n }\r\n if (value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]) {\r\n return value.x + \", \" + value.y + \", \" + value.z;\r\n }\r\n if (value instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"]) {\r\n return value.r + \", \" + value.g + \", \" + value.b;\r\n }\r\n if (value instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"]) {\r\n return value.r + \", \" + value.g + \", \" + value.b + \", \" + value.a;\r\n }\r\n return value; // string\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Action._GetTargetProperty = function (target) {\r\n return {\r\n name: \"target\",\r\n targetType: target._isMesh ? \"MeshProperties\"\r\n : target._isLight ? \"LightProperties\"\r\n : target._isCamera ? \"CameraProperties\"\r\n : \"SceneProperties\",\r\n value: target._isScene ? \"Scene\" : target.name\r\n };\r\n };\r\n return Action;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Action\"] = Action;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/actionEvent.ts\":\n/*!********************************!*\\\n !*** ./Actions/actionEvent.ts ***!\n \\********************************/\n/*! exports provided: ActionEvent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return ActionEvent; });\n/**\r\n * ActionEvent is the event being sent when an action is triggered.\r\n */\r\nvar ActionEvent = /** @class */ (function () {\r\n /**\r\n * Creates a new ActionEvent\r\n * @param source The mesh or sprite that triggered the action\r\n * @param pointerX The X mouse cursor position at the time of the event\r\n * @param pointerY The Y mouse cursor position at the time of the event\r\n * @param meshUnderPointer The mesh that is currently pointed at (can be null)\r\n * @param sourceEvent the original (browser) event that triggered the ActionEvent\r\n * @param additionalData additional data for the event\r\n */\r\n function ActionEvent(\r\n /** The mesh or sprite that triggered the action */\r\n source, \r\n /** The X mouse cursor position at the time of the event */\r\n pointerX, \r\n /** The Y mouse cursor position at the time of the event */\r\n pointerY, \r\n /** The mesh that is currently pointed at (can be null) */\r\n meshUnderPointer, \r\n /** the original (browser) event that triggered the ActionEvent */\r\n sourceEvent, \r\n /** additional data for the event */\r\n additionalData) {\r\n this.source = source;\r\n this.pointerX = pointerX;\r\n this.pointerY = pointerY;\r\n this.meshUnderPointer = meshUnderPointer;\r\n this.sourceEvent = sourceEvent;\r\n this.additionalData = additionalData;\r\n }\r\n /**\r\n * Helper function to auto-create an ActionEvent from a source mesh.\r\n * @param source The source mesh that triggered the event\r\n * @param evt The original (browser) event\r\n * @param additionalData additional data for the event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNew = function (source, evt, additionalData) {\r\n var scene = source.getScene();\r\n return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer || source, evt, additionalData);\r\n };\r\n /**\r\n * Helper function to auto-create an ActionEvent from a source sprite\r\n * @param source The source sprite that triggered the event\r\n * @param scene Scene associated with the sprite\r\n * @param evt The original (browser) event\r\n * @param additionalData additional data for the event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNewFromSprite = function (source, scene, evt, additionalData) {\r\n return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);\r\n };\r\n /**\r\n * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew\r\n * @param scene the scene where the event occurred\r\n * @param evt The original (browser) event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNewFromScene = function (scene, evt) {\r\n return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);\r\n };\r\n /**\r\n * Helper function to auto-create an ActionEvent from a primitive\r\n * @param prim defines the target primitive\r\n * @param pointerPos defines the pointer position\r\n * @param evt The original (browser) event\r\n * @param additionalData additional data for the event\r\n * @returns the new ActionEvent\r\n */\r\n ActionEvent.CreateNewFromPrimitive = function (prim, pointerPos, evt, additionalData) {\r\n return new ActionEvent(prim, pointerPos.x, pointerPos.y, null, evt, additionalData);\r\n };\r\n return ActionEvent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/actionManager.ts\":\n/*!**********************************!*\\\n !*** ./Actions/actionManager.ts ***!\n \\**********************************/\n/*! exports provided: ActionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return ActionManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _condition__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./condition */ \"./Actions/condition.ts\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _directActions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./directActions */ \"./Actions/directActions.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _abstractActionManager__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./abstractActionManager */ \"./Actions/abstractActionManager.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Action Manager manages all events to be triggered on a given mesh or the global scene.\r\n * A single scene can have many Action Managers to handle predefined actions on specific meshes.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar ActionManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ActionManager, _super);\r\n /**\r\n * Creates a new action manager\r\n * @param scene defines the hosting scene\r\n */\r\n function ActionManager(scene) {\r\n var _this = _super.call(this) || this;\r\n _this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n scene.actionManagers.push(_this);\r\n return _this;\r\n }\r\n // Methods\r\n /**\r\n * Releases all associated resources\r\n */\r\n ActionManager.prototype.dispose = function () {\r\n var index = this._scene.actionManagers.indexOf(this);\r\n for (var i = 0; i < this.actions.length; i++) {\r\n var action = this.actions[i];\r\n ActionManager.Triggers[action.trigger]--;\r\n if (ActionManager.Triggers[action.trigger] === 0) {\r\n delete ActionManager.Triggers[action.trigger];\r\n }\r\n }\r\n if (index > -1) {\r\n this._scene.actionManagers.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Gets hosting scene\r\n * @returns the hosting scene\r\n */\r\n ActionManager.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Does this action manager handles actions of any of the given triggers\r\n * @param triggers defines the triggers to be tested\r\n * @return a boolean indicating whether one (or more) of the triggers is handled\r\n */\r\n ActionManager.prototype.hasSpecificTriggers = function (triggers) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (triggers.indexOf(action.trigger) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Does this action manager handles actions of any of the given triggers. This function takes two arguments for\r\n * speed.\r\n * @param triggerA defines the trigger to be tested\r\n * @param triggerB defines the trigger to be tested\r\n * @return a boolean indicating whether one (or more) of the triggers is handled\r\n */\r\n ActionManager.prototype.hasSpecificTriggers2 = function (triggerA, triggerB) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (triggerA == action.trigger || triggerB == action.trigger) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Does this action manager handles actions of a given trigger\r\n * @param trigger defines the trigger to be tested\r\n * @param parameterPredicate defines an optional predicate to filter triggers by parameter\r\n * @return whether the trigger is handled\r\n */\r\n ActionManager.prototype.hasSpecificTrigger = function (trigger, parameterPredicate) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger === trigger) {\r\n if (parameterPredicate) {\r\n if (parameterPredicate(action.getTriggerParameter())) {\r\n return true;\r\n }\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(ActionManager.prototype, \"hasPointerTriggers\", {\r\n /**\r\n * Does this action manager has pointer triggers\r\n */\r\n get: function () {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger >= ActionManager.OnPickTrigger && action.trigger <= ActionManager.OnPointerOutTrigger) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ActionManager.prototype, \"hasPickTriggers\", {\r\n /**\r\n * Does this action manager has pick triggers\r\n */\r\n get: function () {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger >= ActionManager.OnPickTrigger && action.trigger <= ActionManager.OnPickUpTrigger) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers an action to this action manager\r\n * @param action defines the action to be registered\r\n * @return the action amended (prepared) after registration\r\n */\r\n ActionManager.prototype.registerAction = function (action) {\r\n if (action.trigger === ActionManager.OnEveryFrameTrigger) {\r\n if (this.getScene().actionManager !== this) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_7__[\"Logger\"].Warn(\"OnEveryFrameTrigger can only be used with scene.actionManager\");\r\n return null;\r\n }\r\n }\r\n this.actions.push(action);\r\n if (ActionManager.Triggers[action.trigger]) {\r\n ActionManager.Triggers[action.trigger]++;\r\n }\r\n else {\r\n ActionManager.Triggers[action.trigger] = 1;\r\n }\r\n action._actionManager = this;\r\n action._prepare();\r\n return action;\r\n };\r\n /**\r\n * Unregisters an action to this action manager\r\n * @param action defines the action to be unregistered\r\n * @return a boolean indicating whether the action has been unregistered\r\n */\r\n ActionManager.prototype.unregisterAction = function (action) {\r\n var index = this.actions.indexOf(action);\r\n if (index !== -1) {\r\n this.actions.splice(index, 1);\r\n ActionManager.Triggers[action.trigger] -= 1;\r\n if (ActionManager.Triggers[action.trigger] === 0) {\r\n delete ActionManager.Triggers[action.trigger];\r\n }\r\n delete action._actionManager;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Process a specific trigger\r\n * @param trigger defines the trigger to process\r\n * @param evt defines the event details to be processed\r\n */\r\n ActionManager.prototype.processTrigger = function (trigger, evt) {\r\n for (var index = 0; index < this.actions.length; index++) {\r\n var action = this.actions[index];\r\n if (action.trigger === trigger) {\r\n if (evt) {\r\n if (trigger === ActionManager.OnKeyUpTrigger\r\n || trigger === ActionManager.OnKeyDownTrigger) {\r\n var parameter = action.getTriggerParameter();\r\n if (parameter && parameter !== evt.sourceEvent.keyCode) {\r\n if (!parameter.toLowerCase) {\r\n continue;\r\n }\r\n var lowerCase = parameter.toLowerCase();\r\n if (lowerCase !== evt.sourceEvent.key) {\r\n var unicode = evt.sourceEvent.charCode ? evt.sourceEvent.charCode : evt.sourceEvent.keyCode;\r\n var actualkey = String.fromCharCode(unicode).toLowerCase();\r\n if (actualkey !== lowerCase) {\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n action._executeCurrent(evt);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n ActionManager.prototype._getEffectiveTarget = function (target, propertyPath) {\r\n var properties = propertyPath.split(\".\");\r\n for (var index = 0; index < properties.length - 1; index++) {\r\n target = target[properties[index]];\r\n }\r\n return target;\r\n };\r\n /** @hidden */\r\n ActionManager.prototype._getProperty = function (propertyPath) {\r\n var properties = propertyPath.split(\".\");\r\n return properties[properties.length - 1];\r\n };\r\n /**\r\n * Serialize this manager to a JSON object\r\n * @param name defines the property name to store this manager\r\n * @returns a JSON representation of this manager\r\n */\r\n ActionManager.prototype.serialize = function (name) {\r\n var root = {\r\n children: new Array(),\r\n name: name,\r\n type: 3,\r\n properties: new Array() // Empty for root but required\r\n };\r\n for (var i = 0; i < this.actions.length; i++) {\r\n var triggerObject = {\r\n type: 0,\r\n children: new Array(),\r\n name: ActionManager.GetTriggerName(this.actions[i].trigger),\r\n properties: new Array()\r\n };\r\n var triggerOptions = this.actions[i].triggerOptions;\r\n if (triggerOptions && typeof triggerOptions !== \"number\") {\r\n if (triggerOptions.parameter instanceof Node) {\r\n triggerObject.properties.push(_action__WEBPACK_IMPORTED_MODULE_4__[\"Action\"]._GetTargetProperty(triggerOptions.parameter));\r\n }\r\n else {\r\n var parameter = {};\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_8__[\"DeepCopier\"].DeepCopy(triggerOptions.parameter, parameter, [\"mesh\"]);\r\n if (triggerOptions.parameter && triggerOptions.parameter.mesh) {\r\n parameter._meshId = triggerOptions.parameter.mesh.id;\r\n }\r\n triggerObject.properties.push({ name: \"parameter\", targetType: null, value: parameter });\r\n }\r\n }\r\n // Serialize child action, recursively\r\n this.actions[i].serialize(triggerObject);\r\n // Add serialized trigger\r\n root.children.push(triggerObject);\r\n }\r\n return root;\r\n };\r\n /**\r\n * Creates a new ActionManager from a JSON data\r\n * @param parsedActions defines the JSON data to read from\r\n * @param object defines the hosting mesh\r\n * @param scene defines the hosting scene\r\n */\r\n ActionManager.Parse = function (parsedActions, object, scene) {\r\n var actionManager = new ActionManager(scene);\r\n if (object === null) {\r\n scene.actionManager = actionManager;\r\n }\r\n else {\r\n object.actionManager = actionManager;\r\n }\r\n // instanciate a new object\r\n var instanciate = function (name, params) {\r\n var internalClassType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_9__[\"_TypeStore\"].GetClass(\"BABYLON.\" + name);\r\n if (internalClassType) {\r\n var newInstance = Object.create(internalClassType.prototype);\r\n newInstance.constructor.apply(newInstance, params);\r\n return newInstance;\r\n }\r\n };\r\n var parseParameter = function (name, value, target, propertyPath) {\r\n if (propertyPath === null) {\r\n // String, boolean or float\r\n var floatValue = parseFloat(value);\r\n if (value === \"true\" || value === \"false\") {\r\n return value === \"true\";\r\n }\r\n else {\r\n return isNaN(floatValue) ? value : floatValue;\r\n }\r\n }\r\n var effectiveTarget = propertyPath.split(\".\");\r\n var values = value.split(\",\");\r\n // Get effective Target\r\n for (var i = 0; i < effectiveTarget.length; i++) {\r\n target = target[effectiveTarget[i]];\r\n }\r\n // Return appropriate value with its type\r\n if (typeof (target) === \"boolean\") {\r\n return values[0] === \"true\";\r\n }\r\n if (typeof (target) === \"string\") {\r\n return values[0];\r\n }\r\n // Parameters with multiple values such as Vector3 etc.\r\n var split = new Array();\r\n for (var i = 0; i < values.length; i++) {\r\n split.push(parseFloat(values[i]));\r\n }\r\n if (target instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(split);\r\n }\r\n if (target instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"]) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"].FromArray(split);\r\n }\r\n if (target instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"]) {\r\n return _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].FromArray(split);\r\n }\r\n if (target instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"]) {\r\n return _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"].FromArray(split);\r\n }\r\n return parseFloat(values[0]);\r\n };\r\n // traverse graph per trigger\r\n var traverse = function (parsedAction, trigger, condition, action, combineArray) {\r\n if (combineArray === void 0) { combineArray = null; }\r\n if (parsedAction.detached) {\r\n return;\r\n }\r\n var parameters = new Array();\r\n var target = null;\r\n var propertyPath = null;\r\n var combine = parsedAction.combine && parsedAction.combine.length > 0;\r\n // Parameters\r\n if (parsedAction.type === 2) {\r\n parameters.push(actionManager);\r\n }\r\n else {\r\n parameters.push(trigger);\r\n }\r\n if (combine) {\r\n var actions = new Array();\r\n for (var j = 0; j < parsedAction.combine.length; j++) {\r\n traverse(parsedAction.combine[j], ActionManager.NothingTrigger, condition, action, actions);\r\n }\r\n parameters.push(actions);\r\n }\r\n else {\r\n for (var i = 0; i < parsedAction.properties.length; i++) {\r\n var value = parsedAction.properties[i].value;\r\n var name = parsedAction.properties[i].name;\r\n var targetType = parsedAction.properties[i].targetType;\r\n if (name === \"target\") {\r\n if (targetType !== null && targetType === \"SceneProperties\") {\r\n value = target = scene;\r\n }\r\n else {\r\n value = target = scene.getNodeByName(value);\r\n }\r\n }\r\n else if (name === \"parent\") {\r\n value = scene.getNodeByName(value);\r\n }\r\n else if (name === \"sound\") {\r\n // Can not externalize to component, so only checks for the presence off the API.\r\n if (scene.getSoundByName) {\r\n value = scene.getSoundByName(value);\r\n }\r\n }\r\n else if (name !== \"propertyPath\") {\r\n if (parsedAction.type === 2 && name === \"operator\") {\r\n value = _condition__WEBPACK_IMPORTED_MODULE_3__[\"ValueCondition\"][value];\r\n }\r\n else {\r\n value = parseParameter(name, value, target, name === \"value\" ? propertyPath : null);\r\n }\r\n }\r\n else {\r\n propertyPath = value;\r\n }\r\n parameters.push(value);\r\n }\r\n }\r\n if (combineArray === null) {\r\n parameters.push(condition);\r\n }\r\n else {\r\n parameters.push(null);\r\n }\r\n // If interpolate value action\r\n if (parsedAction.name === \"InterpolateValueAction\") {\r\n var param = parameters[parameters.length - 2];\r\n parameters[parameters.length - 1] = param;\r\n parameters[parameters.length - 2] = condition;\r\n }\r\n // Action or condition(s) and not CombineAction\r\n var newAction = instanciate(parsedAction.name, parameters);\r\n if (newAction instanceof _condition__WEBPACK_IMPORTED_MODULE_3__[\"Condition\"] && condition !== null) {\r\n var nothing = new _directActions__WEBPACK_IMPORTED_MODULE_5__[\"DoNothingAction\"](trigger, condition);\r\n if (action) {\r\n action.then(nothing);\r\n }\r\n else {\r\n actionManager.registerAction(nothing);\r\n }\r\n action = nothing;\r\n }\r\n if (combineArray === null) {\r\n if (newAction instanceof _condition__WEBPACK_IMPORTED_MODULE_3__[\"Condition\"]) {\r\n condition = newAction;\r\n newAction = action;\r\n }\r\n else {\r\n condition = null;\r\n if (action) {\r\n action.then(newAction);\r\n }\r\n else {\r\n actionManager.registerAction(newAction);\r\n }\r\n }\r\n }\r\n else {\r\n combineArray.push(newAction);\r\n }\r\n for (var i = 0; i < parsedAction.children.length; i++) {\r\n traverse(parsedAction.children[i], trigger, condition, newAction, null);\r\n }\r\n };\r\n // triggers\r\n for (var i = 0; i < parsedActions.children.length; i++) {\r\n var triggerParams;\r\n var trigger = parsedActions.children[i];\r\n if (trigger.properties.length > 0) {\r\n var param = trigger.properties[0].value;\r\n var value = trigger.properties[0].targetType === null ? param : scene.getMeshByName(param);\r\n if (value._meshId) {\r\n value.mesh = scene.getMeshByID(value._meshId);\r\n }\r\n triggerParams = { trigger: ActionManager[trigger.name], parameter: value };\r\n }\r\n else {\r\n triggerParams = ActionManager[trigger.name];\r\n }\r\n for (var j = 0; j < trigger.children.length; j++) {\r\n if (!trigger.detached) {\r\n traverse(trigger.children[j], triggerParams, null, null);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Get a trigger name by index\r\n * @param trigger defines the trigger index\r\n * @returns a trigger name\r\n */\r\n ActionManager.GetTriggerName = function (trigger) {\r\n switch (trigger) {\r\n case 0: return \"NothingTrigger\";\r\n case 1: return \"OnPickTrigger\";\r\n case 2: return \"OnLeftPickTrigger\";\r\n case 3: return \"OnRightPickTrigger\";\r\n case 4: return \"OnCenterPickTrigger\";\r\n case 5: return \"OnPickDownTrigger\";\r\n case 6: return \"OnPickUpTrigger\";\r\n case 7: return \"OnLongPressTrigger\";\r\n case 8: return \"OnPointerOverTrigger\";\r\n case 9: return \"OnPointerOutTrigger\";\r\n case 10: return \"OnEveryFrameTrigger\";\r\n case 11: return \"OnIntersectionEnterTrigger\";\r\n case 12: return \"OnIntersectionExitTrigger\";\r\n case 13: return \"OnKeyDownTrigger\";\r\n case 14: return \"OnKeyUpTrigger\";\r\n case 15: return \"OnPickOutTrigger\";\r\n default: return \"\";\r\n }\r\n };\r\n /**\r\n * Nothing\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.NothingTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_NothingTrigger;\r\n /**\r\n * On pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickTrigger;\r\n /**\r\n * On left pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnLeftPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnLeftPickTrigger;\r\n /**\r\n * On right pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnRightPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnRightPickTrigger;\r\n /**\r\n * On center pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnCenterPickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnCenterPickTrigger;\r\n /**\r\n * On pick down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickDownTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickDownTrigger;\r\n /**\r\n * On double pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnDoublePickTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnDoublePickTrigger;\r\n /**\r\n * On pick up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickUpTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickUpTrigger;\r\n /**\r\n * On pick out.\r\n * This trigger will only be raised if you also declared a OnPickDown\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPickOutTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPickOutTrigger;\r\n /**\r\n * On long press\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnLongPressTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnLongPressTrigger;\r\n /**\r\n * On pointer over\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPointerOverTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPointerOverTrigger;\r\n /**\r\n * On pointer out\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnPointerOutTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnPointerOutTrigger;\r\n /**\r\n * On every frame\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnEveryFrameTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnEveryFrameTrigger;\r\n /**\r\n * On intersection enter\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnIntersectionEnterTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnIntersectionEnterTrigger;\r\n /**\r\n * On intersection exit\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnIntersectionExitTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnIntersectionExitTrigger;\r\n /**\r\n * On key down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnKeyDownTrigger = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ACTION_OnKeyDownTrigger;\r\n /**\r\n * On key up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n ActionManager.OnKeyUpTrigger = 15;\r\n return ActionManager;\r\n}(_abstractActionManager__WEBPACK_IMPORTED_MODULE_10__[\"AbstractActionManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/condition.ts\":\n/*!******************************!*\\\n !*** ./Actions/condition.ts ***!\n \\******************************/\n/*! exports provided: Condition, ValueCondition, PredicateCondition, StateCondition */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return Condition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return ValueCondition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return PredicateCondition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return StateCondition; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n/**\r\n * A Condition applied to an Action\r\n */\r\nvar Condition = /** @class */ (function () {\r\n /**\r\n * Creates a new Condition\r\n * @param actionManager the manager of the action the condition is applied to\r\n */\r\n function Condition(actionManager) {\r\n this._actionManager = actionManager;\r\n }\r\n /**\r\n * Check if the current condition is valid\r\n * @returns a boolean\r\n */\r\n Condition.prototype.isValid = function () {\r\n return true;\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Condition.prototype._getProperty = function (propertyPath) {\r\n return this._actionManager._getProperty(propertyPath);\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Condition.prototype._getEffectiveTarget = function (target, propertyPath) {\r\n return this._actionManager._getEffectiveTarget(target, propertyPath);\r\n };\r\n /**\r\n * Serialize placeholder for child classes\r\n * @returns the serialized object\r\n */\r\n Condition.prototype.serialize = function () {\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n Condition.prototype._serialize = function (serializedCondition) {\r\n return {\r\n type: 2,\r\n children: [],\r\n name: serializedCondition.name,\r\n properties: serializedCondition.properties\r\n };\r\n };\r\n return Condition;\r\n}());\r\n\r\n/**\r\n * Defines specific conditional operators as extensions of Condition\r\n */\r\nvar ValueCondition = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ValueCondition, _super);\r\n /**\r\n * Creates a new ValueCondition\r\n * @param actionManager manager for the action the condition applies to\r\n * @param target for the action\r\n * @param propertyPath path to specify the property of the target the conditional operator uses\r\n * @param value the value compared by the conditional operator against the current value of the property\r\n * @param operator the conditional operator, default ValueCondition.IsEqual\r\n */\r\n function ValueCondition(actionManager, target, \r\n /** path to specify the property of the target the conditional operator uses */\r\n propertyPath, \r\n /** the value compared by the conditional operator against the current value of the property */\r\n value, \r\n /** the conditional operator, default ValueCondition.IsEqual */\r\n operator) {\r\n if (operator === void 0) { operator = ValueCondition.IsEqual; }\r\n var _this = _super.call(this, actionManager) || this;\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this.operator = operator;\r\n _this._target = target;\r\n _this._effectiveTarget = _this._getEffectiveTarget(target, _this.propertyPath);\r\n _this._property = _this._getProperty(_this.propertyPath);\r\n return _this;\r\n }\r\n Object.defineProperty(ValueCondition, \"IsEqual\", {\r\n /**\r\n * returns the number for IsEqual\r\n */\r\n get: function () {\r\n return ValueCondition._IsEqual;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueCondition, \"IsDifferent\", {\r\n /**\r\n * Returns the number for IsDifferent\r\n */\r\n get: function () {\r\n return ValueCondition._IsDifferent;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueCondition, \"IsGreater\", {\r\n /**\r\n * Returns the number for IsGreater\r\n */\r\n get: function () {\r\n return ValueCondition._IsGreater;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueCondition, \"IsLesser\", {\r\n /**\r\n * Returns the number for IsLesser\r\n */\r\n get: function () {\r\n return ValueCondition._IsLesser;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Compares the given value with the property value for the specified conditional operator\r\n * @returns the result of the comparison\r\n */\r\n ValueCondition.prototype.isValid = function () {\r\n switch (this.operator) {\r\n case ValueCondition.IsGreater:\r\n return this._effectiveTarget[this._property] > this.value;\r\n case ValueCondition.IsLesser:\r\n return this._effectiveTarget[this._property] < this.value;\r\n case ValueCondition.IsEqual:\r\n case ValueCondition.IsDifferent:\r\n var check;\r\n if (this.value.equals) {\r\n check = this.value.equals(this._effectiveTarget[this._property]);\r\n }\r\n else {\r\n check = this.value === this._effectiveTarget[this._property];\r\n }\r\n return this.operator === ValueCondition.IsEqual ? check : !check;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Serialize the ValueCondition into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n ValueCondition.prototype.serialize = function () {\r\n return this._serialize({\r\n name: \"ValueCondition\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.value) },\r\n { name: \"operator\", value: ValueCondition.GetOperatorName(this.operator) }\r\n ]\r\n });\r\n };\r\n /**\r\n * Gets the name of the conditional operator for the ValueCondition\r\n * @param operator the conditional operator\r\n * @returns the name\r\n */\r\n ValueCondition.GetOperatorName = function (operator) {\r\n switch (operator) {\r\n case ValueCondition._IsEqual: return \"IsEqual\";\r\n case ValueCondition._IsDifferent: return \"IsDifferent\";\r\n case ValueCondition._IsGreater: return \"IsGreater\";\r\n case ValueCondition._IsLesser: return \"IsLesser\";\r\n default: return \"\";\r\n }\r\n };\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsEqual = 0;\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsDifferent = 1;\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsGreater = 2;\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n ValueCondition._IsLesser = 3;\r\n return ValueCondition;\r\n}(Condition));\r\n\r\n/**\r\n * Defines a predicate condition as an extension of Condition\r\n */\r\nvar PredicateCondition = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PredicateCondition, _super);\r\n /**\r\n * Creates a new PredicateCondition\r\n * @param actionManager manager for the action the condition applies to\r\n * @param predicate defines the predicate function used to validate the condition\r\n */\r\n function PredicateCondition(actionManager, \r\n /** defines the predicate function used to validate the condition */\r\n predicate) {\r\n var _this = _super.call(this, actionManager) || this;\r\n _this.predicate = predicate;\r\n return _this;\r\n }\r\n /**\r\n * @returns the validity of the predicate condition\r\n */\r\n PredicateCondition.prototype.isValid = function () {\r\n return this.predicate();\r\n };\r\n return PredicateCondition;\r\n}(Condition));\r\n\r\n/**\r\n * Defines a state condition as an extension of Condition\r\n */\r\nvar StateCondition = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StateCondition, _super);\r\n /**\r\n * Creates a new StateCondition\r\n * @param actionManager manager for the action the condition applies to\r\n * @param target of the condition\r\n * @param value to compare with target state\r\n */\r\n function StateCondition(actionManager, target, \r\n /** Value to compare with target state */\r\n value) {\r\n var _this = _super.call(this, actionManager) || this;\r\n _this.value = value;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /**\r\n * Gets a boolean indicating if the current condition is met\r\n * @returns the validity of the state\r\n */\r\n StateCondition.prototype.isValid = function () {\r\n return this._target.state === this.value;\r\n };\r\n /**\r\n * Serialize the StateCondition into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n StateCondition.prototype.serialize = function () {\r\n return this._serialize({\r\n name: \"StateCondition\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"value\", value: this.value }\r\n ]\r\n });\r\n };\r\n return StateCondition;\r\n}(Condition));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ValueCondition\"] = ValueCondition;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PredicateCondition\"] = PredicateCondition;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StateCondition\"] = StateCondition;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/directActions.ts\":\n/*!**********************************!*\\\n !*** ./Actions/directActions.ts ***!\n \\**********************************/\n/*! exports provided: SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return SwitchBooleanAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return SetStateAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return SetValueAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return IncrementValueAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return PlayAnimationAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return StopAnimationAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return DoNothingAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return CombineAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return ExecuteCodeAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return SetParentAction; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This defines an action responsible to toggle a boolean once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SwitchBooleanAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SwitchBooleanAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the boolean\r\n * @param propertyPath defines the path to the boolean property in the target object\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SwitchBooleanAction(triggerOptions, target, propertyPath, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.propertyPath = propertyPath;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n SwitchBooleanAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n };\r\n /**\r\n * Execute the action toggle the boolean value.\r\n */\r\n SwitchBooleanAction.prototype.execute = function () {\r\n this._effectiveTarget[this._property] = !this._effectiveTarget[this._property];\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SwitchBooleanAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SwitchBooleanAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath }\r\n ]\r\n }, parent);\r\n };\r\n return SwitchBooleanAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to set a the state field of the target\r\n * to a desired value once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SetStateAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SetStateAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the state property\r\n * @param value defines the value to store in the state field\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SetStateAction(triggerOptions, target, value, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.value = value;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /**\r\n * Execute the action and store the value on the target state property.\r\n */\r\n SetStateAction.prototype.execute = function () {\r\n this._target.state = this.value;\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SetStateAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SetStateAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"value\", value: this.value }\r\n ]\r\n }, parent);\r\n };\r\n return SetStateAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to set a property of the target\r\n * to a desired value once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SetValueAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SetValueAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the property\r\n * @param propertyPath defines the path of the property to set in the target\r\n * @param value defines the value to set in the property\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SetValueAction(triggerOptions, target, propertyPath, value, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n SetValueAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n };\r\n /**\r\n * Execute the action and set the targetted property to the desired value.\r\n */\r\n SetValueAction.prototype.execute = function () {\r\n this._effectiveTarget[this._property] = this.value;\r\n if (this._target.markAsDirty) {\r\n this._target.markAsDirty(this._property);\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SetValueAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SetValueAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._SerializeValueAsString(this.value) }\r\n ]\r\n }, parent);\r\n };\r\n return SetValueAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to increment the target value\r\n * to a desired value once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar IncrementValueAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](IncrementValueAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the property\r\n * @param propertyPath defines the path of the property to increment in the target\r\n * @param value defines the value value we should increment the property by\r\n * @param condition defines the trigger related conditions\r\n */\r\n function IncrementValueAction(triggerOptions, target, propertyPath, value, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n IncrementValueAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n if (typeof this._effectiveTarget[this._property] !== \"number\") {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Warning: IncrementValueAction can only be used with number values\");\r\n }\r\n };\r\n /**\r\n * Execute the action and increment the target of the value amount.\r\n */\r\n IncrementValueAction.prototype.execute = function () {\r\n this._effectiveTarget[this._property] += this.value;\r\n if (this._target.markAsDirty) {\r\n this._target.markAsDirty(this._property);\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n IncrementValueAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"IncrementValueAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._SerializeValueAsString(this.value) }\r\n ]\r\n }, parent);\r\n };\r\n return IncrementValueAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to start an animation once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar PlayAnimationAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlayAnimationAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the target animation or animation name\r\n * @param from defines from where the animation should start (animation frame)\r\n * @param end defines where the animation should stop (animation frame)\r\n * @param loop defines if the animation should loop or stop after the first play\r\n * @param condition defines the trigger related conditions\r\n */\r\n function PlayAnimationAction(triggerOptions, target, from, to, loop, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.from = from;\r\n _this.to = to;\r\n _this.loop = loop;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PlayAnimationAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and play the animation.\r\n */\r\n PlayAnimationAction.prototype.execute = function () {\r\n var scene = this._actionManager.getScene();\r\n scene.beginAnimation(this._target, this.from, this.to, this.loop);\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n PlayAnimationAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"PlayAnimationAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"from\", value: String(this.from) },\r\n { name: \"to\", value: String(this.to) },\r\n { name: \"loop\", value: _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._SerializeValueAsString(this.loop) || false }\r\n ]\r\n }, parent);\r\n };\r\n return PlayAnimationAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to stop an animation once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar StopAnimationAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StopAnimationAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the target animation or animation name\r\n * @param condition defines the trigger related conditions\r\n */\r\n function StopAnimationAction(triggerOptions, target, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._target = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n StopAnimationAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and stop the animation.\r\n */\r\n StopAnimationAction.prototype.execute = function () {\r\n var scene = this._actionManager.getScene();\r\n scene.stopAnimation(this._target);\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n StopAnimationAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"StopAnimationAction\",\r\n properties: [_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target)]\r\n }, parent);\r\n };\r\n return StopAnimationAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible that does nothing once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar DoNothingAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DoNothingAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param condition defines the trigger related conditions\r\n */\r\n function DoNothingAction(triggerOptions, condition) {\r\n if (triggerOptions === void 0) { triggerOptions = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].ACTION_NothingTrigger; }\r\n return _super.call(this, triggerOptions, condition) || this;\r\n }\r\n /**\r\n * Execute the action and do nothing.\r\n */\r\n DoNothingAction.prototype.execute = function () {\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n DoNothingAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"DoNothingAction\",\r\n properties: []\r\n }, parent);\r\n };\r\n return DoNothingAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to trigger several actions once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar CombineAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CombineAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param children defines the list of aggregated animations to run\r\n * @param condition defines the trigger related conditions\r\n */\r\n function CombineAction(triggerOptions, children, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.children = children;\r\n return _this;\r\n }\r\n /** @hidden */\r\n CombineAction.prototype._prepare = function () {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index]._actionManager = this._actionManager;\r\n this.children[index]._prepare();\r\n }\r\n };\r\n /**\r\n * Execute the action and executes all the aggregated actions.\r\n */\r\n CombineAction.prototype.execute = function (evt) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index].execute(evt);\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n CombineAction.prototype.serialize = function (parent) {\r\n var serializationObject = _super.prototype._serialize.call(this, {\r\n name: \"CombineAction\",\r\n properties: [],\r\n combine: []\r\n }, parent);\r\n for (var i = 0; i < this.children.length; i++) {\r\n serializationObject.combine.push(this.children[i].serialize(null));\r\n }\r\n return serializationObject;\r\n };\r\n return CombineAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to run code (external event) once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar ExecuteCodeAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ExecuteCodeAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param func defines the callback function to run\r\n * @param condition defines the trigger related conditions\r\n */\r\n function ExecuteCodeAction(triggerOptions, func, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this.func = func;\r\n return _this;\r\n }\r\n /**\r\n * Execute the action and run the attached code.\r\n */\r\n ExecuteCodeAction.prototype.execute = function (evt) {\r\n this.func(evt);\r\n };\r\n return ExecuteCodeAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action responsible to set the parent property of the target once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar SetParentAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SetParentAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the target containing the parent property\r\n * @param parent defines from where the animation should start (animation frame)\r\n * @param condition defines the trigger related conditions\r\n */\r\n function SetParentAction(triggerOptions, target, parent, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._target = target;\r\n _this._parent = parent;\r\n return _this;\r\n }\r\n /** @hidden */\r\n SetParentAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and set the parent property.\r\n */\r\n SetParentAction.prototype.execute = function () {\r\n if (this._target.parent === this._parent) {\r\n return;\r\n }\r\n var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();\r\n invertParentWorldMatrix.invert();\r\n this._target.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(this._target.position, invertParentWorldMatrix);\r\n this._target.parent = this._parent;\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n SetParentAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"SetParentAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._target),\r\n _action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]._GetTargetProperty(this._parent),\r\n ]\r\n }, parent);\r\n };\r\n return SetParentAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_3__[\"Action\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetParentAction\"] = SetParentAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ExecuteCodeAction\"] = ExecuteCodeAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DoNothingAction\"] = DoNothingAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StopAnimationAction\"] = StopAnimationAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PlayAnimationAction\"] = PlayAnimationAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.IncrementValueAction\"] = IncrementValueAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetValueAction\"] = SetValueAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetStateAction\"] = SetStateAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SetParentAction\"] = SetParentAction;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/directAudioActions.ts\":\n/*!***************************************!*\\\n !*** ./Actions/directAudioActions.ts ***!\n \\***************************************/\n/*! exports provided: PlaySoundAction, StopSoundAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return PlaySoundAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return StopSoundAction; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n/**\r\n * This defines an action helpful to play a defined sound on a triggered action.\r\n */\r\nvar PlaySoundAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlaySoundAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param sound defines the sound to play\r\n * @param condition defines the trigger related conditions\r\n */\r\n function PlaySoundAction(triggerOptions, sound, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._sound = sound;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PlaySoundAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and play the sound.\r\n */\r\n PlaySoundAction.prototype.execute = function () {\r\n if (this._sound !== undefined) {\r\n this._sound.play();\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n PlaySoundAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"PlaySoundAction\",\r\n properties: [{ name: \"sound\", value: this._sound.name }]\r\n }, parent);\r\n };\r\n return PlaySoundAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]));\r\n\r\n/**\r\n * This defines an action helpful to stop a defined sound on a triggered action.\r\n */\r\nvar StopSoundAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StopSoundAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param sound defines the sound to stop\r\n * @param condition defines the trigger related conditions\r\n */\r\n function StopSoundAction(triggerOptions, sound, condition) {\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n _this._sound = sound;\r\n return _this;\r\n }\r\n /** @hidden */\r\n StopSoundAction.prototype._prepare = function () {\r\n };\r\n /**\r\n * Execute the action and stop the sound.\r\n */\r\n StopSoundAction.prototype.execute = function () {\r\n if (this._sound !== undefined) {\r\n this._sound.stop();\r\n }\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n StopSoundAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"StopSoundAction\",\r\n properties: [{ name: \"sound\", value: this._sound.name }]\r\n }, parent);\r\n };\r\n return StopSoundAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PlaySoundAction\"] = StopSoundAction;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StopSoundAction\"] = StopSoundAction;\r\n\n\n/***/ }),\n\n/***/ \"./Actions/index.ts\":\n/*!**************************!*\\\n !*** ./Actions/index.ts ***!\n \\**************************/\n/*! exports provided: AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _abstractActionManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstractActionManager */ \"./Actions/abstractActionManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return _abstractActionManager__WEBPACK_IMPORTED_MODULE_0__[\"AbstractActionManager\"]; });\n\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]; });\n\n/* harmony import */ var _actionEvent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return _actionEvent__WEBPACK_IMPORTED_MODULE_2__[\"ActionEvent\"]; });\n\n/* harmony import */ var _actionManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./actionManager */ \"./Actions/actionManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return _actionManager__WEBPACK_IMPORTED_MODULE_3__[\"ActionManager\"]; });\n\n/* harmony import */ var _condition__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./condition */ \"./Actions/condition.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"Condition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"ValueCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"PredicateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return _condition__WEBPACK_IMPORTED_MODULE_4__[\"StateCondition\"]; });\n\n/* harmony import */ var _directActions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./directActions */ \"./Actions/directActions.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SwitchBooleanAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SetStateAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SetValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"IncrementValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"PlayAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"StopAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"DoNothingAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"CombineAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"ExecuteCodeAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return _directActions__WEBPACK_IMPORTED_MODULE_5__[\"SetParentAction\"]; });\n\n/* harmony import */ var _directAudioActions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./directAudioActions */ \"./Actions/directAudioActions.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return _directAudioActions__WEBPACK_IMPORTED_MODULE_6__[\"PlaySoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return _directAudioActions__WEBPACK_IMPORTED_MODULE_6__[\"StopSoundAction\"]; });\n\n/* harmony import */ var _interpolateValueAction__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./interpolateValueAction */ \"./Actions/interpolateValueAction.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return _interpolateValueAction__WEBPACK_IMPORTED_MODULE_7__[\"InterpolateValueAction\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Actions/interpolateValueAction.ts\":\n/*!*******************************************!*\\\n !*** ./Actions/interpolateValueAction.ts ***!\n \\*******************************************/\n/*! exports provided: InterpolateValueAction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return InterpolateValueAction; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./action */ \"./Actions/action.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Animations/animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This defines an action responsible to change the value of a property\r\n * by interpolating between its current value and the newly set one once triggered.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\nvar InterpolateValueAction = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InterpolateValueAction, _super);\r\n /**\r\n * Instantiate the action\r\n * @param triggerOptions defines the trigger options\r\n * @param target defines the object containing the value to interpolate\r\n * @param propertyPath defines the path to the property in the target object\r\n * @param value defines the target value at the end of the interpolation\r\n * @param duration deines the time it will take for the property to interpolate to the value.\r\n * @param condition defines the trigger related conditions\r\n * @param stopOtherAnimations defines if the other scene animations should be stopped when the action has been triggered\r\n * @param onInterpolationDone defines a callback raised once the interpolation animation has been done\r\n */\r\n function InterpolateValueAction(triggerOptions, target, propertyPath, value, duration, condition, stopOtherAnimations, onInterpolationDone) {\r\n if (duration === void 0) { duration = 1000; }\r\n var _this = _super.call(this, triggerOptions, condition) || this;\r\n /**\r\n * Defines the time it will take for the property to interpolate to the value.\r\n */\r\n _this.duration = 1000;\r\n /**\r\n * Observable triggered once the interpolation animation has been done.\r\n */\r\n _this.onInterpolationDoneObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this.propertyPath = propertyPath;\r\n _this.value = value;\r\n _this.duration = duration;\r\n _this.stopOtherAnimations = stopOtherAnimations;\r\n _this.onInterpolationDone = onInterpolationDone;\r\n _this._target = _this._effectiveTarget = target;\r\n return _this;\r\n }\r\n /** @hidden */\r\n InterpolateValueAction.prototype._prepare = function () {\r\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\r\n this._property = this._getProperty(this.propertyPath);\r\n };\r\n /**\r\n * Execute the action starts the value interpolation.\r\n */\r\n InterpolateValueAction.prototype.execute = function () {\r\n var _this = this;\r\n var scene = this._actionManager.getScene();\r\n var keys = [\r\n {\r\n frame: 0,\r\n value: this._effectiveTarget[this._property]\r\n }, {\r\n frame: 100,\r\n value: this.value\r\n }\r\n ];\r\n var dataType;\r\n if (typeof this.value === \"number\") {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_FLOAT;\r\n }\r\n else if (this.value instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_COLOR3;\r\n }\r\n else if (this.value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_VECTOR3;\r\n }\r\n else if (this.value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_MATRIX;\r\n }\r\n else if (this.value instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"]) {\r\n dataType = _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_QUATERNION;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"InterpolateValueAction: Unsupported type (\" + typeof this.value + \")\");\r\n return;\r\n }\r\n var animation = new _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"](\"InterpolateValueAction\", this._property, 100 * (1000.0 / this.duration), dataType, _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n animation.setKeys(keys);\r\n if (this.stopOtherAnimations) {\r\n scene.stopAnimation(this._effectiveTarget);\r\n }\r\n var wrapper = function () {\r\n _this.onInterpolationDoneObservable.notifyObservers(_this);\r\n if (_this.onInterpolationDone) {\r\n _this.onInterpolationDone();\r\n }\r\n };\r\n scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, wrapper);\r\n };\r\n /**\r\n * Serializes the actions and its related information.\r\n * @param parent defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n InterpolateValueAction.prototype.serialize = function (parent) {\r\n return _super.prototype._serialize.call(this, {\r\n name: \"InterpolateValueAction\",\r\n properties: [\r\n _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._GetTargetProperty(this._target),\r\n { name: \"propertyPath\", value: this.propertyPath },\r\n { name: \"value\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.value) },\r\n { name: \"duration\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.duration) },\r\n { name: \"stopOtherAnimations\", value: _action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]._SerializeValueAsString(this.stopOtherAnimations) || false }\r\n ]\r\n }, parent);\r\n };\r\n return InterpolateValueAction;\r\n}(_action__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.InterpolateValueAction\"] = InterpolateValueAction;\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animatable.ts\":\n/*!**********************************!*\\\n !*** ./Animations/animatable.ts ***!\n \\**********************************/\n/*! exports provided: Animatable */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return Animatable; });\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _runtimeAnimation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./runtimeAnimation */ \"./Animations/runtimeAnimation.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _Bones_bone__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Bones/bone */ \"./Bones/bone.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store an actual running animation\r\n */\r\nvar Animatable = /** @class */ (function () {\r\n /**\r\n * Creates a new Animatable\r\n * @param scene defines the hosting scene\r\n * @param target defines the target object\r\n * @param fromFrame defines the starting frame number (default is 0)\r\n * @param toFrame defines the ending frame number (default is 100)\r\n * @param loopAnimation defines if the animation must loop (default is false)\r\n * @param speedRatio defines the factor to apply to animation speed (default is 1)\r\n * @param onAnimationEnd defines a callback to call when animation ends if it is not looping\r\n * @param animations defines a group of animation to add to the new Animatable\r\n * @param onAnimationLoop defines a callback to call when animation loops\r\n */\r\n function Animatable(scene, \r\n /** defines the target object */\r\n target, \r\n /** defines the starting frame number (default is 0) */\r\n fromFrame, \r\n /** defines the ending frame number (default is 100) */\r\n toFrame, \r\n /** defines if the animation must loop (default is false) */\r\n loopAnimation, speedRatio, \r\n /** defines a callback to call when animation ends if it is not looping */\r\n onAnimationEnd, animations, \r\n /** defines a callback to call when animation loops */\r\n onAnimationLoop) {\r\n if (fromFrame === void 0) { fromFrame = 0; }\r\n if (toFrame === void 0) { toFrame = 100; }\r\n if (loopAnimation === void 0) { loopAnimation = false; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n this.target = target;\r\n this.fromFrame = fromFrame;\r\n this.toFrame = toFrame;\r\n this.loopAnimation = loopAnimation;\r\n this.onAnimationEnd = onAnimationEnd;\r\n this.onAnimationLoop = onAnimationLoop;\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n this._runtimeAnimations = new Array();\r\n this._paused = false;\r\n this._speedRatio = 1;\r\n this._weight = -1.0;\r\n this._syncRoot = null;\r\n /**\r\n * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.\r\n * This will only apply for non looping animation (default is true)\r\n */\r\n this.disposeOnEnd = true;\r\n /**\r\n * Gets a boolean indicating if the animation has started\r\n */\r\n this.animationStarted = false;\r\n /**\r\n * Observer raised when the animation ends\r\n */\r\n this.onAnimationEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observer raised when the animation loops\r\n */\r\n this.onAnimationLoopObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this._scene = scene;\r\n if (animations) {\r\n this.appendAnimations(target, animations);\r\n }\r\n this._speedRatio = speedRatio;\r\n scene._activeAnimatables.push(this);\r\n }\r\n Object.defineProperty(Animatable.prototype, \"syncRoot\", {\r\n /**\r\n * Gets the root Animatable used to synchronize and normalize animations\r\n */\r\n get: function () {\r\n return this._syncRoot;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"masterFrame\", {\r\n /**\r\n * Gets the current frame of the first RuntimeAnimation\r\n * Used to synchronize Animatables\r\n */\r\n get: function () {\r\n if (this._runtimeAnimations.length === 0) {\r\n return 0;\r\n }\r\n return this._runtimeAnimations[0].currentFrame;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"weight\", {\r\n /**\r\n * Gets or sets the animatable weight (-1.0 by default meaning not weighted)\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n set: function (value) {\r\n if (value === -1) { // -1 is ok and means no weight\r\n this._weight = -1;\r\n return;\r\n }\r\n // Else weight must be in [0, 1] range\r\n this._weight = Math.min(Math.max(value, 0), 1.0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to apply to the animatable (1.0 by default)\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n set: function (value) {\r\n for (var index = 0; index < this._runtimeAnimations.length; index++) {\r\n var animation = this._runtimeAnimations[index];\r\n animation._prepareForSpeedRatioChange(value);\r\n }\r\n this._speedRatio = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Synchronize and normalize current Animatable with a source Animatable\r\n * This is useful when using animation weights and when animations are not of the same length\r\n * @param root defines the root Animatable to synchronize with\r\n * @returns the current Animatable\r\n */\r\n Animatable.prototype.syncWith = function (root) {\r\n this._syncRoot = root;\r\n if (root) {\r\n // Make sure this animatable will animate after the root\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n this._scene._activeAnimatables.push(this);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the list of runtime animations\r\n * @returns an array of RuntimeAnimation\r\n */\r\n Animatable.prototype.getAnimations = function () {\r\n return this._runtimeAnimations;\r\n };\r\n /**\r\n * Adds more animations to the current animatable\r\n * @param target defines the target of the animations\r\n * @param animations defines the new animations to add\r\n */\r\n Animatable.prototype.appendAnimations = function (target, animations) {\r\n var _this = this;\r\n for (var index = 0; index < animations.length; index++) {\r\n var animation = animations[index];\r\n var newRuntimeAnimation = new _runtimeAnimation__WEBPACK_IMPORTED_MODULE_1__[\"RuntimeAnimation\"](target, animation, this._scene, this);\r\n newRuntimeAnimation._onLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(_this);\r\n if (_this.onAnimationLoop) {\r\n _this.onAnimationLoop();\r\n }\r\n };\r\n this._runtimeAnimations.push(newRuntimeAnimation);\r\n }\r\n };\r\n /**\r\n * Gets the source animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the source animation for the given property\r\n */\r\n Animatable.prototype.getAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index].animation;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the runtime animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the runtime animation for the given property\r\n */\r\n Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Resets the animatable to its original state\r\n */\r\n Animatable.prototype.reset = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].reset(true);\r\n }\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n };\r\n /**\r\n * Allows the animatable to blend with current running animations\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-blending\r\n * @param blendingSpeed defines the blending speed to use\r\n */\r\n Animatable.prototype.enableBlending = function (blendingSpeed) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = true;\r\n runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;\r\n }\r\n };\r\n /**\r\n * Disable animation blending\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Animatable.prototype.disableBlending = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = false;\r\n }\r\n };\r\n /**\r\n * Jump directly to a given frame\r\n * @param frame defines the frame to jump to\r\n */\r\n Animatable.prototype.goToFrame = function (frame) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n if (runtimeAnimations[0]) {\r\n var fps = runtimeAnimations[0].animation.framePerSecond;\r\n var currentFrame = runtimeAnimations[0].currentFrame;\r\n var adjustTime = frame - currentFrame;\r\n var delay = this.speedRatio !== 0 ? adjustTime * 1000 / (fps * this.speedRatio) : 0;\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = 0;\r\n }\r\n this._localDelayOffset -= delay;\r\n }\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].goToFrame(frame);\r\n }\r\n };\r\n /**\r\n * Pause the animation\r\n */\r\n Animatable.prototype.pause = function () {\r\n if (this._paused) {\r\n return;\r\n }\r\n this._paused = true;\r\n };\r\n /**\r\n * Restart the animation\r\n */\r\n Animatable.prototype.restart = function () {\r\n this._paused = false;\r\n };\r\n Animatable.prototype._raiseOnAnimationEnd = function () {\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n this.onAnimationEndObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop and delete the current animation\r\n * @param animationName defines a string used to only stop some of the runtime animations instead of all\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Animatable.prototype.stop = function (animationName, targetMask) {\r\n if (animationName || targetMask) {\r\n var idx = this._scene._activeAnimatables.indexOf(this);\r\n if (idx > -1) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = runtimeAnimations.length - 1; index >= 0; index--) {\r\n var runtimeAnimation = runtimeAnimations[index];\r\n if (animationName && runtimeAnimation.animation.name != animationName) {\r\n continue;\r\n }\r\n if (targetMask && !targetMask(runtimeAnimation.target)) {\r\n continue;\r\n }\r\n runtimeAnimation.dispose();\r\n runtimeAnimations.splice(index, 1);\r\n }\r\n if (runtimeAnimations.length == 0) {\r\n this._scene._activeAnimatables.splice(idx, 1);\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n }\r\n else {\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n };\r\n /**\r\n * Wait asynchronously for the animation to end\r\n * @returns a promise which will be fullfilled when the animation ends\r\n */\r\n Animatable.prototype.waitAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.onAnimationEndObservable.add(function () {\r\n resolve(_this);\r\n }, undefined, undefined, _this, true);\r\n });\r\n };\r\n /** @hidden */\r\n Animatable.prototype._animate = function (delay) {\r\n if (this._paused) {\r\n this.animationStarted = false;\r\n if (this._pausedDelay === null) {\r\n this._pausedDelay = delay;\r\n }\r\n return true;\r\n }\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = delay;\r\n this._pausedDelay = null;\r\n }\r\n else if (this._pausedDelay !== null) {\r\n this._localDelayOffset += delay - this._pausedDelay;\r\n this._pausedDelay = null;\r\n }\r\n if (this._weight === 0) { // We consider that an animation with a weight === 0 is \"actively\" paused\r\n return true;\r\n }\r\n // Animating\r\n var running = false;\r\n var runtimeAnimations = this._runtimeAnimations;\r\n var index;\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n var animation = runtimeAnimations[index];\r\n var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);\r\n running = running || isRunning;\r\n }\r\n this.animationStarted = running;\r\n if (!running) {\r\n if (this.disposeOnEnd) {\r\n // Remove from active animatables\r\n index = this._scene._activeAnimatables.indexOf(this);\r\n this._scene._activeAnimatables.splice(index, 1);\r\n // Dispose all runtime animations\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n }\r\n this._raiseOnAnimationEnd();\r\n if (this.disposeOnEnd) {\r\n this.onAnimationEnd = null;\r\n this.onAnimationLoop = null;\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationEndObservable.clear();\r\n }\r\n }\r\n return running;\r\n };\r\n return Animatable;\r\n}());\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._animate = function () {\r\n if (!this.animationsEnabled) {\r\n return;\r\n }\r\n var animatables = this._activeAnimatables;\r\n if (animatables.length === 0) {\r\n return;\r\n }\r\n // Getting time\r\n var now = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_5__[\"PrecisionDate\"].Now;\r\n if (!this._animationTimeLast) {\r\n if (this._pendingData.length > 0) {\r\n return;\r\n }\r\n this._animationTimeLast = now;\r\n }\r\n var deltaTime = this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;\r\n this._animationTime += deltaTime;\r\n var animationTime = this._animationTime;\r\n this._animationTimeLast = now;\r\n for (var index = 0; index < animatables.length; index++) {\r\n var animatable = animatables[index];\r\n if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {\r\n index--; // Array was updated\r\n }\r\n }\r\n // Late animation bindings\r\n this._processLateAnimationBindings();\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginWeightedAnimation = function (target, from, to, weight, loop, speedRatio, onAnimationEnd, animatable, targetMask, onAnimationLoop) {\r\n if (weight === void 0) { weight = 1.0; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n var returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop);\r\n returnedAnimatable.weight = weight;\r\n return returnedAnimatable;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n if (stopCurrent) {\r\n this.stopAnimation(target, undefined, targetMask);\r\n }\r\n if (!animatable) {\r\n animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop);\r\n }\r\n var shouldRunTargetAnimations = targetMask ? targetMask(target) : true;\r\n // Local animations\r\n if (target.animations && shouldRunTargetAnimations) {\r\n animatable.appendAnimations(target, target.animations);\r\n }\r\n // Children animations\r\n if (target.getAnimatables) {\r\n var animatables = target.getAnimatables();\r\n for (var index = 0; index < animatables.length; index++) {\r\n this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);\r\n }\r\n }\r\n animatable.reset();\r\n return animatable;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask));\r\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\r\n var child = children_1[_i];\r\n result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask));\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop) {\r\n if (speedRatio === undefined) {\r\n speedRatio = 1.0;\r\n }\r\n var animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop);\r\n return animatable;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.beginDirectHierarchyAnimation = function (target, directDescendantsOnly, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop) {\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop));\r\n for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\r\n var child = children_2[_i];\r\n result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop));\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.getAnimatableByTarget = function (target) {\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n return this._activeAnimatables[index];\r\n }\r\n }\r\n return null;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.getAllAnimatablesByTarget = function (target) {\r\n var result = [];\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n result.push(this._activeAnimatables[index]);\r\n }\r\n }\r\n return result;\r\n};\r\n/**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.stopAnimation = function (target, animationName, targetMask) {\r\n var animatables = this.getAllAnimatablesByTarget(target);\r\n for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {\r\n var animatable = animatables_1[_i];\r\n animatable.stop(animationName, targetMask);\r\n }\r\n};\r\n/**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype.stopAllAnimations = function () {\r\n if (this._activeAnimatables) {\r\n for (var i = 0; i < this._activeAnimatables.length; i++) {\r\n this._activeAnimatables[i].stop();\r\n }\r\n this._activeAnimatables = [];\r\n }\r\n for (var _i = 0, _a = this.animationGroups; _i < _a.length; _i++) {\r\n var group = _a[_i];\r\n group.stop();\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation, originalValue) {\r\n var target = runtimeAnimation.target;\r\n this._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n animations: [],\r\n originalValue: originalValue\r\n };\r\n }\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._processLateAnimationBindingsForMatrices = function (holder) {\r\n var normalizer = 1.0;\r\n var finalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[0];\r\n var finalScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[1];\r\n var finalQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Quaternion[0];\r\n var startIndex = 0;\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var scale = 1;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n originalValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n scale = 1.0 - holder.totalWeight;\r\n }\r\n else {\r\n startIndex = 1;\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n scale = originalAnimation.weight / normalizer;\r\n if (scale == 1) {\r\n return originalAnimation.currentValue;\r\n }\r\n }\r\n finalScaling.scaleInPlace(scale);\r\n finalPosition.scaleInPlace(scale);\r\n finalQuaternion.scaleInPlace(scale);\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n var scale = runtimeAnimation.weight / normalizer;\r\n var currentPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[2];\r\n var currentScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[3];\r\n var currentQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Quaternion[1];\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.scaleAndAddToRef(scale, finalScaling);\r\n currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(scale, finalPosition);\r\n }\r\n var workValue = originalAnimation._animationState.workValue;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);\r\n return workValue;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._processLateAnimationBindingsForQuaternions = function (holder, refQuaternion) {\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n if (holder.animations.length === 1) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), refQuaternion);\r\n return refQuaternion;\r\n }\r\n var normalizer = 1.0;\r\n var quaternions;\r\n var weights;\r\n if (holder.totalWeight < 1.0) {\r\n var scale = 1.0 - holder.totalWeight;\r\n quaternions = [];\r\n weights = [];\r\n quaternions.push(originalValue);\r\n weights.push(scale);\r\n }\r\n else {\r\n if (holder.animations.length === 2) { // Slerp as soon as we can\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);\r\n return refQuaternion;\r\n }\r\n quaternions = [];\r\n weights = [];\r\n normalizer = holder.totalWeight;\r\n }\r\n for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n quaternions.push(runtimeAnimation.currentValue);\r\n weights.push(runtimeAnimation.weight / normalizer);\r\n }\r\n // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions\r\n var cumulativeAmount = 0;\r\n var cumulativeQuaternion = null;\r\n for (var index = 0; index < quaternions.length;) {\r\n if (!cumulativeQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);\r\n cumulativeQuaternion = refQuaternion;\r\n cumulativeAmount = weights[index] + weights[index + 1];\r\n index += 2;\r\n continue;\r\n }\r\n cumulativeAmount += weights[index];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);\r\n index++;\r\n }\r\n return cumulativeQuaternion;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype._processLateAnimationBindings = function () {\r\n if (!this._registeredForLateAnimationBindings.length) {\r\n return;\r\n }\r\n for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {\r\n var target = this._registeredForLateAnimationBindings.data[index];\r\n for (var path in target._lateAnimationHolders) {\r\n var holder = target._lateAnimationHolders[path];\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var matrixDecomposeMode = _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix\r\n var finalValue = target[path];\r\n if (matrixDecomposeMode) {\r\n finalValue = this._processLateAnimationBindingsForMatrices(holder);\r\n }\r\n else {\r\n var quaternionMode = originalValue.w !== undefined;\r\n if (quaternionMode) {\r\n finalValue = this._processLateAnimationBindingsForQuaternions(holder, finalValue || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].Identity());\r\n }\r\n else {\r\n var startIndex = 0;\r\n var normalizer = 1.0;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n if (originalValue.scale) {\r\n finalValue = originalValue.scale(1.0 - holder.totalWeight);\r\n }\r\n else {\r\n finalValue = originalValue * (1.0 - holder.totalWeight);\r\n }\r\n }\r\n else {\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n var scale_1 = originalAnimation.weight / normalizer;\r\n if (scale_1 !== 1) {\r\n if (originalAnimation.currentValue.scale) {\r\n finalValue = originalAnimation.currentValue.scale(scale_1);\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue * scale_1;\r\n }\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue;\r\n }\r\n startIndex = 1;\r\n }\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n var scale = runtimeAnimation.weight / normalizer;\r\n if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n }\r\n else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n }\r\n }\r\n target[path] = finalValue;\r\n }\r\n target._lateAnimationHolders = {};\r\n }\r\n this._registeredForLateAnimationBindings.reset();\r\n};\r\n_Bones_bone__WEBPACK_IMPORTED_MODULE_6__[\"Bone\"].prototype.copyAnimationRange = function (source, rangeName, frameOffset, rescaleAsRequired, skelDimensionsRatio) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (skelDimensionsRatio === void 0) { skelDimensionsRatio = null; }\r\n // all animation may be coming from a library skeleton, so may need to create animation\r\n if (this.animations.length === 0) {\r\n this.animations.push(new _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"](this.name, \"_matrix\", source.animations[0].framePerSecond, _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].ANIMATIONTYPE_MATRIX, 0));\r\n this.animations[0].setKeys([]);\r\n }\r\n // get animation info / verify there is such a range from the source bone\r\n var sourceRange = source.animations[0].getRange(rangeName);\r\n if (!sourceRange) {\r\n return false;\r\n }\r\n var from = sourceRange.from;\r\n var to = sourceRange.to;\r\n var sourceKeys = source.animations[0].getKeys();\r\n // rescaling prep\r\n var sourceBoneLength = source.length;\r\n var sourceParent = source.getParent();\r\n var parent = this.getParent();\r\n var parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;\r\n var parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;\r\n var dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);\r\n var destKeys = this.animations[0].getKeys();\r\n // loop vars declaration\r\n var orig;\r\n var origTranslation;\r\n var mat;\r\n for (var key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {\r\n orig = sourceKeys[key];\r\n if (orig.frame >= from && orig.frame <= to) {\r\n if (rescaleAsRequired) {\r\n mat = orig.value.clone();\r\n // scale based on parent ratio, when bone has parent\r\n if (parentScalingReqd) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.scaleInPlace(parentRatio));\r\n // scale based on skeleton dimension ratio when root bone, and value is passed\r\n }\r\n else if (dimensionsScalingReqd && skelDimensionsRatio) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));\r\n // use original when root bone, and no data for skelDimensionsRatio\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n destKeys.push({ frame: orig.frame + frameOffset, value: mat });\r\n }\r\n }\r\n this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);\r\n return true;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animation.ts\":\n/*!*********************************!*\\\n !*** ./Animations/animation.ts ***!\n \\*********************************/\n/*! exports provided: _IAnimationState, Animation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _IAnimationState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return Animation; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _animationKey__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./animationKey */ \"./Animations/animationKey.ts\");\n/* harmony import */ var _animationRange__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./animationRange */ \"./Animations/animationRange.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Maths/math.size */ \"./Maths/math.size.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar _IAnimationState = /** @class */ (function () {\r\n function _IAnimationState() {\r\n }\r\n return _IAnimationState;\r\n}());\r\n\r\n/**\r\n * Class used to store any kind of animation\r\n */\r\nvar Animation = /** @class */ (function () {\r\n /**\r\n * Initializes the animation\r\n * @param name Name of the animation\r\n * @param targetProperty Property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param dataType The data type of the animation\r\n * @param loopMode The loop mode of the animation\r\n * @param enableBlending Specifies if blending should be enabled\r\n */\r\n function Animation(\r\n /**Name of the animation */\r\n name, \r\n /**Property to animate */\r\n targetProperty, \r\n /**The frames per second of the animation */\r\n framePerSecond, \r\n /**The data type of the animation */\r\n dataType, \r\n /**The loop mode of the animation */\r\n loopMode, \r\n /**Specifies if blending should be enabled */\r\n enableBlending) {\r\n this.name = name;\r\n this.targetProperty = targetProperty;\r\n this.framePerSecond = framePerSecond;\r\n this.dataType = dataType;\r\n this.loopMode = loopMode;\r\n this.enableBlending = enableBlending;\r\n /**\r\n * @hidden Internal use only\r\n */\r\n this._runtimeAnimations = new Array();\r\n /**\r\n * The set of event that will be linked to this animation\r\n */\r\n this._events = new Array();\r\n /**\r\n * Stores the blending speed of the animation\r\n */\r\n this.blendingSpeed = 0.01;\r\n /**\r\n * Stores the animation ranges for the animation\r\n */\r\n this._ranges = {};\r\n this.targetPropertyPath = targetProperty.split(\".\");\r\n this.dataType = dataType;\r\n this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;\r\n }\r\n /**\r\n * @hidden Internal use\r\n */\r\n Animation._PrepareAnimation = function (name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction) {\r\n var dataType = undefined;\r\n if (!isNaN(parseFloat(from)) && isFinite(from)) {\r\n dataType = Animation.ANIMATIONTYPE_FLOAT;\r\n }\r\n else if (from instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]) {\r\n dataType = Animation.ANIMATIONTYPE_QUATERNION;\r\n }\r\n else if (from instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n else if (from instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"]) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR2;\r\n }\r\n else if (from instanceof _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"]) {\r\n dataType = Animation.ANIMATIONTYPE_COLOR3;\r\n }\r\n else if (from instanceof _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"]) {\r\n dataType = Animation.ANIMATIONTYPE_SIZE;\r\n }\r\n if (dataType == undefined) {\r\n return null;\r\n }\r\n var animation = new Animation(name, targetProperty, framePerSecond, dataType, loopMode);\r\n var keys = [{ frame: 0, value: from }, { frame: totalFrame, value: to }];\r\n animation.setKeys(keys);\r\n if (easingFunction !== undefined) {\r\n animation.setEasingFunction(easingFunction);\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Sets up an animation\r\n * @param property The property to animate\r\n * @param animationType The animation type to apply\r\n * @param framePerSecond The frames per second of the animation\r\n * @param easingFunction The easing function used in the animation\r\n * @returns The created animation\r\n */\r\n Animation.CreateAnimation = function (property, animationType, framePerSecond, easingFunction) {\r\n var animation = new Animation(property + \"Animation\", property, framePerSecond, animationType, Animation.ANIMATIONLOOPMODE_CONSTANT);\r\n animation.setEasingFunction(easingFunction);\r\n return animation;\r\n };\r\n /**\r\n * Create and start an animation on a node\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second yo use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when animation end\r\n * @returns the animatable created for this animation\r\n */\r\n Animation.CreateAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n return node.getScene().beginDirectAnimation(node, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Create and start an animation on a node and its descendants\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second to use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @returns the list of animatables created for all nodes\r\n * @example https://www.babylonjs-playground.com/#MH0VLI\r\n */\r\n Animation.CreateAndStartHierarchyAnimation = function (name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n var scene = node.getScene();\r\n return scene.beginDirectHierarchyAnimation(node, directDescendantsOnly, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Creates a new animation, merges it with the existing animations and starts it\r\n * @param name Name of the animation\r\n * @param node Node which contains the scene that begins the animations\r\n * @param targetProperty Specifies which property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param totalFrame The total number of frames\r\n * @param from The frame at the beginning of the animation\r\n * @param to The frame at the end of the animation\r\n * @param loopMode Specifies the loop mode of the animation\r\n * @param easingFunction (Optional) The easing function of the animation, which allow custom mathematical formulas for animations\r\n * @param onAnimationEnd Callback to run once the animation is complete\r\n * @returns Nullable animation\r\n */\r\n Animation.CreateMergeAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n node.animations.push(animation);\r\n return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Transition property of an host to the target Value\r\n * @param property The property to transition\r\n * @param targetValue The target Value of the property\r\n * @param host The object where the property to animate belongs\r\n * @param scene Scene used to run the animation\r\n * @param frameRate Framerate (in frame/s) to use\r\n * @param transition The transition type we want to use\r\n * @param duration The duration of the animation, in milliseconds\r\n * @param onAnimationEnd Callback trigger at the end of the animation\r\n * @returns Nullable animation\r\n */\r\n Animation.TransitionTo = function (property, targetValue, host, scene, frameRate, transition, duration, onAnimationEnd) {\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n if (duration <= 0) {\r\n host[property] = targetValue;\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n return null;\r\n }\r\n var endFrame = frameRate * (duration / 1000);\r\n transition.setKeys([{\r\n frame: 0,\r\n value: host[property].clone ? host[property].clone() : host[property]\r\n },\r\n {\r\n frame: endFrame,\r\n value: targetValue\r\n }]);\r\n if (!host.animations) {\r\n host.animations = [];\r\n }\r\n host.animations.push(transition);\r\n var animation = scene.beginAnimation(host, 0, endFrame, false);\r\n animation.onAnimationEnd = onAnimationEnd;\r\n return animation;\r\n };\r\n Object.defineProperty(Animation.prototype, \"runtimeAnimations\", {\r\n /**\r\n * Return the array of runtime animations currently using this animation\r\n */\r\n get: function () {\r\n return this._runtimeAnimations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation.prototype, \"hasRunningRuntimeAnimations\", {\r\n /**\r\n * Specifies if any of the runtime animations are currently running\r\n */\r\n get: function () {\r\n for (var _i = 0, _a = this._runtimeAnimations; _i < _a.length; _i++) {\r\n var runtimeAnimation = _a[_i];\r\n if (!runtimeAnimation.isStopped) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Converts the animation to a string\r\n * @param fullDetails support for multiple levels of logging within scene loading\r\n * @returns String form of the animation\r\n */\r\n Animation.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", property: \" + this.targetProperty;\r\n ret += \", datatype: \" + ([\"Float\", \"Vector3\", \"Quaternion\", \"Matrix\", \"Color3\", \"Vector2\"])[this.dataType];\r\n ret += \", nKeys: \" + (this._keys ? this._keys.length : \"none\");\r\n ret += \", nRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Add an event to this animation\r\n * @param event Event to add\r\n */\r\n Animation.prototype.addEvent = function (event) {\r\n this._events.push(event);\r\n };\r\n /**\r\n * Remove all events found at the given frame\r\n * @param frame The frame to remove events from\r\n */\r\n Animation.prototype.removeEvents = function (frame) {\r\n for (var index = 0; index < this._events.length; index++) {\r\n if (this._events[index].frame === frame) {\r\n this._events.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n };\r\n /**\r\n * Retrieves all the events from the animation\r\n * @returns Events from the animation\r\n */\r\n Animation.prototype.getEvents = function () {\r\n return this._events;\r\n };\r\n /**\r\n * Creates an animation range\r\n * @param name Name of the animation range\r\n * @param from Starting frame of the animation range\r\n * @param to Ending frame of the animation\r\n */\r\n Animation.prototype.createRange = function (name, from, to) {\r\n // check name not already in use; could happen for bones after serialized\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new _animationRange__WEBPACK_IMPORTED_MODULE_6__[\"AnimationRange\"](name, from, to);\r\n }\r\n };\r\n /**\r\n * Deletes an animation range by name\r\n * @param name Name of the animation range to delete\r\n * @param deleteFrames Specifies if the key frames for the range should also be deleted (true) or not (false)\r\n */\r\n Animation.prototype.deleteRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n var range = this._ranges[name];\r\n if (!range) {\r\n return;\r\n }\r\n if (deleteFrames) {\r\n var from = range.from;\r\n var to = range.to;\r\n // this loop MUST go high to low for multiple splices to work\r\n for (var key = this._keys.length - 1; key >= 0; key--) {\r\n if (this._keys[key].frame >= from && this._keys[key].frame <= to) {\r\n this._keys.splice(key, 1);\r\n }\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets the animation range by name, or null if not defined\r\n * @param name Name of the animation range\r\n * @returns Nullable animation range\r\n */\r\n Animation.prototype.getRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the key frames from the animation\r\n * @returns The key frames of the animation\r\n */\r\n Animation.prototype.getKeys = function () {\r\n return this._keys;\r\n };\r\n /**\r\n * Gets the highest frame rate of the animation\r\n * @returns Highest frame rate of the animation\r\n */\r\n Animation.prototype.getHighestFrame = function () {\r\n var ret = 0;\r\n for (var key = 0, nKeys = this._keys.length; key < nKeys; key++) {\r\n if (ret < this._keys[key].frame) {\r\n ret = this._keys[key].frame;\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the easing function of the animation\r\n * @returns Easing function of the animation\r\n */\r\n Animation.prototype.getEasingFunction = function () {\r\n return this._easingFunction;\r\n };\r\n /**\r\n * Sets the easing function of the animation\r\n * @param easingFunction A custom mathematical formula for animation\r\n */\r\n Animation.prototype.setEasingFunction = function (easingFunction) {\r\n this._easingFunction = easingFunction;\r\n };\r\n /**\r\n * Interpolates a scalar linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a scalar cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion using a spherical linear interpolation\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Slerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Hermite(startValue, outTangent, endValue, inTangent, gradient).normalize();\r\n };\r\n /**\r\n * Interpolates a Vector3 linearl\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector3 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns InterpolatedVector3 value\r\n */\r\n Animation.prototype.vector3InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a size linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Size value\r\n */\r\n Animation.prototype.sizeInterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Color3 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Color3 value\r\n */\r\n Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._getKeyValue = function (value) {\r\n if (typeof value === \"function\") {\r\n return value();\r\n }\r\n return value;\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._interpolate = function (currentFrame, state) {\r\n if (state.loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && state.repeatCount > 0) {\r\n return state.highLimitValue.clone ? state.highLimitValue.clone() : state.highLimitValue;\r\n }\r\n var keys = this._keys;\r\n if (keys.length === 1) {\r\n return this._getKeyValue(keys[0].value);\r\n }\r\n var startKeyIndex = state.key;\r\n if (keys[startKeyIndex].frame >= currentFrame) {\r\n while (startKeyIndex - 1 >= 0 && keys[startKeyIndex].frame >= currentFrame) {\r\n startKeyIndex--;\r\n }\r\n }\r\n for (var key = startKeyIndex; key < keys.length; key++) {\r\n var endKey = keys[key + 1];\r\n if (endKey.frame >= currentFrame) {\r\n state.key = key;\r\n var startKey = keys[key];\r\n var startValue = this._getKeyValue(startKey.value);\r\n if (startKey.interpolation === _animationKey__WEBPACK_IMPORTED_MODULE_5__[\"AnimationKeyInterpolation\"].STEP) {\r\n return startValue;\r\n }\r\n var endValue = this._getKeyValue(endKey.value);\r\n var useTangent = startKey.outTangent !== undefined && endKey.inTangent !== undefined;\r\n var frameDelta = endKey.frame - startKey.frame;\r\n // gradient : percent of currentFrame between the frame inf and the frame sup\r\n var gradient = (currentFrame - startKey.frame) / frameDelta;\r\n // check for easingFunction and correction of gradient\r\n var easingFunction = this.getEasingFunction();\r\n if (easingFunction != null) {\r\n gradient = easingFunction.ease(gradient);\r\n }\r\n switch (this.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n var floatValue = useTangent ? this.floatInterpolateFunctionWithTangents(startValue, startKey.outTangent * frameDelta, endValue, endKey.inTangent * frameDelta, gradient) : this.floatInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return floatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return state.offsetValue * state.repeatCount + floatValue;\r\n }\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n var quatValue = useTangent ? this.quaternionInterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.quaternionInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return quatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return quatValue.addInPlace(state.offsetValue.scale(state.repeatCount));\r\n }\r\n return quatValue;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n var vec3Value = useTangent ? this.vector3InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector3InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec3Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec3Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n var vec2Value = useTangent ? this.vector2InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector2InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec2Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec2Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Matrix\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n if (Animation.AllowMatricesInterpolation) {\r\n return this.matrixInterpolateFunction(startValue, endValue, gradient, state.workValue);\r\n }\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return startValue;\r\n }\r\n default:\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n return this._getKeyValue(keys[keys.length - 1].value);\r\n };\r\n /**\r\n * Defines the function to use to interpolate matrices\r\n * @param startValue defines the start matrix\r\n * @param endValue defines the end matrix\r\n * @param gradient defines the gradient between both matrices\r\n * @param result defines an optional target matrix where to store the interpolation\r\n * @returns the interpolated matrix\r\n */\r\n Animation.prototype.matrixInterpolateFunction = function (startValue, endValue, gradient, result) {\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerp(startValue, endValue, gradient);\r\n }\r\n if (result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Makes a copy of the animation\r\n * @returns Cloned animation\r\n */\r\n Animation.prototype.clone = function () {\r\n var clone = new Animation(this.name, this.targetPropertyPath.join(\".\"), this.framePerSecond, this.dataType, this.loopMode);\r\n clone.enableBlending = this.enableBlending;\r\n clone.blendingSpeed = this.blendingSpeed;\r\n if (this._keys) {\r\n clone.setKeys(this._keys);\r\n }\r\n if (this._ranges) {\r\n clone._ranges = {};\r\n for (var name in this._ranges) {\r\n var range = this._ranges[name];\r\n if (!range) {\r\n continue;\r\n }\r\n clone._ranges[name] = range.clone();\r\n }\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Sets the key frames of the animation\r\n * @param values The animation key frames to set\r\n */\r\n Animation.prototype.setKeys = function (values) {\r\n this._keys = values.slice(0);\r\n };\r\n /**\r\n * Serializes the animation to an object\r\n * @returns Serialized object\r\n */\r\n Animation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.property = this.targetProperty;\r\n serializationObject.framePerSecond = this.framePerSecond;\r\n serializationObject.dataType = this.dataType;\r\n serializationObject.loopBehavior = this.loopMode;\r\n serializationObject.enableBlending = this.enableBlending;\r\n serializationObject.blendingSpeed = this.blendingSpeed;\r\n var dataType = this.dataType;\r\n serializationObject.keys = [];\r\n var keys = this.getKeys();\r\n for (var index = 0; index < keys.length; index++) {\r\n var animationKey = keys[index];\r\n var key = {};\r\n key.frame = animationKey.frame;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n key.values = [animationKey.value];\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n key.values = animationKey.value.asArray();\r\n break;\r\n }\r\n serializationObject.keys.push(key);\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n return serializationObject;\r\n };\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_FLOAT\", {\r\n /**\r\n * Get the float animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_FLOAT;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_VECTOR3\", {\r\n /**\r\n * Get the Vector3 animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_VECTOR3;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_VECTOR2\", {\r\n /**\r\n * Get the Vector2 animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_VECTOR2;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_SIZE\", {\r\n /**\r\n * Get the Size animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_SIZE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_QUATERNION\", {\r\n /**\r\n * Get the Quaternion animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_QUATERNION;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_MATRIX\", {\r\n /**\r\n * Get the Matrix animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_MATRIX;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONTYPE_COLOR3\", {\r\n /**\r\n * Get the Color3 animation type\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONTYPE_COLOR3;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONLOOPMODE_RELATIVE\", {\r\n /**\r\n * Get the Relative Loop Mode\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONLOOPMODE_RELATIVE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONLOOPMODE_CYCLE\", {\r\n /**\r\n * Get the Cycle Loop Mode\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONLOOPMODE_CYCLE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation, \"ANIMATIONLOOPMODE_CONSTANT\", {\r\n /**\r\n * Get the Constant Loop Mode\r\n */\r\n get: function () {\r\n return Animation._ANIMATIONLOOPMODE_CONSTANT;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Animation._UniversalLerp = function (left, right, amount) {\r\n var constructor = left.constructor;\r\n if (constructor.Lerp) { // Lerp supported\r\n return constructor.Lerp(left, right, amount);\r\n }\r\n else if (constructor.Slerp) { // Slerp supported\r\n return constructor.Slerp(left, right, amount);\r\n }\r\n else if (left.toFixed) { // Number\r\n return left * (1.0 - amount) + amount * right;\r\n }\r\n else { // Blending not supported\r\n return right;\r\n }\r\n };\r\n /**\r\n * Parses an animation object and creates an animation\r\n * @param parsedAnimation Parsed animation object\r\n * @returns Animation object\r\n */\r\n Animation.Parse = function (parsedAnimation) {\r\n var animation = new Animation(parsedAnimation.name, parsedAnimation.property, parsedAnimation.framePerSecond, parsedAnimation.dataType, parsedAnimation.loopBehavior);\r\n var dataType = parsedAnimation.dataType;\r\n var keys = [];\r\n var data;\r\n var index;\r\n if (parsedAnimation.enableBlending) {\r\n animation.enableBlending = parsedAnimation.enableBlending;\r\n }\r\n if (parsedAnimation.blendingSpeed) {\r\n animation.blendingSpeed = parsedAnimation.blendingSpeed;\r\n }\r\n for (index = 0; index < parsedAnimation.keys.length; index++) {\r\n var key = parsedAnimation.keys[index];\r\n var inTangent;\r\n var outTangent;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n data = key.values[0];\r\n if (key.values.length >= 1) {\r\n inTangent = key.values[1];\r\n }\r\n if (key.values.length >= 2) {\r\n outTangent = key.values[2];\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n data = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromArray(key.values);\r\n if (key.values.length >= 8) {\r\n var _inTangent = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromArray(key.values.slice(4, 8));\r\n if (!_inTangent.equals(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Zero())) {\r\n inTangent = _inTangent;\r\n }\r\n }\r\n if (key.values.length >= 12) {\r\n var _outTangent = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromArray(key.values.slice(8, 12));\r\n if (!_outTangent.equals(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Zero())) {\r\n outTangent = _outTangent;\r\n }\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n data = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n data = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n default:\r\n data = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(key.values);\r\n break;\r\n }\r\n var keyData = {};\r\n keyData.frame = key.frame;\r\n keyData.value = data;\r\n if (inTangent != undefined) {\r\n keyData.inTangent = inTangent;\r\n }\r\n if (outTangent != undefined) {\r\n keyData.outTangent = outTangent;\r\n }\r\n keys.push(keyData);\r\n }\r\n animation.setKeys(keys);\r\n if (parsedAnimation.ranges) {\r\n for (index = 0; index < parsedAnimation.ranges.length; index++) {\r\n data = parsedAnimation.ranges[index];\r\n animation.createRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n Animation.AppendSerializedAnimations = function (source, destination) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"].AppendSerializedAnimations(source, destination);\r\n };\r\n /**\r\n * Use matrix interpolation instead of using direct key value when animating matrices\r\n */\r\n Animation.AllowMatricesInterpolation = false;\r\n /**\r\n * When matrix interpolation is enabled, this boolean forces the system to use Matrix.DecomposeLerp instead of Matrix.Lerp. Interpolation is more precise but slower\r\n */\r\n Animation.AllowMatrixDecomposeForInterpolation = true;\r\n // Statics\r\n /**\r\n * Float animation type\r\n */\r\n Animation._ANIMATIONTYPE_FLOAT = 0;\r\n /**\r\n * Vector3 animation type\r\n */\r\n Animation._ANIMATIONTYPE_VECTOR3 = 1;\r\n /**\r\n * Quaternion animation type\r\n */\r\n Animation._ANIMATIONTYPE_QUATERNION = 2;\r\n /**\r\n * Matrix animation type\r\n */\r\n Animation._ANIMATIONTYPE_MATRIX = 3;\r\n /**\r\n * Color3 animation type\r\n */\r\n Animation._ANIMATIONTYPE_COLOR3 = 4;\r\n /**\r\n * Vector2 animation type\r\n */\r\n Animation._ANIMATIONTYPE_VECTOR2 = 5;\r\n /**\r\n * Size animation type\r\n */\r\n Animation._ANIMATIONTYPE_SIZE = 6;\r\n /**\r\n * Relative Loop Mode\r\n */\r\n Animation._ANIMATIONLOOPMODE_RELATIVE = 0;\r\n /**\r\n * Cycle Loop Mode\r\n */\r\n Animation._ANIMATIONLOOPMODE_CYCLE = 1;\r\n /**\r\n * Constant Loop Mode\r\n */\r\n Animation._ANIMATIONLOOPMODE_CONSTANT = 2;\r\n return Animation;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Animation\"] = Animation;\r\n_node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"]._AnimationRangeFactory = function (name, from, to) { return new _animationRange__WEBPACK_IMPORTED_MODULE_6__[\"AnimationRange\"](name, from, to); };\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationEvent.ts\":\n/*!**************************************!*\\\n !*** ./Animations/animationEvent.ts ***!\n \\**************************************/\n/*! exports provided: AnimationEvent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return AnimationEvent; });\n/**\r\n * Composed of a frame, and an action function\r\n */\r\nvar AnimationEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the animation event\r\n * @param frame The frame for which the event is triggered\r\n * @param action The event to perform when triggered\r\n * @param onlyOnce Specifies if the event should be triggered only once\r\n */\r\n function AnimationEvent(\r\n /** The frame for which the event is triggered **/\r\n frame, \r\n /** The event to perform when triggered **/\r\n action, \r\n /** Specifies if the event should be triggered only once**/\r\n onlyOnce) {\r\n this.frame = frame;\r\n this.action = action;\r\n this.onlyOnce = onlyOnce;\r\n /**\r\n * Specifies if the animation event is done\r\n */\r\n this.isDone = false;\r\n }\r\n /** @hidden */\r\n AnimationEvent.prototype._clone = function () {\r\n return new AnimationEvent(this.frame, this.action, this.onlyOnce);\r\n };\r\n return AnimationEvent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationGroup.ts\":\n/*!**************************************!*\\\n !*** ./Animations/animationGroup.ts ***!\n \\**************************************/\n/*! exports provided: TargetedAnimation, AnimationGroup */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return TargetedAnimation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return AnimationGroup; });\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _animatable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./animatable */ \"./Animations/animatable.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nvar TargetedAnimation = /** @class */ (function () {\r\n function TargetedAnimation() {\r\n }\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n TargetedAnimation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n return serializationObject;\r\n };\r\n return TargetedAnimation;\r\n}());\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nvar AnimationGroup = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see http://doc.babylonjs.com/how_to/group\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n */\r\n function AnimationGroup(\r\n /** The name of the animation group */\r\n name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n this._targetedAnimations = new Array();\r\n this._animatables = new Array();\r\n this._from = Number.MAX_VALUE;\r\n this._to = -Number.MAX_VALUE;\r\n this._speedRatio = 1;\r\n this._loopAnimation = false;\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n this.onAnimationEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n this.onAnimationLoopObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n this.onAnimationGroupEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n this.onAnimationGroupPauseObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n this.onAnimationGroupPlayObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedScene;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.animationGroups.push(this);\r\n }\r\n Object.defineProperty(AnimationGroup.prototype, \"from\", {\r\n /**\r\n * Gets the first frame\r\n */\r\n get: function () {\r\n return this._from;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"to\", {\r\n /**\r\n * Gets the last frame\r\n */\r\n get: function () {\r\n return this._to;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isStarted\", {\r\n /**\r\n * Define if the animations are started\r\n */\r\n get: function () {\r\n return this._isStarted;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isPlaying\", {\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n get: function () {\r\n return this._isStarted && !this._isPaused;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n set: function (value) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n this._speedRatio = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"loopAnimation\", {\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n get: function () {\r\n return this._loopAnimation;\r\n },\r\n set: function (value) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n this._loopAnimation = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"targetedAnimations\", {\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n get: function () {\r\n return this._targetedAnimations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"animatables\", {\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n get: function () {\r\n return this._animatables;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n AnimationGroup.prototype.addTargetedAnimation = function (animation, target) {\r\n var targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n var keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n this._targetedAnimations.push(targetedAnimation);\r\n return targetedAnimation;\r\n };\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.normalize = function (beginFrame, endFrame) {\r\n if (beginFrame === void 0) { beginFrame = null; }\r\n if (endFrame === void 0) { endFrame = null; }\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n for (var index = 0; index < this._targetedAnimations.length; index++) {\r\n var targetedAnimation = this._targetedAnimations[index];\r\n var keys = targetedAnimation.animation.getKeys();\r\n var startKey = keys[0];\r\n var endKey = keys[keys.length - 1];\r\n if (startKey.frame > beginFrame) {\r\n var newKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n if (endKey.frame < endFrame) {\r\n var newKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.outTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n return this;\r\n };\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @returns the current animation group\r\n */\r\n AnimationGroup.prototype.start = function (loop, speedRatio, from, to) {\r\n var _this = this;\r\n if (loop === void 0) { loop = false; }\r\n if (speedRatio === void 0) { speedRatio = 1; }\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n this._loopAnimation = loop;\r\n var _loop_1 = function (targetedAnimation) {\r\n var animatable = this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio);\r\n animatable.onAnimationEnd = function () {\r\n _this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n _this._checkAnimationGroupEnded(animatable);\r\n };\r\n animatable.onAnimationLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n };\r\n this_1._animatables.push(animatable);\r\n };\r\n var this_1 = this;\r\n for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {\r\n var targetedAnimation = _a[_i];\r\n _loop_1(targetedAnimation);\r\n }\r\n this._speedRatio = speedRatio;\r\n if (from !== undefined && to !== undefined) {\r\n if (from < to && this._speedRatio < 0) {\r\n var temp = to;\r\n to = from;\r\n from = temp;\r\n }\r\n else if (from > to && this._speedRatio > 0) {\r\n this._speedRatio = -speedRatio;\r\n }\r\n }\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.pause = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n this._isPaused = true;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.play = function (loop) {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n }\r\n else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n this._isPaused = false;\r\n return this;\r\n };\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.reset = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.restart = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.stop = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n var list = this._animatables.slice();\r\n for (var index = 0; index < list.length; index++) {\r\n list[index].stop();\r\n }\r\n this._isStarted = false;\r\n return this;\r\n };\r\n /**\r\n * Set animation weight for all animatables\r\n * @param weight defines the weight to use\r\n * @return the animationGroup\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with\r\n * @return the animationGroup\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.syncAllAnimationsWith = function (root) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @return the animationGroup\r\n */\r\n AnimationGroup.prototype.goToFrame = function (frame) {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Dispose all associated resources\r\n */\r\n AnimationGroup.prototype.dispose = function () {\r\n this._targetedAnimations = [];\r\n this._animatables = [];\r\n var index = this._scene.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n };\r\n AnimationGroup.prototype._checkAnimationGroupEnded = function (animatable) {\r\n // animatable should be taken out of the array\r\n var idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @returns the new aniamtion group\r\n */\r\n AnimationGroup.prototype.clone = function (newName, targetConverter) {\r\n var newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {\r\n var targetAnimation = _a[_i];\r\n newGroup.addTargetedAnimation(targetAnimation.animation.clone(), targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target);\r\n }\r\n return newGroup;\r\n };\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n AnimationGroup.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (var targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n var targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n AnimationGroup.Parse = function (parsedAnimationGroup, scene) {\r\n var animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (var i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n var targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n var animation = _animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].Parse(targetedAnimation.animation);\r\n var id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") { // morph target animation\r\n var morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n }\r\n else {\r\n var targetNode = scene.getNodeByID(id);\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.from !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n return animationGroup;\r\n };\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n AnimationGroup.prototype.getClassName = function () {\r\n return \"AnimationGroup\";\r\n };\r\n /**\r\n * Creates a detailled string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n AnimationGroup.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n };\r\n return AnimationGroup;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationKey.ts\":\n/*!************************************!*\\\n !*** ./Animations/animationKey.ts ***!\n \\************************************/\n/*! exports provided: AnimationKeyInterpolation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return AnimationKeyInterpolation; });\n/**\r\n * Enum for the animation key frame interpolation type\r\n */\r\nvar AnimationKeyInterpolation;\r\n(function (AnimationKeyInterpolation) {\r\n /**\r\n * Do not interpolate between keys and use the start key value only. Tangents are ignored\r\n */\r\n AnimationKeyInterpolation[AnimationKeyInterpolation[\"STEP\"] = 1] = \"STEP\";\r\n})(AnimationKeyInterpolation || (AnimationKeyInterpolation = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationPropertiesOverride.ts\":\n/*!***************************************************!*\\\n !*** ./Animations/animationPropertiesOverride.ts ***!\n \\***************************************************/\n/*! exports provided: AnimationPropertiesOverride */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return AnimationPropertiesOverride; });\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Animations/animation */ \"./Animations/animation.ts\");\n\r\n/**\r\n * Class used to override all child animations of a given target\r\n */\r\nvar AnimationPropertiesOverride = /** @class */ (function () {\r\n function AnimationPropertiesOverride() {\r\n /**\r\n * Gets or sets a value indicating if animation blending must be used\r\n */\r\n this.enableBlending = false;\r\n /**\r\n * Gets or sets the blending speed to use when enableBlending is true\r\n */\r\n this.blendingSpeed = 0.01;\r\n /**\r\n * Gets or sets the default loop mode to use\r\n */\r\n this.loopMode = _Animations_animation__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE;\r\n }\r\n return AnimationPropertiesOverride;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/animationRange.ts\":\n/*!**************************************!*\\\n !*** ./Animations/animationRange.ts ***!\n \\**************************************/\n/*! exports provided: AnimationRange */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return AnimationRange; });\n/**\r\n * Represents the range of an animation\r\n */\r\nvar AnimationRange = /** @class */ (function () {\r\n /**\r\n * Initializes the range of an animation\r\n * @param name The name of the animation range\r\n * @param from The starting frame of the animation\r\n * @param to The ending frame of the animation\r\n */\r\n function AnimationRange(\r\n /**The name of the animation range**/\r\n name, \r\n /**The starting frame of the animation */\r\n from, \r\n /**The ending frame of the animation*/\r\n to) {\r\n this.name = name;\r\n this.from = from;\r\n this.to = to;\r\n }\r\n /**\r\n * Makes a copy of the animation range\r\n * @returns A copy of the animation range\r\n */\r\n AnimationRange.prototype.clone = function () {\r\n return new AnimationRange(this.name, this.from, this.to);\r\n };\r\n return AnimationRange;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/easing.ts\":\n/*!******************************!*\\\n !*** ./Animations/easing.ts ***!\n \\******************************/\n/*! exports provided: EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return EasingFunction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return CircleEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return BackEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return BounceEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return CubicEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return ElasticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return ExponentialEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return PowerEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return QuadraticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return QuarticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return QuinticEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return SineEase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return BezierCurveEase; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n/**\r\n * Base class used for every default easing function.\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar EasingFunction = /** @class */ (function () {\r\n function EasingFunction() {\r\n this._easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n }\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n EasingFunction.prototype.setEasingMode = function (easingMode) {\r\n var n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n };\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n EasingFunction.prototype.getEasingMode = function () {\r\n return this._easingMode;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n EasingFunction.prototype.easeInCore = function (gradient) {\r\n throw new Error('You must implement this method');\r\n };\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n EasingFunction.prototype.ease = function (gradient) {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return (1 - this.easeInCore(1 - gradient));\r\n }\r\n if (gradient >= 0.5) {\r\n return (((1 - this.easeInCore((1 - gradient) * 2)) * 0.5) + 0.5);\r\n }\r\n return (this.easeInCore(gradient * 2) * 0.5);\r\n };\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEIN = 0;\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEOUT = 1;\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n EasingFunction.EASINGMODE_EASEINOUT = 2;\r\n return EasingFunction;\r\n}());\r\n\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CircleEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CircleEase, _super);\r\n function CircleEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CircleEase.prototype.easeInCore = function (gradient) {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return (1.0 - Math.sqrt(1.0 - (gradient * gradient)));\r\n };\r\n return CircleEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BackEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BackEase, _super);\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n function BackEase(\r\n /** Defines the amplitude of the function */\r\n amplitude) {\r\n if (amplitude === void 0) { amplitude = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.amplitude = amplitude;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BackEase.prototype.easeInCore = function (gradient) {\r\n var num = Math.max(0, this.amplitude);\r\n return (Math.pow(gradient, 3.0) - ((gradient * num) * Math.sin(3.1415926535897931 * gradient)));\r\n };\r\n return BackEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BounceEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BounceEase, _super);\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n function BounceEase(\r\n /** Defines the number of bounces */\r\n bounces, \r\n /** Defines the amplitude of the bounce */\r\n bounciness) {\r\n if (bounces === void 0) { bounces = 3; }\r\n if (bounciness === void 0) { bounciness = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.bounces = bounces;\r\n _this.bounciness = bounciness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BounceEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.bounces);\r\n var bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n var num9 = Math.pow(bounciness, y);\r\n var num5 = 1.0 - bounciness;\r\n var num4 = ((1.0 - num9) / num5) + (num9 * 0.5);\r\n var num15 = gradient * num4;\r\n var num65 = Math.log((-num15 * (1.0 - bounciness)) + 1.0) / Math.log(bounciness);\r\n var num3 = Math.floor(num65);\r\n var num13 = num3 + 1.0;\r\n var num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n var num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n var num7 = (num8 + num12) * 0.5;\r\n var num6 = gradient - num7;\r\n var num2 = num7 - num8;\r\n return (((-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2)) * (num6 + num2));\r\n };\r\n return BounceEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CubicEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CubicEase, _super);\r\n function CubicEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CubicEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient);\r\n };\r\n return CubicEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ElasticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ElasticEase, _super);\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n function ElasticEase(\r\n /** Defines the number of oscillations*/\r\n oscillations, \r\n /** Defines the amplitude of the oscillations*/\r\n springiness) {\r\n if (oscillations === void 0) { oscillations = 3; }\r\n if (springiness === void 0) { springiness = 3; }\r\n var _this = _super.call(this) || this;\r\n _this.oscillations = oscillations;\r\n _this.springiness = springiness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ElasticEase.prototype.easeInCore = function (gradient) {\r\n var num2;\r\n var num3 = Math.max(0.0, this.oscillations);\r\n var num = Math.max(0.0, this.springiness);\r\n if (num == 0) {\r\n num2 = gradient;\r\n }\r\n else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return (num2 * Math.sin(((6.2831853071795862 * num3) + 1.5707963267948966) * gradient));\r\n };\r\n return ElasticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ExponentialEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ExponentialEase, _super);\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n function ExponentialEase(\r\n /** Defines the exponent of the function */\r\n exponent) {\r\n if (exponent === void 0) { exponent = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ExponentialEase.prototype.easeInCore = function (gradient) {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n return ((Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0));\r\n };\r\n return ExponentialEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar PowerEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PowerEase, _super);\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n function PowerEase(\r\n /** Defines the power of the function */\r\n power) {\r\n if (power === void 0) { power = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.power = power;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PowerEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n };\r\n return PowerEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuadraticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](QuadraticEase, _super);\r\n function QuadraticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuadraticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient);\r\n };\r\n return QuadraticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuarticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](QuarticEase, _super);\r\n function QuarticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuarticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient);\r\n };\r\n return QuarticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuinticEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](QuinticEase, _super);\r\n function QuinticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuinticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient * gradient);\r\n };\r\n return QuinticEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar SineEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SineEase, _super);\r\n function SineEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n SineEase.prototype.easeInCore = function (gradient) {\r\n return (1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient)));\r\n };\r\n return SineEase;\r\n}(EasingFunction));\r\n\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see http://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BezierCurveEase = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BezierCurveEase, _super);\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n function BezierCurveEase(\r\n /** Defines the x component of the start tangent in the bezier curve */\r\n x1, \r\n /** Defines the y component of the start tangent in the bezier curve */\r\n y1, \r\n /** Defines the x component of the end tangent in the bezier curve */\r\n x2, \r\n /** Defines the y component of the end tangent in the bezier curve */\r\n y2) {\r\n if (x1 === void 0) { x1 = 0; }\r\n if (y1 === void 0) { y1 = 0; }\r\n if (x2 === void 0) { x2 = 1; }\r\n if (y2 === void 0) { y2 = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.x1 = x1;\r\n _this.y1 = y1;\r\n _this.x2 = x2;\r\n _this.y2 = y2;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BezierCurveEase.prototype.easeInCore = function (gradient) {\r\n return _Maths_math_path__WEBPACK_IMPORTED_MODULE_1__[\"BezierCurve\"].Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n };\r\n return BezierCurveEase;\r\n}(EasingFunction));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/index.ts\":\n/*!*****************************!*\\\n !*** ./Animations/index.ts ***!\n \\*****************************/\n/*! exports provided: Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _animatable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./animatable */ \"./Animations/animatable.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return _animatable__WEBPACK_IMPORTED_MODULE_0__[\"Animatable\"]; });\n\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _animation__WEBPACK_IMPORTED_MODULE_1__[\"_IAnimationState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return _animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"]; });\n\n/* harmony import */ var _animationGroup__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./animationGroup */ \"./Animations/animationGroup.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return _animationGroup__WEBPACK_IMPORTED_MODULE_2__[\"TargetedAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return _animationGroup__WEBPACK_IMPORTED_MODULE_2__[\"AnimationGroup\"]; });\n\n/* harmony import */ var _animationPropertiesOverride__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./animationPropertiesOverride */ \"./Animations/animationPropertiesOverride.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return _animationPropertiesOverride__WEBPACK_IMPORTED_MODULE_3__[\"AnimationPropertiesOverride\"]; });\n\n/* harmony import */ var _easing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./easing */ \"./Animations/easing.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"EasingFunction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"CircleEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"BackEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"BounceEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"CubicEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"ElasticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"ExponentialEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"PowerEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"QuadraticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"QuarticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"QuinticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"SineEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return _easing__WEBPACK_IMPORTED_MODULE_4__[\"BezierCurveEase\"]; });\n\n/* harmony import */ var _runtimeAnimation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./runtimeAnimation */ \"./Animations/runtimeAnimation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return _runtimeAnimation__WEBPACK_IMPORTED_MODULE_5__[\"RuntimeAnimation\"]; });\n\n/* harmony import */ var _animationEvent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./animationEvent */ \"./Animations/animationEvent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return _animationEvent__WEBPACK_IMPORTED_MODULE_6__[\"AnimationEvent\"]; });\n\n/* empty/unused harmony star reexport *//* harmony import */ var _animationKey__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./animationKey */ \"./Animations/animationKey.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return _animationKey__WEBPACK_IMPORTED_MODULE_7__[\"AnimationKeyInterpolation\"]; });\n\n/* harmony import */ var _animationRange__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./animationRange */ \"./Animations/animationRange.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return _animationRange__WEBPACK_IMPORTED_MODULE_8__[\"AnimationRange\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Animations/runtimeAnimation.ts\":\n/*!****************************************!*\\\n !*** ./Animations/runtimeAnimation.ts ***!\n \\****************************************/\n/*! exports provided: RuntimeAnimation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return RuntimeAnimation; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.size */ \"./Maths/math.size.ts\");\n\r\n\r\n\r\n\r\n// Static values to help the garbage collector\r\n// Quaternion\r\nvar _staticOffsetValueQuaternion = Object.freeze(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"](0, 0, 0, 0));\r\n// Vector3\r\nvar _staticOffsetValueVector3 = Object.freeze(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero());\r\n// Vector2\r\nvar _staticOffsetValueVector2 = Object.freeze(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero());\r\n// Size\r\nvar _staticOffsetValueSize = Object.freeze(_Maths_math_size__WEBPACK_IMPORTED_MODULE_3__[\"Size\"].Zero());\r\n// Color3\r\nvar _staticOffsetValueColor3 = Object.freeze(_Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].Black());\r\n/**\r\n * Defines a runtime animation\r\n */\r\nvar RuntimeAnimation = /** @class */ (function () {\r\n /**\r\n * Create a new RuntimeAnimation object\r\n * @param target defines the target of the animation\r\n * @param animation defines the source animation object\r\n * @param scene defines the hosting scene\r\n * @param host defines the initiating Animatable\r\n */\r\n function RuntimeAnimation(target, animation, scene, host) {\r\n var _this = this;\r\n this._events = new Array();\r\n /**\r\n * The current frame of the runtime animation\r\n */\r\n this._currentFrame = 0;\r\n /**\r\n * The original value of the runtime animation\r\n */\r\n this._originalValue = new Array();\r\n /**\r\n * The original blend value of the runtime animation\r\n */\r\n this._originalBlendValue = null;\r\n /**\r\n * The offsets cache of the runtime animation\r\n */\r\n this._offsetsCache = {};\r\n /**\r\n * The high limits cache of the runtime animation\r\n */\r\n this._highLimitsCache = {};\r\n /**\r\n * Specifies if the runtime animation has been stopped\r\n */\r\n this._stopped = false;\r\n /**\r\n * The blending factor of the runtime animation\r\n */\r\n this._blendingFactor = 0;\r\n /**\r\n * The current value of the runtime animation\r\n */\r\n this._currentValue = null;\r\n this._currentActiveTarget = null;\r\n this._directTarget = null;\r\n /**\r\n * The target path of the runtime animation\r\n */\r\n this._targetPath = \"\";\r\n /**\r\n * The weight of the runtime animation\r\n */\r\n this._weight = 1.0;\r\n /**\r\n * The ratio offset of the runtime animation\r\n */\r\n this._ratioOffset = 0;\r\n /**\r\n * The previous delay of the runtime animation\r\n */\r\n this._previousDelay = 0;\r\n /**\r\n * The previous ratio of the runtime animation\r\n */\r\n this._previousRatio = 0;\r\n this._targetIsArray = false;\r\n this._animation = animation;\r\n this._target = target;\r\n this._scene = scene;\r\n this._host = host;\r\n this._activeTargets = [];\r\n animation._runtimeAnimations.push(this);\r\n // State\r\n this._animationState = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: this._getCorrectLoopMode()\r\n };\r\n if (this._animation.dataType === _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_MATRIX) {\r\n this._animationState.workValue = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Zero();\r\n }\r\n // Limits\r\n this._keys = this._animation.getKeys();\r\n this._minFrame = this._keys[0].frame;\r\n this._maxFrame = this._keys[this._keys.length - 1].frame;\r\n this._minValue = this._keys[0].value;\r\n this._maxValue = this._keys[this._keys.length - 1].value;\r\n // Add a start key at frame 0 if missing\r\n if (this._minFrame !== 0) {\r\n var newKey = { frame: 0, value: this._minValue };\r\n this._keys.splice(0, 0, newKey);\r\n }\r\n // Check data\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target_1 = _a[_i];\r\n this._preparePath(target_1, index);\r\n this._getOriginalValues(index);\r\n index++;\r\n }\r\n this._targetIsArray = true;\r\n }\r\n else {\r\n this._preparePath(this._target);\r\n this._getOriginalValues();\r\n this._targetIsArray = false;\r\n this._directTarget = this._activeTargets[0];\r\n }\r\n // Cloning events locally\r\n var events = animation.getEvents();\r\n if (events && events.length > 0) {\r\n events.forEach(function (e) {\r\n _this._events.push(e._clone());\r\n });\r\n }\r\n this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;\r\n }\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentFrame\", {\r\n /**\r\n * Gets the current frame of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentFrame;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"weight\", {\r\n /**\r\n * Gets the weight of the runtime animation\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentValue\", {\r\n /**\r\n * Gets the current value of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"targetPath\", {\r\n /**\r\n * Gets the target path of the runtime animation\r\n */\r\n get: function () {\r\n return this._targetPath;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"target\", {\r\n /**\r\n * Gets the actual target of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentActiveTarget;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RuntimeAnimation.prototype._preparePath = function (target, targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var targetPropertyPath = this._animation.targetPropertyPath;\r\n if (targetPropertyPath.length > 1) {\r\n var property = target[targetPropertyPath[0]];\r\n for (var index = 1; index < targetPropertyPath.length - 1; index++) {\r\n property = property[targetPropertyPath[index]];\r\n }\r\n this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];\r\n this._activeTargets[targetIndex] = property;\r\n }\r\n else {\r\n this._targetPath = targetPropertyPath[0];\r\n this._activeTargets[targetIndex] = target;\r\n }\r\n };\r\n Object.defineProperty(RuntimeAnimation.prototype, \"animation\", {\r\n /**\r\n * Gets the animation from the runtime animation\r\n */\r\n get: function () {\r\n return this._animation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the runtime animation to the beginning\r\n * @param restoreOriginal defines whether to restore the target property to the original value\r\n */\r\n RuntimeAnimation.prototype.reset = function (restoreOriginal) {\r\n if (restoreOriginal === void 0) { restoreOriginal = false; }\r\n if (restoreOriginal) {\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (this._originalValue[index] !== undefined) {\r\n this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);\r\n }\r\n index++;\r\n }\r\n }\r\n else {\r\n if (this._originalValue[0] !== undefined) {\r\n this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);\r\n }\r\n }\r\n }\r\n this._offsetsCache = {};\r\n this._highLimitsCache = {};\r\n this._currentFrame = 0;\r\n this._blendingFactor = 0;\r\n // Events\r\n for (var index = 0; index < this._events.length; index++) {\r\n this._events[index].isDone = false;\r\n }\r\n };\r\n /**\r\n * Specifies if the runtime animation is stopped\r\n * @returns Boolean specifying if the runtime animation is stopped\r\n */\r\n RuntimeAnimation.prototype.isStopped = function () {\r\n return this._stopped;\r\n };\r\n /**\r\n * Disposes of the runtime animation\r\n */\r\n RuntimeAnimation.prototype.dispose = function () {\r\n var index = this._animation.runtimeAnimations.indexOf(this);\r\n if (index > -1) {\r\n this._animation.runtimeAnimations.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Apply the interpolated value to the target\r\n * @param currentValue defines the value computed by the animation\r\n * @param weight defines the weight to apply to this value (Defaults to 1.0)\r\n */\r\n RuntimeAnimation.prototype.setValue = function (currentValue, weight) {\r\n if (this._targetIsArray) {\r\n for (var index = 0; index < this._target.length; index++) {\r\n var target = this._target[index];\r\n this._setValue(target, this._activeTargets[index], currentValue, weight, index);\r\n }\r\n return;\r\n }\r\n this._setValue(this._target, this._directTarget, currentValue, weight, 0);\r\n };\r\n RuntimeAnimation.prototype._getOriginalValues = function (targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var originalValue;\r\n var target = this._activeTargets[targetIndex];\r\n if (target.getRestPose && this._targetPath === \"_matrix\") { // For bones\r\n originalValue = target.getRestPose();\r\n }\r\n else {\r\n originalValue = target[this._targetPath];\r\n }\r\n if (originalValue && originalValue.clone) {\r\n this._originalValue[targetIndex] = originalValue.clone();\r\n }\r\n else {\r\n this._originalValue[targetIndex] = originalValue;\r\n }\r\n };\r\n RuntimeAnimation.prototype._setValue = function (target, destination, currentValue, weight, targetIndex) {\r\n // Set value\r\n this._currentActiveTarget = destination;\r\n this._weight = weight;\r\n if (this._enableBlending && this._blendingFactor <= 1.0) {\r\n if (!this._originalBlendValue) {\r\n var originalValue = destination[this._targetPath];\r\n if (originalValue.clone) {\r\n this._originalBlendValue = originalValue.clone();\r\n }\r\n else {\r\n this._originalBlendValue = originalValue;\r\n }\r\n }\r\n if (this._originalBlendValue.m) { // Matrix\r\n if (_animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].AllowMatrixDecomposeForInterpolation) {\r\n if (this._currentValue) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n else {\r\n if (this._currentValue) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Lerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n }\r\n else {\r\n this._currentValue = _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"]._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;\r\n this._blendingFactor += blendingSpeed;\r\n }\r\n else {\r\n this._currentValue = currentValue;\r\n }\r\n if (weight !== -1.0) {\r\n this._scene._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);\r\n }\r\n else {\r\n destination[this._targetPath] = this._currentValue;\r\n }\r\n if (target.markAsDirty) {\r\n target.markAsDirty(this._animation.targetProperty);\r\n }\r\n };\r\n /**\r\n * Gets the loop pmode of the runtime animation\r\n * @returns Loop Mode\r\n */\r\n RuntimeAnimation.prototype._getCorrectLoopMode = function () {\r\n if (this._target && this._target.animationPropertiesOverride) {\r\n return this._target.animationPropertiesOverride.loopMode;\r\n }\r\n return this._animation.loopMode;\r\n };\r\n /**\r\n * Move the current animation to a given frame\r\n * @param frame defines the frame to move to\r\n */\r\n RuntimeAnimation.prototype.goToFrame = function (frame) {\r\n var keys = this._animation.getKeys();\r\n if (frame < keys[0].frame) {\r\n frame = keys[0].frame;\r\n }\r\n else if (frame > keys[keys.length - 1].frame) {\r\n frame = keys[keys.length - 1].frame;\r\n }\r\n // Need to reset animation events\r\n var events = this._events;\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset events in the future\r\n events[index].isDone = events[index].frame < frame;\r\n }\r\n }\r\n }\r\n this._currentFrame = frame;\r\n var currentValue = this._animation._interpolate(frame, this._animationState);\r\n this.setValue(currentValue, -1);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {\r\n var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;\r\n this._ratioOffset = this._previousRatio - newRatio;\r\n };\r\n /**\r\n * Execute the current animation\r\n * @param delay defines the delay to add to the current frame\r\n * @param from defines the lower bound of the animation range\r\n * @param to defines the upper bound of the animation range\r\n * @param loop defines if the current animation must loop\r\n * @param speedRatio defines the current speed ratio\r\n * @param weight defines the weight of the animation (default is -1 so no weight)\r\n * @param onLoop optional callback called when animation loops\r\n * @returns a boolean indicating if the animation is running\r\n */\r\n RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {\r\n if (weight === void 0) { weight = -1.0; }\r\n var animation = this._animation;\r\n var targetPropertyPath = animation.targetPropertyPath;\r\n if (!targetPropertyPath || targetPropertyPath.length < 1) {\r\n this._stopped = true;\r\n return false;\r\n }\r\n var returnValue = true;\r\n // Check limits\r\n if (from < this._minFrame || from > this._maxFrame) {\r\n from = this._minFrame;\r\n }\r\n if (to < this._minFrame || to > this._maxFrame) {\r\n to = this._maxFrame;\r\n }\r\n var range = to - from;\r\n var offsetValue;\r\n // Compute ratio which represents the frame delta between from and to\r\n var ratio = (delay * (animation.framePerSecond * speedRatio) / 1000.0) + this._ratioOffset;\r\n var highLimitValue = 0;\r\n this._previousDelay = delay;\r\n this._previousRatio = ratio;\r\n if (!loop && (to >= from && ratio >= range)) { // If we are out of range and not looping get back to caller\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._maxValue);\r\n }\r\n else if (!loop && (from >= to && ratio <= range)) {\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._minValue);\r\n }\r\n else if (this._animationState.loopMode !== _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE) {\r\n var keyOffset = to.toString() + from.toString();\r\n if (!this._offsetsCache[keyOffset]) {\r\n this._animationState.repeatCount = 0;\r\n this._animationState.loopMode = _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE;\r\n var fromValue = animation._interpolate(from, this._animationState);\r\n var toValue = animation._interpolate(to, this._animationState);\r\n this._animationState.loopMode = this._getCorrectLoopMode();\r\n switch (animation.dataType) {\r\n // Float\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_FLOAT:\r\n this._offsetsCache[keyOffset] = toValue - fromValue;\r\n break;\r\n // Quaternion\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_QUATERNION:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Vector2\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR2:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Size\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_SIZE:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Color3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_COLOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n default:\r\n break;\r\n }\r\n this._highLimitsCache[keyOffset] = toValue;\r\n }\r\n highLimitValue = this._highLimitsCache[keyOffset];\r\n offsetValue = this._offsetsCache[keyOffset];\r\n }\r\n if (offsetValue === undefined) {\r\n switch (animation.dataType) {\r\n // Float\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_FLOAT:\r\n offsetValue = 0;\r\n break;\r\n // Quaternion\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_QUATERNION:\r\n offsetValue = _staticOffsetValueQuaternion;\r\n break;\r\n // Vector3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR3:\r\n offsetValue = _staticOffsetValueVector3;\r\n break;\r\n // Vector2\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_VECTOR2:\r\n offsetValue = _staticOffsetValueVector2;\r\n break;\r\n // Size\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_SIZE:\r\n offsetValue = _staticOffsetValueSize;\r\n break;\r\n // Color3\r\n case _animation__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"].ANIMATIONTYPE_COLOR3:\r\n offsetValue = _staticOffsetValueColor3;\r\n }\r\n }\r\n // Compute value\r\n var currentFrame;\r\n if (this._host && this._host.syncRoot) {\r\n var syncRoot = this._host.syncRoot;\r\n var hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);\r\n currentFrame = from + (to - from) * hostNormalizedFrame;\r\n }\r\n else {\r\n currentFrame = (returnValue && range !== 0) ? from + ratio % range : to;\r\n }\r\n // Reset events if looping\r\n var events = this._events;\r\n if (range > 0 && this.currentFrame > currentFrame ||\r\n range < 0 && this.currentFrame < currentFrame) {\r\n this._onLoop();\r\n // Need to reset animation events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset event, the animation is looping\r\n events[index].isDone = false;\r\n }\r\n }\r\n }\r\n }\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = range === 0 ? 0 : (ratio / range) >> 0;\r\n this._animationState.highLimitValue = highLimitValue;\r\n this._animationState.offsetValue = offsetValue;\r\n var currentValue = animation._interpolate(currentFrame, this._animationState);\r\n // Set value\r\n this.setValue(currentValue, weight);\r\n // Check events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n // Make sure current frame has passed event frame and that event frame is within the current range\r\n // Also, handle both forward and reverse animations\r\n if ((range > 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||\r\n (range < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {\r\n var event = events[index];\r\n if (!event.isDone) {\r\n // If event should be done only once, remove it.\r\n if (event.onlyOnce) {\r\n events.splice(index, 1);\r\n index--;\r\n }\r\n event.isDone = true;\r\n event.action(currentFrame);\r\n } // Don't do anything if the event has already be done.\r\n }\r\n }\r\n }\r\n if (!returnValue) {\r\n this._stopped = true;\r\n }\r\n return returnValue;\r\n };\r\n return RuntimeAnimation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/analyser.ts\":\n/*!***************************!*\\\n !*** ./Audio/analyser.ts ***!\n \\***************************/\n/*! exports provided: Analyser */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return Analyser; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/**\r\n * Class used to work with sound analyzer using fast fourier transform (FFT)\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar Analyser = /** @class */ (function () {\r\n /**\r\n * Creates a new analyser\r\n * @param scene defines hosting scene\r\n */\r\n function Analyser(scene) {\r\n /**\r\n * Gets or sets the smoothing\r\n * @ignorenaming\r\n */\r\n this.SMOOTHING = 0.75;\r\n /**\r\n * Gets or sets the FFT table size\r\n * @ignorenaming\r\n */\r\n this.FFT_SIZE = 512;\r\n /**\r\n * Gets or sets the bar graph amplitude\r\n * @ignorenaming\r\n */\r\n this.BARGRAPHAMPLITUDE = 256;\r\n /**\r\n * Gets or sets the position of the debug canvas\r\n * @ignorenaming\r\n */\r\n this.DEBUGCANVASPOS = { x: 20, y: 20 };\r\n /**\r\n * Gets or sets the debug canvas size\r\n * @ignorenaming\r\n */\r\n this.DEBUGCANVASSIZE = { width: 320, height: 200 };\r\n this._scene = scene;\r\n this._audioEngine = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine;\r\n if (this._audioEngine.canUseWebAudio && this._audioEngine.audioContext) {\r\n this._webAudioAnalyser = this._audioEngine.audioContext.createAnalyser();\r\n this._webAudioAnalyser.minDecibels = -140;\r\n this._webAudioAnalyser.maxDecibels = 0;\r\n this._byteFreqs = new Uint8Array(this._webAudioAnalyser.frequencyBinCount);\r\n this._byteTime = new Uint8Array(this._webAudioAnalyser.frequencyBinCount);\r\n this._floatFreqs = new Float32Array(this._webAudioAnalyser.frequencyBinCount);\r\n }\r\n }\r\n /**\r\n * Get the number of data values you will have to play with for the visualization\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/frequencyBinCount\r\n * @returns a number\r\n */\r\n Analyser.prototype.getFrequencyBinCount = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n return this._webAudioAnalyser.frequencyBinCount;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Gets the current frequency data as a byte array\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData\r\n * @returns a Uint8Array\r\n */\r\n Analyser.prototype.getByteFrequencyData = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;\r\n this._webAudioAnalyser.fftSize = this.FFT_SIZE;\r\n this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs);\r\n }\r\n return this._byteFreqs;\r\n };\r\n /**\r\n * Gets the current waveform as a byte array\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteTimeDomainData\r\n * @returns a Uint8Array\r\n */\r\n Analyser.prototype.getByteTimeDomainData = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;\r\n this._webAudioAnalyser.fftSize = this.FFT_SIZE;\r\n this._webAudioAnalyser.getByteTimeDomainData(this._byteTime);\r\n }\r\n return this._byteTime;\r\n };\r\n /**\r\n * Gets the current frequency data as a float array\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData\r\n * @returns a Float32Array\r\n */\r\n Analyser.prototype.getFloatFrequencyData = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;\r\n this._webAudioAnalyser.fftSize = this.FFT_SIZE;\r\n this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs);\r\n }\r\n return this._floatFreqs;\r\n };\r\n /**\r\n * Renders the debug canvas\r\n */\r\n Analyser.prototype.drawDebugCanvas = function () {\r\n var _this = this;\r\n if (this._audioEngine.canUseWebAudio) {\r\n if (!this._debugCanvas) {\r\n this._debugCanvas = document.createElement(\"canvas\");\r\n this._debugCanvas.width = this.DEBUGCANVASSIZE.width;\r\n this._debugCanvas.height = this.DEBUGCANVASSIZE.height;\r\n this._debugCanvas.style.position = \"absolute\";\r\n this._debugCanvas.style.top = this.DEBUGCANVASPOS.y + \"px\";\r\n this._debugCanvas.style.left = this.DEBUGCANVASPOS.x + \"px\";\r\n this._debugCanvasContext = this._debugCanvas.getContext(\"2d\");\r\n document.body.appendChild(this._debugCanvas);\r\n this._registerFunc = function () {\r\n _this.drawDebugCanvas();\r\n };\r\n this._scene.registerBeforeRender(this._registerFunc);\r\n }\r\n if (this._registerFunc && this._debugCanvasContext) {\r\n var workingArray = this.getByteFrequencyData();\r\n this._debugCanvasContext.fillStyle = 'rgb(0, 0, 0)';\r\n this._debugCanvasContext.fillRect(0, 0, this.DEBUGCANVASSIZE.width, this.DEBUGCANVASSIZE.height);\r\n // Draw the frequency domain chart.\r\n for (var i = 0; i < this.getFrequencyBinCount(); i++) {\r\n var value = workingArray[i];\r\n var percent = value / this.BARGRAPHAMPLITUDE;\r\n var height = this.DEBUGCANVASSIZE.height * percent;\r\n var offset = this.DEBUGCANVASSIZE.height - height - 1;\r\n var barWidth = this.DEBUGCANVASSIZE.width / this.getFrequencyBinCount();\r\n var hue = i / this.getFrequencyBinCount() * 360;\r\n this._debugCanvasContext.fillStyle = 'hsl(' + hue + ', 100%, 50%)';\r\n this._debugCanvasContext.fillRect(i * barWidth, offset, barWidth, height);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Stops rendering the debug canvas and removes it\r\n */\r\n Analyser.prototype.stopDebugCanvas = function () {\r\n if (this._debugCanvas) {\r\n if (this._registerFunc) {\r\n this._scene.unregisterBeforeRender(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n document.body.removeChild(this._debugCanvas);\r\n this._debugCanvas = null;\r\n this._debugCanvasContext = null;\r\n }\r\n };\r\n /**\r\n * Connects two audio nodes\r\n * @param inputAudioNode defines first node to connect\r\n * @param outputAudioNode defines second node to connect\r\n */\r\n Analyser.prototype.connectAudioNodes = function (inputAudioNode, outputAudioNode) {\r\n if (this._audioEngine.canUseWebAudio) {\r\n inputAudioNode.connect(this._webAudioAnalyser);\r\n this._webAudioAnalyser.connect(outputAudioNode);\r\n }\r\n };\r\n /**\r\n * Releases all associated resources\r\n */\r\n Analyser.prototype.dispose = function () {\r\n if (this._audioEngine.canUseWebAudio) {\r\n this._webAudioAnalyser.disconnect();\r\n }\r\n };\r\n return Analyser;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/audioEngine.ts\":\n/*!******************************!*\\\n !*** ./Audio/audioEngine.ts ***!\n \\******************************/\n/*! exports provided: AudioEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return AudioEngine; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n// Sets the default audio engine to Babylon.js\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].AudioEngineFactory = function (hostElement) { return new AudioEngine(hostElement); };\r\n/**\r\n * This represents the default audio engine used in babylon.\r\n * It is responsible to play, synchronize and analyse sounds throughout the application.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar AudioEngine = /** @class */ (function () {\r\n /**\r\n * Instantiates a new audio engine.\r\n *\r\n * There should be only one per page as some browsers restrict the number\r\n * of audio contexts you can create.\r\n * @param hostElement defines the host element where to display the mute icon if necessary\r\n */\r\n function AudioEngine(hostElement) {\r\n var _this = this;\r\n if (hostElement === void 0) { hostElement = null; }\r\n this._audioContext = null;\r\n this._audioContextInitialized = false;\r\n this._muteButton = null;\r\n /**\r\n * Gets whether the current host supports Web Audio and thus could create AudioContexts.\r\n */\r\n this.canUseWebAudio = false;\r\n /**\r\n * Defines if Babylon should emit a warning if WebAudio is not supported.\r\n * @ignoreNaming\r\n */\r\n this.WarnedWebAudioUnsupported = false;\r\n /**\r\n * Gets whether or not mp3 are supported by your browser.\r\n */\r\n this.isMP3supported = false;\r\n /**\r\n * Gets whether or not ogg are supported by your browser.\r\n */\r\n this.isOGGsupported = false;\r\n /**\r\n * Gets whether audio has been unlocked on the device.\r\n * Some Browsers have strong restrictions about Audio and won t autoplay unless\r\n * a user interaction has happened.\r\n */\r\n this.unlocked = true;\r\n /**\r\n * Defines if the audio engine relies on a custom unlocked button.\r\n * In this case, the embedded button will not be displayed.\r\n */\r\n this.useCustomUnlockedButton = false;\r\n /**\r\n * Event raised when audio has been unlocked on the browser.\r\n */\r\n this.onAudioUnlockedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Event raised when audio has been locked on the browser.\r\n */\r\n this.onAudioLockedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._tryToRun = false;\r\n this._onResize = function () {\r\n _this._moveButtonToTopLeft();\r\n };\r\n if (typeof window.AudioContext !== 'undefined' || typeof window.webkitAudioContext !== 'undefined') {\r\n window.AudioContext = window.AudioContext || window.webkitAudioContext;\r\n this.canUseWebAudio = true;\r\n }\r\n var audioElem = document.createElement('audio');\r\n this._hostElement = hostElement;\r\n try {\r\n if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/mpeg; codecs=\"mp3\"').replace(/^no$/, '')) {\r\n this.isMP3supported = true;\r\n }\r\n }\r\n catch (e) {\r\n // protect error during capability check.\r\n }\r\n try {\r\n if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/ogg; codecs=\"vorbis\"').replace(/^no$/, '')) {\r\n this.isOGGsupported = true;\r\n }\r\n }\r\n catch (e) {\r\n // protect error during capability check.\r\n }\r\n }\r\n Object.defineProperty(AudioEngine.prototype, \"audioContext\", {\r\n /**\r\n * Gets the current AudioContext if available.\r\n */\r\n get: function () {\r\n if (!this._audioContextInitialized) {\r\n this._initializeAudioContext();\r\n }\r\n else {\r\n if (!this.unlocked && !this._muteButton) {\r\n this._displayMuteButton();\r\n }\r\n }\r\n return this._audioContext;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Flags the audio engine in Locked state.\r\n * This happens due to new browser policies preventing audio to autoplay.\r\n */\r\n AudioEngine.prototype.lock = function () {\r\n this._triggerSuspendedState();\r\n };\r\n /**\r\n * Unlocks the audio engine once a user action has been done on the dom.\r\n * This is helpful to resume play once browser policies have been satisfied.\r\n */\r\n AudioEngine.prototype.unlock = function () {\r\n this._triggerRunningState();\r\n };\r\n AudioEngine.prototype._resumeAudioContext = function () {\r\n var result;\r\n if (this._audioContext.resume) {\r\n result = this._audioContext.resume();\r\n }\r\n return result || Promise.resolve();\r\n };\r\n AudioEngine.prototype._initializeAudioContext = function () {\r\n try {\r\n if (this.canUseWebAudio) {\r\n this._audioContext = new AudioContext();\r\n // create a global volume gain node\r\n this.masterGain = this._audioContext.createGain();\r\n this.masterGain.gain.value = 1;\r\n this.masterGain.connect(this._audioContext.destination);\r\n this._audioContextInitialized = true;\r\n if (this._audioContext.state === \"running\") {\r\n // Do not wait for the promise to unlock.\r\n this._triggerRunningState();\r\n }\r\n }\r\n }\r\n catch (e) {\r\n this.canUseWebAudio = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Web Audio: \" + e.message);\r\n }\r\n };\r\n AudioEngine.prototype._triggerRunningState = function () {\r\n var _this = this;\r\n if (this._tryToRun) {\r\n return;\r\n }\r\n this._tryToRun = true;\r\n this._resumeAudioContext()\r\n .then(function () {\r\n _this._tryToRun = false;\r\n if (_this._muteButton) {\r\n _this._hideMuteButton();\r\n }\r\n }).catch(function () {\r\n _this._tryToRun = false;\r\n _this.unlocked = false;\r\n });\r\n // Notify users that the audio stack is unlocked/unmuted\r\n this.unlocked = true;\r\n this.onAudioUnlockedObservable.notifyObservers(this);\r\n };\r\n AudioEngine.prototype._triggerSuspendedState = function () {\r\n this.unlocked = false;\r\n this.onAudioLockedObservable.notifyObservers(this);\r\n this._displayMuteButton();\r\n };\r\n AudioEngine.prototype._displayMuteButton = function () {\r\n var _this = this;\r\n if (this.useCustomUnlockedButton || this._muteButton) {\r\n return;\r\n }\r\n this._muteButton = document.createElement(\"BUTTON\");\r\n this._muteButton.className = \"babylonUnmuteIcon\";\r\n this._muteButton.id = \"babylonUnmuteIconBtn\";\r\n this._muteButton.title = \"Unmute\";\r\n var css = \".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }\";\r\n var style = document.createElement('style');\r\n style.appendChild(document.createTextNode(css));\r\n document.getElementsByTagName('head')[0].appendChild(style);\r\n document.body.appendChild(this._muteButton);\r\n this._moveButtonToTopLeft();\r\n this._muteButton.addEventListener('touchend', function () {\r\n _this._triggerRunningState();\r\n }, true);\r\n this._muteButton.addEventListener('click', function () {\r\n _this._triggerRunningState();\r\n }, true);\r\n window.addEventListener(\"resize\", this._onResize);\r\n };\r\n AudioEngine.prototype._moveButtonToTopLeft = function () {\r\n if (this._hostElement && this._muteButton) {\r\n this._muteButton.style.top = this._hostElement.offsetTop + 20 + \"px\";\r\n this._muteButton.style.left = this._hostElement.offsetLeft + 20 + \"px\";\r\n }\r\n };\r\n AudioEngine.prototype._hideMuteButton = function () {\r\n if (this._muteButton) {\r\n document.body.removeChild(this._muteButton);\r\n this._muteButton = null;\r\n }\r\n };\r\n /**\r\n * Destroy and release the resources associated with the audio ccontext.\r\n */\r\n AudioEngine.prototype.dispose = function () {\r\n if (this.canUseWebAudio && this._audioContextInitialized) {\r\n if (this._connectedAnalyser && this._audioContext) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n this._connectedAnalyser.dispose();\r\n this.masterGain.disconnect();\r\n this.masterGain.connect(this._audioContext.destination);\r\n this._connectedAnalyser = null;\r\n }\r\n this.masterGain.gain.value = 1;\r\n }\r\n this.WarnedWebAudioUnsupported = false;\r\n this._hideMuteButton();\r\n window.removeEventListener(\"resize\", this._onResize);\r\n this.onAudioUnlockedObservable.clear();\r\n this.onAudioLockedObservable.clear();\r\n };\r\n /**\r\n * Gets the global volume sets on the master gain.\r\n * @returns the global volume if set or -1 otherwise\r\n */\r\n AudioEngine.prototype.getGlobalVolume = function () {\r\n if (this.canUseWebAudio && this._audioContextInitialized) {\r\n return this.masterGain.gain.value;\r\n }\r\n else {\r\n return -1;\r\n }\r\n };\r\n /**\r\n * Sets the global volume of your experience (sets on the master gain).\r\n * @param newVolume Defines the new global volume of the application\r\n */\r\n AudioEngine.prototype.setGlobalVolume = function (newVolume) {\r\n if (this.canUseWebAudio && this._audioContextInitialized) {\r\n this.masterGain.gain.value = newVolume;\r\n }\r\n };\r\n /**\r\n * Connect the audio engine to an audio analyser allowing some amazing\r\n * synchornization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n AudioEngine.prototype.connectToAnalyser = function (analyser) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n if (this.canUseWebAudio && this._audioContextInitialized && this._audioContext) {\r\n this._connectedAnalyser = analyser;\r\n this.masterGain.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this.masterGain, this._audioContext.destination);\r\n }\r\n };\r\n return AudioEngine;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/audioSceneComponent.ts\":\n/*!**************************************!*\\\n !*** ./Audio/audioSceneComponent.ts ***!\n \\**************************************/\n/*! exports provided: AudioSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return AudioSceneComponent; });\n/* harmony import */ var _sound__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sound */ \"./Audio/sound.ts\");\n/* harmony import */ var _soundTrack__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./soundTrack */ \"./Audio/soundTrack.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _audioEngine__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./audioEngine */ \"./Audio/audioEngine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_6__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO, function (parsedData, scene, container, rootUrl) {\r\n // TODO: add sound\r\n var loadedSounds = [];\r\n var loadedSound;\r\n container.sounds = container.sounds || [];\r\n if (parsedData.sounds !== undefined && parsedData.sounds !== null) {\r\n for (var index = 0, cache = parsedData.sounds.length; index < cache; index++) {\r\n var parsedSound = parsedData.sounds[index];\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (!parsedSound.url) {\r\n parsedSound.url = parsedSound.name;\r\n }\r\n if (!loadedSounds[parsedSound.url]) {\r\n loadedSound = _sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"].Parse(parsedSound, scene, rootUrl);\r\n loadedSounds[parsedSound.url] = loadedSound;\r\n container.sounds.push(loadedSound);\r\n }\r\n else {\r\n container.sounds.push(_sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"].Parse(parsedSound, scene, rootUrl, loadedSounds[parsedSound.url]));\r\n }\r\n }\r\n else {\r\n container.sounds.push(new _sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"](parsedSound.name, null, scene));\r\n }\r\n }\r\n }\r\n loadedSounds = [];\r\n});\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"mainSoundTrack\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (!this._mainSoundTrack) {\r\n this._mainSoundTrack = new _soundTrack__WEBPACK_IMPORTED_MODULE_1__[\"SoundTrack\"](this, { mainTrack: true });\r\n }\r\n return this._mainSoundTrack;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype.getSoundByName = function (name) {\r\n var index;\r\n for (index = 0; index < this.mainSoundTrack.soundCollection.length; index++) {\r\n if (this.mainSoundTrack.soundCollection[index].name === name) {\r\n return this.mainSoundTrack.soundCollection[index];\r\n }\r\n }\r\n if (this.soundTracks) {\r\n for (var sdIndex = 0; sdIndex < this.soundTracks.length; sdIndex++) {\r\n for (index = 0; index < this.soundTracks[sdIndex].soundCollection.length; index++) {\r\n if (this.soundTracks[sdIndex].soundCollection[index].name === name) {\r\n return this.soundTracks[sdIndex].soundCollection[index];\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n};\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"audioEnabled\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n return compo.audioEnabled;\r\n },\r\n set: function (value) {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (value) {\r\n compo.enableAudio();\r\n }\r\n else {\r\n compo.disableAudio();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"headphone\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n return compo.headphone;\r\n },\r\n set: function (value) {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (value) {\r\n compo.switchAudioModeForHeadphones();\r\n }\r\n else {\r\n compo.switchAudioModeForNormalSpeakers();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].prototype, \"audioListenerPositionProvider\", {\r\n get: function () {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n return compo.audioListenerPositionProvider;\r\n },\r\n set: function (value) {\r\n var compo = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(this);\r\n this._addComponent(compo);\r\n }\r\n if (typeof value !== 'function') {\r\n throw new Error('The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3');\r\n }\r\n else {\r\n compo.audioListenerPositionProvider = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Defines the sound scene component responsible to manage any sounds\r\n * in a given scene.\r\n */\r\nvar AudioSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function AudioSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO;\r\n this._audioEnabled = true;\r\n this._headphone = false;\r\n this._audioListenerPositionProvider = null;\r\n this.scene = scene;\r\n scene.soundTracks = new Array();\r\n scene.sounds = new Array();\r\n }\r\n Object.defineProperty(AudioSceneComponent.prototype, \"audioEnabled\", {\r\n /**\r\n * Gets whether audio is enabled or not.\r\n * Please use related enable/disable method to switch state.\r\n */\r\n get: function () {\r\n return this._audioEnabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AudioSceneComponent.prototype, \"headphone\", {\r\n /**\r\n * Gets whether audio is outputing to headphone or not.\r\n * Please use the according Switch methods to change output.\r\n */\r\n get: function () {\r\n return this._headphone;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AudioSceneComponent.prototype, \"audioListenerPositionProvider\", {\r\n /**\r\n * Gets the current audio listener position provider\r\n */\r\n get: function () {\r\n return this._audioListenerPositionProvider;\r\n },\r\n /**\r\n * Sets a custom listener position for all sounds in the scene\r\n * By default, this is the position of the first active camera\r\n */\r\n set: function (value) {\r\n this._audioListenerPositionProvider = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n AudioSceneComponent.prototype.register = function () {\r\n this.scene._afterRenderStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_AFTERRENDER_AUDIO, this, this._afterRender);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n AudioSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do here. (Not rendering related)\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n AudioSceneComponent.prototype.serialize = function (serializationObject) {\r\n serializationObject.sounds = [];\r\n if (this.scene.soundTracks) {\r\n for (var index = 0; index < this.scene.soundTracks.length; index++) {\r\n var soundtrack = this.scene.soundTracks[index];\r\n for (var soundId = 0; soundId < soundtrack.soundCollection.length; soundId++) {\r\n serializationObject.sounds.push(soundtrack.soundCollection[soundId].serialize());\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n AudioSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach(function (sound) {\r\n sound.play();\r\n sound.autoplay = true;\r\n _this.scene.mainSoundTrack.AddSound(sound);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n AudioSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (dispose === void 0) { dispose = false; }\r\n if (!container.sounds) {\r\n return;\r\n }\r\n container.sounds.forEach(function (sound) {\r\n sound.stop();\r\n sound.autoplay = false;\r\n _this.scene.mainSoundTrack.RemoveSound(sound);\r\n if (dispose) {\r\n sound.dispose();\r\n }\r\n });\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n AudioSceneComponent.prototype.dispose = function () {\r\n var scene = this.scene;\r\n if (scene._mainSoundTrack) {\r\n scene.mainSoundTrack.dispose();\r\n }\r\n if (scene.soundTracks) {\r\n for (var scIndex = 0; scIndex < scene.soundTracks.length; scIndex++) {\r\n scene.soundTracks[scIndex].dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Disables audio in the associated scene.\r\n */\r\n AudioSceneComponent.prototype.disableAudio = function () {\r\n var scene = this.scene;\r\n this._audioEnabled = false;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext.suspend();\r\n }\r\n var i;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n scene.mainSoundTrack.soundCollection[i].pause();\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (var j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n scene.soundTracks[i].soundCollection[j].pause();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Enables audio in the associated scene.\r\n */\r\n AudioSceneComponent.prototype.enableAudio = function () {\r\n var scene = this.scene;\r\n this._audioEnabled = true;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine.audioContext.resume();\r\n }\r\n var i;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n if (scene.mainSoundTrack.soundCollection[i].isPaused) {\r\n scene.mainSoundTrack.soundCollection[i].play();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (var j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n if (scene.soundTracks[i].soundCollection[j].isPaused) {\r\n scene.soundTracks[i].soundCollection[j].play();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Switch audio to headphone output.\r\n */\r\n AudioSceneComponent.prototype.switchAudioModeForHeadphones = function () {\r\n var scene = this.scene;\r\n this._headphone = true;\r\n scene.mainSoundTrack.switchPanningModelToHRTF();\r\n if (scene.soundTracks) {\r\n for (var i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n };\r\n /**\r\n * Switch audio to normal speakers.\r\n */\r\n AudioSceneComponent.prototype.switchAudioModeForNormalSpeakers = function () {\r\n var scene = this.scene;\r\n this._headphone = false;\r\n scene.mainSoundTrack.switchPanningModelToEqualPower();\r\n if (scene.soundTracks) {\r\n for (var i = 0; i < scene.soundTracks.length; i++) {\r\n scene.soundTracks[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n };\r\n AudioSceneComponent.prototype._afterRender = function () {\r\n var scene = this.scene;\r\n if (!this._audioEnabled || !scene._mainSoundTrack || !scene.soundTracks || (scene._mainSoundTrack.soundCollection.length === 0 && scene.soundTracks.length === 1)) {\r\n return;\r\n }\r\n var audioEngine = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].audioEngine;\r\n if (audioEngine.audioContext) {\r\n // A custom listener position provider was set\r\n // Use the users provided position instead of camera's\r\n if (this._audioListenerPositionProvider) {\r\n var position = this._audioListenerPositionProvider();\r\n // Make sure all coordinates were provided\r\n position.x = position.x || 0;\r\n position.y = position.y || 0;\r\n position.z = position.z || 0;\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(position.x, position.y, position.z);\r\n }\r\n else {\r\n var listeningCamera;\r\n if (scene.activeCameras.length > 0) {\r\n listeningCamera = scene.activeCameras[0];\r\n }\r\n else {\r\n listeningCamera = scene.activeCamera;\r\n }\r\n // Check if there is a listening camera\r\n if (listeningCamera) {\r\n // Set the listener position to the listening camera global position\r\n audioEngine.audioContext.listener.setPosition(listeningCamera.globalPosition.x, listeningCamera.globalPosition.y, listeningCamera.globalPosition.z);\r\n // for VR cameras\r\n if (listeningCamera.rigCameras && listeningCamera.rigCameras.length > 0) {\r\n listeningCamera = listeningCamera.rigCameras[0];\r\n }\r\n var mat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(listeningCamera.getViewMatrix());\r\n var cameraDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, -1), mat);\r\n cameraDirection.normalize();\r\n // To avoid some errors on GearVR\r\n if (!isNaN(cameraDirection.x) && !isNaN(cameraDirection.y) && !isNaN(cameraDirection.z)) {\r\n audioEngine.audioContext.listener.setOrientation(cameraDirection.x, cameraDirection.y, cameraDirection.z, 0, 1, 0);\r\n }\r\n }\r\n // Otherwise set the listener position to 0, 0 ,0\r\n else {\r\n // Set the listener position\r\n audioEngine.audioContext.listener.setPosition(0, 0, 0);\r\n }\r\n }\r\n var i;\r\n for (i = 0; i < scene.mainSoundTrack.soundCollection.length; i++) {\r\n var sound = scene.mainSoundTrack.soundCollection[i];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n if (scene.soundTracks) {\r\n for (i = 0; i < scene.soundTracks.length; i++) {\r\n for (var j = 0; j < scene.soundTracks[i].soundCollection.length; j++) {\r\n sound = scene.soundTracks[i].soundCollection[j];\r\n if (sound.useCustomAttenuation) {\r\n sound.updateDistanceFromListener();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n return AudioSceneComponent;\r\n}());\r\n\r\n_sound__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"]._SceneComponentInitialization = function (scene) {\r\n var compo = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_AUDIO);\r\n if (!compo) {\r\n compo = new AudioSceneComponent(scene);\r\n scene._addComponent(compo);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Audio/index.ts\":\n/*!************************!*\\\n !*** ./Audio/index.ts ***!\n \\************************/\n/*! exports provided: Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _analyser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./analyser */ \"./Audio/analyser.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return _analyser__WEBPACK_IMPORTED_MODULE_0__[\"Analyser\"]; });\n\n/* harmony import */ var _audioEngine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./audioEngine */ \"./Audio/audioEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return _audioEngine__WEBPACK_IMPORTED_MODULE_1__[\"AudioEngine\"]; });\n\n/* harmony import */ var _audioSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./audioSceneComponent */ \"./Audio/audioSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return _audioSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"AudioSceneComponent\"]; });\n\n/* harmony import */ var _sound__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sound */ \"./Audio/sound.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return _sound__WEBPACK_IMPORTED_MODULE_3__[\"Sound\"]; });\n\n/* harmony import */ var _soundTrack__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./soundTrack */ \"./Audio/soundTrack.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return _soundTrack__WEBPACK_IMPORTED_MODULE_4__[\"SoundTrack\"]; });\n\n/* harmony import */ var _weightedsound__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./weightedsound */ \"./Audio/weightedsound.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return _weightedsound__WEBPACK_IMPORTED_MODULE_5__[\"WeightedSound\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/sound.ts\":\n/*!************************!*\\\n !*** ./Audio/sound.ts ***!\n \\************************/\n/*! exports provided: Sound */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return Sound; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines a sound that can be played in the application.\r\n * The sound can either be an ambient track or a simple sound played in reaction to a user action.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar Sound = /** @class */ (function () {\r\n /**\r\n * Create a sound and attach it to a scene\r\n * @param name Name of your sound\r\n * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer, it also works with MediaStreams\r\n * @param scene defines the scene the sound belongs to\r\n * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played\r\n * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming\r\n */\r\n function Sound(name, urlOrArrayBuffer, scene, readyToPlayCallback, options) {\r\n var _this = this;\r\n if (readyToPlayCallback === void 0) { readyToPlayCallback = null; }\r\n /**\r\n * Does the sound autoplay once loaded.\r\n */\r\n this.autoplay = false;\r\n /**\r\n * Does the sound loop after it finishes playing once.\r\n */\r\n this.loop = false;\r\n /**\r\n * Does the sound use a custom attenuation curve to simulate the falloff\r\n * happening when the source gets further away from the camera.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n this.useCustomAttenuation = false;\r\n /**\r\n * Is this sound currently played.\r\n */\r\n this.isPlaying = false;\r\n /**\r\n * Is this sound currently paused.\r\n */\r\n this.isPaused = false;\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.spatialSound = false;\r\n /**\r\n * Define the reference distance the sound should be heard perfectly.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.refDistance = 1;\r\n /**\r\n * Define the roll off factor of spatial sounds.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.rolloffFactor = 1;\r\n /**\r\n * Define the max distance the sound should be heard (intensity just became 0 at this point).\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.maxDistance = 100;\r\n /**\r\n * Define the distance attenuation model the sound will follow.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.distanceModel = \"linear\";\r\n /**\r\n * Observable event when the current playing sound finishes.\r\n */\r\n this.onEndedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._panningModel = \"equalpower\";\r\n this._playbackRate = 1;\r\n this._streaming = false;\r\n this._startTime = 0;\r\n this._startOffset = 0;\r\n this._position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n this._positionInEmitterSpace = false;\r\n this._localDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1, 0, 0);\r\n this._volume = 1;\r\n this._isReadyToPlay = false;\r\n this._isDirectional = false;\r\n // Used if you'd like to create a directional sound.\r\n // If not set, the sound will be omnidirectional\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._coneOuterGain = 0;\r\n this._isOutputConnected = false;\r\n this._urlType = \"Unknown\";\r\n this.name = name;\r\n this._scene = scene;\r\n Sound._SceneComponentInitialization(scene);\r\n this._readyToPlayCallback = readyToPlayCallback;\r\n // Default custom attenuation function is a linear attenuation\r\n this._customAttenuationFunction = function (currentVolume, currentDistance, maxDistance, refDistance, rolloffFactor) {\r\n if (currentDistance < maxDistance) {\r\n return currentVolume * (1 - currentDistance / maxDistance);\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n if (options) {\r\n this.autoplay = options.autoplay || false;\r\n this.loop = options.loop || false;\r\n // if volume === 0, we need another way to check this option\r\n if (options.volume !== undefined) {\r\n this._volume = options.volume;\r\n }\r\n this.spatialSound = options.spatialSound || false;\r\n this.maxDistance = options.maxDistance || 100;\r\n this.useCustomAttenuation = options.useCustomAttenuation || false;\r\n this.rolloffFactor = options.rolloffFactor || 1;\r\n this.refDistance = options.refDistance || 1;\r\n this.distanceModel = options.distanceModel || \"linear\";\r\n this._playbackRate = options.playbackRate || 1;\r\n this._streaming = options.streaming || false;\r\n this._length = options.length;\r\n this._offset = options.offset;\r\n }\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n this._soundGain = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createGain();\r\n this._soundGain.gain.value = this._volume;\r\n this._inputAudioNode = this._soundGain;\r\n this._outputAudioNode = this._soundGain;\r\n if (this.spatialSound) {\r\n this._createSpatialParameters();\r\n }\r\n this._scene.mainSoundTrack.AddSound(this);\r\n var validParameter = true;\r\n // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound\r\n if (urlOrArrayBuffer) {\r\n try {\r\n if (typeof (urlOrArrayBuffer) === \"string\") {\r\n this._urlType = \"String\";\r\n }\r\n else if (urlOrArrayBuffer instanceof ArrayBuffer) {\r\n this._urlType = \"ArrayBuffer\";\r\n }\r\n else if (urlOrArrayBuffer instanceof MediaStream) {\r\n this._urlType = \"MediaStream\";\r\n }\r\n else if (Array.isArray(urlOrArrayBuffer)) {\r\n this._urlType = \"Array\";\r\n }\r\n var urls = [];\r\n var codecSupportedFound = false;\r\n switch (this._urlType) {\r\n case \"MediaStream\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createMediaStreamSource(urlOrArrayBuffer);\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"ArrayBuffer\":\r\n if (urlOrArrayBuffer.byteLength > 0) {\r\n codecSupportedFound = true;\r\n this._soundLoaded(urlOrArrayBuffer);\r\n }\r\n break;\r\n case \"String\":\r\n urls.push(urlOrArrayBuffer);\r\n case \"Array\":\r\n if (urls.length === 0) {\r\n urls = urlOrArrayBuffer;\r\n }\r\n // If we found a supported format, we load it immediately and stop the loop\r\n for (var i = 0; i < urls.length; i++) {\r\n var url = urls[i];\r\n codecSupportedFound = (options && options.skipCodecCheck) ||\r\n (url.indexOf(\".mp3\", url.length - 4) !== -1 && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.isMP3supported) ||\r\n (url.indexOf(\".ogg\", url.length - 4) !== -1 && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.isOGGsupported) ||\r\n (url.indexOf(\".wav\", url.length - 4) !== -1) ||\r\n (url.indexOf(\"blob:\") !== -1);\r\n if (codecSupportedFound) {\r\n // Loading sound using XHR2\r\n if (!this._streaming) {\r\n this._scene._loadFile(url, function (data) {\r\n _this._soundLoaded(data);\r\n }, undefined, true, true, function (exception) {\r\n if (exception) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"XHR \" + exception.status + \" error on: \" + url + \".\");\r\n }\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Sound creation aborted.\");\r\n _this._scene.mainSoundTrack.RemoveSound(_this);\r\n });\r\n }\r\n // Streaming sound using HTML5 Audio tag\r\n else {\r\n this._htmlAudioElement = new Audio(url);\r\n this._htmlAudioElement.controls = false;\r\n this._htmlAudioElement.loop = this.loop;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].SetCorsBehavior(url, this._htmlAudioElement);\r\n this._htmlAudioElement.preload = \"auto\";\r\n this._htmlAudioElement.addEventListener(\"canplaythrough\", function () {\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n });\r\n document.body.appendChild(this._htmlAudioElement);\r\n this._htmlAudioElement.load();\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n default:\r\n validParameter = false;\r\n break;\r\n }\r\n if (!validParameter) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.\");\r\n }\r\n else {\r\n if (!codecSupportedFound) {\r\n this._isReadyToPlay = true;\r\n // Simulating a ready to play event to avoid breaking code path\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Unexpected error. Sound creation aborted.\");\r\n this._scene.mainSoundTrack.RemoveSound(this);\r\n }\r\n }\r\n }\r\n else {\r\n // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers\r\n this._scene.mainSoundTrack.AddSound(this);\r\n if (!_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.WarnedWebAudioUnsupported) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Web Audio is not supported by your browser.\");\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.WarnedWebAudioUnsupported = true;\r\n }\r\n // Simulating a ready to play event to avoid breaking code for non web audio browsers\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n /**\r\n * Release the sound and its associated resources\r\n */\r\n Sound.prototype.dispose = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (this.isPlaying) {\r\n this.stop();\r\n }\r\n this._isReadyToPlay = false;\r\n if (this.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.RemoveSound(this);\r\n }\r\n else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[this.soundTrackId].RemoveSound(this);\r\n }\r\n if (this._soundGain) {\r\n this._soundGain.disconnect();\r\n this._soundGain = null;\r\n }\r\n if (this._soundPanner) {\r\n this._soundPanner.disconnect();\r\n this._soundPanner = null;\r\n }\r\n if (this._soundSource) {\r\n this._soundSource.disconnect();\r\n this._soundSource = null;\r\n }\r\n this._audioBuffer = null;\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n this._htmlAudioElement.src = \"\";\r\n document.body.removeChild(this._htmlAudioElement);\r\n }\r\n if (this._streamingSource) {\r\n this._streamingSource.disconnect();\r\n }\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets if the sounds is ready to be played or not.\r\n * @returns true if ready, otherwise false\r\n */\r\n Sound.prototype.isReady = function () {\r\n return this._isReadyToPlay;\r\n };\r\n Sound.prototype._soundLoaded = function (audioData) {\r\n var _this = this;\r\n if (!_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n return;\r\n }\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.decodeAudioData(audioData, function (buffer) {\r\n _this._audioBuffer = buffer;\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, function (err) { _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Error while decoding audio data for: \" + _this.name + \" / Error: \" + err); });\r\n };\r\n /**\r\n * Sets the data of the sound from an audiobuffer\r\n * @param audioBuffer The audioBuffer containing the data\r\n */\r\n Sound.prototype.setAudioBuffer = function (audioBuffer) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n this._audioBuffer = audioBuffer;\r\n this._isReadyToPlay = true;\r\n }\r\n };\r\n /**\r\n * Updates the current sounds options such as maxdistance, loop...\r\n * @param options A JSON object containing values named as the object properties\r\n */\r\n Sound.prototype.updateOptions = function (options) {\r\n if (options) {\r\n this.loop = options.loop || this.loop;\r\n this.maxDistance = options.maxDistance || this.maxDistance;\r\n this.useCustomAttenuation = options.useCustomAttenuation || this.useCustomAttenuation;\r\n this.rolloffFactor = options.rolloffFactor || this.rolloffFactor;\r\n this.refDistance = options.refDistance || this.refDistance;\r\n this.distanceModel = options.distanceModel || this.distanceModel;\r\n this._playbackRate = options.playbackRate || this._playbackRate;\r\n this._length = options.length ? options.length / 1000 : undefined;\r\n this._offset = options.offset ? options.offset / 1000 : undefined;\r\n this._updateSpatialParameters();\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n else {\r\n if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n Sound.prototype._createSpatialParameters = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n if (this._scene.headphone) {\r\n this._panningModel = \"HRTF\";\r\n }\r\n this._soundPanner = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createPanner();\r\n this._updateSpatialParameters();\r\n this._soundPanner.connect(this._outputAudioNode);\r\n this._inputAudioNode = this._soundPanner;\r\n }\r\n };\r\n Sound.prototype._updateSpatialParameters = function () {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (this.useCustomAttenuation) {\r\n // Tricks to disable in a way embedded Web Audio attenuation\r\n this._soundPanner.distanceModel = \"linear\";\r\n this._soundPanner.maxDistance = Number.MAX_VALUE;\r\n this._soundPanner.refDistance = 1;\r\n this._soundPanner.rolloffFactor = 1;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n else {\r\n this._soundPanner.distanceModel = this.distanceModel;\r\n this._soundPanner.maxDistance = this.maxDistance;\r\n this._soundPanner.refDistance = this.refDistance;\r\n this._soundPanner.rolloffFactor = this.rolloffFactor;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n }\r\n };\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToHRTF = function () {\r\n this._panningModel = \"HRTF\";\r\n this._switchPanningModel();\r\n };\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToEqualPower = function () {\r\n this._panningModel = \"equalpower\";\r\n this._switchPanningModel();\r\n };\r\n Sound.prototype._switchPanningModel = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n };\r\n /**\r\n * Connect this sound to a sound track audio node like gain...\r\n * @param soundTrackAudioNode the sound track audio node to connect to\r\n */\r\n Sound.prototype.connectToSoundTrackAudioNode = function (soundTrackAudioNode) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (this._isOutputConnected) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode.connect(soundTrackAudioNode);\r\n this._isOutputConnected = true;\r\n }\r\n };\r\n /**\r\n * Transform this sound into a directional source\r\n * @param coneInnerAngle Size of the inner cone in degree\r\n * @param coneOuterAngle Size of the outer cone in degree\r\n * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)\r\n */\r\n Sound.prototype.setDirectionalCone = function (coneInnerAngle, coneOuterAngle, coneOuterGain) {\r\n if (coneOuterAngle < coneInnerAngle) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = coneInnerAngle;\r\n this._coneOuterAngle = coneOuterAngle;\r\n this._coneOuterGain = coneOuterGain;\r\n this._isDirectional = true;\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n };\r\n Object.defineProperty(Sound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Sound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the position of the emitter if spatial sound is enabled\r\n * @param newPosition Defines the new posisiton\r\n */\r\n Sound.prototype.setPosition = function (newPosition) {\r\n this._position = newPosition;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n };\r\n /**\r\n * Sets the local direction of the emitter if spatial sound is enabled\r\n * @param newLocalDirection Defines the new local direction\r\n */\r\n Sound.prototype.setLocalDirectionToMesh = function (newLocalDirection) {\r\n this._localDirection = newLocalDirection;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._connectedTransformNode && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n Sound.prototype._updateDirection = function () {\r\n if (!this._connectedTransformNode || !this._soundPanner) {\r\n return;\r\n }\r\n var mat = this._connectedTransformNode.getWorldMatrix();\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormal(this._localDirection, mat);\r\n direction.normalize();\r\n this._soundPanner.setOrientation(direction.x, direction.y, direction.z);\r\n };\r\n /** @hidden */\r\n Sound.prototype.updateDistanceFromListener = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {\r\n var distance = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);\r\n this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);\r\n }\r\n };\r\n /**\r\n * Sets a new custom attenuation function for the sound.\r\n * @param callback Defines the function used for the attenuation\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n Sound.prototype.setAttenuationFunction = function (callback) {\r\n this._customAttenuationFunction = callback;\r\n };\r\n /**\r\n * Play the sound\r\n * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.\r\n * @param offset (optional) Start the sound at a specific time in seconds\r\n * @param length (optional) Sound duration (in seconds)\r\n */\r\n Sound.prototype.play = function (time, offset, length) {\r\n var _this = this;\r\n if (this._isReadyToPlay && this._scene.audioEnabled && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n try {\r\n if (this._startOffset < 0) {\r\n time = -this._startOffset;\r\n this._startOffset = 0;\r\n }\r\n var startTime = time ? _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time : _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime;\r\n if (!this._soundSource || !this._streamingSource) {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (!isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n if (this._isDirectional) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n this._soundPanner.coneOuterGain = this._coneOuterGain;\r\n if (this._connectedTransformNode) {\r\n this._updateDirection();\r\n }\r\n else {\r\n this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);\r\n }\r\n }\r\n }\r\n }\r\n if (this._streaming) {\r\n if (!this._streamingSource) {\r\n this._streamingSource = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);\r\n this._htmlAudioElement.onended = function () { _this._onended(); };\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n this._streamingSource.disconnect();\r\n this._streamingSource.connect(this._inputAudioNode);\r\n if (this._htmlAudioElement) {\r\n // required to manage properly the new suspended default state of Chrome\r\n // When the option 'streaming: true' is used, we need first to wait for\r\n // the audio engine to be unlocked by a user gesture before trying to play\r\n // an HTML Audio elememt\r\n var tryToPlay = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.unlocked) {\r\n var playPromise = _this._htmlAudioElement.play();\r\n // In browsers that don’t yet support this functionality,\r\n // playPromise won’t be defined.\r\n if (playPromise !== undefined) {\r\n playPromise.catch(function (error) {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.onAudioUnlockedObservable.addOnce(function () { tryToPlay(); });\r\n }\r\n });\r\n }\r\n }\r\n else {\r\n if (_this.loop || _this.autoplay) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.onAudioUnlockedObservable.addOnce(function () { tryToPlay(); });\r\n }\r\n }\r\n };\r\n tryToPlay();\r\n }\r\n }\r\n else {\r\n var tryToPlay = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n length = length || _this._length;\r\n offset = offset || _this._offset;\r\n _this._soundSource = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.createBufferSource();\r\n _this._soundSource.buffer = _this._audioBuffer;\r\n _this._soundSource.connect(_this._inputAudioNode);\r\n _this._soundSource.loop = _this.loop;\r\n if (offset !== undefined) {\r\n _this._soundSource.loopStart = offset;\r\n }\r\n if (length !== undefined) {\r\n _this._soundSource.loopEnd = (offset | 0) + length;\r\n }\r\n _this._soundSource.playbackRate.value = _this._playbackRate;\r\n _this._soundSource.onended = function () { _this._onended(); };\r\n startTime = time ? _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time : _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime;\r\n var actualOffset = _this.isPaused ? _this._startOffset % _this._soundSource.buffer.duration : offset ? offset : 0;\r\n _this._soundSource.start(startTime, actualOffset, _this.loop ? undefined : length);\r\n }\r\n };\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.state === \"suspended\") {\r\n // Wait a bit for FF as context seems late to be ready.\r\n setTimeout(function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.state === \"suspended\") {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.onAudioUnlockedObservable.addOnce(function () { tryToPlay(); });\r\n }\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }, 500);\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }\r\n this._startTime = startTime;\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Error while trying to play audio: \" + this.name + \", \" + ex.message);\r\n }\r\n }\r\n };\r\n Sound.prototype._onended = function () {\r\n this.isPlaying = false;\r\n if (this.onended) {\r\n this.onended();\r\n }\r\n this.onEndedObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop the sound\r\n * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.\r\n */\r\n Sound.prototype.stop = function (time) {\r\n var _this = this;\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n // Test needed for Firefox or it will generate an Invalid State Error\r\n if (this._htmlAudioElement.currentTime > 0) {\r\n this._htmlAudioElement.currentTime = 0;\r\n }\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n }\r\n else if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext && this._soundSource) {\r\n var stopTime = time ? _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time : _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime;\r\n this._soundSource.stop(stopTime);\r\n this._soundSource.onended = function () { _this.isPlaying = false; };\r\n if (!this.isPaused) {\r\n this._startOffset = 0;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Put the sound in pause\r\n */\r\n Sound.prototype.pause = function () {\r\n if (this.isPlaying) {\r\n this.isPaused = true;\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n }\r\n else if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n this.stop(0);\r\n this._startOffset += _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a dedicated volume for this sounds\r\n * @param newVolume Define the new volume of the sound\r\n * @param time Define time for gradual change to new volume\r\n */\r\n Sound.prototype.setVolume = function (newVolume, time) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._soundGain) {\r\n if (time && _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext) {\r\n this._soundGain.gain.cancelScheduledValues(_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.linearRampToValueAtTime(newVolume, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.audioContext.currentTime + time);\r\n }\r\n else {\r\n this._soundGain.gain.value = newVolume;\r\n }\r\n }\r\n this._volume = newVolume;\r\n };\r\n /**\r\n * Set the sound play back rate\r\n * @param newPlaybackRate Define the playback rate the sound should be played at\r\n */\r\n Sound.prototype.setPlaybackRate = function (newPlaybackRate) {\r\n this._playbackRate = newPlaybackRate;\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n else if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the volume of the sound.\r\n * @returns the volume of the sound\r\n */\r\n Sound.prototype.getVolume = function () {\r\n return this._volume;\r\n };\r\n /**\r\n * Attach the sound to a dedicated mesh\r\n * @param transformNode The transform node to connect the sound with\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.attachToMesh = function (transformNode) {\r\n var _this = this;\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n this._connectedTransformNode = transformNode;\r\n if (!this.spatialSound) {\r\n this.spatialSound = true;\r\n this._createSpatialParameters();\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode);\r\n this._registerFunc = function (transformNode) { return _this._onRegisterAfterWorldMatrixUpdate(transformNode); };\r\n this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);\r\n };\r\n /**\r\n * Detach the sound from the previously attached mesh\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.detachFromMesh = function () {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n this._connectedTransformNode = null;\r\n }\r\n };\r\n Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (node) {\r\n if (!node.getBoundingInfo) {\r\n return;\r\n }\r\n var mesh = node;\r\n if (this._positionInEmitterSpace) {\r\n mesh.worldMatrixFromCache.invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[0]);\r\n this.setPosition(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[0].getTranslation());\r\n }\r\n else {\r\n var boundingInfo = mesh.getBoundingInfo();\r\n this.setPosition(boundingInfo.boundingSphere.centerWorld);\r\n }\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n /**\r\n * Clone the current sound in the scene.\r\n * @returns the new sound clone\r\n */\r\n Sound.prototype.clone = function () {\r\n var _this = this;\r\n if (!this._streaming) {\r\n var setBufferAndRun = function () {\r\n if (_this._isReadyToPlay) {\r\n clonedSound._audioBuffer = _this.getAudioBuffer();\r\n clonedSound._isReadyToPlay = true;\r\n if (clonedSound.autoplay) {\r\n clonedSound.play(0, _this._offset, _this._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n var currentOptions = {\r\n autoplay: this.autoplay, loop: this.loop,\r\n volume: this._volume, spatialSound: this.spatialSound, maxDistance: this.maxDistance,\r\n useCustomAttenuation: this.useCustomAttenuation, rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance, distanceModel: this.distanceModel\r\n };\r\n var clonedSound = new Sound(this.name + \"_cloned\", new ArrayBuffer(0), this._scene, null, currentOptions);\r\n if (this.useCustomAttenuation) {\r\n clonedSound.setAttenuationFunction(this._customAttenuationFunction);\r\n }\r\n clonedSound.setPosition(this._position);\r\n clonedSound.setPlaybackRate(this._playbackRate);\r\n setBufferAndRun();\r\n return clonedSound;\r\n }\r\n // Can't clone a streaming sound\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Gets the current underlying audio buffer containing the data\r\n * @returns the audio buffer\r\n */\r\n Sound.prototype.getAudioBuffer = function () {\r\n return this._audioBuffer;\r\n };\r\n /**\r\n * Serializes the Sound in a JSON representation\r\n * @returns the JSON representation of the sound\r\n */\r\n Sound.prototype.serialize = function () {\r\n var serializationObject = {\r\n name: this.name,\r\n url: this.name,\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this.spatialSound,\r\n maxDistance: this.maxDistance,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n playbackRate: this._playbackRate,\r\n panningModel: this._panningModel,\r\n soundTrackId: this.soundTrackId\r\n };\r\n if (this.spatialSound) {\r\n if (this._connectedTransformNode) {\r\n serializationObject.connectedMeshId = this._connectedTransformNode.id;\r\n }\r\n serializationObject.position = this._position.asArray();\r\n serializationObject.refDistance = this.refDistance;\r\n serializationObject.distanceModel = this.distanceModel;\r\n serializationObject.isDirectional = this._isDirectional;\r\n serializationObject.localDirectionToMesh = this._localDirection.asArray();\r\n serializationObject.coneInnerAngle = this._coneInnerAngle;\r\n serializationObject.coneOuterAngle = this._coneOuterAngle;\r\n serializationObject.coneOuterGain = this._coneOuterGain;\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse a JSON representation of a sound to innstantiate in a given scene\r\n * @param parsedSound Define the JSON representation of the sound (usually coming from the serialize method)\r\n * @param scene Define the scene the new parsed sound should be created in\r\n * @param rootUrl Define the rooturl of the load in case we need to fetch relative dependencies\r\n * @param sourceSound Define a cound place holder if do not need to instantiate a new one\r\n * @returns the newly parsed sound\r\n */\r\n Sound.Parse = function (parsedSound, scene, rootUrl, sourceSound) {\r\n var soundName = parsedSound.name;\r\n var soundUrl;\r\n if (parsedSound.url) {\r\n soundUrl = rootUrl + parsedSound.url;\r\n }\r\n else {\r\n soundUrl = rootUrl + soundName;\r\n }\r\n var options = {\r\n autoplay: parsedSound.autoplay, loop: parsedSound.loop, volume: parsedSound.volume,\r\n spatialSound: parsedSound.spatialSound, maxDistance: parsedSound.maxDistance,\r\n rolloffFactor: parsedSound.rolloffFactor,\r\n refDistance: parsedSound.refDistance,\r\n distanceModel: parsedSound.distanceModel,\r\n playbackRate: parsedSound.playbackRate\r\n };\r\n var newSound;\r\n if (!sourceSound) {\r\n newSound = new Sound(soundName, soundUrl, scene, function () { scene._removePendingData(newSound); }, options);\r\n scene._addPendingData(newSound);\r\n }\r\n else {\r\n var setBufferAndRun = function () {\r\n if (sourceSound._isReadyToPlay) {\r\n newSound._audioBuffer = sourceSound.getAudioBuffer();\r\n newSound._isReadyToPlay = true;\r\n if (newSound.autoplay) {\r\n newSound.play(0, newSound._offset, newSound._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);\r\n setBufferAndRun();\r\n }\r\n if (parsedSound.position) {\r\n var soundPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedSound.position);\r\n newSound.setPosition(soundPosition);\r\n }\r\n if (parsedSound.isDirectional) {\r\n newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);\r\n if (parsedSound.localDirectionToMesh) {\r\n var localDirectionToMesh = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedSound.localDirectionToMesh);\r\n newSound.setLocalDirectionToMesh(localDirectionToMesh);\r\n }\r\n }\r\n if (parsedSound.connectedMeshId) {\r\n var connectedMesh = scene.getMeshByID(parsedSound.connectedMeshId);\r\n if (connectedMesh) {\r\n newSound.attachToMesh(connectedMesh);\r\n }\r\n }\r\n return newSound;\r\n };\r\n /** @hidden */\r\n Sound._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"AudioSceneComponent\");\r\n };\r\n return Sound;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/soundTrack.ts\":\n/*!*****************************!*\\\n !*** ./Audio/soundTrack.ts ***!\n \\*****************************/\n/*! exports provided: SoundTrack */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return SoundTrack; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/**\r\n * It could be useful to isolate your music & sounds on several tracks to better manage volume on a grouped instance of sounds.\r\n * It will be also used in a future release to apply effects on a specific track.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-sound-tracks\r\n */\r\nvar SoundTrack = /** @class */ (function () {\r\n /**\r\n * Creates a new sound track.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-sound-tracks\r\n * @param scene Define the scene the sound track belongs to\r\n * @param options\r\n */\r\n function SoundTrack(scene, options) {\r\n if (options === void 0) { options = {}; }\r\n /**\r\n * The unique identifier of the sound track in the scene.\r\n */\r\n this.id = -1;\r\n this._isMainTrack = false;\r\n this._isInitialized = false;\r\n this._scene = scene;\r\n this.soundCollection = new Array();\r\n this._options = options;\r\n if (!this._isMainTrack && this._scene.soundTracks) {\r\n this._scene.soundTracks.push(this);\r\n this.id = this._scene.soundTracks.length - 1;\r\n }\r\n }\r\n SoundTrack.prototype._initializeSoundTrackAudioGraph = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.audioContext) {\r\n this._outputAudioNode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.audioContext.createGain();\r\n this._outputAudioNode.connect(_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.masterGain);\r\n if (this._options) {\r\n if (this._options.volume) {\r\n this._outputAudioNode.gain.value = this._options.volume;\r\n }\r\n if (this._options.mainTrack) {\r\n this._isMainTrack = this._options.mainTrack;\r\n }\r\n }\r\n this._isInitialized = true;\r\n }\r\n };\r\n /**\r\n * Release the sound track and its associated resources\r\n */\r\n SoundTrack.prototype.dispose = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n while (this.soundCollection.length) {\r\n this.soundCollection[0].dispose();\r\n }\r\n if (this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode = null;\r\n }\r\n };\r\n /**\r\n * Adds a sound to this sound track\r\n * @param sound define the cound to add\r\n * @ignoreNaming\r\n */\r\n SoundTrack.prototype.AddSound = function (sound) {\r\n if (!this._isInitialized) {\r\n this._initializeSoundTrackAudioGraph();\r\n }\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n sound.connectToSoundTrackAudioNode(this._outputAudioNode);\r\n }\r\n if (sound.soundTrackId) {\r\n if (sound.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.RemoveSound(sound);\r\n }\r\n else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[sound.soundTrackId].RemoveSound(sound);\r\n }\r\n }\r\n this.soundCollection.push(sound);\r\n sound.soundTrackId = this.id;\r\n };\r\n /**\r\n * Removes a sound to this sound track\r\n * @param sound define the cound to remove\r\n * @ignoreNaming\r\n */\r\n SoundTrack.prototype.RemoveSound = function (sound) {\r\n var index = this.soundCollection.indexOf(sound);\r\n if (index !== -1) {\r\n this.soundCollection.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Set a global volume for the full sound track.\r\n * @param newVolume Define the new volume of the sound track\r\n */\r\n SoundTrack.prototype.setVolume = function (newVolume) {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.gain.value = newVolume;\r\n }\r\n };\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n SoundTrack.prototype.switchPanningModelToHRTF = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n for (var i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToHRTF();\r\n }\r\n }\r\n };\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n SoundTrack.prototype.switchPanningModelToEqualPower = function () {\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio) {\r\n for (var i = 0; i < this.soundCollection.length; i++) {\r\n this.soundCollection[i].switchPanningModelToEqualPower();\r\n }\r\n }\r\n };\r\n /**\r\n * Connect the sound track to an audio analyser allowing some amazing\r\n * synchornization between the sounds/music and your visualization (VuMeter for instance).\r\n * @see http://doc.babylonjs.com/how_to/playing_sounds_and_music#using-the-analyser\r\n * @param analyser The analyser to connect to the engine\r\n */\r\n SoundTrack.prototype.connectToAnalyser = function (analyser) {\r\n if (this._connectedAnalyser) {\r\n this._connectedAnalyser.stopDebugCanvas();\r\n }\r\n this._connectedAnalyser = analyser;\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n this._outputAudioNode.disconnect();\r\n this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].audioEngine.masterGain);\r\n }\r\n };\r\n return SoundTrack;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Audio/weightedsound.ts\":\n/*!********************************!*\\\n !*** ./Audio/weightedsound.ts ***!\n \\********************************/\n/*! exports provided: WeightedSound */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return WeightedSound; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * Wraps one or more Sound objects and selects one with random weight for playback.\r\n */\r\nvar WeightedSound = /** @class */ (function () {\r\n /**\r\n * Creates a new WeightedSound from the list of sounds given.\r\n * @param loop When true a Sound will be selected and played when the current playing Sound completes.\r\n * @param sounds Array of Sounds that will be selected from.\r\n * @param weights Array of number values for selection weights; length must equal sounds, values will be normalized to 1\r\n */\r\n function WeightedSound(loop, sounds, weights) {\r\n var _this = this;\r\n /** When true a Sound will be selected and played when the current playing Sound completes. */\r\n this.loop = false;\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._volume = 1;\r\n /** A Sound is currently playing. */\r\n this.isPlaying = false;\r\n /** A Sound is currently paused. */\r\n this.isPaused = false;\r\n this._sounds = [];\r\n this._weights = [];\r\n if (sounds.length !== weights.length) {\r\n throw new Error('Sounds length does not equal weights length');\r\n }\r\n this.loop = loop;\r\n this._weights = weights;\r\n // Normalize the weights\r\n var weightSum = 0;\r\n for (var _i = 0, weights_1 = weights; _i < weights_1.length; _i++) {\r\n var weight = weights_1[_i];\r\n weightSum += weight;\r\n }\r\n var invWeightSum = weightSum > 0 ? 1 / weightSum : 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n this._weights[i] *= invWeightSum;\r\n }\r\n this._sounds = sounds;\r\n for (var _a = 0, _b = this._sounds; _a < _b.length; _a++) {\r\n var sound = _b[_a];\r\n sound.onEndedObservable.add(function () { _this._onended(); });\r\n }\r\n }\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * The size of cone in degrees for a directional sound in which there will be no attenuation.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * The size of cone in degress for a directional sound in which there will be no attenuation.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeInnerAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeOuterAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"volume\", {\r\n /**\r\n * Playback volume.\r\n */\r\n get: function () {\r\n return this._volume;\r\n },\r\n /**\r\n * Playback volume.\r\n */\r\n set: function (value) {\r\n if (value !== this._volume) {\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.setVolume(value);\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WeightedSound.prototype._onended = function () {\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].autoplay = false;\r\n }\r\n if (this.loop && this.isPlaying) {\r\n this.play();\r\n }\r\n else {\r\n this.isPlaying = false;\r\n }\r\n };\r\n /**\r\n * Suspend playback\r\n */\r\n WeightedSound.prototype.pause = function () {\r\n this.isPaused = true;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].pause();\r\n }\r\n };\r\n /**\r\n * Stop playback\r\n */\r\n WeightedSound.prototype.stop = function () {\r\n this.isPlaying = false;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].stop();\r\n }\r\n };\r\n /**\r\n * Start playback.\r\n * @param startOffset Position the clip head at a specific time in seconds.\r\n */\r\n WeightedSound.prototype.play = function (startOffset) {\r\n if (!this.isPaused) {\r\n this.stop();\r\n var randomValue = Math.random();\r\n var total = 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n total += this._weights[i];\r\n if (randomValue <= total) {\r\n this._currentIndex = i;\r\n break;\r\n }\r\n }\r\n }\r\n var sound = this._sounds[this._currentIndex];\r\n if (sound.isReady()) {\r\n sound.play(0, this.isPaused ? undefined : startOffset);\r\n }\r\n else {\r\n sound.autoplay = true;\r\n }\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n };\r\n return WeightedSound;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/autoRotationBehavior.ts\":\n/*!***************************************************!*\\\n !*** ./Behaviors/Cameras/autoRotationBehavior.ts ***!\n \\***************************************************/\n/*! exports provided: AutoRotationBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return AutoRotationBehavior; });\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n\r\n\r\n/**\r\n * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\nvar AutoRotationBehavior = /** @class */ (function () {\r\n function AutoRotationBehavior() {\r\n this._zoomStopsAnimation = false;\r\n this._idleRotationSpeed = 0.05;\r\n this._idleRotationWaitTime = 2000;\r\n this._idleRotationSpinupTime = 2000;\r\n this._isPointerDown = false;\r\n this._lastFrameTime = null;\r\n this._lastInteractionTime = -Infinity;\r\n this._cameraRotationSpeed = 0;\r\n this._lastFrameRadius = 0;\r\n }\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"AutoRotation\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpeed\", {\r\n /**\r\n * Gets the default speed at which the camera rotates around the model.\r\n */\r\n get: function () {\r\n return this._idleRotationSpeed;\r\n },\r\n /**\r\n * Sets the default speed at which the camera rotates around the model.\r\n */\r\n set: function (speed) {\r\n this._idleRotationSpeed = speed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationWaitTime\", {\r\n /**\r\n * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n get: function () {\r\n return this._idleRotationWaitTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n set: function (time) {\r\n this._idleRotationWaitTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpinupTime\", {\r\n /**\r\n * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n get: function () {\r\n return this._idleRotationSpinupTime;\r\n },\r\n /**\r\n * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n set: function (time) {\r\n this._idleRotationSpinupTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"rotationInProgress\", {\r\n /**\r\n * Gets a value indicating if the camera is currently rotating because of this behavior\r\n */\r\n get: function () {\r\n return Math.abs(this._cameraRotationSpeed) > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n AutoRotationBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n AutoRotationBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n var now = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_1__[\"PrecisionDate\"].Now;\r\n var dt = 0;\r\n if (_this._lastFrameTime != null) {\r\n dt = now - _this._lastFrameTime;\r\n }\r\n _this._lastFrameTime = now;\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n var timeToRotation = now - _this._lastInteractionTime - _this._idleRotationWaitTime;\r\n var scale = Math.max(Math.min(timeToRotation / (_this._idleRotationSpinupTime), 1), 0);\r\n _this._cameraRotationSpeed = _this._idleRotationSpeed * scale;\r\n // Step camera rotation by rotation speed\r\n if (_this._attachedCamera) {\r\n _this._attachedCamera.alpha -= _this._cameraRotationSpeed * (dt / 1000);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n AutoRotationBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Returns true if user is scrolling.\r\n * @return true if user is scrolling.\r\n */\r\n AutoRotationBehavior.prototype._userIsZooming = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialRadiusOffset !== 0;\r\n };\r\n AutoRotationBehavior.prototype._shouldAnimationStopForInteraction = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n var zoomHasHitLimit = false;\r\n if (this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0) {\r\n zoomHasHitLimit = true;\r\n }\r\n // Update the record of previous radius - works as an approx. indicator of hitting radius limits\r\n this._lastFrameRadius = this._attachedCamera.radius;\r\n return this._zoomStopsAnimation ? zoomHasHitLimit : this._userIsZooming();\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n AutoRotationBehavior.prototype._applyUserInteraction = function () {\r\n if (this._userIsMoving() && !this._shouldAnimationStopForInteraction()) {\r\n this._lastInteractionTime = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_1__[\"PrecisionDate\"].Now;\r\n }\r\n };\r\n // Tools\r\n AutoRotationBehavior.prototype._userIsMoving = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n };\r\n return AutoRotationBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/bouncingBehavior.ts\":\n/*!***********************************************!*\\\n !*** ./Behaviors/Cameras/bouncingBehavior.ts ***!\n \\***********************************************/\n/*! exports provided: BouncingBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return BouncingBehavior; });\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n\r\n\r\n/**\r\n * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\nvar BouncingBehavior = /** @class */ (function () {\r\n function BouncingBehavior() {\r\n /**\r\n * The duration of the animation, in milliseconds\r\n */\r\n this.transitionDuration = 450;\r\n /**\r\n * Length of the distance animated by the transition when lower radius is reached\r\n */\r\n this.lowerRadiusTransitionRange = 2;\r\n /**\r\n * Length of the distance animated by the transition when upper radius is reached\r\n */\r\n this.upperRadiusTransitionRange = -2;\r\n this._autoTransitionRange = false;\r\n // Animations\r\n this._radiusIsAnimating = false;\r\n this._radiusBounceTransition = null;\r\n this._animatables = new Array();\r\n }\r\n Object.defineProperty(BouncingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Bouncing\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BouncingBehavior.prototype, \"autoTransitionRange\", {\r\n /**\r\n * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n */\r\n get: function () {\r\n return this._autoTransitionRange;\r\n },\r\n /**\r\n * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n * Transition ranges will be set to 5% of the bounding box diagonal in world space\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._autoTransitionRange === value) {\r\n return;\r\n }\r\n this._autoTransitionRange = value;\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n if (value) {\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n mesh.computeWorldMatrix(true);\r\n var diagonal = mesh.getBoundingInfo().diagonalLength;\r\n _this.lowerRadiusTransitionRange = diagonal * 0.05;\r\n _this.upperRadiusTransitionRange = diagonal * 0.05;\r\n });\r\n }\r\n else if (this._onMeshTargetChangedObserver) {\r\n camera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n BouncingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n BouncingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n if (!_this._attachedCamera) {\r\n return;\r\n }\r\n // Add the bounce animation to the lower radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.lowerRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.lowerRadiusTransitionRange);\r\n }\r\n // Add the bounce animation to the upper radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.upperRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.upperRadiusTransitionRange);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n BouncingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Checks if the camera radius is at the specified limit. Takes into account animation locks.\r\n * @param radiusLimit The limit to check against.\r\n * @return Bool to indicate if at limit.\r\n */\r\n BouncingBehavior.prototype._isRadiusAtLimit = function (radiusLimit) {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n if (this._attachedCamera.radius === radiusLimit && !this._radiusIsAnimating) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Applies an animation to the radius of the camera, extending by the radiusDelta.\r\n * @param radiusDelta The delta by which to animate to. Can be negative.\r\n */\r\n BouncingBehavior.prototype._applyBoundRadiusAnimation = function (radiusDelta) {\r\n var _this = this;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (!this._radiusBounceTransition) {\r\n BouncingBehavior.EasingFunction.setEasingMode(BouncingBehavior.EasingMode);\r\n this._radiusBounceTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"].CreateAnimation(\"radius\", _Animations_animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"].ANIMATIONTYPE_FLOAT, 60, BouncingBehavior.EasingFunction);\r\n }\r\n // Prevent zoom until bounce has completed\r\n this._cachedWheelPrecision = this._attachedCamera.wheelPrecision;\r\n this._attachedCamera.wheelPrecision = Infinity;\r\n this._attachedCamera.inertialRadiusOffset = 0;\r\n // Animate to the radius limit\r\n this.stopAllAnimations();\r\n this._radiusIsAnimating = true;\r\n var animatable = _Animations_animation__WEBPACK_IMPORTED_MODULE_1__[\"Animation\"].TransitionTo(\"radius\", this._attachedCamera.radius + radiusDelta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusBounceTransition, this.transitionDuration, function () { return _this._clearAnimationLocks(); });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the camera properties.\r\n */\r\n BouncingBehavior.prototype._clearAnimationLocks = function () {\r\n this._radiusIsAnimating = false;\r\n if (this._attachedCamera) {\r\n this._attachedCamera.wheelPrecision = this._cachedWheelPrecision;\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n BouncingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n this._animatables.shift();\r\n }\r\n };\r\n /**\r\n * The easing function used by animations\r\n */\r\n BouncingBehavior.EasingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"BackEase\"](0.3);\r\n /**\r\n * The easing mode used by animations\r\n */\r\n BouncingBehavior.EasingMode = _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"EasingFunction\"].EASINGMODE_EASEOUT;\r\n return BouncingBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/framingBehavior.ts\":\n/*!**********************************************!*\\\n !*** ./Behaviors/Cameras/framingBehavior.ts ***!\n \\**********************************************/\n/*! exports provided: FramingBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return FramingBehavior; });\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\nvar FramingBehavior = /** @class */ (function () {\r\n function FramingBehavior() {\r\n this._mode = FramingBehavior.FitFrustumSidesMode;\r\n this._radiusScale = 1.0;\r\n this._positionScale = 0.5;\r\n this._defaultElevation = 0.3;\r\n this._elevationReturnTime = 1500;\r\n this._elevationReturnWaitTime = 1000;\r\n this._zoomStopsAnimation = false;\r\n this._framingTime = 1500;\r\n /**\r\n * Define if the behavior should automatically change the configured\r\n * camera limits and sensibilities.\r\n */\r\n this.autoCorrectCameraLimitsAndSensibility = true;\r\n this._isPointerDown = false;\r\n this._lastInteractionTime = -Infinity;\r\n // Framing control\r\n this._animatables = new Array();\r\n this._betaIsAnimating = false;\r\n }\r\n Object.defineProperty(FramingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Framing\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"mode\", {\r\n /**\r\n * Gets current mode used by the behavior.\r\n */\r\n get: function () {\r\n return this._mode;\r\n },\r\n /**\r\n * Sets the current mode used by the behavior\r\n */\r\n set: function (mode) {\r\n this._mode = mode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"radiusScale\", {\r\n /**\r\n * Gets the scale applied to the radius\r\n */\r\n get: function () {\r\n return this._radiusScale;\r\n },\r\n /**\r\n * Sets the scale applied to the radius (1 by default)\r\n */\r\n set: function (radius) {\r\n this._radiusScale = radius;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"positionScale\", {\r\n /**\r\n * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n get: function () {\r\n return this._positionScale;\r\n },\r\n /**\r\n * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n set: function (scale) {\r\n this._positionScale = scale;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"defaultElevation\", {\r\n /**\r\n * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n get: function () {\r\n return this._defaultElevation;\r\n },\r\n /**\r\n * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n set: function (elevation) {\r\n this._defaultElevation = elevation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnTime\", {\r\n /**\r\n * Gets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n get: function () {\r\n return this._elevationReturnTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n set: function (speed) {\r\n this._elevationReturnTime = speed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnWaitTime\", {\r\n /**\r\n * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n get: function () {\r\n return this._elevationReturnWaitTime;\r\n },\r\n /**\r\n * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n set: function (time) {\r\n this._elevationReturnWaitTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"framingTime\", {\r\n /**\r\n * Gets the transition time when framing the mesh, in milliseconds\r\n */\r\n get: function () {\r\n return this._framingTime;\r\n },\r\n /**\r\n * Sets the transition time when framing the mesh, in milliseconds\r\n */\r\n set: function (time) {\r\n this._framingTime = time;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n FramingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n FramingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n FramingBehavior.EasingFunction.setEasingMode(FramingBehavior.EasingMode);\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"].POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (mesh) {\r\n _this.zoomOnMesh(mesh);\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n // Maintain the camera above the ground. If the user pulls the camera beneath the ground plane, lift it\r\n // back to the default position after a given timeout\r\n _this._maintainCameraAboveGround();\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n FramingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Targets the given mesh and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param radius Optional. If a cached radius position already exists, overrides default.\r\n * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMesh = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getBoundingInfo().boundingBox;\r\n this.zoomOnBoundingInfo(boundingBox.minimumWorld, boundingBox.maximumWorld, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given mesh with its children and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param radius Optional. If a cached radius position already exists, overrides default.\r\n * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshHierarchy = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getHierarchyBoundingVectors(true);\r\n this.zoomOnBoundingInfo(boundingBox.min, boundingBox.max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given meshes with their children and updates zoom level accordingly.\r\n * @param meshes The mesh to target.\r\n * @param radius Optional. If a cached radius position already exists, overrides default.\r\n * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshesHierarchy = function (meshes, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var min = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var i = 0; i < meshes.length; i++) {\r\n var boundingInfo = meshes[i].getHierarchyBoundingVectors(true);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CheckExtends(boundingInfo.min, min, max);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CheckExtends(boundingInfo.max, min, max);\r\n }\r\n this.zoomOnBoundingInfo(min, max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the bounding box info defined by its extends and updates zoom level accordingly.\r\n * @param minimumWorld Determines the smaller position of the bounding box extend\r\n * @param maximumWorld Determines the bigger position of the bounding box extend\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnBoundingInfo = function (minimumWorld, maximumWorld, focusOnOriginXZ, onAnimationEnd) {\r\n var _this = this;\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var zoomTarget;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n // Find target by interpolating from bottom of bounding box in world-space to top via framingPositionY\r\n var bottom = minimumWorld.y;\r\n var top = maximumWorld.y;\r\n var zoomTargetY = bottom + (top - bottom) * this._positionScale;\r\n var radiusWorld = maximumWorld.subtract(minimumWorld).scale(0.5);\r\n if (focusOnOriginXZ) {\r\n zoomTarget = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, zoomTargetY, 0);\r\n }\r\n else {\r\n var centerWorld = minimumWorld.add(radiusWorld);\r\n zoomTarget = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](centerWorld.x, zoomTargetY, centerWorld.z);\r\n }\r\n if (!this._vectorTransition) {\r\n this._vectorTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].CreateAnimation(\"target\", _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].ANIMATIONTYPE_VECTOR3, 60, FramingBehavior.EasingFunction);\r\n }\r\n this._betaIsAnimating = true;\r\n var animatable = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].TransitionTo(\"target\", zoomTarget, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n // sets the radius and lower radius bounds\r\n // Small delta ensures camera is not always at lower zoom limit.\r\n var radius = 0;\r\n if (this._mode === FramingBehavior.FitFrustumSidesMode) {\r\n var position = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n this._attachedCamera.lowerRadiusLimit = radiusWorld.length() + this._attachedCamera.minZ;\r\n }\r\n radius = position;\r\n }\r\n else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n radius = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null) {\r\n this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;\r\n }\r\n }\r\n // Set sensibilities\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n var extend = maximumWorld.subtract(minimumWorld).length();\r\n this._attachedCamera.panningSensibility = 5000 / extend;\r\n this._attachedCamera.wheelPrecision = 100 / radius;\r\n }\r\n // transition to new radius\r\n if (!this._radiusTransition) {\r\n this._radiusTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].CreateAnimation(\"radius\", _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n animatable = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].TransitionTo(\"radius\", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function () {\r\n _this.stopAllAnimations();\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n if (_this._attachedCamera && _this._attachedCamera.useInputToRestoreState) {\r\n _this._attachedCamera.storeState();\r\n }\r\n });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Calculates the lowest radius for the camera based on the bounding box of the mesh.\r\n * @param mesh The mesh on which to base the calculation. mesh boundingInfo used to estimate necessary\r\n *\t\t\t frustum width.\r\n * @return The minimum distance from the primary mesh's center point at which the camera must be kept in order\r\n *\t\t to fully enclose the mesh in the viewing frustum.\r\n */\r\n FramingBehavior.prototype._calculateLowerRadiusFromModelBoundingSphere = function (minimumWorld, maximumWorld) {\r\n var size = maximumWorld.subtract(minimumWorld);\r\n var boxVectorGlobalDiagonal = size.length();\r\n var frustumSlope = this._getFrustumSlope();\r\n // Formula for setting distance\r\n // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)\r\n var radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;\r\n // Horizon distance\r\n var radius = radiusWithoutFraming * this._radiusScale;\r\n var distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.x * frustumSlope.x));\r\n var distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.y * frustumSlope.y));\r\n var distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return 0;\r\n }\r\n if (camera.lowerRadiusLimit && this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n // Don't exceed the requested limit\r\n distance = distance < camera.lowerRadiusLimit ? camera.lowerRadiusLimit : distance;\r\n }\r\n // Don't exceed the upper radius limit\r\n if (camera.upperRadiusLimit) {\r\n distance = distance > camera.upperRadiusLimit ? camera.upperRadiusLimit : distance;\r\n }\r\n return distance;\r\n };\r\n /**\r\n * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera\r\n * is automatically returned to its default position (expected to be above ground plane).\r\n */\r\n FramingBehavior.prototype._maintainCameraAboveGround = function () {\r\n var _this = this;\r\n if (this._elevationReturnTime < 0) {\r\n return;\r\n }\r\n var timeSinceInteraction = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__[\"PrecisionDate\"].Now - this._lastInteractionTime;\r\n var defaultBeta = Math.PI * 0.5 - this._defaultElevation;\r\n var limitBeta = Math.PI * 0.5;\r\n // Bring the camera back up if below the ground plane\r\n if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > limitBeta && timeSinceInteraction >= this._elevationReturnWaitTime) {\r\n this._betaIsAnimating = true;\r\n //Transition to new position\r\n this.stopAllAnimations();\r\n if (!this._betaTransition) {\r\n this._betaTransition = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].CreateAnimation(\"beta\", _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n var animatabe = _Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].TransitionTo(\"beta\", defaultBeta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._betaTransition, this._elevationReturnTime, function () {\r\n _this._clearAnimationLocks();\r\n _this.stopAllAnimations();\r\n });\r\n if (animatabe) {\r\n this._animatables.push(animatabe);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the frustum slope based on the canvas ratio and camera FOV\r\n * @returns The frustum slope represented as a Vector2 with X and Y slopes\r\n */\r\n FramingBehavior.prototype._getFrustumSlope = function () {\r\n // Calculate the viewport ratio\r\n // Aspect Ratio is Height/Width.\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n }\r\n var engine = camera.getScene().getEngine();\r\n var aspectRatio = engine.getAspectRatio(camera);\r\n // Camera FOV is the vertical field of view (top-bottom) in radians.\r\n // Slope of the frustum top/bottom planes in view space, relative to the forward vector.\r\n var frustumSlopeY = Math.tan(camera.fov / 2);\r\n // Slope of the frustum left/right planes in view space, relative to the forward vector.\r\n // Provides the amount that one side (e.g. left) of the frustum gets wider for every unit\r\n // along the forward vector.\r\n var frustumSlopeX = frustumSlopeY * aspectRatio;\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](frustumSlopeX, frustumSlopeY);\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.\r\n */\r\n FramingBehavior.prototype._clearAnimationLocks = function () {\r\n this._betaIsAnimating = false;\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n FramingBehavior.prototype._applyUserInteraction = function () {\r\n if (this.isUserIsMoving) {\r\n this._lastInteractionTime = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__[\"PrecisionDate\"].Now;\r\n this.stopAllAnimations();\r\n this._clearAnimationLocks();\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n FramingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n if (this._animatables[0]) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n }\r\n this._animatables.shift();\r\n }\r\n };\r\n Object.defineProperty(FramingBehavior.prototype, \"isUserIsMoving\", {\r\n /**\r\n * Gets a value indicating if the user is moving the camera\r\n */\r\n get: function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * The easing function used by animations\r\n */\r\n FramingBehavior.EasingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"ExponentialEase\"]();\r\n /**\r\n * The easing mode used by animations\r\n */\r\n FramingBehavior.EasingMode = _Animations_easing__WEBPACK_IMPORTED_MODULE_0__[\"EasingFunction\"].EASINGMODE_EASEINOUT;\r\n // Statics\r\n /**\r\n * The camera can move all the way towards the mesh.\r\n */\r\n FramingBehavior.IgnoreBoundsSizeMode = 0;\r\n /**\r\n * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides\r\n */\r\n FramingBehavior.FitFrustumSidesMode = 1;\r\n return FramingBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Cameras/index.ts\":\n/*!************************************!*\\\n !*** ./Behaviors/Cameras/index.ts ***!\n \\************************************/\n/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _autoRotationBehavior__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autoRotationBehavior */ \"./Behaviors/Cameras/autoRotationBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _autoRotationBehavior__WEBPACK_IMPORTED_MODULE_0__[\"AutoRotationBehavior\"]; });\n\n/* harmony import */ var _bouncingBehavior__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bouncingBehavior */ \"./Behaviors/Cameras/bouncingBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _bouncingBehavior__WEBPACK_IMPORTED_MODULE_1__[\"BouncingBehavior\"]; });\n\n/* harmony import */ var _framingBehavior__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./framingBehavior */ \"./Behaviors/Cameras/framingBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _framingBehavior__WEBPACK_IMPORTED_MODULE_2__[\"FramingBehavior\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/attachToBoxBehavior.ts\":\n/*!*************************************************!*\\\n !*** ./Behaviors/Meshes/attachToBoxBehavior.ts ***!\n \\*************************************************/\n/*! exports provided: AttachToBoxBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return AttachToBoxBehavior; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * @hidden\r\n */\r\nvar FaceDirectionInfo = /** @class */ (function () {\r\n function FaceDirectionInfo(direction, rotatedDirection, diff, ignore) {\r\n if (rotatedDirection === void 0) { rotatedDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](); }\r\n if (diff === void 0) { diff = 0; }\r\n if (ignore === void 0) { ignore = false; }\r\n this.direction = direction;\r\n this.rotatedDirection = rotatedDirection;\r\n this.diff = diff;\r\n this.ignore = ignore;\r\n }\r\n return FaceDirectionInfo;\r\n}());\r\n/**\r\n * A behavior that when attached to a mesh will will place a specified node on the meshes face pointing towards the camera\r\n */\r\nvar AttachToBoxBehavior = /** @class */ (function () {\r\n /**\r\n * Creates the AttachToBoxBehavior, used to attach UI to the closest face of the box to a camera\r\n * @param ui The transform node that should be attched to the mesh\r\n */\r\n function AttachToBoxBehavior(ui) {\r\n this.ui = ui;\r\n /**\r\n * The name of the behavior\r\n */\r\n this.name = \"AttachToBoxBehavior\";\r\n /**\r\n * The distance away from the face of the mesh that the UI should be attached to (default: 0.15)\r\n */\r\n this.distanceAwayFromFace = 0.15;\r\n /**\r\n * The distance from the bottom of the face that the UI should be attached to (default: 0.15)\r\n */\r\n this.distanceAwayFromBottomOfFace = 0.15;\r\n this._faceVectors = [new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Down()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Left()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Right()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Forward()), new FaceDirectionInfo(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Forward().scaleInPlace(-1))];\r\n this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]();\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n this._zeroVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._lookAtTmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]();\r\n /* Does nothing */\r\n }\r\n /**\r\n * Initializes the behavior\r\n */\r\n AttachToBoxBehavior.prototype.init = function () {\r\n /* Does nothing */\r\n };\r\n AttachToBoxBehavior.prototype._closestFace = function (targetDirection) {\r\n var _this = this;\r\n // Go over each face and calculate the angle between the face's normal and targetDirection\r\n this._faceVectors.forEach(function (v) {\r\n if (!_this._target.rotationQuaternion) {\r\n _this._target.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRoll(_this._target.rotation.y, _this._target.rotation.x, _this._target.rotation.z);\r\n }\r\n _this._target.rotationQuaternion.toRotationMatrix(_this._tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(v.direction, _this._tmpMatrix, v.rotatedDirection);\r\n v.diff = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].GetAngleBetweenVectors(v.rotatedDirection, targetDirection, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(v.rotatedDirection, targetDirection));\r\n });\r\n // Return the face information of the one with the normal closeset to target direction\r\n return this._faceVectors.reduce(function (min, p) {\r\n if (min.ignore) {\r\n return p;\r\n }\r\n else if (p.ignore) {\r\n return min;\r\n }\r\n else {\r\n return min.diff < p.diff ? min : p;\r\n }\r\n }, this._faceVectors[0]);\r\n };\r\n AttachToBoxBehavior.prototype._lookAtToRef = function (pos, up, ref) {\r\n if (up === void 0) { up = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1, 0); }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].LookAtLHToRef(this._zeroVector, pos, up, this._lookAtTmpMatrix);\r\n this._lookAtTmpMatrix.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromRotationMatrixToRef(this._lookAtTmpMatrix, ref);\r\n };\r\n /**\r\n * Attaches the AttachToBoxBehavior to the passed in mesh\r\n * @param target The mesh that the specified node will be attached to\r\n */\r\n AttachToBoxBehavior.prototype.attach = function (target) {\r\n var _this = this;\r\n this._target = target;\r\n this._scene = this._target.getScene();\r\n // Every frame, update the app bars position\r\n this._onRenderObserver = this._scene.onBeforeRenderObservable.add(function () {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n // Find the face closest to the cameras position\r\n var cameraPos = _this._scene.activeCamera.position;\r\n if (_this._scene.activeCamera.devicePosition) {\r\n cameraPos = _this._scene.activeCamera.devicePosition;\r\n }\r\n var facing = _this._closestFace(cameraPos.subtract(target.position));\r\n if (_this._scene.activeCamera.leftCamera) {\r\n _this._scene.activeCamera.leftCamera.computeWorldMatrix().getRotationMatrixToRef(_this._tmpMatrix);\r\n }\r\n else {\r\n _this._scene.activeCamera.computeWorldMatrix().getRotationMatrixToRef(_this._tmpMatrix);\r\n }\r\n // Get camera up direction\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(), _this._tmpMatrix, _this._tmpVector);\r\n // Ignore faces to not select a parrelel face for the up vector of the UI\r\n _this._faceVectors.forEach(function (v) {\r\n if (facing.direction.x && v.direction.x) {\r\n v.ignore = true;\r\n }\r\n if (facing.direction.y && v.direction.y) {\r\n v.ignore = true;\r\n }\r\n if (facing.direction.z && v.direction.z) {\r\n v.ignore = true;\r\n }\r\n });\r\n var facingUp = _this._closestFace(_this._tmpVector);\r\n // Unignore faces\r\n _this._faceVectors.forEach(function (v) {\r\n v.ignore = false;\r\n });\r\n // Position the app bar on that face\r\n _this.ui.position.copyFrom(target.position);\r\n if (facing.direction.x) {\r\n facing.rotatedDirection.scaleToRef((target.scaling.x / 2) + _this.distanceAwayFromFace, _this._tmpVector);\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n }\r\n if (facing.direction.y) {\r\n facing.rotatedDirection.scaleToRef((target.scaling.y / 2) + _this.distanceAwayFromFace, _this._tmpVector);\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n }\r\n if (facing.direction.z) {\r\n facing.rotatedDirection.scaleToRef((target.scaling.z / 2) + _this.distanceAwayFromFace, _this._tmpVector);\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n }\r\n // Rotate to be oriented properly to the camera\r\n if (!_this.ui.rotationQuaternion) {\r\n _this.ui.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRoll(_this.ui.rotation.y, _this.ui.rotation.x, _this.ui.rotation.z);\r\n }\r\n facing.rotatedDirection.scaleToRef(-1, _this._tmpVector);\r\n _this._lookAtToRef(_this._tmpVector, facingUp.rotatedDirection, _this.ui.rotationQuaternion);\r\n // Place ui the correct distance from the bottom of the mesh\r\n if (facingUp.direction.x) {\r\n _this.ui.up.scaleToRef(_this.distanceAwayFromBottomOfFace - target.scaling.x / 2, _this._tmpVector);\r\n }\r\n if (facingUp.direction.y) {\r\n _this.ui.up.scaleToRef(_this.distanceAwayFromBottomOfFace - target.scaling.y / 2, _this._tmpVector);\r\n }\r\n if (facingUp.direction.z) {\r\n _this.ui.up.scaleToRef(_this.distanceAwayFromBottomOfFace - target.scaling.z / 2, _this._tmpVector);\r\n }\r\n _this.ui.position.addInPlace(_this._tmpVector);\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n AttachToBoxBehavior.prototype.detach = function () {\r\n this._scene.onBeforeRenderObservable.remove(this._onRenderObserver);\r\n };\r\n return AttachToBoxBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/fadeInOutBehavior.ts\":\n/*!***********************************************!*\\\n !*** ./Behaviors/Meshes/fadeInOutBehavior.ts ***!\n \\***********************************************/\n/*! exports provided: FadeInOutBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return FadeInOutBehavior; });\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to fade in and out\r\n */\r\nvar FadeInOutBehavior = /** @class */ (function () {\r\n /**\r\n * Instatiates the FadeInOutBehavior\r\n */\r\n function FadeInOutBehavior() {\r\n var _this = this;\r\n /**\r\n * Time in milliseconds to delay before fading in (Default: 0)\r\n */\r\n this.delay = 0;\r\n /**\r\n * Time in milliseconds for the mesh to fade in (Default: 300)\r\n */\r\n this.fadeInTime = 300;\r\n this._millisecondsPerFrame = 1000 / 60;\r\n this._hovered = false;\r\n this._hoverValue = 0;\r\n this._ownerNode = null;\r\n this._update = function () {\r\n if (_this._ownerNode) {\r\n _this._hoverValue += _this._hovered ? _this._millisecondsPerFrame : -_this._millisecondsPerFrame;\r\n _this._setAllVisibility(_this._ownerNode, (_this._hoverValue - _this.delay) / _this.fadeInTime);\r\n if (_this._ownerNode.visibility > 1) {\r\n _this._setAllVisibility(_this._ownerNode, 1);\r\n _this._hoverValue = _this.fadeInTime + _this.delay;\r\n return;\r\n }\r\n else if (_this._ownerNode.visibility < 0) {\r\n _this._setAllVisibility(_this._ownerNode, 0);\r\n if (_this._hoverValue < 0) {\r\n _this._hoverValue = 0;\r\n return;\r\n }\r\n }\r\n setTimeout(_this._update, _this._millisecondsPerFrame);\r\n }\r\n };\r\n }\r\n Object.defineProperty(FadeInOutBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"FadeInOut\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n FadeInOutBehavior.prototype.init = function () {\r\n };\r\n /**\r\n * Attaches the fade behavior on the passed in mesh\r\n * @param ownerNode The mesh that will be faded in/out once attached\r\n */\r\n FadeInOutBehavior.prototype.attach = function (ownerNode) {\r\n this._ownerNode = ownerNode;\r\n this._setAllVisibility(this._ownerNode, 0);\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n FadeInOutBehavior.prototype.detach = function () {\r\n this._ownerNode = null;\r\n };\r\n /**\r\n * Triggers the mesh to begin fading in or out\r\n * @param value if the object should fade in or out (true to fade in)\r\n */\r\n FadeInOutBehavior.prototype.fadeIn = function (value) {\r\n this._hovered = value;\r\n this._update();\r\n };\r\n FadeInOutBehavior.prototype._setAllVisibility = function (mesh, value) {\r\n var _this = this;\r\n mesh.visibility = value;\r\n mesh.getChildMeshes().forEach(function (c) {\r\n _this._setAllVisibility(c, value);\r\n });\r\n };\r\n return FadeInOutBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/index.ts\":\n/*!***********************************!*\\\n !*** ./Behaviors/Meshes/index.ts ***!\n \\***********************************/\n/*! exports provided: PointerDragBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _attachToBoxBehavior__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./attachToBoxBehavior */ \"./Behaviors/Meshes/attachToBoxBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _attachToBoxBehavior__WEBPACK_IMPORTED_MODULE_0__[\"AttachToBoxBehavior\"]; });\n\n/* harmony import */ var _fadeInOutBehavior__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fadeInOutBehavior */ \"./Behaviors/Meshes/fadeInOutBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _fadeInOutBehavior__WEBPACK_IMPORTED_MODULE_1__[\"FadeInOutBehavior\"]; });\n\n/* harmony import */ var _multiPointerScaleBehavior__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./multiPointerScaleBehavior */ \"./Behaviors/Meshes/multiPointerScaleBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _multiPointerScaleBehavior__WEBPACK_IMPORTED_MODULE_2__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony import */ var _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_3__[\"PointerDragBehavior\"]; });\n\n/* harmony import */ var _sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sixDofDragBehavior */ \"./Behaviors/Meshes/sixDofDragBehavior.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_4__[\"SixDofDragBehavior\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/multiPointerScaleBehavior.ts\":\n/*!*******************************************************!*\\\n !*** ./Behaviors/Meshes/multiPointerScaleBehavior.ts ***!\n \\*******************************************************/\n/*! exports provided: MultiPointerScaleBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return MultiPointerScaleBehavior; });\n/* harmony import */ var _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be scaled\r\n */\r\nvar MultiPointerScaleBehavior = /** @class */ (function () {\r\n /**\r\n * Instantiate a new behavior that when attached to a mesh will allow the mesh to be scaled\r\n */\r\n function MultiPointerScaleBehavior() {\r\n this._startDistance = 0;\r\n this._initialScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0);\r\n this._targetScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0);\r\n this._sceneRenderObserver = null;\r\n this._dragBehaviorA = new _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_0__[\"PointerDragBehavior\"]({});\r\n this._dragBehaviorA.moveAttached = false;\r\n this._dragBehaviorB = new _pointerDragBehavior__WEBPACK_IMPORTED_MODULE_0__[\"PointerDragBehavior\"]({});\r\n this._dragBehaviorB.moveAttached = false;\r\n }\r\n Object.defineProperty(MultiPointerScaleBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"MultiPointerScale\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n MultiPointerScaleBehavior.prototype.init = function () { };\r\n MultiPointerScaleBehavior.prototype._getCurrentDistance = function () {\r\n return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length();\r\n };\r\n /**\r\n * Attaches the scale behavior the passed in mesh\r\n * @param ownerNode The mesh that will be scaled around once attached\r\n */\r\n MultiPointerScaleBehavior.prototype.attach = function (ownerNode) {\r\n var _this = this;\r\n this._ownerNode = ownerNode;\r\n // Create 2 drag behaviors such that each will only be triggered by a separate pointer\r\n this._dragBehaviorA.onDragStartObservable.add(function (e) {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n if (_this._dragBehaviorA.currentDraggingPointerID == _this._dragBehaviorB.currentDraggingPointerID) {\r\n _this._dragBehaviorA.releaseDrag();\r\n }\r\n else {\r\n _this._initialScale.copyFrom(ownerNode.scaling);\r\n _this._startDistance = _this._getCurrentDistance();\r\n }\r\n }\r\n });\r\n this._dragBehaviorB.onDragStartObservable.add(function (e) {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n if (_this._dragBehaviorA.currentDraggingPointerID == _this._dragBehaviorB.currentDraggingPointerID) {\r\n _this._dragBehaviorB.releaseDrag();\r\n }\r\n else {\r\n _this._initialScale.copyFrom(ownerNode.scaling);\r\n _this._startDistance = _this._getCurrentDistance();\r\n }\r\n }\r\n });\r\n // Once both drag behaviors are active scale based on the distance between the two pointers\r\n [this._dragBehaviorA, this._dragBehaviorB].forEach(function (behavior) {\r\n behavior.onDragObservable.add(function () {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n var ratio = _this._getCurrentDistance() / _this._startDistance;\r\n _this._initialScale.scaleToRef(ratio, _this._targetScale);\r\n }\r\n });\r\n });\r\n ownerNode.addBehavior(this._dragBehaviorA);\r\n ownerNode.addBehavior(this._dragBehaviorB);\r\n // On every frame move towards target scaling to avoid jitter caused by vr controllers\r\n this._sceneRenderObserver = ownerNode.getScene().onBeforeRenderObservable.add(function () {\r\n if (_this._dragBehaviorA.dragging && _this._dragBehaviorB.dragging) {\r\n var change = _this._targetScale.subtract(ownerNode.scaling).scaleInPlace(0.1);\r\n if (change.length() > 0.01) {\r\n ownerNode.scaling.addInPlace(change);\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n MultiPointerScaleBehavior.prototype.detach = function () {\r\n var _this = this;\r\n this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver);\r\n [this._dragBehaviorA, this._dragBehaviorB].forEach(function (behavior) {\r\n behavior.onDragStartObservable.clear();\r\n behavior.onDragObservable.clear();\r\n _this._ownerNode.removeBehavior(behavior);\r\n });\r\n };\r\n return MultiPointerScaleBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/pointerDragBehavior.ts\":\n/*!*************************************************!*\\\n !*** ./Behaviors/Meshes/pointerDragBehavior.ts ***!\n \\*************************************************/\n/*! exports provided: PointerDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return PointerDragBehavior; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/pivotTools */ \"./Misc/pivotTools.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nvar PointerDragBehavior = /** @class */ (function () {\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n */\r\n function PointerDragBehavior(options) {\r\n this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n this.maxDragAngle = 0;\r\n /**\r\n * @hidden\r\n */\r\n this._useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n this.currentDraggingPointerID = -1;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n this.dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n this.dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n this.updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n this._debugMode = false;\r\n this._moving = false;\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n * * delta between last drag position and current drag position in world space\r\n * * dragDistance along the drag axis\r\n * * dragPlaneNormal normal of the current drag plane used during the drag\r\n * * dragPlanePoint in world space where the drag intersects the drag plane\r\n */\r\n this.onDragObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n */\r\n this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n this.moveAttached = true;\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n this.enabled = true;\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n this.startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n this.detachCameraControls = true;\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n this.useObjectOrienationForDragging = true;\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved\r\n */\r\n this.validateDrag = function (targetPosition) { return true; };\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._alternatePickedPoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._worldDragAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._targetPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._attachedElement = null;\r\n this._startDragRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]());\r\n this._lastPointerRay = {};\r\n this._dragDelta = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n // Variables to avoid instantiation in the below method\r\n this._pointA = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._pointB = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._pointC = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._lineA = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._lineB = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._localAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._lookAt = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._options = options ? options : {};\r\n var optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n Object.defineProperty(PointerDragBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"PointerDrag\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n PointerDragBehavior.prototype.init = function () { };\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n PointerDragBehavior.prototype.attach = function (ownerNode, predicate) {\r\n var _this = this;\r\n this._scene = ownerNode.getScene();\r\n this.attachedNode = ownerNode;\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._planeScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._planeScene = this._scene;\r\n }\r\n else {\r\n PointerDragBehavior._planeScene = new _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"](this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._planeScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(function () {\r\n PointerDragBehavior._planeScene.dispose();\r\n PointerDragBehavior._planeScene = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreatePlane(\"pointerDragPlane\", this._debugMode ? 1 : 10000, PointerDragBehavior._planeScene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].DOUBLESIDE);\r\n // State of the drag\r\n this.lastDragPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n var pickPredicate = !!predicate ? predicate : function (m) {\r\n return _this.attachedNode == m || m.isDescendantOf(_this.attachedNode);\r\n };\r\n this._pointerObserver = this._scene.onPointerObservable.add(function (pointerInfo, eventState) {\r\n if (!_this.enabled) {\r\n return;\r\n }\r\n if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (_this.startAndReleaseDragOnPointerEvents && !_this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.pickedPoint && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\r\n _this._startDrag(pointerInfo.event.pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERUP) {\r\n if (_this.startAndReleaseDragOnPointerEvents && _this.currentDraggingPointerID == pointerInfo.event.pointerId) {\r\n _this.releaseDrag();\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE) {\r\n var pointerId = pointerInfo.event.pointerId;\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (_this.currentDraggingPointerID === PointerDragBehavior._AnyMouseID && pointerId !== PointerDragBehavior._AnyMouseID && pointerInfo.event.pointerType == \"mouse\") {\r\n if (_this._lastPointerRay[_this.currentDraggingPointerID]) {\r\n _this._lastPointerRay[pointerId] = _this._lastPointerRay[_this.currentDraggingPointerID];\r\n delete _this._lastPointerRay[_this.currentDraggingPointerID];\r\n }\r\n _this.currentDraggingPointerID = pointerId;\r\n }\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!_this._lastPointerRay[pointerId]) {\r\n _this._lastPointerRay[pointerId] = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n _this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n if (_this.currentDraggingPointerID == pointerId && _this.dragging) {\r\n _this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n }\r\n });\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(function () {\r\n if (_this._moving && _this.moveAttached) {\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(_this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n _this._targetPosition.subtractToRef((_this.attachedNode).absolutePosition, _this._tmpVector);\r\n _this._tmpVector.scaleInPlace(_this.dragDeltaRatio);\r\n (_this.attachedNode).getAbsolutePosition().addToRef(_this._tmpVector, _this._tmpVector);\r\n if (_this.validateDrag(_this._tmpVector)) {\r\n (_this.attachedNode).setAbsolutePosition(_this._tmpVector);\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(_this.attachedNode);\r\n }\r\n });\r\n };\r\n /**\r\n * Force relase the drag action by code.\r\n */\r\n PointerDragBehavior.prototype.releaseDrag = function () {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID });\r\n this.currentDraggingPointerID = -1;\r\n this._moving = false;\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n this._scene.activeCamera.attachControl(this._attachedElement, true);\r\n }\r\n };\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n PointerDragBehavior.prototype.startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (pointerId === void 0) { pointerId = PointerDragBehavior._AnyMouseID; }\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n var lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseID) {\r\n lastRay = this._lastPointerRay[Object.keys(this._lastPointerRay)[0]];\r\n }\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n };\r\n PointerDragBehavior.prototype._startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n }\r\n else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerID = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });\r\n this._targetPosition.copyFrom((this.attachedNode).absolutePosition);\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedElement) {\r\n this._attachedElement = this._scene.activeCamera.inputs.attachedElement;\r\n this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement);\r\n }\r\n else {\r\n this._attachedElement = null;\r\n }\r\n }\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(this.attachedNode);\r\n };\r\n PointerDragBehavior.prototype._moveDrag = function (ray) {\r\n this._moving = true;\r\n var pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n if (pickedPoint) {\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n var dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrienationForDragging\r\n this.useObjectOrienationForDragging ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis) : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n dragLength = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n }\r\n else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({ dragDistance: dragLength, delta: this._dragDelta, dragPlanePoint: pickedPoint, dragPlaneNormal: this._dragPlane.forward, pointerId: this.currentDraggingPointerID });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n }\r\n };\r\n PointerDragBehavior.prototype._pickWithRayOnDragPlane = function (ray) {\r\n var _this = this;\r\n if (!ray) {\r\n return null;\r\n }\r\n // Calculate angle between plane normal and ray\r\n var angle = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n (this.attachedNode).absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n var dot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace((this.attachedNode).absolutePosition);\r\n return this._alternatePickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n var pickResult = PointerDragBehavior._planeScene.pickWithRay(ray, function (m) { return m == _this._dragPlane; });\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && pickResult.pickedPoint) {\r\n return pickResult.pickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n PointerDragBehavior.prototype._updateDragPlanePosition = function (ray, dragPlanePosition) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrienationForDragging ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragAxis);\r\n // Calculate plane normal in direction of camera but perpendicular to drag axis\r\n this._pointA.addToRef(this._localAxis, this._pointB); // towards drag axis\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointA.addToRef(this._pointC.normalize(), this._pointC); // towards camera\r\n // Get perpendicular line from direction to camera and drag axis\r\n this._pointB.subtractToRef(this._pointA, this._lineA);\r\n this._pointC.subtractToRef(this._pointA, this._lineB);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(this._lineA, this._lineB, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendiculat to camera\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(this._lineA, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrienationForDragging ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else {\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(ray.origin);\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition);\r\n this._dragPlane.computeWorldMatrix(true);\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n PointerDragBehavior.prototype.detach = function () {\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n this.releaseDrag();\r\n };\r\n PointerDragBehavior._AnyMouseID = -2;\r\n return PointerDragBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/Meshes/sixDofDragBehavior.ts\":\n/*!************************************************!*\\\n !*** ./Behaviors/Meshes/sixDofDragBehavior.ts ***!\n \\************************************************/\n/*! exports provided: SixDofDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return SixDofDragBehavior; });\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/pivotTools */ \"./Misc/pivotTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around based on directions and origin of the pointer's ray\r\n */\r\nvar SixDofDragBehavior = /** @class */ (function () {\r\n /**\r\n * Instantiates a behavior that when attached to a mesh will allow the mesh to be dragged around based on directions and origin of the pointer's ray\r\n */\r\n function SixDofDragBehavior() {\r\n this._sceneRenderObserver = null;\r\n this._targetPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n this._moving = false;\r\n this._startingOrientation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n /**\r\n * How much faster the object should move when the controller is moving towards it. This is useful to bring objects that are far away from the user to them faster. Set this to 0 to avoid any speed increase. (Default: 3)\r\n */\r\n this.zDragFactor = 3;\r\n /**\r\n * If the object should rotate to face the drag origin\r\n */\r\n this.rotateDraggedObject = true;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n this.dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n this.dragDeltaRatio = 0.2;\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n this.currentDraggingPointerID = -1;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n this.detachCameraControls = true;\r\n /**\r\n * Fires each time a drag starts\r\n */\r\n this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n }\r\n Object.defineProperty(SixDofDragBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"SixDofDrag\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n SixDofDragBehavior.prototype.init = function () { };\r\n Object.defineProperty(SixDofDragBehavior.prototype, \"_pointerCamera\", {\r\n /**\r\n * In the case of multiplea active cameras, the cameraToUseForPointers should be used if set instead of active camera\r\n */\r\n get: function () {\r\n if (this._scene.cameraToUseForPointers) {\r\n return this._scene.cameraToUseForPointers;\r\n }\r\n else {\r\n return this._scene.activeCamera;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches the scale behavior the passed in mesh\r\n * @param ownerNode The mesh that will be scaled around once attached\r\n */\r\n SixDofDragBehavior.prototype.attach = function (ownerNode) {\r\n var _this = this;\r\n this._ownerNode = ownerNode;\r\n this._scene = this._ownerNode.getScene();\r\n if (!SixDofDragBehavior._virtualScene) {\r\n SixDofDragBehavior._virtualScene = new _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"](this._scene.getEngine());\r\n SixDofDragBehavior._virtualScene.detachControl();\r\n this._scene.getEngine().scenes.pop();\r\n }\r\n var pickedMesh = null;\r\n var lastSixDofOriginPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n // Setup virtual meshes to be used for dragging without dirtying the existing scene\r\n this._virtualOriginMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"](\"\", SixDofDragBehavior._virtualScene);\r\n this._virtualOriginMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n this._virtualDragMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"](\"\", SixDofDragBehavior._virtualScene);\r\n this._virtualDragMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n var pickPredicate = function (m) {\r\n return _this._ownerNode == m || m.isDescendantOf(_this._ownerNode);\r\n };\r\n var attachedElement = null;\r\n this._pointerObserver = this._scene.onPointerObservable.add(function (pointerInfo, eventState) {\r\n if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (!_this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\r\n if (_this._pointerCamera && _this._pointerCamera.cameraRigMode == _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__[\"Camera\"].RIG_MODE_NONE) {\r\n pointerInfo.pickInfo.ray.origin.copyFrom(_this._pointerCamera.globalPosition);\r\n }\r\n pickedMesh = _this._ownerNode;\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(pickedMesh);\r\n lastSixDofOriginPosition.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n // Set position and orientation of the controller\r\n _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(pointerInfo.pickInfo.ray.direction));\r\n // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged\r\n _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);\r\n pickedMesh.computeWorldMatrix();\r\n _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);\r\n if (!pickedMesh.rotationQuaternion) {\r\n pickedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);\r\n }\r\n var oldParent = pickedMesh.parent;\r\n pickedMesh.setParent(null);\r\n _this._virtualDragMesh.rotationQuaternion.copyFrom(pickedMesh.rotationQuaternion);\r\n pickedMesh.setParent(oldParent);\r\n _this._virtualOriginMesh.addChild(_this._virtualDragMesh);\r\n // Update state\r\n _this._targetPosition.copyFrom(_this._virtualDragMesh.absolutePosition);\r\n _this.dragging = true;\r\n _this.currentDraggingPointerID = pointerInfo.event.pointerId;\r\n // Detatch camera controls\r\n if (_this.detachCameraControls && _this._pointerCamera && !_this._pointerCamera.leftCamera) {\r\n if (_this._pointerCamera.inputs.attachedElement) {\r\n attachedElement = _this._pointerCamera.inputs.attachedElement;\r\n _this._pointerCamera.detachControl(_this._pointerCamera.inputs.attachedElement);\r\n }\r\n else {\r\n attachedElement = null;\r\n }\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(pickedMesh);\r\n _this.onDragStartObservable.notifyObservers({});\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP) {\r\n if (_this.currentDraggingPointerID == pointerInfo.event.pointerId) {\r\n _this.dragging = false;\r\n _this._moving = false;\r\n _this.currentDraggingPointerID = -1;\r\n pickedMesh = null;\r\n _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);\r\n // Reattach camera controls\r\n if (_this.detachCameraControls && attachedElement && _this._pointerCamera && !_this._pointerCamera.leftCamera) {\r\n _this._pointerCamera.attachControl(attachedElement, true);\r\n }\r\n _this.onDragEndObservable.notifyObservers({});\r\n }\r\n }\r\n else if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (_this.currentDraggingPointerID == pointerInfo.event.pointerId && _this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.ray && pickedMesh) {\r\n var zDragFactor = _this.zDragFactor;\r\n if (_this._pointerCamera && _this._pointerCamera.cameraRigMode == _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__[\"Camera\"].RIG_MODE_NONE) {\r\n pointerInfo.pickInfo.ray.origin.copyFrom(_this._pointerCamera.globalPosition);\r\n zDragFactor = 0;\r\n }\r\n // Calculate controller drag distance in controller space\r\n var originDragDifference = pointerInfo.pickInfo.ray.origin.subtract(lastSixDofOriginPosition);\r\n lastSixDofOriginPosition.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n var localOriginDragDifference = -_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(originDragDifference, pointerInfo.pickInfo.ray.direction);\r\n _this._virtualOriginMesh.addChild(_this._virtualDragMesh);\r\n // Determine how much the controller moved to/away towards the dragged object and use this to move the object further when its further away\r\n _this._virtualDragMesh.position.z -= _this._virtualDragMesh.position.z < 1 ? localOriginDragDifference * _this.zDragFactor : localOriginDragDifference * zDragFactor * _this._virtualDragMesh.position.z;\r\n if (_this._virtualDragMesh.position.z < 0) {\r\n _this._virtualDragMesh.position.z = 0;\r\n }\r\n // Update the controller position\r\n _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(pointerInfo.pickInfo.ray.direction));\r\n _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);\r\n // Move the virtualObjectsPosition into the picked mesh's space if needed\r\n _this._targetPosition.copyFrom(_this._virtualDragMesh.absolutePosition);\r\n if (pickedMesh.parent) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(_this._targetPosition, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(pickedMesh.parent.getWorldMatrix()), _this._targetPosition);\r\n }\r\n if (!_this._moving) {\r\n _this._startingOrientation.copyFrom(_this._virtualDragMesh.rotationQuaternion);\r\n }\r\n _this._moving = true;\r\n }\r\n }\r\n });\r\n var tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n // On every frame move towards target scaling to avoid jitter caused by vr controllers\r\n this._sceneRenderObserver = ownerNode.getScene().onBeforeRenderObservable.add(function () {\r\n if (_this.dragging && _this._moving && pickedMesh) {\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RemoveAndStorePivotPoint(pickedMesh);\r\n // Slowly move mesh to avoid jitter\r\n pickedMesh.position.addInPlace(_this._targetPosition.subtract(pickedMesh.position).scale(_this.dragDeltaRatio));\r\n if (_this.rotateDraggedObject) {\r\n // Get change in rotation\r\n tmpQuaternion.copyFrom(_this._startingOrientation);\r\n tmpQuaternion.x = -tmpQuaternion.x;\r\n tmpQuaternion.y = -tmpQuaternion.y;\r\n tmpQuaternion.z = -tmpQuaternion.z;\r\n _this._virtualDragMesh.rotationQuaternion.multiplyToRef(tmpQuaternion, tmpQuaternion);\r\n // Convert change in rotation to only y axis rotation\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(tmpQuaternion.toEulerAngles(\"xyz\").y, 0, 0, tmpQuaternion);\r\n tmpQuaternion.multiplyToRef(_this._startingOrientation, tmpQuaternion);\r\n // Slowly move mesh to avoid jitter\r\n var oldParent = pickedMesh.parent;\r\n // Only rotate the mesh if it's parent has uniform scaling\r\n if (!oldParent || (oldParent.scaling && !oldParent.scaling.isNonUniformWithinEpsilon(0.001))) {\r\n pickedMesh.setParent(null);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].SlerpToRef(pickedMesh.rotationQuaternion, tmpQuaternion, _this.dragDeltaRatio, pickedMesh.rotationQuaternion);\r\n pickedMesh.setParent(oldParent);\r\n }\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_6__[\"PivotTools\"]._RestorePivotPoint(pickedMesh);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n SixDofDragBehavior.prototype.detach = function () {\r\n if (this._scene) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._ownerNode) {\r\n this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver);\r\n }\r\n if (this._virtualOriginMesh) {\r\n this._virtualOriginMesh.dispose();\r\n }\r\n if (this._virtualDragMesh) {\r\n this._virtualDragMesh.dispose();\r\n }\r\n this.onDragEndObservable.clear();\r\n this.onDragStartObservable.clear();\r\n };\r\n return SixDofDragBehavior;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Behaviors/index.ts\":\n/*!****************************!*\\\n !*** ./Behaviors/index.ts ***!\n \\****************************/\n/*! exports provided: AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Cameras_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Cameras/index */ \"./Behaviors/Cameras/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_0__[\"AutoRotationBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_0__[\"BouncingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_0__[\"FramingBehavior\"]; });\n\n/* harmony import */ var _Meshes_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Meshes/index */ \"./Behaviors/Meshes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"PointerDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"AttachToBoxBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"FadeInOutBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_1__[\"SixDofDragBehavior\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/bone.ts\":\n/*!***********************!*\\\n !*** ./Bones/bone.ts ***!\n \\***********************/\n/*! exports provided: Bone */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return Bone; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store bone information\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Bone = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Bone, _super);\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix\r\n * @param restPose defines the rest pose matrix\r\n * @param baseMatrix defines the base matrix\r\n * @param index defines index of the bone in the hiearchy\r\n */\r\n function Bone(\r\n /**\r\n * defines the bone name\r\n */\r\n name, skeleton, parentBone, localMatrix, restPose, baseMatrix, index) {\r\n if (parentBone === void 0) { parentBone = null; }\r\n if (localMatrix === void 0) { localMatrix = null; }\r\n if (restPose === void 0) { restPose = null; }\r\n if (baseMatrix === void 0) { baseMatrix = null; }\r\n if (index === void 0) { index = null; }\r\n var _this = _super.call(this, name, skeleton.getScene(), false) || this;\r\n _this.name = name;\r\n /**\r\n * Gets the list of child bones\r\n */\r\n _this.children = new Array();\r\n /** Gets the animations associated with this bone */\r\n _this.animations = new Array();\r\n /**\r\n * @hidden Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n _this._index = null;\r\n _this._absoluteTransform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n _this._invertedAbsoluteTransform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n _this._scalingDeterminant = 1;\r\n _this._worldTransform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n _this._needToDecompose = true;\r\n _this._needToCompose = false;\r\n /** @hidden */\r\n _this._linkedTransformNode = null;\r\n /** @hidden */\r\n _this._waitingTransformNodeId = null;\r\n _this._skeleton = skeleton;\r\n _this._localMatrix = localMatrix ? localMatrix.clone() : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _this._restPose = restPose ? restPose : _this._localMatrix.clone();\r\n _this._baseMatrix = baseMatrix ? baseMatrix : _this._localMatrix.clone();\r\n _this._index = index;\r\n skeleton.bones.push(_this);\r\n _this.setParent(parentBone, false);\r\n if (baseMatrix || localMatrix) {\r\n _this._updateDifferenceMatrix();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Bone.prototype, \"_matrix\", {\r\n /** @hidden */\r\n get: function () {\r\n this._compose();\r\n return this._localMatrix;\r\n },\r\n /** @hidden */\r\n set: function (value) {\r\n this._localMatrix.copyFrom(value);\r\n this._needToDecompose = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Bone.prototype.getClassName = function () {\r\n return \"Bone\";\r\n };\r\n // Members\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n Bone.prototype.getSkeleton = function () {\r\n return this._skeleton;\r\n };\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n Bone.prototype.getParent = function () {\r\n return this._parent;\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Bone.prototype.getChildren = function () {\r\n return this.children;\r\n };\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n */\r\n Bone.prototype.setParent = function (parent, updateDifferenceMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (this._parent === parent) {\r\n return;\r\n }\r\n if (this._parent) {\r\n var index = this._parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this._parent.children.splice(index, 1);\r\n }\r\n }\r\n this._parent = parent;\r\n if (this._parent) {\r\n this._parent.children.push(this);\r\n }\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n this.markAsDirty();\r\n };\r\n /**\r\n * Gets the local matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getLocalMatrix = function () {\r\n this._compose();\r\n return this._localMatrix;\r\n };\r\n /**\r\n * Gets the base matrix (initial matrix which remains unchanged)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getBaseMatrix = function () {\r\n return this._baseMatrix;\r\n };\r\n /**\r\n * Gets the rest pose matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getRestPose = function () {\r\n return this._restPose;\r\n };\r\n /**\r\n * Gets a matrix used to store world matrix (ie. the matrix sent to shaders)\r\n */\r\n Bone.prototype.getWorldMatrix = function () {\r\n return this._worldTransform;\r\n };\r\n /**\r\n * Sets the local matrix to rest pose matrix\r\n */\r\n Bone.prototype.returnToRest = function () {\r\n this.updateMatrix(this._restPose.clone());\r\n };\r\n /**\r\n * Gets the inverse of the absolute transform matrix.\r\n * This matrix will be multiplied by local matrix to get the difference matrix (ie. the difference between original state and current state)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getInvertedAbsoluteTransform = function () {\r\n return this._invertedAbsoluteTransform;\r\n };\r\n /**\r\n * Gets the absolute transform matrix (ie base matrix * parent world matrix)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getAbsoluteTransform = function () {\r\n return this._absoluteTransform;\r\n };\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is copied from the transform node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n Bone.prototype.linkTransformNode = function (transformNode) {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n this._linkedTransformNode = transformNode;\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n };\r\n // Properties (matches AbstractMesh properties)\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n Bone.prototype.getTransformNode = function () {\r\n return this._linkedTransformNode;\r\n };\r\n Object.defineProperty(Bone.prototype, \"position\", {\r\n /** Gets or sets current position (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localPosition;\r\n },\r\n set: function (newPosition) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n this._markAsDirtyAndCompose();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotation\", {\r\n /** Gets or sets current rotation (in local space) */\r\n get: function () {\r\n return this.getRotation();\r\n },\r\n set: function (newRotation) {\r\n this.setRotation(newRotation);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotationQuaternion\", {\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localRotation;\r\n },\r\n set: function (newRotation) {\r\n this.setRotationQuaternion(newRotation);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"scaling\", {\r\n /** Gets or sets current scaling (in local space) */\r\n get: function () {\r\n return this.getScale();\r\n },\r\n set: function (newScaling) {\r\n this.setScale(newScaling);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets the animation properties override\r\n */\r\n get: function () {\r\n return this._skeleton.animationPropertiesOverride;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n Bone.prototype._decompose = function () {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n this._needToDecompose = false;\r\n if (!this._localScaling) {\r\n this._localScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._localRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Zero();\r\n this._localPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n };\r\n Bone.prototype._compose = function () {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n this._needToCompose = false;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n };\r\n /**\r\n * Update the base and local matrices\r\n * @param matrix defines the new base or local matrix\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n * @param updateLocalMatrix defines if the local matrix should be updated\r\n */\r\n Bone.prototype.updateMatrix = function (matrix, updateDifferenceMatrix, updateLocalMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (updateLocalMatrix === void 0) { updateLocalMatrix = true; }\r\n this._baseMatrix.copyFrom(matrix);\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n if (updateLocalMatrix) {\r\n this._localMatrix.copyFrom(matrix);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n else {\r\n this.markAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Bone.prototype._updateDifferenceMatrix = function (rootMatrix, updateChildren) {\r\n if (updateChildren === void 0) { updateChildren = true; }\r\n if (!rootMatrix) {\r\n rootMatrix = this._baseMatrix;\r\n }\r\n if (this._parent) {\r\n rootMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(rootMatrix);\r\n }\r\n this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);\r\n if (updateChildren) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateDifferenceMatrix();\r\n }\r\n }\r\n this._scalingDeterminant = (this._absoluteTransform.determinant() < 0 ? -1 : 1);\r\n };\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n */\r\n Bone.prototype.markAsDirty = function () {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n };\r\n /** @hidden */\r\n Bone.prototype._markAsDirtyAndCompose = function () {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n };\r\n Bone.prototype._markAsDirtyAndDecompose = function () {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n };\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.translate = function (vec, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var tvec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n }\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n tmat.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(vec, tmat, tvec);\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the postion of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setPosition = function (position, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n lm.setTranslationFromFloats(position.x, position.y, position.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var vec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n }\r\n tmat.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(position, tmat, vec);\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param mesh The mesh that this bone is attached to\r\n */\r\n Bone.prototype.setAbsolutePosition = function (position, mesh) {\r\n this.setPosition(position, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD, mesh);\r\n };\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n Bone.prototype.scale = function (x, y, z, scaleChildren) {\r\n if (scaleChildren === void 0) { scaleChildren = false; }\r\n var locMat = this.getLocalMatrix();\r\n // Apply new scaling on top of current local matrix\r\n var scaleMat = Bone._tmpMats[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n var cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n child._markAsDirtyAndDecompose();\r\n }\r\n this._markAsDirtyAndDecompose();\r\n if (scaleChildren) {\r\n for (var _b = 0, _c = this.children; _b < _c.length; _b++) {\r\n var child = _c[_b];\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n };\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n Bone.prototype.setScale = function (scale) {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n };\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n Bone.prototype.getScale = function () {\r\n this._decompose();\r\n return this._localScaling;\r\n };\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n Bone.prototype.getScaleToRef = function (result) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n };\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setYawPitchRoll = function (yaw, pitch, roll, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.rotate = function (axis, amount, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var rmat = Bone._tmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setAxisAngle = function (axis, angle, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].RotationAxisToRef(axis, angle, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationAxisToRef(axis, angle, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the euler rotation of the bone in local of world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotation = function (rotation, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);\r\n };\r\n /**\r\n * Set the quaternion rotation of the bone in local of world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n this._markAsDirtyAndCompose();\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromQuaternionToRef(quat, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation matrix of the bone in local of world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationMatrix = function (rotMat, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat2 = Bone._tmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n this._rotateWithMatrix(rotMat2, space, mesh);\r\n };\r\n Bone.prototype._rotateWithMatrix = function (rmat, space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var lmat = this.getLocalMatrix();\r\n var lx = lmat.m[12];\r\n var ly = lmat.m[13];\r\n var lz = lmat.m[14];\r\n var parent = this.getParent();\r\n var parentScale = Bone._tmpMats[3];\r\n var parentScaleInv = Bone._tmpMats[4];\r\n if (parent && space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD) {\r\n if (mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parent.getAbsoluteTransform().multiplyToRef(parentScale, parentScale);\r\n }\r\n else {\r\n parentScale.copyFrom(parent.getAbsoluteTransform());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD && mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n this.computeAbsoluteTransforms();\r\n this._markAsDirtyAndDecompose();\r\n };\r\n Bone.prototype._getNegativeRotationToRef = function (rotMatInv, mesh) {\r\n var scaleMatrix = Bone._tmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteTransform());\r\n if (mesh) {\r\n rotMatInv.multiplyToRef(mesh.getWorldMatrix(), rotMatInv);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ScalingToRef(mesh.scaling.x, mesh.scaling.y, mesh.scaling.z, scaleMatrix);\r\n }\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n return true;\r\n };\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The position of the bone\r\n */\r\n Bone.prototype.getPosition = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getPositionToRef(space, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 to copy the position to\r\n */\r\n Bone.prototype.getPositionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n var lm = this.getLocalMatrix();\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n };\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The absolute position of the bone\r\n */\r\n Bone.prototype.getAbsolutePosition = function (mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getPositionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n Bone.prototype.getAbsolutePositionToRef = function (mesh, result) {\r\n this.getPositionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].WORLD, mesh, result);\r\n };\r\n /**\r\n * Compute the absolute transforms of this bone and its children\r\n */\r\n Bone.prototype.computeAbsoluteTransforms = function () {\r\n this._compose();\r\n if (this._parent) {\r\n this._localMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(this._localMatrix);\r\n var poseMatrix = this._skeleton.getPoseMatrix();\r\n if (poseMatrix) {\r\n this._absoluteTransform.multiplyToRef(poseMatrix, this._absoluteTransform);\r\n }\r\n }\r\n var children = this.children;\r\n var len = children.length;\r\n for (var i = 0; i < len; i++) {\r\n children[i].computeAbsoluteTransforms();\r\n }\r\n };\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world direction\r\n */\r\n Bone.prototype.getDirection = function (localAxis, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getDirectionToRef(localAxis, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n Bone.prototype.getDirectionToRef = function (localAxis, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var mat = Bone._tmpMats[0];\r\n mat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalToRef(localAxis, mat, result);\r\n result.normalize();\r\n };\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The euler rotation\r\n */\r\n Bone.prototype.getRotation = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getRotationToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var quat = Bone._tmpQuat;\r\n this.getRotationQuaternionToRef(space, mesh, quat);\r\n quat.toEulerAnglesToRef(result);\r\n };\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The quaternion rotation\r\n */\r\n Bone.prototype.getRotationQuaternion = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n this.getRotationQuaternionToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationQuaternionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n };\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The rotation matrix\r\n */\r\n Bone.prototype.getRotationMatrix = function (space, mesh) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n this.getRotationMatrixToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL; }\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Space\"].LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world position\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getAbsolutePositionFromLocalToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The local position\r\n */\r\n Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.getLocalPositionFromAbsoluteToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n tmat.invert();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n Bone._tmpVecs = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(2, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n Bone._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n Bone._tmpMats = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(5, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity);\r\n return Bone;\r\n}(_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/boneIKController.ts\":\n/*!***********************************!*\\\n !*** ./Bones/boneIKController.ts ***!\n \\***********************************/\n/*! exports provided: BoneIKController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return BoneIKController; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n/**\r\n * Class used to apply inverse kinematics to bones\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#boneikcontroller\r\n */\r\nvar BoneIKController = /** @class */ (function () {\r\n /**\r\n * Creates a new BoneIKController\r\n * @param mesh defines the mesh to control\r\n * @param bone defines the bone to control\r\n * @param options defines options to set up the controller\r\n */\r\n function BoneIKController(mesh, bone, options) {\r\n /**\r\n * Gets or sets the target position\r\n */\r\n this.targetPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Gets or sets the pole target position\r\n */\r\n this.poleTargetPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Gets or sets the pole target local offset\r\n */\r\n this.poleTargetLocalOffset = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Gets or sets the pole angle\r\n */\r\n this.poleAngle = 0;\r\n /**\r\n * The amount to slerp (spherical linear interpolation) to the target. Set this to a value between 0 and 1 (a value of 1 disables slerp)\r\n */\r\n this.slerpAmount = 1;\r\n this._bone1Quat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Identity();\r\n this._bone1Mat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity();\r\n this._bone2Ang = Math.PI;\r\n this._maxAngle = Math.PI;\r\n this._rightHandedSystem = false;\r\n this._bendAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Right();\r\n this._slerping = false;\r\n this._adjustRoll = 0;\r\n this._bone2 = bone;\r\n this._bone1 = bone.getParent();\r\n if (!this._bone1) {\r\n return;\r\n }\r\n this.mesh = mesh;\r\n var bonePos = bone.getPosition();\r\n if (bone.getAbsoluteTransform().determinant() > 0) {\r\n this._rightHandedSystem = true;\r\n this._bendAxis.x = 0;\r\n this._bendAxis.y = 0;\r\n this._bendAxis.z = -1;\r\n if (bonePos.x > bonePos.y && bonePos.x > bonePos.z) {\r\n this._adjustRoll = Math.PI * .5;\r\n this._bendAxis.z = 1;\r\n }\r\n }\r\n if (this._bone1.length) {\r\n var boneScale1 = this._bone1.getScale();\r\n var boneScale2 = this._bone2.getScale();\r\n this._bone1Length = this._bone1.length * boneScale1.y * this.mesh.scaling.y;\r\n this._bone2Length = this._bone2.length * boneScale2.y * this.mesh.scaling.y;\r\n }\r\n else if (this._bone1.children[0]) {\r\n mesh.computeWorldMatrix(true);\r\n var pos1 = this._bone2.children[0].getAbsolutePosition(mesh);\r\n var pos2 = this._bone2.getAbsolutePosition(mesh);\r\n var pos3 = this._bone1.getAbsolutePosition(mesh);\r\n this._bone1Length = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(pos1, pos2);\r\n this._bone2Length = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(pos2, pos3);\r\n }\r\n this._bone1.getRotationMatrixToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].WORLD, mesh, this._bone1Mat);\r\n this.maxAngle = Math.PI;\r\n if (options) {\r\n if (options.targetMesh) {\r\n this.targetMesh = options.targetMesh;\r\n this.targetMesh.computeWorldMatrix(true);\r\n }\r\n if (options.poleTargetMesh) {\r\n this.poleTargetMesh = options.poleTargetMesh;\r\n this.poleTargetMesh.computeWorldMatrix(true);\r\n }\r\n else if (options.poleTargetBone) {\r\n this.poleTargetBone = options.poleTargetBone;\r\n }\r\n else if (this._bone1.getParent()) {\r\n this.poleTargetBone = this._bone1.getParent();\r\n }\r\n if (options.poleTargetLocalOffset) {\r\n this.poleTargetLocalOffset.copyFrom(options.poleTargetLocalOffset);\r\n }\r\n if (options.poleAngle) {\r\n this.poleAngle = options.poleAngle;\r\n }\r\n if (options.bendAxis) {\r\n this._bendAxis.copyFrom(options.bendAxis);\r\n }\r\n if (options.maxAngle) {\r\n this.maxAngle = options.maxAngle;\r\n }\r\n if (options.slerpAmount) {\r\n this.slerpAmount = options.slerpAmount;\r\n }\r\n }\r\n }\r\n Object.defineProperty(BoneIKController.prototype, \"maxAngle\", {\r\n /**\r\n * Gets or sets maximum allowed angle\r\n */\r\n get: function () {\r\n return this._maxAngle;\r\n },\r\n set: function (value) {\r\n this._setMaxAngle(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n BoneIKController.prototype._setMaxAngle = function (ang) {\r\n if (ang < 0) {\r\n ang = 0;\r\n }\r\n if (ang > Math.PI || ang == undefined) {\r\n ang = Math.PI;\r\n }\r\n this._maxAngle = ang;\r\n var a = this._bone1Length;\r\n var b = this._bone2Length;\r\n this._maxReach = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(ang));\r\n };\r\n /**\r\n * Force the controller to update the bones\r\n */\r\n BoneIKController.prototype.update = function () {\r\n var bone1 = this._bone1;\r\n if (!bone1) {\r\n return;\r\n }\r\n var target = this.targetPosition;\r\n var poleTarget = this.poleTargetPosition;\r\n var mat1 = BoneIKController._tmpMats[0];\r\n var mat2 = BoneIKController._tmpMats[1];\r\n if (this.targetMesh) {\r\n target.copyFrom(this.targetMesh.getAbsolutePosition());\r\n }\r\n if (this.poleTargetBone) {\r\n this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset, this.mesh, poleTarget);\r\n }\r\n else if (this.poleTargetMesh) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(this.poleTargetLocalOffset, this.poleTargetMesh.getWorldMatrix(), poleTarget);\r\n }\r\n var bonePos = BoneIKController._tmpVecs[0];\r\n var zaxis = BoneIKController._tmpVecs[1];\r\n var xaxis = BoneIKController._tmpVecs[2];\r\n var yaxis = BoneIKController._tmpVecs[3];\r\n var upAxis = BoneIKController._tmpVecs[4];\r\n var _tmpQuat = BoneIKController._tmpQuat;\r\n bone1.getAbsolutePositionToRef(this.mesh, bonePos);\r\n poleTarget.subtractToRef(bonePos, upAxis);\r\n if (upAxis.x == 0 && upAxis.y == 0 && upAxis.z == 0) {\r\n upAxis.y = 1;\r\n }\r\n else {\r\n upAxis.normalize();\r\n }\r\n target.subtractToRef(bonePos, yaxis);\r\n yaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(yaxis, upAxis, zaxis);\r\n zaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(yaxis, zaxis, xaxis);\r\n xaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].FromXYZAxesToRef(xaxis, yaxis, zaxis, mat1);\r\n var a = this._bone1Length;\r\n var b = this._bone2Length;\r\n var c = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(bonePos, target);\r\n if (this._maxReach > 0) {\r\n c = Math.min(this._maxReach, c);\r\n }\r\n var acosa = (b * b + c * c - a * a) / (2 * b * c);\r\n var acosb = (c * c + a * a - b * b) / (2 * c * a);\r\n if (acosa > 1) {\r\n acosa = 1;\r\n }\r\n if (acosb > 1) {\r\n acosb = 1;\r\n }\r\n if (acosa < -1) {\r\n acosa = -1;\r\n }\r\n if (acosb < -1) {\r\n acosb = -1;\r\n }\r\n var angA = Math.acos(acosa);\r\n var angB = Math.acos(acosb);\r\n var angC = -angA - angB;\r\n if (this._rightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationYawPitchRollToRef(0, 0, this._adjustRoll, mat2);\r\n mat2.multiplyToRef(mat1, mat1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(this._bendAxis, angB, mat2);\r\n mat2.multiplyToRef(mat1, mat1);\r\n }\r\n else {\r\n var _tmpVec = BoneIKController._tmpVecs[5];\r\n _tmpVec.copyFrom(this._bendAxis);\r\n _tmpVec.x *= -1;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(_tmpVec, -angB, mat2);\r\n mat2.multiplyToRef(mat1, mat1);\r\n }\r\n if (this.poleAngle) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(yaxis, this.poleAngle, mat2);\r\n mat1.multiplyToRef(mat2, mat1);\r\n }\r\n if (this._bone1) {\r\n if (this.slerpAmount < 1) {\r\n if (!this._slerping) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromRotationMatrixToRef(this._bone1Mat, this._bone1Quat);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromRotationMatrixToRef(mat1, _tmpQuat);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].SlerpToRef(this._bone1Quat, _tmpQuat, this.slerpAmount, this._bone1Quat);\r\n angC = this._bone2Ang * (1.0 - this.slerpAmount) + angC * this.slerpAmount;\r\n this._bone1.setRotationQuaternion(this._bone1Quat, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].WORLD, this.mesh);\r\n this._slerping = true;\r\n }\r\n else {\r\n this._bone1.setRotationMatrix(mat1, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].WORLD, this.mesh);\r\n this._bone1Mat.copyFrom(mat1);\r\n this._slerping = false;\r\n }\r\n }\r\n this._bone2.setAxisAngle(this._bendAxis, angC, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_1__[\"Space\"].LOCAL);\r\n this._bone2Ang = angC;\r\n };\r\n BoneIKController._tmpVecs = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero()];\r\n BoneIKController._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Identity();\r\n BoneIKController._tmpMats = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity()];\r\n return BoneIKController;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/boneLookController.ts\":\n/*!*************************************!*\\\n !*** ./Bones/boneLookController.ts ***!\n \\*************************************/\n/*! exports provided: BoneLookController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return BoneLookController; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to make a bone look toward a point in space\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons#bonelookcontroller\r\n */\r\nvar BoneLookController = /** @class */ (function () {\r\n /**\r\n * Create a BoneLookController\r\n * @param mesh the mesh that the bone belongs to\r\n * @param bone the bone that will be looking to the target\r\n * @param target the target Vector3 to look at\r\n * @param options optional settings:\r\n * * maxYaw: the maximum angle the bone will yaw to\r\n * * minYaw: the minimum angle the bone will yaw to\r\n * * maxPitch: the maximum angle the bone will pitch to\r\n * * minPitch: the minimum angle the bone will yaw to\r\n * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.\r\n * * upAxis: the up axis of the coordinate system\r\n * * upAxisSpace: the space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD.\r\n * * yawAxis: set yawAxis if the bone does not yaw on the y axis\r\n * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis\r\n * * adjustYaw: used to make an adjustment to the yaw of the bone\r\n * * adjustPitch: used to make an adjustment to the pitch of the bone\r\n * * adjustRoll: used to make an adjustment to the roll of the bone\r\n **/\r\n function BoneLookController(mesh, bone, target, options) {\r\n /**\r\n * The up axis of the coordinate system that is used when the bone is rotated\r\n */\r\n this.upAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Up();\r\n /**\r\n * The space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD\r\n */\r\n this.upAxisSpace = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL;\r\n /**\r\n * Used to make an adjustment to the yaw of the bone\r\n */\r\n this.adjustYaw = 0;\r\n /**\r\n * Used to make an adjustment to the pitch of the bone\r\n */\r\n this.adjustPitch = 0;\r\n /**\r\n * Used to make an adjustment to the roll of the bone\r\n */\r\n this.adjustRoll = 0;\r\n /**\r\n * The amount to slerp (spherical linear interpolation) to the target. Set this to a value between 0 and 1 (a value of 1 disables slerp)\r\n */\r\n this.slerpAmount = 1;\r\n this._boneQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n this._slerping = false;\r\n this._firstFrameSkipped = false;\r\n this._fowardAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Forward();\r\n this.mesh = mesh;\r\n this.bone = bone;\r\n this.target = target;\r\n if (options) {\r\n if (options.adjustYaw) {\r\n this.adjustYaw = options.adjustYaw;\r\n }\r\n if (options.adjustPitch) {\r\n this.adjustPitch = options.adjustPitch;\r\n }\r\n if (options.adjustRoll) {\r\n this.adjustRoll = options.adjustRoll;\r\n }\r\n if (options.maxYaw != null) {\r\n this.maxYaw = options.maxYaw;\r\n }\r\n else {\r\n this.maxYaw = Math.PI;\r\n }\r\n if (options.minYaw != null) {\r\n this.minYaw = options.minYaw;\r\n }\r\n else {\r\n this.minYaw = -Math.PI;\r\n }\r\n if (options.maxPitch != null) {\r\n this.maxPitch = options.maxPitch;\r\n }\r\n else {\r\n this.maxPitch = Math.PI;\r\n }\r\n if (options.minPitch != null) {\r\n this.minPitch = options.minPitch;\r\n }\r\n else {\r\n this.minPitch = -Math.PI;\r\n }\r\n if (options.slerpAmount != null) {\r\n this.slerpAmount = options.slerpAmount;\r\n }\r\n if (options.upAxis != null) {\r\n this.upAxis = options.upAxis;\r\n }\r\n if (options.upAxisSpace != null) {\r\n this.upAxisSpace = options.upAxisSpace;\r\n }\r\n if (options.yawAxis != null || options.pitchAxis != null) {\r\n var newYawAxis = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Axis\"].Y;\r\n var newPitchAxis = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Axis\"].X;\r\n if (options.yawAxis != null) {\r\n newYawAxis = options.yawAxis.clone();\r\n newYawAxis.normalize();\r\n }\r\n if (options.pitchAxis != null) {\r\n newPitchAxis = options.pitchAxis.clone();\r\n newPitchAxis.normalize();\r\n }\r\n var newRollAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(newPitchAxis, newYawAxis);\r\n this._transformYawPitch = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromXYZAxesToRef(newPitchAxis, newYawAxis, newRollAxis, this._transformYawPitch);\r\n this._transformYawPitchInv = this._transformYawPitch.clone();\r\n this._transformYawPitch.invert();\r\n }\r\n }\r\n if (!bone.getParent() && this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].BONE) {\r\n this.upAxisSpace = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL;\r\n }\r\n }\r\n Object.defineProperty(BoneLookController.prototype, \"minYaw\", {\r\n /**\r\n * Gets or sets the minimum yaw angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._minYaw;\r\n },\r\n set: function (value) {\r\n this._minYaw = value;\r\n this._minYawSin = Math.sin(value);\r\n this._minYawCos = Math.cos(value);\r\n if (this._maxYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * .5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoneLookController.prototype, \"maxYaw\", {\r\n /**\r\n * Gets or sets the maximum yaw angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._maxYaw;\r\n },\r\n set: function (value) {\r\n this._maxYaw = value;\r\n this._maxYawSin = Math.sin(value);\r\n this._maxYawCos = Math.cos(value);\r\n if (this._minYaw != null) {\r\n this._midYawConstraint = this._getAngleDiff(this._minYaw, this._maxYaw) * .5 + this._minYaw;\r\n this._yawRange = this._maxYaw - this._minYaw;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoneLookController.prototype, \"minPitch\", {\r\n /**\r\n * Gets or sets the minimum pitch angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._minPitch;\r\n },\r\n set: function (value) {\r\n this._minPitch = value;\r\n this._minPitchTan = Math.tan(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoneLookController.prototype, \"maxPitch\", {\r\n /**\r\n * Gets or sets the maximum pitch angle that the bone can look to\r\n */\r\n get: function () {\r\n return this._maxPitch;\r\n },\r\n set: function (value) {\r\n this._maxPitch = value;\r\n this._maxPitchTan = Math.tan(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Update the bone to look at the target. This should be called before the scene is rendered (use scene.registerBeforeRender())\r\n */\r\n BoneLookController.prototype.update = function () {\r\n //skip the first frame when slerping so that the mesh rotation is correct\r\n if (this.slerpAmount < 1 && !this._firstFrameSkipped) {\r\n this._firstFrameSkipped = true;\r\n return;\r\n }\r\n var bone = this.bone;\r\n var bonePos = BoneLookController._tmpVecs[0];\r\n bone.getAbsolutePositionToRef(this.mesh, bonePos);\r\n var target = this.target;\r\n var _tmpMat1 = BoneLookController._tmpMats[0];\r\n var _tmpMat2 = BoneLookController._tmpMats[1];\r\n var mesh = this.mesh;\r\n var parentBone = bone.getParent();\r\n var upAxis = BoneLookController._tmpVecs[1];\r\n upAxis.copyFrom(this.upAxis);\r\n if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].BONE && parentBone) {\r\n if (this._transformYawPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(upAxis, this._transformYawPitchInv, upAxis);\r\n }\r\n parentBone.getDirectionToRef(upAxis, this.mesh, upAxis);\r\n }\r\n else if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL) {\r\n mesh.getDirectionToRef(upAxis, upAxis);\r\n if (mesh.scaling.x != 1 || mesh.scaling.y != 1 || mesh.scaling.z != 1) {\r\n upAxis.normalize();\r\n }\r\n }\r\n var checkYaw = false;\r\n var checkPitch = false;\r\n if (this._maxYaw != Math.PI || this._minYaw != -Math.PI) {\r\n checkYaw = true;\r\n }\r\n if (this._maxPitch != Math.PI || this._minPitch != -Math.PI) {\r\n checkPitch = true;\r\n }\r\n if (checkYaw || checkPitch) {\r\n var spaceMat = BoneLookController._tmpMats[2];\r\n var spaceMatInv = BoneLookController._tmpMats[3];\r\n if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].BONE && upAxis.y == 1 && parentBone) {\r\n parentBone.getRotationMatrixToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh, spaceMat);\r\n }\r\n else if (this.upAxisSpace == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].LOCAL && upAxis.y == 1 && !parentBone) {\r\n spaceMat.copyFrom(mesh.getWorldMatrix());\r\n }\r\n else {\r\n var forwardAxis = BoneLookController._tmpVecs[2];\r\n forwardAxis.copyFrom(this._fowardAxis);\r\n if (this._transformYawPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(forwardAxis, this._transformYawPitchInv, forwardAxis);\r\n }\r\n if (parentBone) {\r\n parentBone.getDirectionToRef(forwardAxis, this.mesh, forwardAxis);\r\n }\r\n else {\r\n mesh.getDirectionToRef(forwardAxis, forwardAxis);\r\n }\r\n var rightAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(upAxis, forwardAxis);\r\n rightAxis.normalize();\r\n var forwardAxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(rightAxis, upAxis);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromXYZAxesToRef(rightAxis, upAxis, forwardAxis, spaceMat);\r\n }\r\n spaceMat.invertToRef(spaceMatInv);\r\n var xzlen = null;\r\n if (checkPitch) {\r\n var localTarget = BoneLookController._tmpVecs[3];\r\n target.subtractToRef(bonePos, localTarget);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n var pitch = Math.atan2(localTarget.y, xzlen);\r\n var newPitch = pitch;\r\n if (pitch > this._maxPitch) {\r\n localTarget.y = this._maxPitchTan * xzlen;\r\n newPitch = this._maxPitch;\r\n }\r\n else if (pitch < this._minPitch) {\r\n localTarget.y = this._minPitchTan * xzlen;\r\n newPitch = this._minPitch;\r\n }\r\n if (pitch != newPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n if (checkYaw) {\r\n var localTarget = BoneLookController._tmpVecs[4];\r\n target.subtractToRef(bonePos, localTarget);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMatInv, localTarget);\r\n var yaw = Math.atan2(localTarget.x, localTarget.z);\r\n var newYaw = yaw;\r\n if (yaw > this._maxYaw || yaw < this._minYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n if (this._yawRange > Math.PI) {\r\n if (this._isAngleBetween(yaw, this._maxYaw, this._midYawConstraint)) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n newYaw = this._maxYaw;\r\n }\r\n else if (this._isAngleBetween(yaw, this._midYawConstraint, this._minYaw)) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n newYaw = this._minYaw;\r\n }\r\n }\r\n else {\r\n if (yaw > this._maxYaw) {\r\n localTarget.z = this._maxYawCos * xzlen;\r\n localTarget.x = this._maxYawSin * xzlen;\r\n newYaw = this._maxYaw;\r\n }\r\n else if (yaw < this._minYaw) {\r\n localTarget.z = this._minYawCos * xzlen;\r\n localTarget.x = this._minYawSin * xzlen;\r\n newYaw = this._minYaw;\r\n }\r\n }\r\n }\r\n if (this._slerping && this._yawRange > Math.PI) {\r\n //are we going to be crossing into the min/max region?\r\n var boneFwd = BoneLookController._tmpVecs[8];\r\n boneFwd.copyFrom(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Axis\"].Z);\r\n if (this._transformYawPitch) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(boneFwd, this._transformYawPitchInv, boneFwd);\r\n }\r\n var boneRotMat = BoneLookController._tmpMats[4];\r\n this._boneQuat.toRotationMatrix(boneRotMat);\r\n this.mesh.getWorldMatrix().multiplyToRef(boneRotMat, boneRotMat);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(boneFwd, boneRotMat, boneFwd);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(boneFwd, spaceMatInv, boneFwd);\r\n var boneYaw = Math.atan2(boneFwd.x, boneFwd.z);\r\n var angBtwTar = this._getAngleBetween(boneYaw, yaw);\r\n var angBtwMidYaw = this._getAngleBetween(boneYaw, this._midYawConstraint);\r\n if (angBtwTar > angBtwMidYaw) {\r\n if (xzlen == null) {\r\n xzlen = Math.sqrt(localTarget.x * localTarget.x + localTarget.z * localTarget.z);\r\n }\r\n var angBtwMax = this._getAngleBetween(boneYaw, this._maxYaw);\r\n var angBtwMin = this._getAngleBetween(boneYaw, this._minYaw);\r\n if (angBtwMin < angBtwMax) {\r\n newYaw = boneYaw + Math.PI * .75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n }\r\n else {\r\n newYaw = boneYaw - Math.PI * .75;\r\n localTarget.z = Math.cos(newYaw) * xzlen;\r\n localTarget.x = Math.sin(newYaw) * xzlen;\r\n }\r\n }\r\n }\r\n if (yaw != newYaw) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(localTarget, spaceMat, localTarget);\r\n localTarget.addInPlace(bonePos);\r\n target = localTarget;\r\n }\r\n }\r\n }\r\n var zaxis = BoneLookController._tmpVecs[5];\r\n var xaxis = BoneLookController._tmpVecs[6];\r\n var yaxis = BoneLookController._tmpVecs[7];\r\n var _tmpQuat = BoneLookController._tmpQuat;\r\n target.subtractToRef(bonePos, zaxis);\r\n zaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(upAxis, zaxis, xaxis);\r\n xaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(zaxis, xaxis, yaxis);\r\n yaxis.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromXYZAxesToRef(xaxis, yaxis, zaxis, _tmpMat1);\r\n if (xaxis.x === 0 && xaxis.y === 0 && xaxis.z === 0) {\r\n return;\r\n }\r\n if (yaxis.x === 0 && yaxis.y === 0 && yaxis.z === 0) {\r\n return;\r\n }\r\n if (zaxis.x === 0 && zaxis.y === 0 && zaxis.z === 0) {\r\n return;\r\n }\r\n if (this.adjustYaw || this.adjustPitch || this.adjustRoll) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, _tmpMat2);\r\n _tmpMat2.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n if (this.slerpAmount < 1) {\r\n if (!this._slerping) {\r\n this.bone.getRotationQuaternionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh, this._boneQuat);\r\n }\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromRotationMatrixToRef(_tmpMat1, _tmpQuat);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].SlerpToRef(this._boneQuat, _tmpQuat, this.slerpAmount, this._boneQuat);\r\n this.bone.setRotationQuaternion(this._boneQuat, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh);\r\n this._slerping = true;\r\n }\r\n else {\r\n if (this._transformYawPitch) {\r\n this._transformYawPitch.multiplyToRef(_tmpMat1, _tmpMat1);\r\n }\r\n this.bone.setRotationMatrix(_tmpMat1, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_2__[\"Space\"].WORLD, this.mesh);\r\n this._slerping = false;\r\n }\r\n };\r\n BoneLookController.prototype._getAngleDiff = function (ang1, ang2) {\r\n var angDiff = ang2 - ang1;\r\n angDiff %= Math.PI * 2;\r\n if (angDiff > Math.PI) {\r\n angDiff -= Math.PI * 2;\r\n }\r\n else if (angDiff < -Math.PI) {\r\n angDiff += Math.PI * 2;\r\n }\r\n return angDiff;\r\n };\r\n BoneLookController.prototype._getAngleBetween = function (ang1, ang2) {\r\n ang1 %= (2 * Math.PI);\r\n ang1 = (ang1 < 0) ? ang1 + (2 * Math.PI) : ang1;\r\n ang2 %= (2 * Math.PI);\r\n ang2 = (ang2 < 0) ? ang2 + (2 * Math.PI) : ang2;\r\n var ab = 0;\r\n if (ang1 < ang2) {\r\n ab = ang2 - ang1;\r\n }\r\n else {\r\n ab = ang1 - ang2;\r\n }\r\n if (ab > Math.PI) {\r\n ab = Math.PI * 2 - ab;\r\n }\r\n return ab;\r\n };\r\n BoneLookController.prototype._isAngleBetween = function (ang, ang1, ang2) {\r\n ang %= (2 * Math.PI);\r\n ang = (ang < 0) ? ang + (2 * Math.PI) : ang;\r\n ang1 %= (2 * Math.PI);\r\n ang1 = (ang1 < 0) ? ang1 + (2 * Math.PI) : ang1;\r\n ang2 %= (2 * Math.PI);\r\n ang2 = (ang2 < 0) ? ang2 + (2 * Math.PI) : ang2;\r\n if (ang1 < ang2) {\r\n if (ang > ang1 && ang < ang2) {\r\n return true;\r\n }\r\n }\r\n else {\r\n if (ang > ang2 && ang < ang1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n BoneLookController._tmpVecs = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(10, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n BoneLookController._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Identity();\r\n BoneLookController._tmpMats = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(5, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity);\r\n return BoneLookController;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/index.ts\":\n/*!************************!*\\\n !*** ./Bones/index.ts ***!\n \\************************/\n/*! exports provided: Bone, BoneIKController, BoneLookController, Skeleton */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bone */ \"./Bones/bone.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return _bone__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"]; });\n\n/* harmony import */ var _boneIKController__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boneIKController */ \"./Bones/boneIKController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return _boneIKController__WEBPACK_IMPORTED_MODULE_1__[\"BoneIKController\"]; });\n\n/* harmony import */ var _boneLookController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boneLookController */ \"./Bones/boneLookController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return _boneLookController__WEBPACK_IMPORTED_MODULE_2__[\"BoneLookController\"]; });\n\n/* harmony import */ var _skeleton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./skeleton */ \"./Bones/skeleton.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return _skeleton__WEBPACK_IMPORTED_MODULE_3__[\"Skeleton\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Bones/skeleton.ts\":\n/*!***************************!*\\\n !*** ./Bones/skeleton.ts ***!\n \\***************************/\n/*! exports provided: Skeleton */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return Skeleton; });\n/* harmony import */ var _bone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bone */ \"./Bones/bone.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Animations/animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Animations_animationRange__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Animations/animationRange */ \"./Animations/animationRange.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to handle skinning animations\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Skeleton = /** @class */ (function () {\r\n /**\r\n * Creates a new skeleton\r\n * @param name defines the skeleton name\r\n * @param id defines the skeleton Id\r\n * @param scene defines the hosting scene\r\n */\r\n function Skeleton(\r\n /** defines the skeleton name */\r\n name, \r\n /** defines the skeleton Id */\r\n id, scene) {\r\n this.name = name;\r\n this.id = id;\r\n /**\r\n * Defines the list of child bones\r\n */\r\n this.bones = new Array();\r\n /**\r\n * Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)\r\n */\r\n this.needInitialSkinMatrix = false;\r\n /**\r\n * Defines a mesh that override the matrix used to get the world matrix (null by default).\r\n */\r\n this.overrideMesh = null;\r\n this._isDirty = true;\r\n this._meshesWithPoseMatrix = new Array();\r\n this._identity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n this._ranges = {};\r\n this._lastAbsoluteTransformsUpdateId = -1;\r\n this._canUseTextureForBones = false;\r\n this._uniqueId = 0;\r\n /** @hidden */\r\n this._numBonesWithLinkedTransformNode = 0;\r\n /** @hidden */\r\n this._hasWaitingData = null;\r\n /**\r\n * Specifies if the skeleton should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n this._useTextureToStoreBoneMatrices = true;\r\n this._animationPropertiesOverride = null;\r\n // Events\r\n /**\r\n * An observable triggered before computing the skeleton's matrices\r\n */\r\n this.onBeforeComputeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this.bones = [];\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n this._uniqueId = this._scene.getUniqueId();\r\n this._scene.addSkeleton(this);\r\n //make sure it will recalculate the matrix next time prepare is called.\r\n this._isDirty = true;\r\n var engineCaps = this._scene.getEngine().getCaps();\r\n this._canUseTextureForBones = engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0;\r\n }\r\n Object.defineProperty(Skeleton.prototype, \"useTextureToStoreBoneMatrices\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true).\r\n * Please note that this option is not available if the hardware does not support it\r\n */\r\n get: function () {\r\n return this._useTextureToStoreBoneMatrices;\r\n },\r\n set: function (value) {\r\n this._useTextureToStoreBoneMatrices = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"isUsingTextureForMatrices\", {\r\n /**\r\n * Gets a boolean indicating that the skeleton effectively stores matrices into a texture\r\n */\r\n get: function () {\r\n return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this skeleton\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Skeleton.prototype.getClassName = function () {\r\n return \"Skeleton\";\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Skeleton.prototype.getChildren = function () {\r\n return this.bones.filter(function (b) { return !b.getParent(); });\r\n };\r\n // Members\r\n /**\r\n * Gets the list of transform matrices to send to shaders (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a Float32Array containing matrices data\r\n */\r\n Skeleton.prototype.getTransformMatrices = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {\r\n return mesh._bonesTransformMatrices;\r\n }\r\n if (!this._transformMatrices) {\r\n this.prepare();\r\n }\r\n return this._transformMatrices;\r\n };\r\n /**\r\n * Gets the list of transform matrices to send to shaders inside a texture (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a raw texture containing the data\r\n */\r\n Skeleton.prototype.getTransformMatrixTexture = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._transformMatrixTexture) {\r\n return mesh._transformMatrixTexture;\r\n }\r\n return this._transformMatrixTexture;\r\n };\r\n /**\r\n * Gets the current hosting scene\r\n * @returns a scene object\r\n */\r\n Skeleton.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n // Methods\r\n /**\r\n * Gets a string representing the current skeleton data\r\n * @param fullDetails defines a boolean indicating if we want a verbose version\r\n * @returns a string representing the current skeleton data\r\n */\r\n Skeleton.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", nBones: \" + this.bones.length;\r\n ret += \", nAnimationRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name_1 in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name_1;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Get bone's index searching by name\r\n * @param name defines bone's name to search for\r\n * @return the indice of the bone. Returns -1 if not found\r\n */\r\n Skeleton.prototype.getBoneIndexByName = function (name) {\r\n for (var boneIndex = 0, cache = this.bones.length; boneIndex < cache; boneIndex++) {\r\n if (this.bones[boneIndex].name === name) {\r\n return boneIndex;\r\n }\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Creater a new animation range\r\n * @param name defines the name of the range\r\n * @param from defines the start key\r\n * @param to defines the end key\r\n */\r\n Skeleton.prototype.createAnimationRange = function (name, from, to) {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new _Animations_animationRange__WEBPACK_IMPORTED_MODULE_5__[\"AnimationRange\"](name, from, to);\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range\r\n * @param deleteFrames defines if frames must be removed as well\r\n */\r\n Skeleton.prototype.deleteAnimationRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets a specific animation range\r\n * @param name defines the name of the range to look for\r\n * @returns the requested animation range or null if not found\r\n */\r\n Skeleton.prototype.getAnimationRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the list of all animation ranges defined on this skeleton\r\n * @returns an array\r\n */\r\n Skeleton.prototype.getAnimationRanges = function () {\r\n var animationRanges = [];\r\n var name;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n };\r\n /**\r\n * Copy animation range from a source skeleton.\r\n * This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences\r\n * @param source defines the source skeleton\r\n * @param name defines the name of the range to copy\r\n * @param rescaleAsRequired defines if rescaling must be applied if required\r\n * @returns true if operation was successful\r\n */\r\n Skeleton.prototype.copyAnimationRange = function (source, name, rescaleAsRequired) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (this._ranges[name] || !source.getAnimationRange(name)) {\r\n return false;\r\n }\r\n var ret = true;\r\n var frameOffset = this._getHighestAnimationFrame() + 1;\r\n // make a dictionary of source skeleton's bones, so exact same order or doublely nested loop is not required\r\n var boneDict = {};\r\n var sourceBones = source.bones;\r\n var nBones;\r\n var i;\r\n for (i = 0, nBones = sourceBones.length; i < nBones; i++) {\r\n boneDict[sourceBones[i].name] = sourceBones[i];\r\n }\r\n if (this.bones.length !== sourceBones.length) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Warn(\"copyAnimationRange: this rig has \" + this.bones.length + \" bones, while source as \" + sourceBones.length);\r\n ret = false;\r\n }\r\n var skelDimensionsRatio = (rescaleAsRequired && this.dimensionsAtRest && source.dimensionsAtRest) ? this.dimensionsAtRest.divide(source.dimensionsAtRest) : null;\r\n for (i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n var boneName = this.bones[i].name;\r\n var sourceBone = boneDict[boneName];\r\n if (sourceBone) {\r\n ret = ret && this.bones[i].copyAnimationRange(sourceBone, name, frameOffset, rescaleAsRequired, skelDimensionsRatio);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Warn(\"copyAnimationRange: not same rig, missing source bone \" + boneName);\r\n ret = false;\r\n }\r\n }\r\n // do not call createAnimationRange(), since it also is done to bones, which was already done\r\n var range = source.getAnimationRange(name);\r\n if (range) {\r\n this._ranges[name] = new _Animations_animationRange__WEBPACK_IMPORTED_MODULE_5__[\"AnimationRange\"](name, range.from + frameOffset, range.to + frameOffset);\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Forces the skeleton to go to rest pose\r\n */\r\n Skeleton.prototype.returnToRest = function () {\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this.bones[index].returnToRest();\r\n }\r\n };\r\n Skeleton.prototype._getHighestAnimationFrame = function () {\r\n var ret = 0;\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n var highest = this.bones[i].animations[0].getHighestFrame();\r\n if (ret < highest) {\r\n ret = highest;\r\n }\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Begin a specific animation range\r\n * @param name defines the name of the range to start\r\n * @param loop defines if looping must be turned on (false by default)\r\n * @param speedRatio defines the speed ratio to apply (1 by default)\r\n * @param onAnimationEnd defines a callback which will be called when animation will end\r\n * @returns a new animatable\r\n */\r\n Skeleton.prototype.beginAnimation = function (name, loop, speedRatio, onAnimationEnd) {\r\n var range = this.getAnimationRange(name);\r\n if (!range) {\r\n return null;\r\n }\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._markAsDirty = function () {\r\n this._isDirty = true;\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._registerMeshWithPoseMatrix = function (mesh) {\r\n this._meshesWithPoseMatrix.push(mesh);\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._unregisterMeshWithPoseMatrix = function (mesh) {\r\n var index = this._meshesWithPoseMatrix.indexOf(mesh);\r\n if (index > -1) {\r\n this._meshesWithPoseMatrix.splice(index, 1);\r\n }\r\n };\r\n Skeleton.prototype._computeTransformMatrices = function (targetMatrix, initialSkinMatrix) {\r\n this.onBeforeComputeObservable.notifyObservers(this);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n bone._childUpdateId++;\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n bone.getLocalMatrix().multiplyToRef(parentBone.getWorldMatrix(), bone.getWorldMatrix());\r\n }\r\n else {\r\n if (initialSkinMatrix) {\r\n bone.getLocalMatrix().multiplyToRef(initialSkinMatrix, bone.getWorldMatrix());\r\n }\r\n else {\r\n bone.getWorldMatrix().copyFrom(bone.getLocalMatrix());\r\n }\r\n }\r\n if (bone._index !== -1) {\r\n var mappedIndex = bone._index === null ? index : bone._index;\r\n bone.getInvertedAbsoluteTransform().multiplyToArray(bone.getWorldMatrix(), targetMatrix, mappedIndex * 16);\r\n }\r\n }\r\n this._identity.copyToArray(targetMatrix, this.bones.length * 16);\r\n };\r\n /**\r\n * Build all resources required to render a skeleton\r\n */\r\n Skeleton.prototype.prepare = function () {\r\n // Update the local matrix of bones with linked transform nodes.\r\n if (this._numBonesWithLinkedTransformNode > 0) {\r\n for (var _i = 0, _a = this.bones; _i < _a.length; _i++) {\r\n var bone_1 = _a[_i];\r\n if (bone_1._linkedTransformNode) {\r\n // Computing the world matrix also computes the local matrix.\r\n bone_1._linkedTransformNode.computeWorldMatrix();\r\n bone_1._matrix = bone_1._linkedTransformNode._localMatrix;\r\n bone_1.markAsDirty();\r\n }\r\n }\r\n }\r\n if (!this._isDirty) {\r\n return;\r\n }\r\n if (this.needInitialSkinMatrix) {\r\n for (var index = 0; index < this._meshesWithPoseMatrix.length; index++) {\r\n var mesh = this._meshesWithPoseMatrix[index];\r\n var poseMatrix = mesh.getPoseMatrix();\r\n if (!mesh._bonesTransformMatrices || mesh._bonesTransformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n mesh._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n }\r\n if (this._synchronizedWithMesh !== mesh) {\r\n this._synchronizedWithMesh = mesh;\r\n // Prepare bones\r\n for (var boneIndex = 0; boneIndex < this.bones.length; boneIndex++) {\r\n var bone = this.bones[boneIndex];\r\n if (!bone.getParent()) {\r\n var matrix = bone.getBaseMatrix();\r\n matrix.multiplyToRef(poseMatrix, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[1]);\r\n bone._updateDifferenceMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Matrix[1]);\r\n }\r\n }\r\n if (this.isUsingTextureForMatrices) {\r\n var textureWidth = (this.bones.length + 1) * 4;\r\n if (!mesh._transformMatrixTexture || mesh._transformMatrixTexture.getSize().width !== textureWidth) {\r\n if (mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.dispose();\r\n }\r\n mesh._transformMatrixTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_3__[\"RawTexture\"].CreateRGBATexture(mesh._bonesTransformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n }\r\n }\r\n }\r\n this._computeTransformMatrices(mesh._bonesTransformMatrices, poseMatrix);\r\n if (this.isUsingTextureForMatrices && mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.update(mesh._bonesTransformMatrices);\r\n }\r\n }\r\n }\r\n else {\r\n if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n if (this.isUsingTextureForMatrices) {\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n }\r\n this._transformMatrixTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_3__[\"RawTexture\"].CreateRGBATexture(this._transformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n }\r\n }\r\n this._computeTransformMatrices(this._transformMatrices, null);\r\n if (this.isUsingTextureForMatrices && this._transformMatrixTexture) {\r\n this._transformMatrixTexture.update(this._transformMatrices);\r\n }\r\n }\r\n this._isDirty = false;\r\n this._scene._activeBones.addCount(this.bones.length, false);\r\n };\r\n /**\r\n * Gets the list of animatables currently running for this skeleton\r\n * @returns an array of animatables\r\n */\r\n Skeleton.prototype.getAnimatables = function () {\r\n if (!this._animatables || this._animatables.length !== this.bones.length) {\r\n this._animatables = [];\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._animatables.push(this.bones[index]);\r\n }\r\n }\r\n return this._animatables;\r\n };\r\n /**\r\n * Clone the current skeleton\r\n * @param name defines the name of the new skeleton\r\n * @param id defines the id of the new skeleton\r\n * @returns the new skeleton\r\n */\r\n Skeleton.prototype.clone = function (name, id) {\r\n var result = new Skeleton(name, id || name, this._scene);\r\n result.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var source = this.bones[index];\r\n var parentBone = null;\r\n var parent_1 = source.getParent();\r\n if (parent_1) {\r\n var parentIndex = this.bones.indexOf(parent_1);\r\n parentBone = result.bones[parentIndex];\r\n }\r\n var bone = new _bone__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"](source.name, result, parentBone, source.getBaseMatrix().clone(), source.getRestPose().clone());\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_9__[\"DeepCopier\"].DeepCopy(source.animations, bone.animations);\r\n }\r\n if (this._ranges) {\r\n result._ranges = {};\r\n for (var rangeName in this._ranges) {\r\n var range = this._ranges[rangeName];\r\n if (range) {\r\n result._ranges[rangeName] = range.clone();\r\n }\r\n }\r\n }\r\n this._isDirty = true;\r\n return result;\r\n };\r\n /**\r\n * Enable animation blending for this skeleton\r\n * @param blendingSpeed defines the blending speed to apply\r\n * @see http://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Skeleton.prototype.enableBlending = function (blendingSpeed) {\r\n if (blendingSpeed === void 0) { blendingSpeed = 0.01; }\r\n this.bones.forEach(function (bone) {\r\n bone.animations.forEach(function (animation) {\r\n animation.enableBlending = true;\r\n animation.blendingSpeed = blendingSpeed;\r\n });\r\n });\r\n };\r\n /**\r\n * Releases all resources associated with the current skeleton\r\n */\r\n Skeleton.prototype.dispose = function () {\r\n this._meshesWithPoseMatrix = [];\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeSkeleton(this);\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n };\r\n /**\r\n * Serialize the skeleton in a JSON object\r\n * @returns a JSON object\r\n */\r\n Skeleton.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (this.dimensionsAtRest) {\r\n serializationObject.dimensionsAtRest = this.dimensionsAtRest.asArray();\r\n }\r\n serializationObject.bones = [];\r\n serializationObject.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n var parent_2 = bone.getParent();\r\n var serializedBone = {\r\n parentBoneIndex: parent_2 ? this.bones.indexOf(parent_2) : -1,\r\n name: bone.name,\r\n matrix: bone.getBaseMatrix().toArray(),\r\n rest: bone.getRestPose().toArray()\r\n };\r\n serializationObject.bones.push(serializedBone);\r\n if (bone.length) {\r\n serializedBone.length = bone.length;\r\n }\r\n if (bone.metadata) {\r\n serializedBone.metadata = bone.metadata;\r\n }\r\n if (bone.animations && bone.animations.length > 0) {\r\n serializedBone.animation = bone.animations[0].serialize();\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new skeleton from serialized data\r\n * @param parsedSkeleton defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns a new skeleton\r\n */\r\n Skeleton.Parse = function (parsedSkeleton, scene) {\r\n var skeleton = new Skeleton(parsedSkeleton.name, parsedSkeleton.id, scene);\r\n if (parsedSkeleton.dimensionsAtRest) {\r\n skeleton.dimensionsAtRest = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedSkeleton.dimensionsAtRest);\r\n }\r\n skeleton.needInitialSkinMatrix = parsedSkeleton.needInitialSkinMatrix;\r\n var index;\r\n for (index = 0; index < parsedSkeleton.bones.length; index++) {\r\n var parsedBone = parsedSkeleton.bones[index];\r\n var parentBone = null;\r\n if (parsedBone.parentBoneIndex > -1) {\r\n parentBone = skeleton.bones[parsedBone.parentBoneIndex];\r\n }\r\n var rest = parsedBone.rest ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromArray(parsedBone.rest) : null;\r\n var bone = new _bone__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"](parsedBone.name, skeleton, parentBone, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromArray(parsedBone.matrix), rest);\r\n if (parsedBone.id !== undefined && parsedBone.id !== null) {\r\n bone.id = parsedBone.id;\r\n }\r\n if (parsedBone.length) {\r\n bone.length = parsedBone.length;\r\n }\r\n if (parsedBone.metadata) {\r\n bone.metadata = parsedBone.metadata;\r\n }\r\n if (parsedBone.animation) {\r\n bone.animations.push(_Animations_animation__WEBPACK_IMPORTED_MODULE_4__[\"Animation\"].Parse(parsedBone.animation));\r\n }\r\n if (parsedBone.linkedTransformNodeId !== undefined && parsedBone.linkedTransformNodeId !== null) {\r\n skeleton._hasWaitingData = true;\r\n bone._waitingTransformNodeId = parsedBone.linkedTransformNodeId;\r\n }\r\n }\r\n // placed after bones, so createAnimationRange can cascade down\r\n if (parsedSkeleton.ranges) {\r\n for (index = 0; index < parsedSkeleton.ranges.length; index++) {\r\n var data = parsedSkeleton.ranges[index];\r\n skeleton.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return skeleton;\r\n };\r\n /**\r\n * Compute all node absolute transforms\r\n * @param forceUpdate defines if computation must be done even if cache is up to date\r\n */\r\n Skeleton.prototype.computeAbsoluteTransforms = function (forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var renderId = this._scene.getRenderId();\r\n if (this._lastAbsoluteTransformsUpdateId != renderId || forceUpdate) {\r\n this.bones[0].computeAbsoluteTransforms();\r\n this._lastAbsoluteTransformsUpdateId = renderId;\r\n }\r\n };\r\n /**\r\n * Gets the root pose matrix\r\n * @returns a matrix\r\n */\r\n Skeleton.prototype.getPoseMatrix = function () {\r\n var poseMatrix = null;\r\n if (this._meshesWithPoseMatrix.length > 0) {\r\n poseMatrix = this._meshesWithPoseMatrix[0].getPoseMatrix();\r\n }\r\n return poseMatrix;\r\n };\r\n /**\r\n * Sorts bones per internal index\r\n */\r\n Skeleton.prototype.sortBones = function () {\r\n var bones = new Array();\r\n var visited = new Array(this.bones.length);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._sortBones(index, bones, visited);\r\n }\r\n this.bones = bones;\r\n };\r\n Skeleton.prototype._sortBones = function (index, bones, visited) {\r\n if (visited[index]) {\r\n return;\r\n }\r\n visited[index] = true;\r\n var bone = this.bones[index];\r\n if (bone._index === undefined) {\r\n bone._index = index;\r\n }\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n this._sortBones(this.bones.indexOf(parentBone), bones, visited);\r\n }\r\n bones.push(bone);\r\n };\r\n return Skeleton;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/BaseCameraPointersInput.ts\":\n/*!***************************************************!*\\\n !*** ./Cameras/Inputs/BaseCameraPointersInput.ts ***!\n \\***************************************************/\n/*! exports provided: BaseCameraPointersInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseCameraPointersInput\", function() { return BaseCameraPointersInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Base class for Camera Pointer Inputs.\r\n * See FollowCameraPointersInput in src/Cameras/Inputs/followCameraPointersInput.ts\r\n * for example usage.\r\n */\r\nvar BaseCameraPointersInput = /** @class */ (function () {\r\n function BaseCameraPointersInput() {\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n BaseCameraPointersInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var engine = this.camera.getEngine();\r\n var previousPinchSquaredDistance = 0;\r\n var previousMultiTouchPanPosition = null;\r\n this.pointA = null;\r\n this.pointB = null;\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n this._pointerInput = function (p, s) {\r\n var evt = p.event;\r\n var isTouch = evt.pointerType === \"touch\";\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE &&\r\n _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n _this._altKey = evt.altKey;\r\n _this._ctrlKey = evt.ctrlKey;\r\n _this._metaKey = evt.metaKey;\r\n _this._shiftKey = evt.shiftKey;\r\n _this._buttonsPressed = evt.buttons;\r\n if (engine.isPointerLock) {\r\n var offsetX = evt.movementX ||\r\n evt.mozMovementX ||\r\n evt.webkitMovementX ||\r\n evt.msMovementX ||\r\n 0;\r\n var offsetY = evt.movementY ||\r\n evt.mozMovementY ||\r\n evt.webkitMovementY ||\r\n evt.msMovementY ||\r\n 0;\r\n _this.onTouch(null, offsetX, offsetY);\r\n _this.pointA = null;\r\n _this.pointB = null;\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n if (_this.pointA === null) {\r\n _this.pointA = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n else if (_this.pointB === null) {\r\n _this.pointB = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n _this.onButtonDown(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element.focus();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOUBLETAP) {\r\n _this.onDoubleTap(evt.pointerType);\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n if (!isTouch) {\r\n _this.pointB = null; // Mouse and pen are mono pointer\r\n }\r\n //would be better to use pointers.remove(evt.pointerId) for multitouch gestures,\r\n //but emptying completely pointers collection is required to fix a bug on iPhone :\r\n //when changing orientation while pinching camera,\r\n //one pointer stay pressed forever if we don't release all pointers\r\n //will be ok to put back pointers.remove(evt.pointerId); when iPhone bug corrected\r\n if (engine._badOS) {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n else {\r\n //only remove the impacted pointer in case of multitouch allowing on most\r\n //platforms switching from rotate to zoom and pan seamlessly.\r\n if (_this.pointB && _this.pointA && _this.pointA.pointerId == evt.pointerId) {\r\n _this.pointA = _this.pointB;\r\n _this.pointB = null;\r\n }\r\n else if (_this.pointA && _this.pointB &&\r\n _this.pointB.pointerId == evt.pointerId) {\r\n _this.pointB = null;\r\n }\r\n else {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n }\r\n if (previousPinchSquaredDistance !== 0 || previousMultiTouchPanPosition) {\r\n // Previous pinch data is populated but a button has been lifted\r\n // so pinch has ended.\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, 0, // pinchSquaredDistance\r\n previousMultiTouchPanPosition, null // multiTouchPanPosition\r\n );\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n }\r\n _this.onButtonUp(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n // One button down\r\n if (_this.pointA && _this.pointB === null) {\r\n var offsetX = evt.clientX - _this.pointA.x;\r\n var offsetY = evt.clientY - _this.pointA.y;\r\n _this.onTouch(_this.pointA, offsetX, offsetY);\r\n _this.pointA.x = evt.clientX;\r\n _this.pointA.y = evt.clientY;\r\n }\r\n // Two buttons down: pinch\r\n else if (_this.pointA && _this.pointB) {\r\n var ed = (_this.pointA.pointerId === evt.pointerId) ?\r\n _this.pointA : _this.pointB;\r\n ed.x = evt.clientX;\r\n ed.y = evt.clientY;\r\n var distX = _this.pointA.x - _this.pointB.x;\r\n var distY = _this.pointA.y - _this.pointB.y;\r\n var pinchSquaredDistance = (distX * distX) + (distY * distY);\r\n var multiTouchPanPosition = { x: (_this.pointA.x + _this.pointB.x) / 2,\r\n y: (_this.pointA.y + _this.pointB.y) / 2,\r\n pointerId: evt.pointerId,\r\n type: p.type };\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition);\r\n previousMultiTouchPanPosition = multiTouchPanPosition;\r\n previousPinchSquaredDistance = pinchSquaredDistance;\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP |\r\n _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE);\r\n this._onLostFocus = function () {\r\n _this.pointA = _this.pointB = null;\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n _this.onLostFocus();\r\n };\r\n element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].RegisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(), [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n BaseCameraPointersInput.prototype.detachControl = function (element) {\r\n if (this._onLostFocus) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].UnregisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(), [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n }\r\n if (element && this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n if (this.onContextMenu) {\r\n element.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n this._onLostFocus = null;\r\n }\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n BaseCameraPointersInput.prototype.getClassName = function () {\r\n return \"BaseCameraPointersInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n BaseCameraPointersInput.prototype.getSimpleName = function () {\r\n return \"pointers\";\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n * Override this method to provide functionality on POINTERDOUBLETAP event.\r\n */\r\n BaseCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onLostFocus = function () {\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseCameraPointersInput.prototype, \"buttons\", void 0);\r\n return BaseCameraPointersInput;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraGamepadInput.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraGamepadInput.ts ***!\n \\*******************************************************/\n/*! exports provided: ArcRotateCameraGamepadInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return ArcRotateCameraGamepadInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the gamepad inputs to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraGamepadInput = /** @class */ (function () {\r\n function ArcRotateCameraGamepadInput() {\r\n /**\r\n * Defines the gamepad rotation sensiblity.\r\n * This is the threshold from when rotation starts to be accounted for to prevent jittering.\r\n */\r\n this.gamepadRotationSensibility = 80;\r\n /**\r\n * Defines the gamepad move sensiblity.\r\n * This is the threshold from when moving starts to be accounted for for to prevent jittering.\r\n */\r\n this.gamepadMoveSensibility = 40;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraGamepadInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var manager = this.camera.getScene().gamepadManager;\r\n this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {\r\n if (gamepad.type !== _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__[\"Gamepad\"].POSE_ENABLED) {\r\n // prioritize XBOX gamepads.\r\n if (!_this.gamepad || gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__[\"Gamepad\"].XBOX) {\r\n _this.gamepad = gamepad;\r\n }\r\n }\r\n });\r\n this._onGamepadDisconnectedObserver = manager.onGamepadDisconnectedObservable.add(function (gamepad) {\r\n if (_this.gamepad === gamepad) {\r\n _this.gamepad = null;\r\n }\r\n });\r\n this.gamepad = manager.getGamepadByType(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_3__[\"Gamepad\"].XBOX);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraGamepadInput.prototype.detachControl = function (element) {\r\n this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);\r\n this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);\r\n this.gamepad = null;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraGamepadInput.prototype.checkInputs = function () {\r\n if (this.gamepad) {\r\n var camera = this.camera;\r\n var RSValues = this.gamepad.rightStick;\r\n if (RSValues) {\r\n if (RSValues.x != 0) {\r\n var normalizedRX = RSValues.x / this.gamepadRotationSensibility;\r\n if (normalizedRX != 0 && Math.abs(normalizedRX) > 0.005) {\r\n camera.inertialAlphaOffset += normalizedRX;\r\n }\r\n }\r\n if (RSValues.y != 0) {\r\n var normalizedRY = RSValues.y / this.gamepadRotationSensibility;\r\n if (normalizedRY != 0 && Math.abs(normalizedRY) > 0.005) {\r\n camera.inertialBetaOffset += normalizedRY;\r\n }\r\n }\r\n }\r\n var LSValues = this.gamepad.leftStick;\r\n if (LSValues && LSValues.y != 0) {\r\n var normalizedLY = LSValues.y / this.gamepadMoveSensibility;\r\n if (normalizedLY != 0 && Math.abs(normalizedLY) > 0.005) {\r\n this.camera.inertialRadiusOffset -= normalizedLY;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraGamepadInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraGamepadInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraGamepadInput.prototype.getSimpleName = function () {\r\n return \"gamepad\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraGamepadInput.prototype, \"gamepadRotationSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraGamepadInput.prototype, \"gamepadMoveSensibility\", void 0);\r\n return ArcRotateCameraGamepadInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraGamepadInput\"] = ArcRotateCameraGamepadInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts\":\n/*!************************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts ***!\n \\************************************************************/\n/*! exports provided: ArcRotateCameraKeyboardMoveInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return ArcRotateCameraKeyboardMoveInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the keyboard inputs to control the movement of an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraKeyboardMoveInput = /** @class */ (function () {\r\n function ArcRotateCameraKeyboardMoveInput() {\r\n /**\r\n * Defines the list of key codes associated with the up action (increase alpha)\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Defines the list of key codes associated with the down action (decrease alpha)\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Defines the list of key codes associated with the left action (increase beta)\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Defines the list of key codes associated with the right action (decrease beta)\r\n */\r\n this.keysRight = [39];\r\n /**\r\n * Defines the list of key codes associated with the reset action.\r\n * Those keys reset the camera to its last stored state (with the method camera.storeState())\r\n */\r\n this.keysReset = [220];\r\n /**\r\n * Defines the panning sensibility of the inputs.\r\n * (How fast is the camera paning)\r\n */\r\n this.panningSensibility = 50.0;\r\n /**\r\n * Defines the zooming sensibility of the inputs.\r\n * (How fast is the camera zooming)\r\n */\r\n this.zoomingSensibility = 25.0;\r\n /**\r\n * Defines wether maintaining the alt key down switch the movement mode from\r\n * orientation to zoom.\r\n */\r\n this.useAltToZoom = true;\r\n /**\r\n * Rotation speed of the camera\r\n */\r\n this.angularSpeed = 0.01;\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n _this._ctrlPressed = evt.ctrlKey;\r\n _this._altPressed = evt.altKey;\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX -= 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY += 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset += 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX += 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY -= 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset -= 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysReset.indexOf(keyCode) !== -1) {\r\n if (camera.useInputToRestoreState) {\r\n camera.restoreState();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraKeyboardMoveInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysReset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"panningSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"zoomingSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"useAltToZoom\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"angularSpeed\", void 0);\r\n return ArcRotateCameraKeyboardMoveInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraKeyboardMoveInput\"] = ArcRotateCameraKeyboardMoveInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts\":\n/*!**********************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts ***!\n \\**********************************************************/\n/*! exports provided: ArcRotateCameraMouseWheelInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return ArcRotateCameraMouseWheelInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the mouse wheel inputs to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraMouseWheelInput = /** @class */ (function () {\r\n function ArcRotateCameraMouseWheelInput() {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n this.wheelPrecision = 3.0;\r\n /**\r\n * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when wheel is used.\r\n */\r\n this.wheelDeltaPercentage = 0;\r\n }\r\n ArcRotateCameraMouseWheelInput.prototype.computeDeltaFromMouseWheelLegacyEvent = function (mouseWheelLegacyEvent, radius) {\r\n var delta = 0;\r\n var wheelDelta = (mouseWheelLegacyEvent.wheelDelta * 0.01 * this.wheelDeltaPercentage) * radius;\r\n if (mouseWheelLegacyEvent.wheelDelta > 0) {\r\n delta = wheelDelta / (1.0 + this.wheelDeltaPercentage);\r\n }\r\n else {\r\n delta = wheelDelta * (1.0 + this.wheelDeltaPercentage);\r\n }\r\n return delta;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n this._wheel = function (p, s) {\r\n //sanity check - this should be a PointerWheel event.\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL) {\r\n return;\r\n }\r\n var event = p.event;\r\n var delta = 0;\r\n var mouseWheelLegacyEvent = event;\r\n if (mouseWheelLegacyEvent.wheelDelta) {\r\n if (_this.wheelDeltaPercentage) {\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(mouseWheelLegacyEvent, _this.camera.radius);\r\n // If zooming in, estimate the target radius and use that to compute the delta for inertia\r\n // this will stop multiple scroll events zooming in from adding too much inertia\r\n if (delta > 0) {\r\n var estimatedTargetRadius = _this.camera.radius;\r\n var targetInertia = _this.camera.inertialRadiusOffset + delta;\r\n for (var i = 0; i < 20 && Math.abs(targetInertia) > 0.001; i++) {\r\n estimatedTargetRadius -= targetInertia;\r\n targetInertia *= _this.camera.inertia;\r\n }\r\n estimatedTargetRadius = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Clamp(estimatedTargetRadius, 0, Number.MAX_VALUE);\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(mouseWheelLegacyEvent, estimatedTargetRadius);\r\n }\r\n }\r\n else {\r\n delta = mouseWheelLegacyEvent.wheelDelta / (_this.wheelPrecision * 40);\r\n }\r\n }\r\n else {\r\n var deltaValue = event.deltaY || event.detail;\r\n delta = -deltaValue / _this.wheelPrecision;\r\n }\r\n if (delta) {\r\n _this.camera.inertialRadiusOffset += delta;\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelDeltaPercentage\", void 0);\r\n return ArcRotateCameraMouseWheelInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraMouseWheelInput\"] = ArcRotateCameraMouseWheelInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraPointersInput.ts\":\n/*!********************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraPointersInput.ts ***!\n \\********************************************************/\n/*! exports provided: ArcRotateCameraPointersInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return ArcRotateCameraPointersInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/Inputs/BaseCameraPointersInput */ \"./Cameras/Inputs/BaseCameraPointersInput.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the pointers inputs to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraPointersInput = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcRotateCameraPointersInput, _super);\r\n function ArcRotateCameraPointersInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n _this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityX = 1000.0;\r\n /**\r\n * Defines the pointer angular sensibility along the Y axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityY = 1000.0;\r\n /**\r\n * Defines the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n _this.pinchPrecision = 12.0;\r\n /**\r\n * pinchDeltaPercentage will be used instead of pinchPrecision if different\r\n * from 0.\r\n * It defines the percentage of current camera.radius to use as delta when\r\n * pinch zoom is used.\r\n */\r\n _this.pinchDeltaPercentage = 0;\r\n /**\r\n * Defines the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n _this.panningSensibility = 1000.0;\r\n /**\r\n * Defines whether panning (2 fingers swipe) is enabled through multitouch.\r\n */\r\n _this.multiTouchPanning = true;\r\n /**\r\n * Defines whether panning is enabled for both pan (2 fingers swipe) and\r\n * zoom (pinch) through multitouch.\r\n */\r\n _this.multiTouchPanAndZoom = true;\r\n /**\r\n * Revers pinch action direction.\r\n */\r\n _this.pinchInwards = true;\r\n _this._isPanClick = false;\r\n _this._twoFingerActivityCount = 0;\r\n _this._isPinching = false;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraPointersInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraPointersInput\";\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n if (this.panningSensibility !== 0 &&\r\n ((this._ctrlKey && this.camera._useCtrlForPanning) || this._isPanClick)) {\r\n this.camera.inertialPanningX += -offsetX / this.panningSensibility;\r\n this.camera.inertialPanningY += offsetY / this.panningSensibility;\r\n }\r\n else {\r\n this.camera.inertialAlphaOffset -= offsetX / this.angularSensibilityX;\r\n this.camera.inertialBetaOffset -= offsetY / this.angularSensibilityY;\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n if (this.camera.useInputToRestoreState) {\r\n this.camera.restoreState();\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n if (previousPinchSquaredDistance === 0 && previousMultiTouchPanPosition === null) {\r\n // First time this method is called for new pinch.\r\n // Next time this is called there will be a\r\n // previousPinchSquaredDistance and pinchSquaredDistance to compare.\r\n return;\r\n }\r\n if (pinchSquaredDistance === 0 && multiTouchPanPosition === null) {\r\n // Last time this method is called at the end of a pinch.\r\n return;\r\n }\r\n var direction = this.pinchInwards ? 1 : -1;\r\n if (this.multiTouchPanAndZoom) {\r\n if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n if (this.panningSensibility !== 0 &&\r\n previousMultiTouchPanPosition && multiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n else {\r\n this._twoFingerActivityCount++;\r\n var previousPinchDistance = Math.sqrt(previousPinchSquaredDistance);\r\n var pinchDistance = Math.sqrt(pinchSquaredDistance);\r\n if (this._isPinching ||\r\n (this._twoFingerActivityCount < 20 &&\r\n Math.abs(pinchDistance - previousPinchDistance) >\r\n this.camera.pinchToPanMaxDistance)) {\r\n // Since pinch has not been active long, assume we intend to zoom.\r\n if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n // Since we are pinching, remain pinching on next iteration.\r\n this._isPinching = true;\r\n }\r\n else {\r\n // Pause between pinch starting and moving implies not a zoom event.\r\n // Pan instead.\r\n if (this.panningSensibility !== 0 && this.multiTouchPanning &&\r\n multiTouchPanPosition && previousMultiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n this._isPanClick = evt.button === this.camera._panningMouseButton;\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onLostFocus = function () {\r\n this._isPanClick = false;\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"buttons\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchDeltaPercentage\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"panningSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanning\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanAndZoom\", void 0);\r\n return ArcRotateCameraPointersInput;\r\n}(_Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__[\"BaseCameraPointersInput\"]));\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"ArcRotateCameraPointersInput\"] =\r\n ArcRotateCameraPointersInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts\":\n/*!*******************************************************************!*\\\n !*** ./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts ***!\n \\*******************************************************************/\n/*! exports provided: ArcRotateCameraVRDeviceOrientationInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return ArcRotateCameraVRDeviceOrientationInput; });\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n\r\n\r\n/**\r\n * Add orientation input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n_Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"ArcRotateCameraInputsManager\"].prototype.addVRDeviceOrientation = function () {\r\n this.add(new ArcRotateCameraVRDeviceOrientationInput());\r\n return this;\r\n};\r\n/**\r\n * Manage the device orientation inputs (gyroscope) to control an arc rotate camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraVRDeviceOrientationInput = /** @class */ (function () {\r\n /**\r\n * Instantiate a new ArcRotateCameraVRDeviceOrientationInput.\r\n */\r\n function ArcRotateCameraVRDeviceOrientationInput() {\r\n /**\r\n * Defines a correction factor applied on the alpha value retrieved from the orientation events.\r\n */\r\n this.alphaCorrection = 1;\r\n /**\r\n * Defines a correction factor applied on the gamma value retrieved from the orientation events.\r\n */\r\n this.gammaCorrection = 1;\r\n this._alpha = 0;\r\n this._gamma = 0;\r\n this._dirty = false;\r\n this._deviceOrientationHandler = this._onOrientationEvent.bind(this);\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.attachControl = function (element, noPreventDefault) {\r\n this.camera.attachControl(element, noPreventDefault);\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n hostWindow.addEventListener(\"deviceorientation\", this._deviceOrientationHandler);\r\n };\r\n /** @hidden */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype._onOrientationEvent = function (evt) {\r\n if (evt.alpha !== null) {\r\n this._alpha = (+evt.alpha | 0) * this.alphaCorrection;\r\n }\r\n if (evt.gamma !== null) {\r\n this._gamma = (+evt.gamma | 0) * this.gammaCorrection;\r\n }\r\n this._dirty = true;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.checkInputs = function () {\r\n if (this._dirty) {\r\n this._dirty = false;\r\n if (this._gamma < 0) {\r\n this._gamma = 180 + this._gamma;\r\n }\r\n this.camera.alpha = (-this._alpha / 180.0 * Math.PI) % Math.PI * 2;\r\n this.camera.beta = (this._gamma / 180.0 * Math.PI);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.detachControl = function (element) {\r\n window.removeEventListener(\"deviceorientation\", this._deviceOrientationHandler);\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraVRDeviceOrientationInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraVRDeviceOrientationInput.prototype.getSimpleName = function () {\r\n return \"VRDeviceOrientation\";\r\n };\r\n return ArcRotateCameraVRDeviceOrientationInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputTypes\"][\"ArcRotateCameraVRDeviceOrientationInput\"] = ArcRotateCameraVRDeviceOrientationInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/flyCameraKeyboardInput.ts\":\n/*!**************************************************!*\\\n !*** ./Cameras/Inputs/flyCameraKeyboardInput.ts ***!\n \\**************************************************/\n/*! exports provided: FlyCameraKeyboardInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return FlyCameraKeyboardInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Listen to keyboard events to control the camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FlyCameraKeyboardInput = /** @class */ (function () {\r\n function FlyCameraKeyboardInput() {\r\n /**\r\n * The list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysForward = [87];\r\n /**\r\n * The list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysBackward = [83];\r\n /**\r\n * The list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysUp = [69];\r\n /**\r\n * The list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysDown = [81];\r\n /**\r\n * The list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n this.keysRight = [68];\r\n /**\r\n * The list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n this.keysLeft = [65];\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FlyCameraKeyboardInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n if (_this.keysForward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysBackward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysForward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysBackward.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FlyCameraKeyboardInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FlyCameraKeyboardInput.prototype.getClassName = function () {\r\n return \"FlyCameraKeyboardInput\";\r\n };\r\n /** @hidden */\r\n FlyCameraKeyboardInput.prototype._onLostFocus = function (e) {\r\n this._keys = [];\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FlyCameraKeyboardInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FlyCameraKeyboardInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n // Keyboard\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n var speed = camera._computeLocalCameraSpeed();\r\n if (this.keysForward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, speed);\r\n }\r\n else if (this.keysBackward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, -speed);\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, speed, 0);\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, -speed, 0);\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(speed, 0, 0);\r\n }\r\n else if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(-speed, 0, 0);\r\n }\r\n if (camera.getScene().useRightHandedSystem) {\r\n camera._localDirection.z *= -1;\r\n }\r\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);\r\n camera.cameraDirection.addInPlace(camera._transformedDirection);\r\n }\r\n }\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysForward\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysBackward\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysUp\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysRight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraKeyboardInput.prototype, \"keysLeft\", void 0);\r\n return FlyCameraKeyboardInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FlyCameraKeyboardInput\"] = FlyCameraKeyboardInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/flyCameraMouseInput.ts\":\n/*!***********************************************!*\\\n !*** ./Cameras/Inputs/flyCameraMouseInput.ts ***!\n \\***********************************************/\n/*! exports provided: FlyCameraMouseInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return FlyCameraMouseInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Listen to mouse events to control the camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FlyCameraMouseInput = /** @class */ (function () {\r\n /**\r\n * Listen to mouse events to control the camera.\r\n * @param touchEnabled Define if touch is enabled. (Default is true.)\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\n function FlyCameraMouseInput(touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n /**\r\n * Defines the buttons associated with the input to handle camera rotation.\r\n */\r\n this.buttons = [0, 1, 2];\r\n /**\r\n * Assign buttons for Yaw control.\r\n */\r\n this.buttonsYaw = [-1, 0, 1];\r\n /**\r\n * Assign buttons for Pitch control.\r\n */\r\n this.buttonsPitch = [-1, 0, 1];\r\n /**\r\n * Assign buttons for Roll control.\r\n */\r\n this.buttonsRoll = [2];\r\n /**\r\n * Detect if any button is being pressed while mouse is moved.\r\n * -1 = Mouse locked.\r\n * 0 = Left button.\r\n * 1 = Middle Button.\r\n * 2 = Right Button.\r\n */\r\n this.activeButton = -1;\r\n /**\r\n * Defines the pointer's angular sensibility, to control the camera rotation speed.\r\n * Higher values reduce its sensitivity.\r\n */\r\n this.angularSensibility = 1000.0;\r\n this.previousPosition = null;\r\n }\r\n /**\r\n * Attach the mouse control to the HTML DOM element.\r\n * @param element Defines the element that listens to the input events.\r\n * @param noPreventDefault Defines whether events caught by the controls should call preventdefault().\r\n */\r\n FlyCameraMouseInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n this.element = element;\r\n this.noPreventDefault = noPreventDefault;\r\n this._observer = this.camera.getScene().onPointerObservable.add(function (p, s) {\r\n _this._pointerInput(p, s);\r\n }, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE);\r\n // Correct Roll by rate, if enabled.\r\n this._rollObserver = this.camera.getScene().onBeforeRenderObservable.add(function () {\r\n if (_this.camera.rollCorrect) {\r\n _this.camera.restoreRoll(_this.camera.rollCorrect);\r\n }\r\n });\r\n // Helper function to keep 'this'.\r\n this._mousemoveCallback = function (e) {\r\n _this._onMouseMove(e);\r\n };\r\n element.addEventListener(\"mousemove\", this._mousemoveCallback, false);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FlyCameraMouseInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this.camera.getScene().onBeforeRenderObservable.remove(this._rollObserver);\r\n if (this._mousemoveCallback) {\r\n element.removeEventListener(\"mousemove\", this._mousemoveCallback);\r\n }\r\n this._observer = null;\r\n this._rollObserver = null;\r\n this.previousPosition = null;\r\n this.noPreventDefault = undefined;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name.\r\n */\r\n FlyCameraMouseInput.prototype.getClassName = function () {\r\n return \"FlyCameraMouseInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input's friendly name.\r\n */\r\n FlyCameraMouseInput.prototype.getSimpleName = function () {\r\n return \"mouse\";\r\n };\r\n // Track mouse movement, when the pointer is not locked.\r\n FlyCameraMouseInput.prototype._pointerInput = function (p, s) {\r\n var e = p.event;\r\n var camera = this.camera;\r\n var engine = camera.getEngine();\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (!this.touchEnabled && e.pointerType === \"touch\") {\r\n return;\r\n }\r\n // Mouse is moved but an unknown mouse button is pressed.\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE && this.buttons.indexOf(e.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (e.srcElement || e.target);\r\n // Mouse down.\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(e.pointerId);\r\n }\r\n catch (e) {\r\n // Nothing to do with the error. Execution continues.\r\n }\r\n this.previousPosition = {\r\n x: e.clientX,\r\n y: e.clientY\r\n };\r\n this.activeButton = e.button;\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n this.element.focus();\r\n }\r\n }\r\n else \r\n // Mouse up.\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(e.pointerId);\r\n }\r\n catch (e) {\r\n // Nothing to do with the error. Execution continues.\r\n }\r\n this.activeButton = -1;\r\n this.previousPosition = null;\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n }\r\n }\r\n else \r\n // Mouse move.\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!this.previousPosition || engine.isPointerLock) {\r\n return;\r\n }\r\n var offsetX = e.clientX - this.previousPosition.x;\r\n var offsetY = e.clientY - this.previousPosition.y;\r\n this.rotateCamera(offsetX, offsetY);\r\n this.previousPosition = {\r\n x: e.clientX,\r\n y: e.clientY\r\n };\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n }\r\n }\r\n };\r\n // Track mouse movement, when pointer is locked.\r\n FlyCameraMouseInput.prototype._onMouseMove = function (e) {\r\n var camera = this.camera;\r\n var engine = camera.getEngine();\r\n if (!engine.isPointerLock || engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n var offsetX = e.movementX || e.mozMovementX || e.webkitMovementX || e.msMovementX || 0;\r\n var offsetY = e.movementY || e.mozMovementY || e.webkitMovementY || e.msMovementY || 0;\r\n this.rotateCamera(offsetX, offsetY);\r\n this.previousPosition = null;\r\n if (!this.noPreventDefault) {\r\n e.preventDefault();\r\n }\r\n };\r\n /**\r\n * Rotate camera by mouse offset.\r\n */\r\n FlyCameraMouseInput.prototype.rotateCamera = function (offsetX, offsetY) {\r\n var _this = this;\r\n var camera = this.camera;\r\n var scene = this.camera.getScene();\r\n if (scene.useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (camera.parent && camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n var x = offsetX / this.angularSensibility;\r\n var y = offsetY / this.angularSensibility;\r\n // Initialize to current rotation.\r\n var currentRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, camera.rotation.z);\r\n var rotationChange;\r\n // Pitch.\r\n if (this.buttonsPitch.some(function (v) { return v === _this.activeButton; })) {\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].X, y);\r\n // Apply Pitch to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n }\r\n // Yaw.\r\n if (this.buttonsYaw.some(function (v) { return v === _this.activeButton; })) {\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y, x);\r\n // Apply Yaw to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n // Add Roll, if banked turning is enabled, within Roll limit.\r\n var limit = (camera.bankedTurnLimit) + camera._trackRoll; // Defaults to 90° plus manual roll.\r\n if (camera.bankedTurn && -limit < camera.rotation.z && camera.rotation.z < limit) {\r\n var bankingDelta = camera.bankedTurnMultiplier * -x;\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Z, bankingDelta);\r\n // Apply Yaw to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n }\r\n }\r\n // Roll.\r\n if (this.buttonsRoll.some(function (v) { return v === _this.activeButton; })) {\r\n // Apply change in Radians to vector Angle.\r\n rotationChange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].RotationAxis(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Z, -x);\r\n // Track Rolling.\r\n camera._trackRoll -= x;\r\n // Apply Pitch to quaternion.\r\n currentRotation.multiplyInPlace(rotationChange);\r\n }\r\n // Apply rotationQuaternion to Euler camera.rotation.\r\n currentRotation.toEulerAnglesToRef(camera.rotation);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraMouseInput.prototype, \"buttons\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCameraMouseInput.prototype, \"angularSensibility\", void 0);\r\n return FlyCameraMouseInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FlyCameraMouseInput\"] = FlyCameraMouseInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/followCameraKeyboardMoveInput.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/Inputs/followCameraKeyboardMoveInput.ts ***!\n \\*********************************************************/\n/*! exports provided: FollowCameraKeyboardMoveInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return FollowCameraKeyboardMoveInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the keyboard inputs to control the movement of a follow camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraKeyboardMoveInput = /** @class */ (function () {\r\n function FollowCameraKeyboardMoveInput() {\r\n /**\r\n * Defines the list of key codes associated with the up action (increase heightOffset)\r\n */\r\n this.keysHeightOffsetIncr = [38];\r\n /**\r\n * Defines the list of key codes associated with the down action (decrease heightOffset)\r\n */\r\n this.keysHeightOffsetDecr = [40];\r\n /**\r\n * Defines whether the Alt modifier key is required to move up/down (alter heightOffset)\r\n */\r\n this.keysHeightOffsetModifierAlt = false;\r\n /**\r\n * Defines whether the Ctrl modifier key is required to move up/down (alter heightOffset)\r\n */\r\n this.keysHeightOffsetModifierCtrl = false;\r\n /**\r\n * Defines whether the Shift modifier key is required to move up/down (alter heightOffset)\r\n */\r\n this.keysHeightOffsetModifierShift = false;\r\n /**\r\n * Defines the list of key codes associated with the left action (increase rotationOffset)\r\n */\r\n this.keysRotationOffsetIncr = [37];\r\n /**\r\n * Defines the list of key codes associated with the right action (decrease rotationOffset)\r\n */\r\n this.keysRotationOffsetDecr = [39];\r\n /**\r\n * Defines whether the Alt modifier key is required to move left/right (alter rotationOffset)\r\n */\r\n this.keysRotationOffsetModifierAlt = false;\r\n /**\r\n * Defines whether the Ctrl modifier key is required to move left/right (alter rotationOffset)\r\n */\r\n this.keysRotationOffsetModifierCtrl = false;\r\n /**\r\n * Defines whether the Shift modifier key is required to move left/right (alter rotationOffset)\r\n */\r\n this.keysRotationOffsetModifierShift = false;\r\n /**\r\n * Defines the list of key codes associated with the zoom-in action (decrease radius)\r\n */\r\n this.keysRadiusIncr = [40];\r\n /**\r\n * Defines the list of key codes associated with the zoom-out action (increase radius)\r\n */\r\n this.keysRadiusDecr = [38];\r\n /**\r\n * Defines whether the Alt modifier key is required to zoom in/out (alter radius value)\r\n */\r\n this.keysRadiusModifierAlt = true;\r\n /**\r\n * Defines whether the Ctrl modifier key is required to zoom in/out (alter radius value)\r\n */\r\n this.keysRadiusModifierCtrl = false;\r\n /**\r\n * Defines whether the Shift modifier key is required to zoom in/out (alter radius value)\r\n */\r\n this.keysRadiusModifierShift = false;\r\n /**\r\n * Defines the rate of change of heightOffset.\r\n */\r\n this.heightSensibility = 1;\r\n /**\r\n * Defines the rate of change of rotationOffset.\r\n */\r\n this.rotationSensibility = 1;\r\n /**\r\n * Defines the rate of change of radius.\r\n */\r\n this.radiusSensibility = 1;\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n _this._ctrlPressed = evt.ctrlKey;\r\n _this._altPressed = evt.altKey;\r\n _this._shiftPressed = evt.shiftKey;\r\n if (_this.keysHeightOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysHeightOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusDecr.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysHeightOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysHeightOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRotationOffsetDecr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusIncr.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRadiusDecr.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n var _this = this;\r\n if (this._onKeyboardObserver) {\r\n this._keys.forEach(function (keyCode) {\r\n if (_this.keysHeightOffsetIncr.indexOf(keyCode) !== -1 &&\r\n _this._modifierHeightOffset()) {\r\n _this.camera.heightOffset += _this.heightSensibility;\r\n }\r\n else if (_this.keysHeightOffsetDecr.indexOf(keyCode) !== -1 &&\r\n _this._modifierHeightOffset()) {\r\n _this.camera.heightOffset -= _this.heightSensibility;\r\n }\r\n else if (_this.keysRotationOffsetIncr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRotationOffset()) {\r\n _this.camera.rotationOffset += _this.rotationSensibility;\r\n _this.camera.rotationOffset %= 360;\r\n }\r\n else if (_this.keysRotationOffsetDecr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRotationOffset()) {\r\n _this.camera.rotationOffset -= _this.rotationSensibility;\r\n _this.camera.rotationOffset %= 360;\r\n }\r\n else if (_this.keysRadiusIncr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRadius()) {\r\n _this.camera.radius += _this.radiusSensibility;\r\n }\r\n else if (_this.keysRadiusDecr.indexOf(keyCode) !== -1 &&\r\n _this._modifierRadius()) {\r\n _this.camera.radius -= _this.radiusSensibility;\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"FollowCameraKeyboardMoveInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FollowCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n /**\r\n * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to\r\n * allow modification of the heightOffset value.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype._modifierHeightOffset = function () {\r\n return (this.keysHeightOffsetModifierAlt === this._altPressed &&\r\n this.keysHeightOffsetModifierCtrl === this._ctrlPressed &&\r\n this.keysHeightOffsetModifierShift === this._shiftPressed);\r\n };\r\n /**\r\n * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to\r\n * allow modification of the rotationOffset value.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype._modifierRotationOffset = function () {\r\n return (this.keysRotationOffsetModifierAlt === this._altPressed &&\r\n this.keysRotationOffsetModifierCtrl === this._ctrlPressed &&\r\n this.keysRotationOffsetModifierShift === this._shiftPressed);\r\n };\r\n /**\r\n * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to\r\n * allow modification of the radius value.\r\n */\r\n FollowCameraKeyboardMoveInput.prototype._modifierRadius = function () {\r\n return (this.keysRadiusModifierAlt === this._altPressed &&\r\n this.keysRadiusModifierCtrl === this._ctrlPressed &&\r\n this.keysRadiusModifierShift === this._shiftPressed);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetIncr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetDecr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetModifierAlt\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetModifierCtrl\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysHeightOffsetModifierShift\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetIncr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetDecr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetModifierAlt\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetModifierCtrl\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRotationOffsetModifierShift\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusIncr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusDecr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusModifierAlt\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusModifierCtrl\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"keysRadiusModifierShift\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"heightSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"rotationSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FollowCameraKeyboardMoveInput.prototype, \"radiusSensibility\", void 0);\r\n return FollowCameraKeyboardMoveInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputTypes\"][\"FollowCameraKeyboardMoveInput\"] = FollowCameraKeyboardMoveInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/followCameraMouseWheelInput.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Inputs/followCameraMouseWheelInput.ts ***!\n \\*******************************************************/\n/*! exports provided: FollowCameraMouseWheelInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return FollowCameraMouseWheelInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the mouse wheel inputs to control a follow camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraMouseWheelInput = /** @class */ (function () {\r\n function FollowCameraMouseWheelInput() {\r\n /**\r\n * Moue wheel controls zoom. (Mouse wheel modifies camera.radius value.)\r\n */\r\n this.axisControlRadius = true;\r\n /**\r\n * Moue wheel controls height. (Mouse wheel modifies camera.heightOffset value.)\r\n */\r\n this.axisControlHeight = false;\r\n /**\r\n * Moue wheel controls angle. (Mouse wheel modifies camera.rotationOffset value.)\r\n */\r\n this.axisControlRotation = false;\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera moves in\r\n * relation to mouseWheel events.\r\n */\r\n this.wheelPrecision = 3.0;\r\n /**\r\n * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when wheel is used.\r\n */\r\n this.wheelDeltaPercentage = 0;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FollowCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n this._wheel = function (p, s) {\r\n // sanity check - this should be a PointerWheel event.\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL) {\r\n return;\r\n }\r\n var event = p.event;\r\n var delta = 0;\r\n // Chrome, Safari: event.deltaY\r\n // IE: event.wheelDelta\r\n // Firefox: event.detail (inverted)\r\n var wheelDelta = Math.max(-1, Math.min(1, (event.deltaY || event.wheelDelta || -event.detail)));\r\n if (_this.wheelDeltaPercentage) {\r\n console.assert((_this.axisControlRadius +\r\n _this.axisControlHeight +\r\n _this.axisControlRotation) <= 1, \"wheelDeltaPercentage only usable when mouse wheel \" +\r\n \"controlls ONE axis. \" +\r\n \"Currently enabled: \" +\r\n \"axisControlRadius: \" + _this.axisControlRadius +\r\n \", axisControlHeightOffset: \" + _this.axisControlHeight +\r\n \", axisControlRotationOffset: \" + _this.axisControlRotation);\r\n if (_this.axisControlRadius) {\r\n delta =\r\n wheelDelta * 0.01 * _this.wheelDeltaPercentage *\r\n _this.camera.radius;\r\n }\r\n else if (_this.axisControlHeight) {\r\n delta =\r\n wheelDelta * 0.01 * _this.wheelDeltaPercentage *\r\n _this.camera.heightOffset;\r\n }\r\n else if (_this.axisControlRotation) {\r\n delta =\r\n wheelDelta * 0.01 * _this.wheelDeltaPercentage *\r\n _this.camera.rotationOffset;\r\n }\r\n }\r\n else {\r\n delta = wheelDelta * _this.wheelPrecision;\r\n }\r\n if (delta) {\r\n if (_this.axisControlRadius) {\r\n _this.camera.radius += delta;\r\n }\r\n else if (_this.axisControlHeight) {\r\n _this.camera.heightOffset -= delta;\r\n }\r\n else if (_this.axisControlRotation) {\r\n _this.camera.rotationOffset -= delta;\r\n }\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FollowCameraMouseWheelInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FollowCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FollowCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"axisControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"axisControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"axisControlRotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"wheelPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraMouseWheelInput.prototype, \"wheelDeltaPercentage\", void 0);\r\n return FollowCameraMouseWheelInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FollowCameraMouseWheelInput\"] = FollowCameraMouseWheelInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/followCameraPointersInput.ts\":\n/*!*****************************************************!*\\\n !*** ./Cameras/Inputs/followCameraPointersInput.ts ***!\n \\*****************************************************/\n/*! exports provided: FollowCameraPointersInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return FollowCameraPointersInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/Inputs/BaseCameraPointersInput */ \"./Cameras/Inputs/BaseCameraPointersInput.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manage the pointers inputs to control an follow camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraPointersInput = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FollowCameraPointersInput, _super);\r\n function FollowCameraPointersInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Defines the pointer angular sensibility along the X axis or how fast is\r\n * the camera rotating.\r\n * A negative number will reverse the axis direction.\r\n */\r\n _this.angularSensibilityX = 1;\r\n /**\r\n * Defines the pointer angular sensibility along the Y axis or how fast is\r\n * the camera rotating.\r\n * A negative number will reverse the axis direction.\r\n */\r\n _this.angularSensibilityY = 1;\r\n /**\r\n * Defines the pointer pinch precision or how fast is the camera zooming.\r\n * A negative number will reverse the axis direction.\r\n */\r\n _this.pinchPrecision = 10000.0;\r\n /**\r\n * pinchDeltaPercentage will be used instead of pinchPrecision if different\r\n * from 0.\r\n * It defines the percentage of current camera.radius to use as delta when\r\n * pinch zoom is used.\r\n */\r\n _this.pinchDeltaPercentage = 0;\r\n /**\r\n * Pointer X axis controls zoom. (X axis modifies camera.radius value.)\r\n */\r\n _this.axisXControlRadius = false;\r\n /**\r\n * Pointer X axis controls height. (X axis modifies camera.heightOffset value.)\r\n */\r\n _this.axisXControlHeight = false;\r\n /**\r\n * Pointer X axis controls angle. (X axis modifies camera.rotationOffset value.)\r\n */\r\n _this.axisXControlRotation = true;\r\n /**\r\n * Pointer Y axis controls zoom. (Y axis modifies camera.radius value.)\r\n */\r\n _this.axisYControlRadius = false;\r\n /**\r\n * Pointer Y axis controls height. (Y axis modifies camera.heightOffset value.)\r\n */\r\n _this.axisYControlHeight = true;\r\n /**\r\n * Pointer Y axis controls angle. (Y axis modifies camera.rotationOffset value.)\r\n */\r\n _this.axisYControlRotation = false;\r\n /**\r\n * Pinch controls zoom. (Pinch modifies camera.radius value.)\r\n */\r\n _this.axisPinchControlRadius = true;\r\n /**\r\n * Pinch controls height. (Pinch modifies camera.heightOffset value.)\r\n */\r\n _this.axisPinchControlHeight = false;\r\n /**\r\n * Pinch controls angle. (Pinch modifies camera.rotationOffset value.)\r\n */\r\n _this.axisPinchControlRotation = false;\r\n /**\r\n * Log error messages if basic misconfiguration has occurred.\r\n */\r\n _this.warningEnable = true;\r\n /* Check for obvious misconfiguration. */\r\n _this._warningCounter = 0;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n FollowCameraPointersInput.prototype.getClassName = function () {\r\n return \"FollowCameraPointersInput\";\r\n };\r\n FollowCameraPointersInput.prototype.onTouch = function (pointA, offsetX, offsetY) {\r\n this._warning();\r\n if (this.axisXControlRotation) {\r\n this.camera.rotationOffset += offsetX / this.angularSensibilityX;\r\n }\r\n else if (this.axisYControlRotation) {\r\n this.camera.rotationOffset += offsetY / this.angularSensibilityX;\r\n }\r\n if (this.axisXControlHeight) {\r\n this.camera.heightOffset += offsetX / this.angularSensibilityY;\r\n }\r\n else if (this.axisYControlHeight) {\r\n this.camera.heightOffset += offsetY / this.angularSensibilityY;\r\n }\r\n if (this.axisXControlRadius) {\r\n this.camera.radius -= offsetX / this.angularSensibilityY;\r\n }\r\n else if (this.axisYControlRadius) {\r\n this.camera.radius -= offsetY / this.angularSensibilityY;\r\n }\r\n };\r\n FollowCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n if (previousPinchSquaredDistance === 0 && previousMultiTouchPanPosition === null) {\r\n // First time this method is called for new pinch.\r\n // Next time this is called there will be a\r\n // previousPinchSquaredDistance and pinchSquaredDistance to compare.\r\n return;\r\n }\r\n if (pinchSquaredDistance === 0 && multiTouchPanPosition === null) {\r\n // Last time this method is called at the end of a pinch.\r\n return;\r\n }\r\n var pinchDelta = (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n if (this.pinchDeltaPercentage) {\r\n pinchDelta *= 0.01 * this.pinchDeltaPercentage;\r\n if (this.axisPinchControlRotation) {\r\n this.camera.rotationOffset += pinchDelta * this.camera.rotationOffset;\r\n }\r\n if (this.axisPinchControlHeight) {\r\n this.camera.heightOffset += pinchDelta * this.camera.heightOffset;\r\n }\r\n if (this.axisPinchControlRadius) {\r\n this.camera.radius -= pinchDelta * this.camera.radius;\r\n }\r\n }\r\n else {\r\n if (this.axisPinchControlRotation) {\r\n this.camera.rotationOffset += pinchDelta;\r\n }\r\n if (this.axisPinchControlHeight) {\r\n this.camera.heightOffset += pinchDelta;\r\n }\r\n if (this.axisPinchControlRadius) {\r\n this.camera.radius -= pinchDelta;\r\n }\r\n }\r\n };\r\n FollowCameraPointersInput.prototype._warning = function () {\r\n if (!this.warningEnable || this._warningCounter++ % 100 !== 0) {\r\n return;\r\n }\r\n var warn = \"It probably only makes sense to control ONE camera \" +\r\n \"property with each pointer axis. Set 'warningEnable = false' \" +\r\n \"if you are sure. Currently enabled: \";\r\n console.assert((this.axisXControlRotation +\r\n this.axisXControlHeight +\r\n this.axisXControlRadius) <= 1, warn +\r\n \"axisXControlRotation: \" + this.axisXControlRotation +\r\n \", axisXControlHeight: \" + this.axisXControlHeight +\r\n \", axisXControlRadius: \" + this.axisXControlRadius);\r\n console.assert((this.axisYControlRotation +\r\n this.axisYControlHeight +\r\n this.axisYControlRadius) <= 1, warn +\r\n \"axisYControlRotation: \" + this.axisYControlRotation +\r\n \", axisYControlHeight: \" + this.axisYControlHeight +\r\n \", axisYControlRadius: \" + this.axisYControlRadius);\r\n console.assert((this.axisPinchControlRotation +\r\n this.axisPinchControlHeight +\r\n this.axisPinchControlRadius) <= 1, warn +\r\n \"axisPinchControlRotation: \" + this.axisPinchControlRotation +\r\n \", axisPinchControlHeight: \" + this.axisPinchControlHeight +\r\n \", axisPinchControlRadius: \" + this.axisPinchControlRadius);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"angularSensibilityX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"angularSensibilityY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"pinchPrecision\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"pinchDeltaPercentage\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisXControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisXControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisXControlRotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisYControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisYControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisYControlRotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisPinchControlRadius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisPinchControlHeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCameraPointersInput.prototype, \"axisPinchControlRotation\", void 0);\r\n return FollowCameraPointersInput;\r\n}(_Cameras_Inputs_BaseCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__[\"BaseCameraPointersInput\"]));\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FollowCameraPointersInput\"] = FollowCameraPointersInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraDeviceOrientationInput.ts\":\n/*!************************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraDeviceOrientationInput.ts ***!\n \\************************************************************/\n/*! exports provided: FreeCameraDeviceOrientationInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return FreeCameraDeviceOrientationInput; });\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Add orientation input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n_Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraInputsManager\"].prototype.addDeviceOrientation = function () {\r\n if (!this._deviceOrientationInput) {\r\n this._deviceOrientationInput = new FreeCameraDeviceOrientationInput();\r\n this.add(this._deviceOrientationInput);\r\n }\r\n return this;\r\n};\r\n/**\r\n * Takes information about the orientation of the device as reported by the deviceorientation event to orient the camera.\r\n * Screen rotation is taken into account.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraDeviceOrientationInput = /** @class */ (function () {\r\n /**\r\n * Instantiates a new input\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\n function FreeCameraDeviceOrientationInput() {\r\n var _this = this;\r\n this._screenOrientationAngle = 0;\r\n this._screenQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n this._alpha = 0;\r\n this._beta = 0;\r\n this._gamma = 0;\r\n /**\r\n * @hidden\r\n */\r\n this._onDeviceOrientationChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n this._orientationChanged = function () {\r\n _this._screenOrientationAngle = (window.orientation !== undefined ? +window.orientation : (window.screen.orientation && (window.screen.orientation)['angle'] ? (window.screen.orientation).angle : 0));\r\n _this._screenOrientationAngle = -_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(_this._screenOrientationAngle / 2);\r\n _this._screenQuaternion.copyFromFloats(0, Math.sin(_this._screenOrientationAngle), 0, Math.cos(_this._screenOrientationAngle));\r\n };\r\n this._deviceOrientation = function (evt) {\r\n _this._alpha = evt.alpha !== null ? evt.alpha : 0;\r\n _this._beta = evt.beta !== null ? evt.beta : 0;\r\n _this._gamma = evt.gamma !== null ? evt.gamma : 0;\r\n if (evt.alpha !== null) {\r\n _this._onDeviceOrientationChangedObservable.notifyObservers();\r\n }\r\n };\r\n this._constantTranform = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"](-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5));\r\n this._orientationChanged();\r\n }\r\n /**\r\n * Can be used to detect if a device orientation sensor is availible on a device\r\n * @param timeout amount of time in milliseconds to wait for a response from the sensor (default: infinite)\r\n * @returns a promise that will resolve on orientation change\r\n */\r\n FreeCameraDeviceOrientationInput.WaitForOrientationChangeAsync = function (timeout) {\r\n return new Promise(function (res, rej) {\r\n var gotValue = false;\r\n var eventHandler = function () {\r\n window.removeEventListener(\"deviceorientation\", eventHandler);\r\n gotValue = true;\r\n res();\r\n };\r\n // If timeout is pupulated reject the promise\r\n if (timeout) {\r\n setTimeout(function () {\r\n if (!gotValue) {\r\n window.removeEventListener(\"deviceorientation\", eventHandler);\r\n rej(\"WaitForOrientationChangeAsync timed out\");\r\n }\r\n }, timeout);\r\n }\r\n window.addEventListener(\"deviceorientation\", eventHandler);\r\n });\r\n };\r\n Object.defineProperty(FreeCameraDeviceOrientationInput.prototype, \"camera\", {\r\n /**\r\n * Define the camera controlled by the input.\r\n */\r\n get: function () {\r\n return this._camera;\r\n },\r\n set: function (camera) {\r\n var _this = this;\r\n this._camera = camera;\r\n if (this._camera != null && !this._camera.rotationQuaternion) {\r\n this._camera.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n }\r\n if (this._camera) {\r\n this._camera.onDisposeObservable.add(function () {\r\n _this._onDeviceOrientationChangedObservable.clear();\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n hostWindow.addEventListener(\"orientationchange\", this._orientationChanged);\r\n hostWindow.addEventListener(\"deviceorientation\", this._deviceOrientation);\r\n //In certain cases, the attach control is called AFTER orientation was changed,\r\n //So this is needed.\r\n this._orientationChanged();\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.detachControl = function (element) {\r\n window.removeEventListener(\"orientationchange\", this._orientationChanged);\r\n window.removeEventListener(\"deviceorientation\", this._deviceOrientation);\r\n this._alpha = 0;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.checkInputs = function () {\r\n //if no device orientation provided, don't update the rotation.\r\n //Only testing against alpha under the assumption thatnorientation will never be so exact when set.\r\n if (!this._alpha) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].RotationYawPitchRollToRef(_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this._alpha), _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this._beta), -_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this._gamma), this.camera.rotationQuaternion);\r\n this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion);\r\n this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform);\r\n //Mirror on XY Plane\r\n this._camera.rotationQuaternion.z *= -1;\r\n this._camera.rotationQuaternion.w *= -1;\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.getClassName = function () {\r\n return \"FreeCameraDeviceOrientationInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraDeviceOrientationInput.prototype.getSimpleName = function () {\r\n return \"deviceOrientation\";\r\n };\r\n return FreeCameraDeviceOrientationInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputTypes\"][\"FreeCameraDeviceOrientationInput\"] = FreeCameraDeviceOrientationInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraGamepadInput.ts\":\n/*!**************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraGamepadInput.ts ***!\n \\**************************************************/\n/*! exports provided: FreeCameraGamepadInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return FreeCameraGamepadInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the gamepad inputs to control a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraGamepadInput = /** @class */ (function () {\r\n function FreeCameraGamepadInput() {\r\n /**\r\n * Defines the gamepad rotation sensiblity.\r\n * This is the threshold from when rotation starts to be accounted for to prevent jittering.\r\n */\r\n this.gamepadAngularSensibility = 200;\r\n /**\r\n * Defines the gamepad move sensiblity.\r\n * This is the threshold from when moving starts to be accounted for for to prevent jittering.\r\n */\r\n this.gamepadMoveSensibility = 40;\r\n this._cameraTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n this._deltaTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._vector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._vector2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraGamepadInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var manager = this.camera.getScene().gamepadManager;\r\n this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {\r\n if (gamepad.type !== _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].POSE_ENABLED) {\r\n // prioritize XBOX gamepads.\r\n if (!_this.gamepad || gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].XBOX) {\r\n _this.gamepad = gamepad;\r\n }\r\n }\r\n });\r\n this._onGamepadDisconnectedObserver = manager.onGamepadDisconnectedObservable.add(function (gamepad) {\r\n if (_this.gamepad === gamepad) {\r\n _this.gamepad = null;\r\n }\r\n });\r\n this.gamepad = manager.getGamepadByType(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].XBOX);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraGamepadInput.prototype.detachControl = function (element) {\r\n this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);\r\n this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);\r\n this.gamepad = null;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraGamepadInput.prototype.checkInputs = function () {\r\n if (this.gamepad && this.gamepad.leftStick) {\r\n var camera = this.camera;\r\n var LSValues = this.gamepad.leftStick;\r\n var normalizedLX = LSValues.x / this.gamepadMoveSensibility;\r\n var normalizedLY = LSValues.y / this.gamepadMoveSensibility;\r\n LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;\r\n LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;\r\n var RSValues = this.gamepad.rightStick;\r\n if (RSValues) {\r\n var normalizedRX = RSValues.x / this.gamepadAngularSensibility;\r\n var normalizedRY = RSValues.y / this.gamepadAngularSensibility;\r\n RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;\r\n RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 0;\r\n }\r\n else {\r\n RSValues = { x: 0, y: 0 };\r\n }\r\n if (!camera.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, this._cameraTransform);\r\n }\r\n else {\r\n camera.rotationQuaternion.toRotationMatrix(this._cameraTransform);\r\n }\r\n var speed = camera._computeLocalCameraSpeed() * 50.0;\r\n this._vector3.copyFromFloats(LSValues.x * speed, 0, -LSValues.y * speed);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._vector3, this._cameraTransform, this._deltaTransform);\r\n camera.cameraDirection.addInPlace(this._deltaTransform);\r\n this._vector2.copyFromFloats(RSValues.y, RSValues.x);\r\n camera.cameraRotation.addInPlace(this._vector2);\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraGamepadInput.prototype.getClassName = function () {\r\n return \"FreeCameraGamepadInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraGamepadInput.prototype.getSimpleName = function () {\r\n return \"gamepad\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraGamepadInput.prototype, \"gamepadAngularSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraGamepadInput.prototype, \"gamepadMoveSensibility\", void 0);\r\n return FreeCameraGamepadInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FreeCameraGamepadInput\"] = FreeCameraGamepadInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraKeyboardMoveInput.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraKeyboardMoveInput.ts ***!\n \\*******************************************************/\n/*! exports provided: FreeCameraKeyboardMoveInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return FreeCameraKeyboardMoveInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the keyboard inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraKeyboardMoveInput = /** @class */ (function () {\r\n function FreeCameraKeyboardMoveInput() {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n this.keysRight = [39];\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_3__[\"KeyboardEventTypes\"].KEYDOWN) {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysDown.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysLeft.indexOf(evt.keyCode) !== -1 ||\r\n _this.keysRight.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.detachControl = function (element) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n // Keyboard\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n var speed = camera._computeLocalCameraSpeed();\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(-speed, 0, 0);\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, speed);\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(speed, 0, 0);\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, -speed);\r\n }\r\n if (camera.getScene().useRightHandedSystem) {\r\n camera._localDirection.z *= -1;\r\n }\r\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);\r\n camera.cameraDirection.addInPlace(camera._transformedDirection);\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"FreeCameraKeyboardMoveInput\";\r\n };\r\n /** @hidden */\r\n FreeCameraKeyboardMoveInput.prototype._onLostFocus = function () {\r\n this._keys = [];\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n return FreeCameraKeyboardMoveInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FreeCameraKeyboardMoveInput\"] = FreeCameraKeyboardMoveInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraMouseInput.ts\":\n/*!************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraMouseInput.ts ***!\n \\************************************************/\n/*! exports provided: FreeCameraMouseInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return FreeCameraMouseInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraMouseInput = /** @class */ (function () {\r\n /**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param touchEnabled Defines if touch is enabled or not\r\n */\r\n function FreeCameraMouseInput(\r\n /**\r\n * Define if touch is enabled in the mouse input\r\n */\r\n touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n this.touchEnabled = touchEnabled;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\r\n */\r\n this.angularSensibility = 2000.0;\r\n this.previousPosition = null;\r\n /**\r\n * Observable for when a pointer move event occurs containing the move offset\r\n */\r\n this.onPointerMovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * @hidden\r\n * If the camera should be rotated automatically based on pointer movement\r\n */\r\n this._allowCameraRotation = true;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraMouseInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var engine = this.camera.getEngine();\r\n if (!this._pointerInput) {\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (!_this.touchEnabled && evt.pointerType === \"touch\") {\r\n return;\r\n }\r\n if (p.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE && _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element.focus();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!_this.previousPosition || engine.isPointerLock) {\r\n return;\r\n }\r\n var offsetX = evt.clientX - _this.previousPosition.x;\r\n var offsetY = evt.clientY - _this.previousPosition.y;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n if (_this._allowCameraRotation) {\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n }\r\n _this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n };\r\n }\r\n this._onMouseMove = function (evt) {\r\n if (!engine.isPointerLock) {\r\n return;\r\n }\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERUP | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__[\"PointerEventTypes\"].POINTERMOVE);\r\n element.addEventListener(\"mousemove\", this._onMouseMove, false);\r\n element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n FreeCameraMouseInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraMouseInput.prototype.detachControl = function (element) {\r\n if (this._observer && element) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n if (this._onMouseMove) {\r\n element.removeEventListener(\"mousemove\", this._onMouseMove);\r\n }\r\n if (this.onContextMenu) {\r\n element.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n if (this.onPointerMovedObservable) {\r\n this.onPointerMovedObservable.clear();\r\n }\r\n this._observer = null;\r\n this._onMouseMove = null;\r\n this.previousPosition = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraMouseInput.prototype.getClassName = function () {\r\n return \"FreeCameraMouseInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraMouseInput.prototype.getSimpleName = function () {\r\n return \"mouse\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FreeCameraMouseInput.prototype, \"buttons\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], FreeCameraMouseInput.prototype, \"angularSensibility\", void 0);\r\n return FreeCameraMouseInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"CameraInputTypes\"][\"FreeCameraMouseInput\"] = FreeCameraMouseInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraTouchInput.ts\":\n/*!************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraTouchInput.ts ***!\n \\************************************************/\n/*! exports provided: FreeCameraTouchInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return FreeCameraTouchInput; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraTouchInput = /** @class */ (function () {\r\n function FreeCameraTouchInput() {\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The higher the faster.\r\n */\r\n this.touchAngularSensibility = 200000.0;\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The higher the faster.\r\n */\r\n this.touchMoveSensibility = 250.0;\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n this._pointerPressed = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraTouchInput.prototype.attachControl = function (element, noPreventDefault) {\r\n var _this = this;\r\n var previousPosition = null;\r\n if (this._pointerInput === undefined) {\r\n this._onLostFocus = function () {\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n };\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n if (evt.pointerType === \"mouse\") {\r\n return;\r\n }\r\n if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n _this._pointerPressed.push(evt.pointerId);\r\n if (_this._pointerPressed.length !== 1) {\r\n return;\r\n }\r\n previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY\r\n };\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index === -1) {\r\n return;\r\n }\r\n _this._pointerPressed.splice(index, 1);\r\n if (index != 0) {\r\n return;\r\n }\r\n previousPosition = null;\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n }\r\n else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n if (!previousPosition) {\r\n return;\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index != 0) {\r\n return;\r\n }\r\n _this._offsetX = evt.clientX - previousPosition.x;\r\n _this._offsetY = -(evt.clientY - previousPosition.y);\r\n }\r\n };\r\n }\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERDOWN | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERUP | _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_3__[\"PointerEventTypes\"].POINTERMOVE);\r\n if (this._onLostFocus) {\r\n element.addEventListener(\"blur\", this._onLostFocus);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraTouchInput.prototype.detachControl = function (element) {\r\n if (this._pointerInput && element) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n }\r\n if (this._onLostFocus) {\r\n element.removeEventListener(\"blur\", this._onLostFocus);\r\n this._onLostFocus = null;\r\n }\r\n this._pointerPressed = [];\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n }\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraTouchInput.prototype.checkInputs = function () {\r\n if (this._offsetX && this._offsetY) {\r\n var camera = this.camera;\r\n camera.cameraRotation.y += this._offsetX / this.touchAngularSensibility;\r\n if (this._pointerPressed.length > 1) {\r\n camera.cameraRotation.x += -this._offsetY / this.touchAngularSensibility;\r\n }\r\n else {\r\n var speed = camera._computeLocalCameraSpeed();\r\n var direction = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](0, 0, speed * this._offsetY / this.touchMoveSensibility);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);\r\n camera.cameraDirection.addInPlace(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinates(direction, camera._cameraRotationMatrix));\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraTouchInput.prototype.getClassName = function () {\r\n return \"FreeCameraTouchInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraTouchInput.prototype.getSimpleName = function () {\r\n return \"touch\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraTouchInput.prototype, \"touchAngularSensibility\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCameraTouchInput.prototype, \"touchMoveSensibility\", void 0);\r\n return FreeCameraTouchInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_2__[\"CameraInputTypes\"][\"FreeCameraTouchInput\"] = FreeCameraTouchInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/freeCameraVirtualJoystickInput.ts\":\n/*!**********************************************************!*\\\n !*** ./Cameras/Inputs/freeCameraVirtualJoystickInput.ts ***!\n \\**********************************************************/\n/*! exports provided: FreeCameraVirtualJoystickInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return FreeCameraVirtualJoystickInput; });\n/* harmony import */ var _Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/virtualJoystick */ \"./Misc/virtualJoystick.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n/**\r\n* Add virtual joystick input support to the input manager.\r\n* @returns the current input manager\r\n*/\r\n_Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraInputsManager\"].prototype.addVirtualJoystick = function () {\r\n this.add(new FreeCameraVirtualJoystickInput());\r\n return this;\r\n};\r\n/**\r\n * Manage the Virtual Joystick inputs to control the movement of a free camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraVirtualJoystickInput = /** @class */ (function () {\r\n function FreeCameraVirtualJoystickInput() {\r\n }\r\n /**\r\n * Gets the left stick of the virtual joystick.\r\n * @returns The virtual Joystick\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getLeftJoystick = function () {\r\n return this._leftjoystick;\r\n };\r\n /**\r\n * Gets the right stick of the virtual joystick.\r\n * @returns The virtual Joystick\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getRightJoystick = function () {\r\n return this._rightjoystick;\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.checkInputs = function () {\r\n if (this._leftjoystick) {\r\n var camera = this.camera;\r\n var speed = camera._computeLocalCameraSpeed() * 50;\r\n var cameraTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, 0);\r\n var deltaTransform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](this._leftjoystick.deltaPosition.x * speed, this._leftjoystick.deltaPosition.y * speed, this._leftjoystick.deltaPosition.z * speed), cameraTransform);\r\n camera.cameraDirection = camera.cameraDirection.add(deltaTransform);\r\n camera.cameraRotation = camera.cameraRotation.addVector3(this._rightjoystick.deltaPosition);\r\n if (!this._leftjoystick.pressed) {\r\n this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(0.9);\r\n }\r\n if (!this._rightjoystick.pressed) {\r\n this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(0.9);\r\n }\r\n }\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.attachControl = function (element, noPreventDefault) {\r\n this._leftjoystick = new _Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoystick\"](true);\r\n this._leftjoystick.setAxisForUpDown(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].Z);\r\n this._leftjoystick.setAxisForLeftRight(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].X);\r\n this._leftjoystick.setJoystickSensibility(0.15);\r\n this._rightjoystick = new _Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoystick\"](false);\r\n this._rightjoystick.setAxisForUpDown(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].X);\r\n this._rightjoystick.setAxisForLeftRight(_Misc_virtualJoystick__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"].Y);\r\n this._rightjoystick.reverseUpDown = true;\r\n this._rightjoystick.setJoystickSensibility(0.05);\r\n this._rightjoystick.setJoystickColor(\"yellow\");\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.detachControl = function (element) {\r\n this._leftjoystick.releaseCanvas();\r\n this._rightjoystick.releaseCanvas();\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getClassName = function () {\r\n return \"FreeCameraVirtualJoystickInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraVirtualJoystickInput.prototype.getSimpleName = function () {\r\n return \"virtualJoystick\";\r\n };\r\n return FreeCameraVirtualJoystickInput;\r\n}());\r\n\r\n_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputTypes\"][\"FreeCameraVirtualJoystickInput\"] = FreeCameraVirtualJoystickInput;\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Inputs/index.ts\":\n/*!*********************************!*\\\n !*** ./Cameras/Inputs/index.ts ***!\n \\*********************************/\n/*! exports provided: ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arcRotateCameraGamepadInput */ \"./Cameras/Inputs/arcRotateCameraGamepadInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony import */ var _arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./arcRotateCameraKeyboardMoveInput */ \"./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_1__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony import */ var _arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./arcRotateCameraMouseWheelInput */ \"./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony import */ var _arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arcRotateCameraPointersInput */ \"./Cameras/Inputs/arcRotateCameraPointersInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_3__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony import */ var _arcRotateCameraVRDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./arcRotateCameraVRDeviceOrientationInput */ \"./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _arcRotateCameraVRDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_4__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony import */ var _flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flyCameraKeyboardInput */ \"./Cameras/Inputs/flyCameraKeyboardInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_5__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony import */ var _flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flyCameraMouseInput */ \"./Cameras/Inputs/flyCameraMouseInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_6__[\"FlyCameraMouseInput\"]; });\n\n/* harmony import */ var _followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./followCameraKeyboardMoveInput */ \"./Cameras/Inputs/followCameraKeyboardMoveInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony import */ var _followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./followCameraMouseWheelInput */ \"./Cameras/Inputs/followCameraMouseWheelInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_8__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony import */ var _followCameraPointersInput__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./followCameraPointersInput */ \"./Cameras/Inputs/followCameraPointersInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _followCameraPointersInput__WEBPACK_IMPORTED_MODULE_9__[\"FollowCameraPointersInput\"]; });\n\n/* harmony import */ var _freeCameraDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./freeCameraDeviceOrientationInput */ \"./Cameras/Inputs/freeCameraDeviceOrientationInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _freeCameraDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_10__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony import */ var _freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./freeCameraGamepadInput */ \"./Cameras/Inputs/freeCameraGamepadInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_11__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony import */ var _freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./freeCameraKeyboardMoveInput */ \"./Cameras/Inputs/freeCameraKeyboardMoveInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_12__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony import */ var _freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./freeCameraMouseInput */ \"./Cameras/Inputs/freeCameraMouseInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_13__[\"FreeCameraMouseInput\"]; });\n\n/* harmony import */ var _freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./freeCameraTouchInput */ \"./Cameras/Inputs/freeCameraTouchInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_14__[\"FreeCameraTouchInput\"]; });\n\n/* harmony import */ var _freeCameraVirtualJoystickInput__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./freeCameraVirtualJoystickInput */ \"./Cameras/Inputs/freeCameraVirtualJoystickInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _freeCameraVirtualJoystickInput__WEBPACK_IMPORTED_MODULE_15__[\"FreeCameraVirtualJoystickInput\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts ***!\n \\*********************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../PostProcesses/anaglyphPostProcess */ \"./PostProcesses/anaglyphPostProcess.ts\");\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setStereoscopicAnaglyphRigMode = function (camera) {\r\n camera._rigCameras[0]._rigPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__[\"PassPostProcess\"](camera.name + \"_passthru\", 1.0, camera._rigCameras[0]);\r\n camera._rigCameras[1]._rigPostProcess = new _PostProcesses_anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"AnaglyphPostProcess\"](camera.name + \"_anaglyph\", 1.0, camera._rigCameras);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/stereoscopicRigMode.ts\":\n/*!*************************************************!*\\\n !*** ./Cameras/RigModes/stereoscopicRigMode.ts ***!\n \\*************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../PostProcesses/stereoscopicInterlacePostProcess */ \"./PostProcesses/stereoscopicInterlacePostProcess.ts\");\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setStereoscopicRigMode = function (camera) {\r\n var isStereoscopicHoriz = camera.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL || camera.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;\r\n camera._rigCameras[0]._rigPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_1__[\"PassPostProcess\"](camera.name + \"_passthru\", 1.0, camera._rigCameras[0]);\r\n camera._rigCameras[1]._rigPostProcess = new _PostProcesses_stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_2__[\"StereoscopicInterlacePostProcess\"](camera.name + \"_stereoInterlace\", camera._rigCameras, isStereoscopicHoriz);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/vrRigMode.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/RigModes/vrRigMode.ts ***!\n \\***************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _PostProcesses_vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../PostProcesses/vrDistortionCorrectionPostProcess */ \"./PostProcesses/vrDistortionCorrectionPostProcess.ts\");\n/* harmony import */ var _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../PostProcesses/vrMultiviewToSingleviewPostProcess */ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\");\n/* harmony import */ var _VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../VR/vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setVRRigMode = function (camera, rigParams) {\r\n var metrics = rigParams.vrCameraMetrics || _VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_4__[\"VRCameraMetrics\"].GetDefault();\r\n camera._rigCameras[0]._cameraRigParams.vrMetrics = metrics;\r\n camera._rigCameras[0].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_6__[\"Viewport\"](0, 0, 0.5, 1.0);\r\n camera._rigCameras[0]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[0]._cameraRigParams.vrHMatrix = metrics.leftHMatrix;\r\n camera._rigCameras[0]._cameraRigParams.vrPreViewMatrix = metrics.leftPreViewMatrix;\r\n camera._rigCameras[0].getProjectionMatrix = camera._rigCameras[0]._getVRProjectionMatrix;\r\n camera._rigCameras[1]._cameraRigParams.vrMetrics = metrics;\r\n camera._rigCameras[1].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_6__[\"Viewport\"](0.5, 0, 0.5, 1.0);\r\n camera._rigCameras[1]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[1]._cameraRigParams.vrHMatrix = metrics.rightHMatrix;\r\n camera._rigCameras[1]._cameraRigParams.vrPreViewMatrix = metrics.rightPreViewMatrix;\r\n camera._rigCameras[1].getProjectionMatrix = camera._rigCameras[1]._getVRProjectionMatrix;\r\n // For multiview on a webVR camera\r\n // First multiview will be rendered to camera._multiviewTexture\r\n // Then this postprocess will run on each eye to copy the right texture to each eye\r\n if (metrics.multiviewEnabled) {\r\n if (!camera.getScene().getEngine().getCaps().multiview) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Warn(\"Multiview is not supported, falling back to standard rendering\");\r\n metrics.multiviewEnabled = false;\r\n }\r\n else {\r\n camera._useMultiviewToSingleView = true;\r\n camera._rigPostProcess = new _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_3__[\"VRMultiviewToSingleviewPostProcess\"](\"VRMultiviewToSingleview\", camera, metrics.postProcessScaleFactor);\r\n }\r\n }\r\n if (metrics.compensateDistortion) {\r\n camera._rigCameras[0]._rigPostProcess = new _PostProcesses_vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"VRDistortionCorrectionPostProcess\"](\"VR_Distort_Compensation_Left\", camera._rigCameras[0], false, metrics);\r\n camera._rigCameras[1]._rigPostProcess = new _PostProcesses_vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"VRDistortionCorrectionPostProcess\"](\"VR_Distort_Compensation_Right\", camera._rigCameras[1], true, metrics);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/RigModes/webVRRigMode.ts\":\n/*!******************************************!*\\\n !*** ./Cameras/RigModes/webVRRigMode.ts ***!\n \\******************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]._setWebVRRigMode = function (camera, rigParams) {\r\n if (rigParams.vrDisplay) {\r\n var leftEye = rigParams.vrDisplay.getEyeParameters('left');\r\n var rightEye = rigParams.vrDisplay.getEyeParameters('right');\r\n //Left eye\r\n camera._rigCameras[0].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_2__[\"Viewport\"](0, 0, 0.5, 1.0);\r\n camera._rigCameras[0].setCameraRigParameter(\"left\", true);\r\n //leaving this for future reference\r\n camera._rigCameras[0].setCameraRigParameter(\"specs\", rigParams.specs);\r\n camera._rigCameras[0].setCameraRigParameter(\"eyeParameters\", leftEye);\r\n camera._rigCameras[0].setCameraRigParameter(\"frameData\", rigParams.frameData);\r\n camera._rigCameras[0].setCameraRigParameter(\"parentCamera\", rigParams.parentCamera);\r\n camera._rigCameras[0]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[0].getProjectionMatrix = camera._getWebVRProjectionMatrix;\r\n camera._rigCameras[0].parent = camera;\r\n camera._rigCameras[0]._getViewMatrix = camera._getWebVRViewMatrix;\r\n //Right eye\r\n camera._rigCameras[1].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_2__[\"Viewport\"](0.5, 0, 0.5, 1.0);\r\n camera._rigCameras[1].setCameraRigParameter('eyeParameters', rightEye);\r\n camera._rigCameras[1].setCameraRigParameter(\"specs\", rigParams.specs);\r\n camera._rigCameras[1].setCameraRigParameter(\"frameData\", rigParams.frameData);\r\n camera._rigCameras[1].setCameraRigParameter(\"parentCamera\", rigParams.parentCamera);\r\n camera._rigCameras[1]._cameraRigParams.vrWorkMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n camera._rigCameras[1].getProjectionMatrix = camera._getWebVRProjectionMatrix;\r\n camera._rigCameras[1].parent = camera;\r\n camera._rigCameras[1]._getViewMatrix = camera._getWebVRViewMatrix;\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphArcRotateCamera.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphArcRotateCamera.ts ***!\n \\*********************************************************/\n/*! exports provided: AnaglyphArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return AnaglyphArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphArcRotateCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on ArcRotateCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphArcRotateCamera, _super);\r\n /**\r\n * Creates a new AnaglyphArcRotateCamera\r\n * @param name defines camera name\r\n * @param alpha defines alpha angle (in radians)\r\n * @param beta defines beta angle (in radians)\r\n * @param radius defines radius\r\n * @param target defines camera target\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphArcRotateCamera(name, alpha, beta, radius, target, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, alpha, beta, radius, target, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphArcRotateCamera\r\n */\r\n AnaglyphArcRotateCamera.prototype.getClassName = function () {\r\n return \"AnaglyphArcRotateCamera\";\r\n };\r\n return AnaglyphArcRotateCamera;\r\n}(_Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphFreeCamera.ts\":\n/*!****************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphFreeCamera.ts ***!\n \\****************************************************/\n/*! exports provided: AnaglyphFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return AnaglyphFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphFreeCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on FreeCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphFreeCamera, _super);\r\n /**\r\n * Creates a new AnaglyphFreeCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphFreeCamera(name, position, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphFreeCamera\r\n */\r\n AnaglyphFreeCamera.prototype.getClassName = function () {\r\n return \"AnaglyphFreeCamera\";\r\n };\r\n return AnaglyphFreeCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphGamepadCamera.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphGamepadCamera.ts ***!\n \\*******************************************************/\n/*! exports provided: AnaglyphGamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return AnaglyphGamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/gamepadCamera */ \"./Cameras/gamepadCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphGamepadCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphGamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on GamepadCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphGamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphGamepadCamera, _super);\r\n /**\r\n * Creates a new AnaglyphGamepadCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphGamepadCamera(name, position, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphGamepadCamera\r\n */\r\n AnaglyphGamepadCamera.prototype.getClassName = function () {\r\n return \"AnaglyphGamepadCamera\";\r\n };\r\n return AnaglyphGamepadCamera;\r\n}(_Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__[\"GamepadCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/anaglyphUniversalCamera.ts\":\n/*!*********************************************************!*\\\n !*** ./Cameras/Stereoscopic/anaglyphUniversalCamera.ts ***!\n \\*********************************************************/\n/*! exports provided: AnaglyphUniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return AnaglyphUniversalCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicAnaglyphRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicAnaglyphRigMode */ \"./Cameras/RigModes/stereoscopicAnaglyphRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"AnaglyphUniversalCamera\", function (name, scene, options) {\r\n return function () { return new AnaglyphUniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, scene); };\r\n});\r\n/**\r\n * Camera used to simulate anaglyphic rendering (based on UniversalCamera)\r\n * @see http://doc.babylonjs.com/features/cameras#anaglyph-cameras\r\n */\r\nvar AnaglyphUniversalCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphUniversalCamera, _super);\r\n /**\r\n * Creates a new AnaglyphUniversalCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param scene defines the hosting scene\r\n */\r\n function AnaglyphUniversalCamera(name, position, interaxialDistance, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns AnaglyphUniversalCamera\r\n */\r\n AnaglyphUniversalCamera.prototype.getClassName = function () {\r\n return \"AnaglyphUniversalCamera\";\r\n };\r\n return AnaglyphUniversalCamera;\r\n}(_Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__[\"UniversalCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/index.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/Stereoscopic/index.ts ***!\n \\***************************************/\n/*! exports provided: AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _anaglyphArcRotateCamera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./anaglyphArcRotateCamera */ \"./Cameras/Stereoscopic/anaglyphArcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _anaglyphArcRotateCamera__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony import */ var _anaglyphFreeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./anaglyphFreeCamera */ \"./Cameras/Stereoscopic/anaglyphFreeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _anaglyphFreeCamera__WEBPACK_IMPORTED_MODULE_1__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony import */ var _anaglyphGamepadCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./anaglyphGamepadCamera */ \"./Cameras/Stereoscopic/anaglyphGamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _anaglyphGamepadCamera__WEBPACK_IMPORTED_MODULE_2__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony import */ var _anaglyphUniversalCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./anaglyphUniversalCamera */ \"./Cameras/Stereoscopic/anaglyphUniversalCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _anaglyphUniversalCamera__WEBPACK_IMPORTED_MODULE_3__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony import */ var _stereoscopicArcRotateCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stereoscopicArcRotateCamera */ \"./Cameras/Stereoscopic/stereoscopicArcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _stereoscopicArcRotateCamera__WEBPACK_IMPORTED_MODULE_4__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony import */ var _stereoscopicFreeCamera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stereoscopicFreeCamera */ \"./Cameras/Stereoscopic/stereoscopicFreeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _stereoscopicFreeCamera__WEBPACK_IMPORTED_MODULE_5__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony import */ var _stereoscopicGamepadCamera__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stereoscopicGamepadCamera */ \"./Cameras/Stereoscopic/stereoscopicGamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _stereoscopicGamepadCamera__WEBPACK_IMPORTED_MODULE_6__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony import */ var _stereoscopicUniversalCamera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stereoscopicUniversalCamera */ \"./Cameras/Stereoscopic/stereoscopicUniversalCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _stereoscopicUniversalCamera__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicUniversalCamera\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicArcRotateCamera.ts\":\n/*!*************************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicArcRotateCamera.ts ***!\n \\*************************************************************/\n/*! exports provided: StereoscopicArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return StereoscopicArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicArcRotateCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on ArcRotateCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicArcRotateCamera, _super);\r\n /**\r\n * Creates a new StereoscopicArcRotateCamera\r\n * @param name defines camera name\r\n * @param alpha defines alpha angle (in radians)\r\n * @param beta defines beta angle (in radians)\r\n * @param radius defines radius\r\n * @param target defines camera target\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicArcRotateCamera(name, alpha, beta, radius, target, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, alpha, beta, radius, target, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicArcRotateCamera\r\n */\r\n StereoscopicArcRotateCamera.prototype.getClassName = function () {\r\n return \"StereoscopicArcRotateCamera\";\r\n };\r\n return StereoscopicArcRotateCamera;\r\n}(_Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicFreeCamera.ts\":\n/*!********************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicFreeCamera.ts ***!\n \\********************************************************/\n/*! exports provided: StereoscopicFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return StereoscopicFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicFreeCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on FreeCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicFreeCamera, _super);\r\n /**\r\n * Creates a new StereoscopicFreeCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicFreeCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicFreeCamera\r\n */\r\n StereoscopicFreeCamera.prototype.getClassName = function () {\r\n return \"StereoscopicFreeCamera\";\r\n };\r\n return StereoscopicFreeCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicGamepadCamera.ts\":\n/*!***********************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicGamepadCamera.ts ***!\n \\***********************************************************/\n/*! exports provided: StereoscopicGamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return StereoscopicGamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/gamepadCamera */ \"./Cameras/gamepadCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicGamepadCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicGamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on GamepadCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicGamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicGamepadCamera, _super);\r\n /**\r\n * Creates a new StereoscopicGamepadCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicGamepadCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicGamepadCamera\r\n */\r\n StereoscopicGamepadCamera.prototype.getClassName = function () {\r\n return \"StereoscopicGamepadCamera\";\r\n };\r\n return StereoscopicGamepadCamera;\r\n}(_Cameras_gamepadCamera__WEBPACK_IMPORTED_MODULE_2__[\"GamepadCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/Stereoscopic/stereoscopicUniversalCamera.ts\":\n/*!*************************************************************!*\\\n !*** ./Cameras/Stereoscopic/stereoscopicUniversalCamera.ts ***!\n \\*************************************************************/\n/*! exports provided: StereoscopicUniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return StereoscopicUniversalCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_stereoscopicRigMode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../RigModes/stereoscopicRigMode */ \"./Cameras/RigModes/stereoscopicRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"StereoscopicFreeCamera\", function (name, scene, options) {\r\n return function () { return new StereoscopicUniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), options.interaxial_distance, options.isStereoscopicSideBySide, scene); };\r\n});\r\n/**\r\n * Camera used to simulate stereoscopic rendering (based on UniversalCamera)\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar StereoscopicUniversalCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicUniversalCamera, _super);\r\n /**\r\n * Creates a new StereoscopicUniversalCamera\r\n * @param name defines camera name\r\n * @param position defines initial position\r\n * @param interaxialDistance defines distance between each color axis\r\n * @param isStereoscopicSideBySide defines is stereoscopic is done side by side or over under\r\n * @param scene defines the hosting scene\r\n */\r\n function StereoscopicUniversalCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.interaxialDistance = interaxialDistance;\r\n _this.isStereoscopicSideBySide = isStereoscopicSideBySide;\r\n _this.setCameraRigMode(isStereoscopicSideBySide ? _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns StereoscopicUniversalCamera\r\n */\r\n StereoscopicUniversalCamera.prototype.getClassName = function () {\r\n return \"StereoscopicUniversalCamera\";\r\n };\r\n return StereoscopicUniversalCamera;\r\n}(_Cameras_universalCamera__WEBPACK_IMPORTED_MODULE_2__[\"UniversalCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/index.ts\":\n/*!*****************************!*\\\n !*** ./Cameras/VR/index.ts ***!\n \\*****************************/\n/*! exports provided: VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_0__[\"VRCameraMetrics\"]; });\n\n/* harmony import */ var _vrDeviceOrientationArcRotateCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vrDeviceOrientationArcRotateCamera */ \"./Cameras/VR/vrDeviceOrientationArcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _vrDeviceOrientationArcRotateCamera__WEBPACK_IMPORTED_MODULE_1__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony import */ var _vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vrDeviceOrientationFreeCamera */ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_2__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony import */ var _vrDeviceOrientationGamepadCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vrDeviceOrientationGamepadCamera */ \"./Cameras/VR/vrDeviceOrientationGamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _vrDeviceOrientationGamepadCamera__WEBPACK_IMPORTED_MODULE_3__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony import */ var _vrExperienceHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./vrExperienceHelper */ \"./Cameras/VR/vrExperienceHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _vrExperienceHelper__WEBPACK_IMPORTED_MODULE_4__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _vrExperienceHelper__WEBPACK_IMPORTED_MODULE_4__[\"VRExperienceHelper\"]; });\n\n/* harmony import */ var _webVRCamera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webVRCamera */ \"./Cameras/VR/webVRCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _webVRCamera__WEBPACK_IMPORTED_MODULE_5__[\"WebVRFreeCamera\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrCameraMetrics.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/VR/vrCameraMetrics.ts ***!\n \\***************************************/\n/*! exports provided: VRCameraMetrics */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return VRCameraMetrics; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * This represents all the required metrics to create a VR camera.\r\n * @see http://doc.babylonjs.com/babylon101/cameras#device-orientation-camera\r\n */\r\nvar VRCameraMetrics = /** @class */ (function () {\r\n function VRCameraMetrics() {\r\n /**\r\n * Define if the current vr camera should compensate the distortion of the lense or not.\r\n */\r\n this.compensateDistortion = true;\r\n /**\r\n * Defines if multiview should be enabled when rendering (Default: false)\r\n */\r\n this.multiviewEnabled = false;\r\n }\r\n Object.defineProperty(VRCameraMetrics.prototype, \"aspectRatio\", {\r\n /**\r\n * Gets the rendering aspect ratio based on the provided resolutions.\r\n */\r\n get: function () {\r\n return this.hResolution / (2 * this.vResolution);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"aspectRatioFov\", {\r\n /**\r\n * Gets the aspect ratio based on the FOV, scale factors, and real screen sizes.\r\n */\r\n get: function () {\r\n return (2 * Math.atan((this.postProcessScaleFactor * this.vScreenSize) / (2 * this.eyeToScreenDistance)));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"leftHMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);\r\n var h = (4 * meters) / this.hScreenSize;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(h, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"rightHMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);\r\n var h = (4 * meters) / this.hScreenSize;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(-h, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"leftPreViewMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(0.5 * this.interpupillaryDistance, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRCameraMetrics.prototype, \"rightPreViewMatrix\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(-0.5 * this.interpupillaryDistance, 0, 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the default VRMetrics based on the most generic setup.\r\n * @returns the default vr metrics\r\n */\r\n VRCameraMetrics.GetDefault = function () {\r\n var result = new VRCameraMetrics();\r\n result.hResolution = 1280;\r\n result.vResolution = 800;\r\n result.hScreenSize = 0.149759993;\r\n result.vScreenSize = 0.0935999975;\r\n result.vScreenCenter = 0.0467999987;\r\n result.eyeToScreenDistance = 0.0410000011;\r\n result.lensSeparationDistance = 0.0635000020;\r\n result.interpupillaryDistance = 0.0640000030;\r\n result.distortionK = [1.0, 0.219999999, 0.239999995, 0.0];\r\n result.chromaAbCorrection = [0.995999992, -0.00400000019, 1.01400006, 0.0];\r\n result.postProcessScaleFactor = 1.714605507808412;\r\n result.lensCenterOffset = 0.151976421;\r\n return result;\r\n };\r\n return VRCameraMetrics;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrDeviceOrientationArcRotateCamera.ts\":\n/*!**********************************************************!*\\\n !*** ./Cameras/VR/vrDeviceOrientationArcRotateCamera.ts ***!\n \\**********************************************************/\n/*! exports provided: VRDeviceOrientationArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return VRDeviceOrientationArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _Inputs_arcRotateCameraVRDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Inputs/arcRotateCameraVRDeviceOrientationInput */ \"./Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts\");\n/* harmony import */ var _RigModes_vrRigMode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../RigModes/vrRigMode */ \"./Cameras/RigModes/vrRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"VRDeviceOrientationFreeCamera\", function (name, scene) {\r\n return function () { return new VRDeviceOrientationArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * Camera used to simulate VR rendering (based on ArcRotateCamera)\r\n * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras\r\n */\r\nvar VRDeviceOrientationArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDeviceOrientationArcRotateCamera, _super);\r\n /**\r\n * Creates a new VRDeviceOrientationArcRotateCamera\r\n * @param name defines camera name\r\n * @param alpha defines the camera rotation along the logitudinal axis\r\n * @param beta defines the camera rotation along the latitudinal axis\r\n * @param radius defines the camera distance from its target\r\n * @param target defines the camera target\r\n * @param scene defines the scene the camera belongs to\r\n * @param compensateDistortion defines if the camera needs to compensate the lens distorsion\r\n * @param vrCameraMetrics defines the vr metrics associated to the camera\r\n */\r\n function VRDeviceOrientationArcRotateCamera(name, alpha, beta, radius, target, scene, compensateDistortion, vrCameraMetrics) {\r\n if (compensateDistortion === void 0) { compensateDistortion = true; }\r\n if (vrCameraMetrics === void 0) { vrCameraMetrics = _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__[\"VRCameraMetrics\"].GetDefault(); }\r\n var _this = _super.call(this, name, alpha, beta, radius, target, scene) || this;\r\n vrCameraMetrics.compensateDistortion = compensateDistortion;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });\r\n _this.inputs.addVRDeviceOrientation();\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns VRDeviceOrientationArcRotateCamera\r\n */\r\n VRDeviceOrientationArcRotateCamera.prototype.getClassName = function () {\r\n return \"VRDeviceOrientationArcRotateCamera\";\r\n };\r\n return VRDeviceOrientationArcRotateCamera;\r\n}(_Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\":\n/*!*****************************************************!*\\\n !*** ./Cameras/VR/vrDeviceOrientationFreeCamera.ts ***!\n \\*****************************************************/\n/*! exports provided: VRDeviceOrientationFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return VRDeviceOrientationFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/deviceOrientationCamera */ \"./Cameras/deviceOrientationCamera.ts\");\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _RigModes_vrRigMode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../RigModes/vrRigMode */ \"./Cameras/RigModes/vrRigMode.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"VRDeviceOrientationFreeCamera\", function (name, scene) {\r\n return function () { return new VRDeviceOrientationFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * Camera used to simulate VR rendering (based on FreeCamera)\r\n * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras\r\n */\r\nvar VRDeviceOrientationFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDeviceOrientationFreeCamera, _super);\r\n /**\r\n * Creates a new VRDeviceOrientationFreeCamera\r\n * @param name defines camera name\r\n * @param position defines the start position of the camera\r\n * @param scene defines the scene the camera belongs to\r\n * @param compensateDistortion defines if the camera needs to compensate the lens distorsion\r\n * @param vrCameraMetrics defines the vr metrics associated to the camera\r\n */\r\n function VRDeviceOrientationFreeCamera(name, position, scene, compensateDistortion, vrCameraMetrics) {\r\n if (compensateDistortion === void 0) { compensateDistortion = true; }\r\n if (vrCameraMetrics === void 0) { vrCameraMetrics = _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_3__[\"VRCameraMetrics\"].GetDefault(); }\r\n var _this = _super.call(this, name, position, scene) || this;\r\n vrCameraMetrics.compensateDistortion = compensateDistortion;\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns VRDeviceOrientationFreeCamera\r\n */\r\n VRDeviceOrientationFreeCamera.prototype.getClassName = function () {\r\n return \"VRDeviceOrientationFreeCamera\";\r\n };\r\n return VRDeviceOrientationFreeCamera;\r\n}(_Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_2__[\"DeviceOrientationCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrDeviceOrientationGamepadCamera.ts\":\n/*!********************************************************!*\\\n !*** ./Cameras/VR/vrDeviceOrientationGamepadCamera.ts ***!\n \\********************************************************/\n/*! exports provided: VRDeviceOrientationGamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return VRDeviceOrientationGamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vrDeviceOrientationFreeCamera */ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\");\n/* harmony import */ var _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _Gamepads_gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Gamepads/gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"VRDeviceOrientationGamepadCamera\", function (name, scene) {\r\n return function () { return new VRDeviceOrientationGamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * Camera used to simulate VR rendering (based on VRDeviceOrientationFreeCamera)\r\n * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras\r\n */\r\nvar VRDeviceOrientationGamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDeviceOrientationGamepadCamera, _super);\r\n /**\r\n * Creates a new VRDeviceOrientationGamepadCamera\r\n * @param name defines camera name\r\n * @param position defines the start position of the camera\r\n * @param scene defines the scene the camera belongs to\r\n * @param compensateDistortion defines if the camera needs to compensate the lens distorsion\r\n * @param vrCameraMetrics defines the vr metrics associated to the camera\r\n */\r\n function VRDeviceOrientationGamepadCamera(name, position, scene, compensateDistortion, vrCameraMetrics) {\r\n if (compensateDistortion === void 0) { compensateDistortion = true; }\r\n if (vrCameraMetrics === void 0) { vrCameraMetrics = _vrCameraMetrics__WEBPACK_IMPORTED_MODULE_2__[\"VRCameraMetrics\"].GetDefault(); }\r\n var _this = _super.call(this, name, position, scene, compensateDistortion, vrCameraMetrics) || this;\r\n _this.inputs.addGamepad();\r\n return _this;\r\n }\r\n /**\r\n * Gets camera class name\r\n * @returns VRDeviceOrientationGamepadCamera\r\n */\r\n VRDeviceOrientationGamepadCamera.prototype.getClassName = function () {\r\n return \"VRDeviceOrientationGamepadCamera\";\r\n };\r\n return VRDeviceOrientationGamepadCamera;\r\n}(_vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_1__[\"VRDeviceOrientationFreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/vrExperienceHelper.ts\":\n/*!******************************************!*\\\n !*** ./Cameras/VR/vrExperienceHelper.ts ***!\n \\******************************************/\n/*! exports provided: OnAfterEnteringVRObservableEvent, VRExperienceHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return OnAfterEnteringVRObservableEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return VRExperienceHelper; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Cameras/targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Cameras/deviceOrientationCamera */ \"./Cameras/deviceOrientationCamera.ts\");\n/* harmony import */ var _Cameras_VR_vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Cameras/VR/vrDeviceOrientationFreeCamera */ \"./Cameras/VR/vrDeviceOrientationFreeCamera.ts\");\n/* harmony import */ var _Cameras_VR_webVRCamera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Cameras/VR/webVRCamera */ \"./Cameras/VR/webVRCamera.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony import */ var _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Gamepads/Controllers/poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _Gamepads_Controllers_webVRController__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Gamepads/Controllers/webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _Gamepads_xboxGamepad__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Gamepads/xboxGamepad */ \"./Gamepads/xboxGamepad.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../PostProcesses/imageProcessingPostProcess */ \"./PostProcesses/imageProcessingPostProcess.ts\");\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n/* harmony import */ var _Cameras_VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../Cameras/VR/vrCameraMetrics */ \"./Cameras/VR/vrCameraMetrics.ts\");\n/* harmony import */ var _Meshes_Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../Meshes/Builders/groundBuilder */ \"./Meshes/Builders/groundBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_torusBuilder__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../Meshes/Builders/torusBuilder */ \"./Meshes/Builders/torusBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Gamepads_gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../../Gamepads/gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n/* harmony import */ var _Animations_animatable__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../../Animations/animatable */ \"./Animations/animatable.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar VRExperienceHelperGazer = /** @class */ (function () {\r\n function VRExperienceHelperGazer(scene, gazeTrackerToClone) {\r\n if (gazeTrackerToClone === void 0) { gazeTrackerToClone = null; }\r\n this.scene = scene;\r\n /** @hidden */\r\n this._pointerDownOnMeshAsked = false;\r\n /** @hidden */\r\n this._isActionableMesh = false;\r\n /** @hidden */\r\n this._teleportationRequestInitiated = false;\r\n /** @hidden */\r\n this._teleportationBackRequestInitiated = false;\r\n /** @hidden */\r\n this._rotationRightAsked = false;\r\n /** @hidden */\r\n this._rotationLeftAsked = false;\r\n /** @hidden */\r\n this._dpadPressed = true;\r\n /** @hidden */\r\n this._activePointer = false;\r\n this._id = VRExperienceHelperGazer._idCounter++;\r\n // Gaze tracker\r\n if (!gazeTrackerToClone) {\r\n this._gazeTracker = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateTorus(\"gazeTracker\", 0.0035, 0.0025, 20, scene, false);\r\n this._gazeTracker.bakeCurrentTransformIntoVertices();\r\n this._gazeTracker.isPickable = false;\r\n this._gazeTracker.isVisible = false;\r\n var targetMat = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__[\"StandardMaterial\"](\"targetMat\", scene);\r\n targetMat.specularColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"].Black();\r\n targetMat.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7);\r\n targetMat.backFaceCulling = false;\r\n this._gazeTracker.material = targetMat;\r\n }\r\n else {\r\n this._gazeTracker = gazeTrackerToClone.clone(\"gazeTracker\");\r\n }\r\n }\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._getForwardRay = function (length) {\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_16__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Zero(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, 0, length));\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._selectionPointerDown = function () {\r\n this._pointerDownOnMeshAsked = true;\r\n if (this._currentHit) {\r\n this.scene.simulatePointerDown(this._currentHit, { pointerId: this._id });\r\n }\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._selectionPointerUp = function () {\r\n if (this._currentHit) {\r\n this.scene.simulatePointerUp(this._currentHit, { pointerId: this._id });\r\n }\r\n this._pointerDownOnMeshAsked = false;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._activatePointer = function () {\r\n this._activePointer = true;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._deactivatePointer = function () {\r\n this._activePointer = false;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperGazer.prototype._updatePointerDistance = function (distance) {\r\n if (distance === void 0) { distance = 100; }\r\n };\r\n VRExperienceHelperGazer.prototype.dispose = function () {\r\n this._interactionsEnabled = false;\r\n this._teleportationEnabled = false;\r\n if (this._gazeTracker) {\r\n this._gazeTracker.dispose();\r\n }\r\n };\r\n VRExperienceHelperGazer._idCounter = 0;\r\n return VRExperienceHelperGazer;\r\n}());\r\nvar VRExperienceHelperControllerGazer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRExperienceHelperControllerGazer, _super);\r\n function VRExperienceHelperControllerGazer(webVRController, scene, gazeTrackerToClone) {\r\n var _this = _super.call(this, scene, gazeTrackerToClone) || this;\r\n _this.webVRController = webVRController;\r\n // Laser pointer\r\n _this._laserPointer = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateCylinder(\"laserPointer\", 1, 0.004, 0.0002, 20, 1, scene, false);\r\n var laserPointerMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__[\"StandardMaterial\"](\"laserPointerMat\", scene);\r\n laserPointerMaterial.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7);\r\n laserPointerMaterial.alpha = 0.6;\r\n _this._laserPointer.material = laserPointerMaterial;\r\n _this._laserPointer.rotation.x = Math.PI / 2;\r\n _this._laserPointer.position.z = -0.5;\r\n _this._laserPointer.isVisible = false;\r\n _this._laserPointer.isPickable = false;\r\n if (!webVRController.mesh) {\r\n // Create an empty mesh that is used prior to loading the high quality model\r\n var preloadMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"](\"preloadControllerMesh\", scene);\r\n var preloadPointerPose = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"](_Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__[\"PoseEnabledController\"].POINTING_POSE, scene);\r\n preloadPointerPose.rotation.x = -0.7;\r\n preloadMesh.addChild(preloadPointerPose);\r\n webVRController.attachToMesh(preloadMesh);\r\n }\r\n _this._setLaserPointerParent(webVRController.mesh);\r\n _this._meshAttachedObserver = webVRController._meshAttachedObservable.add(function (mesh) {\r\n _this._setLaserPointerParent(mesh);\r\n });\r\n return _this;\r\n }\r\n VRExperienceHelperControllerGazer.prototype._getForwardRay = function (length) {\r\n return this.webVRController.getForwardRay(length);\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._activatePointer = function () {\r\n _super.prototype._activatePointer.call(this);\r\n this._laserPointer.isVisible = true;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._deactivatePointer = function () {\r\n _super.prototype._deactivatePointer.call(this);\r\n this._laserPointer.isVisible = false;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._setLaserPointerColor = function (color) {\r\n this._laserPointer.material.emissiveColor = color;\r\n };\r\n /** @hidden */\r\n VRExperienceHelperControllerGazer.prototype._setLaserPointerParent = function (mesh) {\r\n var makeNotPick = function (root) {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach(function (c) {\r\n makeNotPick(c);\r\n });\r\n };\r\n makeNotPick(mesh);\r\n var meshChildren = mesh.getChildren(undefined, false);\r\n var laserParent = mesh;\r\n this.webVRController._pointingPoseNode = null;\r\n for (var i = 0; i < meshChildren.length; i++) {\r\n if (meshChildren[i].name && meshChildren[i].name.indexOf(_Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__[\"PoseEnabledController\"].POINTING_POSE) >= 0) {\r\n laserParent = meshChildren[i];\r\n this.webVRController._pointingPoseNode = laserParent;\r\n break;\r\n }\r\n }\r\n this._laserPointer.parent = laserParent;\r\n };\r\n VRExperienceHelperControllerGazer.prototype._updatePointerDistance = function (distance) {\r\n if (distance === void 0) { distance = 100; }\r\n this._laserPointer.scaling.y = distance;\r\n this._laserPointer.position.z = -distance / 2;\r\n };\r\n VRExperienceHelperControllerGazer.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this._laserPointer.dispose();\r\n if (this._meshAttachedObserver) {\r\n this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver);\r\n }\r\n };\r\n return VRExperienceHelperControllerGazer;\r\n}(VRExperienceHelperGazer));\r\nvar VRExperienceHelperCameraGazer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRExperienceHelperCameraGazer, _super);\r\n function VRExperienceHelperCameraGazer(getCamera, scene) {\r\n var _this = _super.call(this, scene) || this;\r\n _this.getCamera = getCamera;\r\n return _this;\r\n }\r\n VRExperienceHelperCameraGazer.prototype._getForwardRay = function (length) {\r\n var camera = this.getCamera();\r\n if (camera) {\r\n return camera.getForwardRay(length);\r\n }\r\n else {\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_16__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Forward());\r\n }\r\n };\r\n return VRExperienceHelperCameraGazer;\r\n}(VRExperienceHelperGazer));\r\n/**\r\n * Event containing information after VR has been entered\r\n */\r\nvar OnAfterEnteringVRObservableEvent = /** @class */ (function () {\r\n function OnAfterEnteringVRObservableEvent() {\r\n }\r\n return OnAfterEnteringVRObservableEvent;\r\n}());\r\n\r\n/**\r\n * Helps to quickly add VR support to an existing scene.\r\n * See http://doc.babylonjs.com/how_to/webvr_helper\r\n */\r\nvar VRExperienceHelper = /** @class */ (function () {\r\n /**\r\n * Instantiates a VRExperienceHelper.\r\n * Helps to quickly add VR support to an existing scene.\r\n * @param scene The scene the VRExperienceHelper belongs to.\r\n * @param webVROptions Options to modify the vr experience helper's behavior.\r\n */\r\n function VRExperienceHelper(scene, \r\n /** Options to modify the vr experience helper's behavior. */\r\n webVROptions) {\r\n var _this = this;\r\n if (webVROptions === void 0) { webVROptions = {}; }\r\n this.webVROptions = webVROptions;\r\n // Can the system support WebVR, even if a headset isn't plugged in?\r\n this._webVRsupported = false;\r\n // If WebVR is supported, is a headset plugged in and are we ready to present?\r\n this._webVRready = false;\r\n // Are we waiting for the requestPresent callback to complete?\r\n this._webVRrequesting = false;\r\n // Are we presenting to the headset right now? (this is the vrDevice state)\r\n this._webVRpresenting = false;\r\n // Are we presenting in the fullscreen fallback?\r\n this._fullscreenVRpresenting = false;\r\n /**\r\n * Gets or sets a boolean indicating that gaze can be enabled even if pointer lock is not engage (useful on iOS where fullscreen mode and pointer lock are not supported)\r\n */\r\n this.enableGazeEvenWhenNoPointerLock = false;\r\n /**\r\n * Gets or sets a boolean indicating that the VREXperienceHelper will exit VR if double tap is detected\r\n */\r\n this.exitVROnDoubleTap = true;\r\n /**\r\n * Observable raised right before entering VR.\r\n */\r\n this.onEnteringVRObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when entering VR has completed.\r\n */\r\n this.onAfterEnteringVRObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when exiting VR.\r\n */\r\n this.onExitingVRObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when controller mesh is loaded.\r\n */\r\n this.onControllerMeshLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this._useCustomVRButton = false;\r\n this._teleportationRequested = false;\r\n this._teleportActive = false;\r\n this._floorMeshesCollection = [];\r\n this._rotationAllowed = true;\r\n this._teleportBackwardsVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, -1, -1);\r\n this._isDefaultTeleportationTarget = true;\r\n this._teleportationFillColor = \"#444444\";\r\n this._teleportationBorderColor = \"#FFFFFF\";\r\n this._rotationAngle = 0;\r\n this._haloCenter = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, 0, 0);\r\n this._padSensibilityUp = 0.65;\r\n this._padSensibilityDown = 0.35;\r\n this._leftController = null;\r\n this._rightController = null;\r\n /**\r\n * Observable raised when a new mesh is selected based on meshSelectionPredicate\r\n */\r\n this.onNewMeshSelected = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when a new mesh is selected based on meshSelectionPredicate.\r\n * This observable will provide the mesh and the controller used to select the mesh\r\n */\r\n this.onMeshSelectedWithController = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when a new mesh is picked based on meshSelectionPredicate\r\n */\r\n this.onNewMeshPicked = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised before camera teleportation\r\n */\r\n this.onBeforeCameraTeleport = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised after camera teleportation\r\n */\r\n this.onAfterCameraTeleport = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Observable raised when current selected mesh gets unselected\r\n */\r\n this.onSelectedMeshUnselected = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Set teleportation enabled. If set to false camera teleportation will be disabled but camera rotation will be kept.\r\n */\r\n this.teleportationEnabled = true;\r\n this._teleportationInitialized = false;\r\n this._interactionsEnabled = false;\r\n this._interactionsRequested = false;\r\n this._displayGaze = true;\r\n this._displayLaserPointer = true;\r\n /**\r\n * If the gaze trackers scale should be updated to be constant size when pointing at near/far meshes\r\n */\r\n this.updateGazeTrackerScale = true;\r\n /**\r\n * If the gaze trackers color should be updated when selecting meshes\r\n */\r\n this.updateGazeTrackerColor = true;\r\n /**\r\n * If the controller laser color should be updated when selecting meshes\r\n */\r\n this.updateControllerLaserColor = true;\r\n /**\r\n * Defines wether or not Pointer lock should be requested when switching to\r\n * full screen.\r\n */\r\n this.requestPointerLockOnFullScreen = true;\r\n this._onResize = function () {\r\n _this.moveButtonToBottomRight();\r\n if (_this._fullscreenVRpresenting && _this._webVRready) {\r\n _this.exitVR();\r\n }\r\n };\r\n this._onFullscreenChange = function () {\r\n var anyDoc = document;\r\n if (anyDoc.fullscreen !== undefined) {\r\n _this._fullscreenVRpresenting = document.fullscreen;\r\n }\r\n else if (anyDoc.mozFullScreen !== undefined) {\r\n _this._fullscreenVRpresenting = anyDoc.mozFullScreen;\r\n }\r\n else if (anyDoc.webkitIsFullScreen !== undefined) {\r\n _this._fullscreenVRpresenting = anyDoc.webkitIsFullScreen;\r\n }\r\n else if (anyDoc.msIsFullScreen !== undefined) {\r\n _this._fullscreenVRpresenting = anyDoc.msIsFullScreen;\r\n }\r\n else if (document.msFullscreenElement !== undefined) {\r\n _this._fullscreenVRpresenting = document.msFullscreenElement;\r\n }\r\n if (!_this._fullscreenVRpresenting && _this._canvas) {\r\n _this.exitVR();\r\n if (!_this._useCustomVRButton && _this._btnVR) {\r\n _this._btnVR.style.top = _this._canvas.offsetTop + _this._canvas.offsetHeight - 70 + \"px\";\r\n _this._btnVR.style.left = _this._canvas.offsetLeft + _this._canvas.offsetWidth - 100 + \"px\";\r\n }\r\n }\r\n };\r\n this._cachedAngularSensibility = { angularSensibilityX: null, angularSensibilityY: null, angularSensibility: null };\r\n this.beforeRender = function () {\r\n if (_this._leftController && _this._leftController._activePointer) {\r\n _this._castRayAndSelectObject(_this._leftController);\r\n }\r\n if (_this._rightController && _this._rightController._activePointer) {\r\n _this._castRayAndSelectObject(_this._rightController);\r\n }\r\n if (_this._noControllerIsActive && (_this._scene.getEngine().isPointerLock || _this.enableGazeEvenWhenNoPointerLock)) {\r\n _this._castRayAndSelectObject(_this._cameraGazer);\r\n }\r\n else {\r\n _this._cameraGazer._gazeTracker.isVisible = false;\r\n }\r\n };\r\n this._onNewGamepadConnected = function (gamepad) {\r\n if (gamepad.type !== _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_11__[\"Gamepad\"].POSE_ENABLED) {\r\n if (gamepad.leftStick) {\r\n gamepad.onleftstickchanged(function (stickValues) {\r\n if (_this._teleportationInitialized && _this.teleportationEnabled) {\r\n // Listening to classic/xbox gamepad only if no VR controller is active\r\n if ((!_this._leftController && !_this._rightController) ||\r\n ((_this._leftController && !_this._leftController._activePointer) &&\r\n (_this._rightController && !_this._rightController._activePointer))) {\r\n _this._checkTeleportWithRay(stickValues, _this._cameraGazer);\r\n _this._checkTeleportBackwards(stickValues, _this._cameraGazer);\r\n }\r\n }\r\n });\r\n }\r\n if (gamepad.rightStick) {\r\n gamepad.onrightstickchanged(function (stickValues) {\r\n if (_this._teleportationInitialized) {\r\n _this._checkRotate(stickValues, _this._cameraGazer);\r\n }\r\n });\r\n }\r\n if (gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_11__[\"Gamepad\"].XBOX) {\r\n gamepad.onbuttondown(function (buttonPressed) {\r\n if (_this._interactionsEnabled && buttonPressed === _Gamepads_xboxGamepad__WEBPACK_IMPORTED_MODULE_14__[\"Xbox360Button\"].A) {\r\n _this._cameraGazer._selectionPointerDown();\r\n }\r\n });\r\n gamepad.onbuttonup(function (buttonPressed) {\r\n if (_this._interactionsEnabled && buttonPressed === _Gamepads_xboxGamepad__WEBPACK_IMPORTED_MODULE_14__[\"Xbox360Button\"].A) {\r\n _this._cameraGazer._selectionPointerUp();\r\n }\r\n });\r\n }\r\n }\r\n else {\r\n var webVRController = gamepad;\r\n var controller = new VRExperienceHelperControllerGazer(webVRController, _this._scene, _this._cameraGazer._gazeTracker);\r\n if (webVRController.hand === \"right\" || (_this._leftController && _this._leftController.webVRController != webVRController)) {\r\n _this._rightController = controller;\r\n }\r\n else {\r\n _this._leftController = controller;\r\n }\r\n _this._tryEnableInteractionOnController(controller);\r\n }\r\n };\r\n // This only succeeds if the controller's mesh exists for the controller so this must be called whenever new controller is connected or when mesh is loaded\r\n this._tryEnableInteractionOnController = function (controller) {\r\n if (_this._interactionsRequested && !controller._interactionsEnabled) {\r\n _this._enableInteractionOnController(controller);\r\n }\r\n if (_this._teleportationRequested && !controller._teleportationEnabled) {\r\n _this._enableTeleportationOnController(controller);\r\n }\r\n };\r\n this._onNewGamepadDisconnected = function (gamepad) {\r\n if (gamepad instanceof _Gamepads_Controllers_webVRController__WEBPACK_IMPORTED_MODULE_13__[\"WebVRController\"]) {\r\n if (gamepad.hand === \"left\" && _this._leftController != null) {\r\n _this._leftController.dispose();\r\n _this._leftController = null;\r\n }\r\n if (gamepad.hand === \"right\" && _this._rightController != null) {\r\n _this._rightController.dispose();\r\n _this._rightController = null;\r\n }\r\n }\r\n };\r\n this._workingVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Zero();\r\n this._workingQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].Identity();\r\n this._workingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Matrix\"].Identity();\r\n this._scene = scene;\r\n this._canvas = scene.getEngine().getRenderingCanvas();\r\n // Parse options\r\n if (webVROptions.createFallbackVRDeviceOrientationFreeCamera === undefined) {\r\n webVROptions.createFallbackVRDeviceOrientationFreeCamera = true;\r\n }\r\n if (webVROptions.createDeviceOrientationCamera === undefined) {\r\n webVROptions.createDeviceOrientationCamera = true;\r\n }\r\n if (webVROptions.laserToggle === undefined) {\r\n webVROptions.laserToggle = true;\r\n }\r\n if (webVROptions.defaultHeight === undefined) {\r\n webVROptions.defaultHeight = 1.7;\r\n }\r\n if (webVROptions.useCustomVRButton) {\r\n this._useCustomVRButton = true;\r\n if (webVROptions.customVRButton) {\r\n this._btnVR = webVROptions.customVRButton;\r\n }\r\n }\r\n if (webVROptions.rayLength) {\r\n this._rayLength = webVROptions.rayLength;\r\n }\r\n this._defaultHeight = webVROptions.defaultHeight;\r\n if (webVROptions.positionScale) {\r\n this._rayLength *= webVROptions.positionScale;\r\n this._defaultHeight *= webVROptions.positionScale;\r\n }\r\n this._hasEnteredVR = false;\r\n // Set position\r\n if (this._scene.activeCamera) {\r\n this._position = this._scene.activeCamera.position.clone();\r\n }\r\n else {\r\n this._position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"](0, this._defaultHeight, 0);\r\n }\r\n // Set non-vr camera\r\n if (webVROptions.createDeviceOrientationCamera || !this._scene.activeCamera) {\r\n this._deviceOrientationCamera = new _Cameras_deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_5__[\"DeviceOrientationCamera\"](\"deviceOrientationVRHelper\", this._position.clone(), scene);\r\n // Copy data from existing camera\r\n if (this._scene.activeCamera) {\r\n this._deviceOrientationCamera.minZ = this._scene.activeCamera.minZ;\r\n this._deviceOrientationCamera.maxZ = this._scene.activeCamera.maxZ;\r\n // Set rotation from previous camera\r\n if (this._scene.activeCamera instanceof _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"] && this._scene.activeCamera.rotation) {\r\n var targetCamera = this._scene.activeCamera;\r\n if (targetCamera.rotationQuaternion) {\r\n this._deviceOrientationCamera.rotationQuaternion.copyFrom(targetCamera.rotationQuaternion);\r\n }\r\n else {\r\n this._deviceOrientationCamera.rotationQuaternion.copyFrom(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].RotationYawPitchRoll(targetCamera.rotation.y, targetCamera.rotation.x, targetCamera.rotation.z));\r\n }\r\n this._deviceOrientationCamera.rotation = targetCamera.rotation.clone();\r\n }\r\n }\r\n this._scene.activeCamera = this._deviceOrientationCamera;\r\n if (this._canvas) {\r\n this._scene.activeCamera.attachControl(this._canvas);\r\n }\r\n }\r\n else {\r\n this._existingCamera = this._scene.activeCamera;\r\n }\r\n // Create VR cameras\r\n if (webVROptions.createFallbackVRDeviceOrientationFreeCamera) {\r\n if (webVROptions.useMultiview) {\r\n if (!webVROptions.vrDeviceOrientationCameraMetrics) {\r\n webVROptions.vrDeviceOrientationCameraMetrics = _Cameras_VR_vrCameraMetrics__WEBPACK_IMPORTED_MODULE_23__[\"VRCameraMetrics\"].GetDefault();\r\n }\r\n webVROptions.vrDeviceOrientationCameraMetrics.multiviewEnabled = true;\r\n }\r\n this._vrDeviceOrientationCamera = new _Cameras_VR_vrDeviceOrientationFreeCamera__WEBPACK_IMPORTED_MODULE_6__[\"VRDeviceOrientationFreeCamera\"](\"VRDeviceOrientationVRHelper\", this._position, this._scene, true, webVROptions.vrDeviceOrientationCameraMetrics);\r\n this._vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE;\r\n }\r\n this._webVRCamera = new _Cameras_VR_webVRCamera__WEBPACK_IMPORTED_MODULE_7__[\"WebVRFreeCamera\"](\"WebVRHelper\", this._position, this._scene, webVROptions);\r\n this._webVRCamera.useStandingMatrix();\r\n this._cameraGazer = new VRExperienceHelperCameraGazer(function () { return _this.currentVRCamera; }, scene);\r\n // Create default button\r\n if (!this._useCustomVRButton) {\r\n this._btnVR = document.createElement(\"BUTTON\");\r\n this._btnVR.className = \"babylonVRicon\";\r\n this._btnVR.id = \"babylonVRiconbtn\";\r\n this._btnVR.title = \"Click to switch to VR\";\r\n var css = \".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) }\";\r\n css += \".babylonVRicon.vrdisplaypresenting { display: none; }\";\r\n // TODO: Add user feedback so that they know what state the VRDisplay is in (disconnected, connected, entering-VR)\r\n // css += \".babylonVRicon.vrdisplaysupported { }\";\r\n // css += \".babylonVRicon.vrdisplayready { }\";\r\n // css += \".babylonVRicon.vrdisplayrequesting { }\";\r\n var style = document.createElement('style');\r\n style.appendChild(document.createTextNode(css));\r\n document.getElementsByTagName('head')[0].appendChild(style);\r\n this.moveButtonToBottomRight();\r\n }\r\n // VR button click event\r\n if (this._btnVR) {\r\n this._btnVR.addEventListener(\"click\", function () {\r\n if (!_this.isInVRMode) {\r\n _this.enterVR();\r\n }\r\n else {\r\n _this.exitVR();\r\n }\r\n });\r\n }\r\n // Window events\r\n var hostWindow = this._scene.getEngine().getHostWindow();\r\n hostWindow.addEventListener(\"resize\", this._onResize);\r\n document.addEventListener(\"fullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"mozfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"webkitfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"msfullscreenchange\", this._onFullscreenChange, false);\r\n document.onmsfullscreenchange = this._onFullscreenChange;\r\n // Display vr button when headset is connected\r\n if (webVROptions.createFallbackVRDeviceOrientationFreeCamera) {\r\n this.displayVRButton();\r\n }\r\n else {\r\n this._scene.getEngine().onVRDisplayChangedObservable.add(function (e) {\r\n if (e.vrDisplay) {\r\n _this.displayVRButton();\r\n }\r\n });\r\n }\r\n // Exiting VR mode using 'ESC' key on desktop\r\n this._onKeyDown = function (event) {\r\n if (event.keyCode === 27 && _this.isInVRMode) {\r\n _this.exitVR();\r\n }\r\n };\r\n document.addEventListener(\"keydown\", this._onKeyDown);\r\n // Exiting VR mode double tapping the touch screen\r\n this._scene.onPrePointerObservable.add(function () {\r\n if (_this.isInVRMode && _this.exitVROnDoubleTap) {\r\n _this.exitVR();\r\n if (_this._fullscreenVRpresenting) {\r\n _this._scene.getEngine().exitFullscreen();\r\n }\r\n }\r\n }, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__[\"PointerEventTypes\"].POINTERDOUBLETAP, false);\r\n // Listen for WebVR display changes\r\n this._onVRDisplayChanged = function (eventArgs) { return _this.onVRDisplayChanged(eventArgs); };\r\n this._onVrDisplayPresentChange = function () { return _this.onVrDisplayPresentChange(); };\r\n this._onVRRequestPresentStart = function () {\r\n _this._webVRrequesting = true;\r\n _this.updateButtonVisibility();\r\n };\r\n this._onVRRequestPresentComplete = function () {\r\n _this._webVRrequesting = false;\r\n _this.updateButtonVisibility();\r\n };\r\n scene.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged);\r\n scene.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart);\r\n scene.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete);\r\n hostWindow.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n scene.onDisposeObservable.add(function () {\r\n _this.dispose();\r\n });\r\n // Gamepad connection events\r\n this._webVRCamera.onControllerMeshLoadedObservable.add(function (webVRController) { return _this._onDefaultMeshLoaded(webVRController); });\r\n this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected);\r\n this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected);\r\n this.updateButtonVisibility();\r\n //create easing functions\r\n this._circleEase = new _Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"CircleEase\"]();\r\n this._circleEase.setEasingMode(_Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"EasingFunction\"].EASINGMODE_EASEINOUT);\r\n // Allow clicking in the vrDeviceOrientationCamera\r\n scene.onPointerObservable.add(function (e) {\r\n if (_this._interactionsEnabled) {\r\n if (scene.activeCamera === _this.vrDeviceOrientationCamera && e.event.pointerType === \"mouse\") {\r\n if (e.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._cameraGazer._selectionPointerDown();\r\n }\r\n else if (e.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_8__[\"PointerEventTypes\"].POINTERUP) {\r\n _this._cameraGazer._selectionPointerUp();\r\n }\r\n }\r\n }\r\n });\r\n if (this.webVROptions.floorMeshes) {\r\n this.enableTeleportation({ floorMeshes: this.webVROptions.floorMeshes });\r\n }\r\n }\r\n Object.defineProperty(VRExperienceHelper.prototype, \"onEnteringVR\", {\r\n /** Return this.onEnteringVRObservable\r\n * Note: This one is for backward compatibility. Please use onEnteringVRObservable directly\r\n */\r\n get: function () {\r\n return this.onEnteringVRObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"onExitingVR\", {\r\n /** Return this.onExitingVRObservable\r\n * Note: This one is for backward compatibility. Please use onExitingVRObservable directly\r\n */\r\n get: function () {\r\n return this.onExitingVRObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"onControllerMeshLoaded\", {\r\n /** Return this.onControllerMeshLoadedObservable\r\n * Note: This one is for backward compatibility. Please use onControllerMeshLoadedObservable directly\r\n */\r\n get: function () {\r\n return this.onControllerMeshLoadedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"teleportationTarget\", {\r\n /**\r\n * The mesh used to display where the user is going to teleport.\r\n */\r\n get: function () {\r\n return this._teleportationTarget;\r\n },\r\n /**\r\n * Sets the mesh to be used to display where the user is going to teleport.\r\n */\r\n set: function (value) {\r\n if (value) {\r\n value.name = \"teleportationTarget\";\r\n this._isDefaultTeleportationTarget = false;\r\n this._teleportationTarget = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"gazeTrackerMesh\", {\r\n /**\r\n * The mesh used to display where the user is selecting, this mesh will be cloned and set as the gazeTracker for the left and right controller\r\n * when set bakeCurrentTransformIntoVertices will be called on the mesh.\r\n * See http://doc.babylonjs.com/resources/baking_transformations\r\n */\r\n get: function () {\r\n return this._cameraGazer._gazeTracker;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n // Dispose of existing meshes\r\n if (this._cameraGazer._gazeTracker) {\r\n this._cameraGazer._gazeTracker.dispose();\r\n }\r\n if (this._leftController && this._leftController._gazeTracker) {\r\n this._leftController._gazeTracker.dispose();\r\n }\r\n if (this._rightController && this._rightController._gazeTracker) {\r\n this._rightController._gazeTracker.dispose();\r\n }\r\n // Set and create gaze trackers on head and controllers\r\n this._cameraGazer._gazeTracker = value;\r\n this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices();\r\n this._cameraGazer._gazeTracker.isPickable = false;\r\n this._cameraGazer._gazeTracker.isVisible = false;\r\n this._cameraGazer._gazeTracker.name = \"gazeTracker\";\r\n if (this._leftController) {\r\n this._leftController._gazeTracker = this._cameraGazer._gazeTracker.clone(\"gazeTracker\");\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker = this._cameraGazer._gazeTracker.clone(\"gazeTracker\");\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"leftControllerGazeTrackerMesh\", {\r\n /**\r\n * The gaze tracking mesh corresponding to the left controller\r\n */\r\n get: function () {\r\n if (this._leftController) {\r\n return this._leftController._gazeTracker;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"rightControllerGazeTrackerMesh\", {\r\n /**\r\n * The gaze tracking mesh corresponding to the right controller\r\n */\r\n get: function () {\r\n if (this._rightController) {\r\n return this._rightController._gazeTracker;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"displayGaze\", {\r\n /**\r\n * If the ray of the gaze should be displayed.\r\n */\r\n get: function () {\r\n return this._displayGaze;\r\n },\r\n /**\r\n * Sets if the ray of the gaze should be displayed.\r\n */\r\n set: function (value) {\r\n this._displayGaze = value;\r\n if (!value) {\r\n this._cameraGazer._gazeTracker.isVisible = false;\r\n if (this._leftController) {\r\n this._leftController._gazeTracker.isVisible = false;\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker.isVisible = false;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"displayLaserPointer\", {\r\n /**\r\n * If the ray of the LaserPointer should be displayed.\r\n */\r\n get: function () {\r\n return this._displayLaserPointer;\r\n },\r\n /**\r\n * Sets if the ray of the LaserPointer should be displayed.\r\n */\r\n set: function (value) {\r\n this._displayLaserPointer = value;\r\n if (!value) {\r\n if (this._rightController) {\r\n this._rightController._deactivatePointer();\r\n this._rightController._gazeTracker.isVisible = false;\r\n }\r\n if (this._leftController) {\r\n this._leftController._deactivatePointer();\r\n this._leftController._gazeTracker.isVisible = false;\r\n }\r\n }\r\n else {\r\n if (this._rightController) {\r\n this._rightController._activatePointer();\r\n }\r\n if (this._leftController) {\r\n this._leftController._activatePointer();\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"deviceOrientationCamera\", {\r\n /**\r\n * The deviceOrientationCamera used as the camera when not in VR.\r\n */\r\n get: function () {\r\n return this._deviceOrientationCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"currentVRCamera\", {\r\n /**\r\n * Based on the current WebVR support, returns the current VR camera used.\r\n */\r\n get: function () {\r\n if (this._webVRready) {\r\n return this._webVRCamera;\r\n }\r\n else {\r\n return this._scene.activeCamera;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"webVRCamera\", {\r\n /**\r\n * The webVRCamera which is used when in VR.\r\n */\r\n get: function () {\r\n return this._webVRCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"vrDeviceOrientationCamera\", {\r\n /**\r\n * The deviceOrientationCamera that is used as a fallback when vr device is not connected.\r\n */\r\n get: function () {\r\n return this._vrDeviceOrientationCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"vrButton\", {\r\n /**\r\n * The html button that is used to trigger entering into VR.\r\n */\r\n get: function () {\r\n return this._btnVR;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VRExperienceHelper.prototype, \"_teleportationRequestInitiated\", {\r\n get: function () {\r\n var result = this._cameraGazer._teleportationRequestInitiated\r\n || (this._leftController !== null && this._leftController._teleportationRequestInitiated)\r\n || (this._rightController !== null && this._rightController._teleportationRequestInitiated);\r\n return result;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Raised when one of the controller has loaded successfully its associated default mesh\r\n VRExperienceHelper.prototype._onDefaultMeshLoaded = function (webVRController) {\r\n if (this._leftController && this._leftController.webVRController == webVRController) {\r\n if (webVRController.mesh) {\r\n this._leftController._setLaserPointerParent(webVRController.mesh);\r\n }\r\n }\r\n if (this._rightController && this._rightController.webVRController == webVRController) {\r\n if (webVRController.mesh) {\r\n this._rightController._setLaserPointerParent(webVRController.mesh);\r\n }\r\n }\r\n try {\r\n this.onControllerMeshLoadedObservable.notifyObservers(webVRController);\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error in your custom logic onControllerMeshLoaded: \" + err);\r\n }\r\n };\r\n Object.defineProperty(VRExperienceHelper.prototype, \"isInVRMode\", {\r\n /**\r\n * Gets a value indicating if we are currently in VR mode.\r\n */\r\n get: function () {\r\n return this._webVRpresenting || this._fullscreenVRpresenting;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VRExperienceHelper.prototype.onVrDisplayPresentChange = function () {\r\n var vrDisplay = this._scene.getEngine().getVRDevice();\r\n if (vrDisplay) {\r\n var wasPresenting = this._webVRpresenting;\r\n this._webVRpresenting = vrDisplay.isPresenting;\r\n if (wasPresenting && !this._webVRpresenting) {\r\n this.exitVR();\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?');\r\n }\r\n this.updateButtonVisibility();\r\n };\r\n VRExperienceHelper.prototype.onVRDisplayChanged = function (eventArgs) {\r\n this._webVRsupported = eventArgs.vrSupported;\r\n this._webVRready = !!eventArgs.vrDisplay;\r\n this._webVRpresenting = eventArgs.vrDisplay && eventArgs.vrDisplay.isPresenting;\r\n this.updateButtonVisibility();\r\n };\r\n VRExperienceHelper.prototype.moveButtonToBottomRight = function () {\r\n if (this._canvas && !this._useCustomVRButton && this._btnVR) {\r\n var rect = this._canvas.getBoundingClientRect();\r\n this._btnVR.style.top = rect.top + rect.height - 70 + \"px\";\r\n this._btnVR.style.left = rect.left + rect.width - 100 + \"px\";\r\n }\r\n };\r\n VRExperienceHelper.prototype.displayVRButton = function () {\r\n if (!this._useCustomVRButton && !this._btnVRDisplayed && this._btnVR) {\r\n document.body.appendChild(this._btnVR);\r\n this._btnVRDisplayed = true;\r\n }\r\n };\r\n VRExperienceHelper.prototype.updateButtonVisibility = function () {\r\n if (!this._btnVR || this._useCustomVRButton) {\r\n return;\r\n }\r\n this._btnVR.className = \"babylonVRicon\";\r\n if (this.isInVRMode) {\r\n this._btnVR.className += \" vrdisplaypresenting\";\r\n }\r\n else {\r\n if (this._webVRready) {\r\n this._btnVR.className += \" vrdisplayready\";\r\n }\r\n if (this._webVRsupported) {\r\n this._btnVR.className += \" vrdisplaysupported\";\r\n }\r\n if (this._webVRrequesting) {\r\n this._btnVR.className += \" vrdisplayrequesting\";\r\n }\r\n }\r\n };\r\n /**\r\n * Attempt to enter VR. If a headset is connected and ready, will request present on that.\r\n * Otherwise, will use the fullscreen API.\r\n */\r\n VRExperienceHelper.prototype.enterVR = function () {\r\n var _this = this;\r\n if (this.onEnteringVRObservable) {\r\n try {\r\n this.onEnteringVRObservable.notifyObservers(this);\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error in your custom logic onEnteringVR: \" + err);\r\n }\r\n }\r\n if (this._scene.activeCamera) {\r\n this._position = this._scene.activeCamera.position.clone();\r\n if (this.vrDeviceOrientationCamera) {\r\n this.vrDeviceOrientationCamera.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles();\r\n this.vrDeviceOrientationCamera.angularSensibility = 2000;\r\n }\r\n if (this.webVRCamera) {\r\n var currentYRotation = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y;\r\n var desiredYRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y;\r\n var delta = desiredYRotation - currentYRotation;\r\n var currentGlobalRotation = this.webVRCamera.rotationQuaternion.toEulerAngles().y;\r\n this.webVRCamera.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromEulerAngles(0, currentGlobalRotation + delta, 0);\r\n }\r\n // make sure that we return to the last active camera\r\n this._existingCamera = this._scene.activeCamera;\r\n // Remove and cache angular sensability to avoid camera rotation when in VR\r\n if (this._existingCamera.angularSensibilityX) {\r\n this._cachedAngularSensibility.angularSensibilityX = this._existingCamera.angularSensibilityX;\r\n this._existingCamera.angularSensibilityX = Number.MAX_VALUE;\r\n }\r\n if (this._existingCamera.angularSensibilityY) {\r\n this._cachedAngularSensibility.angularSensibilityY = this._existingCamera.angularSensibilityY;\r\n this._existingCamera.angularSensibilityY = Number.MAX_VALUE;\r\n }\r\n if (this._existingCamera.angularSensibility) {\r\n this._cachedAngularSensibility.angularSensibility = this._existingCamera.angularSensibility;\r\n this._existingCamera.angularSensibility = Number.MAX_VALUE;\r\n }\r\n }\r\n if (this._webVRrequesting) {\r\n return;\r\n }\r\n // If WebVR is supported and a headset is connected\r\n if (this._webVRready) {\r\n if (!this._webVRpresenting) {\r\n this._scene.getEngine().onVRRequestPresentComplete.addOnce(function (result) {\r\n _this.onAfterEnteringVRObservable.notifyObservers({ success: result });\r\n });\r\n this._webVRCamera.position = this._position;\r\n this._scene.activeCamera = this._webVRCamera;\r\n }\r\n }\r\n else if (this._vrDeviceOrientationCamera) {\r\n this._vrDeviceOrientationCamera.position = this._position;\r\n if (this._scene.activeCamera) {\r\n this._vrDeviceOrientationCamera.minZ = this._scene.activeCamera.minZ;\r\n }\r\n this._scene.activeCamera = this._vrDeviceOrientationCamera;\r\n this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen);\r\n this.updateButtonVisibility();\r\n this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(function () {\r\n _this.onAfterEnteringVRObservable.notifyObservers({ success: true });\r\n });\r\n }\r\n if (this._scene.activeCamera && this._canvas) {\r\n this._scene.activeCamera.attachControl(this._canvas);\r\n }\r\n if (this._interactionsEnabled) {\r\n this._scene.registerBeforeRender(this.beforeRender);\r\n }\r\n if (this._displayLaserPointer) {\r\n [this._leftController, this._rightController].forEach(function (controller) {\r\n if (controller) {\r\n controller._activatePointer();\r\n }\r\n });\r\n }\r\n this._hasEnteredVR = true;\r\n };\r\n /**\r\n * Attempt to exit VR, or fullscreen.\r\n */\r\n VRExperienceHelper.prototype.exitVR = function () {\r\n if (this._hasEnteredVR) {\r\n if (this.onExitingVRObservable) {\r\n try {\r\n this.onExitingVRObservable.notifyObservers(this);\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error in your custom logic onExitingVR: \" + err);\r\n }\r\n }\r\n if (this._webVRpresenting) {\r\n this._scene.getEngine().disableVR();\r\n }\r\n if (this._scene.activeCamera) {\r\n this._position = this._scene.activeCamera.position.clone();\r\n }\r\n if (this.vrDeviceOrientationCamera) {\r\n this.vrDeviceOrientationCamera.angularSensibility = Number.MAX_VALUE;\r\n }\r\n if (this._deviceOrientationCamera) {\r\n this._deviceOrientationCamera.position = this._position;\r\n this._scene.activeCamera = this._deviceOrientationCamera;\r\n if (this._canvas) {\r\n this._scene.activeCamera.attachControl(this._canvas);\r\n }\r\n // Restore angular sensibility\r\n if (this._cachedAngularSensibility.angularSensibilityX) {\r\n this._deviceOrientationCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX;\r\n this._cachedAngularSensibility.angularSensibilityX = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibilityY) {\r\n this._deviceOrientationCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY;\r\n this._cachedAngularSensibility.angularSensibilityY = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibility) {\r\n this._deviceOrientationCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility;\r\n this._cachedAngularSensibility.angularSensibility = null;\r\n }\r\n }\r\n else if (this._existingCamera) {\r\n this._existingCamera.position = this._position;\r\n this._scene.activeCamera = this._existingCamera;\r\n // Restore angular sensibility\r\n if (this._cachedAngularSensibility.angularSensibilityX) {\r\n this._existingCamera.angularSensibilityX = this._cachedAngularSensibility.angularSensibilityX;\r\n this._cachedAngularSensibility.angularSensibilityX = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibilityY) {\r\n this._existingCamera.angularSensibilityY = this._cachedAngularSensibility.angularSensibilityY;\r\n this._cachedAngularSensibility.angularSensibilityY = null;\r\n }\r\n if (this._cachedAngularSensibility.angularSensibility) {\r\n this._existingCamera.angularSensibility = this._cachedAngularSensibility.angularSensibility;\r\n this._cachedAngularSensibility.angularSensibility = null;\r\n }\r\n }\r\n this.updateButtonVisibility();\r\n if (this._interactionsEnabled) {\r\n this._scene.unregisterBeforeRender(this.beforeRender);\r\n this._cameraGazer._gazeTracker.isVisible = false;\r\n if (this._leftController) {\r\n this._leftController._gazeTracker.isVisible = false;\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker.isVisible = false;\r\n }\r\n }\r\n // resize to update width and height when exiting vr exits fullscreen\r\n this._scene.getEngine().resize();\r\n [this._leftController, this._rightController].forEach(function (controller) {\r\n if (controller) {\r\n controller._deactivatePointer();\r\n }\r\n });\r\n this._hasEnteredVR = false;\r\n // Update engine state to re enable non-vr camera input\r\n var engine = this._scene.getEngine();\r\n if (engine._onVrDisplayPresentChange) {\r\n engine._onVrDisplayPresentChange();\r\n }\r\n }\r\n };\r\n Object.defineProperty(VRExperienceHelper.prototype, \"position\", {\r\n /**\r\n * The position of the vr experience helper.\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n /**\r\n * Sets the position of the vr experience helper.\r\n */\r\n set: function (value) {\r\n this._position = value;\r\n if (this._scene.activeCamera) {\r\n this._scene.activeCamera.position = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Enables controllers and user interactions such as selecting and object or clicking on an object.\r\n */\r\n VRExperienceHelper.prototype.enableInteractions = function () {\r\n var _this = this;\r\n if (!this._interactionsEnabled) {\r\n this._interactionsRequested = true;\r\n if (this._leftController) {\r\n this._enableInteractionOnController(this._leftController);\r\n }\r\n if (this._rightController) {\r\n this._enableInteractionOnController(this._rightController);\r\n }\r\n this.raySelectionPredicate = function (mesh) {\r\n return mesh.isVisible && (mesh.isPickable || mesh.name === _this._floorMeshName);\r\n };\r\n this.meshSelectionPredicate = function () {\r\n return true;\r\n };\r\n this._raySelectionPredicate = function (mesh) {\r\n if (_this._isTeleportationFloor(mesh) || (mesh.name.indexOf(\"gazeTracker\") === -1\r\n && mesh.name.indexOf(\"teleportationTarget\") === -1\r\n && mesh.name.indexOf(\"torusTeleportation\") === -1)) {\r\n return _this.raySelectionPredicate(mesh);\r\n }\r\n return false;\r\n };\r\n this._interactionsEnabled = true;\r\n }\r\n };\r\n Object.defineProperty(VRExperienceHelper.prototype, \"_noControllerIsActive\", {\r\n get: function () {\r\n return !(this._leftController && this._leftController._activePointer) && !(this._rightController && this._rightController._activePointer);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VRExperienceHelper.prototype._isTeleportationFloor = function (mesh) {\r\n for (var i = 0; i < this._floorMeshesCollection.length; i++) {\r\n if (this._floorMeshesCollection[i].id === mesh.id) {\r\n return true;\r\n }\r\n }\r\n if (this._floorMeshName && mesh.name === this._floorMeshName) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Adds a floor mesh to be used for teleportation.\r\n * @param floorMesh the mesh to be used for teleportation.\r\n */\r\n VRExperienceHelper.prototype.addFloorMesh = function (floorMesh) {\r\n if (!this._floorMeshesCollection) {\r\n return;\r\n }\r\n if (this._floorMeshesCollection.indexOf(floorMesh) > -1) {\r\n return;\r\n }\r\n this._floorMeshesCollection.push(floorMesh);\r\n };\r\n /**\r\n * Removes a floor mesh from being used for teleportation.\r\n * @param floorMesh the mesh to be removed.\r\n */\r\n VRExperienceHelper.prototype.removeFloorMesh = function (floorMesh) {\r\n if (!this._floorMeshesCollection) {\r\n return;\r\n }\r\n var meshIndex = this._floorMeshesCollection.indexOf(floorMesh);\r\n if (meshIndex !== -1) {\r\n this._floorMeshesCollection.splice(meshIndex, 1);\r\n }\r\n };\r\n /**\r\n * Enables interactions and teleportation using the VR controllers and gaze.\r\n * @param vrTeleportationOptions options to modify teleportation behavior.\r\n */\r\n VRExperienceHelper.prototype.enableTeleportation = function (vrTeleportationOptions) {\r\n if (vrTeleportationOptions === void 0) { vrTeleportationOptions = {}; }\r\n if (!this._teleportationInitialized) {\r\n this._teleportationRequested = true;\r\n this.enableInteractions();\r\n if (vrTeleportationOptions.floorMeshName) {\r\n this._floorMeshName = vrTeleportationOptions.floorMeshName;\r\n }\r\n if (vrTeleportationOptions.floorMeshes) {\r\n this._floorMeshesCollection = vrTeleportationOptions.floorMeshes;\r\n }\r\n if (this._leftController != null) {\r\n this._enableTeleportationOnController(this._leftController);\r\n }\r\n if (this._rightController != null) {\r\n this._enableTeleportationOnController(this._rightController);\r\n }\r\n // Creates an image processing post process for the vignette not relying\r\n // on the main scene configuration for image processing to reduce setup and spaces\r\n // (gamma/linear) conflicts.\r\n var imageProcessingConfiguration = new _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_17__[\"ImageProcessingConfiguration\"]();\r\n imageProcessingConfiguration.vignetteColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color4\"](0, 0, 0, 0);\r\n imageProcessingConfiguration.vignetteEnabled = true;\r\n this._postProcessMove = new _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_20__[\"ImageProcessingPostProcess\"](\"postProcessMove\", 1.0, this._webVRCamera, undefined, undefined, undefined, undefined, imageProcessingConfiguration);\r\n this._webVRCamera.detachPostProcess(this._postProcessMove);\r\n this._teleportationInitialized = true;\r\n if (this._isDefaultTeleportationTarget) {\r\n this._createTeleportationCircles();\r\n this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor);\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._enableInteractionOnController = function (controller) {\r\n var _this = this;\r\n var controllerMesh = controller.webVRController.mesh;\r\n if (controllerMesh) {\r\n controller._interactionsEnabled = true;\r\n if (this.isInVRMode && this._displayLaserPointer) {\r\n controller._activatePointer();\r\n }\r\n if (this.webVROptions.laserToggle) {\r\n controller.webVRController.onMainButtonStateChangedObservable.add(function (stateObject) {\r\n // Enabling / disabling laserPointer\r\n if (_this._displayLaserPointer && stateObject.value === 1) {\r\n if (controller._activePointer) {\r\n controller._deactivatePointer();\r\n }\r\n else {\r\n controller._activatePointer();\r\n }\r\n if (_this.displayGaze) {\r\n controller._gazeTracker.isVisible = controller._activePointer;\r\n }\r\n }\r\n });\r\n }\r\n controller.webVRController.onTriggerStateChangedObservable.add(function (stateObject) {\r\n var gazer = controller;\r\n if (_this._noControllerIsActive) {\r\n gazer = _this._cameraGazer;\r\n }\r\n if (!gazer._pointerDownOnMeshAsked) {\r\n if (stateObject.value > _this._padSensibilityUp) {\r\n gazer._selectionPointerDown();\r\n }\r\n }\r\n else if (stateObject.value < _this._padSensibilityDown) {\r\n gazer._selectionPointerUp();\r\n }\r\n });\r\n }\r\n };\r\n VRExperienceHelper.prototype._checkTeleportWithRay = function (stateObject, gazer) {\r\n // Dont teleport if another gaze already requested teleportation\r\n if (this._teleportationRequestInitiated && !gazer._teleportationRequestInitiated) {\r\n return;\r\n }\r\n if (!gazer._teleportationRequestInitiated) {\r\n if (stateObject.y < -this._padSensibilityUp && gazer._dpadPressed) {\r\n gazer._activatePointer();\r\n gazer._teleportationRequestInitiated = true;\r\n }\r\n }\r\n else {\r\n // Listening to the proper controller values changes to confirm teleportation\r\n if (Math.sqrt(stateObject.y * stateObject.y + stateObject.x * stateObject.x) < this._padSensibilityDown) {\r\n if (this._teleportActive) {\r\n this.teleportCamera(this._haloCenter);\r\n }\r\n gazer._teleportationRequestInitiated = false;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._checkRotate = function (stateObject, gazer) {\r\n // Only rotate when user is not currently selecting a teleportation location\r\n if (gazer._teleportationRequestInitiated) {\r\n return;\r\n }\r\n if (!gazer._rotationLeftAsked) {\r\n if (stateObject.x < -this._padSensibilityUp && gazer._dpadPressed) {\r\n gazer._rotationLeftAsked = true;\r\n if (this._rotationAllowed) {\r\n this._rotateCamera(false);\r\n }\r\n }\r\n }\r\n else {\r\n if (stateObject.x > -this._padSensibilityDown) {\r\n gazer._rotationLeftAsked = false;\r\n }\r\n }\r\n if (!gazer._rotationRightAsked) {\r\n if (stateObject.x > this._padSensibilityUp && gazer._dpadPressed) {\r\n gazer._rotationRightAsked = true;\r\n if (this._rotationAllowed) {\r\n this._rotateCamera(true);\r\n }\r\n }\r\n }\r\n else {\r\n if (stateObject.x < this._padSensibilityDown) {\r\n gazer._rotationRightAsked = false;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._checkTeleportBackwards = function (stateObject, gazer) {\r\n // Only teleport backwards when user is not currently selecting a teleportation location\r\n if (gazer._teleportationRequestInitiated) {\r\n return;\r\n }\r\n // Teleport backwards\r\n if (stateObject.y > this._padSensibilityUp && gazer._dpadPressed) {\r\n if (!gazer._teleportationBackRequestInitiated) {\r\n if (!this.currentVRCamera) {\r\n return;\r\n }\r\n // Get rotation and position of the current camera\r\n var rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix());\r\n var position = this.currentVRCamera.position;\r\n // If the camera has device position, use that instead\r\n if (this.currentVRCamera.devicePosition && this.currentVRCamera.deviceRotationQuaternion) {\r\n rotation = this.currentVRCamera.deviceRotationQuaternion;\r\n position = this.currentVRCamera.devicePosition;\r\n }\r\n // Get matrix with only the y rotation of the device rotation\r\n rotation.toEulerAnglesToRef(this._workingVector);\r\n this._workingVector.z = 0;\r\n this._workingVector.x = 0;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].RotationYawPitchRollToRef(this._workingVector.y, this._workingVector.x, this._workingVector.z, this._workingQuaternion);\r\n this._workingQuaternion.toRotationMatrix(this._workingMatrix);\r\n // Rotate backwards ray by device rotation to cast at the ground behind the user\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].TransformCoordinatesToRef(this._teleportBackwardsVector, this._workingMatrix, this._workingVector);\r\n // Teleport if ray hit the ground and is not to far away eg. backwards off a cliff\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_16__[\"Ray\"](position, this._workingVector);\r\n var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);\r\n if (hit && hit.pickedPoint && hit.pickedMesh && this._isTeleportationFloor(hit.pickedMesh) && hit.distance < 5) {\r\n this.teleportCamera(hit.pickedPoint);\r\n }\r\n gazer._teleportationBackRequestInitiated = true;\r\n }\r\n }\r\n else {\r\n gazer._teleportationBackRequestInitiated = false;\r\n }\r\n };\r\n VRExperienceHelper.prototype._enableTeleportationOnController = function (controller) {\r\n var _this = this;\r\n var controllerMesh = controller.webVRController.mesh;\r\n if (controllerMesh) {\r\n if (!controller._interactionsEnabled) {\r\n this._enableInteractionOnController(controller);\r\n }\r\n controller._interactionsEnabled = true;\r\n controller._teleportationEnabled = true;\r\n if (controller.webVRController.controllerType === _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_12__[\"PoseEnabledControllerType\"].VIVE) {\r\n controller._dpadPressed = false;\r\n controller.webVRController.onPadStateChangedObservable.add(function (stateObject) {\r\n controller._dpadPressed = stateObject.pressed;\r\n if (!controller._dpadPressed) {\r\n controller._rotationLeftAsked = false;\r\n controller._rotationRightAsked = false;\r\n controller._teleportationBackRequestInitiated = false;\r\n }\r\n });\r\n }\r\n controller.webVRController.onPadValuesChangedObservable.add(function (stateObject) {\r\n if (_this.teleportationEnabled) {\r\n _this._checkTeleportBackwards(stateObject, controller);\r\n _this._checkTeleportWithRay(stateObject, controller);\r\n }\r\n _this._checkRotate(stateObject, controller);\r\n });\r\n }\r\n };\r\n VRExperienceHelper.prototype._createTeleportationCircles = function () {\r\n this._teleportationTarget = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateGround(\"teleportationTarget\", 2, 2, 2, this._scene);\r\n this._teleportationTarget.isPickable = false;\r\n var length = 512;\r\n var dynamicTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_19__[\"DynamicTexture\"](\"DynamicTexture\", length, this._scene, true);\r\n dynamicTexture.hasAlpha = true;\r\n var context = dynamicTexture.getContext();\r\n var centerX = length / 2;\r\n var centerY = length / 2;\r\n var radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = this._teleportationFillColor;\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = this._teleportationBorderColor;\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n var teleportationCircleMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_18__[\"StandardMaterial\"](\"TextPlaneMaterial\", this._scene);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n this._teleportationTarget.material = teleportationCircleMaterial;\r\n var torus = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_15__[\"Mesh\"].CreateTorus(\"torusTeleportation\", 0.75, 0.1, 25, this._scene, false);\r\n torus.isPickable = false;\r\n torus.parent = this._teleportationTarget;\r\n var animationInnerCircle = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationInnerCircle\", \"position.y\", 30, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE);\r\n var keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n var easingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"SineEase\"]();\r\n easingFunction.setEasingMode(_Animations_easing__WEBPACK_IMPORTED_MODULE_21__[\"EasingFunction\"].EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n this._scene.beginAnimation(torus, 0, 60, true);\r\n this._hideTeleportationTarget();\r\n };\r\n VRExperienceHelper.prototype._displayTeleportationTarget = function () {\r\n this._teleportActive = true;\r\n if (this._teleportationInitialized) {\r\n this._teleportationTarget.isVisible = true;\r\n if (this._isDefaultTeleportationTarget) {\r\n this._teleportationTarget.getChildren()[0].isVisible = true;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._hideTeleportationTarget = function () {\r\n this._teleportActive = false;\r\n if (this._teleportationInitialized) {\r\n this._teleportationTarget.isVisible = false;\r\n if (this._isDefaultTeleportationTarget) {\r\n this._teleportationTarget.getChildren()[0].isVisible = false;\r\n }\r\n }\r\n };\r\n VRExperienceHelper.prototype._rotateCamera = function (right) {\r\n var _this = this;\r\n if (!(this.currentVRCamera instanceof _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"])) {\r\n return;\r\n }\r\n if (right) {\r\n this._rotationAngle++;\r\n }\r\n else {\r\n this._rotationAngle--;\r\n }\r\n this.currentVRCamera.animations = [];\r\n var target = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Quaternion\"].FromRotationMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Matrix\"].RotationY(Math.PI / 4 * this._rotationAngle));\r\n var animationRotation = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationRotation\", \"rotationQuaternion\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_QUATERNION, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var animationRotationKeys = [];\r\n animationRotationKeys.push({\r\n frame: 0,\r\n value: this.currentVRCamera.rotationQuaternion\r\n });\r\n animationRotationKeys.push({\r\n frame: 6,\r\n value: target\r\n });\r\n animationRotation.setKeys(animationRotationKeys);\r\n animationRotation.setEasingFunction(this._circleEase);\r\n this.currentVRCamera.animations.push(animationRotation);\r\n this._postProcessMove.animations = [];\r\n var animationPP = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP\", \"vignetteWeight\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteWeightKeys = [];\r\n vignetteWeightKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 3,\r\n value: 4\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 6,\r\n value: 0\r\n });\r\n animationPP.setKeys(vignetteWeightKeys);\r\n animationPP.setEasingFunction(this._circleEase);\r\n this._postProcessMove.animations.push(animationPP);\r\n var animationPP2 = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP2\", \"vignetteStretch\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteStretchKeys = [];\r\n vignetteStretchKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 3,\r\n value: 10\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 6,\r\n value: 0\r\n });\r\n animationPP2.setKeys(vignetteStretchKeys);\r\n animationPP2.setEasingFunction(this._circleEase);\r\n this._postProcessMove.animations.push(animationPP2);\r\n this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0;\r\n this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0;\r\n this._postProcessMove.samples = 4;\r\n this._webVRCamera.attachPostProcess(this._postProcessMove);\r\n this._scene.beginAnimation(this._postProcessMove, 0, 6, false, 1, function () {\r\n _this._webVRCamera.detachPostProcess(_this._postProcessMove);\r\n });\r\n this._scene.beginAnimation(this.currentVRCamera, 0, 6, false, 1);\r\n };\r\n VRExperienceHelper.prototype._moveTeleportationSelectorTo = function (hit, gazer, ray) {\r\n if (hit.pickedPoint) {\r\n if (gazer._teleportationRequestInitiated) {\r\n this._displayTeleportationTarget();\r\n this._haloCenter.copyFrom(hit.pickedPoint);\r\n this._teleportationTarget.position.copyFrom(hit.pickedPoint);\r\n }\r\n var pickNormal = this._convertNormalToDirectionOfRay(hit.getNormal(true, false), ray);\r\n if (pickNormal) {\r\n var axis1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_29__[\"Axis\"].Y, pickNormal);\r\n var axis2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(pickNormal, axis1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].RotationFromAxisToRef(axis2, pickNormal, axis1, this._teleportationTarget.rotation);\r\n }\r\n this._teleportationTarget.position.y += 0.1;\r\n }\r\n };\r\n /**\r\n * Teleports the users feet to the desired location\r\n * @param location The location where the user's feet should be placed\r\n */\r\n VRExperienceHelper.prototype.teleportCamera = function (location) {\r\n var _this = this;\r\n if (!(this.currentVRCamera instanceof _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"])) {\r\n return;\r\n }\r\n // Teleport the hmd to where the user is looking by moving the anchor to where they are looking minus the\r\n // offset of the headset from the anchor.\r\n if (this.webVRCamera.leftCamera) {\r\n this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition);\r\n this._workingVector.subtractInPlace(this.webVRCamera.position);\r\n location.subtractToRef(this._workingVector, this._workingVector);\r\n }\r\n else {\r\n this._workingVector.copyFrom(location);\r\n }\r\n // Add height to account for user's height offset\r\n if (this.isInVRMode) {\r\n this._workingVector.y += this.webVRCamera.deviceDistanceToRoomGround() * this._webVRCamera.deviceScaleFactor;\r\n }\r\n else {\r\n this._workingVector.y += this._defaultHeight;\r\n }\r\n this.onBeforeCameraTeleport.notifyObservers(this._workingVector);\r\n // Create animation from the camera's position to the new location\r\n this.currentVRCamera.animations = [];\r\n var animationCameraTeleportation = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationCameraTeleportation\", \"position\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_VECTOR3, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var animationCameraTeleportationKeys = [{\r\n frame: 0,\r\n value: this.currentVRCamera.position\r\n },\r\n {\r\n frame: 11,\r\n value: this._workingVector\r\n }\r\n ];\r\n animationCameraTeleportation.setKeys(animationCameraTeleportationKeys);\r\n animationCameraTeleportation.setEasingFunction(this._circleEase);\r\n this.currentVRCamera.animations.push(animationCameraTeleportation);\r\n this._postProcessMove.animations = [];\r\n var animationPP = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP\", \"vignetteWeight\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteWeightKeys = [];\r\n vignetteWeightKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 5,\r\n value: 8\r\n });\r\n vignetteWeightKeys.push({\r\n frame: 11,\r\n value: 0\r\n });\r\n animationPP.setKeys(vignetteWeightKeys);\r\n this._postProcessMove.animations.push(animationPP);\r\n var animationPP2 = new _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"](\"animationPP2\", \"vignetteStretch\", 90, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_22__[\"Animation\"].ANIMATIONLOOPMODE_CONSTANT);\r\n var vignetteStretchKeys = [];\r\n vignetteStretchKeys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 5,\r\n value: 10\r\n });\r\n vignetteStretchKeys.push({\r\n frame: 11,\r\n value: 0\r\n });\r\n animationPP2.setKeys(vignetteStretchKeys);\r\n this._postProcessMove.animations.push(animationPP2);\r\n this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0;\r\n this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0;\r\n this._webVRCamera.attachPostProcess(this._postProcessMove);\r\n this._scene.beginAnimation(this._postProcessMove, 0, 11, false, 1, function () {\r\n _this._webVRCamera.detachPostProcess(_this._postProcessMove);\r\n });\r\n this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1, function () {\r\n _this.onAfterCameraTeleport.notifyObservers(_this._workingVector);\r\n });\r\n this._hideTeleportationTarget();\r\n };\r\n VRExperienceHelper.prototype._convertNormalToDirectionOfRay = function (normal, ray) {\r\n if (normal) {\r\n var angle = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Dot(normal, ray.direction));\r\n if (angle < Math.PI / 2) {\r\n normal.scaleInPlace(-1);\r\n }\r\n }\r\n return normal;\r\n };\r\n VRExperienceHelper.prototype._castRayAndSelectObject = function (gazer) {\r\n if (!(this.currentVRCamera instanceof _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"])) {\r\n return;\r\n }\r\n var ray = gazer._getForwardRay(this._rayLength);\r\n var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);\r\n if (hit) {\r\n // Populate the controllers mesh that can be used for drag/drop\r\n if (gazer._laserPointer) {\r\n hit.originMesh = gazer._laserPointer.parent;\r\n }\r\n this._scene.simulatePointerMove(hit, { pointerId: gazer._id });\r\n }\r\n gazer._currentHit = hit;\r\n // Moving the gazeTracker on the mesh face targetted\r\n if (hit && hit.pickedPoint) {\r\n if (this._displayGaze) {\r\n var multiplier = 1;\r\n gazer._gazeTracker.isVisible = true;\r\n if (gazer._isActionableMesh) {\r\n multiplier = 3;\r\n }\r\n if (this.updateGazeTrackerScale) {\r\n gazer._gazeTracker.scaling.x = hit.distance * multiplier;\r\n gazer._gazeTracker.scaling.y = hit.distance * multiplier;\r\n gazer._gazeTracker.scaling.z = hit.distance * multiplier;\r\n }\r\n var pickNormal = this._convertNormalToDirectionOfRay(hit.getNormal(), ray);\r\n // To avoid z-fighting\r\n var deltaFighting = 0.002;\r\n if (pickNormal) {\r\n var axis1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_29__[\"Axis\"].Y, pickNormal);\r\n var axis2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].Cross(pickNormal, axis1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_9__[\"Vector3\"].RotationFromAxisToRef(axis2, pickNormal, axis1, gazer._gazeTracker.rotation);\r\n }\r\n gazer._gazeTracker.position.copyFrom(hit.pickedPoint);\r\n if (gazer._gazeTracker.position.x < 0) {\r\n gazer._gazeTracker.position.x += deltaFighting;\r\n }\r\n else {\r\n gazer._gazeTracker.position.x -= deltaFighting;\r\n }\r\n if (gazer._gazeTracker.position.y < 0) {\r\n gazer._gazeTracker.position.y += deltaFighting;\r\n }\r\n else {\r\n gazer._gazeTracker.position.y -= deltaFighting;\r\n }\r\n if (gazer._gazeTracker.position.z < 0) {\r\n gazer._gazeTracker.position.z += deltaFighting;\r\n }\r\n else {\r\n gazer._gazeTracker.position.z -= deltaFighting;\r\n }\r\n }\r\n // Changing the size of the laser pointer based on the distance from the targetted point\r\n gazer._updatePointerDistance(hit.distance);\r\n }\r\n else {\r\n gazer._updatePointerDistance();\r\n gazer._gazeTracker.isVisible = false;\r\n }\r\n if (hit && hit.pickedMesh) {\r\n // The object selected is the floor, we're in a teleportation scenario\r\n if (this._teleportationInitialized && this._isTeleportationFloor(hit.pickedMesh) && hit.pickedPoint) {\r\n // Moving the teleportation area to this targetted point\r\n //Raise onSelectedMeshUnselected observable if ray collided floor mesh/meshes and a non floor mesh was previously selected\r\n if (gazer._currentMeshSelected && !this._isTeleportationFloor(gazer._currentMeshSelected)) {\r\n this._notifySelectedMeshUnselected(gazer._currentMeshSelected);\r\n }\r\n gazer._currentMeshSelected = null;\r\n if (gazer._teleportationRequestInitiated) {\r\n this._moveTeleportationSelectorTo(hit, gazer, ray);\r\n }\r\n return;\r\n }\r\n // If not, we're in a selection scenario\r\n //this._teleportationAllowed = false;\r\n if (hit.pickedMesh !== gazer._currentMeshSelected) {\r\n if (this.meshSelectionPredicate(hit.pickedMesh)) {\r\n this.onNewMeshPicked.notifyObservers(hit);\r\n gazer._currentMeshSelected = hit.pickedMesh;\r\n if (hit.pickedMesh.isPickable && hit.pickedMesh.actionManager) {\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0, 0, 1));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.2, 0.2, 1));\r\n gazer._isActionableMesh = true;\r\n }\r\n else {\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n gazer._isActionableMesh = false;\r\n }\r\n try {\r\n this.onNewMeshSelected.notifyObservers(hit.pickedMesh);\r\n var gazerAsControllerGazer = gazer;\r\n if (gazerAsControllerGazer.webVRController) {\r\n this.onMeshSelectedWithController.notifyObservers({ mesh: hit.pickedMesh, controller: gazerAsControllerGazer.webVRController });\r\n }\r\n }\r\n catch (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Error while raising onNewMeshSelected or onMeshSelectedWithController: \" + err);\r\n }\r\n }\r\n else {\r\n this._notifySelectedMeshUnselected(gazer._currentMeshSelected);\r\n gazer._currentMeshSelected = null;\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n }\r\n }\r\n }\r\n else {\r\n this._notifySelectedMeshUnselected(gazer._currentMeshSelected);\r\n gazer._currentMeshSelected = null;\r\n //this._teleportationAllowed = false;\r\n this.changeGazeColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n this.changeLaserColor(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.7, 0.7, 0.7));\r\n }\r\n };\r\n VRExperienceHelper.prototype._notifySelectedMeshUnselected = function (mesh) {\r\n if (mesh) {\r\n this.onSelectedMeshUnselected.notifyObservers(mesh);\r\n }\r\n };\r\n /**\r\n * Sets the color of the laser ray from the vr controllers.\r\n * @param color new color for the ray.\r\n */\r\n VRExperienceHelper.prototype.changeLaserColor = function (color) {\r\n if (!this.updateControllerLaserColor) {\r\n return;\r\n }\r\n if (this._leftController) {\r\n this._leftController._setLaserPointerColor(color);\r\n }\r\n if (this._rightController) {\r\n this._rightController._setLaserPointerColor(color);\r\n }\r\n };\r\n /**\r\n * Sets the color of the ray from the vr headsets gaze.\r\n * @param color new color for the ray.\r\n */\r\n VRExperienceHelper.prototype.changeGazeColor = function (color) {\r\n if (!this.updateGazeTrackerColor) {\r\n return;\r\n }\r\n if (!this._cameraGazer._gazeTracker.material) {\r\n return;\r\n }\r\n this._cameraGazer._gazeTracker.material.emissiveColor = color;\r\n if (this._leftController) {\r\n this._leftController._gazeTracker.material.emissiveColor = color;\r\n }\r\n if (this._rightController) {\r\n this._rightController._gazeTracker.material.emissiveColor = color;\r\n }\r\n };\r\n /**\r\n * Exits VR and disposes of the vr experience helper\r\n */\r\n VRExperienceHelper.prototype.dispose = function () {\r\n if (this.isInVRMode) {\r\n this.exitVR();\r\n }\r\n if (this._postProcessMove) {\r\n this._postProcessMove.dispose();\r\n }\r\n if (this._webVRCamera) {\r\n this._webVRCamera.dispose();\r\n }\r\n if (this._vrDeviceOrientationCamera) {\r\n this._vrDeviceOrientationCamera.dispose();\r\n }\r\n if (!this._useCustomVRButton && this._btnVR && this._btnVR.parentNode) {\r\n document.body.removeChild(this._btnVR);\r\n }\r\n if (this._deviceOrientationCamera && (this._scene.activeCamera != this._deviceOrientationCamera)) {\r\n this._deviceOrientationCamera.dispose();\r\n }\r\n if (this._cameraGazer) {\r\n this._cameraGazer.dispose();\r\n }\r\n if (this._leftController) {\r\n this._leftController.dispose();\r\n }\r\n if (this._rightController) {\r\n this._rightController.dispose();\r\n }\r\n if (this._teleportationTarget) {\r\n this._teleportationTarget.dispose();\r\n }\r\n this._floorMeshesCollection = [];\r\n document.removeEventListener(\"keydown\", this._onKeyDown);\r\n window.removeEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n window.removeEventListener(\"resize\", this._onResize);\r\n document.removeEventListener(\"fullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"mozfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"webkitfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"msfullscreenchange\", this._onFullscreenChange);\r\n document.onmsfullscreenchange = null;\r\n this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChanged);\r\n this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart);\r\n this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete);\r\n window.removeEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected);\r\n this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected);\r\n this._scene.unregisterBeforeRender(this.beforeRender);\r\n };\r\n /**\r\n * Gets the name of the VRExperienceHelper class\r\n * @returns \"VRExperienceHelper\"\r\n */\r\n VRExperienceHelper.prototype.getClassName = function () {\r\n return \"VRExperienceHelper\";\r\n };\r\n return VRExperienceHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/VR/webVRCamera.ts\":\n/*!***********************************!*\\\n !*** ./Cameras/VR/webVRCamera.ts ***!\n \\***********************************/\n/*! exports provided: WebVRFreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return WebVRFreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony import */ var _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Gamepads/Controllers/poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../node */ \"./node.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../PostProcesses/vrMultiviewToSingleviewPostProcess */ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\");\n/* harmony import */ var _RigModes_webVRRigMode__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../RigModes/webVRRigMode */ \"./Cameras/RigModes/webVRRigMode.ts\");\n/* harmony import */ var _Engines_Extensions_engine_webVR__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Engines/Extensions/engine.webVR */ \"./Engines/Extensions/engine.webVR.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Side effect import to define the stereoscopic mode.\r\n\r\n// Side effect import to add webvr support to engine\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].AddNodeConstructor(\"WebVRFreeCamera\", function (name, scene) {\r\n return function () { return new WebVRFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n_node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].AddNodeConstructor(\"WebVRGamepadCamera\", function (name, scene) {\r\n return function () { return new WebVRFreeCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a WebVR camera.\r\n * The WebVR camera is Babylon's simple interface to interaction with Windows Mixed Reality, HTC Vive and Oculus Rift.\r\n * @example http://doc.babylonjs.com/how_to/webvr_camera\r\n */\r\nvar WebVRFreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebVRFreeCamera, _super);\r\n /**\r\n * Instantiates a WebVRFreeCamera.\r\n * @param name The name of the WebVRFreeCamera\r\n * @param position The starting anchor position for the camera\r\n * @param scene The scene the camera belongs to\r\n * @param webVROptions a set of customizable options for the webVRCamera\r\n */\r\n function WebVRFreeCamera(name, position, scene, webVROptions) {\r\n if (webVROptions === void 0) { webVROptions = {}; }\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.webVROptions = webVROptions;\r\n /**\r\n * @hidden\r\n * The vrDisplay tied to the camera. See https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay\r\n */\r\n _this._vrDevice = null;\r\n /**\r\n * The rawPose of the vrDevice.\r\n */\r\n _this.rawPose = null;\r\n _this._specsVersion = \"1.1\";\r\n _this._attached = false;\r\n _this._descendants = [];\r\n // Represents device position and rotation in room space. Should only be used to help calculate babylon space values\r\n _this._deviceRoomPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n _this._deviceRoomRotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].Identity();\r\n _this._standingMatrix = null;\r\n /**\r\n * Represents device position in babylon space.\r\n */\r\n _this.devicePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n /**\r\n * Represents device rotation in babylon space.\r\n */\r\n _this.deviceRotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].Identity();\r\n /**\r\n * The scale of the device to be used when translating from device space to babylon space.\r\n */\r\n _this.deviceScaleFactor = 1;\r\n _this._deviceToWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n _this._worldToDevice = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n /**\r\n * References to the webVR controllers for the vrDevice.\r\n */\r\n _this.controllers = [];\r\n /**\r\n * Emits an event when a controller is attached.\r\n */\r\n _this.onControllersAttachedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Emits an event when a controller's mesh has been loaded;\r\n */\r\n _this.onControllerMeshLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Emits an event when the HMD's pose has been updated.\r\n */\r\n _this.onPoseUpdatedFromDeviceObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._poseSet = false;\r\n /**\r\n * If the rig cameras be used as parent instead of this camera.\r\n */\r\n _this.rigParenting = true;\r\n _this._defaultHeight = undefined;\r\n _this._htmlElementAttached = null;\r\n _this._detachIfAttached = function () {\r\n var vrDisplay = _this.getEngine().getVRDevice();\r\n if (vrDisplay && !vrDisplay.isPresenting && _this._htmlElementAttached) {\r\n _this.detachControl(_this._htmlElementAttached);\r\n }\r\n };\r\n _this._workingVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n _this._oneVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].One();\r\n _this._workingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n _this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"]();\r\n _this._cache.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n if (webVROptions.defaultHeight) {\r\n _this._defaultHeight = webVROptions.defaultHeight;\r\n _this.position.y = _this._defaultHeight;\r\n }\r\n _this.minZ = 0.1;\r\n //legacy support - the compensation boolean was removed.\r\n if (arguments.length === 5) {\r\n _this.webVROptions = arguments[4];\r\n }\r\n // default webVR options\r\n if (_this.webVROptions.trackPosition == undefined) {\r\n _this.webVROptions.trackPosition = true;\r\n }\r\n if (_this.webVROptions.controllerMeshes == undefined) {\r\n _this.webVROptions.controllerMeshes = true;\r\n }\r\n if (_this.webVROptions.defaultLightingOnControllers == undefined) {\r\n _this.webVROptions.defaultLightingOnControllers = true;\r\n }\r\n _this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"]();\r\n if (_this.webVROptions && _this.webVROptions.positionScale) {\r\n _this.deviceScaleFactor = _this.webVROptions.positionScale;\r\n }\r\n //enable VR\r\n var engine = _this.getEngine();\r\n _this._onVREnabled = function (success) { if (success) {\r\n _this.initControllers();\r\n } };\r\n engine.onVRRequestPresentComplete.add(_this._onVREnabled);\r\n engine.initWebVR().add(function (event) {\r\n if (!event.vrDisplay || _this._vrDevice === event.vrDisplay) {\r\n return;\r\n }\r\n _this._vrDevice = event.vrDisplay;\r\n //reset the rig parameters.\r\n _this.setCameraRigMode(_Cameras_camera__WEBPACK_IMPORTED_MODULE_3__[\"Camera\"].RIG_MODE_WEBVR, { parentCamera: _this, vrDisplay: _this._vrDevice, frameData: _this._frameData, specs: _this._specsVersion });\r\n if (_this._attached) {\r\n _this.getEngine().enableVR();\r\n }\r\n });\r\n if (typeof (VRFrameData) !== \"undefined\") {\r\n _this._frameData = new VRFrameData();\r\n }\r\n if (webVROptions.useMultiview) {\r\n if (!_this.getScene().getEngine().getCaps().multiview) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"Multiview is not supported, falling back to standard rendering\");\r\n _this._useMultiviewToSingleView = false;\r\n }\r\n else {\r\n _this._useMultiviewToSingleView = true;\r\n _this._rigPostProcess = new _PostProcesses_vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"VRMultiviewToSingleviewPostProcess\"](\"VRMultiviewToSingleview\", _this, 1.0);\r\n }\r\n }\r\n /**\r\n * The idea behind the following lines:\r\n * objects that have the camera as parent should actually have the rig cameras as a parent.\r\n * BUT, each of those cameras has a different view matrix, which means that if we set the parent to the first rig camera,\r\n * the second will not show it correctly.\r\n *\r\n * To solve this - each object that has the camera as parent will be added to a protected array.\r\n * When the rig camera renders, it will take this array and set all of those to be its children.\r\n * This way, the right camera will be used as a parent, and the mesh will be rendered correctly.\r\n * Amazing!\r\n */\r\n scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n if (camera.parent === _this && _this.rigParenting) {\r\n _this._descendants = _this.getDescendants(true, function (n) {\r\n // don't take the cameras or the controllers!\r\n var isController = _this.controllers.some(function (controller) { return controller._mesh === n; });\r\n var isRigCamera = _this._rigCameras.indexOf(n) !== -1;\r\n return !isController && !isRigCamera;\r\n });\r\n _this._descendants.forEach(function (node) {\r\n node.parent = camera;\r\n });\r\n }\r\n });\r\n scene.onAfterCameraRenderObservable.add(function (camera) {\r\n if (camera.parent === _this && _this.rigParenting) {\r\n _this._descendants.forEach(function (node) {\r\n node.parent = _this;\r\n });\r\n }\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Gets the device distance from the ground in meters.\r\n * @returns the distance in meters from the vrDevice to ground in device space. If standing matrix is not supported for the vrDevice 0 is returned.\r\n */\r\n WebVRFreeCamera.prototype.deviceDistanceToRoomGround = function () {\r\n if (this._standingMatrix) {\r\n // Add standing matrix offset to get real offset from ground in room\r\n this._standingMatrix.getTranslationToRef(this._workingVector);\r\n return this._deviceRoomPosition.y + this._workingVector.y;\r\n }\r\n //If VRDisplay does not inform stage parameters and no default height is set we fallback to zero.\r\n return this._defaultHeight || 0;\r\n };\r\n /**\r\n * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.\r\n * @param callback will be called when the standing matrix is set. Callback parameter is if the standing matrix is supported.\r\n */\r\n WebVRFreeCamera.prototype.useStandingMatrix = function (callback) {\r\n var _this = this;\r\n if (callback === void 0) { callback = function (bool) { }; }\r\n // Use standing matrix if available\r\n this.getEngine().initWebVRAsync().then(function (result) {\r\n if (!result.vrDisplay || !result.vrDisplay.stageParameters || !result.vrDisplay.stageParameters.sittingToStandingTransform || !_this.webVROptions.trackPosition) {\r\n callback(false);\r\n }\r\n else {\r\n _this._standingMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"]();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromFloat32ArrayToRefScaled(result.vrDisplay.stageParameters.sittingToStandingTransform, 0, 1, _this._standingMatrix);\r\n if (!_this.getScene().useRightHandedSystem) {\r\n if (_this._standingMatrix) {\r\n _this._standingMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n }\r\n callback(true);\r\n }\r\n });\r\n };\r\n /**\r\n * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.\r\n * @returns A promise with a boolean set to if the standing matrix is supported.\r\n */\r\n WebVRFreeCamera.prototype.useStandingMatrixAsync = function () {\r\n var _this = this;\r\n return new Promise(function (res) {\r\n _this.useStandingMatrix(function (supported) {\r\n res(supported);\r\n });\r\n });\r\n };\r\n /**\r\n * Disposes the camera\r\n */\r\n WebVRFreeCamera.prototype.dispose = function () {\r\n this._detachIfAttached();\r\n this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled);\r\n if (this._updateCacheWhenTrackingDisabledObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver);\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets a vrController by name.\r\n * @param name The name of the controller to retreive\r\n * @returns the controller matching the name specified or null if not found\r\n */\r\n WebVRFreeCamera.prototype.getControllerByName = function (name) {\r\n for (var _i = 0, _a = this.controllers; _i < _a.length; _i++) {\r\n var gp = _a[_i];\r\n if (gp.hand === name) {\r\n return gp;\r\n }\r\n }\r\n return null;\r\n };\r\n Object.defineProperty(WebVRFreeCamera.prototype, \"leftController\", {\r\n /**\r\n * The controller corresponding to the users left hand.\r\n */\r\n get: function () {\r\n if (!this._leftController) {\r\n this._leftController = this.getControllerByName(\"left\");\r\n }\r\n return this._leftController;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebVRFreeCamera.prototype, \"rightController\", {\r\n /**\r\n * The controller corresponding to the users right hand.\r\n */\r\n get: function () {\r\n if (!this._rightController) {\r\n this._rightController = this.getControllerByName(\"right\");\r\n }\r\n return this._rightController;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Casts a ray forward from the vrCamera's gaze.\r\n * @param length Length of the ray (default: 100)\r\n * @returns the ray corresponding to the gaze\r\n */\r\n WebVRFreeCamera.prototype.getForwardRay = function (length) {\r\n if (length === void 0) { length = 100; }\r\n if (this.leftCamera) {\r\n // Use left eye to avoid computation to compute center on every call\r\n return _super.prototype.getForwardRay.call(this, length, this.leftCamera.getWorldMatrix(), this.leftCamera.globalPosition); // Need the actual rendered camera\r\n }\r\n else {\r\n return _super.prototype.getForwardRay.call(this, length);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Updates the camera based on device's frame data\r\n */\r\n WebVRFreeCamera.prototype._checkInputs = function () {\r\n if (this._vrDevice && this._vrDevice.isPresenting) {\r\n this._vrDevice.getFrameData(this._frameData);\r\n this.updateFromDevice(this._frameData.pose);\r\n }\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /**\r\n * Updates the poseControlled values based on the input device pose.\r\n * @param poseData Pose coming from the device\r\n */\r\n WebVRFreeCamera.prototype.updateFromDevice = function (poseData) {\r\n if (poseData && poseData.orientation && poseData.orientation.length === 4) {\r\n this.rawPose = poseData;\r\n this._deviceRoomRotationQuaternion.copyFromFloats(poseData.orientation[0], poseData.orientation[1], -poseData.orientation[2], -poseData.orientation[3]);\r\n if (this.getScene().useRightHandedSystem) {\r\n this._deviceRoomRotationQuaternion.z *= -1;\r\n this._deviceRoomRotationQuaternion.w *= -1;\r\n }\r\n if (this.webVROptions.trackPosition && this.rawPose.position) {\r\n this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2]);\r\n if (this.getScene().useRightHandedSystem) {\r\n this._deviceRoomPosition.z *= -1;\r\n }\r\n }\r\n this._poseSet = true;\r\n }\r\n };\r\n /**\r\n * WebVR's attach control will start broadcasting frames to the device.\r\n * Note that in certain browsers (chrome for example) this function must be called\r\n * within a user-interaction callback. Example:\r\n *
 scene.onPointerDown = function() { camera.attachControl(canvas); }
\r\n *\r\n * @param element html element to attach the vrDevice to\r\n * @param noPreventDefault prevent the default html element operation when attaching the vrDevice\r\n */\r\n WebVRFreeCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n _super.prototype.attachControl.call(this, element, noPreventDefault);\r\n this._attached = true;\r\n this._htmlElementAttached = element;\r\n noPreventDefault = _Cameras_camera__WEBPACK_IMPORTED_MODULE_3__[\"Camera\"].ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;\r\n if (this._vrDevice) {\r\n this.getEngine().enableVR();\r\n }\r\n var hostWindow = this._scene.getEngine().getHostWindow();\r\n hostWindow.addEventListener('vrdisplaypresentchange', this._detachIfAttached);\r\n };\r\n /**\r\n * Detaches the camera from the html element and disables VR\r\n *\r\n * @param element html element to detach from\r\n */\r\n WebVRFreeCamera.prototype.detachControl = function (element) {\r\n this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);\r\n this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);\r\n _super.prototype.detachControl.call(this, element);\r\n this._attached = false;\r\n this.getEngine().disableVR();\r\n window.removeEventListener('vrdisplaypresentchange', this._detachIfAttached);\r\n };\r\n /**\r\n * @returns the name of this class\r\n */\r\n WebVRFreeCamera.prototype.getClassName = function () {\r\n return \"WebVRFreeCamera\";\r\n };\r\n /**\r\n * Calls resetPose on the vrDisplay\r\n * See: https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/resetPose\r\n */\r\n WebVRFreeCamera.prototype.resetToCurrentRotation = function () {\r\n //uses the vrDisplay's \"resetPose()\".\r\n //pitch and roll won't be affected.\r\n this._vrDevice.resetPose();\r\n };\r\n /**\r\n * @hidden\r\n * Updates the rig cameras (left and right eye)\r\n */\r\n WebVRFreeCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n camLeft.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion);\r\n camLeft.position.copyFrom(this._deviceRoomPosition);\r\n camRight.position.copyFrom(this._deviceRoomPosition);\r\n };\r\n // Remove translation from 6dof headset if trackposition is set to false\r\n WebVRFreeCamera.prototype._correctPositionIfNotTrackPosition = function (matrix, isViewMatrix) {\r\n if (isViewMatrix === void 0) { isViewMatrix = false; }\r\n if (this.rawPose && this.rawPose.position && !this.webVROptions.trackPosition) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].TranslationToRef(this.rawPose.position[0], this.rawPose.position[1], -this.rawPose.position[2], this._tmpMatrix);\r\n if (!isViewMatrix) {\r\n this._tmpMatrix.invert();\r\n }\r\n this._tmpMatrix.multiplyToRef(matrix, matrix);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Updates the cached values of the camera\r\n * @param ignoreParentClass ignores updating the parent class's cache (default: false)\r\n */\r\n WebVRFreeCamera.prototype._updateCache = function (ignoreParentClass) {\r\n var _this = this;\r\n if (!this.rotationQuaternion.equals(this._cache.rotationQuaternion) || !this.position.equals(this._cache.position)) {\r\n // Update to ensure devicePosition is up to date with most recent _deviceRoomPosition\r\n if (!this.updateCacheCalled) {\r\n // make sure it is only called once per loop. this.update() might cause an infinite loop.\r\n this.updateCacheCalled = true;\r\n this.update();\r\n }\r\n // Set working vector to the device position in room space rotated by the new rotation\r\n this.rotationQuaternion.toRotationMatrix(this._workingMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinatesToRef(this._deviceRoomPosition, this._workingMatrix, this._workingVector);\r\n // Subtract this vector from the current device position in world to get the translation for the device world matrix\r\n this.devicePosition.subtractToRef(this._workingVector, this._workingVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].ComposeToRef(this._oneVector, this.rotationQuaternion, this._workingVector, this._deviceToWorld);\r\n // Add translation from anchor position\r\n this._deviceToWorld.getTranslationToRef(this._workingVector);\r\n this._workingVector.addInPlace(this.position);\r\n this._workingVector.subtractInPlace(this._cache.position);\r\n this._deviceToWorld.setTranslation(this._workingVector);\r\n // Set an inverted matrix to be used when updating the camera\r\n this._deviceToWorld.invertToRef(this._worldToDevice);\r\n // Update the gamepad to ensure the mesh is updated on the same frame as camera\r\n this.controllers.forEach(function (controller) {\r\n controller._deviceToWorld.copyFrom(_this._deviceToWorld);\r\n _this._correctPositionIfNotTrackPosition(controller._deviceToWorld);\r\n controller.update();\r\n });\r\n }\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this.updateCacheCalled = false;\r\n };\r\n /**\r\n * @hidden\r\n * Get current device position in babylon world\r\n */\r\n WebVRFreeCamera.prototype._computeDevicePosition = function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinatesToRef(this._deviceRoomPosition, this._deviceToWorld, this.devicePosition);\r\n };\r\n /**\r\n * Updates the current device position and rotation in the babylon world\r\n */\r\n WebVRFreeCamera.prototype.update = function () {\r\n this._computeDevicePosition();\r\n // Get current device rotation in babylon world\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix);\r\n this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Quaternion\"].FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);\r\n if (this._poseSet) {\r\n this.onPoseUpdatedFromDeviceObservable.notifyObservers(null);\r\n }\r\n _super.prototype.update.call(this);\r\n };\r\n /**\r\n * @hidden\r\n * Gets the view matrix of this camera (Always set to identity as left and right eye cameras contain the actual view matrix)\r\n * @returns an identity matrix\r\n */\r\n WebVRFreeCamera.prototype._getViewMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n };\r\n /**\r\n * This function is called by the two RIG cameras.\r\n * 'this' is the left or right camera (and NOT (!!!) the WebVRFreeCamera instance)\r\n * @hidden\r\n */\r\n WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {\r\n // Update the parent camera prior to using a child camera to avoid desynchronization\r\n var parentCamera = this._cameraRigParams[\"parentCamera\"];\r\n parentCamera._updateCache();\r\n //WebVR 1.1\r\n var viewArray = this._cameraRigParams[\"left\"] ? this._cameraRigParams[\"frameData\"].leftViewMatrix : this._cameraRigParams[\"frameData\"].rightViewMatrix;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromArrayToRef(viewArray, 0, this._webvrViewMatrix);\r\n if (!this.getScene().useRightHandedSystem) {\r\n this._webvrViewMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n // update the camera rotation matrix\r\n this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n // should the view matrix be updated with scale and position offset?\r\n if (parentCamera.deviceScaleFactor !== 1) {\r\n this._webvrViewMatrix.invert();\r\n // scale the position, if set\r\n if (parentCamera.deviceScaleFactor) {\r\n this._webvrViewMatrix.multiplyAtIndex(12, parentCamera.deviceScaleFactor);\r\n this._webvrViewMatrix.multiplyAtIndex(13, parentCamera.deviceScaleFactor);\r\n this._webvrViewMatrix.multiplyAtIndex(14, parentCamera.deviceScaleFactor);\r\n }\r\n this._webvrViewMatrix.invert();\r\n }\r\n // Remove translation from 6dof headset if trackposition is set to false\r\n parentCamera._correctPositionIfNotTrackPosition(this._webvrViewMatrix, true);\r\n parentCamera._worldToDevice.multiplyToRef(this._webvrViewMatrix, this._webvrViewMatrix);\r\n // Compute global position\r\n this._workingMatrix = this._workingMatrix || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Identity();\r\n this._webvrViewMatrix.invertToRef(this._workingMatrix);\r\n this._workingMatrix.multiplyToRef(parentCamera.getWorldMatrix(), this._workingMatrix);\r\n this._workingMatrix.getTranslationToRef(this._globalPosition);\r\n this._markSyncedWithParent();\r\n return this._webvrViewMatrix;\r\n };\r\n /** @hidden */\r\n WebVRFreeCamera.prototype._getWebVRProjectionMatrix = function () {\r\n var parentCamera = this.parent;\r\n parentCamera._vrDevice.depthNear = parentCamera.minZ;\r\n parentCamera._vrDevice.depthFar = parentCamera.maxZ;\r\n var projectionArray = this._cameraRigParams[\"left\"] ? this._cameraRigParams[\"frameData\"].leftProjectionMatrix : this._cameraRigParams[\"frameData\"].rightProjectionMatrix;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].FromArrayToRef(projectionArray, 0, this._projectionMatrix);\r\n //babylon compatible matrix\r\n if (!this.getScene().useRightHandedSystem) {\r\n this._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Initializes the controllers and their meshes\r\n */\r\n WebVRFreeCamera.prototype.initControllers = function () {\r\n var _this = this;\r\n this.controllers = [];\r\n var manager = this.getScene().gamepadManager;\r\n this._onGamepadDisconnectedObserver = manager.onGamepadDisconnectedObservable.add(function (gamepad) {\r\n if (gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"].POSE_ENABLED) {\r\n var webVrController = gamepad;\r\n if (webVrController.defaultModel) {\r\n webVrController.defaultModel.setEnabled(false);\r\n }\r\n if (webVrController.hand === \"right\") {\r\n _this._rightController = null;\r\n }\r\n if (webVrController.hand === \"left\") {\r\n _this._leftController = null;\r\n }\r\n var controllerIndex = _this.controllers.indexOf(webVrController);\r\n if (controllerIndex !== -1) {\r\n _this.controllers.splice(controllerIndex, 1);\r\n }\r\n }\r\n });\r\n this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {\r\n if (gamepad.type === _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"].POSE_ENABLED) {\r\n var webVrController_1 = gamepad;\r\n if (!_this.webVROptions.trackPosition) {\r\n webVrController_1._disableTrackPosition(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](webVrController_1.hand == \"left\" ? -0.15 : 0.15, -0.5, 0.25));\r\n // Cache must be updated before rendering controllers to avoid them being one frame behind\r\n if (!_this._updateCacheWhenTrackingDisabledObserver) {\r\n _this._updateCacheWhenTrackingDisabledObserver = _this._scene.onBeforeRenderObservable.add(function () {\r\n _this._updateCache();\r\n });\r\n }\r\n }\r\n webVrController_1.deviceScaleFactor = _this.deviceScaleFactor;\r\n webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);\r\n _this._correctPositionIfNotTrackPosition(webVrController_1._deviceToWorld);\r\n if (_this.webVROptions.controllerMeshes) {\r\n if (webVrController_1.defaultModel) {\r\n webVrController_1.defaultModel.setEnabled(true);\r\n }\r\n else {\r\n // Load the meshes\r\n webVrController_1.initControllerMesh(_this.getScene(), function (loadedMesh) {\r\n loadedMesh.scaling.scaleInPlace(_this.deviceScaleFactor);\r\n _this.onControllerMeshLoadedObservable.notifyObservers(webVrController_1);\r\n if (_this.webVROptions.defaultLightingOnControllers) {\r\n if (!_this._lightOnControllers) {\r\n _this._lightOnControllers = new _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_8__[\"HemisphericLight\"](\"vrControllersLight\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](0, 1, 0), _this.getScene());\r\n }\r\n var activateLightOnSubMeshes_1 = function (mesh, light) {\r\n var children = mesh.getChildren();\r\n if (children && children.length !== 0) {\r\n children.forEach(function (mesh) {\r\n light.includedOnlyMeshes.push(mesh);\r\n activateLightOnSubMeshes_1(mesh, light);\r\n });\r\n }\r\n };\r\n _this._lightOnControllers.includedOnlyMeshes.push(loadedMesh);\r\n activateLightOnSubMeshes_1(loadedMesh, _this._lightOnControllers);\r\n }\r\n });\r\n }\r\n }\r\n webVrController_1.attachToPoseControlledCamera(_this);\r\n // since this is async - sanity check. Is the controller already stored?\r\n if (_this.controllers.indexOf(webVrController_1) === -1) {\r\n //add to the controllers array\r\n _this.controllers.push(webVrController_1);\r\n // Forced to add some control code for Vive as it doesn't always fill properly the \"hand\" property\r\n // Sometimes, both controllers are set correctly (left and right), sometimes none, sometimes only one of them...\r\n // So we're overriding setting left & right manually to be sure\r\n var firstViveWandDetected = false;\r\n for (var i = 0; i < _this.controllers.length; i++) {\r\n if (_this.controllers[i].controllerType === _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_6__[\"PoseEnabledControllerType\"].VIVE) {\r\n if (!firstViveWandDetected) {\r\n firstViveWandDetected = true;\r\n _this.controllers[i].hand = \"left\";\r\n }\r\n else {\r\n _this.controllers[i].hand = \"right\";\r\n }\r\n }\r\n }\r\n //did we find enough controllers? Great! let the developer know.\r\n if (_this.controllers.length >= 2) {\r\n _this.onControllersAttachedObservable.notifyObservers(_this.controllers);\r\n }\r\n }\r\n }\r\n });\r\n };\r\n return WebVRFreeCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_2__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/index.ts\":\n/*!*****************************!*\\\n !*** ./Cameras/XR/index.ts ***!\n \\*****************************/\n/*! exports provided: WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _webXRCamera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webXRCamera */ \"./Cameras/XR/webXRCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _webXRCamera__WEBPACK_IMPORTED_MODULE_0__[\"WebXRCamera\"]; });\n\n/* harmony import */ var _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webXREnterExitUI */ \"./Cameras/XR/webXREnterExitUI.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_1__[\"WebXREnterExitUI\"]; });\n\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRExperienceHelper\"]; });\n\n/* harmony import */ var _webXRInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webXRInput */ \"./Cameras/XR/webXRInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _webXRInput__WEBPACK_IMPORTED_MODULE_3__[\"WebXRInput\"]; });\n\n/* harmony import */ var _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webXRControllerTeleportation */ \"./Cameras/XR/webXRControllerTeleportation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony import */ var _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webXRControllerPointerSelection */ \"./Cameras/XR/webXRControllerPointerSelection.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_5__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony import */ var _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webXRControllerModelLoader */ \"./Cameras/XR/webXRControllerModelLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_6__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony import */ var _webXRController__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./webXRController */ \"./Cameras/XR/webXRController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _webXRController__WEBPACK_IMPORTED_MODULE_7__[\"WebXRController\"]; });\n\n/* harmony import */ var _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./webXRManagedOutputCanvas */ \"./Cameras/XR/webXRManagedOutputCanvas.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_8__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony import */ var _webXRSessionManager__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./webXRSessionManager */ \"./Cameras/XR/webXRSessionManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _webXRSessionManager__WEBPACK_IMPORTED_MODULE_9__[\"WebXRSessionManager\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRCamera.ts\":\n/*!***********************************!*\\\n !*** ./Cameras/XR/webXRCamera.ts ***!\n \\***********************************/\n/*! exports provided: WebXRCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return WebXRCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Cameras/targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n */\r\nvar WebXRCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebXRCamera, _super);\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n */\r\n function WebXRCamera(name, scene) {\r\n var _this = _super.call(this, name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), scene) || this;\r\n // Initial camera configuration\r\n _this.minZ = 0.1;\r\n _this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n _this.cameraRigMode = _Cameras_camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_CUSTOM;\r\n _this.updateUpVectorFromRotation = true;\r\n _this._updateNumberOfRigCameras(1);\r\n return _this;\r\n }\r\n WebXRCamera.prototype._updateNumberOfRigCameras = function (viewCount) {\r\n if (viewCount === void 0) { viewCount = 1; }\r\n while (this.rigCameras.length < viewCount) {\r\n var newCamera = new _Cameras_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"](\"view: \" + this.rigCameras.length, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.parent = this;\r\n newCamera.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n newCamera.updateUpVectorFromRotation = true;\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n var removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n WebXRCamera.prototype._updateForDualEyeDebugging = function (pupilDistance) {\r\n if (pupilDistance === void 0) { pupilDistance = 0.01; }\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_5__[\"Viewport\"](0, 0, 0.5, 1.0);\r\n this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_5__[\"Viewport\"](0.5, 0, 0.5, 1.0);\r\n this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n };\r\n /**\r\n * Updates the cameras position from the current pose information of the XR session\r\n * @param xrSessionManager the session containing pose information\r\n * @returns true if the camera has been updated, false if the session did not contain pose or frame data\r\n */\r\n WebXRCamera.prototype.updateFromXRSessionManager = function (xrSessionManager) {\r\n var _this = this;\r\n // Ensure all frame data is available\r\n if (!xrSessionManager.currentFrame || !xrSessionManager.currentFrame.getViewerPose) {\r\n return false;\r\n }\r\n var pose = xrSessionManager.currentFrame.getViewerPose(xrSessionManager.referenceSpace);\r\n if (!pose || !pose.transform || !pose.transform.matrix) {\r\n return false;\r\n }\r\n // Update the parent cameras matrix\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromFloat32ArrayToRefScaled(pose.transform.matrix, 0, 1, WebXRCamera._TmpMatrix);\r\n if (!this._scene.useRightHandedSystem) {\r\n WebXRCamera._TmpMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n WebXRCamera._TmpMatrix.getTranslationToRef(this.position);\r\n WebXRCamera._TmpMatrix.getRotationMatrixToRef(WebXRCamera._TmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromRotationMatrixToRef(WebXRCamera._TmpMatrix, this.rotationQuaternion);\r\n this.computeWorldMatrix();\r\n // Update camera rigs\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n pose.views.forEach(function (view, i) {\r\n // Update view/projection matrix\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromFloat32ArrayToRefScaled(view.transform.matrix, 0, 1, _this.rigCameras[i]._computedViewMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, _this.rigCameras[i]._projectionMatrix);\r\n if (!_this._scene.useRightHandedSystem) {\r\n _this.rigCameras[i]._computedViewMatrix.toggleModelMatrixHandInPlace();\r\n _this.rigCameras[i]._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n // Update viewport\r\n if (xrSessionManager.session.renderState.baseLayer) {\r\n var viewport = xrSessionManager.session.renderState.baseLayer.getViewport(view);\r\n var width = xrSessionManager.session.renderState.baseLayer.framebufferWidth;\r\n var height = xrSessionManager.session.renderState.baseLayer.framebufferHeight;\r\n _this.rigCameras[i].viewport.width = viewport.width / width;\r\n _this.rigCameras[i].viewport.height = viewport.height / height;\r\n _this.rigCameras[i].viewport.x = viewport.x / width;\r\n _this.rigCameras[i].viewport.y = viewport.y / height;\r\n }\r\n // Set cameras to render to the session's render target\r\n _this.rigCameras[i].outputRenderTarget = xrSessionManager._sessionRenderTargetTexture;\r\n });\r\n return true;\r\n };\r\n WebXRCamera._TmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n return WebXRCamera;\r\n}(_Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_3__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRController.ts\":\n/*!***************************************!*\\\n !*** ./Cameras/XR/webXRController.ts ***!\n \\***************************************/\n/*! exports provided: WebXRController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return WebXRController; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n/**\r\n * Represents an XR input\r\n */\r\nvar WebXRController = /** @class */ (function () {\r\n /**\r\n * Creates the controller\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n * @param scene the scene which the controller should be associated to\r\n * @param inputSource the underlying input source for the controller\r\n * @param parentContainer parent that the controller meshes should be children of\r\n */\r\n function WebXRController(scene, \r\n /** The underlying input source for the controller */\r\n inputSource, parentContainer) {\r\n if (parentContainer === void 0) { parentContainer = null; }\r\n this.scene = scene;\r\n this.inputSource = inputSource;\r\n this.parentContainer = parentContainer;\r\n /**\r\n * Event that fires when the controller is removed/disposed\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n this.pointer = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"](\"controllerPointer\", scene);\r\n if (parentContainer) {\r\n parentContainer.addChild(this.pointer);\r\n }\r\n if (this.inputSource.gripSpace) {\r\n this.grip = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"](\"controllerGrip\", this.scene);\r\n if (this.parentContainer) {\r\n this.parentContainer.addChild(this.grip);\r\n }\r\n }\r\n }\r\n /**\r\n * Updates the controller pose based on the given XRFrame\r\n * @param xrFrame xr frame to update the pose with\r\n * @param referenceSpace reference space to use\r\n */\r\n WebXRController.prototype.updateFromXRFrame = function (xrFrame, referenceSpace) {\r\n var pose = xrFrame.getPose(this.inputSource.targetRaySpace, referenceSpace);\r\n // Update the pointer mesh\r\n if (pose) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromFloat32ArrayToRefScaled(pose.transform.matrix, 0, 1, this._tmpMatrix);\r\n if (!this.pointer.getScene().useRightHandedSystem) {\r\n this._tmpMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n if (!this.pointer.rotationQuaternion) {\r\n this.pointer.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._tmpMatrix.decompose(this.pointer.scaling, this.pointer.rotationQuaternion, this.pointer.position);\r\n }\r\n // Update the grip mesh if it exists\r\n if (this.inputSource.gripSpace && this.grip) {\r\n var pose_1 = xrFrame.getPose(this.inputSource.gripSpace, referenceSpace);\r\n if (pose_1) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromFloat32ArrayToRefScaled(pose_1.transform.matrix, 0, 1, this._tmpMatrix);\r\n if (!this.grip.getScene().useRightHandedSystem) {\r\n this._tmpMatrix.toggleModelMatrixHandInPlace();\r\n }\r\n if (!this.grip.rotationQuaternion) {\r\n this.grip.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._tmpMatrix.decompose(this.grip.scaling, this.grip.rotationQuaternion, this.grip.position);\r\n }\r\n }\r\n };\r\n /**\r\n * Gets a world space ray coming from the controller\r\n * @param result the resulting ray\r\n */\r\n WebXRController.prototype.getWorldPointerRayToRef = function (result) {\r\n // Force update to ensure picked point is synced with ray\r\n var worldMatrix = this.pointer.computeWorldMatrix(true);\r\n worldMatrix.decompose(undefined, this._tmpQuaternion, undefined);\r\n this._tmpVector.set(0, 0, 1);\r\n this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion, this._tmpVector);\r\n result.origin = this.pointer.absolutePosition;\r\n result.direction.copyFrom(this._tmpVector);\r\n result.length = 1000;\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXRController.prototype.dispose = function () {\r\n if (this.grip) {\r\n this.grip.dispose();\r\n }\r\n this.pointer.dispose();\r\n this.onDisposeObservable.notifyObservers({});\r\n };\r\n return WebXRController;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRControllerModelLoader.ts\":\n/*!**************************************************!*\\\n !*** ./Cameras/XR/webXRControllerModelLoader.ts ***!\n \\**************************************************/\n/*! exports provided: WebXRControllerModelLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return WebXRControllerModelLoader; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Gamepads_Controllers_windowsMotionController__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Gamepads/Controllers/windowsMotionController */ \"./Gamepads/Controllers/windowsMotionController.ts\");\n/* harmony import */ var _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Gamepads/Controllers/oculusTouchController */ \"./Gamepads/Controllers/oculusTouchController.ts\");\n/* harmony import */ var _Gamepads_Controllers_viveController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Gamepads/Controllers/viveController */ \"./Gamepads/Controllers/viveController.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Loads a controller model and adds it as a child of the WebXRControllers grip when the controller is created\r\n */\r\nvar WebXRControllerModelLoader = /** @class */ (function () {\r\n /**\r\n * Creates the WebXRControllerModelLoader\r\n * @param input xr input that creates the controllers\r\n */\r\n function WebXRControllerModelLoader(input) {\r\n input.onControllerAddedObservable.add(function (c) {\r\n if (c.inputSource.gamepad && c.inputSource.gamepad.id === \"htc-vive\") {\r\n var controllerModel_1 = new _Gamepads_Controllers_viveController__WEBPACK_IMPORTED_MODULE_3__[\"ViveController\"](c.inputSource.gamepad);\r\n controllerModel_1.hand = c.inputSource.handedness;\r\n controllerModel_1.isXR = true;\r\n controllerModel_1.initControllerMesh(c.grip.getScene(), function (m) {\r\n m.isPickable = false;\r\n m.getChildMeshes(false).forEach(function (m) {\r\n m.isPickable = false;\r\n });\r\n controllerModel_1.mesh.parent = c.grip;\r\n controllerModel_1.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI, 0);\r\n });\r\n }\r\n else if (c.inputSource.gamepad && c.inputSource.gamepad.id === \"oculus-touch\") {\r\n var controllerModel_2 = new _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__[\"OculusTouchController\"](c.inputSource.gamepad);\r\n controllerModel_2.hand = c.inputSource.handedness;\r\n controllerModel_2.isXR = true;\r\n controllerModel_2.initControllerMesh(c.grip.getScene(), function (m) {\r\n controllerModel_2.mesh.parent = c.grip;\r\n controllerModel_2.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI, 0);\r\n controllerModel_2.mesh.position.y = 0.034;\r\n controllerModel_2.mesh.position.z = 0.052;\r\n });\r\n }\r\n else if (c.inputSource.gamepad && c.inputSource.gamepad.id === \"oculus-quest\") {\r\n _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__[\"OculusTouchController\"]._IsQuest = true;\r\n var controllerModel_3 = new _Gamepads_Controllers_oculusTouchController__WEBPACK_IMPORTED_MODULE_2__[\"OculusTouchController\"](c.inputSource.gamepad);\r\n controllerModel_3.hand = c.inputSource.handedness;\r\n controllerModel_3.isXR = true;\r\n controllerModel_3.initControllerMesh(c.grip.getScene(), function (m) {\r\n controllerModel_3.mesh.parent = c.grip;\r\n controllerModel_3.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(Math.PI / -4, Math.PI, 0);\r\n });\r\n }\r\n else {\r\n var controllerModel_4 = new _Gamepads_Controllers_windowsMotionController__WEBPACK_IMPORTED_MODULE_1__[\"WindowsMotionController\"](c.inputSource.gamepad);\r\n controllerModel_4.hand = c.inputSource.handedness;\r\n controllerModel_4.isXR = true;\r\n controllerModel_4.initControllerMesh(c.grip.getScene(), function (m) {\r\n controllerModel_4.mesh.parent = c.grip;\r\n controllerModel_4.mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI, 0);\r\n });\r\n }\r\n });\r\n }\r\n return WebXRControllerModelLoader;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRControllerPointerSelection.ts\":\n/*!*******************************************************!*\\\n !*** ./Cameras/XR/webXRControllerPointerSelection.ts ***!\n \\*******************************************************/\n/*! exports provided: WebXRControllerPointerSelection */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return WebXRControllerPointerSelection; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Handles pointer input automatically for the pointer of XR controllers\r\n */\r\nvar WebXRControllerPointerSelection = /** @class */ (function () {\r\n /**\r\n * Creates a WebXRControllerPointerSelection\r\n * @param input input manager to setup pointer selection\r\n */\r\n function WebXRControllerPointerSelection(input) {\r\n var _this = this;\r\n this._tmpRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]());\r\n input.onControllerAddedObservable.add(function (controller) {\r\n var scene = controller.pointer.getScene();\r\n var laserPointer;\r\n var cursorMesh;\r\n var triggerDown = false;\r\n var id;\r\n id = WebXRControllerPointerSelection._idCounter++;\r\n // Create a laser pointer for the XR controller\r\n laserPointer = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateCylinder(\"laserPointer\", 1, 0.0002, 0.004, 20, 1, scene, false);\r\n laserPointer.parent = controller.pointer;\r\n var laserPointerMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__[\"StandardMaterial\"](\"laserPointerMat\", scene);\r\n laserPointerMaterial.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.7, 0.7, 0.7);\r\n laserPointerMaterial.alpha = 0.6;\r\n laserPointer.material = laserPointerMaterial;\r\n laserPointer.rotation.x = Math.PI / 2;\r\n _this._updatePointerDistance(laserPointer, 1);\r\n laserPointer.isPickable = false;\r\n // Create a gaze tracker for the XR controlelr\r\n cursorMesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorus(\"gazeTracker\", 0.0035 * 3, 0.0025 * 3, 20, scene, false);\r\n cursorMesh.bakeCurrentTransformIntoVertices();\r\n cursorMesh.isPickable = false;\r\n cursorMesh.isVisible = false;\r\n var targetMat = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__[\"StandardMaterial\"](\"targetMat\", scene);\r\n targetMat.specularColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Black();\r\n targetMat.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.7, 0.7, 0.7);\r\n targetMat.backFaceCulling = false;\r\n cursorMesh.material = targetMat;\r\n var renderObserver = scene.onBeforeRenderObservable.add(function () {\r\n // Every frame check collisions/input\r\n controller.getWorldPointerRayToRef(_this._tmpRay);\r\n var pick = scene.pickWithRay(_this._tmpRay);\r\n if (pick) {\r\n if (controller.inputSource.gamepad && controller.inputSource.gamepad.buttons[0] && controller.inputSource.gamepad.buttons[0].value > 0.7) {\r\n if (!triggerDown) {\r\n scene.simulatePointerDown(pick, { pointerId: id });\r\n }\r\n triggerDown = true;\r\n }\r\n else {\r\n if (triggerDown) {\r\n scene.simulatePointerUp(pick, { pointerId: id });\r\n }\r\n triggerDown = false;\r\n }\r\n scene.simulatePointerMove(pick, { pointerId: id });\r\n }\r\n if (pick && pick.pickedPoint && pick.hit) {\r\n // Update laser state\r\n _this._updatePointerDistance(laserPointer, pick.distance);\r\n // Update cursor state\r\n cursorMesh.position.copyFrom(pick.pickedPoint);\r\n cursorMesh.scaling.x = Math.sqrt(pick.distance);\r\n cursorMesh.scaling.y = Math.sqrt(pick.distance);\r\n cursorMesh.scaling.z = Math.sqrt(pick.distance);\r\n // To avoid z-fighting\r\n var pickNormal = _this._convertNormalToDirectionOfRay(pick.getNormal(), _this._tmpRay);\r\n var deltaFighting = 0.002;\r\n cursorMesh.position.copyFrom(pick.pickedPoint);\r\n if (pickNormal) {\r\n var axis1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y, pickNormal);\r\n var axis2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(pickNormal, axis1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].RotationFromAxisToRef(axis2, pickNormal, axis1, cursorMesh.rotation);\r\n cursorMesh.position.addInPlace(pickNormal.scale(deltaFighting));\r\n }\r\n cursorMesh.isVisible = true;\r\n }\r\n else {\r\n cursorMesh.isVisible = false;\r\n }\r\n });\r\n controller.onDisposeObservable.addOnce(function () {\r\n laserPointer.dispose();\r\n cursorMesh.dispose();\r\n scene.onBeforeRenderObservable.remove(renderObserver);\r\n });\r\n });\r\n }\r\n WebXRControllerPointerSelection.prototype._convertNormalToDirectionOfRay = function (normal, ray) {\r\n if (normal) {\r\n var angle = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(normal, ray.direction));\r\n if (angle < Math.PI / 2) {\r\n normal.scaleInPlace(-1);\r\n }\r\n }\r\n return normal;\r\n };\r\n WebXRControllerPointerSelection.prototype._updatePointerDistance = function (_laserPointer, distance) {\r\n if (distance === void 0) { distance = 100; }\r\n _laserPointer.scaling.y = distance;\r\n _laserPointer.position.z = distance / 2;\r\n };\r\n WebXRControllerPointerSelection._idCounter = 0;\r\n return WebXRControllerPointerSelection;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRControllerTeleportation.ts\":\n/*!****************************************************!*\\\n !*** ./Cameras/XR/webXRControllerTeleportation.ts ***!\n \\****************************************************/\n/*! exports provided: WebXRControllerTeleportation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return WebXRControllerTeleportation; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _Animations_easing__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Animations/easing */ \"./Animations/easing.ts\");\n/* harmony import */ var _Animations_animation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Animations/animation */ \"./Animations/animation.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Enables teleportation\r\n */\r\nvar WebXRControllerTeleportation = /** @class */ (function () {\r\n /**\r\n * Creates a WebXRControllerTeleportation\r\n * @param input input manager to add teleportation to\r\n * @param floorMeshes floormeshes which can be teleported to\r\n */\r\n function WebXRControllerTeleportation(input, floorMeshes) {\r\n var _this = this;\r\n if (floorMeshes === void 0) { floorMeshes = []; }\r\n this._teleportationFillColor = \"#444444\";\r\n this._teleportationBorderColor = \"#FFFFFF\";\r\n this._tmpRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]());\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n input.onControllerAddedObservable.add(function (c) {\r\n var scene = c.pointer.getScene();\r\n var forwardReadyToTeleport = false;\r\n var backwardReadyToTeleport = false;\r\n var leftReadyToTeleport = false;\r\n var rightReadyToTeleport = false;\r\n // Teleport target abd it's animation\r\n var teleportationTarget = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateGround(\"teleportationTarget\", 2, 2, 2, scene);\r\n teleportationTarget.isPickable = false;\r\n var length = 512;\r\n var dynamicTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_4__[\"DynamicTexture\"](\"DynamicTexture\", length, scene, true);\r\n dynamicTexture.hasAlpha = true;\r\n var context = dynamicTexture.getContext();\r\n var centerX = length / 2;\r\n var centerY = length / 2;\r\n var radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = _this._teleportationFillColor;\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = _this._teleportationBorderColor;\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n var teleportationCircleMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_3__[\"StandardMaterial\"](\"TextPlaneMaterial\", scene);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n teleportationTarget.material = teleportationCircleMaterial;\r\n var torus = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorus(\"torusTeleportation\", 0.75, 0.1, 25, scene, false);\r\n torus.isPickable = false;\r\n torus.parent = teleportationTarget;\r\n var animationInnerCircle = new _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"](\"animationInnerCircle\", \"position.y\", 30, _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONTYPE_FLOAT, _Animations_animation__WEBPACK_IMPORTED_MODULE_6__[\"Animation\"].ANIMATIONLOOPMODE_CYCLE);\r\n var keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n var easingFunction = new _Animations_easing__WEBPACK_IMPORTED_MODULE_5__[\"SineEase\"]();\r\n easingFunction.setEasingMode(_Animations_easing__WEBPACK_IMPORTED_MODULE_5__[\"EasingFunction\"].EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n scene.beginAnimation(torus, 0, 60, true);\r\n // Handle user input on every frame\r\n var renderObserver = scene.onBeforeRenderObservable.add(function () {\r\n // Move the teleportationTarget to where the user is targetting to teleport to\r\n if (forwardReadyToTeleport) {\r\n c.getWorldPointerRayToRef(_this._tmpRay);\r\n var pick = scene.pickWithRay(_this._tmpRay, function (o) {\r\n return floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedPoint) {\r\n // To avoid z-fighting\r\n teleportationTarget.position.copyFrom(pick.pickedPoint);\r\n teleportationTarget.position.y += 0.002;\r\n }\r\n teleportationTarget.isVisible = true;\r\n teleportationTarget.getChildren()[0].isVisible = true;\r\n }\r\n else {\r\n teleportationTarget.isVisible = false;\r\n teleportationTarget.getChildren()[0].isVisible = false;\r\n }\r\n if (c.inputSource.gamepad) {\r\n if (c.inputSource.gamepad.axes[1] !== undefined) {\r\n // Forward teleportation\r\n if (c.inputSource.gamepad.axes[1] < -0.7) {\r\n forwardReadyToTeleport = true;\r\n }\r\n else {\r\n if (forwardReadyToTeleport) {\r\n // Teleport the users feet to where they targetted\r\n _this._tmpVector.copyFrom(teleportationTarget.position);\r\n _this._tmpVector.y += input.baseExperience.camera.position.y;\r\n input.baseExperience.setPositionOfCameraUsingContainer(_this._tmpVector);\r\n }\r\n forwardReadyToTeleport = false;\r\n }\r\n // Backward teleportation\r\n if (c.inputSource.gamepad.axes[1] > 0.7) {\r\n backwardReadyToTeleport = true;\r\n }\r\n else {\r\n if (backwardReadyToTeleport) {\r\n // Cast a ray down from behind the user\r\n var camMat = input.baseExperience.camera.computeWorldMatrix();\r\n var q = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]();\r\n camMat.decompose(undefined, q, _this._tmpRay.origin);\r\n _this._tmpVector.set(0, 0, -1);\r\n _this._tmpVector.rotateByQuaternionToRef(q, _this._tmpVector);\r\n _this._tmpVector.y = 0;\r\n _this._tmpVector.normalize();\r\n _this._tmpVector.y = -1.5;\r\n _this._tmpVector.normalize();\r\n _this._tmpRay.direction.copyFrom(_this._tmpVector);\r\n var pick = scene.pickWithRay(_this._tmpRay, function (o) {\r\n return floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedPoint) {\r\n // Teleport the users feet to where they targetted\r\n _this._tmpVector.copyFrom(pick.pickedPoint);\r\n _this._tmpVector.y += input.baseExperience.camera.position.y;\r\n input.baseExperience.setPositionOfCameraUsingContainer(_this._tmpVector);\r\n }\r\n }\r\n backwardReadyToTeleport = false;\r\n }\r\n }\r\n if (c.inputSource.gamepad.axes[0] !== undefined) {\r\n if (c.inputSource.gamepad.axes[0] < -0.7) {\r\n leftReadyToTeleport = true;\r\n }\r\n else {\r\n if (leftReadyToTeleport) {\r\n input.baseExperience.rotateCameraByQuaternionUsingContainer(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, -Math.PI / 4, 0));\r\n }\r\n leftReadyToTeleport = false;\r\n }\r\n if (c.inputSource.gamepad.axes[0] > 0.7) {\r\n rightReadyToTeleport = true;\r\n }\r\n else {\r\n if (rightReadyToTeleport) {\r\n input.baseExperience.rotateCameraByQuaternionUsingContainer(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].FromEulerAngles(0, Math.PI / 4, 0));\r\n }\r\n rightReadyToTeleport = false;\r\n }\r\n }\r\n }\r\n });\r\n c.onDisposeObservable.addOnce(function () {\r\n teleportationTarget.dispose();\r\n dynamicTexture.dispose();\r\n teleportationCircleMaterial.dispose();\r\n torus.dispose();\r\n scene.onBeforeRenderObservable.remove(renderObserver);\r\n });\r\n });\r\n }\r\n return WebXRControllerTeleportation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRDefaultExperience.ts\":\n/*!**********************************************!*\\\n !*** ./Cameras/XR/webXRDefaultExperience.ts ***!\n \\**********************************************/\n/*! exports provided: WebXRDefaultExperienceOptions, WebXRDefaultExperience */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRDefaultExperienceOptions\", function() { return WebXRDefaultExperienceOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRDefaultExperience\", function() { return WebXRDefaultExperience; });\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n/* harmony import */ var _webXRInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webXRInput */ \"./Cameras/XR/webXRInput.ts\");\n/* harmony import */ var _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRControllerModelLoader */ \"./Cameras/XR/webXRControllerModelLoader.ts\");\n/* harmony import */ var _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webXRControllerPointerSelection */ \"./Cameras/XR/webXRControllerPointerSelection.ts\");\n/* harmony import */ var _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webXRControllerTeleportation */ \"./Cameras/XR/webXRControllerTeleportation.ts\");\n/* harmony import */ var _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webXRManagedOutputCanvas */ \"./Cameras/XR/webXRManagedOutputCanvas.ts\");\n/* harmony import */ var _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webXREnterExitUI */ \"./Cameras/XR/webXREnterExitUI.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Options for the default xr helper\r\n */\r\nvar WebXRDefaultExperienceOptions = /** @class */ (function () {\r\n function WebXRDefaultExperienceOptions() {\r\n }\r\n return WebXRDefaultExperienceOptions;\r\n}());\r\n\r\n/**\r\n * Default experience which provides a similar setup to the previous webVRExperience\r\n */\r\nvar WebXRDefaultExperience = /** @class */ (function () {\r\n function WebXRDefaultExperience() {\r\n }\r\n /**\r\n * Creates the default xr experience\r\n * @param scene scene\r\n * @param options options for basic configuration\r\n * @returns resulting WebXRDefaultExperience\r\n */\r\n WebXRDefaultExperience.CreateAsync = function (scene, options) {\r\n var result = new WebXRDefaultExperience();\r\n // Create base experience\r\n return _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__[\"WebXRExperienceHelper\"].CreateAsync(scene).then(function (xrHelper) {\r\n result.baseExperience = xrHelper;\r\n // Add controller support\r\n result.input = new _webXRInput__WEBPACK_IMPORTED_MODULE_1__[\"WebXRInput\"](xrHelper);\r\n result.controllerModelLoader = new _webXRControllerModelLoader__WEBPACK_IMPORTED_MODULE_2__[\"WebXRControllerModelLoader\"](result.input);\r\n result.pointerSelection = new _webXRControllerPointerSelection__WEBPACK_IMPORTED_MODULE_3__[\"WebXRControllerPointerSelection\"](result.input);\r\n result.teleportation = new _webXRControllerTeleportation__WEBPACK_IMPORTED_MODULE_4__[\"WebXRControllerTeleportation\"](result.input, options.floorMeshes);\r\n // Create output canvas manager (this controls where the xr frames will be rendered)\r\n result.outputCanvas = new _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_5__[\"WebXRManagedOutputCanvas\"](xrHelper, scene.getEngine().getRenderingCanvas());\r\n // Create ui for entering/exiting xr\r\n return _webXREnterExitUI__WEBPACK_IMPORTED_MODULE_6__[\"WebXREnterExitUI\"].CreateAsync(scene, result.baseExperience, { webXRManagedOutputCanvas: result.outputCanvas });\r\n }).then(function (ui) {\r\n result.enterExitUI = ui;\r\n return result;\r\n });\r\n };\r\n /**\r\n * DIsposes of the experience helper\r\n */\r\n WebXRDefaultExperience.prototype.dispose = function () {\r\n if (this.baseExperience) {\r\n this.baseExperience.dispose();\r\n }\r\n if (this.input) {\r\n this.input.dispose();\r\n }\r\n if (this.enterExitUI) {\r\n this.enterExitUI.dispose();\r\n }\r\n if (this.outputCanvas) {\r\n this.outputCanvas.dispose();\r\n }\r\n };\r\n return WebXRDefaultExperience;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXREnterExitUI.ts\":\n/*!****************************************!*\\\n !*** ./Cameras/XR/webXREnterExitUI.ts ***!\n \\****************************************/\n/*! exports provided: WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return WebXREnterExitUIButton; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return WebXREnterExitUIOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return WebXREnterExitUI; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n\r\n\r\n\r\n/**\r\n * Button which can be used to enter a different mode of XR\r\n */\r\nvar WebXREnterExitUIButton = /** @class */ (function () {\r\n /**\r\n * Creates a WebXREnterExitUIButton\r\n * @param element button element\r\n * @param sessionMode XR initialization session mode\r\n * @param referenceSpaceType the type of reference space to be used\r\n */\r\n function WebXREnterExitUIButton(\r\n /** button element */\r\n element, \r\n /** XR initialization options for the button */\r\n sessionMode, \r\n /** Reference space type */\r\n referenceSpaceType) {\r\n this.element = element;\r\n this.sessionMode = sessionMode;\r\n this.referenceSpaceType = referenceSpaceType;\r\n }\r\n /**\r\n * Overwritable function which can be used to update the button's visuals when the state changes\r\n * @param activeButton the current active button in the UI\r\n */\r\n WebXREnterExitUIButton.prototype.update = function (activeButton) {\r\n };\r\n return WebXREnterExitUIButton;\r\n}());\r\n\r\n/**\r\n * Options to create the webXR UI\r\n */\r\nvar WebXREnterExitUIOptions = /** @class */ (function () {\r\n function WebXREnterExitUIOptions() {\r\n }\r\n return WebXREnterExitUIOptions;\r\n}());\r\n\r\n/**\r\n * UI to allow the user to enter/exit XR mode\r\n */\r\nvar WebXREnterExitUI = /** @class */ (function () {\r\n function WebXREnterExitUI(scene, options) {\r\n var _this = this;\r\n this.scene = scene;\r\n this._buttons = [];\r\n this._activeButton = null;\r\n /**\r\n * Fired every time the active button is changed.\r\n *\r\n * When xr is entered via a button that launches xr that button will be the callback parameter\r\n *\r\n * When exiting xr the callback parameter will be null)\r\n */\r\n this.activeButtonChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._overlay = document.createElement(\"div\");\r\n this._overlay.style.cssText = \"z-index:11;position: absolute; right: 20px;bottom: 50px;\";\r\n if (options.customButtons) {\r\n this._buttons = options.customButtons;\r\n }\r\n else {\r\n var hmdBtn = document.createElement(\"button\");\r\n hmdBtn.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;\";\r\n hmdBtn.innerText = \"HMD\";\r\n this._buttons.push(new WebXREnterExitUIButton(hmdBtn, \"immersive-vr\", \"local-floor\"));\r\n this._buttons[this._buttons.length - 1].update = function (activeButton) {\r\n this.element.style.display = (activeButton === null || activeButton === this) ? \"\" : \"none\";\r\n this.element.innerText = activeButton === this ? \"EXIT\" : \"HMD\";\r\n };\r\n this._updateButtons(null);\r\n }\r\n var renderCanvas = scene.getEngine().getRenderingCanvas();\r\n if (renderCanvas && renderCanvas.parentNode) {\r\n renderCanvas.parentNode.appendChild(this._overlay);\r\n scene.onDisposeObservable.addOnce(function () {\r\n _this.dispose();\r\n });\r\n }\r\n }\r\n /**\r\n * Creates UI to allow the user to enter/exit XR mode\r\n * @param scene the scene to add the ui to\r\n * @param helper the xr experience helper to enter/exit xr with\r\n * @param options options to configure the UI\r\n * @returns the created ui\r\n */\r\n WebXREnterExitUI.CreateAsync = function (scene, helper, options) {\r\n var _this = this;\r\n var ui = new WebXREnterExitUI(scene, options);\r\n var supportedPromises = ui._buttons.map(function (btn) {\r\n return helper.sessionManager.supportsSessionAsync(btn.sessionMode);\r\n });\r\n helper.onStateChangedObservable.add(function (state) {\r\n if (state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"].NOT_IN_XR) {\r\n ui._updateButtons(null);\r\n }\r\n });\r\n return Promise.all(supportedPromises).then(function (results) {\r\n results.forEach(function (supported, i) {\r\n if (supported) {\r\n ui._overlay.appendChild(ui._buttons[i].element);\r\n ui._buttons[i].element.onclick = function () { return tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"](_this, void 0, void 0, function () {\r\n return tslib__WEBPACK_IMPORTED_MODULE_0__[\"__generator\"](this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!(helper.state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"].IN_XR)) return [3 /*break*/, 2];\r\n ui._updateButtons(null);\r\n return [4 /*yield*/, helper.exitXRAsync()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n case 2:\r\n if (!(helper.state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_2__[\"WebXRState\"].NOT_IN_XR)) return [3 /*break*/, 4];\r\n ui._updateButtons(ui._buttons[i]);\r\n if (!options.webXRManagedOutputCanvas) return [3 /*break*/, 4];\r\n return [4 /*yield*/, helper.enterXRAsync(ui._buttons[i].sessionMode, ui._buttons[i].referenceSpaceType, options.webXRManagedOutputCanvas)];\r\n case 3:\r\n _a.sent();\r\n _a.label = 4;\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n }); };\r\n }\r\n });\r\n return ui;\r\n });\r\n };\r\n WebXREnterExitUI.prototype._updateButtons = function (activeButton) {\r\n var _this = this;\r\n this._activeButton = activeButton;\r\n this._buttons.forEach(function (b) {\r\n b.update(_this._activeButton);\r\n });\r\n this.activeButtonChangedObservable.notifyObservers(this._activeButton);\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXREnterExitUI.prototype.dispose = function () {\r\n var renderCanvas = this.scene.getEngine().getRenderingCanvas();\r\n if (renderCanvas && renderCanvas.parentNode && renderCanvas.parentNode.contains(this._overlay)) {\r\n renderCanvas.parentNode.removeChild(this._overlay);\r\n }\r\n this.activeButtonChangedObservable.clear();\r\n };\r\n return WebXREnterExitUI;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRExperienceHelper.ts\":\n/*!*********************************************!*\\\n !*** ./Cameras/XR/webXRExperienceHelper.ts ***!\n \\*********************************************/\n/*! exports provided: WebXRState, WebXRExperienceHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return WebXRState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return WebXRExperienceHelper; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _webXRSessionManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webXRSessionManager */ \"./Cameras/XR/webXRSessionManager.ts\");\n/* harmony import */ var _webXRCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webXRCamera */ \"./Cameras/XR/webXRCamera.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * States of the webXR experience\r\n */\r\nvar WebXRState;\r\n(function (WebXRState) {\r\n /**\r\n * Transitioning to being in XR mode\r\n */\r\n WebXRState[WebXRState[\"ENTERING_XR\"] = 0] = \"ENTERING_XR\";\r\n /**\r\n * Transitioning to non XR mode\r\n */\r\n WebXRState[WebXRState[\"EXITING_XR\"] = 1] = \"EXITING_XR\";\r\n /**\r\n * In XR mode and presenting\r\n */\r\n WebXRState[WebXRState[\"IN_XR\"] = 2] = \"IN_XR\";\r\n /**\r\n * Not entered XR mode\r\n */\r\n WebXRState[WebXRState[\"NOT_IN_XR\"] = 3] = \"NOT_IN_XR\";\r\n})(WebXRState || (WebXRState = {}));\r\n/**\r\n * Base set of functionality needed to create an XR experince (WebXRSessionManager, Camera, StateManagement, etc.)\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n */\r\nvar WebXRExperienceHelper = /** @class */ (function () {\r\n /**\r\n * Creates a WebXRExperienceHelper\r\n * @param scene The scene the helper should be created in\r\n */\r\n function WebXRExperienceHelper(scene) {\r\n var _this = this;\r\n this.scene = scene;\r\n /**\r\n * The current state of the XR experience (eg. transitioning, in XR or not in XR)\r\n */\r\n this.state = WebXRState.NOT_IN_XR;\r\n /**\r\n * Fires when the state of the experience helper has changed\r\n */\r\n this.onStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._nonVRCamera = null;\r\n this._originalSceneAutoClear = true;\r\n this._supported = false;\r\n this.camera = new _webXRCamera__WEBPACK_IMPORTED_MODULE_4__[\"WebXRCamera\"](\"\", scene);\r\n this.sessionManager = new _webXRSessionManager__WEBPACK_IMPORTED_MODULE_3__[\"WebXRSessionManager\"](scene);\r\n this.container = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"](\"WebXR Container\", scene);\r\n this.camera.parent = this.container;\r\n scene.onDisposeObservable.add(function () {\r\n _this.exitXRAsync();\r\n });\r\n }\r\n WebXRExperienceHelper.prototype._setState = function (val) {\r\n this.state = val;\r\n this.onStateChangedObservable.notifyObservers(this.state);\r\n };\r\n /**\r\n * Creates the experience helper\r\n * @param scene the scene to attach the experience helper to\r\n * @returns a promise for the experience helper\r\n */\r\n WebXRExperienceHelper.CreateAsync = function (scene) {\r\n var helper = new WebXRExperienceHelper(scene);\r\n return helper.sessionManager.initializeAsync().then(function () {\r\n helper._supported = true;\r\n return helper;\r\n }).catch(function () {\r\n return helper;\r\n });\r\n };\r\n /**\r\n * Exits XR mode and returns the scene to its original state\r\n * @returns promise that resolves after xr mode has exited\r\n */\r\n WebXRExperienceHelper.prototype.exitXRAsync = function () {\r\n this._setState(WebXRState.EXITING_XR);\r\n return this.sessionManager.exitXRAsync();\r\n };\r\n /**\r\n * Enters XR mode (This must be done within a user interaction in most browsers eg. button click)\r\n * @param sessionCreationOptions options for the XR session\r\n * @param referenceSpaceType frame of reference of the XR session\r\n * @param outputCanvas the output canvas that will be used to enter XR mode\r\n * @returns promise that resolves after xr mode has entered\r\n */\r\n WebXRExperienceHelper.prototype.enterXRAsync = function (sessionCreationOptions, referenceSpaceType, outputCanvas) {\r\n var _this = this;\r\n if (!this._supported) {\r\n throw \"XR session not supported by this browser\";\r\n }\r\n this._setState(WebXRState.ENTERING_XR);\r\n return this.sessionManager.initializeSessionAsync(sessionCreationOptions).then(function () {\r\n return _this.sessionManager.setReferenceSpaceAsync(referenceSpaceType);\r\n }).then(function () {\r\n return outputCanvas.initializeXRLayerAsync(_this.sessionManager.session);\r\n }).then(function () {\r\n return _this.sessionManager.updateRenderStateAsync({ depthFar: _this.camera.maxZ, depthNear: _this.camera.minZ, baseLayer: outputCanvas.xrLayer });\r\n }).then(function () {\r\n return _this.sessionManager.startRenderingToXRAsync();\r\n }).then(function () {\r\n // Cache pre xr scene settings\r\n _this._originalSceneAutoClear = _this.scene.autoClear;\r\n _this._nonVRCamera = _this.scene.activeCamera;\r\n // Overwrite current scene settings\r\n _this.scene.autoClear = false;\r\n _this.scene.activeCamera = _this.camera;\r\n _this.sessionManager.onXRFrameObservable.add(function () {\r\n _this.camera.updateFromXRSessionManager(_this.sessionManager);\r\n });\r\n _this.sessionManager.onXRSessionEnded.addOnce(function () {\r\n // Reset camera rigs output render target to ensure sessions render target is not drawn after it ends\r\n _this.camera.rigCameras.forEach(function (c) {\r\n c.outputRenderTarget = null;\r\n });\r\n // Restore scene settings\r\n _this.scene.autoClear = _this._originalSceneAutoClear;\r\n _this.scene.activeCamera = _this._nonVRCamera;\r\n _this._setState(WebXRState.NOT_IN_XR);\r\n });\r\n // Wait until the first frame arrives before setting state to in xr\r\n _this.sessionManager.onXRFrameObservable.addOnce(function () {\r\n _this._setState(WebXRState.IN_XR);\r\n });\r\n }).catch(function (e) {\r\n console.log(e);\r\n console.log(e.message);\r\n });\r\n };\r\n /**\r\n * Updates the global position of the camera by moving the camera's container\r\n * This should be used instead of modifying the camera's position as it will be overwritten by an xrSessions's update frame\r\n * @param position The desired global position of the camera\r\n */\r\n WebXRExperienceHelper.prototype.setPositionOfCameraUsingContainer = function (position) {\r\n this.camera.globalPosition.subtractToRef(position, WebXRExperienceHelper._TmpVector);\r\n this.container.position.subtractInPlace(WebXRExperienceHelper._TmpVector);\r\n };\r\n /**\r\n * Rotates the xr camera by rotating the camera's container around the camera's position\r\n * This should be used instead of modifying the camera's rotation as it will be overwritten by an xrSessions's update frame\r\n * @param rotation the desired quaternion rotation to apply to the camera\r\n */\r\n WebXRExperienceHelper.prototype.rotateCameraByQuaternionUsingContainer = function (rotation) {\r\n if (!this.container.rotationQuaternion) {\r\n this.container.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromEulerVector(this.container.rotation);\r\n }\r\n this.container.rotationQuaternion.multiplyInPlace(rotation);\r\n this.container.position.rotateByQuaternionAroundPointToRef(rotation, this.camera.globalPosition, this.container.position);\r\n };\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n WebXRExperienceHelper.prototype.dispose = function () {\r\n this.camera.dispose();\r\n this.container.dispose();\r\n this.onStateChangedObservable.clear();\r\n this.sessionManager.dispose();\r\n };\r\n WebXRExperienceHelper._TmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]();\r\n return WebXRExperienceHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRInput.ts\":\n/*!**********************************!*\\\n !*** ./Cameras/XR/webXRInput.ts ***!\n \\**********************************/\n/*! exports provided: WebXRInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return WebXRInput; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n/* harmony import */ var _webXRController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webXRController */ \"./Cameras/XR/webXRController.ts\");\n\r\n\r\n\r\n/**\r\n * XR input used to track XR inputs such as controllers/rays\r\n */\r\nvar WebXRInput = /** @class */ (function () {\r\n /**\r\n * Initializes the WebXRInput\r\n * @param baseExperience experience helper which the input should be created for\r\n */\r\n function WebXRInput(\r\n /**\r\n * Base experience the input listens to\r\n */\r\n baseExperience) {\r\n var _this = this;\r\n this.baseExperience = baseExperience;\r\n /**\r\n * XR controllers being tracked\r\n */\r\n this.controllers = [];\r\n /**\r\n * Event when a controller has been connected/added\r\n */\r\n this.onControllerAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Event when a controller has been removed/disconnected\r\n */\r\n this.onControllerRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._onInputSourcesChange = function (event) {\r\n _this._addAndRemoveControllers(event.added, event.removed);\r\n };\r\n // Remove controllers when exiting XR\r\n this._stateObserver = baseExperience.onStateChangedObservable.add(function (s) {\r\n if (s === _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_1__[\"WebXRState\"].NOT_IN_XR) {\r\n _this._addAndRemoveControllers([], _this.controllers.map(function (c) { return c.inputSource; }));\r\n }\r\n });\r\n this._frameObserver = baseExperience.sessionManager.onXRFrameObservable.add(function () {\r\n if (!baseExperience.sessionManager.currentFrame) {\r\n return;\r\n }\r\n // Start listing to input add/remove event\r\n if (_this.controllers.length == 0 && baseExperience.sessionManager.session.inputSources) {\r\n _this._addAndRemoveControllers(baseExperience.sessionManager.session.inputSources, []);\r\n baseExperience.sessionManager.session.addEventListener(\"inputsourceschange\", _this._onInputSourcesChange);\r\n }\r\n // Update controller pose info\r\n _this.controllers.forEach(function (controller) {\r\n controller.updateFromXRFrame(baseExperience.sessionManager.currentFrame, baseExperience.sessionManager.referenceSpace);\r\n });\r\n });\r\n }\r\n WebXRInput.prototype._addAndRemoveControllers = function (addInputs, removeInputs) {\r\n var _this = this;\r\n // Add controllers if they don't already exist\r\n var sources = this.controllers.map(function (c) { return c.inputSource; });\r\n for (var _i = 0, addInputs_1 = addInputs; _i < addInputs_1.length; _i++) {\r\n var input = addInputs_1[_i];\r\n if (sources.indexOf(input) === -1) {\r\n var controller = new _webXRController__WEBPACK_IMPORTED_MODULE_2__[\"WebXRController\"](this.baseExperience.camera._scene, input, this.baseExperience.container);\r\n this.controllers.push(controller);\r\n this.onControllerAddedObservable.notifyObservers(controller);\r\n }\r\n }\r\n // Remove and dispose of controllers to be disposed\r\n var keepControllers = [];\r\n var removedControllers = [];\r\n this.controllers.forEach(function (c) {\r\n if (removeInputs.indexOf(c.inputSource) === -1) {\r\n keepControllers.push(c);\r\n }\r\n else {\r\n removedControllers.push(c);\r\n }\r\n });\r\n this.controllers = keepControllers;\r\n removedControllers.forEach(function (c) {\r\n _this.onControllerRemovedObservable.notifyObservers(c);\r\n c.dispose();\r\n });\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXRInput.prototype.dispose = function () {\r\n this.controllers.forEach(function (c) {\r\n c.dispose();\r\n });\r\n this.baseExperience.sessionManager.onXRFrameObservable.remove(this._frameObserver);\r\n this.baseExperience.onStateChangedObservable.remove(this._stateObserver);\r\n };\r\n return WebXRInput;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRManagedOutputCanvas.ts\":\n/*!************************************************!*\\\n !*** ./Cameras/XR/webXRManagedOutputCanvas.ts ***!\n \\************************************************/\n/*! exports provided: WebXRManagedOutputCanvas */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return WebXRManagedOutputCanvas; });\n/* harmony import */ var _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webXRExperienceHelper */ \"./Cameras/XR/webXRExperienceHelper.ts\");\n\r\n/**\r\n * Creates a canvas that is added/removed from the webpage when entering/exiting XR\r\n */\r\nvar WebXRManagedOutputCanvas = /** @class */ (function () {\r\n /**\r\n * Initializes the canvas to be added/removed upon entering/exiting xr\r\n * @param helper the xr experience helper used to trigger adding/removing of the canvas\r\n * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)\r\n */\r\n function WebXRManagedOutputCanvas(helper, canvas) {\r\n var _this = this;\r\n this.helper = helper;\r\n this._canvas = null;\r\n /**\r\n * xr layer for the canvas\r\n */\r\n this.xrLayer = null;\r\n if (!canvas) {\r\n canvas = document.createElement('canvas');\r\n canvas.style.cssText = \"position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;\";\r\n }\r\n this._setManagedOutputCanvas(canvas);\r\n helper.onStateChangedObservable.add(function (stateInfo) {\r\n if (stateInfo == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__[\"WebXRState\"].ENTERING_XR) {\r\n // The canvas is added to the screen before entering XR because currently the xr session must be initialized while the canvas is added render properly\r\n _this._addCanvas();\r\n }\r\n else if (helper.state == _webXRExperienceHelper__WEBPACK_IMPORTED_MODULE_0__[\"WebXRState\"].NOT_IN_XR) {\r\n _this._removeCanvas();\r\n }\r\n });\r\n }\r\n /**\r\n * Initializes the xr layer for the session\r\n * @param xrSession xr session\r\n * @returns a promise that will resolve once the XR Layer has been created\r\n */\r\n WebXRManagedOutputCanvas.prototype.initializeXRLayerAsync = function (xrSession) {\r\n var _this = this;\r\n return this.canvasContext.makeXRCompatible().then(function () {\r\n _this.xrLayer = new XRWebGLLayer(xrSession, _this.canvasContext);\r\n });\r\n };\r\n /**\r\n * Disposes of the object\r\n */\r\n WebXRManagedOutputCanvas.prototype.dispose = function () {\r\n this._removeCanvas();\r\n this._setManagedOutputCanvas(null);\r\n };\r\n WebXRManagedOutputCanvas.prototype._setManagedOutputCanvas = function (canvas) {\r\n this._removeCanvas();\r\n if (!canvas) {\r\n this._canvas = null;\r\n this.canvasContext = null;\r\n }\r\n else {\r\n this._canvas = canvas;\r\n this.canvasContext = this._canvas.getContext('webgl');\r\n if (!this.canvasContext) {\r\n this.canvasContext = this._canvas.getContext('webgl2');\r\n }\r\n }\r\n };\r\n WebXRManagedOutputCanvas.prototype._addCanvas = function () {\r\n if (this._canvas && this._canvas !== this.helper.container.getScene().getEngine().getRenderingCanvas()) {\r\n document.body.appendChild(this._canvas);\r\n }\r\n };\r\n WebXRManagedOutputCanvas.prototype._removeCanvas = function () {\r\n if (this._canvas && document.body.contains(this._canvas) && this._canvas !== this.helper.container.getScene().getEngine().getRenderingCanvas()) {\r\n document.body.removeChild(this._canvas);\r\n }\r\n };\r\n return WebXRManagedOutputCanvas;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/XR/webXRSessionManager.ts\":\n/*!*******************************************!*\\\n !*** ./Cameras/XR/webXRSessionManager.ts ***!\n \\*******************************************/\n/*! exports provided: WebXRSessionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return WebXRSessionManager; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Manages an XRSession to work with Babylon's engine\r\n * @see https://doc.babylonjs.com/how_to/webxr\r\n */\r\nvar WebXRSessionManager = /** @class */ (function () {\r\n /**\r\n * Constructs a WebXRSessionManager, this must be initialized within a user action before usage\r\n * @param scene The scene which the session should be created for\r\n */\r\n function WebXRSessionManager(scene) {\r\n this.scene = scene;\r\n /**\r\n * Fires every time a new xrFrame arrives which can be used to update the camera\r\n */\r\n this.onXRFrameObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fires when the xr session is ended either by the device or manually done\r\n */\r\n this.onXRSessionEnded = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** @hidden */\r\n this._sessionRenderTargetTexture = null;\r\n this.baseLayer = null;\r\n }\r\n /**\r\n * Initializes the manager\r\n * After initialization enterXR can be called to start an XR session\r\n * @returns Promise which resolves after it is initialized\r\n */\r\n WebXRSessionManager.prototype.initializeAsync = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"The WebXR APIs are still under development and are subject to change in the future.\");\r\n // Check if the browser supports webXR\r\n this._xrNavigator = navigator;\r\n if (!this._xrNavigator.xr) {\r\n return Promise.reject(\"webXR not supported by this browser\");\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Initializes an xr session\r\n * @param xrSessionMode mode to initialize\r\n * @returns a promise which will resolve once the session has been initialized\r\n */\r\n WebXRSessionManager.prototype.initializeSessionAsync = function (xrSessionMode) {\r\n var _this = this;\r\n return this._xrNavigator.xr.requestSession(xrSessionMode).then(function (session) {\r\n _this.session = session;\r\n // handle when the session is ended (By calling session.end or device ends its own session eg. pressing home button on phone)\r\n _this.session.addEventListener(\"end\", function () {\r\n // Remove render target texture and notify frame obervers\r\n _this._sessionRenderTargetTexture = null;\r\n // Restore frame buffer to avoid clear on xr framebuffer after session end\r\n _this.scene.getEngine().restoreDefaultFramebuffer();\r\n // Need to restart render loop as after the session is ended the last request for new frame will never call callback\r\n _this.scene.getEngine().customAnimationFrameRequester = null;\r\n _this.onXRSessionEnded.notifyObservers(null);\r\n _this.scene.getEngine()._renderLoop();\r\n }, { once: true });\r\n });\r\n };\r\n /**\r\n * Sets the reference space on the xr session\r\n * @param referenceSpace space to set\r\n * @returns a promise that will resolve once the reference space has been set\r\n */\r\n WebXRSessionManager.prototype.setReferenceSpaceAsync = function (referenceSpace) {\r\n var _this = this;\r\n return this.session.requestReferenceSpace(referenceSpace).then(function (referenceSpace) {\r\n _this.referenceSpace = referenceSpace;\r\n });\r\n };\r\n /**\r\n * Updates the render state of the session\r\n * @param state state to set\r\n * @returns a promise that resolves once the render state has been updated\r\n */\r\n WebXRSessionManager.prototype.updateRenderStateAsync = function (state) {\r\n if (state.baseLayer) {\r\n this.baseLayer = state.baseLayer;\r\n }\r\n return this.session.updateRenderState(state);\r\n };\r\n /**\r\n * Starts rendering to the xr layer\r\n * @returns a promise that will resolve once rendering has started\r\n */\r\n WebXRSessionManager.prototype.startRenderingToXRAsync = function () {\r\n var _this = this;\r\n // Tell the engine's render loop to be driven by the xr session's refresh rate and provide xr pose information\r\n this.scene.getEngine().customAnimationFrameRequester = {\r\n requestAnimationFrame: this.session.requestAnimationFrame.bind(this.session),\r\n renderFunction: function (timestamp, xrFrame) {\r\n // Store the XR frame in the manager to be consumed by the XR camera to update pose\r\n _this.currentFrame = xrFrame;\r\n _this.onXRFrameObservable.notifyObservers(null);\r\n _this.scene.getEngine()._renderLoop();\r\n }\r\n };\r\n // Create render target texture from xr's webgl render target\r\n this._sessionRenderTargetTexture = WebXRSessionManager._CreateRenderTargetTextureFromSession(this.session, this.scene, this.baseLayer);\r\n // Stop window's animation frame and trigger sessions animation frame\r\n window.cancelAnimationFrame(this.scene.getEngine()._frameHandler);\r\n this.scene.getEngine()._renderLoop();\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Stops the xrSession and restores the renderloop\r\n * @returns Promise which resolves after it exits XR\r\n */\r\n WebXRSessionManager.prototype.exitXRAsync = function () {\r\n if (this.session) {\r\n this.session.end();\r\n }\r\n return new Promise(function () { });\r\n };\r\n /**\r\n * Checks if a session would be supported for the creation options specified\r\n * @param sessionMode session mode to check if supported eg. immersive-vr\r\n * @returns true if supported\r\n */\r\n WebXRSessionManager.prototype.supportsSessionAsync = function (sessionMode) {\r\n if (!navigator.xr || !navigator.xr.supportsSession) {\r\n return Promise.resolve(false);\r\n }\r\n else {\r\n return navigator.xr.supportsSession(sessionMode).then(function () {\r\n return Promise.resolve(true);\r\n }).catch(function (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(e);\r\n return Promise.resolve(false);\r\n });\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Converts the render layer of xrSession to a render target\r\n * @param session session to create render target for\r\n * @param scene scene the new render target should be created for\r\n */\r\n WebXRSessionManager._CreateRenderTargetTextureFromSession = function (session, scene, baseLayer) {\r\n if (!baseLayer) {\r\n throw \"no layer\";\r\n }\r\n // Create internal texture\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](scene.getEngine(), _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_UNKNOWN, true);\r\n internalTexture.width = baseLayer.framebufferWidth;\r\n internalTexture.height = baseLayer.framebufferHeight;\r\n internalTexture._framebuffer = baseLayer.framebuffer;\r\n // Create render target texture from the internal texture\r\n var renderTargetTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetTexture\"](\"XR renderTargetTexture\", { width: internalTexture.width, height: internalTexture.height }, scene, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);\r\n renderTargetTexture._texture = internalTexture;\r\n return renderTargetTexture;\r\n };\r\n /**\r\n * Disposes of the session manager\r\n */\r\n WebXRSessionManager.prototype.dispose = function () {\r\n this.onXRFrameObservable.clear();\r\n this.onXRSessionEnded.clear();\r\n };\r\n return WebXRSessionManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/arcRotateCamera.ts\":\n/*!************************************!*\\\n !*** ./Cameras/arcRotateCamera.ts ***!\n \\************************************/\n/*! exports provided: ArcRotateCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return ArcRotateCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Behaviors_Cameras_autoRotationBehavior__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Behaviors/Cameras/autoRotationBehavior */ \"./Behaviors/Cameras/autoRotationBehavior.ts\");\n/* harmony import */ var _Behaviors_Cameras_bouncingBehavior__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Behaviors/Cameras/bouncingBehavior */ \"./Behaviors/Cameras/bouncingBehavior.ts\");\n/* harmony import */ var _Behaviors_Cameras_framingBehavior__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Behaviors/Cameras/framingBehavior */ \"./Behaviors/Cameras/framingBehavior.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Cameras/arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"ArcRotateCamera\", function (name, scene) {\r\n return function () { return new ArcRotateCamera(name, 0, 0, 1.0, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents an orbital type of camera.\r\n *\r\n * This camera always points towards a given target position and can be rotated around that target with the target as the centre of rotation. It can be controlled with cursors and mouse, or with touch events.\r\n * Think of this camera as one orbiting its target position, or more imaginatively as a spy satellite orbiting the earth. Its position relative to the target (earth) can be set by three parameters, alpha (radians) the longitudinal rotation, beta (radians) the latitudinal rotation and radius the distance from the target position.\r\n * @see http://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera\r\n */\r\nvar ArcRotateCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcRotateCamera, _super);\r\n /**\r\n * Instantiates a new ArcRotateCamera in a given scene\r\n * @param name Defines the name of the camera\r\n * @param alpha Defines the camera rotation along the logitudinal axis\r\n * @param beta Defines the camera rotation along the latitudinal axis\r\n * @param radius Defines the camera distance from its target\r\n * @param target Defines the camera target\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function ArcRotateCamera(name, alpha, beta, radius, target, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene, setActiveOnSceneIfNoneActive) || this;\r\n _this._upVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up();\r\n /**\r\n * Current inertia value on the longitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialAlphaOffset = 0;\r\n /**\r\n * Current inertia value on the latitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialBetaOffset = 0;\r\n /**\r\n * Current inertia value on the radius axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialRadiusOffset = 0;\r\n /**\r\n * Minimum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerAlphaLimit = null;\r\n /**\r\n * Maximum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperAlphaLimit = null;\r\n /**\r\n * Minimum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerBetaLimit = 0.01;\r\n /**\r\n * Maximum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperBetaLimit = Math.PI - 0.01;\r\n /**\r\n * Minimum allowed distance of the camera to the target (The camera can not get closer).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRadiusLimit = null;\r\n /**\r\n * Maximum allowed distance of the camera to the target (The camera can not get further).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRadiusLimit = null;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the X axis.\r\n */\r\n _this.inertialPanningX = 0;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the Y axis.\r\n */\r\n _this.inertialPanningY = 0;\r\n /**\r\n * Defines the distance used to consider the camera in pan mode vs pinch/zoom.\r\n * Basically if your fingers moves away from more than this distance you will be considered\r\n * in pinch mode.\r\n */\r\n _this.pinchToPanMaxDistance = 20;\r\n /**\r\n * Defines the maximum distance the camera can pan.\r\n * This could help keeping the cammera always in your scene.\r\n */\r\n _this.panningDistanceLimit = null;\r\n /**\r\n * Defines the target of the camera before paning.\r\n */\r\n _this.panningOriginTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n /**\r\n * Defines the value of the inertia used during panning.\r\n * 0 would mean stop inertia and one would mean no decelleration at all.\r\n */\r\n _this.panningInertia = 0.9;\r\n //-- end properties for backward compatibility for inputs\r\n /**\r\n * Defines how much the radius should be scaled while zomming on a particular mesh (through the zoomOn function)\r\n */\r\n _this.zoomOnFactor = 1;\r\n /**\r\n * Defines a screen offset for the camera position.\r\n */\r\n _this.targetScreenOffset = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n /**\r\n * Allows the camera to be completely reversed.\r\n * If false the camera can not arrive upside down.\r\n */\r\n _this.allowUpsideDown = true;\r\n /**\r\n * Define if double tap/click is used to restore the previously saved state of the camera.\r\n */\r\n _this.useInputToRestoreState = true;\r\n /** @hidden */\r\n _this._viewMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n /**\r\n * Defines the allowed panning axis.\r\n */\r\n _this.panningAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 1, 0);\r\n /**\r\n * Observable triggered when the mesh target has been changed on the camera.\r\n */\r\n _this.onMeshTargetChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Defines whether the camera should check collision with the objects oh the scene.\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#how-can-i-do-this\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Defines the collision radius of the camera.\r\n * This simulates a sphere around the camera.\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.collisionRadius = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0.5, 0.5, 0.5);\r\n _this._previousPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._collisionVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._computationVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n if (!collidedMesh) {\r\n _this._previousPosition.copyFrom(_this._position);\r\n }\r\n else {\r\n _this.setPosition(newPosition);\r\n if (_this.onCollide) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n // Recompute because of constraints\r\n var cosa = Math.cos(_this.alpha);\r\n var sina = Math.sin(_this.alpha);\r\n var cosb = Math.cos(_this.beta);\r\n var sinb = Math.sin(_this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n var target = _this._getTargetPosition();\r\n _this._computationVector.copyFromFloats(_this.radius * cosa * sinb, _this.radius * cosb, _this.radius * sina * sinb);\r\n target.addToRef(_this._computationVector, _this._newPosition);\r\n _this._position.copyFrom(_this._newPosition);\r\n var up = _this.upVector;\r\n if (_this.allowUpsideDown && _this.beta < 0) {\r\n up = up.clone();\r\n up = up.negate();\r\n }\r\n _this._computeViewMatrix(_this._position, target, up);\r\n _this._viewMatrix.addAtIndex(12, _this.targetScreenOffset.x);\r\n _this._viewMatrix.addAtIndex(13, _this.targetScreenOffset.y);\r\n _this._collisionTriggered = false;\r\n };\r\n _this._target = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n if (target) {\r\n _this.setTarget(target);\r\n }\r\n _this.alpha = alpha;\r\n _this.beta = beta;\r\n _this.radius = radius;\r\n _this.getViewMatrix();\r\n _this.inputs = new _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__[\"ArcRotateCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouseWheel().addPointers();\r\n return _this;\r\n }\r\n Object.defineProperty(ArcRotateCamera.prototype, \"target\", {\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n */\r\n get: function () {\r\n return this._target;\r\n },\r\n set: function (value) {\r\n this.setTarget(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this.setPosition(newPosition);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"upVector\", {\r\n get: function () {\r\n return this._upVector;\r\n },\r\n /**\r\n * The vector the camera should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())\r\n * Setting this will copy the given vector to the camera's upVector, and set rotation matrices to and from Y up.\r\n * DO NOT set the up vector using copyFrom or copyFromFloats, as this bypasses setting the above matrices.\r\n */\r\n set: function (vec) {\r\n if (!this._upToYMatrix) {\r\n this._YToUpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n this._upToYMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n this._upVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n vec.normalize();\r\n this._upVector.copyFrom(vec);\r\n this.setMatUp();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the Y-up to camera up-vector rotation matrix, and the up-vector to Y-up rotation matrix.\r\n */\r\n ArcRotateCamera.prototype.setMatUp = function () {\r\n // from y-up to custom-up (used in _getViewMatrix)\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationAlignToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].UpReadOnly, this._upVector, this._YToUpMatrix);\r\n // from custom-up to y-up (used in rebuildAnglesAndRadius)\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationAlignToRef(this._upVector, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].UpReadOnly, this._upToYMatrix);\r\n };\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityX\", {\r\n //-- begin properties for backward compatibility for inputs\r\n /**\r\n * Gets or Set the pointer angular sensibility along the X axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityX;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityX = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityY\", {\r\n /**\r\n * Gets or Set the pointer angular sensibility along the Y axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityY;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityY = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchPrecision\", {\r\n /**\r\n * Gets or Set the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchPrecision = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchDeltaPercentage\", {\r\n /**\r\n * Gets or Set the pointer pinch delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"panningSensibility\", {\r\n /**\r\n * Gets or Set the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.panningSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.panningSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelPrecision\", {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelPrecision = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelDeltaPercentage\", {\r\n /**\r\n * Gets or Set the mouse wheel delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"bouncingBehavior\", {\r\n /**\r\n * Gets the bouncing behavior of the camera if it has been enabled.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useBouncingBehavior\", {\r\n /**\r\n * Defines if the bouncing behavior of the camera is enabled on the camera.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useBouncingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._bouncingBehavior = new _Behaviors_Cameras_bouncingBehavior__WEBPACK_IMPORTED_MODULE_7__[\"BouncingBehavior\"]();\r\n this.addBehavior(this._bouncingBehavior);\r\n }\r\n else if (this._bouncingBehavior) {\r\n this.removeBehavior(this._bouncingBehavior);\r\n this._bouncingBehavior = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"framingBehavior\", {\r\n /**\r\n * Gets the framing behavior of the camera if it has been enabled.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useFramingBehavior\", {\r\n /**\r\n * Defines if the framing behavior of the camera is enabled on the camera.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useFramingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._framingBehavior = new _Behaviors_Cameras_framingBehavior__WEBPACK_IMPORTED_MODULE_8__[\"FramingBehavior\"]();\r\n this.addBehavior(this._framingBehavior);\r\n }\r\n else if (this._framingBehavior) {\r\n this.removeBehavior(this._framingBehavior);\r\n this._framingBehavior = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"autoRotationBehavior\", {\r\n /**\r\n * Gets the auto rotation behavior of the camera if it has been enabled.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useAutoRotationBehavior\", {\r\n /**\r\n * Defines if the auto rotation behavior of the camera is enabled on the camera.\r\n * @see http://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useAutoRotationBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._autoRotationBehavior = new _Behaviors_Cameras_autoRotationBehavior__WEBPACK_IMPORTED_MODULE_6__[\"AutoRotationBehavior\"]();\r\n this.addBehavior(this._autoRotationBehavior);\r\n }\r\n else if (this._autoRotationBehavior) {\r\n this.removeBehavior(this._autoRotationBehavior);\r\n this._autoRotationBehavior = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Cache\r\n /** @hidden */\r\n ArcRotateCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache._target = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.alpha = undefined;\r\n this._cache.beta = undefined;\r\n this._cache.radius = undefined;\r\n this._cache.targetScreenOffset = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache._target.copyFrom(this._getTargetPosition());\r\n this._cache.alpha = this.alpha;\r\n this._cache.beta = this.beta;\r\n this._cache.radius = this.radius;\r\n this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset);\r\n };\r\n ArcRotateCamera.prototype._getTargetPosition = function () {\r\n if (this._targetHost && this._targetHost.getAbsolutePosition) {\r\n var pos = this._targetHost.absolutePosition;\r\n if (this._targetBoundingCenter) {\r\n pos.addToRef(this._targetBoundingCenter, this._target);\r\n }\r\n else {\r\n this._target.copyFrom(pos);\r\n }\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (lockedTargetPosition) {\r\n return lockedTargetPosition;\r\n }\r\n return this._target;\r\n };\r\n /**\r\n * Stores the current state of the camera (alpha, beta, radius and target)\r\n * @returns the camera itself\r\n */\r\n ArcRotateCamera.prototype.storeState = function () {\r\n this._storedAlpha = this.alpha;\r\n this._storedBeta = this.beta;\r\n this._storedRadius = this.radius;\r\n this._storedTarget = this._getTargetPosition().clone();\r\n this._storedTargetScreenOffset = this.targetScreenOffset.clone();\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * @hidden\r\n * Restored camera state. You must call storeState() first\r\n */\r\n ArcRotateCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.setTarget(this._storedTarget.clone());\r\n this.alpha = this._storedAlpha;\r\n this.beta = this._storedBeta;\r\n this.radius = this._storedRadius;\r\n this.targetScreenOffset = this._storedTargetScreenOffset.clone();\r\n this.inertialAlphaOffset = 0;\r\n this.inertialBetaOffset = 0;\r\n this.inertialRadiusOffset = 0;\r\n this.inertialPanningX = 0;\r\n this.inertialPanningY = 0;\r\n return true;\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n return this._cache._target.equals(this._getTargetPosition())\r\n && this._cache.alpha === this.alpha\r\n && this._cache.beta === this.beta\r\n && this._cache.radius === this.radius\r\n && this._cache.targetScreenOffset.equals(this.targetScreenOffset);\r\n };\r\n /**\r\n * Attached controls to the current camera.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n * @param useCtrlForPanning Defines whether ctrl is used for paning within the controls\r\n * @param panningMouseButton Defines whether panning is allowed through mouse click button\r\n */\r\n ArcRotateCamera.prototype.attachControl = function (element, noPreventDefault, useCtrlForPanning, panningMouseButton) {\r\n var _this = this;\r\n if (useCtrlForPanning === void 0) { useCtrlForPanning = true; }\r\n if (panningMouseButton === void 0) { panningMouseButton = 2; }\r\n this._useCtrlForPanning = useCtrlForPanning;\r\n this._panningMouseButton = panningMouseButton;\r\n this.inputs.attachElement(element, noPreventDefault);\r\n this._reset = function () {\r\n _this.inertialAlphaOffset = 0;\r\n _this.inertialBetaOffset = 0;\r\n _this.inertialRadiusOffset = 0;\r\n _this.inertialPanningX = 0;\r\n _this.inertialPanningY = 0;\r\n };\r\n };\r\n /**\r\n * Detach the current controls from the camera.\r\n * The camera will stop reacting to inputs.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n ArcRotateCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n if (this._reset) {\r\n this._reset();\r\n }\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._checkInputs = function () {\r\n //if (async) collision inspection was triggered, don't update the camera's position - until the collision callback was called.\r\n if (this._collisionTriggered) {\r\n return;\r\n }\r\n this.inputs.checkInputs();\r\n // Inertia\r\n if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {\r\n var inertialAlphaOffset = this.inertialAlphaOffset;\r\n if (this.beta <= 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n this.alpha += inertialAlphaOffset;\r\n this.beta += this.inertialBetaOffset;\r\n this.radius -= this.inertialRadiusOffset;\r\n this.inertialAlphaOffset *= this.inertia;\r\n this.inertialBetaOffset *= this.inertia;\r\n this.inertialRadiusOffset *= this.inertia;\r\n if (Math.abs(this.inertialAlphaOffset) < _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialAlphaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialBetaOffset) < _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialBetaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialRadiusOffset) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialRadiusOffset = 0;\r\n }\r\n }\r\n // Panning inertia\r\n if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) {\r\n if (!this._localDirection) {\r\n this._localDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);\r\n this._localDirection.multiplyInPlace(this.panningAxis);\r\n this._viewMatrix.invertToRef(this._cameraTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);\r\n //Eliminate y if map panning is enabled (panningAxis == 1,0,1)\r\n if (!this.panningAxis.y) {\r\n this._transformedDirection.y = 0;\r\n }\r\n if (!this._targetHost) {\r\n if (this.panningDistanceLimit) {\r\n this._transformedDirection.addInPlace(this._target);\r\n var distanceSquared = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].DistanceSquared(this._transformedDirection, this.panningOriginTarget);\r\n if (distanceSquared <= (this.panningDistanceLimit * this.panningDistanceLimit)) {\r\n this._target.copyFrom(this._transformedDirection);\r\n }\r\n }\r\n else {\r\n this._target.addInPlace(this._transformedDirection);\r\n }\r\n }\r\n this.inertialPanningX *= this.panningInertia;\r\n this.inertialPanningY *= this.panningInertia;\r\n if (Math.abs(this.inertialPanningX) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialPanningX = 0;\r\n }\r\n if (Math.abs(this.inertialPanningY) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_12__[\"Epsilon\"]) {\r\n this.inertialPanningY = 0;\r\n }\r\n }\r\n // Limits\r\n this._checkLimits();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n ArcRotateCamera.prototype._checkLimits = function () {\r\n if (this.lowerBetaLimit === null || this.lowerBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta > Math.PI) {\r\n this.beta = this.beta - (2 * Math.PI);\r\n }\r\n }\r\n else {\r\n if (this.beta < this.lowerBetaLimit) {\r\n this.beta = this.lowerBetaLimit;\r\n }\r\n }\r\n if (this.upperBetaLimit === null || this.upperBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta < -Math.PI) {\r\n this.beta = this.beta + (2 * Math.PI);\r\n }\r\n }\r\n else {\r\n if (this.beta > this.upperBetaLimit) {\r\n this.beta = this.upperBetaLimit;\r\n }\r\n }\r\n if (this.lowerAlphaLimit !== null && this.alpha < this.lowerAlphaLimit) {\r\n this.alpha = this.lowerAlphaLimit;\r\n }\r\n if (this.upperAlphaLimit !== null && this.alpha > this.upperAlphaLimit) {\r\n this.alpha = this.upperAlphaLimit;\r\n }\r\n if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {\r\n this.radius = this.lowerRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {\r\n this.radius = this.upperRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n };\r\n /**\r\n * Rebuilds angles (alpha, beta) and radius from the give position and target\r\n */\r\n ArcRotateCamera.prototype.rebuildAnglesAndRadius = function () {\r\n this._position.subtractToRef(this._getTargetPosition(), this._computationVector);\r\n // need to rotate to Y up equivalent if up vector not Axis.Y\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector);\r\n }\r\n this.radius = this._computationVector.length();\r\n if (this.radius === 0) {\r\n this.radius = 0.0001; // Just to avoid division by zero\r\n }\r\n // Alpha\r\n if (this._computationVector.x === 0 && this._computationVector.z === 0) {\r\n this.alpha = Math.PI / 2; // avoid division by zero when looking along up axis, and set to acos(0)\r\n }\r\n else {\r\n this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2)));\r\n }\r\n if (this._computationVector.z < 0) {\r\n this.alpha = 2 * Math.PI - this.alpha;\r\n }\r\n // Beta\r\n this.beta = Math.acos(this._computationVector.y / this.radius);\r\n this._checkLimits();\r\n };\r\n /**\r\n * Use a position to define the current camera related information like aplha, beta and radius\r\n * @param position Defines the position to set the camera at\r\n */\r\n ArcRotateCamera.prototype.setPosition = function (position) {\r\n if (this._position.equals(position)) {\r\n return;\r\n }\r\n this._position.copyFrom(position);\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /**\r\n * Defines the target the camera should look at.\r\n * This will automatically adapt alpha beta and radius to fit within the new target.\r\n * @param target Defines the new target as a Vector or a mesh\r\n * @param toBoundingCenter In case of a mesh target, defines wether to target the mesh position or its bounding information center\r\n * @param allowSamePosition If false, prevents reapplying the new computed position if it is identical to the current one (optim)\r\n */\r\n ArcRotateCamera.prototype.setTarget = function (target, toBoundingCenter, allowSamePosition) {\r\n if (toBoundingCenter === void 0) { toBoundingCenter = false; }\r\n if (allowSamePosition === void 0) { allowSamePosition = false; }\r\n if (target.getBoundingInfo) {\r\n if (toBoundingCenter) {\r\n this._targetBoundingCenter = target.getBoundingInfo().boundingBox.centerWorld.clone();\r\n }\r\n else {\r\n this._targetBoundingCenter = null;\r\n }\r\n target.computeWorldMatrix();\r\n this._targetHost = target;\r\n this._target = this._getTargetPosition();\r\n this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);\r\n }\r\n else {\r\n var newTarget = target;\r\n var currentTarget = this._getTargetPosition();\r\n if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {\r\n return;\r\n }\r\n this._targetHost = null;\r\n this._target = newTarget;\r\n this._targetBoundingCenter = null;\r\n this.onMeshTargetChangedObservable.notifyObservers(null);\r\n }\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._getViewMatrix = function () {\r\n // Compute\r\n var cosa = Math.cos(this.alpha);\r\n var sina = Math.sin(this.alpha);\r\n var cosb = Math.cos(this.beta);\r\n var sinb = Math.sin(this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n var target = this._getTargetPosition();\r\n this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);\r\n // Rotate according to up vector\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._computationVector, this._YToUpMatrix, this._computationVector);\r\n }\r\n target.addToRef(this._computationVector, this._newPosition);\r\n if (this.getScene().collisionsEnabled && this.checkCollisions) {\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.collisionRadius;\r\n this._newPosition.subtractToRef(this._position, this._collisionVelocity);\r\n this._collisionTriggered = true;\r\n coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n }\r\n else {\r\n this._position.copyFrom(this._newPosition);\r\n var up = this.upVector;\r\n if (this.allowUpsideDown && sinb < 0) {\r\n up = up.negate();\r\n }\r\n this._computeViewMatrix(this._position, target, up);\r\n this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);\r\n this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);\r\n }\r\n this._currentTarget = target;\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Zooms on a mesh to be at the min distance where we could see it fully in the current viewport.\r\n * @param meshes Defines the mesh to zoom on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.zoomOn = function (meshes, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n meshes = meshes || this.getScene().meshes;\r\n var minMaxVector = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].MinMax(meshes);\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(minMaxVector.min, minMaxVector.max);\r\n this.radius = distance * this.zoomOnFactor;\r\n this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance }, doNotUpdateMaxZ);\r\n };\r\n /**\r\n * Focus on a mesh or a bounding box. This adapts the target and maxRadius if necessary but does not update the current radius.\r\n * The target will be changed but the radius\r\n * @param meshesOrMinMaxVectorAndDistance Defines the mesh or bounding info to focus on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n var meshesOrMinMaxVector;\r\n var distance;\r\n if (meshesOrMinMaxVectorAndDistance.min === undefined) { // meshes\r\n var meshes = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;\r\n meshesOrMinMaxVector = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].MinMax(meshes);\r\n distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);\r\n }\r\n else { //minMaxVector and distance\r\n var minMaxVectorAndDistance = meshesOrMinMaxVectorAndDistance;\r\n meshesOrMinMaxVector = minMaxVectorAndDistance;\r\n distance = minMaxVectorAndDistance.distance;\r\n }\r\n this._target = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].Center(meshesOrMinMaxVector);\r\n if (!doNotUpdateMaxZ) {\r\n this.maxZ = distance * 2;\r\n }\r\n };\r\n /**\r\n * @override\r\n * Override Camera.createRigCamera\r\n */\r\n ArcRotateCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n var alphaShift = 0;\r\n switch (this.cameraRigMode) {\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_VR:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);\r\n break;\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);\r\n break;\r\n }\r\n var rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());\r\n rigCam._cameraRigParams = {};\r\n return rigCam;\r\n };\r\n /**\r\n * @hidden\r\n * @override\r\n * Override Camera._updateRigCameras\r\n */\r\n ArcRotateCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n camLeft.beta = camRight.beta = this.beta;\r\n switch (this.cameraRigMode) {\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_VR:\r\n camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n case _camera__WEBPACK_IMPORTED_MODULE_9__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n ArcRotateCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n ArcRotateCamera.prototype.getClassName = function () {\r\n return \"ArcRotateCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"alpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"beta\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"target\")\r\n ], ArcRotateCamera.prototype, \"_target\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"upVector\")\r\n ], ArcRotateCamera.prototype, \"_upVector\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialAlphaOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialBetaOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialRadiusOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"lowerAlphaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"upperAlphaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"lowerBetaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"upperBetaLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"lowerRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"upperRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialPanningX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"inertialPanningY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"pinchToPanMaxDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"panningDistanceLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ArcRotateCamera.prototype, \"panningOriginTarget\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"panningInertia\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"zoomOnFactor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"targetScreenOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"allowUpsideDown\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ArcRotateCamera.prototype, \"useInputToRestoreState\", void 0);\r\n return ArcRotateCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_10__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/arcRotateCameraInputsManager.ts\":\n/*!*************************************************!*\\\n !*** ./Cameras/arcRotateCameraInputsManager.ts ***!\n \\*************************************************/\n/*! exports provided: ArcRotateCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return ArcRotateCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraPointersInput */ \"./Cameras/Inputs/arcRotateCameraPointersInput.ts\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraKeyboardMoveInput */ \"./Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraMouseWheelInput */ \"./Cameras/Inputs/arcRotateCameraMouseWheelInput.ts\");\n/* harmony import */ var _Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Cameras/cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the ArcRotateCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcRotateCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new ArcRotateCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function ArcRotateCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addMouseWheel = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__[\"ArcRotateCameraMouseWheelInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add pointers input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addPointers = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraPointersInput__WEBPACK_IMPORTED_MODULE_1__[\"ArcRotateCameraPointersInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCameraKeyboardMoveInput\"]());\r\n return this;\r\n };\r\n return ArcRotateCameraInputsManager;\r\n}(_Cameras_cameraInputsManager__WEBPACK_IMPORTED_MODULE_4__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/camera.ts\":\n/*!***************************!*\\\n !*** ./Cameras/camera.ts ***!\n \\***************************/\n/*! exports provided: Camera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return Camera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n/* harmony import */ var _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Maths/math.frustum */ \"./Maths/math.frustum.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This is the base class of all the camera used in the application.\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar Camera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Camera, _super);\r\n /**\r\n * Instantiates a new camera object.\r\n * This should not be used directly but through the inherited cameras: ArcRotate, Free...\r\n * @see http://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the position of the camera\r\n * @param scene Defines the scene the camera belongs too\r\n * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene\r\n */\r\n function Camera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n /** @hidden */\r\n _this._position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n /**\r\n * The vector the camera should consider as up.\r\n * (default is Vector3(0, 1, 0) aka Vector3.Up())\r\n */\r\n _this.upVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Up();\r\n /**\r\n * Define the current limit on the left side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoLeft = null;\r\n /**\r\n * Define the current limit on the right side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoRight = null;\r\n /**\r\n * Define the current limit on the bottom side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoBottom = null;\r\n /**\r\n * Define the current limit on the top side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoTop = null;\r\n /**\r\n * Field Of View is set in Radians. (default is 0.8)\r\n */\r\n _this.fov = 0.8;\r\n /**\r\n * Define the minimum distance the camera can see from.\r\n * This is important to note that the depth buffer are not infinite and the closer it starts\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.minZ = 1;\r\n /**\r\n * Define the maximum distance the camera can see to.\r\n * This is important to note that the depth buffer are not infinite and the further it end\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.maxZ = 10000.0;\r\n /**\r\n * Define the default inertia of the camera.\r\n * This helps giving a smooth feeling to the camera movement.\r\n */\r\n _this.inertia = 0.9;\r\n /**\r\n * Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)\r\n */\r\n _this.mode = Camera.PERSPECTIVE_CAMERA;\r\n /**\r\n * Define wether the camera is intermediate.\r\n * This is useful to not present the output directly to the screen in case of rig without post process for instance\r\n */\r\n _this.isIntermediate = false;\r\n /**\r\n * Define the viewport of the camera.\r\n * This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.\r\n */\r\n _this.viewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_10__[\"Viewport\"](0, 0, 1.0, 1.0);\r\n /**\r\n * Restricts the camera to viewing objects with the same layerMask.\r\n * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0\r\n */\r\n _this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)\r\n */\r\n _this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;\r\n /**\r\n * Rig mode of the camera.\r\n * This is useful to create the camera with two \"eyes\" instead of one to create VR or stereoscopic scenes.\r\n * This is normally controlled byt the camera themselves as internal use.\r\n */\r\n _this.cameraRigMode = Camera.RIG_MODE_NONE;\r\n /**\r\n * Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene\r\n * This is pretty helpfull if you wish to make a camera render to a texture you could reuse somewhere\r\n * else in the scene. (Eg. security camera)\r\n *\r\n * To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corrisponding to an HMD)\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * When set, the camera will render to this render target instead of the default canvas\r\n *\r\n * If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead\r\n */\r\n _this.outputRenderTarget = null;\r\n /**\r\n * Observable triggered when the camera view matrix has changed.\r\n */\r\n _this.onViewMatrixChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Observable triggered when the camera Projection matrix has changed.\r\n */\r\n _this.onProjectionMatrixChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Observable triggered when the inputs have been processed.\r\n */\r\n _this.onAfterCheckInputsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /**\r\n * Observable triggered when reset has been called and applied to the camera.\r\n */\r\n _this.onRestoreStateObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_4__[\"Observable\"]();\r\n /** @hidden */\r\n _this._rigCameras = new Array();\r\n _this._webvrViewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n /** @hidden */\r\n _this._skipRendering = false;\r\n /** @hidden */\r\n _this._projectionMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]();\r\n /** @hidden */\r\n _this._postProcesses = new Array();\r\n /** @hidden */\r\n _this._activeMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__[\"SmartArray\"](256);\r\n _this._globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n _this._computedViewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n _this._doNotComputeProjectionMatrix = false;\r\n _this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Zero();\r\n _this._refreshFrustumPlanes = true;\r\n /** @hidden */\r\n _this._isCamera = true;\r\n /** @hidden */\r\n _this._isLeftCamera = false;\r\n /** @hidden */\r\n _this._isRightCamera = false;\r\n _this.getScene().addCamera(_this);\r\n if (setActiveOnSceneIfNoneActive && !_this.getScene().activeCamera) {\r\n _this.getScene().activeCamera = _this;\r\n }\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(Camera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Store current camera state (fov, position, etc..)\r\n * @returns the camera\r\n */\r\n Camera.prototype.storeState = function () {\r\n this._stateStored = true;\r\n this._storedFov = this.fov;\r\n return this;\r\n };\r\n /**\r\n * Restores the camera state values if it has been stored. You must call storeState() first\r\n */\r\n Camera.prototype._restoreStateValues = function () {\r\n if (!this._stateStored) {\r\n return false;\r\n }\r\n this.fov = this._storedFov;\r\n return true;\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first.\r\n * @returns true if restored and false otherwise\r\n */\r\n Camera.prototype.restoreState = function () {\r\n if (this._restoreStateValues()) {\r\n this.onRestoreStateObservable.notifyObservers(this);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the class name of the camera.\r\n * @returns the class name\r\n */\r\n Camera.prototype.getClassName = function () {\r\n return \"Camera\";\r\n };\r\n /**\r\n * Gets a string representation of the camera useful for debug purpose.\r\n * @param fullDetails Defines that a more verboe level of logging is required\r\n * @returns the string representation\r\n */\r\n Camera.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n Object.defineProperty(Camera.prototype, \"globalPosition\", {\r\n /**\r\n * Gets the current world space position of the camera.\r\n */\r\n get: function () {\r\n return this._globalPosition;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of active meshes this frame (meshes no culled or excluded by lod s in the frame)\r\n * @returns the active meshe list\r\n */\r\n Camera.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Check wether a mesh is part of the current active mesh list of the camera\r\n * @param mesh Defines the mesh to check\r\n * @returns true if active, false otherwise\r\n */\r\n Camera.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n /**\r\n * Is this camera ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including post processes) has to be done (false by default)\r\n * @return true if the camera is ready\r\n */\r\n Camera.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (completeCheck) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var pp = _a[_i];\r\n if (pp && !pp.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return _super.prototype.isReady.call(this, completeCheck);\r\n };\r\n /** @hidden */\r\n Camera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.upVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.mode = undefined;\r\n this._cache.minZ = undefined;\r\n this._cache.maxZ = undefined;\r\n this._cache.fov = undefined;\r\n this._cache.fovMode = undefined;\r\n this._cache.aspectRatio = undefined;\r\n this._cache.orthoLeft = undefined;\r\n this._cache.orthoRight = undefined;\r\n this._cache.orthoBottom = undefined;\r\n this._cache.orthoTop = undefined;\r\n this._cache.renderWidth = undefined;\r\n this._cache.renderHeight = undefined;\r\n };\r\n /** @hidden */\r\n Camera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache.position.copyFrom(this.position);\r\n this._cache.upVector.copyFrom(this.upVector);\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronized = function () {\r\n return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronized.call(this)) {\r\n return false;\r\n }\r\n return this._cache.position.equals(this.position)\r\n && this._cache.upVector.equals(this.upVector)\r\n && this.isSynchronizedWithParent();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedProjectionMatrix = function () {\r\n var check = this._cache.mode === this.mode\r\n && this._cache.minZ === this.minZ\r\n && this._cache.maxZ === this.maxZ;\r\n if (!check) {\r\n return false;\r\n }\r\n var engine = this.getEngine();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n check = this._cache.fov === this.fov\r\n && this._cache.fovMode === this.fovMode\r\n && this._cache.aspectRatio === engine.getAspectRatio(this);\r\n }\r\n else {\r\n check = this._cache.orthoLeft === this.orthoLeft\r\n && this._cache.orthoRight === this.orthoRight\r\n && this._cache.orthoBottom === this.orthoBottom\r\n && this._cache.orthoTop === this.orthoTop\r\n && this._cache.renderWidth === engine.getRenderWidth()\r\n && this._cache.renderHeight === engine.getRenderHeight();\r\n }\r\n return check;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n Camera.prototype.attachControl = function (element, noPreventDefault) {\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n Camera.prototype.detachControl = function (element) {\r\n };\r\n /**\r\n * Update the camera state according to the different inputs gathered during the frame.\r\n */\r\n Camera.prototype.update = function () {\r\n this._checkInputs();\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._updateRigCameras();\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._checkInputs = function () {\r\n this.onAfterCheckInputsObservable.notifyObservers(this);\r\n };\r\n Object.defineProperty(Camera.prototype, \"rigCameras\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._rigCameras;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rigPostProcess\", {\r\n /**\r\n * Gets the post process used by the rig cameras\r\n */\r\n get: function () {\r\n return this._rigPostProcess;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Internal, gets the first post proces.\r\n * @returns the first post process to be run on this camera.\r\n */\r\n Camera.prototype._getFirstPostProcess = function () {\r\n for (var ppIndex = 0; ppIndex < this._postProcesses.length; ppIndex++) {\r\n if (this._postProcesses[ppIndex] !== null) {\r\n return this._postProcesses[ppIndex];\r\n }\r\n }\r\n return null;\r\n };\r\n Camera.prototype._cascadePostProcessesToRigCams = function () {\r\n // invalidate framebuffer\r\n var firstPostProcess = this._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera\r\n for (var i = 0, len = this._rigCameras.length; i < len; i++) {\r\n var cam = this._rigCameras[i];\r\n var rigPostProcess = cam._rigPostProcess;\r\n // for VR rig, there does not have to be a post process\r\n if (rigPostProcess) {\r\n var isPass = rigPostProcess.getEffectName() === \"pass\";\r\n if (isPass) {\r\n // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses\r\n cam.isIntermediate = this._postProcesses.length === 0;\r\n }\r\n cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);\r\n rigPostProcess.markTextureDirty();\r\n }\r\n else {\r\n cam._postProcesses = this._postProcesses.slice(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Attach a post process to the camera.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to attach to the camera\r\n * @param insertAt The position of the post process in case several of them are in use in the scene\r\n * @returns the position the post process has been inserted at\r\n */\r\n Camera.prototype.attachPostProcess = function (postProcess, insertAt) {\r\n if (insertAt === void 0) { insertAt = null; }\r\n if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_7__[\"Logger\"].Error(\"You're trying to reuse a post process not defined as reusable.\");\r\n return 0;\r\n }\r\n if (insertAt == null || insertAt < 0) {\r\n this._postProcesses.push(postProcess);\r\n }\r\n else if (this._postProcesses[insertAt] === null) {\r\n this._postProcesses[insertAt] = postProcess;\r\n }\r\n else {\r\n this._postProcesses.splice(insertAt, 0, postProcess);\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n return this._postProcesses.indexOf(postProcess);\r\n };\r\n /**\r\n * Detach a post process to the camera.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to detach from the camera\r\n */\r\n Camera.prototype.detachPostProcess = function (postProcess) {\r\n var idx = this._postProcesses.indexOf(postProcess);\r\n if (idx !== -1) {\r\n this._postProcesses[idx] = null;\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n };\r\n /**\r\n * Gets the current world matrix of the camera\r\n */\r\n Camera.prototype.getWorldMatrix = function () {\r\n if (this._isSynchronizedViewMatrix()) {\r\n return this._worldMatrix;\r\n }\r\n // Getting the the view matrix will also compute the world matrix.\r\n this.getViewMatrix();\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n Camera.prototype._getViewMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n };\r\n /**\r\n * Gets the current view matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the view matrix\r\n */\r\n Camera.prototype.getViewMatrix = function (force) {\r\n if (!force && this._isSynchronizedViewMatrix()) {\r\n return this._computedViewMatrix;\r\n }\r\n this.updateCache();\r\n this._computedViewMatrix = this._getViewMatrix();\r\n this._currentRenderId = this.getScene().getRenderId();\r\n this._childUpdateId++;\r\n this._refreshFrustumPlanes = true;\r\n if (this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix) {\r\n this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix);\r\n }\r\n // Notify parent camera if rig camera is changed\r\n if (this.parent && this.parent.onViewMatrixChangedObservable) {\r\n this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent);\r\n }\r\n this.onViewMatrixChangedObservable.notifyObservers(this);\r\n this._computedViewMatrix.invertToRef(this._worldMatrix);\r\n return this._computedViewMatrix;\r\n };\r\n /**\r\n * Freeze the projection matrix.\r\n * It will prevent the cache check of the camera projection compute and can speed up perf\r\n * if no parameter of the camera are meant to change\r\n * @param projection Defines manually a projection if necessary\r\n */\r\n Camera.prototype.freezeProjectionMatrix = function (projection) {\r\n this._doNotComputeProjectionMatrix = true;\r\n if (projection !== undefined) {\r\n this._projectionMatrix = projection;\r\n }\r\n };\r\n /**\r\n * Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.\r\n */\r\n Camera.prototype.unfreezeProjectionMatrix = function () {\r\n this._doNotComputeProjectionMatrix = false;\r\n };\r\n /**\r\n * Gets the current projection matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the projection matrix\r\n */\r\n Camera.prototype.getProjectionMatrix = function (force) {\r\n if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {\r\n return this._projectionMatrix;\r\n }\r\n // Cache\r\n this._cache.mode = this.mode;\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = this.maxZ;\r\n // Matrix\r\n this._refreshFrustumPlanes = true;\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n this._cache.fov = this.fov;\r\n this._cache.fovMode = this.fovMode;\r\n this._cache.aspectRatio = engine.getAspectRatio(this);\r\n if (this.minZ <= 0) {\r\n this.minZ = 0.1;\r\n }\r\n if (scene.useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].PerspectiveFovRHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].PerspectiveFovLHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);\r\n }\r\n }\r\n else {\r\n var halfWidth = engine.getRenderWidth() / 2.0;\r\n var halfHeight = engine.getRenderHeight() / 2.0;\r\n if (scene.useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].OrthoOffCenterRHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n this._cache.orthoLeft = this.orthoLeft;\r\n this._cache.orthoRight = this.orthoRight;\r\n this._cache.orthoBottom = this.orthoBottom;\r\n this._cache.orthoTop = this.orthoTop;\r\n this._cache.renderWidth = engine.getRenderWidth();\r\n this._cache.renderHeight = engine.getRenderHeight();\r\n }\r\n this.onProjectionMatrixChangedObservable.notifyObservers(this);\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the transformation matrix (ie. the multiplication of view by projection matrices)\r\n * @returns a Matrix\r\n */\r\n Camera.prototype.getTransformationMatrix = function () {\r\n this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n return this._transformMatrix;\r\n };\r\n Camera.prototype._updateFrustumPlanes = function () {\r\n if (!this._refreshFrustumPlanes) {\r\n return;\r\n }\r\n this.getTransformationMatrix();\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_11__[\"Frustum\"].GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_11__[\"Frustum\"].GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n this._refreshFrustumPlanes = false;\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * This checks the bounding box center. See isCompletelyInFrustum for a full bounding check\r\n * @param target The object to check\r\n * @param checkRigCameras If the rig cameras should be checked (eg. with webVR camera both eyes should be checked) (Default: false)\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isInFrustum = function (target, checkRigCameras) {\r\n if (checkRigCameras === void 0) { checkRigCameras = false; }\r\n this._updateFrustumPlanes();\r\n if (checkRigCameras && this.rigCameras.length > 0) {\r\n var result = false;\r\n this.rigCameras.forEach(function (cam) {\r\n cam._updateFrustumPlanes();\r\n result = result || target.isInFrustum(cam._frustumPlanes);\r\n });\r\n return result;\r\n }\r\n else {\r\n return target.isInFrustum(this._frustumPlanes);\r\n }\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param target The object to check\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isCompletelyInFrustum = function (target) {\r\n this._updateFrustumPlanes();\r\n return target.isCompletelyInFrustum(this._frustumPlanes);\r\n };\r\n /**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\n Camera.prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Camera.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Observables\r\n this.onViewMatrixChangedObservable.clear();\r\n this.onProjectionMatrixChangedObservable.clear();\r\n this.onAfterCheckInputsObservable.clear();\r\n this.onRestoreStateObservable.clear();\r\n // Inputs\r\n if (this.inputs) {\r\n this.inputs.clear();\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeCamera(this);\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n // Postprocesses\r\n if (this._rigPostProcess) {\r\n this._rigPostProcess.dispose(this);\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else {\r\n var i = this._postProcesses.length;\r\n while (--i >= 0) {\r\n var postProcess = this._postProcesses[i];\r\n if (postProcess) {\r\n postProcess.dispose(this);\r\n }\r\n }\r\n }\r\n // Render targets\r\n var i = this.customRenderTargets.length;\r\n while (--i >= 0) {\r\n this.customRenderTargets[i].dispose();\r\n }\r\n this.customRenderTargets = [];\r\n // Active Meshes\r\n this._activeMeshes.dispose();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n Object.defineProperty(Camera.prototype, \"isLeftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isLeftCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"isRightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isRightCamera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"leftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the left camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getLeftTarget = function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0].getTarget();\r\n };\r\n /**\r\n * Gets the right camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getRightTarget = function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1].getTarget();\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Camera.prototype.setCameraRigMode = function (mode, rigParams) {\r\n if (this.cameraRigMode === mode) {\r\n return;\r\n }\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n this.cameraRigMode = mode;\r\n this._cameraRigParams = {};\r\n //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target,\r\n //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced\r\n this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;\r\n this._cameraRigParams.stereoHalfAngle = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].ToRadians(this._cameraRigParams.interaxialDistance / 0.0637);\r\n // create the rig cameras, unless none\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n var leftCamera = this.createRigCamera(this.name + \"_L\", 0);\r\n if (leftCamera) {\r\n leftCamera._isLeftCamera = true;\r\n }\r\n var rightCamera = this.createRigCamera(this.name + \"_R\", 1);\r\n if (rightCamera) {\r\n rightCamera._isRightCamera = true;\r\n }\r\n if (leftCamera && rightCamera) {\r\n this._rigCameras.push(leftCamera);\r\n this._rigCameras.push(rightCamera);\r\n }\r\n }\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n Camera._setStereoscopicAnaglyphRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n Camera._setStereoscopicRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_VR:\r\n Camera._setVRRigMode(this, rigParams);\r\n break;\r\n case Camera.RIG_MODE_WEBVR:\r\n Camera._setWebVRRigMode(this, rigParams);\r\n break;\r\n }\r\n this._cascadePostProcessesToRigCams();\r\n this.update();\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicAnaglyphRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/vrRigMode before using VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setWebVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera.prototype._getVRProjectionMatrix = function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix);\r\n this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);\r\n return this._projectionMatrix;\r\n };\r\n Camera.prototype._updateCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n Camera.prototype._updateWebVRCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRProjectionMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRViewMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n };\r\n /** @hidden */\r\n Camera.prototype.setCameraRigParameter = function (name, value) {\r\n if (!this._cameraRigParams) {\r\n this._cameraRigParams = {};\r\n }\r\n this._cameraRigParams[name] = value;\r\n //provisionnally:\r\n if (name === \"interaxialDistance\") {\r\n this._cameraRigParams.stereoHalfAngle = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].ToRadians(value / 0.0637);\r\n }\r\n };\r\n /**\r\n * needs to be overridden by children so sub has required properties to be copied\r\n * @hidden\r\n */\r\n Camera.prototype.createRigCamera = function (name, cameraIndex) {\r\n return null;\r\n };\r\n /**\r\n * May need to be overridden by children\r\n * @hidden\r\n */\r\n Camera.prototype._updateRigCameras = function () {\r\n for (var i = 0; i < this._rigCameras.length; i++) {\r\n this._rigCameras[i].minZ = this.minZ;\r\n this._rigCameras[i].maxZ = this.maxZ;\r\n this._rigCameras[i].fov = this.fov;\r\n this._rigCameras[i].upVector.copyFrom(this.upVector);\r\n }\r\n // only update viewport when ANAGLYPH\r\n if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {\r\n this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._setupInputs = function () {\r\n };\r\n /**\r\n * Serialiaze the camera setup to a json represention\r\n * @returns the JSON representation\r\n */\r\n Camera.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n // Type\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n if (this.inputs) {\r\n this.inputs.serialize(serializationObject);\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Clones the current camera.\r\n * @param name The cloned camera name\r\n * @returns the cloned camera\r\n */\r\n Camera.prototype.clone = function (name) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(Camera.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);\r\n };\r\n /**\r\n * Gets the direction of the camera relative to a given local axis.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @return the direction\r\n */\r\n Camera.prototype.getDirection = function (localAxis) {\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n /**\r\n * Gets the direction of the camera relative to a given local axis into a passed vector.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @param result Defines the vector to store the result in\r\n */\r\n Camera.prototype.getDirectionToRef = function (localAxis, result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n };\r\n /**\r\n * Gets a camera constructor for a given camera type\r\n * @param type The type of the camera to construct (should be equal to one of the camera class name)\r\n * @param name The name of the camera the result will be able to instantiate\r\n * @param scene The scene the result will construct the camera in\r\n * @param interaxial_distance In case of stereoscopic setup, the distance between both eyes\r\n * @param isStereoscopicSideBySide In case of stereoscopic setup, should the sereo be side b side\r\n * @returns a factory method to construc the camera\r\n */\r\n Camera.GetConstructorFromName = function (type, name, scene, interaxial_distance, isStereoscopicSideBySide) {\r\n if (interaxial_distance === void 0) { interaxial_distance = 0; }\r\n if (isStereoscopicSideBySide === void 0) { isStereoscopicSideBySide = true; }\r\n var constructorFunc = _node__WEBPACK_IMPORTED_MODULE_6__[\"Node\"].Construct(type, name, scene, {\r\n interaxial_distance: interaxial_distance,\r\n isStereoscopicSideBySide: isStereoscopicSideBySide\r\n });\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to universal camera\r\n return function () { return Camera._createDefaultParsedCamera(name, scene); };\r\n };\r\n /**\r\n * Compute the world matrix of the camera.\r\n * @returns the camera workd matrix\r\n */\r\n Camera.prototype.computeWorldMatrix = function () {\r\n return this.getWorldMatrix();\r\n };\r\n /**\r\n * Parse a JSON and creates the camera from the parsed information\r\n * @param parsedCamera The JSON to parse\r\n * @param scene The scene to instantiate the camera in\r\n * @returns the newly constructed camera\r\n */\r\n Camera.Parse = function (parsedCamera, scene) {\r\n var type = parsedCamera.type;\r\n var construct = Camera.GetConstructorFromName(type, parsedCamera.name, scene, parsedCamera.interaxial_distance, parsedCamera.isStereoscopicSideBySide);\r\n var camera = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(construct, parsedCamera, scene);\r\n // Parent\r\n if (parsedCamera.parentId) {\r\n camera._waitingParentId = parsedCamera.parentId;\r\n }\r\n //If camera has an input manager, let it parse inputs settings\r\n if (camera.inputs) {\r\n camera.inputs.parse(parsedCamera);\r\n camera._setupInputs();\r\n }\r\n if (camera.setPosition) { // need to force position\r\n camera.position.copyFromFloats(0, 0, 0);\r\n camera.setPosition(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedCamera.position));\r\n }\r\n // Target\r\n if (parsedCamera.target) {\r\n if (camera.setTarget) {\r\n camera.setTarget(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedCamera.target));\r\n }\r\n }\r\n // Apply 3d rig, when found\r\n if (parsedCamera.cameraRigMode) {\r\n var rigParams = (parsedCamera.interaxial_distance) ? { interaxialDistance: parsedCamera.interaxial_distance } : {};\r\n camera.setCameraRigMode(parsedCamera.cameraRigMode, rigParams);\r\n }\r\n // Animations\r\n if (parsedCamera.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedCamera.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedCamera.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n camera.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_6__[\"Node\"].ParseAnimationRanges(camera, parsedCamera, scene);\r\n }\r\n if (parsedCamera.autoAnimate) {\r\n scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);\r\n }\r\n return camera;\r\n };\r\n /** @hidden */\r\n Camera._createDefaultParsedCamera = function (name, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"UniversalCamera\");\r\n };\r\n /**\r\n * This is the default projection mode used by the cameras.\r\n * It helps recreating a feeling of perspective and better appreciate depth.\r\n * This is the best way to simulate real life cameras.\r\n */\r\n Camera.PERSPECTIVE_CAMERA = 0;\r\n /**\r\n * This helps creating camera with an orthographic mode.\r\n * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.\r\n */\r\n Camera.ORTHOGRAPHIC_CAMERA = 1;\r\n /**\r\n * This is the default FOV mode for perspective cameras.\r\n * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_VERTICAL_FIXED = 0;\r\n /**\r\n * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_HORIZONTAL_FIXED = 1;\r\n /**\r\n * This specifies ther is no need for a camera rig.\r\n * Basically only one eye is rendered corresponding to the camera.\r\n */\r\n Camera.RIG_MODE_NONE = 0;\r\n /**\r\n * Simulates a camera Rig with one blue eye and one red eye.\r\n * This can be use with 3d blue and red glasses.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a none parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;\r\n /**\r\n * Defines that both eyes of the camera will be rendered over under each other.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (carbox).\r\n */\r\n Camera.RIG_MODE_VR = 20;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (webVR).\r\n */\r\n Camera.RIG_MODE_WEBVR = 21;\r\n /**\r\n * Custom rig mode allowing rig cameras to be populated manually with any number of cameras\r\n */\r\n Camera.RIG_MODE_CUSTOM = 22;\r\n /**\r\n * Defines if by default attaching controls should prevent the default javascript event to continue.\r\n */\r\n Camera.ForceAttachControlToAlwaysPreventDefault = false;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"position\")\r\n ], Camera.prototype, \"_position\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], Camera.prototype, \"upVector\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoLeft\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoRight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoBottom\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"orthoTop\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"fov\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"minZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"maxZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"inertia\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"mode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"layerMask\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"fovMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"cameraRigMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"interaxialDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Camera.prototype, \"isStereoscopicSideBySide\", void 0);\r\n return Camera;\r\n}(_node__WEBPACK_IMPORTED_MODULE_6__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/cameraInputsManager.ts\":\n/*!****************************************!*\\\n !*** ./Cameras/cameraInputsManager.ts ***!\n \\****************************************/\n/*! exports provided: CameraInputTypes, CameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return CameraInputTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return CameraInputsManager; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n\r\n\r\n\r\n/**\r\n * @ignore\r\n * This is a list of all the different input types that are available in the application.\r\n * Fo instance: ArcRotateCameraGamepadInput...\r\n */\r\nvar CameraInputTypes = {};\r\n/**\r\n * This represents the input manager used within a camera.\r\n * It helps dealing with all the different kind of input attached to a camera.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar CameraInputsManager = /** @class */ (function () {\r\n /**\r\n * Instantiate a new Camera Input Manager.\r\n * @param camera Defines the camera the input manager blongs to\r\n */\r\n function CameraInputsManager(camera) {\r\n this.attached = {};\r\n this.camera = camera;\r\n this.checkInputs = function () { };\r\n }\r\n /**\r\n * Add an input method to a camera\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param input camera input method\r\n */\r\n CameraInputsManager.prototype.add = function (input) {\r\n var type = input.getSimpleName();\r\n if (this.attached[type]) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"camera input of type \" + type + \" already exists on camera\");\r\n return;\r\n }\r\n this.attached[type] = input;\r\n input.camera = this.camera;\r\n //for checkInputs, we are dynamically creating a function\r\n //the goal is to avoid the performance penalty of looping for inputs in the render loop\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n if (this.attachedElement) {\r\n input.attachControl(this.attachedElement);\r\n }\r\n };\r\n /**\r\n * Remove a specific input method from a camera\r\n * example: camera.inputs.remove(camera.inputs.attached.mouse);\r\n * @param inputToRemove camera input method\r\n */\r\n CameraInputsManager.prototype.remove = function (inputToRemove) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input === inputToRemove) {\r\n input.detachControl(this.attachedElement);\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n /**\r\n * Remove a specific input type from a camera\r\n * example: camera.inputs.remove(\"ArcRotateCameraGamepadInput\");\r\n * @param inputType the type of the input to remove\r\n */\r\n CameraInputsManager.prototype.removeByType = function (inputType) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.getClassName() === inputType) {\r\n input.detachControl(this.attachedElement);\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n CameraInputsManager.prototype._addCheckInputs = function (fn) {\r\n var current = this.checkInputs;\r\n return function () {\r\n current();\r\n fn();\r\n };\r\n };\r\n /**\r\n * Attach the input controls to the currently attached dom element to listen the events from.\r\n * @param input Defines the input to attach\r\n */\r\n CameraInputsManager.prototype.attachInput = function (input) {\r\n if (this.attachedElement) {\r\n input.attachControl(this.attachedElement, this.noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Attach the current manager inputs controls to a specific dom element to listen the events from.\r\n * @param element Defines the dom element to collect the events from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n CameraInputsManager.prototype.attachElement = function (element, noPreventDefault) {\r\n if (noPreventDefault === void 0) { noPreventDefault = false; }\r\n if (this.attachedElement) {\r\n return;\r\n }\r\n noPreventDefault = _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;\r\n this.attachedElement = element;\r\n this.noPreventDefault = noPreventDefault;\r\n for (var cam in this.attached) {\r\n this.attached[cam].attachControl(element, noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Detach the current manager inputs controls from a specific dom element.\r\n * @param element Defines the dom element to collect the events from\r\n * @param disconnect Defines whether the input should be removed from the current list of attached inputs\r\n */\r\n CameraInputsManager.prototype.detachElement = function (element, disconnect) {\r\n if (disconnect === void 0) { disconnect = false; }\r\n if (this.attachedElement !== element) {\r\n return;\r\n }\r\n for (var cam in this.attached) {\r\n this.attached[cam].detachControl(element);\r\n if (disconnect) {\r\n this.attached[cam].camera = null;\r\n }\r\n }\r\n this.attachedElement = null;\r\n };\r\n /**\r\n * Rebuild the dynamic inputCheck function from the current list of\r\n * defined inputs in the manager.\r\n */\r\n CameraInputsManager.prototype.rebuildInputCheck = function () {\r\n this.checkInputs = function () { };\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n }\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n CameraInputsManager.prototype.clear = function () {\r\n if (this.attachedElement) {\r\n this.detachElement(this.attachedElement, true);\r\n }\r\n this.attached = {};\r\n this.attachedElement = null;\r\n this.checkInputs = function () { };\r\n };\r\n /**\r\n * Serialize the current input manager attached to a camera.\r\n * This ensures than once parsed,\r\n * the input associated to the camera will be identical to the current ones\r\n * @param serializedCamera Defines the camera serialization JSON the input serialization should write to\r\n */\r\n CameraInputsManager.prototype.serialize = function (serializedCamera) {\r\n var inputs = {};\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n var res = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(input);\r\n inputs[input.getClassName()] = res;\r\n }\r\n serializedCamera.inputsmgr = inputs;\r\n };\r\n /**\r\n * Parses an input manager serialized JSON to restore the previous list of inputs\r\n * and states associated to a camera.\r\n * @param parsedCamera Defines the JSON to parse\r\n */\r\n CameraInputsManager.prototype.parse = function (parsedCamera) {\r\n var parsedInputs = parsedCamera.inputsmgr;\r\n if (parsedInputs) {\r\n this.clear();\r\n for (var n in parsedInputs) {\r\n var construct = CameraInputTypes[n];\r\n if (construct) {\r\n var parsedinput = parsedInputs[n];\r\n var input = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new construct(); }, parsedinput, null);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n else {\r\n //2016-03-08 this part is for managing backward compatibility\r\n for (var n in this.attached) {\r\n var construct = CameraInputTypes[this.attached[n].getClassName()];\r\n if (construct) {\r\n var input = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new construct(); }, parsedCamera, null);\r\n this.remove(this.attached[n]);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n };\r\n return CameraInputsManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/deviceOrientationCamera.ts\":\n/*!********************************************!*\\\n !*** ./Cameras/deviceOrientationCamera.ts ***!\n \\********************************************/\n/*! exports provided: DeviceOrientationCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return DeviceOrientationCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Inputs_freeCameraDeviceOrientationInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Inputs/freeCameraDeviceOrientationInput */ \"./Cameras/Inputs/freeCameraDeviceOrientationInput.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"DeviceOrientationCamera\", function (name, scene) {\r\n return function () { return new DeviceOrientationCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n// We're mainly based on the logic defined into the FreeCamera code\r\n/**\r\n * This is a camera specifically designed to react to device orientation events such as a modern mobile device\r\n * being tilted forward or back and left or right.\r\n */\r\nvar DeviceOrientationCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DeviceOrientationCamera, _super);\r\n /**\r\n * Creates a new device orientation camera\r\n * @param name The name of the camera\r\n * @param position The start position camera\r\n * @param scene The scene the camera belongs to\r\n */\r\n function DeviceOrientationCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this._tmpDragQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this._disablePointerInputWhenUsingDeviceOrientation = true;\r\n _this._dragFactor = 0;\r\n _this._quaternionCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this.inputs.addDeviceOrientation();\r\n // When the orientation sensor fires it's first event, disable mouse input\r\n if (_this.inputs._deviceOrientationInput) {\r\n _this.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function () {\r\n if (_this._disablePointerInputWhenUsingDeviceOrientation) {\r\n if (_this.inputs._mouseInput) {\r\n _this.inputs._mouseInput._allowCameraRotation = false;\r\n _this.inputs._mouseInput.onPointerMovedObservable.add(function (e) {\r\n if (_this._dragFactor != 0) {\r\n if (!_this._initialQuaternion) {\r\n _this._initialQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n // Rotate the initial space around the y axis to allow users to \"turn around\" via touch/mouse\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].FromEulerAnglesToRef(0, e.offsetX * _this._dragFactor, 0, _this._tmpDragQuaternion);\r\n _this._initialQuaternion.multiplyToRef(_this._tmpDragQuaternion, _this._initialQuaternion);\r\n }\r\n });\r\n }\r\n }\r\n });\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(DeviceOrientationCamera.prototype, \"disablePointerInputWhenUsingDeviceOrientation\", {\r\n /**\r\n * Gets or sets a boolean indicating that pointer input must be disabled on first orientation sensor update (Default: true)\r\n */\r\n get: function () {\r\n return this._disablePointerInputWhenUsingDeviceOrientation;\r\n },\r\n set: function (value) {\r\n this._disablePointerInputWhenUsingDeviceOrientation = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Enabled turning on the y axis when the orientation sensor is active\r\n * @param dragFactor the factor that controls the turn speed (default: 1/300)\r\n */\r\n DeviceOrientationCamera.prototype.enableHorizontalDragging = function (dragFactor) {\r\n if (dragFactor === void 0) { dragFactor = 1 / 300; }\r\n this._dragFactor = dragFactor;\r\n };\r\n /**\r\n * Gets the current instance class name (\"DeviceOrientationCamera\").\r\n * This helps avoiding instanceof at run time.\r\n * @returns the class name\r\n */\r\n DeviceOrientationCamera.prototype.getClassName = function () {\r\n return \"DeviceOrientationCamera\";\r\n };\r\n /**\r\n * @hidden\r\n * Checks and applies the current values of the inputs to the camera. (Internal use only)\r\n */\r\n DeviceOrientationCamera.prototype._checkInputs = function () {\r\n _super.prototype._checkInputs.call(this);\r\n this._quaternionCache.copyFrom(this.rotationQuaternion);\r\n if (this._initialQuaternion) {\r\n this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n }\r\n };\r\n /**\r\n * Reset the camera to its default orientation on the specified axis only.\r\n * @param axis The axis to reset\r\n */\r\n DeviceOrientationCamera.prototype.resetToCurrentRotation = function (axis) {\r\n var _this = this;\r\n if (axis === void 0) { axis = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y; }\r\n //can only work if this camera has a rotation quaternion already.\r\n if (!this.rotationQuaternion) {\r\n return;\r\n }\r\n if (!this._initialQuaternion) {\r\n this._initialQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._initialQuaternion.copyFrom(this._quaternionCache || this.rotationQuaternion);\r\n ['x', 'y', 'z'].forEach(function (axisName) {\r\n if (!axis[axisName]) {\r\n _this._initialQuaternion[axisName] = 0;\r\n }\r\n else {\r\n _this._initialQuaternion[axisName] *= -1;\r\n }\r\n });\r\n this._initialQuaternion.normalize();\r\n //force rotation update\r\n this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n };\r\n return DeviceOrientationCamera;\r\n}(_freeCamera__WEBPACK_IMPORTED_MODULE_1__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/flyCamera.ts\":\n/*!******************************!*\\\n !*** ./Cameras/flyCamera.ts ***!\n \\******************************/\n/*! exports provided: FlyCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return FlyCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flyCameraInputsManager */ \"./Cameras/flyCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This is a flying camera, designed for 3D movement and rotation in all directions,\r\n * such as in a 3D Space Shooter or a Flight Simulator.\r\n */\r\nvar FlyCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FlyCamera, _super);\r\n /**\r\n * Instantiates a FlyCamera.\r\n * This is a flying camera, designed for 3D movement and rotation in all directions,\r\n * such as in a 3D Space Shooter or a Flight Simulator.\r\n * @param name Define the name of the camera in the scene.\r\n * @param position Define the starting position of the camera in the scene.\r\n * @param scene Define the scene the camera belongs to.\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active, if no other camera has been defined as active.\r\n */\r\n function FlyCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful for simulating a camera body, like a player's body.\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.ellipsoid = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1, 1, 1);\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful if the camera is attached away from the player's body center,\r\n * such as at its head.\r\n */\r\n _this.ellipsoidOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n _this.applyGravity = false;\r\n /**\r\n * Define the current direction the camera is moving to.\r\n */\r\n _this.cameraDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /**\r\n * Track Roll to maintain the wanted Rolling when looking around.\r\n */\r\n _this._trackRoll = 0;\r\n /**\r\n * Slowly correct the Roll to its original value after a Pitch+Yaw rotation.\r\n */\r\n _this.rollCorrect = 100;\r\n /**\r\n * Mimic a banked turn, Rolling the camera when Yawing.\r\n * It's recommended to use rollCorrect = 10 for faster banking correction.\r\n */\r\n _this.bankedTurn = false;\r\n /**\r\n * Limit in radians for how much Roll banking will add. (Default: 90°)\r\n */\r\n _this.bankedTurnLimit = Math.PI / 2;\r\n /**\r\n * Value of 0 disables the banked Roll.\r\n * Value of 1 is equal to the Yaw angle in radians.\r\n */\r\n _this.bankedTurnMultiplier = 1;\r\n _this._needMoveForGravity = false;\r\n _this._oldPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._diffPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n // Collisions.\r\n _this._collisionMask = -1;\r\n /** @hidden */\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n var updatePosition = function (newPos) {\r\n _this._newPosition.copyFrom(newPos);\r\n _this._newPosition.subtractToRef(_this._oldPosition, _this._diffPosition);\r\n if (_this._diffPosition.length() > _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._diffPosition);\r\n if (_this.onCollide && collidedMesh) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n };\r\n updatePosition(newPosition);\r\n };\r\n _this.inputs = new _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"FlyCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouse();\r\n return _this;\r\n }\r\n Object.defineProperty(FlyCamera.prototype, \"angularSensibility\", {\r\n /**\r\n * Gets the input sensibility for mouse input.\r\n * Higher values reduce sensitivity.\r\n */\r\n get: function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n return 0;\r\n },\r\n /**\r\n * Sets the input sensibility for a mouse input.\r\n * Higher values reduce sensitivity.\r\n */\r\n set: function (value) {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysForward\", {\r\n /**\r\n * Get the keys for camera movement forward.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysForward;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement forward.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysForward = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysBackward\", {\r\n /**\r\n * Get the keys for camera movement backward.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysBackward;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysBackward = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysUp\", {\r\n /**\r\n * Get the keys for camera movement up.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement up.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysDown\", {\r\n /**\r\n * Get the keys for camera movement down.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement down.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Get the keys for camera movement left.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement left.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FlyCamera.prototype, \"keysRight\", {\r\n /**\r\n * Set the keys for camera movement right.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n /**\r\n * Set the keys for camera movement right.\r\n */\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach a control to the HTML DOM element.\r\n * @param element Defines the element that listens to the input events.\r\n * @param noPreventDefault Defines whether events caught by the controls should call preventdefault(). https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault\r\n */\r\n FlyCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n this.inputs.attachElement(element, noPreventDefault);\r\n };\r\n /**\r\n * Detach a control from the HTML DOM element.\r\n * The camera will stop reacting to that input.\r\n * @param element Defines the element that listens to the input events.\r\n */\r\n FlyCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n this.cameraDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n };\r\n Object.defineProperty(FlyCamera.prototype, \"collisionMask\", {\r\n /**\r\n * Get the mask that the camera ignores in collision events.\r\n */\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n /**\r\n * Set the mask that the camera ignores in collision events.\r\n */\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n FlyCamera.prototype._collideWithWorld = function (displacement) {\r\n var globalPosition;\r\n if (this.parent) {\r\n globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n }\r\n else {\r\n globalPosition = this.position;\r\n }\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n // No need for clone, as long as gravity is not on.\r\n var actualDisplacement = displacement;\r\n // Add gravity to direction to prevent dual-collision checking.\r\n if (this.applyGravity) {\r\n // This prevents mending with cameraDirection, a global variable of the fly camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n };\r\n /** @hidden */\r\n FlyCamera.prototype._checkInputs = function () {\r\n if (!this._localDirection) {\r\n this._localDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n this.inputs.checkInputs();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /** @hidden */\r\n FlyCamera.prototype._decideIfNeedsToMove = function () {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n FlyCamera.prototype._updatePosition = function () {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n }\r\n else {\r\n _super.prototype._updatePosition.call(this);\r\n }\r\n };\r\n /**\r\n * Restore the Roll to its target value at the rate specified.\r\n * @param rate - Higher means slower restoring.\r\n * @hidden\r\n */\r\n FlyCamera.prototype.restoreRoll = function (rate) {\r\n var limit = this._trackRoll; // Target Roll.\r\n var z = this.rotation.z; // Current Roll.\r\n var delta = limit - z; // Difference in Roll.\r\n var minRad = 0.001; // Tenth of a radian is a barely noticable difference.\r\n // If the difference is noticable, restore the Roll.\r\n if (Math.abs(delta) >= minRad) {\r\n // Change Z rotation towards the target Roll.\r\n this.rotation.z += delta / rate;\r\n // Match when near enough.\r\n if (Math.abs(limit - this.rotation.z) <= minRad) {\r\n this.rotation.z = limit;\r\n }\r\n }\r\n };\r\n /**\r\n * Destroy the camera and release the current resources held by it.\r\n */\r\n FlyCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Get the current object class name.\r\n * @returns the class name.\r\n */\r\n FlyCamera.prototype.getClassName = function () {\r\n return \"FlyCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FlyCamera.prototype, \"ellipsoid\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FlyCamera.prototype, \"ellipsoidOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCamera.prototype, \"checkCollisions\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FlyCamera.prototype, \"applyGravity\", void 0);\r\n return FlyCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/flyCameraInputsManager.ts\":\n/*!*******************************************!*\\\n !*** ./Cameras/flyCameraInputsManager.ts ***!\n \\*******************************************/\n/*! exports provided: FlyCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return FlyCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/Inputs/flyCameraMouseInput */ \"./Cameras/Inputs/flyCameraMouseInput.ts\");\n/* harmony import */ var _Cameras_Inputs_flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/Inputs/flyCameraKeyboardInput */ \"./Cameras/Inputs/flyCameraKeyboardInput.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the FlyCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FlyCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FlyCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FlyCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to.\r\n */\r\n function FlyCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the new FlyCameraKeyboardMoveInput().\r\n */\r\n FlyCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Cameras_Inputs_flyCameraKeyboardInput__WEBPACK_IMPORTED_MODULE_3__[\"FlyCameraKeyboardInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add mouse input support to the input manager.\r\n * @param touchEnabled Enable touch screen support.\r\n * @returns the new FlyCameraMouseInput().\r\n */\r\n FlyCameraInputsManager.prototype.addMouse = function (touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n this.add(new _Cameras_Inputs_flyCameraMouseInput__WEBPACK_IMPORTED_MODULE_2__[\"FlyCameraMouseInput\"](touchEnabled));\r\n return this;\r\n };\r\n return FlyCameraInputsManager;\r\n}(_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/followCamera.ts\":\n/*!*********************************!*\\\n !*** ./Cameras/followCamera.ts ***!\n \\*********************************/\n/*! exports provided: FollowCamera, ArcFollowCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return FollowCamera; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return ArcFollowCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./followCameraInputsManager */ \"./Cameras/followCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"FollowCamera\", function (name, scene) {\r\n return function () { return new FollowCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene); };\r\n});\r\n_node__WEBPACK_IMPORTED_MODULE_5__[\"Node\"].AddNodeConstructor(\"ArcFollowCamera\", function (name, scene) {\r\n return function () { return new ArcFollowCamera(name, 0, 0, 1.0, null, scene); };\r\n});\r\n/**\r\n * A follow camera takes a mesh as a target and follows it as it moves. Both a free camera version followCamera and\r\n * an arc rotate version arcFollowCamera are available.\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n */\r\nvar FollowCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FollowCamera, _super);\r\n /**\r\n * Instantiates the follow camera.\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the position of the camera\r\n * @param scene Define the scene the camera belong to\r\n * @param lockedTarget Define the target of the camera\r\n */\r\n function FollowCamera(name, position, scene, lockedTarget) {\r\n if (lockedTarget === void 0) { lockedTarget = null; }\r\n var _this = _super.call(this, name, position, scene) || this;\r\n /**\r\n * Distance the follow camera should follow an object at\r\n */\r\n _this.radius = 12;\r\n /**\r\n * Minimum allowed distance of the camera to the axis of rotation\r\n * (The camera can not get closer).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRadiusLimit = null;\r\n /**\r\n * Maximum allowed distance of the camera to the axis of rotation\r\n * (The camera can not get further).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRadiusLimit = null;\r\n /**\r\n * Define a rotation offset between the camera and the object it follows\r\n */\r\n _this.rotationOffset = 0;\r\n /**\r\n * Minimum allowed angle to camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRotationOffsetLimit = null;\r\n /**\r\n * Maximum allowed angle to camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRotationOffsetLimit = null;\r\n /**\r\n * Define a height offset between the camera and the object it follows.\r\n * It can help following an object from the top (like a car chaing a plane)\r\n */\r\n _this.heightOffset = 4;\r\n /**\r\n * Minimum allowed height of camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerHeightOffsetLimit = null;\r\n /**\r\n * Maximum allowed height of camera position relative to target object.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperHeightOffsetLimit = null;\r\n /**\r\n * Define how fast the camera can accelerate to follow it s target.\r\n */\r\n _this.cameraAcceleration = 0.05;\r\n /**\r\n * Define the speed limit of the camera following an object.\r\n */\r\n _this.maxCameraSpeed = 20;\r\n _this.lockedTarget = lockedTarget;\r\n _this.inputs = new _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_6__[\"FollowCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouseWheel().addPointers();\r\n return _this;\r\n // Uncomment the following line when the relevant handlers have been implemented.\r\n // this.inputs.addKeyboard().addMouseWheel().addPointers().addVRDeviceOrientation();\r\n }\r\n FollowCamera.prototype._follow = function (cameraTarget) {\r\n if (!cameraTarget) {\r\n return;\r\n }\r\n var yRotation;\r\n if (cameraTarget.rotationQuaternion) {\r\n var rotMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"]();\r\n cameraTarget.rotationQuaternion.toRotationMatrix(rotMatrix);\r\n yRotation = Math.atan2(rotMatrix.m[8], rotMatrix.m[10]);\r\n }\r\n else {\r\n yRotation = cameraTarget.rotation.y;\r\n }\r\n var radians = _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].ToRadians(this.rotationOffset) + yRotation;\r\n var targetPosition = cameraTarget.getAbsolutePosition();\r\n var targetX = targetPosition.x + Math.sin(radians) * this.radius;\r\n var targetZ = targetPosition.z + Math.cos(radians) * this.radius;\r\n var dx = targetX - this.position.x;\r\n var dy = (targetPosition.y + this.heightOffset) - this.position.y;\r\n var dz = (targetZ) - this.position.z;\r\n var vx = dx * this.cameraAcceleration * 2; //this is set to .05\r\n var vy = dy * this.cameraAcceleration;\r\n var vz = dz * this.cameraAcceleration * 2;\r\n if (vx > this.maxCameraSpeed || vx < -this.maxCameraSpeed) {\r\n vx = vx < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;\r\n }\r\n if (vy > this.maxCameraSpeed || vy < -this.maxCameraSpeed) {\r\n vy = vy < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;\r\n }\r\n if (vz > this.maxCameraSpeed || vz < -this.maxCameraSpeed) {\r\n vz = vz < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;\r\n }\r\n this.position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](this.position.x + vx, this.position.y + vy, this.position.z + vz);\r\n this.setTarget(targetPosition);\r\n };\r\n /**\r\n * Attached controls to the current camera.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FollowCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n this.inputs.attachElement(element, noPreventDefault);\r\n this._reset = function () {\r\n };\r\n };\r\n /**\r\n * Detach the current controls from the camera.\r\n * The camera will stop reacting to inputs.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FollowCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n if (this._reset) {\r\n this._reset();\r\n }\r\n };\r\n /** @hidden */\r\n FollowCamera.prototype._checkInputs = function () {\r\n this.inputs.checkInputs();\r\n this._checkLimits();\r\n _super.prototype._checkInputs.call(this);\r\n if (this.lockedTarget) {\r\n this._follow(this.lockedTarget);\r\n }\r\n };\r\n FollowCamera.prototype._checkLimits = function () {\r\n if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {\r\n this.radius = this.lowerRadiusLimit;\r\n }\r\n if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {\r\n this.radius = this.upperRadiusLimit;\r\n }\r\n if (this.lowerHeightOffsetLimit !== null &&\r\n this.heightOffset < this.lowerHeightOffsetLimit) {\r\n this.heightOffset = this.lowerHeightOffsetLimit;\r\n }\r\n if (this.upperHeightOffsetLimit !== null &&\r\n this.heightOffset > this.upperHeightOffsetLimit) {\r\n this.heightOffset = this.upperHeightOffsetLimit;\r\n }\r\n if (this.lowerRotationOffsetLimit !== null &&\r\n this.rotationOffset < this.lowerRotationOffsetLimit) {\r\n this.rotationOffset = this.lowerRotationOffsetLimit;\r\n }\r\n if (this.upperRotationOffsetLimit !== null &&\r\n this.rotationOffset > this.upperRotationOffsetLimit) {\r\n this.rotationOffset = this.upperRotationOffsetLimit;\r\n }\r\n };\r\n /**\r\n * Gets the camera class name.\r\n * @returns the class name\r\n */\r\n FollowCamera.prototype.getClassName = function () {\r\n return \"FollowCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"lowerRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"upperRadiusLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"rotationOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"lowerRotationOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"upperRotationOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"heightOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"lowerHeightOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"upperHeightOffsetLimit\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"cameraAcceleration\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FollowCamera.prototype, \"maxCameraSpeed\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])(\"lockedTargetId\")\r\n ], FollowCamera.prototype, \"lockedTarget\", void 0);\r\n return FollowCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_3__[\"TargetCamera\"]));\r\n\r\n/**\r\n * Arc Rotate version of the follow camera.\r\n * It still follows a Defined mesh but in an Arc Rotate Camera fashion.\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n */\r\nvar ArcFollowCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ArcFollowCamera, _super);\r\n /**\r\n * Instantiates a new ArcFollowCamera\r\n * @see http://doc.babylonjs.com/features/cameras#follow-camera\r\n * @param name Define the name of the camera\r\n * @param alpha Define the rotation angle of the camera around the logitudinal axis\r\n * @param beta Define the rotation angle of the camera around the elevation axis\r\n * @param radius Define the radius of the camera from its target point\r\n * @param target Define the target of the camera\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function ArcFollowCamera(name, \r\n /** The longitudinal angle of the camera */\r\n alpha, \r\n /** The latitudinal angle of the camera */\r\n beta, \r\n /** The radius of the camera from its target */\r\n radius, \r\n /** Define the camera target (the messh it should follow) */\r\n target, scene) {\r\n var _this = _super.call(this, name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero(), scene) || this;\r\n _this.alpha = alpha;\r\n _this.beta = beta;\r\n _this.radius = radius;\r\n _this.target = target;\r\n _this._cartesianCoordinates = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n _this._follow();\r\n return _this;\r\n }\r\n ArcFollowCamera.prototype._follow = function () {\r\n if (!this.target) {\r\n return;\r\n }\r\n this._cartesianCoordinates.x = this.radius * Math.cos(this.alpha) * Math.cos(this.beta);\r\n this._cartesianCoordinates.y = this.radius * Math.sin(this.beta);\r\n this._cartesianCoordinates.z = this.radius * Math.sin(this.alpha) * Math.cos(this.beta);\r\n var targetPosition = this.target.getAbsolutePosition();\r\n this.position = targetPosition.add(this._cartesianCoordinates);\r\n this.setTarget(targetPosition);\r\n };\r\n /** @hidden */\r\n ArcFollowCamera.prototype._checkInputs = function () {\r\n _super.prototype._checkInputs.call(this);\r\n this._follow();\r\n };\r\n /**\r\n * Returns the class name of the object.\r\n * It is mostly used internally for serialization purposes.\r\n */\r\n ArcFollowCamera.prototype.getClassName = function () {\r\n return \"ArcFollowCamera\";\r\n };\r\n return ArcFollowCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_3__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/followCameraInputsManager.ts\":\n/*!**********************************************!*\\\n !*** ./Cameras/followCameraInputsManager.ts ***!\n \\**********************************************/\n/*! exports provided: FollowCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return FollowCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Inputs_followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Inputs/followCameraKeyboardMoveInput */ \"./Cameras/Inputs/followCameraKeyboardMoveInput.ts\");\n/* harmony import */ var _Inputs_followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Inputs/followCameraMouseWheelInput */ \"./Cameras/Inputs/followCameraMouseWheelInput.ts\");\n/* harmony import */ var _Inputs_followCameraPointersInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Inputs/followCameraPointersInput */ \"./Cameras/Inputs/followCameraPointersInput.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the FollowCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FollowCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FollowCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FollowCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function FollowCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Inputs_followCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__[\"FollowCameraKeyboardMoveInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addMouseWheel = function () {\r\n this.add(new _Inputs_followCameraMouseWheelInput__WEBPACK_IMPORTED_MODULE_3__[\"FollowCameraMouseWheelInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add pointers input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addPointers = function () {\r\n this.add(new _Inputs_followCameraPointersInput__WEBPACK_IMPORTED_MODULE_4__[\"FollowCameraPointersInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add orientation input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FollowCameraInputsManager.prototype.addVRDeviceOrientation = function () {\r\n console.warn(\"DeviceOrientation support not yet implemented for FollowCamera.\");\r\n return this;\r\n };\r\n return FollowCameraInputsManager;\r\n}(_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/freeCamera.ts\":\n/*!*******************************!*\\\n !*** ./Cameras/freeCamera.ts ***!\n \\*******************************/\n/*! exports provided: FreeCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return FreeCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony import */ var _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar FreeCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FreeCamera, _super);\r\n /**\r\n * Instantiates a Free Camera.\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function FreeCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful to simulate a camera body like the player body around the camera\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.ellipsoid = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.5, 1, 0.5);\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful to determine the center of the body near the gravity center of the body\r\n * instead of its head.\r\n */\r\n _this.ellipsoidOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n _this.applyGravity = false;\r\n _this._needMoveForGravity = false;\r\n _this._oldPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._diffPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n // Collisions\r\n _this._collisionMask = -1;\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n var updatePosition = function (newPos) {\r\n _this._newPosition.copyFrom(newPos);\r\n _this._newPosition.subtractToRef(_this._oldPosition, _this._diffPosition);\r\n if (_this._diffPosition.length() > _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._diffPosition);\r\n if (_this.onCollide && collidedMesh) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n };\r\n updatePosition(newPosition);\r\n };\r\n _this.inputs = new _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"FreeCameraInputsManager\"](_this);\r\n _this.inputs.addKeyboard().addMouse();\r\n return _this;\r\n }\r\n Object.defineProperty(FreeCamera.prototype, \"angularSensibility\", {\r\n /**\r\n * Gets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n get: function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n return 0;\r\n },\r\n /**\r\n * Sets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n set: function (value) {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attached controls to the current camera.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCamera.prototype.attachControl = function (element, noPreventDefault) {\r\n this.inputs.attachElement(element, noPreventDefault);\r\n };\r\n /**\r\n * Detach the current controls from the camera.\r\n * The camera will stop reacting to inputs.\r\n * @param element Defines the element to stop listening the inputs from\r\n */\r\n FreeCamera.prototype.detachControl = function (element) {\r\n this.inputs.detachElement(element);\r\n this.cameraDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 0);\r\n this.cameraRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 0);\r\n };\r\n Object.defineProperty(FreeCamera.prototype, \"collisionMask\", {\r\n /**\r\n * Define a collision mask to limit the list of object the camera can collide with\r\n */\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n FreeCamera.prototype._collideWithWorld = function (displacement) {\r\n var globalPosition;\r\n if (this.parent) {\r\n globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n }\r\n else {\r\n globalPosition = this.position;\r\n }\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n //no need for clone, as long as gravity is not on.\r\n var actualDisplacement = displacement;\r\n //add gravity to the direction to prevent the dual-collision checking\r\n if (this.applyGravity) {\r\n //this prevents mending with cameraDirection, a global variable of the free camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._checkInputs = function () {\r\n if (!this._localDirection) {\r\n this._localDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n this.inputs.checkInputs();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._decideIfNeedsToMove = function () {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._updatePosition = function () {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n }\r\n else {\r\n _super.prototype._updatePosition.call(this);\r\n }\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n FreeCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n FreeCamera.prototype.getClassName = function () {\r\n return \"FreeCamera\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FreeCamera.prototype, \"ellipsoid\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], FreeCamera.prototype, \"ellipsoidOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCamera.prototype, \"checkCollisions\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], FreeCamera.prototype, \"applyGravity\", void 0);\r\n return FreeCamera;\r\n}(_targetCamera__WEBPACK_IMPORTED_MODULE_4__[\"TargetCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/freeCameraInputsManager.ts\":\n/*!********************************************!*\\\n !*** ./Cameras/freeCameraInputsManager.ts ***!\n \\********************************************/\n/*! exports provided: FreeCameraInputsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return FreeCameraInputsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraKeyboardMoveInput */ \"./Cameras/Inputs/freeCameraKeyboardMoveInput.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraMouseInput */ \"./Cameras/Inputs/freeCameraMouseInput.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraTouchInput */ \"./Cameras/Inputs/freeCameraTouchInput.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default Inputs manager for the FreeCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraInputsManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FreeCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FreeCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function FreeCameraInputsManager(camera) {\r\n var _this = _super.call(this, camera) || this;\r\n /**\r\n * @hidden\r\n */\r\n _this._mouseInput = null;\r\n return _this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new _Cameras_Inputs_freeCameraKeyboardMoveInput__WEBPACK_IMPORTED_MODULE_2__[\"FreeCameraKeyboardMoveInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Add mouse input support to the input manager.\r\n * @param touchEnabled if the FreeCameraMouseInput should support touch (default: true)\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addMouse = function (touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n if (!this._mouseInput) {\r\n this._mouseInput = new _Cameras_Inputs_freeCameraMouseInput__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraMouseInput\"](touchEnabled);\r\n this.add(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the mouse input support from the manager\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.removeMouse = function () {\r\n if (this._mouseInput) {\r\n this.remove(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add touch input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addTouch = function () {\r\n this.add(new _Cameras_Inputs_freeCameraTouchInput__WEBPACK_IMPORTED_MODULE_4__[\"FreeCameraTouchInput\"]());\r\n return this;\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n FreeCameraInputsManager.prototype.clear = function () {\r\n _super.prototype.clear.call(this);\r\n this._mouseInput = null;\r\n };\r\n return FreeCameraInputsManager;\r\n}(_cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/gamepadCamera.ts\":\n/*!**********************************!*\\\n !*** ./Cameras/gamepadCamera.ts ***!\n \\**********************************/\n/*! exports provided: GamepadCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return GamepadCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _universalCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"GamepadCamera\", function (name, scene) {\r\n return function () { return new GamepadCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a FPS type of camera. This is only here for back compat purpose.\r\n * Please use the UniversalCamera instead as both are identical.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar GamepadCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GamepadCamera, _super);\r\n /**\r\n * Instantiates a new Gamepad Camera\r\n * This represents a FPS type of camera. This is only here for back compat purpose.\r\n * Please use the UniversalCamera instead as both are identical.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function GamepadCamera(name, position, scene) {\r\n return _super.call(this, name, position, scene) || this;\r\n }\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n GamepadCamera.prototype.getClassName = function () {\r\n return \"GamepadCamera\";\r\n };\r\n return GamepadCamera;\r\n}(_universalCamera__WEBPACK_IMPORTED_MODULE_1__[\"UniversalCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/index.ts\":\n/*!**************************!*\\\n !*** ./Cameras/index.ts ***!\n \\**************************/\n/*! exports provided: CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Inputs_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Inputs/index */ \"./Cameras/Inputs/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraTouchInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _Inputs_index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraVirtualJoystickInput\"]; });\n\n/* harmony import */ var _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cameraInputsManager */ \"./Cameras/cameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return _cameraInputsManager__WEBPACK_IMPORTED_MODULE_1__[\"CameraInputsManager\"]; });\n\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"]; });\n\n/* harmony import */ var _targetCamera__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./targetCamera */ \"./Cameras/targetCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return _targetCamera__WEBPACK_IMPORTED_MODULE_3__[\"TargetCamera\"]; });\n\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return _freeCamera__WEBPACK_IMPORTED_MODULE_4__[\"FreeCamera\"]; });\n\n/* harmony import */ var _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return _freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"FreeCameraInputsManager\"]; });\n\n/* harmony import */ var _touchCamera__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./touchCamera */ \"./Cameras/touchCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return _touchCamera__WEBPACK_IMPORTED_MODULE_6__[\"TouchCamera\"]; });\n\n/* harmony import */ var _arcRotateCamera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return _arcRotateCamera__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCamera\"]; });\n\n/* harmony import */ var _arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return _arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_8__[\"ArcRotateCameraInputsManager\"]; });\n\n/* harmony import */ var _deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./deviceOrientationCamera */ \"./Cameras/deviceOrientationCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return _deviceOrientationCamera__WEBPACK_IMPORTED_MODULE_9__[\"DeviceOrientationCamera\"]; });\n\n/* harmony import */ var _flyCamera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flyCamera */ \"./Cameras/flyCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return _flyCamera__WEBPACK_IMPORTED_MODULE_10__[\"FlyCamera\"]; });\n\n/* harmony import */ var _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./flyCameraInputsManager */ \"./Cameras/flyCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return _flyCameraInputsManager__WEBPACK_IMPORTED_MODULE_11__[\"FlyCameraInputsManager\"]; });\n\n/* harmony import */ var _followCamera__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./followCamera */ \"./Cameras/followCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return _followCamera__WEBPACK_IMPORTED_MODULE_12__[\"FollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return _followCamera__WEBPACK_IMPORTED_MODULE_12__[\"ArcFollowCamera\"]; });\n\n/* harmony import */ var _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./followCameraInputsManager */ \"./Cameras/followCameraInputsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return _followCameraInputsManager__WEBPACK_IMPORTED_MODULE_13__[\"FollowCameraInputsManager\"]; });\n\n/* harmony import */ var _gamepadCamera__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./gamepadCamera */ \"./Cameras/gamepadCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return _gamepadCamera__WEBPACK_IMPORTED_MODULE_14__[\"GamepadCamera\"]; });\n\n/* harmony import */ var _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Stereoscopic/index */ \"./Cameras/Stereoscopic/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _Stereoscopic_index__WEBPACK_IMPORTED_MODULE_15__[\"StereoscopicUniversalCamera\"]; });\n\n/* harmony import */ var _universalCamera__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./universalCamera */ \"./Cameras/universalCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return _universalCamera__WEBPACK_IMPORTED_MODULE_16__[\"UniversalCamera\"]; });\n\n/* harmony import */ var _virtualJoysticksCamera__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./virtualJoysticksCamera */ \"./Cameras/virtualJoysticksCamera.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return _virtualJoysticksCamera__WEBPACK_IMPORTED_MODULE_17__[\"VirtualJoysticksCamera\"]; });\n\n/* harmony import */ var _VR_index__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./VR/index */ \"./Cameras/VR/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRCameraMetrics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"VRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _VR_index__WEBPACK_IMPORTED_MODULE_18__[\"WebVRFreeCamera\"]; });\n\n/* harmony import */ var _XR_index__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./XR/index */ \"./Cameras/XR/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXREnterExitUI\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _XR_index__WEBPACK_IMPORTED_MODULE_19__[\"WebXRSessionManager\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/targetCamera.ts\":\n/*!*********************************!*\\\n !*** ./Cameras/targetCamera.ts ***!\n \\*********************************/\n/*! exports provided: TargetCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return TargetCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A target camera takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see http://doc.babylonjs.com/features/cameras\r\n */\r\nvar TargetCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TargetCamera, _super);\r\n /**\r\n * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see http://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the start position of the camera in the scene\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function TargetCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the current direction the camera is moving to\r\n */\r\n _this.cameraDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Define the current rotation the camera is rotating to\r\n */\r\n _this.cameraRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 0);\r\n /**\r\n * When set, the up vector of the camera will be updated by the rotation of the camera\r\n */\r\n _this.updateUpVectorFromRotation = false;\r\n _this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n /**\r\n * Define the current rotation of the camera\r\n */\r\n _this.rotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * Define the current speed of the camera\r\n */\r\n _this.speed = 2.0;\r\n /**\r\n * Add cconstraint to the camera to prevent it to move freely in all directions and\r\n * around all axis.\r\n */\r\n _this.noRotationConstraint = false;\r\n /**\r\n * Define the current target of the camera as an object or a position.\r\n */\r\n _this.lockedTarget = null;\r\n /** @hidden */\r\n _this._currentTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n _this._initialFocalDistance = 1;\r\n /** @hidden */\r\n _this._viewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._camMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._cameraTransformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._cameraRotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n /** @hidden */\r\n _this._referencePoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1);\r\n /** @hidden */\r\n _this._transformedReferencePoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._globalCurrentTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._globalCurrentUpVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._defaultUp = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up();\r\n _this._cachedRotationZ = 0;\r\n _this._cachedQuaternionRotationZ = 0;\r\n return _this;\r\n }\r\n /**\r\n * Gets the position in front of the camera at a given distance.\r\n * @param distance The distance from the camera we want the position to be\r\n * @returns the position\r\n */\r\n TargetCamera.prototype.getFrontPosition = function (distance) {\r\n this.getWorldMatrix();\r\n var direction = this.getTarget().subtract(this.position);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n return this.globalPosition.add(direction);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getLockedTargetPosition = function () {\r\n if (!this.lockedTarget) {\r\n return null;\r\n }\r\n if (this.lockedTarget.absolutePosition) {\r\n this.lockedTarget.computeWorldMatrix();\r\n }\r\n return this.lockedTarget.absolutePosition || this.lockedTarget;\r\n };\r\n /**\r\n * Store current camera state of the camera (fov, position, rotation, etc..)\r\n * @returns the camera\r\n */\r\n TargetCamera.prototype.storeState = function () {\r\n this._storedPosition = this.position.clone();\r\n this._storedRotation = this.rotation.clone();\r\n if (this.rotationQuaternion) {\r\n this._storedRotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first\r\n * @returns whether it was successful or not\r\n * @hidden\r\n */\r\n TargetCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.position = this._storedPosition.clone();\r\n this.rotation = this._storedRotation.clone();\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = this._storedRotationQuaternion.clone();\r\n }\r\n this.cameraDirection.copyFromFloats(0, 0, 0);\r\n this.cameraRotation.copyFromFloats(0, 0);\r\n return true;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.lockedTarget = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (!lockedTargetPosition) {\r\n this._cache.lockedTarget = null;\r\n }\r\n else {\r\n if (!this._cache.lockedTarget) {\r\n this._cache.lockedTarget = lockedTargetPosition.clone();\r\n }\r\n else {\r\n this._cache.lockedTarget.copyFrom(lockedTargetPosition);\r\n }\r\n }\r\n this._cache.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n TargetCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition)\r\n && (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation));\r\n };\r\n // Methods\r\n /** @hidden */\r\n TargetCamera.prototype._computeLocalCameraSpeed = function () {\r\n var engine = this.getEngine();\r\n return this.speed * Math.sqrt((engine.getDeltaTime() / (engine.getFps() * 100.0)));\r\n };\r\n // Target\r\n /**\r\n * Defines the target the camera should look at.\r\n * @param target Defines the new target as a Vector or a mesh\r\n */\r\n TargetCamera.prototype.setTarget = function (target) {\r\n this.upVector.normalize();\r\n this._initialFocalDistance = target.subtract(this.position).length();\r\n if (this.position.z === target.z) {\r\n this.position.z += _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"];\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtLHToRef(this.position, target, this._defaultUp, this._camMatrix);\r\n this._camMatrix.invert();\r\n this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);\r\n var vDir = target.subtract(this.position);\r\n if (vDir.x >= 0.0) {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) + Math.PI / 2.0);\r\n }\r\n else {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) - Math.PI / 2.0);\r\n }\r\n this.rotation.z = 0;\r\n if (isNaN(this.rotation.x)) {\r\n this.rotation.x = 0;\r\n }\r\n if (isNaN(this.rotation.y)) {\r\n this.rotation.y = 0;\r\n }\r\n if (isNaN(this.rotation.z)) {\r\n this.rotation.z = 0;\r\n }\r\n if (this.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n };\r\n /**\r\n * Return the current target position of the camera. This value is expressed in local space.\r\n * @returns the target position\r\n */\r\n TargetCamera.prototype.getTarget = function () {\r\n return this._currentTarget;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._decideIfNeedsToMove = function () {\r\n return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updatePosition = function () {\r\n if (this.parent) {\r\n this.parent.getWorldMatrix().invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(this.cameraDirection, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0], _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0]);\r\n this.position.addInPlace(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0]);\r\n return;\r\n }\r\n this.position.addInPlace(this.cameraDirection);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._checkInputs = function () {\r\n var needToMove = this._decideIfNeedsToMove();\r\n var needToRotate = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0;\r\n // Move\r\n if (needToMove) {\r\n this._updatePosition();\r\n }\r\n // Rotate\r\n if (needToRotate) {\r\n this.rotation.x += this.cameraRotation.x;\r\n this.rotation.y += this.cameraRotation.y;\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n }\r\n if (!this.noRotationConstraint) {\r\n var limit = 1.570796;\r\n if (this.rotation.x > limit) {\r\n this.rotation.x = limit;\r\n }\r\n if (this.rotation.x < -limit) {\r\n this.rotation.x = -limit;\r\n }\r\n }\r\n }\r\n // Inertia\r\n if (needToMove) {\r\n if (Math.abs(this.cameraDirection.x) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraDirection.x = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.y) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraDirection.y = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.z) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraDirection.z = 0;\r\n }\r\n this.cameraDirection.scaleInPlace(this.inertia);\r\n }\r\n if (needToRotate) {\r\n if (Math.abs(this.cameraRotation.x) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraRotation.x = 0;\r\n }\r\n if (Math.abs(this.cameraRotation.y) < this.speed * _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"Epsilon\"]) {\r\n this.cameraRotation.y = 0;\r\n }\r\n this.cameraRotation.scaleInPlace(this.inertia);\r\n }\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n TargetCamera.prototype._updateCameraRotationMatrix = function () {\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);\r\n }\r\n };\r\n /**\r\n * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well)\r\n * @returns the current camera\r\n */\r\n TargetCamera.prototype._rotateUpVectorWithCameraRotationMatrix = function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(this._defaultUp, this._cameraRotationMatrix, this.upVector);\r\n return this;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getViewMatrix = function () {\r\n if (this.lockedTarget) {\r\n this.setTarget(this._getLockedTargetPosition());\r\n }\r\n // Compute\r\n this._updateCameraRotationMatrix();\r\n // Apply the changed rotation to the upVector\r\n if (this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedQuaternionRotationZ = this.rotationQuaternion.z;\r\n }\r\n else if (this._cachedRotationZ != this.rotation.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedRotationZ = this.rotation.z;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n if (this.updateUpVectorFromRotation) {\r\n if (this.rotationQuaternion) {\r\n _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].FromEulerVectorToRef(this.rotation, this._tmpQuaternion);\r\n _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);\r\n }\r\n }\r\n this._computeViewMatrix(this.position, this._currentTarget, this.upVector);\r\n return this._viewMatrix;\r\n };\r\n TargetCamera.prototype._computeViewMatrix = function (position, target, up) {\r\n if (this.parent) {\r\n var parentWorldMatrix = this.parent.getWorldMatrix();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(target, parentWorldMatrix, this._globalCurrentTarget);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(up, parentWorldMatrix, this._globalCurrentUpVector);\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._globalPosition.copyFrom(position);\r\n this._globalCurrentTarget.copyFrom(target);\r\n this._globalCurrentUpVector.copyFrom(up);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtRHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtLHToRef(this._globalPosition, this._globalCurrentTarget, this._globalCurrentUpVector, this._viewMatrix);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n if (this.cameraRigMode !== _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_NONE) {\r\n var rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());\r\n if (this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_VR || this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_WEBVR) {\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n }\r\n rigCamera._cameraRigParams = {};\r\n rigCamera.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n }\r\n return rigCamera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n this.computeWorldMatrix();\r\n switch (this.cameraRigMode) {\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:\r\n var leftSign = (this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;\r\n var rightSign = (this.cameraRigMode === _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);\r\n break;\r\n case _camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"].RIG_MODE_VR:\r\n if (camLeft.rotationQuaternion) {\r\n camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n else {\r\n camLeft.rotation.copyFrom(this.rotation);\r\n camRight.rotation.copyFrom(this.rotation);\r\n }\r\n camLeft.position.copyFrom(this.position);\r\n camRight.position.copyFrom(this.position);\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n TargetCamera.prototype._getRigCamPositionAndTarget = function (halfSpace, rigCamera) {\r\n var target = this.getTarget();\r\n target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);\r\n TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n var newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._TargetTransformMatrix.multiplyToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationY(halfSpace), TargetCamera._RigCamTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);\r\n rigCamera.setTarget(newFocalTarget);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n TargetCamera.prototype.getClassName = function () {\r\n return \"TargetCamera\";\r\n };\r\n TargetCamera._RigCamTransformMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n TargetCamera._TargetTransformMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n TargetCamera._TargetFocalPoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], TargetCamera.prototype, \"rotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TargetCamera.prototype, \"speed\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])(\"lockedTargetId\")\r\n ], TargetCamera.prototype, \"lockedTarget\", void 0);\r\n return TargetCamera;\r\n}(_camera__WEBPACK_IMPORTED_MODULE_2__[\"Camera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/touchCamera.ts\":\n/*!********************************!*\\\n !*** ./Cameras/touchCamera.ts ***!\n \\********************************/\n/*! exports provided: TouchCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return TouchCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"TouchCamera\", function (name, scene) {\r\n return function () { return new TouchCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a FPS type of camera controlled by touch.\r\n * This is like a universal camera minus the Gamepad controls.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar TouchCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TouchCamera, _super);\r\n /**\r\n * Instantiates a new touch camera.\r\n * This represents a FPS type of camera controlled by touch.\r\n * This is like a universal camera minus the Gamepad controls.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function TouchCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.inputs.addTouch();\r\n _this._setupInputs();\r\n return _this;\r\n }\r\n Object.defineProperty(TouchCamera.prototype, \"touchAngularSensibility\", {\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The higher the faster.\r\n */\r\n get: function () {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n return touch.touchAngularSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n touch.touchAngularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TouchCamera.prototype, \"touchMoveSensibility\", {\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The higher the faster.\r\n */\r\n get: function () {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n return touch.touchMoveSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var touch = this.inputs.attached[\"touch\"];\r\n if (touch) {\r\n touch.touchMoveSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n TouchCamera.prototype.getClassName = function () {\r\n return \"TouchCamera\";\r\n };\r\n /** @hidden */\r\n TouchCamera.prototype._setupInputs = function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.touchEnabled = false;\r\n }\r\n };\r\n return TouchCamera;\r\n}(_freeCamera__WEBPACK_IMPORTED_MODULE_1__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/universalCamera.ts\":\n/*!************************************!*\\\n !*** ./Cameras/universalCamera.ts ***!\n \\************************************/\n/*! exports provided: UniversalCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return UniversalCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _touchCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./touchCamera */ \"./Cameras/touchCamera.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _camera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Gamepads_gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Gamepads/gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_2__[\"Node\"].AddNodeConstructor(\"FreeCamera\", function (name, scene) {\r\n // Forcing to use the Universal camera\r\n return function () { return new UniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * The Universal Camera is the one to choose for first person shooter type games, and works with all the keyboard, mouse, touch and gamepads. This replaces the earlier Free Camera,\r\n * which still works and will still be found in many Playgrounds.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar UniversalCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](UniversalCamera, _super);\r\n /**\r\n * The Universal Camera is the one to choose for first person shooter type games, and works with all the keyboard, mouse, touch and gamepads. This replaces the earlier Free Camera,\r\n * which still works and will still be found in many Playgrounds.\r\n * @see http://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function UniversalCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.inputs.addGamepad();\r\n return _this;\r\n }\r\n Object.defineProperty(UniversalCamera.prototype, \"gamepadAngularSensibility\", {\r\n /**\r\n * Defines the gamepad rotation sensiblity.\r\n * This is the threshold from when rotation starts to be accounted for to prevent jittering.\r\n */\r\n get: function () {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n return gamepad.gamepadAngularSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n gamepad.gamepadAngularSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UniversalCamera.prototype, \"gamepadMoveSensibility\", {\r\n /**\r\n * Defines the gamepad move sensiblity.\r\n * This is the threshold from when moving starts to be accounted for for to prevent jittering.\r\n */\r\n get: function () {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n return gamepad.gamepadMoveSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var gamepad = this.inputs.attached[\"gamepad\"];\r\n if (gamepad) {\r\n gamepad.gamepadMoveSensibility = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n UniversalCamera.prototype.getClassName = function () {\r\n return \"UniversalCamera\";\r\n };\r\n return UniversalCamera;\r\n}(_touchCamera__WEBPACK_IMPORTED_MODULE_1__[\"TouchCamera\"]));\r\n\r\n_camera__WEBPACK_IMPORTED_MODULE_4__[\"Camera\"]._createDefaultParsedCamera = function (name, scene) {\r\n return new UniversalCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(), scene);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Cameras/virtualJoysticksCamera.ts\":\n/*!*******************************************!*\\\n !*** ./Cameras/virtualJoysticksCamera.ts ***!\n \\*******************************************/\n/*! exports provided: VirtualJoysticksCamera */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return VirtualJoysticksCamera; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _freeCamera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Inputs_freeCameraVirtualJoystickInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Inputs/freeCameraVirtualJoystickInput */ \"./Cameras/Inputs/freeCameraVirtualJoystickInput.ts\");\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"VirtualJoysticksCamera\", function (name, scene) {\r\n return function () { return new VirtualJoysticksCamera(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * It is identical to the Free Camera and simply adds by default a virtual joystick.\r\n * Virtual Joysticks are on-screen 2D graphics that are used to control the camera or other scene items.\r\n * @see http://doc.babylonjs.com/features/cameras#virtual-joysticks-camera\r\n */\r\nvar VirtualJoysticksCamera = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VirtualJoysticksCamera, _super);\r\n /**\r\n * Intantiates a VirtualJoysticksCamera. It can be useful in First Person Shooter game for instance.\r\n * It is identical to the Free Camera and simply adds by default a virtual joystick.\r\n * Virtual Joysticks are on-screen 2D graphics that are used to control the camera or other scene items.\r\n * @see http://doc.babylonjs.com/features/cameras#virtual-joysticks-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n */\r\n function VirtualJoysticksCamera(name, position, scene) {\r\n var _this = _super.call(this, name, position, scene) || this;\r\n _this.inputs.addVirtualJoystick();\r\n return _this;\r\n }\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n VirtualJoysticksCamera.prototype.getClassName = function () {\r\n return \"VirtualJoysticksCamera\";\r\n };\r\n return VirtualJoysticksCamera;\r\n}(_freeCamera__WEBPACK_IMPORTED_MODULE_1__[\"FreeCamera\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/collider.ts\":\n/*!********************************!*\\\n !*** ./Collisions/collider.ts ***!\n \\********************************/\n/*! exports provided: Collider */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return Collider; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\nvar intersectBoxAASphere = function (boxMin, boxMax, sphereCenter, sphereRadius) {\r\n if (boxMin.x > sphereCenter.x + sphereRadius) {\r\n return false;\r\n }\r\n if (sphereCenter.x - sphereRadius > boxMax.x) {\r\n return false;\r\n }\r\n if (boxMin.y > sphereCenter.y + sphereRadius) {\r\n return false;\r\n }\r\n if (sphereCenter.y - sphereRadius > boxMax.y) {\r\n return false;\r\n }\r\n if (boxMin.z > sphereCenter.z + sphereRadius) {\r\n return false;\r\n }\r\n if (sphereCenter.z - sphereRadius > boxMax.z) {\r\n return false;\r\n }\r\n return true;\r\n};\r\nvar getLowestRoot = (function () {\r\n var result = { root: 0, found: false };\r\n return function (a, b, c, maxR) {\r\n result.root = 0;\r\n result.found = false;\r\n var determinant = b * b - 4.0 * a * c;\r\n if (determinant < 0) {\r\n return result;\r\n }\r\n var sqrtD = Math.sqrt(determinant);\r\n var r1 = (-b - sqrtD) / (2.0 * a);\r\n var r2 = (-b + sqrtD) / (2.0 * a);\r\n if (r1 > r2) {\r\n var temp = r2;\r\n r2 = r1;\r\n r1 = temp;\r\n }\r\n if (r1 > 0 && r1 < maxR) {\r\n result.root = r1;\r\n result.found = true;\r\n return result;\r\n }\r\n if (r2 > 0 && r2 < maxR) {\r\n result.root = r2;\r\n result.found = true;\r\n return result;\r\n }\r\n return result;\r\n };\r\n})();\r\n/** @hidden */\r\nvar Collider = /** @class */ (function () {\r\n function Collider() {\r\n this._collisionPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._planeIntersectionPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._tempVector4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._edge = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._baseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._destinationPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._slidePlaneNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._displacementVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /** @hidden */\r\n this._radius = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].One();\r\n /** @hidden */\r\n this._retry = 0;\r\n /** @hidden */\r\n this._basePointWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._velocityWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._normalizedVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._collisionMask = -1;\r\n }\r\n Object.defineProperty(Collider.prototype, \"collisionMask\", {\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Collider.prototype, \"slidePlaneNormal\", {\r\n /**\r\n * Gets the plane normal used to compute the sliding response (in local space)\r\n */\r\n get: function () {\r\n return this._slidePlaneNormal;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /** @hidden */\r\n Collider.prototype._initialize = function (source, dir, e) {\r\n this._velocity = dir;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].NormalizeToRef(dir, this._normalizedVelocity);\r\n this._basePoint = source;\r\n source.multiplyToRef(this._radius, this._basePointWorld);\r\n dir.multiplyToRef(this._radius, this._velocityWorld);\r\n this._velocityWorldLength = this._velocityWorld.length();\r\n this._epsilon = e;\r\n this.collisionFound = false;\r\n };\r\n /** @hidden */\r\n Collider.prototype._checkPointInTriangle = function (point, pa, pb, pc, n) {\r\n pa.subtractToRef(point, this._tempVector);\r\n pb.subtractToRef(point, this._tempVector2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(this._tempVector, this._tempVector2, this._tempVector4);\r\n var d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._tempVector4, n);\r\n if (d < 0) {\r\n return false;\r\n }\r\n pc.subtractToRef(point, this._tempVector3);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4);\r\n d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._tempVector4, n);\r\n if (d < 0) {\r\n return false;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(this._tempVector3, this._tempVector, this._tempVector4);\r\n d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._tempVector4, n);\r\n return d >= 0;\r\n };\r\n /** @hidden */\r\n Collider.prototype._canDoCollision = function (sphereCenter, sphereRadius, vecMin, vecMax) {\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(this._basePointWorld, sphereCenter);\r\n var max = Math.max(this._radius.x, this._radius.y, this._radius.z);\r\n if (distance > this._velocityWorldLength + max + sphereRadius) {\r\n return false;\r\n }\r\n if (!intersectBoxAASphere(vecMin, vecMax, this._basePointWorld, this._velocityWorldLength + max)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Collider.prototype._testTriangle = function (faceIndex, trianglePlaneArray, p1, p2, p3, hasMaterial, hostMesh) {\r\n var t0;\r\n var embeddedInPlane = false;\r\n //defensive programming, actually not needed.\r\n if (!trianglePlaneArray) {\r\n trianglePlaneArray = [];\r\n }\r\n if (!trianglePlaneArray[faceIndex]) {\r\n trianglePlaneArray[faceIndex] = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"](0, 0, 0, 0);\r\n trianglePlaneArray[faceIndex].copyFromPoints(p1, p2, p3);\r\n }\r\n var trianglePlane = trianglePlaneArray[faceIndex];\r\n if ((!hasMaterial) && !trianglePlane.isFrontFacingTo(this._normalizedVelocity, 0)) {\r\n return;\r\n }\r\n var signedDistToTrianglePlane = trianglePlane.signedDistanceTo(this._basePoint);\r\n var normalDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(trianglePlane.normal, this._velocity);\r\n if (normalDotVelocity == 0) {\r\n if (Math.abs(signedDistToTrianglePlane) >= 1.0) {\r\n return;\r\n }\r\n embeddedInPlane = true;\r\n t0 = 0;\r\n }\r\n else {\r\n t0 = (-1.0 - signedDistToTrianglePlane) / normalDotVelocity;\r\n var t1 = (1.0 - signedDistToTrianglePlane) / normalDotVelocity;\r\n if (t0 > t1) {\r\n var temp = t1;\r\n t1 = t0;\r\n t0 = temp;\r\n }\r\n if (t0 > 1.0 || t1 < 0.0) {\r\n return;\r\n }\r\n if (t0 < 0) {\r\n t0 = 0;\r\n }\r\n if (t0 > 1.0) {\r\n t0 = 1.0;\r\n }\r\n }\r\n this._collisionPoint.copyFromFloats(0, 0, 0);\r\n var found = false;\r\n var t = 1.0;\r\n if (!embeddedInPlane) {\r\n this._basePoint.subtractToRef(trianglePlane.normal, this._planeIntersectionPoint);\r\n this._velocity.scaleToRef(t0, this._tempVector);\r\n this._planeIntersectionPoint.addInPlace(this._tempVector);\r\n if (this._checkPointInTriangle(this._planeIntersectionPoint, p1, p2, p3, trianglePlane.normal)) {\r\n found = true;\r\n t = t0;\r\n this._collisionPoint.copyFrom(this._planeIntersectionPoint);\r\n }\r\n }\r\n if (!found) {\r\n var velocitySquaredLength = this._velocity.lengthSquared();\r\n var a = velocitySquaredLength;\r\n this._basePoint.subtractToRef(p1, this._tempVector);\r\n var b = 2.0 * (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._tempVector));\r\n var c = this._tempVector.lengthSquared() - 1.0;\r\n var lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._collisionPoint.copyFrom(p1);\r\n }\r\n this._basePoint.subtractToRef(p2, this._tempVector);\r\n b = 2.0 * (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._tempVector));\r\n c = this._tempVector.lengthSquared() - 1.0;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._collisionPoint.copyFrom(p2);\r\n }\r\n this._basePoint.subtractToRef(p3, this._tempVector);\r\n b = 2.0 * (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._tempVector));\r\n c = this._tempVector.lengthSquared() - 1.0;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._collisionPoint.copyFrom(p3);\r\n }\r\n p2.subtractToRef(p1, this._edge);\r\n p1.subtractToRef(this._basePoint, this._baseToVertex);\r\n var edgeSquaredLength = this._edge.lengthSquared();\r\n var edgeDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._velocity);\r\n var edgeDotBaseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._baseToVertex);\r\n a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;\r\n b = edgeSquaredLength * (2.0 * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;\r\n c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n var f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;\r\n if (f >= 0.0 && f <= 1.0) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._edge.scaleInPlace(f);\r\n p1.addToRef(this._edge, this._collisionPoint);\r\n }\r\n }\r\n p3.subtractToRef(p2, this._edge);\r\n p2.subtractToRef(this._basePoint, this._baseToVertex);\r\n edgeSquaredLength = this._edge.lengthSquared();\r\n edgeDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._velocity);\r\n edgeDotBaseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._baseToVertex);\r\n a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;\r\n b = edgeSquaredLength * (2.0 * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;\r\n c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;\r\n if (f >= 0.0 && f <= 1.0) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._edge.scaleInPlace(f);\r\n p2.addToRef(this._edge, this._collisionPoint);\r\n }\r\n }\r\n p1.subtractToRef(p3, this._edge);\r\n p3.subtractToRef(this._basePoint, this._baseToVertex);\r\n edgeSquaredLength = this._edge.lengthSquared();\r\n edgeDotVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._velocity);\r\n edgeDotBaseToVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._edge, this._baseToVertex);\r\n a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;\r\n b = edgeSquaredLength * (2.0 * _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this._velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;\r\n c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;\r\n lowestRoot = getLowestRoot(a, b, c, t);\r\n if (lowestRoot.found) {\r\n f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;\r\n if (f >= 0.0 && f <= 1.0) {\r\n t = lowestRoot.root;\r\n found = true;\r\n this._edge.scaleInPlace(f);\r\n p3.addToRef(this._edge, this._collisionPoint);\r\n }\r\n }\r\n }\r\n if (found) {\r\n var distToCollision = t * this._velocity.length();\r\n if (!this.collisionFound || distToCollision < this._nearestDistance) {\r\n if (!this.intersectionPoint) {\r\n this.intersectionPoint = this._collisionPoint.clone();\r\n }\r\n else {\r\n this.intersectionPoint.copyFrom(this._collisionPoint);\r\n }\r\n this._nearestDistance = distToCollision;\r\n this.collisionFound = true;\r\n this.collidedMesh = hostMesh;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Collider.prototype._collide = function (trianglePlaneArray, pts, indices, indexStart, indexEnd, decal, hasMaterial, hostMesh) {\r\n for (var i = indexStart; i < indexEnd; i += 3) {\r\n var p1 = pts[indices[i] - decal];\r\n var p2 = pts[indices[i + 1] - decal];\r\n var p3 = pts[indices[i + 2] - decal];\r\n this._testTriangle(i, trianglePlaneArray, p3, p2, p1, hasMaterial, hostMesh);\r\n }\r\n };\r\n /** @hidden */\r\n Collider.prototype._getResponse = function (pos, vel) {\r\n pos.addToRef(vel, this._destinationPoint);\r\n vel.scaleInPlace((this._nearestDistance / vel.length()));\r\n this._basePoint.addToRef(vel, pos);\r\n pos.subtractToRef(this.intersectionPoint, this._slidePlaneNormal);\r\n this._slidePlaneNormal.normalize();\r\n this._slidePlaneNormal.scaleToRef(this._epsilon, this._displacementVector);\r\n pos.addInPlace(this._displacementVector);\r\n this.intersectionPoint.addInPlace(this._displacementVector);\r\n this._slidePlaneNormal.scaleInPlace(_Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"].SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint));\r\n this._destinationPoint.subtractInPlace(this._slidePlaneNormal);\r\n this._destinationPoint.subtractToRef(this.intersectionPoint, vel);\r\n };\r\n return Collider;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/collisionCoordinator.ts\":\n/*!********************************************!*\\\n !*** ./Collisions/collisionCoordinator.ts ***!\n \\********************************************/\n/*! exports provided: DefaultCollisionCoordinator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return DefaultCollisionCoordinator; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _collider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./collider */ \"./Collisions/collider.ts\");\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar DefaultCollisionCoordinator = /** @class */ (function () {\r\n function DefaultCollisionCoordinator() {\r\n this._scaledPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._scaledVelocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._finalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n }\r\n DefaultCollisionCoordinator.prototype.getNewPosition = function (position, displacement, collider, maximumRetry, excludedMesh, onNewPosition, collisionIndex) {\r\n position.divideToRef(collider._radius, this._scaledPosition);\r\n displacement.divideToRef(collider._radius, this._scaledVelocity);\r\n collider.collidedMesh = null;\r\n collider._retry = 0;\r\n collider._initialVelocity = this._scaledVelocity;\r\n collider._initialPosition = this._scaledPosition;\r\n this._collideWithWorld(this._scaledPosition, this._scaledVelocity, collider, maximumRetry, this._finalPosition, excludedMesh);\r\n this._finalPosition.multiplyInPlace(collider._radius);\r\n //run the callback\r\n onNewPosition(collisionIndex, this._finalPosition, collider.collidedMesh);\r\n };\r\n DefaultCollisionCoordinator.prototype.createCollider = function () {\r\n return new _collider__WEBPACK_IMPORTED_MODULE_3__[\"Collider\"]();\r\n };\r\n DefaultCollisionCoordinator.prototype.init = function (scene) {\r\n this._scene = scene;\r\n };\r\n DefaultCollisionCoordinator.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {\r\n if (excludedMesh === void 0) { excludedMesh = null; }\r\n var closeDistance = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].CollisionsEpsilon * 10.0;\r\n if (collider._retry >= maximumRetry) {\r\n finalPosition.copyFrom(position);\r\n return;\r\n }\r\n // Check if this is a mesh else camera or -1\r\n var collisionMask = (excludedMesh ? excludedMesh.collisionMask : collider.collisionMask);\r\n collider._initialize(position, velocity, closeDistance);\r\n // Check all meshes\r\n for (var index = 0; index < this._scene.meshes.length; index++) {\r\n var mesh = this._scene.meshes[index];\r\n if (mesh.isEnabled() && mesh.checkCollisions && mesh.subMeshes && mesh !== excludedMesh && ((collisionMask & mesh.collisionGroup) !== 0)) {\r\n mesh._checkCollision(collider);\r\n }\r\n }\r\n if (!collider.collisionFound) {\r\n position.addToRef(velocity, finalPosition);\r\n return;\r\n }\r\n if (velocity.x !== 0 || velocity.y !== 0 || velocity.z !== 0) {\r\n collider._getResponse(position, velocity);\r\n }\r\n if (velocity.length() <= closeDistance) {\r\n finalPosition.copyFrom(position);\r\n return;\r\n }\r\n collider._retry++;\r\n this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);\r\n };\r\n return DefaultCollisionCoordinator;\r\n}());\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].CollisionCoordinatorFactory = function () {\r\n return new DefaultCollisionCoordinator();\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/index.ts\":\n/*!*****************************!*\\\n !*** ./Collisions/index.ts ***!\n \\*****************************/\n/*! exports provided: Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _collider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./collider */ \"./Collisions/collider.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return _collider__WEBPACK_IMPORTED_MODULE_0__[\"Collider\"]; });\n\n/* harmony import */ var _collisionCoordinator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./collisionCoordinator */ \"./Collisions/collisionCoordinator.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return _collisionCoordinator__WEBPACK_IMPORTED_MODULE_1__[\"DefaultCollisionCoordinator\"]; });\n\n/* harmony import */ var _pickingInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return _pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]; });\n\n/* harmony import */ var _intersectionInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersectionInfo */ \"./Collisions/intersectionInfo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return _intersectionInfo__WEBPACK_IMPORTED_MODULE_3__[\"IntersectionInfo\"]; });\n\n/* harmony import */ var _meshCollisionData__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./meshCollisionData */ \"./Collisions/meshCollisionData.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _meshCollisionData__WEBPACK_IMPORTED_MODULE_4__[\"_MeshCollisionData\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/intersectionInfo.ts\":\n/*!****************************************!*\\\n !*** ./Collisions/intersectionInfo.ts ***!\n \\****************************************/\n/*! exports provided: IntersectionInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return IntersectionInfo; });\n/**\r\n * @hidden\r\n */\r\nvar IntersectionInfo = /** @class */ (function () {\r\n function IntersectionInfo(bu, bv, distance) {\r\n this.bu = bu;\r\n this.bv = bv;\r\n this.distance = distance;\r\n this.faceId = 0;\r\n this.subMeshId = 0;\r\n }\r\n return IntersectionInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/meshCollisionData.ts\":\n/*!*****************************************!*\\\n !*** ./Collisions/meshCollisionData.ts ***!\n \\*****************************************/\n/*! exports provided: _MeshCollisionData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _MeshCollisionData; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * @hidden\r\n */\r\nvar _MeshCollisionData = /** @class */ (function () {\r\n function _MeshCollisionData() {\r\n this._checkCollisions = false;\r\n this._collisionMask = -1;\r\n this._collisionGroup = -1;\r\n this._collider = null;\r\n this._oldPositionForCollisions = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n this._diffPositionForCollisions = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n return _MeshCollisionData;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Collisions/pickingInfo.ts\":\n/*!***********************************!*\\\n !*** ./Collisions/pickingInfo.ts ***!\n \\***********************************/\n/*! exports provided: PickingInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return PickingInfo; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n\r\n\r\n/**\r\n * Information about the result of picking within a scene\r\n * @see https://doc.babylonjs.com/babylon101/picking_collisions\r\n */\r\nvar PickingInfo = /** @class */ (function () {\r\n function PickingInfo() {\r\n /** @hidden */\r\n this._pickingUnavailable = false;\r\n /**\r\n * If the pick collided with an object\r\n */\r\n this.hit = false;\r\n /**\r\n * Distance away where the pick collided\r\n */\r\n this.distance = 0;\r\n /**\r\n * The location of pick collision\r\n */\r\n this.pickedPoint = null;\r\n /**\r\n * The mesh corresponding the the pick collision\r\n */\r\n this.pickedMesh = null;\r\n /** (See getTextureCoordinates) The barycentric U coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bu = 0;\r\n /** (See getTextureCoordinates) The barycentric V coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bv = 0;\r\n /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n this.faceId = -1;\r\n /** Id of the the submesh that was picked */\r\n this.subMeshId = 0;\r\n /** If a sprite was picked, this will be the sprite the pick collided with */\r\n this.pickedSprite = null;\r\n /**\r\n * If a mesh was used to do the picking (eg. 6dof controller) this will be populated.\r\n */\r\n this.originMesh = null;\r\n /**\r\n * The ray that was used to perform the picking.\r\n */\r\n this.ray = null;\r\n }\r\n /**\r\n * Gets the normal correspodning to the face the pick collided with\r\n * @param useWorldCoordinates If the resulting normal should be relative to the world (default: false)\r\n * @param useVerticesNormals If the vertices normals should be used to calculate the normal instead of the normal map\r\n * @returns The normal correspodning to the face the pick collided with\r\n */\r\n PickingInfo.prototype.getNormal = function (useWorldCoordinates, useVerticesNormals) {\r\n if (useWorldCoordinates === void 0) { useWorldCoordinates = false; }\r\n if (useVerticesNormals === void 0) { useVerticesNormals = true; }\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var result;\r\n if (useVerticesNormals) {\r\n var normals = this.pickedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind);\r\n var normal0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(normals, indices[this.faceId * 3] * 3);\r\n var normal1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(normals, indices[this.faceId * 3 + 1] * 3);\r\n var normal2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(normals, indices[this.faceId * 3 + 2] * 3);\r\n normal0 = normal0.scale(this.bu);\r\n normal1 = normal1.scale(this.bv);\r\n normal2 = normal2.scale(1.0 - this.bu - this.bv);\r\n result = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);\r\n }\r\n else {\r\n var positions = this.pickedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var vertex1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, indices[this.faceId * 3] * 3);\r\n var vertex2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, indices[this.faceId * 3 + 1] * 3);\r\n var vertex3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, indices[this.faceId * 3 + 2] * 3);\r\n var p1p2 = vertex1.subtract(vertex2);\r\n var p3p2 = vertex3.subtract(vertex2);\r\n result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(p1p2, p3p2);\r\n }\r\n if (useWorldCoordinates) {\r\n var wm = this.pickedMesh.getWorldMatrix();\r\n if (this.pickedMesh.nonUniformScaling) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0].copyFrom(wm);\r\n wm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n wm.setTranslationFromFloats(0, 0, 0);\r\n wm.invert();\r\n wm.transposeToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1]);\r\n wm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1];\r\n }\r\n result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(result, wm);\r\n }\r\n result.normalize();\r\n return result;\r\n };\r\n /**\r\n * Gets the texture coordinates of where the pick occured\r\n * @returns the vector containing the coordnates of the texture\r\n */\r\n PickingInfo.prototype.getTextureCoordinates = function () {\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var uvs = this.pickedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n if (!uvs) {\r\n return null;\r\n }\r\n var uv0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].FromArray(uvs, indices[this.faceId * 3] * 2);\r\n var uv1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].FromArray(uvs, indices[this.faceId * 3 + 1] * 2);\r\n var uv2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].FromArray(uvs, indices[this.faceId * 3 + 2] * 2);\r\n uv0 = uv0.scale(this.bu);\r\n uv1 = uv1.scale(this.bv);\r\n uv2 = uv2.scale(1.0 - this.bu - this.bv);\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);\r\n };\r\n return PickingInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/index.ts\":\n/*!**********************************!*\\\n !*** ./Culling/Octrees/index.ts ***!\n \\**********************************/\n/*! exports provided: Octree, OctreeBlock, OctreeSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _octree__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./octree */ \"./Culling/Octrees/octree.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _octree__WEBPACK_IMPORTED_MODULE_0__[\"Octree\"]; });\n\n/* harmony import */ var _octreeBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./octreeBlock */ \"./Culling/Octrees/octreeBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _octreeBlock__WEBPACK_IMPORTED_MODULE_1__[\"OctreeBlock\"]; });\n\n/* harmony import */ var _octreeSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./octreeSceneComponent */ \"./Culling/Octrees/octreeSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _octreeSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"OctreeSceneComponent\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/octree.ts\":\n/*!***********************************!*\\\n !*** ./Culling/Octrees/octree.ts ***!\n \\***********************************/\n/*! exports provided: Octree */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return Octree; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _octreeBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./octreeBlock */ \"./Culling/Octrees/octreeBlock.ts\");\n\r\n\r\n/**\r\n * Octrees are a really powerful data structure that can quickly select entities based on space coordinates.\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n */\r\nvar Octree = /** @class */ (function () {\r\n /**\r\n * Creates a octree\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n * @param creationFunc function to be used to instatiate the octree\r\n * @param maxBlockCapacity defines the maximum number of meshes you want on your octree's leaves (default: 64)\r\n * @param maxDepth defines the maximum depth (sub-levels) for your octree. Default value is 2, which means 8 8 8 = 512 blocks :) (This parameter takes precedence over capacity.)\r\n */\r\n function Octree(creationFunc, maxBlockCapacity, \r\n /** Defines the maximum depth (sub-levels) for your octree. Default value is 2, which means 8 8 8 = 512 blocks :) (This parameter takes precedence over capacity.) */\r\n maxDepth) {\r\n if (maxDepth === void 0) { maxDepth = 2; }\r\n this.maxDepth = maxDepth;\r\n /**\r\n * Content stored in the octree\r\n */\r\n this.dynamicContent = new Array();\r\n this._maxBlockCapacity = maxBlockCapacity || 64;\r\n this._selectionContent = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArrayNoDuplicate\"](1024);\r\n this._creationFunc = creationFunc;\r\n }\r\n // Methods\r\n /**\r\n * Updates the octree by adding blocks for the passed in meshes within the min and max world parameters\r\n * @param worldMin worldMin for the octree blocks var blockSize = new Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);\r\n * @param worldMax worldMax for the octree blocks var blockSize = new Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);\r\n * @param entries meshes to be added to the octree blocks\r\n */\r\n Octree.prototype.update = function (worldMin, worldMax, entries) {\r\n _octreeBlock__WEBPACK_IMPORTED_MODULE_1__[\"OctreeBlock\"]._CreateBlocks(worldMin, worldMax, entries, this._maxBlockCapacity, 0, this.maxDepth, this, this._creationFunc);\r\n };\r\n /**\r\n * Adds a mesh to the octree\r\n * @param entry Mesh to add to the octree\r\n */\r\n Octree.prototype.addMesh = function (entry) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.addEntry(entry);\r\n }\r\n };\r\n /**\r\n * Remove an element from the octree\r\n * @param entry defines the element to remove\r\n */\r\n Octree.prototype.removeMesh = function (entry) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.removeEntry(entry);\r\n }\r\n };\r\n /**\r\n * Selects an array of meshes within the frustum\r\n * @param frustumPlanes The frustum planes to use which will select all meshes within it\r\n * @param allowDuplicate If duplicate objects are allowed in the resulting object array\r\n * @returns array of meshes within the frustum\r\n */\r\n Octree.prototype.select = function (frustumPlanes, allowDuplicate) {\r\n this._selectionContent.reset();\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.select(frustumPlanes, this._selectionContent, allowDuplicate);\r\n }\r\n if (allowDuplicate) {\r\n this._selectionContent.concat(this.dynamicContent);\r\n }\r\n else {\r\n this._selectionContent.concatWithNoDuplicate(this.dynamicContent);\r\n }\r\n return this._selectionContent;\r\n };\r\n /**\r\n * Test if the octree intersect with the given bounding sphere and if yes, then add its content to the selection array\r\n * @param sphereCenter defines the bounding sphere center\r\n * @param sphereRadius defines the bounding sphere radius\r\n * @param allowDuplicate defines if the selection array can contains duplicated entries\r\n * @returns an array of objects that intersect the sphere\r\n */\r\n Octree.prototype.intersects = function (sphereCenter, sphereRadius, allowDuplicate) {\r\n this._selectionContent.reset();\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersects(sphereCenter, sphereRadius, this._selectionContent, allowDuplicate);\r\n }\r\n if (allowDuplicate) {\r\n this._selectionContent.concat(this.dynamicContent);\r\n }\r\n else {\r\n this._selectionContent.concatWithNoDuplicate(this.dynamicContent);\r\n }\r\n return this._selectionContent;\r\n };\r\n /**\r\n * Test if the octree intersect with the given ray and if yes, then add its content to resulting array\r\n * @param ray defines the ray to test with\r\n * @returns array of intersected objects\r\n */\r\n Octree.prototype.intersectsRay = function (ray) {\r\n this._selectionContent.reset();\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersectsRay(ray, this._selectionContent);\r\n }\r\n this._selectionContent.concatWithNoDuplicate(this.dynamicContent);\r\n return this._selectionContent;\r\n };\r\n /**\r\n * Adds a mesh into the octree block if it intersects the block\r\n */\r\n Octree.CreationFuncForMeshes = function (entry, block) {\r\n var boundingInfo = entry.getBoundingInfo();\r\n if (!entry.isBlocked && boundingInfo.boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {\r\n block.entries.push(entry);\r\n }\r\n };\r\n /**\r\n * Adds a submesh into the octree block if it intersects the block\r\n */\r\n Octree.CreationFuncForSubMeshes = function (entry, block) {\r\n var boundingInfo = entry.getBoundingInfo();\r\n if (boundingInfo.boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {\r\n block.entries.push(entry);\r\n }\r\n };\r\n return Octree;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/octreeBlock.ts\":\n/*!****************************************!*\\\n !*** ./Culling/Octrees/octreeBlock.ts ***!\n \\****************************************/\n/*! exports provided: OctreeBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return OctreeBlock; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Culling_boundingBox__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Culling/boundingBox */ \"./Culling/boundingBox.ts\");\n\r\n\r\n/**\r\n * Class used to store a cell in an octree\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n */\r\nvar OctreeBlock = /** @class */ (function () {\r\n /**\r\n * Creates a new block\r\n * @param minPoint defines the minimum vector (in world space) of the block's bounding box\r\n * @param maxPoint defines the maximum vector (in world space) of the block's bounding box\r\n * @param capacity defines the maximum capacity of this block (if capacity is reached the block will be split into sub blocks)\r\n * @param depth defines the current depth of this block in the octree\r\n * @param maxDepth defines the maximal depth allowed (beyond this value, the capacity is ignored)\r\n * @param creationFunc defines a callback to call when an element is added to the block\r\n */\r\n function OctreeBlock(minPoint, maxPoint, capacity, depth, maxDepth, creationFunc) {\r\n /**\r\n * Gets the content of the current block\r\n */\r\n this.entries = new Array();\r\n this._boundingVectors = new Array();\r\n this._capacity = capacity;\r\n this._depth = depth;\r\n this._maxDepth = maxDepth;\r\n this._creationFunc = creationFunc;\r\n this._minPoint = minPoint;\r\n this._maxPoint = maxPoint;\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors[2].x = maxPoint.x;\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors[3].y = maxPoint.y;\r\n this._boundingVectors.push(minPoint.clone());\r\n this._boundingVectors[4].z = maxPoint.z;\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors[5].z = minPoint.z;\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors[6].x = minPoint.x;\r\n this._boundingVectors.push(maxPoint.clone());\r\n this._boundingVectors[7].y = minPoint.y;\r\n }\r\n Object.defineProperty(OctreeBlock.prototype, \"capacity\", {\r\n // Property\r\n /**\r\n * Gets the maximum capacity of this block (if capacity is reached the block will be split into sub blocks)\r\n */\r\n get: function () {\r\n return this._capacity;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OctreeBlock.prototype, \"minPoint\", {\r\n /**\r\n * Gets the minimum vector (in world space) of the block's bounding box\r\n */\r\n get: function () {\r\n return this._minPoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OctreeBlock.prototype, \"maxPoint\", {\r\n /**\r\n * Gets the maximum vector (in world space) of the block's bounding box\r\n */\r\n get: function () {\r\n return this._maxPoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Add a new element to this block\r\n * @param entry defines the element to add\r\n */\r\n OctreeBlock.prototype.addEntry = function (entry) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.addEntry(entry);\r\n }\r\n return;\r\n }\r\n this._creationFunc(entry, this);\r\n if (this.entries.length > this.capacity && this._depth < this._maxDepth) {\r\n this.createInnerBlocks();\r\n }\r\n };\r\n /**\r\n * Remove an element from this block\r\n * @param entry defines the element to remove\r\n */\r\n OctreeBlock.prototype.removeEntry = function (entry) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.removeEntry(entry);\r\n }\r\n return;\r\n }\r\n var entryIndex = this.entries.indexOf(entry);\r\n if (entryIndex > -1) {\r\n this.entries.splice(entryIndex, 1);\r\n }\r\n };\r\n /**\r\n * Add an array of elements to this block\r\n * @param entries defines the array of elements to add\r\n */\r\n OctreeBlock.prototype.addEntries = function (entries) {\r\n for (var index = 0; index < entries.length; index++) {\r\n var mesh = entries[index];\r\n this.addEntry(mesh);\r\n }\r\n };\r\n /**\r\n * Test if the current block intersects the furstum planes and if yes, then add its content to the selection array\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @param selection defines the array to store current content if selection is positive\r\n * @param allowDuplicate defines if the selection array can contains duplicated entries\r\n */\r\n OctreeBlock.prototype.select = function (frustumPlanes, selection, allowDuplicate) {\r\n if (_Culling_boundingBox__WEBPACK_IMPORTED_MODULE_1__[\"BoundingBox\"].IsInFrustum(this._boundingVectors, frustumPlanes)) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.select(frustumPlanes, selection, allowDuplicate);\r\n }\r\n return;\r\n }\r\n if (allowDuplicate) {\r\n selection.concat(this.entries);\r\n }\r\n else {\r\n selection.concatWithNoDuplicate(this.entries);\r\n }\r\n }\r\n };\r\n /**\r\n * Test if the current block intersect with the given bounding sphere and if yes, then add its content to the selection array\r\n * @param sphereCenter defines the bounding sphere center\r\n * @param sphereRadius defines the bounding sphere radius\r\n * @param selection defines the array to store current content if selection is positive\r\n * @param allowDuplicate defines if the selection array can contains duplicated entries\r\n */\r\n OctreeBlock.prototype.intersects = function (sphereCenter, sphereRadius, selection, allowDuplicate) {\r\n if (_Culling_boundingBox__WEBPACK_IMPORTED_MODULE_1__[\"BoundingBox\"].IntersectsSphere(this._minPoint, this._maxPoint, sphereCenter, sphereRadius)) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersects(sphereCenter, sphereRadius, selection, allowDuplicate);\r\n }\r\n return;\r\n }\r\n if (allowDuplicate) {\r\n selection.concat(this.entries);\r\n }\r\n else {\r\n selection.concatWithNoDuplicate(this.entries);\r\n }\r\n }\r\n };\r\n /**\r\n * Test if the current block intersect with the given ray and if yes, then add its content to the selection array\r\n * @param ray defines the ray to test with\r\n * @param selection defines the array to store current content if selection is positive\r\n */\r\n OctreeBlock.prototype.intersectsRay = function (ray, selection) {\r\n if (ray.intersectsBoxMinMax(this._minPoint, this._maxPoint)) {\r\n if (this.blocks) {\r\n for (var index = 0; index < this.blocks.length; index++) {\r\n var block = this.blocks[index];\r\n block.intersectsRay(ray, selection);\r\n }\r\n return;\r\n }\r\n selection.concatWithNoDuplicate(this.entries);\r\n }\r\n };\r\n /**\r\n * Subdivide the content into child blocks (this block will then be empty)\r\n */\r\n OctreeBlock.prototype.createInnerBlocks = function () {\r\n OctreeBlock._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);\r\n };\r\n /**\r\n * @hidden\r\n */\r\n OctreeBlock._CreateBlocks = function (worldMin, worldMax, entries, maxBlockCapacity, currentDepth, maxDepth, target, creationFunc) {\r\n target.blocks = new Array();\r\n var blockSize = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);\r\n // Segmenting space\r\n for (var x = 0; x < 2; x++) {\r\n for (var y = 0; y < 2; y++) {\r\n for (var z = 0; z < 2; z++) {\r\n var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));\r\n var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));\r\n var block = new OctreeBlock(localMin, localMax, maxBlockCapacity, currentDepth + 1, maxDepth, creationFunc);\r\n block.addEntries(entries);\r\n target.blocks.push(block);\r\n }\r\n }\r\n }\r\n };\r\n return OctreeBlock;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/Octrees/octreeSceneComponent.ts\":\n/*!*************************************************!*\\\n !*** ./Culling/Octrees/octreeSceneComponent.ts ***!\n \\*************************************************/\n/*! exports provided: OctreeSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return OctreeSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _octree__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./octree */ \"./Culling/Octrees/octree.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.createOrUpdateSelectionOctree = function (maxCapacity, maxDepth) {\r\n if (maxCapacity === void 0) { maxCapacity = 64; }\r\n if (maxDepth === void 0) { maxDepth = 2; }\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OCTREE);\r\n if (!component) {\r\n component = new OctreeSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n if (!this._selectionOctree) {\r\n this._selectionOctree = new _octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"](_octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"].CreationFuncForMeshes, maxCapacity, maxDepth);\r\n }\r\n var worldExtends = this.getWorldExtends();\r\n // Update octree\r\n this._selectionOctree.update(worldExtends.min, worldExtends.max, this.meshes);\r\n return this._selectionOctree;\r\n};\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"selectionOctree\", {\r\n get: function () {\r\n return this._selectionOctree;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * This function will create an octree to help to select the right submeshes for rendering, picking and collision computations.\r\n * Please note that you must have a decent number of submeshes to get performance improvements when using an octree\r\n * @param maxCapacity defines the maximum size of each block (64 by default)\r\n * @param maxDepth defines the maximum depth to use (no more than 2 levels by default)\r\n * @returns the new octree\r\n * @see https://www.babylonjs-playground.com/#NA4OQ#12\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.createOrUpdateSubmeshesOctree = function (maxCapacity, maxDepth) {\r\n if (maxCapacity === void 0) { maxCapacity = 64; }\r\n if (maxDepth === void 0) { maxDepth = 2; }\r\n var scene = this.getScene();\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OCTREE);\r\n if (!component) {\r\n component = new OctreeSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n if (!this._submeshesOctree) {\r\n this._submeshesOctree = new _octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"](_octree__WEBPACK_IMPORTED_MODULE_5__[\"Octree\"].CreationFuncForSubMeshes, maxCapacity, maxDepth);\r\n }\r\n this.computeWorldMatrix(true);\r\n var boundingInfo = this.getBoundingInfo();\r\n // Update octree\r\n var bbox = boundingInfo.boundingBox;\r\n this._submeshesOctree.update(bbox.minimumWorld, bbox.maximumWorld, this.subMeshes);\r\n return this._submeshesOctree;\r\n};\r\n/**\r\n * Defines the octree scene component responsible to manage any octrees\r\n * in a given scene.\r\n */\r\nvar OctreeSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function OctreeSceneComponent(scene) {\r\n /**\r\n * The component name help to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OCTREE;\r\n /**\r\n * Indicates if the meshes have been checked to make sure they are isEnabled()\r\n */\r\n this.checksIsEnabled = true;\r\n this._tempRay = new _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](1, 1, 1));\r\n this.scene = scene;\r\n this.scene.getActiveMeshCandidates = this.getActiveMeshCandidates.bind(this);\r\n this.scene.getActiveSubMeshCandidates = this.getActiveSubMeshCandidates.bind(this);\r\n this.scene.getCollidingSubMeshCandidates = this.getCollidingSubMeshCandidates.bind(this);\r\n this.scene.getIntersectingSubMeshCandidates = this.getIntersectingSubMeshCandidates.bind(this);\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n OctreeSceneComponent.prototype.register = function () {\r\n var _this = this;\r\n this.scene.onMeshRemovedObservable.add(function (mesh) {\r\n var sceneOctree = _this.scene.selectionOctree;\r\n if (sceneOctree !== undefined && sceneOctree !== null) {\r\n var index = sceneOctree.dynamicContent.indexOf(mesh);\r\n if (index !== -1) {\r\n sceneOctree.dynamicContent.splice(index, 1);\r\n }\r\n }\r\n });\r\n this.scene.onMeshImportedObservable.add(function (mesh) {\r\n var sceneOctree = _this.scene.selectionOctree;\r\n if (sceneOctree !== undefined && sceneOctree !== null) {\r\n sceneOctree.addMesh(mesh);\r\n }\r\n });\r\n };\r\n /**\r\n * Return the list of active meshes\r\n * @returns the list of active meshes\r\n */\r\n OctreeSceneComponent.prototype.getActiveMeshCandidates = function () {\r\n if (this.scene._selectionOctree) {\r\n var selection = this.scene._selectionOctree.select(this.scene.frustumPlanes);\r\n return selection;\r\n }\r\n return this.scene._getDefaultMeshCandidates();\r\n };\r\n /**\r\n * Return the list of active sub meshes\r\n * @param mesh The mesh to get the candidates sub meshes from\r\n * @returns the list of active sub meshes\r\n */\r\n OctreeSceneComponent.prototype.getActiveSubMeshCandidates = function (mesh) {\r\n if (mesh._submeshesOctree && mesh.useOctreeForRenderingSelection) {\r\n var intersections = mesh._submeshesOctree.select(this.scene.frustumPlanes);\r\n return intersections;\r\n }\r\n return this.scene._getDefaultSubMeshCandidates(mesh);\r\n };\r\n /**\r\n * Return the list of sub meshes intersecting with a given local ray\r\n * @param mesh defines the mesh to find the submesh for\r\n * @param localRay defines the ray in local space\r\n * @returns the list of intersecting sub meshes\r\n */\r\n OctreeSceneComponent.prototype.getIntersectingSubMeshCandidates = function (mesh, localRay) {\r\n if (mesh._submeshesOctree && mesh.useOctreeForPicking) {\r\n _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"].TransformToRef(localRay, mesh.getWorldMatrix(), this._tempRay);\r\n var intersections = mesh._submeshesOctree.intersectsRay(this._tempRay);\r\n return intersections;\r\n }\r\n return this.scene._getDefaultSubMeshCandidates(mesh);\r\n };\r\n /**\r\n * Return the list of sub meshes colliding with a collider\r\n * @param mesh defines the mesh to find the submesh for\r\n * @param collider defines the collider to evaluate the collision against\r\n * @returns the list of colliding sub meshes\r\n */\r\n OctreeSceneComponent.prototype.getCollidingSubMeshCandidates = function (mesh, collider) {\r\n if (mesh._submeshesOctree && mesh.useOctreeForCollisions) {\r\n var radius = collider._velocityWorldLength + Math.max(collider._radius.x, collider._radius.y, collider._radius.z);\r\n var intersections = mesh._submeshesOctree.intersects(collider._basePointWorld, radius);\r\n return intersections;\r\n }\r\n return this.scene._getDefaultSubMeshCandidates(mesh);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n OctreeSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n OctreeSceneComponent.prototype.dispose = function () {\r\n // Nothing to do here.\r\n };\r\n return OctreeSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/boundingBox.ts\":\n/*!********************************!*\\\n !*** ./Culling/boundingBox.ts ***!\n \\********************************/\n/*! exports provided: BoundingBox */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return BoundingBox; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to store bounding box information\r\n */\r\nvar BoundingBox = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding box\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingBox(min, max, worldMatrix) {\r\n /**\r\n * Gets the 8 vectors representing the bounding box in local space\r\n */\r\n this.vectors = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(8, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n /**\r\n * Gets the center of the bounding box in local space\r\n */\r\n this.center = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the center of the bounding box in world space\r\n */\r\n this.centerWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the extend size in local space\r\n */\r\n this.extendSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the extend size in world space\r\n */\r\n this.extendSizeWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the OBB (object bounding box) directions\r\n */\r\n this.directions = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n /**\r\n * Gets the 8 vectors representing the bounding box in world space\r\n */\r\n this.vectorsWorld = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(8, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n /**\r\n * Gets the minimum vector in world space\r\n */\r\n this.minimumWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the maximum vector in world space\r\n */\r\n this.maximumWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n // Methods\r\n /**\r\n * Recreates the entire bounding box from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingBox.prototype.reConstruct = function (min, max, worldMatrix) {\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var vectors = this.vectors;\r\n this.minimum.copyFromFloats(minX, minY, minZ);\r\n this.maximum.copyFromFloats(maxX, maxY, maxZ);\r\n vectors[0].copyFromFloats(minX, minY, minZ);\r\n vectors[1].copyFromFloats(maxX, maxY, maxZ);\r\n vectors[2].copyFromFloats(maxX, minY, minZ);\r\n vectors[3].copyFromFloats(minX, maxY, minZ);\r\n vectors[4].copyFromFloats(minX, minY, maxZ);\r\n vectors[5].copyFromFloats(maxX, maxY, minZ);\r\n vectors[6].copyFromFloats(minX, maxY, maxZ);\r\n vectors[7].copyFromFloats(maxX, minY, maxZ);\r\n // OBB\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);\r\n this._worldMatrix = worldMatrix || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly;\r\n this._update(this._worldMatrix);\r\n };\r\n /**\r\n * Scale the current bounding box by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingBox.prototype.scale = function (factor) {\r\n var tmpVectors = BoundingBox.TmpVector3;\r\n var diff = this.maximum.subtractToRef(this.minimum, tmpVectors[0]);\r\n var len = diff.length();\r\n diff.normalizeFromLength(len);\r\n var distance = len * factor;\r\n var newRadius = diff.scaleInPlace(distance * 0.5);\r\n var min = this.center.subtractToRef(newRadius, tmpVectors[1]);\r\n var max = this.center.addToRef(newRadius, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingBox.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n BoundingBox.prototype._update = function (world) {\r\n var minWorld = this.minimumWorld;\r\n var maxWorld = this.maximumWorld;\r\n var directions = this.directions;\r\n var vectorsWorld = this.vectorsWorld;\r\n var vectors = this.vectors;\r\n if (!world.isIdentity()) {\r\n minWorld.setAll(Number.MAX_VALUE);\r\n maxWorld.setAll(-Number.MAX_VALUE);\r\n for (var index = 0; index < 8; ++index) {\r\n var v = vectorsWorld[index];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(vectors[index], world, v);\r\n minWorld.minimizeInPlace(v);\r\n maxWorld.maximizeInPlace(v);\r\n }\r\n // Extend\r\n maxWorld.subtractToRef(minWorld, this.extendSizeWorld).scaleInPlace(0.5);\r\n maxWorld.addToRef(minWorld, this.centerWorld).scaleInPlace(0.5);\r\n }\r\n else {\r\n minWorld.copyFrom(this.minimum);\r\n maxWorld.copyFrom(this.maximum);\r\n for (var index = 0; index < 8; ++index) {\r\n vectorsWorld[index].copyFrom(vectors[index]);\r\n }\r\n // Extend\r\n this.extendSizeWorld.copyFrom(this.extendSize);\r\n this.centerWorld.copyFrom(this.center);\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(world.m, 0, directions[0]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(world.m, 4, directions[1]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(world.m, 8, directions[2]);\r\n this._worldMatrix = world;\r\n };\r\n /**\r\n * Tests if the bounding box is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.isInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if the bounding box is entirely inside the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an inclusion\r\n */\r\n BoundingBox.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if a point is inside the bounding box\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding box\r\n */\r\n BoundingBox.prototype.intersectsPoint = function (point) {\r\n var min = this.minimumWorld;\r\n var max = this.maximumWorld;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var pointX = point.x, pointY = point.y, pointZ = point.z;\r\n var delta = -_Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"];\r\n if (maxX - pointX < delta || delta > pointX - minX) {\r\n return false;\r\n }\r\n if (maxY - pointY < delta || delta > pointY - minY) {\r\n return false;\r\n }\r\n if (maxZ - pointZ < delta || delta > pointZ - minZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a bounding sphere\r\n * @param sphere defines the sphere to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsSphere = function (sphere) {\r\n return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, sphere.radiusWorld);\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a box defined by a min and max vectors\r\n * @param min defines the min vector to use\r\n * @param max defines the max vector to use\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsMinMax = function (min, max) {\r\n var myMin = this.minimumWorld;\r\n var myMax = this.maximumWorld;\r\n var myMinX = myMin.x, myMinY = myMin.y, myMinZ = myMin.z, myMaxX = myMax.x, myMaxY = myMax.y, myMaxZ = myMax.z;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n if (myMaxX < minX || myMinX > maxX) {\r\n return false;\r\n }\r\n if (myMaxY < minY || myMinY > maxY) {\r\n return false;\r\n }\r\n if (myMaxZ < minZ || myMinZ > maxZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Tests if two bounding boxes are intersections\r\n * @param box0 defines the first box to test\r\n * @param box1 defines the second box to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.Intersects = function (box0, box1) {\r\n return box0.intersectsMinMax(box1.minimumWorld, box1.maximumWorld);\r\n };\r\n /**\r\n * Tests if a bounding box defines by a min/max vectors intersects a sphere\r\n * @param minPoint defines the minimum vector of the bounding box\r\n * @param maxPoint defines the maximum vector of the bounding box\r\n * @param sphereCenter defines the sphere center\r\n * @param sphereRadius defines the sphere radius\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.IntersectsSphere = function (minPoint, maxPoint, sphereCenter, sphereRadius) {\r\n var vector = BoundingBox.TmpVector3[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].ClampToRef(sphereCenter, minPoint, maxPoint, vector);\r\n var num = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(sphereCenter, vector);\r\n return (num <= (sphereRadius * sphereRadius));\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors is entirely inside frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an inclusion\r\n */\r\n BoundingBox.IsCompletelyInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors intersects frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an intersection\r\n */\r\n BoundingBox.IsInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var canReturnFalse = true;\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) >= 0) {\r\n canReturnFalse = false;\r\n break;\r\n }\r\n }\r\n if (canReturnFalse) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n BoundingBox.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n return BoundingBox;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/boundingInfo.ts\":\n/*!*********************************!*\\\n !*** ./Culling/boundingInfo.ts ***!\n \\*********************************/\n/*! exports provided: BoundingInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return BoundingInfo; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _boundingBox__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./boundingBox */ \"./Culling/boundingBox.ts\");\n/* harmony import */ var _boundingSphere__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boundingSphere */ \"./Culling/boundingSphere.ts\");\n\r\n\r\n\r\n\r\n\r\nvar _result0 = { min: 0, max: 0 };\r\nvar _result1 = { min: 0, max: 0 };\r\nvar computeBoxExtents = function (axis, box, result) {\r\n var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.centerWorld, axis);\r\n var r0 = Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.directions[0], axis)) * box.extendSize.x;\r\n var r1 = Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.directions[1], axis)) * box.extendSize.y;\r\n var r2 = Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(box.directions[2], axis)) * box.extendSize.z;\r\n var r = r0 + r1 + r2;\r\n result.min = p - r;\r\n result.max = p + r;\r\n};\r\nvar axisOverlap = function (axis, box0, box1) {\r\n computeBoxExtents(axis, box0, _result0);\r\n computeBoxExtents(axis, box1, _result1);\r\n return !(_result0.min > _result1.max || _result1.min > _result0.max);\r\n};\r\n/**\r\n * Info for a bounding data of a mesh\r\n */\r\nvar BoundingInfo = /** @class */ (function () {\r\n /**\r\n * Constructs bounding info\r\n * @param minimum min vector of the bounding box/sphere\r\n * @param maximum max vector of the bounding box/sphere\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingInfo(minimum, maximum, worldMatrix) {\r\n this._isLocked = false;\r\n this.boundingBox = new _boundingBox__WEBPACK_IMPORTED_MODULE_3__[\"BoundingBox\"](minimum, maximum, worldMatrix);\r\n this.boundingSphere = new _boundingSphere__WEBPACK_IMPORTED_MODULE_4__[\"BoundingSphere\"](minimum, maximum, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding info from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingInfo.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.boundingBox.reConstruct(min, max, worldMatrix);\r\n this.boundingSphere.reConstruct(min, max, worldMatrix);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"minimum\", {\r\n /**\r\n * min vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.minimum;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"maximum\", {\r\n /**\r\n * max vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.maximum;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"isLocked\", {\r\n /**\r\n * If the info is locked and won't be updated to avoid perf overhead\r\n */\r\n get: function () {\r\n return this._isLocked;\r\n },\r\n set: function (value) {\r\n this._isLocked = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Updates the bounding sphere and box\r\n * @param world world matrix to be used to update\r\n */\r\n BoundingInfo.prototype.update = function (world) {\r\n if (this._isLocked) {\r\n return;\r\n }\r\n this.boundingBox._update(world);\r\n this.boundingSphere._update(world);\r\n };\r\n /**\r\n * Recreate the bounding info to be centered around a specific point given a specific extend.\r\n * @param center New center of the bounding info\r\n * @param extend New extend of the bounding info\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.centerOn = function (center, extend) {\r\n var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);\r\n var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);\r\n this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n return this;\r\n };\r\n /**\r\n * Scale the current bounding info by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.scale = function (factor) {\r\n this.boundingBox.scale(factor);\r\n this.boundingSphere.scale(factor);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the bounding info is within the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum to test\r\n * @param strategy defines the strategy to use for the culling (default is BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD)\r\n * @returns true if the bounding info is in the frustum planes\r\n */\r\n BoundingInfo.prototype.isInFrustum = function (frustumPlanes, strategy) {\r\n if (strategy === void 0) { strategy = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_STANDARD; }\r\n var inclusionTest = (strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION || strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY);\r\n if (inclusionTest) {\r\n if (this.boundingSphere.isCenterInFrustum(frustumPlanes)) {\r\n return true;\r\n }\r\n }\r\n if (!this.boundingSphere.isInFrustum(frustumPlanes)) {\r\n return false;\r\n }\r\n var bSphereOnlyTest = (strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY || strategy === _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY);\r\n if (bSphereOnlyTest) {\r\n return true;\r\n }\r\n return this.boundingBox.isInFrustum(frustumPlanes);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"diagonalLength\", {\r\n /**\r\n * Gets the world distance between the min and max points of the bounding box\r\n */\r\n get: function () {\r\n var boundingBox = this.boundingBox;\r\n var diag = boundingBox.maximumWorld.subtractToRef(boundingBox.minimumWorld, BoundingInfo.TmpVector3[0]);\r\n return diag.length();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param frustumPlanes Camera near/planes\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n BoundingInfo.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this.boundingBox.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /** @hidden */\r\n BoundingInfo.prototype._checkCollision = function (collider) {\r\n return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);\r\n };\r\n /**\r\n * Checks if a point is inside the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param point the point to check intersection with\r\n * @returns if the point intersects\r\n */\r\n BoundingInfo.prototype.intersectsPoint = function (point) {\r\n if (!this.boundingSphere.centerWorld) {\r\n return false;\r\n }\r\n if (!this.boundingSphere.intersectsPoint(point)) {\r\n return false;\r\n }\r\n if (!this.boundingBox.intersectsPoint(point)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if another bounding info intersects the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param boundingInfo the bounding info to check intersection with\r\n * @param precise if the intersection should be done using OBB\r\n * @returns if the bounding info intersects\r\n */\r\n BoundingInfo.prototype.intersects = function (boundingInfo, precise) {\r\n if (!_boundingSphere__WEBPACK_IMPORTED_MODULE_4__[\"BoundingSphere\"].Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {\r\n return false;\r\n }\r\n if (!_boundingBox__WEBPACK_IMPORTED_MODULE_3__[\"BoundingBox\"].Intersects(this.boundingBox, boundingInfo.boundingBox)) {\r\n return false;\r\n }\r\n if (!precise) {\r\n return true;\r\n }\r\n var box0 = this.boundingBox;\r\n var box1 = boundingInfo.boundingBox;\r\n if (!axisOverlap(box0.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[0], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[0], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[0], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[1], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[1], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[1], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[2], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[2], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(box0.directions[2], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingInfo.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(2, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n return BoundingInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/boundingSphere.ts\":\n/*!***********************************!*\\\n !*** ./Culling/boundingSphere.ts ***!\n \\***********************************/\n/*! exports provided: BoundingSphere */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return BoundingSphere; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n/**\r\n * Class used to store bounding sphere information\r\n */\r\nvar BoundingSphere = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding sphere\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingSphere(min, max, worldMatrix) {\r\n /**\r\n * Gets the center of the bounding sphere in local space\r\n */\r\n this.center = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the center of the bounding sphere in world space\r\n */\r\n this.centerWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding sphere from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingSphere.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.minimum.copyFrom(min);\r\n this.maximum.copyFrom(max);\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Distance(min, max);\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n this.radius = distance * 0.5;\r\n this._update(worldMatrix || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly);\r\n };\r\n /**\r\n * Scale the current bounding sphere by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingSphere.prototype.scale = function (factor) {\r\n var newRadius = this.radius * factor;\r\n var tmpVectors = BoundingSphere.TmpVector3;\r\n var tempRadiusVector = tmpVectors[0].setAll(newRadius);\r\n var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);\r\n var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingSphere.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n // Methods\r\n /** @hidden */\r\n BoundingSphere.prototype._update = function (worldMatrix) {\r\n if (!worldMatrix.isIdentity()) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(this.center, worldMatrix, this.centerWorld);\r\n var tempVector = BoundingSphere.TmpVector3[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, worldMatrix, tempVector);\r\n this.radiusWorld = Math.max(Math.abs(tempVector.x), Math.abs(tempVector.y), Math.abs(tempVector.z)) * this.radius;\r\n }\r\n else {\r\n this.centerWorld.copyFrom(this.center);\r\n this.radiusWorld = this.radius;\r\n }\r\n };\r\n /**\r\n * Tests if the bounding sphere is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n var radius = this.radiusWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) <= -radius) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding sphere center is in between the frustum planes.\r\n * Used for optimistic fast inclusion.\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if the sphere center is in between the frustum planes\r\n */\r\n BoundingSphere.prototype.isCenterInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) < 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a point is inside the bounding sphere\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding sphere\r\n */\r\n BoundingSphere.prototype.intersectsPoint = function (point) {\r\n var squareDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(this.centerWorld, point);\r\n if (this.radiusWorld * this.radiusWorld < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Checks if two sphere intersct\r\n * @param sphere0 sphere 0\r\n * @param sphere1 sphere 1\r\n * @returns true if the speres intersect\r\n */\r\n BoundingSphere.Intersects = function (sphere0, sphere1) {\r\n var squareDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(sphere0.centerWorld, sphere1.centerWorld);\r\n var radiusSum = sphere0.radiusWorld + sphere1.radiusWorld;\r\n if (radiusSum * radiusSum < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingSphere.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n return BoundingSphere;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/index.ts\":\n/*!**************************!*\\\n !*** ./Culling/index.ts ***!\n \\**************************/\n/*! exports provided: BoundingBox, BoundingInfo, BoundingSphere, Ray, Octree, OctreeBlock, OctreeSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boundingBox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boundingBox */ \"./Culling/boundingBox.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return _boundingBox__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBox\"]; });\n\n/* harmony import */ var _boundingInfo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return _boundingInfo__WEBPACK_IMPORTED_MODULE_1__[\"BoundingInfo\"]; });\n\n/* harmony import */ var _boundingSphere__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boundingSphere */ \"./Culling/boundingSphere.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return _boundingSphere__WEBPACK_IMPORTED_MODULE_2__[\"BoundingSphere\"]; });\n\n/* harmony import */ var _Octrees_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Octrees/index */ \"./Culling/Octrees/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _Octrees_index__WEBPACK_IMPORTED_MODULE_3__[\"Octree\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _Octrees_index__WEBPACK_IMPORTED_MODULE_3__[\"OctreeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _Octrees_index__WEBPACK_IMPORTED_MODULE_3__[\"OctreeSceneComponent\"]; });\n\n/* harmony import */ var _ray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ray */ \"./Culling/ray.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return _ray__WEBPACK_IMPORTED_MODULE_4__[\"Ray\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Culling/ray.ts\":\n/*!************************!*\\\n !*** ./Culling/ray.ts ***!\n \\************************/\n/*! exports provided: Ray */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return Ray; });\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Collisions/intersectionInfo */ \"./Collisions/intersectionInfo.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Cameras/camera */ \"./Cameras/camera.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class representing a ray with position and direction\r\n */\r\nvar Ray = /** @class */ (function () {\r\n /**\r\n * Creates a new ray\r\n * @param origin origin point\r\n * @param direction direction\r\n * @param length length of the ray\r\n */\r\n function Ray(\r\n /** origin point */\r\n origin, \r\n /** direction */\r\n direction, \r\n /** length of the ray */\r\n length) {\r\n if (length === void 0) { length = Number.MAX_VALUE; }\r\n this.origin = origin;\r\n this.direction = direction;\r\n this.length = length;\r\n }\r\n // Methods\r\n /**\r\n * Checks if the ray intersects a box\r\n * @param minimum bound of the box\r\n * @param maximum bound of the box\r\n * @param intersectionTreshold extra extend to be added to the box in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBoxMinMax = function (minimum, maximum, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var newMinimum = Ray.TmpVector3[0].copyFromFloats(minimum.x - intersectionTreshold, minimum.y - intersectionTreshold, minimum.z - intersectionTreshold);\r\n var newMaximum = Ray.TmpVector3[1].copyFromFloats(maximum.x + intersectionTreshold, maximum.y + intersectionTreshold, maximum.z + intersectionTreshold);\r\n var d = 0.0;\r\n var maxValue = Number.MAX_VALUE;\r\n var inv;\r\n var min;\r\n var max;\r\n var temp;\r\n if (Math.abs(this.direction.x) < 0.0000001) {\r\n if (this.origin.x < newMinimum.x || this.origin.x > newMaximum.x) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.x;\r\n min = (newMinimum.x - this.origin.x) * inv;\r\n max = (newMaximum.x - this.origin.x) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.y) < 0.0000001) {\r\n if (this.origin.y < newMinimum.y || this.origin.y > newMaximum.y) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.y;\r\n min = (newMinimum.y - this.origin.y) * inv;\r\n max = (newMaximum.y - this.origin.y) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.z) < 0.0000001) {\r\n if (this.origin.z < newMinimum.z || this.origin.z > newMaximum.z) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.z;\r\n min = (newMinimum.z - this.origin.z) * inv;\r\n max = (newMaximum.z - this.origin.z) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if the ray intersects a box\r\n * @param box the bounding box to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingBox in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBox = function (box, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n return this.intersectsBoxMinMax(box.minimum, box.maximum, intersectionTreshold);\r\n };\r\n /**\r\n * If the ray hits a sphere\r\n * @param sphere the bounding sphere to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingSphere in all direction\r\n * @returns true if it hits the sphere\r\n */\r\n Ray.prototype.intersectsSphere = function (sphere, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var x = sphere.center.x - this.origin.x;\r\n var y = sphere.center.y - this.origin.y;\r\n var z = sphere.center.z - this.origin.z;\r\n var pyth = (x * x) + (y * y) + (z * z);\r\n var radius = sphere.radius + intersectionTreshold;\r\n var rr = radius * radius;\r\n if (pyth <= rr) {\r\n return true;\r\n }\r\n var dot = (x * this.direction.x) + (y * this.direction.y) + (z * this.direction.z);\r\n if (dot < 0.0) {\r\n return false;\r\n }\r\n var temp = pyth - (dot * dot);\r\n return temp <= rr;\r\n };\r\n /**\r\n * If the ray hits a triange\r\n * @param vertex0 triangle vertex\r\n * @param vertex1 triangle vertex\r\n * @param vertex2 triangle vertex\r\n * @returns intersection information if hit\r\n */\r\n Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {\r\n var edge1 = Ray.TmpVector3[0];\r\n var edge2 = Ray.TmpVector3[1];\r\n var pvec = Ray.TmpVector3[2];\r\n var tvec = Ray.TmpVector3[3];\r\n var qvec = Ray.TmpVector3[4];\r\n vertex1.subtractToRef(vertex0, edge1);\r\n vertex2.subtractToRef(vertex0, edge2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(this.direction, edge2, pvec);\r\n var det = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(edge1, pvec);\r\n if (det === 0) {\r\n return null;\r\n }\r\n var invdet = 1 / det;\r\n this.origin.subtractToRef(vertex0, tvec);\r\n var bv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(tvec, pvec) * invdet;\r\n if (bv < 0 || bv > 1.0) {\r\n return null;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(tvec, edge1, qvec);\r\n var bw = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(this.direction, qvec) * invdet;\r\n if (bw < 0 || bv + bw > 1.0) {\r\n return null;\r\n }\r\n //check if the distance is longer than the predefined length.\r\n var distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(edge2, qvec) * invdet;\r\n if (distance > this.length) {\r\n return null;\r\n }\r\n return new _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_3__[\"IntersectionInfo\"](1 - bv - bw, bv, distance);\r\n };\r\n /**\r\n * Checks if ray intersects a plane\r\n * @param plane the plane to check\r\n * @returns the distance away it was hit\r\n */\r\n Ray.prototype.intersectsPlane = function (plane) {\r\n var distance;\r\n var result1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(plane.normal, this.direction);\r\n if (Math.abs(result1) < 9.99999997475243E-07) {\r\n return null;\r\n }\r\n else {\r\n var result2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(plane.normal, this.origin);\r\n distance = (-plane.d - result2) / result1;\r\n if (distance < 0.0) {\r\n if (distance < -9.99999997475243E-07) {\r\n return null;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n return distance;\r\n }\r\n };\r\n /**\r\n * Calculate the intercept of a ray on a given axis\r\n * @param axis to check 'x' | 'y' | 'z'\r\n * @param offset from axis interception (i.e. an offset of 1y is intercepted above ground)\r\n * @returns a vector containing the coordinates where 'axis' is equal to zero (else offset), or null if there is no intercept.\r\n */\r\n Ray.prototype.intersectsAxis = function (axis, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n switch (axis) {\r\n case 'y':\r\n var t = (this.origin.y - offset) / this.direction.y;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](this.origin.x + (this.direction.x * -t), offset, this.origin.z + (this.direction.z * -t));\r\n case 'x':\r\n var t = (this.origin.x - offset) / this.direction.x;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](offset, this.origin.y + (this.direction.y * -t), this.origin.z + (this.direction.z * -t));\r\n case 'z':\r\n var t = (this.origin.z - offset) / this.direction.z;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](this.origin.x + (this.direction.x * -t), this.origin.y + (this.direction.y * -t), offset);\r\n default:\r\n return null;\r\n }\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param mesh the mesh to check\r\n * @param fastCheck if only the bounding box should checked\r\n * @returns picking info of the intersecton\r\n */\r\n Ray.prototype.intersectsMesh = function (mesh, fastCheck) {\r\n var tm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0];\r\n mesh.getWorldMatrix().invertToRef(tm);\r\n if (this._tmpRay) {\r\n Ray.TransformToRef(this, tm, this._tmpRay);\r\n }\r\n else {\r\n this._tmpRay = Ray.Transform(this, tm);\r\n }\r\n return mesh.intersects(this._tmpRay, fastCheck);\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param meshes the meshes to check\r\n * @param fastCheck if only the bounding box should checked\r\n * @param results array to store result in\r\n * @returns Array of picking infos\r\n */\r\n Ray.prototype.intersectsMeshes = function (meshes, fastCheck, results) {\r\n if (results) {\r\n results.length = 0;\r\n }\r\n else {\r\n results = [];\r\n }\r\n for (var i = 0; i < meshes.length; i++) {\r\n var pickInfo = this.intersectsMesh(meshes[i], fastCheck);\r\n if (pickInfo.hit) {\r\n results.push(pickInfo);\r\n }\r\n }\r\n results.sort(this._comparePickingInfo);\r\n return results;\r\n };\r\n Ray.prototype._comparePickingInfo = function (pickingInfoA, pickingInfoB) {\r\n if (pickingInfoA.distance < pickingInfoB.distance) {\r\n return -1;\r\n }\r\n else if (pickingInfoA.distance > pickingInfoB.distance) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Intersection test between the ray and a given segment whithin a given tolerance (threshold)\r\n * @param sega the first point of the segment to test the intersection against\r\n * @param segb the second point of the segment to test the intersection against\r\n * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful\r\n * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection\r\n */\r\n Ray.prototype.intersectionSegment = function (sega, segb, threshold) {\r\n var o = this.origin;\r\n var u = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[0];\r\n var rsegb = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[1];\r\n var v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[2];\r\n var w = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[3];\r\n segb.subtractToRef(sega, u);\r\n this.direction.scaleToRef(Ray.rayl, v);\r\n o.addToRef(v, rsegb);\r\n sega.subtractToRef(o, w);\r\n var a = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(u, u); // always >= 0\r\n var b = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(u, v);\r\n var c = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(v, v); // always >= 0\r\n var d = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(u, w);\r\n var e = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(v, w);\r\n var D = a * c - b * b; // always >= 0\r\n var sc, sN, sD = D; // sc = sN / sD, default sD = D >= 0\r\n var tc, tN, tD = D; // tc = tN / tD, default tD = D >= 0\r\n // compute the line parameters of the two closest points\r\n if (D < Ray.smallnum) { // the lines are almost parallel\r\n sN = 0.0; // force using point P0 on segment S1\r\n sD = 1.0; // to prevent possible division by 0.0 later\r\n tN = e;\r\n tD = c;\r\n }\r\n else { // get the closest points on the infinite lines\r\n sN = (b * e - c * d);\r\n tN = (a * e - b * d);\r\n if (sN < 0.0) { // sc < 0 => the s=0 edge is visible\r\n sN = 0.0;\r\n tN = e;\r\n tD = c;\r\n }\r\n else if (sN > sD) { // sc > 1 => the s=1 edge is visible\r\n sN = sD;\r\n tN = e + b;\r\n tD = c;\r\n }\r\n }\r\n if (tN < 0.0) { // tc < 0 => the t=0 edge is visible\r\n tN = 0.0;\r\n // recompute sc for this edge\r\n if (-d < 0.0) {\r\n sN = 0.0;\r\n }\r\n else if (-d > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = -d;\r\n sD = a;\r\n }\r\n }\r\n else if (tN > tD) { // tc > 1 => the t=1 edge is visible\r\n tN = tD;\r\n // recompute sc for this edge\r\n if ((-d + b) < 0.0) {\r\n sN = 0;\r\n }\r\n else if ((-d + b) > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = (-d + b);\r\n sD = a;\r\n }\r\n }\r\n // finally do the division to get sc and tc\r\n sc = (Math.abs(sN) < Ray.smallnum ? 0.0 : sN / sD);\r\n tc = (Math.abs(tN) < Ray.smallnum ? 0.0 : tN / tD);\r\n // get the difference of the two closest points\r\n var qtc = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[4];\r\n v.scaleToRef(tc, qtc);\r\n var qsc = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[5];\r\n u.scaleToRef(sc, qsc);\r\n qsc.addInPlace(w);\r\n var dP = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[6];\r\n qsc.subtractToRef(qtc, dP); // = S1(sc) - S2(tc)\r\n var isIntersected = (tc > 0) && (tc <= this.length) && (dP.lengthSquared() < (threshold * threshold)); // return intersection result\r\n if (isIntersected) {\r\n return qsc.length();\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Update the ray from viewport position\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns this ray updated\r\n */\r\n Ray.prototype.update = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n this.unprojectRayToRef(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a ray with origin and direction of 0,0,0\r\n * @returns the new ray\r\n */\r\n Ray.Zero = function () {\r\n return new Ray(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero());\r\n };\r\n /**\r\n * Creates a new ray from screen space and viewport\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns new ray\r\n */\r\n Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Ray.Zero();\r\n return result.update(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n };\r\n /**\r\n * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be\r\n * transformed to the given world matrix.\r\n * @param origin The origin point\r\n * @param end The end point\r\n * @param world a matrix to transform the ray to. Default is the identity matrix.\r\n * @returns the new ray\r\n */\r\n Ray.CreateNewFromTo = function (origin, end, world) {\r\n if (world === void 0) { world = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly; }\r\n var direction = end.subtract(origin);\r\n var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));\r\n direction.normalize();\r\n return Ray.Transform(new Ray(origin, direction, length), world);\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @returns the resulting new ray\r\n */\r\n Ray.Transform = function (ray, matrix) {\r\n var result = new Ray(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 0));\r\n Ray.TransformToRef(ray, matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @param result ray to store result in\r\n */\r\n Ray.TransformToRef = function (ray, matrix, result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesToRef(ray.origin, matrix, result.origin);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalToRef(ray.direction, matrix, result.direction);\r\n result.length = ray.length;\r\n var dir = result.direction;\r\n var len = dir.length();\r\n if (!(len === 0 || len === 1)) {\r\n var num = 1.0 / len;\r\n dir.x *= num;\r\n dir.y *= num;\r\n dir.z *= num;\r\n result.length *= len;\r\n }\r\n };\r\n /**\r\n * Unproject a ray from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n */\r\n Ray.prototype.unprojectRayToRef = function (sourceX, sourceY, viewportWidth, viewportHeight, world, view, projection) {\r\n var matrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var nearScreenSource = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[0];\r\n nearScreenSource.x = sourceX / viewportWidth * 2 - 1;\r\n nearScreenSource.y = -(sourceY / viewportHeight * 2 - 1);\r\n nearScreenSource.z = -1.0;\r\n var farScreenSource = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[1].copyFromFloats(nearScreenSource.x, nearScreenSource.y, 1.0);\r\n var nearVec3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[2];\r\n var farVec3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[3];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]._UnprojectFromInvertedMatrixToRef(nearScreenSource, matrix, nearVec3);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]._UnprojectFromInvertedMatrixToRef(farScreenSource, matrix, farVec3);\r\n this.origin.copyFrom(nearVec3);\r\n farVec3.subtractToRef(nearVec3, this.direction);\r\n this.direction.normalize();\r\n };\r\n Ray.TmpVector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_0__[\"ArrayTools\"].BuildArray(6, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero);\r\n Ray.smallnum = 0.00000001;\r\n Ray.rayl = 10e8;\r\n return Ray;\r\n}());\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var result = Ray.Zero();\r\n this.createPickingRayToRef(x, y, world, result, camera, cameraViewSpace);\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, world ? world : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly, cameraViewSpace ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].IdentityReadOnly : camera.getViewMatrix(), camera.getProjectionMatrix());\r\n return this;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n var result = Ray.Zero();\r\n this.createPickingRayInCameraSpaceToRef(x, y, result, camera);\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return this;\r\n }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n var identity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, identity, identity, camera.getProjectionMatrix());\r\n return this;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype._internalPick = function (rayFunction, predicate, fastCheck, trianglePredicate) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfo = null;\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.getWorldMatrix();\r\n var ray = rayFunction(world);\r\n var result = mesh.intersects(ray, fastCheck, trianglePredicate);\r\n if (!result || !result.hit) {\r\n continue;\r\n }\r\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\r\n continue;\r\n }\r\n pickingInfo = result;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n return pickingInfo || new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]();\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype._internalMultiPick = function (rayFunction, predicate, trianglePredicate) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfos = new Array();\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.getWorldMatrix();\r\n var ray = rayFunction(world);\r\n var result = mesh.intersects(ray, false, trianglePredicate);\r\n if (!result || !result.hit) {\r\n continue;\r\n }\r\n pickingInfos.push(result);\r\n }\r\n return pickingInfos;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n var _this = this;\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_2__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var result = this._internalPick(function (world) {\r\n if (!_this._tempPickingRay) {\r\n _this._tempPickingRay = Ray.Zero();\r\n }\r\n _this.createPickingRayToRef(x, y, world, _this._tempPickingRay, camera || null);\r\n return _this._tempPickingRay;\r\n }, predicate, fastCheck, trianglePredicate);\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n var _this = this;\r\n var result = this._internalPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, fastCheck, trianglePredicate);\r\n if (result) {\r\n result.ray = ray;\r\n }\r\n return result;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) { return _this.createPickingRay(x, y, world, camera || null); }, predicate, trianglePredicate);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, trianglePredicate);\r\n};\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_5__[\"Camera\"].prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n if (!transform) {\r\n transform = this.getWorldMatrix();\r\n }\r\n if (!origin) {\r\n origin = this.position;\r\n }\r\n var forward = this._scene.useRightHandedSystem ? new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, -1) : new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 1);\r\n var forwardWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormal(forward, transform);\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Normalize(forwardWorld);\r\n return new Ray(origin, direction, length);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Debug/axesViewer.ts\":\n/*!*****************************!*\\\n !*** ./Debug/axesViewer.ts ***!\n \\*****************************/\n/*! exports provided: AxesViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return AxesViewer; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Gizmos/axisDragGizmo */ \"./Gizmos/axisDragGizmo.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The Axes viewer will show 3 axes in a specific point in space\r\n */\r\nvar AxesViewer = /** @class */ (function () {\r\n /**\r\n * Creates a new AxesViewer\r\n * @param scene defines the hosting scene\r\n * @param scaleLines defines a number used to scale line length (1 by default)\r\n * @param renderingGroupId defines a number used to set the renderingGroupId of the meshes (2 by default)\r\n * @param xAxis defines the node hierarchy used to render the x-axis\r\n * @param yAxis defines the node hierarchy used to render the y-axis\r\n * @param zAxis defines the node hierarchy used to render the z-axis\r\n */\r\n function AxesViewer(scene, scaleLines, renderingGroupId, xAxis, yAxis, zAxis) {\r\n if (scaleLines === void 0) { scaleLines = 1; }\r\n if (renderingGroupId === void 0) { renderingGroupId = 2; }\r\n this._scaleLinesFactor = 4;\r\n this._instanced = false;\r\n /**\r\n * Gets or sets a number used to scale line length\r\n */\r\n this.scaleLines = 1;\r\n this.scaleLines = scaleLines;\r\n if (!xAxis) {\r\n var redColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__[\"StandardMaterial\"](\"\", scene);\r\n redColoredMaterial.disableLighting = true;\r\n redColoredMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Red().scale(0.5);\r\n xAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrow(scene, redColoredMaterial);\r\n }\r\n if (!yAxis) {\r\n var greenColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__[\"StandardMaterial\"](\"\", scene);\r\n greenColoredMaterial.disableLighting = true;\r\n greenColoredMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Green().scale(0.5);\r\n yAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrow(scene, greenColoredMaterial);\r\n }\r\n if (!zAxis) {\r\n var blueColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_1__[\"StandardMaterial\"](\"\", scene);\r\n blueColoredMaterial.disableLighting = true;\r\n blueColoredMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Blue().scale(0.5);\r\n zAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrow(scene, blueColoredMaterial);\r\n }\r\n this._xAxis = xAxis;\r\n this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._yAxis = yAxis;\r\n this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._zAxis = zAxis;\r\n this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n if (renderingGroupId != null) {\r\n AxesViewer._SetRenderingGroupId(this._xAxis, renderingGroupId);\r\n AxesViewer._SetRenderingGroupId(this._yAxis, renderingGroupId);\r\n AxesViewer._SetRenderingGroupId(this._zAxis, renderingGroupId);\r\n }\r\n this.scene = scene;\r\n this.update(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Right(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Forward());\r\n }\r\n Object.defineProperty(AxesViewer.prototype, \"xAxis\", {\r\n /** Gets the node hierarchy used to render x-axis */\r\n get: function () {\r\n return this._xAxis;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxesViewer.prototype, \"yAxis\", {\r\n /** Gets the node hierarchy used to render y-axis */\r\n get: function () {\r\n return this._yAxis;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AxesViewer.prototype, \"zAxis\", {\r\n /** Gets the node hierarchy used to render z-axis */\r\n get: function () {\r\n return this._zAxis;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Force the viewer to update\r\n * @param position defines the position of the viewer\r\n * @param xaxis defines the x axis of the viewer\r\n * @param yaxis defines the y axis of the viewer\r\n * @param zaxis defines the z axis of the viewer\r\n */\r\n AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {\r\n this._xAxis.position.copyFrom(position);\r\n this._xAxis.setDirection(xaxis);\r\n this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._yAxis.position.copyFrom(position);\r\n this._yAxis.setDirection(yaxis);\r\n this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n this._zAxis.position.copyFrom(position);\r\n this._zAxis.setDirection(zaxis);\r\n this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);\r\n };\r\n /**\r\n * Creates an instance of this axes viewer.\r\n * @returns a new axes viewer with instanced meshes\r\n */\r\n AxesViewer.prototype.createInstance = function () {\r\n var xAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrowInstance(this.scene, this._xAxis);\r\n var yAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrowInstance(this.scene, this._yAxis);\r\n var zAxis = _Gizmos_axisDragGizmo__WEBPACK_IMPORTED_MODULE_2__[\"AxisDragGizmo\"]._CreateArrowInstance(this.scene, this._zAxis);\r\n var axesViewer = new AxesViewer(this.scene, this.scaleLines, null, xAxis, yAxis, zAxis);\r\n axesViewer._instanced = true;\r\n return axesViewer;\r\n };\r\n /** Releases resources */\r\n AxesViewer.prototype.dispose = function () {\r\n if (this._xAxis) {\r\n this._xAxis.dispose(false, !this._instanced);\r\n delete this._xAxis;\r\n }\r\n if (this._yAxis) {\r\n this._yAxis.dispose(false, !this._instanced);\r\n delete this._yAxis;\r\n }\r\n if (this._zAxis) {\r\n this._zAxis.dispose(false, !this._instanced);\r\n delete this._zAxis;\r\n }\r\n delete this.scene;\r\n };\r\n AxesViewer._SetRenderingGroupId = function (node, id) {\r\n node.getChildMeshes().forEach(function (mesh) {\r\n mesh.renderingGroupId = id;\r\n });\r\n };\r\n return AxesViewer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/boneAxesViewer.ts\":\n/*!*********************************!*\\\n !*** ./Debug/boneAxesViewer.ts ***!\n \\*********************************/\n/*! exports provided: BoneAxesViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return BoneAxesViewer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Debug_axesViewer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Debug/axesViewer */ \"./Debug/axesViewer.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The BoneAxesViewer will attach 3 axes to a specific bone of a specific mesh\r\n * @see demo here: https://www.babylonjs-playground.com/#0DE8F4#8\r\n */\r\nvar BoneAxesViewer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BoneAxesViewer, _super);\r\n /**\r\n * Creates a new BoneAxesViewer\r\n * @param scene defines the hosting scene\r\n * @param bone defines the target bone\r\n * @param mesh defines the target mesh\r\n * @param scaleLines defines a scaling factor for line length (1 by default)\r\n */\r\n function BoneAxesViewer(scene, bone, mesh, scaleLines) {\r\n if (scaleLines === void 0) { scaleLines = 1; }\r\n var _this = _super.call(this, scene, scaleLines) || this;\r\n /** Gets current position */\r\n _this.pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** Gets direction of X axis */\r\n _this.xaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** Gets direction of Y axis */\r\n _this.yaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /** Gets direction of Z axis */\r\n _this.zaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this.mesh = mesh;\r\n _this.bone = bone;\r\n return _this;\r\n }\r\n /**\r\n * Force the viewer to update\r\n */\r\n BoneAxesViewer.prototype.update = function () {\r\n if (!this.mesh || !this.bone) {\r\n return;\r\n }\r\n var bone = this.bone;\r\n bone._markAsDirtyAndCompose();\r\n bone.getAbsolutePositionToRef(this.mesh, this.pos);\r\n bone.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__[\"Axis\"].X, this.mesh, this.xaxis);\r\n bone.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__[\"Axis\"].Y, this.mesh, this.yaxis);\r\n bone.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_3__[\"Axis\"].Z, this.mesh, this.zaxis);\r\n _super.prototype.update.call(this, this.pos, this.xaxis, this.yaxis, this.zaxis);\r\n };\r\n /** Releases resources */\r\n BoneAxesViewer.prototype.dispose = function () {\r\n if (this.mesh) {\r\n this.mesh = null;\r\n this.bone = null;\r\n _super.prototype.dispose.call(this);\r\n }\r\n };\r\n return BoneAxesViewer;\r\n}(_Debug_axesViewer__WEBPACK_IMPORTED_MODULE_1__[\"AxesViewer\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/debugLayer.ts\":\n/*!*****************************!*\\\n !*** ./Debug/debugLayer.ts ***!\n \\*****************************/\n/*! exports provided: DebugLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return DebugLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].prototype, \"debugLayer\", {\r\n get: function () {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see http://doc.babylonjs.com/features/playground_debuglayer\r\n */\r\nvar DebugLayer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see http://doc.babylonjs.com/features/playground_debuglayer\r\n * @param scene Defines the scene to inspect\r\n */\r\n function DebugLayer(scene) {\r\n var _this = this;\r\n this.BJSINSPECTOR = this._getGlobalInspector();\r\n this._scene = scene;\r\n this._scene.onDisposeObservable.add(function () {\r\n // Debug layer\r\n if (_this._scene._debugLayer) {\r\n _this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n Object.defineProperty(DebugLayer.prototype, \"onPropertyChangedObservable\", {\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n get: function () {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n }\r\n return this._onPropertyChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Creates the inspector window. */\r\n DebugLayer.prototype._createInspector = function (config) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n if (this._onPropertyChangedObservable) {\r\n for (var _i = 0, _a = this._onPropertyChangedObservable.observers; _i < _a.length; _i++) {\r\n var observer = _a[_i];\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n var userOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ overlay: false, showExplorer: true, showInspector: true, embedMode: false, handleResize: true, enablePopup: true }, config);\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n };\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitle defines the specific block to highlight\r\n */\r\n DebugLayer.prototype.select = function (entity, lineContainerTitle) {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitle);\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n };\r\n /** Get the inspector from bundle or global */\r\n DebugLayer.prototype._getGlobalInspector = function () {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof INSPECTOR !== 'undefined') {\r\n return INSPECTOR;\r\n }\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== 'undefined' && typeof BABYLON.Inspector !== 'undefined') {\r\n return BABYLON;\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n DebugLayer.prototype.isVisible = function () {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n };\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n DebugLayer.prototype.hide = function () {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n };\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @return a promise fulfilled when the debug layer is visible\r\n */\r\n DebugLayer.prototype.show = function (config) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (typeof _this.BJSINSPECTOR == 'undefined') {\r\n var inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n // Load inspector and add it to the DOM\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].LoadScript(inspectorUrl, function () {\r\n _this._createInspector(config);\r\n resolve(_this);\r\n });\r\n }\r\n else {\r\n // Otherwise creates the inspector\r\n _this._createInspector(config);\r\n resolve(_this);\r\n }\r\n });\r\n };\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n DebugLayer.InspectorURL = \"https://unpkg.com/babylonjs-inspector@\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].Version + \"/babylon.inspector.bundle.js\";\r\n return DebugLayer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/index.ts\":\n/*!************************!*\\\n !*** ./Debug/index.ts ***!\n \\************************/\n/*! exports provided: AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _axesViewer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./axesViewer */ \"./Debug/axesViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return _axesViewer__WEBPACK_IMPORTED_MODULE_0__[\"AxesViewer\"]; });\n\n/* harmony import */ var _boneAxesViewer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boneAxesViewer */ \"./Debug/boneAxesViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return _boneAxesViewer__WEBPACK_IMPORTED_MODULE_1__[\"BoneAxesViewer\"]; });\n\n/* harmony import */ var _debugLayer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./debugLayer */ \"./Debug/debugLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return _debugLayer__WEBPACK_IMPORTED_MODULE_2__[\"DebugLayer\"]; });\n\n/* harmony import */ var _physicsViewer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./physicsViewer */ \"./Debug/physicsViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return _physicsViewer__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsViewer\"]; });\n\n/* harmony import */ var _rayHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./rayHelper */ \"./Debug/rayHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return _rayHelper__WEBPACK_IMPORTED_MODULE_4__[\"RayHelper\"]; });\n\n/* harmony import */ var _skeletonViewer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./skeletonViewer */ \"./Debug/skeletonViewer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return _skeletonViewer__WEBPACK_IMPORTED_MODULE_5__[\"SkeletonViewer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/physicsViewer.ts\":\n/*!********************************!*\\\n !*** ./Debug/physicsViewer.ts ***!\n \\********************************/\n/*! exports provided: PhysicsViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return PhysicsViewer; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Used to show the physics impostor around the specific mesh\r\n */\r\nvar PhysicsViewer = /** @class */ (function () {\r\n /**\r\n * Creates a new PhysicsViewer\r\n * @param scene defines the hosting scene\r\n */\r\n function PhysicsViewer(scene) {\r\n /** @hidden */\r\n this._impostors = [];\r\n /** @hidden */\r\n this._meshes = [];\r\n /** @hidden */\r\n this._numMeshes = 0;\r\n this._debugMeshMeshes = new Array();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene;\r\n var physicEngine = this._scene.getPhysicsEngine();\r\n if (physicEngine) {\r\n this._physicsEnginePlugin = physicEngine.getPhysicsPlugin();\r\n }\r\n this._utilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"](this._scene, false);\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;\r\n }\r\n /** @hidden */\r\n PhysicsViewer.prototype._updateDebugMeshes = function () {\r\n var plugin = this._physicsEnginePlugin;\r\n for (var i = 0; i < this._numMeshes; i++) {\r\n var impostor = this._impostors[i];\r\n if (!impostor) {\r\n continue;\r\n }\r\n if (impostor.isDisposed) {\r\n this.hideImpostor(this._impostors[i--]);\r\n }\r\n else {\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].MeshImpostor) {\r\n continue;\r\n }\r\n var mesh = this._meshes[i];\r\n if (mesh && plugin) {\r\n plugin.syncMeshWithImpostor(mesh, impostor);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Renders a specified physic impostor\r\n * @param impostor defines the impostor to render\r\n * @param targetMesh defines the mesh represented by the impostor\r\n * @returns the new debug mesh used to render the impostor\r\n */\r\n PhysicsViewer.prototype.showImpostor = function (impostor, targetMesh) {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n for (var i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n return null;\r\n }\r\n }\r\n var debugMesh = this._getDebugMesh(impostor, targetMesh);\r\n if (debugMesh) {\r\n this._impostors[this._numMeshes] = impostor;\r\n this._meshes[this._numMeshes] = debugMesh;\r\n if (this._numMeshes === 0) {\r\n this._renderFunction = this._updateDebugMeshes.bind(this);\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n this._numMeshes++;\r\n }\r\n return debugMesh;\r\n };\r\n /**\r\n * Hides a specified physic impostor\r\n * @param impostor defines the impostor to hide\r\n */\r\n PhysicsViewer.prototype.hideImpostor = function (impostor) {\r\n if (!impostor || !this._scene || !this._utilityLayer) {\r\n return;\r\n }\r\n var removed = false;\r\n var utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n for (var i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n var mesh = this._meshes[i];\r\n if (!mesh) {\r\n continue;\r\n }\r\n utilityLayerScene.removeMesh(mesh);\r\n mesh.dispose();\r\n var index = this._debugMeshMeshes.indexOf(mesh);\r\n if (index > -1) {\r\n this._debugMeshMeshes.splice(index, 1);\r\n }\r\n this._numMeshes--;\r\n if (this._numMeshes > 0) {\r\n this._meshes[i] = this._meshes[this._numMeshes];\r\n this._impostors[i] = this._impostors[this._numMeshes];\r\n this._meshes[this._numMeshes] = null;\r\n this._impostors[this._numMeshes] = null;\r\n }\r\n else {\r\n this._meshes[0] = null;\r\n this._impostors[0] = null;\r\n }\r\n removed = true;\r\n break;\r\n }\r\n }\r\n if (removed && this._numMeshes === 0) {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n }\r\n };\r\n PhysicsViewer.prototype._getDebugMaterial = function (scene) {\r\n if (!this._debugMaterial) {\r\n this._debugMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"]('', scene);\r\n this._debugMaterial.wireframe = true;\r\n this._debugMaterial.emissiveColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].White();\r\n this._debugMaterial.disableLighting = true;\r\n }\r\n return this._debugMaterial;\r\n };\r\n PhysicsViewer.prototype._getDebugBoxMesh = function (scene) {\r\n if (!this._debugBoxMesh) {\r\n this._debugBoxMesh = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_1__[\"BoxBuilder\"].CreateBox('physicsBodyBoxViewMesh', { size: 1 }, scene);\r\n this._debugBoxMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n this._debugBoxMesh.material = this._getDebugMaterial(scene);\r\n this._debugBoxMesh.setEnabled(false);\r\n }\r\n return this._debugBoxMesh.createInstance('physicsBodyBoxViewInstance');\r\n };\r\n PhysicsViewer.prototype._getDebugSphereMesh = function (scene) {\r\n if (!this._debugSphereMesh) {\r\n this._debugSphereMesh = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_2__[\"SphereBuilder\"].CreateSphere('physicsBodySphereViewMesh', { diameter: 1 }, scene);\r\n this._debugSphereMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n this._debugSphereMesh.material = this._getDebugMaterial(scene);\r\n this._debugSphereMesh.setEnabled(false);\r\n }\r\n return this._debugSphereMesh.createInstance('physicsBodyBoxViewInstance');\r\n };\r\n PhysicsViewer.prototype._getDebugCylinderMesh = function (scene) {\r\n if (!this._debugCylinderMesh) {\r\n this._debugCylinderMesh = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_9__[\"CylinderBuilder\"].CreateCylinder('physicsBodyCylinderViewMesh', { diameterTop: 1, diameterBottom: 1, height: 1 }, scene);\r\n this._debugCylinderMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n this._debugCylinderMesh.material = this._getDebugMaterial(scene);\r\n this._debugCylinderMesh.setEnabled(false);\r\n }\r\n return this._debugCylinderMesh.createInstance('physicsBodyBoxViewInstance');\r\n };\r\n PhysicsViewer.prototype._getDebugMeshMesh = function (mesh, scene) {\r\n var wireframeOver = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](mesh.name, scene, null, mesh);\r\n wireframeOver.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n wireframeOver.setParent(mesh);\r\n wireframeOver.material = this._getDebugMaterial(scene);\r\n this._debugMeshMeshes.push(wireframeOver);\r\n return wireframeOver;\r\n };\r\n PhysicsViewer.prototype._getDebugMesh = function (impostor, targetMesh) {\r\n var _this = this;\r\n if (!this._utilityLayer) {\r\n return null;\r\n }\r\n // Only create child impostor debug meshes when evaluating the parent\r\n if (targetMesh && targetMesh.parent && targetMesh.parent.physicsImpostor) {\r\n return null;\r\n }\r\n var mesh = null;\r\n var utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n switch (impostor.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].BoxImpostor:\r\n mesh = this._getDebugBoxMesh(utilityLayerScene);\r\n impostor.getBoxSizeToRef(mesh.scaling);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].SphereImpostor:\r\n mesh = this._getDebugSphereMesh(utilityLayerScene);\r\n var radius = impostor.getRadius();\r\n mesh.scaling.x = radius * 2;\r\n mesh.scaling.y = radius * 2;\r\n mesh.scaling.z = radius * 2;\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].MeshImpostor:\r\n if (targetMesh) {\r\n mesh = this._getDebugMeshMesh(targetMesh, utilityLayerScene);\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].NoImpostor:\r\n if (targetMesh) {\r\n // Handle compound impostors\r\n var childMeshes = targetMesh.getChildMeshes().filter(function (c) { return c.physicsImpostor ? 1 : 0; });\r\n childMeshes.forEach(function (m) {\r\n var a = _this._getDebugBoxMesh(utilityLayerScene);\r\n a.parent = m;\r\n });\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_7__[\"PhysicsImpostor\"].CylinderImpostor:\r\n mesh = this._getDebugCylinderMesh(utilityLayerScene);\r\n var bi = impostor.object.getBoundingInfo();\r\n mesh.scaling.x = bi.boundingBox.maximum.x - bi.boundingBox.minimum.x;\r\n mesh.scaling.y = bi.boundingBox.maximum.y - bi.boundingBox.minimum.y;\r\n mesh.scaling.z = bi.boundingBox.maximum.z - bi.boundingBox.minimum.z;\r\n break;\r\n }\r\n return mesh;\r\n };\r\n /** Releases all resources */\r\n PhysicsViewer.prototype.dispose = function () {\r\n var count = this._numMeshes;\r\n for (var index = 0; index < count; index++) {\r\n this.hideImpostor(this._impostors[0]);\r\n }\r\n if (this._debugBoxMesh) {\r\n this._debugBoxMesh.dispose();\r\n }\r\n if (this._debugSphereMesh) {\r\n this._debugSphereMesh.dispose();\r\n }\r\n if (this._debugCylinderMesh) {\r\n this._debugCylinderMesh.dispose();\r\n }\r\n if (this._debugMaterial) {\r\n this._debugMaterial.dispose();\r\n }\r\n this._impostors.length = 0;\r\n this._scene = null;\r\n this._physicsEnginePlugin = null;\r\n if (this._utilityLayer) {\r\n this._utilityLayer.dispose();\r\n this._utilityLayer = null;\r\n }\r\n };\r\n return PhysicsViewer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/rayHelper.ts\":\n/*!****************************!*\\\n !*** ./Debug/rayHelper.ts ***!\n \\****************************/\n/*! exports provided: RayHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return RayHelper; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n\r\n\r\n\r\n/**\r\n * As raycast might be hard to debug, the RayHelper can help rendering the different rays\r\n * in order to better appreciate the issue one might have.\r\n * @see http://doc.babylonjs.com/babylon101/raycasts#debugging\r\n */\r\nvar RayHelper = /** @class */ (function () {\r\n /**\r\n * Instantiate a new ray helper.\r\n * As raycast might be hard to debug, the RayHelper can help rendering the different rays\r\n * in order to better appreciate the issue one might have.\r\n * @see http://doc.babylonjs.com/babylon101/raycasts#debugging\r\n * @param ray Defines the ray we are currently tryin to visualize\r\n */\r\n function RayHelper(ray) {\r\n this.ray = ray;\r\n }\r\n /**\r\n * Helper function to create a colored helper in a scene in one line.\r\n * @param ray Defines the ray we are currently tryin to visualize\r\n * @param scene Defines the scene the ray is used in\r\n * @param color Defines the color we want to see the ray in\r\n * @returns The newly created ray helper.\r\n */\r\n RayHelper.CreateAndShow = function (ray, scene, color) {\r\n var helper = new RayHelper(ray);\r\n helper.show(scene, color);\r\n return helper;\r\n };\r\n /**\r\n * Shows the ray we are willing to debug.\r\n * @param scene Defines the scene the ray needs to be rendered in\r\n * @param color Defines the color the ray needs to be rendered in\r\n */\r\n RayHelper.prototype.show = function (scene, color) {\r\n if (!this._renderFunction && this.ray) {\r\n var ray = this.ray;\r\n this._renderFunction = this._render.bind(this);\r\n this._scene = scene;\r\n this._renderPoints = [ray.origin, ray.origin.add(ray.direction.scale(ray.length))];\r\n this._renderLine = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLines(\"ray\", this._renderPoints, scene, true);\r\n if (this._renderFunction) {\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n }\r\n if (color && this._renderLine) {\r\n this._renderLine.color.copyFrom(color);\r\n }\r\n };\r\n /**\r\n * Hides the ray we are debugging.\r\n */\r\n RayHelper.prototype.hide = function () {\r\n if (this._renderFunction && this._scene) {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n this._scene = null;\r\n this._renderFunction = null;\r\n if (this._renderLine) {\r\n this._renderLine.dispose();\r\n this._renderLine = null;\r\n }\r\n this._renderPoints = [];\r\n }\r\n };\r\n RayHelper.prototype._render = function () {\r\n var ray = this.ray;\r\n if (!ray) {\r\n return;\r\n }\r\n var point = this._renderPoints[1];\r\n var len = Math.min(ray.length, 1000000);\r\n point.copyFrom(ray.direction);\r\n point.scaleInPlace(len);\r\n point.addInPlace(ray.origin);\r\n _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLines(\"ray\", this._renderPoints, this._scene, true, this._renderLine);\r\n };\r\n /**\r\n * Attach a ray helper to a mesh so that we can easily see its orientation for instance or information like its normals.\r\n * @param mesh Defines the mesh we want the helper attached to\r\n * @param meshSpaceDirection Defines the direction of the Ray in mesh space (local space of the mesh node)\r\n * @param meshSpaceOrigin Defines the origin of the Ray in mesh space (local space of the mesh node)\r\n * @param length Defines the length of the ray\r\n */\r\n RayHelper.prototype.attachToMesh = function (mesh, meshSpaceDirection, meshSpaceOrigin, length) {\r\n this._attachedToMesh = mesh;\r\n var ray = this.ray;\r\n if (!ray) {\r\n return;\r\n }\r\n if (!ray.direction) {\r\n ray.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n if (!ray.origin) {\r\n ray.origin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n if (length) {\r\n ray.length = length;\r\n }\r\n if (!meshSpaceOrigin) {\r\n meshSpaceOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n if (!meshSpaceDirection) {\r\n // -1 so that this will work with Mesh.lookAt\r\n meshSpaceDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1);\r\n }\r\n if (!this._meshSpaceDirection) {\r\n this._meshSpaceDirection = meshSpaceDirection.clone();\r\n this._meshSpaceOrigin = meshSpaceOrigin.clone();\r\n }\r\n else {\r\n this._meshSpaceDirection.copyFrom(meshSpaceDirection);\r\n this._meshSpaceOrigin.copyFrom(meshSpaceOrigin);\r\n }\r\n if (!this._updateToMeshFunction) {\r\n this._updateToMeshFunction = this._updateToMesh.bind(this);\r\n this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction);\r\n }\r\n this._updateToMesh();\r\n };\r\n /**\r\n * Detach the ray helper from the mesh it has previously been attached to.\r\n */\r\n RayHelper.prototype.detachFromMesh = function () {\r\n if (this._attachedToMesh) {\r\n if (this._updateToMeshFunction) {\r\n this._attachedToMesh.getScene().unregisterBeforeRender(this._updateToMeshFunction);\r\n }\r\n this._attachedToMesh = null;\r\n this._updateToMeshFunction = null;\r\n }\r\n };\r\n RayHelper.prototype._updateToMesh = function () {\r\n var ray = this.ray;\r\n if (!this._attachedToMesh || !ray) {\r\n return;\r\n }\r\n if (this._attachedToMesh._isDisposed) {\r\n this.detachFromMesh();\r\n return;\r\n }\r\n this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection, ray.direction);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(this._meshSpaceOrigin, this._attachedToMesh.getWorldMatrix(), ray.origin);\r\n };\r\n /**\r\n * Dispose the helper and release its associated resources.\r\n */\r\n RayHelper.prototype.dispose = function () {\r\n this.hide();\r\n this.detachFromMesh();\r\n this.ray = null;\r\n };\r\n return RayHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Debug/skeletonViewer.ts\":\n/*!*********************************!*\\\n !*** ./Debug/skeletonViewer.ts ***!\n \\*********************************/\n/*! exports provided: SkeletonViewer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return SkeletonViewer; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to render a debug view of a given skeleton\r\n * @see http://www.babylonjs-playground.com/#1BZJVJ#8\r\n */\r\nvar SkeletonViewer = /** @class */ (function () {\r\n /**\r\n * Creates a new SkeletonViewer\r\n * @param skeleton defines the skeleton to render\r\n * @param mesh defines the mesh attached to the skeleton\r\n * @param scene defines the hosting scene\r\n * @param autoUpdateBonesMatrices defines a boolean indicating if bones matrices must be forced to update before rendering (true by default)\r\n * @param renderingGroupId defines the rendering group id to use with the viewer\r\n */\r\n function SkeletonViewer(\r\n /** defines the skeleton to render */\r\n skeleton, \r\n /** defines the mesh attached to the skeleton */\r\n mesh, scene, \r\n /** defines a boolean indicating if bones matrices must be forced to update before rendering (true by default) */\r\n autoUpdateBonesMatrices, \r\n /** defines the rendering group id to use with the viewer */\r\n renderingGroupId) {\r\n if (autoUpdateBonesMatrices === void 0) { autoUpdateBonesMatrices = true; }\r\n if (renderingGroupId === void 0) { renderingGroupId = 1; }\r\n this.skeleton = skeleton;\r\n this.mesh = mesh;\r\n this.autoUpdateBonesMatrices = autoUpdateBonesMatrices;\r\n this.renderingGroupId = renderingGroupId;\r\n /** Gets or sets the color used to render the skeleton */\r\n this.color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].White();\r\n this._debugLines = new Array();\r\n this._isEnabled = false;\r\n this._scene = scene;\r\n this._utilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__[\"UtilityLayerRenderer\"](this._scene, false);\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;\r\n this.update();\r\n this._renderFunction = this.update.bind(this);\r\n }\r\n Object.defineProperty(SkeletonViewer.prototype, \"debugMesh\", {\r\n /**\r\n * Returns the mesh used to render the bones\r\n */\r\n get: function () {\r\n return this._debugMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SkeletonViewer.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /** Gets or sets a boolean indicating if the viewer is enabled */\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n if (value) {\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n else {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SkeletonViewer.prototype._getBonePosition = function (position, bone, meshMat, x, y, z) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n if (z === void 0) { z = 0; }\r\n var tmat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var parentBone = bone.getParent();\r\n tmat.copyFrom(bone.getLocalMatrix());\r\n if (x !== 0 || y !== 0 || z !== 0) {\r\n var tmat2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].IdentityToRef(tmat2);\r\n tmat2.setTranslationFromFloats(x, y, z);\r\n tmat2.multiplyToRef(tmat, tmat);\r\n }\r\n if (parentBone) {\r\n tmat.multiplyToRef(parentBone.getAbsoluteTransform(), tmat);\r\n }\r\n tmat.multiplyToRef(meshMat, tmat);\r\n position.x = tmat.m[12];\r\n position.y = tmat.m[13];\r\n position.z = tmat.m[14];\r\n };\r\n SkeletonViewer.prototype._getLinesForBonesWithLength = function (bones, meshMat) {\r\n var len = bones.length;\r\n var mesh = this.mesh._effectiveMesh;\r\n var meshPos = mesh.position;\r\n for (var i = 0; i < len; i++) {\r\n var bone = bones[i];\r\n var points = this._debugLines[i];\r\n if (!points) {\r\n points = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero()];\r\n this._debugLines[i] = points;\r\n }\r\n this._getBonePosition(points[0], bone, meshMat);\r\n this._getBonePosition(points[1], bone, meshMat, 0, bone.length, 0);\r\n points[0].subtractInPlace(meshPos);\r\n points[1].subtractInPlace(meshPos);\r\n }\r\n };\r\n SkeletonViewer.prototype._getLinesForBonesNoLength = function (bones, meshMat) {\r\n var len = bones.length;\r\n var boneNum = 0;\r\n var mesh = this.mesh._effectiveMesh;\r\n var meshPos = mesh.position;\r\n for (var i = len - 1; i >= 0; i--) {\r\n var childBone = bones[i];\r\n var parentBone = childBone.getParent();\r\n if (!parentBone) {\r\n continue;\r\n }\r\n var points = this._debugLines[boneNum];\r\n if (!points) {\r\n points = [_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero()];\r\n this._debugLines[boneNum] = points;\r\n }\r\n childBone.getAbsolutePositionToRef(mesh, points[0]);\r\n parentBone.getAbsolutePositionToRef(mesh, points[1]);\r\n points[0].subtractInPlace(meshPos);\r\n points[1].subtractInPlace(meshPos);\r\n boneNum++;\r\n }\r\n };\r\n /** Update the viewer to sync with current skeleton state */\r\n SkeletonViewer.prototype.update = function () {\r\n if (!this._utilityLayer) {\r\n return;\r\n }\r\n if (this.autoUpdateBonesMatrices) {\r\n this.skeleton.computeAbsoluteTransforms();\r\n }\r\n var mesh = this.mesh._effectiveMesh;\r\n if (this.skeleton.bones[0].length === undefined) {\r\n this._getLinesForBonesNoLength(this.skeleton.bones, mesh.getWorldMatrix());\r\n }\r\n else {\r\n this._getLinesForBonesWithLength(this.skeleton.bones, mesh.getWorldMatrix());\r\n }\r\n var targetScene = this._utilityLayer.utilityLayerScene;\r\n if (!this._debugMesh) {\r\n this._debugMesh = _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__[\"LinesBuilder\"].CreateLineSystem(\"\", { lines: this._debugLines, updatable: true, instance: null }, targetScene);\r\n this._debugMesh.renderingGroupId = this.renderingGroupId;\r\n }\r\n else {\r\n _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_2__[\"LinesBuilder\"].CreateLineSystem(\"\", { lines: this._debugLines, updatable: true, instance: this._debugMesh }, targetScene);\r\n }\r\n this._debugMesh.position.copyFrom(this.mesh.position);\r\n this._debugMesh.color = this.color;\r\n };\r\n /** Release associated resources */\r\n SkeletonViewer.prototype.dispose = function () {\r\n this.isEnabled = false;\r\n if (this._debugMesh) {\r\n this.isEnabled = false;\r\n this._debugMesh.dispose();\r\n this._debugMesh = null;\r\n }\r\n if (this._utilityLayer) {\r\n this._utilityLayer.dispose();\r\n this._utilityLayer = null;\r\n }\r\n };\r\n return SkeletonViewer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.cubeTexture.ts\":\n/*!**************************************************!*\\\n !*** ./Engines/Extensions/engine.cubeTexture.ts ***!\n \\**************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._createDepthStencilCubeTexture = function (size, options) {\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_UNKNOWN);\r\n internalTexture.isCube = true;\r\n if (this.webGLVersion === 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Depth cube texture is not supported by WebGL 1.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n // Create the depth/stencil buffer\r\n for (var face = 0; face < 6; face++) {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH24_STENCIL8, size, size, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH_COMPONENT24, size, size, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n return internalTexture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._partialLoadFile = function (url, index, loadedFiles, onfinish, onErrorCallBack) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var onload = function (data) {\r\n loadedFiles[index] = data;\r\n loadedFiles._internalCount++;\r\n if (loadedFiles._internalCount === 6) {\r\n onfinish(loadedFiles);\r\n }\r\n };\r\n var onerror = function (request, exception) {\r\n if (onErrorCallBack && request) {\r\n onErrorCallBack(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n this._loadFile(url, onload, undefined, undefined, true, onerror);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._cascadeLoadFiles = function (scene, onfinish, files, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedFiles = [];\r\n loadedFiles._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadFile(files[index], index, loadedFiles, onfinish, onError);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._cascadeLoadImgs = function (scene, onfinish, files, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedImages = [];\r\n loadedImages._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadImg(files[index], index, loadedImages, scene, onfinish, onError);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype._partialLoadImg = function (url, index, loadedImages, scene, onfinish, onErrorCallBack) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var img;\r\n var onload = function () {\r\n loadedImages[index] = img;\r\n loadedImages._internalCount++;\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n if (loadedImages._internalCount === 6) {\r\n onfinish(loadedImages);\r\n }\r\n };\r\n var onerror = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n if (onErrorCallBack) {\r\n onErrorCallBack(message, exception);\r\n }\r\n };\r\n img = _Misc_fileTools__WEBPACK_IMPORTED_MODULE_4__[\"FileTools\"].LoadImage(url, onload, onerror, scene ? scene.offlineProvider : null);\r\n if (scene) {\r\n scene._addPendingData(img);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback, excludeLoaders) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (excludeLoaders === void 0) { excludeLoaders = []; }\r\n var gl = this._gl;\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_CUBE);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n }\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n for (var _i = 0, _a = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (excludeLoaders.indexOf(availableLoader) === -1 && availableLoader.canLoad(extension, this._textureFormatInUse, fallback, false, false)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n var onInternalError = function (request, exception) {\r\n if (loader) {\r\n var fallbackUrl = loader.getFallbackTextureUrl(texture.url, _this._textureFormatInUse);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(loader.constructor.name + \" failed when trying to load \" + texture.url + \", falling back to the next supported loader\");\r\n if (fallbackUrl) {\r\n excludeLoaders.push(loader);\r\n _this.createCubeTexture(fallbackUrl, scene, files, noMipmap, onLoad, onError, format, extension, createPolynomials, lodScale, lodOffset, texture, excludeLoaders);\r\n return;\r\n }\r\n }\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n if (loader) {\r\n rootUrl = loader.transformUrl(rootUrl, this._textureFormatInUse);\r\n var onloaddata = function (data) {\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n loader.loadCubeData(data, texture, createPolynomials, onLoad, onError);\r\n };\r\n if (files && files.length === 6) {\r\n if (loader.supportCascades) {\r\n this._cascadeLoadFiles(scene, onloaddata, files, onError);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Textures type does not support cascades.\");\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(\"Texture loader does not support cascades.\");\r\n }\r\n }\r\n }\r\n else {\r\n this._loadFile(rootUrl, onloaddata, undefined, undefined, true, onInternalError);\r\n }\r\n }\r\n else {\r\n if (!files) {\r\n throw new Error(\"Cannot load cubemap because files were not defined\");\r\n }\r\n this._cascadeLoadImgs(scene, function (imgs) {\r\n var width = _this.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].GetExponentOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize) : imgs[0].width;\r\n var height = width;\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n return;\r\n }\r\n _this._workingCanvas.width = width;\r\n _this._workingCanvas.height = height;\r\n var faces = [\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X, gl.TEXTURE_CUBE_MAP_POSITIVE_Y, gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\r\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X, gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, gl.TEXTURE_CUBE_MAP_NEGATIVE_Z\r\n ];\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var internalFormat = format ? _this._getInternalFormat(format) : _this._gl.RGBA;\r\n for (var index = 0; index < faces.length; index++) {\r\n if (imgs[index].width !== width || imgs[index].height !== height) {\r\n _this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n }\r\n else {\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, imgs[index]);\r\n }\r\n }\r\n if (!noMipmap) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n _this._setCubeMapTextureParams(!noMipmap);\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n if (format) {\r\n texture.format = format;\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n }, files, onError);\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.multiRender.ts\":\n/*!**************************************************!*\\\n !*** ./Engines/Extensions/engine.multiRender.ts ***!\n \\**************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.unBindMultiColorAttachmentFramebuffer = function (textures, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n // If MSAA, we need to bitblt back to main texture\r\n var gl = this._gl;\r\n if (textures[0]._MSAAFramebuffer) {\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, textures[0]._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, textures[0]._framebuffer);\r\n var attachments = textures[0]._attachments;\r\n if (!attachments) {\r\n attachments = new Array(textures.length);\r\n textures[0]._attachments = attachments;\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n for (var j = 0; j < attachments.length; j++) {\r\n attachments[j] = gl.NONE;\r\n }\r\n attachments[i] = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n gl.readBuffer(attachments[i]);\r\n gl.drawBuffers(attachments);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n for (var i = 0; i < attachments.length; i++) {\r\n attachments[i] = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n gl.drawBuffers(attachments);\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n }\r\n if (onBeforeUnbind) {\r\n if (textures[0]._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(textures[0]._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createMultipleRenderTarget = function (size, options) {\r\n var generateMipMaps = false;\r\n var generateDepthBuffer = true;\r\n var generateStencilBuffer = false;\r\n var generateDepthTexture = false;\r\n var textureCount = 1;\r\n var defaultType = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n var defaultSamplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n var types = new Array();\r\n var samplingModes = new Array();\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps === undefined ? false : options.generateMipMaps;\r\n generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n generateStencilBuffer = options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n generateDepthTexture = options.generateDepthTexture === undefined ? false : options.generateDepthTexture;\r\n textureCount = options.textureCount || 1;\r\n if (options.types) {\r\n types = options.types;\r\n }\r\n if (options.samplingModes) {\r\n samplingModes = options.samplingModes;\r\n }\r\n }\r\n var gl = this._gl;\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var textures = [];\r\n var attachments = [];\r\n var depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);\r\n for (var i = 0; i < textureCount; i++) {\r\n var samplingMode = samplingModes[i] || defaultSamplingMode;\r\n var type = types[i] || defaultType;\r\n if (type === _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n else if (type === _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n if (type === _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_MULTIRENDERTARGET);\r\n var attachment = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n textures.push(texture);\r\n attachments.push(attachment);\r\n gl.activeTexture(gl[\"TEXTURE\" + i]);\r\n gl.bindTexture(gl.TEXTURE_2D, texture._webGLTexture);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), width, height, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n gl.framebufferTexture2D(gl.DRAW_FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture._webGLTexture, 0);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n texture._framebuffer = framebuffer;\r\n texture._depthStencilBuffer = depthStencilBuffer;\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._generateDepthBuffer = generateDepthBuffer;\r\n texture._generateStencilBuffer = generateStencilBuffer;\r\n texture._attachments = attachments;\r\n this._internalTexturesCache.push(texture);\r\n }\r\n if (generateDepthTexture && this._caps.depthTextureExtension) {\r\n // Depth texture\r\n var depthTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_MULTIRENDERTARGET);\r\n gl.activeTexture(gl.TEXTURE0);\r\n gl.bindTexture(gl.TEXTURE_2D, depthTexture._webGLTexture);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this.webGLVersion < 2 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, width, height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._webGLTexture, 0);\r\n depthTexture._framebuffer = framebuffer;\r\n depthTexture.baseWidth = width;\r\n depthTexture.baseHeight = height;\r\n depthTexture.width = width;\r\n depthTexture.height = height;\r\n depthTexture.isReady = true;\r\n depthTexture.samples = 1;\r\n depthTexture.generateMipMaps = generateMipMaps;\r\n depthTexture.samplingMode = gl.NEAREST;\r\n depthTexture._generateDepthBuffer = generateDepthBuffer;\r\n depthTexture._generateStencilBuffer = generateStencilBuffer;\r\n textures.push(depthTexture);\r\n this._internalTexturesCache.push(depthTexture);\r\n }\r\n gl.drawBuffers(attachments);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(null);\r\n this.resetTextureCache();\r\n return textures;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateMultipleRenderTargetTextureSampleCount = function (textures, samples) {\r\n if (this.webGLVersion < 2 || !textures || textures.length == 0) {\r\n return 1;\r\n }\r\n if (textures[0].samples === samples) {\r\n return samples;\r\n }\r\n var gl = this._gl;\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n // Dispose previous render buffers\r\n if (textures[0]._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(textures[0]._depthStencilBuffer);\r\n textures[0]._depthStencilBuffer = null;\r\n }\r\n if (textures[0]._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(textures[0]._MSAAFramebuffer);\r\n textures[0]._MSAAFramebuffer = null;\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n if (textures[i]._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(textures[i]._MSAARenderBuffer);\r\n textures[i]._MSAARenderBuffer = null;\r\n }\r\n }\r\n if (samples > 1) {\r\n var framebuffer = gl.createFramebuffer();\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n this._bindUnboundFramebuffer(framebuffer);\r\n var depthStencilBuffer = this._setupFramebufferDepthAttachments(textures[0]._generateStencilBuffer, textures[0]._generateDepthBuffer, textures[0].width, textures[0].height, samples);\r\n var attachments = [];\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n var attachment = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n var colorRenderbuffer = gl.createRenderbuffer();\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, colorRenderbuffer);\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, this._getRGBAMultiSampleBufferFormat(texture.type), texture.width, texture.height);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, colorRenderbuffer);\r\n texture._MSAAFramebuffer = framebuffer;\r\n texture._MSAARenderBuffer = colorRenderbuffer;\r\n texture.samples = samples;\r\n texture._depthStencilBuffer = depthStencilBuffer;\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n attachments.push(attachment);\r\n }\r\n gl.drawBuffers(attachments);\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(textures[0]._framebuffer);\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n return samples;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.multiview.ts\":\n/*!************************************************!*\\\n !*** ./Engines/Extensions/engine.multiview.ts ***!\n \\************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Materials_Textures_MultiviewRenderTarget__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Materials/Textures/MultiviewRenderTarget */ \"./Materials/Textures/MultiviewRenderTarget.ts\");\n/* harmony import */ var _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Maths/math.frustum */ \"./Maths/math.frustum.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.createMultiviewRenderTargetTexture = function (width, height) {\r\n var gl = this._gl;\r\n if (!this.getCaps().multiview) {\r\n throw \"Multiview is not supported\";\r\n }\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"].DATASOURCE_UNKNOWN, true);\r\n internalTexture.width = width;\r\n internalTexture.height = height;\r\n internalTexture._framebuffer = gl.createFramebuffer();\r\n internalTexture._colorTextureArray = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D_ARRAY, internalTexture._colorTextureArray);\r\n gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, width, height, 2);\r\n internalTexture._depthStencilTextureArray = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D_ARRAY, internalTexture._depthStencilTextureArray);\r\n gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.DEPTH32F_STENCIL8, width, height, 2);\r\n internalTexture.isReady = true;\r\n return internalTexture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.bindMultiviewFramebuffer = function (multiviewTexture) {\r\n var gl = this._gl;\r\n var ext = this.getCaps().multiview;\r\n this.bindFramebuffer(multiviewTexture, undefined, undefined, undefined, true);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, multiviewTexture._framebuffer);\r\n if (multiviewTexture._colorTextureArray && multiviewTexture._depthStencilTextureArray) {\r\n ext.framebufferTextureMultiviewOVR(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, multiviewTexture._colorTextureArray, 0, 0, 2);\r\n ext.framebufferTextureMultiviewOVR(gl.DRAW_FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, multiviewTexture._depthStencilTextureArray, 0, 0, 2);\r\n }\r\n else {\r\n throw \"Invalid multiview frame buffer\";\r\n }\r\n};\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].prototype._useMultiviewToSingleView = false;\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].prototype._multiviewTexture = null;\r\n_Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].prototype._resizeOrCreateMultiviewTexture = function (width, height) {\r\n if (!this._multiviewTexture) {\r\n this._multiviewTexture = new _Materials_Textures_MultiviewRenderTarget__WEBPACK_IMPORTED_MODULE_6__[\"MultiviewRenderTarget\"](this.getScene(), { width: width, height: height });\r\n }\r\n else if (this._multiviewTexture.getRenderWidth() != width || this._multiviewTexture.getRenderHeight() != height) {\r\n this._multiviewTexture.dispose();\r\n this._multiviewTexture = new _Materials_Textures_MultiviewRenderTarget__WEBPACK_IMPORTED_MODULE_6__[\"MultiviewRenderTarget\"](this.getScene(), { width: width, height: height });\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._transformMatrixR = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Zero();\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._multiviewSceneUbo = null;\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._createMultiviewUbo = function () {\r\n this._multiviewSceneUbo = new _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__[\"UniformBuffer\"](this.getEngine(), undefined, true);\r\n this._multiviewSceneUbo.addUniform(\"viewProjection\", 16);\r\n this._multiviewSceneUbo.addUniform(\"viewProjectionR\", 16);\r\n this._multiviewSceneUbo.addUniform(\"view\", 16);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._updateMultiviewUbo = function (viewR, projectionR) {\r\n if (viewR && projectionR) {\r\n viewR.multiplyToRef(projectionR, this._transformMatrixR);\r\n }\r\n if (viewR && projectionR) {\r\n viewR.multiplyToRef(projectionR, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Matrix[0]);\r\n _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_7__[\"Frustum\"].GetRightPlaneToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Matrix[0], this._frustumPlanes[3]); // Replace right plane by second camera right plane\r\n }\r\n if (this._multiviewSceneUbo) {\r\n this._multiviewSceneUbo.updateMatrix(\"viewProjection\", this.getTransformMatrix());\r\n this._multiviewSceneUbo.updateMatrix(\"viewProjectionR\", this._transformMatrixR);\r\n this._multiviewSceneUbo.updateMatrix(\"view\", this._viewMatrix);\r\n this._multiviewSceneUbo.update();\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype._renderMultiviewToSingleView = function (camera) {\r\n // Multiview is only able to be displayed directly for API's such as webXR\r\n // This displays a multiview image by rendering to the multiview image and then\r\n // copying the result into the sub cameras instead of rendering them and proceeding as normal from there\r\n // Render to a multiview texture\r\n camera._resizeOrCreateMultiviewTexture((camera._rigPostProcess && camera._rigPostProcess && camera._rigPostProcess.width > 0) ? camera._rigPostProcess.width / 2 : this.getEngine().getRenderWidth(true) / 2, (camera._rigPostProcess && camera._rigPostProcess && camera._rigPostProcess.height > 0) ? camera._rigPostProcess.height : this.getEngine().getRenderHeight(true));\r\n if (!this._multiviewSceneUbo) {\r\n this._createMultiviewUbo();\r\n }\r\n camera.outputRenderTarget = camera._multiviewTexture;\r\n this._renderForCamera(camera);\r\n camera.outputRenderTarget = null;\r\n // Consume the multiview texture through a shader for each eye\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n var engine = this.getEngine();\r\n this._activeCamera = camera._rigCameras[index];\r\n engine.setViewport(this._activeCamera.viewport);\r\n if (this.postProcessManager) {\r\n this.postProcessManager._prepareFrame();\r\n this.postProcessManager._finalizeFrame(this._activeCamera.isIntermediate);\r\n }\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.occlusionQuery.ts\":\n/*!*****************************************************!*\\\n !*** ./Engines/Extensions/engine.occlusionQuery.ts ***!\n \\*****************************************************/\n/*! exports provided: _OcclusionDataStorage */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _OcclusionDataStorage; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Instrumentation_timeToken__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Instrumentation/timeToken */ \"./Instrumentation/timeToken.ts\");\n\r\n\r\n\r\n/** @hidden */\r\nvar _OcclusionDataStorage = /** @class */ (function () {\r\n function _OcclusionDataStorage() {\r\n /** @hidden */\r\n this.occlusionInternalRetryCounter = 0;\r\n /** @hidden */\r\n this.isOcclusionQueryInProgress = false;\r\n /** @hidden */\r\n this.isOccluded = false;\r\n /** @hidden */\r\n this.occlusionRetryCount = -1;\r\n /** @hidden */\r\n this.occlusionType = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_TYPE_NONE;\r\n /** @hidden */\r\n this.occlusionQueryAlgorithmType = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n }\r\n return _OcclusionDataStorage;\r\n}());\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createQuery = function () {\r\n return this._gl.createQuery();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.deleteQuery = function (query) {\r\n this._gl.deleteQuery(query);\r\n return this;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.isQueryResultAvailable = function (query) {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.getQueryResult = function (query) {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.beginOcclusionQuery = function (algorithmType, query) {\r\n var glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.beginQuery(glAlgorithm, query);\r\n return this;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.endOcclusionQuery = function (algorithmType) {\r\n var glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.endQuery(glAlgorithm);\r\n return this;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._createTimeQuery = function () {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.createQueryEXT) {\r\n return timerQuery.createQueryEXT();\r\n }\r\n return this.createQuery();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._deleteTimeQuery = function (query) {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.deleteQueryEXT) {\r\n timerQuery.deleteQueryEXT(query);\r\n return;\r\n }\r\n this.deleteQuery(query);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getTimeQueryResult = function (query) {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_EXT);\r\n }\r\n return this.getQueryResult(query);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getTimeQueryAvailability = function (query) {\r\n var timerQuery = this.getCaps().timerQuery;\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_AVAILABLE_EXT);\r\n }\r\n return this.isQueryResultAvailable(query);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.startTimeQuery = function () {\r\n var caps = this.getCaps();\r\n var timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n var token = new _Instrumentation_timeToken__WEBPACK_IMPORTED_MODULE_2__[\"_TimeToken\"]();\r\n this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n if (caps.canUseTimestampForTimerQuery) {\r\n token._startTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n else {\r\n if (this._currentNonTimestampToken) {\r\n return this._currentNonTimestampToken;\r\n }\r\n token._timeElapsedQuery = this._createTimeQuery();\r\n if (timerQuery.beginQueryEXT) {\r\n timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n else {\r\n this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n this._currentNonTimestampToken = token;\r\n }\r\n return token;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.endTimeQuery = function (token) {\r\n var caps = this.getCaps();\r\n var timerQuery = caps.timerQuery;\r\n if (!timerQuery || !token) {\r\n return -1;\r\n }\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery) {\r\n return -1;\r\n }\r\n if (!token._endTimeQuery) {\r\n token._endTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._endTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n }\r\n else if (!token._timeElapsedQueryEnded) {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n if (timerQuery.endQueryEXT) {\r\n timerQuery.endQueryEXT(timerQuery.TIME_ELAPSED_EXT);\r\n }\r\n else {\r\n this._gl.endQuery(timerQuery.TIME_ELAPSED_EXT);\r\n }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n var disjoint = this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n var available = false;\r\n if (token._endTimeQuery) {\r\n available = this._getTimeQueryAvailability(token._endTimeQuery);\r\n }\r\n else if (token._timeElapsedQuery) {\r\n available = this._getTimeQueryAvailability(token._timeElapsedQuery);\r\n }\r\n if (available && !disjoint) {\r\n var result = 0;\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery || !token._endTimeQuery) {\r\n return -1;\r\n }\r\n var timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n var timeEnd = this._getTimeQueryResult(token._endTimeQuery);\r\n result = timeEnd - timeStart;\r\n this._deleteTimeQuery(token._startTimeQuery);\r\n this._deleteTimeQuery(token._endTimeQuery);\r\n token._startTimeQuery = null;\r\n token._endTimeQuery = null;\r\n }\r\n else {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n result = this._getTimeQueryResult(token._timeElapsedQuery);\r\n this._deleteTimeQuery(token._timeElapsedQuery);\r\n token._timeElapsedQuery = null;\r\n token._timeElapsedQueryEnded = false;\r\n this._currentNonTimestampToken = null;\r\n }\r\n return result;\r\n }\r\n return -1;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getGlAlgorithmType = function (algorithmType) {\r\n return algorithmType === _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"isOcclusionQueryInProgress\", {\r\n get: function () {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"_occlusionDataStorage\", {\r\n get: function () {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"isOccluded\", {\r\n get: function () {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function () {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"occlusionType\", {\r\n get: function () {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"occlusionRetryCount\", {\r\n get: function () {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (value) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype._checkOcclusionQuery = function () {\r\n var dataStorage = this._occlusionDataStorage;\r\n if (dataStorage.occlusionType === _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n var engine = this.getEngine();\r\n if (engine.webGLVersion < 2) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery) {\r\n var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult === 1 ? false : true;\r\n }\r\n else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n }\r\n var scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n if (!this._occlusionQuery) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery);\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n return dataStorage.isOccluded;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.rawTexture.ts\":\n/*!*************************************************!*\\\n !*** ./Engines/Extensions/engine.rawTexture.ts ***!\n \\*************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateRawTexture = function (texture, data, format, invertY, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format);\r\n // Babylon's internalFormat but gl's texImage2D format\r\n var internalFormat = this._getInternalFormat(format);\r\n var textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);\r\n }\r\n else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_RAW);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n this.updateRawTexture(texture, data, format, invertY, compression, type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n var gl = this._gl;\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_CUBERAW);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n var width = size;\r\n var height = width;\r\n texture.width = width;\r\n texture.height = height;\r\n // Double check on POT to generate Mips.\r\n var isPot = !this.needPOTTextures || (_Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.width) && _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n texture.generateMipMaps = generateMipMaps;\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateRawCubeTexture = function (texture, data, format, type, invertY, compression, level) {\r\n if (compression === void 0) { compression = null; }\r\n if (level === void 0) { level = 0; }\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var faceData = data[faceIndex];\r\n if (compression) {\r\n gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, (this.getCaps().s3tc)[compression], texture.width, texture.height, 0, faceData);\r\n }\r\n else {\r\n if (needConversion) {\r\n faceData = this._convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n var isPot = !this.needPOTTextures || (_Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.width) && _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad, onError, samplingMode, invertY) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (invertY === void 0) { invertY = false; }\r\n var gl = this._gl;\r\n var texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode);\r\n scene._addPendingData(texture);\r\n texture.url = url;\r\n this._internalTexturesCache.push(texture);\r\n var onerror = function (request, exception) {\r\n scene._removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n var internalCallback = function (data) {\r\n var width = texture.width;\r\n var faceDataArrays = callback(data);\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n if (mipmapGenerator) {\r\n var textureType = _this._getWebGLTextureType(type);\r\n var internalFormat = _this._getInternalFormat(format);\r\n var internalSizedFomat = _this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var mipData = mipmapGenerator(faceDataArrays);\r\n for (var level = 0; level < mipData.length; level++) {\r\n var mipSize = width >> level;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _this._convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n _this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene._removePendingData(texture);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n this._loadFile(url, function (data) {\r\n internalCallback(data);\r\n }, undefined, scene.offlineProvider, true, onerror);\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_1__[\"InternalTexture\"].DATASOURCE_RAW3D);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.is3D = true;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(this._gl.TEXTURE_3D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_3D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_3D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.updateRawTexture3D = function (texture, data, format, invertY, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var internalType = this._getWebGLTextureType(textureType);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(this._gl.TEXTURE_3D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, texture.depth, 0, data);\r\n }\r\n else {\r\n this._gl.texImage3D(this._gl.TEXTURE_3D, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_3D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.renderTarget.ts\":\n/*!***************************************************!*\\\n !*** ./Engines/Extensions/engine.renderTarget.ts ***!\n \\***************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n\r\n\r\n\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].prototype.createRenderTargetCubeTexture = function (size, options) {\r\n var fullOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ generateMipMaps: true, generateDepthBuffer: true, generateStencilBuffer: false, type: _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT, samplingMode: _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE, format: _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTUREFORMAT_RGBA }, options);\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;\r\n if (fullOptions.type === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n else if (fullOptions.type === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n var gl = this._gl;\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);\r\n if (fullOptions.type === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n fullOptions.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(\"Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type\");\r\n }\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n for (var face = 0; face < 6; face++) {\r\n gl.texImage2D((gl.TEXTURE_CUBE_MAP_POSITIVE_X + face), 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);\r\n }\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);\r\n // MipMaps\r\n if (fullOptions.generateMipMaps) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(null);\r\n texture._framebuffer = framebuffer;\r\n texture.width = size;\r\n texture.height = size;\r\n texture.isReady = true;\r\n texture.isCube = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.transformFeedback.ts\":\n/*!********************************************************!*\\\n !*** ./Engines/Extensions/engine.transformFeedback.ts ***!\n \\********************************************************/\n/*! exports provided: _forceTransformFeedbackToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _forceTransformFeedbackToBundle; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/** @hidden */\r\nvar _forceTransformFeedbackToBundle = true;\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.createTransformFeedback = function () {\r\n return this._gl.createTransformFeedback();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.deleteTransformFeedback = function (value) {\r\n this._gl.deleteTransformFeedback(value);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.bindTransformFeedback = function (value) {\r\n this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK, value);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.beginTransformFeedback = function (usePoints) {\r\n if (usePoints === void 0) { usePoints = true; }\r\n this._gl.beginTransformFeedback(usePoints ? this._gl.POINTS : this._gl.TRIANGLES);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.endTransformFeedback = function () {\r\n this._gl.endTransformFeedback();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.setTranformFeedbackVaryings = function (program, value) {\r\n this._gl.transformFeedbackVaryings(program, value, this._gl.INTERLEAVED_ATTRIBS);\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.bindTransformFeedbackBuffer = function (value) {\r\n this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER, 0, value ? value.underlyingResource : null);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/engine.webVR.ts\":\n/*!********************************************!*\\\n !*** ./Engines/Extensions/engine.webVR.ts ***!\n \\********************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.size */ \"./Maths/math.size.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/domManagement */ \"./Misc/domManagement.ts\");\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype, \"isInVRExclusivePointerMode\", {\r\n get: function () {\r\n return this._vrExclusivePointerMode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._prepareVRComponent = function () {\r\n this._vrSupported = false;\r\n this._vrExclusivePointerMode = false;\r\n this.onVRDisplayChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this.onVRRequestPresentComplete = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this.onVRRequestPresentStart = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.isVRDevicePresent = function () {\r\n return !!this._vrDisplay;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.getVRDevice = function () {\r\n return this._vrDisplay;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.initWebVR = function () {\r\n this.initWebVRAsync();\r\n return this.onVRDisplayChangedObservable;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.initWebVRAsync = function () {\r\n var _this = this;\r\n var notifyObservers = function () {\r\n var eventArgs = {\r\n vrDisplay: _this._vrDisplay,\r\n vrSupported: _this._vrSupported\r\n };\r\n _this.onVRDisplayChangedObservable.notifyObservers(eventArgs);\r\n _this._webVRInitPromise = new Promise(function (res) { res(eventArgs); });\r\n };\r\n if (!this._onVrDisplayConnect) {\r\n this._onVrDisplayConnect = function (event) {\r\n _this._vrDisplay = event.display;\r\n notifyObservers();\r\n };\r\n this._onVrDisplayDisconnect = function () {\r\n _this._vrDisplay.cancelAnimationFrame(_this._frameHandler);\r\n _this._vrDisplay = undefined;\r\n _this._frameHandler = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].QueueNewFrame(_this._bindedRenderFunction);\r\n notifyObservers();\r\n };\r\n this._onVrDisplayPresentChange = function () {\r\n _this._vrExclusivePointerMode = _this._vrDisplay && _this._vrDisplay.isPresenting;\r\n };\r\n var hostWindow = this.getHostWindow();\r\n hostWindow.addEventListener('vrdisplayconnect', this._onVrDisplayConnect);\r\n hostWindow.addEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);\r\n hostWindow.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n }\r\n this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync();\r\n this._webVRInitPromise.then(notifyObservers);\r\n return this._webVRInitPromise;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._getVRDisplaysAsync = function () {\r\n var _this = this;\r\n return new Promise(function (res) {\r\n if (navigator.getVRDisplays) {\r\n navigator.getVRDisplays().then(function (devices) {\r\n _this._vrSupported = true;\r\n // note that devices may actually be an empty array. This is fine;\r\n // we expect this._vrDisplay to be undefined in this case.\r\n _this._vrDisplay = devices[0];\r\n res({\r\n vrDisplay: _this._vrDisplay,\r\n vrSupported: _this._vrSupported\r\n });\r\n });\r\n }\r\n else {\r\n _this._vrDisplay = undefined;\r\n _this._vrSupported = false;\r\n res({\r\n vrDisplay: _this._vrDisplay,\r\n vrSupported: _this._vrSupported\r\n });\r\n }\r\n });\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.enableVR = function () {\r\n var _this = this;\r\n if (this._vrDisplay && !this._vrDisplay.isPresenting) {\r\n var onResolved = function () {\r\n _this.onVRRequestPresentComplete.notifyObservers(true);\r\n _this._onVRFullScreenTriggered();\r\n };\r\n var onRejected = function () {\r\n _this.onVRRequestPresentComplete.notifyObservers(false);\r\n };\r\n this.onVRRequestPresentStart.notifyObservers(this);\r\n this._vrDisplay.requestPresent([{ source: this.getRenderingCanvas() }]).then(onResolved).catch(onRejected);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._onVRFullScreenTriggered = function () {\r\n if (this._vrDisplay && this._vrDisplay.isPresenting) {\r\n //get the old size before we change\r\n this._oldSize = new _Maths_math_size__WEBPACK_IMPORTED_MODULE_1__[\"Size\"](this.getRenderWidth(), this.getRenderHeight());\r\n this._oldHardwareScaleFactor = this.getHardwareScalingLevel();\r\n //get the width and height, change the render size\r\n var leftEye = this._vrDisplay.getEyeParameters('left');\r\n this.setHardwareScalingLevel(1);\r\n this.setSize(leftEye.renderWidth * 2, leftEye.renderHeight);\r\n }\r\n else {\r\n this.setHardwareScalingLevel(this._oldHardwareScaleFactor);\r\n this.setSize(this._oldSize.width, this._oldSize.height);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.disableVR = function () {\r\n var _this = this;\r\n if (this._vrDisplay && this._vrDisplay.isPresenting) {\r\n this._vrDisplay.exitPresent()\r\n .then(function () { return _this._onVRFullScreenTriggered(); })\r\n .catch(function () { return _this._onVRFullScreenTriggered(); });\r\n }\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_4__[\"DomManagement\"].IsWindowObjectExist()) {\r\n window.removeEventListener('vrdisplaypointerrestricted', this._onVRDisplayPointerRestricted);\r\n window.removeEventListener('vrdisplaypointerunrestricted', this._onVRDisplayPointerUnrestricted);\r\n if (this._onVrDisplayConnect) {\r\n window.removeEventListener('vrdisplayconnect', this._onVrDisplayConnect);\r\n if (this._onVrDisplayDisconnect) {\r\n window.removeEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);\r\n }\r\n if (this._onVrDisplayPresentChange) {\r\n window.removeEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);\r\n }\r\n this._onVrDisplayConnect = null;\r\n this._onVrDisplayDisconnect = null;\r\n }\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._connectVREvents = function (canvas, document) {\r\n this._onVRDisplayPointerRestricted = function () {\r\n if (canvas) {\r\n canvas.requestPointerLock();\r\n }\r\n };\r\n this._onVRDisplayPointerUnrestricted = function () {\r\n if (!document.exitPointerLock) {\r\n return;\r\n }\r\n document.exitPointerLock();\r\n };\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_4__[\"DomManagement\"].IsWindowObjectExist()) {\r\n var hostWindow = this.getHostWindow();\r\n hostWindow.addEventListener('vrdisplaypointerrestricted', this._onVRDisplayPointerRestricted, false);\r\n hostWindow.addEventListener('vrdisplaypointerunrestricted', this._onVRDisplayPointerUnrestricted, false);\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._submitVRFrame = function () {\r\n // Submit frame to the vr device, if enabled\r\n if (this._vrDisplay && this._vrDisplay.isPresenting) {\r\n // TODO: We should only submit the frame if we read frameData successfully.\r\n try {\r\n this._vrDisplay.submitFrame();\r\n }\r\n catch (e) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].Warn(\"webVR submitFrame has had an unexpected failure: \" + e);\r\n }\r\n }\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype.isVRPresenting = function () {\r\n return this._vrDisplay && this._vrDisplay.isPresenting;\r\n};\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].prototype._requestVRFrame = function () {\r\n this._frameHandler = _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].QueueNewFrame(this._bindedRenderFunction, this._vrDisplay);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Extensions/index.ts\":\n/*!*************************************!*\\\n !*** ./Engines/Extensions/index.ts ***!\n \\*************************************/\n/*! exports provided: _OcclusionDataStorage, _forceTransformFeedbackToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _engine_occlusionQuery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.occlusionQuery */ \"./Engines/Extensions/engine.occlusionQuery.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _engine_occlusionQuery__WEBPACK_IMPORTED_MODULE_0__[\"_OcclusionDataStorage\"]; });\n\n/* harmony import */ var _engine_transformFeedback__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.transformFeedback */ \"./Engines/Extensions/engine.transformFeedback.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _engine_transformFeedback__WEBPACK_IMPORTED_MODULE_1__[\"_forceTransformFeedbackToBundle\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Native/nativeShaderProcessor.ts\":\n/*!*************************************************!*\\\n !*** ./Engines/Native/nativeShaderProcessor.ts ***!\n \\*************************************************/\n/*! exports provided: NativeShaderProcessor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NativeShaderProcessor\", function() { return NativeShaderProcessor; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../WebGL/webGL2ShaderProcessors */ \"./Engines/WebGL/webGL2ShaderProcessors.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\nvar _a;\r\n\r\n\r\n\r\n// These numbers must match the values for bgfx::Attrib::Enum\r\nvar attributeLocations = (_a = {},\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind] = 0,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind] = 1,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].TangentKind] = 2,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind] = 4,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].MatricesIndicesKind] = 8,\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].MatricesWeightsKind] = 9,\r\n _a);\r\n// Must match bgfx::Attrib::TexCoord0\r\nvar firstGenericAttributeLocation = 10;\r\n// Must match bgfx::Attrib::TexCoord7\r\nvar lastGenericAttributeLocation = 17;\r\n/** @hidden */\r\nvar NativeShaderProcessor = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NativeShaderProcessor, _super);\r\n function NativeShaderProcessor() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n NativeShaderProcessor.prototype.lineProcessor = function (line) {\r\n for (var _i = 0, _a = this._replacements; _i < _a.length; _i++) {\r\n var replacement = _a[_i];\r\n line = line.replace(replacement.searchValue, replacement.replaceValue);\r\n }\r\n return line;\r\n };\r\n NativeShaderProcessor.prototype.attributeProcessor = function (attribute) {\r\n var match = attribute.match(/attribute\\s+[^\\s]+\\s+([^\\s]+)\\s*(?:\\[.+\\])?\\s*;/);\r\n var name = match[1];\r\n var location = attributeLocations[name];\r\n if (location === undefined) {\r\n location = this._genericAttributeLocation++;\r\n if (location > lastGenericAttributeLocation) {\r\n throw new Error(\"Exceeded maximum custom attributes\");\r\n }\r\n }\r\n return \"layout(location=\" + location + \") \" + _super.prototype.attributeProcessor.call(this, attribute);\r\n };\r\n NativeShaderProcessor.prototype.varyingProcessor = function (varying, isFragment) {\r\n var location;\r\n if (isFragment) {\r\n location = this._varyingLocationMap[varying];\r\n }\r\n else {\r\n location = this._varyingLocationCount++;\r\n this._varyingLocationMap[varying] = location;\r\n }\r\n return \"layout(location=\" + location + \") \" + _super.prototype.varyingProcessor.call(this, varying, isFragment);\r\n };\r\n NativeShaderProcessor.prototype.uniformProcessor = function (uniform) {\r\n var match = uniform.match(/uniform\\s+([^\\s]+)\\s+([^\\s]+)\\s*(?:\\[.+\\])?\\s*;/);\r\n var type = match[1];\r\n var name = match[2];\r\n switch (type) {\r\n case \"sampler2D\":\r\n case \"samplerCube\": {\r\n var suffix = type.substr(7);\r\n var binding = this._textureCount++;\r\n this._replacements.push({ searchValue: new RegExp(\"\\\\b\" + name + \"\\\\b\"), replaceValue: \"sampler\" + suffix + \"(\" + name + \"Texture, \" + name + \")\" });\r\n return \"layout(binding=\" + binding + \") uniform texture\" + suffix + \" \" + name + \"Texture;\\nlayout(binding=\" + binding + \") uniform sampler \" + name + \";\";\r\n }\r\n }\r\n this._uniforms.push(uniform);\r\n return this._uniforms.length === 1 ? \"\" : \"\";\r\n };\r\n NativeShaderProcessor.prototype.preProcessor = function (code, defines, isFragment) {\r\n this._genericAttributeLocation = firstGenericAttributeLocation;\r\n if (!isFragment) {\r\n this._varyingLocationCount = 0;\r\n this._varyingLocationMap = {};\r\n }\r\n this._replacements = [];\r\n this._textureCount = 0;\r\n this._uniforms = [];\r\n return code;\r\n };\r\n NativeShaderProcessor.prototype.postProcessor = function (code, defines, isFragment) {\r\n code = _super.prototype.postProcessor.call(this, code, defines, isFragment);\r\n code = code.replace(\"\", \"uniform Frame {\\n\" + this._uniforms.join(\"\\n\") + \"\\n};\");\r\n code = code.replace(\"out vec4 glFragColor\", \"layout(location=0) out vec4 glFragColor\");\r\n return code;\r\n };\r\n return NativeShaderProcessor;\r\n}(_WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_1__[\"WebGL2ShaderProcessor\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineAndOperator.ts\":\n/*!*****************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineAndOperator.ts ***!\n \\*****************************************************************************/\n/*! exports provided: ShaderDefineAndOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineAndOperator\", function() { return ShaderDefineAndOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineAndOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineAndOperator, _super);\r\n function ShaderDefineAndOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineAndOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) && this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineAndOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.ts\":\n/*!************************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.ts ***!\n \\************************************************************************************/\n/*! exports provided: ShaderDefineArithmeticOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineArithmeticOperator\", function() { return ShaderDefineArithmeticOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineArithmeticOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineArithmeticOperator, _super);\r\n function ShaderDefineArithmeticOperator(define, operand, testValue) {\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.operand = operand;\r\n _this.testValue = testValue;\r\n return _this;\r\n }\r\n ShaderDefineArithmeticOperator.prototype.isTrue = function (preprocessors) {\r\n var value = preprocessors[this.define];\r\n if (value === undefined) {\r\n return false;\r\n }\r\n var condition = false;\r\n var left = parseInt(value);\r\n var right = parseInt(this.testValue);\r\n switch (this.operand) {\r\n case \">\":\r\n condition = left > right;\r\n break;\r\n case \"<\":\r\n condition = left < right;\r\n break;\r\n case \"<=\":\r\n condition = left <= right;\r\n break;\r\n case \">=\":\r\n condition = left >= right;\r\n break;\r\n case \"==\":\r\n condition = left === right;\r\n break;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineArithmeticOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.ts\":\n/*!***********************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.ts ***!\n \\***********************************************************************************/\n/*! exports provided: ShaderDefineIsDefinedOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineIsDefinedOperator\", function() { return ShaderDefineIsDefinedOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineIsDefinedOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineIsDefinedOperator, _super);\r\n function ShaderDefineIsDefinedOperator(define, not) {\r\n if (not === void 0) { not = false; }\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.not = not;\r\n return _this;\r\n }\r\n ShaderDefineIsDefinedOperator.prototype.isTrue = function (preprocessors) {\r\n var condition = preprocessors[this.define] !== undefined;\r\n if (this.not) {\r\n condition = !condition;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineIsDefinedOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/Operators/shaderDefineOrOperator.ts\":\n/*!****************************************************************************!*\\\n !*** ./Engines/Processors/Expressions/Operators/shaderDefineOrOperator.ts ***!\n \\****************************************************************************/\n/*! exports provided: ShaderDefineOrOperator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineOrOperator\", function() { return ShaderDefineOrOperator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shaderDefineExpression */ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderDefineOrOperator = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderDefineOrOperator, _super);\r\n function ShaderDefineOrOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineOrOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) || this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineOrOperator;\r\n}(_shaderDefineExpression__WEBPACK_IMPORTED_MODULE_1__[\"ShaderDefineExpression\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/Expressions/shaderDefineExpression.ts\":\n/*!******************************************************************!*\\\n !*** ./Engines/Processors/Expressions/shaderDefineExpression.ts ***!\n \\******************************************************************/\n/*! exports provided: ShaderDefineExpression */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderDefineExpression\", function() { return ShaderDefineExpression; });\n/** @hidden */\r\nvar ShaderDefineExpression = /** @class */ (function () {\r\n function ShaderDefineExpression() {\r\n }\r\n ShaderDefineExpression.prototype.isTrue = function (preprocessors) {\r\n return true;\r\n };\r\n return ShaderDefineExpression;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeConditionNode.ts\":\n/*!*******************************************************!*\\\n !*** ./Engines/Processors/shaderCodeConditionNode.ts ***!\n \\*******************************************************/\n/*! exports provided: ShaderCodeConditionNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeConditionNode\", function() { return ShaderCodeConditionNode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shaderCodeNode */ \"./Engines/Processors/shaderCodeNode.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderCodeConditionNode = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderCodeConditionNode, _super);\r\n function ShaderCodeConditionNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeConditionNode.prototype.process = function (preprocessors, options) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n var node = this.children[index];\r\n if (node.isValid(preprocessors)) {\r\n return node.process(preprocessors, options);\r\n }\r\n }\r\n return \"\";\r\n };\r\n return ShaderCodeConditionNode;\r\n}(_shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__[\"ShaderCodeNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeCursor.ts\":\n/*!************************************************!*\\\n !*** ./Engines/Processors/shaderCodeCursor.ts ***!\n \\************************************************/\n/*! exports provided: ShaderCodeCursor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeCursor\", function() { return ShaderCodeCursor; });\n/** @hidden */\r\nvar ShaderCodeCursor = /** @class */ (function () {\r\n function ShaderCodeCursor() {\r\n }\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"currentLine\", {\r\n get: function () {\r\n return this._lines[this.lineIndex];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"canRead\", {\r\n get: function () {\r\n return this.lineIndex < this._lines.length - 1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"lines\", {\r\n set: function (value) {\r\n this._lines = [];\r\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\r\n var line = value_1[_i];\r\n // Prevent removing line break in macros.\r\n if (line[0] === \"#\") {\r\n this._lines.push(line);\r\n continue;\r\n }\r\n var split = line.split(\";\");\r\n for (var index = 0; index < split.length; index++) {\r\n var subLine = split[index];\r\n subLine = subLine.trim();\r\n if (!subLine) {\r\n continue;\r\n }\r\n this._lines.push(subLine + (index !== split.length - 1 ? \";\" : \"\"));\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ShaderCodeCursor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeNode.ts\":\n/*!**********************************************!*\\\n !*** ./Engines/Processors/shaderCodeNode.ts ***!\n \\**********************************************/\n/*! exports provided: ShaderCodeNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeNode\", function() { return ShaderCodeNode; });\n/* harmony import */ var _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/stringTools */ \"./Misc/stringTools.ts\");\n\r\n/** @hidden */\r\nvar ShaderCodeNode = /** @class */ (function () {\r\n function ShaderCodeNode() {\r\n this.children = [];\r\n }\r\n ShaderCodeNode.prototype.isValid = function (preprocessors) {\r\n return true;\r\n };\r\n ShaderCodeNode.prototype.process = function (preprocessors, options) {\r\n var result = \"\";\r\n if (this.line) {\r\n var value = this.line;\r\n var processor = options.processor;\r\n if (processor) {\r\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\r\n if (processor.lineProcessor) {\r\n value = processor.lineProcessor(value, options.isFragment);\r\n }\r\n if (processor.attributeProcessor && _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__[\"StringTools\"].StartsWith(this.line, \"attribute\")) {\r\n value = processor.attributeProcessor(this.line);\r\n }\r\n else if (processor.varyingProcessor && _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__[\"StringTools\"].StartsWith(this.line, \"varying\")) {\r\n value = processor.varyingProcessor(this.line, options.isFragment);\r\n }\r\n else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && _Misc_stringTools__WEBPACK_IMPORTED_MODULE_0__[\"StringTools\"].StartsWith(this.line, \"uniform\")) {\r\n var regex = /uniform (.+) (.+)/;\r\n if (regex.test(this.line)) { // uniform\r\n if (processor.uniformProcessor) {\r\n value = processor.uniformProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n else { // Uniform buffer\r\n if (processor.uniformBufferProcessor) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n }\r\n }\r\n if (processor.endOfUniformBufferProcessor) {\r\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\r\n options.lookForClosingBracketForUniformBuffer = false;\r\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n }\r\n result += value + \"\\r\\n\";\r\n }\r\n this.children.forEach(function (child) {\r\n result += child.process(preprocessors, options);\r\n });\r\n if (this.additionalDefineKey) {\r\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\r\n }\r\n return result;\r\n };\r\n return ShaderCodeNode;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderCodeTestNode.ts\":\n/*!**************************************************!*\\\n !*** ./Engines/Processors/shaderCodeTestNode.ts ***!\n \\**************************************************/\n/*! exports provided: ShaderCodeTestNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderCodeTestNode\", function() { return ShaderCodeTestNode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shaderCodeNode */ \"./Engines/Processors/shaderCodeNode.ts\");\n\r\n\r\n/** @hidden */\r\nvar ShaderCodeTestNode = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderCodeTestNode, _super);\r\n function ShaderCodeTestNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeTestNode.prototype.isValid = function (preprocessors) {\r\n return this.testExpression.isTrue(preprocessors);\r\n };\r\n return ShaderCodeTestNode;\r\n}(_shaderCodeNode__WEBPACK_IMPORTED_MODULE_1__[\"ShaderCodeNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/Processors/shaderProcessor.ts\":\n/*!***********************************************!*\\\n !*** ./Engines/Processors/shaderProcessor.ts ***!\n \\***********************************************/\n/*! exports provided: ShaderProcessor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderProcessor\", function() { return ShaderProcessor; });\n/* harmony import */ var _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shaderCodeNode */ \"./Engines/Processors/shaderCodeNode.ts\");\n/* harmony import */ var _shaderCodeCursor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shaderCodeCursor */ \"./Engines/Processors/shaderCodeCursor.ts\");\n/* harmony import */ var _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shaderCodeConditionNode */ \"./Engines/Processors/shaderCodeConditionNode.ts\");\n/* harmony import */ var _shaderCodeTestNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shaderCodeTestNode */ \"./Engines/Processors/shaderCodeTestNode.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineIsDefinedOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineOrOperator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineOrOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineOrOperator.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineAndOperator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineAndOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineAndOperator.ts\");\n/* harmony import */ var _Expressions_Operators_shaderDefineArithmeticOperator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Expressions/Operators/shaderDefineArithmeticOperator */ \"./Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar ShaderProcessor = /** @class */ (function () {\r\n function ShaderProcessor() {\r\n }\r\n ShaderProcessor.Process = function (sourceCode, options, callback) {\r\n var _this = this;\r\n this._ProcessIncludes(sourceCode, options, function (codeWithIncludes) {\r\n var migratedCode = _this._ProcessShaderConversion(codeWithIncludes, options);\r\n callback(migratedCode);\r\n });\r\n };\r\n ShaderProcessor._ProcessPrecision = function (source, options) {\r\n var shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\r\n if (source.indexOf(\"precision highp float\") === -1) {\r\n if (!shouldUseHighPrecisionShader) {\r\n source = \"precision mediump float;\\n\" + source;\r\n }\r\n else {\r\n source = \"precision highp float;\\n\" + source;\r\n }\r\n }\r\n else {\r\n if (!shouldUseHighPrecisionShader) { // Moving highp to mediump\r\n source = source.replace(\"precision highp float\", \"precision mediump float\");\r\n }\r\n }\r\n return source;\r\n };\r\n ShaderProcessor._ExtractOperation = function (expression) {\r\n var regex = /defined\\((.+)\\)/;\r\n var match = regex.exec(expression);\r\n if (match && match.length) {\r\n return new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](match[1].trim(), expression[0] === \"!\");\r\n }\r\n var operators = [\"==\", \">=\", \"<=\", \"<\", \">\"];\r\n var operator = \"\";\r\n var indexOperator = 0;\r\n for (var _i = 0, operators_1 = operators; _i < operators_1.length; _i++) {\r\n operator = operators_1[_i];\r\n indexOperator = expression.indexOf(operator);\r\n if (indexOperator > -1) {\r\n break;\r\n }\r\n }\r\n if (indexOperator === -1) {\r\n return new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](expression);\r\n }\r\n var define = expression.substring(0, indexOperator).trim();\r\n var value = expression.substring(indexOperator + operator.length).trim();\r\n return new _Expressions_Operators_shaderDefineArithmeticOperator__WEBPACK_IMPORTED_MODULE_7__[\"ShaderDefineArithmeticOperator\"](define, operator, value);\r\n };\r\n ShaderProcessor._BuildSubExpression = function (expression) {\r\n var indexOr = expression.indexOf(\"||\");\r\n if (indexOr === -1) {\r\n var indexAnd = expression.indexOf(\"&&\");\r\n if (indexAnd > -1) {\r\n var andOperator = new _Expressions_Operators_shaderDefineAndOperator__WEBPACK_IMPORTED_MODULE_6__[\"ShaderDefineAndOperator\"]();\r\n var leftPart = expression.substring(0, indexAnd).trim();\r\n var rightPart = expression.substring(indexAnd + 2).trim();\r\n andOperator.leftOperand = this._BuildSubExpression(leftPart);\r\n andOperator.rightOperand = this._BuildSubExpression(rightPart);\r\n return andOperator;\r\n }\r\n else {\r\n return this._ExtractOperation(expression);\r\n }\r\n }\r\n else {\r\n var orOperator = new _Expressions_Operators_shaderDefineOrOperator__WEBPACK_IMPORTED_MODULE_5__[\"ShaderDefineOrOperator\"]();\r\n var leftPart = expression.substring(0, indexOr).trim();\r\n var rightPart = expression.substring(indexOr + 2).trim();\r\n orOperator.leftOperand = this._BuildSubExpression(leftPart);\r\n orOperator.rightOperand = this._BuildSubExpression(rightPart);\r\n return orOperator;\r\n }\r\n };\r\n ShaderProcessor._BuildExpression = function (line, start) {\r\n var node = new _shaderCodeTestNode__WEBPACK_IMPORTED_MODULE_3__[\"ShaderCodeTestNode\"]();\r\n var command = line.substring(0, start);\r\n var expression = line.substring(start).trim();\r\n if (command === \"#ifdef\") {\r\n node.testExpression = new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](expression);\r\n }\r\n else if (command === \"#ifndef\") {\r\n node.testExpression = new _Expressions_Operators_shaderDefineIsDefinedOperator__WEBPACK_IMPORTED_MODULE_4__[\"ShaderDefineIsDefinedOperator\"](expression, true);\r\n }\r\n else {\r\n node.testExpression = this._BuildSubExpression(expression);\r\n }\r\n return node;\r\n };\r\n ShaderProcessor._MoveCursorWithinIf = function (cursor, rootNode, ifNode) {\r\n var line = cursor.currentLine;\r\n while (this._MoveCursor(cursor, ifNode)) {\r\n line = cursor.currentLine;\r\n var first5 = line.substring(0, 5).toLowerCase();\r\n if (first5 === \"#else\") {\r\n var elseNode = new _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__[\"ShaderCodeNode\"]();\r\n rootNode.children.push(elseNode);\r\n this._MoveCursor(cursor, elseNode);\r\n return;\r\n }\r\n else if (first5 === \"#elif\") {\r\n var elifNode = this._BuildExpression(line, 5);\r\n rootNode.children.push(elifNode);\r\n ifNode = elifNode;\r\n }\r\n }\r\n };\r\n ShaderProcessor._MoveCursor = function (cursor, rootNode) {\r\n while (cursor.canRead) {\r\n cursor.lineIndex++;\r\n var line = cursor.currentLine;\r\n var keywords = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\r\n var matches = keywords.exec(line);\r\n if (matches && matches.length) {\r\n var keyword = matches[0];\r\n switch (keyword) {\r\n case \"#ifdef\": {\r\n var newRootNode = new _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__[\"ShaderCodeConditionNode\"]();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 6);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#else\":\r\n case \"#elif\":\r\n return true;\r\n case \"#endif\":\r\n return false;\r\n case \"#ifndef\": {\r\n var newRootNode = new _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__[\"ShaderCodeConditionNode\"]();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 7);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#if\": {\r\n var newRootNode = new _shaderCodeConditionNode__WEBPACK_IMPORTED_MODULE_2__[\"ShaderCodeConditionNode\"]();\r\n var ifNode = this._BuildExpression(line, 3);\r\n rootNode.children.push(newRootNode);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n var newNode = new _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__[\"ShaderCodeNode\"]();\r\n newNode.line = line;\r\n rootNode.children.push(newNode);\r\n // Detect additional defines\r\n if (line[0] === \"#\" && line[1] === \"d\") {\r\n var split = line.replace(\";\", \"\").split(\" \");\r\n newNode.additionalDefineKey = split[1];\r\n if (split.length === 3) {\r\n newNode.additionalDefineValue = split[2];\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n ShaderProcessor._EvaluatePreProcessors = function (sourceCode, preprocessors, options) {\r\n var rootNode = new _shaderCodeNode__WEBPACK_IMPORTED_MODULE_0__[\"ShaderCodeNode\"]();\r\n var cursor = new _shaderCodeCursor__WEBPACK_IMPORTED_MODULE_1__[\"ShaderCodeCursor\"]();\r\n cursor.lineIndex = -1;\r\n cursor.lines = sourceCode.split(\"\\n\");\r\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\r\n this._MoveCursor(cursor, rootNode);\r\n // Recompose\r\n return rootNode.process(preprocessors, options);\r\n };\r\n ShaderProcessor._PreparePreProcessors = function (options) {\r\n var defines = options.defines;\r\n var preprocessors = {};\r\n for (var _i = 0, defines_1 = defines; _i < defines_1.length; _i++) {\r\n var define = defines_1[_i];\r\n var keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\r\n var split = keyValue.split(\" \");\r\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\r\n }\r\n preprocessors[\"GL_ES\"] = \"true\";\r\n preprocessors[\"__VERSION__\"] = options.version;\r\n preprocessors[options.platformName] = \"true\";\r\n return preprocessors;\r\n };\r\n ShaderProcessor._ProcessShaderConversion = function (sourceCode, options) {\r\n var preparedSourceCode = this._ProcessPrecision(sourceCode, options);\r\n if (!options.processor) {\r\n return preparedSourceCode;\r\n }\r\n // Already converted\r\n if (preparedSourceCode.indexOf(\"#version 3\") !== -1) {\r\n return preparedSourceCode.replace(\"#version 300 es\", \"\");\r\n }\r\n var defines = options.defines;\r\n var preprocessors = this._PreparePreProcessors(options);\r\n // General pre processing\r\n if (options.processor.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n preparedSourceCode = this._EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n // Post processing\r\n if (options.processor.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n return preparedSourceCode;\r\n };\r\n ShaderProcessor._ProcessIncludes = function (sourceCode, options, callback) {\r\n var _this = this;\r\n var regex = /#include<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\r\n var match = regex.exec(sourceCode);\r\n var returnValue = new String(sourceCode);\r\n while (match != null) {\r\n var includeFile = match[1];\r\n // Uniform declaration\r\n if (includeFile.indexOf(\"__decl__\") !== -1) {\r\n includeFile = includeFile.replace(/__decl__/, \"\");\r\n if (options.supportsUniformBuffers) {\r\n includeFile = includeFile.replace(/Vertex/, \"Ubo\");\r\n includeFile = includeFile.replace(/Fragment/, \"Ubo\");\r\n }\r\n includeFile = includeFile + \"Declaration\";\r\n }\r\n if (options.includesShadersStore[includeFile]) {\r\n // Substitution\r\n var includeContent = options.includesShadersStore[includeFile];\r\n if (match[2]) {\r\n var splits = match[3].split(\",\");\r\n for (var index = 0; index < splits.length; index += 2) {\r\n var source = new RegExp(splits[index], \"g\");\r\n var dest = splits[index + 1];\r\n includeContent = includeContent.replace(source, dest);\r\n }\r\n }\r\n if (match[4]) {\r\n var indexString = match[5];\r\n if (indexString.indexOf(\"..\") !== -1) {\r\n var indexSplits = indexString.split(\"..\");\r\n var minIndex = parseInt(indexSplits[0]);\r\n var maxIndex = parseInt(indexSplits[1]);\r\n var sourceIncludeContent = includeContent.slice(0);\r\n includeContent = \"\";\r\n if (isNaN(maxIndex)) {\r\n maxIndex = options.indexParameters[indexSplits[1]];\r\n }\r\n for (var i = minIndex; i < maxIndex; i++) {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n sourceIncludeContent = sourceIncludeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent += sourceIncludeContent.replace(/\\{X\\}/g, i.toString()) + \"\\n\";\r\n }\r\n }\r\n else {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n includeContent = includeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent = includeContent.replace(/\\{X\\}/g, indexString);\r\n }\r\n }\r\n // Replace\r\n returnValue = returnValue.replace(match[0], includeContent);\r\n }\r\n else {\r\n var includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadFile(includeShaderUrl, function (fileContent) {\r\n options.includesShadersStore[includeFile] = fileContent;\r\n _this._ProcessIncludes(returnValue, options, callback);\r\n });\r\n return;\r\n }\r\n match = regex.exec(sourceCode);\r\n }\r\n callback(returnValue);\r\n };\r\n return ShaderProcessor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/WebGL/webGL2ShaderProcessors.ts\":\n/*!*************************************************!*\\\n !*** ./Engines/WebGL/webGL2ShaderProcessors.ts ***!\n \\*************************************************/\n/*! exports provided: WebGL2ShaderProcessor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return WebGL2ShaderProcessor; });\n/** @hidden */\r\nvar WebGL2ShaderProcessor = /** @class */ (function () {\r\n function WebGL2ShaderProcessor() {\r\n }\r\n WebGL2ShaderProcessor.prototype.attributeProcessor = function (attribute) {\r\n return attribute.replace(\"attribute\", \"in\");\r\n };\r\n WebGL2ShaderProcessor.prototype.varyingProcessor = function (varying, isFragment) {\r\n return varying.replace(\"varying\", isFragment ? \"in\" : \"out\");\r\n };\r\n WebGL2ShaderProcessor.prototype.postProcessor = function (code, defines, isFragment) {\r\n var hasDrawBuffersExtension = code.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;\r\n // Remove extensions\r\n var regex = /#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;\r\n code = code.replace(regex, \"\");\r\n // Replace instructions\r\n code = code.replace(/texture2D\\s*\\(/g, \"texture(\");\r\n if (isFragment) {\r\n code = code.replace(/texture2DLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCubeLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCube\\s*\\(/g, \"texture(\");\r\n code = code.replace(/gl_FragDepthEXT/g, \"gl_FragDepth\");\r\n code = code.replace(/gl_FragColor/g, \"glFragColor\");\r\n code = code.replace(/gl_FragData/g, \"glFragData\");\r\n code = code.replace(/void\\s+?main\\s*\\(/g, (hasDrawBuffersExtension ? \"\" : \"out vec4 glFragColor;\\n\") + \"void main(\");\r\n }\r\n else {\r\n var hasMultiviewExtension = defines.indexOf(\"#define MULTIVIEW\") !== -1;\r\n if (hasMultiviewExtension) {\r\n return \"#extension GL_OVR_multiview2 : require\\nlayout (num_views = 2) in;\\n\" + code;\r\n }\r\n }\r\n return code;\r\n };\r\n return WebGL2ShaderProcessor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/WebGL/webGLPipelineContext.ts\":\n/*!***********************************************!*\\\n !*** ./Engines/WebGL/webGLPipelineContext.ts ***!\n \\***********************************************/\n/*! exports provided: WebGLPipelineContext */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return WebGLPipelineContext; });\n/** @hidden */\r\nvar WebGLPipelineContext = /** @class */ (function () {\r\n function WebGLPipelineContext() {\r\n }\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isAsync\", {\r\n get: function () {\r\n return this.isParallelCompiled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isReady\", {\r\n get: function () {\r\n if (this.program) {\r\n if (this.isParallelCompiled) {\r\n return this.engine._isRenderingStateCompiled(this);\r\n }\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WebGLPipelineContext.prototype._handlesSpectorRebuildCallback = function (onCompiled) {\r\n if (onCompiled && this.program) {\r\n onCompiled(this.program);\r\n }\r\n };\r\n return WebGLPipelineContext;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/constants.ts\":\n/*!******************************!*\\\n !*** ./Engines/constants.ts ***!\n \\******************************/\n/*! exports provided: Constants */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return Constants; });\n/** Defines the cross module used constants to avoid circular dependncies */\r\nvar Constants = /** @class */ (function () {\r\n function Constants() {\r\n }\r\n /** Defines that alpha blending is disabled */\r\n Constants.ALPHA_DISABLE = 0;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + DEST */\r\n Constants.ALPHA_ADD = 1;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_COMBINE = 2;\r\n /** Defines that alpha blending to DEST - SRC * DEST */\r\n Constants.ALPHA_SUBTRACT = 3;\r\n /** Defines that alpha blending to SRC * DEST */\r\n Constants.ALPHA_MULTIPLY = 4;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Constants.ALPHA_MAXIMIZED = 5;\r\n /** Defines that alpha blending to SRC + DEST */\r\n Constants.ALPHA_ONEONE = 6;\r\n /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_PREMULTIPLIED = 7;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\r\n /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */\r\n Constants.ALPHA_INTERPOLATE = 9;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_SCREENMODE = 10;\r\n /** Defines that the ressource is not delayed*/\r\n Constants.DELAYLOADSTATE_NONE = 0;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Constants.DELAYLOADSTATE_LOADED = 1;\r\n /** Defines that the ressource is currently delay loading */\r\n Constants.DELAYLOADSTATE_LOADING = 2;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Constants.DELAYLOADSTATE_NOTLOADED = 4;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Constants.NEVER = 0x0200;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Constants.ALWAYS = 0x0207;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Constants.LESS = 0x0201;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Constants.EQUAL = 0x0202;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Constants.LEQUAL = 0x0203;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Constants.GREATER = 0x0204;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Constants.GEQUAL = 0x0206;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Constants.NOTEQUAL = 0x0205;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Constants.KEEP = 0x1E00;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Constants.REPLACE = 0x1E01;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Constants.INCR = 0x1E02;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Constants.DECR = 0x1E03;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Constants.INVERT = 0x150A;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Constants.INCR_WRAP = 0x8507;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Constants.DECR_WRAP = 0x8508;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Constants.TEXTURE_MIRROR_ADDRESSMODE = 2;\r\n /** ALPHA */\r\n Constants.TEXTUREFORMAT_ALPHA = 0;\r\n /** LUMINANCE */\r\n Constants.TEXTUREFORMAT_LUMINANCE = 1;\r\n /** LUMINANCE_ALPHA */\r\n Constants.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\r\n /** RGB */\r\n Constants.TEXTUREFORMAT_RGB = 4;\r\n /** RGBA */\r\n Constants.TEXTUREFORMAT_RGBA = 5;\r\n /** RED */\r\n Constants.TEXTUREFORMAT_RED = 6;\r\n /** RED (2nd reference) */\r\n Constants.TEXTUREFORMAT_R = 6;\r\n /** RG */\r\n Constants.TEXTUREFORMAT_RG = 7;\r\n /** RED_INTEGER */\r\n Constants.TEXTUREFORMAT_RED_INTEGER = 8;\r\n /** RED_INTEGER (2nd reference) */\r\n Constants.TEXTUREFORMAT_R_INTEGER = 8;\r\n /** RG_INTEGER */\r\n Constants.TEXTUREFORMAT_RG_INTEGER = 9;\r\n /** RGB_INTEGER */\r\n Constants.TEXTUREFORMAT_RGB_INTEGER = 10;\r\n /** RGBA_INTEGER */\r\n Constants.TEXTUREFORMAT_RGBA_INTEGER = 11;\r\n /** UNSIGNED_BYTE */\r\n Constants.TEXTURETYPE_UNSIGNED_BYTE = 0;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Constants.TEXTURETYPE_UNSIGNED_INT = 0;\r\n /** FLOAT */\r\n Constants.TEXTURETYPE_FLOAT = 1;\r\n /** HALF_FLOAT */\r\n Constants.TEXTURETYPE_HALF_FLOAT = 2;\r\n /** BYTE */\r\n Constants.TEXTURETYPE_BYTE = 3;\r\n /** SHORT */\r\n Constants.TEXTURETYPE_SHORT = 4;\r\n /** UNSIGNED_SHORT */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT = 5;\r\n /** INT */\r\n Constants.TEXTURETYPE_INT = 6;\r\n /** UNSIGNED_INT */\r\n Constants.TEXTURETYPE_UNSIGNED_INTEGER = 7;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\r\n /** UNSIGNED_INT_24_8 */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Constants.TEXTURE_NEAREST_SAMPLINGMODE = 1;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Constants.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 1;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Constants.TEXTURE_NEAREST_LINEAR = 7;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Constants.TEXTURE_NEAREST_NEAREST = 8;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** mag = linear and min = linear and mip = none */\r\n Constants.TEXTURE_LINEAR_LINEAR = 11;\r\n /** mag = linear and min = nearest and mip = none */\r\n Constants.TEXTURE_LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Constants.TEXTURE_EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Constants.TEXTURE_SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Constants.TEXTURE_PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Constants.TEXTURE_CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Constants.TEXTURE_PROJECTION_MODE = 4;\r\n /** Skybox coordinates mode */\r\n Constants.TEXTURE_SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Constants.TEXTURE_INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Constants.TEXTURE_EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Constants.SCALEMODE_FLOOR = 1;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Constants.SCALEMODE_NEAREST = 2;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Constants.SCALEMODE_CEILING = 3;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Constants.MATERIAL_TextureDirtyFlag = 1;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Constants.MATERIAL_LightDirtyFlag = 2;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Constants.MATERIAL_FresnelDirtyFlag = 4;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Constants.MATERIAL_AttributesDirtyFlag = 8;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Constants.MATERIAL_MiscDirtyFlag = 16;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Constants.MATERIAL_AllDirtyFlag = 31;\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Constants.MATERIAL_TriangleFillMode = 0;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Constants.MATERIAL_WireFrameFillMode = 1;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Constants.MATERIAL_PointFillMode = 2;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Constants.MATERIAL_PointListDrawMode = 3;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Constants.MATERIAL_LineListDrawMode = 4;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Constants.MATERIAL_LineLoopDrawMode = 5;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Constants.MATERIAL_LineStripDrawMode = 6;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Constants.MATERIAL_TriangleStripDrawMode = 7;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Constants.MATERIAL_TriangleFanDrawMode = 8;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Constants.MATERIAL_ClockWiseSideOrientation = 0;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Constants.MATERIAL_CounterClockWiseSideOrientation = 1;\r\n /**\r\n * Nothing\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_NothingTrigger = 0;\r\n /**\r\n * On pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickTrigger = 1;\r\n /**\r\n * On left pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLeftPickTrigger = 2;\r\n /**\r\n * On right pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnRightPickTrigger = 3;\r\n /**\r\n * On center pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnCenterPickTrigger = 4;\r\n /**\r\n * On pick down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickDownTrigger = 5;\r\n /**\r\n * On double pick\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnDoublePickTrigger = 6;\r\n /**\r\n * On pick up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickUpTrigger = 7;\r\n /**\r\n * On pick out.\r\n * This trigger will only be raised if you also declared a OnPickDown\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickOutTrigger = 16;\r\n /**\r\n * On long press\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLongPressTrigger = 8;\r\n /**\r\n * On pointer over\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOverTrigger = 9;\r\n /**\r\n * On pointer out\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOutTrigger = 10;\r\n /**\r\n * On every frame\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnEveryFrameTrigger = 11;\r\n /**\r\n * On intersection enter\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionEnterTrigger = 12;\r\n /**\r\n * On intersection exit\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionExitTrigger = 13;\r\n /**\r\n * On key down\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyDownTrigger = 14;\r\n /**\r\n * On key up\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyUpTrigger = 15;\r\n /**\r\n * Billboard mode will only apply to Y axis\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_Y = 2;\r\n /**\r\n * Billboard mode will apply to all axes\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_STRETCHED = 8;\r\n /**\r\n * Gets or sets base Assets URL\r\n */\r\n Constants.PARTICLES_BaseAssetsUrl = \"https://assets.babylonjs.com/particles\";\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_STANDARD = 0;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\r\n /**\r\n * No logging while loading\r\n */\r\n Constants.SCENELOADER_NO_LOGGING = 0;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n Constants.SCENELOADER_MINIMAL_LOGGING = 1;\r\n /**\r\n * Summary logging while loading\r\n */\r\n Constants.SCENELOADER_SUMMARY_LOGGING = 2;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n Constants.SCENELOADER_DETAILED_LOGGING = 3;\r\n return Constants;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/engine.ts\":\n/*!***************************!*\\\n !*** ./Engines/engine.ts ***!\n \\***************************/\n/*! exports provided: InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return InstancingAttributeInfo; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return DepthTextureCreationOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return EngineCapabilities; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return Engine; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_performanceMonitor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/performanceMonitor */ \"./Misc/performanceMonitor.ts\");\n/* harmony import */ var _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/stringDictionary */ \"./Misc/stringDictionary.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _States_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../States/index */ \"./States/index.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _engineStore__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./WebGL/webGLPipelineContext */ \"./Engines/WebGL/webGLPipelineContext.ts\");\n/* harmony import */ var _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Meshes/WebGL/webGLDataBuffer */ \"./Meshes/WebGL/webGLDataBuffer.ts\");\n/* harmony import */ var _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./WebGL/webGL2ShaderProcessors */ \"./Engines/WebGL/webGL2ShaderProcessors.ts\");\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Keeps track of all the buffer info used in engine.\r\n */\r\nvar BufferPointer = /** @class */ (function () {\r\n function BufferPointer() {\r\n }\r\n return BufferPointer;\r\n}());\r\n/**\r\n * Interface for attribute information associated with buffer instanciation\r\n */\r\nvar InstancingAttributeInfo = /** @class */ (function () {\r\n function InstancingAttributeInfo() {\r\n }\r\n return InstancingAttributeInfo;\r\n}());\r\n\r\n/**\r\n * Define options used to create a depth texture\r\n */\r\nvar DepthTextureCreationOptions = /** @class */ (function () {\r\n function DepthTextureCreationOptions() {\r\n }\r\n return DepthTextureCreationOptions;\r\n}());\r\n\r\n/**\r\n * Class used to describe the capabilities of the engine relatively to the current browser\r\n */\r\nvar EngineCapabilities = /** @class */ (function () {\r\n function EngineCapabilities() {\r\n /** Max number of texture samples for MSAA */\r\n this.maxMSAASamples = 1;\r\n }\r\n return EngineCapabilities;\r\n}());\r\n\r\n/**\r\n * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio\r\n */\r\nvar Engine = /** @class */ (function () {\r\n /**\r\n * Creates a new engine\r\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context\r\n * @param antialias defines enable antialiasing (default: false)\r\n * @param options defines further options to be sent to the getContext() function\r\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\r\n */\r\n function Engine(canvasOrContext, antialias, options, adaptToDeviceRatio) {\r\n var _this = this;\r\n if (adaptToDeviceRatio === void 0) { adaptToDeviceRatio = false; }\r\n /**\r\n * Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required\r\n */\r\n this.forcePOTTextures = false;\r\n /**\r\n * Gets a boolean indicating if the engine is currently rendering in fullscreen mode\r\n */\r\n this.isFullscreen = false;\r\n /**\r\n * Gets a boolean indicating if the pointer is currently locked\r\n */\r\n this.isPointerLock = false;\r\n /**\r\n * Gets or sets a boolean indicating if back faces must be culled (true by default)\r\n */\r\n this.cullBackFaces = true;\r\n /**\r\n * Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foregroun\r\n */\r\n this.renderEvenInBackground = true;\r\n /**\r\n * Gets or sets a boolean indicating that cache can be kept between frames\r\n */\r\n this.preventCacheWipeBetweenFrames = false;\r\n /**\r\n * Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest\r\n **/\r\n this.enableOfflineSupport = false;\r\n /**\r\n * Gets or sets a boolean to enable/disable checking manifest if IndexedDB support is enabled (js will always consider the database is up to date)\r\n **/\r\n this.disableManifestCheck = false;\r\n /**\r\n * Gets the list of created scenes\r\n */\r\n this.scenes = new Array();\r\n /**\r\n * Event raised when a new scene is created\r\n */\r\n this.onNewSceneAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Gets the list of created postprocesses\r\n */\r\n this.postProcesses = new Array();\r\n /** Gets or sets a boolean indicating if the engine should validate programs after compilation */\r\n this.validateShaderPrograms = false;\r\n // Observables\r\n /**\r\n * Observable event triggered each time the rendering canvas is resized\r\n */\r\n this.onResizeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time the canvas loses focus\r\n */\r\n this.onCanvasBlurObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time the canvas gains focus\r\n */\r\n this.onCanvasFocusObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time the canvas receives pointerout event\r\n */\r\n this.onCanvasPointerOutObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable event triggered before each texture is initialized\r\n */\r\n this.onBeforeTextureInitObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n // Uniform buffers list\r\n /**\r\n * Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported\r\n */\r\n this.disableUniformBuffers = false;\r\n /** @hidden */\r\n this._uniformBuffers = new Array();\r\n // Observables\r\n /**\r\n * Observable raised when the engine begins a new frame\r\n */\r\n this.onBeginFrameObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * If set, will be used to request the next animation frame for the render loop\r\n */\r\n this.customAnimationFrameRequester = null;\r\n /**\r\n * Observable raised when the engine ends the current frame\r\n */\r\n this.onEndFrameObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable raised when the engine is about to compile a shader\r\n */\r\n this.onBeforeShaderCompilationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable raised when the engine has jsut compiled a shader\r\n */\r\n this.onAfterShaderCompilationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._windowIsBackground = false;\r\n this._webGLVersion = 1.0;\r\n this._highPrecisionShadersAllowed = true;\r\n /** @hidden */\r\n this._badOS = false;\r\n /** @hidden */\r\n this._badDesktopOS = false;\r\n this._colorWrite = true;\r\n /** @hidden */\r\n this._drawCalls = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_16__[\"PerfCounter\"]();\r\n this._renderingQueueLaunched = false;\r\n this._activeRenderLoops = new Array();\r\n // Deterministic lockstepMaxSteps\r\n this._deterministicLockstep = false;\r\n this._lockstepMaxSteps = 4;\r\n // Lost context\r\n /**\r\n * Observable signaled when a context lost event is raised\r\n */\r\n this.onContextLostObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable signaled when a context restored event is raised\r\n */\r\n this.onContextRestoredObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._contextWasLost = false;\r\n /** @hidden */\r\n this._doNotHandleContextLost = false;\r\n // FPS\r\n this._performanceMonitor = new _Misc_performanceMonitor__WEBPACK_IMPORTED_MODULE_2__[\"PerformanceMonitor\"]();\r\n this._fps = 60;\r\n this._deltaTime = 0;\r\n /**\r\n * Turn this value on if you want to pause FPS computation when in background\r\n */\r\n this.disablePerformanceMonitorInBackground = false;\r\n /**\r\n * Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported\r\n */\r\n this.disableVertexArrayObjects = false;\r\n // States\r\n /** @hidden */\r\n this._depthCullingState = new _States_index__WEBPACK_IMPORTED_MODULE_6__[\"_DepthCullingState\"]();\r\n /** @hidden */\r\n this._stencilState = new _States_index__WEBPACK_IMPORTED_MODULE_6__[\"_StencilState\"]();\r\n /** @hidden */\r\n this._alphaState = new _States_index__WEBPACK_IMPORTED_MODULE_6__[\"_AlphaState\"]();\r\n /** @hidden */\r\n this._alphaMode = Engine.ALPHA_DISABLE;\r\n // Cache\r\n /** @hidden */\r\n this._internalTexturesCache = new Array();\r\n /** @hidden */\r\n this._activeChannel = 0;\r\n this._currentTextureChannel = -1;\r\n /** @hidden */\r\n this._boundTexturesCache = {};\r\n this._compiledEffects = {};\r\n this._vertexAttribArraysEnabled = [];\r\n this._uintIndicesCurrentlySet = false;\r\n this._currentBoundBuffer = new Array();\r\n /** @hidden */\r\n this._currentFramebuffer = null;\r\n this._currentBufferPointers = new Array();\r\n this._currentInstanceLocations = new Array();\r\n this._currentInstanceBuffers = new Array();\r\n this._vaoRecordInProgress = false;\r\n this._mustWipeVertexAttributes = false;\r\n this._nextFreeTextureSlots = new Array();\r\n this._maxSimultaneousTextures = 0;\r\n this._activeRequests = new Array();\r\n // Hardware supported Compressed Textures\r\n this._texturesSupported = new Array();\r\n /**\r\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\r\n */\r\n this.premultipliedAlpha = true;\r\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\r\n this._unpackFlipYCached = null;\r\n /**\r\n * In case you are sharing the context with other applications, it might\r\n * be interested to not cache the unpack flip y state to ensure a consistent\r\n * value would be set.\r\n */\r\n this.enableUnpackFlipYCached = true;\r\n this._boundUniforms = {};\r\n var canvas = null;\r\n Engine.Instances.push(this);\r\n if (!canvasOrContext) {\r\n return;\r\n }\r\n options = options || {};\r\n if (canvasOrContext.getContext) {\r\n canvas = canvasOrContext;\r\n this._renderingCanvas = canvas;\r\n if (antialias != null) {\r\n options.antialias = antialias;\r\n }\r\n if (options.deterministicLockstep === undefined) {\r\n options.deterministicLockstep = false;\r\n }\r\n if (options.lockstepMaxSteps === undefined) {\r\n options.lockstepMaxSteps = 4;\r\n }\r\n if (options.preserveDrawingBuffer === undefined) {\r\n options.preserveDrawingBuffer = false;\r\n }\r\n if (options.audioEngine === undefined) {\r\n options.audioEngine = true;\r\n }\r\n if (options.stencil === undefined) {\r\n options.stencil = true;\r\n }\r\n if (options.premultipliedAlpha === false) {\r\n this.premultipliedAlpha = false;\r\n }\r\n this._deterministicLockstep = options.deterministicLockstep;\r\n this._lockstepMaxSteps = options.lockstepMaxSteps;\r\n this._doNotHandleContextLost = options.doNotHandleContextLost ? true : false;\r\n // Exceptions\r\n if (navigator && navigator.userAgent) {\r\n var ua = navigator.userAgent;\r\n for (var _i = 0, _a = Engine.ExceptionList; _i < _a.length; _i++) {\r\n var exception = _a[_i];\r\n var key = exception.key;\r\n var targets = exception.targets;\r\n var check = new RegExp(key);\r\n if (check.test(ua)) {\r\n if (exception.capture && exception.captureConstraint) {\r\n var capture = exception.capture;\r\n var constraint = exception.captureConstraint;\r\n var regex = new RegExp(capture);\r\n var matches = regex.exec(ua);\r\n if (matches && matches.length > 0) {\r\n var capturedValue = parseInt(matches[matches.length - 1]);\r\n if (capturedValue >= constraint) {\r\n continue;\r\n }\r\n }\r\n }\r\n for (var _b = 0, targets_1 = targets; _b < targets_1.length; _b++) {\r\n var target = targets_1[_b];\r\n switch (target) {\r\n case \"uniformBuffer\":\r\n this.disableUniformBuffers = true;\r\n break;\r\n case \"vao\":\r\n this.disableVertexArrayObjects = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Context lost\r\n if (!this._doNotHandleContextLost) {\r\n this._onContextLost = function (evt) {\r\n evt.preventDefault();\r\n _this._contextWasLost = true;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"WebGL context lost.\");\r\n _this.onContextLostObservable.notifyObservers(_this);\r\n };\r\n this._onContextRestored = function () {\r\n // Adding a timeout to avoid race condition at browser level\r\n setTimeout(function () {\r\n // Rebuild gl context\r\n _this._initGLContext();\r\n // Rebuild effects\r\n _this._rebuildEffects();\r\n // Rebuild textures\r\n _this._rebuildInternalTextures();\r\n // Rebuild buffers\r\n _this._rebuildBuffers();\r\n // Cache\r\n _this.wipeCaches(true);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"WebGL context successfully restored.\");\r\n _this.onContextRestoredObservable.notifyObservers(_this);\r\n _this._contextWasLost = false;\r\n }, 0);\r\n };\r\n canvas.addEventListener(\"webglcontextlost\", this._onContextLost, false);\r\n canvas.addEventListener(\"webglcontextrestored\", this._onContextRestored, false);\r\n options.powerPreference = \"high-performance\";\r\n }\r\n // GL\r\n if (!options.disableWebGL2Support) {\r\n try {\r\n this._gl = (canvas.getContext(\"webgl2\", options) || canvas.getContext(\"experimental-webgl2\", options));\r\n if (this._gl) {\r\n this._webGLVersion = 2.0;\r\n // Prevent weird browsers to lie :-)\r\n if (!this._gl.deleteQuery) {\r\n this._webGLVersion = 1.0;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n }\r\n if (!this._gl) {\r\n if (!canvas) {\r\n throw new Error(\"The provided canvas is null or undefined.\");\r\n }\r\n try {\r\n this._gl = (canvas.getContext(\"webgl\", options) || canvas.getContext(\"experimental-webgl\", options));\r\n }\r\n catch (e) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n if (!this._gl) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n // Ensures a consistent color space unpacking of textures cross browser.\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n this._onCanvasFocus = function () {\r\n _this.onCanvasFocusObservable.notifyObservers(_this);\r\n };\r\n this._onCanvasBlur = function () {\r\n _this.onCanvasBlurObservable.notifyObservers(_this);\r\n };\r\n canvas.addEventListener(\"focus\", this._onCanvasFocus);\r\n canvas.addEventListener(\"blur\", this._onCanvasBlur);\r\n this._onBlur = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.disable();\r\n }\r\n _this._windowIsBackground = true;\r\n };\r\n this._onFocus = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.enable();\r\n }\r\n _this._windowIsBackground = false;\r\n };\r\n this._onCanvasPointerOut = function (ev) {\r\n _this.onCanvasPointerOutObservable.notifyObservers(ev);\r\n };\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n var hostWindow = this.getHostWindow();\r\n hostWindow.addEventListener(\"blur\", this._onBlur);\r\n hostWindow.addEventListener(\"focus\", this._onFocus);\r\n }\r\n canvas.addEventListener(\"pointerout\", this._onCanvasPointerOut);\r\n if (!options.doNotHandleTouchAction) {\r\n this._disableTouchAction();\r\n }\r\n }\r\n else {\r\n this._gl = canvasOrContext;\r\n this._renderingCanvas = this._gl.canvas;\r\n if (this._gl.renderbufferStorageMultisample) {\r\n this._webGLVersion = 2.0;\r\n }\r\n var attributes = this._gl.getContextAttributes();\r\n if (attributes) {\r\n options.stencil = attributes.stencil;\r\n }\r\n }\r\n if (options.useHighPrecisionFloats !== undefined) {\r\n this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;\r\n }\r\n // Viewport\r\n var devicePixelRatio = _Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist() ? (window.devicePixelRatio || 1.0) : 1.0;\r\n var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\r\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\r\n this.resize();\r\n this._isStencilEnable = options.stencil ? true : false;\r\n this._initGLContext();\r\n if (canvas) {\r\n var anyDoc_1 = document;\r\n // Fullscreen\r\n this._onFullscreenChange = function () {\r\n if (anyDoc_1.fullscreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.fullscreen;\r\n }\r\n else if (anyDoc_1.mozFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.mozFullScreen;\r\n }\r\n else if (anyDoc_1.webkitIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.webkitIsFullScreen;\r\n }\r\n else if (anyDoc_1.msIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.msIsFullScreen;\r\n }\r\n // Pointer lock\r\n if (_this.isFullscreen && _this._pointerLockRequested && canvas) {\r\n Engine._RequestPointerlock(canvas);\r\n }\r\n };\r\n document.addEventListener(\"fullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"mozfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"webkitfullscreenchange\", this._onFullscreenChange, false);\r\n document.addEventListener(\"msfullscreenchange\", this._onFullscreenChange, false);\r\n // Pointer lock\r\n this._onPointerLockChange = function () {\r\n _this.isPointerLock = (anyDoc_1.mozPointerLockElement === canvas ||\r\n anyDoc_1.webkitPointerLockElement === canvas ||\r\n anyDoc_1.msPointerLockElement === canvas ||\r\n anyDoc_1.pointerLockElement === canvas);\r\n };\r\n document.addEventListener(\"pointerlockchange\", this._onPointerLockChange, false);\r\n document.addEventListener(\"mspointerlockchange\", this._onPointerLockChange, false);\r\n document.addEventListener(\"mozpointerlockchange\", this._onPointerLockChange, false);\r\n document.addEventListener(\"webkitpointerlockchange\", this._onPointerLockChange, false);\r\n this._connectVREvents(canvas, anyDoc_1);\r\n }\r\n // Create Audio Engine if needed.\r\n if (!Engine.audioEngine && options.audioEngine && Engine.AudioEngineFactory) {\r\n Engine.audioEngine = Engine.AudioEngineFactory(this.getRenderingCanvas());\r\n }\r\n // Prepare buffer pointers\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._currentBufferPointers[i] = new BufferPointer();\r\n }\r\n // Load WebVR Devices\r\n this._prepareVRComponent();\r\n if (options.autoEnableWebVR) {\r\n this.initWebVR();\r\n }\r\n // Shader processor\r\n if (this.webGLVersion > 1) {\r\n this._shaderProcessor = new _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_15__[\"WebGL2ShaderProcessor\"]();\r\n }\r\n // Detect if we are running on a faulty buggy OS.\r\n this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);\r\n // Detect if we are running on a faulty buggy desktop OS.\r\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n console.log(\"Babylon.js v\" + Engine.Version + \" - \" + this.description);\r\n this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;\r\n }\r\n Object.defineProperty(Engine, \"Instances\", {\r\n /** Gets the list of created engines */\r\n get: function () {\r\n return _engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].Instances;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n return _engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].LastCreatedEngine;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return _engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].LastCreatedScene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation\r\n * @param flag defines which part of the materials must be marked as dirty\r\n * @param predicate defines a predicate used to filter which materials should be affected\r\n */\r\n Engine.MarkAllMaterialsAsDirty = function (flag, predicate) {\r\n for (var engineIndex = 0; engineIndex < Engine.Instances.length; engineIndex++) {\r\n var engine = Engine.Instances[engineIndex];\r\n for (var sceneIndex = 0; sceneIndex < engine.scenes.length; sceneIndex++) {\r\n engine.scenes[sceneIndex].markAllMaterialsAsDirty(flag, predicate);\r\n }\r\n }\r\n };\r\n Object.defineProperty(Engine, \"NpmPackage\", {\r\n /**\r\n * Returns the current npm package of the sdk\r\n */\r\n // Not mixed with Version for tooling purpose.\r\n get: function () {\r\n return \"babylonjs@4.1.0-alpha.17\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"Version\", {\r\n /**\r\n * Returns the current version of the framework\r\n */\r\n get: function () {\r\n return \"4.1.0-alpha.17\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"description\", {\r\n /**\r\n * Returns a string describing the current engine\r\n */\r\n get: function () {\r\n var description = \"WebGL\" + this.webGLVersion;\r\n if (this._caps.parallelShaderCompile) {\r\n description += \" - Parallel shader compilation\";\r\n }\r\n return description;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"ShadersRepository\", {\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n get: function () {\r\n return _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ShadersRepository;\r\n },\r\n set: function (value) {\r\n _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ShadersRepository = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Method called to create the default loading screen.\r\n * This can be overriden in your own app.\r\n * @param canvas The rendering canvas element\r\n * @returns The loading screen\r\n */\r\n Engine.DefaultLoadingScreenFactory = function (canvas) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"LoadingScreen\");\r\n };\r\n Object.defineProperty(Engine.prototype, \"supportsUniformBuffers\", {\r\n /**\r\n * Gets a boolean indicating that the engine supports uniform buffers\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n */\r\n get: function () {\r\n return this.webGLVersion > 1 && !this.disableUniformBuffers;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"_shouldUseHighPrecisionShader\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"needPOTTextures\", {\r\n /**\r\n * Gets a boolean indicating that only power of 2 textures are supported\r\n * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them\r\n */\r\n get: function () {\r\n return this._webGLVersion < 2 || this.forcePOTTextures;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"doNotHandleContextLost\", {\r\n /**\r\n * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#handling-webgl-context-lost\r\n */\r\n get: function () {\r\n return this._doNotHandleContextLost;\r\n },\r\n set: function (value) {\r\n this._doNotHandleContextLost = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"performanceMonitor\", {\r\n /**\r\n * Gets the performance monitor attached to this engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n */\r\n get: function () {\r\n return this._performanceMonitor;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"texturesSupported\", {\r\n /**\r\n * Gets the list of texture formats supported\r\n */\r\n get: function () {\r\n return this._texturesSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"textureFormatInUse\", {\r\n /**\r\n * Gets the list of texture formats in use\r\n */\r\n get: function () {\r\n return this._textureFormatInUse;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"currentViewport\", {\r\n /**\r\n * Gets the current viewport\r\n */\r\n get: function () {\r\n return this._cachedViewport;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"emptyTexture\", {\r\n /**\r\n * Gets the default empty texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture) {\r\n this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, Engine.TEXTUREFORMAT_RGBA, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n return this._emptyTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"emptyTexture3D\", {\r\n /**\r\n * Gets the default empty 3D texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture3D) {\r\n this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, Engine.TEXTUREFORMAT_RGBA, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n return this._emptyTexture3D;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"emptyCubeTexture\", {\r\n /**\r\n * Gets the default empty cube texture\r\n */\r\n get: function () {\r\n if (!this._emptyCubeTexture) {\r\n var faceData = new Uint8Array(4);\r\n var cubeData = [faceData, faceData, faceData, faceData, faceData, faceData];\r\n this._emptyCubeTexture = this.createRawCubeTexture(cubeData, 1, Engine.TEXTUREFORMAT_RGBA, Engine.TEXTURETYPE_UNSIGNED_INT, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE);\r\n }\r\n return this._emptyCubeTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // WebVR\r\n /**\r\n * Initializes a webVR display and starts listening to display change events\r\n * The onVRDisplayChangedObservable will be notified upon these changes\r\n * @returns The onVRDisplayChangedObservable\r\n */\r\n Engine.prototype.initWebVR = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"WebVRCamera\");\r\n };\r\n /** @hidden */\r\n Engine.prototype._prepareVRComponent = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._connectVREvents = function (canvas, document) {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._submitVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Call this function to leave webVR mode\r\n * Will do nothing if webVR is not supported or if there is no webVR device\r\n * @see http://doc.babylonjs.com/how_to/webvr_camera\r\n */\r\n Engine.prototype.disableVR = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Gets a boolean indicating that the system is in VR mode and is presenting\r\n * @returns true if VR mode is engaged\r\n */\r\n Engine.prototype.isVRPresenting = function () {\r\n return false;\r\n };\r\n /** @hidden */\r\n Engine.prototype._requestVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n Engine.prototype._disableTouchAction = function () {\r\n if (!this._renderingCanvas) {\r\n return;\r\n }\r\n this._renderingCanvas.setAttribute(\"touch-action\", \"none\");\r\n this._renderingCanvas.style.touchAction = \"none\";\r\n this._renderingCanvas.style.msTouchAction = \"none\";\r\n };\r\n Engine.prototype._rebuildInternalTextures = function () {\r\n var currentState = this._internalTexturesCache.slice(); // Do a copy because the rebuild will add proxies\r\n for (var _i = 0, currentState_1 = currentState; _i < currentState_1.length; _i++) {\r\n var internalTexture = currentState_1[_i];\r\n internalTexture._rebuild();\r\n }\r\n };\r\n Engine.prototype._rebuildEffects = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n effect._prepareEffect();\r\n }\r\n _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ResetCache();\r\n };\r\n /**\r\n * Gets a boolean indicating if all created effects are ready\r\n * @returns true if all effects are ready\r\n */\r\n Engine.prototype.areAllEffectsReady = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n if (!effect.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Engine.prototype._rebuildBuffers = function () {\r\n // Index / Vertex\r\n for (var _i = 0, _a = this.scenes; _i < _a.length; _i++) {\r\n var scene = _a[_i];\r\n scene.resetCachedMaterial();\r\n scene._rebuildGeometries();\r\n scene._rebuildTextures();\r\n }\r\n // Uniforms\r\n for (var _b = 0, _c = this._uniformBuffers; _b < _c.length; _b++) {\r\n var uniformBuffer = _c[_b];\r\n uniformBuffer._rebuild();\r\n }\r\n };\r\n Engine.prototype._initGLContext = function () {\r\n // Caps\r\n this._caps = new EngineCapabilities();\r\n this._caps.maxTexturesImageUnits = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);\r\n this._caps.maxCombinedTexturesImageUnits = this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);\r\n this._caps.maxVertexTextureImageUnits = this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\r\n this._caps.maxTextureSize = this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE);\r\n this._caps.maxCubemapTextureSize = this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE);\r\n this._caps.maxRenderTextureSize = this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE);\r\n this._caps.maxVertexAttribs = this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS);\r\n this._caps.maxVaryingVectors = this._gl.getParameter(this._gl.MAX_VARYING_VECTORS);\r\n this._caps.maxFragmentUniformVectors = this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS);\r\n this._caps.maxVertexUniformVectors = this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS);\r\n // Infos\r\n this._glVersion = this._gl.getParameter(this._gl.VERSION);\r\n var rendererInfo = this._gl.getExtension(\"WEBGL_debug_renderer_info\");\r\n if (rendererInfo != null) {\r\n this._glRenderer = this._gl.getParameter(rendererInfo.UNMASKED_RENDERER_WEBGL);\r\n this._glVendor = this._gl.getParameter(rendererInfo.UNMASKED_VENDOR_WEBGL);\r\n }\r\n if (!this._glVendor) {\r\n this._glVendor = \"Unknown vendor\";\r\n }\r\n if (!this._glRenderer) {\r\n this._glRenderer = \"Unknown renderer\";\r\n }\r\n // Constants\r\n this._gl.HALF_FLOAT_OES = 0x8D61; // Half floating-point type (16-bit).\r\n if (this._gl.RGBA16F !== 0x881A) {\r\n this._gl.RGBA16F = 0x881A; // RGBA 16-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.RGBA32F !== 0x8814) {\r\n this._gl.RGBA32F = 0x8814; // RGBA 32-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.DEPTH24_STENCIL8 !== 35056) {\r\n this._gl.DEPTH24_STENCIL8 = 35056;\r\n }\r\n // Extensions\r\n this._caps.standardDerivatives = this._webGLVersion > 1 || (this._gl.getExtension('OES_standard_derivatives') !== null);\r\n this._caps.astc = this._gl.getExtension('WEBGL_compressed_texture_astc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_astc');\r\n this._caps.s3tc = this._gl.getExtension('WEBGL_compressed_texture_s3tc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');\r\n this._caps.pvrtc = this._gl.getExtension('WEBGL_compressed_texture_pvrtc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');\r\n this._caps.etc1 = this._gl.getExtension('WEBGL_compressed_texture_etc1') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc1');\r\n this._caps.etc2 = this._gl.getExtension('WEBGL_compressed_texture_etc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc') ||\r\n this._gl.getExtension('WEBGL_compressed_texture_es3_0'); // also a requirement of OpenGL ES 3\r\n 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');\r\n this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0;\r\n this._caps.uintIndices = this._webGLVersion > 1 || this._gl.getExtension('OES_element_index_uint') !== null;\r\n this._caps.fragmentDepthSupported = this._webGLVersion > 1 || this._gl.getExtension('EXT_frag_depth') !== null;\r\n this._caps.highPrecisionShaderSupported = false;\r\n this._caps.timerQuery = this._gl.getExtension('EXT_disjoint_timer_query_webgl2') || this._gl.getExtension(\"EXT_disjoint_timer_query\");\r\n if (this._caps.timerQuery) {\r\n if (this._webGLVersion === 1) {\r\n this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery);\r\n }\r\n this._caps.canUseTimestampForTimerQuery = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT) > 0;\r\n }\r\n // Checks if some of the format renders first to allow the use of webgl inspector.\r\n this._caps.colorBufferFloat = this._webGLVersion > 1 && this._gl.getExtension('EXT_color_buffer_float');\r\n this._caps.textureFloat = (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_float')) ? true : false;\r\n this._caps.textureFloatLinearFiltering = this._caps.textureFloat && this._gl.getExtension('OES_texture_float_linear') ? true : false;\r\n this._caps.textureFloatRender = this._caps.textureFloat && this._canRenderToFloatFramebuffer() ? true : false;\r\n this._caps.textureHalfFloat = (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_half_float')) ? true : false;\r\n this._caps.textureHalfFloatLinearFiltering = (this._webGLVersion > 1 || (this._caps.textureHalfFloat && this._gl.getExtension('OES_texture_half_float_linear'))) ? true : false;\r\n if (this._webGLVersion > 1) {\r\n this._gl.HALF_FLOAT_OES = 0x140B;\r\n }\r\n this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer();\r\n this._caps.textureLOD = (this._webGLVersion > 1 || this._gl.getExtension('EXT_shader_texture_lod')) ? true : false;\r\n this._caps.multiview = this._gl.getExtension('OVR_multiview2');\r\n // Draw buffers\r\n if (this._webGLVersion > 1) {\r\n this._caps.drawBuffersExtension = true;\r\n this._caps.maxMSAASamples = this._gl.getParameter(this._gl.MAX_SAMPLES);\r\n }\r\n else {\r\n var drawBuffersExtension = this._gl.getExtension('WEBGL_draw_buffers');\r\n if (drawBuffersExtension !== null) {\r\n this._caps.drawBuffersExtension = true;\r\n this._gl.drawBuffers = drawBuffersExtension.drawBuffersWEBGL.bind(drawBuffersExtension);\r\n this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;\r\n for (var i = 0; i < 16; i++) {\r\n this._gl[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"] = drawBuffersExtension[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n }\r\n else {\r\n this._caps.drawBuffersExtension = false;\r\n }\r\n }\r\n // Shader compiler threads\r\n this._caps.parallelShaderCompile = this._gl.getExtension('KHR_parallel_shader_compile');\r\n // Depth Texture\r\n if (this._webGLVersion > 1) {\r\n this._caps.depthTextureExtension = true;\r\n }\r\n else {\r\n var depthTextureExtension = this._gl.getExtension('WEBGL_depth_texture');\r\n if (depthTextureExtension != null) {\r\n this._caps.depthTextureExtension = true;\r\n this._gl.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\r\n }\r\n }\r\n // Vertex array object\r\n if (this.disableVertexArrayObjects) {\r\n this._caps.vertexArrayObject = false;\r\n }\r\n else if (this._webGLVersion > 1) {\r\n this._caps.vertexArrayObject = true;\r\n }\r\n else {\r\n var vertexArrayObjectExtension = this._gl.getExtension('OES_vertex_array_object');\r\n if (vertexArrayObjectExtension != null) {\r\n this._caps.vertexArrayObject = true;\r\n this._gl.createVertexArray = vertexArrayObjectExtension.createVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.bindVertexArray = vertexArrayObjectExtension.bindVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.deleteVertexArray = vertexArrayObjectExtension.deleteVertexArrayOES.bind(vertexArrayObjectExtension);\r\n }\r\n else {\r\n this._caps.vertexArrayObject = false;\r\n }\r\n }\r\n // Instances count\r\n if (this._webGLVersion > 1) {\r\n this._caps.instancedArrays = true;\r\n }\r\n else {\r\n var instanceExtension = this._gl.getExtension('ANGLE_instanced_arrays');\r\n if (instanceExtension != null) {\r\n this._caps.instancedArrays = true;\r\n this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);\r\n this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);\r\n this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);\r\n }\r\n else {\r\n this._caps.instancedArrays = false;\r\n }\r\n }\r\n // Intelligently add supported compressed formats in order to check for.\r\n // Check for ASTC support first as it is most powerful and to be very cross platform.\r\n // Next PVRTC & DXT, which are probably superior to ETC1/2.\r\n // Likely no hardware which supports both PVR & DXT, so order matters little.\r\n // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.\r\n if (this._caps.astc) {\r\n this.texturesSupported.push('-astc.ktx');\r\n }\r\n if (this._caps.s3tc) {\r\n this.texturesSupported.push('-dxt.ktx');\r\n }\r\n if (this._caps.pvrtc) {\r\n this.texturesSupported.push('-pvrtc.ktx');\r\n }\r\n if (this._caps.etc2) {\r\n this.texturesSupported.push('-etc2.ktx');\r\n }\r\n if (this._caps.etc1) {\r\n this.texturesSupported.push('-etc1.ktx');\r\n }\r\n if (this._gl.getShaderPrecisionFormat) {\r\n var vertex_highp = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT);\r\n var fragment_highp = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);\r\n if (vertex_highp && fragment_highp) {\r\n this._caps.highPrecisionShaderSupported = vertex_highp.precision !== 0 && fragment_highp.precision !== 0;\r\n }\r\n }\r\n // Depth buffer\r\n this.setDepthBuffer(true);\r\n this.setDepthFunctionToLessOrEqual();\r\n this.setDepthWrite(true);\r\n // Texture maps\r\n this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;\r\n for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {\r\n this._nextFreeTextureSlots.push(slot);\r\n }\r\n };\r\n Object.defineProperty(Engine.prototype, \"webGLVersion\", {\r\n /**\r\n * Gets version of the current webGL context\r\n */\r\n get: function () {\r\n return this._webGLVersion;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"Engine\" string\r\n */\r\n Engine.prototype.getClassName = function () {\r\n return \"Engine\";\r\n };\r\n Object.defineProperty(Engine.prototype, \"isStencilEnable\", {\r\n /**\r\n * Returns true if the stencil buffer has been enabled through the creation option of the context.\r\n */\r\n get: function () {\r\n return this._isStencilEnable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Engine.prototype._prepareWorkingCanvas = function () {\r\n if (this._workingCanvas) {\r\n return;\r\n }\r\n this._workingCanvas = document.createElement(\"canvas\");\r\n var context = this._workingCanvas.getContext(\"2d\");\r\n if (context) {\r\n this._workingContext = context;\r\n }\r\n };\r\n /**\r\n * Reset the texture cache to empty state\r\n */\r\n Engine.prototype.resetTextureCache = function () {\r\n for (var key in this._boundTexturesCache) {\r\n if (!this._boundTexturesCache.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n this._boundTexturesCache[key] = null;\r\n }\r\n this._currentTextureChannel = -1;\r\n };\r\n /**\r\n * Gets a boolean indicating that the engine is running in deterministic lock step mode\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns true if engine is in deterministic lock step mode\r\n */\r\n Engine.prototype.isDeterministicLockStep = function () {\r\n return this._deterministicLockstep;\r\n };\r\n /**\r\n * Gets the max steps when engine is running in deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the max steps\r\n */\r\n Engine.prototype.getLockstepMaxSteps = function () {\r\n return this._lockstepMaxSteps;\r\n };\r\n /**\r\n * Gets an object containing information about the current webGL context\r\n * @returns an object containing the vender, the renderer and the version of the current webGL context\r\n */\r\n Engine.prototype.getGlInfo = function () {\r\n return {\r\n vendor: this._glVendor,\r\n renderer: this._glRenderer,\r\n version: this._glVersion\r\n };\r\n };\r\n /**\r\n * Gets current aspect ratio\r\n * @param viewportOwner defines the camera to use to get the aspect ratio\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getAspectRatio = function (viewportOwner, useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n var viewport = viewportOwner.viewport;\r\n return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);\r\n };\r\n /**\r\n * Gets current screen aspect ratio\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getScreenAspectRatio = function () {\r\n return (this.getRenderWidth(true)) / (this.getRenderHeight(true));\r\n };\r\n /**\r\n * Gets the current render width\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render width\r\n */\r\n Engine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._gl.drawingBufferWidth;\r\n };\r\n /**\r\n * Gets the current render height\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render height\r\n */\r\n Engine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._gl.drawingBufferHeight;\r\n };\r\n /**\r\n * Gets the HTML canvas attached with the current webGL context\r\n * @returns a HTML canvas\r\n */\r\n Engine.prototype.getRenderingCanvas = function () {\r\n return this._renderingCanvas;\r\n };\r\n /**\r\n * Gets host window\r\n * @returns the host window object\r\n */\r\n Engine.prototype.getHostWindow = function () {\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView) {\r\n return this._renderingCanvas.ownerDocument.defaultView;\r\n }\r\n return window;\r\n };\r\n /**\r\n * Gets host document\r\n * @returns the host document object\r\n */\r\n Engine.prototype.getHostDocument = function () {\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument) {\r\n return this._renderingCanvas.ownerDocument;\r\n }\r\n return document;\r\n };\r\n /**\r\n * Gets the client rect of the HTML canvas attached with the current webGL context\r\n * @returns a client rectanglee\r\n */\r\n Engine.prototype.getRenderingCanvasClientRect = function () {\r\n if (!this._renderingCanvas) {\r\n return null;\r\n }\r\n return this._renderingCanvas.getBoundingClientRect();\r\n };\r\n /**\r\n * Defines the hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @param level defines the level to use\r\n */\r\n Engine.prototype.setHardwareScalingLevel = function (level) {\r\n this._hardwareScalingLevel = level;\r\n this.resize();\r\n };\r\n /**\r\n * Gets the current hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @returns a number indicating the current hardware scaling level\r\n */\r\n Engine.prototype.getHardwareScalingLevel = function () {\r\n return this._hardwareScalingLevel;\r\n };\r\n /**\r\n * Gets the list of loaded textures\r\n * @returns an array containing all loaded textures\r\n */\r\n Engine.prototype.getLoadedTexturesCache = function () {\r\n return this._internalTexturesCache;\r\n };\r\n /**\r\n * Gets the object containing all engine capabilities\r\n * @returns the EngineCapabilities object\r\n */\r\n Engine.prototype.getCaps = function () {\r\n return this._caps;\r\n };\r\n /**\r\n * Gets the current depth function\r\n * @returns a number defining the depth function\r\n */\r\n Engine.prototype.getDepthFunction = function () {\r\n return this._depthCullingState.depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function\r\n * @param depthFunc defines the function to use\r\n */\r\n Engine.prototype.setDepthFunction = function (depthFunc) {\r\n this._depthCullingState.depthFunc = depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function to GREATER\r\n */\r\n Engine.prototype.setDepthFunctionToGreater = function () {\r\n this._depthCullingState.depthFunc = this._gl.GREATER;\r\n };\r\n /**\r\n * Sets the current depth function to GEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToGreaterOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.GEQUAL;\r\n };\r\n /**\r\n * Sets the current depth function to LESS\r\n */\r\n Engine.prototype.setDepthFunctionToLess = function () {\r\n this._depthCullingState.depthFunc = this._gl.LESS;\r\n };\r\n /**\r\n * Caches the the state of the stencil buffer\r\n */\r\n Engine.prototype.cacheStencilState = function () {\r\n this._cachedStencilBuffer = this.getStencilBuffer();\r\n this._cachedStencilFunction = this.getStencilFunction();\r\n this._cachedStencilMask = this.getStencilMask();\r\n this._cachedStencilOperationPass = this.getStencilOperationPass();\r\n this._cachedStencilOperationFail = this.getStencilOperationFail();\r\n this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();\r\n this._cachedStencilReference = this.getStencilFunctionReference();\r\n };\r\n /**\r\n * Restores the state of the stencil buffer\r\n */\r\n Engine.prototype.restoreStencilState = function () {\r\n this.setStencilFunction(this._cachedStencilFunction);\r\n this.setStencilMask(this._cachedStencilMask);\r\n this.setStencilBuffer(this._cachedStencilBuffer);\r\n this.setStencilOperationPass(this._cachedStencilOperationPass);\r\n this.setStencilOperationFail(this._cachedStencilOperationFail);\r\n this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);\r\n this.setStencilFunctionReference(this._cachedStencilReference);\r\n };\r\n /**\r\n * Sets the current depth function to LEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToLessOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n };\r\n /**\r\n * Gets a boolean indicating if stencil buffer is enabled\r\n * @returns the current stencil buffer state\r\n */\r\n Engine.prototype.getStencilBuffer = function () {\r\n return this._stencilState.stencilTest;\r\n };\r\n /**\r\n * Enable or disable the stencil buffer\r\n * @param enable defines if the stencil buffer must be enabled or disabled\r\n */\r\n Engine.prototype.setStencilBuffer = function (enable) {\r\n this._stencilState.stencilTest = enable;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the new stencil mask to use\r\n */\r\n Engine.prototype.getStencilMask = function () {\r\n return this._stencilState.stencilMask;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilMask = function (mask) {\r\n this._stencilState.stencilMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil function\r\n * @returns a number defining the stencil function to use\r\n */\r\n Engine.prototype.getStencilFunction = function () {\r\n return this._stencilState.stencilFunc;\r\n };\r\n /**\r\n * Gets the current stencil reference value\r\n * @returns a number defining the stencil reference value to use\r\n */\r\n Engine.prototype.getStencilFunctionReference = function () {\r\n return this._stencilState.stencilFuncRef;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the stencil mask to use\r\n */\r\n Engine.prototype.getStencilFunctionMask = function () {\r\n return this._stencilState.stencilFuncMask;\r\n };\r\n /**\r\n * Sets the current stencil function\r\n * @param stencilFunc defines the new stencil function to use\r\n */\r\n Engine.prototype.setStencilFunction = function (stencilFunc) {\r\n this._stencilState.stencilFunc = stencilFunc;\r\n };\r\n /**\r\n * Sets the current stencil reference\r\n * @param reference defines the new stencil reference to use\r\n */\r\n Engine.prototype.setStencilFunctionReference = function (reference) {\r\n this._stencilState.stencilFuncRef = reference;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilFunctionMask = function (mask) {\r\n this._stencilState.stencilFuncMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil fails\r\n * @returns a number defining stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.getStencilOperationFail = function () {\r\n return this._stencilState.stencilOpStencilFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when depth fails\r\n * @returns a number defining stencil operation to use when depth fails\r\n */\r\n Engine.prototype.getStencilOperationDepthFail = function () {\r\n return this._stencilState.stencilOpDepthFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil passes\r\n * @returns a number defining stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.getStencilOperationPass = function () {\r\n return this._stencilState.stencilOpStencilDepthPass;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil fails\r\n * @param operation defines the stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.setStencilOperationFail = function (operation) {\r\n this._stencilState.stencilOpStencilFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when depth fails\r\n * @param operation defines the stencil operation to use when depth fails\r\n */\r\n Engine.prototype.setStencilOperationDepthFail = function (operation) {\r\n this._stencilState.stencilOpDepthFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil passes\r\n * @param operation defines the stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.setStencilOperationPass = function (operation) {\r\n this._stencilState.stencilOpStencilDepthPass = operation;\r\n };\r\n /**\r\n * Sets a boolean indicating if the dithering state is enabled or disabled\r\n * @param value defines the dithering state\r\n */\r\n Engine.prototype.setDitheringState = function (value) {\r\n if (value) {\r\n this._gl.enable(this._gl.DITHER);\r\n }\r\n else {\r\n this._gl.disable(this._gl.DITHER);\r\n }\r\n };\r\n /**\r\n * Sets a boolean indicating if the rasterizer state is enabled or disabled\r\n * @param value defines the rasterizer state\r\n */\r\n Engine.prototype.setRasterizerState = function (value) {\r\n if (value) {\r\n this._gl.disable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n else {\r\n this._gl.enable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n };\r\n /**\r\n * stop executing a render loop function and remove it from the execution array\r\n * @param renderFunction defines the function to be removed. If not provided all functions will be removed.\r\n */\r\n Engine.prototype.stopRenderLoop = function (renderFunction) {\r\n if (!renderFunction) {\r\n this._activeRenderLoops = [];\r\n return;\r\n }\r\n var index = this._activeRenderLoops.indexOf(renderFunction);\r\n if (index >= 0) {\r\n this._activeRenderLoops.splice(index, 1);\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._renderLoop = function () {\r\n if (!this._contextWasLost) {\r\n var shouldRender = true;\r\n if (!this.renderEvenInBackground && this._windowIsBackground) {\r\n shouldRender = false;\r\n }\r\n if (shouldRender) {\r\n // Start new frame\r\n this.beginFrame();\r\n for (var index = 0; index < this._activeRenderLoops.length; index++) {\r\n var renderFunction = this._activeRenderLoops[index];\r\n renderFunction();\r\n }\r\n // Present\r\n this.endFrame();\r\n }\r\n }\r\n if (this._activeRenderLoops.length > 0) {\r\n // Register new frame\r\n if (this.customAnimationFrameRequester) {\r\n this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._bindedRenderFunction, this.customAnimationFrameRequester);\r\n this._frameHandler = this.customAnimationFrameRequester.requestID;\r\n }\r\n else if (this.isVRPresenting()) {\r\n this._requestVRFrame();\r\n }\r\n else {\r\n this._frameHandler = this._queueNewFrame(this._bindedRenderFunction, this.getHostWindow());\r\n }\r\n }\r\n else {\r\n this._renderingQueueLaunched = false;\r\n }\r\n };\r\n /**\r\n * Can be used to override the current requestAnimationFrame requester.\r\n * @hidden\r\n */\r\n Engine.prototype._queueNewFrame = function (bindedRenderFunction, requester) {\r\n return Engine.QueueNewFrame(bindedRenderFunction, requester);\r\n };\r\n /**\r\n * Register and execute a render loop. The engine can have more than one render function\r\n * @param renderFunction defines the function to continuously execute\r\n */\r\n Engine.prototype.runRenderLoop = function (renderFunction) {\r\n if (this._activeRenderLoops.indexOf(renderFunction) !== -1) {\r\n return;\r\n }\r\n this._activeRenderLoops.push(renderFunction);\r\n if (!this._renderingQueueLaunched) {\r\n this._renderingQueueLaunched = true;\r\n this._bindedRenderFunction = this._renderLoop.bind(this);\r\n this._frameHandler = this._queueNewFrame(this._bindedRenderFunction, this.getHostWindow());\r\n }\r\n };\r\n /**\r\n * Toggle full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.switchFullscreen = function (requestPointerLock) {\r\n if (this.isFullscreen) {\r\n this.exitFullscreen();\r\n }\r\n else {\r\n this.enterFullscreen(requestPointerLock);\r\n }\r\n };\r\n /**\r\n * Enters full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.enterFullscreen = function (requestPointerLock) {\r\n if (!this.isFullscreen) {\r\n this._pointerLockRequested = requestPointerLock;\r\n if (this._renderingCanvas) {\r\n Engine._RequestFullscreen(this._renderingCanvas);\r\n }\r\n }\r\n };\r\n /**\r\n * Exits full screen mode\r\n */\r\n Engine.prototype.exitFullscreen = function () {\r\n if (this.isFullscreen) {\r\n Engine._ExitFullscreen();\r\n }\r\n };\r\n /**\r\n * Enters Pointerlock mode\r\n */\r\n Engine.prototype.enterPointerlock = function () {\r\n if (this._renderingCanvas) {\r\n Engine._RequestPointerlock(this._renderingCanvas);\r\n }\r\n };\r\n /**\r\n * Exits Pointerlock mode\r\n */\r\n Engine.prototype.exitPointerlock = function () {\r\n Engine._ExitPointerlock();\r\n };\r\n /**\r\n * Clear the current render buffer or the current render target (if any is set up)\r\n * @param color defines the color to use\r\n * @param backBuffer defines if the back buffer must be cleared\r\n * @param depth defines if the depth buffer must be cleared\r\n * @param stencil defines if the stencil buffer must be cleared\r\n */\r\n Engine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n this.applyStates();\r\n var mode = 0;\r\n if (backBuffer && color) {\r\n this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);\r\n mode |= this._gl.COLOR_BUFFER_BIT;\r\n }\r\n if (depth) {\r\n this._gl.clearDepth(1.0);\r\n mode |= this._gl.DEPTH_BUFFER_BIT;\r\n }\r\n if (stencil) {\r\n this._gl.clearStencil(0);\r\n mode |= this._gl.STENCIL_BUFFER_BIT;\r\n }\r\n this._gl.clear(mode);\r\n };\r\n /**\r\n * Executes a scissor clear (ie. a clear on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n * @param clearColor defines the clear color\r\n */\r\n Engine.prototype.scissorClear = function (x, y, width, height, clearColor) {\r\n this.enableScissor(x, y, width, height);\r\n this.clear(clearColor, true, true, true);\r\n this.disableScissor();\r\n };\r\n /**\r\n * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n */\r\n Engine.prototype.enableScissor = function (x, y, width, height) {\r\n var gl = this._gl;\r\n // Change state\r\n gl.enable(gl.SCISSOR_TEST);\r\n gl.scissor(x, y, width, height);\r\n };\r\n /**\r\n * Disable previously set scissor test rectangle\r\n */\r\n Engine.prototype.disableScissor = function () {\r\n var gl = this._gl;\r\n gl.disable(gl.SCISSOR_TEST);\r\n };\r\n /** @hidden */\r\n Engine.prototype._viewport = function (x, y, width, height) {\r\n if (x !== this._viewportCached.x ||\r\n y !== this._viewportCached.y ||\r\n width !== this._viewportCached.z ||\r\n height !== this._viewportCached.w) {\r\n this._viewportCached.x = x;\r\n this._viewportCached.y = y;\r\n this._viewportCached.z = width;\r\n this._viewportCached.w = height;\r\n this._gl.viewport(x, y, width, height);\r\n }\r\n };\r\n /**\r\n * Set the WebGL's viewport\r\n * @param viewport defines the viewport element to be used\r\n * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used\r\n * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used\r\n */\r\n Engine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n var width = requiredWidth || this.getRenderWidth();\r\n var height = requiredHeight || this.getRenderHeight();\r\n var x = viewport.x || 0;\r\n var y = viewport.y || 0;\r\n this._cachedViewport = viewport;\r\n this._viewport(x * width, y * height, width * viewport.width, height * viewport.height);\r\n };\r\n /**\r\n * Directly set the WebGL Viewport\r\n * @param x defines the x coordinate of the viewport (in screen space)\r\n * @param y defines the y coordinate of the viewport (in screen space)\r\n * @param width defines the width of the viewport (in screen space)\r\n * @param height defines the height of the viewport (in screen space)\r\n * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state\r\n */\r\n Engine.prototype.setDirectViewport = function (x, y, width, height) {\r\n var currentViewport = this._cachedViewport;\r\n this._cachedViewport = null;\r\n this._viewport(x, y, width, height);\r\n return currentViewport;\r\n };\r\n /**\r\n * Begin a new frame\r\n */\r\n Engine.prototype.beginFrame = function () {\r\n this.onBeginFrameObservable.notifyObservers(this);\r\n this._measureFps();\r\n };\r\n /**\r\n * Enf the current frame\r\n */\r\n Engine.prototype.endFrame = function () {\r\n // Force a flush in case we are using a bad OS.\r\n if (this._badOS) {\r\n this.flushFramebuffer();\r\n }\r\n this._submitVRFrame();\r\n this.onEndFrameObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Resize the view according to the canvas' size\r\n */\r\n Engine.prototype.resize = function () {\r\n // We're not resizing the size of the canvas while in VR mode & presenting\r\n if (!this.isVRPresenting()) {\r\n var width = this._renderingCanvas ? this._renderingCanvas.clientWidth : window.innerWidth;\r\n var height = this._renderingCanvas ? this._renderingCanvas.clientHeight : window.innerHeight;\r\n this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel);\r\n }\r\n };\r\n /**\r\n * Force a specific size of the canvas\r\n * @param width defines the new canvas' width\r\n * @param height defines the new canvas' height\r\n */\r\n Engine.prototype.setSize = function (width, height) {\r\n if (!this._renderingCanvas) {\r\n return;\r\n }\r\n width = width | 0;\r\n height = height | 0;\r\n if (this._renderingCanvas.width === width && this._renderingCanvas.height === height) {\r\n return;\r\n }\r\n this._renderingCanvas.width = width;\r\n this._renderingCanvas.height = height;\r\n for (var index = 0; index < this.scenes.length; index++) {\r\n var scene = this.scenes[index];\r\n for (var camIndex = 0; camIndex < scene.cameras.length; camIndex++) {\r\n var cam = scene.cameras[camIndex];\r\n cam._currentRenderId = 0;\r\n }\r\n }\r\n if (this.onResizeObservable.hasObservers) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Binds the frame buffer to the specified texture.\r\n * @param texture The texture to render to or null for the default canvas\r\n * @param faceIndex The face of the texture to render to in case of cube texture\r\n * @param requiredWidth The width of the target to render to\r\n * @param requiredHeight The height of the target to render to\r\n * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true\r\n * @param depthStencilTexture The depth stencil texture to use to render\r\n * @param lodLevel defines le lod level to bind to the frame buffer\r\n */\r\n Engine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport, depthStencilTexture, lodLevel) {\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n this._currentRenderTarget = texture;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer ? texture._MSAAFramebuffer : texture._framebuffer);\r\n var gl = this._gl;\r\n if (texture.isCube) {\r\n if (faceIndex === undefined) {\r\n faceIndex = 0;\r\n }\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, lodLevel);\r\n if (depthStencilTexture) {\r\n if (depthStencilTexture._generateStencilBuffer) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n }\r\n }\r\n if (this._cachedViewport && !forceFullscreenViewport) {\r\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\r\n }\r\n else {\r\n if (!requiredWidth) {\r\n requiredWidth = texture.width;\r\n if (lodLevel) {\r\n requiredWidth = requiredWidth / Math.pow(2, lodLevel);\r\n }\r\n }\r\n if (!requiredHeight) {\r\n requiredHeight = texture.height;\r\n if (lodLevel) {\r\n requiredHeight = requiredHeight / Math.pow(2, lodLevel);\r\n }\r\n }\r\n this._viewport(0, 0, requiredWidth, requiredHeight);\r\n }\r\n this.wipeCaches();\r\n };\r\n /** @hidden */\r\n Engine.prototype._bindUnboundFramebuffer = function (framebuffer) {\r\n if (this._currentFramebuffer !== framebuffer) {\r\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer);\r\n this._currentFramebuffer = framebuffer;\r\n }\r\n };\r\n /**\r\n * Unbind the current render target texture from the webGL context\r\n * @param texture defines the render target texture to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n Engine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n // If MSAA, we need to bitblt back to main texture\r\n var gl = this._gl;\r\n if (texture._MSAAFramebuffer) {\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, texture._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, texture._framebuffer);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n if (onBeforeUnbind) {\r\n if (texture._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n };\r\n /**\r\n * Force the mipmap generation for the given render target texture\r\n * @param texture defines the render target texture to use\r\n */\r\n Engine.prototype.generateMipMapsForCubemap = function (texture) {\r\n if (texture.generateMipMaps) {\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n };\r\n /**\r\n * Force a webGL flush (ie. a flush of all waiting webGL commands)\r\n */\r\n Engine.prototype.flushFramebuffer = function () {\r\n this._gl.flush();\r\n };\r\n /**\r\n * Unbind the current render target and bind the default framebuffer\r\n */\r\n Engine.prototype.restoreDefaultFramebuffer = function () {\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(null);\r\n }\r\n if (this._cachedViewport) {\r\n this.setViewport(this._cachedViewport);\r\n }\r\n this.wipeCaches();\r\n };\r\n // UBOs\r\n /**\r\n * Create an uniform buffer\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n * @param elements defines the content of the uniform buffer\r\n * @returns the webGL uniform buffer\r\n */\r\n Engine.prototype.createUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create uniform buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n };\r\n /**\r\n * Create a dynamic uniform buffer\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n * @param elements defines the content of the uniform buffer\r\n * @returns the webGL uniform buffer\r\n */\r\n Engine.prototype.createDynamicUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create dynamic uniform buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n };\r\n /**\r\n * Update an existing uniform buffer\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n * @param uniformBuffer defines the target uniform buffer\r\n * @param elements defines the content to update\r\n * @param offset defines the offset in the uniform buffer where update should start\r\n * @param count defines the size of the data to update\r\n */\r\n Engine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {\r\n this.bindUniformBuffer(uniformBuffer);\r\n if (offset === undefined) {\r\n offset = 0;\r\n }\r\n if (count === undefined) {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));\r\n }\r\n }\r\n else {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));\r\n }\r\n }\r\n this.bindUniformBuffer(null);\r\n };\r\n // VBOs\r\n Engine.prototype._resetVertexBufferBinding = function () {\r\n this.bindArrayBuffer(null);\r\n this._cachedVertexBuffers = null;\r\n };\r\n /**\r\n * Creates a vertex buffer\r\n * @param data the data for the vertex buffer\r\n * @returns the new WebGL static buffer\r\n */\r\n Engine.prototype.createVertexBuffer = function (data) {\r\n var vbo = this._gl.createBuffer();\r\n if (!vbo) {\r\n throw new Error(\"Unable to create vertex buffer\");\r\n }\r\n var dataBuffer = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](vbo);\r\n this.bindArrayBuffer(dataBuffer);\r\n if (data instanceof Array) {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, this._gl.STATIC_DRAW);\r\n }\r\n this._resetVertexBufferBinding();\r\n dataBuffer.references = 1;\r\n return dataBuffer;\r\n };\r\n /**\r\n * Creates a dynamic vertex buffer\r\n * @param data the data for the dynamic vertex buffer\r\n * @returns the new WebGL dynamic buffer\r\n */\r\n Engine.prototype.createDynamicVertexBuffer = function (data) {\r\n var vbo = this._gl.createBuffer();\r\n if (!vbo) {\r\n throw new Error(\"Unable to create dynamic vertex buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](vbo);\r\n this.bindArrayBuffer(result);\r\n if (data instanceof Array) {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), this._gl.DYNAMIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, this._gl.DYNAMIC_DRAW);\r\n }\r\n this._resetVertexBufferBinding();\r\n result.references = 1;\r\n return result;\r\n };\r\n /**\r\n * Update a dynamic index buffer\r\n * @param indexBuffer defines the target index buffer\r\n * @param indices defines the data to update\r\n * @param offset defines the offset in the target index buffer where update should start\r\n */\r\n Engine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n // Force cache update\r\n this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;\r\n this.bindIndexBuffer(indexBuffer);\r\n var arrayBuffer;\r\n if (indices instanceof Uint16Array || indices instanceof Uint32Array) {\r\n arrayBuffer = indices;\r\n }\r\n else {\r\n arrayBuffer = indexBuffer.is32Bits ? new Uint32Array(indices) : new Uint16Array(indices);\r\n }\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, arrayBuffer, this._gl.DYNAMIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n };\r\n /**\r\n * Updates a dynamic vertex buffer.\r\n * @param vertexBuffer the vertex buffer to update\r\n * @param data the data used to update the vertex buffer\r\n * @param byteOffset the byte offset of the data\r\n * @param byteLength the byte length of the data\r\n */\r\n Engine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\r\n this.bindArrayBuffer(vertexBuffer);\r\n if (byteOffset === undefined) {\r\n byteOffset = 0;\r\n }\r\n if (byteLength === undefined) {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);\r\n }\r\n }\r\n else {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));\r\n }\r\n else {\r\n if (data instanceof ArrayBuffer) {\r\n data = new Uint8Array(data, byteOffset, byteLength);\r\n }\r\n else {\r\n data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\r\n }\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n }\r\n this._resetVertexBufferBinding();\r\n };\r\n Engine.prototype._resetIndexBufferBinding = function () {\r\n this.bindIndexBuffer(null);\r\n this._cachedIndexBuffer = null;\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the content of the index buffer\r\n * @param updatable defines if the index buffer must be updatable\r\n * @returns a new webGL buffer\r\n */\r\n Engine.prototype.createIndexBuffer = function (indices, updatable) {\r\n var vbo = this._gl.createBuffer();\r\n var dataBuffer = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](vbo);\r\n if (!vbo) {\r\n throw new Error(\"Unable to create index buffer\");\r\n }\r\n this.bindIndexBuffer(dataBuffer);\r\n var data = this._normalizeIndexData(indices);\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, data, updatable ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n dataBuffer.references = 1;\r\n dataBuffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);\r\n return dataBuffer;\r\n };\r\n Engine.prototype._normalizeIndexData = function (indices) {\r\n if (indices instanceof Uint16Array) {\r\n return indices;\r\n }\r\n // Check 32 bit support\r\n if (this._caps.uintIndices) {\r\n if (indices instanceof Uint32Array) {\r\n return indices;\r\n }\r\n else {\r\n // number[] or Int32Array, check if 32 bit is necessary\r\n for (var index = 0; index < indices.length; index++) {\r\n if (indices[index] >= 65535) {\r\n return new Uint32Array(indices);\r\n }\r\n }\r\n return new Uint16Array(indices);\r\n }\r\n }\r\n // No 32 bit support, force conversion to 16 bit (values greater 16 bit are lost)\r\n return new Uint16Array(indices);\r\n };\r\n /**\r\n * Bind a webGL buffer to the webGL context\r\n * @param buffer defines the buffer to bind\r\n */\r\n Engine.prototype.bindArrayBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ARRAY_BUFFER);\r\n };\r\n /**\r\n * Bind an uniform buffer to the current webGL context\r\n * @param buffer defines the buffer to bind\r\n */\r\n Engine.prototype.bindUniformBuffer = function (buffer) {\r\n this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);\r\n };\r\n /**\r\n * Bind a buffer to the current webGL context at a given location\r\n * @param buffer defines the buffer to bind\r\n * @param location defines the index where to bind the buffer\r\n */\r\n Engine.prototype.bindUniformBufferBase = function (buffer, location) {\r\n this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);\r\n };\r\n /**\r\n * Bind a specific block at a given index in a specific shader program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param blockName defines the block name\r\n * @param index defines the index where to bind the block\r\n */\r\n Engine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n var program = pipelineContext.program;\r\n var uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\r\n this._gl.uniformBlockBinding(program, uniformLocation, index);\r\n };\r\n Engine.prototype.bindIndexBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ELEMENT_ARRAY_BUFFER);\r\n };\r\n Engine.prototype.bindBuffer = function (buffer, target) {\r\n if (this._vaoRecordInProgress || this._currentBoundBuffer[target] !== buffer) {\r\n this._gl.bindBuffer(target, buffer ? buffer.underlyingResource : null);\r\n this._currentBoundBuffer[target] = buffer;\r\n }\r\n };\r\n /**\r\n * update the bound buffer with the given data\r\n * @param data defines the data to update\r\n */\r\n Engine.prototype.updateArrayBuffer = function (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n };\r\n Engine.prototype._vertexAttribPointer = function (buffer, indx, size, type, normalized, stride, offset) {\r\n var pointer = this._currentBufferPointers[indx];\r\n var changed = false;\r\n if (!pointer.active) {\r\n changed = true;\r\n pointer.active = true;\r\n pointer.index = indx;\r\n pointer.size = size;\r\n pointer.type = type;\r\n pointer.normalized = normalized;\r\n pointer.stride = stride;\r\n pointer.offset = offset;\r\n pointer.buffer = buffer;\r\n }\r\n else {\r\n if (pointer.buffer !== buffer) {\r\n pointer.buffer = buffer;\r\n changed = true;\r\n }\r\n if (pointer.size !== size) {\r\n pointer.size = size;\r\n changed = true;\r\n }\r\n if (pointer.type !== type) {\r\n pointer.type = type;\r\n changed = true;\r\n }\r\n if (pointer.normalized !== normalized) {\r\n pointer.normalized = normalized;\r\n changed = true;\r\n }\r\n if (pointer.stride !== stride) {\r\n pointer.stride = stride;\r\n changed = true;\r\n }\r\n if (pointer.offset !== offset) {\r\n pointer.offset = offset;\r\n changed = true;\r\n }\r\n }\r\n if (changed || this._vaoRecordInProgress) {\r\n this.bindArrayBuffer(buffer);\r\n this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset);\r\n }\r\n };\r\n Engine.prototype._bindIndexBufferWithCache = function (indexBuffer) {\r\n if (indexBuffer == null) {\r\n return;\r\n }\r\n if (this._cachedIndexBuffer !== indexBuffer) {\r\n this._cachedIndexBuffer = indexBuffer;\r\n this.bindIndexBuffer(indexBuffer);\r\n this._uintIndicesCurrentlySet = indexBuffer.is32Bits;\r\n }\r\n };\r\n Engine.prototype._bindVertexBuffersAttributes = function (vertexBuffers, effect) {\r\n var attributes = effect.getAttributesNames();\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.unbindAllAttributes();\r\n for (var index = 0; index < attributes.length; index++) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n var vertexBuffer = vertexBuffers[attributes[index]];\r\n if (!vertexBuffer) {\r\n continue;\r\n }\r\n this._gl.enableVertexAttribArray(order);\r\n if (!this._vaoRecordInProgress) {\r\n this._vertexAttribArraysEnabled[order] = true;\r\n }\r\n var buffer = vertexBuffer.getBuffer();\r\n if (buffer) {\r\n this._vertexAttribPointer(buffer, order, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized, vertexBuffer.byteStride, vertexBuffer.byteOffset);\r\n if (vertexBuffer.getIsInstanced()) {\r\n this._gl.vertexAttribDivisor(order, vertexBuffer.getInstanceDivisor());\r\n if (!this._vaoRecordInProgress) {\r\n this._currentInstanceLocations.push(order);\r\n this._currentInstanceBuffers.push(buffer);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Records a vertex array object\r\n * @see http://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexBuffers defines the list of vertex buffers to store\r\n * @param indexBuffer defines the index buffer to store\r\n * @param effect defines the effect to store\r\n * @returns the new vertex array object\r\n */\r\n Engine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {\r\n var vao = this._gl.createVertexArray();\r\n this._vaoRecordInProgress = true;\r\n this._gl.bindVertexArray(vao);\r\n this._mustWipeVertexAttributes = true;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n this.bindIndexBuffer(indexBuffer);\r\n this._vaoRecordInProgress = false;\r\n this._gl.bindVertexArray(null);\r\n return vao;\r\n };\r\n /**\r\n * Bind a specific vertex array object\r\n * @see http://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexArrayObject defines the vertex array object to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n */\r\n Engine.prototype.bindVertexArrayObject = function (vertexArrayObject, indexBuffer) {\r\n if (this._cachedVertexArrayObject !== vertexArrayObject) {\r\n this._cachedVertexArrayObject = vertexArrayObject;\r\n this._gl.bindVertexArray(vertexArrayObject);\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._uintIndicesCurrentlySet = indexBuffer != null && indexBuffer.is32Bits;\r\n this._mustWipeVertexAttributes = true;\r\n }\r\n };\r\n /**\r\n * Bind webGl buffers directly to the webGL context\r\n * @param vertexBuffer defines the vertex buffer to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer\r\n * @param vertexStrideSize defines the vertex stride of the vertex buffer\r\n * @param effect defines the effect associated with the vertex buffer\r\n */\r\n Engine.prototype.bindBuffersDirectly = function (vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffer || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffer;\r\n this._cachedEffectForVertexBuffers = effect;\r\n var attributesCount = effect.getAttributesCount();\r\n this._unbindVertexArrayObject();\r\n this.unbindAllAttributes();\r\n var offset = 0;\r\n for (var index = 0; index < attributesCount; index++) {\r\n if (index < vertexDeclaration.length) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n this._gl.enableVertexAttribArray(order);\r\n this._vertexAttribArraysEnabled[order] = true;\r\n this._vertexAttribPointer(vertexBuffer, order, vertexDeclaration[index], this._gl.FLOAT, false, vertexStrideSize, offset);\r\n }\r\n offset += vertexDeclaration[index] * 4;\r\n }\r\n }\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n Engine.prototype._unbindVertexArrayObject = function () {\r\n if (!this._cachedVertexArrayObject) {\r\n return;\r\n }\r\n this._cachedVertexArrayObject = null;\r\n this._gl.bindVertexArray(null);\r\n };\r\n /**\r\n * Bind a list of vertex buffers to the webGL context\r\n * @param vertexBuffers defines the list of vertex buffers to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param effect defines the effect associated with the vertex buffers\r\n */\r\n Engine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffers || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffers;\r\n this._cachedEffectForVertexBuffers = effect;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n /**\r\n * Unbind all instance attributes\r\n */\r\n Engine.prototype.unbindInstanceAttributes = function () {\r\n var boundBuffer;\r\n for (var i = 0, ul = this._currentInstanceLocations.length; i < ul; i++) {\r\n var instancesBuffer = this._currentInstanceBuffers[i];\r\n if (boundBuffer != instancesBuffer && instancesBuffer.references) {\r\n boundBuffer = instancesBuffer;\r\n this.bindArrayBuffer(instancesBuffer);\r\n }\r\n var offsetLocation = this._currentInstanceLocations[i];\r\n this._gl.vertexAttribDivisor(offsetLocation, 0);\r\n }\r\n this._currentInstanceBuffers.length = 0;\r\n this._currentInstanceLocations.length = 0;\r\n };\r\n /**\r\n * Release and free the memory of a vertex array object\r\n * @param vao defines the vertex array object to delete\r\n */\r\n Engine.prototype.releaseVertexArrayObject = function (vao) {\r\n this._gl.deleteVertexArray(vao);\r\n };\r\n /** @hidden */\r\n Engine.prototype._releaseBuffer = function (buffer) {\r\n buffer.references--;\r\n if (buffer.references === 0) {\r\n this._deleteBuffer(buffer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n Engine.prototype._deleteBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer.underlyingResource);\r\n };\r\n /**\r\n * Creates a webGL buffer to use with instanciation\r\n * @param capacity defines the size of the buffer\r\n * @returns the webGL buffer\r\n */\r\n Engine.prototype.createInstancesBuffer = function (capacity) {\r\n var buffer = this._gl.createBuffer();\r\n if (!buffer) {\r\n throw new Error(\"Unable to create instance buffer\");\r\n }\r\n var result = new _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_14__[\"WebGLDataBuffer\"](buffer);\r\n result.capacity = capacity;\r\n this.bindArrayBuffer(result);\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);\r\n return result;\r\n };\r\n /**\r\n * Delete a webGL buffer used with instanciation\r\n * @param buffer defines the webGL buffer to delete\r\n */\r\n Engine.prototype.deleteInstancesBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer);\r\n };\r\n /**\r\n * Update the content of a webGL buffer used with instanciation and bind it to the webGL context\r\n * @param instancesBuffer defines the webGL buffer to update and bind\r\n * @param data defines the data to store in the buffer\r\n * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer\r\n */\r\n Engine.prototype.updateAndBindInstancesBuffer = function (instancesBuffer, data, offsetLocations) {\r\n this.bindArrayBuffer(instancesBuffer);\r\n if (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n if (offsetLocations[0].index !== undefined) {\r\n var stride = 0;\r\n for (var i = 0; i < offsetLocations.length; i++) {\r\n var ai = offsetLocations[i];\r\n stride += ai.attributeSize * 4;\r\n }\r\n for (var i = 0; i < offsetLocations.length; i++) {\r\n var ai = offsetLocations[i];\r\n if (!this._vertexAttribArraysEnabled[ai.index]) {\r\n this._gl.enableVertexAttribArray(ai.index);\r\n this._vertexAttribArraysEnabled[ai.index] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attribyteType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);\r\n this._gl.vertexAttribDivisor(ai.index, 1);\r\n this._currentInstanceLocations.push(ai.index);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n else {\r\n for (var index = 0; index < 4; index++) {\r\n var offsetLocation = offsetLocations[index];\r\n if (!this._vertexAttribArraysEnabled[offsetLocation]) {\r\n this._gl.enableVertexAttribArray(offsetLocation);\r\n this._vertexAttribArraysEnabled[offsetLocation] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16);\r\n this._gl.vertexAttribDivisor(offsetLocation, 1);\r\n this._currentInstanceLocations.push(offsetLocation);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n };\r\n /**\r\n * Apply all cached states (depth, culling, stencil and alpha)\r\n */\r\n Engine.prototype.applyStates = function () {\r\n this._depthCullingState.apply(this._gl);\r\n this._stencilState.apply(this._gl);\r\n this._alphaState.apply(this._gl);\r\n };\r\n /**\r\n * Send a draw order\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {\r\n this.drawElementsType(useTriangles ? _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode : _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode, indexStart, indexCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of points\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawPointClouds = function (verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointFillMode, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawUnIndexed = function (useTriangles, verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(useTriangles ? _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode : _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of indexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._drawCalls.addCount(1, false);\r\n // Render\r\n var drawMode = this._drawMode(fillMode);\r\n var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\r\n var mult = this._uintIndicesCurrentlySet ? 4 : 2;\r\n if (instancesCount) {\r\n this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\r\n }\r\n else {\r\n this._gl.drawElements(drawMode, indexCount, indexFormat, indexStart * mult);\r\n }\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n Engine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._drawCalls.addCount(1, false);\r\n var drawMode = this._drawMode(fillMode);\r\n if (instancesCount) {\r\n this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\r\n }\r\n else {\r\n this._gl.drawArrays(drawMode, verticesStart, verticesCount);\r\n }\r\n };\r\n Engine.prototype._drawMode = function (fillMode) {\r\n switch (fillMode) {\r\n // Triangle views\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode:\r\n return this._gl.TRIANGLES;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointFillMode:\r\n return this._gl.POINTS;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode:\r\n return this._gl.LINES;\r\n // Draw modes\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointListDrawMode:\r\n return this._gl.POINTS;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineListDrawMode:\r\n return this._gl.LINES;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineLoopDrawMode:\r\n return this._gl.LINE_LOOP;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineStripDrawMode:\r\n return this._gl.LINE_STRIP;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleStripDrawMode:\r\n return this._gl.TRIANGLE_STRIP;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFanDrawMode:\r\n return this._gl.TRIANGLE_FAN;\r\n default:\r\n return this._gl.TRIANGLES;\r\n }\r\n };\r\n // Shaders\r\n /** @hidden */\r\n Engine.prototype._releaseEffect = function (effect) {\r\n if (this._compiledEffects[effect._key]) {\r\n delete this._compiledEffects[effect._key];\r\n this._deletePipelineContext(effect.getPipelineContext());\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._deletePipelineContext = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (webGLPipelineContext && webGLPipelineContext.program) {\r\n webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;\r\n if (webGLPipelineContext.transformFeedback) {\r\n this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);\r\n webGLPipelineContext.transformFeedback = null;\r\n }\r\n this._gl.deleteProgram(webGLPipelineContext.program);\r\n }\r\n };\r\n /**\r\n * Create a new effect (used to store vertex/fragment shaders)\r\n * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)\r\n * @param attributesNamesOrOptions defines either a list of attribute names or an EffectCreationOptions object\r\n * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use\r\n * @param samplers defines an array of string used to represent textures\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param fallbacks defines the list of potential fallbacks to use if shader conmpilation fails\r\n * @param onCompiled defines a function to call when the effect creation is successful\r\n * @param onError defines a function to call when the effect creation has failed\r\n * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)\r\n * @returns the new Effect\r\n */\r\n Engine.prototype.createEffect = function (baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName;\r\n var name = vertex + \"+\" + fragment + \"@\" + (defines ? defines : attributesNamesOrOptions.defines);\r\n if (this._compiledEffects[name]) {\r\n var compiledEffect = this._compiledEffects[name];\r\n if (onCompiled && compiledEffect.isReady()) {\r\n onCompiled(compiledEffect);\r\n }\r\n return compiledEffect;\r\n }\r\n var effect = new _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"](baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters);\r\n effect._key = name;\r\n this._compiledEffects[name] = effect;\r\n return effect;\r\n };\r\n Engine._concatenateShader = function (source, defines, shaderVersion) {\r\n if (shaderVersion === void 0) { shaderVersion = \"\"; }\r\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\r\n };\r\n Engine.prototype._compileShader = function (source, type, defines, shaderVersion) {\r\n return this._compileRawShader(Engine._concatenateShader(source, defines, shaderVersion), type);\r\n };\r\n Engine.prototype._compileRawShader = function (source, type) {\r\n var gl = this._gl;\r\n var shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n if (!shader) {\r\n throw new Error(\"Something went wrong while compile the shader.\");\r\n }\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n return shader;\r\n };\r\n /**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n Engine.prototype.createRawShaderProgram = function (pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var vertexShader = this._compileRawShader(vertexCode, \"vertex\");\r\n var fragmentShader = this._compileRawShader(fragmentCode, \"fragment\");\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n Engine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n this.onBeforeShaderCompilationObservable.notifyObservers(this);\r\n var shaderVersion = (this._webGLVersion > 1) ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n var vertexShader = this._compileShader(vertexCode, \"vertex\", defines, shaderVersion);\r\n var fragmentShader = this._compileShader(fragmentCode, \"fragment\", defines, shaderVersion);\r\n var program = this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n this.onAfterShaderCompilationObservable.notifyObservers(this);\r\n return program;\r\n };\r\n /**\r\n * Creates a new pipeline context\r\n * @returns the new pipeline\r\n */\r\n Engine.prototype.createPipelineContext = function () {\r\n var pipelineContext = new _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_13__[\"WebGLPipelineContext\"]();\r\n pipelineContext.engine = this;\r\n if (this._caps.parallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n return pipelineContext;\r\n };\r\n Engine.prototype._createShaderProgram = function (pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n var shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n var transformFeedback = this.createTransformFeedback();\r\n this.bindTransformFeedback(transformFeedback);\r\n this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);\r\n pipelineContext.transformFeedback = transformFeedback;\r\n }\r\n context.linkProgram(shaderProgram);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n this.bindTransformFeedback(null);\r\n }\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n if (!pipelineContext.isParallelCompiled) {\r\n this._finalizePipelineContext(pipelineContext);\r\n }\r\n return shaderProgram;\r\n };\r\n Engine.prototype._finalizePipelineContext = function (pipelineContext) {\r\n var context = pipelineContext.context;\r\n var vertexShader = pipelineContext.vertexShader;\r\n var fragmentShader = pipelineContext.fragmentShader;\r\n var program = pipelineContext.program;\r\n var linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) { // Get more info\r\n // Vertex\r\n if (!this._gl.getShaderParameter(vertexShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n // Fragment\r\n if (!this._gl.getShaderParameter(fragmentShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n if (this.validateShaderPrograms) {\r\n context.validateProgram(program);\r\n var validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n if (!validated) {\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._preparePipelineContext = function (pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rebuildRebind, defines, transformFeedbackVaryings) {\r\n var webGLRenderingState = pipelineContext;\r\n if (createAsRaw) {\r\n webGLRenderingState.program = this.createRawShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\r\n }\r\n else {\r\n webGLRenderingState.program = this.createShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n };\r\n /** @hidden */\r\n Engine.prototype._isRenderingStateCompiled = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (this._gl.getProgramParameter(webGLPipelineContext.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\r\n this._finalizePipelineContext(webGLPipelineContext);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n Engine.prototype._executeWhenRenderingStateIsCompiled = function (pipelineContext, action) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action();\r\n return;\r\n }\r\n webGLPipelineContext.onCompiled = action;\r\n };\r\n /**\r\n * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param uniformsNames defines the list of uniform names\r\n * @returns an array of webGL uniform locations\r\n */\r\n Engine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n var results = new Array();\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < uniformsNames.length; index++) {\r\n results.push(this._gl.getUniformLocation(webGLPipelineContext.program, uniformsNames[index]));\r\n }\r\n return results;\r\n };\r\n /**\r\n * Gets the lsit of active attributes for a given webGL program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param attributesNames defines the list of attribute names to get\r\n * @returns an array of indices indicating the offset of each attribute\r\n */\r\n Engine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n var results = [];\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < attributesNames.length; index++) {\r\n try {\r\n results.push(this._gl.getAttribLocation(webGLPipelineContext.program, attributesNames[index]));\r\n }\r\n catch (e) {\r\n results.push(-1);\r\n }\r\n }\r\n return results;\r\n };\r\n /**\r\n * Activates an effect, mkaing it the current one (ie. the one used for rendering)\r\n * @param effect defines the effect to activate\r\n */\r\n Engine.prototype.enableEffect = function (effect) {\r\n if (!effect || effect === this._currentEffect) {\r\n return;\r\n }\r\n // Use program\r\n this.bindSamplers(effect);\r\n this._currentEffect = effect;\r\n if (effect.onBind) {\r\n effect.onBind(effect);\r\n }\r\n if (effect._onBindObservable) {\r\n effect._onBindObservable.notifyObservers(effect);\r\n }\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n Engine.prototype.setIntArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of float32 to store\r\n */\r\n Engine.prototype.setFloatArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n Engine.prototype.setArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as matrices)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrices defines the array of float32 to store\r\n */\r\n Engine.prototype.setMatrices = function (uniform, matrices) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix4fv(uniform, false, matrices);\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (3x3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 3x3 matrix to store\r\n */\r\n Engine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix3fv(uniform, false, matrix);\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (2x2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 2x2 matrix to store\r\n */\r\n Engine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix2fv(uniform, false, matrix);\r\n };\r\n /**\r\n * Set the value of an uniform to a number (int)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the int number to store\r\n */\r\n Engine.prototype.setInt = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, value);\r\n };\r\n /**\r\n * Set the value of an uniform to a number (float)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the float number to store\r\n */\r\n Engine.prototype.setFloat = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1f(uniform, value);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec2\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n */\r\n Engine.prototype.setFloat2 = function (uniform, x, y) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform2f(uniform, x, y);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec3\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n */\r\n Engine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform3f(uniform, x, y, z);\r\n };\r\n /**\r\n * Set the value of an uniform to a boolean\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param bool defines the boolean to store\r\n */\r\n Engine.prototype.setBool = function (uniform, bool) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, bool);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec4\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n * @param w defines the 4th component of the value\r\n */\r\n Engine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform4f(uniform, x, y, z, w);\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniform defines the uniform location\r\n * @param color4 defines the value to be set\r\n */\r\n Engine.prototype.setDirectColor4 = function (uniform, color4) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform4f(uniform, color4.r, color4.g, color4.b, color4.a);\r\n };\r\n // States\r\n /**\r\n * Set various states to the webGL context\r\n * @param culling defines backface culling state\r\n * @param zOffset defines the value to apply to zOffset (0 by default)\r\n * @param force defines if states must be applied even if cache is up to date\r\n * @param reverseSide defines if culling must be reversed (CCW instead of CW and CW instead of CCW)\r\n */\r\n Engine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n // Culling\r\n if (this._depthCullingState.cull !== culling || force) {\r\n this._depthCullingState.cull = culling;\r\n }\r\n // Cull face\r\n var cullFace = this.cullBackFaces ? this._gl.BACK : this._gl.FRONT;\r\n if (this._depthCullingState.cullFace !== cullFace || force) {\r\n this._depthCullingState.cullFace = cullFace;\r\n }\r\n // Z offset\r\n this.setZOffset(zOffset);\r\n // Front face\r\n var frontFace = reverseSide ? this._gl.CW : this._gl.CCW;\r\n if (this._depthCullingState.frontFace !== frontFace || force) {\r\n this._depthCullingState.frontFace = frontFace;\r\n }\r\n };\r\n /**\r\n * Set the z offset to apply to current rendering\r\n * @param value defines the offset to apply\r\n */\r\n Engine.prototype.setZOffset = function (value) {\r\n this._depthCullingState.zOffset = value;\r\n };\r\n /**\r\n * Gets the current value of the zOffset\r\n * @returns the current zOffset state\r\n */\r\n Engine.prototype.getZOffset = function () {\r\n return this._depthCullingState.zOffset;\r\n };\r\n /**\r\n * Enable or disable depth buffering\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthBuffer = function (enable) {\r\n this._depthCullingState.depthTest = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if depth writing is enabled\r\n * @returns the current depth writing state\r\n */\r\n Engine.prototype.getDepthWrite = function () {\r\n return this._depthCullingState.depthMask;\r\n };\r\n /**\r\n * Enable or disable depth writing\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthWrite = function (enable) {\r\n this._depthCullingState.depthMask = enable;\r\n };\r\n /**\r\n * Enable or disable color writing\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setColorWrite = function (enable) {\r\n this._gl.colorMask(enable, enable, enable, enable);\r\n this._colorWrite = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if color writing is enabled\r\n * @returns the current color writing state\r\n */\r\n Engine.prototype.getColorWrite = function () {\r\n return this._colorWrite;\r\n };\r\n /**\r\n * Sets alpha constants used by some alpha blending modes\r\n * @param r defines the red component\r\n * @param g defines the green component\r\n * @param b defines the blue component\r\n * @param a defines the alpha component\r\n */\r\n Engine.prototype.setAlphaConstants = function (r, g, b, a) {\r\n this._alphaState.setAlphaBlendConstants(r, g, b, a);\r\n };\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n */\r\n Engine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n switch (mode) {\r\n case Engine.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Engine.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Engine.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === Engine.ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n };\r\n /**\r\n * Gets the current alpha mode\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n * @returns the current alpha mode\r\n */\r\n Engine.prototype.getAlphaMode = function () {\r\n return this._alphaMode;\r\n };\r\n // Textures\r\n /**\r\n * Clears the list of texture accessible through engine.\r\n * This can help preventing texture load conflict due to name collision.\r\n */\r\n Engine.prototype.clearInternalTexturesCache = function () {\r\n this._internalTexturesCache = [];\r\n };\r\n /**\r\n * Force the entire cache to be cleared\r\n * You should not have to use this function unless your engine needs to share the webGL context with another engine\r\n * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)\r\n */\r\n Engine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames && !bruteForce) {\r\n return;\r\n }\r\n this._currentEffect = null;\r\n this._viewportCached.x = 0;\r\n this._viewportCached.y = 0;\r\n this._viewportCached.z = 0;\r\n this._viewportCached.w = 0;\r\n if (bruteForce) {\r\n this.resetTextureCache();\r\n this._currentProgram = null;\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this.setDepthFunctionToLessOrEqual();\r\n this._alphaState.reset();\r\n this._unpackFlipYCached = null;\r\n }\r\n this._resetVertexBufferBinding();\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n this._unbindVertexArrayObject();\r\n this.bindIndexBuffer(null);\r\n };\r\n /**\r\n * Set the compressed texture format to use, based on the formats you have, and the formats\r\n * supported by the hardware / browser.\r\n *\r\n * Khronos Texture Container (.ktx) files are used to support this. This format has the\r\n * advantage of being specifically designed for OpenGL. Header elements directly correspond\r\n * to API arguments needed to compressed textures. This puts the burden on the container\r\n * generator to house the arcane code for determining these for current & future formats.\r\n *\r\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\r\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\r\n *\r\n * Note: The result of this call is not taken into account when a texture is base64.\r\n *\r\n * @param formatsAvailable defines the list of those format families you have created\r\n * on your server. Syntax: '-' + format family + '.ktx'. (Case and order do not matter.)\r\n *\r\n * Current families are astc, dxt, pvrtc, etc2, & etc1.\r\n * @returns The extension selected.\r\n */\r\n Engine.prototype.setTextureFormatToUse = function (formatsAvailable) {\r\n for (var i = 0, len1 = this.texturesSupported.length; i < len1; i++) {\r\n for (var j = 0, len2 = formatsAvailable.length; j < len2; j++) {\r\n if (this._texturesSupported[i] === formatsAvailable[j].toLowerCase()) {\r\n return this._textureFormatInUse = this._texturesSupported[i];\r\n }\r\n }\r\n }\r\n // actively set format to nothing, to allow this to be called more than once\r\n // and possibly fail the 2nd time\r\n this._textureFormatInUse = null;\r\n return null;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getSamplingParameters = function (samplingMode, generateMipMaps) {\r\n var gl = this._gl;\r\n var magFilter = gl.NEAREST;\r\n var minFilter = gl.NEAREST;\r\n switch (samplingMode) {\r\n case Engine.TEXTURE_BILINEAR_SAMPLINGMODE:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_TRILINEAR_SAMPLINGMODE:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_SAMPLINGMODE:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case Engine.TEXTURE_NEAREST_LINEAR:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case Engine.TEXTURE_NEAREST_NEAREST:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.NEAREST;\r\n break;\r\n case Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case Engine.TEXTURE_LINEAR_LINEAR:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case Engine.TEXTURE_LINEAR_NEAREST:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.NEAREST;\r\n break;\r\n }\r\n return {\r\n min: minFilter,\r\n mag: magFilter\r\n };\r\n };\r\n /** @hidden */\r\n Engine.prototype._createTexture = function () {\r\n var texture = this._gl.createTexture();\r\n if (!texture) {\r\n throw new Error(\"Unable to create texture\");\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Usually called from Texture.ts.\r\n * Passed information to create a WebGLTexture\r\n * @param urlArg defines a value which contains one of the following:\r\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\r\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\r\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\r\n * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)\r\n * @param scene needed for loading to the correct scene\r\n * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param onLoad optional callback to be called upon successful completion\r\n * @param onError optional callback to be called upon failure\r\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob\r\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\r\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param excludeLoaders array of texture loaders that should be excluded when picking a loader for the texture (default: empty array)\r\n * @returns a InternalTexture for assignment back into BABYLON.Texture\r\n */\r\n Engine.prototype.createTexture = function (urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension, excludeLoaders) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (format === void 0) { format = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (excludeLoaders === void 0) { excludeLoaders = []; }\r\n var url = String(urlArg); // assign a new string, so that the original is still available in case of fallback\r\n var fromData = url.substr(0, 5) === \"data:\";\r\n var fromBlob = url.substr(0, 5) === \"blob:\";\r\n var isBase64 = fromData && url.indexOf(\";base64,\") !== -1;\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_URL);\r\n // establish the file extension, if possible\r\n var lastDot = url.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n for (var _i = 0, _a = Engine._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (excludeLoaders.indexOf(availableLoader) === -1 && availableLoader.canLoad(extension, this._textureFormatInUse, fallback, isBase64, buffer ? true : false)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n if (loader) {\r\n url = loader.transformUrl(url, this._textureFormatInUse);\r\n }\r\n if (scene) {\r\n scene._addPendingData(texture);\r\n }\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n if (!this._doNotHandleContextLost) {\r\n // Keep a link to the buffer only if we plan to handle context lost\r\n texture._buffer = buffer;\r\n }\r\n var onLoadObserver = null;\r\n if (onLoad && !fallback) {\r\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\r\n }\r\n if (!fallback) {\r\n this._internalTexturesCache.push(texture);\r\n }\r\n var onInternalError = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n var customFallback = false;\r\n if (loader) {\r\n var fallbackUrl = loader.getFallbackTextureUrl(url, _this._textureFormatInUse);\r\n if (fallbackUrl) {\r\n // Add Back\r\n customFallback = true;\r\n excludeLoaders.push(loader);\r\n _this.createTexture(urlArg, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture, undefined, undefined, excludeLoaders);\r\n return;\r\n }\r\n }\r\n if (!customFallback) {\r\n if (onLoadObserver) {\r\n texture.onLoadedObservable.remove(onLoadObserver);\r\n }\r\n if (_engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].UseFallbackTexture) {\r\n _this.createTexture(_engineStore__WEBPACK_IMPORTED_MODULE_10__[\"EngineStore\"].FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture);\r\n return;\r\n }\r\n }\r\n if (onError) {\r\n onError(message || \"Unknown error\", exception);\r\n }\r\n };\r\n // processing for non-image formats\r\n if (loader) {\r\n var callback = function (data) {\r\n loader.loadData(data, texture, function (width, height, loadMipmap, isCompressed, done, loadFailed) {\r\n if (loadFailed) {\r\n onInternalError(\"TextureLoader failed to load data\");\r\n }\r\n else {\r\n _this._prepareWebGLTexture(texture, scene, width, height, texture.invertY, !loadMipmap, isCompressed, function () {\r\n done();\r\n return false;\r\n }, samplingMode);\r\n }\r\n });\r\n };\r\n if (!buffer) {\r\n this._loadFile(url, callback, undefined, scene ? scene.offlineProvider : undefined, true, function (request, exception) {\r\n onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\r\n });\r\n }\r\n else {\r\n //callback(buffer as ArrayBuffer);\r\n if (buffer instanceof ArrayBuffer) {\r\n callback(buffer);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Unable to load: only ArrayBuffer supported here\", null);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var onload = function (img) {\r\n if (fromBlob && !_this._doNotHandleContextLost) {\r\n // We need to store the image if we need to rebuild the texture\r\n // in case of a webgl context lost\r\n texture._buffer = img;\r\n }\r\n _this._prepareWebGLTexture(texture, scene, img.width, img.height, texture.invertY, noMipmap, false, function (potWidth, potHeight, continuationCallback) {\r\n var gl = _this._gl;\r\n var isPot = (img.width === potWidth && img.height === potHeight);\r\n var internalFormat = format ? _this._getInternalFormat(format) : ((extension === \".jpg\") ? gl.RGB : gl.RGBA);\r\n if (isPot) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n return false;\r\n }\r\n var maxTextureSize = _this._caps.maxTextureSize;\r\n if (img.width > maxTextureSize || img.height > maxTextureSize || Engine._RescalePostProcessFactory === null) {\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n return false;\r\n }\r\n _this._workingCanvas.width = potWidth;\r\n _this._workingCanvas.height = potHeight;\r\n _this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n return false;\r\n }\r\n else {\r\n // Using shaders when possible to rescale because canvas.drawImage is lossy\r\n var source_1 = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](_this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, source_1, true);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n _this._rescaleTexture(source_1, texture, scene, internalFormat, function () {\r\n _this._releaseTexture(source_1);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n continuationCallback();\r\n });\r\n }\r\n return true;\r\n }, samplingMode);\r\n };\r\n if (!fromData || isBase64) {\r\n if (buffer instanceof HTMLImageElement) {\r\n onload(buffer);\r\n }\r\n else {\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__[\"FileTools\"].LoadImage(url, onload, onInternalError, scene ? scene.offlineProvider : null);\r\n }\r\n }\r\n else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__[\"FileTools\"].LoadImage(buffer, onload, onInternalError, scene ? scene.offlineProvider : null);\r\n }\r\n else {\r\n onload(buffer);\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * @hidden\r\n * Rescales a texture\r\n * @param source input texutre\r\n * @param destination destination texture\r\n * @param scene scene to use to render the resize\r\n * @param internalFormat format to use when resizing\r\n * @param onComplete callback to be called when resize has completed\r\n */\r\n Engine.prototype._rescaleTexture = function (source, destination, scene, internalFormat, onComplete) {\r\n var _this = this;\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);\r\n var rtt = this.createRenderTargetTexture({\r\n width: destination.width,\r\n height: destination.height,\r\n }, {\r\n generateMipMaps: false,\r\n type: Engine.TEXTURETYPE_UNSIGNED_INT,\r\n samplingMode: Engine.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false\r\n });\r\n if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {\r\n this._rescalePostProcess = Engine._RescalePostProcessFactory(this);\r\n }\r\n this._rescalePostProcess.getEffect().executeWhenCompiled(function () {\r\n _this._rescalePostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", source);\r\n };\r\n var hostingScene = scene;\r\n if (!hostingScene) {\r\n hostingScene = _this.scenes[_this.scenes.length - 1];\r\n }\r\n hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);\r\n _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination, true);\r\n _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);\r\n _this.unBindFramebuffer(rtt);\r\n _this._releaseTexture(rtt);\r\n if (onComplete) {\r\n onComplete();\r\n }\r\n });\r\n };\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n Engine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = Engine.TEXTURETYPE_UNSIGNED_INT; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"Engine.RawTexture\");\r\n };\r\n /** @hidden */\r\n Engine.prototype._unpackFlipY = function (value) {\r\n if (this._unpackFlipYCached !== value) {\r\n this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);\r\n if (this.enableUnpackFlipYCached) {\r\n this._unpackFlipYCached = value;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._getUnpackAlignement = function () {\r\n return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);\r\n };\r\n /**\r\n * Creates a dynamic texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @returns the dynamic texture inside an InternalTexture\r\n */\r\n Engine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_DYNAMIC);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n if (generateMipMaps) {\r\n width = this.needPOTTextures ? Engine.GetExponentOfTwo(width, this._caps.maxTextureSize) : width;\r\n height = this.needPOTTextures ? Engine.GetExponentOfTwo(height, this._caps.maxTextureSize) : height;\r\n }\r\n // this.resetTextureCache();\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = false;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n this.updateTextureSamplingMode(samplingMode, texture);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n /**\r\n * Update the sampling mode of a given texture\r\n * @param samplingMode defines the required sampling mode\r\n * @param texture defines the texture to update\r\n */\r\n Engine.prototype.updateTextureSamplingMode = function (samplingMode, texture) {\r\n var filters = this._getSamplingParameters(samplingMode, texture.generateMipMaps);\r\n if (texture.isCube) {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else if (texture.is3D) {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n else {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n texture.samplingMode = samplingMode;\r\n };\r\n /**\r\n * Update the content of a dynamic texture\r\n * @param texture defines the texture to update\r\n * @param canvas defines the canvas containing the source\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param premulAlpha defines if alpha is stored as premultiplied\r\n * @param format defines the format of the data\r\n * @param forceBindTexture if the texture should be forced to be bound eg. after a graphics context loss (Default: false)\r\n */\r\n Engine.prototype.updateDynamicTexture = function (texture, canvas, invertY, premulAlpha, format, forceBindTexture) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n if (forceBindTexture === void 0) { forceBindTexture = false; }\r\n if (!texture) {\r\n return;\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true, forceBindTexture);\r\n this._unpackFlipY(invertY);\r\n if (premulAlpha) {\r\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);\r\n }\r\n var internalFormat = format ? this._getInternalFormat(format) : this._gl.RGBA;\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalFormat, internalFormat, this._gl.UNSIGNED_BYTE, canvas);\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n if (premulAlpha) {\r\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\r\n }\r\n texture.isReady = true;\r\n };\r\n /**\r\n * Update a video texture\r\n * @param texture defines the texture to update\r\n * @param video defines the video element to use\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n Engine.prototype.updateVideoTexture = function (texture, video, invertY) {\r\n if (!texture || texture._isDisabled) {\r\n return;\r\n }\r\n var wasPreviouslyBound = this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(!invertY); // Video are upside down by default\r\n try {\r\n // Testing video texture support\r\n if (this._videoTextureSupported === undefined) {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, video);\r\n if (this._gl.getError() !== 0) {\r\n this._videoTextureSupported = false;\r\n }\r\n else {\r\n this._videoTextureSupported = true;\r\n }\r\n }\r\n // Copy video through the current working canvas if video texture is not supported\r\n if (!this._videoTextureSupported) {\r\n if (!texture._workingCanvas) {\r\n texture._workingCanvas = document.createElement(\"canvas\");\r\n var context = texture._workingCanvas.getContext(\"2d\");\r\n if (!context) {\r\n throw new Error(\"Unable to get 2d context\");\r\n }\r\n texture._workingContext = context;\r\n texture._workingCanvas.width = texture.width;\r\n texture._workingCanvas.height = texture.height;\r\n }\r\n texture._workingContext.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, texture.width, texture.height);\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, texture._workingCanvas);\r\n }\r\n else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, video);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n if (!wasPreviouslyBound) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n }\r\n catch (ex) {\r\n // Something unexpected\r\n // Let's disable the texture\r\n texture._isDisabled = true;\r\n }\r\n };\r\n /**\r\n * Updates a depth texture Comparison Mode and Function.\r\n * If the comparison Function is equal to 0, the mode will be set to none.\r\n * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.\r\n * @param texture The texture to set the comparison function for\r\n * @param comparisonFunction The comparison function to set, 0 if no comparison required\r\n */\r\n Engine.prototype.updateTextureComparisonFunction = function (texture, comparisonFunction) {\r\n if (this.webGLVersion === 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Error(\"WebGL 1 does not support texture comparison.\");\r\n return;\r\n }\r\n var gl = this._gl;\r\n if (texture.isCube) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, Engine.LEQUAL);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, Engine.LEQUAL);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n texture._comparisonFunction = comparisonFunction;\r\n };\r\n /** @hidden */\r\n Engine.prototype._setupDepthStencilTexture = function (internalTexture, size, generateStencil, bilinearFiltering, comparisonFunction) {\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n internalTexture.baseWidth = width;\r\n internalTexture.baseHeight = height;\r\n internalTexture.width = width;\r\n internalTexture.height = height;\r\n internalTexture.isReady = true;\r\n internalTexture.samples = 1;\r\n internalTexture.generateMipMaps = false;\r\n internalTexture._generateDepthBuffer = true;\r\n internalTexture._generateStencilBuffer = generateStencil;\r\n internalTexture.samplingMode = bilinearFiltering ? Engine.TEXTURE_BILINEAR_SAMPLINGMODE : Engine.TEXTURE_NEAREST_SAMPLINGMODE;\r\n internalTexture.type = Engine.TEXTURETYPE_UNSIGNED_INT;\r\n internalTexture._comparisonFunction = comparisonFunction;\r\n var gl = this._gl;\r\n var target = internalTexture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n var samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);\r\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);\r\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, Engine.LEQUAL);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n };\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @returns The texture\r\n */\r\n Engine.prototype.createDepthStencilTexture = function (size, options) {\r\n if (options.isCube) {\r\n var width = size.width || size;\r\n return this._createDepthStencilCubeTexture(width, options);\r\n }\r\n else {\r\n return this._createDepthStencilTexture(size, options);\r\n }\r\n };\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param size The size of face edge in the texture.\r\n * @param options The options defining the texture.\r\n * @returns The texture\r\n */\r\n Engine.prototype._createDepthStencilTexture = function (size, options) {\r\n var internalTexture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_DEPTHTEXTURE);\r\n if (!this._caps.depthTextureExtension) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_2D, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n if (this.webGLVersion > 1) {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH24_STENCIL8, internalTexture.width, internalTexture.height, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT24, internalTexture.width, internalTexture.height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n else {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_STENCIL, internalTexture.width, internalTexture.height, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, internalTexture.width, internalTexture.height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n return internalTexture;\r\n };\r\n /**\r\n * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.\r\n * @param renderTarget The render target to set the frame buffer for\r\n */\r\n Engine.prototype.setFrameBufferDepthStencilTexture = function (renderTarget) {\r\n // Create the framebuffer\r\n var internalTexture = renderTarget.getInternalTexture();\r\n if (!internalTexture || !internalTexture._framebuffer || !renderTarget.depthStencilTexture) {\r\n return;\r\n }\r\n var gl = this._gl;\r\n var depthStencilTexture = renderTarget.depthStencilTexture;\r\n this._bindUnboundFramebuffer(internalTexture._framebuffer);\r\n if (depthStencilTexture.isCube) {\r\n if (depthStencilTexture._generateStencilBuffer) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);\r\n }\r\n }\r\n else {\r\n if (depthStencilTexture._generateStencilBuffer) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);\r\n }\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n };\r\n /**\r\n * Creates a new render target texture\r\n * @param size defines the size of the texture\r\n * @param options defines the options used to create the texture\r\n * @returns a new render target texture stored in an InternalTexture\r\n */\r\n Engine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_11__[\"RenderTargetCreationOptions\"]();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? Engine.TEXTURETYPE_UNSIGNED_INT : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? Engine.TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;\r\n fullOptions.format = options.format === undefined ? Engine.TEXTUREFORMAT_RGBA : options.format;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = Engine.TEXTURETYPE_UNSIGNED_INT;\r\n fullOptions.samplingMode = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n fullOptions.format = Engine.TEXTUREFORMAT_RGBA;\r\n }\r\n if (fullOptions.type === Engine.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n else if (fullOptions.type === Engine.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = Engine.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n var gl = this._gl;\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_5__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps ? true : false);\r\n if (fullOptions.type === Engine.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n fullOptions.type = Engine.TEXTURETYPE_UNSIGNED_INT;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);\r\n // Create the framebuffer\r\n var currentFrameBuffer = this._currentFramebuffer;\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);\r\n if (fullOptions.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n texture._framebuffer = framebuffer;\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n // this.resetTextureCache();\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n /** @hidden */\r\n Engine.prototype._setupFramebufferDepthAttachments = function (generateStencilBuffer, generateDepthBuffer, width, height, samples) {\r\n if (samples === void 0) { samples = 1; }\r\n var depthStencilBuffer = null;\r\n var gl = this._gl;\r\n // Create the depth/stencil buffer\r\n if (generateStencilBuffer) {\r\n depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH24_STENCIL8, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);\r\n }\r\n else if (generateDepthBuffer) {\r\n depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH_COMPONENT16, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);\r\n }\r\n return depthStencilBuffer;\r\n };\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see http://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param texture defines the texture to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n Engine.prototype.updateRenderTargetTextureSampleCount = function (texture, samples) {\r\n if (this.webGLVersion < 2 || !texture) {\r\n return 1;\r\n }\r\n if (texture.samples === samples) {\r\n return samples;\r\n }\r\n var gl = this._gl;\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n // Dispose previous render buffers\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n if (samples > 1) {\r\n var framebuffer = gl.createFramebuffer();\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n texture._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer);\r\n var colorRenderbuffer = gl.createRenderbuffer();\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, colorRenderbuffer);\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, this._getRGBAMultiSampleBufferFormat(texture.type), texture.width, texture.height);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorRenderbuffer);\r\n texture._MSAARenderBuffer = colorRenderbuffer;\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n texture.samples = samples;\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(texture._generateStencilBuffer, texture._generateDepthBuffer, texture.width, texture.height, samples);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n this._bindUnboundFramebuffer(null);\r\n return samples;\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod, babylonInternalFormat, useTextureWidthAndHeight) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n if (useTextureWidthAndHeight === void 0) { useTextureWidthAndHeight = false; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = babylonInternalFormat === undefined ? this._getRGBABufferInternalSizedFormat(texture.type, format) : this._getInternalFormat(babylonInternalFormat);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n var lodMaxWidth = Math.round(Math.log(texture.width) * Math.LOG2E);\r\n var lodMaxHeight = Math.round(Math.log(texture.height) * Math.LOG2E);\r\n var width = useTextureWidthAndHeight ? texture.width : Math.pow(2, Math.max(lodMaxWidth - lod, 0));\r\n var height = useTextureWidthAndHeight ? texture.height : Math.pow(2, Math.max(lodMaxHeight - lod, 0));\r\n gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n gl.texImage2D(target, lod, internalFormat, format, textureType, image);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Engine.prototype._setCubeMapTextureParams = function (loadMipmap) {\r\n var gl = this._gl;\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, loadMipmap ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n };\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n Engine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n Engine.prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = Engine.TEXTURETYPE_UNSIGNED_INT; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"Engine.RawTexture\");\r\n };\r\n Engine.prototype._prepareWebGLTextureContinuation = function (texture, scene, noMipmap, isCompressed, samplingMode) {\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, !noMipmap);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (!noMipmap && !isCompressed) {\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n };\r\n Engine.prototype._prepareWebGLTexture = function (texture, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n var maxTextureSize = this.getCaps().maxTextureSize;\r\n var potWidth = Math.min(maxTextureSize, this.needPOTTextures ? Engine.GetExponentOfTwo(width, maxTextureSize) : width);\r\n var potHeight = Math.min(maxTextureSize, this.needPOTTextures ? Engine.GetExponentOfTwo(height, maxTextureSize) : height);\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n if (!texture._webGLTexture) {\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n return;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n texture.isReady = true;\r\n if (processFunction(potWidth, potHeight, function () {\r\n _this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n })) {\r\n // Returning as texture needs extra async steps\r\n return;\r\n }\r\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n };\r\n /** @hidden */\r\n Engine.prototype._convertRGBtoRGBATextureData = function (rgbData, width, height, textureType) {\r\n // Create new RGBA data container.\r\n var rgbaData;\r\n if (textureType === Engine.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n }\r\n else {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n }\r\n // Convert each pixel.\r\n for (var x = 0; x < width; x++) {\r\n for (var y = 0; y < height; y++) {\r\n var index = (y * width + x) * 3;\r\n var newIndex = (y * width + x) * 4;\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = 1;\r\n }\r\n }\r\n return rgbaData;\r\n };\r\n /** @hidden */\r\n Engine.prototype._releaseFramebufferObjects = function (texture) {\r\n var gl = this._gl;\r\n if (texture._framebuffer) {\r\n gl.deleteFramebuffer(texture._framebuffer);\r\n texture._framebuffer = null;\r\n }\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._releaseTexture = function (texture) {\r\n this._releaseFramebufferObjects(texture);\r\n this._deleteTexture(texture._webGLTexture);\r\n // Unbind channels\r\n this.unbindAllTextures();\r\n var index = this._internalTexturesCache.indexOf(texture);\r\n if (index !== -1) {\r\n this._internalTexturesCache.splice(index, 1);\r\n }\r\n // Integrated fixed lod samplers.\r\n if (texture._lodTextureHigh) {\r\n texture._lodTextureHigh.dispose();\r\n }\r\n if (texture._lodTextureMid) {\r\n texture._lodTextureMid.dispose();\r\n }\r\n if (texture._lodTextureLow) {\r\n texture._lodTextureLow.dispose();\r\n }\r\n // Integrated irradiance map.\r\n if (texture._irradianceTexture) {\r\n texture._irradianceTexture.dispose();\r\n }\r\n // Set output texture of post process to null if the texture has been released/disposed\r\n this.scenes.forEach(function (scene) {\r\n scene.postProcesses.forEach(function (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n });\r\n scene.cameras.forEach(function (camera) {\r\n camera._postProcesses.forEach(function (postProcess) {\r\n if (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n }\r\n });\r\n });\r\n });\r\n };\r\n Engine.prototype._deleteTexture = function (texture) {\r\n this._gl.deleteTexture(texture);\r\n };\r\n Engine.prototype._setProgram = function (program) {\r\n if (this._currentProgram !== program) {\r\n this._gl.useProgram(program);\r\n this._currentProgram = program;\r\n }\r\n };\r\n /**\r\n * Binds an effect to the webGL context\r\n * @param effect defines the effect to bind\r\n */\r\n Engine.prototype.bindSamplers = function (effect) {\r\n var webGLPipelineContext = effect.getPipelineContext();\r\n this._setProgram(webGLPipelineContext.program);\r\n var samplers = effect.getSamplers();\r\n for (var index = 0; index < samplers.length; index++) {\r\n var uniform = effect.getUniform(samplers[index]);\r\n if (uniform) {\r\n this._boundUniforms[index] = uniform;\r\n }\r\n }\r\n this._currentEffect = null;\r\n };\r\n Engine.prototype._activateCurrentTexture = function () {\r\n if (this._currentTextureChannel !== this._activeChannel) {\r\n this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel);\r\n this._currentTextureChannel = this._activeChannel;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._bindTextureDirectly = function (target, texture, forTextureDataUpdate, force) {\r\n if (forTextureDataUpdate === void 0) { forTextureDataUpdate = false; }\r\n if (force === void 0) { force = false; }\r\n var wasPreviouslyBound = false;\r\n var isTextureForRendering = texture && texture._associatedChannel > -1;\r\n if (forTextureDataUpdate && isTextureForRendering) {\r\n this._activeChannel = texture._associatedChannel;\r\n }\r\n var currentTextureBound = this._boundTexturesCache[this._activeChannel];\r\n if (currentTextureBound !== texture || force) {\r\n this._activateCurrentTexture();\r\n if (texture && texture.isMultiview) {\r\n this._gl.bindTexture(target, texture ? texture._colorTextureArray : null);\r\n }\r\n else {\r\n this._gl.bindTexture(target, texture ? texture._webGLTexture : null);\r\n }\r\n this._boundTexturesCache[this._activeChannel] = texture;\r\n if (texture) {\r\n texture._associatedChannel = this._activeChannel;\r\n }\r\n }\r\n else if (forTextureDataUpdate) {\r\n wasPreviouslyBound = true;\r\n this._activateCurrentTexture();\r\n }\r\n if (isTextureForRendering && !forTextureDataUpdate) {\r\n this._bindSamplerUniformToChannel(texture._associatedChannel, this._activeChannel);\r\n }\r\n return wasPreviouslyBound;\r\n };\r\n /** @hidden */\r\n Engine.prototype._bindTexture = function (channel, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (texture) {\r\n texture._associatedChannel = channel;\r\n }\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);\r\n };\r\n /**\r\n * Sets a texture to the webGL context from a postprocess\r\n * @param channel defines the channel to use\r\n * @param postProcess defines the source postprocess\r\n */\r\n Engine.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._textures.data[postProcess._currentRenderTextureInd] : null);\r\n };\r\n /**\r\n * Binds the output of the passed in post process to the texture channel specified\r\n * @param channel The channel the texture should be bound to\r\n * @param postProcess The post process which's output should be bound\r\n */\r\n Engine.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._outputTexture : null);\r\n };\r\n /**\r\n * Unbind all textures from the webGL context\r\n */\r\n Engine.prototype.unbindAllTextures = function () {\r\n for (var channel = 0; channel < this._maxSimultaneousTextures; channel++) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a texture to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The texture to apply\r\n */\r\n Engine.prototype.setTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n this._setTexture(channel, texture);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The render target texture containing the depth stencil texture to apply\r\n */\r\n Engine.prototype.setDepthStencilTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n if (!texture || !texture.depthStencilTexture) {\r\n this._setTexture(channel, null);\r\n }\r\n else {\r\n this._setTexture(channel, texture, false, true);\r\n }\r\n };\r\n Engine.prototype._bindSamplerUniformToChannel = function (sourceSlot, destination) {\r\n var uniform = this._boundUniforms[sourceSlot];\r\n if (!uniform || uniform._currentState === destination) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, destination);\r\n uniform._currentState = destination;\r\n };\r\n Engine.prototype._getTextureWrapMode = function (mode) {\r\n switch (mode) {\r\n case Engine.TEXTURE_WRAP_ADDRESSMODE:\r\n return this._gl.REPEAT;\r\n case Engine.TEXTURE_CLAMP_ADDRESSMODE:\r\n return this._gl.CLAMP_TO_EDGE;\r\n case Engine.TEXTURE_MIRROR_ADDRESSMODE:\r\n return this._gl.MIRRORED_REPEAT;\r\n }\r\n return this._gl.REPEAT;\r\n };\r\n Engine.prototype._setTexture = function (channel, texture, isPartOfTextureArray, depthStencilTexture) {\r\n if (isPartOfTextureArray === void 0) { isPartOfTextureArray = false; }\r\n if (depthStencilTexture === void 0) { depthStencilTexture = false; }\r\n // Not ready?\r\n if (!texture) {\r\n if (this._boundTexturesCache[channel] != null) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n }\r\n return false;\r\n }\r\n // Video\r\n if (texture.video) {\r\n this._activeChannel = channel;\r\n texture.update();\r\n }\r\n else if (texture.delayLoadState === Engine.DELAYLOADSTATE_NOTLOADED) { // Delay loading\r\n texture.delayLoad();\r\n return false;\r\n }\r\n var internalTexture;\r\n if (depthStencilTexture) {\r\n internalTexture = texture.depthStencilTexture;\r\n }\r\n else if (texture.isReady()) {\r\n internalTexture = texture.getInternalTexture();\r\n }\r\n else if (texture.isCube) {\r\n internalTexture = this.emptyCubeTexture;\r\n }\r\n else if (texture.is3D) {\r\n internalTexture = this.emptyTexture3D;\r\n }\r\n else {\r\n internalTexture = this.emptyTexture;\r\n }\r\n if (!isPartOfTextureArray && internalTexture) {\r\n internalTexture._associatedChannel = channel;\r\n }\r\n var needToBind = true;\r\n if (this._boundTexturesCache[channel] === internalTexture) {\r\n if (!isPartOfTextureArray) {\r\n this._bindSamplerUniformToChannel(internalTexture._associatedChannel, channel);\r\n }\r\n needToBind = false;\r\n }\r\n this._activeChannel = channel;\r\n if (internalTexture && internalTexture.isMultiview) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, internalTexture, isPartOfTextureArray);\r\n }\r\n }\r\n else if (internalTexture && internalTexture.is3D) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapR !== texture.wrapR) {\r\n internalTexture._cachedWrapR = texture.wrapR;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(texture.wrapR), internalTexture);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_3D, texture);\r\n }\r\n else if (internalTexture && internalTexture.isCube) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {\r\n internalTexture._cachedCoordinatesMode = texture.coordinatesMode;\r\n // CUBIC_MODE and SKYBOX_MODE both require CLAMP_TO_EDGE. All other modes use REPEAT.\r\n var textureWrapMode = (texture.coordinatesMode !== Engine.TEXTURE_CUBIC_MODE && texture.coordinatesMode !== Engine.TEXTURE_SKYBOX_MODE) ? this._gl.REPEAT : this._gl.CLAMP_TO_EDGE;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_S, textureWrapMode, internalTexture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_T, textureWrapMode);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, texture);\r\n }\r\n else {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_2D, texture);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sets an array of texture to the webGL context\r\n * @param channel defines the channel where the texture array must be set\r\n * @param uniform defines the associated uniform location\r\n * @param textures defines the array of textures to bind\r\n */\r\n Engine.prototype.setTextureArray = function (channel, uniform, textures) {\r\n if (channel === undefined || !uniform) {\r\n return;\r\n }\r\n if (!this._textureUnits || this._textureUnits.length !== textures.length) {\r\n this._textureUnits = new Int32Array(textures.length);\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i].getInternalTexture();\r\n if (texture) {\r\n this._textureUnits[i] = channel + i;\r\n texture._associatedChannel = channel + i;\r\n }\r\n else {\r\n this._textureUnits[i] = -1;\r\n }\r\n }\r\n this._gl.uniform1iv(uniform, this._textureUnits);\r\n for (var index = 0; index < textures.length; index++) {\r\n this._setTexture(this._textureUnits[index], textures[index], true);\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._setAnisotropicLevel = function (target, texture) {\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return;\r\n }\r\n var anisotropicFilterExtension = this._caps.textureAnisotropicFilterExtension;\r\n var value = texture.anisotropicFilteringLevel;\r\n if (internalTexture.samplingMode !== Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST\r\n && internalTexture.samplingMode !== Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR\r\n && internalTexture.samplingMode !== Engine.TEXTURE_LINEAR_LINEAR) {\r\n value = 1; // Forcing the anisotropic to 1 because else webgl will force filters to linear\r\n }\r\n if (anisotropicFilterExtension && internalTexture._cachedAnisotropicFilteringLevel !== value) {\r\n this._setTextureParameterFloat(target, anisotropicFilterExtension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(value, this._caps.maxAnisotropy), internalTexture);\r\n internalTexture._cachedAnisotropicFilteringLevel = value;\r\n }\r\n };\r\n Engine.prototype._setTextureParameterFloat = function (target, parameter, value, texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n this._gl.texParameterf(target, parameter, value);\r\n };\r\n Engine.prototype._setTextureParameterInteger = function (target, parameter, value, texture) {\r\n if (texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n }\r\n this._gl.texParameteri(target, parameter, value);\r\n };\r\n /**\r\n * Reads pixels from the current frame buffer. Please note that this function can be slow\r\n * @param x defines the x coordinate of the rectangle where pixels must be read\r\n * @param y defines the y coordinate of the rectangle where pixels must be read\r\n * @param width defines the width of the rectangle where pixels must be read\r\n * @param height defines the height of the rectangle where pixels must be read\r\n * @returns a Uint8Array containing RGBA colors\r\n */\r\n Engine.prototype.readPixels = function (x, y, width, height) {\r\n var data = new Uint8Array(height * width * 4);\r\n this._gl.readPixels(x, y, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data);\r\n return data;\r\n };\r\n /**\r\n * Add an externaly attached data from its key.\r\n * This method call will fail and return false, if such key already exists.\r\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\r\n * @param key the unique key that identifies the data\r\n * @param data the data object to associate to the key for this Engine instance\r\n * @return true if no such key were already present and the data was added successfully, false otherwise\r\n */\r\n Engine.prototype.addExternalData = function (key, data) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.add(key, data);\r\n };\r\n /**\r\n * Get an externaly attached data from its key\r\n * @param key the unique key that identifies the data\r\n * @return the associated data, if present (can be null), or undefined if not present\r\n */\r\n Engine.prototype.getExternalData = function (key) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.get(key);\r\n };\r\n /**\r\n * Get an externaly attached data from its key, create it using a factory if it's not already present\r\n * @param key the unique key that identifies the data\r\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\r\n * @return the associated data, can be null if the factory returned null.\r\n */\r\n Engine.prototype.getOrAddExternalDataWithFactory = function (key, factory) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.getOrAddWithFactory(key, factory);\r\n };\r\n /**\r\n * Remove an externaly attached data from the Engine instance\r\n * @param key the unique key that identifies the data\r\n * @return true if the data was successfully removed, false if it doesn't exist\r\n */\r\n Engine.prototype.removeExternalData = function (key) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_3__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.remove(key);\r\n };\r\n /**\r\n * Unbind all vertex attributes from the webGL context\r\n */\r\n Engine.prototype.unbindAllAttributes = function () {\r\n if (this._mustWipeVertexAttributes) {\r\n this._mustWipeVertexAttributes = false;\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._gl.disableVertexAttribArray(i);\r\n this._vertexAttribArraysEnabled[i] = false;\r\n this._currentBufferPointers[i].active = false;\r\n }\r\n return;\r\n }\r\n for (var i = 0, ul = this._vertexAttribArraysEnabled.length; i < ul; i++) {\r\n if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {\r\n continue;\r\n }\r\n this._gl.disableVertexAttribArray(i);\r\n this._vertexAttribArraysEnabled[i] = false;\r\n this._currentBufferPointers[i].active = false;\r\n }\r\n };\r\n /**\r\n * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled\r\n */\r\n Engine.prototype.releaseEffects = function () {\r\n for (var name in this._compiledEffects) {\r\n var webGLPipelineContext = this._compiledEffects[name].getPipelineContext();\r\n this._deletePipelineContext(webGLPipelineContext);\r\n }\r\n this._compiledEffects = {};\r\n };\r\n /**\r\n * Dispose and release all associated resources\r\n */\r\n Engine.prototype.dispose = function () {\r\n this.hideLoadingUI();\r\n this.stopRenderLoop();\r\n this.onNewSceneAddedObservable.clear();\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Empty texture\r\n if (this._emptyTexture) {\r\n this._releaseTexture(this._emptyTexture);\r\n this._emptyTexture = null;\r\n }\r\n if (this._emptyCubeTexture) {\r\n this._releaseTexture(this._emptyCubeTexture);\r\n this._emptyCubeTexture = null;\r\n }\r\n // Rescale PP\r\n if (this._rescalePostProcess) {\r\n this._rescalePostProcess.dispose();\r\n }\r\n // Release scenes\r\n while (this.scenes.length) {\r\n this.scenes[0].dispose();\r\n }\r\n // Release audio engine\r\n if (Engine.Instances.length === 1 && Engine.audioEngine) {\r\n Engine.audioEngine.dispose();\r\n }\r\n // Release effects\r\n this.releaseEffects();\r\n // Unbind\r\n this.unbindAllAttributes();\r\n this._boundUniforms = [];\r\n if (this._dummyFramebuffer) {\r\n this._gl.deleteFramebuffer(this._dummyFramebuffer);\r\n }\r\n //WebVR\r\n this.disableVR();\r\n // Events\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n window.removeEventListener(\"blur\", this._onBlur);\r\n window.removeEventListener(\"focus\", this._onFocus);\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.removeEventListener(\"focus\", this._onCanvasFocus);\r\n this._renderingCanvas.removeEventListener(\"blur\", this._onCanvasBlur);\r\n this._renderingCanvas.removeEventListener(\"pointerout\", this._onCanvasPointerOut);\r\n if (!this._doNotHandleContextLost) {\r\n this._renderingCanvas.removeEventListener(\"webglcontextlost\", this._onContextLost);\r\n this._renderingCanvas.removeEventListener(\"webglcontextrestored\", this._onContextRestored);\r\n }\r\n }\r\n document.removeEventListener(\"fullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"mozfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"webkitfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"msfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"pointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mspointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mozpointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"webkitpointerlockchange\", this._onPointerLockChange);\r\n }\r\n // Remove from Instances\r\n var index = Engine.Instances.indexOf(this);\r\n if (index >= 0) {\r\n Engine.Instances.splice(index, 1);\r\n }\r\n this._workingCanvas = null;\r\n this._workingContext = null;\r\n this._currentBufferPointers = [];\r\n this._renderingCanvas = null;\r\n this._currentProgram = null;\r\n this._bindedRenderFunction = null;\r\n this.onResizeObservable.clear();\r\n this.onCanvasBlurObservable.clear();\r\n this.onCanvasFocusObservable.clear();\r\n this.onCanvasPointerOutObservable.clear();\r\n this.onBeginFrameObservable.clear();\r\n this.onEndFrameObservable.clear();\r\n _Materials_effect__WEBPACK_IMPORTED_MODULE_4__[\"Effect\"].ResetCache();\r\n // Abort active requests\r\n for (var _i = 0, _a = this._activeRequests; _i < _a.length; _i++) {\r\n var request = _a[_i];\r\n request.abort();\r\n }\r\n };\r\n // Loading screen\r\n /**\r\n * Display the loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.displayLoadingUI = function () {\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this.loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.displayLoadingUI();\r\n }\r\n };\r\n /**\r\n * Hide the loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.hideLoadingUI = function () {\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this._loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.hideLoadingUI();\r\n }\r\n };\r\n Object.defineProperty(Engine.prototype, \"loadingScreen\", {\r\n /**\r\n * Gets the current loading screen object\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n get: function () {\r\n if (!this._loadingScreen && this._renderingCanvas) {\r\n this._loadingScreen = Engine.DefaultLoadingScreenFactory(this._renderingCanvas);\r\n }\r\n return this._loadingScreen;\r\n },\r\n /**\r\n * Sets the current loading screen object\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (loadingScreen) {\r\n this._loadingScreen = loadingScreen;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIText\", {\r\n /**\r\n * Sets the current loading screen text\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (text) {\r\n this.loadingScreen.loadingUIText = text;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIBackgroundColor\", {\r\n /**\r\n * Sets the current loading screen background color\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (color) {\r\n this.loadingScreen.loadingUIBackgroundColor = color;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach a new callback raised when context lost event is fired\r\n * @param callback defines the callback to call\r\n */\r\n Engine.prototype.attachContextLostEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextlost\", callback, false);\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context restored event is fired\r\n * @param callback defines the callback to call\r\n */\r\n Engine.prototype.attachContextRestoredEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextrestored\", callback, false);\r\n }\r\n };\r\n /**\r\n * Gets the source code of the vertex shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the vertex shader associated with the program\r\n */\r\n Engine.prototype.getVertexShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[0]);\r\n };\r\n /**\r\n * Gets the source code of the fragment shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the fragment shader associated with the program\r\n */\r\n Engine.prototype.getFragmentShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[1]);\r\n };\r\n /**\r\n * Get the current error code of the webGL context\r\n * @returns the error code\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\r\n */\r\n Engine.prototype.getError = function () {\r\n return this._gl.getError();\r\n };\r\n // FPS\r\n /**\r\n * Gets the current framerate\r\n * @returns a number representing the framerate\r\n */\r\n Engine.prototype.getFps = function () {\r\n return this._fps;\r\n };\r\n /**\r\n * Gets the time spent between current and previous frame\r\n * @returns a number representing the delta time in ms\r\n */\r\n Engine.prototype.getDeltaTime = function () {\r\n return this._deltaTime;\r\n };\r\n Engine.prototype._measureFps = function () {\r\n this._performanceMonitor.sampleFrame();\r\n this._fps = this._performanceMonitor.averageFPS;\r\n this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;\r\n };\r\n /** @hidden */\r\n Engine.prototype._readTexturePixels = function (texture, width, height, faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = -1; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n var gl = this._gl;\r\n if (!this._dummyFramebuffer) {\r\n var dummy = gl.createFramebuffer();\r\n if (!dummy) {\r\n throw new Error(\"Unable to create dummy framebuffer\");\r\n }\r\n this._dummyFramebuffer = dummy;\r\n }\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);\r\n if (faceIndex > -1) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, level);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, level);\r\n }\r\n var readType = (texture.type !== undefined) ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;\r\n switch (readType) {\r\n case gl.UNSIGNED_BYTE:\r\n if (!buffer) {\r\n buffer = new Uint8Array(4 * width * height);\r\n }\r\n readType = gl.UNSIGNED_BYTE;\r\n break;\r\n default:\r\n if (!buffer) {\r\n buffer = new Float32Array(4 * width * height);\r\n }\r\n readType = gl.FLOAT;\r\n break;\r\n }\r\n gl.readPixels(0, 0, width, height, gl.RGBA, readType, buffer);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);\r\n return buffer;\r\n };\r\n Engine.prototype._canRenderToFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(Engine.TEXTURETYPE_FLOAT);\r\n };\r\n Engine.prototype._canRenderToHalfFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(Engine.TEXTURETYPE_HALF_FLOAT);\r\n };\r\n // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture\r\n Engine.prototype._canRenderToFramebuffer = function (type) {\r\n var gl = this._gl;\r\n //clear existing errors\r\n while (gl.getError() !== gl.NO_ERROR) { }\r\n var successful = true;\r\n var texture = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D, texture);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), 1, 1, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n var fb = gl.createFramebuffer();\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\r\n var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\r\n successful = successful && (status === gl.FRAMEBUFFER_COMPLETE);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n //try render by clearing frame buffer's color buffer\r\n if (successful) {\r\n gl.clear(gl.COLOR_BUFFER_BIT);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //try reading from frame to ensure render occurs (just creating the FBO is not sufficient to determine if rendering is supported)\r\n if (successful) {\r\n //in practice it's sufficient to just read from the backbuffer rather than handle potentially issues reading from the texture\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n var readFormat = gl.RGBA;\r\n var readType = gl.UNSIGNED_BYTE;\r\n var buffer = new Uint8Array(4);\r\n gl.readPixels(0, 0, 1, 1, readFormat, readType, buffer);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //clean up\r\n gl.deleteTexture(texture);\r\n gl.deleteFramebuffer(fb);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n //clear accumulated errors\r\n while (!successful && (gl.getError() !== gl.NO_ERROR)) { }\r\n return successful;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getWebGLTextureType = function (type) {\r\n if (this._webGLVersion === 1) {\r\n switch (type) {\r\n case Engine.TEXTURETYPE_FLOAT:\r\n return this._gl.FLOAT;\r\n case Engine.TEXTURETYPE_HALF_FLOAT:\r\n return this._gl.HALF_FLOAT_OES;\r\n case Engine.TEXTURETYPE_UNSIGNED_BYTE:\r\n return this._gl.UNSIGNED_BYTE;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n }\r\n switch (type) {\r\n case Engine.TEXTURETYPE_BYTE:\r\n return this._gl.BYTE;\r\n case Engine.TEXTURETYPE_UNSIGNED_BYTE:\r\n return this._gl.UNSIGNED_BYTE;\r\n case Engine.TEXTURETYPE_SHORT:\r\n return this._gl.SHORT;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT:\r\n return this._gl.UNSIGNED_SHORT;\r\n case Engine.TEXTURETYPE_INT:\r\n return this._gl.INT;\r\n case Engine.TEXTURETYPE_UNSIGNED_INTEGER: // Refers to UNSIGNED_INT\r\n return this._gl.UNSIGNED_INT;\r\n case Engine.TEXTURETYPE_FLOAT:\r\n return this._gl.FLOAT;\r\n case Engine.TEXTURETYPE_HALF_FLOAT:\r\n return this._gl.HALF_FLOAT;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:\r\n return this._gl.UNSIGNED_INT_2_10_10_10_REV;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_24_8:\r\n return this._gl.UNSIGNED_INT_24_8;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:\r\n return this._gl.UNSIGNED_INT_10F_11F_11F_REV;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:\r\n return this._gl.UNSIGNED_INT_5_9_9_9_REV;\r\n case Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:\r\n return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getInternalFormat = function (format) {\r\n var internalFormat = this._gl.RGBA;\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_ALPHA:\r\n internalFormat = this._gl.ALPHA;\r\n break;\r\n case Engine.TEXTUREFORMAT_LUMINANCE:\r\n internalFormat = this._gl.LUMINANCE;\r\n break;\r\n case Engine.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n internalFormat = this._gl.LUMINANCE_ALPHA;\r\n break;\r\n case Engine.TEXTUREFORMAT_RED:\r\n internalFormat = this._gl.RED;\r\n break;\r\n case Engine.TEXTUREFORMAT_RG:\r\n internalFormat = this._gl.RG;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n internalFormat = this._gl.RGB;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n internalFormat = this._gl.RGBA;\r\n break;\r\n }\r\n if (this._webGLVersion > 1) {\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n internalFormat = this._gl.RED_INTEGER;\r\n break;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n internalFormat = this._gl.RG_INTEGER;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n internalFormat = this._gl.RGB_INTEGER;\r\n break;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n internalFormat = this._gl.RGBA_INTEGER;\r\n break;\r\n }\r\n }\r\n return internalFormat;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getRGBABufferInternalSizedFormat = function (type, format) {\r\n if (this._webGLVersion === 1) {\r\n if (format !== undefined) {\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_ALPHA:\r\n return this._gl.ALPHA;\r\n case Engine.TEXTUREFORMAT_LUMINANCE:\r\n return this._gl.LUMINANCE;\r\n case Engine.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n return this._gl.LUMINANCE_ALPHA;\r\n }\r\n }\r\n return this._gl.RGBA;\r\n }\r\n switch (type) {\r\n case Engine.TEXTURETYPE_BYTE:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R8_SNORM;\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG8_SNORM;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB8_SNORM;\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R8I;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG8I;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB8I;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA8I;\r\n default:\r\n return this._gl.RGBA8_SNORM;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_BYTE:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R8;\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG8;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB8; // By default. Other possibilities are RGB565, SRGB8.\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGBA8; // By default. Other possibilities are RGB5_A1, RGBA4, SRGB8_ALPHA8.\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R8UI;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG8UI;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB8UI;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA8UI;\r\n case Engine.TEXTUREFORMAT_ALPHA:\r\n return this._gl.ALPHA;\r\n case Engine.TEXTUREFORMAT_LUMINANCE:\r\n return this._gl.LUMINANCE;\r\n case Engine.TEXTUREFORMAT_LUMINANCE_ALPHA:\r\n return this._gl.LUMINANCE_ALPHA;\r\n default:\r\n return this._gl.RGBA8;\r\n }\r\n case Engine.TEXTURETYPE_SHORT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R16I;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG16I;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB16I;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA16I;\r\n default:\r\n return this._gl.RGBA16I;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R16UI;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG16UI;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB16UI;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA16UI;\r\n default:\r\n return this._gl.RGBA16UI;\r\n }\r\n case Engine.TEXTURETYPE_INT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R32I;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG32I;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB32I;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA32I;\r\n default:\r\n return this._gl.RGBA32I;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_INTEGER: // Refers to UNSIGNED_INT\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED_INTEGER:\r\n return this._gl.R32UI;\r\n case Engine.TEXTUREFORMAT_RG_INTEGER:\r\n return this._gl.RG32UI;\r\n case Engine.TEXTUREFORMAT_RGB_INTEGER:\r\n return this._gl.RGB32UI;\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGBA32UI;\r\n default:\r\n return this._gl.RGBA32UI;\r\n }\r\n case Engine.TEXTURETYPE_FLOAT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R32F; // By default. Other possibility is R16F.\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG32F; // By default. Other possibility is RG16F.\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB32F; // By default. Other possibilities are RGB16F, R11F_G11F_B10F, RGB9_E5.\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGBA32F; // By default. Other possibility is RGBA16F.\r\n default:\r\n return this._gl.RGBA32F;\r\n }\r\n case Engine.TEXTURETYPE_HALF_FLOAT:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RED:\r\n return this._gl.R16F;\r\n case Engine.TEXTUREFORMAT_RG:\r\n return this._gl.RG16F;\r\n case Engine.TEXTUREFORMAT_RGB:\r\n return this._gl.RGB16F; // By default. Other possibilities are R11F_G11F_B10F, RGB9_E5.\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGBA16F;\r\n default:\r\n return this._gl.RGBA16F;\r\n }\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:\r\n return this._gl.RGB565;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:\r\n return this._gl.R11F_G11F_B10F;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:\r\n return this._gl.RGB9_E5;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:\r\n return this._gl.RGBA4;\r\n case Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:\r\n return this._gl.RGB5_A1;\r\n case Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:\r\n switch (format) {\r\n case Engine.TEXTUREFORMAT_RGBA:\r\n return this._gl.RGB10_A2; // By default. Other possibility is RGB5_A1.\r\n case Engine.TEXTUREFORMAT_RGBA_INTEGER:\r\n return this._gl.RGB10_A2UI;\r\n default:\r\n return this._gl.RGB10_A2;\r\n }\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n Engine.prototype._getRGBAMultiSampleBufferFormat = function (type) {\r\n if (type === Engine.TEXTURETYPE_FLOAT) {\r\n return this._gl.RGBA32F;\r\n }\r\n else if (type === Engine.TEXTURETYPE_HALF_FLOAT) {\r\n return this._gl.RGBA16F;\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n Engine.prototype._loadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = _Misc_fileTools__WEBPACK_IMPORTED_MODULE_17__[\"FileTools\"].LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Engine.prototype._loadFileAsync = function (url, offlineProvider, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, offlineProvider, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n // Statics\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)\r\n * @returns true if the engine can be created\r\n * @ignorenaming\r\n */\r\n Engine.isSupported = function () {\r\n try {\r\n var tempcanvas = document.createElement(\"canvas\");\r\n var gl = tempcanvas.getContext(\"webgl\") || tempcanvas.getContext(\"experimental-webgl\");\r\n return gl != null && !!window.WebGLRenderingContext;\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Find the next highest power of two.\r\n * @param x Number to start search from.\r\n * @return Next highest power of two.\r\n */\r\n Engine.CeilingPOT = function (x) {\r\n x--;\r\n x |= x >> 1;\r\n x |= x >> 2;\r\n x |= x >> 4;\r\n x |= x >> 8;\r\n x |= x >> 16;\r\n x++;\r\n return x;\r\n };\r\n /**\r\n * Find the next lowest power of two.\r\n * @param x Number to start search from.\r\n * @return Next lowest power of two.\r\n */\r\n Engine.FloorPOT = function (x) {\r\n x = x | (x >> 1);\r\n x = x | (x >> 2);\r\n x = x | (x >> 4);\r\n x = x | (x >> 8);\r\n x = x | (x >> 16);\r\n return x - (x >> 1);\r\n };\r\n /**\r\n * Find the nearest power of two.\r\n * @param x Number to start search from.\r\n * @return Next nearest power of two.\r\n */\r\n Engine.NearestPOT = function (x) {\r\n var c = Engine.CeilingPOT(x);\r\n var f = Engine.FloorPOT(x);\r\n return (c - x) > (x - f) ? f : c;\r\n };\r\n /**\r\n * Get the closest exponent of two\r\n * @param value defines the value to approximate\r\n * @param max defines the maximum value to return\r\n * @param mode defines how to define the closest value\r\n * @returns closest exponent of two of the given value\r\n */\r\n Engine.GetExponentOfTwo = function (value, max, mode) {\r\n if (mode === void 0) { mode = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_NEAREST; }\r\n var pot;\r\n switch (mode) {\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_FLOOR:\r\n pot = Engine.FloorPOT(value);\r\n break;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_NEAREST:\r\n pot = Engine.NearestPOT(value);\r\n break;\r\n case _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_CEILING:\r\n default:\r\n pot = Engine.CeilingPOT(value);\r\n break;\r\n }\r\n return Math.min(pot, max);\r\n };\r\n /**\r\n * Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)\r\n * @param func - the function to be called\r\n * @param requester - the object that will request the next frame. Falls back to window.\r\n * @returns frame number\r\n */\r\n Engine.QueueNewFrame = function (func, requester) {\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_8__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return setTimeout(func, 16);\r\n }\r\n if (!requester) {\r\n requester = window;\r\n }\r\n if (requester.requestAnimationFrame) {\r\n return requester.requestAnimationFrame(func);\r\n }\r\n else if (requester.msRequestAnimationFrame) {\r\n return requester.msRequestAnimationFrame(func);\r\n }\r\n else if (requester.webkitRequestAnimationFrame) {\r\n return requester.webkitRequestAnimationFrame(func);\r\n }\r\n else if (requester.mozRequestAnimationFrame) {\r\n return requester.mozRequestAnimationFrame(func);\r\n }\r\n else if (requester.oRequestAnimationFrame) {\r\n return requester.oRequestAnimationFrame(func);\r\n }\r\n else {\r\n return window.setTimeout(func, 16);\r\n }\r\n };\r\n /**\r\n * Ask the browser to promote the current element to pointerlock mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestPointerlock = function (element) {\r\n element.requestPointerLock = element.requestPointerLock || element.msRequestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;\r\n if (element.requestPointerLock) {\r\n element.requestPointerLock();\r\n }\r\n };\r\n /**\r\n * Asks the browser to exit pointerlock mode\r\n */\r\n Engine._ExitPointerlock = function () {\r\n var anyDoc = document;\r\n document.exitPointerLock = document.exitPointerLock || anyDoc.msExitPointerLock || anyDoc.mozExitPointerLock || anyDoc.webkitExitPointerLock;\r\n if (document.exitPointerLock) {\r\n document.exitPointerLock();\r\n }\r\n };\r\n /**\r\n * Ask the browser to promote the current element to fullscreen rendering mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestFullscreen = function (element) {\r\n var requestFunction = element.requestFullscreen || element.msRequestFullscreen || element.webkitRequestFullscreen || element.mozRequestFullScreen;\r\n if (!requestFunction) {\r\n return;\r\n }\r\n requestFunction.call(element);\r\n };\r\n /**\r\n * Asks the browser to exit fullscreen mode\r\n */\r\n Engine._ExitFullscreen = function () {\r\n var anyDoc = document;\r\n if (document.exitFullscreen) {\r\n document.exitFullscreen();\r\n }\r\n else if (anyDoc.mozCancelFullScreen) {\r\n anyDoc.mozCancelFullScreen();\r\n }\r\n else if (anyDoc.webkitCancelFullScreen) {\r\n anyDoc.webkitCancelFullScreen();\r\n }\r\n else if (anyDoc.msCancelFullScreen) {\r\n anyDoc.msCancelFullScreen();\r\n }\r\n };\r\n /** Use this array to turn off some WebGL2 features on known buggy browsers version */\r\n Engine.ExceptionList = [\r\n { key: \"Chrome\\/63\\.0\", capture: \"63\\\\.0\\\\.3239\\\\.(\\\\d+)\", captureConstraint: 108, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/58\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/59\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Chrome\\/72.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/73.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/74.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/71\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/72\", capture: null, captureConstraint: null, targets: [\"vao\"] }\r\n ];\r\n /** @hidden */\r\n Engine._TextureLoaders = [];\r\n // Const statics\r\n /** Defines that alpha blending is disabled */\r\n Engine.ALPHA_DISABLE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_DISABLE;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + DEST */\r\n Engine.ALPHA_ADD = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_ADD;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_COMBINE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_COMBINE;\r\n /** Defines that alpha blending to DEST - SRC * DEST */\r\n Engine.ALPHA_SUBTRACT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_SUBTRACT;\r\n /** Defines that alpha blending to SRC * DEST */\r\n Engine.ALPHA_MULTIPLY = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_MULTIPLY;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Engine.ALPHA_MAXIMIZED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_MAXIMIZED;\r\n /** Defines that alpha blending to SRC + DEST */\r\n Engine.ALPHA_ONEONE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_ONEONE;\r\n /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_PREMULTIPLIED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_PREMULTIPLIED;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_PREMULTIPLIED_PORTERDUFF = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */\r\n Engine.ALPHA_INTERPOLATE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_INTERPOLATE;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_SCREENMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_SCREENMODE;\r\n /** Defines that the ressource is not delayed*/\r\n Engine.DELAYLOADSTATE_NONE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Engine.DELAYLOADSTATE_LOADED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n /** Defines that the ressource is currently delay loading */\r\n Engine.DELAYLOADSTATE_LOADING = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADING;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Engine.DELAYLOADSTATE_NOTLOADED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Engine.NEVER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].NEVER;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Engine.ALWAYS = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALWAYS;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Engine.LESS = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].LESS;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Engine.EQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].EQUAL;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Engine.LEQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].LEQUAL;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Engine.GREATER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].GREATER;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Engine.GEQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].GEQUAL;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Engine.NOTEQUAL = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].NOTEQUAL;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Engine.KEEP = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].KEEP;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Engine.REPLACE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].REPLACE;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Engine.INCR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].INCR;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Engine.DECR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DECR;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Engine.INVERT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].INVERT;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Engine.INCR_WRAP = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].INCR_WRAP;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Engine.DECR_WRAP = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DECR_WRAP;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_CLAMP_ADDRESSMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_WRAP_ADDRESSMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /** Texture is repeating and mirrored */\r\n Engine.TEXTURE_MIRROR_ADDRESSMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_MIRROR_ADDRESSMODE;\r\n /** ALPHA */\r\n Engine.TEXTUREFORMAT_ALPHA = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_ALPHA;\r\n /** LUMINANCE */\r\n Engine.TEXTUREFORMAT_LUMINANCE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_LUMINANCE;\r\n /** LUMINANCE_ALPHA */\r\n Engine.TEXTUREFORMAT_LUMINANCE_ALPHA = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_LUMINANCE_ALPHA;\r\n /** RGB */\r\n Engine.TEXTUREFORMAT_RGB = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGB;\r\n /** RGBA */\r\n Engine.TEXTUREFORMAT_RGBA = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n /** RED */\r\n Engine.TEXTUREFORMAT_RED = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RED;\r\n /** RED (2nd reference) */\r\n Engine.TEXTUREFORMAT_R = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_R;\r\n /** RG */\r\n Engine.TEXTUREFORMAT_RG = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RG;\r\n /** RED_INTEGER */\r\n Engine.TEXTUREFORMAT_RED_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RED_INTEGER;\r\n /** RED_INTEGER (2nd reference) */\r\n Engine.TEXTUREFORMAT_R_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_R_INTEGER;\r\n /** RG_INTEGER */\r\n Engine.TEXTUREFORMAT_RG_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RG_INTEGER;\r\n /** RGB_INTEGER */\r\n Engine.TEXTUREFORMAT_RGB_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGB_INTEGER;\r\n /** RGBA_INTEGER */\r\n Engine.TEXTUREFORMAT_RGBA_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGBA_INTEGER;\r\n /** UNSIGNED_BYTE */\r\n Engine.TEXTURETYPE_UNSIGNED_BYTE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_BYTE;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Engine.TEXTURETYPE_UNSIGNED_INT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n /** FLOAT */\r\n Engine.TEXTURETYPE_FLOAT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n /** HALF_FLOAT */\r\n Engine.TEXTURETYPE_HALF_FLOAT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n /** BYTE */\r\n Engine.TEXTURETYPE_BYTE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_BYTE;\r\n /** SHORT */\r\n Engine.TEXTURETYPE_SHORT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_SHORT;\r\n /** UNSIGNED_SHORT */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT;\r\n /** INT */\r\n Engine.TEXTURETYPE_INT = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_INT;\r\n /** UNSIGNED_INT */\r\n Engine.TEXTURETYPE_UNSIGNED_INTEGER = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INTEGER;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_SHORT_5_6_5;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV;\r\n /** UNSIGNED_INT_24_8 */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_24_8 = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_24_8;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_SAMPLINGMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_BILINEAR_SAMPLINGMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_TRILINEAR_SAMPLINGMODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPLINEAR;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPNEAREST;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = linear and mip = none */\r\n Engine.TEXTURE_NEAREST_LINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_LINEAR;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Engine.TEXTURE_NEAREST_NEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_NEAREST_NEAREST;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n /** mag = linear and min = linear and mip = none */\r\n Engine.TEXTURE_LINEAR_LINEAR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_LINEAR;\r\n /** mag = linear and min = nearest and mip = none */\r\n Engine.TEXTURE_LINEAR_NEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_LINEAR_NEAREST;\r\n /** Explicit coordinates mode */\r\n Engine.TEXTURE_EXPLICIT_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_EXPLICIT_MODE;\r\n /** Spherical coordinates mode */\r\n Engine.TEXTURE_SPHERICAL_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_SPHERICAL_MODE;\r\n /** Planar coordinates mode */\r\n Engine.TEXTURE_PLANAR_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_PLANAR_MODE;\r\n /** Cubic coordinates mode */\r\n Engine.TEXTURE_CUBIC_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_CUBIC_MODE;\r\n /** Projection coordinates mode */\r\n Engine.TEXTURE_PROJECTION_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_PROJECTION_MODE;\r\n /** Skybox coordinates mode */\r\n Engine.TEXTURE_SKYBOX_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_SKYBOX_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n Engine.TEXTURE_INVCUBIC_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_INVCUBIC_MODE;\r\n /** Equirectangular coordinates mode */\r\n Engine.TEXTURE_EQUIRECTANGULAR_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Engine.SCALEMODE_FLOOR = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_FLOOR;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Engine.SCALEMODE_NEAREST = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_NEAREST;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Engine.SCALEMODE_CEILING = _constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCALEMODE_CEILING;\r\n // Updatable statics so stick with vars here\r\n /**\r\n * Gets or sets the epsilon value used by collision engine\r\n */\r\n Engine.CollisionsEpsilon = 0.001;\r\n /**\r\n * Method called to create the default rescale post process on each engine.\r\n */\r\n Engine._RescalePostProcessFactory = null;\r\n return Engine;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/engineStore.ts\":\n/*!********************************!*\\\n !*** ./Engines/engineStore.ts ***!\n \\********************************/\n/*! exports provided: EngineStore */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return EngineStore; });\n/**\r\n * The engine store class is responsible to hold all the instances of Engine and Scene created\r\n * during the life time of the application.\r\n */\r\nvar EngineStore = /** @class */ (function () {\r\n function EngineStore() {\r\n }\r\n Object.defineProperty(EngineStore, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n if (this.Instances.length === 0) {\r\n return null;\r\n }\r\n return this.Instances[this.Instances.length - 1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineStore, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return this._LastCreatedScene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Gets the list of created engines */\r\n EngineStore.Instances = new Array();\r\n /** @hidden */\r\n EngineStore._LastCreatedScene = null;\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.UseFallbackTexture = true;\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.FallbackTexture = \"\";\r\n return EngineStore;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/index.ts\":\n/*!**************************!*\\\n !*** ./Engines/index.ts ***!\n \\**************************/\n/*! exports provided: Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, _OcclusionDataStorage, _forceTransformFeedbackToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./Engines/constants.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"]; });\n\n/* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine */ \"./Engines/engine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"InstancingAttributeInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"DepthTextureCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"EngineCapabilities\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return _engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]; });\n\n/* harmony import */ var _engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./engineStore */ \"./Engines/engineStore.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return _engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"]; });\n\n/* harmony import */ var _nullEngine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nullEngine */ \"./Engines/nullEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return _nullEngine__WEBPACK_IMPORTED_MODULE_3__[\"NullEngineOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return _nullEngine__WEBPACK_IMPORTED_MODULE_3__[\"NullEngine\"]; });\n\n/* harmony import */ var _Extensions_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Extensions/index */ \"./Engines/Extensions/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_4__[\"_OcclusionDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _Extensions_index__WEBPACK_IMPORTED_MODULE_4__[\"_forceTransformFeedbackToBundle\"]; });\n\n/* harmony import */ var _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./WebGL/webGLPipelineContext */ \"./Engines/WebGL/webGLPipelineContext.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return _WebGL_webGLPipelineContext__WEBPACK_IMPORTED_MODULE_5__[\"WebGLPipelineContext\"]; });\n\n/* harmony import */ var _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./WebGL/webGL2ShaderProcessors */ \"./Engines/WebGL/webGL2ShaderProcessors.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return _WebGL_webGL2ShaderProcessors__WEBPACK_IMPORTED_MODULE_6__[\"WebGL2ShaderProcessor\"]; });\n\n/* harmony import */ var _nativeEngine__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./nativeEngine */ \"./Engines/nativeEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return _nativeEngine__WEBPACK_IMPORTED_MODULE_7__[\"NativeEngine\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/nativeEngine.ts\":\n/*!*********************************!*\\\n !*** ./Engines/nativeEngine.ts ***!\n \\*********************************/\n/*! exports provided: NativeEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return NativeEngine; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/dataBuffer */ \"./Meshes/dataBuffer.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Native_nativeShaderProcessor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Native/nativeShaderProcessor */ \"./Engines/Native/nativeShaderProcessor.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar NativePipelineContext = /** @class */ (function () {\r\n function NativePipelineContext() {\r\n // TODO: async should be true?\r\n this.isAsync = false;\r\n this.isReady = false;\r\n }\r\n // TODO: what should this do?\r\n NativePipelineContext.prototype._handlesSpectorRebuildCallback = function (onCompiled) {\r\n throw new Error(\"Not implemented\");\r\n };\r\n return NativePipelineContext;\r\n}());\r\n/**\r\n * Container for accessors for natively-stored mesh data buffers.\r\n */\r\nvar NativeDataBuffer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NativeDataBuffer, _super);\r\n function NativeDataBuffer() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return NativeDataBuffer;\r\n}(_Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_4__[\"DataBuffer\"]));\r\n// TODO: change this to match bgfx.\r\n// Must match Filter enum in SpectreEngine.h.\r\nvar NativeFilter = /** @class */ (function () {\r\n function NativeFilter() {\r\n }\r\n NativeFilter.POINT = 0;\r\n NativeFilter.MINPOINT_MAGPOINT_MIPPOINT = NativeFilter.POINT;\r\n NativeFilter.BILINEAR = 1;\r\n NativeFilter.MINLINEAR_MAGLINEAR_MIPPOINT = NativeFilter.BILINEAR;\r\n NativeFilter.TRILINEAR = 2;\r\n NativeFilter.MINLINEAR_MAGLINEAR_MIPLINEAR = NativeFilter.TRILINEAR;\r\n NativeFilter.ANISOTROPIC = 3;\r\n NativeFilter.POINT_COMPARE = 4;\r\n NativeFilter.TRILINEAR_COMPARE = 5;\r\n NativeFilter.MINBILINEAR_MAGPOINT = 6;\r\n NativeFilter.MINLINEAR_MAGPOINT_MIPLINEAR = NativeFilter.MINBILINEAR_MAGPOINT;\r\n NativeFilter.MINPOINT_MAGPOINT_MIPLINEAR = 7;\r\n NativeFilter.MINPOINT_MAGLINEAR_MIPPOINT = 8;\r\n NativeFilter.MINPOINT_MAGLINEAR_MIPLINEAR = 9;\r\n NativeFilter.MINLINEAR_MAGPOINT_MIPPOINT = 10;\r\n return NativeFilter;\r\n}());\r\n// TODO: change this to match bgfx.\r\n// Must match AddressMode enum in SpectreEngine.h.\r\nvar NativeAddressMode = /** @class */ (function () {\r\n function NativeAddressMode() {\r\n }\r\n NativeAddressMode.WRAP = 0;\r\n NativeAddressMode.MIRROR = 1;\r\n NativeAddressMode.CLAMP = 2;\r\n NativeAddressMode.BORDER = 3;\r\n NativeAddressMode.MIRROR_ONCE = 4;\r\n return NativeAddressMode;\r\n}());\r\n/** @hidden */\r\nvar NativeEngine = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NativeEngine, _super);\r\n function NativeEngine() {\r\n var _this = _super.call(this, null) || this;\r\n _this._native = nativeEngine;\r\n _this._webGLVersion = 2;\r\n _this.disableUniformBuffers = true;\r\n // TODO: Initialize this more correctly based on the hardware capabilities.\r\n // Init caps\r\n _this._caps = new _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"EngineCapabilities\"]();\r\n _this._caps.maxTexturesImageUnits = 16;\r\n _this._caps.maxVertexTextureImageUnits = 16;\r\n _this._caps.maxTextureSize = 512;\r\n _this._caps.maxCubemapTextureSize = 512;\r\n _this._caps.maxRenderTextureSize = 512;\r\n _this._caps.maxVertexAttribs = 16;\r\n _this._caps.maxVaryingVectors = 16;\r\n _this._caps.maxFragmentUniformVectors = 16;\r\n _this._caps.maxVertexUniformVectors = 16;\r\n // Extensions\r\n _this._caps.standardDerivatives = true;\r\n _this._caps.astc = null;\r\n _this._caps.s3tc = null;\r\n _this._caps.pvrtc = null;\r\n _this._caps.etc1 = null;\r\n _this._caps.etc2 = null;\r\n _this._caps.maxAnisotropy = 16; // TODO: Retrieve this smartly. Currently set to D3D11 maximum allowable value.\r\n _this._caps.uintIndices = false;\r\n _this._caps.fragmentDepthSupported = false;\r\n _this._caps.highPrecisionShaderSupported = true;\r\n _this._caps.colorBufferFloat = false;\r\n _this._caps.textureFloat = false;\r\n _this._caps.textureFloatLinearFiltering = false;\r\n _this._caps.textureFloatRender = false;\r\n _this._caps.textureHalfFloat = false;\r\n _this._caps.textureHalfFloatLinearFiltering = false;\r\n _this._caps.textureHalfFloatRender = false;\r\n _this._caps.textureLOD = true;\r\n _this._caps.drawBuffersExtension = false;\r\n _this._caps.depthTextureExtension = false;\r\n _this._caps.vertexArrayObject = true;\r\n _this._caps.instancedArrays = false;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].Log(\"Babylon Native (v\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].Version + \") launched\");\r\n // Wrappers\r\n if (typeof URL === \"undefined\") {\r\n window.URL = {\r\n createObjectURL: function () { },\r\n revokeObjectURL: function () { }\r\n };\r\n }\r\n if (typeof Blob === \"undefined\") {\r\n window.Blob = function () { };\r\n }\r\n // Shader processor\r\n _this._shaderProcessor = new _Native_nativeShaderProcessor__WEBPACK_IMPORTED_MODULE_8__[\"NativeShaderProcessor\"]();\r\n return _this;\r\n }\r\n NativeEngine.prototype.getHardwareScalingLevel = function () {\r\n return 1.0;\r\n };\r\n /**\r\n * Can be used to override the current requestAnimationFrame requester.\r\n * @hidden\r\n */\r\n NativeEngine.prototype._queueNewFrame = function (bindedRenderFunction, requester) {\r\n this._native.requestAnimationFrame(bindedRenderFunction);\r\n return 0;\r\n };\r\n NativeEngine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n this._native.clear(color.r, color.g, color.b, color.a, backBuffer, depth, stencil);\r\n };\r\n NativeEngine.prototype.createIndexBuffer = function (indices) {\r\n var data = this._normalizeIndexData(indices);\r\n var buffer = new NativeDataBuffer();\r\n buffer.references = 1;\r\n buffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);\r\n buffer.nativeIndexBuffer = this._native.createIndexBuffer(data);\r\n return buffer;\r\n };\r\n NativeEngine.prototype.createVertexBuffer = function (data) {\r\n var buffer = new NativeDataBuffer();\r\n buffer.references = 1;\r\n buffer.nativeVertexBuffer = this._native.createVertexBuffer(ArrayBuffer.isView(data) ? data : new Float32Array(data));\r\n return buffer;\r\n };\r\n NativeEngine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {\r\n var vertexArray = this._native.createVertexArray();\r\n if (indexBuffer) {\r\n this._native.recordIndexBuffer(vertexArray, indexBuffer.nativeIndexBuffer);\r\n }\r\n var attributes = effect.getAttributesNames();\r\n for (var index = 0; index < attributes.length; index++) {\r\n var location_1 = effect.getAttributeLocation(index);\r\n if (location_1 >= 0) {\r\n var kind = attributes[index];\r\n var vertexBuffer = vertexBuffers[kind];\r\n if (vertexBuffer) {\r\n var buffer = vertexBuffer.getBuffer();\r\n if (buffer) {\r\n this._native.recordVertexBuffer(vertexArray, buffer.nativeVertexBuffer, location_1, vertexBuffer.byteOffset, vertexBuffer.byteStride, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized);\r\n }\r\n }\r\n }\r\n }\r\n return vertexArray;\r\n };\r\n NativeEngine.prototype.bindVertexArrayObject = function (vertexArray) {\r\n this._native.bindVertexArray(vertexArray);\r\n };\r\n NativeEngine.prototype.releaseVertexArrayObject = function (vertexArray) {\r\n this._native.deleteVertexArray(vertexArray);\r\n };\r\n NativeEngine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n var nativePipelineContext = pipelineContext;\r\n return this._native.getAttributes(nativePipelineContext.nativeProgram, attributesNames);\r\n };\r\n /**\r\n * Draw a list of indexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n NativeEngine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n // Apply states\r\n this._drawCalls.addCount(1, false);\r\n // TODO: Make this implementation more robust like core Engine version.\r\n // Render\r\n //var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\r\n //var mult = this._uintIndicesCurrentlySet ? 4 : 2;\r\n // if (instancesCount) {\r\n // this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\r\n // } else {\r\n this._native.drawIndexed(fillMode, indexStart, indexCount);\r\n // }\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n NativeEngine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n // Apply states\r\n this._drawCalls.addCount(1, false);\r\n // TODO: Make this implementation more robust like core Engine version.\r\n // if (instancesCount) {\r\n // this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\r\n // } else {\r\n this._native.draw(fillMode, verticesStart, verticesCount);\r\n // }\r\n };\r\n NativeEngine.prototype.createPipelineContext = function () {\r\n return new NativePipelineContext();\r\n };\r\n NativeEngine.prototype._preparePipelineContext = function (pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rebuildRebind, defines, transformFeedbackVaryings) {\r\n var nativePipelineContext = pipelineContext;\r\n if (createAsRaw) {\r\n nativePipelineContext.nativeProgram = this.createRawShaderProgram(pipelineContext, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\r\n }\r\n else {\r\n nativePipelineContext.nativeProgram = this.createShaderProgram(pipelineContext, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\r\n }\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._isRenderingStateCompiled = function (pipelineContext) {\r\n // TODO: support async shader compilcation\r\n return true;\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._executeWhenRenderingStateIsCompiled = function (pipelineContext, action) {\r\n // TODO: support async shader compilcation\r\n action();\r\n };\r\n NativeEngine.prototype.createRawShaderProgram = function (pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n throw new Error(\"Not Supported\");\r\n };\r\n NativeEngine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n this.onBeforeShaderCompilationObservable.notifyObservers(this);\r\n var program = this._native.createProgram(_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._concatenateShader(vertexCode, defines), _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._concatenateShader(fragmentCode, defines));\r\n this.onAfterShaderCompilationObservable.notifyObservers(this);\r\n return program;\r\n };\r\n NativeEngine.prototype._setProgram = function (program) {\r\n if (this._currentProgram !== program) {\r\n this._native.setProgram(program);\r\n this._currentProgram = program;\r\n }\r\n };\r\n NativeEngine.prototype._releaseEffect = function (effect) {\r\n // TODO\r\n };\r\n NativeEngine.prototype._deletePipelineContext = function (pipelineContext) {\r\n // TODO\r\n };\r\n NativeEngine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n var nativePipelineContext = pipelineContext;\r\n return this._native.getUniforms(nativePipelineContext.nativeProgram, uniformsNames);\r\n };\r\n NativeEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n // TODO\r\n throw new Error(\"Not Implemented\");\r\n };\r\n NativeEngine.prototype.bindSamplers = function (effect) {\r\n var nativePipelineContext = effect.getPipelineContext();\r\n this._setProgram(nativePipelineContext.nativeProgram);\r\n // TODO: share this with engine?\r\n var samplers = effect.getSamplers();\r\n for (var index = 0; index < samplers.length; index++) {\r\n var uniform = effect.getUniform(samplers[index]);\r\n if (uniform) {\r\n this._boundUniforms[index] = uniform;\r\n }\r\n }\r\n this._currentEffect = null;\r\n };\r\n NativeEngine.prototype.setMatrix = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrix(uniform, matrix.toArray());\r\n };\r\n NativeEngine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._native.getRenderWidth();\r\n };\r\n NativeEngine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._native.getRenderHeight();\r\n };\r\n NativeEngine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n // TODO: Implement.\r\n this._cachedViewport = viewport;\r\n };\r\n NativeEngine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n this._native.setState(culling, zOffset, reverseSide);\r\n };\r\n /**\r\n * Set the z offset to apply to current rendering\r\n * @param value defines the offset to apply\r\n */\r\n NativeEngine.prototype.setZOffset = function (value) {\r\n this._native.setZOffset(value);\r\n };\r\n /**\r\n * Gets the current value of the zOffset\r\n * @returns the current zOffset state\r\n */\r\n NativeEngine.prototype.getZOffset = function () {\r\n return this._native.getZOffset();\r\n };\r\n /**\r\n * Enable or disable depth buffering\r\n * @param enable defines the state to set\r\n */\r\n NativeEngine.prototype.setDepthBuffer = function (enable) {\r\n this._native.setDepthTest(enable);\r\n };\r\n /**\r\n * Gets a boolean indicating if depth writing is enabled\r\n * @returns the current depth writing state\r\n */\r\n NativeEngine.prototype.getDepthWrite = function () {\r\n return this._native.getDepthWrite();\r\n };\r\n /**\r\n * Enable or disable depth writing\r\n * @param enable defines the state to set\r\n */\r\n NativeEngine.prototype.setDepthWrite = function (enable) {\r\n this._native.setDepthWrite(enable);\r\n };\r\n /**\r\n * Enable or disable color writing\r\n * @param enable defines the state to set\r\n */\r\n NativeEngine.prototype.setColorWrite = function (enable) {\r\n this._native.setColorWrite(enable);\r\n this._colorWrite = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if color writing is enabled\r\n * @returns the current color writing state\r\n */\r\n NativeEngine.prototype.getColorWrite = function () {\r\n return this._colorWrite;\r\n };\r\n /**\r\n * Sets alpha constants used by some alpha blending modes\r\n * @param r defines the red component\r\n * @param g defines the green component\r\n * @param b defines the blue component\r\n * @param a defines the alpha component\r\n */\r\n NativeEngine.prototype.setAlphaConstants = function (r, g, b, a) {\r\n throw new Error(\"Setting alpha blend constant color not yet implemented.\");\r\n };\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the BABYLON.Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n */\r\n NativeEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n this._native.setBlendMode(mode);\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n };\r\n /**\r\n * Gets the current alpha mode\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered\r\n * @returns the current alpha mode\r\n */\r\n NativeEngine.prototype.getAlphaMode = function () {\r\n return this._alphaMode;\r\n };\r\n NativeEngine.prototype.setIntArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray(uniform, array);\r\n };\r\n NativeEngine.prototype.setIntArray2 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray2(uniform, array);\r\n };\r\n NativeEngine.prototype.setIntArray3 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray3(uniform, array);\r\n };\r\n NativeEngine.prototype.setIntArray4 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setIntArray4(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray2 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray2(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray3 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray3(uniform, array);\r\n };\r\n NativeEngine.prototype.setFloatArray4 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray4(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray2 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray2(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray3 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray3(uniform, array);\r\n };\r\n NativeEngine.prototype.setArray4 = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloatArray4(uniform, array);\r\n };\r\n NativeEngine.prototype.setMatrices = function (uniform, matrices) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrices(uniform, matrices);\r\n };\r\n NativeEngine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrix3x3(uniform, matrix);\r\n };\r\n NativeEngine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setMatrix2x2(uniform, matrix);\r\n };\r\n NativeEngine.prototype.setFloat = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat(uniform, value);\r\n };\r\n NativeEngine.prototype.setFloat2 = function (uniform, x, y) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat2(uniform, x, y);\r\n };\r\n NativeEngine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat3(uniform, x, y, z);\r\n };\r\n NativeEngine.prototype.setBool = function (uniform, bool) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setBool(uniform, bool);\r\n };\r\n NativeEngine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat4(uniform, x, y, z, w);\r\n };\r\n NativeEngine.prototype.setColor3 = function (uniform, color3) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat3(uniform, color3.r, color3.g, color3.b);\r\n };\r\n NativeEngine.prototype.setColor4 = function (uniform, color3, alpha) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._native.setFloat4(uniform, color3.r, color3.g, color3.b, alpha);\r\n };\r\n NativeEngine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames) {\r\n return;\r\n }\r\n this.resetTextureCache();\r\n this._currentEffect = null;\r\n if (bruteForce) {\r\n this._currentProgram = null;\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this._alphaState.reset();\r\n }\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n };\r\n NativeEngine.prototype._createTexture = function () {\r\n return this._native.createTexture();\r\n };\r\n NativeEngine.prototype._deleteTexture = function (texture) {\r\n this._native.deleteTexture(texture);\r\n };\r\n // TODO: Refactor to share more logic with babylon.engine.ts version.\r\n /**\r\n * Usually called from BABYLON.Texture.ts.\r\n * Passed information to create a WebGLTexture\r\n * @param urlArg defines a value which contains one of the following:\r\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\r\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\r\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\r\n * @param invertY when true, image is flipped when loaded. You probably want true. Ignored for compressed textures. Must be flipped in the file\r\n * @param scene needed for loading to the correct scene\r\n * @param samplingMode mode with should be used sample / access the texture (Default: BABYLON.Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param onLoad optional callback to be called upon successful completion\r\n * @param onError optional callback to be called upon failure\r\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), or a Blob\r\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\r\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns a InternalTexture for assignment back into BABYLON.Texture\r\n */\r\n NativeEngine.prototype.createTexture = function (urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (format === void 0) { format = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n var url = String(urlArg); // assign a new string, so that the original is still available in case of fallback\r\n var fromData = url.substr(0, 5) === \"data:\";\r\n var fromBlob = url.substr(0, 5) === \"blob:\";\r\n var isBase64 = fromData && url.indexOf(\"base64\") !== -1;\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_URL);\r\n // establish the file extension, if possible\r\n var lastDot = url.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\");\r\n // TODO: Add support for compressed texture formats.\r\n var textureFormatInUse = null;\r\n var loader = null;\r\n for (var _i = 0, _a = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (availableLoader.canLoad(extension, textureFormatInUse, fallback, isBase64, buffer ? true : false)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n if (loader) {\r\n url = loader.transformUrl(url, textureFormatInUse);\r\n }\r\n if (scene) {\r\n scene._addPendingData(texture);\r\n }\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n if (!this.doNotHandleContextLost) {\r\n // Keep a link to the buffer only if we plan to handle context lost\r\n texture._buffer = buffer;\r\n }\r\n var onLoadObserver = null;\r\n if (onLoad && !fallback) {\r\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\r\n }\r\n if (!fallback) {\r\n this._internalTexturesCache.push(texture);\r\n }\r\n var onInternalError = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n var customFallback = false;\r\n if (loader) {\r\n var fallbackUrl = loader.getFallbackTextureUrl(url, textureFormatInUse);\r\n if (fallbackUrl) {\r\n // Add Back\r\n customFallback = true;\r\n _this.createTexture(urlArg, noMipmap, invertY, scene, samplingMode, null, onError, buffer, texture);\r\n }\r\n }\r\n if (!customFallback) {\r\n if (onLoadObserver) {\r\n texture.onLoadedObservable.remove(onLoadObserver);\r\n }\r\n if (_Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].UseFallbackTexture) {\r\n _this.createTexture(_Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].fallbackTexture, noMipmap, invertY, scene, samplingMode, null, onError, buffer, texture);\r\n }\r\n }\r\n if (onError) {\r\n onError(message || \"Unknown error\", exception);\r\n }\r\n };\r\n // processing for non-image formats\r\n if (loader) {\r\n throw new Error(\"Loading textures from IInternalTextureLoader not yet implemented.\");\r\n // var callback = (data: string | ArrayBuffer) => {\r\n // loader!.loadData(data as ArrayBuffer, texture, (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void) => {\r\n // this._prepareWebGLTexture(texture, scene, width, height, invertY, !loadMipmap, isCompressed, () => {\r\n // done();\r\n // return false;\r\n // },\r\n // samplingMode);\r\n // });\r\n // }\r\n // if (!buffer) {\r\n // this._loadFile(url, callback, undefined, scene ? scene.database : undefined, true, (request?: XMLHttpRequest, exception?: any) => {\r\n // onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\r\n // });\r\n // } else {\r\n // callback(buffer as ArrayBuffer);\r\n // }\r\n }\r\n else {\r\n var onload = function (data, responseURL) {\r\n if (typeof (data) === \"string\") {\r\n throw new Error(\"Loading textures from string data not yet implemented.\");\r\n }\r\n if (fromBlob && !_this.doNotHandleContextLost) {\r\n // We need to store the image if we need to rebuild the texture\r\n // in case of a webgl context lost\r\n texture._buffer = data;\r\n }\r\n var webGLTexture = texture._webGLTexture;\r\n if (!webGLTexture) {\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n return;\r\n }\r\n _this._native.loadTexture(webGLTexture, data, !noMipmap);\r\n if (invertY) {\r\n throw new Error(\"Support for textures with inverted Y coordinates not yet implemented.\");\r\n }\r\n //this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n texture.baseWidth = _this._native.getTextureWidth(webGLTexture);\r\n texture.baseHeight = _this._native.getTextureHeight(webGLTexture);\r\n texture.width = texture.baseWidth;\r\n texture.height = texture.baseHeight;\r\n texture.isReady = true;\r\n var filter = _this._getSamplingFilter(samplingMode);\r\n _this._native.setTextureSampling(webGLTexture, filter);\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n };\r\n if (buffer instanceof ArrayBuffer) {\r\n onload(buffer);\r\n }\r\n else if (ArrayBuffer.isView(buffer)) {\r\n onload(buffer.buffer);\r\n }\r\n else if (buffer instanceof Blob) {\r\n throw new Error(\"Loading texture from Blob not yet implemented.\");\r\n }\r\n else if (!fromData) {\r\n var onLoadFileError = function (request, exception) {\r\n onInternalError(\"Failed to retrieve \" + url + \".\", exception);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].LoadFile(url, onload, undefined, undefined, /*useArrayBuffer*/ true, onLoadFileError);\r\n }\r\n else {\r\n onload(_Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].DecodeBase64(buffer));\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials if a polynomial sphere should be created for the cube texture\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param fallback defines texture to use while falling back when (compressed) texture file not found.\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n NativeEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n if (fallback === void 0) { fallback = null; }\r\n var texture = fallback ? fallback : new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_CUBE);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n }\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n if (extension === \".env\") {\r\n var onloaddata = function (data) {\r\n data = data;\r\n var info = _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__[\"EnvironmentTextureTools\"].GetEnvInfo(data);\r\n texture.width = info.width;\r\n texture.height = info.width;\r\n _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__[\"EnvironmentTextureTools\"].UploadEnvSpherical(texture, info);\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n if (!specularInfo) {\r\n throw new Error(\"Nothing else parsed so far\");\r\n }\r\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\r\n var imageData = _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_6__[\"EnvironmentTextureTools\"].CreateImageDataArrayBufferViews(data, info);\r\n texture.format = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTUREFORMAT_RGBA;\r\n texture.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n texture.generateMipMaps = true;\r\n texture.getEngine().updateTextureSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE, texture);\r\n texture._isRGBD = true;\r\n texture.invertY = true;\r\n _this._native.loadCubeTexture(texture._webGLTexture, imageData, true);\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n if (files && files.length === 6) {\r\n throw new Error(\"Multi-file loading not yet supported.\");\r\n }\r\n else {\r\n var onInternalError = function (request, exception) {\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n this._loadFile(rootUrl, onloaddata, undefined, undefined, true, onInternalError);\r\n }\r\n }\r\n else {\r\n throw new Error(\"Cannot load cubemap: non-ENV format not supported.\");\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n // Returns a NativeFilter.XXXX value.\r\n NativeEngine.prototype._getSamplingFilter = function (samplingMode) {\r\n switch (samplingMode) {\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_BILINEAR_SAMPLINGMODE:\r\n return NativeFilter.MINLINEAR_MAGLINEAR_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_TRILINEAR_SAMPLINGMODE:\r\n return NativeFilter.MINLINEAR_MAGLINEAR_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_SAMPLINGMODE:\r\n return NativeFilter.MINPOINT_MAGPOINT_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_NEAREST_MIPNEAREST:\r\n return NativeFilter.MINPOINT_MAGPOINT_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_LINEAR_MIPNEAREST:\r\n return NativeFilter.MINLINEAR_MAGPOINT_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_LINEAR_MIPLINEAR:\r\n return NativeFilter.MINLINEAR_MAGPOINT_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_LINEAR:\r\n return NativeFilter.MINLINEAR_MAGPOINT_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_NEAREST_NEAREST:\r\n return NativeFilter.MINPOINT_MAGPOINT_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_NEAREST_MIPNEAREST:\r\n return NativeFilter.MINPOINT_MAGLINEAR_MIPPOINT;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_NEAREST_MIPLINEAR:\r\n return NativeFilter.MINPOINT_MAGLINEAR_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_LINEAR:\r\n return NativeFilter.MINLINEAR_MAGLINEAR_MIPLINEAR;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_LINEAR_NEAREST:\r\n return NativeFilter.MINPOINT_MAGLINEAR_MIPLINEAR;\r\n default:\r\n throw new Error(\"Unexpected sampling mode: \" + samplingMode + \".\");\r\n }\r\n };\r\n NativeEngine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_7__[\"RenderTargetCreationOptions\"]();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE : options.samplingMode;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT;\r\n fullOptions.samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE;\r\n }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n texture._depthStencilBuffer = {};\r\n texture._framebuffer = {};\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n NativeEngine.prototype.updateTextureSamplingMode = function (samplingMode, texture) {\r\n if (texture._webGLTexture) {\r\n var filter = this._getSamplingFilter(samplingMode);\r\n this._native.setTextureSampling(texture._webGLTexture, filter);\r\n }\r\n texture.samplingMode = samplingMode;\r\n };\r\n NativeEngine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {\r\n throw new Error(\"bindFramebuffer not yet implemented.\");\r\n };\r\n NativeEngine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n throw new Error(\"unBindFramebuffer not yet implemented.\");\r\n };\r\n NativeEngine.prototype.createDynamicVertexBuffer = function (data) {\r\n throw new Error(\"createDynamicVertexBuffer not yet implemented.\");\r\n };\r\n NativeEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n throw new Error(\"updateDynamicIndexBuffer not yet implemented.\");\r\n };\r\n /**\r\n * Updates a dynamic vertex buffer.\r\n * @param vertexBuffer the vertex buffer to update\r\n * @param data the data used to update the vertex buffer\r\n * @param byteOffset the byte offset of the data (optional)\r\n * @param byteLength the byte length of the data (optional)\r\n */\r\n NativeEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\r\n throw new Error(\"updateDynamicVertexBuffer not yet implemented.\");\r\n };\r\n // TODO: Refactor to share more logic with base Engine implementation.\r\n NativeEngine.prototype._setTexture = function (channel, texture, isPartOfTextureArray, depthStencilTexture) {\r\n if (isPartOfTextureArray === void 0) { isPartOfTextureArray = false; }\r\n if (depthStencilTexture === void 0) { depthStencilTexture = false; }\r\n var uniform = this._boundUniforms[channel];\r\n if (!uniform) {\r\n return false;\r\n }\r\n // Not ready?\r\n if (!texture) {\r\n if (this._boundTexturesCache[channel] != null) {\r\n this._activeChannel = channel;\r\n this._native.setTexture(uniform, null);\r\n }\r\n return false;\r\n }\r\n // Video\r\n if (texture.video) {\r\n this._activeChannel = channel;\r\n texture.update();\r\n }\r\n else if (texture.delayLoadState === _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].DELAYLOADSTATE_NOTLOADED) { // Delay loading\r\n texture.delayLoad();\r\n return false;\r\n }\r\n var internalTexture;\r\n if (depthStencilTexture) {\r\n internalTexture = texture.depthStencilTexture;\r\n }\r\n else if (texture.isReady()) {\r\n internalTexture = texture.getInternalTexture();\r\n }\r\n else if (texture.isCube) {\r\n internalTexture = this.emptyCubeTexture;\r\n }\r\n else if (texture.is3D) {\r\n internalTexture = this.emptyTexture3D;\r\n }\r\n else {\r\n internalTexture = this.emptyTexture;\r\n }\r\n this._activeChannel = channel;\r\n if (!internalTexture ||\r\n !internalTexture._webGLTexture) {\r\n return false;\r\n }\r\n this._native.setTextureWrapMode(internalTexture._webGLTexture, this._getAddressMode(texture.wrapU), this._getAddressMode(texture.wrapV), this._getAddressMode(texture.wrapR));\r\n this._updateAnisotropicLevel(texture);\r\n this._native.setTexture(uniform, internalTexture._webGLTexture);\r\n return true;\r\n };\r\n // TODO: Share more of this logic with the base implementation.\r\n // TODO: Rename to match naming in base implementation once refactoring allows different parameters.\r\n NativeEngine.prototype._updateAnisotropicLevel = function (texture) {\r\n var internalTexture = texture.getInternalTexture();\r\n var value = texture.anisotropicFilteringLevel;\r\n if (!internalTexture || !internalTexture._webGLTexture) {\r\n return;\r\n }\r\n if (internalTexture._cachedAnisotropicFilteringLevel !== value) {\r\n this._native.setTextureAnisotropicLevel(internalTexture._webGLTexture, value);\r\n internalTexture._cachedAnisotropicFilteringLevel = value;\r\n }\r\n };\r\n // Returns a NativeAddressMode.XXX value.\r\n NativeEngine.prototype._getAddressMode = function (wrapMode) {\r\n switch (wrapMode) {\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_WRAP_ADDRESSMODE:\r\n return NativeAddressMode.WRAP;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_CLAMP_ADDRESSMODE:\r\n return NativeAddressMode.CLAMP;\r\n case _Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"].TEXTURE_MIRROR_ADDRESSMODE:\r\n return NativeAddressMode.MIRROR;\r\n default:\r\n throw new Error(\"Unexpected wrap mode: \" + wrapMode + \".\");\r\n }\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._bindTexture = function (channel, texture) {\r\n throw new Error(\"_bindTexture not implemented.\");\r\n };\r\n NativeEngine.prototype._deleteBuffer = function (buffer) {\r\n if (buffer.nativeIndexBuffer) {\r\n this._native.deleteIndexBuffer(buffer.nativeIndexBuffer);\r\n delete buffer.nativeIndexBuffer;\r\n }\r\n if (buffer.nativeVertexBuffer) {\r\n this._native.deleteVertexBuffer(buffer.nativeVertexBuffer);\r\n delete buffer.nativeVertexBuffer;\r\n }\r\n };\r\n NativeEngine.prototype.releaseEffects = function () {\r\n // TODO\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadCompressedDataToTextureDirectly not implemented.\");\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadDataToTextureDirectly not implemented.\");\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadArrayBufferViewToTexture not implemented.\");\r\n };\r\n /** @hidden */\r\n NativeEngine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n throw new Error(\"_uploadArrayBufferViewToTexture not implemented.\");\r\n };\r\n return NativeEngine;\r\n}(_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Engines/nullEngine.ts\":\n/*!*******************************!*\\\n !*** ./Engines/nullEngine.ts ***!\n \\*******************************/\n/*! exports provided: NullEngineOptions, NullEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return NullEngineOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return NullEngine; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/dataBuffer */ \"./Meshes/dataBuffer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Options to create the null engine\r\n */\r\nvar NullEngineOptions = /** @class */ (function () {\r\n function NullEngineOptions() {\r\n /**\r\n * Render width (Default: 512)\r\n */\r\n this.renderWidth = 512;\r\n /**\r\n * Render height (Default: 256)\r\n */\r\n this.renderHeight = 256;\r\n /**\r\n * Texture size (Default: 512)\r\n */\r\n this.textureSize = 512;\r\n /**\r\n * If delta time between frames should be constant\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n this.deterministicLockstep = false;\r\n /**\r\n * Maximum about of steps between frames (Default: 4)\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n this.lockstepMaxSteps = 4;\r\n }\r\n return NullEngineOptions;\r\n}());\r\n\r\n/**\r\n * The null engine class provides support for headless version of babylon.js.\r\n * This can be used in server side scenario or for testing purposes\r\n */\r\nvar NullEngine = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NullEngine, _super);\r\n function NullEngine(options) {\r\n if (options === void 0) { options = new NullEngineOptions(); }\r\n var _this = _super.call(this, null) || this;\r\n if (options.deterministicLockstep === undefined) {\r\n options.deterministicLockstep = false;\r\n }\r\n if (options.lockstepMaxSteps === undefined) {\r\n options.lockstepMaxSteps = 4;\r\n }\r\n _this._options = options;\r\n // Init caps\r\n // We consider we are on a webgl1 capable device\r\n _this._caps = new _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"EngineCapabilities\"]();\r\n _this._caps.maxTexturesImageUnits = 16;\r\n _this._caps.maxVertexTextureImageUnits = 16;\r\n _this._caps.maxTextureSize = 512;\r\n _this._caps.maxCubemapTextureSize = 512;\r\n _this._caps.maxRenderTextureSize = 512;\r\n _this._caps.maxVertexAttribs = 16;\r\n _this._caps.maxVaryingVectors = 16;\r\n _this._caps.maxFragmentUniformVectors = 16;\r\n _this._caps.maxVertexUniformVectors = 16;\r\n // Extensions\r\n _this._caps.standardDerivatives = false;\r\n _this._caps.astc = null;\r\n _this._caps.s3tc = null;\r\n _this._caps.pvrtc = null;\r\n _this._caps.etc1 = null;\r\n _this._caps.etc2 = null;\r\n _this._caps.textureAnisotropicFilterExtension = null;\r\n _this._caps.maxAnisotropy = 0;\r\n _this._caps.uintIndices = false;\r\n _this._caps.fragmentDepthSupported = false;\r\n _this._caps.highPrecisionShaderSupported = true;\r\n _this._caps.colorBufferFloat = false;\r\n _this._caps.textureFloat = false;\r\n _this._caps.textureFloatLinearFiltering = false;\r\n _this._caps.textureFloatRender = false;\r\n _this._caps.textureHalfFloat = false;\r\n _this._caps.textureHalfFloatLinearFiltering = false;\r\n _this._caps.textureHalfFloatRender = false;\r\n _this._caps.textureLOD = false;\r\n _this._caps.drawBuffersExtension = false;\r\n _this._caps.depthTextureExtension = false;\r\n _this._caps.vertexArrayObject = false;\r\n _this._caps.instancedArrays = false;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log(\"Babylon.js v\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].Version + \" - Null engine\");\r\n // Wrappers\r\n var theCurrentGlobal = (typeof self !== \"undefined\" ? self : typeof global !== \"undefined\" ? global : window);\r\n if (typeof URL === \"undefined\") {\r\n theCurrentGlobal.URL = {\r\n createObjectURL: function () { },\r\n revokeObjectURL: function () { }\r\n };\r\n }\r\n if (typeof Blob === \"undefined\") {\r\n theCurrentGlobal.Blob = function () { };\r\n }\r\n return _this;\r\n }\r\n /**\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n NullEngine.prototype.isDeterministicLockStep = function () {\r\n return this._options.deterministicLockstep;\r\n };\r\n /** @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep */\r\n NullEngine.prototype.getLockstepMaxSteps = function () {\r\n return this._options.lockstepMaxSteps;\r\n };\r\n /**\r\n * Sets hardware scaling, used to save performance if needed\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\n NullEngine.prototype.getHardwareScalingLevel = function () {\r\n return 1.0;\r\n };\r\n NullEngine.prototype.createVertexBuffer = function (vertices) {\r\n var buffer = new _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__[\"DataBuffer\"]();\r\n buffer.references = 1;\r\n return buffer;\r\n };\r\n NullEngine.prototype.createIndexBuffer = function (indices) {\r\n var buffer = new _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__[\"DataBuffer\"]();\r\n buffer.references = 1;\r\n return buffer;\r\n };\r\n NullEngine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n };\r\n NullEngine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._options.renderWidth;\r\n };\r\n NullEngine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._options.renderHeight;\r\n };\r\n NullEngine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n this._cachedViewport = viewport;\r\n };\r\n NullEngine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context) {\r\n return {\r\n __SPECTOR_rebuildProgram: null,\r\n };\r\n };\r\n NullEngine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n return [];\r\n };\r\n NullEngine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n return [];\r\n };\r\n NullEngine.prototype.bindSamplers = function (effect) {\r\n this._currentEffect = null;\r\n };\r\n NullEngine.prototype.enableEffect = function (effect) {\r\n this._currentEffect = effect;\r\n if (effect.onBind) {\r\n effect.onBind(effect);\r\n }\r\n if (effect._onBindObservable) {\r\n effect._onBindObservable.notifyObservers(effect);\r\n }\r\n };\r\n NullEngine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n };\r\n NullEngine.prototype.setIntArray = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setIntArray2 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setIntArray3 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setIntArray4 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray2 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray3 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setFloatArray4 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray2 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray3 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setArray4 = function (uniform, array) {\r\n };\r\n NullEngine.prototype.setMatrices = function (uniform, matrices) {\r\n };\r\n NullEngine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n };\r\n NullEngine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n };\r\n NullEngine.prototype.setFloat = function (uniform, value) {\r\n };\r\n NullEngine.prototype.setFloat2 = function (uniform, x, y) {\r\n };\r\n NullEngine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n };\r\n NullEngine.prototype.setBool = function (uniform, bool) {\r\n };\r\n NullEngine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n };\r\n NullEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n this._alphaState.alphaBlend = (mode !== _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].ALPHA_DISABLE);\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n };\r\n NullEngine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {\r\n };\r\n NullEngine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames) {\r\n return;\r\n }\r\n this.resetTextureCache();\r\n this._currentEffect = null;\r\n if (bruteForce) {\r\n this._currentProgram = null;\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this._alphaState.reset();\r\n }\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n };\r\n NullEngine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {\r\n };\r\n NullEngine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n };\r\n NullEngine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._createTexture = function () {\r\n return {};\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._releaseTexture = function (texture) {\r\n };\r\n NullEngine.prototype.createTexture = function (urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallBack, format) {\r\n if (samplingMode === void 0) { samplingMode = _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_URL);\r\n var url = String(urlArg);\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture.baseWidth = this._options.textureSize;\r\n texture.baseHeight = this._options.textureSize;\r\n texture.width = this._options.textureSize;\r\n texture.height = this._options.textureSize;\r\n if (format) {\r\n texture.format = format;\r\n }\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n NullEngine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetCreationOptions\"]();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n fullOptions.samplingMode = _constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n }\r\n var texture = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_RENDERTARGET);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n texture._depthStencilBuffer = {};\r\n texture._framebuffer = {};\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n NullEngine.prototype.updateTextureSamplingMode = function (samplingMode, texture) {\r\n texture.samplingMode = samplingMode;\r\n };\r\n NullEngine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n this._currentRenderTarget = texture;\r\n this._currentFramebuffer = texture._MSAAFramebuffer ? texture._MSAAFramebuffer : texture._framebuffer;\r\n if (this._cachedViewport && !forceFullscreenViewport) {\r\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\r\n }\r\n };\r\n NullEngine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n if (onBeforeUnbind) {\r\n if (texture._MSAAFramebuffer) {\r\n this._currentFramebuffer = texture._framebuffer;\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._currentFramebuffer = null;\r\n };\r\n NullEngine.prototype.createDynamicVertexBuffer = function (vertices) {\r\n var buffer = new _Meshes_dataBuffer__WEBPACK_IMPORTED_MODULE_6__[\"DataBuffer\"]();\r\n buffer.references = 1;\r\n buffer.capacity = 1;\r\n return buffer;\r\n };\r\n NullEngine.prototype.updateDynamicTexture = function (texture, canvas, invertY, premulAlpha, format) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n };\r\n NullEngine.prototype.areAllEffectsReady = function () {\r\n return true;\r\n };\r\n /**\r\n * @hidden\r\n * Get the current error code of the webGL context\r\n * @returns the error code\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\r\n */\r\n NullEngine.prototype.getError = function () {\r\n return 0;\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._getUnpackAlignement = function () {\r\n return 1;\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._unpackFlipY = function (value) {\r\n };\r\n NullEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n };\r\n /**\r\n * Updates a dynamic vertex buffer.\r\n * @param vertexBuffer the vertex buffer to update\r\n * @param data the data used to update the vertex buffer\r\n * @param byteOffset the byte offset of the data (optional)\r\n * @param byteLength the byte length of the data (optional)\r\n */\r\n NullEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, vertices, byteOffset, byteLength) {\r\n };\r\n NullEngine.prototype._bindTextureDirectly = function (target, texture) {\r\n if (this._boundTexturesCache[this._activeChannel] !== texture) {\r\n this._boundTexturesCache[this._activeChannel] = texture;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._bindTexture = function (channel, texture) {\r\n if (channel < 0) {\r\n return;\r\n }\r\n this._bindTextureDirectly(0, texture);\r\n };\r\n NullEngine.prototype._deleteBuffer = function (buffer) {\r\n };\r\n NullEngine.prototype.releaseEffects = function () {\r\n };\r\n NullEngine.prototype.displayLoadingUI = function () {\r\n };\r\n NullEngine.prototype.hideLoadingUI = function () {\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n /** @hidden */\r\n NullEngine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n };\r\n return NullEngine;\r\n}(_Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"]));\r\n\r\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"../node_modules/webpack/buildin/global.js\")))\n\n/***/ }),\n\n/***/ \"./Events/clipboardEvents.ts\":\n/*!***********************************!*\\\n !*** ./Events/clipboardEvents.ts ***!\n \\***********************************/\n/*! exports provided: ClipboardEventTypes, ClipboardInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return ClipboardEventTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return ClipboardInfo; });\n/**\r\n * Gather the list of clipboard event types as constants.\r\n */\r\nvar ClipboardEventTypes = /** @class */ (function () {\r\n function ClipboardEventTypes() {\r\n }\r\n /**\r\n * The clipboard event is fired when a copy command is active (pressed).\r\n */\r\n ClipboardEventTypes.COPY = 0x01; //\r\n /**\r\n * The clipboard event is fired when a cut command is active (pressed).\r\n */\r\n ClipboardEventTypes.CUT = 0x02;\r\n /**\r\n * The clipboard event is fired when a paste command is active (pressed).\r\n */\r\n ClipboardEventTypes.PASTE = 0x03;\r\n return ClipboardEventTypes;\r\n}());\r\n\r\n/**\r\n * This class is used to store clipboard related info for the onClipboardObservable event.\r\n */\r\nvar ClipboardInfo = /** @class */ (function () {\r\n /**\r\n *Creates an instance of ClipboardInfo.\r\n * @param type Defines the type of event (BABYLON.ClipboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function ClipboardInfo(\r\n /**\r\n * Defines the type of event (BABYLON.ClipboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n /**\r\n * Get the clipboard event's type from the keycode.\r\n * @param keyCode Defines the keyCode for the current keyboard event.\r\n * @return {number}\r\n */\r\n ClipboardInfo.GetTypeFromCharacter = function (keyCode) {\r\n var charCode = keyCode;\r\n //TODO: add codes for extended ASCII\r\n switch (charCode) {\r\n case 67: return ClipboardEventTypes.COPY;\r\n case 86: return ClipboardEventTypes.PASTE;\r\n case 88: return ClipboardEventTypes.CUT;\r\n default: return -1;\r\n }\r\n };\r\n return ClipboardInfo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Events/index.ts\":\n/*!*************************!*\\\n !*** ./Events/index.ts ***!\n \\*************************/\n/*! exports provided: KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keyboardEvents */ \"./Events/keyboardEvents.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return _keyboardEvents__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfoPre\"]; });\n\n/* harmony import */ var _pointerEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerInfoBase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return _pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerInfo\"]; });\n\n/* harmony import */ var _clipboardEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./clipboardEvents */ \"./Events/clipboardEvents.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return _clipboardEvents__WEBPACK_IMPORTED_MODULE_2__[\"ClipboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return _clipboardEvents__WEBPACK_IMPORTED_MODULE_2__[\"ClipboardInfo\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Events/keyboardEvents.ts\":\n/*!**********************************!*\\\n !*** ./Events/keyboardEvents.ts ***!\n \\**********************************/\n/*! exports provided: KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return KeyboardEventTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return KeyboardInfo; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return KeyboardInfoPre; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * Gather the list of keyboard event types as constants.\r\n */\r\nvar KeyboardEventTypes = /** @class */ (function () {\r\n function KeyboardEventTypes() {\r\n }\r\n /**\r\n * The keydown event is fired when a key becomes active (pressed).\r\n */\r\n KeyboardEventTypes.KEYDOWN = 0x01;\r\n /**\r\n * The keyup event is fired when a key has been released.\r\n */\r\n KeyboardEventTypes.KEYUP = 0x02;\r\n return KeyboardEventTypes;\r\n}());\r\n\r\n/**\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n */\r\nvar KeyboardInfo = /** @class */ (function () {\r\n /**\r\n * Instantiates a new keyboard info.\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfo(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return KeyboardInfo;\r\n}());\r\n\r\n/**\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable\r\n */\r\nvar KeyboardInfoPre = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](KeyboardInfoPre, _super);\r\n /**\r\n * Instantiates a new keyboard pre info.\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfoPre(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.type = type;\r\n _this.event = event;\r\n _this.skipOnPointerObservable = false;\r\n return _this;\r\n }\r\n return KeyboardInfoPre;\r\n}(KeyboardInfo));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Events/pointerEvents.ts\":\n/*!*********************************!*\\\n !*** ./Events/pointerEvents.ts ***!\n \\*********************************/\n/*! exports provided: PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return PointerEventTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return PointerInfoBase; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return PointerInfoPre; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return PointerInfo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n/**\r\n * Gather the list of pointer event types as constants.\r\n */\r\nvar PointerEventTypes = /** @class */ (function () {\r\n function PointerEventTypes() {\r\n }\r\n /**\r\n * The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.\r\n */\r\n PointerEventTypes.POINTERDOWN = 0x01;\r\n /**\r\n * The pointerup event is fired when a pointer is no longer active.\r\n */\r\n PointerEventTypes.POINTERUP = 0x02;\r\n /**\r\n * The pointermove event is fired when a pointer changes coordinates.\r\n */\r\n PointerEventTypes.POINTERMOVE = 0x04;\r\n /**\r\n * The pointerwheel event is fired when a mouse wheel has been rotated.\r\n */\r\n PointerEventTypes.POINTERWHEEL = 0x08;\r\n /**\r\n * The pointerpick event is fired when a mesh or sprite has been picked by the pointer.\r\n */\r\n PointerEventTypes.POINTERPICK = 0x10;\r\n /**\r\n * The pointertap event is fired when a the object has been touched and released without drag.\r\n */\r\n PointerEventTypes.POINTERTAP = 0x20;\r\n /**\r\n * The pointerdoubletap event is fired when a the object has been touched and released twice without drag.\r\n */\r\n PointerEventTypes.POINTERDOUBLETAP = 0x40;\r\n return PointerEventTypes;\r\n}());\r\n\r\n/**\r\n * Base class of pointer info types.\r\n */\r\nvar PointerInfoBase = /** @class */ (function () {\r\n /**\r\n * Instantiates the base class of pointers info.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function PointerInfoBase(\r\n /**\r\n * Defines the type of event (PointerEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return PointerInfoBase;\r\n}());\r\n\r\n/**\r\n * This class is used to store pointer related info for the onPrePointerObservable event.\r\n * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable\r\n */\r\nvar PointerInfoPre = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PointerInfoPre, _super);\r\n /**\r\n * Instantiates a PointerInfoPre to store pointer related info to the onPrePointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param localX Defines the local x coordinates of the pointer when the event occured\r\n * @param localY Defines the local y coordinates of the pointer when the event occured\r\n */\r\n function PointerInfoPre(type, event, localX, localY) {\r\n var _this = _super.call(this, type, event) || this;\r\n /**\r\n * Ray from a pointer if availible (eg. 6dof controller)\r\n */\r\n _this.ray = null;\r\n _this.skipOnPointerObservable = false;\r\n _this.localPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](localX, localY);\r\n return _this;\r\n }\r\n return PointerInfoPre;\r\n}(PointerInfoBase));\r\n\r\n/**\r\n * This type contains all the data related to a pointer event in Babylon.js.\r\n * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.\r\n */\r\nvar PointerInfo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PointerInfo, _super);\r\n /**\r\n * Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param pickInfo Defines the picking info associated to the info (if any)\\\r\n */\r\n function PointerInfo(type, event, \r\n /**\r\n * Defines the picking info associated to the info (if any)\\\r\n */\r\n pickInfo) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.pickInfo = pickInfo;\r\n return _this;\r\n }\r\n return PointerInfo;\r\n}(PointerInfoBase));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/daydreamController.ts\":\n/*!****************************************************!*\\\n !*** ./Gamepads/Controllers/daydreamController.ts ***!\n \\****************************************************/\n/*! exports provided: DaydreamController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return DaydreamController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Google Daydream controller\r\n */\r\nvar DaydreamController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DaydreamController, _super);\r\n /**\r\n * Creates a new DaydreamController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function DaydreamController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerType\"].DAYDREAM;\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n DaydreamController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoader\"].ImportMesh(\"\", DaydreamController.MODEL_BASE_URL, DaydreamController.MODEL_FILENAME, scene, function (newMeshes) {\r\n _this._defaultModel = newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n DaydreamController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n // Daydream controller only has 1 GamepadButton (on the trackpad).\r\n if (buttonIdx === 0) {\r\n var observable = this.onTriggerStateChangedObservable;\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n }\r\n else {\r\n // If the app or home buttons are ever made available\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Unrecognized Daydream button index: \" + buttonIdx);\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n DaydreamController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/generic/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n DaydreamController.MODEL_FILENAME = 'generic.babylon';\r\n /**\r\n * Gamepad Id prefix used to identify Daydream Controller.\r\n */\r\n DaydreamController.GAMEPAD_ID_PREFIX = 'Daydream'; // id is 'Daydream Controller'\r\n return DaydreamController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_3__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.indexOf(DaydreamController.GAMEPAD_ID_PREFIX) === 0;\r\n },\r\n create: function (gamepadInfo) {\r\n return new DaydreamController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/gearVRController.ts\":\n/*!**************************************************!*\\\n !*** ./Gamepads/Controllers/gearVRController.ts ***!\n \\**************************************************/\n/*! exports provided: GearVRController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return GearVRController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gear VR Controller\r\n */\r\nvar GearVRController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GearVRController, _super);\r\n /**\r\n * Creates a new GearVRController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function GearVRController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this._buttonIndexToObservableNameMap = [\r\n 'onPadStateChangedObservable',\r\n 'onTriggerStateChangedObservable' // Trigger\r\n ];\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_5__[\"PoseEnabledControllerType\"].GEAR_VR;\r\n // Initial starting position defaults to where hand would be (incase of only 3dof controller)\r\n _this._calculatedPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](_this.hand == \"left\" ? -0.15 : 0.15, -0.5, 0.25);\r\n _this._disableTrackPosition(_this._calculatedPosition);\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n GearVRController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_3__[\"SceneLoader\"].ImportMesh(\"\", GearVRController.MODEL_BASE_URL, GearVRController.MODEL_FILENAME, scene, function (newMeshes) {\r\n // Offset the controller so it will rotate around the users wrist\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"\", scene);\r\n newMeshes[1].parent = mesh;\r\n newMeshes[1].position.z = -0.15;\r\n _this._defaultModel = mesh;\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n GearVRController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n if (buttonIdx < this._buttonIndexToObservableNameMap.length) {\r\n var observableName = this._buttonIndexToObservableNameMap[buttonIdx];\r\n // Only emit events for buttons that we know how to map from index to observable\r\n var observable = this[observableName];\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n GearVRController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/generic/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n GearVRController.MODEL_FILENAME = 'generic.babylon';\r\n /**\r\n * Gamepad Id prefix used to identify this controller.\r\n */\r\n GearVRController.GAMEPAD_ID_PREFIX = 'Gear VR'; // id is 'Gear VR Controller'\r\n return GearVRController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_4__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_5__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.indexOf(GearVRController.GAMEPAD_ID_PREFIX) === 0 ||\r\n gamepadInfo.id.indexOf('Oculus Go') !== -1 ||\r\n gamepadInfo.id.indexOf('Vive Focus') !== -1;\r\n },\r\n create: function (gamepadInfo) {\r\n return new GearVRController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/genericController.ts\":\n/*!***************************************************!*\\\n !*** ./Gamepads/Controllers/genericController.ts ***!\n \\***************************************************/\n/*! exports provided: GenericController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return GenericController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Generic Controller\r\n */\r\nvar GenericController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GenericController, _super);\r\n /**\r\n * Creates a new GenericController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function GenericController(vrGamepad) {\r\n return _super.call(this, vrGamepad) || this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n GenericController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__[\"SceneLoader\"].ImportMesh(\"\", GenericController.MODEL_BASE_URL, GenericController.MODEL_FILENAME, scene, function (newMeshes) {\r\n _this._defaultModel = newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n GenericController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n console.log(\"Button id: \" + buttonIdx + \"state: \");\r\n console.dir(state);\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n GenericController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/generic/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n GenericController.MODEL_FILENAME = 'generic.babylon';\r\n return GenericController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_2__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_3__[\"PoseEnabledControllerHelper\"]._DefaultControllerFactory = function (gamepadInfo) { return new GenericController(gamepadInfo); };\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/index.ts\":\n/*!***************************************!*\\\n !*** ./Gamepads/Controllers/index.ts ***!\n \\***************************************/\n/*! exports provided: DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _daydreamController__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./daydreamController */ \"./Gamepads/Controllers/daydreamController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _daydreamController__WEBPACK_IMPORTED_MODULE_0__[\"DaydreamController\"]; });\n\n/* harmony import */ var _gearVRController__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gearVRController */ \"./Gamepads/Controllers/gearVRController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _gearVRController__WEBPACK_IMPORTED_MODULE_1__[\"GearVRController\"]; });\n\n/* harmony import */ var _genericController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./genericController */ \"./Gamepads/Controllers/genericController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _genericController__WEBPACK_IMPORTED_MODULE_2__[\"GenericController\"]; });\n\n/* harmony import */ var _oculusTouchController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./oculusTouchController */ \"./Gamepads/Controllers/oculusTouchController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _oculusTouchController__WEBPACK_IMPORTED_MODULE_3__[\"OculusTouchController\"]; });\n\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledController\"]; });\n\n/* harmony import */ var _viveController__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./viveController */ \"./Gamepads/Controllers/viveController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _viveController__WEBPACK_IMPORTED_MODULE_5__[\"ViveController\"]; });\n\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _webVRController__WEBPACK_IMPORTED_MODULE_6__[\"WebVRController\"]; });\n\n/* harmony import */ var _windowsMotionController__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./windowsMotionController */ \"./Gamepads/Controllers/windowsMotionController.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _windowsMotionController__WEBPACK_IMPORTED_MODULE_7__[\"WindowsMotionController\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/oculusTouchController.ts\":\n/*!*******************************************************!*\\\n !*** ./Gamepads/Controllers/oculusTouchController.ts ***!\n \\*******************************************************/\n/*! exports provided: OculusTouchController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return OculusTouchController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Oculus Touch Controller\r\n */\r\nvar OculusTouchController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](OculusTouchController, _super);\r\n /**\r\n * Creates a new OculusTouchController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function OculusTouchController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n /**\r\n * Fired when the secondary trigger on this controller is modified\r\n */\r\n _this.onSecondaryTriggerStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the thumb rest on this controller is modified\r\n */\r\n _this.onThumbRestChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerType\"].OCULUS;\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n OculusTouchController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n var meshName;\r\n // Hand\r\n if (this.hand === 'left') {\r\n meshName = OculusTouchController.MODEL_LEFT_FILENAME;\r\n }\r\n else { // Right is the default if no hand is specified\r\n meshName = OculusTouchController.MODEL_RIGHT_FILENAME;\r\n }\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoader\"].ImportMesh(\"\", OculusTouchController._IsQuest ? OculusTouchController.QUEST_MODEL_BASE_URL : OculusTouchController.MODEL_BASE_URL, meshName, scene, function (newMeshes) {\r\n /*\r\n Parent Mesh name: oculus_touch_left\r\n - body\r\n - trigger\r\n - thumbstick\r\n - grip\r\n - button_y\r\n - button_x\r\n - button_enter\r\n */\r\n _this._defaultModel = OculusTouchController._IsQuest ? newMeshes[0] : newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n Object.defineProperty(OculusTouchController.prototype, \"onAButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the A button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'right') {\r\n return this.onMainButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No A button on left hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OculusTouchController.prototype, \"onBButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the B button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'right') {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No B button on left hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OculusTouchController.prototype, \"onXButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the X button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'left') {\r\n return this.onMainButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No X button on right hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OculusTouchController.prototype, \"onYButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the Y button on this controller is modified\r\n */\r\n get: function () {\r\n if (this.hand === 'left') {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n }\r\n else {\r\n throw new Error('No Y button on right hand');\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * 0) thumb stick (touch, press, value = pressed (0,1)). value is in this.leftStick\r\n * 1) index trigger (touch (?), press (only when value > 0.1), value 0 to 1)\r\n * 2) secondary trigger (same)\r\n * 3) A (right) X (left), touch, pressed = value\r\n * 4) B / Y\r\n * 5) thumb rest\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n OculusTouchController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n var notifyObject = state; //{ state: state, changes: changes };\r\n var triggerDirection = this.hand === 'right' ? -1 : 1;\r\n switch (buttonIdx) {\r\n case 0:\r\n this.onPadStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 1: // index trigger\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n (this._defaultModel.getChildren()[3]).rotation.x = -notifyObject.value * 0.20;\r\n (this._defaultModel.getChildren()[3]).position.y = -notifyObject.value * 0.005;\r\n (this._defaultModel.getChildren()[3]).position.z = -notifyObject.value * 0.005;\r\n }\r\n this.onTriggerStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 2: // secondary trigger\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n (this._defaultModel.getChildren()[4]).position.x = triggerDirection * notifyObject.value * 0.0035;\r\n }\r\n this.onSecondaryTriggerStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 3:\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n if (notifyObject.pressed) {\r\n (this._defaultModel.getChildren()[1]).position.y = -0.001;\r\n }\r\n else {\r\n (this._defaultModel.getChildren()[1]).position.y = 0;\r\n }\r\n }\r\n this.onMainButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 4:\r\n if (!OculusTouchController._IsQuest && this._defaultModel) {\r\n if (notifyObject.pressed) {\r\n (this._defaultModel.getChildren()[2]).position.y = -0.001;\r\n }\r\n else {\r\n (this._defaultModel.getChildren()[2]).position.y = 0;\r\n }\r\n }\r\n this.onSecondaryButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 5:\r\n this.onThumbRestChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n OculusTouchController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/oculus/';\r\n /**\r\n * File name for the left controller model.\r\n */\r\n OculusTouchController.MODEL_LEFT_FILENAME = 'left.babylon';\r\n /**\r\n * File name for the right controller model.\r\n */\r\n OculusTouchController.MODEL_RIGHT_FILENAME = 'right.babylon';\r\n /**\r\n * Base Url for the Quest controller model.\r\n */\r\n OculusTouchController.QUEST_MODEL_BASE_URL = 'https://controllers.babylonjs.com/oculusQuest/';\r\n /**\r\n * @hidden\r\n * If the controllers are running on a device that needs the updated Quest controller models\r\n */\r\n OculusTouchController._IsQuest = false;\r\n return OculusTouchController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_3__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_4__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n // If the headset reports being an Oculus Quest, use the Quest controller models\r\n if (_Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].LastCreatedEngine && _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].LastCreatedEngine._vrDisplay && _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].LastCreatedEngine._vrDisplay.displayName === \"Oculus Quest\") {\r\n OculusTouchController._IsQuest = true;\r\n }\r\n return gamepadInfo.id.indexOf('Oculus Touch') !== -1;\r\n },\r\n create: function (gamepadInfo) {\r\n return new OculusTouchController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/poseEnabledController.ts\":\n/*!*******************************************************!*\\\n !*** ./Gamepads/Controllers/poseEnabledController.ts ***!\n \\*******************************************************/\n/*! exports provided: PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return PoseEnabledControllerType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return PoseEnabledControllerHelper; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return PoseEnabledController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n* Defines the types of pose enabled controllers that are supported\r\n*/\r\nvar PoseEnabledControllerType;\r\n(function (PoseEnabledControllerType) {\r\n /**\r\n * HTC Vive\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"VIVE\"] = 0] = \"VIVE\";\r\n /**\r\n * Oculus Rift\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"OCULUS\"] = 1] = \"OCULUS\";\r\n /**\r\n * Windows mixed reality\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"WINDOWS\"] = 2] = \"WINDOWS\";\r\n /**\r\n * Samsung gear VR\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"GEAR_VR\"] = 3] = \"GEAR_VR\";\r\n /**\r\n * Google Daydream\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"DAYDREAM\"] = 4] = \"DAYDREAM\";\r\n /**\r\n * Generic\r\n */\r\n PoseEnabledControllerType[PoseEnabledControllerType[\"GENERIC\"] = 5] = \"GENERIC\";\r\n})(PoseEnabledControllerType || (PoseEnabledControllerType = {}));\r\n/**\r\n * Defines the PoseEnabledControllerHelper object that is used initialize a gamepad as the controller type it is specified as (eg. windows mixed reality controller)\r\n */\r\nvar PoseEnabledControllerHelper = /** @class */ (function () {\r\n function PoseEnabledControllerHelper() {\r\n }\r\n /**\r\n * Initializes a gamepad as the controller type it is specified as (eg. windows mixed reality controller)\r\n * @param vrGamepad the gamepad to initialized\r\n * @returns a vr controller of the type the gamepad identified as\r\n */\r\n PoseEnabledControllerHelper.InitiateController = function (vrGamepad) {\r\n for (var _i = 0, _a = this._ControllerFactories; _i < _a.length; _i++) {\r\n var factory = _a[_i];\r\n if (factory.canCreate(vrGamepad)) {\r\n return factory.create(vrGamepad);\r\n }\r\n }\r\n if (this._DefaultControllerFactory) {\r\n return this._DefaultControllerFactory(vrGamepad);\r\n }\r\n throw \"The type of gamepad you are trying to load needs to be imported first or is not supported.\";\r\n };\r\n /** @hidden */\r\n PoseEnabledControllerHelper._ControllerFactories = [];\r\n /** @hidden */\r\n PoseEnabledControllerHelper._DefaultControllerFactory = null;\r\n return PoseEnabledControllerHelper;\r\n}());\r\n\r\n/**\r\n * Defines the PoseEnabledController object that contains state of a vr capable controller\r\n */\r\nvar PoseEnabledController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PoseEnabledController, _super);\r\n /**\r\n * Creates a new PoseEnabledController from a gamepad\r\n * @param browserGamepad the gamepad that the PoseEnabledController should be created from\r\n */\r\n function PoseEnabledController(browserGamepad) {\r\n var _this = _super.call(this, browserGamepad.id, browserGamepad.index, browserGamepad) || this;\r\n /**\r\n * If the controller is used in a webXR session\r\n */\r\n _this.isXR = false;\r\n // Represents device position and rotation in room space. Should only be used to help calculate babylon space values\r\n _this._deviceRoomPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._deviceRoomRotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * The device position in babylon space\r\n */\r\n _this.devicePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n /**\r\n * The device rotation in babylon space\r\n */\r\n _this.deviceRotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * The scale factor of the device in babylon space\r\n */\r\n _this.deviceScaleFactor = 1;\r\n // Used to convert 6dof controllers to 3dof\r\n _this._trackPosition = true;\r\n _this._maxRotationDistFromHeadset = Math.PI / 5;\r\n _this._draggedRoomRotation = 0;\r\n _this._leftHandSystemQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * Internal, matrix used to convert room space to babylon space\r\n * @hidden\r\n */\r\n _this._deviceToWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n /**\r\n * Node to be used when casting a ray from the controller\r\n * @hidden\r\n */\r\n _this._pointingPoseNode = null;\r\n _this._workingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n /**\r\n * @hidden\r\n */\r\n _this._meshAttachedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this.type = _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"].POSE_ENABLED;\r\n _this.controllerType = PoseEnabledControllerType.GENERIC;\r\n _this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this._calculatedPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._calculatedRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRollToRef(Math.PI, 0, 0, _this._leftHandSystemQuaternion);\r\n return _this;\r\n }\r\n /**\r\n * @hidden\r\n */\r\n PoseEnabledController.prototype._disableTrackPosition = function (fixedPosition) {\r\n if (this._trackPosition) {\r\n this._calculatedPosition.copyFrom(fixedPosition);\r\n this._trackPosition = false;\r\n }\r\n };\r\n /**\r\n * Updates the state of the pose enbaled controller and mesh based on the current position and rotation of the controller\r\n */\r\n PoseEnabledController.prototype.update = function () {\r\n if (this.isXR) {\r\n return;\r\n }\r\n _super.prototype.update.call(this);\r\n this._updatePoseAndMesh();\r\n };\r\n /**\r\n * Updates only the pose device and mesh without doing any button event checking\r\n */\r\n PoseEnabledController.prototype._updatePoseAndMesh = function () {\r\n if (this.isXR) {\r\n return;\r\n }\r\n var pose = this.browserGamepad.pose;\r\n this.updateFromDevice(pose);\r\n if (!this._trackPosition && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene.activeCamera && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene.activeCamera.devicePosition) {\r\n var camera = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene.activeCamera;\r\n camera._computeDevicePosition();\r\n this._deviceToWorld.setTranslation(camera.devicePosition);\r\n if (camera.deviceRotationQuaternion) {\r\n var camera = camera;\r\n camera._deviceRoomRotationQuaternion.toEulerAnglesToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Vector3[0]);\r\n // Find the radian distance away that the headset is from the controllers rotation\r\n var distanceAway = Math.atan2(Math.sin(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Vector3[0].y - this._draggedRoomRotation), Math.cos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"TmpVectors\"].Vector3[0].y - this._draggedRoomRotation));\r\n if (Math.abs(distanceAway) > this._maxRotationDistFromHeadset) {\r\n // Only rotate enouph to be within the _maxRotationDistFromHeadset\r\n var rotationAmount = distanceAway - (distanceAway < 0 ? -this._maxRotationDistFromHeadset : this._maxRotationDistFromHeadset);\r\n this._draggedRoomRotation += rotationAmount;\r\n // Rotate controller around headset\r\n var sin = Math.sin(-rotationAmount);\r\n var cos = Math.cos(-rotationAmount);\r\n this._calculatedPosition.x = this._calculatedPosition.x * cos - this._calculatedPosition.z * sin;\r\n this._calculatedPosition.z = this._calculatedPosition.x * sin + this._calculatedPosition.z * cos;\r\n }\r\n }\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(this._calculatedPosition, this._deviceToWorld, this.devicePosition);\r\n this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);\r\n this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation);\r\n if (this._mesh) {\r\n this._mesh.position.copyFrom(this.devicePosition);\r\n if (this._mesh.rotationQuaternion) {\r\n this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion);\r\n }\r\n }\r\n };\r\n /**\r\n * Updates the state of the pose enbaled controller based on the raw pose data from the device\r\n * @param poseData raw pose fromthe device\r\n */\r\n PoseEnabledController.prototype.updateFromDevice = function (poseData) {\r\n if (this.isXR) {\r\n return;\r\n }\r\n if (poseData) {\r\n this.rawPose = poseData;\r\n if (poseData.position) {\r\n this._deviceRoomPosition.copyFromFloats(poseData.position[0], poseData.position[1], -poseData.position[2]);\r\n if (this._mesh && this._mesh.getScene().useRightHandedSystem) {\r\n this._deviceRoomPosition.z *= -1;\r\n }\r\n if (this._trackPosition) {\r\n this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor, this._calculatedPosition);\r\n }\r\n this._calculatedPosition.addInPlace(this.position);\r\n }\r\n var pose = this.rawPose;\r\n if (poseData.orientation && pose.orientation && pose.orientation.length === 4) {\r\n this._deviceRoomRotationQuaternion.copyFromFloats(pose.orientation[0], pose.orientation[1], -pose.orientation[2], -pose.orientation[3]);\r\n if (this._mesh) {\r\n if (this._mesh.getScene().useRightHandedSystem) {\r\n this._deviceRoomRotationQuaternion.z *= -1;\r\n this._deviceRoomRotationQuaternion.w *= -1;\r\n }\r\n else {\r\n this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion, this._deviceRoomRotationQuaternion);\r\n }\r\n }\r\n // if the camera is set, rotate to the camera's rotation\r\n this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion, this._calculatedRotation);\r\n }\r\n }\r\n };\r\n /**\r\n * Attaches a mesh to the controller\r\n * @param mesh the mesh to be attached\r\n */\r\n PoseEnabledController.prototype.attachToMesh = function (mesh) {\r\n if (this._mesh) {\r\n this._mesh.parent = null;\r\n }\r\n this._mesh = mesh;\r\n if (this._poseControlledCamera) {\r\n this._mesh.parent = this._poseControlledCamera;\r\n }\r\n if (!this._mesh.rotationQuaternion) {\r\n this._mesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n // Sync controller mesh and pointing pose node's state with controller, this is done to avoid a frame where position is 0,0,0 when attaching mesh\r\n if (!this.isXR) {\r\n this._updatePoseAndMesh();\r\n if (this._pointingPoseNode) {\r\n var parents = [];\r\n var obj = this._pointingPoseNode;\r\n while (obj.parent) {\r\n parents.push(obj.parent);\r\n obj = obj.parent;\r\n }\r\n parents.reverse().forEach(function (p) { p.computeWorldMatrix(true); });\r\n }\r\n }\r\n this._meshAttachedObservable.notifyObservers(mesh);\r\n };\r\n /**\r\n * Attaches the controllers mesh to a camera\r\n * @param camera the camera the mesh should be attached to\r\n */\r\n PoseEnabledController.prototype.attachToPoseControlledCamera = function (camera) {\r\n this._poseControlledCamera = camera;\r\n if (this._mesh) {\r\n this._mesh.parent = this._poseControlledCamera;\r\n }\r\n };\r\n /**\r\n * Disposes of the controller\r\n */\r\n PoseEnabledController.prototype.dispose = function () {\r\n if (this._mesh) {\r\n this._mesh.dispose();\r\n }\r\n this._mesh = null;\r\n _super.prototype.dispose.call(this);\r\n };\r\n Object.defineProperty(PoseEnabledController.prototype, \"mesh\", {\r\n /**\r\n * The mesh that is attached to the controller\r\n */\r\n get: function () {\r\n return this._mesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the ray of the controller in the direction the controller is pointing\r\n * @param length the length the resulting ray should be\r\n * @returns a ray in the direction the controller is pointing\r\n */\r\n PoseEnabledController.prototype.getForwardRay = function (length) {\r\n if (length === void 0) { length = 100; }\r\n if (!this.mesh) {\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, 1), length);\r\n }\r\n var m = this._pointingPoseNode ? this._pointingPoseNode.getWorldMatrix() : this.mesh.getWorldMatrix();\r\n var origin = m.getTranslation();\r\n var forward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 0, -1);\r\n var forwardWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormal(forward, m);\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(forwardWorld);\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_3__[\"Ray\"](origin, direction, length);\r\n };\r\n /**\r\n * Name of the child mesh that can be used to cast a ray from the controller\r\n */\r\n PoseEnabledController.POINTING_POSE = \"POINTING_POSE\";\r\n return PoseEnabledController;\r\n}(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_5__[\"Gamepad\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/viveController.ts\":\n/*!************************************************!*\\\n !*** ./Gamepads/Controllers/viveController.ts ***!\n \\************************************************/\n/*! exports provided: ViveController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return ViveController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Vive Controller\r\n */\r\nvar ViveController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ViveController, _super);\r\n /**\r\n * Creates a new ViveController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function ViveController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_3__[\"PoseEnabledControllerType\"].VIVE;\r\n _this._invertLeftStickY = true;\r\n return _this;\r\n }\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n ViveController.prototype.initControllerMesh = function (scene, meshLoaded) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__[\"SceneLoader\"].ImportMesh(\"\", ViveController.MODEL_BASE_URL, ViveController.MODEL_FILENAME, scene, function (newMeshes) {\r\n /*\r\n Parent Mesh name: ViveWand\r\n - body\r\n - r_gripper\r\n - l_gripper\r\n - menu_button\r\n - system_button\r\n - trackpad\r\n - trigger\r\n - LED\r\n */\r\n _this._defaultModel = newMeshes[1];\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n });\r\n };\r\n Object.defineProperty(ViveController.prototype, \"onLeftButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the left button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onMainButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViveController.prototype, \"onRightButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the right button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onMainButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViveController.prototype, \"onMenuButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the menu button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * Vive mapping:\r\n * 0: touchpad\r\n * 1: trigger\r\n * 2: left AND right buttons\r\n * 3: menu button\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n ViveController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n var notifyObject = state; //{ state: state, changes: changes };\r\n switch (buttonIdx) {\r\n case 0:\r\n this.onPadStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 1: // index trigger\r\n if (this._defaultModel) {\r\n (this._defaultModel.getChildren()[6]).rotation.x = -notifyObject.value * 0.15;\r\n }\r\n this.onTriggerStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 2: // left AND right button\r\n this.onMainButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n case 3:\r\n if (this._defaultModel) {\r\n if (notifyObject.pressed) {\r\n (this._defaultModel.getChildren()[2]).position.y = -0.001;\r\n }\r\n else {\r\n (this._defaultModel.getChildren()[2]).position.y = 0;\r\n }\r\n }\r\n this.onSecondaryButtonStateChangedObservable.notifyObservers(notifyObject);\r\n return;\r\n }\r\n };\r\n /**\r\n * Base Url for the controller model.\r\n */\r\n ViveController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/vive/';\r\n /**\r\n * File name for the controller model.\r\n */\r\n ViveController.MODEL_FILENAME = 'wand.babylon';\r\n return ViveController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_2__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_3__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.toLowerCase().indexOf('openvr') !== -1;\r\n },\r\n create: function (gamepadInfo) {\r\n return new ViveController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/webVRController.ts\":\n/*!*************************************************!*\\\n !*** ./Gamepads/Controllers/webVRController.ts ***!\n \\*************************************************/\n/*! exports provided: WebVRController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return WebVRController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n/**\r\n * Defines the WebVRController object that represents controllers tracked in 3D space\r\n */\r\nvar WebVRController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebVRController, _super);\r\n /**\r\n * Creates a new WebVRController from a gamepad\r\n * @param vrGamepad the gamepad that the WebVRController should be created from\r\n */\r\n function WebVRController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n // Observables\r\n /**\r\n * Fired when the trigger state has changed\r\n */\r\n _this.onTriggerStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the main button state has changed\r\n */\r\n _this.onMainButtonStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the secondary button state has changed\r\n */\r\n _this.onSecondaryButtonStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when the pad state has changed\r\n */\r\n _this.onPadStateChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when controllers stick values have changed\r\n */\r\n _this.onPadValuesChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * X and Y axis corresponding to the controllers joystick\r\n */\r\n _this.pad = { x: 0, y: 0 };\r\n // avoid GC, store state in a tmp object\r\n _this._changes = {\r\n pressChanged: false,\r\n touchChanged: false,\r\n valueChanged: false,\r\n changed: false\r\n };\r\n _this._buttons = new Array(vrGamepad.buttons.length);\r\n _this.hand = vrGamepad.hand;\r\n return _this;\r\n }\r\n /**\r\n * Fired when a controller button's state has changed\r\n * @param callback the callback containing the button that was modified\r\n */\r\n WebVRController.prototype.onButtonStateChange = function (callback) {\r\n this._onButtonStateChange = callback;\r\n };\r\n Object.defineProperty(WebVRController.prototype, \"defaultModel\", {\r\n /**\r\n * The default controller model for the controller\r\n */\r\n get: function () {\r\n return this._defaultModel;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the state of the controller and mesh based on the current position and rotation of the controller\r\n */\r\n WebVRController.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n for (var index = 0; index < this._buttons.length; index++) {\r\n this._setButtonValue(this.browserGamepad.buttons[index], this._buttons[index], index);\r\n }\r\n if (this.leftStick.x !== this.pad.x || this.leftStick.y !== this.pad.y) {\r\n this.pad.x = this.leftStick.x;\r\n this.pad.y = this.leftStick.y;\r\n this.onPadValuesChangedObservable.notifyObservers(this.pad);\r\n }\r\n };\r\n WebVRController.prototype._setButtonValue = function (newState, currentState, buttonIndex) {\r\n if (!newState) {\r\n newState = {\r\n pressed: false,\r\n touched: false,\r\n value: 0\r\n };\r\n }\r\n if (!currentState) {\r\n this._buttons[buttonIndex] = {\r\n pressed: newState.pressed,\r\n touched: newState.touched,\r\n value: newState.value\r\n };\r\n return;\r\n }\r\n this._checkChanges(newState, currentState);\r\n if (this._changes.changed) {\r\n this._onButtonStateChange && this._onButtonStateChange(this.index, buttonIndex, newState);\r\n this._handleButtonChange(buttonIndex, newState, this._changes);\r\n }\r\n this._buttons[buttonIndex].pressed = newState.pressed;\r\n this._buttons[buttonIndex].touched = newState.touched;\r\n // oculus triggers are never 0, thou not touched.\r\n this._buttons[buttonIndex].value = newState.value < 0.00000001 ? 0 : newState.value;\r\n };\r\n WebVRController.prototype._checkChanges = function (newState, currentState) {\r\n this._changes.pressChanged = newState.pressed !== currentState.pressed;\r\n this._changes.touchChanged = newState.touched !== currentState.touched;\r\n this._changes.valueChanged = newState.value !== currentState.value;\r\n this._changes.changed = this._changes.pressChanged || this._changes.touchChanged || this._changes.valueChanged;\r\n return this._changes;\r\n };\r\n /**\r\n * Disposes of th webVRCOntroller\r\n */\r\n WebVRController.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onTriggerStateChangedObservable.clear();\r\n this.onMainButtonStateChangedObservable.clear();\r\n this.onSecondaryButtonStateChangedObservable.clear();\r\n this.onPadStateChangedObservable.clear();\r\n this.onPadValuesChangedObservable.clear();\r\n };\r\n return WebVRController;\r\n}(_poseEnabledController__WEBPACK_IMPORTED_MODULE_2__[\"PoseEnabledController\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/Controllers/windowsMotionController.ts\":\n/*!*********************************************************!*\\\n !*** ./Gamepads/Controllers/windowsMotionController.ts ***!\n \\*********************************************************/\n/*! exports provided: WindowsMotionController */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return WindowsMotionController; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _webVRController__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./webVRController */ \"./Gamepads/Controllers/webVRController.ts\");\n/* harmony import */ var _genericController__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./genericController */ \"./Gamepads/Controllers/genericController.ts\");\n/* harmony import */ var _poseEnabledController__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines the LoadedMeshInfo object that describes information about the loaded webVR controller mesh\r\n */\r\nvar LoadedMeshInfo = /** @class */ (function () {\r\n function LoadedMeshInfo() {\r\n /**\r\n * Map of the button meshes contained in the controller\r\n */\r\n this.buttonMeshes = {};\r\n /**\r\n * Map of the axis meshes contained in the controller\r\n */\r\n this.axisMeshes = {};\r\n }\r\n return LoadedMeshInfo;\r\n}());\r\n/**\r\n * Defines the WindowsMotionController object that the state of the windows motion controller\r\n */\r\nvar WindowsMotionController = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WindowsMotionController, _super);\r\n /**\r\n * Creates a new WindowsMotionController from a gamepad\r\n * @param vrGamepad the gamepad that the controller should be created from\r\n */\r\n function WindowsMotionController(vrGamepad) {\r\n var _this = _super.call(this, vrGamepad) || this;\r\n _this._mapping = {\r\n // Semantic button names\r\n buttons: ['thumbstick', 'trigger', 'grip', 'menu', 'trackpad'],\r\n // A mapping of the button name to glTF model node name\r\n // that should be transformed by button value.\r\n buttonMeshNames: {\r\n 'trigger': 'SELECT',\r\n 'menu': 'MENU',\r\n 'grip': 'GRASP',\r\n 'thumbstick': 'THUMBSTICK_PRESS',\r\n 'trackpad': 'TOUCHPAD_PRESS'\r\n },\r\n // This mapping is used to translate from the Motion Controller to Babylon semantics\r\n buttonObservableNames: {\r\n 'trigger': 'onTriggerStateChangedObservable',\r\n 'menu': 'onSecondaryButtonStateChangedObservable',\r\n 'grip': 'onMainButtonStateChangedObservable',\r\n 'thumbstick': 'onPadStateChangedObservable',\r\n 'trackpad': 'onTrackpadChangedObservable'\r\n },\r\n // A mapping of the axis name to glTF model node name\r\n // that should be transformed by axis value.\r\n // This array mirrors the browserGamepad.axes array, such that\r\n // the mesh corresponding to axis 0 is in this array index 0.\r\n axisMeshNames: [\r\n 'THUMBSTICK_X',\r\n 'THUMBSTICK_Y',\r\n 'TOUCHPAD_TOUCH_X',\r\n 'TOUCHPAD_TOUCH_Y'\r\n ],\r\n pointingPoseMeshName: _poseEnabledController__WEBPACK_IMPORTED_MODULE_9__[\"PoseEnabledController\"].POINTING_POSE\r\n };\r\n /**\r\n * Fired when the trackpad on this controller is clicked\r\n */\r\n _this.onTrackpadChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Fired when the trackpad on this controller is modified\r\n */\r\n _this.onTrackpadValuesChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * The current x and y values of this controller's trackpad\r\n */\r\n _this.trackpad = { x: 0, y: 0 };\r\n _this.controllerType = _poseEnabledController__WEBPACK_IMPORTED_MODULE_9__[\"PoseEnabledControllerType\"].WINDOWS;\r\n _this._loadedMeshInfo = null;\r\n return _this;\r\n }\r\n Object.defineProperty(WindowsMotionController.prototype, \"onTriggerButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the trigger on this controller is modified\r\n */\r\n get: function () {\r\n return this.onTriggerStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onMenuButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the menu button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onSecondaryButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onGripButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the grip button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onMainButtonStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onThumbstickButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the thumbstick button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onPadStateChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onTouchpadButtonStateChangedObservable\", {\r\n /**\r\n * Fired when the touchpad button on this controller is modified\r\n */\r\n get: function () {\r\n return this.onTrackpadChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WindowsMotionController.prototype, \"onTouchpadValuesChangedObservable\", {\r\n /**\r\n * Fired when the touchpad values on this controller are modified\r\n */\r\n get: function () {\r\n return this.onTrackpadValuesChangedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WindowsMotionController.prototype._updateTrackpad = function () {\r\n if (this.browserGamepad.axes && (this.browserGamepad.axes[2] != this.trackpad.x || this.browserGamepad.axes[3] != this.trackpad.y)) {\r\n this.trackpad.x = this.browserGamepad[\"axes\"][2];\r\n this.trackpad.y = this.browserGamepad[\"axes\"][3];\r\n this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad);\r\n }\r\n };\r\n /**\r\n * Called once per frame by the engine.\r\n */\r\n WindowsMotionController.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n if (this.browserGamepad.axes) {\r\n this._updateTrackpad();\r\n // Only need to animate axes if there is a loaded mesh\r\n if (this._loadedMeshInfo) {\r\n for (var axis = 0; axis < this._mapping.axisMeshNames.length; axis++) {\r\n this._lerpAxisTransform(axis, this.browserGamepad.axes[axis]);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Called once for each button that changed state since the last frame\r\n * @param buttonIdx Which button index changed\r\n * @param state New state of the button\r\n * @param changes Which properties on the state changed since last frame\r\n */\r\n WindowsMotionController.prototype._handleButtonChange = function (buttonIdx, state, changes) {\r\n var buttonName = this._mapping.buttons[buttonIdx];\r\n if (!buttonName) {\r\n return;\r\n }\r\n // Update the trackpad to ensure trackpad.x/y are accurate during button events between frames\r\n this._updateTrackpad();\r\n // Only emit events for buttons that we know how to map from index to name\r\n var observable = this[(this._mapping.buttonObservableNames)[buttonName]];\r\n if (observable) {\r\n observable.notifyObservers(state);\r\n }\r\n this._lerpButtonTransform(buttonName, state.value);\r\n };\r\n /**\r\n * Moves the buttons on the controller mesh based on their current state\r\n * @param buttonName the name of the button to move\r\n * @param buttonValue the value of the button which determines the buttons new position\r\n */\r\n WindowsMotionController.prototype._lerpButtonTransform = function (buttonName, buttonValue) {\r\n // If there is no loaded mesh, there is nothing to transform.\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n var meshInfo = this._loadedMeshInfo.buttonMeshes[buttonName];\r\n if (!meshInfo.unpressed.rotationQuaternion || !meshInfo.pressed.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].SlerpToRef(meshInfo.unpressed.rotationQuaternion, meshInfo.pressed.rotationQuaternion, buttonValue, meshInfo.value.rotationQuaternion);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].LerpToRef(meshInfo.unpressed.position, meshInfo.pressed.position, buttonValue, meshInfo.value.position);\r\n };\r\n /**\r\n * Moves the axis on the controller mesh based on its current state\r\n * @param axis the index of the axis\r\n * @param axisValue the value of the axis which determines the meshes new position\r\n * @hidden\r\n */\r\n WindowsMotionController.prototype._lerpAxisTransform = function (axis, axisValue) {\r\n if (!this._loadedMeshInfo) {\r\n return;\r\n }\r\n var meshInfo = this._loadedMeshInfo.axisMeshes[axis];\r\n if (!meshInfo) {\r\n return;\r\n }\r\n if (!meshInfo.min.rotationQuaternion || !meshInfo.max.rotationQuaternion || !meshInfo.value.rotationQuaternion) {\r\n return;\r\n }\r\n // Convert from gamepad value range (-1 to +1) to lerp range (0 to 1)\r\n var lerpValue = axisValue * 0.5 + 0.5;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].SlerpToRef(meshInfo.min.rotationQuaternion, meshInfo.max.rotationQuaternion, lerpValue, meshInfo.value.rotationQuaternion);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].LerpToRef(meshInfo.min.position, meshInfo.max.position, lerpValue, meshInfo.value.position);\r\n };\r\n /**\r\n * Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.\r\n * @param scene scene in which to add meshes\r\n * @param meshLoaded optional callback function that will be called if the mesh loads successfully.\r\n */\r\n WindowsMotionController.prototype.initControllerMesh = function (scene, meshLoaded, forceDefault) {\r\n var _this = this;\r\n if (forceDefault === void 0) { forceDefault = false; }\r\n var path;\r\n var filename;\r\n // Checking if GLB loader is present\r\n if (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_6__[\"SceneLoader\"].IsPluginForExtensionAvailable(\".glb\")) {\r\n // Determine the device specific folder based on the ID suffix\r\n var device = 'default';\r\n if (this.id && !forceDefault) {\r\n var match = this.id.match(WindowsMotionController.GAMEPAD_ID_PATTERN);\r\n device = ((match && match[0]) || device);\r\n }\r\n // Hand\r\n if (this.hand === 'left') {\r\n filename = WindowsMotionController.MODEL_LEFT_FILENAME;\r\n }\r\n else { // Right is the default if no hand is specified\r\n filename = WindowsMotionController.MODEL_RIGHT_FILENAME;\r\n }\r\n path = WindowsMotionController.MODEL_BASE_URL + device + '/';\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models\");\r\n path = _genericController__WEBPACK_IMPORTED_MODULE_8__[\"GenericController\"].MODEL_BASE_URL;\r\n filename = _genericController__WEBPACK_IMPORTED_MODULE_8__[\"GenericController\"].MODEL_FILENAME;\r\n }\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_6__[\"SceneLoader\"].ImportMesh(\"\", path, filename, scene, function (meshes) {\r\n // glTF files successfully loaded from the remote server, now process them to ensure they are in the right format.\r\n _this._loadedMeshInfo = _this.processModel(scene, meshes);\r\n if (!_this._loadedMeshInfo) {\r\n return;\r\n }\r\n _this._defaultModel = _this._loadedMeshInfo.rootNode;\r\n _this.attachToMesh(_this._defaultModel);\r\n if (meshLoaded) {\r\n meshLoaded(_this._defaultModel);\r\n }\r\n }, null, function (scene, message) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log(message);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Failed to retrieve controller model from the remote server: ' + path + filename);\r\n if (!forceDefault) {\r\n _this.initControllerMesh(scene, meshLoaded, true);\r\n }\r\n });\r\n };\r\n /**\r\n * Takes a list of meshes (as loaded from the glTF file) and finds the root node, as well as nodes that\r\n * can be transformed by button presses and axes values, based on this._mapping.\r\n *\r\n * @param scene scene in which the meshes exist\r\n * @param meshes list of meshes that make up the controller model to process\r\n * @return structured view of the given meshes, with mapping of buttons and axes to meshes that can be transformed.\r\n */\r\n WindowsMotionController.prototype.processModel = function (scene, meshes) {\r\n var loadedMeshInfo = null;\r\n // Create a new mesh to contain the glTF hierarchy\r\n var parentMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](this.id + \" \" + this.hand, scene);\r\n // Find the root node in the loaded glTF scene, and attach it as a child of 'parentMesh'\r\n var childMesh = null;\r\n for (var i = 0; i < meshes.length; i++) {\r\n var mesh = meshes[i];\r\n if (!mesh.parent) {\r\n // Exclude controller meshes from picking results\r\n mesh.isPickable = false;\r\n // Handle root node, attach to the new parentMesh\r\n childMesh = mesh;\r\n break;\r\n }\r\n }\r\n if (childMesh) {\r\n childMesh.setParent(parentMesh);\r\n // Create our mesh info. Note that this method will always return non-null.\r\n loadedMeshInfo = this.createMeshInfo(parentMesh);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Could not find root node in model file.');\r\n }\r\n return loadedMeshInfo;\r\n };\r\n WindowsMotionController.prototype.createMeshInfo = function (rootNode) {\r\n var loadedMeshInfo = new LoadedMeshInfo();\r\n var i;\r\n loadedMeshInfo.rootNode = rootNode;\r\n // Reset the caches\r\n loadedMeshInfo.buttonMeshes = {};\r\n loadedMeshInfo.axisMeshes = {};\r\n // Button Meshes\r\n for (i = 0; i < this._mapping.buttons.length; i++) {\r\n var buttonMeshName = this._mapping.buttonMeshNames[this._mapping.buttons[i]];\r\n if (!buttonMeshName) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log('Skipping unknown button at index: ' + i + ' with mapped name: ' + this._mapping.buttons[i]);\r\n continue;\r\n }\r\n var buttonMesh = getChildByName(rootNode, buttonMeshName);\r\n if (!buttonMesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing button mesh with name: ' + buttonMeshName);\r\n continue;\r\n }\r\n var buttonMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(buttonMesh, 'VALUE'),\r\n pressed: getImmediateChildByName(buttonMesh, 'PRESSED'),\r\n unpressed: getImmediateChildByName(buttonMesh, 'UNPRESSED')\r\n };\r\n if (buttonMeshInfo.value && buttonMeshInfo.pressed && buttonMeshInfo.unpressed) {\r\n loadedMeshInfo.buttonMeshes[this._mapping.buttons[i]] = buttonMeshInfo;\r\n }\r\n else {\r\n // If we didn't find the mesh, it simply means this button won't have transforms applied as mapped button value changes.\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing button submesh under mesh with name: ' + buttonMeshName +\r\n '(VALUE: ' + !!buttonMeshInfo.value +\r\n ', PRESSED: ' + !!buttonMeshInfo.pressed +\r\n ', UNPRESSED:' + !!buttonMeshInfo.unpressed +\r\n ')');\r\n }\r\n }\r\n // Axis Meshes\r\n for (i = 0; i < this._mapping.axisMeshNames.length; i++) {\r\n var axisMeshName = this._mapping.axisMeshNames[i];\r\n if (!axisMeshName) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log('Skipping unknown axis at index: ' + i);\r\n continue;\r\n }\r\n var axisMesh = getChildByName(rootNode, axisMeshName);\r\n if (!axisMesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing axis mesh with name: ' + axisMeshName);\r\n continue;\r\n }\r\n var axisMeshInfo = {\r\n index: i,\r\n value: getImmediateChildByName(axisMesh, 'VALUE'),\r\n min: getImmediateChildByName(axisMesh, 'MIN'),\r\n max: getImmediateChildByName(axisMesh, 'MAX')\r\n };\r\n if (axisMeshInfo.value && axisMeshInfo.min && axisMeshInfo.max) {\r\n loadedMeshInfo.axisMeshes[i] = axisMeshInfo;\r\n }\r\n else {\r\n // If we didn't find the mesh, it simply means thit axis won't have transforms applied as mapped axis values change.\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing axis submesh under mesh with name: ' + axisMeshName +\r\n '(VALUE: ' + !!axisMeshInfo.value +\r\n ', MIN: ' + !!axisMeshInfo.min +\r\n ', MAX:' + !!axisMeshInfo.max +\r\n ')');\r\n }\r\n }\r\n // Pointing Ray\r\n loadedMeshInfo.pointingPoseNode = getChildByName(rootNode, this._mapping.pointingPoseMeshName);\r\n if (!loadedMeshInfo.pointingPoseNode) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Missing pointing pose mesh with name: ' + this._mapping.pointingPoseMeshName);\r\n }\r\n else {\r\n this._pointingPoseNode = loadedMeshInfo.pointingPoseNode;\r\n }\r\n return loadedMeshInfo;\r\n // Look through all children recursively. This will return null if no mesh exists with the given name.\r\n function getChildByName(node, name) {\r\n return node.getChildren(function (n) { return n.name === name; }, false)[0];\r\n }\r\n // Look through only immediate children. This will return null if no mesh exists with the given name.\r\n function getImmediateChildByName(node, name) {\r\n return node.getChildren(function (n) { return n.name == name; }, true)[0];\r\n }\r\n };\r\n /**\r\n * Gets the ray of the controller in the direction the controller is pointing\r\n * @param length the length the resulting ray should be\r\n * @returns a ray in the direction the controller is pointing\r\n */\r\n WindowsMotionController.prototype.getForwardRay = function (length) {\r\n if (length === void 0) { length = 100; }\r\n if (!(this._loadedMeshInfo && this._loadedMeshInfo.pointingPoseNode)) {\r\n return _super.prototype.getForwardRay.call(this, length);\r\n }\r\n var m = this._loadedMeshInfo.pointingPoseNode.getWorldMatrix();\r\n var origin = m.getTranslation();\r\n var forward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, -1);\r\n var forwardWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(forward, m);\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(forwardWorld);\r\n return new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](origin, direction, length);\r\n };\r\n /**\r\n * Disposes of the controller\r\n */\r\n WindowsMotionController.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onTrackpadChangedObservable.clear();\r\n };\r\n /**\r\n * The base url used to load the left and right controller models\r\n */\r\n WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/microsoft/';\r\n /**\r\n * The name of the left controller model file\r\n */\r\n WindowsMotionController.MODEL_LEFT_FILENAME = 'left.glb';\r\n /**\r\n * The name of the right controller model file\r\n */\r\n WindowsMotionController.MODEL_RIGHT_FILENAME = 'right.glb';\r\n /**\r\n * The controller name prefix for this controller type\r\n */\r\n WindowsMotionController.GAMEPAD_ID_PREFIX = 'Spatial Controller (Spatial Interaction Source) ';\r\n /**\r\n * The controller id pattern for this controller type\r\n */\r\n WindowsMotionController.GAMEPAD_ID_PATTERN = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/;\r\n return WindowsMotionController;\r\n}(_webVRController__WEBPACK_IMPORTED_MODULE_7__[\"WebVRController\"]));\r\n\r\n_poseEnabledController__WEBPACK_IMPORTED_MODULE_9__[\"PoseEnabledControllerHelper\"]._ControllerFactories.push({\r\n canCreate: function (gamepadInfo) {\r\n return gamepadInfo.id.indexOf(WindowsMotionController.GAMEPAD_ID_PREFIX) === 0;\r\n },\r\n create: function (gamepadInfo) {\r\n return new WindowsMotionController(gamepadInfo);\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/dualShockGamepad.ts\":\n/*!**************************************!*\\\n !*** ./Gamepads/dualShockGamepad.ts ***!\n \\**************************************/\n/*! exports provided: DualShockButton, DualShockDpad, DualShockPad */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return DualShockButton; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return DualShockDpad; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return DualShockPad; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _gamepad__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n/**\r\n * Defines supported buttons for DualShock compatible gamepads\r\n */\r\nvar DualShockButton;\r\n(function (DualShockButton) {\r\n /** Cross */\r\n DualShockButton[DualShockButton[\"Cross\"] = 0] = \"Cross\";\r\n /** Circle */\r\n DualShockButton[DualShockButton[\"Circle\"] = 1] = \"Circle\";\r\n /** Square */\r\n DualShockButton[DualShockButton[\"Square\"] = 2] = \"Square\";\r\n /** Triangle */\r\n DualShockButton[DualShockButton[\"Triangle\"] = 3] = \"Triangle\";\r\n /** Options */\r\n DualShockButton[DualShockButton[\"Options\"] = 4] = \"Options\";\r\n /** Share */\r\n DualShockButton[DualShockButton[\"Share\"] = 5] = \"Share\";\r\n /** L1 */\r\n DualShockButton[DualShockButton[\"L1\"] = 6] = \"L1\";\r\n /** R1 */\r\n DualShockButton[DualShockButton[\"R1\"] = 7] = \"R1\";\r\n /** Left stick */\r\n DualShockButton[DualShockButton[\"LeftStick\"] = 8] = \"LeftStick\";\r\n /** Right stick */\r\n DualShockButton[DualShockButton[\"RightStick\"] = 9] = \"RightStick\";\r\n})(DualShockButton || (DualShockButton = {}));\r\n/** Defines values for DualShock DPad */\r\nvar DualShockDpad;\r\n(function (DualShockDpad) {\r\n /** Up */\r\n DualShockDpad[DualShockDpad[\"Up\"] = 0] = \"Up\";\r\n /** Down */\r\n DualShockDpad[DualShockDpad[\"Down\"] = 1] = \"Down\";\r\n /** Left */\r\n DualShockDpad[DualShockDpad[\"Left\"] = 2] = \"Left\";\r\n /** Right */\r\n DualShockDpad[DualShockDpad[\"Right\"] = 3] = \"Right\";\r\n})(DualShockDpad || (DualShockDpad = {}));\r\n/**\r\n * Defines a DualShock gamepad\r\n */\r\nvar DualShockPad = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DualShockPad, _super);\r\n /**\r\n * Creates a new DualShock gamepad object\r\n * @param id defines the id of this gamepad\r\n * @param index defines its index\r\n * @param gamepad defines the internal HTML gamepad object\r\n */\r\n function DualShockPad(id, index, gamepad) {\r\n var _this = _super.call(this, id.replace(\"STANDARD GAMEPAD\", \"SONY PLAYSTATION DUALSHOCK\"), index, gamepad, 0, 1, 2, 3) || this;\r\n _this._leftTrigger = 0;\r\n _this._rightTrigger = 0;\r\n /** Observable raised when a button is pressed */\r\n _this.onButtonDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a button is released */\r\n _this.onButtonUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is pressed */\r\n _this.onPadDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is released */\r\n _this.onPadUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._buttonCross = 0;\r\n _this._buttonCircle = 0;\r\n _this._buttonSquare = 0;\r\n _this._buttonTriangle = 0;\r\n _this._buttonShare = 0;\r\n _this._buttonOptions = 0;\r\n _this._buttonL1 = 0;\r\n _this._buttonR1 = 0;\r\n _this._buttonLeftStick = 0;\r\n _this._buttonRightStick = 0;\r\n _this._dPadUp = 0;\r\n _this._dPadDown = 0;\r\n _this._dPadLeft = 0;\r\n _this._dPadRight = 0;\r\n _this.type = _gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"].DUALSHOCK;\r\n return _this;\r\n }\r\n /**\r\n * Defines the callback to call when left trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onlefttriggerchanged = function (callback) {\r\n this._onlefttriggerchanged = callback;\r\n };\r\n /**\r\n * Defines the callback to call when right trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onrighttriggerchanged = function (callback) {\r\n this._onrighttriggerchanged = callback;\r\n };\r\n Object.defineProperty(DualShockPad.prototype, \"leftTrigger\", {\r\n /**\r\n * Gets the left trigger value\r\n */\r\n get: function () {\r\n return this._leftTrigger;\r\n },\r\n /**\r\n * Sets the left trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onlefttriggerchanged && this._leftTrigger !== newValue) {\r\n this._onlefttriggerchanged(newValue);\r\n }\r\n this._leftTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"rightTrigger\", {\r\n /**\r\n * Gets the right trigger value\r\n */\r\n get: function () {\r\n return this._rightTrigger;\r\n },\r\n /**\r\n * Sets the right trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onrighttriggerchanged && this._rightTrigger !== newValue) {\r\n this._onrighttriggerchanged(newValue);\r\n }\r\n this._rightTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Defines the callback to call when a button is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onbuttondown = function (callback) {\r\n this._onbuttondown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a button is released\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.onbuttonup = function (callback) {\r\n this._onbuttonup = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is pressed\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.ondpaddown = function (callback) {\r\n this._ondpaddown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is released\r\n * @param callback defines the callback to use\r\n */\r\n DualShockPad.prototype.ondpadup = function (callback) {\r\n this._ondpadup = callback;\r\n };\r\n DualShockPad.prototype._setButtonValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._onbuttondown) {\r\n this._onbuttondown(buttonType);\r\n }\r\n this.onButtonDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._onbuttonup) {\r\n this._onbuttonup(buttonType);\r\n }\r\n this.onButtonUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n DualShockPad.prototype._setDPadValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._ondpaddown) {\r\n this._ondpaddown(buttonType);\r\n }\r\n this.onPadDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._ondpadup) {\r\n this._ondpadup(buttonType);\r\n }\r\n this.onPadUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n Object.defineProperty(DualShockPad.prototype, \"buttonCross\", {\r\n /**\r\n * Gets the value of the `Cross` button\r\n */\r\n get: function () {\r\n return this._buttonCross;\r\n },\r\n /**\r\n * Sets the value of the `Cross` button\r\n */\r\n set: function (value) {\r\n this._buttonCross = this._setButtonValue(value, this._buttonCross, DualShockButton.Cross);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonCircle\", {\r\n /**\r\n * Gets the value of the `Circle` button\r\n */\r\n get: function () {\r\n return this._buttonCircle;\r\n },\r\n /**\r\n * Sets the value of the `Circle` button\r\n */\r\n set: function (value) {\r\n this._buttonCircle = this._setButtonValue(value, this._buttonCircle, DualShockButton.Circle);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonSquare\", {\r\n /**\r\n * Gets the value of the `Square` button\r\n */\r\n get: function () {\r\n return this._buttonSquare;\r\n },\r\n /**\r\n * Sets the value of the `Square` button\r\n */\r\n set: function (value) {\r\n this._buttonSquare = this._setButtonValue(value, this._buttonSquare, DualShockButton.Square);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonTriangle\", {\r\n /**\r\n * Gets the value of the `Triangle` button\r\n */\r\n get: function () {\r\n return this._buttonTriangle;\r\n },\r\n /**\r\n * Sets the value of the `Triangle` button\r\n */\r\n set: function (value) {\r\n this._buttonTriangle = this._setButtonValue(value, this._buttonTriangle, DualShockButton.Triangle);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonOptions\", {\r\n /**\r\n * Gets the value of the `Options` button\r\n */\r\n get: function () {\r\n return this._buttonOptions;\r\n },\r\n /**\r\n * Sets the value of the `Options` button\r\n */\r\n set: function (value) {\r\n this._buttonOptions = this._setButtonValue(value, this._buttonOptions, DualShockButton.Options);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonShare\", {\r\n /**\r\n * Gets the value of the `Share` button\r\n */\r\n get: function () {\r\n return this._buttonShare;\r\n },\r\n /**\r\n * Sets the value of the `Share` button\r\n */\r\n set: function (value) {\r\n this._buttonShare = this._setButtonValue(value, this._buttonShare, DualShockButton.Share);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonL1\", {\r\n /**\r\n * Gets the value of the `L1` button\r\n */\r\n get: function () {\r\n return this._buttonL1;\r\n },\r\n /**\r\n * Sets the value of the `L1` button\r\n */\r\n set: function (value) {\r\n this._buttonL1 = this._setButtonValue(value, this._buttonL1, DualShockButton.L1);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonR1\", {\r\n /**\r\n * Gets the value of the `R1` button\r\n */\r\n get: function () {\r\n return this._buttonR1;\r\n },\r\n /**\r\n * Sets the value of the `R1` button\r\n */\r\n set: function (value) {\r\n this._buttonR1 = this._setButtonValue(value, this._buttonR1, DualShockButton.R1);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonLeftStick\", {\r\n /**\r\n * Gets the value of the Left joystick\r\n */\r\n get: function () {\r\n return this._buttonLeftStick;\r\n },\r\n /**\r\n * Sets the value of the Left joystick\r\n */\r\n set: function (value) {\r\n this._buttonLeftStick = this._setButtonValue(value, this._buttonLeftStick, DualShockButton.LeftStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"buttonRightStick\", {\r\n /**\r\n * Gets the value of the Right joystick\r\n */\r\n get: function () {\r\n return this._buttonRightStick;\r\n },\r\n /**\r\n * Sets the value of the Right joystick\r\n */\r\n set: function (value) {\r\n this._buttonRightStick = this._setButtonValue(value, this._buttonRightStick, DualShockButton.RightStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadUp\", {\r\n /**\r\n * Gets the value of D-pad up\r\n */\r\n get: function () {\r\n return this._dPadUp;\r\n },\r\n /**\r\n * Sets the value of D-pad up\r\n */\r\n set: function (value) {\r\n this._dPadUp = this._setDPadValue(value, this._dPadUp, DualShockDpad.Up);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadDown\", {\r\n /**\r\n * Gets the value of D-pad down\r\n */\r\n get: function () {\r\n return this._dPadDown;\r\n },\r\n /**\r\n * Sets the value of D-pad down\r\n */\r\n set: function (value) {\r\n this._dPadDown = this._setDPadValue(value, this._dPadDown, DualShockDpad.Down);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadLeft\", {\r\n /**\r\n * Gets the value of D-pad left\r\n */\r\n get: function () {\r\n return this._dPadLeft;\r\n },\r\n /**\r\n * Sets the value of D-pad left\r\n */\r\n set: function (value) {\r\n this._dPadLeft = this._setDPadValue(value, this._dPadLeft, DualShockDpad.Left);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DualShockPad.prototype, \"dPadRight\", {\r\n /**\r\n * Gets the value of D-pad right\r\n */\r\n get: function () {\r\n return this._dPadRight;\r\n },\r\n /**\r\n * Sets the value of D-pad right\r\n */\r\n set: function (value) {\r\n this._dPadRight = this._setDPadValue(value, this._dPadRight, DualShockDpad.Right);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Force the gamepad to synchronize with device values\r\n */\r\n DualShockPad.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n this.buttonCross = this.browserGamepad.buttons[0].value;\r\n this.buttonCircle = this.browserGamepad.buttons[1].value;\r\n this.buttonSquare = this.browserGamepad.buttons[2].value;\r\n this.buttonTriangle = this.browserGamepad.buttons[3].value;\r\n this.buttonL1 = this.browserGamepad.buttons[4].value;\r\n this.buttonR1 = this.browserGamepad.buttons[5].value;\r\n this.leftTrigger = this.browserGamepad.buttons[6].value;\r\n this.rightTrigger = this.browserGamepad.buttons[7].value;\r\n this.buttonShare = this.browserGamepad.buttons[8].value;\r\n this.buttonOptions = this.browserGamepad.buttons[9].value;\r\n this.buttonLeftStick = this.browserGamepad.buttons[10].value;\r\n this.buttonRightStick = this.browserGamepad.buttons[11].value;\r\n this.dPadUp = this.browserGamepad.buttons[12].value;\r\n this.dPadDown = this.browserGamepad.buttons[13].value;\r\n this.dPadLeft = this.browserGamepad.buttons[14].value;\r\n this.dPadRight = this.browserGamepad.buttons[15].value;\r\n };\r\n /**\r\n * Disposes the gamepad\r\n */\r\n DualShockPad.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onButtonDownObservable.clear();\r\n this.onButtonUpObservable.clear();\r\n this.onPadDownObservable.clear();\r\n this.onPadUpObservable.clear();\r\n };\r\n return DualShockPad;\r\n}(_gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/gamepad.ts\":\n/*!*****************************!*\\\n !*** ./Gamepads/gamepad.ts ***!\n \\*****************************/\n/*! exports provided: StickValues, Gamepad, GenericPad */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return StickValues; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return Gamepad; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return GenericPad; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n\r\n\r\n/**\r\n * Represents a gamepad control stick position\r\n */\r\nvar StickValues = /** @class */ (function () {\r\n /**\r\n * Initializes the gamepad x and y control stick values\r\n * @param x The x component of the gamepad control stick value\r\n * @param y The y component of the gamepad control stick value\r\n */\r\n function StickValues(\r\n /**\r\n * The x component of the control stick\r\n */\r\n x, \r\n /**\r\n * The y component of the control stick\r\n */\r\n y) {\r\n this.x = x;\r\n this.y = y;\r\n }\r\n return StickValues;\r\n}());\r\n\r\n/**\r\n * Represents a gamepad\r\n */\r\nvar Gamepad = /** @class */ (function () {\r\n /**\r\n * Initializes the gamepad\r\n * @param id The id of the gamepad\r\n * @param index The index of the gamepad\r\n * @param browserGamepad The browser gamepad\r\n * @param leftStickX The x component of the left joystick\r\n * @param leftStickY The y component of the left joystick\r\n * @param rightStickX The x component of the right joystick\r\n * @param rightStickY The y component of the right joystick\r\n */\r\n function Gamepad(\r\n /**\r\n * The id of the gamepad\r\n */\r\n id, \r\n /**\r\n * The index of the gamepad\r\n */\r\n index, \r\n /**\r\n * The browser gamepad\r\n */\r\n browserGamepad, leftStickX, leftStickY, rightStickX, rightStickY) {\r\n if (leftStickX === void 0) { leftStickX = 0; }\r\n if (leftStickY === void 0) { leftStickY = 1; }\r\n if (rightStickX === void 0) { rightStickX = 2; }\r\n if (rightStickY === void 0) { rightStickY = 3; }\r\n this.id = id;\r\n this.index = index;\r\n this.browserGamepad = browserGamepad;\r\n this._leftStick = { x: 0, y: 0 };\r\n this._rightStick = { x: 0, y: 0 };\r\n /** @hidden */\r\n this._isConnected = true;\r\n /**\r\n * Specifies whether the left control stick should be Y-inverted\r\n */\r\n this._invertLeftStickY = false;\r\n this.type = Gamepad.GAMEPAD;\r\n this._leftStickAxisX = leftStickX;\r\n this._leftStickAxisY = leftStickY;\r\n this._rightStickAxisX = rightStickX;\r\n this._rightStickAxisY = rightStickY;\r\n if (this.browserGamepad.axes.length >= 2) {\r\n this._leftStick = { x: this.browserGamepad.axes[this._leftStickAxisX], y: this.browserGamepad.axes[this._leftStickAxisY] };\r\n }\r\n if (this.browserGamepad.axes.length >= 4) {\r\n this._rightStick = { x: this.browserGamepad.axes[this._rightStickAxisX], y: this.browserGamepad.axes[this._rightStickAxisY] };\r\n }\r\n }\r\n Object.defineProperty(Gamepad.prototype, \"isConnected\", {\r\n /**\r\n * Specifies if the gamepad has been connected\r\n */\r\n get: function () {\r\n return this._isConnected;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Callback triggered when the left joystick has changed\r\n * @param callback\r\n */\r\n Gamepad.prototype.onleftstickchanged = function (callback) {\r\n this._onleftstickchanged = callback;\r\n };\r\n /**\r\n * Callback triggered when the right joystick has changed\r\n * @param callback\r\n */\r\n Gamepad.prototype.onrightstickchanged = function (callback) {\r\n this._onrightstickchanged = callback;\r\n };\r\n Object.defineProperty(Gamepad.prototype, \"leftStick\", {\r\n /**\r\n * Gets the left joystick\r\n */\r\n get: function () {\r\n return this._leftStick;\r\n },\r\n /**\r\n * Sets the left joystick values\r\n */\r\n set: function (newValues) {\r\n if (this._onleftstickchanged && (this._leftStick.x !== newValues.x || this._leftStick.y !== newValues.y)) {\r\n this._onleftstickchanged(newValues);\r\n }\r\n this._leftStick = newValues;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Gamepad.prototype, \"rightStick\", {\r\n /**\r\n * Gets the right joystick\r\n */\r\n get: function () {\r\n return this._rightStick;\r\n },\r\n /**\r\n * Sets the right joystick value\r\n */\r\n set: function (newValues) {\r\n if (this._onrightstickchanged && (this._rightStick.x !== newValues.x || this._rightStick.y !== newValues.y)) {\r\n this._onrightstickchanged(newValues);\r\n }\r\n this._rightStick = newValues;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the gamepad joystick positions\r\n */\r\n Gamepad.prototype.update = function () {\r\n if (this._leftStick) {\r\n this.leftStick = { x: this.browserGamepad.axes[this._leftStickAxisX], y: this.browserGamepad.axes[this._leftStickAxisY] };\r\n if (this._invertLeftStickY) {\r\n this.leftStick.y *= -1;\r\n }\r\n }\r\n if (this._rightStick) {\r\n this.rightStick = { x: this.browserGamepad.axes[this._rightStickAxisX], y: this.browserGamepad.axes[this._rightStickAxisY] };\r\n }\r\n };\r\n /**\r\n * Disposes the gamepad\r\n */\r\n Gamepad.prototype.dispose = function () {\r\n };\r\n /**\r\n * Represents a gamepad controller\r\n */\r\n Gamepad.GAMEPAD = 0;\r\n /**\r\n * Represents a generic controller\r\n */\r\n Gamepad.GENERIC = 1;\r\n /**\r\n * Represents an XBox controller\r\n */\r\n Gamepad.XBOX = 2;\r\n /**\r\n * Represents a pose-enabled controller\r\n */\r\n Gamepad.POSE_ENABLED = 3;\r\n /**\r\n * Represents an Dual Shock controller\r\n */\r\n Gamepad.DUALSHOCK = 4;\r\n return Gamepad;\r\n}());\r\n\r\n/**\r\n * Represents a generic gamepad\r\n */\r\nvar GenericPad = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GenericPad, _super);\r\n /**\r\n * Initializes the generic gamepad\r\n * @param id The id of the generic gamepad\r\n * @param index The index of the generic gamepad\r\n * @param browserGamepad The browser gamepad\r\n */\r\n function GenericPad(id, index, browserGamepad) {\r\n var _this = _super.call(this, id, index, browserGamepad) || this;\r\n /**\r\n * Observable triggered when a button has been pressed\r\n */\r\n _this.onButtonDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Observable triggered when a button has been released\r\n */\r\n _this.onButtonUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this.type = Gamepad.GENERIC;\r\n _this._buttons = new Array(browserGamepad.buttons.length);\r\n return _this;\r\n }\r\n /**\r\n * Callback triggered when a button has been pressed\r\n * @param callback Called when a button has been pressed\r\n */\r\n GenericPad.prototype.onbuttondown = function (callback) {\r\n this._onbuttondown = callback;\r\n };\r\n /**\r\n * Callback triggered when a button has been released\r\n * @param callback Called when a button has been released\r\n */\r\n GenericPad.prototype.onbuttonup = function (callback) {\r\n this._onbuttonup = callback;\r\n };\r\n GenericPad.prototype._setButtonValue = function (newValue, currentValue, buttonIndex) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._onbuttondown) {\r\n this._onbuttondown(buttonIndex);\r\n }\r\n this.onButtonDownObservable.notifyObservers(buttonIndex);\r\n }\r\n if (newValue === 0) {\r\n if (this._onbuttonup) {\r\n this._onbuttonup(buttonIndex);\r\n }\r\n this.onButtonUpObservable.notifyObservers(buttonIndex);\r\n }\r\n }\r\n return newValue;\r\n };\r\n /**\r\n * Updates the generic gamepad\r\n */\r\n GenericPad.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n for (var index = 0; index < this._buttons.length; index++) {\r\n this._buttons[index] = this._setButtonValue(this.browserGamepad.buttons[index].value, this._buttons[index], index);\r\n }\r\n };\r\n /**\r\n * Disposes the generic gamepad\r\n */\r\n GenericPad.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onButtonDownObservable.clear();\r\n this.onButtonUpObservable.clear();\r\n };\r\n return GenericPad;\r\n}(Gamepad));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/gamepadManager.ts\":\n/*!************************************!*\\\n !*** ./Gamepads/gamepadManager.ts ***!\n \\************************************/\n/*! exports provided: GamepadManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return GamepadManager; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Gamepads/Controllers/poseEnabledController */ \"./Gamepads/Controllers/poseEnabledController.ts\");\n/* harmony import */ var _xboxGamepad__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./xboxGamepad */ \"./Gamepads/xboxGamepad.ts\");\n/* harmony import */ var _gamepad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _dualShockGamepad__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./dualShockGamepad */ \"./Gamepads/dualShockGamepad.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manager for handling gamepads\r\n */\r\nvar GamepadManager = /** @class */ (function () {\r\n /**\r\n * Initializes the gamepad manager\r\n * @param _scene BabylonJS scene\r\n */\r\n function GamepadManager(_scene) {\r\n var _this = this;\r\n this._scene = _scene;\r\n this._babylonGamepads = [];\r\n this._oneGamepadConnected = false;\r\n /** @hidden */\r\n this._isMonitoring = false;\r\n /**\r\n * observable to be triggered when the gamepad controller has been disconnected\r\n */\r\n this.onGamepadDisconnectedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n if (!_Misc_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n this._gamepadEventSupported = false;\r\n }\r\n else {\r\n this._gamepadEventSupported = 'GamepadEvent' in window;\r\n this._gamepadSupport = (navigator.getGamepads ||\r\n navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);\r\n }\r\n this.onGamepadConnectedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"](function (observer) {\r\n // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected\r\n for (var i in _this._babylonGamepads) {\r\n var gamepad = _this._babylonGamepads[i];\r\n if (gamepad && gamepad._isConnected) {\r\n _this.onGamepadConnectedObservable.notifyObserver(observer, gamepad);\r\n }\r\n }\r\n });\r\n this._onGamepadConnectedEvent = function (evt) {\r\n var gamepad = evt.gamepad;\r\n if (gamepad.index in _this._babylonGamepads) {\r\n if (_this._babylonGamepads[gamepad.index].isConnected) {\r\n return;\r\n }\r\n }\r\n var newGamepad;\r\n if (_this._babylonGamepads[gamepad.index]) {\r\n newGamepad = _this._babylonGamepads[gamepad.index];\r\n newGamepad.browserGamepad = gamepad;\r\n newGamepad._isConnected = true;\r\n }\r\n else {\r\n newGamepad = _this._addNewGamepad(gamepad);\r\n }\r\n _this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n _this._startMonitoringGamepads();\r\n };\r\n this._onGamepadDisconnectedEvent = function (evt) {\r\n var gamepad = evt.gamepad;\r\n // Remove the gamepad from the list of gamepads to monitor.\r\n for (var i in _this._babylonGamepads) {\r\n if (_this._babylonGamepads[i].index === gamepad.index) {\r\n var disconnectedGamepad = _this._babylonGamepads[i];\r\n disconnectedGamepad._isConnected = false;\r\n _this.onGamepadDisconnectedObservable.notifyObservers(disconnectedGamepad);\r\n break;\r\n }\r\n }\r\n };\r\n if (this._gamepadSupport) {\r\n //first add already-connected gamepads\r\n this._updateGamepadObjects();\r\n if (this._babylonGamepads.length) {\r\n this._startMonitoringGamepads();\r\n }\r\n // Checking if the gamepad connected event is supported (like in Firefox)\r\n if (this._gamepadEventSupported) {\r\n var hostWindow = this._scene ? this._scene.getEngine().getHostWindow() : window;\r\n hostWindow.addEventListener('gamepadconnected', this._onGamepadConnectedEvent, false);\r\n hostWindow.addEventListener('gamepaddisconnected', this._onGamepadDisconnectedEvent, false);\r\n }\r\n else {\r\n this._startMonitoringGamepads();\r\n }\r\n }\r\n }\r\n Object.defineProperty(GamepadManager.prototype, \"gamepads\", {\r\n /**\r\n * The gamepads in the game pad manager\r\n */\r\n get: function () {\r\n return this._babylonGamepads;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the gamepad controllers based on type\r\n * @param type The type of gamepad controller\r\n * @returns Nullable gamepad\r\n */\r\n GamepadManager.prototype.getGamepadByType = function (type) {\r\n if (type === void 0) { type = _gamepad__WEBPACK_IMPORTED_MODULE_4__[\"Gamepad\"].XBOX; }\r\n for (var _i = 0, _a = this._babylonGamepads; _i < _a.length; _i++) {\r\n var gamepad = _a[_i];\r\n if (gamepad && gamepad.type === type) {\r\n return gamepad;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Disposes the gamepad manager\r\n */\r\n GamepadManager.prototype.dispose = function () {\r\n if (this._gamepadEventSupported) {\r\n if (this._onGamepadConnectedEvent) {\r\n window.removeEventListener('gamepadconnected', this._onGamepadConnectedEvent);\r\n }\r\n if (this._onGamepadDisconnectedEvent) {\r\n window.removeEventListener('gamepaddisconnected', this._onGamepadDisconnectedEvent);\r\n }\r\n this._onGamepadConnectedEvent = null;\r\n this._onGamepadDisconnectedEvent = null;\r\n }\r\n this._babylonGamepads.forEach(function (gamepad) {\r\n gamepad.dispose();\r\n });\r\n this.onGamepadConnectedObservable.clear();\r\n this.onGamepadDisconnectedObservable.clear();\r\n this._oneGamepadConnected = false;\r\n this._stopMonitoringGamepads();\r\n this._babylonGamepads = [];\r\n };\r\n GamepadManager.prototype._addNewGamepad = function (gamepad) {\r\n if (!this._oneGamepadConnected) {\r\n this._oneGamepadConnected = true;\r\n }\r\n var newGamepad;\r\n var dualShock = (gamepad.id.search(\"054c\") !== -1);\r\n var xboxOne = (gamepad.id.search(\"Xbox One\") !== -1);\r\n if (xboxOne || gamepad.id.search(\"Xbox 360\") !== -1 || gamepad.id.search(\"xinput\") !== -1) {\r\n newGamepad = new _xboxGamepad__WEBPACK_IMPORTED_MODULE_3__[\"Xbox360Pad\"](gamepad.id, gamepad.index, gamepad, xboxOne);\r\n }\r\n else if (dualShock) {\r\n newGamepad = new _dualShockGamepad__WEBPACK_IMPORTED_MODULE_6__[\"DualShockPad\"](gamepad.id, gamepad.index, gamepad);\r\n }\r\n // if pose is supported, use the (WebVR) pose enabled controller\r\n else if (gamepad.pose) {\r\n newGamepad = _Gamepads_Controllers_poseEnabledController__WEBPACK_IMPORTED_MODULE_2__[\"PoseEnabledControllerHelper\"].InitiateController(gamepad);\r\n }\r\n else {\r\n newGamepad = new _gamepad__WEBPACK_IMPORTED_MODULE_4__[\"GenericPad\"](gamepad.id, gamepad.index, gamepad);\r\n }\r\n this._babylonGamepads[newGamepad.index] = newGamepad;\r\n return newGamepad;\r\n };\r\n GamepadManager.prototype._startMonitoringGamepads = function () {\r\n if (!this._isMonitoring) {\r\n this._isMonitoring = true;\r\n //back-comp\r\n if (!this._scene) {\r\n this._checkGamepadsStatus();\r\n }\r\n }\r\n };\r\n GamepadManager.prototype._stopMonitoringGamepads = function () {\r\n this._isMonitoring = false;\r\n };\r\n /** @hidden */\r\n GamepadManager.prototype._checkGamepadsStatus = function () {\r\n var _this = this;\r\n // Hack to be compatible Chrome\r\n this._updateGamepadObjects();\r\n for (var i in this._babylonGamepads) {\r\n var gamepad = this._babylonGamepads[i];\r\n if (!gamepad || !gamepad.isConnected) {\r\n continue;\r\n }\r\n gamepad.update();\r\n }\r\n if (this._isMonitoring && !this._scene) {\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].QueueNewFrame(function () { _this._checkGamepadsStatus(); });\r\n }\r\n };\r\n // This function is called only on Chrome, which does not properly support\r\n // connection/disconnection events and forces you to recopy again the gamepad object\r\n GamepadManager.prototype._updateGamepadObjects = function () {\r\n var gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r\n for (var i = 0; i < gamepads.length; i++) {\r\n var gamepad = gamepads[i];\r\n if (gamepad) {\r\n if (!this._babylonGamepads[gamepad.index]) {\r\n var newGamepad = this._addNewGamepad(gamepad);\r\n this.onGamepadConnectedObservable.notifyObservers(newGamepad);\r\n }\r\n else {\r\n // Forced to copy again this object for Chrome for unknown reason\r\n this._babylonGamepads[i].browserGamepad = gamepad;\r\n if (!this._babylonGamepads[i].isConnected) {\r\n this._babylonGamepads[i]._isConnected = true;\r\n this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[i]);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n return GamepadManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/gamepadSceneComponent.ts\":\n/*!*******************************************!*\\\n !*** ./Gamepads/gamepadSceneComponent.ts ***!\n \\*******************************************/\n/*! exports provided: GamepadSystemSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return GamepadSystemSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _gamepadManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gamepadManager */ \"./Gamepads/gamepadManager.ts\");\n/* harmony import */ var _Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Cameras/freeCameraInputsManager */ \"./Cameras/freeCameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Cameras/Inputs/freeCameraGamepadInput */ \"./Cameras/Inputs/freeCameraGamepadInput.ts\");\n/* harmony import */ var _Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Cameras/arcRotateCameraInputsManager */ \"./Cameras/arcRotateCameraInputsManager.ts\");\n/* harmony import */ var _Cameras_Inputs_arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Cameras/Inputs/arcRotateCameraGamepadInput */ \"./Cameras/Inputs/arcRotateCameraGamepadInput.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"gamepadManager\", {\r\n get: function () {\r\n if (!this._gamepadManager) {\r\n this._gamepadManager = new _gamepadManager__WEBPACK_IMPORTED_MODULE_2__[\"GamepadManager\"](this);\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GAMEPAD);\r\n if (!component) {\r\n component = new GamepadSystemSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n }\r\n return this._gamepadManager;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Adds a gamepad to the free camera inputs manager\r\n */\r\n_Cameras_freeCameraInputsManager__WEBPACK_IMPORTED_MODULE_3__[\"FreeCameraInputsManager\"].prototype.addGamepad = function () {\r\n this.add(new _Cameras_Inputs_freeCameraGamepadInput__WEBPACK_IMPORTED_MODULE_4__[\"FreeCameraGamepadInput\"]());\r\n return this;\r\n};\r\n/**\r\n * Adds a gamepad to the arc rotate camera inputs manager\r\n */\r\n_Cameras_arcRotateCameraInputsManager__WEBPACK_IMPORTED_MODULE_5__[\"ArcRotateCameraInputsManager\"].prototype.addGamepad = function () {\r\n this.add(new _Cameras_Inputs_arcRotateCameraGamepadInput__WEBPACK_IMPORTED_MODULE_6__[\"ArcRotateCameraGamepadInput\"]());\r\n return this;\r\n};\r\n/**\r\n * Defines the gamepad scene component responsible to manage gamepads in a given scene\r\n */\r\nvar GamepadSystemSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function GamepadSystemSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GAMEPAD;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n GamepadSystemSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraUpdateStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_BEFORECAMERAUPDATE_GAMEPAD, this, this._beforeCameraUpdate);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n GamepadSystemSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for gamepads\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n GamepadSystemSceneComponent.prototype.dispose = function () {\r\n var gamepadManager = this.scene._gamepadManager;\r\n if (gamepadManager) {\r\n gamepadManager.dispose();\r\n this.scene._gamepadManager = null;\r\n }\r\n };\r\n GamepadSystemSceneComponent.prototype._beforeCameraUpdate = function () {\r\n var gamepadManager = this.scene._gamepadManager;\r\n if (gamepadManager && gamepadManager._isMonitoring) {\r\n gamepadManager._checkGamepadsStatus();\r\n }\r\n };\r\n return GamepadSystemSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/index.ts\":\n/*!***************************!*\\\n !*** ./Gamepads/index.ts ***!\n \\***************************/\n/*! exports provided: DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Controllers_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Controllers/index */ \"./Gamepads/Controllers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"DaydreamController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"GearVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"GenericController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"OculusTouchController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"ViveController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"WebVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _Controllers_index__WEBPACK_IMPORTED_MODULE_0__[\"WindowsMotionController\"]; });\n\n/* harmony import */ var _gamepad__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gamepad */ \"./Gamepads/gamepad.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return _gamepad__WEBPACK_IMPORTED_MODULE_1__[\"StickValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return _gamepad__WEBPACK_IMPORTED_MODULE_1__[\"Gamepad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return _gamepad__WEBPACK_IMPORTED_MODULE_1__[\"GenericPad\"]; });\n\n/* harmony import */ var _gamepadManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gamepadManager */ \"./Gamepads/gamepadManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return _gamepadManager__WEBPACK_IMPORTED_MODULE_2__[\"GamepadManager\"]; });\n\n/* harmony import */ var _gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./gamepadSceneComponent */ \"./Gamepads/gamepadSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return _gamepadSceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"GamepadSystemSceneComponent\"]; });\n\n/* harmony import */ var _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./xboxGamepad */ \"./Gamepads/xboxGamepad.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__[\"Xbox360Button\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__[\"Xbox360Dpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return _xboxGamepad__WEBPACK_IMPORTED_MODULE_4__[\"Xbox360Pad\"]; });\n\n/* harmony import */ var _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dualShockGamepad */ \"./Gamepads/dualShockGamepad.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__[\"DualShockButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__[\"DualShockDpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return _dualShockGamepad__WEBPACK_IMPORTED_MODULE_5__[\"DualShockPad\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gamepads/xboxGamepad.ts\":\n/*!*********************************!*\\\n !*** ./Gamepads/xboxGamepad.ts ***!\n \\*********************************/\n/*! exports provided: Xbox360Button, Xbox360Dpad, Xbox360Pad */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return Xbox360Button; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return Xbox360Dpad; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return Xbox360Pad; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Gamepads/gamepad */ \"./Gamepads/gamepad.ts\");\n\r\n\r\n\r\n/**\r\n * Defines supported buttons for XBox360 compatible gamepads\r\n */\r\nvar Xbox360Button;\r\n(function (Xbox360Button) {\r\n /** A */\r\n Xbox360Button[Xbox360Button[\"A\"] = 0] = \"A\";\r\n /** B */\r\n Xbox360Button[Xbox360Button[\"B\"] = 1] = \"B\";\r\n /** X */\r\n Xbox360Button[Xbox360Button[\"X\"] = 2] = \"X\";\r\n /** Y */\r\n Xbox360Button[Xbox360Button[\"Y\"] = 3] = \"Y\";\r\n /** Start */\r\n Xbox360Button[Xbox360Button[\"Start\"] = 4] = \"Start\";\r\n /** Back */\r\n Xbox360Button[Xbox360Button[\"Back\"] = 5] = \"Back\";\r\n /** Left button */\r\n Xbox360Button[Xbox360Button[\"LB\"] = 6] = \"LB\";\r\n /** Right button */\r\n Xbox360Button[Xbox360Button[\"RB\"] = 7] = \"RB\";\r\n /** Left stick */\r\n Xbox360Button[Xbox360Button[\"LeftStick\"] = 8] = \"LeftStick\";\r\n /** Right stick */\r\n Xbox360Button[Xbox360Button[\"RightStick\"] = 9] = \"RightStick\";\r\n})(Xbox360Button || (Xbox360Button = {}));\r\n/** Defines values for XBox360 DPad */\r\nvar Xbox360Dpad;\r\n(function (Xbox360Dpad) {\r\n /** Up */\r\n Xbox360Dpad[Xbox360Dpad[\"Up\"] = 0] = \"Up\";\r\n /** Down */\r\n Xbox360Dpad[Xbox360Dpad[\"Down\"] = 1] = \"Down\";\r\n /** Left */\r\n Xbox360Dpad[Xbox360Dpad[\"Left\"] = 2] = \"Left\";\r\n /** Right */\r\n Xbox360Dpad[Xbox360Dpad[\"Right\"] = 3] = \"Right\";\r\n})(Xbox360Dpad || (Xbox360Dpad = {}));\r\n/**\r\n * Defines a XBox360 gamepad\r\n */\r\nvar Xbox360Pad = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Xbox360Pad, _super);\r\n /**\r\n * Creates a new XBox360 gamepad object\r\n * @param id defines the id of this gamepad\r\n * @param index defines its index\r\n * @param gamepad defines the internal HTML gamepad object\r\n * @param xboxOne defines if it is a XBox One gamepad\r\n */\r\n function Xbox360Pad(id, index, gamepad, xboxOne) {\r\n if (xboxOne === void 0) { xboxOne = false; }\r\n var _this = _super.call(this, id, index, gamepad, 0, 1, 2, 3) || this;\r\n _this._leftTrigger = 0;\r\n _this._rightTrigger = 0;\r\n /** Observable raised when a button is pressed */\r\n _this.onButtonDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a button is released */\r\n _this.onButtonUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is pressed */\r\n _this.onPadDownObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** Observable raised when a pad is released */\r\n _this.onPadUpObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._buttonA = 0;\r\n _this._buttonB = 0;\r\n _this._buttonX = 0;\r\n _this._buttonY = 0;\r\n _this._buttonBack = 0;\r\n _this._buttonStart = 0;\r\n _this._buttonLB = 0;\r\n _this._buttonRB = 0;\r\n _this._buttonLeftStick = 0;\r\n _this._buttonRightStick = 0;\r\n _this._dPadUp = 0;\r\n _this._dPadDown = 0;\r\n _this._dPadLeft = 0;\r\n _this._dPadRight = 0;\r\n _this._isXboxOnePad = false;\r\n _this.type = _Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"].XBOX;\r\n _this._isXboxOnePad = xboxOne;\r\n return _this;\r\n }\r\n /**\r\n * Defines the callback to call when left trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onlefttriggerchanged = function (callback) {\r\n this._onlefttriggerchanged = callback;\r\n };\r\n /**\r\n * Defines the callback to call when right trigger is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onrighttriggerchanged = function (callback) {\r\n this._onrighttriggerchanged = callback;\r\n };\r\n Object.defineProperty(Xbox360Pad.prototype, \"leftTrigger\", {\r\n /**\r\n * Gets the left trigger value\r\n */\r\n get: function () {\r\n return this._leftTrigger;\r\n },\r\n /**\r\n * Sets the left trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onlefttriggerchanged && this._leftTrigger !== newValue) {\r\n this._onlefttriggerchanged(newValue);\r\n }\r\n this._leftTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"rightTrigger\", {\r\n /**\r\n * Gets the right trigger value\r\n */\r\n get: function () {\r\n return this._rightTrigger;\r\n },\r\n /**\r\n * Sets the right trigger value\r\n */\r\n set: function (newValue) {\r\n if (this._onrighttriggerchanged && this._rightTrigger !== newValue) {\r\n this._onrighttriggerchanged(newValue);\r\n }\r\n this._rightTrigger = newValue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Defines the callback to call when a button is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onbuttondown = function (callback) {\r\n this._onbuttondown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a button is released\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.onbuttonup = function (callback) {\r\n this._onbuttonup = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is pressed\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.ondpaddown = function (callback) {\r\n this._ondpaddown = callback;\r\n };\r\n /**\r\n * Defines the callback to call when a pad is released\r\n * @param callback defines the callback to use\r\n */\r\n Xbox360Pad.prototype.ondpadup = function (callback) {\r\n this._ondpadup = callback;\r\n };\r\n Xbox360Pad.prototype._setButtonValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._onbuttondown) {\r\n this._onbuttondown(buttonType);\r\n }\r\n this.onButtonDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._onbuttonup) {\r\n this._onbuttonup(buttonType);\r\n }\r\n this.onButtonUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n Xbox360Pad.prototype._setDPadValue = function (newValue, currentValue, buttonType) {\r\n if (newValue !== currentValue) {\r\n if (newValue === 1) {\r\n if (this._ondpaddown) {\r\n this._ondpaddown(buttonType);\r\n }\r\n this.onPadDownObservable.notifyObservers(buttonType);\r\n }\r\n if (newValue === 0) {\r\n if (this._ondpadup) {\r\n this._ondpadup(buttonType);\r\n }\r\n this.onPadUpObservable.notifyObservers(buttonType);\r\n }\r\n }\r\n return newValue;\r\n };\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonA\", {\r\n /**\r\n * Gets the value of the `A` button\r\n */\r\n get: function () {\r\n return this._buttonA;\r\n },\r\n /**\r\n * Sets the value of the `A` button\r\n */\r\n set: function (value) {\r\n this._buttonA = this._setButtonValue(value, this._buttonA, Xbox360Button.A);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonB\", {\r\n /**\r\n * Gets the value of the `B` button\r\n */\r\n get: function () {\r\n return this._buttonB;\r\n },\r\n /**\r\n * Sets the value of the `B` button\r\n */\r\n set: function (value) {\r\n this._buttonB = this._setButtonValue(value, this._buttonB, Xbox360Button.B);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonX\", {\r\n /**\r\n * Gets the value of the `X` button\r\n */\r\n get: function () {\r\n return this._buttonX;\r\n },\r\n /**\r\n * Sets the value of the `X` button\r\n */\r\n set: function (value) {\r\n this._buttonX = this._setButtonValue(value, this._buttonX, Xbox360Button.X);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonY\", {\r\n /**\r\n * Gets the value of the `Y` button\r\n */\r\n get: function () {\r\n return this._buttonY;\r\n },\r\n /**\r\n * Sets the value of the `Y` button\r\n */\r\n set: function (value) {\r\n this._buttonY = this._setButtonValue(value, this._buttonY, Xbox360Button.Y);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonStart\", {\r\n /**\r\n * Gets the value of the `Start` button\r\n */\r\n get: function () {\r\n return this._buttonStart;\r\n },\r\n /**\r\n * Sets the value of the `Start` button\r\n */\r\n set: function (value) {\r\n this._buttonStart = this._setButtonValue(value, this._buttonStart, Xbox360Button.Start);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonBack\", {\r\n /**\r\n * Gets the value of the `Back` button\r\n */\r\n get: function () {\r\n return this._buttonBack;\r\n },\r\n /**\r\n * Sets the value of the `Back` button\r\n */\r\n set: function (value) {\r\n this._buttonBack = this._setButtonValue(value, this._buttonBack, Xbox360Button.Back);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonLB\", {\r\n /**\r\n * Gets the value of the `Left` button\r\n */\r\n get: function () {\r\n return this._buttonLB;\r\n },\r\n /**\r\n * Sets the value of the `Left` button\r\n */\r\n set: function (value) {\r\n this._buttonLB = this._setButtonValue(value, this._buttonLB, Xbox360Button.LB);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonRB\", {\r\n /**\r\n * Gets the value of the `Right` button\r\n */\r\n get: function () {\r\n return this._buttonRB;\r\n },\r\n /**\r\n * Sets the value of the `Right` button\r\n */\r\n set: function (value) {\r\n this._buttonRB = this._setButtonValue(value, this._buttonRB, Xbox360Button.RB);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonLeftStick\", {\r\n /**\r\n * Gets the value of the Left joystick\r\n */\r\n get: function () {\r\n return this._buttonLeftStick;\r\n },\r\n /**\r\n * Sets the value of the Left joystick\r\n */\r\n set: function (value) {\r\n this._buttonLeftStick = this._setButtonValue(value, this._buttonLeftStick, Xbox360Button.LeftStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"buttonRightStick\", {\r\n /**\r\n * Gets the value of the Right joystick\r\n */\r\n get: function () {\r\n return this._buttonRightStick;\r\n },\r\n /**\r\n * Sets the value of the Right joystick\r\n */\r\n set: function (value) {\r\n this._buttonRightStick = this._setButtonValue(value, this._buttonRightStick, Xbox360Button.RightStick);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadUp\", {\r\n /**\r\n * Gets the value of D-pad up\r\n */\r\n get: function () {\r\n return this._dPadUp;\r\n },\r\n /**\r\n * Sets the value of D-pad up\r\n */\r\n set: function (value) {\r\n this._dPadUp = this._setDPadValue(value, this._dPadUp, Xbox360Dpad.Up);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadDown\", {\r\n /**\r\n * Gets the value of D-pad down\r\n */\r\n get: function () {\r\n return this._dPadDown;\r\n },\r\n /**\r\n * Sets the value of D-pad down\r\n */\r\n set: function (value) {\r\n this._dPadDown = this._setDPadValue(value, this._dPadDown, Xbox360Dpad.Down);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadLeft\", {\r\n /**\r\n * Gets the value of D-pad left\r\n */\r\n get: function () {\r\n return this._dPadLeft;\r\n },\r\n /**\r\n * Sets the value of D-pad left\r\n */\r\n set: function (value) {\r\n this._dPadLeft = this._setDPadValue(value, this._dPadLeft, Xbox360Dpad.Left);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Xbox360Pad.prototype, \"dPadRight\", {\r\n /**\r\n * Gets the value of D-pad right\r\n */\r\n get: function () {\r\n return this._dPadRight;\r\n },\r\n /**\r\n * Sets the value of D-pad right\r\n */\r\n set: function (value) {\r\n this._dPadRight = this._setDPadValue(value, this._dPadRight, Xbox360Dpad.Right);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Force the gamepad to synchronize with device values\r\n */\r\n Xbox360Pad.prototype.update = function () {\r\n _super.prototype.update.call(this);\r\n if (this._isXboxOnePad) {\r\n this.buttonA = this.browserGamepad.buttons[0].value;\r\n this.buttonB = this.browserGamepad.buttons[1].value;\r\n this.buttonX = this.browserGamepad.buttons[2].value;\r\n this.buttonY = this.browserGamepad.buttons[3].value;\r\n this.buttonLB = this.browserGamepad.buttons[4].value;\r\n this.buttonRB = this.browserGamepad.buttons[5].value;\r\n this.leftTrigger = this.browserGamepad.buttons[6].value;\r\n this.rightTrigger = this.browserGamepad.buttons[7].value;\r\n this.buttonBack = this.browserGamepad.buttons[8].value;\r\n this.buttonStart = this.browserGamepad.buttons[9].value;\r\n this.buttonLeftStick = this.browserGamepad.buttons[10].value;\r\n this.buttonRightStick = this.browserGamepad.buttons[11].value;\r\n this.dPadUp = this.browserGamepad.buttons[12].value;\r\n this.dPadDown = this.browserGamepad.buttons[13].value;\r\n this.dPadLeft = this.browserGamepad.buttons[14].value;\r\n this.dPadRight = this.browserGamepad.buttons[15].value;\r\n }\r\n else {\r\n this.buttonA = this.browserGamepad.buttons[0].value;\r\n this.buttonB = this.browserGamepad.buttons[1].value;\r\n this.buttonX = this.browserGamepad.buttons[2].value;\r\n this.buttonY = this.browserGamepad.buttons[3].value;\r\n this.buttonLB = this.browserGamepad.buttons[4].value;\r\n this.buttonRB = this.browserGamepad.buttons[5].value;\r\n this.leftTrigger = this.browserGamepad.buttons[6].value;\r\n this.rightTrigger = this.browserGamepad.buttons[7].value;\r\n this.buttonBack = this.browserGamepad.buttons[8].value;\r\n this.buttonStart = this.browserGamepad.buttons[9].value;\r\n this.buttonLeftStick = this.browserGamepad.buttons[10].value;\r\n this.buttonRightStick = this.browserGamepad.buttons[11].value;\r\n this.dPadUp = this.browserGamepad.buttons[12].value;\r\n this.dPadDown = this.browserGamepad.buttons[13].value;\r\n this.dPadLeft = this.browserGamepad.buttons[14].value;\r\n this.dPadRight = this.browserGamepad.buttons[15].value;\r\n }\r\n };\r\n /**\r\n * Disposes the gamepad\r\n */\r\n Xbox360Pad.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onButtonDownObservable.clear();\r\n this.onButtonUpObservable.clear();\r\n this.onPadDownObservable.clear();\r\n this.onPadUpObservable.clear();\r\n };\r\n return Xbox360Pad;\r\n}(_Gamepads_gamepad__WEBPACK_IMPORTED_MODULE_2__[\"Gamepad\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/axisDragGizmo.ts\":\n/*!*********************************!*\\\n !*** ./Gizmos/axisDragGizmo.ts ***!\n \\*********************************/\n/*! exports provided: AxisDragGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return AxisDragGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single axis drag gizmo\r\n */\r\nvar AxisDragGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AxisDragGizmo, _super);\r\n /**\r\n * Creates an AxisDragGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param dragAxis The axis which the gizmo will be able to drag on\r\n * @param color The color of the gizmo\r\n */\r\n function AxisDragGizmo(dragAxis, color, gizmoLayer, parent) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (parent === void 0) { parent = null; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._isEnabled = true;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n _this._coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_8__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._coloredMaterial.diffuseColor = color;\r\n _this._coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"](0.1, 0.1, 0.1));\r\n _this._hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_8__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build mesh on root node\r\n _this._arrow = AxisDragGizmo._CreateArrow(gizmoLayer.utilityLayerScene, _this._coloredMaterial);\r\n _this._arrow.lookAt(_this._rootMesh.position.add(dragAxis));\r\n _this._arrow.scaling.scaleInPlace(1 / 3);\r\n _this._arrow.parent = _this._rootMesh;\r\n var currentSnapDragDistance = 0;\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_5__[\"PointerDragBehavior\"]({ dragAxis: dragAxis });\r\n _this.dragBehavior.moveAttached = false;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var localDelta = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n // Convert delta to local translation if it has a parent\r\n if (_this.attachedMesh.parent) {\r\n _this.attachedMesh.parent.computeWorldMatrix().invertToRef(tmpMatrix);\r\n tmpMatrix.setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(event.delta, tmpMatrix, localDelta);\r\n }\r\n else {\r\n localDelta.copyFrom(event.delta);\r\n }\r\n // Snapping logic\r\n if (_this.snapDistance == 0) {\r\n _this.attachedMesh.position.addInPlace(localDelta);\r\n }\r\n else {\r\n currentSnapDragDistance += event.dragDistance;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n var dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n localDelta.normalizeToRef(tmpVector);\r\n tmpVector.scaleInPlace(_this.snapDistance * dragSteps);\r\n _this.attachedMesh.position.addInPlace(tmpVector);\r\n tmpSnapEvent.snapDistance = _this.snapDistance * dragSteps;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? _this._hoverMaterial : _this._coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n if (m.color) {\r\n m.color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes(false));\r\n return _this;\r\n }\r\n /** @hidden */\r\n AxisDragGizmo._CreateArrow = function (scene, material) {\r\n var arrow = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_3__[\"TransformNode\"](\"arrow\", scene);\r\n var cylinder = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"cylinder\", { diameterTop: 0, height: 0.075, diameterBottom: 0.0375, tessellation: 96 }, scene);\r\n var line = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"cylinder\", { diameterTop: 0.005, height: 0.275, diameterBottom: 0.005, tessellation: 96 }, scene);\r\n line.material = material;\r\n cylinder.parent = arrow;\r\n line.parent = arrow;\r\n // Position arrow pointing in its drag axis\r\n cylinder.material = material;\r\n cylinder.rotation.x = Math.PI / 2;\r\n cylinder.position.z += 0.3;\r\n line.position.z += 0.275 / 2;\r\n line.rotation.x = Math.PI / 2;\r\n return arrow;\r\n };\r\n /** @hidden */\r\n AxisDragGizmo._CreateArrowInstance = function (scene, arrow) {\r\n var instance = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_3__[\"TransformNode\"](\"arrow\", scene);\r\n for (var _i = 0, _a = arrow.getChildMeshes(); _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n var childInstance = mesh.createInstance(mesh.name);\r\n childInstance.parent = instance;\r\n }\r\n return instance;\r\n };\r\n AxisDragGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(AxisDragGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n AxisDragGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n if (this._arrow) {\r\n this._arrow.dispose();\r\n }\r\n [this._coloredMaterial, this._hoverMaterial].forEach(function (matl) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n });\r\n _super.prototype.dispose.call(this);\r\n };\r\n return AxisDragGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_6__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/axisScaleGizmo.ts\":\n/*!**********************************!*\\\n !*** ./Gizmos/axisScaleGizmo.ts ***!\n \\**********************************/\n/*! exports provided: AxisScaleGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return AxisScaleGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single axis scale gizmo\r\n */\r\nvar AxisScaleGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AxisScaleGizmo, _super);\r\n /**\r\n * Creates an AxisScaleGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param dragAxis The axis which the gizmo will be able to scale on\r\n * @param color The color of the gizmo\r\n */\r\n function AxisScaleGizmo(dragAxis, color, gizmoLayer, parent) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (parent === void 0) { parent = null; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Scale distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * If the scaling operation should be done on all axis (default: false)\r\n */\r\n _this.uniformScaling = false;\r\n _this._isEnabled = true;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n _this._coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._coloredMaterial.diffuseColor = color;\r\n _this._coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.1, 0.1, 0.1));\r\n _this._hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build mesh on root node\r\n _this._arrow = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n var arrowMesh = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_4__[\"BoxBuilder\"].CreateBox(\"yPosMesh\", { size: 0.4 }, gizmoLayer.utilityLayerScene);\r\n var arrowTail = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__[\"CylinderBuilder\"].CreateCylinder(\"cylinder\", { diameterTop: 0.005, height: 0.275, diameterBottom: 0.005, tessellation: 96 }, gizmoLayer.utilityLayerScene);\r\n arrowTail.material = _this._coloredMaterial;\r\n _this._arrow.addChild(arrowMesh);\r\n _this._arrow.addChild(arrowTail);\r\n // Position arrow pointing in its drag axis\r\n arrowMesh.scaling.scaleInPlace(0.1);\r\n arrowMesh.material = _this._coloredMaterial;\r\n arrowMesh.rotation.x = Math.PI / 2;\r\n arrowMesh.position.z += 0.3;\r\n arrowTail.position.z += 0.275 / 2;\r\n arrowTail.rotation.x = Math.PI / 2;\r\n _this._arrow.lookAt(_this._rootMesh.position.add(dragAxis));\r\n _this._rootMesh.addChild(_this._arrow);\r\n _this._arrow.scaling.scaleInPlace(1 / 3);\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_7__[\"PointerDragBehavior\"]({ dragAxis: dragAxis });\r\n _this.dragBehavior.moveAttached = false;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var currentSnapDragDistance = 0;\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n // Drag strength is modified by the scale of the gizmo (eg. for small objects like boombox the strength will be increased to match the behavior of larger objects)\r\n var dragStrength = event.dragDistance * ((_this.scaleRatio * 3) / _this._rootMesh.scaling.length());\r\n // Snapping logic\r\n var snapped = false;\r\n var dragSteps = 0;\r\n if (_this.uniformScaling) {\r\n _this.attachedMesh.scaling.normalizeToRef(tmpVector);\r\n if (tmpVector.y < 0) {\r\n tmpVector.scaleInPlace(-1);\r\n }\r\n }\r\n else {\r\n tmpVector.copyFrom(dragAxis);\r\n }\r\n if (_this.snapDistance == 0) {\r\n tmpVector.scaleToRef(dragStrength, tmpVector);\r\n }\r\n else {\r\n currentSnapDragDistance += dragStrength;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n if (currentSnapDragDistance < 0) {\r\n dragSteps *= -1;\r\n }\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n tmpVector.scaleToRef(_this.snapDistance * dragSteps, tmpVector);\r\n snapped = true;\r\n }\r\n else {\r\n tmpVector.scaleInPlace(0);\r\n }\r\n }\r\n _this.attachedMesh.scaling.addInPlace(tmpVector);\r\n if (snapped) {\r\n tmpSnapEvent.snapDistance = _this.snapDistance * dragSteps;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? _this._hoverMaterial : _this._coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n if (m.color) {\r\n m.color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes());\r\n return _this;\r\n }\r\n AxisScaleGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(AxisScaleGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n AxisScaleGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n if (this._arrow) {\r\n this._arrow.dispose();\r\n }\r\n [this._coloredMaterial, this._hoverMaterial].forEach(function (matl) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n });\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n * @param useGizmoMaterial If the gizmo's default material should be used (default: false)\r\n */\r\n AxisScaleGizmo.prototype.setCustomMesh = function (mesh, useGizmoMaterial) {\r\n var _this = this;\r\n if (useGizmoMaterial === void 0) { useGizmoMaterial = false; }\r\n _super.prototype.setCustomMesh.call(this, mesh);\r\n if (useGizmoMaterial) {\r\n this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = _this._coloredMaterial;\r\n if (m.color) {\r\n m.color = _this._coloredMaterial.diffuseColor;\r\n }\r\n });\r\n this._customMeshSet = false;\r\n }\r\n };\r\n return AxisScaleGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_8__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/boundingBoxGizmo.ts\":\n/*!************************************!*\\\n !*** ./Gizmos/boundingBoxGizmo.ts ***!\n \\************************************/\n/*! exports provided: BoundingBoxGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return BoundingBoxGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Misc/pivotTools */ \"./Misc/pivotTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Bounding box gizmo\r\n */\r\nvar BoundingBoxGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BoundingBoxGizmo, _super);\r\n /**\r\n * Creates an BoundingBoxGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param color The color of the gizmo\r\n */\r\n function BoundingBoxGizmo(color, gizmoLayer) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_11__[\"UtilityLayerRenderer\"].DefaultKeepDepthUtilityLayer; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._boundingDimensions = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 1, 1);\r\n _this._renderObserver = null;\r\n _this._pointerObserver = null;\r\n _this._scaleDragSpeed = 0.2;\r\n _this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n _this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n _this._tmpRotationMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n /**\r\n * If child meshes should be ignored when calculating the boudning box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)\r\n */\r\n _this.ignoreChildren = false;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored. (Default: null)\r\n */\r\n _this.includeChildPredicate = null;\r\n /**\r\n * The size of the rotation spheres attached to the bounding box (Default: 0.1)\r\n */\r\n _this.rotationSphereSize = 0.1;\r\n /**\r\n * The size of the scale boxes attached to the bounding box (Default: 0.1)\r\n */\r\n _this.scaleBoxSize = 0.1;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false)\r\n */\r\n _this.fixedDragMeshScreenSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)\r\n */\r\n _this.fixedDragMeshScreenSizeDistanceFactor = 10;\r\n /**\r\n * Fired when a rotation sphere or scale box is dragged\r\n */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a scale box is dragged\r\n */\r\n _this.onScaleBoxDragObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a scale box drag is ended\r\n */\r\n _this.onScaleBoxDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a rotation sphere is dragged\r\n */\r\n _this.onRotationSphereDragObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Fired when a rotation sphere drag is ended\r\n */\r\n _this.onRotationSphereDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * Relative bounding box pivot used when scaling the attached mesh. When null object with scale from the opposite corner. 0.5,0.5,0.5 for center and 0.5,0,0.5 for bottom (Default: null)\r\n */\r\n _this.scalePivot = null;\r\n _this._existingMeshScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n // Dragging\r\n _this._dragMesh = null;\r\n _this.pointerDragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__[\"PointerDragBehavior\"]();\r\n // Do not update the gizmo's scale so it has a fixed size to the object its attached to\r\n _this.updateScale = false;\r\n _this._anchorMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"anchor\", gizmoLayer.utilityLayerScene);\r\n // Create Materials\r\n _this.coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this.coloredMaterial.disableLighting = true;\r\n _this.hoverColoredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this.hoverColoredMaterial.disableLighting = true;\r\n // Build bounding box out of lines\r\n _this._lineBoundingBox = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._lineBoundingBox.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n var lines = [];\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, _this._boundingDimensions.y, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, 0, _this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(_Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(\"lines\", { points: [new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, _this._boundingDimensions.z), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](_this._boundingDimensions.x, _this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.forEach(function (l) {\r\n l.color = color;\r\n l.position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-_this._boundingDimensions.x / 2, -_this._boundingDimensions.y / 2, -_this._boundingDimensions.z / 2));\r\n l.isPickable = false;\r\n _this._lineBoundingBox.addChild(l);\r\n });\r\n _this._rootMesh.addChild(_this._lineBoundingBox);\r\n _this.setColor(color);\r\n // Create rotation spheres\r\n _this._rotateSpheresParent = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._rotateSpheresParent.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n var _loop_1 = function (i_1) {\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__[\"SphereBuilder\"].CreateSphere(\"\", { diameter: 1 }, gizmoLayer.utilityLayerScene);\r\n sphere.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n sphere.material = this_1.coloredMaterial;\r\n // Drag behavior\r\n _dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__[\"PointerDragBehavior\"]({});\r\n _dragBehavior.moveAttached = false;\r\n _dragBehavior.updateDragPlane = false;\r\n sphere.addBehavior(_dragBehavior);\r\n var startingTurnDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0);\r\n var totalTurnAmountOfDrag = 0;\r\n _dragBehavior.onDragStartObservable.add(function () {\r\n startingTurnDirection.copyFrom(sphere.forward);\r\n totalTurnAmountOfDrag = 0;\r\n });\r\n _dragBehavior.onDragObservable.add(function (event) {\r\n _this.onRotationSphereDragObservable.notifyObservers({});\r\n if (_this.attachedMesh) {\r\n var originalParent = _this.attachedMesh.parent;\r\n if (originalParent && (originalParent.scaling && originalParent.scaling.isNonUniformWithinEpsilon(0.001))) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(_this.attachedMesh);\r\n var worldDragDirection = startingTurnDirection;\r\n // Project the world right on to the drag plane\r\n var toSub = event.dragPlaneNormal.scale(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(event.dragPlaneNormal, worldDragDirection));\r\n var dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();\r\n // project drag delta on to the resulting drag axis and rotate based on that\r\n var projectDist = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());\r\n // Make rotation relative to size of mesh.\r\n projectDist = (projectDist / _this._boundingDimensions.length()) * _this._anchorMesh.scaling.length();\r\n // Rotate based on axis\r\n if (!_this.attachedMesh.rotationQuaternion) {\r\n _this.attachedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(_this.attachedMesh.rotation.y, _this.attachedMesh.rotation.x, _this.attachedMesh.rotation.z);\r\n }\r\n if (!_this._anchorMesh.rotationQuaternion) {\r\n _this._anchorMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(_this._anchorMesh.rotation.y, _this._anchorMesh.rotation.x, _this._anchorMesh.rotation.z);\r\n }\r\n // Do not allow the object to turn more than a full circle\r\n totalTurnAmountOfDrag += projectDist;\r\n if (Math.abs(totalTurnAmountOfDrag) <= 2 * Math.PI) {\r\n if (i_1 >= 8) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(0, 0, projectDist, _this._tmpQuaternion);\r\n }\r\n else if (i_1 >= 4) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(projectDist, 0, 0, _this._tmpQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(0, projectDist, 0, _this._tmpQuaternion);\r\n }\r\n // Rotate around center of bounding box\r\n _this._anchorMesh.addChild(_this.attachedMesh);\r\n _this._anchorMesh.rotationQuaternion.multiplyToRef(_this._tmpQuaternion, _this._anchorMesh.rotationQuaternion);\r\n _this._anchorMesh.removeChild(_this.attachedMesh);\r\n _this.attachedMesh.setParent(originalParent);\r\n }\r\n _this.updateBoundingBox();\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(_this.attachedMesh);\r\n }\r\n _this._updateDummy();\r\n });\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n _this._selectNode(sphere);\r\n });\r\n _dragBehavior.onDragEndObservable.add(function () {\r\n _this.onRotationSphereDragEndObservable.notifyObservers({});\r\n _this._selectNode(null);\r\n _this._updateDummy();\r\n });\r\n this_1._rotateSpheresParent.addChild(sphere);\r\n };\r\n var this_1 = this, _dragBehavior;\r\n for (var i_1 = 0; i_1 < 12; i_1++) {\r\n _loop_1(i_1);\r\n }\r\n _this._rootMesh.addChild(_this._rotateSpheresParent);\r\n // Create scale cubes\r\n _this._scaleBoxesParent = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._scaleBoxesParent.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n for (var i = 0; i < 2; i++) {\r\n for (var j = 0; j < 2; j++) {\r\n var _loop_2 = function () {\r\n var box = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_7__[\"BoxBuilder\"].CreateBox(\"\", { size: 1 }, gizmoLayer.utilityLayerScene);\r\n box.material = this_2.coloredMaterial;\r\n // Dragging logic\r\n var dragAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](i == 0 ? -1 : 1, j == 0 ? -1 : 1, k == 0 ? -1 : 1);\r\n _dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_9__[\"PointerDragBehavior\"]({ dragAxis: dragAxis });\r\n _dragBehavior.moveAttached = false;\r\n box.addBehavior(_dragBehavior);\r\n _dragBehavior.onDragObservable.add(function (event) {\r\n _this.onScaleBoxDragObservable.notifyObservers({});\r\n if (_this.attachedMesh) {\r\n var originalParent = _this.attachedMesh.parent;\r\n if (originalParent && (originalParent.scaling && originalParent.scaling.isNonUniformWithinEpsilon(0.001))) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(_this.attachedMesh);\r\n var relativeDragDistance = (event.dragDistance / _this._boundingDimensions.length()) * _this._anchorMesh.scaling.length();\r\n var deltaScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](relativeDragDistance, relativeDragDistance, relativeDragDistance);\r\n deltaScale.scaleInPlace(_this._scaleDragSpeed);\r\n _this.updateBoundingBox();\r\n if (_this.scalePivot) {\r\n _this.attachedMesh.getWorldMatrix().getRotationMatrixToRef(_this._tmpRotationMatrix);\r\n // Move anchor to desired pivot point (Bottom left corner + dimension/2)\r\n _this._boundingDimensions.scaleToRef(0.5, _this._tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(_this._tmpVector, _this._tmpRotationMatrix, _this._tmpVector);\r\n _this._anchorMesh.position.subtractInPlace(_this._tmpVector);\r\n _this._boundingDimensions.multiplyToRef(_this.scalePivot, _this._tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(_this._tmpVector, _this._tmpRotationMatrix, _this._tmpVector);\r\n _this._anchorMesh.position.addInPlace(_this._tmpVector);\r\n }\r\n else {\r\n // Scale from the position of the opposite corner\r\n box.absolutePosition.subtractToRef(_this._anchorMesh.position, _this._tmpVector);\r\n _this._anchorMesh.position.subtractInPlace(_this._tmpVector);\r\n }\r\n _this._anchorMesh.addChild(_this.attachedMesh);\r\n _this._anchorMesh.scaling.addInPlace(deltaScale);\r\n if (_this._anchorMesh.scaling.x < 0 || _this._anchorMesh.scaling.y < 0 || _this._anchorMesh.scaling.z < 0) {\r\n _this._anchorMesh.scaling.subtractInPlace(deltaScale);\r\n }\r\n _this._anchorMesh.removeChild(_this.attachedMesh);\r\n _this.attachedMesh.setParent(originalParent);\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(_this.attachedMesh);\r\n }\r\n _this._updateDummy();\r\n });\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n _this._selectNode(box);\r\n });\r\n _dragBehavior.onDragEndObservable.add(function () {\r\n _this.onScaleBoxDragEndObservable.notifyObservers({});\r\n _this._selectNode(null);\r\n _this._updateDummy();\r\n });\r\n this_2._scaleBoxesParent.addChild(box);\r\n };\r\n var this_2 = this, _dragBehavior;\r\n for (var k = 0; k < 2; k++) {\r\n _loop_2();\r\n }\r\n }\r\n }\r\n _this._rootMesh.addChild(_this._scaleBoxesParent);\r\n // Hover color change\r\n var pointerIds = new Array();\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (!pointerIds[pointerInfo.event.pointerId]) {\r\n _this._rotateSpheresParent.getChildMeshes().concat(_this._scaleBoxesParent.getChildMeshes()).forEach(function (mesh) {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {\r\n pointerIds[pointerInfo.event.pointerId] = mesh;\r\n mesh.material = _this.hoverColoredMaterial;\r\n }\r\n });\r\n }\r\n else {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[pointerInfo.event.pointerId]) {\r\n pointerIds[pointerInfo.event.pointerId].material = _this.coloredMaterial;\r\n delete pointerIds[pointerInfo.event.pointerId];\r\n }\r\n }\r\n });\r\n // Update bounding box positions\r\n _this._renderObserver = _this.gizmoLayer.originalScene.onBeforeRenderObservable.add(function () {\r\n // Only update the bouding box if scaling has changed\r\n if (_this.attachedMesh && !_this._existingMeshScale.equals(_this.attachedMesh.scaling)) {\r\n _this.updateBoundingBox();\r\n }\r\n else if (_this.fixedDragMeshScreenSize) {\r\n _this._updateRotationSpheres();\r\n _this._updateScaleBoxes();\r\n }\r\n // If dragg mesh is enabled and dragging, update the attached mesh pose to match the drag mesh\r\n if (_this._dragMesh && _this.attachedMesh && _this.pointerDragBehavior.dragging) {\r\n _this._lineBoundingBox.position.rotateByQuaternionToRef(_this._rootMesh.rotationQuaternion, _this._tmpVector);\r\n _this.attachedMesh.setAbsolutePosition(_this._dragMesh.position.add(_this._tmpVector.scale(-1)));\r\n }\r\n });\r\n _this.updateBoundingBox();\r\n return _this;\r\n }\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n BoundingBoxGizmo.prototype.setColor = function (color) {\r\n this.coloredMaterial.emissiveColor = color;\r\n this.hoverColoredMaterial.emissiveColor = color.clone().add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"](0.3, 0.3, 0.3));\r\n this._lineBoundingBox.getChildren().forEach(function (l) {\r\n if (l.color) {\r\n l.color = color;\r\n }\r\n });\r\n };\r\n BoundingBoxGizmo.prototype._attachedMeshChanged = function (value) {\r\n var _this = this;\r\n if (value) {\r\n // Reset anchor mesh to match attached mesh's scale\r\n // This is needed to avoid invalid box/sphere position on first drag\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(value);\r\n var originalParent = value.parent;\r\n this._anchorMesh.addChild(value);\r\n this._anchorMesh.removeChild(value);\r\n value.setParent(originalParent);\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(value);\r\n this.updateBoundingBox();\r\n value.getChildMeshes(false).forEach(function (m) {\r\n m.markAsDirty(\"scaling\");\r\n });\r\n this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function () {\r\n _this._updateDummy();\r\n });\r\n }\r\n };\r\n BoundingBoxGizmo.prototype._selectNode = function (selectedMesh) {\r\n this._rotateSpheresParent.getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes()).forEach(function (m) {\r\n m.isVisible = (!selectedMesh || m == selectedMesh);\r\n });\r\n };\r\n /**\r\n * Updates the bounding box information for the Gizmo\r\n */\r\n BoundingBoxGizmo.prototype.updateBoundingBox = function () {\r\n if (this.attachedMesh) {\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RemoveAndStorePivotPoint(this.attachedMesh);\r\n // Store original parent\r\n var originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null);\r\n // Store original skelton override mesh\r\n var originalSkeletonOverrideMesh = null;\r\n if (this.attachedMesh.skeleton) {\r\n originalSkeletonOverrideMesh = this.attachedMesh.skeleton.overrideMesh;\r\n this.attachedMesh.skeleton.overrideMesh = null;\r\n }\r\n this._update();\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z);\r\n }\r\n this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n // Update bounding dimensions/positions\r\n var boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n // Update gizmo to match bounding box scaling and rotation\r\n // The position set here is the offset from the origin for the boundingbox when the attached mesh is at the origin\r\n // The position of the gizmo is then set to the attachedMesh in gizmo._update\r\n this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions);\r\n this._lineBoundingBox.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._lineBoundingBox.computeWorldMatrix();\r\n this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition);\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent);\r\n // Restore original skeleton override mesh\r\n if (this.attachedMesh.skeleton) {\r\n this.attachedMesh.skeleton.overrideMesh = originalSkeletonOverrideMesh;\r\n }\r\n }\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n if (this.attachedMesh) {\r\n this._existingMeshScale.copyFrom(this.attachedMesh.scaling);\r\n _Misc_pivotTools__WEBPACK_IMPORTED_MODULE_13__[\"PivotTools\"]._RestorePivotPoint(this.attachedMesh);\r\n }\r\n };\r\n BoundingBoxGizmo.prototype._updateRotationSpheres = function () {\r\n var rotateSpheres = this._rotateSpheresParent.getChildMeshes();\r\n for (var i = 0; i < 3; i++) {\r\n for (var j = 0; j < 2; j++) {\r\n for (var k = 0; k < 2; k++) {\r\n var index = ((i * 4) + (j * 2)) + k;\r\n if (i == 0) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Cross(rotateSpheres[index].position.normalizeToNew(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Right()).normalizeToNew().add(rotateSpheres[index].position));\r\n }\r\n if (i == 1) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Cross(rotateSpheres[index].position.normalizeToNew(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up()).normalizeToNew().add(rotateSpheres[index].position));\r\n }\r\n if (i == 2) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);\r\n rotateSpheres[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Cross(rotateSpheres[index].position.normalizeToNew(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Forward()).normalizeToNew().add(rotateSpheres[index].position));\r\n }\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;\r\n rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n else {\r\n rotateSpheres[index].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n BoundingBoxGizmo.prototype._updateScaleBoxes = function () {\r\n var scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n for (var i = 0; i < 2; i++) {\r\n for (var j = 0; j < 2; j++) {\r\n for (var k = 0; k < 2; k++) {\r\n var index = ((i * 4) + (j * 2)) + k;\r\n if (scaleBoxes[index]) {\r\n scaleBoxes[index].position.set(this._boundingDimensions.x * i, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n scaleBoxes[index].position.addInPlace(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;\r\n scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n else {\r\n scaleBoxes[index].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n BoundingBoxGizmo.prototype.setEnabledRotationAxis = function (axis) {\r\n this._rotateSpheresParent.getChildMeshes().forEach(function (m, i) {\r\n if (i < 4) {\r\n m.setEnabled(axis.indexOf(\"x\") != -1);\r\n }\r\n else if (i < 8) {\r\n m.setEnabled(axis.indexOf(\"y\") != -1);\r\n }\r\n else {\r\n m.setEnabled(axis.indexOf(\"z\") != -1);\r\n }\r\n });\r\n };\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n */\r\n BoundingBoxGizmo.prototype.setEnabledScaling = function (enable) {\r\n this._scaleBoxesParent.getChildMeshes().forEach(function (m, i) {\r\n m.setEnabled(enable);\r\n });\r\n };\r\n BoundingBoxGizmo.prototype._updateDummy = function () {\r\n if (this._dragMesh) {\r\n this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition());\r\n this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling);\r\n this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion);\r\n }\r\n };\r\n /**\r\n * Enables a pointer drag behavior on the bounding box of the gizmo\r\n */\r\n BoundingBoxGizmo.prototype.enableDragBehavior = function () {\r\n this._dragMesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateBox(\"dummy\", 1, this.gizmoLayer.utilityLayerScene);\r\n this._dragMesh.visibility = 0;\r\n this._dragMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n this.pointerDragBehavior.useObjectOrienationForDragging = false;\r\n this._dragMesh.addBehavior(this.pointerDragBehavior);\r\n };\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n BoundingBoxGizmo.prototype.dispose = function () {\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n this._lineBoundingBox.dispose();\r\n this._rotateSpheresParent.dispose();\r\n this._scaleBoxesParent.dispose();\r\n if (this._dragMesh) {\r\n this._dragMesh.dispose();\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Makes a mesh not pickable and wraps the mesh inside of a bounding box mesh that is pickable. (This is useful to avoid picking within complex geometry)\r\n * @param mesh the mesh to wrap in the bounding box mesh and make not pickable\r\n * @returns the bounding box mesh with the passed in mesh as a child\r\n */\r\n BoundingBoxGizmo.MakeNotPickableAndWrapInBoundingBox = function (mesh) {\r\n var makeNotPickable = function (root) {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach(function (c) {\r\n makeNotPickable(c);\r\n });\r\n };\r\n makeNotPickable(mesh);\r\n // Reset position to get boudning box from origin with no rotation\r\n if (!mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(mesh.rotation.y, mesh.rotation.x, mesh.rotation.z);\r\n }\r\n var oldPos = mesh.position.clone();\r\n var oldRot = mesh.rotationQuaternion.clone();\r\n mesh.rotationQuaternion.set(0, 0, 0, 1);\r\n mesh.position.set(0, 0, 0);\r\n // Update bounding dimensions/positions\r\n var box = _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_7__[\"BoxBuilder\"].CreateBox(\"box\", { size: 1 }, mesh.getScene());\r\n var boundingMinMax = mesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);\r\n // Adjust scale to avoid undefined behavior when adding child\r\n if (box.scaling.y === 0) {\r\n box.scaling.y = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n }\r\n if (box.scaling.x === 0) {\r\n box.scaling.x = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n }\r\n if (box.scaling.z === 0) {\r\n box.scaling.z = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n }\r\n box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n // Restore original positions\r\n mesh.addChild(box);\r\n mesh.rotationQuaternion.copyFrom(oldRot);\r\n mesh.position.copyFrom(oldPos);\r\n // Reverse parenting\r\n mesh.removeChild(box);\r\n box.addChild(mesh);\r\n box.visibility = 0;\r\n return box;\r\n };\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n BoundingBoxGizmo.prototype.setCustomMesh = function (mesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Error(\"Custom meshes are not supported on this gizmo\");\r\n };\r\n return BoundingBoxGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_10__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/gizmo.ts\":\n/*!*************************!*\\\n !*** ./Gizmos/gizmo.ts ***!\n \\*************************/\n/*! exports provided: Gizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return Gizmo; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n/**\r\n * Renders gizmos on top of an existing scene which provide controls for position, rotation, etc.\r\n */\r\nvar Gizmo = /** @class */ (function () {\r\n /**\r\n * Creates a gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function Gizmo(\r\n /** The utility layer the gizmo will be added to */\r\n gizmoLayer) {\r\n var _this = this;\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_2__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n this.gizmoLayer = gizmoLayer;\r\n this._attachedMesh = null;\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n this.scaleRatio = 1;\r\n /**\r\n * If a custom mesh has been set (Default: false)\r\n */\r\n this._customMeshSet = false;\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n this.updateGizmoRotationToMatchAttachedMesh = true;\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n this.updateGizmoPositionToMatchAttachedMesh = true;\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n this.updateScale = true;\r\n this._interactionsEnabled = true;\r\n this._tempVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n this._rootMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](\"gizmoRootNode\", gizmoLayer.utilityLayerScene);\r\n this._rootMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].Identity();\r\n this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function () {\r\n _this._update();\r\n });\r\n }\r\n Object.defineProperty(Gizmo.prototype, \"attachedMesh\", {\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n get: function () {\r\n return this._attachedMesh;\r\n },\r\n set: function (value) {\r\n this._attachedMesh = value;\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedMeshChanged(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n Gizmo.prototype.setCustomMesh = function (mesh) {\r\n if (mesh.getScene() != this.gizmoLayer.utilityLayerScene) {\r\n throw \"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)\";\r\n }\r\n this._rootMesh.getChildMeshes().forEach(function (c) {\r\n c.dispose();\r\n });\r\n mesh.parent = this._rootMesh;\r\n this._customMeshSet = true;\r\n };\r\n Gizmo.prototype._attachedMeshChanged = function (value) {\r\n };\r\n /**\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n Gizmo.prototype._update = function () {\r\n if (this.attachedMesh) {\r\n var effectiveMesh = this.attachedMesh._effectiveMesh || this.attachedMesh;\r\n // Position\r\n if (this.updateGizmoPositionToMatchAttachedMesh) {\r\n this._rootMesh.position.copyFrom(effectiveMesh.absolutePosition);\r\n }\r\n // Rotation\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n effectiveMesh.getWorldMatrix().decompose(undefined, this._rootMesh.rotationQuaternion);\r\n }\r\n else {\r\n this._rootMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n }\r\n // Scale\r\n if (this.updateScale) {\r\n var activeCamera = this.gizmoLayer.utilityLayerScene.activeCamera;\r\n var cameraPosition = activeCamera.globalPosition;\r\n if (activeCamera.devicePosition) {\r\n cameraPosition = activeCamera.devicePosition;\r\n }\r\n this._rootMesh.position.subtractToRef(cameraPosition, this._tempVector);\r\n var dist = this._tempVector.length() * this.scaleRatio;\r\n this._rootMesh.scaling.set(dist, dist, dist);\r\n // Account for handedness, similar to Matrix.decompose\r\n if (effectiveMesh._getWorldMatrixDeterminant() < 0) {\r\n this._rootMesh.scaling.y *= -1;\r\n }\r\n }\r\n else {\r\n this._rootMesh.scaling.setAll(this.scaleRatio);\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n Gizmo.prototype.dispose = function () {\r\n this._rootMesh.dispose();\r\n if (this._beforeRenderObserver) {\r\n this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n };\r\n return Gizmo;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/gizmoManager.ts\":\n/*!********************************!*\\\n !*** ./Gizmos/gizmoManager.ts ***!\n \\********************************/\n/*! exports provided: GizmoManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return GizmoManager; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Behaviors_Meshes_sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Behaviors/Meshes/sixDofDragBehavior */ \"./Behaviors/Meshes/sixDofDragBehavior.ts\");\n/* harmony import */ var _rotationGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./rotationGizmo */ \"./Gizmos/rotationGizmo.ts\");\n/* harmony import */ var _positionGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./positionGizmo */ \"./Gizmos/positionGizmo.ts\");\n/* harmony import */ var _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./scaleGizmo */ \"./Gizmos/scaleGizmo.ts\");\n/* harmony import */ var _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./boundingBoxGizmo */ \"./Gizmos/boundingBoxGizmo.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Helps setup gizmo's in the scene to rotate/scale/position meshes\r\n */\r\nvar GizmoManager = /** @class */ (function () {\r\n /**\r\n * Instatiates a gizmo manager\r\n * @param scene the scene to overlay the gizmos on top of\r\n */\r\n function GizmoManager(scene) {\r\n var _this = this;\r\n this.scene = scene;\r\n /** When true, the gizmo will be detached from the current object when a pointer down occurs with an empty picked mesh */\r\n this.clearGizmoOnEmptyPointerEvent = false;\r\n /** Fires an event when the manager is attached to a mesh */\r\n this.onAttachedToMeshObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._gizmosEnabled = { positionGizmo: false, rotationGizmo: false, scaleGizmo: false, boundingBoxGizmo: false };\r\n this._pointerObserver = null;\r\n this._attachedMesh = null;\r\n this._boundingBoxColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].FromHexString(\"#0984e3\");\r\n /**\r\n * When bounding box gizmo is enabled, this can be used to track drag/end events\r\n */\r\n this.boundingBoxDragBehavior = new _Behaviors_Meshes_sixDofDragBehavior__WEBPACK_IMPORTED_MODULE_5__[\"SixDofDragBehavior\"]();\r\n /**\r\n * Array of meshes which will have the gizmo attached when a pointer selected them. If null, all meshes are attachable. (Default: null)\r\n */\r\n this.attachableMeshes = null;\r\n /**\r\n * If pointer events should perform attaching/detaching a gizmo, if false this can be done manually via attachToMesh. (Default: true)\r\n */\r\n this.usePointerToAttachGizmos = true;\r\n this._defaultKeepDepthUtilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__[\"UtilityLayerRenderer\"](scene);\r\n this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false;\r\n this._defaultUtilityLayer = new _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_3__[\"UtilityLayerRenderer\"](scene);\r\n this.gizmos = { positionGizmo: null, rotationGizmo: null, scaleGizmo: null, boundingBoxGizmo: null };\r\n // Instatiate/dispose gizmos based on pointer actions\r\n this._pointerObserver = scene.onPointerObservable.add(function (pointerInfo) {\r\n if (!_this.usePointerToAttachGizmos) {\r\n return;\r\n }\r\n if (pointerInfo.type == _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_1__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh) {\r\n var node = pointerInfo.pickInfo.pickedMesh;\r\n if (_this.attachableMeshes == null) {\r\n // Attach to the most parent node\r\n while (node && node.parent != null) {\r\n node = node.parent;\r\n }\r\n }\r\n else {\r\n // Attach to the parent node that is an attachableMesh\r\n var found = false;\r\n _this.attachableMeshes.forEach(function (mesh) {\r\n if (node && (node == mesh || node.isDescendantOf(mesh))) {\r\n node = mesh;\r\n found = true;\r\n }\r\n });\r\n if (!found) {\r\n node = null;\r\n }\r\n }\r\n if (node instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"]) {\r\n if (_this._attachedMesh != node) {\r\n _this.attachToMesh(node);\r\n }\r\n }\r\n else {\r\n if (_this.clearGizmoOnEmptyPointerEvent) {\r\n _this.attachToMesh(null);\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.clearGizmoOnEmptyPointerEvent) {\r\n _this.attachToMesh(null);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n Object.defineProperty(GizmoManager.prototype, \"keepDepthUtilityLayer\", {\r\n /**\r\n * Utility layer that the bounding box gizmo belongs to\r\n */\r\n get: function () {\r\n return this._defaultKeepDepthUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"utilityLayer\", {\r\n /**\r\n * Utility layer that all gizmos besides bounding box belong to\r\n */\r\n get: function () {\r\n return this._defaultUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a set of gizmos to the specified mesh\r\n * @param mesh The mesh the gizmo's should be attached to\r\n */\r\n GizmoManager.prototype.attachToMesh = function (mesh) {\r\n if (this._attachedMesh) {\r\n this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior);\r\n }\r\n this._attachedMesh = mesh;\r\n for (var key in this.gizmos) {\r\n var gizmo = (this.gizmos[key]);\r\n if (gizmo && this._gizmosEnabled[key]) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n }\r\n if (this.boundingBoxGizmoEnabled && this._attachedMesh) {\r\n this._attachedMesh.addBehavior(this.boundingBoxDragBehavior);\r\n }\r\n this.onAttachedToMeshObservable.notifyObservers(mesh);\r\n };\r\n Object.defineProperty(GizmoManager.prototype, \"positionGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.positionGizmo;\r\n },\r\n /**\r\n * If the position gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n if (!this.gizmos.positionGizmo) {\r\n this.gizmos.positionGizmo = new _positionGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PositionGizmo\"](this._defaultUtilityLayer);\r\n }\r\n this.gizmos.positionGizmo.attachedMesh = this._attachedMesh;\r\n }\r\n else if (this.gizmos.positionGizmo) {\r\n this.gizmos.positionGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.positionGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"rotationGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.rotationGizmo;\r\n },\r\n /**\r\n * If the rotation gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n if (!this.gizmos.rotationGizmo) {\r\n this.gizmos.rotationGizmo = new _rotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"RotationGizmo\"](this._defaultUtilityLayer);\r\n }\r\n this.gizmos.rotationGizmo.attachedMesh = this._attachedMesh;\r\n }\r\n else if (this.gizmos.rotationGizmo) {\r\n this.gizmos.rotationGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.rotationGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"scaleGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.scaleGizmo;\r\n },\r\n /**\r\n * If the scale gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this.gizmos.scaleGizmo = this.gizmos.scaleGizmo || new _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__[\"ScaleGizmo\"](this._defaultUtilityLayer);\r\n this.gizmos.scaleGizmo.attachedMesh = this._attachedMesh;\r\n }\r\n else if (this.gizmos.scaleGizmo) {\r\n this.gizmos.scaleGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.scaleGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GizmoManager.prototype, \"boundingBoxGizmoEnabled\", {\r\n get: function () {\r\n return this._gizmosEnabled.boundingBoxGizmo;\r\n },\r\n /**\r\n * If the boundingBox gizmo is enabled\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this.gizmos.boundingBoxGizmo = this.gizmos.boundingBoxGizmo || new _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_9__[\"BoundingBoxGizmo\"](this._boundingBoxColor, this._defaultKeepDepthUtilityLayer);\r\n this.gizmos.boundingBoxGizmo.attachedMesh = this._attachedMesh;\r\n if (this._attachedMesh) {\r\n this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior);\r\n this._attachedMesh.addBehavior(this.boundingBoxDragBehavior);\r\n }\r\n }\r\n else if (this.gizmos.boundingBoxGizmo) {\r\n if (this._attachedMesh) {\r\n this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior);\r\n }\r\n this.gizmos.boundingBoxGizmo.attachedMesh = null;\r\n }\r\n this._gizmosEnabled.boundingBoxGizmo = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo manager\r\n */\r\n GizmoManager.prototype.dispose = function () {\r\n this.scene.onPointerObservable.remove(this._pointerObserver);\r\n for (var key in this.gizmos) {\r\n var gizmo = (this.gizmos[key]);\r\n if (gizmo) {\r\n gizmo.dispose();\r\n }\r\n }\r\n this._defaultKeepDepthUtilityLayer.dispose();\r\n this._defaultUtilityLayer.dispose();\r\n this.boundingBoxDragBehavior.detach();\r\n this.onAttachedToMeshObservable.clear();\r\n };\r\n return GizmoManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/index.ts\":\n/*!*************************!*\\\n !*** ./Gizmos/index.ts ***!\n \\*************************/\n/*! exports provided: AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _axisDragGizmo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./axisDragGizmo */ \"./Gizmos/axisDragGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return _axisDragGizmo__WEBPACK_IMPORTED_MODULE_0__[\"AxisDragGizmo\"]; });\n\n/* harmony import */ var _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./axisScaleGizmo */ \"./Gizmos/axisScaleGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_1__[\"AxisScaleGizmo\"]; });\n\n/* harmony import */ var _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boundingBoxGizmo */ \"./Gizmos/boundingBoxGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return _boundingBoxGizmo__WEBPACK_IMPORTED_MODULE_2__[\"BoundingBoxGizmo\"]; });\n\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return _gizmo__WEBPACK_IMPORTED_MODULE_3__[\"Gizmo\"]; });\n\n/* harmony import */ var _gizmoManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gizmoManager */ \"./Gizmos/gizmoManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return _gizmoManager__WEBPACK_IMPORTED_MODULE_4__[\"GizmoManager\"]; });\n\n/* harmony import */ var _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./planeRotationGizmo */ \"./Gizmos/planeRotationGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_5__[\"PlaneRotationGizmo\"]; });\n\n/* harmony import */ var _positionGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./positionGizmo */ \"./Gizmos/positionGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return _positionGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PositionGizmo\"]; });\n\n/* harmony import */ var _rotationGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rotationGizmo */ \"./Gizmos/rotationGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return _rotationGizmo__WEBPACK_IMPORTED_MODULE_7__[\"RotationGizmo\"]; });\n\n/* harmony import */ var _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./scaleGizmo */ \"./Gizmos/scaleGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return _scaleGizmo__WEBPACK_IMPORTED_MODULE_8__[\"ScaleGizmo\"]; });\n\n/* harmony import */ var _lightGizmo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lightGizmo */ \"./Gizmos/lightGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return _lightGizmo__WEBPACK_IMPORTED_MODULE_9__[\"LightGizmo\"]; });\n\n/* harmony import */ var _planeDragGizmo__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./planeDragGizmo */ \"./Gizmos/planeDragGizmo.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return _planeDragGizmo__WEBPACK_IMPORTED_MODULE_10__[\"PlaneDragGizmo\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/lightGizmo.ts\":\n/*!******************************!*\\\n !*** ./Gizmos/lightGizmo.ts ***!\n \\******************************/\n/*! exports provided: LightGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return LightGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _Lights_directionalLight__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Lights/directionalLight */ \"./Lights/directionalLight.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_hemisphereBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Meshes/Builders/hemisphereBuilder */ \"./Meshes/Builders/hemisphereBuilder.ts\");\n/* harmony import */ var _Lights_spotLight__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Lights/spotLight */ \"./Lights/spotLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables viewing a light\r\n */\r\nvar LightGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LightGizmo, _super);\r\n /**\r\n * Creates a LightGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function LightGizmo(gizmoLayer) {\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this.cachedPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]();\r\n _this.cachedForward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 0, 1);\r\n _this._light = null;\r\n _this.attachedMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"](\"\", _this.gizmoLayer.utilityLayerScene);\r\n _this._material = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_6__[\"StandardMaterial\"](\"light\", _this.gizmoLayer.originalScene);\r\n _this._material.diffuseColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"](0.5, 0.5, 0.5);\r\n _this._material.specularColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"](0.1, 0.1, 0.1);\r\n return _this;\r\n }\r\n Object.defineProperty(LightGizmo.prototype, \"light\", {\r\n get: function () {\r\n return this._light;\r\n },\r\n /**\r\n * The light that the gizmo is attached to\r\n */\r\n set: function (light) {\r\n var _this = this;\r\n this._light = light;\r\n if (light) {\r\n // Create the mesh for the given light type\r\n if (this._lightMesh) {\r\n this._lightMesh.dispose();\r\n }\r\n if (light instanceof _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__[\"HemisphericLight\"]) {\r\n this._lightMesh = LightGizmo._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n else if (light instanceof _Lights_directionalLight__WEBPACK_IMPORTED_MODULE_8__[\"DirectionalLight\"]) {\r\n this._lightMesh = LightGizmo._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n else if (light instanceof _Lights_spotLight__WEBPACK_IMPORTED_MODULE_11__[\"SpotLight\"]) {\r\n this._lightMesh = LightGizmo._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n else {\r\n this._lightMesh = LightGizmo._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene);\r\n }\r\n this._lightMesh.getChildMeshes(false).forEach(function (m) {\r\n m.material = _this._material;\r\n });\r\n this._lightMesh.parent = this._rootMesh;\r\n // Add lighting to the light gizmo\r\n var gizmoLight = this.gizmoLayer._getSharedGizmoLight();\r\n gizmoLight.includedOnlyMeshes = gizmoLight.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(false));\r\n this._lightMesh.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n if (!this.attachedMesh.reservedDataStore) {\r\n this.attachedMesh.reservedDataStore = {};\r\n }\r\n this.attachedMesh.reservedDataStore.lightGizmo = this;\r\n // Get update position and direction if the light has it\r\n if (light.position) {\r\n this.attachedMesh.position.copyFrom(light.position);\r\n }\r\n if (light.direction) {\r\n this.attachedMesh.setDirection(light.direction);\r\n }\r\n this._update();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightGizmo.prototype, \"material\", {\r\n /**\r\n * Gets the material used to render the light gizmo\r\n */\r\n get: function () {\r\n return this._material;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @hidden\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n LightGizmo.prototype._update = function () {\r\n _super.prototype._update.call(this);\r\n if (!this._light) {\r\n return;\r\n }\r\n if (this._light.position) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n if (!this.attachedMesh.position.equals(this.cachedPosition)) {\r\n // update light to match gizmo\r\n this._light.position.copyFrom(this.attachedMesh.position);\r\n this.cachedPosition.copyFrom(this.attachedMesh.position);\r\n }\r\n else {\r\n // update gizmo to match light\r\n this.attachedMesh.position.copyFrom(this._light.position);\r\n }\r\n }\r\n if (this._light.direction) {\r\n // If the gizmo is moved update the light otherwise update the gizmo to match the light\r\n if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(this.attachedMesh.forward, this.cachedForward) > 0.0001) {\r\n // update light to match gizmo\r\n this._light.direction.copyFrom(this.attachedMesh.forward);\r\n this.cachedForward.copyFrom(this.attachedMesh.forward);\r\n }\r\n else if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].DistanceSquared(this.attachedMesh.forward, this._light.direction) > 0.0001) {\r\n // update gizmo to match light\r\n this.attachedMesh.setDirection(this._light.direction);\r\n this.cachedForward.copyFrom(this._lightMesh.forward);\r\n }\r\n }\r\n if (!this._light.isEnabled()) {\r\n this._material.diffuseColor.set(0, 0, 0);\r\n }\r\n else {\r\n this._material.diffuseColor.set(this._light.diffuse.r / 3, this._light.diffuse.g / 3, this._light.diffuse.b / 3);\r\n }\r\n };\r\n /**\r\n * Disposes of the light gizmo\r\n */\r\n LightGizmo.prototype.dispose = function () {\r\n this._material.dispose();\r\n _super.prototype.dispose.call(this);\r\n };\r\n LightGizmo._CreateHemisphericLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"hemisphereLight\", scene);\r\n var hemisphere = _Meshes_Builders_hemisphereBuilder__WEBPACK_IMPORTED_MODULE_10__[\"HemisphereBuilder\"].CreateHemisphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n hemisphere.position.z = -0.15;\r\n hemisphere.rotation.x = Math.PI / 2;\r\n hemisphere.parent = root;\r\n var lines = this._createLightLines(3, scene);\r\n lines.parent = root;\r\n lines.position.z - 0.15;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n return root;\r\n };\r\n LightGizmo._CreatePointLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"pointLight\", scene);\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__[\"SphereBuilder\"].CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.rotation.x = Math.PI / 2;\r\n sphere.parent = root;\r\n var lines = this._createLightLines(5, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n return root;\r\n };\r\n LightGizmo._CreateSpotLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"spotLight\", scene);\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__[\"SphereBuilder\"].CreateSphere(root.name, { segments: 10, diameter: 1 }, scene);\r\n sphere.parent = root;\r\n var hemisphere = _Meshes_Builders_hemisphereBuilder__WEBPACK_IMPORTED_MODULE_10__[\"HemisphereBuilder\"].CreateHemisphere(root.name, { segments: 10, diameter: 2 }, scene);\r\n hemisphere.parent = root;\r\n hemisphere.rotation.x = -Math.PI / 2;\r\n var lines = this._createLightLines(2, scene);\r\n lines.parent = root;\r\n root.scaling.scaleInPlace(LightGizmo._Scale);\r\n root.rotation.x = Math.PI / 2;\r\n return root;\r\n };\r\n LightGizmo._CreateDirectionalLightMesh = function (scene) {\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"directionalLight\", scene);\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](root.name, scene);\r\n mesh.parent = root;\r\n var sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_9__[\"SphereBuilder\"].CreateSphere(root.name, { diameter: 1.2, segments: 10 }, scene);\r\n sphere.parent = mesh;\r\n var line = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].CreateCylinder(root.name, 6, 0.3, 0.3, 6, 1, scene);\r\n line.parent = mesh;\r\n var left = line.clone(root.name);\r\n left.scaling.y = 0.5;\r\n left.position.x += 1.25;\r\n var right = line.clone(root.name);\r\n right.scaling.y = 0.5;\r\n right.position.x += -1.25;\r\n var arrowHead = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].CreateCylinder(root.name, 1, 0, 0.6, 6, 1, scene);\r\n arrowHead.position.y += 3;\r\n arrowHead.parent = mesh;\r\n var left = arrowHead.clone(root.name);\r\n left.position.y = 1.5;\r\n left.position.x += 1.25;\r\n var right = arrowHead.clone(root.name);\r\n right.position.y = 1.5;\r\n right.position.x += -1.25;\r\n mesh.scaling.scaleInPlace(LightGizmo._Scale);\r\n mesh.rotation.z = Math.PI / 2;\r\n mesh.rotation.y = Math.PI / 2;\r\n return root;\r\n };\r\n // Static helper methods\r\n LightGizmo._Scale = 0.007;\r\n /**\r\n * Creates the lines for a light mesh\r\n */\r\n LightGizmo._createLightLines = function (levels, scene) {\r\n var distFromSphere = 1.2;\r\n var root = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"root\", scene);\r\n root.rotation.x = Math.PI / 2;\r\n // Create the top line, this will be cloned for all other lines\r\n var linePivot = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](\"linePivot\", scene);\r\n linePivot.parent = root;\r\n var line = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].CreateCylinder(\"line\", 2, 0.2, 0.3, 6, 1, scene);\r\n line.position.y = line.scaling.y / 2 + distFromSphere;\r\n line.parent = linePivot;\r\n if (levels < 2) {\r\n return linePivot;\r\n }\r\n for (var i = 0; i < 4; i++) {\r\n var l = linePivot.clone(\"lineParentClone\");\r\n l.rotation.z = Math.PI / 4;\r\n l.rotation.y = (Math.PI / 2) + (Math.PI / 2 * i);\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n if (levels < 3) {\r\n return root;\r\n }\r\n for (var i = 0; i < 4; i++) {\r\n var l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI / 2;\r\n l.rotation.y = (Math.PI / 2 * i);\r\n }\r\n if (levels < 4) {\r\n return root;\r\n }\r\n for (var i = 0; i < 4; i++) {\r\n var l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI + (Math.PI / 4);\r\n l.rotation.y = (Math.PI / 2) + (Math.PI / 2 * i);\r\n l.getChildMeshes()[0].scaling.y = 0.5;\r\n l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;\r\n l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;\r\n }\r\n if (levels < 5) {\r\n return root;\r\n }\r\n var l = linePivot.clone(\"linePivotClone\");\r\n l.rotation.z = Math.PI;\r\n return root;\r\n };\r\n return LightGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_5__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/planeDragGizmo.ts\":\n/*!**********************************!*\\\n !*** ./Gizmos/planeDragGizmo.ts ***!\n \\**********************************/\n/*! exports provided: PlaneDragGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return PlaneDragGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single plane drag gizmo\r\n */\r\nvar PlaneDragGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlaneDragGizmo, _super);\r\n /**\r\n * Creates a PlaneDragGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param dragPlaneNormal The axis normal to which the gizmo will be able to drag on\r\n * @param color The color of the gizmo\r\n */\r\n function PlaneDragGizmo(dragPlaneNormal, color, gizmoLayer, parent) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (parent === void 0) { parent = null; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._isEnabled = false;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n _this._coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._coloredMaterial.diffuseColor = color;\r\n _this._coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.1, 0.1, 0.1));\r\n _this._hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n _this._hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build plane mesh on root node\r\n _this._plane = PlaneDragGizmo._CreatePlane(gizmoLayer.utilityLayerScene, _this._coloredMaterial);\r\n _this._plane.lookAt(_this._rootMesh.position.add(dragPlaneNormal));\r\n _this._plane.scaling.scaleInPlace(1 / 3);\r\n _this._plane.parent = _this._rootMesh;\r\n var currentSnapDragDistance = 0;\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n // Add dragPlaneNormal drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__[\"PointerDragBehavior\"]({ dragPlaneNormal: dragPlaneNormal });\r\n _this.dragBehavior.moveAttached = false;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var localDelta = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n // Convert delta to local translation if it has a parent\r\n if (_this.attachedMesh.parent) {\r\n _this.attachedMesh.parent.computeWorldMatrix().invertToRef(tmpMatrix);\r\n tmpMatrix.setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(event.delta, tmpMatrix, localDelta);\r\n }\r\n else {\r\n localDelta.copyFrom(event.delta);\r\n }\r\n // Snapping logic\r\n if (_this.snapDistance == 0) {\r\n _this.attachedMesh.position.addInPlace(localDelta);\r\n }\r\n else {\r\n currentSnapDragDistance += event.dragDistance;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n var dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n localDelta.normalizeToRef(tmpVector);\r\n tmpVector.scaleInPlace(_this.snapDistance * dragSteps);\r\n _this.attachedMesh.position.addInPlace(tmpVector);\r\n tmpSnapEvent.snapDistance = _this.snapDistance * dragSteps;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? _this._hoverMaterial : _this._coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes(false));\r\n return _this;\r\n }\r\n /** @hidden */\r\n PlaneDragGizmo._CreatePlane = function (scene, material) {\r\n var plane = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_4__[\"TransformNode\"](\"plane\", scene);\r\n //make sure plane is double sided\r\n var dragPlane = _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_5__[\"PlaneBuilder\"].CreatePlane(\"dragPlane\", { width: .1375, height: .1375, sideOrientation: 2 }, scene);\r\n dragPlane.material = material;\r\n dragPlane.parent = plane;\r\n // Position plane pointing normal to dragPlane normal\r\n dragPlane.material = material;\r\n return plane;\r\n };\r\n /** @hidden */\r\n PlaneDragGizmo._CreateArrowInstance = function (scene, arrow) {\r\n var instance = new _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_4__[\"TransformNode\"](\"arrow\", scene);\r\n for (var _i = 0, _a = arrow.getChildMeshes(); _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n var childInstance = mesh.createInstance(mesh.name);\r\n childInstance.parent = instance;\r\n }\r\n return instance;\r\n };\r\n PlaneDragGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(PlaneDragGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n PlaneDragGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n _super.prototype.dispose.call(this);\r\n if (this._plane) {\r\n this._plane.dispose();\r\n }\r\n [this._coloredMaterial, this._hoverMaterial].forEach(function (matl) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n });\r\n };\r\n return PlaneDragGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_7__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/planeRotationGizmo.ts\":\n/*!**************************************!*\\\n !*** ./Gizmos/planeRotationGizmo.ts ***!\n \\**************************************/\n/*! exports provided: PlaneRotationGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return PlaneRotationGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Behaviors/Meshes/pointerDragBehavior */ \"./Behaviors/Meshes/pointerDragBehavior.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Single plane rotation gizmo\r\n */\r\nvar PlaneRotationGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PlaneRotationGizmo, _super);\r\n /**\r\n * Creates a PlaneRotationGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param planeNormal The normal of the plane which the gizmo will be able to rotate on\r\n * @param color The color of the gizmo\r\n * @param tessellation Amount of tessellation to be used when creating rotation circles\r\n * @param useEulerRotation Use and update Euler angle instead of quaternion\r\n */\r\n function PlaneRotationGizmo(planeNormal, color, gizmoLayer, tessellation, parent, useEulerRotation) {\r\n if (color === void 0) { color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].Gray(); }\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (tessellation === void 0) { tessellation = 32; }\r\n if (parent === void 0) { parent = null; }\r\n if (useEulerRotation === void 0) { useEulerRotation = false; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._pointerObserver = null;\r\n /**\r\n * Rotation distance in radians that the gizmo will snap to (Default: 0)\r\n */\r\n _this.snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the the change in distance\r\n */\r\n _this.onSnapObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._isEnabled = true;\r\n _this._parent = null;\r\n _this._parent = parent;\r\n // Create Material\r\n var coloredMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n coloredMaterial.diffuseColor = color;\r\n coloredMaterial.specularColor = color.subtract(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.1, 0.1, 0.1));\r\n var hoverMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](\"\", gizmoLayer.utilityLayerScene);\r\n hoverMaterial.diffuseColor = color.add(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.3, 0.3, 0.3));\r\n // Build mesh on root node\r\n var parentMesh = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"](\"\", gizmoLayer.utilityLayerScene);\r\n var drag = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateTorus(\"\", 0.6, 0.03, tessellation, gizmoLayer.utilityLayerScene);\r\n drag.visibility = 0;\r\n var rotationMesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateTorus(\"\", 0.6, 0.005, tessellation, gizmoLayer.utilityLayerScene);\r\n rotationMesh.material = coloredMaterial;\r\n // Position arrow pointing in its drag axis\r\n rotationMesh.rotation.x = Math.PI / 2;\r\n drag.rotation.x = Math.PI / 2;\r\n parentMesh.addChild(rotationMesh);\r\n parentMesh.addChild(drag);\r\n parentMesh.lookAt(_this._rootMesh.position.add(planeNormal));\r\n _this._rootMesh.addChild(parentMesh);\r\n parentMesh.scaling.scaleInPlace(1 / 3);\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n _this.dragBehavior = new _Behaviors_Meshes_pointerDragBehavior__WEBPACK_IMPORTED_MODULE_6__[\"PointerDragBehavior\"]({ dragPlaneNormal: planeNormal });\r\n _this.dragBehavior.moveAttached = false;\r\n _this.dragBehavior.maxDragAngle = Math.PI * 9 / 20;\r\n _this.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = true;\r\n _this._rootMesh.addBehavior(_this.dragBehavior);\r\n var lastDragPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n _this.dragBehavior.onDragStartObservable.add(function (e) {\r\n if (_this.attachedMesh) {\r\n lastDragPosition.copyFrom(e.dragPlanePoint);\r\n }\r\n });\r\n var rotationMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n var planeNormalTowardsCamera = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var localPlaneNormalTowardsCamera = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var tmpSnapEvent = { snapDistance: 0 };\r\n var currentSnapDragDistance = 0;\r\n var tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n var tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"]();\r\n var amountToRotate = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n _this.dragBehavior.onDragObservable.add(function (event) {\r\n if (_this.attachedMesh) {\r\n if (!_this.attachedMesh.rotationQuaternion || useEulerRotation) {\r\n _this.attachedMesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRoll(_this.attachedMesh.rotation.y, _this.attachedMesh.rotation.x, _this.attachedMesh.rotation.z);\r\n }\r\n // Remove parent priort to rotating\r\n var attachedMeshParent = _this.attachedMesh.parent;\r\n if (attachedMeshParent) {\r\n _this.attachedMesh.setParent(null);\r\n }\r\n // Calc angle over full 360 degree (https://stackoverflow.com/questions/43493711/the-angle-between-two-3d-vectors-with-a-result-range-0-360)\r\n var newVector = event.dragPlanePoint.subtract(_this.attachedMesh.absolutePosition).normalize();\r\n var originalVector = lastDragPosition.subtract(_this.attachedMesh.absolutePosition).normalize();\r\n var cross = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(newVector, originalVector);\r\n var dot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Dot(newVector, originalVector);\r\n var angle = Math.atan2(cross.length(), dot);\r\n planeNormalTowardsCamera.copyFrom(planeNormal);\r\n localPlaneNormalTowardsCamera.copyFrom(planeNormal);\r\n if (_this.updateGizmoRotationToMatchAttachedMesh) {\r\n _this.attachedMesh.rotationQuaternion.toRotationMatrix(rotationMatrix);\r\n localPlaneNormalTowardsCamera = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinates(planeNormalTowardsCamera, rotationMatrix);\r\n }\r\n // Flip up vector depending on which side the camera is on\r\n if (gizmoLayer.utilityLayerScene.activeCamera) {\r\n var camVec = gizmoLayer.utilityLayerScene.activeCamera.position.subtract(_this.attachedMesh.position);\r\n if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Dot(camVec, localPlaneNormalTowardsCamera) > 0) {\r\n planeNormalTowardsCamera.scaleInPlace(-1);\r\n localPlaneNormalTowardsCamera.scaleInPlace(-1);\r\n }\r\n }\r\n var halfCircleSide = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Dot(localPlaneNormalTowardsCamera, cross) > 0.0;\r\n if (halfCircleSide) {\r\n angle = -angle;\r\n }\r\n // Snapping logic\r\n var snapped = false;\r\n if (_this.snapDistance != 0) {\r\n currentSnapDragDistance += angle;\r\n if (Math.abs(currentSnapDragDistance) > _this.snapDistance) {\r\n var dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / _this.snapDistance);\r\n if (currentSnapDragDistance < 0) {\r\n dragSteps *= -1;\r\n }\r\n currentSnapDragDistance = currentSnapDragDistance % _this.snapDistance;\r\n angle = _this.snapDistance * dragSteps;\r\n snapped = true;\r\n }\r\n else {\r\n angle = 0;\r\n }\r\n }\r\n // If the mesh has a parent, convert needed world rotation to local rotation\r\n tmpMatrix.reset();\r\n if (_this.attachedMesh.parent) {\r\n _this.attachedMesh.parent.computeWorldMatrix().invertToRef(tmpMatrix);\r\n tmpMatrix.getRotationMatrixToRef(tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(planeNormalTowardsCamera, tmpMatrix, planeNormalTowardsCamera);\r\n }\r\n // Convert angle and axis to quaternion (http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm)\r\n var quaternionCoefficient = Math.sin(angle / 2);\r\n amountToRotate.set(planeNormalTowardsCamera.x * quaternionCoefficient, planeNormalTowardsCamera.y * quaternionCoefficient, planeNormalTowardsCamera.z * quaternionCoefficient, Math.cos(angle / 2));\r\n // If the meshes local scale is inverted (eg. loaded gltf file parent with z scale of -1) the rotation needs to be inverted on the y axis\r\n if (tmpMatrix.determinant() > 0) {\r\n amountToRotate.toEulerAnglesToRef(tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRollToRef(tmpVector.y, -tmpVector.x, -tmpVector.z, amountToRotate);\r\n }\r\n if (_this.updateGizmoRotationToMatchAttachedMesh) {\r\n // Rotate selected mesh quaternion over fixed axis\r\n _this.attachedMesh.rotationQuaternion.multiplyToRef(amountToRotate, _this.attachedMesh.rotationQuaternion);\r\n }\r\n else {\r\n // Rotate selected mesh quaternion over rotated axis\r\n amountToRotate.multiplyToRef(_this.attachedMesh.rotationQuaternion, _this.attachedMesh.rotationQuaternion);\r\n }\r\n if (useEulerRotation) {\r\n _this.attachedMesh.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n _this.attachedMesh.rotationQuaternion = null;\r\n _this.attachedMesh.rotation.copyFrom(tmpVector);\r\n }\r\n lastDragPosition.copyFrom(event.dragPlanePoint);\r\n if (snapped) {\r\n tmpSnapEvent.snapDistance = angle;\r\n _this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n // Restore parent\r\n if (attachedMeshParent) {\r\n _this.attachedMesh.setParent(attachedMeshParent);\r\n }\r\n }\r\n });\r\n _this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add(function (pointerInfo) {\r\n if (_this._customMeshSet) {\r\n return;\r\n }\r\n var isHovered = pointerInfo.pickInfo && (_this._rootMesh.getChildMeshes().indexOf(pointerInfo.pickInfo.pickedMesh) != -1);\r\n var material = isHovered ? hoverMaterial : coloredMaterial;\r\n _this._rootMesh.getChildMeshes().forEach(function (m) {\r\n m.material = material;\r\n if (m.color) {\r\n m.color = material.diffuseColor;\r\n }\r\n });\r\n });\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._rootMesh.getChildMeshes(false));\r\n return _this;\r\n }\r\n PlaneRotationGizmo.prototype._attachedMeshChanged = function (value) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n };\r\n Object.defineProperty(PlaneRotationGizmo.prototype, \"isEnabled\", {\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n set: function (value) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n }\r\n else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n PlaneRotationGizmo.prototype.dispose = function () {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n _super.prototype.dispose.call(this);\r\n };\r\n return PlaneRotationGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_7__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/positionGizmo.ts\":\n/*!*********************************!*\\\n !*** ./Gizmos/positionGizmo.ts ***!\n \\*********************************/\n/*! exports provided: PositionGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return PositionGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./axisDragGizmo */ \"./Gizmos/axisDragGizmo.ts\");\n/* harmony import */ var _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./planeDragGizmo */ \"./Gizmos/planeDragGizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables dragging a mesh along 3 axis\r\n */\r\nvar PositionGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PositionGizmo, _super);\r\n /**\r\n * Creates a PositionGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function PositionGizmo(gizmoLayer) {\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n /**\r\n * private variables\r\n */\r\n _this._meshAttached = null;\r\n /** Fires an event when any of it's sub gizmos are dragged */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** Fires an event when any of it's sub gizmos are released from dragging */\r\n _this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * If set to true, planar drag is enabled\r\n */\r\n _this._planarGizmoEnabled = false;\r\n _this.xGizmo = new _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__[\"AxisDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), gizmoLayer, _this);\r\n _this.yGizmo = new _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__[\"AxisDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), gizmoLayer, _this);\r\n _this.zGizmo = new _axisDragGizmo__WEBPACK_IMPORTED_MODULE_6__[\"AxisDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), gizmoLayer, _this);\r\n _this.xPlaneGizmo = new _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PlaneDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), _this.gizmoLayer, _this);\r\n _this.yPlaneGizmo = new _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PlaneDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), _this.gizmoLayer, _this);\r\n _this.zPlaneGizmo = new _planeDragGizmo__WEBPACK_IMPORTED_MODULE_7__[\"PlaneDragGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), _this.gizmoLayer, _this);\r\n // Relay drag events\r\n [_this.xGizmo, _this.yGizmo, _this.zGizmo, _this.xPlaneGizmo, _this.yPlaneGizmo, _this.zPlaneGizmo].forEach(function (gizmo) {\r\n gizmo.dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n });\r\n gizmo.dragBehavior.onDragEndObservable.add(function () {\r\n _this.onDragEndObservable.notifyObservers({});\r\n });\r\n });\r\n _this.attachedMesh = null;\r\n return _this;\r\n }\r\n Object.defineProperty(PositionGizmo.prototype, \"attachedMesh\", {\r\n get: function () {\r\n return this._meshAttached;\r\n },\r\n set: function (mesh) {\r\n this._meshAttached = mesh;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo.isEnabled) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n else {\r\n gizmo.attachedMesh = null;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"planarGizmoEnabled\", {\r\n get: function () {\r\n return this._planarGizmoEnabled;\r\n },\r\n /**\r\n * If the planar drag gizmo is enabled\r\n * setting this will enable/disable XY, XZ and YZ planes regardless of individual gizmo settings.\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n this._planarGizmoEnabled = value;\r\n [this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.isEnabled = value;\r\n if (value) {\r\n gizmo.attachedMesh = _this.attachedMesh;\r\n }\r\n }\r\n }, this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"updateGizmoRotationToMatchAttachedMesh\", {\r\n get: function () {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n },\r\n set: function (value) {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"snapDistance\", {\r\n get: function () {\r\n return this._snapDistance;\r\n },\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n set: function (value) {\r\n this._snapDistance = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.snapDistance = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PositionGizmo.prototype, \"scaleRatio\", {\r\n get: function () {\r\n return this._scaleRatio;\r\n },\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n set: function (value) {\r\n this._scaleRatio = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.scaleRatio = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n PositionGizmo.prototype.dispose = function () {\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.xPlaneGizmo, this.yPlaneGizmo, this.zPlaneGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.dispose();\r\n }\r\n });\r\n this.onDragStartObservable.clear();\r\n this.onDragEndObservable.clear();\r\n };\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n PositionGizmo.prototype.setCustomMesh = function (mesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].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,gizmo.xPlaneGizmo, gizmo.yPlaneGizmo, gizmo.zPlaneGizmo)\");\r\n };\r\n return PositionGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_5__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/rotationGizmo.ts\":\n/*!*********************************!*\\\n !*** ./Gizmos/rotationGizmo.ts ***!\n \\*********************************/\n/*! exports provided: RotationGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return RotationGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./planeRotationGizmo */ \"./Gizmos/planeRotationGizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables rotating a mesh along 3 axis\r\n */\r\nvar RotationGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RotationGizmo, _super);\r\n /**\r\n * Creates a RotationGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param tessellation Amount of tessellation to be used when creating rotation circles\r\n * @param useEulerRotation Use and update Euler angle instead of quaternion\r\n */\r\n function RotationGizmo(gizmoLayer, tessellation, useEulerRotation) {\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_7__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n if (tessellation === void 0) { tessellation = 32; }\r\n if (useEulerRotation === void 0) { useEulerRotation = false; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n /** Fires an event when any of it's sub gizmos are dragged */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** Fires an event when any of it's sub gizmos are released from dragging */\r\n _this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this.xGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PlaneRotationGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);\r\n _this.yGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PlaneRotationGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);\r\n _this.zGizmo = new _planeRotationGizmo__WEBPACK_IMPORTED_MODULE_6__[\"PlaneRotationGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), gizmoLayer, tessellation, _this, useEulerRotation);\r\n // Relay drag events\r\n [_this.xGizmo, _this.yGizmo, _this.zGizmo].forEach(function (gizmo) {\r\n gizmo.dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n });\r\n gizmo.dragBehavior.onDragEndObservable.add(function () {\r\n _this.onDragEndObservable.notifyObservers({});\r\n });\r\n });\r\n _this.attachedMesh = null;\r\n return _this;\r\n }\r\n Object.defineProperty(RotationGizmo.prototype, \"attachedMesh\", {\r\n get: function () {\r\n return this._meshAttached;\r\n },\r\n set: function (mesh) {\r\n this._meshAttached = mesh;\r\n [this.xGizmo, this.yGizmo, this.zGizmo].forEach(function (gizmo) {\r\n if (gizmo.isEnabled) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n else {\r\n gizmo.attachedMesh = null;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RotationGizmo.prototype, \"updateGizmoRotationToMatchAttachedMesh\", {\r\n get: function () {\r\n return this.xGizmo.updateGizmoRotationToMatchAttachedMesh;\r\n },\r\n set: function (value) {\r\n if (this.xGizmo) {\r\n this.xGizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n this.yGizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n this.zGizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RotationGizmo.prototype, \"snapDistance\", {\r\n get: function () {\r\n return this.xGizmo.snapDistance;\r\n },\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n set: function (value) {\r\n if (this.xGizmo) {\r\n this.xGizmo.snapDistance = value;\r\n this.yGizmo.snapDistance = value;\r\n this.zGizmo.snapDistance = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RotationGizmo.prototype, \"scaleRatio\", {\r\n get: function () {\r\n return this.xGizmo.scaleRatio;\r\n },\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n set: function (value) {\r\n if (this.xGizmo) {\r\n this.xGizmo.scaleRatio = value;\r\n this.yGizmo.scaleRatio = value;\r\n this.zGizmo.scaleRatio = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n RotationGizmo.prototype.dispose = function () {\r\n this.xGizmo.dispose();\r\n this.yGizmo.dispose();\r\n this.zGizmo.dispose();\r\n this.onDragStartObservable.clear();\r\n this.onDragEndObservable.clear();\r\n };\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n RotationGizmo.prototype.setCustomMesh = function (mesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].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)\");\r\n };\r\n return RotationGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_5__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Gizmos/scaleGizmo.ts\":\n/*!******************************!*\\\n !*** ./Gizmos/scaleGizmo.ts ***!\n \\******************************/\n/*! exports provided: ScaleGizmo */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return ScaleGizmo; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/polyhedronBuilder */ \"./Meshes/Builders/polyhedronBuilder.ts\");\n/* harmony import */ var _gizmo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./gizmo */ \"./Gizmos/gizmo.ts\");\n/* harmony import */ var _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./axisScaleGizmo */ \"./Gizmos/axisScaleGizmo.ts\");\n/* harmony import */ var _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Rendering/utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gizmo that enables scaling a mesh along 3 axis\r\n */\r\nvar ScaleGizmo = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ScaleGizmo, _super);\r\n /**\r\n * Creates a ScaleGizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n function ScaleGizmo(gizmoLayer) {\r\n if (gizmoLayer === void 0) { gizmoLayer = _Rendering_utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_8__[\"UtilityLayerRenderer\"].DefaultUtilityLayer; }\r\n var _this = _super.call(this, gizmoLayer) || this;\r\n _this._meshAttached = null;\r\n /** Fires an event when any of it's sub gizmos are dragged */\r\n _this.onDragStartObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** Fires an event when any of it's sub gizmos are released from dragging */\r\n _this.onDragEndObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this.xGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Red().scale(0.5), gizmoLayer, _this);\r\n _this.yGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Green().scale(0.5), gizmoLayer, _this);\r\n _this.zGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Blue().scale(0.5), gizmoLayer, _this);\r\n // Create uniform scale gizmo\r\n _this.uniformScaleGizmo = new _axisScaleGizmo__WEBPACK_IMPORTED_MODULE_7__[\"AxisScaleGizmo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0), _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"].Yellow().scale(0.5), gizmoLayer, _this);\r\n _this.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh = false;\r\n _this.uniformScaleGizmo.uniformScaling = true;\r\n _this._uniformScalingMesh = _Meshes_Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_5__[\"PolyhedronBuilder\"].CreatePolyhedron(\"\", { type: 1 }, _this.uniformScaleGizmo.gizmoLayer.utilityLayerScene);\r\n _this._uniformScalingMesh.scaling.scaleInPlace(0.02);\r\n _this._uniformScalingMesh.visibility = 0;\r\n _this._octahedron = _Meshes_Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_5__[\"PolyhedronBuilder\"].CreatePolyhedron(\"\", { type: 1 }, _this.uniformScaleGizmo.gizmoLayer.utilityLayerScene);\r\n _this._octahedron.scaling.scaleInPlace(0.007);\r\n _this._uniformScalingMesh.addChild(_this._octahedron);\r\n _this.uniformScaleGizmo.setCustomMesh(_this._uniformScalingMesh, true);\r\n var light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(_this._octahedron);\r\n // Relay drag events\r\n [_this.xGizmo, _this.yGizmo, _this.zGizmo, _this.uniformScaleGizmo].forEach(function (gizmo) {\r\n gizmo.dragBehavior.onDragStartObservable.add(function () {\r\n _this.onDragStartObservable.notifyObservers({});\r\n });\r\n gizmo.dragBehavior.onDragEndObservable.add(function () {\r\n _this.onDragEndObservable.notifyObservers({});\r\n });\r\n });\r\n _this.attachedMesh = null;\r\n return _this;\r\n }\r\n Object.defineProperty(ScaleGizmo.prototype, \"attachedMesh\", {\r\n get: function () {\r\n return this._meshAttached;\r\n },\r\n set: function (mesh) {\r\n this._meshAttached = mesh;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo.isEnabled) {\r\n gizmo.attachedMesh = mesh;\r\n }\r\n else {\r\n gizmo.attachedMesh = null;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleGizmo.prototype, \"updateGizmoRotationToMatchAttachedMesh\", {\r\n get: function () {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n },\r\n set: function (value) {\r\n if (!value) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported.\");\r\n }\r\n else {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleGizmo.prototype, \"snapDistance\", {\r\n get: function () {\r\n return this._snapDistance;\r\n },\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n set: function (value) {\r\n this._snapDistance = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.snapDistance = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleGizmo.prototype, \"scaleRatio\", {\r\n get: function () {\r\n return this._scaleRatio;\r\n },\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n set: function (value) {\r\n this._scaleRatio = value;\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.scaleRatio = value;\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n ScaleGizmo.prototype.dispose = function () {\r\n [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach(function (gizmo) {\r\n if (gizmo) {\r\n gizmo.dispose();\r\n }\r\n });\r\n this.onDragStartObservable.clear();\r\n this.onDragEndObservable.clear();\r\n [this._uniformScalingMesh, this._octahedron].forEach(function (msh) {\r\n if (msh) {\r\n msh.dispose();\r\n }\r\n });\r\n };\r\n return ScaleGizmo;\r\n}(_gizmo__WEBPACK_IMPORTED_MODULE_6__[\"Gizmo\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/environmentHelper.ts\":\n/*!**************************************!*\\\n !*** ./Helpers/environmentHelper.ts ***!\n \\**************************************/\n/*! exports provided: EnvironmentHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return EnvironmentHelper; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_mirrorTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/Textures/mirrorTexture */ \"./Materials/Textures/mirrorTexture.ts\");\n/* harmony import */ var _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/Textures/cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Environment helper class can be used to add a fully featuread none expensive background to your scene.\r\n * It includes by default a skybox and a ground relying on the BackgroundMaterial.\r\n * It also helps with the default setup of your imageProcessing configuration.\r\n */\r\nvar EnvironmentHelper = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n function EnvironmentHelper(options, scene) {\r\n var _this = this;\r\n this._errorHandler = function (message, exception) {\r\n _this.onErrorObservable.notifyObservers({ message: message, exception: exception });\r\n };\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, EnvironmentHelper._getDefaultOptions(), options);\r\n this._scene = scene;\r\n this.onErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n }\r\n /**\r\n * Creates the default options for the helper.\r\n */\r\n EnvironmentHelper._getDefaultOptions = function () {\r\n return {\r\n createGround: true,\r\n groundSize: 15,\r\n groundTexture: this._groundTextureCDNUrl,\r\n groundColor: new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.2, 0.2, 0.3).toLinearSpace().scale(3),\r\n groundOpacity: 0.9,\r\n enableGroundShadow: true,\r\n groundShadowLevel: 0.5,\r\n enableGroundMirror: false,\r\n groundMirrorSizeRatio: 0.3,\r\n groundMirrorBlurKernel: 64,\r\n groundMirrorAmount: 1,\r\n groundMirrorFresnelWeight: 1,\r\n groundMirrorFallOffDistance: 0,\r\n groundMirrorTextureType: _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT,\r\n groundYBias: 0.00001,\r\n createSkybox: true,\r\n skyboxSize: 20,\r\n skyboxTexture: this._skyboxTextureCDNUrl,\r\n skyboxColor: new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color3\"](0.2, 0.2, 0.3).toLinearSpace().scale(3),\r\n backgroundYRotation: 0,\r\n sizeAuto: true,\r\n rootPosition: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(),\r\n setupImageProcessing: true,\r\n environmentTexture: this._environmentTextureCDNUrl,\r\n cameraExposure: 0.8,\r\n cameraContrast: 1.2,\r\n toneMappingEnabled: true,\r\n };\r\n };\r\n Object.defineProperty(EnvironmentHelper.prototype, \"rootMesh\", {\r\n /**\r\n * Gets the root mesh created by the helper.\r\n */\r\n get: function () {\r\n return this._rootMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"skybox\", {\r\n /**\r\n * Gets the skybox created by the helper.\r\n */\r\n get: function () {\r\n return this._skybox;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"skyboxTexture\", {\r\n /**\r\n * Gets the skybox texture created by the helper.\r\n */\r\n get: function () {\r\n return this._skyboxTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"skyboxMaterial\", {\r\n /**\r\n * Gets the skybox material created by the helper.\r\n */\r\n get: function () {\r\n return this._skyboxMaterial;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"ground\", {\r\n /**\r\n * Gets the ground mesh created by the helper.\r\n */\r\n get: function () {\r\n return this._ground;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundTexture\", {\r\n /**\r\n * Gets the ground texture created by the helper.\r\n */\r\n get: function () {\r\n return this._groundTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundMirror\", {\r\n /**\r\n * Gets the ground mirror created by the helper.\r\n */\r\n get: function () {\r\n return this._groundMirror;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundMirrorRenderList\", {\r\n /**\r\n * Gets the ground mirror render list to helps pushing the meshes\r\n * you wish in the ground reflection.\r\n */\r\n get: function () {\r\n if (this._groundMirror) {\r\n return this._groundMirror.renderList;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EnvironmentHelper.prototype, \"groundMaterial\", {\r\n /**\r\n * Gets the ground material created by the helper.\r\n */\r\n get: function () {\r\n return this._groundMaterial;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the background according to the new options\r\n * @param options\r\n */\r\n EnvironmentHelper.prototype.updateOptions = function (options) {\r\n var newOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, this._options, options);\r\n if (this._ground && !newOptions.createGround) {\r\n this._ground.dispose();\r\n this._ground = null;\r\n }\r\n if (this._groundMaterial && !newOptions.createGround) {\r\n this._groundMaterial.dispose();\r\n this._groundMaterial = null;\r\n }\r\n if (this._groundTexture) {\r\n if (this._options.groundTexture != newOptions.groundTexture) {\r\n this._groundTexture.dispose();\r\n this._groundTexture = null;\r\n }\r\n }\r\n if (this._skybox && !newOptions.createSkybox) {\r\n this._skybox.dispose();\r\n this._skybox = null;\r\n }\r\n if (this._skyboxMaterial && !newOptions.createSkybox) {\r\n this._skyboxMaterial.dispose();\r\n this._skyboxMaterial = null;\r\n }\r\n if (this._skyboxTexture) {\r\n if (this._options.skyboxTexture != newOptions.skyboxTexture) {\r\n this._skyboxTexture.dispose();\r\n this._skyboxTexture = null;\r\n }\r\n }\r\n if (this._groundMirror && !newOptions.enableGroundMirror) {\r\n this._groundMirror.dispose();\r\n this._groundMirror = null;\r\n }\r\n if (this._scene.environmentTexture) {\r\n if (this._options.environmentTexture != newOptions.environmentTexture) {\r\n this._scene.environmentTexture.dispose();\r\n }\r\n }\r\n this._options = newOptions;\r\n this._setupBackground();\r\n this._setupImageProcessing();\r\n };\r\n /**\r\n * Sets the primary color of all the available elements.\r\n * @param color the main color to affect to the ground and the background\r\n */\r\n EnvironmentHelper.prototype.setMainColor = function (color) {\r\n if (this.groundMaterial) {\r\n this.groundMaterial.primaryColor = color;\r\n }\r\n if (this.skyboxMaterial) {\r\n this.skyboxMaterial.primaryColor = color;\r\n }\r\n if (this.groundMirror) {\r\n this.groundMirror.clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](color.r, color.g, color.b, 1.0);\r\n }\r\n };\r\n /**\r\n * Setup the image processing according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupImageProcessing = function () {\r\n if (this._options.setupImageProcessing) {\r\n this._scene.imageProcessingConfiguration.contrast = this._options.cameraContrast;\r\n this._scene.imageProcessingConfiguration.exposure = this._options.cameraExposure;\r\n this._scene.imageProcessingConfiguration.toneMappingEnabled = this._options.toneMappingEnabled;\r\n this._setupEnvironmentTexture();\r\n }\r\n };\r\n /**\r\n * Setup the environment texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupEnvironmentTexture = function () {\r\n if (this._scene.environmentTexture) {\r\n return;\r\n }\r\n if (this._options.environmentTexture instanceof _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__[\"BaseTexture\"]) {\r\n this._scene.environmentTexture = this._options.environmentTexture;\r\n return;\r\n }\r\n var environmentTexture = _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"].CreateFromPrefilteredData(this._options.environmentTexture, this._scene);\r\n this._scene.environmentTexture = environmentTexture;\r\n };\r\n /**\r\n * Setup the background according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupBackground = function () {\r\n if (!this._rootMesh) {\r\n this._rootMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"](\"BackgroundHelper\", this._scene);\r\n }\r\n this._rootMesh.rotation.y = this._options.backgroundYRotation;\r\n var sceneSize = this._getSceneSize();\r\n if (this._options.createGround) {\r\n this._setupGround(sceneSize);\r\n this._setupGroundMaterial();\r\n this._setupGroundDiffuseTexture();\r\n if (this._options.enableGroundMirror) {\r\n this._setupGroundMirrorTexture(sceneSize);\r\n }\r\n this._setupMirrorInGroundMaterial();\r\n }\r\n if (this._options.createSkybox) {\r\n this._setupSkybox(sceneSize);\r\n this._setupSkyboxMaterial();\r\n this._setupSkyboxReflectionTexture();\r\n }\r\n this._rootMesh.position.x = sceneSize.rootPosition.x;\r\n this._rootMesh.position.z = sceneSize.rootPosition.z;\r\n this._rootMesh.position.y = sceneSize.rootPosition.y;\r\n };\r\n /**\r\n * Get the scene sizes according to the setup.\r\n */\r\n EnvironmentHelper.prototype._getSceneSize = function () {\r\n var _this = this;\r\n var groundSize = this._options.groundSize;\r\n var skyboxSize = this._options.skyboxSize;\r\n var rootPosition = this._options.rootPosition;\r\n if (!this._scene.meshes || this._scene.meshes.length === 1) { // 1 only means the root of the helper.\r\n return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };\r\n }\r\n var sceneExtends = this._scene.getWorldExtends(function (mesh) {\r\n return (mesh !== _this._ground && mesh !== _this._rootMesh && mesh !== _this._skybox);\r\n });\r\n var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);\r\n if (this._options.sizeAuto) {\r\n if (this._scene.activeCamera instanceof _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_2__[\"ArcRotateCamera\"] &&\r\n this._scene.activeCamera.upperRadiusLimit) {\r\n groundSize = this._scene.activeCamera.upperRadiusLimit * 2;\r\n skyboxSize = groundSize;\r\n }\r\n var sceneDiagonalLenght = sceneDiagonal.length();\r\n if (sceneDiagonalLenght > groundSize) {\r\n groundSize = sceneDiagonalLenght * 2;\r\n skyboxSize = groundSize;\r\n }\r\n // 10 % bigger.\r\n groundSize *= 1.1;\r\n skyboxSize *= 1.5;\r\n rootPosition = sceneExtends.min.add(sceneDiagonal.scale(0.5));\r\n rootPosition.y = sceneExtends.min.y - this._options.groundYBias;\r\n }\r\n return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };\r\n };\r\n /**\r\n * Setup the ground according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGround = function (sceneSize) {\r\n var _this = this;\r\n if (!this._ground || this._ground.isDisposed()) {\r\n this._ground = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreatePlane(\"BackgroundPlane\", sceneSize.groundSize, this._scene);\r\n this._ground.rotation.x = Math.PI / 2; // Face up by default.\r\n this._ground.parent = this._rootMesh;\r\n this._ground.onDisposeObservable.add(function () { _this._ground = null; });\r\n }\r\n this._ground.receiveShadows = this._options.enableGroundShadow;\r\n };\r\n /**\r\n * Setup the ground material according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGroundMaterial = function () {\r\n if (!this._groundMaterial) {\r\n this._groundMaterial = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_10__[\"BackgroundMaterial\"](\"BackgroundPlaneMaterial\", this._scene);\r\n }\r\n this._groundMaterial.alpha = this._options.groundOpacity;\r\n this._groundMaterial.alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF;\r\n this._groundMaterial.shadowLevel = this._options.groundShadowLevel;\r\n this._groundMaterial.primaryColor = this._options.groundColor;\r\n this._groundMaterial.useRGBColor = false;\r\n this._groundMaterial.enableNoise = true;\r\n if (this._ground) {\r\n this._ground.material = this._groundMaterial;\r\n }\r\n };\r\n /**\r\n * Setup the ground diffuse texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGroundDiffuseTexture = function () {\r\n if (!this._groundMaterial) {\r\n return;\r\n }\r\n if (this._groundTexture) {\r\n return;\r\n }\r\n if (this._options.groundTexture instanceof _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__[\"BaseTexture\"]) {\r\n this._groundMaterial.diffuseTexture = this._options.groundTexture;\r\n return;\r\n }\r\n var diffuseTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"](this._options.groundTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n diffuseTexture.gammaSpace = false;\r\n diffuseTexture.hasAlpha = true;\r\n this._groundMaterial.diffuseTexture = diffuseTexture;\r\n };\r\n /**\r\n * Setup the ground mirror texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupGroundMirrorTexture = function (sceneSize) {\r\n var wrapping = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n if (!this._groundMirror) {\r\n this._groundMirror = new _Materials_Textures_mirrorTexture__WEBPACK_IMPORTED_MODULE_8__[\"MirrorTexture\"](\"BackgroundPlaneMirrorTexture\", { ratio: this._options.groundMirrorSizeRatio }, this._scene, false, this._options.groundMirrorTextureType, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, true);\r\n this._groundMirror.mirrorPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_14__[\"Plane\"](0, -1, 0, sceneSize.rootPosition.y);\r\n this._groundMirror.anisotropicFilteringLevel = 1;\r\n this._groundMirror.wrapU = wrapping;\r\n this._groundMirror.wrapV = wrapping;\r\n this._groundMirror.gammaSpace = false;\r\n if (this._groundMirror.renderList) {\r\n for (var i = 0; i < this._scene.meshes.length; i++) {\r\n var mesh = this._scene.meshes[i];\r\n if (mesh !== this._ground &&\r\n mesh !== this._skybox &&\r\n mesh !== this._rootMesh) {\r\n this._groundMirror.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n }\r\n this._groundMirror.clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](this._options.groundColor.r, this._options.groundColor.g, this._options.groundColor.b, 1);\r\n this._groundMirror.adaptiveBlurKernel = this._options.groundMirrorBlurKernel;\r\n };\r\n /**\r\n * Setup the ground to receive the mirror texture.\r\n */\r\n EnvironmentHelper.prototype._setupMirrorInGroundMaterial = function () {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.reflectionTexture = this._groundMirror;\r\n this._groundMaterial.reflectionFresnel = true;\r\n this._groundMaterial.reflectionAmount = this._options.groundMirrorAmount;\r\n this._groundMaterial.reflectionStandardFresnelWeight = this._options.groundMirrorFresnelWeight;\r\n this._groundMaterial.reflectionFalloffDistance = this._options.groundMirrorFallOffDistance;\r\n }\r\n };\r\n /**\r\n * Setup the skybox according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupSkybox = function (sceneSize) {\r\n var _this = this;\r\n if (!this._skybox || this._skybox.isDisposed()) {\r\n this._skybox = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].CreateBox(\"BackgroundSkybox\", sceneSize.skyboxSize, this._scene, undefined, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_5__[\"Mesh\"].BACKSIDE);\r\n this._skybox.onDisposeObservable.add(function () { _this._skybox = null; });\r\n }\r\n this._skybox.parent = this._rootMesh;\r\n };\r\n /**\r\n * Setup the skybox material according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupSkyboxMaterial = function () {\r\n if (!this._skybox) {\r\n return;\r\n }\r\n if (!this._skyboxMaterial) {\r\n this._skyboxMaterial = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_10__[\"BackgroundMaterial\"](\"BackgroundSkyboxMaterial\", this._scene);\r\n }\r\n this._skyboxMaterial.useRGBColor = false;\r\n this._skyboxMaterial.primaryColor = this._options.skyboxColor;\r\n this._skyboxMaterial.enableNoise = true;\r\n this._skybox.material = this._skyboxMaterial;\r\n };\r\n /**\r\n * Setup the skybox reflection texture according to the specified options.\r\n */\r\n EnvironmentHelper.prototype._setupSkyboxReflectionTexture = function () {\r\n if (!this._skyboxMaterial) {\r\n return;\r\n }\r\n if (this._skyboxTexture) {\r\n return;\r\n }\r\n if (this._options.skyboxTexture instanceof _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_6__[\"BaseTexture\"]) {\r\n this._skyboxMaterial.reflectionTexture = this._options.skyboxTexture;\r\n return;\r\n }\r\n this._skyboxTexture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"](this._options.skyboxTexture, this._scene, undefined, undefined, undefined, undefined, this._errorHandler);\r\n this._skyboxTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].SKYBOX_MODE;\r\n this._skyboxTexture.gammaSpace = false;\r\n this._skyboxMaterial.reflectionTexture = this._skyboxTexture;\r\n };\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n EnvironmentHelper.prototype.dispose = function () {\r\n if (this._groundMaterial) {\r\n this._groundMaterial.dispose(true, true);\r\n }\r\n if (this._skyboxMaterial) {\r\n this._skyboxMaterial.dispose(true, true);\r\n }\r\n this._rootMesh.dispose(false);\r\n };\r\n /**\r\n * Default ground texture URL.\r\n */\r\n EnvironmentHelper._groundTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundGround.png\";\r\n /**\r\n * Default skybox texture URL.\r\n */\r\n EnvironmentHelper._skyboxTextureCDNUrl = \"https://assets.babylonjs.com/environments/backgroundSkybox.dds\";\r\n /**\r\n * Default environment texture URL.\r\n */\r\n EnvironmentHelper._environmentTextureCDNUrl = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\r\n return EnvironmentHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/index.ts\":\n/*!**************************!*\\\n !*** ./Helpers/index.ts ***!\n \\**************************/\n/*! exports provided: EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _environmentHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./environmentHelper */ \"./Helpers/environmentHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return _environmentHelper__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentHelper\"]; });\n\n/* harmony import */ var _photoDome__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./photoDome */ \"./Helpers/photoDome.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return _photoDome__WEBPACK_IMPORTED_MODULE_1__[\"PhotoDome\"]; });\n\n/* harmony import */ var _sceneHelpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sceneHelpers */ \"./Helpers/sceneHelpers.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _sceneHelpers__WEBPACK_IMPORTED_MODULE_2__[\"_forceSceneHelpersToBundle\"]; });\n\n/* harmony import */ var _videoDome__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./videoDome */ \"./Helpers/videoDome.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return _videoDome__WEBPACK_IMPORTED_MODULE_3__[\"VideoDome\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/photoDome.ts\":\n/*!******************************!*\\\n !*** ./Helpers/photoDome.ts ***!\n \\******************************/\n/*! exports provided: PhotoDome */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return PhotoDome; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Display a 360 degree photo on an approximately spherical surface, useful for VR applications or skyboxes.\r\n * As a subclass of TransformNode, this allow parenting to the camera with different locations in the scene.\r\n * This class achieves its effect with a Texture and a correctly configured BackgroundMaterial on an inverted sphere.\r\n * Potential additions to this helper include zoom and and non-infinite distance rendering effects.\r\n */\r\nvar PhotoDome = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PhotoDome, _super);\r\n /**\r\n * Create an instance of this class and pass through the parameters to the relevant classes, Texture, StandardMaterial, and Mesh.\r\n * @param name Element's name, child elements will append suffixes for their own names.\r\n * @param urlsOfPhoto defines the url of the photo to display\r\n * @param options defines an object containing optional or exposed sub element properties\r\n * @param onError defines a callback called when an error occured while loading the texture\r\n */\r\n function PhotoDome(name, urlOfPhoto, options, scene, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._useDirectMapping = false;\r\n /**\r\n * Observable raised when an error occured while loading the 360 image\r\n */\r\n _this.onLoadErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._imageMode = PhotoDome.MODE_MONOSCOPIC;\r\n _this._onBeforeCameraRenderObserver = null;\r\n // set defaults and manage values\r\n name = name || \"photoDome\";\r\n options.resolution = (Math.abs(options.resolution) | 0) || 32;\r\n options.size = Math.abs(options.size) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);\r\n if (options.useDirectMapping === undefined) {\r\n _this._useDirectMapping = true;\r\n }\r\n else {\r\n _this._useDirectMapping = options.useDirectMapping;\r\n }\r\n if (options.faceForward === undefined) {\r\n options.faceForward = true;\r\n }\r\n _this._setReady(false);\r\n // create\r\n var material = _this._material = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__[\"BackgroundMaterial\"](name + \"_material\", scene);\r\n _this._mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"].CreateSphere(name + \"_mesh\", options.resolution, options.size, scene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"].BACKSIDE);\r\n // configure material\r\n material.opacityFresnel = false;\r\n material.useEquirectangularFOV = true;\r\n material.fovMultiplier = 1.0;\r\n _this.photoTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"](urlOfPhoto, scene, true, !_this._useDirectMapping, undefined, undefined, function (message, exception) {\r\n _this.onLoadErrorObservable.notifyObservers(message || \"Unknown error occured\");\r\n if (onError) {\r\n onError(message, exception);\r\n }\r\n });\r\n _this.photoTexture.onLoadObservable.addOnce(function () {\r\n _this._setReady(true);\r\n });\r\n // configure mesh\r\n _this._mesh.material = material;\r\n _this._mesh.parent = _this;\r\n // Initial rotation\r\n if (options.faceForward && scene.activeCamera) {\r\n var camera = scene.activeCamera;\r\n var forward = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Forward();\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].TransformNormal(forward, camera.getViewMatrix());\r\n direction.normalize();\r\n _this.rotation.y = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Dot(forward, direction));\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(PhotoDome.prototype, \"photoTexture\", {\r\n /**\r\n * Gets or sets the texture being displayed on the sphere\r\n */\r\n get: function () {\r\n return this._photoTexture;\r\n },\r\n set: function (value) {\r\n if (this._photoTexture === value) {\r\n return;\r\n }\r\n this._photoTexture = value;\r\n if (this._useDirectMapping) {\r\n this._photoTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._photoTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._material.diffuseTexture = this._photoTexture;\r\n }\r\n else {\r\n this._photoTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation\r\n this._photoTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._material.reflectionTexture = this._photoTexture;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhotoDome.prototype, \"fovMultiplier\", {\r\n /**\r\n * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values \"zoom in\" and higher values \"zoom out\".\r\n * Also see the options.resolution property.\r\n */\r\n get: function () {\r\n return this._material.fovMultiplier;\r\n },\r\n set: function (value) {\r\n this._material.fovMultiplier = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhotoDome.prototype, \"imageMode\", {\r\n /**\r\n * Gets or set the current video mode for the video. It can be:\r\n * * PhotoDome.MODE_MONOSCOPIC : Define the image as a Monoscopic panoramic 360 image.\r\n * * PhotoDome.MODE_TOPBOTTOM : Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.\r\n * * PhotoDome.MODE_SIDEBYSIDE : Define the image as a Stereoscopic Side by Side panoramic 360 image.\r\n */\r\n get: function () {\r\n return this._imageMode;\r\n },\r\n set: function (value) {\r\n if (this._imageMode === value) {\r\n return;\r\n }\r\n this._changeImageMode(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n PhotoDome.prototype._changeImageMode = function (value) {\r\n var _this = this;\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._imageMode = value;\r\n // Default Setup and Reset.\r\n this._photoTexture.uScale = 1;\r\n this._photoTexture.vScale = 1;\r\n this._photoTexture.uOffset = 0;\r\n this._photoTexture.vOffset = 0;\r\n switch (value) {\r\n case PhotoDome.MODE_SIDEBYSIDE:\r\n this._photoTexture.uScale = 0.5;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._photoTexture.uOffset = camera.isRightCamera ? 0.5 : 0.0;\r\n });\r\n break;\r\n case PhotoDome.MODE_TOPBOTTOM:\r\n this._photoTexture.vScale = 0.5;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._photoTexture.vOffset = camera.isRightCamera ? 0.5 : 0.0;\r\n });\r\n break;\r\n }\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n PhotoDome.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this._photoTexture.dispose();\r\n this._mesh.dispose();\r\n this._material.dispose();\r\n this.onLoadErrorObservable.clear();\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Define the image as a Monoscopic panoramic 360 image.\r\n */\r\n PhotoDome.MODE_MONOSCOPIC = 0;\r\n /**\r\n * Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.\r\n */\r\n PhotoDome.MODE_TOPBOTTOM = 1;\r\n /**\r\n * Define the image as a Stereoscopic Side by Side panoramic 360 image.\r\n */\r\n PhotoDome.MODE_SIDEBYSIDE = 2;\r\n return PhotoDome;\r\n}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_2__[\"TransformNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/sceneHelpers.ts\":\n/*!*********************************!*\\\n !*** ./Helpers/sceneHelpers.ts ***!\n \\*********************************/\n/*! exports provided: _forceSceneHelpersToBundle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _forceSceneHelpersToBundle; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/PBR/pbrMaterial */ \"./Materials/PBR/pbrMaterial.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _environmentHelper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./environmentHelper */ \"./Helpers/environmentHelper.ts\");\n/* harmony import */ var _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Cameras/freeCamera */ \"./Cameras/freeCamera.ts\");\n/* harmony import */ var _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Cameras/arcRotateCamera */ \"./Cameras/arcRotateCamera.ts\");\n/* harmony import */ var _Cameras_VR_vrExperienceHelper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Cameras/VR/vrExperienceHelper */ \"./Cameras/VR/vrExperienceHelper.ts\");\n/* harmony import */ var _Materials_Textures_Loaders_ddsTextureLoader__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/Textures/Loaders/ddsTextureLoader */ \"./Materials/Textures/Loaders/ddsTextureLoader.ts\");\n/* harmony import */ var _Materials_Textures_Loaders_envTextureLoader__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Materials/Textures/Loaders/envTextureLoader */ \"./Materials/Textures/Loaders/envTextureLoader.ts\");\n/* harmony import */ var _Materials_Textures_Loaders_ktxTextureLoader__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Materials/Textures/Loaders/ktxTextureLoader */ \"./Materials/Textures/Loaders/ktxTextureLoader.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Cameras_XR_webXRDefaultExperience__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Cameras/XR/webXRDefaultExperience */ \"./Cameras/XR/webXRDefaultExperience.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _forceSceneHelpersToBundle = true;\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultLight = function (replace) {\r\n if (replace === void 0) { replace = false; }\r\n // Dispose existing light in replace mode.\r\n if (replace) {\r\n if (this.lights) {\r\n for (var i = 0; i < this.lights.length; i++) {\r\n this.lights[i].dispose();\r\n }\r\n }\r\n }\r\n // Light\r\n if (this.lights.length === 0) {\r\n new _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_7__[\"HemisphericLight\"](\"default light\", _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Up(), this);\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultCamera = function (createArcRotateCamera, replace, attachCameraControls) {\r\n if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }\r\n if (replace === void 0) { replace = false; }\r\n if (attachCameraControls === void 0) { attachCameraControls = false; }\r\n // Dispose existing camera in replace mode.\r\n if (replace) {\r\n if (this.activeCamera) {\r\n this.activeCamera.dispose();\r\n this.activeCamera = null;\r\n }\r\n }\r\n // Camera\r\n if (!this.activeCamera) {\r\n var worldExtends = this.getWorldExtends();\r\n var worldSize = worldExtends.max.subtract(worldExtends.min);\r\n var worldCenter = worldExtends.min.add(worldSize.scale(0.5));\r\n var camera;\r\n var radius = worldSize.length() * 1.5;\r\n // empty scene scenario!\r\n if (!isFinite(radius)) {\r\n radius = 1;\r\n worldCenter.copyFromFloats(0, 0, 0);\r\n }\r\n if (createArcRotateCamera) {\r\n var arcRotateCamera = new _Cameras_arcRotateCamera__WEBPACK_IMPORTED_MODULE_10__[\"ArcRotateCamera\"](\"default camera\", -(Math.PI / 2), Math.PI / 2, radius, worldCenter, this);\r\n arcRotateCamera.lowerRadiusLimit = radius * 0.01;\r\n arcRotateCamera.wheelPrecision = 100 / radius;\r\n camera = arcRotateCamera;\r\n }\r\n else {\r\n var freeCamera = new _Cameras_freeCamera__WEBPACK_IMPORTED_MODULE_9__[\"FreeCamera\"](\"default camera\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](worldCenter.x, worldCenter.y, -radius), this);\r\n freeCamera.setTarget(worldCenter);\r\n camera = freeCamera;\r\n }\r\n camera.minZ = radius * 0.01;\r\n camera.maxZ = radius * 1000;\r\n camera.speed = radius * 0.2;\r\n this.activeCamera = camera;\r\n var canvas = this.getEngine().getRenderingCanvas();\r\n if (attachCameraControls && canvas) {\r\n camera.attachControl(canvas);\r\n }\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultCameraOrLight = function (createArcRotateCamera, replace, attachCameraControls) {\r\n if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }\r\n if (replace === void 0) { replace = false; }\r\n if (attachCameraControls === void 0) { attachCameraControls = false; }\r\n this.createDefaultLight(replace);\r\n this.createDefaultCamera(createArcRotateCamera, replace, attachCameraControls);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultSkybox = function (environmentTexture, pbr, scale, blur, setGlobalEnvTexture) {\r\n if (pbr === void 0) { pbr = false; }\r\n if (scale === void 0) { scale = 1000; }\r\n if (blur === void 0) { blur = 0; }\r\n if (setGlobalEnvTexture === void 0) { setGlobalEnvTexture = true; }\r\n if (!environmentTexture) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Can not create default skybox without environment texture.\");\r\n return null;\r\n }\r\n if (setGlobalEnvTexture) {\r\n if (environmentTexture) {\r\n this.environmentTexture = environmentTexture;\r\n }\r\n }\r\n // Skybox\r\n var hdrSkybox = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"].CreateBox(\"hdrSkyBox\", scale, this);\r\n if (pbr) {\r\n var hdrSkyboxMaterial = new _Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_6__[\"PBRMaterial\"](\"skyBox\", this);\r\n hdrSkyboxMaterial.backFaceCulling = false;\r\n hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();\r\n if (hdrSkyboxMaterial.reflectionTexture) {\r\n hdrSkyboxMaterial.reflectionTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].SKYBOX_MODE;\r\n }\r\n hdrSkyboxMaterial.microSurface = 1.0 - blur;\r\n hdrSkyboxMaterial.disableLighting = true;\r\n hdrSkyboxMaterial.twoSidedLighting = true;\r\n hdrSkybox.infiniteDistance = true;\r\n hdrSkybox.material = hdrSkyboxMaterial;\r\n }\r\n else {\r\n var skyboxMaterial = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__[\"StandardMaterial\"](\"skyBox\", this);\r\n skyboxMaterial.backFaceCulling = false;\r\n skyboxMaterial.reflectionTexture = environmentTexture.clone();\r\n if (skyboxMaterial.reflectionTexture) {\r\n skyboxMaterial.reflectionTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].SKYBOX_MODE;\r\n }\r\n skyboxMaterial.disableLighting = true;\r\n hdrSkybox.infiniteDistance = true;\r\n hdrSkybox.material = skyboxMaterial;\r\n }\r\n hdrSkybox.isPickable = false;\r\n return hdrSkybox;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultEnvironment = function (options) {\r\n if (_environmentHelper__WEBPACK_IMPORTED_MODULE_8__[\"EnvironmentHelper\"]) {\r\n return new _environmentHelper__WEBPACK_IMPORTED_MODULE_8__[\"EnvironmentHelper\"](options, this);\r\n }\r\n return null;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultVRExperience = function (webVROptions) {\r\n if (webVROptions === void 0) { webVROptions = {}; }\r\n return new _Cameras_VR_vrExperienceHelper__WEBPACK_IMPORTED_MODULE_11__[\"VRExperienceHelper\"](this, webVROptions);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.createDefaultXRExperienceAsync = function (options) {\r\n return _Cameras_XR_webXRDefaultExperience__WEBPACK_IMPORTED_MODULE_16__[\"WebXRDefaultExperience\"].CreateAsync(this, options).then(function (helper) {\r\n return helper;\r\n });\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Helpers/videoDome.ts\":\n/*!******************************!*\\\n !*** ./Helpers/videoDome.ts ***!\n \\******************************/\n/*! exports provided: VideoDome */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return VideoDome; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/videoTexture */ \"./Materials/Textures/videoTexture.ts\");\n/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Maths/math */ \"./Maths/math.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Display a 360/180 degree video on an approximately spherical surface, useful for VR applications or skyboxes.\r\n * As a subclass of TransformNode, this allow parenting to the camera or multiple videos with different locations in the scene.\r\n * This class achieves its effect with a VideoTexture and a correctly configured BackgroundMaterial on an inverted sphere.\r\n * Potential additions to this helper include zoom and and non-infinite distance rendering effects.\r\n */\r\nvar VideoDome = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VideoDome, _super);\r\n /**\r\n * Create an instance of this class and pass through the parameters to the relevant classes, VideoTexture, StandardMaterial, and Mesh.\r\n * @param name Element's name, child elements will append suffixes for their own names.\r\n * @param urlsOrVideo defines the url(s) or the video element to use\r\n * @param options An object containing optional or exposed sub element properties\r\n */\r\n function VideoDome(name, urlsOrVideo, options, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._halfDome = false;\r\n _this._useDirectMapping = false;\r\n _this._videoMode = VideoDome.MODE_MONOSCOPIC;\r\n /**\r\n * Oberserver used in Stereoscopic VR Mode.\r\n */\r\n _this._onBeforeCameraRenderObserver = null;\r\n scene = _this.getScene();\r\n // set defaults and manage values\r\n name = name || \"videoDome\";\r\n options.resolution = (Math.abs(options.resolution) | 0) || 32;\r\n options.clickToPlay = Boolean(options.clickToPlay);\r\n options.autoPlay = options.autoPlay === undefined ? true : Boolean(options.autoPlay);\r\n options.loop = options.loop === undefined ? true : Boolean(options.loop);\r\n options.size = Math.abs(options.size) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);\r\n if (options.useDirectMapping === undefined) {\r\n _this._useDirectMapping = true;\r\n }\r\n else {\r\n _this._useDirectMapping = options.useDirectMapping;\r\n }\r\n if (options.faceForward === undefined) {\r\n options.faceForward = true;\r\n }\r\n _this._setReady(false);\r\n // create\r\n var tempOptions = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };\r\n var material = _this._material = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__[\"BackgroundMaterial\"](name + \"_material\", scene);\r\n var texture = _this._videoTexture = new _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_4__[\"VideoTexture\"](name + \"_texture\", urlsOrVideo, scene, false, _this._useDirectMapping, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].TRILINEAR_SAMPLINGMODE, tempOptions);\r\n _this._mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateSphere(name + \"_mesh\", options.resolution, options.size, scene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BACKSIDE);\r\n texture.onLoadObservable.addOnce(function () {\r\n _this._setReady(true);\r\n });\r\n // configure material\r\n material.useEquirectangularFOV = true;\r\n material.fovMultiplier = 1.0;\r\n material.opacityFresnel = false;\r\n if (_this._useDirectMapping) {\r\n texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n material.diffuseTexture = texture;\r\n }\r\n else {\r\n texture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n material.reflectionTexture = texture;\r\n }\r\n // configure mesh\r\n _this._mesh.material = material;\r\n _this._mesh.parent = _this;\r\n // create a (disabled until needed) mask to cover unneeded segments of 180 videos.\r\n _this._halfDomeMask = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__[\"SphereBuilder\"].CreateSphere(\"\", { slice: 0.5, diameter: options.size * 0.99, segments: options.resolution, sideOrientation: _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BACKSIDE }, scene);\r\n _this._halfDomeMask.rotate(_Maths_math__WEBPACK_IMPORTED_MODULE_8__[\"Axis\"].X, -Math.PI / 2);\r\n // set the parent, so it will always be positioned correctly AND will be disposed when the main sphere is disposed\r\n _this._halfDomeMask.parent = _this._mesh;\r\n _this._halfDome = !!options.halfDomeMode;\r\n // enable or disable according to the settings\r\n _this._halfDomeMask.setEnabled(_this._halfDome);\r\n // optional configuration\r\n if (options.clickToPlay) {\r\n scene.onPointerUp = function () {\r\n _this._videoTexture.video.play();\r\n };\r\n }\r\n // Initial rotation\r\n if (options.faceForward && scene.activeCamera) {\r\n var camera = scene.activeCamera;\r\n var forward = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Forward();\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].TransformNormal(forward, camera.getViewMatrix());\r\n direction.normalize();\r\n _this.rotation.y = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].Dot(forward, direction));\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(VideoDome.prototype, \"videoTexture\", {\r\n /**\r\n * Gets the video texture being displayed on the sphere\r\n */\r\n get: function () {\r\n return this._videoTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VideoDome.prototype, \"fovMultiplier\", {\r\n /**\r\n * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values \"zoom in\" and higher values \"zoom out\".\r\n * Also see the options.resolution property.\r\n */\r\n get: function () {\r\n return this._material.fovMultiplier;\r\n },\r\n set: function (value) {\r\n this._material.fovMultiplier = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VideoDome.prototype, \"videoMode\", {\r\n /**\r\n * Gets or set the current video mode for the video. It can be:\r\n * * VideoDome.MODE_MONOSCOPIC : Define the video source as a Monoscopic panoramic 360 video.\r\n * * VideoDome.MODE_TOPBOTTOM : Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.\r\n * * VideoDome.MODE_SIDEBYSIDE : Define the video source as a Stereoscopic Side by Side panoramic 360 video.\r\n */\r\n get: function () {\r\n return this._videoMode;\r\n },\r\n set: function (value) {\r\n if (this._videoMode === value) {\r\n return;\r\n }\r\n this._changeVideoMode(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VideoDome.prototype, \"halfDome\", {\r\n /**\r\n * Is the video a 180 degrees video (half dome) or 360 video (full dome)\r\n *\r\n */\r\n get: function () {\r\n return this._halfDome;\r\n },\r\n /**\r\n * Set the halfDome mode. If set, only the front (180 degrees) will be displayed and the back will be blacked out.\r\n */\r\n set: function (enabled) {\r\n this._halfDome = enabled;\r\n this._halfDomeMask.setEnabled(enabled);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VideoDome.prototype._changeVideoMode = function (value) {\r\n var _this = this;\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._videoMode = value;\r\n // Default Setup and Reset.\r\n this._videoTexture.uScale = 1;\r\n this._videoTexture.vScale = 1;\r\n this._videoTexture.uOffset = 0;\r\n this._videoTexture.vOffset = 0;\r\n switch (value) {\r\n case VideoDome.MODE_SIDEBYSIDE:\r\n // in half-dome mode the uScale should be double of 360 videos\r\n // Use 0.99999 to boost perf by not switching program\r\n this._videoTexture.uScale = this._halfDome ? 0.99999 : 0.5;\r\n var rightOffset_1 = this._halfDome ? 0.0 : 0.5;\r\n var leftOffset_1 = this._halfDome ? 0.5 : 0.0;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._videoTexture.uOffset = camera.isRightCamera ? rightOffset_1 : leftOffset_1;\r\n });\r\n break;\r\n case VideoDome.MODE_TOPBOTTOM:\r\n // in half-dome mode the vScale should be double of 360 videos\r\n // Use 0.99999 to boost perf by not switching program\r\n this._videoTexture.vScale = this._halfDome ? 0.99999 : 0.5;\r\n this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._videoTexture.vOffset = camera.isRightCamera ? 0.5 : 0.0;\r\n });\r\n break;\r\n }\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n VideoDome.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this._videoTexture.dispose();\r\n this._mesh.dispose();\r\n this._material.dispose();\r\n this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Define the video source as a Monoscopic panoramic 360 video.\r\n */\r\n VideoDome.MODE_MONOSCOPIC = 0;\r\n /**\r\n * Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.\r\n */\r\n VideoDome.MODE_TOPBOTTOM = 1;\r\n /**\r\n * Define the video source as a Stereoscopic Side by Side panoramic 360 video.\r\n */\r\n VideoDome.MODE_SIDEBYSIDE = 2;\r\n return VideoDome;\r\n}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__[\"TransformNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Inputs/scene.inputManager.ts\":\n/*!**************************************!*\\\n !*** ./Inputs/scene.inputManager.ts ***!\n \\**************************************/\n/*! exports provided: InputManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InputManager\", function() { return InputManager; });\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Actions/abstractActionManager */ \"./Actions/abstractActionManager.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Actions/actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Events/keyboardEvents */ \"./Events/keyboardEvents.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _ClickInfo = /** @class */ (function () {\r\n function _ClickInfo() {\r\n this._singleClick = false;\r\n this._doubleClick = false;\r\n this._hasSwiped = false;\r\n this._ignore = false;\r\n }\r\n Object.defineProperty(_ClickInfo.prototype, \"singleClick\", {\r\n get: function () {\r\n return this._singleClick;\r\n },\r\n set: function (b) {\r\n this._singleClick = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"doubleClick\", {\r\n get: function () {\r\n return this._doubleClick;\r\n },\r\n set: function (b) {\r\n this._doubleClick = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"hasSwiped\", {\r\n get: function () {\r\n return this._hasSwiped;\r\n },\r\n set: function (b) {\r\n this._hasSwiped = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"ignore\", {\r\n get: function () {\r\n return this._ignore;\r\n },\r\n set: function (b) {\r\n this._ignore = b;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return _ClickInfo;\r\n}());\r\n/**\r\n * Class used to manage all inputs for the scene.\r\n */\r\nvar InputManager = /** @class */ (function () {\r\n /**\r\n * Creates a new InputManager\r\n * @param scene defines the hosting scene\r\n */\r\n function InputManager(scene) {\r\n // Pointers\r\n this._wheelEventName = \"\";\r\n this._meshPickProceed = false;\r\n this._currentPickResult = null;\r\n this._previousPickResult = null;\r\n this._totalPointersPressed = 0;\r\n this._doubleClickOccured = false;\r\n this._pointerX = 0;\r\n this._pointerY = 0;\r\n this._startingPointerPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 0);\r\n this._previousStartingPointerPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 0);\r\n this._startingPointerTime = 0;\r\n this._previousStartingPointerTime = 0;\r\n this._pointerCaptures = {};\r\n this._scene = scene;\r\n }\r\n Object.defineProperty(InputManager.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._pointerOverMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates in 2D without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerX;\r\n },\r\n set: function (value) {\r\n this._pointerX = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerY;\r\n },\r\n set: function (value) {\r\n this._pointerY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InputManager.prototype._updatePointerPosition = function (evt) {\r\n var canvasRect = this._scene.getEngine().getRenderingCanvasClientRect();\r\n if (!canvasRect) {\r\n return;\r\n }\r\n this._pointerX = evt.clientX - canvasRect.left;\r\n this._pointerY = evt.clientY - canvasRect.top;\r\n this._unTranslatedPointerX = this._pointerX;\r\n this._unTranslatedPointerY = this._pointerY;\r\n };\r\n InputManager.prototype._processPointerMove = function (pickResult, evt) {\r\n var scene = this._scene;\r\n var canvas = scene.getEngine().getRenderingCanvas();\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.tabIndex = 1;\r\n // Restore pointer\r\n canvas.style.cursor = scene.defaultCursor;\r\n var isMeshPicked = (pickResult && pickResult.hit && pickResult.pickedMesh) ? true : false;\r\n if (isMeshPicked) {\r\n scene.setPointerOverMesh(pickResult.pickedMesh);\r\n if (this._pointerOverMesh && this._pointerOverMesh.actionManager && this._pointerOverMesh.actionManager.hasPointerTriggers) {\r\n if (this._pointerOverMesh.actionManager.hoverCursor) {\r\n canvas.style.cursor = this._pointerOverMesh.actionManager.hoverCursor;\r\n }\r\n else {\r\n canvas.style.cursor = scene.hoverCursor;\r\n }\r\n }\r\n }\r\n else {\r\n scene.setPointerOverMesh(null);\r\n }\r\n for (var _i = 0, _a = scene._pointerMoveStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, isMeshPicked, canvas);\r\n }\r\n if (pickResult) {\r\n var type = evt.type === this._wheelEventName ? _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERWHEEL : _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERMOVE;\r\n if (scene.onPointerMove) {\r\n scene.onPointerMove(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n // Pointers handling\r\n InputManager.prototype._setRayOnPointerInfo = function (pointerInfo) {\r\n var scene = this._scene;\r\n if (pointerInfo.pickInfo && !pointerInfo.pickInfo._pickingUnavailable) {\r\n if (!pointerInfo.pickInfo.ray) {\r\n pointerInfo.pickInfo.ray = scene.createPickingRay(pointerInfo.event.offsetX, pointerInfo.event.offsetY, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity(), scene.activeCamera);\r\n }\r\n }\r\n };\r\n InputManager.prototype._checkPrePointerObservable = function (pickResult, evt, type) {\r\n var scene = this._scene;\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfoPre\"](type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n if (pickResult) {\r\n pi.ray = pickResult.ray;\r\n }\r\n scene.onPrePointerObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointermove\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERMOVE)) {\r\n return;\r\n }\r\n this._processPointerMove(pickResult, evt);\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointerdown\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN)) {\r\n return;\r\n }\r\n this._processPointerDown(pickResult, evt);\r\n };\r\n InputManager.prototype._processPointerDown = function (pickResult, evt) {\r\n var _this = this;\r\n var scene = this._scene;\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh) {\r\n this._pickedDownMesh = pickResult.pickedMesh;\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager) {\r\n if (actionManager.hasPickTriggers) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickDownTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n switch (evt.button) {\r\n case 0:\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLeftPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 1:\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnCenterPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 2:\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnRightPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n }\r\n }\r\n if (actionManager.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLongPressTrigger)) {\r\n window.setTimeout(function () {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, function (mesh) { return (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLongPressTrigger) && mesh == _this._pickedDownMesh); }, false, scene.cameraToUseForPointers);\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && actionManager) {\r\n if (_this._totalPointersPressed !== 0 &&\r\n ((Date.now() - _this._startingPointerTime) > InputManager.LongPressDelay) &&\r\n !_this._isPointerSwiping()) {\r\n _this._startingPointerTime = 0;\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnLongPressTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }, InputManager.LongPressDelay);\r\n }\r\n }\r\n }\r\n else {\r\n for (var _i = 0, _a = scene._pointerDownStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n if (pickResult) {\r\n var type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN;\r\n if (scene.onPointerDown) {\r\n scene.onPointerDown(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputManager.prototype._isPointerSwiping = function () {\r\n return Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold ||\r\n Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n */\r\n InputManager.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n var evt = new PointerEvent(\"pointerup\", pointerEventInit);\r\n var clickInfo = new _ClickInfo();\r\n if (doubleTap) {\r\n clickInfo.doubleClick = true;\r\n }\r\n else {\r\n clickInfo.singleClick = true;\r\n }\r\n if (this._checkPrePointerObservable(pickResult, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP)) {\r\n return;\r\n }\r\n this._processPointerUp(pickResult, evt, clickInfo);\r\n };\r\n InputManager.prototype._processPointerUp = function (pickResult, evt, clickInfo) {\r\n var scene = this._scene;\r\n if (pickResult && pickResult && pickResult.pickedMesh) {\r\n this._pickedUpMesh = pickResult.pickedMesh;\r\n if (this._pickedDownMesh === this._pickedUpMesh) {\r\n if (scene.onPointerPick) {\r\n scene.onPointerPick(evt, pickResult);\r\n }\r\n if (clickInfo.singleClick && !clickInfo.ignore && scene.onPointerObservable.hasObservers()) {\r\n var type_1 = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERPICK;\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type_1, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type_1);\r\n }\r\n }\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager && !clickInfo.ignore) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickUpTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n if (!clickInfo.hasSwiped && clickInfo.singleClick) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n var doubleClickActionManager = pickResult.pickedMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger);\r\n if (clickInfo.doubleClick && doubleClickActionManager) {\r\n doubleClickActionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }\r\n else {\r\n if (!clickInfo.ignore) {\r\n for (var _i = 0, _a = scene._pointerUpStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n }\r\n if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) {\r\n var pickedDownActionManager = this._pickedDownMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickOutTrigger);\r\n if (pickedDownActionManager) {\r\n pickedDownActionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPickOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(this._pickedDownMesh, evt));\r\n }\r\n }\r\n var type = 0;\r\n if (scene.onPointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore && !clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)) {\r\n type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP;\r\n }\r\n else if (clickInfo.doubleClick && scene.onPointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP)) {\r\n type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP;\r\n }\r\n if (type) {\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (!clickInfo.ignore) {\r\n type = _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP;\r\n var pi = new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"](type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (scene.onPointerUp && !clickInfo.ignore) {\r\n scene.onPointerUp(evt, pickResult, type);\r\n }\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n InputManager.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._pointerCaptures[pointerId];\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n */\r\n InputManager.prototype.attachControl = function (attachUp, attachDown, attachMove) {\r\n var _this = this;\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n var scene = this._scene;\r\n var canvas = scene.getEngine().getRenderingCanvas();\r\n if (!canvas) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n this._initActionManager = function (act, clickInfo) {\r\n if (!_this._meshPickProceed) {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._currentPickResult = pickResult;\r\n if (pickResult) {\r\n act = (pickResult.hit && pickResult.pickedMesh) ? pickResult.pickedMesh._getActionManagerForTrigger() : null;\r\n }\r\n _this._meshPickProceed = true;\r\n }\r\n return act;\r\n };\r\n this._delayedSimpleClick = function (btn, clickInfo, cb) {\r\n // double click delay is over and that no double click has been raised since, or the 2 consecutive keys pressed are different\r\n if ((Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay && !_this._doubleClickOccured) ||\r\n btn !== _this._previousButtonPressed) {\r\n _this._doubleClickOccured = false;\r\n clickInfo.singleClick = true;\r\n clickInfo.ignore = false;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._initClickEvent = function (obs1, obs2, evt, cb) {\r\n var clickInfo = new _ClickInfo();\r\n _this._currentPickResult = null;\r\n var act = null;\r\n var checkPicking = obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERPICK) || obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERPICK)\r\n || obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP) || obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)\r\n || obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP) || obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP);\r\n if (!checkPicking && _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"]) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkPicking = act.hasPickTriggers;\r\n }\r\n }\r\n var needToIgnoreNext = false;\r\n if (checkPicking) {\r\n var btn = evt.button;\r\n clickInfo.hasSwiped = _this._isPointerSwiping();\r\n if (!clickInfo.hasSwiped) {\r\n var checkSingleClickImmediately = !InputManager.ExclusiveDoubleClickMode;\r\n if (!checkSingleClickImmediately) {\r\n checkSingleClickImmediately = !obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP) &&\r\n !obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP);\r\n if (checkSingleClickImmediately && !_Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"].HasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkSingleClickImmediately = !act.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger);\r\n }\r\n }\r\n }\r\n if (checkSingleClickImmediately) {\r\n // single click detected if double click delay is over or two different successive keys pressed without exclusive double click or no double click required\r\n if (Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay ||\r\n btn !== _this._previousButtonPressed) {\r\n clickInfo.singleClick = true;\r\n cb(clickInfo, _this._currentPickResult);\r\n needToIgnoreNext = true;\r\n }\r\n }\r\n // at least one double click is required to be check and exclusive double click is enabled\r\n else {\r\n // wait that no double click has been raised during the double click delay\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n _this._delayedSimpleClickTimeout = window.setTimeout(_this._delayedSimpleClick.bind(_this, btn, clickInfo, cb), InputManager.DoubleClickDelay);\r\n }\r\n var checkDoubleClick = obs1.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP) ||\r\n obs2.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP);\r\n if (!checkDoubleClick && _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"].HasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkDoubleClick = act.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnDoublePickTrigger);\r\n }\r\n }\r\n if (checkDoubleClick) {\r\n // two successive keys pressed are equal, double click delay is not over and double click has not just occurred\r\n if (btn === _this._previousButtonPressed &&\r\n Date.now() - _this._previousStartingPointerTime < InputManager.DoubleClickDelay &&\r\n !_this._doubleClickOccured) {\r\n // pointer has not moved for 2 clicks, it's a double click\r\n if (!clickInfo.hasSwiped &&\r\n !_this._isPointerSwiping()) {\r\n _this._previousStartingPointerTime = 0;\r\n _this._doubleClickOccured = true;\r\n clickInfo.doubleClick = true;\r\n clickInfo.ignore = false;\r\n if (InputManager.ExclusiveDoubleClickMode && _this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n // if the two successive clicks are too far, it's just two simple clicks\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n if (InputManager.ExclusiveDoubleClickMode) {\r\n if (_this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._previousPickResult);\r\n }\r\n else {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n }\r\n needToIgnoreNext = true;\r\n }\r\n // just the first click of the double has been raised\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n }\r\n }\r\n }\r\n }\r\n if (!needToIgnoreNext) {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._onPointerMove = function (evt) {\r\n _this._updatePointerPosition(evt);\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, evt.type === _this._wheelEventName ? _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERWHEEL : _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERMOVE)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerMovePredicate) {\r\n scene.pointerMovePredicate = function (mesh) { return (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (mesh.enablePointerMoveEvents || scene.constantlyUpdateMeshUnderPointer || (mesh._getActionManagerForTrigger() != null)) && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0)); };\r\n }\r\n // Meshes\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerMovePredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerMove(pickResult, evt);\r\n };\r\n this._onPointerDown = function (evt) {\r\n _this._totalPointersPressed++;\r\n _this._pickedDownMesh = null;\r\n _this._meshPickProceed = false;\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerDown && canvas) {\r\n evt.preventDefault();\r\n canvas.focus();\r\n }\r\n _this._startingPointerPosition.x = _this._pointerX;\r\n _this._startingPointerPosition.y = _this._pointerY;\r\n _this._startingPointerTime = Date.now();\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOWN)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = true;\r\n if (!scene.pointerDownPredicate) {\r\n scene.pointerDownPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n _this._pickedDownMesh = null;\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerDown(pickResult, evt);\r\n };\r\n this._onPointerUp = function (evt) {\r\n if (_this._totalPointersPressed === 0) { // We are attaching the pointer up to windows because of a bug in FF\r\n return; // So we need to test it the pointer down was pressed before.\r\n }\r\n _this._totalPointersPressed--;\r\n _this._pickedUpMesh = null;\r\n _this._meshPickProceed = false;\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerUp && canvas) {\r\n evt.preventDefault();\r\n canvas.focus();\r\n }\r\n _this._initClickEvent(scene.onPrePointerObservable, scene.onPointerObservable, evt, function (clickInfo, pickResult) {\r\n // PreObservable support\r\n if (scene.onPrePointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore) {\r\n if (!clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPrePointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERTAP)) {\r\n return;\r\n }\r\n }\r\n if (clickInfo.doubleClick && scene.onPrePointerObservable.hasSpecificMask(_Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERDOUBLETAP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (_this._checkPrePointerObservable(null, evt, _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"].POINTERUP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (!_this._pointerCaptures[evt.pointerId]) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = false;\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerUpPredicate) {\r\n scene.pointerUpPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n if (!_this._meshPickProceed && (_Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"] && _Actions_abstractActionManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"].HasTriggers || scene.onPointerObservable.hasObservers())) {\r\n _this._initActionManager(null, clickInfo);\r\n }\r\n if (!pickResult) {\r\n pickResult = _this._currentPickResult;\r\n }\r\n _this._processPointerUp(pickResult, evt, clickInfo);\r\n _this._previousPickResult = _this._currentPickResult;\r\n });\r\n };\r\n this._onKeyDown = function (evt) {\r\n var type = _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardEventTypes\"].KEYDOWN;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfoPre\"](type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfo\"](type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnKeyDownTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n this._onKeyUp = function (evt) {\r\n var type = _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardEventTypes\"].KEYUP;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfoPre\"](type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new _Events_keyboardEvents__WEBPACK_IMPORTED_MODULE_6__[\"KeyboardInfo\"](type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnKeyUpTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n // Keyboard events\r\n this._onCanvasFocusObserver = engine.onCanvasFocusObservable.add((function () {\r\n var fn = function () {\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.addEventListener(\"keydown\", _this._onKeyDown, false);\r\n canvas.addEventListener(\"keyup\", _this._onKeyUp, false);\r\n };\r\n if (document.activeElement === canvas) {\r\n fn();\r\n }\r\n return fn;\r\n })());\r\n this._onCanvasBlurObserver = engine.onCanvasBlurObservable.add(function () {\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.removeEventListener(\"keydown\", _this._onKeyDown);\r\n canvas.removeEventListener(\"keyup\", _this._onKeyUp);\r\n });\r\n // Pointer events\r\n var eventPrefix = _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].GetPointerPrefix();\r\n if (attachMove) {\r\n canvas.addEventListener(eventPrefix + \"move\", this._onPointerMove, false);\r\n // Wheel\r\n this._wheelEventName = \"onwheel\" in document.createElement(\"div\") ? \"wheel\" : // Modern browsers support \"wheel\"\r\n document.onmousewheel !== undefined ? \"mousewheel\" : // Webkit and IE support at least \"mousewheel\"\r\n \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n canvas.addEventListener(this._wheelEventName, this._onPointerMove, false);\r\n }\r\n if (attachDown) {\r\n canvas.addEventListener(eventPrefix + \"down\", this._onPointerDown, false);\r\n }\r\n if (attachUp) {\r\n var hostWindow = scene.getEngine().getHostWindow();\r\n hostWindow.addEventListener(eventPrefix + \"up\", this._onPointerUp, false);\r\n }\r\n };\r\n /**\r\n * Detaches all event handlers\r\n */\r\n InputManager.prototype.detachControl = function () {\r\n var eventPrefix = _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].GetPointerPrefix();\r\n var canvas = this._scene.getEngine().getRenderingCanvas();\r\n var engine = this._scene.getEngine();\r\n if (!canvas) {\r\n return;\r\n }\r\n // Pointer\r\n canvas.removeEventListener(eventPrefix + \"move\", this._onPointerMove);\r\n canvas.removeEventListener(this._wheelEventName, this._onPointerMove);\r\n canvas.removeEventListener(eventPrefix + \"down\", this._onPointerDown);\r\n window.removeEventListener(eventPrefix + \"up\", this._onPointerUp);\r\n // Blur / Focus\r\n if (this._onCanvasBlurObserver) {\r\n engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n if (this._onCanvasFocusObserver) {\r\n engine.onCanvasFocusObservable.remove(this._onCanvasFocusObserver);\r\n }\r\n // Keyboard\r\n canvas.removeEventListener(\"keydown\", this._onKeyDown);\r\n canvas.removeEventListener(\"keyup\", this._onKeyUp);\r\n // Cursor\r\n canvas.style.cursor = this._scene.defaultCursor;\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n */\r\n InputManager.prototype.setPointerOverMesh = function (mesh) {\r\n if (this._pointerOverMesh === mesh) {\r\n return;\r\n }\r\n var actionManager;\r\n if (this._pointerOverMesh) {\r\n actionManager = this._pointerOverMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOutTrigger);\r\n if (actionManager) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(this._pointerOverMesh));\r\n }\r\n }\r\n this._pointerOverMesh = mesh;\r\n if (this._pointerOverMesh) {\r\n actionManager = this._pointerOverMesh._getActionManagerForTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOverTrigger);\r\n if (actionManager) {\r\n actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ACTION_OnPointerOverTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_4__[\"ActionEvent\"].CreateNew(this._pointerOverMesh));\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n InputManager.prototype.getPointerOverMesh = function () {\r\n return this._pointerOverMesh;\r\n };\r\n /** The distance in pixel that you have to move to prevent some events */\r\n InputManager.DragMovementThreshold = 10; // in pixels\r\n /** Time in milliseconds to wait to raise long press events if button is still pressed */\r\n InputManager.LongPressDelay = 500; // in milliseconds\r\n /** Time in milliseconds with two consecutive clicks will be considered as a double click */\r\n InputManager.DoubleClickDelay = 300; // in milliseconds\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n InputManager.ExclusiveDoubleClickMode = false;\r\n return InputManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/engineInstrumentation.ts\":\n/*!**************************************************!*\\\n !*** ./Instrumentation/engineInstrumentation.ts ***!\n \\**************************************************/\n/*! exports provided: EngineInstrumentation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return EngineInstrumentation; });\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n\r\n/**\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n */\r\nvar EngineInstrumentation = /** @class */ (function () {\r\n /**\r\n * Instantiates a new engine instrumentation.\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n * @param engine Defines the engine to instrument\r\n */\r\n function EngineInstrumentation(\r\n /**\r\n * Define the instrumented engine.\r\n */\r\n engine) {\r\n this.engine = engine;\r\n this._captureGPUFrameTime = false;\r\n this._gpuFrameTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_0__[\"PerfCounter\"]();\r\n this._captureShaderCompilationTime = false;\r\n this._shaderCompilationTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_0__[\"PerfCounter\"]();\r\n // Observers\r\n this._onBeginFrameObserver = null;\r\n this._onEndFrameObserver = null;\r\n this._onBeforeShaderCompilationObserver = null;\r\n this._onAfterShaderCompilationObserver = null;\r\n }\r\n Object.defineProperty(EngineInstrumentation.prototype, \"gpuFrameTimeCounter\", {\r\n // Properties\r\n /**\r\n * Gets the perf counter used for GPU frame time\r\n */\r\n get: function () {\r\n return this._gpuFrameTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineInstrumentation.prototype, \"captureGPUFrameTime\", {\r\n /**\r\n * Gets the GPU frame time capture status\r\n */\r\n get: function () {\r\n return this._captureGPUFrameTime;\r\n },\r\n /**\r\n * Enable or disable the GPU frame time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureGPUFrameTime) {\r\n return;\r\n }\r\n this._captureGPUFrameTime = value;\r\n if (value) {\r\n this._onBeginFrameObserver = this.engine.onBeginFrameObservable.add(function () {\r\n if (!_this._gpuFrameTimeToken) {\r\n _this._gpuFrameTimeToken = _this.engine.startTimeQuery();\r\n }\r\n });\r\n this._onEndFrameObserver = this.engine.onEndFrameObservable.add(function () {\r\n if (!_this._gpuFrameTimeToken) {\r\n return;\r\n }\r\n var time = _this.engine.endTimeQuery(_this._gpuFrameTimeToken);\r\n if (time > -1) {\r\n _this._gpuFrameTimeToken = null;\r\n _this._gpuFrameTime.fetchNewFrame();\r\n _this._gpuFrameTime.addCount(time, true);\r\n }\r\n });\r\n }\r\n else {\r\n this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.engine.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineInstrumentation.prototype, \"shaderCompilationTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for shader compilation time\r\n */\r\n get: function () {\r\n return this._shaderCompilationTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineInstrumentation.prototype, \"captureShaderCompilationTime\", {\r\n /**\r\n * Gets the shader compilation time capture status\r\n */\r\n get: function () {\r\n return this._captureShaderCompilationTime;\r\n },\r\n /**\r\n * Enable or disable the shader compilation time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureShaderCompilationTime) {\r\n return;\r\n }\r\n this._captureShaderCompilationTime = value;\r\n if (value) {\r\n this._onBeforeShaderCompilationObserver = this.engine.onBeforeShaderCompilationObservable.add(function () {\r\n _this._shaderCompilationTime.fetchNewFrame();\r\n _this._shaderCompilationTime.beginMonitoring();\r\n });\r\n this._onAfterShaderCompilationObserver = this.engine.onAfterShaderCompilationObservable.add(function () {\r\n _this._shaderCompilationTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\r\n this._onBeforeShaderCompilationObserver = null;\r\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\r\n this._onAfterShaderCompilationObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose and release associated resources.\r\n */\r\n EngineInstrumentation.prototype.dispose = function () {\r\n this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.engine.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\r\n this._onBeforeShaderCompilationObserver = null;\r\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\r\n this._onAfterShaderCompilationObserver = null;\r\n this.engine = null;\r\n };\r\n return EngineInstrumentation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/index.ts\":\n/*!**********************************!*\\\n !*** ./Instrumentation/index.ts ***!\n \\**********************************/\n/*! exports provided: EngineInstrumentation, SceneInstrumentation, _TimeToken */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _engineInstrumentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engineInstrumentation */ \"./Instrumentation/engineInstrumentation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return _engineInstrumentation__WEBPACK_IMPORTED_MODULE_0__[\"EngineInstrumentation\"]; });\n\n/* harmony import */ var _sceneInstrumentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sceneInstrumentation */ \"./Instrumentation/sceneInstrumentation.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return _sceneInstrumentation__WEBPACK_IMPORTED_MODULE_1__[\"SceneInstrumentation\"]; });\n\n/* harmony import */ var _timeToken__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./timeToken */ \"./Instrumentation/timeToken.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _timeToken__WEBPACK_IMPORTED_MODULE_2__[\"_TimeToken\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/sceneInstrumentation.ts\":\n/*!*************************************************!*\\\n !*** ./Instrumentation/sceneInstrumentation.ts ***!\n \\*************************************************/\n/*! exports provided: SceneInstrumentation */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return SceneInstrumentation; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n\r\n\r\n/**\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#sceneinstrumentation\r\n */\r\nvar SceneInstrumentation = /** @class */ (function () {\r\n /**\r\n * Instantiates a new scene instrumentation.\r\n * This class can be used to get instrumentation data from a Babylon engine\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#sceneinstrumentation\r\n * @param scene Defines the scene to instrument\r\n */\r\n function SceneInstrumentation(\r\n /**\r\n * Defines the scene to instrument\r\n */\r\n scene) {\r\n var _this = this;\r\n this.scene = scene;\r\n this._captureActiveMeshesEvaluationTime = false;\r\n this._activeMeshesEvaluationTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureRenderTargetsRenderTime = false;\r\n this._renderTargetsRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureFrameTime = false;\r\n this._frameTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureRenderTime = false;\r\n this._renderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureInterFrameTime = false;\r\n this._interFrameTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureParticlesRenderTime = false;\r\n this._particlesRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureSpritesRenderTime = false;\r\n this._spritesRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._capturePhysicsTime = false;\r\n this._physicsTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureAnimationsTime = false;\r\n this._animationsTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n this._captureCameraRenderTime = false;\r\n this._cameraRenderTime = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_1__[\"PerfCounter\"]();\r\n // Observers\r\n this._onBeforeActiveMeshesEvaluationObserver = null;\r\n this._onAfterActiveMeshesEvaluationObserver = null;\r\n this._onBeforeRenderTargetsRenderObserver = null;\r\n this._onAfterRenderTargetsRenderObserver = null;\r\n this._onAfterRenderObserver = null;\r\n this._onBeforeDrawPhaseObserver = null;\r\n this._onAfterDrawPhaseObserver = null;\r\n this._onBeforeAnimationsObserver = null;\r\n this._onBeforeParticlesRenderingObserver = null;\r\n this._onAfterParticlesRenderingObserver = null;\r\n this._onBeforeSpritesRenderingObserver = null;\r\n this._onAfterSpritesRenderingObserver = null;\r\n this._onBeforePhysicsObserver = null;\r\n this._onAfterPhysicsObserver = null;\r\n this._onAfterAnimationsObserver = null;\r\n this._onBeforeCameraRenderObserver = null;\r\n this._onAfterCameraRenderObserver = null;\r\n // Before render\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {\r\n if (_this._captureActiveMeshesEvaluationTime) {\r\n _this._activeMeshesEvaluationTime.fetchNewFrame();\r\n }\r\n if (_this._captureRenderTargetsRenderTime) {\r\n _this._renderTargetsRenderTime.fetchNewFrame();\r\n }\r\n if (_this._captureFrameTime) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Scene rendering\");\r\n _this._frameTime.beginMonitoring();\r\n }\r\n if (_this._captureInterFrameTime) {\r\n _this._interFrameTime.endMonitoring();\r\n }\r\n if (_this._captureParticlesRenderTime) {\r\n _this._particlesRenderTime.fetchNewFrame();\r\n }\r\n if (_this._captureSpritesRenderTime) {\r\n _this._spritesRenderTime.fetchNewFrame();\r\n }\r\n if (_this._captureAnimationsTime) {\r\n _this._animationsTime.beginMonitoring();\r\n }\r\n _this.scene.getEngine()._drawCalls.fetchNewFrame();\r\n });\r\n // After render\r\n this._onAfterRenderObserver = scene.onAfterRenderObservable.add(function () {\r\n if (_this._captureFrameTime) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Scene rendering\");\r\n _this._frameTime.endMonitoring();\r\n }\r\n if (_this._captureRenderTime) {\r\n _this._renderTime.endMonitoring(false);\r\n }\r\n if (_this._captureInterFrameTime) {\r\n _this._interFrameTime.beginMonitoring();\r\n }\r\n });\r\n }\r\n Object.defineProperty(SceneInstrumentation.prototype, \"activeMeshesEvaluationTimeCounter\", {\r\n // Properties\r\n /**\r\n * Gets the perf counter used for active meshes evaluation time\r\n */\r\n get: function () {\r\n return this._activeMeshesEvaluationTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureActiveMeshesEvaluationTime\", {\r\n /**\r\n * Gets the active meshes evaluation time capture status\r\n */\r\n get: function () {\r\n return this._captureActiveMeshesEvaluationTime;\r\n },\r\n /**\r\n * Enable or disable the active meshes evaluation time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureActiveMeshesEvaluationTime) {\r\n return;\r\n }\r\n this._captureActiveMeshesEvaluationTime = value;\r\n if (value) {\r\n this._onBeforeActiveMeshesEvaluationObserver = this.scene.onBeforeActiveMeshesEvaluationObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Active meshes evaluation\");\r\n _this._activeMeshesEvaluationTime.beginMonitoring();\r\n });\r\n this._onAfterActiveMeshesEvaluationObserver = this.scene.onAfterActiveMeshesEvaluationObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Active meshes evaluation\");\r\n _this._activeMeshesEvaluationTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver);\r\n this._onBeforeActiveMeshesEvaluationObserver = null;\r\n this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver);\r\n this._onAfterActiveMeshesEvaluationObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"renderTargetsRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for render targets render time\r\n */\r\n get: function () {\r\n return this._renderTargetsRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureRenderTargetsRenderTime\", {\r\n /**\r\n * Gets the render targets render time capture status\r\n */\r\n get: function () {\r\n return this._captureRenderTargetsRenderTime;\r\n },\r\n /**\r\n * Enable or disable the render targets render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureRenderTargetsRenderTime) {\r\n return;\r\n }\r\n this._captureRenderTargetsRenderTime = value;\r\n if (value) {\r\n this._onBeforeRenderTargetsRenderObserver = this.scene.onBeforeRenderTargetsRenderObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Render targets rendering\");\r\n _this._renderTargetsRenderTime.beginMonitoring();\r\n });\r\n this._onAfterRenderTargetsRenderObserver = this.scene.onAfterRenderTargetsRenderObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Render targets rendering\");\r\n _this._renderTargetsRenderTime.endMonitoring(false);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver);\r\n this._onBeforeRenderTargetsRenderObserver = null;\r\n this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver);\r\n this._onAfterRenderTargetsRenderObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"particlesRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for particles render time\r\n */\r\n get: function () {\r\n return this._particlesRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureParticlesRenderTime\", {\r\n /**\r\n * Gets the particles render time capture status\r\n */\r\n get: function () {\r\n return this._captureParticlesRenderTime;\r\n },\r\n /**\r\n * Enable or disable the particles render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureParticlesRenderTime) {\r\n return;\r\n }\r\n this._captureParticlesRenderTime = value;\r\n if (value) {\r\n this._onBeforeParticlesRenderingObserver = this.scene.onBeforeParticlesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Particles\");\r\n _this._particlesRenderTime.beginMonitoring();\r\n });\r\n this._onAfterParticlesRenderingObserver = this.scene.onAfterParticlesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Particles\");\r\n _this._particlesRenderTime.endMonitoring(false);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver);\r\n this._onBeforeParticlesRenderingObserver = null;\r\n this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver);\r\n this._onAfterParticlesRenderingObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"spritesRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for sprites render time\r\n */\r\n get: function () {\r\n return this._spritesRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureSpritesRenderTime\", {\r\n /**\r\n * Gets the sprites render time capture status\r\n */\r\n get: function () {\r\n return this._captureSpritesRenderTime;\r\n },\r\n /**\r\n * Enable or disable the sprites render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureSpritesRenderTime) {\r\n return;\r\n }\r\n this._captureSpritesRenderTime = value;\r\n if (!this.scene.spriteManagers) {\r\n return;\r\n }\r\n if (value) {\r\n this._onBeforeSpritesRenderingObserver = this.scene.onBeforeSpritesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Sprites\");\r\n _this._spritesRenderTime.beginMonitoring();\r\n });\r\n this._onAfterSpritesRenderingObserver = this.scene.onAfterSpritesRenderingObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Sprites\");\r\n _this._spritesRenderTime.endMonitoring(false);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver);\r\n this._onBeforeSpritesRenderingObserver = null;\r\n this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver);\r\n this._onAfterSpritesRenderingObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"physicsTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for physics time\r\n */\r\n get: function () {\r\n return this._physicsTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"capturePhysicsTime\", {\r\n /**\r\n * Gets the physics time capture status\r\n */\r\n get: function () {\r\n return this._capturePhysicsTime;\r\n },\r\n /**\r\n * Enable or disable the physics time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._capturePhysicsTime) {\r\n return;\r\n }\r\n if (!this.scene.onBeforePhysicsObservable) {\r\n return;\r\n }\r\n this._capturePhysicsTime = value;\r\n if (value) {\r\n this._onBeforePhysicsObserver = this.scene.onBeforePhysicsObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Physics\");\r\n _this._physicsTime.beginMonitoring();\r\n });\r\n this._onAfterPhysicsObserver = this.scene.onAfterPhysicsObservable.add(function () {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Physics\");\r\n _this._physicsTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);\r\n this._onBeforePhysicsObserver = null;\r\n this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);\r\n this._onAfterPhysicsObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"animationsTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for animations time\r\n */\r\n get: function () {\r\n return this._animationsTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureAnimationsTime\", {\r\n /**\r\n * Gets the animations time capture status\r\n */\r\n get: function () {\r\n return this._captureAnimationsTime;\r\n },\r\n /**\r\n * Enable or disable the animations time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureAnimationsTime) {\r\n return;\r\n }\r\n this._captureAnimationsTime = value;\r\n if (value) {\r\n this._onAfterAnimationsObserver = this.scene.onAfterAnimationsObservable.add(function () {\r\n _this._animationsTime.endMonitoring();\r\n });\r\n }\r\n else {\r\n this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);\r\n this._onAfterAnimationsObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"frameTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for frame time capture\r\n */\r\n get: function () {\r\n return this._frameTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureFrameTime\", {\r\n /**\r\n * Gets the frame time capture status\r\n */\r\n get: function () {\r\n return this._captureFrameTime;\r\n },\r\n /**\r\n * Enable or disable the frame time capture\r\n */\r\n set: function (value) {\r\n this._captureFrameTime = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"interFrameTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for inter-frames time capture\r\n */\r\n get: function () {\r\n return this._interFrameTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureInterFrameTime\", {\r\n /**\r\n * Gets the inter-frames time capture status\r\n */\r\n get: function () {\r\n return this._captureInterFrameTime;\r\n },\r\n /**\r\n * Enable or disable the inter-frames time capture\r\n */\r\n set: function (value) {\r\n this._captureInterFrameTime = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"renderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for render time capture\r\n */\r\n get: function () {\r\n return this._renderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureRenderTime\", {\r\n /**\r\n * Gets the render time capture status\r\n */\r\n get: function () {\r\n return this._captureRenderTime;\r\n },\r\n /**\r\n * Enable or disable the render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureRenderTime) {\r\n return;\r\n }\r\n this._captureRenderTime = value;\r\n if (value) {\r\n this._onBeforeDrawPhaseObserver = this.scene.onBeforeDrawPhaseObservable.add(function () {\r\n _this._renderTime.beginMonitoring();\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Main render\");\r\n });\r\n this._onAfterDrawPhaseObserver = this.scene.onAfterDrawPhaseObservable.add(function () {\r\n _this._renderTime.endMonitoring(false);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Main render\");\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver);\r\n this._onBeforeDrawPhaseObserver = null;\r\n this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver);\r\n this._onAfterDrawPhaseObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"cameraRenderTimeCounter\", {\r\n /**\r\n * Gets the perf counter used for camera render time capture\r\n */\r\n get: function () {\r\n return this._cameraRenderTime;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"captureCameraRenderTime\", {\r\n /**\r\n * Gets the camera render time capture status\r\n */\r\n get: function () {\r\n return this._captureCameraRenderTime;\r\n },\r\n /**\r\n * Enable or disable the camera render time capture\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (value === this._captureCameraRenderTime) {\r\n return;\r\n }\r\n this._captureCameraRenderTime = value;\r\n if (value) {\r\n this._onBeforeCameraRenderObserver = this.scene.onBeforeCameraRenderObservable.add(function (camera) {\r\n _this._cameraRenderTime.beginMonitoring();\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Rendering camera \" + camera.name);\r\n });\r\n this._onAfterCameraRenderObserver = this.scene.onAfterCameraRenderObservable.add(function (camera) {\r\n _this._cameraRenderTime.endMonitoring(false);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Rendering camera \" + camera.name);\r\n });\r\n }\r\n else {\r\n this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._onBeforeCameraRenderObserver = null;\r\n this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n this._onAfterCameraRenderObserver = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneInstrumentation.prototype, \"drawCallsCounter\", {\r\n /**\r\n * Gets the perf counter used for draw calls\r\n */\r\n get: function () {\r\n return this.scene.getEngine()._drawCalls;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose and release associated resources.\r\n */\r\n SceneInstrumentation.prototype.dispose = function () {\r\n this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n this._onAfterRenderObserver = null;\r\n this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver);\r\n this._onBeforeActiveMeshesEvaluationObserver = null;\r\n this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver);\r\n this._onAfterActiveMeshesEvaluationObserver = null;\r\n this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver);\r\n this._onBeforeRenderTargetsRenderObserver = null;\r\n this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver);\r\n this._onAfterRenderTargetsRenderObserver = null;\r\n this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver);\r\n this._onBeforeParticlesRenderingObserver = null;\r\n this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver);\r\n this._onAfterParticlesRenderingObserver = null;\r\n if (this._onBeforeSpritesRenderingObserver) {\r\n this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver);\r\n this._onBeforeSpritesRenderingObserver = null;\r\n }\r\n if (this._onAfterSpritesRenderingObserver) {\r\n this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver);\r\n this._onAfterSpritesRenderingObserver = null;\r\n }\r\n this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver);\r\n this._onBeforeDrawPhaseObserver = null;\r\n this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver);\r\n this._onAfterDrawPhaseObserver = null;\r\n if (this._onBeforePhysicsObserver) {\r\n this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);\r\n this._onBeforePhysicsObserver = null;\r\n }\r\n if (this._onAfterPhysicsObserver) {\r\n this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);\r\n this._onAfterPhysicsObserver = null;\r\n }\r\n this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);\r\n this._onAfterAnimationsObserver = null;\r\n this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n this._onBeforeCameraRenderObserver = null;\r\n this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n this._onAfterCameraRenderObserver = null;\r\n this.scene = null;\r\n };\r\n return SceneInstrumentation;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Instrumentation/timeToken.ts\":\n/*!**************************************!*\\\n !*** ./Instrumentation/timeToken.ts ***!\n \\**************************************/\n/*! exports provided: _TimeToken */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _TimeToken; });\n/**\r\n * @hidden\r\n **/\r\nvar _TimeToken = /** @class */ (function () {\r\n function _TimeToken() {\r\n this._timeElapsedQueryEnded = false;\r\n }\r\n return _TimeToken;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/effectLayer.ts\":\n/*!*******************************!*\\\n !*** ./Layers/effectLayer.ts ***!\n \\*******************************/\n/*! exports provided: EffectLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return EffectLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_glowMapGeneration_fragment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Shaders/glowMapGeneration.fragment */ \"./Shaders/glowMapGeneration.fragment.ts\");\n/* harmony import */ var _Shaders_glowMapGeneration_vertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/glowMapGeneration.vertex */ \"./Shaders/glowMapGeneration.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The effect layer Helps adding post process effect blended with the main pass.\r\n *\r\n * This can be for instance use to generate glow or higlight effects on the scene.\r\n *\r\n * The effect layer class can not be used directly and is intented to inherited from to be\r\n * customized per effects.\r\n */\r\nvar EffectLayer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new effect Layer and references it in the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n */\r\n function EffectLayer(\r\n /** The Friendly of the effect in the scene */\r\n name, scene) {\r\n this._vertexBuffers = {};\r\n this._maxSize = 0;\r\n this._mainTextureDesiredSize = { width: 0, height: 0 };\r\n this._shouldRender = true;\r\n this._postProcesses = [];\r\n this._textures = [];\r\n this._emissiveTextureAndColor = { texture: null, color: new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"]() };\r\n /**\r\n * The clear color of the texture used to generate the glow map.\r\n */\r\n this.neutralColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"]();\r\n /**\r\n * Specifies wether the highlight layer is enabled or not.\r\n */\r\n this.isEnabled = true;\r\n /**\r\n * An event triggered when the effect layer has been disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the effect layer is about rendering the main texture with the glowy parts.\r\n */\r\n this.onBeforeRenderMainTextureObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the generated texture is being merged in the scene.\r\n */\r\n this.onBeforeComposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the generated texture has been merged in the scene.\r\n */\r\n this.onAfterComposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the efffect layer changes its size.\r\n */\r\n this.onSizeChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n this.name = name;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n EffectLayer._SceneComponentInitialization(this._scene);\r\n this._engine = this._scene.getEngine();\r\n this._maxSize = this._engine.getCaps().maxTextureSize;\r\n this._scene.effectLayers.push(this);\r\n // Generate Buffers\r\n this._generateIndexBuffer();\r\n this._generateVertexBuffer();\r\n }\r\n Object.defineProperty(EffectLayer.prototype, \"camera\", {\r\n /**\r\n * Gets the camera attached to the layer.\r\n */\r\n get: function () {\r\n return this._effectLayerOptions.camera;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EffectLayer.prototype, \"renderingGroupId\", {\r\n /**\r\n * Gets the rendering group id the layer should render in.\r\n */\r\n get: function () {\r\n return this._effectLayerOptions.renderingGroupId;\r\n },\r\n set: function (renderingGroupId) {\r\n this._effectLayerOptions.renderingGroupId = renderingGroupId;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the effect layer with the required options.\r\n * @param options Sets of none mandatory options to use with the layer (see IEffectLayerOptions for more information)\r\n */\r\n EffectLayer.prototype._init = function (options) {\r\n // Adapt options\r\n this._effectLayerOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ mainTextureRatio: 0.5, alphaBlendingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].ALPHA_COMBINE, camera: null, renderingGroupId: -1 }, options);\r\n this._setMainTextureSize();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n this._mergeEffect = this._createMergeEffect();\r\n };\r\n /**\r\n * Generates the index buffer of the full screen quad blending to the main canvas.\r\n */\r\n EffectLayer.prototype._generateIndexBuffer = function () {\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = this._engine.createIndexBuffer(indices);\r\n };\r\n /**\r\n * Generates the vertex buffer of the full screen quad blending to the main canvas.\r\n */\r\n EffectLayer.prototype._generateVertexBuffer = function () {\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n var vertexBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"](this._engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind] = vertexBuffer;\r\n };\r\n /**\r\n * Sets the main texture desired size which is the closest power of two\r\n * of the engine canvas size.\r\n */\r\n EffectLayer.prototype._setMainTextureSize = function () {\r\n if (this._effectLayerOptions.mainTextureFixedSize) {\r\n this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize;\r\n this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize;\r\n }\r\n else {\r\n this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.width = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize) : this._mainTextureDesiredSize.width;\r\n this._mainTextureDesiredSize.height = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize) : this._mainTextureDesiredSize.height;\r\n }\r\n this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width);\r\n this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);\r\n };\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n EffectLayer.prototype._createMainTexture = function () {\r\n var _this = this;\r\n this._mainTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](\"HighlightLayerMainRTT\", {\r\n width: this._mainTextureDesiredSize.width,\r\n height: this._mainTextureDesiredSize.height\r\n }, this._scene, false, true, _Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._mainTexture.activeCamera = this._effectLayerOptions.camera;\r\n this._mainTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._mainTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._mainTexture.anisotropicFilteringLevel = 1;\r\n this._mainTexture.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._mainTexture.renderParticles = false;\r\n this._mainTexture.renderList = null;\r\n this._mainTexture.ignoreCameraViewport = true;\r\n // Custom render function\r\n this._mainTexture.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n _this.onBeforeRenderMainTextureObservable.notifyObservers(_this);\r\n var index;\r\n var engine = _this._scene.getEngine();\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n _this._renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n _this._renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n _this._renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n var previousAlphaMode = engine.getAlphaMode();\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n _this._renderSubMesh(transparentSubMeshes.data[index], true);\r\n }\r\n engine.setAlphaMode(previousAlphaMode);\r\n };\r\n this._mainTexture.onClearObservable.add(function (engine) {\r\n engine.clear(_this.neutralColor, true, true, true);\r\n });\r\n };\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n EffectLayer.prototype._addCustomEffectDefines = function (defines) {\r\n // Nothing to add by default.\r\n };\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify wether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @return true if ready otherwise, false\r\n */\r\n EffectLayer.prototype._isReady = function (subMesh, useInstances, emissiveTexture) {\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return false;\r\n }\r\n if (!material.isReadyForSubMesh(subMesh.getMesh(), subMesh, useInstances)) {\r\n return false;\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n var mesh = subMesh.getMesh();\r\n var uv1 = false;\r\n var uv2 = false;\r\n // Diffuse\r\n if (material) {\r\n var needAlphaTest = material.needAlphaTesting();\r\n var diffuseTexture = material.getAlphaTestTexture();\r\n var needAlphaBlendFromDiffuse = diffuseTexture && diffuseTexture.hasAlpha &&\r\n (material.useAlphaFromDiffuseTexture || material._useAlphaFromAlbedoTexture);\r\n if (diffuseTexture && (needAlphaTest || needAlphaBlendFromDiffuse)) {\r\n defines.push(\"#define DIFFUSE\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind) &&\r\n diffuseTexture.coordinatesIndex === 1) {\r\n defines.push(\"#define DIFFUSEUV2\");\r\n uv2 = true;\r\n }\r\n else if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind)) {\r\n defines.push(\"#define DIFFUSEUV1\");\r\n uv1 = true;\r\n }\r\n if (needAlphaTest) {\r\n defines.push(\"#define ALPHATEST\");\r\n defines.push(\"#define ALPHATESTVALUE 0.4\");\r\n }\r\n }\r\n var opacityTexture = material.opacityTexture;\r\n if (opacityTexture) {\r\n defines.push(\"#define OPACITY\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind) &&\r\n opacityTexture.coordinatesIndex === 1) {\r\n defines.push(\"#define OPACITYUV2\");\r\n uv2 = true;\r\n }\r\n else if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind)) {\r\n defines.push(\"#define OPACITYUV1\");\r\n uv1 = true;\r\n }\r\n }\r\n }\r\n // Emissive\r\n if (emissiveTexture) {\r\n defines.push(\"#define EMISSIVE\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind) &&\r\n emissiveTexture.coordinatesIndex === 1) {\r\n defines.push(\"#define EMISSIVEUV2\");\r\n uv2 = true;\r\n }\r\n else if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind)) {\r\n defines.push(\"#define EMISSIVEUV1\");\r\n uv1 = true;\r\n }\r\n }\r\n // Vertex\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].ColorKind) && mesh.hasVertexAlpha) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].ColorKind);\r\n defines.push(\"#define VERTEXALPHA\");\r\n }\r\n if (uv1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (uv2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n // Bones\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_10__[\"EffectFallbacks\"]();\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n var skeleton = mesh.skeleton;\r\n if (skeleton && skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton ? (skeleton.bones.length + 1) : 0));\r\n }\r\n if (mesh.numBoneInfluencers > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var manager = mesh.morphTargetManager;\r\n var morphInfluencers = 0;\r\n if (manager) {\r\n if (manager.numInfluencers > 0) {\r\n defines.push(\"#define MORPHTARGETS\");\r\n morphInfluencers = manager.numInfluencers;\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + morphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, morphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n this._addCustomEffectDefines(defines);\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect(\"glowMapGeneration\", attribs, [\"world\", \"mBones\", \"viewProjection\",\r\n \"glowColor\", \"morphTargetInfluences\", \"boneTextureWidth\",\r\n \"diffuseMatrix\", \"emissiveMatrix\", \"opacityMatrix\", \"opacityIntensity\"], [\"diffuseSampler\", \"emissiveSampler\", \"opacitySampler\", \"boneSampler\"], join, fallbacks, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers });\r\n }\r\n return this._effectLayerMapGenerationEffect.isReady();\r\n };\r\n /**\r\n * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.\r\n */\r\n EffectLayer.prototype.render = function () {\r\n var currentEffect = this._mergeEffect;\r\n // Check\r\n if (!currentEffect.isReady()) {\r\n return;\r\n }\r\n for (var i = 0; i < this._postProcesses.length; i++) {\r\n if (!this._postProcesses[i].isReady()) {\r\n return;\r\n }\r\n }\r\n var engine = this._scene.getEngine();\r\n this.onBeforeComposeObservable.notifyObservers(this);\r\n // Render\r\n engine.enableEffect(currentEffect);\r\n engine.setState(false);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);\r\n // Cache\r\n var previousAlphaMode = engine.getAlphaMode();\r\n // Go Blend.\r\n engine.setAlphaMode(this._effectLayerOptions.alphaBlendingMode);\r\n // Blends the map on the main canvas.\r\n this._internalRender(currentEffect);\r\n // Restore Alpha\r\n engine.setAlphaMode(previousAlphaMode);\r\n this.onAfterComposeObservable.notifyObservers(this);\r\n // Handle size changes.\r\n var size = this._mainTexture.getSize();\r\n this._setMainTextureSize();\r\n if (size.width !== this._mainTextureDesiredSize.width || size.height !== this._mainTextureDesiredSize.height) {\r\n // Recreate RTT and post processes on size change.\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n this._disposeTextureAndPostProcesses();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n };\r\n /**\r\n * Determine if a given mesh will be used in the current effect.\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be used\r\n */\r\n EffectLayer.prototype.hasMesh = function (mesh) {\r\n if (this.renderingGroupId === -1 || mesh.renderingGroupId === this.renderingGroupId) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n * @returns true if the glow layer should be rendered\r\n */\r\n EffectLayer.prototype.shouldRender = function () {\r\n return this.isEnabled && this._shouldRender;\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n EffectLayer.prototype._shouldRenderMesh = function (mesh) {\r\n return true;\r\n };\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n EffectLayer.prototype._canRenderMesh = function (mesh, material) {\r\n return !material.needAlphaBlendingForMesh(mesh);\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n EffectLayer.prototype._shouldRenderEmissiveTextureForMesh = function () {\r\n return true;\r\n };\r\n /**\r\n * Renders the submesh passed in parameter to the generation map.\r\n */\r\n EffectLayer.prototype._renderSubMesh = function (subMesh, enableAlphaMode) {\r\n var _this = this;\r\n if (enableAlphaMode === void 0) { enableAlphaMode = false; }\r\n if (!this.shouldRender()) {\r\n return;\r\n }\r\n var material = subMesh.getMaterial();\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = this._scene;\r\n var engine = scene.getEngine();\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n if (!material) {\r\n return;\r\n }\r\n // Do not block in blend mode.\r\n if (!this._canRenderMesh(mesh, material)) {\r\n return;\r\n }\r\n // Culling\r\n engine.setState(material.backFaceCulling);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n // Early Exit per mesh\r\n if (!this._shouldRenderMesh(mesh)) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id];\r\n this._setEmissiveTextureAndColor(mesh, subMesh, material);\r\n if (this._isReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\r\n engine.enableEffect(this._effectLayerMapGenerationEffect);\r\n mesh._bind(subMesh, this._effectLayerMapGenerationEffect, _Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].TriangleFillMode);\r\n this._effectLayerMapGenerationEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n this._effectLayerMapGenerationEffect.setFloat4(\"glowColor\", this._emissiveTextureAndColor.color.r, this._emissiveTextureAndColor.color.g, this._emissiveTextureAndColor.color.b, this._emissiveTextureAndColor.color.a);\r\n var needAlphaTest = material.needAlphaTesting();\r\n var diffuseTexture = material.getAlphaTestTexture();\r\n var needAlphaBlendFromDiffuse = diffuseTexture && diffuseTexture.hasAlpha &&\r\n (material.useAlphaFromDiffuseTexture || material._useAlphaFromAlbedoTexture);\r\n if (diffuseTexture && (needAlphaTest || needAlphaBlendFromDiffuse)) {\r\n this._effectLayerMapGenerationEffect.setTexture(\"diffuseSampler\", diffuseTexture);\r\n var textureMatrix = diffuseTexture.getTextureMatrix();\r\n if (textureMatrix) {\r\n this._effectLayerMapGenerationEffect.setMatrix(\"diffuseMatrix\", textureMatrix);\r\n }\r\n }\r\n var opacityTexture = material.opacityTexture;\r\n if (opacityTexture) {\r\n this._effectLayerMapGenerationEffect.setTexture(\"opacitySampler\", opacityTexture);\r\n this._effectLayerMapGenerationEffect.setFloat(\"opacityIntensity\", opacityTexture.level);\r\n var textureMatrix = opacityTexture.getTextureMatrix();\r\n if (textureMatrix) {\r\n this._effectLayerMapGenerationEffect.setMatrix(\"opacityMatrix\", textureMatrix);\r\n }\r\n }\r\n // Glow emissive only\r\n if (this._emissiveTextureAndColor.texture) {\r\n this._effectLayerMapGenerationEffect.setTexture(\"emissiveSampler\", this._emissiveTextureAndColor.texture);\r\n this._effectLayerMapGenerationEffect.setMatrix(\"emissiveMatrix\", this._emissiveTextureAndColor.texture.getTextureMatrix());\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n if (!boneTexture) {\r\n return;\r\n }\r\n this._effectLayerMapGenerationEffect.setTexture(\"boneSampler\", boneTexture);\r\n this._effectLayerMapGenerationEffect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n this._effectLayerMapGenerationEffect.setMatrices(\"mBones\", skeleton.getTransformMatrices((mesh)));\r\n }\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._effectLayerMapGenerationEffect);\r\n // Alpha mode\r\n if (enableAlphaMode) {\r\n engine.setAlphaMode(material.alphaMode);\r\n }\r\n // Draw\r\n mesh._processRendering(subMesh, this._effectLayerMapGenerationEffect, _Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effectLayerMapGenerationEffect.setMatrix(\"world\", world); });\r\n }\r\n else {\r\n // Need to reset refresh rate of the main map\r\n this._mainTexture.resetRefreshCounter();\r\n }\r\n };\r\n /**\r\n * Rebuild the required buffers.\r\n * @hidden Internal use only.\r\n */\r\n EffectLayer.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._generateIndexBuffer();\r\n };\r\n /**\r\n * Dispose only the render target textures and post process.\r\n */\r\n EffectLayer.prototype._disposeTextureAndPostProcesses = function () {\r\n this._mainTexture.dispose();\r\n for (var i = 0; i < this._postProcesses.length; i++) {\r\n if (this._postProcesses[i]) {\r\n this._postProcesses[i].dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n for (var i = 0; i < this._textures.length; i++) {\r\n if (this._textures[i]) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = [];\r\n };\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n EffectLayer.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n // Clean textures and post processes\r\n this._disposeTextureAndPostProcesses();\r\n // Remove from scene\r\n var index = this._scene.effectLayers.indexOf(this, 0);\r\n if (index > -1) {\r\n this._scene.effectLayers.splice(index, 1);\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderMainTextureObservable.clear();\r\n this.onBeforeComposeObservable.clear();\r\n this.onAfterComposeObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n };\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n EffectLayer.prototype.getClassName = function () {\r\n return \"EffectLayer\";\r\n };\r\n /**\r\n * Creates an effect layer from parsed effect layer data\r\n * @param parsedEffectLayer defines effect layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the effect layer information\r\n * @returns a parsed effect Layer\r\n */\r\n EffectLayer.Parse = function (parsedEffectLayer, scene, rootUrl) {\r\n var effectLayerType = _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Instantiate(parsedEffectLayer.customType);\r\n return effectLayerType.Parse(parsedEffectLayer, scene, rootUrl);\r\n };\r\n /** @hidden */\r\n EffectLayer._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_16__[\"_DevTools\"].WarnImport(\"EffectLayerSceneComponent\");\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], EffectLayer.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor4\"])()\r\n ], EffectLayer.prototype, \"neutralColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], EffectLayer.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsCameraReference\"])()\r\n ], EffectLayer.prototype, \"camera\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], EffectLayer.prototype, \"renderingGroupId\", null);\r\n return EffectLayer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/effectLayerSceneComponent.ts\":\n/*!*********************************************!*\\\n !*** ./Layers/effectLayerSceneComponent.ts ***!\n \\*********************************************/\n/*! exports provided: EffectLayerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return EffectLayerSceneComponent; });\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n\r\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_3__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_EFFECTLAYER, function (parsedData, scene, container, rootUrl) {\r\n if (parsedData.effectLayers) {\r\n if (!container.effectLayers) {\r\n container.effectLayers = new Array();\r\n }\r\n for (var index = 0; index < parsedData.effectLayers.length; index++) {\r\n var effectLayer = _effectLayer__WEBPACK_IMPORTED_MODULE_2__[\"EffectLayer\"].Parse(parsedData.effectLayers[index], scene, rootUrl);\r\n container.effectLayers.push(effectLayer);\r\n }\r\n }\r\n});\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_3__[\"AbstractScene\"].prototype.removeEffectLayer = function (toRemove) {\r\n var index = this.effectLayers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.effectLayers.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_3__[\"AbstractScene\"].prototype.addEffectLayer = function (newEffectLayer) {\r\n this.effectLayers.push(newEffectLayer);\r\n};\r\n/**\r\n * Defines the layer scene component responsible to manage any effect layers\r\n * in a given scene.\r\n */\r\nvar EffectLayerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function EffectLayerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_EFFECTLAYER;\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n this._previousStencilState = false;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n scene.effectLayers = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n EffectLayerSceneComponent.prototype.register = function () {\r\n this.scene._isReadyForMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh);\r\n this.scene._cameraDrawRenderTargetStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture);\r\n this.scene._beforeCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil);\r\n this.scene._afterRenderingGroupDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup);\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack);\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n EffectLayerSceneComponent.prototype.rebuild = function () {\r\n var layers = this.scene.effectLayers;\r\n for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {\r\n var effectLayer = layers_1[_i];\r\n effectLayer._rebuild();\r\n }\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n EffectLayerSceneComponent.prototype.serialize = function (serializationObject) {\r\n // Effect layers\r\n serializationObject.effectLayers = [];\r\n var layers = this.scene.effectLayers;\r\n for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {\r\n var effectLayer = layers_2[_i];\r\n if (effectLayer.serialize) {\r\n serializationObject.effectLayers.push(effectLayer.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n EffectLayerSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach(function (o) {\r\n _this.scene.addEffectLayer(o);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n EffectLayerSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach(function (o) {\r\n _this.scene.removeEffectLayer(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n EffectLayerSceneComponent.prototype.dispose = function () {\r\n var layers = this.scene.effectLayers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._isReadyForMesh = function (mesh, hardwareInstancedRendering) {\r\n var layers = this.scene.effectLayers;\r\n for (var _i = 0, layers_3 = layers; _i < layers_3.length; _i++) {\r\n var layer = layers_3[_i];\r\n if (!layer.hasMesh(mesh)) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (!layer.isReady(subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n EffectLayerSceneComponent.prototype._renderMainTexture = function (camera) {\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n var needRebind = false;\r\n var layers = this.scene.effectLayers;\r\n if (layers && layers.length > 0) {\r\n this._previousStencilState = this._engine.getStencilBuffer();\r\n for (var _i = 0, layers_4 = layers; _i < layers_4.length; _i++) {\r\n var effectLayer = layers_4[_i];\r\n if (effectLayer.shouldRender() &&\r\n (!effectLayer.camera ||\r\n (effectLayer.camera.cameraRigMode === _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_NONE && camera === effectLayer.camera) ||\r\n (effectLayer.camera.cameraRigMode !== _Cameras_camera__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"].RIG_MODE_NONE && effectLayer.camera._rigCameras.indexOf(camera) > -1))) {\r\n this._renderEffects = true;\r\n this._needStencil = this._needStencil || effectLayer.needStencil();\r\n var renderTarget = effectLayer._mainTexture;\r\n if (renderTarget._shouldRender()) {\r\n this.scene.incrementRenderId();\r\n renderTarget.render(false, false);\r\n needRebind = true;\r\n }\r\n }\r\n }\r\n this.scene.incrementRenderId();\r\n }\r\n return needRebind;\r\n };\r\n EffectLayerSceneComponent.prototype._setStencil = function () {\r\n // Activate effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(true);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._setStencilBack = function () {\r\n // Restore effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(this._previousStencilState);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._draw = function (renderingGroupId) {\r\n if (this._renderEffects) {\r\n this._engine.setDepthBuffer(false);\r\n var layers = this.scene.effectLayers;\r\n for (var i = 0; i < layers.length; i++) {\r\n var effectLayer = layers[i];\r\n if (effectLayer.renderingGroupId === renderingGroupId) {\r\n if (effectLayer.shouldRender()) {\r\n effectLayer.render();\r\n }\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._drawCamera = function () {\r\n if (this._renderEffects) {\r\n this._draw(-1);\r\n }\r\n };\r\n EffectLayerSceneComponent.prototype._drawRenderingGroup = function (index) {\r\n if (!this.scene._isInIntermediateRendering() && this._renderEffects) {\r\n this._draw(index);\r\n }\r\n };\r\n return EffectLayerSceneComponent;\r\n}());\r\n\r\n_effectLayer__WEBPACK_IMPORTED_MODULE_2__[\"EffectLayer\"]._SceneComponentInitialization = function (scene) {\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_EFFECTLAYER);\r\n if (!component) {\r\n component = new EffectLayerSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Layers/glowLayer.ts\":\n/*!*****************************!*\\\n !*** ./Layers/glowLayer.ts ***!\n \\*****************************/\n/*! exports provided: GlowLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return GlowLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_fragment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Shaders/glowMapMerge.fragment */ \"./Shaders/glowMapMerge.fragment.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_vertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/glowMapMerge.vertex */ \"./Shaders/glowMapMerge.vertex.ts\");\n/* harmony import */ var _Layers_effectLayerSceneComponent__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Layers/effectLayerSceneComponent */ \"./Layers/effectLayerSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_9__[\"AbstractScene\"].prototype.getGlowLayerByName = function (name) {\r\n for (var index = 0; index < this.effectLayers.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {\r\n return this.effectLayers[index];\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\r\n *\r\n * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove\r\n * glowy meshes to your scene.\r\n *\r\n * Documentation: https://doc.babylonjs.com/how_to/glow_layer\r\n */\r\nvar GlowLayer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GlowLayer, _super);\r\n /**\r\n * Instantiates a new glow Layer and references it to the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)\r\n */\r\n function GlowLayer(name, scene, options) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._intensity = 1.0;\r\n _this._includedOnlyMeshes = [];\r\n _this._excludedMeshes = [];\r\n _this.neutralColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color4\"](0, 0, 0, 1);\r\n // Adapt options\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ mainTextureRatio: GlowLayer.DefaultTextureRatio, blurKernelSize: 32, mainTextureFixedSize: undefined, camera: null, mainTextureSamples: 1, renderingGroupId: -1 }, options);\r\n // Initialize the layer\r\n _this._init({\r\n alphaBlendingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].ALPHA_ADD,\r\n camera: _this._options.camera,\r\n mainTextureFixedSize: _this._options.mainTextureFixedSize,\r\n mainTextureRatio: _this._options.mainTextureRatio,\r\n renderingGroupId: _this._options.renderingGroupId\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(GlowLayer.prototype, \"blurKernelSize\", {\r\n /**\r\n * Gets the kernel size of the blur.\r\n */\r\n get: function () {\r\n return this._horizontalBlurPostprocess1.kernel;\r\n },\r\n /**\r\n * Sets the kernel size of the blur.\r\n */\r\n set: function (value) {\r\n this._horizontalBlurPostprocess1.kernel = value;\r\n this._verticalBlurPostprocess1.kernel = value;\r\n this._horizontalBlurPostprocess2.kernel = value;\r\n this._verticalBlurPostprocess2.kernel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GlowLayer.prototype, \"intensity\", {\r\n /**\r\n * Gets the glow intensity.\r\n */\r\n get: function () {\r\n return this._intensity;\r\n },\r\n /**\r\n * Sets the glow intensity.\r\n */\r\n set: function (value) {\r\n this._intensity = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the effect name of the layer.\r\n * @return The effect name\r\n */\r\n GlowLayer.prototype.getEffectName = function () {\r\n return GlowLayer.EffectName;\r\n };\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n GlowLayer.prototype._createMergeEffect = function () {\r\n // Effect\r\n return this._engine.createEffect(\"glowMapMerge\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind], [\"offset\"], [\"textureSampler\", \"textureSampler2\"], \"#define EMISSIVE \\n\");\r\n };\r\n /**\r\n * Creates the render target textures and post processes used in the glow layer.\r\n */\r\n GlowLayer.prototype._createTextureAndPostProcesses = function () {\r\n var _this = this;\r\n var blurTextureWidth = this._mainTextureDesiredSize.width;\r\n var blurTextureHeight = this._mainTextureDesiredSize.height;\r\n blurTextureWidth = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_12__[\"Engine\"].GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_12__[\"Engine\"].GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n var textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n this._blurTexture1 = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_5__[\"RenderTargetTexture\"](\"GlowLayerBlurRTT\", {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, this._scene, false, true, textureType);\r\n this._blurTexture1.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture1.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture1.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._blurTexture1.renderParticles = false;\r\n this._blurTexture1.ignoreCameraViewport = true;\r\n var blurTextureWidth2 = Math.floor(blurTextureWidth / 2);\r\n var blurTextureHeight2 = Math.floor(blurTextureHeight / 2);\r\n this._blurTexture2 = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_5__[\"RenderTargetTexture\"](\"GlowLayerBlurRTT2\", {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2\r\n }, this._scene, false, true, textureType);\r\n this._blurTexture2.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture2.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture2.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._blurTexture2.renderParticles = false;\r\n this._blurTexture2.ignoreCameraViewport = true;\r\n this._textures = [this._blurTexture1, this._blurTexture2];\r\n this._horizontalBlurPostprocess1 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerHBP1\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](1.0, 0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess1.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess1.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess1.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._mainTexture);\r\n });\r\n this._verticalBlurPostprocess1 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerVBP1\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 1.0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess2 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerHBP2\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](1.0, 0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess2.width = blurTextureWidth2;\r\n this._horizontalBlurPostprocess2.height = blurTextureHeight2;\r\n this._horizontalBlurPostprocess2.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._blurTexture1);\r\n });\r\n this._verticalBlurPostprocess2 = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"BlurPostProcess\"](\"GlowLayerVBP2\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](0, 1.0), this._options.blurKernelSize / 2, {\r\n width: blurTextureWidth2,\r\n height: blurTextureHeight2\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1];\r\n this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\r\n this._mainTexture.samples = this._options.mainTextureSamples;\r\n this._mainTexture.onAfterUnbindObservable.add(function () {\r\n var internalTexture = _this._blurTexture1.getInternalTexture();\r\n if (internalTexture) {\r\n _this._scene.postProcessManager.directRender(_this._postProcesses1, internalTexture, true);\r\n internalTexture = _this._blurTexture2.getInternalTexture();\r\n if (internalTexture) {\r\n _this._scene.postProcessManager.directRender(_this._postProcesses2, internalTexture, true);\r\n }\r\n }\r\n });\r\n // Prevent autoClear.\r\n this._postProcesses.map(function (pp) { pp.autoClear = false; });\r\n };\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify wether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @return true if ready otherwise, false\r\n */\r\n GlowLayer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n var mesh = subMesh.getRenderingMesh();\r\n if (!material || !mesh) {\r\n return false;\r\n }\r\n var emissiveTexture = material.emissiveTexture;\r\n return _super.prototype._isReady.call(this, subMesh, useInstances, emissiveTexture);\r\n };\r\n /**\r\n * Returns wether or nood the layer needs stencil enabled during the mesh rendering.\r\n */\r\n GlowLayer.prototype.needStencil = function () {\r\n return false;\r\n };\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n GlowLayer.prototype._canRenderMesh = function (mesh, material) {\r\n return true;\r\n };\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n GlowLayer.prototype._internalRender = function (effect) {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture1);\r\n effect.setTexture(\"textureSampler2\", this._blurTexture2);\r\n effect.setFloat(\"offset\", this._intensity);\r\n // Cache\r\n var engine = this._engine;\r\n var previousStencilBuffer = engine.getStencilBuffer();\r\n // Draw order\r\n engine.setStencilBuffer(false);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n // Draw order\r\n engine.setStencilBuffer(previousStencilBuffer);\r\n };\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n GlowLayer.prototype._setEmissiveTextureAndColor = function (mesh, subMesh, material) {\r\n var textureLevel = 1.0;\r\n if (this.customEmissiveTextureSelector) {\r\n this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(mesh, subMesh, material);\r\n }\r\n else {\r\n if (material) {\r\n this._emissiveTextureAndColor.texture = material.emissiveTexture;\r\n if (this._emissiveTextureAndColor.texture) {\r\n textureLevel = this._emissiveTextureAndColor.texture.level;\r\n }\r\n }\r\n else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n }\r\n if (this.customEmissiveColorSelector) {\r\n this.customEmissiveColorSelector(mesh, subMesh, material, this._emissiveTextureAndColor.color);\r\n }\r\n else {\r\n if (material.emissiveColor) {\r\n this._emissiveTextureAndColor.color.set(material.emissiveColor.r * textureLevel, material.emissiveColor.g * textureLevel, material.emissiveColor.b * textureLevel, material.alpha);\r\n }\r\n else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n GlowLayer.prototype._shouldRenderMesh = function (mesh) {\r\n return this.hasMesh(mesh);\r\n };\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n GlowLayer.prototype._addCustomEffectDefines = function (defines) {\r\n defines.push(\"#define GLOW\");\r\n };\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to exclude from the glow layer\r\n */\r\n GlowLayer.prototype.addExcludedMesh = function (mesh) {\r\n if (this._excludedMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._excludedMeshes.push(mesh.uniqueId);\r\n }\r\n };\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n GlowLayer.prototype.removeExcludedMesh = function (mesh) {\r\n var index = this._excludedMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._excludedMeshes.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Add a mesh in the inclusion list to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to include in the glow layer\r\n */\r\n GlowLayer.prototype.addIncludedOnlyMesh = function (mesh) {\r\n if (this._includedOnlyMeshes.indexOf(mesh.uniqueId) === -1) {\r\n this._includedOnlyMeshes.push(mesh.uniqueId);\r\n }\r\n };\r\n /**\r\n * Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.\r\n * @param mesh The mesh to remove\r\n */\r\n GlowLayer.prototype.removeIncludedOnlyMesh = function (mesh) {\r\n var index = this._includedOnlyMeshes.indexOf(mesh.uniqueId);\r\n if (index !== -1) {\r\n this._includedOnlyMeshes.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Determine if a given mesh will be used in the glow layer\r\n * @param mesh The mesh to test\r\n * @returns true if the mesh will be highlighted by the current glow layer\r\n */\r\n GlowLayer.prototype.hasMesh = function (mesh) {\r\n if (!_super.prototype.hasMesh.call(this, mesh)) {\r\n return false;\r\n }\r\n // Included Mesh\r\n if (this._includedOnlyMeshes.length) {\r\n return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;\r\n }\r\n // Excluded Mesh\r\n if (this._excludedMeshes.length) {\r\n return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @hidden\r\n */\r\n GlowLayer.prototype._disposeMesh = function (mesh) {\r\n this.removeIncludedOnlyMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n };\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n GlowLayer.prototype.getClassName = function () {\r\n return \"GlowLayer\";\r\n };\r\n /**\r\n * Serializes this glow layer\r\n * @returns a serialized glow layer object\r\n */\r\n GlowLayer.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.GlowLayer\";\r\n var index;\r\n // Included meshes\r\n serializationObject.includedMeshes = [];\r\n if (this._includedOnlyMeshes.length) {\r\n for (index = 0; index < this._includedOnlyMeshes.length; index++) {\r\n var mesh = this._scene.getMeshByUniqueID(this._includedOnlyMeshes[index]);\r\n if (mesh) {\r\n serializationObject.includedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n if (this._excludedMeshes.length) {\r\n for (index = 0; index < this._excludedMeshes.length; index++) {\r\n var mesh = this._scene.getMeshByUniqueID(this._excludedMeshes[index]);\r\n if (mesh) {\r\n serializationObject.excludedMeshes.push(mesh.id);\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a Glow Layer from parsed glow layer data\r\n * @param parsedGlowLayer defines glow layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the glow layer information\r\n * @returns a parsed Glow Layer\r\n */\r\n GlowLayer.Parse = function (parsedGlowLayer, scene, rootUrl) {\r\n var gl = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new GlowLayer(parsedGlowLayer.name, scene, parsedGlowLayer.options); }, parsedGlowLayer, scene, rootUrl);\r\n var index;\r\n // Excluded meshes\r\n for (index = 0; index < parsedGlowLayer.excludedMeshes.length; index++) {\r\n var mesh = scene.getMeshByID(parsedGlowLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n gl.addExcludedMesh(mesh);\r\n }\r\n }\r\n // Included meshes\r\n for (index = 0; index < parsedGlowLayer.includedMeshes.length; index++) {\r\n var mesh = scene.getMeshByID(parsedGlowLayer.includedMeshes[index]);\r\n if (mesh) {\r\n gl.addIncludedOnlyMesh(mesh);\r\n }\r\n }\r\n return gl;\r\n };\r\n /**\r\n * Effect Name of the layer.\r\n */\r\n GlowLayer.EffectName = \"GlowLayer\";\r\n /**\r\n * The default blur kernel size used for the glow.\r\n */\r\n GlowLayer.DefaultBlurKernelSize = 32;\r\n /**\r\n * The default texture size ratio used for the glow.\r\n */\r\n GlowLayer.DefaultTextureRatio = 0.5;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], GlowLayer.prototype, \"blurKernelSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], GlowLayer.prototype, \"intensity\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"options\")\r\n ], GlowLayer.prototype, \"_options\", void 0);\r\n return GlowLayer;\r\n}(_effectLayer__WEBPACK_IMPORTED_MODULE_8__[\"EffectLayer\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_11__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.GlowLayer\"] = GlowLayer;\r\n\n\n/***/ }),\n\n/***/ \"./Layers/highlightLayer.ts\":\n/*!**********************************!*\\\n !*** ./Layers/highlightLayer.ts ***!\n \\**********************************/\n/*! exports provided: HighlightLayer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return HighlightLayer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_fragment__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Shaders/glowMapMerge.fragment */ \"./Shaders/glowMapMerge.fragment.ts\");\n/* harmony import */ var _Shaders_glowMapMerge_vertex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Shaders/glowMapMerge.vertex */ \"./Shaders/glowMapMerge.vertex.ts\");\n/* harmony import */ var _Shaders_glowBlurPostProcess_fragment__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Shaders/glowBlurPostProcess.fragment */ \"./Shaders/glowBlurPostProcess.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_13__[\"AbstractScene\"].prototype.getHighlightLayerByName = function (name) {\r\n for (var index = 0; index < this.effectLayers.length; index++) {\r\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {\r\n return this.effectLayers[index];\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n * Special Glow Blur post process only blurring the alpha channel\r\n * It enforces keeping the most luminous color in the color channel.\r\n */\r\nvar GlowBlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GlowBlurPostProcess, _super);\r\n function GlowBlurPostProcess(name, direction, kernel, options, camera, samplingMode, engine, reusable) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n var _this = _super.call(this, name, \"glowBlurPostProcess\", [\"screenSize\", \"direction\", \"blurWidth\"], null, options, camera, samplingMode, engine, reusable) || this;\r\n _this.direction = direction;\r\n _this.kernel = kernel;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", _this.width, _this.height);\r\n effect.setVector2(\"direction\", _this.direction);\r\n effect.setFloat(\"blurWidth\", _this.kernel);\r\n });\r\n return _this;\r\n }\r\n return GlowBlurPostProcess;\r\n}(_PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_9__[\"PostProcess\"]));\r\n/**\r\n * The highlight layer Helps adding a glow effect around a mesh.\r\n *\r\n * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove\r\n * glowy meshes to your scene.\r\n *\r\n * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!\r\n */\r\nvar HighlightLayer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HighlightLayer, _super);\r\n /**\r\n * Instantiates a new highlight Layer and references it to the scene..\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)\r\n */\r\n function HighlightLayer(name, scene, options) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this.name = name;\r\n /**\r\n * Specifies whether or not the inner glow is ACTIVE in the layer.\r\n */\r\n _this.innerGlow = true;\r\n /**\r\n * Specifies whether or not the outer glow is ACTIVE in the layer.\r\n */\r\n _this.outerGlow = true;\r\n /**\r\n * An event triggered when the highlight layer is being blurred.\r\n */\r\n _this.onBeforeBlurObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * An event triggered when the highlight layer has been blurred.\r\n */\r\n _this.onAfterBlurObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._instanceGlowingMeshStencilReference = HighlightLayer.GlowingMeshStencilReference++;\r\n _this._meshes = {};\r\n _this._excludedMeshes = {};\r\n _this.neutralColor = HighlightLayer.NeutralColor;\r\n // Warn on stencil\r\n if (!_this._engine.isStencilEnable) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_15__[\"Logger\"].Warn(\"Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }\");\r\n }\r\n // Adapt options\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ mainTextureRatio: 0.5, blurTextureSizeRatio: 0.5, blurHorizontalSize: 1.0, blurVerticalSize: 1.0, alphaBlendingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].ALPHA_COMBINE, camera: null, renderingGroupId: -1 }, options);\r\n // Initialize the layer\r\n _this._init({\r\n alphaBlendingMode: _this._options.alphaBlendingMode,\r\n camera: _this._options.camera,\r\n mainTextureFixedSize: _this._options.mainTextureFixedSize,\r\n mainTextureRatio: _this._options.mainTextureRatio,\r\n renderingGroupId: _this._options.renderingGroupId\r\n });\r\n // Do not render as long as no meshes have been added\r\n _this._shouldRender = false;\r\n return _this;\r\n }\r\n Object.defineProperty(HighlightLayer.prototype, \"blurHorizontalSize\", {\r\n /**\r\n * Gets the horizontal size of the blur.\r\n */\r\n get: function () {\r\n return this._horizontalBlurPostprocess.kernel;\r\n },\r\n /**\r\n * Specifies the horizontal size of the blur.\r\n */\r\n set: function (value) {\r\n this._horizontalBlurPostprocess.kernel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HighlightLayer.prototype, \"blurVerticalSize\", {\r\n /**\r\n * Gets the vertical size of the blur.\r\n */\r\n get: function () {\r\n return this._verticalBlurPostprocess.kernel;\r\n },\r\n /**\r\n * Specifies the vertical size of the blur.\r\n */\r\n set: function (value) {\r\n this._verticalBlurPostprocess.kernel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the effect name of the layer.\r\n * @return The effect name\r\n */\r\n HighlightLayer.prototype.getEffectName = function () {\r\n return HighlightLayer.EffectName;\r\n };\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n */\r\n HighlightLayer.prototype._createMergeEffect = function () {\r\n // Effect\r\n return this._engine.createEffect(\"glowMapMerge\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind], [\"offset\"], [\"textureSampler\"], this._options.isStroke ? \"#define STROKE \\n\" : undefined);\r\n };\r\n /**\r\n * Creates the render target textures and post processes used in the highlight layer.\r\n */\r\n HighlightLayer.prototype._createTextureAndPostProcesses = function () {\r\n var _this = this;\r\n var blurTextureWidth = this._mainTextureDesiredSize.width * this._options.blurTextureSizeRatio;\r\n var blurTextureHeight = this._mainTextureDesiredSize.height * this._options.blurTextureSizeRatio;\r\n blurTextureWidth = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\r\n blurTextureHeight = this._engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\r\n var textureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n this._blurTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_8__[\"RenderTargetTexture\"](\"HighlightLayerBlurRTT\", {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, this._scene, false, true, textureType);\r\n this._blurTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._blurTexture.anisotropicFilteringLevel = 16;\r\n this._blurTexture.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n this._blurTexture.renderParticles = false;\r\n this._blurTexture.ignoreCameraViewport = true;\r\n this._textures = [this._blurTexture];\r\n if (this._options.alphaBlendingMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].ALPHA_COMBINE) {\r\n this._downSamplePostprocess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"PassPostProcess\"](\"HighlightLayerPPP\", this._options.blurTextureSizeRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine());\r\n this._downSamplePostprocess.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._mainTexture);\r\n });\r\n this._horizontalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerHBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1.0, 0), this._options.blurHorizontalSize, 1, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine());\r\n this._horizontalBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n this._verticalBlurPostprocess = new GlowBlurPostProcess(\"HighlightLayerVBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 1.0), this._options.blurVerticalSize, 1, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine());\r\n this._verticalBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", blurTextureWidth, blurTextureHeight);\r\n });\r\n this._postProcesses = [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n }\r\n else {\r\n this._horizontalBlurPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](\"HighlightLayerHBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1.0, 0), this._options.blurHorizontalSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._horizontalBlurPostprocess.width = blurTextureWidth;\r\n this._horizontalBlurPostprocess.height = blurTextureHeight;\r\n this._horizontalBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._mainTexture);\r\n });\r\n this._verticalBlurPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](\"HighlightLayerVBP\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 1.0), this._options.blurVerticalSize / 2, {\r\n width: blurTextureWidth,\r\n height: blurTextureHeight\r\n }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_7__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\r\n this._postProcesses = [this._horizontalBlurPostprocess, this._verticalBlurPostprocess];\r\n }\r\n this._mainTexture.onAfterUnbindObservable.add(function () {\r\n _this.onBeforeBlurObservable.notifyObservers(_this);\r\n var internalTexture = _this._blurTexture.getInternalTexture();\r\n if (internalTexture) {\r\n _this._scene.postProcessManager.directRender(_this._postProcesses, internalTexture, true);\r\n }\r\n _this.onAfterBlurObservable.notifyObservers(_this);\r\n });\r\n // Prevent autoClear.\r\n this._postProcesses.map(function (pp) { pp.autoClear = false; });\r\n };\r\n /**\r\n * Returns wether or nood the layer needs stencil enabled during the mesh rendering.\r\n */\r\n HighlightLayer.prototype.needStencil = function () {\r\n return true;\r\n };\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify wether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @return true if ready otherwise, false\r\n */\r\n HighlightLayer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n var mesh = subMesh.getRenderingMesh();\r\n if (!material || !mesh || !this._meshes) {\r\n return false;\r\n }\r\n var emissiveTexture = null;\r\n var highlightLayerMesh = this._meshes[mesh.uniqueId];\r\n if (highlightLayerMesh && highlightLayerMesh.glowEmissiveOnly && material) {\r\n emissiveTexture = material.emissiveTexture;\r\n }\r\n return _super.prototype._isReady.call(this, subMesh, useInstances, emissiveTexture);\r\n };\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n */\r\n HighlightLayer.prototype._internalRender = function (effect) {\r\n // Texture\r\n effect.setTexture(\"textureSampler\", this._blurTexture);\r\n // Cache\r\n var engine = this._engine;\r\n engine.cacheStencilState();\r\n // Stencil operations\r\n engine.setStencilOperationPass(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].REPLACE);\r\n engine.setStencilOperationFail(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].KEEP);\r\n engine.setStencilOperationDepthFail(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].KEEP);\r\n // Draw order\r\n engine.setStencilMask(0x00);\r\n engine.setStencilBuffer(true);\r\n engine.setStencilFunctionReference(this._instanceGlowingMeshStencilReference);\r\n // 2 passes inner outer\r\n if (this.outerGlow) {\r\n effect.setFloat(\"offset\", 0);\r\n engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].NOTEQUAL);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n if (this.innerGlow) {\r\n effect.setFloat(\"offset\", 1);\r\n engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_14__[\"Constants\"].EQUAL);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n // Restore Cache\r\n engine.restoreStencilState();\r\n };\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n */\r\n HighlightLayer.prototype.shouldRender = function () {\r\n if (_super.prototype.shouldRender.call(this)) {\r\n return this._meshes ? true : false;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n HighlightLayer.prototype._shouldRenderMesh = function (mesh) {\r\n // Excluded Mesh\r\n if (this._excludedMeshes && this._excludedMeshes[mesh.uniqueId]) {\r\n return false;\r\n }\r\n if (!_super.prototype.hasMesh.call(this, mesh)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n HighlightLayer.prototype._setEmissiveTextureAndColor = function (mesh, subMesh, material) {\r\n var highlightLayerMesh = this._meshes[mesh.uniqueId];\r\n if (highlightLayerMesh) {\r\n this._emissiveTextureAndColor.color.set(highlightLayerMesh.color.r, highlightLayerMesh.color.g, highlightLayerMesh.color.b, 1.0);\r\n }\r\n else {\r\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\r\n }\r\n if (highlightLayerMesh && highlightLayerMesh.glowEmissiveOnly && material) {\r\n this._emissiveTextureAndColor.texture = material.emissiveTexture;\r\n this._emissiveTextureAndColor.color.set(1.0, 1.0, 1.0, 1.0);\r\n }\r\n else {\r\n this._emissiveTextureAndColor.texture = null;\r\n }\r\n };\r\n /**\r\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.\r\n * @param mesh The mesh to exclude from the highlight layer\r\n */\r\n HighlightLayer.prototype.addExcludedMesh = function (mesh) {\r\n if (!this._excludedMeshes) {\r\n return;\r\n }\r\n var meshExcluded = this._excludedMeshes[mesh.uniqueId];\r\n if (!meshExcluded) {\r\n this._excludedMeshes[mesh.uniqueId] = {\r\n mesh: mesh,\r\n beforeBind: mesh.onBeforeBindObservable.add(function (mesh) {\r\n mesh.getEngine().setStencilBuffer(false);\r\n }),\r\n afterRender: mesh.onAfterRenderObservable.add(function (mesh) {\r\n mesh.getEngine().setStencilBuffer(true);\r\n }),\r\n };\r\n }\r\n };\r\n /**\r\n * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.\r\n * @param mesh The mesh to highlight\r\n */\r\n HighlightLayer.prototype.removeExcludedMesh = function (mesh) {\r\n if (!this._excludedMeshes) {\r\n return;\r\n }\r\n var meshExcluded = this._excludedMeshes[mesh.uniqueId];\r\n if (meshExcluded) {\r\n if (meshExcluded.beforeBind) {\r\n mesh.onBeforeBindObservable.remove(meshExcluded.beforeBind);\r\n }\r\n if (meshExcluded.afterRender) {\r\n mesh.onAfterRenderObservable.remove(meshExcluded.afterRender);\r\n }\r\n }\r\n this._excludedMeshes[mesh.uniqueId] = null;\r\n };\r\n /**\r\n * Determine if a given mesh will be highlighted by the current HighlightLayer\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be highlighted by the current HighlightLayer\r\n */\r\n HighlightLayer.prototype.hasMesh = function (mesh) {\r\n if (!this._meshes) {\r\n return false;\r\n }\r\n if (!_super.prototype.hasMesh.call(this, mesh)) {\r\n return false;\r\n }\r\n return this._meshes[mesh.uniqueId] !== undefined && this._meshes[mesh.uniqueId] !== null;\r\n };\r\n /**\r\n * Add a mesh in the highlight layer in order to make it glow with the chosen color.\r\n * @param mesh The mesh to highlight\r\n * @param color The color of the highlight\r\n * @param glowEmissiveOnly Extract the glow from the emissive texture\r\n */\r\n HighlightLayer.prototype.addMesh = function (mesh, color, glowEmissiveOnly) {\r\n var _this = this;\r\n if (glowEmissiveOnly === void 0) { glowEmissiveOnly = false; }\r\n if (!this._meshes) {\r\n return;\r\n }\r\n var meshHighlight = this._meshes[mesh.uniqueId];\r\n if (meshHighlight) {\r\n meshHighlight.color = color;\r\n }\r\n else {\r\n this._meshes[mesh.uniqueId] = {\r\n mesh: mesh,\r\n color: color,\r\n // Lambda required for capture due to Observable this context\r\n observerHighlight: mesh.onBeforeBindObservable.add(function (mesh) {\r\n if (_this.isEnabled) {\r\n if (_this._excludedMeshes && _this._excludedMeshes[mesh.uniqueId]) {\r\n _this._defaultStencilReference(mesh);\r\n }\r\n else {\r\n mesh.getScene().getEngine().setStencilFunctionReference(_this._instanceGlowingMeshStencilReference);\r\n }\r\n }\r\n }),\r\n observerDefault: mesh.onAfterRenderObservable.add(function (mesh) {\r\n if (_this.isEnabled) {\r\n _this._defaultStencilReference(mesh);\r\n }\r\n }),\r\n glowEmissiveOnly: glowEmissiveOnly\r\n };\r\n mesh.onDisposeObservable.add(function () {\r\n _this._disposeMesh(mesh);\r\n });\r\n }\r\n this._shouldRender = true;\r\n };\r\n /**\r\n * Remove a mesh from the highlight layer in order to make it stop glowing.\r\n * @param mesh The mesh to highlight\r\n */\r\n HighlightLayer.prototype.removeMesh = function (mesh) {\r\n if (!this._meshes) {\r\n return;\r\n }\r\n var meshHighlight = this._meshes[mesh.uniqueId];\r\n if (meshHighlight) {\r\n if (meshHighlight.observerHighlight) {\r\n mesh.onBeforeBindObservable.remove(meshHighlight.observerHighlight);\r\n }\r\n if (meshHighlight.observerDefault) {\r\n mesh.onAfterRenderObservable.remove(meshHighlight.observerDefault);\r\n }\r\n delete this._meshes[mesh.uniqueId];\r\n }\r\n this._shouldRender = false;\r\n for (var meshHighlightToCheck in this._meshes) {\r\n if (this._meshes[meshHighlightToCheck]) {\r\n this._shouldRender = true;\r\n break;\r\n }\r\n }\r\n };\r\n /**\r\n * Force the stencil to the normal expected value for none glowing parts\r\n */\r\n HighlightLayer.prototype._defaultStencilReference = function (mesh) {\r\n mesh.getScene().getEngine().setStencilFunctionReference(HighlightLayer.NormalMeshStencilReference);\r\n };\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n * @hidden\r\n */\r\n HighlightLayer.prototype._disposeMesh = function (mesh) {\r\n this.removeMesh(mesh);\r\n this.removeExcludedMesh(mesh);\r\n };\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n HighlightLayer.prototype.dispose = function () {\r\n if (this._meshes) {\r\n // Clean mesh references\r\n for (var id in this._meshes) {\r\n var meshHighlight = this._meshes[id];\r\n if (meshHighlight && meshHighlight.mesh) {\r\n if (meshHighlight.observerHighlight) {\r\n meshHighlight.mesh.onBeforeBindObservable.remove(meshHighlight.observerHighlight);\r\n }\r\n if (meshHighlight.observerDefault) {\r\n meshHighlight.mesh.onAfterRenderObservable.remove(meshHighlight.observerDefault);\r\n }\r\n }\r\n }\r\n this._meshes = null;\r\n }\r\n if (this._excludedMeshes) {\r\n for (var id in this._excludedMeshes) {\r\n var meshHighlight = this._excludedMeshes[id];\r\n if (meshHighlight) {\r\n if (meshHighlight.beforeBind) {\r\n meshHighlight.mesh.onBeforeBindObservable.remove(meshHighlight.beforeBind);\r\n }\r\n if (meshHighlight.afterRender) {\r\n meshHighlight.mesh.onAfterRenderObservable.remove(meshHighlight.afterRender);\r\n }\r\n }\r\n }\r\n this._excludedMeshes = null;\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n HighlightLayer.prototype.getClassName = function () {\r\n return \"HighlightLayer\";\r\n };\r\n /**\r\n * Serializes this Highlight layer\r\n * @returns a serialized Highlight layer object\r\n */\r\n HighlightLayer.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.HighlightLayer\";\r\n // Highlighted meshes\r\n serializationObject.meshes = [];\r\n if (this._meshes) {\r\n for (var m in this._meshes) {\r\n var mesh = this._meshes[m];\r\n if (mesh) {\r\n serializationObject.meshes.push({\r\n glowEmissiveOnly: mesh.glowEmissiveOnly,\r\n color: mesh.color.asArray(),\r\n meshId: mesh.mesh.id\r\n });\r\n }\r\n }\r\n }\r\n // Excluded meshes\r\n serializationObject.excludedMeshes = [];\r\n if (this._excludedMeshes) {\r\n for (var e in this._excludedMeshes) {\r\n var excludedMesh = this._excludedMeshes[e];\r\n if (excludedMesh) {\r\n serializationObject.excludedMeshes.push(excludedMesh.mesh.id);\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a Highlight layer from parsed Highlight layer data\r\n * @param parsedHightlightLayer defines the Highlight layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the Highlight layer information\r\n * @returns a parsed Highlight layer\r\n */\r\n HighlightLayer.Parse = function (parsedHightlightLayer, scene, rootUrl) {\r\n var hl = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new HighlightLayer(parsedHightlightLayer.name, scene, parsedHightlightLayer.options); }, parsedHightlightLayer, scene, rootUrl);\r\n var index;\r\n // Excluded meshes\r\n for (index = 0; index < parsedHightlightLayer.excludedMeshes.length; index++) {\r\n var mesh = scene.getMeshByID(parsedHightlightLayer.excludedMeshes[index]);\r\n if (mesh) {\r\n hl.addExcludedMesh(mesh);\r\n }\r\n }\r\n // Included meshes\r\n for (index = 0; index < parsedHightlightLayer.meshes.length; index++) {\r\n var highlightedMesh = parsedHightlightLayer.meshes[index];\r\n var mesh = scene.getMeshByID(highlightedMesh.meshId);\r\n if (mesh) {\r\n hl.addMesh(mesh, _Maths_math_color__WEBPACK_IMPORTED_MODULE_17__[\"Color3\"].FromArray(highlightedMesh.color), highlightedMesh.glowEmissiveOnly);\r\n }\r\n }\r\n return hl;\r\n };\r\n /**\r\n * Effect Name of the highlight layer.\r\n */\r\n HighlightLayer.EffectName = \"HighlightLayer\";\r\n /**\r\n * The neutral color used during the preparation of the glow effect.\r\n * This is black by default as the blend operation is a blend operation.\r\n */\r\n HighlightLayer.NeutralColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_17__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * Stencil value used for glowing meshes.\r\n */\r\n HighlightLayer.GlowingMeshStencilReference = 0x02;\r\n /**\r\n * Stencil value used for the other meshes in the scene.\r\n */\r\n HighlightLayer.NormalMeshStencilReference = 0x01;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"innerGlow\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"outerGlow\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"blurHorizontalSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], HighlightLayer.prototype, \"blurVerticalSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"options\")\r\n ], HighlightLayer.prototype, \"_options\", void 0);\r\n return HighlightLayer;\r\n}(_effectLayer__WEBPACK_IMPORTED_MODULE_12__[\"EffectLayer\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_16__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.HighlightLayer\"] = HighlightLayer;\r\n\n\n/***/ }),\n\n/***/ \"./Layers/index.ts\":\n/*!*************************!*\\\n !*** ./Layers/index.ts ***!\n \\*************************/\n/*! exports provided: EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _effectLayer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./effectLayer */ \"./Layers/effectLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return _effectLayer__WEBPACK_IMPORTED_MODULE_0__[\"EffectLayer\"]; });\n\n/* harmony import */ var _effectLayerSceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./effectLayerSceneComponent */ \"./Layers/effectLayerSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return _effectLayerSceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"EffectLayerSceneComponent\"]; });\n\n/* harmony import */ var _glowLayer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glowLayer */ \"./Layers/glowLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return _glowLayer__WEBPACK_IMPORTED_MODULE_2__[\"GlowLayer\"]; });\n\n/* harmony import */ var _highlightLayer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./highlightLayer */ \"./Layers/highlightLayer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return _highlightLayer__WEBPACK_IMPORTED_MODULE_3__[\"HighlightLayer\"]; });\n\n/* harmony import */ var _layer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./layer */ \"./Layers/layer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return _layer__WEBPACK_IMPORTED_MODULE_4__[\"Layer\"]; });\n\n/* harmony import */ var _layerSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./layerSceneComponent */ \"./Layers/layerSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return _layerSceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"LayerSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/layer.ts\":\n/*!*************************!*\\\n !*** ./Layers/layer.ts ***!\n \\*************************/\n/*! exports provided: Layer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return Layer; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _layerSceneComponent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./layerSceneComponent */ \"./Layers/layerSceneComponent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_layer_fragment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/layer.fragment */ \"./Shaders/layer.fragment.ts\");\n/* harmony import */ var _Shaders_layer_vertex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/layer.vertex */ \"./Shaders/layer.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n */\r\nvar Layer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new layer.\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n * @param name Define the name of the layer in the scene\r\n * @param imgUrl Define the url of the texture to display in the layer\r\n * @param scene Define the scene the layer belongs to\r\n * @param isBackground Defines whether the layer is displayed in front or behind the scene\r\n * @param color Defines a color for the layer\r\n */\r\n function Layer(\r\n /**\r\n * Define the name of the layer.\r\n */\r\n name, imgUrl, scene, isBackground, color) {\r\n this.name = name;\r\n /**\r\n * Define the scale of the layer in order to zoom in out of the texture.\r\n */\r\n this.scale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1, 1);\r\n /**\r\n * Define an offset for the layer in order to shift the texture.\r\n */\r\n this.offset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 0);\r\n /**\r\n * Define the alpha blending mode used in the layer in case the texture or color has an alpha.\r\n */\r\n this.alphaBlendingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_COMBINE;\r\n /**\r\n * Define a mask to restrict the layer to only some of the scene cameras.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * Define the list of render target the layer is visible into.\r\n */\r\n this.renderTargetTextures = [];\r\n /**\r\n * Define if the layer is only used in renderTarget or if it also\r\n * renders in the main frame buffer of the canvas.\r\n */\r\n this.renderOnlyInRenderTargetTextures = false;\r\n this._vertexBuffers = {};\r\n /**\r\n * An event triggered when the layer is disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering the scene\r\n */\r\n this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this.texture = imgUrl ? new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"](imgUrl, scene, true) : null;\r\n this.isBackground = isBackground === undefined ? true : isBackground;\r\n this.color = color === undefined ? new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](1, 1, 1, 1) : color;\r\n this._scene = (scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene);\r\n var layerComponent = this._scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_7__[\"SceneComponentConstants\"].NAME_LAYER);\r\n if (!layerComponent) {\r\n layerComponent = new _layerSceneComponent__WEBPACK_IMPORTED_MODULE_8__[\"LayerSceneComponent\"](this._scene);\r\n this._scene._addComponent(layerComponent);\r\n }\r\n this._scene.layers.push(this);\r\n var engine = this._scene.getEngine();\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n var vertexBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"](engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = vertexBuffer;\r\n this._createIndexBuffer();\r\n // Effects\r\n this._effect = engine.createEffect(\"layer\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind], [\"textureMatrix\", \"color\", \"scale\", \"offset\"], [\"textureSampler\"], \"\");\r\n this._alphaTestEffect = engine.createEffect(\"layer\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind], [\"textureMatrix\", \"color\", \"scale\", \"offset\"], [\"textureSampler\"], \"#define ALPHATEST\");\r\n }\r\n Object.defineProperty(Layer.prototype, \"onDispose\", {\r\n /**\r\n * Back compatibility with callback before the onDisposeObservable existed.\r\n * The set callback will be triggered when the layer has been disposed.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onBeforeRender\", {\r\n /**\r\n * Back compatibility with callback before the onBeforeRenderObservable existed.\r\n * The set callback will be triggered just before rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onAfterRender\", {\r\n /**\r\n * Back compatibility with callback before the onAfterRenderObservable existed.\r\n * The set callback will be triggered just after rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Layer.prototype._createIndexBuffer = function () {\r\n var engine = this._scene.getEngine();\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n };\r\n /** @hidden */\r\n Layer.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n };\r\n /**\r\n * Renders the layer in the scene.\r\n */\r\n Layer.prototype.render = function () {\r\n var currentEffect = this.alphaTest ? this._alphaTestEffect : this._effect;\r\n // Check\r\n if (!currentEffect.isReady() || !this.texture || !this.texture.isReady()) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Render\r\n engine.enableEffect(currentEffect);\r\n engine.setState(false);\r\n // Texture\r\n currentEffect.setTexture(\"textureSampler\", this.texture);\r\n currentEffect.setMatrix(\"textureMatrix\", this.texture.getTextureMatrix());\r\n // Color\r\n currentEffect.setFloat4(\"color\", this.color.r, this.color.g, this.color.b, this.color.a);\r\n // Scale / offset\r\n currentEffect.setVector2(\"offset\", this.offset);\r\n currentEffect.setVector2(\"scale\", this.scale);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);\r\n // Draw order\r\n if (!this.alphaTest) {\r\n engine.setAlphaMode(this.alphaBlendingMode);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n else {\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Disposes and releases the associated ressources.\r\n */\r\n Layer.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (this.texture) {\r\n this.texture.dispose();\r\n this.texture = null;\r\n }\r\n // Clean RTT list\r\n this.renderTargetTextures = [];\r\n // Remove from scene\r\n var index = this._scene.layers.indexOf(this);\r\n this._scene.layers.splice(index, 1);\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n };\r\n return Layer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Layers/layerSceneComponent.ts\":\n/*!***************************************!*\\\n !*** ./Layers/layerSceneComponent.ts ***!\n \\***************************************/\n/*! exports provided: LayerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return LayerSceneComponent; });\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n\r\n/**\r\n * Defines the layer scene component responsible to manage any layers\r\n * in a given scene.\r\n */\r\nvar LayerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function LayerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].NAME_LAYER;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n scene.layers = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n LayerSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_BEFORECAMERADRAW_LAYER, this, this._drawCameraBackground);\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_LAYER, this, this._drawCameraForeground);\r\n this.scene._beforeRenderTargetDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_BEFORERENDERTARGETDRAW_LAYER, this, this._drawRenderTargetBackground);\r\n this.scene._afterRenderTargetDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_AFTERRENDERTARGETDRAW_LAYER, this, this._drawRenderTargetForeground);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n LayerSceneComponent.prototype.rebuild = function () {\r\n var layers = this.scene.layers;\r\n for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {\r\n var layer = layers_1[_i];\r\n layer._rebuild();\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n LayerSceneComponent.prototype.dispose = function () {\r\n var layers = this.scene.layers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n };\r\n LayerSceneComponent.prototype._draw = function (predicate) {\r\n var layers = this.scene.layers;\r\n if (layers.length) {\r\n this._engine.setDepthBuffer(false);\r\n for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {\r\n var layer = layers_2[_i];\r\n if (predicate(layer)) {\r\n layer.render();\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n };\r\n LayerSceneComponent.prototype._drawCameraPredicate = function (layer, isBackground, cameraLayerMask) {\r\n return !layer.renderOnlyInRenderTargetTextures &&\r\n layer.isBackground === isBackground &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawCameraBackground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, true, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawCameraForeground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, false, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetPredicate = function (layer, isBackground, cameraLayerMask, renderTargetTexture) {\r\n return (layer.renderTargetTextures.length > 0) &&\r\n layer.isBackground === isBackground &&\r\n (layer.renderTargetTextures.indexOf(renderTargetTexture) > -1) &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetBackground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, true, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetForeground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, false, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n LayerSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n _this.scene.layers.push(layer);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n LayerSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (dispose === void 0) { dispose = false; }\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n var index = _this.scene.layers.indexOf(layer);\r\n if (index !== -1) {\r\n _this.scene.layers.splice(index, 1);\r\n }\r\n if (dispose) {\r\n layer.dispose();\r\n }\r\n });\r\n };\r\n return LayerSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Legacy/legacy.ts\":\n/*!**************************!*\\\n !*** ./Legacy/legacy.ts ***!\n \\**************************/\n/*! exports provided: Debug, AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Debug\", function() { return Debug; });\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ \"./index.ts\");\n/* harmony import */ var _Debug_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Debug/index */ \"./Debug/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractScene\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractScene\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeepAssets\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeepAssets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetContainer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetContainer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Node\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Node\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scene\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneComponentConstants\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Stage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Stage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Action\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ActionEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Condition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ValueCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PredicateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SwitchBooleanAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SetStateAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SetValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"IncrementValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlayAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StopAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DoNothingAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CombineAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ExecuteCodeAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SetParentAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaySoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StopSoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InterpolateValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Animatable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_IAnimationState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Animation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TargetedAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationPropertiesOverride\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EasingFunction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CircleEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BackEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BounceEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubicEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ElasticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ExponentialEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PowerEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"QuadraticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"QuarticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"QuinticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SineEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BezierCurveEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RuntimeAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationKeyInterpolation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimationRange\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Analyser\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AudioEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AudioSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Sound\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SoundTrack\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WeightedSound\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AutoRotationBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BouncingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FramingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Bone\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoneIKController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoneLookController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Skeleton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Camera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TargetCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TouchCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DeviceOrientationCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcFollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"UniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoysticksCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Collider\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultCollisionCoordinator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PickingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"IntersectionInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_MeshCollisionData\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBox\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingSphere\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Ray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoneAxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DebugLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RayHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SkeletonViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancingAttributeInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthTextureCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EngineCapabilities\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EngineStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NullEngineOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NullEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebGLPipelineContext\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebGL2ShaderProcessor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NativeEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KeyboardInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfoBase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointerInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ClipboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ClipboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DaydreamController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GearVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GenericController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OculusTouchController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PoseEnabledController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ViveController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WindowsMotionController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StickValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Gamepad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GenericPad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GamepadManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GamepadSystemSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Xbox360Button\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Xbox360Dpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Xbox360Pad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DualShockButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DualShockDpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DualShockPad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AxisDragGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AxisScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBoxGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Gizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GizmoManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaneRotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PositionGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LightGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaneDragGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhotoDome\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_forceSceneHelpersToBundle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VideoDome\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EngineInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_TimeToken\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectLayerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GlowLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HighlightLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Layer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LayerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlare\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlareSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlareSystemSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Light\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DirectionalLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HemisphericLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpotLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultLoadingScreen\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoaderProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoaderFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectFallbacks\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingConfigurationDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Material\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaterialHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PushMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShaderMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StandardMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StandardMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BaseTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DynamicTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HDRCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InternalTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MirrorTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiRenderTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RawTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderTargetTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"UniformBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaterialFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EffectWrapper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Axis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TmpColors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Epsilon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Frustum\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Plane\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Size\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Viewport\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphericalHarmonics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphericalPolynomial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Buffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CSG\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Geometry\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GroundMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TrailMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancedMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancedLinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_CreationDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_InstancesBatch\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VertexData\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplificationSettings\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplificationQueue\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplificationType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SimplicationQueueSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Polygon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PolygonMeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BaseSubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshLODLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TransformNode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CylinderBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TorusBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LinesBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GroundBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebGLDataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTargetManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Database\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BaseParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GPUParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Particle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticleHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_IDoNeedToBeInTheBuild\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticleSystemSet\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SolidParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ModelShape\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthSortedParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SolidParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubEmitterType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsEngineSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsRadialExplosionEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsUpdraftEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsVortexEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsRadialImpulseFalloff\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsUpdraftMode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DistanceJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MotorEnabledJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HingeJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Hinge2Joint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BlackAndWhitePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BloomEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BloomMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ChromaticAberrationPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CircleOfConfusionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ConvolutionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldEffectBlurLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldMergePostProcessOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthOfFieldMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DisplayPassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ExtractHighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FilterPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FxaaPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GrainPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MotionBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PassCubePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RefractionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SharpenPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicInterlacePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TonemappingOperator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TonemapPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VolumetricLightScatteringPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDistortionCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRMultiviewToSingleviewPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ReflectionProbe\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBoxRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DepthRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LineEdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GeometryBufferRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GeometryBufferRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OutlineRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderingGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderingGroupInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderingManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"UtilityLayerRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Sprite\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpriteManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpritePackedManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SpriteSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_AlphaState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_DepthCullingState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_StencilState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AndOrNotEvaluator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetTaskState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AbstractAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetsProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BinaryFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HDRCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EquiRectangularCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AssetsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DDSTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"expandToProperty\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serialize\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsColor3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsFresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsVector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsVector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsMeshReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsColor4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsQuaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsMatrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"serializeAsCameraReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SerializationHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Deferred\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MeshExploder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FilesInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"KhronosTextureContainer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"EventState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Observer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiObserver\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PerformanceMonitor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RollingAverage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PromisePolyfill\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HardwareScalingOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensFlaresOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CustomOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ParticlesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RenderTargetsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MergeMeshesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneOptimizerOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SceneSerializer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SmartArrayNoDuplicate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StringDictionary\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TGATools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"className\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AsyncLoop\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VideoRecorder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"JoystickAxis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VirtualJoystick\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WorkerPool\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_TypeStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FilesInputStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PivotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ScreenshotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebRequest\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InspectableType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BRDFTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RGBDTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Color3Gradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FactorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"GradientHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PerfCounter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RetryStrategy\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LoadFileError\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AttachToBoxBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FadeInOutBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SixDofDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FlyCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FollowCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraTouchInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FreeCameraVirtualJoystickInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StereoscopicUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRCameraMetrics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebVRFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXREnterExitUI\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"WebXRSessionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Octree\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OctreeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OctreeSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_OcclusionDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_forceTransformFeedbackToBundle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGeneratorSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_BabylonLoaderRegistered\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BackgroundMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRBaseMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PBRSpecularGlossinessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorGradingTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RawCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RawTexture3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RefractionTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VideoTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HtmlElementTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"Curve3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DracoCompression\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TiledBoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DiscBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RibbonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HemisphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TorusKnotBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PolygonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ShapeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LatheBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TiledPlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TubeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PolyhedronBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"IcoSphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DecalBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSCrowd\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BoxParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ConeParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PointParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SphereDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CannonJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AmmoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OimoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"HDRTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PanoramaToCubeMapTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"_BasisTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"StandardRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _index__WEBPACK_IMPORTED_MODULE_0__[\"AnimatedInputBlockTypes\"]; });\n\n\r\n\r\n/**\r\n * Legacy support, defining window.BABYLON (global variable).\r\n *\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nvar globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);\r\nif (typeof globalObject !== \"undefined\") {\r\n globalObject.BABYLON = BABYLON;\r\n globalObject.BABYLON = globalObject.BABYLON || {};\r\n var BABYLON = globalObject.BABYLON;\r\n BABYLON.Debug = BABYLON.Debug || {};\r\n var keys = [];\r\n for (var key in _Debug_index__WEBPACK_IMPORTED_MODULE_1__) {\r\n BABYLON.Debug[key] = _Debug_index__WEBPACK_IMPORTED_MODULE_1__[key];\r\n keys.push(key);\r\n }\r\n for (var key in _index__WEBPACK_IMPORTED_MODULE_0__) {\r\n BABYLON[key] = _index__WEBPACK_IMPORTED_MODULE_0__[key];\r\n }\r\n}\r\n\r\nvar Debug = {\r\n AxesViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"AxesViewer\"],\r\n BoneAxesViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"BoneAxesViewer\"],\r\n PhysicsViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsViewer\"],\r\n SkeletonViewer: _Debug_index__WEBPACK_IMPORTED_MODULE_1__[\"SkeletonViewer\"],\r\n};\r\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"../node_modules/webpack/buildin/global.js\")))\n\n/***/ }),\n\n/***/ \"./LensFlares/index.ts\":\n/*!*****************************!*\\\n !*** ./LensFlares/index.ts ***!\n \\*****************************/\n/*! exports provided: LensFlare, LensFlareSystem, LensFlareSystemSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _lensFlare__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lensFlare */ \"./LensFlares/lensFlare.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return _lensFlare__WEBPACK_IMPORTED_MODULE_0__[\"LensFlare\"]; });\n\n/* harmony import */ var _lensFlareSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lensFlareSystem */ \"./LensFlares/lensFlareSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return _lensFlareSystem__WEBPACK_IMPORTED_MODULE_1__[\"LensFlareSystem\"]; });\n\n/* harmony import */ var _lensFlareSystemSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lensFlareSystemSceneComponent */ \"./LensFlares/lensFlareSystemSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return _lensFlareSystemSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"LensFlareSystemSceneComponent\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./LensFlares/lensFlare.ts\":\n/*!*********************************!*\\\n !*** ./LensFlares/lensFlare.ts ***!\n \\*********************************/\n/*! exports provided: LensFlare */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return LensFlare; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n/**\r\n * This represents one of the lens effect in a `lensFlareSystem`.\r\n * It controls one of the indiviual texture used in the effect.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\nvar LensFlare = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Lens Flare.\r\n * This represents one of the lens effect in a `lensFlareSystem`.\r\n * It controls one of the indiviual texture used in the effect.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n * @param size Define the size of the lens flare in the system (a floating value between 0 and 1)\r\n * @param position Define the position of the lens flare in the system. (a floating value between -1 and 1). A value of 0 is located on the emitter. A value greater than 0 is beyond the emitter and a value lesser than 0 is behind.\r\n * @param color Define the lens color\r\n * @param imgUrl Define the lens texture url\r\n * @param system Define the `lensFlareSystem` this flare is part of\r\n */\r\n function LensFlare(\r\n /**\r\n * Define the size of the lens flare in the system (a floating value between 0 and 1)\r\n */\r\n size, \r\n /**\r\n * Define the position of the lens flare in the system. (a floating value between -1 and 1). A value of 0 is located on the emitter. A value greater than 0 is beyond the emitter and a value lesser than 0 is behind.\r\n */\r\n position, color, imgUrl, system) {\r\n this.size = size;\r\n this.position = position;\r\n /**\r\n * Define the alpha mode to render this particular lens.\r\n */\r\n this.alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_ONEONE;\r\n this.color = color || new _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color3\"](1, 1, 1);\r\n this.texture = imgUrl ? new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](imgUrl, system.getScene(), true) : null;\r\n this._system = system;\r\n system.lensFlares.push(this);\r\n }\r\n /**\r\n * Creates a new Lens Flare.\r\n * This represents one of the lens effect in a `lensFlareSystem`.\r\n * It controls one of the indiviual texture used in the effect.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n * @param size Define the size of the lens flare (a floating value between 0 and 1)\r\n * @param position Define the position of the lens flare in the system. (a floating value between -1 and 1). A value of 0 is located on the emitter. A value greater than 0 is beyond the emitter and a value lesser than 0 is behind.\r\n * @param color Define the lens color\r\n * @param imgUrl Define the lens texture url\r\n * @param system Define the `lensFlareSystem` this flare is part of\r\n * @returns The newly created Lens Flare\r\n */\r\n LensFlare.AddFlare = function (size, position, color, imgUrl, system) {\r\n return new LensFlare(size, position, color, imgUrl, system);\r\n };\r\n /**\r\n * Dispose and release the lens flare with its associated resources.\r\n */\r\n LensFlare.prototype.dispose = function () {\r\n if (this.texture) {\r\n this.texture.dispose();\r\n }\r\n // Remove from scene\r\n var index = this._system.lensFlares.indexOf(this);\r\n this._system.lensFlares.splice(index, 1);\r\n };\r\n return LensFlare;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./LensFlares/lensFlareSystem.ts\":\n/*!***************************************!*\\\n !*** ./LensFlares/lensFlareSystem.ts ***!\n \\***************************************/\n/*! exports provided: LensFlareSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return LensFlareSystem; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _lensFlare__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lensFlare */ \"./LensFlares/lensFlare.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_lensFlare_fragment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Shaders/lensFlare.fragment */ \"./Shaders/lensFlare.fragment.ts\");\n/* harmony import */ var _Shaders_lensFlare_vertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/lensFlare.vertex */ \"./Shaders/lensFlare.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a Lens Flare System or the shiny effect created by the light reflection on the camera lenses.\r\n * It is usually composed of several `lensFlare`.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\nvar LensFlareSystem = /** @class */ (function () {\r\n /**\r\n * Instantiates a lens flare system.\r\n * This represents a Lens Flare System or the shiny effect created by the light reflection on the camera lenses.\r\n * It is usually composed of several `lensFlare`.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n * @param name Define the name of the lens flare system in the scene\r\n * @param emitter Define the source (the emitter) of the lens flares (it can be a camera, a light or a mesh).\r\n * @param scene Define the scene the lens flare system belongs to\r\n */\r\n function LensFlareSystem(\r\n /**\r\n * Define the name of the lens flare system\r\n */\r\n name, emitter, scene) {\r\n this.name = name;\r\n /**\r\n * List of lens flares used in this system.\r\n */\r\n this.lensFlares = new Array();\r\n /**\r\n * Define a limit from the border the lens flare can be visible.\r\n */\r\n this.borderLimit = 300;\r\n /**\r\n * Define a viewport border we do not want to see the lens flare in.\r\n */\r\n this.viewportBorder = 0;\r\n /**\r\n * Restricts the rendering of the effect to only the camera rendering this layer mask.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n this._vertexBuffers = {};\r\n this._isEnabled = true;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene;\r\n LensFlareSystem._SceneComponentInitialization(this._scene);\r\n this._emitter = emitter;\r\n this.id = name;\r\n scene.lensFlareSystems.push(this);\r\n this.meshesSelectionPredicate = function (m) { return (scene.activeCamera && m.material && m.isVisible && m.isEnabled() && m.isBlocker && ((m.layerMask & scene.activeCamera.layerMask) != 0)); };\r\n var engine = scene.getEngine();\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"](engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n // Effects\r\n this._effect = engine.createEffect(\"lensFlare\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind], [\"color\", \"viewportMatrix\"], [\"textureSampler\"], \"\");\r\n }\r\n Object.defineProperty(LensFlareSystem.prototype, \"isEnabled\", {\r\n /**\r\n * Define if the lens flare system is enabled.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n set: function (value) {\r\n this._isEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the scene the effects belongs to.\r\n * @returns the scene holding the lens flare system\r\n */\r\n LensFlareSystem.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Get the emitter of the lens flare system.\r\n * It defines the source of the lens flares (it can be a camera, a light or a mesh).\r\n * @returns the emitter of the lens flare system\r\n */\r\n LensFlareSystem.prototype.getEmitter = function () {\r\n return this._emitter;\r\n };\r\n /**\r\n * Set the emitter of the lens flare system.\r\n * It defines the source of the lens flares (it can be a camera, a light or a mesh).\r\n * @param newEmitter Define the new emitter of the system\r\n */\r\n LensFlareSystem.prototype.setEmitter = function (newEmitter) {\r\n this._emitter = newEmitter;\r\n };\r\n /**\r\n * Get the lens flare system emitter position.\r\n * The emitter defines the source of the lens flares (it can be a camera, a light or a mesh).\r\n * @returns the position\r\n */\r\n LensFlareSystem.prototype.getEmitterPosition = function () {\r\n return this._emitter.getAbsolutePosition ? this._emitter.getAbsolutePosition() : this._emitter.position;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n LensFlareSystem.prototype.computeEffectivePosition = function (globalViewport) {\r\n var position = this.getEmitterPosition();\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Project(position, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity(), this._scene.getTransformMatrix(), globalViewport);\r\n this._positionX = position.x;\r\n this._positionY = position.y;\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix());\r\n if (this.viewportBorder > 0) {\r\n globalViewport.x -= this.viewportBorder;\r\n globalViewport.y -= this.viewportBorder;\r\n globalViewport.width += this.viewportBorder * 2;\r\n globalViewport.height += this.viewportBorder * 2;\r\n position.x += this.viewportBorder;\r\n position.y += this.viewportBorder;\r\n this._positionX += this.viewportBorder;\r\n this._positionY += this.viewportBorder;\r\n }\r\n if (position.z > 0) {\r\n if ((this._positionX > globalViewport.x) && (this._positionX < globalViewport.x + globalViewport.width)) {\r\n if ((this._positionY > globalViewport.y) && (this._positionY < globalViewport.y + globalViewport.height)) {\r\n return true;\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n LensFlareSystem.prototype._isVisible = function () {\r\n if (!this._isEnabled || !this._scene.activeCamera) {\r\n return false;\r\n }\r\n var emitterPosition = this.getEmitterPosition();\r\n var direction = emitterPosition.subtract(this._scene.activeCamera.globalPosition);\r\n var distance = direction.length();\r\n direction.normalize();\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](this._scene.activeCamera.globalPosition, direction);\r\n var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);\r\n return !pickInfo || !pickInfo.hit || pickInfo.distance > distance;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n LensFlareSystem.prototype.render = function () {\r\n if (!this._effect.isReady() || !this._scene.activeCamera) {\r\n return false;\r\n }\r\n var engine = this._scene.getEngine();\r\n var viewport = this._scene.activeCamera.viewport;\r\n var globalViewport = viewport.toGlobal(engine.getRenderWidth(true), engine.getRenderHeight(true));\r\n // Position\r\n if (!this.computeEffectivePosition(globalViewport)) {\r\n return false;\r\n }\r\n // Visibility\r\n if (!this._isVisible()) {\r\n return false;\r\n }\r\n // Intensity\r\n var awayX;\r\n var awayY;\r\n if (this._positionX < this.borderLimit + globalViewport.x) {\r\n awayX = this.borderLimit + globalViewport.x - this._positionX;\r\n }\r\n else if (this._positionX > globalViewport.x + globalViewport.width - this.borderLimit) {\r\n awayX = this._positionX - globalViewport.x - globalViewport.width + this.borderLimit;\r\n }\r\n else {\r\n awayX = 0;\r\n }\r\n if (this._positionY < this.borderLimit + globalViewport.y) {\r\n awayY = this.borderLimit + globalViewport.y - this._positionY;\r\n }\r\n else if (this._positionY > globalViewport.y + globalViewport.height - this.borderLimit) {\r\n awayY = this._positionY - globalViewport.y - globalViewport.height + this.borderLimit;\r\n }\r\n else {\r\n awayY = 0;\r\n }\r\n var away = (awayX > awayY) ? awayX : awayY;\r\n away -= this.viewportBorder;\r\n if (away > this.borderLimit) {\r\n away = this.borderLimit;\r\n }\r\n var intensity = 1.0 - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Clamp(away / this.borderLimit, 0, 1);\r\n if (intensity < 0) {\r\n return false;\r\n }\r\n if (intensity > 1.0) {\r\n intensity = 1.0;\r\n }\r\n if (this.viewportBorder > 0) {\r\n globalViewport.x += this.viewportBorder;\r\n globalViewport.y += this.viewportBorder;\r\n globalViewport.width -= this.viewportBorder * 2;\r\n globalViewport.height -= this.viewportBorder * 2;\r\n this._positionX -= this.viewportBorder;\r\n this._positionY -= this.viewportBorder;\r\n }\r\n // Position\r\n var centerX = globalViewport.x + globalViewport.width / 2;\r\n var centerY = globalViewport.y + globalViewport.height / 2;\r\n var distX = centerX - this._positionX;\r\n var distY = centerY - this._positionY;\r\n // Effects\r\n engine.enableEffect(this._effect);\r\n engine.setState(false);\r\n engine.setDepthBuffer(false);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);\r\n // Flares\r\n for (var index = 0; index < this.lensFlares.length; index++) {\r\n var flare = this.lensFlares[index];\r\n if (flare.texture && !flare.texture.isReady()) {\r\n continue;\r\n }\r\n engine.setAlphaMode(flare.alphaMode);\r\n var x = centerX - (distX * flare.position);\r\n var y = centerY - (distY * flare.position);\r\n var cw = flare.size;\r\n var ch = flare.size * engine.getAspectRatio(this._scene.activeCamera, true);\r\n var cx = 2 * (x / (globalViewport.width + globalViewport.x * 2)) - 1.0;\r\n var cy = 1.0 - 2 * (y / (globalViewport.height + globalViewport.y * 2));\r\n var viewportMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromValues(cw / 2, 0, 0, 0, 0, ch / 2, 0, 0, 0, 0, 1, 0, cx, cy, 0, 1);\r\n this._effect.setMatrix(\"viewportMatrix\", viewportMatrix);\r\n // Texture\r\n this._effect.setTexture(\"textureSampler\", flare.texture);\r\n // Color\r\n this._effect.setFloat4(\"color\", flare.color.r * intensity, flare.color.g * intensity, flare.color.b * intensity, 1.0);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_6__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n engine.setDepthBuffer(true);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].ALPHA_DISABLE);\r\n return true;\r\n };\r\n /**\r\n * Dispose and release the lens flare with its associated resources.\r\n */\r\n LensFlareSystem.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n while (this.lensFlares.length) {\r\n this.lensFlares[0].dispose();\r\n }\r\n // Remove from scene\r\n var index = this._scene.lensFlareSystems.indexOf(this);\r\n this._scene.lensFlareSystems.splice(index, 1);\r\n };\r\n /**\r\n * Parse a lens flare system from a JSON repressentation\r\n * @param parsedLensFlareSystem Define the JSON to parse\r\n * @param scene Define the scene the parsed system should be instantiated in\r\n * @param rootUrl Define the rootUrl of the load sequence to easily find a load relative dependencies such as textures\r\n * @returns the parsed system\r\n */\r\n LensFlareSystem.Parse = function (parsedLensFlareSystem, scene, rootUrl) {\r\n var emitter = scene.getLastEntryByID(parsedLensFlareSystem.emitterId);\r\n var name = parsedLensFlareSystem.name || \"lensFlareSystem#\" + parsedLensFlareSystem.emitterId;\r\n var lensFlareSystem = new LensFlareSystem(name, emitter, scene);\r\n lensFlareSystem.id = parsedLensFlareSystem.id || name;\r\n lensFlareSystem.borderLimit = parsedLensFlareSystem.borderLimit;\r\n for (var index = 0; index < parsedLensFlareSystem.flares.length; index++) {\r\n var parsedFlare = parsedLensFlareSystem.flares[index];\r\n _lensFlare__WEBPACK_IMPORTED_MODULE_7__[\"LensFlare\"].AddFlare(parsedFlare.size, parsedFlare.position, _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__[\"Color3\"].FromArray(parsedFlare.color), parsedFlare.textureName ? rootUrl + parsedFlare.textureName : \"\", lensFlareSystem);\r\n }\r\n return lensFlareSystem;\r\n };\r\n /**\r\n * Serialize the current Lens Flare System into a JSON representation.\r\n * @returns the serialized JSON\r\n */\r\n LensFlareSystem.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.id;\r\n serializationObject.name = this.name;\r\n serializationObject.emitterId = this.getEmitter().id;\r\n serializationObject.borderLimit = this.borderLimit;\r\n serializationObject.flares = [];\r\n for (var index = 0; index < this.lensFlares.length; index++) {\r\n var flare = this.lensFlares[index];\r\n serializationObject.flares.push({\r\n size: flare.size,\r\n position: flare.position,\r\n color: flare.color.asArray(),\r\n textureName: _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetFilename(flare.texture ? flare.texture.name : \"\")\r\n });\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n LensFlareSystem._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_11__[\"_DevTools\"].WarnImport(\"LensFlareSystemSceneComponent\");\r\n };\r\n return LensFlareSystem;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./LensFlares/lensFlareSystemSceneComponent.ts\":\n/*!*****************************************************!*\\\n !*** ./LensFlares/lensFlareSystemSceneComponent.ts ***!\n \\*****************************************************/\n/*! exports provided: LensFlareSystemSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return LensFlareSystemSceneComponent; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _lensFlareSystem__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lensFlareSystem */ \"./LensFlares/lensFlareSystem.ts\");\n\r\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_LENSFLARESYSTEM, function (parsedData, scene, container, rootUrl) {\r\n // Lens flares\r\n if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {\r\n if (!container.lensFlareSystems) {\r\n container.lensFlareSystems = new Array();\r\n }\r\n for (var index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {\r\n var parsedLensFlareSystem = parsedData.lensFlareSystems[index];\r\n var lf = _lensFlareSystem__WEBPACK_IMPORTED_MODULE_3__[\"LensFlareSystem\"].Parse(parsedLensFlareSystem, scene, rootUrl);\r\n container.lensFlareSystems.push(lf);\r\n }\r\n }\r\n});\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.getLensFlareSystemByName = function (name) {\r\n for (var index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].name === name) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n return null;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.getLensFlareSystemByID = function (id) {\r\n for (var index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].id === id) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n return null;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.removeLensFlareSystem = function (toRemove) {\r\n var index = this.lensFlareSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.lensFlareSystems.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].prototype.addLensFlareSystem = function (newLensFlareSystem) {\r\n this.lensFlareSystems.push(newLensFlareSystem);\r\n};\r\n/**\r\n * Defines the lens flare scene component responsible to manage any lens flares\r\n * in a given scene.\r\n */\r\nvar LensFlareSystemSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function LensFlareSystemSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_LENSFLARESYSTEM;\r\n this.scene = scene;\r\n scene.lensFlareSystems = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n LensFlareSystemSceneComponent.prototype.register = function () {\r\n this.scene._afterCameraDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_AFTERCAMERADRAW_LENSFLARESYSTEM, this, this._draw);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n LensFlareSystemSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for lens flare\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n LensFlareSystemSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach(function (o) {\r\n _this.scene.addLensFlareSystem(o);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n LensFlareSystemSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach(function (o) {\r\n _this.scene.removeLensFlareSystem(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n LensFlareSystemSceneComponent.prototype.serialize = function (serializationObject) {\r\n // Lens flares\r\n serializationObject.lensFlareSystems = [];\r\n var lensFlareSystems = this.scene.lensFlareSystems;\r\n for (var _i = 0, lensFlareSystems_1 = lensFlareSystems; _i < lensFlareSystems_1.length; _i++) {\r\n var lensFlareSystem = lensFlareSystems_1[_i];\r\n serializationObject.lensFlareSystems.push(lensFlareSystem.serialize());\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n LensFlareSystemSceneComponent.prototype.dispose = function () {\r\n var lensFlareSystems = this.scene.lensFlareSystems;\r\n while (lensFlareSystems.length) {\r\n lensFlareSystems[0].dispose();\r\n }\r\n };\r\n LensFlareSystemSceneComponent.prototype._draw = function (camera) {\r\n // Lens flares\r\n if (this.scene.lensFlaresEnabled) {\r\n var lensFlareSystems = this.scene.lensFlareSystems;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n for (var _i = 0, lensFlareSystems_2 = lensFlareSystems; _i < lensFlareSystems_2.length; _i++) {\r\n var lensFlareSystem = lensFlareSystems_2[_i];\r\n if ((camera.layerMask & lensFlareSystem.layerMask) !== 0) {\r\n lensFlareSystem.render();\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n }\r\n };\r\n return LensFlareSystemSceneComponent;\r\n}());\r\n\r\n_lensFlareSystem__WEBPACK_IMPORTED_MODULE_3__[\"LensFlareSystem\"]._SceneComponentInitialization = function (scene) {\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_LENSFLARESYSTEM);\r\n if (!component) {\r\n component = new LensFlareSystemSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Lights/Shadows/index.ts\":\n/*!*********************************!*\\\n !*** ./Lights/Shadows/index.ts ***!\n \\*********************************/\n/*! exports provided: ShadowGenerator, ShadowGeneratorSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shadowGenerator */ \"./Lights/Shadows/shadowGenerator.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"]; });\n\n/* harmony import */ var _shadowGeneratorSceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shadowGeneratorSceneComponent */ \"./Lights/Shadows/shadowGeneratorSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _shadowGeneratorSceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"ShadowGeneratorSceneComponent\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/Shadows/shadowGenerator.ts\":\n/*!*******************************************!*\\\n !*** ./Lights/Shadows/shadowGenerator.ts ***!\n \\*******************************************/\n/*! exports provided: ShadowGenerator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return ShadowGenerator; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_shadowMap_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Shaders/shadowMap.fragment */ \"./Shaders/shadowMap.fragment.ts\");\n/* harmony import */ var _Shaders_shadowMap_vertex__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Shaders/shadowMap.vertex */ \"./Shaders/shadowMap.vertex.ts\");\n/* harmony import */ var _Shaders_depthBoxBlur_fragment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Shaders/depthBoxBlur.fragment */ \"./Shaders/depthBoxBlur.fragment.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Default implementation IShadowGenerator.\r\n * This is the main object responsible of generating shadows in the framework.\r\n * Documentation: https://doc.babylonjs.com/babylon101/shadows\r\n */\r\nvar ShadowGenerator = /** @class */ (function () {\r\n /**\r\n * Creates a ShadowGenerator object.\r\n * A ShadowGenerator is the required tool to use the shadows.\r\n * Each light casting shadows needs to use its own ShadowGenerator.\r\n * Documentation : https://doc.babylonjs.com/babylon101/shadows\r\n * @param mapSize The size of the texture what stores the shadows. Example : 1024.\r\n * @param light The light object generating the shadows.\r\n * @param usefulFloatFirst By default the generator will try to use half float textures but if you need precision (for self shadowing for instance), you can use this option to enforce full float texture.\r\n */\r\n function ShadowGenerator(mapSize, light, usefulFloatFirst) {\r\n /**\r\n * Observable triggered before the shadow is rendered. Can be used to update internal effect state\r\n */\r\n this.onBeforeShadowMapRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n /**\r\n * Observable triggered after the shadow is rendered. Can be used to restore internal effect state\r\n */\r\n this.onAfterShadowMapRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n /**\r\n * Observable triggered before a mesh is rendered in the shadow map.\r\n * Can be used to update internal effect state (that you can get from the onBeforeShadowMapRenderObservable)\r\n */\r\n this.onBeforeShadowMapRenderMeshObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n /**\r\n * Observable triggered after a mesh is rendered in the shadow map.\r\n * Can be used to update internal effect state (that you can get from the onAfterShadowMapRenderObservable)\r\n */\r\n this.onAfterShadowMapRenderMeshObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_16__[\"Observable\"]();\r\n this._bias = 0.00005;\r\n this._normalBias = 0;\r\n this._blurBoxOffset = 1;\r\n this._blurScale = 2;\r\n this._blurKernel = 1;\r\n this._useKernelBlur = false;\r\n this._filter = ShadowGenerator.FILTER_NONE;\r\n this._filteringQuality = ShadowGenerator.QUALITY_HIGH;\r\n this._contactHardeningLightSizeUVRatio = 0.1;\r\n this._darkness = 0;\r\n this._transparencyShadow = false;\r\n /**\r\n * Controls the extent to which the shadows fade out at the edge of the frustum\r\n * Used only by directionals and spots\r\n */\r\n this.frustumEdgeFalloff = 0;\r\n /**\r\n * If true the shadow map is generated by rendering the back face of the mesh instead of the front face.\r\n * This can help with self-shadowing as the geometry making up the back of objects is slightly offset.\r\n * It might on the other hand introduce peter panning.\r\n */\r\n this.forceBackFacesOnly = false;\r\n this._lightDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._viewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n this._projectionMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n this._cachedPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cachedDirection = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._currentFaceIndex = 0;\r\n this._currentFaceIndexCache = 0;\r\n this._defaultTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n this._mapSize = mapSize;\r\n this._light = light;\r\n this._scene = light.getScene();\r\n light._shadowGenerator = this;\r\n ShadowGenerator._SceneComponentInitialization(this._scene);\r\n // Texture type fallback from float to int if not supported.\r\n var caps = this._scene.getEngine().getCaps();\r\n if (!usefulFloatFirst) {\r\n if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n else {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n }\r\n else {\r\n if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else {\r\n this._textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n }\r\n this._initializeGenerator();\r\n this._applyFilterValues();\r\n }\r\n Object.defineProperty(ShadowGenerator.prototype, \"bias\", {\r\n /**\r\n * Gets the bias: offset applied on the depth preventing acnea (in light direction).\r\n */\r\n get: function () {\r\n return this._bias;\r\n },\r\n /**\r\n * Sets the bias: offset applied on the depth preventing acnea (in light direction).\r\n */\r\n set: function (bias) {\r\n this._bias = bias;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"normalBias\", {\r\n /**\r\n * Gets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle).\r\n */\r\n get: function () {\r\n return this._normalBias;\r\n },\r\n /**\r\n * Sets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle).\r\n */\r\n set: function (normalBias) {\r\n this._normalBias = normalBias;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"blurBoxOffset\", {\r\n /**\r\n * Gets the blur box offset: offset applied during the blur pass.\r\n * Only useful if useKernelBlur = false\r\n */\r\n get: function () {\r\n return this._blurBoxOffset;\r\n },\r\n /**\r\n * Sets the blur box offset: offset applied during the blur pass.\r\n * Only useful if useKernelBlur = false\r\n */\r\n set: function (value) {\r\n if (this._blurBoxOffset === value) {\r\n return;\r\n }\r\n this._blurBoxOffset = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"blurScale\", {\r\n /**\r\n * Gets the blur scale: scale of the blurred texture compared to the main shadow map.\r\n * 2 means half of the size.\r\n */\r\n get: function () {\r\n return this._blurScale;\r\n },\r\n /**\r\n * Sets the blur scale: scale of the blurred texture compared to the main shadow map.\r\n * 2 means half of the size.\r\n */\r\n set: function (value) {\r\n if (this._blurScale === value) {\r\n return;\r\n }\r\n this._blurScale = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"blurKernel\", {\r\n /**\r\n * Gets the blur kernel: kernel size of the blur pass.\r\n * Only useful if useKernelBlur = true\r\n */\r\n get: function () {\r\n return this._blurKernel;\r\n },\r\n /**\r\n * Sets the blur kernel: kernel size of the blur pass.\r\n * Only useful if useKernelBlur = true\r\n */\r\n set: function (value) {\r\n if (this._blurKernel === value) {\r\n return;\r\n }\r\n this._blurKernel = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useKernelBlur\", {\r\n /**\r\n * Gets whether the blur pass is a kernel blur (if true) or box blur.\r\n * Only useful in filtered mode (useBlurExponentialShadowMap...)\r\n */\r\n get: function () {\r\n return this._useKernelBlur;\r\n },\r\n /**\r\n * Sets whether the blur pass is a kernel blur (if true) or box blur.\r\n * Only useful in filtered mode (useBlurExponentialShadowMap...)\r\n */\r\n set: function (value) {\r\n if (this._useKernelBlur === value) {\r\n return;\r\n }\r\n this._useKernelBlur = value;\r\n this._disposeBlurPostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"depthScale\", {\r\n /**\r\n * Gets the depth scale used in ESM mode.\r\n */\r\n get: function () {\r\n return this._depthScale !== undefined ? this._depthScale : this._light.getDepthScale();\r\n },\r\n /**\r\n * Sets the depth scale used in ESM mode.\r\n * This can override the scale stored on the light.\r\n */\r\n set: function (value) {\r\n this._depthScale = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"filter\", {\r\n /**\r\n * Gets the current mode of the shadow generator (normal, PCF, ESM...).\r\n * The returned value is a number equal to one of the available mode defined in ShadowMap.FILTER_x like _FILTER_NONE\r\n */\r\n get: function () {\r\n return this._filter;\r\n },\r\n /**\r\n * Sets the current mode of the shadow generator (normal, PCF, ESM...).\r\n * The returned value is a number equal to one of the available mode defined in ShadowMap.FILTER_x like _FILTER_NONE\r\n */\r\n set: function (value) {\r\n // Blurring the cubemap is going to be too expensive. Reverting to unblurred version\r\n if (this._light.needCube()) {\r\n if (value === ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP) {\r\n this.useExponentialShadowMap = true;\r\n return;\r\n }\r\n else if (value === ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) {\r\n this.useCloseExponentialShadowMap = true;\r\n return;\r\n }\r\n // PCF on cubemap would also be expensive\r\n else if (value === ShadowGenerator.FILTER_PCF || value === ShadowGenerator.FILTER_PCSS) {\r\n this.usePoissonSampling = true;\r\n return;\r\n }\r\n }\r\n // Weblg1 fallback for PCF.\r\n if (value === ShadowGenerator.FILTER_PCF || value === ShadowGenerator.FILTER_PCSS) {\r\n if (this._scene.getEngine().webGLVersion === 1) {\r\n this.usePoissonSampling = true;\r\n return;\r\n }\r\n }\r\n if (this._filter === value) {\r\n return;\r\n }\r\n this._filter = value;\r\n this._disposeBlurPostProcesses();\r\n this._applyFilterValues();\r\n this._light._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"usePoissonSampling\", {\r\n /**\r\n * Gets if the current filter is set to Poisson Sampling.\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_POISSONSAMPLING;\r\n },\r\n /**\r\n * Sets the current filter to Poisson Sampling.\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_POISSONSAMPLING) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to ESM.\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Sets the current filter is to ESM.\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useBlurExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to filtered ESM.\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Gets if the current filter is set to filtered ESM.\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useCloseExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Sets the current filter to \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useBlurCloseExponentialShadowMap\", {\r\n /**\r\n * Gets if the current filter is set to filtered \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP;\r\n },\r\n /**\r\n * Sets the current filter to filtered \"close ESM\" (using the inverse of the\r\n * exponential to prevent steep falloff artifacts).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"usePercentageCloserFiltering\", {\r\n /**\r\n * Gets if the current filter is set to \"PCF\" (percentage closer filtering).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_PCF;\r\n },\r\n /**\r\n * Sets the current filter to \"PCF\" (percentage closer filtering).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_PCF) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_PCF : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"filteringQuality\", {\r\n /**\r\n * Gets the PCF or PCSS Quality.\r\n * Only valid if usePercentageCloserFiltering or usePercentageCloserFiltering is true.\r\n */\r\n get: function () {\r\n return this._filteringQuality;\r\n },\r\n /**\r\n * Sets the PCF or PCSS Quality.\r\n * Only valid if usePercentageCloserFiltering or usePercentageCloserFiltering is true.\r\n */\r\n set: function (filteringQuality) {\r\n if (this._filteringQuality === filteringQuality) {\r\n return;\r\n }\r\n this._filteringQuality = filteringQuality;\r\n this._disposeBlurPostProcesses();\r\n this._applyFilterValues();\r\n this._light._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"useContactHardeningShadow\", {\r\n /**\r\n * Gets if the current filter is set to \"PCSS\" (contact hardening).\r\n */\r\n get: function () {\r\n return this.filter === ShadowGenerator.FILTER_PCSS;\r\n },\r\n /**\r\n * Sets the current filter to \"PCSS\" (contact hardening).\r\n */\r\n set: function (value) {\r\n if (!value && this.filter !== ShadowGenerator.FILTER_PCSS) {\r\n return;\r\n }\r\n this.filter = (value ? ShadowGenerator.FILTER_PCSS : ShadowGenerator.FILTER_NONE);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"contactHardeningLightSizeUVRatio\", {\r\n /**\r\n * Gets the Light Size (in shadow map uv unit) used in PCSS to determine the blocker search area and the penumbra size.\r\n * Using a ratio helps keeping shape stability independently of the map size.\r\n *\r\n * It does not account for the light projection as it was having too much\r\n * instability during the light setup or during light position changes.\r\n *\r\n * Only valid if useContactHardeningShadow is true.\r\n */\r\n get: function () {\r\n return this._contactHardeningLightSizeUVRatio;\r\n },\r\n /**\r\n * Sets the Light Size (in shadow map uv unit) used in PCSS to determine the blocker search area and the penumbra size.\r\n * Using a ratio helps keeping shape stability independently of the map size.\r\n *\r\n * It does not account for the light projection as it was having too much\r\n * instability during the light setup or during light position changes.\r\n *\r\n * Only valid if useContactHardeningShadow is true.\r\n */\r\n set: function (contactHardeningLightSizeUVRatio) {\r\n this._contactHardeningLightSizeUVRatio = contactHardeningLightSizeUVRatio;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowGenerator.prototype, \"darkness\", {\r\n /** Gets or sets the actual darkness of a shadow */\r\n get: function () {\r\n return this._darkness;\r\n },\r\n set: function (value) {\r\n this.setDarkness(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the darkness value (float). This can only decrease the actual darkness of a shadow.\r\n * 0 means strongest and 1 would means no shadow.\r\n * @returns the darkness.\r\n */\r\n ShadowGenerator.prototype.getDarkness = function () {\r\n return this._darkness;\r\n };\r\n /**\r\n * Sets the darkness value (float). This can only decrease the actual darkness of a shadow.\r\n * @param darkness The darkness value 0 means strongest and 1 would means no shadow.\r\n * @returns the shadow generator allowing fluent coding.\r\n */\r\n ShadowGenerator.prototype.setDarkness = function (darkness) {\r\n if (darkness >= 1.0) {\r\n this._darkness = 1.0;\r\n }\r\n else if (darkness <= 0.0) {\r\n this._darkness = 0.0;\r\n }\r\n else {\r\n this._darkness = darkness;\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(ShadowGenerator.prototype, \"transparencyShadow\", {\r\n /** Gets or sets the ability to have transparent shadow */\r\n get: function () {\r\n return this._transparencyShadow;\r\n },\r\n set: function (value) {\r\n this.setTransparencyShadow(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the ability to have transparent shadow (boolean).\r\n * @param transparent True if transparent else False\r\n * @returns the shadow generator allowing fluent coding\r\n */\r\n ShadowGenerator.prototype.setTransparencyShadow = function (transparent) {\r\n this._transparencyShadow = transparent;\r\n return this;\r\n };\r\n /**\r\n * Gets the main RTT containing the shadow map (usually storing depth from the light point of view).\r\n * @returns The render target texture if present otherwise, null\r\n */\r\n ShadowGenerator.prototype.getShadowMap = function () {\r\n return this._shadowMap;\r\n };\r\n /**\r\n * Gets the RTT used during rendering (can be a blurred version of the shadow map or the shadow map itself).\r\n * @returns The render target texture if the shadow map is present otherwise, null\r\n */\r\n ShadowGenerator.prototype.getShadowMapForRendering = function () {\r\n if (this._shadowMap2) {\r\n return this._shadowMap2;\r\n }\r\n return this._shadowMap;\r\n };\r\n /**\r\n * Gets the class name of that object\r\n * @returns \"ShadowGenerator\"\r\n */\r\n ShadowGenerator.prototype.getClassName = function () {\r\n return \"ShadowGenerator\";\r\n };\r\n /**\r\n * Helper function to add a mesh and its descendants to the list of shadow casters.\r\n * @param mesh Mesh to add\r\n * @param includeDescendants boolean indicating if the descendants should be added. Default to true\r\n * @returns the Shadow Generator itself\r\n */\r\n ShadowGenerator.prototype.addShadowCaster = function (mesh, includeDescendants) {\r\n var _a;\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (!this._shadowMap) {\r\n return this;\r\n }\r\n if (!this._shadowMap.renderList) {\r\n this._shadowMap.renderList = [];\r\n }\r\n this._shadowMap.renderList.push(mesh);\r\n if (includeDescendants) {\r\n (_a = this._shadowMap.renderList).push.apply(_a, mesh.getChildMeshes());\r\n }\r\n return this;\r\n };\r\n /**\r\n * Helper function to remove a mesh and its descendants from the list of shadow casters\r\n * @param mesh Mesh to remove\r\n * @param includeDescendants boolean indicating if the descendants should be removed. Default to true\r\n * @returns the Shadow Generator itself\r\n */\r\n ShadowGenerator.prototype.removeShadowCaster = function (mesh, includeDescendants) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (!this._shadowMap || !this._shadowMap.renderList) {\r\n return this;\r\n }\r\n var index = this._shadowMap.renderList.indexOf(mesh);\r\n if (index !== -1) {\r\n this._shadowMap.renderList.splice(index, 1);\r\n }\r\n if (includeDescendants) {\r\n for (var _i = 0, _a = mesh.getChildren(); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n this.removeShadowCaster(child);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the associated light object.\r\n * @returns the light generating the shadow\r\n */\r\n ShadowGenerator.prototype.getLight = function () {\r\n return this._light;\r\n };\r\n ShadowGenerator.prototype._initializeGenerator = function () {\r\n this._light._markMeshesAsLightDirty();\r\n this._initializeShadowMap();\r\n };\r\n ShadowGenerator.prototype._initializeShadowMap = function () {\r\n var _this = this;\r\n // Render target\r\n var engine = this._scene.getEngine();\r\n if (engine.webGLVersion > 1) {\r\n this._shadowMap = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](this._light.name + \"_shadowMap\", this._mapSize, this._scene, false, true, this._textureType, this._light.needCube(), undefined, false, false);\r\n this._shadowMap.createDepthStencilTexture(_Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].LESS, true);\r\n }\r\n else {\r\n this._shadowMap = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](this._light.name + \"_shadowMap\", this._mapSize, this._scene, false, true, this._textureType, this._light.needCube());\r\n }\r\n this._shadowMap.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap.anisotropicFilteringLevel = 1;\r\n this._shadowMap.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._shadowMap.renderParticles = false;\r\n this._shadowMap.ignoreCameraViewport = true;\r\n // Record Face Index before render.\r\n this._shadowMap.onBeforeRenderObservable.add(function (faceIndex) {\r\n _this._currentFaceIndex = faceIndex;\r\n if (_this._filter === ShadowGenerator.FILTER_PCF) {\r\n engine.setColorWrite(false);\r\n }\r\n });\r\n // Custom render function.\r\n this._shadowMap.customRenderFunction = this._renderForShadowMap.bind(this);\r\n // Blur if required afer render.\r\n this._shadowMap.onAfterUnbindObservable.add(function () {\r\n if (_this._filter === ShadowGenerator.FILTER_PCF) {\r\n engine.setColorWrite(true);\r\n }\r\n if (!_this.useBlurExponentialShadowMap && !_this.useBlurCloseExponentialShadowMap) {\r\n return;\r\n }\r\n var shadowMap = _this.getShadowMapForRendering();\r\n if (shadowMap) {\r\n _this._scene.postProcessManager.directRender(_this._blurPostProcesses, shadowMap.getInternalTexture(), true);\r\n }\r\n });\r\n // Clear according to the chosen filter.\r\n var clearZero = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n var clearOne = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n this._shadowMap.onClearObservable.add(function (engine) {\r\n if (_this._filter === ShadowGenerator.FILTER_PCF) {\r\n engine.clear(clearOne, false, true, false);\r\n }\r\n else if (_this.useExponentialShadowMap || _this.useBlurExponentialShadowMap) {\r\n engine.clear(clearZero, true, true, false);\r\n }\r\n else {\r\n engine.clear(clearOne, true, true, false);\r\n }\r\n });\r\n this._shadowMap.onResizeObservable.add(function (RTT) {\r\n _this._mapSize = RTT.getRenderSize();\r\n _this._light._markMeshesAsLightDirty();\r\n _this.recreateShadowMap();\r\n });\r\n };\r\n ShadowGenerator.prototype._initializeBlurRTTAndPostProcesses = function () {\r\n var _this = this;\r\n var engine = this._scene.getEngine();\r\n var targetSize = this._mapSize / this.blurScale;\r\n if (!this.useKernelBlur || this.blurScale !== 1.0) {\r\n this._shadowMap2 = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_9__[\"RenderTargetTexture\"](this._light.name + \"_shadowMap2\", targetSize, this._scene, false, true, this._textureType);\r\n this._shadowMap2.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap2.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._shadowMap2.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n }\r\n if (this.useKernelBlur) {\r\n this._kernelBlurXPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](this._light.name + \"KernelBlurX\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1, 0), this.blurKernel, 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._textureType);\r\n this._kernelBlurXPostprocess.width = targetSize;\r\n this._kernelBlurXPostprocess.height = targetSize;\r\n this._kernelBlurXPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setTexture(\"textureSampler\", _this._shadowMap);\r\n });\r\n this._kernelBlurYPostprocess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_11__[\"BlurPostProcess\"](this._light.name + \"KernelBlurY\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1), this.blurKernel, 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._textureType);\r\n this._kernelBlurXPostprocess.autoClear = false;\r\n this._kernelBlurYPostprocess.autoClear = false;\r\n if (this._textureType === _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n this._kernelBlurXPostprocess.packedFloat = true;\r\n this._kernelBlurYPostprocess.packedFloat = true;\r\n }\r\n this._blurPostProcesses = [this._kernelBlurXPostprocess, this._kernelBlurYPostprocess];\r\n }\r\n else {\r\n this._boxBlurPostprocess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_10__[\"PostProcess\"](this._light.name + \"DepthBoxBlur\", \"depthBoxBlur\", [\"screenSize\", \"boxOffset\"], [], 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, \"#define OFFSET \" + this._blurBoxOffset, this._textureType);\r\n this._boxBlurPostprocess.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"screenSize\", targetSize, targetSize);\r\n effect.setTexture(\"textureSampler\", _this._shadowMap);\r\n });\r\n this._boxBlurPostprocess.autoClear = false;\r\n this._blurPostProcesses = [this._boxBlurPostprocess];\r\n }\r\n };\r\n ShadowGenerator.prototype._renderForShadowMap = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var index;\r\n var engine = this._scene.getEngine();\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(alphaTestSubMeshes.data[index]);\r\n }\r\n if (this._transparencyShadow) {\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n this._renderSubMeshForShadowMap(transparentSubMeshes.data[index]);\r\n }\r\n }\r\n };\r\n ShadowGenerator.prototype._renderSubMeshForShadowMap = function (subMesh) {\r\n var _this = this;\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = this._scene;\r\n var engine = scene.getEngine();\r\n var material = subMesh.getMaterial();\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n if (!material || subMesh.verticesCount === 0) {\r\n return;\r\n }\r\n // Culling\r\n engine.setState(material.backFaceCulling);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null) && (batch.visibleInstances[subMesh._id] !== undefined);\r\n if (this.isReady(subMesh, hardwareInstancedRendering)) {\r\n engine.enableEffect(this._effect);\r\n mesh._bind(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode);\r\n this._effect.setFloat3(\"biasAndScale\", this.bias, this.normalBias, this.depthScale);\r\n this._effect.setMatrix(\"viewProjection\", this.getTransformMatrix());\r\n if (this.getLight().getTypeID() === _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n this._effect.setVector3(\"lightData\", this._cachedDirection);\r\n }\r\n else {\r\n this._effect.setVector3(\"lightData\", this._cachedPosition);\r\n }\r\n if (scene.activeCamera) {\r\n this._effect.setFloat2(\"depthValues\", this.getLight().getDepthMinZ(scene.activeCamera), this.getLight().getDepthMinZ(scene.activeCamera) + this.getLight().getDepthMaxZ(scene.activeCamera));\r\n }\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix() || this._defaultTextureMatrix);\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n if (!boneTexture) {\r\n return;\r\n }\r\n this._effect.setTexture(\"boneSampler\", boneTexture);\r\n this._effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n this._effect.setMatrices(\"mBones\", skeleton.getTransformMatrices((mesh)));\r\n }\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._effect);\r\n if (this.forceBackFacesOnly) {\r\n engine.setState(true, 0, false, true);\r\n }\r\n // Observables\r\n this.onBeforeShadowMapRenderMeshObservable.notifyObservers(mesh);\r\n this.onBeforeShadowMapRenderObservable.notifyObservers(this._effect);\r\n // Draw\r\n mesh._processRendering(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix(\"world\", world); });\r\n if (this.forceBackFacesOnly) {\r\n engine.setState(true, 0, false, false);\r\n }\r\n // Observables\r\n this.onAfterShadowMapRenderObservable.notifyObservers(this._effect);\r\n this.onAfterShadowMapRenderMeshObservable.notifyObservers(mesh);\r\n }\r\n else {\r\n // Need to reset refresh rate of the shadowMap\r\n if (this._shadowMap) {\r\n this._shadowMap.resetRefreshCounter();\r\n }\r\n }\r\n };\r\n ShadowGenerator.prototype._applyFilterValues = function () {\r\n if (!this._shadowMap) {\r\n return;\r\n }\r\n if (this.filter === ShadowGenerator.FILTER_NONE || this.filter === ShadowGenerator.FILTER_PCSS) {\r\n this._shadowMap.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n }\r\n else {\r\n this._shadowMap.updateSamplingMode(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_8__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n }\r\n };\r\n /**\r\n * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.\r\n * @param onCompiled Callback triggered at the and of the effects compilation\r\n * @param options Sets of optional options forcing the compilation with different modes\r\n */\r\n ShadowGenerator.prototype.forceCompilation = function (onCompiled, options) {\r\n var _this = this;\r\n var localOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ useInstances: false }, options);\r\n var shadowMap = this.getShadowMap();\r\n if (!shadowMap) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n return;\r\n }\r\n var renderList = shadowMap.renderList;\r\n if (!renderList) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n return;\r\n }\r\n var subMeshes = new Array();\r\n for (var _i = 0, renderList_1 = renderList; _i < renderList_1.length; _i++) {\r\n var mesh = renderList_1[_i];\r\n subMeshes.push.apply(subMeshes, mesh.subMeshes);\r\n }\r\n if (subMeshes.length === 0) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n return;\r\n }\r\n var currentIndex = 0;\r\n var checkReady = function () {\r\n if (!_this._scene || !_this._scene.getEngine()) {\r\n return;\r\n }\r\n while (_this.isReady(subMeshes[currentIndex], localOptions.useInstances)) {\r\n currentIndex++;\r\n if (currentIndex >= subMeshes.length) {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n return;\r\n }\r\n }\r\n setTimeout(checkReady, 16);\r\n };\r\n checkReady();\r\n };\r\n /**\r\n * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.\r\n * @param options Sets of optional options forcing the compilation with different modes\r\n * @returns A promise that resolves when the compilation completes\r\n */\r\n ShadowGenerator.prototype.forceCompilationAsync = function (options) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.forceCompilation(function () {\r\n resolve();\r\n }, options);\r\n });\r\n };\r\n /**\r\n * Determine wheter the shadow generator is ready or not (mainly all effects and related post processes needs to be ready).\r\n * @param subMesh The submesh we want to render in the shadow map\r\n * @param useInstances Defines wether will draw in the map using instances\r\n * @returns true if ready otherwise, false\r\n */\r\n ShadowGenerator.prototype.isReady = function (subMesh, useInstances) {\r\n var defines = [];\r\n if (this._textureType !== _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n defines.push(\"#define FLOAT\");\r\n }\r\n if (this.useExponentialShadowMap || this.useBlurExponentialShadowMap) {\r\n defines.push(\"#define ESM\");\r\n }\r\n else if (this.usePercentageCloserFiltering || this.useContactHardeningShadow) {\r\n defines.push(\"#define DEPTHTEXTURE\");\r\n }\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind];\r\n var mesh = subMesh.getMesh();\r\n var material = subMesh.getMaterial();\r\n // Normal bias.\r\n if (this.normalBias && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind);\r\n defines.push(\"#define NORMAL\");\r\n if (mesh.nonUniformScaling) {\r\n defines.push(\"#define NONUNIFORMSCALING\");\r\n }\r\n if (this.getLight().getTypeID() === _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n defines.push(\"#define DIRECTIONINLIGHTDATA\");\r\n }\r\n }\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind)) {\r\n if (alphaTexture.coordinatesIndex === 1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n }\r\n }\r\n // Bones\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_7__[\"EffectFallbacks\"]();\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n var skeleton = mesh.skeleton;\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n if (mesh.numBoneInfluencers > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n if (skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton.bones.length + 1));\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var manager = mesh.morphTargetManager;\r\n var morphInfluencers = 0;\r\n if (manager) {\r\n if (manager.numInfluencers > 0) {\r\n defines.push(\"#define MORPHTARGETS\");\r\n morphInfluencers = manager.numInfluencers;\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + morphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, morphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n if (this.customShaderOptions) {\r\n if (this.customShaderOptions.defines) {\r\n for (var _i = 0, _a = this.customShaderOptions.defines; _i < _a.length; _i++) {\r\n var define = _a[_i];\r\n if (defines.indexOf(define) === -1) {\r\n defines.push(define);\r\n }\r\n }\r\n }\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n var shaderName = \"shadowMap\";\r\n var uniforms = [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"lightData\", \"depthValues\", \"biasAndScale\", \"morphTargetInfluences\", \"boneTextureWidth\"];\r\n var samplers = [\"diffuseSampler\", \"boneSampler\"];\r\n // Custom shader?\r\n if (this.customShaderOptions) {\r\n shaderName = this.customShaderOptions.shaderName;\r\n if (this.customShaderOptions.attributes) {\r\n for (var _b = 0, _c = this.customShaderOptions.attributes; _b < _c.length; _b++) {\r\n var attrib = _c[_b];\r\n if (attribs.indexOf(attrib) === -1) {\r\n attribs.push(attrib);\r\n }\r\n }\r\n }\r\n if (this.customShaderOptions.uniforms) {\r\n for (var _d = 0, _e = this.customShaderOptions.uniforms; _d < _e.length; _d++) {\r\n var uniform = _e[_d];\r\n if (uniforms.indexOf(uniform) === -1) {\r\n uniforms.push(uniform);\r\n }\r\n }\r\n }\r\n if (this.customShaderOptions.samplers) {\r\n for (var _f = 0, _g = this.customShaderOptions.samplers; _f < _g.length; _f++) {\r\n var sampler = _g[_f];\r\n if (samplers.indexOf(sampler) === -1) {\r\n samplers.push(sampler);\r\n }\r\n }\r\n }\r\n }\r\n this._effect = this._scene.getEngine().createEffect(shaderName, attribs, uniforms, samplers, join, fallbacks, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers });\r\n }\r\n if (!this._effect.isReady()) {\r\n return false;\r\n }\r\n if (this.useBlurExponentialShadowMap || this.useBlurCloseExponentialShadowMap) {\r\n if (!this._blurPostProcesses || !this._blurPostProcesses.length) {\r\n this._initializeBlurRTTAndPostProcesses();\r\n }\r\n }\r\n if (this._kernelBlurXPostprocess && !this._kernelBlurXPostprocess.isReady()) {\r\n return false;\r\n }\r\n if (this._kernelBlurYPostprocess && !this._kernelBlurYPostprocess.isReady()) {\r\n return false;\r\n }\r\n if (this._boxBlurPostprocess && !this._boxBlurPostprocess.isReady()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Prepare all the defines in a material relying on a shadow map at the specified light index.\r\n * @param defines Defines of the material we want to update\r\n * @param lightIndex Index of the light in the enabled light list of the material\r\n */\r\n ShadowGenerator.prototype.prepareDefines = function (defines, lightIndex) {\r\n var scene = this._scene;\r\n var light = this._light;\r\n if (!scene.shadowsEnabled || !light.shadowEnabled) {\r\n return;\r\n }\r\n defines[\"SHADOW\" + lightIndex] = true;\r\n if (this.useContactHardeningShadow) {\r\n defines[\"SHADOWPCSS\" + lightIndex] = true;\r\n if (this._filteringQuality === ShadowGenerator.QUALITY_LOW) {\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = true;\r\n }\r\n else if (this._filteringQuality === ShadowGenerator.QUALITY_MEDIUM) {\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = true;\r\n }\r\n // else default to high.\r\n }\r\n if (this.usePercentageCloserFiltering) {\r\n defines[\"SHADOWPCF\" + lightIndex] = true;\r\n if (this._filteringQuality === ShadowGenerator.QUALITY_LOW) {\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = true;\r\n }\r\n else if (this._filteringQuality === ShadowGenerator.QUALITY_MEDIUM) {\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = true;\r\n }\r\n // else default to high.\r\n }\r\n else if (this.usePoissonSampling) {\r\n defines[\"SHADOWPOISSON\" + lightIndex] = true;\r\n }\r\n else if (this.useExponentialShadowMap || this.useBlurExponentialShadowMap) {\r\n defines[\"SHADOWESM\" + lightIndex] = true;\r\n }\r\n else if (this.useCloseExponentialShadowMap || this.useBlurCloseExponentialShadowMap) {\r\n defines[\"SHADOWCLOSEESM\" + lightIndex] = true;\r\n }\r\n if (light.needCube()) {\r\n defines[\"SHADOWCUBE\" + lightIndex] = true;\r\n }\r\n };\r\n /**\r\n * Binds the shadow related information inside of an effect (information like near, far, darkness...\r\n * defined in the generator but impacting the effect).\r\n * @param lightIndex Index of the light in the enabled light list of the material owning the effect\r\n * @param effect The effect we are binfing the information for\r\n */\r\n ShadowGenerator.prototype.bindShadowLight = function (lightIndex, effect) {\r\n var light = this._light;\r\n var scene = this._scene;\r\n if (!scene.shadowsEnabled || !light.shadowEnabled) {\r\n return;\r\n }\r\n var camera = scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n var shadowMap = this.getShadowMap();\r\n if (!shadowMap) {\r\n return;\r\n }\r\n if (!light.needCube()) {\r\n effect.setMatrix(\"lightMatrix\" + lightIndex, this.getTransformMatrix());\r\n }\r\n // Only PCF uses depth stencil texture.\r\n if (this._filter === ShadowGenerator.FILTER_PCF) {\r\n effect.setDepthStencilTexture(\"shadowSampler\" + lightIndex, this.getShadowMapForRendering());\r\n light._uniformBuffer.updateFloat4(\"shadowsInfo\", this.getDarkness(), shadowMap.getSize().width, 1 / shadowMap.getSize().width, this.frustumEdgeFalloff, lightIndex);\r\n }\r\n else if (this._filter === ShadowGenerator.FILTER_PCSS) {\r\n effect.setDepthStencilTexture(\"shadowSampler\" + lightIndex, this.getShadowMapForRendering());\r\n effect.setTexture(\"depthSampler\" + lightIndex, this.getShadowMapForRendering());\r\n light._uniformBuffer.updateFloat4(\"shadowsInfo\", this.getDarkness(), 1 / shadowMap.getSize().width, this._contactHardeningLightSizeUVRatio * shadowMap.getSize().width, this.frustumEdgeFalloff, lightIndex);\r\n }\r\n else {\r\n effect.setTexture(\"shadowSampler\" + lightIndex, this.getShadowMapForRendering());\r\n light._uniformBuffer.updateFloat4(\"shadowsInfo\", this.getDarkness(), this.blurScale / shadowMap.getSize().width, this.depthScale, this.frustumEdgeFalloff, lightIndex);\r\n }\r\n light._uniformBuffer.updateFloat2(\"depthValues\", this.getLight().getDepthMinZ(camera), this.getLight().getDepthMinZ(camera) + this.getLight().getDepthMaxZ(camera), lightIndex);\r\n };\r\n /**\r\n * Gets the transformation matrix used to project the meshes into the map from the light point of view.\r\n * (eq to shadow prjection matrix * light transform matrix)\r\n * @returns The transform matrix used to create the shadow map\r\n */\r\n ShadowGenerator.prototype.getTransformMatrix = function () {\r\n var scene = this._scene;\r\n if (this._currentRenderID === scene.getRenderId() && this._currentFaceIndexCache === this._currentFaceIndex) {\r\n return this._transformMatrix;\r\n }\r\n this._currentRenderID = scene.getRenderId();\r\n this._currentFaceIndexCache = this._currentFaceIndex;\r\n var lightPosition = this._light.position;\r\n if (this._light.computeTransformedInformation()) {\r\n lightPosition = this._light.transformedPosition;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex), this._lightDirection);\r\n if (Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Dot(this._lightDirection, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Up())) === 1.0) {\r\n this._lightDirection.z = 0.0000000000001; // Required to avoid perfectly perpendicular light\r\n }\r\n if (this._light.needProjectionMatrixCompute() || !this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !this._lightDirection.equals(this._cachedDirection)) {\r\n this._cachedPosition.copyFrom(lightPosition);\r\n this._cachedDirection.copyFrom(this._lightDirection);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].LookAtLHToRef(lightPosition, lightPosition.add(this._lightDirection), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Up(), this._viewMatrix);\r\n var shadowMap = this.getShadowMap();\r\n if (shadowMap) {\r\n var renderList = shadowMap.renderList;\r\n if (renderList) {\r\n this._light.setShadowProjectionMatrix(this._projectionMatrix, this._viewMatrix, renderList);\r\n }\r\n }\r\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n }\r\n return this._transformMatrix;\r\n };\r\n /**\r\n * Recreates the shadow map dependencies like RTT and post processes. This can be used during the switch between\r\n * Cube and 2D textures for instance.\r\n */\r\n ShadowGenerator.prototype.recreateShadowMap = function () {\r\n var shadowMap = this._shadowMap;\r\n if (!shadowMap) {\r\n return;\r\n }\r\n // Track render list.\r\n var renderList = shadowMap.renderList;\r\n // Clean up existing data.\r\n this._disposeRTTandPostProcesses();\r\n // Reinitializes.\r\n this._initializeGenerator();\r\n // Reaffect the filter to ensure a correct fallback if necessary.\r\n this.filter = this.filter;\r\n // Reaffect the filter.\r\n this._applyFilterValues();\r\n // Reaffect Render List.\r\n this._shadowMap.renderList = renderList;\r\n };\r\n ShadowGenerator.prototype._disposeBlurPostProcesses = function () {\r\n if (this._shadowMap2) {\r\n this._shadowMap2.dispose();\r\n this._shadowMap2 = null;\r\n }\r\n if (this._boxBlurPostprocess) {\r\n this._boxBlurPostprocess.dispose();\r\n this._boxBlurPostprocess = null;\r\n }\r\n if (this._kernelBlurXPostprocess) {\r\n this._kernelBlurXPostprocess.dispose();\r\n this._kernelBlurXPostprocess = null;\r\n }\r\n if (this._kernelBlurYPostprocess) {\r\n this._kernelBlurYPostprocess.dispose();\r\n this._kernelBlurYPostprocess = null;\r\n }\r\n this._blurPostProcesses = [];\r\n };\r\n ShadowGenerator.prototype._disposeRTTandPostProcesses = function () {\r\n if (this._shadowMap) {\r\n this._shadowMap.dispose();\r\n this._shadowMap = null;\r\n }\r\n this._disposeBlurPostProcesses();\r\n };\r\n /**\r\n * Disposes the ShadowGenerator.\r\n * Returns nothing.\r\n */\r\n ShadowGenerator.prototype.dispose = function () {\r\n this._disposeRTTandPostProcesses();\r\n if (this._light) {\r\n this._light._shadowGenerator = null;\r\n this._light._markMeshesAsLightDirty();\r\n }\r\n this.onBeforeShadowMapRenderMeshObservable.clear();\r\n this.onBeforeShadowMapRenderObservable.clear();\r\n this.onAfterShadowMapRenderMeshObservable.clear();\r\n this.onAfterShadowMapRenderObservable.clear();\r\n };\r\n /**\r\n * Serializes the shadow generator setup to a json object.\r\n * @returns The serialized JSON object\r\n */\r\n ShadowGenerator.prototype.serialize = function () {\r\n var serializationObject = {};\r\n var shadowMap = this.getShadowMap();\r\n if (!shadowMap) {\r\n return serializationObject;\r\n }\r\n serializationObject.lightId = this._light.id;\r\n serializationObject.mapSize = shadowMap.getRenderSize();\r\n serializationObject.useExponentialShadowMap = this.useExponentialShadowMap;\r\n serializationObject.useBlurExponentialShadowMap = this.useBlurExponentialShadowMap;\r\n serializationObject.useCloseExponentialShadowMap = this.useBlurExponentialShadowMap;\r\n serializationObject.useBlurCloseExponentialShadowMap = this.useBlurExponentialShadowMap;\r\n serializationObject.usePoissonSampling = this.usePoissonSampling;\r\n serializationObject.forceBackFacesOnly = this.forceBackFacesOnly;\r\n serializationObject.depthScale = this.depthScale;\r\n serializationObject.darkness = this.getDarkness();\r\n serializationObject.blurBoxOffset = this.blurBoxOffset;\r\n serializationObject.blurKernel = this.blurKernel;\r\n serializationObject.blurScale = this.blurScale;\r\n serializationObject.useKernelBlur = this.useKernelBlur;\r\n serializationObject.transparencyShadow = this._transparencyShadow;\r\n serializationObject.frustumEdgeFalloff = this.frustumEdgeFalloff;\r\n serializationObject.bias = this.bias;\r\n serializationObject.normalBias = this.normalBias;\r\n serializationObject.usePercentageCloserFiltering = this.usePercentageCloserFiltering;\r\n serializationObject.useContactHardeningShadow = this.useContactHardeningShadow;\r\n serializationObject.filteringQuality = this.filteringQuality;\r\n serializationObject.contactHardeningLightSizeUVRatio = this.contactHardeningLightSizeUVRatio;\r\n serializationObject.renderList = [];\r\n if (shadowMap.renderList) {\r\n for (var meshIndex = 0; meshIndex < shadowMap.renderList.length; meshIndex++) {\r\n var mesh = shadowMap.renderList[meshIndex];\r\n serializationObject.renderList.push(mesh.id);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a serialized ShadowGenerator and returns a new ShadowGenerator.\r\n * @param parsedShadowGenerator The JSON object to parse\r\n * @param scene The scene to create the shadow map for\r\n * @returns The parsed shadow generator\r\n */\r\n ShadowGenerator.Parse = function (parsedShadowGenerator, scene) {\r\n var light = scene.getLightByID(parsedShadowGenerator.lightId);\r\n var shadowGenerator = new ShadowGenerator(parsedShadowGenerator.mapSize, light);\r\n var shadowMap = shadowGenerator.getShadowMap();\r\n for (var meshIndex = 0; meshIndex < parsedShadowGenerator.renderList.length; meshIndex++) {\r\n var meshes = scene.getMeshesByID(parsedShadowGenerator.renderList[meshIndex]);\r\n meshes.forEach(function (mesh) {\r\n if (!shadowMap) {\r\n return;\r\n }\r\n if (!shadowMap.renderList) {\r\n shadowMap.renderList = [];\r\n }\r\n shadowMap.renderList.push(mesh);\r\n });\r\n }\r\n if (parsedShadowGenerator.usePoissonSampling) {\r\n shadowGenerator.usePoissonSampling = true;\r\n }\r\n else if (parsedShadowGenerator.useExponentialShadowMap) {\r\n shadowGenerator.useExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useBlurExponentialShadowMap) {\r\n shadowGenerator.useBlurExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useCloseExponentialShadowMap) {\r\n shadowGenerator.useCloseExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useBlurCloseExponentialShadowMap) {\r\n shadowGenerator.useBlurCloseExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.usePercentageCloserFiltering) {\r\n shadowGenerator.usePercentageCloserFiltering = true;\r\n }\r\n else if (parsedShadowGenerator.useContactHardeningShadow) {\r\n shadowGenerator.useContactHardeningShadow = true;\r\n }\r\n if (parsedShadowGenerator.filteringQuality) {\r\n shadowGenerator.filteringQuality = parsedShadowGenerator.filteringQuality;\r\n }\r\n if (parsedShadowGenerator.contactHardeningLightSizeUVRatio) {\r\n shadowGenerator.contactHardeningLightSizeUVRatio = parsedShadowGenerator.contactHardeningLightSizeUVRatio;\r\n }\r\n // Backward compat\r\n else if (parsedShadowGenerator.useVarianceShadowMap) {\r\n shadowGenerator.useExponentialShadowMap = true;\r\n }\r\n else if (parsedShadowGenerator.useBlurVarianceShadowMap) {\r\n shadowGenerator.useBlurExponentialShadowMap = true;\r\n }\r\n if (parsedShadowGenerator.depthScale) {\r\n shadowGenerator.depthScale = parsedShadowGenerator.depthScale;\r\n }\r\n if (parsedShadowGenerator.blurScale) {\r\n shadowGenerator.blurScale = parsedShadowGenerator.blurScale;\r\n }\r\n if (parsedShadowGenerator.blurBoxOffset) {\r\n shadowGenerator.blurBoxOffset = parsedShadowGenerator.blurBoxOffset;\r\n }\r\n if (parsedShadowGenerator.useKernelBlur) {\r\n shadowGenerator.useKernelBlur = parsedShadowGenerator.useKernelBlur;\r\n }\r\n if (parsedShadowGenerator.blurKernel) {\r\n shadowGenerator.blurKernel = parsedShadowGenerator.blurKernel;\r\n }\r\n if (parsedShadowGenerator.bias !== undefined) {\r\n shadowGenerator.bias = parsedShadowGenerator.bias;\r\n }\r\n if (parsedShadowGenerator.normalBias !== undefined) {\r\n shadowGenerator.normalBias = parsedShadowGenerator.normalBias;\r\n }\r\n if (parsedShadowGenerator.frustumEdgeFalloff !== undefined) {\r\n shadowGenerator.frustumEdgeFalloff = parsedShadowGenerator.frustumEdgeFalloff;\r\n }\r\n if (parsedShadowGenerator.darkness) {\r\n shadowGenerator.setDarkness(parsedShadowGenerator.darkness);\r\n }\r\n if (parsedShadowGenerator.transparencyShadow) {\r\n shadowGenerator.setTransparencyShadow(true);\r\n }\r\n shadowGenerator.forceBackFacesOnly = parsedShadowGenerator.forceBackFacesOnly;\r\n return shadowGenerator;\r\n };\r\n /**\r\n * Shadow generator mode None: no filtering applied.\r\n */\r\n ShadowGenerator.FILTER_NONE = 0;\r\n /**\r\n * Shadow generator mode ESM: Exponential Shadow Mapping.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_EXPONENTIALSHADOWMAP = 1;\r\n /**\r\n * Shadow generator mode Poisson Sampling: Percentage Closer Filtering.\r\n * (Multiple Tap around evenly distributed around the pixel are used to evaluate the shadow strength)\r\n */\r\n ShadowGenerator.FILTER_POISSONSAMPLING = 2;\r\n /**\r\n * Shadow generator mode ESM: Blurred Exponential Shadow Mapping.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_BLUREXPONENTIALSHADOWMAP = 3;\r\n /**\r\n * Shadow generator mode ESM: Exponential Shadow Mapping using the inverse of the exponential preventing\r\n * edge artifacts on steep falloff.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_CLOSEEXPONENTIALSHADOWMAP = 4;\r\n /**\r\n * Shadow generator mode ESM: Blurred Exponential Shadow Mapping using the inverse of the exponential preventing\r\n * edge artifacts on steep falloff.\r\n * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf)\r\n */\r\n ShadowGenerator.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP = 5;\r\n /**\r\n * Shadow generator mode PCF: Percentage Closer Filtering\r\n * benefits from Webgl 2 shadow samplers. Fallback to Poisson Sampling in Webgl 1\r\n * (https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch11.html)\r\n */\r\n ShadowGenerator.FILTER_PCF = 6;\r\n /**\r\n * Shadow generator mode PCSS: Percentage Closering Soft Shadow.\r\n * benefits from Webgl 2 shadow samplers. Fallback to Poisson Sampling in Webgl 1\r\n * Contact Hardening\r\n */\r\n ShadowGenerator.FILTER_PCSS = 7;\r\n /**\r\n * Reserved for PCF and PCSS\r\n * Highest Quality.\r\n *\r\n * Execute PCF on a 5*5 kernel improving a lot the shadow aliasing artifacts.\r\n *\r\n * Execute PCSS with 32 taps blocker search and 64 taps PCF.\r\n */\r\n ShadowGenerator.QUALITY_HIGH = 0;\r\n /**\r\n * Reserved for PCF and PCSS\r\n * Good tradeoff for quality/perf cross devices\r\n *\r\n * Execute PCF on a 3*3 kernel.\r\n *\r\n * Execute PCSS with 16 taps blocker search and 32 taps PCF.\r\n */\r\n ShadowGenerator.QUALITY_MEDIUM = 1;\r\n /**\r\n * Reserved for PCF and PCSS\r\n * The lowest quality but the fastest.\r\n *\r\n * Execute PCF on a 1*1 kernel.\r\n *\r\n * Execute PCSS with 16 taps blocker search and 16 taps PCF.\r\n */\r\n ShadowGenerator.QUALITY_LOW = 2;\r\n /** @hidden */\r\n ShadowGenerator._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_17__[\"_DevTools\"].WarnImport(\"ShadowGeneratorSceneComponent\");\r\n };\r\n return ShadowGenerator;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/Shadows/shadowGeneratorSceneComponent.ts\":\n/*!*********************************************************!*\\\n !*** ./Lights/Shadows/shadowGeneratorSceneComponent.ts ***!\n \\*********************************************************/\n/*! exports provided: ShadowGeneratorSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return ShadowGeneratorSceneComponent; });\n/* harmony import */ var _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shadowGenerator */ \"./Lights/Shadows/shadowGenerator.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../abstractScene */ \"./abstractScene.ts\");\n\r\n\r\n\r\n// Adds the parser to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_SHADOWGENERATOR, function (parsedData, scene) {\r\n // Shadows\r\n if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {\r\n for (var index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {\r\n var parsedShadowGenerator = parsedData.shadowGenerators[index];\r\n _shadowGenerator__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"].Parse(parsedShadowGenerator, scene);\r\n // SG would be available on their associated lights\r\n }\r\n }\r\n});\r\n/**\r\n * Defines the shadow generator component responsible to manage any shadow generators\r\n * in a given scene.\r\n */\r\nvar ShadowGeneratorSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function ShadowGeneratorSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_SHADOWGENERATOR;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n ShadowGeneratorSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n ShadowGeneratorSceneComponent.prototype.rebuild = function () {\r\n // Nothing To Do Here.\r\n };\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n ShadowGeneratorSceneComponent.prototype.serialize = function (serializationObject) {\r\n // Shadows\r\n serializationObject.shadowGenerators = [];\r\n var lights = this.scene.lights;\r\n for (var _i = 0, lights_1 = lights; _i < lights_1.length; _i++) {\r\n var light = lights_1[_i];\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n serializationObject.shadowGenerators.push(shadowGenerator.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n ShadowGeneratorSceneComponent.prototype.addFromContainer = function (container) {\r\n // Nothing To Do Here. (directly attached to a light)\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n ShadowGeneratorSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n // Nothing To Do Here. (directly attached to a light)\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n ShadowGeneratorSceneComponent.prototype.dispose = function () {\r\n // Nothing To Do Here.\r\n };\r\n ShadowGeneratorSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {\r\n // Shadows\r\n var scene = this.scene;\r\n if (this.scene.shadowsEnabled) {\r\n for (var lightIndex = 0; lightIndex < scene.lights.length; lightIndex++) {\r\n var light = scene.lights[lightIndex];\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (light.isEnabled() && light.shadowEnabled && shadowGenerator) {\r\n var shadowMap = (shadowGenerator.getShadowMap());\r\n if (scene.textures.indexOf(shadowMap) !== -1) {\r\n renderTargets.push(shadowMap);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n return ShadowGeneratorSceneComponent;\r\n}());\r\n\r\n_shadowGenerator__WEBPACK_IMPORTED_MODULE_0__[\"ShadowGenerator\"]._SceneComponentInitialization = function (scene) {\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_SHADOWGENERATOR);\r\n if (!component) {\r\n component = new ShadowGeneratorSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Lights/directionalLight.ts\":\n/*!************************************!*\\\n !*** ./Lights/directionalLight.ts ***!\n \\************************************/\n/*! exports provided: DirectionalLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return DirectionalLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"Light_Type_1\", function (name, scene) {\r\n return function () { return new DirectionalLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * A directional light is defined by a direction (what a surprise!).\r\n * The light is emitted from everywhere in the specified direction, and has an infinite range.\r\n * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar DirectionalLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DirectionalLight, _super);\r\n /**\r\n * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).\r\n * The directional light is emitted from everywhere in the given direction.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light\r\n * @param scene The scene the light belongs to\r\n */\r\n function DirectionalLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowFrustumSize = 0;\r\n _this._shadowOrthoScale = 0.1;\r\n /**\r\n * Automatically compute the projection matrix to best fit (including all the casters)\r\n * on each frame.\r\n */\r\n _this.autoUpdateExtends = true;\r\n // Cache\r\n _this._orthoLeft = Number.MAX_VALUE;\r\n _this._orthoRight = Number.MIN_VALUE;\r\n _this._orthoTop = Number.MIN_VALUE;\r\n _this._orthoBottom = Number.MAX_VALUE;\r\n _this.position = direction.scale(-1.0);\r\n _this.direction = direction;\r\n return _this;\r\n }\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowFrustumSize\", {\r\n /**\r\n * Fix frustum size for the shadow generation. This is disabled if the value is 0.\r\n */\r\n get: function () {\r\n return this._shadowFrustumSize;\r\n },\r\n /**\r\n * Specifies a fix frustum size for the shadow generation.\r\n */\r\n set: function (value) {\r\n this._shadowFrustumSize = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowOrthoScale\", {\r\n /**\r\n * Gets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n get: function () {\r\n return this._shadowOrthoScale;\r\n },\r\n /**\r\n * Sets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n set: function (value) {\r\n this._shadowOrthoScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"DirectionalLight\".\r\n * @return The class name\r\n */\r\n DirectionalLight.prototype.getClassName = function () {\r\n return \"DirectionalLight\";\r\n };\r\n /**\r\n * Returns the integer 1.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n DirectionalLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_DIRECTIONALLIGHT;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.shadowFrustumSize > 0) {\r\n this._setDefaultFixedFrustumShadowProjectionMatrix(matrix);\r\n }\r\n else {\r\n this._setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultFixedFrustumShadowProjectionMatrix = function (matrix) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultAutoExtendShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n // Check extends\r\n if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {\r\n var tempVector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._orthoLeft = Number.MAX_VALUE;\r\n this._orthoRight = Number.MIN_VALUE;\r\n this._orthoTop = Number.MIN_VALUE;\r\n this._orthoBottom = Number.MAX_VALUE;\r\n for (var meshIndex = 0; meshIndex < renderList.length; meshIndex++) {\r\n var mesh = renderList[meshIndex];\r\n if (!mesh) {\r\n continue;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n for (var index = 0; index < boundingBox.vectorsWorld.length; index++) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);\r\n if (tempVector3.x < this._orthoLeft) {\r\n this._orthoLeft = tempVector3.x;\r\n }\r\n if (tempVector3.y < this._orthoBottom) {\r\n this._orthoBottom = tempVector3.y;\r\n }\r\n if (tempVector3.x > this._orthoRight) {\r\n this._orthoRight = tempVector3.x;\r\n }\r\n if (tempVector3.y > this._orthoTop) {\r\n this._orthoTop = tempVector3.y;\r\n }\r\n }\r\n }\r\n }\r\n var xOffset = this._orthoRight - this._orthoLeft;\r\n var yOffset = this._orthoTop - this._orthoBottom;\r\n if (this.getScene().useRightHandedSystem) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].OrthoOffCenterRHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n }\r\n };\r\n DirectionalLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The directional light\r\n */\r\n DirectionalLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n if (this.getScene().useRightHandedSystem) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", -this.transformedDirection.x, -this.transformedDirection.y, -this.transformedDirection.z, 1, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);\r\n }\r\n return this;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", -this.direction.x, -this.direction.y, -this.direction.z, 1, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);\r\n }\r\n return this;\r\n };\r\n DirectionalLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -this.transformedDirection.x, -this.transformedDirection.y, -this.transformedDirection.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);\r\n }\r\n return this;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -this.direction.x, -this.direction.y, -this.direction.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n DirectionalLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n DirectionalLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n DirectionalLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"DIRLIGHT\" + lightIndex] = true;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DirectionalLight.prototype, \"shadowFrustumSize\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DirectionalLight.prototype, \"shadowOrthoScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DirectionalLight.prototype, \"autoUpdateExtends\", void 0);\r\n return DirectionalLight;\r\n}(_shadowLight__WEBPACK_IMPORTED_MODULE_5__[\"ShadowLight\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/hemisphericLight.ts\":\n/*!************************************!*\\\n !*** ./Lights/hemisphericLight.ts ***!\n \\************************************/\n/*! exports provided: HemisphericLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return HemisphericLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].AddNodeConstructor(\"Light_Type_3\", function (name, scene) {\r\n return function () { return new HemisphericLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * The HemisphericLight simulates the ambient environment light,\r\n * so the passed direction is the light reflection direction, not the incoming direction.\r\n */\r\nvar HemisphericLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HemisphericLight, _super);\r\n /**\r\n * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).\r\n * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.\r\n * The HemisphericLight can't cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light reflection\r\n * @param scene The scene the light belongs to\r\n */\r\n function HemisphericLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * The groundColor is the light in the opposite direction to the one specified during creation.\r\n * You can think of the diffuse and specular light as coming from the centre of the object in the given direction and the groundColor light in the opposite direction.\r\n */\r\n _this.groundColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0.0, 0.0, 0.0);\r\n _this.direction = direction || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Up();\r\n return _this;\r\n }\r\n HemisphericLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"vLightGround\", 3);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Returns the string \"HemisphericLight\".\r\n * @return The class name\r\n */\r\n HemisphericLight.prototype.getClassName = function () {\r\n return \"HemisphericLight\";\r\n };\r\n /**\r\n * Sets the HemisphericLight direction towards the passed target (Vector3).\r\n * Returns the updated direction.\r\n * @param target The target the direction should point to\r\n * @return The computed direction\r\n */\r\n HemisphericLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(target.subtract(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero()));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the shadow generator associated to the light.\r\n * @returns Always null for hemispheric lights because it does not support shadows.\r\n */\r\n HemisphericLight.prototype.getShadowGenerator = function () {\r\n return null;\r\n };\r\n /**\r\n * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The hemispheric light\r\n */\r\n HemisphericLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n this._uniformBuffer.updateFloat4(\"vLightData\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0.0, lightIndex);\r\n this._uniformBuffer.updateColor3(\"vLightGround\", this.groundColor.scale(this.intensity), lightIndex);\r\n return this;\r\n };\r\n HemisphericLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n return this;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @param useWasUpdatedFlag defines a reserved property\r\n * @returns the world matrix\r\n */\r\n HemisphericLight.prototype.computeWorldMatrix = function () {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Returns the integer 3.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n HemisphericLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_5__[\"Light\"].LIGHTTYPEID_HEMISPHERICLIGHT;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n HemisphericLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"HEMILIGHT\" + lightIndex] = true;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], HemisphericLight.prototype, \"groundColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], HemisphericLight.prototype, \"direction\", void 0);\r\n return HemisphericLight;\r\n}(_light__WEBPACK_IMPORTED_MODULE_5__[\"Light\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/index.ts\":\n/*!*************************!*\\\n !*** ./Lights/index.ts ***!\n \\*************************/\n/*! exports provided: Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, ShadowGenerator, ShadowGeneratorSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return _light__WEBPACK_IMPORTED_MODULE_0__[\"Light\"]; });\n\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return _shadowLight__WEBPACK_IMPORTED_MODULE_1__[\"ShadowLight\"]; });\n\n/* harmony import */ var _Shadows_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Shadows/index */ \"./Lights/Shadows/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _Shadows_index__WEBPACK_IMPORTED_MODULE_2__[\"ShadowGenerator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _Shadows_index__WEBPACK_IMPORTED_MODULE_2__[\"ShadowGeneratorSceneComponent\"]; });\n\n/* harmony import */ var _directionalLight__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./directionalLight */ \"./Lights/directionalLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return _directionalLight__WEBPACK_IMPORTED_MODULE_3__[\"DirectionalLight\"]; });\n\n/* harmony import */ var _hemisphericLight__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return _hemisphericLight__WEBPACK_IMPORTED_MODULE_4__[\"HemisphericLight\"]; });\n\n/* harmony import */ var _pointLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pointLight */ \"./Lights/pointLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return _pointLight__WEBPACK_IMPORTED_MODULE_5__[\"PointLight\"]; });\n\n/* harmony import */ var _spotLight__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./spotLight */ \"./Lights/spotLight.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return _spotLight__WEBPACK_IMPORTED_MODULE_6__[\"SpotLight\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/light.ts\":\n/*!*************************!*\\\n !*** ./Lights/light.ts ***!\n \\*************************/\n/*! exports provided: Light */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return Light; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class of all the lights in Babylon. It groups all the generic information about lights.\r\n * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour.\r\n * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased.\r\n */\r\nvar Light = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Light, _super);\r\n /**\r\n * Creates a Light object in the scene.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The firendly name of the light\r\n * @param scene The scene the light belongs too\r\n */\r\n function Light(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Diffuse gives the basic color to an object.\r\n */\r\n _this.diffuse = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1.0, 1.0, 1.0);\r\n /**\r\n * Specular produces a highlight color on an object.\r\n * Note: This is note affecting PBR materials.\r\n */\r\n _this.specular = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1.0, 1.0, 1.0);\r\n /**\r\n * Defines the falloff type for this light. This lets overrriding how punctual light are\r\n * falling off base on range or angle.\r\n * This can be set to any values in Light.FALLOFF_x.\r\n *\r\n * Note: This is only useful for PBR Materials at the moment. This could be extended if required to\r\n * other types of materials.\r\n */\r\n _this.falloffType = Light.FALLOFF_DEFAULT;\r\n /**\r\n * Strength of the light.\r\n * Note: By default it is define in the framework own unit.\r\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\r\n */\r\n _this.intensity = 1.0;\r\n _this._range = Number.MAX_VALUE;\r\n _this._inverseSquaredRange = 0;\r\n /**\r\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\r\n * of light.\r\n */\r\n _this._photometricScale = 1.0;\r\n _this._intensityMode = Light.INTENSITYMODE_AUTOMATIC;\r\n _this._radius = 0.00001;\r\n /**\r\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\r\n * exceeding the number allowed of the materials.\r\n */\r\n _this.renderPriority = 0;\r\n _this._shadowEnabled = true;\r\n _this._excludeWithLayerMask = 0;\r\n _this._includeOnlyWithLayerMask = 0;\r\n _this._lightmapMode = 0;\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._excludedMeshesIds = new Array();\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._includedOnlyMeshesIds = new Array();\r\n /** @hidden */\r\n _this._isLight = true;\r\n _this.getScene().addLight(_this);\r\n _this._uniformBuffer = new _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_5__[\"UniformBuffer\"](_this.getScene().getEngine());\r\n _this._buildUniformLayout();\r\n _this.includedOnlyMeshes = new Array();\r\n _this.excludedMeshes = new Array();\r\n _this._resyncMeshes();\r\n return _this;\r\n }\r\n Object.defineProperty(Light.prototype, \"range\", {\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n get: function () {\r\n return this._range;\r\n },\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n set: function (value) {\r\n this._range = value;\r\n this._inverseSquaredRange = 1.0 / (this.range * this.range);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"intensityMode\", {\r\n /**\r\n * Gets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n get: function () {\r\n return this._intensityMode;\r\n },\r\n /**\r\n * Sets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n set: function (value) {\r\n this._intensityMode = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"radius\", {\r\n /**\r\n * Gets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n get: function () {\r\n return this._radius;\r\n },\r\n /**\r\n * sets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n set: function (value) {\r\n this._radius = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"shadowEnabled\", {\r\n /**\r\n * Gets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n get: function () {\r\n return this._shadowEnabled;\r\n },\r\n /**\r\n * Sets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n set: function (value) {\r\n if (this._shadowEnabled === value) {\r\n return;\r\n }\r\n this._shadowEnabled = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includedOnlyMeshes\", {\r\n /**\r\n * Gets the only meshes impacted by this light.\r\n */\r\n get: function () {\r\n return this._includedOnlyMeshes;\r\n },\r\n /**\r\n * Sets the only meshes impacted by this light.\r\n */\r\n set: function (value) {\r\n this._includedOnlyMeshes = value;\r\n this._hookArrayForIncludedOnly(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludedMeshes\", {\r\n /**\r\n * Gets the meshes not impacted by this light.\r\n */\r\n get: function () {\r\n return this._excludedMeshes;\r\n },\r\n /**\r\n * Sets the meshes not impacted by this light.\r\n */\r\n set: function (value) {\r\n this._excludedMeshes = value;\r\n this._hookArrayForExcluded(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludeWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._excludeWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._excludeWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includeOnlyWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._includeOnlyWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._includeOnlyWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"lightmapMode\", {\r\n /**\r\n * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n get: function () {\r\n return this._lightmapMode;\r\n },\r\n /**\r\n * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n set: function (value) {\r\n if (this._lightmapMode === value) {\r\n return;\r\n }\r\n this._lightmapMode = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"Light\".\r\n * @returns the class name\r\n */\r\n Light.prototype.getClassName = function () {\r\n return \"Light\";\r\n };\r\n /**\r\n * Converts the light information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable light info\r\n */\r\n Light.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + ([\"Point\", \"Directional\", \"Spot\", \"Hemispheric\"])[this.getTypeID()];\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Light.prototype._syncParentEnabledState = function () {\r\n _super.prototype._syncParentEnabledState.call(this);\r\n this._resyncMeshes();\r\n };\r\n /**\r\n * Set the enabled state of this node.\r\n * @param value - the new enabled state\r\n */\r\n Light.prototype.setEnabled = function (value) {\r\n _super.prototype.setEnabled.call(this, value);\r\n this._resyncMeshes();\r\n };\r\n /**\r\n * Returns the Light associated shadow generator if any.\r\n * @return the associated shadow generator.\r\n */\r\n Light.prototype.getShadowGenerator = function () {\r\n return this._shadowGenerator;\r\n };\r\n /**\r\n * Returns a Vector3, the absolute light position in the World.\r\n * @returns the world space position of the light\r\n */\r\n Light.prototype.getAbsolutePosition = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Specifies if the light will affect the passed mesh.\r\n * @param mesh The mesh to test against the light\r\n * @return true the mesh is affected otherwise, false.\r\n */\r\n Light.prototype.canAffectMesh = function (mesh) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {\r\n return false;\r\n }\r\n if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return false;\r\n }\r\n if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {\r\n return false;\r\n }\r\n if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sort function to order lights for rendering.\r\n * @param a First Light object to compare to second.\r\n * @param b Second Light object to compare first.\r\n * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.\r\n */\r\n Light.CompareLightsPriority = function (a, b) {\r\n //shadow-casting lights have priority over non-shadow-casting lights\r\n //the renderPrioirty is a secondary sort criterion\r\n if (a.shadowEnabled !== b.shadowEnabled) {\r\n return (b.shadowEnabled ? 1 : 0) - (a.shadowEnabled ? 1 : 0);\r\n }\r\n return b.renderPriority - a.renderPriority;\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Light.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n if (this._shadowGenerator) {\r\n this._shadowGenerator.dispose();\r\n this._shadowGenerator = null;\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(this, true);\r\n }\r\n this._uniformBuffer.dispose();\r\n // Remove from scene\r\n this.getScene().removeLight(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Returns the light type ID (integer).\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n Light.prototype.getTypeID = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.\r\n * @returns the scaled intensity in intensity mode unit\r\n */\r\n Light.prototype.getScaledIntensity = function () {\r\n return this._photometricScale * this.intensity;\r\n };\r\n /**\r\n * Returns a new Light object, named \"name\", from the current one.\r\n * @param name The name of the cloned light\r\n * @returns the new created light\r\n */\r\n Light.prototype.clone = function (name) {\r\n var constructor = Light.GetConstructorFromName(this.getTypeID(), name, this.getScene());\r\n if (!constructor) {\r\n return null;\r\n }\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(constructor, this);\r\n };\r\n /**\r\n * Serializes the current light into a Serialization object.\r\n * @returns the serialized object.\r\n */\r\n Light.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n // Type\r\n serializationObject.type = this.getTypeID();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Inclusion / exclusions\r\n if (this.excludedMeshes.length > 0) {\r\n serializationObject.excludedMeshesIds = [];\r\n this.excludedMeshes.forEach(function (mesh) {\r\n serializationObject.excludedMeshesIds.push(mesh.id);\r\n });\r\n }\r\n if (this.includedOnlyMeshes.length > 0) {\r\n serializationObject.includedOnlyMeshesIds = [];\r\n this.includedOnlyMeshes.forEach(function (mesh) {\r\n serializationObject.includedOnlyMeshesIds.push(mesh.id);\r\n });\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.\r\n * This new light is named \"name\" and added to the passed scene.\r\n * @param type Type according to the types available in Light.LIGHTTYPEID_x\r\n * @param name The friendly name of the light\r\n * @param scene The scene the new light will belong to\r\n * @returns the constructor function\r\n */\r\n Light.GetConstructorFromName = function (type, name, scene) {\r\n var constructorFunc = _node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].Construct(\"Light_Type_\" + type, name, scene);\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to no light for none present once.\r\n return null;\r\n };\r\n /**\r\n * Parses the passed \"parsedLight\" and returns a new instanced Light from this parsing.\r\n * @param parsedLight The JSON representation of the light\r\n * @param scene The scene to create the parsed light in\r\n * @returns the created light after parsing\r\n */\r\n Light.Parse = function (parsedLight, scene) {\r\n var constructor = Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene);\r\n if (!constructor) {\r\n return null;\r\n }\r\n var light = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(constructor, parsedLight, scene);\r\n // Inclusion / exclusions\r\n if (parsedLight.excludedMeshesIds) {\r\n light._excludedMeshesIds = parsedLight.excludedMeshesIds;\r\n }\r\n if (parsedLight.includedOnlyMeshesIds) {\r\n light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;\r\n }\r\n // Parent\r\n if (parsedLight.parentId) {\r\n light._waitingParentId = parsedLight.parentId;\r\n }\r\n // Falloff\r\n if (parsedLight.falloffType !== undefined) {\r\n light.falloffType = parsedLight.falloffType;\r\n }\r\n // Lightmaps\r\n if (parsedLight.lightmapMode !== undefined) {\r\n light.lightmapMode = parsedLight.lightmapMode;\r\n }\r\n // Animations\r\n if (parsedLight.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedLight.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n light.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"].ParseAnimationRanges(light, parsedLight, scene);\r\n }\r\n if (parsedLight.autoAnimate) {\r\n scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);\r\n }\r\n return light;\r\n };\r\n Light.prototype._hookArrayForExcluded = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {\r\n var item = items_1[_a];\r\n item._resyncLighSource(_this);\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n for (var _i = 0, deleted_1 = deleted; _i < deleted_1.length; _i++) {\r\n var item = deleted_1[_i];\r\n item._resyncLighSource(_this);\r\n }\r\n return deleted;\r\n };\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var item = array_1[_i];\r\n item._resyncLighSource(this);\r\n }\r\n };\r\n Light.prototype._hookArrayForIncludedOnly = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._resyncMeshes();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._resyncMeshes();\r\n return deleted;\r\n };\r\n this._resyncMeshes();\r\n };\r\n Light.prototype._resyncMeshes = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._resyncLighSource(this);\r\n }\r\n };\r\n /**\r\n * Forces the meshes to update their light related information in their rendering used effects\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._markMeshesAsLightDirty = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(this) !== -1) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n };\r\n /**\r\n * Recomputes the cached photometric scale if needed.\r\n */\r\n Light.prototype._computePhotometricScale = function () {\r\n this._photometricScale = this._getPhotometricScale();\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Returns the Photometric Scale according to the light type and intensity mode.\r\n */\r\n Light.prototype._getPhotometricScale = function () {\r\n var photometricScale = 0.0;\r\n var lightTypeID = this.getTypeID();\r\n //get photometric mode\r\n var photometricMode = this.intensityMode;\r\n if (photometricMode === Light.INTENSITYMODE_AUTOMATIC) {\r\n if (lightTypeID === Light.LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n photometricMode = Light.INTENSITYMODE_ILLUMINANCE;\r\n }\r\n else {\r\n photometricMode = Light.INTENSITYMODE_LUMINOUSINTENSITY;\r\n }\r\n }\r\n //compute photometric scale\r\n switch (lightTypeID) {\r\n case Light.LIGHTTYPEID_POINTLIGHT:\r\n case Light.LIGHTTYPEID_SPOTLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_LUMINOUSPOWER:\r\n photometricScale = 1.0 / (4.0 * Math.PI);\r\n break;\r\n case Light.INTENSITYMODE_LUMINOUSINTENSITY:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n photometricScale = this.radius * this.radius;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_DIRECTIONALLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_ILLUMINANCE:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n // When radius (and therefore solid angle) is non-zero a directional lights brightness can be specified via central (peak) luminance.\r\n // For a directional light the 'radius' defines the angular radius (in radians) rather than world-space radius (e.g. in metres).\r\n var apexAngleRadians = this.radius;\r\n // Impose a minimum light angular size to avoid the light becoming an infinitely small angular light source (i.e. a dirac delta function).\r\n apexAngleRadians = Math.max(apexAngleRadians, 0.001);\r\n var solidAngle = 2.0 * Math.PI * (1.0 - Math.cos(apexAngleRadians));\r\n photometricScale = solidAngle;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_HEMISPHERICLIGHT:\r\n // No fall off in hemisperic light.\r\n photometricScale = 1.0;\r\n break;\r\n }\r\n return photometricScale;\r\n };\r\n /**\r\n * Reorder the light in the scene according to their defined priority.\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._reorderLightsInScene = function () {\r\n var scene = this.getScene();\r\n if (this._renderPriority != 0) {\r\n scene.requireLightSorting = true;\r\n }\r\n this.getScene().sortLightsByPriority();\r\n };\r\n /**\r\n * Falloff Default: light is falling off following the material specification:\r\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\r\n */\r\n Light.FALLOFF_DEFAULT = 0;\r\n /**\r\n * Falloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n Light.FALLOFF_PHYSICAL = 1;\r\n /**\r\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n Light.FALLOFF_GLTF = 2;\r\n /**\r\n * Falloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n Light.FALLOFF_STANDARD = 3;\r\n //lightmapMode Consts\r\n /**\r\n * If every light affecting the material is in this lightmapMode,\r\n * material.lightmapTexture adds or multiplies\r\n * (depends on material.useLightmapAsShadowmap)\r\n * after every other light calculations.\r\n */\r\n Light.LIGHTMAP_DEFAULT = 0;\r\n /**\r\n * material.lightmapTexture as only diffuse lighting from this light\r\n * adds only specular lighting from this light\r\n * adds dynamic shadows\r\n */\r\n Light.LIGHTMAP_SPECULAR = 1;\r\n /**\r\n * material.lightmapTexture as only lighting\r\n * no light calculation from this light\r\n * only adds dynamic shadows from this light\r\n */\r\n Light.LIGHTMAP_SHADOWSONLY = 2;\r\n // Intensity Mode Consts\r\n /**\r\n * Each light type uses the default quantity according to its type:\r\n * point/spot lights use luminous intensity\r\n * directional lights use illuminance\r\n */\r\n Light.INTENSITYMODE_AUTOMATIC = 0;\r\n /**\r\n * lumen (lm)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSPOWER = 1;\r\n /**\r\n * candela (lm/sr)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSINTENSITY = 2;\r\n /**\r\n * lux (lm/m^2)\r\n */\r\n Light.INTENSITYMODE_ILLUMINANCE = 3;\r\n /**\r\n * nit (cd/m^2)\r\n */\r\n Light.INTENSITYMODE_LUMINANCE = 4;\r\n // Light types ids const.\r\n /**\r\n * Light type const id of the point light.\r\n */\r\n Light.LIGHTTYPEID_POINTLIGHT = 0;\r\n /**\r\n * Light type const id of the directional light.\r\n */\r\n Light.LIGHTTYPEID_DIRECTIONALLIGHT = 1;\r\n /**\r\n * Light type const id of the spot light.\r\n */\r\n Light.LIGHTTYPEID_SPOTLIGHT = 2;\r\n /**\r\n * Light type const id of the hemispheric light.\r\n */\r\n Light.LIGHTTYPEID_HEMISPHERICLIGHT = 3;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], Light.prototype, \"diffuse\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], Light.prototype, \"specular\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"falloffType\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"range\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"intensityMode\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"radius\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Light.prototype, \"_renderPriority\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_reorderLightsInScene\")\r\n ], Light.prototype, \"renderPriority\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"shadowEnabled\")\r\n ], Light.prototype, \"_shadowEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"excludeWithLayerMask\")\r\n ], Light.prototype, \"_excludeWithLayerMask\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"includeOnlyWithLayerMask\")\r\n ], Light.prototype, \"_includeOnlyWithLayerMask\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"lightmapMode\")\r\n ], Light.prototype, \"_lightmapMode\", void 0);\r\n return Light;\r\n}(_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/pointLight.ts\":\n/*!******************************!*\\\n !*** ./Lights/pointLight.ts ***!\n \\******************************/\n/*! exports provided: PointLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return PointLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"Light_Type_0\", function (name, scene) {\r\n return function () { return new PointLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), scene); };\r\n});\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar PointLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PointLight, _super);\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n function PointLight(name, position, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowAngle = Math.PI / 2;\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(PointLight.prototype, \"shadowAngle\", {\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n get: function () {\r\n return this._shadowAngle;\r\n },\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n set: function (value) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointLight.prototype, \"direction\", {\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n set: function (value) {\r\n var previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerator) {\r\n this._shadowGenerator.recreateShadowMap();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n PointLight.prototype.getClassName = function () {\r\n return \"PointLight\";\r\n };\r\n /**\r\n * Returns the integer 0.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n PointLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_POINTLIGHT;\r\n };\r\n /**\r\n * Specifies wether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n PointLight.prototype.needCube = function () {\r\n return !this.direction;\r\n };\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n PointLight.prototype.getShadowDirection = function (faceIndex) {\r\n if (this.direction) {\r\n return _super.prototype.getShadowDirection.call(this, faceIndex);\r\n }\r\n else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1.0, 0.0, 0.0);\r\n case 1:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](-1.0, 0.0, 0.0);\r\n case 2:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, -1.0, 0.0);\r\n case 3:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, 1.0, 0.0);\r\n case 4:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, 0.0, 1.0);\r\n case 5:\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0.0, 0.0, -1.0);\r\n }\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\r\n */\r\n PointLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].PerspectiveFovLHToRef(this.shadowAngle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n PointLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The point light\r\n */\r\n PointLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n };\r\n PointLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n PointLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"POINTLIGHT\" + lightIndex] = true;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PointLight.prototype, \"shadowAngle\", null);\r\n return PointLight;\r\n}(_shadowLight__WEBPACK_IMPORTED_MODULE_5__[\"ShadowLight\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/shadowLight.ts\":\n/*!*******************************!*\\\n !*** ./Lights/shadowLight.ts ***!\n \\*******************************/\n/*! exports provided: ShadowLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return ShadowLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base implementation IShadowLight\r\n * It groups all the common behaviour in order to reduce dupplication and better follow the DRY pattern.\r\n */\r\nvar ShadowLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShadowLight, _super);\r\n function ShadowLight() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._needProjectionMatrixCompute = true;\r\n return _this;\r\n }\r\n ShadowLight.prototype._setPosition = function (value) {\r\n this._position = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"position\", {\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n set: function (value) {\r\n this._setPosition(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ShadowLight.prototype._setDirection = function (value) {\r\n this._direction = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"direction\", {\r\n /**\r\n * In 2d mode (needCube being false), gets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In 2d mode (needCube being false), sets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n set: function (value) {\r\n this._setDirection(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMinZ\", {\r\n /**\r\n * Gets the shadow projection clipping minimum z value.\r\n */\r\n get: function () {\r\n return this._shadowMinZ;\r\n },\r\n /**\r\n * Sets the shadow projection clipping minimum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMinZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMaxZ\", {\r\n /**\r\n * Sets the shadow projection clipping maximum z value.\r\n */\r\n get: function () {\r\n return this._shadowMaxZ;\r\n },\r\n /**\r\n * Gets the shadow projection clipping maximum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMaxZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n ShadowLight.prototype.computeTransformedInformation = function () {\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n if (!this.transformedPosition) {\r\n this.transformedPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);\r\n // In case the direction is present.\r\n if (this.direction) {\r\n if (!this.transformedDirection) {\r\n this.transformedDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Return the depth scale used for the shadow map.\r\n * @returns the depth scale.\r\n */\r\n ShadowLight.prototype.getDepthScale = function () {\r\n return 50.0;\r\n };\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n ShadowLight.prototype.getShadowDirection = function (faceIndex) {\r\n return this.transformedDirection ? this.transformedDirection : this.direction;\r\n };\r\n /**\r\n * Returns the ShadowLight absolute position in the World.\r\n * @returns the position vector in world space\r\n */\r\n ShadowLight.prototype.getAbsolutePosition = function () {\r\n return this.transformedPosition ? this.transformedPosition : this.position;\r\n };\r\n /**\r\n * Sets the ShadowLight direction toward the passed target.\r\n * @param target The point to target in local space\r\n * @returns the updated ShadowLight direction\r\n */\r\n ShadowLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(target.subtract(this.position));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the light rotation in euler definition.\r\n * @returns the x y z rotation in local space.\r\n */\r\n ShadowLight.prototype.getRotation = function () {\r\n this.direction.normalize();\r\n var xaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(this.direction, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_4__[\"Axis\"].Y);\r\n var yaxis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(xaxis, this.direction);\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].RotationFromAxis(xaxis, yaxis, this.direction);\r\n };\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n ShadowLight.prototype.needCube = function () {\r\n return false;\r\n };\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n ShadowLight.prototype.needProjectionMatrixCompute = function () {\r\n return this._needProjectionMatrixCompute;\r\n };\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n ShadowLight.prototype.forceProjectionMatrixCompute = function () {\r\n this._needProjectionMatrixCompute = true;\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._isSynchronized = function () {\r\n if (!this._cache.position.equals(this.position)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n ShadowLight.prototype.computeWorldMatrix = function (force) {\r\n if (!force && this.isSynchronized()) {\r\n this._currentRenderId = this.getScene().getRenderId();\r\n return this._worldMatrix;\r\n }\r\n this._updateCache();\r\n this._cache.position.copyFrom(this.position);\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Identity();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);\r\n this._markSyncedWithParent();\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n ShadowLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n ShadowLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n };\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The materix to updated with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n ShadowLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.customProjectionMatrixBuilder) {\r\n this.customProjectionMatrixBuilder(viewMatrix, renderList, matrix);\r\n }\r\n else {\r\n this._setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n return this;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ShadowLight.prototype, \"position\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ShadowLight.prototype, \"direction\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ShadowLight.prototype, \"shadowMinZ\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ShadowLight.prototype, \"shadowMaxZ\", null);\r\n return ShadowLight;\r\n}(_light__WEBPACK_IMPORTED_MODULE_3__[\"Light\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Lights/spotLight.ts\":\n/*!*****************************!*\\\n !*** ./Lights/spotLight.ts ***!\n \\*****************************/\n/*! exports provided: SpotLight */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return SpotLight; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./light */ \"./Lights/light.ts\");\n/* harmony import */ var _shadowLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shadowLight */ \"./Lights/shadowLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_node__WEBPACK_IMPORTED_MODULE_3__[\"Node\"].AddNodeConstructor(\"Light_Type_2\", function (name, scene) {\r\n return function () { return new SpotLight(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(), 0, 0, scene); };\r\n});\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar SpotLight = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SpotLight, _super);\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n */\r\n function SpotLight(name, position, direction, angle, exponent, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._innerAngle = 0;\r\n _this._projectionTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Zero();\r\n _this._projectionTextureLightNear = 1e-6;\r\n _this._projectionTextureLightFar = 1000.0;\r\n _this._projectionTextureUpDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Up();\r\n _this._projectionTextureViewLightDirty = true;\r\n _this._projectionTextureProjectionLightDirty = true;\r\n _this._projectionTextureDirty = true;\r\n _this._projectionTextureViewTargetVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._projectionTextureViewLightMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Zero();\r\n _this._projectionTextureProjectionLightMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].Zero();\r\n _this._projectionTextureScalingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n _this.position = position;\r\n _this.direction = direction;\r\n _this.angle = angle;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n Object.defineProperty(SpotLight.prototype, \"angle\", {\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n get: function () {\r\n return this._angle;\r\n },\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n set: function (value) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"innerAngle\", {\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n get: function () {\r\n return this._innerAngle;\r\n },\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n set: function (value) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"shadowAngleScale\", {\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n get: function () {\r\n return this._shadowAngleScale;\r\n },\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n set: function (value) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureMatrix\", {\r\n /**\r\n * Allows reading the projecton texture\r\n */\r\n get: function () {\r\n return this._projectionTextureMatrix;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightNear\", {\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightNear;\r\n },\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightFar\", {\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightFar;\r\n },\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureUpDirection\", {\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureUpDirection;\r\n },\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTexture\", {\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n get: function () {\r\n return this._projectionTexture;\r\n },\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n var texture = this._projectionTexture;\r\n if (texture.onLoadObservable) {\r\n texture.onLoadObservable.addOnce(function () {\r\n _this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n SpotLight.prototype.getClassName = function () {\r\n return \"SpotLight\";\r\n };\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n SpotLight.prototype.getTypeID = function () {\r\n return _light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTTYPEID_SPOTLIGHT;\r\n };\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setDirection = function (value) {\r\n _super.prototype._setDirection.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setPosition = function (value) {\r\n _super.prototype._setPosition.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n */\r\n SpotLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n var angle = this._shadowAngleScale * this._angle;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].PerspectiveFovLHToRef(angle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureViewLightMatrix = function () {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n this.position.addToRef(this.direction, this._projectionTextureViewTargetVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureProjectionLightMatrix = function () {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n var light_far = this.projectionTextureLightFar;\r\n var light_near = this.projectionTextureLightNear;\r\n var P = light_far / (light_far - light_near);\r\n var Q = -P * light_near;\r\n var S = 1.0 / Math.tan(this._angle / 2.0);\r\n var A = 1.0;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromValuesToRef(S / A, 0.0, 0.0, 0.0, 0.0, S, 0.0, 0.0, 0.0, 0.0, P, 1.0, 0.0, 0.0, Q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n };\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n SpotLight.prototype._computeProjectionTextureMatrix = function () {\r\n this._projectionTextureDirty = false;\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n };\r\n SpotLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 3);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n SpotLight.prototype._computeAngleValues = function () {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, (Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle));\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n };\r\n /**\r\n * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n SpotLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, lightIndex);\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.transformedDirection);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, this.exponent, lightIndex);\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightSampler\" + lightIndex, this.projectionTexture);\r\n }\r\n return this;\r\n };\r\n SpotLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.transformedDirection);\r\n }\r\n else {\r\n normalizeDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Normalize(this.direction);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n SpotLight.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n SpotLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"angle\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"innerAngle\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"shadowAngleScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"exponent\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"projectionTextureLightNear\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"projectionTextureLightFar\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], SpotLight.prototype, \"projectionTextureUpDirection\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"projectedLightTexture\")\r\n ], SpotLight.prototype, \"_projectionTexture\", void 0);\r\n return SpotLight;\r\n}(_shadowLight__WEBPACK_IMPORTED_MODULE_5__[\"ShadowLight\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/Plugins/babylonFileLoader.ts\":\n/*!**********************************************!*\\\n !*** ./Loading/Plugins/babylonFileLoader.ts ***!\n \\**********************************************/\n/*! exports provided: _BabylonLoaderRegistered */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _BabylonLoaderRegistered; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_geometry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/geometry */ \"./Meshes/geometry.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Materials/multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony import */ var _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Materials/Textures/cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Materials/Textures/hdrCubeTexture */ \"./Materials/Textures/hdrCubeTexture.ts\");\n/* harmony import */ var _Animations_animationGroup__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Animations/animationGroup */ \"./Animations/animationGroup.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _assetContainer__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../assetContainer */ \"./assetContainer.ts\");\n/* harmony import */ var _Actions_actionManager__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Actions/actionManager */ \"./Actions/actionManager.ts\");\n/* harmony import */ var _Bones_skeleton__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Bones/skeleton */ \"./Bones/skeleton.ts\");\n/* harmony import */ var _Morph_morphTargetManager__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Morph/morphTargetManager */ \"./Morph/morphTargetManager.ts\");\n/* harmony import */ var _Physics_Plugins_cannonJSPlugin__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../Physics/Plugins/cannonJSPlugin */ \"./Physics/Plugins/cannonJSPlugin.ts\");\n/* harmony import */ var _Physics_Plugins_oimoJSPlugin__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../Physics/Plugins/oimoJSPlugin */ \"./Physics/Plugins/oimoJSPlugin.ts\");\n/* harmony import */ var _Physics_Plugins_ammoJSPlugin__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../Physics/Plugins/ammoJSPlugin */ \"./Physics/Plugins/ammoJSPlugin.ts\");\n/* harmony import */ var _Probes_reflectionProbe__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../Probes/reflectionProbe */ \"./Probes/reflectionProbe.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_stringTools__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../Misc/stringTools */ \"./Misc/stringTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _BabylonLoaderRegistered = true;\r\nvar parseMaterialById = function (id, parsedData, scene, rootUrl) {\r\n for (var index = 0, cache = parsedData.materials.length; index < cache; index++) {\r\n var parsedMaterial = parsedData.materials[index];\r\n if (parsedMaterial.id === id) {\r\n return _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].Parse(parsedMaterial, scene, rootUrl);\r\n }\r\n }\r\n return null;\r\n};\r\nvar isDescendantOf = function (mesh, names, hierarchyIds) {\r\n for (var i in names) {\r\n if (mesh.name === names[i]) {\r\n hierarchyIds.push(mesh.id);\r\n return true;\r\n }\r\n }\r\n if (mesh.parentId && hierarchyIds.indexOf(mesh.parentId) !== -1) {\r\n hierarchyIds.push(mesh.id);\r\n return true;\r\n }\r\n return false;\r\n};\r\nvar logOperation = function (operation, producer) {\r\n return operation + \" of \" + (producer ? producer.file + \" from \" + producer.name + \" version: \" + producer.version + \", exporter version: \" + producer.exporter_version : \"unknown\");\r\n};\r\nvar loadDetailLevels = function (scene, mesh) {\r\n var mastermesh = mesh;\r\n // Every value specified in the ids array of the lod data points to another mesh which should be used as the lower LOD level.\r\n // The distances (or coverages) array values specified are used along with the lod mesh ids as a hint to determine the switching threshold for the various LODs.\r\n if (mesh._waitingData.lods) {\r\n if (mesh._waitingData.lods.ids && mesh._waitingData.lods.ids.length > 0) {\r\n var lodmeshes = mesh._waitingData.lods.ids;\r\n var wasenabled = mastermesh.isEnabled(false);\r\n if (mesh._waitingData.lods.distances) {\r\n var distances = mesh._waitingData.lods.distances;\r\n if (distances.length >= lodmeshes.length) {\r\n var culling = (distances.length > lodmeshes.length) ? distances[distances.length - 1] : 0;\r\n mastermesh.setEnabled(false);\r\n for (var index = 0; index < lodmeshes.length; index++) {\r\n var lodid = lodmeshes[index];\r\n var lodmesh = scene.getMeshByID(lodid);\r\n if (lodmesh != null) {\r\n mastermesh.addLODLevel(distances[index], lodmesh);\r\n }\r\n }\r\n if (culling > 0) {\r\n mastermesh.addLODLevel(culling, null);\r\n }\r\n if (wasenabled === true) {\r\n mastermesh.setEnabled(true);\r\n }\r\n }\r\n else {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_25__[\"Tools\"].Warn(\"Invalid level of detail distances for \" + mesh.name);\r\n }\r\n }\r\n }\r\n mesh._waitingData.lods = null;\r\n }\r\n};\r\nvar loadAssetContainer = function (scene, data, rootUrl, onError, addToScene) {\r\n if (addToScene === void 0) { addToScene = false; }\r\n var container = new _assetContainer__WEBPACK_IMPORTED_MODULE_16__[\"AssetContainer\"](scene);\r\n // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details\r\n // when SceneLoader.debugLogging = true (default), or exception encountered.\r\n // Everything stored in var log instead of writing separate lines to support only writing in exception,\r\n // and avoid problems with multiple concurrent .babylon loads.\r\n var log = \"importScene has failed JSON parse\";\r\n try {\r\n var parsedData = JSON.parse(data);\r\n log = \"\";\r\n var fullDetails = _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel === _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].DETAILED_LOGGING;\r\n var index;\r\n var cache;\r\n // Environment texture\r\n if (parsedData.environmentTexture !== undefined && parsedData.environmentTexture !== null) {\r\n // PBR needed for both HDR texture (gamma space) & a sky box\r\n var isPBR = parsedData.isPBR !== undefined ? parsedData.isPBR : true;\r\n if (parsedData.environmentTextureType && parsedData.environmentTextureType === \"BABYLON.HDRCubeTexture\") {\r\n var hdrSize = (parsedData.environmentTextureSize) ? parsedData.environmentTextureSize : 128;\r\n var hdrTexture = new _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_10__[\"HDRCubeTexture\"]((parsedData.environmentTexture.match(/https?:\\/\\//g) ? \"\" : rootUrl) + parsedData.environmentTexture, scene, hdrSize, true, !isPBR);\r\n if (parsedData.environmentTextureRotationY) {\r\n hdrTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = hdrTexture;\r\n }\r\n else {\r\n if (_Misc_stringTools__WEBPACK_IMPORTED_MODULE_26__[\"StringTools\"].EndsWith(parsedData.environmentTexture, \".env\")) {\r\n var compressedTexture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"]((parsedData.environmentTexture.match(/https?:\\/\\//g) ? \"\" : rootUrl) + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n compressedTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = compressedTexture;\r\n }\r\n else {\r\n var cubeTexture = _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"].CreateFromPrefilteredData((parsedData.environmentTexture.match(/https?:\\/\\//g) ? \"\" : rootUrl) + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n cubeTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = cubeTexture;\r\n }\r\n }\r\n if (parsedData.createDefaultSkybox === true) {\r\n var skyboxScale = (scene.activeCamera !== undefined && scene.activeCamera !== null) ? (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2 : 1000;\r\n var skyboxBlurLevel = parsedData.skyboxBlurLevel || 0;\r\n scene.createDefaultSkybox(scene.environmentTexture, isPBR, skyboxScale, skyboxBlurLevel);\r\n }\r\n container.environmentTexture = scene.environmentTexture;\r\n }\r\n // Environment Intensity\r\n if (parsedData.environmentIntensity !== undefined && parsedData.environmentIntensity !== null) {\r\n scene.environmentIntensity = parsedData.environmentIntensity;\r\n }\r\n // Lights\r\n if (parsedData.lights !== undefined && parsedData.lights !== null) {\r\n for (index = 0, cache = parsedData.lights.length; index < cache; index++) {\r\n var parsedLight = parsedData.lights[index];\r\n var light = _Lights_light__WEBPACK_IMPORTED_MODULE_12__[\"Light\"].Parse(parsedLight, scene);\r\n if (light) {\r\n container.lights.push(light);\r\n log += (index === 0 ? \"\\n\\tLights:\" : \"\");\r\n log += \"\\n\\t\\t\" + light.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Reflection probes\r\n if (parsedData.reflectionProbes !== undefined && parsedData.reflectionProbes !== null) {\r\n for (index = 0, cache = parsedData.reflectionProbes.length; index < cache; index++) {\r\n var parsedReflectionProbe = parsedData.reflectionProbes[index];\r\n var reflectionProbe = _Probes_reflectionProbe__WEBPACK_IMPORTED_MODULE_23__[\"ReflectionProbe\"].Parse(parsedReflectionProbe, scene, rootUrl);\r\n if (reflectionProbe) {\r\n container.reflectionProbes.push(reflectionProbe);\r\n log += (index === 0 ? \"\\n\\tReflection Probes:\" : \"\");\r\n log += \"\\n\\t\\t\" + reflectionProbe.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Animations\r\n if (parsedData.animations !== undefined && parsedData.animations !== null) {\r\n for (index = 0, cache = parsedData.animations.length; index < cache; index++) {\r\n var parsedAnimation = parsedData.animations[index];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_24__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n var animation = internalClass.Parse(parsedAnimation);\r\n scene.animations.push(animation);\r\n container.animations.push(animation);\r\n log += (index === 0 ? \"\\n\\tAnimations:\" : \"\");\r\n log += \"\\n\\t\\t\" + animation.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Materials\r\n if (parsedData.materials !== undefined && parsedData.materials !== null) {\r\n for (index = 0, cache = parsedData.materials.length; index < cache; index++) {\r\n var parsedMaterial = parsedData.materials[index];\r\n var mat = _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].Parse(parsedMaterial, scene, rootUrl);\r\n if (mat) {\r\n container.materials.push(mat);\r\n log += (index === 0 ? \"\\n\\tMaterials:\" : \"\");\r\n log += \"\\n\\t\\t\" + mat.toString(fullDetails);\r\n // Textures\r\n var textures = mat.getActiveTextures();\r\n textures.forEach(function (t) {\r\n if (container.textures.indexOf(t) == -1) {\r\n container.textures.push(t);\r\n }\r\n });\r\n }\r\n }\r\n }\r\n if (parsedData.multiMaterials !== undefined && parsedData.multiMaterials !== null) {\r\n for (index = 0, cache = parsedData.multiMaterials.length; index < cache; index++) {\r\n var parsedMultiMaterial = parsedData.multiMaterials[index];\r\n var mmat = _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_8__[\"MultiMaterial\"].ParseMultiMaterial(parsedMultiMaterial, scene);\r\n container.multiMaterials.push(mmat);\r\n log += (index === 0 ? \"\\n\\tMultiMaterials:\" : \"\");\r\n log += \"\\n\\t\\t\" + mmat.toString(fullDetails);\r\n // Textures\r\n var textures = mmat.getActiveTextures();\r\n textures.forEach(function (t) {\r\n if (container.textures.indexOf(t) == -1) {\r\n container.textures.push(t);\r\n }\r\n });\r\n }\r\n }\r\n // Morph targets\r\n if (parsedData.morphTargetManagers !== undefined && parsedData.morphTargetManagers !== null) {\r\n for (var _i = 0, _a = parsedData.morphTargetManagers; _i < _a.length; _i++) {\r\n var managerData = _a[_i];\r\n container.morphTargetManagers.push(_Morph_morphTargetManager__WEBPACK_IMPORTED_MODULE_19__[\"MorphTargetManager\"].Parse(managerData, scene));\r\n }\r\n }\r\n // Skeletons\r\n if (parsedData.skeletons !== undefined && parsedData.skeletons !== null) {\r\n for (index = 0, cache = parsedData.skeletons.length; index < cache; index++) {\r\n var parsedSkeleton = parsedData.skeletons[index];\r\n var skeleton = _Bones_skeleton__WEBPACK_IMPORTED_MODULE_18__[\"Skeleton\"].Parse(parsedSkeleton, scene);\r\n container.skeletons.push(skeleton);\r\n log += (index === 0 ? \"\\n\\tSkeletons:\" : \"\");\r\n log += \"\\n\\t\\t\" + skeleton.toString(fullDetails);\r\n }\r\n }\r\n // Geometries\r\n var geometries = parsedData.geometries;\r\n if (geometries !== undefined && geometries !== null) {\r\n var addedGeometry = new Array();\r\n // VertexData\r\n var vertexData = geometries.vertexData;\r\n if (vertexData !== undefined && vertexData !== null) {\r\n for (index = 0, cache = vertexData.length; index < cache; index++) {\r\n var parsedVertexData = vertexData[index];\r\n addedGeometry.push(_Meshes_geometry__WEBPACK_IMPORTED_MODULE_5__[\"Geometry\"].Parse(parsedVertexData, scene, rootUrl));\r\n }\r\n }\r\n addedGeometry.forEach(function (g) {\r\n if (g) {\r\n container.geometries.push(g);\r\n }\r\n });\r\n }\r\n // Transform nodes\r\n if (parsedData.transformNodes !== undefined && parsedData.transformNodes !== null) {\r\n for (index = 0, cache = parsedData.transformNodes.length; index < cache; index++) {\r\n var parsedTransformNode = parsedData.transformNodes[index];\r\n var node = _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_6__[\"TransformNode\"].Parse(parsedTransformNode, scene, rootUrl);\r\n container.transformNodes.push(node);\r\n }\r\n }\r\n // Meshes\r\n if (parsedData.meshes !== undefined && parsedData.meshes !== null) {\r\n for (index = 0, cache = parsedData.meshes.length; index < cache; index++) {\r\n var parsedMesh = parsedData.meshes[index];\r\n var mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].Parse(parsedMesh, scene, rootUrl);\r\n container.meshes.push(mesh);\r\n log += (index === 0 ? \"\\n\\tMeshes:\" : \"\");\r\n log += \"\\n\\t\\t\" + mesh.toString(fullDetails);\r\n }\r\n }\r\n // Cameras\r\n if (parsedData.cameras !== undefined && parsedData.cameras !== null) {\r\n for (index = 0, cache = parsedData.cameras.length; index < cache; index++) {\r\n var parsedCamera = parsedData.cameras[index];\r\n var camera = _Cameras_camera__WEBPACK_IMPORTED_MODULE_1__[\"Camera\"].Parse(parsedCamera, scene);\r\n container.cameras.push(camera);\r\n log += (index === 0 ? \"\\n\\tCameras:\" : \"\");\r\n log += \"\\n\\t\\t\" + camera.toString(fullDetails);\r\n }\r\n }\r\n // Animation Groups\r\n if (parsedData.animationGroups !== undefined && parsedData.animationGroups !== null) {\r\n for (index = 0, cache = parsedData.animationGroups.length; index < cache; index++) {\r\n var parsedAnimationGroup = parsedData.animationGroups[index];\r\n var animationGroup = _Animations_animationGroup__WEBPACK_IMPORTED_MODULE_11__[\"AnimationGroup\"].Parse(parsedAnimationGroup, scene);\r\n container.animationGroups.push(animationGroup);\r\n log += (index === 0 ? \"\\n\\tAnimationGroups:\" : \"\");\r\n log += \"\\n\\t\\t\" + animationGroup.toString(fullDetails);\r\n }\r\n }\r\n // Browsing all the graph to connect the dots\r\n for (index = 0, cache = scene.cameras.length; index < cache; index++) {\r\n var camera = scene.cameras[index];\r\n if (camera._waitingParentId) {\r\n camera.parent = scene.getLastEntryByID(camera._waitingParentId);\r\n camera._waitingParentId = null;\r\n }\r\n }\r\n for (index = 0, cache = scene.lights.length; index < cache; index++) {\r\n var light_1 = scene.lights[index];\r\n if (light_1 && light_1._waitingParentId) {\r\n light_1.parent = scene.getLastEntryByID(light_1._waitingParentId);\r\n light_1._waitingParentId = null;\r\n }\r\n }\r\n // Connect parents & children and parse actions and lods\r\n for (index = 0, cache = scene.transformNodes.length; index < cache; index++) {\r\n var transformNode = scene.transformNodes[index];\r\n if (transformNode._waitingParentId) {\r\n transformNode.parent = scene.getLastEntryByID(transformNode._waitingParentId);\r\n transformNode._waitingParentId = null;\r\n }\r\n }\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n var mesh = scene.meshes[index];\r\n if (mesh._waitingParentId) {\r\n mesh.parent = scene.getLastEntryByID(mesh._waitingParentId);\r\n mesh._waitingParentId = null;\r\n }\r\n if (mesh._waitingData.lods) {\r\n loadDetailLevels(scene, mesh);\r\n }\r\n }\r\n // link skeleton transform nodes\r\n for (index = 0, cache = scene.skeletons.length; index < cache; index++) {\r\n var skeleton = scene.skeletons[index];\r\n if (skeleton._hasWaitingData) {\r\n if (skeleton.bones != null) {\r\n skeleton.bones.forEach(function (bone) {\r\n if (bone._waitingTransformNodeId) {\r\n var linkTransformNode = scene.getLastEntryByID(bone._waitingTransformNodeId);\r\n if (linkTransformNode) {\r\n bone.linkTransformNode(linkTransformNode);\r\n }\r\n bone._waitingTransformNodeId = null;\r\n }\r\n });\r\n }\r\n skeleton._hasWaitingData = null;\r\n }\r\n }\r\n // freeze world matrix application\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n var currentMesh = scene.meshes[index];\r\n if (currentMesh._waitingData.freezeWorldMatrix) {\r\n currentMesh.freezeWorldMatrix();\r\n currentMesh._waitingData.freezeWorldMatrix = null;\r\n }\r\n else {\r\n currentMesh.computeWorldMatrix(true);\r\n }\r\n }\r\n // Lights exclusions / inclusions\r\n for (index = 0, cache = scene.lights.length; index < cache; index++) {\r\n var light_2 = scene.lights[index];\r\n // Excluded check\r\n if (light_2._excludedMeshesIds.length > 0) {\r\n for (var excludedIndex = 0; excludedIndex < light_2._excludedMeshesIds.length; excludedIndex++) {\r\n var excludedMesh = scene.getMeshByID(light_2._excludedMeshesIds[excludedIndex]);\r\n if (excludedMesh) {\r\n light_2.excludedMeshes.push(excludedMesh);\r\n }\r\n }\r\n light_2._excludedMeshesIds = [];\r\n }\r\n // Included check\r\n if (light_2._includedOnlyMeshesIds.length > 0) {\r\n for (var includedOnlyIndex = 0; includedOnlyIndex < light_2._includedOnlyMeshesIds.length; includedOnlyIndex++) {\r\n var includedOnlyMesh = scene.getMeshByID(light_2._includedOnlyMeshesIds[includedOnlyIndex]);\r\n if (includedOnlyMesh) {\r\n light_2.includedOnlyMeshes.push(includedOnlyMesh);\r\n }\r\n }\r\n light_2._includedOnlyMeshesIds = [];\r\n }\r\n }\r\n _abstractScene__WEBPACK_IMPORTED_MODULE_15__[\"AbstractScene\"].Parse(parsedData, scene, container, rootUrl);\r\n // Actions (scene) Done last as it can access other objects.\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n var mesh = scene.meshes[index];\r\n if (mesh._waitingData.actions) {\r\n _Actions_actionManager__WEBPACK_IMPORTED_MODULE_17__[\"ActionManager\"].Parse(mesh._waitingData.actions, mesh, scene);\r\n mesh._waitingData.actions = null;\r\n }\r\n }\r\n if (parsedData.actions !== undefined && parsedData.actions !== null) {\r\n _Actions_actionManager__WEBPACK_IMPORTED_MODULE_17__[\"ActionManager\"].Parse(parsedData.actions, null, scene);\r\n }\r\n if (!addToScene) {\r\n container.removeAllFromScene();\r\n }\r\n }\r\n catch (err) {\r\n var msg = logOperation(\"loadAssets\", parsedData ? parsedData.producer : \"Unknown\") + log;\r\n if (onError) {\r\n onError(msg, err);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(msg);\r\n throw err;\r\n }\r\n }\r\n finally {\r\n if (log !== null && _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].NO_LOGGING) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(logOperation(\"loadAssets\", parsedData ? parsedData.producer : \"Unknown\") + (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].MINIMAL_LOGGING ? log : \"\"));\r\n }\r\n }\r\n return container;\r\n};\r\n_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].RegisterPlugin({\r\n name: \"babylon.js\",\r\n extensions: \".babylon\",\r\n canDirectLoad: function (data) {\r\n if (data.indexOf(\"babylon\") !== -1) { // We consider that the producer string is filled\r\n return true;\r\n }\r\n return false;\r\n },\r\n importMesh: function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons, onError) {\r\n // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details\r\n // when SceneLoader.debugLogging = true (default), or exception encountered.\r\n // Everything stored in var log instead of writing separate lines to support only writing in exception,\r\n // and avoid problems with multiple concurrent .babylon loads.\r\n var log = \"importMesh has failed JSON parse\";\r\n try {\r\n var parsedData = JSON.parse(data);\r\n log = \"\";\r\n var fullDetails = _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel === _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].DETAILED_LOGGING;\r\n if (!meshesNames) {\r\n meshesNames = null;\r\n }\r\n else if (!Array.isArray(meshesNames)) {\r\n meshesNames = [meshesNames];\r\n }\r\n var hierarchyIds = new Array();\r\n if (parsedData.meshes !== undefined && parsedData.meshes !== null) {\r\n var loadedSkeletonsIds = [];\r\n var loadedMaterialsIds = [];\r\n var index;\r\n var cache;\r\n for (index = 0, cache = parsedData.meshes.length; index < cache; index++) {\r\n var parsedMesh = parsedData.meshes[index];\r\n if (meshesNames === null || isDescendantOf(parsedMesh, meshesNames, hierarchyIds)) {\r\n if (meshesNames !== null) {\r\n // Remove found mesh name from list.\r\n delete meshesNames[meshesNames.indexOf(parsedMesh.name)];\r\n }\r\n //Geometry?\r\n if (parsedMesh.geometryId !== undefined && parsedMesh.geometryId !== null) {\r\n //does the file contain geometries?\r\n if (parsedData.geometries !== undefined && parsedData.geometries !== null) {\r\n //find the correct geometry and add it to the scene\r\n var found = false;\r\n [\"boxes\", \"spheres\", \"cylinders\", \"toruses\", \"grounds\", \"planes\", \"torusKnots\", \"vertexData\"].forEach(function (geometryType) {\r\n if (found === true || !parsedData.geometries[geometryType] || !(Array.isArray(parsedData.geometries[geometryType]))) {\r\n return;\r\n }\r\n else {\r\n parsedData.geometries[geometryType].forEach(function (parsedGeometryData) {\r\n if (parsedGeometryData.id === parsedMesh.geometryId) {\r\n switch (geometryType) {\r\n case \"vertexData\":\r\n _Meshes_geometry__WEBPACK_IMPORTED_MODULE_5__[\"Geometry\"].Parse(parsedGeometryData, scene, rootUrl);\r\n break;\r\n }\r\n found = true;\r\n }\r\n });\r\n }\r\n });\r\n if (found === false) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Geometry not found for mesh \" + parsedMesh.id);\r\n }\r\n }\r\n }\r\n // Material ?\r\n if (parsedMesh.materialId) {\r\n var materialFound = (loadedMaterialsIds.indexOf(parsedMesh.materialId) !== -1);\r\n if (materialFound === false && parsedData.multiMaterials !== undefined && parsedData.multiMaterials !== null) {\r\n for (var multimatIndex = 0, multimatCache = parsedData.multiMaterials.length; multimatIndex < multimatCache; multimatIndex++) {\r\n var parsedMultiMaterial = parsedData.multiMaterials[multimatIndex];\r\n if (parsedMultiMaterial.id === parsedMesh.materialId) {\r\n for (var matIndex = 0, matCache = parsedMultiMaterial.materials.length; matIndex < matCache; matIndex++) {\r\n var subMatId = parsedMultiMaterial.materials[matIndex];\r\n loadedMaterialsIds.push(subMatId);\r\n var mat = parseMaterialById(subMatId, parsedData, scene, rootUrl);\r\n if (mat) {\r\n log += \"\\n\\tMaterial \" + mat.toString(fullDetails);\r\n }\r\n }\r\n loadedMaterialsIds.push(parsedMultiMaterial.id);\r\n var mmat = _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_8__[\"MultiMaterial\"].ParseMultiMaterial(parsedMultiMaterial, scene);\r\n if (mmat) {\r\n materialFound = true;\r\n log += \"\\n\\tMulti-Material \" + mmat.toString(fullDetails);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n if (materialFound === false) {\r\n loadedMaterialsIds.push(parsedMesh.materialId);\r\n var mat = parseMaterialById(parsedMesh.materialId, parsedData, scene, rootUrl);\r\n if (!mat) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Material not found for mesh \" + parsedMesh.id);\r\n }\r\n else {\r\n log += \"\\n\\tMaterial \" + mat.toString(fullDetails);\r\n }\r\n }\r\n }\r\n // Skeleton ?\r\n if (parsedMesh.skeletonId > -1 && parsedData.skeletons !== undefined && parsedData.skeletons !== null) {\r\n var skeletonAlreadyLoaded = (loadedSkeletonsIds.indexOf(parsedMesh.skeletonId) > -1);\r\n if (skeletonAlreadyLoaded === false) {\r\n for (var skeletonIndex = 0, skeletonCache = parsedData.skeletons.length; skeletonIndex < skeletonCache; skeletonIndex++) {\r\n var parsedSkeleton = parsedData.skeletons[skeletonIndex];\r\n if (parsedSkeleton.id === parsedMesh.skeletonId) {\r\n var skeleton = _Bones_skeleton__WEBPACK_IMPORTED_MODULE_18__[\"Skeleton\"].Parse(parsedSkeleton, scene);\r\n skeletons.push(skeleton);\r\n loadedSkeletonsIds.push(parsedSkeleton.id);\r\n log += \"\\n\\tSkeleton \" + skeleton.toString(fullDetails);\r\n }\r\n }\r\n }\r\n }\r\n // Morph targets ?\r\n if (parsedData.morphTargetManagers !== undefined && parsedData.morphTargetManagers !== null) {\r\n for (var _i = 0, _a = parsedData.morphTargetManagers; _i < _a.length; _i++) {\r\n var managerData = _a[_i];\r\n _Morph_morphTargetManager__WEBPACK_IMPORTED_MODULE_19__[\"MorphTargetManager\"].Parse(managerData, scene);\r\n }\r\n }\r\n var mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"].Parse(parsedMesh, scene, rootUrl);\r\n meshes.push(mesh);\r\n log += \"\\n\\tMesh \" + mesh.toString(fullDetails);\r\n }\r\n }\r\n // Connecting parents and lods\r\n var currentMesh;\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n currentMesh = scene.meshes[index];\r\n if (currentMesh._waitingParentId) {\r\n currentMesh.parent = scene.getLastEntryByID(currentMesh._waitingParentId);\r\n currentMesh._waitingParentId = null;\r\n }\r\n if (currentMesh._waitingData.lods) {\r\n loadDetailLevels(scene, currentMesh);\r\n }\r\n }\r\n // link skeleton transform nodes\r\n for (index = 0, cache = scene.skeletons.length; index < cache; index++) {\r\n var skeleton = scene.skeletons[index];\r\n if (skeleton._hasWaitingData) {\r\n if (skeleton.bones != null) {\r\n skeleton.bones.forEach(function (bone) {\r\n if (bone._waitingTransformNodeId) {\r\n var linkTransformNode = scene.getLastEntryByID(bone._waitingTransformNodeId);\r\n if (linkTransformNode) {\r\n bone.linkTransformNode(linkTransformNode);\r\n }\r\n bone._waitingTransformNodeId = null;\r\n }\r\n });\r\n }\r\n skeleton._hasWaitingData = null;\r\n }\r\n }\r\n // freeze and compute world matrix application\r\n for (index = 0, cache = scene.meshes.length; index < cache; index++) {\r\n currentMesh = scene.meshes[index];\r\n if (currentMesh._waitingData.freezeWorldMatrix) {\r\n currentMesh.freezeWorldMatrix();\r\n currentMesh._waitingData.freezeWorldMatrix = null;\r\n }\r\n else {\r\n currentMesh.computeWorldMatrix(true);\r\n }\r\n }\r\n }\r\n // Particles\r\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\r\n var parser = _abstractScene__WEBPACK_IMPORTED_MODULE_15__[\"AbstractScene\"].GetIndividualParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_13__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM);\r\n if (parser) {\r\n for (index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\r\n var parsedParticleSystem = parsedData.particleSystems[index];\r\n if (hierarchyIds.indexOf(parsedParticleSystem.emitterId) !== -1) {\r\n particleSystems.push(parser(parsedParticleSystem, scene, rootUrl));\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n catch (err) {\r\n var msg = logOperation(\"importMesh\", parsedData ? parsedData.producer : \"Unknown\") + log;\r\n if (onError) {\r\n onError(msg, err);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(msg);\r\n throw err;\r\n }\r\n }\r\n finally {\r\n if (log !== null && _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].NO_LOGGING) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(logOperation(\"importMesh\", parsedData ? parsedData.producer : \"Unknown\") + (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].MINIMAL_LOGGING ? log : \"\"));\r\n }\r\n }\r\n return false;\r\n },\r\n load: function (scene, data, rootUrl, onError) {\r\n // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details\r\n // when SceneLoader.debugLogging = true (default), or exception encountered.\r\n // Everything stored in var log instead of writing separate lines to support only writing in exception,\r\n // and avoid problems with multiple concurrent .babylon loads.\r\n var log = \"importScene has failed JSON parse\";\r\n try {\r\n var parsedData = JSON.parse(data);\r\n log = \"\";\r\n // Scene\r\n if (parsedData.useDelayedTextureLoading !== undefined && parsedData.useDelayedTextureLoading !== null) {\r\n scene.useDelayedTextureLoading = parsedData.useDelayedTextureLoading && !_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].ForceFullSceneLoadingForIncremental;\r\n }\r\n if (parsedData.autoClear !== undefined && parsedData.autoClear !== null) {\r\n scene.autoClear = parsedData.autoClear;\r\n }\r\n if (parsedData.clearColor !== undefined && parsedData.clearColor !== null) {\r\n scene.clearColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"].FromArray(parsedData.clearColor);\r\n }\r\n if (parsedData.ambientColor !== undefined && parsedData.ambientColor !== null) {\r\n scene.ambientColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].FromArray(parsedData.ambientColor);\r\n }\r\n if (parsedData.gravity !== undefined && parsedData.gravity !== null) {\r\n scene.gravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedData.gravity);\r\n }\r\n // Fog\r\n if (parsedData.fogMode && parsedData.fogMode !== 0) {\r\n scene.fogMode = parsedData.fogMode;\r\n scene.fogColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].FromArray(parsedData.fogColor);\r\n scene.fogStart = parsedData.fogStart;\r\n scene.fogEnd = parsedData.fogEnd;\r\n scene.fogDensity = parsedData.fogDensity;\r\n log += \"\\tFog mode for scene: \";\r\n switch (scene.fogMode) {\r\n // getters not compiling, so using hardcoded\r\n case 1:\r\n log += \"exp\\n\";\r\n break;\r\n case 2:\r\n log += \"exp2\\n\";\r\n break;\r\n case 3:\r\n log += \"linear\\n\";\r\n break;\r\n }\r\n }\r\n //Physics\r\n if (parsedData.physicsEnabled) {\r\n var physicsPlugin;\r\n if (parsedData.physicsEngine === \"cannon\") {\r\n physicsPlugin = new _Physics_Plugins_cannonJSPlugin__WEBPACK_IMPORTED_MODULE_20__[\"CannonJSPlugin\"]();\r\n }\r\n else if (parsedData.physicsEngine === \"oimo\") {\r\n physicsPlugin = new _Physics_Plugins_oimoJSPlugin__WEBPACK_IMPORTED_MODULE_21__[\"OimoJSPlugin\"]();\r\n }\r\n else if (parsedData.physicsEngine === \"ammo\") {\r\n physicsPlugin = new _Physics_Plugins_ammoJSPlugin__WEBPACK_IMPORTED_MODULE_22__[\"AmmoJSPlugin\"]();\r\n }\r\n log = \"\\tPhysics engine \" + (parsedData.physicsEngine ? parsedData.physicsEngine : \"oimo\") + \" enabled\\n\";\r\n //else - default engine, which is currently oimo\r\n var physicsGravity = parsedData.physicsGravity ? _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(parsedData.physicsGravity) : null;\r\n scene.enablePhysics(physicsGravity, physicsPlugin);\r\n }\r\n // Metadata\r\n if (parsedData.metadata !== undefined && parsedData.metadata !== null) {\r\n scene.metadata = parsedData.metadata;\r\n }\r\n //collisions, if defined. otherwise, default is true\r\n if (parsedData.collisionsEnabled !== undefined && parsedData.collisionsEnabled !== null) {\r\n scene.collisionsEnabled = parsedData.collisionsEnabled;\r\n }\r\n var container = loadAssetContainer(scene, data, rootUrl, onError, true);\r\n if (!container) {\r\n return false;\r\n }\r\n if (parsedData.autoAnimate) {\r\n scene.beginAnimation(scene, parsedData.autoAnimateFrom, parsedData.autoAnimateTo, parsedData.autoAnimateLoop, parsedData.autoAnimateSpeed || 1.0);\r\n }\r\n if (parsedData.activeCameraID !== undefined && parsedData.activeCameraID !== null) {\r\n scene.setActiveCameraByID(parsedData.activeCameraID);\r\n }\r\n // Environment texture\r\n if (parsedData.environmentTexture !== undefined && parsedData.environmentTexture !== null) {\r\n // PBR needed for both HDR texture (gamma space) & a sky box\r\n var isPBR = parsedData.isPBR !== undefined ? parsedData.isPBR : true;\r\n if (parsedData.environmentTextureType && parsedData.environmentTextureType === \"BABYLON.HDRCubeTexture\") {\r\n var hdrSize = (parsedData.environmentTextureSize) ? parsedData.environmentTextureSize : 128;\r\n var hdrTexture = new _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_10__[\"HDRCubeTexture\"](rootUrl + parsedData.environmentTexture, scene, hdrSize, true, !isPBR);\r\n if (parsedData.environmentTextureRotationY) {\r\n hdrTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = hdrTexture;\r\n }\r\n else {\r\n if (_Misc_stringTools__WEBPACK_IMPORTED_MODULE_26__[\"StringTools\"].EndsWith(parsedData.environmentTexture, \".env\")) {\r\n var compressedTexture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"](rootUrl + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n compressedTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = compressedTexture;\r\n }\r\n else {\r\n var cubeTexture = _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_9__[\"CubeTexture\"].CreateFromPrefilteredData(rootUrl + parsedData.environmentTexture, scene);\r\n if (parsedData.environmentTextureRotationY) {\r\n cubeTexture.rotationY = parsedData.environmentTextureRotationY;\r\n }\r\n scene.environmentTexture = cubeTexture;\r\n }\r\n }\r\n if (parsedData.createDefaultSkybox === true) {\r\n var skyboxScale = (scene.activeCamera !== undefined && scene.activeCamera !== null) ? (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2 : 1000;\r\n var skyboxBlurLevel = parsedData.skyboxBlurLevel || 0;\r\n scene.createDefaultSkybox(scene.environmentTexture, isPBR, skyboxScale, skyboxBlurLevel);\r\n }\r\n }\r\n // Finish\r\n return true;\r\n }\r\n catch (err) {\r\n var msg = logOperation(\"importScene\", parsedData ? parsedData.producer : \"Unknown\") + log;\r\n if (onError) {\r\n onError(msg, err);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(msg);\r\n throw err;\r\n }\r\n }\r\n finally {\r\n if (log !== null && _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].NO_LOGGING) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Log(logOperation(\"importScene\", parsedData ? parsedData.producer : \"Unknown\") + (_Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].loggingLevel !== _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_14__[\"SceneLoader\"].MINIMAL_LOGGING ? log : \"\"));\r\n }\r\n }\r\n return false;\r\n },\r\n loadAssetContainer: function (scene, data, rootUrl, onError) {\r\n var container = loadAssetContainer(scene, data, rootUrl, onError);\r\n return container;\r\n }\r\n});\r\n\n\n/***/ }),\n\n/***/ \"./Loading/Plugins/index.ts\":\n/*!**********************************!*\\\n !*** ./Loading/Plugins/index.ts ***!\n \\**********************************/\n/*! exports provided: _BabylonLoaderRegistered */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babylonFileLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./babylonFileLoader */ \"./Loading/Plugins/babylonFileLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _babylonFileLoader__WEBPACK_IMPORTED_MODULE_0__[\"_BabylonLoaderRegistered\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/index.ts\":\n/*!**************************!*\\\n !*** ./Loading/index.ts ***!\n \\**************************/\n/*! exports provided: DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, _BabylonLoaderRegistered */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _loadingScreen__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./loadingScreen */ \"./Loading/loadingScreen.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return _loadingScreen__WEBPACK_IMPORTED_MODULE_0__[\"DefaultLoadingScreen\"]; });\n\n/* harmony import */ var _Plugins_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Plugins/index */ \"./Loading/Plugins/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_1__[\"_BabylonLoaderRegistered\"]; });\n\n/* harmony import */ var _sceneLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return _sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoaderProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return _sceneLoader__WEBPACK_IMPORTED_MODULE_2__[\"SceneLoader\"]; });\n\n/* harmony import */ var _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_3__[\"SceneLoaderFlags\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/loadingScreen.ts\":\n/*!**********************************!*\\\n !*** ./Loading/loadingScreen.ts ***!\n \\**********************************/\n/*! exports provided: DefaultLoadingScreen */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return DefaultLoadingScreen; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n/**\r\n * Class used for the default loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\nvar DefaultLoadingScreen = /** @class */ (function () {\r\n /**\r\n * Creates a new default loading screen\r\n * @param _renderingCanvas defines the canvas used to render the scene\r\n * @param _loadingText defines the default text to display\r\n * @param _loadingDivBackgroundColor defines the default background color\r\n */\r\n function DefaultLoadingScreen(_renderingCanvas, _loadingText, _loadingDivBackgroundColor) {\r\n var _this = this;\r\n if (_loadingText === void 0) { _loadingText = \"\"; }\r\n if (_loadingDivBackgroundColor === void 0) { _loadingDivBackgroundColor = \"black\"; }\r\n this._renderingCanvas = _renderingCanvas;\r\n this._loadingText = _loadingText;\r\n this._loadingDivBackgroundColor = _loadingDivBackgroundColor;\r\n // Resize\r\n this._resizeLoadingUI = function () {\r\n var canvasRect = _this._renderingCanvas.getBoundingClientRect();\r\n var canvasPositioning = window.getComputedStyle(_this._renderingCanvas).position;\r\n if (!_this._loadingDiv) {\r\n return;\r\n }\r\n _this._loadingDiv.style.position = (canvasPositioning === \"fixed\") ? \"fixed\" : \"absolute\";\r\n _this._loadingDiv.style.left = canvasRect.left + \"px\";\r\n _this._loadingDiv.style.top = canvasRect.top + \"px\";\r\n _this._loadingDiv.style.width = canvasRect.width + \"px\";\r\n _this._loadingDiv.style.height = canvasRect.height + \"px\";\r\n };\r\n }\r\n /**\r\n * Function called to display the loading screen\r\n */\r\n DefaultLoadingScreen.prototype.displayLoadingUI = function () {\r\n if (this._loadingDiv) {\r\n // Do not add a loading screen if there is already one\r\n return;\r\n }\r\n this._loadingDiv = document.createElement(\"div\");\r\n this._loadingDiv.id = \"babylonjsLoadingDiv\";\r\n this._loadingDiv.style.opacity = \"0\";\r\n this._loadingDiv.style.transition = \"opacity 1.5s ease\";\r\n this._loadingDiv.style.pointerEvents = \"none\";\r\n // Loading text\r\n this._loadingTextDiv = document.createElement(\"div\");\r\n this._loadingTextDiv.style.position = \"absolute\";\r\n this._loadingTextDiv.style.left = \"0\";\r\n this._loadingTextDiv.style.top = \"50%\";\r\n this._loadingTextDiv.style.marginTop = \"80px\";\r\n this._loadingTextDiv.style.width = \"100%\";\r\n this._loadingTextDiv.style.height = \"20px\";\r\n this._loadingTextDiv.style.fontFamily = \"Arial\";\r\n this._loadingTextDiv.style.fontSize = \"14px\";\r\n this._loadingTextDiv.style.color = \"white\";\r\n this._loadingTextDiv.style.textAlign = \"center\";\r\n this._loadingTextDiv.innerHTML = \"Loading\";\r\n this._loadingDiv.appendChild(this._loadingTextDiv);\r\n //set the predefined text\r\n this._loadingTextDiv.innerHTML = this._loadingText;\r\n // Generating keyframes\r\n var style = document.createElement('style');\r\n style.type = 'text/css';\r\n var keyFrames = \"@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}\\n 100% { -webkit-transform: rotate(360deg);}\\n } @keyframes spin1 { 0% { transform: rotate(0deg);}\\n 100% { transform: rotate(360deg);}\\n }\";\r\n style.innerHTML = keyFrames;\r\n document.getElementsByTagName('head')[0].appendChild(style);\r\n // Loading img\r\n var imgBack = new Image();\r\n if (!DefaultLoadingScreen.DefaultLogoUrl) {\r\n imgBack.src = \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+\";\r\n }\r\n else {\r\n imgBack.src = DefaultLoadingScreen.DefaultLogoUrl;\r\n }\r\n imgBack.style.position = \"absolute\";\r\n imgBack.style.left = \"40%\";\r\n imgBack.style.top = \"40%\";\r\n imgBack.style.width = \"20%\";\r\n imgBack.style.height = \"20%\";\r\n // Loading spinner\r\n var imgSpinner = new Image();\r\n if (!DefaultLoadingScreen.DefaultSpinnerUrl) {\r\n imgSpinner.src = \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==\";\r\n }\r\n else {\r\n imgSpinner.src = DefaultLoadingScreen.DefaultSpinnerUrl;\r\n }\r\n imgSpinner.style.position = \"absolute\";\r\n imgSpinner.style.left = \"30%\";\r\n imgSpinner.style.top = \"30%\";\r\n imgSpinner.style.width = \"40%\";\r\n imgSpinner.style.height = \"40%\";\r\n imgSpinner.style.animation = \"spin1 0.75s infinite linear\";\r\n imgSpinner.style.webkitAnimation = \"spin1 0.75s infinite linear\";\r\n imgSpinner.style.transformOrigin = \"50% 50%\";\r\n imgSpinner.style.webkitTransformOrigin = \"50% 50%\";\r\n this._loadingDiv.appendChild(imgBack);\r\n this._loadingDiv.appendChild(imgSpinner);\r\n this._resizeLoadingUI();\r\n window.addEventListener(\"resize\", this._resizeLoadingUI);\r\n this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n document.body.appendChild(this._loadingDiv);\r\n this._loadingDiv.style.opacity = \"1\";\r\n };\r\n /**\r\n * Function called to hide the loading screen\r\n */\r\n DefaultLoadingScreen.prototype.hideLoadingUI = function () {\r\n var _this = this;\r\n if (!this._loadingDiv) {\r\n return;\r\n }\r\n var onTransitionEnd = function () {\r\n if (!_this._loadingDiv) {\r\n return;\r\n }\r\n if (_this._loadingDiv.parentElement) {\r\n _this._loadingDiv.parentElement.removeChild(_this._loadingDiv);\r\n }\r\n window.removeEventListener(\"resize\", _this._resizeLoadingUI);\r\n _this._loadingDiv = null;\r\n };\r\n this._loadingDiv.style.opacity = \"0\";\r\n this._loadingDiv.addEventListener(\"transitionend\", onTransitionEnd);\r\n };\r\n Object.defineProperty(DefaultLoadingScreen.prototype, \"loadingUIText\", {\r\n get: function () {\r\n return this._loadingText;\r\n },\r\n /**\r\n * Gets or sets the text to display while loading\r\n */\r\n set: function (text) {\r\n this._loadingText = text;\r\n if (this._loadingTextDiv) {\r\n this._loadingTextDiv.innerHTML = this._loadingText;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultLoadingScreen.prototype, \"loadingUIBackgroundColor\", {\r\n /**\r\n * Gets or sets the color to use for the background\r\n */\r\n get: function () {\r\n return this._loadingDivBackgroundColor;\r\n },\r\n set: function (color) {\r\n this._loadingDivBackgroundColor = color;\r\n if (!this._loadingDiv) {\r\n return;\r\n }\r\n this._loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Gets or sets the logo url to use for the default loading screen */\r\n DefaultLoadingScreen.DefaultLogoUrl = \"\";\r\n /** Gets or sets the spinner url to use for the default loading screen */\r\n DefaultLoadingScreen.DefaultSpinnerUrl = \"\";\r\n return DefaultLoadingScreen;\r\n}());\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].DefaultLoadingScreenFactory = function (canvas) { return new DefaultLoadingScreen(canvas); };\r\n\n\n/***/ }),\n\n/***/ \"./Loading/sceneLoader.ts\":\n/*!********************************!*\\\n !*** ./Loading/sceneLoader.ts ***!\n \\********************************/\n/*! exports provided: SceneLoaderProgressEvent, SceneLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return SceneLoaderProgressEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return SceneLoader; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_filesInputStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/filesInputStore */ \"./Misc/filesInputStore.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to represent data loading progression\r\n */\r\nvar SceneLoaderProgressEvent = /** @class */ (function () {\r\n /**\r\n * Create a new progress event\r\n * @param lengthComputable defines if data length to load can be evaluated\r\n * @param loaded defines the loaded data length\r\n * @param total defines the data length to load\r\n */\r\n function SceneLoaderProgressEvent(\r\n /** defines if data length to load can be evaluated */\r\n lengthComputable, \r\n /** defines the loaded data length */\r\n loaded, \r\n /** defines the data length to load */\r\n total) {\r\n this.lengthComputable = lengthComputable;\r\n this.loaded = loaded;\r\n this.total = total;\r\n }\r\n /**\r\n * Creates a new SceneLoaderProgressEvent from a ProgressEvent\r\n * @param event defines the source event\r\n * @returns a new SceneLoaderProgressEvent\r\n */\r\n SceneLoaderProgressEvent.FromProgressEvent = function (event) {\r\n return new SceneLoaderProgressEvent(event.lengthComputable, event.loaded, event.total);\r\n };\r\n return SceneLoaderProgressEvent;\r\n}());\r\n\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see http://doc.babylonjs.com/how_to/load_from_any_file_type\r\n */\r\nvar SceneLoader = /** @class */ (function () {\r\n function SceneLoader() {\r\n }\r\n Object.defineProperty(SceneLoader, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].ShowLoadingScreen = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].loggingLevel;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].loggingLevel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n _sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_8__[\"SceneLoaderFlags\"].CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SceneLoader._getDefaultPlugin = function () {\r\n return SceneLoader._registeredPlugins[\".babylon\"];\r\n };\r\n SceneLoader._getPluginForExtension = function (extension) {\r\n var registeredPlugin = SceneLoader._registeredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Warn(\"Unable to find a plugin to load \" + extension + \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type\");\r\n return SceneLoader._getDefaultPlugin();\r\n };\r\n SceneLoader._getPluginForDirectLoad = function (data) {\r\n for (var extension in SceneLoader._registeredPlugins) {\r\n var plugin = SceneLoader._registeredPlugins[extension].plugin;\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return SceneLoader._registeredPlugins[extension];\r\n }\r\n }\r\n return SceneLoader._getDefaultPlugin();\r\n };\r\n SceneLoader._getPluginForFilename = function (sceneFilename) {\r\n var queryStringPosition = sceneFilename.indexOf(\"?\");\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n var dotPosition = sceneFilename.lastIndexOf(\".\");\r\n var extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n return SceneLoader._getPluginForExtension(extension);\r\n };\r\n // use babylon file loader directly if sceneFilename is prefixed with \"data:\"\r\n SceneLoader._getDirectLoad = function (sceneFilename) {\r\n if (sceneFilename.substr(0, 5) === \"data:\") {\r\n return sceneFilename.substr(5);\r\n }\r\n return null;\r\n };\r\n SceneLoader._loadData = function (fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension) {\r\n var directLoad = SceneLoader._getDirectLoad(fileInfo.name);\r\n var registeredPlugin = pluginExtension ? SceneLoader._getPluginForExtension(pluginExtension) : (directLoad ? SceneLoader._getPluginForDirectLoad(fileInfo.name) : SceneLoader._getPluginForFilename(fileInfo.name));\r\n var plugin;\r\n if (registeredPlugin.plugin.createPlugin) {\r\n plugin = registeredPlugin.plugin.createPlugin();\r\n }\r\n else {\r\n plugin = registeredPlugin.plugin;\r\n }\r\n if (!plugin) {\r\n throw \"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.\";\r\n }\r\n var useArrayBuffer = registeredPlugin.isBinary;\r\n var offlineProvider;\r\n SceneLoader.OnPluginActivatedObservable.notifyObservers(plugin);\r\n var dataCallback = function (data, responseURL) {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n scene.offlineProvider = offlineProvider;\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n var request = null;\r\n var pluginDisposed = false;\r\n var onDisposeObservable = plugin.onDisposeObservable;\r\n if (onDisposeObservable) {\r\n onDisposeObservable.add(function () {\r\n pluginDisposed = true;\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n onDispose();\r\n });\r\n }\r\n var manifestChecked = function () {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n request = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFile(fileInfo.url, dataCallback, onProgress ? function (event) {\r\n onProgress(SceneLoaderProgressEvent.FromProgressEvent(event));\r\n } : undefined, offlineProvider, useArrayBuffer, function (request, exception) {\r\n onError(\"Failed to load scene.\" + (exception ? \" \" + exception.message : \"\"), exception);\r\n });\r\n };\r\n if (directLoad) {\r\n dataCallback(directLoad);\r\n return plugin;\r\n }\r\n var file = fileInfo.file || _Misc_filesInputStore__WEBPACK_IMPORTED_MODULE_2__[\"FilesInputStore\"].FilesToLoad[fileInfo.name.toLowerCase()];\r\n if (fileInfo.rootUrl.indexOf(\"file:\") === -1 || (fileInfo.rootUrl.indexOf(\"file:\") !== -1 && !file)) {\r\n var engine = scene.getEngine();\r\n var canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n var exceptionFound = false;\r\n for (var _i = 0, _a = scene.disableOfflineSupportExceptionRules; _i < _a.length; _i++) {\r\n var regex = _a[_i];\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n if (canUseOfflineSupport && _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n offlineProvider = _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n }\r\n else {\r\n manifestChecked();\r\n }\r\n }\r\n // Loading file from disk via input file or drag'n'drop\r\n else {\r\n if (file) {\r\n request = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].ReadFile(file, dataCallback, onProgress, useArrayBuffer);\r\n }\r\n else {\r\n onError(\"Unable to find file named \" + fileInfo.name);\r\n }\r\n }\r\n return plugin;\r\n };\r\n SceneLoader._getFileInfo = function (rootUrl, sceneFilename) {\r\n var url;\r\n var name;\r\n var file = null;\r\n if (!sceneFilename) {\r\n url = rootUrl;\r\n name = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetFilename(rootUrl);\r\n rootUrl = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetFolderPath(rootUrl);\r\n }\r\n else if (sceneFilename.name) {\r\n var sceneFile = sceneFilename;\r\n url = rootUrl + sceneFile.name;\r\n name = sceneFile.name;\r\n file = sceneFile;\r\n }\r\n else {\r\n var filename = sceneFilename;\r\n if (filename.substr(0, 1) === \"/\") {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n url = rootUrl + filename;\r\n name = filename;\r\n }\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file\r\n };\r\n };\r\n // Public functions\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n SceneLoader.GetPluginForExtension = function (extension) {\r\n return SceneLoader._getPluginForExtension(extension).plugin;\r\n };\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n SceneLoader.IsPluginForExtensionAvailable = function (extension) {\r\n return !!SceneLoader._registeredPlugins[extension];\r\n };\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n SceneLoader.RegisterPlugin = function (plugin) {\r\n if (typeof plugin.extensions === \"string\") {\r\n var extension = plugin.extensions;\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false\r\n };\r\n }\r\n else {\r\n var extensions = plugin.extensions;\r\n Object.keys(extensions).forEach(function (extension) {\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary\r\n };\r\n });\r\n }\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._getFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to import meshes from \" + fileInfo.url + \": \" + message;\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n } : undefined;\r\n var successHandler = function (meshes, particleSystems, skeletons, animationGroups) {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._loadData(fileInfo, scene, function (plugin, data, responseURL) {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n if (plugin.importMesh) {\r\n var syncedPlugin = plugin;\r\n var meshes = new Array();\r\n var particleSystems = new Array();\r\n var skeletons = new Array();\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, []);\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (result) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(result.meshes, result.particleSystems, result.skeletons, result.animationGroups);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.ImportMesh(meshNames, rootUrl, sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups) {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups\r\n });\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Load = function (rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedEngine; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!engine) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].Error(\"No engine available\");\r\n return null;\r\n }\r\n return SceneLoader.Append(rootUrl, sceneFilename, new _scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"](engine), onSuccess, onProgress, onError, pluginExtension);\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded scene\r\n */\r\n SceneLoader.LoadAsync = function (rootUrl, sceneFilename, engine, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedEngine; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Load(rootUrl, sceneFilename, engine, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._getFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n if (SceneLoader.ShowLoadingScreen) {\r\n scene.getEngine().displayLoadingUI();\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n scene.getEngine().hideLoadingUI();\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function () {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._loadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.load) {\r\n var syncedPlugin = plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function () {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n if (SceneLoader.ShowLoadingScreen) {\r\n scene.executeWhenReady(function () {\r\n scene.getEngine().hideLoadingUI();\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The given scene\r\n */\r\n SceneLoader.AppendAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Append(rootUrl, sceneFilename, scene, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._getFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load assets from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_6__[\"Logger\"].Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function (assets) {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._loadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.loadAssetContainer) {\r\n var syncedPlugin = plugin;\r\n var assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }\r\n else if (plugin.loadAssetContainerAsync) {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (assetContainer) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n if (SceneLoader.ShowLoadingScreen) {\r\n scene.executeWhenReady(function () {\r\n scene.getEngine().hideLoadingUI();\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded asset container\r\n */\r\n SceneLoader.LoadAssetContainerAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.LoadAssetContainer(rootUrl, sceneFilename, scene, function (assetContainer) {\r\n resolve(assetContainer);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * No logging while loading\r\n */\r\n SceneLoader.NO_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_NO_LOGGING;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n SceneLoader.MINIMAL_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_MINIMAL_LOGGING;\r\n /**\r\n * Summary logging while loading\r\n */\r\n SceneLoader.SUMMARY_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_SUMMARY_LOGGING;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n SceneLoader.DETAILED_LOGGING = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].SCENELOADER_DETAILED_LOGGING;\r\n // Members\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n SceneLoader.OnPluginActivatedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n SceneLoader._registeredPlugins = {};\r\n return SceneLoader;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Loading/sceneLoaderFlags.ts\":\n/*!*************************************!*\\\n !*** ./Loading/sceneLoaderFlags.ts ***!\n \\*************************************/\n/*! exports provided: SceneLoaderFlags */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return SceneLoaderFlags; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n/**\r\n * Class used to represent data loading progression\r\n */\r\nvar SceneLoaderFlags = /** @class */ (function () {\r\n function SceneLoaderFlags() {\r\n }\r\n Object.defineProperty(SceneLoaderFlags, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ShowLoadingScreen = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._loggingLevel;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._loggingLevel = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Flags\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = false;\r\n SceneLoaderFlags._ShowLoadingScreen = true;\r\n SceneLoaderFlags._CleanBoneMatrixWeights = false;\r\n SceneLoaderFlags._loggingLevel = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].SCENELOADER_NO_LOGGING;\r\n return SceneLoaderFlags;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Background/backgroundMaterial.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Background/backgroundMaterial.ts ***!\n \\****************************************************/\n/*! exports provided: BackgroundMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return BackgroundMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Materials/pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Shaders_background_fragment__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Shaders/background.fragment */ \"./Shaders/background.fragment.ts\");\n/* harmony import */ var _Shaders_background_vertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Shaders/background.vertex */ \"./Shaders/background.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Background material defines definition.\r\n * @hidden Mainly internal Use\r\n */\r\nvar BackgroundMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BackgroundMaterialDefines, _super);\r\n /**\r\n * Constructor of the defines.\r\n */\r\n function BackgroundMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * True if the diffuse texture is in use.\r\n */\r\n _this.DIFFUSE = false;\r\n /**\r\n * The direct UV channel to use.\r\n */\r\n _this.DIFFUSEDIRECTUV = 0;\r\n /**\r\n * True if the diffuse texture is in gamma space.\r\n */\r\n _this.GAMMADIFFUSE = false;\r\n /**\r\n * True if the diffuse texture has opacity in the alpha channel.\r\n */\r\n _this.DIFFUSEHASALPHA = false;\r\n /**\r\n * True if you want the material to fade to transparent at grazing angle.\r\n */\r\n _this.OPACITYFRESNEL = false;\r\n /**\r\n * True if an extra blur needs to be added in the reflection.\r\n */\r\n _this.REFLECTIONBLUR = false;\r\n /**\r\n * True if you want the material to fade to reflection at grazing angle.\r\n */\r\n _this.REFLECTIONFRESNEL = false;\r\n /**\r\n * True if you want the material to falloff as far as you move away from the scene center.\r\n */\r\n _this.REFLECTIONFALLOFF = false;\r\n /**\r\n * False if the current Webgl implementation does not support the texture lod extension.\r\n */\r\n _this.TEXTURELODSUPPORT = false;\r\n /**\r\n * True to ensure the data are premultiplied.\r\n */\r\n _this.PREMULTIPLYALPHA = false;\r\n /**\r\n * True if the texture contains cooked RGB values and not gray scaled multipliers.\r\n */\r\n _this.USERGBCOLOR = false;\r\n /**\r\n * True if highlight and shadow levels have been specified. It can help ensuring the main perceived color\r\n * stays aligned with the desired configuration.\r\n */\r\n _this.USEHIGHLIGHTANDSHADOWCOLORS = false;\r\n /**\r\n * True to add noise in order to reduce the banding effect.\r\n */\r\n _this.NOISE = false;\r\n /**\r\n * is the reflection texture in BGR color scheme?\r\n * Mainly used to solve a bug in ios10 video tag\r\n */\r\n _this.REFLECTIONBGR = false;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.MULTIVIEW = false;\r\n // Reflection.\r\n _this.REFLECTION = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.REFLECTIONMAP_OPPOSITEZ = false;\r\n _this.LODINREFLECTIONALPHA = false;\r\n _this.GAMMAREFLECTION = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.EQUIRECTANGULAR_RELFECTION_FOV = false;\r\n // Default BJS.\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.NORMAL = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.INSTANCES = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n return BackgroundMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_8__[\"MaterialDefines\"]));\r\n/**\r\n * Background material used to create an efficient environement around your scene.\r\n */\r\nvar BackgroundMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BackgroundMaterial, _super);\r\n /**\r\n * Instantiates a Background Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n function BackgroundMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Key light Color (multiply against the environement texture)\r\n */\r\n _this.primaryColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].White();\r\n _this._primaryColorShadowLevel = 0;\r\n _this._primaryColorHighlightLevel = 0;\r\n /**\r\n * Reflection Texture used in the material.\r\n * Should be author in a specific way for the best result (refer to the documentation).\r\n */\r\n _this.reflectionTexture = null;\r\n /**\r\n * Reflection Texture level of blur.\r\n *\r\n * Can be use to reuse an existing HDR Texture and target a specific LOD to prevent authoring the\r\n * texture twice.\r\n */\r\n _this.reflectionBlur = 0;\r\n /**\r\n * Diffuse Texture used in the material.\r\n * Should be author in a specific way for the best result (refer to the documentation).\r\n */\r\n _this.diffuseTexture = null;\r\n _this._shadowLights = null;\r\n /**\r\n * Specify the list of lights casting shadow on the material.\r\n * All scene shadow lights will be included if null.\r\n */\r\n _this.shadowLights = null;\r\n /**\r\n * Helps adjusting the shadow to a softer level if required.\r\n * 0 means black shadows and 1 means no shadows.\r\n */\r\n _this.shadowLevel = 0;\r\n /**\r\n * In case of opacity Fresnel or reflection falloff, this is use as a scene center.\r\n * It is usually zero but might be interesting to modify according to your setup.\r\n */\r\n _this.sceneCenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Zero();\r\n /**\r\n * This helps specifying that the material is falling off to the sky box at grazing angle.\r\n * This helps ensuring a nice transition when the camera goes under the ground.\r\n */\r\n _this.opacityFresnel = true;\r\n /**\r\n * This helps specifying that the material is falling off from diffuse to the reflection texture at grazing angle.\r\n * This helps adding a mirror texture on the ground.\r\n */\r\n _this.reflectionFresnel = false;\r\n /**\r\n * This helps specifying the falloff radius off the reflection texture from the sceneCenter.\r\n * This helps adding a nice falloff effect to the reflection if used as a mirror for instance.\r\n */\r\n _this.reflectionFalloffDistance = 0.0;\r\n /**\r\n * This specifies the weight of the reflection against the background in case of reflection Fresnel.\r\n */\r\n _this.reflectionAmount = 1.0;\r\n /**\r\n * This specifies the weight of the reflection at grazing angle.\r\n */\r\n _this.reflectionReflectance0 = 0.05;\r\n /**\r\n * This specifies the weight of the reflection at a perpendicular point of view.\r\n */\r\n _this.reflectionReflectance90 = 0.5;\r\n /**\r\n * Helps to directly use the maps channels instead of their level.\r\n */\r\n _this.useRGBColor = true;\r\n /**\r\n * This helps reducing the banding effect that could occur on the background.\r\n */\r\n _this.enableNoise = false;\r\n _this._fovMultiplier = 1.0;\r\n /**\r\n * Enable the FOV adjustment feature controlled by fovMultiplier.\r\n */\r\n _this.useEquirectangularFOV = false;\r\n _this._maxSimultaneousLights = 4;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * Keep track of the image processing observer to allow dispose and replace.\r\n */\r\n _this._imageProcessingObserver = null;\r\n /**\r\n * Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB.\r\n * Setting this flag to true (not done automatically!) will convert it back to RGB.\r\n */\r\n _this.switchToBGR = false;\r\n // Temp values kept as cache in the material.\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__[\"SmartArray\"](16);\r\n _this._reflectionControls = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector4\"].Zero();\r\n _this._white = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].White();\r\n _this._primaryShadowColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].Black();\r\n _this._primaryHighlightColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_15__[\"Color3\"].Black();\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (_this._diffuseTexture && _this._diffuseTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._diffuseTexture);\r\n }\r\n if (_this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n return _this._renderTargets;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(BackgroundMaterial.prototype, \"_perceptualColor\", {\r\n /**\r\n * Experimental Internal Use Only.\r\n *\r\n * Key light Color in \"perceptual value\" meaning the color you would like to see on screen.\r\n * This acts as a helper to set the primary color to a more \"human friendly\" value.\r\n * Conversion to linear space as well as exposure and tone mapping correction will be applied to keep the\r\n * output color as close as possible from the chosen value.\r\n * (This does not account for contrast color grading and color curves as they are considered post effect and not directly\r\n * part of lighting setup.)\r\n */\r\n get: function () {\r\n return this.__perceptualColor;\r\n },\r\n set: function (value) {\r\n this.__perceptualColor = value;\r\n this._computePrimaryColorFromPerceptualColor();\r\n this._markAllSubMeshesAsLightsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"primaryColorShadowLevel\", {\r\n /**\r\n * Defines the level of the shadows (dark area of the reflection map) in order to help scaling the colors.\r\n * The color opposite to the primary color is used at the level chosen to define what the black area would look.\r\n */\r\n get: function () {\r\n return this._primaryColorShadowLevel;\r\n },\r\n set: function (value) {\r\n this._primaryColorShadowLevel = value;\r\n this._computePrimaryColors();\r\n this._markAllSubMeshesAsLightsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"primaryColorHighlightLevel\", {\r\n /**\r\n * Defines the level of the highliights (highlight area of the reflection map) in order to help scaling the colors.\r\n * The primary color is used at the level chosen to define what the white area would look.\r\n */\r\n get: function () {\r\n return this._primaryColorHighlightLevel;\r\n },\r\n set: function (value) {\r\n this._primaryColorHighlightLevel = value;\r\n this._computePrimaryColors();\r\n this._markAllSubMeshesAsLightsDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"reflectionStandardFresnelWeight\", {\r\n /**\r\n * Sets the reflection reflectance fresnel values according to the default standard\r\n * empirically know to work well :-)\r\n */\r\n set: function (value) {\r\n var reflectionWeight = value;\r\n if (reflectionWeight < 0.5) {\r\n reflectionWeight = reflectionWeight * 2.0;\r\n this.reflectionReflectance0 = BackgroundMaterial.StandardReflectance0 * reflectionWeight;\r\n this.reflectionReflectance90 = BackgroundMaterial.StandardReflectance90 * reflectionWeight;\r\n }\r\n else {\r\n reflectionWeight = reflectionWeight * 2.0 - 1.0;\r\n this.reflectionReflectance0 = BackgroundMaterial.StandardReflectance0 + (1.0 - BackgroundMaterial.StandardReflectance0) * reflectionWeight;\r\n this.reflectionReflectance90 = BackgroundMaterial.StandardReflectance90 + (1.0 - BackgroundMaterial.StandardReflectance90) * reflectionWeight;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"fovMultiplier\", {\r\n /**\r\n * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values \"zoom in\" and higher values \"zoom out\".\r\n * Best used when trying to implement visual zoom effects like fish-eye or binoculars while not adjusting camera fov.\r\n * Recommended to be keep at 1.0 except for special cases.\r\n */\r\n get: function () {\r\n return this._fovMultiplier;\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n value = 1.0;\r\n }\r\n this._fovMultiplier = Math.max(0.0, Math.min(2.0, value));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration (if null the scene configuration will be use)\r\n */\r\n BackgroundMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._computePrimaryColorFromPerceptualColor();\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(BackgroundMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BackgroundMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (this._diffuseTexture && this._diffuseTexture.isRenderTarget) {\r\n return true;\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * The entire material has been created in order to prevent overdraw.\r\n * @returns false\r\n */\r\n BackgroundMaterial.prototype.needAlphaTesting = function () {\r\n return true;\r\n };\r\n /**\r\n * The entire material has been created in order to prevent overdraw.\r\n * @returns true if blending is enable\r\n */\r\n BackgroundMaterial.prototype.needAlphaBlending = function () {\r\n return ((this.alpha < 0) || (this._diffuseTexture != null && this._diffuseTexture.hasAlpha));\r\n };\r\n /**\r\n * Checks wether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @param useInstances Specify wether or not the material is used with instances\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n BackgroundMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n var _this = this;\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new BackgroundMaterialDefines();\r\n }\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var engine = scene.getEngine();\r\n // Lights\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights);\r\n defines._needNormals = true;\r\n // Multiview\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForMultiview(scene, defines);\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (scene.getEngine().getCaps().textureLOD) {\r\n defines.TEXTURELODSUPPORT = true;\r\n }\r\n if (this._diffuseTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._diffuseTexture, defines, \"DIFFUSE\");\r\n defines.DIFFUSEHASALPHA = this._diffuseTexture.hasAlpha;\r\n defines.GAMMADIFFUSE = this._diffuseTexture.gammaSpace;\r\n defines.OPACITYFRESNEL = this._opacityFresnel;\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n defines.DIFFUSEHASALPHA = false;\r\n defines.GAMMADIFFUSE = false;\r\n defines.OPACITYFRESNEL = false;\r\n }\r\n var reflectionTexture = this._reflectionTexture;\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (!reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n defines.REFLECTION = true;\r\n defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;\r\n defines.RGBDREFLECTION = reflectionTexture.isRGBD;\r\n defines.REFLECTIONBLUR = this._reflectionBlur > 0;\r\n defines.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;\r\n defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;\r\n defines.EQUIRECTANGULAR_RELFECTION_FOV = this.useEquirectangularFOV;\r\n defines.REFLECTIONBGR = this.switchToBGR;\r\n if (reflectionTexture.coordinatesMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].INVCUBIC_MODE) {\r\n defines.INVERTCUBICMAP = true;\r\n }\r\n defines.REFLECTIONMAP_3D = reflectionTexture.isCube;\r\n switch (reflectionTexture.coordinatesMode) {\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].EXPLICIT_MODE:\r\n defines.REFLECTIONMAP_EXPLICIT = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].PLANAR_MODE:\r\n defines.REFLECTIONMAP_PLANAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].PROJECTION_MODE:\r\n defines.REFLECTIONMAP_PROJECTION = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].SKYBOX_MODE:\r\n defines.REFLECTIONMAP_SKYBOX = true;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = !reflectionTexture.getReflectionTextureMatrix().isIdentity();\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].SPHERICAL_MODE:\r\n defines.REFLECTIONMAP_SPHERICAL = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].FIXED_EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].CUBIC_MODE:\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_11__[\"Texture\"].INVCUBIC_MODE:\r\n default:\r\n defines.REFLECTIONMAP_CUBIC = true;\r\n break;\r\n }\r\n if (this.reflectionFresnel) {\r\n defines.REFLECTIONFRESNEL = true;\r\n defines.REFLECTIONFALLOFF = this.reflectionFalloffDistance > 0;\r\n this._reflectionControls.x = this.reflectionAmount;\r\n this._reflectionControls.y = this.reflectionReflectance0;\r\n this._reflectionControls.z = this.reflectionReflectance90;\r\n this._reflectionControls.w = 1 / this.reflectionFalloffDistance;\r\n }\r\n else {\r\n defines.REFLECTIONFRESNEL = false;\r\n defines.REFLECTIONFALLOFF = false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n defines.REFLECTIONFRESNEL = false;\r\n defines.REFLECTIONFALLOFF = false;\r\n defines.REFLECTIONBLUR = false;\r\n defines.REFLECTIONMAP_3D = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.INVERTCUBICMAP = false;\r\n defines.REFLECTIONMAP_OPPOSITEZ = false;\r\n defines.LODINREFLECTIONALPHA = false;\r\n defines.GAMMAREFLECTION = false;\r\n defines.RGBDREFLECTION = false;\r\n }\r\n }\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].ALPHA_PREMULTIPLIED || this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_12__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF);\r\n defines.USERGBCOLOR = this._useRGBColor;\r\n defines.NOISE = this._enableNoise;\r\n }\r\n if (defines._areLightsDirty) {\r\n defines.USEHIGHLIGHTANDSHADOWCOLORS = !this._useRGBColor && (this._primaryColorShadowLevel !== 0 || this._primaryColorHighlightLevel !== 0);\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n // Misc.\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n // Values that need to be evaluated on every frame\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);\r\n // Attribs\r\n if (_Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareDefinesForAttributes(mesh, defines, false, true, false)) {\r\n if (mesh) {\r\n if (!scene.getEngine().getCaps().standardDerivatives && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind)) {\r\n mesh.createNormals(true);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Warn(\"BackgroundMaterial: Normals have been created for the mesh: \" + mesh.name);\r\n }\r\n }\r\n }\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n // Fallbacks\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_6__[\"EffectFallbacks\"]();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(0, \"FOG\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(1, \"POINTSIZE\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);\r\n //Attributes\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareAttributesForInstances(attribs, defines);\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"mBones\",\r\n \"vPrimaryColor\", \"vPrimaryColorShadow\",\r\n \"vReflectionInfos\", \"reflectionMatrix\", \"vReflectionMicrosurfaceInfos\", \"fFovMultiplier\",\r\n \"shadowLevel\", \"alpha\",\r\n \"vBackgroundCenter\", \"vReflectionControl\",\r\n \"vDiffuseInfos\", \"diffuseMatrix\",\r\n ];\r\n var samplers = [\"diffuseSampler\", \"reflectionSampler\", \"reflectionSamplerLow\", \"reflectionSamplerHigh\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, defines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, defines);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n var onCompiled = function (effect) {\r\n if (_this.onCompiled) {\r\n _this.onCompiled(effect);\r\n }\r\n _this.bindSceneUniformBuffer(effect, scene.getSceneUniformBuffer());\r\n };\r\n var join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(\"background\", {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }\r\n }, engine), defines);\r\n this.buildUniformLayout();\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Compute the primary color according to the chosen perceptual color.\r\n */\r\n BackgroundMaterial.prototype._computePrimaryColorFromPerceptualColor = function () {\r\n if (!this.__perceptualColor) {\r\n return;\r\n }\r\n this._primaryColor.copyFrom(this.__perceptualColor);\r\n // Revert gamma space.\r\n this._primaryColor.toLinearSpaceToRef(this._primaryColor);\r\n // Revert image processing configuration.\r\n if (this._imageProcessingConfiguration) {\r\n // Revert Exposure.\r\n this._primaryColor.scaleToRef(1 / this._imageProcessingConfiguration.exposure, this._primaryColor);\r\n }\r\n this._computePrimaryColors();\r\n };\r\n /**\r\n * Compute the highlights and shadow colors according to their chosen levels.\r\n */\r\n BackgroundMaterial.prototype._computePrimaryColors = function () {\r\n if (this._primaryColorShadowLevel === 0 && this._primaryColorHighlightLevel === 0) {\r\n return;\r\n }\r\n // Find the highlight color based on the configuration.\r\n this._primaryColor.scaleToRef(this._primaryColorShadowLevel, this._primaryShadowColor);\r\n this._primaryColor.subtractToRef(this._primaryShadowColor, this._primaryShadowColor);\r\n // Find the shadow color based on the configuration.\r\n this._white.subtractToRef(this._primaryColor, this._primaryHighlightColor);\r\n this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel, this._primaryHighlightColor);\r\n this._primaryColor.addToRef(this._primaryHighlightColor, this._primaryHighlightColor);\r\n };\r\n /**\r\n * Build the uniform buffer used in the material.\r\n */\r\n BackgroundMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n this._uniformBuffer.addUniform(\"vPrimaryColor\", 4);\r\n this._uniformBuffer.addUniform(\"vPrimaryColorShadow\", 4);\r\n this._uniformBuffer.addUniform(\"vDiffuseInfos\", 2);\r\n this._uniformBuffer.addUniform(\"vReflectionInfos\", 2);\r\n this._uniformBuffer.addUniform(\"diffuseMatrix\", 16);\r\n this._uniformBuffer.addUniform(\"reflectionMatrix\", 16);\r\n this._uniformBuffer.addUniform(\"vReflectionMicrosurfaceInfos\", 3);\r\n this._uniformBuffer.addUniform(\"fFovMultiplier\", 1);\r\n this._uniformBuffer.addUniform(\"pointSize\", 1);\r\n this._uniformBuffer.addUniform(\"shadowLevel\", 1);\r\n this._uniformBuffer.addUniform(\"alpha\", 1);\r\n this._uniformBuffer.addUniform(\"vBackgroundCenter\", 3);\r\n this._uniformBuffer.addUniform(\"vReflectionControl\", 4);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Unbind the material.\r\n */\r\n BackgroundMaterial.prototype.unbind = function () {\r\n if (this._diffuseTexture && this._diffuseTexture.isRenderTarget) {\r\n this._uniformBuffer.setTexture(\"diffuseSampler\", null);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", null);\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Bind only the world matrix to the material.\r\n * @param world The world matrix to bind.\r\n */\r\n BackgroundMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n this._activeEffect.setMatrix(\"world\", world);\r\n };\r\n /**\r\n * Bind the material for a dedicated submeh (every used meshes will be considered opaque).\r\n * @param world The world matrix to bind.\r\n * @param subMesh The submesh to bind for.\r\n */\r\n BackgroundMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n // Bones\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindBonesParameters(mesh, this._activeEffect);\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n if (mustRebind) {\r\n this._uniformBuffer.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n var reflectionTexture = this._reflectionTexture;\r\n if (!this._uniformBuffer.useUbo || !this.isFrozen || !this._uniformBuffer.isSync) {\r\n // Texture uniforms\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n this._uniformBuffer.updateFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindTextureMatrix(this._diffuseTexture, this._uniformBuffer, \"diffuse\");\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n this._uniformBuffer.updateMatrix(\"reflectionMatrix\", reflectionTexture.getReflectionTextureMatrix());\r\n this._uniformBuffer.updateFloat2(\"vReflectionInfos\", reflectionTexture.level, this._reflectionBlur);\r\n this._uniformBuffer.updateFloat3(\"vReflectionMicrosurfaceInfos\", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);\r\n }\r\n }\r\n if (this.shadowLevel > 0) {\r\n this._uniformBuffer.updateFloat(\"shadowLevel\", this.shadowLevel);\r\n }\r\n this._uniformBuffer.updateFloat(\"alpha\", this.alpha);\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._uniformBuffer.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n if (defines.USEHIGHLIGHTANDSHADOWCOLORS) {\r\n this._uniformBuffer.updateColor4(\"vPrimaryColor\", this._primaryHighlightColor, 1.0);\r\n this._uniformBuffer.updateColor4(\"vPrimaryColorShadow\", this._primaryShadowColor, 1.0);\r\n }\r\n else {\r\n this._uniformBuffer.updateColor4(\"vPrimaryColor\", this._primaryColor, 1.0);\r\n }\r\n }\r\n this._uniformBuffer.updateFloat(\"fFovMultiplier\", this._fovMultiplier);\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n this._uniformBuffer.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (defines.REFLECTIONBLUR && defines.TEXTURELODSUPPORT) {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else if (!defines.REFLECTIONBLUR) {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else {\r\n this._uniformBuffer.setTexture(\"reflectionSampler\", reflectionTexture._lodTextureMid || reflectionTexture);\r\n this._uniformBuffer.setTexture(\"reflectionSamplerLow\", reflectionTexture._lodTextureLow || reflectionTexture);\r\n this._uniformBuffer.setTexture(\"reflectionSamplerHigh\", reflectionTexture._lodTextureHigh || reflectionTexture);\r\n }\r\n if (defines.REFLECTIONFRESNEL) {\r\n this._uniformBuffer.updateFloat3(\"vBackgroundCenter\", this.sceneCenter.x, this.sceneCenter.y, this.sceneCenter.z);\r\n this._uniformBuffer.updateFloat4(\"vReflectionControl\", this._reflectionControls.x, this._reflectionControls.y, this._reflectionControls.z, this._reflectionControls.w);\r\n }\r\n }\r\n }\r\n // Clip plane\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindClipPlane(this._activeEffect, scene);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindEyePosition(effect, scene);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n if (scene.lightsEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights, false);\r\n }\r\n // View\r\n this.bindView(effect);\r\n // Fog\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindFogParameters(scene, mesh, this._activeEffect, true);\r\n // image processing\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n }\r\n }\r\n this._uniformBuffer.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n BackgroundMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Dispose the material.\r\n * @param forceDisposeEffect Force disposal of the associated effect.\r\n * @param forceDisposeTextures Force disposal of the associated textures.\r\n */\r\n BackgroundMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n if (forceDisposeEffect === void 0) { forceDisposeEffect = false; }\r\n if (forceDisposeTextures === void 0) { forceDisposeTextures = false; }\r\n if (forceDisposeTextures) {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n if (this.reflectionTexture) {\r\n this.reflectionTexture.dispose();\r\n }\r\n }\r\n this._renderTargets.dispose();\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect);\r\n };\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n BackgroundMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new BackgroundMaterial(name, _this.getScene()); }, this);\r\n };\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n BackgroundMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.BackgroundMaterial\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"BackgroundMaterial\"\r\n */\r\n BackgroundMaterial.prototype.getClassName = function () {\r\n return \"BackgroundMaterial\";\r\n };\r\n /**\r\n * Parse a JSON input to create back a background material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated BackgroundMaterial.\r\n */\r\n BackgroundMaterial.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new BackgroundMaterial(source.name, scene); }, source, scene, rootUrl);\r\n };\r\n /**\r\n * Standard reflectance value at parallel view angle.\r\n */\r\n BackgroundMaterial.StandardReflectance0 = 0.05;\r\n /**\r\n * Standard reflectance value at grazing angle.\r\n */\r\n BackgroundMaterial.StandardReflectance90 = 0.5;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], BackgroundMaterial.prototype, \"_primaryColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], BackgroundMaterial.prototype, \"primaryColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], BackgroundMaterial.prototype, \"__perceptualColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_primaryColorShadowLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_primaryColorHighlightLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], BackgroundMaterial.prototype, \"primaryColorHighlightLevel\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])()\r\n ], BackgroundMaterial.prototype, \"_diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"shadowLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_shadowLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"shadowLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], BackgroundMaterial.prototype, \"_sceneCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"sceneCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_opacityFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"opacityFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionFalloffDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionFalloffDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionAmount\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionAmount\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionReflectance0\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionReflectance0\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_reflectionReflectance90\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"reflectionReflectance90\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_useRGBColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"useRGBColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_enableNoise\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"enableNoise\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BackgroundMaterial.prototype, \"_maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], BackgroundMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsImageProcessingConfiguration\"])()\r\n ], BackgroundMaterial.prototype, \"_imageProcessingConfiguration\", void 0);\r\n return BackgroundMaterial;\r\n}(_Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_9__[\"PushMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.BackgroundMaterial\"] = BackgroundMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Background/index.ts\":\n/*!***************************************!*\\\n !*** ./Materials/Background/index.ts ***!\n \\***************************************/\n/*! exports provided: BackgroundMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _backgroundMaterial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./backgroundMaterial */ \"./Materials/Background/backgroundMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _backgroundMaterial__WEBPACK_IMPORTED_MODULE_0__[\"BackgroundMaterial\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/fogBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/fogBlock.ts ***!\n \\************************************************/\n/*! exports provided: FogBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return FogBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add support for scene fog\r\n */\r\nvar FogBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FogBlock, _super);\r\n /**\r\n * Create a new FogBlock\r\n * @param name defines the block name\r\n */\r\n function FogBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].VertexAndFragment, true) || this;\r\n // Vertex\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"view\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Vertex);\r\n // Fragment\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerInput(\"fogColor\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.input.acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this.fogColor.acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n FogBlock.prototype.getClassName = function () {\r\n return \"FogBlock\";\r\n };\r\n Object.defineProperty(FogBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"view\", {\r\n /**\r\n * Gets the view input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"input\", {\r\n /**\r\n * Gets the color input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"fogColor\", {\r\n /**\r\n * Gets the fog color input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FogBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n FogBlock.prototype.autoConfigure = function (material) {\r\n if (!this.view.isConnected) {\r\n var viewInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].View; });\r\n if (!viewInput) {\r\n viewInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"view\");\r\n viewInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].View);\r\n }\r\n viewInput.output.connectTo(this.view);\r\n }\r\n if (!this.fogColor.isConnected) {\r\n var fogColorInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].FogColor; });\r\n if (!fogColorInput) {\r\n fogColorInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"fogColor\", undefined, _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n fogColorInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].FogColor);\r\n }\r\n fogColorInput.output.connectTo(this.fogColor);\r\n }\r\n };\r\n FogBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n var scene = mesh.getScene();\r\n defines.setValue(\"FOG\", nodeMaterial.fogEnabled && _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].GetFogState(mesh, scene));\r\n };\r\n FogBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n effect.setFloat4(this._fogParameters, scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n };\r\n FogBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n state._emitFunctionFromInclude(\"fogFragmentDeclaration\", \"//\" + this.name, {\r\n removeUniforms: true,\r\n removeVaryings: true,\r\n removeIfDef: false,\r\n replaceStrings: [{ search: /float CalcFogFactor\\(\\)/, replace: \"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)\" }]\r\n });\r\n var tempFogVariablename = state._getFreeVariableName(\"fog\");\r\n var color = this.input;\r\n var fogColor = this.fogColor;\r\n this._fogParameters = state._getFreeVariableName(\"fogParameters\");\r\n var output = this._outputs[0];\r\n state._emitUniformFromString(this._fogParameters, \"vec4\");\r\n state.compilationString += \"#ifdef FOG\\r\\n\";\r\n state.compilationString += \"float \" + tempFogVariablename + \" = CalcFogFactor(\" + this._fogDistanceName + \", \" + this._fogParameters + \");\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + tempFogVariablename + \" * \" + color.associatedVariableName + \".rgb + (1.0 - \" + tempFogVariablename + \") * \" + fogColor.associatedVariableName + \".rgb;\\r\\n\");\r\n state.compilationString += \"#else\\r\\n\" + this._declareOutput(output, state) + \" = \" + color.associatedVariableName + \".rgb;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n }\r\n else {\r\n var worldPos = this.worldPosition;\r\n var view = this.view;\r\n this._fogDistanceName = state._getFreeVariableName(\"vFogDistance\");\r\n state._emitVaryingFromString(this._fogDistanceName, \"vec3\");\r\n state.compilationString += this._fogDistanceName + \" = (\" + view.associatedVariableName + \" * \" + worldPos.associatedVariableName + \").xyz;\\r\\n\";\r\n }\r\n return this;\r\n };\r\n return FogBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.FogBlock\"] = FogBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/index.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/index.ts ***!\n \\*********************************************/\n/*! exports provided: FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _fogBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fogBlock */ \"./Materials/Node/Blocks/Dual/fogBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _fogBlock__WEBPACK_IMPORTED_MODULE_0__[\"FogBlock\"]; });\n\n/* harmony import */ var _lightBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lightBlock */ \"./Materials/Node/Blocks/Dual/lightBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _lightBlock__WEBPACK_IMPORTED_MODULE_1__[\"LightBlock\"]; });\n\n/* harmony import */ var _textureBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./textureBlock */ \"./Materials/Node/Blocks/Dual/textureBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _textureBlock__WEBPACK_IMPORTED_MODULE_2__[\"TextureBlock\"]; });\n\n/* harmony import */ var _reflectionTextureBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./reflectionTextureBlock */ \"./Materials/Node/Blocks/Dual/reflectionTextureBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _reflectionTextureBlock__WEBPACK_IMPORTED_MODULE_3__[\"ReflectionTextureBlock\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/lightBlock.ts\":\n/*!**************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/lightBlock.ts ***!\n \\**************************************************/\n/*! exports provided: LightBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return LightBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add light in the fragment shader\r\n */\r\nvar LightBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LightBlock, _super);\r\n /**\r\n * Create a new LightBlock\r\n * @param name defines the block name\r\n */\r\n function LightBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].VertexAndFragment) || this;\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerInput(\"cameraPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"diffuseOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"specularOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n LightBlock.prototype.getClassName = function () {\r\n return \"LightBlock\";\r\n };\r\n Object.defineProperty(LightBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"cameraPosition\", {\r\n /**\r\n * Gets the camera (or eye) position component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"diffuseOutput\", {\r\n /**\r\n * Gets the diffuse output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightBlock.prototype, \"specularOutput\", {\r\n /**\r\n * Gets the specular output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n LightBlock.prototype.autoConfigure = function (material) {\r\n if (!this.cameraPosition.isConnected) {\r\n var cameraPositionInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition; });\r\n if (!cameraPositionInput) {\r\n cameraPositionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"cameraPosition\");\r\n cameraPositionInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition);\r\n }\r\n cameraPositionInput.output.connectTo(this.cameraPosition);\r\n }\r\n };\r\n LightBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areLightsDirty) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n if (!this.light) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, true, nodeMaterial.maxSimultaneousLights);\r\n }\r\n else {\r\n var state = {\r\n needNormals: false,\r\n needRebuild: false,\r\n lightmapMode: false,\r\n shadowEnabled: false,\r\n specularEnabled: false\r\n };\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForLight(scene, mesh, this.light, this._lightId, defines, true, state);\r\n if (state.needRebuild) {\r\n defines.rebuild();\r\n }\r\n }\r\n };\r\n LightBlock.prototype.updateUniformsAndSamples = function (state, nodeMaterial, defines) {\r\n for (var lightIndex = 0; lightIndex < nodeMaterial.maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareUniformsAndSamplersForLight(lightIndex, state.uniforms, state.samplers, false, state.uniformBuffers);\r\n }\r\n };\r\n LightBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n if (!this.light) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindLights(scene, mesh, effect, true, nodeMaterial.maxSimultaneousLights, false);\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindLight(this.light, this._lightId, scene, mesh, effect, true, false);\r\n }\r\n };\r\n LightBlock.prototype._injectVertexCode = function (state) {\r\n var worldPos = this.worldPosition;\r\n var comments = \"//\" + this.name;\r\n // Declaration\r\n if (!this.light) { // Emit for all lights\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n this._lightId = 0;\r\n state.sharedData.dynamicUniformBlocks.push(this);\r\n }\r\n else {\r\n this._lightId = (state.counters[\"lightCounter\"] !== undefined ? state.counters[\"lightCounter\"] : -1) + 1;\r\n state.counters[\"lightCounter\"] = this._lightId;\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }]\r\n }, this._lightId.toString());\r\n }\r\n // Inject code in vertex\r\n var worldPosVaryingName = \"v_\" + worldPos.associatedVariableName;\r\n if (state._emitVaryingFromString(worldPosVaryingName, \"vec4\")) {\r\n state.compilationString += worldPosVaryingName + \" = \" + worldPos.associatedVariableName + \";\\r\\n\";\r\n }\r\n if (this.light) {\r\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\r\n replaceStrings: [\r\n { search: /{X}/g, replace: this._lightId.toString() },\r\n { search: /worldPos/g, replace: worldPos.associatedVariableName }\r\n ]\r\n });\r\n }\r\n else {\r\n state.compilationString += \"vec4 worldPos = \" + worldPos.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n }\r\n };\r\n LightBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n // Vertex\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n // Fragment\r\n state.sharedData.bindableBlocks.push(this);\r\n state.sharedData.blocksWithDefines.push(this);\r\n var comments = \"//\" + this.name;\r\n var worldPos = this.worldPosition;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n state._emitFunctionFromInclude(\"lightsFragmentFunctions\", comments, {\r\n replaceStrings: [\r\n { search: /vPositionW/g, replace: \"v_\" + worldPos.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n state._emitFunctionFromInclude(\"shadowsFragmentFunctions\", comments, {\r\n replaceStrings: [\r\n { search: /vPositionW/g, replace: \"v_\" + worldPos.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n if (!this.light) { // Emit for all lights\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n }\r\n else {\r\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\r\n replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }]\r\n }, this._lightId.toString());\r\n // Uniforms and samplers\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareUniformsAndSamplersForLight(this._lightId, state.uniforms, state.samplers, undefined, state.uniformBuffers);\r\n }\r\n // Code\r\n if (this._lightId === 0) {\r\n if (state._registerTempVariable(\"viewDirectionW\")) {\r\n state.compilationString += \"vec3 viewDirectionW = normalize(\" + this.cameraPosition.associatedVariableName + \" - \" + (\"v_\" + worldPos.associatedVariableName) + \".xyz);\\r\\n\";\r\n }\r\n state.compilationString += \"lightingInfo info;\\r\\n\";\r\n state.compilationString += \"float shadow = 1.;\\r\\n\";\r\n state.compilationString += \"float glossiness = 0.;\\r\\n\";\r\n state.compilationString += \"vec3 diffuseBase = vec3(0., 0., 0.);\\r\\n\";\r\n state.compilationString += \"vec3 specularBase = vec3(0., 0., 0.);\\r\\n\";\r\n state.compilationString += \"vec3 normalW = \" + this.worldNormal.associatedVariableName + \".xyz;\\r\\n\";\r\n }\r\n if (this.light) {\r\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\r\n replaceStrings: [\r\n { search: /{X}/g, replace: this._lightId.toString() }\r\n ]\r\n });\r\n }\r\n else {\r\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\r\n repeatKey: \"maxSimultaneousLights\"\r\n });\r\n }\r\n var diffuseOutput = this.diffuseOutput;\r\n var specularOutput = this.specularOutput;\r\n state.compilationString += this._declareOutput(diffuseOutput, state) + \" = diffuseBase;\\r\\n\";\r\n if (specularOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(specularOutput, state) + \" = specularBase;\\r\\n\";\r\n }\r\n return this;\r\n };\r\n LightBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.light) {\r\n serializationObject.lightId = this.light.id;\r\n }\r\n return serializationObject;\r\n };\r\n LightBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.lightId) {\r\n this.light = scene.getLightByID(serializationObject.lightId);\r\n }\r\n };\r\n return LightBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.LightBlock\"] = LightBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/reflectionTextureBlock.ts\":\n/*!**************************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/reflectionTextureBlock.ts ***!\n \\**************************************************************/\n/*! exports provided: ReflectionTextureBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return ReflectionTextureBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Textures_texture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to read a reflection texture from a sampler\r\n */\r\nvar ReflectionTextureBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ReflectionTextureBlock, _super);\r\n /**\r\n * Create a new TextureBlock\r\n * @param name defines the block name\r\n */\r\n function ReflectionTextureBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment) || this;\r\n _this.registerInput(\"position\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"world\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerInput(\"cameraPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerInput(\"view\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ReflectionTextureBlock.prototype.getClassName = function () {\r\n return \"ReflectionTextureBlock\";\r\n };\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"position\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"world\", {\r\n /**\r\n * Gets the world input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"cameraPosition\", {\r\n /**\r\n * Gets the camera (or eye) position component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"view\", {\r\n /**\r\n * Gets the view input component\r\n */\r\n get: function () {\r\n return this._inputs[5];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g output component\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionTextureBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b output component\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ReflectionTextureBlock.prototype.autoConfigure = function (material) {\r\n if (!this.position.isConnected) {\r\n var positionInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"position\"; });\r\n if (!positionInput) {\r\n positionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"position\");\r\n positionInput.setAsAttribute();\r\n }\r\n positionInput.output.connectTo(this.position);\r\n }\r\n if (!this.world.isConnected) {\r\n var worldInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].World; });\r\n if (!worldInput) {\r\n worldInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].World);\r\n }\r\n worldInput.output.connectTo(this.world);\r\n }\r\n if (!this.cameraPosition.isConnected) {\r\n var cameraPositionInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].CameraPosition; });\r\n if (!cameraPositionInput) {\r\n cameraPositionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"cameraPosition\");\r\n cameraPositionInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].CameraPosition);\r\n }\r\n cameraPositionInput.output.connectTo(this.cameraPosition);\r\n }\r\n if (!this.view.isConnected) {\r\n var viewInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].View; });\r\n if (!viewInput) {\r\n viewInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"view\");\r\n viewInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialSystemValues\"].View);\r\n }\r\n viewInput.output.connectTo(this.view);\r\n }\r\n };\r\n ReflectionTextureBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areTexturesDirty) {\r\n return;\r\n }\r\n if (!this.texture || !this.texture.getTextureMatrix) {\r\n return;\r\n }\r\n defines.setValue(this._define3DName, this.texture.isCube);\r\n defines.setValue(this._defineLocalCubicName, this.texture.boundingBoxSize ? true : false);\r\n defines.setValue(this._defineExplicitName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_EXPLICIT_MODE);\r\n defines.setValue(this._defineSkyboxName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_SKYBOX_MODE);\r\n defines.setValue(this._defineCubicName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_CUBIC_MODE);\r\n defines.setValue(this._defineSphericalName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_SPHERICAL_MODE);\r\n defines.setValue(this._definePlanarName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_PLANAR_MODE);\r\n defines.setValue(this._defineProjectionName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_PROJECTION_MODE);\r\n defines.setValue(this._defineEquirectangularName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_EQUIRECTANGULAR_MODE);\r\n defines.setValue(this._defineEquirectangularFixedName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MODE);\r\n defines.setValue(this._defineMirroredEquirectangularFixedName, this.texture.coordinatesMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE);\r\n };\r\n ReflectionTextureBlock.prototype.isReady = function () {\r\n if (this.texture && !this.texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n ReflectionTextureBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh || !this.texture) {\r\n return;\r\n }\r\n effect.setMatrix(this._reflectionMatrixName, this.texture.getReflectionTextureMatrix());\r\n if (this.texture.isCube) {\r\n effect.setTexture(this._cubeSamplerName, this.texture);\r\n }\r\n else {\r\n effect.setTexture(this._2DSamplerName, this.texture);\r\n }\r\n };\r\n ReflectionTextureBlock.prototype._injectVertexCode = function (state) {\r\n var worldPosVaryingName = \"v_\" + this.worldPosition.associatedVariableName;\r\n if (state._emitVaryingFromString(worldPosVaryingName, \"vec4\")) {\r\n state.compilationString += worldPosVaryingName + \" = \" + this.worldPosition.associatedVariableName + \";\\r\\n\";\r\n }\r\n var worldNormalVaryingName = \"v_\" + this.worldNormal.associatedVariableName;\r\n if (state._emitVaryingFromString(worldNormalVaryingName, \"vec4\")) {\r\n state.compilationString += worldNormalVaryingName + \" = \" + this.worldNormal.associatedVariableName + \";\\r\\n\";\r\n }\r\n this._positionUVWName = state._getFreeVariableName(\"positionUVW\");\r\n this._directionWName = state._getFreeVariableName(\"directionW\");\r\n if (state._emitVaryingFromString(this._positionUVWName, \"vec3\", this._defineSkyboxName)) {\r\n state.compilationString += \"#ifdef \" + this._defineSkyboxName + \"\\r\\n\";\r\n state.compilationString += this._positionUVWName + \" = \" + this.position.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n }\r\n if (state._emitVaryingFromString(this._directionWName, \"vec3\", \"defined(\" + this._defineEquirectangularFixedName + \") || defined(\" + this._defineMirroredEquirectangularFixedName + \")\")) {\r\n state.compilationString += \"#if defined(\" + this._defineEquirectangularFixedName + \") || defined(\" + this._defineMirroredEquirectangularFixedName + \")\\r\\n\";\r\n state.compilationString += this._directionWName + \" = normalize(vec3(\" + this.world.associatedVariableName + \" * vec4(\" + this.position.associatedVariableName + \", 0.0)));\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n }\r\n };\r\n ReflectionTextureBlock.prototype._writeOutput = function (state, output, swizzle) {\r\n state.compilationString += this._declareOutput(output, state) + \" = \" + this._reflectionColorName + \".\" + swizzle + \";\\r\\n\";\r\n };\r\n ReflectionTextureBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n this._define3DName = state._getFreeDefineName(\"REFLECTIONMAP_3D\");\r\n this._defineCubicName = state._getFreeDefineName(\"REFLECTIONMAP_CUBIC\");\r\n this._defineSphericalName = state._getFreeDefineName(\"REFLECTIONMAP_SPHERICAL\");\r\n this._definePlanarName = state._getFreeDefineName(\"REFLECTIONMAP_PLANAR\");\r\n this._defineProjectionName = state._getFreeDefineName(\"REFLECTIONMAP_PROJECTION\");\r\n this._defineExplicitName = state._getFreeDefineName(\"REFLECTIONMAP_EXPLICIT\");\r\n this._defineEquirectangularName = state._getFreeDefineName(\"REFLECTIONMAP_EQUIRECTANGULAR\");\r\n this._defineLocalCubicName = state._getFreeDefineName(\"USE_LOCAL_REFLECTIONMAP_CUBIC\");\r\n this._defineMirroredEquirectangularFixedName = state._getFreeDefineName(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");\r\n this._defineEquirectangularFixedName = state._getFreeDefineName(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");\r\n this._defineSkyboxName = state._getFreeDefineName(\"REFLECTIONMAP_SKYBOX\");\r\n // Vertex\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n state.sharedData.blockingBlocks.push(this);\r\n state.sharedData.textureBlocks.push(this);\r\n // Samplers\r\n this._cubeSamplerName = state._getFreeVariableName(this.name + \"CubeSampler\");\r\n state.samplers.push(this._cubeSamplerName);\r\n this._2DSamplerName = state._getFreeVariableName(this.name + \"2DSampler\");\r\n state.samplers.push(this._2DSamplerName);\r\n state._samplerDeclaration += \"#ifdef \" + this._define3DName + \"\\r\\n\";\r\n state._samplerDeclaration += \"uniform samplerCube \" + this._cubeSamplerName + \";\\r\\n\";\r\n state._samplerDeclaration += \"#else\\r\\n\";\r\n state._samplerDeclaration += \"uniform sampler2D \" + this._2DSamplerName + \";\\r\\n\";\r\n state._samplerDeclaration += \"#endif\\r\\n\";\r\n // Fragment\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n var comments = \"//\" + this.name;\r\n state._emitFunction(\"ReciprocalPI\", \"#define RECIPROCAL_PI2 0.15915494\", \"\");\r\n state._emitFunctionFromInclude(\"reflectionFunction\", comments);\r\n this._reflectionColorName = state._getFreeVariableName(\"reflectionColor\");\r\n this._reflectionCoordsName = state._getFreeVariableName(\"reflectionUVW\");\r\n this._reflection2DCoordsName = state._getFreeVariableName(\"reflectionUV\");\r\n this._reflectionMatrixName = state._getFreeVariableName(\"reflectionMatrix\");\r\n state._emitUniformFromString(this._reflectionMatrixName, \"mat4\");\r\n // Code\r\n var worldPos = \"v_\" + this.worldPosition.associatedVariableName;\r\n var worldNormal = \"v_\" + this.worldNormal.associatedVariableName + \".xyz\";\r\n var reflectionMatrix = this._reflectionMatrixName;\r\n var direction = \"normalize(\" + this._directionWName + \")\";\r\n var positionUVW = \"\" + this._positionUVWName;\r\n var vEyePosition = \"\" + this.cameraPosition.associatedVariableName;\r\n var view = \"\" + this.view.associatedVariableName;\r\n state.compilationString += \"vec3 \" + this._reflectionColorName + \";\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._define3DName + \"\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineMirroredEquirectangularFixedName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeMirroredFixedEquirectangularCoords(\" + worldPos + \", \" + worldNormal + \", \" + direction + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineEquirectangularFixedName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeFixedEquirectangularCoords(\" + worldPos + \", \" + worldNormal + \", \" + direction + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineEquirectangularName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeEquirectangularCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \" #endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineSphericalName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeSphericalCoords(\" + worldPos + \", \" + worldNormal + \", \" + view + \", \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._definePlanarName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computePlanarCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineCubicName + \"\\r\\n\";\r\n state.compilationString += \" #ifdef \" + this._defineLocalCubicName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeCubicLocalCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \", vReflectionSize, vReflectionPosition);\\r\\n\";\r\n state.compilationString += \" #else\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeCubicCoords(\" + worldPos + \", \" + worldNormal + \", \" + vEyePosition + \".xyz, \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \" #endif\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineProjectionName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeProjectionCoords(\" + worldPos + \", \" + view + \", \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineSkyboxName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = computeSkyBoxCoords(\" + positionUVW + \", \" + reflectionMatrix + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineExplicitName + \"\\r\\n\";\r\n state.compilationString += \" vec3 \" + this._reflectionCoordsName + \" = vec3(0, 0, 0);\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += this._reflectionColorName + \" = textureCube(\" + this._cubeSamplerName + \", \" + this._reflectionCoordsName + \").rgb;\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += \"vec2 \" + this._reflection2DCoordsName + \" = \" + this._reflectionCoordsName + \".xy;\\r\\n\";\r\n state.compilationString += \"#ifdef \" + this._defineProjectionName + \"\\r\\n\";\r\n state.compilationString += this._reflection2DCoordsName + \" /= \" + this._reflectionCoordsName + \".z;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += this._reflection2DCoordsName + \".y = 1.0 - \" + this._reflection2DCoordsName + \".y;\\r\\n\";\r\n state.compilationString += this._reflectionColorName + \" = texture2D(\" + this._2DSamplerName + \", \" + this._reflection2DCoordsName + \").rgb;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n for (var _i = 0, _a = this._outputs; _i < _a.length; _i++) {\r\n var output = _a[_i];\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name);\r\n }\r\n }\r\n return this;\r\n };\r\n ReflectionTextureBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.texture) {\r\n serializationObject.texture = this.texture.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n ReflectionTextureBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.texture) {\r\n this.texture = _Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].Parse(serializationObject.texture, scene, rootUrl);\r\n }\r\n };\r\n return ReflectionTextureBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ReflectionTextureBlock\"] = ReflectionTextureBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Dual/textureBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/Dual/textureBlock.ts ***!\n \\****************************************************/\n/*! exports provided: TextureBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return TextureBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to read a texture from a sampler\r\n */\r\nvar TextureBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextureBlock, _super);\r\n /**\r\n * Create a new TextureBlock\r\n * @param name defines the block name\r\n */\r\n function TextureBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment) || this;\r\n _this.registerInput(\"uv\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment);\r\n _this.registerOutput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this.registerOutput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment);\r\n _this._inputs[0].acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this._inputs[0].acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n TextureBlock.prototype.getClassName = function () {\r\n return \"TextureBlock\";\r\n };\r\n Object.defineProperty(TextureBlock.prototype, \"uv\", {\r\n /**\r\n * Gets the uv input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r output component\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g output component\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b output component\r\n */\r\n get: function () {\r\n return this._outputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a output component\r\n */\r\n get: function () {\r\n return this._outputs[5];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextureBlock.prototype, \"target\", {\r\n get: function () {\r\n // TextureBlock has a special optimizations for uvs that come from the vertex shaders as they can be packed into a single varyings.\r\n // But we need to detect uvs coming from fragment then\r\n if (!this.uv.isConnected) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n }\r\n if (this.uv.sourceBlock.isInput) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n }\r\n var parent = this.uv.connectedPoint;\r\n while (parent) {\r\n if (parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment;\r\n }\r\n if (parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) {\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n }\r\n if (parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral || parent.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment) {\r\n var parentBlock = parent.ownerBlock;\r\n parent = null;\r\n for (var _i = 0, _a = parentBlock.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (input.connectedPoint) {\r\n parent = input.connectedPoint;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TextureBlock.prototype.autoConfigure = function (material) {\r\n if (!this.uv.isConnected) {\r\n var uvInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"uv\"; });\r\n if (!uvInput) {\r\n uvInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_4__[\"InputBlock\"](\"uv\");\r\n uvInput.setAsAttribute();\r\n }\r\n uvInput.output.connectTo(this.uv);\r\n }\r\n };\r\n TextureBlock.prototype.initializeDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (!defines._areTexturesDirty) {\r\n return;\r\n }\r\n defines.setValue(this._mainUVDefineName, false);\r\n };\r\n TextureBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areTexturesDirty) {\r\n return;\r\n }\r\n if (!this.texture || !this.texture.getTextureMatrix) {\r\n return;\r\n }\r\n if (!this.texture.getTextureMatrix().isIdentityAs3x2()) {\r\n defines.setValue(this._defineName, true);\r\n }\r\n else {\r\n defines.setValue(this._defineName, false);\r\n defines.setValue(this._mainUVDefineName, true);\r\n }\r\n };\r\n TextureBlock.prototype.isReady = function () {\r\n if (this.texture && !this.texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n TextureBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh || !this.texture) {\r\n return;\r\n }\r\n if (this._isMixed) {\r\n effect.setFloat(this._textureInfoName, this.texture.level);\r\n effect.setMatrix(this._textureTransformName, this.texture.getTextureMatrix());\r\n }\r\n effect.setTexture(this._samplerName, this.texture);\r\n };\r\n Object.defineProperty(TextureBlock.prototype, \"_isMixed\", {\r\n get: function () {\r\n return this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TextureBlock.prototype._injectVertexCode = function (state) {\r\n var uvInput = this.uv;\r\n // Inject code in vertex\r\n this._defineName = state._getFreeDefineName(\"UVTRANSFORM\");\r\n this._mainUVDefineName = state._getFreeDefineName(\"vMain\" + uvInput.associatedVariableName);\r\n if (uvInput.connectedPoint.ownerBlock.isInput) {\r\n var uvInputOwnerBlock = uvInput.connectedPoint.ownerBlock;\r\n if (!uvInputOwnerBlock.isAttribute) {\r\n state._emitUniformFromString(uvInput.associatedVariableName, \"vec2\");\r\n }\r\n }\r\n this._mainUVName = \"vMain\" + uvInput.associatedVariableName;\r\n this._transformedUVName = state._getFreeVariableName(\"transformedUV\");\r\n this._textureTransformName = state._getFreeVariableName(\"textureTransform\");\r\n this._textureInfoName = state._getFreeVariableName(\"textureInfoName\");\r\n state._emitVaryingFromString(this._transformedUVName, \"vec2\", this._defineName);\r\n state._emitVaryingFromString(this._mainUVName, \"vec2\", this._mainUVDefineName);\r\n state._emitUniformFromString(this._textureTransformName, \"mat4\", this._defineName);\r\n state.compilationString += \"#ifdef \" + this._defineName + \"\\r\\n\";\r\n state.compilationString += this._transformedUVName + \" = vec2(\" + this._textureTransformName + \" * vec4(\" + uvInput.associatedVariableName + \".xy, 1.0, 0.0));\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._mainUVName + \" = \" + uvInput.associatedVariableName + \".xy;\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n };\r\n TextureBlock.prototype._writeOutput = function (state, output, swizzle) {\r\n var uvInput = this.uv;\r\n if (this.uv.ownerBlock.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n state.compilationString += this._declareOutput(output, state) + \" = texture2D(\" + this._samplerName + \", \" + uvInput.associatedVariableName + \").\" + swizzle + \";\\r\\n\";\r\n return;\r\n }\r\n var complement = \" * \" + this._textureInfoName;\r\n state.compilationString += \"#ifdef \" + this._defineName + \"\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + \" = texture2D(\" + this._samplerName + \", \" + this._transformedUVName + \").\" + swizzle + complement + \";\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + \" = texture2D(\" + this._samplerName + \", \" + (\"vMain\" + uvInput.associatedVariableName) + \").\" + swizzle + complement + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n };\r\n TextureBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (state.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) {\r\n // Vertex\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n state.sharedData.blockingBlocks.push(this);\r\n state.sharedData.textureBlocks.push(this);\r\n this._samplerName = state._getFreeVariableName(this.name + \"Sampler\");\r\n state.samplers.push(this._samplerName);\r\n state._samplerDeclaration += \"uniform sampler2D \" + this._samplerName + \";\\r\\n\";\r\n // Fragment\r\n state.sharedData.bindableBlocks.push(this);\r\n if (this._isMixed) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n state._emitUniformFromString(this._textureInfoName, \"float\");\r\n }\r\n for (var _i = 0, _a = this._outputs; _i < _a.length; _i++) {\r\n var output = _a[_i];\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name);\r\n }\r\n }\r\n return this;\r\n };\r\n TextureBlock.prototype._dumpPropertiesCode = function () {\r\n if (!this.texture) {\r\n return \"\";\r\n }\r\n var codeString = this._codeVariableName + \".texture = new BABYLON.Texture(\\\"\" + this.texture.name + \"\\\");\\r\\n\";\r\n return codeString;\r\n };\r\n TextureBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.texture) {\r\n serializationObject.texture = this.texture.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n TextureBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.texture) {\r\n this.texture = _Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].Parse(serializationObject.texture, scene, rootUrl);\r\n }\r\n };\r\n return TextureBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.TextureBlock\"] = TextureBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/alphaTestBlock.ts\":\n/*!**********************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/alphaTestBlock.ts ***!\n \\**********************************************************/\n/*! exports provided: AlphaTestBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return AlphaTestBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add an alpha test in the fragment shader\r\n */\r\nvar AlphaTestBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AlphaTestBlock, _super);\r\n /**\r\n * Create a new AlphaTestBlock\r\n * @param name defines the block name\r\n */\r\n function AlphaTestBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n /**\r\n * Gets or sets the alpha value where alpha testing happens\r\n */\r\n _this.alphaCutOff = 0.4;\r\n _this.registerInput(\"color\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, true);\r\n _this.registerInput(\"alpha\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n AlphaTestBlock.prototype.getClassName = function () {\r\n return \"AlphaTestBlock\";\r\n };\r\n Object.defineProperty(AlphaTestBlock.prototype, \"color\", {\r\n /**\r\n * Gets the color input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AlphaTestBlock.prototype, \"alpha\", {\r\n /**\r\n * Gets the alpha input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n AlphaTestBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n state.sharedData.hints.needAlphaTesting = true;\r\n if (this.color.connectedPoint) {\r\n state.compilationString += \"if (\" + this.color.associatedVariableName + \".a < \" + this.alphaCutOff + \") discard;\\r\\n\";\r\n }\r\n else {\r\n state.compilationString += \"if (\" + this.alpha.associatedVariableName + \" < \" + this.alphaCutOff + \") discard;\\r\\n\";\r\n }\r\n return this;\r\n };\r\n AlphaTestBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".alphaCutOff = \" + this.alphaCutOff + \";\\r\\n\";\r\n return codeString;\r\n };\r\n AlphaTestBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.alphaCutOff = this.alphaCutOff;\r\n return serializationObject;\r\n };\r\n AlphaTestBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.alphaCutOff = serializationObject.alphaCutOff;\r\n };\r\n return AlphaTestBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.AlphaTestBlock\"] = AlphaTestBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts\":\n/*!***************************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts ***!\n \\***************************************************************/\n/*! exports provided: FragmentOutputBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return FragmentOutputBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to output the final color\r\n */\r\nvar FragmentOutputBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FragmentOutputBlock, _super);\r\n /**\r\n * Create a new FragmentOutputBlock\r\n * @param name defines the block name\r\n */\r\n function FragmentOutputBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment, true) || this;\r\n _this.registerInput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, true);\r\n _this.registerInput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, true);\r\n _this.registerInput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n FragmentOutputBlock.prototype.getClassName = function () {\r\n return \"FragmentOutputBlock\";\r\n };\r\n Object.defineProperty(FragmentOutputBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FragmentOutputBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FragmentOutputBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n FragmentOutputBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var rgba = this.rgba;\r\n var rgb = this.rgb;\r\n var a = this.a;\r\n state.sharedData.hints.needAlphaBlending = rgba.isConnected || a.isConnected;\r\n if (rgba.connectedPoint) {\r\n state.compilationString += \"gl_FragColor = \" + rgba.associatedVariableName + \";\\r\\n\";\r\n }\r\n else if (rgb.connectedPoint) {\r\n if (a.connectedPoint) {\r\n state.compilationString += \"gl_FragColor = vec4(\" + rgb.associatedVariableName + \", \" + a.associatedVariableName + \");\\r\\n\";\r\n }\r\n else {\r\n state.compilationString += \"gl_FragColor = vec4(\" + rgb.associatedVariableName + \", 1.0);\\r\\n\";\r\n }\r\n }\r\n else {\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(rgba);\r\n }\r\n return this;\r\n };\r\n return FragmentOutputBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.FragmentOutputBlock\"] = FragmentOutputBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/imageProcessingBlock.ts\":\n/*!****************************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/imageProcessingBlock.ts ***!\n \\****************************************************************/\n/*! exports provided: ImageProcessingBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return ImageProcessingBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add image processing support to fragment shader\r\n */\r\nvar ImageProcessingBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageProcessingBlock, _super);\r\n /**\r\n * Create a new ImageProcessingBlock\r\n * @param name defines the block name\r\n */\r\n function ImageProcessingBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"color\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this._inputs[0].acceptedConnectionPointTypes.push(_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ImageProcessingBlock.prototype.getClassName = function () {\r\n return \"ImageProcessingBlock\";\r\n };\r\n Object.defineProperty(ImageProcessingBlock.prototype, \"color\", {\r\n /**\r\n * Gets the color input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n ImageProcessingBlock.prototype.initialize = function (state) {\r\n state._excludeVariableName(\"exposureLinear\");\r\n state._excludeVariableName(\"contrast\");\r\n state._excludeVariableName(\"vInverseScreenSize\");\r\n state._excludeVariableName(\"vignetteSettings1\");\r\n state._excludeVariableName(\"vignetteSettings2\");\r\n state._excludeVariableName(\"vCameraColorCurveNegative\");\r\n state._excludeVariableName(\"vCameraColorCurveNeutral\");\r\n state._excludeVariableName(\"vCameraColorCurvePositive\");\r\n state._excludeVariableName(\"txColorTransform\");\r\n state._excludeVariableName(\"colorTransformSettings\");\r\n };\r\n ImageProcessingBlock.prototype.isReady = function (mesh, nodeMaterial, defines) {\r\n if (defines._areImageProcessingDirty && nodeMaterial.imageProcessingConfiguration) {\r\n if (!nodeMaterial.imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n ImageProcessingBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (defines._areImageProcessingDirty && nodeMaterial.imageProcessingConfiguration) {\r\n nodeMaterial.imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n };\r\n ImageProcessingBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n if (!nodeMaterial.imageProcessingConfiguration) {\r\n return;\r\n }\r\n nodeMaterial.imageProcessingConfiguration.bind(effect);\r\n };\r\n ImageProcessingBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Register for blocking\r\n state.sharedData.blockingBlocks.push(this);\r\n // Register for binding\r\n state.sharedData.bindableBlocks.push(this);\r\n // Uniforms\r\n state.uniforms.push(\"exposureLinear\");\r\n state.uniforms.push(\"contrast\");\r\n state.uniforms.push(\"vInverseScreenSize\");\r\n state.uniforms.push(\"vignetteSettings1\");\r\n state.uniforms.push(\"vignetteSettings2\");\r\n state.uniforms.push(\"vCameraColorCurveNegative\");\r\n state.uniforms.push(\"vCameraColorCurveNeutral\");\r\n state.uniforms.push(\"vCameraColorCurvePositive\");\r\n state.uniforms.push(\"txColorTransform\");\r\n state.uniforms.push(\"colorTransformSettings\");\r\n // Emit code\r\n var color = this.color;\r\n var output = this._outputs[0];\r\n var comments = \"//\" + this.name;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n state._emitFunctionFromInclude(\"imageProcessingDeclaration\", comments);\r\n state._emitFunctionFromInclude(\"imageProcessingFunctions\", comments);\r\n if (color.connectedPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4) {\r\n state.compilationString += this._declareOutput(output, state) + \" = \" + color.associatedVariableName + \";\\r\\n\";\r\n }\r\n else {\r\n state.compilationString += this._declareOutput(output, state) + \" = vec4(\" + color.associatedVariableName + \", 1.0);\\r\\n\";\r\n }\r\n state.compilationString += \"#ifdef IMAGEPROCESSINGPOSTPROCESS\\r\\n\";\r\n state.compilationString += output.associatedVariableName + \".rgb = toLinearSpace(\" + color.associatedVariableName + \".rgb);\\r\\n\";\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += \"#ifdef IMAGEPROCESSING\\r\\n\";\r\n state.compilationString += output.associatedVariableName + \".rgb = toLinearSpace(\" + color.associatedVariableName + \".rgb);\\r\\n\";\r\n state.compilationString += output.associatedVariableName + \" = applyImageProcessing(\" + output.associatedVariableName + \");\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n return this;\r\n };\r\n return ImageProcessingBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ImageProcessingBlock\"] = ImageProcessingBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/index.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/index.ts ***!\n \\*************************************************/\n/*! exports provided: FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fragmentOutputBlock */ \"./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_0__[\"FragmentOutputBlock\"]; });\n\n/* harmony import */ var _alphaTestBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./alphaTestBlock */ \"./Materials/Node/Blocks/Fragment/alphaTestBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _alphaTestBlock__WEBPACK_IMPORTED_MODULE_1__[\"AlphaTestBlock\"]; });\n\n/* harmony import */ var _imageProcessingBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./imageProcessingBlock */ \"./Materials/Node/Blocks/Fragment/imageProcessingBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _imageProcessingBlock__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingBlock\"]; });\n\n/* harmony import */ var _perturbNormalBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./perturbNormalBlock */ \"./Materials/Node/Blocks/Fragment/perturbNormalBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _perturbNormalBlock__WEBPACK_IMPORTED_MODULE_3__[\"PerturbNormalBlock\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Fragment/perturbNormalBlock.ts\":\n/*!**************************************************************!*\\\n !*** ./Materials/Node/Blocks/Fragment/perturbNormalBlock.ts ***!\n \\**************************************************************/\n/*! exports provided: PerturbNormalBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return PerturbNormalBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to pertub normals based on a normal map\r\n */\r\nvar PerturbNormalBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PerturbNormalBlock, _super);\r\n /**\r\n * Create a new PerturbNormalBlock\r\n * @param name defines the block name\r\n */\r\n function PerturbNormalBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this._tangentSpaceParameterName = \"\";\r\n /** Gets or sets a boolean indicating that normal should be inverted on X axis */\r\n _this.invertX = false;\r\n /** Gets or sets a boolean indicating that normal should be inverted on Y axis */\r\n _this.invertY = false;\r\n // Vertex\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false);\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false);\r\n _this.registerInput(\"uv\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2, false);\r\n _this.registerInput(\"normalMapColor\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, false);\r\n _this.registerInput(\"strength\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, false);\r\n // Fragment\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n PerturbNormalBlock.prototype.getClassName = function () {\r\n return \"PerturbNormalBlock\";\r\n };\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"uv\", {\r\n /**\r\n * Gets the uv input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"normalMapColor\", {\r\n /**\r\n * Gets the normal map color input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"strength\", {\r\n /**\r\n * Gets the strength input component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerturbNormalBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n PerturbNormalBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n defines.setValue(\"BUMP\", true);\r\n };\r\n PerturbNormalBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n effect.setFloat2(this._tangentSpaceParameterName, this.invertX ? -1 : 1, this.invertY ? -1 : 1);\r\n };\r\n PerturbNormalBlock.prototype.autoConfigure = function (material) {\r\n if (!this.uv.isConnected) {\r\n var uvInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"uv\"; });\r\n if (!uvInput) {\r\n uvInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"uv\");\r\n uvInput.setAsAttribute();\r\n }\r\n uvInput.output.connectTo(this.uv);\r\n }\r\n if (!this.strength.isConnected) {\r\n var strengthInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"strength\");\r\n strengthInput.value = 1.0;\r\n strengthInput.output.connectTo(this.strength);\r\n }\r\n };\r\n PerturbNormalBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var comments = \"//\" + this.name;\r\n var uv = this.uv;\r\n var worldPosition = this.worldPosition;\r\n var worldNormal = this.worldNormal;\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n this._tangentSpaceParameterName = state._getFreeDefineName(\"tangentSpaceParameter\");\r\n state._emitUniformFromString(this._tangentSpaceParameterName, \"vec2\");\r\n state._emitExtension(\"bump\", \"#extension GL_OES_standard_derivatives : enable\");\r\n state._emitFunctionFromInclude(\"bumpFragmentFunctions\", comments, {\r\n replaceStrings: [\r\n { search: /vBumpInfos.y/g, replace: \"1.0 / \" + this.strength.associatedVariableName },\r\n { search: /vTangentSpaceParams/g, replace: this._tangentSpaceParameterName },\r\n { search: /vPositionW/g, replace: worldPosition.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n state.compilationString += this._declareOutput(this.output, state) + \" = vec4(0.);\\r\\n\";\r\n state.compilationString += state._emitCodeFromInclude(\"bumpFragment\", comments, {\r\n replaceStrings: [\r\n { search: /perturbNormal\\(TBN,vBumpUV\\+uvOffset\\)/g, replace: \"perturbNormal(TBN, \" + this.normalMapColor.associatedVariableName + \")\" },\r\n { search: /vBumpInfos.y/g, replace: \"1.0 / \" + this.strength.associatedVariableName },\r\n { search: /vBumpUV/g, replace: uv.associatedVariableName },\r\n { search: /vPositionW/g, replace: worldPosition.associatedVariableName + \".xyz\" },\r\n { search: /normalW=/g, replace: this.output.associatedVariableName + \".xyz = \" },\r\n { search: /normalW/g, replace: worldNormal.associatedVariableName + \".xyz\" }\r\n ]\r\n });\r\n return this;\r\n };\r\n PerturbNormalBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".invertX = \" + this.invertX + \";\\r\\n\";\r\n codeString += this._codeVariableName + \".invertY = \" + this.invertY + \";\\r\\n\";\r\n return codeString;\r\n };\r\n PerturbNormalBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.invertX = this.invertX;\r\n serializationObject.invertY = this.invertY;\r\n return serializationObject;\r\n };\r\n PerturbNormalBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.invertX = serializationObject.invertX;\r\n this.invertY = serializationObject.invertY;\r\n };\r\n return PerturbNormalBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PerturbNormalBlock\"] = PerturbNormalBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts\":\n/*!****************************************************************!*\\\n !*** ./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts ***!\n \\****************************************************************/\n/*! exports provided: AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return AnimatedInputBlockTypes; });\n/**\r\n * Enum defining the type of animations supported by InputBlock\r\n */\r\nvar AnimatedInputBlockTypes;\r\n(function (AnimatedInputBlockTypes) {\r\n /** No animation */\r\n AnimatedInputBlockTypes[AnimatedInputBlockTypes[\"None\"] = 0] = \"None\";\r\n /** Time based animation. Will only work for floats */\r\n AnimatedInputBlockTypes[AnimatedInputBlockTypes[\"Time\"] = 1] = \"Time\";\r\n})(AnimatedInputBlockTypes || (AnimatedInputBlockTypes = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Input/index.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Node/Blocks/Input/index.ts ***!\n \\**********************************************/\n/*! exports provided: InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _inputBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _inputBlock__WEBPACK_IMPORTED_MODULE_0__[\"InputBlock\"]; });\n\n/* harmony import */ var _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./animatedInputBlockTypes */ \"./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_1__[\"AnimatedInputBlockTypes\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Input/inputBlock.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Node/Blocks/Input/inputBlock.ts ***!\n \\***************************************************/\n/*! exports provided: InputBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return InputBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../NodeMaterialBlockConnectionPointMode */ \"./Materials/Node/NodeMaterialBlockConnectionPointMode.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../Maths/math */ \"./Maths/math.ts\");\n/* harmony import */ var _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./animatedInputBlockTypes */ \"./Materials/Node/Blocks/Input/animatedInputBlockTypes.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nvar InputBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InputBlock, _super);\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param target defines the target of that block (Vertex by default)\r\n * @param type defines the type of the input (can be set to NodeMaterialBlockConnectionPointTypes.AutoDetect)\r\n */\r\n function InputBlock(name, target, type) {\r\n if (target === void 0) { target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_6__[\"NodeMaterialBlockTargets\"].Vertex; }\r\n if (type === void 0) { type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect; }\r\n var _this = _super.call(this, name, target, false, true) || this;\r\n _this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n _this._animationType = _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__[\"AnimatedInputBlockTypes\"].None;\r\n /** @hidden */\r\n _this._systemValue = null;\r\n /** Gets or sets a boolean indicating that this input can be edited in the Inspector (false by default) */\r\n _this.visibleInInspector = false;\r\n _this._type = type;\r\n _this.setDefaultValue();\r\n _this.registerOutput(\"output\", type);\r\n return _this;\r\n }\r\n Object.defineProperty(InputBlock.prototype, \"type\", {\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n get: function () {\r\n if (this._type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect) {\r\n if (this.isUniform && this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float;\r\n return this._type;\r\n }\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3;\r\n return this._type;\r\n case \"Vector4\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4;\r\n return this._type;\r\n case \"Color3\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3;\r\n return this._type;\r\n case \"Color4\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4;\r\n return this._type;\r\n }\r\n }\r\n if (this.isAttribute) {\r\n switch (this.name) {\r\n case \"position\":\r\n case \"normal\":\r\n case \"tangent\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3;\r\n return this._type;\r\n case \"uv\":\r\n case \"uv2\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2;\r\n return this._type;\r\n case \"matricesIndices\":\r\n case \"matricesWeights\":\r\n case \"world0\":\r\n case \"world1\":\r\n case \"world2\":\r\n case \"world3\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4;\r\n return this._type;\r\n case \"color\":\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4;\r\n return this._type;\r\n }\r\n }\r\n if (this.isSystemValue) {\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].View:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].ViewProjection:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].Projection:\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix;\r\n return this._type;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].CameraPosition:\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3;\r\n return this._type;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].FogColor:\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3;\r\n return this._type;\r\n }\r\n }\r\n }\r\n return this._type;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Set the source of this connection point to a vertex attribute\r\n * @param attributeName defines the attribute name (position, uv, normal, etc...). If not specified it will take the connection point name\r\n * @returns the current connection point\r\n */\r\n InputBlock.prototype.setAsAttribute = function (attributeName) {\r\n if (attributeName) {\r\n this.name = attributeName;\r\n }\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Attribute;\r\n return this;\r\n };\r\n /**\r\n * Set the source of this connection point to a system value\r\n * @param value define the system value to use (world, view, etc...) or null to switch to manual value\r\n * @returns the current connection point\r\n */\r\n InputBlock.prototype.setAsSystemValue = function (value) {\r\n this.systemValue = value;\r\n return this;\r\n };\r\n Object.defineProperty(InputBlock.prototype, \"value\", {\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n get: function () {\r\n return this._storedValue;\r\n },\r\n set: function (value) {\r\n this._storedValue = value;\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"valueCallback\", {\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n get: function () {\r\n return this._valueCallback;\r\n },\r\n set: function (value) {\r\n this._valueCallback = value;\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"associatedVariableName\", {\r\n /**\r\n * Gets or sets the associated variable name in the shader\r\n */\r\n get: function () {\r\n return this._associatedVariableName;\r\n },\r\n set: function (value) {\r\n this._associatedVariableName = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"animationType\", {\r\n /** Gets or sets the type of animation applied to the input */\r\n get: function () {\r\n return this._animationType;\r\n },\r\n set: function (value) {\r\n this._animationType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isUndefined\", {\r\n /**\r\n * Gets a boolean indicating that this connection point not defined yet\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isUniform\", {\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is coming from an uniform.\r\n * In this case the connection point name must be the name of the uniform to use.\r\n * Can only be set on inputs\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n },\r\n set: function (value) {\r\n this._mode = value ? _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform : _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n this.associatedVariableName = \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isAttribute\", {\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is coming from an attribute.\r\n * In this case the connection point name must be the name of the attribute to use\r\n * Can only be set on inputs\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Attribute;\r\n },\r\n set: function (value) {\r\n this._mode = value ? _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Attribute : _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n this.associatedVariableName = \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isVarying\", {\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is generating a varying variable.\r\n * Can only be set on exit points\r\n */\r\n get: function () {\r\n return this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Varying;\r\n },\r\n set: function (value) {\r\n this._mode = value ? _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Varying : _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Undefined;\r\n this.associatedVariableName = \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"isSystemValue\", {\r\n /**\r\n * Gets a boolean indicating that the current connection point is a system value\r\n */\r\n get: function () {\r\n return this._systemValue != null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputBlock.prototype, \"systemValue\", {\r\n /**\r\n * Gets or sets the current well known value or null if not defined as a system value\r\n */\r\n get: function () {\r\n return this._systemValue;\r\n },\r\n set: function (value) {\r\n this._mode = _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform;\r\n this.associatedVariableName = \"\";\r\n this._systemValue = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n InputBlock.prototype.getClassName = function () {\r\n return \"InputBlock\";\r\n };\r\n /**\r\n * Animate the input if animationType !== None\r\n * @param scene defines the rendering scene\r\n */\r\n InputBlock.prototype.animate = function (scene) {\r\n switch (this._animationType) {\r\n case _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__[\"AnimatedInputBlockTypes\"].Time: {\r\n if (this.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float) {\r\n this.value += scene.getAnimationRatio() * 0.01;\r\n }\r\n break;\r\n }\r\n }\r\n };\r\n InputBlock.prototype._emitDefine = function (define) {\r\n if (define[0] === \"!\") {\r\n return \"#ifndef \" + define.substring(1) + \"\\r\\n\";\r\n }\r\n return \"#ifdef \" + define + \"\\r\\n\";\r\n };\r\n /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n InputBlock.prototype.setDefaultValue = function () {\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n this.value = 0;\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].Zero();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector4\"].Zero();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n this.value = _Maths_math__WEBPACK_IMPORTED_MODULE_8__[\"Color3\"].White();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n this.value = new _Maths_math__WEBPACK_IMPORTED_MODULE_8__[\"Color4\"](1, 1, 1, 1);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix:\r\n this.value = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n break;\r\n }\r\n };\r\n InputBlock.prototype._dumpPropertiesCode = function () {\r\n if (this.isAttribute) {\r\n return this._codeVariableName + \".setAsAttribute(\\\"\" + this.name + \"\\\");\\r\\n\";\r\n }\r\n if (this.isSystemValue) {\r\n return this._codeVariableName + \".setAsSystemValue(BABYLON.NodeMaterialSystemValues.\" + _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"][this._systemValue] + \");\\r\\n\";\r\n }\r\n if (this.isUniform) {\r\n var valueString = \"\";\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n valueString = this.value.toString();\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n valueString = \"new BABYLON.Vector2(\" + this.value.x + \", \" + this.value.y + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n valueString = \"new BABYLON.Vector3(\" + this.value.x + \", \" + this.value.y + \", \" + this.value.z + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n valueString = \"new BABYLON.Vector4(\" + this.value.x + \", \" + this.value.y + \", \" + this.value.z + \", \" + this.value.w + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n valueString = \"new BABYLON.Color3(\" + this.value.r + \", \" + this.value.g + \", \" + this.value.b + \")\";\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n valueString = \"new BABYLON.Color4(\" + this.value.r + \", \" + this.value.g + \", \" + this.value.b + \", \" + this.value.a + \")\";\r\n break;\r\n }\r\n return this._codeVariableName + \".value = \" + valueString + \";\\r\\n\";\r\n }\r\n return \"\";\r\n };\r\n InputBlock.prototype._emit = function (state, define) {\r\n // Uniforms\r\n if (this.isUniform) {\r\n if (!this.associatedVariableName) {\r\n this.associatedVariableName = state._getFreeVariableName(\"u_\" + this.name);\r\n }\r\n if (state.uniforms.indexOf(this.associatedVariableName) !== -1) {\r\n return;\r\n }\r\n state.uniforms.push(this.associatedVariableName);\r\n if (define) {\r\n state._uniformDeclaration += this._emitDefine(define);\r\n }\r\n state._uniformDeclaration += \"uniform \" + state._getGLType(this.type) + \" \" + this.associatedVariableName + \";\\r\\n\";\r\n if (define) {\r\n state._uniformDeclaration += \"#endif\\r\\n\";\r\n }\r\n // well known\r\n var hints = state.sharedData.hints;\r\n if (this._systemValue !== null && this._systemValue !== undefined) {\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n hints.needWorldViewMatrix = true;\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n hints.needWorldViewProjectionMatrix = true;\r\n break;\r\n }\r\n }\r\n else {\r\n if (this._animationType !== _animatedInputBlockTypes__WEBPACK_IMPORTED_MODULE_9__[\"AnimatedInputBlockTypes\"].None) {\r\n state.sharedData.animatedInputs.push(this);\r\n }\r\n }\r\n return;\r\n }\r\n // Attribute\r\n if (this.isAttribute) {\r\n this.associatedVariableName = this.name;\r\n if (this.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_6__[\"NodeMaterialBlockTargets\"].Vertex && state._vertexState) { // Attribute for fragment need to be carried over by varyings\r\n this._emit(state._vertexState, define);\r\n return;\r\n }\r\n if (state.attributes.indexOf(this.associatedVariableName) !== -1) {\r\n return;\r\n }\r\n state.attributes.push(this.associatedVariableName);\r\n if (define) {\r\n state._attributeDeclaration += this._emitDefine(define);\r\n }\r\n state._attributeDeclaration += \"attribute \" + state._getGLType(this.type) + \" \" + this.associatedVariableName + \";\\r\\n\";\r\n if (define) {\r\n state._attributeDeclaration += \"#endif\\r\\n\";\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputBlock.prototype._transmitWorld = function (effect, world, worldView, worldViewProjection) {\r\n if (!this._systemValue) {\r\n return;\r\n }\r\n var variableName = this.associatedVariableName;\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World:\r\n effect.setMatrix(variableName, world);\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n effect.setMatrix(variableName, worldView);\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n effect.setMatrix(variableName, worldViewProjection);\r\n break;\r\n }\r\n };\r\n /** @hidden */\r\n InputBlock.prototype._transmit = function (effect, scene) {\r\n if (this.isAttribute) {\r\n return;\r\n }\r\n var variableName = this.associatedVariableName;\r\n if (this._systemValue) {\r\n switch (this._systemValue) {\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldView:\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].WorldViewProjection:\r\n return;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].View:\r\n effect.setMatrix(variableName, scene.getViewMatrix());\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].Projection:\r\n effect.setMatrix(variableName, scene.getProjectionMatrix());\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].ViewProjection:\r\n effect.setMatrix(variableName, scene.getTransformMatrix());\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].CameraPosition:\r\n effect.setVector3(variableName, scene.activeCamera.globalPosition);\r\n break;\r\n case _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].FogColor:\r\n effect.setColor3(variableName, scene.fogColor);\r\n break;\r\n }\r\n return;\r\n }\r\n var value = this._valueCallback ? this._valueCallback() : this._storedValue;\r\n if (value === null) {\r\n return;\r\n }\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n effect.setFloat(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Int:\r\n effect.setInt(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n effect.setColor3(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n effect.setDirectColor4(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n effect.setVector2(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n effect.setVector3(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n effect.setVector4(variableName, value);\r\n break;\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix:\r\n effect.setMatrix(variableName, value);\r\n break;\r\n }\r\n };\r\n InputBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n if (this.isUniform || this.isSystemValue) {\r\n state.sharedData.inputBlocks.push(this);\r\n }\r\n this._emit(state);\r\n };\r\n InputBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.type = this.type;\r\n serializationObject.mode = this._mode;\r\n serializationObject.systemValue = this._systemValue;\r\n serializationObject.animationType = this._animationType;\r\n serializationObject.visibleInInspector = this.visibleInInspector;\r\n if (this._storedValue != null && this._mode === _NodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointMode\"].Uniform) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n }\r\n else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n InputBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this._type = serializationObject.type;\r\n this._mode = serializationObject.mode;\r\n this._systemValue = serializationObject.systemValue || serializationObject.wellKnownValue;\r\n this._animationType = serializationObject.animationType;\r\n this.visibleInInspector = serializationObject.visibleInInspector;\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n }\r\n else {\r\n var valueType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].GetClass(serializationObject.valueType);\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n };\r\n return InputBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.InputBlock\"] = InputBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/bonesBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/bonesBlock.ts ***!\n \\****************************************************/\n/*! exports provided: BonesBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return BonesBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add support for vertex skinning (bones)\r\n */\r\nvar BonesBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BonesBlock, _super);\r\n /**\r\n * Creates a new BonesBlock\r\n * @param name defines the block name\r\n */\r\n function BonesBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this.registerInput(\"matricesIndices\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"matricesWeights\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"matricesIndicesExtra\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, true);\r\n _this.registerInput(\"matricesWeightsExtra\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, true);\r\n _this.registerInput(\"world\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n return _this;\r\n }\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n BonesBlock.prototype.initialize = function (state) {\r\n state._excludeVariableName(\"boneSampler\");\r\n state._excludeVariableName(\"boneTextureWidth\");\r\n state._excludeVariableName(\"mBones\");\r\n state._excludeVariableName(\"BonesPerMesh\");\r\n };\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n BonesBlock.prototype.getClassName = function () {\r\n return \"BonesBlock\";\r\n };\r\n Object.defineProperty(BonesBlock.prototype, \"matricesIndices\", {\r\n /**\r\n * Gets the matrix indices input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"matricesWeights\", {\r\n /**\r\n * Gets the matrix weights input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"matricesIndicesExtra\", {\r\n /**\r\n * Gets the extra matrix indices input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"matricesWeightsExtra\", {\r\n /**\r\n * Gets the extra matrix weights input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"world\", {\r\n /**\r\n * Gets the world input component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BonesBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n BonesBlock.prototype.autoConfigure = function (material) {\r\n if (!this.matricesIndices.isConnected) {\r\n var matricesIndicesInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"matricesIndices\"; });\r\n if (!matricesIndicesInput) {\r\n matricesIndicesInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"matricesIndices\");\r\n matricesIndicesInput.setAsAttribute(\"matricesIndices\");\r\n }\r\n matricesIndicesInput.output.connectTo(this.matricesIndices);\r\n }\r\n if (!this.matricesWeights.isConnected) {\r\n var matricesWeightsInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"matricesWeights\"; });\r\n if (!matricesWeightsInput) {\r\n matricesWeightsInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"matricesWeights\");\r\n matricesWeightsInput.setAsAttribute(\"matricesWeights\");\r\n }\r\n matricesWeightsInput.output.connectTo(this.matricesWeights);\r\n }\r\n if (!this.world.isConnected) {\r\n var worldInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].World; });\r\n if (!worldInput) {\r\n worldInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialSystemValues\"].World);\r\n }\r\n worldInput.output.connectTo(this.world);\r\n }\r\n };\r\n BonesBlock.prototype.provideFallbacks = function (mesh, fallbacks) {\r\n if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n };\r\n BonesBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindBonesParameters(mesh, effect);\r\n };\r\n BonesBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areAttributesDirty) {\r\n return;\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PrepareDefinesForBones(mesh, defines);\r\n };\r\n BonesBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for compilation fallbacks\r\n state.sharedData.blocksWithFallbacks.push(this);\r\n // Register for binding\r\n state.sharedData.bindableBlocks.push(this);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Register internal uniforms and samplers\r\n state.uniforms.push(\"boneTextureWidth\");\r\n state.uniforms.push(\"mBones\");\r\n state.samplers.push(\"boneSampler\");\r\n // Emit code\r\n var comments = \"//\" + this.name;\r\n state._emitFunctionFromInclude(\"bonesDeclaration\", comments, {\r\n removeAttributes: true,\r\n removeUniforms: false,\r\n removeVaryings: true,\r\n removeIfDef: false\r\n });\r\n var influenceVariablename = state._getFreeVariableName(\"influence\");\r\n state.compilationString += state._emitCodeFromInclude(\"bonesVertex\", comments, {\r\n replaceStrings: [\r\n {\r\n search: /finalWorld=finalWorld\\*influence;/,\r\n replace: \"\"\r\n },\r\n {\r\n search: /influence/gm,\r\n replace: influenceVariablename\r\n }\r\n ]\r\n });\r\n var output = this._outputs[0];\r\n var worldInput = this.world;\r\n state.compilationString += \"#if NUM_BONE_INFLUENCERS>0\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + worldInput.associatedVariableName + \" * \" + influenceVariablename + \";\\r\\n\");\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + worldInput.associatedVariableName + \";\\r\\n\");\r\n state.compilationString += \"#endif\\r\\n\";\r\n return this;\r\n };\r\n return BonesBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.BonesBlock\"] = BonesBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/index.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/index.ts ***!\n \\***********************************************/\n/*! exports provided: VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _vertexOutputBlock__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vertexOutputBlock */ \"./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _vertexOutputBlock__WEBPACK_IMPORTED_MODULE_0__[\"VertexOutputBlock\"]; });\n\n/* harmony import */ var _bonesBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bonesBlock */ \"./Materials/Node/Blocks/Vertex/bonesBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _bonesBlock__WEBPACK_IMPORTED_MODULE_1__[\"BonesBlock\"]; });\n\n/* harmony import */ var _instancesBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./instancesBlock */ \"./Materials/Node/Blocks/Vertex/instancesBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _instancesBlock__WEBPACK_IMPORTED_MODULE_2__[\"InstancesBlock\"]; });\n\n/* harmony import */ var _morphTargetsBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./morphTargetsBlock */ \"./Materials/Node/Blocks/Vertex/morphTargetsBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _morphTargetsBlock__WEBPACK_IMPORTED_MODULE_3__[\"MorphTargetsBlock\"]; });\n\n/* harmony import */ var _lightInformationBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lightInformationBlock */ \"./Materials/Node/Blocks/Vertex/lightInformationBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _lightInformationBlock__WEBPACK_IMPORTED_MODULE_4__[\"LightInformationBlock\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/instancesBlock.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/instancesBlock.ts ***!\n \\********************************************************/\n/*! exports provided: InstancesBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return InstancesBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add support for instances\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n */\r\nvar InstancesBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InstancesBlock, _super);\r\n /**\r\n * Creates a new InstancesBlock\r\n * @param name defines the block name\r\n */\r\n function InstancesBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this.registerInput(\"world0\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world1\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world2\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world3\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"world\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix, true);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n InstancesBlock.prototype.getClassName = function () {\r\n return \"InstancesBlock\";\r\n };\r\n Object.defineProperty(InstancesBlock.prototype, \"world0\", {\r\n /**\r\n * Gets the first world row input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world1\", {\r\n /**\r\n * Gets the second world row input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world2\", {\r\n /**\r\n * Gets the third world row input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world3\", {\r\n /**\r\n * Gets the forth world row input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"world\", {\r\n /**\r\n * Gets the world input component\r\n */\r\n get: function () {\r\n return this._inputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancesBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InstancesBlock.prototype.autoConfigure = function (material) {\r\n if (!this.world0.connectedPoint) {\r\n var world0Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world0\"; });\r\n if (!world0Input) {\r\n world0Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world0\");\r\n world0Input.setAsAttribute(\"world0\");\r\n }\r\n world0Input.output.connectTo(this.world0);\r\n }\r\n if (!this.world1.connectedPoint) {\r\n var world1Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world1\"; });\r\n if (!world1Input) {\r\n world1Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world1\");\r\n world1Input.setAsAttribute(\"world1\");\r\n }\r\n world1Input.output.connectTo(this.world1);\r\n }\r\n if (!this.world2.connectedPoint) {\r\n var world2Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world2\"; });\r\n if (!world2Input) {\r\n world2Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world2\");\r\n world2Input.setAsAttribute(\"world2\");\r\n }\r\n world2Input.output.connectTo(this.world2);\r\n }\r\n if (!this.world3.connectedPoint) {\r\n var world3Input = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world3\"; });\r\n if (!world3Input) {\r\n world3Input = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world3\");\r\n world3Input.setAsAttribute(\"world3\");\r\n }\r\n world3Input.output.connectTo(this.world3);\r\n }\r\n if (!this.world.connectedPoint) {\r\n var worldInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"world\"; });\r\n if (!worldInput) {\r\n worldInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialSystemValues\"].World);\r\n }\r\n worldInput.output.connectTo(this.world);\r\n }\r\n this.world.define = \"!INSTANCES\";\r\n };\r\n InstancesBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n var changed = false;\r\n if (defines[\"INSTANCES\"] !== useInstances) {\r\n defines.setValue(\"INSTANCES\", useInstances);\r\n changed = true;\r\n }\r\n if (changed) {\r\n defines.markAsUnprocessed();\r\n }\r\n };\r\n InstancesBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Emit code\r\n var output = this._outputs[0];\r\n var world0 = this.world0;\r\n var world1 = this.world1;\r\n var world2 = this.world2;\r\n var world3 = this.world3;\r\n state.compilationString += \"#ifdef INSTANCES\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = mat4(\" + world0.associatedVariableName + \", \" + world1.associatedVariableName + \", \" + world2.associatedVariableName + \", \" + world3.associatedVariableName + \");\\r\\n\");\r\n state.compilationString += \"#else\\r\\n\";\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.world.associatedVariableName + \";\\r\\n\");\r\n state.compilationString += \"#endif\\r\\n\";\r\n return this;\r\n };\r\n return InstancesBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.InstancesBlock\"] = InstancesBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/lightInformationBlock.ts\":\n/*!***************************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/lightInformationBlock.ts ***!\n \\***************************************************************/\n/*! exports provided: LightInformationBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return LightInformationBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Lights_pointLight__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Lights/pointLight */ \"./Lights/pointLight.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get data information from a light\r\n */\r\nvar LightInformationBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LightInformationBlock, _super);\r\n /**\r\n * Creates a new LightInformationBlock\r\n * @param name defines the block name\r\n */\r\n function LightInformationBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, false, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex);\r\n _this.registerOutput(\"direction\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"color\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n LightInformationBlock.prototype.getClassName = function () {\r\n return \"LightInformationBlock\";\r\n };\r\n Object.defineProperty(LightInformationBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightInformationBlock.prototype, \"direction\", {\r\n /**\r\n * Gets the direction output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LightInformationBlock.prototype, \"color\", {\r\n /**\r\n * Gets the direction output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n LightInformationBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n if (!this.light || !this.light.isEnabled) {\r\n effect.setFloat3(this._lightDataDefineName, 0, 0, 0);\r\n effect.setFloat3(this._lightColorDefineName, 0, 0, 0);\r\n return;\r\n }\r\n this.light.transferToNodeMaterialEffect(effect, this._lightDataDefineName);\r\n effect.setColor3(this._lightColorDefineName, this.light.diffuse);\r\n };\r\n LightInformationBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n state.sharedData.bindableBlocks.push(this);\r\n var direction = this.direction;\r\n var color = this.color;\r\n if (!this.light) {\r\n state.compilationString += this._declareOutput(direction, state) + \" = vec3(0.);\\r\\n\";\r\n state.compilationString += this._declareOutput(color, state) + \" = vec3(0.);\\r\\n\";\r\n }\r\n else {\r\n this._lightDataDefineName = state._getFreeDefineName(\"lightData\");\r\n state._emitUniformFromString(this._lightDataDefineName, \"vec3\");\r\n this._lightColorDefineName = state._getFreeDefineName(\"lightColor\");\r\n state._emitUniformFromString(this._lightColorDefineName, \"vec3\");\r\n if (this.light instanceof _Lights_pointLight__WEBPACK_IMPORTED_MODULE_5__[\"PointLight\"]) {\r\n state.compilationString += this._declareOutput(direction, state) + (\" = normalize(\" + this._lightDataDefineName + \" - \" + this.worldPosition.associatedVariableName + \".xyz);\\r\\n\");\r\n }\r\n else {\r\n state.compilationString += this._declareOutput(direction, state) + (\" = \" + this._lightDataDefineName + \";\\r\\n\");\r\n }\r\n state.compilationString += this._declareOutput(color, state) + (\" = \" + this._lightColorDefineName + \";\\r\\n\");\r\n }\r\n return this;\r\n };\r\n LightInformationBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this.light) {\r\n serializationObject.lightId = this.light.id;\r\n }\r\n return serializationObject;\r\n };\r\n LightInformationBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n if (serializationObject.lightId) {\r\n this.light = scene.getLightByID(serializationObject.lightId);\r\n }\r\n };\r\n return LightInformationBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.LightInformationBlock\"] = LightInformationBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/morphTargetsBlock.ts\":\n/*!***********************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/morphTargetsBlock.ts ***!\n \\***********************************************************/\n/*! exports provided: MorphTargetsBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return MorphTargetsBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add morph targets support to vertex shader\r\n */\r\nvar MorphTargetsBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MorphTargetsBlock, _super);\r\n /**\r\n * Create a new MorphTargetsBlock\r\n * @param name defines the block name\r\n */\r\n function MorphTargetsBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n _this._repeatebleContentGenerated = 0;\r\n _this.registerInput(\"position\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"normal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"tangent\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"uv\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n _this.registerOutput(\"positionOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"normalOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"tangentOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"uvOutput\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MorphTargetsBlock.prototype.getClassName = function () {\r\n return \"MorphTargetsBlock\";\r\n };\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"position\", {\r\n /**\r\n * Gets the position input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"normal\", {\r\n /**\r\n * Gets the normal input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"tangent\", {\r\n /**\r\n * Gets the tangent input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"uv\", {\r\n /**\r\n * Gets the tangent input component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"positionOutput\", {\r\n /**\r\n * Gets the position output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"normalOutput\", {\r\n /**\r\n * Gets the normal output component\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"tangentOutput\", {\r\n /**\r\n * Gets the tangent output component\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetsBlock.prototype, \"uvOutput\", {\r\n /**\r\n * Gets the tangent output component\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MorphTargetsBlock.prototype.initialize = function (state) {\r\n state._excludeVariableName(\"morphTargetInfluences\");\r\n };\r\n MorphTargetsBlock.prototype.autoConfigure = function (material) {\r\n if (!this.position.isConnected) {\r\n var positionInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"position\"; });\r\n if (!positionInput) {\r\n positionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"position\");\r\n positionInput.setAsAttribute();\r\n }\r\n positionInput.output.connectTo(this.position);\r\n }\r\n if (!this.normal.isConnected) {\r\n var normalInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"normal\"; });\r\n if (!normalInput) {\r\n normalInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"normal\");\r\n normalInput.setAsAttribute(\"normal\");\r\n }\r\n normalInput.output.connectTo(this.normal);\r\n }\r\n if (!this.tangent.isConnected) {\r\n var tangentInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"tangent\"; });\r\n if (!tangentInput) {\r\n tangentInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"tangent\");\r\n tangentInput.setAsAttribute(\"tangent\");\r\n }\r\n tangentInput.output.connectTo(this.tangent);\r\n }\r\n if (!this.uv.isConnected) {\r\n var uvInput = material.getInputBlockByPredicate(function (b) { return b.isAttribute && b.name === \"uv\"; });\r\n if (!uvInput) {\r\n uvInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"uv\");\r\n uvInput.setAsAttribute(\"uv\");\r\n }\r\n uvInput.output.connectTo(this.uv);\r\n }\r\n };\r\n MorphTargetsBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines) {\r\n if (!defines._areAttributesDirty) {\r\n return;\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMorphTargets(mesh, defines);\r\n };\r\n MorphTargetsBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n if (mesh && this._repeatebleContentGenerated) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, effect);\r\n }\r\n };\r\n MorphTargetsBlock.prototype.replaceRepeatableContent = function (vertexShaderState, fragmentShaderState, mesh, defines) {\r\n var position = this.position;\r\n var normal = this.normal;\r\n var tangent = this.tangent;\r\n var uv = this.uv;\r\n var positionOutput = this.positionOutput;\r\n var normalOutput = this.normalOutput;\r\n var tangentOutput = this.tangentOutput;\r\n var uvOutput = this.uvOutput;\r\n var state = vertexShaderState;\r\n var repeatCount = defines.NUM_MORPH_INFLUENCERS;\r\n this._repeatebleContentGenerated = repeatCount;\r\n var manager = mesh.morphTargetManager;\r\n var hasNormals = manager && manager.supportsNormals && defines[\"NORMAL\"];\r\n var hasTangents = manager && manager.supportsTangents && defines[\"TANGENT\"];\r\n var hasUVs = manager && manager.supportsUVs && defines[\"UV1\"];\r\n var injectionCode = \"\";\r\n for (var index = 0; index < repeatCount; index++) {\r\n injectionCode += \"#ifdef MORPHTARGETS\\r\\n\";\r\n injectionCode += positionOutput.associatedVariableName + \" += (position\" + index + \" - \" + position.associatedVariableName + \") * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n if (hasNormals) {\r\n injectionCode += \"#ifdef MORPHTARGETS_NORMAL\\r\\n\";\r\n injectionCode += normalOutput.associatedVariableName + \" += (normal\" + index + \" - \" + normal.associatedVariableName + \") * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n if (hasTangents) {\r\n injectionCode += \"#ifdef MORPHTARGETS_TANGENT\\r\\n\";\r\n injectionCode += tangentOutput.associatedVariableName + \".xyz += (tangent\" + index + \" - \" + tangent.associatedVariableName + \".xyz) * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n if (hasUVs) {\r\n injectionCode += \"#ifdef MORPHTARGETS_UV\\r\\n\";\r\n injectionCode += uvOutput.associatedVariableName + \".xyz += (uv_\" + index + \" - \" + uv.associatedVariableName + \".xyz) * morphTargetInfluences[\" + index + \"];\\r\\n\";\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n injectionCode += \"#endif\\r\\n\";\r\n }\r\n state.compilationString = state.compilationString.replace(this._repeatableContentAnchor, injectionCode);\r\n if (repeatCount > 0) {\r\n for (var index = 0; index < repeatCount; index++) {\r\n state.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind + index);\r\n if (hasNormals) {\r\n state.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind + index);\r\n }\r\n if (hasTangents) {\r\n state.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].TangentKind + index);\r\n }\r\n }\r\n }\r\n };\r\n MorphTargetsBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n // Register for defines\r\n state.sharedData.blocksWithDefines.push(this);\r\n // Register for binding\r\n state.sharedData.bindableBlocks.push(this);\r\n // Register for repeatable content generation\r\n state.sharedData.repeatableContentBlocks.push(this);\r\n // Emit code\r\n var position = this.position;\r\n var normal = this.normal;\r\n var tangent = this.tangent;\r\n var uv = this.uv;\r\n var positionOutput = this.positionOutput;\r\n var normalOutput = this.normalOutput;\r\n var tangentOutput = this.tangentOutput;\r\n var uvOutput = this.uvOutput;\r\n var comments = \"//\" + this.name;\r\n state.uniforms.push(\"morphTargetInfluences\");\r\n state._emitFunctionFromInclude(\"morphTargetsVertexGlobalDeclaration\", comments);\r\n state._emitFunctionFromInclude(\"morphTargetsVertexDeclaration\", comments, {\r\n repeatKey: \"maxSimultaneousMorphTargets\"\r\n });\r\n state.compilationString += this._declareOutput(positionOutput, state) + \" = \" + position.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#ifdef NORMAL\\r\\n\";\r\n state.compilationString += this._declareOutput(normalOutput, state) + \" = \" + normal.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef TANGENT\\r\\n\";\r\n state.compilationString += this._declareOutput(tangentOutput, state) + \" = \" + tangent.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n state.compilationString += \"#ifdef UV1\\r\\n\";\r\n state.compilationString += this._declareOutput(uvOutput, state) + \" = \" + uv.associatedVariableName + \";\\r\\n\";\r\n state.compilationString += \"#endif\\r\\n\";\r\n // Repeatable content\r\n this._repeatableContentAnchor = state._repeatableContentAnchor;\r\n state.compilationString += this._repeatableContentAnchor;\r\n return this;\r\n };\r\n return MorphTargetsBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MorphTargetsBlock\"] = MorphTargetsBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts\":\n/*!***********************************************************!*\\\n !*** ./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts ***!\n \\***********************************************************/\n/*! exports provided: VertexOutputBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return VertexOutputBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to output the vertex position\r\n */\r\nvar VertexOutputBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VertexOutputBlock, _super);\r\n /**\r\n * Creates a new VertexOutputBlock\r\n * @param name defines the block name\r\n */\r\n function VertexOutputBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex, true) || this;\r\n _this.registerInput(\"vector\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n VertexOutputBlock.prototype.getClassName = function () {\r\n return \"VertexOutputBlock\";\r\n };\r\n Object.defineProperty(VertexOutputBlock.prototype, \"vector\", {\r\n /**\r\n * Gets the vector input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VertexOutputBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var input = this.vector;\r\n state.compilationString += \"gl_Position = \" + input.associatedVariableName + \";\\r\\n\";\r\n return this;\r\n };\r\n return VertexOutputBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.VertexOutputBlock\"] = VertexOutputBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/addBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/addBlock.ts ***!\n \\*******************************************/\n/*! exports provided: AddBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return AddBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to add 2 vectors\r\n */\r\nvar AddBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AddBlock, _super);\r\n /**\r\n * Creates a new AddBlock\r\n * @param name defines the block name\r\n */\r\n function AddBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n AddBlock.prototype.getClassName = function () {\r\n return \"AddBlock\";\r\n };\r\n Object.defineProperty(AddBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AddBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AddBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n AddBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" + \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return AddBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.AddBlock\"] = AddBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/clampBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/clampBlock.ts ***!\n \\*********************************************/\n/*! exports provided: ClampBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return ClampBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to clamp a float\r\n */\r\nvar ClampBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ClampBlock, _super);\r\n /**\r\n * Creates a new ClampBlock\r\n * @param name defines the block name\r\n */\r\n function ClampBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n /** Gets or sets the minimum range */\r\n _this.minimum = 0.0;\r\n /** Gets or sets the maximum range */\r\n _this.maximum = 1.0;\r\n _this.registerInput(\"value\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ClampBlock.prototype.getClassName = function () {\r\n return \"ClampBlock\";\r\n };\r\n Object.defineProperty(ClampBlock.prototype, \"value\", {\r\n /**\r\n * Gets the value input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClampBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ClampBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = clamp(\" + this.value.associatedVariableName + \", \" + this._writeFloat(this.minimum) + \", \" + this._writeFloat(this.maximum) + \");\\r\\n\");\r\n return this;\r\n };\r\n ClampBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".minimum = \" + this.minimum + \";\\r\\n\";\r\n codeString += this._codeVariableName + \".maximum = \" + this.maximum + \";\\r\\n\";\r\n return codeString;\r\n };\r\n ClampBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.minimum = this.minimum;\r\n serializationObject.maximum = this.maximum;\r\n return serializationObject;\r\n };\r\n ClampBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.minimum = serializationObject.minimum;\r\n this.maximum = serializationObject.maximum;\r\n };\r\n return ClampBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ClampBlock\"] = ClampBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/colorMergerBlock.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Node/Blocks/colorMergerBlock.ts ***!\n \\***************************************************/\n/*! exports provided: ColorMergerBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return ColorMergerBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to create a Color3/4 out of individual inputs (one for each component)\r\n */\r\nvar ColorMergerBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorMergerBlock, _super);\r\n /**\r\n * Create a new ColorMergerBlock\r\n * @param name defines the block name\r\n */\r\n function ColorMergerBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerOutput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ColorMergerBlock.prototype.getClassName = function () {\r\n return \"ColorMergerBlock\";\r\n };\r\n Object.defineProperty(ColorMergerBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b component (input)\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a component (input)\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorMergerBlock.prototype, \"rgb\", {\r\n /**\r\n * Gets the rgb component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ColorMergerBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var rInput = this.r;\r\n var gInput = this.g;\r\n var bInput = this.b;\r\n var aInput = this.a;\r\n var color4Output = this._outputs[0];\r\n var color3Output = this._outputs[1];\r\n if (color4Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(color4Output, state) + (\" = vec4(\" + (rInput.isConnected ? this._writeVariable(rInput) : \"0.0\") + \", \" + (gInput.isConnected ? this._writeVariable(gInput) : \"0.0\") + \", \" + (bInput.isConnected ? this._writeVariable(bInput) : \"0.0\") + \", \" + (aInput.isConnected ? this._writeVariable(aInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n else if (color3Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(color3Output, state) + (\" = vec3(\" + (rInput.isConnected ? this._writeVariable(rInput) : \"0.0\") + \", \" + (gInput.isConnected ? this._writeVariable(gInput) : \"0.0\") + \", \" + (bInput.isConnected ? this._writeVariable(bInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return ColorMergerBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ColorMergerBlock\"] = ColorMergerBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/colorSplitterBlock.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/Node/Blocks/colorSplitterBlock.ts ***!\n \\*****************************************************/\n/*! exports provided: ColorSplitterBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return ColorSplitterBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to expand a Color3/4 into 4 outputs (one for each component)\r\n */\r\nvar ColorSplitterBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorSplitterBlock, _super);\r\n /**\r\n * Create a new ColorSplitterBlock\r\n * @param name defines the block name\r\n */\r\n function ColorSplitterBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"rgba\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color4, true);\r\n _this.registerInput(\"rgb \", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3, true);\r\n _this.registerOutput(\"rgb\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Color3);\r\n _this.registerOutput(\"r\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"g\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"b\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"a\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ColorSplitterBlock.prototype.getClassName = function () {\r\n return \"ColorSplitterBlock\";\r\n };\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"rgba\", {\r\n /**\r\n * Gets the rgba component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"rgbIn\", {\r\n /**\r\n * Gets the rgb component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"rgbOut\", {\r\n /**\r\n * Gets the rgb component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"r\", {\r\n /**\r\n * Gets the r component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"g\", {\r\n /**\r\n * Gets the g component (output)\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"b\", {\r\n /**\r\n * Gets the b component (output)\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorSplitterBlock.prototype, \"a\", {\r\n /**\r\n * Gets the a component (output)\r\n */\r\n get: function () {\r\n return this._outputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ColorSplitterBlock.prototype._inputRename = function (name) {\r\n if (name === \"rgb \") {\r\n return \"rgbIn\";\r\n }\r\n return name;\r\n };\r\n ColorSplitterBlock.prototype._outputRename = function (name) {\r\n if (name === \"rgb\") {\r\n return \"rgbOut\";\r\n }\r\n return name;\r\n };\r\n ColorSplitterBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var input = this.rgba.isConnected ? this.rgba : this.rgbIn;\r\n if (!input.isConnected) {\r\n return;\r\n }\r\n var rgbOutput = this._outputs[0];\r\n var rOutput = this._outputs[1];\r\n var gOutput = this._outputs[2];\r\n var bOutput = this._outputs[3];\r\n var aOutput = this._outputs[4];\r\n if (rgbOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(rgbOutput, state) + (\" = \" + input.associatedVariableName + \".rgb;\\r\\n\");\r\n }\r\n if (rOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(rOutput, state) + (\" = \" + input.associatedVariableName + \".r;\\r\\n\");\r\n }\r\n if (gOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(gOutput, state) + (\" = \" + input.associatedVariableName + \".g;\\r\\n\");\r\n }\r\n if (bOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(bOutput, state) + (\" = \" + input.associatedVariableName + \".b;\\r\\n\");\r\n }\r\n if (aOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(aOutput, state) + (\" = \" + input.associatedVariableName + \".a;\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return ColorSplitterBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ColorSplitterBlock\"] = ColorSplitterBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/crossBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/crossBlock.ts ***!\n \\*********************************************/\n/*! exports provided: CrossBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return CrossBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to apply a cross product between 2 vectors\r\n */\r\nvar CrossBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CrossBlock, _super);\r\n /**\r\n * Creates a new CrossBlock\r\n * @param name defines the block name\r\n */\r\n function CrossBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n CrossBlock.prototype.getClassName = function () {\r\n return \"CrossBlock\";\r\n };\r\n Object.defineProperty(CrossBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CrossBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CrossBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n CrossBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = cross(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return CrossBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.CrossBlock\"] = CrossBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/divideBlock.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Node/Blocks/divideBlock.ts ***!\n \\**********************************************/\n/*! exports provided: DivideBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return DivideBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to divide 2 vectors\r\n */\r\nvar DivideBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DivideBlock, _super);\r\n /**\r\n * Creates a new DivideBlock\r\n * @param name defines the block name\r\n */\r\n function DivideBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n DivideBlock.prototype.getClassName = function () {\r\n return \"DivideBlock\";\r\n };\r\n Object.defineProperty(DivideBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DivideBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DivideBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DivideBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" / \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return DivideBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DivideBlock\"] = DivideBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/dotBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/dotBlock.ts ***!\n \\*******************************************/\n/*! exports provided: DotBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return DotBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to apply a dot product between 2 vectors\r\n */\r\nvar DotBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DotBlock, _super);\r\n /**\r\n * Creates a new DotBlock\r\n * @param name defines the block name\r\n */\r\n function DotBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n DotBlock.prototype.getClassName = function () {\r\n return \"DotBlock\";\r\n };\r\n Object.defineProperty(DotBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DotBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DotBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DotBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = dot(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return DotBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DotBlock\"] = DotBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/fresnelBlock.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/Node/Blocks/fresnelBlock.ts ***!\n \\***********************************************/\n/*! exports provided: FresnelBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return FresnelBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to compute fresnel value\r\n */\r\nvar FresnelBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FresnelBlock, _super);\r\n /**\r\n * Create a new FresnelBlock\r\n * @param name defines the block name\r\n */\r\n function FresnelBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"worldNormal\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"viewDirection\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerInput(\"bias\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"power\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"fresnel\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n FresnelBlock.prototype.getClassName = function () {\r\n return \"FresnelBlock\";\r\n };\r\n Object.defineProperty(FresnelBlock.prototype, \"worldNormal\", {\r\n /**\r\n * Gets the world normal input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"viewDirection\", {\r\n /**\r\n * Gets the view direction input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"bias\", {\r\n /**\r\n * Gets the bias input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"power\", {\r\n /**\r\n * Gets the camera (or eye) position component\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FresnelBlock.prototype, \"fresnel\", {\r\n /**\r\n * Gets the fresnel output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n FresnelBlock.prototype.autoConfigure = function (material) {\r\n if (!this.bias.isConnected) {\r\n var biasInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"bias\");\r\n biasInput.value = 0;\r\n biasInput.output.connectTo(this.bias);\r\n }\r\n if (!this.power.isConnected) {\r\n var powerInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_5__[\"InputBlock\"](\"power\");\r\n powerInput.value = 1;\r\n powerInput.output.connectTo(this.power);\r\n }\r\n };\r\n FresnelBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var comments = \"//\" + this.name;\r\n state._emitFunctionFromInclude(\"fresnelFunction\", comments, { removeIfDef: true });\r\n state.compilationString += this._declareOutput(this.fresnel, state) + (\" = computeFresnelTerm(\" + this.viewDirection.associatedVariableName + \", \" + this.worldNormal.associatedVariableName + \", \" + this.bias.associatedVariableName + \", \" + this.power.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return FresnelBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.FresnelBlock\"] = FresnelBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/index.ts\":\n/*!****************************************!*\\\n !*** ./Materials/Node/Blocks/index.ts ***!\n \\****************************************/\n/*! exports provided: MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Vertex_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Vertex/index */ \"./Materials/Node/Blocks/Vertex/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Vertex_index__WEBPACK_IMPORTED_MODULE_0__[\"LightInformationBlock\"]; });\n\n/* harmony import */ var _Fragment_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Fragment/index */ \"./Materials/Node/Blocks/Fragment/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Fragment_index__WEBPACK_IMPORTED_MODULE_1__[\"PerturbNormalBlock\"]; });\n\n/* harmony import */ var _Dual_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Dual/index */ \"./Materials/Node/Blocks/Dual/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Dual_index__WEBPACK_IMPORTED_MODULE_2__[\"ReflectionTextureBlock\"]; });\n\n/* harmony import */ var _Input_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Input/index */ \"./Materials/Node/Blocks/Input/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Input_index__WEBPACK_IMPORTED_MODULE_3__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Input_index__WEBPACK_IMPORTED_MODULE_3__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _multiplyBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./multiplyBlock */ \"./Materials/Node/Blocks/multiplyBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _multiplyBlock__WEBPACK_IMPORTED_MODULE_4__[\"MultiplyBlock\"]; });\n\n/* harmony import */ var _addBlock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./addBlock */ \"./Materials/Node/Blocks/addBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _addBlock__WEBPACK_IMPORTED_MODULE_5__[\"AddBlock\"]; });\n\n/* harmony import */ var _scaleBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./scaleBlock */ \"./Materials/Node/Blocks/scaleBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _scaleBlock__WEBPACK_IMPORTED_MODULE_6__[\"ScaleBlock\"]; });\n\n/* harmony import */ var _clampBlock__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./clampBlock */ \"./Materials/Node/Blocks/clampBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _clampBlock__WEBPACK_IMPORTED_MODULE_7__[\"ClampBlock\"]; });\n\n/* harmony import */ var _crossBlock__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./crossBlock */ \"./Materials/Node/Blocks/crossBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _crossBlock__WEBPACK_IMPORTED_MODULE_8__[\"CrossBlock\"]; });\n\n/* harmony import */ var _dotBlock__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./dotBlock */ \"./Materials/Node/Blocks/dotBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _dotBlock__WEBPACK_IMPORTED_MODULE_9__[\"DotBlock\"]; });\n\n/* harmony import */ var _transformBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./transformBlock */ \"./Materials/Node/Blocks/transformBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _transformBlock__WEBPACK_IMPORTED_MODULE_10__[\"TransformBlock\"]; });\n\n/* harmony import */ var _remapBlock__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./remapBlock */ \"./Materials/Node/Blocks/remapBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _remapBlock__WEBPACK_IMPORTED_MODULE_11__[\"RemapBlock\"]; });\n\n/* harmony import */ var _normalizeBlock__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./normalizeBlock */ \"./Materials/Node/Blocks/normalizeBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _normalizeBlock__WEBPACK_IMPORTED_MODULE_12__[\"NormalizeBlock\"]; });\n\n/* harmony import */ var _trigonometryBlock__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./trigonometryBlock */ \"./Materials/Node/Blocks/trigonometryBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _trigonometryBlock__WEBPACK_IMPORTED_MODULE_13__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _trigonometryBlock__WEBPACK_IMPORTED_MODULE_13__[\"TrigonometryBlock\"]; });\n\n/* harmony import */ var _colorMergerBlock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./colorMergerBlock */ \"./Materials/Node/Blocks/colorMergerBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _colorMergerBlock__WEBPACK_IMPORTED_MODULE_14__[\"ColorMergerBlock\"]; });\n\n/* harmony import */ var _vectorMergerBlock__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./vectorMergerBlock */ \"./Materials/Node/Blocks/vectorMergerBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _vectorMergerBlock__WEBPACK_IMPORTED_MODULE_15__[\"VectorMergerBlock\"]; });\n\n/* harmony import */ var _colorSplitterBlock__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./colorSplitterBlock */ \"./Materials/Node/Blocks/colorSplitterBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _colorSplitterBlock__WEBPACK_IMPORTED_MODULE_16__[\"ColorSplitterBlock\"]; });\n\n/* harmony import */ var _vectorSplitterBlock__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./vectorSplitterBlock */ \"./Materials/Node/Blocks/vectorSplitterBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _vectorSplitterBlock__WEBPACK_IMPORTED_MODULE_17__[\"VectorSplitterBlock\"]; });\n\n/* harmony import */ var _lerpBlock__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./lerpBlock */ \"./Materials/Node/Blocks/lerpBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _lerpBlock__WEBPACK_IMPORTED_MODULE_18__[\"LerpBlock\"]; });\n\n/* harmony import */ var _divideBlock__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./divideBlock */ \"./Materials/Node/Blocks/divideBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _divideBlock__WEBPACK_IMPORTED_MODULE_19__[\"DivideBlock\"]; });\n\n/* harmony import */ var _subtractBlock__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./subtractBlock */ \"./Materials/Node/Blocks/subtractBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _subtractBlock__WEBPACK_IMPORTED_MODULE_20__[\"SubtractBlock\"]; });\n\n/* harmony import */ var _stepBlock__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./stepBlock */ \"./Materials/Node/Blocks/stepBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _stepBlock__WEBPACK_IMPORTED_MODULE_21__[\"StepBlock\"]; });\n\n/* harmony import */ var _oppositeBlock__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./oppositeBlock */ \"./Materials/Node/Blocks/oppositeBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _oppositeBlock__WEBPACK_IMPORTED_MODULE_22__[\"OppositeBlock\"]; });\n\n/* harmony import */ var _viewDirectionBlock__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./viewDirectionBlock */ \"./Materials/Node/Blocks/viewDirectionBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _viewDirectionBlock__WEBPACK_IMPORTED_MODULE_23__[\"ViewDirectionBlock\"]; });\n\n/* harmony import */ var _fresnelBlock__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./fresnelBlock */ \"./Materials/Node/Blocks/fresnelBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _fresnelBlock__WEBPACK_IMPORTED_MODULE_24__[\"FresnelBlock\"]; });\n\n/* harmony import */ var _maxBlock__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./maxBlock */ \"./Materials/Node/Blocks/maxBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _maxBlock__WEBPACK_IMPORTED_MODULE_25__[\"MaxBlock\"]; });\n\n/* harmony import */ var _minBlock__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./minBlock */ \"./Materials/Node/Blocks/minBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _minBlock__WEBPACK_IMPORTED_MODULE_26__[\"MinBlock\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/lerpBlock.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Node/Blocks/lerpBlock.ts ***!\n \\********************************************/\n/*! exports provided: LerpBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return LerpBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to lerp 2 values\r\n */\r\nvar LerpBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LerpBlock, _super);\r\n /**\r\n * Creates a new LerpBlock\r\n * @param name defines the block name\r\n */\r\n function LerpBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"gradient\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n LerpBlock.prototype.getClassName = function () {\r\n return \"LerpBlock\";\r\n };\r\n Object.defineProperty(LerpBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LerpBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LerpBlock.prototype, \"gradient\", {\r\n /**\r\n * Gets the gradient operand input component\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LerpBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n LerpBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = mix(\" + this.left.associatedVariableName + \" , \" + this.right.associatedVariableName + \", \" + this.gradient.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return LerpBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.LerpBlock\"] = LerpBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/maxBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/maxBlock.ts ***!\n \\*******************************************/\n/*! exports provided: MaxBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return MaxBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the max of 2 values\r\n */\r\nvar MaxBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MaxBlock, _super);\r\n /**\r\n * Creates a new MaxBlock\r\n * @param name defines the block name\r\n */\r\n function MaxBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MaxBlock.prototype.getClassName = function () {\r\n return \"MaxBlock\";\r\n };\r\n Object.defineProperty(MaxBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaxBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaxBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MaxBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = max(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return MaxBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MaxBlock\"] = MaxBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/minBlock.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Node/Blocks/minBlock.ts ***!\n \\*******************************************/\n/*! exports provided: MinBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return MinBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the min of 2 values\r\n */\r\nvar MinBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MinBlock, _super);\r\n /**\r\n * Creates a new MinBlock\r\n * @param name defines the block name\r\n */\r\n function MinBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MinBlock.prototype.getClassName = function () {\r\n return \"MinBlock\";\r\n };\r\n Object.defineProperty(MinBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MinBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MinBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MinBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = min(\" + this.left.associatedVariableName + \", \" + this.right.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return MinBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MinBlock\"] = MinBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/multiplyBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/multiplyBlock.ts ***!\n \\************************************************/\n/*! exports provided: MultiplyBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return MultiplyBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to multiply 2 values\r\n */\r\nvar MultiplyBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiplyBlock, _super);\r\n /**\r\n * Creates a new MultiplyBlock\r\n * @param name defines the block name\r\n */\r\n function MultiplyBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n MultiplyBlock.prototype.getClassName = function () {\r\n return \"MultiplyBlock\";\r\n };\r\n Object.defineProperty(MultiplyBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiplyBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiplyBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MultiplyBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" * \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return MultiplyBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MultiplyBlock\"] = MultiplyBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/normalizeBlock.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Node/Blocks/normalizeBlock.ts ***!\n \\*************************************************/\n/*! exports provided: NormalizeBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return NormalizeBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to normalize a vector\r\n */\r\nvar NormalizeBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NormalizeBlock, _super);\r\n /**\r\n * Creates a new NormalizeBlock\r\n * @param name defines the block name\r\n */\r\n function NormalizeBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n NormalizeBlock.prototype.getClassName = function () {\r\n return \"NormalizeBlock\";\r\n };\r\n Object.defineProperty(NormalizeBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NormalizeBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n NormalizeBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n var input = this._inputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = normalize(\" + input.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return NormalizeBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.NormalizeBlock\"] = NormalizeBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/oppositeBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/oppositeBlock.ts ***!\n \\************************************************/\n/*! exports provided: OppositeBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return OppositeBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the opposite of a value\r\n */\r\nvar OppositeBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](OppositeBlock, _super);\r\n /**\r\n * Creates a new OppositeBlock\r\n * @param name defines the block name\r\n */\r\n function OppositeBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n OppositeBlock.prototype.getClassName = function () {\r\n return \"OppositeBlock\";\r\n };\r\n Object.defineProperty(OppositeBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(OppositeBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n OppositeBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = 1. - \" + this.input.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return OppositeBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.OppositeBlock\"] = OppositeBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/remapBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/remapBlock.ts ***!\n \\*********************************************/\n/*! exports provided: RemapBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return RemapBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to remap a float from a range to a new one\r\n */\r\nvar RemapBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RemapBlock, _super);\r\n /**\r\n * Creates a new RemapBlock\r\n * @param name defines the block name\r\n */\r\n function RemapBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n /**\r\n * Gets or sets the source range\r\n */\r\n _this.sourceRange = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](-1, 1);\r\n /**\r\n * Gets or sets the target range\r\n */\r\n _this.targetRange = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](0, 1);\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n RemapBlock.prototype.getClassName = function () {\r\n return \"RemapBlock\";\r\n };\r\n Object.defineProperty(RemapBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RemapBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RemapBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this._writeFloat(this.targetRange.x) + \" + (\" + this._inputs[0].associatedVariableName + \" - \" + this._writeFloat(this.sourceRange.x) + \") * (\" + this._writeFloat(this.targetRange.y) + \" - \" + this._writeFloat(this.targetRange.x) + \") / (\" + this._writeFloat(this.sourceRange.y) + \" - \" + this._writeFloat(this.sourceRange.x) + \");\\r\\n\");\r\n return this;\r\n };\r\n RemapBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".sourceRange = new BABYLON.Vector2(\" + this.sourceRange.x + \", \" + this.sourceRange.y + \");\\r\\n\";\r\n codeString += this._codeVariableName + \".targetRange = new BABYLON.Vector2(\" + this.targetRange.x + \", \" + this.targetRange.y + \");\\r\\n\";\r\n return codeString;\r\n };\r\n RemapBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.sourceRange = this.sourceRange.asArray();\r\n serializationObject.targetRange = this.targetRange.asArray();\r\n return serializationObject;\r\n };\r\n RemapBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.sourceRange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].FromArray(serializationObject.sourceRange);\r\n this.targetRange = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].FromArray(serializationObject.targetRange);\r\n };\r\n return RemapBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.RemapBlock\"] = RemapBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/scaleBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/Blocks/scaleBlock.ts ***!\n \\*********************************************/\n/*! exports provided: ScaleBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return ScaleBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to scale a vector by a float\r\n */\r\nvar ScaleBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ScaleBlock, _super);\r\n /**\r\n * Creates a new ScaleBlock\r\n * @param name defines the block name\r\n */\r\n function ScaleBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"factor\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ScaleBlock.prototype.getClassName = function () {\r\n return \"ScaleBlock\";\r\n };\r\n Object.defineProperty(ScaleBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleBlock.prototype, \"factor\", {\r\n /**\r\n * Gets the factor input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScaleBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ScaleBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.input.associatedVariableName + \" * \" + this.factor.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return ScaleBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ScaleBlock\"] = ScaleBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/stepBlock.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Node/Blocks/stepBlock.ts ***!\n \\********************************************/\n/*! exports provided: StepBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return StepBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to step a value\r\n */\r\nvar StepBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StepBlock, _super);\r\n /**\r\n * Creates a new AddBlock\r\n * @param name defines the block name\r\n */\r\n function StepBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"value\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"edge\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n StepBlock.prototype.getClassName = function () {\r\n return \"StepBlock\";\r\n };\r\n Object.defineProperty(StepBlock.prototype, \"value\", {\r\n /**\r\n * Gets the value operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StepBlock.prototype, \"edge\", {\r\n /**\r\n * Gets the edge operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StepBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n StepBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = step(\" + this.edge.associatedVariableName + \", \" + this.value.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n return StepBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StepBlock\"] = StepBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/subtractBlock.ts\":\n/*!************************************************!*\\\n !*** ./Materials/Node/Blocks/subtractBlock.ts ***!\n \\************************************************/\n/*! exports provided: SubtractBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return SubtractBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to subtract 2 vectors\r\n */\r\nvar SubtractBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SubtractBlock, _super);\r\n /**\r\n * Creates a new SubtractBlock\r\n * @param name defines the block name\r\n */\r\n function SubtractBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"left\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"right\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput);\r\n _this._outputs[0]._typeConnectionSource = _this._inputs[0];\r\n _this._linkConnectionTypes(0, 1);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n SubtractBlock.prototype.getClassName = function () {\r\n return \"SubtractBlock\";\r\n };\r\n Object.defineProperty(SubtractBlock.prototype, \"left\", {\r\n /**\r\n * Gets the left operand input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SubtractBlock.prototype, \"right\", {\r\n /**\r\n * Gets the right operand input component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SubtractBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SubtractBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + this.left.associatedVariableName + \" - \" + this.right.associatedVariableName + \";\\r\\n\");\r\n return this;\r\n };\r\n return SubtractBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SubtractBlock\"] = SubtractBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/transformBlock.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Node/Blocks/transformBlock.ts ***!\n \\*************************************************/\n/*! exports provided: TransformBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return TransformBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to transform a vector (2, 3 or 4) with a matrix. It will generate a Vector4\r\n */\r\nvar TransformBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TransformBlock, _super);\r\n /**\r\n * Creates a new TransformBlock\r\n * @param name defines the block name\r\n */\r\n function TransformBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Vertex) || this;\r\n /**\r\n * Defines the value to use to complement W value to transform it to a Vector4\r\n */\r\n _this.complementW = 1;\r\n /**\r\n * Defines the value to use to complement z value to transform it to a Vector4\r\n */\r\n _this.complementZ = 0;\r\n _this.registerInput(\"vector\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect);\r\n _this.registerInput(\"transform\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n TransformBlock.prototype.getClassName = function () {\r\n return \"TransformBlock\";\r\n };\r\n Object.defineProperty(TransformBlock.prototype, \"vector\", {\r\n /**\r\n * Gets the vector input\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformBlock.prototype, \"transform\", {\r\n /**\r\n * Gets the matrix transform input\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TransformBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n var vector = this.vector;\r\n var transform = this.transform;\r\n if (vector.connectedPoint) {\r\n switch (vector.connectedPoint.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + transform.associatedVariableName + \" * vec4(\" + vector.associatedVariableName + \", \" + this._writeFloat(this.complementZ) + \", \" + this._writeFloat(this.complementW) + \");\\r\\n\");\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + transform.associatedVariableName + \" * vec4(\" + vector.associatedVariableName + \", \" + this._writeFloat(this.complementW) + \");\\r\\n\");\r\n break;\r\n default:\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + transform.associatedVariableName + \" * \" + vector.associatedVariableName + \";\\r\\n\");\r\n break;\r\n }\r\n }\r\n return this;\r\n };\r\n TransformBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.complementZ = this.complementZ;\r\n serializationObject.complementW = this.complementW;\r\n return serializationObject;\r\n };\r\n TransformBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.complementZ = serializationObject.complementZ !== undefined ? serializationObject.complementZ : 0.0;\r\n this.complementW = serializationObject.complementW !== undefined ? serializationObject.complementW : 1.0;\r\n };\r\n TransformBlock.prototype._dumpPropertiesCode = function () {\r\n var codeString = this._codeVariableName + \".complementZ = \" + this.complementZ + \";\\r\\n\";\r\n codeString += this._codeVariableName + \".complementW = \" + this.complementW + \";\\r\\n\";\r\n return codeString;\r\n };\r\n return TransformBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.TransformBlock\"] = TransformBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/trigonometryBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/trigonometryBlock.ts ***!\n \\****************************************************/\n/*! exports provided: TrigonometryBlockOperations, TrigonometryBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return TrigonometryBlockOperations; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return TrigonometryBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nvar TrigonometryBlockOperations;\r\n(function (TrigonometryBlockOperations) {\r\n /** Cos */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Cos\"] = 0] = \"Cos\";\r\n /** Sin */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Sin\"] = 1] = \"Sin\";\r\n /** Abs */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Abs\"] = 2] = \"Abs\";\r\n /** Exp */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Exp\"] = 3] = \"Exp\";\r\n /** Exp2 */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Exp2\"] = 4] = \"Exp2\";\r\n /** Round */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Round\"] = 5] = \"Round\";\r\n /** Floor */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Floor\"] = 6] = \"Floor\";\r\n /** Ceiling */\r\n TrigonometryBlockOperations[TrigonometryBlockOperations[\"Ceiling\"] = 7] = \"Ceiling\";\r\n})(TrigonometryBlockOperations || (TrigonometryBlockOperations = {}));\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nvar TrigonometryBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TrigonometryBlock, _super);\r\n /**\r\n * Creates a new TrigonometryBlock\r\n * @param name defines the block name\r\n */\r\n function TrigonometryBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n _this.operation = TrigonometryBlockOperations.Cos;\r\n _this.registerInput(\"input\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n TrigonometryBlock.prototype.getClassName = function () {\r\n return \"TrigonometryBlock\";\r\n };\r\n Object.defineProperty(TrigonometryBlock.prototype, \"input\", {\r\n /**\r\n * Gets the input component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TrigonometryBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n TrigonometryBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n var operation = \"\";\r\n switch (this.operation) {\r\n case TrigonometryBlockOperations.Cos: {\r\n operation = \"cos\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Sin: {\r\n operation = \"sin\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Abs: {\r\n operation = \"abs\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Exp: {\r\n operation = \"exp\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Exp2: {\r\n operation = \"exp2\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Round: {\r\n operation = \"round\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Floor: {\r\n operation = \"floor\";\r\n break;\r\n }\r\n case TrigonometryBlockOperations.Ceiling: {\r\n operation = \"ceil\";\r\n break;\r\n }\r\n }\r\n state.compilationString += this._declareOutput(output, state) + (\" = \" + operation + \"(\" + this.input.associatedVariableName + \");\\r\\n\");\r\n return this;\r\n };\r\n TrigonometryBlock.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.operation = this.operation;\r\n return serializationObject;\r\n };\r\n TrigonometryBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n _super.prototype._deserialize.call(this, serializationObject, scene, rootUrl);\r\n this.operation = serializationObject.operation;\r\n };\r\n return TrigonometryBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.TrigonometryBlock\"] = TrigonometryBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/vectorMergerBlock.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/Blocks/vectorMergerBlock.ts ***!\n \\****************************************************/\n/*! exports provided: VectorMergerBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return VectorMergerBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to create a Vector2/3/4 out of individual inputs (one for each component)\r\n */\r\nvar VectorMergerBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VectorMergerBlock, _super);\r\n /**\r\n * Create a new VectorMergerBlock\r\n * @param name defines the block name\r\n */\r\n function VectorMergerBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"x\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"y\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerInput(\"z\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerInput(\"w\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float, true);\r\n _this.registerOutput(\"xyzw\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerOutput(\"xyz\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"xy\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n VectorMergerBlock.prototype.getClassName = function () {\r\n return \"VectorMergerBlock\";\r\n };\r\n Object.defineProperty(VectorMergerBlock.prototype, \"x\", {\r\n /**\r\n * Gets the x component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"y\", {\r\n /**\r\n * Gets the y component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"z\", {\r\n /**\r\n * Gets the z component (input)\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"w\", {\r\n /**\r\n * Gets the w component (input)\r\n */\r\n get: function () {\r\n return this._inputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"xyzw\", {\r\n /**\r\n * Gets the xyzw component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"xyz\", {\r\n /**\r\n * Gets the xyz component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorMergerBlock.prototype, \"xy\", {\r\n /**\r\n * Gets the xy component (output)\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VectorMergerBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var xInput = this.x;\r\n var yInput = this.y;\r\n var zInput = this.z;\r\n var wInput = this.w;\r\n var v4Output = this._outputs[0];\r\n var v3Output = this._outputs[1];\r\n var v2Output = this._outputs[2];\r\n if (v4Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(v4Output, state) + (\" = vec4(\" + this._writeVariable(xInput) + \", \" + this._writeVariable(yInput) + \", \" + (zInput.isConnected ? this._writeVariable(zInput) : \"0.0\") + \", \" + (zInput.isConnected ? this._writeVariable(wInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n else if (v3Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(v3Output, state) + (\" = vec3(\" + this._writeVariable(xInput) + \", \" + this._writeVariable(yInput) + \", \" + (zInput.isConnected ? this._writeVariable(zInput) : \"0.0\") + \");\\r\\n\");\r\n }\r\n else if (v2Output.hasEndpoints) {\r\n state.compilationString += this._declareOutput(v2Output, state) + (\" = vec2(\" + this._writeVariable(xInput) + \", \" + this._writeVariable(yInput) + \");\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return VectorMergerBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.VectorMergerBlock\"] = VectorMergerBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/vectorSplitterBlock.ts\":\n/*!******************************************************!*\\\n !*** ./Materials/Node/Blocks/vectorSplitterBlock.ts ***!\n \\******************************************************/\n/*! exports provided: VectorSplitterBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return VectorSplitterBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to expand a Vector3/4 into 4 outputs (one for each component)\r\n */\r\nvar VectorSplitterBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VectorSplitterBlock, _super);\r\n /**\r\n * Create a new VectorSplitterBlock\r\n * @param name defines the block name\r\n */\r\n function VectorSplitterBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Fragment) || this;\r\n _this.registerInput(\"xyzw\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4, true);\r\n _this.registerInput(\"xyz \", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3, true);\r\n _this.registerInput(\"xy \", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2, true);\r\n _this.registerOutput(\"xyz\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"xy\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2);\r\n _this.registerOutput(\"x\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"y\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"z\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n _this.registerOutput(\"w\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Float);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n VectorSplitterBlock.prototype.getClassName = function () {\r\n return \"VectorSplitterBlock\";\r\n };\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyzw\", {\r\n /**\r\n * Gets the xyzw component (input)\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyzIn\", {\r\n /**\r\n * Gets the xyz component (input)\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyIn\", {\r\n /**\r\n * Gets the xy component (input)\r\n */\r\n get: function () {\r\n return this._inputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyzOut\", {\r\n /**\r\n * Gets the xyz component (output)\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"xyOut\", {\r\n /**\r\n * Gets the xy component (output)\r\n */\r\n get: function () {\r\n return this._outputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"x\", {\r\n /**\r\n * Gets the x component (output)\r\n */\r\n get: function () {\r\n return this._outputs[2];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"y\", {\r\n /**\r\n * Gets the y component (output)\r\n */\r\n get: function () {\r\n return this._outputs[3];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"z\", {\r\n /**\r\n * Gets the z component (output)\r\n */\r\n get: function () {\r\n return this._outputs[4];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(VectorSplitterBlock.prototype, \"w\", {\r\n /**\r\n * Gets the w component (output)\r\n */\r\n get: function () {\r\n return this._outputs[5];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VectorSplitterBlock.prototype._inputRename = function (name) {\r\n switch (name) {\r\n case \"xy \":\r\n return \"xyIn\";\r\n case \"xyz \":\r\n return \"xyzIn\";\r\n default:\r\n return name;\r\n }\r\n };\r\n VectorSplitterBlock.prototype._outputRename = function (name) {\r\n switch (name) {\r\n case \"xy\":\r\n return \"xyOut\";\r\n case \"xyz\":\r\n return \"xyzOut\";\r\n default:\r\n return name;\r\n }\r\n };\r\n VectorSplitterBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var input = this.xyzw.isConnected ? this.xyzw : this.xyzIn.isConnected ? this.xyzIn : this.xyIn;\r\n var xyzOutput = this._outputs[0];\r\n var xyOutput = this._outputs[1];\r\n var xOutput = this._outputs[2];\r\n var yOutput = this._outputs[3];\r\n var zOutput = this._outputs[4];\r\n var wOutput = this._outputs[5];\r\n if (xyzOutput.hasEndpoints) {\r\n if (input === this.xyIn) {\r\n state.compilationString += this._declareOutput(xyzOutput, state) + (\" = vec3(\" + input.associatedVariableName + \", 0.0);\\r\\n\");\r\n }\r\n else {\r\n state.compilationString += this._declareOutput(xyzOutput, state) + (\" = \" + input.associatedVariableName + \".xyz;\\r\\n\");\r\n }\r\n }\r\n if (xyOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(xyOutput, state) + (\" = \" + input.associatedVariableName + \".xy;\\r\\n\");\r\n }\r\n if (xOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(xOutput, state) + (\" = \" + input.associatedVariableName + \".x;\\r\\n\");\r\n }\r\n if (yOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(yOutput, state) + (\" = \" + input.associatedVariableName + \".y;\\r\\n\");\r\n }\r\n if (zOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(zOutput, state) + (\" = \" + input.associatedVariableName + \".z;\\r\\n\");\r\n }\r\n if (wOutput.hasEndpoints) {\r\n state.compilationString += this._declareOutput(wOutput, state) + (\" = \" + input.associatedVariableName + \".w;\\r\\n\");\r\n }\r\n return this;\r\n };\r\n return VectorSplitterBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.VectorSplitterBlock\"] = VectorSplitterBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Blocks/viewDirectionBlock.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/Node/Blocks/viewDirectionBlock.ts ***!\n \\*****************************************************/\n/*! exports provided: ViewDirectionBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return ViewDirectionBlock; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony import */ var _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Block used to get the view direction\r\n */\r\nvar ViewDirectionBlock = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ViewDirectionBlock, _super);\r\n /**\r\n * Creates a new ViewDirectionBlock\r\n * @param name defines the block name\r\n */\r\n function ViewDirectionBlock(name) {\r\n var _this = _super.call(this, name, _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlockTargets\"].Neutral) || this;\r\n _this.registerInput(\"worldPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4);\r\n _this.registerInput(\"cameraPosition\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n _this.registerOutput(\"output\", _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3);\r\n return _this;\r\n }\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n ViewDirectionBlock.prototype.getClassName = function () {\r\n return \"ViewDirectionBlock\";\r\n };\r\n Object.defineProperty(ViewDirectionBlock.prototype, \"worldPosition\", {\r\n /**\r\n * Gets the world position component\r\n */\r\n get: function () {\r\n return this._inputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViewDirectionBlock.prototype, \"cameraPosition\", {\r\n /**\r\n * Gets the camera position component\r\n */\r\n get: function () {\r\n return this._inputs[1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ViewDirectionBlock.prototype, \"output\", {\r\n /**\r\n * Gets the output component\r\n */\r\n get: function () {\r\n return this._outputs[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ViewDirectionBlock.prototype.autoConfigure = function (material) {\r\n if (!this.cameraPosition.isConnected) {\r\n var cameraPositionInput = material.getInputBlockByPredicate(function (b) { return b.systemValue === _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition; });\r\n if (!cameraPositionInput) {\r\n cameraPositionInput = new _Input_inputBlock__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"](\"cameraPosition\");\r\n cameraPositionInput.setAsSystemValue(_nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"].CameraPosition);\r\n }\r\n cameraPositionInput.output.connectTo(this.cameraPosition);\r\n }\r\n };\r\n ViewDirectionBlock.prototype._buildBlock = function (state) {\r\n _super.prototype._buildBlock.call(this, state);\r\n var output = this._outputs[0];\r\n state.compilationString += this._declareOutput(output, state) + (\" = normalize(\" + this.cameraPosition.associatedVariableName + \" - \" + this.worldPosition.associatedVariableName + \".xyz);\\r\\n\");\r\n return this;\r\n };\r\n return ViewDirectionBlock;\r\n}(_nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlock\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ViewDirectionBlock\"] = ViewDirectionBlock;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/NodeMaterialBlockConnectionPointMode.ts\":\n/*!****************************************************************!*\\\n !*** ./Materials/Node/NodeMaterialBlockConnectionPointMode.ts ***!\n \\****************************************************************/\n/*! exports provided: NodeMaterialBlockConnectionPointMode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointMode\", function() { return NodeMaterialBlockConnectionPointMode; });\n/**\r\n * Enum defining the mode of a NodeMaterialBlockConnectionPoint\r\n */\r\nvar NodeMaterialBlockConnectionPointMode;\r\n(function (NodeMaterialBlockConnectionPointMode) {\r\n /** Value is an uniform */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Uniform\"] = 0] = \"Uniform\";\r\n /** Value is a mesh attribute */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Attribute\"] = 1] = \"Attribute\";\r\n /** Value is a varying between vertex and fragment shaders */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Varying\"] = 2] = \"Varying\";\r\n /** Mode is undefined */\r\n NodeMaterialBlockConnectionPointMode[NodeMaterialBlockConnectionPointMode[\"Undefined\"] = 3] = \"Undefined\";\r\n})(NodeMaterialBlockConnectionPointMode || (NodeMaterialBlockConnectionPointMode = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Optimizers/index.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Node/Optimizers/index.ts ***!\n \\********************************************/\n/*! exports provided: NodeMaterialOptimizer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nodeMaterialOptimizer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialOptimizer */ \"./Materials/Node/Optimizers/nodeMaterialOptimizer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _nodeMaterialOptimizer__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialOptimizer\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/Optimizers/nodeMaterialOptimizer.ts\":\n/*!************************************************************!*\\\n !*** ./Materials/Node/Optimizers/nodeMaterialOptimizer.ts ***!\n \\************************************************************/\n/*! exports provided: NodeMaterialOptimizer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return NodeMaterialOptimizer; });\n/**\r\n * Root class for all node material optimizers\r\n */\r\nvar NodeMaterialOptimizer = /** @class */ (function () {\r\n function NodeMaterialOptimizer() {\r\n }\r\n /**\r\n * Function used to optimize a NodeMaterial graph\r\n * @param vertexOutputNodes defines the list of output nodes for the vertex shader\r\n * @param fragmentOutputNodes defines the list of output nodes for the fragment shader\r\n */\r\n NodeMaterialOptimizer.prototype.optimize = function (vertexOutputNodes, fragmentOutputNodes) {\r\n // Do nothing by default\r\n };\r\n return NodeMaterialOptimizer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/index.ts\":\n/*!*********************************!*\\\n !*** ./Materials/Node/index.ts ***!\n \\*********************************/\n/*! exports provided: NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony import */ var _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPoint */ \"./Materials/Node/nodeMaterialBlockConnectionPoint.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony import */ var _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nodeMaterialBlock */ \"./Materials/Node/nodeMaterialBlock.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _nodeMaterialBlock__WEBPACK_IMPORTED_MODULE_3__[\"NodeMaterialBlock\"]; });\n\n/* harmony import */ var _nodeMaterial__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nodeMaterial */ \"./Materials/Node/nodeMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _nodeMaterial__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _nodeMaterial__WEBPACK_IMPORTED_MODULE_4__[\"NodeMaterial\"]; });\n\n/* harmony import */ var _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nodeMaterialSystemValues */ \"./Materials/Node/nodeMaterialSystemValues.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _nodeMaterialSystemValues__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony import */ var _Blocks_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Blocks/index */ \"./Materials/Node/Blocks/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Blocks_index__WEBPACK_IMPORTED_MODULE_6__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _Optimizers_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Optimizers/index */ \"./Materials/Node/Optimizers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _Optimizers_index__WEBPACK_IMPORTED_MODULE_7__[\"NodeMaterialOptimizer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterial.ts\":\n/*!****************************************!*\\\n !*** ./Materials/Node/nodeMaterial.ts ***!\n \\****************************************/\n/*! exports provided: NodeMaterialDefines, NodeMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return NodeMaterialDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return NodeMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _pushMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _nodeMaterialBuildState__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nodeMaterialBuildState */ \"./Materials/Node/nodeMaterialBuildState.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _nodeMaterialBuildStateSharedData__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./nodeMaterialBuildStateSharedData */ \"./Materials/Node/nodeMaterialBuildStateSharedData.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Blocks_transformBlock__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Blocks/transformBlock */ \"./Materials/Node/Blocks/transformBlock.ts\");\n/* harmony import */ var _Blocks_Vertex_vertexOutputBlock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Blocks/Vertex/vertexOutputBlock */ \"./Materials/Node/Blocks/Vertex/vertexOutputBlock.ts\");\n/* harmony import */ var _Blocks_Fragment_fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Blocks/Fragment/fragmentOutputBlock */ \"./Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts\");\n/* harmony import */ var _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Blocks/Input/inputBlock */ \"./Materials/Node/Blocks/Input/inputBlock.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_fileTools__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Misc/fileTools */ \"./Misc/fileTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar NodeMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NodeMaterialDefines, _super);\r\n function NodeMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n /** BONES */\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n /** MORPH TARGETS */\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n /** IMAGE PROCESSING */\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.EXPOSURE = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n /** MISC. */\r\n _this.BUMPDIRECTUV = 0;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n NodeMaterialDefines.prototype.setValue = function (name, value) {\r\n if (this[name] === undefined) {\r\n this._keys.push(name);\r\n }\r\n this[name] = value;\r\n };\r\n return NodeMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_10__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * Class used to create a node based material built by assembling shader blocks\r\n */\r\nvar NodeMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NodeMaterial, _super);\r\n /**\r\n * Create a new node based material\r\n * @param name defines the material name\r\n * @param scene defines the hosting scene\r\n * @param options defines creation option\r\n */\r\n function NodeMaterial(name, scene, options) {\r\n if (options === void 0) { options = {}; }\r\n var _this = _super.call(this, name, scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].LastCreatedScene) || this;\r\n _this._buildId = NodeMaterial._BuildIdGenerator++;\r\n _this._buildWasSuccessful = false;\r\n _this._cachedWorldViewMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._cachedWorldViewProjectionMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._optimizers = new Array();\r\n _this._animationFrame = -1;\r\n _this.BJSNODEMATERIALEDITOR = _this._getGlobalNodeMaterialEditor();\r\n /**\r\n * Gets or sets a boolean indicating that alpha value must be ignored (This will turn alpha blending off even if an alpha value is produced by the material)\r\n */\r\n _this.ignoreAlpha = false;\r\n /**\r\n * Defines the maximum number of lights that can be used in the material\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * Observable raised when the material is built\r\n */\r\n _this.onBuildObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_7__[\"Observable\"]();\r\n /**\r\n * Gets or sets the root nodes of the material vertex shader\r\n */\r\n _this._vertexOutputNodes = new Array();\r\n /**\r\n * Gets or sets the root nodes of the material fragment (pixel) shader\r\n */\r\n _this._fragmentOutputNodes = new Array();\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n _this.attachedBlocks = new Array();\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ emitComments: false }, options);\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n return _this;\r\n }\r\n /** Get the inspector from bundle or global */\r\n NodeMaterial.prototype._getGlobalNodeMaterialEditor = function () {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEEDITOR !== 'undefined') {\r\n return NODEEDITOR;\r\n }\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== 'undefined' && typeof BABYLON.NodeEditor !== 'undefined') {\r\n return BABYLON;\r\n }\r\n return undefined;\r\n };\r\n Object.defineProperty(NodeMaterial.prototype, \"options\", {\r\n /** Gets or sets options to control the node material overall behavior */\r\n get: function () {\r\n return this._options;\r\n },\r\n set: function (options) {\r\n this._options = options;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"NodeMaterial\"\r\n * @returns the class name\r\n */\r\n NodeMaterial.prototype.getClassName = function () {\r\n return \"NodeMaterial\";\r\n };\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n NodeMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n NodeMaterial.prototype.getBlockByName = function (name) {\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (block.name === name) {\r\n return block;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a block by its name\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n NodeMaterial.prototype.getBlockByPredicate = function (predicate) {\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get an input block by its name\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required input block or null if not found\r\n */\r\n NodeMaterial.prototype.getInputBlockByPredicate = function (predicate) {\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (block.isInput && predicate(block)) {\r\n return block;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n NodeMaterial.prototype.getInputBlocks = function () {\r\n var blocks = [];\r\n for (var _i = 0, _a = this.attachedBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n if (block.isInput) {\r\n blocks.push(block);\r\n }\r\n }\r\n return blocks;\r\n };\r\n /**\r\n * Adds a new optimizer to the list of optimizers\r\n * @param optimizer defines the optimizers to add\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.registerOptimizer = function (optimizer) {\r\n var index = this._optimizers.indexOf(optimizer);\r\n if (index > -1) {\r\n return;\r\n }\r\n this._optimizers.push(optimizer);\r\n return this;\r\n };\r\n /**\r\n * Remove an optimizer from the list of optimizers\r\n * @param optimizer defines the optimizers to remove\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.unregisterOptimizer = function (optimizer) {\r\n var index = this._optimizers.indexOf(optimizer);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._optimizers.splice(index, 1);\r\n return this;\r\n };\r\n /**\r\n * Add a new block to the list of output nodes\r\n * @param node defines the node to add\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.addOutputNode = function (node) {\r\n if (node.target === null) {\r\n throw \"This node is not meant to be an output node. You may want to explicitly set its target value.\";\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex) !== 0) {\r\n this._addVertexOutputNode(node);\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment) !== 0) {\r\n this._addFragmentOutputNode(node);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Remove a block from the list of root nodes\r\n * @param node defines the node to remove\r\n * @returns the current material\r\n */\r\n NodeMaterial.prototype.removeOutputNode = function (node) {\r\n if (node.target === null) {\r\n return this;\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex) !== 0) {\r\n this._removeVertexOutputNode(node);\r\n }\r\n if ((node.target & _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment) !== 0) {\r\n this._removeFragmentOutputNode(node);\r\n }\r\n return this;\r\n };\r\n NodeMaterial.prototype._addVertexOutputNode = function (node) {\r\n if (this._vertexOutputNodes.indexOf(node) !== -1) {\r\n return;\r\n }\r\n node.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex;\r\n this._vertexOutputNodes.push(node);\r\n return this;\r\n };\r\n NodeMaterial.prototype._removeVertexOutputNode = function (node) {\r\n var index = this._vertexOutputNodes.indexOf(node);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._vertexOutputNodes.splice(index, 1);\r\n return this;\r\n };\r\n NodeMaterial.prototype._addFragmentOutputNode = function (node) {\r\n if (this._fragmentOutputNodes.indexOf(node) !== -1) {\r\n return;\r\n }\r\n node.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment;\r\n this._fragmentOutputNodes.push(node);\r\n return this;\r\n };\r\n NodeMaterial.prototype._removeFragmentOutputNode = function (node) {\r\n var index = this._fragmentOutputNodes.indexOf(node);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._fragmentOutputNodes.splice(index, 1);\r\n return this;\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n NodeMaterial.prototype.needAlphaBlending = function () {\r\n if (this.ignoreAlpha) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._sharedData && this._sharedData.hints.needAlphaBlending);\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n NodeMaterial.prototype.needAlphaTesting = function () {\r\n return this._sharedData && this._sharedData.hints.needAlphaTesting;\r\n };\r\n NodeMaterial.prototype._initializeBlock = function (node, state, nodesToProcessForOtherBuildState) {\r\n node.initialize(state);\r\n node.autoConfigure(this);\r\n node._preparationId = this._buildId;\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n for (var _i = 0, _a = node.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!node.isInput) {\r\n input.associatedVariableName = \"\";\r\n }\r\n var connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n var block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n if (block.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].VertexAndFragment) {\r\n nodesToProcessForOtherBuildState.push(block);\r\n }\r\n else if (state.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment\r\n && block.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex\r\n && block._preparationId !== this._buildId) {\r\n nodesToProcessForOtherBuildState.push(block);\r\n }\r\n this._initializeBlock(block, state, nodesToProcessForOtherBuildState);\r\n }\r\n }\r\n }\r\n for (var _b = 0, _c = node.outputs; _b < _c.length; _b++) {\r\n var output = _c[_b];\r\n output.associatedVariableName = \"\";\r\n }\r\n };\r\n NodeMaterial.prototype._resetDualBlocks = function (node, id) {\r\n if (node.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].VertexAndFragment) {\r\n node.buildId = id;\r\n }\r\n for (var _i = 0, _a = node.inputs; _i < _a.length; _i++) {\r\n var inputs = _a[_i];\r\n var connectedPoint = inputs.connectedPoint;\r\n if (connectedPoint) {\r\n var block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._resetDualBlocks(block, id);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Build the material and generates the inner effect\r\n * @param verbose defines if the build should log activity\r\n */\r\n NodeMaterial.prototype.build = function (verbose) {\r\n if (verbose === void 0) { verbose = false; }\r\n this._buildWasSuccessful = false;\r\n var engine = this.getScene().getEngine();\r\n if (this._vertexOutputNodes.length === 0) {\r\n throw \"You must define at least one vertexOutputNode\";\r\n }\r\n if (this._fragmentOutputNodes.length === 0) {\r\n throw \"You must define at least one fragmentOutputNode\";\r\n }\r\n // Compilation state\r\n this._vertexCompilationState = new _nodeMaterialBuildState__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialBuildState\"]();\r\n this._vertexCompilationState.supportUniformBuffers = engine.supportsUniformBuffers;\r\n this._vertexCompilationState.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Vertex;\r\n this._fragmentCompilationState = new _nodeMaterialBuildState__WEBPACK_IMPORTED_MODULE_5__[\"NodeMaterialBuildState\"]();\r\n this._fragmentCompilationState.supportUniformBuffers = engine.supportsUniformBuffers;\r\n this._fragmentCompilationState.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_8__[\"NodeMaterialBlockTargets\"].Fragment;\r\n // Shared data\r\n this._sharedData = new _nodeMaterialBuildStateSharedData__WEBPACK_IMPORTED_MODULE_9__[\"NodeMaterialBuildStateSharedData\"]();\r\n this._vertexCompilationState.sharedData = this._sharedData;\r\n this._fragmentCompilationState.sharedData = this._sharedData;\r\n this._sharedData.buildId = this._buildId;\r\n this._sharedData.emitComments = this._options.emitComments;\r\n this._sharedData.verbose = verbose;\r\n // Initialize blocks\r\n var vertexNodes = [];\r\n var fragmentNodes = [];\r\n for (var _i = 0, _a = this._vertexOutputNodes; _i < _a.length; _i++) {\r\n var vertexOutputNode = _a[_i];\r\n vertexNodes.push(vertexOutputNode);\r\n this._initializeBlock(vertexOutputNode, this._vertexCompilationState, fragmentNodes);\r\n }\r\n for (var _b = 0, _c = this._fragmentOutputNodes; _b < _c.length; _b++) {\r\n var fragmentOutputNode = _c[_b];\r\n fragmentNodes.push(fragmentOutputNode);\r\n this._initializeBlock(fragmentOutputNode, this._fragmentCompilationState, vertexNodes);\r\n }\r\n // Optimize\r\n this.optimize();\r\n // Vertex\r\n for (var _d = 0, vertexNodes_1 = vertexNodes; _d < vertexNodes_1.length; _d++) {\r\n var vertexOutputNode = vertexNodes_1[_d];\r\n vertexOutputNode.build(this._vertexCompilationState, vertexNodes);\r\n }\r\n // Fragment\r\n this._fragmentCompilationState.uniforms = this._vertexCompilationState.uniforms.slice(0);\r\n this._fragmentCompilationState._uniformDeclaration = this._vertexCompilationState._uniformDeclaration;\r\n this._fragmentCompilationState._vertexState = this._vertexCompilationState;\r\n for (var _e = 0, fragmentNodes_1 = fragmentNodes; _e < fragmentNodes_1.length; _e++) {\r\n var fragmentOutputNode = fragmentNodes_1[_e];\r\n this._resetDualBlocks(fragmentOutputNode, this._buildId - 1);\r\n }\r\n for (var _f = 0, fragmentNodes_2 = fragmentNodes; _f < fragmentNodes_2.length; _f++) {\r\n var fragmentOutputNode = fragmentNodes_2[_f];\r\n fragmentOutputNode.build(this._fragmentCompilationState, fragmentNodes);\r\n }\r\n // Finalize\r\n this._vertexCompilationState.finalize(this._vertexCompilationState);\r\n this._fragmentCompilationState.finalize(this._fragmentCompilationState);\r\n this._buildId = NodeMaterial._BuildIdGenerator++;\r\n // Errors\r\n this._sharedData.emitErrors();\r\n if (verbose) {\r\n console.log(\"Vertex shader:\");\r\n console.log(this._vertexCompilationState.compilationString);\r\n console.log(\"Fragment shader:\");\r\n console.log(this._fragmentCompilationState.compilationString);\r\n }\r\n this._buildWasSuccessful = true;\r\n this.onBuildObservable.notifyObservers(this);\r\n // Wipe defines\r\n var meshes = this.getScene().meshes;\r\n for (var _g = 0, meshes_1 = meshes; _g < meshes_1.length; _g++) {\r\n var mesh = meshes_1[_g];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _h = 0, _j = mesh.subMeshes; _h < _j.length; _h++) {\r\n var subMesh = _j[_h];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh._materialDefines) {\r\n continue;\r\n }\r\n var defines = subMesh._materialDefines;\r\n defines.markAllAsDirty();\r\n defines.reset();\r\n }\r\n }\r\n };\r\n /**\r\n * Runs an otpimization phase to try to improve the shader code\r\n */\r\n NodeMaterial.prototype.optimize = function () {\r\n for (var _i = 0, _a = this._optimizers; _i < _a.length; _i++) {\r\n var optimizer = _a[_i];\r\n optimizer.optimize(this._vertexOutputNodes, this._fragmentOutputNodes);\r\n }\r\n };\r\n NodeMaterial.prototype._prepareDefinesForAttributes = function (mesh, defines) {\r\n if (!defines._areAttributesDirty) {\r\n return;\r\n }\r\n defines[\"NORMAL\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__[\"VertexBuffer\"].NormalKind);\r\n defines[\"TANGENT\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__[\"VertexBuffer\"].TangentKind);\r\n defines[\"UV1\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_11__[\"VertexBuffer\"].UVKind);\r\n };\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n NodeMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n var _this = this;\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (!this._buildWasSuccessful) {\r\n return false;\r\n }\r\n var scene = this.getScene();\r\n if (this._sharedData.animatedInputs) {\r\n var frameId = scene.getFrameId();\r\n if (this._animationFrame !== frameId) {\r\n for (var _i = 0, _a = this._sharedData.animatedInputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n input.animate(scene);\r\n }\r\n this._animationFrame = frameId;\r\n }\r\n }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new NodeMaterialDefines();\r\n }\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var engine = scene.getEngine();\r\n this._prepareDefinesForAttributes(mesh, defines);\r\n // Check if blocks are ready\r\n if (this._sharedData.blockingBlocks.some(function (b) { return !b.isReady(mesh, _this, defines, useInstances); })) {\r\n return false;\r\n }\r\n // Shared defines\r\n this._sharedData.blocksWithDefines.forEach(function (b) {\r\n b.initializeDefines(mesh, _this, defines, useInstances);\r\n });\r\n this._sharedData.blocksWithDefines.forEach(function (b) {\r\n b.prepareDefines(mesh, _this, defines, useInstances);\r\n });\r\n // Need to recompile?\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n // Repeatable content generators\r\n this._vertexCompilationState.compilationString = this._vertexCompilationState._builtCompilationString;\r\n this._fragmentCompilationState.compilationString = this._fragmentCompilationState._builtCompilationString;\r\n this._sharedData.repeatableContentBlocks.forEach(function (b) {\r\n b.replaceRepeatableContent(_this._vertexCompilationState, _this._fragmentCompilationState, mesh, defines);\r\n });\r\n // Uniforms\r\n this._sharedData.dynamicUniformBlocks.forEach(function (b) {\r\n b.updateUniformsAndSamples(_this._vertexCompilationState, _this, defines);\r\n });\r\n var mergedUniforms_1 = this._vertexCompilationState.uniforms;\r\n this._fragmentCompilationState.uniforms.forEach(function (u) {\r\n var index = mergedUniforms_1.indexOf(u);\r\n if (index === -1) {\r\n mergedUniforms_1.push(u);\r\n }\r\n });\r\n // Uniform buffers\r\n var mergedUniformBuffers_1 = this._vertexCompilationState.uniformBuffers;\r\n this._fragmentCompilationState.uniformBuffers.forEach(function (u) {\r\n var index = mergedUniformBuffers_1.indexOf(u);\r\n if (index === -1) {\r\n mergedUniformBuffers_1.push(u);\r\n }\r\n });\r\n // Samplers\r\n var mergedSamplers_1 = this._vertexCompilationState.samplers;\r\n this._fragmentCompilationState.samplers.forEach(function (s) {\r\n var index = mergedSamplers_1.indexOf(s);\r\n if (index === -1) {\r\n mergedSamplers_1.push(s);\r\n }\r\n });\r\n var fallbacks = new _effect__WEBPACK_IMPORTED_MODULE_6__[\"EffectFallbacks\"]();\r\n this._sharedData.blocksWithFallbacks.forEach(function (b) {\r\n b.provideFallbacks(mesh, fallbacks);\r\n });\r\n var previousEffect = subMesh.effect;\r\n // Compilation\r\n var join = defines.toString();\r\n var effect = engine.createEffect({\r\n vertex: \"nodeMaterial\" + this._buildId,\r\n fragment: \"nodeMaterial\" + this._buildId,\r\n vertexSource: this._vertexCompilationState.compilationString,\r\n fragmentSource: this._fragmentCompilationState.compilationString\r\n }, {\r\n attributes: this._vertexCompilationState.attributes,\r\n uniformsNames: mergedUniforms_1,\r\n uniformBuffersNames: mergedUniformBuffers_1,\r\n samplers: mergedSamplers_1,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS }\r\n }, engine);\r\n if (effect) {\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n defines.markAsUnprocessed();\r\n }\r\n else {\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n }\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n Object.defineProperty(NodeMaterial.prototype, \"compiledShaders\", {\r\n /**\r\n * Get a string representing the shaders built by the current node graph\r\n */\r\n get: function () {\r\n return \"// Vertex shader\\r\\n\" + this._vertexCompilationState.compilationString + \"\\r\\n\\r\\n// Fragment shader\\r\\n\" + this._fragmentCompilationState.compilationString;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n NodeMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n var scene = this.getScene();\r\n if (!this._activeEffect) {\r\n return;\r\n }\r\n var hints = this._sharedData.hints;\r\n if (hints.needWorldViewMatrix) {\r\n world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);\r\n }\r\n if (hints.needWorldViewProjectionMatrix) {\r\n world.multiplyToRef(scene.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);\r\n }\r\n // Connection points\r\n for (var _i = 0, _a = this._sharedData.inputBlocks; _i < _a.length; _i++) {\r\n var inputBlock = _a[_i];\r\n inputBlock._transmitWorld(this._activeEffect, world, this._cachedWorldViewMatrix, this._cachedWorldViewProjectionMatrix);\r\n }\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n NodeMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n if (mustRebind) {\r\n var sharedData = this._sharedData;\r\n if (effect && scene.getCachedMaterial() !== this) {\r\n // Bindable blocks\r\n for (var _i = 0, _a = sharedData.bindableBlocks; _i < _a.length; _i++) {\r\n var block = _a[_i];\r\n block.bind(effect, this, mesh);\r\n }\r\n // Connection points\r\n for (var _b = 0, _c = sharedData.inputBlocks; _b < _c.length; _b++) {\r\n var inputBlock = _c[_b];\r\n inputBlock._transmit(effect, scene);\r\n }\r\n }\r\n }\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n NodeMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n activeTextures.push.apply(activeTextures, this._sharedData.textureBlocks.filter(function (tb) { return tb.texture; }).map(function (tb) { return tb.texture; }));\r\n return activeTextures;\r\n };\r\n /**\r\n * Gets the list of texture blocks\r\n * @returns an array of texture blocks\r\n */\r\n NodeMaterial.prototype.getTextureBlocks = function () {\r\n if (!this._sharedData) {\r\n return [];\r\n }\r\n return this._sharedData.textureBlocks.filter(function (tb) { return tb.texture; });\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n NodeMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (!this._sharedData) {\r\n return false;\r\n }\r\n for (var _i = 0, _a = this._sharedData.textureBlocks; _i < _a.length; _i++) {\r\n var t = _a[_i];\r\n if (t.texture === texture) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n NodeMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n if (forceDisposeTextures) {\r\n for (var _i = 0, _a = this._sharedData.textureBlocks.filter(function (tb) { return tb.texture; }).map(function (tb) { return tb.texture; }); _i < _a.length; _i++) {\r\n var texture = _a[_i];\r\n texture.dispose();\r\n }\r\n }\r\n this.onBuildObservable.clear();\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\r\n };\r\n /** Creates the node editor window. */\r\n NodeMaterial.prototype._createNodeEditor = function () {\r\n this.BJSNODEMATERIALEDITOR = this.BJSNODEMATERIALEDITOR || this._getGlobalNodeMaterialEditor();\r\n this.BJSNODEMATERIALEDITOR.NodeEditor.Show({\r\n nodeMaterial: this\r\n });\r\n };\r\n /**\r\n * Launch the node material editor\r\n * @param config Define the configuration of the editor\r\n * @return a promise fulfilled when the node editor is visible\r\n */\r\n NodeMaterial.prototype.edit = function (config) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (typeof _this.BJSNODEMATERIALEDITOR == 'undefined') {\r\n var editorUrl = config && config.editorURL ? config.editorURL : NodeMaterial.EditorURL;\r\n // Load editor and add it to the DOM\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_12__[\"Tools\"].LoadScript(editorUrl, function () {\r\n _this._createNodeEditor();\r\n resolve();\r\n });\r\n }\r\n else {\r\n // Otherwise creates the editor\r\n _this._createNodeEditor();\r\n resolve();\r\n }\r\n });\r\n };\r\n /**\r\n * Clear the current material\r\n */\r\n NodeMaterial.prototype.clear = function () {\r\n this._vertexOutputNodes = [];\r\n this._fragmentOutputNodes = [];\r\n this.attachedBlocks = [];\r\n };\r\n /**\r\n * Clear the current material and set it to a default state\r\n */\r\n NodeMaterial.prototype.setToDefault = function () {\r\n this.clear();\r\n var positionInput = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"position\");\r\n positionInput.setAsAttribute(\"position\");\r\n var worldInput = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"world\");\r\n worldInput.setAsSystemValue(BABYLON.NodeMaterialSystemValues.World);\r\n var worldPos = new _Blocks_transformBlock__WEBPACK_IMPORTED_MODULE_13__[\"TransformBlock\"](\"worldPos\");\r\n positionInput.connectTo(worldPos);\r\n worldInput.connectTo(worldPos);\r\n var viewProjectionInput = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"viewProjection\");\r\n viewProjectionInput.setAsSystemValue(BABYLON.NodeMaterialSystemValues.ViewProjection);\r\n var worldPosdMultipliedByViewProjection = new _Blocks_transformBlock__WEBPACK_IMPORTED_MODULE_13__[\"TransformBlock\"](\"worldPos * viewProjectionTransform\");\r\n worldPos.connectTo(worldPosdMultipliedByViewProjection);\r\n viewProjectionInput.connectTo(worldPosdMultipliedByViewProjection);\r\n var vertexOutput = new _Blocks_Vertex_vertexOutputBlock__WEBPACK_IMPORTED_MODULE_14__[\"VertexOutputBlock\"](\"vertexOutput\");\r\n worldPosdMultipliedByViewProjection.connectTo(vertexOutput);\r\n // Pixel\r\n var pixelColor = new _Blocks_Input_inputBlock__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"](\"color\");\r\n pixelColor.value = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"](0.8, 0.8, 0.8, 1);\r\n var fragmentOutput = new _Blocks_Fragment_fragmentOutputBlock__WEBPACK_IMPORTED_MODULE_15__[\"FragmentOutputBlock\"](\"fragmentOutput\");\r\n pixelColor.connectTo(fragmentOutput);\r\n // Add to nodes\r\n this.addOutputNode(vertexOutput);\r\n this.addOutputNode(fragmentOutput);\r\n };\r\n /**\r\n * Loads the current Node Material from a url pointing to a file save by the Node Material Editor\r\n * @param url defines the url to load from\r\n * @returns a promise that will fullfil when the material is fully loaded\r\n */\r\n NodeMaterial.prototype.loadAsync = function (url) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _Misc_fileTools__WEBPACK_IMPORTED_MODULE_19__[\"FileTools\"].LoadFile(url, function (data) {\r\n var serializationObject = JSON.parse(data);\r\n _this.loadFromSerialization(serializationObject, \"\");\r\n resolve();\r\n }, undefined, undefined, false, function (request, exception) {\r\n reject(exception.message);\r\n });\r\n });\r\n };\r\n NodeMaterial.prototype._gatherBlocks = function (rootNode, list) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n for (var _i = 0, _a = rootNode.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n var connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n var block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this material\r\n * @returns a string\r\n */\r\n NodeMaterial.prototype.generateCode = function () {\r\n var alreadyDumped = [];\r\n var vertexBlocks = [];\r\n var uniqueNames = [];\r\n // Gets active blocks\r\n for (var _i = 0, _a = this._vertexOutputNodes; _i < _a.length; _i++) {\r\n var outputNode = _a[_i];\r\n this._gatherBlocks(outputNode, vertexBlocks);\r\n }\r\n var fragmentBlocks = [];\r\n for (var _b = 0, _c = this._fragmentOutputNodes; _b < _c.length; _b++) {\r\n var outputNode = _c[_b];\r\n this._gatherBlocks(outputNode, fragmentBlocks);\r\n }\r\n // Generate vertex shader\r\n var codeString = \"var nodeMaterial = new BABYLON.NodeMaterial(`node material`);\\r\\n\";\r\n for (var _d = 0, vertexBlocks_1 = vertexBlocks; _d < vertexBlocks_1.length; _d++) {\r\n var node = vertexBlocks_1[_d];\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n // Generate fragment shader\r\n for (var _e = 0, fragmentBlocks_1 = fragmentBlocks; _e < fragmentBlocks_1.length; _e++) {\r\n var node = fragmentBlocks_1[_e];\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n for (var _f = 0, _g = this._vertexOutputNodes; _f < _g.length; _f++) {\r\n var node = _g[_f];\r\n codeString += \"nodeMaterial.addOutputNode(\" + node._codeVariableName + \");\\r\\n\";\r\n }\r\n for (var _h = 0, _j = this._fragmentOutputNodes; _h < _j.length; _h++) {\r\n var node = _j[_h];\r\n codeString += \"nodeMaterial.addOutputNode(\" + node._codeVariableName + \");\\r\\n\";\r\n }\r\n codeString += \"nodeMaterial.build();\\r\\n\";\r\n return codeString;\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n NodeMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.NodeMaterial\";\r\n serializationObject.outputNodes = [];\r\n var blocks = [];\r\n // Outputs\r\n for (var _i = 0, _a = this._vertexOutputNodes; _i < _a.length; _i++) {\r\n var outputNode = _a[_i];\r\n this._gatherBlocks(outputNode, blocks);\r\n serializationObject.outputNodes.push(outputNode.uniqueId);\r\n }\r\n for (var _b = 0, _c = this._fragmentOutputNodes; _b < _c.length; _b++) {\r\n var outputNode = _c[_b];\r\n this._gatherBlocks(outputNode, blocks);\r\n if (serializationObject.outputNodes.indexOf(outputNode.uniqueId) === -1) {\r\n serializationObject.outputNodes.push(outputNode.uniqueId);\r\n }\r\n }\r\n // Blocks\r\n serializationObject.blocks = [];\r\n for (var _d = 0, blocks_1 = blocks; _d < blocks_1.length; _d++) {\r\n var block = blocks_1[_d];\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n for (var _e = 0, _f = this.attachedBlocks; _e < _f.length; _e++) {\r\n var block = _f[_e];\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n NodeMaterial.prototype._restoreConnections = function (block, source, map) {\r\n for (var _i = 0, _a = block.outputs; _i < _a.length; _i++) {\r\n var outputPoint = _a[_i];\r\n for (var _b = 0, _c = source.blocks; _b < _c.length; _b++) {\r\n var candidate = _c[_b];\r\n var target = map[candidate.id];\r\n for (var _d = 0, _e = candidate.inputs; _d < _e.length; _d++) {\r\n var input = _e[_d];\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n var inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the material\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n */\r\n NodeMaterial.prototype.loadFromSerialization = function (source, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n this.clear();\r\n var map = {};\r\n // Create blocks\r\n for (var _i = 0, _a = source.blocks; _i < _a.length; _i++) {\r\n var parsedBlock = _a[_i];\r\n var blockType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_17__[\"_TypeStore\"].GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n var block = new blockType();\r\n block._deserialize(parsedBlock, this.getScene(), rootUrl);\r\n map[parsedBlock.id] = block;\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n // Connections\r\n // Starts with input blocks only\r\n for (var blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n var parsedBlock_1 = source.blocks[blockIndex];\r\n var block = map[parsedBlock_1.id];\r\n if (!block.isInput) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n // Outputs\r\n for (var _b = 0, _c = source.outputNodes; _b < _c.length; _b++) {\r\n var outputNodeId = _c[_b];\r\n this.addOutputNode(map[outputNodeId]);\r\n }\r\n // Store map for external uses\r\n source.map = {};\r\n for (var key in map) {\r\n source.map[key] = map[key].uniqueId;\r\n }\r\n };\r\n /**\r\n * Creates a node material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new node material\r\n */\r\n NodeMaterial.Parse = function (source, scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n var nodeMaterial = _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].Parse(function () { return new NodeMaterial(source.name, scene); }, source, scene, rootUrl);\r\n nodeMaterial.loadFromSerialization(source, rootUrl);\r\n return nodeMaterial;\r\n };\r\n /**\r\n * Creates a new node material set to default basic configuration\r\n * @param name defines the name of the material\r\n * @param scene defines the hosting scene\r\n * @returns a new NodeMaterial\r\n */\r\n NodeMaterial.CreateDefault = function (name, scene) {\r\n var newMaterial = new NodeMaterial(name, scene);\r\n newMaterial.setToDefault();\r\n newMaterial.build();\r\n return newMaterial;\r\n };\r\n NodeMaterial._BuildIdGenerator = 0;\r\n /** Define the URl to load node editor script */\r\n NodeMaterial.EditorURL = \"https://unpkg.com/babylonjs-node-editor@\" + _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].Version + \"/babylon.nodeEditor.js\";\r\n return NodeMaterial;\r\n}(_pushMaterial__WEBPACK_IMPORTED_MODULE_1__[\"PushMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_17__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.NodeMaterial\"] = NodeMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlock.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlock.ts ***!\n \\*********************************************/\n/*! exports provided: NodeMaterialBlock */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return NodeMaterialBlock; });\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPoint */ \"./Materials/Node/nodeMaterialBlockConnectionPoint.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/uniqueIdGenerator */ \"./Misc/uniqueIdGenerator.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines a block that can be used inside a node based material\r\n */\r\nvar NodeMaterialBlock = /** @class */ (function () {\r\n /**\r\n * Creates a new NodeMaterialBlock\r\n * @param name defines the block name\r\n * @param target defines the target of that block (Vertex by default)\r\n * @param isFinalMerger defines a boolean indicating that this block is an end block (e.g. it is generating a system value). Default is false\r\n * @param isInput defines a boolean indicating that this block is an input (e.g. it sends data to the shader). Default is false\r\n */\r\n function NodeMaterialBlock(name, target, isFinalMerger, isInput) {\r\n if (target === void 0) { target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex; }\r\n if (isFinalMerger === void 0) { isFinalMerger = false; }\r\n if (isInput === void 0) { isInput = false; }\r\n this._isFinalMerger = false;\r\n this._isInput = false;\r\n /** @hidden */\r\n this._codeVariableName = \"\";\r\n /** @hidden */\r\n this._inputs = new Array();\r\n /** @hidden */\r\n this._outputs = new Array();\r\n this.name = name;\r\n this._target = target;\r\n this._isFinalMerger = isFinalMerger;\r\n this._isInput = isInput;\r\n this.uniqueId = _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_3__[\"UniqueIdGenerator\"].UniqueId;\r\n }\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"isFinalMerger\", {\r\n /**\r\n * Gets a boolean indicating that this block is an end block (e.g. it is generating a system value)\r\n */\r\n get: function () {\r\n return this._isFinalMerger;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"isInput\", {\r\n /**\r\n * Gets a boolean indicating that this block is an input (e.g. it sends data to the shader)\r\n */\r\n get: function () {\r\n return this._isInput;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"buildId\", {\r\n /**\r\n * Gets or sets the build Id\r\n */\r\n get: function () {\r\n return this._buildId;\r\n },\r\n set: function (value) {\r\n this._buildId = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"target\", {\r\n /**\r\n * Gets or sets the target of the block\r\n */\r\n get: function () {\r\n return this._target;\r\n },\r\n set: function (value) {\r\n if ((this._target & value) !== 0) {\r\n return;\r\n }\r\n this._target = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"inputs\", {\r\n /**\r\n * Gets the list of input points\r\n */\r\n get: function () {\r\n return this._inputs;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialBlock.prototype, \"outputs\", {\r\n /** Gets the list of output points */\r\n get: function () {\r\n return this._outputs;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n NodeMaterialBlock.prototype.getInputByName = function (name) {\r\n var filter = this._inputs.filter(function (e) { return e.name === name; });\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Find an output by its name\r\n * @param name defines the name of the outputto look for\r\n * @returns the output or null if not found\r\n */\r\n NodeMaterialBlock.prototype.getOutputByName = function (name) {\r\n var filter = this._outputs.filter(function (e) { return e.name === name; });\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n NodeMaterialBlock.prototype.initialize = function (state) {\r\n // Do nothing\r\n };\r\n /**\r\n * Bind data to effect. Will only be called for blocks with isBindable === true\r\n * @param effect defines the effect to bind data to\r\n * @param nodeMaterial defines the hosting NodeMaterial\r\n * @param mesh defines the mesh that will be rendered\r\n */\r\n NodeMaterialBlock.prototype.bind = function (effect, nodeMaterial, mesh) {\r\n // Do nothing\r\n };\r\n NodeMaterialBlock.prototype._declareOutput = function (output, state) {\r\n return state._getGLType(output.type) + \" \" + output.associatedVariableName;\r\n };\r\n NodeMaterialBlock.prototype._writeVariable = function (currentPoint) {\r\n var connectionPoint = currentPoint.connectedPoint;\r\n if (connectionPoint) {\r\n return \"\" + currentPoint.associatedVariableName;\r\n }\r\n return \"0.\";\r\n };\r\n NodeMaterialBlock.prototype._writeFloat = function (value) {\r\n var stringVersion = value.toString();\r\n if (stringVersion.indexOf(\".\") === -1) {\r\n stringVersion += \".0\";\r\n }\r\n return \"\" + stringVersion;\r\n };\r\n /**\r\n * Gets the current class name e.g. \"NodeMaterialBlock\"\r\n * @returns the class name\r\n */\r\n NodeMaterialBlock.prototype.getClassName = function () {\r\n return \"NodeMaterialBlock\";\r\n };\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param target defines the target to use to limit the connection point (will be VertexAndFragment by default)\r\n * @returns the current block\r\n */\r\n NodeMaterialBlock.prototype.registerInput = function (name, type, isOptional, target) {\r\n if (isOptional === void 0) { isOptional = false; }\r\n var point = new _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialConnectionPoint\"](name, this);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n if (target) {\r\n point.target = target;\r\n }\r\n this._inputs.push(point);\r\n return this;\r\n };\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param target defines the target to use to limit the connection point (will be VertexAndFragment by default)\r\n * @returns the current block\r\n */\r\n NodeMaterialBlock.prototype.registerOutput = function (name, type, target) {\r\n var point = new _nodeMaterialBlockConnectionPoint__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialConnectionPoint\"](name, this);\r\n point.type = type;\r\n if (target) {\r\n point.target = target;\r\n }\r\n this._outputs.push(point);\r\n return this;\r\n };\r\n /**\r\n * Will return the first available input e.g. the first one which is not an uniform or an attribute\r\n * @param forOutput defines an optional connection point to check compatibility with\r\n * @returns the first available input or null\r\n */\r\n NodeMaterialBlock.prototype.getFirstAvailableInput = function (forOutput) {\r\n if (forOutput === void 0) { forOutput = null; }\r\n for (var _i = 0, _a = this._inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!input.connectedPoint) {\r\n if (!forOutput || (forOutput.type === input.type) || (input.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect)) {\r\n return input;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Will return the first available output e.g. the first one which is not yet connected and not a varying\r\n * @param forBlock defines an optional block to check compatibility with\r\n * @returns the first available input or null\r\n */\r\n NodeMaterialBlock.prototype.getFirstAvailableOutput = function (forBlock) {\r\n if (forBlock === void 0) { forBlock = null; }\r\n for (var _i = 0, _a = this._outputs; _i < _a.length; _i++) {\r\n var output = _a[_i];\r\n if (!forBlock || !forBlock.target || forBlock.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral || (forBlock.target & output.target) !== 0) {\r\n return output;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the sibling of the given output\r\n * @param current defines the current output\r\n * @returns the next output in the list or null\r\n */\r\n NodeMaterialBlock.prototype.getSiblingOutput = function (current) {\r\n var index = this._outputs.indexOf(current);\r\n if (index === -1 || index >= this._outputs.length) {\r\n return null;\r\n }\r\n return this._outputs[index + 1];\r\n };\r\n /**\r\n * Connect current block with another block\r\n * @param other defines the block to connect with\r\n * @param options define the various options to help pick the right connections\r\n * @returns the current block\r\n */\r\n NodeMaterialBlock.prototype.connectTo = function (other, options) {\r\n if (this._outputs.length === 0) {\r\n return;\r\n }\r\n var output = options && options.output ? this.getOutputByName(options.output) : this.getFirstAvailableOutput(other);\r\n var notFound = true;\r\n while (notFound) {\r\n var input = options && options.input ? other.getInputByName(options.input) : other.getFirstAvailableInput(output);\r\n if (output && input && output.canConnectTo(input)) {\r\n output.connectTo(input);\r\n notFound = false;\r\n }\r\n else if (!output) {\r\n throw \"Unable to find a compatible match\";\r\n }\r\n else {\r\n output = this.getSiblingOutput(output);\r\n }\r\n }\r\n return this;\r\n };\r\n NodeMaterialBlock.prototype._buildBlock = function (state) {\r\n // Empty. Must be defined by child nodes\r\n };\r\n /**\r\n * Add uniforms, samplers and uniform buffers at compilation time\r\n * @param state defines the state to update\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to update\r\n */\r\n NodeMaterialBlock.prototype.updateUniformsAndSamples = function (state, nodeMaterial, defines) {\r\n // Do nothing\r\n };\r\n /**\r\n * Add potential fallbacks if shader compilation fails\r\n * @param mesh defines the mesh to be rendered\r\n * @param fallbacks defines the current prioritized list of fallbacks\r\n */\r\n NodeMaterialBlock.prototype.provideFallbacks = function (mesh, fallbacks) {\r\n // Do nothing\r\n };\r\n /**\r\n * Update defines for shader compilation\r\n * @param mesh defines the mesh to be rendered\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to update\r\n * @param useInstances specifies that instances should be used\r\n */\r\n NodeMaterialBlock.prototype.prepareDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n // Do nothing\r\n };\r\n /**\r\n * Initialize defines for shader compilation\r\n * @param mesh defines the mesh to be rendered\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to be prepared\r\n * @param useInstances specifies that instances should be used\r\n */\r\n NodeMaterialBlock.prototype.initializeDefines = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n // Do nothing\r\n };\r\n /**\r\n * Lets the block try to connect some inputs automatically\r\n * @param material defines the hosting NodeMaterial\r\n */\r\n NodeMaterialBlock.prototype.autoConfigure = function (material) {\r\n // Do nothing\r\n };\r\n /**\r\n * Function called when a block is declared as repeatable content generator\r\n * @param vertexShaderState defines the current compilation state for the vertex shader\r\n * @param fragmentShaderState defines the current compilation state for the fragment shader\r\n * @param mesh defines the mesh to be rendered\r\n * @param defines defines the material defines to update\r\n */\r\n NodeMaterialBlock.prototype.replaceRepeatableContent = function (vertexShaderState, fragmentShaderState, mesh, defines) {\r\n // Do nothing\r\n };\r\n /**\r\n * Checks if the block is ready\r\n * @param mesh defines the mesh to be rendered\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param defines defines the material defines to update\r\n * @param useInstances specifies that instances should be used\r\n * @returns true if the block is ready\r\n */\r\n NodeMaterialBlock.prototype.isReady = function (mesh, nodeMaterial, defines, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n return true;\r\n };\r\n NodeMaterialBlock.prototype._linkConnectionTypes = function (inputIndex0, inputIndex1) {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n };\r\n NodeMaterialBlock.prototype._processBuild = function (block, state, input, activeBlocks) {\r\n block.build(state, activeBlocks);\r\n var localBlockIsFragment = (state._vertexState != null);\r\n var otherBlockWasGeneratedInVertexShader = block._buildTarget === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex && block.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n if (localBlockIsFragment && (((block.target & input.target) === 0) ||\r\n (this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].VertexAndFragment && otherBlockWasGeneratedInVertexShader))) { // context switch! We need a varying\r\n if ((!block.isInput && state.target !== block._buildTarget) // block was already emitted by vertex shader\r\n || (block.isInput && block.isAttribute) // block is an attribute\r\n ) {\r\n var connectedPoint = input.connectedPoint;\r\n if (state._vertexState._emitVaryingFromString(\"v_\" + connectedPoint.associatedVariableName, state._getGLType(connectedPoint.type))) {\r\n state._vertexState.compilationString += \"v_\" + connectedPoint.associatedVariableName + \" = \" + connectedPoint.associatedVariableName + \";\\r\\n\";\r\n }\r\n input.associatedVariableName = \"v_\" + connectedPoint.associatedVariableName;\r\n input._enforceAssociatedVariableName = true;\r\n }\r\n }\r\n };\r\n /**\r\n * Compile the current node and generate the shader code\r\n * @param state defines the current compilation state (uniforms, samplers, current string)\r\n * @param activeBlocks defines the list of active blocks (i.e. blocks to compile)\r\n * @returns true if already built\r\n */\r\n NodeMaterialBlock.prototype.build = function (state, activeBlocks) {\r\n if (this._buildId === state.sharedData.buildId) {\r\n return true;\r\n }\r\n // Check if \"parent\" blocks are compiled\r\n for (var _i = 0, _a = this._inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) { // Emit a warning\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n if (this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral) {\r\n if ((input.target & this.target) === 0) {\r\n continue;\r\n }\r\n if ((input.target & state.target) === 0) {\r\n continue;\r\n }\r\n }\r\n var block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this) {\r\n this._processBuild(block, state, input, activeBlocks);\r\n }\r\n }\r\n if (this._buildId === state.sharedData.buildId) {\r\n return true; // Need to check again as inputs can be connected multiple time to this endpoint\r\n }\r\n // Logs\r\n if (state.sharedData.verbose) {\r\n console.log((state.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex ? \"Vertex shader\" : \"Fragment shader\") + \": Building \" + this.name + \" [\" + this.getClassName() + \"]\");\r\n }\r\n if (!this.isInput) {\r\n /** Prepare outputs */\r\n for (var _b = 0, _c = this._outputs; _b < _c.length; _b++) {\r\n var output = _c[_b];\r\n if (this.target !== _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Neutral) {\r\n if ((output.target & this.target) === 0) {\r\n continue;\r\n }\r\n if ((output.target & state.target) === 0) {\r\n continue;\r\n }\r\n }\r\n if (!output.associatedVariableName) {\r\n output.associatedVariableName = state._getFreeVariableName(output.name);\r\n }\r\n }\r\n }\r\n // Checks final outputs\r\n if (this.isFinalMerger) {\r\n switch (state.target) {\r\n case _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Vertex:\r\n state.sharedData.checks.emitVertex = true;\r\n break;\r\n case _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_2__[\"NodeMaterialBlockTargets\"].Fragment:\r\n state.sharedData.checks.emitFragment = true;\r\n break;\r\n }\r\n }\r\n if (!this.isInput && state.sharedData.emitComments) {\r\n state.compilationString += \"\\r\\n//\" + this.name + \"\\r\\n\";\r\n }\r\n this._buildBlock(state);\r\n this._buildId = state.sharedData.buildId;\r\n this._buildTarget = state.target;\r\n // Compile connected blocks\r\n for (var _d = 0, _e = this._outputs; _d < _e.length; _d++) {\r\n var output = _e[_d];\r\n if ((output.target & state.target) === 0) {\r\n continue;\r\n }\r\n for (var _f = 0, _g = output.endpoints; _f < _g.length; _f++) {\r\n var endpoint = _g[_f];\r\n var block = endpoint.ownerBlock;\r\n if (block && (block.target & state.target) !== 0 && activeBlocks.indexOf(block) !== -1) {\r\n this._processBuild(block, state, endpoint, activeBlocks);\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n NodeMaterialBlock.prototype._inputRename = function (name) {\r\n return name;\r\n };\r\n NodeMaterialBlock.prototype._outputRename = function (name) {\r\n return name;\r\n };\r\n NodeMaterialBlock.prototype._dumpPropertiesCode = function () {\r\n return \"\";\r\n };\r\n /** @hidden */\r\n NodeMaterialBlock.prototype._dumpCode = function (uniqueNames, alreadyDumped) {\r\n alreadyDumped.push(this);\r\n var codeString;\r\n // Get unique name\r\n var nameAsVariableName = this.name.replace(/[^A-Za-z_]+/g, \"\");\r\n this._codeVariableName = nameAsVariableName;\r\n if (uniqueNames.indexOf(this._codeVariableName) !== -1) {\r\n var index = 0;\r\n do {\r\n index++;\r\n this._codeVariableName = nameAsVariableName + index;\r\n } while (uniqueNames.indexOf(this._codeVariableName) !== -1);\r\n }\r\n uniqueNames.push(this._codeVariableName);\r\n // Declaration\r\n codeString = \"\\r\\nvar \" + this._codeVariableName + \" = new BABYLON.\" + this.getClassName() + \"(\\\"\" + this.name + \"\\\");\\r\\n\";\r\n // Properties\r\n codeString += this._dumpPropertiesCode();\r\n // Inputs\r\n for (var _i = 0, _a = this.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n var connectedOutput = input.connectedPoint;\r\n var connectedBlock = connectedOutput.ownerBlock;\r\n if (alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n codeString += connectedBlock._codeVariableName + \".\" + connectedBlock._outputRename(connectedOutput.name) + \".connectTo(\" + this._codeVariableName + \".\" + this._inputRename(input.name) + \");\\r\\n\";\r\n }\r\n // Outputs\r\n for (var _b = 0, _c = this.outputs; _b < _c.length; _b++) {\r\n var output = _c[_b];\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n for (var _d = 0, _e = output.endpoints; _d < _e.length; _d++) {\r\n var endpoint = _e[_d];\r\n var connectedBlock = endpoint.ownerBlock;\r\n if (connectedBlock && alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n }\r\n return codeString;\r\n };\r\n /**\r\n * Clone the current block to a new identical block\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a copy of the current block\r\n */\r\n NodeMaterialBlock.prototype.clone = function (scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n var serializationObject = this.serialize();\r\n var blockType = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].GetClass(serializationObject.customType);\r\n if (blockType) {\r\n var block = new blockType();\r\n block._deserialize(serializationObject, scene, rootUrl);\r\n return block;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n NodeMaterialBlock.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject.inputs = [];\r\n for (var _i = 0, _a = this.inputs; _i < _a.length; _i++) {\r\n var input = _a[_i];\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n NodeMaterialBlock.prototype._deserialize = function (serializationObject, scene, rootUrl) {\r\n this.name = serializationObject.name;\r\n };\r\n return NodeMaterialBlock;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlockConnectionPoint.ts\":\n/*!************************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlockConnectionPoint.ts ***!\n \\************************************************************/\n/*! exports provided: NodeMaterialConnectionPoint */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return NodeMaterialConnectionPoint; });\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nvar NodeMaterialConnectionPoint = /** @class */ (function () {\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n */\r\n function NodeMaterialConnectionPoint(name, ownerBlock) {\r\n /** @hidden */\r\n this._connectedPoint = null;\r\n this._endpoints = new Array();\r\n /** @hidden */\r\n this._typeConnectionSource = null;\r\n /** @hidden */\r\n this._linkedConnectionSource = null;\r\n this._type = _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Float;\r\n /** @hidden */\r\n this._enforceAssociatedVariableName = false;\r\n /**\r\n * Gets or sets the additional types supported byt this connection point\r\n */\r\n this.acceptedConnectionPointTypes = new Array();\r\n /** Gets or sets the target of that connection point */\r\n this.target = _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlockTargets\"].VertexAndFragment;\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n }\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"associatedVariableName\", {\r\n /**\r\n * Gets or sets the associated variable name in the shader\r\n */\r\n get: function () {\r\n if (this._ownerBlock.isInput) {\r\n return this._ownerBlock.associatedVariableName;\r\n }\r\n if ((!this._enforceAssociatedVariableName || !this._associatedVariableName) && this._connectedPoint) {\r\n return this._connectedPoint.associatedVariableName;\r\n }\r\n return this._associatedVariableName;\r\n },\r\n set: function (value) {\r\n this._associatedVariableName = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"type\", {\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n get: function () {\r\n if (this._type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return this._ownerBlock.type;\r\n }\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n }\r\n if (this._type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].BasedOnInput && this._typeConnectionSource) {\r\n return this._typeConnectionSource.type;\r\n }\r\n return this._type;\r\n },\r\n set: function (value) {\r\n this._type = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"isConnected\", {\r\n /**\r\n * Gets a boolean indicating that the current point is connected\r\n */\r\n get: function () {\r\n return this.connectedPoint !== null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"isConnectedToInputBlock\", {\r\n /**\r\n * Gets a boolean indicating that the current point is connected to an input block\r\n */\r\n get: function () {\r\n return this.connectedPoint !== null && this.connectedPoint.ownerBlock.isInput;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"connectInputBlock\", {\r\n /**\r\n * Gets a the connected input block (if any)\r\n */\r\n get: function () {\r\n if (!this.isConnectedToInputBlock) {\r\n return null;\r\n }\r\n return this.connectedPoint.ownerBlock;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"connectedPoint\", {\r\n /** Get the other side of the connection (if any) */\r\n get: function () {\r\n return this._connectedPoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"ownerBlock\", {\r\n /** Get the block that owns this connection point */\r\n get: function () {\r\n return this._ownerBlock;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"sourceBlock\", {\r\n /** Get the block connected on the other side of this connection (if any) */\r\n get: function () {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n return this._connectedPoint.ownerBlock;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"connectedBlocks\", {\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n get: function () {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n return this._endpoints.map(function (e) { return e.ownerBlock; });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"endpoints\", {\r\n /** Gets the list of connected endpoints */\r\n get: function () {\r\n return this._endpoints;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NodeMaterialConnectionPoint.prototype, \"hasEndpoints\", {\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n get: function () {\r\n return this._endpoints && this._endpoints.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name e.g. \"NodeMaterialConnectionPoint\"\r\n * @returns the class name\r\n */\r\n NodeMaterialConnectionPoint.prototype.getClassName = function () {\r\n return \"NodeMaterialConnectionPoint\";\r\n };\r\n /**\r\n * Gets an boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns true if the connection is possible\r\n */\r\n NodeMaterialConnectionPoint.prototype.canConnectTo = function (connectionPoint) {\r\n if (this.type !== connectionPoint.type && connectionPoint.type !== _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].AutoDetect) {\r\n // Equivalents\r\n switch (this.type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color3) {\r\n return true;\r\n }\r\n }\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color4) {\r\n return true;\r\n }\r\n }\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color3: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3) {\r\n return true;\r\n }\r\n }\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color4: {\r\n if (connectionPoint.type === _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4) {\r\n return true;\r\n }\r\n }\r\n }\r\n // Accepted types\r\n return (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n NodeMaterialConnectionPoint.prototype.connectTo = function (connectionPoint, ignoreConstraints) {\r\n if (ignoreConstraints === void 0) { ignoreConstraints = false; }\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n throw \"Cannot connect two different connection types.\";\r\n }\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n this._enforceAssociatedVariableName = false;\r\n return this;\r\n };\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n NodeMaterialConnectionPoint.prototype.disconnectFrom = function (endpoint) {\r\n var index = this._endpoints.indexOf(endpoint);\r\n if (index === -1) {\r\n return this;\r\n }\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n this._enforceAssociatedVariableName = false;\r\n endpoint._enforceAssociatedVariableName = false;\r\n return this;\r\n };\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @returns the serialized point object\r\n */\r\n NodeMaterialConnectionPoint.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n if (this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n }\r\n return serializationObject;\r\n };\r\n return NodeMaterialConnectionPoint;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\":\n/*!*****************************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts ***!\n \\*****************************************************************/\n/*! exports provided: NodeMaterialBlockConnectionPointTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return NodeMaterialBlockConnectionPointTypes; });\n/**\r\n * Defines the kind of connection point for node based material\r\n */\r\nvar NodeMaterialBlockConnectionPointTypes;\r\n(function (NodeMaterialBlockConnectionPointTypes) {\r\n /** Float */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Float\"] = 1] = \"Float\";\r\n /** Int */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Int\"] = 2] = \"Int\";\r\n /** Vector2 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Vector2\"] = 4] = \"Vector2\";\r\n /** Vector3 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Vector3\"] = 8] = \"Vector3\";\r\n /** Vector4 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Vector4\"] = 16] = \"Vector4\";\r\n /** Color3 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Color3\"] = 32] = \"Color3\";\r\n /** Color4 */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Color4\"] = 64] = \"Color4\";\r\n /** Matrix */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"Matrix\"] = 128] = \"Matrix\";\r\n /** Detect type based on connection */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"AutoDetect\"] = 1024] = \"AutoDetect\";\r\n /** Output type that will be defined by input type */\r\n NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes[\"BasedOnInput\"] = 2048] = \"BasedOnInput\";\r\n})(NodeMaterialBlockConnectionPointTypes || (NodeMaterialBlockConnectionPointTypes = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBlockTargets.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBlockTargets.ts ***!\n \\****************************************************/\n/*! exports provided: NodeMaterialBlockTargets */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return NodeMaterialBlockTargets; });\n/**\r\n * Enum used to define the target of a block\r\n */\r\nvar NodeMaterialBlockTargets;\r\n(function (NodeMaterialBlockTargets) {\r\n /** Vertex shader */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"Vertex\"] = 1] = \"Vertex\";\r\n /** Fragment shader */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"Fragment\"] = 2] = \"Fragment\";\r\n /** Neutral */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"Neutral\"] = 4] = \"Neutral\";\r\n /** Vertex and Fragment */\r\n NodeMaterialBlockTargets[NodeMaterialBlockTargets[\"VertexAndFragment\"] = 3] = \"VertexAndFragment\";\r\n})(NodeMaterialBlockTargets || (NodeMaterialBlockTargets = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBuildState.ts\":\n/*!**************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBuildState.ts ***!\n \\**************************************************/\n/*! exports provided: NodeMaterialBuildState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBuildState\", function() { return NodeMaterialBuildState; });\n/* harmony import */ var _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodeMaterialBlockConnectionPointTypes */ \"./Materials/Node/nodeMaterialBlockConnectionPointTypes.ts\");\n/* harmony import */ var _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeMaterialBlockTargets */ \"./Materials/Node/nodeMaterialBlockTargets.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Misc_stringTools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/stringTools */ \"./Misc/stringTools.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store node based material build state\r\n */\r\nvar NodeMaterialBuildState = /** @class */ (function () {\r\n function NodeMaterialBuildState() {\r\n /** Gets or sets a boolean indicating if the current state can emit uniform buffers */\r\n this.supportUniformBuffers = false;\r\n /**\r\n * Gets the list of emitted attributes\r\n */\r\n this.attributes = new Array();\r\n /**\r\n * Gets the list of emitted uniforms\r\n */\r\n this.uniforms = new Array();\r\n /**\r\n * Gets the list of emitted uniform buffers\r\n */\r\n this.uniformBuffers = new Array();\r\n /**\r\n * Gets the list of emitted samplers\r\n */\r\n this.samplers = new Array();\r\n /**\r\n * Gets the list of emitted functions\r\n */\r\n this.functions = {};\r\n /**\r\n * Gets the list of emitted extensions\r\n */\r\n this.extensions = {};\r\n /**\r\n * Gets the list of emitted counters\r\n */\r\n this.counters = {};\r\n /** @hidden */\r\n this._attributeDeclaration = \"\";\r\n /** @hidden */\r\n this._uniformDeclaration = \"\";\r\n /** @hidden */\r\n this._samplerDeclaration = \"\";\r\n /** @hidden */\r\n this._varyingTransfer = \"\";\r\n this._repeatableContentAnchorIndex = 0;\r\n /** @hidden */\r\n this._builtCompilationString = \"\";\r\n /**\r\n * Gets the emitted compilation strings\r\n */\r\n this.compilationString = \"\";\r\n }\r\n /**\r\n * Finalize the compilation strings\r\n * @param state defines the current compilation state\r\n */\r\n NodeMaterialBuildState.prototype.finalize = function (state) {\r\n var emitComments = state.sharedData.emitComments;\r\n var isFragmentMode = (this.target === _nodeMaterialBlockTargets__WEBPACK_IMPORTED_MODULE_1__[\"NodeMaterialBlockTargets\"].Fragment);\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Entry point\\r\\n\" : \"\") + \"void main(void) {\\r\\n\" + this.compilationString;\r\n var functionCode = \"\";\r\n for (var functionName in this.functions) {\r\n functionCode += this.functions[functionName] + \"\\r\\n\";\r\n }\r\n this.compilationString = \"\\r\\n\" + functionCode + \"\\r\\n\" + this.compilationString;\r\n if (!isFragmentMode && this._varyingTransfer) {\r\n this.compilationString = this.compilationString + \"\\r\\n\" + this._varyingTransfer;\r\n }\r\n this.compilationString = this.compilationString + \"\\r\\n}\";\r\n if (this.sharedData.varyingDeclaration) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Varyings\\r\\n\" : \"\") + this.sharedData.varyingDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n if (this._samplerDeclaration) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Samplers\\r\\n\" : \"\") + this._samplerDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n if (this._uniformDeclaration) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Uniforms\\r\\n\" : \"\") + this._uniformDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n if (this._attributeDeclaration && !isFragmentMode) {\r\n this.compilationString = \"\\r\\n\" + (emitComments ? \"//Attributes\\r\\n\" : \"\") + this._attributeDeclaration + \"\\r\\n\" + this.compilationString;\r\n }\r\n for (var extensionName in this.extensions) {\r\n var extension = this.extensions[extensionName];\r\n this.compilationString = \"\\r\\n\" + extension + \"\\r\\n\" + this.compilationString;\r\n }\r\n this._builtCompilationString = this.compilationString;\r\n };\r\n Object.defineProperty(NodeMaterialBuildState.prototype, \"_repeatableContentAnchor\", {\r\n /** @hidden */\r\n get: function () {\r\n return \"###___ANCHOR\" + this._repeatableContentAnchorIndex++ + \"___###\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._getFreeVariableName = function (prefix) {\r\n prefix = prefix.replace(/[^a-zA-Z_]+/g, \"\");\r\n if (this.sharedData.variableNames[prefix] === undefined) {\r\n this.sharedData.variableNames[prefix] = 0;\r\n // Check reserved words\r\n if (prefix === \"output\" || prefix === \"texture\") {\r\n return prefix + this.sharedData.variableNames[prefix];\r\n }\r\n return prefix;\r\n }\r\n else {\r\n this.sharedData.variableNames[prefix]++;\r\n }\r\n return prefix + this.sharedData.variableNames[prefix];\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._getFreeDefineName = function (prefix) {\r\n if (this.sharedData.defineNames[prefix] === undefined) {\r\n this.sharedData.defineNames[prefix] = 0;\r\n }\r\n else {\r\n this.sharedData.defineNames[prefix]++;\r\n }\r\n return prefix + this.sharedData.defineNames[prefix];\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._excludeVariableName = function (name) {\r\n this.sharedData.variableNames[name] = 0;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._getGLType = function (type) {\r\n switch (type) {\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Float:\r\n return \"float\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Int:\r\n return \"int\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector2:\r\n return \"vec2\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color3:\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector3:\r\n return \"vec3\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Color4:\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Vector4:\r\n return \"vec4\";\r\n case _nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_0__[\"NodeMaterialBlockConnectionPointTypes\"].Matrix:\r\n return \"mat4\";\r\n }\r\n return \"\";\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitExtension = function (name, extension) {\r\n if (this.extensions[name]) {\r\n return;\r\n }\r\n this.extensions[name] = extension;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitFunction = function (name, code, comments) {\r\n if (this.functions[name]) {\r\n return;\r\n }\r\n if (this.sharedData.emitComments) {\r\n code = comments + \"\\r\\n\" + code;\r\n }\r\n this.functions[name] = code;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitCodeFromInclude = function (includeName, comments, options) {\r\n if (options && options.repeatKey) {\r\n return \"#include<\" + includeName + \">[0..\" + options.repeatKey + \"]\\r\\n\";\r\n }\r\n var code = _effect__WEBPACK_IMPORTED_MODULE_2__[\"Effect\"].IncludesShadersStore[includeName] + \"\\r\\n\";\r\n if (this.sharedData.emitComments) {\r\n code = comments + \"\\r\\n\" + code;\r\n }\r\n if (!options) {\r\n return code;\r\n }\r\n if (options.replaceStrings) {\r\n for (var index = 0; index < options.replaceStrings.length; index++) {\r\n var replaceString = options.replaceStrings[index];\r\n code = code.replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n return code;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitFunctionFromInclude = function (includeName, comments, options, storeKey) {\r\n if (storeKey === void 0) { storeKey = \"\"; }\r\n var key = includeName + storeKey;\r\n if (this.functions[key]) {\r\n return;\r\n }\r\n if (!options || (!options.removeAttributes && !options.removeUniforms && !options.removeVaryings && !options.removeIfDef && !options.replaceStrings)) {\r\n if (options && options.repeatKey) {\r\n this.functions[key] = \"#include<\" + includeName + \">[0..\" + options.repeatKey + \"]\\r\\n\";\r\n }\r\n else {\r\n this.functions[key] = \"#include<\" + includeName + \">\\r\\n\";\r\n }\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + \"\\r\\n\" + this.functions[key];\r\n }\r\n return;\r\n }\r\n this.functions[key] = _effect__WEBPACK_IMPORTED_MODULE_2__[\"Effect\"].IncludesShadersStore[includeName];\r\n if (this.sharedData.emitComments) {\r\n this.functions[key] = comments + \"\\r\\n\" + this.functions[key];\r\n }\r\n if (options.removeIfDef) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#ifdef.+$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#endif.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#else.*$/gm, \"\");\r\n this.functions[key] = this.functions[key].replace(/^\\s*?#elif.*$/gm, \"\");\r\n }\r\n if (options.removeAttributes) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?attribute.+$/gm, \"\");\r\n }\r\n if (options.removeUniforms) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?uniform.+$/gm, \"\");\r\n }\r\n if (options.removeVaryings) {\r\n this.functions[key] = this.functions[key].replace(/^\\s*?varying.+$/gm, \"\");\r\n }\r\n if (options.replaceStrings) {\r\n for (var index = 0; index < options.replaceStrings.length; index++) {\r\n var replaceString = options.replaceStrings[index];\r\n this.functions[key] = this.functions[key].replace(replaceString.search, replaceString.replace);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._registerTempVariable = function (name) {\r\n if (this.sharedData.temps.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n this.sharedData.temps.push(name);\r\n return true;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitVaryingFromString = function (name, type, define, notDefine) {\r\n if (define === void 0) { define = \"\"; }\r\n if (notDefine === void 0) { notDefine = false; }\r\n if (this.sharedData.varyings.indexOf(name) !== -1) {\r\n return false;\r\n }\r\n this.sharedData.varyings.push(name);\r\n if (define) {\r\n if (_Misc_stringTools__WEBPACK_IMPORTED_MODULE_3__[\"StringTools\"].StartsWith(define, \"defined(\")) {\r\n this.sharedData.varyingDeclaration += \"#if \" + define + \"\\r\\n\";\r\n }\r\n else {\r\n this.sharedData.varyingDeclaration += (notDefine ? \"#ifndef\" : \"#ifdef\") + \" \" + define + \"\\r\\n\";\r\n }\r\n }\r\n this.sharedData.varyingDeclaration += \"varying \" + type + \" \" + name + \";\\r\\n\";\r\n if (define) {\r\n this.sharedData.varyingDeclaration += \"#endif\\r\\n\";\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n NodeMaterialBuildState.prototype._emitUniformFromString = function (name, type, define, notDefine) {\r\n if (define === void 0) { define = \"\"; }\r\n if (notDefine === void 0) { notDefine = false; }\r\n if (this.uniforms.indexOf(name) !== -1) {\r\n return;\r\n }\r\n this.uniforms.push(name);\r\n if (define) {\r\n this._uniformDeclaration += (notDefine ? \"#ifndef\" : \"#ifdef\") + \" \" + define + \"\\r\\n\";\r\n }\r\n this._uniformDeclaration += \"uniform \" + type + \" \" + name + \";\\r\\n\";\r\n if (define) {\r\n this._uniformDeclaration += \"#endif\\r\\n\";\r\n }\r\n };\r\n return NodeMaterialBuildState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialBuildStateSharedData.ts\":\n/*!************************************************************!*\\\n !*** ./Materials/Node/nodeMaterialBuildStateSharedData.ts ***!\n \\************************************************************/\n/*! exports provided: NodeMaterialBuildStateSharedData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBuildStateSharedData\", function() { return NodeMaterialBuildStateSharedData; });\n/**\r\n * Class used to store shared data between 2 NodeMaterialBuildState\r\n */\r\nvar NodeMaterialBuildStateSharedData = /** @class */ (function () {\r\n /** Creates a new shared data */\r\n function NodeMaterialBuildStateSharedData() {\r\n /**\r\n * Gets the list of emitted varyings\r\n */\r\n this.temps = new Array();\r\n /**\r\n * Gets the list of emitted varyings\r\n */\r\n this.varyings = new Array();\r\n /**\r\n * Gets the varying declaration string\r\n */\r\n this.varyingDeclaration = \"\";\r\n /**\r\n * Input blocks\r\n */\r\n this.inputBlocks = new Array();\r\n /**\r\n * Input blocks\r\n */\r\n this.textureBlocks = new Array();\r\n /**\r\n * Bindable blocks (Blocks that need to set data to the effect)\r\n */\r\n this.bindableBlocks = new Array();\r\n /**\r\n * List of blocks that can provide a compilation fallback\r\n */\r\n this.blocksWithFallbacks = new Array();\r\n /**\r\n * List of blocks that can provide a define update\r\n */\r\n this.blocksWithDefines = new Array();\r\n /**\r\n * List of blocks that can provide a repeatable content\r\n */\r\n this.repeatableContentBlocks = new Array();\r\n /**\r\n * List of blocks that can provide a dynamic list of uniforms\r\n */\r\n this.dynamicUniformBlocks = new Array();\r\n /**\r\n * List of blocks that can block the isReady function for the material\r\n */\r\n this.blockingBlocks = new Array();\r\n /**\r\n * Gets the list of animated inputs\r\n */\r\n this.animatedInputs = new Array();\r\n /** List of emitted variables */\r\n this.variableNames = {};\r\n /** List of emitted defines */\r\n this.defineNames = {};\r\n /**\r\n * Gets the compilation hints emitted at compilation time\r\n */\r\n this.hints = {\r\n needWorldViewMatrix: false,\r\n needWorldViewProjectionMatrix: false,\r\n needAlphaBlending: false,\r\n needAlphaTesting: false\r\n };\r\n /**\r\n * List of compilation checks\r\n */\r\n this.checks = {\r\n emitVertex: false,\r\n emitFragment: false,\r\n notConnectedNonOptionalInputs: new Array()\r\n };\r\n // Exclude usual attributes from free variable names\r\n this.variableNames[\"position\"] = 0;\r\n this.variableNames[\"normal\"] = 0;\r\n this.variableNames[\"tangent\"] = 0;\r\n this.variableNames[\"uv\"] = 0;\r\n this.variableNames[\"uv2\"] = 0;\r\n this.variableNames[\"uv3\"] = 0;\r\n this.variableNames[\"uv4\"] = 0;\r\n this.variableNames[\"uv4\"] = 0;\r\n this.variableNames[\"uv5\"] = 0;\r\n this.variableNames[\"uv6\"] = 0;\r\n this.variableNames[\"color\"] = 0;\r\n this.variableNames[\"matricesIndices\"] = 0;\r\n this.variableNames[\"matricesWeights\"] = 0;\r\n this.variableNames[\"matricesIndicesExtra\"] = 0;\r\n this.variableNames[\"matricesWeightsExtra\"] = 0;\r\n this.variableNames[\"diffuseBase\"] = 0;\r\n this.variableNames[\"specularBase\"] = 0;\r\n this.variableNames[\"worldPos\"] = 0;\r\n // Exclude known varyings\r\n this.variableNames[\"vTBN\"] = 0;\r\n // Exclude defines\r\n this.defineNames[\"MAINUV0\"] = 0;\r\n this.defineNames[\"MAINUV1\"] = 0;\r\n this.defineNames[\"MAINUV2\"] = 0;\r\n this.defineNames[\"MAINUV3\"] = 0;\r\n this.defineNames[\"MAINUV4\"] = 0;\r\n this.defineNames[\"MAINUV5\"] = 0;\r\n this.defineNames[\"MAINUV6\"] = 0;\r\n this.defineNames[\"MAINUV7\"] = 0;\r\n }\r\n /**\r\n * Emits console errors and exceptions if there is a failing check\r\n */\r\n NodeMaterialBuildStateSharedData.prototype.emitErrors = function () {\r\n var errorMessage = \"\";\r\n if (!this.checks.emitVertex) {\r\n errorMessage += \"NodeMaterial does not have a vertex output. You need to at least add a block that generates a glPosition value.\\r\\n\";\r\n }\r\n if (!this.checks.emitFragment) {\r\n errorMessage += \"NodeMaterial does not have a fragment output. You need to at least add a block that generates a glFragColor value.\\r\\n\";\r\n }\r\n for (var _i = 0, _a = this.checks.notConnectedNonOptionalInputs; _i < _a.length; _i++) {\r\n var notConnectedInput = _a[_i];\r\n errorMessage += \"input \" + notConnectedInput.name + \" from block \" + notConnectedInput.ownerBlock.name + \"[\" + notConnectedInput.ownerBlock.getClassName() + \"] is not connected and is not optional.\\r\\n\";\r\n }\r\n if (errorMessage) {\r\n throw \"Build of NodeMaterial failed:\\r\\n\" + errorMessage;\r\n }\r\n };\r\n return NodeMaterialBuildStateSharedData;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Node/nodeMaterialSystemValues.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/Node/nodeMaterialSystemValues.ts ***!\n \\****************************************************/\n/*! exports provided: NodeMaterialSystemValues */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return NodeMaterialSystemValues; });\n/**\r\n * Enum used to define system values e.g. values automatically provided by the system\r\n */\r\nvar NodeMaterialSystemValues;\r\n(function (NodeMaterialSystemValues) {\r\n /** World */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"World\"] = 1] = \"World\";\r\n /** View */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"View\"] = 2] = \"View\";\r\n /** Projection */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"Projection\"] = 3] = \"Projection\";\r\n /** ViewProjection */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"ViewProjection\"] = 4] = \"ViewProjection\";\r\n /** WorldView */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"WorldView\"] = 5] = \"WorldView\";\r\n /** WorldViewProjection */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"WorldViewProjection\"] = 6] = \"WorldViewProjection\";\r\n /** CameraPosition */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"CameraPosition\"] = 7] = \"CameraPosition\";\r\n /** Fog Color */\r\n NodeMaterialSystemValues[NodeMaterialSystemValues[\"FogColor\"] = 8] = \"FogColor\";\r\n})(NodeMaterialSystemValues || (NodeMaterialSystemValues = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/index.ts\":\n/*!********************************!*\\\n !*** ./Materials/PBR/index.ts ***!\n \\********************************/\n/*! exports provided: PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pbrBaseMaterial */ \"./Materials/PBR/pbrBaseMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_0__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_0__[\"PBRBaseMaterial\"]; });\n\n/* harmony import */ var _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pbrBaseSimpleMaterial */ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_1__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony import */ var _pbrMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pbrMaterial */ \"./Materials/PBR/pbrMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _pbrMaterial__WEBPACK_IMPORTED_MODULE_2__[\"PBRMaterial\"]; });\n\n/* harmony import */ var _pbrMetallicRoughnessMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pbrMetallicRoughnessMaterial */ \"./Materials/PBR/pbrMetallicRoughnessMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _pbrMetallicRoughnessMaterial__WEBPACK_IMPORTED_MODULE_3__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony import */ var _pbrSpecularGlossinessMaterial__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pbrSpecularGlossinessMaterial */ \"./Materials/PBR/pbrSpecularGlossinessMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _pbrSpecularGlossinessMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRSpecularGlossinessMaterial\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrAnisotropicConfiguration.ts\":\n/*!******************************************************!*\\\n !*** ./Materials/PBR/pbrAnisotropicConfiguration.ts ***!\n \\******************************************************/\n/*! exports provided: PBRAnisotropicConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRAnisotropicConfiguration\", function() { return PBRAnisotropicConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the anisotropic parameters of the pbr material.\r\n */\r\nvar PBRAnisotropicConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of anisotropy configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRAnisotropicConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the anisotropy is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the anisotropy strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines if the effect is along the tangents, bitangents or in between.\r\n * By default, the effect is \"strectching\" the highlights along the tangents.\r\n */\r\n this.direction = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1, 0);\r\n this._texture = null;\r\n /**\r\n * Stores the anisotropy values in a texture.\r\n * rg is direction (like normal from -1 to 1)\r\n * b is a intensity\r\n */\r\n this.texture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRAnisotropicConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param mesh the mesh we are preparing the defines for.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRAnisotropicConfiguration.prototype.prepareDefines = function (defines, mesh, scene) {\r\n if (this._isEnabled) {\r\n defines.ANISOTROPIC = this._isEnabled;\r\n if (this._isEnabled && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].TangentKind)) {\r\n defines._needUVs = true;\r\n defines.MAINUV1 = true;\r\n }\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._texture, defines, \"ANISOTROPIC_TEXTURE\");\r\n }\r\n else {\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.ANISOTROPIC = false;\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vAnisotropyInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindTextureMatrix(this._texture, uniformBuffer, \"anisotropy\");\r\n }\r\n // Anisotropy\r\n uniformBuffer.updateFloat3(\"vAnisotropy\", this.direction.x, this.direction.y, this.intensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_4__[\"MaterialFlags\"].AnisotropicTextureEnabled) {\r\n uniformBuffer.setTexture(\"anisotropySampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRAnisotropicConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRAnisotropicConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRAnisotropicConfiguration\"\r\n */\r\n PBRAnisotropicConfiguration.prototype.getClassName = function () {\r\n return \"PBRAnisotropicConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRAnisotropicConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.ANISOTROPIC) {\r\n fallbacks.addFallback(currentRank++, \"ANISOTROPIC\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRAnisotropicConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vAnisotropy\", \"vAnisotropyInfos\", \"anisotropyMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRAnisotropicConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vAnisotropy\", 3);\r\n uniformBuffer.addUniform(\"vAnisotropyInfos\", 2);\r\n uniformBuffer.addUniform(\"anisotropyMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRAnisotropicConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"anisotropySampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param anisotropicConfiguration define the config where to copy the info\r\n */\r\n PBRAnisotropicConfiguration.prototype.copyTo = function (anisotropicConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return anisotropicConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this anisotropy configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRAnisotropicConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRAnisotropicConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRAnisotropicConfiguration.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector2\"])()\r\n ], PBRAnisotropicConfiguration.prototype, \"direction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"texture\", void 0);\r\n return PBRAnisotropicConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrBRDFConfiguration.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/PBR/pbrBRDFConfiguration.ts ***!\n \\***********************************************/\n/*! exports provided: PBRBRDFConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRBRDFConfiguration\", function() { return PBRBRDFConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n\r\n\r\n/**\r\n * Define the code related to the BRDF parameters of the pbr material.\r\n */\r\nvar PBRBRDFConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsMiscDirty Callback to flag the material to dirty\r\n */\r\n function PBRBRDFConfiguration(markAllSubMeshesAsMiscDirty) {\r\n this._useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n /**\r\n * Defines if the material uses energy conservation.\r\n */\r\n this.useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n this._useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses height smith correlated visibility term.\r\n * If you intent to not use our default BRDF, you need to load a separate BRDF Texture for the PBR\r\n * You can either load https://assets.babylonjs.com/environments/uncorrelatedBRDF.png\r\n * or https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds to have more precision\r\n * Not relying on height correlated will also disable energy conservation.\r\n */\r\n this.useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n this._useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses spherical harmonics vs spherical polynomials for the\r\n * diffuse part of the IBL.\r\n * The harmonics despite a tiny bigger cost has been proven to provide closer results\r\n * to the ground truth.\r\n */\r\n this.useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n this._internalMarkAllSubMeshesAsMiscDirty = markAllSubMeshesAsMiscDirty;\r\n }\r\n /** @hidden */\r\n PBRBRDFConfiguration.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._internalMarkAllSubMeshesAsMiscDirty();\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n */\r\n PBRBRDFConfiguration.prototype.prepareDefines = function (defines) {\r\n defines.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated;\r\n defines.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated;\r\n defines.SPHERICAL_HARMONICS = this._useSphericalHarmonics;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRBRDFConfiguration.prototype.getClassName = function () {\r\n return \"PBRBRDFConfiguration\";\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param brdfConfiguration define the config where to copy the info\r\n */\r\n PBRBRDFConfiguration.prototype.copyTo = function (brdfConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return brdfConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRBRDFConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRBRDFConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * Default value used for the energy conservation.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION = true;\r\n /**\r\n * Default value used for the Smith Visibility Height Correlated mode.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true;\r\n /**\r\n * Default value used for the IBL diffuse part.\r\n * This can help switching back to the polynomials mode globally which is a tiny bit\r\n * less GPU intensive at the drawback of a lower quality.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS = true;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useEnergyConservation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSmithVisibilityHeightCorrelated\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSphericalHarmonics\", void 0);\r\n return PBRBRDFConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrBaseMaterial.ts\":\n/*!******************************************!*\\\n !*** ./Materials/PBR/pbrBaseMaterial.ts ***!\n \\******************************************/\n/*! exports provided: PBRMaterialDefines, PBRBaseMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return PBRMaterialDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return PBRBaseMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/brdfTextureTools */ \"./Misc/brdfTextureTools.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./pbrClearCoatConfiguration */ \"./Materials/PBR/pbrClearCoatConfiguration.ts\");\n/* harmony import */ var _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./pbrAnisotropicConfiguration */ \"./Materials/PBR/pbrAnisotropicConfiguration.ts\");\n/* harmony import */ var _pbrBRDFConfiguration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pbrBRDFConfiguration */ \"./Materials/PBR/pbrBRDFConfiguration.ts\");\n/* harmony import */ var _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./pbrSheenConfiguration */ \"./Materials/PBR/pbrSheenConfiguration.ts\");\n/* harmony import */ var _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./pbrSubSurfaceConfiguration */ \"./Materials/PBR/pbrSubSurfaceConfiguration.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Materials/pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_pbr_fragment__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../Shaders/pbr.fragment */ \"./Shaders/pbr.fragment.ts\");\n/* harmony import */ var _Shaders_pbr_vertex__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../Shaders/pbr.vertex */ \"./Shaders/pbr.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Manages the defines for the PBR Material.\r\n * @hidden\r\n */\r\nvar PBRMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRMaterialDefines, _super);\r\n /**\r\n * Initializes the PBR Material defines.\r\n */\r\n function PBRMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.PBR = true;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.ALBEDO = false;\r\n _this.ALBEDODIRECTUV = 0;\r\n _this.VERTEXCOLOR = false;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.AMBIENTINGRAYSCALE = false;\r\n _this.OPACITY = false;\r\n _this.VERTEXALPHA = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHABLEND = false;\r\n _this.ALPHAFROMALBEDO = false;\r\n _this.ALPHATESTVALUE = \"0.5\";\r\n _this.SPECULAROVERALPHA = false;\r\n _this.RADIANCEOVERALPHA = false;\r\n _this.ALPHAFRESNEL = false;\r\n _this.LINEARALPHAFRESNEL = false;\r\n _this.PREMULTIPLYALPHA = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.REFLECTIVITY = false;\r\n _this.REFLECTIVITYDIRECTUV = 0;\r\n _this.SPECULARTERM = false;\r\n _this.MICROSURFACEFROMREFLECTIVITYMAP = false;\r\n _this.MICROSURFACEAUTOMATIC = false;\r\n _this.LODBASEDMICROSFURACE = false;\r\n _this.MICROSURFACEMAP = false;\r\n _this.MICROSURFACEMAPDIRECTUV = 0;\r\n _this.METALLICWORKFLOW = false;\r\n _this.ROUGHNESSSTOREINMETALMAPALPHA = false;\r\n _this.ROUGHNESSSTOREINMETALMAPGREEN = false;\r\n _this.METALLNESSSTOREINMETALMAPBLUE = false;\r\n _this.AOSTOREINMETALMAPRED = false;\r\n _this.ENVIRONMENTBRDF = false;\r\n _this.ENVIRONMENTBRDF_RGBD = false;\r\n _this.NORMAL = false;\r\n _this.TANGENT = false;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.NORMALXYSCALE = true;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.GAMMALIGHTMAP = false;\r\n _this.RGBDLIGHTMAP = false;\r\n _this.REFLECTION = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.USESPHERICALFROMREFLECTIONMAP = false;\r\n _this.USEIRRADIANCEMAP = false;\r\n _this.SPHERICAL_HARMONICS = false;\r\n _this.USESPHERICALINVERTEX = false;\r\n _this.REFLECTIONMAP_OPPOSITEZ = false;\r\n _this.LODINREFLECTIONALPHA = false;\r\n _this.GAMMAREFLECTION = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.LINEARSPECULARREFLECTION = false;\r\n _this.RADIANCEOCCLUSION = false;\r\n _this.HORIZONOCCLUSION = false;\r\n _this.INSTANCES = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.NONUNIFORMSCALING = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.MULTIVIEW = false;\r\n _this.USEPHYSICALLIGHTFALLOFF = false;\r\n _this.USEGLTFLIGHTFALLOFF = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.FORCENORMALFORWARD = false;\r\n _this.SPECULARAA = false;\r\n _this.CLEARCOAT = false;\r\n _this.CLEARCOAT_DEFAULTIOR = false;\r\n _this.CLEARCOAT_TEXTURE = false;\r\n _this.CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n _this.CLEARCOAT_BUMP = false;\r\n _this.CLEARCOAT_BUMPDIRECTUV = 0;\r\n _this.CLEARCOAT_TINT = false;\r\n _this.CLEARCOAT_TINT_TEXTURE = false;\r\n _this.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n _this.ANISOTROPIC = false;\r\n _this.ANISOTROPIC_TEXTURE = false;\r\n _this.ANISOTROPIC_TEXTUREDIRECTUV = 0;\r\n _this.BRDF_V_HEIGHT_CORRELATED = false;\r\n _this.MS_BRDF_ENERGY_CONSERVATION = false;\r\n _this.SHEEN = false;\r\n _this.SHEEN_TEXTURE = false;\r\n _this.SHEEN_TEXTUREDIRECTUV = 0;\r\n _this.SHEEN_LINKWITHALBEDO = false;\r\n _this.SUBSURFACE = false;\r\n _this.SS_REFRACTION = false;\r\n _this.SS_TRANSLUCENCY = false;\r\n _this.SS_SCATERRING = false;\r\n _this.SS_THICKNESSANDMASK_TEXTURE = false;\r\n _this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0;\r\n _this.SS_REFRACTIONMAP_3D = false;\r\n _this.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n _this.SS_LODINREFRACTIONALPHA = false;\r\n _this.SS_GAMMAREFRACTION = false;\r\n _this.SS_RGBDREFRACTION = false;\r\n _this.SS_LINEARSPECULARREFRACTION = false;\r\n _this.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n _this.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n _this.UNLIT = false;\r\n _this.DEBUGMODE = 0;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n /**\r\n * Resets the PBR Material defines.\r\n */\r\n PBRMaterialDefines.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this.ALPHATESTVALUE = \"0.5\";\r\n this.PBR = true;\r\n };\r\n return PBRMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_16__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * The Physically based material base class of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRBaseMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRBaseMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRBaseMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this._directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this._emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this._environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this._specularIntensity = 1.0;\r\n /**\r\n * This stores the direct, emissive, environment, and specular light intensities into a Vector4.\r\n */\r\n _this._lightingInfos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_6__[\"Vector4\"](_this._directIntensity, _this._emissiveIntensity, _this._environmentIntensity, _this._specularIntensity);\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this._disableBumpMap = false;\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n _this._albedoTexture = null;\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n _this._ambientTexture = null;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this._ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this._ambientTextureImpactOnAnalyticalLights = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * Stores the alpha values in a texture.\r\n */\r\n _this._opacityTexture = null;\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n _this._reflectionTexture = null;\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n _this._emissiveTexture = null;\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n _this._reflectivityTexture = null;\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n _this._metallicTexture = null;\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n _this._metallic = null;\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n _this._roughness = null;\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n _this._microSurfaceTexture = null;\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n _this._bumpTexture = null;\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n _this._lightmapTexture = null;\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this._ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this._albedoColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this._reflectivityColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](1, 1, 1);\r\n /**\r\n * The color applied when light is reflected from a material.\r\n */\r\n _this._reflectionColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](1, 1, 1);\r\n /**\r\n * The color applied when light is emitted from a material.\r\n */\r\n _this._emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this._microSurface = 0.9;\r\n /**\r\n * Specifies that the material will use the light map as a show map.\r\n */\r\n _this._useLightmapAsShadowmap = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this._useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this._useRadianceOcclusion = true;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this._useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this._useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this._useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this._useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this._useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this._useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this._useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Defines the falloff type used in this material.\r\n * It by default is Physical.\r\n */\r\n _this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this._useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this._useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this._useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this._parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this._disableLighting = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this._maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n */\r\n _this._invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n */\r\n _this._invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this._twoSidedLighting = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this._alphaCutOff = 0.4;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this._forceAlphaTest = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this._useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this._useLinearAlphaFresnel = false;\r\n /**\r\n * The transparency mode of the material.\r\n */\r\n _this._transparencyMode = null;\r\n /**\r\n * Specifies the environment BRDF texture used to comput the scale and offset roughness values\r\n * from cos thetav and roughness:\r\n * http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf\r\n */\r\n _this._environmentBRDFTexture = null;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this._forceIrradianceInFragment = false;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this._forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this._enableSpecularAntiAliasing = false;\r\n /**\r\n * Keep track of the image processing observer to allow dispose and replace.\r\n */\r\n _this._imageProcessingObserver = null;\r\n /**\r\n * Stores the available render targets.\r\n */\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_3__[\"SmartArray\"](16);\r\n /**\r\n * Sets the global ambient color for the material used in lighting calculations.\r\n */\r\n _this._globalAmbientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"](0, 0, 0);\r\n /**\r\n * Enables the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n _this._useLogarithmicDepth = false;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this._unlit = false;\r\n _this._debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Defines the material debug mode.\r\n * It helps seeing only some components of the material while troubleshooting.\r\n */\r\n _this.debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Specify from where on screen the debug mode should start.\r\n * The value goes from -1 (full screen) to 1 (not visible)\r\n * It helps with side by side comparison against the final render\r\n * This defaults to -1\r\n */\r\n _this.debugLimit = -1;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * As the default viewing range might not be enough (if the ambient is really small for instance)\r\n * You can use the factor to better multiply the final value.\r\n */\r\n _this.debugFactor = 1;\r\n /**\r\n * Defines the clear coat layer parameters for the material.\r\n */\r\n _this.clearCoat = new _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the anisotropic parameters for the material.\r\n */\r\n _this.anisotropy = new _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the BRDF parameters for the material.\r\n */\r\n _this.brdf = new _pbrBRDFConfiguration__WEBPACK_IMPORTED_MODULE_10__[\"PBRBRDFConfiguration\"](_this._markAllSubMeshesAsMiscDirty.bind(_this));\r\n /**\r\n * Defines the Sheen parameters for the material.\r\n */\r\n _this.sheen = new _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the SubSurface parameters for the material.\r\n */\r\n _this.subSurface = new _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"](_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n _this.subSurface.fillRenderTargetTextures(_this._renderTargets);\r\n return _this._renderTargets;\r\n };\r\n _this._environmentBRDFTexture = _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_4__[\"BRDFTextureTools\"].GetEnvironmentBRDFTexture(scene);\r\n return _this;\r\n }\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration\r\n */\r\n PBRBaseMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return this.subSurface.hasRenderTargetTextures();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the name of the material class.\r\n */\r\n PBRBaseMaterial.prototype.getClassName = function () {\r\n return \"PBRBaseMaterial\";\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"transparencyMode\", {\r\n /**\r\n * Gets the current transparency mode.\r\n */\r\n get: function () {\r\n return this._transparencyMode;\r\n },\r\n /**\r\n * Sets the transparency mode of the material.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | OPAQUE | |\r\n * | 1 | ALPHATEST | |\r\n * | 2 | ALPHABLEND | |\r\n * | 3 | ALPHATESTANDBLEND | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._transparencyMode === value) {\r\n return;\r\n }\r\n this._transparencyMode = value;\r\n this._forceAlphaTest = (value === PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND);\r\n this._markAllSubMeshesAsTexturesAndMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"_disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return (this.subSurface.disableAlphaBlending ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_OPAQUE ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromAlbedoTexture();\r\n };\r\n /**\r\n * Specifies if the mesh will require alpha blending.\r\n * @param mesh - BJS mesh.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaBlendingForMesh = function (mesh) {\r\n if (this._disableAlphaBlending && mesh.visibility >= 1.0) {\r\n return false;\r\n }\r\n return _super.prototype.needAlphaBlendingForMesh.call(this, mesh);\r\n };\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n if (this.subSurface.disableAlphaBlending) {\r\n return false;\r\n }\r\n return this._albedoTexture != null && this._albedoTexture.hasAlpha && (this._transparencyMode == null || this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n };\r\n /**\r\n * Specifies whether or not the alpha value of the albedo texture should be used for alpha blending.\r\n */\r\n PBRBaseMaterial.prototype._shouldUseAlphaFromAlbedoTexture = function () {\r\n return this._albedoTexture != null && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n };\r\n /**\r\n * Gets the texture used for the alpha test.\r\n */\r\n PBRBaseMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._albedoTexture;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param mesh - BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh. Used to check if it is ready.\r\n * @param useInstances - Specifies that instances should be used.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRBaseMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new PBRMaterialDefines();\r\n }\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === this.getScene().getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (!reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n if (reflectionTexture.irradianceTexture && !reflectionTexture.irradianceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n if (!this._metallicTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n else if (this._reflectivityTexture) {\r\n if (!this._reflectivityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._microSurfaceTexture) {\r\n if (!this._microSurfaceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._environmentBRDFTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n // This is blocking.\r\n if (!this._environmentBRDFTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n if (!this.subSurface.isReadyForSubMesh(defines, scene) ||\r\n !this.clearCoat.isReadyForSubMesh(defines, scene, engine, this._disableBumpMap) ||\r\n !this.sheen.isReadyForSubMesh(defines, scene) ||\r\n !this.anisotropy.isReadyForSubMesh(defines, scene)) {\r\n return false;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (!engine.getCaps().standardDerivatives && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].NormalKind)) {\r\n mesh.createNormals(true);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"PBRMaterial: Normals have been created for the mesh: \" + mesh.name);\r\n }\r\n var previousEffect = subMesh.effect;\r\n var lightDisposed = defines._areLightsDisposed;\r\n var effect = this._prepareEffect(mesh, defines, this.onCompiled, this.onError, useInstances);\r\n if (effect) {\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Specifies if the material uses metallic roughness workflow.\r\n * @returns boolean specifiying if the material uses metallic roughness workflow.\r\n */\r\n PBRBaseMaterial.prototype.isMetallicWorkflow = function () {\r\n if (this._metallic != null || this._roughness != null || this._metallicTexture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n PBRBaseMaterial.prototype._prepareEffect = function (mesh, defines, onCompiled, onError, useInstances, useClipPlane) {\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n this._prepareDefines(mesh, defines, useInstances, useClipPlane);\r\n if (!defines.isDirty) {\r\n return null;\r\n }\r\n defines.markAsProcessed();\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Fallbacks\r\n var fallbacks = new _Materials_effect__WEBPACK_IMPORTED_MODULE_15__[\"EffectFallbacks\"]();\r\n var fallbackRank = 0;\r\n if (defines.USESPHERICALINVERTEX) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALINVERTEX\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(fallbackRank, \"FOG\");\r\n }\r\n if (defines.SPECULARAA) {\r\n fallbacks.addFallback(fallbackRank, \"SPECULARAA\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(fallbackRank, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(fallbackRank, \"LOGARITHMICDEPTH\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(fallbackRank, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(fallbackRank++, \"PARALLAXOCCLUSION\");\r\n }\r\n fallbackRank = _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].AddFallbacks(defines, fallbacks, fallbackRank);\r\n if (defines.ENVIRONMENTBRDF) {\r\n fallbacks.addFallback(fallbackRank++, \"ENVIRONMENTBRDF\");\r\n }\r\n if (defines.TANGENT) {\r\n fallbacks.addFallback(fallbackRank++, \"TANGENT\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(fallbackRank++, \"BUMP\");\r\n }\r\n fallbackRank = _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights, fallbackRank++);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(fallbackRank++, \"SPECULARTERM\");\r\n }\r\n if (defines.USESPHERICALFROMREFLECTIONMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALFROMREFLECTIONMAP\");\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USEIRRADIANCEMAP\");\r\n }\r\n if (defines.LIGHTMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"LIGHTMAP\");\r\n }\r\n if (defines.NORMAL) {\r\n fallbacks.addFallback(fallbackRank++, \"NORMAL\");\r\n }\r\n if (defines.AMBIENT) {\r\n fallbacks.addFallback(fallbackRank++, \"AMBIENT\");\r\n }\r\n if (defines.EMISSIVE) {\r\n fallbacks.addFallback(fallbackRank++, \"EMISSIVE\");\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n fallbacks.addFallback(fallbackRank++, \"VERTEXCOLOR\");\r\n }\r\n if (defines.MORPHTARGETS) {\r\n fallbacks.addFallback(fallbackRank++, \"MORPHTARGETS\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].NormalKind);\r\n }\r\n if (defines.TANGENT) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].TangentKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].ColorKind);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareAttributesForInstances(attribs, defines);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"pbr\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vAlbedoColor\", \"vReflectivityColor\", \"vEmissiveColor\", \"visibility\", \"vReflectionColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vAlbedoInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vReflectionPosition\", \"vReflectionSize\", \"vEmissiveInfos\", \"vReflectivityInfos\",\r\n \"vMicroSurfaceSamplerInfos\", \"vBumpInfos\", \"vLightmapInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"albedoMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"reflectivityMatrix\", \"normalMatrix\", \"microSurfaceSamplerMatrix\", \"bumpMatrix\", \"lightmapMatrix\",\r\n \"vLightingIntensity\",\r\n \"logarithmicDepthConstant\",\r\n \"vSphericalX\", \"vSphericalY\", \"vSphericalZ\",\r\n \"vSphericalXX_ZZ\", \"vSphericalYY_ZZ\", \"vSphericalZZ\",\r\n \"vSphericalXY\", \"vSphericalYZ\", \"vSphericalZX\",\r\n \"vSphericalL00\",\r\n \"vSphericalL1_1\", \"vSphericalL10\", \"vSphericalL11\",\r\n \"vSphericalL2_2\", \"vSphericalL2_1\", \"vSphericalL20\", \"vSphericalL21\", \"vSphericalL22\",\r\n \"vReflectionMicrosurfaceInfos\",\r\n \"vTangentSpaceParams\", \"boneTextureWidth\",\r\n \"vDebugMode\"\r\n ];\r\n var samplers = [\"albedoSampler\", \"reflectivitySampler\", \"ambientSampler\", \"emissiveSampler\",\r\n \"bumpSampler\", \"lightmapSampler\", \"opacitySampler\",\r\n \"reflectionSampler\", \"reflectionSamplerLow\", \"reflectionSamplerHigh\", \"irradianceSampler\",\r\n \"microSurfaceSampler\", \"environmentBrdfSampler\", \"boneSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].AddUniforms(uniforms);\r\n _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].AddSamplers(samplers);\r\n _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"].AddUniforms(uniforms);\r\n _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"].AddSamplers(samplers);\r\n _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddUniforms(uniforms);\r\n _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].AddSamplers(samplers);\r\n _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].AddUniforms(uniforms);\r\n _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].AddSamplers(samplers);\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, defines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_14__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, defines);\r\n }\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines);\r\n }\r\n var join = defines.toString();\r\n return engine.createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: onCompiled,\r\n onError: onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS }\r\n }, engine);\r\n };\r\n PBRBaseMaterial.prototype._prepareDefines = function (mesh, defines, useInstances, useClipPlane) {\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Lights\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n defines._needNormals = true;\r\n // Multiview\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMultiview(scene, defines);\r\n // Textures\r\n defines.METALLICWORKFLOW = this.isMetallicWorkflow();\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (scene.getEngine().getCaps().textureLOD) {\r\n defines.LODBASEDMICROSFURACE = true;\r\n }\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._albedoTexture, defines, \"ALBEDO\");\r\n }\r\n else {\r\n defines.ALBEDO = false;\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n defines.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale;\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n defines.REFLECTION = true;\r\n defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;\r\n defines.RGBDREFLECTION = reflectionTexture.isRGBD;\r\n defines.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;\r\n defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;\r\n defines.LINEARSPECULARREFLECTION = reflectionTexture.linearSpecularLOD;\r\n if (reflectionTexture.coordinatesMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].INVCUBIC_MODE) {\r\n defines.INVERTCUBICMAP = true;\r\n }\r\n defines.REFLECTIONMAP_3D = reflectionTexture.isCube;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n switch (reflectionTexture.coordinatesMode) {\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].EXPLICIT_MODE:\r\n defines.REFLECTIONMAP_EXPLICIT = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].PLANAR_MODE:\r\n defines.REFLECTIONMAP_PLANAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].PROJECTION_MODE:\r\n defines.REFLECTIONMAP_PROJECTION = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].SKYBOX_MODE:\r\n defines.REFLECTIONMAP_SKYBOX = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].SPHERICAL_MODE:\r\n defines.REFLECTIONMAP_SPHERICAL = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].FIXED_EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].CUBIC_MODE:\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].INVCUBIC_MODE:\r\n default:\r\n defines.REFLECTIONMAP_CUBIC = true;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = reflectionTexture.boundingBoxSize ? true : false;\r\n break;\r\n }\r\n if (reflectionTexture.coordinatesMode !== _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_19__[\"Texture\"].SKYBOX_MODE) {\r\n if (reflectionTexture.irradianceTexture) {\r\n defines.USEIRRADIANCEMAP = true;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n }\r\n else if (reflectionTexture.sphericalPolynomial) {\r\n defines.USESPHERICALFROMREFLECTIONMAP = true;\r\n defines.USEIRRADIANCEMAP = false;\r\n if (this._forceIrradianceInFragment || scene.getEngine().getCaps().maxVaryingVectors <= 8) {\r\n defines.USESPHERICALINVERTEX = false;\r\n }\r\n else {\r\n defines.USESPHERICALINVERTEX = true;\r\n }\r\n }\r\n }\r\n else {\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = !reflectionTexture.getReflectionTextureMatrix().isIdentity();\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n defines.REFLECTIONMAP_3D = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.INVERTCUBICMAP = false;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n defines.USEIRRADIANCEMAP = false;\r\n defines.USESPHERICALINVERTEX = false;\r\n defines.REFLECTIONMAP_OPPOSITEZ = false;\r\n defines.LODINREFLECTIONALPHA = false;\r\n defines.GAMMAREFLECTION = false;\r\n defines.RGBDREFLECTION = false;\r\n defines.LINEARSPECULARREFLECTION = false;\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n defines.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace;\r\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._metallicTexture, defines, \"REFLECTIVITY\");\r\n defines.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha;\r\n defines.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen;\r\n defines.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue;\r\n defines.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed;\r\n }\r\n else if (this._reflectivityTexture) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._reflectivityTexture, defines, \"REFLECTIVITY\");\r\n defines.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha;\r\n defines.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap;\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n }\r\n if (this._microSurfaceTexture) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._microSurfaceTexture, defines, \"MICROSURFACEMAP\");\r\n }\r\n else {\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n if (this._useParallax && this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n defines.PARALLAX = true;\r\n defines.PARALLAXOCCLUSION = !!this._useParallaxOcclusion;\r\n }\r\n else {\r\n defines.PARALLAX = false;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._environmentBRDFTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n defines.ENVIRONMENTBRDF = true;\r\n // Not actual true RGBD, only the B chanel is encoded as RGBD for sheen.\r\n defines.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD;\r\n }\r\n else {\r\n defines.ENVIRONMENTBRDF = false;\r\n defines.ENVIRONMENTBRDF_RGBD = false;\r\n }\r\n if (this._shouldUseAlphaFromAlbedoTexture()) {\r\n defines.ALPHAFROMALBEDO = true;\r\n }\r\n else {\r\n defines.ALPHAFROMALBEDO = false;\r\n }\r\n }\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_STANDARD) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n else if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = true;\r\n }\r\n else {\r\n defines.USEPHYSICALLIGHTFALLOFF = true;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n defines.RADIANCEOVERALPHA = this._useRadianceOverAlpha;\r\n if (!this.backFaceCulling && this._twoSidedLighting) {\r\n defines.TWOSIDEDLIGHTING = true;\r\n }\r\n else {\r\n defines.TWOSIDEDLIGHTING = false;\r\n }\r\n defines.SPECULARAA = scene.getEngine().getCaps().standardDerivatives && this._enableSpecularAntiAliasing;\r\n }\r\n if (defines._areTexturesDirty || defines._areMiscDirty) {\r\n defines.ALPHATESTVALUE = \"\" + this._alphaCutOff + (this._alphaCutOff % 1 === 0 ? \".\" : \"\");\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_21__[\"Constants\"].ALPHA_PREMULTIPLIED || this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_21__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF);\r\n defines.ALPHABLEND = this.needAlphaBlendingForMesh(mesh);\r\n defines.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel;\r\n defines.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n defines.FORCENORMALFORWARD = this._forceNormalForward;\r\n defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;\r\n defines.HORIZONOCCLUSION = this._useHorizonOcclusion;\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);\r\n defines.UNLIT = this._unlit || ((this.pointsCloud || this.wireframe) && !mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_7__[\"VertexBuffer\"].NormalKind));\r\n defines.DEBUGMODE = this._debugMode;\r\n }\r\n // External config\r\n this.subSurface.prepareDefines(defines, scene);\r\n this.clearCoat.prepareDefines(defines, scene);\r\n this.anisotropy.prepareDefines(defines, mesh, scene);\r\n this.brdf.prepareDefines(defines);\r\n this.sheen.prepareDefines(defines, scene);\r\n // Values that need to be evaluated on every frame\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, useClipPlane);\r\n // Attribs\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE);\r\n };\r\n /**\r\n * Force shader compilation\r\n */\r\n PBRBaseMaterial.prototype.forceCompilation = function (mesh, onCompiled, options) {\r\n var _this = this;\r\n var localOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ clipPlane: false }, options);\r\n var defines = new PBRMaterialDefines();\r\n var effect = this._prepareEffect(mesh, defines, undefined, undefined, undefined, localOptions.clipPlane);\r\n if (effect.isReady()) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n }\r\n else {\r\n effect.onCompileObservable.add(function () {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Initializes the uniform buffer layout for the shader.\r\n */\r\n PBRBaseMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"vAlbedoInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 4);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vReflectivityInfos\", 3);\r\n ubo.addUniform(\"vMicroSurfaceSamplerInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"albedoMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"reflectivityMatrix\", 16);\r\n ubo.addUniform(\"microSurfaceSamplerMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"vReflectionColor\", 3);\r\n ubo.addUniform(\"vAlbedoColor\", 4);\r\n ubo.addUniform(\"vLightingIntensity\", 4);\r\n ubo.addUniform(\"vReflectionMicrosurfaceInfos\", 3);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"vReflectivityColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n _pbrClearCoatConfiguration__WEBPACK_IMPORTED_MODULE_8__[\"PBRClearCoatConfiguration\"].PrepareUniformBuffer(ubo);\r\n _pbrAnisotropicConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"PBRAnisotropicConfiguration\"].PrepareUniformBuffer(ubo);\r\n _pbrSheenConfiguration__WEBPACK_IMPORTED_MODULE_11__[\"PBRSheenConfiguration\"].PrepareUniformBuffer(ubo);\r\n _pbrSubSurfaceConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"PBRSubSurfaceConfiguration\"].PrepareUniformBuffer(ubo);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n PBRBaseMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this.subSurface.unbind(this._activeEffect)) {\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh data.\r\n * @param world - The world matrix.\r\n * @param mesh - The BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh.\r\n */\r\n PBRBaseMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindBonesParameters(mesh, this._activeEffect);\r\n var reflectionTexture = null;\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n var engine = scene.getEngine();\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n reflectionTexture = this._getReflectionTexture();\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n // Texture uniforms\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vAlbedoInfos\", this._albedoTexture.coordinatesIndex, this._albedoTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._albedoTexture, ubo, \"albedo\");\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n ubo.updateFloat4(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n ubo.updateMatrix(\"reflectionMatrix\", reflectionTexture.getReflectionTextureMatrix());\r\n ubo.updateFloat2(\"vReflectionInfos\", reflectionTexture.level, 0);\r\n if (reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n if (!defines.USEIRRADIANCEMAP) {\r\n var polynomials = reflectionTexture.sphericalPolynomial;\r\n if (defines.USESPHERICALFROMREFLECTIONMAP && polynomials) {\r\n if (defines.SPHERICAL_HARMONICS) {\r\n var preScaledHarmonics = polynomials.preScaledHarmonics;\r\n this._activeEffect.setVector3(\"vSphericalL00\", preScaledHarmonics.l00);\r\n this._activeEffect.setVector3(\"vSphericalL1_1\", preScaledHarmonics.l1_1);\r\n this._activeEffect.setVector3(\"vSphericalL10\", preScaledHarmonics.l10);\r\n this._activeEffect.setVector3(\"vSphericalL11\", preScaledHarmonics.l11);\r\n this._activeEffect.setVector3(\"vSphericalL2_2\", preScaledHarmonics.l2_2);\r\n this._activeEffect.setVector3(\"vSphericalL2_1\", preScaledHarmonics.l2_1);\r\n this._activeEffect.setVector3(\"vSphericalL20\", preScaledHarmonics.l20);\r\n this._activeEffect.setVector3(\"vSphericalL21\", preScaledHarmonics.l21);\r\n this._activeEffect.setVector3(\"vSphericalL22\", preScaledHarmonics.l22);\r\n }\r\n else {\r\n this._activeEffect.setFloat3(\"vSphericalX\", polynomials.x.x, polynomials.x.y, polynomials.x.z);\r\n this._activeEffect.setFloat3(\"vSphericalY\", polynomials.y.x, polynomials.y.y, polynomials.y.z);\r\n this._activeEffect.setFloat3(\"vSphericalZ\", polynomials.z.x, polynomials.z.y, polynomials.z.z);\r\n this._activeEffect.setFloat3(\"vSphericalXX_ZZ\", polynomials.xx.x - polynomials.zz.x, polynomials.xx.y - polynomials.zz.y, polynomials.xx.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalYY_ZZ\", polynomials.yy.x - polynomials.zz.x, polynomials.yy.y - polynomials.zz.y, polynomials.yy.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZZ\", polynomials.zz.x, polynomials.zz.y, polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalXY\", polynomials.xy.x, polynomials.xy.y, polynomials.xy.z);\r\n this._activeEffect.setFloat3(\"vSphericalYZ\", polynomials.yz.x, polynomials.yz.y, polynomials.yz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZX\", polynomials.zx.x, polynomials.zx.y, polynomials.zx.z);\r\n }\r\n }\r\n }\r\n ubo.updateFloat3(\"vReflectionMicrosurfaceInfos\", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._metallicTexture, ubo, \"reflectivity\");\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1.0);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._reflectivityTexture, ubo, \"reflectivity\");\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.updateFloat2(\"vMicroSurfaceSamplerInfos\", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._microSurfaceTexture, ubo, \"microSurfaceSampler\");\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n // Colors\r\n if (defines.METALLICWORKFLOW) {\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"TmpColors\"].Color3[0].r = (this._metallic === undefined || this._metallic === null) ? 1 : this._metallic;\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"TmpColors\"].Color3[0].g = (this._roughness === undefined || this._roughness === null) ? 1 : this._roughness;\r\n ubo.updateColor4(\"vReflectivityColor\", _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"TmpColors\"].Color3[0], 0);\r\n }\r\n else {\r\n ubo.updateColor4(\"vReflectivityColor\", this._reflectivityColor, this._microSurface);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled ? this._emissiveColor : _Maths_math_color__WEBPACK_IMPORTED_MODULE_13__[\"Color3\"].BlackReadOnly);\r\n ubo.updateColor3(\"vReflectionColor\", this._reflectionColor);\r\n if (!defines.SS_REFRACTION && this.subSurface.linkRefractionWithTransparency) {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, 1);\r\n }\r\n else {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, this.alpha);\r\n }\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Misc\r\n this._lightingInfos.x = this._directIntensity;\r\n this._lightingInfos.y = this._emissiveIntensity;\r\n this._lightingInfos.z = this._environmentIntensity * scene.environmentIntensity;\r\n this._lightingInfos.w = this._specularIntensity;\r\n ubo.updateVector4(\"vLightingIntensity\", this._lightingInfos);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].DiffuseTextureEnabled) {\r\n ubo.setTexture(\"albedoSampler\", this._albedoTexture);\r\n }\r\n if (this._ambientTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].AmbientTextureEnabled) {\r\n ubo.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].OpacityTextureEnabled) {\r\n ubo.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (reflectionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].ReflectionTextureEnabled) {\r\n if (defines.LODBASEDMICROSFURACE) {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture._lodTextureMid || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerLow\", reflectionTexture._lodTextureLow || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerHigh\", reflectionTexture._lodTextureHigh || reflectionTexture);\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n ubo.setTexture(\"irradianceSampler\", reflectionTexture.irradianceTexture);\r\n }\r\n }\r\n if (defines.ENVIRONMENTBRDF) {\r\n ubo.setTexture(\"environmentBrdfSampler\", this._environmentBRDFTexture);\r\n }\r\n if (this._emissiveTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].EmissiveTextureEnabled) {\r\n ubo.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].LightmapTextureEnabled) {\r\n ubo.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._reflectivityTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.setTexture(\"microSurfaceSampler\", this._microSurfaceTexture);\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_20__[\"MaterialFlags\"].BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n }\r\n this.subSurface.bindForSubMesh(ubo, scene, engine, this.isFrozen, defines.LODBASEDMICROSFURACE);\r\n this.clearCoat.bindForSubMesh(ubo, scene, engine, this._disableBumpMap, this.isFrozen, this._invertNormalMapX, this._invertNormalMapY);\r\n this.anisotropy.bindForSubMesh(ubo, scene, this.isFrozen);\r\n this.sheen.bindForSubMesh(ubo, scene, this.isFrozen);\r\n // Clip plane\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindClipPlane(this._activeEffect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor);\r\n var eyePosition = scene._forcedViewPosition ? scene._forcedViewPosition : (scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.globalPosition);\r\n var invertNormal = (scene.useRightHandedSystem === (scene._mirroredCameraPosition != null));\r\n effect.setFloat4(\"vEyePosition\", eyePosition.x, eyePosition.y, eyePosition.z, invertNormal ? -1 : 1);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n effect.setFloat2(\"vDebugMode\", this.debugLimit, this.debugFactor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights, this._lightFalloff !== PBRBaseMaterial.LIGHTFALLOFF_STANDARD, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_5__[\"Scene\"].FOGMODE_NONE || reflectionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindFogParameters(scene, mesh, this._activeEffect, true);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._activeEffect);\r\n }\r\n // image processing\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n // Log. depth\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_18__[\"MaterialHelper\"].BindLogDepth(defines, this._activeEffect, scene);\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @returns - Array of animatable textures.\r\n */\r\n PBRBaseMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0) {\r\n results.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0) {\r\n results.push(this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0) {\r\n results.push(this._reflectivityTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n this.subSurface.getAnimatables(results);\r\n this.clearCoat.getAnimatables(results);\r\n this.sheen.getAnimatables(results);\r\n this.anisotropy.getAnimatables(results);\r\n return results;\r\n };\r\n /**\r\n * Returns the texture used for reflections.\r\n * @returns - Reflection texture if present. Otherwise, returns the environment texture.\r\n */\r\n PBRBaseMaterial.prototype._getReflectionTexture = function () {\r\n if (this._reflectionTexture) {\r\n return this._reflectionTexture;\r\n }\r\n return this.getScene().environmentTexture;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @returns - Array of BaseTextures\r\n */\r\n PBRBaseMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._albedoTexture) {\r\n activeTextures.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._reflectivityTexture) {\r\n activeTextures.push(this._reflectivityTexture);\r\n }\r\n if (this._metallicTexture) {\r\n activeTextures.push(this._metallicTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n activeTextures.push(this._microSurfaceTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n this.subSurface.getActiveTextures(activeTextures);\r\n this.clearCoat.getActiveTextures(activeTextures);\r\n this.sheen.getActiveTextures(activeTextures);\r\n this.anisotropy.getActiveTextures(activeTextures);\r\n return activeTextures;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRBaseMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._albedoTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectivityTexture === texture) {\r\n return true;\r\n }\r\n if (this._metallicTexture === texture) {\r\n return true;\r\n }\r\n if (this._microSurfaceTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n return this.subSurface.hasTexture(texture) ||\r\n this.clearCoat.hasTexture(texture) ||\r\n this.sheen.hasTexture(texture) ||\r\n this.anisotropy.hasTexture(texture);\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeEffect - Forces the disposal of effects.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRBaseMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._albedoTexture) {\r\n this._albedoTexture.dispose();\r\n }\r\n if (this._ambientTexture) {\r\n this._ambientTexture.dispose();\r\n }\r\n if (this._opacityTexture) {\r\n this._opacityTexture.dispose();\r\n }\r\n if (this._reflectionTexture) {\r\n this._reflectionTexture.dispose();\r\n }\r\n if (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture) {\r\n this._environmentBRDFTexture.dispose();\r\n }\r\n if (this._emissiveTexture) {\r\n this._emissiveTexture.dispose();\r\n }\r\n if (this._metallicTexture) {\r\n this._metallicTexture.dispose();\r\n }\r\n if (this._reflectivityTexture) {\r\n this._reflectivityTexture.dispose();\r\n }\r\n if (this._bumpTexture) {\r\n this._bumpTexture.dispose();\r\n }\r\n if (this._lightmapTexture) {\r\n this._lightmapTexture.dispose();\r\n }\r\n }\r\n this.subSurface.dispose(forceDisposeTextures);\r\n this.clearCoat.dispose(forceDisposeTextures);\r\n this.sheen.dispose(forceDisposeTextures);\r\n this.anisotropy.dispose(forceDisposeTextures);\r\n this._renderTargets.dispose();\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_OPAQUE = 0;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATEST = 1;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHABLEND = 2;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND = 3;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0;\r\n /**\r\n * PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL = 0;\r\n /**\r\n * PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_GLTF = 1;\r\n /**\r\n * PBRMaterialLightFalloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_STANDARD = 2;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsImageProcessingConfiguration\"])()\r\n ], PBRBaseMaterial.prototype, \"_imageProcessingConfiguration\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBaseMaterial.prototype, \"debugMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRBaseMaterial.prototype, \"useLogarithmicDepth\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRBaseMaterial.prototype, \"transparencyMode\", null);\r\n return PBRBaseMaterial;\r\n}(_Materials_pushMaterial__WEBPACK_IMPORTED_MODULE_17__[\"PushMaterial\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\":\n/*!************************************************!*\\\n !*** ./Materials/PBR/pbrBaseSimpleMaterial.ts ***!\n \\************************************************/\n/*! exports provided: PBRBaseSimpleMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return PBRBaseSimpleMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pbrBaseMaterial */ \"./Materials/PBR/pbrBaseMaterial.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The Physically based simple base material of BJS.\r\n *\r\n * This enables better naming and convention enforcements on top of the pbrMaterial.\r\n * It is used as the base class for both the specGloss and metalRough conventions.\r\n */\r\nvar PBRBaseSimpleMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRBaseSimpleMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRBaseSimpleMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this.disableLighting = false;\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n _this.invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n _this.invertNormalMapY = false;\r\n /**\r\n * Emissivie color used to self-illuminate the model.\r\n */\r\n _this.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"](0, 0, 0);\r\n /**\r\n * Occlusion Channel Strenght.\r\n */\r\n _this.occlusionStrength = 1.0;\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n _this.useLightmapAsShadowmap = false;\r\n _this._useAlphaFromAlbedoTexture = true;\r\n _this._useAmbientInGrayScale = true;\r\n return _this;\r\n }\r\n Object.defineProperty(PBRBaseSimpleMaterial.prototype, \"doubleSided\", {\r\n /**\r\n * Gets the current double sided mode.\r\n */\r\n get: function () {\r\n return this._twoSidedLighting;\r\n },\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n set: function (value) {\r\n if (this._twoSidedLighting === value) {\r\n return;\r\n }\r\n this._twoSidedLighting = value;\r\n this.backFaceCulling = !value;\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n PBRBaseSimpleMaterial.prototype.getClassName = function () {\r\n return \"PBRBaseSimpleMaterial\";\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectionTexture\")\r\n ], PBRBaseSimpleMaterial.prototype, \"environmentTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_bumpTexture\")\r\n ], PBRBaseSimpleMaterial.prototype, \"normalTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"emissive\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"emissiveColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTextureStrength\")\r\n ], PBRBaseSimpleMaterial.prototype, \"occlusionStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTexture\")\r\n ], PBRBaseSimpleMaterial.prototype, \"occlusionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_alphaCutOff\")\r\n ], PBRBaseSimpleMaterial.prototype, \"alphaCutOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRBaseSimpleMaterial.prototype, \"doubleSided\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n ], PBRBaseSimpleMaterial.prototype, \"lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRBaseSimpleMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n return PBRBaseSimpleMaterial;\r\n}(_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_3__[\"PBRBaseMaterial\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrClearCoatConfiguration.ts\":\n/*!****************************************************!*\\\n !*** ./Materials/PBR/pbrClearCoatConfiguration.ts ***!\n \\****************************************************/\n/*! exports provided: PBRClearCoatConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRClearCoatConfiguration\", function() { return PBRClearCoatConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the clear coat parameters of the pbr material.\r\n */\r\nvar PBRClearCoatConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRClearCoatConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the clear coat is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the clear coat layer roughness.\r\n */\r\n this.roughness = 0;\r\n this._indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n /**\r\n * Defines the index of refraction of the clear coat.\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * Changing the default value is more performance intensive.\r\n */\r\n this.indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n this._texture = null;\r\n /**\r\n * Stores the clear coat values in a texture.\r\n */\r\n this.texture = null;\r\n this._bumpTexture = null;\r\n /**\r\n * Define the clear coat specific bump texture.\r\n */\r\n this.bumpTexture = null;\r\n this._isTintEnabled = false;\r\n /**\r\n * Defines if the clear coat tint is enabled in the material.\r\n */\r\n this.isTintEnabled = false;\r\n /**\r\n * Defines the clear coat tint of the material.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the\r\n * clear coat media.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines the clear coat layer thickness.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintThickness = 1;\r\n this._tintTexture = null;\r\n /**\r\n * Stores the clear tint values in a texture.\r\n * rgb is tint\r\n * a is a thickness factor\r\n */\r\n this.tintTexture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRClearCoatConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRClearCoatConfiguration.prototype.isReadyForSubMesh = function (defines, scene, engine, disableBumpMap) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._isTintEnabled && this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n if (!this._tintTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRClearCoatConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (this._isEnabled) {\r\n defines.CLEARCOAT = true;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._texture, defines, \"CLEARCOAT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TEXTURE = false;\r\n }\r\n if (this._bumpTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatBumpTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._bumpTexture, defines, \"CLEARCOAT_BUMP\");\r\n }\r\n else {\r\n defines.CLEARCOAT_BUMP = false;\r\n }\r\n defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n if (this._isTintEnabled) {\r\n defines.CLEARCOAT_TINT = true;\r\n if (this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._tintTexture, defines, \"CLEARCOAT_TINT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT = false;\r\n defines.CLEARCOAT_TEXTURE = false;\r\n defines.CLEARCOAT_BUMP = false;\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param invertNormalMapX If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n * @param invertNormalMapY If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n */\r\n PBRClearCoatConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, disableBumpMap, isFrozen, invertNormalMapX, invertNormalMapY) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.updateFloat2(\"vClearCoatBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._bumpTexture, uniformBuffer, \"clearCoatBump\");\r\n if (scene._mirroredCameraPosition) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? 1.0 : -1.0, invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? -1.0 : 1.0, invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTintInfos\", this._tintTexture.coordinatesIndex, this._tintTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._tintTexture, uniformBuffer, \"clearCoatTint\");\r\n }\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat2(\"vClearCoatParams\", this.intensity, this.roughness);\r\n // Clear Coat Refraction params\r\n var a = 1 - this._indexOfRefraction;\r\n var b = 1 + this._indexOfRefraction;\r\n var f0 = Math.pow((-a / b), 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\r\n var eta = 1 / this._indexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\r\n if (this._isTintEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatTintParams\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintThickness));\r\n uniformBuffer.updateFloat(\"clearCoatColorAtDistance\", Math.max(0.00001, this.tintColorAtDistance));\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatSampler\", this._texture);\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.setTexture(\"clearCoatBumpSampler\", this._bumpTexture);\r\n }\r\n if (this._isTintEnabled && this._tintTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ClearCoatTintTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatTintSampler\", this._tintTexture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRClearCoatConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._tintTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRClearCoatConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture) {\r\n activeTextures.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n animatables.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0) {\r\n animatables.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n if (this._bumpTexture) {\r\n this._bumpTexture.dispose();\r\n }\r\n if (this._tintTexture) {\r\n this._tintTexture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRClearCoatConfiguration.prototype.getClassName = function () {\r\n return \"PBRClearCoatConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRClearCoatConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.CLEARCOAT_BUMP) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_BUMP\");\r\n }\r\n if (defines.CLEARCOAT_TINT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_TINT\");\r\n }\r\n if (defines.CLEARCOAT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRClearCoatConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vClearCoatTangentSpaceParams\", \"vClearCoatParams\", \"vClearCoatRefractionParams\", \"vClearCoatTintParams\", \"clearCoatColorAtDistance\", \"clearCoatMatrix\", \"clearCoatBumpMatrix\", \"clearCoatTintMatrix\", \"vClearCoatInfos\", \"vClearCoatBumpInfos\", \"vClearCoatTintInfos\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRClearCoatConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"clearCoatSampler\", \"clearCoatBumpSampler\", \"clearCoatTintSampler\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRClearCoatConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vClearCoatParams\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatRefractionParams\", 4);\r\n uniformBuffer.addUniform(\"vClearCoatInfos\", 2);\r\n uniformBuffer.addUniform(\"clearCoatMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatBumpInfos\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatTangentSpaceParams\", 2);\r\n uniformBuffer.addUniform(\"clearCoatBumpMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatTintParams\", 4);\r\n uniformBuffer.addUniform(\"clearCoatColorAtDistance\", 1);\r\n uniformBuffer.addUniform(\"vClearCoatTintInfos\", 2);\r\n uniformBuffer.addUniform(\"clearCoatTintMatrix\", 16);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param clearCoatConfiguration define the config where to copy the info\r\n */\r\n PBRClearCoatConfiguration.prototype.copyTo = function (clearCoatConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return clearCoatConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this clear coat configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRClearCoatConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRClearCoatConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n */\r\n PBRClearCoatConfiguration._DefaultIndexOfRefraction = 1.5;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"texture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isTintEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRClearCoatConfiguration.prototype, \"tintThickness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"tintTexture\", void 0);\r\n return PBRClearCoatConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrMaterial.ts\":\n/*!**************************************!*\\\n !*** ./Materials/PBR/pbrMaterial.ts ***!\n \\**************************************/\n/*! exports provided: PBRMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return PBRMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/brdfTextureTools */ \"./Misc/brdfTextureTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pbrBaseMaterial */ \"./Materials/PBR/pbrBaseMaterial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this.directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this.emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this.environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this.specularIntensity = 1.0;\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this.disableBumpMap = false;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this.ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this.ambientTextureImpactOnAnalyticalLights = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this.ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this.albedoColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this.reflectivityColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1, 1, 1);\r\n /**\r\n * The color reflected from the material.\r\n */\r\n _this.reflectionColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](1.0, 1.0, 1.0);\r\n /**\r\n * The color emitted from the material.\r\n */\r\n _this.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this.microSurface = 1.0;\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n _this.useLightmapAsShadowmap = false;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this.useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this.forceAlphaTest = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this.useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this.useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this.useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this.useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this.useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this.useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this.useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this.useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this.useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this.useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this.disableLighting = false;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this.forceIrradianceInFragment = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n _this.invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n _this.invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this.twoSidedLighting = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this.useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this.useLinearAlphaFresnel = false;\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n _this.environmentBRDFTexture = null;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this.forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this.enableSpecularAntiAliasing = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this.useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this.useRadianceOcclusion = true;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this.unlit = false;\r\n _this._environmentBRDFTexture = _Misc_brdfTextureTools__WEBPACK_IMPORTED_MODULE_2__[\"BRDFTextureTools\"].GetEnvironmentBRDFTexture(scene);\r\n return _this;\r\n }\r\n Object.defineProperty(PBRMaterial.prototype, \"refractionTexture\", {\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n get: function () {\r\n return this.subSurface.refractionTexture;\r\n },\r\n set: function (value) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"indexOfRefraction\", {\r\n /**\r\n * source material index of refraction (IOR)' / 'destination material IOR.\r\n */\r\n get: function () {\r\n return 1 / this.subSurface.indexOfRefraction;\r\n },\r\n set: function (value) {\r\n this.subSurface.indexOfRefraction = 1 / value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"invertRefractionY\", {\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n get: function () {\r\n return this.subSurface.invertRefractionY;\r\n },\r\n set: function (value) {\r\n this.subSurface.invertRefractionY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"linkRefractionWithTransparency\", {\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n get: function () {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n },\r\n set: function (value) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"usePhysicalLightFalloff\", {\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n get: function () {\r\n return this._lightFalloff === _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_PHYSICAL;\r\n },\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n set: function (value) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_PHYSICAL;\r\n }\r\n else {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"useGLTFLightFalloff\", {\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n get: function () {\r\n return this._lightFalloff === _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_GLTF;\r\n },\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n set: function (value) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_GLTF;\r\n }\r\n else {\r\n this._lightFalloff = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the name of this material class.\r\n */\r\n PBRMaterial.prototype.getClassName = function () {\r\n return \"PBRMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n return clone;\r\n };\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n PBRMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n PBRMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new PBRMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRMaterial.PBRMATERIAL_OPAQUE = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_OPAQUE;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATEST = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_ALPHATEST;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHABLEND = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_ALPHABLEND;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].PBRMATERIAL_ALPHATESTANDBLEND;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = _pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"].DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"directIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"specularIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"disableBumpMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureImpactOnAnalyticalLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"opacityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallic\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurfaceTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n ], PBRMaterial.prototype, \"lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"ambient\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"albedo\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"reflectivity\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"reflection\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"emissive\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurface\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFromAlbedoTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"forceAlphaTest\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"alphaCutOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMicroSurfaceFromReflectivityMapAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureGreen\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMetallnessFromMetallicTextureBlue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientOcclusionFromMetallicTextureRed\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientInGrayScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAutoMicroSurfaceFromReflectivityMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRMaterial.prototype, \"usePhysicalLightFalloff\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRMaterial.prototype, \"useGLTFLightFalloff\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallax\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceIrradianceInFragment\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"twoSidedLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLinearAlphaFresnel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentBRDFTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceNormalForward\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"enableSpecularAntiAliasing\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useHorizonOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRMaterial.prototype, \"unlit\", void 0);\r\n return PBRMaterial;\r\n}(_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_4__[\"PBRBaseMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PBRMaterial\"] = PBRMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrMetallicRoughnessMaterial.ts\":\n/*!*******************************************************!*\\\n !*** ./Materials/PBR/pbrMetallicRoughnessMaterial.ts ***!\n \\*******************************************************/\n/*! exports provided: PBRMetallicRoughnessMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return PBRMetallicRoughnessMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pbrBaseSimpleMaterial */ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The PBR material of BJS following the metal roughness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0\r\n */\r\nvar PBRMetallicRoughnessMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRMetallicRoughnessMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMetalRoughnessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRMetallicRoughnessMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._useRoughnessFromMetallicTextureAlpha = false;\r\n _this._useRoughnessFromMetallicTextureGreen = true;\r\n _this._useMetallnessFromMetallicTextureBlue = true;\r\n _this.metallic = 1.0;\r\n _this.roughness = 1.0;\r\n return _this;\r\n }\r\n /**\r\n * Return the currrent class name of the material.\r\n */\r\n PBRMetallicRoughnessMaterial.prototype.getClassName = function () {\r\n return \"PBRMetallicRoughnessMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRMetallicRoughnessMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new PBRMetallicRoughnessMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n return clone;\r\n };\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n */\r\n PBRMetallicRoughnessMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMetallicRoughnessMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a JSON object correponding to the serialize function.\r\n */\r\n PBRMetallicRoughnessMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new PBRMetallicRoughnessMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"baseColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"baseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"metallic\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_metallicTexture\")\r\n ], PBRMetallicRoughnessMaterial.prototype, \"metallicRoughnessTexture\", void 0);\r\n return PBRMetallicRoughnessMaterial;\r\n}(_pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__[\"PBRBaseSimpleMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PBRMetallicRoughnessMaterial\"] = PBRMetallicRoughnessMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrSheenConfiguration.ts\":\n/*!************************************************!*\\\n !*** ./Materials/PBR/pbrSheenConfiguration.ts ***!\n \\************************************************/\n/*! exports provided: PBRSheenConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRSheenConfiguration\", function() { return PBRSheenConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the Sheen parameters of the pbr material.\r\n */\r\nvar PBRSheenConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRSheenConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the material uses sheen.\r\n */\r\n this.isEnabled = false;\r\n this._linkSheenWithAlbedo = false;\r\n /**\r\n * Defines if the sheen is linked to the sheen color.\r\n */\r\n this.linkSheenWithAlbedo = false;\r\n /**\r\n * Defines the sheen intensity.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the sheen color.\r\n */\r\n this.color = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n this._texture = null;\r\n /**\r\n * Stores the sheen tint values in a texture.\r\n * rgb is tint\r\n * a is a intensity\r\n */\r\n this.texture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRSheenConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSheenConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRSheenConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (this._isEnabled) {\r\n defines.SHEEN = this._isEnabled;\r\n defines.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._texture, defines, \"SHEEN_TEXTURE\");\r\n }\r\n else {\r\n defines.SHEEN_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.SHEEN = false;\r\n defines.SHEEN_TEXTURE = false;\r\n defines.SHEEN_LINKWITHALBEDO = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n */\r\n PBRSheenConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vSheenInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\r\n }\r\n // Sheen\r\n uniformBuffer.updateFloat4(\"vSheenColor\", this.color.r, this.color.g, this.color.b, this.intensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && _Materials_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].SheenTextureEnabled) {\r\n uniformBuffer.setTexture(\"sheenSampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSheenConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSheenConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSheenConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSheenConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSheenConfiguration\"\r\n */\r\n PBRSheenConfiguration.prototype.getClassName = function () {\r\n return \"PBRSheenConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSheenConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SHEEN) {\r\n fallbacks.addFallback(currentRank++, \"SHEEN\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSheenConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vSheenColor\", \"vSheenInfos\", \"sheenMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSheenConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vSheenColor\", 4);\r\n uniformBuffer.addUniform(\"vSheenInfos\", 2);\r\n uniformBuffer.addUniform(\"sheenMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSheenConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"sheenSampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param sheenConfiguration define the config where to copy the info\r\n */\r\n PBRSheenConfiguration.prototype.copyTo = function (sheenConfiguration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return sheenConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSheenConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSheenConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"linkSheenWithAlbedo\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSheenConfiguration.prototype, \"intensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRSheenConfiguration.prototype, \"color\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"texture\", void 0);\r\n return PBRSheenConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrSpecularGlossinessMaterial.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/PBR/pbrSpecularGlossinessMaterial.ts ***!\n \\********************************************************/\n/*! exports provided: PBRSpecularGlossinessMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return PBRSpecularGlossinessMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pbrBaseSimpleMaterial */ \"./Materials/PBR/pbrBaseSimpleMaterial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The PBR material of BJS following the specular glossiness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness\r\n */\r\nvar PBRSpecularGlossinessMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PBRSpecularGlossinessMaterial, _super);\r\n /**\r\n * Instantiates a new PBRSpecularGlossinessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRSpecularGlossinessMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._useMicroSurfaceFromReflectivityMapAlpha = true;\r\n return _this;\r\n }\r\n /**\r\n * Return the currrent class name of the material.\r\n */\r\n PBRSpecularGlossinessMaterial.prototype.getClassName = function () {\r\n return \"PBRSpecularGlossinessMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRSpecularGlossinessMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new PBRSpecularGlossinessMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n return clone;\r\n };\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n */\r\n PBRSpecularGlossinessMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRSpecularGlossinessMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a JSON object correponding to the serialize function.\r\n */\r\n PBRSpecularGlossinessMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new PBRSpecularGlossinessMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"diffuse\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"diffuseColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"specular\"),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityColor\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"specularColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_microSurface\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"glossiness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityTexture\")\r\n ], PBRSpecularGlossinessMaterial.prototype, \"specularGlossinessTexture\", void 0);\r\n return PBRSpecularGlossinessMaterial;\r\n}(_pbrBaseSimpleMaterial__WEBPACK_IMPORTED_MODULE_2__[\"PBRBaseSimpleMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.PBRSpecularGlossinessMaterial\"] = PBRSpecularGlossinessMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/PBR/pbrSubSurfaceConfiguration.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/PBR/pbrSubSurfaceConfiguration.ts ***!\n \\*****************************************************/\n/*! exports provided: PBRSubSurfaceConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PBRSubSurfaceConfiguration\", function() { return PBRSubSurfaceConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Define the code related to the sub surface parameters of the pbr material.\r\n */\r\nvar PBRSubSurfaceConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of sub surface configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRSubSurfaceConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isRefractionEnabled = false;\r\n /**\r\n * Defines if the refraction is enabled in the material.\r\n */\r\n this.isRefractionEnabled = false;\r\n this._isTranslucencyEnabled = false;\r\n /**\r\n * Defines if the translucency is enabled in the material.\r\n */\r\n this.isTranslucencyEnabled = false;\r\n this._isScatteringEnabled = false;\r\n // /**\r\n // * Defines if the sub surface scattering is enabled in the material.\r\n // */\r\n // @serialize()\r\n // @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n // public isScatteringEnabled = false;\r\n /**\r\n * Defines the refraction intensity of the material.\r\n * The refraction when enabled replaces the Diffuse part of the material.\r\n * The intensity helps transitionning between diffuse and refraction.\r\n */\r\n this.refractionIntensity = 1;\r\n /**\r\n * Defines the translucency intensity of the material.\r\n * When translucency has been enabled, this defines how much of the \"translucency\"\r\n * is addded to the diffuse part of the material.\r\n */\r\n this.translucencyIntensity = 1;\r\n /**\r\n * Defines the scattering intensity of the material.\r\n * When scattering has been enabled, this defines how much of the \"scattered light\"\r\n * is addded to the diffuse part of the material.\r\n */\r\n this.scatteringIntensity = 1;\r\n this._thicknessTexture = null;\r\n /**\r\n * Stores the average thickness of a mesh in a texture (The texture is holding the values linearly).\r\n * The red channel of the texture should contain the thickness remapped between 0 and 1.\r\n * 0 would mean minimumThickness\r\n * 1 would mean maximumThickness\r\n * The other channels might be use as a mask to vary the different effects intensity.\r\n */\r\n this.thicknessTexture = null;\r\n this._refractionTexture = null;\r\n /**\r\n * Defines the texture to use for refraction.\r\n */\r\n this.refractionTexture = null;\r\n this._indexOfRefraction = 1;\r\n /**\r\n * Defines the index of refraction used in the material.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n */\r\n this.indexOfRefraction = 1;\r\n this._invertRefractionY = false;\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n this.invertRefractionY = false;\r\n this._linkRefractionWithTransparency = false;\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n this.linkRefractionWithTransparency = false;\r\n /**\r\n * Defines the minimum thickness stored in the thickness map.\r\n * If no thickness map is defined, this value will be used to simulate thickness.\r\n */\r\n this.minimumThickness = 0;\r\n /**\r\n * Defines the maximum thickness stored in the thickness map.\r\n */\r\n this.maximumThickness = 1;\r\n /**\r\n * Defines the volume tint of the material.\r\n * This is used for both translucency and scattering.\r\n */\r\n this.tintColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the media.\r\n * This is used for refraction only.\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines how far each channel transmit through the media.\r\n * It is defined as a color to simplify it selection.\r\n */\r\n this.diffusionDistance = _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color3\"].White();\r\n this._useMaskFromThicknessTexture = false;\r\n /**\r\n * Stores the intensity of the different subsurface effects in the thickness texture.\r\n * * the green channel is the translucency intensity.\r\n * * the blue channel is the scattering intensity.\r\n * * the alpha channel is the refraction intensity.\r\n */\r\n this.useMaskFromThicknessTexture = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRSubSurfaceConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n if (!refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n defines.SUBSURFACE = false;\r\n defines.SS_TRANSLUCENCY = this._isTranslucencyEnabled;\r\n defines.SS_SCATERRING = this._isScatteringEnabled;\r\n defines.SS_THICKNESSANDMASK_TEXTURE = false;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n defines.SS_REFRACTION = false;\r\n defines.SS_REFRACTIONMAP_3D = false;\r\n defines.SS_GAMMAREFRACTION = false;\r\n defines.SS_RGBDREFRACTION = false;\r\n defines.SS_LINEARSPECULARREFRACTION = false;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n defines.SS_LODINREFRACTIONALPHA = false;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n if (this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled) {\r\n defines.SUBSURFACE = true;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"SS_THICKNESSANDMASK_TEXTURE\");\r\n }\r\n }\r\n }\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = this._useMaskFromThicknessTexture;\r\n }\r\n if (this._isRefractionEnabled) {\r\n if (scene.texturesEnabled) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n defines.SS_REFRACTION = true;\r\n defines.SS_REFRACTIONMAP_3D = refractionTexture.isCube;\r\n defines.SS_GAMMAREFRACTION = refractionTexture.gammaSpace;\r\n defines.SS_RGBDREFRACTION = refractionTexture.isRGBD;\r\n defines.SS_LINEARSPECULARREFRACTION = refractionTexture.linearSpecularLOD;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = refractionTexture.invertZ;\r\n defines.SS_LODINREFRACTIONALPHA = refractionTexture.lodLevelInAlpha;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param lodBasedMicrosurface defines wether the material relies on lod based microsurface or not.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, isFrozen, lodBasedMicrosurface) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vThicknessInfos\", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_4__[\"MaterialHelper\"].BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"thickness\");\r\n }\r\n uniformBuffer.updateFloat2(\"vThicknessParam\", this.minimumThickness, this.maximumThickness - this.minimumThickness);\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n uniformBuffer.updateMatrix(\"refractionMatrix\", refractionTexture.getReflectionTextureMatrix());\r\n var depth = 1.0;\r\n if (!refractionTexture.isCube) {\r\n if (refractionTexture.depth) {\r\n depth = refractionTexture.depth;\r\n }\r\n }\r\n uniformBuffer.updateFloat4(\"vRefractionInfos\", refractionTexture.level, 1 / this._indexOfRefraction, depth, this._invertRefractionY ? -1 : 1);\r\n uniformBuffer.updateFloat3(\"vRefractionMicrosurfaceInfos\", refractionTexture.getSize().width, refractionTexture.lodGenerationScale, refractionTexture.lodGenerationOffset);\r\n }\r\n uniformBuffer.updateColor3(\"vDiffusionDistance\", this.diffusionDistance);\r\n uniformBuffer.updateFloat4(\"vTintColor\", this.tintColor.r, this.tintColor.g, this.tintColor.b, this.tintColorAtDistance);\r\n uniformBuffer.updateFloat3(\"vSubSurfaceIntensity\", this.refractionIntensity, this.translucencyIntensity, this.scatteringIntensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].ThicknessTextureEnabled) {\r\n uniformBuffer.setTexture(\"thicknessSampler\", this._thicknessTexture);\r\n }\r\n if (refractionTexture && _materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled) {\r\n if (lodBasedMicrosurface) {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture);\r\n }\r\n else {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture._lodTextureMid || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerLow\", refractionTexture._lodTextureLow || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerHigh\", refractionTexture._lodTextureHigh || refractionTexture);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh.\r\n * @param activeEffect defines the effect that should be unbound from.\r\n * @returns true if unbound, otherwise false\r\n */\r\n PBRSubSurfaceConfiguration.prototype.unbind = function (activeEffect) {\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n activeEffect.setTexture(\"refractionSampler\", null);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns the texture used for refraction or null if none is used.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - Refraction texture if present. If no refraction texture and refraction\r\n * is linked with transparency, returns environment texture. Otherwise, returns null.\r\n */\r\n PBRSubSurfaceConfiguration.prototype._getRefractionTexture = function (scene) {\r\n if (this._refractionTexture) {\r\n return this._refractionTexture;\r\n }\r\n if (this._isRefractionEnabled) {\r\n return scene.environmentTexture;\r\n }\r\n return null;\r\n };\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return this.isRefractionEnabled && this._linkRefractionWithTransparency;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Fills the list of render target textures.\r\n * @param renderTargets the list of render targets to update\r\n */\r\n PBRSubSurfaceConfiguration.prototype.fillRenderTargetTextures = function (renderTargets) {\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n renderTargets.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._thicknessTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n * @returns true if this uses a render target otherwise false.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasRenderTargetTextures = function () {\r\n if (_materialFlags__WEBPACK_IMPORTED_MODULE_3__[\"MaterialFlags\"].RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._thicknessTexture) {\r\n activeTextures.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\r\n animatables.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n animatables.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._thicknessTexture) {\r\n this._thicknessTexture.dispose();\r\n }\r\n if (this._refractionTexture) {\r\n this._refractionTexture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSubSurfaceConfiguration\"\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getClassName = function () {\r\n return \"PBRSubSurfaceConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSubSurfaceConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SS_SCATERRING) {\r\n fallbacks.addFallback(currentRank++, \"SS_SCATERRING\");\r\n }\r\n if (defines.SS_TRANSLUCENCY) {\r\n fallbacks.addFallback(currentRank++, \"SS_TRANSLUCENCY\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSubSurfaceConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vDiffusionDistance\", \"vTintColor\", \"vSubSurfaceIntensity\", \"vRefractionMicrosurfaceInfos\", \"vRefractionInfos\", \"vThicknessInfos\", \"vThicknessParam\", \"refractionMatrix\", \"thicknessMatrix\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSubSurfaceConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"thicknessSampler\", \"refractionSampler\", \"refractionSamplerLow\", \"refractionSamplerHigh\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSubSurfaceConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vRefractionMicrosurfaceInfos\", 3);\r\n uniformBuffer.addUniform(\"vRefractionInfos\", 4);\r\n uniformBuffer.addUniform(\"refractionMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessInfos\", 2);\r\n uniformBuffer.addUniform(\"thicknessMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessParam\", 2);\r\n uniformBuffer.addUniform(\"vDiffusionDistance\", 3);\r\n uniformBuffer.addUniform(\"vTintColor\", 4);\r\n uniformBuffer.addUniform(\"vSubSurfaceIntensity\", 3);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param configuration define the config where to copy the info\r\n */\r\n PBRSubSurfaceConfiguration.prototype.copyTo = function (configuration) {\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return configuration; }, this);\r\n };\r\n /**\r\n * Serializes this Sub Surface configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSubSurfaceConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isRefractionEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isTranslucencyEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"translucencyIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"scatteringIntensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"thicknessTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"invertRefractionY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"linkRefractionWithTransparency\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"minimumThickness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"maximumThickness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])()\r\n ], PBRSubSurfaceConfiguration.prototype, \"diffusionDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(),\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"useMaskFromThicknessTexture\", void 0);\r\n return PBRSubSurfaceConfiguration;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/basisTextureLoader.ts\":\n/*!**********************************************************!*\\\n !*** ./Materials/Textures/Loaders/basisTextureLoader.ts ***!\n \\**********************************************************/\n/*! exports provided: _BasisTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _BasisTextureLoader; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_basis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/basis */ \"./Misc/basis.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/tools */ \"./Misc/tools.ts\");\n\r\n\r\n\r\n/**\r\n * Loader for .basis file format\r\n */\r\nvar _BasisTextureLoader = /** @class */ (function () {\r\n function _BasisTextureLoader() {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = true;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _BasisTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".basis\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _BasisTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _BasisTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has already been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _BasisTextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n var caps = texture.getEngine().getCaps();\r\n var transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false\r\n }\r\n };\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].TranscodeAsync(data, transcodeConfig).then(function (result) {\r\n var hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].LoadTextureFromTranscodeResult(texture, result);\r\n texture.getEngine()._setCubeMapTextureParams(hasMipmap);\r\n texture.isReady = true;\r\n }).catch(function (err) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\");\r\n texture.isReady = true;\r\n });\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _BasisTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n var caps = texture.getEngine().getCaps();\r\n var transcodeConfig = {\r\n supportedCompressionFormats: {\r\n etc1: caps.etc1 ? true : false,\r\n s3tc: caps.s3tc ? true : false,\r\n pvrtc: caps.pvrtc ? true : false,\r\n etc2: caps.etc2 ? true : false\r\n }\r\n };\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].TranscodeAsync(data, transcodeConfig).then(function (result) {\r\n var rootImage = result.fileInfo.images[0].levels[0];\r\n var hasMipmap = result.fileInfo.images[0].levels.length > 1 && texture.generateMipMaps;\r\n callback(rootImage.width, rootImage.height, hasMipmap, result.format !== -1, function () {\r\n _Misc_basis__WEBPACK_IMPORTED_MODULE_1__[\"BasisTools\"].LoadTextureFromTranscodeResult(texture, result);\r\n });\r\n }).catch(function (err) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\");\r\n callback(0, 0, false, false, function () {\r\n });\r\n });\r\n };\r\n return _BasisTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"]._TextureLoaders.push(new _BasisTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/ddsTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/ddsTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _DDSTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _DDSTextureLoader; });\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_dds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/dds */ \"./Misc/dds.ts\");\n\r\n\r\n\r\n/**\r\n * Implementation of the DDS Texture Loader.\r\n * @hidden\r\n */\r\nvar _DDSTextureLoader = /** @class */ (function () {\r\n function _DDSTextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = true;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _DDSTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".dds\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _DDSTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _DDSTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _DDSTextureLoader.prototype.loadCubeData = function (imgs, texture, createPolynomials, onLoad, onError) {\r\n var engine = texture.getEngine();\r\n var info;\r\n var loadMipmap = false;\r\n if (Array.isArray(imgs)) {\r\n for (var index = 0; index < imgs.length; index++) {\r\n var data_1 = imgs[index];\r\n info = _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].GetDDSInfo(data_1);\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n engine._unpackFlipY(info.isCompressed);\r\n _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].UploadDDSLevels(engine, texture, data_1, info, loadMipmap, 6, -1, index);\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n engine.generateMipMapsForCubemap(texture);\r\n }\r\n }\r\n }\r\n else {\r\n var data = imgs;\r\n info = _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].GetDDSInfo(data);\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n if (createPolynomials) {\r\n info.sphericalPolynomial = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__[\"SphericalPolynomial\"]();\r\n }\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n engine._unpackFlipY(info.isCompressed);\r\n _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].UploadDDSLevels(engine, texture, data, info, loadMipmap, 6);\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n engine.generateMipMapsForCubemap(texture);\r\n }\r\n }\r\n engine._setCubeMapTextureParams(loadMipmap);\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad({ isDDS: true, width: texture.width, info: info, data: imgs, texture: texture });\r\n }\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _DDSTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n var info = _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].GetDDSInfo(data);\r\n var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps && ((info.width >> (info.mipmapCount - 1)) === 1);\r\n callback(info.width, info.height, loadMipmap, info.isFourCC, function () {\r\n _Misc_dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"].UploadDDSLevels(texture.getEngine(), texture, data, info, loadMipmap, 1);\r\n });\r\n };\r\n return _DDSTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.push(new _DDSTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/envTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/envTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _ENVTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _ENVTextureLoader; });\n/* harmony import */ var _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n/**\r\n * Implementation of the ENV Texture Loader.\r\n * @hidden\r\n */\r\nvar _ENVTextureLoader = /** @class */ (function () {\r\n function _ENVTextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = false;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _ENVTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".env\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _ENVTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _ENVTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _ENVTextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n data = data;\r\n var info = _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"].GetEnvInfo(data);\r\n if (info) {\r\n texture.width = info.width;\r\n texture.height = info.width;\r\n _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"].UploadEnvSpherical(texture, info);\r\n _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_0__[\"EnvironmentTextureTools\"].UploadEnvLevelsAsync(texture, data, info).then(function () {\r\n texture.isReady = true;\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n });\r\n }\r\n else if (onError) {\r\n onError(\"Can not parse the environment file\", null);\r\n }\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _ENVTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n throw \".env not supported in 2d.\";\r\n };\r\n return _ENVTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.push(new _ENVTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/index.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Textures/Loaders/index.ts ***!\n \\*********************************************/\n/*! exports provided: _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ddsTextureLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ddsTextureLoader */ \"./Materials/Textures/Loaders/ddsTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _ddsTextureLoader__WEBPACK_IMPORTED_MODULE_0__[\"_DDSTextureLoader\"]; });\n\n/* harmony import */ var _envTextureLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./envTextureLoader */ \"./Materials/Textures/Loaders/envTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _envTextureLoader__WEBPACK_IMPORTED_MODULE_1__[\"_ENVTextureLoader\"]; });\n\n/* harmony import */ var _ktxTextureLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ktxTextureLoader */ \"./Materials/Textures/Loaders/ktxTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _ktxTextureLoader__WEBPACK_IMPORTED_MODULE_2__[\"_KTXTextureLoader\"]; });\n\n/* harmony import */ var _tgaTextureLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tgaTextureLoader */ \"./Materials/Textures/Loaders/tgaTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _tgaTextureLoader__WEBPACK_IMPORTED_MODULE_3__[\"_TGATextureLoader\"]; });\n\n/* harmony import */ var _basisTextureLoader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./basisTextureLoader */ \"./Materials/Textures/Loaders/basisTextureLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _basisTextureLoader__WEBPACK_IMPORTED_MODULE_4__[\"_BasisTextureLoader\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/ktxTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/ktxTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _KTXTextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _KTXTextureLoader; });\n/* harmony import */ var _Misc_khronosTextureContainer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/khronosTextureContainer */ \"./Misc/khronosTextureContainer.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n/**\r\n * Implementation of the KTX Texture Loader.\r\n * @hidden\r\n */\r\nvar _KTXTextureLoader = /** @class */ (function () {\r\n function _KTXTextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = false;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _KTXTextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n if (textureFormatInUse && !isBase64 && !fallback && !isBuffer) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _KTXTextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n if (lastDot != -1 && rootUrl.substring(lastDot + 1) == \"ktx\") {\r\n // Already transformed\r\n return rootUrl;\r\n }\r\n return (lastDot > -1 ? rootUrl.substring(0, lastDot) : rootUrl) + textureFormatInUse;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _KTXTextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n // remove the format appended to the rootUrl in the original createCubeTexture call.\r\n var exp = new RegExp(\"\" + textureFormatInUse + \"$\");\r\n return rootUrl.replace(exp, \"\");\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _KTXTextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n if (Array.isArray(data)) {\r\n return;\r\n }\r\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\r\n texture._invertVScale = !texture.invertY;\r\n var engine = texture.getEngine();\r\n var ktx = new _Misc_khronosTextureContainer__WEBPACK_IMPORTED_MODULE_0__[\"KhronosTextureContainer\"](data, 6);\r\n var loadMipmap = ktx.numberOfMipmapLevels > 1 && texture.generateMipMaps;\r\n engine._unpackFlipY(true);\r\n ktx.uploadLevels(texture, texture.generateMipMaps);\r\n texture.width = ktx.pixelWidth;\r\n texture.height = ktx.pixelHeight;\r\n engine._setCubeMapTextureParams(loadMipmap);\r\n texture.isReady = true;\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _KTXTextureLoader.prototype.loadData = function (data, texture, callback) {\r\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\r\n texture._invertVScale = !texture.invertY;\r\n var ktx = new _Misc_khronosTextureContainer__WEBPACK_IMPORTED_MODULE_0__[\"KhronosTextureContainer\"](data, 1);\r\n callback(ktx.pixelWidth, ktx.pixelHeight, false, true, function () {\r\n ktx.uploadLevels(texture, texture.generateMipMaps);\r\n }, ktx.isInvalid);\r\n };\r\n return _KTXTextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.unshift(new _KTXTextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Loaders/tgaTextureLoader.ts\":\n/*!********************************************************!*\\\n !*** ./Materials/Textures/Loaders/tgaTextureLoader.ts ***!\n \\********************************************************/\n/*! exports provided: _TGATextureLoader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _TGATextureLoader; });\n/* harmony import */ var _Misc_tga__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/tga */ \"./Misc/tga.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n/**\r\n * Implementation of the TGA Texture Loader.\r\n * @hidden\r\n */\r\nvar _TGATextureLoader = /** @class */ (function () {\r\n function _TGATextureLoader() {\r\n /**\r\n * Defines wether the loader supports cascade loading the different faces.\r\n */\r\n this.supportCascades = false;\r\n }\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @param fallback defines the fallback internal texture if any\r\n * @param isBase64 defines whether the texture is encoded as a base64\r\n * @param isBuffer defines whether the texture data are stored as a buffer\r\n * @returns true if the loader can load the specified file\r\n */\r\n _TGATextureLoader.prototype.canLoad = function (extension, textureFormatInUse, fallback, isBase64, isBuffer) {\r\n return extension.indexOf(\".tga\") === 0;\r\n };\r\n /**\r\n * Transform the url before loading if required.\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the transformed texture\r\n */\r\n _TGATextureLoader.prototype.transformUrl = function (rootUrl, textureFormatInUse) {\r\n return rootUrl;\r\n };\r\n /**\r\n * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work\r\n * @param rootUrl the url of the texture\r\n * @param textureFormatInUse defines the current compressed format in use iun the engine\r\n * @returns the fallback texture\r\n */\r\n _TGATextureLoader.prototype.getFallbackTextureUrl = function (rootUrl, textureFormatInUse) {\r\n return null;\r\n };\r\n /**\r\n * Uploads the cube texture data to the WebGl Texture. It has alreday been bound.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n * @param onError defines the callback to trigger in case of error\r\n */\r\n _TGATextureLoader.prototype.loadCubeData = function (data, texture, createPolynomials, onLoad, onError) {\r\n throw \".env not supported in Cube.\";\r\n };\r\n /**\r\n * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n _TGATextureLoader.prototype.loadData = function (data, texture, callback) {\r\n var uintData = new Uint8Array(data);\r\n var header = _Misc_tga__WEBPACK_IMPORTED_MODULE_0__[\"TGATools\"].GetTGAHeader(uintData);\r\n callback(header.width, header.height, texture.generateMipMaps, false, function () {\r\n _Misc_tga__WEBPACK_IMPORTED_MODULE_0__[\"TGATools\"].UploadContent(texture, uintData);\r\n });\r\n };\r\n return _TGATextureLoader;\r\n}());\r\n\r\n// Register the loader.\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_1__[\"Engine\"]._TextureLoaders.push(new _TGATextureLoader());\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/MultiviewRenderTarget.ts\":\n/*!*****************************************************!*\\\n !*** ./Materials/Textures/MultiviewRenderTarget.ts ***!\n \\*****************************************************/\n/*! exports provided: MultiviewRenderTarget */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiviewRenderTarget\", function() { return MultiviewRenderTarget; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n\r\n\r\n\r\n/**\r\n * Renders to multiple views with a single draw call\r\n * @see https://www.khronos.org/registry/webgl/extensions/WEBGL_multiview/\r\n */\r\nvar MultiviewRenderTarget = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiviewRenderTarget, _super);\r\n /**\r\n * Creates a multiview render target\r\n * @param scene scene used with the render target\r\n * @param size the size of the render target (used for each view)\r\n */\r\n function MultiviewRenderTarget(scene, size) {\r\n if (size === void 0) { size = 512; }\r\n var _this = _super.call(this, \"multiview rtt\", size, scene, false, true, _Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_UNKNOWN, false, undefined, false, false, true, undefined, true) || this;\r\n var internalTexture = scene.getEngine().createMultiviewRenderTargetTexture(_this.getRenderWidth(), _this.getRenderHeight());\r\n internalTexture.isMultiview = true;\r\n _this._texture = internalTexture;\r\n return _this;\r\n }\r\n /**\r\n * @hidden\r\n * @param faceIndex the face index, if its a cube texture\r\n */\r\n MultiviewRenderTarget.prototype._bindFrameBuffer = function (faceIndex) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (!this._texture) {\r\n return;\r\n }\r\n this.getScene().getEngine().bindMultiviewFramebuffer(this._texture);\r\n };\r\n /**\r\n * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)\r\n * @returns the view count\r\n */\r\n MultiviewRenderTarget.prototype.getViewCount = function () {\r\n return 2;\r\n };\r\n return MultiviewRenderTarget;\r\n}(_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/customProceduralTexture.ts\":\n/*!*******************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/customProceduralTexture.ts ***!\n \\*******************************************************************/\n/*! exports provided: CustomProceduralTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return CustomProceduralTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _proceduralTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony import */ var _Misc_webRequest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../Misc/webRequest */ \"./Misc/webRequest.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes called 'refMaps' or 'sampler' images.\r\n * Custom Procedural textures are the easiest way to create your own procedural in your application.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures#creating-custom-procedural-textures\r\n */\r\nvar CustomProceduralTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CustomProceduralTexture, _super);\r\n /**\r\n * Instantiates a new Custom Procedural Texture.\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes called 'refMaps' or 'sampler' images.\r\n * Custom Procedural textures are the easiest way to create your own procedural in your application.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures#creating-custom-procedural-textures\r\n * @param name Define the name of the texture\r\n * @param texturePath Define the folder path containing all the cutom texture related files (config, shaders...)\r\n * @param size Define the size of the texture to create\r\n * @param scene Define the scene the texture belongs to\r\n * @param fallbackTexture Define a fallback texture in case there were issues to create the custom texture\r\n * @param generateMipMaps Define if the texture should creates mip maps or not\r\n */\r\n function CustomProceduralTexture(name, texturePath, size, scene, fallbackTexture, generateMipMaps) {\r\n var _this = _super.call(this, name, size, null, scene, fallbackTexture, generateMipMaps) || this;\r\n _this._animate = true;\r\n _this._time = 0;\r\n _this._texturePath = texturePath;\r\n //Try to load json\r\n _this._loadJson(texturePath);\r\n _this.refreshRate = 1;\r\n return _this;\r\n }\r\n CustomProceduralTexture.prototype._loadJson = function (jsonUrl) {\r\n var _this = this;\r\n var noConfigFile = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Log(\"No config file found in \" + jsonUrl + \" trying to use ShadersStore or DOM element\");\r\n try {\r\n _this.setFragment(_this._texturePath);\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"No json or ShaderStore or DOM element found for CustomProceduralTexture\");\r\n }\r\n };\r\n var configFileUrl = jsonUrl + \"/config.json\";\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_6__[\"WebRequest\"]();\r\n xhr.open(\"GET\", configFileUrl);\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 || (xhr.responseText && xhr.responseText.length > 0)) {\r\n try {\r\n _this._config = JSON.parse(xhr.response);\r\n _this.updateShaderUniforms();\r\n _this.updateTextures();\r\n _this.setFragment(_this._texturePath + \"/custom\");\r\n _this._animate = _this._config.animate;\r\n _this.refreshRate = _this._config.refreshrate;\r\n }\r\n catch (ex) {\r\n noConfigFile();\r\n }\r\n }\r\n else {\r\n noConfigFile();\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n noConfigFile();\r\n }, false);\r\n try {\r\n xhr.send();\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"CustomProceduralTexture: Error on XHR send request.\");\r\n }\r\n };\r\n /**\r\n * Is the texture ready to be used ? (rendered at least once)\r\n * @returns true if ready, otherwise, false.\r\n */\r\n CustomProceduralTexture.prototype.isReady = function () {\r\n if (!_super.prototype.isReady.call(this)) {\r\n return false;\r\n }\r\n for (var name in this._textures) {\r\n var texture = this._textures[name];\r\n if (!texture.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Render the texture to its associated render target.\r\n * @param useCameraPostProcess Define if camera post process should be applied to the texture\r\n */\r\n CustomProceduralTexture.prototype.render = function (useCameraPostProcess) {\r\n var scene = this.getScene();\r\n if (this._animate && scene) {\r\n this._time += scene.getAnimationRatio() * 0.03;\r\n this.updateShaderUniforms();\r\n }\r\n _super.prototype.render.call(this, useCameraPostProcess);\r\n };\r\n /**\r\n * Update the list of dependant textures samplers in the shader.\r\n */\r\n CustomProceduralTexture.prototype.updateTextures = function () {\r\n for (var i = 0; i < this._config.sampler2Ds.length; i++) {\r\n this.setTexture(this._config.sampler2Ds[i].sample2Dname, new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"](this._texturePath + \"/\" + this._config.sampler2Ds[i].textureRelativeUrl, this.getScene()));\r\n }\r\n };\r\n /**\r\n * Update the uniform values of the procedural texture in the shader.\r\n */\r\n CustomProceduralTexture.prototype.updateShaderUniforms = function () {\r\n if (this._config) {\r\n for (var j = 0; j < this._config.uniforms.length; j++) {\r\n var uniform = this._config.uniforms[j];\r\n switch (uniform.type) {\r\n case \"float\":\r\n this.setFloat(uniform.name, uniform.value);\r\n break;\r\n case \"color3\":\r\n this.setColor3(uniform.name, new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"](uniform.r, uniform.g, uniform.b));\r\n break;\r\n case \"color4\":\r\n this.setColor4(uniform.name, new _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"](uniform.r, uniform.g, uniform.b, uniform.a));\r\n break;\r\n case \"vector2\":\r\n this.setVector2(uniform.name, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](uniform.x, uniform.y));\r\n break;\r\n case \"vector3\":\r\n this.setVector3(uniform.name, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](uniform.x, uniform.y, uniform.z));\r\n break;\r\n }\r\n }\r\n }\r\n this.setFloat(\"time\", this._time);\r\n };\r\n Object.defineProperty(CustomProceduralTexture.prototype, \"animate\", {\r\n /**\r\n * Define if the texture animates or not.\r\n */\r\n get: function () {\r\n return this._animate;\r\n },\r\n set: function (value) {\r\n this._animate = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CustomProceduralTexture;\r\n}(_proceduralTexture__WEBPACK_IMPORTED_MODULE_5__[\"ProceduralTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/index.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Textures/Procedurals/index.ts ***!\n \\*************************************************/\n/*! exports provided: CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _customProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./customProceduralTexture */ \"./Materials/Textures/Procedurals/customProceduralTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _customProceduralTexture__WEBPACK_IMPORTED_MODULE_0__[\"CustomProceduralTexture\"]; });\n\n/* harmony import */ var _noiseProceduralTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./noiseProceduralTexture */ \"./Materials/Textures/Procedurals/noiseProceduralTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _noiseProceduralTexture__WEBPACK_IMPORTED_MODULE_1__[\"NoiseProceduralTexture\"]; });\n\n/* harmony import */ var _proceduralTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _proceduralTexture__WEBPACK_IMPORTED_MODULE_2__[\"ProceduralTexture\"]; });\n\n/* harmony import */ var _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proceduralTextureSceneComponent */ \"./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"ProceduralTextureSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/noiseProceduralTexture.ts\":\n/*!******************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/noiseProceduralTexture.ts ***!\n \\******************************************************************/\n/*! exports provided: NoiseProceduralTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return NoiseProceduralTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _proceduralTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Shaders_noise_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Shaders/noise.fragment */ \"./Shaders/noise.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to generate noise procedural textures\r\n */\r\nvar NoiseProceduralTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](NoiseProceduralTexture, _super);\r\n /**\r\n * Creates a new NoiseProceduralTexture\r\n * @param name defines the name fo the texture\r\n * @param size defines the size of the texture (default is 256)\r\n * @param scene defines the hosting scene\r\n * @param fallbackTexture defines the texture to use if the NoiseProceduralTexture can't be created\r\n * @param generateMipMaps defines if mipmaps must be generated (true by default)\r\n */\r\n function NoiseProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {\r\n if (size === void 0) { size = 256; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__[\"EngineStore\"].LastCreatedScene; }\r\n var _this = _super.call(this, name, size, \"noise\", scene, fallbackTexture, generateMipMaps) || this;\r\n _this._time = 0;\r\n /** Gets or sets a value between 0 and 1 indicating the overall brightness of the texture (default is 0.2) */\r\n _this.brightness = 0.2;\r\n /** Defines the number of octaves to process */\r\n _this.octaves = 3;\r\n /** Defines the level of persistence (0.8 by default) */\r\n _this.persistence = 0.8;\r\n /** Gets or sets animation speed factor (default is 1) */\r\n _this.animationSpeedFactor = 1;\r\n _this.autoClear = false;\r\n _this._updateShaderUniforms();\r\n return _this;\r\n }\r\n NoiseProceduralTexture.prototype._updateShaderUniforms = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._time += scene.getAnimationRatio() * this.animationSpeedFactor * 0.01;\r\n this.setFloat(\"brightness\", this.brightness);\r\n this.setFloat(\"persistence\", this.persistence);\r\n this.setFloat(\"timeScale\", this._time);\r\n };\r\n NoiseProceduralTexture.prototype._getDefines = function () {\r\n return \"#define OCTAVES \" + (this.octaves | 0);\r\n };\r\n /** Generate the current state of the procedural texture */\r\n NoiseProceduralTexture.prototype.render = function (useCameraPostProcess) {\r\n this._updateShaderUniforms();\r\n _super.prototype.render.call(this, useCameraPostProcess);\r\n };\r\n /**\r\n * Serializes this noise procedural texture\r\n * @returns a serialized noise procedural texture object\r\n */\r\n NoiseProceduralTexture.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.customType = \"BABYLON.NoiseProceduralTexture\";\r\n serializationObject.brightness = this.brightness;\r\n serializationObject.octaves = this.octaves;\r\n serializationObject.persistence = this.persistence;\r\n serializationObject.animationSpeedFactor = this.animationSpeedFactor;\r\n serializationObject.size = this.getSize().width;\r\n serializationObject.generateMipMaps = this._generateMipMaps;\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a NoiseProceduralTexture from parsed noise procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing noise procedural texture information\r\n * @returns a parsed NoiseProceduralTexture\r\n */\r\n NoiseProceduralTexture.Parse = function (parsedTexture, scene) {\r\n var texture = new NoiseProceduralTexture(parsedTexture.name, parsedTexture.size, scene, undefined, parsedTexture.generateMipMaps);\r\n texture.brightness = parsedTexture.brightness;\r\n texture.octaves = parsedTexture.octaves;\r\n texture.persistence = parsedTexture.persistence;\r\n texture.animationSpeedFactor = parsedTexture.animationSpeedFactor;\r\n return texture;\r\n };\r\n return NoiseProceduralTexture;\r\n}(_proceduralTexture__WEBPACK_IMPORTED_MODULE_2__[\"ProceduralTexture\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.NoiseProceduralTexture\"] = NoiseProceduralTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/proceduralTexture.ts\":\n/*!*************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/proceduralTexture.ts ***!\n \\*************************************************************/\n/*! exports provided: ProceduralTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return ProceduralTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./proceduralTextureSceneComponent */ \"./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts\");\n/* harmony import */ var _Engines_Extensions_engine_renderTarget__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Engines/Extensions/engine.renderTarget */ \"./Engines/Extensions/engine.renderTarget.ts\");\n/* harmony import */ var _Shaders_procedural_vertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Shaders/procedural.vertex */ \"./Shaders/procedural.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes calmpler' images.\r\n * This is the base class of any Procedural texture and contains most of the shareable code.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures\r\n */\r\nvar ProceduralTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ProceduralTexture, _super);\r\n /**\r\n * Instantiates a new procedural texture.\r\n * Procedural texturing is a way to programmatically create a texture. There are 2 types of procedural textures: code-only, and code that references some classic 2D images, sometimes called 'refMaps' or 'sampler' images.\r\n * This is the base class of any Procedural texture and contains most of the shareable code.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_procedural_textures\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the texture to create\r\n * @param fragment Define the fragment shader to use to generate the texture or null if it is defined later\r\n * @param scene Define the scene the texture belongs to\r\n * @param fallbackTexture Define a fallback texture in case there were issues to create the custom texture\r\n * @param generateMipMaps Define if the texture should creates mip maps or not\r\n * @param isCube Define if the texture is a cube texture or not (this will render each faces of the cube)\r\n */\r\n function ProceduralTexture(name, size, fragment, scene, fallbackTexture, generateMipMaps, isCube) {\r\n if (fallbackTexture === void 0) { fallbackTexture = null; }\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (isCube === void 0) { isCube = false; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps) || this;\r\n _this.isCube = isCube;\r\n /**\r\n * Define if the texture is enabled or not (disabled texture will not render)\r\n */\r\n _this.isEnabled = true;\r\n /**\r\n * Define if the texture must be cleared before rendering (default is true)\r\n */\r\n _this.autoClear = true;\r\n /**\r\n * Event raised when the texture is generated\r\n */\r\n _this.onGeneratedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /** @hidden */\r\n _this._textures = {};\r\n _this._currentRefreshId = -1;\r\n _this._refreshRate = 1;\r\n _this._vertexBuffers = {};\r\n _this._uniforms = new Array();\r\n _this._samplers = new Array();\r\n _this._floats = {};\r\n _this._ints = {};\r\n _this._floatsArrays = {};\r\n _this._colors3 = {};\r\n _this._colors4 = {};\r\n _this._vectors2 = {};\r\n _this._vectors3 = {};\r\n _this._matrices = {};\r\n _this._fallbackTextureUsed = false;\r\n _this._cachedDefines = \"\";\r\n _this._contentUpdateId = -1;\r\n scene = _this.getScene();\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_PROCEDURALTEXTURE);\r\n if (!component) {\r\n component = new _proceduralTextureSceneComponent__WEBPACK_IMPORTED_MODULE_8__[\"ProceduralTextureSceneComponent\"](scene);\r\n scene._addComponent(component);\r\n }\r\n scene.proceduralTextures.push(_this);\r\n _this._engine = scene.getEngine();\r\n _this.name = name;\r\n _this.isRenderTarget = true;\r\n _this._size = size;\r\n _this._generateMipMaps = generateMipMaps;\r\n _this.setFragment(fragment);\r\n _this._fallbackTexture = fallbackTexture;\r\n if (isCube) {\r\n _this._texture = _this._engine.createRenderTargetCubeTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });\r\n _this.setFloat(\"face\", 0);\r\n }\r\n else {\r\n _this._texture = _this._engine.createRenderTargetTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });\r\n }\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n _this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"](_this._engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n _this._createIndexBuffer();\r\n return _this;\r\n }\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the the postprocess.\r\n */\r\n ProceduralTexture.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * Gets texture content (Use this function wisely as reading from a texture can be slow)\r\n * @returns an ArrayBufferView (Uint8Array or Float32Array)\r\n */\r\n ProceduralTexture.prototype.getContent = function () {\r\n if (this._contentData && this._currentRefreshId == this._contentUpdateId) {\r\n return this._contentData;\r\n }\r\n this._contentData = this.readPixels(0, 0, this._contentData);\r\n this._contentUpdateId = this._currentRefreshId;\r\n return this._contentData;\r\n };\r\n ProceduralTexture.prototype._createIndexBuffer = function () {\r\n var engine = this._engine;\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n };\r\n /** @hidden */\r\n ProceduralTexture.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n if (this.refreshRate === _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_7__[\"RenderTargetTexture\"].REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_7__[\"RenderTargetTexture\"].REFRESHRATE_RENDER_ONCE;\r\n }\r\n };\r\n /**\r\n * Resets the texture in order to recreate its associated resources.\r\n * This can be called in case of context loss\r\n */\r\n ProceduralTexture.prototype.reset = function () {\r\n if (this._effect === undefined) {\r\n return;\r\n }\r\n this._effect.dispose();\r\n };\r\n ProceduralTexture.prototype._getDefines = function () {\r\n return \"\";\r\n };\r\n /**\r\n * Is the texture ready to be used ? (rendered at least once)\r\n * @returns true if ready, otherwise, false.\r\n */\r\n ProceduralTexture.prototype.isReady = function () {\r\n var _this = this;\r\n var engine = this._engine;\r\n var shaders;\r\n if (!this._fragment) {\r\n return false;\r\n }\r\n if (this._fallbackTextureUsed) {\r\n return true;\r\n }\r\n var defines = this._getDefines();\r\n if (this._effect && defines === this._cachedDefines && this._effect.isReady()) {\r\n return true;\r\n }\r\n if (this._fragment.fragmentElement !== undefined) {\r\n shaders = { vertex: \"procedural\", fragmentElement: this._fragment.fragmentElement };\r\n }\r\n else {\r\n shaders = { vertex: \"procedural\", fragment: this._fragment };\r\n }\r\n this._cachedDefines = defines;\r\n this._effect = engine.createEffect(shaders, [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind], this._uniforms, this._samplers, defines, undefined, undefined, function () {\r\n _this.releaseInternalTexture();\r\n if (_this._fallbackTexture) {\r\n _this._texture = _this._fallbackTexture._texture;\r\n if (_this._texture) {\r\n _this._texture.incrementReferences();\r\n }\r\n }\r\n _this._fallbackTextureUsed = true;\r\n });\r\n return this._effect.isReady();\r\n };\r\n /**\r\n * Resets the refresh counter of the texture and start bak from scratch.\r\n * Could be useful to regenerate the texture if it is setup to render only once.\r\n */\r\n ProceduralTexture.prototype.resetRefreshCounter = function () {\r\n this._currentRefreshId = -1;\r\n };\r\n /**\r\n * Set the fragment shader to use in order to render the texture.\r\n * @param fragment This can be set to a path (into the shader store) or to a json object containing a fragmentElement property.\r\n */\r\n ProceduralTexture.prototype.setFragment = function (fragment) {\r\n this._fragment = fragment;\r\n };\r\n Object.defineProperty(ProceduralTexture.prototype, \"refreshRate\", {\r\n /**\r\n * Define the refresh rate of the texture or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n get: function () {\r\n return this._refreshRate;\r\n },\r\n set: function (value) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n ProceduralTexture.prototype._shouldRender = function () {\r\n if (!this.isEnabled || !this.isReady() || !this._texture) {\r\n if (this._texture) {\r\n this._texture.isReady = false;\r\n }\r\n return false;\r\n }\r\n if (this._fallbackTextureUsed) {\r\n return false;\r\n }\r\n if (this._currentRefreshId === -1) { // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n this._currentRefreshId++;\r\n return false;\r\n };\r\n /**\r\n * Get the size the texture is rendering at.\r\n * @returns the size (texture is always squared)\r\n */\r\n ProceduralTexture.prototype.getRenderSize = function () {\r\n return this._size;\r\n };\r\n /**\r\n * Resize the texture to new value.\r\n * @param size Define the new size the texture should have\r\n * @param generateMipMaps Define whether the new texture should create mip maps\r\n */\r\n ProceduralTexture.prototype.resize = function (size, generateMipMaps) {\r\n if (this._fallbackTextureUsed) {\r\n return;\r\n }\r\n this.releaseInternalTexture();\r\n this._texture = this._engine.createRenderTargetTexture(size, generateMipMaps);\r\n // Update properties\r\n this._size = size;\r\n this._generateMipMaps = generateMipMaps;\r\n };\r\n ProceduralTexture.prototype._checkUniform = function (uniformName) {\r\n if (this._uniforms.indexOf(uniformName) === -1) {\r\n this._uniforms.push(uniformName);\r\n }\r\n };\r\n /**\r\n * Set a texture in the shader program used to render.\r\n * @param name Define the name of the uniform samplers as defined in the shader\r\n * @param texture Define the texture to bind to this sampler\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setTexture = function (name, texture) {\r\n if (this._samplers.indexOf(name) === -1) {\r\n this._samplers.push(name);\r\n }\r\n this._textures[name] = texture;\r\n return this;\r\n };\r\n /**\r\n * Set a float in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setFloat = function (name, value) {\r\n this._checkUniform(name);\r\n this._floats[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a int in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setInt = function (name, value) {\r\n this._checkUniform(name);\r\n this._ints[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set an array of floats in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setFloats = function (name, value) {\r\n this._checkUniform(name);\r\n this._floatsArrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Color3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setColor3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Color4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setColor4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 in the shader from a Vector2.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setVector2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Vector3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setVector3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat4 in the shader from a MAtrix.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the texture itself allowing \"fluent\" like uniform updates\r\n */\r\n ProceduralTexture.prototype.setMatrix = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Render the texture to its associated render target.\r\n * @param useCameraPostProcess Define if camera post process should be applied to the texture\r\n */\r\n ProceduralTexture.prototype.render = function (useCameraPostProcess) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = this._engine;\r\n // Render\r\n engine.enableEffect(this._effect);\r\n engine.setState(false);\r\n // Texture\r\n for (var name in this._textures) {\r\n this._effect.setTexture(name, this._textures[name]);\r\n }\r\n // Float\r\n for (name in this._ints) {\r\n this._effect.setInt(name, this._ints[name]);\r\n }\r\n // Float\r\n for (name in this._floats) {\r\n this._effect.setFloat(name, this._floats[name]);\r\n }\r\n // Floats\r\n for (name in this._floatsArrays) {\r\n this._effect.setArray(name, this._floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in this._colors3) {\r\n this._effect.setColor3(name, this._colors3[name]);\r\n }\r\n // Color4\r\n for (name in this._colors4) {\r\n var color = this._colors4[name];\r\n this._effect.setFloat4(name, color.r, color.g, color.b, color.a);\r\n }\r\n // Vector2\r\n for (name in this._vectors2) {\r\n this._effect.setVector2(name, this._vectors2[name]);\r\n }\r\n // Vector3\r\n for (name in this._vectors3) {\r\n this._effect.setVector3(name, this._vectors3[name]);\r\n }\r\n // Matrix\r\n for (name in this._matrices) {\r\n this._effect.setMatrix(name, this._matrices[name]);\r\n }\r\n if (!this._texture) {\r\n return;\r\n }\r\n if (this.isCube) {\r\n for (var face = 0; face < 6; face++) {\r\n engine.bindFramebuffer(this._texture, face, undefined, undefined, true);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);\r\n this._effect.setFloat(\"face\", face);\r\n // Clear\r\n if (this.autoClear) {\r\n engine.clear(scene.clearColor, true, false, false);\r\n }\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n // Mipmaps\r\n if (face === 5) {\r\n engine.generateMipMapsForCubemap(this._texture);\r\n }\r\n }\r\n }\r\n else {\r\n engine.bindFramebuffer(this._texture, 0, undefined, undefined, true);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);\r\n // Clear\r\n if (this.autoClear) {\r\n engine.clear(scene.clearColor, true, false, false);\r\n }\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, 6);\r\n }\r\n // Unbind\r\n engine.unBindFramebuffer(this._texture, this.isCube);\r\n if (this.onGenerated) {\r\n this.onGenerated();\r\n }\r\n this.onGeneratedObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Clone the texture.\r\n * @returns the cloned texture\r\n */\r\n ProceduralTexture.prototype.clone = function () {\r\n var textureSize = this.getSize();\r\n var newTexture = new ProceduralTexture(this.name, textureSize.width, this._fragment, this.getScene(), this._fallbackTexture, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // RenderTarget Texture\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n return newTexture;\r\n };\r\n /**\r\n * Dispose the texture and release its asoociated resources.\r\n */\r\n ProceduralTexture.prototype.dispose = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var index = scene.proceduralTextures.indexOf(this);\r\n if (index >= 0) {\r\n scene.proceduralTextures.splice(index, 1);\r\n }\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer)) {\r\n this._indexBuffer = null;\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"isEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"autoClear\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"_generateMipMaps\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"_size\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ProceduralTexture.prototype, \"refreshRate\", null);\r\n return ProceduralTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts\":\n/*!***************************************************************************!*\\\n !*** ./Materials/Textures/Procedurals/proceduralTextureSceneComponent.ts ***!\n \\***************************************************************************/\n/*! exports provided: ProceduralTextureSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return ProceduralTextureSceneComponent; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../sceneComponent */ \"./sceneComponent.ts\");\n\r\n\r\n/**\r\n * Defines the Procedural Texture scene component responsible to manage any Procedural Texture\r\n * in a given scene.\r\n */\r\nvar ProceduralTextureSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function ProceduralTextureSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_PROCEDURALTEXTURE;\r\n this.scene = scene;\r\n this.scene.proceduralTextures = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n ProceduralTextureSceneComponent.prototype.register = function () {\r\n this.scene._beforeClearStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_BEFORECLEAR_PROCEDURALTEXTURE, this, this._beforeClear);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n ProceduralTextureSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n ProceduralTextureSceneComponent.prototype.dispose = function () {\r\n // Nothing to do here.\r\n };\r\n ProceduralTextureSceneComponent.prototype._beforeClear = function () {\r\n if (this.scene.proceduralTexturesEnabled) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].StartPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n for (var proceduralIndex = 0; proceduralIndex < this.scene.proceduralTextures.length; proceduralIndex++) {\r\n var proceduralTexture = this.scene.proceduralTextures[proceduralIndex];\r\n if (proceduralTexture._shouldRender()) {\r\n proceduralTexture.render();\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].EndPerformanceCounter(\"Procedural textures\", this.scene.proceduralTextures.length > 0);\r\n }\r\n };\r\n return ProceduralTextureSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/baseTexture.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Textures/baseTexture.ts ***!\n \\*******************************************/\n/*! exports provided: BaseTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return BaseTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_guid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/guid */ \"./Misc/guid.ts\");\n/* harmony import */ var _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Maths/math.size */ \"./Maths/math.size.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nvar BaseTexture = /** @class */ (function () {\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param scene Define the scene the texture blongs to\r\n */\r\n function BaseTexture(scene) {\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n this._hasAlpha = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n this.getAlphaFromRGB = false;\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n this.level = 1;\r\n /**\r\n * Define the UV chanel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n this.coordinatesIndex = 0;\r\n this._coordinatesMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_EXPLICIT_MODE;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapU = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapV = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapR = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n this.anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n this.gammaSpace = true;\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n this.invertZ = false;\r\n /**\r\n * @hidden\r\n */\r\n this.lodLevelInAlpha = false;\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n this.isRenderTarget = false;\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n this.animations = new Array();\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n this._onDisposeObserver = null;\r\n /**\r\n * Define the current state of the loading sequence when in delayed load mode.\r\n */\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n this._scene = null;\r\n /** @hidden */\r\n this._texture = null;\r\n this._uid = null;\r\n this._cachedSize = _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"].Zero();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__[\"EngineStore\"].LastCreatedScene;\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n }\r\n this._uid = null;\r\n }\r\n Object.defineProperty(BaseTexture.prototype, \"hasAlpha\", {\r\n get: function () {\r\n return this._hasAlpha;\r\n },\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n set: function (value) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag | _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"coordinatesMode\", {\r\n get: function () {\r\n return this._coordinatesMode;\r\n },\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n set: function (value) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isCube\", {\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.isCube;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.isCube = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"is3D\", {\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is3D;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is3D = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isRGBD\", {\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n get: function () {\r\n return this._texture != null && this._texture._isRGBD;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationOffset\", {\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationScale\", {\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"linearSpecularLOD\", {\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n return false;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"irradianceTexture\", {\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n return null;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"uid\", {\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = _Misc_guid__WEBPACK_IMPORTED_MODULE_7__[\"GUID\"].RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n BaseTexture.prototype.toString = function () {\r\n return this.name;\r\n };\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n BaseTexture.prototype.getClassName = function () {\r\n return \"BaseTexture\";\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"onDispose\", {\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isBlocking\", {\r\n /**\r\n * Define if the texture is preventinga material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n BaseTexture.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for istance.\r\n * @returns the transformation matrix\r\n */\r\n BaseTexture.prototype.getTextureMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].IdentityReadOnly;\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n BaseTexture.prototype.getReflectionTextureMatrix = function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].IdentityReadOnly;\r\n };\r\n /**\r\n * Get the underlying lower level texture from Babylon.\r\n * @returns the insternal texture\r\n */\r\n BaseTexture.prototype.getInternalTexture = function () {\r\n return this._texture;\r\n };\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready or not blocking\r\n */\r\n BaseTexture.prototype.isReadyOrNotBlocking = function () {\r\n return !this.isBlocking || this.isReady();\r\n };\r\n /**\r\n * Get if the texture is ready to be used (downloaded, converted, mip mapped...).\r\n * @returns true if fully ready\r\n */\r\n BaseTexture.prototype.isReady = function () {\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n this.delayLoad();\r\n return false;\r\n }\r\n if (this._texture) {\r\n return this._texture.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Get the size of the texture.\r\n * @returns the texture size.\r\n */\r\n BaseTexture.prototype.getSize = function () {\r\n if (this._texture) {\r\n if (this._texture.width) {\r\n this._cachedSize.width = this._texture.width;\r\n this._cachedSize.height = this._texture.height;\r\n return this._cachedSize;\r\n }\r\n if (this._texture._size) {\r\n this._cachedSize.width = this._texture._size;\r\n this._cachedSize.height = this._texture._size;\r\n return this._cachedSize;\r\n }\r\n }\r\n return this._cachedSize;\r\n };\r\n /**\r\n * Get the base size of the texture.\r\n * It can be different from the size if the texture has been resized for POT for instance\r\n * @returns the base size\r\n */\r\n BaseTexture.prototype.getBaseSize = function () {\r\n if (!this.isReady() || !this._texture) {\r\n return _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"].Zero();\r\n }\r\n if (this._texture._size) {\r\n return new _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"](this._texture._size, this._texture._size);\r\n }\r\n return new _Maths_math_size__WEBPACK_IMPORTED_MODULE_8__[\"Size\"](this._texture.baseWidth, this._texture.baseHeight);\r\n };\r\n /**\r\n * Update the sampling mode of the texture.\r\n * Default is Trilinear mode.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |\r\n * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |\r\n * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |\r\n * | 4 | NEAREST_NEAREST_MIPNEAREST | |\r\n * | 5 | NEAREST_LINEAR_MIPNEAREST | |\r\n * | 6 | NEAREST_LINEAR_MIPLINEAR | |\r\n * | 7 | NEAREST_LINEAR | |\r\n * | 8 | NEAREST_NEAREST | |\r\n * | 9 | LINEAR_NEAREST_MIPNEAREST | |\r\n * | 10 | LINEAR_NEAREST_MIPLINEAR | |\r\n * | 11 | LINEAR_LINEAR | |\r\n * | 12 | LINEAR_NEAREST | |\r\n *\r\n * > _mag_: magnification filter (close to the viewer)\r\n * > _min_: minification filter (far from the viewer)\r\n * > _mip_: filter used between mip map levels\r\n *@param samplingMode Define the new sampling mode of the texture\r\n */\r\n BaseTexture.prototype.updateSamplingMode = function (samplingMode) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);\r\n };\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n BaseTexture.prototype.scale = function (ratio) {\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling, invertY) {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n var texturesCache = this._scene.getEngine().getLoadedTexturesCache();\r\n for (var index = 0; index < texturesCache.length; index++) {\r\n var texturesCacheEntry = texturesCache[index];\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n BaseTexture.prototype._rebuild = function () {\r\n };\r\n /**\r\n * Triggers the load sequence in delayed load mode.\r\n */\r\n BaseTexture.prototype.delayLoad = function () {\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n BaseTexture.prototype.clone = function () {\r\n return null;\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"textureType\", {\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n return (this._texture.type !== undefined) ? this._texture.type : _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"textureFormat\", {\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n }\r\n return (this._texture.format !== undefined) ? this._texture.format : _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @returns The Array buffer containing the pixels data.\r\n */\r\n BaseTexture.prototype.readPixels = function (faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (!this._texture) {\r\n return null;\r\n }\r\n var size = this.getSize();\r\n var width = size.width;\r\n var height = size.height;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return null;\r\n }\r\n var engine = scene.getEngine();\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer);\r\n }\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer);\r\n };\r\n /**\r\n * Release and destroy the underlying lower level texture aka internalTexture.\r\n */\r\n BaseTexture.prototype.releaseInternalTexture = function () {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"sphericalPolynomial\", {\r\n /**\r\n * Get the polynomial representation of the texture data.\r\n * This is mainly use as a fast way to recover IBL Diffuse irradiance data.\r\n * @see https://learnopengl.com/PBR/IBL/Diffuse-irradiance\r\n */\r\n get: function () {\r\n if (!this._texture || !_Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__[\"CubeMapToSphericalPolynomialTools\"] || !this.isReady()) {\r\n return null;\r\n }\r\n if (!this._texture._sphericalPolynomial) {\r\n this._texture._sphericalPolynomial =\r\n _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__[\"CubeMapToSphericalPolynomialTools\"].ConvertCubeMapTextureToSphericalPolynomial(this);\r\n }\r\n return this._texture._sphericalPolynomial;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._sphericalPolynomial = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureHigh\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureMid\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureLow\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n BaseTexture.prototype.dispose = function () {\r\n if (!this._scene) {\r\n return;\r\n }\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n // Remove from scene\r\n this._scene._removePendingData(this);\r\n var index = this._scene.textures.indexOf(this);\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n if (this._texture === undefined) {\r\n return;\r\n }\r\n // Release\r\n this.releaseInternalTexture();\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @returns the JSON representation of the texture\r\n */\r\n BaseTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n BaseTexture.WhenAllReady = function (textures, callback) {\r\n var numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n var _loop_1 = function () {\r\n texture = textures[i];\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n else {\r\n onLoadObservable = texture.onLoadObservable;\r\n var onLoadCallback_1 = function () {\r\n onLoadObservable.removeCallback(onLoadCallback_1);\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n };\r\n onLoadObservable.add(onLoadCallback_1);\r\n }\r\n };\r\n var texture, onLoadObservable;\r\n for (var i = 0; i < textures.length; i++) {\r\n _loop_1();\r\n }\r\n };\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"uniqueId\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"metadata\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"hasAlpha\")\r\n ], BaseTexture.prototype, \"_hasAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"getAlphaFromRGB\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"level\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"coordinatesIndex\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"coordinatesMode\")\r\n ], BaseTexture.prototype, \"_coordinatesMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"wrapU\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"wrapV\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"wrapR\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"anisotropicFilteringLevel\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"isCube\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"is3D\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"gammaSpace\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"invertZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"lodLevelInAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"lodGenerationOffset\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"lodGenerationScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"linearSpecularLOD\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])()\r\n ], BaseTexture.prototype, \"irradianceTexture\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], BaseTexture.prototype, \"isRenderTarget\", void 0);\r\n return BaseTexture;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/colorGradingTexture.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Textures/colorGradingTexture.ts ***!\n \\***************************************************/\n/*! exports provided: ColorGradingTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return ColorGradingTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a color grading texture. This acts as a lookup table LUT, useful during post process\r\n * It can help converting any input color in a desired output one. This can then be used to create effects\r\n * from sepia, black and white to sixties or futuristic rendering...\r\n *\r\n * The only supported format is currently 3dl.\r\n * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table\r\n */\r\nvar ColorGradingTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorGradingTexture, _super);\r\n /**\r\n * Instantiates a ColorGradingTexture from the following parameters.\r\n *\r\n * @param url The location of the color gradind data (currently only supporting 3dl)\r\n * @param scene The scene the texture will be used in\r\n */\r\n function ColorGradingTexture(url, scene) {\r\n var _this = _super.call(this, scene) || this;\r\n if (!url) {\r\n return _this;\r\n }\r\n _this._engine = scene.getEngine();\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _this.name = url;\r\n _this.url = url;\r\n _this.hasAlpha = false;\r\n _this.isCube = false;\r\n _this.is3D = _this._engine.webGLVersion > 1;\r\n _this.wrapU = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n _this.wrapR = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n _this.anisotropicFilteringLevel = 1;\r\n _this._texture = _this._getFromCache(url, true);\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n _this.loadTexture();\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Returns the texture matrix used in most of the material.\r\n * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).\r\n */\r\n ColorGradingTexture.prototype.getTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Occurs when the file being loaded is a .3dl LUT file.\r\n */\r\n ColorGradingTexture.prototype.load3dlTexture = function () {\r\n var engine = this._engine;\r\n var texture;\r\n if (engine.webGLVersion === 1) {\r\n texture = engine.createRawTexture(null, 1, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE);\r\n }\r\n else {\r\n texture = engine.createRawTexture3D(null, 1, 1, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE);\r\n }\r\n this._texture = texture;\r\n var callback = function (text) {\r\n if (typeof text !== \"string\") {\r\n return;\r\n }\r\n var data = null;\r\n var tempData = null;\r\n var line;\r\n var lines = text.split('\\n');\r\n var size = 0, pixelIndexW = 0, pixelIndexH = 0, pixelIndexSlice = 0;\r\n var maxColor = 0;\r\n for (var i = 0; i < lines.length; i++) {\r\n line = lines[i];\r\n if (!ColorGradingTexture._noneEmptyLineRegex.test(line)) {\r\n continue;\r\n }\r\n if (line.indexOf('#') === 0) {\r\n continue;\r\n }\r\n var words = line.split(\" \");\r\n if (size === 0) {\r\n // Number of space + one\r\n size = words.length;\r\n data = new Uint8Array(size * size * size * 4); // volume texture of side size and rgb 8\r\n tempData = new Float32Array(size * size * size * 4);\r\n continue;\r\n }\r\n if (size != 0) {\r\n var r = Math.max(parseInt(words[0]), 0);\r\n var g = Math.max(parseInt(words[1]), 0);\r\n var b = Math.max(parseInt(words[2]), 0);\r\n maxColor = Math.max(r, maxColor);\r\n maxColor = Math.max(g, maxColor);\r\n maxColor = Math.max(b, maxColor);\r\n var pixelStorageIndex = (pixelIndexW + pixelIndexSlice * size + pixelIndexH * size * size) * 4;\r\n if (tempData) {\r\n tempData[pixelStorageIndex + 0] = r;\r\n tempData[pixelStorageIndex + 1] = g;\r\n tempData[pixelStorageIndex + 2] = b;\r\n }\r\n // Keep for reference in case of back compat problems.\r\n // pixelIndexSlice++;\r\n // if (pixelIndexSlice % size == 0) {\r\n // pixelIndexH++;\r\n // pixelIndexSlice = 0;\r\n // if (pixelIndexH % size == 0) {\r\n // pixelIndexW++;\r\n // pixelIndexH = 0;\r\n // }\r\n // }\r\n pixelIndexH++;\r\n if (pixelIndexH % size == 0) {\r\n pixelIndexSlice++;\r\n pixelIndexH = 0;\r\n if (pixelIndexSlice % size == 0) {\r\n pixelIndexW++;\r\n pixelIndexSlice = 0;\r\n }\r\n }\r\n }\r\n }\r\n if (tempData && data) {\r\n for (var i = 0; i < tempData.length; i++) {\r\n if (i > 0 && (i + 1) % 4 === 0) {\r\n data[i] = 255;\r\n }\r\n else {\r\n var value = tempData[i];\r\n data[i] = (value / maxColor * 255);\r\n }\r\n }\r\n }\r\n if (texture.is3D) {\r\n texture.updateSize(size, size, size);\r\n engine.updateRawTexture3D(texture, data, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false);\r\n }\r\n else {\r\n texture.updateSize(size * size, size);\r\n engine.updateRawTexture(texture, data, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA, false);\r\n }\r\n };\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene._loadFile(this.url, callback);\r\n }\r\n else {\r\n this._engine._loadFile(this.url, callback);\r\n }\r\n return this._texture;\r\n };\r\n /**\r\n * Starts the loading process of the texture.\r\n */\r\n ColorGradingTexture.prototype.loadTexture = function () {\r\n if (this.url && this.url.toLocaleLowerCase().indexOf(\".3dl\") == (this.url.length - 4)) {\r\n this.load3dlTexture();\r\n }\r\n };\r\n /**\r\n * Clones the color gradind texture.\r\n */\r\n ColorGradingTexture.prototype.clone = function () {\r\n var newTexture = new ColorGradingTexture(this.url, this.getScene());\r\n // Base texture\r\n newTexture.level = this.level;\r\n return newTexture;\r\n };\r\n /**\r\n * Called during delayed load for textures.\r\n */\r\n ColorGradingTexture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, true);\r\n if (!this._texture) {\r\n this.loadTexture();\r\n }\r\n };\r\n /**\r\n * Parses a color grading texture serialized by Babylon.\r\n * @param parsedTexture The texture information being parsedTexture\r\n * @param scene The scene to load the texture in\r\n * @param rootUrl The root url of the data assets to load\r\n * @return A color gradind texture\r\n */\r\n ColorGradingTexture.Parse = function (parsedTexture, scene) {\r\n var texture = null;\r\n if (parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n texture = new ColorGradingTexture(parsedTexture.name, scene);\r\n texture.name = parsedTexture.name;\r\n texture.level = parsedTexture.level;\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Serializes the LUT texture to json format.\r\n */\r\n ColorGradingTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.level = this.level;\r\n serializationObject.customType = \"BABYLON.ColorGradingTexture\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Empty line regex stored for GC.\r\n */\r\n ColorGradingTexture._noneEmptyLineRegex = /\\S+/;\r\n return ColorGradingTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_2__[\"BaseTexture\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_4__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ColorGradingTexture\"] = ColorGradingTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/cubeTexture.ts\":\n/*!*******************************************!*\\\n !*** ./Materials/Textures/cubeTexture.ts ***!\n \\*******************************************/\n/*! exports provided: CubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return CubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_Extensions_engine_cubeTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Engines/Extensions/engine.cubeTexture */ \"./Engines/Extensions/engine.cubeTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nvar CubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CubeTexture, _super);\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param scene defines the scene the texture is attached to\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occured\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @return the cube texture\r\n */\r\n function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension, createPolynomials, lodScale, lodOffset) {\r\n if (extensions === void 0) { extensions = null; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (files === void 0) { files = null; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (prefiltered === void 0) { prefiltered = false; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n var _this = _super.call(this, scene) || this;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see http://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n _this.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._rotationY = 0;\r\n /** @hidden */\r\n _this._prefiltered = false;\r\n _this.name = rootUrl;\r\n _this.url = rootUrl;\r\n _this._noMipmap = noMipmap;\r\n _this.hasAlpha = false;\r\n _this._format = format;\r\n _this.isCube = true;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n _this._createPolynomials = createPolynomials;\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].CUBIC_MODE;\r\n if (!rootUrl && !files) {\r\n return _this;\r\n }\r\n var lastDot = rootUrl.lastIndexOf(\".\");\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var isDDS = (extension === \".dds\");\r\n var isEnv = (extension === \".env\");\r\n if (isEnv) {\r\n _this.gammaSpace = false;\r\n _this._prefiltered = false;\r\n }\r\n else {\r\n _this._prefiltered = prefiltered;\r\n if (prefiltered) {\r\n _this.gammaSpace = false;\r\n }\r\n }\r\n _this._texture = _this._getFromCache(rootUrl, noMipmap);\r\n if (!files) {\r\n if (!isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n files = [];\r\n if (extensions) {\r\n for (var index = 0; index < extensions.length; index++) {\r\n files.push(rootUrl + extensions[index]);\r\n }\r\n }\r\n }\r\n _this._files = files;\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n if (prefiltered) {\r\n _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);\r\n }\r\n else {\r\n _this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension, false, lodScale, lodOffset);\r\n }\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n else if (onLoad) {\r\n if (_this._texture.isReady) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetImmediate(function () { return onLoad(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(CubeTexture.prototype, \"boundingBoxSize\", {\r\n /**\r\n * Returns the bounding box size\r\n * @see http://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"rotationY\", {\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n get: function () {\r\n return this._rotationY;\r\n },\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n set: function (value) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationY(this._rotationY));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n CubeTexture.CreateFromImages = function (files, scene, noMipmap) {\r\n var rootUrlKey = \"\";\r\n files.forEach(function (url) { return rootUrlKey += url; });\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n };\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @return the prefiltered texture\r\n */\r\n CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension, createPolynomials) {\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = true; }\r\n return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n };\r\n Object.defineProperty(CubeTexture.prototype, \"isPrefiltered\", {\r\n /**\r\n * Gets a boolean indicating if the cube texture contains prefiltered mips (used to simulate roughness with PBR)\r\n */\r\n get: function () {\r\n return this._prefiltered;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"CubeTexture\"\r\n */\r\n CubeTexture.prototype.getClassName = function () {\r\n return \"CubeTexture\";\r\n };\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n */\r\n CubeTexture.prototype.updateURL = function (url, forcedExtension, onLoad) {\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n this.name = url;\r\n this.url = url;\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n this._prefiltered = false;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad(forcedExtension);\r\n };\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n CubeTexture.prototype.delayLoad = function (forcedExtension) {\r\n if (this.delayLoadState !== _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n if (!this._texture) {\r\n if (this._prefiltered) {\r\n this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);\r\n }\r\n else {\r\n this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n CubeTexture.prototype.getReflectionTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n CubeTexture.prototype.setReflectionTextureMatrix = function (value) {\r\n var _this = this;\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) { return mat.getActiveTextures().indexOf(_this) !== -1; });\r\n }\r\n this._textureMatrix = value;\r\n };\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n CubeTexture.Parse = function (parsedTexture, scene, rootUrl) {\r\n var texture = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () {\r\n var prefiltered = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.extensions, false, parsedTexture.files || null, null, null, undefined, prefiltered);\r\n }, parsedTexture, scene);\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n // Animations\r\n if (parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n CubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n var uniqueId = 0;\r\n var newCubeTexture = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () {\r\n if (!scene) {\r\n return _this;\r\n }\r\n var cubeTexture = new CubeTexture(_this.url, scene, _this._extensions, _this._noMipmap, _this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n return cubeTexture;\r\n }, this);\r\n newCubeTexture.uniqueId = uniqueId;\r\n return newCubeTexture;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"rotationY\")\r\n ], CubeTexture.prototype, \"rotationY\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"files\")\r\n ], CubeTexture.prototype, \"_files\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMatrix\"])(\"textureMatrix\")\r\n ], CubeTexture.prototype, \"_textureMatrix\", void 0);\r\n return CubeTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__[\"BaseTexture\"]));\r\n\r\n_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"]._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.CubeTexture\"] = CubeTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/dynamicTexture.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Textures/dynamicTexture.ts ***!\n \\**********************************************/\n/*! exports provided: DynamicTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return DynamicTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * A class extending Texture allowing drawing on a texture\r\n * @see http://doc.babylonjs.com/how_to/dynamictexture\r\n */\r\nvar DynamicTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DynamicTexture, _super);\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param options provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param scene defines the scene where you want the texture\r\n * @param generateMipMaps defines the use of MinMaps or not (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param format defines the texture format to use (default is Engine.TEXTUREFORMAT_RGBA)\r\n */\r\n function DynamicTexture(name, options, scene, generateMipMaps, samplingMode, format) {\r\n if (scene === void 0) { scene = null; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, undefined, samplingMode, undefined, undefined, undefined, undefined, format) || this;\r\n _this.name = name;\r\n _this._engine = _this.getScene().getEngine();\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this._generateMipMaps = generateMipMaps;\r\n if (options.getContext) {\r\n _this._canvas = options;\r\n _this._texture = _this._engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._canvas = document.createElement(\"canvas\");\r\n if (options.width || options.width === 0) {\r\n _this._texture = _this._engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._texture = _this._engine.createDynamicTexture(options, options, generateMipMaps, samplingMode);\r\n }\r\n }\r\n var textureSize = _this.getSize();\r\n _this._canvas.width = textureSize.width;\r\n _this._canvas.height = textureSize.height;\r\n _this._context = _this._canvas.getContext(\"2d\");\r\n return _this;\r\n }\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"DynamicTexture\"\r\n */\r\n DynamicTexture.prototype.getClassName = function () {\r\n return \"DynamicTexture\";\r\n };\r\n Object.defineProperty(DynamicTexture.prototype, \"canRescale\", {\r\n /**\r\n * Gets the current state of canRescale\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DynamicTexture.prototype._recreate = function (textureSize) {\r\n this._canvas.width = textureSize.width;\r\n this._canvas.height = textureSize.height;\r\n this.releaseInternalTexture();\r\n this._texture = this._engine.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);\r\n };\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n DynamicTexture.prototype.scale = function (ratio) {\r\n var textureSize = this.getSize();\r\n textureSize.width *= ratio;\r\n textureSize.height *= ratio;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n DynamicTexture.prototype.scaleTo = function (width, height) {\r\n var textureSize = this.getSize();\r\n textureSize.width = width;\r\n textureSize.height = height;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Gets the context of the canvas used by the texture\r\n * @returns the canvas context of the dynamic texture\r\n */\r\n DynamicTexture.prototype.getContext = function () {\r\n return this._context;\r\n };\r\n /**\r\n * Clears the texture\r\n */\r\n DynamicTexture.prototype.clear = function () {\r\n var size = this.getSize();\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n };\r\n /**\r\n * Updates the texture\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param premulAlpha defines if alpha is stored as premultiplied (default is false)\r\n */\r\n DynamicTexture.prototype.update = function (invertY, premulAlpha) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n this._engine.updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY, premulAlpha, this._format || undefined);\r\n };\r\n /**\r\n * Draws text onto the texture\r\n * @param text defines the text to be drawn\r\n * @param x defines the placement of the text from the left\r\n * @param y defines the placement of the text from the top when invertY is true and from the bottom when false\r\n * @param font defines the font to be used with font-style, font-size, font-name\r\n * @param color defines the color used for the text\r\n * @param clearColor defines the color for the canvas, use null to not overwrite canvas\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param update defines whether texture is immediately update (default is true)\r\n */\r\n DynamicTexture.prototype.drawText = function (text, x, y, font, color, clearColor, invertY, update) {\r\n if (update === void 0) { update = true; }\r\n var size = this.getSize();\r\n if (clearColor) {\r\n this._context.fillStyle = clearColor;\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n }\r\n this._context.font = font;\r\n if (x === null || x === undefined) {\r\n var textSize = this._context.measureText(text);\r\n x = (size.width - textSize.width) / 2;\r\n }\r\n if (y === null || y === undefined) {\r\n var fontSize = parseInt((font.replace(/\\D/g, '')));\r\n y = (size.height / 2) + (fontSize / 3.65);\r\n }\r\n this._context.fillStyle = color;\r\n this._context.fillText(text, x, y);\r\n if (update) {\r\n this.update(invertY);\r\n }\r\n };\r\n /**\r\n * Clones the texture\r\n * @returns the clone of the texture.\r\n */\r\n DynamicTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new DynamicTexture(this.name, textureSize, scene, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Dynamic Texture\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n return newTexture;\r\n };\r\n /**\r\n * Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized\r\n * @returns a serialized dynamic texture object\r\n */\r\n DynamicTexture.prototype.serialize = function () {\r\n var scene = this.getScene();\r\n if (scene && !scene.isReady()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"The scene must be ready before serializing the dynamic texture\");\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.base64String = this._canvas.toDataURL();\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n DynamicTexture.prototype._rebuild = function () {\r\n this.update();\r\n };\r\n return DynamicTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/equiRectangularCubeTexture.ts\":\n/*!**********************************************************!*\\\n !*** ./Materials/Textures/equiRectangularCubeTexture.ts ***!\n \\**********************************************************/\n/*! exports provided: EquiRectangularCubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return EquiRectangularCubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_HighDynamicRange_panoramaToCubemap__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/panoramaToCubemap */ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _baseTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a texture coming from an equirectangular image supported by the web browser canvas.\r\n */\r\nvar EquiRectangularCubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](EquiRectangularCubeTexture, _super);\r\n /**\r\n * Instantiates an EquiRectangularCubeTexture from the following parameters.\r\n * @param url The location of the image\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @param onLoad — defines a callback called when texture is loaded\r\n * @param onError — defines a callback called if there is an error\r\n */\r\n function EquiRectangularCubeTexture(url, scene, size, noMipmap, gammaSpace, onLoad, onError) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (gammaSpace === void 0) { gammaSpace = true; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n var _this = _super.call(this, scene) || this;\r\n _this._onLoad = null;\r\n _this._onError = null;\r\n /** The texture coordinates mode. As this texture is stored in a cube format, please modify carefully. */\r\n _this.coordinatesMode = _texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CUBIC_MODE;\r\n if (!url) {\r\n throw new Error('Image url is not set');\r\n }\r\n _this.name = url;\r\n _this.url = url;\r\n _this._size = size;\r\n _this._noMipmap = noMipmap;\r\n _this.gammaSpace = gammaSpace;\r\n _this._onLoad = onLoad;\r\n _this._onError = onError;\r\n _this.hasAlpha = false;\r\n _this.isCube = true;\r\n _this._texture = _this._getFromCache(url, _this._noMipmap);\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n _this.loadImage(_this.loadTexture.bind(_this), _this._onError);\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n else if (onLoad) {\r\n if (_this._texture.isReady) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].SetImmediate(function () { return onLoad(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Load the image data, by putting the image on a canvas and extracting its buffer.\r\n */\r\n EquiRectangularCubeTexture.prototype.loadImage = function (loadTextureCallback, onError) {\r\n var _this = this;\r\n var canvas = document.createElement('canvas');\r\n var image = new Image();\r\n image.addEventListener('load', function () {\r\n _this._width = image.width;\r\n _this._height = image.height;\r\n canvas.width = _this._width;\r\n canvas.height = _this._height;\r\n var ctx = canvas.getContext('2d');\r\n ctx.drawImage(image, 0, 0);\r\n var imageData = ctx.getImageData(0, 0, image.width, image.height);\r\n _this._buffer = imageData.data.buffer;\r\n canvas.remove();\r\n loadTextureCallback();\r\n });\r\n image.addEventListener('error', function (error) {\r\n if (onError) {\r\n onError(_this.getClassName() + \" could not be loaded\", error);\r\n }\r\n });\r\n image.src = this.url;\r\n };\r\n /**\r\n * Convert the image buffer into a cubemap and create a CubeTexture.\r\n */\r\n EquiRectangularCubeTexture.prototype.loadTexture = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n var callback = function () {\r\n var imageData = _this.getFloat32ArrayFromArrayBuffer(_this._buffer);\r\n // Extract the raw linear data.\r\n var data = _Misc_HighDynamicRange_panoramaToCubemap__WEBPACK_IMPORTED_MODULE_1__[\"PanoramaToCubeMapTools\"].ConvertPanoramaToCubemap(imageData, _this._width, _this._height, _this._size);\r\n var results = [];\r\n // Push each faces.\r\n for (var i = 0; i < 6; i++) {\r\n var dataFace = data[EquiRectangularCubeTexture._FacesMapping[i]];\r\n results.push(dataFace);\r\n }\r\n return results;\r\n };\r\n if (!scene) {\r\n return;\r\n }\r\n this._texture = scene\r\n .getEngine()\r\n .createRawCubeTextureFromUrl(this.url, scene, this._size, _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTUREFORMAT_RGB, scene.getEngine().getCaps().textureFloat\r\n ? _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_FLOAT\r\n : _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_UNSIGNED_INTEGER, this._noMipmap, callback, null, this._onLoad, this._onError);\r\n };\r\n /**\r\n * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.\r\n * @param buffer The ArrayBuffer that should be converted.\r\n * @returns The buffer as Float32Array.\r\n */\r\n EquiRectangularCubeTexture.prototype.getFloat32ArrayFromArrayBuffer = function (buffer) {\r\n var dataView = new DataView(buffer);\r\n var floatImageData = new Float32Array((buffer.byteLength * 3) / 4);\r\n var k = 0;\r\n for (var i = 0; i < buffer.byteLength; i++) {\r\n // We drop the transparency channel, because we do not need/want it\r\n if ((i + 1) % 4 !== 0) {\r\n floatImageData[k++] = dataView.getUint8(i) / 255;\r\n }\r\n }\r\n return floatImageData;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"EquiRectangularCubeTexture\"\r\n */\r\n EquiRectangularCubeTexture.prototype.getClassName = function () {\r\n return \"EquiRectangularCubeTexture\";\r\n };\r\n /**\r\n * Create a clone of the current EquiRectangularCubeTexture and return it.\r\n * @returns A clone of the current EquiRectangularCubeTexture.\r\n */\r\n EquiRectangularCubeTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var newTexture = new EquiRectangularCubeTexture(this.url, scene, this._size, this._noMipmap, this.gammaSpace);\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n return newTexture;\r\n };\r\n /** The six faces of the cube. */\r\n EquiRectangularCubeTexture._FacesMapping = ['right', 'left', 'up', 'down', 'front', 'back'];\r\n return EquiRectangularCubeTexture;\r\n}(_baseTexture__WEBPACK_IMPORTED_MODULE_3__[\"BaseTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/hdrCubeTexture.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Textures/hdrCubeTexture.ts ***!\n \\**********************************************/\n/*! exports provided: HDRCubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return HDRCubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_hdr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/hdr */ \"./Misc/HighDynamicRange/hdr.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/HighDynamicRange/cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a texture coming from an HDR input.\r\n *\r\n * The only supported format is currently panorama picture stored in RGBE format.\r\n * Example of such files can be found on HDRLib: http://hdrlib.com/\r\n */\r\nvar HDRCubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HDRCubeTexture, _super);\r\n /**\r\n * Instantiates an HDRTexture from the following parameters.\r\n *\r\n * @param url The location of the HDR raw data (Panorama stored in RGBE format)\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process\r\n * @param gammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * @param reserved Reserved flag for internal use.\r\n */\r\n function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, gammaSpace, reserved, onLoad, onError) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (generateHarmonics === void 0) { generateHarmonics = true; }\r\n if (gammaSpace === void 0) { gammaSpace = false; }\r\n if (reserved === void 0) { reserved = false; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n var _this = _super.call(this, scene) || this;\r\n _this._generateHarmonics = true;\r\n _this._onLoad = null;\r\n _this._onError = null;\r\n /**\r\n * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.\r\n */\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CUBIC_MODE;\r\n _this._isBlocking = true;\r\n _this._rotationY = 0;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture\r\n * It must define where the camera used to render the texture was set\r\n */\r\n _this.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n if (!url) {\r\n return _this;\r\n }\r\n _this.name = url;\r\n _this.url = url;\r\n _this.hasAlpha = false;\r\n _this.isCube = true;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n _this._onLoad = onLoad;\r\n _this._onError = onError;\r\n _this.gammaSpace = gammaSpace;\r\n _this._noMipmap = noMipmap;\r\n _this._size = size;\r\n _this._texture = _this._getFromCache(url, _this._noMipmap);\r\n if (!_this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n _this.loadTexture();\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_NOTLOADED;\r\n }\r\n }\r\n else if (onLoad) {\r\n if (_this._texture.isReady) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_9__[\"Tools\"].SetImmediate(function () { return onLoad(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(HDRCubeTexture.prototype, \"isBlocking\", {\r\n /**\r\n * Gets wether or not the texture is blocking during loading.\r\n */\r\n get: function () {\r\n return this._isBlocking;\r\n },\r\n /**\r\n * Sets wether or not the texture is blocking during loading.\r\n */\r\n set: function (value) {\r\n this._isBlocking = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HDRCubeTexture.prototype, \"rotationY\", {\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n get: function () {\r\n return this._rotationY;\r\n },\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n set: function (value) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].RotationY(this._rotationY));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HDRCubeTexture.prototype, \"boundingBoxSize\", {\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"HDRCubeTexture\"\r\n */\r\n HDRCubeTexture.prototype.getClassName = function () {\r\n return \"HDRCubeTexture\";\r\n };\r\n /**\r\n * Occurs when the file is raw .hdr file.\r\n */\r\n HDRCubeTexture.prototype.loadTexture = function () {\r\n var _this = this;\r\n var callback = function (buffer) {\r\n _this.lodGenerationOffset = 0.0;\r\n _this.lodGenerationScale = 0.8;\r\n var scene = _this.getScene();\r\n if (!scene) {\r\n return null;\r\n }\r\n // Extract the raw linear data.\r\n var data = _Misc_HighDynamicRange_hdr__WEBPACK_IMPORTED_MODULE_6__[\"HDRTools\"].GetCubeMapTextureData(buffer, _this._size);\r\n // Generate harmonics if needed.\r\n if (_this._generateHarmonics) {\r\n var sphericalPolynomial = _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_7__[\"CubeMapToSphericalPolynomialTools\"].ConvertCubeMapToSphericalPolynomial(data);\r\n _this.sphericalPolynomial = sphericalPolynomial;\r\n }\r\n var results = [];\r\n var byteArray = null;\r\n // Push each faces.\r\n for (var j = 0; j < 6; j++) {\r\n // Create uintarray fallback.\r\n if (!scene.getEngine().getCaps().textureFloat) {\r\n // 3 channels of 1 bytes per pixel in bytes.\r\n var byteBuffer = new ArrayBuffer(_this._size * _this._size * 3);\r\n byteArray = new Uint8Array(byteBuffer);\r\n }\r\n var dataFace = (data[HDRCubeTexture._facesMapping[j]]);\r\n // If special cases.\r\n if (_this.gammaSpace || byteArray) {\r\n for (var i = 0; i < _this._size * _this._size; i++) {\r\n // Put in gamma space if requested.\r\n if (_this.gammaSpace) {\r\n dataFace[(i * 3) + 0] = Math.pow(dataFace[(i * 3) + 0], _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__[\"ToGammaSpace\"]);\r\n dataFace[(i * 3) + 1] = Math.pow(dataFace[(i * 3) + 1], _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__[\"ToGammaSpace\"]);\r\n dataFace[(i * 3) + 2] = Math.pow(dataFace[(i * 3) + 2], _Maths_math_constants__WEBPACK_IMPORTED_MODULE_11__[\"ToGammaSpace\"]);\r\n }\r\n // Convert to int texture for fallback.\r\n if (byteArray) {\r\n var r = Math.max(dataFace[(i * 3) + 0] * 255, 0);\r\n var g = Math.max(dataFace[(i * 3) + 1] * 255, 0);\r\n var b = Math.max(dataFace[(i * 3) + 2] * 255, 0);\r\n // May use luminance instead if the result is not accurate.\r\n var max = Math.max(Math.max(r, g), b);\r\n if (max > 255) {\r\n var scale = 255 / max;\r\n r *= scale;\r\n g *= scale;\r\n b *= scale;\r\n }\r\n byteArray[(i * 3) + 0] = r;\r\n byteArray[(i * 3) + 1] = g;\r\n byteArray[(i * 3) + 2] = b;\r\n }\r\n }\r\n }\r\n if (byteArray) {\r\n results.push(byteArray);\r\n }\r\n else {\r\n results.push(dataFace);\r\n }\r\n }\r\n return results;\r\n };\r\n var scene = this.getScene();\r\n if (scene) {\r\n this._texture = scene.getEngine().createRawCubeTextureFromUrl(this.url, scene, this._size, _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTUREFORMAT_RGB, scene.getEngine().getCaps().textureFloat ? _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_FLOAT : _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT, this._noMipmap, callback, null, this._onLoad, this._onError);\r\n }\r\n };\r\n HDRCubeTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var newTexture = new HDRCubeTexture(this.url, scene, this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n return newTexture;\r\n };\r\n // Methods\r\n HDRCubeTexture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n if (!this._texture) {\r\n this.loadTexture();\r\n }\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n HDRCubeTexture.prototype.getReflectionTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Set the texture reflection matrix used to rotate/transform the reflection.\r\n * @param value Define the reflection matrix to set\r\n */\r\n HDRCubeTexture.prototype.setReflectionTextureMatrix = function (value) {\r\n var _this = this;\r\n this._textureMatrix = value;\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) { return mat.getActiveTextures().indexOf(_this) !== -1; });\r\n }\r\n };\r\n /**\r\n * Parses a JSON representation of an HDR Texture in order to create the texture\r\n * @param parsedTexture Define the JSON representation\r\n * @param scene Define the scene the texture should be created in\r\n * @param rootUrl Define the root url in case we need to load relative dependencies\r\n * @returns the newly created texture after parsing\r\n */\r\n HDRCubeTexture.Parse = function (parsedTexture, scene, rootUrl) {\r\n var texture = null;\r\n if (parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n texture = new HDRCubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace);\r\n texture.name = parsedTexture.name;\r\n texture.hasAlpha = parsedTexture.hasAlpha;\r\n texture.level = parsedTexture.level;\r\n texture.coordinatesMode = parsedTexture.coordinatesMode;\r\n texture.isBlocking = parsedTexture.isBlocking;\r\n }\r\n if (texture) {\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n if (parsedTexture.rotationY) {\r\n texture.rotationY = parsedTexture.rotationY;\r\n }\r\n }\r\n return texture;\r\n };\r\n HDRCubeTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.hasAlpha = this.hasAlpha;\r\n serializationObject.isCube = true;\r\n serializationObject.level = this.level;\r\n serializationObject.size = this._size;\r\n serializationObject.coordinatesMode = this.coordinatesMode;\r\n serializationObject.useInGammaSpace = this.gammaSpace;\r\n serializationObject.generateHarmonics = this._generateHarmonics;\r\n serializationObject.customType = \"BABYLON.HDRCubeTexture\";\r\n serializationObject.noMipmap = this._noMipmap;\r\n serializationObject.isBlocking = this._isBlocking;\r\n serializationObject.rotationY = this._rotationY;\r\n return serializationObject;\r\n };\r\n HDRCubeTexture._facesMapping = [\r\n \"right\",\r\n \"left\",\r\n \"up\",\r\n \"down\",\r\n \"front\",\r\n \"back\"\r\n ];\r\n return HDRCubeTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_3__[\"BaseTexture\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.HDRCubeTexture\"] = HDRCubeTexture;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/htmlElementTexture.ts\":\n/*!**************************************************!*\\\n !*** ./Materials/Textures/htmlElementTexture.ts ***!\n \\**************************************************/\n/*! exports provided: HtmlElementTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return HtmlElementTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This represents the smallest workload to use an already existing element (Canvas or Video) as a texture.\r\n * To be as efficient as possible depending on your constraints nothing aside the first upload\r\n * is automatically managed.\r\n * It is a cheap VideoTexture or DynamicTexture if you prefer to keep full control of the elements\r\n * in your application.\r\n *\r\n * As the update is not automatic, you need to call them manually.\r\n */\r\nvar HtmlElementTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HtmlElementTexture, _super);\r\n /**\r\n * Instantiates a HtmlElementTexture from the following parameters.\r\n *\r\n * @param name Defines the name of the texture\r\n * @param element Defines the video or canvas the texture is filled with\r\n * @param options Defines the other none mandatory texture creation options\r\n */\r\n function HtmlElementTexture(name, element, options) {\r\n var _this = _super.call(this, options.scene) || this;\r\n if (!element || (!options.engine && !options.scene)) {\r\n return _this;\r\n }\r\n options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, HtmlElementTexture.DefaultOptions, options);\r\n _this._engine = options.engine || options.scene.getEngine();\r\n _this._generateMipMaps = options.generateMipMaps;\r\n _this._samplingMode = options.samplingMode;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n _this.name = name;\r\n _this.element = element;\r\n _this._isVideo = (element instanceof HTMLVideoElement);\r\n _this.anisotropicFilteringLevel = 1;\r\n _this._createInternalTexture();\r\n return _this;\r\n }\r\n HtmlElementTexture.prototype._createInternalTexture = function () {\r\n var width = 0;\r\n var height = 0;\r\n if (this._isVideo) {\r\n width = this.element.videoWidth;\r\n height = this.element.videoHeight;\r\n }\r\n else {\r\n width = this.element.width;\r\n height = this.element.height;\r\n }\r\n this._texture = this._engine.createDynamicTexture(width, height, this._generateMipMaps, this._samplingMode);\r\n this.update();\r\n };\r\n /**\r\n * Returns the texture matrix used in most of the material.\r\n */\r\n HtmlElementTexture.prototype.getTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Updates the content of the texture.\r\n * @param invertY Defines wether the texture should be inverted on Y (false by default on video and true on canvas)\r\n */\r\n HtmlElementTexture.prototype.update = function (invertY) {\r\n if (invertY === void 0) { invertY = null; }\r\n if (this._texture == null) {\r\n return;\r\n }\r\n if (this._isVideo) {\r\n var videoElement = this.element;\r\n if (videoElement.readyState < videoElement.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n this._engine.updateVideoTexture(this._texture, videoElement, invertY === null ? true : invertY);\r\n }\r\n else {\r\n var canvasElement = this.element;\r\n this._engine.updateDynamicTexture(this._texture, canvasElement, invertY === null ? true : invertY, false);\r\n }\r\n };\r\n HtmlElementTexture.DefaultOptions = {\r\n generateMipMaps: false,\r\n samplingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE,\r\n engine: null,\r\n scene: null\r\n };\r\n return HtmlElementTexture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_1__[\"BaseTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/index.ts\":\n/*!*************************************!*\\\n !*** ./Materials/Textures/index.ts ***!\n \\*************************************/\n/*! exports provided: BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _baseTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _baseTexture__WEBPACK_IMPORTED_MODULE_0__[\"BaseTexture\"]; });\n\n/* harmony import */ var _colorGradingTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colorGradingTexture */ \"./Materials/Textures/colorGradingTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _colorGradingTexture__WEBPACK_IMPORTED_MODULE_1__[\"ColorGradingTexture\"]; });\n\n/* harmony import */ var _cubeTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _cubeTexture__WEBPACK_IMPORTED_MODULE_2__[\"CubeTexture\"]; });\n\n/* harmony import */ var _dynamicTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _dynamicTexture__WEBPACK_IMPORTED_MODULE_3__[\"DynamicTexture\"]; });\n\n/* harmony import */ var _equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./equiRectangularCubeTexture */ \"./Materials/Textures/equiRectangularCubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_4__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony import */ var _hdrCubeTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hdrCubeTexture */ \"./Materials/Textures/hdrCubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _hdrCubeTexture__WEBPACK_IMPORTED_MODULE_5__[\"HDRCubeTexture\"]; });\n\n/* harmony import */ var _internalTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _internalTexture__WEBPACK_IMPORTED_MODULE_6__[\"InternalTexture\"]; });\n\n/* harmony import */ var _Loaders_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Loaders/index */ \"./Materials/Textures/Loaders/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _Loaders_index__WEBPACK_IMPORTED_MODULE_7__[\"_BasisTextureLoader\"]; });\n\n/* harmony import */ var _mirrorTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./mirrorTexture */ \"./Materials/Textures/mirrorTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _mirrorTexture__WEBPACK_IMPORTED_MODULE_8__[\"MirrorTexture\"]; });\n\n/* harmony import */ var _multiRenderTarget__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./multiRenderTarget */ \"./Materials/Textures/multiRenderTarget.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _multiRenderTarget__WEBPACK_IMPORTED_MODULE_9__[\"MultiRenderTarget\"]; });\n\n/* harmony import */ var _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Procedurals/index */ \"./Materials/Textures/Procedurals/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _Procedurals_index__WEBPACK_IMPORTED_MODULE_10__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony import */ var _rawCubeTexture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./rawCubeTexture */ \"./Materials/Textures/rawCubeTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _rawCubeTexture__WEBPACK_IMPORTED_MODULE_11__[\"RawCubeTexture\"]; });\n\n/* harmony import */ var _rawTexture__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _rawTexture__WEBPACK_IMPORTED_MODULE_12__[\"RawTexture\"]; });\n\n/* harmony import */ var _rawTexture3D__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./rawTexture3D */ \"./Materials/Textures/rawTexture3D.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _rawTexture3D__WEBPACK_IMPORTED_MODULE_13__[\"RawTexture3D\"]; });\n\n/* harmony import */ var _refractionTexture__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./refractionTexture */ \"./Materials/Textures/refractionTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _refractionTexture__WEBPACK_IMPORTED_MODULE_14__[\"RefractionTexture\"]; });\n\n/* harmony import */ var _renderTargetTexture__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _renderTargetTexture__WEBPACK_IMPORTED_MODULE_15__[\"RenderTargetTexture\"]; });\n\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _texture__WEBPACK_IMPORTED_MODULE_16__[\"Texture\"]; });\n\n/* harmony import */ var _videoTexture__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./videoTexture */ \"./Materials/Textures/videoTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _videoTexture__WEBPACK_IMPORTED_MODULE_17__[\"VideoTexture\"]; });\n\n/* harmony import */ var _htmlElementTexture__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./htmlElementTexture */ \"./Materials/Textures/htmlElementTexture.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _htmlElementTexture__WEBPACK_IMPORTED_MODULE_18__[\"HtmlElementTexture\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/internalTexture.ts\":\n/*!***********************************************!*\\\n !*** ./Materials/Textures/internalTexture.ts ***!\n \\***********************************************/\n/*! exports provided: InternalTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return InternalTexture; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetCreationOptions */ \"./Materials/Textures/renderTargetCreationOptions.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nvar InternalTexture = /** @class */ (function () {\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param dataSource defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function InternalTexture(engine, dataSource, delayAllocation) {\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n this.isReady = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n this.isCube = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n this.is3D = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n this.isMultiview = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n this.url = \"\";\r\n /**\r\n * Gets the sampling mode of the texture\r\n */\r\n this.samplingMode = -1;\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n this.generateMipMaps = false;\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n this.samples = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n this.type = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n this.format = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n this.onLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Gets the width of the texture\r\n */\r\n this.width = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n this.height = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n this.depth = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseWidth = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseHeight = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseDepth = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n this.invertY = false;\r\n // Private\r\n /** @hidden */\r\n this._invertVScale = false;\r\n /** @hidden */\r\n this._associatedChannel = -1;\r\n /** @hidden */\r\n this._dataSource = InternalTexture.DATASOURCE_UNKNOWN;\r\n /** @hidden */\r\n this._buffer = null;\r\n /** @hidden */\r\n this._bufferView = null;\r\n /** @hidden */\r\n this._bufferViewArray = null;\r\n /** @hidden */\r\n this._bufferViewArrayArray = null;\r\n /** @hidden */\r\n this._size = 0;\r\n /** @hidden */\r\n this._extension = \"\";\r\n /** @hidden */\r\n this._files = null;\r\n /** @hidden */\r\n this._workingCanvas = null;\r\n /** @hidden */\r\n this._workingContext = null;\r\n /** @hidden */\r\n this._framebuffer = null;\r\n /** @hidden */\r\n this._depthStencilBuffer = null;\r\n /** @hidden */\r\n this._MSAAFramebuffer = null;\r\n /** @hidden */\r\n this._MSAARenderBuffer = null;\r\n /** @hidden */\r\n this._attachments = null;\r\n /** @hidden */\r\n this._cachedCoordinatesMode = null;\r\n /** @hidden */\r\n this._cachedWrapU = null;\r\n /** @hidden */\r\n this._cachedWrapV = null;\r\n /** @hidden */\r\n this._cachedWrapR = null;\r\n /** @hidden */\r\n this._cachedAnisotropicFilteringLevel = null;\r\n /** @hidden */\r\n this._isDisabled = false;\r\n /** @hidden */\r\n this._compression = null;\r\n /** @hidden */\r\n this._generateStencilBuffer = false;\r\n /** @hidden */\r\n this._generateDepthBuffer = false;\r\n /** @hidden */\r\n this._comparisonFunction = 0;\r\n /** @hidden */\r\n this._sphericalPolynomial = null;\r\n /** @hidden */\r\n this._lodGenerationScale = 0;\r\n /** @hidden */\r\n this._lodGenerationOffset = 0;\r\n // Multiview\r\n /** @hidden */\r\n this._colorTextureArray = null;\r\n /** @hidden */\r\n this._depthStencilTextureArray = null;\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @hidden */\r\n this._lodTextureHigh = null;\r\n /** @hidden */\r\n this._lodTextureMid = null;\r\n /** @hidden */\r\n this._lodTextureLow = null;\r\n /** @hidden */\r\n this._isRGBD = false;\r\n /** @hidden */\r\n this._linearSpecularLOD = false;\r\n /** @hidden */\r\n this._irradianceTexture = null;\r\n /** @hidden */\r\n this._webGLTexture = null;\r\n /** @hidden */\r\n this._references = 1;\r\n this._engine = engine;\r\n this._dataSource = dataSource;\r\n if (!delayAllocation) {\r\n this._webGLTexture = engine._createTexture();\r\n }\r\n }\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n InternalTexture.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n Object.defineProperty(InternalTexture.prototype, \"dataSource\", {\r\n /**\r\n * Gets the data source type of the texture (can be one of the InternalTexture.DATASOURCE_XXXX)\r\n */\r\n get: function () {\r\n return this._dataSource;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n InternalTexture.prototype.incrementReferences = function () {\r\n this._references++;\r\n };\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n InternalTexture.prototype.updateSize = function (width, height, depth) {\r\n if (depth === void 0) { depth = 1; }\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n this._size = width * height * depth;\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._rebuild = function () {\r\n var _this = this;\r\n var proxy;\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n switch (this._dataSource) {\r\n case InternalTexture.DATASOURCE_TEMP:\r\n return;\r\n case InternalTexture.DATASOURCE_URL:\r\n proxy = this._engine.createTexture(this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this._buffer, undefined, this.format);\r\n return;\r\n case InternalTexture.DATASOURCE_RAW:\r\n proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_RAW3D:\r\n proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_DYNAMIC:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this);\r\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, undefined, undefined, true);\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n return;\r\n case InternalTexture.DATASOURCE_RENDERTARGET:\r\n var options = new _Materials_Textures_renderTargetCreationOptions__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetCreationOptions\"]();\r\n options.generateDepthBuffer = this._generateDepthBuffer;\r\n options.generateMipMaps = this.generateMipMaps;\r\n options.generateStencilBuffer = this._generateStencilBuffer;\r\n options.samplingMode = this.samplingMode;\r\n options.type = this.type;\r\n if (this.isCube) {\r\n proxy = this._engine.createRenderTargetCubeTexture(this.width, options);\r\n }\r\n else {\r\n var size = {\r\n width: this.width,\r\n height: this.height\r\n };\r\n proxy = this._engine.createRenderTargetTexture(size, options);\r\n }\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_DEPTHTEXTURE:\r\n var depthTextureOptions = {\r\n bilinearFiltering: this.samplingMode !== _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE,\r\n comparisonFunction: this._comparisonFunction,\r\n generateStencil: this._generateStencilBuffer,\r\n isCube: this.isCube\r\n };\r\n proxy = this._engine.createDepthStencilTexture({ width: this.width, height: this.height }, depthTextureOptions);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_CUBE:\r\n proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n return;\r\n case InternalTexture.DATASOURCE_CUBERAW:\r\n proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTexture.DATASOURCE_CUBERAW_RGBD:\r\n proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n InternalTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n });\r\n return;\r\n case InternalTexture.DATASOURCE_CUBEPREFILTERED:\r\n proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {\r\n if (proxy) {\r\n proxy._swapAndDie(_this);\r\n }\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._swapAndDie = function (target) {\r\n target._webGLTexture = this._webGLTexture;\r\n target._isRGBD = this._isRGBD;\r\n if (this._framebuffer) {\r\n target._framebuffer = this._framebuffer;\r\n }\r\n if (this._depthStencilBuffer) {\r\n target._depthStencilBuffer = this._depthStencilBuffer;\r\n }\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n var cache = this._engine.getLoadedTexturesCache();\r\n var index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n var index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n };\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n InternalTexture.prototype.dispose = function () {\r\n if (!this._webGLTexture) {\r\n return;\r\n }\r\n this._references--;\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._webGLTexture = null;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__[\"_DevTools\"].WarnImport(\"environmentTextureTools\");\r\n };\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n InternalTexture.DATASOURCE_UNKNOWN = 0;\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n InternalTexture.DATASOURCE_URL = 1;\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n InternalTexture.DATASOURCE_TEMP = 2;\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n InternalTexture.DATASOURCE_RAW = 3;\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n InternalTexture.DATASOURCE_DYNAMIC = 4;\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n InternalTexture.DATASOURCE_RENDERTARGET = 5;\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n InternalTexture.DATASOURCE_MULTIRENDERTARGET = 6;\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n InternalTexture.DATASOURCE_CUBE = 7;\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n InternalTexture.DATASOURCE_CUBERAW = 8;\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n InternalTexture.DATASOURCE_CUBEPREFILTERED = 9;\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n InternalTexture.DATASOURCE_RAW3D = 10;\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n InternalTexture.DATASOURCE_DEPTHTEXTURE = 11;\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n InternalTexture.DATASOURCE_CUBERAW_RGBD = 12;\r\n return InternalTexture;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/mirrorTexture.ts\":\n/*!*********************************************!*\\\n !*** ./Materials/Textures/mirrorTexture.ts ***!\n \\*********************************************/\n/*! exports provided: MirrorTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return MirrorTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\nvar MirrorTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MirrorTexture, _super);\r\n /**\r\n * Instantiates a Mirror Texture.\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n * @param name\r\n * @param size\r\n * @param scene\r\n * @param generateMipMaps\r\n * @param type\r\n * @param samplingMode\r\n * @param generateDepthBuffer\r\n */\r\n function MirrorTexture(name, size, scene, generateMipMaps, type, samplingMode, generateDepthBuffer) {\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n if (generateDepthBuffer === void 0) { generateDepthBuffer = true; }\r\n var _this = _super.call(this, name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer) || this;\r\n _this.scene = scene;\r\n /**\r\n * Define the reflection plane we want to use. The mirrorPlane is usually set to the constructed reflector.\r\n * It is possible to directly set the mirrorPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the mirrorPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the reflector as stated in the doc.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\n _this.mirrorPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_6__[\"Plane\"](0, 1, 0, 1);\r\n _this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n _this._mirrorMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Zero();\r\n _this._adaptiveBlurKernel = 0;\r\n _this._blurKernelX = 0;\r\n _this._blurKernelY = 0;\r\n _this._blurRatio = 1.0;\r\n _this.ignoreCameraViewport = true;\r\n _this._updateGammaSpace();\r\n _this._imageProcessingConfigChangeObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._updateGammaSpace;\r\n });\r\n _this.onBeforeRenderObservable.add(function () {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].ReflectionToRef(_this.mirrorPlane, _this._mirrorMatrix);\r\n _this._savedViewMatrix = scene.getViewMatrix();\r\n _this._mirrorMatrix.multiplyToRef(_this._savedViewMatrix, _this._transformMatrix);\r\n scene.setTransformMatrix(_this._transformMatrix, scene.getProjectionMatrix());\r\n scene.clipPlane = _this.mirrorPlane;\r\n scene.getEngine().cullBackFaces = false;\r\n scene._mirroredCameraPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(scene.activeCamera.globalPosition, _this._mirrorMatrix);\r\n });\r\n _this.onAfterRenderObservable.add(function () {\r\n scene.setTransformMatrix(_this._savedViewMatrix, scene.getProjectionMatrix());\r\n scene.getEngine().cullBackFaces = true;\r\n scene._mirroredCameraPosition = null;\r\n scene.clipPlane = null;\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(MirrorTexture.prototype, \"blurRatio\", {\r\n get: function () {\r\n return this._blurRatio;\r\n },\r\n /**\r\n * Define the blur ratio used to blur the reflection if needed.\r\n */\r\n set: function (value) {\r\n if (this._blurRatio === value) {\r\n return;\r\n }\r\n this._blurRatio = value;\r\n this._preparePostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"adaptiveBlurKernel\", {\r\n /**\r\n * Define the adaptive blur kernel used to blur the reflection if needed.\r\n * This will autocompute the closest best match for the `blurKernel`\r\n */\r\n set: function (value) {\r\n this._adaptiveBlurKernel = value;\r\n this._autoComputeBlurKernel();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"blurKernel\", {\r\n /**\r\n * Define the blur kernel used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n set: function (value) {\r\n this.blurKernelX = value;\r\n this.blurKernelY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"blurKernelX\", {\r\n get: function () {\r\n return this._blurKernelX;\r\n },\r\n /**\r\n * Define the blur kernel on the X Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n set: function (value) {\r\n if (this._blurKernelX === value) {\r\n return;\r\n }\r\n this._blurKernelX = value;\r\n this._preparePostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MirrorTexture.prototype, \"blurKernelY\", {\r\n get: function () {\r\n return this._blurKernelY;\r\n },\r\n /**\r\n * Define the blur kernel on the Y Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n set: function (value) {\r\n if (this._blurKernelY === value) {\r\n return;\r\n }\r\n this._blurKernelY = value;\r\n this._preparePostProcesses();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n MirrorTexture.prototype._autoComputeBlurKernel = function () {\r\n var engine = this.getScene().getEngine();\r\n var dw = this.getRenderWidth() / engine.getRenderWidth();\r\n var dh = this.getRenderHeight() / engine.getRenderHeight();\r\n this.blurKernelX = this._adaptiveBlurKernel * dw;\r\n this.blurKernelY = this._adaptiveBlurKernel * dh;\r\n };\r\n MirrorTexture.prototype._onRatioRescale = function () {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n if (!this._adaptiveBlurKernel) {\r\n this._preparePostProcesses();\r\n }\r\n }\r\n if (this._adaptiveBlurKernel) {\r\n this._autoComputeBlurKernel();\r\n }\r\n };\r\n MirrorTexture.prototype._updateGammaSpace = function () {\r\n this.gammaSpace = !this.scene.imageProcessingConfiguration.isEnabled || !this.scene.imageProcessingConfiguration.applyByPostProcess;\r\n };\r\n MirrorTexture.prototype._preparePostProcesses = function () {\r\n this.clearPostProcesses(true);\r\n if (this._blurKernelX && this._blurKernelY) {\r\n var engine = this.getScene().getEngine();\r\n var textureType = engine.getCaps().textureFloatRender ? _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n this._blurX = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BlurPostProcess\"](\"horizontal blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1.0, 0), this._blurKernelX, this._blurRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, textureType);\r\n this._blurX.autoClear = false;\r\n if (this._blurRatio === 1 && this.samples < 2 && this._texture) {\r\n this._blurX.inputTexture = this._texture;\r\n }\r\n else {\r\n this._blurX.alwaysForcePOT = true;\r\n }\r\n this._blurY = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BlurPostProcess\"](\"vertical blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1.0), this._blurKernelY, this._blurRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, textureType);\r\n this._blurY.autoClear = false;\r\n this._blurY.alwaysForcePOT = this._blurRatio !== 1;\r\n this.addPostProcess(this._blurX);\r\n this.addPostProcess(this._blurY);\r\n }\r\n else {\r\n if (this._blurY) {\r\n this.removePostProcess(this._blurY);\r\n this._blurY.dispose();\r\n this._blurY = null;\r\n }\r\n if (this._blurX) {\r\n this.removePostProcess(this._blurX);\r\n this._blurX.dispose();\r\n this._blurX = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Clone the mirror texture.\r\n * @returns the cloned texture\r\n */\r\n MirrorTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new MirrorTexture(this.name, textureSize.width, scene, this._renderTargetOptions.generateMipMaps, this._renderTargetOptions.type, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Mirror Texture\r\n newTexture.mirrorPlane = this.mirrorPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n MirrorTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.mirrorPlane = this.mirrorPlane.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n MirrorTexture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver);\r\n };\r\n return MirrorTexture;\r\n}(_Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetTexture\"]));\r\n\r\n_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"]._CreateMirror = function (name, renderTargetSize, scene, generateMipMaps) {\r\n return new MirrorTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/multiRenderTarget.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Textures/multiRenderTarget.ts ***!\n \\*************************************************/\n/*! exports provided: MultiRenderTarget */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return MultiRenderTarget; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_multiRender__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Engines/Extensions/engine.multiRender */ \"./Engines/Extensions/engine.multiRender.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n */\r\nvar MultiRenderTarget = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiRenderTarget, _super);\r\n /**\r\n * Instantiate a new multi render target texture.\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the buffers to render to\r\n * @param count Define the number of target we are rendering into\r\n * @param scene Define the scene the texture belongs to\r\n * @param options Define the options used to create the multi render target\r\n */\r\n function MultiRenderTarget(name, size, count, scene, options) {\r\n var _this = this;\r\n var generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;\r\n var generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;\r\n var doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;\r\n _this = _super.call(this, name, size, scene, generateMipMaps, doNotChangeAspectRatio) || this;\r\n _this._engine = scene.getEngine();\r\n if (!_this.isSupported) {\r\n _this.dispose();\r\n return;\r\n }\r\n var types = [];\r\n var samplingModes = [];\r\n for (var i = 0; i < count; i++) {\r\n if (options && options.types && options.types[i] !== undefined) {\r\n types.push(options.types[i]);\r\n }\r\n else {\r\n types.push(options && options.defaultType ? options.defaultType : _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n }\r\n if (options && options.samplingModes && options.samplingModes[i] !== undefined) {\r\n samplingModes.push(options.samplingModes[i]);\r\n }\r\n else {\r\n samplingModes.push(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n }\r\n }\r\n var generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n var generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n _this._size = size;\r\n _this._multiRenderTargetOptions = {\r\n samplingModes: samplingModes,\r\n generateMipMaps: generateMipMaps,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer,\r\n generateDepthTexture: generateDepthTexture,\r\n types: types,\r\n textureCount: count\r\n };\r\n _this._createInternalTextures();\r\n _this._createTextures();\r\n return _this;\r\n }\r\n Object.defineProperty(MultiRenderTarget.prototype, \"isSupported\", {\r\n /**\r\n * Get if draw buffers are currently supported by the used hardware and browser.\r\n */\r\n get: function () {\r\n return this._engine.webGLVersion > 1 || this._engine.getCaps().drawBuffersExtension;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"textures\", {\r\n /**\r\n * Get the list of textures generated by the multi render target.\r\n */\r\n get: function () {\r\n return this._textures;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"depthTexture\", {\r\n /**\r\n * Get the depth texture generated by the multi render target if options.generateDepthTexture has been set\r\n */\r\n get: function () {\r\n return this._textures[this._textures.length - 1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"wrapU\", {\r\n /**\r\n * Set the wrapping mode on U of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n set: function (wrap) {\r\n if (this._textures) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapU = wrap;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiRenderTarget.prototype, \"wrapV\", {\r\n /**\r\n * Set the wrapping mode on V of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n set: function (wrap) {\r\n if (this._textures) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapV = wrap;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n MultiRenderTarget.prototype._rebuild = function () {\r\n this.releaseInternalTextures();\r\n this._createInternalTextures();\r\n for (var i = 0; i < this._internalTextures.length; i++) {\r\n var texture = this._textures[i];\r\n texture._texture = this._internalTextures[i];\r\n }\r\n // Keeps references to frame buffer and stencil/depth buffer\r\n this._texture = this._internalTextures[0];\r\n };\r\n MultiRenderTarget.prototype._createInternalTextures = function () {\r\n this._internalTextures = this._engine.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions);\r\n };\r\n MultiRenderTarget.prototype._createTextures = function () {\r\n this._textures = [];\r\n for (var i = 0; i < this._internalTextures.length; i++) {\r\n var texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](null, this.getScene());\r\n texture._texture = this._internalTextures[i];\r\n this._textures.push(texture);\r\n }\r\n // Keeps references to frame buffer and stencil/depth buffer\r\n this._texture = this._internalTextures[0];\r\n };\r\n Object.defineProperty(MultiRenderTarget.prototype, \"samples\", {\r\n /**\r\n * Define the number of samples used if MSAA is enabled.\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (value) {\r\n if (this._samples === value) {\r\n return;\r\n }\r\n this._samples = this._engine.updateMultipleRenderTargetTextureSampleCount(this._internalTextures, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resize all the textures in the multi render target.\r\n * Be carrefull as it will recreate all the data in the new texture.\r\n * @param size Define the new size\r\n */\r\n MultiRenderTarget.prototype.resize = function (size) {\r\n this.releaseInternalTextures();\r\n this._internalTextures = this._engine.createMultipleRenderTarget(size, this._multiRenderTargetOptions);\r\n this._createInternalTextures();\r\n };\r\n MultiRenderTarget.prototype.unbindFrameBuffer = function (engine, faceIndex) {\r\n var _this = this;\r\n engine.unBindMultiColorAttachmentFramebuffer(this._internalTextures, this.isCube, function () {\r\n _this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n };\r\n /**\r\n * Dispose the render targets and their associated resources\r\n */\r\n MultiRenderTarget.prototype.dispose = function () {\r\n this.releaseInternalTextures();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Release all the underlying texture used as draw buffers.\r\n */\r\n MultiRenderTarget.prototype.releaseInternalTextures = function () {\r\n if (!this._internalTextures) {\r\n return;\r\n }\r\n for (var i = this._internalTextures.length - 1; i >= 0; i--) {\r\n if (this._internalTextures[i] !== undefined) {\r\n this._internalTextures[i].dispose();\r\n this._internalTextures.splice(i, 1);\r\n }\r\n }\r\n };\r\n return MultiRenderTarget;\r\n}(_Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__[\"RenderTargetTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/rawCubeTexture.ts\":\n/*!**********************************************!*\\\n !*** ./Materials/Textures/rawCubeTexture.ts ***!\n \\**********************************************/\n/*! exports provided: RawCubeTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return RawCubeTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony import */ var _internalTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _cubeTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Raw cube texture where the raw buffers are passed in\r\n */\r\nvar RawCubeTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RawCubeTexture, _super);\r\n /**\r\n * Creates a cube texture where the raw buffers are passed in.\r\n * @param scene defines the scene the texture is attached to\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n */\r\n function RawCubeTexture(scene, data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (compression === void 0) { compression = null; }\r\n var _this = _super.call(this, \"\", scene) || this;\r\n _this._texture = scene.getEngine().createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression);\r\n return _this;\r\n }\r\n /**\r\n * Updates the raw cube texture.\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n RawCubeTexture.prototype.update = function (data, format, type, invertY, compression) {\r\n if (compression === void 0) { compression = null; }\r\n this._texture.getEngine().updateRawCubeTexture(this._texture, data, format, type, invertY, compression);\r\n };\r\n /**\r\n * Updates a raw cube texture with RGBD encoded data.\r\n * @param data defines the array of data [mipmap][face] to use to create each face\r\n * @param sphericalPolynomial defines the spherical polynomial for irradiance\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns a promsie that resolves when the operation is complete\r\n */\r\n RawCubeTexture.prototype.updateRGBDAsync = function (data, sphericalPolynomial, lodScale, lodOffset) {\r\n if (sphericalPolynomial === void 0) { sphericalPolynomial = null; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n return RawCubeTexture._UpdateRGBDAsync(this._texture, data, sphericalPolynomial, lodScale, lodOffset);\r\n };\r\n /**\r\n * Clones the raw cube texture.\r\n * @return a new cube texture\r\n */\r\n RawCubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () {\r\n var scene = _this.getScene();\r\n var internalTexture = _this._texture;\r\n var texture = new RawCubeTexture(scene, internalTexture._bufferViewArray, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);\r\n if (internalTexture.dataSource === _internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"].DATASOURCE_CUBERAW_RGBD) {\r\n texture.updateRGBDAsync(internalTexture._bufferViewArrayArray, internalTexture._sphericalPolynomial, internalTexture._lodGenerationScale, internalTexture._lodGenerationOffset);\r\n }\r\n return texture;\r\n }, this);\r\n };\r\n /** @hidden */\r\n RawCubeTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._dataSource = _internalTexture__WEBPACK_IMPORTED_MODULE_3__[\"InternalTexture\"].DATASOURCE_CUBERAW_RGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return _Misc_environmentTextureTools__WEBPACK_IMPORTED_MODULE_2__[\"EnvironmentTextureTools\"].UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n return RawCubeTexture;\r\n}(_cubeTexture__WEBPACK_IMPORTED_MODULE_4__[\"CubeTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/rawTexture.ts\":\n/*!******************************************!*\\\n !*** ./Materials/Textures/rawTexture.ts ***!\n \\******************************************/\n/*! exports provided: RawTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return RawTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nvar RawTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RawTexture, _super);\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param scene define the scene the texture belongs to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n */\r\n function RawTexture(data, width, height, \r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n format, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;\r\n _this.format = format;\r\n _this._engine = scene.getEngine();\r\n _this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);\r\n _this.wrapU = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n return _this;\r\n }\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n RawTexture.prototype.update = function (data) {\r\n this._engine.updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);\r\n };\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n RawTexture.CreateLuminanceTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_LUMINANCE, scene, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n RawTexture.CreateLuminanceAlphaTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_LUMINANCE_ALPHA, scene, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n RawTexture.CreateAlphaTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGB alpha texture\r\n */\r\n RawTexture.CreateRGBTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGBA texture\r\n */\r\n RawTexture.CreateRGBATexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param scene Define the scene the texture belongs to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n RawTexture.CreateRTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT; }\r\n return new RawTexture(data, width, height, _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_R, scene, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n return RawTexture;\r\n}(_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/rawTexture3D.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Textures/rawTexture3D.ts ***!\n \\********************************************/\n/*! exports provided: RawTexture3D */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return RawTexture3D; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_rawTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/Extensions/engine.rawTexture */ \"./Engines/Extensions/engine.rawTexture.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store 3D textures containing user data\r\n */\r\nvar RawTexture3D = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RawTexture3D, _super);\r\n /**\r\n * Create a new RawTexture3D\r\n * @param data defines the data of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the texture format to use\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)\r\n * @param invertY defines if texture must be stored with Y axis inverted\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n function RawTexture3D(data, width, height, depth, \r\n /** Gets or sets the texture format to use */\r\n format, scene, generateMipMaps, invertY, samplingMode, textureType) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;\r\n _this.format = format;\r\n _this._engine = scene.getEngine();\r\n _this._texture = scene.getEngine().createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, undefined, textureType);\r\n _this.is3D = true;\r\n return _this;\r\n }\r\n /**\r\n * Update the texture with new data\r\n * @param data defines the data to store in the texture\r\n */\r\n RawTexture3D.prototype.update = function (data) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._engine.updateRawTexture3D(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);\r\n };\r\n return RawTexture3D;\r\n}(_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/refractionTexture.ts\":\n/*!*************************************************!*\\\n !*** ./Materials/Textures/refractionTexture.ts ***!\n \\*************************************************/\n/*! exports provided: RefractionTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return RefractionTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.plane */ \"./Maths/math.plane.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n\r\n\r\n\r\n/**\r\n * Creates a refraction texture used by refraction channel of the standard material.\r\n * It is like a mirror but to see through a material.\r\n * @see https://doc.babylonjs.com/how_to/reflect#refraction\r\n */\r\nvar RefractionTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RefractionTexture, _super);\r\n /**\r\n * Creates a refraction texture used by refraction channel of the standard material.\r\n * It is like a mirror but to see through a material.\r\n * @see https://doc.babylonjs.com/how_to/reflect#refraction\r\n * @param name Define the texture name\r\n * @param size Define the size of the underlying texture\r\n * @param scene Define the scene the refraction belongs to\r\n * @param generateMipMaps Define if we need to generate mips level for the refraction\r\n */\r\n function RefractionTexture(name, size, scene, generateMipMaps) {\r\n var _this = _super.call(this, name, size, scene, generateMipMaps, true) || this;\r\n /**\r\n * Define the reflection plane we want to use. The refractionPlane is usually set to the constructed refractor.\r\n * It is possible to directly set the refractionPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the refractionPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the refractor as stated in the doc.\r\n * @see https://doc.babylonjs.com/how_to/reflect#refraction\r\n */\r\n _this.refractionPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"](0, 1, 0, 1);\r\n /**\r\n * Define how deep under the surface we should see.\r\n */\r\n _this.depth = 2.0;\r\n _this.onBeforeRenderObservable.add(function () {\r\n scene.clipPlane = _this.refractionPlane;\r\n });\r\n _this.onAfterRenderObservable.add(function () {\r\n scene.clipPlane = null;\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Clone the refraction texture.\r\n * @returns the cloned texture\r\n */\r\n RefractionTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new RefractionTexture(this.name, textureSize.width, scene, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Refraction Texture\r\n newTexture.refractionPlane = this.refractionPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n newTexture.depth = this.depth;\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n RefractionTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.mirrorPlane = this.refractionPlane.asArray();\r\n serializationObject.depth = this.depth;\r\n return serializationObject;\r\n };\r\n return RefractionTexture;\r\n}(_Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__[\"RenderTargetTexture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/renderTargetCreationOptions.ts\":\n/*!***********************************************************!*\\\n !*** ./Materials/Textures/renderTargetCreationOptions.ts ***!\n \\***********************************************************/\n/*! exports provided: RenderTargetCreationOptions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetCreationOptions\", function() { return RenderTargetCreationOptions; });\n/**\r\n * Define options used to create a render target texture\r\n */\r\nvar RenderTargetCreationOptions = /** @class */ (function () {\r\n function RenderTargetCreationOptions() {\r\n }\r\n return RenderTargetCreationOptions;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/renderTargetTexture.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/Textures/renderTargetTexture.ts ***!\n \\***************************************************/\n/*! exports provided: RenderTargetTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return RenderTargetTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../PostProcesses/postProcessManager */ \"./PostProcesses/postProcessManager.ts\");\n/* harmony import */ var _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Rendering/renderingManager */ \"./Rendering/renderingManager.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_Extensions_engine_renderTarget__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Engines/Extensions/engine.renderTarget */ \"./Engines/Extensions/engine.renderTarget.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This Helps creating a texture that will be created from a camera in your scene.\r\n * It is basically a dynamic texture that could be used to create special effects for instance.\r\n * Actually, It is the base of lot of effects in the framework like post process, shadows, effect layers and rendering pipelines...\r\n */\r\nvar RenderTargetTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RenderTargetTexture, _super);\r\n /**\r\n * Instantiate a render target texture. This is mainly used to render of screen the scene to for instance apply post processse\r\n * or used a shadow, depth texture...\r\n * @param name The friendly name of the texture\r\n * @param size The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)\r\n * @param scene The scene the RTT belongs to. The latest created scene will be used if not precised.\r\n * @param generateMipMaps True if mip maps need to be generated after render.\r\n * @param doNotChangeAspectRatio True to not change the aspect ratio of the scene in the RTT\r\n * @param type The type of the buffer in the RTT (int, half float, float...)\r\n * @param isCube True if a cube texture needs to be created\r\n * @param samplingMode The sampling mode to be usedwith the render target (Linear, Nearest...)\r\n * @param generateDepthBuffer True to generate a depth buffer\r\n * @param generateStencilBuffer True to generate a stencil buffer\r\n * @param isMulti True if multiple textures need to be created (Draw Buffers)\r\n * @param format The internal format of the buffer in the RTT (RED, RG, RGB, RGBA, ALPHA...)\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function RenderTargetTexture(name, size, scene, generateMipMaps, doNotChangeAspectRatio, type, isCube, samplingMode, generateDepthBuffer, generateStencilBuffer, isMulti, format, delayAllocation) {\r\n if (doNotChangeAspectRatio === void 0) { doNotChangeAspectRatio = true; }\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (isCube === void 0) { isCube = false; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (generateDepthBuffer === void 0) { generateDepthBuffer = true; }\r\n if (generateStencilBuffer === void 0) { generateStencilBuffer = false; }\r\n if (isMulti === void 0) { isMulti = false; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps) || this;\r\n _this.isCube = isCube;\r\n /**\r\n * Define if particles should be rendered in your texture.\r\n */\r\n _this.renderParticles = true;\r\n /**\r\n * Define if sprites should be rendered in your texture.\r\n */\r\n _this.renderSprites = false;\r\n /**\r\n * Override the default coordinates mode to projection for RTT as it is the most common case for rendered textures.\r\n */\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].PROJECTION_MODE;\r\n /**\r\n * Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.\r\n */\r\n _this.ignoreCameraViewport = false;\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onBeforeBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onAfterUnbindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering the texture\r\n */\r\n _this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the texture\r\n */\r\n _this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered after the texture clear\r\n */\r\n _this.onClearObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the texture is resized.\r\n */\r\n _this.onResizeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n _this._currentRefreshId = -1;\r\n _this._refreshRate = 1;\r\n _this._samples = 1;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the texture (when in cube mode)\r\n * It must define where the camera used to render the texture is set\r\n */\r\n _this.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n scene = _this.getScene();\r\n if (!scene) {\r\n return _this;\r\n }\r\n _this.renderList = new Array();\r\n _this._engine = scene.getEngine();\r\n _this.name = name;\r\n _this.isRenderTarget = true;\r\n _this._initialSizeParameter = size;\r\n _this._processSizeParameter(size);\r\n _this._resizeObserver = _this.getScene().getEngine().onResizeObservable.add(function () {\r\n });\r\n _this._generateMipMaps = generateMipMaps ? true : false;\r\n _this._doNotChangeAspectRatio = doNotChangeAspectRatio;\r\n // Rendering groups\r\n _this._renderingManager = new _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_6__[\"RenderingManager\"](scene);\r\n _this._renderingManager._useSceneAutoClearSetup = true;\r\n if (isMulti) {\r\n return _this;\r\n }\r\n _this._renderTargetOptions = {\r\n generateMipMaps: generateMipMaps,\r\n type: type,\r\n format: format,\r\n samplingMode: samplingMode,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer\r\n };\r\n if (samplingMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].NEAREST_SAMPLINGMODE) {\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n }\r\n if (!delayAllocation) {\r\n if (isCube) {\r\n _this._texture = scene.getEngine().createRenderTargetCubeTexture(_this.getRenderSize(), _this._renderTargetOptions);\r\n _this.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].INVCUBIC_MODE;\r\n _this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n }\r\n else {\r\n _this._texture = scene.getEngine().createRenderTargetTexture(_this._size, _this._renderTargetOptions);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderList\", {\r\n /**\r\n * Use this list to define the list of mesh you want to render.\r\n */\r\n get: function () {\r\n return this._renderList;\r\n },\r\n set: function (value) {\r\n this._renderList = value;\r\n if (this._renderList) {\r\n this._hookArray(this._renderList);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var wasEmpty = array.length === 0;\r\n var result = oldPush.apply(array, items);\r\n if (wasEmpty) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n if (array.length === 0) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return deleted;\r\n };\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterUnbind\", {\r\n /**\r\n * Set a after unbind callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterUnbindObserver) {\r\n this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n }\r\n this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onBeforeRender\", {\r\n /**\r\n * Set a before render callback in the texture.\r\n * This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterRender\", {\r\n /**\r\n * Set a after render callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onClear\", {\r\n /**\r\n * Set a clear callback in the texture.\r\n * This has been kept for backward compatibility and use of onClearObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onClearObserver) {\r\n this.onClearObservable.remove(this._onClearObserver);\r\n }\r\n this._onClearObserver = this.onClearObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderTargetOptions\", {\r\n /**\r\n * Gets render target creation options that were used.\r\n */\r\n get: function () {\r\n return this._renderTargetOptions;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._onRatioRescale = function () {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"boundingBoxSize\", {\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the texture (when in cube mode)\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param comparisonFunction Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode\r\n * @param bilinearFiltering Specifies whether or not bilinear filtering is enable on the texture\r\n * @param generateStencil Specifies whether or not a stencil should be allocated in the texture\r\n */\r\n RenderTargetTexture.prototype.createDepthStencilTexture = function (comparisonFunction, bilinearFiltering, generateStencil) {\r\n if (comparisonFunction === void 0) { comparisonFunction = 0; }\r\n if (bilinearFiltering === void 0) { bilinearFiltering = true; }\r\n if (generateStencil === void 0) { generateStencil = false; }\r\n if (!this.getScene()) {\r\n return;\r\n }\r\n var engine = this.getScene().getEngine();\r\n this.depthStencilTexture = engine.createDepthStencilTexture(this._size, {\r\n bilinearFiltering: bilinearFiltering,\r\n comparisonFunction: comparisonFunction,\r\n generateStencil: generateStencil,\r\n isCube: this.isCube\r\n });\r\n engine.setFrameBufferDepthStencilTexture(this);\r\n };\r\n RenderTargetTexture.prototype._processSizeParameter = function (size) {\r\n if (size.ratio) {\r\n this._sizeRatio = size.ratio;\r\n this._size = {\r\n width: this._bestReflectionRenderTargetDimension(this._engine.getRenderWidth(), this._sizeRatio),\r\n height: this._bestReflectionRenderTargetDimension(this._engine.getRenderHeight(), this._sizeRatio)\r\n };\r\n }\r\n else {\r\n this._size = size;\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"samples\", {\r\n /**\r\n * Define the number of samples to use in case of MSAA.\r\n * It defaults to one meaning no MSAA has been enabled.\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (value) {\r\n if (this._samples === value) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._samples = scene.getEngine().updateRenderTargetTextureSampleCount(this._texture, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the refresh counter of the texture and start bak from scratch.\r\n * Could be useful to regenerate the texture if it is setup to render only once.\r\n */\r\n RenderTargetTexture.prototype.resetRefreshCounter = function () {\r\n this._currentRefreshId = -1;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"refreshRate\", {\r\n /**\r\n * Define the refresh rate of the texture or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n get: function () {\r\n return this._refreshRate;\r\n },\r\n set: function (value) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a post process to the render target rendering passes.\r\n * @param postProcess define the post process to add\r\n */\r\n RenderTargetTexture.prototype.addPostProcess = function (postProcess) {\r\n if (!this._postProcessManager) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._postProcessManager = new _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessManager\"](scene);\r\n this._postProcesses = new Array();\r\n }\r\n this._postProcesses.push(postProcess);\r\n this._postProcesses[0].autoClear = false;\r\n };\r\n /**\r\n * Clear all the post processes attached to the render target\r\n * @param dispose define if the cleared post processesshould also be disposed (false by default)\r\n */\r\n RenderTargetTexture.prototype.clearPostProcesses = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n if (dispose) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var postProcess = _a[_i];\r\n postProcess.dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n };\r\n /**\r\n * Remove one of the post process from the list of attached post processes to the texture\r\n * @param postProcess define the post process to remove from the list\r\n */\r\n RenderTargetTexture.prototype.removePostProcess = function (postProcess) {\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n var index = this._postProcesses.indexOf(postProcess);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._postProcesses.splice(index, 1);\r\n if (this._postProcesses.length > 0) {\r\n this._postProcesses[0].autoClear = false;\r\n }\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._shouldRender = function () {\r\n if (this._currentRefreshId === -1) { // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n this._currentRefreshId++;\r\n return false;\r\n };\r\n /**\r\n * Gets the actual render size of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderSize = function () {\r\n return this.getRenderWidth();\r\n };\r\n /**\r\n * Gets the actual render width of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderWidth = function () {\r\n if (this._size.width) {\r\n return this._size.width;\r\n }\r\n return this._size;\r\n };\r\n /**\r\n * Gets the actual render height of the texture.\r\n * @returns the height of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderHeight = function () {\r\n if (this._size.width) {\r\n return this._size.height;\r\n }\r\n return this._size;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can be rescaled or not.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resize the texture using a ratio.\r\n * @param ratio the ratio to apply to the texture size in order to compute the new target size\r\n */\r\n RenderTargetTexture.prototype.scale = function (ratio) {\r\n var newSize = this.getRenderSize() * ratio;\r\n this.resize(newSize);\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n RenderTargetTexture.prototype.getReflectionTextureMatrix = function () {\r\n if (this.isCube) {\r\n return this._textureMatrix;\r\n }\r\n return _super.prototype.getReflectionTextureMatrix.call(this);\r\n };\r\n /**\r\n * Resize the texture to a new desired size.\r\n * Be carrefull as it will recreate all the data in the new texture.\r\n * @param size Define the new size. It can be:\r\n * - a number for squared texture,\r\n * - an object containing { width: number, height: number }\r\n * - or an object containing a ratio { ratio: number }\r\n */\r\n RenderTargetTexture.prototype.resize = function (size) {\r\n var wasCube = this.isCube;\r\n this.releaseInternalTexture();\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._processSizeParameter(size);\r\n if (wasCube) {\r\n this._texture = scene.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions);\r\n }\r\n else {\r\n this._texture = scene.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions);\r\n }\r\n if (this.onResizeObservable.hasObservers()) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Renders all the objects from the render list into the texture.\r\n * @param useCameraPostProcess Define if camera post processes should be used during the rendering\r\n * @param dumpForDebug Define if the rendering result should be dumped (copied) for debugging purpose\r\n */\r\n RenderTargetTexture.prototype.render = function (useCameraPostProcess, dumpForDebug) {\r\n if (useCameraPostProcess === void 0) { useCameraPostProcess = false; }\r\n if (dumpForDebug === void 0) { dumpForDebug = false; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this.useCameraPostProcesses !== undefined) {\r\n useCameraPostProcess = this.useCameraPostProcesses;\r\n }\r\n if (this._waitingRenderList) {\r\n this.renderList = [];\r\n for (var index = 0; index < this._waitingRenderList.length; index++) {\r\n var id = this._waitingRenderList[index];\r\n var mesh_1 = scene.getMeshByID(id);\r\n if (mesh_1) {\r\n this.renderList.push(mesh_1);\r\n }\r\n }\r\n delete this._waitingRenderList;\r\n }\r\n // Is predicate defined?\r\n if (this.renderListPredicate) {\r\n if (this.renderList) {\r\n this.renderList.length = 0; // Clear previous renderList\r\n }\r\n else {\r\n this.renderList = [];\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var sceneMeshes = scene.meshes;\r\n for (var index = 0; index < sceneMeshes.length; index++) {\r\n var mesh = sceneMeshes[index];\r\n if (this.renderListPredicate(mesh)) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n this.onBeforeBindObservable.notifyObservers(this);\r\n // Set custom projection.\r\n // Needs to be before binding to prevent changing the aspect ratio.\r\n var camera;\r\n if (this.activeCamera) {\r\n camera = this.activeCamera;\r\n engine.setViewport(this.activeCamera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n if (this.activeCamera !== scene.activeCamera) {\r\n scene.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true));\r\n }\r\n }\r\n else {\r\n camera = scene.activeCamera;\r\n if (camera) {\r\n engine.setViewport(camera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n }\r\n }\r\n // Prepare renderingManager\r\n this._renderingManager.reset();\r\n var currentRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;\r\n var currentRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;\r\n var sceneRenderId = scene.getRenderId();\r\n for (var meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {\r\n var mesh = currentRenderList[meshIndex];\r\n if (mesh) {\r\n if (!mesh.isReady(this.refreshRate === 0)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n mesh._preActivateForIntermediateRendering(sceneRenderId);\r\n var isMasked = void 0;\r\n if (!this.renderList && camera) {\r\n isMasked = ((mesh.layerMask & camera.layerMask) === 0);\r\n }\r\n else {\r\n isMasked = false;\r\n }\r\n if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {\r\n if (mesh._activate(sceneRenderId, true)) {\r\n if (!mesh.isAnInstance) {\r\n mesh._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;\r\n }\r\n else {\r\n mesh = mesh.sourceMesh;\r\n }\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = true;\r\n for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n var subMesh = mesh.subMeshes[subIndex];\r\n scene._activeIndices.addCount(subMesh.indexCount, false);\r\n this._renderingManager.dispatch(subMesh, mesh);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n for (var particleIndex = 0; particleIndex < scene.particleSystems.length; particleIndex++) {\r\n var particleSystem = scene.particleSystems[particleIndex];\r\n var emitter = particleSystem.emitter;\r\n if (!particleSystem.isStarted() || !emitter || !emitter.position || !emitter.isEnabled()) {\r\n continue;\r\n }\r\n if (currentRenderList.indexOf(emitter) >= 0) {\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n if (this.isCube) {\r\n for (var face = 0; face < 6; face++) {\r\n this.renderToTarget(face, currentRenderList, useCameraPostProcess, dumpForDebug);\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n else {\r\n this.renderToTarget(0, currentRenderList, useCameraPostProcess, dumpForDebug);\r\n }\r\n this.onAfterUnbindObservable.notifyObservers(this);\r\n if (scene.activeCamera) {\r\n // Do not avoid setting uniforms when multiple scenes are active as another camera may have overwrite these\r\n if (scene.getEngine().scenes.length > 1 || (this.activeCamera && this.activeCamera !== scene.activeCamera)) {\r\n scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));\r\n }\r\n engine.setViewport(scene.activeCamera.viewport);\r\n }\r\n scene.resetCachedMaterial();\r\n };\r\n RenderTargetTexture.prototype._bestReflectionRenderTargetDimension = function (renderDimension, scale) {\r\n var minimum = 128;\r\n var x = renderDimension * scale;\r\n var curved = _Engines_engine__WEBPACK_IMPORTED_MODULE_9__[\"Engine\"].NearestPOT(x + (minimum * minimum / (minimum + x)));\r\n // Ensure we don't exceed the render dimension (while staying POT)\r\n return Math.min(_Engines_engine__WEBPACK_IMPORTED_MODULE_9__[\"Engine\"].FloorPOT(renderDimension), curved);\r\n };\r\n /**\r\n * @hidden\r\n * @param faceIndex face index to bind to if this is a cubetexture\r\n */\r\n RenderTargetTexture.prototype._bindFrameBuffer = function (faceIndex) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this._texture) {\r\n engine.bindFramebuffer(this._texture, this.isCube ? faceIndex : undefined, undefined, undefined, this.ignoreCameraViewport, this.depthStencilTexture ? this.depthStencilTexture : undefined);\r\n }\r\n };\r\n RenderTargetTexture.prototype.unbindFrameBuffer = function (engine, faceIndex) {\r\n var _this = this;\r\n if (!this._texture) {\r\n return;\r\n }\r\n engine.unBindFramebuffer(this._texture, this.isCube, function () {\r\n _this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n };\r\n RenderTargetTexture.prototype.renderToTarget = function (faceIndex, currentRenderList, useCameraPostProcess, dumpForDebug) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (!this._texture) {\r\n return;\r\n }\r\n // Bind\r\n if (this._postProcessManager) {\r\n this._postProcessManager._prepareFrame(this._texture, this._postProcesses);\r\n }\r\n else if (!useCameraPostProcess || !scene.postProcessManager._prepareFrame(this._texture)) {\r\n this._bindFrameBuffer(faceIndex);\r\n }\r\n this.onBeforeRenderObservable.notifyObservers(faceIndex);\r\n // Clear\r\n if (this.onClearObservable.hasObservers()) {\r\n this.onClearObservable.notifyObservers(engine);\r\n }\r\n else {\r\n engine.clear(this.clearColor || scene.clearColor, true, true, true);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Before Camera Draw\r\n for (var _i = 0, _a = scene._beforeRenderTargetDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this);\r\n }\r\n // Render\r\n this._renderingManager.render(this.customRenderFunction, currentRenderList, this.renderParticles, this.renderSprites);\r\n // After Camera Draw\r\n for (var _b = 0, _c = scene._afterRenderTargetDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this);\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._finalizeFrame(false, this._texture, faceIndex, this._postProcesses, this.ignoreCameraViewport);\r\n }\r\n else if (useCameraPostProcess) {\r\n scene.postProcessManager._finalizeFrame(false, this._texture, faceIndex);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Dump ?\r\n if (dumpForDebug) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), engine);\r\n }\r\n // Unbind\r\n if (!this.isCube || faceIndex === 5) {\r\n if (this.isCube) {\r\n if (faceIndex === 5) {\r\n engine.generateMipMapsForCubemap(this._texture);\r\n }\r\n }\r\n this.unbindFrameBuffer(engine, faceIndex);\r\n }\r\n else {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n }\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderTargetTexture.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n */\r\n RenderTargetTexture.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);\r\n this._renderingManager._useSceneAutoClearSetup = false;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n RenderTargetTexture.prototype.clone = function () {\r\n var textureSize = this.getSize();\r\n var newTexture = new RenderTargetTexture(this.name, textureSize, this.getScene(), this._renderTargetOptions.generateMipMaps, this._doNotChangeAspectRatio, this._renderTargetOptions.type, this.isCube, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer, this._renderTargetOptions.generateStencilBuffer);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // RenderTarget Texture\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n RenderTargetTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.renderTargetSize = this.getRenderSize();\r\n serializationObject.renderList = [];\r\n if (this.renderList) {\r\n for (var index = 0; index < this.renderList.length; index++) {\r\n serializationObject.renderList.push(this.renderList[index].id);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore\r\n */\r\n RenderTargetTexture.prototype.disposeFramebufferObjects = function () {\r\n var objBuffer = this.getInternalTexture();\r\n var scene = this.getScene();\r\n if (objBuffer && scene) {\r\n scene.getEngine()._releaseFramebufferObjects(objBuffer);\r\n }\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n RenderTargetTexture.prototype.dispose = function () {\r\n this.onResizeObservable.clear();\r\n this.onClearObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onAfterUnbindObservable.clear();\r\n this.onBeforeBindObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n if (this._postProcessManager) {\r\n this._postProcessManager.dispose();\r\n this._postProcessManager = null;\r\n }\r\n this.clearPostProcesses(true);\r\n if (this._resizeObserver) {\r\n this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver);\r\n this._resizeObserver = null;\r\n }\r\n this.renderList = null;\r\n // Remove from custom render targets\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var index = scene.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n scene.customRenderTargets.splice(index, 1);\r\n }\r\n for (var _i = 0, _a = scene.cameras; _i < _a.length; _i++) {\r\n var camera = _a[_i];\r\n index = camera.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n camera.customRenderTargets.splice(index, 1);\r\n }\r\n }\r\n if (this.depthStencilTexture) {\r\n this.getScene().getEngine()._releaseTexture(this.depthStencilTexture);\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._rebuild = function () {\r\n if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._rebuild();\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention point in material dispose.\r\n */\r\n RenderTargetTexture.prototype.freeRenderingGroups = function () {\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n };\r\n /**\r\n * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)\r\n * @returns the view count\r\n */\r\n RenderTargetTexture.prototype.getViewCount = function () {\r\n return 1;\r\n };\r\n /**\r\n * The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONCE = 0;\r\n /**\r\n * The texture will only be rendered rendered every frame and is recomended for dynamic contents.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME = 1;\r\n /**\r\n * The texture will be rendered every 2 frames which could be enough if your dynamic objects are not\r\n * the central point of your effect and can save a lot of performances.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;\r\n return RenderTargetTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"]));\r\n\r\n_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"]._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n return new RenderTargetTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/texture.ts\":\n/*!***************************************!*\\\n !*** ./Materials/Textures/texture.ts ***!\n \\***************************************/\n/*! exports provided: Texture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return Texture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Misc_timingTools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Misc/timingTools */ \"./Misc/timingTools.ts\");\n/* harmony import */ var _Misc_instantiationTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Misc/instantiationTools */ \"./Misc/instantiationTools.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see http://doc.babylonjs.com/babylon101/materials#texture\r\n */\r\nvar Texture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Texture, _super);\r\n /**\r\n * Instantiates a new texture.\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see http://doc.babylonjs.com/babylon101/materials#texture\r\n * @param url define the url of the picture to load as a texture\r\n * @param scene define the scene or engine the texture will belong to\r\n * @param noMipmap define if the texture will require mip maps or not\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n */\r\n function Texture(url, sceneOrEngine, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n var _this = _super.call(this, (sceneOrEngine && sceneOrEngine.getClassName() === \"Scene\") ? sceneOrEngine : null) || this;\r\n /**\r\n * Define the url of the texture.\r\n */\r\n _this.url = null;\r\n /**\r\n * Define an offset on the texture to offset the u coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.uOffset = 0;\r\n /**\r\n * Define an offset on the texture to offset the v coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.vOffset = 0;\r\n /**\r\n * Define an offset on the texture to scale the u coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.uScale = 1.0;\r\n /**\r\n * Define an offset on the texture to scale the v coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.vScale = 1.0;\r\n /**\r\n * Define an offset on the texture to rotate around the u coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.uAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the v coordinates of the UVs\r\n * @see http://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.vAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)\r\n * @see http://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.wAng = 0;\r\n /**\r\n * Defines the center of rotation (U)\r\n */\r\n _this.uRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (V)\r\n */\r\n _this.vRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (W)\r\n */\r\n _this.wRotationCenter = 0.5;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility\r\n */\r\n _this.inspectableCustomProperties = null;\r\n _this._noMipmap = false;\r\n /** @hidden */\r\n _this._invertY = false;\r\n _this._rowGenerationMatrix = null;\r\n _this._cachedTextureMatrix = null;\r\n _this._projectionModeMatrix = null;\r\n _this._t0 = null;\r\n _this._t1 = null;\r\n _this._t2 = null;\r\n _this._cachedUOffset = -1;\r\n _this._cachedVOffset = -1;\r\n _this._cachedUScale = 0;\r\n _this._cachedVScale = 0;\r\n _this._cachedUAng = -1;\r\n _this._cachedVAng = -1;\r\n _this._cachedWAng = -1;\r\n _this._cachedProjectionMatrixId = -1;\r\n _this._cachedCoordinatesMode = -1;\r\n /** @hidden */\r\n _this._initialSamplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n /** @hidden */\r\n _this._buffer = null;\r\n _this._deleteBuffer = false;\r\n _this._format = null;\r\n _this._delayedOnLoad = null;\r\n _this._delayedOnError = null;\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n _this.onLoadObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._isBlocking = true;\r\n _this.name = url || \"\";\r\n _this.url = url;\r\n _this._noMipmap = noMipmap;\r\n _this._invertY = invertY;\r\n _this._initialSamplingMode = samplingMode;\r\n _this._buffer = buffer;\r\n _this._deleteBuffer = deleteBuffer;\r\n if (format) {\r\n _this._format = format;\r\n }\r\n var scene = _this.getScene();\r\n var engine = (sceneOrEngine && sceneOrEngine.getCaps) ? sceneOrEngine : (scene ? scene.getEngine() : null);\r\n if (!engine) {\r\n return _this;\r\n }\r\n engine.onBeforeTextureInitObservable.notifyObservers(_this);\r\n var load = function () {\r\n if (_this._texture) {\r\n if (_this._texture._invertVScale) {\r\n _this.vScale *= -1;\r\n _this.vOffset += 1;\r\n }\r\n // Update texutre to match internal texture's wrapping\r\n if (_this._texture._cachedWrapU !== null) {\r\n _this.wrapU = _this._texture._cachedWrapU;\r\n _this._texture._cachedWrapU = null;\r\n }\r\n if (_this._texture._cachedWrapV !== null) {\r\n _this.wrapV = _this._texture._cachedWrapV;\r\n _this._texture._cachedWrapV = null;\r\n }\r\n if (_this._texture._cachedWrapR !== null) {\r\n _this.wrapR = _this._texture._cachedWrapR;\r\n _this._texture._cachedWrapR = null;\r\n }\r\n }\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n if (!_this.isBlocking && scene) {\r\n scene.resetCachedMaterial();\r\n }\r\n };\r\n if (!_this.url) {\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n return _this;\r\n }\r\n _this._texture = _this._getFromCache(_this.url, noMipmap, samplingMode, invertY);\r\n if (!_this._texture) {\r\n if (!scene || !scene.useDelayedTextureLoading) {\r\n _this._texture = engine.createTexture(_this.url, noMipmap, invertY, scene, samplingMode, load, onError, _this._buffer, undefined, _this._format);\r\n if (deleteBuffer) {\r\n delete _this._buffer;\r\n }\r\n }\r\n else {\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n }\r\n }\r\n else {\r\n if (_this._texture.isReady) {\r\n _Misc_timingTools__WEBPACK_IMPORTED_MODULE_8__[\"TimingTools\"].SetImmediate(function () { return load(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(load);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Texture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"isBlocking\", {\r\n get: function () {\r\n return this._isBlocking;\r\n },\r\n /**\r\n * Is the texture preventing material to render while loading.\r\n * If false, a default texture will be used instead of the loading one during the preparation step.\r\n */\r\n set: function (value) {\r\n this._isBlocking = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"samplingMode\", {\r\n /**\r\n * Get the current sampling mode associated with the texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._initialSamplingMode;\r\n }\r\n return this._texture.samplingMode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"invertY\", {\r\n /**\r\n * Gets a boolean indicating if the texture needs to be inverted on the y axis during loading\r\n */\r\n get: function () {\r\n return this._invertY;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param buffer the buffer of the texture (defaults to null)\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n */\r\n Texture.prototype.updateURL = function (url, buffer, onLoad) {\r\n if (buffer === void 0) { buffer = null; }\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene().markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n }\r\n this.name = url;\r\n this.url = url;\r\n this._buffer = buffer;\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad();\r\n };\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @hidden\r\n */\r\n Texture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY);\r\n if (!this._texture) {\r\n this._texture = scene.getEngine().createTexture(this.url, this._noMipmap, this._invertY, scene, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format);\r\n if (this._deleteBuffer) {\r\n delete this._buffer;\r\n }\r\n }\r\n else {\r\n if (this._delayedOnLoad) {\r\n if (this._texture.isReady) {\r\n _Misc_timingTools__WEBPACK_IMPORTED_MODULE_8__[\"TimingTools\"].SetImmediate(this._delayedOnLoad);\r\n }\r\n else {\r\n this._texture.onLoadedObservable.add(this._delayedOnLoad);\r\n }\r\n }\r\n }\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {\r\n x *= this.uScale;\r\n y *= this.vScale;\r\n x -= this.uRotationCenter * this.uScale;\r\n y -= this.vRotationCenter * this.vScale;\r\n z -= this.wRotationCenter;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix, t);\r\n t.x += this.uRotationCenter * this.uScale + this.uOffset;\r\n t.y += this.vRotationCenter * this.vScale + this.vOffset;\r\n t.z += this.wRotationCenter;\r\n };\r\n /**\r\n * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.\r\n * @returns the transform matrix of the texture.\r\n */\r\n Texture.prototype.getTextureMatrix = function () {\r\n var _this = this;\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.uAng === this._cachedUAng &&\r\n this.vAng === this._cachedVAng &&\r\n this.wAng === this._cachedWAng) {\r\n return this._cachedTextureMatrix;\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale;\r\n this._cachedVScale = this.vScale;\r\n this._cachedUAng = this.uAng;\r\n this._cachedVAng = this.vAng;\r\n this._cachedWAng = this.wAng;\r\n if (!this._cachedTextureMatrix) {\r\n this._cachedTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n this._rowGenerationMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n this._t0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._t1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._t2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix);\r\n this._prepareRowForTextureGeneration(0, 0, 0, this._t0);\r\n this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1);\r\n this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2);\r\n this._t1.subtractInPlace(this._t0);\r\n this._t2.subtractInPlace(this._t0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValuesToRef(this._t1.x, this._t1.y, this._t1.z, 0.0, this._t2.x, this._t2.y, this._t2.z, 0.0, this._t0.x, this._t0.y, this._t0.z, 0.0, 0.0, 0.0, 0.0, 1.0, this._cachedTextureMatrix);\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) {\r\n return mat.hasTexture(_this);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.\r\n * @returns The reflection texture transform\r\n */\r\n Texture.prototype.getReflectionTextureMatrix = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.coordinatesMode === this._cachedCoordinatesMode) {\r\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\r\n if (this._cachedProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n else {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n if (!this._cachedTextureMatrix) {\r\n this._cachedTextureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n }\r\n if (!this._projectionModeMatrix) {\r\n this._projectionModeMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale;\r\n this._cachedVScale = this.vScale;\r\n this._cachedCoordinatesMode = this.coordinatesMode;\r\n switch (this.coordinatesMode) {\r\n case Texture.PLANAR_MODE:\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].IdentityToRef(this._cachedTextureMatrix);\r\n this._cachedTextureMatrix[0] = this.uScale;\r\n this._cachedTextureMatrix[5] = this.vScale;\r\n this._cachedTextureMatrix[12] = this.uOffset;\r\n this._cachedTextureMatrix[13] = this.vOffset;\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValuesToRef(0.5, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 1.0, this._projectionModeMatrix);\r\n var projectionMatrix = scene.getProjectionMatrix();\r\n this._cachedProjectionMatrixId = projectionMatrix.updateFlag;\r\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix);\r\n break;\r\n default:\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].IdentityToRef(this._cachedTextureMatrix);\r\n break;\r\n }\r\n scene.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].MATERIAL_TextureDirtyFlag, function (mat) {\r\n return (mat.getActiveTextures().indexOf(_this) !== -1);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n Texture.prototype.clone = function () {\r\n var _this = this;\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () {\r\n return new Texture(_this._texture ? _this._texture.url : null, _this.getScene(), _this._noMipmap, _this._invertY, _this.samplingMode, undefined, undefined, _this._texture ? _this._texture._buffer : undefined);\r\n }, this);\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n Texture.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (!serializationObject) {\r\n return null;\r\n }\r\n if (typeof this._buffer === \"string\" && this._buffer.substr(0, 5) === \"data:\") {\r\n serializationObject.base64String = this._buffer;\r\n serializationObject.name = serializationObject.name.replace(\"data:\", \"\");\r\n }\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n return serializationObject;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"Texture\"\r\n */\r\n Texture.prototype.getClassName = function () {\r\n return \"Texture\";\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n Texture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onLoadObservable.clear();\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n /**\r\n * Parse the JSON representation of a texture in order to recreate the texture in the given scene.\r\n * @param parsedTexture Define the JSON representation of the texture\r\n * @param scene Define the scene the parsed texture should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed texture if successful\r\n */\r\n Texture.Parse = function (parsedTexture, scene, rootUrl) {\r\n if (parsedTexture.customType) {\r\n var customTexture = _Misc_instantiationTools__WEBPACK_IMPORTED_MODULE_9__[\"InstantiationTools\"].Instantiate(parsedTexture.customType);\r\n // Update Sampling Mode\r\n var parsedCustomTexture = customTexture.Parse(parsedTexture, scene, rootUrl);\r\n if (parsedTexture.samplingMode && parsedCustomTexture.updateSamplingMode && parsedCustomTexture._samplingMode) {\r\n if (parsedCustomTexture._samplingMode !== parsedTexture.samplingMode) {\r\n parsedCustomTexture.updateSamplingMode(parsedTexture.samplingMode);\r\n }\r\n }\r\n return parsedCustomTexture;\r\n }\r\n if (parsedTexture.isCube && !parsedTexture.isRenderTarget) {\r\n return Texture._CubeTextureParser(parsedTexture, scene, rootUrl);\r\n }\r\n if (!parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n return null;\r\n }\r\n var texture = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () {\r\n var generateMipMaps = true;\r\n if (parsedTexture.noMipmap) {\r\n generateMipMaps = false;\r\n }\r\n if (parsedTexture.mirrorPlane) {\r\n var mirrorTexture = Texture._CreateMirror(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n mirrorTexture._waitingRenderList = parsedTexture.renderList;\r\n mirrorTexture.mirrorPlane = _Maths_math_plane__WEBPACK_IMPORTED_MODULE_10__[\"Plane\"].FromArray(parsedTexture.mirrorPlane);\r\n return mirrorTexture;\r\n }\r\n else if (parsedTexture.isRenderTarget) {\r\n var renderTargetTexture = null;\r\n if (parsedTexture.isCube) {\r\n // Search for an existing reflection probe (which contains a cube render target texture)\r\n if (scene.reflectionProbes) {\r\n for (var index = 0; index < scene.reflectionProbes.length; index++) {\r\n var probe = scene.reflectionProbes[index];\r\n if (probe.name === parsedTexture.name) {\r\n return probe.cubeTexture;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n renderTargetTexture = Texture._CreateRenderTargetTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n renderTargetTexture._waitingRenderList = parsedTexture.renderList;\r\n }\r\n return renderTargetTexture;\r\n }\r\n else {\r\n var texture;\r\n if (parsedTexture.base64String) {\r\n texture = Texture.CreateFromBase64String(parsedTexture.base64String, parsedTexture.name, scene, !generateMipMaps);\r\n }\r\n else {\r\n var url = rootUrl + parsedTexture.name;\r\n if (Texture.UseSerializedUrlIfAny && parsedTexture.url) {\r\n url = parsedTexture.url;\r\n }\r\n texture = new Texture(url, scene, !generateMipMaps, parsedTexture.invertY);\r\n }\r\n return texture;\r\n }\r\n }, parsedTexture, scene);\r\n // Update Sampling Mode\r\n if (parsedTexture.samplingMode) {\r\n var sampling = parsedTexture.samplingMode;\r\n if (texture && texture.samplingMode !== sampling) {\r\n texture.updateSamplingMode(sampling);\r\n }\r\n }\r\n // Animations\r\n if (texture && parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_6__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Creates a texture from its base 64 representation.\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param scene Define the scene the texture should belong to\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n return new Texture(\"data:\" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);\r\n };\r\n /**\r\n * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param scene Define the scene the texture should belong to\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.LoadFromDataString = function (name, buffer, scene, deleteBuffer, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTUREFORMAT_RGBA; }\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n return new Texture(name, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format);\r\n };\r\n /** @hidden */\r\n Texture._CubeTextureParser = function (jsonTexture, scene, rootUrl) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__[\"_DevTools\"].WarnImport(\"CubeTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateMirror = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__[\"_DevTools\"].WarnImport(\"MirrorTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_7__[\"_DevTools\"].WarnImport(\"RenderTargetTexture\");\r\n };\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_SAMPLINGMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_NEAREST_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.BILINEAR_SAMPLINGMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.LINEAR_LINEAR_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.TRILINEAR_SAMPLINGMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.LINEAR_LINEAR_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Texture.NEAREST_NEAREST_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Texture.NEAREST_LINEAR_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Texture.NEAREST_LINEAR_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = linear and mip = none */\r\n Texture.NEAREST_LINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_LINEAR;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Texture.NEAREST_NEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_NEAREST_NEAREST;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Texture.LINEAR_NEAREST_MIPNEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Texture.LINEAR_NEAREST_MIPLINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n /** mag = linear and min = linear and mip = none */\r\n Texture.LINEAR_LINEAR = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_LINEAR;\r\n /** mag = linear and min = nearest and mip = none */\r\n Texture.LINEAR_NEAREST = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_LINEAR_NEAREST;\r\n /** Explicit coordinates mode */\r\n Texture.EXPLICIT_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_EXPLICIT_MODE;\r\n /** Spherical coordinates mode */\r\n Texture.SPHERICAL_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_SPHERICAL_MODE;\r\n /** Planar coordinates mode */\r\n Texture.PLANAR_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_PLANAR_MODE;\r\n /** Cubic coordinates mode */\r\n Texture.CUBIC_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_CUBIC_MODE;\r\n /** Projection coordinates mode */\r\n Texture.PROJECTION_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_PROJECTION_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.SKYBOX_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_SKYBOX_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.INVCUBIC_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_INVCUBIC_MODE;\r\n /** Equirectangular coordinates mode */\r\n Texture.EQUIRECTANGULAR_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Texture.CLAMP_ADDRESSMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_CLAMP_ADDRESSMODE;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Texture.WRAP_ADDRESSMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_WRAP_ADDRESSMODE;\r\n /** Texture is repeating and mirrored */\r\n Texture.MIRROR_ADDRESSMODE = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURE_MIRROR_ADDRESSMODE;\r\n /**\r\n * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file\r\n */\r\n Texture.UseSerializedUrlIfAny = false;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"url\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uAng\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vAng\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"wAng\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"uRotationCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"vRotationCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"wRotationCenter\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Texture.prototype, \"isBlocking\", null);\r\n return Texture;\r\n}(_Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_4__[\"BaseTexture\"]));\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"]._TextureParser = Texture.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/Textures/videoTexture.ts\":\n/*!********************************************!*\\\n !*** ./Materials/Textures/videoTexture.ts ***!\n \\********************************************/\n/*! exports provided: VideoTexture */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return VideoTexture; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/how_to/video_texture\r\n */\r\nvar VideoTexture = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VideoTexture, _super);\r\n /**\r\n * Creates a video texture.\r\n * If you want to display a video in your scene, this is the special texture for that.\r\n * This special texture works similar to other textures, with the exception of a few parameters.\r\n * @see https://doc.babylonjs.com/how_to/video_texture\r\n * @param name optional name, will detect from video source, if not defined\r\n * @param src can be used to provide an url, array of urls or an already setup HTML video element.\r\n * @param scene is obviously the current scene.\r\n * @param generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).\r\n * @param invertY is false by default but can be used to invert video on Y axis\r\n * @param samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default\r\n * @param settings allows finer control over video usage\r\n */\r\n function VideoTexture(name, src, scene, generateMipMaps, invertY, samplingMode, settings) {\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (settings === void 0) { settings = {\r\n autoPlay: true,\r\n loop: true,\r\n autoUpdateTexture: true,\r\n }; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;\r\n _this._onUserActionRequestedObservable = null;\r\n _this._stillImageCaptured = false;\r\n _this._displayingPosterTexture = false;\r\n _this._frameId = -1;\r\n _this._createInternalTexture = function () {\r\n if (_this._texture != null) {\r\n if (_this._displayingPosterTexture) {\r\n _this._texture.dispose();\r\n _this._displayingPosterTexture = false;\r\n }\r\n else {\r\n return;\r\n }\r\n }\r\n if (!_this._engine.needPOTTextures ||\r\n (_Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].IsExponentOfTwo(_this.video.videoWidth) && _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].IsExponentOfTwo(_this.video.videoHeight))) {\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n }\r\n else {\r\n _this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this._generateMipMaps = false;\r\n }\r\n _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this.samplingMode);\r\n if (!_this.video.autoplay && !_this._settings.poster) {\r\n var oldHandler_1 = _this.video.onplaying;\r\n var error_1 = false;\r\n var oldMuted_1 = _this.video.muted;\r\n _this.video.muted = true;\r\n _this.video.onplaying = function () {\r\n _this.video.muted = oldMuted_1;\r\n _this.video.onplaying = oldHandler_1;\r\n _this._texture.isReady = true;\r\n _this._updateInternalTexture();\r\n if (!error_1) {\r\n _this.video.pause();\r\n }\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n };\r\n var playing = _this.video.play();\r\n if (playing) {\r\n playing.then(function () {\r\n // Everything is good.\r\n })\r\n .catch(function () {\r\n error_1 = true;\r\n // On Chrome for instance, new policies might prevent playing without user interaction.\r\n if (_this._onUserActionRequestedObservable && _this._onUserActionRequestedObservable.hasObservers()) {\r\n _this._onUserActionRequestedObservable.notifyObservers(_this);\r\n }\r\n });\r\n }\r\n else {\r\n _this.video.onplaying = oldHandler_1;\r\n _this._texture.isReady = true;\r\n _this._updateInternalTexture();\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n }\r\n }\r\n else {\r\n _this._texture.isReady = true;\r\n _this._updateInternalTexture();\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n }\r\n };\r\n _this.reset = function () {\r\n if (_this._texture == null) {\r\n return;\r\n }\r\n if (!_this._displayingPosterTexture) {\r\n _this._texture.dispose();\r\n _this._texture = null;\r\n }\r\n };\r\n _this._updateInternalTexture = function () {\r\n if (_this._texture == null || !_this._texture.isReady) {\r\n return;\r\n }\r\n if (_this.video.readyState < _this.video.HAVE_CURRENT_DATA) {\r\n return;\r\n }\r\n if (_this._displayingPosterTexture) {\r\n return;\r\n }\r\n var frameId = _this.getScene().getFrameId();\r\n if (_this._frameId === frameId) {\r\n return;\r\n }\r\n _this._frameId = frameId;\r\n _this._engine.updateVideoTexture(_this._texture, _this.video, _this._invertY);\r\n };\r\n _this._engine = _this.getScene().getEngine();\r\n _this._generateMipMaps = generateMipMaps;\r\n _this._initialSamplingMode = samplingMode;\r\n _this.autoUpdateTexture = settings.autoUpdateTexture;\r\n _this.name = name || _this._getName(src);\r\n _this.video = _this._getVideo(src);\r\n _this._settings = settings;\r\n if (settings.poster) {\r\n _this.video.poster = settings.poster;\r\n }\r\n if (settings.autoPlay !== undefined) {\r\n _this.video.autoplay = settings.autoPlay;\r\n }\r\n if (settings.loop !== undefined) {\r\n _this.video.loop = settings.loop;\r\n }\r\n _this.video.setAttribute(\"playsinline\", \"\");\r\n _this.video.addEventListener(\"paused\", _this._updateInternalTexture);\r\n _this.video.addEventListener(\"seeked\", _this._updateInternalTexture);\r\n _this.video.addEventListener(\"emptied\", _this.reset);\r\n _this._createInternalTextureOnEvent = (settings.poster && !settings.autoPlay) ? \"play\" : \"canplay\";\r\n _this.video.addEventListener(_this._createInternalTextureOnEvent, _this._createInternalTexture);\r\n var videoHasEnoughData = (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA);\r\n if (settings.poster &&\r\n (!settings.autoPlay || !videoHasEnoughData)) {\r\n _this._texture = _this._engine.createTexture(settings.poster, false, true, scene);\r\n _this._displayingPosterTexture = true;\r\n }\r\n else if (videoHasEnoughData) {\r\n _this._createInternalTexture();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(VideoTexture.prototype, \"onUserActionRequestedObservable\", {\r\n /**\r\n * Event triggerd when a dom action is required by the user to play the video.\r\n * This happens due to recent changes in browser policies preventing video to auto start.\r\n */\r\n get: function () {\r\n if (!this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._onUserActionRequestedObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n VideoTexture.prototype._getName = function (src) {\r\n if (src instanceof HTMLVideoElement) {\r\n return src.currentSrc;\r\n }\r\n if (typeof src === \"object\") {\r\n return src.toString();\r\n }\r\n return src;\r\n };\r\n VideoTexture.prototype._getVideo = function (src) {\r\n if (src instanceof HTMLVideoElement) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(src.currentSrc, src);\r\n return src;\r\n }\r\n var video = document.createElement(\"video\");\r\n if (typeof src === \"string\") {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(src, video);\r\n video.src = src;\r\n }\r\n else {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(src[0], video);\r\n src.forEach(function (url) {\r\n var source = document.createElement(\"source\");\r\n source.src = url;\r\n video.appendChild(source);\r\n });\r\n }\r\n return video;\r\n };\r\n /**\r\n * @hidden Internal method to initiate `update`.\r\n */\r\n VideoTexture.prototype._rebuild = function () {\r\n this.update();\r\n };\r\n /**\r\n * Update Texture in the `auto` mode. Does not do anything if `settings.autoUpdateTexture` is false.\r\n */\r\n VideoTexture.prototype.update = function () {\r\n if (!this.autoUpdateTexture) {\r\n // Expecting user to call `updateTexture` manually\r\n return;\r\n }\r\n this.updateTexture(true);\r\n };\r\n /**\r\n * Update Texture in `manual` mode. Does not do anything if not visible or paused.\r\n * @param isVisible Visibility state, detected by user using `scene.getActiveMeshes()` or othervise.\r\n */\r\n VideoTexture.prototype.updateTexture = function (isVisible) {\r\n if (!isVisible) {\r\n return;\r\n }\r\n if (this.video.paused && this._stillImageCaptured) {\r\n return;\r\n }\r\n this._stillImageCaptured = true;\r\n this._updateInternalTexture();\r\n };\r\n /**\r\n * Change video content. Changing video instance or setting multiple urls (as in constructor) is not supported.\r\n * @param url New url.\r\n */\r\n VideoTexture.prototype.updateURL = function (url) {\r\n this.video.src = url;\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n VideoTexture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._onUserActionRequestedObservable) {\r\n this._onUserActionRequestedObservable.clear();\r\n this._onUserActionRequestedObservable = null;\r\n }\r\n this.video.removeEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);\r\n this.video.removeEventListener(\"paused\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"seeked\", this._updateInternalTexture);\r\n this.video.removeEventListener(\"emptied\", this.reset);\r\n this.video.pause();\r\n };\r\n /**\r\n * Creates a video texture straight from a stream.\r\n * @param scene Define the scene the texture should be created in\r\n * @param stream Define the stream the texture should be created from\r\n * @returns The created video texture as a promise\r\n */\r\n VideoTexture.CreateFromStreamAsync = function (scene, stream) {\r\n var video = document.createElement(\"video\");\r\n video.setAttribute('autoplay', '');\r\n video.setAttribute('muted', 'true');\r\n video.setAttribute('playsinline', '');\r\n video.muted = true;\r\n if (video.mozSrcObject !== undefined) {\r\n // hack for Firefox < 19\r\n video.mozSrcObject = stream;\r\n }\r\n else {\r\n if (typeof video.srcObject == \"object\") {\r\n video.srcObject = stream;\r\n }\r\n else {\r\n window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;\r\n video.src = (window.URL && window.URL.createObjectURL(stream));\r\n }\r\n }\r\n return new Promise(function (resolve) {\r\n var onPlaying = function () {\r\n resolve(new VideoTexture(\"video\", video, scene, true, true));\r\n video.removeEventListener(\"playing\", onPlaying);\r\n };\r\n video.addEventListener(\"playing\", onPlaying);\r\n video.play();\r\n });\r\n };\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Define the scene the texture should be created in\r\n * @param constraints Define the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Define the audio constraints to use to create the web cam feed from WebRTC\r\n * @returns The created video texture as a promise\r\n */\r\n VideoTexture.CreateFromWebCamAsync = function (scene, constraints, audioConstaints) {\r\n var _this = this;\r\n if (audioConstaints === void 0) { audioConstaints = false; }\r\n var constraintsDeviceId;\r\n if (constraints && constraints.deviceId) {\r\n constraintsDeviceId = {\r\n exact: constraints.deviceId,\r\n };\r\n }\r\n if (navigator.mediaDevices) {\r\n return navigator.mediaDevices.getUserMedia({\r\n video: constraints,\r\n audio: audioConstaints\r\n })\r\n .then(function (stream) {\r\n return _this.CreateFromStreamAsync(scene, stream);\r\n });\r\n }\r\n else {\r\n navigator.getUserMedia =\r\n navigator.getUserMedia ||\r\n navigator.webkitGetUserMedia ||\r\n navigator.mozGetUserMedia ||\r\n navigator.msGetUserMedia;\r\n if (navigator.getUserMedia) {\r\n navigator.getUserMedia({\r\n video: {\r\n deviceId: constraintsDeviceId,\r\n width: {\r\n min: (constraints && constraints.minWidth) || 256,\r\n max: (constraints && constraints.maxWidth) || 640,\r\n },\r\n height: {\r\n min: (constraints && constraints.minHeight) || 256,\r\n max: (constraints && constraints.maxHeight) || 480,\r\n },\r\n },\r\n audio: audioConstaints\r\n }, function (stream) {\r\n return _this.CreateFromStreamAsync(scene, stream);\r\n }, function (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(e.name);\r\n });\r\n }\r\n }\r\n return Promise.reject(\"No support for userMedia on this device\");\r\n };\r\n /**\r\n * Creates a video texture straight from your WebCam video feed.\r\n * @param scene Define the scene the texture should be created in\r\n * @param onReady Define a callback to triggered once the texture will be ready\r\n * @param constraints Define the constraints to use to create the web cam feed from WebRTC\r\n * @param audioConstaints Define the audio constraints to use to create the web cam feed from WebRTC\r\n */\r\n VideoTexture.CreateFromWebCam = function (scene, onReady, constraints, audioConstaints) {\r\n if (audioConstaints === void 0) { audioConstaints = false; }\r\n this.CreateFromWebCamAsync(scene, constraints, audioConstaints)\r\n .then(function (videoTexture) {\r\n if (onReady) {\r\n onReady(videoTexture);\r\n }\r\n })\r\n .catch(function (err) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(err.name);\r\n });\r\n };\r\n return VideoTexture;\r\n}(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/colorCurves.ts\":\n/*!**********************************!*\\\n !*** ./Materials/colorCurves.ts ***!\n \\**********************************/\n/*! exports provided: ColorCurves */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return ColorCurves; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n/**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\nvar ColorCurves = /** @class */ (function () {\r\n function ColorCurves() {\r\n this._dirty = true;\r\n this._tempColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._globalCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._highlightsCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._midtonesCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._shadowsCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._positiveCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._negativeCurve = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_2__[\"Color4\"](0, 0, 0, 0);\r\n this._globalHue = 30;\r\n this._globalDensity = 0;\r\n this._globalSaturation = 0;\r\n this._globalExposure = 0;\r\n this._highlightsHue = 30;\r\n this._highlightsDensity = 0;\r\n this._highlightsSaturation = 0;\r\n this._highlightsExposure = 0;\r\n this._midtonesHue = 30;\r\n this._midtonesDensity = 0;\r\n this._midtonesSaturation = 0;\r\n this._midtonesExposure = 0;\r\n this._shadowsHue = 30;\r\n this._shadowsDensity = 0;\r\n this._shadowsSaturation = 0;\r\n this._shadowsExposure = 0;\r\n }\r\n Object.defineProperty(ColorCurves.prototype, \"globalHue\", {\r\n /**\r\n * Gets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._globalHue;\r\n },\r\n /**\r\n * Sets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._globalHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalDensity\", {\r\n /**\r\n * Gets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._globalDensity;\r\n },\r\n /**\r\n * Sets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._globalDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalSaturation\", {\r\n /**\r\n * Gets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._globalSaturation;\r\n },\r\n /**\r\n * Sets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._globalSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalExposure\", {\r\n /**\r\n * Gets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._globalExposure;\r\n },\r\n /**\r\n * Sets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._globalExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsHue\", {\r\n /**\r\n * Gets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._highlightsHue;\r\n },\r\n /**\r\n * Sets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._highlightsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsDensity\", {\r\n /**\r\n * Gets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._highlightsDensity;\r\n },\r\n /**\r\n * Sets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._highlightsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsSaturation\", {\r\n /**\r\n * Gets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._highlightsSaturation;\r\n },\r\n /**\r\n * Sets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._highlightsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsExposure\", {\r\n /**\r\n * Gets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._highlightsExposure;\r\n },\r\n /**\r\n * Sets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._highlightsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesHue\", {\r\n /**\r\n * Gets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._midtonesHue;\r\n },\r\n /**\r\n * Sets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._midtonesHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesDensity\", {\r\n /**\r\n * Gets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._midtonesDensity;\r\n },\r\n /**\r\n * Sets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._midtonesDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesSaturation\", {\r\n /**\r\n * Gets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._midtonesSaturation;\r\n },\r\n /**\r\n * Sets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._midtonesSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesExposure\", {\r\n /**\r\n * Gets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._midtonesExposure;\r\n },\r\n /**\r\n * Sets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._midtonesExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsHue\", {\r\n /**\r\n * Gets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._shadowsHue;\r\n },\r\n /**\r\n * Sets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._shadowsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsDensity\", {\r\n /**\r\n * Gets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._shadowsDensity;\r\n },\r\n /**\r\n * Sets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._shadowsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsSaturation\", {\r\n /**\r\n * Gets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._shadowsSaturation;\r\n },\r\n /**\r\n * Sets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._shadowsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsExposure\", {\r\n /**\r\n * Gets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._shadowsExposure;\r\n },\r\n /**\r\n * Sets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._shadowsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the class name\r\n * @returns The class name\r\n */\r\n ColorCurves.prototype.getClassName = function () {\r\n return \"ColorCurves\";\r\n };\r\n /**\r\n * Binds the color curves to the shader.\r\n * @param colorCurves The color curve to bind\r\n * @param effect The effect to bind to\r\n * @param positiveUniform The positive uniform shader parameter\r\n * @param neutralUniform The neutral uniform shader parameter\r\n * @param negativeUniform The negative uniform shader parameter\r\n */\r\n ColorCurves.Bind = function (colorCurves, effect, positiveUniform, neutralUniform, negativeUniform) {\r\n if (positiveUniform === void 0) { positiveUniform = \"vCameraColorCurvePositive\"; }\r\n if (neutralUniform === void 0) { neutralUniform = \"vCameraColorCurveNeutral\"; }\r\n if (negativeUniform === void 0) { negativeUniform = \"vCameraColorCurveNegative\"; }\r\n if (colorCurves._dirty) {\r\n colorCurves._dirty = false;\r\n // Fill in global info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);\r\n // Compute highlights info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._highlightsHue, colorCurves._highlightsDensity, colorCurves._highlightsSaturation, colorCurves._highlightsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._highlightsCurve);\r\n // Compute midtones info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._midtonesHue, colorCurves._midtonesDensity, colorCurves._midtonesSaturation, colorCurves._midtonesExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);\r\n // Compute shadows info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._shadowsHue, colorCurves._shadowsDensity, colorCurves._shadowsSaturation, colorCurves._shadowsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);\r\n // Compute deltas (neutral is midtones).\r\n colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);\r\n colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);\r\n }\r\n if (effect) {\r\n effect.setFloat4(positiveUniform, colorCurves._positiveCurve.r, colorCurves._positiveCurve.g, colorCurves._positiveCurve.b, colorCurves._positiveCurve.a);\r\n effect.setFloat4(neutralUniform, colorCurves._midtonesCurve.r, colorCurves._midtonesCurve.g, colorCurves._midtonesCurve.b, colorCurves._midtonesCurve.a);\r\n effect.setFloat4(negativeUniform, colorCurves._negativeCurve.r, colorCurves._negativeCurve.g, colorCurves._negativeCurve.b, colorCurves._negativeCurve.a);\r\n }\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the ColorCurves effects.\r\n * @param uniformsList The list of uniforms used in the effect\r\n */\r\n ColorCurves.PrepareUniforms = function (uniformsList) {\r\n uniformsList.push(\"vCameraColorCurveNeutral\", \"vCameraColorCurvePositive\", \"vCameraColorCurveNegative\");\r\n };\r\n /**\r\n * Returns color grading data based on a hue, density, saturation and exposure value.\r\n * @param filterHue The hue of the color filter.\r\n * @param filterDensity The density of the color filter.\r\n * @param saturation The saturation.\r\n * @param exposure The exposure.\r\n * @param result The result data container.\r\n */\r\n ColorCurves.prototype.getColorGradingDataToRef = function (hue, density, saturation, exposure, result) {\r\n if (hue == null) {\r\n return;\r\n }\r\n hue = ColorCurves.clamp(hue, 0, 360);\r\n density = ColorCurves.clamp(density, -100, 100);\r\n saturation = ColorCurves.clamp(saturation, -100, 100);\r\n exposure = ColorCurves.clamp(exposure, -100, 100);\r\n // Remap the slider/config filter density with non-linear mapping and also scale by half\r\n // so that the maximum filter density is only 50% control. This provides fine control\r\n // for small values and reasonable range.\r\n density = ColorCurves.applyColorGradingSliderNonlinear(density);\r\n density *= 0.5;\r\n exposure = ColorCurves.applyColorGradingSliderNonlinear(exposure);\r\n if (density < 0) {\r\n density *= -1;\r\n hue = (hue + 180) % 360;\r\n }\r\n ColorCurves.fromHSBToRef(hue, density, 50 + 0.25 * exposure, result);\r\n result.scaleToRef(2, result);\r\n result.a = 1 + 0.01 * saturation;\r\n };\r\n /**\r\n * Takes an input slider value and returns an adjusted value that provides extra control near the centre.\r\n * @param value The input slider value in range [-100,100].\r\n * @returns Adjusted value.\r\n */\r\n ColorCurves.applyColorGradingSliderNonlinear = function (value) {\r\n value /= 100;\r\n var x = Math.abs(value);\r\n x = Math.pow(x, 2);\r\n if (value < 0) {\r\n x *= -1;\r\n }\r\n x *= 100;\r\n return x;\r\n };\r\n /**\r\n * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).\r\n * @param hue The hue (H) input.\r\n * @param saturation The saturation (S) input.\r\n * @param brightness The brightness (B) input.\r\n * @result An RGBA color represented as Vector4.\r\n */\r\n ColorCurves.fromHSBToRef = function (hue, saturation, brightness, result) {\r\n var h = ColorCurves.clamp(hue, 0, 360);\r\n var s = ColorCurves.clamp(saturation / 100, 0, 1);\r\n var v = ColorCurves.clamp(brightness / 100, 0, 1);\r\n if (s === 0) {\r\n result.r = v;\r\n result.g = v;\r\n result.b = v;\r\n }\r\n else {\r\n // sector 0 to 5\r\n h /= 60;\r\n var i = Math.floor(h);\r\n // fractional part of h\r\n var f = h - i;\r\n var p = v * (1 - s);\r\n var q = v * (1 - s * f);\r\n var t = v * (1 - s * (1 - f));\r\n switch (i) {\r\n case 0:\r\n result.r = v;\r\n result.g = t;\r\n result.b = p;\r\n break;\r\n case 1:\r\n result.r = q;\r\n result.g = v;\r\n result.b = p;\r\n break;\r\n case 2:\r\n result.r = p;\r\n result.g = v;\r\n result.b = t;\r\n break;\r\n case 3:\r\n result.r = p;\r\n result.g = q;\r\n result.b = v;\r\n break;\r\n case 4:\r\n result.r = t;\r\n result.g = p;\r\n result.b = v;\r\n break;\r\n default: // case 5:\r\n result.r = v;\r\n result.g = p;\r\n result.b = q;\r\n break;\r\n }\r\n }\r\n result.a = 1;\r\n };\r\n /**\r\n * Returns a value clamped between min and max\r\n * @param value The value to clamp\r\n * @param min The minimum of value\r\n * @param max The maximum of value\r\n * @returns The clamped value.\r\n */\r\n ColorCurves.clamp = function (value, min, max) {\r\n return Math.min(Math.max(value, min), max);\r\n };\r\n /**\r\n * Clones the current color curve instance.\r\n * @return The cloned curves\r\n */\r\n ColorCurves.prototype.clone = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new ColorCurves(); }, this);\r\n };\r\n /**\r\n * Serializes the current color curve instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ColorCurves.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses the color curve from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed curves\r\n */\r\n ColorCurves.Parse = function (source) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new ColorCurves(); }, source, null, null);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalHue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalDensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalSaturation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_globalExposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsHue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsDensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsSaturation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_highlightsExposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesHue\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesDensity\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesSaturation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ColorCurves.prototype, \"_midtonesExposure\", void 0);\r\n return ColorCurves;\r\n}());\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"]._ColorCurvesParser = ColorCurves.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/effect.ts\":\n/*!*****************************!*\\\n !*** ./Materials/effect.ts ***!\n \\*****************************/\n/*! exports provided: EffectFallbacks, EffectCreationOptions, Effect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return EffectFallbacks; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return EffectCreationOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return Effect; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_Processors_shaderProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/Processors/shaderProcessor */ \"./Engines/Processors/shaderProcessor.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * EffectFallbacks can be used to add fallbacks (properties to disable) to certain properties when desired to improve performance.\r\n * (Eg. Start at high quality with reflection and fog, if fps is low, remove reflection, if still low remove fog)\r\n */\r\nvar EffectFallbacks = /** @class */ (function () {\r\n function EffectFallbacks() {\r\n this._defines = {};\r\n this._currentRank = 32;\r\n this._maxRank = -1;\r\n this._mesh = null;\r\n }\r\n /**\r\n * Removes the fallback from the bound mesh.\r\n */\r\n EffectFallbacks.prototype.unBindMesh = function () {\r\n this._mesh = null;\r\n };\r\n /**\r\n * Adds a fallback on the specified property.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param define The name of the define in the shader\r\n */\r\n EffectFallbacks.prototype.addFallback = function (rank, define) {\r\n if (!this._defines[rank]) {\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n this._defines[rank] = new Array();\r\n }\r\n this._defines[rank].push(define);\r\n };\r\n /**\r\n * Sets the mesh to use CPU skinning when needing to fallback.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param mesh The mesh to use the fallbacks.\r\n */\r\n EffectFallbacks.prototype.addCPUSkinningFallback = function (rank, mesh) {\r\n this._mesh = mesh;\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n };\r\n Object.defineProperty(EffectFallbacks.prototype, \"hasMoreFallbacks\", {\r\n /**\r\n * Checks to see if more fallbacks are still availible.\r\n */\r\n get: function () {\r\n return this._currentRank <= this._maxRank;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Removes the defines that should be removed when falling back.\r\n * @param currentDefines defines the current define statements for the shader.\r\n * @param effect defines the current effect we try to compile\r\n * @returns The resulting defines with defines of the current rank removed.\r\n */\r\n EffectFallbacks.prototype.reduce = function (currentDefines, effect) {\r\n // First we try to switch to CPU skinning\r\n if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {\r\n this._mesh.computeBonesUsingShaders = false;\r\n currentDefines = currentDefines.replace(\"#define NUM_BONE_INFLUENCERS \" + this._mesh.numBoneInfluencers, \"#define NUM_BONE_INFLUENCERS 0\");\r\n effect._bonesComputationForcedToCPU = true;\r\n var scene = this._mesh.getScene();\r\n for (var index = 0; index < scene.meshes.length; index++) {\r\n var otherMesh = scene.meshes[index];\r\n if (!otherMesh.material) {\r\n if (!this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n continue;\r\n }\r\n if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {\r\n continue;\r\n }\r\n if (otherMesh.material.getEffect() === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n else if (otherMesh.subMeshes) {\r\n for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var subMeshEffect = subMesh.effect;\r\n if (subMeshEffect === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var currentFallbacks = this._defines[this._currentRank];\r\n if (currentFallbacks) {\r\n for (var index = 0; index < currentFallbacks.length; index++) {\r\n currentDefines = currentDefines.replace(\"#define \" + currentFallbacks[index], \"\");\r\n }\r\n }\r\n this._currentRank++;\r\n }\r\n return currentDefines;\r\n };\r\n return EffectFallbacks;\r\n}());\r\n\r\n/**\r\n * Options to be used when creating an effect.\r\n */\r\nvar EffectCreationOptions = /** @class */ (function () {\r\n function EffectCreationOptions() {\r\n }\r\n return EffectCreationOptions;\r\n}());\r\n\r\n/**\r\n * Effect containing vertex and fragment shader that can be executed on an object.\r\n */\r\nvar Effect = /** @class */ (function () {\r\n /**\r\n * Instantiates an effect.\r\n * An effect can be used to create/manage/execute vertex and fragment shaders.\r\n * @param baseName Name of the effect.\r\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\r\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\r\n * @param samplers List of sampler variables that will be passed to the shader.\r\n * @param engine Engine to be used to render the effect\r\n * @param defines Define statements to be added to the shader.\r\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\r\n * @param onCompiled Callback that will be called when the shader is compiled.\r\n * @param onError Callback that will be called if an error occurs during shader compilation.\r\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. {lights: 10})\r\n */\r\n function Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var _this = this;\r\n if (samplers === void 0) { samplers = null; }\r\n if (defines === void 0) { defines = null; }\r\n if (fallbacks === void 0) { fallbacks = null; }\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n /**\r\n * Name of the effect.\r\n */\r\n this.name = null;\r\n /**\r\n * String container all the define statements that should be set on the shader.\r\n */\r\n this.defines = \"\";\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback that will be called when effect is bound.\r\n */\r\n this.onBind = null;\r\n /**\r\n * Unique ID of the effect.\r\n */\r\n this.uniqueId = 0;\r\n /**\r\n * Observable that will be called when the shader is compiled.\r\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\r\n */\r\n this.onCompileObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /**\r\n * Observable that will be called if an error occurs during shader compilation.\r\n */\r\n this.onErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n /** @hidden */\r\n this._onBindObservable = null;\r\n /** @hidden */\r\n this._bonesComputationForcedToCPU = false;\r\n this._uniformBuffersNames = {};\r\n this._samplers = {};\r\n this._isReady = false;\r\n this._compilationError = \"\";\r\n this._uniforms = {};\r\n /**\r\n * Key for the effect.\r\n * @hidden\r\n */\r\n this._key = \"\";\r\n this._fallbacks = null;\r\n this._vertexSourceCode = \"\";\r\n this._fragmentSourceCode = \"\";\r\n this._vertexSourceCodeOverride = \"\";\r\n this._fragmentSourceCodeOverride = \"\";\r\n this._transformFeedbackVaryings = null;\r\n /**\r\n * Compiled shader to webGL program.\r\n * @hidden\r\n */\r\n this._pipelineContext = null;\r\n this._valueCache = {};\r\n this.name = baseName;\r\n if (attributesNamesOrOptions.attributes) {\r\n var options = attributesNamesOrOptions;\r\n this._engine = uniformsNamesOrEngine;\r\n this._attributesNames = options.attributes;\r\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\r\n this._samplerList = options.samplers.slice();\r\n this.defines = options.defines;\r\n this.onError = options.onError;\r\n this.onCompiled = options.onCompiled;\r\n this._fallbacks = options.fallbacks;\r\n this._indexParameters = options.indexParameters;\r\n this._transformFeedbackVaryings = options.transformFeedbackVaryings;\r\n if (options.uniformBuffersNames) {\r\n for (var i = 0; i < options.uniformBuffersNames.length; i++) {\r\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\r\n }\r\n }\r\n }\r\n else {\r\n this._engine = engine;\r\n this.defines = (defines == null ? \"\" : defines);\r\n this._uniformsNames = uniformsNamesOrEngine.concat(samplers);\r\n this._samplerList = samplers ? samplers.slice() : [];\r\n this._attributesNames = attributesNamesOrOptions;\r\n this.onError = onError;\r\n this.onCompiled = onCompiled;\r\n this._indexParameters = indexParameters;\r\n this._fallbacks = fallbacks;\r\n }\r\n this.uniqueId = Effect._uniqueIdSeed++;\r\n var vertexSource;\r\n var fragmentSource;\r\n if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n }\r\n else if (baseName.vertexElement) {\r\n vertexSource = document.getElementById(baseName.vertexElement);\r\n if (!vertexSource) {\r\n vertexSource = baseName.vertexElement;\r\n }\r\n }\r\n else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n }\r\n else if (baseName.fragmentElement) {\r\n fragmentSource = document.getElementById(baseName.fragmentElement);\r\n if (!fragmentSource) {\r\n fragmentSource = baseName.fragmentElement;\r\n }\r\n }\r\n else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n var processorOptions = {\r\n defines: this.defines.split(\"\\n\"),\r\n indexParameters: this._indexParameters,\r\n isFragment: false,\r\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\r\n processor: this._engine._shaderProcessor,\r\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\r\n shadersRepository: Effect.ShadersRepository,\r\n includesShadersStore: Effect.IncludesShadersStore,\r\n version: (this._engine.webGLVersion * 100).toString(),\r\n platformName: this._engine.webGLVersion >= 2 ? \"WEBGL2\" : \"WEBGL1\"\r\n };\r\n this._loadVertexShader(vertexSource, function (vertexCode) {\r\n _this._loadFragmentShader(fragmentSource, function (fragmentCode) {\r\n _Engines_Processors_shaderProcessor__WEBPACK_IMPORTED_MODULE_4__[\"ShaderProcessor\"].Process(vertexCode, processorOptions, function (migratedVertexCode) {\r\n processorOptions.isFragment = true;\r\n _Engines_Processors_shaderProcessor__WEBPACK_IMPORTED_MODULE_4__[\"ShaderProcessor\"].Process(fragmentCode, processorOptions, function (migratedFragmentCode) {\r\n _this._useFinalCode(migratedVertexCode, migratedFragmentCode, baseName);\r\n });\r\n });\r\n });\r\n });\r\n }\r\n Object.defineProperty(Effect.prototype, \"onBindObservable\", {\r\n /**\r\n * Observable that will be called when effect is bound.\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Effect.prototype._useFinalCode = function (migratedVertexCode, migratedFragmentCode, baseName) {\r\n if (baseName) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n this._vertexSourceCode = \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\r\n this._fragmentSourceCode = \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\r\n }\r\n else {\r\n this._vertexSourceCode = migratedVertexCode;\r\n this._fragmentSourceCode = migratedFragmentCode;\r\n }\r\n this._prepareEffect();\r\n };\r\n Object.defineProperty(Effect.prototype, \"key\", {\r\n /**\r\n * Unique key for this effect\r\n */\r\n get: function () {\r\n return this._key;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * If the effect has been compiled and prepared.\r\n * @returns if the effect is compiled and prepared.\r\n */\r\n Effect.prototype.isReady = function () {\r\n try {\r\n return this._isReadyInternal();\r\n }\r\n catch (_a) {\r\n return false;\r\n }\r\n };\r\n Effect.prototype._isReadyInternal = function () {\r\n if (this._isReady) {\r\n return true;\r\n }\r\n if (this._pipelineContext) {\r\n return this._pipelineContext.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * The engine the effect was initialized with.\r\n * @returns the engine.\r\n */\r\n Effect.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The pipeline context for this effect\r\n * @returns the associated pipeline context\r\n */\r\n Effect.prototype.getPipelineContext = function () {\r\n return this._pipelineContext;\r\n };\r\n /**\r\n * The set of names of attribute variables for the shader.\r\n * @returns An array of attribute names.\r\n */\r\n Effect.prototype.getAttributesNames = function () {\r\n return this._attributesNames;\r\n };\r\n /**\r\n * Returns the attribute at the given index.\r\n * @param index The index of the attribute.\r\n * @returns The location of the attribute.\r\n */\r\n Effect.prototype.getAttributeLocation = function (index) {\r\n return this._attributes[index];\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param name of the attribute to look up.\r\n * @returns the attribute location.\r\n */\r\n Effect.prototype.getAttributeLocationByName = function (name) {\r\n var index = this._attributesNames.indexOf(name);\r\n return this._attributes[index];\r\n };\r\n /**\r\n * The number of attributes.\r\n * @returns the numnber of attributes.\r\n */\r\n Effect.prototype.getAttributesCount = function () {\r\n return this._attributes.length;\r\n };\r\n /**\r\n * Gets the index of a uniform variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the index.\r\n */\r\n Effect.prototype.getUniformIndex = function (uniformName) {\r\n return this._uniformsNames.indexOf(uniformName);\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the location of the uniform.\r\n */\r\n Effect.prototype.getUniform = function (uniformName) {\r\n return this._uniforms[uniformName];\r\n };\r\n /**\r\n * Returns an array of sampler variable names\r\n * @returns The array of sampler variable neames.\r\n */\r\n Effect.prototype.getSamplers = function () {\r\n return this._samplerList;\r\n };\r\n /**\r\n * The error from the last compilation.\r\n * @returns the error string.\r\n */\r\n Effect.prototype.getCompilationError = function () {\r\n return this._compilationError;\r\n };\r\n /**\r\n * Adds a callback to the onCompiled observable and call the callback imediatly if already ready.\r\n * @param func The callback to be used.\r\n */\r\n Effect.prototype.executeWhenCompiled = function (func) {\r\n var _this = this;\r\n if (this.isReady()) {\r\n func(this);\r\n return;\r\n }\r\n this.onCompileObservable.add(function (effect) {\r\n func(effect);\r\n });\r\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\r\n setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 16);\r\n }\r\n };\r\n Effect.prototype._checkIsReady = function () {\r\n var _this = this;\r\n try {\r\n if (this._isReadyInternal()) {\r\n return;\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e);\r\n return;\r\n }\r\n setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 16);\r\n };\r\n /** @hidden */\r\n Effect.prototype._loadVertexShader = function (vertex, callback) {\r\n if (typeof (HTMLElement) !== \"undefined\") {\r\n // DOM element ?\r\n if (vertex instanceof HTMLElement) {\r\n var vertexCode = _Misc_domManagement__WEBPACK_IMPORTED_MODULE_2__[\"DomManagement\"].GetDOMTextContent(vertex);\r\n callback(vertexCode);\r\n return;\r\n }\r\n }\r\n // Direct source ?\r\n if (vertex.substr(0, 7) === \"source:\") {\r\n callback(vertex.substr(7));\r\n return;\r\n }\r\n // Base64 encoded ?\r\n if (vertex.substr(0, 7) === \"base64:\") {\r\n var vertexBinary = window.atob(vertex.substr(7));\r\n callback(vertexBinary);\r\n return;\r\n }\r\n // Is in local store ?\r\n if (Effect.ShadersStore[vertex + \"VertexShader\"]) {\r\n callback(Effect.ShadersStore[vertex + \"VertexShader\"]);\r\n return;\r\n }\r\n var vertexShaderUrl;\r\n if (vertex[0] === \".\" || vertex[0] === \"/\" || vertex.indexOf(\"http\") > -1) {\r\n vertexShaderUrl = vertex;\r\n }\r\n else {\r\n vertexShaderUrl = Effect.ShadersRepository + vertex;\r\n }\r\n // Vertex shader\r\n this._engine._loadFile(vertexShaderUrl + \".vertex.fx\", callback);\r\n };\r\n /** @hidden */\r\n Effect.prototype._loadFragmentShader = function (fragment, callback) {\r\n if (typeof (HTMLElement) !== \"undefined\") {\r\n // DOM element ?\r\n if (fragment instanceof HTMLElement) {\r\n var fragmentCode = _Misc_domManagement__WEBPACK_IMPORTED_MODULE_2__[\"DomManagement\"].GetDOMTextContent(fragment);\r\n callback(fragmentCode);\r\n return;\r\n }\r\n }\r\n // Direct source ?\r\n if (fragment.substr(0, 7) === \"source:\") {\r\n callback(fragment.substr(7));\r\n return;\r\n }\r\n // Base64 encoded ?\r\n if (fragment.substr(0, 7) === \"base64:\") {\r\n var fragmentBinary = window.atob(fragment.substr(7));\r\n callback(fragmentBinary);\r\n return;\r\n }\r\n // Is in local store ?\r\n if (Effect.ShadersStore[fragment + \"PixelShader\"]) {\r\n callback(Effect.ShadersStore[fragment + \"PixelShader\"]);\r\n return;\r\n }\r\n if (Effect.ShadersStore[fragment + \"FragmentShader\"]) {\r\n callback(Effect.ShadersStore[fragment + \"FragmentShader\"]);\r\n return;\r\n }\r\n var fragmentShaderUrl;\r\n if (fragment[0] === \".\" || fragment[0] === \"/\" || fragment.indexOf(\"http\") > -1) {\r\n fragmentShaderUrl = fragment;\r\n }\r\n else {\r\n fragmentShaderUrl = Effect.ShadersRepository + fragment;\r\n }\r\n // Fragment shader\r\n this._engine._loadFile(fragmentShaderUrl + \".fragment.fx\", callback);\r\n };\r\n /** @hidden */\r\n Effect.prototype._dumpShadersSource = function (vertexCode, fragmentCode, defines) {\r\n // Rebuild shaders source code\r\n var shaderVersion = (this._engine.webGLVersion > 1) ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n var prefix = shaderVersion + (defines ? defines + \"\\n\" : \"\");\r\n vertexCode = prefix + vertexCode;\r\n fragmentCode = prefix + fragmentCode;\r\n // Number lines of shaders source code\r\n var i = 2;\r\n var regex = /\\n/gm;\r\n var formattedVertexCode = \"\\n1\\t\" + vertexCode.replace(regex, function () { return \"\\n\" + (i++) + \"\\t\"; });\r\n i = 2;\r\n var formattedFragmentCode = \"\\n1\\t\" + fragmentCode.replace(regex, function () { return \"\\n\" + (i++) + \"\\t\"; });\r\n // Dump shaders name and formatted source code\r\n if (this.name.vertexElement) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Vertex shader: \" + this.name.vertexElement + formattedVertexCode);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Fragment shader: \" + this.name.fragmentElement + formattedFragmentCode);\r\n }\r\n else if (this.name.vertex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Vertex shader: \" + this.name.vertex + formattedVertexCode);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Fragment shader: \" + this.name.fragment + formattedFragmentCode);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Vertex shader: \" + this.name + formattedVertexCode);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Fragment shader: \" + this.name + formattedFragmentCode);\r\n }\r\n };\r\n /**\r\n * Recompiles the webGL program\r\n * @param vertexSourceCode The source code for the vertex shader.\r\n * @param fragmentSourceCode The source code for the fragment shader.\r\n * @param onCompiled Callback called when completed.\r\n * @param onError Callback called on error.\r\n * @hidden\r\n */\r\n Effect.prototype._rebuildProgram = function (vertexSourceCode, fragmentSourceCode, onCompiled, onError) {\r\n var _this = this;\r\n this._isReady = false;\r\n this._vertexSourceCodeOverride = vertexSourceCode;\r\n this._fragmentSourceCodeOverride = fragmentSourceCode;\r\n this.onError = function (effect, error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n };\r\n this.onCompiled = function () {\r\n var scenes = _this.getEngine().scenes;\r\n for (var i = 0; i < scenes.length; i++) {\r\n scenes[i].markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_AllDirtyFlag);\r\n }\r\n _this._pipelineContext._handlesSpectorRebuildCallback(onCompiled);\r\n };\r\n this._fallbacks = null;\r\n this._prepareEffect();\r\n };\r\n /**\r\n * Prepares the effect\r\n * @hidden\r\n */\r\n Effect.prototype._prepareEffect = function () {\r\n var _this = this;\r\n var attributesNames = this._attributesNames;\r\n var defines = this.defines;\r\n this._valueCache = {};\r\n var previousPipelineContext = this._pipelineContext;\r\n try {\r\n var engine_1 = this._engine;\r\n this._pipelineContext = engine_1.createPipelineContext();\r\n var rebuildRebind = this._rebuildProgram.bind(this);\r\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, true, rebuildRebind, null, this._transformFeedbackVaryings);\r\n }\r\n else {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, false, rebuildRebind, defines, this._transformFeedbackVaryings);\r\n }\r\n engine_1._executeWhenRenderingStateIsCompiled(this._pipelineContext, function () {\r\n if (engine_1.supportsUniformBuffers) {\r\n for (var name in _this._uniformBuffersNames) {\r\n _this.bindUniformBlock(name, _this._uniformBuffersNames[name]);\r\n }\r\n }\r\n var uniforms = engine_1.getUniforms(_this._pipelineContext, _this._uniformsNames);\r\n uniforms.forEach(function (uniform, index) {\r\n _this._uniforms[_this._uniformsNames[index]] = uniform;\r\n });\r\n _this._attributes = engine_1.getAttributes(_this._pipelineContext, attributesNames);\r\n var index;\r\n for (index = 0; index < _this._samplerList.length; index++) {\r\n var sampler = _this.getUniform(_this._samplerList[index]);\r\n if (sampler == null) {\r\n _this._samplerList.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n _this._samplerList.forEach(function (name, index) {\r\n _this._samplers[name] = index;\r\n });\r\n engine_1.bindSamplers(_this);\r\n _this._compilationError = \"\";\r\n _this._isReady = true;\r\n if (_this.onCompiled) {\r\n _this.onCompiled(_this);\r\n }\r\n _this.onCompileObservable.notifyObservers(_this);\r\n _this.onCompileObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (_this._fallbacks) {\r\n _this._fallbacks.unBindMesh();\r\n }\r\n if (previousPipelineContext) {\r\n _this.getEngine()._deletePipelineContext(previousPipelineContext);\r\n }\r\n });\r\n if (this._pipelineContext.isAsync) {\r\n this._checkIsReady();\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n }\r\n };\r\n Effect.prototype._processCompilationErrors = function (e, previousPipelineContext) {\r\n if (previousPipelineContext === void 0) { previousPipelineContext = null; }\r\n this._compilationError = e.message;\r\n var attributesNames = this._attributesNames;\r\n var fallbacks = this._fallbacks;\r\n // Let's go through fallbacks then\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Unable to compile effect:\");\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Uniforms: \" + this._uniformsNames.map(function (uniform) {\r\n return \" \" + uniform;\r\n }));\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Attributes: \" + attributesNames.map(function (attribute) {\r\n return \" \" + attribute;\r\n }));\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Defines:\\r\\n\" + this.defines);\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Error: \" + this._compilationError);\r\n if (previousPipelineContext) {\r\n this._pipelineContext = previousPipelineContext;\r\n this._isReady = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n }\r\n if (fallbacks) {\r\n this._pipelineContext = null;\r\n if (fallbacks.hasMoreFallbacks) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_3__[\"Logger\"].Error(\"Trying next fallback.\");\r\n this.defines = fallbacks.reduce(this.defines, this);\r\n this._prepareEffect();\r\n }\r\n else { // Sorry we did everything we can\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n this.onErrorObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n }\r\n }\r\n };\r\n Object.defineProperty(Effect.prototype, \"isSupported\", {\r\n /**\r\n * Checks if the effect is supported. (Must be called after compilation)\r\n */\r\n get: function () {\r\n return this._compilationError === \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Binds a texture to the engine to be used as output of the shader.\r\n * @param channel Name of the output variable.\r\n * @param texture Texture to bind.\r\n * @hidden\r\n */\r\n Effect.prototype._bindTexture = function (channel, texture) {\r\n this._engine._bindTexture(this._samplers[channel], texture);\r\n };\r\n /**\r\n * Sets a texture on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setTexture = function (channel, texture) {\r\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setDepthStencilTexture = function (channel, texture) {\r\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets an array of textures on the engine to be used in the shader.\r\n * @param channel Name of the variable.\r\n * @param textures Textures to set.\r\n */\r\n Effect.prototype.setTextureArray = function (channel, textures) {\r\n var exName = channel + \"Ex\";\r\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\r\n var initialPos = this._samplerList.indexOf(channel);\r\n for (var index = 1; index < textures.length; index++) {\r\n var currentExName = exName + (index - 1).toString();\r\n this._samplerList.splice(initialPos + index, 0, currentExName);\r\n }\r\n // Reset every channels\r\n var channelIndex = 0;\r\n for (var _i = 0, _a = this._samplerList; _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n this._samplers[key] = channelIndex;\r\n channelIndex += 1;\r\n }\r\n }\r\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures);\r\n };\r\n /**\r\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the input texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess);\r\n };\r\n /**\r\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\r\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the output texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess);\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheMatrix = function (uniformName, matrix) {\r\n var cache = this._valueCache[uniformName];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[uniformName] = flag;\r\n return true;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat2 = function (uniformName, x, y) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat3 = function (uniformName, x, y, z) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y, z];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat4 = function (uniformName, x, y, z, w) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y, z, w];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n if (cache[3] !== w) {\r\n cache[3] = w;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /**\r\n * Binds a buffer to a uniform.\r\n * @param buffer Buffer to bind.\r\n * @param name Name of the uniform variable to bind to.\r\n */\r\n Effect.prototype.bindUniformBuffer = function (buffer, name) {\r\n var bufferName = this._uniformBuffersNames[name];\r\n if (bufferName === undefined || Effect._baseCache[bufferName] === buffer) {\r\n return;\r\n }\r\n Effect._baseCache[bufferName] = buffer;\r\n this._engine.bindUniformBufferBase(buffer, bufferName);\r\n };\r\n /**\r\n * Binds block to a uniform.\r\n * @param blockName Name of the block to bind.\r\n * @param index Index to bind.\r\n */\r\n Effect.prototype.bindUniformBlock = function (blockName, index) {\r\n this._engine.bindUniformBlock(this._pipelineContext, blockName, index);\r\n };\r\n /**\r\n * Sets an interger value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setInt = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = value;\r\n this._engine.setInt(this._uniforms[uniformName], value);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setFloatArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets matrices on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrices matrices to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrices = function (uniformName, matrices) {\r\n if (!matrices) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrices(this._uniforms[uniformName], matrices);\r\n return this;\r\n };\r\n /**\r\n * Sets matrix on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix = function (uniformName, matrix) {\r\n if (this._cacheMatrix(uniformName, matrix)) {\r\n this._engine.setMatrices(this._uniforms[uniformName], matrix.toArray());\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a 3x3 matrix on a uniform variable. (Speicified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix3x3 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix3x3(this._uniforms[uniformName], matrix);\r\n return this;\r\n };\r\n /**\r\n * Sets a 2x2 matrix on a uniform variable. (Speicified as [1,2,3,4] will result in [1,2][3,4] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix2x2 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix2x2(this._uniforms[uniformName], matrix);\r\n return this;\r\n };\r\n /**\r\n * Sets a float on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = value;\r\n this._engine.setFloat(this._uniforms[uniformName], value);\r\n return this;\r\n };\r\n /**\r\n * Sets a boolean on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param bool value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setBool = function (uniformName, bool) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === bool) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = bool;\r\n this._engine.setBool(this._uniforms[uniformName], bool ? 1 : 0);\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector2 vector2 to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector2 = function (uniformName, vector2) {\r\n if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {\r\n this._engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float2.\r\n * @param y Second float in float2.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat2 = function (uniformName, x, y) {\r\n if (this._cacheFloat2(uniformName, x, y)) {\r\n this._engine.setFloat2(this._uniforms[uniformName], x, y);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector3 = function (uniformName, vector3) {\r\n if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float3.\r\n * @param y Second float in float3.\r\n * @param z Third float in float3.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat3 = function (uniformName, x, y, z) {\r\n if (this._cacheFloat3(uniformName, x, y, z)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], x, y, z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector4 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector4 = function (uniformName, vector4) {\r\n if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float4.\r\n * @param y Second float in float4.\r\n * @param z Third float in float4.\r\n * @param w Fourth float in float4.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat4 = function (uniformName, x, y, z, w) {\r\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], x, y, z, w);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor3 = function (uniformName, color3) {\r\n if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @param alpha Alpha value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor4 = function (uniformName, color3, alpha) {\r\n if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniformName defines the name of the variable\r\n * @param color4 defines the value to be set\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setDirectColor4 = function (uniformName, color4) {\r\n if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {\r\n this._engine.setDirectColor4(this._uniforms[uniformName], color4);\r\n }\r\n return this;\r\n };\r\n /** Release all associated resources */\r\n Effect.prototype.dispose = function () {\r\n this._engine._releaseEffect(this);\r\n };\r\n /**\r\n * This function will add a new shader to the shader store\r\n * @param name the name of the shader\r\n * @param pixelShader optional pixel shader content\r\n * @param vertexShader optional vertex shader content\r\n */\r\n Effect.RegisterShader = function (name, pixelShader, vertexShader) {\r\n if (pixelShader) {\r\n Effect.ShadersStore[name + \"PixelShader\"] = pixelShader;\r\n }\r\n if (vertexShader) {\r\n Effect.ShadersStore[name + \"VertexShader\"] = vertexShader;\r\n }\r\n };\r\n /**\r\n * Resets the cache of effects.\r\n */\r\n Effect.ResetCache = function () {\r\n Effect._baseCache = {};\r\n };\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n Effect.ShadersRepository = \"src/Shaders/\";\r\n Effect._uniqueIdSeed = 0;\r\n Effect._baseCache = {};\r\n /**\r\n * Store of each shader (The can be looked up using effect.key)\r\n */\r\n Effect.ShadersStore = {};\r\n /**\r\n * Store of each included file for a shader (The can be looked up using effect.key)\r\n */\r\n Effect.IncludesShadersStore = {};\r\n return Effect;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/effectRenderer.ts\":\n/*!*************************************!*\\\n !*** ./Materials/effectRenderer.ts ***!\n \\*************************************/\n/*! exports provided: EffectRenderer, EffectWrapper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return EffectRenderer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return EffectWrapper; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Shaders_postprocess_vertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/postprocess.vertex */ \"./Shaders/postprocess.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Prevents ES6 Crash if not imported.\r\n\r\n/**\r\n * Helper class to render one or more effects\r\n */\r\nvar EffectRenderer = /** @class */ (function () {\r\n /**\r\n * Creates an effect renderer\r\n * @param engine the engine to use for rendering\r\n * @param options defines the options of the effect renderer\r\n */\r\n function EffectRenderer(engine, options) {\r\n var _a;\r\n if (options === void 0) { options = EffectRenderer._DefaultOptions; }\r\n this.engine = engine;\r\n this._ringBufferIndex = 0;\r\n this._ringScreenBuffer = null;\r\n this._fullscreenViewport = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_3__[\"Viewport\"](0, 0, 1, 1);\r\n options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, EffectRenderer._DefaultOptions, options);\r\n this._vertexBuffers = (_a = {},\r\n _a[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"](engine, options.positions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, false, false, 2),\r\n _a);\r\n this._indexBuffer = engine.createIndexBuffer(options.indices);\r\n // No need here for full screen render.\r\n engine.setDepthBuffer(false);\r\n engine.setStencilBuffer(false);\r\n }\r\n EffectRenderer.prototype._getNextFrameBuffer = function (incrementIndex) {\r\n if (incrementIndex === void 0) { incrementIndex = true; }\r\n if (!this._ringScreenBuffer) {\r\n this._ringScreenBuffer = [];\r\n for (var i = 0; i < 2; i++) {\r\n var internalTexture = this.engine.createRenderTargetTexture({\r\n width: this.engine.getRenderWidth(true),\r\n height: this.engine.getRenderHeight(true),\r\n }, {\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n generateMipMaps: false,\r\n samplingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURE_NEAREST_NEAREST,\r\n });\r\n var texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](\"\", null);\r\n texture._texture = internalTexture;\r\n this._ringScreenBuffer.push(texture);\r\n }\r\n }\r\n var ret = this._ringScreenBuffer[this._ringBufferIndex];\r\n if (incrementIndex) {\r\n this._ringBufferIndex = (this._ringBufferIndex + 1) % 2;\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Sets the current viewport in normalized coordinates 0-1\r\n * @param viewport Defines the viewport to set (defaults to 0 0 1 1)\r\n */\r\n EffectRenderer.prototype.setViewport = function (viewport) {\r\n if (viewport === void 0) { viewport = this._fullscreenViewport; }\r\n this.engine.setViewport(viewport);\r\n };\r\n /**\r\n * Binds the embedded attributes buffer to the effect.\r\n * @param effect Defines the effect to bind the attributes for\r\n */\r\n EffectRenderer.prototype.bindBuffers = function (effect) {\r\n this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n };\r\n /**\r\n * Sets the current effect wrapper to use during draw.\r\n * The effect needs to be ready before calling this api.\r\n * This also sets the default full screen position attribute.\r\n * @param effectWrapper Defines the effect to draw with\r\n */\r\n EffectRenderer.prototype.applyEffectWrapper = function (effectWrapper) {\r\n this.engine.enableEffect(effectWrapper.effect);\r\n this.bindBuffers(effectWrapper.effect);\r\n effectWrapper.onApplyObservable.notifyObservers({});\r\n };\r\n /**\r\n * Draws a full screen quad.\r\n */\r\n EffectRenderer.prototype.draw = function () {\r\n this.engine.drawElementsType(_Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_TriangleFillMode, 0, 6);\r\n };\r\n /**\r\n * renders one or more effects to a specified texture\r\n * @param effectWrappers list of effects to renderer\r\n * @param outputTexture texture to draw to, if null it will render to the screen\r\n */\r\n EffectRenderer.prototype.render = function (effectWrappers, outputTexture) {\r\n var _this = this;\r\n if (outputTexture === void 0) { outputTexture = null; }\r\n if (!Array.isArray(effectWrappers)) {\r\n effectWrappers = [effectWrappers];\r\n }\r\n // Ensure all effects are ready\r\n for (var _i = 0, effectWrappers_1 = effectWrappers; _i < effectWrappers_1.length; _i++) {\r\n var wrapper = effectWrappers_1[_i];\r\n if (!wrapper.effect.isReady()) {\r\n return;\r\n }\r\n }\r\n effectWrappers.forEach(function (effectWrapper, i) {\r\n var renderTo = outputTexture;\r\n // for any next effect make it's input the output of the previous effect\r\n if (i !== 0) {\r\n effectWrapper.effect.onBindObservable.addOnce(function () {\r\n effectWrapper.effect.setTexture(\"textureSampler\", _this._getNextFrameBuffer(false));\r\n });\r\n }\r\n // Set the output to the next screenbuffer\r\n if (effectWrappers.length > 1 && i != effectWrappers.length - 1) {\r\n renderTo = _this._getNextFrameBuffer();\r\n }\r\n else {\r\n renderTo = outputTexture;\r\n }\r\n // Reset state\r\n _this.setViewport();\r\n _this.applyEffectWrapper(effectWrapper);\r\n if (renderTo) {\r\n _this.engine.bindFramebuffer(renderTo.getInternalTexture());\r\n }\r\n _this.draw();\r\n if (renderTo) {\r\n _this.engine.unBindFramebuffer(renderTo.getInternalTexture());\r\n }\r\n });\r\n };\r\n /**\r\n * Disposes of the effect renderer\r\n */\r\n EffectRenderer.prototype.dispose = function () {\r\n if (this._ringScreenBuffer) {\r\n this._ringScreenBuffer.forEach(function (b) {\r\n b.dispose();\r\n });\r\n this._ringScreenBuffer = null;\r\n }\r\n var vertexBuffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n delete this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind];\r\n }\r\n if (this._indexBuffer) {\r\n this.engine._releaseBuffer(this._indexBuffer);\r\n }\r\n };\r\n // Fullscreen quad buffers by default.\r\n EffectRenderer._DefaultOptions = {\r\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\r\n indices: [0, 1, 2, 0, 2, 3]\r\n };\r\n return EffectRenderer;\r\n}());\r\n\r\n/**\r\n * Wraps an effect to be used for rendering\r\n */\r\nvar EffectWrapper = /** @class */ (function () {\r\n /**\r\n * Creates an effect to be renderer\r\n * @param creationOptions options to create the effect\r\n */\r\n function EffectWrapper(creationOptions) {\r\n var _this = this;\r\n /**\r\n * Event that is fired right before the effect is drawn (should be used to update uniforms)\r\n */\r\n this.onApplyObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_5__[\"Observable\"]();\r\n var effectCreationOptions;\r\n var uniformNames = creationOptions.uniformNames || [];\r\n if (creationOptions.vertexShader) {\r\n effectCreationOptions = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertexSource: creationOptions.vertexShader,\r\n spectorName: creationOptions.name || \"effectWrapper\"\r\n };\r\n }\r\n else {\r\n // Default scale to use in post process vertex shader.\r\n uniformNames.push(\"scale\");\r\n effectCreationOptions = {\r\n fragmentSource: creationOptions.fragmentShader,\r\n vertex: \"postprocess\",\r\n spectorName: creationOptions.name || \"effectWrapper\"\r\n };\r\n // Sets the default scale to identity for the post process vertex shader.\r\n this.onApplyObservable.add(function () {\r\n _this.effect.setFloat2(\"scale\", 1, 1);\r\n });\r\n }\r\n this.effect = new _effect__WEBPACK_IMPORTED_MODULE_6__[\"Effect\"](effectCreationOptions, creationOptions.attributeNames || [\"position\"], uniformNames, creationOptions.samplerNames, creationOptions.engine);\r\n }\r\n /**\r\n * Disposes of the effect wrapper\r\n */\r\n EffectWrapper.prototype.dispose = function () {\r\n this.effect.dispose();\r\n };\r\n return EffectWrapper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/fresnelParameters.ts\":\n/*!****************************************!*\\\n !*** ./Materials/fresnelParameters.ts ***!\n \\****************************************/\n/*! exports provided: FresnelParameters */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return FresnelParameters; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents all the required information to add a fresnel effect on a material:\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_fresnelparameters\r\n */\r\nvar FresnelParameters = /** @class */ (function () {\r\n function FresnelParameters() {\r\n this._isEnabled = true;\r\n /**\r\n * Define the color used on edges (grazing angle)\r\n */\r\n this.leftColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].White();\r\n /**\r\n * Define the color used on center\r\n */\r\n this.rightColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].Black();\r\n /**\r\n * Define bias applied to computed fresnel term\r\n */\r\n this.bias = 0;\r\n /**\r\n * Defined the power exponent applied to fresnel term\r\n */\r\n this.power = 1;\r\n }\r\n Object.defineProperty(FresnelParameters.prototype, \"isEnabled\", {\r\n /**\r\n * Define if the fresnel effect is enable or not.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_2__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_FresnelDirtyFlag | _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clones the current fresnel and its valuues\r\n * @returns a clone fresnel configuration\r\n */\r\n FresnelParameters.prototype.clone = function () {\r\n var newFresnelParameters = new FresnelParameters();\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newFresnelParameters);\r\n return newFresnelParameters;\r\n };\r\n /**\r\n * Serializes the current fresnel parameters to a JSON representation.\r\n * @return the JSON serialization\r\n */\r\n FresnelParameters.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.isEnabled = this.isEnabled;\r\n serializationObject.leftColor = this.leftColor.asArray();\r\n serializationObject.rightColor = this.rightColor.asArray();\r\n serializationObject.bias = this.bias;\r\n serializationObject.power = this.power;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse a JSON object and deserialize it to a new Fresnel parameter object.\r\n * @param parsedFresnelParameters Define the JSON representation\r\n * @returns the parsed parameters\r\n */\r\n FresnelParameters.Parse = function (parsedFresnelParameters) {\r\n var fresnelParameters = new FresnelParameters();\r\n fresnelParameters.isEnabled = parsedFresnelParameters.isEnabled;\r\n fresnelParameters.leftColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].FromArray(parsedFresnelParameters.leftColor);\r\n fresnelParameters.rightColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"].FromArray(parsedFresnelParameters.rightColor);\r\n fresnelParameters.bias = parsedFresnelParameters.bias;\r\n fresnelParameters.power = parsedFresnelParameters.power || 1.0;\r\n return fresnelParameters;\r\n };\r\n return FresnelParameters;\r\n}());\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"]._FresnelParametersParser = FresnelParameters.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/imageProcessingConfiguration.ts\":\n/*!***************************************************!*\\\n !*** ./Materials/imageProcessingConfiguration.ts ***!\n \\***************************************************/\n/*! exports provided: ImageProcessingConfigurationDefines, ImageProcessingConfiguration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return ImageProcessingConfigurationDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return ImageProcessingConfiguration; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/colorCurves */ \"./Materials/colorCurves.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar ImageProcessingConfigurationDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageProcessingConfigurationDefines, _super);\r\n function ImageProcessingConfigurationDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n return ImageProcessingConfigurationDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_5__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * This groups together the common properties used for image processing either in direct forward pass\r\n * or through post processing effect depending on the use of the image processing pipeline in your scene\r\n * or not.\r\n */\r\nvar ImageProcessingConfiguration = /** @class */ (function () {\r\n function ImageProcessingConfiguration() {\r\n /**\r\n * Color curves setup used in the effect if colorCurvesEnabled is set to true\r\n */\r\n this.colorCurves = new _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__[\"ColorCurves\"]();\r\n this._colorCurvesEnabled = false;\r\n this._colorGradingEnabled = false;\r\n this._colorGradingWithGreenDepth = true;\r\n this._colorGradingBGR = true;\r\n /** @hidden */\r\n this._exposure = 1.0;\r\n this._toneMappingEnabled = false;\r\n this._toneMappingType = ImageProcessingConfiguration.TONEMAPPING_STANDARD;\r\n this._contrast = 1.0;\r\n /**\r\n * Vignette stretch size.\r\n */\r\n this.vignetteStretch = 0;\r\n /**\r\n * Vignette centre X Offset.\r\n */\r\n this.vignetteCentreX = 0;\r\n /**\r\n * Vignette centre Y Offset.\r\n */\r\n this.vignetteCentreY = 0;\r\n /**\r\n * Vignette weight or intensity of the vignette effect.\r\n */\r\n this.vignetteWeight = 1.5;\r\n /**\r\n * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n this.vignetteColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * Camera field of view used by the Vignette effect.\r\n */\r\n this.vignetteCameraFov = 0.5;\r\n this._vignetteBlendMode = ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;\r\n this._vignetteEnabled = false;\r\n this._applyByPostProcess = false;\r\n this._isEnabled = true;\r\n /**\r\n * An event triggered when the configuration changes and requires Shader to Update some parameters.\r\n */\r\n this.onUpdateParameters = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n }\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorCurvesEnabled === value) {\r\n return;\r\n }\r\n this._colorCurvesEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingTexture\", {\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n get: function () {\r\n return this._colorGradingTexture;\r\n },\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n set: function (value) {\r\n if (this._colorGradingTexture === value) {\r\n return;\r\n }\r\n this._colorGradingTexture = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorGradingEnabled;\r\n },\r\n /**\r\n * Sets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingEnabled === value) {\r\n return;\r\n }\r\n this._colorGradingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingWithGreenDepth\", {\r\n /**\r\n * Gets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n get: function () {\r\n return this._colorGradingWithGreenDepth;\r\n },\r\n /**\r\n * Sets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingWithGreenDepth === value) {\r\n return;\r\n }\r\n this._colorGradingWithGreenDepth = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingBGR\", {\r\n /**\r\n * Gets wether the color grading texture contains BGR values.\r\n */\r\n get: function () {\r\n return this._colorGradingBGR;\r\n },\r\n /**\r\n * Sets wether the color grading texture contains BGR values.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingBGR === value) {\r\n return;\r\n }\r\n this._colorGradingBGR = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"exposure\", {\r\n /**\r\n * Gets the Exposure used in the effect.\r\n */\r\n get: function () {\r\n return this._exposure;\r\n },\r\n /**\r\n * Sets the Exposure used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._exposure === value) {\r\n return;\r\n }\r\n this._exposure = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingEnabled\", {\r\n /**\r\n * Gets wether the tone mapping effect is enabled.\r\n */\r\n get: function () {\r\n return this._toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether the tone mapping effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingEnabled === value) {\r\n return;\r\n }\r\n this._toneMappingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingType\", {\r\n /**\r\n * Gets the type of tone mapping effect.\r\n */\r\n get: function () {\r\n return this._toneMappingType;\r\n },\r\n /**\r\n * Sets the type of tone mapping effect used in BabylonJS.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingType === value) {\r\n return;\r\n }\r\n this._toneMappingType = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"contrast\", {\r\n /**\r\n * Gets the contrast used in the effect.\r\n */\r\n get: function () {\r\n return this._contrast;\r\n },\r\n /**\r\n * Sets the contrast used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._contrast === value) {\r\n return;\r\n }\r\n this._contrast = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteBlendMode\", {\r\n /**\r\n * Gets the vignette blend mode allowing different kind of effect.\r\n */\r\n get: function () {\r\n return this._vignetteBlendMode;\r\n },\r\n /**\r\n * Sets the vignette blend mode allowing different kind of effect.\r\n */\r\n set: function (value) {\r\n if (this._vignetteBlendMode === value) {\r\n return;\r\n }\r\n this._vignetteBlendMode = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteEnabled\", {\r\n /**\r\n * Gets wether the vignette effect is enabled.\r\n */\r\n get: function () {\r\n return this._vignetteEnabled;\r\n },\r\n /**\r\n * Sets wether the vignette effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._vignetteEnabled === value) {\r\n return;\r\n }\r\n this._vignetteEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"applyByPostProcess\", {\r\n /**\r\n * Gets wether the image processing is applied through a post process or not.\r\n */\r\n get: function () {\r\n return this._applyByPostProcess;\r\n },\r\n /**\r\n * Sets wether the image processing is applied through a post process or not.\r\n */\r\n set: function (value) {\r\n if (this._applyByPostProcess === value) {\r\n return;\r\n }\r\n this._applyByPostProcess = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"isEnabled\", {\r\n /**\r\n * Gets wether the image processing is enabled or not.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * Sets wether the image processing is enabled or not.\r\n */\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Method called each time the image processing information changes requires to recompile the effect.\r\n */\r\n ImageProcessingConfiguration.prototype._updateParameters = function () {\r\n this.onUpdateParameters.notifyObservers(this);\r\n };\r\n /**\r\n * Gets the current class name.\r\n * @return \"ImageProcessingConfiguration\"\r\n */\r\n ImageProcessingConfiguration.prototype.getClassName = function () {\r\n return \"ImageProcessingConfiguration\";\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the Image Processing effects.\r\n * @param uniforms The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareUniforms = function (uniforms, defines) {\r\n if (defines.EXPOSURE) {\r\n uniforms.push(\"exposureLinear\");\r\n }\r\n if (defines.CONTRAST) {\r\n uniforms.push(\"contrast\");\r\n }\r\n if (defines.COLORGRADING) {\r\n uniforms.push(\"colorTransformSettings\");\r\n }\r\n if (defines.VIGNETTE) {\r\n uniforms.push(\"vInverseScreenSize\");\r\n uniforms.push(\"vignetteSettings1\");\r\n uniforms.push(\"vignetteSettings2\");\r\n }\r\n if (defines.COLORCURVES) {\r\n _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__[\"ColorCurves\"].PrepareUniforms(uniforms);\r\n }\r\n };\r\n /**\r\n * Prepare the list of samplers associated with the Image Processing effects.\r\n * @param samplersList The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareSamplers = function (samplersList, defines) {\r\n if (defines.COLORGRADING) {\r\n samplersList.push(\"txColorTransform\");\r\n }\r\n };\r\n /**\r\n * Prepare the list of defines associated to the shader.\r\n * @param defines the list of defines to complete\r\n * @param forPostProcess Define if we are currently in post process mode or not\r\n */\r\n ImageProcessingConfiguration.prototype.prepareDefines = function (defines, forPostProcess) {\r\n if (forPostProcess === void 0) { forPostProcess = false; }\r\n if (forPostProcess !== this.applyByPostProcess || !this._isEnabled) {\r\n defines.VIGNETTE = false;\r\n defines.TONEMAPPING = false;\r\n defines.TONEMAPPING_ACES = false;\r\n defines.CONTRAST = false;\r\n defines.EXPOSURE = false;\r\n defines.COLORCURVES = false;\r\n defines.COLORGRADING = false;\r\n defines.COLORGRADING3D = false;\r\n defines.IMAGEPROCESSING = false;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess && this._isEnabled;\r\n return;\r\n }\r\n defines.VIGNETTE = this.vignetteEnabled;\r\n defines.VIGNETTEBLENDMODEMULTIPLY = (this.vignetteBlendMode === ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY);\r\n defines.VIGNETTEBLENDMODEOPAQUE = !defines.VIGNETTEBLENDMODEMULTIPLY;\r\n defines.TONEMAPPING = this.toneMappingEnabled;\r\n switch (this._toneMappingType) {\r\n case ImageProcessingConfiguration.TONEMAPPING_ACES:\r\n defines.TONEMAPPING_ACES = true;\r\n break;\r\n default:\r\n defines.TONEMAPPING_ACES = false;\r\n break;\r\n }\r\n defines.CONTRAST = (this.contrast !== 1.0);\r\n defines.EXPOSURE = (this.exposure !== 1.0);\r\n defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);\r\n defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);\r\n if (defines.COLORGRADING) {\r\n defines.COLORGRADING3D = this.colorGradingTexture.is3D;\r\n }\r\n else {\r\n defines.COLORGRADING3D = false;\r\n }\r\n defines.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth;\r\n defines.SAMPLER3DBGRMAP = this.colorGradingBGR;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess;\r\n defines.IMAGEPROCESSING = defines.VIGNETTE || defines.TONEMAPPING || defines.CONTRAST || defines.EXPOSURE || defines.COLORCURVES || defines.COLORGRADING;\r\n };\r\n /**\r\n * Returns true if all the image processing information are ready.\r\n * @returns True if ready, otherwise, false\r\n */\r\n ImageProcessingConfiguration.prototype.isReady = function () {\r\n // Color Grading texure can not be none blocking.\r\n return !this.colorGradingEnabled || !this.colorGradingTexture || this.colorGradingTexture.isReady();\r\n };\r\n /**\r\n * Binds the image processing to the shader.\r\n * @param effect The effect to bind to\r\n * @param aspectRatio Define the current aspect ratio of the effect\r\n */\r\n ImageProcessingConfiguration.prototype.bind = function (effect, aspectRatio) {\r\n if (aspectRatio === void 0) { aspectRatio = 1; }\r\n // Color Curves\r\n if (this._colorCurvesEnabled && this.colorCurves) {\r\n _Materials_colorCurves__WEBPACK_IMPORTED_MODULE_6__[\"ColorCurves\"].Bind(this.colorCurves, effect);\r\n }\r\n // Vignette\r\n if (this._vignetteEnabled) {\r\n var inverseWidth = 1 / effect.getEngine().getRenderWidth();\r\n var inverseHeight = 1 / effect.getEngine().getRenderHeight();\r\n effect.setFloat2(\"vInverseScreenSize\", inverseWidth, inverseHeight);\r\n var vignetteScaleY = Math.tan(this.vignetteCameraFov * 0.5);\r\n var vignetteScaleX = vignetteScaleY * aspectRatio;\r\n var vignetteScaleGeometricMean = Math.sqrt(vignetteScaleX * vignetteScaleY);\r\n vignetteScaleX = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].Mix(vignetteScaleX, vignetteScaleGeometricMean, this.vignetteStretch);\r\n vignetteScaleY = _Misc_tools__WEBPACK_IMPORTED_MODULE_3__[\"Tools\"].Mix(vignetteScaleY, vignetteScaleGeometricMean, this.vignetteStretch);\r\n effect.setFloat4(\"vignetteSettings1\", vignetteScaleX, vignetteScaleY, -vignetteScaleX * this.vignetteCentreX, -vignetteScaleY * this.vignetteCentreY);\r\n var vignettePower = -2.0 * this.vignetteWeight;\r\n effect.setFloat4(\"vignetteSettings2\", this.vignetteColor.r, this.vignetteColor.g, this.vignetteColor.b, vignettePower);\r\n }\r\n // Exposure\r\n effect.setFloat(\"exposureLinear\", this.exposure);\r\n // Contrast\r\n effect.setFloat(\"contrast\", this.contrast);\r\n // Color transform settings\r\n if (this.colorGradingTexture) {\r\n effect.setTexture(\"txColorTransform\", this.colorGradingTexture);\r\n var textureSize = this.colorGradingTexture.getSize().height;\r\n effect.setFloat4(\"colorTransformSettings\", (textureSize - 1) / textureSize, // textureScale\r\n 0.5 / textureSize, // textureOffset\r\n textureSize, // textureSize\r\n this.colorGradingTexture.level // weight\r\n );\r\n }\r\n };\r\n /**\r\n * Clones the current image processing instance.\r\n * @return The cloned image processing\r\n */\r\n ImageProcessingConfiguration.prototype.clone = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new ImageProcessingConfiguration(); }, this);\r\n };\r\n /**\r\n * Serializes the current image processing instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ImageProcessingConfiguration.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Parses the image processing from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed image processing\r\n */\r\n ImageProcessingConfiguration.Parse = function (source) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new ImageProcessingConfiguration(); }, source, null, null);\r\n };\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_MULTIPLY\", {\r\n /**\r\n * Used to apply the vignette as a mix with the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_MULTIPLY;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_OPAQUE\", {\r\n /**\r\n * Used to apply the vignette as a replacement of the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_OPAQUE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Default tone mapping applied in BabylonJS.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_STANDARD = 0;\r\n /**\r\n * ACES Tone mapping (used by default in unreal and unity). This can help getting closer\r\n * to other engines rendering to increase portability.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_ACES = 1;\r\n // Static constants associated to the image processing.\r\n ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY = 0;\r\n ImageProcessingConfiguration._VIGNETTEMODE_OPAQUE = 1;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColorCurves\"])()\r\n ], ImageProcessingConfiguration.prototype, \"colorCurves\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorCurvesEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"colorGradingTexture\")\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingWithGreenDepth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingBGR\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_exposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingType\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_contrast\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteStretch\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteWeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor4\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCameraFov\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteBlendMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_applyByPostProcess\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingConfiguration.prototype, \"_isEnabled\", void 0);\r\n return ImageProcessingConfiguration;\r\n}());\r\n\r\n// References the dependencies.\r\n_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"]._ImageProcessingConfigurationParser = ImageProcessingConfiguration.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/index.ts\":\n/*!****************************!*\\\n !*** ./Materials/index.ts ***!\n \\****************************/\n/*! exports provided: ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Background_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Background/index */ \"./Materials/Background/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _Background_index__WEBPACK_IMPORTED_MODULE_0__[\"BackgroundMaterial\"]; });\n\n/* harmony import */ var _colorCurves__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colorCurves */ \"./Materials/colorCurves.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return _colorCurves__WEBPACK_IMPORTED_MODULE_1__[\"ColorCurves\"]; });\n\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return _effect__WEBPACK_IMPORTED_MODULE_2__[\"EffectFallbacks\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return _effect__WEBPACK_IMPORTED_MODULE_2__[\"EffectCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return _effect__WEBPACK_IMPORTED_MODULE_2__[\"Effect\"]; });\n\n/* harmony import */ var _fresnelParameters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fresnelParameters */ \"./Materials/fresnelParameters.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return _fresnelParameters__WEBPACK_IMPORTED_MODULE_3__[\"FresnelParameters\"]; });\n\n/* harmony import */ var _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_4__[\"ImageProcessingConfigurationDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_4__[\"ImageProcessingConfiguration\"]; });\n\n/* harmony import */ var _material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./material */ \"./Materials/material.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return _material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"]; });\n\n/* harmony import */ var _materialDefines__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return _materialDefines__WEBPACK_IMPORTED_MODULE_6__[\"MaterialDefines\"]; });\n\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return _materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"]; });\n\n/* harmony import */ var _multiMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return _multiMaterial__WEBPACK_IMPORTED_MODULE_8__[\"MultiMaterial\"]; });\n\n/* harmony import */ var _PBR_index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./PBR/index */ \"./Materials/PBR/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRBaseMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _PBR_index__WEBPACK_IMPORTED_MODULE_9__[\"PBRSpecularGlossinessMaterial\"]; });\n\n/* harmony import */ var _pushMaterial__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return _pushMaterial__WEBPACK_IMPORTED_MODULE_10__[\"PushMaterial\"]; });\n\n/* harmony import */ var _shaderMaterial__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return _shaderMaterial__WEBPACK_IMPORTED_MODULE_11__[\"ShaderMaterial\"]; });\n\n/* harmony import */ var _standardMaterial__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return _standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return _standardMaterial__WEBPACK_IMPORTED_MODULE_12__[\"StandardMaterial\"]; });\n\n/* harmony import */ var _Textures_index__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Textures/index */ \"./Materials/Textures/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"BaseTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"CubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"DynamicTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"HDRCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"InternalTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"MirrorTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"MultiRenderTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RawTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RenderTargetTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"Texture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"ColorGradingTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RawCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RawTexture3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"RefractionTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"VideoTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"HtmlElementTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"_BasisTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _Textures_index__WEBPACK_IMPORTED_MODULE_13__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony import */ var _uniformBuffer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return _uniformBuffer__WEBPACK_IMPORTED_MODULE_14__[\"UniformBuffer\"]; });\n\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return _materialFlags__WEBPACK_IMPORTED_MODULE_15__[\"MaterialFlags\"]; });\n\n/* harmony import */ var _Node_index__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Node/index */ \"./Materials/Node/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"NodeMaterialOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Node_index__WEBPACK_IMPORTED_MODULE_16__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _effectRenderer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./effectRenderer */ \"./Materials/effectRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return _effectRenderer__WEBPACK_IMPORTED_MODULE_17__[\"EffectRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return _effectRenderer__WEBPACK_IMPORTED_MODULE_17__[\"EffectWrapper\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/material.ts\":\n/*!*******************************!*\\\n !*** ./Materials/material.ts ***!\n \\*******************************/\n/*! exports provided: Material */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return Material; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _uniformBuffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_plane__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.plane */ \"./Maths/math.plane.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class for the main features of a material in Babylon.js\r\n */\r\nvar Material = /** @class */ (function () {\r\n /**\r\n * Creates a material instance\r\n * @param name defines the name of the material\r\n * @param scene defines the scene to reference\r\n * @param doNotAdd specifies if the material should be added to the scene\r\n */\r\n function Material(name, scene, doNotAdd) {\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n /**\r\n * Specifies if the ready state should be checked on each call\r\n */\r\n this.checkReadyOnEveryCall = false;\r\n /**\r\n * Specifies if the ready state should be checked once\r\n */\r\n this.checkReadyOnlyOnce = false;\r\n /**\r\n * The state of the material\r\n */\r\n this.state = \"\";\r\n /**\r\n * The alpha value of the material\r\n */\r\n this._alpha = 1.0;\r\n /**\r\n * Specifies if back face culling is enabled\r\n */\r\n this._backFaceCulling = true;\r\n /**\r\n * Callback triggered when the material is compiled\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback triggered when an error occurs\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback triggered to get the render target textures\r\n */\r\n this.getRenderTargetTextures = null;\r\n /**\r\n * Specifies if the material should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n /**\r\n * @hidden\r\n */\r\n this._storeEffectOnSubMeshes = false;\r\n /**\r\n * Stores the animations for the material\r\n */\r\n this.animations = null;\r\n /**\r\n * An event triggered when the material is disposed\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An observer which watches for dispose events\r\n */\r\n this._onDisposeObserver = null;\r\n this._onUnBindObservable = null;\r\n /**\r\n * An observer which watches for bind events\r\n */\r\n this._onBindObserver = null;\r\n /**\r\n * Stores the value of the alpha mode\r\n */\r\n this._alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].ALPHA_COMBINE;\r\n /**\r\n * Stores the state of the need depth pre-pass value\r\n */\r\n this._needDepthPrePass = false;\r\n /**\r\n * Specifies if depth writing should be disabled\r\n */\r\n this.disableDepthWrite = false;\r\n /**\r\n * Specifies if depth writing should be forced\r\n */\r\n this.forceDepthWrite = false;\r\n /**\r\n * Specifies if there should be a separate pass for culling\r\n */\r\n this.separateCullingPass = false;\r\n /**\r\n * Stores the state specifing if fog should be enabled\r\n */\r\n this._fogEnabled = true;\r\n /**\r\n * Stores the size of points\r\n */\r\n this.pointSize = 1.0;\r\n /**\r\n * Stores the z offset value\r\n */\r\n this.zOffset = 0;\r\n /**\r\n * @hidden\r\n * Stores the effects for the material\r\n */\r\n this._effect = null;\r\n /**\r\n * @hidden\r\n * Specifies if the material was previously ready\r\n */\r\n this._wasPreviouslyReady = false;\r\n /**\r\n * Specifies if uniform buffers should be used\r\n */\r\n this._useUBO = false;\r\n /**\r\n * Stores the fill mode state\r\n */\r\n this._fillMode = Material.TriangleFillMode;\r\n /**\r\n * Specifies if the depth write state should be cached\r\n */\r\n this._cachedDepthWriteState = false;\r\n /** @hidden */\r\n this._indexInSceneMaterialArray = -1;\r\n /** @hidden */\r\n this.meshMap = null;\r\n this.name = name;\r\n this.id = name || _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].RandomId();\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene;\r\n this.uniqueId = this._scene.getUniqueId();\r\n if (this._scene.useRightHandedSystem) {\r\n this.sideOrientation = Material.ClockWiseSideOrientation;\r\n }\r\n else {\r\n this.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n }\r\n this._uniformBuffer = new _uniformBuffer__WEBPACK_IMPORTED_MODULE_6__[\"UniformBuffer\"](this._scene.getEngine());\r\n this._useUBO = this.getScene().getEngine().supportsUniformBuffers;\r\n if (!doNotAdd) {\r\n this._scene.addMaterial(this);\r\n }\r\n if (this._scene.useMaterialMeshMap) {\r\n this.meshMap = {};\r\n }\r\n }\r\n Object.defineProperty(Material.prototype, \"alpha\", {\r\n /**\r\n * Gets the alpha value of the material\r\n */\r\n get: function () {\r\n return this._alpha;\r\n },\r\n /**\r\n * Sets the alpha value of the material\r\n */\r\n set: function (value) {\r\n if (this._alpha === value) {\r\n return;\r\n }\r\n this._alpha = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"backFaceCulling\", {\r\n /**\r\n * Gets the back-face culling state\r\n */\r\n get: function () {\r\n return this._backFaceCulling;\r\n },\r\n /**\r\n * Sets the back-face culling state\r\n */\r\n set: function (value) {\r\n if (this._backFaceCulling === value) {\r\n return;\r\n }\r\n this._backFaceCulling = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onDispose\", {\r\n /**\r\n * Called during a dispose event\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBindObservable\", {\r\n /**\r\n * An event triggered when the material is bound\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBind\", {\r\n /**\r\n * Called during a bind event\r\n */\r\n set: function (callback) {\r\n if (this._onBindObserver) {\r\n this.onBindObservable.remove(this._onBindObserver);\r\n }\r\n this._onBindObserver = this.onBindObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onUnBindObservable\", {\r\n /**\r\n * An event triggered when the material is unbound\r\n */\r\n get: function () {\r\n if (!this._onUnBindObservable) {\r\n this._onUnBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n }\r\n return this._onUnBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"alphaMode\", {\r\n /**\r\n * Gets the value of the alpha mode\r\n */\r\n get: function () {\r\n return this._alphaMode;\r\n },\r\n /**\r\n * Sets the value of the alpha mode.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | ALPHA_DISABLE | |\r\n * | 1 | ALPHA_ADD | |\r\n * | 2 | ALPHA_COMBINE | |\r\n * | 3 | ALPHA_SUBTRACT | |\r\n * | 4 | ALPHA_MULTIPLY | |\r\n * | 5 | ALPHA_MAXIMIZED | |\r\n * | 6 | ALPHA_ONEONE | |\r\n * | 7 | ALPHA_PREMULTIPLIED | |\r\n * | 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |\r\n * | 9 | ALPHA_INTERPOLATE | |\r\n * | 10 | ALPHA_SCREENMODE | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._alphaMode === value) {\r\n return;\r\n }\r\n this._alphaMode = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"needDepthPrePass\", {\r\n /**\r\n * Gets the depth pre-pass value\r\n */\r\n get: function () {\r\n return this._needDepthPrePass;\r\n },\r\n /**\r\n * Sets the need depth pre-pass value\r\n */\r\n set: function (value) {\r\n if (this._needDepthPrePass === value) {\r\n return;\r\n }\r\n this._needDepthPrePass = value;\r\n if (this._needDepthPrePass) {\r\n this.checkReadyOnEveryCall = true;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fogEnabled\", {\r\n /**\r\n * Gets the value of the fog enabled state\r\n */\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Sets the state for enabling fog\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"wireframe\", {\r\n /**\r\n * Gets a value specifying if wireframe mode is enabled\r\n */\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.WireFrameFillMode:\r\n case Material.LineListDrawMode:\r\n case Material.LineLoopDrawMode:\r\n case Material.LineStripDrawMode:\r\n return true;\r\n }\r\n return this._scene.forceWireframe;\r\n },\r\n /**\r\n * Sets the state of wireframe mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.WireFrameFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"pointsCloud\", {\r\n /**\r\n * Gets the value specifying if point clouds are enabled\r\n */\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.PointFillMode:\r\n case Material.PointListDrawMode:\r\n return true;\r\n }\r\n return this._scene.forcePointsCloud;\r\n },\r\n /**\r\n * Sets the state of point cloud mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.PointFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fillMode\", {\r\n /**\r\n * Gets the material fill mode\r\n */\r\n get: function () {\r\n return this._fillMode;\r\n },\r\n /**\r\n * Sets the material fill mode\r\n */\r\n set: function (value) {\r\n if (this._fillMode === value) {\r\n return;\r\n }\r\n this._fillMode = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a string representation of the current material\r\n * @param fullDetails defines a boolean indicating which levels of logging is desired\r\n * @returns a string with material information\r\n */\r\n Material.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the class name of the material\r\n * @returns a string with the class name of the material\r\n */\r\n Material.prototype.getClassName = function () {\r\n return \"Material\";\r\n };\r\n Object.defineProperty(Material.prototype, \"isFrozen\", {\r\n /**\r\n * Specifies if updates for the material been locked\r\n */\r\n get: function () {\r\n return this.checkReadyOnlyOnce;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Locks updates for the material\r\n */\r\n Material.prototype.freeze = function () {\r\n this.checkReadyOnlyOnce = true;\r\n };\r\n /**\r\n * Unlocks updates for the material\r\n */\r\n Material.prototype.unfreeze = function () {\r\n this.checkReadyOnlyOnce = false;\r\n };\r\n /**\r\n * Specifies if the material is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param useInstances specifies if instances should be used\r\n * @returns a boolean indicating if the material is ready to be used\r\n */\r\n Material.prototype.isReady = function (mesh, useInstances) {\r\n return true;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n Material.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return false;\r\n };\r\n /**\r\n * Returns the material effect\r\n * @returns the effect associated with the material\r\n */\r\n Material.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * Returns the current scene\r\n * @returns a Scene\r\n */\r\n Material.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n Material.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0);\r\n };\r\n /**\r\n * Specifies if the mesh will require alpha blending\r\n * @param mesh defines the mesh to check\r\n * @returns a boolean specifying if alpha blending is needed for the mesh\r\n */\r\n Material.prototype.needAlphaBlendingForMesh = function (mesh) {\r\n return this.needAlphaBlending() || (mesh.visibility < 1.0) || mesh.hasVertexAlpha;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n Material.prototype.needAlphaTesting = function () {\r\n return false;\r\n };\r\n /**\r\n * Gets the texture used for the alpha test\r\n * @returns the texture to use for alpha testing\r\n */\r\n Material.prototype.getAlphaTestTexture = function () {\r\n return null;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n Material.prototype.markDirty = function () {\r\n this._wasPreviouslyReady = false;\r\n };\r\n /** @hidden */\r\n Material.prototype._preBind = function (effect, overrideOrientation) {\r\n if (overrideOrientation === void 0) { overrideOrientation = null; }\r\n var engine = this._scene.getEngine();\r\n var orientation = (overrideOrientation == null) ? this.sideOrientation : overrideOrientation;\r\n var reverse = orientation === Material.ClockWiseSideOrientation;\r\n engine.enableEffect(effect ? effect : this._effect);\r\n engine.setState(this.backFaceCulling, this.zOffset, false, reverse);\r\n return reverse;\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n */\r\n Material.prototype.bind = function (world, mesh) {\r\n };\r\n /**\r\n * Binds the submesh to the material\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n Material.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n Material.prototype.bindOnlyWorldMatrix = function (world) {\r\n };\r\n /**\r\n * Binds the scene's uniform buffer to the effect.\r\n * @param effect defines the effect to bind to the scene uniform buffer\r\n * @param sceneUbo defines the uniform buffer storing scene data\r\n */\r\n Material.prototype.bindSceneUniformBuffer = function (effect, sceneUbo) {\r\n sceneUbo.bindToEffect(effect, \"Scene\");\r\n };\r\n /**\r\n * Binds the view matrix to the effect\r\n * @param effect defines the effect to bind the view matrix to\r\n */\r\n Material.prototype.bindView = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Binds the view projection matrix to the effect\r\n * @param effect defines the effect to bind the view projection matrix to\r\n */\r\n Material.prototype.bindViewProjection = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Specifies if material alpha testing should be turned on for the mesh\r\n * @param mesh defines the mesh to check\r\n */\r\n Material.prototype._shouldTurnAlphaTestOn = function (mesh) {\r\n return (!this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting());\r\n };\r\n /**\r\n * Processes to execute after binding the material to a mesh\r\n * @param mesh defines the rendered mesh\r\n */\r\n Material.prototype._afterBind = function (mesh) {\r\n this._scene._cachedMaterial = this;\r\n if (mesh) {\r\n this._scene._cachedVisibility = mesh.visibility;\r\n }\r\n else {\r\n this._scene._cachedVisibility = 1;\r\n }\r\n if (this._onBindObservable && mesh) {\r\n this._onBindObservable.notifyObservers(mesh);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n this._cachedDepthWriteState = engine.getDepthWrite();\r\n engine.setDepthWrite(false);\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n Material.prototype.unbind = function () {\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.notifyObservers(this);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n engine.setDepthWrite(this._cachedDepthWriteState);\r\n }\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n Material.prototype.getActiveTextures = function () {\r\n return [];\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n Material.prototype.hasTexture = function (texture) {\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n Material.prototype.clone = function (name) {\r\n return null;\r\n };\r\n /**\r\n * Gets the meshes bound to the material\r\n * @returns an array of meshes bound to the material\r\n */\r\n Material.prototype.getBindedMeshes = function () {\r\n var _this = this;\r\n if (this.meshMap) {\r\n var result = new Array();\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n result.push(mesh);\r\n }\r\n }\r\n return result;\r\n }\r\n else {\r\n var meshes = this._scene.meshes;\r\n return meshes.filter(function (mesh) { return mesh.material === _this; });\r\n }\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh associated with this material\r\n * @param onCompiled defines a function to execute once the material is compiled\r\n * @param options defines the options to configure the compilation\r\n */\r\n Material.prototype.forceCompilation = function (mesh, onCompiled, options) {\r\n var _this = this;\r\n var localOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ clipPlane: false }, options);\r\n var subMesh = new _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_5__[\"BaseSubMesh\"]();\r\n var scene = this.getScene();\r\n var checkReady = function () {\r\n if (!_this._scene || !_this._scene.getEngine()) {\r\n return;\r\n }\r\n if (subMesh._materialDefines) {\r\n subMesh._materialDefines._renderId = -1;\r\n }\r\n var clipPlaneState = scene.clipPlane;\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = new _Maths_math_plane__WEBPACK_IMPORTED_MODULE_9__[\"Plane\"](0, 0, 0, 1);\r\n }\r\n if (_this._storeEffectOnSubMeshes) {\r\n if (_this.isReadyForSubMesh(mesh, subMesh)) {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n else {\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n else {\r\n if (_this.isReady()) {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n else {\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = clipPlaneState;\r\n }\r\n };\r\n checkReady();\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh that will use this material\r\n * @param options defines additional options for compiling the shaders\r\n * @returns a promise that resolves when the compilation completes\r\n */\r\n Material.prototype.forceCompilationAsync = function (mesh, options) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.forceCompilation(mesh, function () {\r\n resolve();\r\n }, options);\r\n });\r\n };\r\n /**\r\n * Marks a define in the material to indicate that it needs to be re-computed\r\n * @param flag defines a flag used to determine which parts of the material have to be marked as dirty\r\n */\r\n Material.prototype.markAsDirty = function (flag) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n Material._DirtyCallbackArray.length = 0;\r\n if (flag & Material.TextureDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._TextureDirtyCallBack);\r\n }\r\n if (flag & Material.LightDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._LightsDirtyCallBack);\r\n }\r\n if (flag & Material.FresnelDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._FresnelDirtyCallBack);\r\n }\r\n if (flag & Material.AttributesDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._AttributeDirtyCallBack);\r\n }\r\n if (flag & Material.MiscDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._MiscDirtyCallBack);\r\n }\r\n if (Material._DirtyCallbackArray.length) {\r\n this._markAllSubMeshesAsDirty(Material._RunDirtyCallBacks);\r\n }\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Marks all submeshes of a material to indicate that their material defines need to be re-calculated\r\n * @param func defines a function which checks material defines against the submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsDirty = function (func) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh._materialDefines) {\r\n continue;\r\n }\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /**\r\n * Indicates that we need to re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAllDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AllDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that image processing needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsImageProcessingDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._ImageProcessingDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that lights need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsLightsDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._LightsDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that attributes need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAttributesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AttributeDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that misc needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n var scene = this.getScene();\r\n // Animations\r\n scene.stopAnimation(this);\r\n scene.freeProcessedMaterials();\r\n // Remove from scene\r\n scene.removeMaterial(this);\r\n if (notBoundToMesh !== true) {\r\n // Remove from meshes\r\n if (this.meshMap) {\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n mesh.material = null; // will set the entry in the map to undefined\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n else {\r\n var meshes = scene.meshes;\r\n for (var _i = 0, meshes_2 = meshes; _i < meshes_2.length; _i++) {\r\n var mesh = meshes_2[_i];\r\n if (mesh.material === this && !mesh.sourceMesh) {\r\n mesh.material = null;\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n }\r\n this._uniformBuffer.dispose();\r\n // Shader are kept in cache for further use but we can get rid of this by using forceDisposeEffect\r\n if (forceDisposeEffect && this._effect) {\r\n if (!this._storeEffectOnSubMeshes) {\r\n this._effect.dispose();\r\n }\r\n this._effect = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n if (this._onBindObservable) {\r\n this._onBindObservable.clear();\r\n }\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.clear();\r\n }\r\n };\r\n /** @hidden */\r\n Material.prototype.releaseVertexArrayObject = function (mesh, forceDisposeEffect) {\r\n if (mesh.geometry) {\r\n var geometry = (mesh.geometry);\r\n if (this._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _a = mesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n geometry._releaseVertexArrayObject(subMesh._materialEffect);\r\n if (forceDisposeEffect && subMesh._materialEffect) {\r\n subMesh._materialEffect.dispose();\r\n }\r\n }\r\n }\r\n else {\r\n geometry._releaseVertexArrayObject(this._effect);\r\n }\r\n }\r\n };\r\n /**\r\n * Serializes this material\r\n * @returns the serialized material object\r\n */\r\n Material.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedMaterial defines parsed material data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new material\r\n */\r\n Material.Parse = function (parsedMaterial, scene, rootUrl) {\r\n if (!parsedMaterial.customType) {\r\n parsedMaterial.customType = \"BABYLON.StandardMaterial\";\r\n }\r\n else if (parsedMaterial.customType === \"BABYLON.PBRMaterial\" && parsedMaterial.overloadedAlbedo) {\r\n parsedMaterial.customType = \"BABYLON.LegacyPBRMaterial\";\r\n if (!BABYLON.LegacyPBRMaterial) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Error(\"Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library.\");\r\n return null;\r\n }\r\n }\r\n var materialType = _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].Instantiate(parsedMaterial.customType);\r\n return materialType.Parse(parsedMaterial, scene, rootUrl);\r\n };\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Material.TriangleFillMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFillMode;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Material.WireFrameFillMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_WireFrameFillMode;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Material.PointFillMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointFillMode;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Material.PointListDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_PointListDrawMode;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Material.LineListDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineListDrawMode;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Material.LineLoopDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineLoopDrawMode;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Material.LineStripDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LineStripDrawMode;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Material.TriangleStripDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleStripDrawMode;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Material.TriangleFanDrawMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TriangleFanDrawMode;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Material.ClockWiseSideOrientation = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_ClockWiseSideOrientation;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Material.CounterClockWiseSideOrientation = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_CounterClockWiseSideOrientation;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Material.TextureDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_TextureDirtyFlag;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Material.LightDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_LightDirtyFlag;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Material.FresnelDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_FresnelDirtyFlag;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Material.AttributesDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_AttributesDirtyFlag;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Material.MiscDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_MiscDirtyFlag;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Material.AllDirtyFlag = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].MATERIAL_AllDirtyFlag;\r\n Material._AllDirtyCallBack = function (defines) { return defines.markAllAsDirty(); };\r\n Material._ImageProcessingDirtyCallBack = function (defines) { return defines.markAsImageProcessingDirty(); };\r\n Material._TextureDirtyCallBack = function (defines) { return defines.markAsTexturesDirty(); };\r\n Material._FresnelDirtyCallBack = function (defines) { return defines.markAsFresnelDirty(); };\r\n Material._MiscDirtyCallBack = function (defines) { return defines.markAsMiscDirty(); };\r\n Material._LightsDirtyCallBack = function (defines) { return defines.markAsLightDirty(); };\r\n Material._AttributeDirtyCallBack = function (defines) { return defines.markAsAttributesDirty(); };\r\n Material._FresnelAndMiscDirtyCallBack = function (defines) {\r\n Material._FresnelDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._TextureAndMiscDirtyCallBack = function (defines) {\r\n Material._TextureDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._DirtyCallbackArray = [];\r\n Material._RunDirtyCallBacks = function (defines) {\r\n for (var _i = 0, _a = Material._DirtyCallbackArray; _i < _a.length; _i++) {\r\n var cb = _a[_i];\r\n cb(defines);\r\n }\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"id\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"uniqueId\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"checkReadyOnEveryCall\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"checkReadyOnlyOnce\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"state\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"alpha\")\r\n ], Material.prototype, \"_alpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"backFaceCulling\")\r\n ], Material.prototype, \"_backFaceCulling\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"sideOrientation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"alphaMode\")\r\n ], Material.prototype, \"_alphaMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"_needDepthPrePass\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"disableDepthWrite\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"forceDepthWrite\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"separateCullingPass\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"fogEnabled\")\r\n ], Material.prototype, \"_fogEnabled\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"pointSize\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"zOffset\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"wireframe\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"pointsCloud\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], Material.prototype, \"fillMode\", null);\r\n return Material;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/materialDefines.ts\":\n/*!**************************************!*\\\n !*** ./Materials/materialDefines.ts ***!\n \\**************************************/\n/*! exports provided: MaterialDefines */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return MaterialDefines; });\n/**\r\n * Manages the defines for the Material\r\n */\r\nvar MaterialDefines = /** @class */ (function () {\r\n function MaterialDefines() {\r\n this._isDirty = true;\r\n /** @hidden */\r\n this._areLightsDirty = true;\r\n /** @hidden */\r\n this._areLightsDisposed = false;\r\n /** @hidden */\r\n this._areAttributesDirty = true;\r\n /** @hidden */\r\n this._areTexturesDirty = true;\r\n /** @hidden */\r\n this._areFresnelDirty = true;\r\n /** @hidden */\r\n this._areMiscDirty = true;\r\n /** @hidden */\r\n this._areImageProcessingDirty = true;\r\n /** @hidden */\r\n this._normals = false;\r\n /** @hidden */\r\n this._uvs = false;\r\n /** @hidden */\r\n this._needNormals = false;\r\n /** @hidden */\r\n this._needUVs = false;\r\n }\r\n Object.defineProperty(MaterialDefines.prototype, \"isDirty\", {\r\n /**\r\n * Specifies if the material needs to be re-calculated\r\n */\r\n get: function () {\r\n return this._isDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Marks the material to indicate that it has been re-calculated\r\n */\r\n MaterialDefines.prototype.markAsProcessed = function () {\r\n this._isDirty = false;\r\n this._areAttributesDirty = false;\r\n this._areTexturesDirty = false;\r\n this._areFresnelDirty = false;\r\n this._areLightsDirty = false;\r\n this._areLightsDisposed = false;\r\n this._areMiscDirty = false;\r\n this._areImageProcessingDirty = false;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsUnprocessed = function () {\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate all of its defines need to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAllAsDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._areAttributesDirty = true;\r\n this._areLightsDirty = true;\r\n this._areFresnelDirty = true;\r\n this._areMiscDirty = true;\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate that image processing needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsImageProcessingDirty = function () {\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate the lights need to be re-calculated\r\n * @param disposed Defines whether the light is dirty due to dispose or not\r\n */\r\n MaterialDefines.prototype.markAsLightDirty = function (disposed) {\r\n if (disposed === void 0) { disposed = false; }\r\n this._areLightsDirty = true;\r\n this._areLightsDisposed = this._areLightsDisposed || disposed;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the attribute state as changed\r\n */\r\n MaterialDefines.prototype.markAsAttributesDirty = function () {\r\n this._areAttributesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the texture state as changed\r\n */\r\n MaterialDefines.prototype.markAsTexturesDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the fresnel state as changed\r\n */\r\n MaterialDefines.prototype.markAsFresnelDirty = function () {\r\n this._areFresnelDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the misc state as changed\r\n */\r\n MaterialDefines.prototype.markAsMiscDirty = function () {\r\n this._areMiscDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Rebuilds the material defines\r\n */\r\n MaterialDefines.prototype.rebuild = function () {\r\n if (this._keys) {\r\n delete this._keys;\r\n }\r\n this._keys = [];\r\n for (var _i = 0, _a = Object.keys(this); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n if (key[0] === \"_\") {\r\n continue;\r\n }\r\n this._keys.push(key);\r\n }\r\n };\r\n /**\r\n * Specifies if two material defines are equal\r\n * @param other - A material define instance to compare to\r\n * @returns - Boolean indicating if the material defines are equal (true) or not (false)\r\n */\r\n MaterialDefines.prototype.isEqual = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n return false;\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n if (this[prop] !== other[prop]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones this instance's defines to another instance\r\n * @param other - material defines to clone values to\r\n */\r\n MaterialDefines.prototype.cloneTo = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n other._keys = this._keys.slice(0);\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n other[prop] = this[prop];\r\n }\r\n };\r\n /**\r\n * Resets the material define values\r\n */\r\n MaterialDefines.prototype.reset = function () {\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var type = typeof this[prop];\r\n switch (type) {\r\n case \"number\":\r\n this[prop] = 0;\r\n break;\r\n case \"string\":\r\n this[prop] = \"\";\r\n break;\r\n default:\r\n this[prop] = false;\r\n break;\r\n }\r\n }\r\n };\r\n /**\r\n * Converts the material define values to a string\r\n * @returns - String of material define information\r\n */\r\n MaterialDefines.prototype.toString = function () {\r\n var result = \"\";\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var value = this[prop];\r\n var type = typeof value;\r\n switch (type) {\r\n case \"number\":\r\n case \"string\":\r\n result += \"#define \" + prop + \" \" + value + \"\\n\";\r\n break;\r\n default:\r\n if (value) {\r\n result += \"#define \" + prop + \"\\n\";\r\n }\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n return MaterialDefines;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/materialFlags.ts\":\n/*!************************************!*\\\n !*** ./Materials/materialFlags.ts ***!\n \\************************************/\n/*! exports provided: MaterialFlags */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return MaterialFlags; });\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n/**\r\n * This groups all the flags used to control the materials channel.\r\n */\r\nvar MaterialFlags = /** @class */ (function () {\r\n function MaterialFlags() {\r\n }\r\n Object.defineProperty(MaterialFlags, \"DiffuseTextureEnabled\", {\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._DiffuseTextureEnabled === value) {\r\n return;\r\n }\r\n this._DiffuseTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AmbientTextureEnabled === value) {\r\n return;\r\n }\r\n this._AmbientTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._OpacityTextureEnabled === value) {\r\n return;\r\n }\r\n this._OpacityTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ReflectionTextureEnabled === value) {\r\n return;\r\n }\r\n this._ReflectionTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._EmissiveTextureEnabled === value) {\r\n return;\r\n }\r\n this._EmissiveTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SpecularTextureEnabled === value) {\r\n return;\r\n }\r\n this._SpecularTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._BumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._BumpTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._LightmapTextureEnabled === value) {\r\n return;\r\n }\r\n this._LightmapTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._RefractionTextureEnabled === value) {\r\n return;\r\n }\r\n this._RefractionTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ColorGradingTextureEnabled === value) {\r\n return;\r\n }\r\n this._ColorGradingTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return this._FresnelEnabled;\r\n },\r\n set: function (value) {\r\n if (this._FresnelEnabled === value) {\r\n return;\r\n }\r\n this._FresnelEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_FresnelDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTextureEnabled\", {\r\n /**\r\n * Are clear coat textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatBumpTextureEnabled\", {\r\n /**\r\n * Are clear coat bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatBumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatBumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatBumpTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTintTextureEnabled\", {\r\n /**\r\n * Are clear coat tint textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTintTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTintTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTintTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SheenTextureEnabled\", {\r\n /**\r\n * Are sheen textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SheenTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SheenTextureEnabled === value) {\r\n return;\r\n }\r\n this._SheenTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AnisotropicTextureEnabled\", {\r\n /**\r\n * Are anisotropic textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AnisotropicTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AnisotropicTextureEnabled === value) {\r\n return;\r\n }\r\n this._AnisotropicTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ThicknessTextureEnabled\", {\r\n /**\r\n * Are thickness textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ThicknessTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ThicknessTextureEnabled === value) {\r\n return;\r\n }\r\n this._ThicknessTextureEnabled = value;\r\n _Engines_engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].MarkAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n MaterialFlags._DiffuseTextureEnabled = true;\r\n MaterialFlags._AmbientTextureEnabled = true;\r\n MaterialFlags._OpacityTextureEnabled = true;\r\n MaterialFlags._ReflectionTextureEnabled = true;\r\n MaterialFlags._EmissiveTextureEnabled = true;\r\n MaterialFlags._SpecularTextureEnabled = true;\r\n MaterialFlags._BumpTextureEnabled = true;\r\n MaterialFlags._LightmapTextureEnabled = true;\r\n MaterialFlags._RefractionTextureEnabled = true;\r\n MaterialFlags._ColorGradingTextureEnabled = true;\r\n MaterialFlags._FresnelEnabled = true;\r\n MaterialFlags._ClearCoatTextureEnabled = true;\r\n MaterialFlags._ClearCoatBumpTextureEnabled = true;\r\n MaterialFlags._ClearCoatTintTextureEnabled = true;\r\n MaterialFlags._SheenTextureEnabled = true;\r\n MaterialFlags._AnisotropicTextureEnabled = true;\r\n MaterialFlags._ThicknessTextureEnabled = true;\r\n return MaterialFlags;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/materialHelper.ts\":\n/*!*************************************!*\\\n !*** ./Materials/materialHelper.ts ***!\n \\*************************************/\n/*! exports provided: MaterialHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return MaterialHelper; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * \"Static Class\" containing the most commonly used helper while dealing with material for\r\n * rendering purpose.\r\n *\r\n * It contains the basic tools to help defining defines, binding uniform for the common part of the materials.\r\n *\r\n * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions.\r\n */\r\nvar MaterialHelper = /** @class */ (function () {\r\n function MaterialHelper() {\r\n }\r\n /**\r\n * Bind the current view position to an effect.\r\n * @param effect The effect to be bound\r\n * @param scene The scene the eyes position is used from\r\n */\r\n MaterialHelper.BindEyePosition = function (effect, scene) {\r\n if (scene._forcedViewPosition) {\r\n effect.setVector3(\"vEyePosition\", scene._forcedViewPosition);\r\n return;\r\n }\r\n var globalPosition = scene.activeCamera.globalPosition;\r\n if (!globalPosition) {\r\n // Use WebVRFreecamera's device position as global position is not it's actual position in babylon space\r\n globalPosition = scene.activeCamera.devicePosition;\r\n }\r\n effect.setVector3(\"vEyePosition\", scene._mirroredCameraPosition ? scene._mirroredCameraPosition : globalPosition);\r\n };\r\n /**\r\n * Helps preparing the defines values about the UVs in used in the effect.\r\n * UVs are shared as much as we can accross channels in the shaders.\r\n * @param texture The texture we are preparing the UVs for\r\n * @param defines The defines to update\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.PrepareDefinesForMergedUV = function (texture, defines, key) {\r\n defines._needUVs = true;\r\n defines[key] = true;\r\n if (texture.getTextureMatrix().isIdentityAs3x2()) {\r\n defines[key + \"DIRECTUV\"] = texture.coordinatesIndex + 1;\r\n if (texture.coordinatesIndex === 0) {\r\n defines[\"MAINUV1\"] = true;\r\n }\r\n else {\r\n defines[\"MAINUV2\"] = true;\r\n }\r\n }\r\n else {\r\n defines[key + \"DIRECTUV\"] = 0;\r\n }\r\n };\r\n /**\r\n * Binds a texture matrix value to its corrsponding uniform\r\n * @param texture The texture to bind the matrix for\r\n * @param uniformBuffer The uniform buffer receivin the data\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.BindTextureMatrix = function (texture, uniformBuffer, key) {\r\n var matrix = texture.getTextureMatrix();\r\n uniformBuffer.updateMatrix(key + \"Matrix\", matrix);\r\n };\r\n /**\r\n * Gets the current status of the fog (should it be enabled?)\r\n * @param mesh defines the mesh to evaluate for fog support\r\n * @param scene defines the hosting scene\r\n * @returns true if fog must be enabled\r\n */\r\n MaterialHelper.GetFogState = function (mesh, scene) {\r\n return (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].FOGMODE_NONE);\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with misc. values for shader compilation\r\n * @param mesh defines the current mesh\r\n * @param scene defines the current scene\r\n * @param useLogarithmicDepth defines if logarithmic depth has to be turned on\r\n * @param pointsCloud defines if point cloud rendering has to be turned on\r\n * @param fogEnabled defines if fog has to be turned on\r\n * @param alphaTest defines if alpha testing has to be turned on\r\n * @param defines defines the current list of defines\r\n */\r\n MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, alphaTest, defines) {\r\n if (defines._areMiscDirty) {\r\n defines[\"LOGARITHMICDEPTH\"] = useLogarithmicDepth;\r\n defines[\"POINTSIZE\"] = pointsCloud;\r\n defines[\"FOG\"] = fogEnabled && this.GetFogState(mesh, scene);\r\n defines[\"NONUNIFORMSCALING\"] = mesh.nonUniformScaling;\r\n defines[\"ALPHATEST\"] = alphaTest;\r\n }\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with frame values for shader compilation\r\n * @param scene defines the current scene\r\n * @param engine defines the current engine\r\n * @param defines specifies the list of active defines\r\n * @param useInstances defines if instances have to be turned on\r\n * @param useClipPlane defines if clip plane have to be turned on\r\n */\r\n MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances, useClipPlane) {\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n var changed = false;\r\n var useClipPlane1 = false;\r\n var useClipPlane2 = false;\r\n var useClipPlane3 = false;\r\n var useClipPlane4 = false;\r\n useClipPlane1 = useClipPlane == null ? (scene.clipPlane !== undefined && scene.clipPlane !== null) : useClipPlane;\r\n useClipPlane2 = useClipPlane == null ? (scene.clipPlane2 !== undefined && scene.clipPlane2 !== null) : useClipPlane;\r\n useClipPlane3 = useClipPlane == null ? (scene.clipPlane3 !== undefined && scene.clipPlane3 !== null) : useClipPlane;\r\n useClipPlane4 = useClipPlane == null ? (scene.clipPlane4 !== undefined && scene.clipPlane4 !== null) : useClipPlane;\r\n if (defines[\"CLIPPLANE\"] !== useClipPlane1) {\r\n defines[\"CLIPPLANE\"] = useClipPlane1;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE2\"] !== useClipPlane2) {\r\n defines[\"CLIPPLANE2\"] = useClipPlane2;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE3\"] !== useClipPlane3) {\r\n defines[\"CLIPPLANE3\"] = useClipPlane3;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE4\"] !== useClipPlane4) {\r\n defines[\"CLIPPLANE4\"] = useClipPlane4;\r\n changed = true;\r\n }\r\n if (defines[\"DEPTHPREPASS\"] !== !engine.getColorWrite()) {\r\n defines[\"DEPTHPREPASS\"] = !defines[\"DEPTHPREPASS\"];\r\n changed = true;\r\n }\r\n if (defines[\"INSTANCES\"] !== useInstances) {\r\n defines[\"INSTANCES\"] = useInstances;\r\n changed = true;\r\n }\r\n if (changed) {\r\n defines.markAsUnprocessed();\r\n }\r\n };\r\n /**\r\n * Prepares the defines for bones\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForBones = function (mesh, defines) {\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = mesh.numBoneInfluencers;\r\n var materialSupportsBoneTexture = defines[\"BONETEXTURE\"] !== undefined;\r\n if (mesh.skeleton.isUsingTextureForMatrices && materialSupportsBoneTexture) {\r\n defines[\"BONETEXTURE\"] = true;\r\n }\r\n else {\r\n defines[\"BonesPerMesh\"] = (mesh.skeleton.bones.length + 1);\r\n defines[\"BONETEXTURE\"] = materialSupportsBoneTexture ? false : undefined;\r\n }\r\n }\r\n else {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = 0;\r\n defines[\"BonesPerMesh\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines for morph targets\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMorphTargets = function (mesh, defines) {\r\n var manager = mesh.morphTargetManager;\r\n if (manager) {\r\n defines[\"MORPHTARGETS_UV\"] = manager.supportsUVs && defines[\"UV1\"];\r\n defines[\"MORPHTARGETS_TANGENT\"] = manager.supportsTangents && defines[\"TANGENT\"];\r\n defines[\"MORPHTARGETS_NORMAL\"] = manager.supportsNormals && defines[\"NORMAL\"];\r\n defines[\"MORPHTARGETS\"] = (manager.numInfluencers > 0);\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = manager.numInfluencers;\r\n }\r\n else {\r\n defines[\"MORPHTARGETS_UV\"] = false;\r\n defines[\"MORPHTARGETS_TANGENT\"] = false;\r\n defines[\"MORPHTARGETS_NORMAL\"] = false;\r\n defines[\"MORPHTARGETS\"] = false;\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines used in the shader depending on the attributes data available in the mesh\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n * @param useVertexColor Precise whether vertex colors should be used or not (override mesh info)\r\n * @param useBones Precise whether bones should be used or not (override mesh info)\r\n * @param useMorphTargets Precise whether morph targets should be used or not (override mesh info)\r\n * @param useVertexAlpha Precise whether vertex alpha should be used or not (override mesh info)\r\n * @returns false if defines are considered not dirty and have not been checked\r\n */\r\n MaterialHelper.PrepareDefinesForAttributes = function (mesh, defines, useVertexColor, useBones, useMorphTargets, useVertexAlpha) {\r\n if (useMorphTargets === void 0) { useMorphTargets = false; }\r\n if (useVertexAlpha === void 0) { useVertexAlpha = true; }\r\n if (!defines._areAttributesDirty && defines._needNormals === defines._normals && defines._needUVs === defines._uvs) {\r\n return false;\r\n }\r\n defines._normals = defines._needNormals;\r\n defines._uvs = defines._needUVs;\r\n defines[\"NORMAL\"] = (defines._needNormals && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind));\r\n if (defines._needNormals && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n defines[\"TANGENT\"] = true;\r\n }\r\n if (defines._needUVs) {\r\n defines[\"UV1\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind);\r\n defines[\"UV2\"] = mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n else {\r\n defines[\"UV1\"] = false;\r\n defines[\"UV2\"] = false;\r\n }\r\n if (useVertexColor) {\r\n var hasVertexColors = mesh.useVertexColors && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind);\r\n defines[\"VERTEXCOLOR\"] = hasVertexColors;\r\n defines[\"VERTEXALPHA\"] = mesh.hasVertexAlpha && hasVertexColors && useVertexAlpha;\r\n }\r\n if (useBones) {\r\n this.PrepareDefinesForBones(mesh, defines);\r\n }\r\n if (useMorphTargets) {\r\n this.PrepareDefinesForMorphTargets(mesh, defines);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Prepares the defines related to multiview\r\n * @param scene The scene we are intending to draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMultiview = function (scene, defines) {\r\n if (scene.activeCamera) {\r\n var previousMultiview = defines.MULTIVIEW;\r\n defines.MULTIVIEW = (scene.activeCamera.outputRenderTarget !== null && scene.activeCamera.outputRenderTarget.getViewCount() > 1);\r\n if (defines.MULTIVIEW != previousMultiview) {\r\n defines.markAsUnprocessed();\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param light The light the effect is compiling for\r\n * @param lightIndex The index of the light\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param state Defines the current state regarding what is needed (normals, etc...)\r\n */\r\n MaterialHelper.PrepareDefinesForLight = function (scene, mesh, light, lightIndex, defines, specularSupported, state) {\r\n state.needNormals = true;\r\n if (defines[\"LIGHT\" + lightIndex] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"LIGHT\" + lightIndex] = true;\r\n defines[\"SPOTLIGHT\" + lightIndex] = false;\r\n defines[\"HEMILIGHT\" + lightIndex] = false;\r\n defines[\"POINTLIGHT\" + lightIndex] = false;\r\n defines[\"DIRLIGHT\" + lightIndex] = false;\r\n light.prepareLightSpecificDefines(defines, lightIndex);\r\n // FallOff.\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = false;\r\n switch (light.falloffType) {\r\n case _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].FALLOFF_GLTF:\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = true;\r\n break;\r\n case _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].FALLOFF_PHYSICAL:\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = true;\r\n break;\r\n case _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].FALLOFF_STANDARD:\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = true;\r\n break;\r\n }\r\n // Specular\r\n if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {\r\n state.specularEnabled = true;\r\n }\r\n // Shadows\r\n defines[\"SHADOW\" + lightIndex] = false;\r\n defines[\"SHADOWPCF\" + lightIndex] = false;\r\n defines[\"SHADOWPCSS\" + lightIndex] = false;\r\n defines[\"SHADOWPOISSON\" + lightIndex] = false;\r\n defines[\"SHADOWESM\" + lightIndex] = false;\r\n defines[\"SHADOWCUBE\" + lightIndex] = false;\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = false;\r\n if (mesh && mesh.receiveShadows && scene.shadowsEnabled && light.shadowEnabled) {\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n var shadowMap = shadowGenerator.getShadowMap();\r\n if (shadowMap) {\r\n if (shadowMap.renderList && shadowMap.renderList.length > 0) {\r\n state.shadowEnabled = true;\r\n shadowGenerator.prepareDefines(defines, lightIndex);\r\n }\r\n }\r\n }\r\n }\r\n if (light.lightmapMode != _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTMAP_DEFAULT) {\r\n state.lightmapMode = true;\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = true;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = (light.lightmapMode == _Lights_light__WEBPACK_IMPORTED_MODULE_4__[\"Light\"].LIGHTMAP_SHADOWSONLY);\r\n }\r\n else {\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = false;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = false;\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param maxSimultaneousLights Specfies how manuy lights can be added to the effect at max\r\n * @param disableLighting Specifies whether the lighting is disabled (override scene and light)\r\n * @returns true if normals will be required for the rest of the effect\r\n */\r\n MaterialHelper.PrepareDefinesForLights = function (scene, mesh, defines, specularSupported, maxSimultaneousLights, disableLighting) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (disableLighting === void 0) { disableLighting = false; }\r\n if (!defines._areLightsDirty) {\r\n return defines._needNormals;\r\n }\r\n var lightIndex = 0;\r\n var state = {\r\n needNormals: false,\r\n needRebuild: false,\r\n lightmapMode: false,\r\n shadowEnabled: false,\r\n specularEnabled: false\r\n };\r\n if (scene.lightsEnabled && !disableLighting) {\r\n for (var _i = 0, _a = mesh.lightSources; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n this.PrepareDefinesForLight(scene, mesh, light, lightIndex, defines, specularSupported, state);\r\n lightIndex++;\r\n if (lightIndex === maxSimultaneousLights) {\r\n break;\r\n }\r\n }\r\n }\r\n defines[\"SPECULARTERM\"] = state.specularEnabled;\r\n defines[\"SHADOWS\"] = state.shadowEnabled;\r\n // Resetting all other lights if any\r\n for (var index = lightIndex; index < maxSimultaneousLights; index++) {\r\n if (defines[\"LIGHT\" + index] !== undefined) {\r\n defines[\"LIGHT\" + index] = false;\r\n defines[\"HEMILIGHT\" + index] = false;\r\n defines[\"POINTLIGHT\" + index] = false;\r\n defines[\"DIRLIGHT\" + index] = false;\r\n defines[\"SPOTLIGHT\" + index] = false;\r\n defines[\"SHADOW\" + index] = false;\r\n defines[\"SHADOWPCF\" + index] = false;\r\n defines[\"SHADOWPCSS\" + index] = false;\r\n defines[\"SHADOWPOISSON\" + index] = false;\r\n defines[\"SHADOWESM\" + index] = false;\r\n defines[\"SHADOWCUBE\" + index] = false;\r\n defines[\"SHADOWLOWQUALITY\" + index] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + index] = false;\r\n }\r\n }\r\n var caps = scene.getEngine().getCaps();\r\n if (defines[\"SHADOWFLOAT\"] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"SHADOWFLOAT\"] = state.shadowEnabled &&\r\n ((caps.textureFloatRender && caps.textureFloatLinearFiltering) ||\r\n (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering));\r\n defines[\"LIGHTMAPEXCLUDED\"] = state.lightmapMode;\r\n if (state.needRebuild) {\r\n defines.rebuild();\r\n }\r\n return state.needNormals;\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect (for a specific light)\r\n * @param lightIndex defines the light index\r\n * @param uniformsList The uniform list\r\n * @param samplersList The sampler list\r\n * @param projectedLightTexture defines if projected texture must be used\r\n * @param uniformBuffersList defines an optional list of uniform buffers\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersForLight = function (lightIndex, uniformsList, samplersList, projectedLightTexture, uniformBuffersList) {\r\n if (uniformBuffersList === void 0) { uniformBuffersList = null; }\r\n uniformsList.push(\"vLightData\" + lightIndex, \"vLightDiffuse\" + lightIndex, \"vLightSpecular\" + lightIndex, \"vLightDirection\" + lightIndex, \"vLightFalloff\" + lightIndex, \"vLightGround\" + lightIndex, \"lightMatrix\" + lightIndex, \"shadowsInfo\" + lightIndex, \"depthValues\" + lightIndex);\r\n if (uniformBuffersList) {\r\n uniformBuffersList.push(\"Light\" + lightIndex);\r\n }\r\n samplersList.push(\"shadowSampler\" + lightIndex);\r\n samplersList.push(\"depthSampler\" + lightIndex);\r\n if (projectedLightTexture) {\r\n samplersList.push(\"projectionLightSampler\" + lightIndex);\r\n uniformsList.push(\"textureProjectionMatrix\" + lightIndex);\r\n }\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect\r\n * @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the liist and extra information\r\n * @param samplersList The sampler list\r\n * @param defines The defines helping in the list generation\r\n * @param maxSimultaneousLights The maximum number of simultanous light allowed in the effect\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersList = function (uniformsListOrOptions, samplersList, defines, maxSimultaneousLights) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n var uniformsList;\r\n var uniformBuffersList = null;\r\n if (uniformsListOrOptions.uniformsNames) {\r\n var options = uniformsListOrOptions;\r\n uniformsList = options.uniformsNames;\r\n uniformBuffersList = options.uniformBuffersNames;\r\n samplersList = options.samplers;\r\n defines = options.defines;\r\n maxSimultaneousLights = options.maxSimultaneousLights;\r\n }\r\n else {\r\n uniformsList = uniformsListOrOptions;\r\n if (!samplersList) {\r\n samplersList = [];\r\n }\r\n }\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n this.PrepareUniformsAndSamplersForLight(lightIndex, uniformsList, samplersList, defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex], uniformBuffersList);\r\n }\r\n if (defines[\"NUM_MORPH_INFLUENCERS\"]) {\r\n uniformsList.push(\"morphTargetInfluences\");\r\n }\r\n };\r\n /**\r\n * This helps decreasing rank by rank the shadow quality (0 being the highest rank and quality)\r\n * @param defines The defines to update while falling back\r\n * @param fallbacks The authorized effect fallbacks\r\n * @param maxSimultaneousLights The maximum number of lights allowed\r\n * @param rank the current rank of the Effect\r\n * @returns The newly affected rank\r\n */\r\n MaterialHelper.HandleFallbacksForShadows = function (defines, fallbacks, maxSimultaneousLights, rank) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (rank === void 0) { rank = 0; }\r\n var lightFallbackRank = 0;\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n if (lightIndex > 0) {\r\n lightFallbackRank = rank + lightIndex;\r\n fallbacks.addFallback(lightFallbackRank, \"LIGHT\" + lightIndex);\r\n }\r\n if (!defines[\"SHADOWS\"]) {\r\n if (defines[\"SHADOW\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOW\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCF\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCF\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCSS\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCSS\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPOISSON\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPOISSON\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWESM\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWESM\" + lightIndex);\r\n }\r\n }\r\n }\r\n return lightFallbackRank++;\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param influencers The number of influencers\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargetsInfluencers = function (attribs, mesh, influencers) {\r\n this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS = influencers;\r\n this.PrepareAttributesForMorphTargets(attribs, mesh, this._TmpMorphInfluencers);\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param defines The current Defines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargets = function (attribs, mesh, defines) {\r\n var influencers = defines[\"NUM_MORPH_INFLUENCERS\"];\r\n if (influencers > 0 && _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedEngine) {\r\n var maxAttributesCount = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedEngine.getCaps().maxVertexAttribs;\r\n var manager = mesh.morphTargetManager;\r\n var normal = manager && manager.supportsNormals && defines[\"NORMAL\"];\r\n var tangent = manager && manager.supportsTangents && defines[\"TANGENT\"];\r\n var uv = manager && manager.supportsUVs && defines[\"UV1\"];\r\n for (var index = 0; index < influencers; index++) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind + index);\r\n if (normal) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind + index);\r\n }\r\n if (tangent) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind + index);\r\n }\r\n if (uv) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind + \"_\" + index);\r\n }\r\n if (attribs.length > maxAttributesCount) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Cannot add more vertex attributes for mesh \" + mesh.name);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the list of attributes required for bones according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the bones attributes for\r\n * @param defines The current Defines of the effect\r\n * @param fallbacks The current efffect fallback strategy\r\n */\r\n MaterialHelper.PrepareAttributesForBones = function (attribs, mesh, defines, fallbacks) {\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n }\r\n };\r\n /**\r\n * Check and prepare the list of attributes required for instances according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param defines The current MaterialDefines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForInstances = function (attribs, defines) {\r\n if (defines[\"INSTANCES\"]) {\r\n this.PushAttributesForInstances(attribs);\r\n }\r\n };\r\n /**\r\n * Add the list of attributes required for instances to the attribs array.\r\n * @param attribs The current list of supported attribs\r\n */\r\n MaterialHelper.PushAttributesForInstances = function (attribs) {\r\n attribs.push(\"world0\");\r\n attribs.push(\"world1\");\r\n attribs.push(\"world2\");\r\n attribs.push(\"world3\");\r\n };\r\n /**\r\n * Binds the light shadow information to the effect for the given mesh.\r\n * @param light The light containing the generator\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param lightIndex The light index in the effect used to render the mesh\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindLightShadow = function (light, mesh, lightIndex, effect) {\r\n if (light.shadowEnabled && mesh.receiveShadows) {\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n shadowGenerator.bindShadowLight(lightIndex, effect);\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the light information to the effect.\r\n * @param light The light containing the generator\r\n * @param effect The effect we are binding the data to\r\n * @param lightIndex The light index in the effect used to render\r\n */\r\n MaterialHelper.BindLightProperties = function (light, effect, lightIndex) {\r\n light.transferToEffect(effect, lightIndex + \"\");\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param light Light to bind\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param usePhysicalLightFalloff Specifies whether the light falloff is defined physically or not\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLight = function (light, lightIndex, scene, mesh, effect, useSpecular, usePhysicalLightFalloff, rebuildInParallel) {\r\n if (usePhysicalLightFalloff === void 0) { usePhysicalLightFalloff = false; }\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var iAsString = lightIndex.toString();\r\n var scaledIntensity = light.getScaledIntensity();\r\n if (!rebuildInParallel) {\r\n light._uniformBuffer.bindToEffect(effect, \"Light\" + iAsString);\r\n }\r\n MaterialHelper.BindLightProperties(light, effect, lightIndex);\r\n light.diffuse.scaleToRef(scaledIntensity, _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[0]);\r\n light._uniformBuffer.updateColor4(\"vLightDiffuse\", _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[0], usePhysicalLightFalloff ? light.radius : light.range, iAsString);\r\n if (useSpecular) {\r\n light.specular.scaleToRef(scaledIntensity, _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[1]);\r\n light._uniformBuffer.updateColor3(\"vLightSpecular\", _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"TmpColors\"].Color3[1], iAsString);\r\n }\r\n // Shadows\r\n if (scene.shadowsEnabled) {\r\n this.BindLightShadow(light, mesh, iAsString, effect);\r\n }\r\n light._uniformBuffer.update();\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param defines The generated defines for the effect\r\n * @param maxSimultaneousLights The maximum number of light that can be bound to the effect\r\n * @param usePhysicalLightFalloff Specifies whether the light falloff is defined physically or not\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLights = function (scene, mesh, effect, defines, maxSimultaneousLights, usePhysicalLightFalloff, rebuildInParallel) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (usePhysicalLightFalloff === void 0) { usePhysicalLightFalloff = false; }\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var len = Math.min(mesh.lightSources.length, maxSimultaneousLights);\r\n for (var i = 0; i < len; i++) {\r\n var light = mesh.lightSources[i];\r\n this.BindLight(light, i, scene, mesh, effect, typeof defines === \"boolean\" ? defines : defines[\"SPECULARTERM\"], usePhysicalLightFalloff, rebuildInParallel);\r\n }\r\n };\r\n /**\r\n * Binds the fog information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param linearSpace Defines if the fog effect is applied in linear space\r\n */\r\n MaterialHelper.BindFogParameters = function (scene, mesh, effect, linearSpace) {\r\n if (linearSpace === void 0) { linearSpace = false; }\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].FOGMODE_NONE) {\r\n effect.setFloat4(\"vFogInfos\", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n // Convert fog color to linear space if used in a linear space computed shader.\r\n if (linearSpace) {\r\n scene.fogColor.toLinearSpaceToRef(this._tempFogColor);\r\n effect.setColor3(\"vFogColor\", this._tempFogColor);\r\n }\r\n else {\r\n effect.setColor3(\"vFogColor\", scene.fogColor);\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the bones information from the mesh to the effect.\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindBonesParameters = function (mesh, effect) {\r\n if (!effect || !mesh) {\r\n return;\r\n }\r\n if (mesh.computeBonesUsingShaders && effect._bonesComputationForcedToCPU) {\r\n mesh.computeBonesUsingShaders = false;\r\n }\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex(\"boneTextureWidth\") > -1) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n effect.setTexture(\"boneSampler\", boneTexture);\r\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n var matrices = skeleton.getTransformMatrices(mesh);\r\n if (matrices) {\r\n effect.setMatrices(\"mBones\", matrices);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the morph targets information from the mesh to the effect.\r\n * @param abstractMesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindMorphTargetParameters = function (abstractMesh, effect) {\r\n var manager = abstractMesh.morphTargetManager;\r\n if (!abstractMesh || !manager) {\r\n return;\r\n }\r\n effect.setFloatArray(\"morphTargetInfluences\", manager.influences);\r\n };\r\n /**\r\n * Binds the logarithmic depth information from the scene to the effect for the given defines.\r\n * @param defines The generated defines used in the effect\r\n * @param effect The effect we are binding the data to\r\n * @param scene The scene we are willing to render with logarithmic scale for\r\n */\r\n MaterialHelper.BindLogDepth = function (defines, effect, scene) {\r\n if (defines[\"LOGARITHMICDEPTH\"]) {\r\n effect.setFloat(\"logarithmicDepthConstant\", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));\r\n }\r\n };\r\n /**\r\n * Binds the clip plane information from the scene to the effect.\r\n * @param scene The scene the clip plane information are extracted from\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindClipPlane = function (effect, scene) {\r\n if (scene.clipPlane) {\r\n var clipPlane = scene.clipPlane;\r\n effect.setFloat4(\"vClipPlane\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (scene.clipPlane2) {\r\n var clipPlane = scene.clipPlane2;\r\n effect.setFloat4(\"vClipPlane2\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (scene.clipPlane3) {\r\n var clipPlane = scene.clipPlane3;\r\n effect.setFloat4(\"vClipPlane3\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (scene.clipPlane4) {\r\n var clipPlane = scene.clipPlane4;\r\n effect.setFloat4(\"vClipPlane4\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n };\r\n MaterialHelper._TmpMorphInfluencers = { \"NUM_MORPH_INFLUENCERS\": 0 };\r\n MaterialHelper._tempFogColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"].Black();\r\n return MaterialHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/multiMaterial.ts\":\n/*!************************************!*\\\n !*** ./Materials/multiMaterial.ts ***!\n \\************************************/\n/*! exports provided: MultiMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return MultiMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see http://doc.babylonjs.com/how_to/multi_materials\r\n */\r\nvar MultiMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MultiMaterial, _super);\r\n /**\r\n * Instantiates a new Multi Material\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see http://doc.babylonjs.com/how_to/multi_materials\r\n * @param name Define the name in the scene\r\n * @param scene Define the scene the material belongs to\r\n */\r\n function MultiMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene, true) || this;\r\n scene.multiMaterials.push(_this);\r\n _this.subMaterials = new Array();\r\n _this._storeEffectOnSubMeshes = true; // multimaterial is considered like a push material\r\n return _this;\r\n }\r\n Object.defineProperty(MultiMaterial.prototype, \"subMaterials\", {\r\n /**\r\n * Gets or Sets the list of Materials used within the multi material.\r\n * They need to be ordered according to the submeshes order in the associated mesh\r\n */\r\n get: function () {\r\n return this._subMaterials;\r\n },\r\n set: function (value) {\r\n this._subMaterials = value;\r\n this._hookArray(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Function used to align with Node.getChildren()\r\n * @returns the list of Materials used within the multi material\r\n */\r\n MultiMaterial.prototype.getChildren = function () {\r\n return this.subMaterials;\r\n };\r\n MultiMaterial.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return deleted;\r\n };\r\n };\r\n /**\r\n * Get one of the submaterial by its index in the submaterials array\r\n * @param index The index to look the sub material at\r\n * @returns The Material if the index has been defined\r\n */\r\n MultiMaterial.prototype.getSubMaterial = function (index) {\r\n if (index < 0 || index >= this.subMaterials.length) {\r\n return this.getScene().defaultMaterial;\r\n }\r\n return this.subMaterials[index];\r\n };\r\n /**\r\n * Get the list of active textures for the whole sub materials list.\r\n * @returns All the textures that will be used during the rendering\r\n */\r\n MultiMaterial.prototype.getActiveTextures = function () {\r\n var _a;\r\n return (_a = _super.prototype.getActiveTextures.call(this)).concat.apply(_a, this.subMaterials.map(function (subMaterial) {\r\n if (subMaterial) {\r\n return subMaterial.getActiveTextures();\r\n }\r\n else {\r\n return [];\r\n }\r\n }));\r\n };\r\n /**\r\n * Gets the current class name of the material e.g. \"MultiMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n MultiMaterial.prototype.getClassName = function () {\r\n return \"MultiMaterial\";\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested sub mesh\r\n * @param mesh Define the mesh the submesh belongs to\r\n * @param subMesh Define the sub mesh to look readyness for\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n MultiMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n if (subMaterial._storeEffectOnSubMeshes) {\r\n if (!subMaterial.isReadyForSubMesh(mesh, subMesh, useInstances)) {\r\n return false;\r\n }\r\n continue;\r\n }\r\n if (!subMaterial.isReady(mesh)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones the current material and its related sub materials\r\n * @param name Define the name of the newly cloned material\r\n * @param cloneChildren Define if submaterial will be cloned or shared with the parent instance\r\n * @returns the cloned material\r\n */\r\n MultiMaterial.prototype.clone = function (name, cloneChildren) {\r\n var newMultiMaterial = new MultiMaterial(name, this.getScene());\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = null;\r\n var current = this.subMaterials[index];\r\n if (cloneChildren && current) {\r\n subMaterial = current.clone(name + \"-\" + current.name);\r\n }\r\n else {\r\n subMaterial = this.subMaterials[index];\r\n }\r\n newMultiMaterial.subMaterials.push(subMaterial);\r\n }\r\n return newMultiMaterial;\r\n };\r\n /**\r\n * Serializes the materials into a JSON representation.\r\n * @returns the JSON representation\r\n */\r\n MultiMaterial.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"]) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"].GetTags(this);\r\n }\r\n serializationObject.materials = [];\r\n for (var matIndex = 0; matIndex < this.subMaterials.length; matIndex++) {\r\n var subMat = this.subMaterials[matIndex];\r\n if (subMat) {\r\n serializationObject.materials.push(subMat.id);\r\n }\r\n else {\r\n serializationObject.materials.push(null);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Dispose the material and release its associated resources\r\n * @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on)\r\n * @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app)\r\n * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app)\r\n */\r\n MultiMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, forceDisposeChildren) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n if (forceDisposeChildren) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n subMaterial.dispose(forceDisposeEffect, forceDisposeTextures);\r\n }\r\n }\r\n }\r\n var index = scene.multiMaterials.indexOf(this);\r\n if (index >= 0) {\r\n scene.multiMaterials.splice(index, 1);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Creates a MultiMaterial from parsed MultiMaterial data.\r\n * @param parsedMultiMaterial defines parsed MultiMaterial data.\r\n * @param scene defines the hosting scene\r\n * @returns a new MultiMaterial\r\n */\r\n MultiMaterial.ParseMultiMaterial = function (parsedMultiMaterial, scene) {\r\n var multiMaterial = new MultiMaterial(parsedMultiMaterial.name, scene);\r\n multiMaterial.id = parsedMultiMaterial.id;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_2__[\"Tags\"].AddTagsTo(multiMaterial, parsedMultiMaterial.tags);\r\n }\r\n for (var matIndex = 0; matIndex < parsedMultiMaterial.materials.length; matIndex++) {\r\n var subMatId = parsedMultiMaterial.materials[matIndex];\r\n if (subMatId) {\r\n // If the same multimaterial is loaded twice, the 2nd multimaterial needs to reference the latest material by that id which\r\n // is why this lookup should use getLastMaterialByID instead of getMaterialByID\r\n multiMaterial.subMaterials.push(scene.getLastMaterialByID(subMatId));\r\n }\r\n else {\r\n multiMaterial.subMaterials.push(null);\r\n }\r\n }\r\n return multiMaterial;\r\n };\r\n return MultiMaterial;\r\n}(_Materials_material__WEBPACK_IMPORTED_MODULE_1__[\"Material\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.MultiMaterial\"] = MultiMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/pushMaterial.ts\":\n/*!***********************************!*\\\n !*** ./Materials/pushMaterial.ts ***!\n \\***********************************/\n/*! exports provided: PushMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return PushMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n\r\n\r\n\r\n/**\r\n * Base class of materials working in push mode in babylon JS\r\n * @hidden\r\n */\r\nvar PushMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PushMaterial, _super);\r\n function PushMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._normalMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]();\r\n /**\r\n * Gets or sets a boolean indicating that the material is allowed to do shader hot swapping.\r\n * This means that the material can keep using a previous shader while a new one is being compiled.\r\n * This is mostly used when shader parallel compilation is supported (true by default)\r\n */\r\n _this.allowShaderHotSwapping = true;\r\n _this._storeEffectOnSubMeshes = true;\r\n return _this;\r\n }\r\n PushMaterial.prototype.getEffect = function () {\r\n return this._activeEffect;\r\n };\r\n PushMaterial.prototype.isReady = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return false;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n return true;\r\n }\r\n return this.isReadyForSubMesh(mesh, mesh.subMeshes[0], useInstances);\r\n };\r\n /**\r\n * Binds the given world matrix to the active effect\r\n *\r\n * @param world the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n this._activeEffect.setMatrix(\"world\", world);\r\n };\r\n /**\r\n * Binds the given normal matrix to the active effect\r\n *\r\n * @param normalMatrix the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyNormalMatrix = function (normalMatrix) {\r\n this._activeEffect.setMatrix(\"normalMatrix\", normalMatrix);\r\n };\r\n PushMaterial.prototype.bind = function (world, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n this.bindForSubMesh(world, mesh, mesh.subMeshes[0]);\r\n };\r\n PushMaterial.prototype._afterBind = function (mesh, effect) {\r\n if (effect === void 0) { effect = null; }\r\n _super.prototype._afterBind.call(this, mesh);\r\n this.getScene()._cachedEffect = effect;\r\n };\r\n PushMaterial.prototype._mustRebind = function (scene, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return scene.isCachedMaterialInvalid(this, effect, visibility);\r\n };\r\n return PushMaterial;\r\n}(_Materials_material__WEBPACK_IMPORTED_MODULE_2__[\"Material\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Materials/shaderMaterial.ts\":\n/*!*************************************!*\\\n !*** ./Materials/shaderMaterial.ts ***!\n \\*************************************/\n/*! exports provided: ShaderMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return ShaderMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./material */ \"./Materials/material.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n *\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n *\r\n * @see http://doc.babylonjs.com/how_to/shader_material\r\n */\r\nvar ShaderMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShaderMaterial, _super);\r\n /**\r\n * Instantiate a new shader material.\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n * @see http://doc.babylonjs.com/how_to/shader_material\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belongs to\r\n * @param shaderPath Defines the route to the shader code in one of three ways:\r\n * * object: { vertex: \"custom\", fragment: \"custom\" }, used with Effect.ShadersStore[\"customVertexShader\"] and Effect.ShadersStore[\"customFragmentShader\"]\r\n * * object: { vertexElement: \"vertexShaderCode\", fragmentElement: \"fragmentShaderCode\" }, used with shader code in script tags\r\n * * object: { vertexSource: \"vertex shader code string\", fragmentSource: \"fragment shader code string\" } using with strings containing the shaders code\r\n * * string: \"./COMMON_NAME\", used with external files COMMON_NAME.vertex.fx and COMMON_NAME.fragment.fx in index.html folder.\r\n * @param options Define the options used to create the shader\r\n */\r\n function ShaderMaterial(name, scene, shaderPath, options) {\r\n if (options === void 0) { options = {}; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._textures = {};\r\n _this._textureArrays = {};\r\n _this._floats = {};\r\n _this._ints = {};\r\n _this._floatsArrays = {};\r\n _this._colors3 = {};\r\n _this._colors3Arrays = {};\r\n _this._colors4 = {};\r\n _this._colors4Arrays = {};\r\n _this._vectors2 = {};\r\n _this._vectors3 = {};\r\n _this._vectors4 = {};\r\n _this._matrices = {};\r\n _this._matrices3x3 = {};\r\n _this._matrices2x2 = {};\r\n _this._vectors2Arrays = {};\r\n _this._vectors3Arrays = {};\r\n _this._vectors4Arrays = {};\r\n _this._cachedWorldViewMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._cachedWorldViewProjectionMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"]();\r\n _this._shaderPath = shaderPath;\r\n _this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ needAlphaBlending: false, needAlphaTesting: false, attributes: [\"position\", \"normal\", \"uv\"], uniforms: [\"worldViewProjection\"], uniformBuffers: [], samplers: [], defines: [] }, options);\r\n return _this;\r\n }\r\n Object.defineProperty(ShaderMaterial.prototype, \"options\", {\r\n /**\r\n * Gets the options used to compile the shader.\r\n * They can be modified to trigger a new compilation\r\n */\r\n get: function () {\r\n return this._options;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"ShaderMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n ShaderMaterial.prototype.getClassName = function () {\r\n return \"ShaderMaterial\";\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n ShaderMaterial.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0) || this._options.needAlphaBlending;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n ShaderMaterial.prototype.needAlphaTesting = function () {\r\n return this._options.needAlphaTesting;\r\n };\r\n ShaderMaterial.prototype._checkUniform = function (uniformName) {\r\n if (this._options.uniforms.indexOf(uniformName) === -1) {\r\n this._options.uniforms.push(uniformName);\r\n }\r\n };\r\n /**\r\n * Set a texture in the shader.\r\n * @param name Define the name of the uniform samplers as defined in the shader\r\n * @param texture Define the texture to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTexture = function (name, texture) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._textures[name] = texture;\r\n return this;\r\n };\r\n /**\r\n * Set a texture array in the shader.\r\n * @param name Define the name of the uniform sampler array as defined in the shader\r\n * @param textures Define the list of textures to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTextureArray = function (name, textures) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._checkUniform(name);\r\n this._textureArrays[name] = textures;\r\n return this;\r\n };\r\n /**\r\n * Set a float in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloat = function (name, value) {\r\n this._checkUniform(name);\r\n this._floats[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a int in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setInt = function (name, value) {\r\n this._checkUniform(name);\r\n this._ints[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set an array of floats in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloats = function (name, value) {\r\n this._checkUniform(name);\r\n this._floatsArrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Color3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a Color3 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Color4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a Color4 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 in the shader from a Vector2.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Vector3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Vector4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat4 in the shader from a Matrix.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat3 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix3x3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices3x3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat2 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix2x2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices2x2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4Arrays[name] = value;\r\n return this;\r\n };\r\n ShaderMaterial.prototype._checkCache = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this._effect && (this._effect.defines.indexOf(\"#define INSTANCES\") !== -1) !== useInstances) {\r\n return false;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n ShaderMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return this.isReady(mesh, useInstances);\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested mesh\r\n * @param mesh Define the mesh to render\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n ShaderMaterial.prototype.isReady = function (mesh, useInstances) {\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (!this.checkReadyOnEveryCall) {\r\n if (this._renderId === scene.getRenderId()) {\r\n if (this._checkCache(mesh, useInstances)) {\r\n return true;\r\n }\r\n }\r\n }\r\n // Instances\r\n var defines = [];\r\n var attribs = [];\r\n var fallbacks = new _effect__WEBPACK_IMPORTED_MODULE_6__[\"EffectFallbacks\"]();\r\n for (var index = 0; index < this._options.defines.length; index++) {\r\n defines.push(this._options.defines[index]);\r\n }\r\n for (var index = 0; index < this._options.attributes.length; index++) {\r\n attribs.push(this._options.attributes[index]);\r\n }\r\n if (mesh && mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind);\r\n defines.push(\"#define VERTEXCOLOR\");\r\n }\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Bones\r\n if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n var skeleton = mesh.skeleton;\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n if (skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n if (this._options.uniforms.indexOf(\"boneTextureWidth\") === -1) {\r\n this._options.uniforms.push(\"boneTextureWidth\");\r\n }\r\n if (this._options.samplers.indexOf(\"boneSampler\") === -1) {\r\n this._options.samplers.push(\"boneSampler\");\r\n }\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton.bones.length + 1));\r\n if (this._options.uniforms.indexOf(\"mBones\") === -1) {\r\n this._options.uniforms.push(\"mBones\");\r\n }\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Textures\r\n for (var name in this._textures) {\r\n if (!this._textures[name].isReady()) {\r\n return false;\r\n }\r\n }\r\n // Alpha test\r\n if (mesh && this._shouldTurnAlphaTestOn(mesh)) {\r\n defines.push(\"#define ALPHATEST\");\r\n }\r\n var previousEffect = this._effect;\r\n var join = defines.join(\"\\n\");\r\n this._effect = engine.createEffect(this._shaderPath, {\r\n attributes: attribs,\r\n uniformsNames: this._options.uniforms,\r\n uniformBuffersNames: this._options.uniformBuffers,\r\n samplers: this._options.samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError\r\n }, engine);\r\n if (!this._effect.isReady()) {\r\n return false;\r\n }\r\n if (previousEffect !== this._effect) {\r\n scene.resetCachedMaterial();\r\n }\r\n this._renderId = scene.getRenderId();\r\n return true;\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n ShaderMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n var scene = this.getScene();\r\n if (!this._effect) {\r\n return;\r\n }\r\n if (this._options.uniforms.indexOf(\"world\") !== -1) {\r\n this._effect.setMatrix(\"world\", world);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldView\") !== -1) {\r\n world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);\r\n this._effect.setMatrix(\"worldView\", this._cachedWorldViewMatrix);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldViewProjection\") !== -1) {\r\n world.multiplyToRef(scene.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);\r\n this._effect.setMatrix(\"worldViewProjection\", this._cachedWorldViewProjectionMatrix);\r\n }\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n */\r\n ShaderMaterial.prototype.bind = function (world, mesh) {\r\n // Std values\r\n this.bindOnlyWorldMatrix(world);\r\n if (this._effect && this.getScene().getCachedMaterial() !== this) {\r\n if (this._options.uniforms.indexOf(\"view\") !== -1) {\r\n this._effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"projection\") !== -1) {\r\n this._effect.setMatrix(\"projection\", this.getScene().getProjectionMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"viewProjection\") !== -1) {\r\n this._effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n }\r\n // Bones\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindBonesParameters(mesh, this._effect);\r\n var name;\r\n // Texture\r\n for (name in this._textures) {\r\n this._effect.setTexture(name, this._textures[name]);\r\n }\r\n // Texture arrays\r\n for (name in this._textureArrays) {\r\n this._effect.setTextureArray(name, this._textureArrays[name]);\r\n }\r\n // Int\r\n for (name in this._ints) {\r\n this._effect.setInt(name, this._ints[name]);\r\n }\r\n // Float\r\n for (name in this._floats) {\r\n this._effect.setFloat(name, this._floats[name]);\r\n }\r\n // Floats\r\n for (name in this._floatsArrays) {\r\n this._effect.setArray(name, this._floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in this._colors3) {\r\n this._effect.setColor3(name, this._colors3[name]);\r\n }\r\n // Color3Array\r\n for (name in this._colors3Arrays) {\r\n this._effect.setArray3(name, this._colors3Arrays[name]);\r\n }\r\n // Color4\r\n for (name in this._colors4) {\r\n var color = this._colors4[name];\r\n this._effect.setFloat4(name, color.r, color.g, color.b, color.a);\r\n }\r\n // Color4Array\r\n for (name in this._colors4Arrays) {\r\n this._effect.setArray4(name, this._colors4Arrays[name]);\r\n }\r\n // Vector2\r\n for (name in this._vectors2) {\r\n this._effect.setVector2(name, this._vectors2[name]);\r\n }\r\n // Vector3\r\n for (name in this._vectors3) {\r\n this._effect.setVector3(name, this._vectors3[name]);\r\n }\r\n // Vector4\r\n for (name in this._vectors4) {\r\n this._effect.setVector4(name, this._vectors4[name]);\r\n }\r\n // Matrix\r\n for (name in this._matrices) {\r\n this._effect.setMatrix(name, this._matrices[name]);\r\n }\r\n // Matrix 3x3\r\n for (name in this._matrices3x3) {\r\n this._effect.setMatrix3x3(name, this._matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in this._matrices2x2) {\r\n this._effect.setMatrix2x2(name, this._matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in this._vectors2Arrays) {\r\n this._effect.setArray2(name, this._vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in this._vectors3Arrays) {\r\n this._effect.setArray3(name, this._vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in this._vectors4Arrays) {\r\n this._effect.setArray4(name, this._vectors4Arrays[name]);\r\n }\r\n }\r\n this._afterBind(mesh);\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n ShaderMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n for (var name in this._textures) {\r\n activeTextures.push(this._textures[name]);\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n activeTextures.push(array[index]);\r\n }\r\n }\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n ShaderMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n for (var name in this._textures) {\r\n if (this._textures[name] === texture) {\r\n return true;\r\n }\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n if (array[index] === texture) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n ShaderMaterial.prototype.clone = function (name) {\r\n var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);\r\n return newShaderMaterial;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n ShaderMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n if (forceDisposeTextures) {\r\n var name;\r\n for (name in this._textures) {\r\n this._textures[name].dispose();\r\n }\r\n for (name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n array[index].dispose();\r\n }\r\n }\r\n }\r\n this._textures = {};\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n ShaderMaterial.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"BABYLON.ShaderMaterial\";\r\n serializationObject.options = this._options;\r\n serializationObject.shaderPath = this._shaderPath;\r\n var name;\r\n // Texture\r\n serializationObject.textures = {};\r\n for (name in this._textures) {\r\n serializationObject.textures[name] = this._textures[name].serialize();\r\n }\r\n // Texture arrays\r\n serializationObject.textureArrays = {};\r\n for (name in this._textureArrays) {\r\n serializationObject.textureArrays[name] = [];\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n serializationObject.textureArrays[name].push(array[index].serialize());\r\n }\r\n }\r\n // Float\r\n serializationObject.floats = {};\r\n for (name in this._floats) {\r\n serializationObject.floats[name] = this._floats[name];\r\n }\r\n // Float s\r\n serializationObject.FloatArrays = {};\r\n for (name in this._floatsArrays) {\r\n serializationObject.FloatArrays[name] = this._floatsArrays[name];\r\n }\r\n // Color3\r\n serializationObject.colors3 = {};\r\n for (name in this._colors3) {\r\n serializationObject.colors3[name] = this._colors3[name].asArray();\r\n }\r\n // Color3 array\r\n serializationObject.colors3Arrays = {};\r\n for (name in this._colors3Arrays) {\r\n serializationObject.colors3Arrays[name] = this._colors3Arrays[name];\r\n }\r\n // Color4\r\n serializationObject.colors4 = {};\r\n for (name in this._colors4) {\r\n serializationObject.colors4[name] = this._colors4[name].asArray();\r\n }\r\n // Color4 array\r\n serializationObject.colors4Arrays = {};\r\n for (name in this._colors4Arrays) {\r\n serializationObject.colors4Arrays[name] = this._colors4Arrays[name];\r\n }\r\n // Vector2\r\n serializationObject.vectors2 = {};\r\n for (name in this._vectors2) {\r\n serializationObject.vectors2[name] = this._vectors2[name].asArray();\r\n }\r\n // Vector3\r\n serializationObject.vectors3 = {};\r\n for (name in this._vectors3) {\r\n serializationObject.vectors3[name] = this._vectors3[name].asArray();\r\n }\r\n // Vector4\r\n serializationObject.vectors4 = {};\r\n for (name in this._vectors4) {\r\n serializationObject.vectors4[name] = this._vectors4[name].asArray();\r\n }\r\n // Matrix\r\n serializationObject.matrices = {};\r\n for (name in this._matrices) {\r\n serializationObject.matrices[name] = this._matrices[name].asArray();\r\n }\r\n // Matrix 3x3\r\n serializationObject.matrices3x3 = {};\r\n for (name in this._matrices3x3) {\r\n serializationObject.matrices3x3[name] = this._matrices3x3[name];\r\n }\r\n // Matrix 2x2\r\n serializationObject.matrices2x2 = {};\r\n for (name in this._matrices2x2) {\r\n serializationObject.matrices2x2[name] = this._matrices2x2[name];\r\n }\r\n // Vector2Array\r\n serializationObject.vectors2Arrays = {};\r\n for (name in this._vectors2Arrays) {\r\n serializationObject.vectors2Arrays[name] = this._vectors2Arrays[name];\r\n }\r\n // Vector3Array\r\n serializationObject.vectors3Arrays = {};\r\n for (name in this._vectors3Arrays) {\r\n serializationObject.vectors3Arrays[name] = this._vectors3Arrays[name];\r\n }\r\n // Vector4Array\r\n serializationObject.vectors4Arrays = {};\r\n for (name in this._vectors4Arrays) {\r\n serializationObject.vectors4Arrays[name] = this._vectors4Arrays[name];\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a shader material from parsed shader material data\r\n * @param source defines the JSON represnetation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new material\r\n */\r\n ShaderMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new ShaderMaterial(source.name, scene, source.shaderPath, source.options); }, source, scene, rootUrl);\r\n var name;\r\n // Texture\r\n for (name in source.textures) {\r\n material.setTexture(name, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].Parse(source.textures[name], scene, rootUrl));\r\n }\r\n // Texture arrays\r\n for (name in source.textureArrays) {\r\n var array = source.textureArrays[name];\r\n var textureArray = new Array();\r\n for (var index = 0; index < array.length; index++) {\r\n textureArray.push(_Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].Parse(array[index], scene, rootUrl));\r\n }\r\n material.setTextureArray(name, textureArray);\r\n }\r\n // Float\r\n for (name in source.floats) {\r\n material.setFloat(name, source.floats[name]);\r\n }\r\n // Float s\r\n for (name in source.floatsArrays) {\r\n material.setFloats(name, source.floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in source.colors3) {\r\n material.setColor3(name, _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"].FromArray(source.colors3[name]));\r\n }\r\n // Color3 arrays\r\n for (name in source.colors3Arrays) {\r\n var colors = source.colors3Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 3 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color3\"].FromArray(color); });\r\n material.setColor3Array(name, colors);\r\n }\r\n // Color4\r\n for (name in source.colors4) {\r\n material.setColor4(name, _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color4\"].FromArray(source.colors4[name]));\r\n }\r\n // Color4 arrays\r\n for (name in source.colors4Arrays) {\r\n var colors = source.colors4Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 4 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return _Maths_math_color__WEBPACK_IMPORTED_MODULE_9__[\"Color4\"].FromArray(color); });\r\n material.setColor4Array(name, colors);\r\n }\r\n // Vector2\r\n for (name in source.vectors2) {\r\n material.setVector2(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"].FromArray(source.vectors2[name]));\r\n }\r\n // Vector3\r\n for (name in source.vectors3) {\r\n material.setVector3(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].FromArray(source.vectors3[name]));\r\n }\r\n // Vector4\r\n for (name in source.vectors4) {\r\n material.setVector4(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector4\"].FromArray(source.vectors4[name]));\r\n }\r\n // Matrix\r\n for (name in source.matrices) {\r\n material.setMatrix(name, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Matrix\"].FromArray(source.matrices[name]));\r\n }\r\n // Matrix 3x3\r\n for (name in source.matrices3x3) {\r\n material.setMatrix3x3(name, source.matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in source.matrices2x2) {\r\n material.setMatrix2x2(name, source.matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in source.vectors2Arrays) {\r\n material.setArray2(name, source.vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in source.vectors3Arrays) {\r\n material.setArray3(name, source.vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in source.vectors4Arrays) {\r\n material.setArray4(name, source.vectors4Arrays[name]);\r\n }\r\n return material;\r\n };\r\n return ShaderMaterial;\r\n}(_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_8__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.ShaderMaterial\"] = ShaderMaterial;\r\n\n\n/***/ }),\n\n/***/ \"./Materials/standardMaterial.ts\":\n/*!***************************************!*\\\n !*** ./Materials/standardMaterial.ts ***!\n \\***************************************/\n/*! exports provided: StandardMaterialDefines, StandardMaterial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return StandardMaterialDefines; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return StandardMaterial; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _effect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_materialDefines__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/materialDefines */ \"./Materials/materialDefines.ts\");\n/* harmony import */ var _pushMaterial__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./pushMaterial */ \"./Materials/pushMaterial.ts\");\n/* harmony import */ var _materialHelper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _materialFlags__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./materialFlags */ \"./Materials/materialFlags.ts\");\n/* harmony import */ var _Shaders_default_fragment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/default.fragment */ \"./Shaders/default.fragment.ts\");\n/* harmony import */ var _Shaders_default_vertex__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Shaders/default.vertex */ \"./Shaders/default.vertex.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar StandardMaterialDefines = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StandardMaterialDefines, _super);\r\n function StandardMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.DIFFUSE = false;\r\n _this.DIFFUSEDIRECTUV = 0;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.OPACITY = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.REFLECTION = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.SPECULAR = false;\r\n _this.SPECULARDIRECTUV = 0;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.SPECULAROVERALPHA = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHAFROMDIFFUSE = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.SPECULARTERM = false;\r\n _this.DIFFUSEFRESNEL = false;\r\n _this.OPACITYFRESNEL = false;\r\n _this.REFLECTIONFRESNEL = false;\r\n _this.REFRACTIONFRESNEL = false;\r\n _this.EMISSIVEFRESNEL = false;\r\n _this.FRESNEL = false;\r\n _this.NORMAL = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.VERTEXCOLOR = false;\r\n _this.VERTEXALPHA = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.INSTANCES = false;\r\n _this.GLOSSINESS = false;\r\n _this.ROUGHNESS = false;\r\n _this.EMISSIVEASILLUMINATION = false;\r\n _this.LINKEMISSIVEWITHDIFFUSE = false;\r\n _this.REFLECTIONFRESNELFROMSPECULAR = false;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_SKYBOX_TRANSFORMED = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.REFRACTION = false;\r\n _this.REFRACTIONMAP_3D = false;\r\n _this.REFLECTIONOVERALPHA = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.NONUNIFORMSCALING = false; // https://playground.babylonjs.com#V6DWIH\r\n _this.PREMULTIPLYALPHA = false; // https://playground.babylonjs.com#LNVJJ7\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.MULTIVIEW = false;\r\n /**\r\n * If the reflection texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFLECTION_LINEAR = false;\r\n /**\r\n * If the refraction texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFRACTION_LINEAR = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n StandardMaterialDefines.prototype.setReflectionMode = function (modeToEnable) {\r\n var modes = [\r\n \"REFLECTIONMAP_CUBIC\", \"REFLECTIONMAP_EXPLICIT\", \"REFLECTIONMAP_PLANAR\",\r\n \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_SKYBOX\",\r\n \"REFLECTIONMAP_SPHERICAL\", \"REFLECTIONMAP_EQUIRECTANGULAR\", \"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\",\r\n \"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\"\r\n ];\r\n for (var _i = 0, modes_1 = modes; _i < modes_1.length; _i++) {\r\n var mode = modes_1[_i];\r\n this[mode] = (mode === modeToEnable);\r\n }\r\n };\r\n return StandardMaterialDefines;\r\n}(_Materials_materialDefines__WEBPACK_IMPORTED_MODULE_9__[\"MaterialDefines\"]));\r\n\r\n/**\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see http://doc.babylonjs.com/babylon101/materials\r\n */\r\nvar StandardMaterial = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StandardMaterial, _super);\r\n /**\r\n * Instantiates a new standard material.\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see http://doc.babylonjs.com/babylon101/materials\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n function StandardMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._diffuseTexture = null;\r\n _this._ambientTexture = null;\r\n _this._opacityTexture = null;\r\n _this._reflectionTexture = null;\r\n _this._emissiveTexture = null;\r\n _this._specularTexture = null;\r\n _this._bumpTexture = null;\r\n _this._lightmapTexture = null;\r\n _this._refractionTexture = null;\r\n /**\r\n * The color of the material lit by the environmental background lighting.\r\n * @see http://doc.babylonjs.com/babylon101/materials#ambient-color-example\r\n */\r\n _this.ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](0, 0, 0);\r\n /**\r\n * The basic color of the material as viewed under a light.\r\n */\r\n _this.diffuseColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Define how the color and intensity of the highlight given by the light in the material.\r\n */\r\n _this.specularColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Define the color of the material as if self lit.\r\n * This will be mixed in the final result even in the absence of light.\r\n */\r\n _this.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](0, 0, 0);\r\n /**\r\n * Defines how sharp are the highlights in the material.\r\n * The bigger the value the sharper giving a more glossy feeling to the result.\r\n * Reversely, the smaller the value the blurrier giving a more rough feeling to the result.\r\n */\r\n _this.specularPower = 64;\r\n _this._useAlphaFromDiffuseTexture = false;\r\n _this._useEmissiveAsIllumination = false;\r\n _this._linkEmissiveWithDiffuse = false;\r\n _this._useSpecularOverAlpha = false;\r\n _this._useReflectionOverAlpha = false;\r\n _this._disableLighting = false;\r\n _this._useObjectSpaceNormalMap = false;\r\n _this._useParallax = false;\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Apply a scaling factor that determine which \"depth\" the height map should reprensent. A value between 0.05 and 0.1 is reasonnable in Parallax, you can reach 0.2 using Parallax Occlusion.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n _this._roughness = 0;\r\n /**\r\n * In case of refraction, define the value of the index of refraction.\r\n * @see http://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.indexOfRefraction = 0.98;\r\n /**\r\n * Invert the refraction texture alongside the y axis.\r\n * It can be useful with procedural textures or probe for instance.\r\n * @see http://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.invertRefractionY = true;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n _this._useLightmapAsShadowmap = false;\r\n _this._useReflectionFresnelFromSpecular = false;\r\n _this._useGlossinessFromSpecularMapAlpha = false;\r\n _this._maxSimultaneousLights = 4;\r\n _this._invertNormalMapX = false;\r\n _this._invertNormalMapY = false;\r\n _this._twoSidedLighting = false;\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_2__[\"SmartArray\"](16);\r\n _this._worldViewProjectionMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Zero();\r\n _this._globalAmbientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](0, 0, 0);\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (StandardMaterial.ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && _this._refractionTexture && _this._refractionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._refractionTexture);\r\n }\r\n return _this._renderTargets;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(StandardMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n StandardMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (StandardMaterial.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"StandardMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n StandardMaterial.prototype.getClassName = function () {\r\n return \"StandardMaterial\";\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes)\r\n * You can try switching to logarithmic depth.\r\n * @see http://doc.babylonjs.com/how_to/using_logarithmic_depth_buffer\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n this._markAllSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n StandardMaterial.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture() || this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n StandardMaterial.prototype.needAlphaTesting = function () {\r\n return this._diffuseTexture != null && this._diffuseTexture.hasAlpha;\r\n };\r\n StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function () {\r\n return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture;\r\n };\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns the diffuse texture in case of the standard material.\r\n */\r\n StandardMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._diffuseTexture;\r\n };\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n StandardMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (this._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new StandardMaterialDefines();\r\n }\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n var engine = scene.getEngine();\r\n // Lights\r\n defines._needNormals = _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n // Multiview\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMultiview(scene, defines);\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n defines.MAINUV1 = false;\r\n defines.MAINUV2 = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._diffuseTexture, defines, \"DIFFUSE\");\r\n }\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n }\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (!this._reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needNormals = true;\r\n defines.REFLECTION = true;\r\n defines.ROUGHNESS = (this._roughness > 0);\r\n defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;\r\n defines.INVERTCUBICMAP = (this._reflectionTexture.coordinatesMode === _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].INVCUBIC_MODE);\r\n defines.REFLECTIONMAP_3D = this._reflectionTexture.isCube;\r\n switch (this._reflectionTexture.coordinatesMode) {\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].EXPLICIT_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EXPLICIT\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].PLANAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PLANAR\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].PROJECTION_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PROJECTION\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].SKYBOX_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SKYBOX\");\r\n defines.REFLECTIONMAP_SKYBOX_TRANSFORMED = !this._reflectionTexture.getReflectionTextureMatrix().isIdentity();\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].SPHERICAL_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SPHERICAL\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].FIXED_EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");\r\n break;\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].CUBIC_MODE:\r\n case _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_12__[\"Texture\"].INVCUBIC_MODE:\r\n default:\r\n defines.setReflectionMode(\"REFLECTIONMAP_CUBIC\");\r\n break;\r\n }\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = this._reflectionTexture.boundingBoxSize ? true : false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n }\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n if (!this._specularTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._specularTexture, defines, \"SPECULAR\");\r\n defines.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha;\r\n }\r\n }\r\n else {\r\n defines.SPECULAR = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && StandardMaterial.BumpTextureEnabled) {\r\n // Bump texure can not be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n else {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n defines.PARALLAX = this._useParallax;\r\n defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n if (!this._refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needUVs = true;\r\n defines.REFRACTION = true;\r\n defines.REFRACTIONMAP_3D = this._refractionTexture.isCube;\r\n }\r\n }\r\n else {\r\n defines.REFRACTION = false;\r\n }\r\n defines.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting;\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n defines.AMBIENT = false;\r\n defines.OPACITY = false;\r\n defines.REFLECTION = false;\r\n defines.EMISSIVE = false;\r\n defines.LIGHTMAP = false;\r\n defines.BUMP = false;\r\n defines.REFRACTION = false;\r\n }\r\n defines.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture();\r\n defines.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination;\r\n defines.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse;\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].ALPHA_PREMULTIPLIED || this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].ALPHA_PREMULTIPLIED_PORTERDUFF);\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\r\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\r\n }\r\n if (defines._areFresnelDirty) {\r\n if (StandardMaterial.FresnelEnabled) {\r\n // Fresnel\r\n if (this._diffuseFresnelParameters || this._opacityFresnelParameters ||\r\n this._emissiveFresnelParameters || this._refractionFresnelParameters ||\r\n this._reflectionFresnelParameters) {\r\n defines.DIFFUSEFRESNEL = (this._diffuseFresnelParameters && this._diffuseFresnelParameters.isEnabled);\r\n defines.OPACITYFRESNEL = (this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNEL = (this._reflectionFresnelParameters && this._reflectionFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNELFROMSPECULAR = this._useReflectionFresnelFromSpecular;\r\n defines.REFRACTIONFRESNEL = (this._refractionFresnelParameters && this._refractionFresnelParameters.isEnabled);\r\n defines.EMISSIVEFRESNEL = (this._emissiveFresnelParameters && this._emissiveFresnelParameters.isEnabled);\r\n defines._needNormals = true;\r\n defines.FRESNEL = true;\r\n }\r\n }\r\n else {\r\n defines.FRESNEL = false;\r\n }\r\n }\r\n // Misc.\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n // Attribs\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForAttributes(mesh, defines, true, true, true);\r\n // Values that need to be evaluated on every frame\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n var lightDisposed = defines._areLightsDisposed;\r\n defines.markAsProcessed();\r\n // Fallbacks\r\n var fallbacks = new _effect__WEBPACK_IMPORTED_MODULE_8__[\"EffectFallbacks\"]();\r\n if (defines.REFLECTION) {\r\n fallbacks.addFallback(0, \"REFLECTION\");\r\n }\r\n if (defines.SPECULAR) {\r\n fallbacks.addFallback(0, \"SPECULAR\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(0, \"BUMP\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(1, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(0, \"PARALLAXOCCLUSION\");\r\n }\r\n if (defines.SPECULAROVERALPHA) {\r\n fallbacks.addFallback(0, \"SPECULAROVERALPHA\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(0, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(0, \"SPECULARTERM\");\r\n }\r\n if (defines.DIFFUSEFRESNEL) {\r\n fallbacks.addFallback(1, \"DIFFUSEFRESNEL\");\r\n }\r\n if (defines.OPACITYFRESNEL) {\r\n fallbacks.addFallback(2, \"OPACITYFRESNEL\");\r\n }\r\n if (defines.REFLECTIONFRESNEL) {\r\n fallbacks.addFallback(3, \"REFLECTIONFRESNEL\");\r\n }\r\n if (defines.EMISSIVEFRESNEL) {\r\n fallbacks.addFallback(4, \"EMISSIVEFRESNEL\");\r\n }\r\n if (defines.FRESNEL) {\r\n fallbacks.addFallback(4, \"FRESNEL\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].NormalKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"VertexBuffer\"].ColorKind);\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareAttributesForInstances(attribs, defines);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"default\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vDiffuseColor\", \"vSpecularColor\", \"vEmissiveColor\", \"visibility\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vEmissiveInfos\", \"vSpecularInfos\", \"vBumpInfos\", \"vLightmapInfos\", \"vRefractionInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"diffuseMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"specularMatrix\", \"bumpMatrix\", \"normalMatrix\", \"lightmapMatrix\", \"refractionMatrix\",\r\n \"diffuseLeftColor\", \"diffuseRightColor\", \"opacityParts\", \"reflectionLeftColor\", \"reflectionRightColor\", \"emissiveLeftColor\", \"emissiveRightColor\", \"refractionLeftColor\", \"refractionRightColor\",\r\n \"vReflectionPosition\", \"vReflectionSize\",\r\n \"logarithmicDepthConstant\", \"vTangentSpaceParams\", \"alphaCutOff\", \"boneTextureWidth\"\r\n ];\r\n var samplers = [\"diffuseSampler\", \"ambientSampler\", \"opacitySampler\", \"reflectionCubeSampler\",\r\n \"reflection2DSampler\", \"emissiveSampler\", \"specularSampler\", \"bumpSampler\", \"lightmapSampler\",\r\n \"refractionCubeSampler\", \"refraction2DSampler\", \"boneSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n if (_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingConfiguration\"]) {\r\n _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, defines);\r\n _imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, defines);\r\n }\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines);\r\n }\r\n var join = defines.toString();\r\n var previousEffect = subMesh.effect;\r\n var effect = scene.getEngine().createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS }\r\n }, engine);\r\n if (effect) {\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n this._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Builds the material UBO layouts.\r\n * Used internally during the effect preparation.\r\n */\r\n StandardMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"diffuseLeftColor\", 4);\r\n ubo.addUniform(\"diffuseRightColor\", 4);\r\n ubo.addUniform(\"opacityParts\", 4);\r\n ubo.addUniform(\"reflectionLeftColor\", 4);\r\n ubo.addUniform(\"reflectionRightColor\", 4);\r\n ubo.addUniform(\"refractionLeftColor\", 4);\r\n ubo.addUniform(\"refractionRightColor\", 4);\r\n ubo.addUniform(\"emissiveLeftColor\", 4);\r\n ubo.addUniform(\"emissiveRightColor\", 4);\r\n ubo.addUniform(\"vDiffuseInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 2);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vSpecularInfos\", 2);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"diffuseMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"specularMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"refractionMatrix\", 16);\r\n ubo.addUniform(\"vRefractionInfos\", 4);\r\n ubo.addUniform(\"vSpecularColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n ubo.addUniform(\"vDiffuseColor\", 4);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n StandardMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"refraction2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n StandardMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindBonesParameters(mesh, effect);\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n if (StandardMaterial.FresnelEnabled && defines.FRESNEL) {\r\n // Fresnel\r\n if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"diffuseLeftColor\", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);\r\n ubo.updateColor4(\"diffuseRightColor\", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);\r\n }\r\n if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"opacityParts\", new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);\r\n }\r\n if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"reflectionLeftColor\", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);\r\n ubo.updateColor4(\"reflectionRightColor\", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);\r\n }\r\n if (this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"refractionLeftColor\", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power);\r\n ubo.updateColor4(\"refractionRightColor\", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias);\r\n }\r\n if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"emissiveLeftColor\", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);\r\n ubo.updateColor4(\"emissiveRightColor\", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._diffuseTexture, ubo, \"diffuse\");\r\n if (this._diffuseTexture.hasAlpha) {\r\n effect.setFloat(\"alphaCutOff\", this.alphaCutOff);\r\n }\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n ubo.updateFloat2(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n ubo.updateFloat2(\"vReflectionInfos\", this._reflectionTexture.level, this.roughness);\r\n ubo.updateMatrix(\"reflectionMatrix\", this._reflectionTexture.getReflectionTextureMatrix());\r\n if (this._reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = this._reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n ubo.updateFloat2(\"vSpecularInfos\", this._specularTexture.coordinatesIndex, this._specularTexture.level);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._specularTexture, ubo, \"specular\");\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level, this.parallaxScaleBias);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (!this._refractionTexture.isCube) {\r\n ubo.updateMatrix(\"refractionMatrix\", this._refractionTexture.getReflectionTextureMatrix());\r\n if (this._refractionTexture.depth) {\r\n depth = this._refractionTexture.depth;\r\n }\r\n }\r\n ubo.updateFloat4(\"vRefractionInfos\", this._refractionTexture.level, this.indexOfRefraction, depth, this.invertRefractionY ? -1 : 1);\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n if (defines.SPECULARTERM) {\r\n ubo.updateColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", StandardMaterial.EmissiveTextureEnabled ? this.emissiveColor : _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"].BlackReadOnly);\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Diffuse\r\n ubo.updateColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n effect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n effect.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n effect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (this._reflectionTexture.isCube) {\r\n effect.setTexture(\"reflectionCubeSampler\", this._reflectionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"reflection2DSampler\", this._reflectionTexture);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n effect.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n effect.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n effect.setTexture(\"specularSampler\", this._specularTexture);\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n effect.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (this._refractionTexture.isCube) {\r\n effect.setTexture(\"refractionCubeSampler\", this._refractionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"refraction2DSampler\", this._refractionTexture);\r\n }\r\n }\r\n }\r\n // Clip plane\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindClipPlane(effect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindEyePosition(effect, scene);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindLights(scene, mesh, effect, defines, this._maxSimultaneousLights, false, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindFogParameters(scene, mesh, effect);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, effect);\r\n }\r\n // Log. depth\r\n _materialHelper__WEBPACK_IMPORTED_MODULE_11__[\"MaterialHelper\"].BindLogDepth(defines, effect, scene);\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n }\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n StandardMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture && this._specularTexture.animations && this._specularTexture.animations.length > 0) {\r\n results.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n results.push(this._refractionTexture);\r\n }\r\n return results;\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n StandardMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture) {\r\n activeTextures.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n StandardMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._emissiveTexture === texture) {\r\n return true;\r\n }\r\n if (this._specularTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n */\r\n StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._ambientTexture) {\r\n this._ambientTexture.dispose();\r\n }\r\n if (this._opacityTexture) {\r\n this._opacityTexture.dispose();\r\n }\r\n if (this._reflectionTexture) {\r\n this._reflectionTexture.dispose();\r\n }\r\n if (this._emissiveTexture) {\r\n this._emissiveTexture.dispose();\r\n }\r\n if (this._specularTexture) {\r\n this._specularTexture.dispose();\r\n }\r\n if (this._bumpTexture) {\r\n this._bumpTexture.dispose();\r\n }\r\n if (this._lightmapTexture) {\r\n this._lightmapTexture.dispose();\r\n }\r\n if (this._refractionTexture) {\r\n this._refractionTexture.dispose();\r\n }\r\n }\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n StandardMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var result = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new StandardMaterial(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n return result;\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n StandardMaterial.prototype.serialize = function () {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n };\r\n /**\r\n * Creates a standard material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new standard material\r\n */\r\n StandardMaterial.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new StandardMaterial(source.name, scene); }, source, scene, rootUrl);\r\n };\r\n Object.defineProperty(StandardMaterial, \"DiffuseTextureEnabled\", {\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].DiffuseTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].AmbientTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].OpacityTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ReflectionTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].EmissiveTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].SpecularTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].BumpTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].LightmapTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].RefractionTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].ColorGradingTextureEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].FresnelEnabled;\r\n },\r\n set: function (value) {\r\n _materialFlags__WEBPACK_IMPORTED_MODULE_14__[\"MaterialFlags\"].FresnelEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"diffuseTexture\")\r\n ], StandardMaterial.prototype, \"_diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"diffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"ambientTexture\")\r\n ], StandardMaterial.prototype, \"_ambientTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"ambientTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"opacityTexture\")\r\n ], StandardMaterial.prototype, \"_opacityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"reflectionTexture\")\r\n ], StandardMaterial.prototype, \"_reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"reflectionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"emissiveTexture\")\r\n ], StandardMaterial.prototype, \"_emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"emissiveTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"specularTexture\")\r\n ], StandardMaterial.prototype, \"_specularTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"specularTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"bumpTexture\")\r\n ], StandardMaterial.prototype, \"_bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"bumpTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lightmapTexture\")\r\n ], StandardMaterial.prototype, \"_lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"lightmapTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"refractionTexture\")\r\n ], StandardMaterial.prototype, \"_refractionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"refractionTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"ambient\")\r\n ], StandardMaterial.prototype, \"ambientColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"diffuse\")\r\n ], StandardMaterial.prototype, \"diffuseColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"specular\")\r\n ], StandardMaterial.prototype, \"specularColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsColor3\"])(\"emissive\")\r\n ], StandardMaterial.prototype, \"emissiveColor\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"specularPower\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useAlphaFromDiffuseTexture\")\r\n ], StandardMaterial.prototype, \"_useAlphaFromDiffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useAlphaFromDiffuseTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useEmissiveAsIllumination\")\r\n ], StandardMaterial.prototype, \"_useEmissiveAsIllumination\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useEmissiveAsIllumination\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"linkEmissiveWithDiffuse\")\r\n ], StandardMaterial.prototype, \"_linkEmissiveWithDiffuse\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"linkEmissiveWithDiffuse\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useSpecularOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useSpecularOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useReflectionOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useReflectionOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionOverAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"disableLighting\")\r\n ], StandardMaterial.prototype, \"_disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"disableLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useObjectSpaceNormalMap\")\r\n ], StandardMaterial.prototype, \"_useObjectSpaceNormalMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useParallax\")\r\n ], StandardMaterial.prototype, \"_useParallax\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallax\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useParallaxOcclusion\")\r\n ], StandardMaterial.prototype, \"_useParallaxOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"roughness\")\r\n ], StandardMaterial.prototype, \"_roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"roughness\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"indexOfRefraction\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"invertRefractionY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"alphaCutOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useLightmapAsShadowmap\")\r\n ], StandardMaterial.prototype, \"_useLightmapAsShadowmap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"diffuseFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_diffuseFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"diffuseFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"opacityFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_opacityFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"reflectionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_reflectionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"reflectionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"refractionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_refractionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"refractionFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsFresnelParameters\"])(\"emissiveFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_emissiveFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"emissiveFresnelParameters\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useReflectionFresnelFromSpecular\")\r\n ], StandardMaterial.prototype, \"_useReflectionFresnelFromSpecular\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionFresnelFromSpecular\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"useGlossinessFromSpecularMapAlpha\")\r\n ], StandardMaterial.prototype, \"_useGlossinessFromSpecularMapAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useGlossinessFromSpecularMapAlpha\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"maxSimultaneousLights\")\r\n ], StandardMaterial.prototype, \"_maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"invertNormalMapX\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapX\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"invertNormalMapY\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapY\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"twoSidedLighting\")\r\n ], StandardMaterial.prototype, \"_twoSidedLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"expandToProperty\"])(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"twoSidedLighting\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardMaterial.prototype, \"useLogarithmicDepth\", null);\r\n return StandardMaterial;\r\n}(_pushMaterial__WEBPACK_IMPORTED_MODULE_10__[\"PushMaterial\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_13__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StandardMaterial\"] = StandardMaterial;\r\n_scene__WEBPACK_IMPORTED_MODULE_3__[\"Scene\"].DefaultMaterialFactory = function (scene) {\r\n return new StandardMaterial(\"default material\", scene);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Materials/uniformBuffer.ts\":\n/*!************************************!*\\\n !*** ./Materials/uniformBuffer.ts ***!\n \\************************************/\n/*! exports provided: UniformBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return UniformBuffer; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n */\r\nvar UniformBuffer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * @see https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n * @param engine Define the engine the buffer is associated with\r\n * @param data Define the data contained in the buffer\r\n * @param dynamic Define if the buffer is updatable\r\n */\r\n function UniformBuffer(engine, data, dynamic) {\r\n // Matrix cache\r\n this._valueCache = {};\r\n this._engine = engine;\r\n this._noUBO = !engine.supportsUniformBuffers;\r\n this._dynamic = dynamic;\r\n this._data = data || [];\r\n this._uniformLocations = {};\r\n this._uniformSizes = {};\r\n this._uniformLocationPointer = 0;\r\n this._needSync = false;\r\n if (this._noUBO) {\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForEffect;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForEffect;\r\n this.updateFloat = this._updateFloatForEffect;\r\n this.updateFloat2 = this._updateFloat2ForEffect;\r\n this.updateFloat3 = this._updateFloat3ForEffect;\r\n this.updateFloat4 = this._updateFloat4ForEffect;\r\n this.updateMatrix = this._updateMatrixForEffect;\r\n this.updateVector3 = this._updateVector3ForEffect;\r\n this.updateVector4 = this._updateVector4ForEffect;\r\n this.updateColor3 = this._updateColor3ForEffect;\r\n this.updateColor4 = this._updateColor4ForEffect;\r\n }\r\n else {\r\n this._engine._uniformBuffers.push(this);\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForUniform;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForUniform;\r\n this.updateFloat = this._updateFloatForUniform;\r\n this.updateFloat2 = this._updateFloat2ForUniform;\r\n this.updateFloat3 = this._updateFloat3ForUniform;\r\n this.updateFloat4 = this._updateFloat4ForUniform;\r\n this.updateMatrix = this._updateMatrixForUniform;\r\n this.updateVector3 = this._updateVector3ForUniform;\r\n this.updateVector4 = this._updateVector4ForUniform;\r\n this.updateColor3 = this._updateColor3ForUniform;\r\n this.updateColor4 = this._updateColor4ForUniform;\r\n }\r\n }\r\n Object.defineProperty(UniformBuffer.prototype, \"useUbo\", {\r\n /**\r\n * Indicates if the buffer is using the WebGL2 UBO implementation,\r\n * or just falling back on setUniformXXX calls.\r\n */\r\n get: function () {\r\n return !this._noUBO;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UniformBuffer.prototype, \"isSync\", {\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is in sync\r\n * with the javascript cache data.\r\n */\r\n get: function () {\r\n return !this._needSync;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is dynamic.\r\n * Also, a dynamic UniformBuffer will disable cache verification and always\r\n * update the underlying WebGL uniform buffer to the GPU.\r\n * @returns if Dynamic, otherwise false\r\n */\r\n UniformBuffer.prototype.isDynamic = function () {\r\n return this._dynamic !== undefined;\r\n };\r\n /**\r\n * The data cache on JS side.\r\n * @returns the underlying data as a float array\r\n */\r\n UniformBuffer.prototype.getData = function () {\r\n return this._bufferData;\r\n };\r\n /**\r\n * The underlying WebGL Uniform buffer.\r\n * @returns the webgl buffer\r\n */\r\n UniformBuffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * std140 layout specifies how to align data within an UBO structure.\r\n * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159\r\n * for specs.\r\n */\r\n UniformBuffer.prototype._fillAlignment = function (size) {\r\n // This code has been simplified because we only use floats, vectors of 1, 2, 3, 4 components\r\n // and 4x4 matrices\r\n // TODO : change if other types are used\r\n var alignment;\r\n if (size <= 2) {\r\n alignment = size;\r\n }\r\n else {\r\n alignment = 4;\r\n }\r\n if ((this._uniformLocationPointer % alignment) !== 0) {\r\n var oldPointer = this._uniformLocationPointer;\r\n this._uniformLocationPointer += alignment - (this._uniformLocationPointer % alignment);\r\n var diff = this._uniformLocationPointer - oldPointer;\r\n for (var i = 0; i < diff; i++) {\r\n this._data.push(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Adds an uniform in the buffer.\r\n * Warning : the subsequents calls of this function must be in the same order as declared in the shader\r\n * for the layout to be correct !\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param size Data size, or data directly.\r\n */\r\n UniformBuffer.prototype.addUniform = function (name, size) {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._uniformLocations[name] !== undefined) {\r\n // Already existing uniform\r\n return;\r\n }\r\n // This function must be called in the order of the shader layout !\r\n // size can be the size of the uniform, or data directly\r\n var data;\r\n if (size instanceof Array) {\r\n data = size;\r\n size = data.length;\r\n }\r\n else {\r\n size = size;\r\n data = [];\r\n // Fill with zeros\r\n for (var i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n }\r\n this._fillAlignment(size);\r\n this._uniformSizes[name] = size;\r\n this._uniformLocations[name] = this._uniformLocationPointer;\r\n this._uniformLocationPointer += size;\r\n for (var i = 0; i < size; i++) {\r\n this._data.push(data[i]);\r\n }\r\n this._needSync = true;\r\n };\r\n /**\r\n * Adds a Matrix 4x4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param mat A 4x4 matrix.\r\n */\r\n UniformBuffer.prototype.addMatrix = function (name, mat) {\r\n this.addUniform(name, Array.prototype.slice.call(mat.toArray()));\r\n };\r\n /**\r\n * Adds a vec2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec2\r\n * @param y Define the y component value of the vec2\r\n */\r\n UniformBuffer.prototype.addFloat2 = function (name, x, y) {\r\n var temp = [x, y];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec3\r\n * @param y Define the y component value of the vec3\r\n * @param z Define the z component value of the vec3\r\n */\r\n UniformBuffer.prototype.addFloat3 = function (name, x, y, z) {\r\n var temp = [x, y, z];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the vec3 from a Color\r\n */\r\n UniformBuffer.prototype.addColor3 = function (name, color) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the rgb components from a Color\r\n * @param alpha Define the a component of the vec4\r\n */\r\n UniformBuffer.prototype.addColor4 = function (name, color, alpha) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n temp.push(alpha);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param vector Define the vec3 components from a Vector\r\n */\r\n UniformBuffer.prototype.addVector3 = function (name, vector) {\r\n var temp = new Array();\r\n vector.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a Matrix 3x3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix3x3 = function (name) {\r\n this.addUniform(name, 12);\r\n };\r\n /**\r\n * Adds a Matrix 2x2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix2x2 = function (name) {\r\n this.addUniform(name, 8);\r\n };\r\n /**\r\n * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.\r\n */\r\n UniformBuffer.prototype.create = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._buffer) {\r\n return; // nothing to do\r\n }\r\n // See spec, alignment must be filled as a vec4\r\n this._fillAlignment(4);\r\n this._bufferData = new Float32Array(this._data);\r\n this._rebuild();\r\n this._needSync = true;\r\n };\r\n /** @hidden */\r\n UniformBuffer.prototype._rebuild = function () {\r\n if (this._noUBO || !this._bufferData) {\r\n return;\r\n }\r\n if (this._dynamic) {\r\n this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData);\r\n }\r\n else {\r\n this._buffer = this._engine.createUniformBuffer(this._bufferData);\r\n }\r\n };\r\n /**\r\n * Updates the WebGL Uniform Buffer on the GPU.\r\n * If the `dynamic` flag is set to true, no cache comparison is done.\r\n * Otherwise, the buffer will be updated only if the cache differs.\r\n */\r\n UniformBuffer.prototype.update = function () {\r\n if (!this._buffer) {\r\n this.create();\r\n return;\r\n }\r\n if (!this._dynamic && !this._needSync) {\r\n return;\r\n }\r\n this._engine.updateUniformBuffer(this._buffer, this._bufferData);\r\n this._needSync = false;\r\n };\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n UniformBuffer.prototype.updateUniform = function (uniformName, data, size) {\r\n var location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n if (this._buffer) {\r\n // Cannot add an uniform if the buffer is already created\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Cannot add an uniform after UBO has been created.\");\r\n return;\r\n }\r\n this.addUniform(uniformName, size);\r\n location = this._uniformLocations[uniformName];\r\n }\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n var changed = false;\r\n for (var i = 0; i < size; i++) {\r\n if (size === 16 || this._bufferData[location + i] !== data[i]) {\r\n changed = true;\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n this._needSync = this._needSync || changed;\r\n }\r\n else {\r\n // No cache for dynamic\r\n for (var i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n };\r\n UniformBuffer.prototype._cacheMatrix = function (name, matrix) {\r\n var cache = this._valueCache[name];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[name] = flag;\r\n return true;\r\n };\r\n // Update methods\r\n UniformBuffer.prototype._updateMatrix3x3ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 3; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 3];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 3 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = matrix[i * 3 + 2];\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 12);\r\n };\r\n UniformBuffer.prototype._updateMatrix3x3ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix3x3(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix2x2(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 2; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 2];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 2 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = 0.0;\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 8);\r\n };\r\n UniformBuffer.prototype._updateFloatForEffect = function (name, x) {\r\n this._currentEffect.setFloat(name, x);\r\n };\r\n UniformBuffer.prototype._updateFloatForUniform = function (name, x) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 1);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForEffect = function (name, x, y, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat2(name + suffix, x, y);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForUniform = function (name, x, y) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 2);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForEffect = function (name, x, y, z, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat3(name + suffix, x, y, z);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForUniform = function (name, x, y, z) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForEffect = function (name, x, y, z, w, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat4(name + suffix, x, y, z, w);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForUniform = function (name, x, y, z, w) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n UniformBuffer._tempBuffer[3] = w;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateMatrixForEffect = function (name, mat) {\r\n this._currentEffect.setMatrix(name, mat);\r\n };\r\n UniformBuffer.prototype._updateMatrixForUniform = function (name, mat) {\r\n if (this._cacheMatrix(name, mat)) {\r\n this.updateUniform(name, mat.toArray(), 16);\r\n }\r\n };\r\n UniformBuffer.prototype._updateVector3ForEffect = function (name, vector) {\r\n this._currentEffect.setVector3(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector3ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateVector4ForEffect = function (name, vector) {\r\n this._currentEffect.setVector4(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector4ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateColor3ForEffect = function (name, color, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor3(name + suffix, color);\r\n };\r\n UniformBuffer.prototype._updateColor3ForUniform = function (name, color) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateColor4ForEffect = function (name, color, alpha, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor4(name + suffix, color, alpha);\r\n };\r\n UniformBuffer.prototype._updateColor4ForUniform = function (name, color, alpha) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n UniformBuffer._tempBuffer[3] = alpha;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the texture to set in the sampler\r\n */\r\n UniformBuffer.prototype.setTexture = function (name, texture) {\r\n this._currentEffect.setTexture(name, texture);\r\n };\r\n /**\r\n * Directly updates the value of the uniform in the cache AND on the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n */\r\n UniformBuffer.prototype.updateUniformDirectly = function (uniformName, data) {\r\n this.updateUniform(uniformName, data, data.length);\r\n this.update();\r\n };\r\n /**\r\n * Binds this uniform buffer to an effect.\r\n * @param effect Define the effect to bind the buffer to\r\n * @param name Name of the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.bindToEffect = function (effect, name) {\r\n this._currentEffect = effect;\r\n if (this._noUBO || !this._buffer) {\r\n return;\r\n }\r\n effect.bindUniformBuffer(this._buffer, name);\r\n };\r\n /**\r\n * Disposes the uniform buffer.\r\n */\r\n UniformBuffer.prototype.dispose = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n var uniformBuffers = this._engine._uniformBuffers;\r\n var index = uniformBuffers.indexOf(this);\r\n if (index !== -1) {\r\n uniformBuffers[index] = uniformBuffers[uniformBuffers.length - 1];\r\n uniformBuffers.pop();\r\n }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n // Pool for avoiding memory leaks\r\n UniformBuffer._MAX_UNIFORM_SIZE = 256;\r\n UniformBuffer._tempBuffer = new Float32Array(UniformBuffer._MAX_UNIFORM_SIZE);\r\n return UniformBuffer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/index.ts\":\n/*!************************!*\\\n !*** ./Maths/index.ts ***!\n \\************************/\n/*! exports provided: Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"]; });\n\n/* harmony import */ var _math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math */ \"./Maths/math.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Axis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"TmpColors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Frustum\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Plane\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Size\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Viewport\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"Curve3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _math__WEBPACK_IMPORTED_MODULE_1__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony import */ var _sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return _sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalHarmonics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return _sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalPolynomial\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.axis.ts\":\n/*!****************************!*\\\n !*** ./Maths/math.axis.ts ***!\n \\****************************/\n/*! exports provided: Space, Axis */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return Space; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return Axis; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/** Defines supported spaces */\r\nvar Space;\r\n(function (Space) {\r\n /** Local (object) space */\r\n Space[Space[\"LOCAL\"] = 0] = \"LOCAL\";\r\n /** World space */\r\n Space[Space[\"WORLD\"] = 1] = \"WORLD\";\r\n /** Bone space */\r\n Space[Space[\"BONE\"] = 2] = \"BONE\";\r\n})(Space || (Space = {}));\r\n/** Defines the 3 main axes */\r\nvar Axis = /** @class */ (function () {\r\n function Axis() {\r\n }\r\n /** X axis */\r\n Axis.X = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 0.0, 0.0);\r\n /** Y axis */\r\n Axis.Y = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0.0, 1.0, 0.0);\r\n /** Z axis */\r\n Axis.Z = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0.0, 0.0, 1.0);\r\n return Axis;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.color.ts\":\n/*!*****************************!*\\\n !*** ./Maths/math.color.ts ***!\n \\*****************************/\n/*! exports provided: Color3, Color4, TmpColors */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return Color3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return Color4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return TmpColors; });\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to hold a RBG color\r\n */\r\nvar Color3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color3 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n */\r\n function Color3(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n }\r\n /**\r\n * Creates a string with the Color3 current values\r\n * @returns the string representation of the Color3 object\r\n */\r\n Color3.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color3\"\r\n * @returns \"Color3\"\r\n */\r\n Color3.prototype.getClassName = function () {\r\n return \"Color3\";\r\n };\r\n /**\r\n * Compute the Color3 hash code\r\n * @returns an unique number that can be used to hash Color3 objects\r\n */\r\n Color3.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Stores in the given array from the given starting index the red, green, blue values as successive elements\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color4 object from the current Color3 and the given alpha\r\n * @param alpha defines the alpha component on the new Color4 object (default is 1)\r\n * @returns a new Color4 object\r\n */\r\n Color3.prototype.toColor4 = function (alpha) {\r\n if (alpha === void 0) { alpha = 1; }\r\n return new Color4(this.r, this.g, this.b, alpha);\r\n };\r\n /**\r\n * Returns a new array populated with 3 numeric elements : red, green and blue values\r\n * @returns the new array\r\n */\r\n Color3.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Returns the luminance value\r\n * @returns a float value\r\n */\r\n Color3.prototype.toLuminance = function () {\r\n return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;\r\n };\r\n /**\r\n * Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3 object\r\n */\r\n Color3.prototype.multiply = function (otherColor) {\r\n return new Color3(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);\r\n };\r\n /**\r\n * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the current Color3\r\n */\r\n Color3.prototype.multiplyToRef = function (otherColor, result) {\r\n result.r = this.r * otherColor.r;\r\n result.g = this.g * otherColor.g;\r\n result.b = this.b * otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color3 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b;\r\n };\r\n /**\r\n * Determines equality between the current Color3 object and a set of r,b,g values\r\n * @param r defines the red component to check\r\n * @param g defines the green component to check\r\n * @param b defines the blue component to check\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equalsFloats = function (r, g, b) {\r\n return this.r === r && this.g === g && this.b === b;\r\n };\r\n /**\r\n * Multiplies in place each rgb value by scale\r\n * @param scale defines the scaling factor\r\n * @returns the updated Color3\r\n */\r\n Color3.prototype.scale = function (scale) {\r\n return new Color3(this.r * scale, this.g * scale, this.b * scale);\r\n };\r\n /**\r\n * Multiplies the rgb values by scale and stores the result into \"result\"\r\n * @param scale defines the scaling factor\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color3 values by a factor and add the result to a given Color3\r\n * @param scale defines the scale factor\r\n * @param result defines color to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into\r\n * @returns the original Color3\r\n */\r\n Color3.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.r, min, max);\r\n result.g = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.g, min, max);\r\n result.b = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.b, min, max);\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color3 set with the added values of the current Color3 and of the given one\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.add = function (otherColor) {\r\n return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the addition of the current Color3 and given one rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.addToRef = function (otherColor, result) {\r\n result.r = this.r + otherColor.r;\r\n result.g = this.g + otherColor.g;\r\n result.b = this.b + otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color3 set with the subtracted values of the given one from the current Color3\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.subtract = function (otherColor) {\r\n return new Color3(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the subtraction of given one from the current Color3 rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.subtractToRef = function (otherColor, result) {\r\n result.r = this.r - otherColor.r;\r\n result.g = this.g - otherColor.g;\r\n result.b = this.b - otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Copy the current object\r\n * @returns a new Color3 copied the current one\r\n */\r\n Color3.prototype.clone = function () {\r\n return new Color3(this.r, this.g, this.b);\r\n };\r\n /**\r\n * Copies the rgb values from the source in the current Color3\r\n * @param source defines the source Color3 object\r\n * @returns the updated Color3 object\r\n */\r\n Color3.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.copyFromFloats = function (r, g, b) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.set = function (r, g, b) {\r\n return this.copyFromFloats(r, g, b);\r\n };\r\n /**\r\n * Compute the Color3 hexadecimal code as a string\r\n * @returns a string containing the hexadecimal representation of the Color3 object\r\n */\r\n Color3.prototype.toHexString = function () {\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n return \"#\" + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intR) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intG) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intB);\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to linear space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @returns a new color3 representing the HSV values\r\n */\r\n Color3.prototype.toHSV = function () {\r\n var result = new Color3();\r\n this.toHSVToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @param result defines the Color3 where to store the HSV values\r\n */\r\n Color3.prototype.toHSVToRef = function (result) {\r\n var r = this.r;\r\n var g = this.g;\r\n var b = this.b;\r\n var max = Math.max(r, g, b);\r\n var min = Math.min(r, g, b);\r\n var h = 0;\r\n var s = 0;\r\n var v = max;\r\n var dm = max - min;\r\n if (max !== 0) {\r\n s = dm / max;\r\n }\r\n if (max != min) {\r\n if (max == r) {\r\n h = (g - b) / dm;\r\n if (g < b) {\r\n h += 6;\r\n }\r\n }\r\n else if (max == g) {\r\n h = (b - r) / dm + 2;\r\n }\r\n else if (max == b) {\r\n h = (r - g) / dm + 4;\r\n }\r\n h *= 60;\r\n }\r\n result.r = h;\r\n result.g = s;\r\n result.b = v;\r\n };\r\n /**\r\n * Converts the Color3 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the linear space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to gamma space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color3 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the gamma space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n return this;\r\n };\r\n /**\r\n * Convert Hue, saturation and value to a Color3 (RGB)\r\n * @param hue defines the hue\r\n * @param saturation defines the saturation\r\n * @param value defines the value\r\n * @param result defines the Color3 where to store the RGB values\r\n */\r\n Color3.HSVtoRGBToRef = function (hue, saturation, value, result) {\r\n var chroma = value * saturation;\r\n var h = hue / 60;\r\n var x = chroma * (1 - Math.abs((h % 2) - 1));\r\n var r = 0;\r\n var g = 0;\r\n var b = 0;\r\n if (h >= 0 && h <= 1) {\r\n r = chroma;\r\n g = x;\r\n }\r\n else if (h >= 1 && h <= 2) {\r\n r = x;\r\n g = chroma;\r\n }\r\n else if (h >= 2 && h <= 3) {\r\n g = chroma;\r\n b = x;\r\n }\r\n else if (h >= 3 && h <= 4) {\r\n g = x;\r\n b = chroma;\r\n }\r\n else if (h >= 4 && h <= 5) {\r\n r = x;\r\n b = chroma;\r\n }\r\n else if (h >= 5 && h <= 6) {\r\n r = chroma;\r\n b = x;\r\n }\r\n var m = value - chroma;\r\n result.set((r + m), (g + m), (b + m));\r\n };\r\n /**\r\n * Creates a new Color3 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 7) {\r\n return new Color3(0, 0, 0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n return Color3.FromInts(r, g, b);\r\n };\r\n /**\r\n * Creates a new Color3 from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromInts = function (r, g, b) {\r\n return new Color3(r / 255.0, g / 255.0, b / 255.0);\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param start defines the start Color3 value\r\n * @param end defines the end Color3 value\r\n * @param amount defines the gradient value between start and end\r\n * @returns a new Color3 object\r\n */\r\n Color3.Lerp = function (start, end, amount) {\r\n var result = new Color3(0.0, 0.0, 0.0);\r\n Color3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color3 object where to store the result\r\n */\r\n Color3.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + ((right.r - left.r) * amount);\r\n result.g = left.g + ((right.g - left.g) * amount);\r\n result.b = left.b + ((right.b - left.b) * amount);\r\n };\r\n /**\r\n * Returns a Color3 value containing a red color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Red = function () { return new Color3(1, 0, 0); };\r\n /**\r\n * Returns a Color3 value containing a green color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Green = function () { return new Color3(0, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a blue color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Blue = function () { return new Color3(0, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a black color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Black = function () { return new Color3(0, 0, 0); };\r\n Object.defineProperty(Color3, \"BlackReadOnly\", {\r\n /**\r\n * Gets a Color3 value containing a black color that must not be updated\r\n */\r\n get: function () {\r\n return Color3._BlackReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a Color3 value containing a white color\r\n * @returns a new Color3 object\r\n */\r\n Color3.White = function () { return new Color3(1, 1, 1); };\r\n /**\r\n * Returns a Color3 value containing a purple color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Purple = function () { return new Color3(0.5, 0, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a magenta color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Magenta = function () { return new Color3(1, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a yellow color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Yellow = function () { return new Color3(1, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a gray color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Gray = function () { return new Color3(0.5, 0.5, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a teal color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Teal = function () { return new Color3(0, 1.0, 1.0); };\r\n /**\r\n * Returns a Color3 value containing a random color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Random = function () { return new Color3(Math.random(), Math.random(), Math.random()); };\r\n // Statics\r\n Color3._BlackReadOnly = Color3.Black();\r\n return Color3;\r\n}());\r\n\r\n/**\r\n * Class used to hold a RBGA color\r\n */\r\nvar Color4 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color4 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n * @param a defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n function Color4(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b, \r\n /**\r\n * Defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n a) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n if (a === void 0) { a = 1; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n }\r\n // Operators\r\n /**\r\n * Adds in place the given Color4 values to the current Color4 object\r\n * @param right defines the second operand\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.addInPlace = function (right) {\r\n this.r += right.r;\r\n this.g += right.g;\r\n this.b += right.b;\r\n this.a += right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new array populated with 4 numeric elements : red, green, blue, alpha values\r\n * @returns the new array\r\n */\r\n Color4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Stores from the starting index in the given array the Color4 successive values\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n array[index + 3] = this.a;\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color4 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgba values are equal to the given ones\r\n */\r\n Color4.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b && this.a === otherColor.a;\r\n };\r\n /**\r\n * Creates a new Color4 set with the added values of the current Color4 and of the given one\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.add = function (right) {\r\n return new Color4(this.r + right.r, this.g + right.g, this.b + right.b, this.a + right.a);\r\n };\r\n /**\r\n * Creates a new Color4 set with the subtracted values of the given one from the current Color4\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.subtract = function (right) {\r\n return new Color4(this.r - right.r, this.g - right.g, this.b - right.b, this.a - right.a);\r\n };\r\n /**\r\n * Subtracts the given ones from the current Color4 values and stores the results in \"result\"\r\n * @param right defines the second operand\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.subtractToRef = function (right, result) {\r\n result.r = this.r - right.r;\r\n result.g = this.g - right.g;\r\n result.b = this.b - right.b;\r\n result.a = this.a - right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color4 with the current Color4 values multiplied by scale\r\n * @param scale defines the scaling factor to apply\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.scale = function (scale) {\r\n return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);\r\n };\r\n /**\r\n * Multiplies the current Color4 values by scale and stores the result in \"result\"\r\n * @param scale defines the scaling factor to apply\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current unmodified Color4\r\n */\r\n Color4.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n result.a = this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color4 values by a factor and add the result to a given Color4\r\n * @param scale defines the scale factor\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the unmodified current Color4\r\n */\r\n Color4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n result.a += this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into.\r\n * @returns the cuurent Color4\r\n */\r\n Color4.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.r, min, max);\r\n result.g = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.g, min, max);\r\n result.b = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.b, min, max);\r\n result.a = _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(this.a, min, max);\r\n return this;\r\n };\r\n /**\r\n * Multipy an Color4 value by another and return a new Color4 object\r\n * @param color defines the Color4 value to multiply by\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.multiply = function (color) {\r\n return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);\r\n };\r\n /**\r\n * Multipy a Color4 value by another and push the result in a reference value\r\n * @param color defines the Color4 value to multiply by\r\n * @param result defines the Color4 to fill the result in\r\n * @returns the result Color4\r\n */\r\n Color4.prototype.multiplyToRef = function (color, result) {\r\n result.r = this.r * color.r;\r\n result.g = this.g * color.g;\r\n result.b = this.b * color.b;\r\n result.a = this.a * color.a;\r\n return result;\r\n };\r\n /**\r\n * Creates a string with the Color4 current values\r\n * @returns the string representation of the Color4 object\r\n */\r\n Color4.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \" A:\" + this.a + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color4\"\r\n * @returns \"Color4\"\r\n */\r\n Color4.prototype.getClassName = function () {\r\n return \"Color4\";\r\n };\r\n /**\r\n * Compute the Color4 hash code\r\n * @returns an unique number that can be used to hash Color4 objects\r\n */\r\n Color4.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n hash = (hash * 397) ^ ((this.a * 255) | 0);\r\n return hash;\r\n };\r\n /**\r\n * Creates a new Color4 copied from the current one\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.clone = function () {\r\n return new Color4(this.r, this.g, this.b, this.a);\r\n };\r\n /**\r\n * Copies the given Color4 values into the current one\r\n * @param source defines the source Color4 object\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n this.a = source.a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFromFloats = function (r, g, b, a) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.set = function (r, g, b, a) {\r\n return this.copyFromFloats(r, g, b, a);\r\n };\r\n /**\r\n * Compute the Color4 hexadecimal code as a string\r\n * @returns a string containing the hexadecimal representation of the Color4 object\r\n */\r\n Color4.prototype.toHexString = function () {\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n var intA = (this.a * 255) | 0;\r\n return \"#\" + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intR) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intG) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intB) + _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].ToHex(intA);\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to linear space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the linear space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToLinearSpace\"]);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to gamma space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the gamma space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.g = Math.pow(this.g, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.b = Math.pow(this.b, _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"ToGammaSpace\"]);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new Color4 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 9) {\r\n return new Color4(0.0, 0.0, 0.0, 0.0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n var a = parseInt(hex.substring(7, 9), 16);\r\n return Color4.FromInts(r, g, b, a);\r\n };\r\n /**\r\n * Creates a new Color4 object set with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @returns a new Color4 object\r\n */\r\n Color4.Lerp = function (left, right, amount) {\r\n var result = new Color4(0.0, 0.0, 0.0, 0.0);\r\n Color4.LerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given \"result\" with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color4 object where to store data\r\n */\r\n Color4.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + (right.r - left.r) * amount;\r\n result.g = left.g + (right.g - left.g) * amount;\r\n result.b = left.b + (right.b - left.b) * amount;\r\n result.a = left.a + (right.a - left.a) * amount;\r\n };\r\n /**\r\n * Creates a new Color4 from a Color3 and an alpha value\r\n * @param color3 defines the source Color3 to read from\r\n * @param alpha defines the alpha component (1.0 by default)\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromColor3 = function (color3, alpha) {\r\n if (alpha === void 0) { alpha = 1.0; }\r\n return new Color4(color3.r, color3.g, color3.b, alpha);\r\n };\r\n /**\r\n * Creates a new Color4 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @param a defines the alpha component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color4.FromInts = function (r, g, b, a) {\r\n return new Color4(r / 255.0, g / 255.0, b / 255.0, a / 255.0);\r\n };\r\n /**\r\n * Check the content of a given array and convert it to an array containing RGBA data\r\n * If the original array was already containing count * 4 values then it is returned directly\r\n * @param colors defines the array to check\r\n * @param count defines the number of RGBA data to expect\r\n * @returns an array containing count * 4 values (RGBA)\r\n */\r\n Color4.CheckColors4 = function (colors, count) {\r\n // Check if color3 was used\r\n if (colors.length === count * 3) {\r\n var colors4 = [];\r\n for (var index = 0; index < colors.length; index += 3) {\r\n var newIndex = (index / 3) * 4;\r\n colors4[newIndex] = colors[index];\r\n colors4[newIndex + 1] = colors[index + 1];\r\n colors4[newIndex + 2] = colors[index + 2];\r\n colors4[newIndex + 3] = 1.0;\r\n }\r\n return colors4;\r\n }\r\n return colors;\r\n };\r\n return Color4;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar TmpColors = /** @class */ (function () {\r\n function TmpColors() {\r\n }\r\n TmpColors.Color3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Color3.Black);\r\n TmpColors.Color4 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, function () { return new Color4(0, 0, 0, 0); });\r\n return TmpColors;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Color3\"] = Color3;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Color4\"] = Color4;\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.constants.ts\":\n/*!*********************************!*\\\n !*** ./Maths/math.constants.ts ***!\n \\*********************************/\n/*! exports provided: ToGammaSpace, ToLinearSpace, Epsilon */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return ToGammaSpace; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return ToLinearSpace; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return Epsilon; });\n/**\r\n * Constant used to convert a value to gamma space\r\n * @ignorenaming\r\n */\r\nvar ToGammaSpace = 1 / 2.2;\r\n/**\r\n * Constant used to convert a value to linear space\r\n * @ignorenaming\r\n */\r\nvar ToLinearSpace = 2.2;\r\n/**\r\n * Constant used to define the minimal number value in Babylon.js\r\n * @ignorenaming\r\n */\r\nvar Epsilon = 0.001;\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.frustum.ts\":\n/*!*******************************!*\\\n !*** ./Maths/math.frustum.ts ***!\n \\*******************************/\n/*! exports provided: Frustum */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return Frustum; });\n/* harmony import */ var _math_plane__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.plane */ \"./Maths/math.plane.ts\");\n\r\n/**\r\n * Reprasents a camera frustum\r\n */\r\nvar Frustum = /** @class */ (function () {\r\n function Frustum() {\r\n }\r\n /**\r\n * Gets the planes representing the frustum\r\n * @param transform matrix to be applied to the returned planes\r\n * @returns a new array of 6 Frustum planes computed by the given transformation matrix.\r\n */\r\n Frustum.GetPlanes = function (transform) {\r\n var frustumPlanes = [];\r\n for (var index = 0; index < 6; index++) {\r\n frustumPlanes.push(new _math_plane__WEBPACK_IMPORTED_MODULE_0__[\"Plane\"](0.0, 0.0, 0.0, 0.0));\r\n }\r\n Frustum.GetPlanesToRef(transform, frustumPlanes);\r\n return frustumPlanes;\r\n };\r\n /**\r\n * Gets the near frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetNearPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[2];\r\n frustumPlane.normal.y = m[7] + m[6];\r\n frustumPlane.normal.z = m[11] + m[10];\r\n frustumPlane.d = m[15] + m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the far frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetFarPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[2];\r\n frustumPlane.normal.y = m[7] - m[6];\r\n frustumPlane.normal.z = m[11] - m[10];\r\n frustumPlane.d = m[15] - m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the left frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetLeftPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[0];\r\n frustumPlane.normal.y = m[7] + m[4];\r\n frustumPlane.normal.z = m[11] + m[8];\r\n frustumPlane.d = m[15] + m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the right frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetRightPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[0];\r\n frustumPlane.normal.y = m[7] - m[4];\r\n frustumPlane.normal.z = m[11] - m[8];\r\n frustumPlane.d = m[15] - m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the top frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetTopPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[1];\r\n frustumPlane.normal.y = m[7] - m[5];\r\n frustumPlane.normal.z = m[11] - m[9];\r\n frustumPlane.d = m[15] - m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the bottom frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetBottomPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[1];\r\n frustumPlane.normal.y = m[7] + m[5];\r\n frustumPlane.normal.z = m[11] + m[9];\r\n frustumPlane.d = m[15] + m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Sets the given array \"frustumPlanes\" with the 6 Frustum planes computed by the given transformation matrix.\r\n * @param transform transformation matrix to be applied to the resulting frustum planes\r\n * @param frustumPlanes the resuling frustum planes\r\n */\r\n Frustum.GetPlanesToRef = function (transform, frustumPlanes) {\r\n // Near\r\n Frustum.GetNearPlaneToRef(transform, frustumPlanes[0]);\r\n // Far\r\n Frustum.GetFarPlaneToRef(transform, frustumPlanes[1]);\r\n // Left\r\n Frustum.GetLeftPlaneToRef(transform, frustumPlanes[2]);\r\n // Right\r\n Frustum.GetRightPlaneToRef(transform, frustumPlanes[3]);\r\n // Top\r\n Frustum.GetTopPlaneToRef(transform, frustumPlanes[4]);\r\n // Bottom\r\n Frustum.GetBottomPlaneToRef(transform, frustumPlanes[5]);\r\n };\r\n return Frustum;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.functions.ts\":\n/*!*********************************!*\\\n !*** ./Maths/math.functions.ts ***!\n \\*********************************/\n/*! exports provided: extractMinAndMaxIndexed, extractMinAndMax */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractMinAndMaxIndexed\", function() { return extractMinAndMaxIndexed; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractMinAndMax\", function() { return extractMinAndMax; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Extracts minimum and maximum values from a list of indexed positions\r\n * @param positions defines the positions to use\r\n * @param indices defines the indices to the positions\r\n * @param indexStart defines the start index\r\n * @param indexCount defines the end index\r\n * @param bias defines bias value to add to the result\r\n * @return minimum and maximum values\r\n */\r\nfunction extractMinAndMaxIndexed(positions, indices, indexStart, indexCount, bias) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var index = indexStart; index < indexStart + indexCount; index++) {\r\n var offset = indices[index] * 3;\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n/**\r\n * Extracts minimum and maximum values from a list of positions\r\n * @param positions defines the positions to use\r\n * @param start defines the start index in the positions array\r\n * @param count defines the number of positions to handle\r\n * @param bias defines bias value to add to the result\r\n * @param stride defines the stride size to use (distance between two positions in the positions array)\r\n * @return minimum and maximum values\r\n */\r\nfunction extractMinAndMax(positions, start, count, bias, stride) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n if (!stride) {\r\n stride = 3;\r\n }\r\n for (var index = start, offset = start * stride; index < start + count; index++, offset += stride) {\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.path.ts\":\n/*!****************************!*\\\n !*** ./Maths/math.path.ts ***!\n \\****************************/\n/*! exports provided: Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return Orientation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return BezierCurve; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return Angle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return Arc2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return Path2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return Path3D; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return Curve3; });\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n/**\r\n * Defines potential orientation for back face culling\r\n */\r\nvar Orientation;\r\n(function (Orientation) {\r\n /**\r\n * Clockwise\r\n */\r\n Orientation[Orientation[\"CW\"] = 0] = \"CW\";\r\n /** Counter clockwise */\r\n Orientation[Orientation[\"CCW\"] = 1] = \"CCW\";\r\n})(Orientation || (Orientation = {}));\r\n/** Class used to represent a Bezier curve */\r\nvar BezierCurve = /** @class */ (function () {\r\n function BezierCurve() {\r\n }\r\n /**\r\n * Returns the cubic Bezier interpolated value (float) at \"t\" (float) from the given x1, y1, x2, y2 floats\r\n * @param t defines the time\r\n * @param x1 defines the left coordinate on X axis\r\n * @param y1 defines the left coordinate on Y axis\r\n * @param x2 defines the right coordinate on X axis\r\n * @param y2 defines the right coordinate on Y axis\r\n * @returns the interpolated value\r\n */\r\n BezierCurve.Interpolate = function (t, x1, y1, x2, y2) {\r\n // Extract X (which is equal to time here)\r\n var f0 = 1 - 3 * x2 + 3 * x1;\r\n var f1 = 3 * x2 - 6 * x1;\r\n var f2 = 3 * x1;\r\n var refinedT = t;\r\n for (var i = 0; i < 5; i++) {\r\n var refinedT2 = refinedT * refinedT;\r\n var refinedT3 = refinedT2 * refinedT;\r\n var x = f0 * refinedT3 + f1 * refinedT2 + f2 * refinedT;\r\n var slope = 1.0 / (3.0 * f0 * refinedT2 + 2.0 * f1 * refinedT + f2);\r\n refinedT -= (x - t) * slope;\r\n refinedT = Math.min(1, Math.max(0, refinedT));\r\n }\r\n // Resolve cubic bezier for the given x\r\n return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 +\r\n 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 +\r\n Math.pow(refinedT, 3);\r\n };\r\n return BezierCurve;\r\n}());\r\n\r\n/**\r\n * Defines angle representation\r\n */\r\nvar Angle = /** @class */ (function () {\r\n /**\r\n * Creates an Angle object of \"radians\" radians (float).\r\n * @param radians the angle in radians\r\n */\r\n function Angle(radians) {\r\n this._radians = radians;\r\n if (this._radians < 0.0) {\r\n this._radians += (2.0 * Math.PI);\r\n }\r\n }\r\n /**\r\n * Get value in degrees\r\n * @returns the Angle value in degrees (float)\r\n */\r\n Angle.prototype.degrees = function () {\r\n return this._radians * 180.0 / Math.PI;\r\n };\r\n /**\r\n * Get value in radians\r\n * @returns the Angle value in radians (float)\r\n */\r\n Angle.prototype.radians = function () {\r\n return this._radians;\r\n };\r\n /**\r\n * Gets a new Angle object valued with the angle value in radians between the two given vectors\r\n * @param a defines first vector\r\n * @param b defines second vector\r\n * @returns a new Angle\r\n */\r\n Angle.BetweenTwoPoints = function (a, b) {\r\n var delta = b.subtract(a);\r\n var theta = Math.atan2(delta.y, delta.x);\r\n return new Angle(theta);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in radians\r\n * @param radians defines the angle value in radians\r\n * @returns a new Angle\r\n */\r\n Angle.FromRadians = function (radians) {\r\n return new Angle(radians);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in degrees\r\n * @param degrees defines the angle value in degrees\r\n * @returns a new Angle\r\n */\r\n Angle.FromDegrees = function (degrees) {\r\n return new Angle(degrees * Math.PI / 180.0);\r\n };\r\n return Angle;\r\n}());\r\n\r\n/**\r\n * This represents an arc in a 2d space.\r\n */\r\nvar Arc2 = /** @class */ (function () {\r\n /**\r\n * Creates an Arc object from the three given points : start, middle and end.\r\n * @param startPoint Defines the start point of the arc\r\n * @param midPoint Defines the midlle point of the arc\r\n * @param endPoint Defines the end point of the arc\r\n */\r\n function Arc2(\r\n /** Defines the start point of the arc */\r\n startPoint, \r\n /** Defines the mid point of the arc */\r\n midPoint, \r\n /** Defines the end point of the arc */\r\n endPoint) {\r\n this.startPoint = startPoint;\r\n this.midPoint = midPoint;\r\n this.endPoint = endPoint;\r\n var temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);\r\n var startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2.;\r\n var midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2.;\r\n var det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);\r\n this.centerPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"]((startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det, ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det);\r\n this.radius = this.centerPoint.subtract(this.startPoint).length();\r\n this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);\r\n var a1 = this.startAngle.degrees();\r\n var a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();\r\n var a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();\r\n // angles correction\r\n if (a2 - a1 > +180.0) {\r\n a2 -= 360.0;\r\n }\r\n if (a2 - a1 < -180.0) {\r\n a2 += 360.0;\r\n }\r\n if (a3 - a2 > +180.0) {\r\n a3 -= 360.0;\r\n }\r\n if (a3 - a2 < -180.0) {\r\n a3 += 360.0;\r\n }\r\n this.orientation = (a2 - a1) < 0 ? Orientation.CW : Orientation.CCW;\r\n this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);\r\n }\r\n return Arc2;\r\n}());\r\n\r\n/**\r\n * Represents a 2D path made up of multiple 2D points\r\n */\r\nvar Path2 = /** @class */ (function () {\r\n /**\r\n * Creates a Path2 object from the starting 2D coordinates x and y.\r\n * @param x the starting points x value\r\n * @param y the starting points y value\r\n */\r\n function Path2(x, y) {\r\n this._points = new Array();\r\n this._length = 0.0;\r\n /**\r\n * If the path start and end point are the same\r\n */\r\n this.closed = false;\r\n this._points.push(new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](x, y));\r\n }\r\n /**\r\n * Adds a new segment until the given coordinates (x, y) to the current Path2.\r\n * @param x the added points x value\r\n * @param y the added points y value\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addLineTo = function (x, y) {\r\n if (this.closed) {\r\n return this;\r\n }\r\n var newPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](x, y);\r\n var previousPoint = this._points[this._points.length - 1];\r\n this._points.push(newPoint);\r\n this._length += newPoint.subtract(previousPoint).length();\r\n return this;\r\n };\r\n /**\r\n * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.\r\n * @param midX middle point x value\r\n * @param midY middle point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {\r\n if (numberOfSegments === void 0) { numberOfSegments = 36; }\r\n if (this.closed) {\r\n return this;\r\n }\r\n var startPoint = this._points[this._points.length - 1];\r\n var midPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](midX, midY);\r\n var endPoint = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](endX, endY);\r\n var arc = new Arc2(startPoint, midPoint, endPoint);\r\n var increment = arc.angle.radians() / numberOfSegments;\r\n if (arc.orientation === Orientation.CW) {\r\n increment *= -1;\r\n }\r\n var currentAngle = arc.startAngle.radians() + increment;\r\n for (var i = 0; i < numberOfSegments; i++) {\r\n var x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;\r\n var y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;\r\n this.addLineTo(x, y);\r\n currentAngle += increment;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Closes the Path2.\r\n * @returns the Path2.\r\n */\r\n Path2.prototype.close = function () {\r\n this.closed = true;\r\n return this;\r\n };\r\n /**\r\n * Gets the sum of the distance between each sequential point in the path\r\n * @returns the Path2 total length (float).\r\n */\r\n Path2.prototype.length = function () {\r\n var result = this._length;\r\n if (!this.closed) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var firstPoint = this._points[0];\r\n result += (firstPoint.subtract(lastPoint).length());\r\n }\r\n return result;\r\n };\r\n /**\r\n * Gets the points which construct the path\r\n * @returns the Path2 internal array of points.\r\n */\r\n Path2.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * Retreives the point at the distance aways from the starting point\r\n * @param normalizedLengthPosition the length along the path to retreive the point from\r\n * @returns a new Vector2 located at a percentage of the Path2 total length on this path.\r\n */\r\n Path2.prototype.getPointAtLengthPosition = function (normalizedLengthPosition) {\r\n if (normalizedLengthPosition < 0 || normalizedLengthPosition > 1) {\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].Zero();\r\n }\r\n var lengthPosition = normalizedLengthPosition * this.length();\r\n var previousOffset = 0;\r\n for (var i = 0; i < this._points.length; i++) {\r\n var j = (i + 1) % this._points.length;\r\n var a = this._points[i];\r\n var b = this._points[j];\r\n var bToA = b.subtract(a);\r\n var nextOffset = (bToA.length() + previousOffset);\r\n if (lengthPosition >= previousOffset && lengthPosition <= nextOffset) {\r\n var dir = bToA.normalize();\r\n var localOffset = lengthPosition - previousOffset;\r\n return new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](a.x + (dir.x * localOffset), a.y + (dir.y * localOffset));\r\n }\r\n previousOffset = nextOffset;\r\n }\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].Zero();\r\n };\r\n /**\r\n * Creates a new path starting from an x and y position\r\n * @param x starting x value\r\n * @param y starting y value\r\n * @returns a new Path2 starting at the coordinates (x, y).\r\n */\r\n Path2.StartingAt = function (x, y) {\r\n return new Path2(x, y);\r\n };\r\n return Path2;\r\n}());\r\n\r\n/**\r\n * Represents a 3D path made up of multiple 3D points\r\n */\r\nvar Path3D = /** @class */ (function () {\r\n /**\r\n * new Path3D(path, normal, raw)\r\n * Creates a Path3D. A Path3D is a logical math object, so not a mesh.\r\n * please read the description in the tutorial : https://doc.babylonjs.com/how_to/how_to_use_path3d\r\n * @param path an array of Vector3, the curve axis of the Path3D\r\n * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.\r\n * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.\r\n */\r\n function Path3D(\r\n /**\r\n * an array of Vector3, the curve axis of the Path3D\r\n */\r\n path, firstNormal, raw) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n this.path = path;\r\n this._curve = new Array();\r\n this._distances = new Array();\r\n this._tangents = new Array();\r\n this._normals = new Array();\r\n this._binormals = new Array();\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p] = path[p].clone(); // hard copy\r\n }\r\n this._raw = raw || false;\r\n this._compute(firstNormal);\r\n }\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n Path3D.prototype.getCurve = function () {\r\n return this._curve;\r\n };\r\n /**\r\n * Returns an array populated with tangent vectors on each Path3D curve point.\r\n * @returns an array populated with tangent vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Returns an array populated with normal vectors on each Path3D curve point.\r\n * @returns an array populated with normal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Returns an array populated with binormal vectors on each Path3D curve point.\r\n * @returns an array populated with binormal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getBinormals = function () {\r\n return this._binormals;\r\n };\r\n /**\r\n * Returns an array populated with distances (float) of the i-th point from the first curve point.\r\n * @returns an array populated with distances (float) of the i-th point from the first curve point.\r\n */\r\n Path3D.prototype.getDistances = function () {\r\n return this._distances;\r\n };\r\n /**\r\n * Forces the Path3D tangent, normal, binormal and distance recomputation.\r\n * @param path path which all values are copied into the curves points\r\n * @param firstNormal which should be projected onto the curve\r\n * @returns the same object updated.\r\n */\r\n Path3D.prototype.update = function (path, firstNormal) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p].x = path[p].x;\r\n this._curve[p].y = path[p].y;\r\n this._curve[p].z = path[p].z;\r\n }\r\n this._compute(firstNormal);\r\n return this;\r\n };\r\n // private function compute() : computes tangents, normals and binormals\r\n Path3D.prototype._compute = function (firstNormal) {\r\n var l = this._curve.length;\r\n // first and last tangents\r\n this._tangents[0] = this._getFirstNonNullVector(0);\r\n if (!this._raw) {\r\n this._tangents[0].normalize();\r\n }\r\n this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);\r\n if (!this._raw) {\r\n this._tangents[l - 1].normalize();\r\n }\r\n // normals and binormals at first point : arbitrary vector with _normalVector()\r\n var tg0 = this._tangents[0];\r\n var pp0 = this._normalVector(tg0, firstNormal);\r\n this._normals[0] = pp0;\r\n if (!this._raw) {\r\n this._normals[0].normalize();\r\n }\r\n this._binormals[0] = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(tg0, this._normals[0]);\r\n if (!this._raw) {\r\n this._binormals[0].normalize();\r\n }\r\n this._distances[0] = 0.0;\r\n // normals and binormals : next points\r\n var prev; // previous vector (segment)\r\n var cur; // current vector (segment)\r\n var curTang; // current tangent\r\n // previous normal\r\n var prevBinor; // previous binormal\r\n for (var i = 1; i < l; i++) {\r\n // tangents\r\n prev = this._getLastNonNullVector(i);\r\n if (i < l - 1) {\r\n cur = this._getFirstNonNullVector(i);\r\n this._tangents[i] = prev.add(cur);\r\n this._tangents[i].normalize();\r\n }\r\n this._distances[i] = this._distances[i - 1] + prev.length();\r\n // normals and binormals\r\n // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html\r\n curTang = this._tangents[i];\r\n prevBinor = this._binormals[i - 1];\r\n this._normals[i] = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(prevBinor, curTang);\r\n if (!this._raw) {\r\n this._normals[i].normalize();\r\n }\r\n this._binormals[i] = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(curTang, this._normals[i]);\r\n if (!this._raw) {\r\n this._binormals[i].normalize();\r\n }\r\n }\r\n };\r\n // private function getFirstNonNullVector(index)\r\n // returns the first non null vector from index : curve[index + N].subtract(curve[index])\r\n Path3D.prototype._getFirstNonNullVector = function (index) {\r\n var i = 1;\r\n var nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n while (nNVector.length() === 0 && index + i + 1 < this._curve.length) {\r\n i++;\r\n nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n }\r\n return nNVector;\r\n };\r\n // private function getLastNonNullVector(index)\r\n // returns the last non null vector from index : curve[index].subtract(curve[index - N])\r\n Path3D.prototype._getLastNonNullVector = function (index) {\r\n var i = 1;\r\n var nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n while (nLVector.length() === 0 && index > i + 1) {\r\n i++;\r\n nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n }\r\n return nLVector;\r\n };\r\n // private function normalVector(v0, vt, va) :\r\n // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane\r\n // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0\r\n Path3D.prototype._normalVector = function (vt, va) {\r\n var normal0;\r\n var tgl = vt.length();\r\n if (tgl === 0.0) {\r\n tgl = 1.0;\r\n }\r\n if (va === undefined || va === null) {\r\n var point;\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"])) { // search for a point in the plane\r\n point = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.0, -1.0, 0.0);\r\n }\r\n else if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"])) {\r\n point = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](1.0, 0.0, 0.0);\r\n }\r\n else if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"])) {\r\n point = new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.0, 0.0, 1.0);\r\n }\r\n else {\r\n point = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n }\r\n normal0 = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(vt, point);\r\n }\r\n else {\r\n normal0 = _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Cross(vt, va);\r\n _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(normal0, vt, normal0);\r\n }\r\n normal0.normalize();\r\n return normal0;\r\n };\r\n return Path3D;\r\n}());\r\n\r\n/**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_curve3\r\n */\r\nvar Curve3 = /** @class */ (function () {\r\n /**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * Tuto : https://doc.babylonjs.com/how_to/how_to_use_curve3#curve3-object\r\n * @param points points which make up the curve\r\n */\r\n function Curve3(points) {\r\n this._length = 0.0;\r\n this._points = points;\r\n this._length = this._computeLength(points);\r\n }\r\n /**\r\n * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#quadratic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Quadratic Bezier\r\n * @param v1 (Vector3) the control point\r\n * @param v2 (Vector3) the end point of the Quadratic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateQuadraticBezier = function (v0, v1, v2, nbPoints) {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2) {\r\n var res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](equation(i / nbPoints, v0.x, v1.x, v2.x), equation(i / nbPoints, v0.y, v1.y, v2.y), equation(i / nbPoints, v0.z, v1.z, v2.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#cubic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Cubic Bezier\r\n * @param v1 (Vector3) the first control point\r\n * @param v2 (Vector3) the second control point\r\n * @param v3 (Vector3) the end point of the Cubic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCubicBezier = function (v0, v1, v2, v3, nbPoints) {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2, val3) {\r\n var res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new _math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x), equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y), equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#hermite-spline\r\n * @param p1 (Vector3) the origin point of the Hermite Spline\r\n * @param t1 (Vector3) the tangent vector at the origin point\r\n * @param p2 (Vector3) the end point of the Hermite Spline\r\n * @param t2 (Vector3) the tangent vector at the end point\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateHermiteSpline = function (p1, t1, p2, t2, nbPoints) {\r\n var hermite = new Array();\r\n var step = 1.0 / nbPoints;\r\n for (var i = 0; i <= nbPoints; i++) {\r\n hermite.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n return new Curve3(hermite);\r\n };\r\n /**\r\n * Returns a Curve3 object along a CatmullRom Spline curve :\r\n * @param points (array of Vector3) the points the spline must pass through. At least, four points required\r\n * @param nbPoints (integer) the wanted number of points between each curve control points\r\n * @param closed (boolean) optional with default false, when true forms a closed loop from the points\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCatmullRomSpline = function (points, nbPoints, closed) {\r\n var catmullRom = new Array();\r\n var step = 1.0 / nbPoints;\r\n var amount = 0.0;\r\n if (closed) {\r\n var pointsCount = points.length;\r\n for (var i = 0; i < pointsCount; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CatmullRom(points[i % pointsCount], points[(i + 1) % pointsCount], points[(i + 2) % pointsCount], points[(i + 3) % pointsCount], amount));\r\n amount += step;\r\n }\r\n }\r\n catmullRom.push(catmullRom[0]);\r\n }\r\n else {\r\n var totalPoints = new Array();\r\n totalPoints.push(points[0].clone());\r\n Array.prototype.push.apply(totalPoints, points);\r\n totalPoints.push(points[points.length - 1].clone());\r\n for (var i = 0; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n amount += step;\r\n }\r\n }\r\n i--;\r\n catmullRom.push(_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n return new Curve3(catmullRom);\r\n };\r\n /**\r\n * @returns the Curve3 stored array of successive Vector3\r\n */\r\n Curve3.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * @returns the computed length (float) of the curve.\r\n */\r\n Curve3.prototype.length = function () {\r\n return this._length;\r\n };\r\n /**\r\n * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);\r\n * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.\r\n * curveA and curveB keep unchanged.\r\n * @param curve the curve to continue from this curve\r\n * @returns the newly constructed curve\r\n */\r\n Curve3.prototype.continue = function (curve) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var continuedPoints = this._points.slice();\r\n var curvePoints = curve.getPoints();\r\n for (var i = 1; i < curvePoints.length; i++) {\r\n continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));\r\n }\r\n var continuedCurve = new Curve3(continuedPoints);\r\n return continuedCurve;\r\n };\r\n Curve3.prototype._computeLength = function (path) {\r\n var l = 0;\r\n for (var i = 1; i < path.length; i++) {\r\n l += (path[i].subtract(path[i - 1])).length();\r\n }\r\n return l;\r\n };\r\n return Curve3;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.plane.ts\":\n/*!*****************************!*\\\n !*** ./Maths/math.plane.ts ***!\n \\*****************************/\n/*! exports provided: Plane */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return Plane; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Represens a plane by the equation ax + by + cz + d = 0\r\n */\r\nvar Plane = /** @class */ (function () {\r\n /**\r\n * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0\r\n * @param a a component of the plane\r\n * @param b b component of the plane\r\n * @param c c component of the plane\r\n * @param d d component of the plane\r\n */\r\n function Plane(a, b, c, d) {\r\n this.normal = new _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](a, b, c);\r\n this.d = d;\r\n }\r\n /**\r\n * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].\r\n */\r\n Plane.prototype.asArray = function () {\r\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\r\n };\r\n // Methods\r\n /**\r\n * @returns a new plane copied from the current Plane.\r\n */\r\n Plane.prototype.clone = function () {\r\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\r\n };\r\n /**\r\n * @returns the string \"Plane\".\r\n */\r\n Plane.prototype.getClassName = function () {\r\n return \"Plane\";\r\n };\r\n /**\r\n * @returns the Plane hash code.\r\n */\r\n Plane.prototype.getHashCode = function () {\r\n var hash = this.normal.getHashCode();\r\n hash = (hash * 397) ^ (this.d | 0);\r\n return hash;\r\n };\r\n /**\r\n * Normalize the current Plane in place.\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.normalize = function () {\r\n var norm = (Math.sqrt((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y) + (this.normal.z * this.normal.z)));\r\n var magnitude = 0.0;\r\n if (norm !== 0) {\r\n magnitude = 1.0 / norm;\r\n }\r\n this.normal.x *= magnitude;\r\n this.normal.y *= magnitude;\r\n this.normal.z *= magnitude;\r\n this.d *= magnitude;\r\n return this;\r\n };\r\n /**\r\n * Applies a transformation the plane and returns the result\r\n * @param transformation the transformation matrix to be applied to the plane\r\n * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.\r\n */\r\n Plane.prototype.transform = function (transformation) {\r\n var transposedMatrix = Plane._TmpMatrix;\r\n _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].TransposeToRef(transformation, transposedMatrix);\r\n var m = transposedMatrix.m;\r\n var x = this.normal.x;\r\n var y = this.normal.y;\r\n var z = this.normal.z;\r\n var d = this.d;\r\n var normalX = x * m[0] + y * m[1] + z * m[2] + d * m[3];\r\n var normalY = x * m[4] + y * m[5] + z * m[6] + d * m[7];\r\n var normalZ = x * m[8] + y * m[9] + z * m[10] + d * m[11];\r\n var finalD = x * m[12] + y * m[13] + z * m[14] + d * m[15];\r\n return new Plane(normalX, normalY, normalZ, finalD);\r\n };\r\n /**\r\n * Calcualtte the dot product between the point and the plane normal\r\n * @param point point to calculate the dot product with\r\n * @returns the dot product (float) of the point coordinates and the plane normal.\r\n */\r\n Plane.prototype.dotCoordinate = function (point) {\r\n return ((((this.normal.x * point.x) + (this.normal.y * point.y)) + (this.normal.z * point.z)) + this.d);\r\n };\r\n /**\r\n * Updates the current Plane from the plane defined by the three given points.\r\n * @param point1 one of the points used to contruct the plane\r\n * @param point2 one of the points used to contruct the plane\r\n * @param point3 one of the points used to contruct the plane\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.copyFromPoints = function (point1, point2, point3) {\r\n var x1 = point2.x - point1.x;\r\n var y1 = point2.y - point1.y;\r\n var z1 = point2.z - point1.z;\r\n var x2 = point3.x - point1.x;\r\n var y2 = point3.y - point1.y;\r\n var z2 = point3.z - point1.z;\r\n var yz = (y1 * z2) - (z1 * y2);\r\n var xz = (z1 * x2) - (x1 * z2);\r\n var xy = (x1 * y2) - (y1 * x2);\r\n var pyth = (Math.sqrt((yz * yz) + (xz * xz) + (xy * xy)));\r\n var invPyth;\r\n if (pyth !== 0) {\r\n invPyth = 1.0 / pyth;\r\n }\r\n else {\r\n invPyth = 0.0;\r\n }\r\n this.normal.x = yz * invPyth;\r\n this.normal.y = xz * invPyth;\r\n this.normal.z = xy * invPyth;\r\n this.d = -((this.normal.x * point1.x) + (this.normal.y * point1.y) + (this.normal.z * point1.z));\r\n return this;\r\n };\r\n /**\r\n * Checks if the plane is facing a given direction\r\n * @param direction the direction to check if the plane is facing\r\n * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)\r\n * @returns True is the vector \"direction\" is the same side than the plane normal.\r\n */\r\n Plane.prototype.isFrontFacingTo = function (direction, epsilon) {\r\n var dot = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, direction);\r\n return (dot <= epsilon);\r\n };\r\n /**\r\n * Calculates the distance to a point\r\n * @param point point to calculate distance to\r\n * @returns the signed distance (float) from the given point to the Plane.\r\n */\r\n Plane.prototype.signedDistanceTo = function (point) {\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(point, this.normal) + this.d;\r\n };\r\n // Statics\r\n /**\r\n * Creates a plane from an array\r\n * @param array the array to create a plane from\r\n * @returns a new Plane from the given array.\r\n */\r\n Plane.FromArray = function (array) {\r\n return new Plane(array[0], array[1], array[2], array[3]);\r\n };\r\n /**\r\n * Creates a plane from three points\r\n * @param point1 point used to create the plane\r\n * @param point2 point used to create the plane\r\n * @param point3 point used to create the plane\r\n * @returns a new Plane defined by the three given points.\r\n */\r\n Plane.FromPoints = function (point1, point2, point3) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n result.copyFromPoints(point1, point2, point3);\r\n return result;\r\n };\r\n /**\r\n * Creates a plane from an origin point and a normal\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @returns a new Plane the normal vector to this plane at the given origin point.\r\n * Note : the vector \"normal\" is updated because normalized.\r\n */\r\n Plane.FromPositionAndNormal = function (origin, normal) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n normal.normalize();\r\n result.normal = normal;\r\n result.d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return result;\r\n };\r\n /**\r\n * Calculates the distance from a plane and a point\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @param point point to calculate distance to\r\n * @returns the signed distance between the plane defined by the normal vector at the \"origin\"\" point and the given other point.\r\n */\r\n Plane.SignedDistanceToPlaneFromPositionAndNormal = function (origin, normal, point) {\r\n var d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(point, normal) + d;\r\n };\r\n Plane._TmpMatrix = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity();\r\n return Plane;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.scalar.ts\":\n/*!******************************!*\\\n !*** ./Maths/math.scalar.ts ***!\n \\******************************/\n/*! exports provided: Scalar */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return Scalar; });\n/**\r\n * Scalar computation library\r\n */\r\nvar Scalar = /** @class */ (function () {\r\n function Scalar() {\r\n }\r\n /**\r\n * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n * @param a number\r\n * @param b number\r\n * @param epsilon (default = 1.401298E-45)\r\n * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n */\r\n Scalar.WithinEpsilon = function (a, b, epsilon) {\r\n if (epsilon === void 0) { epsilon = 1.401298E-45; }\r\n var num = a - b;\r\n return -epsilon <= num && num <= epsilon;\r\n };\r\n /**\r\n * Returns a string : the upper case translation of the number i to hexadecimal.\r\n * @param i number\r\n * @returns the upper case translation of the number i to hexadecimal.\r\n */\r\n Scalar.ToHex = function (i) {\r\n var str = i.toString(16);\r\n if (i <= 15) {\r\n return (\"0\" + str).toUpperCase();\r\n }\r\n return str.toUpperCase();\r\n };\r\n /**\r\n * Returns -1 if value is negative and +1 is value is positive.\r\n * @param value the value\r\n * @returns the value itself if it's equal to zero.\r\n */\r\n Scalar.Sign = function (value) {\r\n value = +value; // convert to a number\r\n if (value === 0 || isNaN(value)) {\r\n return value;\r\n }\r\n return value > 0 ? 1 : -1;\r\n };\r\n /**\r\n * Returns the value itself if it's between min and max.\r\n * Returns min if the value is lower than min.\r\n * Returns max if the value is greater than max.\r\n * @param value the value to clmap\r\n * @param min the min value to clamp to (default: 0)\r\n * @param max the max value to clamp to (default: 1)\r\n * @returns the clamped value\r\n */\r\n Scalar.Clamp = function (value, min, max) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n return Math.min(max, Math.max(min, value));\r\n };\r\n /**\r\n * the log2 of value.\r\n * @param value the value to compute log2 of\r\n * @returns the log2 of value.\r\n */\r\n Scalar.Log2 = function (value) {\r\n return Math.log(value) * Math.LOG2E;\r\n };\r\n /**\r\n * Loops the value, so that it is never larger than length and never smaller than 0.\r\n *\r\n * This is similar to the modulo operator but it works with floating point numbers.\r\n * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.\r\n * With t = 5 and length = 2.5, the result would be 0.0.\r\n * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator\r\n * @param value the value\r\n * @param length the length\r\n * @returns the looped value\r\n */\r\n Scalar.Repeat = function (value, length) {\r\n return value - Math.floor(value / length) * length;\r\n };\r\n /**\r\n * Normalize the value between 0.0 and 1.0 using min and max values\r\n * @param value value to normalize\r\n * @param min max to normalize between\r\n * @param max min to normalize between\r\n * @returns the normalized value\r\n */\r\n Scalar.Normalize = function (value, min, max) {\r\n return (value - min) / (max - min);\r\n };\r\n /**\r\n * Denormalize the value from 0.0 and 1.0 using min and max values\r\n * @param normalized value to denormalize\r\n * @param min max to denormalize between\r\n * @param max min to denormalize between\r\n * @returns the denormalized value\r\n */\r\n Scalar.Denormalize = function (normalized, min, max) {\r\n return (normalized * (max - min) + min);\r\n };\r\n /**\r\n * Calculates the shortest difference between two given angles given in degrees.\r\n * @param current current angle in degrees\r\n * @param target target angle in degrees\r\n * @returns the delta\r\n */\r\n Scalar.DeltaAngle = function (current, target) {\r\n var num = Scalar.Repeat(target - current, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return num;\r\n };\r\n /**\r\n * PingPongs the value t, so that it is never larger than length and never smaller than 0.\r\n * @param tx value\r\n * @param length length\r\n * @returns The returned value will move back and forth between 0 and length\r\n */\r\n Scalar.PingPong = function (tx, length) {\r\n var t = Scalar.Repeat(tx, length * 2.0);\r\n return length - Math.abs(t - length);\r\n };\r\n /**\r\n * Interpolates between min and max with smoothing at the limits.\r\n *\r\n * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up\r\n * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.\r\n * @param from from\r\n * @param to to\r\n * @param tx value\r\n * @returns the smooth stepped value\r\n */\r\n Scalar.SmoothStep = function (from, to, tx) {\r\n var t = Scalar.Clamp(tx);\r\n t = -2.0 * t * t * t + 3.0 * t * t;\r\n return to * t + from * (1.0 - t);\r\n };\r\n /**\r\n * Moves a value current towards target.\r\n *\r\n * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.\r\n * Negative values of maxDelta pushes the value away from target.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting value\r\n */\r\n Scalar.MoveTowards = function (current, target, maxDelta) {\r\n var result = 0;\r\n if (Math.abs(target - current) <= maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n result = current + Scalar.Sign(target - current) * maxDelta;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n *\r\n * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta\r\n * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting angle\r\n */\r\n Scalar.MoveTowardsAngle = function (current, target, maxDelta) {\r\n var num = Scalar.DeltaAngle(current, target);\r\n var result = 0;\r\n if (-maxDelta < num && num < maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n target = current + num;\r\n result = Scalar.MoveTowards(current, target, maxDelta);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a new scalar with values linearly interpolated of \"amount\" between the start scalar and the end scalar.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.Lerp = function (start, end, amount) {\r\n return start + ((end - start) * amount);\r\n };\r\n /**\r\n * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.LerpAngle = function (start, end, amount) {\r\n var num = Scalar.Repeat(end - start, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return start + num * Scalar.Clamp(amount);\r\n };\r\n /**\r\n * Calculates the linear parameter t that produces the interpolant value within the range [a, b].\r\n * @param a start value\r\n * @param b target value\r\n * @param value value between a and b\r\n * @returns the inverseLerp value\r\n */\r\n Scalar.InverseLerp = function (a, b, value) {\r\n var result = 0;\r\n if (a != b) {\r\n result = Scalar.Clamp((value - a) / (b - a));\r\n }\r\n else {\r\n result = 0.0;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Returns a new scalar located for \"amount\" (float) on the Hermite spline defined by the scalars \"value1\", \"value3\", \"tangent1\", \"tangent2\".\r\n * @see http://mathworld.wolfram.com/HermitePolynomial.html\r\n * @param value1 spline value\r\n * @param tangent1 spline value\r\n * @param value2 spline value\r\n * @param tangent2 spline value\r\n * @param amount input value\r\n * @returns hermite result\r\n */\r\n Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);\r\n };\r\n /**\r\n * Returns a random float number between and min and max values\r\n * @param min min value of random\r\n * @param max max value of random\r\n * @returns random value\r\n */\r\n Scalar.RandomRange = function (min, max) {\r\n if (min === max) {\r\n return min;\r\n }\r\n return ((Math.random() * (max - min)) + min);\r\n };\r\n /**\r\n * This function returns percentage of a number in a given range.\r\n *\r\n * RangeToPercent(40,20,60) will return 0.5 (50%)\r\n * RangeToPercent(34,0,100) will return 0.34 (34%)\r\n * @param number to convert to percentage\r\n * @param min min range\r\n * @param max max range\r\n * @returns the percentage\r\n */\r\n Scalar.RangeToPercent = function (number, min, max) {\r\n return ((number - min) / (max - min));\r\n };\r\n /**\r\n * This function returns number that corresponds to the percentage in a given range.\r\n *\r\n * PercentToRange(0.34,0,100) will return 34.\r\n * @param percent to convert to number\r\n * @param min min range\r\n * @param max max range\r\n * @returns the number\r\n */\r\n Scalar.PercentToRange = function (percent, min, max) {\r\n return ((max - min) * percent + min);\r\n };\r\n /**\r\n * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.\r\n * @param angle The angle to normalize in radian.\r\n * @return The converted angle.\r\n */\r\n Scalar.NormalizeRadians = function (angle) {\r\n // More precise but slower version kept for reference.\r\n // angle = angle % Tools.TwoPi;\r\n // angle = (angle + Tools.TwoPi) % Tools.TwoPi;\r\n //if (angle > Math.PI) {\r\n //\tangle -= Tools.TwoPi;\r\n //}\r\n angle -= (Scalar.TwoPi * Math.floor((angle + Math.PI) / Scalar.TwoPi));\r\n return angle;\r\n };\r\n /**\r\n * Two pi constants convenient for computation.\r\n */\r\n Scalar.TwoPi = Math.PI * 2;\r\n return Scalar;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.size.ts\":\n/*!****************************!*\\\n !*** ./Maths/math.size.ts ***!\n \\****************************/\n/*! exports provided: Size */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return Size; });\n/**\r\n * Size containing widht and height\r\n */\r\nvar Size = /** @class */ (function () {\r\n /**\r\n * Creates a Size object from the given width and height (floats).\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n */\r\n function Size(width, height) {\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Returns a string with the Size width and height\r\n * @returns a string with the Size width and height\r\n */\r\n Size.prototype.toString = function () {\r\n return \"{W: \" + this.width + \", H: \" + this.height + \"}\";\r\n };\r\n /**\r\n * \"Size\"\r\n * @returns the string \"Size\"\r\n */\r\n Size.prototype.getClassName = function () {\r\n return \"Size\";\r\n };\r\n /**\r\n * Returns the Size hash code.\r\n * @returns a hash code for a unique width and height\r\n */\r\n Size.prototype.getHashCode = function () {\r\n var hash = this.width | 0;\r\n hash = (hash * 397) ^ (this.height | 0);\r\n return hash;\r\n };\r\n /**\r\n * Updates the current size from the given one.\r\n * @param src the given size\r\n */\r\n Size.prototype.copyFrom = function (src) {\r\n this.width = src.width;\r\n this.height = src.height;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.copyFromFloats = function (width, height) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width to set\r\n * @param height height to set\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.set = function (width, height) {\r\n return this.copyFromFloats(width, height);\r\n };\r\n /**\r\n * Multiplies the width and height by numbers\r\n * @param w factor to multiple the width by\r\n * @param h factor to multiple the height by\r\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\r\n */\r\n Size.prototype.multiplyByFloats = function (w, h) {\r\n return new Size(this.width * w, this.height * h);\r\n };\r\n /**\r\n * Clones the size\r\n * @returns a new Size copied from the given one.\r\n */\r\n Size.prototype.clone = function () {\r\n return new Size(this.width, this.height);\r\n };\r\n /**\r\n * True if the current Size and the given one width and height are strictly equal.\r\n * @param other the other size to compare against\r\n * @returns True if the current Size and the given one width and height are strictly equal.\r\n */\r\n Size.prototype.equals = function (other) {\r\n if (!other) {\r\n return false;\r\n }\r\n return (this.width === other.width) && (this.height === other.height);\r\n };\r\n Object.defineProperty(Size.prototype, \"surface\", {\r\n /**\r\n * The surface of the Size : width * height (float).\r\n */\r\n get: function () {\r\n return this.width * this.height;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new size of zero\r\n * @returns a new Size set to (0.0, 0.0)\r\n */\r\n Size.Zero = function () {\r\n return new Size(0.0, 0.0);\r\n };\r\n /**\r\n * Sums the width and height of two sizes\r\n * @param otherSize size to add to this size\r\n * @returns a new Size set as the addition result of the current Size and the given one.\r\n */\r\n Size.prototype.add = function (otherSize) {\r\n var r = new Size(this.width + otherSize.width, this.height + otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Subtracts the width and height of two\r\n * @param otherSize size to subtract to this size\r\n * @returns a new Size set as the subtraction result of the given one from the current Size.\r\n */\r\n Size.prototype.subtract = function (otherSize) {\r\n var r = new Size(this.width - otherSize.width, this.height - otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Creates a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n * @param start starting size to lerp between\r\n * @param end end size to lerp between\r\n * @param amount amount to lerp between the start and end values\r\n * @returns a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n */\r\n Size.Lerp = function (start, end, amount) {\r\n var w = start.width + ((end.width - start.width) * amount);\r\n var h = start.height + ((end.height - start.height) * amount);\r\n return new Size(w, h);\r\n };\r\n return Size;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.ts\":\n/*!***********************!*\\\n !*** ./Maths/math.ts ***!\n \\***********************/\n/*! exports provided: Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _math_axis__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.axis */ \"./Maths/math.axis.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _math_axis__WEBPACK_IMPORTED_MODULE_0__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _math_axis__WEBPACK_IMPORTED_MODULE_0__[\"Axis\"]; });\n\n/* harmony import */ var _math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.color */ \"./Maths/math.color.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _math_color__WEBPACK_IMPORTED_MODULE_1__[\"TmpColors\"]; });\n\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _math_constants__WEBPACK_IMPORTED_MODULE_2__[\"Epsilon\"]; });\n\n/* harmony import */ var _math_frustum__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./math.frustum */ \"./Maths/math.frustum.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _math_frustum__WEBPACK_IMPORTED_MODULE_3__[\"Frustum\"]; });\n\n/* harmony import */ var _math_path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./math.path */ \"./Maths/math.path.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _math_path__WEBPACK_IMPORTED_MODULE_4__[\"Curve3\"]; });\n\n/* harmony import */ var _math_plane__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./math.plane */ \"./Maths/math.plane.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _math_plane__WEBPACK_IMPORTED_MODULE_5__[\"Plane\"]; });\n\n/* harmony import */ var _math_size__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./math.size */ \"./Maths/math.size.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _math_size__WEBPACK_IMPORTED_MODULE_6__[\"Size\"]; });\n\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _math_vector__WEBPACK_IMPORTED_MODULE_7__[\"TmpVectors\"]; });\n\n/* harmony import */ var _math_vertexFormat__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./math.vertexFormat */ \"./Maths/math.vertexFormat.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _math_vertexFormat__WEBPACK_IMPORTED_MODULE_8__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _math_vertexFormat__WEBPACK_IMPORTED_MODULE_8__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony import */ var _math_viewport__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./math.viewport */ \"./Maths/math.viewport.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _math_viewport__WEBPACK_IMPORTED_MODULE_9__[\"Viewport\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.vector.ts\":\n/*!******************************!*\\\n !*** ./Maths/math.vector.ts ***!\n \\******************************/\n/*! exports provided: Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return Vector2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return Vector3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return Vector4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return Quaternion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return Matrix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return TmpVectors; });\n/* harmony import */ var _math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _math_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class representing a vector containing 2 coordinates\r\n */\r\nvar Vector2 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector2 from the given x and y coordinates\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n */\r\n function Vector2(\r\n /** defines the first coordinate */\r\n x, \r\n /** defines the second coordinate */\r\n y) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /**\r\n * Gets a string with the Vector2 coordinates\r\n * @returns a string with the Vector2 coordinates\r\n */\r\n Vector2.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \"}\";\r\n };\r\n /**\r\n * Gets class name\r\n * @returns the string \"Vector2\"\r\n */\r\n Vector2.prototype.getClassName = function () {\r\n return \"Vector2\";\r\n };\r\n /**\r\n * Gets current vector hash code\r\n * @returns the Vector2 hash code as a number\r\n */\r\n Vector2.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Sets the Vector2 coordinates in the given array or Float32Array from the given index.\r\n * @param array defines the source array\r\n * @param index defines the offset in source array\r\n * @returns the current Vector2\r\n */\r\n Vector2.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n return this;\r\n };\r\n /**\r\n * Copy the current vector to an array\r\n * @returns a new array with 2 elements: the Vector2 coordinates.\r\n */\r\n Vector2.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given Vector2 coordinates\r\n * @param source defines the source Vector2\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFromFloats = function (x, y) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.set = function (x, y) {\r\n return this.copyFromFloats(x, y);\r\n };\r\n /**\r\n * Add another vector with the current one\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2 set with the addition of the current Vector2 and the given one coordinates\r\n */\r\n Vector2.prototype.add = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the addition of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Set the Vector2 coordinates by adding the given Vector2 coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.addVector3 = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.subtract = function (otherVector) {\r\n return new Vector2(this.x - otherVector.x, this.y - otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the subtraction of the given one from the current Vector2 coordinates.\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the current Vector2 coordinates by subtracting from it the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiply = function (otherVector) {\r\n return new Vector2(this.x * otherVector.x, this.y * otherVector.y);\r\n };\r\n /**\r\n * Sets \"result\" coordinates with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiplyByFloats = function (x, y) {\r\n return new Vector2(this.x * x, this.y * y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.divide = function (otherVector) {\r\n return new Vector2(this.x / otherVector.x, this.y / otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the Vector2 divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Gets a new Vector2 with current Vector2 negated coordinates\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.negate = function () {\r\n return new Vector2(-this.x, -this.y);\r\n };\r\n /**\r\n * Multiply the Vector2 coordinates by scale\r\n * @param scale defines the scaling factor\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 scaled by \"scale\" from the current Vector2\r\n * @param scale defines the scaling factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.scale = function (scale) {\r\n var result = new Vector2(0, 0);\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor and add the result to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals\r\n * @param otherVector defines the other vector\r\n * @returns true if the given vector coordinates strictly equal the current Vector2 ones\r\n */\r\n Vector2.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals (using an epsilon value)\r\n * @param otherVector defines the other vector\r\n * @param epsilon defines the minimal distance to consider equality\r\n * @returns true if the given vector coordinates are close to the current ones by a distance of epsilon.\r\n */\r\n Vector2.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; }\r\n return otherVector && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.x, otherVector.x, epsilon) && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.y, otherVector.y, epsilon);\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.floor = function () {\r\n return new Vector2(Math.floor(this.x), Math.floor(this.y));\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.fract = function () {\r\n return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the vector\r\n * @returns the vector length (float)\r\n */\r\n Vector2.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n };\r\n /**\r\n * Gets the vector squared length\r\n * @returns the vector squared length (float)\r\n */\r\n Vector2.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y);\r\n };\r\n // Methods\r\n /**\r\n * Normalize the vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n var num = 1.0 / len;\r\n this.x *= num;\r\n this.y *= num;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 copied from the Vector2\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.clone = function () {\r\n return new Vector2(this.x, this.y);\r\n };\r\n // Statics\r\n /**\r\n * Gets a new Vector2(0, 0)\r\n * @returns a new Vector2\r\n */\r\n Vector2.Zero = function () {\r\n return new Vector2(0, 0);\r\n };\r\n /**\r\n * Gets a new Vector2(1, 1)\r\n * @returns a new Vector2\r\n */\r\n Vector2.One = function () {\r\n return new Vector2(1, 1);\r\n };\r\n /**\r\n * Gets a new Vector2 set from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @returns a new Vector2\r\n */\r\n Vector2.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector2(array[offset], array[offset + 1]);\r\n };\r\n /**\r\n * Sets \"result\" from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @param result defines the target vector\r\n */\r\n Vector2.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n };\r\n /**\r\n * Gets a new Vector2 located for \"amount\" (float) on the CatmullRom spline defined by the given four Vector2\r\n * @param value1 defines 1st point of control\r\n * @param value2 defines 2nd point of control\r\n * @param value3 defines 3rd point of control\r\n * @param value4 defines 4th point of control\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +\r\n (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +\r\n ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +\r\n (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +\r\n ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with same the coordinates than \"value\" ones if the vector \"value\" is in the square defined by \"min\" and \"max\".\r\n * If a coordinate of \"value\" is lower than \"min\" coordinates, the returned Vector2 is given this \"min\" coordinate.\r\n * If a coordinate of \"value\" is greater than \"max\" coordinates, the returned Vector2 is given this \"max\" coordinate\r\n * @param value defines the value to clamp\r\n * @param min defines the lower limit\r\n * @param max defines the upper limit\r\n * @returns a new Vector2\r\n */\r\n Vector2.Clamp = function (value, min, max) {\r\n var x = value.x;\r\n x = (x > max.x) ? max.x : x;\r\n x = (x < min.x) ? min.x : x;\r\n var y = value.y;\r\n y = (y > max.y) ? max.y : y;\r\n y = (y < min.y) ? min.y : y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the Hermite spline defined by the vectors \"value1\", \"value3\", \"tangent1\", \"tangent2\"\r\n * @param value1 defines the 1st control point\r\n * @param tangent1 defines the outgoing tangent\r\n * @param value2 defines the 2nd control point\r\n * @param tangent2 defines the incoming tangent\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the linear interpolation between the vector \"start\" adn the vector \"end\".\r\n * @param start defines the start vector\r\n * @param end defines the end vector\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Lerp = function (start, end, amount) {\r\n var x = start.x + ((end.x - start.x) * amount);\r\n var y = start.y + ((end.y - start.y) * amount);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets the dot product of the vector \"left\" and the vector \"right\"\r\n * @param left defines first vector\r\n * @param right defines second vector\r\n * @returns the dot product (float)\r\n */\r\n Vector2.Dot = function (left, right) {\r\n return left.x * right.x + left.y * right.y;\r\n };\r\n /**\r\n * Returns a new Vector2 equal to the normalized given vector\r\n * @param vector defines the vector to normalize\r\n * @returns a new Vector2\r\n */\r\n Vector2.Normalize = function (vector) {\r\n var newVector = vector.clone();\r\n newVector.normalize();\r\n return newVector;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the minimal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Minimize = function (left, right) {\r\n var x = (left.x < right.x) ? left.x : right.x;\r\n var y = (left.y < right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vecto2 set with the maximal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Maximize = function (left, right) {\r\n var x = (left.x > right.x) ? left.x : right.x;\r\n var y = (left.y > right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @returns a new Vector2\r\n */\r\n Vector2.Transform = function (vector, transformation) {\r\n var r = Vector2.Zero();\r\n Vector2.TransformToRef(vector, transformation, r);\r\n return r;\r\n };\r\n /**\r\n * Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector \"result\" coordinates\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @param result defines the target vector\r\n */\r\n Vector2.TransformToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + m[12];\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + m[13];\r\n result.x = x;\r\n result.y = y;\r\n };\r\n /**\r\n * Determines if a given vector is included in a triangle\r\n * @param p defines the vector to test\r\n * @param p0 defines 1st triangle point\r\n * @param p1 defines 2nd triangle point\r\n * @param p2 defines 3rd triangle point\r\n * @returns true if the point \"p\" is in the triangle defined by the vertors \"p0\", \"p1\", \"p2\"\r\n */\r\n Vector2.PointInTriangle = function (p, p0, p1, p2) {\r\n var a = 1 / 2 * (-p1.y * p2.x + p0.y * (-p1.x + p2.x) + p0.x * (p1.y - p2.y) + p1.x * p2.y);\r\n var sign = a < 0 ? -1 : 1;\r\n var s = (p0.y * p2.x - p0.x * p2.y + (p2.y - p0.y) * p.x + (p0.x - p2.x) * p.y) * sign;\r\n var t = (p0.x * p1.y - p0.y * p1.x + (p0.y - p1.y) * p.x + (p1.x - p0.x) * p.y) * sign;\r\n return s > 0 && t > 0 && (s + t) < 2 * a * sign;\r\n };\r\n /**\r\n * Gets the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the distance between vectors\r\n */\r\n Vector2.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector2.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the squared distance between vectors\r\n */\r\n Vector2.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n return (x * x) + (y * y);\r\n };\r\n /**\r\n * Gets a new Vector2 located at the center of the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Gets the shortest distance (float) between the point \"p\" and the segment defined by the two points \"segA\" and \"segB\".\r\n * @param p defines the middle point\r\n * @param segA defines one point of the segment\r\n * @param segB defines the other point of the segment\r\n * @returns the shortest distance\r\n */\r\n Vector2.DistanceOfPointFromSegment = function (p, segA, segB) {\r\n var l2 = Vector2.DistanceSquared(segA, segB);\r\n if (l2 === 0.0) {\r\n return Vector2.Distance(p, segA);\r\n }\r\n var v = segB.subtract(segA);\r\n var t = Math.max(0, Math.min(1, Vector2.Dot(p.subtract(segA), v) / l2));\r\n var proj = segA.add(v.multiplyByFloats(t, t));\r\n return Vector2.Distance(p, proj);\r\n };\r\n return Vector2;\r\n}());\r\n\r\n/**\r\n * Classed used to store (x,y,z) vector representation\r\n * A Vector3 is the main object used in 3D geometry\r\n * It can represent etiher the coordinates of a point the space, either a direction\r\n * Reminder: js uses a left handed forward facing system\r\n */\r\nvar Vector3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector3 object from the given x, y, z (floats) coordinates.\r\n * @param x defines the first coordinates (on X axis)\r\n * @param y defines the second coordinates (on Y axis)\r\n * @param z defines the third coordinates (on Z axis)\r\n */\r\n function Vector3(\r\n /**\r\n * Defines the first coordinates (on X axis)\r\n */\r\n x, \r\n /**\r\n * Defines the second coordinates (on Y axis)\r\n */\r\n y, \r\n /**\r\n * Defines the third coordinates (on Z axis)\r\n */\r\n z) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n if (z === void 0) { z = 0; }\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n }\r\n /**\r\n * Creates a string representation of the Vector3\r\n * @returns a string with the Vector3 coordinates.\r\n */\r\n Vector3.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \"}\";\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Vector3\"\r\n */\r\n Vector3.prototype.getClassName = function () {\r\n return \"Vector3\";\r\n };\r\n /**\r\n * Creates the Vector3 hash code\r\n * @returns a number which tends to be unique between Vector3 instances\r\n */\r\n Vector3.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Creates an array containing three elements : the coordinates of the Vector3\r\n * @returns a new array of numbers\r\n */\r\n Vector3.prototype.asArray = function () {\r\n var result = [];\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n array[index + 2] = this.z;\r\n return this;\r\n };\r\n /**\r\n * Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation)\r\n * @returns a new Quaternion object, computed from the Vector3 coordinates\r\n */\r\n Vector3.prototype.toQuaternion = function () {\r\n return Quaternion.RotationYawPitchRoll(this.y, this.x, this.z);\r\n };\r\n /**\r\n * Adds the given vector to the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlace = function (otherVector) {\r\n return this.addInPlaceFromFloats(otherVector.x, otherVector.y, otherVector.z);\r\n };\r\n /**\r\n * Adds the given coordinates to the current Vector3\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlaceFromFloats = function (x, y, z) {\r\n this.x += x;\r\n this.y += y;\r\n this.z += z;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector3, result of the addition the current Vector3 and the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.add = function (otherVector) {\r\n return new Vector3(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z);\r\n };\r\n /**\r\n * Adds the current Vector3 to the given one and stores the result in the vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.addToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z);\r\n };\r\n /**\r\n * Subtract the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n this.z -= otherVector.z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the subtraction of the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtract = function (otherVector) {\r\n return new Vector3(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z);\r\n };\r\n /**\r\n * Subtracts the given vector from the current Vector3 and stores the result in the vector \"result\".\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractToRef = function (otherVector, result) {\r\n return this.subtractFromFloatsToRef(otherVector.x, otherVector.y, otherVector.z, result);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtractFromFloats = function (x, y, z) {\r\n return new Vector3(this.x - x, this.y - y, this.z - z);\r\n };\r\n /**\r\n * Subtracts the given floats from the current Vector3 coordinates and set the given vector \"result\" with this result\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractFromFloatsToRef = function (x, y, z, result) {\r\n return result.copyFromFloats(this.x - x, this.y - y, this.z - z);\r\n };\r\n /**\r\n * Gets a new Vector3 set with the current Vector3 negated coordinates\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.negate = function () {\r\n return new Vector3(-this.x, -this.y, -this.z);\r\n };\r\n /**\r\n * Multiplies the Vector3 coordinates by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.scale = function (scale) {\r\n return new Vector3(this.x * scale, this.y * scale, this.z * scale);\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the float \"scale\" and stores the result in the given vector \"result\" coordinates\r\n * @param scale defines the multiplier factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.scaleToRef = function (scale, result) {\r\n return result.copyFromFloats(this.x * scale, this.y * scale, this.z * scale);\r\n };\r\n /**\r\n * Scale the current Vector3 values by a factor and add the result to a given Vector3\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the unmodified current Vector3\r\n */\r\n Vector3.prototype.scaleAndAddToRef = function (scale, result) {\r\n return result.addInPlaceFromFloats(this.x * scale, this.y * scale, this.z * scale);\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are strictly equal\r\n * @param otherVector defines the second operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z;\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon\r\n * @param otherVector defines the second operand\r\n * @param epsilon defines the minimal distance to define values as equals\r\n * @returns true if both vectors are distant less than epsilon\r\n */\r\n Vector3.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; }\r\n return otherVector && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.x, otherVector.x, epsilon) && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.y, otherVector.y, epsilon) && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.z, otherVector.z, epsilon);\r\n };\r\n /**\r\n * Returns true if the current Vector3 coordinates equals the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equalsToFloats = function (x, y, z) {\r\n return this.x === x && this.y === y && this.z === z;\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n this.z *= otherVector.z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiply = function (otherVector) {\r\n return this.multiplyByFloats(otherVector.x, otherVector.y, otherVector.z);\r\n };\r\n /**\r\n * Multiplies the current Vector3 by the given one and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.multiplyToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiplyByFloats = function (x, y, z) {\r\n return new Vector3(this.x * x, this.y * y, this.z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.divide = function (otherVector) {\r\n return new Vector3(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.divideToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlace = function (other) {\r\n return this.minimizeInPlaceFromFloats(other.x, other.y, other.z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given vector ones.\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlace = function (other) {\r\n return this.maximizeInPlaceFromFloats(other.x, other.y, other.z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlaceFromFloats = function (x, y, z) {\r\n if (x < this.x) {\r\n this.x = x;\r\n }\r\n if (y < this.y) {\r\n this.y = y;\r\n }\r\n if (z < this.z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given coordinates.\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlaceFromFloats = function (x, y, z) {\r\n if (x > this.x) {\r\n this.x = x;\r\n }\r\n if (y > this.y) {\r\n this.y = y;\r\n }\r\n if (z > this.z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Due to float precision, scale of a mesh could be uniform but float values are off by a small fraction\r\n * Check if is non uniform within a certain amount of decimal places to account for this\r\n * @param epsilon the amount the values can differ\r\n * @returns if the the vector is non uniform to a certain number of decimal places\r\n */\r\n Vector3.prototype.isNonUniformWithinEpsilon = function (epsilon) {\r\n var absX = Math.abs(this.x);\r\n var absY = Math.abs(this.y);\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(absX, absY, epsilon)) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this.z);\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(absX, absZ, epsilon)) {\r\n return true;\r\n }\r\n if (!_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(absY, absZ, epsilon)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(Vector3.prototype, \"isNonUniform\", {\r\n /**\r\n * Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same\r\n */\r\n get: function () {\r\n var absX = Math.abs(this.x);\r\n var absY = Math.abs(this.y);\r\n if (absX !== absY) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this.z);\r\n if (absX !== absZ) {\r\n return true;\r\n }\r\n if (absY !== absZ) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.floor = function () {\r\n return new Vector3(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));\r\n };\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.fract = function () {\r\n return new Vector3(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the Vector3\r\n * @returns the length of the Vector3\r\n */\r\n Vector3.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\r\n };\r\n /**\r\n * Gets the squared length of the Vector3\r\n * @returns squared length of the Vector3\r\n */\r\n Vector3.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y + this.z * this.z);\r\n };\r\n /**\r\n * Normalize the current Vector3.\r\n * Please note that this is an in place operation.\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalize = function () {\r\n return this.normalizeFromLength(this.length());\r\n };\r\n /**\r\n * Reorders the x y z properties of the vector in place\r\n * @param order new ordering of the properties (eg. for vector 1,2,3 with \"ZYX\" will produce 3,2,1)\r\n * @returns the current updated vector\r\n */\r\n Vector3.prototype.reorderInPlace = function (order) {\r\n var _this = this;\r\n order = order.toLowerCase();\r\n if (order === \"xyz\") {\r\n return this;\r\n }\r\n MathTmp.Vector3[0].copyFrom(this);\r\n [\"x\", \"y\", \"z\"].forEach(function (val, i) {\r\n _this[val] = MathTmp.Vector3[0][order[i]];\r\n });\r\n return this;\r\n };\r\n /**\r\n * Rotates the vector around 0,0,0 by a quaternion\r\n * @param quaternion the rotation quaternion\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionToRef = function (quaternion, result) {\r\n quaternion.toRotationMatrix(MathTmp.Matrix[0]);\r\n Vector3.TransformCoordinatesToRef(this, MathTmp.Matrix[0], result);\r\n return result;\r\n };\r\n /**\r\n * Rotates a vector around a given point\r\n * @param quaternion the rotation quaternion\r\n * @param point the point to rotate around\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionAroundPointToRef = function (quaternion, point, result) {\r\n this.subtractToRef(point, MathTmp.Vector3[0]);\r\n MathTmp.Vector3[0].rotateByQuaternionToRef(quaternion, MathTmp.Vector3[0]);\r\n point.addToRef(MathTmp.Vector3[0], result);\r\n return result;\r\n };\r\n /**\r\n * Normalize the current Vector3 with the given input length.\r\n * Please note that this is an in place operation.\r\n * @param len the length of the vector\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalizeFromLength = function (len) {\r\n if (len === 0 || len === 1.0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Normalize the current Vector3 to a new vector\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.normalizeToNew = function () {\r\n var normalized = new Vector3(0, 0, 0);\r\n this.normalizeToRef(normalized);\r\n return normalized;\r\n };\r\n /**\r\n * Normalize the current Vector3 to the reference\r\n * @param reference define the Vector3 to update\r\n * @returns the updated Vector3\r\n */\r\n Vector3.prototype.normalizeToRef = function (reference) {\r\n var len = this.length();\r\n if (len === 0 || len === 1.0) {\r\n return reference.copyFromFloats(this.x, this.y, this.z);\r\n }\r\n return this.scaleToRef(1.0 / len, reference);\r\n };\r\n /**\r\n * Creates a new Vector3 copied from the current Vector3\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.clone = function () {\r\n return new Vector3(this.x, this.y, this.z);\r\n };\r\n /**\r\n * Copies the given vector coordinates to the current Vector3 ones\r\n * @param source defines the source Vector3\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFrom = function (source) {\r\n return this.copyFromFloats(source.x, source.y, source.z);\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFromFloats = function (x, y, z) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n return this;\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.set = function (x, y, z) {\r\n return this.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y and z coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Get the clip factor between two vectors\r\n * @param vector0 defines the first operand\r\n * @param vector1 defines the second operand\r\n * @param axis defines the axis to use\r\n * @param size defines the size along the axis\r\n * @returns the clip factor\r\n */\r\n Vector3.GetClipFactor = function (vector0, vector1, axis, size) {\r\n var d0 = Vector3.Dot(vector0, axis) - size;\r\n var d1 = Vector3.Dot(vector1, axis) - size;\r\n var s = d0 / (d0 - d1);\r\n return s;\r\n };\r\n /**\r\n * Get angle between two vectors\r\n * @param vector0 angle between vector0 and vector1\r\n * @param vector1 angle between vector0 and vector1\r\n * @param normal direction of the normal\r\n * @return the angle between vector0 and vector1\r\n */\r\n Vector3.GetAngleBetweenVectors = function (vector0, vector1, normal) {\r\n var v0 = vector0.normalizeToRef(MathTmp.Vector3[1]);\r\n var v1 = vector1.normalizeToRef(MathTmp.Vector3[2]);\r\n var dot = Vector3.Dot(v0, v1);\r\n var n = MathTmp.Vector3[3];\r\n Vector3.CrossToRef(v0, v1, n);\r\n if (Vector3.Dot(n, normal) > 0) {\r\n return Math.acos(dot);\r\n }\r\n return -Math.acos(dot);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n */\r\n Vector3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given Float32Array\r\n * This function is deprecated. Use FromArray instead\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n */\r\n Vector3.FromFloatArray = function (array, offset) {\r\n return Vector3.FromArray(array, offset);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given Float32Array\r\n * This function is deprecated. Use FromArrayToRef instead.\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromFloatArrayToRef = function (array, offset, result) {\r\n return Vector3.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the given floats.\r\n * @param x defines the x coordinate of the source\r\n * @param y defines the y coordinate of the source\r\n * @param z defines the z coordinate of the source\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromFloatsToRef = function (x, y, z, result) {\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 0.0)\r\n * @returns a new empty Vector3\r\n */\r\n Vector3.Zero = function () {\r\n return new Vector3(0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 1.0, 1.0)\r\n * @returns a new unit Vector3\r\n */\r\n Vector3.One = function () {\r\n return new Vector3(1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 1.0, 0.0)\r\n * @returns a new up Vector3\r\n */\r\n Vector3.Up = function () {\r\n return new Vector3(0.0, 1.0, 0.0);\r\n };\r\n Object.defineProperty(Vector3, \"UpReadOnly\", {\r\n /**\r\n * Gets a up Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._UpReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3, \"ZeroReadOnly\", {\r\n /**\r\n * Gets a zero Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._ZeroReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new Vector3 set to (0.0, -1.0, 0.0)\r\n * @returns a new down Vector3\r\n */\r\n Vector3.Down = function () {\r\n return new Vector3(0.0, -1.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 1.0)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Forward = function () {\r\n return new Vector3(0.0, 0.0, 1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, -1.0)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Backward = function () {\r\n return new Vector3(0.0, 0.0, -1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 0.0, 0.0)\r\n * @returns a new right Vector3\r\n */\r\n Vector3.Right = function () {\r\n return new Vector3(1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (-1.0, 0.0, 0.0)\r\n * @returns a new left Vector3\r\n */\r\n Vector3.Left = function () {\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector.\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the transformed Vector3\r\n */\r\n Vector3.TransformCoordinates = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given vector\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesToRef = function (vector, transformation, result) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(vector.x, vector.y, vector.z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z)\r\n * This method computes tranformed coordinates only, not transformed direction vectors\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n var rx = x * m[0] + y * m[4] + z * m[8] + m[12];\r\n var ry = x * m[1] + y * m[5] + z * m[9] + m[13];\r\n var rz = x * m[2] + y * m[6] + z * m[10] + m[14];\r\n var rw = 1 / (x * m[3] + y * m[7] + z * m[11] + m[15]);\r\n result.x = rx * rw;\r\n result.y = ry * rw;\r\n result.z = rz * rw;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the new Vector3\r\n */\r\n Vector3.TransformNormal = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalToRef = function (vector, transformation, result) {\r\n this.TransformNormalFromFloatsToRef(vector.x, vector.y, vector.z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z)\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n result.x = x * m[0] + y * m[4] + z * m[8];\r\n result.y = x * m[1] + y * m[5] + z * m[9];\r\n result.z = x * m[2] + y * m[6] + z * m[10];\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" on the CatmullRom interpolation spline defined by the vectors \"value1\", \"value2\", \"value3\", \"value4\"\r\n * @param value1 defines the first control point\r\n * @param value2 defines the second control point\r\n * @param value3 defines the third control point\r\n * @param value4 defines the fourth control point\r\n * @param amount defines the amount on the spline to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +\r\n (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +\r\n ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +\r\n (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +\r\n ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));\r\n var z = 0.5 * ((((2.0 * value2.z) + ((-value1.z + value3.z) * amount)) +\r\n (((((2.0 * value1.z) - (5.0 * value2.z)) + (4.0 * value3.z)) - value4.z) * squared)) +\r\n ((((-value1.z + (3.0 * value2.z)) - (3.0 * value3.z)) + value4.z) * cubed));\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @returns the new Vector3\r\n */\r\n Vector3.Clamp = function (value, min, max) {\r\n var v = new Vector3();\r\n Vector3.ClampToRef(value, min, max, v);\r\n return v;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.ClampToRef = function (value, min, max, result) {\r\n var x = value.x;\r\n x = (x > max.x) ? max.x : x;\r\n x = (x < min.x) ? min.x : x;\r\n var y = value.y;\r\n y = (y > max.y) ? max.y : y;\r\n y = (y < min.y) ? min.y : y;\r\n var z = value.z;\r\n z = (z > max.z) ? max.z : z;\r\n z = (z < min.z) ? min.z : z;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Checks if a given vector is inside a specific range\r\n * @param v defines the vector to test\r\n * @param min defines the minimum range\r\n * @param max defines the maximum range\r\n */\r\n Vector3.CheckExtends = function (v, min, max) {\r\n min.minimizeInPlace(v);\r\n max.maximizeInPlace(v);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the Hermite interpolation spline defined by the vectors \"value1\", \"tangent1\", \"value2\", \"tangent2\"\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent vector\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent vector\r\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n var z = (((value1.z * part1) + (value2.z * part2)) + (tangent1.z * part3)) + (tangent2.z * part4);\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the linear interpolation between the vectors \"start\" and \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Lerp = function (start, end, amount) {\r\n var result = new Vector3(0, 0, 0);\r\n Vector3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the linear interpolation from the vector \"start\" for \"amount\" to the vector \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.LerpToRef = function (start, end, amount, result) {\r\n result.x = start.x + ((end.x - start.x) * amount);\r\n result.y = start.y + ((end.y - start.y) * amount);\r\n result.z = start.z + ((end.z - start.z) * amount);\r\n };\r\n /**\r\n * Returns the dot product (float) between the vectors \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Vector3.Dot = function (left, right) {\r\n return (left.x * right.x + left.y * right.y + left.z * right.z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the cross product of the vectors \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the cross product\r\n */\r\n Vector3.Cross = function (left, right) {\r\n var result = Vector3.Zero();\r\n Vector3.CrossToRef(left, right, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the cross product of \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.CrossToRef = function (left, right, result) {\r\n var x = left.y * right.z - left.z * right.y;\r\n var y = left.z * right.x - left.x * right.z;\r\n var z = left.x * right.y - left.y * right.x;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the normalization of the given vector\r\n * @param vector defines the Vector3 to normalize\r\n * @returns the new Vector3\r\n */\r\n Vector3.Normalize = function (vector) {\r\n var result = Vector3.Zero();\r\n Vector3.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the normalization of the given first vector\r\n * @param vector defines the Vector3 to normalize\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.NormalizeToRef = function (vector, result) {\r\n vector.normalizeToRef(result);\r\n };\r\n /**\r\n * Project a Vector3 onto screen space\r\n * @param vector defines the Vector3 to project\r\n * @param world defines the world matrix to use\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @param viewport defines the screen viewport to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Project = function (vector, world, transform, viewport) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = MathTmp.Matrix[1];\r\n Matrix.FromValuesToRef(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 0.5, 0, cx + cw / 2.0, ch / 2.0 + cy, 0.5, 1, viewportMatrix);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.multiplyToRef(viewportMatrix, matrix);\r\n return Vector3.TransformCoordinates(vector, matrix);\r\n };\r\n /** @hidden */\r\n Vector3._UnprojectFromInvertedMatrixToRef = function (source, matrix, result) {\r\n Vector3.TransformCoordinatesToRef(source, matrix, result);\r\n var m = matrix.m;\r\n var num = source.x * m[3] + source.y * m[7] + source.z * m[11] + m[15];\r\n if (_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(num, 1.0)) {\r\n result.scaleInPlace(1.0 / num);\r\n }\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.UnprojectFromTransform = function (source, viewportWidth, viewportHeight, world, transform) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.invert();\r\n source.x = source.x / viewportWidth * 2 - 1;\r\n source.y = -(source.y / viewportHeight * 2 - 1);\r\n var vector = new Vector3();\r\n Vector3._UnprojectFromInvertedMatrixToRef(source, matrix, vector);\r\n return vector;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Unproject = function (source, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Vector3.Zero();\r\n Vector3.UnprojectToRef(source, viewportWidth, viewportHeight, world, view, projection, result);\r\n return result;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectToRef = function (source, viewportWidth, viewportHeight, world, view, projection, result) {\r\n Vector3.UnprojectFloatsToRef(source.x, source.y, source.z, viewportWidth, viewportHeight, world, view, projection, result);\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param sourceZ defines the screen space z coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectFloatsToRef = function (sourceX, sourceY, sourceZ, viewportWidth, viewportHeight, world, view, projection, result) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var screenSource = MathTmp.Vector3[0];\r\n screenSource.x = sourceX / viewportWidth * 2 - 1;\r\n screenSource.y = -(sourceY / viewportHeight * 2 - 1);\r\n screenSource.z = 2 * sourceZ - 1.0;\r\n Vector3._UnprojectFromInvertedMatrixToRef(screenSource, matrix, result);\r\n };\r\n /**\r\n * Gets the minimal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Gets the maximal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the distance\r\n */\r\n Vector3.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector3.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the squared distance\r\n */\r\n Vector3.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n var z = value1.z - value2.z;\r\n return (x * x) + (y * y) + (z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 located at the center between \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),\r\n * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply\r\n * to something in order to rotate it from its local system to the given target system\r\n * Note: axis1, axis2 and axis3 are normalized during this operation\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns a new Vector3\r\n */\r\n Vector3.RotationFromAxis = function (axis1, axis2, axis3) {\r\n var rotation = Vector3.Zero();\r\n Vector3.RotationFromAxisToRef(axis1, axis2, axis3, rotation);\r\n return rotation;\r\n };\r\n /**\r\n * The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the Vector3 where to store the result\r\n */\r\n Vector3.RotationFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var quat = MathTmp.Quaternion[0];\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n quat.toEulerAnglesToRef(ref);\r\n };\r\n Vector3._UpReadOnly = Vector3.Up();\r\n Vector3._ZeroReadOnly = Vector3.Zero();\r\n return Vector3;\r\n}());\r\n\r\n/**\r\n * Vector4 class created for EulerAngle class conversion to Quaternion\r\n */\r\nvar Vector4 = /** @class */ (function () {\r\n /**\r\n * Creates a Vector4 object from the given floats.\r\n * @param x x value of the vector\r\n * @param y y value of the vector\r\n * @param z z value of the vector\r\n * @param w w value of the vector\r\n */\r\n function Vector4(\r\n /** x value of the vector */\r\n x, \r\n /** y value of the vector */\r\n y, \r\n /** z value of the vector */\r\n z, \r\n /** w value of the vector */\r\n w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n }\r\n /**\r\n * Returns the string with the Vector4 coordinates.\r\n * @returns a string containing all the vector values\r\n */\r\n Vector4.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \" W:\" + this.w + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Vector4\".\r\n * @returns \"Vector4\"\r\n */\r\n Vector4.prototype.getClassName = function () {\r\n return \"Vector4\";\r\n };\r\n /**\r\n * Returns the Vector4 hash code.\r\n * @returns a unique hash code\r\n */\r\n Vector4.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n hash = (hash * 397) ^ (this.w | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Returns a new array populated with 4 elements : the Vector4 coordinates.\r\n * @returns the resulting array\r\n */\r\n Vector4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array from the given index with the Vector4 coordinates.\r\n * @param array array to populate\r\n * @param index index of the array to start at (default: 0)\r\n * @returns the Vector4.\r\n */\r\n Vector4.prototype.toArray = function (array, index) {\r\n if (index === undefined) {\r\n index = 0;\r\n }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n array[index + 2] = this.z;\r\n array[index + 3] = this.w;\r\n return this;\r\n };\r\n /**\r\n * Adds the given vector to the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n this.z += otherVector.z;\r\n this.w += otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 as the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @returns the resulting vector\r\n */\r\n Vector4.prototype.add = function (otherVector) {\r\n return new Vector4(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n result.z = this.z + otherVector.z;\r\n result.w = this.w + otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Subtract in place the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n this.z -= otherVector.z;\r\n this.w -= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the new vector with the result\r\n */\r\n Vector4.prototype.subtract = function (otherVector) {\r\n return new Vector4(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n result.z = this.z - otherVector.z;\r\n result.w = this.w - otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n */\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @returns new vector containing the result\r\n */\r\n Vector4.prototype.subtractFromFloats = function (x, y, z, w) {\r\n return new Vector4(this.x - x, this.y - y, this.z - z, this.w - w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @param result the vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractFromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = this.x - x;\r\n result.y = this.y - y;\r\n result.z = this.z - z;\r\n result.w = this.w - w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 negated coordinates.\r\n * @returns a new vector with the negated values\r\n */\r\n Vector4.prototype.negate = function () {\r\n return new Vector4(-this.x, -this.y, -this.z, -this.w);\r\n };\r\n /**\r\n * Multiplies the current Vector4 coordinates by scale (float).\r\n * @param scale the number to scale with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n this.w *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @returns a new vector with the result\r\n */\r\n Vector4.prototype.scale = function (scale) {\r\n return new Vector4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @param result a vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n result.z = this.z * scale;\r\n result.w = this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector4 values by a factor and add the result to a given Vector4\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector4 object where to store the result\r\n * @returns the unmodified current Vector4\r\n */\r\n Vector4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n result.z += this.z * scale;\r\n result.w += this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are stricly equal to the given ones.\r\n * @param otherVector the vector to compare against\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are each beneath the distance \"epsilon\" from the given vector ones.\r\n * @param otherVector vector to compare against\r\n * @param epsilon (Default: very small number)\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = _math_constants__WEBPACK_IMPORTED_MODULE_1__[\"Epsilon\"]; }\r\n return otherVector\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.x, otherVector.x, epsilon)\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.y, otherVector.y, epsilon)\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.z, otherVector.z, epsilon)\r\n && _math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].WithinEpsilon(this.w, otherVector.w, epsilon);\r\n };\r\n /**\r\n * Boolean : True if the given floats are strictly equal to the current Vector4 coordinates.\r\n * @param x x value to compare against\r\n * @param y y value to compare against\r\n * @param z z value to compare against\r\n * @param w w value to compare against\r\n * @returns true if equal\r\n */\r\n Vector4.prototype.equalsToFloats = function (x, y, z, w) {\r\n return this.x === x && this.y === y && this.z === z && this.w === w;\r\n };\r\n /**\r\n * Multiplies in place the current Vector4 by the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n this.z *= otherVector.z;\r\n this.w *= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiply = function (otherVector) {\r\n return new Vector4(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n result.z = this.z * otherVector.z;\r\n result.w = this.w * otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates.\r\n * @param x x value multiply with\r\n * @param y y value multiply with\r\n * @param z z value multiply with\r\n * @param w w value multiply with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiplyByFloats = function (x, y, z, w) {\r\n return new Vector4(this.x * x, this.y * y, this.z * z, this.w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 set with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.divide = function (otherVector) {\r\n return new Vector4(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n result.z = this.z / otherVector.z;\r\n result.w = this.w / otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector vector to devide with\r\n * @returns the updated Vector3.\r\n */\r\n Vector4.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the minimum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.minimizeInPlace = function (other) {\r\n if (other.x < this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y < this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z < this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w < this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the maximum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.maximizeInPlace = function (other) {\r\n if (other.x > this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y > this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z > this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w > this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector4 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.floor = function () {\r\n return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector3 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.fract = function () {\r\n return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));\r\n };\r\n // Properties\r\n /**\r\n * Returns the Vector4 length (float).\r\n * @returns the length\r\n */\r\n Vector4.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n /**\r\n * Returns the Vector4 squared length (float).\r\n * @returns the length squared\r\n */\r\n Vector4.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n // Methods\r\n /**\r\n * Normalizes in place the Vector4.\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.\r\n * @returns this converted to a new vector3\r\n */\r\n Vector4.prototype.toVector3 = function () {\r\n return new Vector3(this.x, this.y, this.z);\r\n };\r\n /**\r\n * Returns a new Vector4 copied from the current one.\r\n * @returns the new cloned vector\r\n */\r\n Vector4.prototype.clone = function () {\r\n return new Vector4(this.x, this.y, this.z, this.w);\r\n };\r\n /**\r\n * Updates the current Vector4 with the given one coordinates.\r\n * @param source the source vector to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n this.z = source.z;\r\n this.w = source.w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to copy from\r\n * @param y float to copy from\r\n * @param z float to copy from\r\n * @param w float to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y, z and w coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector4.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = this.w = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new Vector4 set from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @returns the new vector\r\n */\r\n Vector4.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Vector4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n result.w = array[offset + 3];\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given Float32Array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromFloatArrayToRef = function (array, offset, result) {\r\n Vector4.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Updates the given vector \"result\" coordinates from the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @param result the vector to the floats in\r\n */\r\n Vector4.FromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = w;\r\n };\r\n /**\r\n * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)\r\n * @returns the new vector\r\n */\r\n Vector4.Zero = function () {\r\n return new Vector4(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)\r\n * @returns the new vector\r\n */\r\n Vector4.One = function () {\r\n return new Vector4(1.0, 1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new normalized Vector4 from the given one.\r\n * @param vector the vector to normalize\r\n * @returns the vector\r\n */\r\n Vector4.Normalize = function (vector) {\r\n var result = Vector4.Zero();\r\n Vector4.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the normalization of the given one.\r\n * @param vector the vector to normalize\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.NormalizeToRef = function (vector, result) {\r\n result.copyFrom(vector);\r\n result.normalize();\r\n };\r\n /**\r\n * Returns a vector with the minimum values from the left and right vectors\r\n * @param left left vector to minimize\r\n * @param right right vector to minimize\r\n * @returns a new vector with the minimum of the left and right vector values\r\n */\r\n Vector4.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Returns a vector with the maximum values from the left and right vectors\r\n * @param left left vector to maximize\r\n * @param right right vector to maximize\r\n * @returns a new vector with the maximum of the left and right vector values\r\n */\r\n Vector4.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors\r\n */\r\n Vector4.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector4.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors squared\r\n */\r\n Vector4.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n var z = value1.z - value2.z;\r\n var w = value1.w - value2.w;\r\n return (x * x) + (y * y) + (z * z) + (w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 located at the center between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the center between\r\n * @param value2 value to calulate the center between\r\n * @return the center between the two vectors\r\n */\r\n Vector4.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @returns the new vector\r\n */\r\n Vector4.TransformNormal = function (vector, transformation) {\r\n var result = Vector4.Zero();\r\n Vector4.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.TransformNormalToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + (vector.z * m[8]);\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + (vector.z * m[9]);\r\n var z = (vector.x * m[2]) + (vector.y * m[6]) + (vector.z * m[10]);\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = vector.w;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z, w).\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param x value to transform\r\n * @param y value to transform\r\n * @param z value to transform\r\n * @param w value to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the results in\r\n */\r\n Vector4.TransformNormalFromFloatsToRef = function (x, y, z, w, transformation, result) {\r\n var m = transformation.m;\r\n result.x = (x * m[0]) + (y * m[4]) + (z * m[8]);\r\n result.y = (x * m[1]) + (y * m[5]) + (z * m[9]);\r\n result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);\r\n result.w = w;\r\n };\r\n /**\r\n * Creates a new Vector4 from a Vector3\r\n * @param source defines the source data\r\n * @param w defines the 4th component (default is 0)\r\n * @returns a new Vector4\r\n */\r\n Vector4.FromVector3 = function (source, w) {\r\n if (w === void 0) { w = 0; }\r\n return new Vector4(source.x, source.y, source.z, w);\r\n };\r\n return Vector4;\r\n}());\r\n\r\n/**\r\n * Class used to store quaternion data\r\n * @see https://en.wikipedia.org/wiki/Quaternion\r\n * @see http://doc.babylonjs.com/features/position,_rotation,_scaling\r\n */\r\nvar Quaternion = /** @class */ (function () {\r\n /**\r\n * Creates a new Quaternion from the given floats\r\n * @param x defines the first component (0 by default)\r\n * @param y defines the second component (0 by default)\r\n * @param z defines the third component (0 by default)\r\n * @param w defines the fourth component (1.0 by default)\r\n */\r\n function Quaternion(\r\n /** defines the first component (0 by default) */\r\n x, \r\n /** defines the second component (0 by default) */\r\n y, \r\n /** defines the third component (0 by default) */\r\n z, \r\n /** defines the fourth component (1.0 by default) */\r\n w) {\r\n if (x === void 0) { x = 0.0; }\r\n if (y === void 0) { y = 0.0; }\r\n if (z === void 0) { z = 0.0; }\r\n if (w === void 0) { w = 1.0; }\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n }\r\n /**\r\n * Gets a string representation for the current quaternion\r\n * @returns a string with the Quaternion coordinates\r\n */\r\n Quaternion.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \" W:\" + this.w + \"}\";\r\n };\r\n /**\r\n * Gets the class name of the quaternion\r\n * @returns the string \"Quaternion\"\r\n */\r\n Quaternion.prototype.getClassName = function () {\r\n return \"Quaternion\";\r\n };\r\n /**\r\n * Gets a hash code for this quaternion\r\n * @returns the quaternion hash code\r\n */\r\n Quaternion.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n hash = (hash * 397) ^ (this.w | 0);\r\n return hash;\r\n };\r\n /**\r\n * Copy the quaternion to an array\r\n * @returns a new array populated with 4 elements from the quaternion coordinates\r\n */\r\n Quaternion.prototype.asArray = function () {\r\n return [this.x, this.y, this.z, this.w];\r\n };\r\n /**\r\n * Check if two quaternions are equals\r\n * @param otherQuaternion defines the second operand\r\n * @return true if the current quaternion and the given one coordinates are strictly equals\r\n */\r\n Quaternion.prototype.equals = function (otherQuaternion) {\r\n return otherQuaternion && this.x === otherQuaternion.x && this.y === otherQuaternion.y && this.z === otherQuaternion.z && this.w === otherQuaternion.w;\r\n };\r\n /**\r\n * Clone the current quaternion\r\n * @returns a new quaternion copied from the current one\r\n */\r\n Quaternion.prototype.clone = function () {\r\n return new Quaternion(this.x, this.y, this.z, this.w);\r\n };\r\n /**\r\n * Copy a quaternion to the current one\r\n * @param other defines the other quaternion\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFrom = function (other) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n this.z = other.z;\r\n this.w = other.w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Adds two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the addition result of the given one and the current quaternion\r\n */\r\n Quaternion.prototype.add = function (other) {\r\n return new Quaternion(this.x + other.x, this.y + other.y, this.z + other.z, this.w + other.w);\r\n };\r\n /**\r\n * Add a quaternion to the current one\r\n * @param other defines the quaternion to add\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.addInPlace = function (other) {\r\n this.x += other.x;\r\n this.y += other.y;\r\n this.z += other.z;\r\n this.w += other.w;\r\n return this;\r\n };\r\n /**\r\n * Subtract two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the subtraction result of the given one from the current one\r\n */\r\n Quaternion.prototype.subtract = function (other) {\r\n return new Quaternion(this.x - other.x, this.y - other.y, this.z - other.z, this.w - other.w);\r\n };\r\n /**\r\n * Multiplies the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns a new quaternion set by multiplying the current quaternion coordinates by the float \"scale\"\r\n */\r\n Quaternion.prototype.scale = function (value) {\r\n return new Quaternion(this.x * value, this.y * value, this.z * value, this.w * value);\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and stores the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n result.z = this.z * scale;\r\n result.w = this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns the current modified quaternion\r\n */\r\n Quaternion.prototype.scaleInPlace = function (value) {\r\n this.x *= value;\r\n this.y *= value;\r\n this.z *= value;\r\n this.w *= value;\r\n return this;\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and add the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n result.z += this.z * scale;\r\n result.w += this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies two quaternions\r\n * @param q1 defines the second operand\r\n * @returns a new quaternion set as the multiplication result of the current one with the given one \"q1\"\r\n */\r\n Quaternion.prototype.multiply = function (q1) {\r\n var result = new Quaternion(0, 0, 0, 1.0);\r\n this.multiplyToRef(q1, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" as the the multiplication result of the current one with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @param result defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.multiplyToRef = function (q1, result) {\r\n var x = this.x * q1.w + this.y * q1.z - this.z * q1.y + this.w * q1.x;\r\n var y = -this.x * q1.z + this.y * q1.w + this.z * q1.x + this.w * q1.y;\r\n var z = this.x * q1.y - this.y * q1.x + this.z * q1.w + this.w * q1.z;\r\n var w = -this.x * q1.x - this.y * q1.y - this.z * q1.z + this.w * q1.w;\r\n result.copyFromFloats(x, y, z, w);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the multiplication of itself with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @returns the currentupdated quaternion\r\n */\r\n Quaternion.prototype.multiplyInPlace = function (q1) {\r\n this.multiplyToRef(q1, this);\r\n return this;\r\n };\r\n /**\r\n * Conjugates (1-q) the current quaternion and stores the result in the given quaternion\r\n * @param ref defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.conjugateToRef = function (ref) {\r\n ref.copyFromFloats(-this.x, -this.y, -this.z, this.w);\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.conjugateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns a new quaternion\r\n */\r\n Quaternion.prototype.conjugate = function () {\r\n var result = new Quaternion(-this.x, -this.y, -this.z, this.w);\r\n return result;\r\n };\r\n /**\r\n * Gets length of current quaternion\r\n * @returns the quaternion length (float)\r\n */\r\n Quaternion.prototype.length = function () {\r\n return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z) + (this.w * this.w));\r\n };\r\n /**\r\n * Normalize in place the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n var inv = 1.0 / len;\r\n this.x *= inv;\r\n this.y *= inv;\r\n this.z *= inv;\r\n this.w *= inv;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the Euler angles translated from the current quaternion\r\n * @param order is a reserved parameter and is ignore for now\r\n * @returns a new Vector3 containing the Euler angles\r\n */\r\n Quaternion.prototype.toEulerAngles = function (order) {\r\n if (order === void 0) { order = \"YZX\"; }\r\n var result = Vector3.Zero();\r\n this.toEulerAnglesToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector3 \"result\" with the Euler angles translated from the current quaternion\r\n * @param result defines the vector which will be filled with the Euler angles\r\n * @param order is a reserved parameter and is ignore for now\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toEulerAnglesToRef = function (result) {\r\n var qz = this.z;\r\n var qx = this.x;\r\n var qy = this.y;\r\n var qw = this.w;\r\n var sqw = qw * qw;\r\n var sqz = qz * qz;\r\n var sqx = qx * qx;\r\n var sqy = qy * qy;\r\n var zAxisY = qy * qz - qx * qw;\r\n var limit = .4999999;\r\n if (zAxisY < -limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else if (zAxisY > limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = -Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else {\r\n result.z = Math.atan2(2.0 * (qx * qy + qz * qw), (-sqz - sqx + sqy + sqw));\r\n result.x = Math.asin(-2.0 * (qz * qy - qx * qw));\r\n result.y = Math.atan2(2.0 * (qz * qx + qy * qw), (sqz - sqx - sqy + sqw));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the given rotation matrix with the current quaternion values\r\n * @param result defines the target matrix\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toRotationMatrix = function (result) {\r\n Matrix.FromQuaternionToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.fromRotationMatrix = function (matrix) {\r\n Quaternion.FromRotationMatrixToRef(matrix, this);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new quaternion from a rotation matrix\r\n * @param matrix defines the source matrix\r\n * @returns a new quaternion created from the given rotation matrix values\r\n */\r\n Quaternion.FromRotationMatrix = function (matrix) {\r\n var result = new Quaternion();\r\n Quaternion.FromRotationMatrixToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given quaternion with the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.FromRotationMatrixToRef = function (matrix, result) {\r\n var data = matrix.m;\r\n var m11 = data[0], m12 = data[4], m13 = data[8];\r\n var m21 = data[1], m22 = data[5], m23 = data[9];\r\n var m31 = data[2], m32 = data[6], m33 = data[10];\r\n var trace = m11 + m22 + m33;\r\n var s;\r\n if (trace > 0) {\r\n s = 0.5 / Math.sqrt(trace + 1.0);\r\n result.w = 0.25 / s;\r\n result.x = (m32 - m23) * s;\r\n result.y = (m13 - m31) * s;\r\n result.z = (m21 - m12) * s;\r\n }\r\n else if (m11 > m22 && m11 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\r\n result.w = (m32 - m23) / s;\r\n result.x = 0.25 * s;\r\n result.y = (m12 + m21) / s;\r\n result.z = (m13 + m31) / s;\r\n }\r\n else if (m22 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\r\n result.w = (m13 - m31) / s;\r\n result.x = (m12 + m21) / s;\r\n result.y = 0.25 * s;\r\n result.z = (m23 + m32) / s;\r\n }\r\n else {\r\n s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\r\n result.w = (m21 - m12) / s;\r\n result.x = (m13 + m31) / s;\r\n result.y = (m23 + m32) / s;\r\n result.z = 0.25 * s;\r\n }\r\n };\r\n /**\r\n * Returns the dot product (float) between the quaternions \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Quaternion.Dot = function (left, right) {\r\n return (left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w);\r\n };\r\n /**\r\n * Checks if the two quaternions are close to each other\r\n * @param quat0 defines the first quaternion to check\r\n * @param quat1 defines the second quaternion to check\r\n * @returns true if the two quaternions are close to each other\r\n */\r\n Quaternion.AreClose = function (quat0, quat1) {\r\n var dot = Quaternion.Dot(quat0, quat1);\r\n return dot >= 0;\r\n };\r\n /**\r\n * Creates an empty quaternion\r\n * @returns a new quaternion set to (0.0, 0.0, 0.0)\r\n */\r\n Quaternion.Zero = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @returns a new quaternion as the inverted current quaternion\r\n */\r\n Quaternion.Inverse = function (q) {\r\n return new Quaternion(-q.x, -q.y, -q.z, q.w);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @param result the quaternion the result will be stored in\r\n * @returns the result quaternion\r\n */\r\n Quaternion.InverseToRef = function (q, result) {\r\n result.set(-q.x, -q.y, -q.z, q.w);\r\n return result;\r\n };\r\n /**\r\n * Creates an identity quaternion\r\n * @returns the identity quaternion\r\n */\r\n Quaternion.Identity = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 1.0);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given quaternion is identity\r\n * @param quaternion defines the quaternion to check\r\n * @returns true if the quaternion is identity\r\n */\r\n Quaternion.IsIdentity = function (quaternion) {\r\n return quaternion && quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\r\n };\r\n /**\r\n * Creates a quaternion from a rotation around an axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @returns a new quaternion created from the given axis (Vector3) and angle in radians (float)\r\n */\r\n Quaternion.RotationAxis = function (axis, angle) {\r\n return Quaternion.RotationAxisToRef(axis, angle, new Quaternion());\r\n };\r\n /**\r\n * Creates a rotation around an axis and stores it into the given quaternion\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\n Quaternion.RotationAxisToRef = function (axis, angle, result) {\r\n var sin = Math.sin(angle / 2);\r\n axis.normalize();\r\n result.w = Math.cos(angle / 2);\r\n result.x = axis.x * sin;\r\n result.y = axis.y * sin;\r\n result.z = axis.z * sin;\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from data stored into an array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the source array where the data starts\r\n * @returns a new quaternion\r\n */\r\n Quaternion.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Quaternion(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerAngles = function (x, y, z) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerAnglesToRef = function (x, y, z, result) {\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, result);\r\n return result;\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerVector = function (vec) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(vec.y, vec.x, vec.z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerVectorToRef = function (vec, result) {\r\n Quaternion.RotationYawPitchRollToRef(vec.y, vec.x, vec.z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles (y, x, z)\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, q);\r\n return q;\r\n };\r\n /**\r\n * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n // Produces a quaternion from Euler angles in the z-y-x orientation (Tait-Bryan angles)\r\n var halfRoll = roll * 0.5;\r\n var halfPitch = pitch * 0.5;\r\n var halfYaw = yaw * 0.5;\r\n var sinRoll = Math.sin(halfRoll);\r\n var cosRoll = Math.cos(halfRoll);\r\n var sinPitch = Math.sin(halfPitch);\r\n var cosPitch = Math.cos(halfPitch);\r\n var sinYaw = Math.sin(halfYaw);\r\n var cosYaw = Math.cos(halfYaw);\r\n result.x = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);\r\n result.y = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll);\r\n result.z = (cosYaw * cosPitch * sinRoll) - (sinYaw * sinPitch * cosRoll);\r\n result.w = (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll);\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGamma = function (alpha, beta, gamma) {\r\n var result = new Quaternion();\r\n Quaternion.RotationAlphaBetaGammaToRef(alpha, beta, gamma, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGammaToRef = function (alpha, beta, gamma, result) {\r\n // Produces a quaternion from Euler angles in the z-x-z orientation\r\n var halfGammaPlusAlpha = (gamma + alpha) * 0.5;\r\n var halfGammaMinusAlpha = (gamma - alpha) * 0.5;\r\n var halfBeta = beta * 0.5;\r\n result.x = Math.cos(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.y = Math.sin(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.z = Math.sin(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n result.w = Math.cos(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n };\r\n /**\r\n * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxis = function (axis1, axis2, axis3) {\r\n var quat = new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n return quat;\r\n };\r\n /**\r\n * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the target quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var rotMat = MathTmp.Matrix[0];\r\n Matrix.FromXYZAxesToRef(axis1.normalize(), axis2.normalize(), axis3.normalize(), rotMat);\r\n Quaternion.FromRotationMatrixToRef(rotMat, ref);\r\n };\r\n /**\r\n * Interpolates between two quaternions\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Slerp = function (left, right, amount) {\r\n var result = Quaternion.Identity();\r\n Quaternion.SlerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Interpolates between two quaternions and stores it into a target quaternion\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.SlerpToRef = function (left, right, amount, result) {\r\n var num2;\r\n var num3;\r\n var num4 = (((left.x * right.x) + (left.y * right.y)) + (left.z * right.z)) + (left.w * right.w);\r\n var flag = false;\r\n if (num4 < 0) {\r\n flag = true;\r\n num4 = -num4;\r\n }\r\n if (num4 > 0.999999) {\r\n num3 = 1 - amount;\r\n num2 = flag ? -amount : amount;\r\n }\r\n else {\r\n var num5 = Math.acos(num4);\r\n var num6 = (1.0 / Math.sin(num5));\r\n num3 = (Math.sin((1.0 - amount) * num5)) * num6;\r\n num2 = flag ? ((-Math.sin(amount * num5)) * num6) : ((Math.sin(amount * num5)) * num6);\r\n }\r\n result.x = (num3 * left.x) + (num2 * right.x);\r\n result.y = (num3 * left.y) + (num2 * right.y);\r\n result.z = (num3 * left.z) + (num2 * right.z);\r\n result.w = (num3 * left.w) + (num2 * right.w);\r\n };\r\n /**\r\n * Interpolate between two quaternions using Hermite interpolation\r\n * @param value1 defines first quaternion\r\n * @param tangent1 defines the incoming tangent\r\n * @param value2 defines second quaternion\r\n * @param tangent2 defines the outgoing tangent\r\n * @param amount defines the target quaternion\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n var z = (((value1.z * part1) + (value2.z * part2)) + (tangent1.z * part3)) + (tangent2.z * part4);\r\n var w = (((value1.w * part1) + (value2.w * part2)) + (tangent1.w * part3)) + (tangent2.w * part4);\r\n return new Quaternion(x, y, z, w);\r\n };\r\n return Quaternion;\r\n}());\r\n\r\n/**\r\n * Class used to store matrix data (4x4)\r\n */\r\nvar Matrix = /** @class */ (function () {\r\n /**\r\n * Creates an empty matrix (filled with zeros)\r\n */\r\n function Matrix() {\r\n this._isIdentity = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2 = true;\r\n this._isIdentity3x2Dirty = true;\r\n /**\r\n * Gets the update flag of the matrix which is an unique number for the matrix.\r\n * It will be incremented every time the matrix data change.\r\n * You can use it to speed the comparison between two versions of the same matrix.\r\n */\r\n this.updateFlag = -1;\r\n this._m = new Float32Array(16);\r\n this._updateIdentityStatus(false);\r\n }\r\n Object.defineProperty(Matrix.prototype, \"m\", {\r\n /**\r\n * Gets the internal data of the matrix\r\n */\r\n get: function () { return this._m; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Matrix.prototype._markAsUpdated = function () {\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = false;\r\n this._isIdentity3x2 = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2Dirty = true;\r\n };\r\n /** @hidden */\r\n Matrix.prototype._updateIdentityStatus = function (isIdentity, isIdentityDirty, isIdentity3x2, isIdentity3x2Dirty) {\r\n if (isIdentityDirty === void 0) { isIdentityDirty = false; }\r\n if (isIdentity3x2 === void 0) { isIdentity3x2 = false; }\r\n if (isIdentity3x2Dirty === void 0) { isIdentity3x2Dirty = true; }\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = isIdentity;\r\n this._isIdentity3x2 = isIdentity || isIdentity3x2;\r\n this._isIdentityDirty = this._isIdentity ? false : isIdentityDirty;\r\n this._isIdentity3x2Dirty = this._isIdentity3x2 ? false : isIdentity3x2Dirty;\r\n };\r\n // Properties\r\n /**\r\n * Check if the current matrix is identity\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentity = function () {\r\n if (this._isIdentityDirty) {\r\n this._isIdentityDirty = false;\r\n var m = this._m;\r\n this._isIdentity = (m[0] === 1.0 && m[1] === 0.0 && m[2] === 0.0 && m[3] === 0.0 &&\r\n m[4] === 0.0 && m[5] === 1.0 && m[6] === 0.0 && m[7] === 0.0 &&\r\n m[8] === 0.0 && m[9] === 0.0 && m[10] === 1.0 && m[11] === 0.0 &&\r\n m[12] === 0.0 && m[13] === 0.0 && m[14] === 0.0 && m[15] === 1.0);\r\n }\r\n return this._isIdentity;\r\n };\r\n /**\r\n * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentityAs3x2 = function () {\r\n if (this._isIdentity3x2Dirty) {\r\n this._isIdentity3x2Dirty = false;\r\n if (this._m[0] !== 1.0 || this._m[5] !== 1.0 || this._m[15] !== 1.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else if (this._m[1] !== 0.0 || this._m[2] !== 0.0 || this._m[3] !== 0.0 ||\r\n this._m[4] !== 0.0 || this._m[6] !== 0.0 || this._m[7] !== 0.0 ||\r\n this._m[8] !== 0.0 || this._m[9] !== 0.0 || this._m[10] !== 0.0 || this._m[11] !== 0.0 ||\r\n this._m[12] !== 0.0 || this._m[13] !== 0.0 || this._m[14] !== 0.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else {\r\n this._isIdentity3x2 = true;\r\n }\r\n }\r\n return this._isIdentity3x2;\r\n };\r\n /**\r\n * Gets the determinant of the matrix\r\n * @returns the matrix determinant\r\n */\r\n Matrix.prototype.determinant = function () {\r\n if (this._isIdentity === true) {\r\n return 1;\r\n }\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n // https://en.wikipedia.org/wiki/Laplace_expansion\r\n // to compute the deterrminant of a 4x4 Matrix we compute the cofactors of any row or column,\r\n // then we multiply each Cofactor by its corresponding matrix value and sum them all to get the determinant\r\n // Cofactor(i, j) = sign(i,j) * det(Minor(i, j))\r\n // where\r\n // - sign(i,j) = (i+j) % 2 === 0 ? 1 : -1\r\n // - Minor(i, j) is the 3x3 matrix we get by removing row i and column j from current Matrix\r\n //\r\n // Here we do that for the 1st row.\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n return m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n };\r\n // Methods\r\n /**\r\n * Returns the matrix as a Float32Array\r\n * @returns the matrix underlying array\r\n */\r\n Matrix.prototype.toArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Returns the matrix as a Float32Array\r\n * @returns the matrix underlying array.\r\n */\r\n Matrix.prototype.asArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Inverts the current matrix in place\r\n * @returns the current inverted matrix\r\n */\r\n Matrix.prototype.invert = function () {\r\n this.invertToRef(this);\r\n return this;\r\n };\r\n /**\r\n * Sets all the matrix elements to zero\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.reset = function () {\r\n Matrix.FromValuesToRef(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, this);\r\n this._updateIdentityStatus(false);\r\n return this;\r\n };\r\n /**\r\n * Adds the current matrix with a second one\r\n * @param other defines the matrix to add\r\n * @returns a new matrix as the addition of the current matrix and the given one\r\n */\r\n Matrix.prototype.add = function (other) {\r\n var result = new Matrix();\r\n this.addToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" to the addition of the current matrix and the given one\r\n * @param other defines the matrix to add\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.addToRef = function (other, result) {\r\n var m = this._m;\r\n var resultM = result._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = m[index] + otherM[index];\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds in place the given matrix to the current matrix\r\n * @param other defines the second operand\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addToSelf = function (other) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n m[index] += otherM[index];\r\n }\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix to the current inverted Matrix\r\n * @param other defines the target matrix\r\n * @returns the unmodified current matrix\r\n */\r\n Matrix.prototype.invertToRef = function (other) {\r\n if (this._isIdentity === true) {\r\n Matrix.IdentityToRef(other);\r\n return this;\r\n }\r\n // the inverse of a Matrix is the transpose of cofactor matrix divided by the determinant\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n var det = m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n if (det === 0) {\r\n // not invertible\r\n other.copyFrom(this);\r\n return this;\r\n }\r\n var detInv = 1 / det;\r\n var det_12_33 = m12 * m33 - m32 * m13;\r\n var det_11_33 = m11 * m33 - m31 * m13;\r\n var det_11_32 = m11 * m32 - m31 * m12;\r\n var det_10_33 = m10 * m33 - m30 * m13;\r\n var det_10_32 = m10 * m32 - m30 * m12;\r\n var det_10_31 = m10 * m31 - m30 * m11;\r\n var det_12_23 = m12 * m23 - m22 * m13;\r\n var det_11_23 = m11 * m23 - m21 * m13;\r\n var det_11_22 = m11 * m22 - m21 * m12;\r\n var det_10_23 = m10 * m23 - m20 * m13;\r\n var det_10_22 = m10 * m22 - m20 * m12;\r\n var det_10_21 = m10 * m21 - m20 * m11;\r\n var cofact_10 = -(m01 * det_22_33 - m02 * det_21_33 + m03 * det_21_32);\r\n var cofact_11 = +(m00 * det_22_33 - m02 * det_20_33 + m03 * det_20_32);\r\n var cofact_12 = -(m00 * det_21_33 - m01 * det_20_33 + m03 * det_20_31);\r\n var cofact_13 = +(m00 * det_21_32 - m01 * det_20_32 + m02 * det_20_31);\r\n var cofact_20 = +(m01 * det_12_33 - m02 * det_11_33 + m03 * det_11_32);\r\n var cofact_21 = -(m00 * det_12_33 - m02 * det_10_33 + m03 * det_10_32);\r\n var cofact_22 = +(m00 * det_11_33 - m01 * det_10_33 + m03 * det_10_31);\r\n var cofact_23 = -(m00 * det_11_32 - m01 * det_10_32 + m02 * det_10_31);\r\n var cofact_30 = -(m01 * det_12_23 - m02 * det_11_23 + m03 * det_11_22);\r\n var cofact_31 = +(m00 * det_12_23 - m02 * det_10_23 + m03 * det_10_22);\r\n var cofact_32 = -(m00 * det_11_23 - m01 * det_10_23 + m03 * det_10_21);\r\n var cofact_33 = +(m00 * det_11_22 - m01 * det_10_22 + m02 * det_10_21);\r\n Matrix.FromValuesToRef(cofact_00 * detInv, cofact_10 * detInv, cofact_20 * detInv, cofact_30 * detInv, cofact_01 * detInv, cofact_11 * detInv, cofact_21 * detInv, cofact_31 * detInv, cofact_02 * detInv, cofact_12 * detInv, cofact_22 * detInv, cofact_32 * detInv, cofact_03 * detInv, cofact_13 * detInv, cofact_23 * detInv, cofact_33 * detInv, other);\r\n return this;\r\n };\r\n /**\r\n * add a value at the specified position in the current Matrix\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addAtIndex = function (index, value) {\r\n this._m[index] += value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * mutiply the specified position in the current Matrix by a value\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.multiplyAtIndex = function (index, value) {\r\n this._m[index] *= value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslationFromFloats = function (x, y, z) {\r\n this._m[12] = x;\r\n this._m[13] = y;\r\n this._m[14] = z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addTranslationFromFloats = function (x, y, z) {\r\n this._m[12] += x;\r\n this._m[13] += y;\r\n this._m[14] += z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector in the current matrix\r\n * @param vector3 defines the translation to insert\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslation = function (vector3) {\r\n return this.setTranslationFromFloats(vector3.x, vector3.y, vector3.z);\r\n };\r\n /**\r\n * Gets the translation value of the current matrix\r\n * @returns a new Vector3 as the extracted translation from the matrix\r\n */\r\n Matrix.prototype.getTranslation = function () {\r\n return new Vector3(this._m[12], this._m[13], this._m[14]);\r\n };\r\n /**\r\n * Fill a Vector3 with the extracted translation from the matrix\r\n * @param result defines the Vector3 where to store the translation\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getTranslationToRef = function (result) {\r\n result.x = this._m[12];\r\n result.y = this._m[13];\r\n result.z = this._m[14];\r\n return this;\r\n };\r\n /**\r\n * Remove rotation and scaling part from the matrix\r\n * @returns the updated matrix\r\n */\r\n Matrix.prototype.removeRotationAndScaling = function () {\r\n var m = this.m;\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, m[12], m[13], m[14], m[15], this);\r\n this._updateIdentityStatus(m[12] === 0 && m[13] === 0 && m[14] === 0 && m[15] === 1);\r\n return this;\r\n };\r\n /**\r\n * Multiply two matrices\r\n * @param other defines the second operand\r\n * @returns a new matrix set with the multiplication result of the current Matrix and the given one\r\n */\r\n Matrix.prototype.multiply = function (other) {\r\n var result = new Matrix();\r\n this.multiplyToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the current matrix from the given one\r\n * @param other defines the source matrix\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.copyFrom = function (other) {\r\n other.copyToArray(this._m);\r\n var o = other;\r\n this._updateIdentityStatus(o._isIdentity, o._isIdentityDirty, o._isIdentity3x2, o._isIdentity3x2Dirty);\r\n return this;\r\n };\r\n /**\r\n * Populates the given array from the starting index with the current matrix values\r\n * @param array defines the target array\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.copyToArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n for (var index = 0; index < 16; index++) {\r\n array[offset + index] = this._m[index];\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" with the multiplication result of the current Matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the matrix where to store the multiplication\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToRef = function (other, result) {\r\n if (this._isIdentity) {\r\n result.copyFrom(other);\r\n return this;\r\n }\r\n if (other._isIdentity) {\r\n result.copyFrom(this);\r\n return this;\r\n }\r\n this.multiplyToArray(other, result._m, 0);\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the Float32Array \"result\" from the given index \"offset\" with the multiplication of the current matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the array where to store the multiplication\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToArray = function (other, result, offset) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n var tm0 = m[0], tm1 = m[1], tm2 = m[2], tm3 = m[3];\r\n var tm4 = m[4], tm5 = m[5], tm6 = m[6], tm7 = m[7];\r\n var tm8 = m[8], tm9 = m[9], tm10 = m[10], tm11 = m[11];\r\n var tm12 = m[12], tm13 = m[13], tm14 = m[14], tm15 = m[15];\r\n var om0 = otherM[0], om1 = otherM[1], om2 = otherM[2], om3 = otherM[3];\r\n var om4 = otherM[4], om5 = otherM[5], om6 = otherM[6], om7 = otherM[7];\r\n var om8 = otherM[8], om9 = otherM[9], om10 = otherM[10], om11 = otherM[11];\r\n var om12 = otherM[12], om13 = otherM[13], om14 = otherM[14], om15 = otherM[15];\r\n result[offset] = tm0 * om0 + tm1 * om4 + tm2 * om8 + tm3 * om12;\r\n result[offset + 1] = tm0 * om1 + tm1 * om5 + tm2 * om9 + tm3 * om13;\r\n result[offset + 2] = tm0 * om2 + tm1 * om6 + tm2 * om10 + tm3 * om14;\r\n result[offset + 3] = tm0 * om3 + tm1 * om7 + tm2 * om11 + tm3 * om15;\r\n result[offset + 4] = tm4 * om0 + tm5 * om4 + tm6 * om8 + tm7 * om12;\r\n result[offset + 5] = tm4 * om1 + tm5 * om5 + tm6 * om9 + tm7 * om13;\r\n result[offset + 6] = tm4 * om2 + tm5 * om6 + tm6 * om10 + tm7 * om14;\r\n result[offset + 7] = tm4 * om3 + tm5 * om7 + tm6 * om11 + tm7 * om15;\r\n result[offset + 8] = tm8 * om0 + tm9 * om4 + tm10 * om8 + tm11 * om12;\r\n result[offset + 9] = tm8 * om1 + tm9 * om5 + tm10 * om9 + tm11 * om13;\r\n result[offset + 10] = tm8 * om2 + tm9 * om6 + tm10 * om10 + tm11 * om14;\r\n result[offset + 11] = tm8 * om3 + tm9 * om7 + tm10 * om11 + tm11 * om15;\r\n result[offset + 12] = tm12 * om0 + tm13 * om4 + tm14 * om8 + tm15 * om12;\r\n result[offset + 13] = tm12 * om1 + tm13 * om5 + tm14 * om9 + tm15 * om13;\r\n result[offset + 14] = tm12 * om2 + tm13 * om6 + tm14 * om10 + tm15 * om14;\r\n result[offset + 15] = tm12 * om3 + tm13 * om7 + tm14 * om11 + tm15 * om15;\r\n return this;\r\n };\r\n /**\r\n * Check equality between this matrix and a second one\r\n * @param value defines the second matrix to compare\r\n * @returns true is the current matrix and the given one values are strictly equal\r\n */\r\n Matrix.prototype.equals = function (value) {\r\n var other = value;\r\n if (!other) {\r\n return false;\r\n }\r\n if (this._isIdentity || other._isIdentity) {\r\n if (!this._isIdentityDirty && !other._isIdentityDirty) {\r\n return this._isIdentity && other._isIdentity;\r\n }\r\n }\r\n var m = this.m;\r\n var om = other.m;\r\n return (m[0] === om[0] && m[1] === om[1] && m[2] === om[2] && m[3] === om[3] &&\r\n m[4] === om[4] && m[5] === om[5] && m[6] === om[6] && m[7] === om[7] &&\r\n m[8] === om[8] && m[9] === om[9] && m[10] === om[10] && m[11] === om[11] &&\r\n m[12] === om[12] && m[13] === om[13] && m[14] === om[14] && m[15] === om[15]);\r\n };\r\n /**\r\n * Clone the current matrix\r\n * @returns a new matrix from the current matrix\r\n */\r\n Matrix.prototype.clone = function () {\r\n var matrix = new Matrix();\r\n matrix.copyFrom(this);\r\n return matrix;\r\n };\r\n /**\r\n * Returns the name of the current matrix class\r\n * @returns the string \"Matrix\"\r\n */\r\n Matrix.prototype.getClassName = function () {\r\n return \"Matrix\";\r\n };\r\n /**\r\n * Gets the hash code of the current matrix\r\n * @returns the hash code\r\n */\r\n Matrix.prototype.getHashCode = function () {\r\n var hash = this._m[0] | 0;\r\n for (var i = 1; i < 16; i++) {\r\n hash = (hash * 397) ^ (this._m[i] | 0);\r\n }\r\n return hash;\r\n };\r\n /**\r\n * Decomposes the current Matrix into a translation, rotation and scaling components\r\n * @param scale defines the scale vector3 given as a reference to update\r\n * @param rotation defines the rotation quaternion given as a reference to update\r\n * @param translation defines the translation vector3 given as a reference to update\r\n * @returns true if operation was successful\r\n */\r\n Matrix.prototype.decompose = function (scale, rotation, translation) {\r\n if (this._isIdentity) {\r\n if (translation) {\r\n translation.setAll(0);\r\n }\r\n if (scale) {\r\n scale.setAll(1);\r\n }\r\n if (rotation) {\r\n rotation.copyFromFloats(0, 0, 0, 1);\r\n }\r\n return true;\r\n }\r\n var m = this._m;\r\n if (translation) {\r\n translation.copyFromFloats(m[12], m[13], m[14]);\r\n }\r\n scale = scale || MathTmp.Vector3[0];\r\n scale.x = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);\r\n scale.y = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);\r\n scale.z = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);\r\n if (this.determinant() <= 0) {\r\n scale.y *= -1;\r\n }\r\n if (scale.x === 0 || scale.y === 0 || scale.z === 0) {\r\n if (rotation) {\r\n rotation.copyFromFloats(0.0, 0.0, 0.0, 1.0);\r\n }\r\n return false;\r\n }\r\n if (rotation) {\r\n var sx = 1 / scale.x, sy = 1 / scale.y, sz = 1 / scale.z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, MathTmp.Matrix[0]);\r\n Quaternion.FromRotationMatrixToRef(MathTmp.Matrix[0], rotation);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets specific row of the matrix\r\n * @param index defines the number of the row to get\r\n * @returns the index-th row of the current matrix as a new Vector4\r\n */\r\n Matrix.prototype.getRow = function (index) {\r\n if (index < 0 || index > 3) {\r\n return null;\r\n }\r\n var i = index * 4;\r\n return new Vector4(this._m[i + 0], this._m[i + 1], this._m[i + 2], this._m[i + 3]);\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix to the vector4 values\r\n * @param index defines the number of the row to set\r\n * @param row defines the target vector4\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRow = function (index, row) {\r\n return this.setRowFromFloats(index, row.x, row.y, row.z, row.w);\r\n };\r\n /**\r\n * Compute the transpose of the matrix\r\n * @returns the new transposed matrix\r\n */\r\n Matrix.prototype.transpose = function () {\r\n return Matrix.Transpose(this);\r\n };\r\n /**\r\n * Compute the transpose of the matrix and store it in a given matrix\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.transposeToRef = function (result) {\r\n Matrix.TransposeToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix with the given 4 x float values\r\n * @param index defines the row index\r\n * @param x defines the x component to set\r\n * @param y defines the y component to set\r\n * @param z defines the z component to set\r\n * @param w defines the w component to set\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {\r\n if (index < 0 || index > 3) {\r\n return this;\r\n }\r\n var i = index * 4;\r\n this._m[i + 0] = x;\r\n this._m[i + 1] = y;\r\n this._m[i + 2] = z;\r\n this._m[i + 3] = w;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Compute a new matrix set with the current matrix values multiplied by scale (float)\r\n * @param scale defines the scale factor\r\n * @returns a new matrix\r\n */\r\n Matrix.prototype.scale = function (scale) {\r\n var result = new Matrix();\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor to a given result matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor and add the result to a given matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the Matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleAndAddToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] += this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).\r\n * @param ref matrix to store the result\r\n */\r\n Matrix.prototype.toNormalMatrix = function (ref) {\r\n var tmp = MathTmp.Matrix[0];\r\n this.invertToRef(tmp);\r\n tmp.transposeToRef(ref);\r\n var m = ref._m;\r\n Matrix.FromValuesToRef(m[0], m[1], m[2], 0.0, m[4], m[5], m[6], 0.0, m[8], m[9], m[10], 0.0, 0.0, 0.0, 0.0, 1.0, ref);\r\n };\r\n /**\r\n * Gets only rotation part of the current matrix\r\n * @returns a new matrix sets to the extracted rotation matrix from the current one\r\n */\r\n Matrix.prototype.getRotationMatrix = function () {\r\n var result = new Matrix();\r\n this.getRotationMatrixToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Extracts the rotation matrix from the current one and sets it as the given \"result\"\r\n * @param result defines the target matrix to store data to\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getRotationMatrixToRef = function (result) {\r\n var scale = MathTmp.Vector3[0];\r\n if (!this.decompose(scale)) {\r\n Matrix.IdentityToRef(result);\r\n return this;\r\n }\r\n var m = this._m;\r\n var sx = 1 / scale.x, sy = 1 / scale.y, sz = 1 / scale.z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n return this;\r\n };\r\n /**\r\n * Toggles model matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleModelMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[2] *= -1;\r\n m[6] *= -1;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[14] *= -1;\r\n this._markAsUpdated();\r\n };\r\n /**\r\n * Toggles projection matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleProjectionMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[10] *= -1;\r\n m[11] *= -1;\r\n this._markAsUpdated();\r\n };\r\n // Statics\r\n /**\r\n * Creates a matrix from an array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Matrix set from the starting index of the given array\r\n */\r\n Matrix.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var result = new Matrix();\r\n Matrix.FromArrayToRef(array, offset, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the content of an array into a given matrix\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromArrayToRef = function (array, offset, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset];\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Stores an array into a matrix after having multiplied each component by a given factor\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param scale defines the scaling factor\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromFloat32ArrayToRefScaled = function (array, offset, scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset] * scale;\r\n }\r\n result._markAsUpdated();\r\n };\r\n Object.defineProperty(Matrix, \"IdentityReadOnly\", {\r\n /**\r\n * Gets an identity matrix that must not be updated\r\n */\r\n get: function () {\r\n return Matrix._identityReadOnly;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stores a list of values (16) inside a given matrix\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromValuesToRef = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44, result) {\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates new matrix from a list of values (16)\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @returns the new matrix\r\n */\r\n Matrix.FromValues = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44) {\r\n var result = new Matrix();\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @returns a new matrix\r\n */\r\n Matrix.Compose = function (scale, rotation, translation) {\r\n var result = new Matrix();\r\n Matrix.ComposeToRef(scale, rotation, translation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ComposeToRef = function (scale, rotation, translation, result) {\r\n var m = result._m;\r\n var x = rotation.x, y = rotation.y, z = rotation.z, w = rotation.w;\r\n var x2 = x + x, y2 = y + y, z2 = z + z;\r\n var xx = x * x2, xy = x * y2, xz = x * z2;\r\n var yy = y * y2, yz = y * z2, zz = z * z2;\r\n var wx = w * x2, wy = w * y2, wz = w * z2;\r\n var sx = scale.x, sy = scale.y, sz = scale.z;\r\n m[0] = (1 - (yy + zz)) * sx;\r\n m[1] = (xy + wz) * sx;\r\n m[2] = (xz - wy) * sx;\r\n m[3] = 0;\r\n m[4] = (xy - wz) * sy;\r\n m[5] = (1 - (xx + zz)) * sy;\r\n m[6] = (yz + wx) * sy;\r\n m[7] = 0;\r\n m[8] = (xz + wy) * sz;\r\n m[9] = (yz - wx) * sz;\r\n m[10] = (1 - (xx + yy)) * sz;\r\n m[11] = 0;\r\n m[12] = translation.x;\r\n m[13] = translation.y;\r\n m[14] = translation.z;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a new identity matrix\r\n * @returns a new identity matrix\r\n */\r\n Matrix.Identity = function () {\r\n var identity = Matrix.FromValues(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n identity._updateIdentityStatus(true);\r\n return identity;\r\n };\r\n /**\r\n * Creates a new identity matrix and stores the result in a given matrix\r\n * @param result defines the target matrix\r\n */\r\n Matrix.IdentityToRef = function (result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(true);\r\n };\r\n /**\r\n * Creates a new zero matrix\r\n * @returns a new zero matrix\r\n */\r\n Matrix.Zero = function () {\r\n var zero = Matrix.FromValues(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);\r\n zero._updateIdentityStatus(false);\r\n return zero;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationX = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationXToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix as the invert of a given matrix\r\n * @param source defines the source matrix\r\n * @returns the new matrix\r\n */\r\n Matrix.Invert = function (source) {\r\n var result = new Matrix();\r\n source.invertToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationXToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationY = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationYToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, 0.0, -s, 0.0, 0.0, 1.0, 0.0, 0.0, s, 0.0, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationZ = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationZToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationZToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationAxis = function (axis, angle) {\r\n var result = new Matrix();\r\n Matrix.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis and stores it in a given matrix\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAxisToRef = function (axis, angle, result) {\r\n var s = Math.sin(-angle);\r\n var c = Math.cos(-angle);\r\n var c1 = 1 - c;\r\n axis.normalize();\r\n var m = result._m;\r\n m[0] = (axis.x * axis.x) * c1 + c;\r\n m[1] = (axis.x * axis.y) * c1 - (axis.z * s);\r\n m[2] = (axis.x * axis.z) * c1 + (axis.y * s);\r\n m[3] = 0.0;\r\n m[4] = (axis.y * axis.x) * c1 + (axis.z * s);\r\n m[5] = (axis.y * axis.y) * c1 + c;\r\n m[6] = (axis.y * axis.z) * c1 - (axis.x * s);\r\n m[7] = 0.0;\r\n m[8] = (axis.z * axis.x) * c1 - (axis.y * s);\r\n m[9] = (axis.z * axis.y) * c1 + (axis.x * s);\r\n m[10] = (axis.z * axis.z) * c1 + c;\r\n m[11] = 0.0;\r\n m[12] = 0.0;\r\n m[13] = 0.0;\r\n m[14] = 0.0;\r\n m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Takes normalised vectors and returns a rotation matrix to align \"from\" with \"to\".\r\n * Taken from http://www.iquilezles.org/www/articles/noacos/noacos.htm\r\n * @param from defines the vector to align\r\n * @param to defines the vector to align to\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAlignToRef = function (from, to, result) {\r\n var v = Vector3.Cross(to, from);\r\n var c = Vector3.Dot(to, from);\r\n var k = 1 / (1 + c);\r\n var m = result._m;\r\n m[0] = v.x * v.x * k + c;\r\n m[1] = v.y * v.x * k - v.z;\r\n m[2] = v.z * v.x * k + v.y;\r\n m[3] = 0;\r\n m[4] = v.x * v.y * k + v.z;\r\n m[5] = v.y * v.y * k + c;\r\n m[6] = v.z * v.y * k - v.x;\r\n m[7] = 0;\r\n m[8] = v.x * v.z * k - v.y;\r\n m[9] = v.y * v.z * k + v.x;\r\n m[10] = v.z * v.z * k + c;\r\n m[11] = 0;\r\n m[12] = 0;\r\n m[13] = 0;\r\n m[14] = 0;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a rotation matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (X axis)\r\n * @returns the new rotation matrix\r\n */\r\n Matrix.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var result = new Matrix();\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a rotation matrix and stores it in a given matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (X axis)\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);\r\n MathTmp.Quaternion[0].toRotationMatrix(result);\r\n };\r\n /**\r\n * Creates a scaling matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Scaling = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.ScalingToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a scaling matrix and stores it in a given matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ScalingToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(x, 0.0, 0.0, 0.0, 0.0, y, 0.0, 0.0, 0.0, 0.0, z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(x === 1 && y === 1 && z === 1);\r\n };\r\n /**\r\n * Creates a translation matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Translation = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.TranslationToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a translation matrix and stores it in a given matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TranslationToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0, result);\r\n result._updateIdentityStatus(x === 0 && y === 0 && z === 0);\r\n };\r\n /**\r\n * Returns a new Matrix whose values are the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @returns the new matrix\r\n */\r\n Matrix.Lerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given matrix \"result\" as the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @param result defines the Matrix object where to store data\r\n */\r\n Matrix.LerpToRef = function (startValue, endValue, gradient, result) {\r\n var resultM = result._m;\r\n var startM = startValue.m;\r\n var endM = endValue.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Builds a new matrix whose values are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @returns the new matrix\r\n */\r\n Matrix.DecomposeLerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Update a matrix to values which are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @param result defines the target matrix\r\n */\r\n Matrix.DecomposeLerpToRef = function (startValue, endValue, gradient, result) {\r\n var startScale = MathTmp.Vector3[0];\r\n var startRotation = MathTmp.Quaternion[0];\r\n var startTranslation = MathTmp.Vector3[1];\r\n startValue.decompose(startScale, startRotation, startTranslation);\r\n var endScale = MathTmp.Vector3[2];\r\n var endRotation = MathTmp.Quaternion[1];\r\n var endTranslation = MathTmp.Vector3[3];\r\n endValue.decompose(endScale, endRotation, endTranslation);\r\n var resultScale = MathTmp.Vector3[4];\r\n Vector3.LerpToRef(startScale, endScale, gradient, resultScale);\r\n var resultRotation = MathTmp.Quaternion[2];\r\n Quaternion.SlerpToRef(startRotation, endRotation, gradient, resultRotation);\r\n var resultTranslation = MathTmp.Vector3[5];\r\n Vector3.LerpToRef(startTranslation, endTranslation, gradient, resultTranslation);\r\n Matrix.ComposeToRef(resultScale, resultRotation, resultTranslation, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtLH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtLHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtLHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n target.subtractToRef(eye, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis.x, yAxis.x, zAxis.x, 0.0, xAxis.y, yAxis.y, zAxis.y, 0.0, xAxis.z, yAxis.z, zAxis.z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtRH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtRHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtRHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n eye.subtractToRef(target, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis.x, yAxis.x, zAxis.x, 0.0, xAxis.y, yAxis.y, zAxis.y, 0.0, xAxis.z, yAxis.z, zAxis.z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoLHToRef(width, height, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Store a left-handed orthographic projection to a given matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoLHToRef = function (width, height, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / width;\r\n var b = 2.0 / height;\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, 0.0, 0.0, d, 1.0, result);\r\n result._updateIdentityStatus(a === 1 && b === 1 && c === 1 && d === 0);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterLH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterLHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / (right - left);\r\n var b = 2.0 / (top - bottom);\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n var i0 = (left + right) / (left - right);\r\n var i1 = (top + bottom) / (bottom - top);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, i0, i1, d, 1.0, result);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a right-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterRH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterRHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterRHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, result);\r\n result._m[10] *= -1; // No need to call _markAsUpdated as previous function already called it and let _isIdentityDirty to true\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 * n / width;\r\n var b = 2.0 * n / height;\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, matrix);\r\n matrix._updateIdentityStatus(false);\r\n return matrix;\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovLH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovLHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovLHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Creates a right-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovRH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovRHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovRHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n //alternatively this could be expressed as:\r\n // m = PerspectiveFovLHToRef\r\n // m[10] *= -1.0;\r\n // m[11] *= -1.0;\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = -(f + n) / (f - n);\r\n var d = -2 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, -1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a perspective projection for WebVR info a given matrix\r\n * @param fov defines the field of view\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param rightHanded defines if the matrix must be in right-handed mode (false by default)\r\n */\r\n Matrix.PerspectiveFovWebVRToRef = function (fov, znear, zfar, result, rightHanded) {\r\n if (rightHanded === void 0) { rightHanded = false; }\r\n var rightHandedFactor = rightHanded ? -1 : 1;\r\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\r\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\r\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\r\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\r\n var xScale = 2.0 / (leftTan + rightTan);\r\n var yScale = 2.0 / (upTan + downTan);\r\n var m = result._m;\r\n m[0] = xScale;\r\n m[1] = m[2] = m[3] = m[4] = 0.0;\r\n m[5] = yScale;\r\n m[6] = m[7] = 0.0;\r\n m[8] = ((leftTan - rightTan) * xScale * 0.5);\r\n m[9] = -((upTan - downTan) * yScale * 0.5);\r\n m[10] = -zfar / (znear - zfar);\r\n m[11] = 1.0 * rightHandedFactor;\r\n m[12] = m[13] = m[15] = 0.0;\r\n m[14] = -(2.0 * zfar * znear) / (zfar - znear);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Computes a complete transformation matrix\r\n * @param viewport defines the viewport to use\r\n * @param world defines the world matrix\r\n * @param view defines the view matrix\r\n * @param projection defines the projection matrix\r\n * @param zmin defines the near clip plane\r\n * @param zmax defines the far clip plane\r\n * @returns the transformation matrix\r\n */\r\n Matrix.GetFinalMatrix = function (viewport, world, view, projection, zmin, zmax) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = Matrix.FromValues(cw / 2.0, 0.0, 0.0, 0.0, 0.0, -ch / 2.0, 0.0, 0.0, 0.0, 0.0, zmax - zmin, 0.0, cx + cw / 2.0, ch / 2.0 + cy, zmin, 1.0);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n return matrix.multiply(viewportMatrix);\r\n };\r\n /**\r\n * Extracts a 2x2 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix2x2 = function (matrix) {\r\n var m = matrix.m;\r\n return new Float32Array([m[0], m[1], m[4], m[5]]);\r\n };\r\n /**\r\n * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix3x3 = function (matrix) {\r\n var m = matrix.m;\r\n return new Float32Array([\r\n m[0], m[1], m[2],\r\n m[4], m[5], m[6],\r\n m[8], m[9], m[10]\r\n ]);\r\n };\r\n /**\r\n * Compute the transpose of a given matrix\r\n * @param matrix defines the matrix to transpose\r\n * @returns the new matrix\r\n */\r\n Matrix.Transpose = function (matrix) {\r\n var result = new Matrix();\r\n Matrix.TransposeToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Compute the transpose of a matrix and store it in a target matrix\r\n * @param matrix defines the matrix to transpose\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TransposeToRef = function (matrix, result) {\r\n var rm = result._m;\r\n var mm = matrix.m;\r\n rm[0] = mm[0];\r\n rm[1] = mm[4];\r\n rm[2] = mm[8];\r\n rm[3] = mm[12];\r\n rm[4] = mm[1];\r\n rm[5] = mm[5];\r\n rm[6] = mm[9];\r\n rm[7] = mm[13];\r\n rm[8] = mm[2];\r\n rm[9] = mm[6];\r\n rm[10] = mm[10];\r\n rm[11] = mm[14];\r\n rm[12] = mm[3];\r\n rm[13] = mm[7];\r\n rm[14] = mm[11];\r\n rm[15] = mm[15];\r\n // identity-ness does not change when transposing\r\n result._updateIdentityStatus(matrix._isIdentity, matrix._isIdentityDirty);\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @returns a new matrix\r\n */\r\n Matrix.Reflection = function (plane) {\r\n var matrix = new Matrix();\r\n Matrix.ReflectionToRef(plane, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ReflectionToRef = function (plane, result) {\r\n plane.normalize();\r\n var x = plane.normal.x;\r\n var y = plane.normal.y;\r\n var z = plane.normal.z;\r\n var temp = -2 * x;\r\n var temp2 = -2 * y;\r\n var temp3 = -2 * z;\r\n Matrix.FromValuesToRef(temp * x + 1, temp2 * x, temp3 * x, 0.0, temp * y, temp2 * y + 1, temp3 * y, 0.0, temp * z, temp2 * z, temp3 * z + 1, 0.0, temp * plane.d, temp2 * plane.d, temp3 * plane.d, 1.0, result);\r\n };\r\n /**\r\n * Sets the given matrix as a rotation matrix composed from the 3 left handed axes\r\n * @param xaxis defines the value of the 1st axis\r\n * @param yaxis defines the value of the 2nd axis\r\n * @param zaxis defines the value of the 3rd axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromXYZAxesToRef = function (xaxis, yaxis, zaxis, result) {\r\n Matrix.FromValuesToRef(xaxis.x, xaxis.y, xaxis.z, 0.0, yaxis.x, yaxis.y, yaxis.z, 0.0, zaxis.x, zaxis.y, zaxis.z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n };\r\n /**\r\n * Creates a rotation matrix from a quaternion and stores it in a target matrix\r\n * @param quat defines the quaternion to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromQuaternionToRef = function (quat, result) {\r\n var xx = quat.x * quat.x;\r\n var yy = quat.y * quat.y;\r\n var zz = quat.z * quat.z;\r\n var xy = quat.x * quat.y;\r\n var zw = quat.z * quat.w;\r\n var zx = quat.z * quat.x;\r\n var yw = quat.y * quat.w;\r\n var yz = quat.y * quat.z;\r\n var xw = quat.x * quat.w;\r\n result._m[0] = 1.0 - (2.0 * (yy + zz));\r\n result._m[1] = 2.0 * (xy + zw);\r\n result._m[2] = 2.0 * (zx - yw);\r\n result._m[3] = 0.0;\r\n result._m[4] = 2.0 * (xy - zw);\r\n result._m[5] = 1.0 - (2.0 * (zz + xx));\r\n result._m[6] = 2.0 * (yz + xw);\r\n result._m[7] = 0.0;\r\n result._m[8] = 2.0 * (zx + yw);\r\n result._m[9] = 2.0 * (yz - xw);\r\n result._m[10] = 1.0 - (2.0 * (yy + xx));\r\n result._m[11] = 0.0;\r\n result._m[12] = 0.0;\r\n result._m[13] = 0.0;\r\n result._m[14] = 0.0;\r\n result._m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n Matrix._updateFlagSeed = 0;\r\n Matrix._identityReadOnly = Matrix.Identity();\r\n return Matrix;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n * Same as Tmp but not exported to keep it only for math functions to avoid conflicts\r\n */\r\nvar MathTmp = /** @class */ (function () {\r\n function MathTmp() {\r\n }\r\n MathTmp.Vector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(6, Vector3.Zero);\r\n MathTmp.Matrix = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(2, Matrix.Identity);\r\n MathTmp.Quaternion = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Quaternion.Zero);\r\n return MathTmp;\r\n}());\r\n/**\r\n * @hidden\r\n */\r\nvar TmpVectors = /** @class */ (function () {\r\n function TmpVectors() {\r\n }\r\n TmpVectors.Vector2 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Vector2.Zero); // 3 temp Vector2 at once should be enough\r\n TmpVectors.Vector3 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(13, Vector3.Zero); // 13 temp Vector3 at once should be enough\r\n TmpVectors.Vector4 = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(3, Vector4.Zero); // 3 temp Vector4 at once should be enough\r\n TmpVectors.Quaternion = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(2, Quaternion.Zero); // 2 temp Quaternion at once should be enough\r\n TmpVectors.Matrix = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_2__[\"ArrayTools\"].BuildArray(8, Matrix.Identity); // 8 temp Matrices at once should be enough\r\n return TmpVectors;\r\n}());\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Vector2\"] = Vector2;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Vector3\"] = Vector3;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Vector4\"] = Vector4;\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_3__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.Matrix\"] = Matrix;\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.vertexFormat.ts\":\n/*!************************************!*\\\n !*** ./Maths/math.vertexFormat.ts ***!\n \\************************************/\n/*! exports provided: PositionNormalVertex, PositionNormalTextureVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return PositionNormalVertex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return PositionNormalTextureVertex; });\n/* harmony import */ var _math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Contains position and normal vectors for a vertex\r\n */\r\nvar PositionNormalVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n */\r\n function PositionNormalVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal) {\r\n if (position === void 0) { position = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n if (normal === void 0) { normal = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(); }\r\n this.position = position;\r\n this.normal = normal;\r\n }\r\n /**\r\n * Clones the PositionNormalVertex\r\n * @returns the cloned PositionNormalVertex\r\n */\r\n PositionNormalVertex.prototype.clone = function () {\r\n return new PositionNormalVertex(this.position.clone(), this.normal.clone());\r\n };\r\n return PositionNormalVertex;\r\n}());\r\n\r\n/**\r\n * Contains position, normal and uv vectors for a vertex\r\n */\r\nvar PositionNormalTextureVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalTextureVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n * @param uv the uv of the vertex (default: 0,0)\r\n */\r\n function PositionNormalTextureVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal, \r\n /** the uv of the vertex (default: 0,0) */\r\n uv) {\r\n if (position === void 0) { position = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n if (normal === void 0) { normal = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(); }\r\n if (uv === void 0) { uv = _math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero(); }\r\n this.position = position;\r\n this.normal = normal;\r\n this.uv = uv;\r\n }\r\n /**\r\n * Clones the PositionNormalTextureVertex\r\n * @returns the cloned PositionNormalTextureVertex\r\n */\r\n PositionNormalTextureVertex.prototype.clone = function () {\r\n return new PositionNormalTextureVertex(this.position.clone(), this.normal.clone(), this.uv.clone());\r\n };\r\n return PositionNormalTextureVertex;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/math.viewport.ts\":\n/*!********************************!*\\\n !*** ./Maths/math.viewport.ts ***!\n \\********************************/\n/*! exports provided: Viewport */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return Viewport; });\n/**\r\n * Class used to represent a viewport on screen\r\n */\r\nvar Viewport = /** @class */ (function () {\r\n /**\r\n * Creates a Viewport object located at (x, y) and sized (width, height)\r\n * @param x defines viewport left coordinate\r\n * @param y defines viewport top coordinate\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n */\r\n function Viewport(\r\n /** viewport left coordinate */\r\n x, \r\n /** viewport top coordinate */\r\n y, \r\n /**viewport width */\r\n width, \r\n /** viewport height */\r\n height) {\r\n this.x = x;\r\n this.y = y;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.toGlobal = function (renderWidth, renderHeight) {\r\n return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);\r\n };\r\n /**\r\n * Stores absolute viewport value into a target viewport (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @param ref defines the target viewport\r\n * @returns the current viewport\r\n */\r\n Viewport.prototype.toGlobalToRef = function (renderWidth, renderHeight, ref) {\r\n ref.x = this.x * renderWidth;\r\n ref.y = this.y * renderHeight;\r\n ref.width = this.width * renderWidth;\r\n ref.height = this.height * renderHeight;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Viewport copied from the current one\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.clone = function () {\r\n return new Viewport(this.x, this.y, this.width, this.height);\r\n };\r\n return Viewport;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Maths/sphericalPolynomial.ts\":\n/*!**************************************!*\\\n !*** ./Maths/sphericalPolynomial.ts ***!\n \\**************************************/\n/*! exports provided: SphericalHarmonics, SphericalPolynomial */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return SphericalHarmonics; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return SphericalPolynomial; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n// https://dickyjim.wordpress.com/2013/09/04/spherical-harmonics-for-beginners/\r\n// http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf\r\n// https://www.ppsloan.org/publications/StupidSH36.pdf\r\n// http://cseweb.ucsd.edu/~ravir/papers/envmap/envmap.pdf\r\n// https://www.ppsloan.org/publications/SHJCGT.pdf\r\n// https://www.ppsloan.org/publications/shdering.pdf\r\n// https://google.github.io/filament/Filament.md.html#annex/sphericalharmonics\r\n// https://patapom.com/blog/SHPortal/\r\n// https://imdoingitwrong.wordpress.com/2011/04/14/spherical-harmonics-wtf/\r\n// Using real SH basis:\r\n// m>0 m m\r\n// y = sqrt(2) * K * P * cos(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m<0 m |m|\r\n// y = sqrt(2) * K * P * sin(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m=0 0 0\r\n// y = K * P * trigono terms\r\n// l l l\r\n//\r\n// m (2l + 1)(l - |m|)!\r\n// K = sqrt(------------------)\r\n// l 4pi(l + |m|)!\r\n//\r\n// and P by recursion:\r\n//\r\n// P00(x) = 1\r\n// P01(x) = x\r\n// Pll(x) = (-1^l)(2l - 1)!!(1-x*x)^(1/2)\r\n// ((2l - 1)x[Pl-1/m]-(l + m - 1)[Pl-2/m])\r\n// Plm(x) = ---------------------------------------\r\n// l - m\r\n// Leaving the trigonometric terms aside we can precompute the constants to :\r\nvar SH3ylmBasisConstants = [\r\n Math.sqrt(1 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(3 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(15 / (4 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(5 / (16 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(15 / (16 * Math.PI)),\r\n];\r\n// cm = cos(m * phi)\r\n// sm = sin(m * phi)\r\n// {x,y,z} = {cos(phi)sin(theta), sin(phi)sin(theta), cos(theta)}\r\n// By recursion on using trigo identities:\r\nvar SH3ylmBasisTrigonometricTerms = [\r\n function (direction) { return 1; },\r\n function (direction) { return direction.y; },\r\n function (direction) { return direction.z; },\r\n function (direction) { return direction.x; },\r\n function (direction) { return direction.x * direction.y; },\r\n function (direction) { return direction.y * direction.z; },\r\n function (direction) { return 3 * direction.z * direction.z - 1; },\r\n function (direction) { return direction.x * direction.z; },\r\n function (direction) { return direction.x * direction.x - direction.y * direction.y; },\r\n];\r\n// Wrap the full compute\r\nvar applySH3 = function (lm, direction) {\r\n return SH3ylmBasisConstants[lm] * SH3ylmBasisTrigonometricTerms[lm](direction);\r\n};\r\n// Derived from the integration of the a kernel convolution to SH.\r\n// Great explanation here: https://patapom.com/blog/SHPortal/#about-distant-radiance-and-irradiance-environments\r\nvar SHCosKernelConvolution = [\r\n Math.PI,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n];\r\n/**\r\n * Class representing spherical harmonics coefficients to the 3rd degree\r\n */\r\nvar SphericalHarmonics = /** @class */ (function () {\r\n function SphericalHarmonics() {\r\n /**\r\n * Defines whether or not the harmonics have been prescaled for rendering.\r\n */\r\n this.preScaled = false;\r\n /**\r\n * The l0,0 coefficients of the spherical harmonics\r\n */\r\n this.l00 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l1,-1 coefficients of the spherical harmonics\r\n */\r\n this.l1_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l1,0 coefficients of the spherical harmonics\r\n */\r\n this.l10 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l1,1 coefficients of the spherical harmonics\r\n */\r\n this.l11 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,-2 coefficients of the spherical harmonics\r\n */\r\n this.l2_2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,-1 coefficients of the spherical harmonics\r\n */\r\n this.l2_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,0 coefficients of the spherical harmonics\r\n */\r\n this.l20 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,1 coefficients of the spherical harmonics\r\n */\r\n this.l21 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The l2,2 coefficients of the spherical harmonics\r\n */\r\n this.l22 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n /**\r\n * Adds a light to the spherical harmonics\r\n * @param direction the direction of the light\r\n * @param color the color of the light\r\n * @param deltaSolidAngle the delta solid angle of the light\r\n */\r\n SphericalHarmonics.prototype.addLight = function (direction, color, deltaSolidAngle) {\r\n var colorVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](color.r, color.g, color.b);\r\n var c = colorVector.scale(deltaSolidAngle);\r\n this.l00 = this.l00.add(c.scale(applySH3(0, direction)));\r\n this.l1_1 = this.l1_1.add(c.scale(applySH3(1, direction)));\r\n this.l10 = this.l10.add(c.scale(applySH3(2, direction)));\r\n this.l11 = this.l11.add(c.scale(applySH3(3, direction)));\r\n this.l2_2 = this.l2_2.add(c.scale(applySH3(4, direction)));\r\n this.l2_1 = this.l2_1.add(c.scale(applySH3(5, direction)));\r\n this.l20 = this.l20.add(c.scale(applySH3(6, direction)));\r\n this.l21 = this.l21.add(c.scale(applySH3(7, direction)));\r\n this.l22 = this.l22.add(c.scale(applySH3(8, direction)));\r\n };\r\n /**\r\n * Scales the spherical harmonics by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalHarmonics.prototype.scaleInPlace = function (scale) {\r\n this.l00.scaleInPlace(scale);\r\n this.l1_1.scaleInPlace(scale);\r\n this.l10.scaleInPlace(scale);\r\n this.l11.scaleInPlace(scale);\r\n this.l2_2.scaleInPlace(scale);\r\n this.l2_1.scaleInPlace(scale);\r\n this.l20.scaleInPlace(scale);\r\n this.l21.scaleInPlace(scale);\r\n this.l22.scaleInPlace(scale);\r\n };\r\n /**\r\n * Convert from incident radiance (Li) to irradiance (E) by applying convolution with the cosine-weighted hemisphere.\r\n *\r\n * ```\r\n * E_lm = A_l * L_lm\r\n * ```\r\n *\r\n * In spherical harmonics this convolution amounts to scaling factors for each frequency band.\r\n * This corresponds to equation 5 in \"An Efficient Representation for Irradiance Environment Maps\", where\r\n * the scaling factors are given in equation 9.\r\n */\r\n SphericalHarmonics.prototype.convertIncidentRadianceToIrradiance = function () {\r\n // Constant (Band 0)\r\n this.l00.scaleInPlace(SHCosKernelConvolution[0]);\r\n // Linear (Band 1)\r\n this.l1_1.scaleInPlace(SHCosKernelConvolution[1]);\r\n this.l10.scaleInPlace(SHCosKernelConvolution[2]);\r\n this.l11.scaleInPlace(SHCosKernelConvolution[3]);\r\n // Quadratic (Band 2)\r\n this.l2_2.scaleInPlace(SHCosKernelConvolution[4]);\r\n this.l2_1.scaleInPlace(SHCosKernelConvolution[5]);\r\n this.l20.scaleInPlace(SHCosKernelConvolution[6]);\r\n this.l21.scaleInPlace(SHCosKernelConvolution[7]);\r\n this.l22.scaleInPlace(SHCosKernelConvolution[8]);\r\n };\r\n /**\r\n * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.\r\n *\r\n * ```\r\n * L = (1/pi) * E * rho\r\n * ```\r\n *\r\n * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.\r\n */\r\n SphericalHarmonics.prototype.convertIrradianceToLambertianRadiance = function () {\r\n this.scaleInPlace(1.0 / Math.PI);\r\n // The resultant SH now represents outgoing radiance, so includes the Lambert 1/pi normalisation factor but without albedo (rho) applied\r\n // (The pixel shader must apply albedo after texture fetches, etc).\r\n };\r\n /**\r\n * Integrates the reconstruction coefficients directly in to the SH preventing further\r\n * required operations at run time.\r\n *\r\n * This is simply done by scaling back the SH with Ylm constants parameter.\r\n * The trigonometric part being applied by the shader at run time.\r\n */\r\n SphericalHarmonics.prototype.preScaleForRendering = function () {\r\n this.preScaled = true;\r\n this.l00.scaleInPlace(SH3ylmBasisConstants[0]);\r\n this.l1_1.scaleInPlace(SH3ylmBasisConstants[1]);\r\n this.l10.scaleInPlace(SH3ylmBasisConstants[2]);\r\n this.l11.scaleInPlace(SH3ylmBasisConstants[3]);\r\n this.l2_2.scaleInPlace(SH3ylmBasisConstants[4]);\r\n this.l2_1.scaleInPlace(SH3ylmBasisConstants[5]);\r\n this.l20.scaleInPlace(SH3ylmBasisConstants[6]);\r\n this.l21.scaleInPlace(SH3ylmBasisConstants[7]);\r\n this.l22.scaleInPlace(SH3ylmBasisConstants[8]);\r\n };\r\n /**\r\n * Constructs a spherical harmonics from an array.\r\n * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromArray = function (data) {\r\n var sh = new SphericalHarmonics();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[0], 0, sh.l00);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[1], 0, sh.l1_1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[2], 0, sh.l10);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[3], 0, sh.l11);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[4], 0, sh.l2_2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[5], 0, sh.l2_1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[6], 0, sh.l20);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[7], 0, sh.l21);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[8], 0, sh.l22);\r\n return sh;\r\n };\r\n // Keep for references.\r\n /**\r\n * Gets the spherical harmonics from polynomial\r\n * @param polynomial the spherical polynomial\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromPolynomial = function (polynomial) {\r\n var result = new SphericalHarmonics();\r\n result.l00 = polynomial.xx.scale(0.376127).add(polynomial.yy.scale(0.376127)).add(polynomial.zz.scale(0.376126));\r\n result.l1_1 = polynomial.y.scale(0.977204);\r\n result.l10 = polynomial.z.scale(0.977204);\r\n result.l11 = polynomial.x.scale(0.977204);\r\n result.l2_2 = polynomial.xy.scale(1.16538);\r\n result.l2_1 = polynomial.yz.scale(1.16538);\r\n result.l20 = polynomial.zz.scale(1.34567).subtract(polynomial.xx.scale(0.672834)).subtract(polynomial.yy.scale(0.672834));\r\n result.l21 = polynomial.zx.scale(1.16538);\r\n result.l22 = polynomial.xx.scale(1.16538).subtract(polynomial.yy.scale(1.16538));\r\n result.l1_1.scaleInPlace(-1);\r\n result.l11.scaleInPlace(-1);\r\n result.l2_1.scaleInPlace(-1);\r\n result.l21.scaleInPlace(-1);\r\n result.scaleInPlace(Math.PI);\r\n return result;\r\n };\r\n return SphericalHarmonics;\r\n}());\r\n\r\n/**\r\n * Class representing spherical polynomial coefficients to the 3rd degree\r\n */\r\nvar SphericalPolynomial = /** @class */ (function () {\r\n function SphericalPolynomial() {\r\n /**\r\n * The x coefficients of the spherical polynomial\r\n */\r\n this.x = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The y coefficients of the spherical polynomial\r\n */\r\n this.y = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The z coefficients of the spherical polynomial\r\n */\r\n this.z = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The xx coefficients of the spherical polynomial\r\n */\r\n this.xx = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The yy coefficients of the spherical polynomial\r\n */\r\n this.yy = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The zz coefficients of the spherical polynomial\r\n */\r\n this.zz = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The xy coefficients of the spherical polynomial\r\n */\r\n this.xy = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The yz coefficients of the spherical polynomial\r\n */\r\n this.yz = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The zx coefficients of the spherical polynomial\r\n */\r\n this.zx = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n Object.defineProperty(SphericalPolynomial.prototype, \"preScaledHarmonics\", {\r\n /**\r\n * The spherical harmonics used to create the polynomials.\r\n */\r\n get: function () {\r\n if (!this._harmonics) {\r\n this._harmonics = SphericalHarmonics.FromPolynomial(this);\r\n }\r\n if (!this._harmonics.preScaled) {\r\n this._harmonics.preScaleForRendering();\r\n }\r\n return this._harmonics;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds an ambient color to the spherical polynomial\r\n * @param color the color to add\r\n */\r\n SphericalPolynomial.prototype.addAmbient = function (color) {\r\n var colorVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](color.r, color.g, color.b);\r\n this.xx = this.xx.add(colorVector);\r\n this.yy = this.yy.add(colorVector);\r\n this.zz = this.zz.add(colorVector);\r\n };\r\n /**\r\n * Scales the spherical polynomial by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalPolynomial.prototype.scaleInPlace = function (scale) {\r\n this.x.scaleInPlace(scale);\r\n this.y.scaleInPlace(scale);\r\n this.z.scaleInPlace(scale);\r\n this.xx.scaleInPlace(scale);\r\n this.yy.scaleInPlace(scale);\r\n this.zz.scaleInPlace(scale);\r\n this.yz.scaleInPlace(scale);\r\n this.zx.scaleInPlace(scale);\r\n this.xy.scaleInPlace(scale);\r\n };\r\n /**\r\n * Gets the spherical polynomial from harmonics\r\n * @param harmonics the spherical harmonics\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromHarmonics = function (harmonics) {\r\n var result = new SphericalPolynomial();\r\n result._harmonics = harmonics;\r\n result.x = harmonics.l11.scale(1.02333).scale(-1);\r\n result.y = harmonics.l1_1.scale(1.02333).scale(-1);\r\n result.z = harmonics.l10.scale(1.02333);\r\n result.xx = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).add(harmonics.l22.scale(0.429043));\r\n result.yy = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).subtract(harmonics.l22.scale(0.429043));\r\n result.zz = harmonics.l00.scale(0.886277).add(harmonics.l20.scale(0.495417));\r\n result.yz = harmonics.l2_1.scale(0.858086).scale(-1);\r\n result.zx = harmonics.l21.scale(0.858086).scale(-1);\r\n result.xy = harmonics.l2_2.scale(0.858086);\r\n result.scaleInPlace(1.0 / Math.PI);\r\n return result;\r\n };\r\n /**\r\n * Constructs a spherical polynomial from an array.\r\n * @param data defines the 9x3 coefficients (x, y, z, xx, yy, zz, yz, zx, xy)\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromArray = function (data) {\r\n var sp = new SphericalPolynomial();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[0], 0, sp.x);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[1], 0, sp.y);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[2], 0, sp.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[3], 0, sp.xx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[4], 0, sp.yy);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[5], 0, sp.zz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[6], 0, sp.yz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[7], 0, sp.zx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(data[8], 0, sp.xy);\r\n return sp;\r\n };\r\n return SphericalPolynomial;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/boxBuilder.ts\":\n/*!***************************************!*\\\n !*** ./Meshes/Builders/boxBuilder.ts ***!\n \\***************************************/\n/*! exports provided: BoxBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return BoxBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateBox = function (options) {\r\n var nbFaces = 6;\r\n var indices = [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];\r\n var normals = [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];\r\n var uvs = [];\r\n var positions = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var wrap = options.wrap || false;\r\n var topBaseAt = (options.topBaseAt === void 0) ? 1 : options.topBaseAt;\r\n var bottomBaseAt = (options.bottomBaseAt === void 0) ? 0 : options.bottomBaseAt;\r\n topBaseAt = (topBaseAt + 4) % 4; // places values as 0 to 3\r\n bottomBaseAt = (bottomBaseAt + 4) % 4; // places values as 0 to 3\r\n var topOrder = [2, 0, 3, 1];\r\n var bottomOrder = [2, 0, 1, 3];\r\n var topIndex = topOrder[topBaseAt];\r\n var bottomIndex = bottomOrder[bottomBaseAt];\r\n var basePositions = [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];\r\n if (wrap) {\r\n indices = [2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, 14, 15, 12, 13, 14];\r\n basePositions = [-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];\r\n var topFaceBase = [[1, 1, 1], [-1, 1, 1], [-1, 1, -1], [1, 1, -1]];\r\n var bottomFaceBase = [[-1, -1, 1], [1, -1, 1], [1, -1, -1], [-1, -1, -1]];\r\n var topFaceOrder = [17, 18, 19, 16];\r\n var bottomFaceOrder = [22, 23, 20, 21];\r\n while (topIndex > 0) {\r\n topFaceBase.unshift(topFaceBase.pop());\r\n topFaceOrder.unshift(topFaceOrder.pop());\r\n topIndex--;\r\n }\r\n while (bottomIndex > 0) {\r\n bottomFaceBase.unshift(bottomFaceBase.pop());\r\n bottomFaceOrder.unshift(bottomFaceOrder.pop());\r\n bottomIndex--;\r\n }\r\n topFaceBase = topFaceBase.flat();\r\n bottomFaceBase = bottomFaceBase.flat();\r\n basePositions = basePositions.concat(topFaceBase).concat(bottomFaceBase);\r\n indices.push(topFaceOrder[0], topFaceOrder[2], topFaceOrder[3], topFaceOrder[0], topFaceOrder[1], topFaceOrder[2]);\r\n indices.push(bottomFaceOrder[0], bottomFaceOrder[2], bottomFaceOrder[3], bottomFaceOrder[0], bottomFaceOrder[1], bottomFaceOrder[2]);\r\n }\r\n var scaleArray = [width / 2, height / 2, depth / 2];\r\n positions = basePositions.reduce(function (accumulator, currentValue, currentIndex) { return accumulator.concat(currentValue * scaleArray[currentIndex % 3]); }, []);\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(6);\r\n var faceColors = options.faceColors;\r\n var colors = [];\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < 6; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n // Create each face in turn.\r\n for (var index = 0; index < nbFaces; index++) {\r\n uvs.push(faceUV[index].z, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].y);\r\n uvs.push(faceUV[index].z, faceUV[index].y);\r\n if (faceColors) {\r\n for (var c = 0; c < 4; c++) {\r\n colors.push(faceColors[index].r, faceColors[index].g, faceColors[index].b, faceColors[index].a);\r\n }\r\n }\r\n }\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n size: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return BoxBuilder.CreateBox(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar BoxBuilder = /** @class */ (function () {\r\n function BoxBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * * The parameter `size` sets the size (float) of each box side (default 1)\r\n * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n BoxBuilder.CreateBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var box = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateBox(options);\r\n vertexData.applyToMesh(box, options.updatable);\r\n return box;\r\n };\r\n return BoxBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/cylinderBuilder.ts\":\n/*!********************************************!*\\\n !*** ./Meshes/Builders/cylinderBuilder.ts ***!\n \\********************************************/\n/*! exports provided: CylinderBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return CylinderBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateCylinder = function (options) {\r\n var height = options.height || 2;\r\n var diameterTop = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation = options.tessellation || 24;\r\n var subdivisions = options.subdivisions || 1;\r\n var hasRings = options.hasRings ? true : false;\r\n var enclose = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_ALL;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb = (hasRings) ? subdivisions : 1;\r\n var surfaceNb = 2 + (1 + quadNb) * ringNb;\r\n var f;\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n }\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle;\r\n var h;\r\n var radius;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var ringNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var ringFirstVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var ringFirstNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var quadNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var Y = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Axis\"].Y;\r\n // positions, normals, uvs\r\n var i;\r\n var j;\r\n var r;\r\n var ringIdx = 1;\r\n var s = 1; // surface index\r\n var cs = 0;\r\n var v = 0;\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n }\r\n else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n }\r\n else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n }\r\n else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n }\r\n }\r\n // indices\r\n var e = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n var i0 = 0;\r\n var i1 = 0;\r\n var i2 = 0;\r\n var i3 = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n // Caps\r\n var createCylinderCap = function (isTop) {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i;\r\n var u = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n var textureScale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](cos * radius, offset, sin * radius);\r\n var textureCoordinate = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n // add caps to geometry based on cap parameter\r\n if ((cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_START)\r\n || (cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_END)\r\n || (cap === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n if (scene === undefined || !(scene instanceof _scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"])) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = subdivisions;\r\n subdivisions = 1;\r\n }\r\n var options = {\r\n height: height,\r\n diameterTop: diameterTop,\r\n diameterBottom: diameterBottom,\r\n tessellation: tessellation,\r\n subdivisions: subdivisions,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return CylinderBuilder.CreateCylinder(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar CylinderBuilder = /** @class */ (function () {\r\n function CylinderBuilder() {\r\n }\r\n /**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\n CylinderBuilder.CreateCylinder = function (name, options, scene) {\r\n var cylinder = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateCylinder(options);\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n return cylinder;\r\n };\r\n return CylinderBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/decalBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/decalBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: DecalBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return DecalBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Maths_math_vertexFormat__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.vertexFormat */ \"./Maths/math.vertexFormat.ts\");\n\r\n\r\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateDecal = function (name, sourceMesh, position, normal, size, angle) {\r\n var options = {\r\n position: position,\r\n normal: normal,\r\n size: size,\r\n angle: angle\r\n };\r\n return DecalBuilder.CreateDecal(name, sourceMesh, options);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar DecalBuilder = /** @class */ (function () {\r\n function DecalBuilder() {\r\n }\r\n /**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/how_to/decals\r\n */\r\n DecalBuilder.CreateDecal = function (name, sourceMesh, options) {\r\n var indices = sourceMesh.getIndices();\r\n var positions = sourceMesh.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n var normals = sourceMesh.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var position = options.position || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var normal = options.normal || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up();\r\n var size = options.size || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].One();\r\n var angle = options.angle || 0;\r\n // Getting correct rotation\r\n if (!normal) {\r\n var target = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1);\r\n var camera = sourceMesh.getScene().activeCamera;\r\n var cameraWorldTarget = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(target, camera.getWorldMatrix());\r\n normal = camera.globalPosition.subtract(cameraWorldTarget);\r\n }\r\n var yaw = -Math.atan2(normal.z, normal.x) - Math.PI / 2;\r\n var len = Math.sqrt(normal.x * normal.x + normal.z * normal.z);\r\n var pitch = Math.atan2(normal.y, len);\r\n // Matrix\r\n var decalWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationYawPitchRoll(yaw, pitch, angle).multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(position.x, position.y, position.z));\r\n var inverseDecalWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Invert(decalWorldMatrix);\r\n var meshWorldMatrix = sourceMesh.getWorldMatrix();\r\n var transformMatrix = meshWorldMatrix.multiply(inverseDecalWorldMatrix);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = [];\r\n vertexData.positions = [];\r\n vertexData.normals = [];\r\n vertexData.uvs = [];\r\n var currentVertexDataIndex = 0;\r\n var extractDecalVector3 = function (indexId) {\r\n var result = new _Maths_math_vertexFormat__WEBPACK_IMPORTED_MODULE_4__[\"PositionNormalVertex\"]();\r\n if (!indices || !positions || !normals) {\r\n return result;\r\n }\r\n var vertexId = indices[indexId];\r\n result.position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](positions[vertexId * 3], positions[vertexId * 3 + 1], positions[vertexId * 3 + 2]);\r\n // Send vector to decal local world\r\n result.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(result.position, transformMatrix);\r\n // Get normal\r\n result.normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](normals[vertexId * 3], normals[vertexId * 3 + 1], normals[vertexId * 3 + 2]);\r\n result.normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(result.normal, transformMatrix);\r\n return result;\r\n }; // Inspired by https://github.com/mrdoob/three.js/blob/eee231960882f6f3b6113405f524956145148146/examples/js/geometries/DecalGeometry.js\r\n var clip = function (vertices, axis) {\r\n if (vertices.length === 0) {\r\n return vertices;\r\n }\r\n var clipSize = 0.5 * Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(size, axis));\r\n var clipVertices = function (v0, v1) {\r\n var clipFactor = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].GetClipFactor(v0.position, v1.position, axis, clipSize);\r\n return new _Maths_math_vertexFormat__WEBPACK_IMPORTED_MODULE_4__[\"PositionNormalVertex\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(v0.position, v1.position, clipFactor), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(v0.normal, v1.normal, clipFactor));\r\n };\r\n var result = new Array();\r\n for (var index = 0; index < vertices.length; index += 3) {\r\n var v1Out;\r\n var v2Out;\r\n var v3Out;\r\n var total = 0;\r\n var nV1 = null;\r\n var nV2 = null;\r\n var nV3 = null;\r\n var nV4 = null;\r\n var d1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(vertices[index].position, axis) - clipSize;\r\n var d2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(vertices[index + 1].position, axis) - clipSize;\r\n var d3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(vertices[index + 2].position, axis) - clipSize;\r\n v1Out = d1 > 0;\r\n v2Out = d2 > 0;\r\n v3Out = d3 > 0;\r\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\r\n switch (total) {\r\n case 0:\r\n result.push(vertices[index]);\r\n result.push(vertices[index + 1]);\r\n result.push(vertices[index + 2]);\r\n break;\r\n case 1:\r\n if (v1Out) {\r\n nV1 = vertices[index + 1];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index], nV1);\r\n nV4 = clipVertices(vertices[index], nV2);\r\n }\r\n if (v2Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 2];\r\n nV3 = clipVertices(vertices[index + 1], nV1);\r\n nV4 = clipVertices(vertices[index + 1], nV2);\r\n result.push(nV3);\r\n result.push(nV2.clone());\r\n result.push(nV1.clone());\r\n result.push(nV2.clone());\r\n result.push(nV3.clone());\r\n result.push(nV4);\r\n break;\r\n }\r\n if (v3Out) {\r\n nV1 = vertices[index];\r\n nV2 = vertices[index + 1];\r\n nV3 = clipVertices(vertices[index + 2], nV1);\r\n nV4 = clipVertices(vertices[index + 2], nV2);\r\n }\r\n if (nV1 && nV2 && nV3 && nV4) {\r\n result.push(nV1.clone());\r\n result.push(nV2.clone());\r\n result.push(nV3);\r\n result.push(nV4);\r\n result.push(nV3.clone());\r\n result.push(nV2.clone());\r\n }\r\n break;\r\n case 2:\r\n if (!v1Out) {\r\n nV1 = vertices[index].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 1]);\r\n nV3 = clipVertices(nV1, vertices[index + 2]);\r\n result.push(nV1);\r\n result.push(nV2);\r\n result.push(nV3);\r\n }\r\n if (!v2Out) {\r\n nV1 = vertices[index + 1].clone();\r\n nV2 = clipVertices(nV1, vertices[index + 2]);\r\n nV3 = clipVertices(nV1, vertices[index]);\r\n result.push(nV1);\r\n result.push(nV2);\r\n result.push(nV3);\r\n }\r\n if (!v3Out) {\r\n nV1 = vertices[index + 2].clone();\r\n nV2 = clipVertices(nV1, vertices[index]);\r\n nV3 = clipVertices(nV1, vertices[index + 1]);\r\n result.push(nV1);\r\n result.push(nV2);\r\n result.push(nV3);\r\n }\r\n break;\r\n case 3:\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n for (var index = 0; index < indices.length; index += 3) {\r\n var faceVertices = new Array();\r\n faceVertices.push(extractDecalVector3(index));\r\n faceVertices.push(extractDecalVector3(index + 1));\r\n faceVertices.push(extractDecalVector3(index + 2));\r\n // Clip\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1, 0, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1));\r\n faceVertices = clip(faceVertices, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1));\r\n if (faceVertices.length === 0) {\r\n continue;\r\n }\r\n // Add UVs and get back to world\r\n for (var vIndex = 0; vIndex < faceVertices.length; vIndex++) {\r\n var vertex = faceVertices[vIndex];\r\n //TODO check for Int32Array | Uint32Array | Uint16Array\r\n vertexData.indices.push(currentVertexDataIndex);\r\n vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);\r\n vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);\r\n vertexData.uvs.push(0.5 + vertex.position.x / size.x);\r\n vertexData.uvs.push(0.5 + vertex.position.y / size.y);\r\n currentVertexDataIndex++;\r\n }\r\n }\r\n // Return mesh\r\n var decal = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, sourceMesh.getScene());\r\n vertexData.applyToMesh(decal);\r\n decal.position = position.clone();\r\n decal.rotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](pitch, yaw, angle);\r\n return decal;\r\n };\r\n return DecalBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/discBuilder.ts\":\n/*!****************************************!*\\\n !*** ./Meshes/Builders/discBuilder.ts ***!\n \\****************************************/\n/*! exports provided: DiscBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return DiscBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateDisc = function (options) {\r\n var positions = new Array();\r\n var indices = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var radius = options.radius || 0.5;\r\n var tessellation = options.tessellation || 64;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DEFAULTSIDE;\r\n // positions and uvs\r\n positions.push(0, 0, 0); // disc center first\r\n uvs.push(0.5, 0.5);\r\n var theta = Math.PI * 2 * arc;\r\n var step = theta / tessellation;\r\n for (var a = 0; a < theta; a += step) {\r\n var x = Math.cos(a);\r\n var y = Math.sin(a);\r\n var u = (x + 1) / 2;\r\n var v = (1 - y) / 2;\r\n positions.push(radius * x, radius * y, 0);\r\n uvs.push(u, v);\r\n }\r\n if (arc === 1) {\r\n positions.push(positions[3], positions[4], positions[5]); // close the circle\r\n uvs.push(uvs[2], uvs[3]);\r\n }\r\n //indices\r\n var vertexNb = positions.length / 3;\r\n for (var i = 1; i < vertexNb - 1; i++) {\r\n indices.push(i + 1, 0, i);\r\n }\r\n // result\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreateDisc = function (name, radius, tessellation, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n radius: radius,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return DiscBuilder.CreateDisc(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar DiscBuilder = /** @class */ (function () {\r\n function DiscBuilder() {\r\n }\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc\r\n * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)\r\n * * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane polygonal mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#disc-or-regular-polygon\r\n */\r\n DiscBuilder.CreateDisc = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var disc = new _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n disc._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateDisc(options);\r\n vertexData.applyToMesh(disc, options.updatable);\r\n return disc;\r\n };\r\n return DiscBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/groundBuilder.ts\":\n/*!******************************************!*\\\n !*** ./Meshes/Builders/groundBuilder.ts ***!\n \\******************************************/\n/*! exports provided: GroundBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return GroundBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _groundMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../groundMesh */ \"./Meshes/groundMesh.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGround = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var row, col;\r\n var width = options.width || 1;\r\n var height = options.height || 1;\r\n var subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n var subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n var position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]((col * width) / subdivisionsX - (width / 2.0), 0, ((subdivisionsY - row) * height) / subdivisionsY - (height / 2.0));\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0);\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledGround = function (options) {\r\n var xmin = (options.xmin !== undefined && options.xmin !== null) ? options.xmin : -1.0;\r\n var zmin = (options.zmin !== undefined && options.zmin !== null) ? options.zmin : -1.0;\r\n var xmax = (options.xmax !== undefined && options.xmax !== null) ? options.xmax : 1.0;\r\n var zmax = (options.zmax !== undefined && options.zmax !== null) ? options.zmax : 1.0;\r\n var subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n var precision = options.precision || { w: 1, h: 1 };\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var row, col, tileRow, tileCol;\r\n subdivisions.h = (subdivisions.h < 1) ? 1 : subdivisions.h;\r\n subdivisions.w = (subdivisions.w < 1) ? 1 : subdivisions.w;\r\n precision.w = (precision.w < 1) ? 1 : precision.w;\r\n precision.h = (precision.h < 1) ? 1 : precision.h;\r\n var tileSize = {\r\n 'w': (xmax - xmin) / subdivisions.w,\r\n 'h': (zmax - zmin) / subdivisions.h\r\n };\r\n function applyTile(xTileMin, zTileMin, xTileMax, zTileMax) {\r\n // Indices\r\n var base = positions.length / 3;\r\n var rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n var square = [\r\n base + col + row * rowLength,\r\n base + (col + 1) + row * rowLength,\r\n base + (col + 1) + (row + 1) * rowLength,\r\n base + col + (row + 1) * rowLength\r\n ];\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n // Position, normals and uvs\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGroundFromHeightMap = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var row, col;\r\n var filter = options.colorFilter || new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"](0.3, 0.59, 0.11);\r\n var alphaFilter = options.alphaFilter || 0.0;\r\n var invert = false;\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n var temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n var position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]((col * options.width) / options.subdivisions - (options.width / 2.0), 0, ((options.subdivisions - row) * options.height) / options.subdivisions - (options.height / 2.0));\r\n // Compute height\r\n var heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n var heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n var pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n var r = options.buffer[pos] / 255.0;\r\n var g = options.buffer[pos + 1] / 255.0;\r\n var b = options.buffer[pos + 2] / 255.0;\r\n var a = options.buffer[pos + 3] / 255.0;\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n var gradient = r * filter.r + g * filter.g + b * filter.b;\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n }\r\n else {\r\n position.y = options.minHeight - _Maths_math_constants__WEBPACK_IMPORTED_MODULE_7__[\"Epsilon\"]; // We can't have a height below minHeight, normally.\r\n }\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n var idx1 = (col + 1 + (row + 1) * (options.subdivisions + 1));\r\n var idx2 = (col + 1 + row * (options.subdivisions + 1));\r\n var idx3 = (col + row * (options.subdivisions + 1));\r\n var idx4 = (col + (row + 1) * (options.subdivisions + 1));\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n var isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n var isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n var isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n var isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n // Normals\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateGround = function (name, width, height, subdivisions, scene, updatable) {\r\n var options = {\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n updatable: updatable\r\n };\r\n return GroundBuilder.CreateGround(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateTiledGround = function (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\r\n var options = {\r\n xmin: xmin,\r\n zmin: zmin,\r\n xmax: xmax,\r\n zmax: zmax,\r\n subdivisions: subdivisions,\r\n precision: precision,\r\n updatable: updatable\r\n };\r\n return GroundBuilder.CreateTiledGround(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\r\n var options = {\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n updatable: updatable,\r\n onReady: onReady,\r\n alphaFilter: alphaFilter\r\n };\r\n return GroundBuilder.CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar GroundBuilder = /** @class */ (function () {\r\n function GroundBuilder() {\r\n }\r\n /**\r\n * Creates a ground mesh\r\n * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground\r\n * * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground\r\n */\r\n GroundBuilder.CreateGround = function (name, options, scene) {\r\n var ground = new _groundMesh__WEBPACK_IMPORTED_MODULE_4__[\"GroundMesh\"](name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGround(options);\r\n vertexData.applyToMesh(ground, options.updatable);\r\n ground._setReady(true);\r\n return ground;\r\n };\r\n /**\r\n * Creates a tiled ground mesh\r\n * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates\r\n * * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates\r\n * * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tiled-ground\r\n */\r\n GroundBuilder.CreateTiledGround = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var tiledGround = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledGround(options);\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n return tiledGround;\r\n };\r\n /**\r\n * Creates a ground mesh from a height map\r\n * * The parameter `url` sets the URL of the height map image resource.\r\n * * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.\r\n * * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.\r\n * * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.\r\n * * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.\r\n * * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.\r\n * * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).\r\n * * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param url defines the url to the height map\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map\r\n */\r\n GroundBuilder.CreateGroundFromHeightMap = function (name, url, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var width = options.width || 10.0;\r\n var height = options.height || 10.0;\r\n var subdivisions = options.subdivisions || 1 | 0;\r\n var minHeight = options.minHeight || 0.0;\r\n var maxHeight = options.maxHeight || 1.0;\r\n var filter = options.colorFilter || new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"](0.3, 0.59, 0.11);\r\n var alphaFilter = options.alphaFilter || 0.0;\r\n var updatable = options.updatable;\r\n var onReady = options.onReady;\r\n scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n var ground = new _groundMesh__WEBPACK_IMPORTED_MODULE_4__[\"GroundMesh\"](name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n ground._setReady(false);\r\n var onload = function (img) {\r\n // Getting height map data\r\n var canvas = document.createElement(\"canvas\");\r\n var context = canvas.getContext(\"2d\");\r\n if (!context) {\r\n throw new Error(\"Unable to get 2d context for CreateGroundFromHeightMap\");\r\n }\r\n if (scene.isDisposed) {\r\n return;\r\n }\r\n var bufferWidth = img.width;\r\n var bufferHeight = img.height;\r\n canvas.width = bufferWidth;\r\n canvas.height = bufferHeight;\r\n context.drawImage(img, 0, 0);\r\n // Create VertexData from map data\r\n // Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\r\n var buffer = context.getImageData(0, 0, bufferWidth, bufferHeight).data;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateGroundFromHeightMap({\r\n width: width, height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight, maxHeight: maxHeight, colorFilter: filter,\r\n buffer: buffer, bufferWidth: bufferWidth, bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter\r\n });\r\n vertexData.applyToMesh(ground, updatable);\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground);\r\n }\r\n ground._setReady(true);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].LoadImage(url, onload, function () { }, scene.offlineProvider);\r\n return ground;\r\n };\r\n return GroundBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/hemisphereBuilder.ts\":\n/*!**********************************************!*\\\n !*** ./Meshes/Builders/hemisphereBuilder.ts ***!\n \\**********************************************/\n/*! exports provided: HemisphereBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return HemisphereBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n\r\n\r\n/**\r\n * Creates a hemispheric light\r\n */\r\n_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreateHemisphere = function (name, segments, diameter, scene) {\r\n var options = {\r\n segments: segments,\r\n diameter: diameter\r\n };\r\n return HemisphereBuilder.CreateHemisphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar HemisphereBuilder = /** @class */ (function () {\r\n function HemisphereBuilder() {\r\n }\r\n /**\r\n * Creates a hemisphere mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the hemisphere mesh\r\n */\r\n HemisphereBuilder.CreateHemisphere = function (name, options, scene) {\r\n if (!options.diameter) {\r\n options.diameter = 1;\r\n }\r\n if (!options.segments) {\r\n options.segments = 16;\r\n }\r\n var halfSphere = _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__[\"SphereBuilder\"].CreateSphere(\"\", { slice: 0.5, diameter: options.diameter, segments: options.segments }, scene);\r\n var disc = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreateDisc(\"\", options.diameter / 2, (options.segments * 3) + (4 - options.segments), scene);\r\n disc.rotation.x = -Math.PI / 2;\r\n disc.parent = halfSphere;\r\n var merged = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].MergeMeshes([disc, halfSphere], true);\r\n merged.name = name;\r\n return merged;\r\n };\r\n return HemisphereBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/icoSphereBuilder.ts\":\n/*!*********************************************!*\\\n !*** ./Meshes/Builders/icoSphereBuilder.ts ***!\n \\*********************************************/\n/*! exports provided: IcoSphereBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return IcoSphereBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateIcoSphere = function (options) {\r\n var sideOrientation = options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n var radius = options.radius || 1;\r\n var flat = (options.flat === undefined) ? true : options.flat;\r\n var subdivisions = options.subdivisions || 4;\r\n var radiusX = options.radiusX || radius;\r\n var radiusY = options.radiusY || radius;\r\n var radiusZ = options.radiusZ || radius;\r\n var t = (1 + Math.sqrt(5)) / 2;\r\n // 12 vertex x,y,z\r\n var ico_vertices = [\r\n -1, t, -0, 1, t, 0, -1, -t, 0, 1, -t, 0,\r\n 0, -1, -t, 0, 1, -t, 0, -1, t, 0, 1, t,\r\n t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, -1 // v8-11\r\n ];\r\n // index of 3 vertex makes a face of icopshere\r\n var ico_indices = [\r\n 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 12, 22, 23,\r\n 1, 5, 20, 5, 11, 4, 23, 22, 13, 22, 18, 6, 7, 1, 8,\r\n 14, 21, 4, 14, 4, 2, 16, 13, 6, 15, 6, 19, 3, 8, 9,\r\n 4, 21, 5, 13, 17, 23, 6, 13, 22, 19, 6, 18, 9, 8, 1\r\n ];\r\n // vertex for uv have aliased position, not for UV\r\n var vertices_unalias_id = [\r\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\r\n // vertex alias\r\n 0,\r\n 2,\r\n 3,\r\n 3,\r\n 3,\r\n 4,\r\n 7,\r\n 8,\r\n 9,\r\n 9,\r\n 10,\r\n 11 // 23: B + 12\r\n ];\r\n // uv as integer step (not pixels !)\r\n var ico_vertexuv = [\r\n 5, 1, 3, 1, 6, 4, 0, 0,\r\n 5, 3, 4, 2, 2, 2, 4, 0,\r\n 2, 0, 1, 1, 6, 0, 6, 2,\r\n // vertex alias (for same vertex on different faces)\r\n 0, 4,\r\n 3, 3,\r\n 4, 4,\r\n 3, 1,\r\n 4, 2,\r\n 4, 4,\r\n 0, 2,\r\n 1, 1,\r\n 2, 2,\r\n 3, 3,\r\n 1, 3,\r\n 2, 4 // 23: B + 12\r\n ];\r\n // Vertices[0, 1, ...9, A, B] : position on UV plane\r\n // '+' indicate duplicate position to be fixed (3,9:0,2,3,4,7,8,A,B)\r\n // First island of uv mapping\r\n // v = 4h 3+ 2\r\n // v = 3h 9+ 4\r\n // v = 2h 9+ 5 B\r\n // v = 1h 9 1 0\r\n // v = 0h 3 8 7 A\r\n // u = 0 1 2 3 4 5 6 *a\r\n // Second island of uv mapping\r\n // v = 4h 0+ B+ 4+\r\n // v = 3h A+ 2+\r\n // v = 2h 7+ 6 3+\r\n // v = 1h 8+ 3+\r\n // v = 0h\r\n // u = 0 1 2 3 4 5 6 *a\r\n // Face layout on texture UV mapping\r\n // ============\r\n // \\ 4 /\\ 16 / ======\r\n // \\ / \\ / /\\ 11 /\r\n // \\/ 7 \\/ / \\ /\r\n // ======= / 10 \\/\r\n // /\\ 17 /\\ =======\r\n // / \\ / \\ \\ 15 /\\\r\n // / 8 \\/ 12 \\ \\ / \\\r\n // ============ \\/ 6 \\\r\n // \\ 18 /\\ ============\r\n // \\ / \\ \\ 5 /\\ 0 /\r\n // \\/ 13 \\ \\ / \\ /\r\n // ======= \\/ 1 \\/\r\n // =============\r\n // /\\ 19 /\\ 2 /\\\r\n // / \\ / \\ / \\\r\n // / 14 \\/ 9 \\/ 3 \\\r\n // ===================\r\n // uv step is u:1 or 0.5, v:cos(30)=sqrt(3)/2, ratio approx is 84/97\r\n var ustep = 138 / 1024;\r\n var vstep = 239 / 1024;\r\n var uoffset = 60 / 1024;\r\n var voffset = 26 / 1024;\r\n // Second island should have margin, not to touch the first island\r\n // avoid any borderline artefact in pixel rounding\r\n var island_u_offset = -40 / 1024;\r\n var island_v_offset = +20 / 1024;\r\n // face is either island 0 or 1 :\r\n // second island is for faces : [4, 7, 8, 12, 13, 16, 17, 18]\r\n var island = [\r\n 0, 0, 0, 0, 1,\r\n 0, 0, 1, 1, 0,\r\n 0, 0, 1, 1, 0,\r\n 0, 1, 1, 1, 0 // 15 - 19\r\n ];\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var current_indice = 0;\r\n // prepare array of 3 vector (empty) (to be worked in place, shared for each face)\r\n var face_vertex_pos = new Array(3);\r\n var face_vertex_uv = new Array(3);\r\n var v012;\r\n for (v012 = 0; v012 < 3; v012++) {\r\n face_vertex_pos[v012] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n face_vertex_uv[v012] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero();\r\n }\r\n // create all with normals\r\n for (var face = 0; face < 20; face++) {\r\n // 3 vertex per face\r\n for (v012 = 0; v012 < 3; v012++) {\r\n // look up vertex 0,1,2 to its index in 0 to 11 (or 23 including alias)\r\n var v_id = ico_indices[3 * face + v012];\r\n // vertex have 3D position (x,y,z)\r\n face_vertex_pos[v012].copyFromFloats(ico_vertices[3 * vertices_unalias_id[v_id]], ico_vertices[3 * vertices_unalias_id[v_id] + 1], ico_vertices[3 * vertices_unalias_id[v_id] + 2]);\r\n // Normalize to get normal, then scale to radius\r\n face_vertex_pos[v012].normalize().scaleInPlace(radius);\r\n // uv Coordinates from vertex ID\r\n face_vertex_uv[v012].copyFromFloats(ico_vertexuv[2 * v_id] * ustep + uoffset + island[face] * island_u_offset, ico_vertexuv[2 * v_id + 1] * vstep + voffset + island[face] * island_v_offset);\r\n }\r\n // Subdivide the face (interpolate pos, norm, uv)\r\n // - pos is linear interpolation, then projected to sphere (converge polyhedron to sphere)\r\n // - norm is linear interpolation of vertex corner normal\r\n // (to be checked if better to re-calc from face vertex, or if approximation is OK ??? )\r\n // - uv is linear interpolation\r\n //\r\n // Topology is as below for sub-divide by 2\r\n // vertex shown as v0,v1,v2\r\n // interp index is i1 to progress in range [v0,v1[\r\n // interp index is i2 to progress in range [v0,v2[\r\n // face index as (i1,i2) for /\\ : (i1,i2),(i1+1,i2),(i1,i2+1)\r\n // and (i1,i2)' for \\/ : (i1+1,i2),(i1+1,i2+1),(i1,i2+1)\r\n //\r\n //\r\n // i2 v2\r\n // ^ ^\r\n // / / \\\r\n // / / \\\r\n // / / \\\r\n // / / (0,1) \\\r\n // / #---------\\\r\n // / / \\ (0,0)'/ \\\r\n // / / \\ / \\\r\n // / / \\ / \\\r\n // / / (0,0) \\ / (1,0) \\\r\n // / #---------#---------\\\r\n // v0 v1\r\n //\r\n // --------------------> i1\r\n //\r\n // interp of (i1,i2):\r\n // along i2 : x0=lerp(v0,v2, i2/S) <---> x1=lerp(v1,v2, i2/S)\r\n // along i1 : lerp(x0,x1, i1/(S-i2))\r\n //\r\n // centroid of triangle is needed to get help normal computation\r\n // (c1,c2) are used for centroid location\r\n var interp_vertex = function (i1, i2, c1, c2) {\r\n // vertex is interpolated from\r\n // - face_vertex_pos[0..2]\r\n // - face_vertex_uv[0..2]\r\n var pos_x0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[0], face_vertex_pos[2], i2 / subdivisions);\r\n var pos_x1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[1], face_vertex_pos[2], i2 / subdivisions);\r\n var pos_interp = (subdivisions === i2) ? face_vertex_pos[2] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(pos_x0, pos_x1, i1 / (subdivisions - i2));\r\n pos_interp.normalize();\r\n var vertex_normal;\r\n if (flat) {\r\n // in flat mode, recalculate normal as face centroid normal\r\n var centroid_x0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[0], face_vertex_pos[2], c2 / subdivisions);\r\n var centroid_x1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(face_vertex_pos[1], face_vertex_pos[2], c2 / subdivisions);\r\n vertex_normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(centroid_x0, centroid_x1, c1 / (subdivisions - c2));\r\n }\r\n else {\r\n // in smooth mode, recalculate normal from each single vertex position\r\n vertex_normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](pos_interp.x, pos_interp.y, pos_interp.z);\r\n }\r\n // Vertex normal need correction due to X,Y,Z radius scaling\r\n vertex_normal.x /= radiusX;\r\n vertex_normal.y /= radiusY;\r\n vertex_normal.z /= radiusZ;\r\n vertex_normal.normalize();\r\n var uv_x0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(face_vertex_uv[0], face_vertex_uv[2], i2 / subdivisions);\r\n var uv_x1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(face_vertex_uv[1], face_vertex_uv[2], i2 / subdivisions);\r\n var uv_interp = (subdivisions === i2) ? face_vertex_uv[2] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(uv_x0, uv_x1, i1 / (subdivisions - i2));\r\n positions.push(pos_interp.x * radiusX, pos_interp.y * radiusY, pos_interp.z * radiusZ);\r\n normals.push(vertex_normal.x, vertex_normal.y, vertex_normal.z);\r\n uvs.push(uv_interp.x, uv_interp.y);\r\n // push each vertex has member of a face\r\n // Same vertex can bleong to multiple face, it is pushed multiple time (duplicate vertex are present)\r\n indices.push(current_indice);\r\n current_indice++;\r\n };\r\n for (var i2 = 0; i2 < subdivisions; i2++) {\r\n for (var i1 = 0; i1 + i2 < subdivisions; i1++) {\r\n // face : (i1,i2) for /\\ :\r\n // interp for : (i1,i2),(i1+1,i2),(i1,i2+1)\r\n interp_vertex(i1, i2, i1 + 1.0 / 3, i2 + 1.0 / 3);\r\n interp_vertex(i1 + 1, i2, i1 + 1.0 / 3, i2 + 1.0 / 3);\r\n interp_vertex(i1, i2 + 1, i1 + 1.0 / 3, i2 + 1.0 / 3);\r\n if (i1 + i2 + 1 < subdivisions) {\r\n // face : (i1,i2)' for \\/ :\r\n // interp for (i1+1,i2),(i1+1,i2+1),(i1,i2+1)\r\n interp_vertex(i1 + 1, i2, i1 + 2.0 / 3, i2 + 2.0 / 3);\r\n interp_vertex(i1 + 1, i2 + 1, i1 + 2.0 / 3, i2 + 2.0 / 3);\r\n interp_vertex(i1, i2 + 1, i1 + 2.0 / 3, i2 + 2.0 / 3);\r\n }\r\n }\r\n }\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateIcoSphere = function (name, options, scene) {\r\n return IcoSphereBuilder.CreateIcoSphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar IcoSphereBuilder = /** @class */ (function () {\r\n function IcoSphereBuilder() {\r\n }\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value of `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the icosahedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n IcoSphereBuilder.CreateIcoSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var sphere = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateIcoSphere(options);\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n return sphere;\r\n };\r\n return IcoSphereBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/index.ts\":\n/*!**********************************!*\\\n !*** ./Meshes/Builders/index.ts ***!\n \\**********************************/\n/*! exports provided: BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boxBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _boxBuilder__WEBPACK_IMPORTED_MODULE_0__[\"BoxBuilder\"]; });\n\n/* harmony import */ var _tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tiledBoxBuilder */ \"./Meshes/Builders/tiledBoxBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_1__[\"TiledBoxBuilder\"]; });\n\n/* harmony import */ var _discBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./discBuilder */ \"./Meshes/Builders/discBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _discBuilder__WEBPACK_IMPORTED_MODULE_2__[\"DiscBuilder\"]; });\n\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _ribbonBuilder__WEBPACK_IMPORTED_MODULE_3__[\"RibbonBuilder\"]; });\n\n/* harmony import */ var _sphereBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _sphereBuilder__WEBPACK_IMPORTED_MODULE_4__[\"SphereBuilder\"]; });\n\n/* harmony import */ var _hemisphereBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hemisphereBuilder */ \"./Meshes/Builders/hemisphereBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _hemisphereBuilder__WEBPACK_IMPORTED_MODULE_5__[\"HemisphereBuilder\"]; });\n\n/* harmony import */ var _cylinderBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _cylinderBuilder__WEBPACK_IMPORTED_MODULE_6__[\"CylinderBuilder\"]; });\n\n/* harmony import */ var _torusBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./torusBuilder */ \"./Meshes/Builders/torusBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _torusBuilder__WEBPACK_IMPORTED_MODULE_7__[\"TorusBuilder\"]; });\n\n/* harmony import */ var _torusKnotBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./torusKnotBuilder */ \"./Meshes/Builders/torusKnotBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _torusKnotBuilder__WEBPACK_IMPORTED_MODULE_8__[\"TorusKnotBuilder\"]; });\n\n/* harmony import */ var _linesBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _linesBuilder__WEBPACK_IMPORTED_MODULE_9__[\"LinesBuilder\"]; });\n\n/* harmony import */ var _polygonBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./polygonBuilder */ \"./Meshes/Builders/polygonBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _polygonBuilder__WEBPACK_IMPORTED_MODULE_10__[\"PolygonBuilder\"]; });\n\n/* harmony import */ var _shapeBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./shapeBuilder */ \"./Meshes/Builders/shapeBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _shapeBuilder__WEBPACK_IMPORTED_MODULE_11__[\"ShapeBuilder\"]; });\n\n/* harmony import */ var _latheBuilder__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./latheBuilder */ \"./Meshes/Builders/latheBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _latheBuilder__WEBPACK_IMPORTED_MODULE_12__[\"LatheBuilder\"]; });\n\n/* harmony import */ var _planeBuilder__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _planeBuilder__WEBPACK_IMPORTED_MODULE_13__[\"PlaneBuilder\"]; });\n\n/* harmony import */ var _tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tiledPlaneBuilder */ \"./Meshes/Builders/tiledPlaneBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_14__[\"TiledPlaneBuilder\"]; });\n\n/* harmony import */ var _groundBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./groundBuilder */ \"./Meshes/Builders/groundBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _groundBuilder__WEBPACK_IMPORTED_MODULE_15__[\"GroundBuilder\"]; });\n\n/* harmony import */ var _tubeBuilder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./tubeBuilder */ \"./Meshes/Builders/tubeBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _tubeBuilder__WEBPACK_IMPORTED_MODULE_16__[\"TubeBuilder\"]; });\n\n/* harmony import */ var _polyhedronBuilder__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./polyhedronBuilder */ \"./Meshes/Builders/polyhedronBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _polyhedronBuilder__WEBPACK_IMPORTED_MODULE_17__[\"PolyhedronBuilder\"]; });\n\n/* harmony import */ var _icoSphereBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./icoSphereBuilder */ \"./Meshes/Builders/icoSphereBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _icoSphereBuilder__WEBPACK_IMPORTED_MODULE_18__[\"IcoSphereBuilder\"]; });\n\n/* harmony import */ var _decalBuilder__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./decalBuilder */ \"./Meshes/Builders/decalBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _decalBuilder__WEBPACK_IMPORTED_MODULE_19__[\"DecalBuilder\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/latheBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/latheBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: LatheBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return LatheBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLathe = function (name, shape, radius, tessellation, scene, updatable, sideOrientation) {\r\n var options = {\r\n shape: shape,\r\n radius: radius,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return LatheBuilder.CreateLathe(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar LatheBuilder = /** @class */ (function () {\r\n function LatheBuilder() {\r\n }\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * * The parameter `radius` (positive float, default 1) is the radius value of the lathe\r\n * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe\r\n * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides\r\n * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape\r\n * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter \"arc\"\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the lathe mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lathe\r\n */\r\n LatheBuilder.CreateLathe = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var arc = options.arc ? ((options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc) : 1.0;\r\n var closed = (options.closed === undefined) ? true : options.closed;\r\n var shape = options.shape;\r\n var radius = options.radius || 1;\r\n var tessellation = options.tessellation || 64;\r\n var clip = options.clip || 0;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var cap = options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var pi2 = Math.PI * 2;\r\n var paths = new Array();\r\n var invertUV = options.invertUV || false;\r\n var i = 0;\r\n var p = 0;\r\n var step = pi2 / tessellation * arc;\r\n var rotated;\r\n var path = new Array();\r\n for (i = 0; i <= tessellation - clip; i++) {\r\n var path = [];\r\n if (cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_START || cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL) {\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, shape[0].y, 0));\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Math.cos(i * step) * shape[0].x * radius, shape[0].y, Math.sin(i * step) * shape[0].x * radius));\r\n }\r\n for (p = 0; p < shape.length; p++) {\r\n rotated = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Math.cos(i * step) * shape[p].x * radius, shape[p].y, Math.sin(i * step) * shape[p].x * radius);\r\n path.push(rotated);\r\n }\r\n if (cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END || cap == _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL) {\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Math.cos(i * step) * shape[shape.length - 1].x * radius, shape[shape.length - 1].y, Math.sin(i * step) * shape[shape.length - 1].x * radius));\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, shape[shape.length - 1].y, 0));\r\n }\r\n paths.push(path);\r\n }\r\n // lathe ribbon\r\n var lathe = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(name, { pathArray: paths, closeArray: closed, sideOrientation: sideOrientation, updatable: updatable, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);\r\n return lathe;\r\n };\r\n return LatheBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/linesBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/linesBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: LinesBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return LinesBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Meshes/linesMesh */ \"./Meshes/linesMesh.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateLineSystem = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateDashedLines = function (options) {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n var positions = new Array();\r\n var indices = new Array();\r\n var curvect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n var options = {\r\n points: points,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateLines(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n points: points,\r\n dashSize: dashSize,\r\n gapSize: gapSize,\r\n dashNb: dashNb,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateDashedLines(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar LinesBuilder = /** @class */ (function () {\r\n function LinesBuilder() {\r\n }\r\n /**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\n LinesBuilder.CreateLineSystem = function (name, options, scene) {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind);\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"](name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha);\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateLineSystem(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n };\r\n /**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\n LinesBuilder.CreateLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = LinesBuilder.CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha }, scene);\r\n return lines;\r\n };\r\n /**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\n LinesBuilder.CreateDashedLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n if (instance) { // dashed lines update\r\n var positionFunction = function (positions) {\r\n var curvect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n var dashSize = instance._creationDataStorage.dashSize;\r\n var gapSize = instance._creationDataStorage.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"](name, scene);\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateDashedLines(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n dashedLines._creationDataStorage = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"_CreationDataStorage\"]();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n };\r\n return LinesBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/planeBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/planeBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: PlaneBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return PlaneBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreatePlane = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DEFAULTSIDE;\r\n // Vertices\r\n var halfWidth = width / 2.0;\r\n var halfHeight = height / 2.0;\r\n positions.push(-halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 0.0);\r\n positions.push(halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 0.0);\r\n positions.push(halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 1.0);\r\n positions.push(-halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 1.0);\r\n // Indices\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n var options = {\r\n size: size,\r\n width: size,\r\n height: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return PlaneBuilder.CreatePlane(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PlaneBuilder = /** @class */ (function () {\r\n function PlaneBuilder() {\r\n }\r\n /**\r\n * Creates a plane mesh\r\n * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)\r\n * * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value of `size`)\r\n * * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n PlaneBuilder.CreatePlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var plane = new _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n plane._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreatePlane(options);\r\n vertexData.applyToMesh(plane, options.updatable);\r\n if (options.sourcePlane) {\r\n plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);\r\n plane.setDirection(options.sourcePlane.normal.scale(-1));\r\n }\r\n return plane;\r\n };\r\n return PlaneBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/polygonBuilder.ts\":\n/*!*******************************************!*\\\n !*** ./Meshes/Builders/polygonBuilder.ts ***!\n \\*******************************************/\n/*! exports provided: PolygonBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return PolygonBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _polygonMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../polygonMesh */ \"./Meshes/polygonMesh.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolygon = function (polygon, sideOrientation, fUV, fColors, frontUVs, backUVs) {\r\n var faceUV = fUV || new Array(3);\r\n var faceColors = fColors;\r\n var colors = [];\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < 3; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n var positions = polygon.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n var normals = polygon.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n var uvs = polygon.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].UVKind);\r\n var indices = polygon.getIndices();\r\n // set face colours and textures\r\n var idx = 0;\r\n var face = 0;\r\n for (var index = 0; index < normals.length; index += 3) {\r\n //Edge Face no. 1\r\n if (Math.abs(normals[index + 1]) < 0.001) {\r\n face = 1;\r\n }\r\n //Top Face no. 0\r\n if (Math.abs(normals[index + 1] - 1) < 0.001) {\r\n face = 0;\r\n }\r\n //Bottom Face no. 2\r\n if (Math.abs(normals[index + 1] + 1) < 0.001) {\r\n face = 2;\r\n }\r\n idx = index / 3;\r\n uvs[2 * idx] = (1 - uvs[2 * idx]) * faceUV[face].x + uvs[2 * idx] * faceUV[face].z;\r\n uvs[2 * idx + 1] = (1 - uvs[2 * idx + 1]) * faceUV[face].y + uvs[2 * idx + 1] * faceUV[face].w;\r\n if (faceColors) {\r\n colors.push(faceColors[face].r, faceColors[face].g, faceColors[face].b, faceColors[face].a);\r\n }\r\n }\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreatePolygon = function (name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n var options = {\r\n shape: shape,\r\n holes: holes,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation\r\n };\r\n return PolygonBuilder.CreatePolygon(name, options, scene, earcutInjection);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].ExtrudePolygon = function (name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n var options = {\r\n shape: shape,\r\n holes: holes,\r\n depth: depth,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation\r\n };\r\n return PolygonBuilder.ExtrudePolygon(name, options, scene, earcutInjection);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PolygonBuilder = /** @class */ (function () {\r\n function PolygonBuilder() {\r\n }\r\n /**\r\n * Creates a polygon mesh\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh\r\n * * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4)\r\n * * Remember you can only change the shape positions, not their number when updating a polygon\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n PolygonBuilder.CreatePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var shape = options.shape;\r\n var holes = options.holes || [];\r\n var depth = options.depth || 0;\r\n var contours = [];\r\n var hole = [];\r\n for (var i = 0; i < shape.length; i++) {\r\n contours[i] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](shape[i].x, shape[i].z);\r\n }\r\n var epsilon = 0.00000001;\r\n if (contours[0].equalsWithEpsilon(contours[contours.length - 1], epsilon)) {\r\n contours.pop();\r\n }\r\n var polygonTriangulation = new _polygonMesh__WEBPACK_IMPORTED_MODULE_4__[\"PolygonMeshBuilder\"](name, contours, scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene, earcutInjection);\r\n for (var hNb = 0; hNb < holes.length; hNb++) {\r\n hole = [];\r\n for (var hPoint = 0; hPoint < holes[hNb].length; hPoint++) {\r\n hole.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](holes[hNb][hPoint].x, holes[hNb][hPoint].z));\r\n }\r\n polygonTriangulation.addHole(hole);\r\n }\r\n var polygon = polygonTriangulation.build(options.updatable, depth);\r\n polygon._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolygon(polygon, options.sideOrientation, options.faceUV, options.faceColors, options.frontUVs, options.backUVs);\r\n vertexData.applyToMesh(polygon, options.updatable);\r\n return polygon;\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction.\r\n * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)\r\n * @see https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n PolygonBuilder.ExtrudePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n return PolygonBuilder.CreatePolygon(name, options, scene, earcutInjection);\r\n };\r\n return PolygonBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/polyhedronBuilder.ts\":\n/*!**********************************************!*\\\n !*** ./Meshes/Builders/polyhedronBuilder.ts ***!\n \\**********************************************/\n/*! exports provided: PolyhedronBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return PolyhedronBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolyhedron = function (options) {\r\n // provided polyhedron types :\r\n // 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\r\n // 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\r\n var polyhedra = [];\r\n polyhedra[0] = { vertex: [[0, 0, 1.732051], [1.632993, 0, -0.5773503], [-0.8164966, 1.414214, -0.5773503], [-0.8164966, -1.414214, -0.5773503]], face: [[0, 1, 2], [0, 2, 3], [0, 3, 1], [1, 3, 2]] };\r\n polyhedra[1] = { vertex: [[0, 0, 1.414214], [1.414214, 0, 0], [0, 1.414214, 0], [-1.414214, 0, 0], [0, -1.414214, 0], [0, 0, -1.414214]], face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 1], [1, 4, 5], [1, 5, 2], [2, 5, 3], [3, 5, 4]] };\r\n polyhedra[2] = {\r\n vertex: [[0, 0, 1.070466], [0.7136442, 0, 0.7978784], [-0.3568221, 0.618034, 0.7978784], [-0.3568221, -0.618034, 0.7978784], [0.7978784, 0.618034, 0.3568221], [0.7978784, -0.618034, 0.3568221], [-0.9341724, 0.381966, 0.3568221], [0.1362939, 1, 0.3568221], [0.1362939, -1, 0.3568221], [-0.9341724, -0.381966, 0.3568221], [0.9341724, 0.381966, -0.3568221], [0.9341724, -0.381966, -0.3568221], [-0.7978784, 0.618034, -0.3568221], [-0.1362939, 1, -0.3568221], [-0.1362939, -1, -0.3568221], [-0.7978784, -0.618034, -0.3568221], [0.3568221, 0.618034, -0.7978784], [0.3568221, -0.618034, -0.7978784], [-0.7136442, 0, -0.7978784], [0, 0, -1.070466]],\r\n face: [[0, 1, 4, 7, 2], [0, 2, 6, 9, 3], [0, 3, 8, 5, 1], [1, 5, 11, 10, 4], [2, 7, 13, 12, 6], [3, 9, 15, 14, 8], [4, 10, 16, 13, 7], [5, 8, 14, 17, 11], [6, 12, 18, 15, 9], [10, 11, 17, 19, 16], [12, 13, 16, 19, 18], [14, 15, 18, 19, 17]]\r\n };\r\n polyhedra[3] = {\r\n vertex: [[0, 0, 1.175571], [1.051462, 0, 0.5257311], [0.3249197, 1, 0.5257311], [-0.8506508, 0.618034, 0.5257311], [-0.8506508, -0.618034, 0.5257311], [0.3249197, -1, 0.5257311], [0.8506508, 0.618034, -0.5257311], [0.8506508, -0.618034, -0.5257311], [-0.3249197, 1, -0.5257311], [-1.051462, 0, -0.5257311], [-0.3249197, -1, -0.5257311], [0, 0, -1.175571]],\r\n face: [[0, 1, 2], [0, 2, 3], [0, 3, 4], [0, 4, 5], [0, 5, 1], [1, 5, 7], [1, 7, 6], [1, 6, 2], [2, 6, 8], [2, 8, 3], [3, 8, 9], [3, 9, 4], [4, 9, 10], [4, 10, 5], [5, 10, 7], [6, 7, 11], [6, 11, 8], [7, 10, 11], [8, 11, 9], [9, 11, 10]]\r\n };\r\n polyhedra[4] = {\r\n vertex: [[0, 0, 1.070722], [0.7148135, 0, 0.7971752], [-0.104682, 0.7071068, 0.7971752], [-0.6841528, 0.2071068, 0.7971752], [-0.104682, -0.7071068, 0.7971752], [0.6101315, 0.7071068, 0.5236279], [1.04156, 0.2071068, 0.1367736], [0.6101315, -0.7071068, 0.5236279], [-0.3574067, 1, 0.1367736], [-0.7888348, -0.5, 0.5236279], [-0.9368776, 0.5, 0.1367736], [-0.3574067, -1, 0.1367736], [0.3574067, 1, -0.1367736], [0.9368776, -0.5, -0.1367736], [0.7888348, 0.5, -0.5236279], [0.3574067, -1, -0.1367736], [-0.6101315, 0.7071068, -0.5236279], [-1.04156, -0.2071068, -0.1367736], [-0.6101315, -0.7071068, -0.5236279], [0.104682, 0.7071068, -0.7971752], [0.6841528, -0.2071068, -0.7971752], [0.104682, -0.7071068, -0.7971752], [-0.7148135, 0, -0.7971752], [0, 0, -1.070722]],\r\n face: [[0, 2, 3], [1, 6, 5], [4, 9, 11], [7, 15, 13], [8, 16, 10], [12, 14, 19], [17, 22, 18], [20, 21, 23], [0, 1, 5, 2], [0, 3, 9, 4], [0, 4, 7, 1], [1, 7, 13, 6], [2, 5, 12, 8], [2, 8, 10, 3], [3, 10, 17, 9], [4, 11, 15, 7], [5, 6, 14, 12], [6, 13, 20, 14], [8, 12, 19, 16], [9, 17, 18, 11], [10, 16, 22, 17], [11, 18, 21, 15], [13, 15, 21, 20], [14, 20, 23, 19], [16, 19, 23, 22], [18, 22, 23, 21]]\r\n };\r\n polyhedra[5] = { vertex: [[0, 0, 1.322876], [1.309307, 0, 0.1889822], [-0.9819805, 0.8660254, 0.1889822], [0.1636634, -1.299038, 0.1889822], [0.3273268, 0.8660254, -0.9449112], [-0.8183171, -0.4330127, -0.9449112]], face: [[0, 3, 1], [2, 4, 5], [0, 1, 4, 2], [0, 2, 5, 3], [1, 3, 5, 4]] };\r\n polyhedra[6] = { vertex: [[0, 0, 1.159953], [1.013464, 0, 0.5642542], [-0.3501431, 0.9510565, 0.5642542], [-0.7715208, -0.6571639, 0.5642542], [0.6633206, 0.9510565, -0.03144481], [0.8682979, -0.6571639, -0.3996071], [-1.121664, 0.2938926, -0.03144481], [-0.2348831, -1.063314, -0.3996071], [0.5181548, 0.2938926, -0.9953061], [-0.5850262, -0.112257, -0.9953061]], face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 9, 7], [5, 7, 9, 8], [0, 3, 7, 5, 1], [2, 4, 8, 9, 6]] };\r\n polyhedra[7] = { vertex: [[0, 0, 1.118034], [0.8944272, 0, 0.6708204], [-0.2236068, 0.8660254, 0.6708204], [-0.7826238, -0.4330127, 0.6708204], [0.6708204, 0.8660254, 0.2236068], [1.006231, -0.4330127, -0.2236068], [-1.006231, 0.4330127, 0.2236068], [-0.6708204, -0.8660254, -0.2236068], [0.7826238, 0.4330127, -0.6708204], [0.2236068, -0.8660254, -0.6708204], [-0.8944272, 0, -0.6708204], [0, 0, -1.118034]], face: [[0, 1, 4, 2], [0, 2, 6, 3], [1, 5, 8, 4], [3, 6, 10, 7], [5, 9, 11, 8], [7, 10, 11, 9], [0, 3, 7, 9, 5, 1], [2, 4, 8, 11, 10, 6]] };\r\n polyhedra[8] = { vertex: [[-0.729665, 0.670121, 0.319155], [-0.655235, -0.29213, -0.754096], [-0.093922, -0.607123, 0.537818], [0.702196, 0.595691, 0.485187], [0.776626, -0.36656, -0.588064]], face: [[1, 4, 2], [0, 1, 2], [3, 0, 2], [4, 3, 2], [4, 1, 0, 3]] };\r\n polyhedra[9] = { vertex: [[-0.868849, -0.100041, 0.61257], [-0.329458, 0.976099, 0.28078], [-0.26629, -0.013796, -0.477654], [-0.13392, -1.034115, 0.229829], [0.738834, 0.707117, -0.307018], [0.859683, -0.535264, -0.338508]], face: [[3, 0, 2], [5, 3, 2], [4, 5, 2], [1, 4, 2], [0, 1, 2], [0, 3, 5, 4, 1]] };\r\n polyhedra[10] = { vertex: [[-0.610389, 0.243975, 0.531213], [-0.187812, -0.48795, -0.664016], [-0.187812, 0.9759, -0.664016], [0.187812, -0.9759, 0.664016], [0.798201, 0.243975, 0.132803]], face: [[1, 3, 0], [3, 4, 0], [3, 1, 4], [0, 2, 1], [0, 4, 2], [2, 4, 1]] };\r\n polyhedra[11] = { vertex: [[-1.028778, 0.392027, -0.048786], [-0.640503, -0.646161, 0.621837], [-0.125162, -0.395663, -0.540059], [0.004683, 0.888447, -0.651988], [0.125161, 0.395663, 0.540059], [0.632925, -0.791376, 0.433102], [1.031672, 0.157063, -0.354165]], face: [[3, 2, 0], [2, 1, 0], [2, 5, 1], [0, 4, 3], [0, 1, 4], [4, 1, 5], [2, 3, 6], [3, 4, 6], [5, 2, 6], [4, 5, 6]] };\r\n polyhedra[12] = { vertex: [[-0.669867, 0.334933, -0.529576], [-0.669867, 0.334933, 0.529577], [-0.4043, 1.212901, 0], [-0.334933, -0.669867, -0.529576], [-0.334933, -0.669867, 0.529577], [0.334933, 0.669867, -0.529576], [0.334933, 0.669867, 0.529577], [0.4043, -1.212901, 0], [0.669867, -0.334933, -0.529576], [0.669867, -0.334933, 0.529577]], face: [[8, 9, 7], [6, 5, 2], [3, 8, 7], [5, 0, 2], [4, 3, 7], [0, 1, 2], [9, 4, 7], [1, 6, 2], [9, 8, 5, 6], [8, 3, 0, 5], [3, 4, 1, 0], [4, 9, 6, 1]] };\r\n polyhedra[13] = { vertex: [[-0.931836, 0.219976, -0.264632], [-0.636706, 0.318353, 0.692816], [-0.613483, -0.735083, -0.264632], [-0.326545, 0.979634, 0], [-0.318353, -0.636706, 0.692816], [-0.159176, 0.477529, -0.856368], [0.159176, -0.477529, -0.856368], [0.318353, 0.636706, 0.692816], [0.326545, -0.979634, 0], [0.613482, 0.735082, -0.264632], [0.636706, -0.318353, 0.692816], [0.931835, -0.219977, -0.264632]], face: [[11, 10, 8], [7, 9, 3], [6, 11, 8], [9, 5, 3], [2, 6, 8], [5, 0, 3], [4, 2, 8], [0, 1, 3], [10, 4, 8], [1, 7, 3], [10, 11, 9, 7], [11, 6, 5, 9], [6, 2, 0, 5], [2, 4, 1, 0], [4, 10, 7, 1]] };\r\n polyhedra[14] = {\r\n vertex: [[-0.93465, 0.300459, -0.271185], [-0.838689, -0.260219, -0.516017], [-0.711319, 0.717591, 0.128359], [-0.710334, -0.156922, 0.080946], [-0.599799, 0.556003, -0.725148], [-0.503838, -0.004675, -0.969981], [-0.487004, 0.26021, 0.48049], [-0.460089, -0.750282, -0.512622], [-0.376468, 0.973135, -0.325605], [-0.331735, -0.646985, 0.084342], [-0.254001, 0.831847, 0.530001], [-0.125239, -0.494738, -0.966586], [0.029622, 0.027949, 0.730817], [0.056536, -0.982543, -0.262295], [0.08085, 1.087391, 0.076037], [0.125583, -0.532729, 0.485984], [0.262625, 0.599586, 0.780328], [0.391387, -0.726999, -0.716259], [0.513854, -0.868287, 0.139347], [0.597475, 0.85513, 0.326364], [0.641224, 0.109523, 0.783723], [0.737185, -0.451155, 0.538891], [0.848705, -0.612742, -0.314616], [0.976075, 0.365067, 0.32976], [1.072036, -0.19561, 0.084927]],\r\n face: [[15, 18, 21], [12, 20, 16], [6, 10, 2], [3, 0, 1], [9, 7, 13], [2, 8, 4, 0], [0, 4, 5, 1], [1, 5, 11, 7], [7, 11, 17, 13], [13, 17, 22, 18], [18, 22, 24, 21], [21, 24, 23, 20], [20, 23, 19, 16], [16, 19, 14, 10], [10, 14, 8, 2], [15, 9, 13, 18], [12, 15, 21, 20], [6, 12, 16, 10], [3, 6, 2, 0], [9, 3, 1, 7], [9, 15, 12, 6, 3], [22, 17, 11, 5, 4, 8, 14, 19, 23, 24]]\r\n };\r\n var type = options.type && (options.type < 0 || options.type >= polyhedra.length) ? 0 : options.type || 0;\r\n var size = options.size;\r\n var sizeX = options.sizeX || size || 1;\r\n var sizeY = options.sizeY || size || 1;\r\n var sizeZ = options.sizeZ || size || 1;\r\n var data = options.custom || polyhedra[type];\r\n var nbfaces = data.face.length;\r\n var faceUV = options.faceUV || new Array(nbfaces);\r\n var faceColors = options.faceColors;\r\n var flat = (options.flat === undefined) ? true : options.flat;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var positions = new Array();\r\n var indices = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var index = 0;\r\n var faceIdx = 0; // face cursor in the array \"indexes\"\r\n var indexes = new Array();\r\n var i = 0;\r\n var f = 0;\r\n var u, v, ang, x, y, tmp;\r\n // default face colors and UV if undefined\r\n if (flat) {\r\n for (f = 0; f < nbfaces; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n }\r\n }\r\n if (!flat) {\r\n for (i = 0; i < data.vertex.length; i++) {\r\n positions.push(data.vertex[i][0] * sizeX, data.vertex[i][1] * sizeY, data.vertex[i][2] * sizeZ);\r\n uvs.push(0, 0);\r\n }\r\n for (f = 0; f < nbfaces; f++) {\r\n for (i = 0; i < data.face[f].length - 2; i++) {\r\n indices.push(data.face[f][0], data.face[f][i + 2], data.face[f][i + 1]);\r\n }\r\n }\r\n }\r\n else {\r\n for (f = 0; f < nbfaces; f++) {\r\n var fl = data.face[f].length; // number of vertices of the current face\r\n ang = 2 * Math.PI / fl;\r\n x = 0.5 * Math.tan(ang / 2);\r\n y = 0.5;\r\n // positions, uvs, colors\r\n for (i = 0; i < fl; i++) {\r\n // positions\r\n positions.push(data.vertex[data.face[f][i]][0] * sizeX, data.vertex[data.face[f][i]][1] * sizeY, data.vertex[data.face[f][i]][2] * sizeZ);\r\n indexes.push(index);\r\n index++;\r\n // uvs\r\n u = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * (0.5 + x);\r\n v = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * (y - 0.5);\r\n uvs.push(u, v);\r\n tmp = x * Math.cos(ang) - y * Math.sin(ang);\r\n y = x * Math.sin(ang) + y * Math.cos(ang);\r\n x = tmp;\r\n // colors\r\n if (faceColors) {\r\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\r\n }\r\n }\r\n // indices from indexes\r\n for (i = 0; i < fl - 2; i++) {\r\n indices.push(indexes[0 + faceIdx], indexes[i + 2 + faceIdx], indexes[i + 1 + faceIdx]);\r\n }\r\n faceIdx += fl;\r\n }\r\n }\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors && flat) {\r\n vertexData.colors = colors;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].CreatePolyhedron = function (name, options, scene) {\r\n return PolyhedronBuilder.CreatePolyhedron(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PolyhedronBuilder = /** @class */ (function () {\r\n function PolyhedronBuilder() {\r\n }\r\n /**\r\n * Creates a polyhedron mesh\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the polyhedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes\r\n */\r\n PolyhedronBuilder.CreatePolyhedron = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var polyhedron = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n polyhedron._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreatePolyhedron(options);\r\n vertexData.applyToMesh(polyhedron, options.updatable);\r\n return polyhedron;\r\n };\r\n return PolyhedronBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/ribbonBuilder.ts\":\n/*!******************************************!*\\\n !*** ./Meshes/Builders/ribbonBuilder.ts ***!\n \\******************************************/\n/*! exports provided: RibbonBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return RibbonBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n\r\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateRibbon = function (options) {\r\n var pathArray = options.pathArray;\r\n var closeArray = options.closeArray || false;\r\n var closePath = options.closePath || false;\r\n var invertUV = options.invertUV || false;\r\n var defaultOffset = Math.floor(pathArray[0].length / 2);\r\n var offset = options.offset || defaultOffset;\r\n offset = offset > defaultOffset ? defaultOffset : Math.floor(offset); // offset max allowed : defaultOffset\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n var customUV = options.uvs;\r\n var customColors = options.colors;\r\n var positions = [];\r\n var indices = [];\r\n var normals = [];\r\n var uvs = [];\r\n var us = []; // us[path_id] = [uDist1, uDist2, uDist3 ... ] distances between points on path path_id\r\n var vs = []; // vs[i] = [vDist1, vDist2, vDist3, ... ] distances between points i of consecutives paths from pathArray\r\n var uTotalDistance = []; // uTotalDistance[p] : total distance of path p\r\n var vTotalDistance = []; // vTotalDistance[i] : total distance between points i of first and last path from pathArray\r\n var minlg; // minimal length among all paths from pathArray\r\n var lg = []; // array of path lengths : nb of vertex per path\r\n var idx = []; // array of path indexes : index of each path (first vertex) in the total vertex number\r\n var p; // path iterator\r\n var i; // point iterator\r\n var j; // point iterator\r\n // if single path in pathArray\r\n if (pathArray.length < 2) {\r\n var ar1 = [];\r\n var ar2 = [];\r\n for (i = 0; i < pathArray[0].length - offset; i++) {\r\n ar1.push(pathArray[0][i]);\r\n ar2.push(pathArray[0][i + offset]);\r\n }\r\n pathArray = [ar1, ar2];\r\n }\r\n // positions and horizontal distances (u)\r\n var idc = 0;\r\n var closePathCorr = (closePath) ? 1 : 0; // the final index will be +1 if closePath\r\n var path;\r\n var l;\r\n minlg = pathArray[0].length;\r\n var vectlg;\r\n var dist;\r\n for (p = 0; p < pathArray.length; p++) {\r\n uTotalDistance[p] = 0;\r\n us[p] = [0];\r\n path = pathArray[p];\r\n l = path.length;\r\n minlg = (minlg < l) ? minlg : l;\r\n j = 0;\r\n while (j < l) {\r\n positions.push(path[j].x, path[j].y, path[j].z);\r\n if (j > 0) {\r\n vectlg = path[j].subtract(path[j - 1]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n j++;\r\n }\r\n if (closePath) { // an extra hidden vertex is added in the \"positions\" array\r\n j--;\r\n positions.push(path[0].x, path[0].y, path[0].z);\r\n vectlg = path[j].subtract(path[0]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n lg[p] = l + closePathCorr;\r\n idx[p] = idc;\r\n idc += (l + closePathCorr);\r\n }\r\n // vertical distances (v)\r\n var path1;\r\n var path2;\r\n var vertex1 = null;\r\n var vertex2 = null;\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n vTotalDistance[i] = 0;\r\n vs[i] = [0];\r\n for (p = 0; p < pathArray.length - 1; p++) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[p + 1];\r\n if (i === minlg) { // closePath\r\n vertex1 = path1[0];\r\n vertex2 = path2[0];\r\n }\r\n else {\r\n vertex1 = path1[i];\r\n vertex2 = path2[i];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vs[i].push(dist);\r\n vTotalDistance[i] = dist;\r\n }\r\n if (closeArray && vertex2 && vertex1) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[0];\r\n if (i === minlg) { // closePath\r\n vertex2 = path2[0];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vTotalDistance[i] = dist;\r\n }\r\n }\r\n // uvs\r\n var u;\r\n var v;\r\n if (customUV) {\r\n for (p = 0; p < customUV.length; p++) {\r\n uvs.push(customUV[p].x, customUV[p].y);\r\n }\r\n }\r\n else {\r\n for (p = 0; p < pathArray.length; p++) {\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n u = (uTotalDistance[p] != 0.0) ? us[p][i] / uTotalDistance[p] : 0.0;\r\n v = (vTotalDistance[i] != 0.0) ? vs[i][p] / vTotalDistance[i] : 0.0;\r\n if (invertUV) {\r\n uvs.push(v, u);\r\n }\r\n else {\r\n uvs.push(u, v);\r\n }\r\n }\r\n }\r\n }\r\n // indices\r\n p = 0; // path index\r\n var pi = 0; // positions array index\r\n var l1 = lg[p] - 1; // path1 length\r\n var l2 = lg[p + 1] - 1; // path2 length\r\n var min = (l1 < l2) ? l1 : l2; // current path stop index\r\n var shft = idx[1] - idx[0]; // shift\r\n var path1nb = closeArray ? lg.length : lg.length - 1; // number of path1 to iterate\ton\r\n while (pi <= min && p < path1nb) { // stay under min and don't go over next to last path\r\n // draw two triangles between path1 (p1) and path2 (p2) : (p1.pi, p2.pi, p1.pi+1) and (p2.pi+1, p1.pi+1, p2.pi) clockwise\r\n indices.push(pi, pi + shft, pi + 1);\r\n indices.push(pi + shft + 1, pi + 1, pi + shft);\r\n pi += 1;\r\n if (pi === min) { // if end of one of two consecutive paths reached, go to next existing path\r\n p++;\r\n if (p === lg.length - 1) { // last path of pathArray reached <=> closeArray == true\r\n shft = idx[0] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[0] - 1;\r\n }\r\n else {\r\n shft = idx[p + 1] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[p + 1] - 1;\r\n }\r\n pi = idx[p];\r\n min = (l1 < l2) ? l1 + pi : l2 + pi;\r\n }\r\n }\r\n // normals\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n if (closePath) { // update both the first and last vertex normals to their average value\r\n var indexFirst = 0;\r\n var indexLast = 0;\r\n for (p = 0; p < pathArray.length; p++) {\r\n indexFirst = idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (idx[p + 1] - 1) * 3;\r\n }\r\n else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Colors\r\n var colors = null;\r\n if (customColors) {\r\n colors = new Float32Array(customColors.length * 4);\r\n for (var c = 0; c < customColors.length; c++) {\r\n colors[c * 4] = customColors[c].r;\r\n colors[c * 4 + 1] = customColors[c].g;\r\n colors[c * 4 + 2] = customColors[c].b;\r\n colors[c * 4 + 3] = customColors[c].a;\r\n }\r\n }\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n var positions32 = new Float32Array(positions);\r\n var normals32 = new Float32Array(normals);\r\n var uvs32 = new Float32Array(uvs);\r\n vertexData.indices = indices;\r\n vertexData.positions = positions32;\r\n vertexData.normals = normals32;\r\n vertexData.uvs = uvs32;\r\n if (colors) {\r\n vertexData.set(colors, _buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n }\r\n if (closePath) {\r\n vertexData._idx = idx;\r\n }\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateRibbon = function (name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\r\n if (closeArray === void 0) { closeArray = false; }\r\n if (updatable === void 0) { updatable = false; }\r\n return RibbonBuilder.CreateRibbon(name, {\r\n pathArray: pathArray,\r\n closeArray: closeArray,\r\n closePath: closePath,\r\n offset: offset,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance\r\n }, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar RibbonBuilder = /** @class */ (function () {\r\n function RibbonBuilder() {\r\n }\r\n /**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#ribbon\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ribbon mesh\r\n * @see https://doc.babylonjs.com/how_to/ribbon_tutorial\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n */\r\n RibbonBuilder.CreateRibbon = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var pathArray = options.pathArray;\r\n var closeArray = options.closeArray;\r\n var closePath = options.closePath;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var instance = options.instance;\r\n var updatable = options.updatable;\r\n if (instance) { // existing ribbon instance update\r\n // positionFunction : ribbon case\r\n // only pathArray and sideOrientation parameters are taken into account for positions update\r\n var minimum_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0].setAll(Number.MAX_VALUE);\r\n var maximum_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[1].setAll(-Number.MAX_VALUE);\r\n var positionFunction = function (positions) {\r\n var minlg = pathArray[0].length;\r\n var mesh = instance;\r\n var i = 0;\r\n var ns = (mesh._originalBuilderSideOrientation === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].DOUBLESIDE) ? 2 : 1;\r\n for (var si = 1; si <= ns; ++si) {\r\n for (var p = 0; p < pathArray.length; ++p) {\r\n var path = pathArray[p];\r\n var l = path.length;\r\n minlg = (minlg < l) ? minlg : l;\r\n for (var j = 0; j < minlg; ++j) {\r\n var pathPoint = path[j];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n minimum_1.minimizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n maximum_1.maximizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n i += 3;\r\n }\r\n if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {\r\n var pathPoint = path[0];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n i += 3;\r\n }\r\n }\r\n }\r\n };\r\n var positions = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n positionFunction(positions);\r\n if (instance._boundingInfo) {\r\n instance._boundingInfo.reConstruct(minimum_1, maximum_1, instance._worldMatrix);\r\n }\r\n else {\r\n instance._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_4__[\"BoundingInfo\"](minimum_1, maximum_1, instance._worldMatrix);\r\n }\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, positions, false, false);\r\n if (options.colors) {\r\n var colors = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n for (var c = 0, colorIndex = 0; c < options.colors.length; c++, colorIndex += 4) {\r\n var color = options.colors[c];\r\n colors[colorIndex] = color.r;\r\n colors[colorIndex + 1] = color.g;\r\n colors[colorIndex + 2] = color.b;\r\n colors[colorIndex + 3] = color.a;\r\n }\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind, colors, false, false);\r\n }\r\n if (options.uvs) {\r\n var uvs = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n for (var i = 0; i < options.uvs.length; i++) {\r\n uvs[i * 2] = options.uvs[i].x;\r\n uvs[i * 2 + 1] = options.uvs[i].y;\r\n }\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind, uvs, false, false);\r\n }\r\n if (!instance.areNormalsFrozen || instance.isFacetDataEnabled) {\r\n var indices = instance.getIndices();\r\n var normals = instance.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions, indices, normals, params);\r\n if (instance._creationDataStorage && instance._creationDataStorage.closePath) {\r\n var indexFirst = 0;\r\n var indexLast = 0;\r\n for (var p = 0; p < pathArray.length; p++) {\r\n indexFirst = instance._creationDataStorage.idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (instance._creationDataStorage.idx[p + 1] - 1) * 3;\r\n }\r\n else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n if (!(instance.areNormalsFrozen)) {\r\n instance.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind, normals, false, false);\r\n }\r\n }\r\n return instance;\r\n }\r\n else { // new ribbon creation\r\n var ribbon = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n ribbon._originalBuilderSideOrientation = sideOrientation;\r\n ribbon._creationDataStorage = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"_CreationDataStorage\"]();\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateRibbon(options);\r\n if (closePath) {\r\n ribbon._creationDataStorage.idx = vertexData._idx;\r\n }\r\n ribbon._creationDataStorage.closePath = closePath;\r\n ribbon._creationDataStorage.closeArray = closeArray;\r\n vertexData.applyToMesh(ribbon, updatable);\r\n return ribbon;\r\n }\r\n };\r\n return RibbonBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/shapeBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/shapeBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: ShapeBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return ShapeBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].ExtrudeShape = function (name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n shape: shape,\r\n path: path,\r\n scale: scale,\r\n rotation: rotation,\r\n cap: (cap === 0) ? 0 : cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable\r\n };\r\n return ShapeBuilder.ExtrudeShape(name, options, scene);\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].ExtrudeShapeCustom = function (name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\r\n var options = {\r\n shape: shape,\r\n path: path,\r\n scaleFunction: scaleFunction,\r\n rotationFunction: rotationFunction,\r\n ribbonCloseArray: ribbonCloseArray,\r\n ribbonClosePath: ribbonClosePath,\r\n cap: (cap === 0) ? 0 : cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable\r\n };\r\n return ShapeBuilder.ExtrudeShapeCustom(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar ShapeBuilder = /** @class */ (function () {\r\n function ShapeBuilder() {\r\n }\r\n /**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n ShapeBuilder.ExtrudeShape = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var path = options.path;\r\n var shape = options.shape;\r\n var scale = options.scale || 1;\r\n var rotation = options.rotation || 0;\r\n var cap = (options.cap === 0) ? 0 : options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var instance = options.instance || null;\r\n var invertUV = options.invertUV || false;\r\n return ShapeBuilder._ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, false, false, cap, false, scene, updatable ? true : false, sideOrientation, instance, invertUV, options.frontUVs || null, options.backUVs || null);\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n ShapeBuilder.ExtrudeShapeCustom = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var path = options.path;\r\n var shape = options.shape;\r\n var scaleFunction = options.scaleFunction || (function () { return 1; });\r\n var rotationFunction = options.rotationFunction || (function () { return 0; });\r\n var ribbonCloseArray = options.ribbonCloseArray || false;\r\n var ribbonClosePath = options.ribbonClosePath || false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n var instance = options.instance;\r\n var invertUV = options.invertUV || false;\r\n return ShapeBuilder._ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable ? true : false, sideOrientation, instance || null, invertUV, options.frontUVs || null, options.backUVs || null);\r\n };\r\n ShapeBuilder._ExtrudeShapeGeneric = function (name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV, frontUVs, backUVs) {\r\n // extrusion geometry\r\n var extrusionPathArray = function (shape, curve, path3D, shapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom) {\r\n var tangents = path3D.getTangents();\r\n var normals = path3D.getNormals();\r\n var binormals = path3D.getBinormals();\r\n var distances = path3D.getDistances();\r\n var angle = 0;\r\n var returnScale = function () { return scale !== null ? scale : 1; };\r\n var returnRotation = function () { return rotation !== null ? rotation : 0; };\r\n var rotate = custom && rotateFunction ? rotateFunction : returnRotation;\r\n var scl = custom && scaleFunction ? scaleFunction : returnScale;\r\n var index = (cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP || cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END) ? 0 : 2;\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n for (var i = 0; i < curve.length; i++) {\r\n var shapePath = new Array();\r\n var angleStep = rotate(i, distances[i]);\r\n var scaleRatio = scl(i, distances[i]);\r\n for (var p = 0; p < shape.length; p++) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(tangents[i], angle, rotationMatrix);\r\n var planed = ((tangents[i].scale(shape[p].z)).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y)));\r\n var rotated = shapePath[p] ? shapePath[p] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(planed, rotationMatrix, rotated);\r\n rotated.scaleInPlace(scaleRatio).addInPlace(curve[i]);\r\n shapePath[p] = rotated;\r\n }\r\n shapePaths[index] = shapePath;\r\n angle += angleStep;\r\n index++;\r\n }\r\n // cap\r\n var capPath = function (shapePath) {\r\n var pointCap = Array();\r\n var barycenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var i;\r\n for (i = 0; i < shapePath.length; i++) {\r\n barycenter.addInPlace(shapePath[i]);\r\n }\r\n barycenter.scaleInPlace(1.0 / shapePath.length);\r\n for (i = 0; i < shapePath.length; i++) {\r\n pointCap.push(barycenter);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP:\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_START:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END:\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n default:\r\n break;\r\n }\r\n return shapePaths;\r\n };\r\n var path3D;\r\n var pathArray;\r\n if (instance) { // instance update\r\n var storage = instance._creationDataStorage;\r\n path3D = storage.path3D.update(curve);\r\n pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom);\r\n instance = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateRibbon(\"\", pathArray, false, false, 0, scene || undefined, false, 0, instance);\r\n return instance;\r\n }\r\n // extruded shape creation\r\n path3D = new _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__[\"Path3D\"](curve);\r\n var newShapePaths = new Array();\r\n cap = (cap < 0 || cap > 3) ? 0 : cap;\r\n pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom);\r\n var extrudedGeneric = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(name, { pathArray: pathArray, closeArray: rbCA, closePath: rbCP, updatable: updtbl, sideOrientation: side, invertUV: invertUV, frontUVs: frontUVs || undefined, backUVs: backUVs || undefined }, scene);\r\n extrudedGeneric._creationDataStorage.pathArray = pathArray;\r\n extrudedGeneric._creationDataStorage.path3D = path3D;\r\n extrudedGeneric._creationDataStorage.cap = cap;\r\n return extrudedGeneric;\r\n };\r\n return ShapeBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/sphereBuilder.ts\":\n/*!******************************************!*\\\n !*** ./Meshes/Builders/sphereBuilder.ts ***!\n \\******************************************/\n/*! exports provided: SphereBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return SphereBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateSphere = function (options) {\r\n var segments = options.segments || 32;\r\n var diameterX = options.diameterX || options.diameter || 1;\r\n var diameterY = options.diameterY || options.diameter || 1;\r\n var diameterZ = options.diameterZ || options.diameter || 1;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var slice = options.slice && (options.slice <= 0) ? 1.0 : options.slice || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n var radius = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](diameterX / 2, diameterY / 2, diameterZ / 2);\r\n var totalZRotationSteps = 2 + segments;\r\n var totalYRotationSteps = 2 * totalZRotationSteps;\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n for (var zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {\r\n var normalizedZ = zRotationStep / totalZRotationSteps;\r\n var angleZ = normalizedZ * Math.PI * slice;\r\n for (var yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {\r\n var normalizedY = yRotationStep / totalYRotationSteps;\r\n var angleY = normalizedY * Math.PI * 2 * arc;\r\n var rotationZ = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationZ(-angleZ);\r\n var rotationY = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(angleY);\r\n var afterRotZ = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Up(), rotationZ);\r\n var complete = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(afterRotZ, rotationY);\r\n var vertex = complete.multiply(radius);\r\n var normal = complete.divide(radius).normalize();\r\n positions.push(vertex.x, vertex.y, vertex.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(normalizedY, normalizedZ);\r\n }\r\n if (zRotationStep > 0) {\r\n var verticesCount = positions.length / 3;\r\n for (var firstIndex = verticesCount - 2 * (totalYRotationSteps + 1); (firstIndex + totalYRotationSteps + 2) < verticesCount; firstIndex++) {\r\n indices.push((firstIndex));\r\n indices.push((firstIndex + 1));\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push((firstIndex + totalYRotationSteps + 1));\r\n indices.push((firstIndex + 1));\r\n indices.push((firstIndex + totalYRotationSteps + 2));\r\n }\r\n }\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n var options = {\r\n segments: segments,\r\n diameterX: diameter,\r\n diameterY: diameter,\r\n diameterZ: diameter,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return SphereBuilder.CreateSphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar SphereBuilder = /** @class */ (function () {\r\n function SphereBuilder() {\r\n }\r\n /**\r\n * Creates a sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the sphere mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#sphere\r\n */\r\n SphereBuilder.CreateSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var sphere = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateSphere(options);\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n return sphere;\r\n };\r\n return SphereBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/tiledBoxBuilder.ts\":\n/*!********************************************!*\\\n !*** ./Meshes/Builders/tiledBoxBuilder.ts ***!\n \\********************************************/\n/*! exports provided: TiledBoxBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return TiledBoxBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledBox = function (options) {\r\n var nbFaces = 6;\r\n var faceUV = options.faceUV || new Array(6);\r\n var faceColors = options.faceColors;\r\n var flipTile = options.pattern || _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].NO_FLIP;\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var tileWidth = options.tileWidth || options.tileSize || 1;\r\n var tileHeight = options.tileHeight || options.tileSize || 1;\r\n var alignH = options.alignHorizontal || 0;\r\n var alignV = options.alignVertical || 0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DEFAULTSIDE;\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < nbFaces; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1, 1, 1, 1);\r\n }\r\n }\r\n var halfWidth = width / 2;\r\n var halfHeight = height / 2;\r\n var halfDepth = depth / 2;\r\n var faceVertexData = [];\r\n for (var f = 0; f < 2; f++) { //front and back\r\n faceVertexData[f] = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledPlane({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation\r\n });\r\n }\r\n for (var f = 2; f < 4; f++) { //sides\r\n faceVertexData[f] = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledPlane({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: depth,\r\n height: height,\r\n alignVertical: alignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation\r\n });\r\n }\r\n var baseAlignV = alignV;\r\n if (alignV === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BOTTOM) {\r\n baseAlignV = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].TOP;\r\n }\r\n else if (alignV === _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].TOP) {\r\n baseAlignV = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].BOTTOM;\r\n }\r\n for (var f = 4; f < 6; f++) { //top and bottom\r\n faceVertexData[f] = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledPlane({\r\n pattern: flipTile,\r\n tileWidth: tileWidth,\r\n tileHeight: tileHeight,\r\n width: width,\r\n height: depth,\r\n alignVertical: baseAlignV,\r\n alignHorizontal: alignH,\r\n sideOrientation: sideOrientation\r\n });\r\n }\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var indices = [];\r\n var colors = [];\r\n var facePositions = [];\r\n var faceNormals = [];\r\n var newFaceUV = [];\r\n var len = 0;\r\n var lu = 0;\r\n var li = 0;\r\n for (var f = 0; f < nbFaces; f++) {\r\n var len = faceVertexData[f].positions.length;\r\n facePositions[f] = [];\r\n faceNormals[f] = [];\r\n for (var p = 0; p < len / 3; p++) {\r\n facePositions[f].push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](faceVertexData[f].positions[3 * p], faceVertexData[f].positions[3 * p + 1], faceVertexData[f].positions[3 * p + 2]));\r\n faceNormals[f].push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](faceVertexData[f].normals[3 * p], faceVertexData[f].normals[3 * p + 1], faceVertexData[f].normals[3 * p + 2]));\r\n }\r\n // uvs\r\n lu = faceVertexData[f].uvs.length;\r\n newFaceUV[f] = [];\r\n for (var i = 0; i < lu; i += 2) {\r\n newFaceUV[f][i] = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * faceVertexData[f].uvs[i];\r\n newFaceUV[f][i + 1] = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * faceVertexData[f].uvs[i + 1];\r\n }\r\n uvs = uvs.concat(newFaceUV[f]);\r\n indices = indices.concat(faceVertexData[f].indices.map(function (x) { return x + li; }));\r\n li += facePositions[f].length;\r\n if (faceColors) {\r\n for (var c = 0; c < 4; c++) {\r\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\r\n }\r\n }\r\n }\r\n var vec0 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, halfDepth);\r\n var mtrx0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(Math.PI);\r\n positions = facePositions[0].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx0).add(vec0); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []);\r\n normals = faceNormals[0].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx0); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []);\r\n positions = positions.concat(facePositions[1].map(function (entry) { return entry.subtract(vec0); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[1].map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var vec2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](halfWidth, 0, 0);\r\n var mtrx2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(-Math.PI / 2);\r\n positions = positions.concat(facePositions[2].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx2).add(vec2); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[2].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx2); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var mtrx3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(Math.PI / 2);\r\n positions = positions.concat(facePositions[3].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx3).subtract(vec2); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[3].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx3); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var vec4 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, halfHeight, 0);\r\n var mtrx4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationX(Math.PI / 2);\r\n positions = positions.concat(facePositions[4].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx4).add(vec4); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[4].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx4); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n var mtrx5 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationX(-Math.PI / 2);\r\n positions = positions.concat(facePositions[5].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx5).subtract(vec4); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n normals = normals.concat(faceNormals[5].map(function (entry) { return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(entry, mtrx5); }).map(function (entry) { return [entry.x, entry.y, entry.z]; }).reduce(function (accumulator, currentValue) { return accumulator.concat(currentValue); }, []));\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TiledBoxBuilder = /** @class */ (function () {\r\n function TiledBoxBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * faceTiles sets the pattern, tile size and number of tiles for a face * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n TiledBoxBuilder.CreateTiledBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var box = new _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateTiledBox(options);\r\n vertexData.applyToMesh(box, options.updatable);\r\n return box;\r\n };\r\n return TiledBoxBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/tiledPlaneBuilder.ts\":\n/*!**********************************************!*\\\n !*** ./Meshes/Builders/tiledPlaneBuilder.ts ***!\n \\**********************************************/\n/*! exports provided: TiledPlaneBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return TiledPlaneBuilder; });\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateTiledPlane = function (options) {\r\n var flipTile = options.pattern || _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].NO_FLIP;\r\n var tileWidth = options.tileWidth || options.tileSize || 1;\r\n var tileHeight = options.tileHeight || options.tileSize || 1;\r\n var alignH = options.alignHorizontal || 0;\r\n var alignV = options.alignVertical || 0;\r\n var width = options.width || options.size || 1;\r\n var tilesX = Math.floor(width / tileWidth);\r\n var offsetX = width - tilesX * tileWidth;\r\n var height = options.height || options.size || 1;\r\n var tilesY = Math.floor(height / tileHeight);\r\n var offsetY = height - tilesY * tileHeight;\r\n var halfWidth = tileWidth * tilesX / 2;\r\n var halfHeight = tileHeight * tilesY / 2;\r\n var adjustX = 0;\r\n var adjustY = 0;\r\n var startX = 0;\r\n var startY = 0;\r\n var endX = 0;\r\n var endY = 0;\r\n //Part Tiles\r\n if (offsetX > 0 || offsetY > 0) {\r\n startX = -halfWidth;\r\n startY = -halfHeight;\r\n var endX = halfWidth;\r\n var endY = halfHeight;\r\n switch (alignH) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER:\r\n offsetX /= 2;\r\n startX -= offsetX;\r\n endX += offsetX;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].LEFT:\r\n endX += offsetX;\r\n adjustX = -offsetX / 2;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].RIGHT:\r\n startX -= offsetX;\r\n adjustX = offsetX / 2;\r\n break;\r\n }\r\n switch (alignV) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER:\r\n offsetY /= 2;\r\n startY -= offsetY;\r\n endY += offsetY;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].BOTTOM:\r\n endY += offsetY;\r\n adjustY = -offsetY / 2;\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].TOP:\r\n startY -= offsetY;\r\n adjustY = offsetY / 2;\r\n break;\r\n }\r\n }\r\n var positions = [];\r\n var normals = [];\r\n var uvBase = [];\r\n uvBase[0] = [0, 0, 1, 0, 1, 1, 0, 1];\r\n uvBase[1] = [0, 0, 1, 0, 1, 1, 0, 1];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBase[1] = [1, 1, 0, 1, 0, 0, 1, 0];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBase[1] = [1, 0, 0, 0, 0, 1, 1, 1];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBase[1] = [0, 1, 1, 1, 1, 0, 0, 0];\r\n }\r\n var uvs = [];\r\n var colors = [];\r\n var indices = [];\r\n var index = 0;\r\n for (var y = 0; y < tilesY; y++) {\r\n for (var x = 0; x < tilesX; x++) {\r\n positions.push(-halfWidth + x * tileWidth + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n positions.push(-halfWidth + x * tileWidth + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBase[(x % 2 + y % 2) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBase[y % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBase[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n index += 4;\r\n }\r\n }\r\n //Part Tiles\r\n if (offsetX > 0 || offsetY > 0) {\r\n var partialBottomRow = (offsetY > 0 && (alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].TOP));\r\n var partialTopRow = (offsetY > 0 && (alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignV === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].BOTTOM));\r\n var partialLeftCol = (offsetX > 0 && (alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].RIGHT));\r\n var partialRightCol = (offsetX > 0 && (alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].CENTER || alignH === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].LEFT));\r\n var uvPart = [];\r\n var a, b, c, d;\r\n //corners\r\n if (partialBottomRow && partialLeftCol) { //bottom left corner\r\n positions.push(startX + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, startY + offsetY + adjustY, 0);\r\n positions.push(startX + adjustX, startY + offsetY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 1 - offsetX / tileWidth;\r\n b = 1 - offsetY / tileHeight;\r\n c = 1;\r\n d = 1;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n if (partialBottomRow && partialRightCol) { //bottom right corner\r\n positions.push(halfWidth + adjustX, startY + adjustY, 0);\r\n positions.push(endX + adjustX, startY + adjustY, 0);\r\n positions.push(endX + adjustX, startY + offsetY + adjustY, 0);\r\n positions.push(halfWidth + adjustX, startY + offsetY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 0,\r\n b = 1 - offsetY / tileHeight;\r\n c = offsetX / tileWidth;\r\n d = 1;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE && (tilesX % 2) === 0)) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE && (tilesX % 2) === 0)) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE && (tilesX % 2) === 0)) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n if (partialTopRow && partialLeftCol) { //top left corner\r\n positions.push(startX + adjustX, halfHeight + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, halfHeight + adjustY, 0);\r\n positions.push(-halfWidth + adjustX, endY + adjustY, 0);\r\n positions.push(startX + adjustX, endY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 1 - offsetX / tileWidth;\r\n b = 0;\r\n c = 1;\r\n d = offsetY / tileHeight;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE && (tilesY % 1) === 0)) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE && (tilesY % 2) === 0)) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE && (tilesY % 2) === 0)) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n if (partialTopRow && partialRightCol) { //top right corner\r\n positions.push(halfWidth + adjustX, halfHeight + adjustY, 0);\r\n positions.push(endX + adjustX, halfHeight + adjustY, 0);\r\n positions.push(endX + adjustX, endY + adjustY, 0);\r\n positions.push(halfWidth + adjustX, endY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n a = 0,\r\n b = 0;\r\n c = offsetX / tileWidth;\r\n d = offsetY / tileHeight;\r\n uvPart = [a, b, c, b, c, d, a, d];\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE && (tilesY + tilesX) % 2 === 1)) {\r\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE && (tilesY + tilesX) % 2 === 1)) {\r\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if ((flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW && (tilesY % 2) === 1) || (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE && (tilesY + tilesX) % 2 === 1)) {\r\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n uvs = uvs.concat(uvPart);\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n //part rows\r\n if (partialBottomRow) {\r\n var uvBaseBR = [];\r\n a = 0;\r\n b = 1 - offsetY / tileHeight;\r\n c = 1;\r\n d = 1;\r\n uvBaseBR[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseBR[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseBR[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseBR[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseBR[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var x = 0; x < tilesX; x++) {\r\n positions.push(-halfWidth + x * tileWidth + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, startY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, startY + offsetY + adjustY, 0);\r\n positions.push(-halfWidth + x * tileWidth + adjustX, startY + offsetY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseBR[(x + 1) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseBR[1]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseBR[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n if (partialTopRow) {\r\n var uvBaseTR = [];\r\n a = 0;\r\n b = 0;\r\n c = 1;\r\n d = offsetY / tileHeight;\r\n uvBaseTR[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseTR[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseTR[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseTR[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseTR[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var x = 0; x < tilesX; x++) {\r\n positions.push(-halfWidth + x * tileWidth + adjustX, endY - offsetY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, endY - offsetY + adjustY, 0);\r\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, endY + adjustY, 0);\r\n positions.push(-halfWidth + x * tileWidth + adjustX, endY + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseTR[(x + tilesY) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseTR[tilesY % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseTR[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n if (partialLeftCol) {\r\n var uvBaseLC = [];\r\n a = 1 - offsetX / tileWidth;\r\n b = 0;\r\n c = 1;\r\n d = 1;\r\n uvBaseLC[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseLC[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseLC[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseLC[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseLC[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var y = 0; y < tilesY; y++) {\r\n positions.push(startX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(startX + offsetX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(startX + offsetX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n positions.push(startX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseLC[(y + 1) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseLC[y % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseLC[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n if (partialRightCol) {\r\n var uvBaseRC = [];\r\n a = 0;\r\n b = 0;\r\n c = offsetX / tileHeight;\r\n d = 1;\r\n uvBaseRC[0] = [a, b, c, b, c, d, a, d];\r\n uvBaseRC[1] = [a, b, c, b, c, d, a, d];\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW) {\r\n uvBaseRC[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW) {\r\n uvBaseRC[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\r\n }\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvBaseRC[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\r\n }\r\n for (var y = 0; y < tilesY; y++) {\r\n positions.push(endX - offsetX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(endX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\r\n positions.push(endX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n positions.push(endX - offsetX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\r\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\r\n index += 4;\r\n if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_TILE || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_TILE) {\r\n uvs = uvs.concat(uvBaseRC[(y + tilesX) % 2]);\r\n }\r\n else if (flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].ROTATE_ROW || flipTile === _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].FLIP_N_ROTATE_ROW) {\r\n uvs = uvs.concat(uvBaseRC[y % 2]);\r\n }\r\n else {\r\n uvs = uvs.concat(uvBaseRC[0]);\r\n }\r\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\r\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\r\n }\r\n }\r\n }\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DEFAULTSIDE;\r\n // sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n var totalColors = (sideOrientation === _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n return vertexData;\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TiledPlaneBuilder = /** @class */ (function () {\r\n function TiledPlaneBuilder() {\r\n }\r\n /**\r\n * Creates a tiled plane mesh\r\n * * The parameter `pattern` will, depending on value, do nothing or\r\n * * * flip (reflect about central vertical) alternate tiles across and up\r\n * * * flip every tile on alternate rows\r\n * * * rotate (180 degs) alternate tiles across and up\r\n * * * rotate every tile on alternate rows\r\n * * * flip and rotate alternate tiles across and up\r\n * * * flip and rotate every tile on alternate rows\r\n * * The parameter `tileSize` sets the size (float) of each tile side (default 1)\r\n * * You can set some different tile dimensions by using the parameters `tileWidth` and `tileHeight` (both by default have the same value of `tileSize`)\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n TiledPlaneBuilder.CreateTiledPlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var plane = new _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n plane._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"].CreateTiledPlane(options);\r\n vertexData.applyToMesh(plane, options.updatable);\r\n return plane;\r\n };\r\n return TiledPlaneBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/torusBuilder.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/Builders/torusBuilder.ts ***!\n \\*****************************************/\n/*! exports provided: TorusBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return TorusBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorus = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var diameter = options.diameter || 1;\r\n var thickness = options.thickness || 0.5;\r\n var tessellation = options.tessellation || 16;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n var stride = tessellation + 1;\r\n for (var i = 0; i <= tessellation; i++) {\r\n var u = i / tessellation;\r\n var outerAngle = i * Math.PI * 2.0 / tessellation - Math.PI / 2.0;\r\n var transform = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Translation(diameter / 2.0, 0, 0).multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationY(outerAngle));\r\n for (var j = 0; j <= tessellation; j++) {\r\n var v = 1 - j / tessellation;\r\n var innerAngle = j * Math.PI * 2.0 / tessellation + Math.PI;\r\n var dx = Math.cos(innerAngle);\r\n var dy = Math.sin(innerAngle);\r\n // Create a vertex.\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](dx, dy, 0);\r\n var position = normal.scale(thickness / 2);\r\n var textureCoordinate = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](u, v);\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(position, transform);\r\n normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(normal, transform);\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(textureCoordinate.x, textureCoordinate.y);\r\n // And create indices for two triangles.\r\n var nextI = (i + 1) % stride;\r\n var nextJ = (j + 1) % stride;\r\n indices.push(i * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n }\r\n }\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n var options = {\r\n diameter: diameter,\r\n thickness: thickness,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return TorusBuilder.CreateTorus(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TorusBuilder = /** @class */ (function () {\r\n function TorusBuilder() {\r\n }\r\n /**\r\n * Creates a torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (postive integer, default 16)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus\r\n */\r\n TorusBuilder.CreateTorus = function (name, options, scene) {\r\n var torus = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n torus._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorus(options);\r\n vertexData.applyToMesh(torus, options.updatable);\r\n return torus;\r\n };\r\n return TorusBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/torusKnotBuilder.ts\":\n/*!*********************************************!*\\\n !*** ./Meshes/Builders/torusKnotBuilder.ts ***!\n \\*********************************************/\n/*! exports provided: TorusKnotBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return TorusKnotBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorusKnot = function (options) {\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var radius = options.radius || 2;\r\n var tube = options.tube || 0.5;\r\n var radialSegments = options.radialSegments || 32;\r\n var tubularSegments = options.tubularSegments || 32;\r\n var p = options.p || 2;\r\n var q = options.q || 3;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].DEFAULTSIDE;\r\n // Helper\r\n var getPos = function (angle) {\r\n var cu = Math.cos(angle);\r\n var su = Math.sin(angle);\r\n var quOverP = q / p * angle;\r\n var cs = Math.cos(quOverP);\r\n var tx = radius * (2 + cs) * 0.5 * cu;\r\n var ty = radius * (2 + cs) * su * 0.5;\r\n var tz = radius * Math.sin(quOverP) * 0.5;\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](tx, ty, tz);\r\n };\r\n // Vertices\r\n var i;\r\n var j;\r\n for (i = 0; i <= radialSegments; i++) {\r\n var modI = i % radialSegments;\r\n var u = modI / radialSegments * 2 * p * Math.PI;\r\n var p1 = getPos(u);\r\n var p2 = getPos(u + 0.01);\r\n var tang = p2.subtract(p1);\r\n var n = p2.add(p1);\r\n var bitan = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(tang, n);\r\n n = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(bitan, tang);\r\n bitan.normalize();\r\n n.normalize();\r\n for (j = 0; j < tubularSegments; j++) {\r\n var modJ = j % tubularSegments;\r\n var v = modJ / tubularSegments * 2 * Math.PI;\r\n var cx = -tube * Math.cos(v);\r\n var cy = tube * Math.sin(v);\r\n positions.push(p1.x + cx * n.x + cy * bitan.x);\r\n positions.push(p1.y + cx * n.y + cy * bitan.y);\r\n positions.push(p1.z + cx * n.z + cy * bitan.z);\r\n uvs.push(i / radialSegments);\r\n uvs.push(j / tubularSegments);\r\n }\r\n }\r\n for (i = 0; i < radialSegments; i++) {\r\n for (j = 0; j < tubularSegments; j++) {\r\n var jNext = (j + 1) % tubularSegments;\r\n var a = i * tubularSegments + j;\r\n var b = (i + 1) * tubularSegments + j;\r\n var c = (i + 1) * tubularSegments + jNext;\r\n var d = i * tubularSegments + jNext;\r\n indices.push(d);\r\n indices.push(b);\r\n indices.push(a);\r\n indices.push(d);\r\n indices.push(c);\r\n indices.push(b);\r\n }\r\n }\r\n // Normals\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n // Sides\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTorusKnot = function (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\r\n var options = {\r\n radius: radius,\r\n tube: tube,\r\n radialSegments: radialSegments,\r\n tubularSegments: tubularSegments,\r\n p: p,\r\n q: q,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return TorusKnotBuilder.CreateTorusKnot(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TorusKnotBuilder = /** @class */ (function () {\r\n function TorusKnotBuilder() {\r\n }\r\n /**\r\n * Creates a torus knot mesh\r\n * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)\r\n * * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32)\r\n * * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus knot mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus-knot\r\n */\r\n TorusKnotBuilder.CreateTorusKnot = function (name, options, scene) {\r\n var torusKnot = new _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"](name, scene);\r\n options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n torusKnot._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].CreateTorusKnot(options);\r\n vertexData.applyToMesh(torusKnot, options.updatable);\r\n return torusKnot;\r\n };\r\n return TorusKnotBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Builders/tubeBuilder.ts\":\n/*!****************************************!*\\\n !*** ./Meshes/Builders/tubeBuilder.ts ***!\n \\****************************************/\n/*! exports provided: TubeBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return TubeBuilder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n\r\n\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\r\n var options = {\r\n path: path,\r\n radius: radius,\r\n tessellation: tessellation,\r\n radiusFunction: radiusFunction,\r\n arc: 1,\r\n cap: cap,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance\r\n };\r\n return TubeBuilder.CreateTube(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TubeBuilder = /** @class */ (function () {\r\n function TubeBuilder() {\r\n }\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * * The parameter `radius` (positive float, default 1) sets the tube radius size\r\n * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface\r\n * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`\r\n * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)\r\n * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#tube\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tube mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tube\r\n */\r\n TubeBuilder.CreateTube = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var path = options.path;\r\n var instance = options.instance;\r\n var radius = 1.0;\r\n if (options.radius !== undefined) {\r\n radius = options.radius;\r\n }\r\n else if (instance) {\r\n radius = instance._creationDataStorage.radius;\r\n }\r\n var tessellation = options.tessellation || 64 | 0;\r\n var radiusFunction = options.radiusFunction || null;\r\n var cap = options.cap || _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP;\r\n var invertUV = options.invertUV || false;\r\n var updatable = options.updatable;\r\n var sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]._GetDefaultSideOrientation(options.sideOrientation);\r\n options.arc = options.arc && (options.arc <= 0.0 || options.arc > 1.0) ? 1.0 : options.arc || 1.0;\r\n // tube geometry\r\n var tubePathArray = function (path, path3D, circlePaths, radius, tessellation, radiusFunction, cap, arc) {\r\n var tangents = path3D.getTangents();\r\n var normals = path3D.getNormals();\r\n var distances = path3D.getDistances();\r\n var pi2 = Math.PI * 2;\r\n var step = pi2 / tessellation * arc;\r\n var returnRadius = function () { return radius; };\r\n var radiusFunctionFinal = radiusFunction || returnRadius;\r\n var circlePath;\r\n var rad;\r\n var normal;\r\n var rotated;\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var index = (cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP || cap === _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END) ? 0 : 2;\r\n for (var i = 0; i < path.length; i++) {\r\n rad = radiusFunctionFinal(i, distances[i]); // current radius\r\n circlePath = Array(); // current circle array\r\n normal = normals[i]; // current normal\r\n for (var t = 0; t < tessellation; t++) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].RotationAxisToRef(tangents[i], step * t, rotationMatrix);\r\n rotated = circlePath[t] ? circlePath[t] : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(normal, rotationMatrix, rotated);\r\n rotated.scaleInPlace(rad).addInPlace(path[i]);\r\n circlePath[t] = rotated;\r\n }\r\n circlePaths[index] = circlePath;\r\n index++;\r\n }\r\n // cap\r\n var capPath = function (nbPoints, pathIndex) {\r\n var pointCap = Array();\r\n for (var i = 0; i < nbPoints; i++) {\r\n pointCap.push(path[pathIndex]);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].NO_CAP:\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_START:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_END:\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n case _mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].CAP_ALL:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n default:\r\n break;\r\n }\r\n return circlePaths;\r\n };\r\n var path3D;\r\n var pathArray;\r\n if (instance) { // tube update\r\n var storage = instance._creationDataStorage;\r\n var arc = options.arc || storage.arc;\r\n path3D = storage.path3D.update(path);\r\n pathArray = tubePathArray(path, path3D, storage.pathArray, radius, storage.tessellation, radiusFunction, storage.cap, arc);\r\n instance = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(\"\", { pathArray: pathArray, instance: instance });\r\n // Update mode, no need to recreate the storage.\r\n storage.path3D = path3D;\r\n storage.pathArray = pathArray;\r\n storage.arc = arc;\r\n storage.radius = radius;\r\n return instance;\r\n }\r\n // tube creation\r\n path3D = new _Maths_math_path__WEBPACK_IMPORTED_MODULE_3__[\"Path3D\"](path);\r\n var newPathArray = new Array();\r\n cap = (cap < 0 || cap > 3) ? 0 : cap;\r\n pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);\r\n var tube = _ribbonBuilder__WEBPACK_IMPORTED_MODULE_2__[\"RibbonBuilder\"].CreateRibbon(name, { pathArray: pathArray, closePath: true, closeArray: false, updatable: updatable, sideOrientation: sideOrientation, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);\r\n tube._creationDataStorage.pathArray = pathArray;\r\n tube._creationDataStorage.path3D = path3D;\r\n tube._creationDataStorage.tessellation = tessellation;\r\n tube._creationDataStorage.cap = cap;\r\n tube._creationDataStorage.arc = options.arc;\r\n tube._creationDataStorage.radius = radius;\r\n return tube;\r\n };\r\n return TubeBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Compression/dracoCompression.ts\":\n/*!************************************************!*\\\n !*** ./Meshes/Compression/dracoCompression.ts ***!\n \\************************************************/\n/*! exports provided: DracoCompression */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return DracoCompression; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_workerPool__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/workerPool */ \"./Misc/workerPool.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\nfunction loadScriptAsync(url) {\r\n if (typeof importScripts === \"function\") {\r\n importScripts(url);\r\n return Promise.resolve();\r\n }\r\n else {\r\n return new Promise(function (resolve, reject) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadScript(url, function () {\r\n resolve();\r\n }, function (message) {\r\n reject(new Error(message));\r\n });\r\n });\r\n }\r\n}\r\nfunction loadFileAsync(url) {\r\n return new Promise(function (resolve, reject) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, undefined, true, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n}\r\nfunction createDecoderAsync(wasmUrl, wasmBinary, fallbackUrl) {\r\n var decoderUrl = (wasmBinary && wasmUrl) || fallbackUrl;\r\n if (decoderUrl) {\r\n return loadScriptAsync(decoderUrl).then(function () {\r\n return new Promise(function (resolve) {\r\n DracoDecoderModule({ wasmBinary: wasmBinary }).then(function (module) {\r\n resolve({ module: module });\r\n });\r\n });\r\n });\r\n }\r\n return undefined;\r\n}\r\nfunction decodeMesh(decoderModule, dataView, attributes, onIndicesData, onAttributeData) {\r\n var buffer = new decoderModule.DecoderBuffer();\r\n buffer.Init(dataView, dataView.byteLength);\r\n var decoder = new decoderModule.Decoder();\r\n var geometry;\r\n var status;\r\n try {\r\n var type = decoder.GetEncodedGeometryType(buffer);\r\n switch (type) {\r\n case decoderModule.TRIANGULAR_MESH:\r\n geometry = new decoderModule.Mesh();\r\n status = decoder.DecodeBufferToMesh(buffer, geometry);\r\n break;\r\n case decoderModule.POINT_CLOUD:\r\n geometry = new decoderModule.PointCloud();\r\n status = decoder.DecodeBufferToPointCloud(buffer, geometry);\r\n break;\r\n default:\r\n throw new Error(\"Invalid geometry type \" + type);\r\n }\r\n if (!status.ok() || !geometry.ptr) {\r\n throw new Error(status.error_msg());\r\n }\r\n var numPoints_1 = geometry.num_points();\r\n if (type === decoderModule.TRIANGULAR_MESH) {\r\n var numFaces = geometry.num_faces();\r\n var faceIndices = new decoderModule.DracoInt32Array();\r\n try {\r\n var indices = new Uint32Array(numFaces * 3);\r\n for (var i = 0; i < numFaces; i++) {\r\n decoder.GetFaceFromMesh(geometry, i, faceIndices);\r\n var offset = i * 3;\r\n indices[offset + 0] = faceIndices.GetValue(0);\r\n indices[offset + 1] = faceIndices.GetValue(1);\r\n indices[offset + 2] = faceIndices.GetValue(2);\r\n }\r\n onIndicesData(indices);\r\n }\r\n finally {\r\n decoderModule.destroy(faceIndices);\r\n }\r\n }\r\n var processAttribute = function (kind, attribute) {\r\n var dracoData = new decoderModule.DracoFloat32Array();\r\n try {\r\n decoder.GetAttributeFloatForAllPoints(geometry, attribute, dracoData);\r\n var babylonData = new Float32Array(numPoints_1 * attribute.num_components());\r\n for (var i = 0; i < babylonData.length; i++) {\r\n babylonData[i] = dracoData.GetValue(i);\r\n }\r\n onAttributeData(kind, babylonData);\r\n }\r\n finally {\r\n decoderModule.destroy(dracoData);\r\n }\r\n };\r\n if (attributes) {\r\n for (var kind in attributes) {\r\n var id = attributes[kind];\r\n var attribute = decoder.GetAttributeByUniqueId(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n else {\r\n var nativeAttributeTypes = {\r\n \"position\": \"POSITION\",\r\n \"normal\": \"NORMAL\",\r\n \"color\": \"COLOR\",\r\n \"uv\": \"TEX_COORD\"\r\n };\r\n for (var kind in nativeAttributeTypes) {\r\n var id = decoder.GetAttributeId(geometry, decoderModule[nativeAttributeTypes[kind]]);\r\n if (id !== -1) {\r\n var attribute = decoder.GetAttribute(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n if (geometry) {\r\n decoderModule.destroy(geometry);\r\n }\r\n decoderModule.destroy(decoder);\r\n decoderModule.destroy(buffer);\r\n }\r\n}\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction worker() {\r\n var decoderPromise;\r\n onmessage = function (event) {\r\n var data = event.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n var decoder = data.decoder;\r\n decoderPromise = createDecoderAsync(decoder.wasmUrl, decoder.wasmBinary, decoder.fallbackUrl);\r\n postMessage(\"done\");\r\n break;\r\n }\r\n case \"decodeMesh\": {\r\n if (!decoderPromise) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n decoderPromise.then(function (decoder) {\r\n decodeMesh(decoder.module, data.dataView, data.attributes, function (indices) {\r\n postMessage({ id: \"indices\", value: indices }, [indices.buffer]);\r\n }, function (kind, data) {\r\n postMessage({ id: kind, value: data }, [data.buffer]);\r\n });\r\n postMessage(\"done\");\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n}\r\nfunction getAbsoluteUrl(url) {\r\n if (typeof document !== \"object\" || typeof url !== \"string\") {\r\n return url;\r\n }\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].GetAbsoluteUrl(url);\r\n}\r\n/**\r\n * Draco compression (https://google.github.io/draco/)\r\n *\r\n * This class wraps the Draco module.\r\n *\r\n * **Encoder**\r\n *\r\n * The encoder is not currently implemented.\r\n *\r\n * **Decoder**\r\n *\r\n * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js.\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * DracoCompression.Configuration = {\r\n * decoder: {\r\n * wasmUrl: \"\",\r\n * wasmBinaryUrl: \"\",\r\n * fallbackUrl: \"\",\r\n * }\r\n * };\r\n * ```\r\n *\r\n * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version.\r\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\r\n * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context.\r\n *\r\n * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshAsync:\r\n * ```javascript\r\n * var vertexData = await DracoCompression.Default.decodeMeshAsync(data);\r\n * ```\r\n *\r\n * @see https://www.babylonjs-playground.com/#N3EK4B#0\r\n */\r\nvar DracoCompression = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\r\n */\r\n function DracoCompression(numWorkers) {\r\n if (numWorkers === void 0) { numWorkers = DracoCompression.DefaultNumWorkers; }\r\n var decoder = DracoCompression.Configuration.decoder;\r\n var decoderWasmBinaryPromise = (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\")\r\n ? loadFileAsync(getAbsoluteUrl(decoder.wasmBinaryUrl))\r\n : Promise.resolve(undefined);\r\n if (numWorkers && typeof Worker === \"function\") {\r\n this._workerPoolPromise = decoderWasmBinaryPromise.then(function (decoderWasmBinary) {\r\n var workerContent = \"\" + loadScriptAsync + createDecoderAsync + decodeMesh + \"(\" + worker + \")()\";\r\n var workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n var workerPromises = new Array(numWorkers);\r\n for (var i = 0; i < workerPromises.length; i++) {\r\n workerPromises[i] = new Promise(function (resolve, reject) {\r\n var worker = new Worker(workerBlobUrl);\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(worker);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n worker.postMessage({\r\n id: \"init\",\r\n decoder: {\r\n wasmUrl: getAbsoluteUrl(decoder.wasmUrl),\r\n wasmBinary: decoderWasmBinary,\r\n fallbackUrl: getAbsoluteUrl(decoder.fallbackUrl)\r\n }\r\n });\r\n });\r\n }\r\n return Promise.all(workerPromises).then(function (workers) {\r\n return new _Misc_workerPool__WEBPACK_IMPORTED_MODULE_1__[\"WorkerPool\"](workers);\r\n });\r\n });\r\n }\r\n else {\r\n this._decoderModulePromise = decoderWasmBinaryPromise.then(function (decoderWasmBinary) {\r\n return createDecoderAsync(decoder.wasmUrl, decoderWasmBinary, decoder.fallbackUrl);\r\n });\r\n }\r\n }\r\n Object.defineProperty(DracoCompression, \"DecoderAvailable\", {\r\n /**\r\n * Returns true if the decoder configuration is available.\r\n */\r\n get: function () {\r\n var decoder = DracoCompression.Configuration.decoder;\r\n return !!((decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") || decoder.fallbackUrl);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DracoCompression.GetDefaultNumWorkers = function () {\r\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\r\n return 1;\r\n }\r\n // Use 50% of the available logical processors but capped at 4.\r\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\r\n };\r\n Object.defineProperty(DracoCompression, \"Default\", {\r\n /**\r\n * Default instance for the draco compression object.\r\n */\r\n get: function () {\r\n if (!DracoCompression._Default) {\r\n DracoCompression._Default = new DracoCompression();\r\n }\r\n return DracoCompression._Default;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stop all async operations and release resources.\r\n */\r\n DracoCompression.prototype.dispose = function () {\r\n if (this._workerPoolPromise) {\r\n this._workerPoolPromise.then(function (workerPool) {\r\n workerPool.dispose();\r\n });\r\n }\r\n delete this._workerPoolPromise;\r\n delete this._decoderModulePromise;\r\n };\r\n /**\r\n * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use.\r\n * @returns a promise that resolves when ready\r\n */\r\n DracoCompression.prototype.whenReadyAsync = function () {\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function () { });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function () { });\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Decode Draco compressed mesh data to vertex data.\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded vertex data\r\n */\r\n DracoCompression.prototype.decodeMeshAsync = function (data, attributes) {\r\n var dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function (workerPool) {\r\n return new Promise(function (resolve, reject) {\r\n workerPool.push(function (worker, onComplete) {\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n onComplete();\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(vertexData);\r\n onComplete();\r\n }\r\n else if (message.data.id === \"indices\") {\r\n vertexData.indices = message.data.value;\r\n }\r\n else {\r\n vertexData.set(message.data.value, message.data.id);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n var dataViewCopy = new Uint8Array(dataView.byteLength);\r\n dataViewCopy.set(new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength));\r\n worker.postMessage({ id: \"decodeMesh\", dataView: dataViewCopy, attributes: attributes }, [dataViewCopy.buffer]);\r\n });\r\n });\r\n });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function (decoder) {\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n decodeMesh(decoder.module, dataView, attributes, function (indices) {\r\n vertexData.indices = indices;\r\n }, function (kind, data) {\r\n vertexData.set(data, kind);\r\n });\r\n return vertexData;\r\n });\r\n }\r\n throw new Error(\"Draco decoder module is not available\");\r\n };\r\n /**\r\n * The configuration. Defaults to the following urls:\r\n * - wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\"\r\n * - wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\"\r\n * - fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n */\r\n DracoCompression.Configuration = {\r\n decoder: {\r\n wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\",\r\n wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\",\r\n fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n }\r\n };\r\n /**\r\n * Default number of workers to create when creating the draco compression object.\r\n */\r\n DracoCompression.DefaultNumWorkers = DracoCompression.GetDefaultNumWorkers();\r\n DracoCompression._Default = null;\r\n return DracoCompression;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/Compression/index.ts\":\n/*!*************************************!*\\\n !*** ./Meshes/Compression/index.ts ***!\n \\*************************************/\n/*! exports provided: DracoCompression */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _dracoCompression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dracoCompression */ \"./Meshes/Compression/dracoCompression.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _dracoCompression__WEBPACK_IMPORTED_MODULE_0__[\"DracoCompression\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/WebGL/webGLDataBuffer.ts\":\n/*!*****************************************!*\\\n !*** ./Meshes/WebGL/webGLDataBuffer.ts ***!\n \\*****************************************/\n/*! exports provided: WebGLDataBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return WebGLDataBuffer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _dataBuffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dataBuffer */ \"./Meshes/dataBuffer.ts\");\n\r\n\r\n/** @hidden */\r\nvar WebGLDataBuffer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](WebGLDataBuffer, _super);\r\n function WebGLDataBuffer(resource) {\r\n var _this = _super.call(this) || this;\r\n _this._buffer = resource;\r\n return _this;\r\n }\r\n Object.defineProperty(WebGLDataBuffer.prototype, \"underlyingResource\", {\r\n get: function () {\r\n return this._buffer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return WebGLDataBuffer;\r\n}(_dataBuffer__WEBPACK_IMPORTED_MODULE_1__[\"DataBuffer\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/abstractMesh.ts\":\n/*!********************************!*\\\n !*** ./Meshes/abstractMesh.ts ***!\n \\********************************/\n/*! exports provided: AbstractMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return AbstractMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Collisions_meshCollisionData__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Collisions/meshCollisionData */ \"./Collisions/meshCollisionData.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_functions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Maths/math.functions */ \"./Maths/math.functions.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar _FacetDataStorage = /** @class */ (function () {\r\n function _FacetDataStorage() {\r\n this.facetNb = 0; // facet number\r\n this.partitioningSubdivisions = 10; // number of subdivisions per axis in the partioning space\r\n this.partitioningBBoxRatio = 1.01; // the partioning array space is by default 1% bigger than the bounding box\r\n this.facetDataEnabled = false; // is the facet data feature enabled on this mesh ?\r\n this.facetParameters = {}; // keep a reference to the object parameters to avoid memory re-allocation\r\n this.bbSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero(); // bbox size approximated for facet data\r\n this.subDiv = {\r\n max: 1,\r\n X: 1,\r\n Y: 1,\r\n Z: 1\r\n };\r\n this.facetDepthSort = false; // is the facet depth sort to be computed\r\n this.facetDepthSortEnabled = false; // is the facet depth sort initialized\r\n }\r\n return _FacetDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalAbstractMeshDataInfo = /** @class */ (function () {\r\n function _InternalAbstractMeshDataInfo() {\r\n this._hasVertexAlpha = false;\r\n this._useVertexColors = true;\r\n this._numBoneInfluencers = 4;\r\n this._applyFog = true;\r\n this._receiveShadows = false;\r\n this._facetData = new _FacetDataStorage();\r\n this._visibility = 1.0;\r\n this._skeleton = null;\r\n this._layerMask = 0x0FFFFFFF;\r\n this._computeBonesUsingShaders = true;\r\n this._isActive = false;\r\n this._onlyForInstances = false;\r\n this._isActiveIntermediate = false;\r\n this._onlyForInstancesIntermediate = false;\r\n }\r\n return _InternalAbstractMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to store all common mesh properties\r\n */\r\nvar AbstractMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AbstractMesh, _super);\r\n // Constructor\r\n /**\r\n * Creates a new AbstractMesh\r\n * @param name defines the name of the mesh\r\n * @param scene defines the hosting scene\r\n */\r\n function AbstractMesh(name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var _this = _super.call(this, name, scene, false) || this;\r\n // Internal data\r\n /** @hidden */\r\n _this._internalAbstractMeshDataInfo = new _InternalAbstractMeshDataInfo();\r\n /**\r\n * The culling strategy to use to check whether the mesh must be rendered or not.\r\n * This value can be changed at any time and will be used on the next render mesh selection.\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * Please read each static variable documentation to get details about the culling process.\r\n * */\r\n _this.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_STANDARD;\r\n // Events\r\n /**\r\n * An event triggered when this mesh collides with another one\r\n */\r\n _this.onCollideObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * An event triggered when the collision's position changes\r\n */\r\n _this.onCollisionPositionChangeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * An event triggered when material is changed\r\n */\r\n _this.onMaterialChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n // Properties\r\n /**\r\n * Gets or sets the orientation for POV movement & rotation\r\n */\r\n _this.definedFacingForward = true;\r\n /** @hidden */\r\n _this._occlusionQuery = null;\r\n /** @hidden */\r\n _this._renderingGroup = null;\r\n /** Gets or sets the alpha index used to sort transparent meshes\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index\r\n */\r\n _this.alphaIndex = Number.MAX_VALUE;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true\r\n */\r\n _this.isVisible = true;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true\r\n */\r\n _this.isPickable = true;\r\n /** Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default) */\r\n _this.showSubMeshesBoundingBox = false;\r\n /** Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\n _this.isBlocker = false;\r\n /**\r\n * Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)\r\n */\r\n _this.enablePointerMoveEvents = false;\r\n /**\r\n * Specifies the rendering group id for this mesh (0 by default)\r\n * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#rendering-groups\r\n */\r\n _this.renderingGroupId = 0;\r\n _this._material = null;\r\n /** Defines color to use when rendering outline */\r\n _this.outlineColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"].Red();\r\n /** Define width to use when rendering outline */\r\n _this.outlineWidth = 0.02;\r\n /** Defines color to use when rendering overlay */\r\n _this.overlayColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color3\"].Red();\r\n /** Defines alpha to use when rendering overlay */\r\n _this.overlayAlpha = 0.5;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default) */\r\n _this.useOctreeForRenderingSelection = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default) */\r\n _this.useOctreeForPicking = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default) */\r\n _this.useOctreeForCollisions = true;\r\n /**\r\n * True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)\r\n */\r\n _this.alwaysSelectAsActiveMesh = false;\r\n /**\r\n * Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)\r\n */\r\n _this.doNotSyncBoundingInfo = false;\r\n /**\r\n * Gets or sets the current action manager\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\n _this.actionManager = null;\r\n // Collisions\r\n _this._meshCollisionData = new _Collisions_meshCollisionData__WEBPACK_IMPORTED_MODULE_11__[\"_MeshCollisionData\"]();\r\n /**\r\n * Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoid = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0.5, 1, 0.5);\r\n /**\r\n * Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoidOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n // Edges\r\n /**\r\n * Defines edge width used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesWidth = 1;\r\n /**\r\n * Defines edge color used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_14__[\"Color4\"](1, 0, 0, 1);\r\n /** @hidden */\r\n _this._edgesRenderer = null;\r\n /** @hidden */\r\n _this._masterMesh = null;\r\n /** @hidden */\r\n _this._boundingInfo = null;\r\n /** @hidden */\r\n _this._renderId = 0;\r\n /** @hidden */\r\n _this._intersectionsInProgress = new Array();\r\n /** @hidden */\r\n _this._unIndexed = false;\r\n /** @hidden */\r\n _this._lightSources = new Array();\r\n // Loading properties\r\n /** @hidden */\r\n _this._waitingData = {\r\n lods: null,\r\n actions: null,\r\n freezeWorldMatrix: null\r\n };\r\n /** @hidden */\r\n _this._bonesTransformMatrices = null;\r\n /** @hidden */\r\n _this._transformMatrixTexture = null;\r\n /**\r\n * An event triggered when the mesh is rebuilt.\r\n */\r\n _this.onRebuildObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n newPosition.subtractToRef(_this._meshCollisionData._oldPositionForCollisions, _this._meshCollisionData._diffPositionForCollisions);\r\n if (_this._meshCollisionData._diffPositionForCollisions.length() > _Engines_engine__WEBPACK_IMPORTED_MODULE_4__[\"Engine\"].CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._meshCollisionData._diffPositionForCollisions);\r\n }\r\n if (collidedMesh) {\r\n _this.onCollideObservable.notifyObservers(collidedMesh);\r\n }\r\n _this.onCollisionPositionChangeObservable.notifyObservers(_this.position);\r\n };\r\n _this.getScene().addMesh(_this);\r\n _this._resyncLightSources();\r\n return _this;\r\n }\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_NONE\", {\r\n /**\r\n * No billboard\r\n */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_NONE;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_X\", {\r\n /** Billboard on X axis */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_X;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Y\", {\r\n /** Billboard on Y axis */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_Y;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Z\", {\r\n /** Billboard on Z axis */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_Z;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_ALL\", {\r\n /** Billboard on all axes */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_ALL;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_USE_POSITION\", {\r\n /** Billboard on using position instead of orientation */\r\n get: function () {\r\n return _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_USE_POSITION;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetNb\", {\r\n /**\r\n * Gets the number of facets in the mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetNb;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningSubdivisions\", {\r\n /**\r\n * Gets or set the number (integer) of subdivisions per axis in the partioning space\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions;\r\n },\r\n set: function (nb) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = nb;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningBBoxRatio\", {\r\n /**\r\n * The ratio (float) to apply to the bouding box size to set to the partioning space.\r\n * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio;\r\n },\r\n set: function (ratio) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = ratio;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"mustDepthSortFacets\", {\r\n /**\r\n * Gets or sets a boolean indicating that the facets must be depth sorted on next call to `updateFacetData()`.\r\n * Works only for updatable meshes.\r\n * Doesn't work with multi-materials\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSort;\r\n },\r\n set: function (sort) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSort = sort;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetDepthSortFrom\", {\r\n /**\r\n * The location (Vector3) where the facet depth sort must be computed from.\r\n * By default, the active camera position.\r\n * Used only when facet depth sort is enabled\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom;\r\n },\r\n set: function (location) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = location;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isFacetDataEnabled\", {\r\n /**\r\n * gets a boolean indicating if facetData is enabled\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._updateNonUniformScalingState = function (value) {\r\n if (!_super.prototype._updateNonUniformScalingState.call(this, value)) {\r\n return false;\r\n }\r\n this._markSubMeshesAsMiscDirty();\r\n return true;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollide\", {\r\n /** Set a function to call when this mesh collides with another one */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollideObserver) {\r\n this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver);\r\n }\r\n this._meshCollisionData._onCollideObserver = this.onCollideObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollisionPositionChange\", {\r\n /** Set a function to call when the collision's position changes */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollisionPositionChangeObserver) {\r\n this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver);\r\n }\r\n this._meshCollisionData._onCollisionPositionChangeObserver = this.onCollisionPositionChangeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"visibility\", {\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._visibility;\r\n },\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._visibility === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._visibility = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"material\", {\r\n /** Gets or sets current material */\r\n get: function () {\r\n return this._material;\r\n },\r\n set: function (value) {\r\n if (this._material === value) {\r\n return;\r\n }\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n this._material = value;\r\n if (value && value.meshMap) {\r\n value.meshMap[this.uniqueId] = this;\r\n }\r\n if (this.onMaterialChangedObservable.hasObservers) {\r\n this.onMaterialChangedObservable.notifyObservers(this);\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n this._unBindEffect();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"receiveShadows\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can receive realtime shadows\r\n * @see http://doc.babylonjs.com/babylon101/shadows\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._receiveShadows;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._receiveShadows === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._receiveShadows = value;\r\n this._markSubMeshesAsLightDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasVertexAlpha\", {\r\n /** Gets or sets a boolean indicating that this mesh contains vertex color data with alpha values */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._hasVertexAlpha;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._hasVertexAlpha === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._hasVertexAlpha = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"useVertexColors\", {\r\n /** Gets or sets a boolean indicating that this mesh needs to use vertex color data to render (if this kind of vertex data is available in the geometry) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._useVertexColors;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._useVertexColors === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._useVertexColors = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"computeBonesUsingShaders\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone animations must be computed by the CPU (false by default)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"numBoneInfluencers\", {\r\n /** Gets or sets the number of allowed bone influences per vertex (4 by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._numBoneInfluencers;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._numBoneInfluencers === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._numBoneInfluencers = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"applyFog\", {\r\n /** Gets or sets a boolean indicating that this mesh will allow fog to be rendered on it (true by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._applyFog;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._applyFog === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._applyFog = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"layerMask\", {\r\n /**\r\n * Gets or sets the current layer mask (default is 0x0FFFFFFF)\r\n * @see http://doc.babylonjs.com/how_to/layermasks_and_multi-cam_textures\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._layerMask;\r\n },\r\n set: function (value) {\r\n if (value === this._internalAbstractMeshDataInfo._layerMask) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._layerMask = value;\r\n this._resyncLightSources();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionMask\", {\r\n /**\r\n * Gets or sets a collision mask used to mask collisions (default is -1).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionGroup\", {\r\n /**\r\n * Gets or sets the current collision group mask (-1 by default).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionGroup;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionGroup = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._lightSources;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"_positions\", {\r\n /** @hidden */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"skeleton\", {\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._skeleton;\r\n },\r\n /**\r\n * Gets or sets a skeleton to apply skining transformations\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\n set: function (value) {\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton && skeleton.needInitialSkinMatrix) {\r\n skeleton._unregisterMeshWithPoseMatrix(this);\r\n }\r\n if (value && value.needInitialSkinMatrix) {\r\n value._registerMeshWithPoseMatrix(this);\r\n }\r\n this._internalAbstractMeshDataInfo._skeleton = value;\r\n if (!this._internalAbstractMeshDataInfo._skeleton) {\r\n this._bonesTransformMatrices = null;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"AbstractMesh\"\r\n * @returns \"AbstractMesh\"\r\n */\r\n AbstractMesh.prototype.getClassName = function () {\r\n return \"AbstractMesh\";\r\n };\r\n /**\r\n * Gets a string representation of the current mesh\r\n * @param fullDetails defines a boolean indicating if full details must be included\r\n * @returns a string representation of the current mesh\r\n */\r\n AbstractMesh.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", isInstance: \" + (this.getClassName() !== \"InstancedMesh\" ? \"YES\" : \"NO\");\r\n ret += \", # of submeshes: \" + (this.subMeshes ? this.subMeshes.length : 0);\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton) {\r\n ret += \", skeleton: \" + skeleton.name;\r\n }\r\n if (fullDetails) {\r\n ret += \", billboard mode: \" + ([\"NONE\", \"X\", \"Y\", null, \"Z\", null, null, \"ALL\"])[this.billboardMode];\r\n ret += \", freeze wrld mat: \" + (this._isWorldMatrixFrozen || this._waitingData.freezeWorldMatrix ? \"YES\" : \"NO\");\r\n }\r\n return ret;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n AbstractMesh.prototype._getEffectiveParent = function () {\r\n if (this._masterMesh && this.billboardMode !== _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_NONE) {\r\n return this._masterMesh;\r\n }\r\n return _super.prototype._getEffectiveParent.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getActionManagerForTrigger = function (trigger, initialCall) {\r\n if (initialCall === void 0) { initialCall = true; }\r\n if (this.actionManager && (initialCall || this.actionManager.isRecursive)) {\r\n if (trigger) {\r\n if (this.actionManager.hasSpecificTrigger(trigger)) {\r\n return this.actionManager;\r\n }\r\n }\r\n else {\r\n return this.actionManager;\r\n }\r\n }\r\n if (!this.parent) {\r\n return null;\r\n }\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._rebuild = function () {\r\n this.onRebuildObservable.notifyObservers(this);\r\n if (this._occlusionQuery) {\r\n this._occlusionQuery = null;\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh._rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLightSources = function () {\r\n this._lightSources.length = 0;\r\n for (var _i = 0, _a = this.getScene().lights; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n if (!light.isEnabled()) {\r\n continue;\r\n }\r\n if (light.canAffectMesh(this)) {\r\n this._lightSources.push(light);\r\n }\r\n }\r\n this._markSubMeshesAsLightDirty();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLighSource = function (light) {\r\n var isIn = light.isEnabled() && light.canAffectMesh(this);\r\n var index = this._lightSources.indexOf(light);\r\n if (index === -1) {\r\n if (!isIn) {\r\n return;\r\n }\r\n this._lightSources.push(light);\r\n }\r\n else {\r\n if (isIn) {\r\n return;\r\n }\r\n this._lightSources.splice(index, 1);\r\n }\r\n this._markSubMeshesAsLightDirty();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unBindEffect = function () {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh.setEffect(null);\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._removeLightSource = function (light, dispose) {\r\n var index = this._lightSources.indexOf(light);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._lightSources.splice(index, 1);\r\n this._markSubMeshesAsLightDirty(dispose);\r\n };\r\n AbstractMesh.prototype._markSubMeshesAsDirty = function (func) {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n if (subMesh._materialDefines) {\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsLightDirty = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(dispose); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsAttributesDirty = function () {\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsAttributesDirty(); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsMiscDirty = function () {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var material = subMesh.getMaterial();\r\n if (material) {\r\n material.markAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n }\r\n }\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets a Vector3 depicting the mesh scaling along each local axis X, Y, Z. Default is (1.0, 1.0, 1.0)\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isBlocked\", {\r\n // Methods\r\n /**\r\n * Returns true if the mesh is blocked. Implemented by child classes\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the mesh itself by default. Implemented by child classes\r\n * @param camera defines the camera to use to pick the right LOD level\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.getLOD = function (camera) {\r\n return this;\r\n };\r\n /**\r\n * Returns 0 by default. Implemented by child classes\r\n * @returns an integer\r\n */\r\n AbstractMesh.prototype.getTotalVertices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n AbstractMesh.prototype.getTotalIndices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns null by default. Implemented by child classes\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getIndices = function () {\r\n return null;\r\n };\r\n /**\r\n * Returns the array of the requested vertex data kind. Implemented by child classes\r\n * @param kind defines the vertex data kind to use\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getVerticesData = function (kind) {\r\n return null;\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the data must be flagged as updatable (or static)\r\n * @param stride defines the vertex stride (size of an entire vertex). Can be null and in this case will be deduced from vertex data kind\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n return this;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends If `kind` is `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed\r\n * @param makeItUnique If true, a new global geometry is created from this data and is set to the mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh indices,\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * @param indices Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)\r\n * @param totalVertices Defines the total number of vertices\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setIndices = function (indices, totalVertices) {\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex data is present\r\n * @param kind defines the vertex data kind to use\r\n * @returns true is data kind is present\r\n */\r\n AbstractMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return false;\r\n };\r\n /**\r\n * Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined.\r\n * Note that it returns a shallow bounding of the mesh (i.e. it does not include children).\r\n * To get the full bounding of all children, call `getHierarchyBoundingVectors` instead.\r\n * @returns a BoundingInfo\r\n */\r\n AbstractMesh.prototype.getBoundingInfo = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh.getBoundingInfo();\r\n }\r\n if (!this._boundingInfo) {\r\n // this._boundingInfo is being created here\r\n this._updateBoundingInfo();\r\n }\r\n // cannot be null.\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n return _super.prototype.normalizeToUnitCube.call(this, includeDescendants, ignoreRotation, predicate);\r\n };\r\n /**\r\n * Overwrite the current bounding info\r\n * @param boundingInfo defines the new bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"useBones\", {\r\n /** Gets a boolean indicating if this mesh has skinning data and an attached skeleton */\r\n get: function () {\r\n return (this.skeleton && this.getScene().skeletonsEnabled && this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesIndicesKind) && this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesWeightsKind));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivate = function () {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n this._renderId = renderId;\r\n return true;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._postActivate = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._freeze = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unFreeze = function () {\r\n // Do nothing\r\n };\r\n /**\r\n * Gets the current world matrix\r\n * @returns a Matrix\r\n */\r\n AbstractMesh.prototype.getWorldMatrix = function () {\r\n if (this._masterMesh && this.billboardMode === _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"].BILLBOARDMODE_NONE) {\r\n return this._masterMesh.getWorldMatrix();\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getWorldMatrixDeterminant = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh._getWorldMatrixDeterminant();\r\n }\r\n return _super.prototype._getWorldMatrixDeterminant.call(this);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"isAnInstance\", {\r\n /**\r\n * Gets a boolean indicating if this mesh is an instance or a regular mesh\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasInstances\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has instances\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // ================================== Point of View Movement =================================\r\n /**\r\n * Perform relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.movePOV = function (amountRight, amountUp, amountForward) {\r\n this.position.addInPlace(this.calcMovePOV(amountRight, amountUp, amountForward));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the new displacement vector\r\n */\r\n AbstractMesh.prototype.calcMovePOV = function (amountRight, amountUp, amountForward) {\r\n var rotMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"]();\r\n var rotQuaternion = (this.rotationQuaternion) ? this.rotationQuaternion : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n rotQuaternion.toRotationMatrix(rotMatrix);\r\n var translationDelta = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var defForwardMult = this.definedFacingForward ? -1 : 1;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(amountRight * defForwardMult, amountUp, amountForward * defForwardMult, rotMatrix, translationDelta);\r\n return translationDelta;\r\n };\r\n // ================================== Point of View Rotation =================================\r\n /**\r\n * Perform relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.rotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n this.rotation.addInPlace(this.calcRotatePOV(flipBack, twirlClockwise, tiltRight));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward.\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the new rotation vector\r\n */\r\n AbstractMesh.prototype.calcRotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n var defForwardMult = this.definedFacingForward ? 1 : -1;\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](flipBack * defForwardMult, twirlClockwise, tiltRight * defForwardMult);\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), null);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._refreshBoundingInfo = function (data, bias) {\r\n if (data) {\r\n var extend = Object(_Maths_math_functions__WEBPACK_IMPORTED_MODULE_13__[\"extractMinAndMax\"])(data, 0, this.getTotalVertices(), bias);\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_9__[\"BoundingInfo\"](extend.minimum, extend.maximum);\r\n }\r\n }\r\n if (this.subMeshes) {\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this.subMeshes[index].refreshBoundingInfo(data);\r\n }\r\n }\r\n this._updateBoundingInfo();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getPositionData = function (applySkeleton) {\r\n var data = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n if (data && applySkeleton && this.skeleton) {\r\n data = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].Slice(data);\r\n this._generatePointsArray();\r\n var matricesIndicesData = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (matricesWeightsData && matricesIndicesData) {\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].MatricesWeightsExtraKind) : null;\r\n this.skeleton.prepare();\r\n var skeletonMatrices = this.skeleton.getTransformMatrices(this);\r\n var tempVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var finalMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n var tempMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n var matWeightIdx = 0;\r\n for (var index = 0; index < data.length; index += 3, matWeightIdx += 4) {\r\n finalMatrix.reset();\r\n var inf;\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);\r\n tempVector.toArray(data, index);\r\n if (this._positions) {\r\n this._positions[index / 3].copyFrom(tempVector);\r\n }\r\n }\r\n }\r\n }\r\n return data;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateBoundingInfo = function () {\r\n var effectiveMesh = this._effectiveMesh;\r\n if (this._boundingInfo) {\r\n this._boundingInfo.update(effectiveMesh.worldMatrixFromCache);\r\n }\r\n else {\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_9__[\"BoundingInfo\"](this.absolutePosition, this.absolutePosition, effectiveMesh.worldMatrixFromCache);\r\n }\r\n this._updateSubMeshesBoundingInfo(effectiveMesh.worldMatrixFromCache);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {\r\n if (!this.subMeshes) {\r\n return this;\r\n }\r\n var count = this.subMeshes.length;\r\n for (var subIndex = 0; subIndex < count; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n if (count > 1 || !subMesh.IsGlobal) {\r\n subMesh.updateBoundingInfo(matrix);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._afterComputeWorldMatrix = function () {\r\n if (this.doNotSyncBoundingInfo) {\r\n return;\r\n }\r\n // Bounding info\r\n this._updateBoundingInfo();\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"_effectiveMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return (this.skeleton && this.skeleton.overrideMesh) || this;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n AbstractMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n };\r\n /**\r\n * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.\r\n * A mesh is completely in the frustum if its bounding box it completely inside the frustum.\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is completely in the frustum planes\r\n */\r\n AbstractMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * True if the mesh intersects another mesh or a SolidParticle object\r\n * @param mesh defines a target mesh or SolidParticle to test\r\n * @param precise Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)\r\n * @param includeDescendants Can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsMesh = function (mesh, precise, includeDescendants) {\r\n if (precise === void 0) { precise = false; }\r\n if (!this._boundingInfo || !mesh._boundingInfo) {\r\n return false;\r\n }\r\n if (this._boundingInfo.intersects(mesh._boundingInfo, precise)) {\r\n return true;\r\n }\r\n if (includeDescendants) {\r\n for (var _i = 0, _a = this.getChildMeshes(); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.intersectsMesh(mesh, precise, true)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the passed point (Vector3) is inside the mesh bounding box\r\n * @param point defines the point to test\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsPoint = function (point) {\r\n if (!this._boundingInfo) {\r\n return false;\r\n }\r\n return this._boundingInfo.intersectsPoint(point);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"checkCollisions\", {\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can be used in the collision engine\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._checkCollisions;\r\n },\r\n set: function (collisionEnabled) {\r\n this._meshCollisionData._checkCollisions = collisionEnabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collider\", {\r\n /**\r\n * Gets Collider object used to compute collisions (not physics)\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collider;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Move the mesh using collision engine\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n * @param displacement defines the requested displacement vector\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.moveWithCollisions = function (displacement) {\r\n var globalPosition = this.getAbsolutePosition();\r\n globalPosition.addToRef(this.ellipsoidOffset, this._meshCollisionData._oldPositionForCollisions);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._meshCollisionData._collider) {\r\n this._meshCollisionData._collider = coordinator.createCollider();\r\n }\r\n this._meshCollisionData._collider._radius = this.ellipsoid;\r\n coordinator.getNewPosition(this._meshCollisionData._oldPositionForCollisions, displacement, this._meshCollisionData._collider, 3, this, this._onCollisionPositionChange, this.uniqueId);\r\n return this;\r\n };\r\n // Collisions\r\n /** @hidden */\r\n AbstractMesh.prototype._collideForSubMesh = function (subMesh, transformMatrix, collider) {\r\n this._generatePointsArray();\r\n if (!this._positions) {\r\n return this;\r\n }\r\n // Transformation\r\n if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix.equals(transformMatrix)) {\r\n subMesh._lastColliderTransformMatrix = transformMatrix.clone();\r\n subMesh._lastColliderWorldVertices = [];\r\n subMesh._trianglePlanes = [];\r\n var start = subMesh.verticesStart;\r\n var end = (subMesh.verticesStart + subMesh.verticesCount);\r\n for (var i = start; i < end; i++) {\r\n subMesh._lastColliderWorldVertices.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(this._positions[i], transformMatrix));\r\n }\r\n }\r\n // Collide\r\n collider._collide(subMesh._trianglePlanes, subMesh._lastColliderWorldVertices, this.getIndices(), subMesh.indexStart, subMesh.indexStart + subMesh.indexCount, subMesh.verticesStart, !!subMesh.getMaterial(), this);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._processCollisionsForSubMeshes = function (collider, transformMatrix) {\r\n var subMeshes = this._scene.getCollidingSubMeshCandidates(this, collider);\r\n var len = subMeshes.length;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh._checkCollision(collider)) {\r\n continue;\r\n }\r\n this._collideForSubMesh(subMesh, transformMatrix, collider);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkCollision = function (collider) {\r\n // Bounding box test\r\n if (!this._boundingInfo || !this._boundingInfo._checkCollision(collider)) {\r\n return this;\r\n }\r\n // Transformation matrix\r\n var collisionsScalingMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n var collisionsTransformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ScalingToRef(1.0 / collider._radius.x, 1.0 / collider._radius.y, 1.0 / collider._radius.z, collisionsScalingMatrix);\r\n this.worldMatrixFromCache.multiplyToRef(collisionsScalingMatrix, collisionsTransformMatrix);\r\n this._processCollisionsForSubMeshes(collider, collisionsTransformMatrix);\r\n return this;\r\n };\r\n // Picking\r\n /** @hidden */\r\n AbstractMesh.prototype._generatePointsArray = function () {\r\n return false;\r\n };\r\n /**\r\n * Checks if the passed Ray intersects with the mesh\r\n * @param ray defines the ray to use\r\n * @param fastCheck defines if fast mode (but less precise) must be used (false by default)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns the picking info\r\n * @see http://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n */\r\n AbstractMesh.prototype.intersects = function (ray, fastCheck, trianglePredicate) {\r\n var pickingInfo = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_8__[\"PickingInfo\"]();\r\n var intersectionThreshold = this.getClassName() === \"InstancedLinesMesh\" || this.getClassName() === \"LinesMesh\" ? this.intersectionThreshold : 0;\r\n var boundingInfo = this._boundingInfo;\r\n if (!this.subMeshes || !boundingInfo || !ray.intersectsSphere(boundingInfo.boundingSphere, intersectionThreshold) || !ray.intersectsBox(boundingInfo.boundingBox, intersectionThreshold)) {\r\n return pickingInfo;\r\n }\r\n if (!this._generatePointsArray()) {\r\n return pickingInfo;\r\n }\r\n var intersectInfo = null;\r\n var subMeshes = this._scene.getIntersectingSubMeshCandidates(this, ray);\r\n var len = subMeshes.length;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh.canIntersects(ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = subMesh.intersects(ray, this._positions, this.getIndices(), fastCheck, trianglePredicate);\r\n if (currentIntersectInfo) {\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.subMeshId = index;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (intersectInfo) {\r\n // Get picked point\r\n var world = this.getWorldMatrix();\r\n var worldOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(ray.origin, world, worldOrigin);\r\n ray.direction.scaleToRef(intersectInfo.distance, direction);\r\n var worldDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(direction, world);\r\n var pickedPoint = worldDirection.addInPlace(worldOrigin);\r\n // Return result\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(worldOrigin, pickedPoint);\r\n pickingInfo.pickedPoint = pickedPoint;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.bu = intersectInfo.bu || 0;\r\n pickingInfo.bv = intersectInfo.bv || 0;\r\n pickingInfo.faceId = intersectInfo.faceId;\r\n pickingInfo.subMeshId = intersectInfo.subMeshId;\r\n return pickingInfo;\r\n }\r\n return pickingInfo;\r\n };\r\n /**\r\n * Clones the current mesh\r\n * @param name defines the mesh name\r\n * @param newParent defines the new mesh parent\r\n * @param doNotCloneChildren defines a boolean indicating that children must not be cloned (false by default)\r\n * @returns the new mesh\r\n */\r\n AbstractMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n return null;\r\n };\r\n /**\r\n * Disposes all the submeshes of the current meshnp\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.releaseSubMeshes = function () {\r\n if (this.subMeshes) {\r\n while (this.subMeshes.length) {\r\n this.subMeshes[0].dispose();\r\n }\r\n }\r\n else {\r\n this.subMeshes = new Array();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Releases resources associated with this abstract mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n AbstractMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n var _this = this;\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n var index;\r\n // mesh map release.\r\n if (this._scene.useMaterialMeshMap) {\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n // Smart Array Retainers.\r\n this.getScene().freeActiveMeshes();\r\n this.getScene().freeRenderingGroups();\r\n // Action manager\r\n if (this.actionManager !== undefined && this.actionManager !== null) {\r\n this.actionManager.dispose();\r\n this.actionManager = null;\r\n }\r\n // Skeleton\r\n this._internalAbstractMeshDataInfo._skeleton = null;\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n // Intersections in progress\r\n for (index = 0; index < this._intersectionsInProgress.length; index++) {\r\n var other = this._intersectionsInProgress[index];\r\n var pos = other._intersectionsInProgress.indexOf(this);\r\n other._intersectionsInProgress.splice(pos, 1);\r\n }\r\n this._intersectionsInProgress = [];\r\n // Lights\r\n var lights = this.getScene().lights;\r\n lights.forEach(function (light) {\r\n var meshIndex = light.includedOnlyMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.includedOnlyMeshes.splice(meshIndex, 1);\r\n }\r\n meshIndex = light.excludedMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.excludedMeshes.splice(meshIndex, 1);\r\n }\r\n // Shadow generators\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n var shadowMap = generator.getShadowMap();\r\n if (shadowMap && shadowMap.renderList) {\r\n meshIndex = shadowMap.renderList.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n shadowMap.renderList.splice(meshIndex, 1);\r\n }\r\n }\r\n }\r\n });\r\n // SubMeshes\r\n if (this.getClassName() !== \"InstancedMesh\" || this.getClassName() !== \"InstancedLinesMesh\") {\r\n this.releaseSubMeshes();\r\n }\r\n // Query\r\n var engine = this.getScene().getEngine();\r\n if (this._occlusionQuery) {\r\n this.isOcclusionQueryInProgress = false;\r\n engine.deleteQuery(this._occlusionQuery);\r\n this._occlusionQuery = null;\r\n }\r\n // Engine\r\n engine.wipeCaches();\r\n // Remove from scene\r\n this.getScene().removeMesh(this);\r\n if (disposeMaterialAndTextures) {\r\n if (this.material) {\r\n if (this.material.getClassName() === \"MultiMaterial\") {\r\n this.material.dispose(false, true, true);\r\n }\r\n else {\r\n this.material.dispose(false, true);\r\n }\r\n }\r\n }\r\n if (!doNotRecurse) {\r\n // Particles\r\n for (index = 0; index < this.getScene().particleSystems.length; index++) {\r\n if (this.getScene().particleSystems[index].emitter === this) {\r\n this.getScene().particleSystems[index].dispose();\r\n index--;\r\n }\r\n }\r\n }\r\n // facet data\r\n if (this._internalAbstractMeshDataInfo._facetData.facetDataEnabled) {\r\n this.disableFacetData();\r\n }\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n this.onCollideObservable.clear();\r\n this.onCollisionPositionChangeObservable.clear();\r\n this.onRebuildObservable.clear();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Adds the passed mesh as a child to the current mesh\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.addChild = function (mesh) {\r\n mesh.setParent(this);\r\n return this;\r\n };\r\n /**\r\n * Removes the passed mesh from the current mesh children list\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.removeChild = function (mesh) {\r\n mesh.setParent(null);\r\n return this;\r\n };\r\n // Facet data\r\n /** @hidden */\r\n AbstractMesh.prototype._initFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetNormals) {\r\n data.facetNormals = new Array();\r\n }\r\n if (!data.facetPositions) {\r\n data.facetPositions = new Array();\r\n }\r\n if (!data.facetPartitioning) {\r\n data.facetPartitioning = new Array();\r\n }\r\n data.facetNb = (this.getIndices().length / 3) | 0;\r\n data.partitioningSubdivisions = (data.partitioningSubdivisions) ? data.partitioningSubdivisions : 10; // default nb of partitioning subdivisions = 10\r\n data.partitioningBBoxRatio = (data.partitioningBBoxRatio) ? data.partitioningBBoxRatio : 1.01; // default ratio 1.01 = the partitioning is 1% bigger than the bounding box\r\n for (var f = 0; f < data.facetNb; f++) {\r\n data.facetNormals[f] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n data.facetPositions[f] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n data.facetDataEnabled = true;\r\n return this;\r\n };\r\n /**\r\n * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.\r\n * This method can be called within the render loop.\r\n * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.updateFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetDataEnabled) {\r\n this._initFacetData();\r\n }\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n var bInfo = this.getBoundingInfo();\r\n if (data.facetDepthSort && !data.facetDepthSortEnabled) {\r\n // init arrays, matrix and sort function on first call\r\n data.facetDepthSortEnabled = true;\r\n if (indices instanceof Uint16Array) {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n else if (indices instanceof Uint32Array) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n var needs32bits = false;\r\n for (var i = 0; i < indices.length; i++) {\r\n if (indices[i] > 65535) {\r\n needs32bits = true;\r\n break;\r\n }\r\n }\r\n if (needs32bits) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n }\r\n data.facetDepthSortFunction = function (f1, f2) {\r\n return (f2.sqDistance - f1.sqDistance);\r\n };\r\n if (!data.facetDepthSortFrom) {\r\n var camera = this.getScene().activeCamera;\r\n data.facetDepthSortFrom = (camera) ? camera.position : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n data.depthSortedFacets = [];\r\n for (var f = 0; f < data.facetNb; f++) {\r\n var depthSortedFacet = { ind: f * 3, sqDistance: 0.0 };\r\n data.depthSortedFacets.push(depthSortedFacet);\r\n }\r\n data.invertedMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n data.facetDepthSortOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n data.bbSize.x = (bInfo.maximum.x - bInfo.minimum.x > _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"]) ? bInfo.maximum.x - bInfo.minimum.x : _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n data.bbSize.y = (bInfo.maximum.y - bInfo.minimum.y > _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"]) ? bInfo.maximum.y - bInfo.minimum.y : _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n data.bbSize.z = (bInfo.maximum.z - bInfo.minimum.z > _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"]) ? bInfo.maximum.z - bInfo.minimum.z : _Maths_math_constants__WEBPACK_IMPORTED_MODULE_15__[\"Epsilon\"];\r\n var bbSizeMax = (data.bbSize.x > data.bbSize.y) ? data.bbSize.x : data.bbSize.y;\r\n bbSizeMax = (bbSizeMax > data.bbSize.z) ? bbSizeMax : data.bbSize.z;\r\n data.subDiv.max = data.partitioningSubdivisions;\r\n data.subDiv.X = Math.floor(data.subDiv.max * data.bbSize.x / bbSizeMax); // adjust the number of subdivisions per axis\r\n data.subDiv.Y = Math.floor(data.subDiv.max * data.bbSize.y / bbSizeMax); // according to each bbox size per axis\r\n data.subDiv.Z = Math.floor(data.subDiv.max * data.bbSize.z / bbSizeMax);\r\n data.subDiv.X = data.subDiv.X < 1 ? 1 : data.subDiv.X; // at least one subdivision\r\n data.subDiv.Y = data.subDiv.Y < 1 ? 1 : data.subDiv.Y;\r\n data.subDiv.Z = data.subDiv.Z < 1 ? 1 : data.subDiv.Z;\r\n // set the parameters for ComputeNormals()\r\n data.facetParameters.facetNormals = this.getFacetLocalNormals();\r\n data.facetParameters.facetPositions = this.getFacetLocalPositions();\r\n data.facetParameters.facetPartitioning = this.getFacetLocalPartitioning();\r\n data.facetParameters.bInfo = bInfo;\r\n data.facetParameters.bbSize = data.bbSize;\r\n data.facetParameters.subDiv = data.subDiv;\r\n data.facetParameters.ratio = this.partitioningBBoxRatio;\r\n data.facetParameters.depthSort = data.facetDepthSort;\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n this.computeWorldMatrix(true);\r\n this._worldMatrix.invertToRef(data.invertedMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(data.facetDepthSortFrom, data.invertedMatrix, data.facetDepthSortOrigin);\r\n data.facetParameters.distanceTo = data.facetDepthSortOrigin;\r\n }\r\n data.facetParameters.depthSortedFacets = data.depthSortedFacets;\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_6__[\"VertexData\"].ComputeNormals(positions, indices, normals, data.facetParameters);\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n data.depthSortedFacets.sort(data.facetDepthSortFunction);\r\n var l = (data.depthSortedIndices.length / 3) | 0;\r\n for (var f = 0; f < l; f++) {\r\n var sind = data.depthSortedFacets[f].ind;\r\n data.depthSortedIndices[f * 3] = indices[sind];\r\n data.depthSortedIndices[f * 3 + 1] = indices[sind + 1];\r\n data.depthSortedIndices[f * 3 + 2] = indices[sind + 2];\r\n }\r\n this.updateIndices(data.depthSortedIndices, undefined, true);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the facetLocalNormals array.\r\n * The normals are expressed in the mesh local spac\r\n * @returns an array of Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalNormals = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetNormals) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetNormals;\r\n };\r\n /**\r\n * Returns the facetLocalPositions array.\r\n * The facet positions are expressed in the mesh local space\r\n * @returns an array of Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPositions = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPositions) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPositions;\r\n };\r\n /**\r\n * Returns the facetLocalPartioning array\r\n * @returns an array of array of numbers\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPartitioning = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPartitioning) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPartitioning;\r\n };\r\n /**\r\n * Returns the i-th facet position in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPosition = function (i) {\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getFacetPositionToRef(i, pos);\r\n return pos;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet position in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPositionToRef = function (i, ref) {\r\n var localPos = (this.getFacetLocalPositions())[i];\r\n var world = this.getWorldMatrix();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(localPos, world, ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the i-th facet normal in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormal = function (i) {\r\n var norm = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getFacetNormalToRef(i, norm);\r\n return norm;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet normal in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormalToRef = function (i, ref) {\r\n var localNorm = (this.getFacetLocalNormals())[i];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(localNorm, this.getWorldMatrix(), ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system)\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the array of facet indexes\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetsAtLocalCoordinates = function (x, y, z) {\r\n var bInfo = this.getBoundingInfo();\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n var ox = Math.floor((x - bInfo.minimum.x * data.partitioningBBoxRatio) * data.subDiv.X * data.partitioningBBoxRatio / data.bbSize.x);\r\n var oy = Math.floor((y - bInfo.minimum.y * data.partitioningBBoxRatio) * data.subDiv.Y * data.partitioningBBoxRatio / data.bbSize.y);\r\n var oz = Math.floor((z - bInfo.minimum.z * data.partitioningBBoxRatio) * data.subDiv.Z * data.partitioningBBoxRatio / data.bbSize.z);\r\n if (ox < 0 || ox > data.subDiv.max || oy < 0 || oy > data.subDiv.max || oz < 0 || oz > data.subDiv.max) {\r\n return null;\r\n }\r\n return data.facetPartitioning[ox + data.subDiv.max * oy + data.subDiv.max * data.subDiv.max * oz];\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found\r\n * @param projected sets as the (x,y,z) world projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var world = this.getWorldMatrix();\r\n var invMat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[5];\r\n world.invertToRef(invMat);\r\n var invVect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[8];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, y, z, invMat, invVect); // transform (x,y,z) to coordinates in the mesh local space\r\n var closest = this.getClosestFacetAtLocalCoordinates(invVect.x, invVect.y, invVect.z, projected, checkFace, facing);\r\n if (projected) {\r\n // tranform the local computed projected vector to world coordinates\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(projected.x, projected.y, projected.z, world, projected);\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found\r\n * @param projected sets as the (x,y,z) local projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtLocalCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var closest = null;\r\n var tmpx = 0.0;\r\n var tmpy = 0.0;\r\n var tmpz = 0.0;\r\n var d = 0.0; // tmp dot facet normal * facet position\r\n var t0 = 0.0;\r\n var projx = 0.0;\r\n var projy = 0.0;\r\n var projz = 0.0;\r\n // Get all the facets in the same partitioning block than (x, y, z)\r\n var facetPositions = this.getFacetLocalPositions();\r\n var facetNormals = this.getFacetLocalNormals();\r\n var facetsInBlock = this.getFacetsAtLocalCoordinates(x, y, z);\r\n if (!facetsInBlock) {\r\n return null;\r\n }\r\n // Get the closest facet to (x, y, z)\r\n var shortest = Number.MAX_VALUE; // init distance vars\r\n var tmpDistance = shortest;\r\n var fib; // current facet in the block\r\n var norm; // current facet normal\r\n var p0; // current facet barycenter position\r\n // loop on all the facets in the current partitioning block\r\n for (var idx = 0; idx < facetsInBlock.length; idx++) {\r\n fib = facetsInBlock[idx];\r\n norm = facetNormals[fib];\r\n p0 = facetPositions[fib];\r\n d = (x - p0.x) * norm.x + (y - p0.y) * norm.y + (z - p0.z) * norm.z;\r\n if (!checkFace || (checkFace && facing && d >= 0.0) || (checkFace && !facing && d <= 0.0)) {\r\n // compute (x,y,z) projection on the facet = (projx, projy, projz)\r\n d = norm.x * p0.x + norm.y * p0.y + norm.z * p0.z;\r\n t0 = -(norm.x * x + norm.y * y + norm.z * z - d) / (norm.x * norm.x + norm.y * norm.y + norm.z * norm.z);\r\n projx = x + norm.x * t0;\r\n projy = y + norm.y * t0;\r\n projz = z + norm.z * t0;\r\n tmpx = projx - x;\r\n tmpy = projy - y;\r\n tmpz = projz - z;\r\n tmpDistance = tmpx * tmpx + tmpy * tmpy + tmpz * tmpz; // compute length between (x, y, z) and its projection on the facet\r\n if (tmpDistance < shortest) { // just keep the closest facet to (x, y, z)\r\n shortest = tmpDistance;\r\n closest = fib;\r\n if (projected) {\r\n projected.x = projx;\r\n projected.y = projy;\r\n projected.z = projz;\r\n }\r\n }\r\n }\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the object \"parameter\" set with all the expected parameters for facetData computation by ComputeNormals()\r\n * @returns the parameters\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetDataParameters = function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetParameters;\r\n };\r\n /**\r\n * Disables the feature FacetData and frees the related memory\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.disableFacetData = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (facetData.facetDataEnabled) {\r\n facetData.facetDataEnabled = false;\r\n facetData.facetPositions = new Array();\r\n facetData.facetNormals = new Array();\r\n facetData.facetPartitioning = new Array();\r\n facetData.facetParameters = null;\r\n facetData.depthSortedIndices = new Uint32Array(0);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the AbstractMesh indices array\r\n * @param indices defines the data source\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n return this;\r\n };\r\n /**\r\n * Creates new normals data for the mesh\r\n * @param updatable defines if the normal vertex buffer must be flagged as updatable\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.createNormals = function (updatable) {\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind);\r\n var indices = this.getIndices();\r\n var normals;\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind)) {\r\n normals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind);\r\n }\r\n else {\r\n normals = [];\r\n }\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_6__[\"VertexData\"].ComputeNormals(positions, indices, normals, { useRightHandedSystem: this.getScene().useRightHandedSystem });\r\n this.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].NormalKind, normals, updatable);\r\n return this;\r\n };\r\n /**\r\n * Align the mesh with a normal\r\n * @param normal defines the normal to use\r\n * @param upDirection can be used to redefined the up vector to use (will use the (0, 1, 0) by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.alignWithNormal = function (normal, upDirection) {\r\n if (!upDirection) {\r\n upDirection = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_16__[\"Axis\"].Y;\r\n }\r\n var axisX = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var axisZ = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(upDirection, normal, axisZ);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].CrossToRef(normal, axisZ, axisX);\r\n if (this.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationQuaternionFromAxisToRef(axisX, normal, axisZ, this.rotationQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].RotationFromAxisToRef(axisX, normal, axisZ, this.rotation);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkOcclusionQuery = function () {\r\n return false;\r\n };\r\n /**\r\n * Disables the mesh edge rendering mode\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.disableEdgesRendering = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"EdgesRenderer\");\r\n };\r\n /**\r\n * Enables the edge rendering mode on the mesh.\r\n * This mode makes the mesh edges visible\r\n * @param epsilon defines the maximal distance between two angles to detect a face\r\n * @param checkVerticesInsteadOfIndices indicates that we should check vertex list directly instead of faces\r\n * @returns the currentAbstractMesh\r\n * @see https://www.babylonjs-playground.com/#19O9TU#0\r\n */\r\n AbstractMesh.prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_12__[\"_DevTools\"].WarnImport(\"EdgesRenderer\");\r\n };\r\n /** No occlusion */\r\n AbstractMesh.OCCLUSION_TYPE_NONE = 0;\r\n /** Occlusion set to optimisitic */\r\n AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC = 1;\r\n /** Occlusion set to strict */\r\n AbstractMesh.OCCLUSION_TYPE_STRICT = 2;\r\n /** Use an accurante occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0;\r\n /** Use a conservative occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1;\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_STANDARD = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_STANDARD;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = _Engines_constants__WEBPACK_IMPORTED_MODULE_10__[\"Constants\"].MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY;\r\n return AbstractMesh;\r\n}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_7__[\"TransformNode\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/buffer.ts\":\n/*!**************************!*\\\n !*** ./Meshes/buffer.ts ***!\n \\**************************/\n/*! exports provided: Buffer, VertexBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return Buffer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return VertexBuffer; });\n/**\r\n * Class used to store data that will be store in GPU memory\r\n */\r\nvar Buffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this buffer\r\n * @param updatable whether the data is updatable\r\n * @param stride the stride (optional)\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param useBytes set to true if the stride in in bytes (optional)\r\n */\r\n function Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes) {\r\n if (stride === void 0) { stride = 0; }\r\n if (postponeInternalCreation === void 0) { postponeInternalCreation = false; }\r\n if (instanced === void 0) { instanced = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (engine.getScene) { // old versions of VertexBuffer accepted 'mesh' instead of 'engine'\r\n this._engine = engine.getScene().getEngine();\r\n }\r\n else {\r\n this._engine = engine;\r\n }\r\n this._updatable = updatable;\r\n this._instanced = instanced;\r\n this._data = data;\r\n this.byteStride = useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT;\r\n if (!postponeInternalCreation) { // by default\r\n this.create();\r\n }\r\n }\r\n /**\r\n * Create a new VertexBuffer based on the current buffer\r\n * @param kind defines the vertex buffer kind (position, normal, etc.)\r\n * @param offset defines offset in the buffer (0 by default)\r\n * @param size defines the size in floats of attributes (position is 3 for instance)\r\n * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)\r\n * @param instanced defines if the vertex buffer contains indexed data\r\n * @param useBytes defines if the offset and stride are in bytes\r\n * @returns the new vertex buffer\r\n */\r\n Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride, instanced, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var byteOffset = useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT;\r\n var byteStride = stride ? (useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT) : this.byteStride;\r\n // a lot of these parameters are ignored as they are overriden by the buffer\r\n return new VertexBuffer(this._engine, this, kind, this._updatable, true, byteStride, instanced === undefined ? this._instanced : instanced, byteOffset, size, undefined, undefined, true);\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the Buffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n Buffer.prototype.isUpdatable = function () {\r\n return this._updatable;\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n Buffer.prototype.getData = function () {\r\n return this._data;\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n Buffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * DEPRECATED. Use byteStride instead.\r\n * @returns the stride in float32 units\r\n */\r\n Buffer.prototype.getStrideSize = function () {\r\n return this.byteStride / Float32Array.BYTES_PER_ELEMENT;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.create = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (!data && this._buffer) {\r\n return; // nothing to do\r\n }\r\n data = data || this._data;\r\n if (!data) {\r\n return;\r\n }\r\n if (!this._buffer) { // create buffer\r\n if (this._updatable) {\r\n this._buffer = this._engine.createDynamicVertexBuffer(data);\r\n this._data = data;\r\n }\r\n else {\r\n this._buffer = this._engine.createVertexBuffer(data);\r\n }\r\n }\r\n else if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data);\r\n this._data = data;\r\n }\r\n };\r\n /** @hidden */\r\n Buffer.prototype._rebuild = function () {\r\n this._buffer = null;\r\n this.create(this._data);\r\n };\r\n /**\r\n * Update current buffer data\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.update = function (data) {\r\n this.create(data);\r\n };\r\n /**\r\n * Updates the data directly.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param vertexCount the vertex count (optional)\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Buffer.prototype.updateDirectly = function (data, offset, vertexCount, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data, useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT, (vertexCount ? vertexCount * this.byteStride : undefined));\r\n this._data = null;\r\n }\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n Buffer.prototype.dispose = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n return Buffer;\r\n}());\r\n\r\n/**\r\n * Specialized buffer used to store vertex data\r\n */\r\nvar VertexBuffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param updatable whether the data is updatable\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param stride the stride (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param offset the offset of the data (optional)\r\n * @param size the number of components (optional)\r\n * @param type the type of the component (optional)\r\n * @param normalized whether the data contains normalized data (optional)\r\n * @param useBytes set to true if stride and offset are in bytes (optional)\r\n */\r\n function VertexBuffer(engine, data, kind, updatable, postponeInternalCreation, stride, instanced, offset, size, type, normalized, useBytes) {\r\n if (normalized === void 0) { normalized = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (data instanceof Buffer) {\r\n this._buffer = data;\r\n this._ownsBuffer = false;\r\n }\r\n else {\r\n this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes);\r\n this._ownsBuffer = true;\r\n }\r\n this._kind = kind;\r\n if (type == undefined) {\r\n var data_1 = this.getData();\r\n this.type = VertexBuffer.FLOAT;\r\n if (data_1 instanceof Int8Array) {\r\n this.type = VertexBuffer.BYTE;\r\n }\r\n else if (data_1 instanceof Uint8Array) {\r\n this.type = VertexBuffer.UNSIGNED_BYTE;\r\n }\r\n else if (data_1 instanceof Int16Array) {\r\n this.type = VertexBuffer.SHORT;\r\n }\r\n else if (data_1 instanceof Uint16Array) {\r\n this.type = VertexBuffer.UNSIGNED_SHORT;\r\n }\r\n else if (data_1 instanceof Int32Array) {\r\n this.type = VertexBuffer.INT;\r\n }\r\n else if (data_1 instanceof Uint32Array) {\r\n this.type = VertexBuffer.UNSIGNED_INT;\r\n }\r\n }\r\n else {\r\n this.type = type;\r\n }\r\n var typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\r\n if (useBytes) {\r\n this._size = size || (stride ? (stride / typeByteLength) : VertexBuffer.DeduceStride(kind));\r\n this.byteStride = stride || this._buffer.byteStride || (this._size * typeByteLength);\r\n this.byteOffset = offset || 0;\r\n }\r\n else {\r\n this._size = size || stride || VertexBuffer.DeduceStride(kind);\r\n this.byteStride = stride ? (stride * typeByteLength) : (this._buffer.byteStride || (this._size * typeByteLength));\r\n this.byteOffset = (offset || 0) * typeByteLength;\r\n }\r\n this.normalized = normalized;\r\n this._instanced = instanced !== undefined ? instanced : false;\r\n this._instanceDivisor = instanced ? 1 : 0;\r\n }\r\n Object.defineProperty(VertexBuffer.prototype, \"instanceDivisor\", {\r\n /**\r\n * Gets or sets the instance divisor when in instanced mode\r\n */\r\n get: function () {\r\n return this._instanceDivisor;\r\n },\r\n set: function (value) {\r\n this._instanceDivisor = value;\r\n if (value == 0) {\r\n this._instanced = false;\r\n }\r\n else {\r\n this._instanced = true;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n VertexBuffer.prototype._rebuild = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n this._buffer._rebuild();\r\n };\r\n /**\r\n * Returns the kind of the VertexBuffer (string)\r\n * @returns a string\r\n */\r\n VertexBuffer.prototype.getKind = function () {\r\n return this._kind;\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the VertexBuffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n VertexBuffer.prototype.isUpdatable = function () {\r\n return this._buffer.isUpdatable();\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n VertexBuffer.prototype.getData = function () {\r\n return this._buffer.getData();\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n VertexBuffer.prototype.getBuffer = function () {\r\n return this._buffer.getBuffer();\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * DEPRECATED. Use byteStride instead.\r\n * @returns the stride in float32 units\r\n */\r\n VertexBuffer.prototype.getStrideSize = function () {\r\n return this.byteStride / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the offset as a multiple of the type byte length.\r\n * DEPRECATED. Use byteOffset instead.\r\n * @returns the offset in bytes\r\n */\r\n VertexBuffer.prototype.getOffset = function () {\r\n return this.byteOffset / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the number of components per vertex attribute (integer)\r\n * @returns the size in float\r\n */\r\n VertexBuffer.prototype.getSize = function () {\r\n return this._size;\r\n };\r\n /**\r\n * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced\r\n * @returns true if this buffer is instanced\r\n */\r\n VertexBuffer.prototype.getIsInstanced = function () {\r\n return this._instanced;\r\n };\r\n /**\r\n * Returns the instancing divisor, zero for non-instanced (integer).\r\n * @returns a number\r\n */\r\n VertexBuffer.prototype.getInstanceDivisor = function () {\r\n return this._instanceDivisor;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.create = function (data) {\r\n this._buffer.create(data);\r\n };\r\n /**\r\n * Updates the underlying buffer according to the passed numeric array or Float32Array.\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.update = function (data) {\r\n this._buffer.update(data);\r\n };\r\n /**\r\n * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.\r\n * Returns the directly updated WebGLBuffer.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n VertexBuffer.prototype.updateDirectly = function (data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n this._buffer.updateDirectly(data, offset, undefined, useBytes);\r\n };\r\n /**\r\n * Disposes the VertexBuffer and the underlying WebGLBuffer.\r\n */\r\n VertexBuffer.prototype.dispose = function () {\r\n if (this._ownsBuffer) {\r\n this._buffer.dispose();\r\n }\r\n };\r\n /**\r\n * Enumerates each value of this vertex buffer as numbers.\r\n * @param count the number of values to enumerate\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.prototype.forEach = function (count, callback) {\r\n VertexBuffer.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);\r\n };\r\n /**\r\n * Deduces the stride given a kind.\r\n * @param kind The kind string to deduce\r\n * @returns The deduced stride\r\n */\r\n VertexBuffer.DeduceStride = function (kind) {\r\n switch (kind) {\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind:\r\n case VertexBuffer.UV3Kind:\r\n case VertexBuffer.UV4Kind:\r\n case VertexBuffer.UV5Kind:\r\n case VertexBuffer.UV6Kind:\r\n return 2;\r\n case VertexBuffer.NormalKind:\r\n case VertexBuffer.PositionKind:\r\n return 3;\r\n case VertexBuffer.ColorKind:\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n case VertexBuffer.TangentKind:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid kind '\" + kind + \"'\");\r\n }\r\n };\r\n /**\r\n * Gets the byte length of the given type.\r\n * @param type the type\r\n * @returns the number of bytes\r\n */\r\n VertexBuffer.GetTypeByteLength = function (type) {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return 1;\r\n case VertexBuffer.SHORT:\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return 2;\r\n case VertexBuffer.INT:\r\n case VertexBuffer.UNSIGNED_INT:\r\n case VertexBuffer.FLOAT:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid type '\" + type + \"'\");\r\n }\r\n };\r\n /**\r\n * Enumerates each value of the given parameters as numbers.\r\n * @param data the data to enumerate\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param componentCount the number of components per element\r\n * @param componentType the type of the component\r\n * @param count the number of values to enumerate\r\n * @param normalized whether the data is normalized\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.ForEach = function (data, byteOffset, byteStride, componentCount, componentType, count, normalized, callback) {\r\n if (data instanceof Array) {\r\n var offset = byteOffset / 4;\r\n var stride = byteStride / 4;\r\n for (var index = 0; index < count; index += componentCount) {\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n callback(data[offset + componentIndex], index + componentIndex);\r\n }\r\n offset += stride;\r\n }\r\n }\r\n else {\r\n var dataView = data instanceof ArrayBuffer ? new DataView(data) : new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n var componentByteLength = VertexBuffer.GetTypeByteLength(componentType);\r\n for (var index = 0; index < count; index += componentCount) {\r\n var componentByteOffset = byteOffset;\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n var value = VertexBuffer._GetFloatValue(dataView, componentType, componentByteOffset, normalized);\r\n callback(value, index + componentIndex);\r\n componentByteOffset += componentByteLength;\r\n }\r\n byteOffset += byteStride;\r\n }\r\n }\r\n };\r\n VertexBuffer._GetFloatValue = function (dataView, type, byteOffset, normalized) {\r\n switch (type) {\r\n case VertexBuffer.BYTE: {\r\n var value = dataView.getInt8(byteOffset);\r\n if (normalized) {\r\n value = Math.max(value / 127, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_BYTE: {\r\n var value = dataView.getUint8(byteOffset);\r\n if (normalized) {\r\n value = value / 255;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.SHORT: {\r\n var value = dataView.getInt16(byteOffset, true);\r\n if (normalized) {\r\n value = Math.max(value / 32767, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_SHORT: {\r\n var value = dataView.getUint16(byteOffset, true);\r\n if (normalized) {\r\n value = value / 65535;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.INT: {\r\n return dataView.getInt32(byteOffset, true);\r\n }\r\n case VertexBuffer.UNSIGNED_INT: {\r\n return dataView.getUint32(byteOffset, true);\r\n }\r\n case VertexBuffer.FLOAT: {\r\n return dataView.getFloat32(byteOffset, true);\r\n }\r\n default: {\r\n throw new Error(\"Invalid component type \" + type);\r\n }\r\n }\r\n };\r\n /**\r\n * The byte type.\r\n */\r\n VertexBuffer.BYTE = 5120;\r\n /**\r\n * The unsigned byte type.\r\n */\r\n VertexBuffer.UNSIGNED_BYTE = 5121;\r\n /**\r\n * The short type.\r\n */\r\n VertexBuffer.SHORT = 5122;\r\n /**\r\n * The unsigned short type.\r\n */\r\n VertexBuffer.UNSIGNED_SHORT = 5123;\r\n /**\r\n * The integer type.\r\n */\r\n VertexBuffer.INT = 5124;\r\n /**\r\n * The unsigned integer type.\r\n */\r\n VertexBuffer.UNSIGNED_INT = 5125;\r\n /**\r\n * The float type.\r\n */\r\n VertexBuffer.FLOAT = 5126;\r\n // Enums\r\n /**\r\n * Positions\r\n */\r\n VertexBuffer.PositionKind = \"position\";\r\n /**\r\n * Normals\r\n */\r\n VertexBuffer.NormalKind = \"normal\";\r\n /**\r\n * Tangents\r\n */\r\n VertexBuffer.TangentKind = \"tangent\";\r\n /**\r\n * Texture coordinates\r\n */\r\n VertexBuffer.UVKind = \"uv\";\r\n /**\r\n * Texture coordinates 2\r\n */\r\n VertexBuffer.UV2Kind = \"uv2\";\r\n /**\r\n * Texture coordinates 3\r\n */\r\n VertexBuffer.UV3Kind = \"uv3\";\r\n /**\r\n * Texture coordinates 4\r\n */\r\n VertexBuffer.UV4Kind = \"uv4\";\r\n /**\r\n * Texture coordinates 5\r\n */\r\n VertexBuffer.UV5Kind = \"uv5\";\r\n /**\r\n * Texture coordinates 6\r\n */\r\n VertexBuffer.UV6Kind = \"uv6\";\r\n /**\r\n * Colors\r\n */\r\n VertexBuffer.ColorKind = \"color\";\r\n /**\r\n * Matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesKind = \"matricesIndices\";\r\n /**\r\n * Matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsKind = \"matricesWeights\";\r\n /**\r\n * Additional matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesExtraKind = \"matricesIndicesExtra\";\r\n /**\r\n * Additional matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsExtraKind = \"matricesWeightsExtra\";\r\n return VertexBuffer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/csg.ts\":\n/*!***********************!*\\\n !*** ./Meshes/csg.ts ***!\n \\***********************/\n/*! exports provided: CSG */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return CSG; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Unique ID when we import meshes from Babylon to CSG\r\n */\r\nvar currentCSGMeshId = 0;\r\n/**\r\n * Represents a vertex of a polygon. Use your own vertex class instead of this\r\n * one to provide additional features like texture coordinates and vertex\r\n * colors. Custom vertex classes need to provide a `pos` property and `clone()`,\r\n * `flip()`, and `interpolate()` methods that behave analogous to the ones\r\n * defined by `BABYLON.CSG.Vertex`. This class provides `normal` so convenience\r\n * functions like `BABYLON.CSG.sphere()` can return a smooth vertex normal, but `normal`\r\n * is not used anywhere else.\r\n * Same goes for uv, it allows to keep the original vertex uv coordinates of the 2 meshes\r\n */\r\nvar Vertex = /** @class */ (function () {\r\n /**\r\n * Initializes the vertex\r\n * @param pos The position of the vertex\r\n * @param normal The normal of the vertex\r\n * @param uv The texture coordinate of the vertex\r\n */\r\n function Vertex(\r\n /**\r\n * The position of the vertex\r\n */\r\n pos, \r\n /**\r\n * The normal of the vertex\r\n */\r\n normal, \r\n /**\r\n * The texture coordinate of the vertex\r\n */\r\n uv) {\r\n this.pos = pos;\r\n this.normal = normal;\r\n this.uv = uv;\r\n }\r\n /**\r\n * Make a clone, or deep copy, of the vertex\r\n * @returns A new Vertex\r\n */\r\n Vertex.prototype.clone = function () {\r\n return new Vertex(this.pos.clone(), this.normal.clone(), this.uv.clone());\r\n };\r\n /**\r\n * Invert all orientation-specific data (e.g. vertex normal). Called when the\r\n * orientation of a polygon is flipped.\r\n */\r\n Vertex.prototype.flip = function () {\r\n this.normal = this.normal.scale(-1);\r\n };\r\n /**\r\n * Create a new vertex between this vertex and `other` by linearly\r\n * interpolating all properties using a parameter of `t`. Subclasses should\r\n * override this to interpolate additional properties.\r\n * @param other the vertex to interpolate against\r\n * @param t The factor used to linearly interpolate between the vertices\r\n */\r\n Vertex.prototype.interpolate = function (other, t) {\r\n return new Vertex(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(this.pos, other.pos, t), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Lerp(this.normal, other.normal, t), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Lerp(this.uv, other.uv, t));\r\n };\r\n return Vertex;\r\n}());\r\n/**\r\n * Represents a plane in 3D space.\r\n */\r\nvar Plane = /** @class */ (function () {\r\n /**\r\n * Initializes the plane\r\n * @param normal The normal for the plane\r\n * @param w\r\n */\r\n function Plane(normal, w) {\r\n this.normal = normal;\r\n this.w = w;\r\n }\r\n /**\r\n * Construct a plane from three points\r\n * @param a Point a\r\n * @param b Point b\r\n * @param c Point c\r\n */\r\n Plane.FromPoints = function (a, b, c) {\r\n var v0 = c.subtract(a);\r\n var v1 = b.subtract(a);\r\n if (v0.lengthSquared() === 0 || v1.lengthSquared() === 0) {\r\n return null;\r\n }\r\n var n = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(v0, v1));\r\n return new Plane(n, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(n, a));\r\n };\r\n /**\r\n * Clone, or make a deep copy of the plane\r\n * @returns a new Plane\r\n */\r\n Plane.prototype.clone = function () {\r\n return new Plane(this.normal.clone(), this.w);\r\n };\r\n /**\r\n * Flip the face of the plane\r\n */\r\n Plane.prototype.flip = function () {\r\n this.normal.scaleInPlace(-1);\r\n this.w = -this.w;\r\n };\r\n /**\r\n * Split `polygon` by this plane if needed, then put the polygon or polygon\r\n * fragments in the appropriate lists. Coplanar polygons go into either\r\n `* coplanarFront` or `coplanarBack` depending on their orientation with\r\n * respect to this plane. Polygons in front or in back of this plane go into\r\n * either `front` or `back`\r\n * @param polygon The polygon to be split\r\n * @param coplanarFront Will contain polygons coplanar with the plane that are oriented to the front of the plane\r\n * @param coplanarBack Will contain polygons coplanar with the plane that are oriented to the back of the plane\r\n * @param front Will contain the polygons in front of the plane\r\n * @param back Will contain the polygons begind the plane\r\n */\r\n Plane.prototype.splitPolygon = function (polygon, coplanarFront, coplanarBack, front, back) {\r\n var COPLANAR = 0;\r\n var FRONT = 1;\r\n var BACK = 2;\r\n var SPANNING = 3;\r\n // Classify each point as well as the entire polygon into one of the above\r\n // four classes.\r\n var polygonType = 0;\r\n var types = [];\r\n var i;\r\n var t;\r\n for (i = 0; i < polygon.vertices.length; i++) {\r\n t = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, polygon.vertices[i].pos) - this.w;\r\n var type = (t < -Plane.EPSILON) ? BACK : (t > Plane.EPSILON) ? FRONT : COPLANAR;\r\n polygonType |= type;\r\n types.push(type);\r\n }\r\n // Put the polygon in the correct list, splitting it when necessary\r\n switch (polygonType) {\r\n case COPLANAR:\r\n (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, polygon.plane.normal) > 0 ? coplanarFront : coplanarBack).push(polygon);\r\n break;\r\n case FRONT:\r\n front.push(polygon);\r\n break;\r\n case BACK:\r\n back.push(polygon);\r\n break;\r\n case SPANNING:\r\n var f = [], b = [];\r\n for (i = 0; i < polygon.vertices.length; i++) {\r\n var j = (i + 1) % polygon.vertices.length;\r\n var ti = types[i], tj = types[j];\r\n var vi = polygon.vertices[i], vj = polygon.vertices[j];\r\n if (ti !== BACK) {\r\n f.push(vi);\r\n }\r\n if (ti !== FRONT) {\r\n b.push(ti !== BACK ? vi.clone() : vi);\r\n }\r\n if ((ti | tj) === SPANNING) {\r\n t = (this.w - _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, vi.pos)) / _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(this.normal, vj.pos.subtract(vi.pos));\r\n var v = vi.interpolate(vj, t);\r\n f.push(v);\r\n b.push(v.clone());\r\n }\r\n }\r\n var poly;\r\n if (f.length >= 3) {\r\n poly = new Polygon(f, polygon.shared);\r\n if (poly.plane) {\r\n front.push(poly);\r\n }\r\n }\r\n if (b.length >= 3) {\r\n poly = new Polygon(b, polygon.shared);\r\n if (poly.plane) {\r\n back.push(poly);\r\n }\r\n }\r\n break;\r\n }\r\n };\r\n /**\r\n * `CSG.Plane.EPSILON` is the tolerance used by `splitPolygon()` to decide if a\r\n * point is on the plane\r\n */\r\n Plane.EPSILON = 1e-5;\r\n return Plane;\r\n}());\r\n/**\r\n * Represents a convex polygon. The vertices used to initialize a polygon must\r\n * be coplanar and form a convex loop.\r\n *\r\n * Each convex polygon has a `shared` property, which is shared between all\r\n * polygons that are clones of each other or were split from the same polygon.\r\n * This can be used to define per-polygon properties (such as surface color)\r\n */\r\nvar Polygon = /** @class */ (function () {\r\n /**\r\n * Initializes the polygon\r\n * @param vertices The vertices of the polygon\r\n * @param shared The properties shared across all polygons\r\n */\r\n function Polygon(vertices, shared) {\r\n this.vertices = vertices;\r\n this.shared = shared;\r\n this.plane = Plane.FromPoints(vertices[0].pos, vertices[1].pos, vertices[2].pos);\r\n }\r\n /**\r\n * Clones, or makes a deep copy, or the polygon\r\n */\r\n Polygon.prototype.clone = function () {\r\n var vertices = this.vertices.map(function (v) { return v.clone(); });\r\n return new Polygon(vertices, this.shared);\r\n };\r\n /**\r\n * Flips the faces of the polygon\r\n */\r\n Polygon.prototype.flip = function () {\r\n this.vertices.reverse().map(function (v) { v.flip(); });\r\n this.plane.flip();\r\n };\r\n return Polygon;\r\n}());\r\n/**\r\n * Holds a node in a BSP tree. A BSP tree is built from a collection of polygons\r\n * by picking a polygon to split along. That polygon (and all other coplanar\r\n * polygons) are added directly to that node and the other polygons are added to\r\n * the front and/or back subtrees. This is not a leafy BSP tree since there is\r\n * no distinction between internal and leaf nodes\r\n */\r\nvar Node = /** @class */ (function () {\r\n /**\r\n * Initializes the node\r\n * @param polygons A collection of polygons held in the node\r\n */\r\n function Node(polygons) {\r\n this.plane = null;\r\n this.front = null;\r\n this.back = null;\r\n this.polygons = new Array();\r\n if (polygons) {\r\n this.build(polygons);\r\n }\r\n }\r\n /**\r\n * Clones, or makes a deep copy, of the node\r\n * @returns The cloned node\r\n */\r\n Node.prototype.clone = function () {\r\n var node = new Node();\r\n node.plane = this.plane && this.plane.clone();\r\n node.front = this.front && this.front.clone();\r\n node.back = this.back && this.back.clone();\r\n node.polygons = this.polygons.map(function (p) { return p.clone(); });\r\n return node;\r\n };\r\n /**\r\n * Convert solid space to empty space and empty space to solid space\r\n */\r\n Node.prototype.invert = function () {\r\n for (var i = 0; i < this.polygons.length; i++) {\r\n this.polygons[i].flip();\r\n }\r\n if (this.plane) {\r\n this.plane.flip();\r\n }\r\n if (this.front) {\r\n this.front.invert();\r\n }\r\n if (this.back) {\r\n this.back.invert();\r\n }\r\n var temp = this.front;\r\n this.front = this.back;\r\n this.back = temp;\r\n };\r\n /**\r\n * Recursively remove all polygons in `polygons` that are inside this BSP\r\n * tree.\r\n * @param polygons Polygons to remove from the BSP\r\n * @returns Polygons clipped from the BSP\r\n */\r\n Node.prototype.clipPolygons = function (polygons) {\r\n if (!this.plane) {\r\n return polygons.slice();\r\n }\r\n var front = new Array(), back = new Array();\r\n for (var i = 0; i < polygons.length; i++) {\r\n this.plane.splitPolygon(polygons[i], front, back, front, back);\r\n }\r\n if (this.front) {\r\n front = this.front.clipPolygons(front);\r\n }\r\n if (this.back) {\r\n back = this.back.clipPolygons(back);\r\n }\r\n else {\r\n back = [];\r\n }\r\n return front.concat(back);\r\n };\r\n /**\r\n * Remove all polygons in this BSP tree that are inside the other BSP tree\r\n * `bsp`.\r\n * @param bsp BSP containing polygons to remove from this BSP\r\n */\r\n Node.prototype.clipTo = function (bsp) {\r\n this.polygons = bsp.clipPolygons(this.polygons);\r\n if (this.front) {\r\n this.front.clipTo(bsp);\r\n }\r\n if (this.back) {\r\n this.back.clipTo(bsp);\r\n }\r\n };\r\n /**\r\n * Return a list of all polygons in this BSP tree\r\n * @returns List of all polygons in this BSP tree\r\n */\r\n Node.prototype.allPolygons = function () {\r\n var polygons = this.polygons.slice();\r\n if (this.front) {\r\n polygons = polygons.concat(this.front.allPolygons());\r\n }\r\n if (this.back) {\r\n polygons = polygons.concat(this.back.allPolygons());\r\n }\r\n return polygons;\r\n };\r\n /**\r\n * Build a BSP tree out of `polygons`. When called on an existing tree, the\r\n * new polygons are filtered down to the bottom of the tree and become new\r\n * nodes there. Each set of polygons is partitioned using the first polygon\r\n * (no heuristic is used to pick a good split)\r\n * @param polygons Polygons used to construct the BSP tree\r\n */\r\n Node.prototype.build = function (polygons) {\r\n if (!polygons.length) {\r\n return;\r\n }\r\n if (!this.plane) {\r\n this.plane = polygons[0].plane.clone();\r\n }\r\n var front = new Array(), back = new Array();\r\n for (var i = 0; i < polygons.length; i++) {\r\n this.plane.splitPolygon(polygons[i], this.polygons, this.polygons, front, back);\r\n }\r\n if (front.length) {\r\n if (!this.front) {\r\n this.front = new Node();\r\n }\r\n this.front.build(front);\r\n }\r\n if (back.length) {\r\n if (!this.back) {\r\n this.back = new Node();\r\n }\r\n this.back.build(back);\r\n }\r\n };\r\n return Node;\r\n}());\r\n/**\r\n * Class for building Constructive Solid Geometry\r\n */\r\nvar CSG = /** @class */ (function () {\r\n function CSG() {\r\n this.polygons = new Array();\r\n }\r\n /**\r\n * Convert the Mesh to CSG\r\n * @param mesh The Mesh to convert to CSG\r\n * @returns A new CSG from the Mesh\r\n */\r\n CSG.FromMesh = function (mesh) {\r\n var vertex, normal, uv, position, polygon, polygons = new Array(), vertices;\r\n var matrix, meshPosition, meshRotation, meshRotationQuaternion = null, meshScaling;\r\n if (mesh instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]) {\r\n mesh.computeWorldMatrix(true);\r\n matrix = mesh.getWorldMatrix();\r\n meshPosition = mesh.position.clone();\r\n meshRotation = mesh.rotation.clone();\r\n if (mesh.rotationQuaternion) {\r\n meshRotationQuaternion = mesh.rotationQuaternion.clone();\r\n }\r\n meshScaling = mesh.scaling.clone();\r\n }\r\n else {\r\n throw 'BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh';\r\n }\r\n var indices = mesh.getIndices(), positions = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind), normals = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind), uvs = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n var subMeshes = mesh.subMeshes;\r\n for (var sm = 0, sml = subMeshes.length; sm < sml; sm++) {\r\n for (var i = subMeshes[sm].indexStart, il = subMeshes[sm].indexCount + subMeshes[sm].indexStart; i < il; i += 3) {\r\n vertices = [];\r\n for (var j = 0; j < 3; j++) {\r\n var sourceNormal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](normals[indices[i + j] * 3], normals[indices[i + j] * 3 + 1], normals[indices[i + j] * 3 + 2]);\r\n uv = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](uvs[indices[i + j] * 2], uvs[indices[i + j] * 2 + 1]);\r\n var sourcePosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](positions[indices[i + j] * 3], positions[indices[i + j] * 3 + 1], positions[indices[i + j] * 3 + 2]);\r\n position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(sourcePosition, matrix);\r\n normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(sourceNormal, matrix);\r\n vertex = new Vertex(position, normal, uv);\r\n vertices.push(vertex);\r\n }\r\n polygon = new Polygon(vertices, { subMeshId: sm, meshId: currentCSGMeshId, materialIndex: subMeshes[sm].materialIndex });\r\n // To handle the case of degenerated triangle\r\n // polygon.plane == null <=> the polygon does not represent 1 single plane <=> the triangle is degenerated\r\n if (polygon.plane) {\r\n polygons.push(polygon);\r\n }\r\n }\r\n }\r\n var csg = CSG.FromPolygons(polygons);\r\n csg.matrix = matrix;\r\n csg.position = meshPosition;\r\n csg.rotation = meshRotation;\r\n csg.scaling = meshScaling;\r\n csg.rotationQuaternion = meshRotationQuaternion;\r\n currentCSGMeshId++;\r\n return csg;\r\n };\r\n /**\r\n * Construct a CSG solid from a list of `CSG.Polygon` instances.\r\n * @param polygons Polygons used to construct a CSG solid\r\n */\r\n CSG.FromPolygons = function (polygons) {\r\n var csg = new CSG();\r\n csg.polygons = polygons;\r\n return csg;\r\n };\r\n /**\r\n * Clones, or makes a deep copy, of the CSG\r\n * @returns A new CSG\r\n */\r\n CSG.prototype.clone = function () {\r\n var csg = new CSG();\r\n csg.polygons = this.polygons.map(function (p) { return p.clone(); });\r\n csg.copyTransformAttributes(this);\r\n return csg;\r\n };\r\n /**\r\n * Unions this CSG with another CSG\r\n * @param csg The CSG to union against this CSG\r\n * @returns The unioned CSG\r\n */\r\n CSG.prototype.union = function (csg) {\r\n var a = new Node(this.clone().polygons);\r\n var b = new Node(csg.clone().polygons);\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n return CSG.FromPolygons(a.allPolygons()).copyTransformAttributes(this);\r\n };\r\n /**\r\n * Unions this CSG with another CSG in place\r\n * @param csg The CSG to union against this CSG\r\n */\r\n CSG.prototype.unionInPlace = function (csg) {\r\n var a = new Node(this.polygons);\r\n var b = new Node(csg.polygons);\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n this.polygons = a.allPolygons();\r\n };\r\n /**\r\n * Subtracts this CSG with another CSG\r\n * @param csg The CSG to subtract against this CSG\r\n * @returns A new CSG\r\n */\r\n CSG.prototype.subtract = function (csg) {\r\n var a = new Node(this.clone().polygons);\r\n var b = new Node(csg.clone().polygons);\r\n a.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n a.invert();\r\n return CSG.FromPolygons(a.allPolygons()).copyTransformAttributes(this);\r\n };\r\n /**\r\n * Subtracts this CSG with another CSG in place\r\n * @param csg The CSG to subtact against this CSG\r\n */\r\n CSG.prototype.subtractInPlace = function (csg) {\r\n var a = new Node(this.polygons);\r\n var b = new Node(csg.polygons);\r\n a.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n b.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.build(b.allPolygons());\r\n a.invert();\r\n this.polygons = a.allPolygons();\r\n };\r\n /**\r\n * Intersect this CSG with another CSG\r\n * @param csg The CSG to intersect against this CSG\r\n * @returns A new CSG\r\n */\r\n CSG.prototype.intersect = function (csg) {\r\n var a = new Node(this.clone().polygons);\r\n var b = new Node(csg.clone().polygons);\r\n a.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n a.build(b.allPolygons());\r\n a.invert();\r\n return CSG.FromPolygons(a.allPolygons()).copyTransformAttributes(this);\r\n };\r\n /**\r\n * Intersects this CSG with another CSG in place\r\n * @param csg The CSG to intersect against this CSG\r\n */\r\n CSG.prototype.intersectInPlace = function (csg) {\r\n var a = new Node(this.polygons);\r\n var b = new Node(csg.polygons);\r\n a.invert();\r\n b.clipTo(a);\r\n b.invert();\r\n a.clipTo(b);\r\n b.clipTo(a);\r\n a.build(b.allPolygons());\r\n a.invert();\r\n this.polygons = a.allPolygons();\r\n };\r\n /**\r\n * Return a new CSG solid with solid and empty space switched. This solid is\r\n * not modified.\r\n * @returns A new CSG solid with solid and empty space switched\r\n */\r\n CSG.prototype.inverse = function () {\r\n var csg = this.clone();\r\n csg.inverseInPlace();\r\n return csg;\r\n };\r\n /**\r\n * Inverses the CSG in place\r\n */\r\n CSG.prototype.inverseInPlace = function () {\r\n this.polygons.map(function (p) { p.flip(); });\r\n };\r\n /**\r\n * This is used to keep meshes transformations so they can be restored\r\n * when we build back a Babylon Mesh\r\n * NB : All CSG operations are performed in world coordinates\r\n * @param csg The CSG to copy the transform attributes from\r\n * @returns This CSG\r\n */\r\n CSG.prototype.copyTransformAttributes = function (csg) {\r\n this.matrix = csg.matrix;\r\n this.position = csg.position;\r\n this.rotation = csg.rotation;\r\n this.scaling = csg.scaling;\r\n this.rotationQuaternion = csg.rotationQuaternion;\r\n return this;\r\n };\r\n /**\r\n * Build Raw mesh from CSG\r\n * Coordinates here are in world space\r\n * @param name The name of the mesh geometry\r\n * @param scene The Scene\r\n * @param keepSubMeshes Specifies if the submeshes should be kept\r\n * @returns A new Mesh\r\n */\r\n CSG.prototype.buildMeshGeometry = function (name, scene, keepSubMeshes) {\r\n var matrix = this.matrix.clone();\r\n matrix.invert();\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"](name, scene), vertices = [], indices = [], normals = [], uvs = [], vertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(), uv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"].Zero(), polygons = this.polygons, polygonIndices = [0, 0, 0], polygon, vertice_dict = {}, vertex_idx, currentIndex = 0, subMesh_dict = {}, subMesh_obj;\r\n if (keepSubMeshes) {\r\n // Sort Polygons, since subMeshes are indices range\r\n polygons.sort(function (a, b) {\r\n if (a.shared.meshId === b.shared.meshId) {\r\n return a.shared.subMeshId - b.shared.subMeshId;\r\n }\r\n else {\r\n return a.shared.meshId - b.shared.meshId;\r\n }\r\n });\r\n }\r\n for (var i = 0, il = polygons.length; i < il; i++) {\r\n polygon = polygons[i];\r\n // Building SubMeshes\r\n if (!subMesh_dict[polygon.shared.meshId]) {\r\n subMesh_dict[polygon.shared.meshId] = {};\r\n }\r\n if (!subMesh_dict[polygon.shared.meshId][polygon.shared.subMeshId]) {\r\n subMesh_dict[polygon.shared.meshId][polygon.shared.subMeshId] = {\r\n indexStart: +Infinity,\r\n indexEnd: -Infinity,\r\n materialIndex: polygon.shared.materialIndex\r\n };\r\n }\r\n subMesh_obj = subMesh_dict[polygon.shared.meshId][polygon.shared.subMeshId];\r\n for (var j = 2, jl = polygon.vertices.length; j < jl; j++) {\r\n polygonIndices[0] = 0;\r\n polygonIndices[1] = j - 1;\r\n polygonIndices[2] = j;\r\n for (var k = 0; k < 3; k++) {\r\n vertex.copyFrom(polygon.vertices[polygonIndices[k]].pos);\r\n normal.copyFrom(polygon.vertices[polygonIndices[k]].normal);\r\n uv.copyFrom(polygon.vertices[polygonIndices[k]].uv);\r\n var localVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(vertex, matrix);\r\n var localNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(normal, matrix);\r\n vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z];\r\n // Check if 2 points can be merged\r\n if (!(typeof vertex_idx !== 'undefined' &&\r\n normals[vertex_idx * 3] === localNormal.x &&\r\n normals[vertex_idx * 3 + 1] === localNormal.y &&\r\n normals[vertex_idx * 3 + 2] === localNormal.z &&\r\n uvs[vertex_idx * 2] === uv.x &&\r\n uvs[vertex_idx * 2 + 1] === uv.y)) {\r\n vertices.push(localVertex.x, localVertex.y, localVertex.z);\r\n uvs.push(uv.x, uv.y);\r\n normals.push(normal.x, normal.y, normal.z);\r\n vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z] = (vertices.length / 3) - 1;\r\n }\r\n indices.push(vertex_idx);\r\n subMesh_obj.indexStart = Math.min(currentIndex, subMesh_obj.indexStart);\r\n subMesh_obj.indexEnd = Math.max(currentIndex, subMesh_obj.indexEnd);\r\n currentIndex++;\r\n }\r\n }\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, vertices);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, normals);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, uvs);\r\n mesh.setIndices(indices, null);\r\n if (keepSubMeshes) {\r\n // We offset the materialIndex by the previous number of materials in the CSG mixed meshes\r\n var materialIndexOffset = 0, materialMaxIndex;\r\n mesh.subMeshes = new Array();\r\n for (var m in subMesh_dict) {\r\n materialMaxIndex = -1;\r\n for (var sm in subMesh_dict[m]) {\r\n subMesh_obj = subMesh_dict[m][sm];\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__[\"SubMesh\"].CreateFromIndices(subMesh_obj.materialIndex + materialIndexOffset, subMesh_obj.indexStart, subMesh_obj.indexEnd - subMesh_obj.indexStart + 1, mesh);\r\n materialMaxIndex = Math.max(subMesh_obj.materialIndex, materialMaxIndex);\r\n }\r\n materialIndexOffset += ++materialMaxIndex;\r\n }\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Build Mesh from CSG taking material and transforms into account\r\n * @param name The name of the Mesh\r\n * @param material The material of the Mesh\r\n * @param scene The Scene\r\n * @param keepSubMeshes Specifies if submeshes should be kept\r\n * @returns The new Mesh\r\n */\r\n CSG.prototype.toMesh = function (name, material, scene, keepSubMeshes) {\r\n if (material === void 0) { material = null; }\r\n var mesh = this.buildMeshGeometry(name, scene, keepSubMeshes);\r\n mesh.material = material;\r\n mesh.position.copyFrom(this.position);\r\n mesh.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n mesh.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n mesh.scaling.copyFrom(this.scaling);\r\n mesh.computeWorldMatrix(true);\r\n return mesh;\r\n };\r\n return CSG;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/dataBuffer.ts\":\n/*!******************************!*\\\n !*** ./Meshes/dataBuffer.ts ***!\n \\******************************/\n/*! exports provided: DataBuffer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return DataBuffer; });\n/**\r\n * Class used to store gfx data (like WebGLBuffer)\r\n */\r\nvar DataBuffer = /** @class */ (function () {\r\n function DataBuffer() {\r\n /**\r\n * Gets or sets the number of objects referencing this buffer\r\n */\r\n this.references = 0;\r\n /** Gets or sets the size of the underlying buffer */\r\n this.capacity = 0;\r\n /**\r\n * Gets or sets a boolean indicating if the buffer contains 32bits indices\r\n */\r\n this.is32Bits = false;\r\n }\r\n Object.defineProperty(DataBuffer.prototype, \"underlyingResource\", {\r\n /**\r\n * Gets the underlying buffer\r\n */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DataBuffer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/geometry.ts\":\n/*!****************************!*\\\n !*** ./Meshes/geometry.ts ***!\n \\****************************/\n/*! exports provided: Geometry */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return Geometry; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Loading/sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_functions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.functions */ \"./Maths/math.functions.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nvar Geometry = /** @class */ (function () {\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n */\r\n function Geometry(id, scene, vertexData, updatable, mesh) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (mesh === void 0) { mesh = null; }\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n this._totalVertices = 0;\r\n this._isDisposed = false;\r\n this._indexBufferIsUpdatable = false;\r\n this.id = id;\r\n this.uniqueId = scene.getUniqueId();\r\n this._engine = scene.getEngine();\r\n this._meshes = [];\r\n this._scene = scene;\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n }\r\n else {\r\n this._totalVertices = 0;\r\n this._indices = [];\r\n }\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n Object.defineProperty(Geometry.prototype, \"boundingBias\", {\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n get: function () {\r\n return this._boundingBias;\r\n },\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n set: function (value) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n }\r\n else {\r\n this._boundingBias = value.clone();\r\n }\r\n this._updateBoundingInfo(true, null);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n Geometry.CreateGeometryForMesh = function (mesh) {\r\n var geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n geometry.applyToMesh(mesh);\r\n return geometry;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"extend\", {\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n get: function () {\r\n return this._extend;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n Geometry.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n Geometry.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n Geometry.prototype.isReady = function () {\r\n return this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADED || this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"doNotSerialize\", {\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n get: function () {\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Geometry.prototype._rebuild = function () {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n // Vertex buffers\r\n for (var key in this._vertexBuffers) {\r\n var vertexBuffer = this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n };\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n Geometry.prototype.setAllVerticesData = function (vertexData, updatable) {\r\n vertexData.applyToGeometry(this, updatable);\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n Geometry.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n var buffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"](this._engine, data, kind, updatable, this._meshes.length === 0, stride);\r\n this.setVerticesBuffer(buffer);\r\n };\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n Geometry.prototype.removeVerticesData = function (kind) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n };\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n */\r\n Geometry.prototype.setVerticesBuffer = function (buffer, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n var kind = buffer.getKind();\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers[kind] = buffer;\r\n if (kind === _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind) {\r\n var data = buffer.getData();\r\n if (totalVertices != null) {\r\n this._totalVertices = totalVertices;\r\n }\r\n else {\r\n if (data != null) {\r\n this._totalVertices = data.length / (buffer.byteStride / 4);\r\n }\r\n }\r\n this._updateExtend(data);\r\n this._resetPointsArrayCache();\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n var mesh = meshes[index];\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n this.notifyUpdate(kind);\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n }\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Geometry.prototype.updateVerticesDataDirectly = function (kind, data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this.notifyUpdate(kind);\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n Geometry.prototype.updateVerticesData = function (kind, data, updateExtends) {\r\n if (updateExtends === void 0) { updateExtends = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.update(data);\r\n if (kind === _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this.notifyUpdate(kind);\r\n };\r\n Geometry.prototype._updateBoundingInfo = function (updateExtends, data) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n this._resetPointsArrayCache();\r\n if (updateExtends) {\r\n var meshes = this._meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (mesh._boundingInfo) {\r\n mesh._boundingInfo.reConstruct(this._extend.minimum, this._extend.maximum);\r\n }\r\n else {\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n }\r\n var subMeshes = mesh.subMeshes;\r\n for (var _a = 0, subMeshes_1 = subMeshes; _a < subMeshes_1.length; _a++) {\r\n var subMesh = subMeshes_1[_a];\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Geometry.prototype._bind = function (effect, indexToBind) {\r\n if (!effect) {\r\n return;\r\n }\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n var vbs = this.getVertexBuffers();\r\n if (!vbs) {\r\n return;\r\n }\r\n if (indexToBind != this._indexBuffer || !this._vertexArrayObjects) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect);\r\n return;\r\n }\r\n // Using VAO\r\n if (!this._vertexArrayObjects[effect.key]) {\r\n this._vertexArrayObjects[effect.key] = this._engine.recordVertexArrayObject(vbs, indexToBind, effect);\r\n }\r\n this._engine.bindVertexArrayObject(this._vertexArrayObjects[effect.key], indexToBind);\r\n };\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n Geometry.prototype.getTotalVertices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._totalVertices;\r\n };\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n Geometry.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n var data = vertexBuffer.getData();\r\n if (!data) {\r\n return null;\r\n }\r\n var tightlyPackedByteStride = vertexBuffer.getSize() * _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].GetTypeByteLength(vertexBuffer.type);\r\n var count = this._totalVertices * vertexBuffer.getSize();\r\n if (vertexBuffer.type !== _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {\r\n var copy_1 = [];\r\n vertexBuffer.forEach(count, function (value) { return copy_1.push(value); });\r\n return copy_1;\r\n }\r\n if (!((data instanceof Array) || (data instanceof Float32Array)) || vertexBuffer.byteOffset !== 0 || data.length !== count) {\r\n if (data instanceof Array) {\r\n var offset = vertexBuffer.byteOffset / 4;\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_8__[\"Tools\"].Slice(data, offset, offset + count);\r\n }\r\n else if (data instanceof ArrayBuffer) {\r\n return new Float32Array(data, vertexBuffer.byteOffset, count);\r\n }\r\n else {\r\n var offset = data.byteOffset + vertexBuffer.byteOffset;\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n var result = new Float32Array(count);\r\n var source = new Float32Array(data.buffer, offset, count);\r\n result.set(source);\r\n return result;\r\n }\r\n return new Float32Array(data.buffer, offset, count);\r\n }\r\n }\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_8__[\"Tools\"].Slice(data);\r\n }\r\n return data;\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n Geometry.prototype.isVertexBufferUpdatable = function (kind) {\r\n var vb = this._vertexBuffers[kind];\r\n if (!vb) {\r\n return false;\r\n }\r\n return vb.isUpdatable();\r\n };\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n Geometry.prototype.getVertexBuffer = function (kind) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n };\r\n /**\r\n * Returns all vertex buffers\r\n * @return an object holding all vertex buffers indexed by kind\r\n */\r\n Geometry.prototype.getVertexBuffers = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n Geometry.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n };\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n Geometry.prototype.getVerticesDataKinds = function () {\r\n var result = [];\r\n var kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n }\r\n else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n Geometry.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n }\r\n else {\r\n var needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n */\r\n Geometry.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._disposeVertexArrayObjects();\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable);\r\n }\r\n if (totalVertices != undefined) { // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n Geometry.prototype.getTotalIndices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._indices.length;\r\n };\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n Geometry.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n var orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n }\r\n else {\r\n var len = orig.length;\r\n var copy = [];\r\n for (var i = 0; i < len; i++) {\r\n copy.push(orig[i]);\r\n }\r\n return copy;\r\n }\r\n };\r\n /**\r\n * Gets the index buffer\r\n * @return the index buffer\r\n */\r\n Geometry.prototype.getIndexBuffer = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._releaseVertexArrayObject = function (effect) {\r\n if (effect === void 0) { effect = null; }\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n if (this._vertexArrayObjects[effect.key]) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n };\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n Geometry.prototype.releaseForMesh = function (mesh, shouldDispose) {\r\n var meshes = this._meshes;\r\n var index = meshes.indexOf(mesh);\r\n if (index === -1) {\r\n return;\r\n }\r\n meshes.splice(index, 1);\r\n mesh._geometry = null;\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n };\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n Geometry.prototype.applyToMesh = function (mesh) {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n var previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n var meshes = this._meshes;\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n this._scene.pushGeometry(this);\r\n meshes.push(mesh);\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n }\r\n else {\r\n mesh._boundingInfo = this._boundingInfo;\r\n }\r\n };\r\n Geometry.prototype._updateExtend = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (!data) {\r\n data = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind);\r\n }\r\n this._extend = Object(_Maths_math_functions__WEBPACK_IMPORTED_MODULE_10__[\"extractMinAndMax\"])(data, 0, this._totalVertices, this.boundingBias, 3);\r\n };\r\n Geometry.prototype._applyToMesh = function (mesh) {\r\n var numOfMeshes = this._meshes.length;\r\n // vertexBuffers\r\n for (var kind in this._vertexBuffers) {\r\n if (numOfMeshes === 1) {\r\n this._vertexBuffers[kind].create();\r\n }\r\n var buffer = this._vertexBuffers[kind].getBuffer();\r\n if (buffer) {\r\n buffer.references = numOfMeshes;\r\n }\r\n if (kind === _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n // indexBuffer\r\n if (numOfMeshes === 1 && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n if (this._indexBuffer) {\r\n this._indexBuffer.references = numOfMeshes;\r\n }\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n // instances\r\n mesh.synchronizeInstances();\r\n };\r\n Geometry.prototype.notifyUpdate = function (kind) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n };\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n Geometry.prototype.load = function (scene, onLoaded) {\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return;\r\n }\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADING;\r\n this._queueLoad(scene, onLoaded);\r\n };\r\n Geometry.prototype._queueLoad = function (scene, onLoaded) {\r\n var _this = this;\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n scene._addPendingData(this);\r\n scene._loadFile(this.delayLoadingFile, function (data) {\r\n if (!_this._delayLoadingFunction) {\r\n return;\r\n }\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n _this._delayInfo = [];\r\n scene._removePendingData(_this);\r\n var meshes = _this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n _this._applyToMesh(meshes[index]);\r\n }\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n }, undefined, true);\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n Geometry.prototype.toLeftHanded = function () {\r\n // Flip faces\r\n var tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (var i = 0; i < tIndices.length; i += 3) {\r\n var tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n // Negate position.z\r\n var tPositions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (var i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, tPositions, false);\r\n }\r\n // Negate normal.z\r\n var tNormals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (var i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, tNormals, false);\r\n }\r\n };\r\n // Cache\r\n /** @hidden */\r\n Geometry.prototype._resetPointsArrayCache = function () {\r\n this._positions = null;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._generatePointsArray = function () {\r\n if (this._positions) {\r\n return true;\r\n }\r\n var data = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind);\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n this._positions = [];\r\n for (var index = 0; index < data.length; index += 3) {\r\n this._positions.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(data, index));\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n Geometry.prototype.isDisposed = function () {\r\n return this._isDisposed;\r\n };\r\n Geometry.prototype._disposeVertexArrayObjects = function () {\r\n if (this._vertexArrayObjects) {\r\n for (var kind in this._vertexArrayObjects) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {};\r\n }\r\n };\r\n /**\r\n * Free all associated resources\r\n */\r\n Geometry.prototype.dispose = function () {\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n var index;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes = [];\r\n this._disposeVertexArrayObjects();\r\n for (var kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n this._boundingInfo = null;\r\n this._scene.removeGeometry(this);\r\n this._isDisposed = true;\r\n };\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n Geometry.prototype.copy = function (id) {\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"]();\r\n vertexData.indices = [];\r\n var indices = this.getIndices();\r\n if (indices) {\r\n for (var index = 0; index < indices.length; index++) {\r\n vertexData.indices.push(indices[index]);\r\n }\r\n }\r\n var updatable = false;\r\n var stopChecking = false;\r\n var kind;\r\n for (kind in this._vertexBuffers) {\r\n // using slice() to make a copy of the array and not just reference it\r\n var data = this.getVerticesData(kind);\r\n if (data) {\r\n if (data instanceof Float32Array) {\r\n vertexData.set(new Float32Array(data), kind);\r\n }\r\n else {\r\n vertexData.set(data.slice(0), kind);\r\n }\r\n if (!stopChecking) {\r\n var vb = this.getVertexBuffer(kind);\r\n if (vb) {\r\n updatable = vb.isUpdatable();\r\n stopChecking = !updatable;\r\n }\r\n }\r\n }\r\n }\r\n var geometry = new Geometry(id, this._scene, vertexData, updatable);\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n // Bounding info\r\n geometry._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](this._extend.minimum, this._extend.maximum);\r\n return geometry;\r\n };\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @return a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n Geometry.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.id;\r\n serializationObject.updatable = this._updatable;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"].HasTags(this)) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"].GetTags(this);\r\n }\r\n return serializationObject;\r\n };\r\n Geometry.prototype.toNumberArray = function (origin) {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n }\r\n else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n };\r\n /**\r\n * Serialize all vertices data into a JSON oject\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n Geometry.prototype.serializeVerticeData = function () {\r\n var serializationObject = this.serialize();\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind)) {\r\n serializationObject.positions = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind)) {\r\n serializationObject.positions._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n serializationObject.normals = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n serializationObject.normals._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n serializationObject.tangets = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n serializationObject.tangets._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n serializationObject.uvs = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n serializationObject.uvs._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind)) {\r\n serializationObject.uv2s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind)) {\r\n serializationObject.uv2s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind)) {\r\n serializationObject.uv3s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind)) {\r\n serializationObject.uv3s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind)) {\r\n serializationObject.uv4s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind)) {\r\n serializationObject.uv4s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind)) {\r\n serializationObject.uv5s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind)) {\r\n serializationObject.uv5s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind)) {\r\n serializationObject.uv6s = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind)) {\r\n serializationObject.uv6s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind)) {\r\n serializationObject.colors = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind)) {\r\n serializationObject.colors._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind));\r\n serializationObject.matricesIndices._isExpanded = true;\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n serializationObject.matricesIndices._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this.toNumberArray(this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n serializationObject.matricesWeights._updatable = true;\r\n }\r\n }\r\n serializationObject.indices = this.toNumberArray(this.getIndices());\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n Geometry.ExtractFromMesh = function (mesh, id) {\r\n var geometry = mesh._geometry;\r\n if (!geometry) {\r\n return null;\r\n }\r\n return geometry.copy(id);\r\n };\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n Geometry.RandomId = function () {\r\n return _Misc_tools__WEBPACK_IMPORTED_MODULE_8__[\"Tools\"].RandomId();\r\n };\r\n /** @hidden */\r\n Geometry._ImportGeometry = function (parsedGeometry, mesh) {\r\n var scene = mesh.getScene();\r\n // Geometry\r\n var geometryId = parsedGeometry.geometryId;\r\n if (geometryId) {\r\n var geometry = scene.getGeometryByID(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n }\r\n else if (parsedGeometry instanceof ArrayBuffer) {\r\n var binaryInfo = mesh._binaryInfo;\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n var positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, positionsData, false);\r\n }\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n var normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, normalsData, false);\r\n }\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n var tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind, tangentsData, false);\r\n }\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n var uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind, uvsData, false);\r\n }\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n var uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind, uvs2Data, false);\r\n }\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n var uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind, uvs3Data, false);\r\n }\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n var uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind, uvs4Data, false);\r\n }\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n var uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind, uvs5Data, false);\r\n }\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n var uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind, uvs6Data, false);\r\n }\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n var colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n var matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n var floatIndices = [];\r\n for (var i = 0; i < matricesIndicesData.length; i++) {\r\n var index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000FF);\r\n floatIndices.push((index & 0x0000FF00) >> 8);\r\n floatIndices.push((index & 0x00FF0000) >> 16);\r\n floatIndices.push(index >> 24);\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, floatIndices, false);\r\n }\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n var matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n var indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n var subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n mesh.subMeshes = [];\r\n for (var i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n var materialIndex = subMeshesData[(i * 5) + 0];\r\n var verticesStart = subMeshesData[(i * 5) + 1];\r\n var verticesCount = subMeshesData[(i * 5) + 2];\r\n var indexStart = subMeshesData[(i * 5) + 3];\r\n var indexCount = subMeshesData[(i * 5) + 4];\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_4__[\"SubMesh\"].AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh);\r\n }\r\n }\r\n }\r\n else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable);\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable);\r\n }\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable);\r\n }\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable);\r\n }\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable);\r\n }\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable);\r\n }\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable);\r\n }\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable);\r\n }\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind, _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"].CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndices[i];\r\n floatIndices.push(matricesIndex & 0x000000FF);\r\n floatIndices.push((matricesIndex & 0x0000FF00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00FF0000) >> 16);\r\n floatIndices.push(matricesIndex >> 24);\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!parsedGeometry.matricesIndicesExtra._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n floatIndices.push(matricesIndex & 0x000000FF);\r\n floatIndices.push((matricesIndex & 0x0000FF00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00FF0000) >> 16);\r\n floatIndices.push(matricesIndex >> 24);\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (var subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n var parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_4__[\"SubMesh\"].AddToMesh(parsedSubMesh.materialIndex, parsedSubMesh.verticesStart, parsedSubMesh.verticesCount, parsedSubMesh.indexStart, parsedSubMesh.indexCount, mesh);\r\n }\r\n }\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n delete mesh._shouldGenerateFlatShading;\r\n }\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n scene.onMeshImportedObservable.notifyObservers(mesh);\r\n };\r\n Geometry._CleanMatricesWeights = function (parsedGeometry, mesh) {\r\n var epsilon = 1e-3;\r\n if (!_Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_5__[\"SceneLoaderFlags\"].CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n var noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n var skeleton = mesh.getScene().getLastSkeletonByID(parsedGeometry.skeletonId);\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n }\r\n else {\r\n return;\r\n }\r\n var matricesIndices = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesIndicesExtra = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n var matricesWeights = parsedGeometry.matricesWeights;\r\n var matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n var influencers = parsedGeometry.numBoneInfluencer;\r\n var size = matricesWeights.length;\r\n for (var i = 0; i < size; i += 4) {\r\n var weight = 0.0;\r\n var firstZeroWeight = -1;\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > (influencers - 1)) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n var mweight = 1.0 / weight;\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n }\r\n else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n }\r\n else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n };\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n Geometry.Parse = function (parsedVertexData, scene, rootUrl) {\r\n if (scene.getGeometryByID(parsedVertexData.id)) {\r\n return null; // null since geometry could be something else than a box...\r\n }\r\n var geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_9__[\"Tags\"].AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_6__[\"BoundingInfo\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(parsedVertexData.boundingBoxMinimum), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(parsedVertexData.boundingBoxMaximum));\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV3Kind);\r\n }\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV4Kind);\r\n }\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV5Kind);\r\n }\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UV6Kind);\r\n }\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].ColorKind);\r\n }\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesIndicesKind);\r\n }\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].MatricesWeightsKind);\r\n }\r\n geometry._delayLoadingFunction = _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].ImportVertexData;\r\n }\r\n else {\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__[\"VertexData\"].ImportVertexData(parsedVertexData, geometry);\r\n }\r\n scene.pushGeometry(geometry, true);\r\n return geometry;\r\n };\r\n return Geometry;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/groundMesh.ts\":\n/*!******************************!*\\\n !*** ./Meshes/groundMesh.ts ***!\n \\******************************/\n/*! exports provided: GroundMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return GroundMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n\r\n\r\n\r\n\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]._GroundMeshParser = function (parsedMesh, scene) {\r\n return GroundMesh.Parse(parsedMesh, scene);\r\n};\r\n/**\r\n * Mesh representing the gorund\r\n */\r\nvar GroundMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GroundMesh, _super);\r\n function GroundMesh(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /** If octree should be generated */\r\n _this.generateOctree = false;\r\n return _this;\r\n }\r\n /**\r\n * \"GroundMesh\"\r\n * @returns \"GroundMesh\"\r\n */\r\n GroundMesh.prototype.getClassName = function () {\r\n return \"GroundMesh\";\r\n };\r\n Object.defineProperty(GroundMesh.prototype, \"subdivisions\", {\r\n /**\r\n * The minimum of x and y subdivisions\r\n */\r\n get: function () {\r\n return Math.min(this._subdivisionsX, this._subdivisionsY);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GroundMesh.prototype, \"subdivisionsX\", {\r\n /**\r\n * X subdivisions\r\n */\r\n get: function () {\r\n return this._subdivisionsX;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GroundMesh.prototype, \"subdivisionsY\", {\r\n /**\r\n * Y subdivisions\r\n */\r\n get: function () {\r\n return this._subdivisionsY;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This function will update an octree to help to select the right submeshes for rendering, picking and collision computations.\r\n * Please note that you must have a decent number of submeshes to get performance improvements when using an octree\r\n * @param chunksCount the number of subdivisions for x and y\r\n * @param octreeBlocksSize (Default: 32)\r\n */\r\n GroundMesh.prototype.optimize = function (chunksCount, octreeBlocksSize) {\r\n if (octreeBlocksSize === void 0) { octreeBlocksSize = 32; }\r\n this._subdivisionsX = chunksCount;\r\n this._subdivisionsY = chunksCount;\r\n this.subdivide(chunksCount);\r\n // Call the octree system optimization if it is defined.\r\n var thisAsAny = this;\r\n if (thisAsAny.createOrUpdateSubmeshesOctree) {\r\n thisAsAny.createOrUpdateSubmeshesOctree(octreeBlocksSize);\r\n }\r\n };\r\n /**\r\n * Returns a height (y) value in the Worl system :\r\n * the ground altitude at the coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns the ground y position if (x, z) are outside the ground surface.\r\n */\r\n GroundMesh.prototype.getHeightAtCoordinates = function (x, z) {\r\n var world = this.getWorldMatrix();\r\n var invMat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[5];\r\n world.invertToRef(invMat);\r\n var tmpVect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[8];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, 0.0, z, invMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\r\n return this.position.y;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n var facet = this._getFacetAt(x, z);\r\n var y = -(facet.x * x + facet.z * z + facet.w) / facet.y;\r\n // return y in the World system\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(0.0, y, 0.0, world, tmpVect);\r\n return tmpVect.y;\r\n };\r\n /**\r\n * Returns a normalized vector (Vector3) orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.\r\n */\r\n GroundMesh.prototype.getNormalAtCoordinates = function (x, z) {\r\n var normal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.0, 1.0, 0.0);\r\n this.getNormalAtCoordinatesToRef(x, z, normal);\r\n return normal;\r\n };\r\n /**\r\n * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @param ref vector to store the result\r\n * @returns the GroundMesh.\r\n */\r\n GroundMesh.prototype.getNormalAtCoordinatesToRef = function (x, z, ref) {\r\n var world = this.getWorldMatrix();\r\n var tmpMat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[5];\r\n world.invertToRef(tmpMat);\r\n var tmpVect = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[8];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(x, 0.0, z, tmpMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\r\n return this;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n var facet = this._getFacetAt(x, z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(facet.x, facet.y, facet.z, world, ref);\r\n return this;\r\n };\r\n /**\r\n * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()\r\n * if the ground has been updated.\r\n * This can be used in the render loop.\r\n * @returns the GroundMesh.\r\n */\r\n GroundMesh.prototype.updateCoordinateHeights = function () {\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n }\r\n this._computeHeightQuads();\r\n return this;\r\n };\r\n // Returns the element \"facet\" from the heightQuads array relative to (x, z) local coordinates\r\n GroundMesh.prototype._getFacetAt = function (x, z) {\r\n // retrieve col and row from x, z coordinates in the ground local system\r\n var col = Math.floor((x + this._maxX) * this._subdivisionsX / this._width);\r\n var row = Math.floor(-(z + this._maxZ) * this._subdivisionsY / this._height + this._subdivisionsY);\r\n var quad = this._heightQuads[row * this._subdivisionsX + col];\r\n var facet;\r\n if (z < quad.slope.x * x + quad.slope.y) {\r\n facet = quad.facet1;\r\n }\r\n else {\r\n facet = quad.facet2;\r\n }\r\n return facet;\r\n };\r\n // Creates and populates the heightMap array with \"facet\" elements :\r\n // a quad is two triangular facets separated by a slope, so a \"facet\" element is 1 slope + 2 facets\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting appart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n GroundMesh.prototype._initHeightQuads = function () {\r\n var subdivisionsX = this._subdivisionsX;\r\n var subdivisionsY = this._subdivisionsY;\r\n this._heightQuads = new Array();\r\n for (var row = 0; row < subdivisionsY; row++) {\r\n for (var col = 0; col < subdivisionsX; col++) {\r\n var quad = { slope: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].Zero(), facet1: new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"](0.0, 0.0, 0.0, 0.0), facet2: new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector4\"](0.0, 0.0, 0.0, 0.0) };\r\n this._heightQuads[row * subdivisionsX + col] = quad;\r\n }\r\n }\r\n return this;\r\n };\r\n // Compute each quad element values and update the the heightMap array :\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting appart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n GroundMesh.prototype._computeHeightQuads = function () {\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n if (!positions) {\r\n return this;\r\n }\r\n var v1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[3];\r\n var v2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[2];\r\n var v3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[1];\r\n var v4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[0];\r\n var v1v2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[4];\r\n var v1v3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[5];\r\n var v1v4 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[6];\r\n var norm1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[7];\r\n var norm2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector3[8];\r\n var i = 0;\r\n var j = 0;\r\n var k = 0;\r\n var cd = 0; // 2D slope coefficient : z = cd * x + h\r\n var h = 0;\r\n var d1 = 0; // facet plane equation : ax + by + cz + d = 0\r\n var d2 = 0;\r\n var subdivisionsX = this._subdivisionsX;\r\n var subdivisionsY = this._subdivisionsY;\r\n for (var row = 0; row < subdivisionsY; row++) {\r\n for (var col = 0; col < subdivisionsX; col++) {\r\n i = col * 3;\r\n j = row * (subdivisionsX + 1) * 3;\r\n k = (row + 1) * (subdivisionsX + 1) * 3;\r\n v1.x = positions[j + i];\r\n v1.y = positions[j + i + 1];\r\n v1.z = positions[j + i + 2];\r\n v2.x = positions[j + i + 3];\r\n v2.y = positions[j + i + 4];\r\n v2.z = positions[j + i + 5];\r\n v3.x = positions[k + i];\r\n v3.y = positions[k + i + 1];\r\n v3.z = positions[k + i + 2];\r\n v4.x = positions[k + i + 3];\r\n v4.y = positions[k + i + 4];\r\n v4.z = positions[k + i + 5];\r\n // 2D slope V1V4\r\n cd = (v4.z - v1.z) / (v4.x - v1.x);\r\n h = v1.z - cd * v1.x; // v1 belongs to the slope\r\n // facet equations :\r\n // we compute each facet normal vector\r\n // the equation of the facet plane is : norm.x * x + norm.y * y + norm.z * z + d = 0\r\n // we compute the value d by applying the equation to v1 which belongs to the plane\r\n // then we store the facet equation in a Vector4\r\n v2.subtractToRef(v1, v1v2);\r\n v3.subtractToRef(v1, v1v3);\r\n v4.subtractToRef(v1, v1v4);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(v1v4, v1v3, norm1); // caution : CrossToRef uses the Tmp class\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CrossToRef(v1v2, v1v4, norm2);\r\n norm1.normalize();\r\n norm2.normalize();\r\n d1 = -(norm1.x * v1.x + norm1.y * v1.y + norm1.z * v1.z);\r\n d2 = -(norm2.x * v2.x + norm2.y * v2.y + norm2.z * v2.z);\r\n var quad = this._heightQuads[row * subdivisionsX + col];\r\n quad.slope.copyFromFloats(cd, h);\r\n quad.facet1.copyFromFloats(norm1.x, norm1.y, norm1.z, d1);\r\n quad.facet2.copyFromFloats(norm2.x, norm2.y, norm2.z, d2);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Serializes this ground mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n GroundMesh.prototype.serialize = function (serializationObject) {\r\n _super.prototype.serialize.call(this, serializationObject);\r\n serializationObject.subdivisionsX = this._subdivisionsX;\r\n serializationObject.subdivisionsY = this._subdivisionsY;\r\n serializationObject.minX = this._minX;\r\n serializationObject.maxX = this._maxX;\r\n serializationObject.minZ = this._minZ;\r\n serializationObject.maxZ = this._maxZ;\r\n serializationObject.width = this._width;\r\n serializationObject.height = this._height;\r\n };\r\n /**\r\n * Parses a serialized ground mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the ground mesh in\r\n * @returns the created ground mesh\r\n */\r\n GroundMesh.Parse = function (parsedMesh, scene) {\r\n var result = new GroundMesh(parsedMesh.name, scene);\r\n result._subdivisionsX = parsedMesh.subdivisionsX || 1;\r\n result._subdivisionsY = parsedMesh.subdivisionsY || 1;\r\n result._minX = parsedMesh.minX;\r\n result._maxX = parsedMesh.maxX;\r\n result._minZ = parsedMesh.minZ;\r\n result._maxZ = parsedMesh.maxZ;\r\n result._width = parsedMesh.width;\r\n result._height = parsedMesh.height;\r\n return result;\r\n };\r\n return GroundMesh;\r\n}(_Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/index.ts\":\n/*!*************************!*\\\n !*** ./Meshes/index.ts ***!\n \\*************************/\n/*! exports provided: AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _abstractMesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return _abstractMesh__WEBPACK_IMPORTED_MODULE_0__[\"AbstractMesh\"]; });\n\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buffer */ \"./Meshes/buffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return _buffer__WEBPACK_IMPORTED_MODULE_1__[\"Buffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return _buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"]; });\n\n/* harmony import */ var _Compression_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Compression/index */ \"./Meshes/Compression/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _Compression_index__WEBPACK_IMPORTED_MODULE_2__[\"DracoCompression\"]; });\n\n/* harmony import */ var _csg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./csg */ \"./Meshes/csg.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return _csg__WEBPACK_IMPORTED_MODULE_3__[\"CSG\"]; });\n\n/* harmony import */ var _geometry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./geometry */ \"./Meshes/geometry.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return _geometry__WEBPACK_IMPORTED_MODULE_4__[\"Geometry\"]; });\n\n/* harmony import */ var _groundMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./groundMesh */ \"./Meshes/groundMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return _groundMesh__WEBPACK_IMPORTED_MODULE_5__[\"GroundMesh\"]; });\n\n/* harmony import */ var _trailMesh__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./trailMesh */ \"./Meshes/trailMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return _trailMesh__WEBPACK_IMPORTED_MODULE_6__[\"TrailMesh\"]; });\n\n/* harmony import */ var _instancedMesh__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./instancedMesh */ \"./Meshes/instancedMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return _instancedMesh__WEBPACK_IMPORTED_MODULE_7__[\"InstancedMesh\"]; });\n\n/* harmony import */ var _linesMesh__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./linesMesh */ \"./Meshes/linesMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return _linesMesh__WEBPACK_IMPORTED_MODULE_8__[\"LinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return _linesMesh__WEBPACK_IMPORTED_MODULE_8__[\"InstancedLinesMesh\"]; });\n\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./mesh */ \"./Meshes/mesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _mesh__WEBPACK_IMPORTED_MODULE_9__[\"_CreationDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _mesh__WEBPACK_IMPORTED_MODULE_9__[\"_InstancesBatch\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return _mesh__WEBPACK_IMPORTED_MODULE_9__[\"Mesh\"]; });\n\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return _mesh_vertexData__WEBPACK_IMPORTED_MODULE_10__[\"VertexData\"]; });\n\n/* harmony import */ var _meshBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./meshBuilder */ \"./Meshes/meshBuilder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return _meshBuilder__WEBPACK_IMPORTED_MODULE_11__[\"MeshBuilder\"]; });\n\n/* harmony import */ var _meshSimplification__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./meshSimplification */ \"./Meshes/meshSimplification.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return _meshSimplification__WEBPACK_IMPORTED_MODULE_12__[\"SimplificationSettings\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return _meshSimplification__WEBPACK_IMPORTED_MODULE_12__[\"SimplificationQueue\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return _meshSimplification__WEBPACK_IMPORTED_MODULE_12__[\"SimplificationType\"]; });\n\n/* harmony import */ var _meshSimplificationSceneComponent__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./meshSimplificationSceneComponent */ \"./Meshes/meshSimplificationSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return _meshSimplificationSceneComponent__WEBPACK_IMPORTED_MODULE_13__[\"SimplicationQueueSceneComponent\"]; });\n\n/* harmony import */ var _polygonMesh__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./polygonMesh */ \"./Meshes/polygonMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return _polygonMesh__WEBPACK_IMPORTED_MODULE_14__[\"Polygon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return _polygonMesh__WEBPACK_IMPORTED_MODULE_14__[\"PolygonMeshBuilder\"]; });\n\n/* harmony import */ var _subMesh__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return _subMesh__WEBPACK_IMPORTED_MODULE_15__[\"BaseSubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return _subMesh__WEBPACK_IMPORTED_MODULE_15__[\"SubMesh\"]; });\n\n/* harmony import */ var _meshLODLevel__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./meshLODLevel */ \"./Meshes/meshLODLevel.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return _meshLODLevel__WEBPACK_IMPORTED_MODULE_16__[\"MeshLODLevel\"]; });\n\n/* harmony import */ var _transformNode__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return _transformNode__WEBPACK_IMPORTED_MODULE_17__[\"TransformNode\"]; });\n\n/* harmony import */ var _Builders_index__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Builders/index */ \"./Meshes/Builders/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"BoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"SphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"CylinderBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TorusBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"LinesBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"PlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"GroundBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TiledBoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"DiscBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"RibbonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"HemisphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TorusKnotBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"PolygonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"ShapeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"LatheBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TiledPlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"TubeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"PolyhedronBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"IcoSphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _Builders_index__WEBPACK_IMPORTED_MODULE_18__[\"DecalBuilder\"]; });\n\n/* harmony import */ var _dataBuffer__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./dataBuffer */ \"./Meshes/dataBuffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return _dataBuffer__WEBPACK_IMPORTED_MODULE_19__[\"DataBuffer\"]; });\n\n/* harmony import */ var _WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./WebGL/webGLDataBuffer */ \"./Meshes/WebGL/webGLDataBuffer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return _WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_20__[\"WebGLDataBuffer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/instancedMesh.ts\":\n/*!*********************************!*\\\n !*** ./Meshes/instancedMesh.ts ***!\n \\*********************************/\n/*! exports provided: InstancedMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return InstancedMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _transformNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transformNode */ \"./Meshes/transformNode.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"]._instancedMeshFactory = function (name, mesh) {\r\n return new InstancedMesh(name, mesh);\r\n};\r\n/**\r\n * Creates an instance based on a source mesh.\r\n */\r\nvar InstancedMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InstancedMesh, _super);\r\n function InstancedMesh(name, source) {\r\n var _this = _super.call(this, name, source.getScene()) || this;\r\n /** @hidden */\r\n _this._indexInSourceMeshInstanceArray = -1;\r\n source.addInstance(_this);\r\n _this._sourceMesh = source;\r\n _this._unIndexed = source._unIndexed;\r\n _this.position.copyFrom(source.position);\r\n _this.rotation.copyFrom(source.rotation);\r\n _this.scaling.copyFrom(source.scaling);\r\n if (source.rotationQuaternion) {\r\n _this.rotationQuaternion = source.rotationQuaternion.clone();\r\n }\r\n _this.infiniteDistance = source.infiniteDistance;\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.refreshBoundingInfo();\r\n _this._syncSubMeshes();\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedMesh\".\r\n */\r\n InstancedMesh.prototype.getClassName = function () {\r\n return \"InstancedMesh\";\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._sourceMesh._lightSources;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InstancedMesh.prototype._resyncLightSources = function () {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._resyncLighSource = function (light) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._removeLightSource = function (light, dispose) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"receiveShadows\", {\r\n // Methods\r\n /**\r\n * If the source mesh receives shadows\r\n */\r\n get: function () {\r\n return this._sourceMesh.receiveShadows;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"material\", {\r\n /**\r\n * The material of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.material;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"visibility\", {\r\n /**\r\n * Visibility of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.visibility;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"skeleton\", {\r\n /**\r\n * Skeleton of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.skeleton;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"renderingGroupId\", {\r\n /**\r\n * Rendering ground id of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.renderingGroupId;\r\n },\r\n set: function (value) {\r\n if (!this._sourceMesh || value === this._sourceMesh.renderingGroupId) {\r\n return;\r\n }\r\n //no-op with warning\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Note - setting renderingGroupId of an instanced mesh has no effect on the scene\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices (integer).\r\n */\r\n InstancedMesh.prototype.getTotalVertices = function () {\r\n return this._sourceMesh ? this._sourceMesh.getTotalVertices() : 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n InstancedMesh.prototype.getTotalIndices = function () {\r\n return this._sourceMesh.getTotalIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"sourceMesh\", {\r\n /**\r\n * The source mesh of the instance\r\n */\r\n get: function () {\r\n return this._sourceMesh;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return {boolean} is it ready\r\n */\r\n InstancedMesh.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n return this._sourceMesh.isReady(completeCheck, true);\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param kind kind of verticies to retreive (eg. positons, normals, uvs, etc.)\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc.\r\n */\r\n InstancedMesh.prototype.getVerticesData = function (kind, copyWhenShared) {\r\n return this._sourceMesh.getVerticesData(kind, copyWhenShared);\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.\r\n * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * No new underlying VertexBuffer object is created.\r\n * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.updateVerticesData(kind, data, updateExtends, makeItUnique);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Sets the mesh indices.\r\n * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * This method creates a new index buffer each call.\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setIndices = function (indices, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setIndices(indices, totalVertices);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Boolean : True if the mesh owns the requested kind of data.\r\n */\r\n InstancedMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return this._sourceMesh.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns an array of indices (IndicesArray).\r\n */\r\n InstancedMesh.prototype.getIndices = function () {\r\n return this._sourceMesh.getIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"_positions\", {\r\n get: function () {\r\n return this._sourceMesh._positions;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n InstancedMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this._sourceMesh.geometry ? this._sourceMesh.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._sourceMesh._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._preActivate = function () {\r\n if (this._currentLOD) {\r\n this._currentLOD._preActivate();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n if (!this._sourceMesh.subMeshes) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Instances should only be created for meshes with geometry.\");\r\n }\r\n if (this._currentLOD) {\r\n this._currentLOD._registerInstanceForRenderId(this, renderId);\r\n if (intermediateRendering) {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true;\r\n return true;\r\n }\r\n }\r\n else {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._postActivate = function () {\r\n if (this._edgesRenderer && this._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\r\n this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer);\r\n }\r\n };\r\n InstancedMesh.prototype.getWorldMatrix = function () {\r\n if (this._currentLOD && this._currentLOD.billboardMode !== _transformNode__WEBPACK_IMPORTED_MODULE_6__[\"TransformNode\"].BILLBOARDMODE_NONE && this._currentLOD._masterMesh !== this) {\r\n var tempMaster = this._currentLOD._masterMesh;\r\n this._currentLOD._masterMesh = this;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(true));\r\n this._currentLOD._masterMesh = tempMaster;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Matrix[0];\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"isAnInstance\", {\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the current associated LOD AbstractMesh.\r\n */\r\n InstancedMesh.prototype.getLOD = function (camera) {\r\n if (!camera) {\r\n return this;\r\n }\r\n var boundingInfo = this.getBoundingInfo();\r\n this._currentLOD = this.sourceMesh.getLOD(camera, boundingInfo.boundingSphere);\r\n if (this._currentLOD === this.sourceMesh) {\r\n return this.sourceMesh;\r\n }\r\n return this._currentLOD;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._syncSubMeshes = function () {\r\n this.releaseSubMeshes();\r\n if (this._sourceMesh.subMeshes) {\r\n for (var index = 0; index < this._sourceMesh.subMeshes.length; index++) {\r\n this._sourceMesh.subMeshes[index].clone(this, this._sourceMesh);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._generatePointsArray = function () {\r\n return this._sourceMesh._generatePointsArray();\r\n };\r\n /**\r\n * Creates a new InstancedMesh from the current mesh.\r\n * - name (string) : the cloned mesh name\r\n * - newParent (optional Node) : the optional Node to parent the clone to.\r\n * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned.\r\n *\r\n * Returns the clone.\r\n */\r\n InstancedMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n var result = this._sourceMesh.createInstance(name);\r\n // Deep copy\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_5__[\"DeepCopier\"].DeepCopy(this, result, [\"name\", \"subMeshes\", \"uniqueId\"], []);\r\n // Bounding info\r\n this.refreshBoundingInfo();\r\n // Parent\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n for (var index = 0; index < this.getScene().meshes.length; index++) {\r\n var mesh = this.getScene().meshes[index];\r\n if (mesh.parent === this) {\r\n mesh.clone(mesh.name, result);\r\n }\r\n }\r\n }\r\n result.computeWorldMatrix(true);\r\n return result;\r\n };\r\n /**\r\n * Disposes the InstancedMesh.\r\n * Returns nothing.\r\n */\r\n InstancedMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Remove from mesh\r\n this._sourceMesh.removeInstance(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n return InstancedMesh;\r\n}(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/linesMesh.ts\":\n/*!*****************************!*\\\n !*** ./Meshes/linesMesh.ts ***!\n \\*****************************/\n/*! exports provided: LinesMesh, InstancedLinesMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return LinesMesh; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return InstancedLinesMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_instancedMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/instancedMesh */ \"./Meshes/instancedMesh.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Shaders_color_fragment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/color.fragment */ \"./Shaders/color.fragment.ts\");\n/* harmony import */ var _Shaders_color_vertex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Shaders/color.vertex */ \"./Shaders/color.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Line mesh\r\n * @see https://doc.babylonjs.com/babylon101/parametric_shapes\r\n */\r\nvar LinesMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LinesMesh, _super);\r\n /**\r\n * Creates a new LinesMesh\r\n * @param name defines the name\r\n * @param scene defines the hosting scene\r\n * @param parent defines the parent mesh if any\r\n * @param source defines the optional source LinesMesh used to clone data from\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param useVertexColor defines if this LinesMesh supports vertex color\r\n * @param useVertexAlpha defines if this LinesMesh supports vertex alpha\r\n */\r\n function LinesMesh(name, scene, parent, source, doNotCloneChildren, \r\n /**\r\n * If vertex color should be applied to the mesh\r\n */\r\n useVertexColor, \r\n /**\r\n * If vertex alpha should be applied to the mesh\r\n */\r\n useVertexAlpha) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n var _this = _super.call(this, name, scene, parent, source, doNotCloneChildren) || this;\r\n _this.useVertexColor = useVertexColor;\r\n _this.useVertexAlpha = useVertexAlpha;\r\n /**\r\n * Color of the line (Default: White)\r\n */\r\n _this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Alpha of the line (Default: 1)\r\n */\r\n _this.alpha = 1;\r\n if (source) {\r\n _this.color = source.color.clone();\r\n _this.alpha = source.alpha;\r\n _this.useVertexColor = source.useVertexColor;\r\n _this.useVertexAlpha = source.useVertexAlpha;\r\n }\r\n _this.intersectionThreshold = 0.1;\r\n var defines = [];\r\n var options = {\r\n attributes: [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, \"world0\", \"world1\", \"world2\", \"world3\"],\r\n uniforms: [\"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"world\", \"viewProjection\"],\r\n needAlphaBlending: true,\r\n defines: defines\r\n };\r\n if (useVertexAlpha === false) {\r\n options.needAlphaBlending = false;\r\n }\r\n if (!useVertexColor) {\r\n options.uniforms.push(\"color\");\r\n _this.color4 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"]();\r\n }\r\n else {\r\n options.defines.push(\"#define VERTEXCOLOR\");\r\n options.attributes.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n }\r\n _this._colorShader = new _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__[\"ShaderMaterial\"](\"colorShader\", _this.getScene(), \"color\", options);\r\n return _this;\r\n }\r\n LinesMesh.prototype._addClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index !== -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.push(define);\r\n };\r\n LinesMesh.prototype._removeClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.splice(index, 1);\r\n };\r\n LinesMesh.prototype.isReady = function () {\r\n var scene = this.getScene();\r\n // Clip planes\r\n scene.clipPlane ? this._addClipPlaneDefine(\"CLIPPLANE\") : this._removeClipPlaneDefine(\"CLIPPLANE\");\r\n scene.clipPlane2 ? this._addClipPlaneDefine(\"CLIPPLANE2\") : this._removeClipPlaneDefine(\"CLIPPLANE2\");\r\n scene.clipPlane3 ? this._addClipPlaneDefine(\"CLIPPLANE3\") : this._removeClipPlaneDefine(\"CLIPPLANE3\");\r\n scene.clipPlane4 ? this._addClipPlaneDefine(\"CLIPPLANE4\") : this._removeClipPlaneDefine(\"CLIPPLANE4\");\r\n if (!this._colorShader.isReady()) {\r\n return false;\r\n }\r\n return _super.prototype.isReady.call(this);\r\n };\r\n /**\r\n * Returns the string \"LineMesh\"\r\n */\r\n LinesMesh.prototype.getClassName = function () {\r\n return \"LinesMesh\";\r\n };\r\n Object.defineProperty(LinesMesh.prototype, \"material\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return this._colorShader;\r\n },\r\n /**\r\n * @hidden\r\n */\r\n set: function (value) {\r\n // Do nothing\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LinesMesh.prototype, \"checkCollisions\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var colorEffect = this._colorShader.getEffect();\r\n // VBOs\r\n var indexToBind = this.isUnIndexed ? null : this._geometry.getIndexBuffer();\r\n this._geometry._bind(colorEffect, indexToBind);\r\n // Color\r\n if (!this.useVertexColor) {\r\n var _a = this.color, r = _a.r, g = _a.g, b = _a.b;\r\n this.color4.set(r, g, b, this.alpha);\r\n this._colorShader.setColor4(\"color\", this.color4);\r\n }\r\n // Clip planes\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_7__[\"MaterialHelper\"].BindClipPlane(colorEffect, this.getScene());\r\n return this;\r\n };\r\n /** @hidden */\r\n LinesMesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Draw order\r\n if (this._unIndexed) {\r\n engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].LineListDrawMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes of the line mesh\r\n * @param doNotRecurse If children should be disposed\r\n */\r\n LinesMesh.prototype.dispose = function (doNotRecurse) {\r\n this._colorShader.dispose(false, false, true);\r\n _super.prototype.dispose.call(this, doNotRecurse);\r\n };\r\n /**\r\n * Returns a new LineMesh object cloned from the current one.\r\n */\r\n LinesMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n return new LinesMesh(name, this.getScene(), newParent, this, doNotCloneChildren);\r\n };\r\n /**\r\n * Creates a new InstancedLinesMesh object from the mesh model.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedLinesMesh\r\n */\r\n LinesMesh.prototype.createInstance = function (name) {\r\n return new InstancedLinesMesh(name, this);\r\n };\r\n return LinesMesh;\r\n}(_Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"]));\r\n\r\n/**\r\n * Creates an instance based on a source LinesMesh\r\n */\r\nvar InstancedLinesMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](InstancedLinesMesh, _super);\r\n function InstancedLinesMesh(name, source) {\r\n var _this = _super.call(this, name, source) || this;\r\n _this.intersectionThreshold = source.intersectionThreshold;\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedLinesMesh\".\r\n */\r\n InstancedLinesMesh.prototype.getClassName = function () {\r\n return \"InstancedLinesMesh\";\r\n };\r\n return InstancedLinesMesh;\r\n}(_Meshes_instancedMesh__WEBPACK_IMPORTED_MODULE_4__[\"InstancedMesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/mesh.ts\":\n/*!************************!*\\\n !*** ./Meshes/mesh.ts ***!\n \\************************/\n/*! exports provided: _CreationDataStorage, _InstancesBatch, Mesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _CreationDataStorage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _InstancesBatch; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return Mesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _geometry__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./geometry */ \"./Meshes/geometry.ts\");\n/* harmony import */ var _abstractMesh__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _subMesh__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Materials/multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony import */ var _Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Loading/sceneLoaderFlags */ \"./Loading/sceneLoaderFlags.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _meshLODLevel__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./meshLODLevel */ \"./Meshes/meshLODLevel.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _CreationDataStorage = /** @class */ (function () {\r\n function _CreationDataStorage() {\r\n }\r\n return _CreationDataStorage;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstanceDataStorage = /** @class */ (function () {\r\n function _InstanceDataStorage() {\r\n this.visibleInstances = {};\r\n this.batchCache = new _InstancesBatch();\r\n this.instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances\r\n }\r\n return _InstanceDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstancesBatch = /** @class */ (function () {\r\n function _InstancesBatch() {\r\n this.mustReturn = false;\r\n this.visibleInstances = new Array();\r\n this.renderSelf = new Array();\r\n this.hardwareInstancedRendering = new Array();\r\n }\r\n return _InstancesBatch;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalMeshDataInfo = /** @class */ (function () {\r\n function _InternalMeshDataInfo() {\r\n this._areNormalsFrozen = false; // Will be used by ribbons mainly\r\n // Will be used to save a source mesh reference, If any\r\n this._source = null;\r\n // Will be used to for fast cloned mesh lookup\r\n this.meshMap = null;\r\n this._preActivateId = -1;\r\n this._LODLevels = new Array();\r\n // Morph\r\n this._morphTargetManager = null;\r\n }\r\n return _InternalMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to represent renderable models\r\n */\r\nvar Mesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Mesh, _super);\r\n /**\r\n * @constructor\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param scene The scene to add this mesh to.\r\n * @param parent The parent of this mesh, if it has one\r\n * @param source An optional Mesh from which geometry is shared, cloned.\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.\r\n */\r\n function Mesh(name, scene, parent, source, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n // Internal data\r\n _this._internalMeshDataInfo = new _InternalMeshDataInfo();\r\n // Members\r\n /**\r\n * Gets the delay loading state of the mesh (when delay loading is turned on)\r\n * @see http://doc.babylonjs.com/how_to/using_the_incremental_loading_system\r\n */\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_NONE;\r\n /**\r\n * Gets the list of instances created from this mesh\r\n * it is not supposed to be modified manually.\r\n * Note also that the order of the InstancedMesh wihin the array is not significant and might change.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_instances\r\n */\r\n _this.instances = new Array();\r\n // Private\r\n /** @hidden */\r\n _this._creationDataStorage = null;\r\n /** @hidden */\r\n _this._geometry = null;\r\n /** @hidden */\r\n _this._instanceDataStorage = new _InstanceDataStorage();\r\n _this._effectiveMaterial = null;\r\n /** @hidden */\r\n _this._shouldGenerateFlatShading = false;\r\n // Use by builder only to know what orientation were the mesh build in.\r\n /** @hidden */\r\n _this._originalBuilderSideOrientation = Mesh.DEFAULTSIDE;\r\n /**\r\n * Use this property to change the original side orientation defined at construction time\r\n */\r\n _this.overrideMaterialSideOrientation = null;\r\n scene = _this.getScene();\r\n if (source) {\r\n // Geometry\r\n if (source._geometry) {\r\n source._geometry.applyToMesh(_this);\r\n }\r\n // Deep copy\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(source, _this, [\"name\", \"material\", \"skeleton\", \"instances\", \"parent\", \"uniqueId\",\r\n \"source\", \"metadata\", \"hasLODLevels\", \"geometry\", \"isBlocked\", \"areNormalsFrozen\",\r\n \"onBeforeDrawObservable\", \"onBeforeRenderObservable\", \"onAfterRenderObservable\", \"onBeforeDraw\",\r\n \"onAfterWorldMatrixUpdateObservable\", \"onCollideObservable\", \"onCollisionPositionChangeObservable\", \"onRebuildObservable\",\r\n \"onDisposeObservable\", \"lightSources\"\r\n ], [\"_poseMatrix\"]);\r\n // Source mesh\r\n _this._internalMeshDataInfo._source = source;\r\n if (scene.useClonedMeshhMap) {\r\n if (!source._internalMeshDataInfo.meshMap) {\r\n source._internalMeshDataInfo.meshMap = {};\r\n }\r\n source._internalMeshDataInfo.meshMap[_this.uniqueId] = _this;\r\n }\r\n // Construction Params\r\n // Clone parameters allowing mesh to be updated in case of parametric shapes.\r\n _this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;\r\n _this._creationDataStorage = source._creationDataStorage;\r\n // Animation ranges\r\n if (source._ranges) {\r\n var ranges = source._ranges;\r\n for (var name in ranges) {\r\n if (!ranges.hasOwnProperty(name)) {\r\n continue;\r\n }\r\n if (!ranges[name]) {\r\n continue;\r\n }\r\n _this.createAnimationRange(name, ranges[name].from, ranges[name].to);\r\n }\r\n }\r\n // Metadata\r\n if (source.metadata && source.metadata.clone) {\r\n _this.metadata = source.metadata.clone();\r\n }\r\n else {\r\n _this.metadata = source.metadata;\r\n }\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].HasTags(source)) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(_this, _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].GetTags(source, true));\r\n }\r\n // Parent\r\n _this.parent = source.parent;\r\n // Pivot\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.id = name + \".\" + source.id;\r\n // Material\r\n _this.material = source.material;\r\n var index;\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = source.getDescendants(true);\r\n for (var index_1 = 0; index_1 < directDescendants.length; index_1++) {\r\n var child = directDescendants[index_1];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, _this);\r\n }\r\n }\r\n }\r\n // Physics clone\r\n if (scene.getPhysicsEngine) {\r\n var physicsEngine = scene.getPhysicsEngine();\r\n if (clonePhysicsImpostor && physicsEngine) {\r\n var impostor = physicsEngine.getImpostorForPhysicsObject(source);\r\n if (impostor) {\r\n _this.physicsImpostor = impostor.clone(_this);\r\n }\r\n }\r\n }\r\n // Particles\r\n for (index = 0; index < scene.particleSystems.length; index++) {\r\n var system = scene.particleSystems[index];\r\n if (system.emitter === source) {\r\n system.clone(system.name, _this);\r\n }\r\n }\r\n _this.refreshBoundingInfo();\r\n _this.computeWorldMatrix(true);\r\n }\r\n // Parent\r\n if (parent !== null) {\r\n _this.parent = parent;\r\n }\r\n _this._instanceDataStorage.hardwareInstancedRendering = _this.getEngine().getCaps().instancedArrays;\r\n return _this;\r\n }\r\n /**\r\n * Gets the default side orientation.\r\n * @param orientation the orientation to value to attempt to get\r\n * @returns the default orientation\r\n * @hidden\r\n */\r\n Mesh._GetDefaultSideOrientation = function (orientation) {\r\n return orientation || Mesh.FRONTSIDE; // works as Mesh.FRONTSIDE is 0\r\n };\r\n Object.defineProperty(Mesh.prototype, \"onBeforeRenderObservable\", {\r\n /**\r\n * An event triggered before rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onBeforeRenderObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeBindObservable\", {\r\n /**\r\n * An event triggered before binding the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onBeforeBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onAfterRenderObservable\", {\r\n /**\r\n * An event triggered after rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onAfterRenderObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDrawObservable\", {\r\n /**\r\n * An event triggered before drawing the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n }\r\n return this._internalMeshDataInfo._onBeforeDrawObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDraw\", {\r\n /**\r\n * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeDrawObserver) {\r\n this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);\r\n }\r\n this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"hasInstances\", {\r\n get: function () {\r\n return this.instances.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"morphTargetManager\", {\r\n /**\r\n * Gets or sets the morph target manager\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._morphTargetManager;\r\n },\r\n set: function (value) {\r\n if (this._internalMeshDataInfo._morphTargetManager === value) {\r\n return;\r\n }\r\n this._internalMeshDataInfo._morphTargetManager = value;\r\n this._syncGeometryWithMorphTargetManager();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"source\", {\r\n /**\r\n * Gets the source mesh (the one used to clone this one from)\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._source;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"isUnIndexed\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh does not use index buffer\r\n */\r\n get: function () {\r\n return this._unIndexed;\r\n },\r\n set: function (value) {\r\n if (this._unIndexed !== value) {\r\n this._unIndexed = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n Mesh.prototype.instantiateHierarychy = function (newParent) {\r\n if (newParent === void 0) { newParent = null; }\r\n var instance = this.createInstance(\"instance of \" + (this.name || this.id));\r\n instance.parent = newParent || this.parent;\r\n instance.position = this.position.clone();\r\n instance.scaling = this.scaling.clone();\r\n if (this.rotationQuaternion) {\r\n instance.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n else {\r\n instance.rotation = this.rotation.clone();\r\n }\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarychy(instance);\r\n }\r\n return instance;\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Mesh\".\r\n */\r\n Mesh.prototype.getClassName = function () {\r\n return \"Mesh\";\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_isMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a description of this mesh\r\n * @param fullDetails define if full details about this mesh must be used\r\n * @returns a descriptive string representing this mesh\r\n */\r\n Mesh.prototype.toString = function (fullDetails) {\r\n var ret = _super.prototype.toString.call(this, fullDetails);\r\n ret += \", n vertices: \" + this.getTotalVertices();\r\n ret += \", parent: \" + (this._waitingParentId ? this._waitingParentId : (this.parent ? this.parent.name : \"NONE\"));\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n if (this._geometry) {\r\n var ib = this.getIndices();\r\n var vb = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (vb && ib) {\r\n ret += \", flat shading: \" + (vb.length / 3 === ib.length ? \"YES\" : \"NO\");\r\n }\r\n }\r\n else {\r\n ret += \", flat shading: UNKNOWN\";\r\n }\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unBindEffect = function () {\r\n _super.prototype._unBindEffect.call(this);\r\n for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {\r\n var instance = _a[_i];\r\n instance._unBindEffect();\r\n }\r\n };\r\n Object.defineProperty(Mesh.prototype, \"hasLODLevels\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has LOD\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._LODLevels.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of MeshLODLevel associated with the current mesh\r\n * @returns an array of MeshLODLevel\r\n */\r\n Mesh.prototype.getLODLevels = function () {\r\n return this._internalMeshDataInfo._LODLevels;\r\n };\r\n Mesh.prototype._sortLODLevels = function () {\r\n this._internalMeshDataInfo._LODLevels.sort(function (a, b) {\r\n if (a.distance < b.distance) {\r\n return 1;\r\n }\r\n if (a.distance > b.distance) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n };\r\n /**\r\n * Add a mesh as LOD level triggered at the given distance.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @param mesh The mesh to be added as LOD level (can be null)\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.addLODLevel = function (distance, mesh) {\r\n if (mesh && mesh._masterMesh) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"You cannot use a mesh as LOD level twice\");\r\n return this;\r\n }\r\n var level = new _meshLODLevel__WEBPACK_IMPORTED_MODULE_23__[\"MeshLODLevel\"](distance, mesh);\r\n this._internalMeshDataInfo._LODLevels.push(level);\r\n if (mesh) {\r\n mesh._masterMesh = this;\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the LOD level mesh at the passed distance or null if not found.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @returns a Mesh or `null`\r\n */\r\n Mesh.prototype.getLODLevelAtDistance = function (distance) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance === distance) {\r\n return level.mesh;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Remove a mesh from the LOD array\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param mesh defines the mesh to be removed\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.removeLODLevel = function (mesh) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n if (internalDataInfo._LODLevels[index].mesh === mesh) {\r\n internalDataInfo._LODLevels.splice(index, 1);\r\n if (mesh) {\r\n mesh._masterMesh = null;\r\n }\r\n }\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param camera defines the camera to use to compute distance\r\n * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.getLOD = function (camera, boundingSphere) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._LODLevels || internalDataInfo._LODLevels.length === 0) {\r\n return this;\r\n }\r\n var bSphere;\r\n if (boundingSphere) {\r\n bSphere = boundingSphere;\r\n }\r\n else {\r\n var boundingInfo = this.getBoundingInfo();\r\n bSphere = boundingInfo.boundingSphere;\r\n }\r\n var distanceToCamera = bSphere.centerWorld.subtract(camera.globalPosition).length();\r\n if (internalDataInfo._LODLevels[internalDataInfo._LODLevels.length - 1].distance > distanceToCamera) {\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n }\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance < distanceToCamera) {\r\n if (level.mesh) {\r\n level.mesh._preActivate();\r\n level.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, level.mesh);\r\n }\r\n return level.mesh;\r\n }\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"geometry\", {\r\n /**\r\n * Gets the mesh internal Geometry object\r\n */\r\n get: function () {\r\n return this._geometry;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.\r\n * @returns the total number of vertices\r\n */\r\n Mesh.prototype.getTotalVertices = function () {\r\n if (this._geometry === null || this._geometry === undefined) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalVertices();\r\n };\r\n /**\r\n * Returns the content of an associated vertex buffer\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one\r\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\r\n * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Returns the mesh VertexBuffer object from the requested `kind`\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVertexBuffer = function (kind) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVertexBuffer(kind);\r\n };\r\n /**\r\n * Tests if a specific vertex buffer is associated with this mesh\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable.\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVertexBufferUpdatable = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVertexBufferUpdatable(kind);\r\n };\r\n /**\r\n * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns an array of strings\r\n */\r\n Mesh.prototype.getVerticesDataKinds = function () {\r\n if (!this._geometry) {\r\n var result = new Array();\r\n if (this._delayInfo) {\r\n this._delayInfo.forEach(function (kind) {\r\n result.push(kind);\r\n });\r\n }\r\n return result;\r\n }\r\n return this._geometry.getVerticesDataKinds();\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n Mesh.prototype.getTotalIndices = function () {\r\n if (!this._geometry) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalIndices();\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the indices array or an empty array if the mesh has no geometry\r\n */\r\n Mesh.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return [];\r\n }\r\n return this._geometry.getIndices(copyWhenShared, forceCopy);\r\n };\r\n Object.defineProperty(Mesh.prototype, \"isBlocked\", {\r\n get: function () {\r\n return this._masterMesh !== null && this._masterMesh !== undefined;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Determine if the current mesh is ready to be rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)\r\n * @returns true if all associated assets are ready (material, textures, shaders)\r\n */\r\n Mesh.prototype.isReady = function (completeCheck, forceInstanceSupport) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (forceInstanceSupport === void 0) { forceInstanceSupport = false; }\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return false;\r\n }\r\n if (!_super.prototype.isReady.call(this, completeCheck)) {\r\n return false;\r\n }\r\n if (!this.subMeshes || this.subMeshes.length === 0) {\r\n return true;\r\n }\r\n if (!completeCheck) {\r\n return true;\r\n }\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n var hardwareInstancedRendering = forceInstanceSupport || engine.getCaps().instancedArrays && this.instances.length > 0;\r\n this.computeWorldMatrix();\r\n var mat = this.material || scene.defaultMaterial;\r\n if (mat) {\r\n if (mat._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var effectiveMaterial = subMesh.getMaterial();\r\n if (effectiveMaterial) {\r\n if (effectiveMaterial._storeEffectOnSubMeshes) {\r\n if (!effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n else {\r\n if (!effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (!mat.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Shadows\r\n for (var _b = 0, _c = this.lightSources; _b < _c.length; _b++) {\r\n var light = _c[_b];\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n for (var _d = 0, _e = this.subMeshes; _d < _e.length; _d++) {\r\n var subMesh = _e[_d];\r\n if (!generator.isReady(subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n // LOD\r\n for (var _f = 0, _g = this._internalMeshDataInfo._LODLevels; _f < _g.length; _f++) {\r\n var lod = _g[_f];\r\n if (lod.mesh && !lod.mesh.isReady(hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"areNormalsFrozen\", {\r\n /**\r\n * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._areNormalsFrozen;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.freezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unfreezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = false;\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"overridenInstanceCount\", {\r\n /**\r\n * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs\r\n */\r\n set: function (count) {\r\n this._instanceDataStorage.overridenInstanceCount = count;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /** @hidden */\r\n Mesh.prototype._preActivate = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n var sceneRenderId = this.getScene().getRenderId();\r\n if (internalDataInfo._preActivateId === sceneRenderId) {\r\n return this;\r\n }\r\n internalDataInfo._preActivateId = sceneRenderId;\r\n this._instanceDataStorage.visibleInstances = null;\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n if (this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._registerInstanceForRenderId = function (instance, renderId) {\r\n if (!this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances = {\r\n defaultRenderId: renderId,\r\n selfDefaultRenderId: this._renderId\r\n };\r\n }\r\n if (!this._instanceDataStorage.visibleInstances[renderId]) {\r\n this._instanceDataStorage.visibleInstances[renderId] = new Array();\r\n }\r\n this._instanceDataStorage.visibleInstances[renderId].push(instance);\r\n return this;\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this.geometry ? this.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._createGlobalSubMesh = function (force) {\r\n var totalVertices = this.getTotalVertices();\r\n if (!totalVertices || !this.getIndices()) {\r\n return null;\r\n }\r\n // Check if we need to recreate the submeshes\r\n if (this.subMeshes && this.subMeshes.length > 0) {\r\n var ib = this.getIndices();\r\n if (!ib) {\r\n return null;\r\n }\r\n var totalIndices = ib.length;\r\n var needToRecreate = false;\r\n if (force) {\r\n needToRecreate = true;\r\n }\r\n else {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var submesh = _a[_i];\r\n if (submesh.indexStart + submesh.indexCount >= totalIndices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n }\r\n }\r\n if (!needToRecreate) {\r\n return this.subMeshes[0];\r\n }\r\n }\r\n this.releaseSubMeshes();\r\n return new _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"](0, 0, totalVertices, 0, this.getTotalIndices(), this);\r\n };\r\n /**\r\n * This function will subdivide the mesh into multiple submeshes\r\n * @param count defines the expected number of submeshes\r\n */\r\n Mesh.prototype.subdivide = function (count) {\r\n if (count < 1) {\r\n return;\r\n }\r\n var totalIndices = this.getTotalIndices();\r\n var subdivisionSize = (totalIndices / count) | 0;\r\n var offset = 0;\r\n // Ensure that subdivisionSize is a multiple of 3\r\n while (subdivisionSize % 3 !== 0) {\r\n subdivisionSize++;\r\n }\r\n this.releaseSubMeshes();\r\n for (var index = 0; index < count; index++) {\r\n if (offset >= totalIndices) {\r\n break;\r\n }\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].CreateFromIndices(0, offset, Math.min(subdivisionSize, totalIndices - offset), this);\r\n offset += subdivisionSize;\r\n }\r\n this.synchronizeInstances();\r\n };\r\n /**\r\n * Copy a FloatArray into a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n * @param stride defines the data stride size (can be null)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"]();\r\n vertexData.set(data, kind);\r\n var scene = this.getScene();\r\n new _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"](_geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Flags an associated vertex buffer as updatable\r\n * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n */\r\n Mesh.prototype.markVerticesDataAsUpdatable = function (kind, updatable) {\r\n if (updatable === void 0) { updatable = true; }\r\n var vb = this.getVertexBuffer(kind);\r\n if (!vb || vb.isUpdatable() === updatable) {\r\n return;\r\n }\r\n this.setVerticesData(kind, this.getVerticesData(kind), updatable);\r\n };\r\n /**\r\n * Sets the mesh global Vertex Buffer\r\n * @param buffer defines the buffer to use\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesBuffer = function (buffer) {\r\n if (!this._geometry) {\r\n this._geometry = _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].CreateGeometryForMesh(this);\r\n }\r\n this._geometry.setVerticesBuffer(buffer);\r\n return this;\r\n };\r\n /**\r\n * Update a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for \"position\" kind\r\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n if (!makeItUnique) {\r\n this._geometry.updateVerticesData(kind, data, updateExtends);\r\n }\r\n else {\r\n this.makeGeometryUnique();\r\n this.updateVerticesData(kind, data, updateExtends, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.\r\n * @see http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions\r\n * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything\r\n * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateMeshPositions = function (positionFunction, computeNormals) {\r\n if (computeNormals === void 0) { computeNormals = true; }\r\n var positions = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!positions) {\r\n return this;\r\n }\r\n positionFunction(positions);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positions, false, false);\r\n if (computeNormals) {\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n if (!normals) {\r\n return this;\r\n }\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals, false, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Creates a un-shared specific occurence of the geometry for the mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.makeGeometryUnique = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var oldGeometry = this._geometry;\r\n var geometry = this._geometry.copy(_geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].RandomId());\r\n oldGeometry.releaseForMesh(this, true);\r\n geometry.applyToMesh(this);\r\n return this;\r\n };\r\n /**\r\n * Set the index buffer of this mesh\r\n * @param indices defines the source data\r\n * @param totalVertices defines the total number of vertices referenced by this index data (can be null)\r\n * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n var scene = this.getScene();\r\n new _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"](_geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"].RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setIndices(indices, totalVertices, updatable);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Update the current index buffer\r\n * @param indices defines the source data\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.updateIndices(indices, offset, gpuMemoryOnly);\r\n return this;\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.toLeftHanded = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.toLeftHanded();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Wireframe\r\n var indexToBind;\r\n if (this._unIndexed) {\r\n indexToBind = null;\r\n }\r\n else {\r\n switch (fillMode) {\r\n case _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].PointFillMode:\r\n indexToBind = null;\r\n break;\r\n case _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].WireFrameFillMode:\r\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\r\n break;\r\n default:\r\n case _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].TriangleFillMode:\r\n indexToBind = this._geometry.getIndexBuffer();\r\n break;\r\n }\r\n }\r\n // VBOs\r\n this._geometry._bind(effect, indexToBind);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (this._unIndexed || fillMode == _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].PointFillMode) {\r\n // or triangles as points\r\n engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else if (fillMode == _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].WireFrameFillMode) {\r\n // Triangles as wireframe\r\n engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just before the rendering process\r\n * @param func defines the function to call before rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called before the rendering\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just after the rendering is complete\r\n * @param func defines the function to call after rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called after the rendering.\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._getInstancesRenderList = function (subMeshId) {\r\n if (this._instanceDataStorage.isFrozen && this._instanceDataStorage.previousBatch) {\r\n return this._instanceDataStorage.previousBatch;\r\n }\r\n var scene = this.getScene();\r\n var isInIntermediateRendering = scene._isInIntermediateRendering();\r\n var onlyForInstances = isInIntermediateRendering ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate : this._internalAbstractMeshDataInfo._onlyForInstances;\r\n var batchCache = this._instanceDataStorage.batchCache;\r\n batchCache.mustReturn = false;\r\n batchCache.renderSelf[subMeshId] = !onlyForInstances && this.isEnabled() && this.isVisible;\r\n batchCache.visibleInstances[subMeshId] = null;\r\n if (this._instanceDataStorage.visibleInstances) {\r\n var visibleInstances = this._instanceDataStorage.visibleInstances;\r\n var currentRenderId = scene.getRenderId();\r\n var defaultRenderId = (isInIntermediateRendering ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId);\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];\r\n if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];\r\n }\r\n }\r\n batchCache.hardwareInstancedRendering[subMeshId] = this._instanceDataStorage.hardwareInstancedRendering && (batchCache.visibleInstances[subMeshId] !== null) && (batchCache.visibleInstances[subMeshId] !== undefined);\r\n this._instanceDataStorage.previousBatch = batchCache;\r\n return batchCache;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._renderWithInstances = function (subMesh, fillMode, batch, effect, engine) {\r\n var visibleInstances = batch.visibleInstances[subMesh._id];\r\n if (!visibleInstances) {\r\n return this;\r\n }\r\n var instanceStorage = this._instanceDataStorage;\r\n var currentInstancesBufferSize = instanceStorage.instancesBufferSize;\r\n var instancesBuffer = instanceStorage.instancesBuffer;\r\n var matricesCount = visibleInstances.length + 1;\r\n var bufferSize = matricesCount * 16 * 4;\r\n while (instanceStorage.instancesBufferSize < bufferSize) {\r\n instanceStorage.instancesBufferSize *= 2;\r\n }\r\n if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\r\n instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);\r\n }\r\n var offset = 0;\r\n var instancesCount = 0;\r\n var world = this._effectiveMesh.getWorldMatrix();\r\n if (batch.renderSelf[subMesh._id]) {\r\n world.copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n if (visibleInstances) {\r\n for (var instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\r\n var instance = visibleInstances[instanceIndex];\r\n instance.getWorldMatrix().copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n }\r\n if (!instancesBuffer || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\r\n if (instancesBuffer) {\r\n instancesBuffer.dispose();\r\n }\r\n instancesBuffer = new _buffer__WEBPACK_IMPORTED_MODULE_8__[\"Buffer\"](engine, instanceStorage.instancesData, true, 16, false, true);\r\n instanceStorage.instancesBuffer = instancesBuffer;\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n }\r\n else {\r\n instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\r\n }\r\n this._bind(subMesh, effect, fillMode);\r\n this._draw(subMesh, fillMode, instancesCount);\r\n engine.unbindInstanceAttributes();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._processRendering = function (subMesh, effect, fillMode, batch, hardwareInstancedRendering, onBeforeDraw, effectiveMaterial) {\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (hardwareInstancedRendering) {\r\n this._renderWithInstances(subMesh, fillMode, batch, effect, engine);\r\n }\r\n else {\r\n if (batch.renderSelf[subMesh._id]) {\r\n // Draw\r\n if (onBeforeDraw) {\r\n onBeforeDraw(false, this._effectiveMesh.getWorldMatrix(), effectiveMaterial);\r\n }\r\n this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);\r\n }\r\n var visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];\r\n if (visibleInstancesForSubMesh) {\r\n for (var instanceIndex = 0; instanceIndex < visibleInstancesForSubMesh.length; instanceIndex++) {\r\n var instance = visibleInstancesForSubMesh[instanceIndex];\r\n // World\r\n var world = instance.getWorldMatrix();\r\n if (onBeforeDraw) {\r\n onBeforeDraw(true, world, effectiveMaterial);\r\n }\r\n // Draw\r\n this._draw(subMesh, fillMode);\r\n }\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._rebuild = function () {\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n _super.prototype._rebuild.call(this);\r\n };\r\n /** @hidden */\r\n Mesh.prototype._freeze = function () {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n // Prepare batches\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this._getInstancesRenderList(index);\r\n }\r\n this._effectiveMaterial = null;\r\n this._instanceDataStorage.isFrozen = true;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unFreeze = function () {\r\n this._instanceDataStorage.isFrozen = false;\r\n this._instanceDataStorage.previousBatch = null;\r\n };\r\n /**\r\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\r\n * @param subMesh defines the subMesh to render\r\n * @param enableAlphaMode defines if alpha mode can be changed\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.render = function (subMesh, enableAlphaMode) {\r\n var scene = this.getScene();\r\n if (scene._isInIntermediateRendering()) {\r\n this._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n }\r\n else {\r\n this._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n if (this._checkOcclusionQuery()) {\r\n return this;\r\n }\r\n // Managing instances\r\n var batch = this._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return this;\r\n }\r\n // Checking geometry state\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);\r\n }\r\n var engine = scene.getEngine();\r\n var hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id];\r\n var instanceDataStorage = this._instanceDataStorage;\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return this;\r\n }\r\n // Material\r\n if (!instanceDataStorage.isFrozen || !this._effectiveMaterial || this._effectiveMaterial !== material) {\r\n this._effectiveMaterial = material;\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n if (!this._effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n }\r\n else if (!this._effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n }\r\n // Alpha mode\r\n if (enableAlphaMode) {\r\n engine.setAlphaMode(this._effectiveMaterial.alphaMode);\r\n }\r\n for (var _i = 0, _a = scene._beforeRenderingMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this, subMesh, batch);\r\n }\r\n var effect;\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n effect = subMesh.effect;\r\n }\r\n else {\r\n effect = this._effectiveMaterial.getEffect();\r\n }\r\n if (!effect) {\r\n return this;\r\n }\r\n var effectiveMesh = this._effectiveMesh;\r\n var sideOrientation;\r\n if (!instanceDataStorage.isFrozen) {\r\n sideOrientation = this.overrideMaterialSideOrientation;\r\n if (sideOrientation == null) {\r\n sideOrientation = this._effectiveMaterial.sideOrientation;\r\n }\r\n if (effectiveMesh._getWorldMatrixDeterminant() < 0) {\r\n sideOrientation = (sideOrientation === _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].ClockWiseSideOrientation ? _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].CounterClockWiseSideOrientation : _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].ClockWiseSideOrientation);\r\n }\r\n instanceDataStorage.sideOrientation = sideOrientation;\r\n }\r\n else {\r\n sideOrientation = instanceDataStorage.sideOrientation;\r\n }\r\n var reverse = this._effectiveMaterial._preBind(effect, sideOrientation);\r\n if (this._effectiveMaterial.forceDepthWrite) {\r\n engine.setDepthWrite(true);\r\n }\r\n // Bind\r\n var fillMode = scene.forcePointsCloud ? _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].PointFillMode : (scene.forceWireframe ? _Materials_material__WEBPACK_IMPORTED_MODULE_14__[\"Material\"].WireFrameFillMode : this._effectiveMaterial.fillMode);\r\n if (this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this);\r\n }\r\n if (!hardwareInstancedRendering) { // Binding will be done later because we need to add more info to the VB\r\n this._bind(subMesh, effect, fillMode);\r\n }\r\n var world = effectiveMesh.getWorldMatrix();\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n this._effectiveMaterial.bindForSubMesh(world, this, subMesh);\r\n }\r\n else {\r\n this._effectiveMaterial.bind(world, this);\r\n }\r\n if (!this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass) {\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, !reverse);\r\n this._processRendering(subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, reverse);\r\n }\r\n // Draw\r\n this._processRendering(subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n // Unbind\r\n this._effectiveMaterial.unbind();\r\n for (var _b = 0, _c = scene._afterRenderingMeshStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this, subMesh, batch);\r\n }\r\n if (this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._onBeforeDraw = function (isInstance, world, effectiveMaterial) {\r\n if (isInstance && effectiveMaterial) {\r\n effectiveMaterial.bindOnlyWorldMatrix(world);\r\n }\r\n };\r\n /**\r\n * Renormalize the mesh and patch it up if there are no weights\r\n * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.\r\n * However in the case of zero weights then we set just a single influence to 1.\r\n * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.\r\n */\r\n Mesh.prototype.cleanMatrixWeights = function () {\r\n if (this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n if (this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind)) {\r\n this.normalizeSkinWeightsAndExtra();\r\n }\r\n else {\r\n this.normalizeSkinFourWeights();\r\n }\r\n }\r\n };\r\n // faster 4 weight version.\r\n Mesh.prototype.normalizeSkinFourWeights = function () {\r\n var matricesWeights = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeights);\r\n };\r\n // handle special case of extra verts. (in theory gltf can handle 12 influences)\r\n Mesh.prototype.normalizeSkinWeightsAndExtra = function () {\r\n var matricesWeightsExtra = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n t += matricesWeightsExtra[a] + matricesWeightsExtra[a + 1] + matricesWeightsExtra[a + 2] + matricesWeightsExtra[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n // same goes for extras\r\n matricesWeightsExtra[a] *= recip;\r\n matricesWeightsExtra[a + 1] *= recip;\r\n matricesWeightsExtra[a + 2] *= recip;\r\n matricesWeightsExtra[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeights);\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind, matricesWeightsExtra);\r\n };\r\n /**\r\n * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,\r\n * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let\r\n * the user know there was an issue with importing the mesh\r\n * @returns a validation object with skinned, valid and report string\r\n */\r\n Mesh.prototype.validateSkinning = function () {\r\n var matricesWeightsExtra = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (matricesWeights === null || this.skeleton == null) {\r\n return { skinned: false, valid: true, report: \"not skinned\" };\r\n }\r\n var numWeights = matricesWeights.length;\r\n var numberNotSorted = 0;\r\n var missingWeights = 0;\r\n var maxUsedWeights = 0;\r\n var numberNotNormalized = 0;\r\n var numInfluences = matricesWeightsExtra === null ? 4 : 8;\r\n var usedWeightCounts = new Array();\r\n for (var a = 0; a <= numInfluences; a++) {\r\n usedWeightCounts[a] = 0;\r\n }\r\n var toleranceEpsilon = 0.001;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n var lastWeight = matricesWeights[a];\r\n var t = lastWeight;\r\n var usedWeights = t === 0 ? 0 : 1;\r\n for (var b = 1; b < numInfluences; b++) {\r\n var d = b < 4 ? matricesWeights[a + b] : matricesWeightsExtra[a + b - 4];\r\n if (d > lastWeight) {\r\n numberNotSorted++;\r\n }\r\n if (d !== 0) {\r\n usedWeights++;\r\n }\r\n t += d;\r\n lastWeight = d;\r\n }\r\n // count the buffer weights usage\r\n usedWeightCounts[usedWeights]++;\r\n // max influences\r\n if (usedWeights > maxUsedWeights) {\r\n maxUsedWeights = usedWeights;\r\n }\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n missingWeights++;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n var tolerance = 0;\r\n for (b = 0; b < numInfluences; b++) {\r\n if (b < 4) {\r\n tolerance += Math.abs(matricesWeights[a + b] - (matricesWeights[a + b] * recip));\r\n }\r\n else {\r\n tolerance += Math.abs(matricesWeightsExtra[a + b - 4] - (matricesWeightsExtra[a + b - 4] * recip));\r\n }\r\n }\r\n // arbitary epsilon value for dicdating not normalized\r\n if (tolerance > toleranceEpsilon) {\r\n numberNotNormalized++;\r\n }\r\n }\r\n }\r\n // validate bone indices are in range of the skeleton\r\n var numBones = this.skeleton.bones.length;\r\n var matricesIndices = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesIndicesExtra = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n var numBadBoneIndices = 0;\r\n for (var a = 0; a < numWeights; a++) {\r\n for (var b = 0; b < numInfluences; b++) {\r\n var index = b < 4 ? matricesIndices[b] : matricesIndicesExtra[b - 4];\r\n if (index >= numBones || index < 0) {\r\n numBadBoneIndices++;\r\n }\r\n }\r\n }\r\n // log mesh stats\r\n var output = \"Number of Weights = \" + numWeights / 4 + \"\\nMaximum influences = \" + maxUsedWeights +\r\n \"\\nMissing Weights = \" + missingWeights + \"\\nNot Sorted = \" + numberNotSorted +\r\n \"\\nNot Normalized = \" + numberNotNormalized + \"\\nWeightCounts = [\" + usedWeightCounts + \"]\" +\r\n \"\\nNumber of bones = \" + numBones + \"\\nBad Bone Indices = \" + numBadBoneIndices;\r\n return { skinned: true, valid: missingWeights === 0 && numberNotNormalized === 0 && numBadBoneIndices === 0, report: output };\r\n };\r\n /** @hidden */\r\n Mesh.prototype._checkDelayState = function () {\r\n var scene = this.getScene();\r\n if (this._geometry) {\r\n this._geometry.load(scene);\r\n }\r\n else if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_NOTLOADED) {\r\n this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADING;\r\n this._queueLoad(scene);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._queueLoad = function (scene) {\r\n var _this = this;\r\n scene._addPendingData(this);\r\n var getBinaryData = (this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\") !== -1);\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].LoadFile(this.delayLoadingFile, function (data) {\r\n if (data instanceof ArrayBuffer) {\r\n _this._delayLoadingFunction(data, _this);\r\n }\r\n else {\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n }\r\n _this.instances.forEach(function (instance) {\r\n instance.refreshBoundingInfo();\r\n instance._syncSubMeshes();\r\n });\r\n _this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADED;\r\n scene._removePendingData(_this);\r\n }, function () { }, scene.offlineProvider, getBinaryData);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n Mesh.prototype.isInFrustum = function (frustumPlanes) {\r\n if (this.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return false;\r\n }\r\n if (!_super.prototype.isInFrustum.call(this, frustumPlanes)) {\r\n return false;\r\n }\r\n this._checkDelayState();\r\n return true;\r\n };\r\n /**\r\n * Sets the mesh material by the material or multiMaterial `id` property\r\n * @param id is a string identifying the material or the multiMaterial\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setMaterialByID = function (id) {\r\n var materials = this.getScene().materials;\r\n var index;\r\n for (index = materials.length - 1; index > -1; index--) {\r\n if (materials[index].id === id) {\r\n this.material = materials[index];\r\n return this;\r\n }\r\n }\r\n // Multi\r\n var multiMaterials = this.getScene().multiMaterials;\r\n for (index = multiMaterials.length - 1; index > -1; index--) {\r\n if (multiMaterials[index].id === id) {\r\n this.material = multiMaterials[index];\r\n return this;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns as a new array populated with the mesh material and/or skeleton, if any.\r\n * @returns an array of IAnimatable\r\n */\r\n Mesh.prototype.getAnimatables = function () {\r\n var results = new Array();\r\n if (this.material) {\r\n results.push(this.material);\r\n }\r\n if (this.skeleton) {\r\n results.push(this.skeleton);\r\n }\r\n return results;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to the passed transformation matrix.\r\n * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.\r\n * The mesh normals are modified using the same transformation.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @param transform defines the transform matrix to use\r\n * @see http://doc.babylonjs.com/resources/baking_transformations\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeTransformIntoVertices = function (transform) {\r\n // Position\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)) {\r\n return this;\r\n }\r\n var submeshes = this.subMeshes.splice(0);\r\n this._resetPointsArrayCache();\r\n var data = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < data.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(data, index), transform).toArray(temp, index);\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, temp, this.getVertexBuffer(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind).isUpdatable());\r\n // Normals\r\n if (this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)) {\r\n data = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n temp = [];\r\n for (index = 0; index < data.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformNormal(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(data, index), transform).normalize().toArray(temp, index);\r\n }\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, temp, this.getVertexBuffer(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind).isUpdatable());\r\n }\r\n // flip faces?\r\n if (transform.m[0] * transform.m[5] * transform.m[10] < 0) {\r\n this.flipFaces();\r\n }\r\n // Restore submeshes\r\n this.releaseSubMeshes();\r\n this.subMeshes = submeshes;\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to its own current World Matrix.\r\n * The mesh World Matrix is then reset.\r\n * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @see http://doc.babylonjs.com/resources/baking_transformations\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeCurrentTransformIntoVertices = function () {\r\n this.bakeTransformIntoVertices(this.computeWorldMatrix(true));\r\n this.scaling.copyFromFloats(1, 1, 1);\r\n this.position.copyFromFloats(0, 0, 0);\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n //only if quaternion is already set\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"].Identity();\r\n }\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].Identity();\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_positions\", {\r\n // Cache\r\n /** @hidden */\r\n get: function () {\r\n if (this._geometry) {\r\n return this._geometry._positions;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Mesh.prototype._resetPointsArrayCache = function () {\r\n if (this._geometry) {\r\n this._geometry._resetPointsArrayCache();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._generatePointsArray = function () {\r\n if (this._geometry) {\r\n return this._geometry._generatePointsArray();\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns a new Mesh object generated from the current mesh properties.\r\n * This method must not get confused with createInstance()\r\n * @param name is a string, the name given to the new mesh\r\n * @param newParent can be any Node object (default `null`)\r\n * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)\r\n * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)\r\n * @returns a new mesh\r\n */\r\n Mesh.prototype.clone = function (name, newParent, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (name === void 0) { name = \"\"; }\r\n if (newParent === void 0) { newParent = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n return new Mesh(name, this.getScene(), newParent, this, doNotCloneChildren, clonePhysicsImpostor);\r\n };\r\n /**\r\n * Releases resources associated with this mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Mesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this.morphTargetManager = null;\r\n if (this._geometry) {\r\n this._geometry.releaseForMesh(this, true);\r\n }\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (internalDataInfo._onBeforeDrawObservable) {\r\n internalDataInfo._onBeforeDrawObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeBindObservable) {\r\n internalDataInfo._onBeforeBindObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeRenderObservable) {\r\n internalDataInfo._onBeforeRenderObservable.clear();\r\n }\r\n if (internalDataInfo._onAfterRenderObservable) {\r\n internalDataInfo._onAfterRenderObservable.clear();\r\n }\r\n // Sources\r\n if (this._scene.useClonedMeshhMap) {\r\n if (internalDataInfo.meshMap) {\r\n for (var uniqueId in internalDataInfo.meshMap) {\r\n var mesh = internalDataInfo.meshMap[uniqueId];\r\n if (mesh) {\r\n mesh._internalMeshDataInfo._source = null;\r\n internalDataInfo.meshMap[uniqueId] = undefined;\r\n }\r\n }\r\n }\r\n if (internalDataInfo._source && internalDataInfo._source._internalMeshDataInfo.meshMap) {\r\n internalDataInfo._source._internalMeshDataInfo.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n else {\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var abstractMesh = meshes_1[_i];\r\n var mesh = abstractMesh;\r\n if (mesh._internalMeshDataInfo && mesh._internalMeshDataInfo._source && mesh._internalMeshDataInfo._source === this) {\r\n mesh._internalMeshDataInfo._source = null;\r\n }\r\n }\r\n }\r\n internalDataInfo._source = null;\r\n // Instances\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n while (this.instances.length) {\r\n this.instances[0].dispose();\r\n }\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacement map.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param url is a string, the URL from the image file is to be downloaded.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMap = function (url, minHeight, maxHeight, onSuccess, uvOffset, uvScale, forceUpdate) {\r\n var _this = this;\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var scene = this.getScene();\r\n var onload = function (img) {\r\n // Getting height map data\r\n var canvas = document.createElement(\"canvas\");\r\n var context = canvas.getContext(\"2d\");\r\n var heightMapWidth = img.width;\r\n var heightMapHeight = img.height;\r\n canvas.width = heightMapWidth;\r\n canvas.height = heightMapHeight;\r\n context.drawImage(img, 0, 0);\r\n // Create VertexData from map data\r\n //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\r\n var buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;\r\n _this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);\r\n //execute success callback, if set\r\n if (onSuccess) {\r\n onSuccess(_this);\r\n }\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].LoadImage(url, onload, function () { }, scene.offlineProvider);\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacementMap buffer.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.\r\n * @param heightMapWidth is the width of the buffer image.\r\n * @param heightMapHeight is the height of the buffer image.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMapFromBuffer = function (buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)\r\n || !this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)\r\n || !this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind)) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing\");\r\n return this;\r\n }\r\n var positions = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, true, true);\r\n var normals = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n var uvs = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind);\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n var uv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].Zero();\r\n uvOffset = uvOffset || _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].Zero();\r\n uvScale = uvScale || new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](1, 1);\r\n for (var index = 0; index < positions.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArrayToRef(positions, index, position);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArrayToRef(normals, index, normal);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"].FromArrayToRef(uvs, (index / 3) * 2, uv);\r\n // Compute height\r\n var u = ((Math.abs(uv.x * uvScale.x + uvOffset.x) * heightMapWidth) % heightMapWidth) | 0;\r\n var v = ((Math.abs(uv.y * uvScale.y + uvOffset.y) * heightMapHeight) % heightMapHeight) | 0;\r\n var pos = (u + v * heightMapWidth) * 4;\r\n var r = buffer[pos] / 255.0;\r\n var g = buffer[pos + 1] / 255.0;\r\n var b = buffer[pos + 2] / 255.0;\r\n var gradient = r * 0.3 + g * 0.59 + b * 0.11;\r\n normal.normalize();\r\n normal.scaleInPlace(minHeight + (maxHeight - minHeight) * gradient);\r\n position = position.add(normal);\r\n position.toArray(positions, index);\r\n }\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ComputeNormals(positions, this.getIndices(), normals);\r\n if (forceUpdate) {\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positions);\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals);\r\n }\r\n else {\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positions);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Modify the mesh to get a flat shading rendering.\r\n * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.\r\n * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToFlatShadedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var updatableNormals = false;\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (kind === _buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind) {\r\n updatableNormals = vertexBuffer.isUpdatable();\r\n kinds.splice(kindIndex, 1);\r\n kindIndex--;\r\n continue;\r\n }\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating faces & normal\r\n var normals = [];\r\n var positions = newdata[_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind];\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n var p1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, index * 3);\r\n var p2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, (index + 1) * 3);\r\n var p3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, (index + 2) * 3);\r\n var p1p2 = p1.subtract(p2);\r\n var p3p2 = p3.subtract(p2);\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Cross(p1p2, p3p2));\r\n // Store same normals for every vertex\r\n for (var localIndex = 0; localIndex < 3; localIndex++) {\r\n normals.push(normal.x);\r\n normals.push(normal.y);\r\n normals.push(normal.z);\r\n }\r\n }\r\n this.setIndices(indices);\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normals, updatableNormals);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.\r\n * In other words, more vertices, no more indices and a single bigger VBO.\r\n * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToUnIndexedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating indices\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n }\r\n this.setIndices(indices);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this._unIndexed = true;\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * Inverses facet orientations.\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param flipNormals will also inverts the normals\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.flipFaces = function (flipNormals) {\r\n if (flipNormals === void 0) { flipNormals = false; }\r\n var vertex_data = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(this);\r\n var i;\r\n if (flipNormals && this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind) && vertex_data.normals) {\r\n for (i = 0; i < vertex_data.normals.length; i++) {\r\n vertex_data.normals[i] *= -1;\r\n }\r\n }\r\n if (vertex_data.indices) {\r\n var temp;\r\n for (i = 0; i < vertex_data.indices.length; i += 3) {\r\n // reassign indices\r\n temp = vertex_data.indices[i + 1];\r\n vertex_data.indices[i + 1] = vertex_data.indices[i + 2];\r\n vertex_data.indices[i + 2] = temp;\r\n }\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind));\r\n return this;\r\n };\r\n /**\r\n * Increase the number of facets and hence vertices in a mesh\r\n * Vertex normals are interpolated from existing vertex normals\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1\r\n */\r\n Mesh.prototype.increaseVertices = function (numberPerEdge) {\r\n var vertex_data = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(this);\r\n var uvs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var positions = vertex_data.positions;\r\n var normals = vertex_data.normals;\r\n if (currentIndices === null || positions === null || normals === null || uvs === null) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"VertexData contains null entries\");\r\n }\r\n else {\r\n var segments = numberPerEdge + 1; //segments per current facet edge, become sides of new facets\r\n var tempIndices = new Array();\r\n for (var i = 0; i < segments + 1; i++) {\r\n tempIndices[i] = new Array();\r\n }\r\n var a; //vertex index of one end of a side\r\n var b; //vertex index of other end of the side\r\n var deltaPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](0, 0, 0);\r\n var deltaNormal = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](0, 0, 0);\r\n var deltaUV = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](0, 0);\r\n var indices = new Array();\r\n var vertexIndex = new Array();\r\n var side = new Array();\r\n var len;\r\n var positionPtr = positions.length;\r\n var uvPtr = uvs.length;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n vertexIndex[0] = currentIndices[i];\r\n vertexIndex[1] = currentIndices[i + 1];\r\n vertexIndex[2] = currentIndices[i + 2];\r\n for (var j = 0; j < 3; j++) {\r\n a = vertexIndex[j];\r\n b = vertexIndex[(j + 1) % 3];\r\n if (side[a] === undefined && side[b] === undefined) {\r\n side[a] = new Array();\r\n side[b] = new Array();\r\n }\r\n else {\r\n if (side[a] === undefined) {\r\n side[a] = new Array();\r\n }\r\n if (side[b] === undefined) {\r\n side[b] = new Array();\r\n }\r\n }\r\n if (side[a][b] === undefined && side[b][a] === undefined) {\r\n side[a][b] = [];\r\n deltaPosition.x = (positions[3 * b] - positions[3 * a]) / segments;\r\n deltaPosition.y = (positions[3 * b + 1] - positions[3 * a + 1]) / segments;\r\n deltaPosition.z = (positions[3 * b + 2] - positions[3 * a + 2]) / segments;\r\n deltaNormal.x = (normals[3 * b] - normals[3 * a]) / segments;\r\n deltaNormal.y = (normals[3 * b + 1] - normals[3 * a + 1]) / segments;\r\n deltaNormal.z = (normals[3 * b + 2] - normals[3 * a + 2]) / segments;\r\n deltaUV.x = (uvs[2 * b] - uvs[2 * a]) / segments;\r\n deltaUV.y = (uvs[2 * b + 1] - uvs[2 * a + 1]) / segments;\r\n side[a][b].push(a);\r\n for (var k = 1; k < segments; k++) {\r\n side[a][b].push(positions.length / 3);\r\n positions[positionPtr] = positions[3 * a] + k * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * a] + k * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * a + 1] + k * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * a + 1] + k * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * a + 2] + k * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * a + 2] + k * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * a] + k * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * a + 1] + k * deltaUV.y;\r\n }\r\n side[a][b].push(b);\r\n side[b][a] = new Array();\r\n len = side[a][b].length;\r\n for (var idx = 0; idx < len; idx++) {\r\n side[b][a][idx] = side[a][b][len - 1 - idx];\r\n }\r\n }\r\n }\r\n //Calculate positions, normals and uvs of new internal vertices\r\n tempIndices[0][0] = currentIndices[i];\r\n tempIndices[1][0] = side[currentIndices[i]][currentIndices[i + 1]][1];\r\n tempIndices[1][1] = side[currentIndices[i]][currentIndices[i + 2]][1];\r\n for (var k = 2; k < segments; k++) {\r\n tempIndices[k][0] = side[currentIndices[i]][currentIndices[i + 1]][k];\r\n tempIndices[k][k] = side[currentIndices[i]][currentIndices[i + 2]][k];\r\n deltaPosition.x = (positions[3 * tempIndices[k][k]] - positions[3 * tempIndices[k][0]]) / k;\r\n deltaPosition.y = (positions[3 * tempIndices[k][k] + 1] - positions[3 * tempIndices[k][0] + 1]) / k;\r\n deltaPosition.z = (positions[3 * tempIndices[k][k] + 2] - positions[3 * tempIndices[k][0] + 2]) / k;\r\n deltaNormal.x = (normals[3 * tempIndices[k][k]] - normals[3 * tempIndices[k][0]]) / k;\r\n deltaNormal.y = (normals[3 * tempIndices[k][k] + 1] - normals[3 * tempIndices[k][0] + 1]) / k;\r\n deltaNormal.z = (normals[3 * tempIndices[k][k] + 2] - normals[3 * tempIndices[k][0] + 2]) / k;\r\n deltaUV.x = (uvs[2 * tempIndices[k][k]] - uvs[2 * tempIndices[k][0]]) / k;\r\n deltaUV.y = (uvs[2 * tempIndices[k][k] + 1] - uvs[2 * tempIndices[k][0] + 1]) / k;\r\n for (var j = 1; j < k; j++) {\r\n tempIndices[k][j] = positions.length / 3;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0]] + j * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0]] + j * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 1] + j * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 1] + j * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 2] + j * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 2] + j * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0]] + j * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0] + 1] + j * deltaUV.y;\r\n }\r\n }\r\n tempIndices[segments] = side[currentIndices[i + 1]][currentIndices[i + 2]];\r\n // reform indices\r\n indices.push(tempIndices[0][0], tempIndices[1][0], tempIndices[1][1]);\r\n for (var k = 1; k < segments; k++) {\r\n for (var j = 0; j < k; j++) {\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j + 1], tempIndices[k][j + 1]);\r\n }\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n }\r\n }\r\n vertex_data.indices = indices;\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind));\r\n }\r\n };\r\n /**\r\n * Force adjacent facets to share vertices and remove any facets that have all vertices in a line\r\n * This will undo any application of covertToFlatShadedMesh\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n */\r\n Mesh.prototype.forceSharedVertices = function () {\r\n var vertex_data = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(this);\r\n var currentUVs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var currentPositions = vertex_data.positions;\r\n var currentColors = vertex_data.colors;\r\n if (currentIndices === void 0 || currentPositions === void 0 || currentIndices === null || currentPositions === null) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"VertexData contains empty entries\");\r\n }\r\n else {\r\n var positions = new Array();\r\n var indices = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var pstring = new Array(); //lists facet vertex positions (a,b,c) as string \"a|b|c\"\r\n var indexPtr = 0; // pointer to next available index value\r\n var uniquePositions = new Array(); // unique vertex positions\r\n var ptr; // pointer to element in uniquePositions\r\n var facet;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n facet = [currentIndices[i], currentIndices[i + 1], currentIndices[i + 2]]; //facet vertex indices\r\n pstring = new Array();\r\n for (var j = 0; j < 3; j++) {\r\n pstring[j] = \"\";\r\n for (var k = 0; k < 3; k++) {\r\n //small values make 0\r\n if (Math.abs(currentPositions[3 * facet[j] + k]) < 0.00000001) {\r\n currentPositions[3 * facet[j] + k] = 0;\r\n }\r\n pstring[j] += currentPositions[3 * facet[j] + k] + \"|\";\r\n }\r\n pstring[j] = pstring[j].slice(0, -1);\r\n }\r\n //check facet vertices to see that none are repeated\r\n // do not process any facet that has a repeated vertex, ie is a line\r\n if (!(pstring[0] == pstring[1] || pstring[0] == pstring[2] || pstring[1] == pstring[2])) {\r\n //for each facet position check if already listed in uniquePositions\r\n // if not listed add to uniquePositions and set index pointer\r\n // if listed use its index in uniquePositions and new index pointer\r\n for (var j = 0; j < 3; j++) {\r\n ptr = uniquePositions.indexOf(pstring[j]);\r\n if (ptr < 0) {\r\n uniquePositions.push(pstring[j]);\r\n ptr = indexPtr++;\r\n //not listed so add individual x, y, z coordinates to positions\r\n for (var k = 0; k < 3; k++) {\r\n positions.push(currentPositions[3 * facet[j] + k]);\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n for (var k = 0; k < 4; k++) {\r\n colors.push(currentColors[4 * facet[j] + k]);\r\n }\r\n }\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n for (var k = 0; k < 2; k++) {\r\n uvs.push(currentUVs[2 * facet[j] + k]);\r\n }\r\n }\r\n }\r\n // add new index pointer to indices array\r\n indices.push(ptr);\r\n }\r\n }\r\n }\r\n var normals = new Array();\r\n _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n //create new vertex data object and update\r\n vertex_data.positions = positions;\r\n vertex_data.indices = indices;\r\n vertex_data.normals = normals;\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n vertex_data.uvs = uvs;\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n vertex_data.colors = colors;\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind));\r\n }\r\n };\r\n // Instances\r\n /** @hidden */\r\n Mesh._instancedMeshFactory = function (name, mesh) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"InstancedMesh\");\r\n };\r\n /** @hidden */\r\n Mesh._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"PhysicsImpostor\");\r\n };\r\n /**\r\n * Creates a new InstancedMesh object from the mesh model.\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedMesh\r\n */\r\n Mesh.prototype.createInstance = function (name) {\r\n return Mesh._instancedMeshFactory(name, this);\r\n };\r\n /**\r\n * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.\r\n * After this call, all the mesh instances have the same submeshes than the current mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.synchronizeInstances = function () {\r\n for (var instanceIndex = 0; instanceIndex < this.instances.length; instanceIndex++) {\r\n var instance = this.instances[instanceIndex];\r\n instance._syncSubMeshes();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Optimization of the mesh's indices, in case a mesh has duplicated vertices.\r\n * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.\r\n * This should be used together with the simplification to avoid disappearing triangles.\r\n * @param successCallback an optional success callback to be called after the optimization finished.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.optimizeIndices = function (successCallback) {\r\n var _this = this;\r\n var indices = this.getIndices();\r\n var positions = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!positions || !indices) {\r\n return this;\r\n }\r\n var vectorPositions = new Array();\r\n for (var pos = 0; pos < positions.length; pos = pos + 3) {\r\n vectorPositions.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(positions, pos));\r\n }\r\n var dupes = new Array();\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_2__[\"AsyncLoop\"].SyncAsyncForLoop(vectorPositions.length, 40, function (iteration) {\r\n var realPos = vectorPositions.length - 1 - iteration;\r\n var testedPosition = vectorPositions[realPos];\r\n for (var j = 0; j < realPos; ++j) {\r\n var againstPosition = vectorPositions[j];\r\n if (testedPosition.equals(againstPosition)) {\r\n dupes[realPos] = j;\r\n break;\r\n }\r\n }\r\n }, function () {\r\n for (var i = 0; i < indices.length; ++i) {\r\n indices[i] = dupes[indices[i]] || indices[i];\r\n }\r\n //indices are now reordered\r\n var originalSubMeshes = _this.subMeshes.slice(0);\r\n _this.setIndices(indices);\r\n _this.subMeshes = originalSubMeshes;\r\n if (successCallback) {\r\n successCallback(_this);\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Serialize current mesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n */\r\n Mesh.prototype.serialize = function (serializationObject) {\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n serializationObject.type = this.getClassName();\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].HasTags(this)) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].GetTags(this);\r\n }\r\n serializationObject.position = this.position.asArray();\r\n if (this.rotationQuaternion) {\r\n serializationObject.rotationQuaternion = this.rotationQuaternion.asArray();\r\n }\r\n else if (this.rotation) {\r\n serializationObject.rotation = this.rotation.asArray();\r\n }\r\n serializationObject.scaling = this.scaling.asArray();\r\n if (this._postMultiplyPivotMatrix) {\r\n serializationObject.pivotMatrix = this.getPivotMatrix().asArray();\r\n }\r\n else {\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n }\r\n serializationObject.isEnabled = this.isEnabled(false);\r\n serializationObject.isVisible = this.isVisible;\r\n serializationObject.infiniteDistance = this.infiniteDistance;\r\n serializationObject.pickable = this.isPickable;\r\n serializationObject.receiveShadows = this.receiveShadows;\r\n serializationObject.billboardMode = this.billboardMode;\r\n serializationObject.visibility = this.visibility;\r\n serializationObject.checkCollisions = this.checkCollisions;\r\n serializationObject.isBlocker = this.isBlocker;\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Geometry\r\n serializationObject.isUnIndexed = this.isUnIndexed;\r\n var geometry = this._geometry;\r\n if (geometry) {\r\n var geometryId = geometry.id;\r\n serializationObject.geometryId = geometryId;\r\n // SubMeshes\r\n serializationObject.subMeshes = [];\r\n for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n serializationObject.subMeshes.push({\r\n materialIndex: subMesh.materialIndex,\r\n verticesStart: subMesh.verticesStart,\r\n verticesCount: subMesh.verticesCount,\r\n indexStart: subMesh.indexStart,\r\n indexCount: subMesh.indexCount\r\n });\r\n }\r\n }\r\n // Material\r\n if (this.material) {\r\n if (!this.material.doNotSerialize) {\r\n serializationObject.materialId = this.material.id;\r\n }\r\n }\r\n else {\r\n this.material = null;\r\n }\r\n // Morph targets\r\n if (this.morphTargetManager) {\r\n serializationObject.morphTargetManagerId = this.morphTargetManager.uniqueId;\r\n }\r\n // Skeleton\r\n if (this.skeleton) {\r\n serializationObject.skeletonId = this.skeleton.id;\r\n }\r\n // Physics\r\n //TODO implement correct serialization for physics impostors.\r\n if (this.getScene()._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_22__[\"SceneComponentConstants\"].NAME_PHYSICSENGINE)) {\r\n var impostor = this.getPhysicsImpostor();\r\n if (impostor) {\r\n serializationObject.physicsMass = impostor.getParam(\"mass\");\r\n serializationObject.physicsFriction = impostor.getParam(\"friction\");\r\n serializationObject.physicsRestitution = impostor.getParam(\"mass\");\r\n serializationObject.physicsImpostor = impostor.type;\r\n }\r\n }\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n // Instances\r\n serializationObject.instances = [];\r\n for (var index = 0; index < this.instances.length; index++) {\r\n var instance = this.instances[index];\r\n if (instance.doNotSerialize) {\r\n continue;\r\n }\r\n var serializationInstance = {\r\n name: instance.name,\r\n id: instance.id,\r\n position: instance.position.asArray(),\r\n scaling: instance.scaling.asArray()\r\n };\r\n if (instance.parent) {\r\n serializationInstance.parentId = instance.parent.id;\r\n }\r\n if (instance.rotationQuaternion) {\r\n serializationInstance.rotationQuaternion = instance.rotationQuaternion.asArray();\r\n }\r\n else if (instance.rotation) {\r\n serializationInstance.rotation = instance.rotation.asArray();\r\n }\r\n serializationObject.instances.push(serializationInstance);\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].AppendSerializedAnimations(instance, serializationInstance);\r\n serializationInstance.ranges = instance.serializeAnimationRanges();\r\n }\r\n //\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_18__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n // Layer mask\r\n serializationObject.layerMask = this.layerMask;\r\n // Alpha\r\n serializationObject.alphaIndex = this.alphaIndex;\r\n serializationObject.hasVertexAlpha = this.hasVertexAlpha;\r\n // Overlay\r\n serializationObject.overlayAlpha = this.overlayAlpha;\r\n serializationObject.overlayColor = this.overlayColor.asArray();\r\n serializationObject.renderOverlay = this.renderOverlay;\r\n // Fog\r\n serializationObject.applyFog = this.applyFog;\r\n // Action Manager\r\n if (this.actionManager) {\r\n serializationObject.actions = this.actionManager.serialize(this.name);\r\n }\r\n };\r\n /** @hidden */\r\n Mesh.prototype._syncGeometryWithMorphTargetManager = function () {\r\n if (!this.geometry) {\r\n return;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n var morphTargetManager = this._internalMeshDataInfo._morphTargetManager;\r\n if (morphTargetManager && morphTargetManager.vertexCount) {\r\n if (morphTargetManager.vertexCount !== this.getTotalVertices()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Error(\"Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count.\");\r\n this.morphTargetManager = null;\r\n return;\r\n }\r\n for (var index = 0; index < morphTargetManager.numInfluencers; index++) {\r\n var morphTarget = morphTargetManager.getActiveTarget(index);\r\n var positions = morphTarget.getPositions();\r\n if (!positions) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Error(\"Invalid morph target. Target must have positions.\");\r\n return;\r\n }\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind + index, positions, false, 3);\r\n var normals = morphTarget.getNormals();\r\n if (normals) {\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind + index, normals, false, 3);\r\n }\r\n var tangents = morphTarget.getTangents();\r\n if (tangents) {\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].TangentKind + index, tangents, false, 3);\r\n }\r\n var uvs = morphTarget.getUVs();\r\n if (uvs) {\r\n this.geometry.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind + \"_\" + index, uvs, false, 2);\r\n }\r\n }\r\n }\r\n else {\r\n var index = 0;\r\n // Positions\r\n while (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind + index);\r\n if (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].TangentKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].TangentKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind + index)) {\r\n this.geometry.removeVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind + \"_\" + index);\r\n }\r\n index++;\r\n }\r\n }\r\n };\r\n /**\r\n * Returns a new Mesh object parsed from the source provided.\r\n * @param parsedMesh is the source\r\n * @param scene defines the hosting scene\r\n * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new Mesh\r\n */\r\n Mesh.Parse = function (parsedMesh, scene, rootUrl) {\r\n var mesh;\r\n if (parsedMesh.type && parsedMesh.type === \"GroundMesh\") {\r\n mesh = Mesh._GroundMeshParser(parsedMesh, scene);\r\n }\r\n else {\r\n mesh = new Mesh(parsedMesh.name, scene);\r\n }\r\n mesh.id = parsedMesh.id;\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(mesh, parsedMesh.tags);\r\n }\r\n mesh.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.position);\r\n if (parsedMesh.metadata !== undefined) {\r\n mesh.metadata = parsedMesh.metadata;\r\n }\r\n if (parsedMesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"].FromArray(parsedMesh.rotationQuaternion);\r\n }\r\n else if (parsedMesh.rotation) {\r\n mesh.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.rotation);\r\n }\r\n mesh.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.scaling);\r\n if (parsedMesh.localMatrix) {\r\n mesh.setPreTransformMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromArray(parsedMesh.localMatrix));\r\n }\r\n else if (parsedMesh.pivotMatrix) {\r\n mesh.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromArray(parsedMesh.pivotMatrix));\r\n }\r\n mesh.setEnabled(parsedMesh.isEnabled);\r\n mesh.isVisible = parsedMesh.isVisible;\r\n mesh.infiniteDistance = parsedMesh.infiniteDistance;\r\n mesh.showBoundingBox = parsedMesh.showBoundingBox;\r\n mesh.showSubMeshesBoundingBox = parsedMesh.showSubMeshesBoundingBox;\r\n if (parsedMesh.applyFog !== undefined) {\r\n mesh.applyFog = parsedMesh.applyFog;\r\n }\r\n if (parsedMesh.pickable !== undefined) {\r\n mesh.isPickable = parsedMesh.pickable;\r\n }\r\n if (parsedMesh.alphaIndex !== undefined) {\r\n mesh.alphaIndex = parsedMesh.alphaIndex;\r\n }\r\n mesh.receiveShadows = parsedMesh.receiveShadows;\r\n mesh.billboardMode = parsedMesh.billboardMode;\r\n if (parsedMesh.visibility !== undefined) {\r\n mesh.visibility = parsedMesh.visibility;\r\n }\r\n mesh.checkCollisions = parsedMesh.checkCollisions;\r\n if (parsedMesh.isBlocker !== undefined) {\r\n mesh.isBlocker = parsedMesh.isBlocker;\r\n }\r\n mesh._shouldGenerateFlatShading = parsedMesh.useFlatShading;\r\n // freezeWorldMatrix\r\n if (parsedMesh.freezeWorldMatrix) {\r\n mesh._waitingData.freezeWorldMatrix = parsedMesh.freezeWorldMatrix;\r\n }\r\n // Parent\r\n if (parsedMesh.parentId) {\r\n mesh._waitingParentId = parsedMesh.parentId;\r\n }\r\n // Actions\r\n if (parsedMesh.actions !== undefined) {\r\n mesh._waitingData.actions = parsedMesh.actions;\r\n }\r\n // Overlay\r\n if (parsedMesh.overlayAlpha !== undefined) {\r\n mesh.overlayAlpha = parsedMesh.overlayAlpha;\r\n }\r\n if (parsedMesh.overlayColor !== undefined) {\r\n mesh.overlayColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__[\"Color3\"].FromArray(parsedMesh.overlayColor);\r\n }\r\n if (parsedMesh.renderOverlay !== undefined) {\r\n mesh.renderOverlay = parsedMesh.renderOverlay;\r\n }\r\n // Geometry\r\n mesh.isUnIndexed = !!parsedMesh.isUnIndexed;\r\n mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;\r\n if (parsedMesh.delayLoadingFile) {\r\n mesh.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_17__[\"Constants\"].DELAYLOADSTATE_NOTLOADED;\r\n mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_13__[\"BoundingInfo\"](_Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.boundingBoxMinimum), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedMesh.boundingBoxMaximum));\r\n if (parsedMesh._binaryInfo) {\r\n mesh._binaryInfo = parsedMesh._binaryInfo;\r\n }\r\n mesh._delayInfo = [];\r\n if (parsedMesh.hasUVs) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (parsedMesh.hasUVs2) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n if (parsedMesh.hasUVs3) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV3Kind);\r\n }\r\n if (parsedMesh.hasUVs4) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV4Kind);\r\n }\r\n if (parsedMesh.hasUVs5) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV5Kind);\r\n }\r\n if (parsedMesh.hasUVs6) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].UV6Kind);\r\n }\r\n if (parsedMesh.hasColors) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].ColorKind);\r\n }\r\n if (parsedMesh.hasMatricesIndices) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind);\r\n }\r\n if (parsedMesh.hasMatricesWeights) {\r\n mesh._delayInfo.push(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n }\r\n mesh._delayLoadingFunction = _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"]._ImportGeometry;\r\n if (_Loading_sceneLoaderFlags__WEBPACK_IMPORTED_MODULE_16__[\"SceneLoaderFlags\"].ForceFullSceneLoadingForIncremental) {\r\n mesh._checkDelayState();\r\n }\r\n }\r\n else {\r\n _geometry__WEBPACK_IMPORTED_MODULE_10__[\"Geometry\"]._ImportGeometry(parsedMesh, mesh);\r\n }\r\n // Material\r\n if (parsedMesh.materialId) {\r\n mesh.setMaterialByID(parsedMesh.materialId);\r\n }\r\n else {\r\n mesh.material = null;\r\n }\r\n // Morph targets\r\n if (parsedMesh.morphTargetManagerId > -1) {\r\n mesh.morphTargetManager = scene.getMorphTargetManagerById(parsedMesh.morphTargetManagerId);\r\n }\r\n // Skeleton\r\n if (parsedMesh.skeletonId > -1) {\r\n mesh.skeleton = scene.getLastSkeletonByID(parsedMesh.skeletonId);\r\n if (parsedMesh.numBoneInfluencers) {\r\n mesh.numBoneInfluencers = parsedMesh.numBoneInfluencers;\r\n }\r\n }\r\n // Animations\r\n if (parsedMesh.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedMesh.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedMesh.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_20__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n mesh.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].ParseAnimationRanges(mesh, parsedMesh, scene);\r\n }\r\n if (parsedMesh.autoAnimate) {\r\n scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);\r\n }\r\n // Layer Mask\r\n if (parsedMesh.layerMask && (!isNaN(parsedMesh.layerMask))) {\r\n mesh.layerMask = Math.abs(parseInt(parsedMesh.layerMask));\r\n }\r\n else {\r\n mesh.layerMask = 0x0FFFFFFF;\r\n }\r\n // Physics\r\n if (parsedMesh.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, mesh, parsedMesh);\r\n }\r\n // Levels\r\n if (parsedMesh.lodMeshIds) {\r\n mesh._waitingData.lods = {\r\n ids: parsedMesh.lodMeshIds,\r\n distances: (parsedMesh.lodDistances) ? parsedMesh.lodDistances : null,\r\n coverages: (parsedMesh.lodCoverages) ? parsedMesh.lodCoverages : null\r\n };\r\n }\r\n // Instances\r\n if (parsedMesh.instances) {\r\n for (var index = 0; index < parsedMesh.instances.length; index++) {\r\n var parsedInstance = parsedMesh.instances[index];\r\n var instance = mesh.createInstance(parsedInstance.name);\r\n if (parsedInstance.id) {\r\n instance.id = parsedInstance.id;\r\n }\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"]) {\r\n if (parsedInstance.tags) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(instance, parsedInstance.tags);\r\n }\r\n else {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_4__[\"Tags\"].AddTagsTo(instance, parsedMesh.tags);\r\n }\r\n }\r\n instance.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedInstance.position);\r\n if (parsedInstance.metadata !== undefined) {\r\n instance.metadata = parsedInstance.metadata;\r\n }\r\n if (parsedInstance.parentId) {\r\n instance._waitingParentId = parsedInstance.parentId;\r\n }\r\n if (parsedInstance.rotationQuaternion) {\r\n instance.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Quaternion\"].FromArray(parsedInstance.rotationQuaternion);\r\n }\r\n else if (parsedInstance.rotation) {\r\n instance.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedInstance.rotation);\r\n }\r\n instance.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].FromArray(parsedInstance.scaling);\r\n if (parsedInstance.checkCollisions != undefined && parsedInstance.checkCollisions != null) {\r\n instance.checkCollisions = parsedInstance.checkCollisions;\r\n }\r\n if (parsedInstance.pickable != undefined && parsedInstance.pickable != null) {\r\n instance.isPickable = parsedInstance.pickable;\r\n }\r\n if (parsedInstance.showBoundingBox != undefined && parsedInstance.showBoundingBox != null) {\r\n instance.showBoundingBox = parsedInstance.showBoundingBox;\r\n }\r\n if (parsedInstance.showSubMeshesBoundingBox != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.showSubMeshesBoundingBox = parsedInstance.showSubMeshesBoundingBox;\r\n }\r\n if (parsedInstance.alphaIndex != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.alphaIndex = parsedInstance.alphaIndex;\r\n }\r\n // Physics\r\n if (parsedInstance.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, instance, parsedInstance);\r\n }\r\n // Animation\r\n if (parsedInstance.animations) {\r\n for (animationIndex = 0; animationIndex < parsedInstance.animations.length; animationIndex++) {\r\n parsedAnimation = parsedInstance.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_20__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n instance.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n _node__WEBPACK_IMPORTED_MODULE_7__[\"Node\"].ParseAnimationRanges(instance, parsedInstance, scene);\r\n if (parsedInstance.autoAnimate) {\r\n scene.beginAnimation(instance, parsedInstance.autoAnimateFrom, parsedInstance.autoAnimateTo, parsedInstance.autoAnimateLoop, parsedInstance.autoAnimateSpeed || 1.0);\r\n }\r\n }\r\n }\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Creates a ribbon mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\r\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\r\n * @param closePath creates a seam between the first and the last points of each path of the path array\r\n * @param offset is taken in account only if the `pathArray` is containing a single path\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateRibbon = function (name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the radius size (float) of the polygon (default 0.5)\r\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDisc = function (name, radius, tessellation, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a box mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of each box side (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateHemisphere = function (name, segments, diameter, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\r\n * @param diameterTop set the top cap diameter (floats, default 1)\r\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\r\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\r\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n // Torus (Code from SharpDX.org)\r\n /**\r\n * Creates a torus mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param diameter sets the diameter size (float) of the torus (default 1)\r\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param tessellation sets the number of torus sides (postive integer, default 16)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a torus knot mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the global radius size (float) of the torus knot (default 2)\r\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\r\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * @param p the number of windings on X axis (positive integers, default 2)\r\n * @param q the number of windings on Y axis (positive integers, default 3)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorusKnot = function (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a line mesh. Please consider using the same method from the MeshBuilder class instead.\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a dashed line mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\r\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\r\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\r\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * Remember you can only change the shape positions, not their number when updating a polygon.\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolygon = function (name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction. Please consider using the same method from the MeshBuilder class instead.\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param depth defines the height of extrusion\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudePolygon = function (name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded shape mesh.\r\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters. Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scale is the value to scale the shape\r\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShape = function (name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scaleFunction is a custom Javascript function called on each path point\r\n * @param rotationFunction is a custom Javascript function called on each path point\r\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShapeCustom = function (name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * @param radius is the radius value of the lathe\r\n * @param tessellation is the side number of the lathe.\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLathe = function (name, shape, radius, tessellation, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of both sides of the plane at once (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param width set the width of the ground\r\n * @param height set the height of the ground\r\n * @param subdivisions sets the number of subdivisions per side\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGround = function (name, width, height, subdivisions, scene, updatable) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tiled ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param xmin set the ground minimum X coordinate\r\n * @param zmin set the ground minimum Y coordinate\r\n * @param xmax set the ground maximum X coordinate\r\n * @param zmax set the ground maximum Z coordinate\r\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTiledGround = function (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh from a height map.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/babylon101/height_map\r\n * @param name defines the name of the mesh to create\r\n * @param url sets the URL of the height map image resource\r\n * @param width set the ground width size\r\n * @param height set the ground height size\r\n * @param subdivisions sets the number of subdivision per side\r\n * @param minHeight is the minimum altitude on the ground\r\n * @param maxHeight is the maximum altitude on the ground\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\r\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see http://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * @param radius sets the tube radius size\r\n * @param tessellation is the number of sides on the tubular surface\r\n * @param radiusFunction is a custom function. If it is not null, it overwrittes the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (http://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polyhedron mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh to create\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolyhedron = function (name, options, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : http://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @see http://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n Mesh.CreateIcoSphere = function (name, options, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a decal mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh receiving the decal\r\n * @param position sets the position of the decal in world coordinates\r\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\r\n * @param size sets the decal scaling\r\n * @param angle sets the angle to rotate the decal\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDecal = function (name, sourceMesh, position, normal, size, angle) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"MeshBuilder\");\r\n };\r\n // Skeletons\r\n /**\r\n * Prepare internal position array for software CPU skinning\r\n * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh\r\n */\r\n Mesh.prototype.setPositionsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var source = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!source) {\r\n return internalDataInfo._sourcePositions;\r\n }\r\n internalDataInfo._sourcePositions = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)) {\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourcePositions;\r\n };\r\n /**\r\n * Prepare internal normal array for software CPU skinning\r\n * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.\r\n */\r\n Mesh.prototype.setNormalsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourceNormals) {\r\n var source = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n if (!source) {\r\n return internalDataInfo._sourceNormals;\r\n }\r\n internalDataInfo._sourceNormals = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)) {\r\n this.setVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourceNormals;\r\n };\r\n /**\r\n * Updates the vertex buffer by applying transformation from the bones\r\n * @param skeleton defines the skeleton to apply to current mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.applySkeleton = function (skeleton) {\r\n if (!this.geometry) {\r\n return this;\r\n }\r\n if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) {\r\n return this;\r\n }\r\n this.geometry._softwareSkinningFrameId = this.getScene().getFrameId();\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n return this;\r\n }\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var submeshes = this.subMeshes.slice();\r\n this.setPositionsForCPUSkinning();\r\n this.subMeshes = submeshes;\r\n }\r\n if (!internalDataInfo._sourceNormals) {\r\n this.setNormalsForCPUSkinning();\r\n }\r\n // positionsData checks for not being Float32Array will only pass at most once\r\n var positionsData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind);\r\n if (!positionsData) {\r\n return this;\r\n }\r\n if (!(positionsData instanceof Float32Array)) {\r\n positionsData = new Float32Array(positionsData);\r\n }\r\n // normalsData checks for not being Float32Array will only pass at most once\r\n var normalsData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind);\r\n if (!normalsData) {\r\n return this;\r\n }\r\n if (!(normalsData instanceof Float32Array)) {\r\n normalsData = new Float32Array(normalsData);\r\n }\r\n var matricesIndicesData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (!matricesWeightsData || !matricesIndicesData) {\r\n return this;\r\n }\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].MatricesWeightsExtraKind) : null;\r\n var skeletonMatrices = skeleton.getTransformMatrices(this);\r\n var tempVector3 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero();\r\n var finalMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]();\r\n var tempMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"]();\r\n var matWeightIdx = 0;\r\n var inf;\r\n for (var index = 0; index < positionsData.length; index += 3, matWeightIdx += 4) {\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Matrix\"].FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(internalDataInfo._sourcePositions[index], internalDataInfo._sourcePositions[index + 1], internalDataInfo._sourcePositions[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(positionsData, index);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].TransformNormalFromFloatsToRef(internalDataInfo._sourceNormals[index], internalDataInfo._sourceNormals[index + 1], internalDataInfo._sourceNormals[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(normalsData, index);\r\n finalMatrix.reset();\r\n }\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].PositionKind, positionsData);\r\n this.updateVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_8__[\"VertexBuffer\"].NormalKind, normalsData);\r\n return this;\r\n };\r\n // Tools\r\n /**\r\n * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates\r\n * @param meshes defines the list of meshes to scan\r\n * @returns an object `{min:` Vector3`, max:` Vector3`}`\r\n */\r\n Mesh.MinMax = function (meshes) {\r\n var minVector = null;\r\n var maxVector = null;\r\n meshes.forEach(function (mesh) {\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n if (!minVector || !maxVector) {\r\n minVector = boundingBox.minimumWorld;\r\n maxVector = boundingBox.maximumWorld;\r\n }\r\n else {\r\n minVector.minimizeInPlace(boundingBox.minimumWorld);\r\n maxVector.maximizeInPlace(boundingBox.maximumWorld);\r\n }\r\n });\r\n if (!minVector || !maxVector) {\r\n return {\r\n min: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero(),\r\n max: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Zero()\r\n };\r\n }\r\n return {\r\n min: minVector,\r\n max: maxVector\r\n };\r\n };\r\n /**\r\n * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array\r\n * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object\r\n * @returns a vector3\r\n */\r\n Mesh.Center = function (meshesOrMinMaxVector) {\r\n var minMaxVector = (meshesOrMinMaxVector instanceof Array) ? Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"].Center(minMaxVector.min, minMaxVector.max);\r\n };\r\n /**\r\n * Merge the array of meshes into a single mesh for performance reasons.\r\n * @param meshes defines he vertices source. They should all be of the same material. Entries can empty\r\n * @param disposeSource when true (default), dispose of the vertices from the source meshes\r\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true\r\n * @param meshSubclass when set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.\r\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh to his subMesh array with meshes source.\r\n * @param multiMultiMaterials when true (false default), subdivide mesh and accept multiple multi materials, ignores subdivideWithSubMeshes.\r\n * @returns a new mesh\r\n */\r\n Mesh.MergeMeshes = function (meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\r\n if (disposeSource === void 0) { disposeSource = true; }\r\n var index;\r\n if (!allow32BitsIndices) {\r\n var totalVertices = 0;\r\n // Counting vertices\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n totalVertices += meshes[index].getTotalVertices();\r\n if (totalVertices >= 65536) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\");\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n var newMultiMaterial = null;\r\n var subIndex;\r\n var matIndex;\r\n subdivideWithSubMeshes = false;\r\n }\r\n var materialArray = new Array();\r\n var materialIndexArray = new Array();\r\n // Merge\r\n var vertexData = null;\r\n var otherVertexData;\r\n var indiceArray = new Array();\r\n var source = null;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n var mesh = meshes[index];\r\n if (mesh.isAnInstance) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_19__[\"Logger\"].Warn(\"Cannot merge instance meshes.\");\r\n return null;\r\n }\r\n var wm = mesh.computeWorldMatrix(true);\r\n otherVertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].ExtractFromMesh(mesh, true, true);\r\n otherVertexData.transform(wm);\r\n if (vertexData) {\r\n vertexData.merge(otherVertexData, allow32BitsIndices);\r\n }\r\n else {\r\n vertexData = otherVertexData;\r\n source = mesh;\r\n }\r\n if (subdivideWithSubMeshes) {\r\n indiceArray.push(mesh.getTotalIndices());\r\n }\r\n if (multiMultiMaterials) {\r\n if (mesh.material) {\r\n var material = mesh.material;\r\n if (material instanceof _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_15__[\"MultiMaterial\"]) {\r\n for (matIndex = 0; matIndex < material.subMaterials.length; matIndex++) {\r\n if (materialArray.indexOf(material.subMaterials[matIndex]) < 0) {\r\n materialArray.push(material.subMaterials[matIndex]);\r\n }\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material.subMaterials[mesh.subMeshes[subIndex].materialIndex]));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n else {\r\n if (materialArray.indexOf(material) < 0) {\r\n materialArray.push(material);\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n else {\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(0);\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n source = source;\r\n if (!meshSubclass) {\r\n meshSubclass = new Mesh(source.name + \"_merged\", source.getScene());\r\n }\r\n vertexData.applyToMesh(meshSubclass);\r\n // Setting properties\r\n meshSubclass.checkCollisions = source.checkCollisions;\r\n // Cleaning\r\n if (disposeSource) {\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n meshes[index].dispose();\r\n }\r\n }\r\n }\r\n // Subdivide\r\n if (subdivideWithSubMeshes || multiMultiMaterials) {\r\n //-- removal of global submesh\r\n meshSubclass.releaseSubMeshes();\r\n index = 0;\r\n var offset = 0;\r\n //-- apply subdivision according to index table\r\n while (index < indiceArray.length) {\r\n _subMesh__WEBPACK_IMPORTED_MODULE_12__[\"SubMesh\"].CreateFromIndices(0, offset, indiceArray[index], meshSubclass);\r\n offset += indiceArray[index];\r\n index++;\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n newMultiMaterial = new _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_15__[\"MultiMaterial\"](source.name + \"_merged\", source.getScene());\r\n newMultiMaterial.subMaterials = materialArray;\r\n for (subIndex = 0; subIndex < meshSubclass.subMeshes.length; subIndex++) {\r\n meshSubclass.subMeshes[subIndex].materialIndex = materialIndexArray[subIndex];\r\n }\r\n meshSubclass.material = newMultiMaterial;\r\n }\r\n else {\r\n meshSubclass.material = source.material;\r\n }\r\n return meshSubclass;\r\n };\r\n /** @hidden */\r\n Mesh.prototype.addInstance = function (instance) {\r\n instance._indexInSourceMeshInstanceArray = this.instances.length;\r\n this.instances.push(instance);\r\n };\r\n /** @hidden */\r\n Mesh.prototype.removeInstance = function (instance) {\r\n // Remove from mesh\r\n var index = instance._indexInSourceMeshInstanceArray;\r\n if (index != -1) {\r\n if (index !== this.instances.length - 1) {\r\n var last = this.instances[this.instances.length - 1];\r\n this.instances[index] = last;\r\n last._indexInSourceMeshInstanceArray = index;\r\n }\r\n instance._indexInSourceMeshInstanceArray = -1;\r\n this.instances.pop();\r\n }\r\n };\r\n // Consts\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n Mesh.FRONTSIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].FRONTSIDE;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n Mesh.BACKSIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].BACKSIDE;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n Mesh.DOUBLESIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].DOUBLESIDE;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n Mesh.DEFAULTSIDE = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_9__[\"VertexData\"].DEFAULTSIDE;\r\n /**\r\n * Mesh cap setting : no cap\r\n */\r\n Mesh.NO_CAP = 0;\r\n /**\r\n * Mesh cap setting : one cap at the beginning of the mesh\r\n */\r\n Mesh.CAP_START = 1;\r\n /**\r\n * Mesh cap setting : one cap at the end of the mesh\r\n */\r\n Mesh.CAP_END = 2;\r\n /**\r\n * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh\r\n */\r\n Mesh.CAP_ALL = 3;\r\n /**\r\n * Mesh pattern setting : no flip or rotate\r\n */\r\n Mesh.NO_FLIP = 0;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_TILE = 1;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column\r\n */\r\n Mesh.ROTATE_TILE = 2;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows\r\n */\r\n Mesh.FLIP_ROW = 3;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) all tiles on alternate rows\r\n */\r\n Mesh.ROTATE_ROW = 4;\r\n /**\r\n * Mesh pattern setting : flip and rotate alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_N_ROTATE_TILE = 5;\r\n /**\r\n * Mesh pattern setting : rotate pattern and rotate\r\n */\r\n Mesh.FLIP_N_ROTATE_ROW = 6;\r\n /**\r\n * Mesh tile positioning : part tiles same on left/right or top/bottom\r\n */\r\n Mesh.CENTER = 0;\r\n /**\r\n * Mesh tile positioning : part tiles on left\r\n */\r\n Mesh.LEFT = 1;\r\n /**\r\n * Mesh tile positioning : part tiles on right\r\n */\r\n Mesh.RIGHT = 2;\r\n /**\r\n * Mesh tile positioning : part tiles on top\r\n */\r\n Mesh.TOP = 3;\r\n /**\r\n * Mesh tile positioning : part tiles on bottom\r\n */\r\n Mesh.BOTTOM = 4;\r\n // Statics\r\n /** @hidden */\r\n Mesh._GroundMeshParser = function (parsedMesh, scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_21__[\"_DevTools\"].WarnImport(\"GroundMesh\");\r\n };\r\n return Mesh;\r\n}(_abstractMesh__WEBPACK_IMPORTED_MODULE_11__[\"AbstractMesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/mesh.vertexData.ts\":\n/*!***********************************!*\\\n !*** ./Meshes/mesh.vertexData.ts ***!\n \\***********************************/\n/*! exports provided: VertexData */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return VertexData; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This class contains the various kinds of data on every vertex of a mesh used in determining its shape and appearance\r\n */\r\nvar VertexData = /** @class */ (function () {\r\n function VertexData() {\r\n }\r\n /**\r\n * Uses the passed data array to set the set the values for the specified kind of data\r\n * @param data a linear array of floating numbers\r\n * @param kind the type of data that is being set, eg positions, colors etc\r\n */\r\n VertexData.prototype.set = function (data, kind) {\r\n switch (kind) {\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind:\r\n this.positions = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind:\r\n this.normals = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind:\r\n this.tangents = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind:\r\n this.uvs = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind:\r\n this.uvs2 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind:\r\n this.uvs3 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind:\r\n this.uvs4 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind:\r\n this.uvs5 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind:\r\n this.uvs6 = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind:\r\n this.colors = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind:\r\n this.matricesIndices = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind:\r\n this.matricesWeights = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind:\r\n this.matricesIndicesExtra = data;\r\n break;\r\n case _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind:\r\n this.matricesWeightsExtra = data;\r\n break;\r\n }\r\n };\r\n /**\r\n * Associates the vertexData to the passed Mesh.\r\n * Sets it as updatable or not (default `false`)\r\n * @param mesh the mesh the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.applyToMesh = function (mesh, updatable) {\r\n this._applyTo(mesh, updatable);\r\n return this;\r\n };\r\n /**\r\n * Associates the vertexData to the passed Geometry.\r\n * Sets it as updatable or not (default `false`)\r\n * @param geometry the geometry the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.applyToGeometry = function (geometry, updatable) {\r\n this._applyTo(geometry, updatable);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated mesh\r\n * @param mesh the mesh to be updated\r\n * @param updateExtends when true the mesh BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.updateMesh = function (mesh) {\r\n this._update(mesh);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated geometry\r\n * @param geometry the geometry to be updated\r\n * @param updateExtends when true BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData.\r\n */\r\n VertexData.prototype.updateGeometry = function (geometry) {\r\n this._update(geometry);\r\n return this;\r\n };\r\n VertexData.prototype._applyTo = function (meshOrGeometry, updatable) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (this.positions) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, this.positions, updatable);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, this.normals, updatable);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, this.tangents, updatable);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, this.uvs, updatable);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, this.uvs2, updatable);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, this.uvs3, updatable);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, this.uvs4, updatable);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, this.uvs5, updatable);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, this.uvs6, updatable);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, this.colors, updatable);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, this.matricesIndices, updatable);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, this.matricesWeights, updatable);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, this.matricesIndicesExtra, updatable);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, this.matricesWeightsExtra, updatable);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null, updatable);\r\n }\r\n else {\r\n meshOrGeometry.setIndices([], null);\r\n }\r\n return this;\r\n };\r\n VertexData.prototype._update = function (meshOrGeometry, updateExtends, makeItUnique) {\r\n if (this.positions) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, this.positions, updateExtends, makeItUnique);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, this.normals, updateExtends, makeItUnique);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, this.tangents, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, this.uvs, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, this.uvs2, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, this.uvs3, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, this.uvs4, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, this.uvs5, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, this.uvs6, updateExtends, makeItUnique);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, this.colors, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, this.matricesIndices, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, this.matricesWeights, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, this.matricesIndicesExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, this.matricesWeightsExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Transforms each position and each normal of the vertexData according to the passed Matrix\r\n * @param matrix the transforming matrix\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.transform = function (matrix) {\r\n var flip = matrix.m[0] * matrix.m[5] * matrix.m[10] < 0;\r\n var transformed = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var index;\r\n if (this.positions) {\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n for (index = 0; index < this.positions.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(this.positions, index, position);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(position, matrix, transformed);\r\n this.positions[index] = transformed.x;\r\n this.positions[index + 1] = transformed.y;\r\n this.positions[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.normals) {\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n for (index = 0; index < this.normals.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArrayToRef(this.normals, index, normal);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalToRef(normal, matrix, transformed);\r\n this.normals[index] = transformed.x;\r\n this.normals[index + 1] = transformed.y;\r\n this.normals[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.tangents) {\r\n var tangent = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].Zero();\r\n var tangentTransformed = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].Zero();\r\n for (index = 0; index < this.tangents.length; index += 4) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].FromArrayToRef(this.tangents, index, tangent);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"].TransformNormalToRef(tangent, matrix, tangentTransformed);\r\n this.tangents[index] = tangentTransformed.x;\r\n this.tangents[index + 1] = tangentTransformed.y;\r\n this.tangents[index + 2] = tangentTransformed.z;\r\n this.tangents[index + 3] = tangentTransformed.w;\r\n }\r\n }\r\n if (flip && this.indices) {\r\n for (index = 0; index < this.indices.length; index += 3) {\r\n var tmp = this.indices[index + 1];\r\n this.indices[index + 1] = this.indices[index + 2];\r\n this.indices[index + 2] = tmp;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Merges the passed VertexData into the current one\r\n * @param other the VertexData to be merged into the current one\r\n * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array\r\n * @returns the modified VertexData\r\n */\r\n VertexData.prototype.merge = function (other, use32BitsIndices) {\r\n if (use32BitsIndices === void 0) { use32BitsIndices = false; }\r\n this._validate();\r\n other._validate();\r\n if (!this.normals !== !other.normals ||\r\n !this.tangents !== !other.tangents ||\r\n !this.uvs !== !other.uvs ||\r\n !this.uvs2 !== !other.uvs2 ||\r\n !this.uvs3 !== !other.uvs3 ||\r\n !this.uvs4 !== !other.uvs4 ||\r\n !this.uvs5 !== !other.uvs5 ||\r\n !this.uvs6 !== !other.uvs6 ||\r\n !this.colors !== !other.colors ||\r\n !this.matricesIndices !== !other.matricesIndices ||\r\n !this.matricesWeights !== !other.matricesWeights ||\r\n !this.matricesIndicesExtra !== !other.matricesIndicesExtra ||\r\n !this.matricesWeightsExtra !== !other.matricesWeightsExtra) {\r\n throw new Error(\"Cannot merge vertex data that do not have the same set of attributes\");\r\n }\r\n if (other.indices) {\r\n if (!this.indices) {\r\n this.indices = [];\r\n }\r\n var offset = this.positions ? this.positions.length / 3 : 0;\r\n var isSrcTypedArray = this.indices.BYTES_PER_ELEMENT !== undefined;\r\n if (isSrcTypedArray) {\r\n var len = this.indices.length + other.indices.length;\r\n var temp = use32BitsIndices || this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);\r\n temp.set(this.indices);\r\n var decal = this.indices.length;\r\n for (var index = 0; index < other.indices.length; index++) {\r\n temp[decal + index] = other.indices[index] + offset;\r\n }\r\n this.indices = temp;\r\n }\r\n else {\r\n for (var index = 0; index < other.indices.length; index++) {\r\n this.indices.push(other.indices[index] + offset);\r\n }\r\n }\r\n }\r\n this.positions = this._mergeElement(this.positions, other.positions);\r\n this.normals = this._mergeElement(this.normals, other.normals);\r\n this.tangents = this._mergeElement(this.tangents, other.tangents);\r\n this.uvs = this._mergeElement(this.uvs, other.uvs);\r\n this.uvs2 = this._mergeElement(this.uvs2, other.uvs2);\r\n this.uvs3 = this._mergeElement(this.uvs3, other.uvs3);\r\n this.uvs4 = this._mergeElement(this.uvs4, other.uvs4);\r\n this.uvs5 = this._mergeElement(this.uvs5, other.uvs5);\r\n this.uvs6 = this._mergeElement(this.uvs6, other.uvs6);\r\n this.colors = this._mergeElement(this.colors, other.colors);\r\n this.matricesIndices = this._mergeElement(this.matricesIndices, other.matricesIndices);\r\n this.matricesWeights = this._mergeElement(this.matricesWeights, other.matricesWeights);\r\n this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, other.matricesIndicesExtra);\r\n this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, other.matricesWeightsExtra);\r\n return this;\r\n };\r\n VertexData.prototype._mergeElement = function (source, other) {\r\n if (!source) {\r\n return other;\r\n }\r\n if (!other) {\r\n return source;\r\n }\r\n var len = other.length + source.length;\r\n var isSrcTypedArray = source instanceof Float32Array;\r\n var isOthTypedArray = other instanceof Float32Array;\r\n // use non-loop method when the source is Float32Array\r\n if (isSrcTypedArray) {\r\n var ret32 = new Float32Array(len);\r\n ret32.set(source);\r\n ret32.set(other, source.length);\r\n return ret32;\r\n // source is number[], when other is also use concat\r\n }\r\n else if (!isOthTypedArray) {\r\n return source.concat(other);\r\n // source is a number[], but other is a Float32Array, loop required\r\n }\r\n else {\r\n var ret = source.slice(0); // copy source to a separate array\r\n for (var i = 0, len = other.length; i < len; i++) {\r\n ret.push(other[i]);\r\n }\r\n return ret;\r\n }\r\n };\r\n VertexData.prototype._validate = function () {\r\n if (!this.positions) {\r\n throw new Error(\"Positions are required\");\r\n }\r\n var getElementCount = function (kind, values) {\r\n var stride = _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].DeduceStride(kind);\r\n if ((values.length % stride) !== 0) {\r\n throw new Error(\"The \" + kind + \"s array count must be a multiple of \" + stride);\r\n }\r\n return values.length / stride;\r\n };\r\n var positionsElementCount = getElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, this.positions);\r\n var validateElementCount = function (kind, values) {\r\n var elementCount = getElementCount(kind, values);\r\n if (elementCount !== positionsElementCount) {\r\n throw new Error(\"The \" + kind + \"s element count (\" + elementCount + \") does not match the positions count (\" + positionsElementCount + \")\");\r\n }\r\n };\r\n if (this.normals) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, this.normals);\r\n }\r\n if (this.tangents) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, this.tangents);\r\n }\r\n if (this.uvs) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, this.uvs);\r\n }\r\n if (this.uvs2) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, this.uvs2);\r\n }\r\n if (this.uvs3) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, this.uvs3);\r\n }\r\n if (this.uvs4) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, this.uvs4);\r\n }\r\n if (this.uvs5) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, this.uvs5);\r\n }\r\n if (this.uvs6) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, this.uvs6);\r\n }\r\n if (this.colors) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, this.colors);\r\n }\r\n if (this.matricesIndices) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, this.matricesIndices);\r\n }\r\n if (this.matricesWeights) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, this.matricesWeights);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, this.matricesIndicesExtra);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n validateElementCount(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, this.matricesWeightsExtra);\r\n }\r\n };\r\n /**\r\n * Serializes the VertexData\r\n * @returns a serialized object\r\n */\r\n VertexData.prototype.serialize = function () {\r\n var serializationObject = this.serialize();\r\n if (this.positions) {\r\n serializationObject.positions = this.positions;\r\n }\r\n if (this.normals) {\r\n serializationObject.normals = this.normals;\r\n }\r\n if (this.tangents) {\r\n serializationObject.tangents = this.tangents;\r\n }\r\n if (this.uvs) {\r\n serializationObject.uvs = this.uvs;\r\n }\r\n if (this.uvs2) {\r\n serializationObject.uvs2 = this.uvs2;\r\n }\r\n if (this.uvs3) {\r\n serializationObject.uvs3 = this.uvs3;\r\n }\r\n if (this.uvs4) {\r\n serializationObject.uvs4 = this.uvs4;\r\n }\r\n if (this.uvs5) {\r\n serializationObject.uvs5 = this.uvs5;\r\n }\r\n if (this.uvs6) {\r\n serializationObject.uvs6 = this.uvs6;\r\n }\r\n if (this.colors) {\r\n serializationObject.colors = this.colors;\r\n }\r\n if (this.matricesIndices) {\r\n serializationObject.matricesIndices = this.matricesIndices;\r\n serializationObject.matricesIndices._isExpanded = true;\r\n }\r\n if (this.matricesWeights) {\r\n serializationObject.matricesWeights = this.matricesWeights;\r\n }\r\n if (this.matricesIndicesExtra) {\r\n serializationObject.matricesIndicesExtra = this.matricesIndicesExtra;\r\n serializationObject.matricesIndicesExtra._isExpanded = true;\r\n }\r\n if (this.matricesWeightsExtra) {\r\n serializationObject.matricesWeightsExtra = this.matricesWeightsExtra;\r\n }\r\n serializationObject.indices = this.indices;\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts the vertexData from a mesh\r\n * @param mesh the mesh from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromMesh = function (mesh, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(mesh, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Extracts the vertexData from the geometry\r\n * @param geometry the geometry from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when the geometrty is shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromGeometry = function (geometry, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(geometry, copyWhenShared, forceCopy);\r\n };\r\n VertexData._ExtractFrom = function (meshOrGeometry, copyWhenShared, forceCopy) {\r\n var result = new VertexData();\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind)) {\r\n result.positions = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind)) {\r\n result.normals = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind)) {\r\n result.tangents = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n result.uvs = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind)) {\r\n result.uvs2 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind)) {\r\n result.uvs3 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind)) {\r\n result.uvs4 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind)) {\r\n result.uvs5 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind)) {\r\n result.uvs6 = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind)) {\r\n result.colors = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind)) {\r\n result.matricesIndices = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind)) {\r\n result.matricesWeights = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind)) {\r\n result.matricesIndicesExtra = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind)) {\r\n result.matricesWeightsExtra = meshOrGeometry.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind, copyWhenShared, forceCopy);\r\n }\r\n result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);\r\n return result;\r\n };\r\n /**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @returns the VertexData of the ribbon\r\n */\r\n VertexData.CreateRibbon = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"ribbonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * size sets the width, height and depth of the box to the value of size, optional default 1\r\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\r\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateBox = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"boxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * faceTiles sets the pattern, tile size and number of tiles for a face\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateTiledBox = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"tiledBoxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled plane\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * pattern a limited pattern arrangement depending on the number\r\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\r\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\r\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the tiled plane\r\n */\r\n VertexData.CreateTiledPlane = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"tiledPlaneBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an ellipsoid, defaults to a sphere\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * segments sets the number of horizontal strips optional, default 32\r\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\r\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\r\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\r\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\r\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\r\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the ellipsoid\r\n */\r\n VertexData.CreateSphere = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"sphereBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\n VertexData.CreateCylinder = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"cylinderBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a torus\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * diameter the diameter of the torus, optional default 1\r\n * * thickness the diameter of the tube forming the torus, optional default 0.5\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the torus\r\n */\r\n VertexData.CreateTorus = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"torusBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\n VertexData.CreateLineSystem = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\n VertexData.CreateDashedLines = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * - width the width (x direction) of the ground, optional, default 1\r\n * - height the height (z direction) of the ground, optional, default 1\r\n * - subdivisions the number of subdivisions per side, optional, default 1\r\n * @returns the VertexData of the Ground\r\n */\r\n VertexData.CreateGround = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * * xmin the ground minimum X coordinate, optional, default -1\r\n * * zmin the ground minimum Z coordinate, optional, default -1\r\n * * xmax the ground maximum X coordinate, optional, default 1\r\n * * zmax the ground maximum Z coordinate, optional, default 1\r\n * * subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * * precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @returns the VertexData of the TiledGround\r\n */\r\n VertexData.CreateTiledGround = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by MeshBuilder.CreateGroundFromHeightMap\r\n * * width the width (x direction) of the ground\r\n * * height the height (z direction) of the ground\r\n * * subdivisions the number of subdivisions per side\r\n * * minHeight the minimum altitude on the ground, optional, default 0\r\n * * maxHeight the maximum altitude on the ground, optional default 1\r\n * * colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * * buffer the array holding the image color data\r\n * * bufferWidth the width of image\r\n * * bufferHeight the height of image\r\n * * alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\n VertexData.CreateGroundFromHeightMap = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Plane\r\n * @param options an object used to set the following optional parameters for the plane, required but can be empty\r\n * * size sets the width and height of the plane to the value of size, optional default 1\r\n * * width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreatePlane = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"planeBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Disc or regular Polygon\r\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\r\n * * radius the radius of the disc, optional default 0.5\r\n * * tessellation the number of polygon sides, optional, default 64\r\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateDisc = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"discBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build()\r\n * All parameters are provided by MeshBuilder.CreatePolygon as needed\r\n * @param polygon a mesh built from polygonTriangulation.build()\r\n * @param sideOrientation takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @param fUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * @param fColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * @param frontUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * @param backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Polygon\r\n */\r\n VertexData.CreatePolygon = function (polygon, sideOrientation, fUV, fColors, frontUVs, backUVs) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"polygonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the IcoSphere\r\n * @param options an object used to set the following optional parameters for the IcoSphere, required but can be empty\r\n * * radius the radius of the IcoSphere, optional default 1\r\n * * radiusX allows stretching in the x direction, optional, default radius\r\n * * radiusY allows stretching in the y direction, optional, default radius\r\n * * radiusZ allows stretching in the z direction, optional, default radius\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the IcoSphere\r\n */\r\n VertexData.CreateIcoSphere = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"icoSphereBuilder\");\r\n };\r\n // inspired from // http://stemkoski.github.io/Three.js/Polyhedra.html\r\n /**\r\n * Creates the VertexData for a Polyhedron\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * type provided types are:\r\n * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\r\n * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\r\n * * size the size of the IcoSphere, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Polyhedron\r\n */\r\n VertexData.CreatePolyhedron = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"polyhedronBuilder\");\r\n };\r\n // based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n /**\r\n * Creates the VertexData for a TorusKnot\r\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\r\n * * radius the radius of the torus knot, optional, default 2\r\n * * tube the thickness of the tube, optional, default 0.5\r\n * * radialSegments the number of sides on each tube segments, optional, default 32\r\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\r\n * * p the number of windings around the z axis, optional, default 2\r\n * * q the number of windings around the x axis, optional, default 3\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Torus Knot\r\n */\r\n VertexData.CreateTorusKnot = function (options) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"torusKnotBuilder\");\r\n };\r\n // Tools\r\n /**\r\n * Compute normals for given positions and indices\r\n * @param positions an array of vertex positions, [...., x, y, z, ......]\r\n * @param indices an array of indices in groups of three for each triangular facet, [...., i, j, k, ......]\r\n * @param normals an array of vertex normals, [...., x, y, z, ......]\r\n * @param options an object used to set the following optional parameters for the TorusKnot, optional\r\n * * facetNormals : optional array of facet normals (vector3)\r\n * * facetPositions : optional array of facet positions (vector3)\r\n * * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation\r\n * * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation\r\n * * bInfo : optional bounding info, required for facetPartitioning computation\r\n * * bbSize : optional bounding box size data, required for facetPartitioning computation\r\n * * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation\r\n * * useRightHandedSystem: optional boolean to for right handed system computation\r\n * * depthSort : optional boolean to enable the facet depth sort computation\r\n * * distanceTo : optional Vector3 to compute the facet depth from this location\r\n * * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location\r\n */\r\n VertexData.ComputeNormals = function (positions, indices, normals, options) {\r\n // temporary scalar variables\r\n var index = 0; // facet index\r\n var p1p2x = 0.0; // p1p2 vector x coordinate\r\n var p1p2y = 0.0; // p1p2 vector y coordinate\r\n var p1p2z = 0.0; // p1p2 vector z coordinate\r\n var p3p2x = 0.0; // p3p2 vector x coordinate\r\n var p3p2y = 0.0; // p3p2 vector y coordinate\r\n var p3p2z = 0.0; // p3p2 vector z coordinate\r\n var faceNormalx = 0.0; // facet normal x coordinate\r\n var faceNormaly = 0.0; // facet normal y coordinate\r\n var faceNormalz = 0.0; // facet normal z coordinate\r\n var length = 0.0; // facet normal length before normalization\r\n var v1x = 0; // vector1 x index in the positions array\r\n var v1y = 0; // vector1 y index in the positions array\r\n var v1z = 0; // vector1 z index in the positions array\r\n var v2x = 0; // vector2 x index in the positions array\r\n var v2y = 0; // vector2 y index in the positions array\r\n var v2z = 0; // vector2 z index in the positions array\r\n var v3x = 0; // vector3 x index in the positions array\r\n var v3y = 0; // vector3 y index in the positions array\r\n var v3z = 0; // vector3 z index in the positions array\r\n var computeFacetNormals = false;\r\n var computeFacetPositions = false;\r\n var computeFacetPartitioning = false;\r\n var computeDepthSort = false;\r\n var faceNormalSign = 1;\r\n var ratio = 0;\r\n var distanceTo = null;\r\n if (options) {\r\n computeFacetNormals = (options.facetNormals) ? true : false;\r\n computeFacetPositions = (options.facetPositions) ? true : false;\r\n computeFacetPartitioning = (options.facetPartitioning) ? true : false;\r\n faceNormalSign = (options.useRightHandedSystem === true) ? -1 : 1;\r\n ratio = options.ratio || 0;\r\n computeDepthSort = (options.depthSort) ? true : false;\r\n distanceTo = (options.distanceTo);\r\n if (computeDepthSort) {\r\n if (distanceTo === undefined) {\r\n distanceTo = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n var depthSortedFacets = options.depthSortedFacets;\r\n }\r\n }\r\n // facetPartitioning reinit if needed\r\n var xSubRatio = 0;\r\n var ySubRatio = 0;\r\n var zSubRatio = 0;\r\n var subSq = 0;\r\n if (computeFacetPartitioning && options && options.bbSize) {\r\n var ox = 0; // X partitioning index for facet position\r\n var oy = 0; // Y partinioning index for facet position\r\n var oz = 0; // Z partinioning index for facet position\r\n var b1x = 0; // X partitioning index for facet v1 vertex\r\n var b1y = 0; // Y partitioning index for facet v1 vertex\r\n var b1z = 0; // z partitioning index for facet v1 vertex\r\n var b2x = 0; // X partitioning index for facet v2 vertex\r\n var b2y = 0; // Y partitioning index for facet v2 vertex\r\n var b2z = 0; // Z partitioning index for facet v2 vertex\r\n var b3x = 0; // X partitioning index for facet v3 vertex\r\n var b3y = 0; // Y partitioning index for facet v3 vertex\r\n var b3z = 0; // Z partitioning index for facet v3 vertex\r\n var block_idx_o = 0; // facet barycenter block index\r\n var block_idx_v1 = 0; // v1 vertex block index\r\n var block_idx_v2 = 0; // v2 vertex block index\r\n var block_idx_v3 = 0; // v3 vertex block index\r\n var bbSizeMax = (options.bbSize.x > options.bbSize.y) ? options.bbSize.x : options.bbSize.y;\r\n bbSizeMax = (bbSizeMax > options.bbSize.z) ? bbSizeMax : options.bbSize.z;\r\n xSubRatio = options.subDiv.X * ratio / options.bbSize.x;\r\n ySubRatio = options.subDiv.Y * ratio / options.bbSize.y;\r\n zSubRatio = options.subDiv.Z * ratio / options.bbSize.z;\r\n subSq = options.subDiv.max * options.subDiv.max;\r\n options.facetPartitioning.length = 0;\r\n }\r\n // reset the normals\r\n for (index = 0; index < positions.length; index++) {\r\n normals[index] = 0.0;\r\n }\r\n // Loop : 1 indice triplet = 1 facet\r\n var nbFaces = (indices.length / 3) | 0;\r\n for (index = 0; index < nbFaces; index++) {\r\n // get the indexes of the coordinates of each vertex of the facet\r\n v1x = indices[index * 3] * 3;\r\n v1y = v1x + 1;\r\n v1z = v1x + 2;\r\n v2x = indices[index * 3 + 1] * 3;\r\n v2y = v2x + 1;\r\n v2z = v2x + 2;\r\n v3x = indices[index * 3 + 2] * 3;\r\n v3y = v3x + 1;\r\n v3z = v3x + 2;\r\n p1p2x = positions[v1x] - positions[v2x]; // compute two vectors per facet : p1p2 and p3p2\r\n p1p2y = positions[v1y] - positions[v2y];\r\n p1p2z = positions[v1z] - positions[v2z];\r\n p3p2x = positions[v3x] - positions[v2x];\r\n p3p2y = positions[v3y] - positions[v2y];\r\n p3p2z = positions[v3z] - positions[v2z];\r\n // compute the face normal with the cross product\r\n faceNormalx = faceNormalSign * (p1p2y * p3p2z - p1p2z * p3p2y);\r\n faceNormaly = faceNormalSign * (p1p2z * p3p2x - p1p2x * p3p2z);\r\n faceNormalz = faceNormalSign * (p1p2x * p3p2y - p1p2y * p3p2x);\r\n // normalize this normal and store it in the array facetData\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n if (computeFacetNormals && options) {\r\n options.facetNormals[index].x = faceNormalx;\r\n options.facetNormals[index].y = faceNormaly;\r\n options.facetNormals[index].z = faceNormalz;\r\n }\r\n if (computeFacetPositions && options) {\r\n // compute and the facet barycenter coordinates in the array facetPositions\r\n options.facetPositions[index].x = (positions[v1x] + positions[v2x] + positions[v3x]) / 3.0;\r\n options.facetPositions[index].y = (positions[v1y] + positions[v2y] + positions[v3y]) / 3.0;\r\n options.facetPositions[index].z = (positions[v1z] + positions[v2z] + positions[v3z]) / 3.0;\r\n }\r\n if (computeFacetPartitioning && options) {\r\n // store the facet indexes in arrays in the main facetPartitioning array :\r\n // compute each facet vertex (+ facet barycenter) index in the partiniong array\r\n ox = Math.floor((options.facetPositions[index].x - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n oy = Math.floor((options.facetPositions[index].y - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n oz = Math.floor((options.facetPositions[index].z - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b1x = Math.floor((positions[v1x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b1y = Math.floor((positions[v1y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b1z = Math.floor((positions[v1z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b2x = Math.floor((positions[v2x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b2y = Math.floor((positions[v2y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b2z = Math.floor((positions[v2z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b3x = Math.floor((positions[v3x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b3y = Math.floor((positions[v3y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b3z = Math.floor((positions[v3z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n block_idx_v1 = b1x + options.subDiv.max * b1y + subSq * b1z;\r\n block_idx_v2 = b2x + options.subDiv.max * b2y + subSq * b2z;\r\n block_idx_v3 = b3x + options.subDiv.max * b3y + subSq * b3z;\r\n block_idx_o = ox + options.subDiv.max * oy + subSq * oz;\r\n options.facetPartitioning[block_idx_o] = options.facetPartitioning[block_idx_o] ? options.facetPartitioning[block_idx_o] : new Array();\r\n options.facetPartitioning[block_idx_v1] = options.facetPartitioning[block_idx_v1] ? options.facetPartitioning[block_idx_v1] : new Array();\r\n options.facetPartitioning[block_idx_v2] = options.facetPartitioning[block_idx_v2] ? options.facetPartitioning[block_idx_v2] : new Array();\r\n options.facetPartitioning[block_idx_v3] = options.facetPartitioning[block_idx_v3] ? options.facetPartitioning[block_idx_v3] : new Array();\r\n // push each facet index in each block containing the vertex\r\n options.facetPartitioning[block_idx_v1].push(index);\r\n if (block_idx_v2 != block_idx_v1) {\r\n options.facetPartitioning[block_idx_v2].push(index);\r\n }\r\n if (!(block_idx_v3 == block_idx_v2 || block_idx_v3 == block_idx_v1)) {\r\n options.facetPartitioning[block_idx_v3].push(index);\r\n }\r\n if (!(block_idx_o == block_idx_v1 || block_idx_o == block_idx_v2 || block_idx_o == block_idx_v3)) {\r\n options.facetPartitioning[block_idx_o].push(index);\r\n }\r\n }\r\n if (computeDepthSort && options && options.facetPositions) {\r\n var dsf = depthSortedFacets[index];\r\n dsf.ind = index * 3;\r\n dsf.sqDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].DistanceSquared(options.facetPositions[index], distanceTo);\r\n }\r\n // compute the normals anyway\r\n normals[v1x] += faceNormalx; // accumulate all the normals per face\r\n normals[v1y] += faceNormaly;\r\n normals[v1z] += faceNormalz;\r\n normals[v2x] += faceNormalx;\r\n normals[v2y] += faceNormaly;\r\n normals[v2z] += faceNormalz;\r\n normals[v3x] += faceNormalx;\r\n normals[v3y] += faceNormaly;\r\n normals[v3z] += faceNormalz;\r\n }\r\n // last normalization of each normal\r\n for (index = 0; index < normals.length / 3; index++) {\r\n faceNormalx = normals[index * 3];\r\n faceNormaly = normals[index * 3 + 1];\r\n faceNormalz = normals[index * 3 + 2];\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n normals[index * 3] = faceNormalx;\r\n normals[index * 3 + 1] = faceNormaly;\r\n normals[index * 3 + 2] = faceNormalz;\r\n }\r\n };\r\n /** @hidden */\r\n VertexData._ComputeSides = function (sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs) {\r\n var li = indices.length;\r\n var ln = normals.length;\r\n var i;\r\n var n;\r\n sideOrientation = sideOrientation || VertexData.DEFAULTSIDE;\r\n switch (sideOrientation) {\r\n case VertexData.FRONTSIDE:\r\n // nothing changed\r\n break;\r\n case VertexData.BACKSIDE:\r\n var tmp;\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n tmp = indices[i];\r\n indices[i] = indices[i + 2];\r\n indices[i + 2] = tmp;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[n] = -normals[n];\r\n }\r\n break;\r\n case VertexData.DOUBLESIDE:\r\n // positions\r\n var lp = positions.length;\r\n var l = lp / 3;\r\n for (var p = 0; p < lp; p++) {\r\n positions[lp + p] = positions[p];\r\n }\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n indices[i + li] = indices[i + 2] + l;\r\n indices[i + 1 + li] = indices[i + 1] + l;\r\n indices[i + 2 + li] = indices[i] + l;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[ln + n] = -normals[n];\r\n }\r\n // uvs\r\n var lu = uvs.length;\r\n var u = 0;\r\n for (u = 0; u < lu; u++) {\r\n uvs[u + lu] = uvs[u];\r\n }\r\n frontUVs = frontUVs ? frontUVs : new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0.0, 0.0, 1.0, 1.0);\r\n backUVs = backUVs ? backUVs : new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0.0, 0.0, 1.0, 1.0);\r\n u = 0;\r\n for (i = 0; i < lu / 2; i++) {\r\n uvs[u] = frontUVs.x + (frontUVs.z - frontUVs.x) * uvs[u];\r\n uvs[u + 1] = frontUVs.y + (frontUVs.w - frontUVs.y) * uvs[u + 1];\r\n uvs[u + lu] = backUVs.x + (backUVs.z - backUVs.x) * uvs[u + lu];\r\n uvs[u + lu + 1] = backUVs.y + (backUVs.w - backUVs.y) * uvs[u + lu + 1];\r\n u += 2;\r\n }\r\n break;\r\n }\r\n };\r\n /**\r\n * Applies VertexData created from the imported parameters to the geometry\r\n * @param parsedVertexData the parsed data from an imported file\r\n * @param geometry the geometry to apply the VertexData to\r\n */\r\n VertexData.ImportVertexData = function (parsedVertexData, geometry) {\r\n var vertexData = new VertexData();\r\n // positions\r\n var positions = parsedVertexData.positions;\r\n if (positions) {\r\n vertexData.set(positions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n }\r\n // normals\r\n var normals = parsedVertexData.normals;\r\n if (normals) {\r\n vertexData.set(normals, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind);\r\n }\r\n // tangents\r\n var tangents = parsedVertexData.tangents;\r\n if (tangents) {\r\n vertexData.set(tangents, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].TangentKind);\r\n }\r\n // uvs\r\n var uvs = parsedVertexData.uvs;\r\n if (uvs) {\r\n vertexData.set(uvs, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n }\r\n // uv2s\r\n var uv2s = parsedVertexData.uv2s;\r\n if (uv2s) {\r\n vertexData.set(uv2s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind);\r\n }\r\n // uv3s\r\n var uv3s = parsedVertexData.uv3s;\r\n if (uv3s) {\r\n vertexData.set(uv3s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV3Kind);\r\n }\r\n // uv4s\r\n var uv4s = parsedVertexData.uv4s;\r\n if (uv4s) {\r\n vertexData.set(uv4s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV4Kind);\r\n }\r\n // uv5s\r\n var uv5s = parsedVertexData.uv5s;\r\n if (uv5s) {\r\n vertexData.set(uv5s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV5Kind);\r\n }\r\n // uv6s\r\n var uv6s = parsedVertexData.uv6s;\r\n if (uv6s) {\r\n vertexData.set(uv6s, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV6Kind);\r\n }\r\n // colors\r\n var colors = parsedVertexData.colors;\r\n if (colors) {\r\n vertexData.set(_Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"].CheckColors4(colors, positions.length / 3), _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind);\r\n }\r\n // matricesIndices\r\n var matricesIndices = parsedVertexData.matricesIndices;\r\n if (matricesIndices) {\r\n vertexData.set(matricesIndices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind);\r\n }\r\n // matricesWeights\r\n var matricesWeights = parsedVertexData.matricesWeights;\r\n if (matricesWeights) {\r\n vertexData.set(matricesWeights, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind);\r\n }\r\n // indices\r\n var indices = parsedVertexData.indices;\r\n if (indices) {\r\n vertexData.indices = indices;\r\n }\r\n geometry.setAllVerticesData(vertexData, parsedVertexData.updatable);\r\n };\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n VertexData.FRONTSIDE = 0;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n VertexData.BACKSIDE = 1;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n VertexData.DOUBLESIDE = 2;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n VertexData.DEFAULTSIDE = 0;\r\n return VertexData;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshBuilder.ts\":\n/*!*******************************!*\\\n !*** ./Meshes/meshBuilder.ts ***!\n \\*******************************/\n/*! exports provided: MeshBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return MeshBuilder; });\n/* harmony import */ var _Builders_ribbonBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Builders/ribbonBuilder */ \"./Meshes/Builders/ribbonBuilder.ts\");\n/* harmony import */ var _Builders_discBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Builders/discBuilder */ \"./Meshes/Builders/discBuilder.ts\");\n/* harmony import */ var _Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Builders_tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Builders/tiledBoxBuilder */ \"./Meshes/Builders/tiledBoxBuilder.ts\");\n/* harmony import */ var _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Builders_torusBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Builders/torusBuilder */ \"./Meshes/Builders/torusBuilder.ts\");\n/* harmony import */ var _Builders_torusKnotBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Builders/torusKnotBuilder */ \"./Meshes/Builders/torusKnotBuilder.ts\");\n/* harmony import */ var _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Builders/polygonBuilder */ \"./Meshes/Builders/polygonBuilder.ts\");\n/* harmony import */ var _Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Builders/shapeBuilder */ \"./Meshes/Builders/shapeBuilder.ts\");\n/* harmony import */ var _Builders_latheBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Builders/latheBuilder */ \"./Meshes/Builders/latheBuilder.ts\");\n/* harmony import */ var _Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Builders_tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Builders/tiledPlaneBuilder */ \"./Meshes/Builders/tiledPlaneBuilder.ts\");\n/* harmony import */ var _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Builders/groundBuilder */ \"./Meshes/Builders/groundBuilder.ts\");\n/* harmony import */ var _Builders_tubeBuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Builders/tubeBuilder */ \"./Meshes/Builders/tubeBuilder.ts\");\n/* harmony import */ var _Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Builders/polyhedronBuilder */ \"./Meshes/Builders/polyhedronBuilder.ts\");\n/* harmony import */ var _Builders_icoSphereBuilder__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Builders/icoSphereBuilder */ \"./Meshes/Builders/icoSphereBuilder.ts\");\n/* harmony import */ var _Builders_decalBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Builders/decalBuilder */ \"./Meshes/Builders/decalBuilder.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar MeshBuilder = /** @class */ (function () {\r\n function MeshBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * * The parameter `size` sets the size (float) of each box side (default 1)\r\n * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n MeshBuilder.CreateBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_2__[\"BoxBuilder\"].CreateBox(name, options, scene);\r\n };\r\n /**\r\n * Creates a tiled box mesh\r\n * * faceTiles sets the pattern, tile size and number of tiles for a face\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tiled box mesh\r\n */\r\n MeshBuilder.CreateTiledBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_tiledBoxBuilder__WEBPACK_IMPORTED_MODULE_3__[\"TiledBoxBuilder\"].CreateTiledBox(name, options, scene);\r\n };\r\n /**\r\n * Creates a sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the sphere mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#sphere\r\n */\r\n MeshBuilder.CreateSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_4__[\"SphereBuilder\"].CreateSphere(name, options, scene);\r\n };\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc\r\n * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)\r\n * * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane polygonal mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#disc-or-regular-polygon\r\n */\r\n MeshBuilder.CreateDisc = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_discBuilder__WEBPACK_IMPORTED_MODULE_1__[\"DiscBuilder\"].CreateDisc(name, options, scene);\r\n };\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value of `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the icosahedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n MeshBuilder.CreateIcoSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_icoSphereBuilder__WEBPACK_IMPORTED_MODULE_17__[\"IcoSphereBuilder\"].CreateIcoSphere(name, options, scene);\r\n };\r\n /**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#ribbon\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ribbon mesh\r\n * @see https://doc.babylonjs.com/how_to/ribbon_tutorial\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n */\r\n MeshBuilder.CreateRibbon = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_ribbonBuilder__WEBPACK_IMPORTED_MODULE_0__[\"RibbonBuilder\"].CreateRibbon(name, options, scene);\r\n };\r\n /**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\n MeshBuilder.CreateCylinder = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_5__[\"CylinderBuilder\"].CreateCylinder(name, options, scene);\r\n };\r\n /**\r\n * Creates a torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (postive integer, default 16)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus\r\n */\r\n MeshBuilder.CreateTorus = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_torusBuilder__WEBPACK_IMPORTED_MODULE_6__[\"TorusBuilder\"].CreateTorus(name, options, scene);\r\n };\r\n /**\r\n * Creates a torus knot mesh\r\n * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)\r\n * * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32)\r\n * * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus knot mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus-knot\r\n */\r\n MeshBuilder.CreateTorusKnot = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_torusKnotBuilder__WEBPACK_IMPORTED_MODULE_7__[\"TorusKnotBuilder\"].CreateTorusKnot(name, options, scene);\r\n };\r\n /**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\n MeshBuilder.CreateLineSystem = function (name, options, scene) {\r\n return _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLineSystem(name, options, scene);\r\n };\r\n /**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\n MeshBuilder.CreateLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateLines(name, options, scene);\r\n };\r\n /**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\n MeshBuilder.CreateDashedLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_8__[\"LinesBuilder\"].CreateDashedLines(name, options, scene);\r\n };\r\n /**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n MeshBuilder.ExtrudeShape = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_10__[\"ShapeBuilder\"].ExtrudeShape(name, options, scene);\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray`\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n */\r\n MeshBuilder.ExtrudeShapeCustom = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_10__[\"ShapeBuilder\"].ExtrudeShapeCustom(name, options, scene);\r\n };\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * * The parameter `radius` (positive float, default 1) is the radius value of the lathe\r\n * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe\r\n * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides\r\n * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape\r\n * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter \"arc\"\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the lathe mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lathe\r\n */\r\n MeshBuilder.CreateLathe = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_latheBuilder__WEBPACK_IMPORTED_MODULE_11__[\"LatheBuilder\"].CreateLathe(name, options, scene);\r\n };\r\n /**\r\n * Creates a tiled plane mesh\r\n * * You can set a limited pattern arrangement with the tiles\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n MeshBuilder.CreateTiledPlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_tiledPlaneBuilder__WEBPACK_IMPORTED_MODULE_13__[\"TiledPlaneBuilder\"].CreateTiledPlane(name, options, scene);\r\n };\r\n /**\r\n * Creates a plane mesh\r\n * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)\r\n * * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value of `size`)\r\n * * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n MeshBuilder.CreatePlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_12__[\"PlaneBuilder\"].CreatePlane(name, options, scene);\r\n };\r\n /**\r\n * Creates a ground mesh\r\n * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground\r\n * * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground\r\n */\r\n MeshBuilder.CreateGround = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__[\"GroundBuilder\"].CreateGround(name, options, scene);\r\n };\r\n /**\r\n * Creates a tiled ground mesh\r\n * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates\r\n * * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates\r\n * * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tiled-ground\r\n */\r\n MeshBuilder.CreateTiledGround = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__[\"GroundBuilder\"].CreateTiledGround(name, options, scene);\r\n };\r\n /**\r\n * Creates a ground mesh from a height map\r\n * * The parameter `url` sets the URL of the height map image resource.\r\n * * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.\r\n * * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.\r\n * * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.\r\n * * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.\r\n * * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.\r\n * * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).\r\n * * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param url defines the url to the height map\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map\r\n */\r\n MeshBuilder.CreateGroundFromHeightMap = function (name, url, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_14__[\"GroundBuilder\"].CreateGroundFromHeightMap(name, url, options, scene);\r\n };\r\n /**\r\n * Creates a polygon mesh\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh\r\n * * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4)\r\n * * Remember you can only change the shape positions, not their number when updating a polygon\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n MeshBuilder.CreatePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n return _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_9__[\"PolygonBuilder\"].CreatePolygon(name, options, scene, earcutInjection);\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction.\r\n * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)\r\n * @see https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns the polygon mesh\r\n */\r\n MeshBuilder.ExtrudePolygon = function (name, options, scene, earcutInjection) {\r\n if (scene === void 0) { scene = null; }\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n return _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_9__[\"PolygonBuilder\"].ExtrudePolygon(name, options, scene, earcutInjection);\r\n };\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * * The parameter `radius` (positive float, default 1) sets the tube radius size\r\n * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface\r\n * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`\r\n * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)\r\n * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#tube\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the tube mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#tube\r\n */\r\n MeshBuilder.CreateTube = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_tubeBuilder__WEBPACK_IMPORTED_MODULE_15__[\"TubeBuilder\"].CreateTube(name, options, scene);\r\n };\r\n /**\r\n * Creates a polyhedron mesh\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the polyhedron mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes\r\n */\r\n MeshBuilder.CreatePolyhedron = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n return _Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_16__[\"PolyhedronBuilder\"].CreatePolyhedron(name, options, scene);\r\n };\r\n /**\r\n * Creates a decal mesh.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\r\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\r\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\r\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\r\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh where the decal must be applied\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the decal mesh\r\n * @see https://doc.babylonjs.com/how_to/decals\r\n */\r\n MeshBuilder.CreateDecal = function (name, sourceMesh, options) {\r\n return _Builders_decalBuilder__WEBPACK_IMPORTED_MODULE_18__[\"DecalBuilder\"].CreateDecal(name, sourceMesh, options);\r\n };\r\n return MeshBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshLODLevel.ts\":\n/*!********************************!*\\\n !*** ./Meshes/meshLODLevel.ts ***!\n \\********************************/\n/*! exports provided: MeshLODLevel */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return MeshLODLevel; });\n/**\r\n * Class used to represent a specific level of detail of a mesh\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_lod\r\n */\r\nvar MeshLODLevel = /** @class */ (function () {\r\n /**\r\n * Creates a new LOD level\r\n * @param distance defines the distance where this level should star being displayed\r\n * @param mesh defines the mesh to use to render this level\r\n */\r\n function MeshLODLevel(\r\n /** Defines the distance where this level should start being displayed */\r\n distance, \r\n /** Defines the mesh to use to render this level */\r\n mesh) {\r\n this.distance = distance;\r\n this.mesh = mesh;\r\n }\r\n return MeshLODLevel;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshSimplification.ts\":\n/*!**************************************!*\\\n !*** ./Meshes/meshSimplification.ts ***!\n \\**************************************/\n/*! exports provided: SimplificationSettings, SimplificationQueue, SimplificationType */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return SimplificationSettings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return SimplificationQueue; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return SimplificationType; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/subMesh */ \"./Meshes/subMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to specify simplification options\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar SimplificationSettings = /** @class */ (function () {\r\n /**\r\n * Creates a SimplificationSettings\r\n * @param quality expected quality\r\n * @param distance distance when this optimized version should be used\r\n * @param optimizeMesh already optimized mesh\r\n */\r\n function SimplificationSettings(\r\n /** expected quality */\r\n quality, \r\n /** distance when this optimized version should be used */\r\n distance, \r\n /** already optimized mesh */\r\n optimizeMesh) {\r\n this.quality = quality;\r\n this.distance = distance;\r\n this.optimizeMesh = optimizeMesh;\r\n }\r\n return SimplificationSettings;\r\n}());\r\n\r\n/**\r\n * Queue used to order the simplification tasks\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar SimplificationQueue = /** @class */ (function () {\r\n /**\r\n * Creates a new queue\r\n */\r\n function SimplificationQueue() {\r\n this.running = false;\r\n this._simplificationArray = [];\r\n }\r\n /**\r\n * Adds a new simplification task\r\n * @param task defines a task to add\r\n */\r\n SimplificationQueue.prototype.addTask = function (task) {\r\n this._simplificationArray.push(task);\r\n };\r\n /**\r\n * Execute next task\r\n */\r\n SimplificationQueue.prototype.executeNext = function () {\r\n var task = this._simplificationArray.pop();\r\n if (task) {\r\n this.running = true;\r\n this.runSimplification(task);\r\n }\r\n else {\r\n this.running = false;\r\n }\r\n };\r\n /**\r\n * Execute a simplification task\r\n * @param task defines the task to run\r\n */\r\n SimplificationQueue.prototype.runSimplification = function (task) {\r\n var _this = this;\r\n if (task.parallelProcessing) {\r\n //parallel simplifier\r\n task.settings.forEach(function (setting) {\r\n var simplifier = _this.getSimplifier(task);\r\n simplifier.simplify(setting, function (newMesh) {\r\n task.mesh.addLODLevel(setting.distance, newMesh);\r\n newMesh.isVisible = true;\r\n //check if it is the last\r\n if (setting.quality === task.settings[task.settings.length - 1].quality && task.successCallback) {\r\n //all done, run the success callback.\r\n task.successCallback();\r\n }\r\n _this.executeNext();\r\n });\r\n });\r\n }\r\n else {\r\n //single simplifier.\r\n var simplifier = this.getSimplifier(task);\r\n var runDecimation = function (setting, callback) {\r\n simplifier.simplify(setting, function (newMesh) {\r\n task.mesh.addLODLevel(setting.distance, newMesh);\r\n newMesh.isVisible = true;\r\n //run the next quality level\r\n callback();\r\n });\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].Run(task.settings.length, function (loop) {\r\n runDecimation(task.settings[loop.index], function () {\r\n loop.executeNext();\r\n });\r\n }, function () {\r\n //execution ended, run the success callback.\r\n if (task.successCallback) {\r\n task.successCallback();\r\n }\r\n _this.executeNext();\r\n });\r\n }\r\n };\r\n SimplificationQueue.prototype.getSimplifier = function (task) {\r\n switch (task.simplificationType) {\r\n case SimplificationType.QUADRATIC:\r\n default:\r\n return new QuadraticErrorSimplification(task.mesh);\r\n }\r\n };\r\n return SimplificationQueue;\r\n}());\r\n\r\n/**\r\n * The implemented types of simplification\r\n * At the moment only Quadratic Error Decimation is implemented\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar SimplificationType;\r\n(function (SimplificationType) {\r\n /** Quadratic error decimation */\r\n SimplificationType[SimplificationType[\"QUADRATIC\"] = 0] = \"QUADRATIC\";\r\n})(SimplificationType || (SimplificationType = {}));\r\nvar DecimationTriangle = /** @class */ (function () {\r\n function DecimationTriangle(vertices) {\r\n this.vertices = vertices;\r\n this.error = new Array(4);\r\n this.deleted = false;\r\n this.isDirty = false;\r\n this.deletePending = false;\r\n this.borderFactor = 0;\r\n }\r\n return DecimationTriangle;\r\n}());\r\nvar DecimationVertex = /** @class */ (function () {\r\n function DecimationVertex(position, id) {\r\n this.position = position;\r\n this.id = id;\r\n this.isBorder = true;\r\n this.q = new QuadraticMatrix();\r\n this.triangleCount = 0;\r\n this.triangleStart = 0;\r\n this.originalOffsets = [];\r\n }\r\n DecimationVertex.prototype.updatePosition = function (newPosition) {\r\n this.position.copyFrom(newPosition);\r\n };\r\n return DecimationVertex;\r\n}());\r\nvar QuadraticMatrix = /** @class */ (function () {\r\n function QuadraticMatrix(data) {\r\n this.data = new Array(10);\r\n for (var i = 0; i < 10; ++i) {\r\n if (data && data[i]) {\r\n this.data[i] = data[i];\r\n }\r\n else {\r\n this.data[i] = 0;\r\n }\r\n }\r\n }\r\n QuadraticMatrix.prototype.det = function (a11, a12, a13, a21, a22, a23, a31, a32, a33) {\r\n var det = this.data[a11] * this.data[a22] * this.data[a33] + this.data[a13] * this.data[a21] * this.data[a32] +\r\n this.data[a12] * this.data[a23] * this.data[a31] - this.data[a13] * this.data[a22] * this.data[a31] -\r\n this.data[a11] * this.data[a23] * this.data[a32] - this.data[a12] * this.data[a21] * this.data[a33];\r\n return det;\r\n };\r\n QuadraticMatrix.prototype.addInPlace = function (matrix) {\r\n for (var i = 0; i < 10; ++i) {\r\n this.data[i] += matrix.data[i];\r\n }\r\n };\r\n QuadraticMatrix.prototype.addArrayInPlace = function (data) {\r\n for (var i = 0; i < 10; ++i) {\r\n this.data[i] += data[i];\r\n }\r\n };\r\n QuadraticMatrix.prototype.add = function (matrix) {\r\n var m = new QuadraticMatrix();\r\n for (var i = 0; i < 10; ++i) {\r\n m.data[i] = this.data[i] + matrix.data[i];\r\n }\r\n return m;\r\n };\r\n QuadraticMatrix.FromData = function (a, b, c, d) {\r\n return new QuadraticMatrix(QuadraticMatrix.DataFromNumbers(a, b, c, d));\r\n };\r\n //returning an array to avoid garbage collection\r\n QuadraticMatrix.DataFromNumbers = function (a, b, c, d) {\r\n return [a * a, a * b, a * c, a * d, b * b, b * c, b * d, c * c, c * d, d * d];\r\n };\r\n return QuadraticMatrix;\r\n}());\r\nvar Reference = /** @class */ (function () {\r\n function Reference(vertexId, triangleId) {\r\n this.vertexId = vertexId;\r\n this.triangleId = triangleId;\r\n }\r\n return Reference;\r\n}());\r\n/**\r\n * An implementation of the Quadratic Error simplification algorithm.\r\n * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf\r\n * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS\r\n * @author RaananW\r\n * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification\r\n */\r\nvar QuadraticErrorSimplification = /** @class */ (function () {\r\n function QuadraticErrorSimplification(_mesh) {\r\n this._mesh = _mesh;\r\n this.syncIterations = 5000;\r\n this.aggressiveness = 7;\r\n this.decimationIterations = 100;\r\n this.boundingBoxEpsilon = _Maths_math_constants__WEBPACK_IMPORTED_MODULE_5__[\"Epsilon\"];\r\n }\r\n QuadraticErrorSimplification.prototype.simplify = function (settings, successCallback) {\r\n var _this = this;\r\n this.initDecimatedMesh();\r\n //iterating through the submeshes array, one after the other.\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].Run(this._mesh.subMeshes.length, function (loop) {\r\n _this.initWithMesh(loop.index, function () {\r\n _this.runDecimation(settings, loop.index, function () {\r\n loop.executeNext();\r\n });\r\n }, settings.optimizeMesh);\r\n }, function () {\r\n setTimeout(function () {\r\n successCallback(_this._reconstructedMesh);\r\n }, 0);\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.runDecimation = function (settings, submeshIndex, successCallback) {\r\n var _this = this;\r\n var targetCount = ~~(this.triangles.length * settings.quality);\r\n var deletedTriangles = 0;\r\n var triangleCount = this.triangles.length;\r\n var iterationFunction = function (iteration, callback) {\r\n setTimeout(function () {\r\n if (iteration % 5 === 0) {\r\n _this.updateMesh(iteration === 0);\r\n }\r\n for (var i = 0; i < _this.triangles.length; ++i) {\r\n _this.triangles[i].isDirty = false;\r\n }\r\n var threshold = 0.000000001 * Math.pow((iteration + 3), _this.aggressiveness);\r\n var trianglesIterator = function (i) {\r\n var tIdx = ~~(((_this.triangles.length / 2) + i) % _this.triangles.length);\r\n var t = _this.triangles[tIdx];\r\n if (!t) {\r\n return;\r\n }\r\n if (t.error[3] > threshold || t.deleted || t.isDirty) {\r\n return;\r\n }\r\n for (var j = 0; j < 3; ++j) {\r\n if (t.error[j] < threshold) {\r\n var deleted0 = [];\r\n var deleted1 = [];\r\n var v0 = t.vertices[j];\r\n var v1 = t.vertices[(j + 1) % 3];\r\n if (v0.isBorder || v1.isBorder) {\r\n continue;\r\n }\r\n var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n // var n = Vector3.Zero();\r\n // var uv = Vector2.Zero();\r\n // var color = new Color4(0, 0, 0, 1);\r\n _this.calculateError(v0, v1, p);\r\n var delTr = new Array();\r\n if (_this.isFlipped(v0, v1, p, deleted0, delTr)) {\r\n continue;\r\n }\r\n if (_this.isFlipped(v1, v0, p, deleted1, delTr)) {\r\n continue;\r\n }\r\n if (deleted0.indexOf(true) < 0 || deleted1.indexOf(true) < 0) {\r\n continue;\r\n }\r\n var uniqueArray = new Array();\r\n delTr.forEach(function (deletedT) {\r\n if (uniqueArray.indexOf(deletedT) === -1) {\r\n deletedT.deletePending = true;\r\n uniqueArray.push(deletedT);\r\n }\r\n });\r\n if (uniqueArray.length % 2 !== 0) {\r\n continue;\r\n }\r\n v0.q = v1.q.add(v0.q);\r\n v0.updatePosition(p);\r\n var tStart = _this.references.length;\r\n deletedTriangles = _this.updateTriangles(v0, v0, deleted0, deletedTriangles);\r\n deletedTriangles = _this.updateTriangles(v0, v1, deleted1, deletedTriangles);\r\n var tCount = _this.references.length - tStart;\r\n if (tCount <= v0.triangleCount) {\r\n if (tCount) {\r\n for (var c = 0; c < tCount; c++) {\r\n _this.references[v0.triangleStart + c] = _this.references[tStart + c];\r\n }\r\n }\r\n }\r\n else {\r\n v0.triangleStart = tStart;\r\n }\r\n v0.triangleCount = tCount;\r\n break;\r\n }\r\n }\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, trianglesIterator, callback, function () { return (triangleCount - deletedTriangles <= targetCount); });\r\n }, 0);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].Run(this.decimationIterations, function (loop) {\r\n if (triangleCount - deletedTriangles <= targetCount) {\r\n loop.breakLoop();\r\n }\r\n else {\r\n iterationFunction(loop.index, function () {\r\n loop.executeNext();\r\n });\r\n }\r\n }, function () {\r\n setTimeout(function () {\r\n //reconstruct this part of the mesh\r\n _this.reconstructMesh(submeshIndex);\r\n successCallback();\r\n }, 0);\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.initWithMesh = function (submeshIndex, callback, optimizeMesh) {\r\n var _this = this;\r\n this.vertices = [];\r\n this.triangles = [];\r\n var positionData = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var indices = this._mesh.getIndices();\r\n var submesh = this._mesh.subMeshes[submeshIndex];\r\n var findInVertices = function (positionToSearch) {\r\n if (optimizeMesh) {\r\n for (var ii = 0; ii < _this.vertices.length; ++ii) {\r\n if (_this.vertices[ii].position.equals(positionToSearch)) {\r\n return _this.vertices[ii];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n var vertexReferences = [];\r\n var vertexInit = function (i) {\r\n if (!positionData) {\r\n return;\r\n }\r\n var offset = i + submesh.verticesStart;\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positionData, offset * 3);\r\n var vertex = findInVertices(position) || new DecimationVertex(position, _this.vertices.length);\r\n vertex.originalOffsets.push(offset);\r\n if (vertex.id === _this.vertices.length) {\r\n _this.vertices.push(vertex);\r\n }\r\n vertexReferences.push(vertex.id);\r\n };\r\n //var totalVertices = mesh.getTotalVertices();\r\n var totalVertices = submesh.verticesCount;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(totalVertices, (this.syncIterations / 4) >> 0, vertexInit, function () {\r\n var indicesInit = function (i) {\r\n if (!indices) {\r\n return;\r\n }\r\n var offset = (submesh.indexStart / 3) + i;\r\n var pos = (offset * 3);\r\n var i0 = indices[pos + 0];\r\n var i1 = indices[pos + 1];\r\n var i2 = indices[pos + 2];\r\n var v0 = _this.vertices[vertexReferences[i0 - submesh.verticesStart]];\r\n var v1 = _this.vertices[vertexReferences[i1 - submesh.verticesStart]];\r\n var v2 = _this.vertices[vertexReferences[i2 - submesh.verticesStart]];\r\n var triangle = new DecimationTriangle([v0, v1, v2]);\r\n triangle.originalOffset = pos;\r\n _this.triangles.push(triangle);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(submesh.indexCount / 3, _this.syncIterations, indicesInit, function () {\r\n _this.init(callback);\r\n });\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.init = function (callback) {\r\n var _this = this;\r\n var triangleInit1 = function (i) {\r\n var t = _this.triangles[i];\r\n t.normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(t.vertices[1].position.subtract(t.vertices[0].position), t.vertices[2].position.subtract(t.vertices[0].position)).normalize();\r\n for (var j = 0; j < 3; j++) {\r\n t.vertices[j].q.addArrayInPlace(QuadraticMatrix.DataFromNumbers(t.normal.x, t.normal.y, t.normal.z, -(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(t.normal, t.vertices[0].position))));\r\n }\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(this.triangles.length, this.syncIterations, triangleInit1, function () {\r\n var triangleInit2 = function (i) {\r\n var t = _this.triangles[i];\r\n for (var j = 0; j < 3; ++j) {\r\n t.error[j] = _this.calculateError(t.vertices[j], t.vertices[(j + 1) % 3]);\r\n }\r\n t.error[3] = Math.min(t.error[0], t.error[1], t.error[2]);\r\n };\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_4__[\"AsyncLoop\"].SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, triangleInit2, function () {\r\n callback();\r\n });\r\n });\r\n };\r\n QuadraticErrorSimplification.prototype.reconstructMesh = function (submeshIndex) {\r\n var newTriangles = [];\r\n var i;\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n this.vertices[i].triangleCount = 0;\r\n }\r\n var t;\r\n var j;\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n if (!this.triangles[i].deleted) {\r\n t = this.triangles[i];\r\n for (j = 0; j < 3; ++j) {\r\n t.vertices[j].triangleCount = 1;\r\n }\r\n newTriangles.push(t);\r\n }\r\n }\r\n var newPositionData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind) || []);\r\n var newNormalData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind) || []);\r\n var newUVsData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind) || []);\r\n var newColorsData = (this._reconstructedMesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind) || []);\r\n var normalData = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind);\r\n var uvs = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n var colorsData = this._mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind);\r\n var vertexCount = 0;\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n var vertex = this.vertices[i];\r\n vertex.id = vertexCount;\r\n if (vertex.triangleCount) {\r\n vertex.originalOffsets.forEach(function (originalOffset) {\r\n if (!normalData) {\r\n return;\r\n }\r\n newPositionData.push(vertex.position.x);\r\n newPositionData.push(vertex.position.y);\r\n newPositionData.push(vertex.position.z);\r\n newNormalData.push(normalData[originalOffset * 3]);\r\n newNormalData.push(normalData[(originalOffset * 3) + 1]);\r\n newNormalData.push(normalData[(originalOffset * 3) + 2]);\r\n if (uvs && uvs.length) {\r\n newUVsData.push(uvs[(originalOffset * 2)]);\r\n newUVsData.push(uvs[(originalOffset * 2) + 1]);\r\n }\r\n if (colorsData && colorsData.length) {\r\n newColorsData.push(colorsData[(originalOffset * 4)]);\r\n newColorsData.push(colorsData[(originalOffset * 4) + 1]);\r\n newColorsData.push(colorsData[(originalOffset * 4) + 2]);\r\n newColorsData.push(colorsData[(originalOffset * 4) + 3]);\r\n }\r\n ++vertexCount;\r\n });\r\n }\r\n }\r\n var startingIndex = this._reconstructedMesh.getTotalIndices();\r\n var startingVertex = this._reconstructedMesh.getTotalVertices();\r\n var submeshesArray = this._reconstructedMesh.subMeshes;\r\n this._reconstructedMesh.subMeshes = [];\r\n var newIndicesArray = this._reconstructedMesh.getIndices(); //[];\r\n var originalIndices = this._mesh.getIndices();\r\n for (i = 0; i < newTriangles.length; ++i) {\r\n t = newTriangles[i]; //now get the new referencing point for each vertex\r\n [0, 1, 2].forEach(function (idx) {\r\n var id = originalIndices[t.originalOffset + idx];\r\n var offset = t.vertices[idx].originalOffsets.indexOf(id);\r\n if (offset < 0) {\r\n offset = 0;\r\n }\r\n newIndicesArray.push(t.vertices[idx].id + offset + startingVertex);\r\n });\r\n }\r\n //overwriting the old vertex buffers and indices.\r\n this._reconstructedMesh.setIndices(newIndicesArray);\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, newPositionData);\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, newNormalData);\r\n if (newUVsData.length > 0) {\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind, newUVsData);\r\n }\r\n if (newColorsData.length > 0) {\r\n this._reconstructedMesh.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].ColorKind, newColorsData);\r\n }\r\n //create submesh\r\n var originalSubmesh = this._mesh.subMeshes[submeshIndex];\r\n if (submeshIndex > 0) {\r\n this._reconstructedMesh.subMeshes = [];\r\n submeshesArray.forEach(function (submesh) {\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__[\"SubMesh\"].AddToMesh(submesh.materialIndex, submesh.verticesStart, submesh.verticesCount, /* 0, newPositionData.length/3, */ submesh.indexStart, submesh.indexCount, submesh.getMesh());\r\n });\r\n _Meshes_subMesh__WEBPACK_IMPORTED_MODULE_2__[\"SubMesh\"].AddToMesh(originalSubmesh.materialIndex, startingVertex, vertexCount, /* 0, newPositionData.length / 3, */ startingIndex, newTriangles.length * 3, this._reconstructedMesh);\r\n }\r\n };\r\n QuadraticErrorSimplification.prototype.initDecimatedMesh = function () {\r\n this._reconstructedMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__[\"Mesh\"](this._mesh.name + \"Decimated\", this._mesh.getScene());\r\n this._reconstructedMesh.material = this._mesh.material;\r\n this._reconstructedMesh.parent = this._mesh.parent;\r\n this._reconstructedMesh.isVisible = false;\r\n this._reconstructedMesh.renderingGroupId = this._mesh.renderingGroupId;\r\n };\r\n QuadraticErrorSimplification.prototype.isFlipped = function (vertex1, vertex2, point, deletedArray, delTr) {\r\n for (var i = 0; i < vertex1.triangleCount; ++i) {\r\n var t = this.triangles[this.references[vertex1.triangleStart + i].triangleId];\r\n if (t.deleted) {\r\n continue;\r\n }\r\n var s = this.references[vertex1.triangleStart + i].vertexId;\r\n var v1 = t.vertices[(s + 1) % 3];\r\n var v2 = t.vertices[(s + 2) % 3];\r\n if ((v1 === vertex2 || v2 === vertex2)) {\r\n deletedArray[i] = true;\r\n delTr.push(t);\r\n continue;\r\n }\r\n var d1 = v1.position.subtract(point);\r\n d1 = d1.normalize();\r\n var d2 = v2.position.subtract(point);\r\n d2 = d2.normalize();\r\n if (Math.abs(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(d1, d2)) > 0.999) {\r\n return true;\r\n }\r\n var normal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Cross(d1, d2).normalize();\r\n deletedArray[i] = false;\r\n if (_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Dot(normal, t.normal) < 0.2) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n QuadraticErrorSimplification.prototype.updateTriangles = function (origVertex, vertex, deletedArray, deletedTriangles) {\r\n var newDeleted = deletedTriangles;\r\n for (var i = 0; i < vertex.triangleCount; ++i) {\r\n var ref = this.references[vertex.triangleStart + i];\r\n var t = this.triangles[ref.triangleId];\r\n if (t.deleted) {\r\n continue;\r\n }\r\n if (deletedArray[i] && t.deletePending) {\r\n t.deleted = true;\r\n newDeleted++;\r\n continue;\r\n }\r\n t.vertices[ref.vertexId] = origVertex;\r\n t.isDirty = true;\r\n t.error[0] = this.calculateError(t.vertices[0], t.vertices[1]) + (t.borderFactor / 2);\r\n t.error[1] = this.calculateError(t.vertices[1], t.vertices[2]) + (t.borderFactor / 2);\r\n t.error[2] = this.calculateError(t.vertices[2], t.vertices[0]) + (t.borderFactor / 2);\r\n t.error[3] = Math.min(t.error[0], t.error[1], t.error[2]);\r\n this.references.push(ref);\r\n }\r\n return newDeleted;\r\n };\r\n QuadraticErrorSimplification.prototype.identifyBorder = function () {\r\n for (var i = 0; i < this.vertices.length; ++i) {\r\n var vCount = [];\r\n var vId = [];\r\n var v = this.vertices[i];\r\n var j;\r\n for (j = 0; j < v.triangleCount; ++j) {\r\n var triangle = this.triangles[this.references[v.triangleStart + j].triangleId];\r\n for (var ii = 0; ii < 3; ii++) {\r\n var ofs = 0;\r\n var vv = triangle.vertices[ii];\r\n while (ofs < vCount.length) {\r\n if (vId[ofs] === vv.id) {\r\n break;\r\n }\r\n ++ofs;\r\n }\r\n if (ofs === vCount.length) {\r\n vCount.push(1);\r\n vId.push(vv.id);\r\n }\r\n else {\r\n vCount[ofs]++;\r\n }\r\n }\r\n }\r\n for (j = 0; j < vCount.length; ++j) {\r\n if (vCount[j] === 1) {\r\n this.vertices[vId[j]].isBorder = true;\r\n }\r\n else {\r\n this.vertices[vId[j]].isBorder = false;\r\n }\r\n }\r\n }\r\n };\r\n QuadraticErrorSimplification.prototype.updateMesh = function (identifyBorders) {\r\n if (identifyBorders === void 0) { identifyBorders = false; }\r\n var i;\r\n if (!identifyBorders) {\r\n var newTrianglesVector = [];\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n if (!this.triangles[i].deleted) {\r\n newTrianglesVector.push(this.triangles[i]);\r\n }\r\n }\r\n this.triangles = newTrianglesVector;\r\n }\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n this.vertices[i].triangleCount = 0;\r\n this.vertices[i].triangleStart = 0;\r\n }\r\n var t;\r\n var j;\r\n var v;\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n t = this.triangles[i];\r\n for (j = 0; j < 3; ++j) {\r\n v = t.vertices[j];\r\n v.triangleCount++;\r\n }\r\n }\r\n var tStart = 0;\r\n for (i = 0; i < this.vertices.length; ++i) {\r\n this.vertices[i].triangleStart = tStart;\r\n tStart += this.vertices[i].triangleCount;\r\n this.vertices[i].triangleCount = 0;\r\n }\r\n var newReferences = new Array(this.triangles.length * 3);\r\n for (i = 0; i < this.triangles.length; ++i) {\r\n t = this.triangles[i];\r\n for (j = 0; j < 3; ++j) {\r\n v = t.vertices[j];\r\n newReferences[v.triangleStart + v.triangleCount] = new Reference(j, i);\r\n v.triangleCount++;\r\n }\r\n }\r\n this.references = newReferences;\r\n if (identifyBorders) {\r\n this.identifyBorder();\r\n }\r\n };\r\n QuadraticErrorSimplification.prototype.vertexError = function (q, point) {\r\n var x = point.x;\r\n var y = point.y;\r\n var z = point.z;\r\n return q.data[0] * x * x + 2 * q.data[1] * x * y + 2 * q.data[2] * x * z + 2 * q.data[3] * x + q.data[4] * y * y\r\n + 2 * q.data[5] * y * z + 2 * q.data[6] * y + q.data[7] * z * z + 2 * q.data[8] * z + q.data[9];\r\n };\r\n QuadraticErrorSimplification.prototype.calculateError = function (vertex1, vertex2, pointResult) {\r\n var q = vertex1.q.add(vertex2.q);\r\n var border = vertex1.isBorder && vertex2.isBorder;\r\n var error = 0;\r\n var qDet = q.det(0, 1, 2, 1, 4, 5, 2, 5, 7);\r\n if (qDet !== 0 && !border) {\r\n if (!pointResult) {\r\n pointResult = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n pointResult.x = -1 / qDet * (q.det(1, 2, 3, 4, 5, 6, 5, 7, 8));\r\n pointResult.y = 1 / qDet * (q.det(0, 2, 3, 1, 5, 6, 2, 7, 8));\r\n pointResult.z = -1 / qDet * (q.det(0, 1, 3, 1, 4, 6, 2, 5, 8));\r\n error = this.vertexError(q, pointResult);\r\n }\r\n else {\r\n var p3 = (vertex1.position.add(vertex2.position)).divide(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](2, 2, 2));\r\n //var norm3 = (vertex1.normal.add(vertex2.normal)).divide(new Vector3(2, 2, 2)).normalize();\r\n var error1 = this.vertexError(q, vertex1.position);\r\n var error2 = this.vertexError(q, vertex2.position);\r\n var error3 = this.vertexError(q, p3);\r\n error = Math.min(error1, error2, error3);\r\n if (error === error1) {\r\n if (pointResult) {\r\n pointResult.copyFrom(vertex1.position);\r\n }\r\n }\r\n else if (error === error2) {\r\n if (pointResult) {\r\n pointResult.copyFrom(vertex2.position);\r\n }\r\n }\r\n else {\r\n if (pointResult) {\r\n pointResult.copyFrom(p3);\r\n }\r\n }\r\n }\r\n return error;\r\n };\r\n return QuadraticErrorSimplification;\r\n}());\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/meshSimplificationSceneComponent.ts\":\n/*!****************************************************!*\\\n !*** ./Meshes/meshSimplificationSceneComponent.ts ***!\n \\****************************************************/\n/*! exports provided: SimplicationQueueSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return SimplicationQueueSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _meshSimplification__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./meshSimplification */ \"./Meshes/meshSimplification.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"simplificationQueue\", {\r\n get: function () {\r\n if (!this._simplificationQueue) {\r\n this._simplificationQueue = new _meshSimplification__WEBPACK_IMPORTED_MODULE_2__[\"SimplificationQueue\"]();\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_SIMPLIFICATIONQUEUE);\r\n if (!component) {\r\n component = new SimplicationQueueSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n }\r\n return this._simplificationQueue;\r\n },\r\n set: function (value) {\r\n this._simplificationQueue = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"].prototype.simplify = function (settings, parallelProcessing, simplificationType, successCallback) {\r\n if (parallelProcessing === void 0) { parallelProcessing = true; }\r\n if (simplificationType === void 0) { simplificationType = _meshSimplification__WEBPACK_IMPORTED_MODULE_2__[\"SimplificationType\"].QUADRATIC; }\r\n this.getScene().simplificationQueue.addTask({\r\n settings: settings,\r\n parallelProcessing: parallelProcessing,\r\n mesh: this,\r\n simplificationType: simplificationType,\r\n successCallback: successCallback\r\n });\r\n return this;\r\n};\r\n/**\r\n * Defines the simplification queue scene component responsible to help scheduling the various simplification task\r\n * created in a scene\r\n */\r\nvar SimplicationQueueSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function SimplicationQueueSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_SIMPLIFICATIONQUEUE;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n SimplicationQueueSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraUpdateStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE, this, this._beforeCameraUpdate);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n SimplicationQueueSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n SimplicationQueueSceneComponent.prototype.dispose = function () {\r\n // Nothing to do for this component\r\n };\r\n SimplicationQueueSceneComponent.prototype._beforeCameraUpdate = function () {\r\n if (this.scene._simplificationQueue && !this.scene._simplificationQueue.running) {\r\n this.scene._simplificationQueue.executeNext();\r\n }\r\n };\r\n return SimplicationQueueSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/polygonMesh.ts\":\n/*!*******************************!*\\\n !*** ./Meshes/polygonMesh.ts ***!\n \\*******************************/\n/*! exports provided: Polygon, PolygonMeshBuilder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return Polygon; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return PolygonMeshBuilder; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_path__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.path */ \"./Maths/math.path.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Vector2 wth index property\r\n */\r\nvar IndexedVector2 = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](IndexedVector2, _super);\r\n function IndexedVector2(original, \r\n /** Index of the vector2 */\r\n index) {\r\n var _this = _super.call(this, original.x, original.y) || this;\r\n _this.index = index;\r\n return _this;\r\n }\r\n return IndexedVector2;\r\n}(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"]));\r\n/**\r\n * Defines points to create a polygon\r\n */\r\nvar PolygonPoints = /** @class */ (function () {\r\n function PolygonPoints() {\r\n this.elements = new Array();\r\n }\r\n PolygonPoints.prototype.add = function (originalPoints) {\r\n var _this = this;\r\n var result = new Array();\r\n originalPoints.forEach(function (point) {\r\n if (result.length === 0 || !point.equalsWithEpsilon(result[0])) {\r\n var newPoint = new IndexedVector2(point, _this.elements.length);\r\n result.push(newPoint);\r\n _this.elements.push(newPoint);\r\n }\r\n });\r\n return result;\r\n };\r\n PolygonPoints.prototype.computeBounds = function () {\r\n var lmin = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](this.elements[0].x, this.elements[0].y);\r\n var lmax = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](this.elements[0].x, this.elements[0].y);\r\n this.elements.forEach(function (point) {\r\n // x\r\n if (point.x < lmin.x) {\r\n lmin.x = point.x;\r\n }\r\n else if (point.x > lmax.x) {\r\n lmax.x = point.x;\r\n }\r\n // y\r\n if (point.y < lmin.y) {\r\n lmin.y = point.y;\r\n }\r\n else if (point.y > lmax.y) {\r\n lmax.y = point.y;\r\n }\r\n });\r\n return {\r\n min: lmin,\r\n max: lmax,\r\n width: lmax.x - lmin.x,\r\n height: lmax.y - lmin.y\r\n };\r\n };\r\n return PolygonPoints;\r\n}());\r\n/**\r\n * Polygon\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n */\r\nvar Polygon = /** @class */ (function () {\r\n function Polygon() {\r\n }\r\n /**\r\n * Creates a rectangle\r\n * @param xmin bottom X coord\r\n * @param ymin bottom Y coord\r\n * @param xmax top X coord\r\n * @param ymax top Y coord\r\n * @returns points that make the resulting rectation\r\n */\r\n Polygon.Rectangle = function (xmin, ymin, xmax, ymax) {\r\n return [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmin, ymin),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmax, ymin),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmax, ymax),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](xmin, ymax)\r\n ];\r\n };\r\n /**\r\n * Creates a circle\r\n * @param radius radius of circle\r\n * @param cx scale in x\r\n * @param cy scale in y\r\n * @param numberOfSides number of sides that make up the circle\r\n * @returns points that make the resulting circle\r\n */\r\n Polygon.Circle = function (radius, cx, cy, numberOfSides) {\r\n if (cx === void 0) { cx = 0; }\r\n if (cy === void 0) { cy = 0; }\r\n if (numberOfSides === void 0) { numberOfSides = 32; }\r\n var result = new Array();\r\n var angle = 0;\r\n var increment = (Math.PI * 2) / numberOfSides;\r\n for (var i = 0; i < numberOfSides; i++) {\r\n result.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](cx + Math.cos(angle) * radius, cy + Math.sin(angle) * radius));\r\n angle -= increment;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a polygon from input string\r\n * @param input Input polygon data\r\n * @returns the parsed points\r\n */\r\n Polygon.Parse = function (input) {\r\n var floats = input.split(/[^-+eE\\.\\d]+/).map(parseFloat).filter(function (val) { return (!isNaN(val)); });\r\n var i, result = [];\r\n for (i = 0; i < (floats.length & 0x7FFFFFFE); i += 2) {\r\n result.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](floats[i], floats[i + 1]));\r\n }\r\n return result;\r\n };\r\n /**\r\n * Starts building a polygon from x and y coordinates\r\n * @param x x coordinate\r\n * @param y y coordinate\r\n * @returns the started path2\r\n */\r\n Polygon.StartingAt = function (x, y) {\r\n return _Maths_math_path__WEBPACK_IMPORTED_MODULE_7__[\"Path2\"].StartingAt(x, y);\r\n };\r\n return Polygon;\r\n}());\r\n\r\n/**\r\n * Builds a polygon\r\n * @see https://doc.babylonjs.com/how_to/polygonmeshbuilder\r\n */\r\nvar PolygonMeshBuilder = /** @class */ (function () {\r\n /**\r\n * Creates a PolygonMeshBuilder\r\n * @param name name of the builder\r\n * @param contours Path of the polygon\r\n * @param scene scene to add to when creating the mesh\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n */\r\n function PolygonMeshBuilder(name, contours, scene, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n this._points = new PolygonPoints();\r\n this._outlinepoints = new PolygonPoints();\r\n this._holes = new Array();\r\n this._epoints = new Array();\r\n this._eholes = new Array();\r\n this.bjsEarcut = earcutInjection;\r\n this._name = name;\r\n this._scene = scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_6__[\"Engine\"].LastCreatedScene;\r\n var points;\r\n if (contours instanceof _Maths_math_path__WEBPACK_IMPORTED_MODULE_7__[\"Path2\"]) {\r\n points = contours.getPoints();\r\n }\r\n else {\r\n points = contours;\r\n }\r\n this._addToepoint(points);\r\n this._points.add(points);\r\n this._outlinepoints.add(points);\r\n if (typeof this.bjsEarcut === 'undefined') {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Earcut was not found, the polygon will not be built.\");\r\n }\r\n }\r\n PolygonMeshBuilder.prototype._addToepoint = function (points) {\r\n for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {\r\n var p = points_1[_i];\r\n this._epoints.push(p.x, p.y);\r\n }\r\n };\r\n /**\r\n * Adds a whole within the polygon\r\n * @param hole Array of points defining the hole\r\n * @returns this\r\n */\r\n PolygonMeshBuilder.prototype.addHole = function (hole) {\r\n this._points.add(hole);\r\n var holepoints = new PolygonPoints();\r\n holepoints.add(hole);\r\n this._holes.push(holepoints);\r\n this._eholes.push(this._epoints.length / 2);\r\n this._addToepoint(hole);\r\n return this;\r\n };\r\n /**\r\n * Creates the polygon\r\n * @param updatable If the mesh should be updatable\r\n * @param depth The depth of the mesh created\r\n * @returns the created mesh\r\n */\r\n PolygonMeshBuilder.prototype.build = function (updatable, depth) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (depth === void 0) { depth = 0; }\r\n var result = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](this._name, this._scene);\r\n var vertexData = this.buildVertexData(depth);\r\n result.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, vertexData.positions, updatable);\r\n result.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, vertexData.normals, updatable);\r\n result.setVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind, vertexData.uvs, updatable);\r\n result.setIndices(vertexData.indices);\r\n return result;\r\n };\r\n /**\r\n * Creates the polygon\r\n * @param depth The depth of the mesh created\r\n * @returns the created VertexData\r\n */\r\n PolygonMeshBuilder.prototype.buildVertexData = function (depth) {\r\n var _this = this;\r\n if (depth === void 0) { depth = 0; }\r\n var result = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"]();\r\n var normals = new Array();\r\n var positions = new Array();\r\n var uvs = new Array();\r\n var bounds = this._points.computeBounds();\r\n this._points.elements.forEach(function (p) {\r\n normals.push(0, 1.0, 0);\r\n positions.push(p.x, 0, p.y);\r\n uvs.push((p.x - bounds.min.x) / bounds.width, (p.y - bounds.min.y) / bounds.height);\r\n });\r\n var indices = new Array();\r\n var res = this.bjsEarcut(this._epoints, this._eholes, 2);\r\n for (var i = 0; i < res.length; i++) {\r\n indices.push(res[i]);\r\n }\r\n if (depth > 0) {\r\n var positionscount = (positions.length / 3); //get the current pointcount\r\n this._points.elements.forEach(function (p) {\r\n normals.push(0, -1.0, 0);\r\n positions.push(p.x, -depth, p.y);\r\n uvs.push(1 - (p.x - bounds.min.x) / bounds.width, 1 - (p.y - bounds.min.y) / bounds.height);\r\n });\r\n var totalCount = indices.length;\r\n for (var i = 0; i < totalCount; i += 3) {\r\n var i0 = indices[i + 0];\r\n var i1 = indices[i + 1];\r\n var i2 = indices[i + 2];\r\n indices.push(i2 + positionscount);\r\n indices.push(i1 + positionscount);\r\n indices.push(i0 + positionscount);\r\n }\r\n //Add the sides\r\n this.addSide(positions, normals, uvs, indices, bounds, this._outlinepoints, depth, false);\r\n this._holes.forEach(function (hole) {\r\n _this.addSide(positions, normals, uvs, indices, bounds, hole, depth, true);\r\n });\r\n }\r\n result.indices = indices;\r\n result.positions = positions;\r\n result.normals = normals;\r\n result.uvs = uvs;\r\n return result;\r\n };\r\n /**\r\n * Adds a side to the polygon\r\n * @param positions points that make the polygon\r\n * @param normals normals of the polygon\r\n * @param uvs uvs of the polygon\r\n * @param indices indices of the polygon\r\n * @param bounds bounds of the polygon\r\n * @param points points of the polygon\r\n * @param depth depth of the polygon\r\n * @param flip flip of the polygon\r\n */\r\n PolygonMeshBuilder.prototype.addSide = function (positions, normals, uvs, indices, bounds, points, depth, flip) {\r\n var StartIndex = positions.length / 3;\r\n var ulength = 0;\r\n for (var i = 0; i < points.elements.length; i++) {\r\n var p = points.elements[i];\r\n var p1;\r\n if ((i + 1) > points.elements.length - 1) {\r\n p1 = points.elements[0];\r\n }\r\n else {\r\n p1 = points.elements[i + 1];\r\n }\r\n positions.push(p.x, 0, p.y);\r\n positions.push(p.x, -depth, p.y);\r\n positions.push(p1.x, 0, p1.y);\r\n positions.push(p1.x, -depth, p1.y);\r\n var v1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](p.x, 0, p.y);\r\n var v2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](p1.x, 0, p1.y);\r\n var v3 = v2.subtract(v1);\r\n var v4 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, 1, 0);\r\n var vn = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(v3, v4);\r\n vn = vn.normalize();\r\n uvs.push(ulength / bounds.width, 0);\r\n uvs.push(ulength / bounds.width, 1);\r\n ulength += v3.length();\r\n uvs.push((ulength / bounds.width), 0);\r\n uvs.push((ulength / bounds.width), 1);\r\n if (!flip) {\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n normals.push(-vn.x, -vn.y, -vn.z);\r\n indices.push(StartIndex);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 2);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 3);\r\n indices.push(StartIndex + 2);\r\n }\r\n else {\r\n normals.push(vn.x, vn.y, vn.z);\r\n normals.push(vn.x, vn.y, vn.z);\r\n normals.push(vn.x, vn.y, vn.z);\r\n normals.push(vn.x, vn.y, vn.z);\r\n indices.push(StartIndex);\r\n indices.push(StartIndex + 2);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 1);\r\n indices.push(StartIndex + 2);\r\n indices.push(StartIndex + 3);\r\n }\r\n StartIndex += 4;\r\n }\r\n };\r\n return PolygonMeshBuilder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/subMesh.ts\":\n/*!***************************!*\\\n !*** ./Meshes/subMesh.ts ***!\n \\***************************/\n/*! exports provided: BaseSubMesh, SubMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return BaseSubMesh; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return SubMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Collisions/intersectionInfo */ \"./Collisions/intersectionInfo.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_functions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.functions */ \"./Maths/math.functions.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Base class for submeshes\r\n */\r\nvar BaseSubMesh = /** @class */ (function () {\r\n function BaseSubMesh() {\r\n /** @hidden */\r\n this._materialDefines = null;\r\n /** @hidden */\r\n this._materialEffect = null;\r\n }\r\n Object.defineProperty(BaseSubMesh.prototype, \"effect\", {\r\n /**\r\n * Gets associated effect\r\n */\r\n get: function () {\r\n return this._materialEffect;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets associated effect (effect used to render this submesh)\r\n * @param effect defines the effect to associate with\r\n * @param defines defines the set of defines used to compile this effect\r\n */\r\n BaseSubMesh.prototype.setEffect = function (effect, defines) {\r\n if (defines === void 0) { defines = null; }\r\n if (this._materialEffect === effect) {\r\n if (!effect) {\r\n this._materialDefines = null;\r\n }\r\n return;\r\n }\r\n this._materialDefines = defines;\r\n this._materialEffect = effect;\r\n };\r\n return BaseSubMesh;\r\n}());\r\n\r\n/**\r\n * Defines a subdivision inside a mesh\r\n */\r\nvar SubMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SubMesh, _super);\r\n /**\r\n * Creates a new submesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n */\r\n function SubMesh(\r\n /** the material index to use */\r\n materialIndex, \r\n /** vertex index start */\r\n verticesStart, \r\n /** vertices count */\r\n verticesCount, \r\n /** index start */\r\n indexStart, \r\n /** indices count */\r\n indexCount, mesh, renderingMesh, createBoundingBox) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n var _this = _super.call(this) || this;\r\n _this.materialIndex = materialIndex;\r\n _this.verticesStart = verticesStart;\r\n _this.verticesCount = verticesCount;\r\n _this.indexStart = indexStart;\r\n _this.indexCount = indexCount;\r\n /** @hidden */\r\n _this._linesIndexCount = 0;\r\n _this._linesIndexBuffer = null;\r\n /** @hidden */\r\n _this._lastColliderWorldVertices = null;\r\n /** @hidden */\r\n _this._lastColliderTransformMatrix = null;\r\n /** @hidden */\r\n _this._renderId = 0;\r\n /** @hidden */\r\n _this._alphaIndex = 0;\r\n /** @hidden */\r\n _this._distanceToCamera = 0;\r\n _this._currentMaterial = null;\r\n _this._mesh = mesh;\r\n _this._renderingMesh = renderingMesh || mesh;\r\n mesh.subMeshes.push(_this);\r\n _this._trianglePlanes = [];\r\n _this._id = mesh.subMeshes.length - 1;\r\n if (createBoundingBox) {\r\n _this.refreshBoundingInfo();\r\n mesh.computeWorldMatrix(true);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Add a new submesh to a mesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.AddToMesh = function (materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);\r\n };\r\n Object.defineProperty(SubMesh.prototype, \"IsGlobal\", {\r\n /**\r\n * Returns true if this submesh covers the entire parent mesh\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the submesh BoudingInfo object\r\n * @returns current bounding info (or mesh's one if the submesh is global)\r\n */\r\n SubMesh.prototype.getBoundingInfo = function () {\r\n if (this.IsGlobal) {\r\n return this._mesh.getBoundingInfo();\r\n }\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Sets the submesh BoundingInfo\r\n * @param boundingInfo defines the new bounding info to use\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh of the current submesh\r\n * @return the parent mesh\r\n */\r\n SubMesh.prototype.getMesh = function () {\r\n return this._mesh;\r\n };\r\n /**\r\n * Returns the rendering mesh of the submesh\r\n * @returns the rendering mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getRenderingMesh = function () {\r\n return this._renderingMesh;\r\n };\r\n /**\r\n * Returns the submesh material\r\n * @returns null or the current material\r\n */\r\n SubMesh.prototype.getMaterial = function () {\r\n var rootMaterial = this._renderingMesh.material;\r\n if (rootMaterial === null || rootMaterial === undefined) {\r\n return this._mesh.getScene().defaultMaterial;\r\n }\r\n else if (rootMaterial.getSubMaterial) {\r\n var multiMaterial = rootMaterial;\r\n var effectiveMaterial = multiMaterial.getSubMaterial(this.materialIndex);\r\n if (this._currentMaterial !== effectiveMaterial) {\r\n this._currentMaterial = effectiveMaterial;\r\n this._materialDefines = null;\r\n }\r\n return effectiveMaterial;\r\n }\r\n return rootMaterial;\r\n };\r\n // Methods\r\n /**\r\n * Sets a new updated BoundingInfo object to the submesh\r\n * @param data defines an optional position array to use to determine the bounding info\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.refreshBoundingInfo = function (data) {\r\n if (data === void 0) { data = null; }\r\n this._lastColliderWorldVertices = null;\r\n if (this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) {\r\n return this;\r\n }\r\n if (!data) {\r\n data = this._renderingMesh.getVerticesData(_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n }\r\n if (!data) {\r\n this._boundingInfo = this._mesh.getBoundingInfo();\r\n return this;\r\n }\r\n var indices = this._renderingMesh.getIndices();\r\n var extend;\r\n //is this the only submesh?\r\n if (this.indexStart === 0 && this.indexCount === indices.length) {\r\n var boundingInfo = this._renderingMesh.getBoundingInfo();\r\n //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.\r\n extend = { minimum: boundingInfo.minimum.clone(), maximum: boundingInfo.maximum.clone() };\r\n }\r\n else {\r\n extend = Object(_Maths_math_functions__WEBPACK_IMPORTED_MODULE_5__[\"extractMinAndMaxIndexed\"])(data, indices, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);\r\n }\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_3__[\"BoundingInfo\"](extend.minimum, extend.maximum);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._checkCollision = function (collider) {\r\n var boundingInfo = this.getBoundingInfo();\r\n return boundingInfo._checkCollision(collider);\r\n };\r\n /**\r\n * Updates the submesh BoundingInfo\r\n * @param world defines the world matrix to use to update the bounding info\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.updateBoundingInfo = function (world) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n this.refreshBoundingInfo();\r\n boundingInfo = this.getBoundingInfo();\r\n }\r\n boundingInfo.update(world);\r\n return this;\r\n };\r\n /**\r\n * True is the submesh bounding box intersects the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is intersecting with the frustum\r\n */\r\n SubMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isInFrustum(frustumPlanes, this._mesh.cullingStrategy);\r\n };\r\n /**\r\n * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is inside the frustum\r\n */\r\n SubMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * Renders the submesh\r\n * @param enableAlphaMode defines if alpha needs to be used\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.render = function (enableAlphaMode) {\r\n this._renderingMesh.render(this, enableAlphaMode);\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n SubMesh.prototype._getLinesIndexBuffer = function (indices, engine) {\r\n if (!this._linesIndexBuffer) {\r\n var linesIndices = [];\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n linesIndices.push(indices[index], indices[index + 1], indices[index + 1], indices[index + 2], indices[index + 2], indices[index]);\r\n }\r\n this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);\r\n this._linesIndexCount = linesIndices.length;\r\n }\r\n return this._linesIndexBuffer;\r\n };\r\n /**\r\n * Checks if the submesh intersects with a ray\r\n * @param ray defines the ray to test\r\n * @returns true is the passed ray intersects the submesh bounding box\r\n */\r\n SubMesh.prototype.canIntersects = function (ray) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return ray.intersectsBox(boundingInfo.boundingBox);\r\n };\r\n /**\r\n * Intersects current submesh with a ray\r\n * @param ray defines the ray to test\r\n * @param positions defines mesh's positions array\r\n * @param indices defines mesh's indices array\r\n * @param fastCheck defines if only bounding info should be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns intersection info or null if no intersection\r\n */\r\n SubMesh.prototype.intersects = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var material = this.getMaterial();\r\n if (!material) {\r\n return null;\r\n }\r\n switch (material.fillMode) {\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_PointListDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_LineListDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_LineLoopDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_LineStripDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_TriangleFanDrawMode:\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].MATERIAL_TriangleStripDrawMode:\r\n return null;\r\n }\r\n // LineMesh first as it's also a Mesh...\r\n if (this._mesh.getClassName() === \"InstancedLinesMesh\" || this._mesh.getClassName() === \"LinesMesh\") {\r\n // Check if mesh is unindexed\r\n if (!indices.length) {\r\n return this._intersectUnIndexedLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n return this._intersectLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n else {\r\n // Check if mesh is unindexed\r\n if (!indices.length && this._mesh._unIndexed) {\r\n return this._intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n return this._intersectTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 2) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_2__[\"IntersectionInfo\"](null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 2) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new _Collisions_intersectionInfo__WEBPACK_IMPORTED_MODULE_2__[\"IntersectionInfo\"](null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectTriangles = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n var p2 = positions[indices[index + 2]];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedTriangles = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 3) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var p2 = positions[index + 2];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._rebuild = function () {\r\n if (this._linesIndexBuffer) {\r\n this._linesIndexBuffer = null;\r\n }\r\n };\r\n // Clone\r\n /**\r\n * Creates a new submesh from the passed mesh\r\n * @param newMesh defines the new hosting mesh\r\n * @param newRenderingMesh defines an optional rendering mesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.prototype.clone = function (newMesh, newRenderingMesh) {\r\n var result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);\r\n if (!this.IsGlobal) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return result;\r\n }\r\n result._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_3__[\"BoundingInfo\"](boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n return result;\r\n };\r\n // Dispose\r\n /**\r\n * Release associated resources\r\n */\r\n SubMesh.prototype.dispose = function () {\r\n if (this._linesIndexBuffer) {\r\n this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer);\r\n this._linesIndexBuffer = null;\r\n }\r\n // Remove from mesh\r\n var index = this._mesh.subMeshes.indexOf(this);\r\n this._mesh.subMeshes.splice(index, 1);\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"SubMesh\".\r\n */\r\n SubMesh.prototype.getClassName = function () {\r\n return \"SubMesh\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new submesh from indices data\r\n * @param materialIndex the index of the main mesh material\r\n * @param startIndex the index where to start the copy in the mesh indices array\r\n * @param indexCount the number of indices to copy then from the startIndex\r\n * @param mesh the main mesh to create the submesh from\r\n * @param renderingMesh the optional rendering mesh\r\n * @returns a new submesh\r\n */\r\n SubMesh.CreateFromIndices = function (materialIndex, startIndex, indexCount, mesh, renderingMesh) {\r\n var minVertexIndex = Number.MAX_VALUE;\r\n var maxVertexIndex = -Number.MAX_VALUE;\r\n var whatWillRender = (renderingMesh || mesh);\r\n var indices = whatWillRender.getIndices();\r\n for (var index = startIndex; index < startIndex + indexCount; index++) {\r\n var vertexIndex = indices[index];\r\n if (vertexIndex < minVertexIndex) {\r\n minVertexIndex = vertexIndex;\r\n }\r\n if (vertexIndex > maxVertexIndex) {\r\n maxVertexIndex = vertexIndex;\r\n }\r\n }\r\n return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh);\r\n };\r\n return SubMesh;\r\n}(BaseSubMesh));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/trailMesh.ts\":\n/*!*****************************!*\\\n !*** ./Meshes/trailMesh.ts ***!\n \\*****************************/\n/*! exports provided: TrailMesh */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return TrailMesh; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to create a trail following a mesh\r\n */\r\nvar TrailMesh = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TrailMesh, _super);\r\n /**\r\n * @constructor\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param generator The mesh to generate a trail.\r\n * @param scene The scene to add this mesh to.\r\n * @param diameter Diameter of trailing mesh. Default is 1.\r\n * @param length Length of trailing mesh. Default is 60.\r\n * @param autoStart Automatically start trailing mesh. Default true.\r\n */\r\n function TrailMesh(name, generator, scene, diameter, length, autoStart) {\r\n if (diameter === void 0) { diameter = 1; }\r\n if (length === void 0) { length = 60; }\r\n if (autoStart === void 0) { autoStart = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._sectionPolygonPointsCount = 4;\r\n _this._running = false;\r\n _this._autoStart = autoStart;\r\n _this._generator = generator;\r\n _this._diameter = diameter;\r\n _this._length = length;\r\n _this._sectionVectors = [];\r\n _this._sectionNormalVectors = [];\r\n for (var i = 0; i < _this._sectionPolygonPointsCount; i++) {\r\n _this._sectionVectors[i] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n _this._sectionNormalVectors[i] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n }\r\n _this._createMesh();\r\n return _this;\r\n }\r\n /**\r\n * \"TrailMesh\"\r\n * @returns \"TrailMesh\"\r\n */\r\n TrailMesh.prototype.getClassName = function () {\r\n return \"TrailMesh\";\r\n };\r\n TrailMesh.prototype._createMesh = function () {\r\n var data = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_4__[\"VertexData\"]();\r\n var positions = [];\r\n var normals = [];\r\n var indices = [];\r\n var meshCenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n if (this._generator._boundingInfo) {\r\n meshCenter = this._generator._boundingInfo.boundingBox.centerWorld;\r\n }\r\n var alpha = 2 * Math.PI / this._sectionPolygonPointsCount;\r\n for (var i = 0; i < this._sectionPolygonPointsCount; i++) {\r\n positions.push(meshCenter.x + Math.cos(i * alpha) * this._diameter, meshCenter.y + Math.sin(i * alpha) * this._diameter, meshCenter.z);\r\n }\r\n for (var i = 1; i <= this._length; i++) {\r\n for (var j = 0; j < this._sectionPolygonPointsCount; j++) {\r\n positions.push(meshCenter.x + Math.cos(j * alpha) * this._diameter, meshCenter.y + Math.sin(j * alpha) * this._diameter, meshCenter.z);\r\n }\r\n var l = positions.length / 3 - 2 * this._sectionPolygonPointsCount;\r\n for (var j = 0; j < this._sectionPolygonPointsCount - 1; j++) {\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount, l + j + this._sectionPolygonPointsCount + 1);\r\n indices.push(l + j, l + j + this._sectionPolygonPointsCount + 1, l + j + 1);\r\n }\r\n indices.push(l + this._sectionPolygonPointsCount - 1, l + this._sectionPolygonPointsCount - 1 + this._sectionPolygonPointsCount, l + this._sectionPolygonPointsCount);\r\n indices.push(l + this._sectionPolygonPointsCount - 1, l + this._sectionPolygonPointsCount, l);\r\n }\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_4__[\"VertexData\"].ComputeNormals(positions, indices, normals);\r\n data.positions = positions;\r\n data.normals = normals;\r\n data.indices = indices;\r\n data.applyToMesh(this, true);\r\n if (this._autoStart) {\r\n this.start();\r\n }\r\n };\r\n /**\r\n * Start trailing mesh.\r\n */\r\n TrailMesh.prototype.start = function () {\r\n var _this = this;\r\n if (!this._running) {\r\n this._running = true;\r\n this._beforeRenderObserver = this.getScene().onBeforeRenderObservable.add(function () {\r\n _this.update();\r\n });\r\n }\r\n };\r\n /**\r\n * Stop trailing mesh.\r\n */\r\n TrailMesh.prototype.stop = function () {\r\n if (this._beforeRenderObserver && this._running) {\r\n this._running = false;\r\n this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n };\r\n /**\r\n * Update trailing mesh geometry.\r\n */\r\n TrailMesh.prototype.update = function () {\r\n var positions = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind);\r\n var normals = this.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind);\r\n var wm = this._generator.getWorldMatrix();\r\n if (positions && normals) {\r\n for (var i = 3 * this._sectionPolygonPointsCount; i < positions.length; i++) {\r\n positions[i - 3 * this._sectionPolygonPointsCount] = positions[i] - normals[i] / this._length * this._diameter;\r\n }\r\n for (var i = 3 * this._sectionPolygonPointsCount; i < normals.length; i++) {\r\n normals[i - 3 * this._sectionPolygonPointsCount] = normals[i];\r\n }\r\n var l = positions.length - 3 * this._sectionPolygonPointsCount;\r\n var alpha = 2 * Math.PI / this._sectionPolygonPointsCount;\r\n for (var i = 0; i < this._sectionPolygonPointsCount; i++) {\r\n this._sectionVectors[i].copyFromFloats(Math.cos(i * alpha) * this._diameter, Math.sin(i * alpha) * this._diameter, 0);\r\n this._sectionNormalVectors[i].copyFromFloats(Math.cos(i * alpha), Math.sin(i * alpha), 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformCoordinatesToRef(this._sectionVectors[i], wm, this._sectionVectors[i]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].TransformNormalToRef(this._sectionNormalVectors[i], wm, this._sectionNormalVectors[i]);\r\n }\r\n for (var i = 0; i < this._sectionPolygonPointsCount; i++) {\r\n positions[l + 3 * i] = this._sectionVectors[i].x;\r\n positions[l + 3 * i + 1] = this._sectionVectors[i].y;\r\n positions[l + 3 * i + 2] = this._sectionVectors[i].z;\r\n normals[l + 3 * i] = this._sectionNormalVectors[i].x;\r\n normals[l + 3 * i + 1] = this._sectionNormalVectors[i].y;\r\n normals[l + 3 * i + 2] = this._sectionNormalVectors[i].z;\r\n }\r\n this.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind, positions, true, false);\r\n this.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind, normals, true, false);\r\n }\r\n };\r\n /**\r\n * Returns a new TrailMesh object.\r\n * @param name is a string, the name given to the new mesh\r\n * @param newGenerator use new generator object for cloned trail mesh\r\n * @returns a new mesh\r\n */\r\n TrailMesh.prototype.clone = function (name, newGenerator) {\r\n if (name === void 0) { name = \"\"; }\r\n return new TrailMesh(name, (newGenerator === undefined ? this._generator : newGenerator), this.getScene(), this._diameter, this._length, this._autoStart);\r\n };\r\n /**\r\n * Serializes this trail mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n TrailMesh.prototype.serialize = function (serializationObject) {\r\n _super.prototype.serialize.call(this, serializationObject);\r\n };\r\n /**\r\n * Parses a serialized trail mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the trail mesh in\r\n * @returns the created trail mesh\r\n */\r\n TrailMesh.Parse = function (parsedMesh, scene) {\r\n return new TrailMesh(parsedMesh.name, parsedMesh._generator, scene, parsedMesh._diameter, parsedMesh._length, parsedMesh._autoStart);\r\n };\r\n return TrailMesh;\r\n}(_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__[\"Mesh\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Meshes/transformNode.ts\":\n/*!*********************************!*\\\n !*** ./Meshes/transformNode.ts ***!\n \\*********************************/\n/*! exports provided: TransformNode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return TransformNode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node */ \"./node.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.\r\n * @see https://doc.babylonjs.com/how_to/transformnode\r\n */\r\nvar TransformNode = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TransformNode, _super);\r\n function TransformNode(name, scene, isPure) {\r\n if (scene === void 0) { scene = null; }\r\n if (isPure === void 0) { isPure = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._forward = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 1);\r\n _this._forwardInverted = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, -1);\r\n _this._up = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 1, 0);\r\n _this._right = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1, 0, 0);\r\n _this._rightInverted = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](-1, 0, 0);\r\n // Properties\r\n _this._position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._rotationQuaternion = null;\r\n _this._scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].One();\r\n _this._isDirty = false;\r\n _this._transformToBoneReferal = null;\r\n _this._isAbsoluteSynced = false;\r\n _this._billboardMode = TransformNode.BILLBOARDMODE_NONE;\r\n _this._preserveParentRotationForBillboard = false;\r\n /**\r\n * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube\r\n */\r\n _this.scalingDeterminant = 1;\r\n _this._infiniteDistance = false;\r\n /**\r\n * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.\r\n * By default the system will update normals to compensate\r\n */\r\n _this.ignoreNonUniformScaling = false;\r\n /**\r\n * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both\r\n */\r\n _this.reIntegrateRotationIntoRotationQuaternion = false;\r\n // Cache\r\n /** @hidden */\r\n _this._poseMatrix = null;\r\n /** @hidden */\r\n _this._localMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Zero();\r\n _this._usePivotMatrix = false;\r\n _this._absolutePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._absoluteScaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._absoluteRotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].Identity();\r\n _this._pivotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n _this._postMultiplyPivotMatrix = false;\r\n _this._isWorldMatrixFrozen = false;\r\n /** @hidden */\r\n _this._indexInSceneTransformNodesArray = -1;\r\n /**\r\n * An event triggered after the world matrix is updated\r\n */\r\n _this.onAfterWorldMatrixUpdateObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._nonUniformScaling = false;\r\n if (isPure) {\r\n _this.getScene().addTransformNode(_this);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(TransformNode.prototype, \"billboardMode\", {\r\n /**\r\n * Gets or sets the billboard mode. Default is 0.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | BILLBOARDMODE_NONE | |\r\n * | 1 | BILLBOARDMODE_X | |\r\n * | 2 | BILLBOARDMODE_Y | |\r\n * | 4 | BILLBOARDMODE_Z | |\r\n * | 7 | BILLBOARDMODE_ALL | |\r\n *\r\n */\r\n get: function () {\r\n return this._billboardMode;\r\n },\r\n set: function (value) {\r\n if (this._billboardMode === value) {\r\n return;\r\n }\r\n this._billboardMode = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"preserveParentRotationForBillboard\", {\r\n /**\r\n * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.\r\n * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed\r\n */\r\n get: function () {\r\n return this._preserveParentRotationForBillboard;\r\n },\r\n set: function (value) {\r\n if (value === this._preserveParentRotationForBillboard) {\r\n return;\r\n }\r\n this._preserveParentRotationForBillboard = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"infiniteDistance\", {\r\n /**\r\n * Gets or sets the distance of the object to max, often used by skybox\r\n */\r\n get: function () {\r\n return this._infiniteDistance;\r\n },\r\n set: function (value) {\r\n if (this._infiniteDistance === value) {\r\n return;\r\n }\r\n this._infiniteDistance = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"TransformNode\" string\r\n */\r\n TransformNode.prototype.getClassName = function () {\r\n return \"TransformNode\";\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"position\", {\r\n /**\r\n * Gets or set the node position (default is (0.0, 0.0, 0.0))\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotation\", {\r\n /**\r\n * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion\r\n */\r\n get: function () {\r\n return this._rotation;\r\n },\r\n set: function (newRotation) {\r\n this._rotation = newRotation;\r\n this._rotationQuaternion = null;\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotationQuaternion\", {\r\n /**\r\n * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).\r\n * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)\r\n */\r\n get: function () {\r\n return this._rotationQuaternion;\r\n },\r\n set: function (quaternion) {\r\n this._rotationQuaternion = quaternion;\r\n //reset the rotation vector.\r\n if (quaternion) {\r\n this._rotation.setAll(0.0);\r\n }\r\n this._isDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"forward\", {\r\n /**\r\n * The forward direction of that transform in world space.\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this.getScene().useRightHandedSystem ? this._forwardInverted : this._forward, this.getWorldMatrix()));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"up\", {\r\n /**\r\n * The up direction of that transform in world space.\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this._up, this.getWorldMatrix()));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"right\", {\r\n /**\r\n * The right direction of that transform in world space.\r\n */\r\n get: function () {\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Normalize(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this.getScene().useRightHandedSystem ? this._rightInverted : this._right, this.getWorldMatrix()));\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies the parameter passed Matrix into the mesh Pose matrix.\r\n * @param matrix the matrix to copy the pose from\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.updatePoseMatrix = function (matrix) {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = matrix.clone();\r\n return this;\r\n }\r\n this._poseMatrix.copyFrom(matrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh Pose matrix.\r\n * @returns the pose matrix\r\n */\r\n TransformNode.prototype.getPoseMatrix = function () {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n }\r\n return this._poseMatrix;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._isSynchronized = function () {\r\n var cache = this._cache;\r\n if (this.billboardMode !== cache.billboardMode || this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n return false;\r\n }\r\n if (cache.pivotMatrixUpdated) {\r\n return false;\r\n }\r\n if (this.infiniteDistance) {\r\n return false;\r\n }\r\n if (!cache.position.equals(this._position)) {\r\n return false;\r\n }\r\n if (this._rotationQuaternion) {\r\n if (!cache.rotationQuaternion.equals(this._rotationQuaternion)) {\r\n return false;\r\n }\r\n }\r\n else if (!cache.rotation.equals(this._rotation)) {\r\n return false;\r\n }\r\n if (!cache.scaling.equals(this._scaling)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n var cache = this._cache;\r\n cache.localMatrixUpdated = false;\r\n cache.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n cache.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n cache.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n cache.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"](0, 0, 0, 0);\r\n cache.billboardMode = -1;\r\n cache.infiniteDistance = false;\r\n };\r\n /**\r\n * Flag the transform node as dirty (Forcing it to update everything)\r\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\r\n * @returns this transform node\r\n */\r\n TransformNode.prototype.markAsDirty = function (property) {\r\n this._currentRenderId = Number.MAX_VALUE;\r\n this._isDirty = true;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"absolutePosition\", {\r\n /**\r\n * Returns the current mesh absolute position.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n return this._absolutePosition;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteScaling\", {\r\n /**\r\n * Returns the current mesh absolute scaling.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteScaling;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteRotationQuaternion\", {\r\n /**\r\n * Returns the current mesh absolute rotation.\r\n * Returns a Quaternion.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteRotationQuaternion;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets a new matrix to apply before all other transformation\r\n * @param matrix defines the transform matrix\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPreTransformMatrix = function (matrix) {\r\n return this.setPivotMatrix(matrix, false);\r\n };\r\n /**\r\n * Sets a new pivot matrix to the current node\r\n * @param matrix defines the new pivot matrix to use\r\n * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {\r\n if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = true; }\r\n this._pivotMatrix.copyFrom(matrix);\r\n this._usePivotMatrix = !this._pivotMatrix.isIdentity();\r\n this._cache.pivotMatrixUpdated = true;\r\n this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;\r\n if (this._postMultiplyPivotMatrix) {\r\n if (!this._pivotMatrixInverse) {\r\n this._pivotMatrixInverse = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(this._pivotMatrix);\r\n }\r\n else {\r\n this._pivotMatrix.invertToRef(this._pivotMatrixInverse);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh pivot matrix.\r\n * Default : Identity.\r\n * @returns the matrix\r\n */\r\n TransformNode.prototype.getPivotMatrix = function () {\r\n return this._pivotMatrix;\r\n };\r\n /**\r\n * Instantiate (when possible) or clone that node with its hierarchy\r\n * @param newParent defines the new parent to use for the instance (or clone)\r\n * @returns an instance (or a clone) of the current node with its hiearchy\r\n */\r\n TransformNode.prototype.instantiateHierarychy = function (newParent) {\r\n if (newParent === void 0) { newParent = null; }\r\n var clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarychy(clone);\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Prevents the World matrix to be computed any longer\r\n * @param newWorldMatrix defines an optional matrix to use as world matrix\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.freezeWorldMatrix = function (newWorldMatrix) {\r\n if (newWorldMatrix === void 0) { newWorldMatrix = null; }\r\n if (newWorldMatrix) {\r\n this._worldMatrix = this._worldMatrix;\r\n }\r\n else {\r\n this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily\r\n this.computeWorldMatrix(true);\r\n }\r\n this._isWorldMatrixFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * Allows back the World matrix computation.\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unfreezeWorldMatrix = function () {\r\n this._isWorldMatrixFrozen = false;\r\n this.computeWorldMatrix(true);\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"isWorldMatrixFrozen\", {\r\n /**\r\n * True if the World matrix has been frozen.\r\n */\r\n get: function () {\r\n return this._isWorldMatrixFrozen;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Retuns the mesh absolute position in the World.\r\n * @returns a Vector3.\r\n */\r\n TransformNode.prototype.getAbsolutePosition = function () {\r\n this.computeWorldMatrix();\r\n return this._absolutePosition;\r\n };\r\n /**\r\n * Sets the mesh absolute position in the World from a Vector3 or an Array(3).\r\n * @param absolutePosition the absolute position to set\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setAbsolutePosition = function (absolutePosition) {\r\n if (!absolutePosition) {\r\n return this;\r\n }\r\n var absolutePositionX;\r\n var absolutePositionY;\r\n var absolutePositionZ;\r\n if (absolutePosition.x === undefined) {\r\n if (arguments.length < 3) {\r\n return this;\r\n }\r\n absolutePositionX = arguments[0];\r\n absolutePositionY = arguments[1];\r\n absolutePositionZ = arguments[2];\r\n }\r\n else {\r\n absolutePositionX = absolutePosition.x;\r\n absolutePositionY = absolutePosition.y;\r\n absolutePositionZ = absolutePosition.z;\r\n }\r\n if (this.parent) {\r\n var invertParentWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);\r\n }\r\n else {\r\n this.position.x = absolutePositionX;\r\n this.position.y = absolutePositionY;\r\n this.position.z = absolutePositionZ;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh position in its local space.\r\n * @param vector3 the position to set in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setPositionWithLocalVector = function (vector3) {\r\n this.computeWorldMatrix();\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh position in the local space from the current World matrix values.\r\n * @returns a new Vector3.\r\n */\r\n TransformNode.prototype.getPositionExpressedInLocalSpace = function () {\r\n this.computeWorldMatrix();\r\n var invLocalWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this._localMatrix.invertToRef(invLocalWorldMatrix);\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(this.position, invLocalWorldMatrix);\r\n };\r\n /**\r\n * Translates the mesh along the passed Vector3 in its local space.\r\n * @param vector3 the distance to translate in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.locallyTranslate = function (vector3) {\r\n this.computeWorldMatrix(true);\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Orients a mesh towards a target point. Mesh must be drawn facing user.\r\n * @param targetPoint the position (must be in same space as current mesh) to look at\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @param space the choosen space of the target\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.lookAt = function (targetPoint, yawCor, pitchCor, rollCor, space) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL; }\r\n var dv = TransformNode._lookAtVectorCache;\r\n var pos = space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL ? this.position : this.getAbsolutePosition();\r\n targetPoint.subtractToRef(pos, dv);\r\n this.setDirection(dv, yawCor, pitchCor, rollCor);\r\n // Correct for parent's rotation offset\r\n if (space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].WORLD && this.parent) {\r\n if (this.rotationQuaternion) {\r\n // Get local rotation matrix of the looking object\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this.rotationQuaternion.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n this.rotationQuaternion.fromRotationMatrix(rotationMatrix);\r\n }\r\n else {\r\n // Get local rotation matrix of the looking object\r\n var quaternionRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].FromEulerVectorToRef(this.rotation, quaternionRotation);\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n quaternionRotation.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n quaternionRotation.fromRotationMatrix(rotationMatrix);\r\n quaternionRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n * This Vector3 is expressed in the World space.\r\n * @param localAxis axis to rotate\r\n * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n */\r\n TransformNode.prototype.getDirection = function (localAxis) {\r\n var result = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" as the rotated Vector3 \"localAxis\" in the same rotation than the mesh.\r\n * localAxis is expressed in the mesh local space.\r\n * result is computed in the Wordl space from the mesh World matrix.\r\n * @param localAxis axis to rotate\r\n * @param result the resulting transformnode\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getDirectionToRef = function (localAxis, result) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Sets this transform node rotation to the given local axis.\r\n * @param localAxis the axis in local space\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @returns this TransformNode\r\n */\r\n TransformNode.prototype.setDirection = function (localAxis, yawCor, pitchCor, rollCor) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;\r\n var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);\r\n var pitch = -Math.atan2(localAxis.y, len);\r\n if (this.rotationQuaternion) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);\r\n }\r\n else {\r\n this.rotation.x = pitch + pitchCor;\r\n this.rotation.y = yaw + yawCor;\r\n this.rotation.z = rollCor;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a new pivot point to the current node\r\n * @param point defines the new pivot point to use\r\n * @param space defines if the point is in world or local space (local by default)\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotPoint = function (point, space) {\r\n if (space === void 0) { space = _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL; }\r\n if (this.getScene().getRenderId() == 0) {\r\n this.computeWorldMatrix(true);\r\n }\r\n var wm = this.getWorldMatrix();\r\n if (space == _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].WORLD) {\r\n var tmat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n wm.invertToRef(tmat);\r\n point = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(point, tmat);\r\n }\r\n return this.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Translation(-point.x, -point.y, -point.z), true);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.\r\n * @returns the pivot point\r\n */\r\n TransformNode.prototype.getPivotPoint = function () {\r\n var point = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getPivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the passed Vector3 \"result\" with the coordinates of the mesh pivot point in the local space.\r\n * @param result the vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getPivotPointToRef = function (result) {\r\n result.x = -this._pivotMatrix.m[12];\r\n result.y = -this._pivotMatrix.m[13];\r\n result.z = -this._pivotMatrix.m[14];\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point World coordinates.\r\n * @returns a new Vector3 set with the mesh pivot point World coordinates.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPoint = function () {\r\n var point = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.getAbsolutePivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" coordinates with the mesh pivot point World coordinates.\r\n * @param result vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPointToRef = function (result) {\r\n result.x = this._pivotMatrix.m[12];\r\n result.y = this._pivotMatrix.m[13];\r\n result.z = this._pivotMatrix.m[14];\r\n this.getPivotPointToRef(result);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(result, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Defines the passed node as the parent of the current node.\r\n * The node will remain exactly where it is and its position / rotation will be updated accordingly\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n * @param node the node ot set as the parent\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.setParent = function (node) {\r\n if (!node && !this.parent) {\r\n return this;\r\n }\r\n var quatRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n var position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var scale = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n if (!node) {\r\n this.computeWorldMatrix(true);\r\n this.getWorldMatrix().decompose(scale, quatRotation, position);\r\n }\r\n else {\r\n var diffMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n var invParentMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n this.computeWorldMatrix(true);\r\n node.computeWorldMatrix(true);\r\n node.getWorldMatrix().invertToRef(invParentMatrix);\r\n this.getWorldMatrix().multiplyToRef(invParentMatrix, diffMatrix);\r\n diffMatrix.decompose(scale, quatRotation, position);\r\n }\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(quatRotation);\r\n }\r\n else {\r\n quatRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n this.scaling.copyFrom(scale);\r\n this.position.copyFrom(position);\r\n this.parent = node;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"nonUniformScaling\", {\r\n /**\r\n * True if the scaling property of this object is non uniform eg. (1,2,1)\r\n */\r\n get: function () {\r\n return this._nonUniformScaling;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n TransformNode.prototype._updateNonUniformScalingState = function (value) {\r\n if (this._nonUniformScaling === value) {\r\n return false;\r\n }\r\n this._nonUniformScaling = value;\r\n return true;\r\n };\r\n /**\r\n * Attach the current TransformNode to another TransformNode associated with a bone\r\n * @param bone Bone affecting the TransformNode\r\n * @param affectedTransformNode TransformNode associated with the bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.attachToBone = function (bone, affectedTransformNode) {\r\n this._transformToBoneReferal = affectedTransformNode;\r\n this.parent = bone;\r\n if (bone.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Detach the transform node if its associated with a bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.detachFromBone = function () {\r\n if (!this.parent) {\r\n return this;\r\n }\r\n if (this.parent.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n this._transformToBoneReferal = null;\r\n this.parent = null;\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized.\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.rotate = function (axis, amount, space) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = this.rotation.toQuaternion();\r\n this.rotation.setAll(0);\r\n }\r\n var rotationQuaternion;\r\n if (!space || space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL) {\r\n rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);\r\n }\r\n else {\r\n if (this.parent) {\r\n var invertParentWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n axis = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformNormal(axis, invertParentWorldMatrix);\r\n }\r\n rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized. .\r\n * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm\r\n * @param point the point to rotate around\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @returns the TransformNode\r\n */\r\n TransformNode.prototype.rotateAround = function (point, axis, amount) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n this.rotation.setAll(0);\r\n }\r\n var tmpVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var finalScale = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n var finalTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[2];\r\n var finalRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n var translationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]; // T\r\n var translationMatrixInv = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1]; // T'\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[2]; // R\r\n var finalMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[3]; // T' x R x T\r\n point.subtractToRef(this.position, tmpVector);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationAxisToRef(axis, amount, rotationMatrix); // R\r\n translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R\r\n finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T\r\n finalMatrix.decompose(finalScale, finalRotation, finalTranslation);\r\n this.position.addInPlace(finalTranslation);\r\n finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n return this;\r\n };\r\n /**\r\n * Translates the mesh along the axis vector for the passed distance in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * @param axis the axis to translate in\r\n * @param distance the distance to translate\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.translate = function (axis, distance, space) {\r\n var displacementVector = axis.scale(distance);\r\n if (!space || space === _Maths_math_axis__WEBPACK_IMPORTED_MODULE_5__[\"Space\"].LOCAL) {\r\n var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);\r\n this.setPositionWithLocalVector(tempV3);\r\n }\r\n else {\r\n this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds a rotation step to the mesh current rotation.\r\n * x, y, z are Euler angles expressed in radians.\r\n * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.\r\n * This means this rotation is made in the mesh local space only.\r\n * It's useful to set a custom rotation order different from the BJS standard one YXZ.\r\n * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.\r\n * ```javascript\r\n * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);\r\n * ```\r\n * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.\r\n * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.\r\n * @param x Rotation to add\r\n * @param y Rotation to add\r\n * @param z Rotation to add\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.addRotation = function (x, y, z) {\r\n var rotationQuaternion;\r\n if (this.rotationQuaternion) {\r\n rotationQuaternion = this.rotationQuaternion;\r\n }\r\n else {\r\n rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);\r\n }\r\n var accumulation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(y, x, z, accumulation);\r\n rotationQuaternion.multiplyInPlace(accumulation);\r\n if (!this.rotationQuaternion) {\r\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n }\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TransformNode.prototype._getEffectiveParent = function () {\r\n return this.parent;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n TransformNode.prototype.computeWorldMatrix = function (force) {\r\n if (this._isWorldMatrixFrozen && !this._isDirty) {\r\n return this._worldMatrix;\r\n }\r\n var currentRenderId = this.getScene().getRenderId();\r\n if (!this._isDirty && !force && this.isSynchronized()) {\r\n this._currentRenderId = currentRenderId;\r\n return this._worldMatrix;\r\n }\r\n var camera = this.getScene().activeCamera;\r\n var useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;\r\n var useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\r\n // Billboarding based on camera position\r\n if (useBillboardPath && camera && useBillboardPosition) {\r\n this.lookAt(camera.position);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n this.rotation.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n this.rotation.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n this.rotation.z = 0;\r\n }\r\n }\r\n this._updateCache();\r\n var cache = this._cache;\r\n cache.pivotMatrixUpdated = false;\r\n cache.billboardMode = this.billboardMode;\r\n cache.infiniteDistance = this.infiniteDistance;\r\n this._currentRenderId = currentRenderId;\r\n this._childUpdateId++;\r\n this._isDirty = false;\r\n var parent = this._getEffectiveParent();\r\n // Scaling\r\n var scaling = cache.scaling;\r\n var translation = cache.position;\r\n // Translation\r\n if (this._infiniteDistance) {\r\n if (!this.parent && camera) {\r\n var cameraWorldMatrix = camera.getWorldMatrix();\r\n var cameraGlobalPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);\r\n translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);\r\n }\r\n else {\r\n translation.copyFrom(this._position);\r\n }\r\n }\r\n else {\r\n translation.copyFrom(this._position);\r\n }\r\n // Scaling\r\n scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);\r\n // Rotation\r\n var rotation = cache.rotationQuaternion;\r\n if (this._rotationQuaternion) {\r\n if (this.reIntegrateRotationIntoRotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n this._rotationQuaternion.multiplyInPlace(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));\r\n this._rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n rotation.copyFrom(this._rotationQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"].RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);\r\n cache.rotation.copyFrom(this._rotation);\r\n }\r\n // Compose\r\n if (this._usePivotMatrix) {\r\n var scaleMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);\r\n // Rotation\r\n var rotationMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0];\r\n rotation.toRotationMatrix(rotationMatrix);\r\n // Composing transformations\r\n this._pivotMatrix.multiplyToRef(scaleMatrix, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[4]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);\r\n // Post multiply inverse of pivotMatrix\r\n if (this._postMultiplyPivotMatrix) {\r\n this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);\r\n }\r\n this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ComposeToRef(scaling, rotation, translation, this._localMatrix);\r\n }\r\n // Parent\r\n if (parent && parent.getWorldMatrix) {\r\n if (force) {\r\n parent.computeWorldMatrix();\r\n }\r\n if (useBillboardPath) {\r\n if (this._transformToBoneReferal) {\r\n parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7]);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7].copyFrom(parent.getWorldMatrix());\r\n }\r\n // Extract scaling and translation from parent\r\n var translation_1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[5];\r\n var scale = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[6];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7].decompose(scale, undefined, translation_1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].ScalingToRef(scale.x, scale.y, scale.z, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7].setTranslation(translation_1);\r\n this._localMatrix.multiplyToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[7], this._worldMatrix);\r\n }\r\n else {\r\n if (this._transformToBoneReferal) {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[6]);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);\r\n }\r\n else {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);\r\n }\r\n }\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._worldMatrix.copyFrom(this._localMatrix);\r\n }\r\n // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)\r\n if (useBillboardPath && camera && this.billboardMode && !useBillboardPosition) {\r\n var storedTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation\r\n // Cancel camera rotation\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1].copyFrom(camera.getViewMatrix());\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1].setTranslationFromFloats(0, 0, 0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[1].invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0].decompose(undefined, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0], undefined);\r\n var eulerAngles = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Quaternion[0].toEulerAnglesToRef(eulerAngles);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n eulerAngles.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n eulerAngles.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n eulerAngles.z = 0;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n }\r\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\r\n this._worldMatrix.multiplyToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0], this._worldMatrix);\r\n // Restore translation\r\n this._worldMatrix.setTranslation(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0]);\r\n }\r\n // Normal matrix\r\n if (!this.ignoreNonUniformScaling) {\r\n if (this._scaling.isNonUniform) {\r\n this._updateNonUniformScalingState(true);\r\n }\r\n else if (parent && parent._nonUniformScaling) {\r\n this._updateNonUniformScalingState(parent._nonUniformScaling);\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n this._afterComputeWorldMatrix();\r\n // Absolute position\r\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\r\n this._isAbsoluteSynced = false;\r\n // Callbacks\r\n this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Invert(this._worldMatrix);\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n TransformNode.prototype._afterComputeWorldMatrix = function () {\r\n };\r\n /**\r\n * If you'd like to be called back after the mesh position, rotation or scaling has been updated.\r\n * @param func callback function to add\r\n *\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.registerAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Removes a registered callback function.\r\n * @param func callback function to remove\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unregisterAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Gets the position of the current mesh in camera space\r\n * @param camera defines the camera to use\r\n * @returns a position\r\n */\r\n TransformNode.prototype.getPositionInCameraSpace = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(this.absolutePosition, camera.getViewMatrix());\r\n };\r\n /**\r\n * Returns the distance from the mesh to the active camera\r\n * @param camera defines the camera to use\r\n * @returns the distance\r\n */\r\n TransformNode.prototype.getDistanceToCamera = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return this.absolutePosition.subtract(camera.globalPosition).length();\r\n };\r\n /**\r\n * Clone the current transform node\r\n * @param name Name of the new clone\r\n * @param newParent New parent for the clone\r\n * @param doNotCloneChildren Do not clone children hierarchy\r\n * @returns the new transform node\r\n */\r\n TransformNode.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n var _this = this;\r\n var result = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Clone(function () { return new TransformNode(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = this.getDescendants(true);\r\n for (var index = 0; index < directDescendants.length; index++) {\r\n var child = directDescendants[index];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, result);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the objects information.\r\n * @param currentSerializationObject defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n TransformNode.prototype.serialize = function (currentSerializationObject) {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this, currentSerializationObject);\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n serializationObject.isEnabled = this.isEnabled();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new TransformNode object parsed from the source provided.\r\n * @param parsedTransformNode is the source.\r\n * @param scene the scne the object belongs to\r\n * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new TransformNode object parsed from the source provided.\r\n */\r\n TransformNode.Parse = function (parsedTransformNode, scene, rootUrl) {\r\n var transformNode = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new TransformNode(parsedTransformNode.name, scene); }, parsedTransformNode, scene, rootUrl);\r\n if (parsedTransformNode.localMatrix) {\r\n transformNode.setPreTransformMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromArray(parsedTransformNode.localMatrix));\r\n }\r\n else if (parsedTransformNode.pivotMatrix) {\r\n transformNode.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromArray(parsedTransformNode.pivotMatrix));\r\n }\r\n transformNode.setEnabled(parsedTransformNode.isEnabled);\r\n // Parent\r\n if (parsedTransformNode.parentId) {\r\n transformNode._waitingParentId = parsedTransformNode.parentId;\r\n }\r\n return transformNode;\r\n };\r\n /**\r\n * Get all child-transformNodes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of TransformNode\r\n */\r\n TransformNode.prototype.getChildTransformNodes = function (directDescendantsOnly, predicate) {\r\n var results = [];\r\n this._getDescendants(results, directDescendantsOnly, function (node) {\r\n return ((!predicate || predicate(node)) && (node instanceof TransformNode));\r\n });\r\n return results;\r\n };\r\n /**\r\n * Releases resources associated with this transform node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n TransformNode.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeTransformNode(this);\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n if (doNotRecurse) {\r\n var transformNodes = this.getChildTransformNodes(true);\r\n for (var _i = 0, transformNodes_1 = transformNodes; _i < transformNodes_1.length; _i++) {\r\n var transformNode = transformNodes_1[_i];\r\n transformNode.parent = null;\r\n transformNode.computeWorldMatrix(true);\r\n }\r\n }\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n TransformNode.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n var storedRotation = null;\r\n var storedRotationQuaternion = null;\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion) {\r\n storedRotationQuaternion = this.rotationQuaternion.clone();\r\n this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);\r\n }\r\n else if (this.rotation) {\r\n storedRotation = this.rotation.clone();\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n var boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);\r\n var sizeVec = boundingVectors.max.subtract(boundingVectors.min);\r\n var maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);\r\n if (maxDimension === 0) {\r\n return this;\r\n }\r\n var scale = 1 / maxDimension;\r\n this.scaling.scaleInPlace(scale);\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion && storedRotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(storedRotationQuaternion);\r\n }\r\n else if (this.rotation && storedRotation) {\r\n this.rotation.copyFrom(storedRotation);\r\n }\r\n }\r\n return this;\r\n };\r\n TransformNode.prototype._syncAbsoluteScalingAndRotation = function () {\r\n if (!this._isAbsoluteSynced) {\r\n this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);\r\n this._isAbsoluteSynced = true;\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Object will not rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_NONE = 0;\r\n /**\r\n * Object will rotate to face the camera but only on the x axis\r\n */\r\n TransformNode.BILLBOARDMODE_X = 1;\r\n /**\r\n * Object will rotate to face the camera but only on the y axis\r\n */\r\n TransformNode.BILLBOARDMODE_Y = 2;\r\n /**\r\n * Object will rotate to face the camera but only on the z axis\r\n */\r\n TransformNode.BILLBOARDMODE_Z = 4;\r\n /**\r\n * Object will rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Object will rotate to face the camera's position instead of orientation\r\n */\r\n TransformNode.BILLBOARDMODE_USE_POSITION = 128;\r\n TransformNode._lookAtVectorCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0, 0, 0);\r\n TransformNode._rotationAxisCache = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"position\")\r\n ], TransformNode.prototype, \"_position\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"rotation\")\r\n ], TransformNode.prototype, \"_rotation\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsQuaternion\"])(\"rotationQuaternion\")\r\n ], TransformNode.prototype, \"_rotationQuaternion\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])(\"scaling\")\r\n ], TransformNode.prototype, \"_scaling\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"billboardMode\")\r\n ], TransformNode.prototype, \"_billboardMode\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TransformNode.prototype, \"scalingDeterminant\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])(\"infiniteDistance\")\r\n ], TransformNode.prototype, \"_infiniteDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TransformNode.prototype, \"ignoreNonUniformScaling\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], TransformNode.prototype, \"reIntegrateRotationIntoRotationQuaternion\", void 0);\r\n return TransformNode;\r\n}(_node__WEBPACK_IMPORTED_MODULE_4__[\"Node\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\":\n/*!***************************************************************!*\\\n !*** ./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts ***!\n \\***************************************************************/\n/*! exports provided: CubeMapToSphericalPolynomialTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return CubeMapToSphericalPolynomialTools; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\nvar FileFaceOrientation = /** @class */ (function () {\r\n function FileFaceOrientation(name, worldAxisForNormal, worldAxisForFileX, worldAxisForFileY) {\r\n this.name = name;\r\n this.worldAxisForNormal = worldAxisForNormal;\r\n this.worldAxisForFileX = worldAxisForFileX;\r\n this.worldAxisForFileY = worldAxisForFileY;\r\n }\r\n return FileFaceOrientation;\r\n}());\r\n/**\r\n * Helper class dealing with the extraction of spherical polynomial dataArray\r\n * from a cube map.\r\n */\r\nvar CubeMapToSphericalPolynomialTools = /** @class */ (function () {\r\n function CubeMapToSphericalPolynomialTools() {\r\n }\r\n /**\r\n * Converts a texture to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param texture The texture to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial = function (texture) {\r\n if (!texture.isCube) {\r\n // Only supports cube Textures currently.\r\n return null;\r\n }\r\n var size = texture.getSize().width;\r\n var right = texture.readPixels(0);\r\n var left = texture.readPixels(1);\r\n var up;\r\n var down;\r\n if (texture.isRenderTarget) {\r\n up = texture.readPixels(3);\r\n down = texture.readPixels(2);\r\n }\r\n else {\r\n up = texture.readPixels(2);\r\n down = texture.readPixels(3);\r\n }\r\n var front = texture.readPixels(4);\r\n var back = texture.readPixels(5);\r\n var gammaSpace = texture.gammaSpace;\r\n // Always read as RGBA.\r\n var format = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n var type = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n if (texture.textureType && texture.textureType !== _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n type = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n var cubeInfo = {\r\n size: size,\r\n right: right,\r\n left: left,\r\n up: up,\r\n down: down,\r\n front: front,\r\n back: back,\r\n format: format,\r\n type: type,\r\n gammaSpace: gammaSpace,\r\n };\r\n return this.ConvertCubeMapToSphericalPolynomial(cubeInfo);\r\n };\r\n /**\r\n * Converts a cubemap to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param cubeInfo The Cube map to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial = function (cubeInfo) {\r\n var sphericalHarmonics = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalHarmonics\"]();\r\n var totalSolidAngle = 0.0;\r\n // The (u,v) range is [-1,+1], so the distance between each texel is 2/Size.\r\n var du = 2.0 / cubeInfo.size;\r\n var dv = du;\r\n // The (u,v) of the first texel is half a texel from the corner (-1,-1).\r\n var minUV = du * 0.5 - 1.0;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var fileFace = this.FileFaces[faceIndex];\r\n var dataArray = cubeInfo[fileFace.name];\r\n var v = minUV;\r\n // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).\r\n // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.\r\n // Because SP is still linear, so summation is fine in that basis.\r\n var stride = cubeInfo.format === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTUREFORMAT_RGBA ? 4 : 3;\r\n for (var y = 0; y < cubeInfo.size; y++) {\r\n var u = minUV;\r\n for (var x = 0; x < cubeInfo.size; x++) {\r\n // World direction (not normalised)\r\n var worldDirection = fileFace.worldAxisForFileX.scale(u).add(fileFace.worldAxisForFileY.scale(v)).add(fileFace.worldAxisForNormal);\r\n worldDirection.normalize();\r\n var deltaSolidAngle = Math.pow(1.0 + u * u + v * v, -3.0 / 2.0);\r\n var r = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 0];\r\n var g = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 1];\r\n var b = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 2];\r\n // Prevent NaN harmonics with extreme HDRI data.\r\n if (isNaN(r)) {\r\n r = 0;\r\n }\r\n if (isNaN(g)) {\r\n g = 0;\r\n }\r\n if (isNaN(b)) {\r\n b = 0;\r\n }\r\n // Handle Integer types.\r\n if (cubeInfo.type === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n r /= 255;\r\n g /= 255;\r\n b /= 255;\r\n }\r\n // Handle Gamma space textures.\r\n if (cubeInfo.gammaSpace) {\r\n r = Math.pow(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(r), _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"ToLinearSpace\"]);\r\n g = Math.pow(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(g), _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"ToLinearSpace\"]);\r\n b = Math.pow(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(b), _Maths_math_constants__WEBPACK_IMPORTED_MODULE_4__[\"ToLinearSpace\"]);\r\n }\r\n // Prevent to explode in case of really high dynamic ranges.\r\n // sh 3 would not be enough to accurately represent it.\r\n var max = 4096;\r\n r = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(r, 0, max);\r\n g = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(g, 0, max);\r\n b = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_1__[\"Scalar\"].Clamp(b, 0, max);\r\n var color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_5__[\"Color3\"](r, g, b);\r\n sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);\r\n totalSolidAngle += deltaSolidAngle;\r\n u += du;\r\n }\r\n v += dv;\r\n }\r\n }\r\n // Solid angle for entire sphere is 4*pi\r\n var sphereSolidAngle = 4.0 * Math.PI;\r\n // Adjust the solid angle to allow for how many faces we processed.\r\n var facesProcessed = 6.0;\r\n var expectedSolidAngle = sphereSolidAngle * facesProcessed / 6.0;\r\n // Adjust the harmonics so that the accumulated solid angle matches the expected solid angle.\r\n // This is needed because the numerical integration over the cube uses a\r\n // small angle approximation of solid angle for each texel (see deltaSolidAngle),\r\n // and also to compensate for accumulative error due to float precision in the summation.\r\n var correctionFactor = expectedSolidAngle / totalSolidAngle;\r\n sphericalHarmonics.scaleInPlace(correctionFactor);\r\n sphericalHarmonics.convertIncidentRadianceToIrradiance();\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n return _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_2__[\"SphericalPolynomial\"].FromHarmonics(sphericalHarmonics);\r\n };\r\n CubeMapToSphericalPolynomialTools.FileFaces = [\r\n new FileFaceOrientation(\"right\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)),\r\n new FileFaceOrientation(\"left\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)),\r\n new FileFaceOrientation(\"up\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1)),\r\n new FileFaceOrientation(\"down\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1)),\r\n new FileFaceOrientation(\"front\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)),\r\n new FileFaceOrientation(\"back\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, -1), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1, 0, 0), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -1, 0)) // -Z bottom\r\n ];\r\n return CubeMapToSphericalPolynomialTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/hdr.ts\":\n/*!**************************************!*\\\n !*** ./Misc/HighDynamicRange/hdr.ts ***!\n \\**************************************/\n/*! exports provided: HDRTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return HDRTools; });\n/* harmony import */ var _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./panoramaToCubemap */ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\");\n\r\n/**\r\n * This groups tools to convert HDR texture to native colors array.\r\n */\r\nvar HDRTools = /** @class */ (function () {\r\n function HDRTools() {\r\n }\r\n HDRTools.Ldexp = function (mantissa, exponent) {\r\n if (exponent > 1023) {\r\n return mantissa * Math.pow(2, 1023) * Math.pow(2, exponent - 1023);\r\n }\r\n if (exponent < -1074) {\r\n return mantissa * Math.pow(2, -1074) * Math.pow(2, exponent + 1074);\r\n }\r\n return mantissa * Math.pow(2, exponent);\r\n };\r\n HDRTools.Rgbe2float = function (float32array, red, green, blue, exponent, index) {\r\n if (exponent > 0) { /*nonzero pixel*/\r\n exponent = this.Ldexp(1.0, exponent - (128 + 8));\r\n float32array[index + 0] = red * exponent;\r\n float32array[index + 1] = green * exponent;\r\n float32array[index + 2] = blue * exponent;\r\n }\r\n else {\r\n float32array[index + 0] = 0;\r\n float32array[index + 1] = 0;\r\n float32array[index + 2] = 0;\r\n }\r\n };\r\n HDRTools.readStringLine = function (uint8array, startIndex) {\r\n var line = \"\";\r\n var character = \"\";\r\n for (var i = startIndex; i < uint8array.length - startIndex; i++) {\r\n character = String.fromCharCode(uint8array[i]);\r\n if (character == \"\\n\") {\r\n break;\r\n }\r\n line += character;\r\n }\r\n return line;\r\n };\r\n /**\r\n * Reads header information from an RGBE texture stored in a native array.\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in native array.\r\n * @return The header information.\r\n */\r\n HDRTools.RGBE_ReadHeader = function (uint8array) {\r\n var height = 0;\r\n var width = 0;\r\n var line = this.readStringLine(uint8array, 0);\r\n if (line[0] != '#' || line[1] != '?') {\r\n throw \"Bad HDR Format.\";\r\n }\r\n var endOfHeader = false;\r\n var findFormat = false;\r\n var lineIndex = 0;\r\n do {\r\n lineIndex += (line.length + 1);\r\n line = this.readStringLine(uint8array, lineIndex);\r\n if (line == \"FORMAT=32-bit_rle_rgbe\") {\r\n findFormat = true;\r\n }\r\n else if (line.length == 0) {\r\n endOfHeader = true;\r\n }\r\n } while (!endOfHeader);\r\n if (!findFormat) {\r\n throw \"HDR Bad header format, unsupported FORMAT\";\r\n }\r\n lineIndex += (line.length + 1);\r\n line = this.readStringLine(uint8array, lineIndex);\r\n var sizeRegexp = /^\\-Y (.*) \\+X (.*)$/g;\r\n var match = sizeRegexp.exec(line);\r\n // TODO. Support +Y and -X if needed.\r\n if (!match || match.length < 3) {\r\n throw \"HDR Bad header format, no size\";\r\n }\r\n width = parseInt(match[2]);\r\n height = parseInt(match[1]);\r\n if (width < 8 || width > 0x7fff) {\r\n throw \"HDR Bad header format, unsupported size\";\r\n }\r\n lineIndex += (line.length + 1);\r\n return {\r\n height: height,\r\n width: width,\r\n dataPosition: lineIndex\r\n };\r\n };\r\n /**\r\n * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.\r\n * This RGBE texture needs to store the information as a panorama.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param buffer The binary file stored in an array buffer.\r\n * @param size The expected size of the extracted cubemap.\r\n * @return The Cube Map information.\r\n */\r\n HDRTools.GetCubeMapTextureData = function (buffer, size) {\r\n var uint8array = new Uint8Array(buffer);\r\n var hdrInfo = this.RGBE_ReadHeader(uint8array);\r\n var data = this.RGBE_ReadPixels_RLE(uint8array, hdrInfo);\r\n var cubeMapData = _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_0__[\"PanoramaToCubeMapTools\"].ConvertPanoramaToCubemap(data, hdrInfo.width, hdrInfo.height, size);\r\n return cubeMapData;\r\n };\r\n /**\r\n * Returns the pixels data extracted from an RGBE texture.\r\n * This pixels will be stored left to right up to down in the R G B order in one array.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in an array buffer.\r\n * @param hdrInfo The header information of the file.\r\n * @return The pixels data in RGB right to left up to down order.\r\n */\r\n HDRTools.RGBE_ReadPixels = function (uint8array, hdrInfo) {\r\n // Keep for multi format supports.\r\n return this.RGBE_ReadPixels_RLE(uint8array, hdrInfo);\r\n };\r\n HDRTools.RGBE_ReadPixels_RLE = function (uint8array, hdrInfo) {\r\n var num_scanlines = hdrInfo.height;\r\n var scanline_width = hdrInfo.width;\r\n var a, b, c, d, count;\r\n var dataIndex = hdrInfo.dataPosition;\r\n var index = 0, endIndex = 0, i = 0;\r\n var scanLineArrayBuffer = new ArrayBuffer(scanline_width * 4); // four channel R G B E\r\n var scanLineArray = new Uint8Array(scanLineArrayBuffer);\r\n // 3 channels of 4 bytes per pixel in float.\r\n var resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\r\n var resultArray = new Float32Array(resultBuffer);\r\n // read in each successive scanline\r\n while (num_scanlines > 0) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n c = uint8array[dataIndex++];\r\n d = uint8array[dataIndex++];\r\n if (a != 2 || b != 2 || (c & 0x80)) {\r\n // this file is not run length encoded\r\n throw \"HDR Bad header format, not RLE\";\r\n }\r\n if (((c << 8) | d) != scanline_width) {\r\n throw \"HDR Bad header format, wrong scan line width\";\r\n }\r\n index = 0;\r\n // read each of the four channels for the scanline into the buffer\r\n for (i = 0; i < 4; i++) {\r\n endIndex = (i + 1) * scanline_width;\r\n while (index < endIndex) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n if (a > 128) {\r\n // a run of the same value\r\n count = a - 128;\r\n if ((count == 0) || (count > endIndex - index)) {\r\n throw \"HDR Bad Format, bad scanline data (run)\";\r\n }\r\n while (count-- > 0) {\r\n scanLineArray[index++] = b;\r\n }\r\n }\r\n else {\r\n // a non-run\r\n count = a;\r\n if ((count == 0) || (count > endIndex - index)) {\r\n throw \"HDR Bad Format, bad scanline data (non-run)\";\r\n }\r\n scanLineArray[index++] = b;\r\n if (--count > 0) {\r\n for (var j = 0; j < count; j++) {\r\n scanLineArray[index++] = uint8array[dataIndex++];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // now convert data from buffer into floats\r\n for (i = 0; i < scanline_width; i++) {\r\n a = scanLineArray[i];\r\n b = scanLineArray[i + scanline_width];\r\n c = scanLineArray[i + 2 * scanline_width];\r\n d = scanLineArray[i + 3 * scanline_width];\r\n this.Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\r\n }\r\n num_scanlines--;\r\n }\r\n return resultArray;\r\n };\r\n return HDRTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/index.ts\":\n/*!****************************************!*\\\n !*** ./Misc/HighDynamicRange/index.ts ***!\n \\****************************************/\n/*! exports provided: CubeMapToSphericalPolynomialTools, HDRTools, PanoramaToCubeMapTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony import */ var _hdr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hdr */ \"./Misc/HighDynamicRange/hdr.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _hdr__WEBPACK_IMPORTED_MODULE_1__[\"HDRTools\"]; });\n\n/* harmony import */ var _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./panoramaToCubemap */ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _panoramaToCubemap__WEBPACK_IMPORTED_MODULE_2__[\"PanoramaToCubeMapTools\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/HighDynamicRange/panoramaToCubemap.ts\":\n/*!****************************************************!*\\\n !*** ./Misc/HighDynamicRange/panoramaToCubemap.ts ***!\n \\****************************************************/\n/*! exports provided: PanoramaToCubeMapTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return PanoramaToCubeMapTools; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n/**\r\n * Helper class useful to convert panorama picture to their cubemap representation in 6 faces.\r\n */\r\nvar PanoramaToCubeMapTools = /** @class */ (function () {\r\n function PanoramaToCubeMapTools() {\r\n }\r\n /**\r\n * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces).\r\n *\r\n * @param float32Array The source data.\r\n * @param inputWidth The width of the input panorama.\r\n * @param inputHeight The height of the input panorama.\r\n * @param size The willing size of the generated cubemap (each faces will be size * size pixels)\r\n * @return The cubemap data\r\n */\r\n PanoramaToCubeMapTools.ConvertPanoramaToCubemap = function (float32Array, inputWidth, inputHeight, size) {\r\n if (!float32Array) {\r\n throw \"ConvertPanoramaToCubemap: input cannot be null\";\r\n }\r\n if (float32Array.length != inputWidth * inputHeight * 3) {\r\n throw \"ConvertPanoramaToCubemap: input size is wrong\";\r\n }\r\n var textureFront = this.CreateCubemapTexture(size, this.FACE_FRONT, float32Array, inputWidth, inputHeight);\r\n var textureBack = this.CreateCubemapTexture(size, this.FACE_BACK, float32Array, inputWidth, inputHeight);\r\n var textureLeft = this.CreateCubemapTexture(size, this.FACE_LEFT, float32Array, inputWidth, inputHeight);\r\n var textureRight = this.CreateCubemapTexture(size, this.FACE_RIGHT, float32Array, inputWidth, inputHeight);\r\n var textureUp = this.CreateCubemapTexture(size, this.FACE_UP, float32Array, inputWidth, inputHeight);\r\n var textureDown = this.CreateCubemapTexture(size, this.FACE_DOWN, float32Array, inputWidth, inputHeight);\r\n return {\r\n front: textureFront,\r\n back: textureBack,\r\n left: textureLeft,\r\n right: textureRight,\r\n up: textureUp,\r\n down: textureDown,\r\n size: size,\r\n type: _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTURETYPE_FLOAT,\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTUREFORMAT_RGB,\r\n gammaSpace: false,\r\n };\r\n };\r\n PanoramaToCubeMapTools.CreateCubemapTexture = function (texSize, faceData, float32Array, inputWidth, inputHeight) {\r\n var buffer = new ArrayBuffer(texSize * texSize * 4 * 3);\r\n var textureArray = new Float32Array(buffer);\r\n var rotDX1 = faceData[1].subtract(faceData[0]).scale(1 / texSize);\r\n var rotDX2 = faceData[3].subtract(faceData[2]).scale(1 / texSize);\r\n var dy = 1 / texSize;\r\n var fy = 0;\r\n for (var y = 0; y < texSize; y++) {\r\n var xv1 = faceData[0];\r\n var xv2 = faceData[2];\r\n for (var x = 0; x < texSize; x++) {\r\n var v = xv2.subtract(xv1).scale(fy).add(xv1);\r\n v.normalize();\r\n var color = this.CalcProjectionSpherical(v, float32Array, inputWidth, inputHeight);\r\n // 3 channels per pixels\r\n textureArray[y * texSize * 3 + (x * 3) + 0] = color.r;\r\n textureArray[y * texSize * 3 + (x * 3) + 1] = color.g;\r\n textureArray[y * texSize * 3 + (x * 3) + 2] = color.b;\r\n xv1 = xv1.add(rotDX1);\r\n xv2 = xv2.add(rotDX2);\r\n }\r\n fy += dy;\r\n }\r\n return textureArray;\r\n };\r\n PanoramaToCubeMapTools.CalcProjectionSpherical = function (vDir, float32Array, inputWidth, inputHeight) {\r\n var theta = Math.atan2(vDir.z, vDir.x);\r\n var phi = Math.acos(vDir.y);\r\n while (theta < -Math.PI) {\r\n theta += 2 * Math.PI;\r\n }\r\n while (theta > Math.PI) {\r\n theta -= 2 * Math.PI;\r\n }\r\n var dx = theta / Math.PI;\r\n var dy = phi / Math.PI;\r\n // recenter.\r\n dx = dx * 0.5 + 0.5;\r\n var px = Math.round(dx * inputWidth);\r\n if (px < 0) {\r\n px = 0;\r\n }\r\n else if (px >= inputWidth) {\r\n px = inputWidth - 1;\r\n }\r\n var py = Math.round(dy * inputHeight);\r\n if (py < 0) {\r\n py = 0;\r\n }\r\n else if (py >= inputHeight) {\r\n py = inputHeight - 1;\r\n }\r\n var inputY = (inputHeight - py - 1);\r\n var r = float32Array[inputY * inputWidth * 3 + (px * 3) + 0];\r\n var g = float32Array[inputY * inputWidth * 3 + (px * 3) + 1];\r\n var b = float32Array[inputY * inputWidth * 3 + (px * 3) + 2];\r\n return {\r\n r: r,\r\n g: g,\r\n b: b\r\n };\r\n };\r\n PanoramaToCubeMapTools.FACE_FRONT = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, -1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_BACK = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, 1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_RIGHT = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, 1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_LEFT = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, -1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_DOWN = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, 1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, 1.0, 1.0)\r\n ];\r\n PanoramaToCubeMapTools.FACE_UP = [\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, 1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-1.0, -1.0, -1.0),\r\n new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](1.0, -1.0, -1.0)\r\n ];\r\n return PanoramaToCubeMapTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/andOrNotEvaluator.ts\":\n/*!***********************************!*\\\n !*** ./Misc/andOrNotEvaluator.ts ***!\n \\***********************************/\n/*! exports provided: AndOrNotEvaluator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return AndOrNotEvaluator; });\n/**\r\n * Class used to evalaute queries containing `and` and `or` operators\r\n */\r\nvar AndOrNotEvaluator = /** @class */ (function () {\r\n function AndOrNotEvaluator() {\r\n }\r\n /**\r\n * Evaluate a query\r\n * @param query defines the query to evaluate\r\n * @param evaluateCallback defines the callback used to filter result\r\n * @returns true if the query matches\r\n */\r\n AndOrNotEvaluator.Eval = function (query, evaluateCallback) {\r\n if (!query.match(/\\([^\\(\\)]*\\)/g)) {\r\n query = AndOrNotEvaluator._HandleParenthesisContent(query, evaluateCallback);\r\n }\r\n else {\r\n query = query.replace(/\\([^\\(\\)]*\\)/g, function (r) {\r\n // remove parenthesis\r\n r = r.slice(1, r.length - 1);\r\n return AndOrNotEvaluator._HandleParenthesisContent(r, evaluateCallback);\r\n });\r\n }\r\n if (query === \"true\") {\r\n return true;\r\n }\r\n if (query === \"false\") {\r\n return false;\r\n }\r\n return AndOrNotEvaluator.Eval(query, evaluateCallback);\r\n };\r\n AndOrNotEvaluator._HandleParenthesisContent = function (parenthesisContent, evaluateCallback) {\r\n evaluateCallback = evaluateCallback || (function (r) {\r\n return r === \"true\" ? true : false;\r\n });\r\n var result;\r\n var or = parenthesisContent.split(\"||\");\r\n for (var i in or) {\r\n if (or.hasOwnProperty(i)) {\r\n var ori = AndOrNotEvaluator._SimplifyNegation(or[i].trim());\r\n var and = ori.split(\"&&\");\r\n if (and.length > 1) {\r\n for (var j = 0; j < and.length; ++j) {\r\n var andj = AndOrNotEvaluator._SimplifyNegation(and[j].trim());\r\n if (andj !== \"true\" && andj !== \"false\") {\r\n if (andj[0] === \"!\") {\r\n result = !evaluateCallback(andj.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(andj);\r\n }\r\n }\r\n else {\r\n result = andj === \"true\" ? true : false;\r\n }\r\n if (!result) { // no need to continue since 'false && ... && ...' will always return false\r\n ori = \"false\";\r\n break;\r\n }\r\n }\r\n }\r\n if (result || ori === \"true\") { // no need to continue since 'true || ... || ...' will always return true\r\n result = true;\r\n break;\r\n }\r\n // result equals false (or undefined)\r\n if (ori !== \"true\" && ori !== \"false\") {\r\n if (ori[0] === \"!\") {\r\n result = !evaluateCallback(ori.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(ori);\r\n }\r\n }\r\n else {\r\n result = ori === \"true\" ? true : false;\r\n }\r\n }\r\n }\r\n // the whole parenthesis scope is replaced by 'true' or 'false'\r\n return result ? \"true\" : \"false\";\r\n };\r\n AndOrNotEvaluator._SimplifyNegation = function (booleanString) {\r\n booleanString = booleanString.replace(/^[\\s!]+/, function (r) {\r\n // remove whitespaces\r\n r = r.replace(/[\\s]/g, function () { return \"\"; });\r\n return r.length % 2 ? \"!\" : \"\";\r\n });\r\n booleanString = booleanString.trim();\r\n if (booleanString === \"!true\") {\r\n booleanString = \"false\";\r\n }\r\n else if (booleanString === \"!false\") {\r\n booleanString = \"true\";\r\n }\r\n return booleanString;\r\n };\r\n return AndOrNotEvaluator;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/arrayTools.ts\":\n/*!****************************!*\\\n !*** ./Misc/arrayTools.ts ***!\n \\****************************/\n/*! exports provided: ArrayTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ArrayTools\", function() { return ArrayTools; });\n/**\r\n * Class containing a set of static utilities functions for arrays.\r\n */\r\nvar ArrayTools = /** @class */ (function () {\r\n function ArrayTools() {\r\n }\r\n /**\r\n * Returns an array of the given size filled with element built from the given constructor and the paramters\r\n * @param size the number of element to construct and put in the array\r\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per array entry.\r\n * @returns a new array filled with new objects\r\n */\r\n ArrayTools.BuildArray = function (size, itemBuilder) {\r\n var a = [];\r\n for (var i = 0; i < size; ++i) {\r\n a.push(itemBuilder());\r\n }\r\n return a;\r\n };\r\n return ArrayTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/assetsManager.ts\":\n/*!*******************************!*\\\n !*** ./Misc/assetsManager.ts ***!\n \\*******************************/\n/*! exports provided: AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return AssetTaskState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return AbstractAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return AssetsProgressEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return MeshAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return TextFileAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return BinaryFileAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return ImageAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return TextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return CubeTextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return HDRCubeTextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return EquiRectangularCubeTextureAssetTask; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return AssetsManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/cubeTexture */ \"./Materials/Textures/cubeTexture.ts\");\n/* harmony import */ var _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/hdrCubeTexture */ \"./Materials/Textures/hdrCubeTexture.ts\");\n/* harmony import */ var _Materials_Textures_equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/equiRectangularCubeTexture */ \"./Materials/Textures/equiRectangularCubeTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines the list of states available for a task inside a AssetsManager\r\n */\r\nvar AssetTaskState;\r\n(function (AssetTaskState) {\r\n /**\r\n * Initialization\r\n */\r\n AssetTaskState[AssetTaskState[\"INIT\"] = 0] = \"INIT\";\r\n /**\r\n * Running\r\n */\r\n AssetTaskState[AssetTaskState[\"RUNNING\"] = 1] = \"RUNNING\";\r\n /**\r\n * Done\r\n */\r\n AssetTaskState[AssetTaskState[\"DONE\"] = 2] = \"DONE\";\r\n /**\r\n * Error\r\n */\r\n AssetTaskState[AssetTaskState[\"ERROR\"] = 3] = \"ERROR\";\r\n})(AssetTaskState || (AssetTaskState = {}));\r\n/**\r\n * Define an abstract asset task used with a AssetsManager class to load assets into a scene\r\n */\r\nvar AbstractAssetTask = /** @class */ (function () {\r\n /**\r\n * Creates a new AssetsManager\r\n * @param name defines the name of the task\r\n */\r\n function AbstractAssetTask(\r\n /**\r\n * Task name\r\n */ name) {\r\n this.name = name;\r\n this._isCompleted = false;\r\n this._taskState = AssetTaskState.INIT;\r\n }\r\n Object.defineProperty(AbstractAssetTask.prototype, \"isCompleted\", {\r\n /**\r\n * Get if the task is completed\r\n */\r\n get: function () {\r\n return this._isCompleted;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractAssetTask.prototype, \"taskState\", {\r\n /**\r\n * Gets the current state of the task\r\n */\r\n get: function () {\r\n return this._taskState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractAssetTask.prototype, \"errorObject\", {\r\n /**\r\n * Gets the current error object (if task is in error)\r\n */\r\n get: function () {\r\n return this._errorObject;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Internal only\r\n * @hidden\r\n */\r\n AbstractAssetTask.prototype._setErrorObject = function (message, exception) {\r\n if (this._errorObject) {\r\n return;\r\n }\r\n this._errorObject = {\r\n message: message,\r\n exception: exception\r\n };\r\n };\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n AbstractAssetTask.prototype.run = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n this._taskState = AssetTaskState.RUNNING;\r\n this.runTask(scene, function () {\r\n _this.onDoneCallback(onSuccess, onError);\r\n }, function (msg, exception) {\r\n _this.onErrorCallback(onError, msg, exception);\r\n });\r\n };\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n AbstractAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n throw new Error(\"runTask is not implemented\");\r\n };\r\n /**\r\n * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\r\n * This can be used with failed tasks that have the reason for failure fixed.\r\n */\r\n AbstractAssetTask.prototype.reset = function () {\r\n this._taskState = AssetTaskState.INIT;\r\n };\r\n AbstractAssetTask.prototype.onErrorCallback = function (onError, message, exception) {\r\n this._taskState = AssetTaskState.ERROR;\r\n this._errorObject = {\r\n message: message,\r\n exception: exception\r\n };\r\n if (this.onError) {\r\n this.onError(this, message, exception);\r\n }\r\n onError();\r\n };\r\n AbstractAssetTask.prototype.onDoneCallback = function (onSuccess, onError) {\r\n try {\r\n this._taskState = AssetTaskState.DONE;\r\n this._isCompleted = true;\r\n if (this.onSuccess) {\r\n this.onSuccess(this);\r\n }\r\n onSuccess();\r\n }\r\n catch (e) {\r\n this.onErrorCallback(onError, \"Task is done, error executing success callback(s)\", e);\r\n }\r\n };\r\n return AbstractAssetTask;\r\n}());\r\n\r\n/**\r\n * Class used to share progress information about assets loading\r\n */\r\nvar AssetsProgressEvent = /** @class */ (function () {\r\n /**\r\n * Creates a AssetsProgressEvent\r\n * @param remainingCount defines the number of remaining tasks to process\r\n * @param totalCount defines the total number of tasks\r\n * @param task defines the task that was just processed\r\n */\r\n function AssetsProgressEvent(remainingCount, totalCount, task) {\r\n this.remainingCount = remainingCount;\r\n this.totalCount = totalCount;\r\n this.task = task;\r\n }\r\n return AssetsProgressEvent;\r\n}());\r\n\r\n/**\r\n * Define a task used by AssetsManager to load meshes\r\n */\r\nvar MeshAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MeshAssetTask, _super);\r\n /**\r\n * Creates a new MeshAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename of the scene to load from\r\n */\r\n function MeshAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n meshesNames, \r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n rootUrl, \r\n /**\r\n * Defines the filename of the scene to load from\r\n */\r\n sceneFilename) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.meshesNames = meshesNames;\r\n _this.rootUrl = rootUrl;\r\n _this.sceneFilename = sceneFilename;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_1__[\"SceneLoader\"].ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups) {\r\n _this.loadedMeshes = meshes;\r\n _this.loadedParticleSystems = particleSystems;\r\n _this.loadedSkeletons = skeletons;\r\n _this.loadedAnimationGroups = animationGroups;\r\n onSuccess();\r\n }, null, function (scene, message, exception) {\r\n onError(message, exception);\r\n });\r\n };\r\n return MeshAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load text content\r\n */\r\nvar TextFileAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextFileAssetTask, _super);\r\n /**\r\n * Creates a new TextFileAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n */\r\n function TextFileAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n TextFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n scene._loadFile(this.url, function (data) {\r\n _this.text = data;\r\n onSuccess();\r\n }, undefined, false, false, function (request, exception) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n });\r\n };\r\n return TextFileAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load binary data\r\n */\r\nvar BinaryFileAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BinaryFileAssetTask, _super);\r\n /**\r\n * Creates a new BinaryFileAssetTask object\r\n * @param name defines the name of the new task\r\n * @param url defines the location of the file to load\r\n */\r\n function BinaryFileAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n BinaryFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n scene._loadFile(this.url, function (data) {\r\n _this.data = data;\r\n onSuccess();\r\n }, undefined, true, true, function (request, exception) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n });\r\n };\r\n return BinaryFileAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load images\r\n */\r\nvar ImageAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageAssetTask, _super);\r\n /**\r\n * Creates a new ImageAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the image to load\r\n */\r\n function ImageAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the image to load\r\n */\r\n url) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n ImageAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var _this = this;\r\n var img = new Image();\r\n _tools__WEBPACK_IMPORTED_MODULE_2__[\"Tools\"].SetCorsBehavior(this.url, img);\r\n img.onload = function () {\r\n _this.image = img;\r\n onSuccess();\r\n };\r\n img.onerror = function (err) {\r\n onError(\"Error loading image\", err);\r\n };\r\n img.src = this.url;\r\n };\r\n return ImageAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load 2D textures\r\n */\r\nvar TextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextureAssetTask, _super);\r\n /**\r\n * Creates a new TextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param noMipmap defines if mipmap should not be generated (default is false)\r\n * @param invertY defines if texture must be inverted on Y axis (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n function TextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url, \r\n /**\r\n * Defines if mipmap should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Defines if texture must be inverted on Y axis (default is false)\r\n */\r\n invertY, \r\n /**\r\n * Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n samplingMode) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.noMipmap = noMipmap;\r\n _this.invertY = invertY;\r\n _this.samplingMode = samplingMode;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n TextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"](this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);\r\n };\r\n return TextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load cube textures\r\n */\r\nvar CubeTextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CubeTextureAssetTask, _super);\r\n /**\r\n * Creates a new CubeTextureAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n * @param extensions defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param files defines the explicit list of files (undefined by default)\r\n */\r\n function CubeTextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n */\r\n url, \r\n /**\r\n * Defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n */\r\n extensions, \r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Defines the explicit list of files (undefined by default)\r\n */\r\n files) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.extensions = extensions;\r\n _this.noMipmap = noMipmap;\r\n _this.files = files;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n CubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_cubeTexture__WEBPACK_IMPORTED_MODULE_5__[\"CubeTexture\"](this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror);\r\n };\r\n return CubeTextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load HDR cube textures\r\n */\r\nvar HDRCubeTextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HDRCubeTextureAssetTask, _super);\r\n /**\r\n * Creates a new HDRCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n */\r\n function HDRCubeTextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url, \r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n size, \r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n */\r\n generateHarmonics, \r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n */\r\n gammaSpace, \r\n /**\r\n * Internal Use Only\r\n */\r\n reserved) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (generateHarmonics === void 0) { generateHarmonics = true; }\r\n if (gammaSpace === void 0) { gammaSpace = false; }\r\n if (reserved === void 0) { reserved = false; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.size = size;\r\n _this.noMipmap = noMipmap;\r\n _this.generateHarmonics = generateHarmonics;\r\n _this.gammaSpace = gammaSpace;\r\n _this.reserved = reserved;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n HDRCubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_hdrCubeTexture__WEBPACK_IMPORTED_MODULE_6__[\"HDRCubeTexture\"](this.url, scene, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, onload, onerror);\r\n };\r\n return HDRCubeTextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * Define a task used by AssetsManager to load Equirectangular cube textures\r\n */\r\nvar EquiRectangularCubeTextureAssetTask = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](EquiRectangularCubeTextureAssetTask, _super);\r\n /**\r\n * Creates a new EquiRectangularCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be)\r\n * If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param gammaSpace specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * (default is true)\r\n */\r\n function EquiRectangularCubeTextureAssetTask(\r\n /**\r\n * Defines the name of the task\r\n */\r\n name, \r\n /**\r\n * Defines the location of the file to load\r\n */\r\n url, \r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n size, \r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n noMipmap, \r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space,\r\n * but the standard material would require them in Gamma space) (default is true)\r\n */\r\n gammaSpace) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (gammaSpace === void 0) { gammaSpace = true; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.url = url;\r\n _this.size = size;\r\n _this.noMipmap = noMipmap;\r\n _this.gammaSpace = gammaSpace;\r\n return _this;\r\n }\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n EquiRectangularCubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {\r\n var onload = function () {\r\n onSuccess();\r\n };\r\n var onerror = function (message, exception) {\r\n onError(message, exception);\r\n };\r\n this.texture = new _Materials_Textures_equiRectangularCubeTexture__WEBPACK_IMPORTED_MODULE_7__[\"EquiRectangularCubeTexture\"](this.url, scene, this.size, this.noMipmap, this.gammaSpace, onload, onerror);\r\n };\r\n return EquiRectangularCubeTextureAssetTask;\r\n}(AbstractAssetTask));\r\n\r\n/**\r\n * This class can be used to easily import assets into a scene\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager\r\n */\r\nvar AssetsManager = /** @class */ (function () {\r\n /**\r\n * Creates a new AssetsManager\r\n * @param scene defines the scene to work on\r\n */\r\n function AssetsManager(scene) {\r\n this._isLoading = false;\r\n this._tasks = new Array();\r\n this._waitingTasksCount = 0;\r\n this._totalTasksCount = 0;\r\n /**\r\n * Observable called when all tasks are processed\r\n */\r\n this.onTaskSuccessObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable called when a task had an error\r\n */\r\n this.onTaskErrorObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable called when all tasks were executed\r\n */\r\n this.onTasksDoneObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable called when a task is done (whatever the result is)\r\n */\r\n this.onProgressObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should use the default loading screen\r\n * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n this.useDefaultLoadingScreen = true;\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen\r\n * when all assets have been downloaded.\r\n * If set to false, you need to manually call in hideLoadingUI() once your scene is ready.\r\n */\r\n this.autoHideLoadingUI = true;\r\n this._scene = scene;\r\n }\r\n /**\r\n * Add a MeshAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file\r\n * @returns a new MeshAssetTask object\r\n */\r\n AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {\r\n var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a TextFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new TextFileAssetTask object\r\n */\r\n AssetsManager.prototype.addTextFileTask = function (taskName, url) {\r\n var task = new TextFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a BinaryFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new BinaryFileAssetTask object\r\n */\r\n AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {\r\n var task = new BinaryFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a ImageAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new ImageAssetTask object\r\n */\r\n AssetsManager.prototype.addImageTask = function (taskName, url) {\r\n var task = new ImageAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a TextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @returns a new TextureAssetTask object\r\n */\r\n AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Add a CubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param extensions defines the extension to use to load the cube map (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param files defines the list of files to load (can be null)\r\n * @returns a new CubeTextureAssetTask object\r\n */\r\n AssetsManager.prototype.addCubeTextureTask = function (taskName, url, extensions, noMipmap, files) {\r\n var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n *\r\n * Add a HDRCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param generateHarmonics defines if you want to automatically generate (true by default)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n * @returns a new HDRCubeTextureAssetTask object\r\n */\r\n AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (generateHarmonics === void 0) { generateHarmonics = true; }\r\n if (gammaSpace === void 0) { gammaSpace = false; }\r\n if (reserved === void 0) { reserved = false; }\r\n var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n *\r\n * Add a EquiRectangularCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @returns a new EquiRectangularCubeTextureAssetTask object\r\n */\r\n AssetsManager.prototype.addEquiRectangularCubeTextureAssetTask = function (taskName, url, size, noMipmap, gammaSpace) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (gammaSpace === void 0) { gammaSpace = true; }\r\n var task = new EquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap, gammaSpace);\r\n this._tasks.push(task);\r\n return task;\r\n };\r\n /**\r\n * Remove a task from the assets manager.\r\n * @param task the task to remove\r\n */\r\n AssetsManager.prototype.removeTask = function (task) {\r\n var index = this._tasks.indexOf(task);\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n };\r\n AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {\r\n this._waitingTasksCount--;\r\n try {\r\n if (this.onProgress) {\r\n this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);\r\n }\r\n this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Error(\"Error running progress callbacks.\");\r\n console.log(e);\r\n }\r\n if (this._waitingTasksCount === 0) {\r\n try {\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n // Let's remove successfull tasks\r\n var currentTasks = this._tasks.slice();\r\n for (var _i = 0, currentTasks_1 = currentTasks; _i < currentTasks_1.length; _i++) {\r\n var task = currentTasks_1[_i];\r\n if (task.taskState === AssetTaskState.DONE) {\r\n var index = this._tasks.indexOf(task);\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_8__[\"Logger\"].Error(\"Error running tasks-done callbacks.\");\r\n console.log(e);\r\n }\r\n this._isLoading = false;\r\n if (this.autoHideLoadingUI) {\r\n this._scene.getEngine().hideLoadingUI();\r\n }\r\n }\r\n };\r\n AssetsManager.prototype._runTask = function (task) {\r\n var _this = this;\r\n var done = function () {\r\n try {\r\n if (_this.onTaskSuccess) {\r\n _this.onTaskSuccess(task);\r\n }\r\n _this.onTaskSuccessObservable.notifyObservers(task);\r\n _this._decreaseWaitingTasksCount(task);\r\n }\r\n catch (e) {\r\n error(\"Error executing task success callbacks\", e);\r\n }\r\n };\r\n var error = function (message, exception) {\r\n task._setErrorObject(message, exception);\r\n if (_this.onTaskError) {\r\n _this.onTaskError(task);\r\n }\r\n _this.onTaskErrorObservable.notifyObservers(task);\r\n _this._decreaseWaitingTasksCount(task);\r\n };\r\n task.run(this._scene, done, error);\r\n };\r\n /**\r\n * Reset the AssetsManager and remove all tasks\r\n * @return the current instance of the AssetsManager\r\n */\r\n AssetsManager.prototype.reset = function () {\r\n this._isLoading = false;\r\n this._tasks = new Array();\r\n return this;\r\n };\r\n /**\r\n * Start the loading process\r\n * @return the current instance of the AssetsManager\r\n */\r\n AssetsManager.prototype.load = function () {\r\n if (this._isLoading) {\r\n return this;\r\n }\r\n this._isLoading = true;\r\n this._waitingTasksCount = this._tasks.length;\r\n this._totalTasksCount = this._tasks.length;\r\n if (this._waitingTasksCount === 0) {\r\n this._isLoading = false;\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n return this;\r\n }\r\n if (this.useDefaultLoadingScreen) {\r\n this._scene.getEngine().displayLoadingUI();\r\n }\r\n for (var index = 0; index < this._tasks.length; index++) {\r\n var task = this._tasks[index];\r\n if (task.taskState === AssetTaskState.INIT) {\r\n this._runTask(task);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Start the loading process as an async operation\r\n * @return a promise returning the list of failed tasks\r\n */\r\n AssetsManager.prototype.loadAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (_this._isLoading) {\r\n resolve();\r\n return;\r\n }\r\n _this.onTasksDoneObservable.addOnce(function (remainingTasks) {\r\n if (remainingTasks && remainingTasks.length) {\r\n reject(remainingTasks);\r\n }\r\n else {\r\n resolve();\r\n }\r\n });\r\n _this.load();\r\n });\r\n };\r\n return AssetsManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/basis.ts\":\n/*!***********************!*\\\n !*** ./Misc/basis.ts ***!\n \\***********************/\n/*! exports provided: BasisTranscodeConfiguration, BasisTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BasisTranscodeConfiguration\", function() { return BasisTranscodeConfiguration; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BasisTools\", function() { return BasisTools; });\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Info about the .basis files\r\n */\r\nvar BasisFileInfo = /** @class */ (function () {\r\n function BasisFileInfo() {\r\n }\r\n return BasisFileInfo;\r\n}());\r\n/**\r\n * Result of transcoding a basis file\r\n */\r\nvar TranscodeResult = /** @class */ (function () {\r\n function TranscodeResult() {\r\n }\r\n return TranscodeResult;\r\n}());\r\n/**\r\n * Configuration options for the Basis transcoder\r\n */\r\nvar BasisTranscodeConfiguration = /** @class */ (function () {\r\n function BasisTranscodeConfiguration() {\r\n }\r\n return BasisTranscodeConfiguration;\r\n}());\r\n\r\n/**\r\n * @hidden\r\n * Enum of basis transcoder formats\r\n */\r\nvar BASIS_FORMATS;\r\n(function (BASIS_FORMATS) {\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC1\"] = 0] = \"cTFETC1\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC1\"] = 1] = \"cTFBC1\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC4\"] = 2] = \"cTFBC4\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFPVRTC1_4_OPAQUE_ONLY\"] = 3] = \"cTFPVRTC1_4_OPAQUE_ONLY\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC7_M6_OPAQUE_ONLY\"] = 4] = \"cTFBC7_M6_OPAQUE_ONLY\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFETC2\"] = 5] = \"cTFETC2\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC3\"] = 6] = \"cTFBC3\";\r\n BASIS_FORMATS[BASIS_FORMATS[\"cTFBC5\"] = 7] = \"cTFBC5\";\r\n})(BASIS_FORMATS || (BASIS_FORMATS = {}));\r\n/**\r\n * Used to load .Basis files\r\n * See https://github.com/BinomialLLC/basis_universal/tree/master/webgl\r\n */\r\nvar BasisTools = /** @class */ (function () {\r\n function BasisTools() {\r\n }\r\n /**\r\n * Get the internal format to be passed to texImage2D corresponding to the .basis format value\r\n * @param basisFormat format chosen from GetSupportedTranscodeFormat\r\n * @returns internal format corresponding to the Basis format\r\n */\r\n BasisTools.GetInternalFormatFromBasisFormat = function (basisFormat) {\r\n // Corrisponding internal formats\r\n var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;\r\n var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;\r\n var RGB_ETC1_Format = 36196;\r\n if (basisFormat === BASIS_FORMATS.cTFETC1) {\r\n return RGB_ETC1_Format;\r\n }\r\n else if (basisFormat === BASIS_FORMATS.cTFBC1) {\r\n return COMPRESSED_RGB_S3TC_DXT1_EXT;\r\n }\r\n else if (basisFormat === BASIS_FORMATS.cTFBC3) {\r\n return COMPRESSED_RGBA_S3TC_DXT5_EXT;\r\n }\r\n else {\r\n throw \"The chosen Basis transcoder format is not currently supported\";\r\n }\r\n };\r\n BasisTools._CreateWorkerAsync = function () {\r\n var _this = this;\r\n if (!this._WorkerPromise) {\r\n this._WorkerPromise = new Promise(function (res) {\r\n if (_this._Worker) {\r\n res(_this._Worker);\r\n }\r\n else {\r\n _tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFileAsync(BasisTools.WasmModuleURL).then(function (wasmBinary) {\r\n var workerBlobUrl = URL.createObjectURL(new Blob([\"(\" + workerFunc + \")()\"], { type: \"application/javascript\" }));\r\n _this._Worker = new Worker(workerBlobUrl);\r\n var initHandler = function (msg) {\r\n if (msg.data.action === \"init\") {\r\n _this._Worker.removeEventListener(\"message\", initHandler);\r\n res(_this._Worker);\r\n }\r\n };\r\n _this._Worker.addEventListener(\"message\", initHandler);\r\n _this._Worker.postMessage({ action: \"init\", url: BasisTools.JSModuleURL, wasmBinary: wasmBinary });\r\n });\r\n }\r\n });\r\n }\r\n return this._WorkerPromise;\r\n };\r\n /**\r\n * Transcodes a loaded image file to compressed pixel data\r\n * @param imageData image data to transcode\r\n * @param config configuration options for the transcoding\r\n * @returns a promise resulting in the transcoded image\r\n */\r\n BasisTools.TranscodeAsync = function (imageData, config) {\r\n var _this = this;\r\n return new Promise(function (res, rej) {\r\n _this._CreateWorkerAsync().then(function () {\r\n var actionId = _this._actionId++;\r\n var messageHandler = function (msg) {\r\n if (msg.data.action === \"transcode\" && msg.data.id === actionId) {\r\n _this._Worker.removeEventListener(\"message\", messageHandler);\r\n if (!msg.data.success) {\r\n rej(\"Transcode is not supported on this device\");\r\n }\r\n else {\r\n res(msg.data);\r\n }\r\n }\r\n };\r\n _this._Worker.addEventListener(\"message\", messageHandler);\r\n _this._Worker.postMessage({ action: \"transcode\", id: actionId, imageData: imageData, config: config, ignoreSupportedFormats: _this._IgnoreSupportedFormats }, [imageData]);\r\n });\r\n });\r\n };\r\n /**\r\n * Loads a texture from the transcode result\r\n * @param texture texture load to\r\n * @param transcodeResult the result of transcoding the basis file to load from\r\n */\r\n BasisTools.LoadTextureFromTranscodeResult = function (texture, transcodeResult) {\r\n var _loop_1 = function () {\r\n rootImage = transcodeResult.fileInfo.images[i].levels[0];\r\n texture._invertVScale = texture.invertY;\r\n if (transcodeResult.format === -1) {\r\n // No compatable compressed format found, fallback to RGB\r\n texture.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURETYPE_UNSIGNED_SHORT_5_6_5;\r\n texture.format = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB;\r\n if (texture.getEngine().webGLVersion < 2 && (_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(rootImage.width) % 1 !== 0 || _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(rootImage.height) % 1 !== 0)) {\r\n // Create non power of two texture\r\n var source_1 = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"](texture.getEngine(), _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_2__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n texture._invertVScale = texture.invertY;\r\n source_1.type = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURETYPE_UNSIGNED_SHORT_5_6_5;\r\n source_1.format = _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB;\r\n // Fallback requires aligned width/height\r\n source_1.width = (rootImage.width + 3) & ~3;\r\n source_1.height = (rootImage.height + 3) & ~3;\r\n texture.getEngine()._bindTextureDirectly(source_1.getEngine()._gl.TEXTURE_2D, source_1, true);\r\n texture.getEngine()._uploadDataToTextureDirectly(source_1, rootImage.transcodedPixels, i, 0, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB, true);\r\n // Resize to power of two\r\n source_1.getEngine()._rescaleTexture(source_1, texture, texture.getEngine().scenes[0], source_1.getEngine()._getInternalFormat(_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB), function () {\r\n source_1.getEngine()._releaseTexture(source_1);\r\n source_1.getEngine()._bindTextureDirectly(source_1.getEngine()._gl.TEXTURE_2D, texture, true);\r\n });\r\n }\r\n else {\r\n // Fallback is already inverted\r\n texture._invertVScale = !texture.invertY;\r\n // Upload directly\r\n texture.width = (rootImage.width + 3) & ~3;\r\n texture.height = (rootImage.height + 3) & ~3;\r\n texture.getEngine()._uploadDataToTextureDirectly(texture, rootImage.transcodedPixels, i, 0, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTUREFORMAT_RGB, true);\r\n }\r\n }\r\n else {\r\n texture.width = rootImage.width;\r\n texture.height = rootImage.height;\r\n // Upload all mip levels in the file\r\n transcodeResult.fileInfo.images[i].levels.forEach(function (level, index) {\r\n texture.getEngine()._uploadCompressedDataToTextureDirectly(texture, BasisTools.GetInternalFormatFromBasisFormat(transcodeResult.format), level.width, level.height, level.transcodedPixels, i, index);\r\n });\r\n if (texture.getEngine().webGLVersion < 2 && (_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(texture.width) % 1 !== 0 || _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Log2(texture.height) % 1 !== 0)) {\r\n _tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].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.\");\r\n texture._cachedWrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n }\r\n }\r\n };\r\n var rootImage;\r\n for (var i = 0; i < transcodeResult.fileInfo.images.length; i++) {\r\n _loop_1();\r\n }\r\n };\r\n BasisTools._IgnoreSupportedFormats = false;\r\n /**\r\n * URL to use when loading the basis transcoder\r\n */\r\n BasisTools.JSModuleURL = \"https://preview.babylonjs.com/basisTranscoder/basis_transcoder.js\";\r\n /**\r\n * URL to use when loading the wasm module for the transcoder\r\n */\r\n BasisTools.WasmModuleURL = \"https://preview.babylonjs.com/basisTranscoder/basis_transcoder.wasm\";\r\n BasisTools._WorkerPromise = null;\r\n BasisTools._Worker = null;\r\n BasisTools._actionId = 0;\r\n return BasisTools;\r\n}());\r\n\r\nfunction workerFunc() {\r\n var _BASIS_FORMAT = {\r\n cTFETC1: 0,\r\n cTFBC1: 1,\r\n cTFBC4: 2,\r\n cTFPVRTC1_4_OPAQUE_ONLY: 3,\r\n cTFBC7_M6_OPAQUE_ONLY: 4,\r\n cTFETC2: 5,\r\n cTFBC3: 6,\r\n cTFBC5: 7,\r\n };\r\n var transcoderModulePromise = null;\r\n onmessage = function (event) {\r\n if (event.data.action === \"init\") {\r\n // Load the transcoder if it hasn't been yet\r\n if (!transcoderModulePromise) {\r\n // Override wasm binary\r\n Module = { wasmBinary: (event.data.wasmBinary) };\r\n importScripts(event.data.url);\r\n transcoderModulePromise = new Promise(function (res) {\r\n Module.onRuntimeInitialized = function () {\r\n Module.initializeBasis();\r\n res();\r\n };\r\n });\r\n }\r\n transcoderModulePromise.then(function () {\r\n postMessage({ action: \"init\" });\r\n });\r\n }\r\n else if (event.data.action === \"transcode\") {\r\n // Transcode the basis image and return the resulting pixels\r\n var config = event.data.config;\r\n var imgData = event.data.imageData;\r\n var loadedFile = new Module.BasisFile(new Uint8Array(imgData));\r\n var fileInfo = GetFileInfo(loadedFile);\r\n var format = event.data.ignoreSupportedFormats ? null : GetSupportedTranscodeFormat(event.data.config, fileInfo);\r\n var needsConversion = false;\r\n if (format === null) {\r\n needsConversion = true;\r\n format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFBC3 : _BASIS_FORMAT.cTFBC1;\r\n }\r\n // Begin transcode\r\n var success = true;\r\n if (!loadedFile.startTranscoding()) {\r\n success = false;\r\n }\r\n var buffers = [];\r\n for (var imageIndex = 0; imageIndex < fileInfo.images.length; imageIndex++) {\r\n if (!success) {\r\n break;\r\n }\r\n var image = fileInfo.images[imageIndex];\r\n if (config.loadSingleImage === undefined || config.loadSingleImage === imageIndex) {\r\n var mipCount = image.levels.length;\r\n if (config.loadMipmapLevels === false) {\r\n mipCount = 1;\r\n }\r\n for (var levelIndex = 0; levelIndex < mipCount; levelIndex++) {\r\n var levelInfo = image.levels[levelIndex];\r\n var pixels = TranscodeLevel(loadedFile, imageIndex, levelIndex, format, needsConversion);\r\n if (!pixels) {\r\n success = false;\r\n break;\r\n }\r\n levelInfo.transcodedPixels = pixels;\r\n buffers.push(levelInfo.transcodedPixels.buffer);\r\n }\r\n }\r\n }\r\n // Close file\r\n loadedFile.close();\r\n loadedFile.delete();\r\n if (needsConversion) {\r\n format = -1;\r\n }\r\n if (!success) {\r\n postMessage({ action: \"transcode\", success: success, id: event.data.id });\r\n }\r\n else {\r\n postMessage({ action: \"transcode\", success: success, id: event.data.id, fileInfo: fileInfo, format: format }, buffers);\r\n }\r\n }\r\n };\r\n /**\r\n * Detects the supported transcode format for the file\r\n * @param config transcode config\r\n * @param fileInfo info about the file\r\n * @returns the chosed format or null if none are supported\r\n */\r\n function GetSupportedTranscodeFormat(config, fileInfo) {\r\n var format = null;\r\n if (config.supportedCompressionFormats) {\r\n if (config.supportedCompressionFormats.etc1) {\r\n format = _BASIS_FORMAT.cTFETC1;\r\n }\r\n else if (config.supportedCompressionFormats.s3tc) {\r\n format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFBC3 : _BASIS_FORMAT.cTFBC1;\r\n }\r\n else if (config.supportedCompressionFormats.pvrtc) {\r\n // TODO uncomment this after pvrtc bug is fixed is basis transcoder\r\n // See discussion here: https://github.com/mrdoob/three.js/issues/16524#issuecomment-498929924\r\n // format = _BASIS_FORMAT.cTFPVRTC1_4_OPAQUE_ONLY;\r\n }\r\n else if (config.supportedCompressionFormats.etc2) {\r\n format = _BASIS_FORMAT.cTFETC2;\r\n }\r\n }\r\n return format;\r\n }\r\n /**\r\n * Retreives information about the basis file eg. dimensions\r\n * @param basisFile the basis file to get the info from\r\n * @returns information about the basis file\r\n */\r\n function GetFileInfo(basisFile) {\r\n var hasAlpha = basisFile.getHasAlpha();\r\n var imageCount = basisFile.getNumImages();\r\n var images = [];\r\n for (var i = 0; i < imageCount; i++) {\r\n var imageInfo = {\r\n levels: []\r\n };\r\n var levelCount = basisFile.getNumLevels(i);\r\n for (var level = 0; level < levelCount; level++) {\r\n var levelInfo = {\r\n width: basisFile.getImageWidth(i, level),\r\n height: basisFile.getImageHeight(i, level)\r\n };\r\n imageInfo.levels.push(levelInfo);\r\n }\r\n images.push(imageInfo);\r\n }\r\n var info = { hasAlpha: hasAlpha, images: images };\r\n return info;\r\n }\r\n function TranscodeLevel(loadedFile, imageIndex, levelIndex, format, convertToRgb565) {\r\n var dstSize = loadedFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, format);\r\n var dst = new Uint8Array(dstSize);\r\n if (!loadedFile.transcodeImage(dst, imageIndex, levelIndex, format, 1, 0)) {\r\n return null;\r\n }\r\n // If no supported format is found, load as dxt and convert to rgb565\r\n if (convertToRgb565) {\r\n var alignedWidth = (loadedFile.getImageWidth(imageIndex, levelIndex) + 3) & ~3;\r\n var alignedHeight = (loadedFile.getImageHeight(imageIndex, levelIndex) + 3) & ~3;\r\n dst = ConvertDxtToRgb565(dst, 0, alignedWidth, alignedHeight);\r\n }\r\n return dst;\r\n }\r\n /**\r\n * From https://github.com/BinomialLLC/basis_universal/blob/master/webgl/texture/dxt-to-rgb565.js\r\n * An unoptimized version of dxtToRgb565. Also, the floating\r\n * point math used to compute the colors actually results in\r\n * slightly different colors compared to hardware DXT decoders.\r\n * @param src dxt src pixels\r\n * @param srcByteOffset offset for the start of src\r\n * @param width aligned width of the image\r\n * @param height aligned height of the image\r\n * @return the converted pixels\r\n */\r\n function ConvertDxtToRgb565(src, srcByteOffset, width, height) {\r\n var c = new Uint16Array(4);\r\n var dst = new Uint16Array(width * height);\r\n var blockWidth = width / 4;\r\n var blockHeight = height / 4;\r\n for (var blockY = 0; blockY < blockHeight; blockY++) {\r\n for (var blockX = 0; blockX < blockWidth; blockX++) {\r\n var i = srcByteOffset + 8 * (blockY * blockWidth + blockX);\r\n c[0] = src[i] | (src[i + 1] << 8);\r\n c[1] = src[i + 2] | (src[i + 3] << 8);\r\n c[2] = (2 * (c[0] & 0x1f) + 1 * (c[1] & 0x1f)) / 3\r\n | (((2 * (c[0] & 0x7e0) + 1 * (c[1] & 0x7e0)) / 3) & 0x7e0)\r\n | (((2 * (c[0] & 0xf800) + 1 * (c[1] & 0xf800)) / 3) & 0xf800);\r\n c[3] = (2 * (c[1] & 0x1f) + 1 * (c[0] & 0x1f)) / 3\r\n | (((2 * (c[1] & 0x7e0) + 1 * (c[0] & 0x7e0)) / 3) & 0x7e0)\r\n | (((2 * (c[1] & 0xf800) + 1 * (c[0] & 0xf800)) / 3) & 0xf800);\r\n for (var row = 0; row < 4; row++) {\r\n var m = src[i + 4 + row];\r\n var dstI = (blockY * 4 + row) * width + blockX * 4;\r\n dst[dstI++] = c[m & 0x3];\r\n dst[dstI++] = c[(m >> 2) & 0x3];\r\n dst[dstI++] = c[(m >> 4) & 0x3];\r\n dst[dstI++] = c[(m >> 6) & 0x3];\r\n }\r\n }\r\n }\r\n return dst;\r\n }\r\n}\r\n\n\n/***/ }),\n\n/***/ \"./Misc/brdfTextureTools.ts\":\n/*!**********************************!*\\\n !*** ./Misc/brdfTextureTools.ts ***!\n \\**********************************/\n/*! exports provided: BRDFTextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return BRDFTextureTools; });\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rgbdTextureTools */ \"./Misc/rgbdTextureTools.ts\");\n\r\n\r\n/**\r\n * Class used to host texture specific utilities\r\n */\r\nvar BRDFTextureTools = /** @class */ (function () {\r\n function BRDFTextureTools() {\r\n }\r\n /**\r\n * Gets a default environment BRDF for MS-BRDF Height Correlated BRDF\r\n * @param scene defines the hosting scene\r\n * @returns the environment BRDF texture\r\n */\r\n BRDFTextureTools.GetEnvironmentBRDFTexture = function (scene) {\r\n if (!scene.environmentBRDFTexture) {\r\n // Forces Delayed Texture Loading to prevent undefined error whilst setting RGBD values.\r\n var useDelayedTextureLoading = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n var texture = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CreateFromBase64String(this._environmentBRDFBase64Texture, \"EnvironmentBRDFTexture\", scene, true, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n texture.isRGBD = true;\r\n texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n scene.environmentBRDFTexture = texture;\r\n scene.useDelayedTextureLoading = useDelayedTextureLoading;\r\n _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_1__[\"RGBDTextureTools\"].ExpandRGBDTexture(texture);\r\n }\r\n return scene.environmentBRDFTexture;\r\n };\r\n BRDFTextureTools._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==\";\r\n return BRDFTextureTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/dds.ts\":\n/*!*********************!*\\\n !*** ./Misc/dds.ts ***!\n \\*********************/\n/*! exports provided: DDSTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return DDSTools; });\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/HighDynamicRange/cubemapToSphericalPolynomial */ \"./Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_Extensions_engine_cubeTexture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Engines/Extensions/engine.cubeTexture */ \"./Engines/Extensions/engine.cubeTexture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html\r\n// All values and structures referenced from:\r\n// http://msdn.microsoft.com/en-us/library/bb943991.aspx/\r\nvar DDS_MAGIC = 0x20534444;\r\nvar \r\n//DDSD_CAPS = 0x1,\r\n//DDSD_HEIGHT = 0x2,\r\n//DDSD_WIDTH = 0x4,\r\n//DDSD_PITCH = 0x8,\r\n//DDSD_PIXELFORMAT = 0x1000,\r\nDDSD_MIPMAPCOUNT = 0x20000;\r\n//DDSD_LINEARSIZE = 0x80000,\r\n//DDSD_DEPTH = 0x800000;\r\n// var DDSCAPS_COMPLEX = 0x8,\r\n// DDSCAPS_MIPMAP = 0x400000,\r\n// DDSCAPS_TEXTURE = 0x1000;\r\nvar DDSCAPS2_CUBEMAP = 0x200;\r\n// DDSCAPS2_CUBEMAP_POSITIVEX = 0x400,\r\n// DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800,\r\n// DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000,\r\n// DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000,\r\n// DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000,\r\n// DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000,\r\n// DDSCAPS2_VOLUME = 0x200000;\r\nvar \r\n//DDPF_ALPHAPIXELS = 0x1,\r\n//DDPF_ALPHA = 0x2,\r\nDDPF_FOURCC = 0x4, DDPF_RGB = 0x40, \r\n//DDPF_YUV = 0x200,\r\nDDPF_LUMINANCE = 0x20000;\r\nfunction FourCCToInt32(value) {\r\n return value.charCodeAt(0) +\r\n (value.charCodeAt(1) << 8) +\r\n (value.charCodeAt(2) << 16) +\r\n (value.charCodeAt(3) << 24);\r\n}\r\nfunction Int32ToFourCC(value) {\r\n return String.fromCharCode(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, (value >> 24) & 0xff);\r\n}\r\nvar FOURCC_DXT1 = FourCCToInt32(\"DXT1\");\r\nvar FOURCC_DXT3 = FourCCToInt32(\"DXT3\");\r\nvar FOURCC_DXT5 = FourCCToInt32(\"DXT5\");\r\nvar FOURCC_DX10 = FourCCToInt32(\"DX10\");\r\nvar FOURCC_D3DFMT_R16G16B16A16F = 113;\r\nvar FOURCC_D3DFMT_R32G32B32A32F = 116;\r\nvar DXGI_FORMAT_R32G32B32A32_FLOAT = 2;\r\nvar DXGI_FORMAT_R16G16B16A16_FLOAT = 10;\r\nvar DXGI_FORMAT_B8G8R8X8_UNORM = 88;\r\nvar headerLengthInt = 31; // The header length in 32 bit ints\r\n// Offsets into the header array\r\nvar off_magic = 0;\r\nvar off_size = 1;\r\nvar off_flags = 2;\r\nvar off_height = 3;\r\nvar off_width = 4;\r\nvar off_mipmapCount = 7;\r\nvar off_pfFlags = 20;\r\nvar off_pfFourCC = 21;\r\nvar off_RGBbpp = 22;\r\nvar off_RMask = 23;\r\nvar off_GMask = 24;\r\nvar off_BMask = 25;\r\nvar off_AMask = 26;\r\n// var off_caps1 = 27;\r\nvar off_caps2 = 28;\r\n// var off_caps3 = 29;\r\n// var off_caps4 = 30;\r\nvar off_dxgiFormat = 32;\r\n/**\r\n * Class used to provide DDS decompression tools\r\n */\r\nvar DDSTools = /** @class */ (function () {\r\n function DDSTools() {\r\n }\r\n /**\r\n * Gets DDS information from an array buffer\r\n * @param arrayBuffer defines the array buffer to read data from\r\n * @returns the DDS information\r\n */\r\n DDSTools.GetDDSInfo = function (arrayBuffer) {\r\n var header = new Int32Array(arrayBuffer, 0, headerLengthInt);\r\n var extendedHeader = new Int32Array(arrayBuffer, 0, headerLengthInt + 4);\r\n var mipmapCount = 1;\r\n if (header[off_flags] & DDSD_MIPMAPCOUNT) {\r\n mipmapCount = Math.max(1, header[off_mipmapCount]);\r\n }\r\n var fourCC = header[off_pfFourCC];\r\n var dxgiFormat = (fourCC === FOURCC_DX10) ? extendedHeader[off_dxgiFormat] : 0;\r\n var textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n switch (fourCC) {\r\n case FOURCC_D3DFMT_R16G16B16A16F:\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n break;\r\n case FOURCC_D3DFMT_R32G32B32A32F:\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n break;\r\n case FOURCC_DX10:\r\n if (dxgiFormat === DXGI_FORMAT_R16G16B16A16_FLOAT) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n break;\r\n }\r\n if (dxgiFormat === DXGI_FORMAT_R32G32B32A32_FLOAT) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n break;\r\n }\r\n }\r\n return {\r\n width: header[off_width],\r\n height: header[off_height],\r\n mipmapCount: mipmapCount,\r\n isFourCC: (header[off_pfFlags] & DDPF_FOURCC) === DDPF_FOURCC,\r\n isRGB: (header[off_pfFlags] & DDPF_RGB) === DDPF_RGB,\r\n isLuminance: (header[off_pfFlags] & DDPF_LUMINANCE) === DDPF_LUMINANCE,\r\n isCube: (header[off_caps2] & DDSCAPS2_CUBEMAP) === DDSCAPS2_CUBEMAP,\r\n isCompressed: (fourCC === FOURCC_DXT1 || fourCC === FOURCC_DXT3 || fourCC === FOURCC_DXT5),\r\n dxgiFormat: dxgiFormat,\r\n textureType: textureType\r\n };\r\n };\r\n DDSTools._ToHalfFloat = function (value) {\r\n if (!DDSTools._FloatView) {\r\n DDSTools._FloatView = new Float32Array(1);\r\n DDSTools._Int32View = new Int32Array(DDSTools._FloatView.buffer);\r\n }\r\n DDSTools._FloatView[0] = value;\r\n var x = DDSTools._Int32View[0];\r\n var bits = (x >> 16) & 0x8000; /* Get the sign */\r\n var m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */\r\n var e = (x >> 23) & 0xff; /* Using int is faster here */\r\n /* If zero, or denormal, or exponent underflows too much for a denormal\r\n * half, return signed zero. */\r\n if (e < 103) {\r\n return bits;\r\n }\r\n /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */\r\n if (e > 142) {\r\n bits |= 0x7c00;\r\n /* If exponent was 0xff and one mantissa bit was set, it means NaN,\r\n * not Inf, so make sure we set one mantissa bit too. */\r\n bits |= ((e == 255) ? 0 : 1) && (x & 0x007fffff);\r\n return bits;\r\n }\r\n /* If exponent underflows but not too much, return a denormal */\r\n if (e < 113) {\r\n m |= 0x0800;\r\n /* Extra rounding may overflow and set mantissa to 0 and exponent\r\n * to 1, which is OK. */\r\n bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1);\r\n return bits;\r\n }\r\n bits |= ((e - 112) << 10) | (m >> 1);\r\n bits += m & 1;\r\n return bits;\r\n };\r\n DDSTools._FromHalfFloat = function (value) {\r\n var s = (value & 0x8000) >> 15;\r\n var e = (value & 0x7C00) >> 10;\r\n var f = value & 0x03FF;\r\n if (e === 0) {\r\n return (s ? -1 : 1) * Math.pow(2, -14) * (f / Math.pow(2, 10));\r\n }\r\n else if (e == 0x1F) {\r\n return f ? NaN : ((s ? -1 : 1) * Infinity);\r\n }\r\n return (s ? -1 : 1) * Math.pow(2, e - 15) * (1 + (f / Math.pow(2, 10)));\r\n };\r\n DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n var destArray = new Float32Array(dataLength);\r\n var srcData = new Uint16Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = DDSTools._FromHalfFloat(srcData[srcPos]);\r\n destArray[index + 1] = DDSTools._FromHalfFloat(srcData[srcPos + 1]);\r\n destArray[index + 2] = DDSTools._FromHalfFloat(srcData[srcPos + 2]);\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n destArray[index + 3] = lod;\r\n }\r\n else {\r\n destArray[index + 3] = DDSTools._FromHalfFloat(srcData[srcPos + 3]);\r\n }\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n };\r\n DDSTools._GetHalfFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n var destArray = new Uint16Array(dataLength);\r\n var srcData = new Uint16Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = srcData[srcPos];\r\n destArray[index + 1] = srcData[srcPos + 1];\r\n destArray[index + 2] = srcData[srcPos + 2];\r\n destArray[index + 3] = DDSTools._ToHalfFloat(lod);\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n }\r\n return new Uint16Array(arrayBuffer, dataOffset, dataLength);\r\n };\r\n DDSTools._GetFloatRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n var destArray = new Float32Array(dataLength);\r\n var srcData = new Float32Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = srcData[srcPos];\r\n destArray[index + 1] = srcData[srcPos + 1];\r\n destArray[index + 2] = srcData[srcPos + 2];\r\n destArray[index + 3] = lod;\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n }\r\n return new Float32Array(arrayBuffer, dataOffset, dataLength);\r\n };\r\n DDSTools._GetFloatAsUIntRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n var destArray = new Uint8Array(dataLength);\r\n var srcData = new Float32Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos]) * 255;\r\n destArray[index + 1] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos + 1]) * 255;\r\n destArray[index + 2] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos + 2]) * 255;\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n destArray[index + 3] = lod;\r\n }\r\n else {\r\n destArray[index + 3] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(srcData[srcPos + 3]) * 255;\r\n }\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n };\r\n DDSTools._GetHalfFloatAsUIntRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, lod) {\r\n var destArray = new Uint8Array(dataLength);\r\n var srcData = new Uint16Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n destArray[index] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos])) * 255;\r\n destArray[index + 1] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 1])) * 255;\r\n destArray[index + 2] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 2])) * 255;\r\n if (DDSTools.StoreLODInAlphaChannel) {\r\n destArray[index + 3] = lod;\r\n }\r\n else {\r\n destArray[index + 3] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 3])) * 255;\r\n }\r\n index += 4;\r\n }\r\n }\r\n return destArray;\r\n };\r\n DDSTools._GetRGBAArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset) {\r\n var byteArray = new Uint8Array(dataLength);\r\n var srcData = new Uint8Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 4;\r\n byteArray[index] = srcData[srcPos + rOffset];\r\n byteArray[index + 1] = srcData[srcPos + gOffset];\r\n byteArray[index + 2] = srcData[srcPos + bOffset];\r\n byteArray[index + 3] = srcData[srcPos + aOffset];\r\n index += 4;\r\n }\r\n }\r\n return byteArray;\r\n };\r\n DDSTools._ExtractLongWordOrder = function (value) {\r\n if (value === 0 || value === 255 || value === -16777216) {\r\n return 0;\r\n }\r\n return 1 + DDSTools._ExtractLongWordOrder(value >> 8);\r\n };\r\n DDSTools._GetRGBArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset) {\r\n var byteArray = new Uint8Array(dataLength);\r\n var srcData = new Uint8Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width) * 3;\r\n byteArray[index] = srcData[srcPos + rOffset];\r\n byteArray[index + 1] = srcData[srcPos + gOffset];\r\n byteArray[index + 2] = srcData[srcPos + bOffset];\r\n index += 3;\r\n }\r\n }\r\n return byteArray;\r\n };\r\n DDSTools._GetLuminanceArrayBuffer = function (width, height, dataOffset, dataLength, arrayBuffer) {\r\n var byteArray = new Uint8Array(dataLength);\r\n var srcData = new Uint8Array(arrayBuffer, dataOffset);\r\n var index = 0;\r\n for (var y = 0; y < height; y++) {\r\n for (var x = 0; x < width; x++) {\r\n var srcPos = (x + y * width);\r\n byteArray[index] = srcData[srcPos];\r\n index++;\r\n }\r\n }\r\n return byteArray;\r\n };\r\n /**\r\n * Uploads DDS Levels to a Babylon Texture\r\n * @hidden\r\n */\r\n DDSTools.UploadDDSLevels = function (engine, texture, arrayBuffer, info, loadMipmaps, faces, lodIndex, currentFace) {\r\n if (lodIndex === void 0) { lodIndex = -1; }\r\n var sphericalPolynomialFaces = null;\r\n if (info.sphericalPolynomial) {\r\n sphericalPolynomialFaces = new Array();\r\n }\r\n var ext = engine.getCaps().s3tc;\r\n var header = new Int32Array(arrayBuffer, 0, headerLengthInt);\r\n var fourCC, width, height, dataLength = 0, dataOffset;\r\n var byteArray, mipmapCount, mip;\r\n var internalCompressedFormat = 0;\r\n var blockBytes = 1;\r\n if (header[off_magic] !== DDS_MAGIC) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Error(\"Invalid magic number in DDS header\");\r\n return;\r\n }\r\n if (!info.isFourCC && !info.isRGB && !info.isLuminance) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Error(\"Unsupported format, must contain a FourCC, RGB or LUMINANCE code\");\r\n return;\r\n }\r\n if (info.isCompressed && !ext) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Error(\"Compressed textures are not supported on this platform.\");\r\n return;\r\n }\r\n var bpp = header[off_RGBbpp];\r\n dataOffset = header[off_size] + 4;\r\n var computeFormats = false;\r\n if (info.isFourCC) {\r\n fourCC = header[off_pfFourCC];\r\n switch (fourCC) {\r\n case FOURCC_DXT1:\r\n blockBytes = 8;\r\n internalCompressedFormat = ext.COMPRESSED_RGBA_S3TC_DXT1_EXT;\r\n break;\r\n case FOURCC_DXT3:\r\n blockBytes = 16;\r\n internalCompressedFormat = ext.COMPRESSED_RGBA_S3TC_DXT3_EXT;\r\n break;\r\n case FOURCC_DXT5:\r\n blockBytes = 16;\r\n internalCompressedFormat = ext.COMPRESSED_RGBA_S3TC_DXT5_EXT;\r\n break;\r\n case FOURCC_D3DFMT_R16G16B16A16F:\r\n computeFormats = true;\r\n break;\r\n case FOURCC_D3DFMT_R32G32B32A32F:\r\n computeFormats = true;\r\n break;\r\n case FOURCC_DX10:\r\n // There is an additionnal header so dataOffset need to be changed\r\n dataOffset += 5 * 4; // 5 uints\r\n var supported = false;\r\n switch (info.dxgiFormat) {\r\n case DXGI_FORMAT_R16G16B16A16_FLOAT:\r\n case DXGI_FORMAT_R32G32B32A32_FLOAT:\r\n computeFormats = true;\r\n supported = true;\r\n break;\r\n case DXGI_FORMAT_B8G8R8X8_UNORM:\r\n info.isRGB = true;\r\n info.isFourCC = false;\r\n bpp = 32;\r\n supported = true;\r\n break;\r\n }\r\n if (supported) {\r\n break;\r\n }\r\n default:\r\n console.error(\"Unsupported FourCC code:\", Int32ToFourCC(fourCC));\r\n return;\r\n }\r\n }\r\n var rOffset = DDSTools._ExtractLongWordOrder(header[off_RMask]);\r\n var gOffset = DDSTools._ExtractLongWordOrder(header[off_GMask]);\r\n var bOffset = DDSTools._ExtractLongWordOrder(header[off_BMask]);\r\n var aOffset = DDSTools._ExtractLongWordOrder(header[off_AMask]);\r\n if (computeFormats) {\r\n internalCompressedFormat = engine._getRGBABufferInternalSizedFormat(info.textureType);\r\n }\r\n mipmapCount = 1;\r\n if (header[off_flags] & DDSD_MIPMAPCOUNT && loadMipmaps !== false) {\r\n mipmapCount = Math.max(1, header[off_mipmapCount]);\r\n }\r\n var startFace = currentFace || 0;\r\n for (var face = startFace; face < faces; face++) {\r\n width = header[off_width];\r\n height = header[off_height];\r\n for (mip = 0; mip < mipmapCount; ++mip) {\r\n if (lodIndex === -1 || lodIndex === mip) {\r\n // In case of fixed LOD, if the lod has just been uploaded, early exit.\r\n var i = (lodIndex === -1) ? mip : 0;\r\n if (!info.isCompressed && info.isFourCC) {\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n dataLength = width * height * 4;\r\n var floatArray = null;\r\n if (engine._badOS || engine._badDesktopOS || (!engine.getCaps().textureHalfFloat && !engine.getCaps().textureFloat)) { // Required because iOS has many issues with float and half float generation\r\n if (bpp === 128) {\r\n floatArray = DDSTools._GetFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));\r\n }\r\n }\r\n else if (bpp === 64) {\r\n floatArray = DDSTools._GetHalfFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));\r\n }\r\n }\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n else {\r\n if (bpp === 128) {\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n floatArray = DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(floatArray);\r\n }\r\n }\r\n else if (bpp === 64 && !engine.getCaps().textureHalfFloat) {\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n floatArray = DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(floatArray);\r\n }\r\n }\r\n else { // 64\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n floatArray = DDSTools._GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);\r\n if (sphericalPolynomialFaces && i == 0) {\r\n sphericalPolynomialFaces.push(DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));\r\n }\r\n }\r\n }\r\n if (floatArray) {\r\n engine._uploadDataToTextureDirectly(texture, floatArray, face, i);\r\n }\r\n }\r\n else if (info.isRGB) {\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n if (bpp === 24) {\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGB;\r\n dataLength = width * height * 3;\r\n byteArray = DDSTools._GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset);\r\n engine._uploadDataToTextureDirectly(texture, byteArray, face, i);\r\n }\r\n else { // 32\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n dataLength = width * height * 4;\r\n byteArray = DDSTools._GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset);\r\n engine._uploadDataToTextureDirectly(texture, byteArray, face, i);\r\n }\r\n }\r\n else if (info.isLuminance) {\r\n var unpackAlignment = engine._getUnpackAlignement();\r\n var unpaddedRowSize = width;\r\n var paddedRowSize = Math.floor((width + unpackAlignment - 1) / unpackAlignment) * unpackAlignment;\r\n dataLength = paddedRowSize * (height - 1) + unpaddedRowSize;\r\n byteArray = DDSTools._GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_LUMINANCE;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n engine._uploadDataToTextureDirectly(texture, byteArray, face, i);\r\n }\r\n else {\r\n dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;\r\n byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n engine._uploadCompressedDataToTextureDirectly(texture, internalCompressedFormat, width, height, byteArray, face, i);\r\n }\r\n }\r\n dataOffset += bpp ? (width * height * (bpp / 8)) : dataLength;\r\n width *= 0.5;\r\n height *= 0.5;\r\n width = Math.max(1.0, width);\r\n height = Math.max(1.0, height);\r\n }\r\n if (currentFace !== undefined) {\r\n // Loading a single face\r\n break;\r\n }\r\n }\r\n if (sphericalPolynomialFaces && sphericalPolynomialFaces.length > 0) {\r\n info.sphericalPolynomial = _Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_6__[\"CubeMapToSphericalPolynomialTools\"].ConvertCubeMapToSphericalPolynomial({\r\n size: header[off_width],\r\n right: sphericalPolynomialFaces[0],\r\n left: sphericalPolynomialFaces[1],\r\n up: sphericalPolynomialFaces[2],\r\n down: sphericalPolynomialFaces[3],\r\n front: sphericalPolynomialFaces[4],\r\n back: sphericalPolynomialFaces[5],\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTUREFORMAT_RGBA,\r\n type: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT,\r\n gammaSpace: false,\r\n });\r\n }\r\n else {\r\n info.sphericalPolynomial = undefined;\r\n }\r\n };\r\n /**\r\n * Gets or sets a boolean indicating that LOD info is stored in alpha channel (false by default)\r\n */\r\n DDSTools.StoreLODInAlphaChannel = false;\r\n return DDSTools;\r\n}());\r\n\r\n/**\r\n * Create a cube texture from prefiltered data (ie. the mipmaps contain ready to use data for PBR reflection)\r\n * @param rootUrl defines the url where the file to load is located\r\n * @param scene defines the current scene\r\n * @param lodScale defines scale to apply to the mip map selection\r\n * @param lodOffset defines offset to apply to the mip map selection\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].prototype.createPrefilteredCubeTexture = function (rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, createPolynomials) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = true; }\r\n var callback = function (loadData) {\r\n if (!loadData) {\r\n if (onLoad) {\r\n onLoad(null);\r\n }\r\n return;\r\n }\r\n var texture = loadData.texture;\r\n if (!createPolynomials) {\r\n texture._sphericalPolynomial = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_1__[\"SphericalPolynomial\"]();\r\n }\r\n else if (loadData.info.sphericalPolynomial) {\r\n texture._sphericalPolynomial = loadData.info.sphericalPolynomial;\r\n }\r\n texture._dataSource = _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_CUBEPREFILTERED;\r\n if (_this.getCaps().textureLOD) {\r\n // Do not add extra process if texture lod is supported.\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n return;\r\n }\r\n var mipSlices = 3;\r\n var gl = _this._gl;\r\n var width = loadData.width;\r\n if (!width) {\r\n return;\r\n }\r\n var textures = [];\r\n for (var i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n var smoothness = i / (mipSlices - 1);\r\n var roughness = 1 - smoothness;\r\n var minLODIndex = lodOffset; // roughness = 0\r\n var maxLODIndex = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Log2(width) * lodScale + lodOffset; // roughness = 1\r\n var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n var mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n var glTextureFromLod = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](_this, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n glTextureFromLod.type = texture.type;\r\n glTextureFromLod.format = texture.format;\r\n glTextureFromLod.width = Math.pow(2, Math.max(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_0__[\"Scalar\"].Log2(width) - mipmapIndex, 0));\r\n glTextureFromLod.height = glTextureFromLod.width;\r\n glTextureFromLod.isCube = true;\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, glTextureFromLod, true);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n if (loadData.isDDS) {\r\n var info = loadData.info;\r\n var data = loadData.data;\r\n _this._unpackFlipY(info.isCompressed);\r\n DDSTools.UploadDDSLevels(_this, glTextureFromLod, data, info, true, 6, mipmapIndex);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_5__[\"Logger\"].Warn(\"DDS is the only prefiltered cube map supported so far.\");\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n // Wrap in a base texture for easy binding.\r\n var lodTexture = new _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_7__[\"BaseTexture\"](scene);\r\n lodTexture.isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n glTextureFromLod.isReady = true;\r\n textures.push(lodTexture);\r\n }\r\n texture._lodTextureHigh = textures[2];\r\n texture._lodTextureMid = textures[1];\r\n texture._lodTextureLow = textures[0];\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n };\r\n return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Misc/decorators.ts\":\n/*!****************************!*\\\n !*** ./Misc/decorators.ts ***!\n \\****************************/\n/*! exports provided: expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return expandToProperty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return serialize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return serializeAsTexture; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return serializeAsColor3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return serializeAsFresnelParameters; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return serializeAsVector2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return serializeAsVector3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return serializeAsMeshReference; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return serializeAsColorCurves; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return serializeAsColor4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return serializeAsImageProcessingConfiguration; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return serializeAsQuaternion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return serializeAsMatrix; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return serializeAsCameraReference; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return SerializationHelper; });\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _devTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\nvar __decoratorInitialStore = {};\r\nvar __mergedStore = {};\r\nvar _copySource = function (creationFunction, source, instanciate) {\r\n var destination = creationFunction();\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"].AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 11: // Camera reference\r\n destination[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n destination[property] = (instanciate || sourceProperty.isRenderTarget) ? sourceProperty : sourceProperty.clone();\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n destination[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n};\r\nfunction getDirectStore(target) {\r\n var classKey = target.getClassName();\r\n if (!__decoratorInitialStore[classKey]) {\r\n __decoratorInitialStore[classKey] = {};\r\n }\r\n return __decoratorInitialStore[classKey];\r\n}\r\n/**\r\n * Return the list of properties flagged as serializable\r\n * @param target: host object\r\n */\r\nfunction getMergedStore(target) {\r\n var classKey = target.getClassName();\r\n if (__mergedStore[classKey]) {\r\n return __mergedStore[classKey];\r\n }\r\n __mergedStore[classKey] = {};\r\n var store = __mergedStore[classKey];\r\n var currentTarget = target;\r\n var currentKey = classKey;\r\n while (currentKey) {\r\n var initialStore = __decoratorInitialStore[currentKey];\r\n for (var property in initialStore) {\r\n store[property] = initialStore[property];\r\n }\r\n var parent_1 = void 0;\r\n var done = false;\r\n do {\r\n parent_1 = Object.getPrototypeOf(currentTarget);\r\n if (!parent_1.getClassName) {\r\n done = true;\r\n break;\r\n }\r\n if (parent_1.getClassName() !== currentKey) {\r\n break;\r\n }\r\n currentTarget = parent_1;\r\n } while (parent_1);\r\n if (done) {\r\n break;\r\n }\r\n currentKey = parent_1.getClassName();\r\n currentTarget = parent_1;\r\n }\r\n return store;\r\n}\r\nfunction generateSerializableMember(type, sourceName) {\r\n return function (target, propertyKey) {\r\n var classStore = getDirectStore(target);\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\nfunction generateExpandMember(setCallback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return function (target, propertyKey) {\r\n var key = targetKey || (\"_\" + propertyKey);\r\n Object.defineProperty(target, propertyKey, {\r\n get: function () {\r\n return this[key];\r\n },\r\n set: function (value) {\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n };\r\n}\r\nfunction expandToProperty(callback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return generateExpandMember(callback, targetKey);\r\n}\r\nfunction serialize(sourceName) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\nfunction serializeAsTexture(sourceName) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\nfunction serializeAsColor3(sourceName) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\nfunction serializeAsFresnelParameters(sourceName) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\nfunction serializeAsVector2(sourceName) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\nfunction serializeAsVector3(sourceName) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\nfunction serializeAsMeshReference(sourceName) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\nfunction serializeAsColorCurves(sourceName) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\nfunction serializeAsColor4(sourceName) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\nfunction serializeAsImageProcessingConfiguration(sourceName) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\nfunction serializeAsQuaternion(sourceName) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\nfunction serializeAsMatrix(sourceName) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n */\r\nfunction serializeAsCameraReference(sourceName) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\r\n}\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nvar SerializationHelper = /** @class */ (function () {\r\n function SerializationHelper() {\r\n }\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n SerializationHelper.AppendSerializedAnimations = function (source, destination) {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (var animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n var animation = source.animations[animationIndex];\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target obecjt where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n SerializationHelper.Serialize = function (entity, serializationObject) {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]) {\r\n serializationObject.tags = _Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"].GetTags(entity);\r\n }\r\n var serializedProperties = getMergedStore(entity);\r\n // Properties\r\n for (var property in serializedProperties) {\r\n var propertyDescriptor = serializedProperties[property];\r\n var targetPropertyName = propertyDescriptor.sourceName || property;\r\n var propertyType = propertyDescriptor.type;\r\n var sourceProperty = entity[property];\r\n if (sourceProperty !== undefined && sourceProperty !== null) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n SerializationHelper.Parse = function (creationFunction, source, scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = null; }\r\n var destination = creationFunction();\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n // Tags\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"]) {\r\n _Misc_tags__WEBPACK_IMPORTED_MODULE_0__[\"Tags\"].AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[propertyDescriptor.sourceName || property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null) {\r\n var dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color3\"].FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"].FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshByID(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = _Maths_math_color__WEBPACK_IMPORTED_MODULE_3__[\"Color4\"].FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraByID(sourceProperty);\r\n }\r\n case 12: // Matrix\r\n dest[property] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n };\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the cloned object\r\n */\r\n SerializationHelper.Clone = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, false);\r\n };\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n SerializationHelper.Instanciate = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, true);\r\n };\r\n /** @hidden */\r\n SerializationHelper._ImageProcessingConfigurationParser = function (sourceProperty) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._FresnelParametersParser = function (sourceProperty) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"FresnelParameters\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._ColorCurvesParser = function (sourceProperty) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"ColorCurves\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._TextureParser = function (sourceProperty, scene, rootUrl) {\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_2__[\"_DevTools\"].WarnImport(\"Texture\");\r\n };\r\n return SerializationHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/deepCopier.ts\":\n/*!****************************!*\\\n !*** ./Misc/deepCopier.ts ***!\n \\****************************/\n/*! exports provided: DeepCopier */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return DeepCopier; });\nvar cloneValue = function (source, destinationObject) {\r\n if (!source) {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"Mesh\") {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"SubMesh\") {\r\n return source.clone(destinationObject);\r\n }\r\n else if (source.clone) {\r\n return source.clone();\r\n }\r\n return null;\r\n};\r\n/**\r\n * Class containing a set of static utilities functions for deep copy.\r\n */\r\nvar DeepCopier = /** @class */ (function () {\r\n function DeepCopier() {\r\n }\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n DeepCopier.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n for (var prop in source) {\r\n if (prop[0] === \"_\" && (!mustCopyList || mustCopyList.indexOf(prop) === -1)) {\r\n continue;\r\n }\r\n if (doNotCopyList && doNotCopyList.indexOf(prop) !== -1) {\r\n continue;\r\n }\r\n var sourceValue = source[prop];\r\n var typeOfSourceValue = typeof sourceValue;\r\n if (typeOfSourceValue === \"function\") {\r\n continue;\r\n }\r\n try {\r\n if (typeOfSourceValue === \"object\") {\r\n if (sourceValue instanceof Array) {\r\n destination[prop] = [];\r\n if (sourceValue.length > 0) {\r\n if (typeof sourceValue[0] == \"object\") {\r\n for (var index = 0; index < sourceValue.length; index++) {\r\n var clonedValue = cloneValue(sourceValue[index], destination);\r\n if (destination[prop].indexOf(clonedValue) === -1) { // Test if auto inject was not done\r\n destination[prop].push(clonedValue);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue.slice(0);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = cloneValue(sourceValue, destination);\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue;\r\n }\r\n }\r\n catch (e) {\r\n // Just ignore error (it could be because of a read-only property)\r\n }\r\n }\r\n };\r\n return DeepCopier;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/deferred.ts\":\n/*!**************************!*\\\n !*** ./Misc/deferred.ts ***!\n \\**************************/\n/*! exports provided: Deferred */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return Deferred; });\n/**\r\n * Wrapper class for promise with external resolve and reject.\r\n */\r\nvar Deferred = /** @class */ (function () {\r\n /**\r\n * Constructor for this deferred object.\r\n */\r\n function Deferred() {\r\n var _this = this;\r\n this.promise = new Promise(function (resolve, reject) {\r\n _this._resolve = resolve;\r\n _this._reject = reject;\r\n });\r\n }\r\n Object.defineProperty(Deferred.prototype, \"resolve\", {\r\n /**\r\n * The resolve method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._resolve;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Deferred.prototype, \"reject\", {\r\n /**\r\n * The reject method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._reject;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return Deferred;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/devTools.ts\":\n/*!**************************!*\\\n !*** ./Misc/devTools.ts ***!\n \\**************************/\n/*! exports provided: _DevTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_DevTools\", function() { return _DevTools; });\n/** @hidden */\r\nvar _DevTools = /** @class */ (function () {\r\n function _DevTools() {\r\n }\r\n _DevTools.WarnImport = function (name) {\r\n return name + \" needs to be imported before as it contains a side-effect required by your code.\";\r\n };\r\n return _DevTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/domManagement.ts\":\n/*!*******************************!*\\\n !*** ./Misc/domManagement.ts ***!\n \\*******************************/\n/*! exports provided: DomManagement */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DomManagement\", function() { return DomManagement; });\n/**\r\n * Sets of helpers dealing with the DOM and some of the recurrent functions needed in\r\n * Babylon.js\r\n */\r\nvar DomManagement = /** @class */ (function () {\r\n function DomManagement() {\r\n }\r\n /**\r\n * Checks if the window object exists\r\n * @returns true if the window object exists\r\n */\r\n DomManagement.IsWindowObjectExist = function () {\r\n return (typeof window) !== \"undefined\";\r\n };\r\n /**\r\n * Checks if the navigator object exists\r\n * @returns true if the navigator object exists\r\n */\r\n DomManagement.IsNavigatorAvailable = function () {\r\n return (typeof navigator) !== \"undefined\";\r\n };\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * @param element defines the root element\r\n * @returns a string\r\n */\r\n DomManagement.GetDOMTextContent = function (element) {\r\n var result = \"\";\r\n var child = element.firstChild;\r\n while (child) {\r\n if (child.nodeType === 3) {\r\n result += child.textContent;\r\n }\r\n child = (child.nextSibling);\r\n }\r\n return result;\r\n };\r\n return DomManagement;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/environmentTextureTools.ts\":\n/*!*****************************************!*\\\n !*** ./Misc/environmentTextureTools.ts ***!\n \\*****************************************/\n/*! exports provided: EnvironmentTextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return EnvironmentTextureTools; });\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/sphericalPolynomial */ \"./Maths/sphericalPolynomial.ts\");\n/* harmony import */ var _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/internalTexture */ \"./Materials/Textures/internalTexture.ts\");\n/* harmony import */ var _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/baseTexture */ \"./Materials/Textures/baseTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_Extensions_engine_renderTarget__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/Extensions/engine.renderTarget */ \"./Engines/Extensions/engine.renderTarget.ts\");\n/* harmony import */ var _Shaders_rgbdEncode_fragment__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/rgbdEncode.fragment */ \"./Shaders/rgbdEncode.fragment.ts\");\n/* harmony import */ var _Shaders_rgbdDecode_fragment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Shaders/rgbdDecode.fragment */ \"./Shaders/rgbdDecode.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Sets of helpers addressing the serialization and deserialization of environment texture\r\n * stored in a BabylonJS env file.\r\n * Those files are usually stored as .env files.\r\n */\r\nvar EnvironmentTextureTools = /** @class */ (function () {\r\n function EnvironmentTextureTools() {\r\n }\r\n /**\r\n * Gets the environment info from an env file.\r\n * @param data The array buffer containing the .env bytes.\r\n * @returns the environment file info (the json header) if successfully parsed.\r\n */\r\n EnvironmentTextureTools.GetEnvInfo = function (data) {\r\n var dataView = new DataView(data);\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n if (dataView.getUint8(pos++) !== EnvironmentTextureTools._MagicBytes[i]) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Error('Not a babylon environment map');\r\n return null;\r\n }\r\n }\r\n // Read json manifest - collect characters up to null terminator\r\n var manifestString = '';\r\n var charCode = 0x00;\r\n while ((charCode = dataView.getUint8(pos++))) {\r\n manifestString += String.fromCharCode(charCode);\r\n }\r\n var manifest = JSON.parse(manifestString);\r\n if (manifest.specular) {\r\n // Extend the header with the position of the payload.\r\n manifest.specular.specularDataPosition = pos;\r\n // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.\r\n manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;\r\n }\r\n return manifest;\r\n };\r\n /**\r\n * Creates an environment texture from a loaded cube texture.\r\n * @param texture defines the cube texture to convert in env file\r\n * @return a promise containing the environment data if succesfull.\r\n */\r\n EnvironmentTextureTools.CreateEnvTextureAsync = function (texture) {\r\n var _this = this;\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return Promise.reject(\"The cube texture is invalid.\");\r\n }\r\n if (!texture._prefiltered) {\r\n return Promise.reject(\"The cube texture is invalid (not prefiltered).\");\r\n }\r\n var engine = internalTexture.getEngine();\r\n if (engine && engine.premultipliedAlpha) {\r\n return Promise.reject(\"Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.\");\r\n }\r\n if (texture.textureType === _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT) {\r\n return Promise.reject(\"The cube texture should allow HDR (Full Float or Half Float).\");\r\n }\r\n var canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n return Promise.reject(\"Env texture can only be created when the engine is associated to a canvas.\");\r\n }\r\n var textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n if (!engine.getCaps().textureFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n if (!engine.getCaps().textureHalfFloatRender) {\r\n return Promise.reject(\"Env texture can only be created when the browser supports half float or full float rendering.\");\r\n }\r\n }\r\n var cubeWidth = internalTexture.width;\r\n var hostingScene = new _scene__WEBPACK_IMPORTED_MODULE_7__[\"Scene\"](engine);\r\n var specularTextures = {};\r\n var promises = [];\r\n // Read and collect all mipmaps data from the cube.\r\n var mipmapsCount = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Log2(internalTexture.width);\r\n mipmapsCount = Math.round(mipmapsCount);\r\n var _loop_1 = function (i) {\r\n var faceWidth = Math.pow(2, mipmapsCount - i);\r\n var _loop_2 = function (face) {\r\n var data = texture.readPixels(face, i);\r\n // Creates a temp texture with the face data.\r\n var tempTexture = engine.createRawTexture(data, faceWidth, faceWidth, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, null, textureType);\r\n // And rgbdEncode them.\r\n var promise = new Promise(function (resolve, reject) {\r\n var rgbdPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_8__[\"PostProcess\"](\"rgbdEncode\", \"rgbdEncode\", null, null, 1, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, engine, false, undefined, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, undefined, null, false);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture);\r\n };\r\n // As the process needs to happen on the main canvas, keep track of the current size\r\n var currentW = engine.getRenderWidth();\r\n var currentH = engine.getRenderHeight();\r\n // Set the desired size for the texture\r\n engine.setSize(faceWidth, faceWidth);\r\n hostingScene.postProcessManager.directRender([rgbdPostProcess], null);\r\n // Reading datas from WebGL\r\n _tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].ToBlob(canvas, function (blob) {\r\n var fileReader = new FileReader();\r\n fileReader.onload = function (event) {\r\n var arrayBuffer = event.target.result;\r\n specularTextures[i * 6 + face] = arrayBuffer;\r\n resolve();\r\n };\r\n fileReader.readAsArrayBuffer(blob);\r\n });\r\n // Reapply the previous canvas size\r\n engine.setSize(currentW, currentH);\r\n });\r\n });\r\n promises.push(promise);\r\n };\r\n // All faces of the cube.\r\n for (var face = 0; face < 6; face++) {\r\n _loop_2(face);\r\n }\r\n };\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n _loop_1(i);\r\n }\r\n // Once all the textures haves been collected as RGBD stored in PNGs\r\n return Promise.all(promises).then(function () {\r\n // We can delete the hosting scene keeping track of all the creation objects\r\n hostingScene.dispose();\r\n // Creates the json header for the env texture\r\n var info = {\r\n version: 1,\r\n width: cubeWidth,\r\n irradiance: _this._CreateEnvTextureIrradiance(texture),\r\n specular: {\r\n mipmaps: [],\r\n lodGenerationScale: texture.lodGenerationScale\r\n }\r\n };\r\n // Sets the specular image data information\r\n var position = 0;\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var byteLength = specularTextures[i * 6 + face].byteLength;\r\n info.specular.mipmaps.push({\r\n length: byteLength,\r\n position: position\r\n });\r\n position += byteLength;\r\n }\r\n }\r\n // Encode the JSON as an array buffer\r\n var infoString = JSON.stringify(info);\r\n var infoBuffer = new ArrayBuffer(infoString.length + 1);\r\n var infoView = new Uint8Array(infoBuffer); // Limited to ascii subset matching unicode.\r\n for (var i = 0, strLen = infoString.length; i < strLen; i++) {\r\n infoView[i] = infoString.charCodeAt(i);\r\n }\r\n // Ends up with a null terminator for easier parsing\r\n infoView[infoString.length] = 0x00;\r\n // Computes the final required size and creates the storage\r\n var totalSize = EnvironmentTextureTools._MagicBytes.length + position + infoBuffer.byteLength;\r\n var finalBuffer = new ArrayBuffer(totalSize);\r\n var finalBufferView = new Uint8Array(finalBuffer);\r\n var dataView = new DataView(finalBuffer);\r\n // Copy the magic bytes identifying the file in\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n dataView.setUint8(pos++, EnvironmentTextureTools._MagicBytes[i]);\r\n }\r\n // Add the json info\r\n finalBufferView.set(new Uint8Array(infoBuffer), pos);\r\n pos += infoBuffer.byteLength;\r\n // Finally inserts the texture data\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var dataBuffer = specularTextures[i * 6 + face];\r\n finalBufferView.set(new Uint8Array(dataBuffer), pos);\r\n pos += dataBuffer.byteLength;\r\n }\r\n }\r\n // Voila\r\n return finalBuffer;\r\n });\r\n };\r\n /**\r\n * Creates a JSON representation of the spherical data.\r\n * @param texture defines the texture containing the polynomials\r\n * @return the JSON representation of the spherical info\r\n */\r\n EnvironmentTextureTools._CreateEnvTextureIrradiance = function (texture) {\r\n var polynmials = texture.sphericalPolynomial;\r\n if (polynmials == null) {\r\n return null;\r\n }\r\n return {\r\n x: [polynmials.x.x, polynmials.x.y, polynmials.x.z],\r\n y: [polynmials.y.x, polynmials.y.y, polynmials.y.z],\r\n z: [polynmials.z.x, polynmials.z.y, polynmials.z.z],\r\n xx: [polynmials.xx.x, polynmials.xx.y, polynmials.xx.z],\r\n yy: [polynmials.yy.x, polynmials.yy.y, polynmials.yy.z],\r\n zz: [polynmials.zz.x, polynmials.zz.y, polynmials.zz.z],\r\n yz: [polynmials.yz.x, polynmials.yz.y, polynmials.yz.z],\r\n zx: [polynmials.zx.x, polynmials.zx.y, polynmials.zx.z],\r\n xy: [polynmials.xy.x, polynmials.xy.y, polynmials.xy.z]\r\n };\r\n };\r\n /**\r\n * Creates the ArrayBufferViews used for initializing environment texture image data.\r\n * @param arrayBuffer the underlying ArrayBuffer to which the views refer\r\n * @param info parameters that determine what views will be created for accessing the underlying buffer\r\n * @return the views described by info providing access to the underlying buffer\r\n */\r\n EnvironmentTextureTools.CreateImageDataArrayBufferViews = function (arrayBuffer, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n // Double checks the enclosed info\r\n var mipmapsCount = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Log2(info.width);\r\n mipmapsCount = Math.round(mipmapsCount) + 1;\r\n if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {\r\n throw new Error(\"Unsupported specular mipmaps number \\\"\" + specularInfo.mipmaps.length + \"\\\"\");\r\n }\r\n var imageData = new Array(mipmapsCount);\r\n for (var i = 0; i < mipmapsCount; i++) {\r\n imageData[i] = new Array(6);\r\n for (var face = 0; face < 6; face++) {\r\n var imageInfo = specularInfo.mipmaps[i * 6 + face];\r\n imageData[i][face] = new Uint8Array(arrayBuffer, specularInfo.specularDataPosition + imageInfo.position, imageInfo.length);\r\n }\r\n }\r\n return imageData;\r\n };\r\n /**\r\n * Uploads the texture info contained in the env file to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param arrayBuffer defines the buffer cotaining the data to load\r\n * @param info defines the texture info retrieved through the GetEnvInfo method\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, arrayBuffer, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n if (!specularInfo) {\r\n // Nothing else parsed so far\r\n return Promise.resolve();\r\n }\r\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\r\n var imageData = EnvironmentTextureTools.CreateImageDataArrayBufferViews(arrayBuffer, info);\r\n return EnvironmentTextureTools.UploadLevelsAsync(texture, imageData);\r\n };\r\n /**\r\n * Uploads the levels of image data to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param imageData defines the array buffer views of image data [mipmap][face]\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {\r\n if (!_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].IsExponentOfTwo(texture.width)) {\r\n throw new Error(\"Texture size must be a power of two\");\r\n }\r\n var mipmapsCount = Math.round(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Log2(texture.width)) + 1;\r\n // Gets everything ready.\r\n var engine = texture.getEngine();\r\n var expandTexture = false;\r\n var generateNonLODTextures = false;\r\n var rgbdPostProcess = null;\r\n var cubeRtt = null;\r\n var lodTextures = null;\r\n var caps = engine.getCaps();\r\n texture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n texture.generateMipMaps = true;\r\n engine.updateTextureSamplingMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE, texture);\r\n // Add extra process if texture lod is not supported\r\n if (!caps.textureLOD) {\r\n expandTexture = false;\r\n generateNonLODTextures = true;\r\n lodTextures = {};\r\n }\r\n // in webgl 1 there are no ways to either render or copy lod level information for float textures.\r\n else if (engine.webGLVersion < 2) {\r\n expandTexture = false;\r\n }\r\n // If half float available we can uncompress the texture\r\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Simply run through the decode PP\r\n rgbdPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_8__[\"PostProcess\"](\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE, engine, false, undefined, texture.type, undefined, null, false);\r\n texture._isRGBD = false;\r\n texture.invertY = false;\r\n cubeRtt = engine.createRenderTargetCubeTexture(texture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: true,\r\n generateStencilBuffer: false,\r\n samplingMode: _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: texture.type,\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA\r\n });\r\n }\r\n else {\r\n texture._isRGBD = true;\r\n texture.invertY = true;\r\n // In case of missing support, applies the same patch than DDS files.\r\n if (generateNonLODTextures) {\r\n var mipSlices = 3;\r\n var scale = texture._lodGenerationScale;\r\n var offset = texture._lodGenerationOffset;\r\n for (var i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n var smoothness = i / (mipSlices - 1);\r\n var roughness = 1 - smoothness;\r\n var minLODIndex = offset; // roughness = 0\r\n var maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1 (mipmaps start from 0)\r\n var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n var mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n var glTextureFromLod = new _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"](engine, _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_TEMP);\r\n glTextureFromLod.isCube = true;\r\n glTextureFromLod.invertY = true;\r\n glTextureFromLod.generateMipMaps = false;\r\n engine.updateTextureSamplingMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_LINEAR_LINEAR, glTextureFromLod);\r\n // Wrap in a base texture for easy binding.\r\n var lodTexture = new _Materials_Textures_baseTexture__WEBPACK_IMPORTED_MODULE_5__[\"BaseTexture\"](null);\r\n lodTexture.isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n lodTextures[mipmapIndex] = lodTexture;\r\n switch (i) {\r\n case 0:\r\n texture._lodTextureLow = lodTexture;\r\n break;\r\n case 1:\r\n texture._lodTextureMid = lodTexture;\r\n break;\r\n case 2:\r\n texture._lodTextureHigh = lodTexture;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n var promises = [];\r\n var _loop_3 = function (i) {\r\n var _loop_4 = function (face) {\r\n // Constructs an image element from image data\r\n var bytes = imageData[i][face];\r\n var blob = new Blob([bytes], { type: 'image/png' });\r\n var url = URL.createObjectURL(blob);\r\n var image = new Image();\r\n image.src = url;\r\n // Enqueue promise to upload to the texture.\r\n var promise = new Promise(function (resolve, reject) {\r\n image.onload = function () {\r\n if (expandTexture) {\r\n var tempTexture_1 = engine.createTexture(null, true, true, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, null, function (message) {\r\n reject(message);\r\n }, image);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n // Uncompress the data to a RTT\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture_1);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess], cubeRtt, true, face, i);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n tempTexture_1.dispose();\r\n window.URL.revokeObjectURL(url);\r\n resolve();\r\n });\r\n }\r\n else {\r\n engine._uploadImageToTexture(texture, image, face, i);\r\n // Upload the face to the non lod texture support\r\n if (generateNonLODTextures) {\r\n var lodTexture = lodTextures[i];\r\n if (lodTexture) {\r\n engine._uploadImageToTexture(lodTexture._texture, image, face, 0);\r\n }\r\n }\r\n resolve();\r\n }\r\n };\r\n image.onerror = function (error) {\r\n reject(error);\r\n };\r\n });\r\n promises.push(promise);\r\n };\r\n // All faces\r\n for (var face = 0; face < 6; face++) {\r\n _loop_4(face);\r\n }\r\n };\r\n // All mipmaps up to provided number of images\r\n for (var i = 0; i < imageData.length; i++) {\r\n _loop_3(i);\r\n }\r\n // Fill remaining mipmaps with black textures.\r\n if (imageData.length < mipmapsCount) {\r\n var data = void 0;\r\n var size = Math.pow(2, mipmapsCount - 1 - imageData.length);\r\n var dataLength = size * size * 4;\r\n switch (texture.type) {\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT: {\r\n data = new Uint8Array(dataLength);\r\n break;\r\n }\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_HALF_FLOAT: {\r\n data = new Uint16Array(dataLength);\r\n break;\r\n }\r\n case _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT: {\r\n data = new Float32Array(dataLength);\r\n break;\r\n }\r\n }\r\n for (var i = imageData.length; i < mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n engine._uploadArrayBufferViewToTexture(texture, data, face, i);\r\n }\r\n }\r\n }\r\n // Once all done, finishes the cleanup and return\r\n return Promise.all(promises).then(function () {\r\n // Release temp RTT.\r\n if (cubeRtt) {\r\n engine._releaseFramebufferObjects(cubeRtt);\r\n engine._releaseTexture(texture);\r\n cubeRtt._swapAndDie(texture);\r\n }\r\n // Release temp Post Process.\r\n if (rgbdPostProcess) {\r\n rgbdPostProcess.dispose();\r\n }\r\n // Flag internal texture as ready in case they are in use.\r\n if (generateNonLODTextures) {\r\n if (texture._lodTextureHigh && texture._lodTextureHigh._texture) {\r\n texture._lodTextureHigh._texture.isReady = true;\r\n }\r\n if (texture._lodTextureMid && texture._lodTextureMid._texture) {\r\n texture._lodTextureMid._texture.isReady = true;\r\n }\r\n if (texture._lodTextureLow && texture._lodTextureLow._texture) {\r\n texture._lodTextureLow._texture.isReady = true;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Uploads spherical polynomials information to the texture.\r\n * @param texture defines the texture we are trying to upload the information to\r\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\r\n */\r\n EnvironmentTextureTools.UploadEnvSpherical = function (texture, info) {\r\n if (info.version !== 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_9__[\"Logger\"].Warn('Unsupported babylon environment map version \"' + info.version + '\"');\r\n }\r\n var irradianceInfo = info.irradiance;\r\n if (!irradianceInfo) {\r\n return;\r\n }\r\n var sp = new _Maths_sphericalPolynomial__WEBPACK_IMPORTED_MODULE_3__[\"SphericalPolynomial\"]();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.x, 0, sp.x);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.y, 0, sp.y);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.z, 0, sp.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.xx, 0, sp.xx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.yy, 0, sp.yy);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.zz, 0, sp.zz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.yz, 0, sp.yz);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.zx, 0, sp.zx);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(irradianceInfo.xy, 0, sp.xy);\r\n texture._sphericalPolynomial = sp;\r\n };\r\n /** @hidden */\r\n EnvironmentTextureTools._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._dataSource = _Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"].DATASOURCE_CUBERAW_RGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return EnvironmentTextureTools.UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n /**\r\n * Magic number identifying the env file.\r\n */\r\n EnvironmentTextureTools._MagicBytes = [0x86, 0x16, 0x87, 0x96, 0xf6, 0xd6, 0x96, 0x36];\r\n return EnvironmentTextureTools;\r\n}());\r\n\r\n// References the dependencies.\r\n_Materials_Textures_internalTexture__WEBPACK_IMPORTED_MODULE_4__[\"InternalTexture\"]._UpdateRGBDAsync = EnvironmentTextureTools._UpdateRGBDAsync;\r\n\n\n/***/ }),\n\n/***/ \"./Misc/fileTools.ts\":\n/*!***************************!*\\\n !*** ./Misc/fileTools.ts ***!\n \\***************************/\n/*! exports provided: FileTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FileTools\", function() { return FileTools; });\n/* harmony import */ var _webRequest__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webRequest */ \"./Misc/webRequest.ts\");\n/* harmony import */ var _loadFileError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./loadFileError */ \"./Misc/loadFileError.ts\");\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _filesInputStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./filesInputStore */ \"./Misc/filesInputStore.ts\");\n/* harmony import */ var _retryStrategy__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./retryStrategy */ \"./Misc/retryStrategy.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * @hidden\r\n */\r\nvar FileTools = /** @class */ (function () {\r\n function FileTools() {\r\n }\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n FileTools._CleanUrl = function (url) {\r\n url = url.replace(/#/mg, \"%23\");\r\n return url;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n FileTools.SetCorsBehavior = function (url, element) {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n if (this.CorsBehavior) {\r\n if (typeof (this.CorsBehavior) === 'string' || this.CorsBehavior instanceof String) {\r\n element.crossOrigin = this.CorsBehavior;\r\n }\r\n else {\r\n var result = this.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n FileTools.LoadImage = function (input, onLoad, onError, offlineProvider) {\r\n var url;\r\n var usingObjectURL = false;\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n url = URL.createObjectURL(new Blob([input]));\r\n usingObjectURL = true;\r\n }\r\n else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = this._CleanUrl(input);\r\n url = this.PreprocessUrl(input);\r\n }\r\n var img = new Image();\r\n this.SetCorsBehavior(url, img);\r\n var loadHandler = function () {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n onLoad(img);\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n var errorHandler = function (err) {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, err);\r\n }\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n img.addEventListener(\"load\", loadHandler);\r\n img.addEventListener(\"error\", errorHandler);\r\n var noOfflineSupport = function () {\r\n img.src = url;\r\n };\r\n var loadFromOfflineSupport = function () {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n if (url.substr(0, 5) !== \"data:\" && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n }\r\n else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[textureName]) {\r\n try {\r\n var blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[textureName]);\r\n }\r\n catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n }\r\n catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n noOfflineSupport();\r\n }\r\n return img;\r\n };\r\n /**\r\n * Loads a file\r\n * @param fileToLoad defines the file to load\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallBack defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @returns a file request object\r\n */\r\n FileTools.ReadFile = function (fileToLoad, callback, progressCallBack, useArrayBuffer) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"](),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) { return request.onCompleteObservable.notifyObservers(request); };\r\n reader.onerror = function (e) {\r\n callback(JSON.stringify({ autoClear: true, clearColor: [1, 0, 0], ambientColor: [0, 0, 0], gravity: [0, -9.807, 0], meshes: [], cameras: [], lights: [] }));\r\n };\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n callback(e.target['result']);\r\n };\r\n if (progressCallBack) {\r\n reader.onprogress = progressCallBack;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(fileToLoad);\r\n }\r\n else {\r\n reader.readAsArrayBuffer(fileToLoad);\r\n }\r\n return request;\r\n };\r\n /**\r\n * Loads a file\r\n * @param url url string, ArrayBuffer, or Blob to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n FileTools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n var _this = this;\r\n url = this._CleanUrl(url);\r\n url = this.PreprocessUrl(url);\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[fileName]) {\r\n return this.ReadFile(_filesInputStore__WEBPACK_IMPORTED_MODULE_4__[\"FilesInputStore\"].FilesToLoad[fileName], onSuccess, onProgress, useArrayBuffer);\r\n }\r\n }\r\n var loadUrl = this.BaseUrl + url;\r\n var aborted = false;\r\n var fileRequest = {\r\n onCompleteObservable: new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"](),\r\n abort: function () { return aborted = true; },\r\n };\r\n var requestFile = function () {\r\n var request = new _webRequest__WEBPACK_IMPORTED_MODULE_0__[\"WebRequest\"]();\r\n var retryHandle = null;\r\n fileRequest.abort = function () {\r\n aborted = true;\r\n if (request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n };\r\n var retryLoop = function (retryIndex) {\r\n request.open('GET', loadUrl);\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n var onLoadEnd = function () {\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n };\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n var onReadyStateChange = function () {\r\n if (aborted) {\r\n return;\r\n }\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!_domManagement__WEBPACK_IMPORTED_MODULE_2__[\"DomManagement\"].IsWindowObjectExist() || _this.IsFileURL()))) {\r\n onSuccess(!useArrayBuffer ? request.responseText : request.response, request.responseURL);\r\n return;\r\n }\r\n var retryStrategy = _this.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n var waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n request = new _webRequest__WEBPACK_IMPORTED_MODULE_0__[\"WebRequest\"]();\r\n retryHandle = setTimeout(function () { return retryLoop(retryIndex + 1); }, waitTime);\r\n return;\r\n }\r\n }\r\n var e = new _loadFileError__WEBPACK_IMPORTED_MODULE_1__[\"LoadFileError\"](\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(request, e);\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n };\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n request.send();\r\n };\r\n retryLoop(0);\r\n };\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline) {\r\n var noOfflineSupport_1 = function (request) {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n }\r\n else {\r\n if (!aborted) {\r\n requestFile();\r\n }\r\n }\r\n };\r\n var loadFromOfflineSupport = function () {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n if (aborted) {\r\n return;\r\n }\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(url, function (data) {\r\n if (!aborted) {\r\n onSuccess(data);\r\n }\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n }, onProgress ? function (event) {\r\n if (!aborted) {\r\n onProgress(event);\r\n }\r\n } : undefined, noOfflineSupport_1, useArrayBuffer);\r\n }\r\n };\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport_1);\r\n }\r\n else {\r\n requestFile();\r\n }\r\n return fileRequest;\r\n };\r\n /**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n */\r\n FileTools.IsFileURL = function () {\r\n return location.protocol === \"file:\";\r\n };\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n FileTools.DefaultRetryStrategy = _retryStrategy__WEBPACK_IMPORTED_MODULE_5__[\"RetryStrategy\"].ExponentialBackoff();\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n FileTools.BaseUrl = \"\";\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n FileTools.CorsBehavior = \"anonymous\";\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n FileTools.PreprocessUrl = function (url) {\r\n return url;\r\n };\r\n return FileTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/filesInput.ts\":\n/*!****************************!*\\\n !*** ./Misc/filesInput.ts ***!\n \\****************************/\n/*! exports provided: FilesInput */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return FilesInput; });\n/* harmony import */ var _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Loading/sceneLoader */ \"./Loading/sceneLoader.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _filesInputStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filesInputStore */ \"./Misc/filesInputStore.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to help managing file picking and drag'n'drop\r\n */\r\nvar FilesInput = /** @class */ (function () {\r\n /**\r\n * Creates a new FilesInput\r\n * @param engine defines the rendering engine\r\n * @param scene defines the hosting scene\r\n * @param sceneLoadedCallback callback called when scene is loaded\r\n * @param progressCallback callback called to track progress\r\n * @param additionalRenderLoopLogicCallback callback called to add user logic to the rendering loop\r\n * @param textureLoadingCallback callback called when a texture is loading\r\n * @param startingProcessingFilesCallback callback called when the system is about to process all files\r\n * @param onReloadCallback callback called when a reload is requested\r\n * @param errorCallback callback call if an error occurs\r\n */\r\n function FilesInput(engine, scene, sceneLoadedCallback, progressCallback, additionalRenderLoopLogicCallback, textureLoadingCallback, startingProcessingFilesCallback, onReloadCallback, errorCallback) {\r\n /**\r\n * Callback called when a file is processed\r\n */\r\n this.onProcessFileCallback = function () { return true; };\r\n this._engine = engine;\r\n this._currentScene = scene;\r\n this._sceneLoadedCallback = sceneLoadedCallback;\r\n this._progressCallback = progressCallback;\r\n this._additionalRenderLoopLogicCallback = additionalRenderLoopLogicCallback;\r\n this._textureLoadingCallback = textureLoadingCallback;\r\n this._startingProcessingFilesCallback = startingProcessingFilesCallback;\r\n this._onReloadCallback = onReloadCallback;\r\n this._errorCallback = errorCallback;\r\n }\r\n Object.defineProperty(FilesInput, \"FilesToLoad\", {\r\n /**\r\n * List of files ready to be loaded\r\n */\r\n get: function () {\r\n return _filesInputStore__WEBPACK_IMPORTED_MODULE_2__[\"FilesInputStore\"].FilesToLoad;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Calls this function to listen to drag'n'drop events on a specific DOM element\r\n * @param elementToMonitor defines the DOM element to track\r\n */\r\n FilesInput.prototype.monitorElementForDragNDrop = function (elementToMonitor) {\r\n var _this = this;\r\n if (elementToMonitor) {\r\n this._elementToMonitor = elementToMonitor;\r\n this._dragEnterHandler = function (e) { _this.drag(e); };\r\n this._dragOverHandler = function (e) { _this.drag(e); };\r\n this._dropHandler = function (e) { _this.drop(e); };\r\n this._elementToMonitor.addEventListener(\"dragenter\", this._dragEnterHandler, false);\r\n this._elementToMonitor.addEventListener(\"dragover\", this._dragOverHandler, false);\r\n this._elementToMonitor.addEventListener(\"drop\", this._dropHandler, false);\r\n }\r\n };\r\n /**\r\n * Release all associated resources\r\n */\r\n FilesInput.prototype.dispose = function () {\r\n if (!this._elementToMonitor) {\r\n return;\r\n }\r\n this._elementToMonitor.removeEventListener(\"dragenter\", this._dragEnterHandler);\r\n this._elementToMonitor.removeEventListener(\"dragover\", this._dragOverHandler);\r\n this._elementToMonitor.removeEventListener(\"drop\", this._dropHandler);\r\n };\r\n FilesInput.prototype.renderFunction = function () {\r\n if (this._additionalRenderLoopLogicCallback) {\r\n this._additionalRenderLoopLogicCallback();\r\n }\r\n if (this._currentScene) {\r\n if (this._textureLoadingCallback) {\r\n var remaining = this._currentScene.getWaitingItemsCount();\r\n if (remaining > 0) {\r\n this._textureLoadingCallback(remaining);\r\n }\r\n }\r\n this._currentScene.render();\r\n }\r\n };\r\n FilesInput.prototype.drag = function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n };\r\n FilesInput.prototype.drop = function (eventDrop) {\r\n eventDrop.stopPropagation();\r\n eventDrop.preventDefault();\r\n this.loadFiles(eventDrop);\r\n };\r\n FilesInput.prototype._traverseFolder = function (folder, files, remaining, callback) {\r\n var _this = this;\r\n var reader = folder.createReader();\r\n var relativePath = folder.fullPath.replace(/^\\//, \"\").replace(/(.+?)\\/?$/, \"$1/\");\r\n reader.readEntries(function (entries) {\r\n remaining.count += entries.length;\r\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\r\n var entry = entries_1[_i];\r\n if (entry.isFile) {\r\n entry.file(function (file) {\r\n file.correctName = relativePath + file.name;\r\n files.push(file);\r\n if (--remaining.count === 0) {\r\n callback();\r\n }\r\n });\r\n }\r\n else if (entry.isDirectory) {\r\n _this._traverseFolder(entry, files, remaining, callback);\r\n }\r\n }\r\n if (--remaining.count) {\r\n callback();\r\n }\r\n });\r\n };\r\n FilesInput.prototype._processFiles = function (files) {\r\n for (var i = 0; i < files.length; i++) {\r\n var name = files[i].correctName.toLowerCase();\r\n var extension = name.split('.').pop();\r\n if (!this.onProcessFileCallback(files[i], name, extension)) {\r\n continue;\r\n }\r\n if ((extension === \"babylon\" || extension === \"stl\" || extension === \"obj\" || extension === \"gltf\" || extension === \"glb\")\r\n && name.indexOf(\".binary.babylon\") === -1 && name.indexOf(\".incremental.babylon\") === -1) {\r\n this._sceneFileToLoad = files[i];\r\n }\r\n FilesInput.FilesToLoad[name] = files[i];\r\n }\r\n };\r\n /**\r\n * Load files from a drop event\r\n * @param event defines the drop event to use as source\r\n */\r\n FilesInput.prototype.loadFiles = function (event) {\r\n var _this = this;\r\n // Handling data transfer via drag'n'drop\r\n if (event && event.dataTransfer && event.dataTransfer.files) {\r\n this._filesToLoad = event.dataTransfer.files;\r\n }\r\n // Handling files from input files\r\n if (event && event.target && event.target.files) {\r\n this._filesToLoad = event.target.files;\r\n }\r\n if (!this._filesToLoad || this._filesToLoad.length === 0) {\r\n return;\r\n }\r\n if (this._startingProcessingFilesCallback) {\r\n this._startingProcessingFilesCallback(this._filesToLoad);\r\n }\r\n if (this._filesToLoad && this._filesToLoad.length > 0) {\r\n var files_1 = new Array();\r\n var folders = [];\r\n var items = event.dataTransfer ? event.dataTransfer.items : null;\r\n for (var i = 0; i < this._filesToLoad.length; i++) {\r\n var fileToLoad = this._filesToLoad[i];\r\n var name_1 = fileToLoad.name.toLowerCase();\r\n var entry = void 0;\r\n fileToLoad.correctName = name_1;\r\n if (items) {\r\n var item = items[i];\r\n if (item.getAsEntry) {\r\n entry = item.getAsEntry();\r\n }\r\n else if (item.webkitGetAsEntry) {\r\n entry = item.webkitGetAsEntry();\r\n }\r\n }\r\n if (!entry) {\r\n files_1.push(fileToLoad);\r\n }\r\n else {\r\n if (entry.isDirectory) {\r\n folders.push(entry);\r\n }\r\n else {\r\n files_1.push(fileToLoad);\r\n }\r\n }\r\n }\r\n if (folders.length === 0) {\r\n this._processFiles(files_1);\r\n this._processReload();\r\n }\r\n else {\r\n var remaining = { count: folders.length };\r\n for (var _i = 0, folders_1 = folders; _i < folders_1.length; _i++) {\r\n var folder = folders_1[_i];\r\n this._traverseFolder(folder, files_1, remaining, function () {\r\n _this._processFiles(files_1);\r\n if (remaining.count === 0) {\r\n _this._processReload();\r\n }\r\n });\r\n }\r\n }\r\n }\r\n };\r\n FilesInput.prototype._processReload = function () {\r\n if (this._onReloadCallback) {\r\n this._onReloadCallback(this._sceneFileToLoad);\r\n }\r\n else {\r\n this.reload();\r\n }\r\n };\r\n /**\r\n * Reload the current scene from the loaded files\r\n */\r\n FilesInput.prototype.reload = function () {\r\n var _this = this;\r\n // If a scene file has been provided\r\n if (this._sceneFileToLoad) {\r\n if (this._currentScene) {\r\n if (_Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].errorsCount > 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].ClearLogCache();\r\n }\r\n this._engine.stopRenderLoop();\r\n }\r\n _Loading_sceneLoader__WEBPACK_IMPORTED_MODULE_0__[\"SceneLoader\"].LoadAsync(\"file:\", this._sceneFileToLoad, this._engine, function (progress) {\r\n if (_this._progressCallback) {\r\n _this._progressCallback(progress);\r\n }\r\n }).then(function (scene) {\r\n if (_this._currentScene) {\r\n _this._currentScene.dispose();\r\n }\r\n _this._currentScene = scene;\r\n if (_this._sceneLoadedCallback) {\r\n _this._sceneLoadedCallback(_this._sceneFileToLoad, _this._currentScene);\r\n }\r\n // Wait for textures and shaders to be ready\r\n _this._currentScene.executeWhenReady(function () {\r\n _this._engine.runRenderLoop(function () {\r\n _this.renderFunction();\r\n });\r\n });\r\n }).catch(function (error) {\r\n if (_this._errorCallback) {\r\n _this._errorCallback(_this._sceneFileToLoad, _this._currentScene, error.message);\r\n }\r\n });\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Please provide a valid .babylon file.\");\r\n }\r\n };\r\n return FilesInput;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/filesInputStore.ts\":\n/*!*********************************!*\\\n !*** ./Misc/filesInputStore.ts ***!\n \\*********************************/\n/*! exports provided: FilesInputStore */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return FilesInputStore; });\n/**\r\n * Class used to help managing file picking and drag'n'drop\r\n * File Storage\r\n */\r\nvar FilesInputStore = /** @class */ (function () {\r\n function FilesInputStore() {\r\n }\r\n /**\r\n * List of files ready to be loaded\r\n */\r\n FilesInputStore.FilesToLoad = {};\r\n return FilesInputStore;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/gradients.ts\":\n/*!***************************!*\\\n !*** ./Misc/gradients.ts ***!\n \\***************************/\n/*! exports provided: ColorGradient, Color3Gradient, FactorGradient, GradientHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return ColorGradient; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return Color3Gradient; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return FactorGradient; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return GradientHelper; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n/** Class used to store color4 gradient */\r\nvar ColorGradient = /** @class */ (function () {\r\n function ColorGradient() {\r\n }\r\n /**\r\n * Will get a color picked randomly between color1 and color2.\r\n * If color2 is undefined then color1 will be used\r\n * @param result defines the target Color4 to store the result in\r\n */\r\n ColorGradient.prototype.getColorToRef = function (result) {\r\n if (!this.color2) {\r\n result.copyFrom(this.color1);\r\n return;\r\n }\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"].LerpToRef(this.color1, this.color2, Math.random(), result);\r\n };\r\n return ColorGradient;\r\n}());\r\n\r\n/** Class used to store color 3 gradient */\r\nvar Color3Gradient = /** @class */ (function () {\r\n function Color3Gradient() {\r\n }\r\n return Color3Gradient;\r\n}());\r\n\r\n/** Class used to store factor gradient */\r\nvar FactorGradient = /** @class */ (function () {\r\n function FactorGradient() {\r\n }\r\n /**\r\n * Will get a number picked randomly between factor1 and factor2.\r\n * If factor2 is undefined then factor1 will be used\r\n * @returns the picked number\r\n */\r\n FactorGradient.prototype.getFactor = function () {\r\n if (this.factor2 === undefined) {\r\n return this.factor1;\r\n }\r\n return this.factor1 + ((this.factor2 - this.factor1) * Math.random());\r\n };\r\n return FactorGradient;\r\n}());\r\n\r\n/**\r\n * Helper used to simplify some generic gradient tasks\r\n */\r\nvar GradientHelper = /** @class */ (function () {\r\n function GradientHelper() {\r\n }\r\n /**\r\n * Gets the current gradient from an array of IValueGradient\r\n * @param ratio defines the current ratio to get\r\n * @param gradients defines the array of IValueGradient\r\n * @param updateFunc defines the callback function used to get the final value from the selected gradients\r\n */\r\n GradientHelper.GetCurrentGradient = function (ratio, gradients, updateFunc) {\r\n for (var gradientIndex = 0; gradientIndex < gradients.length - 1; gradientIndex++) {\r\n var currentGradient = gradients[gradientIndex];\r\n var nextGradient = gradients[gradientIndex + 1];\r\n if (ratio >= currentGradient.gradient && ratio <= nextGradient.gradient) {\r\n var scale = (ratio - currentGradient.gradient) / (nextGradient.gradient - currentGradient.gradient);\r\n updateFunc(currentGradient, nextGradient, scale);\r\n return;\r\n }\r\n }\r\n // Use last index if over\r\n var lastIndex = gradients.length - 1;\r\n updateFunc(gradients[lastIndex], gradients[lastIndex], 1.0);\r\n };\r\n return GradientHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/guid.ts\":\n/*!**********************!*\\\n !*** ./Misc/guid.ts ***!\n \\**********************/\n/*! exports provided: GUID */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GUID\", function() { return GUID; });\n/**\r\n * Class used to manipulate GUIDs\r\n */\r\nvar GUID = /** @class */ (function () {\r\n function GUID() {\r\n }\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n GUID.RandomId = function () {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n };\r\n return GUID;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/iInspectable.ts\":\n/*!******************************!*\\\n !*** ./Misc/iInspectable.ts ***!\n \\******************************/\n/*! exports provided: InspectableType */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return InspectableType; });\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nvar InspectableType;\r\n(function (InspectableType) {\r\n /**\r\n * Checkbox for booleans\r\n */\r\n InspectableType[InspectableType[\"Checkbox\"] = 0] = \"Checkbox\";\r\n /**\r\n * Sliders for numbers\r\n */\r\n InspectableType[InspectableType[\"Slider\"] = 1] = \"Slider\";\r\n /**\r\n * Vector3\r\n */\r\n InspectableType[InspectableType[\"Vector3\"] = 2] = \"Vector3\";\r\n /**\r\n * Quaternions\r\n */\r\n InspectableType[InspectableType[\"Quaternion\"] = 3] = \"Quaternion\";\r\n /**\r\n * Color3\r\n */\r\n InspectableType[InspectableType[\"Color3\"] = 4] = \"Color3\";\r\n /**\r\n * String\r\n */\r\n InspectableType[InspectableType[\"String\"] = 5] = \"String\";\r\n})(InspectableType || (InspectableType = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Misc/index.ts\":\n/*!***********************!*\\\n !*** ./Misc/index.ts ***!\n \\***********************/\n/*! exports provided: AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, HDRTools, PanoramaToCubeMapTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./andOrNotEvaluator */ \"./Misc/andOrNotEvaluator.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__[\"AndOrNotEvaluator\"]; });\n\n/* harmony import */ var _assetsManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assetsManager */ \"./Misc/assetsManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AssetTaskState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AbstractAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AssetsProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"MeshAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"TextFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"BinaryFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"ImageAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"TextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"CubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"HDRCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"EquiRectangularCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return _assetsManager__WEBPACK_IMPORTED_MODULE_1__[\"AssetsManager\"]; });\n\n/* harmony import */ var _dds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dds */ \"./Misc/dds.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return _dds__WEBPACK_IMPORTED_MODULE_2__[\"DDSTools\"]; });\n\n/* harmony import */ var _decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./decorators */ \"./Misc/decorators.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"expandToProperty\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serialize\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsColor3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsFresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsVector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsVector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsMeshReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsColor4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsQuaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsMatrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"serializeAsCameraReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return _decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"]; });\n\n/* harmony import */ var _deferred__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./deferred */ \"./Misc/deferred.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return _deferred__WEBPACK_IMPORTED_MODULE_4__[\"Deferred\"]; });\n\n/* harmony import */ var _environmentTextureTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./environmentTextureTools */ \"./Misc/environmentTextureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return _environmentTextureTools__WEBPACK_IMPORTED_MODULE_5__[\"EnvironmentTextureTools\"]; });\n\n/* harmony import */ var _meshExploder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./meshExploder */ \"./Misc/meshExploder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return _meshExploder__WEBPACK_IMPORTED_MODULE_6__[\"MeshExploder\"]; });\n\n/* harmony import */ var _filesInput__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./filesInput */ \"./Misc/filesInput.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return _filesInput__WEBPACK_IMPORTED_MODULE_7__[\"FilesInput\"]; });\n\n/* harmony import */ var _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./HighDynamicRange/index */ \"./Misc/HighDynamicRange/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__[\"HDRTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _HighDynamicRange_index__WEBPACK_IMPORTED_MODULE_8__[\"PanoramaToCubeMapTools\"]; });\n\n/* harmony import */ var _khronosTextureContainer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./khronosTextureContainer */ \"./Misc/khronosTextureContainer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return _khronosTextureContainer__WEBPACK_IMPORTED_MODULE_9__[\"KhronosTextureContainer\"]; });\n\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"EventState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"Observer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"MultiObserver\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return _observable__WEBPACK_IMPORTED_MODULE_10__[\"Observable\"]; });\n\n/* harmony import */ var _performanceMonitor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./performanceMonitor */ \"./Misc/performanceMonitor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return _performanceMonitor__WEBPACK_IMPORTED_MODULE_11__[\"PerformanceMonitor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return _performanceMonitor__WEBPACK_IMPORTED_MODULE_11__[\"RollingAverage\"]; });\n\n/* harmony import */ var _promise__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./promise */ \"./Misc/promise.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return _promise__WEBPACK_IMPORTED_MODULE_12__[\"PromisePolyfill\"]; });\n\n/* harmony import */ var _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./sceneOptimizer */ \"./Misc/sceneOptimizer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"SceneOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"TextureOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"HardwareScalingOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"ShadowsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"PostProcessesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"LensFlaresOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"CustomOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"ParticlesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"RenderTargetsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"MergeMeshesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"SceneOptimizerOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return _sceneOptimizer__WEBPACK_IMPORTED_MODULE_13__[\"SceneOptimizer\"]; });\n\n/* harmony import */ var _sceneSerializer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sceneSerializer */ \"./Misc/sceneSerializer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return _sceneSerializer__WEBPACK_IMPORTED_MODULE_14__[\"SceneSerializer\"]; });\n\n/* harmony import */ var _smartArray__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./smartArray */ \"./Misc/smartArray.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return _smartArray__WEBPACK_IMPORTED_MODULE_15__[\"SmartArray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return _smartArray__WEBPACK_IMPORTED_MODULE_15__[\"SmartArrayNoDuplicate\"]; });\n\n/* harmony import */ var _stringDictionary__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./stringDictionary */ \"./Misc/stringDictionary.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return _stringDictionary__WEBPACK_IMPORTED_MODULE_16__[\"StringDictionary\"]; });\n\n/* harmony import */ var _tags__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./tags */ \"./Misc/tags.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return _tags__WEBPACK_IMPORTED_MODULE_17__[\"Tags\"]; });\n\n/* harmony import */ var _textureTools__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./textureTools */ \"./Misc/textureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return _textureTools__WEBPACK_IMPORTED_MODULE_18__[\"TextureTools\"]; });\n\n/* harmony import */ var _tga__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./tga */ \"./Misc/tga.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return _tga__WEBPACK_IMPORTED_MODULE_19__[\"TGATools\"]; });\n\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return _tools__WEBPACK_IMPORTED_MODULE_20__[\"Tools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return _tools__WEBPACK_IMPORTED_MODULE_20__[\"className\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return _tools__WEBPACK_IMPORTED_MODULE_20__[\"AsyncLoop\"]; });\n\n/* harmony import */ var _videoRecorder__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./videoRecorder */ \"./Misc/videoRecorder.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return _videoRecorder__WEBPACK_IMPORTED_MODULE_21__[\"VideoRecorder\"]; });\n\n/* harmony import */ var _virtualJoystick__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./virtualJoystick */ \"./Misc/virtualJoystick.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return _virtualJoystick__WEBPACK_IMPORTED_MODULE_22__[\"JoystickAxis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return _virtualJoystick__WEBPACK_IMPORTED_MODULE_22__[\"VirtualJoystick\"]; });\n\n/* harmony import */ var _workerPool__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./workerPool */ \"./Misc/workerPool.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return _workerPool__WEBPACK_IMPORTED_MODULE_23__[\"WorkerPool\"]; });\n\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return _logger__WEBPACK_IMPORTED_MODULE_24__[\"Logger\"]; });\n\n/* harmony import */ var _typeStore__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./typeStore */ \"./Misc/typeStore.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _typeStore__WEBPACK_IMPORTED_MODULE_25__[\"_TypeStore\"]; });\n\n/* harmony import */ var _filesInputStore__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./filesInputStore */ \"./Misc/filesInputStore.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return _filesInputStore__WEBPACK_IMPORTED_MODULE_26__[\"FilesInputStore\"]; });\n\n/* harmony import */ var _deepCopier__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return _deepCopier__WEBPACK_IMPORTED_MODULE_27__[\"DeepCopier\"]; });\n\n/* harmony import */ var _pivotTools__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./pivotTools */ \"./Misc/pivotTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return _pivotTools__WEBPACK_IMPORTED_MODULE_28__[\"PivotTools\"]; });\n\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return _precisionDate__WEBPACK_IMPORTED_MODULE_29__[\"PrecisionDate\"]; });\n\n/* harmony import */ var _screenshotTools__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./screenshotTools */ \"./Misc/screenshotTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return _screenshotTools__WEBPACK_IMPORTED_MODULE_30__[\"ScreenshotTools\"]; });\n\n/* empty/unused harmony star reexport *//* harmony import */ var _webRequest__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./webRequest */ \"./Misc/webRequest.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return _webRequest__WEBPACK_IMPORTED_MODULE_31__[\"WebRequest\"]; });\n\n/* harmony import */ var _iInspectable__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./iInspectable */ \"./Misc/iInspectable.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return _iInspectable__WEBPACK_IMPORTED_MODULE_32__[\"InspectableType\"]; });\n\n/* harmony import */ var _brdfTextureTools__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./brdfTextureTools */ \"./Misc/brdfTextureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return _brdfTextureTools__WEBPACK_IMPORTED_MODULE_33__[\"BRDFTextureTools\"]; });\n\n/* harmony import */ var _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./rgbdTextureTools */ \"./Misc/rgbdTextureTools.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return _rgbdTextureTools__WEBPACK_IMPORTED_MODULE_34__[\"RGBDTextureTools\"]; });\n\n/* harmony import */ var _gradients__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./gradients */ \"./Misc/gradients.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"ColorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"Color3Gradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"FactorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return _gradients__WEBPACK_IMPORTED_MODULE_35__[\"GradientHelper\"]; });\n\n/* harmony import */ var _perfCounter__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./perfCounter */ \"./Misc/perfCounter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return _perfCounter__WEBPACK_IMPORTED_MODULE_36__[\"PerfCounter\"]; });\n\n/* harmony import */ var _retryStrategy__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./retryStrategy */ \"./Misc/retryStrategy.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return _retryStrategy__WEBPACK_IMPORTED_MODULE_37__[\"RetryStrategy\"]; });\n\n/* harmony import */ var _loadFileError__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./loadFileError */ \"./Misc/loadFileError.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return _loadFileError__WEBPACK_IMPORTED_MODULE_38__[\"LoadFileError\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/instantiationTools.ts\":\n/*!************************************!*\\\n !*** ./Misc/instantiationTools.ts ***!\n \\************************************/\n/*! exports provided: InstantiationTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InstantiationTools\", function() { return InstantiationTools; });\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _typeStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n/**\r\n * Class used to enable instatition of objects by class name\r\n */\r\nvar InstantiationTools = /** @class */ (function () {\r\n function InstantiationTools() {\r\n }\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n InstantiationTools.Instantiate = function (className) {\r\n if (this.RegisteredExternalClasses && this.RegisteredExternalClasses[className]) {\r\n return this.RegisteredExternalClasses[className];\r\n }\r\n var internalClass = _typeStore__WEBPACK_IMPORTED_MODULE_1__[\"_TypeStore\"].GetClass(className);\r\n if (internalClass) {\r\n return internalClass;\r\n }\r\n _logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(className + \" not found, you may have missed an import.\");\r\n var arr = className.split(\".\");\r\n var fn = (window || this);\r\n for (var i = 0, len = arr.length; i < len; i++) {\r\n fn = fn[arr[i]];\r\n }\r\n if (typeof fn !== \"function\") {\r\n return null;\r\n }\r\n return fn;\r\n };\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n InstantiationTools.RegisteredExternalClasses = {};\r\n return InstantiationTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/khronosTextureContainer.ts\":\n/*!*****************************************!*\\\n !*** ./Misc/khronosTextureContainer.ts ***!\n \\*****************************************/\n/*! exports provided: KhronosTextureContainer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return KhronosTextureContainer; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\r\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\r\n */\r\nvar KhronosTextureContainer = /** @class */ (function () {\r\n /**\r\n * Creates a new KhronosTextureContainer\r\n * @param arrayBuffer contents of the KTX container file\r\n * @param facesExpected should be either 1 or 6, based whether a cube texture or or\r\n * @param threeDExpected provision for indicating that data should be a 3D texture, not implemented\r\n * @param textureArrayExpected provision for indicating that data should be a texture array, not implemented\r\n */\r\n function KhronosTextureContainer(\r\n /** contents of the KTX container file */\r\n arrayBuffer, facesExpected, threeDExpected, textureArrayExpected) {\r\n this.arrayBuffer = arrayBuffer;\r\n /**\r\n * If the container has been made invalid (eg. constructor failed to correctly load array buffer)\r\n */\r\n this.isInvalid = false;\r\n // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is:\r\n // '�', 'K', 'T', 'X', ' ', '1', '1', '�', '\\r', '\\n', '\\x1A', '\\n'\r\n // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A\r\n var identifier = new Uint8Array(this.arrayBuffer, 0, 12);\r\n if (identifier[0] !== 0xAB || identifier[1] !== 0x4B || identifier[2] !== 0x54 || identifier[3] !== 0x58 || identifier[4] !== 0x20 || identifier[5] !== 0x31 ||\r\n identifier[6] !== 0x31 || identifier[7] !== 0xBB || identifier[8] !== 0x0D || identifier[9] !== 0x0A || identifier[10] !== 0x1A || identifier[11] !== 0x0A) {\r\n this.isInvalid = true;\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"texture missing KTX identifier\");\r\n return;\r\n }\r\n // load the reset of the header in native 32 bit uint\r\n var dataSize = Uint32Array.BYTES_PER_ELEMENT;\r\n var headerDataView = new DataView(this.arrayBuffer, 12, 13 * dataSize);\r\n var endianness = headerDataView.getUint32(0, true);\r\n var littleEndian = endianness === 0x04030201;\r\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures\r\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures\r\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures\r\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\r\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\r\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\r\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\r\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\r\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays\r\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6\r\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures\r\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data\r\n // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing.\r\n if (this.glType !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"only compressed formats currently supported\");\r\n return;\r\n }\r\n else {\r\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\r\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);\r\n }\r\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"only 2D textures currently supported\");\r\n return;\r\n }\r\n if (this.numberOfArrayElements !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"texture arrays not currently supported\");\r\n return;\r\n }\r\n if (this.numberOfFaces !== facesExpected) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"number of faces expected\" + facesExpected + \", but found \" + this.numberOfFaces);\r\n return;\r\n }\r\n // we now have a completely validated file, so could use existence of loadType as success\r\n // would need to make this more elaborate & adjust checks above to support more than one load type\r\n this.loadType = KhronosTextureContainer.COMPRESSED_2D;\r\n }\r\n /**\r\n * Uploads KTX content to a Babylon Texture.\r\n * It is assumed that the texture has already been created & is currently bound\r\n * @hidden\r\n */\r\n KhronosTextureContainer.prototype.uploadLevels = function (texture, loadMipmaps) {\r\n switch (this.loadType) {\r\n case KhronosTextureContainer.COMPRESSED_2D:\r\n this._upload2DCompressedLevels(texture, loadMipmaps);\r\n break;\r\n case KhronosTextureContainer.TEX_2D:\r\n case KhronosTextureContainer.COMPRESSED_3D:\r\n case KhronosTextureContainer.TEX_3D:\r\n }\r\n };\r\n KhronosTextureContainer.prototype._upload2DCompressedLevels = function (texture, loadMipmaps) {\r\n // initialize width & height for level 1\r\n var dataOffset = KhronosTextureContainer.HEADER_LEN + this.bytesOfKeyValueData;\r\n var width = this.pixelWidth;\r\n var height = this.pixelHeight;\r\n var mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;\r\n for (var level = 0; level < mipmapCount; level++) {\r\n var imageSize = new Int32Array(this.arrayBuffer, dataOffset, 1)[0]; // size per face, since not supporting array cubemaps\r\n dataOffset += 4; //image data starts from next multiple of 4 offset. Each face refers to same imagesize field above.\r\n for (var face = 0; face < this.numberOfFaces; face++) {\r\n var byteArray = new Uint8Array(this.arrayBuffer, dataOffset, imageSize);\r\n var engine = texture.getEngine();\r\n engine._uploadCompressedDataToTextureDirectly(texture, this.glInternalFormat, width, height, byteArray, face, level);\r\n dataOffset += imageSize; // add size of the image for the next face/mipmap\r\n dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image\r\n }\r\n width = Math.max(1.0, width * 0.5);\r\n height = Math.max(1.0, height * 0.5);\r\n }\r\n };\r\n KhronosTextureContainer.HEADER_LEN = 12 + (13 * 4); // identifier + header elements (not including key value meta-data pairs)\r\n // load types\r\n KhronosTextureContainer.COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()\r\n KhronosTextureContainer.COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\r\n KhronosTextureContainer.TEX_2D = 2; // uses a gl.texImage2D()\r\n KhronosTextureContainer.TEX_3D = 3; // uses a gl.texImage3D()\r\n return KhronosTextureContainer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/loadFileError.ts\":\n/*!*******************************!*\\\n !*** ./Misc/loadFileError.ts ***!\n \\*******************************/\n/*! exports provided: LoadFileError */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return LoadFileError; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * @ignore\r\n * Application error to support additional information when loading a file\r\n */\r\nvar LoadFileError = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LoadFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n function LoadFileError(message, \r\n /** defines the optional web request */\r\n request) {\r\n var _this = _super.call(this, message) || this;\r\n _this.request = request;\r\n _this.name = \"LoadFileError\";\r\n LoadFileError._setPrototypeOf(_this, LoadFileError.prototype);\r\n return _this;\r\n }\r\n // See https://stackoverflow.com/questions/12915412/how-do-i-extend-a-host-object-e-g-error-in-typescript\r\n // and https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n // Polyfill for Object.setPrototypeOf if necessary.\r\n LoadFileError._setPrototypeOf = Object.setPrototypeOf || (function (o, proto) { o.__proto__ = proto; return o; });\r\n return LoadFileError;\r\n}(Error));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/logger.ts\":\n/*!************************!*\\\n !*** ./Misc/logger.ts ***!\n \\************************/\n/*! exports provided: Logger */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return Logger; });\n/**\r\n * Logger used througouht the application to allow configuration of\r\n * the log level required for the messages.\r\n */\r\nvar Logger = /** @class */ (function () {\r\n function Logger() {\r\n }\r\n Logger._AddLogEntry = function (entry) {\r\n Logger._LogCache = entry + Logger._LogCache;\r\n if (Logger.OnNewCacheEntry) {\r\n Logger.OnNewCacheEntry(entry);\r\n }\r\n };\r\n Logger._FormatMessage = function (message) {\r\n var padStr = function (i) { return (i < 10) ? \"0\" + i : \"\" + i; };\r\n var date = new Date();\r\n return \"[\" + padStr(date.getHours()) + \":\" + padStr(date.getMinutes()) + \":\" + padStr(date.getSeconds()) + \"]: \" + message;\r\n };\r\n Logger._LogDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._LogEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.log(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._WarnDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._WarnEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.warn(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._ErrorDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._ErrorEnabled = function (message) {\r\n Logger.errorsCount++;\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.error(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Object.defineProperty(Logger, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return Logger._LogCache;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Logger.ClearLogCache = function () {\r\n Logger._LogCache = \"\";\r\n Logger.errorsCount = 0;\r\n };\r\n Object.defineProperty(Logger, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n if ((level & Logger.MessageLogLevel) === Logger.MessageLogLevel) {\r\n Logger.Log = Logger._LogEnabled;\r\n }\r\n else {\r\n Logger.Log = Logger._LogDisabled;\r\n }\r\n if ((level & Logger.WarningLogLevel) === Logger.WarningLogLevel) {\r\n Logger.Warn = Logger._WarnEnabled;\r\n }\r\n else {\r\n Logger.Warn = Logger._WarnDisabled;\r\n }\r\n if ((level & Logger.ErrorLogLevel) === Logger.ErrorLogLevel) {\r\n Logger.Error = Logger._ErrorEnabled;\r\n }\r\n else {\r\n Logger.Error = Logger._ErrorDisabled;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * No log\r\n */\r\n Logger.NoneLogLevel = 0;\r\n /**\r\n * Only message logs\r\n */\r\n Logger.MessageLogLevel = 1;\r\n /**\r\n * Only warning logs\r\n */\r\n Logger.WarningLogLevel = 2;\r\n /**\r\n * Only error logs\r\n */\r\n Logger.ErrorLogLevel = 4;\r\n /**\r\n * All logs\r\n */\r\n Logger.AllLogLevel = 7;\r\n Logger._LogCache = \"\";\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n Logger.errorsCount = 0;\r\n /**\r\n * Log a message to the console\r\n */\r\n Logger.Log = Logger._LogEnabled;\r\n /**\r\n * Write a warning message to the console\r\n */\r\n Logger.Warn = Logger._WarnEnabled;\r\n /**\r\n * Write an error message to the console\r\n */\r\n Logger.Error = Logger._ErrorEnabled;\r\n return Logger;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/meshExploder.ts\":\n/*!******************************!*\\\n !*** ./Misc/meshExploder.ts ***!\n \\******************************/\n/*! exports provided: MeshExploder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return MeshExploder; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Class used to explode meshes (ie. to have a center and move them away from that center to better see the overall organization)\r\n */\r\nvar MeshExploder = /** @class */ (function () {\r\n /**\r\n * Explodes meshes from a center mesh.\r\n * @param meshes The meshes to explode.\r\n * @param centerMesh The mesh to be center of explosion.\r\n */\r\n function MeshExploder(meshes, centerMesh) {\r\n this._meshesOrigins = [];\r\n this._toCenterVectors = [];\r\n this._scaledDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._newPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._centerPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._meshes = meshes.slice();\r\n if (centerMesh) {\r\n this._centerMesh = centerMesh;\r\n }\r\n else {\r\n this._setCenterMesh();\r\n }\r\n var centerMeshIndex = this._meshes.indexOf(this._centerMesh);\r\n if (centerMeshIndex >= 0) {\r\n this._meshes.splice(centerMeshIndex, 1);\r\n }\r\n this._centerPosition = this._centerMesh.getAbsolutePosition().clone();\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index]) {\r\n var mesh = this._meshes[index];\r\n this._meshesOrigins[index] = mesh.getAbsolutePosition().clone();\r\n this._toCenterVectors[index] = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n if (mesh._boundingInfo && this._centerMesh._boundingInfo) {\r\n mesh._boundingInfo.boundingBox.centerWorld.subtractToRef(this._centerMesh._boundingInfo.boundingBox.centerWorld, this._toCenterVectors[index]);\r\n }\r\n }\r\n }\r\n }\r\n MeshExploder.prototype._setCenterMesh = function () {\r\n var averageCenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var totalCenters = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var shortestToCenter = Number.MAX_VALUE;\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index]) {\r\n var mesh = this._meshes[index];\r\n var boundingInfo = mesh.getBoundingInfo();\r\n if (boundingInfo) {\r\n totalCenters.addInPlace(boundingInfo.boundingBox.centerWorld);\r\n }\r\n }\r\n }\r\n averageCenter = totalCenters.scale(1 / this._meshes.length);\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index]) {\r\n var mesh = this._meshes[index];\r\n var boundingInfo = mesh.getBoundingInfo();\r\n if (boundingInfo) {\r\n var distanceToCenter = boundingInfo.boundingBox.centerWorld.subtract(averageCenter).lengthSquared();\r\n if (distanceToCenter < shortestToCenter) {\r\n this._centerMesh = mesh;\r\n shortestToCenter = distanceToCenter;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Get class name\r\n * @returns \"MeshExploder\"\r\n */\r\n MeshExploder.prototype.getClassName = function () {\r\n return \"MeshExploder\";\r\n };\r\n /**\r\n * \"Exploded meshes\"\r\n * @returns Array of meshes with the centerMesh at index 0.\r\n */\r\n MeshExploder.prototype.getMeshes = function () {\r\n var meshArray = this._meshes.slice();\r\n meshArray.unshift(this._centerMesh);\r\n return meshArray;\r\n };\r\n /**\r\n * Explodes meshes giving a specific direction\r\n * @param direction Number to multiply distance of each mesh's origin from center. Use a negative number to implode, or zero to reset.\r\n */\r\n MeshExploder.prototype.explode = function (direction) {\r\n if (direction === void 0) { direction = 1.0; }\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (this._meshes[index] && this._meshesOrigins[index] && this._toCenterVectors[index]) {\r\n this._toCenterVectors[index].scaleToRef(direction, this._scaledDirection);\r\n this._meshesOrigins[index].addToRef(this._scaledDirection, this._newPosition);\r\n this._meshes[index].setAbsolutePosition(this._newPosition);\r\n }\r\n }\r\n this._centerMesh.setAbsolutePosition(this._centerPosition);\r\n };\r\n return MeshExploder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/observable.ts\":\n/*!****************************!*\\\n !*** ./Misc/observable.ts ***!\n \\****************************/\n/*! exports provided: EventState, Observer, MultiObserver, Observable */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return EventState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return Observer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return MultiObserver; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return Observable; });\n/**\r\n * A class serves as a medium between the observable and its observers\r\n */\r\nvar EventState = /** @class */ (function () {\r\n /**\r\n * Create a new EventState\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n */\r\n function EventState(mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.initalize(mask, skipNextObservers, target, currentTarget);\r\n }\r\n /**\r\n * Initialize the current event state\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @returns the current event state\r\n */\r\n EventState.prototype.initalize = function (mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.mask = mask;\r\n this.skipNextObservers = skipNextObservers;\r\n this.target = target;\r\n this.currentTarget = currentTarget;\r\n return this;\r\n };\r\n return EventState;\r\n}());\r\n\r\n/**\r\n * Represent an Observer registered to a given Observable object.\r\n */\r\nvar Observer = /** @class */ (function () {\r\n /**\r\n * Creates a new observer\r\n * @param callback defines the callback to call when the observer is notified\r\n * @param mask defines the mask of the observer (used to filter notifications)\r\n * @param scope defines the current scope used to restore the JS context\r\n */\r\n function Observer(\r\n /**\r\n * Defines the callback to call when the observer is notified\r\n */\r\n callback, \r\n /**\r\n * Defines the mask of the observer (used to filter notifications)\r\n */\r\n mask, \r\n /**\r\n * Defines the current scope used to restore the JS context\r\n */\r\n scope) {\r\n if (scope === void 0) { scope = null; }\r\n this.callback = callback;\r\n this.mask = mask;\r\n this.scope = scope;\r\n /** @hidden */\r\n this._willBeUnregistered = false;\r\n /**\r\n * Gets or sets a property defining that the observer as to be unregistered after the next notification\r\n */\r\n this.unregisterOnNextCall = false;\r\n }\r\n return Observer;\r\n}());\r\n\r\n/**\r\n * Represent a list of observers registered to multiple Observables object.\r\n */\r\nvar MultiObserver = /** @class */ (function () {\r\n function MultiObserver() {\r\n }\r\n /**\r\n * Release associated resources\r\n */\r\n MultiObserver.prototype.dispose = function () {\r\n if (this._observers && this._observables) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n this._observables[index].remove(this._observers[index]);\r\n }\r\n }\r\n this._observers = null;\r\n this._observables = null;\r\n };\r\n /**\r\n * Raise a callback when one of the observable will notify\r\n * @param observables defines a list of observables to watch\r\n * @param callback defines the callback to call on notification\r\n * @param mask defines the mask used to filter notifications\r\n * @param scope defines the current scope used to restore the JS context\r\n * @returns the new MultiObserver\r\n */\r\n MultiObserver.Watch = function (observables, callback, mask, scope) {\r\n if (mask === void 0) { mask = -1; }\r\n if (scope === void 0) { scope = null; }\r\n var result = new MultiObserver();\r\n result._observers = new Array();\r\n result._observables = observables;\r\n for (var _i = 0, observables_1 = observables; _i < observables_1.length; _i++) {\r\n var observable = observables_1[_i];\r\n var observer = observable.add(callback, mask, false, scope);\r\n if (observer) {\r\n result._observers.push(observer);\r\n }\r\n }\r\n return result;\r\n };\r\n return MultiObserver;\r\n}());\r\n\r\n/**\r\n * The Observable class is a simple implementation of the Observable pattern.\r\n *\r\n * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.\r\n * This enable a more fine grained execution without having to rely on multiple different Observable objects.\r\n * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).\r\n * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.\r\n */\r\nvar Observable = /** @class */ (function () {\r\n /**\r\n * Creates a new observable\r\n * @param onObserverAdded defines a callback to call when a new observer is added\r\n */\r\n function Observable(onObserverAdded) {\r\n this._observers = new Array();\r\n this._eventState = new EventState(0);\r\n if (onObserverAdded) {\r\n this._onObserverAdded = onObserverAdded;\r\n }\r\n }\r\n Object.defineProperty(Observable.prototype, \"observers\", {\r\n /**\r\n * Gets the list of observers\r\n */\r\n get: function () {\r\n return this._observers;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new Observer with the specified callback\r\n * @param callback the callback that will be executed for that Observer\r\n * @param mask the mask used to filter observers\r\n * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.\r\n * @param scope optional scope for the callback to be called from\r\n * @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.add = function (callback, mask, insertFirst, scope, unregisterOnFirstCall) {\r\n if (mask === void 0) { mask = -1; }\r\n if (insertFirst === void 0) { insertFirst = false; }\r\n if (scope === void 0) { scope = null; }\r\n if (unregisterOnFirstCall === void 0) { unregisterOnFirstCall = false; }\r\n if (!callback) {\r\n return null;\r\n }\r\n var observer = new Observer(callback, mask, scope);\r\n observer.unregisterOnNextCall = unregisterOnFirstCall;\r\n if (insertFirst) {\r\n this._observers.unshift(observer);\r\n }\r\n else {\r\n this._observers.push(observer);\r\n }\r\n if (this._onObserverAdded) {\r\n this._onObserverAdded(observer);\r\n }\r\n return observer;\r\n };\r\n /**\r\n * Create a new Observer with the specified callback and unregisters after the next notification\r\n * @param callback the callback that will be executed for that Observer\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.addOnce = function (callback) {\r\n return this.add(callback, undefined, undefined, undefined, true);\r\n };\r\n /**\r\n * Remove an Observer from the Observable object\r\n * @param observer the instance of the Observer to remove\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Remove a callback from the Observable object\r\n * @param callback the callback to remove\r\n * @param scope optional scope. If used only the callbacks with this scope will be removed\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.removeCallback = function (callback, scope) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n var observer = this._observers[index];\r\n if (observer._willBeUnregistered) {\r\n continue;\r\n }\r\n if (observer.callback === callback && (!scope || scope === observer.scope)) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Observable.prototype._deferUnregister = function (observer) {\r\n var _this = this;\r\n observer.unregisterOnNextCall = false;\r\n observer._willBeUnregistered = true;\r\n setTimeout(function () {\r\n _this._remove(observer);\r\n }, 0);\r\n };\r\n // This should only be called when not iterating over _observers to avoid callback skipping.\r\n // Removes an observer from the _observer Array.\r\n Observable.prototype._remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._observers.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Moves the observable to the top of the observer list making it get called first when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverTopPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.unshift(observer);\r\n };\r\n /**\r\n * Moves the observable to the bottom of the observer list making it get called last when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverBottomPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.push(observer);\r\n };\r\n /**\r\n * Notify all Observers by calling their respective callback with the given data\r\n * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute\r\n * @param eventData defines the data to send to all observers\r\n * @param mask defines the mask of the current notification (observers with incompatible mask (ie mask & observer.mask === 0) will not be notified)\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true)\r\n */\r\n Observable.prototype.notifyObservers = function (eventData, mask, target, currentTarget) {\r\n if (mask === void 0) { mask = -1; }\r\n if (!this._observers.length) {\r\n return true;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n state.lastReturnValue = eventData;\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs._willBeUnregistered) {\r\n continue;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n state.lastReturnValue = obs.callback.apply(obs.scope, [eventData, state]);\r\n }\r\n else {\r\n state.lastReturnValue = obs.callback(eventData, state);\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n this._deferUnregister(obs);\r\n }\r\n }\r\n if (state.skipNextObservers) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Calling this will execute each callback, expecting it to be a promise or return a value.\r\n * If at any point in the chain one function fails, the promise will fail and the execution will not continue.\r\n * This is useful when a chain of events (sometimes async events) is needed to initialize a certain object\r\n * and it is crucial that all callbacks will be executed.\r\n * The order of the callbacks is kept, callbacks are not executed parallel.\r\n *\r\n * @param eventData The data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n * @param target defines the callback target (see EventState)\r\n * @param currentTarget defines he current object in the bubbling phase\r\n * @returns {Promise} will return a Promise than resolves when all callbacks executed successfully.\r\n */\r\n Observable.prototype.notifyObserversWithPromise = function (eventData, mask, target, currentTarget) {\r\n var _this = this;\r\n if (mask === void 0) { mask = -1; }\r\n // create an empty promise\r\n var p = Promise.resolve(eventData);\r\n // no observers? return this promise.\r\n if (!this._observers.length) {\r\n return p;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n // execute one callback after another (not using Promise.all, the order is important)\r\n this._observers.forEach(function (obs) {\r\n if (state.skipNextObservers) {\r\n return;\r\n }\r\n if (obs._willBeUnregistered) {\r\n return;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback.apply(obs.scope, [eventData, state]);\r\n });\r\n }\r\n else {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback(eventData, state);\r\n });\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n _this._deferUnregister(obs);\r\n }\r\n }\r\n });\r\n // return the eventData\r\n return p.then(function () { return eventData; });\r\n };\r\n /**\r\n * Notify a specific observer\r\n * @param observer defines the observer to notify\r\n * @param eventData defines the data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n */\r\n Observable.prototype.notifyObserver = function (observer, eventData, mask) {\r\n if (mask === void 0) { mask = -1; }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.skipNextObservers = false;\r\n observer.callback(eventData, state);\r\n };\r\n /**\r\n * Gets a boolean indicating if the observable has at least one observer\r\n * @returns true is the Observable has at least one Observer registered\r\n */\r\n Observable.prototype.hasObservers = function () {\r\n return this._observers.length > 0;\r\n };\r\n /**\r\n * Clear the list of observers\r\n */\r\n Observable.prototype.clear = function () {\r\n this._observers = new Array();\r\n this._onObserverAdded = null;\r\n };\r\n /**\r\n * Clone the current observable\r\n * @returns a new observable\r\n */\r\n Observable.prototype.clone = function () {\r\n var result = new Observable();\r\n result._observers = this._observers.slice(0);\r\n return result;\r\n };\r\n /**\r\n * Does this observable handles observer registered with a given mask\r\n * @param mask defines the mask to be tested\r\n * @return whether or not one observer registered with the given mask is handeled\r\n **/\r\n Observable.prototype.hasSpecificMask = function (mask) {\r\n if (mask === void 0) { mask = -1; }\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs.mask & mask || obs.mask === mask) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n return Observable;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/perfCounter.ts\":\n/*!*****************************!*\\\n !*** ./Misc/perfCounter.ts ***!\n \\*****************************/\n/*! exports provided: PerfCounter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return PerfCounter; });\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n\r\n/**\r\n * This class is used to track a performance counter which is number based.\r\n * The user has access to many properties which give statistics of different nature.\r\n *\r\n * The implementer can track two kinds of Performance Counter: time and count.\r\n * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.\r\n * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.\r\n */\r\nvar PerfCounter = /** @class */ (function () {\r\n /**\r\n * Creates a new counter\r\n */\r\n function PerfCounter() {\r\n this._startMonitoringTime = 0;\r\n this._min = 0;\r\n this._max = 0;\r\n this._average = 0;\r\n this._lastSecAverage = 0;\r\n this._current = 0;\r\n this._totalValueCount = 0;\r\n this._totalAccumulated = 0;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecTime = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n Object.defineProperty(PerfCounter.prototype, \"min\", {\r\n /**\r\n * Returns the smallest value ever\r\n */\r\n get: function () {\r\n return this._min;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"max\", {\r\n /**\r\n * Returns the biggest value ever\r\n */\r\n get: function () {\r\n return this._max;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"average\", {\r\n /**\r\n * Returns the average value since the performance counter is running\r\n */\r\n get: function () {\r\n return this._average;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"lastSecAverage\", {\r\n /**\r\n * Returns the average value of the last second the counter was monitored\r\n */\r\n get: function () {\r\n return this._lastSecAverage;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"current\", {\r\n /**\r\n * Returns the current value\r\n */\r\n get: function () {\r\n return this._current;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"total\", {\r\n /**\r\n * Gets the accumulated total\r\n */\r\n get: function () {\r\n return this._totalAccumulated;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"count\", {\r\n /**\r\n * Gets the total value count\r\n */\r\n get: function () {\r\n return this._totalValueCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Call this method to start monitoring a new frame.\r\n * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.\r\n */\r\n PerfCounter.prototype.fetchNewFrame = function () {\r\n this._totalValueCount++;\r\n this._current = 0;\r\n this._lastSecValueCount++;\r\n };\r\n /**\r\n * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)\r\n * @param newCount the count value to add to the monitored count\r\n * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.\r\n */\r\n PerfCounter.prototype.addCount = function (newCount, fetchResult) {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._current += newCount;\r\n if (fetchResult) {\r\n this._fetchResult();\r\n }\r\n };\r\n /**\r\n * Start monitoring this performance counter\r\n */\r\n PerfCounter.prototype.beginMonitoring = function () {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._startMonitoringTime = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now;\r\n };\r\n /**\r\n * Compute the time lapsed since the previous beginMonitoring() call.\r\n * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter\r\n */\r\n PerfCounter.prototype.endMonitoring = function (newFrame) {\r\n if (newFrame === void 0) { newFrame = true; }\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n if (newFrame) {\r\n this.fetchNewFrame();\r\n }\r\n var currentTime = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now;\r\n this._current = currentTime - this._startMonitoringTime;\r\n if (newFrame) {\r\n this._fetchResult();\r\n }\r\n };\r\n PerfCounter.prototype._fetchResult = function () {\r\n this._totalAccumulated += this._current;\r\n this._lastSecAccumulated += this._current;\r\n // Min/Max update\r\n this._min = Math.min(this._min, this._current);\r\n this._max = Math.max(this._max, this._current);\r\n this._average = this._totalAccumulated / this._totalValueCount;\r\n // Reset last sec?\r\n var now = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now;\r\n if ((now - this._lastSecTime) > 1000) {\r\n this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount;\r\n this._lastSecTime = now;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n };\r\n /**\r\n * Gets or sets a global boolean to turn on and off all the counters\r\n */\r\n PerfCounter.Enabled = true;\r\n return PerfCounter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/performanceMonitor.ts\":\n/*!************************************!*\\\n !*** ./Misc/performanceMonitor.ts ***!\n \\************************************/\n/*! exports provided: PerformanceMonitor, RollingAverage */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return PerformanceMonitor; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return RollingAverage; });\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n\r\n/**\r\n * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window\r\n */\r\nvar PerformanceMonitor = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param frameSampleSize The number of samples required to saturate the sliding window\r\n */\r\n function PerformanceMonitor(frameSampleSize) {\r\n if (frameSampleSize === void 0) { frameSampleSize = 30; }\r\n this._enabled = true;\r\n this._rollingFrameTime = new RollingAverage(frameSampleSize);\r\n }\r\n /**\r\n * Samples current frame\r\n * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames\r\n */\r\n PerformanceMonitor.prototype.sampleFrame = function (timeMs) {\r\n if (timeMs === void 0) { timeMs = _precisionDate__WEBPACK_IMPORTED_MODULE_0__[\"PrecisionDate\"].Now; }\r\n if (!this._enabled) {\r\n return;\r\n }\r\n if (this._lastFrameTimeMs != null) {\r\n var dt = timeMs - this._lastFrameTimeMs;\r\n this._rollingFrameTime.add(dt);\r\n }\r\n this._lastFrameTimeMs = timeMs;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTime\", {\r\n /**\r\n * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.average;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTimeVariance\", {\r\n /**\r\n * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.variance;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFrameTime\", {\r\n /**\r\n * Returns the frame time of the most recent frame\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.history(0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return 1000.0 / this._rollingFrameTime.average;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second using the most recent frame time\r\n */\r\n get: function () {\r\n var history = this._rollingFrameTime.history(0);\r\n if (history === 0) {\r\n return 0;\r\n }\r\n return 1000.0 / history;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isSaturated\", {\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.isSaturated();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Enables contributions to the sliding window sample set\r\n */\r\n PerformanceMonitor.prototype.enable = function () {\r\n this._enabled = true;\r\n };\r\n /**\r\n * Disables contributions to the sliding window sample set\r\n * Samples will not be interpolated over the disabled period\r\n */\r\n PerformanceMonitor.prototype.disable = function () {\r\n this._enabled = false;\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isEnabled\", {\r\n /**\r\n * Returns true if sampling is enabled\r\n */\r\n get: function () {\r\n return this._enabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets performance monitor\r\n */\r\n PerformanceMonitor.prototype.reset = function () {\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n //wipe record\r\n this._rollingFrameTime.reset();\r\n };\r\n return PerformanceMonitor;\r\n}());\r\n\r\n/**\r\n * RollingAverage\r\n *\r\n * Utility to efficiently compute the rolling average and variance over a sliding window of samples\r\n */\r\nvar RollingAverage = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param length The number of samples required to saturate the sliding window\r\n */\r\n function RollingAverage(length) {\r\n this._samples = new Array(length);\r\n this.reset();\r\n }\r\n /**\r\n * Adds a sample to the sample set\r\n * @param v The sample value\r\n */\r\n RollingAverage.prototype.add = function (v) {\r\n //http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance\r\n var delta;\r\n //we need to check if we've already wrapped round\r\n if (this.isSaturated()) {\r\n //remove bottom of stack from mean\r\n var bottomValue = this._samples[this._pos];\r\n delta = bottomValue - this.average;\r\n this.average -= delta / (this._sampleCount - 1);\r\n this._m2 -= delta * (bottomValue - this.average);\r\n }\r\n else {\r\n this._sampleCount++;\r\n }\r\n //add new value to mean\r\n delta = v - this.average;\r\n this.average += delta / (this._sampleCount);\r\n this._m2 += delta * (v - this.average);\r\n //set the new variance\r\n this.variance = this._m2 / (this._sampleCount - 1);\r\n this._samples[this._pos] = v;\r\n this._pos++;\r\n this._pos %= this._samples.length; //positive wrap around\r\n };\r\n /**\r\n * Returns previously added values or null if outside of history or outside the sliding window domain\r\n * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that\r\n * @return Value previously recorded with add() or null if outside of range\r\n */\r\n RollingAverage.prototype.history = function (i) {\r\n if ((i >= this._sampleCount) || (i >= this._samples.length)) {\r\n return 0;\r\n }\r\n var i0 = this._wrapPosition(this._pos - 1.0);\r\n return this._samples[this._wrapPosition(i0 - i)];\r\n };\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n * @return true if sample-set saturated\r\n */\r\n RollingAverage.prototype.isSaturated = function () {\r\n return this._sampleCount >= this._samples.length;\r\n };\r\n /**\r\n * Resets the rolling average (equivalent to 0 samples taken so far)\r\n */\r\n RollingAverage.prototype.reset = function () {\r\n this.average = 0;\r\n this.variance = 0;\r\n this._sampleCount = 0;\r\n this._pos = 0;\r\n this._m2 = 0;\r\n };\r\n /**\r\n * Wraps a value around the sample range boundaries\r\n * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.\r\n * @return Wrapped position in sample range\r\n */\r\n RollingAverage.prototype._wrapPosition = function (i) {\r\n var max = this._samples.length;\r\n return ((i % max) + max) % max;\r\n };\r\n return RollingAverage;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/pivotTools.ts\":\n/*!****************************!*\\\n !*** ./Misc/pivotTools.ts ***!\n \\****************************/\n/*! exports provided: PivotTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return PivotTools; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Class containing a set of static utilities functions for managing Pivots\r\n * @hidden\r\n */\r\nvar PivotTools = /** @class */ (function () {\r\n function PivotTools() {\r\n }\r\n /** @hidden */\r\n PivotTools._RemoveAndStorePivotPoint = function (mesh) {\r\n if (mesh && PivotTools._PivotCached === 0) {\r\n // Save old pivot and set pivot to 0,0,0\r\n mesh.getPivotPointToRef(PivotTools._OldPivotPoint);\r\n if (!PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0)) {\r\n mesh.setPivotMatrix(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].IdentityReadOnly);\r\n PivotTools._OldPivotPoint.subtractToRef(mesh.getPivotPoint(), PivotTools._PivotTranslation);\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.addInPlace(PivotTools._PivotTmpVector);\r\n }\r\n }\r\n PivotTools._PivotCached++;\r\n };\r\n /** @hidden */\r\n PivotTools._RestorePivotPoint = function (mesh) {\r\n if (mesh && !PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0) && PivotTools._PivotCached === 1) {\r\n mesh.setPivotPoint(PivotTools._OldPivotPoint);\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.subtractInPlace(PivotTools._PivotTmpVector);\r\n }\r\n this._PivotCached--;\r\n };\r\n // Stores the state of the pivot cache (_oldPivotPoint, _pivotTranslation)\r\n // store/remove pivot point should only be applied during their outermost calls\r\n PivotTools._PivotCached = 0;\r\n PivotTools._OldPivotPoint = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n PivotTools._PivotTranslation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n PivotTools._PivotTmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n return PivotTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/precisionDate.ts\":\n/*!*******************************!*\\\n !*** ./Misc/precisionDate.ts ***!\n \\*******************************/\n/*! exports provided: PrecisionDate */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return PrecisionDate; });\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n\r\n/**\r\n * Class containing a set of static utilities functions for precision date\r\n */\r\nvar PrecisionDate = /** @class */ (function () {\r\n function PrecisionDate() {\r\n }\r\n Object.defineProperty(PrecisionDate, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n if (_domManagement__WEBPACK_IMPORTED_MODULE_0__[\"DomManagement\"].IsWindowObjectExist() && window.performance && window.performance.now) {\r\n return window.performance.now();\r\n }\r\n return Date.now();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PrecisionDate;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/promise.ts\":\n/*!*************************!*\\\n !*** ./Misc/promise.ts ***!\n \\*************************/\n/*! exports provided: PromisePolyfill */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return PromisePolyfill; });\nvar PromiseStates;\r\n(function (PromiseStates) {\r\n PromiseStates[PromiseStates[\"Pending\"] = 0] = \"Pending\";\r\n PromiseStates[PromiseStates[\"Fulfilled\"] = 1] = \"Fulfilled\";\r\n PromiseStates[PromiseStates[\"Rejected\"] = 2] = \"Rejected\";\r\n})(PromiseStates || (PromiseStates = {}));\r\nvar FulFillmentAgregator = /** @class */ (function () {\r\n function FulFillmentAgregator() {\r\n this.count = 0;\r\n this.target = 0;\r\n this.results = [];\r\n }\r\n return FulFillmentAgregator;\r\n}());\r\nvar InternalPromise = /** @class */ (function () {\r\n function InternalPromise(resolver) {\r\n var _this = this;\r\n this._state = PromiseStates.Pending;\r\n this._children = new Array();\r\n this._rejectWasConsumed = false;\r\n if (!resolver) {\r\n return;\r\n }\r\n try {\r\n resolver(function (value) {\r\n _this._resolve(value);\r\n }, function (reason) {\r\n _this._reject(reason);\r\n });\r\n }\r\n catch (e) {\r\n this._reject(e);\r\n }\r\n }\r\n Object.defineProperty(InternalPromise.prototype, \"_result\", {\r\n get: function () {\r\n return this._resultValue;\r\n },\r\n set: function (value) {\r\n this._resultValue = value;\r\n if (this._parent && this._parent._result === undefined) {\r\n this._parent._result = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n InternalPromise.prototype.catch = function (onRejected) {\r\n return this.then(undefined, onRejected);\r\n };\r\n InternalPromise.prototype.then = function (onFulfilled, onRejected) {\r\n var _this = this;\r\n var newPromise = new InternalPromise();\r\n newPromise._onFulfilled = onFulfilled;\r\n newPromise._onRejected = onRejected;\r\n // Composition\r\n this._children.push(newPromise);\r\n newPromise._parent = this;\r\n if (this._state !== PromiseStates.Pending) {\r\n setTimeout(function () {\r\n if (_this._state === PromiseStates.Fulfilled || _this._rejectWasConsumed) {\r\n var returnedValue = newPromise._resolve(_this._result);\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n var returnedPromise = returnedValue;\r\n newPromise._children.push(returnedPromise);\r\n returnedPromise._parent = newPromise;\r\n newPromise = returnedPromise;\r\n }\r\n else {\r\n newPromise._result = returnedValue;\r\n }\r\n }\r\n }\r\n else {\r\n newPromise._reject(_this._reason);\r\n }\r\n });\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.prototype._moveChildren = function (children) {\r\n var _a;\r\n var _this = this;\r\n (_a = this._children).push.apply(_a, children.splice(0, children.length));\r\n this._children.forEach(function (child) {\r\n child._parent = _this;\r\n });\r\n if (this._state === PromiseStates.Fulfilled) {\r\n for (var _i = 0, _b = this._children; _i < _b.length; _i++) {\r\n var child = _b[_i];\r\n child._resolve(this._result);\r\n }\r\n }\r\n else if (this._state === PromiseStates.Rejected) {\r\n for (var _c = 0, _d = this._children; _c < _d.length; _c++) {\r\n var child = _d[_c];\r\n child._reject(this._reason);\r\n }\r\n }\r\n };\r\n InternalPromise.prototype._resolve = function (value) {\r\n try {\r\n this._state = PromiseStates.Fulfilled;\r\n var returnedValue = null;\r\n if (this._onFulfilled) {\r\n returnedValue = this._onFulfilled(value);\r\n }\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n // Transmit children\r\n var returnedPromise = returnedValue;\r\n returnedPromise._parent = this;\r\n returnedPromise._moveChildren(this._children);\r\n value = returnedPromise._result;\r\n }\r\n else {\r\n value = returnedValue;\r\n }\r\n }\r\n this._result = value;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._resolve(value);\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n }\r\n catch (e) {\r\n this._reject(e, true);\r\n }\r\n };\r\n InternalPromise.prototype._reject = function (reason, onLocalThrow) {\r\n if (onLocalThrow === void 0) { onLocalThrow = false; }\r\n this._state = PromiseStates.Rejected;\r\n this._reason = reason;\r\n if (this._onRejected && !onLocalThrow) {\r\n try {\r\n this._onRejected(reason);\r\n this._rejectWasConsumed = true;\r\n }\r\n catch (e) {\r\n reason = e;\r\n }\r\n }\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (this._rejectWasConsumed) {\r\n child._resolve(null);\r\n }\r\n else {\r\n child._reject(reason);\r\n }\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n };\r\n InternalPromise.resolve = function (value) {\r\n var newPromise = new InternalPromise();\r\n newPromise._resolve(value);\r\n return newPromise;\r\n };\r\n InternalPromise._RegisterForFulfillment = function (promise, agregator, index) {\r\n promise.then(function (value) {\r\n agregator.results[index] = value;\r\n agregator.count++;\r\n if (agregator.count === agregator.target) {\r\n agregator.rootPromise._resolve(agregator.results);\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (agregator.rootPromise._state !== PromiseStates.Rejected) {\r\n agregator.rootPromise._reject(reason);\r\n }\r\n });\r\n };\r\n InternalPromise.all = function (promises) {\r\n var newPromise = new InternalPromise();\r\n var agregator = new FulFillmentAgregator();\r\n agregator.target = promises.length;\r\n agregator.rootPromise = newPromise;\r\n if (promises.length) {\r\n for (var index = 0; index < promises.length; index++) {\r\n InternalPromise._RegisterForFulfillment(promises[index], agregator, index);\r\n }\r\n }\r\n else {\r\n newPromise._resolve([]);\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.race = function (promises) {\r\n var newPromise = new InternalPromise();\r\n if (promises.length) {\r\n for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {\r\n var promise = promises_1[_i];\r\n promise.then(function (value) {\r\n if (newPromise) {\r\n newPromise._resolve(value);\r\n newPromise = null;\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (newPromise) {\r\n newPromise._reject(reason);\r\n newPromise = null;\r\n }\r\n });\r\n }\r\n }\r\n return newPromise;\r\n };\r\n return InternalPromise;\r\n}());\r\n/**\r\n * Helper class that provides a small promise polyfill\r\n */\r\nvar PromisePolyfill = /** @class */ (function () {\r\n function PromisePolyfill() {\r\n }\r\n /**\r\n * Static function used to check if the polyfill is required\r\n * If this is the case then the function will inject the polyfill to window.Promise\r\n * @param force defines a boolean used to force the injection (mostly for testing purposes)\r\n */\r\n PromisePolyfill.Apply = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (force || typeof Promise === 'undefined') {\r\n var root = window;\r\n root.Promise = InternalPromise;\r\n }\r\n };\r\n return PromisePolyfill;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/retryStrategy.ts\":\n/*!*******************************!*\\\n !*** ./Misc/retryStrategy.ts ***!\n \\*******************************/\n/*! exports provided: RetryStrategy */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return RetryStrategy; });\n/**\r\n * Class used to define a retry strategy when error happens while loading assets\r\n */\r\nvar RetryStrategy = /** @class */ (function () {\r\n function RetryStrategy() {\r\n }\r\n /**\r\n * Function used to defines an exponential back off strategy\r\n * @param maxRetries defines the maximum number of retries (3 by default)\r\n * @param baseInterval defines the interval between retries\r\n * @returns the strategy function to use\r\n */\r\n RetryStrategy.ExponentialBackoff = function (maxRetries, baseInterval) {\r\n if (maxRetries === void 0) { maxRetries = 3; }\r\n if (baseInterval === void 0) { baseInterval = 500; }\r\n return function (url, request, retryIndex) {\r\n if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf(\"file:\") !== -1) {\r\n return -1;\r\n }\r\n return Math.pow(2, retryIndex) * baseInterval;\r\n };\r\n };\r\n return RetryStrategy;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/rgbdTextureTools.ts\":\n/*!**********************************!*\\\n !*** ./Misc/rgbdTextureTools.ts ***!\n \\**********************************/\n/*! exports provided: RGBDTextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return RGBDTextureTools; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_rgbdDecode_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/rgbdDecode.fragment */ \"./Shaders/rgbdDecode.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to host RGBD texture specific utilities\r\n */\r\nvar RGBDTextureTools = /** @class */ (function () {\r\n function RGBDTextureTools() {\r\n }\r\n /**\r\n * Expand the RGBD Texture from RGBD to Half Float if possible.\r\n * @param texture the texture to expand.\r\n */\r\n RGBDTextureTools.ExpandRGBDTexture = function (texture) {\r\n var internalTexture = texture._texture;\r\n if (!internalTexture || !texture.isRGBD) {\r\n return;\r\n }\r\n texture.onLoadObservable.addOnce(function () {\r\n // Gets everything ready.\r\n var engine = internalTexture.getEngine();\r\n var caps = engine.getCaps();\r\n var expandTexture = false;\r\n // If half float available we can uncompress the texture\r\n if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Do not use during decode.\r\n internalTexture.isReady = false;\r\n // Simply run through the decode PP.\r\n var rgbdPostProcess_1 = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"](\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE, engine, false, undefined, internalTexture.type, undefined, null, false);\r\n internalTexture._isRGBD = false;\r\n internalTexture.invertY = false;\r\n // Hold the output of the decoding.\r\n var expandedTexture_1 = engine.createRenderTargetTexture(internalTexture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n generateStencilBuffer: false,\r\n samplingMode: internalTexture.samplingMode,\r\n type: internalTexture.type,\r\n format: _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].TEXTUREFORMAT_RGBA\r\n });\r\n rgbdPostProcess_1.getEffect().executeWhenCompiled(function () {\r\n // PP Render Pass\r\n rgbdPostProcess_1.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", internalTexture);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess_1], expandedTexture_1, true);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n engine._releaseTexture(internalTexture);\r\n engine._releaseFramebufferObjects(expandedTexture_1);\r\n if (rgbdPostProcess_1) {\r\n rgbdPostProcess_1.dispose();\r\n }\r\n // Internal Swap\r\n expandedTexture_1._swapAndDie(internalTexture);\r\n // Ready to get rolling again.\r\n internalTexture.isReady = true;\r\n });\r\n }\r\n });\r\n };\r\n return RGBDTextureTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/sceneOptimizer.ts\":\n/*!********************************!*\\\n !*** ./Misc/sceneOptimizer.ts ***!\n \\********************************/\n/*! exports provided: SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return SceneOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return TextureOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return HardwareScalingOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return ShadowsOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return PostProcessesOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return LensFlaresOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return CustomOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return ParticlesOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return RenderTargetsOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return MergeMeshesOptimization; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return SceneOptimizerOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return SceneOptimizer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Defines the root class used to create scene optimization to use with SceneOptimizer\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar SceneOptimization = /** @class */ (function () {\r\n /**\r\n * Creates the SceneOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param desc defines the description associated with the optimization\r\n */\r\n function SceneOptimization(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n priority) {\r\n if (priority === void 0) { priority = 0; }\r\n this.priority = priority;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n SceneOptimization.prototype.getDescription = function () {\r\n return \"\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n SceneOptimization.prototype.apply = function (scene, optimizer) {\r\n return true;\r\n };\r\n return SceneOptimization;\r\n}());\r\n\r\n/**\r\n * Defines an optimization used to reduce the size of render target textures\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar TextureOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TextureOptimization, _super);\r\n /**\r\n * Creates the TextureOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumSize defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n * @param step defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n function TextureOptimization(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n priority, \r\n /**\r\n * Defines the maximum sized allowed for textures (1024 is the default value). If a texture is bigger, it will be scaled down using a factor defined by the step parameter\r\n */\r\n maximumSize, \r\n /**\r\n * Defines the factor (0.5 by default) used to scale down textures bigger than maximum sized allowed.\r\n */\r\n step) {\r\n if (priority === void 0) { priority = 0; }\r\n if (maximumSize === void 0) { maximumSize = 1024; }\r\n if (step === void 0) { step = 0.5; }\r\n var _this = _super.call(this, priority) || this;\r\n _this.priority = priority;\r\n _this.maximumSize = maximumSize;\r\n _this.step = step;\r\n return _this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n TextureOptimization.prototype.getDescription = function () {\r\n return \"Reducing render target texture size to \" + this.maximumSize;\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n TextureOptimization.prototype.apply = function (scene, optimizer) {\r\n var allDone = true;\r\n for (var index = 0; index < scene.textures.length; index++) {\r\n var texture = scene.textures[index];\r\n if (!texture.canRescale || texture.getContext) {\r\n continue;\r\n }\r\n var currentSize = texture.getSize();\r\n var maxDimension = Math.max(currentSize.width, currentSize.height);\r\n if (maxDimension > this.maximumSize) {\r\n texture.scale(this.step);\r\n allDone = false;\r\n }\r\n }\r\n return allDone;\r\n };\r\n return TextureOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to increase or decrease the rendering resolution\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar HardwareScalingOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HardwareScalingOptimization, _super);\r\n /**\r\n * Creates the HardwareScalingOptimization object\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @param maximumScale defines the maximum scale to use (2 by default)\r\n * @param step defines the step to use between two passes (0.5 by default)\r\n */\r\n function HardwareScalingOptimization(\r\n /**\r\n * Defines the priority of this optimization (0 by default which means first in the list)\r\n */\r\n priority, \r\n /**\r\n * Defines the maximum scale to use (2 by default)\r\n */\r\n maximumScale, \r\n /**\r\n * Defines the step to use between two passes (0.5 by default)\r\n */\r\n step) {\r\n if (priority === void 0) { priority = 0; }\r\n if (maximumScale === void 0) { maximumScale = 2; }\r\n if (step === void 0) { step = 0.25; }\r\n var _this = _super.call(this, priority) || this;\r\n _this.priority = priority;\r\n _this.maximumScale = maximumScale;\r\n _this.step = step;\r\n _this._currentScale = -1;\r\n _this._directionOffset = 1;\r\n return _this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n HardwareScalingOptimization.prototype.getDescription = function () {\r\n return \"Setting hardware scaling level to \" + this._currentScale;\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n HardwareScalingOptimization.prototype.apply = function (scene, optimizer) {\r\n if (this._currentScale === -1) {\r\n this._currentScale = scene.getEngine().getHardwareScalingLevel();\r\n if (this._currentScale > this.maximumScale) {\r\n this._directionOffset = -1;\r\n }\r\n }\r\n this._currentScale += this._directionOffset * this.step;\r\n scene.getEngine().setHardwareScalingLevel(this._currentScale);\r\n return this._directionOffset === 1 ? this._currentScale >= this.maximumScale : this._currentScale <= this.maximumScale;\r\n };\r\n return HardwareScalingOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to remove shadows\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar ShadowsOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ShadowsOptimization, _super);\r\n function ShadowsOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n ShadowsOptimization.prototype.getDescription = function () {\r\n return \"Turning shadows on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n ShadowsOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.shadowsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return ShadowsOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn post-processes off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar PostProcessesOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PostProcessesOptimization, _super);\r\n function PostProcessesOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n PostProcessesOptimization.prototype.getDescription = function () {\r\n return \"Turning post-processes on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n PostProcessesOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.postProcessesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return PostProcessesOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn lens flares off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar LensFlaresOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LensFlaresOptimization, _super);\r\n function LensFlaresOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n LensFlaresOptimization.prototype.getDescription = function () {\r\n return \"Turning lens flares on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n LensFlaresOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.lensFlaresEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return LensFlaresOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization based on user defined callback.\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar CustomOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CustomOptimization, _super);\r\n function CustomOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @returns description string\r\n */\r\n CustomOptimization.prototype.getDescription = function () {\r\n if (this.onGetDescription) {\r\n return this.onGetDescription();\r\n }\r\n return \"Running user defined callback\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n CustomOptimization.prototype.apply = function (scene, optimizer) {\r\n if (this.onApply) {\r\n return this.onApply(scene, optimizer);\r\n }\r\n return true;\r\n };\r\n return CustomOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn particles off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar ParticlesOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ParticlesOptimization, _super);\r\n function ParticlesOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n ParticlesOptimization.prototype.getDescription = function () {\r\n return \"Turning particles on/off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n ParticlesOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.particlesEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return ParticlesOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to turn render targets off\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar RenderTargetsOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RenderTargetsOptimization, _super);\r\n function RenderTargetsOptimization() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n RenderTargetsOptimization.prototype.getDescription = function () {\r\n return \"Turning render targets off\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @returns true if everything that can be done was applied\r\n */\r\n RenderTargetsOptimization.prototype.apply = function (scene, optimizer) {\r\n scene.renderTargetsEnabled = optimizer.isInImprovementMode;\r\n return true;\r\n };\r\n return RenderTargetsOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines an optimization used to merge meshes with compatible materials\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar MergeMeshesOptimization = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MergeMeshesOptimization, _super);\r\n function MergeMeshesOptimization() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._canBeMerged = function (abstractMesh) {\r\n if (!(abstractMesh instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"])) {\r\n return false;\r\n }\r\n var mesh = abstractMesh;\r\n if (mesh.isDisposed()) {\r\n return false;\r\n }\r\n if (!mesh.isVisible || !mesh.isEnabled()) {\r\n return false;\r\n }\r\n if (mesh.instances.length > 0) {\r\n return false;\r\n }\r\n if (mesh.skeleton || mesh.hasLODLevels) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(MergeMeshesOptimization, \"UpdateSelectionTree\", {\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n get: function () {\r\n return MergeMeshesOptimization._UpdateSelectionTree;\r\n },\r\n /**\r\n * Gets or sets a boolean which defines if optimization octree has to be updated\r\n */\r\n set: function (value) {\r\n MergeMeshesOptimization._UpdateSelectionTree = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string describing the action executed by the current optimization\r\n * @return description string\r\n */\r\n MergeMeshesOptimization.prototype.getDescription = function () {\r\n return \"Merging similar meshes together\";\r\n };\r\n /**\r\n * This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization\r\n * @param scene defines the current scene where to apply this optimization\r\n * @param optimizer defines the current optimizer\r\n * @param updateSelectionTree defines that the selection octree has to be updated (false by default)\r\n * @returns true if everything that can be done was applied\r\n */\r\n MergeMeshesOptimization.prototype.apply = function (scene, optimizer, updateSelectionTree) {\r\n var globalPool = scene.meshes.slice(0);\r\n var globalLength = globalPool.length;\r\n for (var index = 0; index < globalLength; index++) {\r\n var currentPool = new Array();\r\n var current = globalPool[index];\r\n // Checks\r\n if (!this._canBeMerged(current)) {\r\n continue;\r\n }\r\n currentPool.push(current);\r\n // Find compatible meshes\r\n for (var subIndex = index + 1; subIndex < globalLength; subIndex++) {\r\n var otherMesh = globalPool[subIndex];\r\n if (!this._canBeMerged(otherMesh)) {\r\n continue;\r\n }\r\n if (otherMesh.material !== current.material) {\r\n continue;\r\n }\r\n if (otherMesh.checkCollisions !== current.checkCollisions) {\r\n continue;\r\n }\r\n currentPool.push(otherMesh);\r\n globalLength--;\r\n globalPool.splice(subIndex, 1);\r\n subIndex--;\r\n }\r\n if (currentPool.length < 2) {\r\n continue;\r\n }\r\n // Merge meshes\r\n _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"].MergeMeshes(currentPool, undefined, true);\r\n }\r\n // Call the octree system optimization if it is defined.\r\n var sceneAsAny = scene;\r\n if (sceneAsAny.createOrUpdateSelectionOctree) {\r\n if (updateSelectionTree != undefined) {\r\n if (updateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n else if (MergeMeshesOptimization.UpdateSelectionTree) {\r\n sceneAsAny.createOrUpdateSelectionOctree();\r\n }\r\n }\r\n return true;\r\n };\r\n MergeMeshesOptimization._UpdateSelectionTree = false;\r\n return MergeMeshesOptimization;\r\n}(SceneOptimization));\r\n\r\n/**\r\n * Defines a list of options used by SceneOptimizer\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar SceneOptimizerOptions = /** @class */ (function () {\r\n /**\r\n * Creates a new list of options used by SceneOptimizer\r\n * @param targetFrameRate defines the target frame rate to reach (60 by default)\r\n * @param trackerDuration defines the interval between two checkes (2000ms by default)\r\n */\r\n function SceneOptimizerOptions(\r\n /**\r\n * Defines the target frame rate to reach (60 by default)\r\n */\r\n targetFrameRate, \r\n /**\r\n * Defines the interval between two checkes (2000ms by default)\r\n */\r\n trackerDuration) {\r\n if (targetFrameRate === void 0) { targetFrameRate = 60; }\r\n if (trackerDuration === void 0) { trackerDuration = 2000; }\r\n this.targetFrameRate = targetFrameRate;\r\n this.trackerDuration = trackerDuration;\r\n /**\r\n * Gets the list of optimizations to apply\r\n */\r\n this.optimizations = new Array();\r\n }\r\n /**\r\n * Add a new optimization\r\n * @param optimization defines the SceneOptimization to add to the list of active optimizations\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n SceneOptimizerOptions.prototype.addOptimization = function (optimization) {\r\n this.optimizations.push(optimization);\r\n return this;\r\n };\r\n /**\r\n * Add a new custom optimization\r\n * @param onApply defines the callback called to apply the custom optimization (true if everything that can be done was applied)\r\n * @param onGetDescription defines the callback called to get the description attached with the optimization.\r\n * @param priority defines the priority of this optimization (0 by default which means first in the list)\r\n * @returns the current SceneOptimizerOptions\r\n */\r\n SceneOptimizerOptions.prototype.addCustomOptimization = function (onApply, onGetDescription, priority) {\r\n if (priority === void 0) { priority = 0; }\r\n var optimization = new CustomOptimization(priority);\r\n optimization.onApply = onApply;\r\n optimization.onGetDescription = onGetDescription;\r\n this.optimizations.push(optimization);\r\n return this;\r\n };\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to reduce the visual impact on the scene\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n SceneOptimizerOptions.LowDegradationAllowed = function (targetFrameRate) {\r\n var result = new SceneOptimizerOptions(targetFrameRate);\r\n var priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 1024));\r\n return result;\r\n };\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a moderate impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n SceneOptimizerOptions.ModerateDegradationAllowed = function (targetFrameRate) {\r\n var result = new SceneOptimizerOptions(targetFrameRate);\r\n var priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 512));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 2));\r\n return result;\r\n };\r\n /**\r\n * Creates a list of pre-defined optimizations aimed to have a big impact on the scene visual\r\n * @param targetFrameRate defines the target frame rate (60 by default)\r\n * @returns a SceneOptimizerOptions object\r\n */\r\n SceneOptimizerOptions.HighDegradationAllowed = function (targetFrameRate) {\r\n var result = new SceneOptimizerOptions(targetFrameRate);\r\n var priority = 0;\r\n result.addOptimization(new MergeMeshesOptimization(priority));\r\n result.addOptimization(new ShadowsOptimization(priority));\r\n result.addOptimization(new LensFlaresOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new PostProcessesOptimization(priority));\r\n result.addOptimization(new ParticlesOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new TextureOptimization(priority, 256));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new RenderTargetsOptimization(priority));\r\n // Next priority\r\n priority++;\r\n result.addOptimization(new HardwareScalingOptimization(priority, 4));\r\n return result;\r\n };\r\n return SceneOptimizerOptions;\r\n}());\r\n\r\n/**\r\n * Class used to run optimizations in order to reach a target frame rate\r\n * @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer\r\n */\r\nvar SceneOptimizer = /** @class */ (function () {\r\n /**\r\n * Creates a new SceneOptimizer\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param autoGeneratePriorities defines if priorities must be generated and not read from SceneOptimization property (true by default)\r\n * @param improvementMode defines if the scene optimizer must run the maximum optimization while staying over a target frame instead of trying to reach the target framerate (false by default)\r\n */\r\n function SceneOptimizer(scene, options, autoGeneratePriorities, improvementMode) {\r\n var _this = this;\r\n if (autoGeneratePriorities === void 0) { autoGeneratePriorities = true; }\r\n if (improvementMode === void 0) { improvementMode = false; }\r\n this._isRunning = false;\r\n this._currentPriorityLevel = 0;\r\n this._targetFrameRate = 60;\r\n this._trackerDuration = 2000;\r\n this._currentFrameRate = 0;\r\n this._improvementMode = false;\r\n /**\r\n * Defines an observable called when the optimizer reaches the target frame rate\r\n */\r\n this.onSuccessObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Defines an observable called when the optimizer enables an optimization\r\n */\r\n this.onNewOptimizationAppliedObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Defines an observable called when the optimizer is not able to reach the target frame rate\r\n */\r\n this.onFailureObservable = new _observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n if (!options) {\r\n this._options = new SceneOptimizerOptions();\r\n }\r\n else {\r\n this._options = options;\r\n }\r\n if (this._options.targetFrameRate) {\r\n this._targetFrameRate = this._options.targetFrameRate;\r\n }\r\n if (this._options.trackerDuration) {\r\n this._trackerDuration = this._options.trackerDuration;\r\n }\r\n if (autoGeneratePriorities) {\r\n var priority = 0;\r\n for (var _i = 0, _a = this._options.optimizations; _i < _a.length; _i++) {\r\n var optim = _a[_i];\r\n optim.priority = priority++;\r\n }\r\n }\r\n this._improvementMode = improvementMode;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_1__[\"EngineStore\"].LastCreatedScene;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(function () {\r\n _this._sceneDisposeObserver = null;\r\n _this.dispose();\r\n });\r\n }\r\n Object.defineProperty(SceneOptimizer.prototype, \"isInImprovementMode\", {\r\n /**\r\n * Gets a boolean indicating if the optimizer is in improvement mode\r\n */\r\n get: function () {\r\n return this._improvementMode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"currentPriorityLevel\", {\r\n /**\r\n * Gets the current priority level (0 at start)\r\n */\r\n get: function () {\r\n return this._currentPriorityLevel;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"currentFrameRate\", {\r\n /**\r\n * Gets the current frame rate checked by the SceneOptimizer\r\n */\r\n get: function () {\r\n return this._currentFrameRate;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"targetFrameRate\", {\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n get: function () {\r\n return this._targetFrameRate;\r\n },\r\n /**\r\n * Gets or sets the current target frame rate (60 by default)\r\n */\r\n set: function (value) {\r\n this._targetFrameRate = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"trackerDuration\", {\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n get: function () {\r\n return this._trackerDuration;\r\n },\r\n /**\r\n * Gets or sets the current interval between two checks (every 2000ms by default)\r\n */\r\n set: function (value) {\r\n this._trackerDuration = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneOptimizer.prototype, \"optimizations\", {\r\n /**\r\n * Gets the list of active optimizations\r\n */\r\n get: function () {\r\n return this._options.optimizations;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stops the current optimizer\r\n */\r\n SceneOptimizer.prototype.stop = function () {\r\n this._isRunning = false;\r\n };\r\n /**\r\n * Reset the optimizer to initial step (current priority level = 0)\r\n */\r\n SceneOptimizer.prototype.reset = function () {\r\n this._currentPriorityLevel = 0;\r\n };\r\n /**\r\n * Start the optimizer. By default it will try to reach a specific framerate\r\n * but if the optimizer is set with improvementMode === true then it will run all optimiatiation while frame rate is above the target frame rate\r\n */\r\n SceneOptimizer.prototype.start = function () {\r\n var _this = this;\r\n if (this._isRunning) {\r\n return;\r\n }\r\n this._isRunning = true;\r\n // Let's wait for the scene to be ready before running our check\r\n this._scene.executeWhenReady(function () {\r\n setTimeout(function () {\r\n _this._checkCurrentState();\r\n }, _this._trackerDuration);\r\n });\r\n };\r\n SceneOptimizer.prototype._checkCurrentState = function () {\r\n var _this = this;\r\n if (!this._isRunning) {\r\n return;\r\n }\r\n var scene = this._scene;\r\n var options = this._options;\r\n this._currentFrameRate = Math.round(scene.getEngine().getFps());\r\n if (this._improvementMode && this._currentFrameRate <= this._targetFrameRate ||\r\n !this._improvementMode && this._currentFrameRate >= this._targetFrameRate) {\r\n this._isRunning = false;\r\n this.onSuccessObservable.notifyObservers(this);\r\n return;\r\n }\r\n // Apply current level of optimizations\r\n var allDone = true;\r\n var noOptimizationApplied = true;\r\n for (var index = 0; index < options.optimizations.length; index++) {\r\n var optimization = options.optimizations[index];\r\n if (optimization.priority === this._currentPriorityLevel) {\r\n noOptimizationApplied = false;\r\n allDone = allDone && optimization.apply(scene, this);\r\n this.onNewOptimizationAppliedObservable.notifyObservers(optimization);\r\n }\r\n }\r\n // If no optimization was applied, this is a failure :(\r\n if (noOptimizationApplied) {\r\n this._isRunning = false;\r\n this.onFailureObservable.notifyObservers(this);\r\n return;\r\n }\r\n // If all optimizations were done, move to next level\r\n if (allDone) {\r\n this._currentPriorityLevel++;\r\n }\r\n // Let's the system running for a specific amount of time before checking FPS\r\n scene.executeWhenReady(function () {\r\n setTimeout(function () {\r\n _this._checkCurrentState();\r\n }, _this._trackerDuration);\r\n });\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n SceneOptimizer.prototype.dispose = function () {\r\n this.stop();\r\n this.onSuccessObservable.clear();\r\n this.onFailureObservable.clear();\r\n this.onNewOptimizationAppliedObservable.clear();\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n };\r\n /**\r\n * Helper function to create a SceneOptimizer with one single line of code\r\n * @param scene defines the scene to work on\r\n * @param options defines the options to use with the SceneOptimizer\r\n * @param onSuccess defines a callback to call on success\r\n * @param onFailure defines a callback to call on failure\r\n * @returns the new SceneOptimizer object\r\n */\r\n SceneOptimizer.OptimizeAsync = function (scene, options, onSuccess, onFailure) {\r\n var optimizer = new SceneOptimizer(scene, options || SceneOptimizerOptions.ModerateDegradationAllowed(), false);\r\n if (onSuccess) {\r\n optimizer.onSuccessObservable.add(function () {\r\n onSuccess();\r\n });\r\n }\r\n if (onFailure) {\r\n optimizer.onFailureObservable.add(function () {\r\n onFailure();\r\n });\r\n }\r\n optimizer.start();\r\n return optimizer;\r\n };\r\n return SceneOptimizer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/sceneSerializer.ts\":\n/*!*********************************!*\\\n !*** ./Misc/sceneSerializer.ts ***!\n \\*********************************/\n/*! exports provided: SceneSerializer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return SceneSerializer; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/multiMaterial */ \"./Materials/multiMaterial.ts\");\n/* harmony import */ var _decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./decorators */ \"./Misc/decorators.ts\");\n\r\n\r\n\r\n\r\nvar serializedGeometries = [];\r\nvar serializeGeometry = function (geometry, serializationGeometries) {\r\n if (serializedGeometries[geometry.id]) {\r\n return;\r\n }\r\n if (geometry.doNotSerialize) {\r\n return;\r\n }\r\n serializationGeometries.vertexData.push(geometry.serializeVerticeData());\r\n serializedGeometries[geometry.id] = true;\r\n};\r\nvar serializeMesh = function (mesh, serializationScene) {\r\n var serializationObject = {};\r\n // Geometry\r\n var geometry = mesh._geometry;\r\n if (geometry) {\r\n if (!mesh.getScene().getGeometryByID(geometry.id)) {\r\n // Geometry was in the memory but not added to the scene, nevertheless it's better to serialize to be able to reload the mesh with its geometry\r\n serializeGeometry(geometry, serializationScene.geometries);\r\n }\r\n }\r\n // Custom\r\n if (mesh.serialize) {\r\n mesh.serialize(serializationObject);\r\n }\r\n return serializationObject;\r\n};\r\nvar finalizeSingleMesh = function (mesh, serializationObject) {\r\n //only works if the mesh is already loaded\r\n if (mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_LOADED || mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_NONE) {\r\n //serialize material\r\n if (mesh.material && !mesh.material.doNotSerialize) {\r\n if (mesh.material instanceof _Materials_multiMaterial__WEBPACK_IMPORTED_MODULE_2__[\"MultiMaterial\"]) {\r\n serializationObject.multiMaterials = serializationObject.multiMaterials || [];\r\n serializationObject.materials = serializationObject.materials || [];\r\n if (!serializationObject.multiMaterials.some(function (mat) { return (mat.id === mesh.material.id); })) {\r\n serializationObject.multiMaterials.push(mesh.material.serialize());\r\n var _loop_1 = function (submaterial) {\r\n if (submaterial) {\r\n if (!serializationObject.materials.some(function (mat) { return (mat.id === submaterial.id); })) {\r\n serializationObject.materials.push(submaterial.serialize());\r\n }\r\n }\r\n };\r\n for (var _i = 0, _a = mesh.material.subMaterials; _i < _a.length; _i++) {\r\n var submaterial = _a[_i];\r\n _loop_1(submaterial);\r\n }\r\n }\r\n }\r\n else {\r\n serializationObject.materials = serializationObject.materials || [];\r\n if (!serializationObject.materials.some(function (mat) { return (mat.id === mesh.material.id); })) {\r\n serializationObject.materials.push(mesh.material.serialize());\r\n }\r\n }\r\n }\r\n //serialize geometry\r\n var geometry = mesh._geometry;\r\n if (geometry) {\r\n if (!serializationObject.geometries) {\r\n serializationObject.geometries = {};\r\n serializationObject.geometries.boxes = [];\r\n serializationObject.geometries.spheres = [];\r\n serializationObject.geometries.cylinders = [];\r\n serializationObject.geometries.toruses = [];\r\n serializationObject.geometries.grounds = [];\r\n serializationObject.geometries.planes = [];\r\n serializationObject.geometries.torusKnots = [];\r\n serializationObject.geometries.vertexData = [];\r\n }\r\n serializeGeometry(geometry, serializationObject.geometries);\r\n }\r\n // Skeletons\r\n if (mesh.skeleton && !mesh.skeleton.doNotSerialize) {\r\n serializationObject.skeletons = serializationObject.skeletons || [];\r\n serializationObject.skeletons.push(mesh.skeleton.serialize());\r\n }\r\n //serialize the actual mesh\r\n serializationObject.meshes = serializationObject.meshes || [];\r\n serializationObject.meshes.push(serializeMesh(mesh, serializationObject));\r\n }\r\n};\r\n/**\r\n * Class used to serialize a scene into a string\r\n */\r\nvar SceneSerializer = /** @class */ (function () {\r\n function SceneSerializer() {\r\n }\r\n /**\r\n * Clear cache used by a previous serialization\r\n */\r\n SceneSerializer.ClearCache = function () {\r\n serializedGeometries = [];\r\n };\r\n /**\r\n * Serialize a scene into a JSON compatible object\r\n * @param scene defines the scene to serialize\r\n * @returns a JSON compatible object\r\n */\r\n SceneSerializer.Serialize = function (scene) {\r\n var serializationObject = {};\r\n SceneSerializer.ClearCache();\r\n // Scene\r\n serializationObject.useDelayedTextureLoading = scene.useDelayedTextureLoading;\r\n serializationObject.autoClear = scene.autoClear;\r\n serializationObject.clearColor = scene.clearColor.asArray();\r\n serializationObject.ambientColor = scene.ambientColor.asArray();\r\n serializationObject.gravity = scene.gravity.asArray();\r\n serializationObject.collisionsEnabled = scene.collisionsEnabled;\r\n // Fog\r\n if (scene.fogMode && scene.fogMode !== 0) {\r\n serializationObject.fogMode = scene.fogMode;\r\n serializationObject.fogColor = scene.fogColor.asArray();\r\n serializationObject.fogStart = scene.fogStart;\r\n serializationObject.fogEnd = scene.fogEnd;\r\n serializationObject.fogDensity = scene.fogDensity;\r\n }\r\n //Physics\r\n if (scene.isPhysicsEnabled()) {\r\n var physicEngine = scene.getPhysicsEngine();\r\n if (physicEngine) {\r\n serializationObject.physicsEnabled = true;\r\n serializationObject.physicsGravity = physicEngine.gravity.asArray();\r\n serializationObject.physicsEngine = physicEngine.getPhysicsPluginName();\r\n }\r\n }\r\n // Metadata\r\n if (scene.metadata) {\r\n serializationObject.metadata = scene.metadata;\r\n }\r\n // Morph targets\r\n serializationObject.morphTargetManagers = [];\r\n for (var _i = 0, _a = scene.meshes; _i < _a.length; _i++) {\r\n var abstractMesh = _a[_i];\r\n var manager = abstractMesh.morphTargetManager;\r\n if (manager) {\r\n serializationObject.morphTargetManagers.push(manager.serialize());\r\n }\r\n }\r\n // Lights\r\n serializationObject.lights = [];\r\n var index;\r\n var light;\r\n for (index = 0; index < scene.lights.length; index++) {\r\n light = scene.lights[index];\r\n if (!light.doNotSerialize) {\r\n serializationObject.lights.push(light.serialize());\r\n }\r\n }\r\n // Cameras\r\n serializationObject.cameras = [];\r\n for (index = 0; index < scene.cameras.length; index++) {\r\n var camera = scene.cameras[index];\r\n if (!camera.doNotSerialize) {\r\n serializationObject.cameras.push(camera.serialize());\r\n }\r\n }\r\n if (scene.activeCamera) {\r\n serializationObject.activeCameraID = scene.activeCamera.id;\r\n }\r\n // Animations\r\n _decorators__WEBPACK_IMPORTED_MODULE_3__[\"SerializationHelper\"].AppendSerializedAnimations(scene, serializationObject);\r\n // Animation Groups\r\n if (scene.animationGroups && scene.animationGroups.length > 0) {\r\n serializationObject.animationGroups = [];\r\n for (var animationGroupIndex = 0; animationGroupIndex < scene.animationGroups.length; animationGroupIndex++) {\r\n var animationGroup = scene.animationGroups[animationGroupIndex];\r\n serializationObject.animationGroups.push(animationGroup.serialize());\r\n }\r\n }\r\n // Reflection probes\r\n if (scene.reflectionProbes && scene.reflectionProbes.length > 0) {\r\n serializationObject.reflectionProbes = [];\r\n for (index = 0; index < scene.reflectionProbes.length; index++) {\r\n var reflectionProbe = scene.reflectionProbes[index];\r\n serializationObject.reflectionProbes.push(reflectionProbe.serialize());\r\n }\r\n }\r\n // Materials\r\n serializationObject.materials = [];\r\n serializationObject.multiMaterials = [];\r\n var material;\r\n for (index = 0; index < scene.materials.length; index++) {\r\n material = scene.materials[index];\r\n if (!material.doNotSerialize) {\r\n serializationObject.materials.push(material.serialize());\r\n }\r\n }\r\n // MultiMaterials\r\n serializationObject.multiMaterials = [];\r\n for (index = 0; index < scene.multiMaterials.length; index++) {\r\n var multiMaterial = scene.multiMaterials[index];\r\n serializationObject.multiMaterials.push(multiMaterial.serialize());\r\n }\r\n // Environment texture\r\n if (scene.environmentTexture) {\r\n serializationObject.environmentTexture = scene.environmentTexture.name;\r\n }\r\n // Environment Intensity\r\n serializationObject.environmentIntensity = scene.environmentIntensity;\r\n // Skeletons\r\n serializationObject.skeletons = [];\r\n for (index = 0; index < scene.skeletons.length; index++) {\r\n var skeleton = scene.skeletons[index];\r\n if (!skeleton.doNotSerialize) {\r\n serializationObject.skeletons.push(skeleton.serialize());\r\n }\r\n }\r\n // Transform nodes\r\n serializationObject.transformNodes = [];\r\n for (index = 0; index < scene.transformNodes.length; index++) {\r\n serializationObject.transformNodes.push(scene.transformNodes[index].serialize());\r\n }\r\n // Geometries\r\n serializationObject.geometries = {};\r\n serializationObject.geometries.boxes = [];\r\n serializationObject.geometries.spheres = [];\r\n serializationObject.geometries.cylinders = [];\r\n serializationObject.geometries.toruses = [];\r\n serializationObject.geometries.grounds = [];\r\n serializationObject.geometries.planes = [];\r\n serializationObject.geometries.torusKnots = [];\r\n serializationObject.geometries.vertexData = [];\r\n serializedGeometries = [];\r\n var geometries = scene.getGeometries();\r\n for (index = 0; index < geometries.length; index++) {\r\n var geometry = geometries[index];\r\n if (geometry.isReady()) {\r\n serializeGeometry(geometry, serializationObject.geometries);\r\n }\r\n }\r\n // Meshes\r\n serializationObject.meshes = [];\r\n for (index = 0; index < scene.meshes.length; index++) {\r\n var abstractMesh = scene.meshes[index];\r\n if (abstractMesh instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"]) {\r\n var mesh = abstractMesh;\r\n if (!mesh.doNotSerialize) {\r\n if (mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_LOADED || mesh.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].DELAYLOADSTATE_NONE) {\r\n serializationObject.meshes.push(serializeMesh(mesh, serializationObject));\r\n }\r\n }\r\n }\r\n }\r\n // Particles Systems\r\n serializationObject.particleSystems = [];\r\n for (index = 0; index < scene.particleSystems.length; index++) {\r\n serializationObject.particleSystems.push(scene.particleSystems[index].serialize());\r\n }\r\n // Action Manager\r\n if (scene.actionManager) {\r\n serializationObject.actions = scene.actionManager.serialize(\"scene\");\r\n }\r\n // Components\r\n for (var _b = 0, _c = scene._serializableComponents; _b < _c.length; _b++) {\r\n var component = _c[_b];\r\n component.serialize(serializationObject);\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Serialize a mesh into a JSON compatible object\r\n * @param toSerialize defines the mesh to serialize\r\n * @param withParents defines if parents must be serialized as well\r\n * @param withChildren defines if children must be serialized as well\r\n * @returns a JSON compatible object\r\n */\r\n SceneSerializer.SerializeMesh = function (toSerialize /* Mesh || Mesh[] */, withParents, withChildren) {\r\n if (withParents === void 0) { withParents = false; }\r\n if (withChildren === void 0) { withChildren = false; }\r\n var serializationObject = {};\r\n SceneSerializer.ClearCache();\r\n toSerialize = (toSerialize instanceof Array) ? toSerialize : [toSerialize];\r\n if (withParents || withChildren) {\r\n //deliberate for loop! not for each, appended should be processed as well.\r\n for (var i = 0; i < toSerialize.length; ++i) {\r\n if (withChildren) {\r\n toSerialize[i].getDescendants().forEach(function (node) {\r\n if (node instanceof _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"] && (toSerialize.indexOf(node) < 0) && !node.doNotSerialize) {\r\n toSerialize.push(node);\r\n }\r\n });\r\n }\r\n //make sure the array doesn't contain the object already\r\n if (withParents && toSerialize[i].parent && (toSerialize.indexOf(toSerialize[i].parent) < 0) && !toSerialize[i].parent.doNotSerialize) {\r\n toSerialize.push(toSerialize[i].parent);\r\n }\r\n }\r\n }\r\n toSerialize.forEach(function (mesh) {\r\n finalizeSingleMesh(mesh, serializationObject);\r\n });\r\n return serializationObject;\r\n };\r\n return SceneSerializer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/screenshotTools.ts\":\n/*!*********************************!*\\\n !*** ./Misc/screenshotTools.ts ***!\n \\*********************************/\n/*! exports provided: ScreenshotTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return ScreenshotTools; });\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../PostProcesses/fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nvar ScreenshotTools = /** @class */ (function () {\r\n function ScreenshotTools() {\r\n }\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n ScreenshotTools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n if (!(height && width)) {\r\n _logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n if (!_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas) {\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas = document.createElement('canvas');\r\n }\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas.width = width;\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas.height = height;\r\n var renderContext = _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"]._ScreenshotCanvas.getContext(\"2d\");\r\n var ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n var newWidth = width;\r\n var newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n var offsetX = Math.max(0, width - newWidth) / 2;\r\n var offsetY = Math.max(0, height - newHeight) / 2;\r\n var renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].EncodeScreenshotCanvasData(successCallback, mimeType);\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshot(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType);\r\n });\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n var targetTextureSize = { width: width, height: height };\r\n if (!(height && width)) {\r\n _logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n var scene = camera.getScene();\r\n var previousCamera = null;\r\n if (scene.activeCamera !== camera) {\r\n previousCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n var renderCanvas = engine.getRenderingCanvas();\r\n if (!renderCanvas) {\r\n _logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Error(\"No rendering canvas found !\");\r\n return;\r\n }\r\n var originalSize = { width: renderCanvas.width, height: renderCanvas.height };\r\n engine.setSize(width, height);\r\n scene.render();\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n var texture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetTexture\"](\"screenShot\", targetTextureSize, scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n texture.renderList = null;\r\n texture.samples = samples;\r\n if (antialiasing) {\r\n texture.addPostProcess(new _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"FxaaPostProcess\"]('antialiasing', 1.0, scene.activeCamera));\r\n }\r\n texture.onAfterRenderObservable.add(function () {\r\n _tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].DumpFramebuffer(width, height, engine, successCallback, mimeType, fileName);\r\n });\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n texture.dispose();\r\n if (previousCamera) {\r\n scene.activeCamera = previousCamera;\r\n }\r\n engine.setSize(originalSize.width, originalSize.height);\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType, samples, antialiasing, fileName);\r\n });\r\n };\r\n /**\r\n * Gets height and width for screenshot size\r\n * @private\r\n */\r\n ScreenshotTools._getScreenshotSize = function (engine, camera, size) {\r\n var height = 0;\r\n var width = 0;\r\n //If a size value defined as object\r\n if (typeof (size) === 'object') {\r\n var precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n }\r\n else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n }\r\n return { height: height, width: width };\r\n };\r\n return ScreenshotTools;\r\n}());\r\n\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshot = ScreenshotTools.CreateScreenshot;\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshotAsync = ScreenshotTools.CreateScreenshotAsync;\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshotUsingRenderTarget = ScreenshotTools.CreateScreenshotUsingRenderTarget;\r\n_tools__WEBPACK_IMPORTED_MODULE_5__[\"Tools\"].CreateScreenshotUsingRenderTargetAsync = ScreenshotTools.CreateScreenshotUsingRenderTargetAsync;\r\n\n\n/***/ }),\n\n/***/ \"./Misc/smartArray.ts\":\n/*!****************************!*\\\n !*** ./Misc/smartArray.ts ***!\n \\****************************/\n/*! exports provided: SmartArray, SmartArrayNoDuplicate */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return SmartArray; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return SmartArrayNoDuplicate; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n */\r\nvar SmartArray = /** @class */ (function () {\r\n /**\r\n * Instantiates a Smart Array.\r\n * @param capacity defines the default capacity of the array.\r\n */\r\n function SmartArray(capacity) {\r\n /**\r\n * The active length of the array.\r\n */\r\n this.length = 0;\r\n this.data = new Array(capacity);\r\n this._id = SmartArray._GlobalId++;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArray.prototype.push = function (value) {\r\n this.data[this.length++] = value;\r\n if (this.length > this.data.length) {\r\n this.data.length *= 2;\r\n }\r\n };\r\n /**\r\n * Iterates over the active data and apply the lambda to them.\r\n * @param func defines the action to apply on each value.\r\n */\r\n SmartArray.prototype.forEach = function (func) {\r\n for (var index = 0; index < this.length; index++) {\r\n func(this.data[index]);\r\n }\r\n };\r\n /**\r\n * Sorts the full sets of data.\r\n * @param compareFn defines the comparison function to apply.\r\n */\r\n SmartArray.prototype.sort = function (compareFn) {\r\n this.data.sort(compareFn);\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArray.prototype.reset = function () {\r\n this.length = 0;\r\n };\r\n /**\r\n * Releases all the data from the array as well as the array.\r\n */\r\n SmartArray.prototype.dispose = function () {\r\n this.reset();\r\n if (this.data) {\r\n this.data.length = 0;\r\n this.data = [];\r\n }\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArray.prototype.concat = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n this.data[this.length++] = (array.data || array)[index];\r\n }\r\n };\r\n /**\r\n * Returns the position of a value in the active data.\r\n * @param value defines the value to find the index for\r\n * @returns the index if found in the active data otherwise -1\r\n */\r\n SmartArray.prototype.indexOf = function (value) {\r\n var position = this.data.indexOf(value);\r\n if (position >= this.length) {\r\n return -1;\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns whether an element is part of the active data.\r\n * @param value defines the value to look for\r\n * @returns true if found in the active data otherwise false\r\n */\r\n SmartArray.prototype.contains = function (value) {\r\n return this.indexOf(value) !== -1;\r\n };\r\n // Statics\r\n SmartArray._GlobalId = 0;\r\n return SmartArray;\r\n}());\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n * The data in this array can only be present once\r\n */\r\nvar SmartArrayNoDuplicate = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SmartArrayNoDuplicate, _super);\r\n function SmartArrayNoDuplicate() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._duplicateId = 0;\r\n return _this;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * THIS DOES NOT PREVENT DUPPLICATE DATA\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArrayNoDuplicate.prototype.push = function (value) {\r\n _super.prototype.push.call(this, value);\r\n if (!value.__smartArrayFlags) {\r\n value.__smartArrayFlags = {};\r\n }\r\n value.__smartArrayFlags[this._id] = this._duplicateId;\r\n };\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * If the data is already present, it won t be added again\r\n * @param value defines the object to push in the array.\r\n * @returns true if added false if it was already present\r\n */\r\n SmartArrayNoDuplicate.prototype.pushNoDuplicate = function (value) {\r\n if (value.__smartArrayFlags && value.__smartArrayFlags[this._id] === this._duplicateId) {\r\n return false;\r\n }\r\n this.push(value);\r\n return true;\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArrayNoDuplicate.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this._duplicateId++;\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * This ensures no dupplicate will be present in the result.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArrayNoDuplicate.prototype.concatWithNoDuplicate = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n var item = (array.data || array)[index];\r\n this.pushNoDuplicate(item);\r\n }\r\n };\r\n return SmartArrayNoDuplicate;\r\n}(SmartArray));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/stringDictionary.ts\":\n/*!**********************************!*\\\n !*** ./Misc/stringDictionary.ts ***!\n \\**********************************/\n/*! exports provided: StringDictionary */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return StringDictionary; });\n/**\r\n * This class implement a typical dictionary using a string as key and the generic type T as value.\r\n * The underlying implementation relies on an associative array to ensure the best performances.\r\n * The value can be anything including 'null' but except 'undefined'\r\n */\r\nvar StringDictionary = /** @class */ (function () {\r\n function StringDictionary() {\r\n this._count = 0;\r\n this._data = {};\r\n }\r\n /**\r\n * This will clear this dictionary and copy the content from the 'source' one.\r\n * If the T value is a custom object, it won't be copied/cloned, the same object will be used\r\n * @param source the dictionary to take the content from and copy to this dictionary\r\n */\r\n StringDictionary.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n this.clear();\r\n source.forEach(function (t, v) { return _this.add(t, v); });\r\n };\r\n /**\r\n * Get a value based from its key\r\n * @param key the given key to get the matching value from\r\n * @return the value if found, otherwise undefined is returned\r\n */\r\n StringDictionary.prototype.get = function (key) {\r\n var val = this._data[key];\r\n if (val !== undefined) {\r\n return val;\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Get a value from its key or add it if it doesn't exist.\r\n * This method will ensure you that a given key/data will be present in the dictionary.\r\n * @param key the given key to get the matching value from\r\n * @param factory the factory that will create the value if the key is not present in the dictionary.\r\n * The factory will only be invoked if there's no data for the given key.\r\n * @return the value corresponding to the key.\r\n */\r\n StringDictionary.prototype.getOrAddWithFactory = function (key, factory) {\r\n var val = this.get(key);\r\n if (val !== undefined) {\r\n return val;\r\n }\r\n val = factory(key);\r\n if (val) {\r\n this.add(key, val);\r\n }\r\n return val;\r\n };\r\n /**\r\n * Get a value from its key if present in the dictionary otherwise add it\r\n * @param key the key to get the value from\r\n * @param val if there's no such key/value pair in the dictionary add it with this value\r\n * @return the value corresponding to the key\r\n */\r\n StringDictionary.prototype.getOrAdd = function (key, val) {\r\n var curVal = this.get(key);\r\n if (curVal !== undefined) {\r\n return curVal;\r\n }\r\n this.add(key, val);\r\n return val;\r\n };\r\n /**\r\n * Check if there's a given key in the dictionary\r\n * @param key the key to check for\r\n * @return true if the key is present, false otherwise\r\n */\r\n StringDictionary.prototype.contains = function (key) {\r\n return this._data[key] !== undefined;\r\n };\r\n /**\r\n * Add a new key and its corresponding value\r\n * @param key the key to add\r\n * @param value the value corresponding to the key\r\n * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary\r\n */\r\n StringDictionary.prototype.add = function (key, value) {\r\n if (this._data[key] !== undefined) {\r\n return false;\r\n }\r\n this._data[key] = value;\r\n ++this._count;\r\n return true;\r\n };\r\n /**\r\n * Update a specific value associated to a key\r\n * @param key defines the key to use\r\n * @param value defines the value to store\r\n * @returns true if the value was updated (or false if the key was not found)\r\n */\r\n StringDictionary.prototype.set = function (key, value) {\r\n if (this._data[key] === undefined) {\r\n return false;\r\n }\r\n this._data[key] = value;\r\n return true;\r\n };\r\n /**\r\n * Get the element of the given key and remove it from the dictionary\r\n * @param key defines the key to search\r\n * @returns the value associated with the key or null if not found\r\n */\r\n StringDictionary.prototype.getAndRemove = function (key) {\r\n var val = this.get(key);\r\n if (val !== undefined) {\r\n delete this._data[key];\r\n --this._count;\r\n return val;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Remove a key/value from the dictionary.\r\n * @param key the key to remove\r\n * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary\r\n */\r\n StringDictionary.prototype.remove = function (key) {\r\n if (this.contains(key)) {\r\n delete this._data[key];\r\n --this._count;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Clear the whole content of the dictionary\r\n */\r\n StringDictionary.prototype.clear = function () {\r\n this._data = {};\r\n this._count = 0;\r\n };\r\n Object.defineProperty(StringDictionary.prototype, \"count\", {\r\n /**\r\n * Gets the current count\r\n */\r\n get: function () {\r\n return this._count;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Execute a callback on each key/val of the dictionary.\r\n * Note that you can remove any element in this dictionary in the callback implementation\r\n * @param callback the callback to execute on a given key/value pair\r\n */\r\n StringDictionary.prototype.forEach = function (callback) {\r\n for (var cur in this._data) {\r\n var val = this._data[cur];\r\n callback(cur, val);\r\n }\r\n };\r\n /**\r\n * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.\r\n * If the callback returns null or undefined the method will iterate to the next key/value pair\r\n * Note that you can remove any element in this dictionary in the callback implementation\r\n * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned\r\n * @returns the first item\r\n */\r\n StringDictionary.prototype.first = function (callback) {\r\n for (var cur in this._data) {\r\n var val = this._data[cur];\r\n var res = callback(cur, val);\r\n if (res) {\r\n return res;\r\n }\r\n }\r\n return null;\r\n };\r\n return StringDictionary;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/stringTools.ts\":\n/*!*****************************!*\\\n !*** ./Misc/stringTools.ts ***!\n \\*****************************/\n/*! exports provided: StringTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StringTools\", function() { return StringTools; });\n/**\r\n * Helper to manipulate strings\r\n */\r\nvar StringTools = /** @class */ (function () {\r\n function StringTools() {\r\n }\r\n /**\r\n * Checks for a matching suffix at the end of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.EndsWith = function (str, suffix) {\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n };\r\n /**\r\n * Checks for a matching suffix at the beginning of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.StartsWith = function (str, suffix) {\r\n return str.indexOf(suffix) === 0;\r\n };\r\n return StringTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/tags.ts\":\n/*!**********************!*\\\n !*** ./Misc/tags.ts ***!\n \\**********************/\n/*! exports provided: Tags */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return Tags; });\n/* harmony import */ var _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./andOrNotEvaluator */ \"./Misc/andOrNotEvaluator.ts\");\n\r\n/**\r\n * Class used to store custom tags\r\n */\r\nvar Tags = /** @class */ (function () {\r\n function Tags() {\r\n }\r\n /**\r\n * Adds support for tags on the given object\r\n * @param obj defines the object to use\r\n */\r\n Tags.EnableFor = function (obj) {\r\n obj._tags = obj._tags || {};\r\n obj.hasTags = function () {\r\n return Tags.HasTags(obj);\r\n };\r\n obj.addTags = function (tagsString) {\r\n return Tags.AddTagsTo(obj, tagsString);\r\n };\r\n obj.removeTags = function (tagsString) {\r\n return Tags.RemoveTagsFrom(obj, tagsString);\r\n };\r\n obj.matchesTagsQuery = function (tagsQuery) {\r\n return Tags.MatchesQuery(obj, tagsQuery);\r\n };\r\n };\r\n /**\r\n * Removes tags support\r\n * @param obj defines the object to use\r\n */\r\n Tags.DisableFor = function (obj) {\r\n delete obj._tags;\r\n delete obj.hasTags;\r\n delete obj.addTags;\r\n delete obj.removeTags;\r\n delete obj.matchesTagsQuery;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has tags\r\n * @param obj defines the object to use\r\n * @returns a boolean\r\n */\r\n Tags.HasTags = function (obj) {\r\n if (!obj._tags) {\r\n return false;\r\n }\r\n var tags = obj._tags;\r\n for (var i in tags) {\r\n if (tags.hasOwnProperty(i)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the tags available on a given object\r\n * @param obj defines the object to use\r\n * @param asString defines if the tags must be returned as a string instead of an array of strings\r\n * @returns the tags\r\n */\r\n Tags.GetTags = function (obj, asString) {\r\n if (asString === void 0) { asString = true; }\r\n if (!obj._tags) {\r\n return null;\r\n }\r\n if (asString) {\r\n var tagsArray = [];\r\n for (var tag in obj._tags) {\r\n if (obj._tags.hasOwnProperty(tag) && obj._tags[tag] === true) {\r\n tagsArray.push(tag);\r\n }\r\n }\r\n return tagsArray.join(\" \");\r\n }\r\n else {\r\n return obj._tags;\r\n }\r\n };\r\n /**\r\n * Adds tags to an object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tag string. The tags 'true' and 'false' are reserved and cannot be used as tags.\r\n * A tag cannot start with '||', '&&', and '!'. It cannot contain whitespaces\r\n */\r\n Tags.AddTagsTo = function (obj, tagsString) {\r\n if (!tagsString) {\r\n return;\r\n }\r\n if (typeof tagsString !== \"string\") {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n tags.forEach(function (tag, index, array) {\r\n Tags._AddTagTo(obj, tag);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._AddTagTo = function (obj, tag) {\r\n tag = tag.trim();\r\n if (tag === \"\" || tag === \"true\" || tag === \"false\") {\r\n return;\r\n }\r\n if (tag.match(/[\\s]/) || tag.match(/^([!]|([|]|[&]){2})/)) {\r\n return;\r\n }\r\n Tags.EnableFor(obj);\r\n obj._tags[tag] = true;\r\n };\r\n /**\r\n * Removes specific tags from a specific object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tags to remove\r\n */\r\n Tags.RemoveTagsFrom = function (obj, tagsString) {\r\n if (!Tags.HasTags(obj)) {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n for (var t in tags) {\r\n Tags._RemoveTagFrom(obj, tags[t]);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._RemoveTagFrom = function (obj, tag) {\r\n delete obj._tags[tag];\r\n };\r\n /**\r\n * Defines if tags hosted on an object match a given query\r\n * @param obj defines the object to use\r\n * @param tagsQuery defines the tag query\r\n * @returns a boolean\r\n */\r\n Tags.MatchesQuery = function (obj, tagsQuery) {\r\n if (tagsQuery === undefined) {\r\n return true;\r\n }\r\n if (tagsQuery === \"\") {\r\n return Tags.HasTags(obj);\r\n }\r\n return _andOrNotEvaluator__WEBPACK_IMPORTED_MODULE_0__[\"AndOrNotEvaluator\"].Eval(tagsQuery, function (r) { return Tags.HasTags(obj) && obj._tags[r]; });\r\n };\r\n return Tags;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/textureTools.ts\":\n/*!******************************!*\\\n !*** ./Misc/textureTools.ts ***!\n \\******************************/\n/*! exports provided: TextureTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return TextureTools; });\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Class used to host texture specific utilities\r\n */\r\nvar TextureTools = /** @class */ (function () {\r\n function TextureTools() {\r\n }\r\n /**\r\n * Uses the GPU to create a copy texture rescaled at a given size\r\n * @param texture Texture to copy from\r\n * @param width defines the desired width\r\n * @param height defines the desired height\r\n * @param useBilinearMode defines if bilinear mode has to be used\r\n * @return the generated texture\r\n */\r\n TextureTools.CreateResizedCopy = function (texture, width, height, useBilinearMode) {\r\n if (useBilinearMode === void 0) { useBilinearMode = true; }\r\n var scene = texture.getScene();\r\n var engine = scene.getEngine();\r\n var rtt = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_1__[\"RenderTargetTexture\"]('resized' + texture.name, { width: width, height: height }, scene, !texture.noMipmap, true, texture._texture.type, false, texture.samplingMode, false);\r\n rtt.wrapU = texture.wrapU;\r\n rtt.wrapV = texture.wrapV;\r\n rtt.uOffset = texture.uOffset;\r\n rtt.vOffset = texture.vOffset;\r\n rtt.uScale = texture.uScale;\r\n rtt.vScale = texture.vScale;\r\n rtt.uAng = texture.uAng;\r\n rtt.vAng = texture.vAng;\r\n rtt.wAng = texture.wAng;\r\n rtt.coordinatesIndex = texture.coordinatesIndex;\r\n rtt.level = texture.level;\r\n rtt.anisotropicFilteringLevel = texture.anisotropicFilteringLevel;\r\n rtt._texture.isReady = false;\r\n texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n var passPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"PassPostProcess\"](\"pass\", 1, null, useBilinearMode ? _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].BILINEAR_SAMPLINGMODE : _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_0__[\"Texture\"].NEAREST_SAMPLINGMODE, engine, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n passPostProcess.getEffect().executeWhenCompiled(function () {\r\n passPostProcess.onApply = function (effect) {\r\n effect.setTexture(\"textureSampler\", texture);\r\n };\r\n var internalTexture = rtt.getInternalTexture();\r\n if (internalTexture) {\r\n scene.postProcessManager.directRender([passPostProcess], internalTexture);\r\n engine.unBindFramebuffer(internalTexture);\r\n rtt.disposeFramebufferObjects();\r\n passPostProcess.dispose();\r\n internalTexture.isReady = true;\r\n }\r\n });\r\n return rtt;\r\n };\r\n return TextureTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/tga.ts\":\n/*!*********************!*\\\n !*** ./Misc/tga.ts ***!\n \\*********************/\n/*! exports provided: TGATools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return TGATools; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n\r\n/**\r\n * Based on jsTGALoader - Javascript loader for TGA file\r\n * By Vincent Thibault\r\n * @see http://blog.robrowser.com/javascript-tga-loader.html\r\n */\r\nvar TGATools = /** @class */ (function () {\r\n function TGATools() {\r\n }\r\n /**\r\n * Gets the header of a TGA file\r\n * @param data defines the TGA data\r\n * @returns the header\r\n */\r\n TGATools.GetTGAHeader = function (data) {\r\n var offset = 0;\r\n var header = {\r\n id_length: data[offset++],\r\n colormap_type: data[offset++],\r\n image_type: data[offset++],\r\n colormap_index: data[offset++] | data[offset++] << 8,\r\n colormap_length: data[offset++] | data[offset++] << 8,\r\n colormap_size: data[offset++],\r\n origin: [\r\n data[offset++] | data[offset++] << 8,\r\n data[offset++] | data[offset++] << 8\r\n ],\r\n width: data[offset++] | data[offset++] << 8,\r\n height: data[offset++] | data[offset++] << 8,\r\n pixel_size: data[offset++],\r\n flags: data[offset++]\r\n };\r\n return header;\r\n };\r\n /**\r\n * Uploads TGA content to a Babylon Texture\r\n * @hidden\r\n */\r\n TGATools.UploadContent = function (texture, data) {\r\n // Not enough data to contain header ?\r\n if (data.length < 19) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Unable to load TGA file - Not enough data to contain header\");\r\n return;\r\n }\r\n // Read Header\r\n var offset = 18;\r\n var header = TGATools.GetTGAHeader(data);\r\n // Assume it's a valid Targa file.\r\n if (header.id_length + offset > data.length) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Unable to load TGA file - Not enough data\");\r\n return;\r\n }\r\n // Skip not needed data\r\n offset += header.id_length;\r\n var use_rle = false;\r\n var use_pal = false;\r\n var use_grey = false;\r\n // Get some informations.\r\n switch (header.image_type) {\r\n case TGATools._TYPE_RLE_INDEXED:\r\n use_rle = true;\r\n case TGATools._TYPE_INDEXED:\r\n use_pal = true;\r\n break;\r\n case TGATools._TYPE_RLE_RGB:\r\n use_rle = true;\r\n case TGATools._TYPE_RGB:\r\n // use_rgb = true;\r\n break;\r\n case TGATools._TYPE_RLE_GREY:\r\n use_rle = true;\r\n case TGATools._TYPE_GREY:\r\n use_grey = true;\r\n break;\r\n }\r\n var pixel_data;\r\n // var numAlphaBits = header.flags & 0xf;\r\n var pixel_size = header.pixel_size >> 3;\r\n var pixel_total = header.width * header.height * pixel_size;\r\n // Read palettes\r\n var palettes;\r\n if (use_pal) {\r\n palettes = data.subarray(offset, offset += header.colormap_length * (header.colormap_size >> 3));\r\n }\r\n // Read LRE\r\n if (use_rle) {\r\n pixel_data = new Uint8Array(pixel_total);\r\n var c, count, i;\r\n var localOffset = 0;\r\n var pixels = new Uint8Array(pixel_size);\r\n while (offset < pixel_total && localOffset < pixel_total) {\r\n c = data[offset++];\r\n count = (c & 0x7f) + 1;\r\n // RLE pixels\r\n if (c & 0x80) {\r\n // Bind pixel tmp array\r\n for (i = 0; i < pixel_size; ++i) {\r\n pixels[i] = data[offset++];\r\n }\r\n // Copy pixel array\r\n for (i = 0; i < count; ++i) {\r\n pixel_data.set(pixels, localOffset + i * pixel_size);\r\n }\r\n localOffset += pixel_size * count;\r\n }\r\n // Raw pixels\r\n else {\r\n count *= pixel_size;\r\n for (i = 0; i < count; ++i) {\r\n pixel_data[localOffset + i] = data[offset++];\r\n }\r\n localOffset += count;\r\n }\r\n }\r\n }\r\n // RAW Pixels\r\n else {\r\n pixel_data = data.subarray(offset, offset += (use_pal ? header.width * header.height : pixel_total));\r\n }\r\n // Load to texture\r\n var x_start, y_start, x_step, y_step, y_end, x_end;\r\n switch ((header.flags & TGATools._ORIGIN_MASK) >> TGATools._ORIGIN_SHIFT) {\r\n default:\r\n case TGATools._ORIGIN_UL:\r\n x_start = 0;\r\n x_step = 1;\r\n x_end = header.width;\r\n y_start = 0;\r\n y_step = 1;\r\n y_end = header.height;\r\n break;\r\n case TGATools._ORIGIN_BL:\r\n x_start = 0;\r\n x_step = 1;\r\n x_end = header.width;\r\n y_start = header.height - 1;\r\n y_step = -1;\r\n y_end = -1;\r\n break;\r\n case TGATools._ORIGIN_UR:\r\n x_start = header.width - 1;\r\n x_step = -1;\r\n x_end = -1;\r\n y_start = 0;\r\n y_step = 1;\r\n y_end = header.height;\r\n break;\r\n case TGATools._ORIGIN_BR:\r\n x_start = header.width - 1;\r\n x_step = -1;\r\n x_end = -1;\r\n y_start = header.height - 1;\r\n y_step = -1;\r\n y_end = -1;\r\n break;\r\n }\r\n // Load the specify method\r\n var func = '_getImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits';\r\n var imageData = TGATools[func](header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end);\r\n var engine = texture.getEngine();\r\n engine._uploadDataToTextureDirectly(texture, imageData);\r\n };\r\n /** @hidden */\r\n TGATools._getImageData8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data, colormap = palettes;\r\n var width = header.width, height = header.height;\r\n var color, i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i++) {\r\n color = image[i];\r\n imageData[(x + width * y) * 4 + 3] = 255;\r\n imageData[(x + width * y) * 4 + 2] = colormap[(color * 3) + 0];\r\n imageData[(x + width * y) * 4 + 1] = colormap[(color * 3) + 1];\r\n imageData[(x + width * y) * 4 + 0] = colormap[(color * 3) + 2];\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageData16bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var color, i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 2) {\r\n color = image[i + 0] + (image[i + 1] << 8); // Inversed ?\r\n var r = (((color & 0x7C00) >> 10) * 255) / 0x1F | 0;\r\n var g = (((color & 0x03E0) >> 5) * 255) / 0x1F | 0;\r\n var b = ((color & 0x001F) * 255) / 0x1F | 0;\r\n imageData[(x + width * y) * 4 + 0] = r;\r\n imageData[(x + width * y) * 4 + 1] = g;\r\n imageData[(x + width * y) * 4 + 2] = b;\r\n imageData[(x + width * y) * 4 + 3] = (color & 0x8000) ? 0 : 255;\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageData24bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 3) {\r\n imageData[(x + width * y) * 4 + 3] = 255;\r\n imageData[(x + width * y) * 4 + 2] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 1] = image[i + 1];\r\n imageData[(x + width * y) * 4 + 0] = image[i + 2];\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageData32bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 4) {\r\n imageData[(x + width * y) * 4 + 2] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 1] = image[i + 1];\r\n imageData[(x + width * y) * 4 + 0] = image[i + 2];\r\n imageData[(x + width * y) * 4 + 3] = image[i + 3];\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageDataGrey8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var color, i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i++) {\r\n color = image[i];\r\n imageData[(x + width * y) * 4 + 0] = color;\r\n imageData[(x + width * y) * 4 + 1] = color;\r\n imageData[(x + width * y) * 4 + 2] = color;\r\n imageData[(x + width * y) * 4 + 3] = 255;\r\n }\r\n }\r\n return imageData;\r\n };\r\n /** @hidden */\r\n TGATools._getImageDataGrey16bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {\r\n var image = pixel_data;\r\n var width = header.width, height = header.height;\r\n var i = 0, x, y;\r\n var imageData = new Uint8Array(width * height * 4);\r\n for (y = y_start; y !== y_end; y += y_step) {\r\n for (x = x_start; x !== x_end; x += x_step, i += 2) {\r\n imageData[(x + width * y) * 4 + 0] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 1] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 2] = image[i + 0];\r\n imageData[(x + width * y) * 4 + 3] = image[i + 1];\r\n }\r\n }\r\n return imageData;\r\n };\r\n //private static _TYPE_NO_DATA = 0;\r\n TGATools._TYPE_INDEXED = 1;\r\n TGATools._TYPE_RGB = 2;\r\n TGATools._TYPE_GREY = 3;\r\n TGATools._TYPE_RLE_INDEXED = 9;\r\n TGATools._TYPE_RLE_RGB = 10;\r\n TGATools._TYPE_RLE_GREY = 11;\r\n TGATools._ORIGIN_MASK = 0x30;\r\n TGATools._ORIGIN_SHIFT = 0x04;\r\n TGATools._ORIGIN_BL = 0x00;\r\n TGATools._ORIGIN_BR = 0x01;\r\n TGATools._ORIGIN_UL = 0x02;\r\n TGATools._ORIGIN_UR = 0x03;\r\n return TGATools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/timingTools.ts\":\n/*!*****************************!*\\\n !*** ./Misc/timingTools.ts ***!\n \\*****************************/\n/*! exports provided: TimingTools */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TimingTools\", function() { return TimingTools; });\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n\r\n/**\r\n * Class used to provide helper for timing\r\n */\r\nvar TimingTools = /** @class */ (function () {\r\n function TimingTools() {\r\n }\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n TimingTools.SetImmediate = function (action) {\r\n if (_domManagement__WEBPACK_IMPORTED_MODULE_0__[\"DomManagement\"].IsWindowObjectExist() && window.setImmediate) {\r\n window.setImmediate(action);\r\n }\r\n else {\r\n setTimeout(action, 1);\r\n }\r\n };\r\n return TimingTools;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/tools.ts\":\n/*!***********************!*\\\n !*** ./Misc/tools.ts ***!\n \\***********************/\n/*! exports provided: Tools, className, AsyncLoop */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return Tools; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return className; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return AsyncLoop; });\n/* harmony import */ var _observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _domManagement__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _precisionDate__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _devTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _webRequest__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./webRequest */ \"./Misc/webRequest.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _fileTools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fileTools */ \"./Misc/fileTools.ts\");\n/* harmony import */ var _promise__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./promise */ \"./Misc/promise.ts\");\n/* harmony import */ var _timingTools__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./timingTools */ \"./Misc/timingTools.ts\");\n/* harmony import */ var _instantiationTools__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./instantiationTools */ \"./Misc/instantiationTools.ts\");\n/* harmony import */ var _guid__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./guid */ \"./Misc/guid.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class containing a set of static utilities functions\r\n */\r\nvar Tools = /** @class */ (function () {\r\n function Tools() {\r\n }\r\n Object.defineProperty(Tools, \"BaseUrl\", {\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n get: function () {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].BaseUrl;\r\n },\r\n set: function (value) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].BaseUrl = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"DefaultRetryStrategy\", {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n get: function () {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].DefaultRetryStrategy;\r\n },\r\n set: function (strategy) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].DefaultRetryStrategy = strategy;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"UseFallbackTexture\", {\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].UseFallbackTexture;\r\n },\r\n set: function (value) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].UseFallbackTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"RegisteredExternalClasses\", {\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n get: function () {\r\n return _instantiationTools__WEBPACK_IMPORTED_MODULE_11__[\"InstantiationTools\"].RegisteredExternalClasses;\r\n },\r\n set: function (classes) {\r\n _instantiationTools__WEBPACK_IMPORTED_MODULE_11__[\"InstantiationTools\"].RegisteredExternalClasses = classes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"fallbackTexture\", {\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].FallbackTexture;\r\n },\r\n set: function (value) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].FallbackTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Read the content of a byte array at a specified coordinates (taking in account wrapping)\r\n * @param u defines the coordinate on X axis\r\n * @param v defines the coordinate on Y axis\r\n * @param width defines the width of the source data\r\n * @param height defines the height of the source data\r\n * @param pixels defines the source byte array\r\n * @param color defines the output color\r\n */\r\n Tools.FetchToRef = function (u, v, width, height, pixels, color) {\r\n var wrappedU = ((Math.abs(u) * width) % width) | 0;\r\n var wrappedV = ((Math.abs(v) * height) % height) | 0;\r\n var position = (wrappedU + wrappedV * width) * 4;\r\n color.r = pixels[position] / 255;\r\n color.g = pixels[position + 1] / 255;\r\n color.b = pixels[position + 2] / 255;\r\n color.a = pixels[position + 3] / 255;\r\n };\r\n /**\r\n * Interpolates between a and b via alpha\r\n * @param a The lower value (returned when alpha = 0)\r\n * @param b The upper value (returned when alpha = 1)\r\n * @param alpha The interpolation-factor\r\n * @return The mixed value\r\n */\r\n Tools.Mix = function (a, b, alpha) {\r\n return a * (1 - alpha) + b * alpha;\r\n };\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n Tools.Instantiate = function (className) {\r\n return _instantiationTools__WEBPACK_IMPORTED_MODULE_11__[\"InstantiationTools\"].Instantiate(className);\r\n };\r\n /**\r\n * Provides a slice function that will work even on IE\r\n * @param data defines the array to slice\r\n * @param start defines the start of the data (optional)\r\n * @param end defines the end of the data (optional)\r\n * @returns the new sliced array\r\n */\r\n Tools.Slice = function (data, start, end) {\r\n if (data.slice) {\r\n return data.slice(start, end);\r\n }\r\n return Array.prototype.slice.call(data, start, end);\r\n };\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n Tools.SetImmediate = function (action) {\r\n _timingTools__WEBPACK_IMPORTED_MODULE_10__[\"TimingTools\"].SetImmediate(action);\r\n };\r\n /**\r\n * Function indicating if a number is an exponent of 2\r\n * @param value defines the value to test\r\n * @returns true if the value is an exponent of 2\r\n */\r\n Tools.IsExponentOfTwo = function (value) {\r\n var count = 1;\r\n do {\r\n count *= 2;\r\n } while (count < value);\r\n return count === value;\r\n };\r\n /**\r\n * Returns the nearest 32-bit single precision float representation of a Number\r\n * @param value A Number. If the parameter is of a different type, it will get converted\r\n * to a number or to NaN if it cannot be converted\r\n * @returns number\r\n */\r\n Tools.FloatRound = function (value) {\r\n if (Math.fround) {\r\n return Math.fround(value);\r\n }\r\n return (Tools._tmpFloatArray[0] = value);\r\n };\r\n /**\r\n * Extracts the filename from a path\r\n * @param path defines the path to use\r\n * @returns the filename\r\n */\r\n Tools.GetFilename = function (path) {\r\n var index = path.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n return path;\r\n }\r\n return path.substring(index + 1);\r\n };\r\n /**\r\n * Extracts the \"folder\" part of a path (everything before the filename).\r\n * @param uri The URI to extract the info from\r\n * @param returnUnchangedIfNoSlash Do not touch the URI if no slashes are present\r\n * @returns The \"folder\" part of the path\r\n */\r\n Tools.GetFolderPath = function (uri, returnUnchangedIfNoSlash) {\r\n if (returnUnchangedIfNoSlash === void 0) { returnUnchangedIfNoSlash = false; }\r\n var index = uri.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n if (returnUnchangedIfNoSlash) {\r\n return uri;\r\n }\r\n return \"\";\r\n }\r\n return uri.substring(0, index + 1);\r\n };\r\n /**\r\n * Convert an angle in radians to degrees\r\n * @param angle defines the angle to convert\r\n * @returns the angle in degrees\r\n */\r\n Tools.ToDegrees = function (angle) {\r\n return angle * 180 / Math.PI;\r\n };\r\n /**\r\n * Convert an angle in degrees to radians\r\n * @param angle defines the angle to convert\r\n * @returns the angle in radians\r\n */\r\n Tools.ToRadians = function (angle) {\r\n return angle * Math.PI / 180;\r\n };\r\n /**\r\n * Encode a buffer to a base64 string\r\n * @param buffer defines the buffer to encode\r\n * @returns the encoded string\r\n */\r\n Tools.EncodeArrayBufferTobase64 = function (buffer) {\r\n var keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n var output = \"\";\r\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\r\n var i = 0;\r\n var bytes = new Uint8Array(buffer);\r\n while (i < bytes.length) {\r\n chr1 = bytes[i++];\r\n chr2 = i < bytes.length ? bytes[i++] : Number.NaN; // Not sure if the index\r\n chr3 = i < bytes.length ? bytes[i++] : Number.NaN; // checks are needed here\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n }\r\n else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n output += keyStr.charAt(enc1) + keyStr.charAt(enc2) +\r\n keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n return \"data:image/png;base64,\" + output;\r\n };\r\n /**\r\n * Returns an array if obj is not an array\r\n * @param obj defines the object to evaluate as an array\r\n * @param allowsNullUndefined defines a boolean indicating if obj is allowed to be null or undefined\r\n * @returns either obj directly if obj is an array or a new array containing obj\r\n */\r\n Tools.MakeArray = function (obj, allowsNullUndefined) {\r\n if (allowsNullUndefined !== true && (obj === undefined || obj == null)) {\r\n return null;\r\n }\r\n return Array.isArray(obj) ? obj : [obj];\r\n };\r\n /**\r\n * Gets the pointer prefix to use\r\n * @returns \"pointer\" if touch is enabled. Else returns \"mouse\"\r\n */\r\n Tools.GetPointerPrefix = function () {\r\n var eventPrefix = \"pointer\";\r\n // Check if pointer events are supported\r\n if (_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist() && !window.PointerEvent && _domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsNavigatorAvailable() && !navigator.pointerEnabled) {\r\n eventPrefix = \"mouse\";\r\n }\r\n return eventPrefix;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n Tools.SetCorsBehavior = function (url, element) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].SetCorsBehavior(url, element);\r\n };\r\n // External files\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n Tools.CleanUrl = function (url) {\r\n url = url.replace(/#/mg, \"%23\");\r\n return url;\r\n };\r\n Object.defineProperty(Tools, \"PreprocessUrl\", {\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n get: function () {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].PreprocessUrl;\r\n },\r\n set: function (processor) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].PreprocessUrl = processor;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n Tools.LoadImage = function (input, onLoad, onError, offlineProvider) {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadImage(input, onLoad, onError, offlineProvider);\r\n };\r\n /**\r\n * Loads a file\r\n * @param url url string, ArrayBuffer, or Blob to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n Tools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url the file url to load\r\n * @returns a promise containing an ArrayBuffer corrisponding to the loaded file\r\n */\r\n Tools.LoadFileAsync = function (url) {\r\n return new Promise(function (resolve, reject) {\r\n _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].LoadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, undefined, true, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Load a script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param onSuccess defines the callback called when the script is loaded\r\n * @param onError defines the callback to call if an error occurs\r\n * @param scriptId defines the id of the script element\r\n */\r\n Tools.LoadScript = function (scriptUrl, onSuccess, onError, scriptId) {\r\n if (!_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n var head = document.getElementsByTagName('head')[0];\r\n var script = document.createElement('script');\r\n script.setAttribute('type', 'text/javascript');\r\n script.setAttribute('src', scriptUrl);\r\n if (scriptId) {\r\n script.id = scriptId;\r\n }\r\n script.onload = function () {\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n };\r\n script.onerror = function (e) {\r\n if (onError) {\r\n onError(\"Unable to load script '\" + scriptUrl + \"'\", e);\r\n }\r\n };\r\n head.appendChild(script);\r\n };\r\n /**\r\n * Load an asynchronous script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param scriptId defines the id of the script element\r\n * @returns a promise request object\r\n */\r\n Tools.LoadScriptAsync = function (scriptUrl, scriptId) {\r\n return new Promise(function (resolve, reject) {\r\n if (!_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n resolve(false);\r\n return;\r\n }\r\n var head = document.getElementsByTagName('head')[0];\r\n var script = document.createElement('script');\r\n script.setAttribute('type', 'text/javascript');\r\n script.setAttribute('src', scriptUrl);\r\n if (scriptId) {\r\n script.id = scriptId;\r\n }\r\n script.onload = function () {\r\n resolve(true);\r\n };\r\n script.onerror = function (e) {\r\n resolve(false);\r\n };\r\n head.appendChild(script);\r\n });\r\n };\r\n /**\r\n * Loads a file from a blob\r\n * @param fileToLoad defines the blob to use\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallback defines the callback to call during loading process\r\n * @returns a file request object\r\n */\r\n Tools.ReadFileAsDataURL = function (fileToLoad, callback, progressCallback) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new _observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"](),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) {\r\n request.onCompleteObservable.notifyObservers(request);\r\n };\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n callback(e.target['result']);\r\n };\r\n reader.onprogress = progressCallback;\r\n reader.readAsDataURL(fileToLoad);\r\n return request;\r\n };\r\n /**\r\n * Loads a file\r\n * @param fileToLoad defines the file to load\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallBack defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @returns a file request object\r\n */\r\n Tools.ReadFile = function (fileToLoad, callback, progressCallBack, useArrayBuffer) {\r\n return _fileTools__WEBPACK_IMPORTED_MODULE_8__[\"FileTools\"].ReadFile(fileToLoad, callback, progressCallBack, useArrayBuffer);\r\n };\r\n /**\r\n * Creates a data url from a given string content\r\n * @param content defines the content to convert\r\n * @returns the new data url link\r\n */\r\n Tools.FileAsURL = function (content) {\r\n var fileBlob = new Blob([content]);\r\n var url = window.URL || window.webkitURL;\r\n var link = url.createObjectURL(fileBlob);\r\n return link;\r\n };\r\n /**\r\n * Format the given number to a specific decimal format\r\n * @param value defines the number to format\r\n * @param decimals defines the number of decimals to use\r\n * @returns the formatted string\r\n */\r\n Tools.Format = function (value, decimals) {\r\n if (decimals === void 0) { decimals = 2; }\r\n return value.toFixed(decimals);\r\n };\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n Tools.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n _deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(source, destination, doNotCopyList, mustCopyList);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has no own property\r\n * @param obj defines the object to test\r\n * @returns true if object has no own property\r\n */\r\n Tools.IsEmpty = function (obj) {\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Function used to register events at window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to register\r\n */\r\n Tools.RegisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.addEventListener(event.name, event.handler, false);\r\n try {\r\n if (window.parent) {\r\n window.parent.addEventListener(event.name, event.handler, false);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Function used to unregister events from window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to unregister\r\n */\r\n Tools.UnregisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.removeEventListener(event.name, event.handler);\r\n try {\r\n if (windowElement.parent) {\r\n windowElement.parent.removeEventListener(event.name, event.handler);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.DumpFramebuffer = function (width, height, engine, successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // Read the contents of the framebuffer\r\n var numberOfChannelsByLine = width * 4;\r\n var halfHeight = height / 2;\r\n //Reading datas from WebGL\r\n var data = engine.readPixels(0, 0, width, height);\r\n //To flip image on Y axis.\r\n for (var i = 0; i < halfHeight; i++) {\r\n for (var j = 0; j < numberOfChannelsByLine; j++) {\r\n var currentCell = j + i * numberOfChannelsByLine;\r\n var targetLine = height - i - 1;\r\n var targetCell = j + targetLine * numberOfChannelsByLine;\r\n var temp = data[currentCell];\r\n data[currentCell] = data[targetCell];\r\n data[targetCell] = temp;\r\n }\r\n }\r\n // Create a 2D canvas to store the result\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement('canvas');\r\n }\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n var context = Tools._ScreenshotCanvas.getContext('2d');\r\n if (context) {\r\n // Copy the pixels to a 2D canvas\r\n var imageData = context.createImageData(width, height);\r\n var castData = (imageData.data);\r\n castData.set(data);\r\n context.putImageData(imageData, 0, 0);\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType, fileName);\r\n }\r\n };\r\n /**\r\n * Converts the canvas data to blob.\r\n * This acts as a polyfill for browsers not supporting the to blob function.\r\n * @param canvas Defines the canvas to extract the data from\r\n * @param successCallback Defines the callback triggered once the data are available\r\n * @param mimeType Defines the mime type of the result\r\n */\r\n Tools.ToBlob = function (canvas, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // We need HTMLCanvasElement.toBlob for HD screenshots\r\n if (!canvas.toBlob) {\r\n // low performance polyfill based on toDataURL (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)\r\n canvas.toBlob = function (callback, type, quality) {\r\n var _this = this;\r\n setTimeout(function () {\r\n var binStr = atob(_this.toDataURL(type, quality).split(',')[1]), len = binStr.length, arr = new Uint8Array(len);\r\n for (var i = 0; i < len; i++) {\r\n arr[i] = binStr.charCodeAt(i);\r\n }\r\n callback(new Blob([arr]));\r\n });\r\n };\r\n }\r\n canvas.toBlob(function (blob) {\r\n successCallback(blob);\r\n }, mimeType);\r\n };\r\n /**\r\n * Encodes the canvas data to base 64 or automatically download the result if filename is defined\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines he filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.EncodeScreenshotCanvasData = function (successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (successCallback) {\r\n var base64Image = Tools._ScreenshotCanvas.toDataURL(mimeType);\r\n successCallback(base64Image);\r\n }\r\n else {\r\n this.ToBlob(Tools._ScreenshotCanvas, function (blob) {\r\n //Creating a link if the browser have the download attribute on the a tag, to automatically start download generated image.\r\n if ((\"download\" in document.createElement(\"a\"))) {\r\n if (!fileName) {\r\n var date = new Date();\r\n var stringDate = (date.getFullYear() + \"-\" + (date.getMonth() + 1)).slice(2) + \"-\" + date.getDate() + \"_\" + date.getHours() + \"-\" + ('0' + date.getMinutes()).slice(-2);\r\n fileName = \"screenshot_\" + stringDate + \".png\";\r\n }\r\n Tools.Download(blob, fileName);\r\n }\r\n else {\r\n var url = URL.createObjectURL(blob);\r\n var newWindow = window.open(\"\");\r\n if (!newWindow) {\r\n return;\r\n }\r\n var img = newWindow.document.createElement(\"img\");\r\n img.onload = function () {\r\n // no longer need to read the blob so it's revoked\r\n URL.revokeObjectURL(url);\r\n };\r\n img.src = url;\r\n newWindow.document.body.appendChild(img);\r\n }\r\n }, mimeType);\r\n }\r\n };\r\n /**\r\n * Downloads a blob in the browser\r\n * @param blob defines the blob to download\r\n * @param fileName defines the name of the downloaded file\r\n */\r\n Tools.Download = function (blob, fileName) {\r\n if (navigator && navigator.msSaveBlob) {\r\n navigator.msSaveBlob(blob, fileName);\r\n return;\r\n }\r\n var url = window.URL.createObjectURL(blob);\r\n var a = document.createElement(\"a\");\r\n document.body.appendChild(a);\r\n a.style.display = \"none\";\r\n a.href = url;\r\n a.download = fileName;\r\n a.addEventListener(\"click\", function () {\r\n if (a.parentElement) {\r\n a.parentElement.removeChild(a);\r\n }\r\n });\r\n a.click();\r\n window.URL.revokeObjectURL(url);\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n Tools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n */\r\n Tools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n Tools.RandomId = function () {\r\n return _guid__WEBPACK_IMPORTED_MODULE_12__[\"GUID\"].RandomId();\r\n };\r\n /**\r\n * Test if the given uri is a base64 string\r\n * @param uri The uri to test\r\n * @return True if the uri is a base64 string or false otherwise\r\n */\r\n Tools.IsBase64 = function (uri) {\r\n return uri.length < 5 ? false : uri.substr(0, 5) === \"data:\";\r\n };\r\n /**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @return The decoded base64 data.\r\n */\r\n Tools.DecodeBase64 = function (uri) {\r\n var decodedString = atob(uri.split(\",\")[1]);\r\n var bufferLength = decodedString.length;\r\n var bufferView = new Uint8Array(new ArrayBuffer(bufferLength));\r\n for (var i = 0; i < bufferLength; i++) {\r\n bufferView[i] = decodedString.charCodeAt(i);\r\n }\r\n return bufferView.buffer;\r\n };\r\n /**\r\n * Gets the absolute url.\r\n * @param url the input url\r\n * @return the absolute url\r\n */\r\n Tools.GetAbsoluteUrl = function (url) {\r\n var a = document.createElement(\"a\");\r\n a.href = url;\r\n return a.href;\r\n };\r\n Object.defineProperty(Tools, \"errorsCount\", {\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].errorsCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Log a message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Log = function (message) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Log(message);\r\n };\r\n /**\r\n * Write a warning message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Warn = function (message) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(message);\r\n };\r\n /**\r\n * Write an error message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Error = function (message) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Error(message);\r\n };\r\n Object.defineProperty(Tools, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].LogCache;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Tools.ClearLogCache = function () {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].ClearLogCache();\r\n };\r\n Object.defineProperty(Tools, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].LogLevels = level;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"PerformanceLogLevel\", {\r\n /**\r\n * Sets the current performance log level\r\n */\r\n set: function (level) {\r\n if ((level & Tools.PerformanceUserMarkLogLevel) === Tools.PerformanceUserMarkLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartUserMark;\r\n Tools.EndPerformanceCounter = Tools._EndUserMark;\r\n return;\r\n }\r\n if ((level & Tools.PerformanceConsoleLogLevel) === Tools.PerformanceConsoleLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceConsole;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceConsole;\r\n return;\r\n }\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Tools._StartPerformanceCounterDisabled = function (counterName, condition) {\r\n };\r\n Tools._EndPerformanceCounterDisabled = function (counterName, condition) {\r\n };\r\n Tools._StartUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!Tools._performance) {\r\n if (!_domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist()) {\r\n return;\r\n }\r\n Tools._performance = window.performance;\r\n }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-Begin\");\r\n };\r\n Tools._EndUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-End\");\r\n Tools._performance.measure(counterName, counterName + \"-Begin\", counterName + \"-End\");\r\n };\r\n Tools._StartPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._StartUserMark(counterName, condition);\r\n if (console.time) {\r\n console.time(counterName);\r\n }\r\n };\r\n Tools._EndPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._EndUserMark(counterName, condition);\r\n if (console.time) {\r\n console.timeEnd(counterName);\r\n }\r\n };\r\n Object.defineProperty(Tools, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n return _precisionDate__WEBPACK_IMPORTED_MODULE_4__[\"PrecisionDate\"].Now;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This method will return the name of the class used to create the instance of the given object.\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @returns the name of the class, will be \"object\" for a custom data type not using the @className decorator\r\n */\r\n Tools.GetClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var name = null;\r\n if (!isType && object.getClassName) {\r\n name = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n name = classObj.constructor[\"__bjsclassName__\"];\r\n }\r\n if (!name) {\r\n name = typeof object;\r\n }\r\n }\r\n return name;\r\n };\r\n /**\r\n * Gets the first element of an array satisfying a given predicate\r\n * @param array defines the array to browse\r\n * @param predicate defines the predicate to use\r\n * @returns null if not found or the element\r\n */\r\n Tools.First = function (array, predicate) {\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var el = array_1[_i];\r\n if (predicate(el)) {\r\n return el;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * This method will return the name of the full name of the class, including its owning module (if any).\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @return a string that can have two forms: \"moduleName.className\" if module was specified when the class' Name was registered or \"className\" if there was not module specified.\r\n * @ignorenaming\r\n */\r\n Tools.getFullClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var className = null;\r\n var moduleName = null;\r\n if (!isType && object.getClassName) {\r\n className = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n className = classObj.constructor[\"__bjsclassName__\"];\r\n moduleName = classObj.constructor[\"__bjsmoduleName__\"];\r\n }\r\n if (!className) {\r\n className = typeof object;\r\n }\r\n }\r\n if (!className) {\r\n return null;\r\n }\r\n return ((moduleName != null) ? (moduleName + \".\") : \"\") + className;\r\n };\r\n /**\r\n * Returns a promise that resolves after the given amount of time.\r\n * @param delay Number of milliseconds to delay\r\n * @returns Promise that resolves after the given amount of time\r\n */\r\n Tools.DelayAsync = function (delay) {\r\n return new Promise(function (resolve) {\r\n setTimeout(function () {\r\n resolve();\r\n }, delay);\r\n });\r\n };\r\n /**\r\n * Enable/Disable Custom HTTP Request Headers globally.\r\n * default = false\r\n * @see CustomRequestHeaders\r\n */\r\n Tools.UseCustomRequestHeaders = false;\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n Tools.CustomRequestHeaders = _webRequest__WEBPACK_IMPORTED_MODULE_6__[\"WebRequest\"].CustomRequestHeaders;\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n Tools.CorsBehavior = \"anonymous\";\r\n Tools._tmpFloatArray = new Float32Array(1);\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * Back Compat only, please use DomManagement.GetDOMTextContent instead.\r\n */\r\n Tools.GetDOMTextContent = _domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].GetDOMTextContent;\r\n // Logs\r\n /**\r\n * No log\r\n */\r\n Tools.NoneLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].NoneLogLevel;\r\n /**\r\n * Only message logs\r\n */\r\n Tools.MessageLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].MessageLogLevel;\r\n /**\r\n * Only warning logs\r\n */\r\n Tools.WarningLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].WarningLogLevel;\r\n /**\r\n * Only error logs\r\n */\r\n Tools.ErrorLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].ErrorLogLevel;\r\n /**\r\n * All logs\r\n */\r\n Tools.AllLogLevel = _logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].AllLogLevel;\r\n /**\r\n * Checks if the window object exists\r\n * Back Compat only, please use DomManagement.IsWindowObjectExist instead.\r\n */\r\n Tools.IsWindowObjectExist = _domManagement__WEBPACK_IMPORTED_MODULE_1__[\"DomManagement\"].IsWindowObjectExist;\r\n // Performances\r\n /**\r\n * No performance log\r\n */\r\n Tools.PerformanceNoneLogLevel = 0;\r\n /**\r\n * Use user marks to log performance\r\n */\r\n Tools.PerformanceUserMarkLogLevel = 1;\r\n /**\r\n * Log performance to the console\r\n */\r\n Tools.PerformanceConsoleLogLevel = 2;\r\n /**\r\n * Starts a performance counter\r\n */\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n /**\r\n * Ends a specific performance coutner\r\n */\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n return Tools;\r\n}());\r\n\r\n/**\r\n * Use this className as a decorator on a given class definition to add it a name and optionally its module.\r\n * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.\r\n * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified\r\n * @param name The name of the class, case should be preserved\r\n * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.\r\n */\r\nfunction className(name, module) {\r\n return function (target) {\r\n target[\"__bjsclassName__\"] = name;\r\n target[\"__bjsmoduleName__\"] = (module != null) ? module : null;\r\n };\r\n}\r\n/**\r\n * An implementation of a loop for asynchronous functions.\r\n */\r\nvar AsyncLoop = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n * @param iterations the number of iterations.\r\n * @param func the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n */\r\n function AsyncLoop(\r\n /**\r\n * Defines the number of iterations for the loop\r\n */\r\n iterations, func, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n this.iterations = iterations;\r\n this.index = offset - 1;\r\n this._done = false;\r\n this._fn = func;\r\n this._successCallback = successCallback;\r\n }\r\n /**\r\n * Execute the next iteration. Must be called after the last iteration was finished.\r\n */\r\n AsyncLoop.prototype.executeNext = function () {\r\n if (!this._done) {\r\n if (this.index + 1 < this.iterations) {\r\n ++this.index;\r\n this._fn(this);\r\n }\r\n else {\r\n this.breakLoop();\r\n }\r\n }\r\n };\r\n /**\r\n * Break the loop and run the success callback.\r\n */\r\n AsyncLoop.prototype.breakLoop = function () {\r\n this._done = true;\r\n this._successCallback();\r\n };\r\n /**\r\n * Create and run an async loop.\r\n * @param iterations the number of iterations.\r\n * @param fn the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.Run = function (iterations, fn, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var loop = new AsyncLoop(iterations, fn, successCallback, offset);\r\n loop.executeNext();\r\n return loop;\r\n };\r\n /**\r\n * A for-loop that will run a given number of iterations synchronous and the rest async.\r\n * @param iterations total number of iterations\r\n * @param syncedIterations number of synchronous iterations in each async iteration.\r\n * @param fn the function to call each iteration.\r\n * @param callback a success call back that will be called when iterating stops.\r\n * @param breakFunction a break condition (optional)\r\n * @param timeout timeout settings for the setTimeout function. default - 0.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.SyncAsyncForLoop = function (iterations, syncedIterations, fn, callback, breakFunction, timeout) {\r\n if (timeout === void 0) { timeout = 0; }\r\n return AsyncLoop.Run(Math.ceil(iterations / syncedIterations), function (loop) {\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n }\r\n else {\r\n setTimeout(function () {\r\n for (var i = 0; i < syncedIterations; ++i) {\r\n var iteration = (loop.index * syncedIterations) + i;\r\n if (iteration >= iterations) {\r\n break;\r\n }\r\n fn(iteration);\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n break;\r\n }\r\n }\r\n loop.executeNext();\r\n }, timeout);\r\n }\r\n }, callback);\r\n };\r\n return AsyncLoop;\r\n}());\r\n\r\n// Will only be define if Tools is imported freeing up some space when only engine is required\r\n_Engines_engineStore__WEBPACK_IMPORTED_MODULE_7__[\"EngineStore\"].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\";\r\n// Register promise fallback for IE\r\n_promise__WEBPACK_IMPORTED_MODULE_9__[\"PromisePolyfill\"].Apply();\r\n\n\n/***/ }),\n\n/***/ \"./Misc/typeStore.ts\":\n/*!***************************!*\\\n !*** ./Misc/typeStore.ts ***!\n \\***************************/\n/*! exports provided: _TypeStore */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _TypeStore; });\n/** @hidden */\r\nvar _TypeStore = /** @class */ (function () {\r\n function _TypeStore() {\r\n }\r\n /** @hidden */\r\n _TypeStore.GetClass = function (fqdn) {\r\n if (this.RegisteredTypes && this.RegisteredTypes[fqdn]) {\r\n return this.RegisteredTypes[fqdn];\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n _TypeStore.RegisteredTypes = {};\r\n return _TypeStore;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/uniqueIdGenerator.ts\":\n/*!***********************************!*\\\n !*** ./Misc/uniqueIdGenerator.ts ***!\n \\***********************************/\n/*! exports provided: UniqueIdGenerator */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UniqueIdGenerator\", function() { return UniqueIdGenerator; });\n/**\r\n * Helper class used to generate session unique ID\r\n */\r\nvar UniqueIdGenerator = /** @class */ (function () {\r\n function UniqueIdGenerator() {\r\n }\r\n Object.defineProperty(UniqueIdGenerator, \"UniqueId\", {\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n */\r\n get: function () {\r\n var result = this._UniqueIdCounter;\r\n this._UniqueIdCounter++;\r\n return result;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Statics\r\n UniqueIdGenerator._UniqueIdCounter = 0;\r\n return UniqueIdGenerator;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/videoRecorder.ts\":\n/*!*******************************!*\\\n !*** ./Misc/videoRecorder.ts ***!\n \\*******************************/\n/*! exports provided: VideoRecorder */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return VideoRecorder; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tools */ \"./Misc/tools.ts\");\n\r\n\r\n/**\r\n * This can help with recording videos from BabylonJS.\r\n * This is based on the available WebRTC functionalities of the browser.\r\n *\r\n * @see http://doc.babylonjs.com/how_to/render_scene_on_a_video\r\n */\r\nvar VideoRecorder = /** @class */ (function () {\r\n /**\r\n * Create a new VideoCapture object which can help converting what you see in Babylon to a video file.\r\n * @param engine Defines the BabylonJS Engine you wish to record.\r\n * @param options Defines options that can be used to customize the capture.\r\n */\r\n function VideoRecorder(engine, options) {\r\n if (options === void 0) { options = null; }\r\n if (!VideoRecorder.IsSupported(engine)) {\r\n throw \"Your browser does not support recording so far.\";\r\n }\r\n var canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n throw \"The babylon engine must have a canvas to be recorded\";\r\n }\r\n this._canvas = canvas;\r\n this._canvas.isRecording = false;\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, VideoRecorder._defaultOptions, options);\r\n var stream = this._canvas.captureStream(this._options.fps);\r\n if (this._options.audioTracks) {\r\n for (var _i = 0, _a = this._options.audioTracks; _i < _a.length; _i++) {\r\n var track = _a[_i];\r\n stream.addTrack(track);\r\n }\r\n }\r\n this._mediaRecorder = new MediaRecorder(stream, { mimeType: this._options.mimeType });\r\n this._mediaRecorder.ondataavailable = this._handleDataAvailable.bind(this);\r\n this._mediaRecorder.onerror = this._handleError.bind(this);\r\n this._mediaRecorder.onstop = this._handleStop.bind(this);\r\n }\r\n /**\r\n * Returns whether or not the VideoRecorder is available in your browser.\r\n * @param engine Defines the Babylon Engine.\r\n * @returns true if supported otherwise false.\r\n */\r\n VideoRecorder.IsSupported = function (engine) {\r\n var canvas = engine.getRenderingCanvas();\r\n return (!!canvas && typeof canvas.captureStream === \"function\");\r\n };\r\n Object.defineProperty(VideoRecorder.prototype, \"isRecording\", {\r\n /**\r\n * True when a recording is already in progress.\r\n */\r\n get: function () {\r\n return !!this._canvas && this._canvas.isRecording;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Stops the current recording before the default capture timeout passed in the startRecording function.\r\n */\r\n VideoRecorder.prototype.stopRecording = function () {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n return;\r\n }\r\n if (!this.isRecording) {\r\n return;\r\n }\r\n this._canvas.isRecording = false;\r\n this._mediaRecorder.stop();\r\n };\r\n /**\r\n * Starts recording the canvas for a max duration specified in parameters.\r\n * @param fileName Defines the name of the file to be downloaded when the recording stop.\r\n * If null no automatic download will start and you can rely on the promise to get the data back.\r\n * @param maxDuration Defines the maximum recording time in seconds.\r\n * It defaults to 7 seconds. A value of zero will not stop automatically, you would need to call stopRecording manually.\r\n * @return A promise callback at the end of the recording with the video data in Blob.\r\n */\r\n VideoRecorder.prototype.startRecording = function (fileName, maxDuration) {\r\n var _this = this;\r\n if (fileName === void 0) { fileName = \"babylonjs.webm\"; }\r\n if (maxDuration === void 0) { maxDuration = 7; }\r\n if (!this._canvas || !this._mediaRecorder) {\r\n throw \"Recorder has already been disposed\";\r\n }\r\n if (this.isRecording) {\r\n throw \"Recording already in progress\";\r\n }\r\n if (maxDuration > 0) {\r\n setTimeout(function () {\r\n _this.stopRecording();\r\n }, maxDuration * 1000);\r\n }\r\n this._fileName = fileName;\r\n this._recordedChunks = [];\r\n this._resolve = null;\r\n this._reject = null;\r\n this._canvas.isRecording = true;\r\n this._mediaRecorder.start(this._options.recordChunckSize);\r\n return new Promise(function (resolve, reject) {\r\n _this._resolve = resolve;\r\n _this._reject = reject;\r\n });\r\n };\r\n /**\r\n * Releases internal resources used during the recording.\r\n */\r\n VideoRecorder.prototype.dispose = function () {\r\n this._canvas = null;\r\n this._mediaRecorder = null;\r\n this._recordedChunks = [];\r\n this._fileName = null;\r\n this._resolve = null;\r\n this._reject = null;\r\n };\r\n VideoRecorder.prototype._handleDataAvailable = function (event) {\r\n if (event.data.size > 0) {\r\n this._recordedChunks.push(event.data);\r\n }\r\n };\r\n VideoRecorder.prototype._handleError = function (event) {\r\n this.stopRecording();\r\n if (this._reject) {\r\n this._reject(event.error);\r\n }\r\n else {\r\n throw new event.error();\r\n }\r\n };\r\n VideoRecorder.prototype._handleStop = function () {\r\n this.stopRecording();\r\n var superBuffer = new Blob(this._recordedChunks);\r\n if (this._resolve) {\r\n this._resolve(superBuffer);\r\n }\r\n window.URL.createObjectURL(superBuffer);\r\n if (this._fileName) {\r\n _tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].Download(superBuffer, this._fileName);\r\n }\r\n };\r\n VideoRecorder._defaultOptions = {\r\n mimeType: \"video/webm\",\r\n fps: 25,\r\n recordChunckSize: 3000\r\n };\r\n return VideoRecorder;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/virtualJoystick.ts\":\n/*!*********************************!*\\\n !*** ./Misc/virtualJoystick.ts ***!\n \\*********************************/\n/*! exports provided: JoystickAxis, VirtualJoystick */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return JoystickAxis; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return VirtualJoystick; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _stringDictionary__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringDictionary */ \"./Misc/stringDictionary.ts\");\n\r\n\r\n// Mainly based on these 2 articles :\r\n// Creating an universal virtual touch joystick working for all Touch models thanks to Hand.JS : http://blogs.msdn.com/b/davrous/archive/2013/02/22/creating-an-universal-virtual-touch-joystick-working-for-all-touch-models-thanks-to-hand-js.aspx\r\n// & on Seb Lee-Delisle original work: http://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/\r\n/**\r\n * Defines the potential axis of a Joystick\r\n */\r\nvar JoystickAxis;\r\n(function (JoystickAxis) {\r\n /** X axis */\r\n JoystickAxis[JoystickAxis[\"X\"] = 0] = \"X\";\r\n /** Y axis */\r\n JoystickAxis[JoystickAxis[\"Y\"] = 1] = \"Y\";\r\n /** Z axis */\r\n JoystickAxis[JoystickAxis[\"Z\"] = 2] = \"Z\";\r\n})(JoystickAxis || (JoystickAxis = {}));\r\n/**\r\n * Class used to define virtual joystick (used in touch mode)\r\n */\r\nvar VirtualJoystick = /** @class */ (function () {\r\n /**\r\n * Creates a new virtual joystick\r\n * @param leftJoystick defines that the joystick is for left hand (false by default)\r\n */\r\n function VirtualJoystick(leftJoystick) {\r\n var _this = this;\r\n if (leftJoystick) {\r\n this._leftJoystick = true;\r\n }\r\n else {\r\n this._leftJoystick = false;\r\n }\r\n VirtualJoystick._globalJoystickIndex++;\r\n // By default left & right arrow keys are moving the X\r\n // and up & down keys are moving the Y\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n this.reverseLeftRight = false;\r\n this.reverseUpDown = false;\r\n // collections of pointers\r\n this._touches = new _stringDictionary__WEBPACK_IMPORTED_MODULE_1__[\"StringDictionary\"]();\r\n this.deltaPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._joystickSensibility = 25;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n this._onResize = function (evt) {\r\n VirtualJoystick.vjCanvasWidth = window.innerWidth;\r\n VirtualJoystick.vjCanvasHeight = window.innerHeight;\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.width = VirtualJoystick.vjCanvasWidth;\r\n VirtualJoystick.Canvas.height = VirtualJoystick.vjCanvasHeight;\r\n }\r\n VirtualJoystick.halfWidth = VirtualJoystick.vjCanvasWidth / 2;\r\n };\r\n // injecting a canvas element on top of the canvas 3D game\r\n if (!VirtualJoystick.Canvas) {\r\n window.addEventListener(\"resize\", this._onResize, false);\r\n VirtualJoystick.Canvas = document.createElement(\"canvas\");\r\n VirtualJoystick.vjCanvasWidth = window.innerWidth;\r\n VirtualJoystick.vjCanvasHeight = window.innerHeight;\r\n VirtualJoystick.Canvas.width = window.innerWidth;\r\n VirtualJoystick.Canvas.height = window.innerHeight;\r\n VirtualJoystick.Canvas.style.width = \"100%\";\r\n VirtualJoystick.Canvas.style.height = \"100%\";\r\n VirtualJoystick.Canvas.style.position = \"absolute\";\r\n VirtualJoystick.Canvas.style.backgroundColor = \"transparent\";\r\n VirtualJoystick.Canvas.style.top = \"0px\";\r\n VirtualJoystick.Canvas.style.left = \"0px\";\r\n VirtualJoystick.Canvas.style.zIndex = \"5\";\r\n VirtualJoystick.Canvas.style.msTouchAction = \"none\";\r\n // Support for jQuery PEP polyfill\r\n VirtualJoystick.Canvas.setAttribute(\"touch-action\", \"none\");\r\n var context = VirtualJoystick.Canvas.getContext('2d');\r\n if (!context) {\r\n throw new Error(\"Unable to create canvas for virtual joystick\");\r\n }\r\n VirtualJoystick.vjCanvasContext = context;\r\n VirtualJoystick.vjCanvasContext.strokeStyle = \"#ffffff\";\r\n VirtualJoystick.vjCanvasContext.lineWidth = 2;\r\n document.body.appendChild(VirtualJoystick.Canvas);\r\n }\r\n VirtualJoystick.halfWidth = VirtualJoystick.Canvas.width / 2;\r\n this.pressed = false;\r\n // default joystick color\r\n this._joystickColor = \"cyan\";\r\n this._joystickPointerID = -1;\r\n // current joystick position\r\n this._joystickPointerPos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n this._joystickPreviousPointerPos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n // origin joystick position\r\n this._joystickPointerStartPos = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n this._deltaJoystickVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n this._onPointerDownHandlerRef = function (evt) {\r\n _this._onPointerDown(evt);\r\n };\r\n this._onPointerMoveHandlerRef = function (evt) {\r\n _this._onPointerMove(evt);\r\n };\r\n this._onPointerUpHandlerRef = function (evt) {\r\n _this._onPointerUp(evt);\r\n };\r\n VirtualJoystick.Canvas.addEventListener('pointerdown', this._onPointerDownHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener('pointermove', this._onPointerMoveHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener('pointerup', this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener('pointerout', this._onPointerUpHandlerRef, false);\r\n VirtualJoystick.Canvas.addEventListener(\"contextmenu\", function (evt) {\r\n evt.preventDefault(); // Disables system menu\r\n }, false);\r\n requestAnimationFrame(function () { _this._drawVirtualJoystick(); });\r\n }\r\n /**\r\n * Defines joystick sensibility (ie. the ratio beteen a physical move and virtual joystick position change)\r\n * @param newJoystickSensibility defines the new sensibility\r\n */\r\n VirtualJoystick.prototype.setJoystickSensibility = function (newJoystickSensibility) {\r\n this._joystickSensibility = newJoystickSensibility;\r\n this._inversedSensibility = 1 / (this._joystickSensibility / 1000);\r\n };\r\n VirtualJoystick.prototype._onPointerDown = function (e) {\r\n var positionOnScreenCondition;\r\n e.preventDefault();\r\n if (this._leftJoystick === true) {\r\n positionOnScreenCondition = (e.clientX < VirtualJoystick.halfWidth);\r\n }\r\n else {\r\n positionOnScreenCondition = (e.clientX > VirtualJoystick.halfWidth);\r\n }\r\n if (positionOnScreenCondition && this._joystickPointerID < 0) {\r\n // First contact will be dedicated to the virtual joystick\r\n this._joystickPointerID = e.pointerId;\r\n this._joystickPointerStartPos.x = e.clientX;\r\n this._joystickPointerStartPos.y = e.clientY;\r\n this._joystickPointerPos = this._joystickPointerStartPos.clone();\r\n this._joystickPreviousPointerPos = this._joystickPointerStartPos.clone();\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n this.pressed = true;\r\n this._touches.add(e.pointerId.toString(), e);\r\n }\r\n else {\r\n // You can only trigger the action buttons with a joystick declared\r\n if (VirtualJoystick._globalJoystickIndex < 2 && this._action) {\r\n this._action();\r\n this._touches.add(e.pointerId.toString(), { x: e.clientX, y: e.clientY, prevX: e.clientX, prevY: e.clientY });\r\n }\r\n }\r\n };\r\n VirtualJoystick.prototype._onPointerMove = function (e) {\r\n // If the current pointer is the one associated to the joystick (first touch contact)\r\n if (this._joystickPointerID == e.pointerId) {\r\n this._joystickPointerPos.x = e.clientX;\r\n this._joystickPointerPos.y = e.clientY;\r\n this._deltaJoystickVector = this._joystickPointerPos.clone();\r\n this._deltaJoystickVector = this._deltaJoystickVector.subtract(this._joystickPointerStartPos);\r\n var directionLeftRight = this.reverseLeftRight ? -1 : 1;\r\n var deltaJoystickX = directionLeftRight * this._deltaJoystickVector.x / this._inversedSensibility;\r\n switch (this._axisTargetedByLeftAndRight) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickX));\r\n break;\r\n }\r\n var directionUpDown = this.reverseUpDown ? 1 : -1;\r\n var deltaJoystickY = directionUpDown * this._deltaJoystickVector.y / this._inversedSensibility;\r\n switch (this._axisTargetedByUpAndDown) {\r\n case JoystickAxis.X:\r\n this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Y:\r\n this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n case JoystickAxis.Z:\r\n this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickY));\r\n break;\r\n }\r\n }\r\n else {\r\n var data = this._touches.get(e.pointerId.toString());\r\n if (data) {\r\n data.x = e.clientX;\r\n data.y = e.clientY;\r\n }\r\n }\r\n };\r\n VirtualJoystick.prototype._onPointerUp = function (e) {\r\n if (this._joystickPointerID == e.pointerId) {\r\n VirtualJoystick.vjCanvasContext.clearRect(this._joystickPointerStartPos.x - 64, this._joystickPointerStartPos.y - 64, 128, 128);\r\n VirtualJoystick.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x - 42, this._joystickPreviousPointerPos.y - 42, 84, 84);\r\n this._joystickPointerID = -1;\r\n this.pressed = false;\r\n }\r\n else {\r\n var touch = this._touches.get(e.pointerId.toString());\r\n if (touch) {\r\n VirtualJoystick.vjCanvasContext.clearRect(touch.prevX - 44, touch.prevY - 44, 88, 88);\r\n }\r\n }\r\n this._deltaJoystickVector.x = 0;\r\n this._deltaJoystickVector.y = 0;\r\n this._touches.remove(e.pointerId.toString());\r\n };\r\n /**\r\n * Change the color of the virtual joystick\r\n * @param newColor a string that must be a CSS color value (like \"red\") or the hexa value (like \"#FF0000\")\r\n */\r\n VirtualJoystick.prototype.setJoystickColor = function (newColor) {\r\n this._joystickColor = newColor;\r\n };\r\n /**\r\n * Defines a callback to call when the joystick is touched\r\n * @param action defines the callback\r\n */\r\n VirtualJoystick.prototype.setActionOnTouch = function (action) {\r\n this._action = action;\r\n };\r\n /**\r\n * Defines which axis you'd like to control for left & right\r\n * @param axis defines the axis to use\r\n */\r\n VirtualJoystick.prototype.setAxisForLeftRight = function (axis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByLeftAndRight = axis;\r\n break;\r\n default:\r\n this._axisTargetedByLeftAndRight = JoystickAxis.X;\r\n break;\r\n }\r\n };\r\n /**\r\n * Defines which axis you'd like to control for up & down\r\n * @param axis defines the axis to use\r\n */\r\n VirtualJoystick.prototype.setAxisForUpDown = function (axis) {\r\n switch (axis) {\r\n case JoystickAxis.X:\r\n case JoystickAxis.Y:\r\n case JoystickAxis.Z:\r\n this._axisTargetedByUpAndDown = axis;\r\n break;\r\n default:\r\n this._axisTargetedByUpAndDown = JoystickAxis.Y;\r\n break;\r\n }\r\n };\r\n VirtualJoystick.prototype._drawVirtualJoystick = function () {\r\n var _this = this;\r\n if (this.pressed) {\r\n this._touches.forEach(function (key, touch) {\r\n if (touch.pointerId === _this._joystickPointerID) {\r\n VirtualJoystick.vjCanvasContext.clearRect(_this._joystickPointerStartPos.x - 64, _this._joystickPointerStartPos.y - 64, 128, 128);\r\n VirtualJoystick.vjCanvasContext.clearRect(_this._joystickPreviousPointerPos.x - 42, _this._joystickPreviousPointerPos.y - 42, 84, 84);\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.lineWidth = 6;\r\n VirtualJoystick.vjCanvasContext.strokeStyle = _this._joystickColor;\r\n VirtualJoystick.vjCanvasContext.arc(_this._joystickPointerStartPos.x, _this._joystickPointerStartPos.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.strokeStyle = _this._joystickColor;\r\n VirtualJoystick.vjCanvasContext.lineWidth = 2;\r\n VirtualJoystick.vjCanvasContext.arc(_this._joystickPointerStartPos.x, _this._joystickPointerStartPos.y, 60, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.strokeStyle = _this._joystickColor;\r\n VirtualJoystick.vjCanvasContext.arc(_this._joystickPointerPos.x, _this._joystickPointerPos.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n _this._joystickPreviousPointerPos = _this._joystickPointerPos.clone();\r\n }\r\n else {\r\n VirtualJoystick.vjCanvasContext.clearRect(touch.prevX - 44, touch.prevY - 44, 88, 88);\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.fillStyle = \"white\";\r\n VirtualJoystick.vjCanvasContext.beginPath();\r\n VirtualJoystick.vjCanvasContext.strokeStyle = \"red\";\r\n VirtualJoystick.vjCanvasContext.lineWidth = 6;\r\n VirtualJoystick.vjCanvasContext.arc(touch.x, touch.y, 40, 0, Math.PI * 2, true);\r\n VirtualJoystick.vjCanvasContext.stroke();\r\n VirtualJoystick.vjCanvasContext.closePath();\r\n touch.prevX = touch.x;\r\n touch.prevY = touch.y;\r\n }\r\n });\r\n }\r\n requestAnimationFrame(function () { _this._drawVirtualJoystick(); });\r\n };\r\n /**\r\n * Release internal HTML canvas\r\n */\r\n VirtualJoystick.prototype.releaseCanvas = function () {\r\n if (VirtualJoystick.Canvas) {\r\n VirtualJoystick.Canvas.removeEventListener('pointerdown', this._onPointerDownHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener('pointermove', this._onPointerMoveHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener('pointerup', this._onPointerUpHandlerRef);\r\n VirtualJoystick.Canvas.removeEventListener('pointerout', this._onPointerUpHandlerRef);\r\n window.removeEventListener(\"resize\", this._onResize);\r\n document.body.removeChild(VirtualJoystick.Canvas);\r\n VirtualJoystick.Canvas = null;\r\n }\r\n };\r\n // Used to draw the virtual joystick inside a 2D canvas on top of the WebGL rendering canvas\r\n VirtualJoystick._globalJoystickIndex = 0;\r\n return VirtualJoystick;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/webRequest.ts\":\n/*!****************************!*\\\n !*** ./Misc/webRequest.ts ***!\n \\****************************/\n/*! exports provided: WebRequest */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return WebRequest; });\n/**\r\n * Extended version of XMLHttpRequest with support for customizations (headers, ...)\r\n */\r\nvar WebRequest = /** @class */ (function () {\r\n function WebRequest() {\r\n this._xhr = new XMLHttpRequest();\r\n }\r\n WebRequest.prototype._injectCustomRequestHeaders = function () {\r\n for (var key in WebRequest.CustomRequestHeaders) {\r\n var val = WebRequest.CustomRequestHeaders[key];\r\n if (val) {\r\n this._xhr.setRequestHeader(key, val);\r\n }\r\n }\r\n };\r\n Object.defineProperty(WebRequest.prototype, \"onprogress\", {\r\n /**\r\n * Gets or sets a function to be called when loading progress changes\r\n */\r\n get: function () {\r\n return this._xhr.onprogress;\r\n },\r\n set: function (value) {\r\n this._xhr.onprogress = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"readyState\", {\r\n /**\r\n * Returns client's state\r\n */\r\n get: function () {\r\n return this._xhr.readyState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"status\", {\r\n /**\r\n * Returns client's status\r\n */\r\n get: function () {\r\n return this._xhr.status;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"statusText\", {\r\n /**\r\n * Returns client's status as a text\r\n */\r\n get: function () {\r\n return this._xhr.statusText;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"response\", {\r\n /**\r\n * Returns client's response\r\n */\r\n get: function () {\r\n return this._xhr.response;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseURL\", {\r\n /**\r\n * Returns client's response url\r\n */\r\n get: function () {\r\n return this._xhr.responseURL;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseText\", {\r\n /**\r\n * Returns client's response as text\r\n */\r\n get: function () {\r\n return this._xhr.responseText;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseType\", {\r\n /**\r\n * Gets or sets the expected response type\r\n */\r\n get: function () {\r\n return this._xhr.responseType;\r\n },\r\n set: function (value) {\r\n this._xhr.responseType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WebRequest.prototype.addEventListener = function (type, listener, options) {\r\n this._xhr.addEventListener(type, listener, options);\r\n };\r\n WebRequest.prototype.removeEventListener = function (type, listener, options) {\r\n this._xhr.removeEventListener(type, listener, options);\r\n };\r\n /**\r\n * Cancels any network activity\r\n */\r\n WebRequest.prototype.abort = function () {\r\n this._xhr.abort();\r\n };\r\n /**\r\n * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD\r\n * @param body defines an optional request body\r\n */\r\n WebRequest.prototype.send = function (body) {\r\n if (WebRequest.CustomRequestHeaders) {\r\n this._injectCustomRequestHeaders();\r\n }\r\n this._xhr.send(body);\r\n };\r\n /**\r\n * Sets the request method, request URL\r\n * @param method defines the method to use (GET, POST, etc..)\r\n * @param url defines the url to connect with\r\n */\r\n WebRequest.prototype.open = function (method, url) {\r\n for (var _i = 0, _a = WebRequest.CustomRequestModifiers; _i < _a.length; _i++) {\r\n var update = _a[_i];\r\n update(this._xhr, url);\r\n }\r\n // Clean url\r\n url = url.replace(\"file:http:\", \"http:\");\r\n url = url.replace(\"file:https:\", \"https:\");\r\n return this._xhr.open(method, url, true);\r\n };\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n WebRequest.CustomRequestHeaders = {};\r\n /**\r\n * Add callback functions in this array to update all the requests before they get sent to the network\r\n */\r\n WebRequest.CustomRequestModifiers = new Array();\r\n return WebRequest;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Misc/workerPool.ts\":\n/*!****************************!*\\\n !*** ./Misc/workerPool.ts ***!\n \\****************************/\n/*! exports provided: WorkerPool */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return WorkerPool; });\n/**\r\n * Helper class to push actions to a pool of workers.\r\n */\r\nvar WorkerPool = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param workers Array of workers to use for actions\r\n */\r\n function WorkerPool(workers) {\r\n this._pendingActions = new Array();\r\n this._workerInfos = workers.map(function (worker) { return ({\r\n worker: worker,\r\n active: false\r\n }); });\r\n }\r\n /**\r\n * Terminates all workers and clears any pending actions.\r\n */\r\n WorkerPool.prototype.dispose = function () {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n workerInfo.worker.terminate();\r\n }\r\n delete this._workerInfos;\r\n delete this._pendingActions;\r\n };\r\n /**\r\n * Pushes an action to the worker pool. If all the workers are active, the action will be\r\n * pended until a worker has completed its action.\r\n * @param action The action to perform. Call onComplete when the action is complete.\r\n */\r\n WorkerPool.prototype.push = function (action) {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n if (!workerInfo.active) {\r\n this._execute(workerInfo, action);\r\n return;\r\n }\r\n }\r\n this._pendingActions.push(action);\r\n };\r\n WorkerPool.prototype._execute = function (workerInfo, action) {\r\n var _this = this;\r\n workerInfo.active = true;\r\n action(workerInfo.worker, function () {\r\n workerInfo.active = false;\r\n var nextAction = _this._pendingActions.shift();\r\n if (nextAction) {\r\n _this._execute(workerInfo, nextAction);\r\n }\r\n });\r\n };\r\n return WorkerPool;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Morph/index.ts\":\n/*!************************!*\\\n !*** ./Morph/index.ts ***!\n \\************************/\n/*! exports provided: MorphTarget, MorphTargetManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _morphTarget__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./morphTarget */ \"./Morph/morphTarget.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return _morphTarget__WEBPACK_IMPORTED_MODULE_0__[\"MorphTarget\"]; });\n\n/* harmony import */ var _morphTargetManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./morphTargetManager */ \"./Morph/morphTargetManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return _morphTargetManager__WEBPACK_IMPORTED_MODULE_1__[\"MorphTargetManager\"]; });\n\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Morph/morphTarget.ts\":\n/*!******************************!*\\\n !*** ./Morph/morphTarget.ts ***!\n \\******************************/\n/*! exports provided: MorphTarget */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return MorphTarget; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Defines a target to use with MorphTargetManager\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTarget = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTarget\r\n * @param name defines the name of the target\r\n * @param influence defines the influence to use\r\n * @param scene defines the scene the morphtarget belongs to\r\n */\r\n function MorphTarget(\r\n /** defines the name of the target */\r\n name, influence, scene) {\r\n if (influence === void 0) { influence = 0; }\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n /**\r\n * Gets or sets the list of animations\r\n */\r\n this.animations = new Array();\r\n this._positions = null;\r\n this._normals = null;\r\n this._tangents = null;\r\n this._uvs = null;\r\n /**\r\n * Observable raised when the influence changes\r\n */\r\n this.onInfluenceChanged = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /** @hidden */\r\n this._onDataLayoutChanged = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._animationPropertiesOverride = null;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedScene;\r\n this.influence = influence;\r\n }\r\n Object.defineProperty(MorphTarget.prototype, \"influence\", {\r\n /**\r\n * Gets or sets the influence of this target (ie. its weight in the overall morphing)\r\n */\r\n get: function () {\r\n return this._influence;\r\n },\r\n set: function (influence) {\r\n if (this._influence === influence) {\r\n return;\r\n }\r\n var previous = this._influence;\r\n this._influence = influence;\r\n if (this.onInfluenceChanged.hasObservers) {\r\n this.onInfluenceChanged.notifyObservers(previous === 0 || influence === 0);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride && this._scene) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasPositions\", {\r\n /**\r\n * Gets a boolean defining if the target contains position data\r\n */\r\n get: function () {\r\n return !!this._positions;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasNormals\", {\r\n /**\r\n * Gets a boolean defining if the target contains normal data\r\n */\r\n get: function () {\r\n return !!this._normals;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasTangents\", {\r\n /**\r\n * Gets a boolean defining if the target contains tangent data\r\n */\r\n get: function () {\r\n return !!this._tangents;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasUVs\", {\r\n /**\r\n * Gets a boolean defining if the target contains texture coordinates data\r\n */\r\n get: function () {\r\n return !!this._uvs;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Affects position data to this target\r\n * @param data defines the position data to use\r\n */\r\n MorphTarget.prototype.setPositions = function (data) {\r\n var hadPositions = this.hasPositions;\r\n this._positions = data;\r\n if (hadPositions !== this.hasPositions) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the position data stored in this target\r\n * @returns a FloatArray containing the position data (or null if not present)\r\n */\r\n MorphTarget.prototype.getPositions = function () {\r\n return this._positions;\r\n };\r\n /**\r\n * Affects normal data to this target\r\n * @param data defines the normal data to use\r\n */\r\n MorphTarget.prototype.setNormals = function (data) {\r\n var hadNormals = this.hasNormals;\r\n this._normals = data;\r\n if (hadNormals !== this.hasNormals) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the normal data stored in this target\r\n * @returns a FloatArray containing the normal data (or null if not present)\r\n */\r\n MorphTarget.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Affects tangent data to this target\r\n * @param data defines the tangent data to use\r\n */\r\n MorphTarget.prototype.setTangents = function (data) {\r\n var hadTangents = this.hasTangents;\r\n this._tangents = data;\r\n if (hadTangents !== this.hasTangents) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the tangent data stored in this target\r\n * @returns a FloatArray containing the tangent data (or null if not present)\r\n */\r\n MorphTarget.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Affects texture coordinates data to this target\r\n * @param data defines the texture coordinates data to use\r\n */\r\n MorphTarget.prototype.setUVs = function (data) {\r\n var hadUVs = this.hasUVs;\r\n this._uvs = data;\r\n if (hadUVs !== this.hasUVs) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the texture coordinates data stored in this target\r\n * @returns a FloatArray containing the texture coordinates data (or null if not present)\r\n */\r\n MorphTarget.prototype.getUVs = function () {\r\n return this._uvs;\r\n };\r\n /**\r\n * Serializes the current target into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTarget.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.influence = this.influence;\r\n serializationObject.positions = Array.prototype.slice.call(this.getPositions());\r\n if (this.id != null) {\r\n serializationObject.id = this.id;\r\n }\r\n if (this.hasNormals) {\r\n serializationObject.normals = Array.prototype.slice.call(this.getNormals());\r\n }\r\n if (this.hasTangents) {\r\n serializationObject.tangents = Array.prototype.slice.call(this.getTangents());\r\n }\r\n if (this.hasUVs) {\r\n serializationObject.uvs = Array.prototype.slice.call(this.getUVs());\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_4__[\"SerializationHelper\"].AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Returns the string \"MorphTarget\"\r\n * @returns \"MorphTarget\"\r\n */\r\n MorphTarget.prototype.getClassName = function () {\r\n return \"MorphTarget\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new target from serialized data\r\n * @param serializationObject defines the serialized data to use\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.Parse = function (serializationObject) {\r\n var result = new MorphTarget(serializationObject.name, serializationObject.influence);\r\n result.setPositions(serializationObject.positions);\r\n if (serializationObject.id != null) {\r\n result.id = serializationObject.id;\r\n }\r\n if (serializationObject.normals) {\r\n result.setNormals(serializationObject.normals);\r\n }\r\n if (serializationObject.tangents) {\r\n result.setTangents(serializationObject.tangents);\r\n }\r\n if (serializationObject.uvs) {\r\n result.setUVs(serializationObject.uvs);\r\n }\r\n // Animations\r\n if (serializationObject.animations) {\r\n for (var animationIndex = 0; animationIndex < serializationObject.animations.length; animationIndex++) {\r\n var parsedAnimation = serializationObject.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_5__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n result.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a MorphTarget from mesh data\r\n * @param mesh defines the source mesh\r\n * @param name defines the name to use for the new target\r\n * @param influence defines the influence to attach to the target\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.FromMesh = function (mesh, name, influence) {\r\n if (!name) {\r\n name = mesh.name;\r\n }\r\n var result = new MorphTarget(name, influence, mesh.getScene());\r\n result.setPositions(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].PositionKind));\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind)) {\r\n result.setNormals(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].NormalKind));\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind)) {\r\n result.setTangents(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].TangentKind));\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind)) {\r\n result.setUVs(mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__[\"VertexBuffer\"].UVKind));\r\n }\r\n return result;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_4__[\"serialize\"])()\r\n ], MorphTarget.prototype, \"id\", void 0);\r\n return MorphTarget;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Morph/morphTargetManager.ts\":\n/*!*************************************!*\\\n !*** ./Morph/morphTargetManager.ts ***!\n \\*************************************/\n/*! exports provided: MorphTargetManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return MorphTargetManager; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _morphTarget__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./morphTarget */ \"./Morph/morphTarget.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * This class is used to deform meshes using morphing between different targets\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTargetManager = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTargetManager\r\n * @param scene defines the current scene\r\n */\r\n function MorphTargetManager(scene) {\r\n if (scene === void 0) { scene = null; }\r\n this._targets = new Array();\r\n this._targetInfluenceChangedObservers = new Array();\r\n this._targetDataLayoutChangedObservers = new Array();\r\n this._activeTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](16);\r\n this._supportsNormals = false;\r\n this._supportsTangents = false;\r\n this._supportsUVs = false;\r\n this._vertexCount = 0;\r\n this._uniqueId = 0;\r\n this._tempInfluences = new Array();\r\n /**\r\n * Gets or sets a boolean indicating if normals must be morphed\r\n */\r\n this.enableNormalMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if tangents must be morphed\r\n */\r\n this.enableTangentMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if UV must be morphed\r\n */\r\n this.enableUVMorphing = true;\r\n if (!scene) {\r\n scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_2__[\"EngineStore\"].LastCreatedScene;\r\n }\r\n this._scene = scene;\r\n if (this._scene) {\r\n this._scene.morphTargetManagers.push(this);\r\n this._uniqueId = this._scene.getUniqueId();\r\n }\r\n }\r\n Object.defineProperty(MorphTargetManager.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"vertexCount\", {\r\n /**\r\n * Gets the number of vertices handled by this manager\r\n */\r\n get: function () {\r\n return this._vertexCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsNormals\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of normals\r\n */\r\n get: function () {\r\n return this._supportsNormals && this.enableNormalMorphing;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsTangents\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of tangents\r\n */\r\n get: function () {\r\n return this._supportsTangents && this.enableTangentMorphing;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsUVs\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates\r\n */\r\n get: function () {\r\n return this._supportsUVs && this.enableUVMorphing;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numTargets\", {\r\n /**\r\n * Gets the number of targets stored in this manager\r\n */\r\n get: function () {\r\n return this._targets.length;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numInfluencers\", {\r\n /**\r\n * Gets the number of influencers (ie. the number of targets with influences > 0)\r\n */\r\n get: function () {\r\n return this._activeTargets.length;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"influences\", {\r\n /**\r\n * Gets the list of influences (one per target)\r\n */\r\n get: function () {\r\n return this._influences;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the active target at specified index. An active target is a target with an influence > 0\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getActiveTarget = function (index) {\r\n return this._activeTargets.data[index];\r\n };\r\n /**\r\n * Gets the target at specified index\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getTarget = function (index) {\r\n return this._targets[index];\r\n };\r\n /**\r\n * Add a new target to this manager\r\n * @param target defines the target to add\r\n */\r\n MorphTargetManager.prototype.addTarget = function (target) {\r\n var _this = this;\r\n this._targets.push(target);\r\n this._targetInfluenceChangedObservers.push(target.onInfluenceChanged.add(function (needUpdate) {\r\n _this._syncActiveTargets(needUpdate);\r\n }));\r\n this._targetDataLayoutChangedObservers.push(target._onDataLayoutChanged.add(function () {\r\n _this._syncActiveTargets(true);\r\n }));\r\n this._syncActiveTargets(true);\r\n };\r\n /**\r\n * Removes a target from the manager\r\n * @param target defines the target to remove\r\n */\r\n MorphTargetManager.prototype.removeTarget = function (target) {\r\n var index = this._targets.indexOf(target);\r\n if (index >= 0) {\r\n this._targets.splice(index, 1);\r\n target.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(index, 1)[0]);\r\n target._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(index, 1)[0]);\r\n this._syncActiveTargets(true);\r\n }\r\n };\r\n /**\r\n * Serializes the current manager into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTargetManager.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.targets = [];\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n serializationObject.targets.push(target.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n MorphTargetManager.prototype._syncActiveTargets = function (needUpdate) {\r\n var influenceCount = 0;\r\n this._activeTargets.reset();\r\n this._supportsNormals = true;\r\n this._supportsTangents = true;\r\n this._supportsUVs = true;\r\n this._vertexCount = 0;\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (target.influence === 0) {\r\n continue;\r\n }\r\n this._activeTargets.push(target);\r\n this._tempInfluences[influenceCount++] = target.influence;\r\n this._supportsNormals = this._supportsNormals && target.hasNormals;\r\n this._supportsTangents = this._supportsTangents && target.hasTangents;\r\n this._supportsUVs = this._supportsUVs && target.hasUVs;\r\n var positions = target.getPositions();\r\n if (positions) {\r\n var vertexCount = positions.length / 3;\r\n if (this._vertexCount === 0) {\r\n this._vertexCount = vertexCount;\r\n }\r\n else if (this._vertexCount !== vertexCount) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Incompatible target. Targets must all have the same vertices count.\");\r\n return;\r\n }\r\n }\r\n }\r\n if (!this._influences || this._influences.length !== influenceCount) {\r\n this._influences = new Float32Array(influenceCount);\r\n }\r\n for (var index = 0; index < influenceCount; index++) {\r\n this._influences[index] = this._tempInfluences[index];\r\n }\r\n if (needUpdate) {\r\n this.synchronize();\r\n }\r\n };\r\n /**\r\n * Syncrhonize the targets with all the meshes using this morph target manager\r\n */\r\n MorphTargetManager.prototype.synchronize = function () {\r\n if (!this._scene) {\r\n return;\r\n }\r\n // Flag meshes as dirty to resync with the active targets\r\n for (var _i = 0, _a = this._scene.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.morphTargetManager === this) {\r\n mesh._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Creates a new MorphTargetManager from serialized data\r\n * @param serializationObject defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns the new MorphTargetManager\r\n */\r\n MorphTargetManager.Parse = function (serializationObject, scene) {\r\n var result = new MorphTargetManager(scene);\r\n result._uniqueId = serializationObject.id;\r\n for (var _i = 0, _a = serializationObject.targets; _i < _a.length; _i++) {\r\n var targetData = _a[_i];\r\n result.addTarget(_morphTarget__WEBPACK_IMPORTED_MODULE_3__[\"MorphTarget\"].Parse(targetData));\r\n }\r\n return result;\r\n };\r\n return MorphTargetManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Navigation/Plugins/index.ts\":\n/*!*************************************!*\\\n !*** ./Navigation/Plugins/index.ts ***!\n \\*************************************/\n/*! exports provided: RecastJSPlugin, RecastJSCrowd */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _recastJSPlugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./recastJSPlugin */ \"./Navigation/Plugins/recastJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _recastJSPlugin__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _recastJSPlugin__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSCrowd\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Navigation/Plugins/recastJSPlugin.ts\":\n/*!**********************************************!*\\\n !*** ./Navigation/Plugins/recastJSPlugin.ts ***!\n \\**********************************************/\n/*! exports provided: RecastJSPlugin, RecastJSCrowd */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return RecastJSPlugin; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return RecastJSCrowd; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math */ \"./Maths/math.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * RecastJS navigation plugin\r\n */\r\nvar RecastJSPlugin = /** @class */ (function () {\r\n /**\r\n * Initializes the recastJS plugin\r\n * @param recastInjection can be used to inject your own recast reference\r\n */\r\n function RecastJSPlugin(recastInjection) {\r\n if (recastInjection === void 0) { recastInjection = Recast; }\r\n /**\r\n * Reference to the Recast library\r\n */\r\n this.bjsRECAST = {};\r\n /**\r\n * plugin name\r\n */\r\n this.name = \"RecastJSPlugin\";\r\n if (typeof recastInjection === \"function\") {\r\n recastInjection(this.bjsRECAST);\r\n }\r\n else {\r\n this.bjsRECAST = recastInjection;\r\n }\r\n if (!this.isSupported()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"RecastJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n }\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigatio mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n RecastJSPlugin.prototype.createMavMesh = function (meshes, parameters) {\r\n var rc = new this.bjsRECAST.rcConfig();\r\n rc.cs = parameters.cs;\r\n rc.ch = parameters.ch;\r\n rc.borderSize = 0;\r\n rc.tileSize = 0;\r\n rc.walkableSlopeAngle = parameters.walkableSlopeAngle;\r\n rc.walkableHeight = parameters.walkableHeight;\r\n rc.walkableClimb = parameters.walkableClimb;\r\n rc.walkableRadius = parameters.walkableRadius;\r\n rc.maxEdgeLen = parameters.maxEdgeLen;\r\n rc.maxSimplificationError = parameters.maxSimplificationError;\r\n rc.minRegionArea = parameters.minRegionArea;\r\n rc.mergeRegionArea = parameters.mergeRegionArea;\r\n rc.maxVertsPerPoly = parameters.maxVertsPerPoly;\r\n rc.detailSampleDist = parameters.detailSampleDist;\r\n rc.detailSampleMaxError = parameters.detailSampleMaxError;\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n var index;\r\n var tri;\r\n var pt;\r\n var indices = [];\r\n var positions = [];\r\n var offset = 0;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n var mesh = meshes[index];\r\n var meshIndices = mesh.getIndices();\r\n if (!meshIndices) {\r\n continue;\r\n }\r\n var meshPositions = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind, false, false);\r\n if (!meshPositions) {\r\n continue;\r\n }\r\n var wm = mesh.computeWorldMatrix(false);\r\n for (tri = 0; tri < meshIndices.length; tri++) {\r\n indices.push(meshIndices[tri] + offset);\r\n }\r\n var transformed = _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var position = _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n for (pt = 0; pt < meshPositions.length; pt += 3) {\r\n _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArrayToRef(meshPositions, pt, position);\r\n _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(position, wm, transformed);\r\n positions.push(transformed.x, transformed.y, transformed.z);\r\n }\r\n offset += meshPositions.length / 3;\r\n }\r\n }\r\n this.navMesh.build(positions, offset, indices, indices.length, rc);\r\n };\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n RecastJSPlugin.prototype.createDebugNavMesh = function (scene) {\r\n var tri;\r\n var pt;\r\n var debugNavMesh = this.navMesh.getDebugNavMesh();\r\n var triangleCount = debugNavMesh.getTriangleCount();\r\n var indices = [];\r\n var positions = [];\r\n for (tri = 0; tri < triangleCount * 3; tri++) {\r\n indices.push(tri);\r\n }\r\n for (tri = 0; tri < triangleCount; tri++) {\r\n for (pt = 0; pt < 3; pt++) {\r\n var point = debugNavMesh.getTriangle(tri).getPoint(pt);\r\n positions.push(point.x, point.y, point.z);\r\n }\r\n }\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"NavMeshDebug\", scene);\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_1__[\"VertexData\"]();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.applyToMesh(mesh, false);\r\n return mesh;\r\n };\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n RecastJSPlugin.prototype.getClosestPoint = function (position) {\r\n var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);\r\n var ret = this.navMesh.getClosestPoint(p);\r\n var pr = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](ret.x, ret.y, ret.z);\r\n return pr;\r\n };\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n RecastJSPlugin.prototype.getRandomPointAround = function (position, maxRadius) {\r\n var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);\r\n var ret = this.navMesh.getRandomPointAround(p, maxRadius);\r\n var pr = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](ret.x, ret.y, ret.z);\r\n return pr;\r\n };\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n RecastJSPlugin.prototype.moveAlong = function (position, destination) {\r\n var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);\r\n var d = new this.bjsRECAST.Vec3(destination.x, destination.y, destination.z);\r\n var ret = this.navMesh.moveAlong(p, d);\r\n var pr = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](ret.x, ret.y, ret.z);\r\n return pr;\r\n };\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n RecastJSPlugin.prototype.computePath = function (start, end) {\r\n var pt;\r\n var startPos = new this.bjsRECAST.Vec3(start.x, start.y, start.z);\r\n var endPos = new this.bjsRECAST.Vec3(end.x, end.y, end.z);\r\n var navPath = this.navMesh.computePath(startPos, endPos);\r\n var pointCount = navPath.getPointCount();\r\n var positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n var p = navPath.getPoint(pt);\r\n positions.push(new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](p.x, p.y, p.z));\r\n }\r\n return positions;\r\n };\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n RecastJSPlugin.prototype.createCrowd = function (maxAgents, maxAgentRadius, scene) {\r\n var crowd = new RecastJSCrowd(this, maxAgents, maxAgentRadius, scene);\r\n return crowd;\r\n };\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n RecastJSPlugin.prototype.setDefaultQueryExtent = function (extent) {\r\n var ext = new this.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.navMesh.setDefaultQueryExtent(ext);\r\n };\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n RecastJSPlugin.prototype.getDefaultQueryExtent = function () {\r\n var p = this.navMesh.getDefaultQueryExtent();\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](p.x, p.y, p.z);\r\n };\r\n /**\r\n * Disposes\r\n */\r\n RecastJSPlugin.prototype.dispose = function () {\r\n };\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n RecastJSPlugin.prototype.isSupported = function () {\r\n return this.bjsRECAST !== undefined;\r\n };\r\n return RecastJSPlugin;\r\n}());\r\n\r\n/**\r\n * Recast detour crowd implementation\r\n */\r\nvar RecastJSCrowd = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param plugin recastJS plugin\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n function RecastJSCrowd(plugin, maxAgents, maxAgentRadius, scene) {\r\n var _this = this;\r\n /**\r\n * Link to the detour crowd\r\n */\r\n this.recastCrowd = {};\r\n /**\r\n * One transform per agent\r\n */\r\n this.transforms = new Array();\r\n /**\r\n * All agents created\r\n */\r\n this.agents = new Array();\r\n /**\r\n * Observer for crowd updates\r\n */\r\n this._onBeforeAnimationsObserver = null;\r\n this.bjsRECASTPlugin = plugin;\r\n this.recastCrowd = new this.bjsRECASTPlugin.bjsRECAST.Crowd(maxAgents, maxAgentRadius, this.bjsRECASTPlugin.navMesh.getNavMesh());\r\n this._scene = scene;\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {\r\n _this.update(scene.getEngine().getDeltaTime() * 0.001);\r\n });\r\n }\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n RecastJSCrowd.prototype.addAgent = function (pos, parameters, transform) {\r\n var agentParams = new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams();\r\n agentParams.radius = parameters.radius;\r\n agentParams.height = parameters.height;\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n agentParams.separationWeight = parameters.separationWeight;\r\n agentParams.updateFlags = 7;\r\n agentParams.obstacleAvoidanceType = 0;\r\n agentParams.queryFilterType = 0;\r\n agentParams.userData = 0;\r\n var agentIndex = this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(pos.x, pos.y, pos.z), agentParams);\r\n this.transforms.push(transform);\r\n this.agents.push(agentIndex);\r\n return agentIndex;\r\n };\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n RecastJSCrowd.prototype.getAgentPosition = function (index) {\r\n var agentPos = this.recastCrowd.getAgentPosition(index);\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](agentPos.x, agentPos.y, agentPos.z);\r\n };\r\n /**\r\n * Returns the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n RecastJSCrowd.prototype.getAgentVelocity = function (index) {\r\n var agentVel = this.recastCrowd.getAgentVelocity(index);\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](agentVel.x, agentVel.y, agentVel.z);\r\n };\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n RecastJSCrowd.prototype.agentGoto = function (index, destination) {\r\n this.recastCrowd.agentGoto(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n };\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n RecastJSCrowd.prototype.removeAgent = function (index) {\r\n this.recastCrowd.removeAgent(index);\r\n var item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this.agents.splice(item, 1);\r\n this.transforms.splice(item, 1);\r\n }\r\n };\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n RecastJSCrowd.prototype.getAgents = function () {\r\n return this.agents;\r\n };\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n RecastJSCrowd.prototype.update = function (deltaTime) {\r\n // update crowd\r\n this.recastCrowd.update(deltaTime);\r\n // update transforms\r\n for (var index = 0; index < this.agents.length; index++) {\r\n this.transforms[index].position = this.getAgentPosition(this.agents[index]);\r\n }\r\n };\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n RecastJSCrowd.prototype.setDefaultQueryExtent = function (extent) {\r\n var ext = new this.bjsRECASTPlugin.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.recastCrowd.setDefaultQueryExtent(ext);\r\n };\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n RecastJSCrowd.prototype.getDefaultQueryExtent = function () {\r\n var p = this.recastCrowd.getDefaultQueryExtent();\r\n return new _Maths_math__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](p.x, p.y, p.z);\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n RecastJSCrowd.prototype.dispose = function () {\r\n this.recastCrowd.destroy();\r\n this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n };\r\n return RecastJSCrowd;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Navigation/index.ts\":\n/*!*****************************!*\\\n !*** ./Navigation/index.ts ***!\n \\*****************************/\n/*! exports provided: RecastJSPlugin, RecastJSCrowd */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Plugins_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Plugins/index */ \"./Navigation/Plugins/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_0__[\"RecastJSCrowd\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Offline/database.ts\":\n/*!*****************************!*\\\n !*** ./Offline/database.ts ***!\n \\*****************************/\n/*! exports provided: Database */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return Database; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_tga__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/tga */ \"./Misc/tga.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Misc/webRequest */ \"./Misc/webRequest.ts\");\n\r\n\r\n\r\n\r\n\r\n// Sets the default offline provider to Babylon.js\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].OfflineProviderFactory = function (urlToScene, callbackManifestChecked, disableManifestCheck) {\r\n if (disableManifestCheck === void 0) { disableManifestCheck = false; }\r\n return new Database(urlToScene, callbackManifestChecked, disableManifestCheck);\r\n};\r\n/**\r\n * Class used to enable access to IndexedDB\r\n * @see http://doc.babylonjs.com/how_to/caching_resources_in_indexeddb\r\n */\r\nvar Database = /** @class */ (function () {\r\n /**\r\n * Creates a new Database\r\n * @param urlToScene defines the url to load the scene\r\n * @param callbackManifestChecked defines the callback to use when manifest is checked\r\n * @param disableManifestCheck defines a boolean indicating that we want to skip the manifest validation (it will be considered validated and up to date)\r\n */\r\n function Database(urlToScene, callbackManifestChecked, disableManifestCheck) {\r\n var _this = this;\r\n if (disableManifestCheck === void 0) { disableManifestCheck = false; }\r\n // Handling various flavors of prefixed version of IndexedDB\r\n this._idbFactory = (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB);\r\n this._callbackManifestChecked = callbackManifestChecked;\r\n this._currentSceneUrl = Database._ReturnFullUrlLocation(urlToScene);\r\n this._db = null;\r\n this._enableSceneOffline = false;\r\n this._enableTexturesOffline = false;\r\n this._manifestVersionFound = 0;\r\n this._mustUpdateRessources = false;\r\n this._hasReachedQuota = false;\r\n if (!Database.IDBStorageEnabled) {\r\n this._callbackManifestChecked(true);\r\n }\r\n else {\r\n if (disableManifestCheck) {\r\n this._enableSceneOffline = true;\r\n this._enableTexturesOffline = true;\r\n this._manifestVersionFound = 1;\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].SetImmediate(function () {\r\n _this._callbackManifestChecked(true);\r\n });\r\n }\r\n else {\r\n this._checkManifestFile();\r\n }\r\n }\r\n }\r\n Object.defineProperty(Database.prototype, \"enableSceneOffline\", {\r\n /**\r\n * Gets a boolean indicating if scene must be saved in the database\r\n */\r\n get: function () {\r\n return this._enableSceneOffline;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Database.prototype, \"enableTexturesOffline\", {\r\n /**\r\n * Gets a boolean indicating if textures must be saved in the database\r\n */\r\n get: function () {\r\n return this._enableTexturesOffline;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Database.prototype._checkManifestFile = function () {\r\n var _this = this;\r\n var noManifestFile = function () {\r\n _this._enableSceneOffline = false;\r\n _this._enableTexturesOffline = false;\r\n _this._callbackManifestChecked(false);\r\n };\r\n var timeStampUsed = false;\r\n var manifestURL = this._currentSceneUrl + \".manifest\";\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__[\"WebRequest\"]();\r\n if (navigator.onLine) {\r\n // Adding a timestamp to by-pass browsers' cache\r\n timeStampUsed = true;\r\n manifestURL = manifestURL + (manifestURL.match(/\\?/) == null ? \"?\" : \"&\") + Date.now();\r\n }\r\n xhr.open(\"GET\", manifestURL);\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 || Database._ValidateXHRData(xhr, 1)) {\r\n try {\r\n var manifestFile = JSON.parse(xhr.response);\r\n _this._enableSceneOffline = manifestFile.enableSceneOffline;\r\n _this._enableTexturesOffline = manifestFile.enableTexturesOffline && Database.IsUASupportingBlobStorage;\r\n if (manifestFile.version && !isNaN(parseInt(manifestFile.version))) {\r\n _this._manifestVersionFound = manifestFile.version;\r\n }\r\n if (_this._callbackManifestChecked) {\r\n _this._callbackManifestChecked(true);\r\n }\r\n }\r\n catch (ex) {\r\n noManifestFile();\r\n }\r\n }\r\n else {\r\n noManifestFile();\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n if (timeStampUsed) {\r\n timeStampUsed = false;\r\n // Let's retry without the timeStamp\r\n // It could fail when coupled with HTML5 Offline API\r\n var retryManifestURL = _this._currentSceneUrl + \".manifest\";\r\n xhr.open(\"GET\", retryManifestURL);\r\n xhr.send();\r\n }\r\n else {\r\n noManifestFile();\r\n }\r\n }, false);\r\n try {\r\n xhr.send();\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error on XHR send request.\");\r\n this._callbackManifestChecked(false);\r\n }\r\n };\r\n /**\r\n * Open the database and make it available\r\n * @param successCallback defines the callback to call on success\r\n * @param errorCallback defines the callback to call on error\r\n */\r\n Database.prototype.open = function (successCallback, errorCallback) {\r\n var _this = this;\r\n var handleError = function () {\r\n _this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n };\r\n if (!this._idbFactory || !(this._enableSceneOffline || this._enableTexturesOffline)) {\r\n // Your browser doesn't support IndexedDB\r\n this._isSupported = false;\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n }\r\n else {\r\n // If the DB hasn't been opened or created yet\r\n if (!this._db) {\r\n this._hasReachedQuota = false;\r\n this._isSupported = true;\r\n var request = this._idbFactory.open(\"babylonjs\", 1);\r\n // Could occur if user is blocking the quota for the DB and/or doesn't grant access to IndexedDB\r\n request.onerror = function () {\r\n handleError();\r\n };\r\n // executes when a version change transaction cannot complete due to other active transactions\r\n request.onblocked = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"IDB request blocked. Please reload the page.\");\r\n handleError();\r\n };\r\n // DB has been opened successfully\r\n request.onsuccess = function () {\r\n _this._db = request.result;\r\n successCallback();\r\n };\r\n // Initialization of the DB. Creating Scenes & Textures stores\r\n request.onupgradeneeded = function (event) {\r\n _this._db = (event.target).result;\r\n if (_this._db) {\r\n try {\r\n _this._db.createObjectStore(\"scenes\", { keyPath: \"sceneUrl\" });\r\n _this._db.createObjectStore(\"versions\", { keyPath: \"sceneUrl\" });\r\n _this._db.createObjectStore(\"textures\", { keyPath: \"textureUrl\" });\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error while creating object stores. Exception: \" + ex.message);\r\n handleError();\r\n }\r\n }\r\n };\r\n }\r\n // DB has already been created and opened\r\n else {\r\n if (successCallback) {\r\n successCallback();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Loads an image from the database\r\n * @param url defines the url to load from\r\n * @param image defines the target DOM image\r\n */\r\n Database.prototype.loadImage = function (url, image) {\r\n var _this = this;\r\n var completeURL = Database._ReturnFullUrlLocation(url);\r\n var saveAndLoadImage = function () {\r\n if (!_this._hasReachedQuota && _this._db !== null) {\r\n // the texture is not yet in the DB, let's try to save it\r\n _this._saveImageIntoDBAsync(completeURL, image);\r\n }\r\n // If the texture is not in the DB and we've reached the DB quota limit\r\n // let's load it directly from the web\r\n else {\r\n image.src = url;\r\n }\r\n };\r\n if (!this._mustUpdateRessources) {\r\n this._loadImageFromDBAsync(completeURL, image, saveAndLoadImage);\r\n }\r\n // First time we're download the images or update requested in the manifest file by a version change\r\n else {\r\n saveAndLoadImage();\r\n }\r\n };\r\n Database.prototype._loadImageFromDBAsync = function (url, image, notInDBCallback) {\r\n if (this._isSupported && this._db !== null) {\r\n var texture;\r\n var transaction = this._db.transaction([\"textures\"]);\r\n transaction.onabort = function () {\r\n image.src = url;\r\n };\r\n transaction.oncomplete = function () {\r\n var blobTextureURL;\r\n if (texture) {\r\n var URL = window.URL || window.webkitURL;\r\n blobTextureURL = URL.createObjectURL(texture.data);\r\n image.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading image from blob URL: \" + blobTextureURL + \" switching back to web url: \" + url);\r\n image.src = url;\r\n };\r\n image.src = blobTextureURL;\r\n }\r\n else {\r\n notInDBCallback();\r\n }\r\n };\r\n var getRequest = transaction.objectStore(\"textures\").get(url);\r\n getRequest.onsuccess = function (event) {\r\n texture = (event.target).result;\r\n };\r\n getRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading texture \" + url + \" from DB.\");\r\n image.src = url;\r\n };\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n image.src = url;\r\n }\r\n };\r\n Database.prototype._saveImageIntoDBAsync = function (url, image) {\r\n var _this = this;\r\n if (this._isSupported) {\r\n // In case of error (type not supported or quota exceeded), we're at least sending back XHR data to allow texture loading later on\r\n var generateBlobUrl = function () {\r\n var blobTextureURL;\r\n if (blob) {\r\n var URL = window.URL || window.webkitURL;\r\n try {\r\n blobTextureURL = URL.createObjectURL(blob);\r\n }\r\n // Chrome is raising a type error if we're setting the oneTimeOnly parameter\r\n catch (ex) {\r\n blobTextureURL = URL.createObjectURL(blob);\r\n }\r\n }\r\n if (blobTextureURL) {\r\n image.src = blobTextureURL;\r\n }\r\n };\r\n if (Database.IsUASupportingBlobStorage) { // Create XHR\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__[\"WebRequest\"](), blob;\r\n xhr.open(\"GET\", url);\r\n xhr.responseType = \"blob\";\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 && _this._db) {\r\n // Blob as response (XHR2)\r\n blob = xhr.response;\r\n var transaction = _this._db.transaction([\"textures\"], \"readwrite\");\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = function (event) {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n var srcElement = (event.srcElement || event.target);\r\n var error = srcElement.error;\r\n if (error && error.name === \"QuotaExceededError\") {\r\n _this._hasReachedQuota = true;\r\n }\r\n }\r\n catch (ex) { }\r\n generateBlobUrl();\r\n };\r\n transaction.oncomplete = function () {\r\n generateBlobUrl();\r\n };\r\n var newTexture = { textureUrl: url, data: blob };\r\n try {\r\n // Put the blob into the dabase\r\n var addRequest = transaction.objectStore(\"textures\").put(newTexture);\r\n addRequest.onsuccess = function () {\r\n };\r\n addRequest.onerror = function () {\r\n generateBlobUrl();\r\n };\r\n }\r\n catch (ex) {\r\n // \"DataCloneError\" generated by Chrome when you try to inject blob into IndexedDB\r\n if (ex.code === 25) {\r\n Database.IsUASupportingBlobStorage = false;\r\n _this._enableTexturesOffline = false;\r\n }\r\n image.src = url;\r\n }\r\n }\r\n else {\r\n image.src = url;\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error in XHR request in BABYLON.Database.\");\r\n image.src = url;\r\n }, false);\r\n xhr.send();\r\n }\r\n else {\r\n image.src = url;\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n image.src = url;\r\n }\r\n };\r\n Database.prototype._checkVersionFromDB = function (url, versionLoaded) {\r\n var _this = this;\r\n var updateVersion = function () {\r\n // the version is not yet in the DB or we need to update it\r\n _this._saveVersionIntoDBAsync(url, versionLoaded);\r\n };\r\n this._loadVersionFromDBAsync(url, versionLoaded, updateVersion);\r\n };\r\n Database.prototype._loadVersionFromDBAsync = function (url, callback, updateInDBCallback) {\r\n var _this = this;\r\n if (this._isSupported && this._db) {\r\n var version;\r\n try {\r\n var transaction = this._db.transaction([\"versions\"]);\r\n transaction.oncomplete = function () {\r\n if (version) {\r\n // If the version in the JSON file is different from the version in DB\r\n if (_this._manifestVersionFound !== version.data) {\r\n _this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n }\r\n else {\r\n callback(version.data);\r\n }\r\n }\r\n // version was not found in DB\r\n else {\r\n _this._mustUpdateRessources = true;\r\n updateInDBCallback();\r\n }\r\n };\r\n transaction.onabort = function () {\r\n callback(-1);\r\n };\r\n var getRequest = transaction.objectStore(\"versions\").get(url);\r\n getRequest.onsuccess = function (event) {\r\n version = (event.target).result;\r\n };\r\n getRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading version for scene \" + url + \" from DB.\");\r\n callback(-1);\r\n };\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error while accessing 'versions' object store (READ OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n callback(-1);\r\n }\r\n };\r\n Database.prototype._saveVersionIntoDBAsync = function (url, callback) {\r\n var _this = this;\r\n if (this._isSupported && !this._hasReachedQuota && this._db) {\r\n try {\r\n // Open a transaction to the database\r\n var transaction = this._db.transaction([\"versions\"], \"readwrite\");\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = function (event) {\r\n try { //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n var error = event.srcElement['error'];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n _this._hasReachedQuota = true;\r\n }\r\n }\r\n catch (ex) { }\r\n callback(-1);\r\n };\r\n transaction.oncomplete = function () {\r\n callback(_this._manifestVersionFound);\r\n };\r\n var newVersion = { sceneUrl: url, data: this._manifestVersionFound };\r\n // Put the scene into the database\r\n var addRequest = transaction.objectStore(\"versions\").put(newVersion);\r\n addRequest.onsuccess = function () {\r\n };\r\n addRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error in DB add version request in BABYLON.Database.\");\r\n };\r\n }\r\n catch (ex) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error while accessing 'versions' object store (WRITE OP). Exception: \" + ex.message);\r\n callback(-1);\r\n }\r\n }\r\n else {\r\n callback(-1);\r\n }\r\n };\r\n /**\r\n * Loads a file from database\r\n * @param url defines the URL to load from\r\n * @param sceneLoaded defines a callback to call on success\r\n * @param progressCallBack defines a callback to call when progress changed\r\n * @param errorCallback defines a callback to call on error\r\n * @param useArrayBuffer defines a boolean to use array buffer instead of text string\r\n */\r\n Database.prototype.loadFile = function (url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer) {\r\n var _this = this;\r\n var completeUrl = Database._ReturnFullUrlLocation(url);\r\n var saveAndLoadFile = function () {\r\n // the scene is not yet in the DB, let's try to save it\r\n _this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n };\r\n this._checkVersionFromDB(completeUrl, function (version) {\r\n if (version !== -1) {\r\n if (!_this._mustUpdateRessources) {\r\n _this._loadFileAsync(completeUrl, sceneLoaded, saveAndLoadFile);\r\n }\r\n else {\r\n _this._saveFileAsync(completeUrl, sceneLoaded, progressCallBack, useArrayBuffer, errorCallback);\r\n }\r\n }\r\n else {\r\n if (errorCallback) {\r\n errorCallback();\r\n }\r\n }\r\n });\r\n };\r\n Database.prototype._loadFileAsync = function (url, callback, notInDBCallback) {\r\n if (this._isSupported && this._db) {\r\n var targetStore;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n }\r\n else {\r\n targetStore = \"textures\";\r\n }\r\n var file;\r\n var transaction = this._db.transaction([targetStore]);\r\n transaction.oncomplete = function () {\r\n if (file) {\r\n callback(file.data);\r\n }\r\n // file was not found in DB\r\n else {\r\n notInDBCallback();\r\n }\r\n };\r\n transaction.onabort = function () {\r\n notInDBCallback();\r\n };\r\n var getRequest = transaction.objectStore(targetStore).get(url);\r\n getRequest.onsuccess = function (event) {\r\n file = (event.target).result;\r\n };\r\n getRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error loading file \" + url + \" from DB.\");\r\n notInDBCallback();\r\n };\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or BabylonJS Database is not open.\");\r\n callback();\r\n }\r\n };\r\n Database.prototype._saveFileAsync = function (url, callback, progressCallback, useArrayBuffer, errorCallback) {\r\n var _this = this;\r\n if (this._isSupported) {\r\n var targetStore;\r\n if (url.indexOf(\".babylon\") !== -1) {\r\n targetStore = \"scenes\";\r\n }\r\n else {\r\n targetStore = \"textures\";\r\n }\r\n // Create XHR\r\n var xhr = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_4__[\"WebRequest\"]();\r\n var fileData;\r\n xhr.open(\"GET\", url + \"?\" + Date.now());\r\n if (useArrayBuffer) {\r\n xhr.responseType = \"arraybuffer\";\r\n }\r\n if (progressCallback) {\r\n xhr.onprogress = progressCallback;\r\n }\r\n xhr.addEventListener(\"load\", function () {\r\n if (xhr.status === 200 || (xhr.status < 400 && Database._ValidateXHRData(xhr, !useArrayBuffer ? 1 : 6))) {\r\n // Blob as response (XHR2)\r\n fileData = !useArrayBuffer ? xhr.responseText : xhr.response;\r\n if (!_this._hasReachedQuota && _this._db) {\r\n // Open a transaction to the database\r\n var transaction = _this._db.transaction([targetStore], \"readwrite\");\r\n // the transaction could abort because of a QuotaExceededError error\r\n transaction.onabort = function (event) {\r\n try {\r\n //backwards compatibility with ts 1.0, srcElement doesn't have an \"error\" according to ts 1.3\r\n var error = event.srcElement['error'];\r\n if (error && error.name === \"QuotaExceededError\") {\r\n _this._hasReachedQuota = true;\r\n }\r\n }\r\n catch (ex) { }\r\n callback(fileData);\r\n };\r\n transaction.oncomplete = function () {\r\n callback(fileData);\r\n };\r\n var newFile;\r\n if (targetStore === \"scenes\") {\r\n newFile = { sceneUrl: url, data: fileData, version: _this._manifestVersionFound };\r\n }\r\n else {\r\n newFile = { textureUrl: url, data: fileData };\r\n }\r\n try {\r\n // Put the scene into the database\r\n var addRequest = transaction.objectStore(targetStore).put(newFile);\r\n addRequest.onsuccess = function () {\r\n };\r\n addRequest.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error in DB add file request in BABYLON.Database.\");\r\n };\r\n }\r\n catch (ex) {\r\n callback(fileData);\r\n }\r\n }\r\n else {\r\n callback(fileData);\r\n }\r\n }\r\n else {\r\n if (xhr.status >= 400 && errorCallback) {\r\n errorCallback(xhr);\r\n }\r\n else {\r\n callback();\r\n }\r\n }\r\n }, false);\r\n xhr.addEventListener(\"error\", function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"error on XHR request.\");\r\n callback();\r\n }, false);\r\n xhr.send();\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"Error: IndexedDB not supported by your browser or Babylon.js Database is not open.\");\r\n callback();\r\n }\r\n };\r\n /**\r\n * Validates if xhr data is correct\r\n * @param xhr defines the request to validate\r\n * @param dataType defines the expected data type\r\n * @returns true if data is correct\r\n */\r\n Database._ValidateXHRData = function (xhr, dataType) {\r\n // 1 for text (.babylon, manifest and shaders), 2 for TGA, 4 for DDS, 7 for all\r\n if (dataType === void 0) { dataType = 7; }\r\n try {\r\n if (dataType & 1) {\r\n if (xhr.responseText && xhr.responseText.length > 0) {\r\n return true;\r\n }\r\n else if (dataType === 1) {\r\n return false;\r\n }\r\n }\r\n if (dataType & 2) {\r\n // Check header width and height since there is no \"TGA\" magic number\r\n var tgaHeader = _Misc_tga__WEBPACK_IMPORTED_MODULE_2__[\"TGATools\"].GetTGAHeader(xhr.response);\r\n if (tgaHeader.width && tgaHeader.height && tgaHeader.width > 0 && tgaHeader.height > 0) {\r\n return true;\r\n }\r\n else if (dataType === 2) {\r\n return false;\r\n }\r\n }\r\n if (dataType & 4) {\r\n // Check for the \"DDS\" magic number\r\n var ddsHeader = new Uint8Array(xhr.response, 0, 3);\r\n if (ddsHeader[0] === 68 && ddsHeader[1] === 68 && ddsHeader[2] === 83) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Global protection\r\n }\r\n return false;\r\n };\r\n /** Gets a boolean indicating if the user agent supports blob storage (this value will be updated after creating the first Database object) */\r\n Database.IsUASupportingBlobStorage = true;\r\n /**\r\n * Gets a boolean indicating if Database storate is enabled (off by default)\r\n */\r\n Database.IDBStorageEnabled = false;\r\n Database._ParseURL = function (url) {\r\n var a = document.createElement('a');\r\n a.href = url;\r\n var urlWithoutHash = url.substring(0, url.lastIndexOf(\"#\"));\r\n var fileName = url.substring(urlWithoutHash.lastIndexOf(\"/\") + 1, url.length);\r\n var absLocation = url.substring(0, url.indexOf(fileName, 0));\r\n return absLocation;\r\n };\r\n Database._ReturnFullUrlLocation = function (url) {\r\n if (url.indexOf(\"http:/\") === -1 && url.indexOf(\"https:/\") === -1) {\r\n return (Database._ParseURL(window.location.href) + url);\r\n }\r\n else {\r\n return url;\r\n }\r\n };\r\n return Database;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Offline/index.ts\":\n/*!**************************!*\\\n !*** ./Offline/index.ts ***!\n \\**************************/\n/*! exports provided: Database */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _database__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./database */ \"./Offline/database.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return _database__WEBPACK_IMPORTED_MODULE_0__[\"Database\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/boxParticleEmitter.ts\":\n/*!******************************************************!*\\\n !*** ./Particles/EmitterTypes/boxParticleEmitter.ts ***!\n \\******************************************************/\n/*! exports provided: BoxParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return BoxParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a box.\r\n * It emits the particles randomly between 2 given directions.\r\n */\r\nvar BoxParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance BoxParticleEmitter\r\n */\r\n function BoxParticleEmitter() {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n /**\r\n * Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n */\r\n this.minEmitBox = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](-0.5, -0.5, -0.5);\r\n /**\r\n * Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n */\r\n this.maxEmitBox = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0.5, 0.5, 0.5);\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n BoxParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n BoxParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.minEmitBox.x, this.maxEmitBox.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.minEmitBox.y, this.maxEmitBox.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.minEmitBox.z, this.maxEmitBox.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n BoxParticleEmitter.prototype.clone = function () {\r\n var newOne = new BoxParticleEmitter();\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n BoxParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n effect.setVector3(\"minEmitBox\", this.minEmitBox);\r\n effect.setVector3(\"maxEmitBox\", this.maxEmitBox);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n BoxParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define BOXEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"BoxParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n BoxParticleEmitter.prototype.getClassName = function () {\r\n return \"BoxParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n BoxParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n serializationObject.minEmitBox = this.minEmitBox.asArray();\r\n serializationObject.maxEmitBox = this.maxEmitBox.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n BoxParticleEmitter.prototype.parse = function (serializationObject) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction1, 0, this.direction1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction2, 0, this.direction2);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.minEmitBox, 0, this.minEmitBox);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.maxEmitBox, 0, this.maxEmitBox);\r\n };\r\n return BoxParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/coneParticleEmitter.ts\":\n/*!*******************************************************!*\\\n !*** ./Particles/EmitterTypes/coneParticleEmitter.ts ***!\n \\*******************************************************/\n/*! exports provided: ConeParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return ConeParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cone.\r\n * It emits the particles alongside the cone volume from the base to the particle.\r\n * The emission direction might be randomized.\r\n */\r\nvar ConeParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance ConeParticleEmitter\r\n * @param radius the radius of the emission cone (1 by default)\r\n * @param angle the cone base angle (PI by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1] (default is 0)\r\n */\r\n function ConeParticleEmitter(radius, angle, \r\n /** defines how much to randomize the particle direction [0-1] (default is 0) */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (angle === void 0) { angle = Math.PI; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.directionRandomizer = directionRandomizer;\r\n /**\r\n * Gets or sets a value indicating where on the radius the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n this.radiusRange = 1;\r\n /**\r\n * Gets or sets a value indicating where on the height the start position should be picked (1 = everywhere, 0 = only surface)\r\n */\r\n this.heightRange = 1;\r\n /**\r\n * Gets or sets a value indicating if all the particles should be emitted from the spawn point only (the base of the cone)\r\n */\r\n this.emitFromSpawnPointOnly = false;\r\n this.angle = angle;\r\n this.radius = radius;\r\n }\r\n Object.defineProperty(ConeParticleEmitter.prototype, \"radius\", {\r\n /**\r\n * Gets or sets the radius of the emission cone\r\n */\r\n get: function () {\r\n return this._radius;\r\n },\r\n set: function (value) {\r\n this._radius = value;\r\n this._buildHeight();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ConeParticleEmitter.prototype, \"angle\", {\r\n /**\r\n * Gets or sets the angle of the emission cone\r\n */\r\n get: function () {\r\n return this._angle;\r\n },\r\n set: function (value) {\r\n this._angle = value;\r\n this._buildHeight();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ConeParticleEmitter.prototype._buildHeight = function () {\r\n if (this._angle !== 0) {\r\n this._height = this._radius / Math.tan(this._angle / 2);\r\n }\r\n else {\r\n this._height = 1;\r\n }\r\n };\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n ConeParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n if (Math.abs(Math.cos(this._angle)) === 1.0) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(0, 1.0, 0, worldMatrix, directionToUpdate);\r\n }\r\n else {\r\n // measure the direction Vector from the emitter to the particle.\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n }\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n ConeParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var s = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, Math.PI * 2);\r\n var h;\r\n if (!this.emitFromSpawnPointOnly) {\r\n h = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.heightRange);\r\n // Better distribution in a cone at normal angles.\r\n h = 1 - h * h;\r\n }\r\n else {\r\n h = 0.0001;\r\n }\r\n var radius = this._radius - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this._radius * this.radiusRange);\r\n radius = radius * h;\r\n var randX = radius * Math.sin(s);\r\n var randZ = radius * Math.cos(s);\r\n var randY = h * this._height;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n ConeParticleEmitter.prototype.clone = function () {\r\n var newOne = new ConeParticleEmitter(this._radius, this._angle, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n ConeParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat2(\"radius\", this._radius, this.radiusRange);\r\n effect.setFloat(\"coneAngle\", this._angle);\r\n effect.setFloat2(\"height\", this._height, this.heightRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n ConeParticleEmitter.prototype.getEffectDefines = function () {\r\n var defines = \"#define CONEEMITTER\";\r\n if (this.emitFromSpawnPointOnly) {\r\n defines += \"\\n#define CONEEMITTERSPAWNPOINT\";\r\n }\r\n return defines;\r\n };\r\n /**\r\n * Returns the string \"ConeParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n ConeParticleEmitter.prototype.getClassName = function () {\r\n return \"ConeParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n ConeParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this._radius;\r\n serializationObject.angle = this._angle;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n ConeParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.angle = serializationObject.angle;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return ConeParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/cylinderParticleEmitter.ts\":\n/*!***********************************************************!*\\\n !*** ./Particles/EmitterTypes/cylinderParticleEmitter.ts ***!\n \\***********************************************************/\n/*! exports provided: CylinderParticleEmitter, CylinderDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return CylinderParticleEmitter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return CylinderDirectedParticleEmitter; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles alongside the cylinder radius. The emission direction might be randomized.\r\n */\r\nvar CylinderParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance CylinderParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n function CylinderParticleEmitter(\r\n /**\r\n * The radius of the emission cylinder.\r\n */\r\n radius, \r\n /**\r\n * The height of the emission cylinder.\r\n */\r\n height, \r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n radiusRange, \r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.radius = radius;\r\n this.height = height;\r\n this.radiusRange = radiusRange;\r\n this.directionRandomizer = directionRandomizer;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n CylinderParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(-this.directionRandomizer / 2, this.directionRandomizer / 2);\r\n var angle = Math.atan2(direction.x, direction.z);\r\n angle += _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(-Math.PI / 2, Math.PI / 2) * this.directionRandomizer;\r\n direction.y = randY; // set direction y to rand y to mirror normal of cylinder surface\r\n direction.x = Math.sin(angle);\r\n direction.z = Math.cos(angle);\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n CylinderParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var yPos = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(-this.height / 2, this.height / 2);\r\n var angle = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 2 * Math.PI);\r\n // Pick a properly distributed point within the circle https://programming.guide/random-point-within-circle.html\r\n var radiusDistribution = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange((1 - this.radiusRange) * (1 - this.radiusRange), 1);\r\n var positionRadius = Math.sqrt(radiusDistribution) * this.radius;\r\n var xPos = positionRadius * Math.cos(angle);\r\n var zPos = positionRadius * Math.sin(angle);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n CylinderParticleEmitter.prototype.clone = function () {\r\n var newOne = new CylinderParticleEmitter(this.radius, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n CylinderParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"height\", this.height);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n CylinderParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define CYLINDEREMITTER\";\r\n };\r\n /**\r\n * Returns the string \"CylinderParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n CylinderParticleEmitter.prototype.getClassName = function () {\r\n return \"CylinderParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n CylinderParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.height = this.height;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n CylinderParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.height = serializationObject.height;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return CylinderParticleEmitter;\r\n}());\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nvar CylinderDirectedParticleEmitter = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CylinderDirectedParticleEmitter, _super);\r\n /**\r\n * Creates a new instance CylinderDirectedParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n function CylinderDirectedParticleEmitter(radius, height, radiusRange, \r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n direction1, \r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n var _this = _super.call(this, radius, height, radiusRange) || this;\r\n _this.direction1 = direction1;\r\n _this.direction2 = direction2;\r\n return _this;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n CylinderDirectedParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n CylinderDirectedParticleEmitter.prototype.clone = function () {\r\n var newOne = new CylinderDirectedParticleEmitter(this.radius, this.height, this.radiusRange, this.direction1, this.direction2);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n CylinderDirectedParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"height\", this.height);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n CylinderDirectedParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define CYLINDEREMITTER\\n#define DIRECTEDCYLINDEREMITTER\";\r\n };\r\n /**\r\n * Returns the string \"CylinderDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n CylinderDirectedParticleEmitter.prototype.getClassName = function () {\r\n return \"CylinderDirectedParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n CylinderDirectedParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n CylinderDirectedParticleEmitter.prototype.parse = function (serializationObject) {\r\n _super.prototype.parse.call(this, serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n };\r\n return CylinderDirectedParticleEmitter;\r\n}(CylinderParticleEmitter));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/hemisphericParticleEmitter.ts\":\n/*!**************************************************************!*\\\n !*** ./Particles/EmitterTypes/hemisphericParticleEmitter.ts ***!\n \\**************************************************************/\n/*! exports provided: HemisphericParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return HemisphericParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a hemisphere.\r\n * It emits the particles alongside the hemisphere radius. The emission direction might be randomized.\r\n */\r\nvar HemisphericParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance HemisphericParticleEmitter\r\n * @param radius the radius of the emission hemisphere (1 by default)\r\n * @param radiusRange the range of the emission hemisphere [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n function HemisphericParticleEmitter(\r\n /**\r\n * The radius of the emission hemisphere.\r\n */\r\n radius, \r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n radiusRange, \r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.radius = radius;\r\n this.radiusRange = radiusRange;\r\n this.directionRandomizer = directionRandomizer;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n HemisphericParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n HemisphericParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var randRadius = this.radius - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.radius * this.radiusRange);\r\n var v = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 1.0);\r\n var phi = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 2 * Math.PI);\r\n var theta = Math.acos(2 * v - 1);\r\n var randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n var randY = randRadius * Math.cos(theta);\r\n var randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, Math.abs(randY), randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n HemisphericParticleEmitter.prototype.clone = function () {\r\n var newOne = new HemisphericParticleEmitter(this.radius, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n HemisphericParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n HemisphericParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define HEMISPHERICEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"HemisphericParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n HemisphericParticleEmitter.prototype.getClassName = function () {\r\n return \"HemisphericParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n HemisphericParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n HemisphericParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return HemisphericParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/index.ts\":\n/*!*****************************************!*\\\n !*** ./Particles/EmitterTypes/index.ts ***!\n \\*****************************************/\n/*! exports provided: BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boxParticleEmitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boxParticleEmitter */ \"./Particles/EmitterTypes/boxParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _boxParticleEmitter__WEBPACK_IMPORTED_MODULE_0__[\"BoxParticleEmitter\"]; });\n\n/* harmony import */ var _coneParticleEmitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coneParticleEmitter */ \"./Particles/EmitterTypes/coneParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _coneParticleEmitter__WEBPACK_IMPORTED_MODULE_1__[\"ConeParticleEmitter\"]; });\n\n/* harmony import */ var _cylinderParticleEmitter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cylinderParticleEmitter */ \"./Particles/EmitterTypes/cylinderParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _cylinderParticleEmitter__WEBPACK_IMPORTED_MODULE_2__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _cylinderParticleEmitter__WEBPACK_IMPORTED_MODULE_2__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony import */ var _hemisphericParticleEmitter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hemisphericParticleEmitter */ \"./Particles/EmitterTypes/hemisphericParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _hemisphericParticleEmitter__WEBPACK_IMPORTED_MODULE_3__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony import */ var _pointParticleEmitter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pointParticleEmitter */ \"./Particles/EmitterTypes/pointParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _pointParticleEmitter__WEBPACK_IMPORTED_MODULE_4__[\"PointParticleEmitter\"]; });\n\n/* harmony import */ var _sphereParticleEmitter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./sphereParticleEmitter */ \"./Particles/EmitterTypes/sphereParticleEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _sphereParticleEmitter__WEBPACK_IMPORTED_MODULE_5__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _sphereParticleEmitter__WEBPACK_IMPORTED_MODULE_5__[\"SphereDirectedParticleEmitter\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/pointParticleEmitter.ts\":\n/*!********************************************************!*\\\n !*** ./Particles/EmitterTypes/pointParticleEmitter.ts ***!\n \\********************************************************/\n/*! exports provided: PointParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return PointParticleEmitter; });\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from a point.\r\n * It emits the particles randomly between 2 given directions.\r\n */\r\nvar PointParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PointParticleEmitter\r\n */\r\n function PointParticleEmitter() {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n */\r\n this.direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1.0, 0);\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n PointParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n PointParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(0, 0, 0, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n PointParticleEmitter.prototype.clone = function () {\r\n var newOne = new PointParticleEmitter();\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_0__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n PointParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n PointParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define POINTEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"PointParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n PointParticleEmitter.prototype.getClassName = function () {\r\n return \"PointParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n PointParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n PointParticleEmitter.prototype.parse = function (serializationObject) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction1, 0, this.direction1);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArrayToRef(serializationObject.direction2, 0, this.direction2);\r\n };\r\n return PointParticleEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/EmitterTypes/sphereParticleEmitter.ts\":\n/*!*********************************************************!*\\\n !*** ./Particles/EmitterTypes/sphereParticleEmitter.ts ***!\n \\*********************************************************/\n/*! exports provided: SphereParticleEmitter, SphereDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return SphereParticleEmitter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return SphereDirectedParticleEmitter; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles alongside the sphere radius. The emission direction might be randomized.\r\n */\r\nvar SphereParticleEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a new instance SphereParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param radiusRange the range of the emission sphere [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n function SphereParticleEmitter(\r\n /**\r\n * The radius of the emission sphere.\r\n */\r\n radius, \r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n radiusRange, \r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n this.radius = radius;\r\n this.radiusRange = radiusRange;\r\n this.directionRandomizer = directionRandomizer;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n SphereParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n */\r\n SphereParticleEmitter.prototype.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {\r\n var randRadius = this.radius - _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, this.radius * this.radiusRange);\r\n var v = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 1.0);\r\n var phi = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(0, 2 * Math.PI);\r\n var theta = Math.acos(2 * v - 1);\r\n var randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n var randY = randRadius * Math.cos(theta);\r\n var randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n SphereParticleEmitter.prototype.clone = function () {\r\n var newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n SphereParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n SphereParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define SPHEREEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"SphereParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n SphereParticleEmitter.prototype.getClassName = function () {\r\n return \"SphereParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n SphereParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n SphereParticleEmitter.prototype.parse = function (serializationObject) {\r\n this.radius = serializationObject.radius;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n };\r\n return SphereParticleEmitter;\r\n}());\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nvar SphereDirectedParticleEmitter = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SphereDirectedParticleEmitter, _super);\r\n /**\r\n * Creates a new instance SphereDirectedParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n function SphereDirectedParticleEmitter(radius, \r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n direction1, \r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](0, 1, 0); }\r\n var _this = _super.call(this, radius) || this;\r\n _this.direction1 = direction1;\r\n _this.direction2 = direction2;\r\n return _this;\r\n }\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n */\r\n SphereDirectedParticleEmitter.prototype.startDirectionFunction = function (worldMatrix, directionToUpdate, particle) {\r\n var randX = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.x, this.direction2.x);\r\n var randY = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.y, this.direction2.y);\r\n var randZ = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].RandomRange(this.direction1.z, this.direction2.z);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n };\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n SphereDirectedParticleEmitter.prototype.clone = function () {\r\n var newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_3__[\"DeepCopier\"].DeepCopy(this, newOne);\r\n return newOne;\r\n };\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param effect defines the update shader\r\n */\r\n SphereDirectedParticleEmitter.prototype.applyToShader = function (effect) {\r\n effect.setFloat(\"radius\", this.radius);\r\n effect.setFloat(\"radiusRange\", this.radiusRange);\r\n effect.setVector3(\"direction1\", this.direction1);\r\n effect.setVector3(\"direction2\", this.direction2);\r\n };\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containng the defines string\r\n */\r\n SphereDirectedParticleEmitter.prototype.getEffectDefines = function () {\r\n return \"#define SPHEREEMITTER\\n#define DIRECTEDSPHEREEMITTER\";\r\n };\r\n /**\r\n * Returns the string \"SphereDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n SphereDirectedParticleEmitter.prototype.getClassName = function () {\r\n return \"SphereDirectedParticleEmitter\";\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n SphereDirectedParticleEmitter.prototype.serialize = function () {\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n SphereDirectedParticleEmitter.prototype.parse = function (serializationObject) {\r\n _super.prototype.parse.call(this, serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n };\r\n return SphereDirectedParticleEmitter;\r\n}(SphereParticleEmitter));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/baseParticleSystem.ts\":\n/*!*****************************************!*\\\n !*** ./Particles/baseParticleSystem.ts ***!\n \\*****************************************/\n/*! exports provided: BaseParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return BaseParticleSystem; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Particles/EmitterTypes/index */ \"./Particles/EmitterTypes/index.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents the base class for particle system in Babylon.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.\r\n * @example https://doc.babylonjs.com/babylon101/particles\r\n */\r\nvar BaseParticleSystem = /** @class */ (function () {\r\n /**\r\n * Instantiates a particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n */\r\n function BaseParticleSystem(name) {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n this.animations = [];\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n this.renderingGroupId = 0;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n this.emitter = null;\r\n /**\r\n * The maximum number of particles to emit per frame\r\n */\r\n this.emitRate = 10;\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n this.manualEmitCount = -1;\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n this.updateSpeed = 0.01;\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n this.targetStopDuration = 0;\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n this.disposeOnStop = false;\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n this.minEmitPower = 1;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n this.maxEmitPower = 1;\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n this.minLifeTime = 1;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n this.maxLifeTime = 1;\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n this.minSize = 1;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n this.maxSize = 1;\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n this.minScaleX = 1;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n this.maxScaleX = 1;\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n this.minScaleY = 1;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n this.maxScaleY = 1;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n this.minInitialRotation = 0;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n this.maxInitialRotation = 0;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n this.minAngularSpeed = 0;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n this.maxAngularSpeed = 0;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * This can help using your own shader to render the particle system.\r\n * The according effect will be created\r\n */\r\n this.customShader = null;\r\n /**\r\n * By default particle system starts as soon as they are created. This prevents the\r\n * automatic start to happen and let you decide when to start emitting particles.\r\n */\r\n this.preventAutoStart = false;\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n this.noiseStrength = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](10, 10, 10);\r\n /**\r\n * Callback triggered when the particle animation is ending.\r\n */\r\n this.onAnimationEnd = null;\r\n /**\r\n * Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE or ParticleSystem.BLENDMODE_STANDARD.\r\n */\r\n this.blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n /**\r\n * Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls\r\n * to override the particles.\r\n */\r\n this.forceDepthWrite = false;\r\n /** Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0 */\r\n this.preWarmCycles = 0;\r\n /** Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1) */\r\n this.preWarmStepOffset = 1;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n this.spriteCellChangeSpeed = 1;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n this.startSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n this.endSpriteCellID = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n this.spriteCellWidth = 0;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n this.spriteCellHeight = 0;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n this.spriteRandomStartCell = false;\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n this.translationPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](0, 0);\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n this.beginAnimationOnStart = false;\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n this.beginAnimationFrom = 0;\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n this.beginAnimationTo = 60;\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n this.beginAnimationLoop = false;\r\n /**\r\n * Gets or sets a world offset applied to all particles\r\n */\r\n this.worldOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n this.gravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._colorGradients = null;\r\n this._sizeGradients = null;\r\n this._lifeTimeGradients = null;\r\n this._angularSpeedGradients = null;\r\n this._velocityGradients = null;\r\n this._limitVelocityGradients = null;\r\n this._dragGradients = null;\r\n this._emitRateGradients = null;\r\n this._startSizeGradients = null;\r\n this._rampGradients = null;\r\n this._colorRemapGradients = null;\r\n this._alphaRemapGradients = null;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n this.startDelay = 0;\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n this.limitVelocityDamping = 0.4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n this.color1 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors\r\n */\r\n this.color2 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * Color the particle will have at the end of its lifetime\r\n */\r\n this.colorDead = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](0, 0, 0, 1.0);\r\n /**\r\n * An optional mask to filter some colors out of the texture, or filter a part of the alpha channel\r\n */\r\n this.textureMask = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /** @hidden */\r\n this._isSubEmitter = false;\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n this.billboardMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].PARTICLES_BILLBOARDMODE_ALL;\r\n this._isBillboardBased = true;\r\n /**\r\n * Local cache of defines for image processing.\r\n */\r\n this._imageProcessingConfigurationDefines = new _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_1__[\"ImageProcessingConfigurationDefines\"]();\r\n this.id = name;\r\n this.name = name;\r\n }\r\n Object.defineProperty(BaseParticleSystem.prototype, \"noiseTexture\", {\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n get: function () {\r\n return this._noiseTexture;\r\n },\r\n set: function (value) {\r\n if (this._noiseTexture === value) {\r\n return;\r\n }\r\n this._noiseTexture = value;\r\n this._reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"isAnimationSheetEnabled\", {\r\n /**\r\n * Gets or sets whether an animation sprite sheet is enabled or not on the particle system\r\n */\r\n get: function () {\r\n return this._isAnimationSheetEnabled;\r\n },\r\n set: function (value) {\r\n if (this._isAnimationSheetEnabled == value) {\r\n return;\r\n }\r\n this._isAnimationSheetEnabled = value;\r\n this._reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n BaseParticleSystem.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n BaseParticleSystem.prototype._hasTargetStopDurationDependantGradient = function () {\r\n return (this._startSizeGradients && this._startSizeGradients.length > 0)\r\n || (this._emitRateGradients && this._emitRateGradients.length > 0)\r\n || (this._lifeTimeGradients && this._lifeTimeGradients.length > 0);\r\n };\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to udpate this list\r\n * @returns the list of drag gradients\r\n */\r\n BaseParticleSystem.prototype.getDragGradients = function () {\r\n return this._dragGradients;\r\n };\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to udpate this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n BaseParticleSystem.prototype.getLimitVelocityGradients = function () {\r\n return this._limitVelocityGradients;\r\n };\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to udpate this list\r\n * @returns the list of color gradients\r\n */\r\n BaseParticleSystem.prototype.getColorGradients = function () {\r\n return this._colorGradients;\r\n };\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to udpate this list\r\n * @returns the list of size gradients\r\n */\r\n BaseParticleSystem.prototype.getSizeGradients = function () {\r\n return this._sizeGradients;\r\n };\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to udpate this list\r\n * @returns the list of color remap gradients\r\n */\r\n BaseParticleSystem.prototype.getColorRemapGradients = function () {\r\n return this._colorRemapGradients;\r\n };\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to udpate this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n BaseParticleSystem.prototype.getAlphaRemapGradients = function () {\r\n return this._alphaRemapGradients;\r\n };\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to udpate this list\r\n * @returns the list of life time gradients\r\n */\r\n BaseParticleSystem.prototype.getLifeTimeGradients = function () {\r\n return this._lifeTimeGradients;\r\n };\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to udpate this list\r\n * @returns the list of angular speed gradients\r\n */\r\n BaseParticleSystem.prototype.getAngularSpeedGradients = function () {\r\n return this._angularSpeedGradients;\r\n };\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to udpate this list\r\n * @returns the list of velocity gradients\r\n */\r\n BaseParticleSystem.prototype.getVelocityGradients = function () {\r\n return this._velocityGradients;\r\n };\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to udpate this list\r\n * @returns the list of start size gradients\r\n */\r\n BaseParticleSystem.prototype.getStartSizeGradients = function () {\r\n return this._startSizeGradients;\r\n };\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to udpate this list\r\n * @returns the list of emit rate gradients\r\n */\r\n BaseParticleSystem.prototype.getEmitRateGradients = function () {\r\n return this._emitRateGradients;\r\n };\r\n Object.defineProperty(BaseParticleSystem.prototype, \"direction1\", {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.direction1) {\r\n return this.particleEmitterType.direction1;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.direction1) {\r\n this.particleEmitterType.direction1 = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"direction2\", {\r\n /**\r\n * Random direction of each particle after it has been emitted, between direction1 and direction2 vectors.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.direction2) {\r\n return this.particleEmitterType.direction2;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.direction2) {\r\n this.particleEmitterType.direction2 = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"minEmitBox\", {\r\n /**\r\n * Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.minEmitBox) {\r\n return this.particleEmitterType.minEmitBox;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.minEmitBox) {\r\n this.particleEmitterType.minEmitBox = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"maxEmitBox\", {\r\n /**\r\n * Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so.\r\n * This only works when particleEmitterTyps is a BoxParticleEmitter\r\n */\r\n get: function () {\r\n if (this.particleEmitterType.maxEmitBox) {\r\n return this.particleEmitterType.maxEmitBox;\r\n }\r\n return _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n },\r\n set: function (value) {\r\n if (this.particleEmitterType.maxEmitBox) {\r\n this.particleEmitterType.maxEmitBox = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"isBillboardBased\", {\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n get: function () {\r\n return this._isBillboardBased;\r\n },\r\n set: function (value) {\r\n if (this._isBillboardBased === value) {\r\n return;\r\n }\r\n this._isBillboardBased = value;\r\n this._reset();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseParticleSystem.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n BaseParticleSystem.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this._scene.imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n };\r\n /** @hidden */\r\n BaseParticleSystem.prototype._reset = function () {\r\n };\r\n /** @hidden */\r\n BaseParticleSystem.prototype._removeGradientAndTexture = function (gradient, gradients, texture) {\r\n if (!gradients) {\r\n return this;\r\n }\r\n var index = 0;\r\n for (var _i = 0, gradients_1 = gradients; _i < gradients_1.length; _i++) {\r\n var valueGradient = gradients_1[_i];\r\n if (valueGradient.gradient === gradient) {\r\n gradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n if (texture) {\r\n texture.dispose();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createPointEmitter = function (direction1, direction2) {\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"PointParticleEmitter\"]();\r\n particleEmitter.direction1 = direction1;\r\n particleEmitter.direction2 = direction2;\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createHemisphericEmitter = function (radius, radiusRange) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"HemisphericParticleEmitter\"](radius, radiusRange);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createSphereEmitter = function (radius, radiusRange) {\r\n if (radius === void 0) { radius = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"SphereParticleEmitter\"](radius, radiusRange);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createDirectedSphereEmitter = function (radius, direction1, direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"SphereDirectedParticleEmitter\"](radius, direction1, direction2);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createCylinderEmitter = function (radius, height, radiusRange, directionRandomizer) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (directionRandomizer === void 0) { directionRandomizer = 0; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"CylinderParticleEmitter\"](radius, height, radiusRange, directionRandomizer);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createDirectedCylinderEmitter = function (radius, height, radiusRange, direction1, direction2) {\r\n if (radius === void 0) { radius = 1; }\r\n if (height === void 0) { height = 1; }\r\n if (radiusRange === void 0) { radiusRange = 1; }\r\n if (direction1 === void 0) { direction1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n if (direction2 === void 0) { direction2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 1.0, 0); }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"CylinderDirectedParticleEmitter\"](radius, height, radiusRange, direction1, direction2);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createConeEmitter = function (radius, angle) {\r\n if (radius === void 0) { radius = 1; }\r\n if (angle === void 0) { angle = Math.PI / 4; }\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"ConeParticleEmitter\"](radius, angle);\r\n this.particleEmitterType = particleEmitter;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n BaseParticleSystem.prototype.createBoxEmitter = function (direction1, direction2, minEmitBox, maxEmitBox) {\r\n var particleEmitter = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_2__[\"BoxParticleEmitter\"]();\r\n this.particleEmitterType = particleEmitter;\r\n this.direction1 = direction1;\r\n this.direction2 = direction2;\r\n this.minEmitBox = minEmitBox;\r\n this.maxEmitBox = maxEmitBox;\r\n return particleEmitter;\r\n };\r\n /**\r\n * Source color is added to the destination color without alpha affecting the result\r\n */\r\n BaseParticleSystem.BLENDMODE_ONEONE = 0;\r\n /**\r\n * Blend current color and particle color using particle’s alpha\r\n */\r\n BaseParticleSystem.BLENDMODE_STANDARD = 1;\r\n /**\r\n * Add current color and particle color multiplied by particle’s alpha\r\n */\r\n BaseParticleSystem.BLENDMODE_ADD = 2;\r\n /**\r\n * Multiply current color with particle color\r\n */\r\n BaseParticleSystem.BLENDMODE_MULTIPLY = 3;\r\n /**\r\n * Multiply current color with particle color then add current color and particle color multiplied by particle’s alpha\r\n */\r\n BaseParticleSystem.BLENDMODE_MULTIPLYADD = 4;\r\n return BaseParticleSystem;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/gpuParticleSystem.ts\":\n/*!****************************************!*\\\n !*** ./Particles/gpuParticleSystem.ts ***!\n \\****************************************/\n/*! exports provided: GPUParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return GPUParticleSystem; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/gradients */ \"./Misc/gradients.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _baseParticleSystem__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./baseParticleSystem */ \"./Particles/baseParticleSystem.ts\");\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _Particles_EmitterTypes_boxParticleEmitter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Particles/EmitterTypes/boxParticleEmitter */ \"./Particles/EmitterTypes/boxParticleEmitter.ts\");\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Materials/Textures/rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Shaders_gpuUpdateParticles_fragment__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Shaders/gpuUpdateParticles.fragment */ \"./Shaders/gpuUpdateParticles.fragment.ts\");\n/* harmony import */ var _Shaders_gpuUpdateParticles_vertex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Shaders/gpuUpdateParticles.vertex */ \"./Shaders/gpuUpdateParticles.vertex.ts\");\n/* harmony import */ var _Shaders_gpuRenderParticles_fragment__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../Shaders/gpuRenderParticles.fragment */ \"./Shaders/gpuRenderParticles.fragment.ts\");\n/* harmony import */ var _Shaders_gpuRenderParticles_vertex__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../Shaders/gpuRenderParticles.vertex */ \"./Shaders/gpuRenderParticles.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a GPU particle system in Babylon\r\n * This is the fastest particle system in Babylon as it uses the GPU to update the individual particle data\r\n * @see https://www.babylonjs-playground.com/#PU4WYI#4\r\n */\r\nvar GPUParticleSystem = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GPUParticleSystem, _super);\r\n /**\r\n * Instantiates a GPU particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n * @param options The options used to create the system\r\n * @param scene The scene the particle system belongs to\r\n * @param isAnimationSheetEnabled Must be true if using a spritesheet to animate the particles texture\r\n */\r\n function GPUParticleSystem(name, options, scene, isAnimationSheetEnabled) {\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n var _this = _super.call(this, name) || this;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n _this.layerMask = 0x0FFFFFFF;\r\n _this._accumulatedCount = 0;\r\n _this._targetIndex = 0;\r\n _this._currentRenderId = -1;\r\n _this._started = false;\r\n _this._stopped = false;\r\n _this._timeDelta = 0;\r\n _this._actualFrame = 0;\r\n _this._rawTextureWidth = 256;\r\n /**\r\n * An event triggered when the system is disposed.\r\n */\r\n _this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n /**\r\n * Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls\r\n * to override the particles.\r\n */\r\n _this.forceDepthWrite = false;\r\n _this._preWarmDone = false;\r\n _this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__[\"EngineStore\"].LastCreatedScene;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this._engine = _this._scene.getEngine();\r\n if (!options.randomTextureSize) {\r\n delete options.randomTextureSize;\r\n }\r\n var fullOptions = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({ capacity: 50000, randomTextureSize: _this._engine.getCaps().maxTextureSize }, options);\r\n var optionsAsNumber = options;\r\n if (isFinite(optionsAsNumber)) {\r\n fullOptions.capacity = optionsAsNumber;\r\n }\r\n _this._capacity = fullOptions.capacity;\r\n _this._activeCount = fullOptions.capacity;\r\n _this._currentActiveCount = 0;\r\n _this._isAnimationSheetEnabled = isAnimationSheetEnabled;\r\n _this._scene.particleSystems.push(_this);\r\n _this._updateEffectOptions = {\r\n attributes: [\"position\", \"age\", \"life\", \"seed\", \"size\", \"color\", \"direction\", \"initialDirection\", \"angle\", \"cellIndex\", \"cellStartOffset\", \"noiseCoordinates1\", \"noiseCoordinates2\"],\r\n uniformsNames: [\"currentCount\", \"timeDelta\", \"emitterWM\", \"lifeTime\", \"color1\", \"color2\", \"sizeRange\", \"scaleRange\", \"gravity\", \"emitPower\",\r\n \"direction1\", \"direction2\", \"minEmitBox\", \"maxEmitBox\", \"radius\", \"directionRandomizer\", \"height\", \"coneAngle\", \"stopFactor\",\r\n \"angleRange\", \"radiusRange\", \"cellInfos\", \"noiseStrength\", \"limitVelocityDamping\"],\r\n uniformBuffersNames: [],\r\n samplers: [\"randomSampler\", \"randomSampler2\", \"sizeGradientSampler\", \"angularSpeedGradientSampler\", \"velocityGradientSampler\", \"limitVelocityGradientSampler\", \"noiseSampler\", \"dragGradientSampler\"],\r\n defines: \"\",\r\n fallbacks: null,\r\n onCompiled: null,\r\n onError: null,\r\n indexParameters: null,\r\n maxSimultaneousLights: 0,\r\n transformFeedbackVaryings: []\r\n };\r\n _this.particleEmitterType = new _Particles_EmitterTypes_boxParticleEmitter__WEBPACK_IMPORTED_MODULE_9__[\"BoxParticleEmitter\"]();\r\n // Random data\r\n var maxTextureSize = Math.min(_this._engine.getCaps().maxTextureSize, fullOptions.randomTextureSize);\r\n var d = [];\r\n for (var i = 0; i < maxTextureSize; ++i) {\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n }\r\n _this._randomTexture = new _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"](new Float32Array(d), maxTextureSize, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTUREFORMAT_RGBA, _this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n _this._randomTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this._randomTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n d = [];\r\n for (var i = 0; i < maxTextureSize; ++i) {\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n d.push(Math.random());\r\n }\r\n _this._randomTexture2 = new _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"](new Float32Array(d), maxTextureSize, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTUREFORMAT_RGBA, _this._scene, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE, _Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].TEXTURETYPE_FLOAT);\r\n _this._randomTexture2.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this._randomTexture2.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].WRAP_ADDRESSMODE;\r\n _this._randomTextureSize = maxTextureSize;\r\n return _this;\r\n }\r\n Object.defineProperty(GPUParticleSystem, \"IsSupported\", {\r\n /**\r\n * Gets a boolean indicating if the GPU particles can be rendered on current browser\r\n */\r\n get: function () {\r\n if (!_Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__[\"EngineStore\"].LastCreatedEngine) {\r\n return false;\r\n }\r\n return _Engines_engineStore__WEBPACK_IMPORTED_MODULE_17__[\"EngineStore\"].LastCreatedEngine.webGLVersion > 1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n GPUParticleSystem.prototype.getCapacity = function () {\r\n return this._capacity;\r\n };\r\n Object.defineProperty(GPUParticleSystem.prototype, \"activeParticleCount\", {\r\n /**\r\n * Gets or set the number of active particles\r\n */\r\n get: function () {\r\n return this._activeCount;\r\n },\r\n set: function (value) {\r\n this._activeCount = Math.min(value, this._capacity);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @return true if the system is ready\r\n */\r\n GPUParticleSystem.prototype.isReady = function () {\r\n if (!this._updateEffect) {\r\n this._recreateUpdateEffect();\r\n this._recreateRenderEffect();\r\n return false;\r\n }\r\n if (!this.emitter || !this._updateEffect.isReady() || !this._imageProcessingConfiguration.isReady() || !this._renderEffect.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n GPUParticleSystem.prototype.isStarted = function () {\r\n return this._started;\r\n };\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (this.startDelay by default)\r\n */\r\n GPUParticleSystem.prototype.start = function (delay) {\r\n var _this = this;\r\n if (delay === void 0) { delay = this.startDelay; }\r\n if (!this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) {\r\n throw \"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set\";\r\n }\r\n if (delay) {\r\n setTimeout(function () {\r\n _this.start(0);\r\n }, delay);\r\n return;\r\n }\r\n this._started = true;\r\n this._stopped = false;\r\n this._preWarmDone = false;\r\n // Animations\r\n if (this.beginAnimationOnStart && this.animations && this.animations.length > 0) {\r\n this.getScene().beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop);\r\n }\r\n };\r\n /**\r\n * Stops the particle system.\r\n */\r\n GPUParticleSystem.prototype.stop = function () {\r\n this._stopped = true;\r\n };\r\n /**\r\n * Remove all active particles\r\n */\r\n GPUParticleSystem.prototype.reset = function () {\r\n this._releaseBuffers();\r\n this._releaseVAOs();\r\n this._currentActiveCount = 0;\r\n this._targetIndex = 0;\r\n };\r\n /**\r\n * Returns the string \"GPUParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n GPUParticleSystem.prototype.getClassName = function () {\r\n return \"GPUParticleSystem\";\r\n };\r\n GPUParticleSystem.prototype._removeGradientAndTexture = function (gradient, gradients, texture) {\r\n _super.prototype._removeGradientAndTexture.call(this, gradient, gradients, texture);\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addColorGradient = function (gradient, color1, color2) {\r\n if (!this._colorGradients) {\r\n this._colorGradients = [];\r\n }\r\n var colorGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"ColorGradient\"]();\r\n colorGradient.gradient = gradient;\r\n colorGradient.color1 = color1;\r\n this._colorGradients.push(colorGradient);\r\n this._colorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n if (this._colorGradientsTexture) {\r\n this._colorGradientsTexture.dispose();\r\n this._colorGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeColorGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._colorGradients, this._colorGradientsTexture);\r\n this._colorGradientsTexture = null;\r\n return this;\r\n };\r\n GPUParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor) {\r\n var valueGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"FactorGradient\"]();\r\n valueGradient.gradient = gradient;\r\n valueGradient.factor1 = factor;\r\n factorGradients.push(valueGradient);\r\n factorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n this._releaseBuffers();\r\n };\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addSizeGradient = function (gradient, factor) {\r\n if (!this._sizeGradients) {\r\n this._sizeGradients = [];\r\n }\r\n this._addFactorGradient(this._sizeGradients, gradient, factor);\r\n if (this._sizeGradientsTexture) {\r\n this._sizeGradientsTexture.dispose();\r\n this._sizeGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeSizeGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._sizeGradients, this._sizeGradientsTexture);\r\n this._sizeGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addAngularSpeedGradient = function (gradient, factor) {\r\n if (!this._angularSpeedGradients) {\r\n this._angularSpeedGradients = [];\r\n }\r\n this._addFactorGradient(this._angularSpeedGradients, gradient, factor);\r\n if (this._angularSpeedGradientsTexture) {\r\n this._angularSpeedGradientsTexture.dispose();\r\n this._angularSpeedGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeAngularSpeedGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._angularSpeedGradients, this._angularSpeedGradientsTexture);\r\n this._angularSpeedGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addVelocityGradient = function (gradient, factor) {\r\n if (!this._velocityGradients) {\r\n this._velocityGradients = [];\r\n }\r\n this._addFactorGradient(this._velocityGradients, gradient, factor);\r\n if (this._velocityGradientsTexture) {\r\n this._velocityGradientsTexture.dispose();\r\n this._velocityGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeVelocityGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._velocityGradients, this._velocityGradientsTexture);\r\n this._velocityGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity value to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addLimitVelocityGradient = function (gradient, factor) {\r\n if (!this._limitVelocityGradients) {\r\n this._limitVelocityGradients = [];\r\n }\r\n this._addFactorGradient(this._limitVelocityGradients, gradient, factor);\r\n if (this._limitVelocityGradientsTexture) {\r\n this._limitVelocityGradientsTexture.dispose();\r\n this._limitVelocityGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeLimitVelocityGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._limitVelocityGradients, this._limitVelocityGradientsTexture);\r\n this._limitVelocityGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag value to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addDragGradient = function (gradient, factor) {\r\n if (!this._dragGradients) {\r\n this._dragGradients = [];\r\n }\r\n this._addFactorGradient(this._dragGradients, gradient, factor);\r\n if (this._dragGradientsTexture) {\r\n this._dragGradientsTexture.dispose();\r\n this._dragGradientsTexture = null;\r\n }\r\n this._releaseBuffers();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeDragGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._dragGradients, this._dragGradientsTexture);\r\n this._dragGradientsTexture = null;\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addEmitRateGradient = function (gradient, factor, factor2) {\r\n // Do nothing as emit rate is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeEmitRateGradient = function (gradient) {\r\n // Do nothing as emit rate is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addStartSizeGradient = function (gradient, factor, factor2) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeStartSizeGradient = function (gradient) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addColorRemapGradient = function (gradient, min, max) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeColorRemapGradient = function () {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addAlphaRemapGradient = function (gradient, min, max) {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeAlphaRemapGradient = function () {\r\n // Do nothing as start size is not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addRampGradient = function (gradient, color) {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeRampGradient = function () {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @returns the list of ramp gradients\r\n */\r\n GPUParticleSystem.prototype.getRampGradients = function () {\r\n return null;\r\n };\r\n Object.defineProperty(GPUParticleSystem.prototype, \"useRampGradients\", {\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see http://doc.babylonjs.com/babylon101/particles#ramp-gradients\r\n */\r\n get: function () {\r\n //Not supported by GPUParticleSystem\r\n return false;\r\n },\r\n set: function (value) {\r\n //Not supported by GPUParticleSystem\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.addLifeTimeGradient = function (gradient, factor, factor2) {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n /**\r\n * Not supported by GPUParticleSystem\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n GPUParticleSystem.prototype.removeLifeTimeGradient = function (gradient) {\r\n //Not supported by GPUParticleSystem\r\n return this;\r\n };\r\n GPUParticleSystem.prototype._reset = function () {\r\n this._releaseBuffers();\r\n };\r\n GPUParticleSystem.prototype._createUpdateVAO = function (source) {\r\n var updateVertexBuffers = {};\r\n updateVertexBuffers[\"position\"] = source.createVertexBuffer(\"position\", 0, 3);\r\n updateVertexBuffers[\"age\"] = source.createVertexBuffer(\"age\", 3, 1);\r\n updateVertexBuffers[\"life\"] = source.createVertexBuffer(\"life\", 4, 1);\r\n updateVertexBuffers[\"seed\"] = source.createVertexBuffer(\"seed\", 5, 4);\r\n updateVertexBuffers[\"size\"] = source.createVertexBuffer(\"size\", 9, 3);\r\n var offset = 12;\r\n if (!this._colorGradientsTexture) {\r\n updateVertexBuffers[\"color\"] = source.createVertexBuffer(\"color\", offset, 4);\r\n offset += 4;\r\n }\r\n updateVertexBuffers[\"direction\"] = source.createVertexBuffer(\"direction\", offset, 3);\r\n offset += 3;\r\n if (!this._isBillboardBased) {\r\n updateVertexBuffers[\"initialDirection\"] = source.createVertexBuffer(\"initialDirection\", offset, 3);\r\n offset += 3;\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n updateVertexBuffers[\"angle\"] = source.createVertexBuffer(\"angle\", offset, 1);\r\n offset += 1;\r\n }\r\n else {\r\n updateVertexBuffers[\"angle\"] = source.createVertexBuffer(\"angle\", offset, 2);\r\n offset += 2;\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n updateVertexBuffers[\"cellIndex\"] = source.createVertexBuffer(\"cellIndex\", offset, 1);\r\n offset += 1;\r\n if (this.spriteRandomStartCell) {\r\n updateVertexBuffers[\"cellStartOffset\"] = source.createVertexBuffer(\"cellStartOffset\", offset, 1);\r\n offset += 1;\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n updateVertexBuffers[\"noiseCoordinates1\"] = source.createVertexBuffer(\"noiseCoordinates1\", offset, 3);\r\n offset += 3;\r\n updateVertexBuffers[\"noiseCoordinates2\"] = source.createVertexBuffer(\"noiseCoordinates2\", offset, 3);\r\n offset += 3;\r\n }\r\n var vao = this._engine.recordVertexArrayObject(updateVertexBuffers, null, this._updateEffect);\r\n this._engine.bindArrayBuffer(null);\r\n return vao;\r\n };\r\n GPUParticleSystem.prototype._createRenderVAO = function (source, spriteSource) {\r\n var renderVertexBuffers = {};\r\n renderVertexBuffers[\"position\"] = source.createVertexBuffer(\"position\", 0, 3, this._attributesStrideSize, true);\r\n renderVertexBuffers[\"age\"] = source.createVertexBuffer(\"age\", 3, 1, this._attributesStrideSize, true);\r\n renderVertexBuffers[\"life\"] = source.createVertexBuffer(\"life\", 4, 1, this._attributesStrideSize, true);\r\n renderVertexBuffers[\"size\"] = source.createVertexBuffer(\"size\", 9, 3, this._attributesStrideSize, true);\r\n var offset = 12;\r\n if (!this._colorGradientsTexture) {\r\n renderVertexBuffers[\"color\"] = source.createVertexBuffer(\"color\", offset, 4, this._attributesStrideSize, true);\r\n offset += 4;\r\n }\r\n if (this.billboardMode === _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_STRETCHED) {\r\n renderVertexBuffers[\"direction\"] = source.createVertexBuffer(\"direction\", offset, 3, this._attributesStrideSize, true);\r\n }\r\n offset += 3; // Direction\r\n if (!this._isBillboardBased) {\r\n renderVertexBuffers[\"initialDirection\"] = source.createVertexBuffer(\"initialDirection\", offset, 3, this._attributesStrideSize, true);\r\n offset += 3;\r\n }\r\n renderVertexBuffers[\"angle\"] = source.createVertexBuffer(\"angle\", offset, 1, this._attributesStrideSize, true);\r\n if (this._angularSpeedGradientsTexture) {\r\n offset++;\r\n }\r\n else {\r\n offset += 2;\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n renderVertexBuffers[\"cellIndex\"] = source.createVertexBuffer(\"cellIndex\", offset, 1, this._attributesStrideSize, true);\r\n offset += 1;\r\n if (this.spriteRandomStartCell) {\r\n renderVertexBuffers[\"cellStartOffset\"] = source.createVertexBuffer(\"cellStartOffset\", offset, 1, this._attributesStrideSize, true);\r\n offset += 1;\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n renderVertexBuffers[\"noiseCoordinates1\"] = source.createVertexBuffer(\"noiseCoordinates1\", offset, 3, this._attributesStrideSize, true);\r\n offset += 3;\r\n renderVertexBuffers[\"noiseCoordinates2\"] = source.createVertexBuffer(\"noiseCoordinates2\", offset, 3, this._attributesStrideSize, true);\r\n offset += 3;\r\n }\r\n renderVertexBuffers[\"offset\"] = spriteSource.createVertexBuffer(\"offset\", 0, 2);\r\n renderVertexBuffers[\"uv\"] = spriteSource.createVertexBuffer(\"uv\", 2, 2);\r\n var vao = this._engine.recordVertexArrayObject(renderVertexBuffers, null, this._renderEffect);\r\n this._engine.bindArrayBuffer(null);\r\n return vao;\r\n };\r\n GPUParticleSystem.prototype._initialize = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (this._buffer0 && !force) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n var data = new Array();\r\n this._attributesStrideSize = 21;\r\n this._targetIndex = 0;\r\n if (!this.isBillboardBased) {\r\n this._attributesStrideSize += 3;\r\n }\r\n if (this._colorGradientsTexture) {\r\n this._attributesStrideSize -= 4;\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n this._attributesStrideSize -= 1;\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n this._attributesStrideSize += 1;\r\n if (this.spriteRandomStartCell) {\r\n this._attributesStrideSize += 1;\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n this._attributesStrideSize += 6;\r\n }\r\n for (var particleIndex = 0; particleIndex < this._capacity; particleIndex++) {\r\n // position\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n // Age and life\r\n data.push(0.0); // create the particle as a dead one to create a new one at start\r\n data.push(0.0);\r\n // Seed\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n // Size\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n if (!this._colorGradientsTexture) {\r\n // color\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n }\r\n // direction\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n if (!this.isBillboardBased) {\r\n // initialDirection\r\n data.push(0.0);\r\n data.push(0.0);\r\n data.push(0.0);\r\n }\r\n // angle\r\n data.push(0.0);\r\n if (!this._angularSpeedGradientsTexture) {\r\n data.push(0.0);\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n data.push(0.0);\r\n if (this.spriteRandomStartCell) {\r\n data.push(0.0);\r\n }\r\n }\r\n if (this.noiseTexture) { // Random coordinates for reading into noise texture\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n data.push(Math.random());\r\n }\r\n }\r\n // Sprite data\r\n var spriteData = new Float32Array([0.5, 0.5, 1, 1,\r\n -0.5, 0.5, 0, 1,\r\n -0.5, -0.5, 0, 0,\r\n 0.5, -0.5, 1, 0]);\r\n // Buffers\r\n this._buffer0 = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"Buffer\"](engine, data, false, this._attributesStrideSize);\r\n this._buffer1 = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"Buffer\"](engine, data, false, this._attributesStrideSize);\r\n this._spriteBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_6__[\"Buffer\"](engine, spriteData, false, 4);\r\n // Update VAO\r\n this._updateVAO = [];\r\n this._updateVAO.push(this._createUpdateVAO(this._buffer0));\r\n this._updateVAO.push(this._createUpdateVAO(this._buffer1));\r\n // Render VAO\r\n this._renderVAO = [];\r\n this._renderVAO.push(this._createRenderVAO(this._buffer1, this._spriteBuffer));\r\n this._renderVAO.push(this._createRenderVAO(this._buffer0, this._spriteBuffer));\r\n // Links\r\n this._sourceBuffer = this._buffer0;\r\n this._targetBuffer = this._buffer1;\r\n };\r\n /** @hidden */\r\n GPUParticleSystem.prototype._recreateUpdateEffect = function () {\r\n var defines = this.particleEmitterType ? this.particleEmitterType.getEffectDefines() : \"\";\r\n if (this._isBillboardBased) {\r\n defines += \"\\n#define BILLBOARD\";\r\n }\r\n if (this._colorGradientsTexture) {\r\n defines += \"\\n#define COLORGRADIENTS\";\r\n }\r\n if (this._sizeGradientsTexture) {\r\n defines += \"\\n#define SIZEGRADIENTS\";\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n defines += \"\\n#define ANGULARSPEEDGRADIENTS\";\r\n }\r\n if (this._velocityGradientsTexture) {\r\n defines += \"\\n#define VELOCITYGRADIENTS\";\r\n }\r\n if (this._limitVelocityGradientsTexture) {\r\n defines += \"\\n#define LIMITVELOCITYGRADIENTS\";\r\n }\r\n if (this._dragGradientsTexture) {\r\n defines += \"\\n#define DRAGGRADIENTS\";\r\n }\r\n if (this.isAnimationSheetEnabled) {\r\n defines += \"\\n#define ANIMATESHEET\";\r\n if (this.spriteRandomStartCell) {\r\n defines += \"\\n#define ANIMATESHEETRANDOMSTART\";\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n defines += \"\\n#define NOISE\";\r\n }\r\n if (this._updateEffect && this._updateEffectOptions.defines === defines) {\r\n return;\r\n }\r\n this._updateEffectOptions.transformFeedbackVaryings = [\"outPosition\", \"outAge\", \"outLife\", \"outSeed\", \"outSize\"];\r\n if (!this._colorGradientsTexture) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outColor\");\r\n }\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outDirection\");\r\n if (!this._isBillboardBased) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outInitialDirection\");\r\n }\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outAngle\");\r\n if (this.isAnimationSheetEnabled) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outCellIndex\");\r\n if (this.spriteRandomStartCell) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outCellStartOffset\");\r\n }\r\n }\r\n if (this.noiseTexture) {\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outNoiseCoordinates1\");\r\n this._updateEffectOptions.transformFeedbackVaryings.push(\"outNoiseCoordinates2\");\r\n }\r\n this._updateEffectOptions.defines = defines;\r\n this._updateEffect = new _Materials_effect__WEBPACK_IMPORTED_MODULE_10__[\"Effect\"](\"gpuUpdateParticles\", this._updateEffectOptions, this._scene.getEngine());\r\n };\r\n /** @hidden */\r\n GPUParticleSystem.prototype._recreateRenderEffect = function () {\r\n var defines = \"\";\r\n if (this._scene.clipPlane) {\r\n defines = \"\\n#define CLIPPLANE\";\r\n }\r\n if (this._scene.clipPlane2) {\r\n defines = \"\\n#define CLIPPLANE2\";\r\n }\r\n if (this._scene.clipPlane3) {\r\n defines = \"\\n#define CLIPPLANE3\";\r\n }\r\n if (this._scene.clipPlane4) {\r\n defines = \"\\n#define CLIPPLANE4\";\r\n }\r\n if (this.blendMode === _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_MULTIPLY) {\r\n defines = \"\\n#define BLENDMULTIPLYMODE\";\r\n }\r\n if (this._isBillboardBased) {\r\n defines += \"\\n#define BILLBOARD\";\r\n switch (this.billboardMode) {\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_Y:\r\n defines += \"\\n#define BILLBOARDY\";\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_STRETCHED:\r\n defines += \"\\n#define BILLBOARDSTRETCHED\";\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BILLBOARDMODE_ALL:\r\n default:\r\n break;\r\n }\r\n }\r\n if (this._colorGradientsTexture) {\r\n defines += \"\\n#define COLORGRADIENTS\";\r\n }\r\n if (this.isAnimationSheetEnabled) {\r\n defines += \"\\n#define ANIMATESHEET\";\r\n }\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines);\r\n defines += \"\\n\" + this._imageProcessingConfigurationDefines.toString();\r\n }\r\n if (this._renderEffect && this._renderEffect.defines === defines) {\r\n return;\r\n }\r\n var uniforms = [\"worldOffset\", \"view\", \"projection\", \"colorDead\", \"invView\", \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"sheetInfos\", \"translationPivot\", \"eyePosition\"];\r\n var samplers = [\"textureSampler\", \"colorGradientSampler\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, this._imageProcessingConfigurationDefines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_13__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, this._imageProcessingConfigurationDefines);\r\n }\r\n this._renderEffect = new _Materials_effect__WEBPACK_IMPORTED_MODULE_10__[\"Effect\"](\"gpuRenderParticles\", [\"position\", \"age\", \"life\", \"size\", \"color\", \"offset\", \"uv\", \"direction\", \"initialDirection\", \"angle\", \"cellIndex\"], uniforms, samplers, this._scene.getEngine(), defines);\r\n };\r\n /**\r\n * Animates the particle system for the current frame by emitting new particles and or animating the living ones.\r\n * @param preWarm defines if we are in the pre-warmimg phase\r\n */\r\n GPUParticleSystem.prototype.animate = function (preWarm) {\r\n if (preWarm === void 0) { preWarm = false; }\r\n this._timeDelta = this.updateSpeed * (preWarm ? this.preWarmStepOffset : this._scene.getAnimationRatio());\r\n this._actualFrame += this._timeDelta;\r\n if (!this._stopped) {\r\n if (this.targetStopDuration && this._actualFrame >= this.targetStopDuration) {\r\n this.stop();\r\n }\r\n }\r\n };\r\n GPUParticleSystem.prototype._createFactorGradientTexture = function (factorGradients, textureName) {\r\n var texture = this[textureName];\r\n if (!factorGradients || !factorGradients.length || texture) {\r\n return;\r\n }\r\n var data = new Float32Array(this._rawTextureWidth);\r\n for (var x = 0; x < this._rawTextureWidth; x++) {\r\n var ratio = x / this._rawTextureWidth;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, factorGradients, function (currentGradient, nextGradient, scale) {\r\n data[x] = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_5__[\"Scalar\"].Lerp(currentGradient.factor1, nextGradient.factor1, scale);\r\n });\r\n }\r\n this[textureName] = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"].CreateRTexture(data, this._rawTextureWidth, 1, this._scene, false, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n };\r\n GPUParticleSystem.prototype._createSizeGradientTexture = function () {\r\n this._createFactorGradientTexture(this._sizeGradients, \"_sizeGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createAngularSpeedGradientTexture = function () {\r\n this._createFactorGradientTexture(this._angularSpeedGradients, \"_angularSpeedGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createVelocityGradientTexture = function () {\r\n this._createFactorGradientTexture(this._velocityGradients, \"_velocityGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createLimitVelocityGradientTexture = function () {\r\n this._createFactorGradientTexture(this._limitVelocityGradients, \"_limitVelocityGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createDragGradientTexture = function () {\r\n this._createFactorGradientTexture(this._dragGradients, \"_dragGradientsTexture\");\r\n };\r\n GPUParticleSystem.prototype._createColorGradientTexture = function () {\r\n if (!this._colorGradients || !this._colorGradients.length || this._colorGradientsTexture) {\r\n return;\r\n }\r\n var data = new Uint8Array(this._rawTextureWidth * 4);\r\n var tmpColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"TmpColors\"].Color4[0];\r\n for (var x = 0; x < this._rawTextureWidth; x++) {\r\n var ratio = x / this._rawTextureWidth;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this._colorGradients, function (currentGradient, nextGradient, scale) {\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_4__[\"Color4\"].LerpToRef(currentGradient.color1, nextGradient.color1, scale, tmpColor);\r\n data[x * 4] = tmpColor.r * 255;\r\n data[x * 4 + 1] = tmpColor.g * 255;\r\n data[x * 4 + 2] = tmpColor.b * 255;\r\n data[x * 4 + 3] = tmpColor.a * 255;\r\n });\r\n }\r\n this._colorGradientsTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_15__[\"RawTexture\"].CreateRGBATexture(data, this._rawTextureWidth, 1, this._scene, false, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n };\r\n /**\r\n * Renders the particle system in its current state\r\n * @param preWarm defines if the system should only update the particles but not render them\r\n * @returns the current number of particles\r\n */\r\n GPUParticleSystem.prototype.render = function (preWarm) {\r\n if (preWarm === void 0) { preWarm = false; }\r\n if (!this._started) {\r\n return 0;\r\n }\r\n this._createColorGradientTexture();\r\n this._createSizeGradientTexture();\r\n this._createAngularSpeedGradientTexture();\r\n this._createVelocityGradientTexture();\r\n this._createLimitVelocityGradientTexture();\r\n this._createDragGradientTexture();\r\n this._recreateUpdateEffect();\r\n this._recreateRenderEffect();\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n if (!preWarm) {\r\n if (!this._preWarmDone && this.preWarmCycles) {\r\n for (var index = 0; index < this.preWarmCycles; index++) {\r\n this.animate(true);\r\n this.render(true);\r\n }\r\n this._preWarmDone = true;\r\n }\r\n if (this._currentRenderId === this._scene.getFrameId()) {\r\n return 0;\r\n }\r\n this._currentRenderId = this._scene.getFrameId();\r\n }\r\n // Get everything ready to render\r\n this._initialize();\r\n this._accumulatedCount += this.emitRate * this._timeDelta;\r\n if (this._accumulatedCount > 1) {\r\n var intPart = this._accumulatedCount | 0;\r\n this._accumulatedCount -= intPart;\r\n this._currentActiveCount = Math.min(this._activeCount, this._currentActiveCount + intPart);\r\n }\r\n if (!this._currentActiveCount) {\r\n return 0;\r\n }\r\n // Enable update effect\r\n this._engine.enableEffect(this._updateEffect);\r\n this._engine.setState(false);\r\n this._updateEffect.setFloat(\"currentCount\", this._currentActiveCount);\r\n this._updateEffect.setFloat(\"timeDelta\", this._timeDelta);\r\n this._updateEffect.setFloat(\"stopFactor\", this._stopped ? 0 : 1);\r\n this._updateEffect.setTexture(\"randomSampler\", this._randomTexture);\r\n this._updateEffect.setTexture(\"randomSampler2\", this._randomTexture2);\r\n this._updateEffect.setFloat2(\"lifeTime\", this.minLifeTime, this.maxLifeTime);\r\n this._updateEffect.setFloat2(\"emitPower\", this.minEmitPower, this.maxEmitPower);\r\n if (!this._colorGradientsTexture) {\r\n this._updateEffect.setDirectColor4(\"color1\", this.color1);\r\n this._updateEffect.setDirectColor4(\"color2\", this.color2);\r\n }\r\n this._updateEffect.setFloat2(\"sizeRange\", this.minSize, this.maxSize);\r\n this._updateEffect.setFloat4(\"scaleRange\", this.minScaleX, this.maxScaleX, this.minScaleY, this.maxScaleY);\r\n this._updateEffect.setFloat4(\"angleRange\", this.minAngularSpeed, this.maxAngularSpeed, this.minInitialRotation, this.maxInitialRotation);\r\n this._updateEffect.setVector3(\"gravity\", this.gravity);\r\n if (this._sizeGradientsTexture) {\r\n this._updateEffect.setTexture(\"sizeGradientSampler\", this._sizeGradientsTexture);\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n this._updateEffect.setTexture(\"angularSpeedGradientSampler\", this._angularSpeedGradientsTexture);\r\n }\r\n if (this._velocityGradientsTexture) {\r\n this._updateEffect.setTexture(\"velocityGradientSampler\", this._velocityGradientsTexture);\r\n }\r\n if (this._limitVelocityGradientsTexture) {\r\n this._updateEffect.setTexture(\"limitVelocityGradientSampler\", this._limitVelocityGradientsTexture);\r\n this._updateEffect.setFloat(\"limitVelocityDamping\", this.limitVelocityDamping);\r\n }\r\n if (this._dragGradientsTexture) {\r\n this._updateEffect.setTexture(\"dragGradientSampler\", this._dragGradientsTexture);\r\n }\r\n if (this.particleEmitterType) {\r\n this.particleEmitterType.applyToShader(this._updateEffect);\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n this._updateEffect.setFloat3(\"cellInfos\", this.startSpriteCellID, this.endSpriteCellID, this.spriteCellChangeSpeed);\r\n }\r\n if (this.noiseTexture) {\r\n this._updateEffect.setTexture(\"noiseSampler\", this.noiseTexture);\r\n this._updateEffect.setVector3(\"noiseStrength\", this.noiseStrength);\r\n }\r\n var emitterWM;\r\n if (this.emitter.position) {\r\n var emitterMesh = this.emitter;\r\n emitterWM = emitterMesh.getWorldMatrix();\r\n }\r\n else {\r\n var emitterPosition = this.emitter;\r\n emitterWM = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Translation(emitterPosition.x, emitterPosition.y, emitterPosition.z);\r\n }\r\n this._updateEffect.setMatrix(\"emitterWM\", emitterWM);\r\n // Bind source VAO\r\n this._engine.bindVertexArrayObject(this._updateVAO[this._targetIndex], null);\r\n // Update\r\n this._engine.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer());\r\n this._engine.setRasterizerState(false);\r\n this._engine.beginTransformFeedback(true);\r\n this._engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].PointListDrawMode, 0, this._currentActiveCount);\r\n this._engine.endTransformFeedback();\r\n this._engine.setRasterizerState(true);\r\n this._engine.bindTransformFeedbackBuffer(null);\r\n if (!preWarm) {\r\n // Enable render effect\r\n this._engine.enableEffect(this._renderEffect);\r\n var viewMatrix = this._scene.getViewMatrix();\r\n this._renderEffect.setMatrix(\"view\", viewMatrix);\r\n this._renderEffect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\r\n this._renderEffect.setTexture(\"textureSampler\", this.particleTexture);\r\n this._renderEffect.setVector2(\"translationPivot\", this.translationPivot);\r\n this._renderEffect.setVector3(\"worldOffset\", this.worldOffset);\r\n if (this._colorGradientsTexture) {\r\n this._renderEffect.setTexture(\"colorGradientSampler\", this._colorGradientsTexture);\r\n }\r\n else {\r\n this._renderEffect.setDirectColor4(\"colorDead\", this.colorDead);\r\n }\r\n if (this._isAnimationSheetEnabled && this.particleTexture) {\r\n var baseSize = this.particleTexture.getBaseSize();\r\n this._renderEffect.setFloat3(\"sheetInfos\", this.spriteCellWidth / baseSize.width, this.spriteCellHeight / baseSize.height, baseSize.width / this.spriteCellWidth);\r\n }\r\n if (this._isBillboardBased) {\r\n var camera = this._scene.activeCamera;\r\n this._renderEffect.setVector3(\"eyePosition\", camera.globalPosition);\r\n }\r\n if (this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4) {\r\n var invView = viewMatrix.clone();\r\n invView.invert();\r\n this._renderEffect.setMatrix(\"invView\", invView);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_12__[\"MaterialHelper\"].BindClipPlane(this._renderEffect, this._scene);\r\n }\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(this._renderEffect);\r\n }\r\n // Draw order\r\n switch (this.blendMode) {\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_ADD:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_ADD);\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_ONEONE:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_ONEONE);\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_STANDARD:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_COMBINE);\r\n break;\r\n case _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"].BLENDMODE_MULTIPLY:\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_MULTIPLY);\r\n break;\r\n }\r\n if (this.forceDepthWrite) {\r\n this._engine.setDepthWrite(true);\r\n }\r\n // Bind source VAO\r\n this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex], null);\r\n // Render\r\n this._engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_11__[\"Material\"].TriangleFanDrawMode, 0, 4, this._currentActiveCount);\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_16__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // Switch VAOs\r\n this._targetIndex++;\r\n if (this._targetIndex === 2) {\r\n this._targetIndex = 0;\r\n }\r\n // Switch buffers\r\n var tmpBuffer = this._sourceBuffer;\r\n this._sourceBuffer = this._targetBuffer;\r\n this._targetBuffer = tmpBuffer;\r\n return this._currentActiveCount;\r\n };\r\n /**\r\n * Rebuilds the particle system\r\n */\r\n GPUParticleSystem.prototype.rebuild = function () {\r\n this._initialize(true);\r\n };\r\n GPUParticleSystem.prototype._releaseBuffers = function () {\r\n if (this._buffer0) {\r\n this._buffer0.dispose();\r\n this._buffer0 = null;\r\n }\r\n if (this._buffer1) {\r\n this._buffer1.dispose();\r\n this._buffer1 = null;\r\n }\r\n if (this._spriteBuffer) {\r\n this._spriteBuffer.dispose();\r\n this._spriteBuffer = null;\r\n }\r\n };\r\n GPUParticleSystem.prototype._releaseVAOs = function () {\r\n if (!this._updateVAO) {\r\n return;\r\n }\r\n for (var index = 0; index < this._updateVAO.length; index++) {\r\n this._engine.releaseVertexArrayObject(this._updateVAO[index]);\r\n }\r\n this._updateVAO = [];\r\n for (var index = 0; index < this._renderVAO.length; index++) {\r\n this._engine.releaseVertexArrayObject(this._renderVAO[index]);\r\n }\r\n this._renderVAO = [];\r\n };\r\n /**\r\n * Disposes the particle system and free the associated resources\r\n * @param disposeTexture defines if the particule texture must be disposed as well (true by default)\r\n */\r\n GPUParticleSystem.prototype.dispose = function (disposeTexture) {\r\n if (disposeTexture === void 0) { disposeTexture = true; }\r\n var index = this._scene.particleSystems.indexOf(this);\r\n if (index > -1) {\r\n this._scene.particleSystems.splice(index, 1);\r\n }\r\n this._releaseBuffers();\r\n this._releaseVAOs();\r\n if (this._colorGradientsTexture) {\r\n this._colorGradientsTexture.dispose();\r\n this._colorGradientsTexture = null;\r\n }\r\n if (this._sizeGradientsTexture) {\r\n this._sizeGradientsTexture.dispose();\r\n this._sizeGradientsTexture = null;\r\n }\r\n if (this._angularSpeedGradientsTexture) {\r\n this._angularSpeedGradientsTexture.dispose();\r\n this._angularSpeedGradientsTexture = null;\r\n }\r\n if (this._velocityGradientsTexture) {\r\n this._velocityGradientsTexture.dispose();\r\n this._velocityGradientsTexture = null;\r\n }\r\n if (this._limitVelocityGradientsTexture) {\r\n this._limitVelocityGradientsTexture.dispose();\r\n this._limitVelocityGradientsTexture = null;\r\n }\r\n if (this._dragGradientsTexture) {\r\n this._dragGradientsTexture.dispose();\r\n this._dragGradientsTexture = null;\r\n }\r\n if (this._randomTexture) {\r\n this._randomTexture.dispose();\r\n this._randomTexture = null;\r\n }\r\n if (this._randomTexture2) {\r\n this._randomTexture2.dispose();\r\n this._randomTexture2 = null;\r\n }\r\n if (disposeTexture && this.particleTexture) {\r\n this.particleTexture.dispose();\r\n this.particleTexture = null;\r\n }\r\n if (disposeTexture && this.noiseTexture) {\r\n this.noiseTexture.dispose();\r\n this.noiseTexture = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n GPUParticleSystem.prototype.clone = function (name, newEmitter) {\r\n var result = new GPUParticleSystem(name, { capacity: this._capacity, randomTextureSize: this._randomTextureSize }, this._scene);\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_18__[\"DeepCopier\"].DeepCopy(this, result, [\"particles\", \"customShader\", \"noiseTexture\", \"particleTexture\", \"onDisposeObservable\"]);\r\n if (newEmitter === undefined) {\r\n newEmitter = this.emitter;\r\n }\r\n result.emitter = newEmitter;\r\n if (this.particleTexture) {\r\n result.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"](this.particleTexture.url, this._scene);\r\n }\r\n result.noiseTexture = this.noiseTexture;\r\n result.emitter = newEmitter;\r\n if (this.particleTexture) {\r\n result.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_14__[\"Texture\"](this.particleTexture.url, this._scene);\r\n }\r\n // Clone gradients\r\n if (this._colorGradients) {\r\n this._colorGradients.forEach(function (v) {\r\n result.addColorGradient(v.gradient, v.color1, v.color2);\r\n });\r\n }\r\n if (this._dragGradients) {\r\n this._dragGradients.forEach(function (v) {\r\n result.addDragGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._angularSpeedGradients) {\r\n this._angularSpeedGradients.forEach(function (v) {\r\n result.addAngularSpeedGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._emitRateGradients) {\r\n this._emitRateGradients.forEach(function (v) {\r\n result.addEmitRateGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._lifeTimeGradients) {\r\n this._lifeTimeGradients.forEach(function (v) {\r\n result.addLifeTimeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._limitVelocityGradients) {\r\n this._limitVelocityGradients.forEach(function (v) {\r\n result.addLimitVelocityGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._sizeGradients) {\r\n this._sizeGradients.forEach(function (v) {\r\n result.addSizeGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._startSizeGradients) {\r\n this._startSizeGradients.forEach(function (v) {\r\n result.addStartSizeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._velocityGradients) {\r\n this._velocityGradients.forEach(function (v) {\r\n result.addVelocityGradient(v.gradient, v.factor1);\r\n });\r\n }\r\n if (this._rampGradients) {\r\n this._rampGradients.forEach(function (v) {\r\n result.addRampGradient(v.gradient, v.color);\r\n });\r\n }\r\n if (this._colorRemapGradients) {\r\n this._colorRemapGradients.forEach(function (v) {\r\n result.addColorRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._alphaRemapGradients) {\r\n this._alphaRemapGradients.forEach(function (v) {\r\n result.addAlphaRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n GPUParticleSystem.prototype.serialize = function () {\r\n var serializationObject = {};\r\n _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"]._Serialize(serializationObject, this);\r\n serializationObject.activeParticleCount = this.activeParticleCount;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parses a JSON object to create a GPU particle system.\r\n * @param parsedParticleSystem The JSON object to parse\r\n * @param scene The scene to create the particle system in\r\n * @param rootUrl The root url to use to load external dependencies like texture\r\n * @param doNotStart Ignore the preventAutoStart attribute and does not start\r\n * @returns the parsed GPU particle system\r\n */\r\n GPUParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl, doNotStart) {\r\n if (doNotStart === void 0) { doNotStart = false; }\r\n var name = parsedParticleSystem.name;\r\n var particleSystem = new GPUParticleSystem(name, { capacity: parsedParticleSystem.capacity, randomTextureSize: parsedParticleSystem.randomTextureSize }, scene);\r\n if (parsedParticleSystem.activeParticleCount) {\r\n particleSystem.activeParticleCount = parsedParticleSystem.activeParticleCount;\r\n }\r\n _particleSystem__WEBPACK_IMPORTED_MODULE_8__[\"ParticleSystem\"]._Parse(parsedParticleSystem, particleSystem, scene, rootUrl);\r\n // Auto start\r\n if (parsedParticleSystem.preventAutoStart) {\r\n particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;\r\n }\r\n if (!doNotStart && !particleSystem.preventAutoStart) {\r\n particleSystem.start();\r\n }\r\n return particleSystem;\r\n };\r\n return GPUParticleSystem;\r\n}(_baseParticleSystem__WEBPACK_IMPORTED_MODULE_7__[\"BaseParticleSystem\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/index.ts\":\n/*!****************************!*\\\n !*** ./Particles/index.ts ***!\n \\****************************/\n/*! exports provided: BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _baseParticleSystem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseParticleSystem */ \"./Particles/baseParticleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return _baseParticleSystem__WEBPACK_IMPORTED_MODULE_0__[\"BaseParticleSystem\"]; });\n\n/* harmony import */ var _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmitterTypes/index */ \"./Particles/EmitterTypes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"BoxParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"ConeParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"PointParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _EmitterTypes_index__WEBPACK_IMPORTED_MODULE_1__[\"SphereDirectedParticleEmitter\"]; });\n\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__[\"GPUParticleSystem\"]; });\n\n/* harmony import */ var _particle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./particle */ \"./Particles/particle.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return _particle__WEBPACK_IMPORTED_MODULE_3__[\"Particle\"]; });\n\n/* harmony import */ var _particleHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./particleHelper */ \"./Particles/particleHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return _particleHelper__WEBPACK_IMPORTED_MODULE_4__[\"ParticleHelper\"]; });\n\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return _particleSystem__WEBPACK_IMPORTED_MODULE_5__[\"ParticleSystem\"]; });\n\n/* harmony import */ var _particleSystemComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./particleSystemComponent */ \"./Particles/particleSystemComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _particleSystemComponent__WEBPACK_IMPORTED_MODULE_6__[\"_IDoNeedToBeInTheBuild\"]; });\n\n/* harmony import */ var _particleSystemSet__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./particleSystemSet */ \"./Particles/particleSystemSet.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return _particleSystemSet__WEBPACK_IMPORTED_MODULE_7__[\"ParticleSystemSet\"]; });\n\n/* harmony import */ var _solidParticle__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./solidParticle */ \"./Particles/solidParticle.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return _solidParticle__WEBPACK_IMPORTED_MODULE_8__[\"SolidParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return _solidParticle__WEBPACK_IMPORTED_MODULE_8__[\"ModelShape\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return _solidParticle__WEBPACK_IMPORTED_MODULE_8__[\"DepthSortedParticle\"]; });\n\n/* harmony import */ var _solidParticleSystem__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./solidParticleSystem */ \"./Particles/solidParticleSystem.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return _solidParticleSystem__WEBPACK_IMPORTED_MODULE_9__[\"SolidParticleSystem\"]; });\n\n/* harmony import */ var _subEmitter__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./subEmitter */ \"./Particles/subEmitter.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return _subEmitter__WEBPACK_IMPORTED_MODULE_10__[\"SubEmitterType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return _subEmitter__WEBPACK_IMPORTED_MODULE_10__[\"SubEmitter\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particle.ts\":\n/*!*******************************!*\\\n !*** ./Particles/particle.ts ***!\n \\*******************************/\n/*! exports provided: Particle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return Particle; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n/**\r\n * A particle represents one of the element emitted by a particle system.\r\n * This is mainly define by its coordinates, direction, velocity and age.\r\n */\r\nvar Particle = /** @class */ (function () {\r\n /**\r\n * Creates a new instance Particle\r\n * @param particleSystem the particle system the particle belongs to\r\n */\r\n function Particle(\r\n /**\r\n * The particle system the particle belongs to.\r\n */\r\n particleSystem) {\r\n this.particleSystem = particleSystem;\r\n /**\r\n * The world position of the particle in the scene.\r\n */\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The world direction of the particle in the scene.\r\n */\r\n this.direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The color of the particle.\r\n */\r\n this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * The color change of the particle per step.\r\n */\r\n this.colorStep = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /**\r\n * Defines how long will the life of the particle be.\r\n */\r\n this.lifeTime = 1.0;\r\n /**\r\n * The current age of the particle.\r\n */\r\n this.age = 0;\r\n /**\r\n * The current size of the particle.\r\n */\r\n this.size = 0;\r\n /**\r\n * The current scale of the particle.\r\n */\r\n this.scale = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector2\"](1, 1);\r\n /**\r\n * The current angle of the particle.\r\n */\r\n this.angle = 0;\r\n /**\r\n * Defines how fast is the angle changing.\r\n */\r\n this.angularSpeed = 0;\r\n /**\r\n * Defines the cell index used by the particle to be rendered from a sprite.\r\n */\r\n this.cellIndex = 0;\r\n /** @hidden */\r\n this._attachedSubEmitters = null;\r\n /** @hidden */\r\n this._currentColor1 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /** @hidden */\r\n this._currentColor2 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n /** @hidden */\r\n this._currentSize1 = 0;\r\n /** @hidden */\r\n this._currentSize2 = 0;\r\n /** @hidden */\r\n this._currentAngularSpeed1 = 0;\r\n /** @hidden */\r\n this._currentAngularSpeed2 = 0;\r\n /** @hidden */\r\n this._currentVelocity1 = 0;\r\n /** @hidden */\r\n this._currentVelocity2 = 0;\r\n /** @hidden */\r\n this._currentLimitVelocity1 = 0;\r\n /** @hidden */\r\n this._currentLimitVelocity2 = 0;\r\n /** @hidden */\r\n this._currentDrag1 = 0;\r\n /** @hidden */\r\n this._currentDrag2 = 0;\r\n this.id = Particle._Count++;\r\n if (!this.particleSystem.isAnimationSheetEnabled) {\r\n return;\r\n }\r\n this.updateCellInfoFromSystem();\r\n }\r\n Particle.prototype.updateCellInfoFromSystem = function () {\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n };\r\n /**\r\n * Defines how the sprite cell index is updated for the particle\r\n */\r\n Particle.prototype.updateCellIndex = function () {\r\n var offsetAge = this.age;\r\n var changeSpeed = this.particleSystem.spriteCellChangeSpeed;\r\n if (this.particleSystem.spriteRandomStartCell) {\r\n if (this._randomCellOffset === undefined) {\r\n this._randomCellOffset = Math.random() * this.lifeTime;\r\n }\r\n if (changeSpeed === 0) { // Special case when speed = 0 meaning we want to stay on initial cell\r\n changeSpeed = 1;\r\n offsetAge = this._randomCellOffset;\r\n }\r\n else {\r\n offsetAge += this._randomCellOffset;\r\n }\r\n }\r\n var dist = (this._initialEndSpriteCellID - this._initialStartSpriteCellID);\r\n var ratio = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_2__[\"Scalar\"].Clamp(((offsetAge * changeSpeed) % this.lifeTime) / this.lifeTime);\r\n this.cellIndex = this._initialStartSpriteCellID + (ratio * dist) | 0;\r\n };\r\n /** @hidden */\r\n Particle.prototype._inheritParticleInfoToSubEmitter = function (subEmitter) {\r\n if (subEmitter.particleSystem.emitter.position) {\r\n var emitterMesh = subEmitter.particleSystem.emitter;\r\n emitterMesh.position.copyFrom(this.position);\r\n if (subEmitter.inheritDirection) {\r\n emitterMesh.position.subtractToRef(this.direction, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0]);\r\n // Look at using Y as forward\r\n emitterMesh.lookAt(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0], 0, Math.PI / 2);\r\n }\r\n }\r\n else {\r\n var emitterPosition = subEmitter.particleSystem.emitter;\r\n emitterPosition.copyFrom(this.position);\r\n }\r\n // Set inheritedVelocityOffset to be used when new particles are created\r\n this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0]);\r\n subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0]);\r\n };\r\n /** @hidden */\r\n Particle.prototype._inheritParticleInfoToSubEmitters = function () {\r\n var _this = this;\r\n if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {\r\n this._attachedSubEmitters.forEach(function (subEmitter) {\r\n _this._inheritParticleInfoToSubEmitter(subEmitter);\r\n });\r\n }\r\n };\r\n /** @hidden */\r\n Particle.prototype._reset = function () {\r\n this.age = 0;\r\n this._currentColorGradient = null;\r\n this._currentSizeGradient = null;\r\n this._currentAngularSpeedGradient = null;\r\n this._currentVelocityGradient = null;\r\n this._currentLimitVelocityGradient = null;\r\n this._currentDragGradient = null;\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n this._randomCellOffset = undefined;\r\n };\r\n /**\r\n * Copy the properties of particle to another one.\r\n * @param other the particle to copy the information to.\r\n */\r\n Particle.prototype.copyTo = function (other) {\r\n other.position.copyFrom(this.position);\r\n if (this._initialDirection) {\r\n if (other._initialDirection) {\r\n other._initialDirection.copyFrom(this._initialDirection);\r\n }\r\n else {\r\n other._initialDirection = this._initialDirection.clone();\r\n }\r\n }\r\n else {\r\n other._initialDirection = null;\r\n }\r\n other.direction.copyFrom(this.direction);\r\n other.color.copyFrom(this.color);\r\n other.colorStep.copyFrom(this.colorStep);\r\n other.lifeTime = this.lifeTime;\r\n other.age = this.age;\r\n other._randomCellOffset = this._randomCellOffset;\r\n other.size = this.size;\r\n other.scale.copyFrom(this.scale);\r\n other.angle = this.angle;\r\n other.angularSpeed = this.angularSpeed;\r\n other.particleSystem = this.particleSystem;\r\n other.cellIndex = this.cellIndex;\r\n other.id = this.id;\r\n other._attachedSubEmitters = this._attachedSubEmitters;\r\n if (this._currentColorGradient) {\r\n other._currentColorGradient = this._currentColorGradient;\r\n other._currentColor1.copyFrom(this._currentColor1);\r\n other._currentColor2.copyFrom(this._currentColor2);\r\n }\r\n if (this._currentSizeGradient) {\r\n other._currentSizeGradient = this._currentSizeGradient;\r\n other._currentSize1 = this._currentSize1;\r\n other._currentSize2 = this._currentSize2;\r\n }\r\n if (this._currentAngularSpeedGradient) {\r\n other._currentAngularSpeedGradient = this._currentAngularSpeedGradient;\r\n other._currentAngularSpeed1 = this._currentAngularSpeed1;\r\n other._currentAngularSpeed2 = this._currentAngularSpeed2;\r\n }\r\n if (this._currentVelocityGradient) {\r\n other._currentVelocityGradient = this._currentVelocityGradient;\r\n other._currentVelocity1 = this._currentVelocity1;\r\n other._currentVelocity2 = this._currentVelocity2;\r\n }\r\n if (this._currentLimitVelocityGradient) {\r\n other._currentLimitVelocityGradient = this._currentLimitVelocityGradient;\r\n other._currentLimitVelocity1 = this._currentLimitVelocity1;\r\n other._currentLimitVelocity2 = this._currentLimitVelocity2;\r\n }\r\n if (this._currentDragGradient) {\r\n other._currentDragGradient = this._currentDragGradient;\r\n other._currentDrag1 = this._currentDrag1;\r\n other._currentDrag2 = this._currentDrag2;\r\n }\r\n if (this.particleSystem.isAnimationSheetEnabled) {\r\n other._initialStartSpriteCellID = this._initialStartSpriteCellID;\r\n other._initialEndSpriteCellID = this._initialEndSpriteCellID;\r\n }\r\n if (this.particleSystem.useRampGradients) {\r\n other.remapData.copyFrom(this.remapData);\r\n }\r\n if (this._randomNoiseCoordinates1) {\r\n if (other._randomNoiseCoordinates1) {\r\n other._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1);\r\n other._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2);\r\n }\r\n else {\r\n other._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone();\r\n other._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone();\r\n }\r\n }\r\n };\r\n Particle._Count = 0;\r\n return Particle;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleHelper.ts\":\n/*!*************************************!*\\\n !*** ./Particles/particleHelper.ts ***!\n \\*************************************/\n/*! exports provided: ParticleHelper */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return ParticleHelper; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony import */ var _particleSystemSet__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./particleSystemSet */ \"./Particles/particleSystemSet.ts\");\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This class is made for on one-liner static method to help creating particle system set.\r\n */\r\nvar ParticleHelper = /** @class */ (function () {\r\n function ParticleHelper() {\r\n }\r\n /**\r\n * Create a default particle system that you can tweak\r\n * @param emitter defines the emitter to use\r\n * @param capacity defines the system capacity (default is 500 particles)\r\n * @param scene defines the hosting scene\r\n * @param useGPU defines if a GPUParticleSystem must be created (default is false)\r\n * @returns the new Particle system\r\n */\r\n ParticleHelper.CreateDefault = function (emitter, capacity, scene, useGPU) {\r\n if (capacity === void 0) { capacity = 500; }\r\n if (useGPU === void 0) { useGPU = false; }\r\n var system;\r\n if (useGPU) {\r\n system = new _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_4__[\"GPUParticleSystem\"](\"default system\", { capacity: capacity }, scene);\r\n }\r\n else {\r\n system = new _particleSystem__WEBPACK_IMPORTED_MODULE_6__[\"ParticleSystem\"](\"default system\", capacity, scene);\r\n }\r\n system.emitter = emitter;\r\n system.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"](\"https://www.babylonjs.com/assets/Flare.png\", system.getScene());\r\n system.createConeEmitter(0.1, Math.PI / 4);\r\n // Particle color\r\n system.color1 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n system.color2 = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n system.colorDead = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 0.0);\r\n // Particle Size\r\n system.minSize = 0.1;\r\n system.maxSize = 0.1;\r\n // Emission speed\r\n system.minEmitPower = 2;\r\n system.maxEmitPower = 2;\r\n // Update speed\r\n system.updateSpeed = 1 / 60;\r\n system.emitRate = 30;\r\n return system;\r\n };\r\n /**\r\n * This is the main static method (one-liner) of this helper to create different particle systems\r\n * @param type This string represents the type to the particle system to create\r\n * @param scene The scene where the particle system should live\r\n * @param gpu If the system will use gpu\r\n * @returns the ParticleSystemSet created\r\n */\r\n ParticleHelper.CreateAsync = function (type, scene, gpu) {\r\n if (gpu === void 0) { gpu = false; }\r\n if (!scene) {\r\n scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene;\r\n }\r\n var token = {};\r\n scene._addPendingData(token);\r\n return new Promise(function (resolve, reject) {\r\n if (gpu && !_gpuParticleSystem__WEBPACK_IMPORTED_MODULE_4__[\"GPUParticleSystem\"].IsSupported) {\r\n scene._removePendingData(token);\r\n return reject(\"Particle system with GPU is not supported.\");\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].LoadFile(ParticleHelper.BaseAssetsUrl + \"/systems/\" + type + \".json\", function (data) {\r\n scene._removePendingData(token);\r\n var newData = JSON.parse(data.toString());\r\n return resolve(_particleSystemSet__WEBPACK_IMPORTED_MODULE_5__[\"ParticleSystemSet\"].Parse(newData, scene, gpu));\r\n }, undefined, undefined, undefined, function () {\r\n scene._removePendingData(token);\r\n return reject(\"An error occured while the creation of your particle system. Check if your type '\" + type + \"' exists.\");\r\n });\r\n });\r\n };\r\n /**\r\n * Static function used to export a particle system to a ParticleSystemSet variable.\r\n * Please note that the emitter shape is not exported\r\n * @param systems defines the particle systems to export\r\n * @returns the created particle system set\r\n */\r\n ParticleHelper.ExportSet = function (systems) {\r\n var set = new _particleSystemSet__WEBPACK_IMPORTED_MODULE_5__[\"ParticleSystemSet\"]();\r\n for (var _i = 0, systems_1 = systems; _i < systems_1.length; _i++) {\r\n var system = systems_1[_i];\r\n set.systems.push(system);\r\n }\r\n return set;\r\n };\r\n /**\r\n * Gets or sets base Assets URL\r\n */\r\n ParticleHelper.BaseAssetsUrl = _Engines_constants__WEBPACK_IMPORTED_MODULE_7__[\"Constants\"].PARTICLES_BaseAssetsUrl;\r\n return ParticleHelper;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleSystem.ts\":\n/*!*************************************!*\\\n !*** ./Particles/particleSystem.ts ***!\n \\*************************************/\n/*! exports provided: ParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return ParticleSystem; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/gradients */ \"./Misc/gradients.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/Textures/rawTexture */ \"./Materials/Textures/rawTexture.ts\");\n/* harmony import */ var _Materials_Textures_Procedurals_proceduralTexture__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/Textures/Procedurals/proceduralTexture */ \"./Materials/Textures/Procedurals/proceduralTexture.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Particles/EmitterTypes/index */ \"./Particles/EmitterTypes/index.ts\");\n/* harmony import */ var _baseParticleSystem__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./baseParticleSystem */ \"./Particles/baseParticleSystem.ts\");\n/* harmony import */ var _particle__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./particle */ \"./Particles/particle.ts\");\n/* harmony import */ var _subEmitter__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./subEmitter */ \"./Particles/subEmitter.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Misc/deepCopier */ \"./Misc/deepCopier.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Shaders_particles_fragment__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../Shaders/particles.fragment */ \"./Shaders/particles.fragment.ts\");\n/* harmony import */ var _Shaders_particles_vertex__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../Shaders/particles.vertex */ \"./Shaders/particles.vertex.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a particle system in Babylon.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.\r\n * @example https://doc.babylonjs.com/babylon101/particles\r\n */\r\nvar ParticleSystem = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ParticleSystem, _super);\r\n /**\r\n * Instantiates a particle system.\r\n * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.\r\n * @param name The name of the particle system\r\n * @param capacity The max number of particles alive at the same time\r\n * @param scene The scene the particle system belongs to\r\n * @param customEffect a custom effect used to change the way particles are rendered by default\r\n * @param isAnimationSheetEnabled Must be true if using a spritesheet to animate the particles texture\r\n * @param epsilon Offset used to render the particles\r\n */\r\n function ParticleSystem(name, capacity, scene, customEffect, isAnimationSheetEnabled, epsilon) {\r\n if (customEffect === void 0) { customEffect = null; }\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n if (epsilon === void 0) { epsilon = 0.01; }\r\n var _this = _super.call(this, name) || this;\r\n /**\r\n * @hidden\r\n */\r\n _this._inheritedVelocityOffset = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"]();\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n _this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"]();\r\n _this._particles = new Array();\r\n _this._stockParticles = new Array();\r\n _this._newPartsExcess = 0;\r\n _this._vertexBuffers = {};\r\n _this._scaledColorStep = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"](0, 0, 0, 0);\r\n _this._colorDiff = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"](0, 0, 0, 0);\r\n _this._scaledDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._scaledGravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n _this._currentRenderId = -1;\r\n _this._useInstancing = false;\r\n _this._started = false;\r\n _this._stopped = false;\r\n _this._actualFrame = 0;\r\n /** @hidden */\r\n _this._currentEmitRate1 = 0;\r\n /** @hidden */\r\n _this._currentEmitRate2 = 0;\r\n /** @hidden */\r\n _this._currentStartSize1 = 0;\r\n /** @hidden */\r\n _this._currentStartSize2 = 0;\r\n _this._rawTextureWidth = 256;\r\n _this._useRampGradients = false;\r\n /**\r\n * @hidden\r\n * If the particle systems emitter should be disposed when the particle system is disposed\r\n */\r\n _this._disposeEmitterOnDispose = false;\r\n // start of sub system methods\r\n /**\r\n * \"Recycles\" one of the particle by copying it back to the \"stock\" of particles and removing it from the active list.\r\n * Its lifetime will start back at 0.\r\n */\r\n _this.recycleParticle = function (particle) {\r\n // move particle from activeParticle list to stock particles\r\n var lastParticle = _this._particles.pop();\r\n if (lastParticle !== particle) {\r\n lastParticle.copyTo(particle);\r\n }\r\n _this._stockParticles.push(lastParticle);\r\n };\r\n _this._createParticle = function () {\r\n var particle;\r\n if (_this._stockParticles.length !== 0) {\r\n particle = _this._stockParticles.pop();\r\n particle._reset();\r\n }\r\n else {\r\n particle = new _particle__WEBPACK_IMPORTED_MODULE_16__[\"Particle\"](_this);\r\n }\r\n // Attach emitters\r\n if (_this._subEmitters && _this._subEmitters.length > 0) {\r\n var subEmitters = _this._subEmitters[Math.floor(Math.random() * _this._subEmitters.length)];\r\n particle._attachedSubEmitters = [];\r\n subEmitters.forEach(function (subEmitter) {\r\n if (subEmitter.type === _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitterType\"].ATTACHED) {\r\n var newEmitter = subEmitter.clone();\r\n particle._attachedSubEmitters.push(newEmitter);\r\n newEmitter.particleSystem.start();\r\n }\r\n });\r\n }\r\n return particle;\r\n };\r\n _this._emitFromParticle = function (particle) {\r\n if (!_this._subEmitters || _this._subEmitters.length === 0) {\r\n return;\r\n }\r\n var templateIndex = Math.floor(Math.random() * _this._subEmitters.length);\r\n _this._subEmitters[templateIndex].forEach(function (subEmitter) {\r\n if (subEmitter.type === _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitterType\"].END) {\r\n var subSystem = subEmitter.clone();\r\n particle._inheritParticleInfoToSubEmitter(subSystem);\r\n subSystem.particleSystem._rootParticleSystem = _this;\r\n _this.activeSubSystems.push(subSystem.particleSystem);\r\n subSystem.particleSystem.start();\r\n }\r\n });\r\n };\r\n _this._capacity = capacity;\r\n _this._epsilon = epsilon;\r\n _this._isAnimationSheetEnabled = isAnimationSheetEnabled;\r\n _this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_13__[\"EngineStore\"].LastCreatedScene;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this._customEffect = customEffect;\r\n _this._scene.particleSystems.push(_this);\r\n _this._useInstancing = _this._scene.getEngine().getCaps().instancedArrays;\r\n _this._createIndexBuffer();\r\n _this._createVertexBuffers();\r\n // Default emitter type\r\n _this.particleEmitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"BoxParticleEmitter\"]();\r\n // Update\r\n _this.updateFunction = function (particles) {\r\n var noiseTextureSize = null;\r\n var noiseTextureData = null;\r\n if (_this.noiseTexture) { // We need to get texture data back to CPU\r\n noiseTextureSize = _this.noiseTexture.getSize();\r\n noiseTextureData = (_this.noiseTexture.getContent());\r\n }\r\n var _loop_1 = function () {\r\n particle = particles[index];\r\n var scaledUpdateSpeed = _this._scaledUpdateSpeed;\r\n var previousAge = particle.age;\r\n particle.age += scaledUpdateSpeed;\r\n // Evaluate step to death\r\n if (particle.age > particle.lifeTime) {\r\n var diff = particle.age - previousAge;\r\n var oldDiff = particle.lifeTime - previousAge;\r\n scaledUpdateSpeed = (oldDiff * scaledUpdateSpeed) / diff;\r\n particle.age = particle.lifeTime;\r\n }\r\n var ratio = particle.age / particle.lifeTime;\r\n // Color\r\n if (_this._colorGradients && _this._colorGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._colorGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentColorGradient) {\r\n particle._currentColor1.copyFrom(particle._currentColor2);\r\n nextGradient.getColorToRef(particle._currentColor2);\r\n particle._currentColorGradient = currentGradient;\r\n }\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].LerpToRef(particle._currentColor1, particle._currentColor2, scale, particle.color);\r\n });\r\n }\r\n else {\r\n particle.colorStep.scaleToRef(scaledUpdateSpeed, _this._scaledColorStep);\r\n particle.color.addInPlace(_this._scaledColorStep);\r\n if (particle.color.a < 0) {\r\n particle.color.a = 0;\r\n }\r\n }\r\n // Angular speed\r\n if (_this._angularSpeedGradients && _this._angularSpeedGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._angularSpeedGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentAngularSpeedGradient) {\r\n particle._currentAngularSpeed1 = particle._currentAngularSpeed2;\r\n particle._currentAngularSpeed2 = nextGradient.getFactor();\r\n particle._currentAngularSpeedGradient = currentGradient;\r\n }\r\n particle.angularSpeed = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentAngularSpeed1, particle._currentAngularSpeed2, scale);\r\n });\r\n }\r\n particle.angle += particle.angularSpeed * scaledUpdateSpeed;\r\n // Direction\r\n var directionScale = scaledUpdateSpeed;\r\n /// Velocity\r\n if (_this._velocityGradients && _this._velocityGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._velocityGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentVelocityGradient) {\r\n particle._currentVelocity1 = particle._currentVelocity2;\r\n particle._currentVelocity2 = nextGradient.getFactor();\r\n particle._currentVelocityGradient = currentGradient;\r\n }\r\n directionScale *= _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentVelocity1, particle._currentVelocity2, scale);\r\n });\r\n }\r\n particle.direction.scaleToRef(directionScale, _this._scaledDirection);\r\n /// Limit velocity\r\n if (_this._limitVelocityGradients && _this._limitVelocityGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._limitVelocityGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentLimitVelocityGradient) {\r\n particle._currentLimitVelocity1 = particle._currentLimitVelocity2;\r\n particle._currentLimitVelocity2 = nextGradient.getFactor();\r\n particle._currentLimitVelocityGradient = currentGradient;\r\n }\r\n var limitVelocity = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentLimitVelocity1, particle._currentLimitVelocity2, scale);\r\n var currentVelocity = particle.direction.length();\r\n if (currentVelocity > limitVelocity) {\r\n particle.direction.scaleInPlace(_this.limitVelocityDamping);\r\n }\r\n });\r\n }\r\n /// Drag\r\n if (_this._dragGradients && _this._dragGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._dragGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentDragGradient) {\r\n particle._currentDrag1 = particle._currentDrag2;\r\n particle._currentDrag2 = nextGradient.getFactor();\r\n particle._currentDragGradient = currentGradient;\r\n }\r\n var drag = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentDrag1, particle._currentDrag2, scale);\r\n _this._scaledDirection.scaleInPlace(1.0 - drag);\r\n });\r\n }\r\n particle.position.addInPlace(_this._scaledDirection);\r\n // Noise\r\n if (noiseTextureData && noiseTextureSize && particle._randomNoiseCoordinates1) {\r\n var fetchedColorR = _this._fetchR(particle._randomNoiseCoordinates1.x, particle._randomNoiseCoordinates1.y, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);\r\n var fetchedColorG = _this._fetchR(particle._randomNoiseCoordinates1.z, particle._randomNoiseCoordinates2.x, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);\r\n var fetchedColorB = _this._fetchR(particle._randomNoiseCoordinates2.y, particle._randomNoiseCoordinates2.z, noiseTextureSize.width, noiseTextureSize.height, noiseTextureData);\r\n var force = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var scaledForce = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n force.copyFromFloats((2 * fetchedColorR - 1) * _this.noiseStrength.x, (2 * fetchedColorG - 1) * _this.noiseStrength.y, (2 * fetchedColorB - 1) * _this.noiseStrength.z);\r\n force.scaleToRef(scaledUpdateSpeed, scaledForce);\r\n particle.direction.addInPlace(scaledForce);\r\n }\r\n // Gravity\r\n _this.gravity.scaleToRef(scaledUpdateSpeed, _this._scaledGravity);\r\n particle.direction.addInPlace(_this._scaledGravity);\r\n // Size\r\n if (_this._sizeGradients && _this._sizeGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._sizeGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== particle._currentSizeGradient) {\r\n particle._currentSize1 = particle._currentSize2;\r\n particle._currentSize2 = nextGradient.getFactor();\r\n particle._currentSizeGradient = currentGradient;\r\n }\r\n particle.size = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(particle._currentSize1, particle._currentSize2, scale);\r\n });\r\n }\r\n // Remap data\r\n if (_this._useRampGradients) {\r\n if (_this._colorRemapGradients && _this._colorRemapGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._colorRemapGradients, function (currentGradient, nextGradient, scale) {\r\n var min = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor1, nextGradient.factor1, scale);\r\n var max = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor2, nextGradient.factor2, scale);\r\n particle.remapData.x = min;\r\n particle.remapData.y = max - min;\r\n });\r\n }\r\n if (_this._alphaRemapGradients && _this._alphaRemapGradients.length > 0) {\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, _this._alphaRemapGradients, function (currentGradient, nextGradient, scale) {\r\n var min = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor1, nextGradient.factor1, scale);\r\n var max = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(currentGradient.factor2, nextGradient.factor2, scale);\r\n particle.remapData.z = min;\r\n particle.remapData.w = max - min;\r\n });\r\n }\r\n }\r\n if (_this._isAnimationSheetEnabled) {\r\n particle.updateCellIndex();\r\n }\r\n // Update the position of the attached sub-emitters to match their attached particle\r\n particle._inheritParticleInfoToSubEmitters();\r\n if (particle.age >= particle.lifeTime) { // Recycle by swapping with last particle\r\n _this._emitFromParticle(particle);\r\n if (particle._attachedSubEmitters) {\r\n particle._attachedSubEmitters.forEach(function (subEmitter) {\r\n subEmitter.particleSystem.disposeOnStop = true;\r\n subEmitter.particleSystem.stop();\r\n });\r\n particle._attachedSubEmitters = null;\r\n }\r\n _this.recycleParticle(particle);\r\n index--;\r\n return \"continue\";\r\n }\r\n };\r\n var particle;\r\n for (var index = 0; index < particles.length; index++) {\r\n _loop_1();\r\n }\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(ParticleSystem.prototype, \"onDispose\", {\r\n /**\r\n * Sets a callback that will be triggered when the system is disposed\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ParticleSystem.prototype, \"useRampGradients\", {\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see http://doc.babylonjs.com/babylon101/particles#ramp-gradients\r\n */\r\n get: function () {\r\n return this._useRampGradients;\r\n },\r\n set: function (value) {\r\n if (this._useRampGradients === value) {\r\n return;\r\n }\r\n this._useRampGradients = value;\r\n this._resetEffect();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ParticleSystem.prototype, \"particles\", {\r\n //end of Sub-emitter\r\n /**\r\n * Gets the current list of active particles\r\n */\r\n get: function () {\r\n return this._particles;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n ParticleSystem.prototype.getClassName = function () {\r\n return \"ParticleSystem\";\r\n };\r\n ParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor, factor2) {\r\n var newGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"FactorGradient\"]();\r\n newGradient.gradient = gradient;\r\n newGradient.factor1 = factor;\r\n newGradient.factor2 = factor2;\r\n factorGradients.push(newGradient);\r\n factorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n };\r\n ParticleSystem.prototype._removeFactorGradient = function (factorGradients, gradient) {\r\n if (!factorGradients) {\r\n return;\r\n }\r\n var index = 0;\r\n for (var _i = 0, factorGradients_1 = factorGradients; _i < factorGradients_1.length; _i++) {\r\n var factorGradient = factorGradients_1[_i];\r\n if (factorGradient.gradient === gradient) {\r\n factorGradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n };\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addLifeTimeGradient = function (gradient, factor, factor2) {\r\n if (!this._lifeTimeGradients) {\r\n this._lifeTimeGradients = [];\r\n }\r\n this._addFactorGradient(this._lifeTimeGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeLifeTimeGradient = function (gradient) {\r\n this._removeFactorGradient(this._lifeTimeGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addSizeGradient = function (gradient, factor, factor2) {\r\n if (!this._sizeGradients) {\r\n this._sizeGradients = [];\r\n }\r\n this._addFactorGradient(this._sizeGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeSizeGradient = function (gradient) {\r\n this._removeFactorGradient(this._sizeGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addColorRemapGradient = function (gradient, min, max) {\r\n if (!this._colorRemapGradients) {\r\n this._colorRemapGradients = [];\r\n }\r\n this._addFactorGradient(this._colorRemapGradients, gradient, min, max);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific color remap gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeColorRemapGradient = function (gradient) {\r\n this._removeFactorGradient(this._colorRemapGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addAlphaRemapGradient = function (gradient, min, max) {\r\n if (!this._alphaRemapGradients) {\r\n this._alphaRemapGradients = [];\r\n }\r\n this._addFactorGradient(this._alphaRemapGradients, gradient, min, max);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific alpha remap gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeAlphaRemapGradient = function (gradient) {\r\n this._removeFactorGradient(this._alphaRemapGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addAngularSpeedGradient = function (gradient, factor, factor2) {\r\n if (!this._angularSpeedGradients) {\r\n this._angularSpeedGradients = [];\r\n }\r\n this._addFactorGradient(this._angularSpeedGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeAngularSpeedGradient = function (gradient) {\r\n this._removeFactorGradient(this._angularSpeedGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addVelocityGradient = function (gradient, factor, factor2) {\r\n if (!this._velocityGradients) {\r\n this._velocityGradients = [];\r\n }\r\n this._addFactorGradient(this._velocityGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeVelocityGradient = function (gradient) {\r\n this._removeFactorGradient(this._velocityGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addLimitVelocityGradient = function (gradient, factor, factor2) {\r\n if (!this._limitVelocityGradients) {\r\n this._limitVelocityGradients = [];\r\n }\r\n this._addFactorGradient(this._limitVelocityGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeLimitVelocityGradient = function (gradient) {\r\n this._removeFactorGradient(this._limitVelocityGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addDragGradient = function (gradient, factor, factor2) {\r\n if (!this._dragGradients) {\r\n this._dragGradients = [];\r\n }\r\n this._addFactorGradient(this._dragGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeDragGradient = function (gradient) {\r\n this._removeFactorGradient(this._dragGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addEmitRateGradient = function (gradient, factor, factor2) {\r\n if (!this._emitRateGradients) {\r\n this._emitRateGradients = [];\r\n }\r\n this._addFactorGradient(this._emitRateGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeEmitRateGradient = function (gradient) {\r\n this._removeFactorGradient(this._emitRateGradients, gradient);\r\n return this;\r\n };\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size value to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addStartSizeGradient = function (gradient, factor, factor2) {\r\n if (!this._startSizeGradients) {\r\n this._startSizeGradients = [];\r\n }\r\n this._addFactorGradient(this._startSizeGradients, gradient, factor, factor2);\r\n return this;\r\n };\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeStartSizeGradient = function (gradient) {\r\n this._removeFactorGradient(this._emitRateGradients, gradient);\r\n return this;\r\n };\r\n ParticleSystem.prototype._createRampGradientTexture = function () {\r\n if (!this._rampGradients || !this._rampGradients.length || this._rampGradientsTexture) {\r\n return;\r\n }\r\n var data = new Uint8Array(this._rawTextureWidth * 4);\r\n var tmpColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"TmpColors\"].Color3[0];\r\n for (var x = 0; x < this._rawTextureWidth; x++) {\r\n var ratio = x / this._rawTextureWidth;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this._rampGradients, function (currentGradient, nextGradient, scale) {\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color3\"].LerpToRef(currentGradient.color, nextGradient.color, scale, tmpColor);\r\n data[x * 4] = tmpColor.r * 255;\r\n data[x * 4 + 1] = tmpColor.g * 255;\r\n data[x * 4 + 2] = tmpColor.b * 255;\r\n data[x * 4 + 3] = 255;\r\n });\r\n }\r\n this._rampGradientsTexture = _Materials_Textures_rawTexture__WEBPACK_IMPORTED_MODULE_11__[\"RawTexture\"].CreateRGBATexture(data, this._rawTextureWidth, 1, this._scene, false, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].NEAREST_SAMPLINGMODE);\r\n };\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to udpate this list\r\n * @returns the list of ramp gradients\r\n */\r\n ParticleSystem.prototype.getRampGradients = function () {\r\n return this._rampGradients;\r\n };\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.addRampGradient = function (gradient, color) {\r\n if (!this._rampGradients) {\r\n this._rampGradients = [];\r\n }\r\n var rampGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"Color3Gradient\"]();\r\n rampGradient.gradient = gradient;\r\n rampGradient.color = color;\r\n this._rampGradients.push(rampGradient);\r\n this._rampGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n if (this._rampGradientsTexture) {\r\n this._rampGradientsTexture.dispose();\r\n this._rampGradientsTexture = null;\r\n }\r\n this._createRampGradientTexture();\r\n return this;\r\n };\r\n /**\r\n * Remove a specific ramp gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n ParticleSystem.prototype.removeRampGradient = function (gradient) {\r\n this._removeGradientAndTexture(gradient, this._rampGradients, this._rampGradientsTexture);\r\n this._rampGradientsTexture = null;\r\n if (this._rampGradients && this._rampGradients.length > 0) {\r\n this._createRampGradientTexture();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns this particle system\r\n */\r\n ParticleSystem.prototype.addColorGradient = function (gradient, color1, color2) {\r\n if (!this._colorGradients) {\r\n this._colorGradients = [];\r\n }\r\n var colorGradient = new _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"ColorGradient\"]();\r\n colorGradient.gradient = gradient;\r\n colorGradient.color1 = color1;\r\n colorGradient.color2 = color2;\r\n this._colorGradients.push(colorGradient);\r\n this._colorGradients.sort(function (a, b) {\r\n if (a.gradient < b.gradient) {\r\n return -1;\r\n }\r\n else if (a.gradient > b.gradient) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n return this;\r\n };\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns this particle system\r\n */\r\n ParticleSystem.prototype.removeColorGradient = function (gradient) {\r\n if (!this._colorGradients) {\r\n return this;\r\n }\r\n var index = 0;\r\n for (var _i = 0, _a = this._colorGradients; _i < _a.length; _i++) {\r\n var colorGradient = _a[_i];\r\n if (colorGradient.gradient === gradient) {\r\n this._colorGradients.splice(index, 1);\r\n break;\r\n }\r\n index++;\r\n }\r\n return this;\r\n };\r\n ParticleSystem.prototype._fetchR = function (u, v, width, height, pixels) {\r\n u = Math.abs(u) * 0.5 + 0.5;\r\n v = Math.abs(v) * 0.5 + 0.5;\r\n var wrappedU = ((u * width) % width) | 0;\r\n var wrappedV = ((v * height) % height) | 0;\r\n var position = (wrappedU + wrappedV * width) * 4;\r\n return pixels[position] / 255;\r\n };\r\n ParticleSystem.prototype._reset = function () {\r\n this._resetEffect();\r\n };\r\n ParticleSystem.prototype._resetEffect = function () {\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer.dispose();\r\n this._vertexBuffer = null;\r\n }\r\n if (this._spriteBuffer) {\r\n this._spriteBuffer.dispose();\r\n this._spriteBuffer = null;\r\n }\r\n this._createVertexBuffers();\r\n };\r\n ParticleSystem.prototype._createVertexBuffers = function () {\r\n this._vertexBufferSize = this._useInstancing ? 10 : 12;\r\n if (this._isAnimationSheetEnabled) {\r\n this._vertexBufferSize += 1;\r\n }\r\n if (!this._isBillboardBased || this.billboardMode === ParticleSystem.BILLBOARDMODE_STRETCHED) {\r\n this._vertexBufferSize += 3;\r\n }\r\n if (this._useRampGradients) {\r\n this._vertexBufferSize += 4;\r\n }\r\n var engine = this._scene.getEngine();\r\n this._vertexData = new Float32Array(this._capacity * this._vertexBufferSize * (this._useInstancing ? 1 : 4));\r\n this._vertexBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"Buffer\"](engine, this._vertexData, true, this._vertexBufferSize);\r\n var dataOffset = 0;\r\n var positions = this._vertexBuffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind, dataOffset, 3, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind] = positions;\r\n dataOffset += 3;\r\n var colors = this._vertexBuffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].ColorKind, dataOffset, 4, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].ColorKind] = colors;\r\n dataOffset += 4;\r\n var options = this._vertexBuffer.createVertexBuffer(\"angle\", dataOffset, 1, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"angle\"] = options;\r\n dataOffset += 1;\r\n var size = this._vertexBuffer.createVertexBuffer(\"size\", dataOffset, 2, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"size\"] = size;\r\n dataOffset += 2;\r\n if (this._isAnimationSheetEnabled) {\r\n var cellIndexBuffer = this._vertexBuffer.createVertexBuffer(\"cellIndex\", dataOffset, 1, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"cellIndex\"] = cellIndexBuffer;\r\n dataOffset += 1;\r\n }\r\n if (!this._isBillboardBased || this.billboardMode === ParticleSystem.BILLBOARDMODE_STRETCHED) {\r\n var directionBuffer = this._vertexBuffer.createVertexBuffer(\"direction\", dataOffset, 3, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"direction\"] = directionBuffer;\r\n dataOffset += 3;\r\n }\r\n if (this._useRampGradients) {\r\n var rampDataBuffer = this._vertexBuffer.createVertexBuffer(\"remapData\", dataOffset, 4, this._vertexBufferSize, this._useInstancing);\r\n this._vertexBuffers[\"remapData\"] = rampDataBuffer;\r\n dataOffset += 4;\r\n }\r\n var offsets;\r\n if (this._useInstancing) {\r\n var spriteData = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);\r\n this._spriteBuffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"Buffer\"](engine, spriteData, false, 2);\r\n offsets = this._spriteBuffer.createVertexBuffer(\"offset\", 0, 2);\r\n }\r\n else {\r\n offsets = this._vertexBuffer.createVertexBuffer(\"offset\", dataOffset, 2, this._vertexBufferSize, this._useInstancing);\r\n dataOffset += 2;\r\n }\r\n this._vertexBuffers[\"offset\"] = offsets;\r\n };\r\n ParticleSystem.prototype._createIndexBuffer = function () {\r\n if (this._useInstancing) {\r\n return;\r\n }\r\n var indices = [];\r\n var index = 0;\r\n for (var count = 0; count < this._capacity; count++) {\r\n indices.push(index);\r\n indices.push(index + 1);\r\n indices.push(index + 2);\r\n indices.push(index);\r\n indices.push(index + 2);\r\n indices.push(index + 3);\r\n index += 4;\r\n }\r\n this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);\r\n };\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n ParticleSystem.prototype.getCapacity = function () {\r\n return this._capacity;\r\n };\r\n /**\r\n * Gets whether there are still active particles in the system.\r\n * @returns True if it is alive, otherwise false.\r\n */\r\n ParticleSystem.prototype.isAlive = function () {\r\n return this._alive;\r\n };\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n ParticleSystem.prototype.isStarted = function () {\r\n return this._started;\r\n };\r\n ParticleSystem.prototype._prepareSubEmitterInternalArray = function () {\r\n var _this = this;\r\n this._subEmitters = new Array();\r\n if (this.subEmitters) {\r\n this.subEmitters.forEach(function (subEmitter) {\r\n if (subEmitter instanceof ParticleSystem) {\r\n _this._subEmitters.push([new _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"](subEmitter)]);\r\n }\r\n else if (subEmitter instanceof _subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"]) {\r\n _this._subEmitters.push([subEmitter]);\r\n }\r\n else if (subEmitter instanceof Array) {\r\n _this._subEmitters.push(subEmitter);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (this.startDelay by default)\r\n */\r\n ParticleSystem.prototype.start = function (delay) {\r\n var _this = this;\r\n if (delay === void 0) { delay = this.startDelay; }\r\n if (!this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) {\r\n throw \"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set\";\r\n }\r\n if (delay) {\r\n setTimeout(function () {\r\n _this.start(0);\r\n }, delay);\r\n return;\r\n }\r\n // Convert the subEmitters field to the constant type field _subEmitters\r\n this._prepareSubEmitterInternalArray();\r\n this._started = true;\r\n this._stopped = false;\r\n this._actualFrame = 0;\r\n if (this._subEmitters && this._subEmitters.length != 0) {\r\n this.activeSubSystems = new Array();\r\n }\r\n // Reset emit gradient so it acts the same on every start\r\n if (this._emitRateGradients) {\r\n if (this._emitRateGradients.length > 0) {\r\n this._currentEmitRateGradient = this._emitRateGradients[0];\r\n this._currentEmitRate1 = this._currentEmitRateGradient.getFactor();\r\n this._currentEmitRate2 = this._currentEmitRate1;\r\n }\r\n if (this._emitRateGradients.length > 1) {\r\n this._currentEmitRate2 = this._emitRateGradients[1].getFactor();\r\n }\r\n }\r\n // Reset start size gradient so it acts the same on every start\r\n if (this._startSizeGradients) {\r\n if (this._startSizeGradients.length > 0) {\r\n this._currentStartSizeGradient = this._startSizeGradients[0];\r\n this._currentStartSize1 = this._currentStartSizeGradient.getFactor();\r\n this._currentStartSize2 = this._currentStartSize1;\r\n }\r\n if (this._startSizeGradients.length > 1) {\r\n this._currentStartSize2 = this._startSizeGradients[1].getFactor();\r\n }\r\n }\r\n if (this.preWarmCycles) {\r\n if (this.emitter instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_6__[\"AbstractMesh\"]) {\r\n this.emitter.computeWorldMatrix(true);\r\n }\r\n var noiseTextureAsProcedural_1 = this.noiseTexture;\r\n if (noiseTextureAsProcedural_1 && noiseTextureAsProcedural_1.onGeneratedObservable) {\r\n noiseTextureAsProcedural_1.onGeneratedObservable.addOnce(function () {\r\n setTimeout(function () {\r\n for (var index = 0; index < _this.preWarmCycles; index++) {\r\n _this.animate(true);\r\n noiseTextureAsProcedural_1.render();\r\n }\r\n });\r\n });\r\n }\r\n else {\r\n for (var index = 0; index < this.preWarmCycles; index++) {\r\n this.animate(true);\r\n }\r\n }\r\n }\r\n // Animations\r\n if (this.beginAnimationOnStart && this.animations && this.animations.length > 0) {\r\n this.getScene().beginAnimation(this, this.beginAnimationFrom, this.beginAnimationTo, this.beginAnimationLoop);\r\n }\r\n };\r\n /**\r\n * Stops the particle system.\r\n * @param stopSubEmitters if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.\r\n */\r\n ParticleSystem.prototype.stop = function (stopSubEmitters) {\r\n if (stopSubEmitters === void 0) { stopSubEmitters = true; }\r\n this._stopped = true;\r\n if (stopSubEmitters) {\r\n this._stopSubEmitters();\r\n }\r\n };\r\n // animation sheet\r\n /**\r\n * Remove all active particles\r\n */\r\n ParticleSystem.prototype.reset = function () {\r\n this._stockParticles = [];\r\n this._particles = [];\r\n };\r\n /**\r\n * @hidden (for internal use only)\r\n */\r\n ParticleSystem.prototype._appendParticleVertex = function (index, particle, offsetX, offsetY) {\r\n var offset = index * this._vertexBufferSize;\r\n this._vertexData[offset++] = particle.position.x + this.worldOffset.x;\r\n this._vertexData[offset++] = particle.position.y + this.worldOffset.y;\r\n this._vertexData[offset++] = particle.position.z + this.worldOffset.z;\r\n this._vertexData[offset++] = particle.color.r;\r\n this._vertexData[offset++] = particle.color.g;\r\n this._vertexData[offset++] = particle.color.b;\r\n this._vertexData[offset++] = particle.color.a;\r\n this._vertexData[offset++] = particle.angle;\r\n this._vertexData[offset++] = particle.scale.x * particle.size;\r\n this._vertexData[offset++] = particle.scale.y * particle.size;\r\n if (this._isAnimationSheetEnabled) {\r\n this._vertexData[offset++] = particle.cellIndex;\r\n }\r\n if (!this._isBillboardBased) {\r\n if (particle._initialDirection) {\r\n this._vertexData[offset++] = particle._initialDirection.x;\r\n this._vertexData[offset++] = particle._initialDirection.y;\r\n this._vertexData[offset++] = particle._initialDirection.z;\r\n }\r\n else {\r\n this._vertexData[offset++] = particle.direction.x;\r\n this._vertexData[offset++] = particle.direction.y;\r\n this._vertexData[offset++] = particle.direction.z;\r\n }\r\n }\r\n else if (this.billboardMode === ParticleSystem.BILLBOARDMODE_STRETCHED) {\r\n this._vertexData[offset++] = particle.direction.x;\r\n this._vertexData[offset++] = particle.direction.y;\r\n this._vertexData[offset++] = particle.direction.z;\r\n }\r\n if (this._useRampGradients) {\r\n this._vertexData[offset++] = particle.remapData.x;\r\n this._vertexData[offset++] = particle.remapData.y;\r\n this._vertexData[offset++] = particle.remapData.z;\r\n this._vertexData[offset++] = particle.remapData.w;\r\n }\r\n if (!this._useInstancing) {\r\n if (this._isAnimationSheetEnabled) {\r\n if (offsetX === 0) {\r\n offsetX = this._epsilon;\r\n }\r\n else if (offsetX === 1) {\r\n offsetX = 1 - this._epsilon;\r\n }\r\n if (offsetY === 0) {\r\n offsetY = this._epsilon;\r\n }\r\n else if (offsetY === 1) {\r\n offsetY = 1 - this._epsilon;\r\n }\r\n }\r\n this._vertexData[offset++] = offsetX;\r\n this._vertexData[offset++] = offsetY;\r\n }\r\n };\r\n ParticleSystem.prototype._stopSubEmitters = function () {\r\n if (!this.activeSubSystems) {\r\n return;\r\n }\r\n this.activeSubSystems.forEach(function (subSystem) {\r\n subSystem.stop(true);\r\n });\r\n this.activeSubSystems = new Array();\r\n };\r\n ParticleSystem.prototype._removeFromRoot = function () {\r\n if (!this._rootParticleSystem) {\r\n return;\r\n }\r\n var index = this._rootParticleSystem.activeSubSystems.indexOf(this);\r\n if (index !== -1) {\r\n this._rootParticleSystem.activeSubSystems.splice(index, 1);\r\n }\r\n this._rootParticleSystem = null;\r\n };\r\n // End of sub system methods\r\n ParticleSystem.prototype._update = function (newParticles) {\r\n var _this = this;\r\n // Update current\r\n this._alive = this._particles.length > 0;\r\n if (this.emitter.position) {\r\n var emitterMesh = this.emitter;\r\n this._emitterWorldMatrix = emitterMesh.getWorldMatrix();\r\n }\r\n else {\r\n var emitterPosition = this.emitter;\r\n this._emitterWorldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Translation(emitterPosition.x, emitterPosition.y, emitterPosition.z);\r\n }\r\n this.updateFunction(this._particles);\r\n // Add new ones\r\n var particle;\r\n var _loop_2 = function () {\r\n if (this_1._particles.length === this_1._capacity) {\r\n return \"break\";\r\n }\r\n particle = this_1._createParticle();\r\n this_1._particles.push(particle);\r\n // Emitter\r\n var emitPower = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minEmitPower, this_1.maxEmitPower);\r\n if (this_1.startPositionFunction) {\r\n this_1.startPositionFunction(this_1._emitterWorldMatrix, particle.position, particle);\r\n }\r\n else {\r\n this_1.particleEmitterType.startPositionFunction(this_1._emitterWorldMatrix, particle.position, particle);\r\n }\r\n if (this_1.startDirectionFunction) {\r\n this_1.startDirectionFunction(this_1._emitterWorldMatrix, particle.direction, particle);\r\n }\r\n else {\r\n this_1.particleEmitterType.startDirectionFunction(this_1._emitterWorldMatrix, particle.direction, particle);\r\n }\r\n if (emitPower === 0) {\r\n if (!particle._initialDirection) {\r\n particle._initialDirection = particle.direction.clone();\r\n }\r\n else {\r\n particle._initialDirection.copyFrom(particle.direction);\r\n }\r\n }\r\n else {\r\n particle._initialDirection = null;\r\n }\r\n particle.direction.scaleInPlace(emitPower);\r\n // Life time\r\n if (this_1.targetStopDuration && this_1._lifeTimeGradients && this_1._lifeTimeGradients.length > 0) {\r\n var ratio_1 = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Clamp(this_1._actualFrame / this_1.targetStopDuration);\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio_1, this_1._lifeTimeGradients, function (currentGradient, nextGradient) {\r\n var factorGradient1 = currentGradient;\r\n var factorGradient2 = nextGradient;\r\n var lifeTime1 = factorGradient1.getFactor();\r\n var lifeTime2 = factorGradient2.getFactor();\r\n var gradient = (ratio_1 - factorGradient1.gradient) / (factorGradient2.gradient - factorGradient1.gradient);\r\n particle.lifeTime = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(lifeTime1, lifeTime2, gradient);\r\n });\r\n }\r\n else {\r\n particle.lifeTime = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minLifeTime, this_1.maxLifeTime);\r\n }\r\n // Size\r\n if (!this_1._sizeGradients || this_1._sizeGradients.length === 0) {\r\n particle.size = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minSize, this_1.maxSize);\r\n }\r\n else {\r\n particle._currentSizeGradient = this_1._sizeGradients[0];\r\n particle._currentSize1 = particle._currentSizeGradient.getFactor();\r\n particle.size = particle._currentSize1;\r\n if (this_1._sizeGradients.length > 1) {\r\n particle._currentSize2 = this_1._sizeGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentSize2 = particle._currentSize1;\r\n }\r\n }\r\n // Size and scale\r\n particle.scale.copyFromFloats(_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minScaleX, this_1.maxScaleX), _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minScaleY, this_1.maxScaleY));\r\n // Adjust scale by start size\r\n if (this_1._startSizeGradients && this_1._startSizeGradients[0] && this_1.targetStopDuration) {\r\n var ratio = this_1._actualFrame / this_1.targetStopDuration;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this_1._startSizeGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== _this._currentStartSizeGradient) {\r\n _this._currentStartSize1 = _this._currentStartSize2;\r\n _this._currentStartSize2 = nextGradient.getFactor();\r\n _this._currentStartSizeGradient = currentGradient;\r\n }\r\n var value = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(_this._currentStartSize1, _this._currentStartSize2, scale);\r\n particle.scale.scaleInPlace(value);\r\n });\r\n }\r\n // Angle\r\n if (!this_1._angularSpeedGradients || this_1._angularSpeedGradients.length === 0) {\r\n particle.angularSpeed = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minAngularSpeed, this_1.maxAngularSpeed);\r\n }\r\n else {\r\n particle._currentAngularSpeedGradient = this_1._angularSpeedGradients[0];\r\n particle.angularSpeed = particle._currentAngularSpeedGradient.getFactor();\r\n particle._currentAngularSpeed1 = particle.angularSpeed;\r\n if (this_1._angularSpeedGradients.length > 1) {\r\n particle._currentAngularSpeed2 = this_1._angularSpeedGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentAngularSpeed2 = particle._currentAngularSpeed1;\r\n }\r\n }\r\n particle.angle = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(this_1.minInitialRotation, this_1.maxInitialRotation);\r\n // Velocity\r\n if (this_1._velocityGradients && this_1._velocityGradients.length > 0) {\r\n particle._currentVelocityGradient = this_1._velocityGradients[0];\r\n particle._currentVelocity1 = particle._currentVelocityGradient.getFactor();\r\n if (this_1._velocityGradients.length > 1) {\r\n particle._currentVelocity2 = this_1._velocityGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentVelocity2 = particle._currentVelocity1;\r\n }\r\n }\r\n // Limit velocity\r\n if (this_1._limitVelocityGradients && this_1._limitVelocityGradients.length > 0) {\r\n particle._currentLimitVelocityGradient = this_1._limitVelocityGradients[0];\r\n particle._currentLimitVelocity1 = particle._currentLimitVelocityGradient.getFactor();\r\n if (this_1._limitVelocityGradients.length > 1) {\r\n particle._currentLimitVelocity2 = this_1._limitVelocityGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentLimitVelocity2 = particle._currentLimitVelocity1;\r\n }\r\n }\r\n // Drag\r\n if (this_1._dragGradients && this_1._dragGradients.length > 0) {\r\n particle._currentDragGradient = this_1._dragGradients[0];\r\n particle._currentDrag1 = particle._currentDragGradient.getFactor();\r\n if (this_1._dragGradients.length > 1) {\r\n particle._currentDrag2 = this_1._dragGradients[1].getFactor();\r\n }\r\n else {\r\n particle._currentDrag2 = particle._currentDrag1;\r\n }\r\n }\r\n // Color\r\n if (!this_1._colorGradients || this_1._colorGradients.length === 0) {\r\n step = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].RandomRange(0, 1.0);\r\n _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].LerpToRef(this_1.color1, this_1.color2, step, particle.color);\r\n this_1.colorDead.subtractToRef(particle.color, this_1._colorDiff);\r\n this_1._colorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);\r\n }\r\n else {\r\n particle._currentColorGradient = this_1._colorGradients[0];\r\n particle._currentColorGradient.getColorToRef(particle.color);\r\n particle._currentColor1.copyFrom(particle.color);\r\n if (this_1._colorGradients.length > 1) {\r\n this_1._colorGradients[1].getColorToRef(particle._currentColor2);\r\n }\r\n else {\r\n particle._currentColor2.copyFrom(particle.color);\r\n }\r\n }\r\n // Sheet\r\n if (this_1._isAnimationSheetEnabled) {\r\n particle._initialStartSpriteCellID = this_1.startSpriteCellID;\r\n particle._initialEndSpriteCellID = this_1.endSpriteCellID;\r\n }\r\n // Inherited Velocity\r\n particle.direction.addInPlace(this_1._inheritedVelocityOffset);\r\n // Ramp\r\n if (this_1._useRampGradients) {\r\n particle.remapData = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector4\"](0, 1, 0, 1);\r\n }\r\n // Noise texture coordinates\r\n if (this_1.noiseTexture) {\r\n if (particle._randomNoiseCoordinates1) {\r\n particle._randomNoiseCoordinates1.copyFromFloats(Math.random(), Math.random(), Math.random());\r\n particle._randomNoiseCoordinates2.copyFromFloats(Math.random(), Math.random(), Math.random());\r\n }\r\n else {\r\n particle._randomNoiseCoordinates1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Math.random(), Math.random(), Math.random());\r\n particle._randomNoiseCoordinates2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Math.random(), Math.random(), Math.random());\r\n }\r\n }\r\n // Update the position of the attached sub-emitters to match their attached particle\r\n particle._inheritParticleInfoToSubEmitters();\r\n };\r\n var this_1 = this, step;\r\n for (var index = 0; index < newParticles; index++) {\r\n var state_1 = _loop_2();\r\n if (state_1 === \"break\")\r\n break;\r\n }\r\n };\r\n /** @hidden */\r\n ParticleSystem._GetAttributeNamesOrOptions = function (isAnimationSheetEnabled, isBillboardBased, useRampGradients) {\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n if (isBillboardBased === void 0) { isBillboardBased = false; }\r\n if (useRampGradients === void 0) { useRampGradients = false; }\r\n var attributeNamesOrOptions = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].PositionKind, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_5__[\"VertexBuffer\"].ColorKind, \"angle\", \"offset\", \"size\"];\r\n if (isAnimationSheetEnabled) {\r\n attributeNamesOrOptions.push(\"cellIndex\");\r\n }\r\n if (!isBillboardBased) {\r\n attributeNamesOrOptions.push(\"direction\");\r\n }\r\n if (useRampGradients) {\r\n attributeNamesOrOptions.push(\"remapData\");\r\n }\r\n return attributeNamesOrOptions;\r\n };\r\n /** @hidden */\r\n ParticleSystem._GetEffectCreationOptions = function (isAnimationSheetEnabled) {\r\n if (isAnimationSheetEnabled === void 0) { isAnimationSheetEnabled = false; }\r\n var effectCreationOption = [\"invView\", \"view\", \"projection\", \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"textureMask\", \"translationPivot\", \"eyePosition\"];\r\n if (isAnimationSheetEnabled) {\r\n effectCreationOption.push(\"particlesInfos\");\r\n }\r\n return effectCreationOption;\r\n };\r\n /** @hidden */\r\n ParticleSystem.prototype._getEffect = function (blendMode) {\r\n if (this._customEffect) {\r\n return this._customEffect;\r\n }\r\n var defines = [];\r\n if (this._scene.clipPlane) {\r\n defines.push(\"#define CLIPPLANE\");\r\n }\r\n if (this._scene.clipPlane2) {\r\n defines.push(\"#define CLIPPLANE2\");\r\n }\r\n if (this._scene.clipPlane3) {\r\n defines.push(\"#define CLIPPLANE3\");\r\n }\r\n if (this._scene.clipPlane4) {\r\n defines.push(\"#define CLIPPLANE4\");\r\n }\r\n if (this._isAnimationSheetEnabled) {\r\n defines.push(\"#define ANIMATESHEET\");\r\n }\r\n if (blendMode === ParticleSystem.BLENDMODE_MULTIPLY) {\r\n defines.push(\"#define BLENDMULTIPLYMODE\");\r\n }\r\n if (this._useRampGradients) {\r\n defines.push(\"#define RAMPGRADIENT\");\r\n }\r\n if (this._isBillboardBased) {\r\n defines.push(\"#define BILLBOARD\");\r\n switch (this.billboardMode) {\r\n case ParticleSystem.BILLBOARDMODE_Y:\r\n defines.push(\"#define BILLBOARDY\");\r\n break;\r\n case ParticleSystem.BILLBOARDMODE_STRETCHED:\r\n defines.push(\"#define BILLBOARDSTRETCHED\");\r\n break;\r\n case ParticleSystem.BILLBOARDMODE_ALL:\r\n default:\r\n break;\r\n }\r\n }\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines);\r\n defines.push(this._imageProcessingConfigurationDefines.toString());\r\n }\r\n // Effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n var attributesNamesOrOptions = ParticleSystem._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled, this._isBillboardBased && this.billboardMode !== ParticleSystem.BILLBOARDMODE_STRETCHED, this._useRampGradients);\r\n var effectCreationOption = ParticleSystem._GetEffectCreationOptions(this._isAnimationSheetEnabled);\r\n var samplers = [\"diffuseSampler\", \"rampSampler\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"ImageProcessingConfiguration\"].PrepareUniforms(effectCreationOption, this._imageProcessingConfigurationDefines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_9__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, this._imageProcessingConfigurationDefines);\r\n }\r\n this._effect = this._scene.getEngine().createEffect(\"particles\", attributesNamesOrOptions, effectCreationOption, samplers, join);\r\n }\r\n return this._effect;\r\n };\r\n /**\r\n * Animates the particle system for the current frame by emitting new particles and or animating the living ones.\r\n * @param preWarmOnly will prevent the system from updating the vertex buffer (default is false)\r\n */\r\n ParticleSystem.prototype.animate = function (preWarmOnly) {\r\n var _this = this;\r\n if (preWarmOnly === void 0) { preWarmOnly = false; }\r\n if (!this._started) {\r\n return;\r\n }\r\n if (!preWarmOnly) {\r\n // Check\r\n if (!this.isReady()) {\r\n return;\r\n }\r\n if (this._currentRenderId === this._scene.getFrameId()) {\r\n return;\r\n }\r\n this._currentRenderId = this._scene.getFrameId();\r\n }\r\n this._scaledUpdateSpeed = this.updateSpeed * (preWarmOnly ? this.preWarmStepOffset : this._scene.getAnimationRatio());\r\n // Determine the number of particles we need to create\r\n var newParticles;\r\n if (this.manualEmitCount > -1) {\r\n newParticles = this.manualEmitCount;\r\n this._newPartsExcess = 0;\r\n this.manualEmitCount = 0;\r\n }\r\n else {\r\n var rate_1 = this.emitRate;\r\n if (this._emitRateGradients && this._emitRateGradients.length > 0 && this.targetStopDuration) {\r\n var ratio = this._actualFrame / this.targetStopDuration;\r\n _Misc_gradients__WEBPACK_IMPORTED_MODULE_1__[\"GradientHelper\"].GetCurrentGradient(ratio, this._emitRateGradients, function (currentGradient, nextGradient, scale) {\r\n if (currentGradient !== _this._currentEmitRateGradient) {\r\n _this._currentEmitRate1 = _this._currentEmitRate2;\r\n _this._currentEmitRate2 = nextGradient.getFactor();\r\n _this._currentEmitRateGradient = currentGradient;\r\n }\r\n rate_1 = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Lerp(_this._currentEmitRate1, _this._currentEmitRate2, scale);\r\n });\r\n }\r\n newParticles = ((rate_1 * this._scaledUpdateSpeed) >> 0);\r\n this._newPartsExcess += rate_1 * this._scaledUpdateSpeed - newParticles;\r\n }\r\n if (this._newPartsExcess > 1.0) {\r\n newParticles += this._newPartsExcess >> 0;\r\n this._newPartsExcess -= this._newPartsExcess >> 0;\r\n }\r\n this._alive = false;\r\n if (!this._stopped) {\r\n this._actualFrame += this._scaledUpdateSpeed;\r\n if (this.targetStopDuration && this._actualFrame >= this.targetStopDuration) {\r\n this.stop();\r\n }\r\n }\r\n else {\r\n newParticles = 0;\r\n }\r\n this._update(newParticles);\r\n // Stopped?\r\n if (this._stopped) {\r\n if (!this._alive) {\r\n this._started = false;\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n if (this.disposeOnStop) {\r\n this._scene._toBeDisposed.push(this);\r\n }\r\n }\r\n }\r\n if (!preWarmOnly) {\r\n // Update VBO\r\n var offset = 0;\r\n for (var index = 0; index < this._particles.length; index++) {\r\n var particle = this._particles[index];\r\n this._appendParticleVertices(offset, particle);\r\n offset += this._useInstancing ? 1 : 4;\r\n }\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer.update(this._vertexData);\r\n }\r\n }\r\n if (this.manualEmitCount === 0 && this.disposeOnStop) {\r\n this.stop();\r\n }\r\n };\r\n ParticleSystem.prototype._appendParticleVertices = function (offset, particle) {\r\n this._appendParticleVertex(offset++, particle, 0, 0);\r\n if (!this._useInstancing) {\r\n this._appendParticleVertex(offset++, particle, 1, 0);\r\n this._appendParticleVertex(offset++, particle, 1, 1);\r\n this._appendParticleVertex(offset++, particle, 0, 1);\r\n }\r\n };\r\n /**\r\n * Rebuilds the particle system.\r\n */\r\n ParticleSystem.prototype.rebuild = function () {\r\n this._createIndexBuffer();\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer._rebuild();\r\n }\r\n for (var key in this._vertexBuffers) {\r\n this._vertexBuffers[key]._rebuild();\r\n }\r\n };\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @return true if the system is ready\r\n */\r\n ParticleSystem.prototype.isReady = function () {\r\n if (!this.emitter || !this._imageProcessingConfiguration.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {\r\n return false;\r\n }\r\n if (this.blendMode !== ParticleSystem.BLENDMODE_MULTIPLYADD) {\r\n if (!this._getEffect(this.blendMode).isReady()) {\r\n return false;\r\n }\r\n }\r\n else {\r\n if (!this._getEffect(ParticleSystem.BLENDMODE_MULTIPLY).isReady()) {\r\n return false;\r\n }\r\n if (!this._getEffect(ParticleSystem.BLENDMODE_ADD).isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n ParticleSystem.prototype._render = function (blendMode) {\r\n var effect = this._getEffect(blendMode);\r\n var engine = this._scene.getEngine();\r\n // Render\r\n engine.enableEffect(effect);\r\n var viewMatrix = this._scene.getViewMatrix();\r\n effect.setTexture(\"diffuseSampler\", this.particleTexture);\r\n effect.setMatrix(\"view\", viewMatrix);\r\n effect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\r\n if (this._isAnimationSheetEnabled && this.particleTexture) {\r\n var baseSize = this.particleTexture.getBaseSize();\r\n effect.setFloat3(\"particlesInfos\", this.spriteCellWidth / baseSize.width, this.spriteCellHeight / baseSize.height, baseSize.width / this.spriteCellWidth);\r\n }\r\n effect.setVector2(\"translationPivot\", this.translationPivot);\r\n effect.setFloat4(\"textureMask\", this.textureMask.r, this.textureMask.g, this.textureMask.b, this.textureMask.a);\r\n if (this._isBillboardBased) {\r\n var camera = this._scene.activeCamera;\r\n effect.setVector3(\"eyePosition\", camera.globalPosition);\r\n }\r\n if (this._rampGradientsTexture) {\r\n effect.setTexture(\"rampSampler\", this._rampGradientsTexture);\r\n }\r\n if (this._scene.clipPlane || this._scene.clipPlane2 || this._scene.clipPlane3 || this._scene.clipPlane4) {\r\n var invView = viewMatrix.clone();\r\n invView.invert();\r\n effect.setMatrix(\"invView\", invView);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__[\"MaterialHelper\"].BindClipPlane(effect, this._scene);\r\n }\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(effect);\r\n }\r\n // Draw order\r\n switch (blendMode) {\r\n case ParticleSystem.BLENDMODE_ADD:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_ADD);\r\n break;\r\n case ParticleSystem.BLENDMODE_ONEONE:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_ONEONE);\r\n break;\r\n case ParticleSystem.BLENDMODE_STANDARD:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_COMBINE);\r\n break;\r\n case ParticleSystem.BLENDMODE_MULTIPLY:\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_MULTIPLY);\r\n break;\r\n }\r\n if (this._useInstancing) {\r\n engine.drawArraysType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFanDrawMode, 0, 4, this._particles.length);\r\n }\r\n else {\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, this._particles.length * 6);\r\n }\r\n return this._particles.length;\r\n };\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n ParticleSystem.prototype.render = function () {\r\n // Check\r\n if (!this.isReady() || !this._particles.length) {\r\n return 0;\r\n }\r\n var engine = this._scene.getEngine();\r\n engine.setState(false);\r\n if (this.forceDepthWrite) {\r\n engine.setDepthWrite(true);\r\n }\r\n var outparticles = 0;\r\n if (this.blendMode === ParticleSystem.BLENDMODE_MULTIPLYADD) {\r\n outparticles = this._render(ParticleSystem.BLENDMODE_MULTIPLY) + this._render(ParticleSystem.BLENDMODE_ADD);\r\n }\r\n outparticles = this._render(this.blendMode);\r\n engine.unbindInstanceAttributes();\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].ALPHA_DISABLE);\r\n return outparticles;\r\n };\r\n /**\r\n * Disposes the particle system and free the associated resources\r\n * @param disposeTexture defines if the particule texture must be disposed as well (true by default)\r\n */\r\n ParticleSystem.prototype.dispose = function (disposeTexture) {\r\n if (disposeTexture === void 0) { disposeTexture = true; }\r\n if (this._vertexBuffer) {\r\n this._vertexBuffer.dispose();\r\n this._vertexBuffer = null;\r\n }\r\n if (this._spriteBuffer) {\r\n this._spriteBuffer.dispose();\r\n this._spriteBuffer = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (disposeTexture && this.particleTexture) {\r\n this.particleTexture.dispose();\r\n this.particleTexture = null;\r\n }\r\n if (disposeTexture && this.noiseTexture) {\r\n this.noiseTexture.dispose();\r\n this.noiseTexture = null;\r\n }\r\n if (this._rampGradientsTexture) {\r\n this._rampGradientsTexture.dispose();\r\n this._rampGradientsTexture = null;\r\n }\r\n this._removeFromRoot();\r\n if (this._subEmitters && this._subEmitters.length) {\r\n for (var index = 0; index < this._subEmitters.length; index++) {\r\n for (var _i = 0, _a = this._subEmitters[index]; _i < _a.length; _i++) {\r\n var subEmitter = _a[_i];\r\n subEmitter.dispose();\r\n }\r\n }\r\n this._subEmitters = [];\r\n this.subEmitters = [];\r\n }\r\n if (this._disposeEmitterOnDispose && this.emitter && this.emitter.dispose) {\r\n this.emitter.dispose(true);\r\n }\r\n // Remove from scene\r\n var index = this._scene.particleSystems.indexOf(this);\r\n if (index > -1) {\r\n this._scene.particleSystems.splice(index, 1);\r\n }\r\n this._scene._activeParticleSystems.dispose();\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.reset();\r\n };\r\n // Clone\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n ParticleSystem.prototype.clone = function (name, newEmitter) {\r\n var custom = null;\r\n var program = null;\r\n if (this.customShader != null) {\r\n program = this.customShader;\r\n var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join(\"\\n\") : \"\";\r\n custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);\r\n }\r\n else if (this._customEffect) {\r\n custom = this._customEffect;\r\n }\r\n var result = new ParticleSystem(name, this._capacity, this._scene, custom);\r\n result.customShader = program;\r\n _Misc_deepCopier__WEBPACK_IMPORTED_MODULE_20__[\"DeepCopier\"].DeepCopy(this, result, [\"particles\", \"customShader\", \"noiseTexture\", \"particleTexture\", \"onDisposeObservable\"]);\r\n if (newEmitter === undefined) {\r\n newEmitter = this.emitter;\r\n }\r\n result.noiseTexture = this.noiseTexture;\r\n result.emitter = newEmitter;\r\n if (this.particleTexture) {\r\n result.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"](this.particleTexture.url, this._scene);\r\n }\r\n // Clone gradients\r\n if (this._colorGradients) {\r\n this._colorGradients.forEach(function (v) {\r\n result.addColorGradient(v.gradient, v.color1, v.color2);\r\n });\r\n }\r\n if (this._dragGradients) {\r\n this._dragGradients.forEach(function (v) {\r\n result.addDragGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._angularSpeedGradients) {\r\n this._angularSpeedGradients.forEach(function (v) {\r\n result.addAngularSpeedGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._emitRateGradients) {\r\n this._emitRateGradients.forEach(function (v) {\r\n result.addEmitRateGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._lifeTimeGradients) {\r\n this._lifeTimeGradients.forEach(function (v) {\r\n result.addLifeTimeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._limitVelocityGradients) {\r\n this._limitVelocityGradients.forEach(function (v) {\r\n result.addLimitVelocityGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._sizeGradients) {\r\n this._sizeGradients.forEach(function (v) {\r\n result.addSizeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._startSizeGradients) {\r\n this._startSizeGradients.forEach(function (v) {\r\n result.addStartSizeGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._velocityGradients) {\r\n this._velocityGradients.forEach(function (v) {\r\n result.addVelocityGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._rampGradients) {\r\n this._rampGradients.forEach(function (v) {\r\n result.addRampGradient(v.gradient, v.color);\r\n });\r\n }\r\n if (this._colorRemapGradients) {\r\n this._colorRemapGradients.forEach(function (v) {\r\n result.addColorRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (this._alphaRemapGradients) {\r\n this._alphaRemapGradients.forEach(function (v) {\r\n result.addAlphaRemapGradient(v.gradient, v.factor1, v.factor2);\r\n });\r\n }\r\n if (!this.preventAutoStart) {\r\n result.start();\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n ParticleSystem.prototype.serialize = function () {\r\n var serializationObject = {};\r\n ParticleSystem._Serialize(serializationObject, this);\r\n serializationObject.textureMask = this.textureMask.asArray();\r\n serializationObject.customShader = this.customShader;\r\n serializationObject.preventAutoStart = this.preventAutoStart;\r\n // SubEmitters\r\n if (this.subEmitters) {\r\n serializationObject.subEmitters = [];\r\n if (!this._subEmitters) {\r\n this._prepareSubEmitterInternalArray();\r\n }\r\n for (var _i = 0, _a = this._subEmitters; _i < _a.length; _i++) {\r\n var subs = _a[_i];\r\n var cell = [];\r\n for (var _b = 0, subs_1 = subs; _b < subs_1.length; _b++) {\r\n var sub = subs_1[_b];\r\n cell.push(sub.serialize());\r\n }\r\n serializationObject.subEmitters.push(cell);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n ParticleSystem._Serialize = function (serializationObject, particleSystem) {\r\n serializationObject.name = particleSystem.name;\r\n serializationObject.id = particleSystem.id;\r\n serializationObject.capacity = particleSystem.getCapacity();\r\n // Emitter\r\n if (particleSystem.emitter.position) {\r\n var emitterMesh = particleSystem.emitter;\r\n serializationObject.emitterId = emitterMesh.id;\r\n }\r\n else {\r\n var emitterPosition = particleSystem.emitter;\r\n serializationObject.emitter = emitterPosition.asArray();\r\n }\r\n // Emitter\r\n if (particleSystem.particleEmitterType) {\r\n serializationObject.particleEmitterType = particleSystem.particleEmitterType.serialize();\r\n }\r\n if (particleSystem.particleTexture) {\r\n serializationObject.textureName = particleSystem.particleTexture.name;\r\n serializationObject.invertY = particleSystem.particleTexture._invertY;\r\n }\r\n // Animations\r\n _Misc_decorators__WEBPACK_IMPORTED_MODULE_19__[\"SerializationHelper\"].AppendSerializedAnimations(particleSystem, serializationObject);\r\n serializationObject.beginAnimationOnStart = particleSystem.beginAnimationOnStart;\r\n serializationObject.beginAnimationFrom = particleSystem.beginAnimationFrom;\r\n serializationObject.beginAnimationTo = particleSystem.beginAnimationTo;\r\n serializationObject.beginAnimationLoop = particleSystem.beginAnimationLoop;\r\n // Particle system\r\n serializationObject.startDelay = particleSystem.startDelay;\r\n serializationObject.renderingGroupId = particleSystem.renderingGroupId;\r\n serializationObject.isBillboardBased = particleSystem.isBillboardBased;\r\n serializationObject.billboardMode = particleSystem.billboardMode;\r\n serializationObject.minAngularSpeed = particleSystem.minAngularSpeed;\r\n serializationObject.maxAngularSpeed = particleSystem.maxAngularSpeed;\r\n serializationObject.minSize = particleSystem.minSize;\r\n serializationObject.maxSize = particleSystem.maxSize;\r\n serializationObject.minScaleX = particleSystem.minScaleX;\r\n serializationObject.maxScaleX = particleSystem.maxScaleX;\r\n serializationObject.minScaleY = particleSystem.minScaleY;\r\n serializationObject.maxScaleY = particleSystem.maxScaleY;\r\n serializationObject.minEmitPower = particleSystem.minEmitPower;\r\n serializationObject.maxEmitPower = particleSystem.maxEmitPower;\r\n serializationObject.minLifeTime = particleSystem.minLifeTime;\r\n serializationObject.maxLifeTime = particleSystem.maxLifeTime;\r\n serializationObject.emitRate = particleSystem.emitRate;\r\n serializationObject.gravity = particleSystem.gravity.asArray();\r\n serializationObject.noiseStrength = particleSystem.noiseStrength.asArray();\r\n serializationObject.color1 = particleSystem.color1.asArray();\r\n serializationObject.color2 = particleSystem.color2.asArray();\r\n serializationObject.colorDead = particleSystem.colorDead.asArray();\r\n serializationObject.updateSpeed = particleSystem.updateSpeed;\r\n serializationObject.targetStopDuration = particleSystem.targetStopDuration;\r\n serializationObject.blendMode = particleSystem.blendMode;\r\n serializationObject.preWarmCycles = particleSystem.preWarmCycles;\r\n serializationObject.preWarmStepOffset = particleSystem.preWarmStepOffset;\r\n serializationObject.minInitialRotation = particleSystem.minInitialRotation;\r\n serializationObject.maxInitialRotation = particleSystem.maxInitialRotation;\r\n serializationObject.startSpriteCellID = particleSystem.startSpriteCellID;\r\n serializationObject.endSpriteCellID = particleSystem.endSpriteCellID;\r\n serializationObject.spriteCellChangeSpeed = particleSystem.spriteCellChangeSpeed;\r\n serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;\r\n serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;\r\n serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;\r\n serializationObject.isAnimationSheetEnabled = particleSystem.isAnimationSheetEnabled;\r\n var colorGradients = particleSystem.getColorGradients();\r\n if (colorGradients) {\r\n serializationObject.colorGradients = [];\r\n for (var _i = 0, colorGradients_1 = colorGradients; _i < colorGradients_1.length; _i++) {\r\n var colorGradient = colorGradients_1[_i];\r\n var serializedGradient = {\r\n gradient: colorGradient.gradient,\r\n color1: colorGradient.color1.asArray()\r\n };\r\n if (colorGradient.color2) {\r\n serializedGradient.color2 = colorGradient.color2.asArray();\r\n }\r\n serializationObject.colorGradients.push(serializedGradient);\r\n }\r\n }\r\n var rampGradients = particleSystem.getRampGradients();\r\n if (rampGradients) {\r\n serializationObject.rampGradients = [];\r\n for (var _a = 0, rampGradients_1 = rampGradients; _a < rampGradients_1.length; _a++) {\r\n var rampGradient = rampGradients_1[_a];\r\n var serializedGradient = {\r\n gradient: rampGradient.gradient,\r\n color: rampGradient.color.asArray()\r\n };\r\n serializationObject.rampGradients.push(serializedGradient);\r\n }\r\n serializationObject.useRampGradients = particleSystem.useRampGradients;\r\n }\r\n var colorRemapGradients = particleSystem.getColorRemapGradients();\r\n if (colorRemapGradients) {\r\n serializationObject.colorRemapGradients = [];\r\n for (var _b = 0, colorRemapGradients_1 = colorRemapGradients; _b < colorRemapGradients_1.length; _b++) {\r\n var colorRemapGradient = colorRemapGradients_1[_b];\r\n var serializedGradient = {\r\n gradient: colorRemapGradient.gradient,\r\n factor1: colorRemapGradient.factor1\r\n };\r\n if (colorRemapGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = colorRemapGradient.factor2;\r\n }\r\n serializationObject.colorRemapGradients.push(serializedGradient);\r\n }\r\n }\r\n var alphaRemapGradients = particleSystem.getAlphaRemapGradients();\r\n if (alphaRemapGradients) {\r\n serializationObject.alphaRemapGradients = [];\r\n for (var _c = 0, alphaRemapGradients_1 = alphaRemapGradients; _c < alphaRemapGradients_1.length; _c++) {\r\n var alphaRemapGradient = alphaRemapGradients_1[_c];\r\n var serializedGradient = {\r\n gradient: alphaRemapGradient.gradient,\r\n factor1: alphaRemapGradient.factor1\r\n };\r\n if (alphaRemapGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = alphaRemapGradient.factor2;\r\n }\r\n serializationObject.alphaRemapGradients.push(serializedGradient);\r\n }\r\n }\r\n var sizeGradients = particleSystem.getSizeGradients();\r\n if (sizeGradients) {\r\n serializationObject.sizeGradients = [];\r\n for (var _d = 0, sizeGradients_1 = sizeGradients; _d < sizeGradients_1.length; _d++) {\r\n var sizeGradient = sizeGradients_1[_d];\r\n var serializedGradient = {\r\n gradient: sizeGradient.gradient,\r\n factor1: sizeGradient.factor1\r\n };\r\n if (sizeGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = sizeGradient.factor2;\r\n }\r\n serializationObject.sizeGradients.push(serializedGradient);\r\n }\r\n }\r\n var angularSpeedGradients = particleSystem.getAngularSpeedGradients();\r\n if (angularSpeedGradients) {\r\n serializationObject.angularSpeedGradients = [];\r\n for (var _e = 0, angularSpeedGradients_1 = angularSpeedGradients; _e < angularSpeedGradients_1.length; _e++) {\r\n var angularSpeedGradient = angularSpeedGradients_1[_e];\r\n var serializedGradient = {\r\n gradient: angularSpeedGradient.gradient,\r\n factor1: angularSpeedGradient.factor1\r\n };\r\n if (angularSpeedGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = angularSpeedGradient.factor2;\r\n }\r\n serializationObject.angularSpeedGradients.push(serializedGradient);\r\n }\r\n }\r\n var velocityGradients = particleSystem.getVelocityGradients();\r\n if (velocityGradients) {\r\n serializationObject.velocityGradients = [];\r\n for (var _f = 0, velocityGradients_1 = velocityGradients; _f < velocityGradients_1.length; _f++) {\r\n var velocityGradient = velocityGradients_1[_f];\r\n var serializedGradient = {\r\n gradient: velocityGradient.gradient,\r\n factor1: velocityGradient.factor1\r\n };\r\n if (velocityGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = velocityGradient.factor2;\r\n }\r\n serializationObject.velocityGradients.push(serializedGradient);\r\n }\r\n }\r\n var dragGradients = particleSystem.getDragGradients();\r\n if (dragGradients) {\r\n serializationObject.dragGradients = [];\r\n for (var _g = 0, dragGradients_1 = dragGradients; _g < dragGradients_1.length; _g++) {\r\n var dragGradient = dragGradients_1[_g];\r\n var serializedGradient = {\r\n gradient: dragGradient.gradient,\r\n factor1: dragGradient.factor1\r\n };\r\n if (dragGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = dragGradient.factor2;\r\n }\r\n serializationObject.dragGradients.push(serializedGradient);\r\n }\r\n }\r\n var emitRateGradients = particleSystem.getEmitRateGradients();\r\n if (emitRateGradients) {\r\n serializationObject.emitRateGradients = [];\r\n for (var _h = 0, emitRateGradients_1 = emitRateGradients; _h < emitRateGradients_1.length; _h++) {\r\n var emitRateGradient = emitRateGradients_1[_h];\r\n var serializedGradient = {\r\n gradient: emitRateGradient.gradient,\r\n factor1: emitRateGradient.factor1\r\n };\r\n if (emitRateGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = emitRateGradient.factor2;\r\n }\r\n serializationObject.emitRateGradients.push(serializedGradient);\r\n }\r\n }\r\n var startSizeGradients = particleSystem.getStartSizeGradients();\r\n if (startSizeGradients) {\r\n serializationObject.startSizeGradients = [];\r\n for (var _j = 0, startSizeGradients_1 = startSizeGradients; _j < startSizeGradients_1.length; _j++) {\r\n var startSizeGradient = startSizeGradients_1[_j];\r\n var serializedGradient = {\r\n gradient: startSizeGradient.gradient,\r\n factor1: startSizeGradient.factor1\r\n };\r\n if (startSizeGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = startSizeGradient.factor2;\r\n }\r\n serializationObject.startSizeGradients.push(serializedGradient);\r\n }\r\n }\r\n var lifeTimeGradients = particleSystem.getLifeTimeGradients();\r\n if (lifeTimeGradients) {\r\n serializationObject.lifeTimeGradients = [];\r\n for (var _k = 0, lifeTimeGradients_1 = lifeTimeGradients; _k < lifeTimeGradients_1.length; _k++) {\r\n var lifeTimeGradient = lifeTimeGradients_1[_k];\r\n var serializedGradient = {\r\n gradient: lifeTimeGradient.gradient,\r\n factor1: lifeTimeGradient.factor1\r\n };\r\n if (lifeTimeGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = lifeTimeGradient.factor2;\r\n }\r\n serializationObject.lifeTimeGradients.push(serializedGradient);\r\n }\r\n }\r\n var limitVelocityGradients = particleSystem.getLimitVelocityGradients();\r\n if (limitVelocityGradients) {\r\n serializationObject.limitVelocityGradients = [];\r\n for (var _l = 0, limitVelocityGradients_1 = limitVelocityGradients; _l < limitVelocityGradients_1.length; _l++) {\r\n var limitVelocityGradient = limitVelocityGradients_1[_l];\r\n var serializedGradient = {\r\n gradient: limitVelocityGradient.gradient,\r\n factor1: limitVelocityGradient.factor1\r\n };\r\n if (limitVelocityGradient.factor2 !== undefined) {\r\n serializedGradient.factor2 = limitVelocityGradient.factor2;\r\n }\r\n serializationObject.limitVelocityGradients.push(serializedGradient);\r\n }\r\n serializationObject.limitVelocityDamping = particleSystem.limitVelocityDamping;\r\n }\r\n if (particleSystem.noiseTexture) {\r\n serializationObject.noiseTexture = particleSystem.noiseTexture.serialize();\r\n }\r\n };\r\n /** @hidden */\r\n ParticleSystem._Parse = function (parsedParticleSystem, particleSystem, scene, rootUrl) {\r\n // Texture\r\n if (parsedParticleSystem.textureName) {\r\n particleSystem.particleTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"](rootUrl + parsedParticleSystem.textureName, scene, false, parsedParticleSystem.invertY !== undefined ? parsedParticleSystem.invertY : true);\r\n particleSystem.particleTexture.name = parsedParticleSystem.textureName;\r\n }\r\n // Emitter\r\n if (!parsedParticleSystem.emitterId && parsedParticleSystem.emitterId !== 0 && parsedParticleSystem.emitter === undefined) {\r\n particleSystem.emitter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n }\r\n else if (parsedParticleSystem.emitterId) {\r\n particleSystem.emitter = scene.getLastMeshByID(parsedParticleSystem.emitterId);\r\n }\r\n else {\r\n particleSystem.emitter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedParticleSystem.emitter);\r\n }\r\n // Misc.\r\n if (parsedParticleSystem.renderingGroupId !== undefined) {\r\n particleSystem.renderingGroupId = parsedParticleSystem.renderingGroupId;\r\n }\r\n if (parsedParticleSystem.isBillboardBased !== undefined) {\r\n particleSystem.isBillboardBased = parsedParticleSystem.isBillboardBased;\r\n }\r\n if (parsedParticleSystem.billboardMode !== undefined) {\r\n particleSystem.billboardMode = parsedParticleSystem.billboardMode;\r\n }\r\n // Animations\r\n if (parsedParticleSystem.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedParticleSystem.animations[animationIndex];\r\n var internalClass = _Misc_typeStore__WEBPACK_IMPORTED_MODULE_21__[\"_TypeStore\"].GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n particleSystem.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n particleSystem.beginAnimationOnStart = parsedParticleSystem.beginAnimationOnStart;\r\n particleSystem.beginAnimationFrom = parsedParticleSystem.beginAnimationFrom;\r\n particleSystem.beginAnimationTo = parsedParticleSystem.beginAnimationTo;\r\n particleSystem.beginAnimationLoop = parsedParticleSystem.beginAnimationLoop;\r\n }\r\n if (parsedParticleSystem.autoAnimate) {\r\n scene.beginAnimation(particleSystem, parsedParticleSystem.autoAnimateFrom, parsedParticleSystem.autoAnimateTo, parsedParticleSystem.autoAnimateLoop, parsedParticleSystem.autoAnimateSpeed || 1.0);\r\n }\r\n // Particle system\r\n particleSystem.startDelay = parsedParticleSystem.startDelay | 0;\r\n particleSystem.minAngularSpeed = parsedParticleSystem.minAngularSpeed;\r\n particleSystem.maxAngularSpeed = parsedParticleSystem.maxAngularSpeed;\r\n particleSystem.minSize = parsedParticleSystem.minSize;\r\n particleSystem.maxSize = parsedParticleSystem.maxSize;\r\n if (parsedParticleSystem.minScaleX) {\r\n particleSystem.minScaleX = parsedParticleSystem.minScaleX;\r\n particleSystem.maxScaleX = parsedParticleSystem.maxScaleX;\r\n particleSystem.minScaleY = parsedParticleSystem.minScaleY;\r\n particleSystem.maxScaleY = parsedParticleSystem.maxScaleY;\r\n }\r\n if (parsedParticleSystem.preWarmCycles !== undefined) {\r\n particleSystem.preWarmCycles = parsedParticleSystem.preWarmCycles;\r\n particleSystem.preWarmStepOffset = parsedParticleSystem.preWarmStepOffset;\r\n }\r\n if (parsedParticleSystem.minInitialRotation !== undefined) {\r\n particleSystem.minInitialRotation = parsedParticleSystem.minInitialRotation;\r\n particleSystem.maxInitialRotation = parsedParticleSystem.maxInitialRotation;\r\n }\r\n particleSystem.minLifeTime = parsedParticleSystem.minLifeTime;\r\n particleSystem.maxLifeTime = parsedParticleSystem.maxLifeTime;\r\n particleSystem.minEmitPower = parsedParticleSystem.minEmitPower;\r\n particleSystem.maxEmitPower = parsedParticleSystem.maxEmitPower;\r\n particleSystem.emitRate = parsedParticleSystem.emitRate;\r\n particleSystem.gravity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedParticleSystem.gravity);\r\n if (parsedParticleSystem.noiseStrength) {\r\n particleSystem.noiseStrength = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].FromArray(parsedParticleSystem.noiseStrength);\r\n }\r\n particleSystem.color1 = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.color1);\r\n particleSystem.color2 = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.color2);\r\n particleSystem.colorDead = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.colorDead);\r\n particleSystem.updateSpeed = parsedParticleSystem.updateSpeed;\r\n particleSystem.targetStopDuration = parsedParticleSystem.targetStopDuration;\r\n particleSystem.blendMode = parsedParticleSystem.blendMode;\r\n if (parsedParticleSystem.colorGradients) {\r\n for (var _i = 0, _a = parsedParticleSystem.colorGradients; _i < _a.length; _i++) {\r\n var colorGradient = _a[_i];\r\n particleSystem.addColorGradient(colorGradient.gradient, _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(colorGradient.color1), colorGradient.color2 ? _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(colorGradient.color2) : undefined);\r\n }\r\n }\r\n if (parsedParticleSystem.rampGradients) {\r\n for (var _b = 0, _c = parsedParticleSystem.rampGradients; _b < _c.length; _b++) {\r\n var rampGradient = _c[_b];\r\n particleSystem.addRampGradient(rampGradient.gradient, _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color3\"].FromArray(rampGradient.color));\r\n }\r\n particleSystem.useRampGradients = parsedParticleSystem.useRampGradients;\r\n }\r\n if (parsedParticleSystem.colorRemapGradients) {\r\n for (var _d = 0, _e = parsedParticleSystem.colorRemapGradients; _d < _e.length; _d++) {\r\n var colorRemapGradient = _e[_d];\r\n particleSystem.addColorRemapGradient(colorRemapGradient.gradient, colorRemapGradient.factor1 !== undefined ? colorRemapGradient.factor1 : colorRemapGradient.factor, colorRemapGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.alphaRemapGradients) {\r\n for (var _f = 0, _g = parsedParticleSystem.alphaRemapGradients; _f < _g.length; _f++) {\r\n var alphaRemapGradient = _g[_f];\r\n particleSystem.addAlphaRemapGradient(alphaRemapGradient.gradient, alphaRemapGradient.factor1 !== undefined ? alphaRemapGradient.factor1 : alphaRemapGradient.factor, alphaRemapGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.sizeGradients) {\r\n for (var _h = 0, _j = parsedParticleSystem.sizeGradients; _h < _j.length; _h++) {\r\n var sizeGradient = _j[_h];\r\n particleSystem.addSizeGradient(sizeGradient.gradient, sizeGradient.factor1 !== undefined ? sizeGradient.factor1 : sizeGradient.factor, sizeGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.angularSpeedGradients) {\r\n for (var _k = 0, _l = parsedParticleSystem.angularSpeedGradients; _k < _l.length; _k++) {\r\n var angularSpeedGradient = _l[_k];\r\n particleSystem.addAngularSpeedGradient(angularSpeedGradient.gradient, angularSpeedGradient.factor1 !== undefined ? angularSpeedGradient.factor1 : angularSpeedGradient.factor, angularSpeedGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.velocityGradients) {\r\n for (var _m = 0, _o = parsedParticleSystem.velocityGradients; _m < _o.length; _m++) {\r\n var velocityGradient = _o[_m];\r\n particleSystem.addVelocityGradient(velocityGradient.gradient, velocityGradient.factor1 !== undefined ? velocityGradient.factor1 : velocityGradient.factor, velocityGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.dragGradients) {\r\n for (var _p = 0, _q = parsedParticleSystem.dragGradients; _p < _q.length; _p++) {\r\n var dragGradient = _q[_p];\r\n particleSystem.addDragGradient(dragGradient.gradient, dragGradient.factor1 !== undefined ? dragGradient.factor1 : dragGradient.factor, dragGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.emitRateGradients) {\r\n for (var _r = 0, _s = parsedParticleSystem.emitRateGradients; _r < _s.length; _r++) {\r\n var emitRateGradient = _s[_r];\r\n particleSystem.addEmitRateGradient(emitRateGradient.gradient, emitRateGradient.factor1 !== undefined ? emitRateGradient.factor1 : emitRateGradient.factor, emitRateGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.startSizeGradients) {\r\n for (var _t = 0, _u = parsedParticleSystem.startSizeGradients; _t < _u.length; _t++) {\r\n var startSizeGradient = _u[_t];\r\n particleSystem.addStartSizeGradient(startSizeGradient.gradient, startSizeGradient.factor1 !== undefined ? startSizeGradient.factor1 : startSizeGradient.factor, startSizeGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.lifeTimeGradients) {\r\n for (var _v = 0, _w = parsedParticleSystem.lifeTimeGradients; _v < _w.length; _v++) {\r\n var lifeTimeGradient = _w[_v];\r\n particleSystem.addLifeTimeGradient(lifeTimeGradient.gradient, lifeTimeGradient.factor1 !== undefined ? lifeTimeGradient.factor1 : lifeTimeGradient.factor, lifeTimeGradient.factor2);\r\n }\r\n }\r\n if (parsedParticleSystem.limitVelocityGradients) {\r\n for (var _x = 0, _y = parsedParticleSystem.limitVelocityGradients; _x < _y.length; _x++) {\r\n var limitVelocityGradient = _y[_x];\r\n particleSystem.addLimitVelocityGradient(limitVelocityGradient.gradient, limitVelocityGradient.factor1 !== undefined ? limitVelocityGradient.factor1 : limitVelocityGradient.factor, limitVelocityGradient.factor2);\r\n }\r\n particleSystem.limitVelocityDamping = parsedParticleSystem.limitVelocityDamping;\r\n }\r\n if (parsedParticleSystem.noiseTexture) {\r\n particleSystem.noiseTexture = _Materials_Textures_Procedurals_proceduralTexture__WEBPACK_IMPORTED_MODULE_12__[\"ProceduralTexture\"].Parse(parsedParticleSystem.noiseTexture, scene, rootUrl);\r\n }\r\n // Emitter\r\n var emitterType;\r\n if (parsedParticleSystem.particleEmitterType) {\r\n switch (parsedParticleSystem.particleEmitterType.type) {\r\n case \"SphereParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"SphereParticleEmitter\"]();\r\n break;\r\n case \"SphereDirectedParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"SphereDirectedParticleEmitter\"]();\r\n break;\r\n case \"ConeEmitter\":\r\n case \"ConeParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"ConeParticleEmitter\"]();\r\n break;\r\n case \"CylinderParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"CylinderParticleEmitter\"]();\r\n break;\r\n case \"HemisphericParticleEmitter\":\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"HemisphericParticleEmitter\"]();\r\n break;\r\n case \"BoxEmitter\":\r\n case \"BoxParticleEmitter\":\r\n default:\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"BoxParticleEmitter\"]();\r\n break;\r\n }\r\n emitterType.parse(parsedParticleSystem.particleEmitterType);\r\n }\r\n else {\r\n emitterType = new _Particles_EmitterTypes_index__WEBPACK_IMPORTED_MODULE_14__[\"BoxParticleEmitter\"]();\r\n emitterType.parse(parsedParticleSystem);\r\n }\r\n particleSystem.particleEmitterType = emitterType;\r\n // Animation sheet\r\n particleSystem.startSpriteCellID = parsedParticleSystem.startSpriteCellID;\r\n particleSystem.endSpriteCellID = parsedParticleSystem.endSpriteCellID;\r\n particleSystem.spriteCellWidth = parsedParticleSystem.spriteCellWidth;\r\n particleSystem.spriteCellHeight = parsedParticleSystem.spriteCellHeight;\r\n particleSystem.spriteCellChangeSpeed = parsedParticleSystem.spriteCellChangeSpeed;\r\n particleSystem.spriteRandomStartCell = parsedParticleSystem.spriteRandomStartCell;\r\n };\r\n /**\r\n * Parses a JSON object to create a particle system.\r\n * @param parsedParticleSystem The JSON object to parse\r\n * @param scene The scene to create the particle system in\r\n * @param rootUrl The root url to use to load external dependencies like texture\r\n * @param doNotStart Ignore the preventAutoStart attribute and does not start\r\n * @returns the Parsed particle system\r\n */\r\n ParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl, doNotStart) {\r\n if (doNotStart === void 0) { doNotStart = false; }\r\n var name = parsedParticleSystem.name;\r\n var custom = null;\r\n var program = null;\r\n if (parsedParticleSystem.customShader) {\r\n program = parsedParticleSystem.customShader;\r\n var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join(\"\\n\") : \"\";\r\n custom = scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);\r\n }\r\n var particleSystem = new ParticleSystem(name, parsedParticleSystem.capacity, scene, custom, parsedParticleSystem.isAnimationSheetEnabled);\r\n particleSystem.customShader = program;\r\n if (parsedParticleSystem.id) {\r\n particleSystem.id = parsedParticleSystem.id;\r\n }\r\n // SubEmitters\r\n if (parsedParticleSystem.subEmitters) {\r\n particleSystem.subEmitters = [];\r\n for (var _i = 0, _a = parsedParticleSystem.subEmitters; _i < _a.length; _i++) {\r\n var cell = _a[_i];\r\n var cellArray = [];\r\n for (var _b = 0, cell_1 = cell; _b < cell_1.length; _b++) {\r\n var sub = cell_1[_b];\r\n cellArray.push(_subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"].Parse(sub, scene, rootUrl));\r\n }\r\n particleSystem.subEmitters.push(cellArray);\r\n }\r\n }\r\n ParticleSystem._Parse(parsedParticleSystem, particleSystem, scene, rootUrl);\r\n particleSystem.textureMask = _Maths_math_color__WEBPACK_IMPORTED_MODULE_24__[\"Color4\"].FromArray(parsedParticleSystem.textureMask);\r\n // Auto start\r\n if (parsedParticleSystem.preventAutoStart) {\r\n particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;\r\n }\r\n if (!doNotStart && !particleSystem.preventAutoStart) {\r\n particleSystem.start();\r\n }\r\n return particleSystem;\r\n };\r\n /**\r\n * Billboard mode will only apply to Y axis\r\n */\r\n ParticleSystem.BILLBOARDMODE_Y = _Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].PARTICLES_BILLBOARDMODE_Y;\r\n /**\r\n * Billboard mode will apply to all axes\r\n */\r\n ParticleSystem.BILLBOARDMODE_ALL = _Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].PARTICLES_BILLBOARDMODE_ALL;\r\n /**\r\n * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction\r\n */\r\n ParticleSystem.BILLBOARDMODE_STRETCHED = _Engines_constants__WEBPACK_IMPORTED_MODULE_18__[\"Constants\"].PARTICLES_BILLBOARDMODE_STRETCHED;\r\n return ParticleSystem;\r\n}(_baseParticleSystem__WEBPACK_IMPORTED_MODULE_15__[\"BaseParticleSystem\"]));\r\n\r\n_subEmitter__WEBPACK_IMPORTED_MODULE_17__[\"SubEmitter\"]._ParseParticleSystem = ParticleSystem.Parse;\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleSystemComponent.ts\":\n/*!**********************************************!*\\\n !*** ./Particles/particleSystemComponent.ts ***!\n \\**********************************************/\n/*! exports provided: _IDoNeedToBeInTheBuild */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _IDoNeedToBeInTheBuild; });\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _particleSystem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Shaders_particles_vertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Shaders/particles.vertex */ \"./Shaders/particles.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n// Adds the parsers to the scene parsers.\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {\r\n var individualParser = _abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].GetIndividualParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM);\r\n if (!individualParser) {\r\n return;\r\n }\r\n // Particles Systems\r\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\r\n for (var index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\r\n var parsedParticleSystem = parsedData.particleSystems[index];\r\n container.particleSystems.push(individualParser(parsedParticleSystem, scene, rootUrl));\r\n }\r\n }\r\n});\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_2__[\"AbstractScene\"].AddIndividualParser(_sceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"SceneComponentConstants\"].NAME_PARTICLESYSTEM, function (parsedParticleSystem, scene, rootUrl) {\r\n if (parsedParticleSystem.activeParticleCount) {\r\n var ps = _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_1__[\"GPUParticleSystem\"].Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n }\r\n else {\r\n var ps = _particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"].Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n }\r\n});\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].prototype.createEffectForParticles = function (fragmentName, uniformsNames, samplers, defines, fallbacks, onCompiled, onError) {\r\n if (uniformsNames === void 0) { uniformsNames = []; }\r\n if (samplers === void 0) { samplers = []; }\r\n if (defines === void 0) { defines = \"\"; }\r\n var attributesNamesOrOptions = _particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"]._GetAttributeNamesOrOptions();\r\n var effectCreationOption = _particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"]._GetEffectCreationOptions();\r\n if (defines.indexOf(\" BILLBOARD\") === -1) {\r\n defines += \"\\n#define BILLBOARD\\n\";\r\n }\r\n if (samplers.indexOf(\"diffuseSampler\") === -1) {\r\n samplers.push(\"diffuseSampler\");\r\n }\r\n return this.createEffect({\r\n vertex: \"particles\",\r\n fragmentElement: fragmentName\r\n }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), samplers, defines, fallbacks, onCompiled, onError);\r\n};\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].prototype.getEmittedParticleSystems = function () {\r\n var results = new Array();\r\n for (var index = 0; index < this.getScene().particleSystems.length; index++) {\r\n var particleSystem = this.getScene().particleSystems[index];\r\n if (particleSystem.emitter === this) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n return results;\r\n};\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_0__[\"Mesh\"].prototype.getHierarchyEmittedParticleSystems = function () {\r\n var results = new Array();\r\n var descendants = this.getDescendants();\r\n descendants.push(this);\r\n for (var index = 0; index < this.getScene().particleSystems.length; index++) {\r\n var particleSystem = this.getScene().particleSystems[index];\r\n var emitter = particleSystem.emitter;\r\n if (emitter.position && descendants.indexOf(emitter) !== -1) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n return results;\r\n};\r\n/**\r\n * @hidden\r\n */\r\nvar _IDoNeedToBeInTheBuild = 42;\r\n\n\n/***/ }),\n\n/***/ \"./Particles/particleSystemSet.ts\":\n/*!****************************************!*\\\n !*** ./Particles/particleSystemSet.ts ***!\n \\****************************************/\n/*! exports provided: ParticleSystemSet */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return ParticleSystemSet; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gpuParticleSystem */ \"./Particles/gpuParticleSystem.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Particles_particleSystem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Particles/particleSystem */ \"./Particles/particleSystem.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** Internal class used to store shapes for emitters */\r\nvar ParticleSystemSetEmitterCreationOptions = /** @class */ (function () {\r\n function ParticleSystemSetEmitterCreationOptions() {\r\n }\r\n return ParticleSystemSetEmitterCreationOptions;\r\n}());\r\n/**\r\n * Represents a set of particle systems working together to create a specific effect\r\n */\r\nvar ParticleSystemSet = /** @class */ (function () {\r\n function ParticleSystemSet() {\r\n /**\r\n * Gets the particle system list\r\n */\r\n this.systems = new Array();\r\n }\r\n Object.defineProperty(ParticleSystemSet.prototype, \"emitterNode\", {\r\n /**\r\n * Gets the emitter node used with this set\r\n */\r\n get: function () {\r\n return this._emitterNode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a new emitter mesh as a sphere\r\n * @param options defines the options used to create the sphere\r\n * @param renderingGroupId defines the renderingGroupId to use for the sphere\r\n * @param scene defines the hosting scene\r\n */\r\n ParticleSystemSet.prototype.setEmitterAsSphere = function (options, renderingGroupId, scene) {\r\n if (this._emitterNode) {\r\n this._emitterNode.dispose();\r\n }\r\n this._emitterCreationOptions = {\r\n kind: \"Sphere\",\r\n options: options,\r\n renderingGroupId: renderingGroupId\r\n };\r\n var emitterMesh = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_1__[\"SphereBuilder\"].CreateSphere(\"emitterSphere\", { diameter: options.diameter, segments: options.segments }, scene);\r\n emitterMesh.renderingGroupId = renderingGroupId;\r\n var material = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_5__[\"StandardMaterial\"](\"emitterSphereMaterial\", scene);\r\n material.emissiveColor = options.color;\r\n emitterMesh.material = material;\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n system.emitter = emitterMesh;\r\n }\r\n this._emitterNode = emitterMesh;\r\n };\r\n /**\r\n * Starts all particle systems of the set\r\n * @param emitter defines an optional mesh to use as emitter for the particle systems\r\n */\r\n ParticleSystemSet.prototype.start = function (emitter) {\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n if (emitter) {\r\n system.emitter = emitter;\r\n }\r\n system.start();\r\n }\r\n };\r\n /**\r\n * Release all associated resources\r\n */\r\n ParticleSystemSet.prototype.dispose = function () {\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n system.dispose();\r\n }\r\n this.systems = [];\r\n if (this._emitterNode) {\r\n this._emitterNode.dispose();\r\n this._emitterNode = null;\r\n }\r\n };\r\n /**\r\n * Serialize the set into a JSON compatible object\r\n * @returns a JSON compatible representation of the set\r\n */\r\n ParticleSystemSet.prototype.serialize = function () {\r\n var result = {};\r\n result.systems = [];\r\n for (var _i = 0, _a = this.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n result.systems.push(system.serialize());\r\n }\r\n if (this._emitterNode) {\r\n result.emitter = this._emitterCreationOptions;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Parse a new ParticleSystemSet from a serialized source\r\n * @param data defines a JSON compatible representation of the set\r\n * @param scene defines the hosting scene\r\n * @param gpu defines if we want GPU particles or CPU particles\r\n * @returns a new ParticleSystemSet\r\n */\r\n ParticleSystemSet.Parse = function (data, scene, gpu) {\r\n if (gpu === void 0) { gpu = false; }\r\n var result = new ParticleSystemSet();\r\n var rootUrl = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].PARTICLES_BaseAssetsUrl + \"/textures/\";\r\n scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene;\r\n for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {\r\n var system = _a[_i];\r\n result.systems.push(gpu ? _gpuParticleSystem__WEBPACK_IMPORTED_MODULE_2__[\"GPUParticleSystem\"].Parse(system, scene, rootUrl, true) : _Particles_particleSystem__WEBPACK_IMPORTED_MODULE_4__[\"ParticleSystem\"].Parse(system, scene, rootUrl, true));\r\n }\r\n if (data.emitter) {\r\n var options = data.emitter.options;\r\n switch (data.emitter.kind) {\r\n case \"Sphere\":\r\n result.setEmitterAsSphere({\r\n diameter: options.diameter,\r\n segments: options.segments,\r\n color: _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color3\"].FromArray(options.color)\r\n }, data.emitter.renderingGroupId, scene);\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n return ParticleSystemSet;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/solidParticle.ts\":\n/*!************************************!*\\\n !*** ./Particles/solidParticle.ts ***!\n \\************************************/\n/*! exports provided: SolidParticle, ModelShape, DepthSortedParticle */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return SolidParticle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return ModelShape; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return DepthSortedParticle; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Culling_boundingSphere__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Culling/boundingSphere */ \"./Culling/boundingSphere.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Represents one particle of a solid particle system.\r\n */\r\nvar SolidParticle = /** @class */ (function () {\r\n /**\r\n * Creates a Solid Particle object.\r\n * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()\r\n * @param particleIndex (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.\r\n * @param positionIndex (integer) is the starting index of the particle vertices in the SPS \"positions\" array.\r\n * @param indiceIndex (integer) is the starting index of the particle indices in the SPS \"indices\" array.\r\n * @param model (ModelShape) is a reference to the model shape on what the particle is designed.\r\n * @param shapeId (integer) is the model shape identifier in the SPS.\r\n * @param idxInShape (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))\r\n * @param sps defines the sps it is associated to\r\n * @param modelBoundingInfo is the reference to the model BoundingInfo used for intersection computations.\r\n */\r\n function SolidParticle(particleIndex, positionIndex, indiceIndex, model, shapeId, idxInShape, sps, modelBoundingInfo) {\r\n if (modelBoundingInfo === void 0) { modelBoundingInfo = null; }\r\n /**\r\n * particle global index\r\n */\r\n this.idx = 0;\r\n /**\r\n * The color of the particle\r\n */\r\n this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * The world space position of the particle.\r\n */\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The world space rotation of the particle. (Not use if rotationQuaternion is set)\r\n */\r\n this.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The scaling of the particle.\r\n */\r\n this.scaling = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].One();\r\n /**\r\n * The uvs of the particle.\r\n */\r\n this.uvs = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector4\"](0.0, 0.0, 1.0, 1.0);\r\n /**\r\n * The current speed of the particle.\r\n */\r\n this.velocity = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * The pivot point in the particle local space.\r\n */\r\n this.pivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n /**\r\n * Must the particle be translated from its pivot point in its local space ?\r\n * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.\r\n * Default : false\r\n */\r\n this.translateFromPivot = false;\r\n /**\r\n * Is the particle active or not ?\r\n */\r\n this.alive = true;\r\n /**\r\n * Is the particle visible or not ?\r\n */\r\n this.isVisible = true;\r\n /**\r\n * Index of this particle in the global \"positions\" array (Internal use)\r\n * @hidden\r\n */\r\n this._pos = 0;\r\n /**\r\n * @hidden Index of this particle in the global \"indices\" array (Internal use)\r\n */\r\n this._ind = 0;\r\n /**\r\n * ModelShape id of this particle\r\n */\r\n this.shapeId = 0;\r\n /**\r\n * Index of the particle in its shape id\r\n */\r\n this.idxInShape = 0;\r\n /**\r\n * @hidden Still set as invisible in order to skip useless computations (Internal use)\r\n */\r\n this._stillInvisible = false;\r\n /**\r\n * @hidden Last computed particle rotation matrix\r\n */\r\n this._rotationMatrix = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];\r\n /**\r\n * Parent particle Id, if any.\r\n * Default null.\r\n */\r\n this.parentId = null;\r\n /**\r\n * The culling strategy to use to check whether the solid particle must be culled or not when using isInFrustum().\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * The default value for solid particles is AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * Please read each static variable documentation in the class AbstractMesh to get details about the culling process.\r\n * */\r\n this.cullingStrategy = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_4__[\"AbstractMesh\"].CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n /**\r\n * @hidden Internal global position in the SPS.\r\n */\r\n this._globalPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this.idx = particleIndex;\r\n this._pos = positionIndex;\r\n this._ind = indiceIndex;\r\n this._model = model;\r\n this.shapeId = shapeId;\r\n this.idxInShape = idxInShape;\r\n this._sps = sps;\r\n if (modelBoundingInfo) {\r\n this._modelBoundingInfo = modelBoundingInfo;\r\n this._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_2__[\"BoundingInfo\"](modelBoundingInfo.minimum, modelBoundingInfo.maximum);\r\n }\r\n }\r\n Object.defineProperty(SolidParticle.prototype, \"scale\", {\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n get: function () {\r\n return this.scaling;\r\n },\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n set: function (scale) {\r\n this.scaling = scale;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticle.prototype, \"quaternion\", {\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n get: function () {\r\n return this.rotationQuaternion;\r\n },\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n set: function (q) {\r\n this.rotationQuaternion = q;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a boolean. True if the particle intersects another particle or another mesh, else false.\r\n * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)\r\n * @param target is the object (solid particle or mesh) what the intersection is computed against.\r\n * @returns true if it intersects\r\n */\r\n SolidParticle.prototype.intersectsMesh = function (target) {\r\n if (!this._boundingInfo || !target._boundingInfo) {\r\n return false;\r\n }\r\n if (this._sps._bSphereOnly) {\r\n return _Culling_boundingSphere__WEBPACK_IMPORTED_MODULE_3__[\"BoundingSphere\"].Intersects(this._boundingInfo.boundingSphere, target._boundingInfo.boundingSphere);\r\n }\r\n return this._boundingInfo.intersects(target._boundingInfo, false);\r\n };\r\n /**\r\n * Returns `true` if the solid particle is within the frustum defined by the passed array of planes.\r\n * A particle is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the particle is in the frustum planes\r\n */\r\n SolidParticle.prototype.isInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n };\r\n /**\r\n * get the rotation matrix of the particle\r\n * @hidden\r\n */\r\n SolidParticle.prototype.getRotationMatrix = function (m) {\r\n var quaternion;\r\n if (this.rotationQuaternion) {\r\n quaternion = this.rotationQuaternion;\r\n }\r\n else {\r\n quaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Quaternion[0];\r\n var rotation = this.rotation;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n }\r\n quaternion.toRotationMatrix(m);\r\n };\r\n return SolidParticle;\r\n}());\r\n\r\n/**\r\n * Represents the shape of the model used by one particle of a solid particle system.\r\n * SPS internal tool, don't use it manually.\r\n */\r\nvar ModelShape = /** @class */ (function () {\r\n /**\r\n * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.\r\n * SPS internal tool, don't use it manually.\r\n * @hidden\r\n */\r\n function ModelShape(id, shape, indicesLength, shapeUV, posFunction, vtxFunction) {\r\n /**\r\n * length of the shape in the model indices array (internal use)\r\n * @hidden\r\n */\r\n this._indicesLength = 0;\r\n this.shapeID = id;\r\n this._shape = shape;\r\n this._indicesLength = indicesLength;\r\n this._shapeUV = shapeUV;\r\n this._positionFunction = posFunction;\r\n this._vertexFunction = vtxFunction;\r\n }\r\n return ModelShape;\r\n}());\r\n\r\n/**\r\n * Represents a Depth Sorted Particle in the solid particle system.\r\n */\r\nvar DepthSortedParticle = /** @class */ (function () {\r\n function DepthSortedParticle() {\r\n /**\r\n * Index of the particle in the \"indices\" array\r\n */\r\n this.ind = 0;\r\n /**\r\n * Length of the particle shape in the \"indices\" array\r\n */\r\n this.indicesLength = 0;\r\n /**\r\n * Squared distance from the particle to the camera\r\n */\r\n this.sqDistance = 0.0;\r\n }\r\n return DepthSortedParticle;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/solidParticleSystem.ts\":\n/*!******************************************!*\\\n !*** ./Particles/solidParticleSystem.ts ***!\n \\******************************************/\n/*! exports provided: SolidParticleSystem */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return SolidParticleSystem; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Meshes_Builders_discBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/discBuilder */ \"./Meshes/Builders/discBuilder.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _solidParticle__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./solidParticle */ \"./Particles/solidParticle.ts\");\n/* harmony import */ var _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Culling/boundingInfo */ \"./Culling/boundingInfo.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar depthSortFunction = function (p1, p2) { return p2.sqDistance - p1.sqDistance; };\r\n/**\r\n * The SPS is a single updatable mesh. The solid particles are simply separate parts or faces fo this big mesh.\r\n *As it is just a mesh, the SPS has all the same properties than any other BJS mesh : not more, not less. It can be scaled, rotated, translated, enlighted, textured, moved, etc.\r\n\r\n * The SPS is also a particle system. It provides some methods to manage the particles.\r\n * However it is behavior agnostic. This means it has no emitter, no particle physics, no particle recycler. You have to implement your own behavior.\r\n *\r\n * Full documentation here : http://doc.babylonjs.com/how_to/Solid_Particle_System\r\n */\r\nvar SolidParticleSystem = /** @class */ (function () {\r\n /**\r\n * Creates a SPS (Solid Particle System) object.\r\n * @param name (String) is the SPS name, this will be the underlying mesh name.\r\n * @param scene (Scene) is the scene in which the SPS is added.\r\n * @param options defines the options of the sps e.g.\r\n * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.\r\n * * isPickable (optional boolean, default false) : if the solid particles must be pickable.\r\n * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.\r\n * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.\r\n * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).\r\n * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.\r\n * @example bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.\r\n */\r\n function SolidParticleSystem(name, scene, options) {\r\n /**\r\n * The SPS array of Solid Particle objects. Just access each particle as with any classic array.\r\n * Example : var p = SPS.particles[i];\r\n */\r\n this.particles = new Array();\r\n /**\r\n * The SPS total number of particles. Read only. Use SPS.counter instead if you need to set your own value.\r\n */\r\n this.nbParticles = 0;\r\n /**\r\n * If the particles must ever face the camera (default false). Useful for planar particles.\r\n */\r\n this.billboard = false;\r\n /**\r\n * Recompute normals when adding a shape\r\n */\r\n this.recomputeNormals = true;\r\n /**\r\n * This a counter ofr your own usage. It's not set by any SPS functions.\r\n */\r\n this.counter = 0;\r\n /**\r\n * This empty object is intended to store some SPS specific or temporary values in order to lower the Garbage Collector activity.\r\n * Please read : http://doc.babylonjs.com/how_to/Solid_Particle_System#garbage-collector-concerns\r\n */\r\n this.vars = {};\r\n /**\r\n * If the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster). (Internal use only)\r\n * @hidden\r\n */\r\n this._bSphereOnly = false;\r\n /**\r\n * A number to multiply the boundind sphere radius by in order to reduce it for instance. (Internal use only)\r\n * @hidden\r\n */\r\n this._bSphereRadiusFactor = 1.0;\r\n this._positions = new Array();\r\n this._indices = new Array();\r\n this._normals = new Array();\r\n this._colors = new Array();\r\n this._uvs = new Array();\r\n this._index = 0; // indices index\r\n this._updatable = true;\r\n this._pickable = false;\r\n this._isVisibilityBoxLocked = false;\r\n this._alwaysVisible = false;\r\n this._depthSort = false;\r\n this._shapeCounter = 0;\r\n this._copy = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"SolidParticle\"](0, 0, 0, null, 0, 0, this);\r\n this._color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](0, 0, 0, 0);\r\n this._computeParticleColor = true;\r\n this._computeParticleTexture = true;\r\n this._computeParticleRotation = true;\r\n this._computeParticleVertex = false;\r\n this._computeBoundingBox = false;\r\n this._depthSortParticles = true;\r\n this._mustUnrotateFixedNormals = false;\r\n this._particlesIntersect = false;\r\n this._needs32Bits = false;\r\n this.name = name;\r\n this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_6__[\"EngineStore\"].LastCreatedScene;\r\n this._camera = scene.activeCamera;\r\n this._pickable = options ? options.isPickable : false;\r\n this._depthSort = options ? options.enableDepthSort : false;\r\n this._particlesIntersect = options ? options.particleIntersection : false;\r\n this._bSphereOnly = options ? options.boundingSphereOnly : false;\r\n this._bSphereRadiusFactor = (options && options.bSphereRadiusFactor) ? options.bSphereRadiusFactor : 1.0;\r\n if (options && options.updatable !== undefined) {\r\n this._updatable = options.updatable;\r\n }\r\n else {\r\n this._updatable = true;\r\n }\r\n if (this._pickable) {\r\n this.pickedParticles = [];\r\n }\r\n if (this._depthSort) {\r\n this.depthSortedParticles = [];\r\n }\r\n }\r\n /**\r\n * Builds the SPS underlying mesh. Returns a standard Mesh.\r\n * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.\r\n * @returns the created mesh\r\n */\r\n SolidParticleSystem.prototype.buildMesh = function () {\r\n if (this.nbParticles === 0) {\r\n var triangle = _Meshes_Builders_discBuilder__WEBPACK_IMPORTED_MODULE_5__[\"DiscBuilder\"].CreateDisc(\"\", { radius: 1, tessellation: 3 }, this._scene);\r\n this.addShape(triangle, 1);\r\n triangle.dispose();\r\n }\r\n this._indices32 = (this._needs32Bits) ? new Uint32Array(this._indices) : new Uint16Array(this._indices);\r\n this._positions32 = new Float32Array(this._positions);\r\n this._uvs32 = new Float32Array(this._uvs);\r\n this._colors32 = new Float32Array(this._colors);\r\n if (this.recomputeNormals) {\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(this._positions32, this._indices32, this._normals);\r\n }\r\n this._normals32 = new Float32Array(this._normals);\r\n this._fixedNormal32 = new Float32Array(this._normals);\r\n if (this._mustUnrotateFixedNormals) { // the particles could be created already rotated in the mesh with a positionFunction\r\n this._unrotateFixedNormals();\r\n }\r\n var vertexData = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"]();\r\n vertexData.indices = (this._depthSort) ? this._indices : this._indices32;\r\n vertexData.set(this._positions32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n vertexData.set(this._normals32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n if (this._uvs32.length > 0) {\r\n vertexData.set(this._uvs32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n }\r\n if (this._colors32.length > 0) {\r\n vertexData.set(this._colors32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n }\r\n var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"](this.name, this._scene);\r\n vertexData.applyToMesh(mesh, this._updatable);\r\n this.mesh = mesh;\r\n this.mesh.isPickable = this._pickable;\r\n // free memory\r\n if (!this._depthSort) {\r\n this._indices = null;\r\n }\r\n this._positions = null;\r\n this._normals = null;\r\n this._uvs = null;\r\n this._colors = null;\r\n if (!this._updatable) {\r\n this.particles.length = 0;\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.\r\n * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.\r\n * Thus the particles generated from `digest()` have their property `position` set yet.\r\n * @param mesh ( Mesh ) is the mesh to be digested\r\n * @param options {facetNb} (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any\r\n * {delta} (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets\r\n * {number} (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets\r\n * @returns the current SPS\r\n */\r\n SolidParticleSystem.prototype.digest = function (mesh, options) {\r\n var size = (options && options.facetNb) || 1;\r\n var number = (options && options.number) || 0;\r\n var delta = (options && options.delta) || 0;\r\n var meshPos = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n var meshInd = mesh.getIndices();\r\n var meshUV = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n var meshCol = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n var meshNor = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var f = 0; // facet counter\r\n var totalFacets = meshInd.length / 3; // a facet is a triangle, so 3 indices\r\n // compute size from number\r\n if (number) {\r\n number = (number > totalFacets) ? totalFacets : number;\r\n size = Math.round(totalFacets / number);\r\n delta = 0;\r\n }\r\n else {\r\n size = (size > totalFacets) ? totalFacets : size;\r\n }\r\n var facetPos = []; // submesh positions\r\n var facetInd = []; // submesh indices\r\n var facetUV = []; // submesh UV\r\n var facetCol = []; // submesh colors\r\n var barycenter = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n var sizeO = size;\r\n while (f < totalFacets) {\r\n size = sizeO + Math.floor((1 + delta) * Math.random());\r\n if (f > totalFacets - size) {\r\n size = totalFacets - f;\r\n }\r\n // reset temp arrays\r\n facetPos.length = 0;\r\n facetInd.length = 0;\r\n facetUV.length = 0;\r\n facetCol.length = 0;\r\n // iterate over \"size\" facets\r\n var fi = 0;\r\n for (var j = f * 3; j < (f + size) * 3; j++) {\r\n facetInd.push(fi);\r\n var i = meshInd[j];\r\n facetPos.push(meshPos[i * 3], meshPos[i * 3 + 1], meshPos[i * 3 + 2]);\r\n if (meshUV) {\r\n facetUV.push(meshUV[i * 2], meshUV[i * 2 + 1]);\r\n }\r\n if (meshCol) {\r\n facetCol.push(meshCol[i * 4], meshCol[i * 4 + 1], meshCol[i * 4 + 2], meshCol[i * 4 + 3]);\r\n }\r\n fi++;\r\n }\r\n // create a model shape for each single particle\r\n var idx = this.nbParticles;\r\n var shape = this._posToShape(facetPos);\r\n var shapeUV = this._uvsToShapeUV(facetUV);\r\n // compute the barycenter of the shape\r\n barycenter.copyFromFloats(0, 0, 0);\r\n var v;\r\n for (v = 0; v < shape.length; v++) {\r\n barycenter.addInPlace(shape[v]);\r\n }\r\n barycenter.scaleInPlace(1 / shape.length);\r\n // shift the shape from its barycenter to the origin\r\n // and compute the BBox required for intersection.\r\n var minimum = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](Infinity, Infinity, Infinity);\r\n var maximum = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-Infinity, -Infinity, -Infinity);\r\n for (v = 0; v < shape.length; v++) {\r\n shape[v].subtractInPlace(barycenter);\r\n minimum.minimizeInPlaceFromFloats(shape[v].x, shape[v].y, shape[v].z);\r\n maximum.maximizeInPlaceFromFloats(shape[v].x, shape[v].y, shape[v].z);\r\n }\r\n var bInfo;\r\n if (this._particlesIntersect) {\r\n bInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__[\"BoundingInfo\"](minimum, maximum);\r\n }\r\n var modelShape = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"ModelShape\"](this._shapeCounter, shape, size * 3, shapeUV, null, null);\r\n // add the particle in the SPS\r\n var currentPos = this._positions.length;\r\n var currentInd = this._indices.length;\r\n this._meshBuilder(this._index, shape, this._positions, facetInd, this._indices, facetUV, this._uvs, facetCol, this._colors, meshNor, this._normals, idx, 0, null);\r\n this._addParticle(idx, currentPos, currentInd, modelShape, this._shapeCounter, 0, bInfo);\r\n // initialize the particle position\r\n this.particles[this.nbParticles].position.addInPlace(barycenter);\r\n this._index += shape.length;\r\n idx++;\r\n this.nbParticles++;\r\n this._shapeCounter++;\r\n f += size;\r\n }\r\n return this;\r\n };\r\n // unrotate the fixed normals in case the mesh was built with pre-rotated particles, ex : use of positionFunction in addShape()\r\n SolidParticleSystem.prototype._unrotateFixedNormals = function () {\r\n var index = 0;\r\n var idx = 0;\r\n var tmpNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0];\r\n var quaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Quaternion[0];\r\n var invertedRotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n for (var p = 0; p < this.particles.length; p++) {\r\n var particle = this.particles[p];\r\n var shape = particle._model._shape;\r\n // computing the inverse of the rotation matrix from the quaternion\r\n // is equivalent to computing the matrix of the inverse quaternion, i.e of the conjugate quaternion\r\n if (particle.rotationQuaternion) {\r\n particle.rotationQuaternion.conjugateToRef(quaternion);\r\n }\r\n else {\r\n var rotation = particle.rotation;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"].RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n quaternion.conjugateInPlace();\r\n }\r\n quaternion.toRotationMatrix(invertedRotMatrix);\r\n for (var pt = 0; pt < shape.length; pt++) {\r\n idx = index + pt * 3;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalFromFloatsToRef(this._normals32[idx], this._normals32[idx + 1], this._normals32[idx + 2], invertedRotMatrix, tmpNormal);\r\n tmpNormal.toArray(this._fixedNormal32, idx);\r\n }\r\n index = idx + 3;\r\n }\r\n };\r\n //reset copy\r\n SolidParticleSystem.prototype._resetCopy = function () {\r\n var copy = this._copy;\r\n copy.position.setAll(0);\r\n copy.rotation.setAll(0);\r\n copy.rotationQuaternion = null;\r\n copy.scaling.setAll(1);\r\n copy.uvs.copyFromFloats(0.0, 0.0, 1.0, 1.0);\r\n copy.color = null;\r\n copy.translateFromPivot = false;\r\n };\r\n // _meshBuilder : inserts the shape model in the global SPS mesh\r\n SolidParticleSystem.prototype._meshBuilder = function (p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors, meshNor, normals, idx, idxInShape, options) {\r\n var i;\r\n var u = 0;\r\n var c = 0;\r\n var n = 0;\r\n this._resetCopy();\r\n var copy = this._copy;\r\n copy.idx = idx;\r\n copy.idxInShape = idxInShape;\r\n if (options && options.positionFunction) { // call to custom positionFunction\r\n options.positionFunction(copy, idx, idxInShape);\r\n this._mustUnrotateFixedNormals = true;\r\n }\r\n var rotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var tmpVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0];\r\n var tmpRotated = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[1];\r\n var pivotBackTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[2];\r\n var scaledPivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[3];\r\n copy.getRotationMatrix(rotMatrix);\r\n copy.pivot.multiplyToRef(copy.scaling, scaledPivot);\r\n if (copy.translateFromPivot) {\r\n pivotBackTranslation.setAll(0.0);\r\n }\r\n else {\r\n pivotBackTranslation.copyFrom(scaledPivot);\r\n }\r\n for (i = 0; i < shape.length; i++) {\r\n tmpVertex.copyFrom(shape[i]);\r\n if (options && options.vertexFunction) {\r\n options.vertexFunction(copy, tmpVertex, i);\r\n }\r\n tmpVertex.multiplyInPlace(copy.scaling).subtractInPlace(scaledPivot);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(tmpVertex, rotMatrix, tmpRotated);\r\n tmpRotated.addInPlace(pivotBackTranslation).addInPlace(copy.position);\r\n positions.push(tmpRotated.x, tmpRotated.y, tmpRotated.z);\r\n if (meshUV) {\r\n var copyUvs = copy.uvs;\r\n uvs.push((copyUvs.z - copyUvs.x) * meshUV[u] + copyUvs.x, (copyUvs.w - copyUvs.y) * meshUV[u + 1] + copyUvs.y);\r\n u += 2;\r\n }\r\n if (copy.color) {\r\n this._color = copy.color;\r\n }\r\n else {\r\n var color = this._color;\r\n if (meshCol && meshCol[c] !== undefined) {\r\n color.r = meshCol[c];\r\n color.g = meshCol[c + 1];\r\n color.b = meshCol[c + 2];\r\n color.a = meshCol[c + 3];\r\n }\r\n else {\r\n color.r = 1.0;\r\n color.g = 1.0;\r\n color.b = 1.0;\r\n color.a = 1.0;\r\n }\r\n }\r\n colors.push(this._color.r, this._color.g, this._color.b, this._color.a);\r\n c += 4;\r\n if (!this.recomputeNormals && meshNor) {\r\n tmpVertex.x = meshNor[n];\r\n tmpVertex.y = meshNor[n + 1];\r\n tmpVertex.z = meshNor[n + 2];\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalToRef(tmpVertex, rotMatrix, tmpVertex);\r\n normals.push(tmpVertex.x, tmpVertex.y, tmpVertex.z);\r\n n += 3;\r\n }\r\n }\r\n for (i = 0; i < meshInd.length; i++) {\r\n var current_ind = p + meshInd[i];\r\n indices.push(current_ind);\r\n if (current_ind > 65535) {\r\n this._needs32Bits = true;\r\n }\r\n }\r\n if (this._pickable) {\r\n var nbfaces = meshInd.length / 3;\r\n for (i = 0; i < nbfaces; i++) {\r\n this.pickedParticles.push({ idx: idx, faceId: i });\r\n }\r\n }\r\n if (this._depthSort) {\r\n this.depthSortedParticles.push(new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"DepthSortedParticle\"]());\r\n }\r\n return copy;\r\n };\r\n // returns a shape array from positions array\r\n SolidParticleSystem.prototype._posToShape = function (positions) {\r\n var shape = [];\r\n for (var i = 0; i < positions.length; i += 3) {\r\n shape.push(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].FromArray(positions, i));\r\n }\r\n return shape;\r\n };\r\n // returns a shapeUV array from a Vector4 uvs\r\n SolidParticleSystem.prototype._uvsToShapeUV = function (uvs) {\r\n var shapeUV = [];\r\n if (uvs) {\r\n for (var i = 0; i < uvs.length; i++) {\r\n shapeUV.push(uvs[i]);\r\n }\r\n }\r\n return shapeUV;\r\n };\r\n // adds a new particle object in the particles array\r\n SolidParticleSystem.prototype._addParticle = function (idx, idxpos, idxind, model, shapeId, idxInShape, bInfo) {\r\n if (bInfo === void 0) { bInfo = null; }\r\n var sp = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"SolidParticle\"](idx, idxpos, idxind, model, shapeId, idxInShape, this, bInfo);\r\n this.particles.push(sp);\r\n return sp;\r\n };\r\n /**\r\n * Adds some particles to the SPS from the model shape. Returns the shape id.\r\n * Please read the doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#create-an-immutable-sps\r\n * @param mesh is any Mesh object that will be used as a model for the solid particles.\r\n * @param nb (positive integer) the number of particles to be created from this model\r\n * @param options {positionFunction} is an optional javascript function to called for each particle on SPS creation.\r\n * {vertexFunction} is an optional javascript function to called for each vertex of each particle on SPS creation\r\n * @returns the number of shapes in the system\r\n */\r\n SolidParticleSystem.prototype.addShape = function (mesh, nb, options) {\r\n var meshPos = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind);\r\n var meshInd = mesh.getIndices();\r\n var meshUV = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind);\r\n var meshCol = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind);\r\n var meshNor = mesh.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind);\r\n var bbInfo;\r\n if (this._particlesIntersect) {\r\n bbInfo = mesh.getBoundingInfo();\r\n }\r\n var shape = this._posToShape(meshPos);\r\n var shapeUV = this._uvsToShapeUV(meshUV);\r\n var posfunc = options ? options.positionFunction : null;\r\n var vtxfunc = options ? options.vertexFunction : null;\r\n var modelShape = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__[\"ModelShape\"](this._shapeCounter, shape, meshInd.length, shapeUV, posfunc, vtxfunc);\r\n // particles\r\n var sp;\r\n var currentCopy;\r\n var idx = this.nbParticles;\r\n for (var i = 0; i < nb; i++) {\r\n var currentPos = this._positions.length;\r\n var currentInd = this._indices.length;\r\n currentCopy = this._meshBuilder(this._index, shape, this._positions, meshInd, this._indices, meshUV, this._uvs, meshCol, this._colors, meshNor, this._normals, idx, i, options);\r\n if (this._updatable) {\r\n sp = this._addParticle(idx, currentPos, currentInd, modelShape, this._shapeCounter, i, bbInfo);\r\n sp.position.copyFrom(currentCopy.position);\r\n sp.rotation.copyFrom(currentCopy.rotation);\r\n if (currentCopy.rotationQuaternion && sp.rotationQuaternion) {\r\n sp.rotationQuaternion.copyFrom(currentCopy.rotationQuaternion);\r\n }\r\n if (currentCopy.color && sp.color) {\r\n sp.color.copyFrom(currentCopy.color);\r\n }\r\n sp.scaling.copyFrom(currentCopy.scaling);\r\n sp.uvs.copyFrom(currentCopy.uvs);\r\n }\r\n this._index += shape.length;\r\n idx++;\r\n }\r\n this.nbParticles += nb;\r\n this._shapeCounter++;\r\n return this._shapeCounter - 1;\r\n };\r\n // rebuilds a particle back to its just built status : if needed, recomputes the custom positions and vertices\r\n SolidParticleSystem.prototype._rebuildParticle = function (particle) {\r\n this._resetCopy();\r\n var copy = this._copy;\r\n if (particle._model._positionFunction) { // recall to stored custom positionFunction\r\n particle._model._positionFunction(copy, particle.idx, particle.idxInShape);\r\n }\r\n var rotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var tmpVertex = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[0];\r\n var tmpRotated = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[1];\r\n var pivotBackTranslation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[2];\r\n var scaledPivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3[3];\r\n copy.getRotationMatrix(rotMatrix);\r\n particle.pivot.multiplyToRef(particle.scaling, scaledPivot);\r\n if (copy.translateFromPivot) {\r\n pivotBackTranslation.copyFromFloats(0.0, 0.0, 0.0);\r\n }\r\n else {\r\n pivotBackTranslation.copyFrom(scaledPivot);\r\n }\r\n var shape = particle._model._shape;\r\n for (var pt = 0; pt < shape.length; pt++) {\r\n tmpVertex.copyFrom(shape[pt]);\r\n if (particle._model._vertexFunction) {\r\n particle._model._vertexFunction(copy, tmpVertex, pt); // recall to stored vertexFunction\r\n }\r\n tmpVertex.multiplyInPlace(copy.scaling).subtractInPlace(scaledPivot);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(tmpVertex, rotMatrix, tmpRotated);\r\n tmpRotated.addInPlace(pivotBackTranslation).addInPlace(copy.position).toArray(this._positions32, particle._pos + pt * 3);\r\n }\r\n particle.position.setAll(0.0);\r\n particle.rotation.setAll(0.0);\r\n particle.rotationQuaternion = null;\r\n particle.scaling.setAll(1.0);\r\n particle.uvs.setAll(0.0);\r\n particle.pivot.setAll(0.0);\r\n particle.translateFromPivot = false;\r\n particle.parentId = null;\r\n };\r\n /**\r\n * Rebuilds the whole mesh and updates the VBO : custom positions and vertices are recomputed if needed.\r\n * @returns the SPS.\r\n */\r\n SolidParticleSystem.prototype.rebuildMesh = function () {\r\n for (var p = 0; p < this.particles.length; p++) {\r\n this._rebuildParticle(this.particles[p]);\r\n }\r\n this.mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, this._positions32, false, false);\r\n return this;\r\n };\r\n /**\r\n * Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.\r\n * This method calls `updateParticle()` for each particle of the SPS.\r\n * For an animated SPS, it is usually called within the render loop.\r\n * @param start The particle index in the particle array where to start to compute the particle property values _(default 0)_\r\n * @param end The particle index in the particle array where to stop to compute the particle property values _(default nbParticle - 1)_\r\n * @param update If the mesh must be finally updated on this call after all the particle computations _(default true)_\r\n * @returns the SPS.\r\n */\r\n SolidParticleSystem.prototype.setParticles = function (start, end, update) {\r\n if (start === void 0) { start = 0; }\r\n if (end === void 0) { end = this.nbParticles - 1; }\r\n if (update === void 0) { update = true; }\r\n if (!this._updatable) {\r\n return this;\r\n }\r\n // custom beforeUpdate\r\n this.beforeUpdateParticles(start, end, update);\r\n var rotMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[0];\r\n var invertedMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Matrix[1];\r\n var mesh = this.mesh;\r\n var colors32 = this._colors32;\r\n var positions32 = this._positions32;\r\n var normals32 = this._normals32;\r\n var uvs32 = this._uvs32;\r\n var indices32 = this._indices32;\r\n var indices = this._indices;\r\n var fixedNormal32 = this._fixedNormal32;\r\n var tempVectors = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"TmpVectors\"].Vector3;\r\n var camAxisX = tempVectors[5].copyFromFloats(1.0, 0.0, 0.0);\r\n var camAxisY = tempVectors[6].copyFromFloats(0.0, 1.0, 0.0);\r\n var camAxisZ = tempVectors[7].copyFromFloats(0.0, 0.0, 1.0);\r\n var minimum = tempVectors[8].setAll(Number.MAX_VALUE);\r\n var maximum = tempVectors[9].setAll(-Number.MAX_VALUE);\r\n var camInvertedPosition = tempVectors[10].setAll(0);\r\n // cases when the World Matrix is to be computed first\r\n if (this.billboard || this._depthSort) {\r\n this.mesh.computeWorldMatrix(true);\r\n this.mesh._worldMatrix.invertToRef(invertedMatrix);\r\n }\r\n // if the particles will always face the camera\r\n if (this.billboard) {\r\n // compute the camera position and un-rotate it by the current mesh rotation\r\n var tmpVertex = tempVectors[0];\r\n this._camera.getDirectionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_9__[\"Axis\"].Z, tmpVertex);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalToRef(tmpVertex, invertedMatrix, camAxisZ);\r\n camAxisZ.normalize();\r\n // same for camera up vector extracted from the cam view matrix\r\n var view = this._camera.getViewMatrix(true);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormalFromFloatsToRef(view.m[1], view.m[5], view.m[9], invertedMatrix, camAxisY);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].CrossToRef(camAxisY, camAxisZ, camAxisX);\r\n camAxisY.normalize();\r\n camAxisX.normalize();\r\n }\r\n // if depthSort, compute the camera global position in the mesh local system\r\n if (this._depthSort) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(this._camera.globalPosition, invertedMatrix, camInvertedPosition); // then un-rotate the camera\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].IdentityToRef(rotMatrix);\r\n var idx = 0; // current position index in the global array positions32\r\n var index = 0; // position start index in the global array positions32 of the current particle\r\n var colidx = 0; // current color index in the global array colors32\r\n var colorIndex = 0; // color start index in the global array colors32 of the current particle\r\n var uvidx = 0; // current uv index in the global array uvs32\r\n var uvIndex = 0; // uv start index in the global array uvs32 of the current particle\r\n var pt = 0; // current index in the particle model shape\r\n if (this.mesh.isFacetDataEnabled) {\r\n this._computeBoundingBox = true;\r\n }\r\n end = (end >= this.nbParticles) ? this.nbParticles - 1 : end;\r\n if (this._computeBoundingBox) {\r\n if (start != 0 || end != this.nbParticles - 1) { // only some particles are updated, then use the current existing BBox basis. Note : it can only increase.\r\n var boundingInfo = this.mesh._boundingInfo;\r\n if (boundingInfo) {\r\n minimum.copyFrom(boundingInfo.minimum);\r\n maximum.copyFrom(boundingInfo.maximum);\r\n }\r\n }\r\n }\r\n // particle loop\r\n index = this.particles[start]._pos;\r\n var vpos = (index / 3) | 0;\r\n colorIndex = vpos * 4;\r\n uvIndex = vpos * 2;\r\n for (var p = start; p <= end; p++) {\r\n var particle = this.particles[p];\r\n // call to custom user function to update the particle properties\r\n this.updateParticle(particle);\r\n var shape = particle._model._shape;\r\n var shapeUV = particle._model._shapeUV;\r\n var particleRotationMatrix = particle._rotationMatrix;\r\n var particlePosition = particle.position;\r\n var particleRotation = particle.rotation;\r\n var particleScaling = particle.scaling;\r\n var particleGlobalPosition = particle._globalPosition;\r\n // camera-particle distance for depth sorting\r\n if (this._depthSort && this._depthSortParticles) {\r\n var dsp = this.depthSortedParticles[p];\r\n dsp.ind = particle._ind;\r\n dsp.indicesLength = particle._model._indicesLength;\r\n dsp.sqDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].DistanceSquared(particle.position, camInvertedPosition);\r\n }\r\n // skip the computations for inactive or already invisible particles\r\n if (!particle.alive || (particle._stillInvisible && !particle.isVisible)) {\r\n // increment indexes for the next particle\r\n pt = shape.length;\r\n index += pt * 3;\r\n colorIndex += pt * 4;\r\n uvIndex += pt * 2;\r\n continue;\r\n }\r\n if (particle.isVisible) {\r\n particle._stillInvisible = false; // un-mark permanent invisibility\r\n var scaledPivot = tempVectors[12];\r\n particle.pivot.multiplyToRef(particleScaling, scaledPivot);\r\n // particle rotation matrix\r\n if (this.billboard) {\r\n particleRotation.x = 0.0;\r\n particleRotation.y = 0.0;\r\n }\r\n if (this._computeParticleRotation || this.billboard) {\r\n particle.getRotationMatrix(rotMatrix);\r\n }\r\n var particleHasParent = (particle.parentId !== null);\r\n if (particleHasParent) {\r\n var parent_1 = this.particles[particle.parentId];\r\n var parentRotationMatrix = parent_1._rotationMatrix;\r\n var parentGlobalPosition = parent_1._globalPosition;\r\n var rotatedY = particlePosition.x * parentRotationMatrix[1] + particlePosition.y * parentRotationMatrix[4] + particlePosition.z * parentRotationMatrix[7];\r\n var rotatedX = particlePosition.x * parentRotationMatrix[0] + particlePosition.y * parentRotationMatrix[3] + particlePosition.z * parentRotationMatrix[6];\r\n var rotatedZ = particlePosition.x * parentRotationMatrix[2] + particlePosition.y * parentRotationMatrix[5] + particlePosition.z * parentRotationMatrix[8];\r\n particleGlobalPosition.x = parentGlobalPosition.x + rotatedX;\r\n particleGlobalPosition.y = parentGlobalPosition.y + rotatedY;\r\n particleGlobalPosition.z = parentGlobalPosition.z + rotatedZ;\r\n if (this._computeParticleRotation || this.billboard) {\r\n var rotMatrixValues = rotMatrix.m;\r\n particleRotationMatrix[0] = rotMatrixValues[0] * parentRotationMatrix[0] + rotMatrixValues[1] * parentRotationMatrix[3] + rotMatrixValues[2] * parentRotationMatrix[6];\r\n particleRotationMatrix[1] = rotMatrixValues[0] * parentRotationMatrix[1] + rotMatrixValues[1] * parentRotationMatrix[4] + rotMatrixValues[2] * parentRotationMatrix[7];\r\n particleRotationMatrix[2] = rotMatrixValues[0] * parentRotationMatrix[2] + rotMatrixValues[1] * parentRotationMatrix[5] + rotMatrixValues[2] * parentRotationMatrix[8];\r\n particleRotationMatrix[3] = rotMatrixValues[4] * parentRotationMatrix[0] + rotMatrixValues[5] * parentRotationMatrix[3] + rotMatrixValues[6] * parentRotationMatrix[6];\r\n particleRotationMatrix[4] = rotMatrixValues[4] * parentRotationMatrix[1] + rotMatrixValues[5] * parentRotationMatrix[4] + rotMatrixValues[6] * parentRotationMatrix[7];\r\n particleRotationMatrix[5] = rotMatrixValues[4] * parentRotationMatrix[2] + rotMatrixValues[5] * parentRotationMatrix[5] + rotMatrixValues[6] * parentRotationMatrix[8];\r\n particleRotationMatrix[6] = rotMatrixValues[8] * parentRotationMatrix[0] + rotMatrixValues[9] * parentRotationMatrix[3] + rotMatrixValues[10] * parentRotationMatrix[6];\r\n particleRotationMatrix[7] = rotMatrixValues[8] * parentRotationMatrix[1] + rotMatrixValues[9] * parentRotationMatrix[4] + rotMatrixValues[10] * parentRotationMatrix[7];\r\n particleRotationMatrix[8] = rotMatrixValues[8] * parentRotationMatrix[2] + rotMatrixValues[9] * parentRotationMatrix[5] + rotMatrixValues[10] * parentRotationMatrix[8];\r\n }\r\n }\r\n else {\r\n particleGlobalPosition.x = particlePosition.x;\r\n particleGlobalPosition.y = particlePosition.y;\r\n particleGlobalPosition.z = particlePosition.z;\r\n if (this._computeParticleRotation || this.billboard) {\r\n var rotMatrixValues = rotMatrix.m;\r\n particleRotationMatrix[0] = rotMatrixValues[0];\r\n particleRotationMatrix[1] = rotMatrixValues[1];\r\n particleRotationMatrix[2] = rotMatrixValues[2];\r\n particleRotationMatrix[3] = rotMatrixValues[4];\r\n particleRotationMatrix[4] = rotMatrixValues[5];\r\n particleRotationMatrix[5] = rotMatrixValues[6];\r\n particleRotationMatrix[6] = rotMatrixValues[8];\r\n particleRotationMatrix[7] = rotMatrixValues[9];\r\n particleRotationMatrix[8] = rotMatrixValues[10];\r\n }\r\n }\r\n var pivotBackTranslation = tempVectors[11];\r\n if (particle.translateFromPivot) {\r\n pivotBackTranslation.setAll(0.0);\r\n }\r\n else {\r\n pivotBackTranslation.copyFrom(scaledPivot);\r\n }\r\n // particle vertex loop\r\n for (pt = 0; pt < shape.length; pt++) {\r\n idx = index + pt * 3;\r\n colidx = colorIndex + pt * 4;\r\n uvidx = uvIndex + pt * 2;\r\n var tmpVertex = tempVectors[0];\r\n tmpVertex.copyFrom(shape[pt]);\r\n if (this._computeParticleVertex) {\r\n this.updateParticleVertex(particle, tmpVertex, pt);\r\n }\r\n // positions\r\n var vertexX = tmpVertex.x * particleScaling.x - scaledPivot.x;\r\n var vertexY = tmpVertex.y * particleScaling.y - scaledPivot.y;\r\n var vertexZ = tmpVertex.z * particleScaling.z - scaledPivot.z;\r\n var rotatedX = vertexX * particleRotationMatrix[0] + vertexY * particleRotationMatrix[3] + vertexZ * particleRotationMatrix[6];\r\n var rotatedY = vertexX * particleRotationMatrix[1] + vertexY * particleRotationMatrix[4] + vertexZ * particleRotationMatrix[7];\r\n var rotatedZ = vertexX * particleRotationMatrix[2] + vertexY * particleRotationMatrix[5] + vertexZ * particleRotationMatrix[8];\r\n rotatedX += pivotBackTranslation.x;\r\n rotatedY += pivotBackTranslation.y;\r\n rotatedZ += pivotBackTranslation.z;\r\n var px = positions32[idx] = particleGlobalPosition.x + camAxisX.x * rotatedX + camAxisY.x * rotatedY + camAxisZ.x * rotatedZ;\r\n var py = positions32[idx + 1] = particleGlobalPosition.y + camAxisX.y * rotatedX + camAxisY.y * rotatedY + camAxisZ.y * rotatedZ;\r\n var pz = positions32[idx + 2] = particleGlobalPosition.z + camAxisX.z * rotatedX + camAxisY.z * rotatedY + camAxisZ.z * rotatedZ;\r\n if (this._computeBoundingBox) {\r\n minimum.minimizeInPlaceFromFloats(px, py, pz);\r\n maximum.maximizeInPlaceFromFloats(px, py, pz);\r\n }\r\n // normals : if the particles can't be morphed then just rotate the normals, what is much more faster than ComputeNormals()\r\n if (!this._computeParticleVertex) {\r\n var normalx = fixedNormal32[idx];\r\n var normaly = fixedNormal32[idx + 1];\r\n var normalz = fixedNormal32[idx + 2];\r\n var rotatedx = normalx * particleRotationMatrix[0] + normaly * particleRotationMatrix[3] + normalz * particleRotationMatrix[6];\r\n var rotatedy = normalx * particleRotationMatrix[1] + normaly * particleRotationMatrix[4] + normalz * particleRotationMatrix[7];\r\n var rotatedz = normalx * particleRotationMatrix[2] + normaly * particleRotationMatrix[5] + normalz * particleRotationMatrix[8];\r\n normals32[idx] = camAxisX.x * rotatedx + camAxisY.x * rotatedy + camAxisZ.x * rotatedz;\r\n normals32[idx + 1] = camAxisX.y * rotatedx + camAxisY.y * rotatedy + camAxisZ.y * rotatedz;\r\n normals32[idx + 2] = camAxisX.z * rotatedx + camAxisY.z * rotatedy + camAxisZ.z * rotatedz;\r\n }\r\n if (this._computeParticleColor && particle.color) {\r\n var color = particle.color;\r\n var colors32_1 = this._colors32;\r\n colors32_1[colidx] = color.r;\r\n colors32_1[colidx + 1] = color.g;\r\n colors32_1[colidx + 2] = color.b;\r\n colors32_1[colidx + 3] = color.a;\r\n }\r\n if (this._computeParticleTexture) {\r\n var uvs = particle.uvs;\r\n uvs32[uvidx] = shapeUV[pt * 2] * (uvs.z - uvs.x) + uvs.x;\r\n uvs32[uvidx + 1] = shapeUV[pt * 2 + 1] * (uvs.w - uvs.y) + uvs.y;\r\n }\r\n }\r\n }\r\n // particle just set invisible : scaled to zero and positioned at the origin\r\n else {\r\n particle._stillInvisible = true; // mark the particle as invisible\r\n for (pt = 0; pt < shape.length; pt++) {\r\n idx = index + pt * 3;\r\n colidx = colorIndex + pt * 4;\r\n uvidx = uvIndex + pt * 2;\r\n positions32[idx] = positions32[idx + 1] = positions32[idx + 2] = 0;\r\n normals32[idx] = normals32[idx + 1] = normals32[idx + 2] = 0;\r\n if (this._computeParticleColor && particle.color) {\r\n var color = particle.color;\r\n colors32[colidx] = color.r;\r\n colors32[colidx + 1] = color.g;\r\n colors32[colidx + 2] = color.b;\r\n colors32[colidx + 3] = color.a;\r\n }\r\n if (this._computeParticleTexture) {\r\n var uvs = particle.uvs;\r\n uvs32[uvidx] = shapeUV[pt * 2] * (uvs.z - uvs.x) + uvs.x;\r\n uvs32[uvidx + 1] = shapeUV[pt * 2 + 1] * (uvs.w - uvs.y) + uvs.y;\r\n }\r\n }\r\n }\r\n // if the particle intersections must be computed : update the bbInfo\r\n if (this._particlesIntersect) {\r\n var bInfo = particle._boundingInfo;\r\n var bBox = bInfo.boundingBox;\r\n var bSphere = bInfo.boundingSphere;\r\n var modelBoundingInfo = particle._modelBoundingInfo;\r\n if (!this._bSphereOnly) {\r\n // place, scale and rotate the particle bbox within the SPS local system, then update it\r\n var modelBoundingInfoVectors = modelBoundingInfo.boundingBox.vectors;\r\n var tempMin = tempVectors[1];\r\n var tempMax = tempVectors[2];\r\n tempMin.setAll(Number.MAX_VALUE);\r\n tempMax.setAll(-Number.MAX_VALUE);\r\n for (var b = 0; b < 8; b++) {\r\n var scaledX = modelBoundingInfoVectors[b].x * particleScaling.x;\r\n var scaledY = modelBoundingInfoVectors[b].y * particleScaling.y;\r\n var scaledZ = modelBoundingInfoVectors[b].z * particleScaling.z;\r\n var rotatedX = scaledX * particleRotationMatrix[0] + scaledY * particleRotationMatrix[3] + scaledZ * particleRotationMatrix[6];\r\n var rotatedY = scaledX * particleRotationMatrix[1] + scaledY * particleRotationMatrix[4] + scaledZ * particleRotationMatrix[7];\r\n var rotatedZ = scaledX * particleRotationMatrix[2] + scaledY * particleRotationMatrix[5] + scaledZ * particleRotationMatrix[8];\r\n var x = particlePosition.x + camAxisX.x * rotatedX + camAxisY.x * rotatedY + camAxisZ.x * rotatedZ;\r\n var y = particlePosition.y + camAxisX.y * rotatedX + camAxisY.y * rotatedY + camAxisZ.y * rotatedZ;\r\n var z = particlePosition.z + camAxisX.z * rotatedX + camAxisY.z * rotatedY + camAxisZ.z * rotatedZ;\r\n tempMin.minimizeInPlaceFromFloats(x, y, z);\r\n tempMax.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n bBox.reConstruct(tempMin, tempMax, mesh._worldMatrix);\r\n }\r\n // place and scale the particle bouding sphere in the SPS local system, then update it\r\n var minBbox = modelBoundingInfo.minimum.multiplyToRef(particleScaling, tempVectors[1]);\r\n var maxBbox = modelBoundingInfo.maximum.multiplyToRef(particleScaling, tempVectors[2]);\r\n var bSphereCenter = maxBbox.addToRef(minBbox, tempVectors[3]).scaleInPlace(0.5).addInPlace(particleGlobalPosition);\r\n var halfDiag = maxBbox.subtractToRef(minBbox, tempVectors[4]).scaleInPlace(0.5 * this._bSphereRadiusFactor);\r\n var bSphereMinBbox = bSphereCenter.subtractToRef(halfDiag, tempVectors[1]);\r\n var bSphereMaxBbox = bSphereCenter.addToRef(halfDiag, tempVectors[2]);\r\n bSphere.reConstruct(bSphereMinBbox, bSphereMaxBbox, mesh._worldMatrix);\r\n }\r\n // increment indexes for the next particle\r\n index = idx + 3;\r\n colorIndex = colidx + 4;\r\n uvIndex = uvidx + 2;\r\n }\r\n // if the VBO must be updated\r\n if (update) {\r\n if (this._computeParticleColor) {\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind, colors32, false, false);\r\n }\r\n if (this._computeParticleTexture) {\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].UVKind, uvs32, false, false);\r\n }\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, positions32, false, false);\r\n if (!mesh.areNormalsFrozen || mesh.isFacetDataEnabled) {\r\n if (this._computeParticleVertex || mesh.isFacetDataEnabled) {\r\n // recompute the normals only if the particles can be morphed, update then also the normal reference array _fixedNormal32[]\r\n var params = mesh.isFacetDataEnabled ? mesh.getFacetDataParameters() : null;\r\n _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].ComputeNormals(positions32, indices32, normals32, params);\r\n for (var i = 0; i < normals32.length; i++) {\r\n fixedNormal32[i] = normals32[i];\r\n }\r\n }\r\n if (!mesh.areNormalsFrozen) {\r\n mesh.updateVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].NormalKind, normals32, false, false);\r\n }\r\n }\r\n if (this._depthSort && this._depthSortParticles) {\r\n var depthSortedParticles = this.depthSortedParticles;\r\n depthSortedParticles.sort(depthSortFunction);\r\n var dspl = depthSortedParticles.length;\r\n var sid = 0;\r\n for (var sorted = 0; sorted < dspl; sorted++) {\r\n var lind = depthSortedParticles[sorted].indicesLength;\r\n var sind = depthSortedParticles[sorted].ind;\r\n for (var i = 0; i < lind; i++) {\r\n indices32[sid] = indices[sind + i];\r\n sid++;\r\n }\r\n }\r\n mesh.updateIndices(indices32);\r\n }\r\n }\r\n if (this._computeBoundingBox) {\r\n if (mesh._boundingInfo) {\r\n mesh._boundingInfo.reConstruct(minimum, maximum, mesh._worldMatrix);\r\n }\r\n else {\r\n mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__[\"BoundingInfo\"](minimum, maximum, mesh._worldMatrix);\r\n }\r\n }\r\n this.afterUpdateParticles(start, end, update);\r\n return this;\r\n };\r\n /**\r\n * Disposes the SPS.\r\n */\r\n SolidParticleSystem.prototype.dispose = function () {\r\n this.mesh.dispose();\r\n this.vars = null;\r\n // drop references to internal big arrays for the GC\r\n this._positions = null;\r\n this._indices = null;\r\n this._normals = null;\r\n this._uvs = null;\r\n this._colors = null;\r\n this._indices32 = null;\r\n this._positions32 = null;\r\n this._normals32 = null;\r\n this._fixedNormal32 = null;\r\n this._uvs32 = null;\r\n this._colors32 = null;\r\n this.pickedParticles = null;\r\n };\r\n /**\r\n * Visibilty helper : Recomputes the visible size according to the mesh bounding box\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n * @returns the SPS.\r\n */\r\n SolidParticleSystem.prototype.refreshVisibleSize = function () {\r\n if (!this._isVisibilityBoxLocked) {\r\n this.mesh.refreshBoundingInfo();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.\r\n * @param size the size (float) of the visibility box\r\n * note : this doesn't lock the SPS mesh bounding box.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n SolidParticleSystem.prototype.setVisibilityBox = function (size) {\r\n var vis = size / 2;\r\n this.mesh._boundingInfo = new _Culling_boundingInfo__WEBPACK_IMPORTED_MODULE_8__[\"BoundingInfo\"](new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](-vis, -vis, -vis), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vis, vis, vis));\r\n };\r\n Object.defineProperty(SolidParticleSystem.prototype, \"isAlwaysVisible\", {\r\n /**\r\n * Gets whether the SPS as always visible or not\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n get: function () {\r\n return this._alwaysVisible;\r\n },\r\n /**\r\n * Sets the SPS as always visible or not\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n set: function (val) {\r\n this._alwaysVisible = val;\r\n this.mesh.alwaysSelectAsActiveMesh = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"isVisibilityBoxLocked\", {\r\n /**\r\n * Gets if the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n get: function () {\r\n return this._isVisibilityBoxLocked;\r\n },\r\n /**\r\n * Sets the SPS visibility box as locked or not. This enables/disables the underlying mesh bounding box updates.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#sps-visibility\r\n */\r\n set: function (val) {\r\n this._isVisibilityBoxLocked = val;\r\n var boundingInfo = this.mesh.getBoundingInfo();\r\n boundingInfo.isLocked = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleRotation\", {\r\n /**\r\n * Gets if `setParticles()` computes the particle rotations or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.\r\n */\r\n get: function () {\r\n return this._computeParticleRotation;\r\n },\r\n /**\r\n * Tells to `setParticles()` to compute the particle rotations or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.\r\n */\r\n set: function (val) {\r\n this._computeParticleRotation = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleColor\", {\r\n /**\r\n * Gets if `setParticles()` computes the particle colors or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.\r\n */\r\n get: function () {\r\n return this._computeParticleColor;\r\n },\r\n /**\r\n * Tells to `setParticles()` to compute the particle colors or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.\r\n */\r\n set: function (val) {\r\n this._computeParticleColor = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleTexture\", {\r\n /**\r\n * Gets if `setParticles()` computes the particle textures or not.\r\n * Default value : true. The SPS is faster when it's set to false.\r\n * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.\r\n */\r\n get: function () {\r\n return this._computeParticleTexture;\r\n },\r\n set: function (val) {\r\n this._computeParticleTexture = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeParticleVertex\", {\r\n /**\r\n * Gets if `setParticles()` calls the vertex function for each vertex of each particle, or not.\r\n * Default value : false. The SPS is faster when it's set to false.\r\n * Note : the particle custom vertex positions aren't stored values.\r\n */\r\n get: function () {\r\n return this._computeParticleVertex;\r\n },\r\n /**\r\n * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.\r\n * Default value : false. The SPS is faster when it's set to false.\r\n * Note : the particle custom vertex positions aren't stored values.\r\n */\r\n set: function (val) {\r\n this._computeParticleVertex = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"computeBoundingBox\", {\r\n /**\r\n * Gets if `setParticles()` computes or not the mesh bounding box when computing the particle positions.\r\n */\r\n get: function () {\r\n return this._computeBoundingBox;\r\n },\r\n /**\r\n * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.\r\n */\r\n set: function (val) {\r\n this._computeBoundingBox = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SolidParticleSystem.prototype, \"depthSortParticles\", {\r\n /**\r\n * Gets if `setParticles()` sorts or not the distance between each particle and the camera.\r\n * Skipped when `enableDepthSort` is set to `false` (default) at construction time.\r\n * Default : `true`\r\n */\r\n get: function () {\r\n return this._depthSortParticles;\r\n },\r\n /**\r\n * Tells to `setParticles()` to sort or not the distance between each particle and the camera.\r\n * Skipped when `enableDepthSort` is set to `false` (default) at construction time.\r\n * Default : `true`\r\n */\r\n set: function (val) {\r\n this._depthSortParticles = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // =======================================================================\r\n // Particle behavior logic\r\n // these following methods may be overwritten by the user to fit his needs\r\n /**\r\n * This function does nothing. It may be overwritten to set all the particle first values.\r\n * The SPS doesn't call this function, you may have to call it by your own.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management\r\n */\r\n SolidParticleSystem.prototype.initParticles = function () {\r\n };\r\n /**\r\n * This function does nothing. It may be overwritten to recycle a particle.\r\n * The SPS doesn't call this function, you may have to call it by your own.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management\r\n * @param particle The particle to recycle\r\n * @returns the recycled particle\r\n */\r\n SolidParticleSystem.prototype.recycleParticle = function (particle) {\r\n return particle;\r\n };\r\n /**\r\n * Updates a particle : this function should be overwritten by the user.\r\n * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management\r\n * @example : just set a particle position or velocity and recycle conditions\r\n * @param particle The particle to update\r\n * @returns the updated particle\r\n */\r\n SolidParticleSystem.prototype.updateParticle = function (particle) {\r\n return particle;\r\n };\r\n /**\r\n * Updates a vertex of a particle : it can be overwritten by the user.\r\n * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.\r\n * @param particle the current particle\r\n * @param vertex the current index of the current particle\r\n * @param pt the index of the current vertex in the particle shape\r\n * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#update-each-particle-shape\r\n * @example : just set a vertex particle position\r\n * @returns the updated vertex\r\n */\r\n SolidParticleSystem.prototype.updateParticleVertex = function (particle, vertex, pt) {\r\n return vertex;\r\n };\r\n /**\r\n * This will be called before any other treatment by `setParticles()` and will be passed three parameters.\r\n * This does nothing and may be overwritten by the user.\r\n * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param update the boolean update value actually passed to setParticles()\r\n */\r\n SolidParticleSystem.prototype.beforeUpdateParticles = function (start, stop, update) {\r\n };\r\n /**\r\n * This will be called by `setParticles()` after all the other treatments and just before the actual mesh update.\r\n * This will be passed three parameters.\r\n * This does nothing and may be overwritten by the user.\r\n * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()\r\n * @param update the boolean update value actually passed to setParticles()\r\n */\r\n SolidParticleSystem.prototype.afterUpdateParticles = function (start, stop, update) {\r\n };\r\n return SolidParticleSystem;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Particles/subEmitter.ts\":\n/*!*********************************!*\\\n !*** ./Particles/subEmitter.ts ***!\n \\*********************************/\n/*! exports provided: SubEmitterType, SubEmitter */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return SubEmitterType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return SubEmitter; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Type of sub emitter\r\n */\r\nvar SubEmitterType;\r\n(function (SubEmitterType) {\r\n /**\r\n * Attached to the particle over it's lifetime\r\n */\r\n SubEmitterType[SubEmitterType[\"ATTACHED\"] = 0] = \"ATTACHED\";\r\n /**\r\n * Created when the particle dies\r\n */\r\n SubEmitterType[SubEmitterType[\"END\"] = 1] = \"END\";\r\n})(SubEmitterType || (SubEmitterType = {}));\r\n/**\r\n * Sub emitter class used to emit particles from an existing particle\r\n */\r\nvar SubEmitter = /** @class */ (function () {\r\n /**\r\n * Creates a sub emitter\r\n * @param particleSystem the particle system to be used by the sub emitter\r\n */\r\n function SubEmitter(\r\n /**\r\n * the particle system to be used by the sub emitter\r\n */\r\n particleSystem) {\r\n this.particleSystem = particleSystem;\r\n /**\r\n * Type of the submitter (Default: END)\r\n */\r\n this.type = SubEmitterType.END;\r\n /**\r\n * If the particle should inherit the direction from the particle it's attached to. (+Y will face the direction the particle is moving) (Default: false)\r\n * Note: This only is supported when using an emitter of type Mesh\r\n */\r\n this.inheritDirection = false;\r\n /**\r\n * How much of the attached particles speed should be added to the sub emitted particle (default: 0)\r\n */\r\n this.inheritedVelocityAmount = 0;\r\n // Create mesh as emitter to support rotation\r\n if (!particleSystem.emitter || !particleSystem.emitter.dispose) {\r\n particleSystem.emitter = new _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"](\"SubemitterSystemEmitter\", particleSystem.getScene());\r\n }\r\n // Automatically dispose of subemitter when system is disposed\r\n particleSystem.onDisposeObservable.add(function () {\r\n if (particleSystem.emitter && particleSystem.emitter.dispose) {\r\n particleSystem.emitter.dispose();\r\n }\r\n });\r\n }\r\n /**\r\n * Clones the sub emitter\r\n * @returns the cloned sub emitter\r\n */\r\n SubEmitter.prototype.clone = function () {\r\n // Clone particle system\r\n var emitter = this.particleSystem.emitter;\r\n if (!emitter) {\r\n emitter = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n }\r\n else if (emitter instanceof _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]) {\r\n emitter = emitter.clone();\r\n }\r\n else if (emitter instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"]) {\r\n emitter = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"\", emitter.getScene());\r\n emitter.isVisible = false;\r\n }\r\n var clone = new SubEmitter(this.particleSystem.clone(\"\", emitter));\r\n // Clone properties\r\n clone.particleSystem.name += \"Clone\";\r\n clone.type = this.type;\r\n clone.inheritDirection = this.inheritDirection;\r\n clone.inheritedVelocityAmount = this.inheritedVelocityAmount;\r\n clone.particleSystem._disposeEmitterOnDispose = true;\r\n clone.particleSystem.disposeOnStop = true;\r\n return clone;\r\n };\r\n /**\r\n * Serialize current object to a JSON object\r\n * @returns the serialized object\r\n */\r\n SubEmitter.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.type = this.type;\r\n serializationObject.inheritDirection = this.inheritDirection;\r\n serializationObject.inheritedVelocityAmount = this.inheritedVelocityAmount;\r\n serializationObject.particleSystem = this.particleSystem.serialize();\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n SubEmitter._ParseParticleSystem = function (system, scene, rootUrl) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_3__[\"_DevTools\"].WarnImport(\"ParseParticle\");\r\n };\r\n /**\r\n * Creates a new SubEmitter from a serialized JSON version\r\n * @param serializationObject defines the JSON object to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the rootUrl for data loading\r\n * @returns a new SubEmitter\r\n */\r\n SubEmitter.Parse = function (serializationObject, scene, rootUrl) {\r\n var system = serializationObject.particleSystem;\r\n var subEmitter = new SubEmitter(SubEmitter._ParseParticleSystem(system, scene, rootUrl));\r\n subEmitter.type = serializationObject.type;\r\n subEmitter.inheritDirection = serializationObject.inheritDirection;\r\n subEmitter.inheritedVelocityAmount = serializationObject.inheritedVelocityAmount;\r\n subEmitter.particleSystem._isSubEmitter = true;\r\n return subEmitter;\r\n };\r\n /** Release associated resources */\r\n SubEmitter.prototype.dispose = function () {\r\n this.particleSystem.dispose();\r\n };\r\n return SubEmitter;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/ammoJSPlugin.ts\":\n/*!*****************************************!*\\\n !*** ./Physics/Plugins/ammoJSPlugin.ts ***!\n \\*****************************************/\n/*! exports provided: AmmoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return AmmoJSPlugin; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Physics/physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Meshes_Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Meshes/Builders/shapeBuilder */ \"./Meshes/Builders/shapeBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Meshes/Builders/linesBuilder */ \"./Meshes/Builders/linesBuilder.ts\");\n/* harmony import */ var _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../physicsRaycastResult */ \"./Physics/physicsRaycastResult.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * AmmoJS Physics plugin\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n * @see https://github.com/kripken/ammo.js/\r\n */\r\nvar AmmoJSPlugin = /** @class */ (function () {\r\n /**\r\n * Initializes the ammoJS plugin\r\n * @param _useDeltaForWorldStep if the time between frames should be used when calculating physics steps (Default: true)\r\n * @param ammoInjection can be used to inject your own ammo reference\r\n * @param overlappingPairCache can be used to specify your own overlapping pair cache\r\n */\r\n function AmmoJSPlugin(_useDeltaForWorldStep, ammoInjection, overlappingPairCache) {\r\n var _this = this;\r\n if (_useDeltaForWorldStep === void 0) { _useDeltaForWorldStep = true; }\r\n if (ammoInjection === void 0) { ammoInjection = Ammo; }\r\n if (overlappingPairCache === void 0) { overlappingPairCache = null; }\r\n this._useDeltaForWorldStep = _useDeltaForWorldStep;\r\n /**\r\n * Reference to the Ammo library\r\n */\r\n this.bjsAMMO = {};\r\n /**\r\n * Name of the plugin\r\n */\r\n this.name = \"AmmoJSPlugin\";\r\n this._timeStep = 1 / 60;\r\n this._fixedTimeStep = 1 / 60;\r\n this._maxSteps = 5;\r\n this._tmpQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Quaternion\"]();\r\n this._tmpContactCallbackResult = false;\r\n this._tmpVector = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n this._tmpMatrix = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"]();\r\n if (typeof ammoInjection === \"function\") {\r\n ammoInjection(this.bjsAMMO);\r\n }\r\n else {\r\n this.bjsAMMO = ammoInjection;\r\n }\r\n if (!this.isSupported()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"AmmoJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n // Initialize the physics world\r\n this._collisionConfiguration = new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration();\r\n this._dispatcher = new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration);\r\n this._overlappingPairCache = overlappingPairCache || new this.bjsAMMO.btDbvtBroadphase();\r\n this._solver = new this.bjsAMMO.btSequentialImpulseConstraintSolver();\r\n this._softBodySolver = new this.bjsAMMO.btDefaultSoftBodySolver();\r\n this.world = new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher, this._overlappingPairCache, this._solver, this._collisionConfiguration, this._softBodySolver);\r\n this._tmpAmmoConcreteContactResultCallback = new this.bjsAMMO.ConcreteContactResultCallback();\r\n this._tmpAmmoConcreteContactResultCallback.addSingleResult = function () { _this._tmpContactCallbackResult = true; };\r\n this._raycastResult = new _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_8__[\"PhysicsRaycastResult\"]();\r\n // Create temp ammo variables\r\n this._tmpAmmoTransform = new this.bjsAMMO.btTransform();\r\n this._tmpAmmoTransform.setIdentity();\r\n this._tmpAmmoQuaternion = new this.bjsAMMO.btQuaternion(0, 0, 0, 1);\r\n this._tmpAmmoVectorA = new this.bjsAMMO.btVector3(0, 0, 0);\r\n this._tmpAmmoVectorB = new this.bjsAMMO.btVector3(0, 0, 0);\r\n this._tmpAmmoVectorC = new this.bjsAMMO.btVector3(0, 0, 0);\r\n this._tmpAmmoVectorD = new this.bjsAMMO.btVector3(0, 0, 0);\r\n }\r\n /**\r\n * Sets the gravity of the physics world (m/(s^2))\r\n * @param gravity Gravity to set\r\n */\r\n AmmoJSPlugin.prototype.setGravity = function (gravity) {\r\n this._tmpAmmoVectorA.setValue(gravity.x, gravity.y, gravity.z);\r\n this.world.setGravity(this._tmpAmmoVectorA);\r\n this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA);\r\n };\r\n /**\r\n * Amount of time to step forward on each frame (only used if useDeltaForWorldStep is false in the constructor)\r\n * @param timeStep timestep to use in seconds\r\n */\r\n AmmoJSPlugin.prototype.setTimeStep = function (timeStep) {\r\n this._timeStep = timeStep;\r\n };\r\n /**\r\n * Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)\r\n * @param fixedTimeStep fixedTimeStep to use in seconds\r\n */\r\n AmmoJSPlugin.prototype.setFixedTimeStep = function (fixedTimeStep) {\r\n this._fixedTimeStep = fixedTimeStep;\r\n };\r\n /**\r\n * Sets the maximum number of steps by the physics engine per frame (Default: 5)\r\n * @param maxSteps the maximum number of steps by the physics engine per frame\r\n */\r\n AmmoJSPlugin.prototype.setMaxSteps = function (maxSteps) {\r\n this._maxSteps = maxSteps;\r\n };\r\n /**\r\n * Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)\r\n * @returns the current timestep in seconds\r\n */\r\n AmmoJSPlugin.prototype.getTimeStep = function () {\r\n return this._timeStep;\r\n };\r\n // Ammo's contactTest and contactPairTest take a callback that runs synchronously, wrap them so that they are easier to consume\r\n AmmoJSPlugin.prototype._isImpostorInContact = function (impostor) {\r\n this._tmpContactCallbackResult = false;\r\n this.world.contactTest(impostor.physicsBody, this._tmpAmmoConcreteContactResultCallback);\r\n return this._tmpContactCallbackResult;\r\n };\r\n // Ammo's collision events have some weird quirks\r\n // contactPairTest fires too many events as it fires events even when objects are close together but contactTest does not\r\n // so only fire event if both contactTest and contactPairTest have a hit\r\n AmmoJSPlugin.prototype._isImpostorPairInContact = function (impostorA, impostorB) {\r\n this._tmpContactCallbackResult = false;\r\n this.world.contactPairTest(impostorA.physicsBody, impostorB.physicsBody, this._tmpAmmoConcreteContactResultCallback);\r\n return this._tmpContactCallbackResult;\r\n };\r\n // Ammo's behavior when maxSteps > 0 does not behave as described in docs\r\n // @see http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World\r\n //\r\n // When maxSteps is 0 do the entire simulation in one step\r\n // When maxSteps is > 0, run up to maxStep times, if on the last step the (remaining step - fixedTimeStep) is < fixedTimeStep, the remainder will be used for the step. (eg. if remainder is 1.001 and fixedTimeStep is 1 the last step will be 1.001, if instead it did 2 steps (1, 0.001) issues occuered when having a tiny step in ammo)\r\n // Note: To get deterministic physics, timeStep would always need to be divisible by fixedTimeStep\r\n AmmoJSPlugin.prototype._stepSimulation = function (timeStep, maxSteps, fixedTimeStep) {\r\n if (timeStep === void 0) { timeStep = 1 / 60; }\r\n if (maxSteps === void 0) { maxSteps = 10; }\r\n if (fixedTimeStep === void 0) { fixedTimeStep = 1 / 60; }\r\n if (maxSteps == 0) {\r\n this.world.stepSimulation(timeStep, 0);\r\n }\r\n else {\r\n while (maxSteps > 0 && timeStep > 0) {\r\n if (timeStep - fixedTimeStep < fixedTimeStep) {\r\n this.world.stepSimulation(timeStep, 0);\r\n timeStep = 0;\r\n }\r\n else {\r\n timeStep -= fixedTimeStep;\r\n this.world.stepSimulation(fixedTimeStep, 0);\r\n }\r\n maxSteps--;\r\n }\r\n }\r\n };\r\n /**\r\n * Moves the physics simulation forward delta seconds and updates the given physics imposters\r\n * Prior to the step the imposters physics location is set to the position of the babylon meshes\r\n * After the step the babylon meshes are set to the position of the physics imposters\r\n * @param delta amount of time to step forward\r\n * @param impostors array of imposters to update before/after the step\r\n */\r\n AmmoJSPlugin.prototype.executeStep = function (delta, impostors) {\r\n for (var _i = 0, impostors_1 = impostors; _i < impostors_1.length; _i++) {\r\n var impostor = impostors_1[_i];\r\n // Update physics world objects to match babylon world\r\n if (!impostor.soft) {\r\n impostor.beforeStep();\r\n }\r\n }\r\n this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps, this._fixedTimeStep);\r\n for (var _a = 0, impostors_2 = impostors; _a < impostors_2.length; _a++) {\r\n var mainImpostor = impostors_2[_a];\r\n // After physics update make babylon world objects match physics world objects\r\n if (mainImpostor.soft) {\r\n this._afterSoftStep(mainImpostor);\r\n }\r\n else {\r\n mainImpostor.afterStep();\r\n }\r\n // Handle collision event\r\n if (mainImpostor._onPhysicsCollideCallbacks.length > 0) {\r\n if (this._isImpostorInContact(mainImpostor)) {\r\n for (var _b = 0, _c = mainImpostor._onPhysicsCollideCallbacks; _b < _c.length; _b++) {\r\n var collideCallback = _c[_b];\r\n for (var _d = 0, _e = collideCallback.otherImpostors; _d < _e.length; _d++) {\r\n var otherImpostor = _e[_d];\r\n if (mainImpostor.physicsBody.isActive() || otherImpostor.physicsBody.isActive()) {\r\n if (this._isImpostorPairInContact(mainImpostor, otherImpostor)) {\r\n mainImpostor.onCollide({ body: otherImpostor.physicsBody });\r\n otherImpostor.onCollide({ body: mainImpostor.physicsBody });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Update babylon mesh to match physics world object\r\n * @param impostor imposter to match\r\n */\r\n AmmoJSPlugin.prototype._afterSoftStep = function (impostor) {\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].RopeImpostor) {\r\n this._ropeStep(impostor);\r\n }\r\n else {\r\n this._softbodyOrClothStep(impostor);\r\n }\r\n };\r\n /**\r\n * Update babylon mesh vertices vertices to match physics world softbody or cloth\r\n * @param impostor imposter to match\r\n */\r\n AmmoJSPlugin.prototype._ropeStep = function (impostor) {\r\n var bodyVertices = impostor.physicsBody.get_m_nodes();\r\n var nbVertices = bodyVertices.size();\r\n var node;\r\n var nodePositions;\r\n var x, y, z;\r\n var path = new Array();\r\n for (var n = 0; n < nbVertices; n++) {\r\n node = bodyVertices.at(n);\r\n nodePositions = node.get_m_x();\r\n x = nodePositions.x();\r\n y = nodePositions.y();\r\n z = nodePositions.z();\r\n path.push(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](x, y, z));\r\n }\r\n var object = impostor.object;\r\n var shape = impostor.getParam(\"shape\");\r\n if (impostor._isFromLine) {\r\n impostor.object = _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_7__[\"LinesBuilder\"].CreateLines(\"lines\", { points: path, instance: object });\r\n }\r\n else {\r\n impostor.object = _Meshes_Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_6__[\"ShapeBuilder\"].ExtrudeShape(\"ext\", { shape: shape, path: path, instance: object });\r\n }\r\n };\r\n /**\r\n * Update babylon mesh vertices vertices to match physics world softbody or cloth\r\n * @param impostor imposter to match\r\n */\r\n AmmoJSPlugin.prototype._softbodyOrClothStep = function (impostor) {\r\n var normalDirection = (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].ClothImpostor) ? 1 : -1;\r\n var object = impostor.object;\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n var vertexNormals = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].NormalKind);\r\n if (!vertexNormals) {\r\n vertexNormals = [];\r\n }\r\n var nbVertices = vertexPositions.length / 3;\r\n var bodyVertices = impostor.physicsBody.get_m_nodes();\r\n var node;\r\n var nodePositions;\r\n var nodeNormals;\r\n var x, y, z;\r\n var nx, ny, nz;\r\n for (var n = 0; n < nbVertices; n++) {\r\n node = bodyVertices.at(n);\r\n nodePositions = node.get_m_x();\r\n x = nodePositions.x();\r\n y = nodePositions.y();\r\n z = nodePositions.z() * normalDirection;\r\n var nodeNormals = node.get_m_n();\r\n nx = nodeNormals.x();\r\n ny = nodeNormals.y();\r\n nz = nodeNormals.z() * normalDirection;\r\n vertexPositions[3 * n] = x;\r\n vertexPositions[3 * n + 1] = y;\r\n vertexPositions[3 * n + 2] = z;\r\n vertexNormals[3 * n] = nx;\r\n vertexNormals[3 * n + 1] = ny;\r\n vertexNormals[3 * n + 2] = nz;\r\n }\r\n var vertex_data = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"]();\r\n vertex_data.positions = vertexPositions;\r\n vertex_data.normals = vertexNormals;\r\n vertex_data.uvs = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind);\r\n vertex_data.colors = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind);\r\n if (object && object.getIndices) {\r\n vertex_data.indices = object.getIndices();\r\n }\r\n vertex_data.applyToMesh(object);\r\n };\r\n /**\r\n * Applies an impulse on the imposter\r\n * @param impostor imposter to apply impulse to\r\n * @param force amount of force to be applied to the imposter\r\n * @param contactPoint the location to apply the impulse on the imposter\r\n */\r\n AmmoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {\r\n if (!impostor.soft) {\r\n impostor.physicsBody.activate();\r\n var worldPoint = this._tmpAmmoVectorA;\r\n var impulse = this._tmpAmmoVectorB;\r\n // Convert contactPoint into world space\r\n if (impostor.object && impostor.object.getWorldMatrix) {\r\n impostor.object.getWorldMatrix().invertToRef(this._tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(contactPoint, this._tmpMatrix, this._tmpVector);\r\n contactPoint = this._tmpVector;\r\n }\r\n worldPoint.setValue(contactPoint.x, contactPoint.y, contactPoint.z);\r\n impulse.setValue(force.x, force.y, force.z);\r\n impostor.physicsBody.applyImpulse(impulse, worldPoint);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Cannot be applied to a soft body\");\r\n }\r\n };\r\n /**\r\n * Applies a force on the imposter\r\n * @param impostor imposter to apply force\r\n * @param force amount of force to be applied to the imposter\r\n * @param contactPoint the location to apply the force on the imposter\r\n */\r\n AmmoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {\r\n if (!impostor.soft) {\r\n impostor.physicsBody.activate();\r\n var worldPoint = this._tmpAmmoVectorA;\r\n var impulse = this._tmpAmmoVectorB;\r\n // Convert contactPoint into world space\r\n if (impostor.object && impostor.object.getWorldMatrix) {\r\n impostor.object.getWorldMatrix().invertToRef(this._tmpMatrix);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinatesToRef(contactPoint, this._tmpMatrix, this._tmpVector);\r\n contactPoint = this._tmpVector;\r\n }\r\n worldPoint.setValue(contactPoint.x, contactPoint.y, contactPoint.z);\r\n impulse.setValue(force.x, force.y, force.z);\r\n impostor.physicsBody.applyForce(impulse, worldPoint);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Cannot be applied to a soft body\");\r\n }\r\n };\r\n /**\r\n * Creates a physics body using the plugin\r\n * @param impostor the imposter to create the physics body on\r\n */\r\n AmmoJSPlugin.prototype.generatePhysicsBody = function (impostor) {\r\n // Note: this method will not be called on child imposotrs for compound impostors\r\n impostor._pluginData.toDispose = [];\r\n //parent-child relationship\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n if (impostor.isBodyInitRequired()) {\r\n var colShape = this._createShape(impostor);\r\n var mass = impostor.getParam(\"mass\");\r\n impostor._pluginData.mass = mass;\r\n if (impostor.soft) {\r\n colShape.get_m_cfg().set_collisions(0x11);\r\n colShape.get_m_cfg().set_kDP(impostor.getParam(\"damping\"));\r\n Ammo.castObject(colShape, Ammo.btCollisionObject).getCollisionShape().setMargin(impostor.getParam(\"margin\"));\r\n colShape.setActivationState(AmmoJSPlugin.DISABLE_DEACTIVATION_FLAG);\r\n this.world.addSoftBody(colShape, 1, -1);\r\n impostor.physicsBody = colShape;\r\n impostor._pluginData.toDispose.push(colShape);\r\n this.setBodyPressure(impostor, 0);\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SoftbodyImpostor) {\r\n this.setBodyPressure(impostor, impostor.getParam(\"pressure\"));\r\n }\r\n this.setBodyStiffness(impostor, impostor.getParam(\"stiffness\"));\r\n this.setBodyVelocityIterations(impostor, impostor.getParam(\"velocityIterations\"));\r\n this.setBodyPositionIterations(impostor, impostor.getParam(\"positionIterations\"));\r\n }\r\n else {\r\n var localInertia = new Ammo.btVector3(0, 0, 0);\r\n var startTransform = new Ammo.btTransform();\r\n startTransform.setIdentity();\r\n if (mass !== 0) {\r\n colShape.calculateLocalInertia(mass, localInertia);\r\n }\r\n this._tmpAmmoVectorA.setValue(impostor.object.position.x, impostor.object.position.y, impostor.object.position.z);\r\n this._tmpAmmoQuaternion.setValue(impostor.object.rotationQuaternion.x, impostor.object.rotationQuaternion.y, impostor.object.rotationQuaternion.z, impostor.object.rotationQuaternion.w);\r\n startTransform.setOrigin(this._tmpAmmoVectorA);\r\n startTransform.setRotation(this._tmpAmmoQuaternion);\r\n var myMotionState = new Ammo.btDefaultMotionState(startTransform);\r\n var rbInfo = new Ammo.btRigidBodyConstructionInfo(mass, myMotionState, colShape, localInertia);\r\n var body = new Ammo.btRigidBody(rbInfo);\r\n // Make objects kinematic if it's mass is 0\r\n if (mass === 0) {\r\n body.setCollisionFlags(body.getCollisionFlags() | AmmoJSPlugin.KINEMATIC_FLAG);\r\n body.setActivationState(AmmoJSPlugin.DISABLE_DEACTIVATION_FLAG);\r\n }\r\n // Disable collision if NoImpostor, but keep collision if shape is btCompoundShape\r\n if (impostor.type == _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].NoImpostor && !colShape.getChildShape) {\r\n body.setCollisionFlags(body.getCollisionFlags() | AmmoJSPlugin.DISABLE_COLLISION_FLAG);\r\n }\r\n this.world.addRigidBody(body);\r\n impostor.physicsBody = body;\r\n impostor._pluginData.toDispose = impostor._pluginData.toDispose.concat([body, rbInfo, myMotionState, startTransform, localInertia, colShape]);\r\n }\r\n this.setBodyRestitution(impostor, impostor.getParam(\"restitution\"));\r\n this.setBodyFriction(impostor, impostor.getParam(\"friction\"));\r\n }\r\n };\r\n /**\r\n * Removes the physics body from the imposter and disposes of the body's memory\r\n * @param impostor imposter to remove the physics body from\r\n */\r\n AmmoJSPlugin.prototype.removePhysicsBody = function (impostor) {\r\n var _this = this;\r\n if (this.world) {\r\n if (impostor.soft) {\r\n this.world.removeSoftBody(impostor.physicsBody);\r\n }\r\n else {\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n }\r\n if (impostor._pluginData) {\r\n impostor._pluginData.toDispose.forEach(function (d) {\r\n _this.bjsAMMO.destroy(d);\r\n });\r\n impostor._pluginData.toDispose = [];\r\n }\r\n }\r\n };\r\n /**\r\n * Generates a joint\r\n * @param impostorJoint the imposter joint to create the joint with\r\n */\r\n AmmoJSPlugin.prototype.generateJoint = function (impostorJoint) {\r\n var mainBody = impostorJoint.mainImpostor.physicsBody;\r\n var connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n var jointData = impostorJoint.joint.jointData;\r\n if (!jointData.mainPivot) {\r\n jointData.mainPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n if (!jointData.connectedPivot) {\r\n jointData.connectedPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n var joint;\r\n switch (impostorJoint.joint.type) {\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsJoint\"].DistanceJoint:\r\n var distance = jointData.maxDistance;\r\n if (distance) {\r\n jointData.mainPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -distance / 2, 0);\r\n jointData.connectedPivot = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, distance / 2, 0);\r\n }\r\n joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsJoint\"].HingeJoint:\r\n if (!jointData.mainAxis) {\r\n jointData.mainAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n if (!jointData.connectedAxis) {\r\n jointData.connectedAxis = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, 0, 0);\r\n }\r\n var mainAxis = new Ammo.btVector3(jointData.mainAxis.x, jointData.mainAxis.y, jointData.mainAxis.z);\r\n var connectedAxis = new Ammo.btVector3(jointData.connectedAxis.x, jointData.connectedAxis.y, jointData.connectedAxis.z);\r\n joint = new Ammo.btHingeConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z), mainAxis, connectedAxis);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsJoint\"].BallAndSocketJoint:\r\n joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));\r\n break;\r\n default:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint\");\r\n joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));\r\n break;\r\n }\r\n this.world.addConstraint(joint, !impostorJoint.joint.jointData.collision);\r\n impostorJoint.joint.physicsJoint = joint;\r\n };\r\n /**\r\n * Removes a joint\r\n * @param impostorJoint the imposter joint to remove the joint from\r\n */\r\n AmmoJSPlugin.prototype.removeJoint = function (impostorJoint) {\r\n if (this.world) {\r\n this.world.removeConstraint(impostorJoint.joint.physicsJoint);\r\n }\r\n };\r\n // adds all verticies (including child verticies) to the triangle mesh\r\n AmmoJSPlugin.prototype._addMeshVerts = function (btTriangleMesh, topLevelObject, object) {\r\n var _this = this;\r\n var triangleCount = 0;\r\n if (object && object.getIndices && object.getWorldMatrix && object.getChildMeshes) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n object.computeWorldMatrix(false);\r\n var faceCount = indices.length / 3;\r\n for (var i = 0; i < faceCount; i++) {\r\n var triPoints = [];\r\n for (var point = 0; point < 3; point++) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[(indices[(i * 3) + point] * 3) + 0], vertexPositions[(indices[(i * 3) + point] * 3) + 1], vertexPositions[(indices[(i * 3) + point] * 3) + 2]);\r\n // Adjust for initial scaling\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].ScalingToRef(object.scaling.x, object.scaling.y, object.scaling.z, this._tmpMatrix);\r\n v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(v, this._tmpMatrix);\r\n var vec;\r\n if (point == 0) {\r\n vec = this._tmpAmmoVectorA;\r\n }\r\n else if (point == 1) {\r\n vec = this._tmpAmmoVectorB;\r\n }\r\n else {\r\n vec = this._tmpAmmoVectorC;\r\n }\r\n vec.setValue(v.x, v.y, v.z);\r\n triPoints.push(vec);\r\n }\r\n btTriangleMesh.addTriangle(triPoints[0], triPoints[1], triPoints[2]);\r\n triangleCount++;\r\n }\r\n object.getChildMeshes().forEach(function (m) {\r\n triangleCount += _this._addMeshVerts(btTriangleMesh, topLevelObject, m);\r\n });\r\n }\r\n return triangleCount;\r\n };\r\n /**\r\n * Initialise the soft body vertices to match its object's (mesh) vertices\r\n * Softbody vertices (nodes) are in world space and to match this\r\n * The object's position and rotation is set to zero and so its vertices are also then set in world space\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._softVertexData = function (impostor) {\r\n var object = impostor.object;\r\n if (object && object.getIndices && object.getWorldMatrix && object.getChildMeshes) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n var vertexNormals = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].NormalKind);\r\n if (!vertexNormals) {\r\n vertexNormals = [];\r\n }\r\n object.computeWorldMatrix(false);\r\n var newPoints = [];\r\n var newNorms = [];\r\n for (var i = 0; i < vertexPositions.length; i += 3) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[i], vertexPositions[i + 1], vertexPositions[i + 2]);\r\n var n = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexNormals[i], vertexNormals[i + 1], vertexNormals[i + 2]);\r\n v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(v, object.getWorldMatrix());\r\n n = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformNormal(n, object.getWorldMatrix());\r\n newPoints.push(v.x, v.y, v.z);\r\n newNorms.push(n.x, n.y, n.z);\r\n }\r\n var vertex_data = new _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"]();\r\n vertex_data.positions = newPoints;\r\n vertex_data.normals = newNorms;\r\n vertex_data.uvs = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind);\r\n vertex_data.colors = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].ColorKind);\r\n if (object && object.getIndices) {\r\n vertex_data.indices = object.getIndices();\r\n }\r\n vertex_data.applyToMesh(object);\r\n object.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n object.rotationQuaternion = null;\r\n object.rotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n object.computeWorldMatrix(true);\r\n return vertex_data;\r\n }\r\n return _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_5__[\"VertexData\"].ExtractFromMesh(object);\r\n };\r\n /**\r\n * Create an impostor's soft body\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._createSoftbody = function (impostor) {\r\n var object = impostor.object;\r\n if (object && object.getIndices) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertex_data = this._softVertexData(impostor);\r\n var vertexPositions = vertex_data.positions;\r\n var vertexNormals = vertex_data.normals;\r\n if (vertexPositions === null || vertexNormals === null) {\r\n return new Ammo.btCompoundShape();\r\n }\r\n else {\r\n var triPoints = [];\r\n var triNorms = [];\r\n for (var i = 0; i < vertexPositions.length; i += 3) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[i], vertexPositions[i + 1], vertexPositions[i + 2]);\r\n var n = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexNormals[i], vertexNormals[i + 1], vertexNormals[i + 2]);\r\n triPoints.push(v.x, v.y, -v.z);\r\n triNorms.push(n.x, n.y, -n.z);\r\n }\r\n var softBody = new Ammo.btSoftBodyHelpers().CreateFromTriMesh(this.world.getWorldInfo(), triPoints, object.getIndices(), indices.length / 3, true);\r\n var nbVertices = vertexPositions.length / 3;\r\n var bodyVertices = softBody.get_m_nodes();\r\n var node;\r\n var nodeNormals;\r\n for (var i = 0; i < nbVertices; i++) {\r\n node = bodyVertices.at(i);\r\n var nodeNormals = node.get_m_n();\r\n nodeNormals.setX(triNorms[3 * i]);\r\n nodeNormals.setY(triNorms[3 * i + 1]);\r\n nodeNormals.setZ(triNorms[3 * i + 2]);\r\n }\r\n return softBody;\r\n }\r\n }\r\n };\r\n /**\r\n * Create cloth for an impostor\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._createCloth = function (impostor) {\r\n var object = impostor.object;\r\n if (object && object.getIndices) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertex_data = this._softVertexData(impostor);\r\n var vertexPositions = vertex_data.positions;\r\n var vertexNormals = vertex_data.normals;\r\n if (vertexPositions === null || vertexNormals === null) {\r\n return new Ammo.btCompoundShape();\r\n }\r\n else {\r\n var len = vertexPositions.length;\r\n var segments = Math.sqrt(len / 3);\r\n impostor.segments = segments;\r\n var segs = segments - 1;\r\n this._tmpAmmoVectorA.setValue(vertexPositions[0], vertexPositions[1], vertexPositions[2]);\r\n this._tmpAmmoVectorB.setValue(vertexPositions[3 * segs], vertexPositions[3 * segs + 1], vertexPositions[3 * segs + 2]);\r\n this._tmpAmmoVectorD.setValue(vertexPositions[len - 3], vertexPositions[len - 2], vertexPositions[len - 1]);\r\n this._tmpAmmoVectorC.setValue(vertexPositions[len - 3 - 3 * segs], vertexPositions[len - 2 - 3 * segs], vertexPositions[len - 1 - 3 * segs]);\r\n var clothBody = new Ammo.btSoftBodyHelpers().CreatePatch(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, this._tmpAmmoVectorC, this._tmpAmmoVectorD, segments, segments, impostor.getParam(\"fixedPoints\"), true);\r\n return clothBody;\r\n }\r\n }\r\n };\r\n /**\r\n * Create rope for an impostor\r\n * @param impostor to create the softbody for\r\n */\r\n AmmoJSPlugin.prototype._createRope = function (impostor) {\r\n var len;\r\n var segments;\r\n var vertex_data = this._softVertexData(impostor);\r\n var vertexPositions = vertex_data.positions;\r\n var vertexNormals = vertex_data.normals;\r\n if (vertexPositions === null || vertexNormals === null) {\r\n return new Ammo.btCompoundShape();\r\n }\r\n //force the mesh to be updatable\r\n vertex_data.applyToMesh(impostor.object, true);\r\n impostor._isFromLine = true;\r\n // If in lines mesh all normals will be zero\r\n var vertexSquared = vertexNormals.map(function (x) { return x * x; });\r\n var reducer = function (accumulator, currentValue) { return accumulator + currentValue; };\r\n var reduced = vertexSquared.reduce(reducer);\r\n if (reduced === 0) { // line mesh\r\n len = vertexPositions.length;\r\n segments = len / 3 - 1;\r\n this._tmpAmmoVectorA.setValue(vertexPositions[0], vertexPositions[1], vertexPositions[2]);\r\n this._tmpAmmoVectorB.setValue(vertexPositions[len - 3], vertexPositions[len - 2], vertexPositions[len - 1]);\r\n }\r\n else { //extruded mesh\r\n impostor._isFromLine = false;\r\n var pathVectors = impostor.getParam(\"path\");\r\n var shape = impostor.getParam(\"shape\");\r\n if (shape === null) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"No shape available for extruded mesh\");\r\n return new Ammo.btCompoundShape();\r\n }\r\n if ((vertexPositions.length % (3 * pathVectors.length)) !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Path does not match extrusion\");\r\n return new Ammo.btCompoundShape();\r\n }\r\n len = pathVectors.length;\r\n segments = len - 1;\r\n this._tmpAmmoVectorA.setValue(pathVectors[0].x, pathVectors[0].y, pathVectors[0].z);\r\n this._tmpAmmoVectorB.setValue(pathVectors[len - 1].x, pathVectors[len - 1].y, pathVectors[len - 1].z);\r\n }\r\n impostor.segments = segments;\r\n var fixedPoints = impostor.getParam(\"fixedPoints\");\r\n fixedPoints = (fixedPoints > 3) ? 3 : fixedPoints;\r\n var ropeBody = new Ammo.btSoftBodyHelpers().CreateRope(this.world.getWorldInfo(), this._tmpAmmoVectorA, this._tmpAmmoVectorB, segments - 1, fixedPoints);\r\n ropeBody.get_m_cfg().set_collisions(0x11);\r\n return ropeBody;\r\n };\r\n // adds all verticies (including child verticies) to the convex hull shape\r\n AmmoJSPlugin.prototype._addHullVerts = function (btConvexHullShape, topLevelObject, object) {\r\n var _this = this;\r\n var triangleCount = 0;\r\n if (object && object.getIndices && object.getWorldMatrix && object.getChildMeshes) {\r\n var indices = object.getIndices();\r\n if (!indices) {\r\n indices = [];\r\n }\r\n var vertexPositions = object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind);\r\n if (!vertexPositions) {\r\n vertexPositions = [];\r\n }\r\n object.computeWorldMatrix(false);\r\n var faceCount = indices.length / 3;\r\n for (var i = 0; i < faceCount; i++) {\r\n var triPoints = [];\r\n for (var point = 0; point < 3; point++) {\r\n var v = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](vertexPositions[(indices[(i * 3) + point] * 3) + 0], vertexPositions[(indices[(i * 3) + point] * 3) + 1], vertexPositions[(indices[(i * 3) + point] * 3) + 2]);\r\n // Adjust for initial scaling\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].ScalingToRef(object.scaling.x, object.scaling.y, object.scaling.z, this._tmpMatrix);\r\n v = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].TransformCoordinates(v, this._tmpMatrix);\r\n var vec;\r\n if (point == 0) {\r\n vec = this._tmpAmmoVectorA;\r\n }\r\n else if (point == 1) {\r\n vec = this._tmpAmmoVectorB;\r\n }\r\n else {\r\n vec = this._tmpAmmoVectorC;\r\n }\r\n vec.setValue(v.x, v.y, v.z);\r\n triPoints.push(vec);\r\n }\r\n btConvexHullShape.addPoint(triPoints[0], true);\r\n btConvexHullShape.addPoint(triPoints[1], true);\r\n btConvexHullShape.addPoint(triPoints[2], true);\r\n triangleCount++;\r\n }\r\n object.getChildMeshes().forEach(function (m) {\r\n triangleCount += _this._addHullVerts(btConvexHullShape, topLevelObject, m);\r\n });\r\n }\r\n return triangleCount;\r\n };\r\n AmmoJSPlugin.prototype._createShape = function (impostor, ignoreChildren) {\r\n var _this = this;\r\n if (ignoreChildren === void 0) { ignoreChildren = false; }\r\n var object = impostor.object;\r\n var returnValue;\r\n var extendSize = impostor.getObjectExtendSize();\r\n if (!ignoreChildren) {\r\n var meshChildren = impostor.object.getChildMeshes ? impostor.object.getChildMeshes(true) : [];\r\n returnValue = new Ammo.btCompoundShape();\r\n // Add shape of all children to the compound shape\r\n var childrenAdded = 0;\r\n meshChildren.forEach(function (childMesh) {\r\n var childImpostor = childMesh.getPhysicsImpostor();\r\n if (childImpostor) {\r\n if (childImpostor.type == _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].MeshImpostor) {\r\n throw \"A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)\";\r\n }\r\n var shape = _this._createShape(childImpostor);\r\n // Position needs to be scaled based on parent's scaling\r\n var parentMat = childMesh.parent.getWorldMatrix().clone();\r\n var s = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"]();\r\n parentMat.decompose(s);\r\n _this._tmpAmmoTransform.getOrigin().setValue(childMesh.position.x * s.x, childMesh.position.y * s.y, childMesh.position.z * s.z);\r\n _this._tmpAmmoQuaternion.setValue(childMesh.rotationQuaternion.x, childMesh.rotationQuaternion.y, childMesh.rotationQuaternion.z, childMesh.rotationQuaternion.w);\r\n _this._tmpAmmoTransform.setRotation(_this._tmpAmmoQuaternion);\r\n returnValue.addChildShape(_this._tmpAmmoTransform, shape);\r\n childImpostor.dispose();\r\n childrenAdded++;\r\n }\r\n });\r\n if (childrenAdded > 0) {\r\n // Add parents shape as a child if present\r\n if (impostor.type != _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].NoImpostor) {\r\n var shape = this._createShape(impostor, true);\r\n if (shape) {\r\n this._tmpAmmoTransform.getOrigin().setValue(0, 0, 0);\r\n this._tmpAmmoQuaternion.setValue(0, 0, 0, 1);\r\n this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion);\r\n returnValue.addChildShape(this._tmpAmmoTransform, shape);\r\n }\r\n }\r\n return returnValue;\r\n }\r\n else {\r\n // If no children with impostors create the actual shape below instead\r\n Ammo.destroy(returnValue);\r\n returnValue = null;\r\n }\r\n }\r\n switch (impostor.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SphereImpostor:\r\n // Is there a better way to compare floats number? With an epsylon or with a Math function\r\n if (_Maths_math_scalar__WEBPACK_IMPORTED_MODULE_9__[\"Scalar\"].WithinEpsilon(extendSize.x, extendSize.y, 0.0001) && _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_9__[\"Scalar\"].WithinEpsilon(extendSize.x, extendSize.z, 0.0001)) {\r\n returnValue = new Ammo.btSphereShape(extendSize.x / 2);\r\n }\r\n else {\r\n // create a btMultiSphereShape because it's not possible to set a local scaling on a btSphereShape\r\n var positions = [new Ammo.btVector3(0, 0, 0)];\r\n var radii = [1];\r\n returnValue = new Ammo.btMultiSphereShape(positions, radii, 1);\r\n returnValue.setLocalScaling(new Ammo.btVector3(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2));\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].CapsuleImpostor:\r\n returnValue = new Ammo.btCapsuleShape(extendSize.x / 2, extendSize.y / 2);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].CylinderImpostor:\r\n this._tmpAmmoVectorA.setValue(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2);\r\n returnValue = new Ammo.btCylinderShape(this._tmpAmmoVectorA);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].PlaneImpostor:\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].BoxImpostor:\r\n this._tmpAmmoVectorA.setValue(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2);\r\n returnValue = new Ammo.btBoxShape(this._tmpAmmoVectorA);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].MeshImpostor:\r\n if (impostor.getParam(\"mass\") == 0) {\r\n // Only create btBvhTriangleMeshShape impostor is static\r\n // See https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=7283\r\n var tetraMesh = new Ammo.btTriangleMesh();\r\n impostor._pluginData.toDispose.push(tetraMesh);\r\n var triangeCount = this._addMeshVerts(tetraMesh, object, object);\r\n if (triangeCount == 0) {\r\n returnValue = new Ammo.btCompoundShape();\r\n }\r\n else {\r\n returnValue = new Ammo.btBvhTriangleMeshShape(tetraMesh);\r\n }\r\n break;\r\n }\r\n // Otherwise create convexHullImpostor\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].ConvexHullImpostor:\r\n var convexMesh = new Ammo.btConvexHullShape();\r\n var triangeCount = this._addHullVerts(convexMesh, object, object);\r\n if (triangeCount == 0) {\r\n // Cleanup Unused Convex Hull Shape\r\n impostor._pluginData.toDispose.push(convexMesh);\r\n returnValue = new Ammo.btCompoundShape();\r\n }\r\n else {\r\n returnValue = convexMesh;\r\n }\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].NoImpostor:\r\n // Fill with sphere but collision is disabled on the rigid body in generatePhysicsBody, using an empty shape caused unexpected movement with joints\r\n returnValue = new Ammo.btSphereShape(extendSize.x / 2);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SoftbodyImpostor:\r\n // Only usable with a mesh that has sufficient and shared vertices\r\n returnValue = this._createSoftbody(impostor);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].ClothImpostor:\r\n // Only usable with a ground mesh that has sufficient and shared vertices\r\n returnValue = this._createCloth(impostor);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].RopeImpostor:\r\n // Only usable with a line mesh or an extruded mesh that is updatable\r\n returnValue = this._createRope(impostor);\r\n break;\r\n default:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"The impostor type is not currently supported by the ammo plugin.\");\r\n break;\r\n }\r\n return returnValue;\r\n };\r\n /**\r\n * Sets the physics body position/rotation from the babylon mesh's position/rotation\r\n * @param impostor imposter containing the physics body and babylon object\r\n */\r\n AmmoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {\r\n impostor.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform);\r\n impostor.object.position.set(this._tmpAmmoTransform.getOrigin().x(), this._tmpAmmoTransform.getOrigin().y(), this._tmpAmmoTransform.getOrigin().z());\r\n if (!impostor.object.rotationQuaternion) {\r\n if (impostor.object.rotation) {\r\n this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w());\r\n this._tmpQuaternion.toEulerAnglesToRef(impostor.object.rotation);\r\n }\r\n }\r\n else {\r\n impostor.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(), this._tmpAmmoTransform.getRotation().y(), this._tmpAmmoTransform.getRotation().z(), this._tmpAmmoTransform.getRotation().w());\r\n }\r\n };\r\n /**\r\n * Sets the babylon object's position/rotation from the physics body's position/rotation\r\n * @param impostor imposter containing the physics body and babylon object\r\n * @param newPosition new position\r\n * @param newRotation new rotation\r\n */\r\n AmmoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {\r\n var trans = impostor.physicsBody.getWorldTransform();\r\n // If rotation/position has changed update and activate riged body\r\n if (trans.getOrigin().x() != newPosition.x ||\r\n trans.getOrigin().y() != newPosition.y ||\r\n trans.getOrigin().z() != newPosition.z ||\r\n trans.getRotation().x() != newRotation.x ||\r\n trans.getRotation().y() != newRotation.y ||\r\n trans.getRotation().z() != newRotation.z ||\r\n trans.getRotation().w() != newRotation.w) {\r\n this._tmpAmmoVectorA.setValue(newPosition.x, newPosition.y, newPosition.z);\r\n trans.setOrigin(this._tmpAmmoVectorA);\r\n this._tmpAmmoQuaternion.setValue(newRotation.x, newRotation.y, newRotation.z, newRotation.w);\r\n trans.setRotation(this._tmpAmmoQuaternion);\r\n impostor.physicsBody.setWorldTransform(trans);\r\n if (impostor.mass == 0) {\r\n // Kinematic objects must be updated using motion state\r\n var motionState = impostor.physicsBody.getMotionState();\r\n if (motionState) {\r\n motionState.setWorldTransform(trans);\r\n }\r\n }\r\n else {\r\n impostor.physicsBody.activate();\r\n }\r\n }\r\n };\r\n /**\r\n * If this plugin is supported\r\n * @returns true if its supported\r\n */\r\n AmmoJSPlugin.prototype.isSupported = function () {\r\n return this.bjsAMMO !== undefined;\r\n };\r\n /**\r\n * Sets the linear velocity of the physics body\r\n * @param impostor imposter to set the velocity on\r\n * @param velocity velocity to set\r\n */\r\n AmmoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {\r\n this._tmpAmmoVectorA.setValue(velocity.x, velocity.y, velocity.z);\r\n if (impostor.soft) {\r\n impostor.physicsBody.linearVelocity(this._tmpAmmoVectorA);\r\n }\r\n else {\r\n impostor.physicsBody.setLinearVelocity(this._tmpAmmoVectorA);\r\n }\r\n };\r\n /**\r\n * Sets the angular velocity of the physics body\r\n * @param impostor imposter to set the velocity on\r\n * @param velocity velocity to set\r\n */\r\n AmmoJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {\r\n this._tmpAmmoVectorA.setValue(velocity.x, velocity.y, velocity.z);\r\n if (impostor.soft) {\r\n impostor.physicsBody.angularVelocity(this._tmpAmmoVectorA);\r\n }\r\n else {\r\n impostor.physicsBody.setAngularVelocity(this._tmpAmmoVectorA);\r\n }\r\n };\r\n /**\r\n * gets the linear velocity\r\n * @param impostor imposter to get linear velocity from\r\n * @returns linear velocity\r\n */\r\n AmmoJSPlugin.prototype.getLinearVelocity = function (impostor) {\r\n if (impostor.soft) {\r\n var v = impostor.physicsBody.linearVelocity();\r\n }\r\n else {\r\n var v = impostor.physicsBody.getLinearVelocity();\r\n }\r\n if (!v) {\r\n return null;\r\n }\r\n var result = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](v.x(), v.y(), v.z());\r\n Ammo.destroy(v);\r\n return result;\r\n };\r\n /**\r\n * gets the angular velocity\r\n * @param impostor imposter to get angular velocity from\r\n * @returns angular velocity\r\n */\r\n AmmoJSPlugin.prototype.getAngularVelocity = function (impostor) {\r\n if (impostor.soft) {\r\n var v = impostor.physicsBody.angularVelocity();\r\n }\r\n else {\r\n var v = impostor.physicsBody.getAngularVelocity();\r\n }\r\n if (!v) {\r\n return null;\r\n }\r\n var result = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](v.x(), v.y(), v.z());\r\n Ammo.destroy(v);\r\n return result;\r\n };\r\n /**\r\n * Sets the mass of physics body\r\n * @param impostor imposter to set the mass on\r\n * @param mass mass to set\r\n */\r\n AmmoJSPlugin.prototype.setBodyMass = function (impostor, mass) {\r\n if (impostor.soft) {\r\n impostor.physicsBody.setTotalMass(mass, false);\r\n }\r\n else {\r\n impostor.physicsBody.setMassProps(mass);\r\n }\r\n impostor._pluginData.mass = mass;\r\n };\r\n /**\r\n * Gets the mass of the physics body\r\n * @param impostor imposter to get the mass from\r\n * @returns mass\r\n */\r\n AmmoJSPlugin.prototype.getBodyMass = function (impostor) {\r\n return impostor._pluginData.mass || 0;\r\n };\r\n /**\r\n * Gets friction of the impostor\r\n * @param impostor impostor to get friction from\r\n * @returns friction value\r\n */\r\n AmmoJSPlugin.prototype.getBodyFriction = function (impostor) {\r\n return impostor._pluginData.friction || 0;\r\n };\r\n /**\r\n * Sets friction of the impostor\r\n * @param impostor impostor to set friction on\r\n * @param friction friction value\r\n */\r\n AmmoJSPlugin.prototype.setBodyFriction = function (impostor, friction) {\r\n if (impostor.soft) {\r\n impostor.physicsBody.get_m_cfg().set_kDF(friction);\r\n }\r\n else {\r\n impostor.physicsBody.setFriction(friction);\r\n }\r\n impostor._pluginData.friction = friction;\r\n };\r\n /**\r\n * Gets restitution of the impostor\r\n * @param impostor impostor to get restitution from\r\n * @returns restitution value\r\n */\r\n AmmoJSPlugin.prototype.getBodyRestitution = function (impostor) {\r\n return impostor._pluginData.restitution || 0;\r\n };\r\n /**\r\n * Sets resitution of the impostor\r\n * @param impostor impostor to set resitution on\r\n * @param restitution resitution value\r\n */\r\n AmmoJSPlugin.prototype.setBodyRestitution = function (impostor, restitution) {\r\n impostor.physicsBody.setRestitution(restitution);\r\n impostor._pluginData.restitution = restitution;\r\n };\r\n /**\r\n * Gets pressure inside the impostor\r\n * @param impostor impostor to get pressure from\r\n * @returns pressure value\r\n */\r\n AmmoJSPlugin.prototype.getBodyPressure = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Pressure is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.pressure || 0;\r\n };\r\n /**\r\n * Sets pressure inside a soft body impostor\r\n * Cloth and rope must remain 0 pressure\r\n * @param impostor impostor to set pressure on\r\n * @param pressure pressure value\r\n */\r\n AmmoJSPlugin.prototype.setBodyPressure = function (impostor, pressure) {\r\n if (impostor.soft) {\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsImpostor\"].SoftbodyImpostor) {\r\n impostor.physicsBody.get_m_cfg().set_kPR(pressure);\r\n impostor._pluginData.pressure = pressure;\r\n }\r\n else {\r\n impostor.physicsBody.get_m_cfg().set_kPR(0);\r\n impostor._pluginData.pressure = 0;\r\n }\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Pressure can only be applied to a softbody\");\r\n }\r\n };\r\n /**\r\n * Gets stiffness of the impostor\r\n * @param impostor impostor to get stiffness from\r\n * @returns pressure value\r\n */\r\n AmmoJSPlugin.prototype.getBodyStiffness = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Stiffness is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.stiffness || 0;\r\n };\r\n /**\r\n * Sets stiffness of the impostor\r\n * @param impostor impostor to set stiffness on\r\n * @param stiffness stiffness value from 0 to 1\r\n */\r\n AmmoJSPlugin.prototype.setBodyStiffness = function (impostor, stiffness) {\r\n if (impostor.soft) {\r\n stiffness = stiffness < 0 ? 0 : stiffness;\r\n stiffness = stiffness > 1 ? 1 : stiffness;\r\n impostor.physicsBody.get_m_materials().at(0).set_m_kLST(stiffness);\r\n impostor._pluginData.stiffness = stiffness;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Stiffness cannot be applied to a rigid body\");\r\n }\r\n };\r\n /**\r\n * Gets velocityIterations of the impostor\r\n * @param impostor impostor to get velocity iterations from\r\n * @returns velocityIterations value\r\n */\r\n AmmoJSPlugin.prototype.getBodyVelocityIterations = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Velocity iterations is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.velocityIterations || 0;\r\n };\r\n /**\r\n * Sets velocityIterations of the impostor\r\n * @param impostor impostor to set velocity iterations on\r\n * @param velocityIterations velocityIterations value\r\n */\r\n AmmoJSPlugin.prototype.setBodyVelocityIterations = function (impostor, velocityIterations) {\r\n if (impostor.soft) {\r\n velocityIterations = velocityIterations < 0 ? 0 : velocityIterations;\r\n impostor.physicsBody.get_m_cfg().set_viterations(velocityIterations);\r\n impostor._pluginData.velocityIterations = velocityIterations;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Velocity iterations cannot be applied to a rigid body\");\r\n }\r\n };\r\n /**\r\n * Gets positionIterations of the impostor\r\n * @param impostor impostor to get position iterations from\r\n * @returns positionIterations value\r\n */\r\n AmmoJSPlugin.prototype.getBodyPositionIterations = function (impostor) {\r\n if (!impostor.soft) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Position iterations is not a property of a rigid body\");\r\n return 0;\r\n }\r\n return impostor._pluginData.positionIterations || 0;\r\n };\r\n /**\r\n * Sets positionIterations of the impostor\r\n * @param impostor impostor to set position on\r\n * @param positionIterations positionIterations value\r\n */\r\n AmmoJSPlugin.prototype.setBodyPositionIterations = function (impostor, positionIterations) {\r\n if (impostor.soft) {\r\n positionIterations = positionIterations < 0 ? 0 : positionIterations;\r\n impostor.physicsBody.get_m_cfg().set_piterations(positionIterations);\r\n impostor._pluginData.positionIterations = positionIterations;\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Position iterations cannot be applied to a rigid body\");\r\n }\r\n };\r\n /**\r\n * Append an anchor to a cloth object\r\n * @param impostor is the cloth impostor to add anchor to\r\n * @param otherImpostor is the rigid impostor to anchor to\r\n * @param width ratio across width from 0 to 1\r\n * @param height ratio up height from 0 to 1\r\n * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n */\r\n AmmoJSPlugin.prototype.appendAnchor = function (impostor, otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies) {\r\n if (influence === void 0) { influence = 1; }\r\n if (noCollisionBetweenLinkedBodies === void 0) { noCollisionBetweenLinkedBodies = false; }\r\n var segs = impostor.segments;\r\n var nbAcross = Math.round((segs - 1) * width);\r\n var nbUp = Math.round((segs - 1) * height);\r\n var nbDown = segs - 1 - nbUp;\r\n var node = nbAcross + segs * nbDown;\r\n impostor.physicsBody.appendAnchor(node, otherImpostor.physicsBody, noCollisionBetweenLinkedBodies, influence);\r\n };\r\n /**\r\n * Append an hook to a rope object\r\n * @param impostor is the rope impostor to add hook to\r\n * @param otherImpostor is the rigid impostor to hook to\r\n * @param length ratio along the rope from 0 to 1\r\n * @param influence the elasticity between soft impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n */\r\n AmmoJSPlugin.prototype.appendHook = function (impostor, otherImpostor, length, influence, noCollisionBetweenLinkedBodies) {\r\n if (influence === void 0) { influence = 1; }\r\n if (noCollisionBetweenLinkedBodies === void 0) { noCollisionBetweenLinkedBodies = false; }\r\n var node = Math.round(impostor.segments * length);\r\n impostor.physicsBody.appendAnchor(node, otherImpostor.physicsBody, noCollisionBetweenLinkedBodies, influence);\r\n };\r\n /**\r\n * Sleeps the physics body and stops it from being active\r\n * @param impostor impostor to sleep\r\n */\r\n AmmoJSPlugin.prototype.sleepBody = function (impostor) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"sleepBody is not currently supported by the Ammo physics plugin\");\r\n };\r\n /**\r\n * Activates the physics body\r\n * @param impostor impostor to activate\r\n */\r\n AmmoJSPlugin.prototype.wakeUpBody = function (impostor) {\r\n impostor.physicsBody.activate();\r\n };\r\n /**\r\n * Updates the distance parameters of the joint\r\n * @param joint joint to update\r\n * @param maxDistance maximum distance of the joint\r\n * @param minDistance minimum distance of the joint\r\n */\r\n AmmoJSPlugin.prototype.updateDistanceJoint = function (joint, maxDistance, minDistance) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"updateDistanceJoint is not currently supported by the Ammo physics plugin\");\r\n };\r\n /**\r\n * Sets a motor on the joint\r\n * @param joint joint to set motor on\r\n * @param speed speed of the motor\r\n * @param maxForce maximum force of the motor\r\n * @param motorIndex index of the motor\r\n */\r\n AmmoJSPlugin.prototype.setMotor = function (joint, speed, maxForce, motorIndex) {\r\n joint.physicsJoint.enableAngularMotor(true, speed, maxForce);\r\n };\r\n /**\r\n * Sets the motors limit\r\n * @param joint joint to set limit on\r\n * @param upperLimit upper limit\r\n * @param lowerLimit lower limit\r\n */\r\n AmmoJSPlugin.prototype.setLimit = function (joint, upperLimit, lowerLimit) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"setLimit is not currently supported by the Ammo physics plugin\");\r\n };\r\n /**\r\n * Syncs the position and rotation of a mesh with the impostor\r\n * @param mesh mesh to sync\r\n * @param impostor impostor to update the mesh with\r\n */\r\n AmmoJSPlugin.prototype.syncMeshWithImpostor = function (mesh, impostor) {\r\n var body = impostor.physicsBody;\r\n body.getMotionState().getWorldTransform(this._tmpAmmoTransform);\r\n mesh.position.x = this._tmpAmmoTransform.getOrigin().x();\r\n mesh.position.y = this._tmpAmmoTransform.getOrigin().y();\r\n mesh.position.z = this._tmpAmmoTransform.getOrigin().z();\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = this._tmpAmmoTransform.getRotation().x();\r\n mesh.rotationQuaternion.y = this._tmpAmmoTransform.getRotation().y();\r\n mesh.rotationQuaternion.z = this._tmpAmmoTransform.getRotation().z();\r\n mesh.rotationQuaternion.w = this._tmpAmmoTransform.getRotation().w();\r\n }\r\n };\r\n /**\r\n * Gets the radius of the impostor\r\n * @param impostor impostor to get radius from\r\n * @returns the radius\r\n */\r\n AmmoJSPlugin.prototype.getRadius = function (impostor) {\r\n var exntend = impostor.getObjectExtendSize();\r\n return exntend.x / 2;\r\n };\r\n /**\r\n * Gets the box size of the impostor\r\n * @param impostor impostor to get box size from\r\n * @param result the resulting box size\r\n */\r\n AmmoJSPlugin.prototype.getBoxSizeToRef = function (impostor, result) {\r\n var exntend = impostor.getObjectExtendSize();\r\n result.x = exntend.x;\r\n result.y = exntend.y;\r\n result.z = exntend.z;\r\n };\r\n /**\r\n * Disposes of the impostor\r\n */\r\n AmmoJSPlugin.prototype.dispose = function () {\r\n // Dispose of world\r\n Ammo.destroy(this.world);\r\n Ammo.destroy(this._solver);\r\n Ammo.destroy(this._overlappingPairCache);\r\n Ammo.destroy(this._dispatcher);\r\n Ammo.destroy(this._collisionConfiguration);\r\n // Dispose of tmp variables\r\n Ammo.destroy(this._tmpAmmoVectorA);\r\n Ammo.destroy(this._tmpAmmoVectorB);\r\n Ammo.destroy(this._tmpAmmoVectorC);\r\n Ammo.destroy(this._tmpAmmoTransform);\r\n Ammo.destroy(this._tmpAmmoQuaternion);\r\n Ammo.destroy(this._tmpAmmoConcreteContactResultCallback);\r\n this.world = null;\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n AmmoJSPlugin.prototype.raycast = function (from, to) {\r\n this._tmpAmmoVectorRCA = new this.bjsAMMO.btVector3(from.x, from.y, from.z);\r\n this._tmpAmmoVectorRCB = new this.bjsAMMO.btVector3(to.x, to.y, to.z);\r\n var rayCallback = new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA, this._tmpAmmoVectorRCB);\r\n this.world.rayTest(this._tmpAmmoVectorRCA, this._tmpAmmoVectorRCB, rayCallback);\r\n this._raycastResult.reset(from, to);\r\n if (rayCallback.hasHit()) {\r\n // TODO: do we want/need the body? If so, set all the data\r\n /*\r\n var rigidBody = this.bjsAMMO.btRigidBody.prototype.upcast(\r\n rayCallback.get_m_collisionObject()\r\n );\r\n var body = {};\r\n */\r\n this._raycastResult.setHitData({\r\n x: rayCallback.get_m_hitNormalWorld().x(),\r\n y: rayCallback.get_m_hitNormalWorld().y(),\r\n z: rayCallback.get_m_hitNormalWorld().z(),\r\n }, {\r\n x: rayCallback.get_m_hitPointWorld().x(),\r\n y: rayCallback.get_m_hitPointWorld().y(),\r\n z: rayCallback.get_m_hitPointWorld().z(),\r\n });\r\n this._raycastResult.calculateHitDistance();\r\n }\r\n Ammo.destroy(rayCallback);\r\n Ammo.destroy(this._tmpAmmoVectorRCA);\r\n Ammo.destroy(this._tmpAmmoVectorRCB);\r\n return this._raycastResult;\r\n };\r\n AmmoJSPlugin.DISABLE_COLLISION_FLAG = 4;\r\n AmmoJSPlugin.KINEMATIC_FLAG = 2;\r\n AmmoJSPlugin.DISABLE_DEACTIVATION_FLAG = 4;\r\n return AmmoJSPlugin;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/cannonJSPlugin.ts\":\n/*!*******************************************!*\\\n !*** ./Physics/Plugins/cannonJSPlugin.ts ***!\n \\*******************************************/\n/*! exports provided: CannonJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return CannonJSPlugin; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Physics/physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Physics/physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony import */ var _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../physicsRaycastResult */ \"./Physics/physicsRaycastResult.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar CannonJSPlugin = /** @class */ (function () {\r\n function CannonJSPlugin(_useDeltaForWorldStep, iterations, cannonInjection) {\r\n if (_useDeltaForWorldStep === void 0) { _useDeltaForWorldStep = true; }\r\n if (iterations === void 0) { iterations = 10; }\r\n if (cannonInjection === void 0) { cannonInjection = CANNON; }\r\n this._useDeltaForWorldStep = _useDeltaForWorldStep;\r\n this.name = \"CannonJSPlugin\";\r\n this._physicsMaterials = new Array();\r\n this._fixedTimeStep = 1 / 60;\r\n this._physicsBodysToRemoveAfterStep = new Array();\r\n this._minus90X = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"](-0.7071067811865475, 0, 0, 0.7071067811865475);\r\n this._plus90X = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"](0.7071067811865475, 0, 0, 0.7071067811865475);\r\n this._tmpPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._tmpDeltaPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n this._tmpUnityRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"]();\r\n this.BJSCANNON = cannonInjection;\r\n if (!this.isSupported()) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"CannonJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n this._extendNamespace();\r\n this.world = new this.BJSCANNON.World();\r\n this.world.broadphase = new this.BJSCANNON.NaiveBroadphase();\r\n this.world.solver.iterations = iterations;\r\n this._cannonRaycastResult = new this.BJSCANNON.RaycastResult();\r\n this._raycastResult = new _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_6__[\"PhysicsRaycastResult\"]();\r\n }\r\n CannonJSPlugin.prototype.setGravity = function (gravity) {\r\n this.world.gravity.copy(gravity);\r\n };\r\n CannonJSPlugin.prototype.setTimeStep = function (timeStep) {\r\n this._fixedTimeStep = timeStep;\r\n };\r\n CannonJSPlugin.prototype.getTimeStep = function () {\r\n return this._fixedTimeStep;\r\n };\r\n CannonJSPlugin.prototype.executeStep = function (delta) {\r\n this.world.step(this._fixedTimeStep, this._useDeltaForWorldStep ? delta : 0, 3);\r\n this._removeMarkedPhysicsBodiesFromWorld();\r\n };\r\n CannonJSPlugin.prototype._removeMarkedPhysicsBodiesFromWorld = function () {\r\n var _this = this;\r\n if (this._physicsBodysToRemoveAfterStep.length > 0) {\r\n this._physicsBodysToRemoveAfterStep.forEach(function (physicsBody) {\r\n _this.world.remove(physicsBody);\r\n });\r\n this._physicsBodysToRemoveAfterStep = [];\r\n }\r\n };\r\n CannonJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {\r\n var worldPoint = new this.BJSCANNON.Vec3(contactPoint.x, contactPoint.y, contactPoint.z);\r\n var impulse = new this.BJSCANNON.Vec3(force.x, force.y, force.z);\r\n impostor.physicsBody.applyImpulse(impulse, worldPoint);\r\n };\r\n CannonJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {\r\n var worldPoint = new this.BJSCANNON.Vec3(contactPoint.x, contactPoint.y, contactPoint.z);\r\n var impulse = new this.BJSCANNON.Vec3(force.x, force.y, force.z);\r\n impostor.physicsBody.applyForce(impulse, worldPoint);\r\n };\r\n CannonJSPlugin.prototype.generatePhysicsBody = function (impostor) {\r\n // When calling forceUpdate generatePhysicsBody is called again, ensure that the updated body does not instantly collide with removed body\r\n this._removeMarkedPhysicsBodiesFromWorld();\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n //should a new body be created for this impostor?\r\n if (impostor.isBodyInitRequired()) {\r\n var shape = this._createShape(impostor);\r\n //unregister events, if body is being changed\r\n var oldBody = impostor.physicsBody;\r\n if (oldBody) {\r\n this.removePhysicsBody(impostor);\r\n }\r\n //create the body and material\r\n var material = this._addMaterial(\"mat-\" + impostor.uniqueId, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\"));\r\n var bodyCreationObject = {\r\n mass: impostor.getParam(\"mass\"),\r\n material: material\r\n };\r\n // A simple extend, in case native options were used.\r\n var nativeOptions = impostor.getParam(\"nativeOptions\");\r\n for (var key in nativeOptions) {\r\n if (nativeOptions.hasOwnProperty(key)) {\r\n bodyCreationObject[key] = nativeOptions[key];\r\n }\r\n }\r\n impostor.physicsBody = new this.BJSCANNON.Body(bodyCreationObject);\r\n impostor.physicsBody.addEventListener(\"collide\", impostor.onCollide);\r\n this.world.addEventListener(\"preStep\", impostor.beforeStep);\r\n this.world.addEventListener(\"postStep\", impostor.afterStep);\r\n impostor.physicsBody.addShape(shape);\r\n this.world.add(impostor.physicsBody);\r\n //try to keep the body moving in the right direction by taking old properties.\r\n //Should be tested!\r\n if (oldBody) {\r\n ['force', 'torque', 'velocity', 'angularVelocity'].forEach(function (param) {\r\n impostor.physicsBody[param].copy(oldBody[param]);\r\n });\r\n }\r\n this._processChildMeshes(impostor);\r\n }\r\n //now update the body's transformation\r\n this._updatePhysicsBodyTransformation(impostor);\r\n };\r\n CannonJSPlugin.prototype._processChildMeshes = function (mainImpostor) {\r\n var _this = this;\r\n var meshChildren = mainImpostor.object.getChildMeshes ? mainImpostor.object.getChildMeshes(true) : [];\r\n var currentRotation = mainImpostor.object.rotationQuaternion;\r\n if (meshChildren.length) {\r\n var processMesh = function (localPosition, mesh) {\r\n if (!currentRotation || !mesh.rotationQuaternion) {\r\n return;\r\n }\r\n var childImpostor = mesh.getPhysicsImpostor();\r\n if (childImpostor) {\r\n var parent = childImpostor.parent;\r\n if (parent !== mainImpostor) {\r\n var pPosition = mesh.getAbsolutePosition().subtract(mainImpostor.object.getAbsolutePosition());\r\n var localRotation = mesh.rotationQuaternion.multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Quaternion\"].Inverse(currentRotation));\r\n if (childImpostor.physicsBody) {\r\n _this.removePhysicsBody(childImpostor);\r\n childImpostor.physicsBody = null;\r\n }\r\n childImpostor.parent = mainImpostor;\r\n childImpostor.resetUpdateFlags();\r\n mainImpostor.physicsBody.addShape(_this._createShape(childImpostor), new _this.BJSCANNON.Vec3(pPosition.x, pPosition.y, pPosition.z), new _this.BJSCANNON.Quaternion(localRotation.x, localRotation.y, localRotation.z, localRotation.w));\r\n //Add the mass of the children.\r\n mainImpostor.physicsBody.mass += childImpostor.getParam(\"mass\");\r\n }\r\n }\r\n currentRotation.multiplyInPlace(mesh.rotationQuaternion);\r\n mesh.getChildMeshes(true).filter(function (m) { return !!m.physicsImpostor; }).forEach(processMesh.bind(_this, mesh.getAbsolutePosition()));\r\n };\r\n meshChildren.filter(function (m) { return !!m.physicsImpostor; }).forEach(processMesh.bind(this, mainImpostor.object.getAbsolutePosition()));\r\n }\r\n };\r\n CannonJSPlugin.prototype.removePhysicsBody = function (impostor) {\r\n impostor.physicsBody.removeEventListener(\"collide\", impostor.onCollide);\r\n this.world.removeEventListener(\"preStep\", impostor.beforeStep);\r\n this.world.removeEventListener(\"postStep\", impostor.afterStep);\r\n // Only remove the physics body after the physics step to avoid disrupting cannon's internal state\r\n if (this._physicsBodysToRemoveAfterStep.indexOf(impostor.physicsBody) === -1) {\r\n this._physicsBodysToRemoveAfterStep.push(impostor.physicsBody);\r\n }\r\n };\r\n CannonJSPlugin.prototype.generateJoint = function (impostorJoint) {\r\n var mainBody = impostorJoint.mainImpostor.physicsBody;\r\n var connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n var constraint;\r\n var jointData = impostorJoint.joint.jointData;\r\n //TODO - https://github.com/schteppe/this.BJSCANNON.js/blob/gh-pages/demos/collisionFilter.html\r\n var constraintData = {\r\n pivotA: jointData.mainPivot ? new this.BJSCANNON.Vec3().copy(jointData.mainPivot) : null,\r\n pivotB: jointData.connectedPivot ? new this.BJSCANNON.Vec3().copy(jointData.connectedPivot) : null,\r\n axisA: jointData.mainAxis ? new this.BJSCANNON.Vec3().copy(jointData.mainAxis) : null,\r\n axisB: jointData.connectedAxis ? new this.BJSCANNON.Vec3().copy(jointData.connectedAxis) : null,\r\n maxForce: jointData.nativeParams.maxForce,\r\n collideConnected: !!jointData.collision\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].HingeJoint:\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].Hinge2Joint:\r\n constraint = new this.BJSCANNON.HingeConstraint(mainBody, connectedBody, constraintData);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].DistanceJoint:\r\n constraint = new this.BJSCANNON.DistanceConstraint(mainBody, connectedBody, jointData.maxDistance || 2);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].SpringJoint:\r\n var springData = jointData;\r\n constraint = new this.BJSCANNON.Spring(mainBody, connectedBody, {\r\n restLength: springData.length,\r\n stiffness: springData.stiffness,\r\n damping: springData.damping,\r\n localAnchorA: constraintData.pivotA,\r\n localAnchorB: constraintData.pivotB\r\n });\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].LockJoint:\r\n constraint = new this.BJSCANNON.LockConstraint(mainBody, connectedBody, constraintData);\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].PointToPointJoint:\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].BallAndSocketJoint:\r\n default:\r\n constraint = new this.BJSCANNON.PointToPointConstraint(mainBody, constraintData.pivotA, connectedBody, constraintData.pivotB, constraintData.maxForce);\r\n break;\r\n }\r\n //set the collideConnected flag after the creation, since DistanceJoint ignores it.\r\n constraint.collideConnected = !!jointData.collision;\r\n impostorJoint.joint.physicsJoint = constraint;\r\n //don't add spring as constraint, as it is not one.\r\n if (impostorJoint.joint.type !== _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].SpringJoint) {\r\n this.world.addConstraint(constraint);\r\n }\r\n else {\r\n impostorJoint.joint.jointData.forceApplicationCallback = impostorJoint.joint.jointData.forceApplicationCallback || function () {\r\n constraint.applyForce();\r\n };\r\n impostorJoint.mainImpostor.registerAfterPhysicsStep(impostorJoint.joint.jointData.forceApplicationCallback);\r\n }\r\n };\r\n CannonJSPlugin.prototype.removeJoint = function (impostorJoint) {\r\n if (impostorJoint.joint.type !== _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"].SpringJoint) {\r\n this.world.removeConstraint(impostorJoint.joint.physicsJoint);\r\n }\r\n else {\r\n impostorJoint.mainImpostor.unregisterAfterPhysicsStep(impostorJoint.joint.jointData.forceApplicationCallback);\r\n }\r\n };\r\n CannonJSPlugin.prototype._addMaterial = function (name, friction, restitution) {\r\n var index;\r\n var mat;\r\n for (index = 0; index < this._physicsMaterials.length; index++) {\r\n mat = this._physicsMaterials[index];\r\n if (mat.friction === friction && mat.restitution === restitution) {\r\n return mat;\r\n }\r\n }\r\n var currentMat = new this.BJSCANNON.Material(name);\r\n currentMat.friction = friction;\r\n currentMat.restitution = restitution;\r\n this._physicsMaterials.push(currentMat);\r\n return currentMat;\r\n };\r\n CannonJSPlugin.prototype._checkWithEpsilon = function (value) {\r\n return value < _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"].Epsilon ? _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"].Epsilon : value;\r\n };\r\n CannonJSPlugin.prototype._createShape = function (impostor) {\r\n var object = impostor.object;\r\n var returnValue;\r\n var extendSize = impostor.getObjectExtendSize();\r\n switch (impostor.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].SphereImpostor:\r\n var radiusX = extendSize.x;\r\n var radiusY = extendSize.y;\r\n var radiusZ = extendSize.z;\r\n returnValue = new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(radiusX), this._checkWithEpsilon(radiusY), this._checkWithEpsilon(radiusZ)) / 2);\r\n break;\r\n //TMP also for cylinder - TODO Cannon supports cylinder natively.\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].CylinderImpostor:\r\n var nativeParams = impostor.getParam(\"nativeOptions\");\r\n if (!nativeParams) {\r\n nativeParams = {};\r\n }\r\n var radiusTop = nativeParams.radiusTop !== undefined ? nativeParams.radiusTop : this._checkWithEpsilon(extendSize.x) / 2;\r\n var radiusBottom = nativeParams.radiusBottom !== undefined ? nativeParams.radiusBottom : this._checkWithEpsilon(extendSize.x) / 2;\r\n var height = nativeParams.height !== undefined ? nativeParams.height : this._checkWithEpsilon(extendSize.y);\r\n var numSegments = nativeParams.numSegments !== undefined ? nativeParams.numSegments : 16;\r\n returnValue = new this.BJSCANNON.Cylinder(radiusTop, radiusBottom, height, numSegments);\r\n // Rotate 90 degrees as this shape is horizontal in cannon\r\n var quat = new this.BJSCANNON.Quaternion();\r\n quat.setFromAxisAngle(new this.BJSCANNON.Vec3(1, 0, 0), -Math.PI / 2);\r\n var translation = new this.BJSCANNON.Vec3(0, 0, 0);\r\n returnValue.transformAllPoints(translation, quat);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].BoxImpostor:\r\n var box = extendSize.scale(0.5);\r\n returnValue = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(box.x), this._checkWithEpsilon(box.y), this._checkWithEpsilon(box.z)));\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].PlaneImpostor:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead\");\r\n returnValue = new this.BJSCANNON.Plane();\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].MeshImpostor:\r\n // should transform the vertex data to world coordinates!!\r\n var rawVerts = object.getVerticesData ? object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind) : [];\r\n var rawFaces = object.getIndices ? object.getIndices() : [];\r\n if (!rawVerts) {\r\n return;\r\n }\r\n // get only scale! so the object could transform correctly.\r\n var oldPosition = object.position.clone();\r\n var oldRotation = object.rotation && object.rotation.clone();\r\n var oldQuaternion = object.rotationQuaternion && object.rotationQuaternion.clone();\r\n object.position.copyFromFloats(0, 0, 0);\r\n object.rotation && object.rotation.copyFromFloats(0, 0, 0);\r\n object.rotationQuaternion && object.rotationQuaternion.copyFrom(impostor.getParentsRotation());\r\n object.rotationQuaternion && object.parent && object.rotationQuaternion.conjugateInPlace();\r\n var transform = object.computeWorldMatrix(true);\r\n // convert rawVerts to object space\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < rawVerts.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(rawVerts, index), transform).toArray(temp, index);\r\n }\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"MeshImpostor only collides against spheres.\");\r\n returnValue = new this.BJSCANNON.Trimesh(temp, rawFaces);\r\n //now set back the transformation!\r\n object.position.copyFrom(oldPosition);\r\n oldRotation && object.rotation && object.rotation.copyFrom(oldRotation);\r\n oldQuaternion && object.rotationQuaternion && object.rotationQuaternion.copyFrom(oldQuaternion);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].HeightmapImpostor:\r\n var oldPosition2 = object.position.clone();\r\n var oldRotation2 = object.rotation && object.rotation.clone();\r\n var oldQuaternion2 = object.rotationQuaternion && object.rotationQuaternion.clone();\r\n object.position.copyFromFloats(0, 0, 0);\r\n object.rotation && object.rotation.copyFromFloats(0, 0, 0);\r\n object.rotationQuaternion && object.rotationQuaternion.copyFrom(impostor.getParentsRotation());\r\n object.rotationQuaternion && object.parent && object.rotationQuaternion.conjugateInPlace();\r\n object.rotationQuaternion && object.rotationQuaternion.multiplyInPlace(this._minus90X);\r\n returnValue = this._createHeightmap(object);\r\n object.position.copyFrom(oldPosition2);\r\n oldRotation2 && object.rotation && object.rotation.copyFrom(oldRotation2);\r\n oldQuaternion2 && object.rotationQuaternion && object.rotationQuaternion.copyFrom(oldQuaternion2);\r\n object.computeWorldMatrix(true);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].ParticleImpostor:\r\n returnValue = new this.BJSCANNON.Particle();\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].NoImpostor:\r\n returnValue = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(0, 0, 0));\r\n break;\r\n }\r\n return returnValue;\r\n };\r\n CannonJSPlugin.prototype._createHeightmap = function (object, pointDepth) {\r\n var pos = (object.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind));\r\n var transform = object.computeWorldMatrix(true);\r\n // convert rawVerts to object space\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < pos.length; index += 3) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].TransformCoordinates(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].FromArray(pos, index), transform).toArray(temp, index);\r\n }\r\n pos = temp;\r\n var matrix = new Array();\r\n //For now pointDepth will not be used and will be automatically calculated.\r\n //Future reference - try and find the best place to add a reference to the pointDepth variable.\r\n var arraySize = pointDepth || ~~(Math.sqrt(pos.length / 3) - 1);\r\n var boundingInfo = object.getBoundingInfo();\r\n var dim = Math.min(boundingInfo.boundingBox.extendSizeWorld.x, boundingInfo.boundingBox.extendSizeWorld.y);\r\n var minY = boundingInfo.boundingBox.extendSizeWorld.z;\r\n var elementSize = dim * 2 / arraySize;\r\n for (var i = 0; i < pos.length; i = i + 3) {\r\n var x = Math.round((pos[i + 0]) / elementSize + arraySize / 2);\r\n var z = Math.round(((pos[i + 1]) / elementSize - arraySize / 2) * -1);\r\n var y = -pos[i + 2] + minY;\r\n if (!matrix[x]) {\r\n matrix[x] = [];\r\n }\r\n if (!matrix[x][z]) {\r\n matrix[x][z] = y;\r\n }\r\n matrix[x][z] = Math.max(y, matrix[x][z]);\r\n }\r\n for (var x = 0; x <= arraySize; ++x) {\r\n if (!matrix[x]) {\r\n var loc = 1;\r\n while (!matrix[(x + loc) % arraySize]) {\r\n loc++;\r\n }\r\n matrix[x] = matrix[(x + loc) % arraySize].slice();\r\n //console.log(\"missing x\", x);\r\n }\r\n for (var z = 0; z <= arraySize; ++z) {\r\n if (!matrix[x][z]) {\r\n var loc = 1;\r\n var newValue;\r\n while (newValue === undefined) {\r\n newValue = matrix[x][(z + loc++) % arraySize];\r\n }\r\n matrix[x][z] = newValue;\r\n }\r\n }\r\n }\r\n var shape = new this.BJSCANNON.Heightfield(matrix, {\r\n elementSize: elementSize\r\n });\r\n //For future reference, needed for body transformation\r\n shape.minY = minY;\r\n return shape;\r\n };\r\n CannonJSPlugin.prototype._updatePhysicsBodyTransformation = function (impostor) {\r\n var object = impostor.object;\r\n //make sure it is updated...\r\n object.computeWorldMatrix && object.computeWorldMatrix(true);\r\n // The delta between the mesh position and the mesh bounding box center\r\n var bInfo = object.getBoundingInfo();\r\n if (!bInfo) {\r\n return;\r\n }\r\n var center = impostor.getObjectCenter();\r\n //m.getAbsolutePosition().subtract(m.getBoundingInfo().boundingBox.centerWorld)\r\n this._tmpDeltaPosition.copyFrom(object.getAbsolutePivotPoint().subtract(center));\r\n this._tmpDeltaPosition.divideInPlace(impostor.object.scaling);\r\n this._tmpPosition.copyFrom(center);\r\n var quaternion = object.rotationQuaternion;\r\n if (!quaternion) {\r\n return;\r\n }\r\n //is shape is a plane or a heightmap, it must be rotated 90 degs in the X axis.\r\n //ideally these would be rotated at time of creation like cylinder but they dont extend ConvexPolyhedron\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].PlaneImpostor || impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].HeightmapImpostor) {\r\n //-90 DEG in X, precalculated\r\n quaternion = quaternion.multiply(this._minus90X);\r\n //Invert! (Precalculated, 90 deg in X)\r\n //No need to clone. this will never change.\r\n impostor.setDeltaRotation(this._plus90X);\r\n }\r\n //If it is a heightfield, if should be centered.\r\n if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].HeightmapImpostor) {\r\n var mesh = object;\r\n var boundingInfo = mesh.getBoundingInfo();\r\n //calculate the correct body position:\r\n var rotationQuaternion = mesh.rotationQuaternion;\r\n mesh.rotationQuaternion = this._tmpUnityRotation;\r\n mesh.computeWorldMatrix(true);\r\n //get original center with no rotation\r\n var c = center.clone();\r\n var oldPivot = mesh.getPivotMatrix();\r\n if (oldPivot) {\r\n // create a copy the pivot Matrix as it is modified in place\r\n oldPivot = oldPivot.clone();\r\n }\r\n else {\r\n oldPivot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n //calculate the new center using a pivot (since this.BJSCANNON.js doesn't center height maps)\r\n var p = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Translation(boundingInfo.boundingBox.extendSizeWorld.x, 0, -boundingInfo.boundingBox.extendSizeWorld.z);\r\n mesh.setPreTransformMatrix(p);\r\n mesh.computeWorldMatrix(true);\r\n //calculate the translation\r\n var translation = boundingInfo.boundingBox.centerWorld.subtract(center).subtract(mesh.position).negate();\r\n this._tmpPosition.copyFromFloats(translation.x, translation.y - boundingInfo.boundingBox.extendSizeWorld.y, translation.z);\r\n //add it inverted to the delta\r\n this._tmpDeltaPosition.copyFrom(boundingInfo.boundingBox.centerWorld.subtract(c));\r\n this._tmpDeltaPosition.y += boundingInfo.boundingBox.extendSizeWorld.y;\r\n //rotation is back\r\n mesh.rotationQuaternion = rotationQuaternion;\r\n mesh.setPreTransformMatrix(oldPivot);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n else if (impostor.type === _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"].MeshImpostor) {\r\n this._tmpDeltaPosition.copyFromFloats(0, 0, 0);\r\n //this._tmpPosition.copyFrom(object.position);\r\n }\r\n impostor.setDeltaPosition(this._tmpDeltaPosition);\r\n //Now update the impostor object\r\n impostor.physicsBody.position.copy(this._tmpPosition);\r\n impostor.physicsBody.quaternion.copy(quaternion);\r\n };\r\n CannonJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {\r\n impostor.object.position.copyFrom(impostor.physicsBody.position);\r\n if (impostor.object.rotationQuaternion) {\r\n impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.quaternion);\r\n }\r\n };\r\n CannonJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {\r\n impostor.physicsBody.position.copy(newPosition);\r\n impostor.physicsBody.quaternion.copy(newRotation);\r\n };\r\n CannonJSPlugin.prototype.isSupported = function () {\r\n return this.BJSCANNON !== undefined;\r\n };\r\n CannonJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.velocity.copy(velocity);\r\n };\r\n CannonJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.angularVelocity.copy(velocity);\r\n };\r\n CannonJSPlugin.prototype.getLinearVelocity = function (impostor) {\r\n var v = impostor.physicsBody.velocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n CannonJSPlugin.prototype.getAngularVelocity = function (impostor) {\r\n var v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n CannonJSPlugin.prototype.setBodyMass = function (impostor, mass) {\r\n impostor.physicsBody.mass = mass;\r\n impostor.physicsBody.updateMassProperties();\r\n };\r\n CannonJSPlugin.prototype.getBodyMass = function (impostor) {\r\n return impostor.physicsBody.mass;\r\n };\r\n CannonJSPlugin.prototype.getBodyFriction = function (impostor) {\r\n return impostor.physicsBody.material.friction;\r\n };\r\n CannonJSPlugin.prototype.setBodyFriction = function (impostor, friction) {\r\n impostor.physicsBody.material.friction = friction;\r\n };\r\n CannonJSPlugin.prototype.getBodyRestitution = function (impostor) {\r\n return impostor.physicsBody.material.restitution;\r\n };\r\n CannonJSPlugin.prototype.setBodyRestitution = function (impostor, restitution) {\r\n impostor.physicsBody.material.restitution = restitution;\r\n };\r\n CannonJSPlugin.prototype.sleepBody = function (impostor) {\r\n impostor.physicsBody.sleep();\r\n };\r\n CannonJSPlugin.prototype.wakeUpBody = function (impostor) {\r\n impostor.physicsBody.wakeUp();\r\n };\r\n CannonJSPlugin.prototype.updateDistanceJoint = function (joint, maxDistance) {\r\n joint.physicsJoint.distance = maxDistance;\r\n };\r\n // private enableMotor(joint: IMotorEnabledJoint, motorIndex?: number) {\r\n // if (!motorIndex) {\r\n // joint.physicsJoint.enableMotor();\r\n // }\r\n // }\r\n // private disableMotor(joint: IMotorEnabledJoint, motorIndex?: number) {\r\n // if (!motorIndex) {\r\n // joint.physicsJoint.disableMotor();\r\n // }\r\n // }\r\n CannonJSPlugin.prototype.setMotor = function (joint, speed, maxForce, motorIndex) {\r\n if (!motorIndex) {\r\n joint.physicsJoint.enableMotor();\r\n joint.physicsJoint.setMotorSpeed(speed);\r\n if (maxForce) {\r\n this.setLimit(joint, maxForce);\r\n }\r\n }\r\n };\r\n CannonJSPlugin.prototype.setLimit = function (joint, upperLimit, lowerLimit) {\r\n joint.physicsJoint.motorEquation.maxForce = upperLimit;\r\n joint.physicsJoint.motorEquation.minForce = lowerLimit === void 0 ? -upperLimit : lowerLimit;\r\n };\r\n CannonJSPlugin.prototype.syncMeshWithImpostor = function (mesh, impostor) {\r\n var body = impostor.physicsBody;\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.quaternion.x;\r\n mesh.rotationQuaternion.y = body.quaternion.y;\r\n mesh.rotationQuaternion.z = body.quaternion.z;\r\n mesh.rotationQuaternion.w = body.quaternion.w;\r\n }\r\n };\r\n CannonJSPlugin.prototype.getRadius = function (impostor) {\r\n var shape = impostor.physicsBody.shapes[0];\r\n return shape.boundingSphereRadius;\r\n };\r\n CannonJSPlugin.prototype.getBoxSizeToRef = function (impostor, result) {\r\n var shape = impostor.physicsBody.shapes[0];\r\n result.x = shape.halfExtents.x * 2;\r\n result.y = shape.halfExtents.y * 2;\r\n result.z = shape.halfExtents.z * 2;\r\n };\r\n CannonJSPlugin.prototype.dispose = function () {\r\n };\r\n CannonJSPlugin.prototype._extendNamespace = function () {\r\n //this will force cannon to execute at least one step when using interpolation\r\n var step_tmp1 = new this.BJSCANNON.Vec3();\r\n var Engine = this.BJSCANNON;\r\n this.BJSCANNON.World.prototype.step = function (dt, timeSinceLastCalled, maxSubSteps) {\r\n maxSubSteps = maxSubSteps || 10;\r\n timeSinceLastCalled = timeSinceLastCalled || 0;\r\n if (timeSinceLastCalled === 0) {\r\n this.internalStep(dt);\r\n this.time += dt;\r\n }\r\n else {\r\n var internalSteps = Math.floor((this.time + timeSinceLastCalled) / dt) - Math.floor(this.time / dt);\r\n internalSteps = Math.min(internalSteps, maxSubSteps) || 1;\r\n var t0 = performance.now();\r\n for (var i = 0; i !== internalSteps; i++) {\r\n this.internalStep(dt);\r\n if (performance.now() - t0 > dt * 1000) {\r\n break;\r\n }\r\n }\r\n this.time += timeSinceLastCalled;\r\n var h = this.time % dt;\r\n var h_div_dt = h / dt;\r\n var interpvelo = step_tmp1;\r\n var bodies = this.bodies;\r\n for (var j = 0; j !== bodies.length; j++) {\r\n var b = bodies[j];\r\n if (b.type !== Engine.Body.STATIC && b.sleepState !== Engine.Body.SLEEPING) {\r\n b.position.vsub(b.previousPosition, interpvelo);\r\n interpvelo.scale(h_div_dt, interpvelo);\r\n b.position.vadd(interpvelo, b.interpolatedPosition);\r\n }\r\n else {\r\n b.interpolatedPosition.copy(b.position);\r\n b.interpolatedQuaternion.copy(b.quaternion);\r\n }\r\n }\r\n }\r\n };\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n CannonJSPlugin.prototype.raycast = function (from, to) {\r\n this._cannonRaycastResult.reset();\r\n this.world.raycastClosest(from, to, {}, this._cannonRaycastResult);\r\n this._raycastResult.reset(from, to);\r\n if (this._cannonRaycastResult.hasHit) {\r\n // TODO: do we also want to get the body it hit?\r\n this._raycastResult.setHitData({\r\n x: this._cannonRaycastResult.hitNormalWorld.x,\r\n y: this._cannonRaycastResult.hitNormalWorld.y,\r\n z: this._cannonRaycastResult.hitNormalWorld.z,\r\n }, {\r\n x: this._cannonRaycastResult.hitPointWorld.x,\r\n y: this._cannonRaycastResult.hitPointWorld.y,\r\n z: this._cannonRaycastResult.hitPointWorld.z,\r\n });\r\n this._raycastResult.setHitDistance(this._cannonRaycastResult.distance);\r\n }\r\n return this._raycastResult;\r\n };\r\n return CannonJSPlugin;\r\n}());\r\n\r\n_Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"].DefaultPluginFactory = function () { return new CannonJSPlugin(); };\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/index.ts\":\n/*!**********************************!*\\\n !*** ./Physics/Plugins/index.ts ***!\n \\**********************************/\n/*! exports provided: CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _cannonJSPlugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cannonJSPlugin */ \"./Physics/Plugins/cannonJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _cannonJSPlugin__WEBPACK_IMPORTED_MODULE_0__[\"CannonJSPlugin\"]; });\n\n/* harmony import */ var _ammoJSPlugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ammoJSPlugin */ \"./Physics/Plugins/ammoJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _ammoJSPlugin__WEBPACK_IMPORTED_MODULE_1__[\"AmmoJSPlugin\"]; });\n\n/* harmony import */ var _oimoJSPlugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./oimoJSPlugin */ \"./Physics/Plugins/oimoJSPlugin.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _oimoJSPlugin__WEBPACK_IMPORTED_MODULE_2__[\"OimoJSPlugin\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/Plugins/oimoJSPlugin.ts\":\n/*!*****************************************!*\\\n !*** ./Physics/Plugins/oimoJSPlugin.ts ***!\n \\*****************************************/\n/*! exports provided: OimoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return OimoJSPlugin; });\n/* harmony import */ var _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Physics/physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony import */ var _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Physics/physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Physics/physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../physicsRaycastResult */ \"./Physics/physicsRaycastResult.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/** @hidden */\r\nvar OimoJSPlugin = /** @class */ (function () {\r\n function OimoJSPlugin(iterations, oimoInjection) {\r\n if (oimoInjection === void 0) { oimoInjection = OIMO; }\r\n this.name = \"OimoJSPlugin\";\r\n this._tmpImpostorsArray = [];\r\n this._tmpPositionVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this.BJSOIMO = oimoInjection;\r\n this.world = new this.BJSOIMO.World({\r\n iterations: iterations\r\n });\r\n this.world.clear();\r\n this._raycastResult = new _physicsRaycastResult__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsRaycastResult\"]();\r\n }\r\n OimoJSPlugin.prototype.setGravity = function (gravity) {\r\n this.world.gravity.copy(gravity);\r\n };\r\n OimoJSPlugin.prototype.setTimeStep = function (timeStep) {\r\n this.world.timeStep = timeStep;\r\n };\r\n OimoJSPlugin.prototype.getTimeStep = function () {\r\n return this.world.timeStep;\r\n };\r\n OimoJSPlugin.prototype.executeStep = function (delta, impostors) {\r\n var _this = this;\r\n impostors.forEach(function (impostor) {\r\n impostor.beforeStep();\r\n });\r\n this.world.step();\r\n impostors.forEach(function (impostor) {\r\n impostor.afterStep();\r\n //update the ordered impostors array\r\n _this._tmpImpostorsArray[impostor.uniqueId] = impostor;\r\n });\r\n //check for collisions\r\n var contact = this.world.contacts;\r\n while (contact !== null) {\r\n if (contact.touching && !contact.body1.sleeping && !contact.body2.sleeping) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n //is this body colliding with any other? get the impostor\r\n var mainImpostor = this._tmpImpostorsArray[+contact.body1.name];\r\n var collidingImpostor = this._tmpImpostorsArray[+contact.body2.name];\r\n if (!mainImpostor || !collidingImpostor) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n mainImpostor.onCollide({ body: collidingImpostor.physicsBody });\r\n collidingImpostor.onCollide({ body: mainImpostor.physicsBody });\r\n contact = contact.next;\r\n }\r\n };\r\n OimoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {\r\n var mass = impostor.physicsBody.mass;\r\n impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));\r\n };\r\n OimoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"Oimo doesn't support applying force. Using impule instead.\");\r\n this.applyImpulse(impostor, force, contactPoint);\r\n };\r\n OimoJSPlugin.prototype.generatePhysicsBody = function (impostor) {\r\n var _this = this;\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n if (impostor.isBodyInitRequired()) {\r\n var bodyConfig = {\r\n name: impostor.uniqueId,\r\n //Oimo must have mass, also for static objects.\r\n config: [impostor.getParam(\"mass\") || 1, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\")],\r\n size: [],\r\n type: [],\r\n pos: [],\r\n posShape: [],\r\n rot: [],\r\n rotShape: [],\r\n move: impostor.getParam(\"mass\") !== 0,\r\n density: impostor.getParam(\"mass\"),\r\n friction: impostor.getParam(\"friction\"),\r\n restitution: impostor.getParam(\"restitution\"),\r\n //Supporting older versions of Oimo\r\n world: this.world\r\n };\r\n var impostors = [impostor];\r\n var addToArray = function (parent) {\r\n if (!parent.getChildMeshes) {\r\n return;\r\n }\r\n parent.getChildMeshes().forEach(function (m) {\r\n if (m.physicsImpostor) {\r\n impostors.push(m.physicsImpostor);\r\n //m.physicsImpostor._init();\r\n }\r\n });\r\n };\r\n addToArray(impostor.object);\r\n var checkWithEpsilon_1 = function (value) {\r\n return Math.max(value, _Physics_physicsEngine__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsEngine\"].Epsilon);\r\n };\r\n var globalQuaternion_1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Quaternion\"]();\r\n impostors.forEach(function (i) {\r\n if (!i.object.rotationQuaternion) {\r\n return;\r\n }\r\n //get the correct bounding box\r\n var oldQuaternion = i.object.rotationQuaternion;\r\n globalQuaternion_1 = oldQuaternion.clone();\r\n var rot = oldQuaternion.toEulerAngles();\r\n var extendSize = i.getObjectExtendSize();\r\n var radToDeg = 57.295779513082320876;\r\n if (i === impostor) {\r\n var center = impostor.getObjectCenter();\r\n impostor.object.getAbsolutePivotPoint().subtractToRef(center, _this._tmpPositionVector);\r\n _this._tmpPositionVector.divideInPlace(impostor.object.scaling);\r\n //Can also use Array.prototype.push.apply\r\n bodyConfig.pos.push(center.x);\r\n bodyConfig.pos.push(center.y);\r\n bodyConfig.pos.push(center.z);\r\n bodyConfig.posShape.push(0, 0, 0);\r\n bodyConfig.rotShape.push(0, 0, 0);\r\n }\r\n else {\r\n var localPosition = i.object.getAbsolutePosition().subtract(impostor.object.getAbsolutePosition());\r\n bodyConfig.posShape.push(localPosition.x);\r\n bodyConfig.posShape.push(localPosition.y);\r\n bodyConfig.posShape.push(localPosition.z);\r\n bodyConfig.pos.push(0, 0, 0);\r\n bodyConfig.rotShape.push(rot.x * radToDeg);\r\n bodyConfig.rotShape.push(rot.y * radToDeg);\r\n bodyConfig.rotShape.push(rot.z * radToDeg);\r\n }\r\n // register mesh\r\n switch (i.type) {\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].ParticleImpostor:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"No Particle support in OIMO.js. using SphereImpostor instead\");\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].SphereImpostor:\r\n var radiusX = extendSize.x;\r\n var radiusY = extendSize.y;\r\n var radiusZ = extendSize.z;\r\n var size = Math.max(checkWithEpsilon_1(radiusX), checkWithEpsilon_1(radiusY), checkWithEpsilon_1(radiusZ)) / 2;\r\n bodyConfig.type.push('sphere');\r\n //due to the way oimo works with compounds, add 3 times\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].CylinderImpostor:\r\n var sizeX = checkWithEpsilon_1(extendSize.x) / 2;\r\n var sizeY = checkWithEpsilon_1(extendSize.y);\r\n bodyConfig.type.push('cylinder');\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n //due to the way oimo works with compounds, add one more value.\r\n bodyConfig.size.push(sizeY);\r\n break;\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].PlaneImpostor:\r\n case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsImpostor\"].BoxImpostor:\r\n default:\r\n var sizeX = checkWithEpsilon_1(extendSize.x);\r\n var sizeY = checkWithEpsilon_1(extendSize.y);\r\n var sizeZ = checkWithEpsilon_1(extendSize.z);\r\n bodyConfig.type.push('box');\r\n //if (i === impostor) {\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n bodyConfig.size.push(sizeZ);\r\n //} else {\r\n // bodyConfig.size.push(0,0,0);\r\n //}\r\n break;\r\n }\r\n //actually not needed, but hey...\r\n i.object.rotationQuaternion = oldQuaternion;\r\n });\r\n impostor.physicsBody = this.world.add(bodyConfig);\r\n // set the quaternion, ignoring the previously defined (euler) rotation\r\n impostor.physicsBody.resetQuaternion(globalQuaternion_1);\r\n // update with delta 0, so the body will reveive the new rotation.\r\n impostor.physicsBody.updatePosition(0);\r\n }\r\n else {\r\n this._tmpPositionVector.copyFromFloats(0, 0, 0);\r\n }\r\n impostor.setDeltaPosition(this._tmpPositionVector);\r\n //this._tmpPositionVector.addInPlace(impostor.mesh.getBoundingInfo().boundingBox.center);\r\n //this.setPhysicsBodyTransformation(impostor, this._tmpPositionVector, impostor.mesh.rotationQuaternion);\r\n };\r\n OimoJSPlugin.prototype.removePhysicsBody = function (impostor) {\r\n //impostor.physicsBody.dispose();\r\n //Same as : (older oimo versions)\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n };\r\n OimoJSPlugin.prototype.generateJoint = function (impostorJoint) {\r\n var mainBody = impostorJoint.mainImpostor.physicsBody;\r\n var connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n var jointData = impostorJoint.joint.jointData;\r\n var options = jointData.nativeParams || {};\r\n var type;\r\n var nativeJointData = {\r\n body1: mainBody,\r\n body2: connectedBody,\r\n axe1: options.axe1 || (jointData.mainAxis ? jointData.mainAxis.asArray() : null),\r\n axe2: options.axe2 || (jointData.connectedAxis ? jointData.connectedAxis.asArray() : null),\r\n pos1: options.pos1 || (jointData.mainPivot ? jointData.mainPivot.asArray() : null),\r\n pos2: options.pos2 || (jointData.connectedPivot ? jointData.connectedPivot.asArray() : null),\r\n min: options.min,\r\n max: options.max,\r\n collision: options.collision || jointData.collision,\r\n spring: options.spring,\r\n //supporting older version of Oimo\r\n world: this.world\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].BallAndSocketJoint:\r\n type = \"jointBall\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].SpringJoint:\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead\");\r\n var springData = jointData;\r\n nativeJointData.min = springData.length || nativeJointData.min;\r\n //Max should also be set, just make sure it is at least min\r\n nativeJointData.max = Math.max(nativeJointData.min, nativeJointData.max);\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].DistanceJoint:\r\n type = \"jointDistance\";\r\n nativeJointData.max = jointData.maxDistance;\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].PrismaticJoint:\r\n type = \"jointPrisme\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].SliderJoint:\r\n type = \"jointSlide\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].WheelJoint:\r\n type = \"jointWheel\";\r\n break;\r\n case _Physics_physicsJoint__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsJoint\"].HingeJoint:\r\n default:\r\n type = \"jointHinge\";\r\n break;\r\n }\r\n nativeJointData.type = type;\r\n impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);\r\n };\r\n OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {\r\n //Bug in Oimo prevents us from disposing a joint in the playground\r\n //joint.joint.physicsJoint.dispose();\r\n //So we will bruteforce it!\r\n try {\r\n this.world.removeJoint(impostorJoint.joint.physicsJoint);\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(e);\r\n }\r\n };\r\n OimoJSPlugin.prototype.isSupported = function () {\r\n return this.BJSOIMO !== undefined;\r\n };\r\n OimoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {\r\n if (!impostor.physicsBody.sleeping) {\r\n //TODO check that\r\n /*if (impostor.physicsBody.shapes.next) {\r\n var parentShape = this._getLastShape(impostor.physicsBody);\r\n impostor.object.position.copyFrom(parentShape.position);\r\n console.log(parentShape.position);\r\n } else {*/\r\n impostor.object.position.copyFrom(impostor.physicsBody.getPosition());\r\n //}\r\n if (impostor.object.rotationQuaternion) {\r\n impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.getQuaternion());\r\n }\r\n }\r\n };\r\n OimoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {\r\n var body = impostor.physicsBody;\r\n body.position.copy(newPosition);\r\n body.orientation.copy(newRotation);\r\n body.syncShapes();\r\n body.awake();\r\n };\r\n /*private _getLastShape(body: any): any {\r\n var lastShape = body.shapes;\r\n while (lastShape.next) {\r\n lastShape = lastShape.next;\r\n }\r\n return lastShape;\r\n }*/\r\n OimoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.linearVelocity.copy(velocity);\r\n };\r\n OimoJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {\r\n impostor.physicsBody.angularVelocity.copy(velocity);\r\n };\r\n OimoJSPlugin.prototype.getLinearVelocity = function (impostor) {\r\n var v = impostor.physicsBody.linearVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n OimoJSPlugin.prototype.getAngularVelocity = function (impostor) {\r\n var v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](v.x, v.y, v.z);\r\n };\r\n OimoJSPlugin.prototype.setBodyMass = function (impostor, mass) {\r\n var staticBody = mass === 0;\r\n //this will actually set the body's density and not its mass.\r\n //But this is how oimo treats the mass variable.\r\n impostor.physicsBody.shapes.density = staticBody ? 1 : mass;\r\n impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);\r\n };\r\n OimoJSPlugin.prototype.getBodyMass = function (impostor) {\r\n return impostor.physicsBody.shapes.density;\r\n };\r\n OimoJSPlugin.prototype.getBodyFriction = function (impostor) {\r\n return impostor.physicsBody.shapes.friction;\r\n };\r\n OimoJSPlugin.prototype.setBodyFriction = function (impostor, friction) {\r\n impostor.physicsBody.shapes.friction = friction;\r\n };\r\n OimoJSPlugin.prototype.getBodyRestitution = function (impostor) {\r\n return impostor.physicsBody.shapes.restitution;\r\n };\r\n OimoJSPlugin.prototype.setBodyRestitution = function (impostor, restitution) {\r\n impostor.physicsBody.shapes.restitution = restitution;\r\n };\r\n OimoJSPlugin.prototype.sleepBody = function (impostor) {\r\n impostor.physicsBody.sleep();\r\n };\r\n OimoJSPlugin.prototype.wakeUpBody = function (impostor) {\r\n impostor.physicsBody.awake();\r\n };\r\n OimoJSPlugin.prototype.updateDistanceJoint = function (joint, maxDistance, minDistance) {\r\n joint.physicsJoint.limitMotor.upperLimit = maxDistance;\r\n if (minDistance !== void 0) {\r\n joint.physicsJoint.limitMotor.lowerLimit = minDistance;\r\n }\r\n };\r\n OimoJSPlugin.prototype.setMotor = function (joint, speed, force, motorIndex) {\r\n if (force !== undefined) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"OimoJS plugin currently has unexpected behavior when using setMotor with force parameter\");\r\n }\r\n else {\r\n force = 1e6;\r\n }\r\n speed *= -1;\r\n //TODO separate rotational and transational motors.\r\n var motor = motorIndex ? joint.physicsJoint.rotationalLimitMotor2 : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setMotor(speed, force);\r\n }\r\n };\r\n OimoJSPlugin.prototype.setLimit = function (joint, upperLimit, lowerLimit, motorIndex) {\r\n //TODO separate rotational and transational motors.\r\n var motor = motorIndex ? joint.physicsJoint.rotationalLimitMotor2 : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setLimit(upperLimit, lowerLimit === void 0 ? -upperLimit : lowerLimit);\r\n }\r\n };\r\n OimoJSPlugin.prototype.syncMeshWithImpostor = function (mesh, impostor) {\r\n var body = impostor.physicsBody;\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.orientation.x;\r\n mesh.rotationQuaternion.y = body.orientation.y;\r\n mesh.rotationQuaternion.z = body.orientation.z;\r\n mesh.rotationQuaternion.w = body.orientation.s;\r\n }\r\n };\r\n OimoJSPlugin.prototype.getRadius = function (impostor) {\r\n return impostor.physicsBody.shapes.radius;\r\n };\r\n OimoJSPlugin.prototype.getBoxSizeToRef = function (impostor, result) {\r\n var shape = impostor.physicsBody.shapes;\r\n result.x = shape.halfWidth * 2;\r\n result.y = shape.halfHeight * 2;\r\n result.z = shape.halfDepth * 2;\r\n };\r\n OimoJSPlugin.prototype.dispose = function () {\r\n this.world.clear();\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n OimoJSPlugin.prototype.raycast = function (from, to) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_4__[\"Logger\"].Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n this._raycastResult.reset(from, to);\r\n return this._raycastResult;\r\n };\r\n return OimoJSPlugin;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/index.ts\":\n/*!**************************!*\\\n !*** ./Physics/index.ts ***!\n \\**************************/\n/*! exports provided: PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _physicsEngine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return _physicsEngine__WEBPACK_IMPORTED_MODULE_0__[\"PhysicsEngine\"]; });\n\n/* harmony import */ var _physicsEngineComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./physicsEngineComponent */ \"./Physics/physicsEngineComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return _physicsEngineComponent__WEBPACK_IMPORTED_MODULE_1__[\"PhysicsEngineSceneComponent\"]; });\n\n/* harmony import */ var _physicsHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./physicsHelper */ \"./Physics/physicsHelper.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsRadialExplosionEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsUpdraftEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsVortexEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsRadialImpulseFalloff\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return _physicsHelper__WEBPACK_IMPORTED_MODULE_2__[\"PhysicsUpdraftMode\"]; });\n\n/* harmony import */ var _physicsImpostor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./physicsImpostor */ \"./Physics/physicsImpostor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return _physicsImpostor__WEBPACK_IMPORTED_MODULE_3__[\"PhysicsImpostor\"]; });\n\n/* harmony import */ var _physicsJoint__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"PhysicsJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"DistanceJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"MotorEnabledJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"HingeJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return _physicsJoint__WEBPACK_IMPORTED_MODULE_4__[\"Hinge2Joint\"]; });\n\n/* harmony import */ var _Plugins_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Plugins/index */ \"./Physics/Plugins/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_5__[\"CannonJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_5__[\"AmmoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _Plugins_index__WEBPACK_IMPORTED_MODULE_5__[\"OimoJSPlugin\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsEngine.ts\":\n/*!**********************************!*\\\n !*** ./Physics/physicsEngine.ts ***!\n \\**********************************/\n/*! exports provided: PhysicsEngine */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return PhysicsEngine; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n/**\r\n * Class used to control physics engine\r\n * @see http://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsEngine = /** @class */ (function () {\r\n /**\r\n * Creates a new Physics Engine\r\n * @param gravity defines the gravity vector used by the simulation\r\n * @param _physicsPlugin defines the plugin to use (CannonJS by default)\r\n */\r\n function PhysicsEngine(gravity, _physicsPlugin) {\r\n if (_physicsPlugin === void 0) { _physicsPlugin = PhysicsEngine.DefaultPluginFactory(); }\r\n this._physicsPlugin = _physicsPlugin;\r\n this._impostors = [];\r\n this._joints = [];\r\n if (!this._physicsPlugin.isSupported()) {\r\n throw new Error(\"Physics Engine \" + this._physicsPlugin.name + \" cannot be found. \"\r\n + \"Please make sure it is included.\");\r\n }\r\n gravity = gravity || new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](0, -9.807, 0);\r\n this.setGravity(gravity);\r\n this.setTimeStep();\r\n }\r\n /**\r\n * Factory used to create the default physics plugin.\r\n * @returns The default physics plugin\r\n */\r\n PhysicsEngine.DefaultPluginFactory = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_1__[\"_DevTools\"].WarnImport(\"CannonJSPlugin\");\r\n };\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n PhysicsEngine.prototype.setGravity = function (gravity) {\r\n this.gravity = gravity;\r\n this._physicsPlugin.setGravity(this.gravity);\r\n };\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * @param newTimeStep defines the new timestep to apply to this world.\r\n */\r\n PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {\r\n if (newTimeStep === void 0) { newTimeStep = 1 / 60; }\r\n this._physicsPlugin.setTimeStep(newTimeStep);\r\n };\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n PhysicsEngine.prototype.getTimeStep = function () {\r\n return this._physicsPlugin.getTimeStep();\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n PhysicsEngine.prototype.dispose = function () {\r\n this._impostors.forEach(function (impostor) {\r\n impostor.dispose();\r\n });\r\n this._physicsPlugin.dispose();\r\n };\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n PhysicsEngine.prototype.getPhysicsPluginName = function () {\r\n return this._physicsPlugin.name;\r\n };\r\n /**\r\n * Adding a new impostor for the impostor tracking.\r\n * This will be done by the impostor itself.\r\n * @param impostor the impostor to add\r\n */\r\n PhysicsEngine.prototype.addImpostor = function (impostor) {\r\n impostor.uniqueId = this._impostors.push(impostor);\r\n //if no parent, generate the body\r\n if (!impostor.parent) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n };\r\n /**\r\n * Remove an impostor from the engine.\r\n * This impostor and its mesh will not longer be updated by the physics engine.\r\n * @param impostor the impostor to remove\r\n */\r\n PhysicsEngine.prototype.removeImpostor = function (impostor) {\r\n var index = this._impostors.indexOf(impostor);\r\n if (index > -1) {\r\n var removed = this._impostors.splice(index, 1);\r\n //Is it needed?\r\n if (removed.length) {\r\n this.getPhysicsPlugin().removePhysicsBody(impostor);\r\n }\r\n }\r\n };\r\n /**\r\n * Add a joint to the physics engine\r\n * @param mainImpostor defines the main impostor to which the joint is added.\r\n * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint\r\n * @param joint defines the joint that will connect both impostors.\r\n */\r\n PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {\r\n var impostorJoint = {\r\n mainImpostor: mainImpostor,\r\n connectedImpostor: connectedImpostor,\r\n joint: joint\r\n };\r\n joint.physicsPlugin = this._physicsPlugin;\r\n this._joints.push(impostorJoint);\r\n this._physicsPlugin.generateJoint(impostorJoint);\r\n };\r\n /**\r\n * Removes a joint from the simulation\r\n * @param mainImpostor defines the impostor used with the joint\r\n * @param connectedImpostor defines the other impostor connected to the main one by the joint\r\n * @param joint defines the joint to remove\r\n */\r\n PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {\r\n var matchingJoints = this._joints.filter(function (impostorJoint) {\r\n return (impostorJoint.connectedImpostor === connectedImpostor\r\n && impostorJoint.joint === joint\r\n && impostorJoint.mainImpostor === mainImpostor);\r\n });\r\n if (matchingJoints.length) {\r\n this._physicsPlugin.removeJoint(matchingJoints[0]);\r\n //TODO remove it from the list as well\r\n }\r\n };\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespam between frames\r\n */\r\n PhysicsEngine.prototype._step = function (delta) {\r\n var _this = this;\r\n //check if any mesh has no body / requires an update\r\n this._impostors.forEach(function (impostor) {\r\n if (impostor.isBodyInitRequired()) {\r\n _this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n });\r\n if (delta > 0.1) {\r\n delta = 0.1;\r\n }\r\n else if (delta <= 0) {\r\n delta = 1.0 / 60.0;\r\n }\r\n this._physicsPlugin.executeStep(delta, this._impostors);\r\n };\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n PhysicsEngine.prototype.getPhysicsPlugin = function () {\r\n return this._physicsPlugin;\r\n };\r\n /**\r\n * Gets the list of physic impostors\r\n * @returns an array of PhysicsImpostor\r\n */\r\n PhysicsEngine.prototype.getImpostors = function () {\r\n return this._impostors;\r\n };\r\n /**\r\n * Gets the impostor for a physics enabled object\r\n * @param object defines the object impersonated by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {\r\n for (var i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].object === object) {\r\n return this._impostors[i];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the impostor for a physics body object\r\n * @param body defines physics body used by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {\r\n for (var i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].physicsBody === body) {\r\n return this._impostors[i];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n PhysicsEngine.prototype.raycast = function (from, to) {\r\n return this._physicsPlugin.raycast(from, to);\r\n };\r\n /**\r\n * Global value used to control the smallest number supported by the simulation\r\n */\r\n PhysicsEngine.Epsilon = 0.001;\r\n return PhysicsEngine;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsEngineComponent.ts\":\n/*!*******************************************!*\\\n !*** ./Physics/physicsEngineComponent.ts ***!\n \\*******************************************/\n/*! exports provided: PhysicsEngineSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return PhysicsEngineSceneComponent; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _physicsEngine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./physicsEngine */ \"./Physics/physicsEngine.ts\");\n/* harmony import */ var _physicsJoint__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./physicsJoint */ \"./Physics/physicsJoint.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gets the current physics engine\r\n * @returns a IPhysicsEngine or null if none attached\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.getPhysicsEngine = function () {\r\n return this._physicsEngine;\r\n};\r\n/**\r\n * Enables physics to the current scene\r\n * @param gravity defines the scene's gravity for the physics engine\r\n * @param plugin defines the physics engine to be used. defaults to OimoJS.\r\n * @return a boolean indicating if the physics engine was initialized\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.enablePhysics = function (gravity, plugin) {\r\n if (gravity === void 0) { gravity = null; }\r\n if (this._physicsEngine) {\r\n return true;\r\n }\r\n // Register the component to the scene\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_PHYSICSENGINE);\r\n if (!component) {\r\n component = new PhysicsEngineSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n try {\r\n this._physicsEngine = new _physicsEngine__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsEngine\"](gravity, plugin);\r\n return true;\r\n }\r\n catch (e) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(e.message);\r\n return false;\r\n }\r\n};\r\n/**\r\n * Disables and disposes the physics engine associated with the scene\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.disablePhysicsEngine = function () {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.dispose();\r\n this._physicsEngine = null;\r\n};\r\n/**\r\n * Gets a boolean indicating if there is an active physics engine\r\n * @returns a boolean indicating if there is an active physics engine\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.isPhysicsEnabled = function () {\r\n return this._physicsEngine !== undefined;\r\n};\r\n/**\r\n * Deletes a physics compound impostor\r\n * @param compound defines the compound to delete\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype.deleteCompoundImpostor = function (compound) {\r\n var mesh = compound.parts[0].mesh;\r\n if (mesh.physicsImpostor) {\r\n mesh.physicsImpostor.dispose( /*true*/);\r\n mesh.physicsImpostor = null;\r\n }\r\n};\r\n/** @hidden */\r\n_scene__WEBPACK_IMPORTED_MODULE_4__[\"Scene\"].prototype._advancePhysicsEngineStep = function (step) {\r\n if (this._physicsEngine) {\r\n this.onBeforePhysicsObservable.notifyObservers(this);\r\n this._physicsEngine._step(step / 1000);\r\n this.onAfterPhysicsObservable.notifyObservers(this);\r\n }\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype, \"physicsImpostor\", {\r\n get: function () {\r\n return this._physicsImpostor;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._physicsImpostor === value) {\r\n return;\r\n }\r\n if (this._disposePhysicsObserver) {\r\n this.onDisposeObservable.remove(this._disposePhysicsObserver);\r\n }\r\n this._physicsImpostor = value;\r\n if (value) {\r\n this._disposePhysicsObserver = this.onDisposeObservable.add(function () {\r\n // Physics\r\n if (_this.physicsImpostor) {\r\n _this.physicsImpostor.dispose( /*!doNotRecurse*/);\r\n _this.physicsImpostor = null;\r\n }\r\n });\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Gets the current physics impostor\r\n * @see http://doc.babylonjs.com/features/physics_engine\r\n * @returns a physics impostor or null\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.getPhysicsImpostor = function () {\r\n return this.physicsImpostor;\r\n};\r\n/**\r\n * Apply a physic impulse to the mesh\r\n * @param force defines the force to apply\r\n * @param contactPoint defines where to apply the force\r\n * @returns the current mesh\r\n * @see http://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.applyImpulse = function (force, contactPoint) {\r\n if (!this.physicsImpostor) {\r\n return this;\r\n }\r\n this.physicsImpostor.applyImpulse(force, contactPoint);\r\n return this;\r\n};\r\n/**\r\n * Creates a physic joint between two meshes\r\n * @param otherMesh defines the other mesh to use\r\n * @param pivot1 defines the pivot to use on this mesh\r\n * @param pivot2 defines the pivot to use on the other mesh\r\n * @param options defines additional options (can be plugin dependent)\r\n * @returns the current mesh\r\n * @see https://www.babylonjs-playground.com/#0BS5U0#0\r\n */\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.setPhysicsLinkWith = function (otherMesh, pivot1, pivot2, options) {\r\n if (!this.physicsImpostor || !otherMesh.physicsImpostor) {\r\n return this;\r\n }\r\n this.physicsImpostor.createJoint(otherMesh.physicsImpostor, _physicsJoint__WEBPACK_IMPORTED_MODULE_6__[\"PhysicsJoint\"].HingeJoint, {\r\n mainPivot: pivot1,\r\n connectedPivot: pivot2,\r\n nativeParams: options\r\n });\r\n return this;\r\n};\r\n/**\r\n * Defines the physics engine scene component responsible to manage a physics engine\r\n */\r\nvar PhysicsEngineSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function PhysicsEngineSceneComponent(scene) {\r\n var _this = this;\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_PHYSICSENGINE;\r\n this.scene = scene;\r\n this.scene.onBeforePhysicsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this.scene.onAfterPhysicsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n // Replace the function used to get the deterministic frame time\r\n this.scene.getDeterministicFrameTime = function () {\r\n if (_this.scene._physicsEngine) {\r\n return _this.scene._physicsEngine.getTimeStep() * 1000;\r\n }\r\n return 1000.0 / 60.0;\r\n };\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n PhysicsEngineSceneComponent.prototype.register = function () {\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n PhysicsEngineSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n PhysicsEngineSceneComponent.prototype.dispose = function () {\r\n this.scene.onBeforePhysicsObservable.clear();\r\n this.scene.onAfterPhysicsObservable.clear();\r\n if (this.scene._physicsEngine) {\r\n this.scene.disablePhysicsEngine();\r\n }\r\n };\r\n return PhysicsEngineSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsHelper.ts\":\n/*!**********************************!*\\\n !*** ./Physics/physicsHelper.ts ***!\n \\**********************************/\n/*! exports provided: PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return PhysicsHelper; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return PhysicsRadialExplosionEventOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return PhysicsUpdraftEventOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return PhysicsVortexEventOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return PhysicsRadialImpulseFalloff; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return PhysicsUpdraftMode; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ \"./Meshes/Builders/sphereBuilder.ts\");\n/* harmony import */ var _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/Builders/cylinderBuilder */ \"./Meshes/Builders/cylinderBuilder.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Culling/ray */ \"./Culling/ray.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * A helper for physics simulations\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsHelper = /** @class */ (function () {\r\n /**\r\n * Initializes the Physics helper\r\n * @param scene Babylon.js scene\r\n */\r\n function PhysicsHelper(scene) {\r\n this._scene = scene;\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you can use the methods.');\r\n return;\r\n }\r\n }\r\n /**\r\n * Applies a radial explosion impulse\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n PhysicsHelper.prototype.applyRadialExplosionImpulse = function (origin, radiusOrEventOptions, strength, falloff) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call this method.');\r\n return null;\r\n }\r\n var impostors = this._physicsEngine.getImpostors();\r\n if (impostors.length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff || radiusOrEventOptions.falloff;\r\n }\r\n var event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n var affectedImpostorsWithData = Array();\r\n impostors.forEach(function (impostor) {\r\n var impostorHitData = event.getImpostorHitData(impostor, origin);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyImpulse(impostorHitData.force, impostorHitData.contactPoint);\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: impostorHitData,\r\n });\r\n });\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Applies a radial explosion force\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n PhysicsHelper.prototype.applyRadialExplosionForce = function (origin, radiusOrEventOptions, strength, falloff) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n var impostors = this._physicsEngine.getImpostors();\r\n if (impostors.length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff || radiusOrEventOptions.falloff;\r\n }\r\n var event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n var affectedImpostorsWithData = Array();\r\n impostors.forEach(function (impostor) {\r\n var impostorHitData = event.getImpostorHitData(impostor, origin);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyForce(impostorHitData.force, impostorHitData.contactPoint);\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: impostorHitData,\r\n });\r\n });\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Creates a gravitational field\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics gravitational field event, or null\r\n */\r\n PhysicsHelper.prototype.gravitationalField = function (origin, radiusOrEventOptions, strength, falloff) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n var impostors = this._physicsEngine.getImpostors();\r\n if (impostors.length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff || radiusOrEventOptions.falloff;\r\n }\r\n var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radiusOrEventOptions);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Creates a physics updraft event\r\n * @param origin the origin of the updraft\r\n * @param radiusOrEventOptions the radius or the options of the updraft\r\n * @param strength the strength of the updraft\r\n * @param height the height of the updraft\r\n * @param updraftMode possible options: Center & Perpendicular. Defaults to Center\r\n * @returns A physics updraft event, or null\r\n */\r\n PhysicsHelper.prototype.updraft = function (origin, radiusOrEventOptions, strength, height, updraftMode) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n if (this._physicsEngine.getImpostors().length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsUpdraftEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height || radiusOrEventOptions.height;\r\n radiusOrEventOptions.updraftMode = updraftMode || radiusOrEventOptions.updraftMode;\r\n }\r\n var event = new PhysicsUpdraftEvent(this._scene, origin, radiusOrEventOptions);\r\n event.dispose(false);\r\n return event;\r\n };\r\n /**\r\n * Creates a physics vortex event\r\n * @param origin the of the vortex\r\n * @param radiusOrEventOptions the radius or the options of the vortex\r\n * @param strength the strength of the vortex\r\n * @param height the height of the vortex\r\n * @returns a Physics vortex event, or null\r\n * A physics vortex event or null\r\n */\r\n PhysicsHelper.prototype.vortex = function (origin, radiusOrEventOptions, strength, height) {\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');\r\n return null;\r\n }\r\n if (this._physicsEngine.getImpostors().length === 0) {\r\n return null;\r\n }\r\n if (typeof radiusOrEventOptions === 'number') {\r\n radiusOrEventOptions = new PhysicsVortexEventOptions();\r\n radiusOrEventOptions.radius = radiusOrEventOptions;\r\n radiusOrEventOptions.strength = strength || radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height || radiusOrEventOptions.height;\r\n }\r\n var event = new PhysicsVortexEvent(this._scene, origin, radiusOrEventOptions);\r\n event.dispose(false);\r\n return event;\r\n };\r\n return PhysicsHelper;\r\n}());\r\n\r\n/**\r\n * Represents a physics radial explosion event\r\n */\r\nvar PhysicsRadialExplosionEvent = /** @class */ (function () {\r\n /**\r\n * Initializes a radial explosioin event\r\n * @param _scene BabylonJS scene\r\n * @param _options The options for the vortex event\r\n */\r\n function PhysicsRadialExplosionEvent(_scene, _options) {\r\n this._scene = _scene;\r\n this._options = _options;\r\n this._dataFetched = false; // check if the data has been fetched. If not, do cleanup\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsRadialExplosionEventOptions()), this._options);\r\n }\r\n /**\r\n * Returns the data related to the radial explosion event (sphere).\r\n * @returns The radial explosion event data\r\n */\r\n PhysicsRadialExplosionEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n sphere: this._sphere,\r\n };\r\n };\r\n /**\r\n * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.\r\n * @param impostor A physics imposter\r\n * @param origin the origin of the explosion\r\n * @returns {Nullable} A physics force and contact point, or null\r\n */\r\n PhysicsRadialExplosionEvent.prototype.getImpostorHitData = function (impostor, origin) {\r\n if (impostor.mass === 0) {\r\n return null;\r\n }\r\n if (!this._intersectsWithSphere(impostor, origin, this._options.radius)) {\r\n return null;\r\n }\r\n if (impostor.object.getClassName() !== 'Mesh' && impostor.object.getClassName() !== 'InstancedMesh') {\r\n return null;\r\n }\r\n var impostorObjectCenter = impostor.getObjectCenter();\r\n var direction = impostorObjectCenter.subtract(origin);\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](origin, direction, this._options.radius);\r\n var hit = ray.intersectsMesh(impostor.object);\r\n var contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return null;\r\n }\r\n var distanceFromOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Distance(origin, contactPoint);\r\n if (distanceFromOrigin > this._options.radius) {\r\n return null;\r\n }\r\n var multiplier = this._options.falloff === PhysicsRadialImpulseFalloff.Constant\r\n ? this._options.strength\r\n : this._options.strength * (1 - (distanceFromOrigin / this._options.radius));\r\n var force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n return { force: force, contactPoint: contactPoint, distanceFromOrigin: distanceFromOrigin };\r\n };\r\n /**\r\n * Triggers affecterd impostors callbacks\r\n * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)\r\n */\r\n PhysicsRadialExplosionEvent.prototype.triggerAffectedImpostorsCallback = function (affectedImpostorsWithData) {\r\n if (this._options.affectedImpostorsCallback) {\r\n this._options.affectedImpostorsCallback(affectedImpostorsWithData);\r\n }\r\n };\r\n /**\r\n * Disposes the sphere.\r\n * @param force Specifies if the sphere should be disposed by force\r\n */\r\n PhysicsRadialExplosionEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (force) {\r\n this._sphere.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n /*** Helpers ***/\r\n PhysicsRadialExplosionEvent.prototype._prepareSphere = function () {\r\n if (!this._sphere) {\r\n this._sphere = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_3__[\"SphereBuilder\"].CreateSphere(\"radialExplosionEventSphere\", this._options.sphere, this._scene);\r\n this._sphere.isVisible = false;\r\n }\r\n };\r\n PhysicsRadialExplosionEvent.prototype._intersectsWithSphere = function (impostor, origin, radius) {\r\n var impostorObject = impostor.object;\r\n this._prepareSphere();\r\n this._sphere.position = origin;\r\n this._sphere.scaling = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](radius * 2, radius * 2, radius * 2);\r\n this._sphere._updateBoundingInfo();\r\n this._sphere.computeWorldMatrix(true);\r\n return this._sphere.intersectsMesh(impostorObject, true);\r\n };\r\n return PhysicsRadialExplosionEvent;\r\n}());\r\n/**\r\n * Represents a gravitational field event\r\n */\r\nvar PhysicsGravitationalFieldEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the physics gravitational field event\r\n * @param _physicsHelper A physics helper\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the gravitational field event\r\n * @param _options The options for the vortex event\r\n */\r\n function PhysicsGravitationalFieldEvent(_physicsHelper, _scene, _origin, _options) {\r\n this._physicsHelper = _physicsHelper;\r\n this._scene = _scene;\r\n this._origin = _origin;\r\n this._options = _options;\r\n this._dataFetched = false; // check if the has been fetched the data. If not, do cleanup\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsRadialExplosionEventOptions()), this._options);\r\n this._tickCallback = this._tick.bind(this);\r\n this._options.strength = this._options.strength * -1;\r\n }\r\n /**\r\n * Returns the data related to the gravitational field event (sphere).\r\n * @returns A gravitational field event\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n sphere: this._sphere,\r\n };\r\n };\r\n /**\r\n * Enables the gravitational field.\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.enable = function () {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disables the gravitational field.\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.disable = function () {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disposes the sphere.\r\n * @param force The force to dispose from the gravitational field event\r\n */\r\n PhysicsGravitationalFieldEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (force) {\r\n this._sphere.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n PhysicsGravitationalFieldEvent.prototype._tick = function () {\r\n // Since the params won't change, we fetch the event only once\r\n if (this._sphere) {\r\n this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n }\r\n else {\r\n var radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n if (radialExplosionEvent) {\r\n this._sphere = radialExplosionEvent.getData().sphere.clone('radialExplosionEventSphereClone');\r\n }\r\n }\r\n };\r\n return PhysicsGravitationalFieldEvent;\r\n}());\r\n/**\r\n * Represents a physics updraft event\r\n */\r\nvar PhysicsUpdraftEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the physics updraft event\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the updraft\r\n * @param _options The options for the updraft event\r\n */\r\n function PhysicsUpdraftEvent(_scene, _origin, _options) {\r\n this._scene = _scene;\r\n this._origin = _origin;\r\n this._options = _options;\r\n this._originTop = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // the most upper part of the cylinder\r\n this._originDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // used if the updraftMode is perpendicular\r\n this._cylinderPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n this._dataFetched = false; // check if the has been fetched the data. If not, do cleanup\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsUpdraftEventOptions()), this._options);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height, 0), this._originTop);\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n this._originDirection = this._origin.subtract(this._originTop).normalize();\r\n }\r\n this._tickCallback = this._tick.bind(this);\r\n this._prepareCylinder();\r\n }\r\n /**\r\n * Returns the data related to the updraft event (cylinder).\r\n * @returns A physics updraft event\r\n */\r\n PhysicsUpdraftEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n };\r\n /**\r\n * Enables the updraft.\r\n */\r\n PhysicsUpdraftEvent.prototype.enable = function () {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disables the updraft.\r\n */\r\n PhysicsUpdraftEvent.prototype.disable = function () {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disposes the cylinder.\r\n * @param force Specifies if the updraft should be disposed by force\r\n */\r\n PhysicsUpdraftEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n PhysicsUpdraftEvent.prototype.getImpostorHitData = function (impostor) {\r\n if (impostor.mass === 0) {\r\n return null;\r\n }\r\n if (!this._intersectsWithCylinder(impostor)) {\r\n return null;\r\n }\r\n var impostorObjectCenter = impostor.getObjectCenter();\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n var direction = this._originDirection;\r\n }\r\n else {\r\n var direction = impostorObjectCenter.subtract(this._originTop);\r\n }\r\n var distanceFromOrigin = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Distance(this._origin, impostorObjectCenter);\r\n var multiplier = this._options.strength * -1;\r\n var force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n return { force: force, contactPoint: impostorObjectCenter, distanceFromOrigin: distanceFromOrigin };\r\n };\r\n PhysicsUpdraftEvent.prototype._tick = function () {\r\n var _this = this;\r\n this._physicsEngine.getImpostors().forEach(function (impostor) {\r\n var impostorHitData = _this.getImpostorHitData(impostor);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyForce(impostorHitData.force, impostorHitData.contactPoint);\r\n });\r\n };\r\n /*** Helpers ***/\r\n PhysicsUpdraftEvent.prototype._prepareCylinder = function () {\r\n if (!this._cylinder) {\r\n this._cylinder = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"updraftEventCylinder\", {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n }, this._scene);\r\n this._cylinder.isVisible = false;\r\n }\r\n };\r\n PhysicsUpdraftEvent.prototype._intersectsWithCylinder = function (impostor) {\r\n var impostorObject = impostor.object;\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(impostorObject, true);\r\n };\r\n return PhysicsUpdraftEvent;\r\n}());\r\n/**\r\n * Represents a physics vortex event\r\n */\r\nvar PhysicsVortexEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the physics vortex event\r\n * @param _scene The BabylonJS scene\r\n * @param _origin The origin position of the vortex\r\n * @param _options The options for the vortex event\r\n */\r\n function PhysicsVortexEvent(_scene, _origin, _options) {\r\n this._scene = _scene;\r\n this._origin = _origin;\r\n this._options = _options;\r\n this._originTop = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // the most upper part of the cylinder\r\n this._cylinderPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n this._dataFetched = false; // check if the has been fetched the data. If not, do cleanup\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n this._options = tslib__WEBPACK_IMPORTED_MODULE_0__[\"__assign\"]({}, (new PhysicsVortexEventOptions()), this._options);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](0, this._options.height, 0), this._originTop);\r\n this._tickCallback = this._tick.bind(this);\r\n this._prepareCylinder();\r\n }\r\n /**\r\n * Returns the data related to the vortex event (cylinder).\r\n * @returns The physics vortex event data\r\n */\r\n PhysicsVortexEvent.prototype.getData = function () {\r\n this._dataFetched = true;\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n };\r\n /**\r\n * Enables the vortex.\r\n */\r\n PhysicsVortexEvent.prototype.enable = function () {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disables the cortex.\r\n */\r\n PhysicsVortexEvent.prototype.disable = function () {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n };\r\n /**\r\n * Disposes the sphere.\r\n * @param force\r\n */\r\n PhysicsVortexEvent.prototype.dispose = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = true; }\r\n if (force) {\r\n this._cylinder.dispose();\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this._dataFetched) {\r\n _this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n };\r\n PhysicsVortexEvent.prototype.getImpostorHitData = function (impostor) {\r\n if (impostor.mass === 0) {\r\n return null;\r\n }\r\n if (!this._intersectsWithCylinder(impostor)) {\r\n return null;\r\n }\r\n if (impostor.object.getClassName() !== 'Mesh' && impostor.object.getClassName() !== 'InstancedMesh') {\r\n return null;\r\n }\r\n var impostorObjectCenter = impostor.getObjectCenter();\r\n var originOnPlane = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](this._origin.x, impostorObjectCenter.y, this._origin.z); // the distance to the origin as if both objects were on a plane (Y-axis)\r\n var originToImpostorDirection = impostorObjectCenter.subtract(originOnPlane);\r\n var ray = new _Culling_ray__WEBPACK_IMPORTED_MODULE_5__[\"Ray\"](originOnPlane, originToImpostorDirection, this._options.radius);\r\n var hit = ray.intersectsMesh(impostor.object);\r\n var contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return null;\r\n }\r\n var absoluteDistanceFromOrigin = hit.distance / this._options.radius;\r\n var directionToOrigin = contactPoint.normalize();\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin = directionToOrigin.negate();\r\n }\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n var forceX = directionToOrigin.x * this._options.centripetalForceMultiplier;\r\n var forceY = directionToOrigin.y * this._options.updraftForceMultiplier;\r\n var forceZ = directionToOrigin.z * this._options.centripetalForceMultiplier;\r\n }\r\n else {\r\n var perpendicularDirection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Cross(originOnPlane, impostorObjectCenter).normalize();\r\n var forceX = (perpendicularDirection.x + directionToOrigin.x) * this._options.centrifugalForceMultiplier;\r\n var forceY = this._originTop.y * this._options.updraftForceMultiplier;\r\n var forceZ = (perpendicularDirection.z + directionToOrigin.z) * this._options.centrifugalForceMultiplier;\r\n }\r\n var force = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](forceX, forceY, forceZ);\r\n force = force.multiplyByFloats(this._options.strength, this._options.strength, this._options.strength);\r\n return { force: force, contactPoint: impostorObjectCenter, distanceFromOrigin: absoluteDistanceFromOrigin };\r\n };\r\n PhysicsVortexEvent.prototype._tick = function () {\r\n var _this = this;\r\n this._physicsEngine.getImpostors().forEach(function (impostor) {\r\n var impostorHitData = _this.getImpostorHitData(impostor);\r\n if (!impostorHitData) {\r\n return;\r\n }\r\n impostor.applyForce(impostorHitData.force, impostorHitData.contactPoint);\r\n });\r\n };\r\n /*** Helpers ***/\r\n PhysicsVortexEvent.prototype._prepareCylinder = function () {\r\n if (!this._cylinder) {\r\n this._cylinder = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__[\"CylinderBuilder\"].CreateCylinder(\"vortexEventCylinder\", {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n }, this._scene);\r\n this._cylinder.isVisible = false;\r\n }\r\n };\r\n PhysicsVortexEvent.prototype._intersectsWithCylinder = function (impostor) {\r\n var impostorObject = impostor.object;\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(impostorObject, true);\r\n };\r\n return PhysicsVortexEvent;\r\n}());\r\n/**\r\n * Options fot the radial explosion event\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsRadialExplosionEventOptions = /** @class */ (function () {\r\n function PhysicsRadialExplosionEventOptions() {\r\n /**\r\n * The radius of the sphere for the radial explosion.\r\n */\r\n this.radius = 5;\r\n /**\r\n * The strenth of the explosion.\r\n */\r\n this.strength = 10;\r\n /**\r\n * The strenght of the force in correspondence to the distance of the affected object\r\n */\r\n this.falloff = PhysicsRadialImpulseFalloff.Constant;\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n this.sphere = { segments: 32, diameter: 1 };\r\n }\r\n return PhysicsRadialExplosionEventOptions;\r\n}());\r\n\r\n/**\r\n * Options fot the updraft event\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsUpdraftEventOptions = /** @class */ (function () {\r\n function PhysicsUpdraftEventOptions() {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n this.radius = 5;\r\n /**\r\n * The strenth of the updraft.\r\n */\r\n this.strength = 10;\r\n /**\r\n * The height of the cylinder for the updraft.\r\n */\r\n this.height = 10;\r\n /**\r\n * The mode for the the updraft.\r\n */\r\n this.updraftMode = PhysicsUpdraftMode.Center;\r\n }\r\n return PhysicsUpdraftEventOptions;\r\n}());\r\n\r\n/**\r\n * Options fot the vortex event\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsVortexEventOptions = /** @class */ (function () {\r\n function PhysicsVortexEventOptions() {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n this.radius = 5;\r\n /**\r\n * The strenth of the vortex.\r\n */\r\n this.strength = 10;\r\n /**\r\n * The height of the cylinder for the vortex.\r\n */\r\n this.height = 10;\r\n /**\r\n * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1\r\n */\r\n this.centripetalForceThreshold = 0.7;\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the treshold.\r\n */\r\n this.centripetalForceMultiplier = 5;\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the treshold.\r\n */\r\n this.centrifugalForceMultiplier = 0.5;\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.\r\n */\r\n this.updraftForceMultiplier = 0.02;\r\n }\r\n return PhysicsVortexEventOptions;\r\n}());\r\n\r\n/**\r\n* The strenght of the force in correspondence to the distance of the affected object\r\n* @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n*/\r\nvar PhysicsRadialImpulseFalloff;\r\n(function (PhysicsRadialImpulseFalloff) {\r\n /** Defines that impulse is constant in strength across it's whole radius */\r\n PhysicsRadialImpulseFalloff[PhysicsRadialImpulseFalloff[\"Constant\"] = 0] = \"Constant\";\r\n /** Defines that impulse gets weaker if it's further from the origin */\r\n PhysicsRadialImpulseFalloff[PhysicsRadialImpulseFalloff[\"Linear\"] = 1] = \"Linear\";\r\n})(PhysicsRadialImpulseFalloff || (PhysicsRadialImpulseFalloff = {}));\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine#further-functionality-of-the-impostor-class\r\n */\r\nvar PhysicsUpdraftMode;\r\n(function (PhysicsUpdraftMode) {\r\n /** Defines that the upstream forces will pull towards the top center of the cylinder */\r\n PhysicsUpdraftMode[PhysicsUpdraftMode[\"Center\"] = 0] = \"Center\";\r\n /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */\r\n PhysicsUpdraftMode[PhysicsUpdraftMode[\"Perpendicular\"] = 1] = \"Perpendicular\";\r\n})(PhysicsUpdraftMode || (PhysicsUpdraftMode = {}));\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsImpostor.ts\":\n/*!************************************!*\\\n !*** ./Physics/physicsImpostor.ts ***!\n \\************************************/\n/*! exports provided: PhysicsImpostor */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return PhysicsImpostor; });\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/arrayTools */ \"./Misc/arrayTools.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _physicsJoint__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./physicsJoint */ \"./Physics/physicsJoint.ts\");\n/* harmony import */ var _Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Maths/math.axis */ \"./Maths/math.axis.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__[\"Mesh\"]._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {\r\n return new PhysicsImpostor(physicObject, jsonObject.physicsImpostor, {\r\n mass: jsonObject.physicsMass,\r\n friction: jsonObject.physicsFriction,\r\n restitution: jsonObject.physicsRestitution\r\n }, scene);\r\n};\r\n/**\r\n * Represents a physics imposter\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsImpostor = /** @class */ (function () {\r\n /**\r\n * Initializes the physics imposter\r\n * @param object The physics-enabled object used as the physics imposter\r\n * @param type The type of the physics imposter\r\n * @param _options The options for the physics imposter\r\n * @param _scene The Babylon scene\r\n */\r\n function PhysicsImpostor(\r\n /**\r\n * The physics-enabled object used as the physics imposter\r\n */\r\n object, \r\n /**\r\n * The type of the physics imposter\r\n */\r\n type, _options, _scene) {\r\n var _this = this;\r\n if (_options === void 0) { _options = { mass: 0 }; }\r\n this.object = object;\r\n this.type = type;\r\n this._options = _options;\r\n this._scene = _scene;\r\n /** @hidden */\r\n this._pluginData = {};\r\n this._bodyUpdateRequired = false;\r\n this._onBeforePhysicsStepCallbacks = new Array();\r\n this._onAfterPhysicsStepCallbacks = new Array();\r\n /** @hidden */\r\n this._onPhysicsCollideCallbacks = [];\r\n this._deltaPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n this._isDisposed = false;\r\n /**\r\n * @hidden\r\n */\r\n this.soft = false;\r\n /**\r\n * @hidden\r\n */\r\n this.segments = 0;\r\n //temp variables for parent rotation calculations\r\n //private _mats: Array = [new Matrix(), new Matrix()];\r\n this._tmpQuat = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n this._tmpQuat2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n /**\r\n * this function is executed by the physics engine.\r\n */\r\n this.beforeStep = function () {\r\n if (!_this._physicsEngine) {\r\n return;\r\n }\r\n _this.object.translate(_this._deltaPosition, -1);\r\n _this._deltaRotationConjugated && _this.object.rotationQuaternion && _this.object.rotationQuaternion.multiplyToRef(_this._deltaRotationConjugated, _this.object.rotationQuaternion);\r\n _this.object.computeWorldMatrix(false);\r\n if (_this.object.parent && _this.object.rotationQuaternion) {\r\n _this.getParentsRotation();\r\n _this._tmpQuat.multiplyToRef(_this.object.rotationQuaternion, _this._tmpQuat);\r\n }\r\n else {\r\n _this._tmpQuat.copyFrom(_this.object.rotationQuaternion || new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]());\r\n }\r\n if (!_this._options.disableBidirectionalTransformation) {\r\n _this.object.rotationQuaternion && _this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(_this, /*bInfo.boundingBox.centerWorld*/ _this.object.getAbsolutePosition(), _this._tmpQuat);\r\n }\r\n _this._onBeforePhysicsStepCallbacks.forEach(function (func) {\r\n func(_this);\r\n });\r\n };\r\n /**\r\n * this function is executed by the physics engine\r\n */\r\n this.afterStep = function () {\r\n if (!_this._physicsEngine) {\r\n return;\r\n }\r\n _this._onAfterPhysicsStepCallbacks.forEach(function (func) {\r\n func(_this);\r\n });\r\n _this._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(_this);\r\n // object has now its world rotation. needs to be converted to local.\r\n if (_this.object.parent && _this.object.rotationQuaternion) {\r\n _this.getParentsRotation();\r\n _this._tmpQuat.conjugateInPlace();\r\n _this._tmpQuat.multiplyToRef(_this.object.rotationQuaternion, _this.object.rotationQuaternion);\r\n }\r\n // take the position set and make it the absolute position of this object.\r\n _this.object.setAbsolutePosition(_this.object.position);\r\n _this._deltaRotation && _this.object.rotationQuaternion && _this.object.rotationQuaternion.multiplyToRef(_this._deltaRotation, _this.object.rotationQuaternion);\r\n _this.object.translate(_this._deltaPosition, 1);\r\n };\r\n /**\r\n * Legacy collision detection event support\r\n */\r\n this.onCollideEvent = null;\r\n /**\r\n * event and body object due to cannon's event-based architecture.\r\n */\r\n this.onCollide = function (e) {\r\n if (!_this._onPhysicsCollideCallbacks.length && !_this.onCollideEvent) {\r\n return;\r\n }\r\n if (!_this._physicsEngine) {\r\n return;\r\n }\r\n var otherImpostor = _this._physicsEngine.getImpostorWithPhysicsBody(e.body);\r\n if (otherImpostor) {\r\n // Legacy collision detection event support\r\n if (_this.onCollideEvent) {\r\n _this.onCollideEvent(_this, otherImpostor);\r\n }\r\n _this._onPhysicsCollideCallbacks.filter(function (obj) {\r\n return obj.otherImpostors.indexOf(otherImpostor) !== -1;\r\n }).forEach(function (obj) {\r\n obj.callback(_this, otherImpostor);\r\n });\r\n }\r\n };\r\n //sanity check!\r\n if (!this.object) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n if (this.object.parent && _options.mass !== 0) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur.\");\r\n }\r\n // Legacy support for old syntax.\r\n if (!this._scene && object.getScene) {\r\n this._scene = object.getScene();\r\n }\r\n if (!this._scene) {\r\n return;\r\n }\r\n if (this.type > 100) {\r\n this.soft = true;\r\n }\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n if (!this._physicsEngine) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Error(\"Physics not enabled. Please use scene.enablePhysics(...) before creating impostors.\");\r\n }\r\n else {\r\n //set the object's quaternion, if not set\r\n if (!this.object.rotationQuaternion) {\r\n if (this.object.rotation) {\r\n this.object.rotationQuaternion = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRoll(this.object.rotation.y, this.object.rotation.x, this.object.rotation.z);\r\n }\r\n else {\r\n this.object.rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n }\r\n //default options params\r\n this._options.mass = (_options.mass === void 0) ? 0 : _options.mass;\r\n this._options.friction = (_options.friction === void 0) ? 0.2 : _options.friction;\r\n this._options.restitution = (_options.restitution === void 0) ? 0.2 : _options.restitution;\r\n if (this.soft) {\r\n //softbody mass must be above 0;\r\n this._options.mass = this._options.mass > 0 ? this._options.mass : 1;\r\n this._options.pressure = (_options.pressure === void 0) ? 200 : _options.pressure;\r\n this._options.stiffness = (_options.stiffness === void 0) ? 1 : _options.stiffness;\r\n this._options.velocityIterations = (_options.velocityIterations === void 0) ? 20 : _options.velocityIterations;\r\n this._options.positionIterations = (_options.positionIterations === void 0) ? 20 : _options.positionIterations;\r\n this._options.fixedPoints = (_options.fixedPoints === void 0) ? 0 : _options.fixedPoints;\r\n this._options.margin = (_options.margin === void 0) ? 0 : _options.margin;\r\n this._options.damping = (_options.damping === void 0) ? 0 : _options.damping;\r\n this._options.path = (_options.path === void 0) ? null : _options.path;\r\n this._options.shape = (_options.shape === void 0) ? null : _options.shape;\r\n }\r\n this._joints = [];\r\n //If the mesh has a parent, don't initialize the physicsBody. Instead wait for the parent to do that.\r\n if (!this.object.parent || this._options.ignoreParent) {\r\n this._init();\r\n }\r\n else if (this.object.parent.physicsImpostor) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"You must affect impostors to children before affecting impostor to parent.\");\r\n }\r\n }\r\n }\r\n Object.defineProperty(PhysicsImpostor.prototype, \"isDisposed\", {\r\n /**\r\n * Specifies if the physics imposter is disposed\r\n */\r\n get: function () {\r\n return this._isDisposed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"mass\", {\r\n /**\r\n * Gets the mass of the physics imposter\r\n */\r\n get: function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;\r\n },\r\n set: function (value) {\r\n this.setMass(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"friction\", {\r\n /**\r\n * Gets the coefficient of friction\r\n */\r\n get: function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;\r\n },\r\n /**\r\n * Sets the coefficient of friction\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"restitution\", {\r\n /**\r\n * Gets the coefficient of restitution\r\n */\r\n get: function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;\r\n },\r\n /**\r\n * Sets the coefficient of restitution\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"pressure\", {\r\n /**\r\n * Gets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return 0;\r\n }\r\n return plugin.getBodyPressure(this);\r\n },\r\n /**\r\n * Sets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return;\r\n }\r\n plugin.setBodyPressure(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"stiffness\", {\r\n /**\r\n * Gets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyStiffness) {\r\n return 0;\r\n }\r\n return plugin.getBodyStiffness(this);\r\n },\r\n /**\r\n * Sets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyStiffness) {\r\n return;\r\n }\r\n plugin.setBodyStiffness(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"velocityIterations\", {\r\n /**\r\n * Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyVelocityIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyVelocityIterations(this);\r\n },\r\n /**\r\n * Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyVelocityIterations) {\r\n return;\r\n }\r\n plugin.setBodyVelocityIterations(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"positionIterations\", {\r\n /**\r\n * Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get: function () {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyPositionIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyPositionIterations(this);\r\n },\r\n /**\r\n * Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set: function (value) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPositionIterations) {\r\n return;\r\n }\r\n plugin.setBodyPositionIterations(this, value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * This function will completly initialize this impostor.\r\n * It will create a new body - but only if this mesh has no parent.\r\n * If it has, this impostor will not be used other than to define the impostor\r\n * of the child mesh.\r\n * @hidden\r\n */\r\n PhysicsImpostor.prototype._init = function () {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.removeImpostor(this);\r\n this.physicsBody = null;\r\n this._parent = this._parent || this._getPhysicsParent();\r\n if (!this._isDisposed && (!this.parent || this._options.ignoreParent)) {\r\n this._physicsEngine.addImpostor(this);\r\n }\r\n };\r\n PhysicsImpostor.prototype._getPhysicsParent = function () {\r\n if (this.object.parent instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_3__[\"AbstractMesh\"]) {\r\n var parentMesh = this.object.parent;\r\n return parentMesh.physicsImpostor;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Should a new body be generated.\r\n * @returns boolean specifying if body initialization is required\r\n */\r\n PhysicsImpostor.prototype.isBodyInitRequired = function () {\r\n return this._bodyUpdateRequired || (!this._physicsBody && !this._parent);\r\n };\r\n /**\r\n * Sets the updated scaling\r\n * @param updated Specifies if the scaling is updated\r\n */\r\n PhysicsImpostor.prototype.setScalingUpdated = function () {\r\n this.forceUpdate();\r\n };\r\n /**\r\n * Force a regeneration of this or the parent's impostor's body.\r\n * Use under cautious - This will remove all joints already implemented.\r\n */\r\n PhysicsImpostor.prototype.forceUpdate = function () {\r\n this._init();\r\n if (this.parent && !this._options.ignoreParent) {\r\n this.parent.forceUpdate();\r\n }\r\n };\r\n Object.defineProperty(PhysicsImpostor.prototype, \"physicsBody\", {\r\n /*public get mesh(): AbstractMesh {\r\n return this._mesh;\r\n }*/\r\n /**\r\n * Gets the body that holds this impostor. Either its own, or its parent.\r\n */\r\n get: function () {\r\n return (this._parent && !this._options.ignoreParent) ? this._parent.physicsBody : this._physicsBody;\r\n },\r\n /**\r\n * Set the physics body. Used mainly by the physics engine/plugin\r\n */\r\n set: function (physicsBody) {\r\n if (this._physicsBody && this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this);\r\n }\r\n this._physicsBody = physicsBody;\r\n this.resetUpdateFlags();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsImpostor.prototype, \"parent\", {\r\n /**\r\n * Get the parent of the physics imposter\r\n * @returns Physics imposter or null\r\n */\r\n get: function () {\r\n return !this._options.ignoreParent && this._parent ? this._parent : null;\r\n },\r\n /**\r\n * Sets the parent of the physics imposter\r\n */\r\n set: function (value) {\r\n this._parent = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the update flags\r\n */\r\n PhysicsImpostor.prototype.resetUpdateFlags = function () {\r\n this._bodyUpdateRequired = false;\r\n };\r\n /**\r\n * Gets the object extend size\r\n * @returns the object extend size\r\n */\r\n PhysicsImpostor.prototype.getObjectExtendSize = function () {\r\n if (this.object.getBoundingInfo) {\r\n var q = this.object.rotationQuaternion;\r\n //reset rotation\r\n this.object.rotationQuaternion = PhysicsImpostor.IDENTITY_QUATERNION;\r\n //calculate the world matrix with no rotation\r\n this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);\r\n var boundingInfo = this.object.getBoundingInfo();\r\n var size = boundingInfo.boundingBox.extendSizeWorld.scale(2);\r\n //bring back the rotation\r\n this.object.rotationQuaternion = q;\r\n //calculate the world matrix with the new rotation\r\n this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);\r\n return size;\r\n }\r\n else {\r\n return PhysicsImpostor.DEFAULT_OBJECT_SIZE;\r\n }\r\n };\r\n /**\r\n * Gets the object center\r\n * @returns The object center\r\n */\r\n PhysicsImpostor.prototype.getObjectCenter = function () {\r\n if (this.object.getBoundingInfo) {\r\n var boundingInfo = this.object.getBoundingInfo();\r\n return boundingInfo.boundingBox.centerWorld;\r\n }\r\n else {\r\n return this.object.position;\r\n }\r\n };\r\n /**\r\n * Get a specific parametes from the options parameter\r\n * @param paramName The object parameter name\r\n * @returns The object parameter\r\n */\r\n PhysicsImpostor.prototype.getParam = function (paramName) {\r\n return this._options[paramName];\r\n };\r\n /**\r\n * Sets a specific parameter in the options given to the physics plugin\r\n * @param paramName The parameter name\r\n * @param value The value of the parameter\r\n */\r\n PhysicsImpostor.prototype.setParam = function (paramName, value) {\r\n this._options[paramName] = value;\r\n this._bodyUpdateRequired = true;\r\n };\r\n /**\r\n * Specifically change the body's mass option. Won't recreate the physics body object\r\n * @param mass The mass of the physics imposter\r\n */\r\n PhysicsImpostor.prototype.setMass = function (mass) {\r\n if (this.getParam(\"mass\") !== mass) {\r\n this.setParam(\"mass\", mass);\r\n }\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setBodyMass(this, mass);\r\n }\r\n };\r\n /**\r\n * Gets the linear velocity\r\n * @returns linear velocity or null\r\n */\r\n PhysicsImpostor.prototype.getLinearVelocity = function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this) : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Sets the linear velocity\r\n * @param velocity linear velocity or null\r\n */\r\n PhysicsImpostor.prototype.setLinearVelocity = function (velocity) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this, velocity);\r\n }\r\n };\r\n /**\r\n * Gets the angular velocity\r\n * @returns angular velocity or null\r\n */\r\n PhysicsImpostor.prototype.getAngularVelocity = function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this) : _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero();\r\n };\r\n /**\r\n * Sets the angular velocity\r\n * @param velocity The velocity or null\r\n */\r\n PhysicsImpostor.prototype.setAngularVelocity = function (velocity) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this, velocity);\r\n }\r\n };\r\n /**\r\n * Execute a function with the physics plugin native code\r\n * Provide a function the will have two variables - the world object and the physics body object\r\n * @param func The function to execute with the physics plugin native code\r\n */\r\n PhysicsImpostor.prototype.executeNativeFunction = function (func) {\r\n if (this._physicsEngine) {\r\n func(this._physicsEngine.getPhysicsPlugin().world, this.physicsBody);\r\n }\r\n };\r\n /**\r\n * Register a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n PhysicsImpostor.prototype.registerBeforePhysicsStep = function (func) {\r\n this._onBeforePhysicsStepCallbacks.push(func);\r\n };\r\n /**\r\n * Unregister a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n PhysicsImpostor.prototype.unregisterBeforePhysicsStep = function (func) {\r\n var index = this._onBeforePhysicsStepCallbacks.indexOf(func);\r\n if (index > -1) {\r\n this._onBeforePhysicsStepCallbacks.splice(index, 1);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Function to remove was not found\");\r\n }\r\n };\r\n /**\r\n * Register a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n PhysicsImpostor.prototype.registerAfterPhysicsStep = function (func) {\r\n this._onAfterPhysicsStepCallbacks.push(func);\r\n };\r\n /**\r\n * Unregisters a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n PhysicsImpostor.prototype.unregisterAfterPhysicsStep = function (func) {\r\n var index = this._onAfterPhysicsStepCallbacks.indexOf(func);\r\n if (index > -1) {\r\n this._onAfterPhysicsStepCallbacks.splice(index, 1);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Function to remove was not found\");\r\n }\r\n };\r\n /**\r\n * register a function that will be executed when this impostor collides against a different body\r\n * @param collideAgainst Physics imposter, or array of physics imposters to collide against\r\n * @param func Callback that is executed on collision\r\n */\r\n PhysicsImpostor.prototype.registerOnPhysicsCollide = function (collideAgainst, func) {\r\n var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n this._onPhysicsCollideCallbacks.push({ callback: func, otherImpostors: collidedAgainstList });\r\n };\r\n /**\r\n * Unregisters the physics imposter on contact\r\n * @param collideAgainst The physics object to collide against\r\n * @param func Callback to execute on collision\r\n */\r\n PhysicsImpostor.prototype.unregisterOnPhysicsCollide = function (collideAgainst, func) {\r\n var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n var index = -1;\r\n var found = this._onPhysicsCollideCallbacks.some(function (cbDef, idx) {\r\n if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) {\r\n // chcek the arrays match\r\n var sameList = cbDef.otherImpostors.every(function (impostor) {\r\n return collidedAgainstList.indexOf(impostor) > -1;\r\n });\r\n if (sameList) {\r\n index = idx;\r\n }\r\n return sameList;\r\n }\r\n return false;\r\n });\r\n if (found) {\r\n this._onPhysicsCollideCallbacks.splice(index, 1);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_0__[\"Logger\"].Warn(\"Function to remove was not found\");\r\n }\r\n };\r\n /**\r\n * Get the parent rotation\r\n * @returns The parent rotation\r\n */\r\n PhysicsImpostor.prototype.getParentsRotation = function () {\r\n var parent = this.object.parent;\r\n this._tmpQuat.copyFromFloats(0, 0, 0, 1);\r\n while (parent) {\r\n if (parent.rotationQuaternion) {\r\n this._tmpQuat2.copyFrom(parent.rotationQuaternion);\r\n }\r\n else {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].RotationYawPitchRollToRef(parent.rotation.y, parent.rotation.x, parent.rotation.z, this._tmpQuat2);\r\n }\r\n this._tmpQuat.multiplyToRef(this._tmpQuat2, this._tmpQuat);\r\n parent = parent.parent;\r\n }\r\n return this._tmpQuat;\r\n };\r\n /**\r\n * Apply a force\r\n * @param force The force to apply\r\n * @param contactPoint The contact point for the force\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.applyForce = function (force, contactPoint) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyForce(this, force, contactPoint);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Apply an impulse\r\n * @param force The impulse force\r\n * @param contactPoint The contact point for the impulse force\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.applyImpulse = function (force, contactPoint) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyImpulse(this, force, contactPoint);\r\n }\r\n return this;\r\n };\r\n /**\r\n * A help function to create a joint\r\n * @param otherImpostor A physics imposter used to create a joint\r\n * @param jointType The type of joint\r\n * @param jointData The data for the joint\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.createJoint = function (otherImpostor, jointType, jointData) {\r\n var joint = new _physicsJoint__WEBPACK_IMPORTED_MODULE_5__[\"PhysicsJoint\"](jointType, jointData);\r\n this.addJoint(otherImpostor, joint);\r\n return this;\r\n };\r\n /**\r\n * Add a joint to this impostor with a different impostor\r\n * @param otherImpostor A physics imposter used to add a joint\r\n * @param joint The joint to add\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.addJoint = function (otherImpostor, joint) {\r\n this._joints.push({\r\n otherImpostor: otherImpostor,\r\n joint: joint\r\n });\r\n if (this._physicsEngine) {\r\n this._physicsEngine.addJoint(this, otherImpostor, joint);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add an anchor to a cloth impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param width ratio across width from 0 to 1\r\n * @param height ratio up height from 0 to 1\r\n * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between cloth impostor and anchor are ignored; default false\r\n * @returns impostor the soft imposter\r\n */\r\n PhysicsImpostor.prototype.addAnchor = function (otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies) {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendAnchor(this, otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add a hook to a rope impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param length ratio across rope from 0 to 1\r\n * @param influence the elasticity between rope impostor and anchor from 0, very stretchy to 1, little strech\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n * @returns impostor the rope imposter\r\n */\r\n PhysicsImpostor.prototype.addHook = function (otherImpostor, length, influence, noCollisionBetweenLinkedBodies) {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n var plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendHook(this, otherImpostor, length, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Will keep this body still, in a sleep mode.\r\n * @returns the physics imposter\r\n */\r\n PhysicsImpostor.prototype.sleep = function () {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().sleepBody(this);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Wake the body up.\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.wakeUp = function () {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().wakeUpBody(this);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Clones the physics imposter\r\n * @param newObject The physics imposter clones to this physics-enabled object\r\n * @returns A nullable physics imposter\r\n */\r\n PhysicsImpostor.prototype.clone = function (newObject) {\r\n if (!newObject) {\r\n return null;\r\n }\r\n return new PhysicsImpostor(newObject, this.type, this._options, this._scene);\r\n };\r\n /**\r\n * Disposes the physics imposter\r\n */\r\n PhysicsImpostor.prototype.dispose = function ( /*disposeChildren: boolean = true*/) {\r\n var _this = this;\r\n //no dispose if no physics engine is available.\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._joints.forEach(function (j) {\r\n if (_this._physicsEngine) {\r\n _this._physicsEngine.removeJoint(_this, j.otherImpostor, j.joint);\r\n }\r\n });\r\n //dispose the physics body\r\n this._physicsEngine.removeImpostor(this);\r\n if (this.parent) {\r\n this.parent.forceUpdate();\r\n }\r\n else {\r\n /*this._object.getChildMeshes().forEach(function(mesh) {\r\n if (mesh.physicsImpostor) {\r\n if (disposeChildren) {\r\n mesh.physicsImpostor.dispose();\r\n mesh.physicsImpostor = null;\r\n }\r\n }\r\n })*/\r\n }\r\n this._isDisposed = true;\r\n };\r\n /**\r\n * Sets the delta position\r\n * @param position The delta position amount\r\n */\r\n PhysicsImpostor.prototype.setDeltaPosition = function (position) {\r\n this._deltaPosition.copyFrom(position);\r\n };\r\n /**\r\n * Sets the delta rotation\r\n * @param rotation The delta rotation amount\r\n */\r\n PhysicsImpostor.prototype.setDeltaRotation = function (rotation) {\r\n if (!this._deltaRotation) {\r\n this._deltaRotation = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"]();\r\n }\r\n this._deltaRotation.copyFrom(rotation);\r\n this._deltaRotationConjugated = this._deltaRotation.conjugate();\r\n };\r\n /**\r\n * Gets the box size of the physics imposter and stores the result in the input parameter\r\n * @param result Stores the box size\r\n * @returns The physics imposter\r\n */\r\n PhysicsImpostor.prototype.getBoxSizeToRef = function (result) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this, result);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the radius of the physics imposter\r\n * @returns Radius of the physics imposter\r\n */\r\n PhysicsImpostor.prototype.getRadius = function () {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getRadius(this) : 0;\r\n };\r\n /**\r\n * Sync a bone with this impostor\r\n * @param bone The bone to sync to the impostor.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n */\r\n PhysicsImpostor.prototype.syncBoneWithImpostor = function (bone, boneMesh, jointPivot, distToJoint, adjustRotation) {\r\n var tempVec = PhysicsImpostor._tmpVecs[0];\r\n var mesh = this.object;\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n var tempQuat = PhysicsImpostor._tmpQuat;\r\n mesh.rotationQuaternion.multiplyToRef(adjustRotation, tempQuat);\r\n bone.setRotationQuaternion(tempQuat, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh);\r\n }\r\n else {\r\n bone.setRotationQuaternion(mesh.rotationQuaternion, _Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh);\r\n }\r\n }\r\n tempVec.x = 0;\r\n tempVec.y = 0;\r\n tempVec.z = 0;\r\n if (jointPivot) {\r\n tempVec.x = jointPivot.x;\r\n tempVec.y = jointPivot.y;\r\n tempVec.z = jointPivot.z;\r\n bone.getDirectionToRef(tempVec, boneMesh, tempVec);\r\n if (distToJoint === undefined || distToJoint === null) {\r\n distToJoint = jointPivot.length();\r\n }\r\n tempVec.x *= distToJoint;\r\n tempVec.y *= distToJoint;\r\n tempVec.z *= distToJoint;\r\n }\r\n if (bone.getParent()) {\r\n tempVec.addInPlace(mesh.getAbsolutePosition());\r\n bone.setAbsolutePosition(tempVec, boneMesh);\r\n }\r\n else {\r\n boneMesh.setAbsolutePosition(mesh.getAbsolutePosition());\r\n boneMesh.position.x -= tempVec.x;\r\n boneMesh.position.y -= tempVec.y;\r\n boneMesh.position.z -= tempVec.z;\r\n }\r\n };\r\n /**\r\n * Sync impostor to a bone\r\n * @param bone The bone that the impostor will be synced to.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n * @param boneAxis Optional vector3 axis the bone is aligned with\r\n */\r\n PhysicsImpostor.prototype.syncImpostorWithBone = function (bone, boneMesh, jointPivot, distToJoint, adjustRotation, boneAxis) {\r\n var mesh = this.object;\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n var tempQuat = PhysicsImpostor._tmpQuat;\r\n bone.getRotationQuaternionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh, tempQuat);\r\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\r\n }\r\n else {\r\n bone.getRotationQuaternionToRef(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_6__[\"Space\"].WORLD, boneMesh, mesh.rotationQuaternion);\r\n }\r\n }\r\n var pos = PhysicsImpostor._tmpVecs[0];\r\n var boneDir = PhysicsImpostor._tmpVecs[1];\r\n if (!boneAxis) {\r\n boneAxis = PhysicsImpostor._tmpVecs[2];\r\n boneAxis.x = 0;\r\n boneAxis.y = 1;\r\n boneAxis.z = 0;\r\n }\r\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\r\n bone.getAbsolutePositionToRef(boneMesh, pos);\r\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\r\n distToJoint = jointPivot.length();\r\n }\r\n if (distToJoint !== undefined && distToJoint !== null) {\r\n pos.x += boneDir.x * distToJoint;\r\n pos.y += boneDir.y * distToJoint;\r\n pos.z += boneDir.z * distToJoint;\r\n }\r\n mesh.setAbsolutePosition(pos);\r\n };\r\n /**\r\n * The default object size of the imposter\r\n */\r\n PhysicsImpostor.DEFAULT_OBJECT_SIZE = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"](1, 1, 1);\r\n /**\r\n * The identity quaternion of the imposter\r\n */\r\n PhysicsImpostor.IDENTITY_QUATERNION = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].Identity();\r\n PhysicsImpostor._tmpVecs = _Misc_arrayTools__WEBPACK_IMPORTED_MODULE_1__[\"ArrayTools\"].BuildArray(3, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector3\"].Zero);\r\n PhysicsImpostor._tmpQuat = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Quaternion\"].Identity();\r\n //Impostor types\r\n /**\r\n * No-Imposter type\r\n */\r\n PhysicsImpostor.NoImpostor = 0;\r\n /**\r\n * Sphere-Imposter type\r\n */\r\n PhysicsImpostor.SphereImpostor = 1;\r\n /**\r\n * Box-Imposter type\r\n */\r\n PhysicsImpostor.BoxImpostor = 2;\r\n /**\r\n * Plane-Imposter type\r\n */\r\n PhysicsImpostor.PlaneImpostor = 3;\r\n /**\r\n * Mesh-imposter type\r\n */\r\n PhysicsImpostor.MeshImpostor = 4;\r\n /**\r\n * Capsule-Impostor type (Ammo.js plugin only)\r\n */\r\n PhysicsImpostor.CapsuleImpostor = 6;\r\n /**\r\n * Cylinder-Imposter type\r\n */\r\n PhysicsImpostor.CylinderImpostor = 7;\r\n /**\r\n * Particle-Imposter type\r\n */\r\n PhysicsImpostor.ParticleImpostor = 8;\r\n /**\r\n * Heightmap-Imposter type\r\n */\r\n PhysicsImpostor.HeightmapImpostor = 9;\r\n /**\r\n * ConvexHull-Impostor type (Ammo.js plugin only)\r\n */\r\n PhysicsImpostor.ConvexHullImpostor = 10;\r\n /**\r\n * Rope-Imposter type\r\n */\r\n PhysicsImpostor.RopeImpostor = 101;\r\n /**\r\n * Cloth-Imposter type\r\n */\r\n PhysicsImpostor.ClothImpostor = 102;\r\n /**\r\n * Softbody-Imposter type\r\n */\r\n PhysicsImpostor.SoftbodyImpostor = 103;\r\n return PhysicsImpostor;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsJoint.ts\":\n/*!*********************************!*\\\n !*** ./Physics/physicsJoint.ts ***!\n \\*********************************/\n/*! exports provided: PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return PhysicsJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return DistanceJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return MotorEnabledJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return HingeJoint; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return Hinge2Joint; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * This is a holder class for the physics joint created by the physics plugin\r\n * It holds a set of functions to control the underlying joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsJoint = /** @class */ (function () {\r\n /**\r\n * Initializes the physics joint\r\n * @param type The type of the physics joint\r\n * @param jointData The data for the physics joint\r\n */\r\n function PhysicsJoint(\r\n /**\r\n * The type of the physics joint\r\n */\r\n type, \r\n /**\r\n * The data for the physics joint\r\n */\r\n jointData) {\r\n this.type = type;\r\n this.jointData = jointData;\r\n jointData.nativeParams = jointData.nativeParams || {};\r\n }\r\n Object.defineProperty(PhysicsJoint.prototype, \"physicsJoint\", {\r\n /**\r\n * Gets the physics joint\r\n */\r\n get: function () {\r\n return this._physicsJoint;\r\n },\r\n /**\r\n * Sets the physics joint\r\n */\r\n set: function (newJoint) {\r\n if (this._physicsJoint) {\r\n //remove from the wolrd\r\n }\r\n this._physicsJoint = newJoint;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsJoint.prototype, \"physicsPlugin\", {\r\n /**\r\n * Sets the physics plugin\r\n */\r\n set: function (physicsPlugin) {\r\n this._physicsPlugin = physicsPlugin;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Execute a function that is physics-plugin specific.\r\n * @param {Function} func the function that will be executed.\r\n * It accepts two parameters: the physics world and the physics joint\r\n */\r\n PhysicsJoint.prototype.executeNativeFunction = function (func) {\r\n func(this._physicsPlugin.world, this._physicsJoint);\r\n };\r\n //TODO check if the native joints are the same\r\n //Joint Types\r\n /**\r\n * Distance-Joint type\r\n */\r\n PhysicsJoint.DistanceJoint = 0;\r\n /**\r\n * Hinge-Joint type\r\n */\r\n PhysicsJoint.HingeJoint = 1;\r\n /**\r\n * Ball-and-Socket joint type\r\n */\r\n PhysicsJoint.BallAndSocketJoint = 2;\r\n /**\r\n * Wheel-Joint type\r\n */\r\n PhysicsJoint.WheelJoint = 3;\r\n /**\r\n * Slider-Joint type\r\n */\r\n PhysicsJoint.SliderJoint = 4;\r\n //OIMO\r\n /**\r\n * Prismatic-Joint type\r\n */\r\n PhysicsJoint.PrismaticJoint = 5;\r\n //\r\n /**\r\n * Universal-Joint type\r\n * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)\r\n */\r\n PhysicsJoint.UniversalJoint = 6;\r\n /**\r\n * Hinge-Joint 2 type\r\n */\r\n PhysicsJoint.Hinge2Joint = PhysicsJoint.WheelJoint;\r\n //Cannon\r\n /**\r\n * Point to Point Joint type. Similar to a Ball-Joint. Different in parameters\r\n */\r\n PhysicsJoint.PointToPointJoint = 8;\r\n //Cannon only at the moment\r\n /**\r\n * Spring-Joint type\r\n */\r\n PhysicsJoint.SpringJoint = 9;\r\n /**\r\n * Lock-Joint type\r\n */\r\n PhysicsJoint.LockJoint = 10;\r\n return PhysicsJoint;\r\n}());\r\n\r\n/**\r\n * A class representing a physics distance joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar DistanceJoint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DistanceJoint, _super);\r\n /**\r\n *\r\n * @param jointData The data for the Distance-Joint\r\n */\r\n function DistanceJoint(jointData) {\r\n return _super.call(this, PhysicsJoint.DistanceJoint, jointData) || this;\r\n }\r\n /**\r\n * Update the predefined distance.\r\n * @param maxDistance The maximum preferred distance\r\n * @param minDistance The minimum preferred distance\r\n */\r\n DistanceJoint.prototype.updateDistance = function (maxDistance, minDistance) {\r\n this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);\r\n };\r\n return DistanceJoint;\r\n}(PhysicsJoint));\r\n\r\n/**\r\n * Represents a Motor-Enabled Joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar MotorEnabledJoint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MotorEnabledJoint, _super);\r\n /**\r\n * Initializes the Motor-Enabled Joint\r\n * @param type The type of the joint\r\n * @param jointData The physica joint data for the joint\r\n */\r\n function MotorEnabledJoint(type, jointData) {\r\n return _super.call(this, type, jointData) || this;\r\n }\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param force the force to apply\r\n * @param maxForce max force for this motor.\r\n */\r\n MotorEnabledJoint.prototype.setMotor = function (force, maxForce) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n };\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n MotorEnabledJoint.prototype.setLimit = function (upperLimit, lowerLimit) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n };\r\n return MotorEnabledJoint;\r\n}(PhysicsJoint));\r\n\r\n/**\r\n * This class represents a single physics Hinge-Joint\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar HingeJoint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HingeJoint, _super);\r\n /**\r\n * Initializes the Hinge-Joint\r\n * @param jointData The joint data for the Hinge-Joint\r\n */\r\n function HingeJoint(jointData) {\r\n return _super.call(this, PhysicsJoint.HingeJoint, jointData) || this;\r\n }\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} force the force to apply\r\n * @param {number} maxForce max force for this motor.\r\n */\r\n HingeJoint.prototype.setMotor = function (force, maxForce) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n };\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n HingeJoint.prototype.setLimit = function (upperLimit, lowerLimit) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n };\r\n return HingeJoint;\r\n}(MotorEnabledJoint));\r\n\r\n/**\r\n * This class represents a dual hinge physics joint (same as wheel joint)\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar Hinge2Joint = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Hinge2Joint, _super);\r\n /**\r\n * Initializes the Hinge2-Joint\r\n * @param jointData The joint data for the Hinge2-Joint\r\n */\r\n function Hinge2Joint(jointData) {\r\n return _super.call(this, PhysicsJoint.Hinge2Joint, jointData) || this;\r\n }\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} targetSpeed the speed the motor is to reach\r\n * @param {number} maxForce max force for this motor.\r\n * @param {motorIndex} the motor's index, 0 or 1.\r\n */\r\n Hinge2Joint.prototype.setMotor = function (targetSpeed, maxForce, motorIndex) {\r\n if (motorIndex === void 0) { motorIndex = 0; }\r\n this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);\r\n };\r\n /**\r\n * Set the motor limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} upperLimit the upper limit\r\n * @param {number} lowerLimit lower limit\r\n * @param {motorIndex} the motor's index, 0 or 1.\r\n */\r\n Hinge2Joint.prototype.setLimit = function (upperLimit, lowerLimit, motorIndex) {\r\n if (motorIndex === void 0) { motorIndex = 0; }\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);\r\n };\r\n return Hinge2Joint;\r\n}(MotorEnabledJoint));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Physics/physicsRaycastResult.ts\":\n/*!*****************************************!*\\\n !*** ./Physics/physicsRaycastResult.ts ***!\n \\*****************************************/\n/*! exports provided: PhysicsRaycastResult */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRaycastResult\", function() { return PhysicsRaycastResult; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n\r\n/**\r\n * Holds the data for the raycast result\r\n * @see https://doc.babylonjs.com/how_to/using_the_physics_engine\r\n */\r\nvar PhysicsRaycastResult = /** @class */ (function () {\r\n function PhysicsRaycastResult() {\r\n this._hasHit = false;\r\n this._hitDistance = 0;\r\n this._hitNormalWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._hitPointWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._rayFromWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._rayToWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hasHit\", {\r\n /**\r\n * Gets if there was a hit\r\n */\r\n get: function () {\r\n return this._hasHit;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hitDistance\", {\r\n /**\r\n * Gets the distance from the hit\r\n */\r\n get: function () {\r\n return this._hitDistance;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hitNormalWorld\", {\r\n /**\r\n * Gets the hit normal/direction in the world\r\n */\r\n get: function () {\r\n return this._hitNormalWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"hitPointWorld\", {\r\n /**\r\n * Gets the hit point in the world\r\n */\r\n get: function () {\r\n return this._hitPointWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"rayFromWorld\", {\r\n /**\r\n * Gets the ray \"start point\" of the ray in the world\r\n */\r\n get: function () {\r\n return this._rayFromWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PhysicsRaycastResult.prototype, \"rayToWorld\", {\r\n /**\r\n * Gets the ray \"end point\" of the ray in the world\r\n */\r\n get: function () {\r\n return this._rayToWorld;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the hit data (normal & point in world space)\r\n * @param hitNormalWorld defines the normal in world space\r\n * @param hitPointWorld defines the point in world space\r\n */\r\n PhysicsRaycastResult.prototype.setHitData = function (hitNormalWorld, hitPointWorld) {\r\n this._hasHit = true;\r\n this._hitNormalWorld = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](hitNormalWorld.x, hitNormalWorld.y, hitNormalWorld.z);\r\n this._hitPointWorld = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"](hitPointWorld.x, hitPointWorld.y, hitPointWorld.z);\r\n };\r\n /**\r\n * Sets the distance from the start point to the hit point\r\n * @param distance\r\n */\r\n PhysicsRaycastResult.prototype.setHitDistance = function (distance) {\r\n this._hitDistance = distance;\r\n };\r\n /**\r\n * Calculates the distance manually\r\n */\r\n PhysicsRaycastResult.prototype.calculateHitDistance = function () {\r\n this._hitDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Distance(this._rayFromWorld, this._hitPointWorld);\r\n };\r\n /**\r\n * Resets all the values to default\r\n * @param from The from point on world space\r\n * @param to The to point on world space\r\n */\r\n PhysicsRaycastResult.prototype.reset = function (from, to) {\r\n if (from === void 0) { from = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n if (to === void 0) { to = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero(); }\r\n this._rayFromWorld = from;\r\n this._rayToWorld = to;\r\n this._hasHit = false;\r\n this._hitDistance = 0;\r\n this._hitNormalWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n this._hitPointWorld = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n };\r\n return PhysicsRaycastResult;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.ts\":\n/*!****************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.ts ***!\n \\****************************************************************************/\n/*! exports provided: DefaultRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return DefaultRenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Layers_glowLayer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Layers/glowLayer */ \"./Layers/glowLayer.ts\");\n/* harmony import */ var _PostProcesses_sharpenPostProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/sharpenPostProcess */ \"./PostProcesses/sharpenPostProcess.ts\");\n/* harmony import */ var _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/imageProcessingPostProcess */ \"./PostProcesses/imageProcessingPostProcess.ts\");\n/* harmony import */ var _PostProcesses_chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/chromaticAberrationPostProcess */ \"./PostProcesses/chromaticAberrationPostProcess.ts\");\n/* harmony import */ var _PostProcesses_grainPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../PostProcesses/grainPostProcess */ \"./PostProcesses/grainPostProcess.ts\");\n/* harmony import */ var _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../PostProcesses/fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../PostProcesses/depthOfFieldEffect */ \"./PostProcesses/depthOfFieldEffect.ts\");\n/* harmony import */ var _PostProcesses_bloomEffect__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../PostProcesses/bloomEffect */ \"./PostProcesses/bloomEffect.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The default rendering pipeline can be added to a scene to apply common post processing effects such as anti-aliasing or depth of field.\r\n * See https://doc.babylonjs.com/how_to/using_default_rendering_pipeline\r\n */\r\nvar DefaultRenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DefaultRenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n * @param name - The rendering pipeline name (default: \"\")\r\n * @param hdr - If high dynamic range textures should be used (default: true)\r\n * @param scene - The scene linked to this pipeline (default: the last created scene)\r\n * @param cameras - The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)\r\n * @param automaticBuild - if false, you will have to manually call prepare() to update the pipeline (default: true)\r\n */\r\n function DefaultRenderingPipeline(name, hdr, scene, cameras, automaticBuild) {\r\n if (name === void 0) { name = \"\"; }\r\n if (hdr === void 0) { hdr = true; }\r\n if (scene === void 0) { scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_16__[\"EngineStore\"].LastCreatedScene; }\r\n if (automaticBuild === void 0) { automaticBuild = true; }\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n _this._camerasToBeAttached = [];\r\n /**\r\n * ID of the sharpen post process,\r\n */\r\n _this.SharpenPostProcessId = \"SharpenPostProcessEffect\";\r\n /**\r\n * @ignore\r\n * ID of the image processing post process;\r\n */\r\n _this.ImageProcessingPostProcessId = \"ImageProcessingPostProcessEffect\";\r\n /**\r\n * @ignore\r\n * ID of the Fast Approximate Anti-Aliasing post process;\r\n */\r\n _this.FxaaPostProcessId = \"FxaaPostProcessEffect\";\r\n /**\r\n * ID of the chromatic aberration post process,\r\n */\r\n _this.ChromaticAberrationPostProcessId = \"ChromaticAberrationPostProcessEffect\";\r\n /**\r\n * ID of the grain post process\r\n */\r\n _this.GrainPostProcessId = \"GrainPostProcessEffect\";\r\n /**\r\n * Glow post process which adds a glow to emissive areas of the image\r\n */\r\n _this._glowLayer = null;\r\n /**\r\n * Animations which can be used to tweak settings over a period of time\r\n */\r\n _this.animations = [];\r\n _this._imageProcessingConfigurationObserver = null;\r\n // Values\r\n _this._sharpenEnabled = false;\r\n _this._bloomEnabled = false;\r\n _this._depthOfFieldEnabled = false;\r\n _this._depthOfFieldBlurLevel = _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__[\"DepthOfFieldEffectBlurLevel\"].Low;\r\n _this._fxaaEnabled = false;\r\n _this._imageProcessingEnabled = true;\r\n _this._bloomScale = 0.5;\r\n _this._chromaticAberrationEnabled = false;\r\n _this._grainEnabled = false;\r\n _this._buildAllowed = true;\r\n _this._resizeObserver = null;\r\n _this._hardwareScaleLevel = 1.0;\r\n _this._bloomKernel = 64;\r\n /**\r\n * Specifies the weight of the bloom in the final rendering\r\n */\r\n _this._bloomWeight = 0.15;\r\n /**\r\n * Specifies the luma threshold for the area that will be blurred by the bloom\r\n */\r\n _this._bloomThreshold = 0.9;\r\n _this._samples = 1;\r\n _this._hasCleared = false;\r\n _this._prevPostProcess = null;\r\n _this._prevPrevPostProcess = null;\r\n _this._depthOfFieldSceneObserver = null;\r\n _this._cameras = cameras || scene.cameras;\r\n _this._cameras = _this._cameras.slice();\r\n _this._camerasToBeAttached = _this._cameras.slice();\r\n _this._buildAllowed = automaticBuild;\r\n // Initialize\r\n _this._scene = scene;\r\n var caps = _this._scene.getEngine().getCaps();\r\n _this._hdr = hdr && (caps.textureHalfFloatRender || caps.textureFloatRender);\r\n // Misc\r\n if (_this._hdr) {\r\n if (caps.textureHalfFloatRender) {\r\n _this._defaultPipelineTextureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else if (caps.textureFloatRender) {\r\n _this._defaultPipelineTextureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n }\r\n else {\r\n _this._defaultPipelineTextureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n // Attach\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n var engine = _this._scene.getEngine();\r\n // Create post processes before hand so they can be modified before enabled.\r\n // Block compilation flag is set to true to avoid compilation prior to use, these will be updated on first use in build pipeline.\r\n _this.sharpen = new _PostProcesses_sharpenPostProcess__WEBPACK_IMPORTED_MODULE_6__[\"SharpenPostProcess\"](\"sharpen\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, _this._defaultPipelineTextureType, true);\r\n _this._sharpenEffect = new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, _this.SharpenPostProcessId, function () { return _this.sharpen; }, true);\r\n _this.depthOfField = new _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__[\"DepthOfFieldEffect\"](_this._scene, null, _this._depthOfFieldBlurLevel, _this._defaultPipelineTextureType, true);\r\n _this.bloom = new _PostProcesses_bloomEffect__WEBPACK_IMPORTED_MODULE_14__[\"BloomEffect\"](_this._scene, _this._bloomScale, _this._bloomWeight, _this.bloomKernel, _this._defaultPipelineTextureType, true);\r\n _this.chromaticAberration = new _PostProcesses_chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"ChromaticAberrationPostProcess\"](\"ChromaticAberration\", engine.getRenderWidth(), engine.getRenderHeight(), 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, _this._defaultPipelineTextureType, true);\r\n _this._chromaticAberrationEffect = new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, _this.ChromaticAberrationPostProcessId, function () { return _this.chromaticAberration; }, true);\r\n _this.grain = new _PostProcesses_grainPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"GrainPostProcess\"](\"Grain\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, _this._defaultPipelineTextureType, true);\r\n _this._grainEffect = new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, _this.GrainPostProcessId, function () { return _this.grain; }, true);\r\n _this._resizeObserver = engine.onResizeObservable.add(function () {\r\n _this._hardwareScaleLevel = engine.getHardwareScalingLevel();\r\n _this.bloomKernel = _this.bloomKernel;\r\n });\r\n _this._imageProcessingConfigurationObserver = _this._scene.imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this.bloom._downscale._exposure = _this._scene.imageProcessingConfiguration.exposure;\r\n });\r\n _this._buildPipeline();\r\n return _this;\r\n }\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"scene\", {\r\n /**\r\n * Gets active scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"sharpenEnabled\", {\r\n get: function () {\r\n return this._sharpenEnabled;\r\n },\r\n /**\r\n * Enable or disable the sharpen process from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._sharpenEnabled === enabled) {\r\n return;\r\n }\r\n this._sharpenEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomKernel\", {\r\n /**\r\n * Specifies the size of the bloom blur kernel, relative to the final output size\r\n */\r\n get: function () {\r\n return this._bloomKernel;\r\n },\r\n set: function (value) {\r\n this._bloomKernel = value;\r\n this.bloom.kernel = value / this._hardwareScaleLevel;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomWeight\", {\r\n get: function () {\r\n return this._bloomWeight;\r\n },\r\n /**\r\n * The strength of the bloom.\r\n */\r\n set: function (value) {\r\n if (this._bloomWeight === value) {\r\n return;\r\n }\r\n this.bloom.weight = value;\r\n this._bloomWeight = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomThreshold\", {\r\n get: function () {\r\n return this._bloomThreshold;\r\n },\r\n /**\r\n * The strength of the bloom.\r\n */\r\n set: function (value) {\r\n if (this._bloomThreshold === value) {\r\n return;\r\n }\r\n this.bloom.threshold = value;\r\n this._bloomThreshold = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomScale\", {\r\n get: function () {\r\n return this._bloomScale;\r\n },\r\n /**\r\n * The scale of the bloom, lower value will provide better performance.\r\n */\r\n set: function (value) {\r\n if (this._bloomScale === value) {\r\n return;\r\n }\r\n this._bloomScale = value;\r\n // recreate bloom and dispose old as this setting is not dynamic\r\n this._rebuildBloom();\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"bloomEnabled\", {\r\n get: function () {\r\n return this._bloomEnabled;\r\n },\r\n /**\r\n * Enable or disable the bloom from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._bloomEnabled === enabled) {\r\n return;\r\n }\r\n this._bloomEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n DefaultRenderingPipeline.prototype._rebuildBloom = function () {\r\n // recreate bloom and dispose old as this setting is not dynamic\r\n var oldBloom = this.bloom;\r\n this.bloom = new _PostProcesses_bloomEffect__WEBPACK_IMPORTED_MODULE_14__[\"BloomEffect\"](this._scene, this.bloomScale, this._bloomWeight, this.bloomKernel, this._defaultPipelineTextureType, false);\r\n this.bloom.threshold = oldBloom.threshold;\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n oldBloom.disposeEffects(this._cameras[i]);\r\n }\r\n };\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"depthOfFieldEnabled\", {\r\n /**\r\n * If the depth of field is enabled.\r\n */\r\n get: function () {\r\n return this._depthOfFieldEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._depthOfFieldEnabled === enabled) {\r\n return;\r\n }\r\n this._depthOfFieldEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"depthOfFieldBlurLevel\", {\r\n /**\r\n * Blur level of the depth of field effect. (Higher blur will effect performance)\r\n */\r\n get: function () {\r\n return this._depthOfFieldBlurLevel;\r\n },\r\n set: function (value) {\r\n if (this._depthOfFieldBlurLevel === value) {\r\n return;\r\n }\r\n this._depthOfFieldBlurLevel = value;\r\n // recreate dof and dispose old as this setting is not dynamic\r\n var oldDof = this.depthOfField;\r\n this.depthOfField = new _PostProcesses_depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_13__[\"DepthOfFieldEffect\"](this._scene, null, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType, false);\r\n this.depthOfField.focalLength = oldDof.focalLength;\r\n this.depthOfField.focusDistance = oldDof.focusDistance;\r\n this.depthOfField.fStop = oldDof.fStop;\r\n this.depthOfField.lensSize = oldDof.lensSize;\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n oldDof.disposeEffects(this._cameras[i]);\r\n }\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"fxaaEnabled\", {\r\n get: function () {\r\n return this._fxaaEnabled;\r\n },\r\n /**\r\n * If the anti aliasing is enabled.\r\n */\r\n set: function (enabled) {\r\n if (this._fxaaEnabled === enabled) {\r\n return;\r\n }\r\n this._fxaaEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"samples\", {\r\n get: function () {\r\n return this._samples;\r\n },\r\n /**\r\n * MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)\r\n */\r\n set: function (sampleCount) {\r\n if (this._samples === sampleCount) {\r\n return;\r\n }\r\n this._samples = sampleCount;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"imageProcessingEnabled\", {\r\n get: function () {\r\n return this._imageProcessingEnabled;\r\n },\r\n /**\r\n * If image processing is enabled.\r\n */\r\n set: function (enabled) {\r\n if (this._imageProcessingEnabled === enabled) {\r\n return;\r\n }\r\n this._imageProcessingEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"glowLayerEnabled\", {\r\n get: function () {\r\n return this._glowLayer != null;\r\n },\r\n /**\r\n * If glow layer is enabled. (Adds a glow effect to emmissive materials)\r\n */\r\n set: function (enabled) {\r\n if (enabled && !this._glowLayer) {\r\n this._glowLayer = new _Layers_glowLayer__WEBPACK_IMPORTED_MODULE_5__[\"GlowLayer\"](\"\", this._scene);\r\n }\r\n else if (!enabled && this._glowLayer) {\r\n this._glowLayer.dispose();\r\n this._glowLayer = null;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"glowLayer\", {\r\n /**\r\n * Gets the glow layer (or null if not defined)\r\n */\r\n get: function () {\r\n return this._glowLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"chromaticAberrationEnabled\", {\r\n get: function () {\r\n return this._chromaticAberrationEnabled;\r\n },\r\n /**\r\n * Enable or disable the chromaticAberration process from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._chromaticAberrationEnabled === enabled) {\r\n return;\r\n }\r\n this._chromaticAberrationEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DefaultRenderingPipeline.prototype, \"grainEnabled\", {\r\n get: function () {\r\n return this._grainEnabled;\r\n },\r\n /**\r\n * Enable or disable the grain process from the pipeline\r\n */\r\n set: function (enabled) {\r\n if (this._grainEnabled === enabled) {\r\n return;\r\n }\r\n this._grainEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the class name\r\n * @returns \"DefaultRenderingPipeline\"\r\n */\r\n DefaultRenderingPipeline.prototype.getClassName = function () {\r\n return \"DefaultRenderingPipeline\";\r\n };\r\n /**\r\n * Force the compilation of the entire pipeline.\r\n */\r\n DefaultRenderingPipeline.prototype.prepare = function () {\r\n var previousState = this._buildAllowed;\r\n this._buildAllowed = true;\r\n this._buildPipeline();\r\n this._buildAllowed = previousState;\r\n };\r\n DefaultRenderingPipeline.prototype._setAutoClearAndTextureSharing = function (postProcess, skipTextureSharing) {\r\n if (skipTextureSharing === void 0) { skipTextureSharing = false; }\r\n if (this._hasCleared) {\r\n postProcess.autoClear = false;\r\n }\r\n else {\r\n postProcess.autoClear = true;\r\n this._scene.autoClear = false;\r\n this._hasCleared = true;\r\n }\r\n if (!skipTextureSharing) {\r\n if (this._prevPrevPostProcess) {\r\n postProcess.shareOutputWith(this._prevPrevPostProcess);\r\n }\r\n else {\r\n postProcess.useOwnOutput();\r\n }\r\n if (this._prevPostProcess) {\r\n this._prevPrevPostProcess = this._prevPostProcess;\r\n }\r\n this._prevPostProcess = postProcess;\r\n }\r\n };\r\n DefaultRenderingPipeline.prototype._buildPipeline = function () {\r\n var _this = this;\r\n if (!this._buildAllowed) {\r\n return;\r\n }\r\n this._scene.autoClear = true;\r\n var engine = this._scene.getEngine();\r\n this._disposePostProcesses();\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n // get back cameras to be used to reattach pipeline\r\n this._cameras = this._camerasToBeAttached.slice();\r\n }\r\n this._reset();\r\n this._prevPostProcess = null;\r\n this._prevPrevPostProcess = null;\r\n this._hasCleared = false;\r\n if (this.depthOfFieldEnabled) {\r\n // Multi camera suport\r\n if (this._cameras.length > 1) {\r\n for (var _i = 0, _a = this._cameras; _i < _a.length; _i++) {\r\n var camera = _a[_i];\r\n var depthRenderer = this._scene.enableDepthRenderer(camera);\r\n depthRenderer.useOnlyInActiveCamera = true;\r\n }\r\n this._depthOfFieldSceneObserver = this._scene.onAfterRenderTargetsRenderObservable.add(function (scene) {\r\n if (_this._cameras.indexOf(scene.activeCamera) > -1) {\r\n _this.depthOfField.depthTexture = scene.enableDepthRenderer(scene.activeCamera).getDepthMap();\r\n }\r\n });\r\n }\r\n else {\r\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\r\n var depthRenderer = this._scene.enableDepthRenderer(this._cameras[0]);\r\n this.depthOfField.depthTexture = depthRenderer.getDepthMap();\r\n }\r\n if (!this.depthOfField._isReady()) {\r\n this.depthOfField._updateEffects();\r\n }\r\n this.addEffect(this.depthOfField);\r\n this._setAutoClearAndTextureSharing(this.depthOfField._effects[0], true);\r\n }\r\n else {\r\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\r\n }\r\n if (this.bloomEnabled) {\r\n if (!this.bloom._isReady()) {\r\n this.bloom._updateEffects();\r\n }\r\n this.addEffect(this.bloom);\r\n this._setAutoClearAndTextureSharing(this.bloom._effects[0], true);\r\n }\r\n if (this._imageProcessingEnabled) {\r\n this.imageProcessing = new _PostProcesses_imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"ImageProcessingPostProcess\"](\"imageProcessing\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType);\r\n if (this._hdr) {\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, this.ImageProcessingPostProcessId, function () { return _this.imageProcessing; }, true));\r\n this._setAutoClearAndTextureSharing(this.imageProcessing);\r\n }\r\n else {\r\n this._scene.imageProcessingConfiguration.applyByPostProcess = false;\r\n }\r\n }\r\n if (this.sharpenEnabled) {\r\n if (!this.sharpen.isReady()) {\r\n this.sharpen.updateEffect();\r\n }\r\n this.addEffect(this._sharpenEffect);\r\n this._setAutoClearAndTextureSharing(this.sharpen);\r\n }\r\n if (this.grainEnabled) {\r\n if (!this.grain.isReady()) {\r\n this.grain.updateEffect();\r\n }\r\n this.addEffect(this._grainEffect);\r\n this._setAutoClearAndTextureSharing(this.grain);\r\n }\r\n if (this.chromaticAberrationEnabled) {\r\n if (!this.chromaticAberration.isReady()) {\r\n this.chromaticAberration.updateEffect();\r\n }\r\n this.addEffect(this._chromaticAberrationEffect);\r\n this._setAutoClearAndTextureSharing(this.chromaticAberration);\r\n }\r\n if (this.fxaaEnabled) {\r\n this.fxaa = new _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"FxaaPostProcess\"](\"fxaa\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_12__[\"PostProcessRenderEffect\"](engine, this.FxaaPostProcessId, function () { return _this.fxaa; }, true));\r\n this._setAutoClearAndTextureSharing(this.fxaa, true);\r\n }\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\r\n }\r\n // In multicamera mode, the scene needs to autoclear in between cameras.\r\n if (this._scene.activeCameras && this._scene.activeCameras.length > 1) {\r\n this._scene.autoClear = true;\r\n }\r\n if (!this._enableMSAAOnFirstPostProcess(this.samples) && this.samples > 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\");\r\n }\r\n };\r\n DefaultRenderingPipeline.prototype._disposePostProcesses = function (disposeNonRecreated) {\r\n if (disposeNonRecreated === void 0) { disposeNonRecreated = false; }\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n var camera = this._cameras[i];\r\n if (this.imageProcessing) {\r\n this.imageProcessing.dispose(camera);\r\n }\r\n if (this.fxaa) {\r\n this.fxaa.dispose(camera);\r\n }\r\n // These are created in the constructor and should not be disposed on every pipeline change\r\n if (disposeNonRecreated) {\r\n if (this.sharpen) {\r\n this.sharpen.dispose(camera);\r\n }\r\n if (this.depthOfField) {\r\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\r\n this.depthOfField.disposeEffects(camera);\r\n }\r\n if (this.bloom) {\r\n this.bloom.disposeEffects(camera);\r\n }\r\n if (this.chromaticAberration) {\r\n this.chromaticAberration.dispose(camera);\r\n }\r\n if (this.grain) {\r\n this.grain.dispose(camera);\r\n }\r\n if (this._glowLayer) {\r\n this._glowLayer.dispose();\r\n }\r\n }\r\n }\r\n this.imageProcessing = null;\r\n this.fxaa = null;\r\n if (disposeNonRecreated) {\r\n this.sharpen = null;\r\n this._sharpenEffect = null;\r\n this.depthOfField = null;\r\n this.bloom = null;\r\n this.chromaticAberration = null;\r\n this._chromaticAberrationEffect = null;\r\n this.grain = null;\r\n this._grainEffect = null;\r\n this._glowLayer = null;\r\n }\r\n };\r\n /**\r\n * Adds a camera to the pipeline\r\n * @param camera the camera to be added\r\n */\r\n DefaultRenderingPipeline.prototype.addCamera = function (camera) {\r\n this._camerasToBeAttached.push(camera);\r\n this._buildPipeline();\r\n };\r\n /**\r\n * Removes a camera from the pipeline\r\n * @param camera the camera to remove\r\n */\r\n DefaultRenderingPipeline.prototype.removeCamera = function (camera) {\r\n var index = this._camerasToBeAttached.indexOf(camera);\r\n this._camerasToBeAttached.splice(index, 1);\r\n this._buildPipeline();\r\n };\r\n /**\r\n * Dispose of the pipeline and stop all post processes\r\n */\r\n DefaultRenderingPipeline.prototype.dispose = function () {\r\n this._disposePostProcesses(true);\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n this._scene.autoClear = true;\r\n if (this._resizeObserver) {\r\n this._scene.getEngine().onResizeObservable.remove(this._resizeObserver);\r\n this._resizeObserver = null;\r\n }\r\n this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver);\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Serialize the rendering pipeline (Used when exporting)\r\n * @returns the serialized object\r\n */\r\n DefaultRenderingPipeline.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"DefaultRenderingPipeline\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the serialized pipeline\r\n * @param source Source pipeline.\r\n * @param scene The scene to load the pipeline to.\r\n * @param rootUrl The URL of the serialized pipeline.\r\n * @returns An instantiated pipeline from the serialized object.\r\n */\r\n DefaultRenderingPipeline.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new DefaultRenderingPipeline(source._name, source._name._hdr, scene); }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"sharpenEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomKernel\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"_bloomWeight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"_bloomThreshold\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"_hdr\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomWeight\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomThreshold\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomScale\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"bloomEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"depthOfFieldEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"depthOfFieldBlurLevel\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"fxaaEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"samples\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"imageProcessingEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"glowLayerEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"chromaticAberrationEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], DefaultRenderingPipeline.prototype, \"grainEnabled\", null);\r\n return DefaultRenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_11__[\"PostProcessRenderPipeline\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_15__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.DefaultRenderingPipeline\"] = DefaultRenderingPipeline;\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/index.ts\":\n/*!*********************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/index.ts ***!\n \\*********************************************************/\n/*! exports provided: DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _defaultRenderingPipeline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _defaultRenderingPipeline__WEBPACK_IMPORTED_MODULE_0__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony import */ var _lensRenderingPipeline__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lensRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _lensRenderingPipeline__WEBPACK_IMPORTED_MODULE_1__[\"LensRenderingPipeline\"]; });\n\n/* harmony import */ var _ssao2RenderingPipeline__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ssao2RenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _ssao2RenderingPipeline__WEBPACK_IMPORTED_MODULE_2__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony import */ var _ssaoRenderingPipeline__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ssaoRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _ssaoRenderingPipeline__WEBPACK_IMPORTED_MODULE_3__[\"SSAORenderingPipeline\"]; });\n\n/* harmony import */ var _standardRenderingPipeline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./standardRenderingPipeline */ \"./PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _standardRenderingPipeline__WEBPACK_IMPORTED_MODULE_4__[\"StandardRenderingPipeline\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.ts\":\n/*!*************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.ts ***!\n \\*************************************************************************/\n/*! exports provided: LensRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return LensRenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_chromaticAberration_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../Shaders/chromaticAberration.fragment */ \"./Shaders/chromaticAberration.fragment.ts\");\n/* harmony import */ var _Shaders_lensHighlights_fragment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../Shaders/lensHighlights.fragment */ \"./Shaders/lensHighlights.fragment.ts\");\n/* harmony import */ var _Shaders_depthOfField_fragment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Shaders/depthOfField.fragment */ \"./Shaders/depthOfField.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * BABYLON.JS Chromatic Aberration GLSL Shader\r\n * Author: Olivier Guyot\r\n * Separates very slightly R, G and B colors on the edges of the screen\r\n * Inspired by Francois Tarlier & Martins Upitis\r\n */\r\nvar LensRenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LensRenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n *\r\n * Effect parameters are as follow:\r\n * {\r\n * chromatic_aberration: number; // from 0 to x (1 for realism)\r\n * edge_blur: number; // from 0 to x (1 for realism)\r\n * distortion: number; // from 0 to x (1 for realism)\r\n * grain_amount: number; // from 0 to 1\r\n * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise\r\n * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default)\r\n * dof_aperture: number; // depth-of-field: focus blur bias (default: 1)\r\n * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default)\r\n * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like \"bokeh\" effect\r\n * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default)\r\n * dof_threshold: number; // depth-of-field: highlights threshold (default: 1)\r\n * blur_noise: boolean; // add a little bit of noise to the blur (default: true)\r\n * }\r\n * Note: if an effect parameter is unset, effect is disabled\r\n *\r\n * @param name The rendering pipeline name\r\n * @param parameters - An object containing all parameters (see above)\r\n * @param scene The scene linked to this pipeline\r\n * @param ratio The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)\r\n * @param cameras The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function LensRenderingPipeline(name, parameters, scene, ratio, cameras) {\r\n if (ratio === void 0) { ratio = 1.0; }\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n // Lens effects can be of the following:\r\n // - chromatic aberration (slight shift of RGB colors)\r\n // - blur on the edge of the lens\r\n // - lens distortion\r\n // - depth-of-field blur & highlights enhancing\r\n // - depth-of-field 'bokeh' effect (shapes appearing in blurred areas)\r\n // - grain effect (noise or custom texture)\r\n // Two additional texture samplers are needed:\r\n // - depth map (for depth-of-field)\r\n // - grain texture\r\n /**\r\n * @ignore\r\n * The chromatic aberration PostProcess id in the pipeline\r\n */\r\n _this.LensChromaticAberrationEffect = \"LensChromaticAberrationEffect\";\r\n /**\r\n * @ignore\r\n * The highlights enhancing PostProcess id in the pipeline\r\n */\r\n _this.HighlightsEnhancingEffect = \"HighlightsEnhancingEffect\";\r\n /**\r\n * @ignore\r\n * The depth-of-field PostProcess id in the pipeline\r\n */\r\n _this.LensDepthOfFieldEffect = \"LensDepthOfFieldEffect\";\r\n _this._pentagonBokehIsEnabled = false;\r\n _this._scene = scene;\r\n // Fetch texture samplers\r\n _this._depthTexture = scene.enableDepthRenderer().getDepthMap(); // Force depth renderer \"on\"\r\n if (parameters.grain_texture) {\r\n _this._grainTexture = parameters.grain_texture;\r\n }\r\n else {\r\n _this._createGrainTexture();\r\n }\r\n // save parameters\r\n _this._edgeBlur = parameters.edge_blur ? parameters.edge_blur : 0;\r\n _this._grainAmount = parameters.grain_amount ? parameters.grain_amount : 0;\r\n _this._chromaticAberration = parameters.chromatic_aberration ? parameters.chromatic_aberration : 0;\r\n _this._distortion = parameters.distortion ? parameters.distortion : 0;\r\n _this._highlightsGain = parameters.dof_gain !== undefined ? parameters.dof_gain : -1;\r\n _this._highlightsThreshold = parameters.dof_threshold ? parameters.dof_threshold : 1;\r\n _this._dofDistance = parameters.dof_focus_distance !== undefined ? parameters.dof_focus_distance : -1;\r\n _this._dofAperture = parameters.dof_aperture ? parameters.dof_aperture : 1;\r\n _this._dofDarken = parameters.dof_darken ? parameters.dof_darken : 0;\r\n _this._dofPentagon = parameters.dof_pentagon !== undefined ? parameters.dof_pentagon : true;\r\n _this._blurNoise = parameters.blur_noise !== undefined ? parameters.blur_noise : true;\r\n // Create effects\r\n _this._createChromaticAberrationPostProcess(ratio);\r\n _this._createHighlightsPostProcess(ratio);\r\n _this._createDepthOfFieldPostProcess(ratio / 4);\r\n // Set up pipeline\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.LensChromaticAberrationEffect, function () { return _this._chromaticAberrationPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.HighlightsEnhancingEffect, function () { return _this._highlightsPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.LensDepthOfFieldEffect, function () { return _this._depthOfFieldPostProcess; }, true));\r\n if (_this._highlightsGain === -1) {\r\n _this._disableEffect(_this.HighlightsEnhancingEffect, null);\r\n }\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n if (cameras) {\r\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Get the class name\r\n * @returns \"LensRenderingPipeline\"\r\n */\r\n LensRenderingPipeline.prototype.getClassName = function () {\r\n return \"LensRenderingPipeline\";\r\n };\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"scene\", {\r\n // Properties\r\n /**\r\n * Gets associated scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"edgeBlur\", {\r\n /**\r\n * Gets or sets the edge blur\r\n */\r\n get: function () {\r\n return this._edgeBlur;\r\n },\r\n set: function (value) {\r\n this.setEdgeBlur(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"grainAmount\", {\r\n /**\r\n * Gets or sets the grain amount\r\n */\r\n get: function () {\r\n return this._grainAmount;\r\n },\r\n set: function (value) {\r\n this.setGrainAmount(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"chromaticAberration\", {\r\n /**\r\n * Gets or sets the chromatic aberration amount\r\n */\r\n get: function () {\r\n return this._chromaticAberration;\r\n },\r\n set: function (value) {\r\n this.setChromaticAberration(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"dofAperture\", {\r\n /**\r\n * Gets or sets the depth of field aperture\r\n */\r\n get: function () {\r\n return this._dofAperture;\r\n },\r\n set: function (value) {\r\n this.setAperture(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"edgeDistortion\", {\r\n /**\r\n * Gets or sets the edge distortion\r\n */\r\n get: function () {\r\n return this._distortion;\r\n },\r\n set: function (value) {\r\n this.setEdgeDistortion(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"dofDistortion\", {\r\n /**\r\n * Gets or sets the depth of field distortion\r\n */\r\n get: function () {\r\n return this._dofDistance;\r\n },\r\n set: function (value) {\r\n this.setFocusDistance(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"darkenOutOfFocus\", {\r\n /**\r\n * Gets or sets the darken out of focus amount\r\n */\r\n get: function () {\r\n return this._dofDarken;\r\n },\r\n set: function (value) {\r\n this.setDarkenOutOfFocus(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"blurNoise\", {\r\n /**\r\n * Gets or sets a boolean indicating if blur noise is enabled\r\n */\r\n get: function () {\r\n return this._blurNoise;\r\n },\r\n set: function (value) {\r\n this._blurNoise = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"pentagonBokeh\", {\r\n /**\r\n * Gets or sets a boolean indicating if pentagon bokeh is enabled\r\n */\r\n get: function () {\r\n return this._pentagonBokehIsEnabled;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n this.enablePentagonBokeh();\r\n }\r\n else {\r\n this.disablePentagonBokeh();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"highlightsGain\", {\r\n /**\r\n * Gets or sets the highlight grain amount\r\n */\r\n get: function () {\r\n return this._highlightsGain;\r\n },\r\n set: function (value) {\r\n this.setHighlightsGain(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(LensRenderingPipeline.prototype, \"highlightsThreshold\", {\r\n /**\r\n * Gets or sets the highlight threshold\r\n */\r\n get: function () {\r\n return this._highlightsThreshold;\r\n },\r\n set: function (value) {\r\n this.setHighlightsThreshold(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // public methods (self explanatory)\r\n /**\r\n * Sets the amount of blur at the edges\r\n * @param amount blur amount\r\n */\r\n LensRenderingPipeline.prototype.setEdgeBlur = function (amount) { this._edgeBlur = amount; };\r\n /**\r\n * Sets edge blur to 0\r\n */\r\n LensRenderingPipeline.prototype.disableEdgeBlur = function () { this._edgeBlur = 0; };\r\n /**\r\n * Sets the amout of grain\r\n * @param amount Amount of grain\r\n */\r\n LensRenderingPipeline.prototype.setGrainAmount = function (amount) { this._grainAmount = amount; };\r\n /**\r\n * Set grain amount to 0\r\n */\r\n LensRenderingPipeline.prototype.disableGrain = function () { this._grainAmount = 0; };\r\n /**\r\n * Sets the chromatic aberration amount\r\n * @param amount amount of chromatic aberration\r\n */\r\n LensRenderingPipeline.prototype.setChromaticAberration = function (amount) { this._chromaticAberration = amount; };\r\n /**\r\n * Sets chromatic aberration amount to 0\r\n */\r\n LensRenderingPipeline.prototype.disableChromaticAberration = function () { this._chromaticAberration = 0; };\r\n /**\r\n * Sets the EdgeDistortion amount\r\n * @param amount amount of EdgeDistortion\r\n */\r\n LensRenderingPipeline.prototype.setEdgeDistortion = function (amount) { this._distortion = amount; };\r\n /**\r\n * Sets edge distortion to 0\r\n */\r\n LensRenderingPipeline.prototype.disableEdgeDistortion = function () { this._distortion = 0; };\r\n /**\r\n * Sets the FocusDistance amount\r\n * @param amount amount of FocusDistance\r\n */\r\n LensRenderingPipeline.prototype.setFocusDistance = function (amount) { this._dofDistance = amount; };\r\n /**\r\n * Disables depth of field\r\n */\r\n LensRenderingPipeline.prototype.disableDepthOfField = function () { this._dofDistance = -1; };\r\n /**\r\n * Sets the Aperture amount\r\n * @param amount amount of Aperture\r\n */\r\n LensRenderingPipeline.prototype.setAperture = function (amount) { this._dofAperture = amount; };\r\n /**\r\n * Sets the DarkenOutOfFocus amount\r\n * @param amount amount of DarkenOutOfFocus\r\n */\r\n LensRenderingPipeline.prototype.setDarkenOutOfFocus = function (amount) { this._dofDarken = amount; };\r\n /**\r\n * Creates a pentagon bokeh effect\r\n */\r\n LensRenderingPipeline.prototype.enablePentagonBokeh = function () {\r\n this._highlightsPostProcess.updateEffect(\"#define PENTAGON\\n\");\r\n this._pentagonBokehIsEnabled = true;\r\n };\r\n /**\r\n * Disables the pentagon bokeh effect\r\n */\r\n LensRenderingPipeline.prototype.disablePentagonBokeh = function () {\r\n this._pentagonBokehIsEnabled = false;\r\n this._highlightsPostProcess.updateEffect();\r\n };\r\n /**\r\n * Enables noise blur\r\n */\r\n LensRenderingPipeline.prototype.enableNoiseBlur = function () { this._blurNoise = true; };\r\n /**\r\n * Disables noise blur\r\n */\r\n LensRenderingPipeline.prototype.disableNoiseBlur = function () { this._blurNoise = false; };\r\n /**\r\n * Sets the HighlightsGain amount\r\n * @param amount amount of HighlightsGain\r\n */\r\n LensRenderingPipeline.prototype.setHighlightsGain = function (amount) {\r\n this._highlightsGain = amount;\r\n };\r\n /**\r\n * Sets the HighlightsThreshold amount\r\n * @param amount amount of HighlightsThreshold\r\n */\r\n LensRenderingPipeline.prototype.setHighlightsThreshold = function (amount) {\r\n if (this._highlightsGain === -1) {\r\n this._highlightsGain = 1.0;\r\n }\r\n this._highlightsThreshold = amount;\r\n };\r\n /**\r\n * Disables highlights\r\n */\r\n LensRenderingPipeline.prototype.disableHighlights = function () {\r\n this._highlightsGain = -1;\r\n };\r\n /**\r\n * Removes the internal pipeline assets and detaches the pipeline from the scene cameras\r\n * @param disableDepthRender If the scens depth rendering should be disabled (default: false)\r\n */\r\n LensRenderingPipeline.prototype.dispose = function (disableDepthRender) {\r\n if (disableDepthRender === void 0) { disableDepthRender = false; }\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\r\n this._chromaticAberrationPostProcess = null;\r\n this._highlightsPostProcess = null;\r\n this._depthOfFieldPostProcess = null;\r\n this._grainTexture.dispose();\r\n if (disableDepthRender) {\r\n this._scene.disableDepthRenderer();\r\n }\r\n };\r\n // colors shifting and distortion\r\n LensRenderingPipeline.prototype._createChromaticAberrationPostProcess = function (ratio) {\r\n var _this = this;\r\n this._chromaticAberrationPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"](\"LensChromaticAberration\", \"chromaticAberration\", [\"chromatic_aberration\", \"screen_width\", \"screen_height\", \"direction\", \"radialIntensity\", \"centerPosition\"], // uniforms\r\n [], // samplers\r\n ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._chromaticAberrationPostProcess.onApply = function (effect) {\r\n effect.setFloat('chromatic_aberration', _this._chromaticAberration);\r\n effect.setFloat('screen_width', _this._scene.getEngine().getRenderWidth());\r\n effect.setFloat('screen_height', _this._scene.getEngine().getRenderHeight());\r\n effect.setFloat('radialIntensity', 1);\r\n effect.setFloat2('direction', 17, 17);\r\n effect.setFloat2('centerPosition', 0.5, 0.5);\r\n };\r\n };\r\n // highlights enhancing\r\n LensRenderingPipeline.prototype._createHighlightsPostProcess = function (ratio) {\r\n var _this = this;\r\n this._highlightsPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"](\"LensHighlights\", \"lensHighlights\", [\"gain\", \"threshold\", \"screen_width\", \"screen_height\"], // uniforms\r\n [], // samplers\r\n ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, this._dofPentagon ? \"#define PENTAGON\\n\" : \"\");\r\n this._highlightsPostProcess.onApply = function (effect) {\r\n effect.setFloat('gain', _this._highlightsGain);\r\n effect.setFloat('threshold', _this._highlightsThreshold);\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._chromaticAberrationPostProcess);\r\n effect.setFloat('screen_width', _this._scene.getEngine().getRenderWidth());\r\n effect.setFloat('screen_height', _this._scene.getEngine().getRenderHeight());\r\n };\r\n };\r\n // colors shifting and distortion\r\n LensRenderingPipeline.prototype._createDepthOfFieldPostProcess = function (ratio) {\r\n var _this = this;\r\n this._depthOfFieldPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"](\"LensDepthOfField\", \"depthOfField\", [\r\n \"grain_amount\", \"blur_noise\", \"screen_width\", \"screen_height\", \"distortion\", \"dof_enabled\",\r\n \"screen_distance\", \"aperture\", \"darken\", \"edge_blur\", \"highlights\", \"near\", \"far\"\r\n ], [\"depthSampler\", \"grainSampler\", \"highlightsSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._depthOfFieldPostProcess.onApply = function (effect) {\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n effect.setTexture(\"grainSampler\", _this._grainTexture);\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._highlightsPostProcess);\r\n effect.setTextureFromPostProcess(\"highlightsSampler\", _this._depthOfFieldPostProcess);\r\n effect.setFloat('grain_amount', _this._grainAmount);\r\n effect.setBool('blur_noise', _this._blurNoise);\r\n effect.setFloat('screen_width', _this._scene.getEngine().getRenderWidth());\r\n effect.setFloat('screen_height', _this._scene.getEngine().getRenderHeight());\r\n effect.setFloat('distortion', _this._distortion);\r\n effect.setBool('dof_enabled', (_this._dofDistance !== -1));\r\n effect.setFloat('screen_distance', 1.0 / (0.1 - 1.0 / _this._dofDistance));\r\n effect.setFloat('aperture', _this._dofAperture);\r\n effect.setFloat('darken', _this._dofDarken);\r\n effect.setFloat('edge_blur', _this._edgeBlur);\r\n effect.setBool('highlights', (_this._highlightsGain !== -1));\r\n if (_this._scene.activeCamera) {\r\n effect.setFloat('near', _this._scene.activeCamera.minZ);\r\n effect.setFloat('far', _this._scene.activeCamera.maxZ);\r\n }\r\n };\r\n };\r\n // creates a black and white random noise texture, 512x512\r\n LensRenderingPipeline.prototype._createGrainTexture = function () {\r\n var size = 512;\r\n this._grainTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_2__[\"DynamicTexture\"](\"LensNoiseTexture\", size, this._scene, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE);\r\n this._grainTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].WRAP_ADDRESSMODE;\r\n this._grainTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].WRAP_ADDRESSMODE;\r\n var context = this._grainTexture.getContext();\r\n var rand = function (min, max) {\r\n return Math.random() * (max - min) + min;\r\n };\r\n var value;\r\n for (var x = 0; x < size; x++) {\r\n for (var y = 0; y < size; y++) {\r\n value = Math.floor(rand(0.42, 0.58) * 255);\r\n context.fillStyle = 'rgb(' + value + ', ' + value + ', ' + value + ')';\r\n context.fillRect(x, y, 1, 1);\r\n }\r\n }\r\n this._grainTexture.update(false);\r\n };\r\n return LensRenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_4__[\"PostProcessRenderPipeline\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.ts\":\n/*!**************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.ts ***!\n \\**************************************************************************/\n/*! exports provided: SSAO2RenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return SSAO2RenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_ssao2_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../Shaders/ssao2.fragment */ \"./Shaders/ssao2.fragment.ts\");\n/* harmony import */ var _Shaders_ssaoCombine_fragment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../Shaders/ssaoCombine.fragment */ \"./Shaders/ssaoCombine.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Render pipeline to produce ssao effect\r\n */\r\nvar SSAO2RenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SSAO2RenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n * @param name The rendering pipeline name\r\n * @param scene The scene linked to this pipeline\r\n * @param ratio The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, blurRatio: 1.0 }\r\n * @param cameras The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function SSAO2RenderingPipeline(name, scene, ratio, cameras) {\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n // Members\r\n /**\r\n * @ignore\r\n * The PassPostProcess id in the pipeline that contains the original scene color\r\n */\r\n _this.SSAOOriginalSceneColorEffect = \"SSAOOriginalSceneColorEffect\";\r\n /**\r\n * @ignore\r\n * The SSAO PostProcess id in the pipeline\r\n */\r\n _this.SSAORenderEffect = \"SSAORenderEffect\";\r\n /**\r\n * @ignore\r\n * The horizontal blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurHRenderEffect = \"SSAOBlurHRenderEffect\";\r\n /**\r\n * @ignore\r\n * The vertical blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurVRenderEffect = \"SSAOBlurVRenderEffect\";\r\n /**\r\n * @ignore\r\n * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)\r\n */\r\n _this.SSAOCombineRenderEffect = \"SSAOCombineRenderEffect\";\r\n /**\r\n * The output strength of the SSAO post-process. Default value is 1.0.\r\n */\r\n _this.totalStrength = 1.0;\r\n /**\r\n * Maximum depth value to still render AO. A smooth falloff makes the dimming more natural, so there will be no abrupt shading change.\r\n */\r\n _this.maxZ = 100.0;\r\n /**\r\n * In order to save performances, SSAO radius is clamped on close geometry. This ratio changes by how much\r\n */\r\n _this.minZAspect = 0.2;\r\n _this._samples = 8;\r\n _this._textureSamples = 1;\r\n _this._expensiveBlur = true;\r\n /**\r\n * The radius around the analyzed pixel used by the SSAO post-process. Default value is 2.0\r\n */\r\n _this.radius = 2.0;\r\n /**\r\n * The base color of the SSAO post-process\r\n * The final result is \"base + ssao\" between [0, 1]\r\n */\r\n _this.base = 0;\r\n _this._firstUpdate = true;\r\n _this._bits = new Uint32Array(1);\r\n _this._scene = scene;\r\n _this._ratio = ratio;\r\n if (!_this.isSupported) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Error(\"SSAO 2 needs WebGL 2 support.\");\r\n return _this;\r\n }\r\n var ssaoRatio = _this._ratio.ssaoRatio || ratio;\r\n var blurRatio = _this._ratio.blurRatio || ratio;\r\n // Set up assets\r\n var geometryBufferRenderer = scene.enableGeometryBufferRenderer();\r\n _this._createRandomTexture();\r\n _this._depthTexture = geometryBufferRenderer.getGBuffer().textures[0];\r\n _this._normalTexture = geometryBufferRenderer.getGBuffer().textures[1];\r\n _this._originalColorPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"PassPostProcess\"](\"SSAOOriginalSceneColor\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false);\r\n _this._originalColorPostProcess.samples = _this.textureSamples;\r\n _this._createSSAOPostProcess(1.0);\r\n _this._createBlurPostProcess(ssaoRatio, blurRatio);\r\n _this._createSSAOCombinePostProcess(blurRatio);\r\n // Set up pipeline\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOOriginalSceneColorEffect, function () { return _this._originalColorPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAORenderEffect, function () { return _this._ssaoPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurHRenderEffect, function () { return _this._blurHPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurVRenderEffect, function () { return _this._blurVPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOCombineRenderEffect, function () { return _this._ssaoCombinePostProcess; }, true));\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n if (cameras) {\r\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"samples\", {\r\n get: function () {\r\n return this._samples;\r\n },\r\n /**\r\n * Number of samples used for the SSAO calculations. Default value is 8\r\n */\r\n set: function (n) {\r\n this._ssaoPostProcess.updateEffect(\"#define SAMPLES \" + n + \"\\n#define SSAO\");\r\n this._samples = n;\r\n this._sampleSphere = this._generateHemisphere();\r\n this._firstUpdate = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"textureSamples\", {\r\n get: function () {\r\n return this._textureSamples;\r\n },\r\n /**\r\n * Number of samples to use for antialiasing\r\n */\r\n set: function (n) {\r\n this._textureSamples = n;\r\n this._originalColorPostProcess.samples = n;\r\n this._blurHPostProcess.samples = n;\r\n this._blurVPostProcess.samples = n;\r\n this._ssaoPostProcess.samples = n;\r\n this._ssaoCombinePostProcess.samples = n;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"expensiveBlur\", {\r\n get: function () {\r\n return this._expensiveBlur;\r\n },\r\n /**\r\n * If bilateral blur should be used\r\n */\r\n set: function (b) {\r\n this._blurHPostProcess.updateEffect(\"#define BILATERAL_BLUR\\n#define BILATERAL_BLUR_H\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (b ? \"1\" : \"0\") + \"\\n\", null, [\"textureSampler\", \"depthSampler\"]);\r\n this._blurVPostProcess.updateEffect(\"#define BILATERAL_BLUR\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (b ? \"1\" : \"0\") + \"\\n\", null, [\"textureSampler\", \"depthSampler\"]);\r\n this._expensiveBlur = b;\r\n this._firstUpdate = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline, \"IsSupported\", {\r\n /**\r\n * Support test.\r\n */\r\n get: function () {\r\n var engine = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_11__[\"EngineStore\"].LastCreatedEngine;\r\n if (!engine) {\r\n return false;\r\n }\r\n return engine.getCaps().drawBuffersExtension;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SSAO2RenderingPipeline.prototype, \"scene\", {\r\n /**\r\n * Gets active scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Public Methods\r\n /**\r\n * Get the class name\r\n * @returns \"SSAO2RenderingPipeline\"\r\n */\r\n SSAO2RenderingPipeline.prototype.getClassName = function () {\r\n return \"SSAO2RenderingPipeline\";\r\n };\r\n /**\r\n * Removes the internal pipeline assets and detatches the pipeline from the scene cameras\r\n */\r\n SSAO2RenderingPipeline.prototype.dispose = function (disableGeometryBufferRenderer) {\r\n if (disableGeometryBufferRenderer === void 0) { disableGeometryBufferRenderer = false; }\r\n for (var i = 0; i < this._scene.cameras.length; i++) {\r\n var camera = this._scene.cameras[i];\r\n this._originalColorPostProcess.dispose(camera);\r\n this._ssaoPostProcess.dispose(camera);\r\n this._blurHPostProcess.dispose(camera);\r\n this._blurVPostProcess.dispose(camera);\r\n this._ssaoCombinePostProcess.dispose(camera);\r\n }\r\n this._randomTexture.dispose();\r\n if (disableGeometryBufferRenderer) {\r\n this._scene.disableGeometryBufferRenderer();\r\n }\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\r\n _super.prototype.dispose.call(this);\r\n };\r\n // Private Methods\r\n SSAO2RenderingPipeline.prototype._createBlurPostProcess = function (ssaoRatio, blurRatio) {\r\n var _this = this;\r\n this._samplerOffsets = [];\r\n var expensive = this.expensiveBlur;\r\n for (var i = -8; i < 8; i++) {\r\n this._samplerOffsets.push(i * 2 + 0.5);\r\n }\r\n this._blurHPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"BlurH\", \"ssao2\", [\"outSize\", \"samplerOffsets\", \"near\", \"far\", \"radius\"], [\"depthSampler\"], ssaoRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define BILATERAL_BLUR\\n#define BILATERAL_BLUR_H\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (expensive ? \"1\" : \"0\") + \"\\n\");\r\n this._blurHPostProcess.onApply = function (effect) {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setFloat(\"outSize\", _this._ssaoCombinePostProcess.width > 0 ? _this._ssaoCombinePostProcess.width : _this._originalColorPostProcess.width);\r\n effect.setFloat(\"near\", _this._scene.activeCamera.minZ);\r\n effect.setFloat(\"far\", _this._scene.activeCamera.maxZ);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n if (_this._firstUpdate) {\r\n effect.setArray(\"samplerOffsets\", _this._samplerOffsets);\r\n }\r\n };\r\n this._blurVPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"BlurV\", \"ssao2\", [\"outSize\", \"samplerOffsets\", \"near\", \"far\", \"radius\"], [\"depthSampler\"], blurRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define BILATERAL_BLUR\\n#define BILATERAL_BLUR_V\\n#define SAMPLES 16\\n#define EXPENSIVE \" + (expensive ? \"1\" : \"0\") + \"\\n\");\r\n this._blurVPostProcess.onApply = function (effect) {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setFloat(\"outSize\", _this._ssaoCombinePostProcess.height > 0 ? _this._ssaoCombinePostProcess.height : _this._originalColorPostProcess.height);\r\n effect.setFloat(\"near\", _this._scene.activeCamera.minZ);\r\n effect.setFloat(\"far\", _this._scene.activeCamera.maxZ);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n if (_this._firstUpdate) {\r\n effect.setArray(\"samplerOffsets\", _this._samplerOffsets);\r\n _this._firstUpdate = false;\r\n }\r\n };\r\n this._blurHPostProcess.samples = this.textureSamples;\r\n this._blurVPostProcess.samples = this.textureSamples;\r\n };\r\n /** @hidden */\r\n SSAO2RenderingPipeline.prototype._rebuild = function () {\r\n this._firstUpdate = true;\r\n _super.prototype._rebuild.call(this);\r\n };\r\n //Van der Corput radical inverse\r\n SSAO2RenderingPipeline.prototype._radicalInverse_VdC = function (i) {\r\n this._bits[0] = i;\r\n this._bits[0] = ((this._bits[0] << 16) | (this._bits[0] >> 16)) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x55555555) << 1) | ((this._bits[0] & 0xAAAAAAAA) >>> 1) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x33333333) << 2) | ((this._bits[0] & 0xCCCCCCCC) >>> 2) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x0F0F0F0F) << 4) | ((this._bits[0] & 0xF0F0F0F0) >>> 4) >>> 0;\r\n this._bits[0] = ((this._bits[0] & 0x00FF00FF) << 8) | ((this._bits[0] & 0xFF00FF00) >>> 8) >>> 0;\r\n return this._bits[0] * 2.3283064365386963e-10; // / 0x100000000 or / 4294967296\r\n };\r\n SSAO2RenderingPipeline.prototype._hammersley = function (i, n) {\r\n return [i / n, this._radicalInverse_VdC(i)];\r\n };\r\n SSAO2RenderingPipeline.prototype._hemisphereSample_uniform = function (u, v) {\r\n var phi = v * 2.0 * Math.PI;\r\n // rejecting samples that are close to tangent plane to avoid z-fighting artifacts\r\n var cosTheta = 1.0 - (u * 0.85 + 0.15);\r\n var sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta);\r\n return new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](Math.cos(phi) * sinTheta, Math.sin(phi) * sinTheta, cosTheta);\r\n };\r\n SSAO2RenderingPipeline.prototype._generateHemisphere = function () {\r\n var numSamples = this.samples;\r\n var result = [];\r\n var vector;\r\n var i = 0;\r\n while (i < numSamples) {\r\n if (numSamples < 16) {\r\n vector = this._hemisphereSample_uniform(Math.random(), Math.random());\r\n }\r\n else {\r\n var rand = this._hammersley(i, numSamples);\r\n vector = this._hemisphereSample_uniform(rand[0], rand[1]);\r\n }\r\n result.push(vector.x, vector.y, vector.z);\r\n i++;\r\n }\r\n return result;\r\n };\r\n SSAO2RenderingPipeline.prototype._createSSAOPostProcess = function (ratio) {\r\n var _this = this;\r\n var numSamples = this.samples;\r\n this._sampleSphere = this._generateHemisphere();\r\n this._ssaoPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"ssao2\", \"ssao2\", [\r\n \"sampleSphere\", \"samplesFactor\", \"randTextureTiles\", \"totalStrength\", \"radius\",\r\n \"base\", \"range\", \"projection\", \"near\", \"far\", \"texelSize\",\r\n \"xViewport\", \"yViewport\", \"maxZ\", \"minZAspect\"\r\n ], [\"randomSampler\", \"normalSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define SAMPLES \" + numSamples + \"\\n#define SSAO\");\r\n this._ssaoPostProcess.onApply = function (effect) {\r\n if (_this._firstUpdate) {\r\n effect.setArray3(\"sampleSphere\", _this._sampleSphere);\r\n effect.setFloat(\"randTextureTiles\", 32.0);\r\n }\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setFloat(\"samplesFactor\", 1 / _this.samples);\r\n effect.setFloat(\"totalStrength\", _this.totalStrength);\r\n effect.setFloat2(\"texelSize\", 1 / _this._ssaoPostProcess.width, 1 / _this._ssaoPostProcess.height);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setFloat(\"maxZ\", _this.maxZ);\r\n effect.setFloat(\"minZAspect\", _this.minZAspect);\r\n effect.setFloat(\"base\", _this.base);\r\n effect.setFloat(\"near\", _this._scene.activeCamera.minZ);\r\n effect.setFloat(\"far\", _this._scene.activeCamera.maxZ);\r\n effect.setFloat(\"xViewport\", Math.tan(_this._scene.activeCamera.fov / 2) * _this._scene.getEngine().getAspectRatio(_this._scene.activeCamera, true));\r\n effect.setFloat(\"yViewport\", Math.tan(_this._scene.activeCamera.fov / 2));\r\n effect.setMatrix(\"projection\", _this._scene.getProjectionMatrix());\r\n effect.setTexture(\"textureSampler\", _this._depthTexture);\r\n effect.setTexture(\"normalSampler\", _this._normalTexture);\r\n effect.setTexture(\"randomSampler\", _this._randomTexture);\r\n };\r\n this._ssaoPostProcess.samples = this.textureSamples;\r\n };\r\n SSAO2RenderingPipeline.prototype._createSSAOCombinePostProcess = function (ratio) {\r\n var _this = this;\r\n this._ssaoCombinePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"ssaoCombine\", \"ssaoCombine\", [], [\"originalColor\", \"viewport\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._ssaoCombinePostProcess.onApply = function (effect) {\r\n var viewport = _this._scene.activeCamera.viewport;\r\n effect.setVector4(\"viewport\", _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector4[0].copyFromFloats(viewport.x, viewport.y, viewport.width, viewport.height));\r\n effect.setTextureFromPostProcess(\"originalColor\", _this._originalColorPostProcess);\r\n };\r\n this._ssaoCombinePostProcess.samples = this.textureSamples;\r\n };\r\n SSAO2RenderingPipeline.prototype._createRandomTexture = function () {\r\n var size = 128;\r\n this._randomTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_5__[\"DynamicTexture\"](\"SSAORandomTexture\", size, this._scene, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n this._randomTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n this._randomTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__[\"Texture\"].WRAP_ADDRESSMODE;\r\n var context = this._randomTexture.getContext();\r\n var rand = function (min, max) {\r\n return Math.random() * (max - min) + min;\r\n };\r\n var randVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n for (var x = 0; x < size; x++) {\r\n for (var y = 0; y < size; y++) {\r\n randVector.x = rand(0.0, 1.0);\r\n randVector.y = rand(0.0, 1.0);\r\n randVector.z = 0.0;\r\n randVector.normalize();\r\n randVector.scaleInPlace(255);\r\n randVector.x = Math.floor(randVector.x);\r\n randVector.y = Math.floor(randVector.y);\r\n context.fillStyle = 'rgb(' + randVector.x + ', ' + randVector.y + ', ' + randVector.z + ')';\r\n context.fillRect(x, y, 1, 1);\r\n }\r\n }\r\n this._randomTexture.update(false);\r\n };\r\n /**\r\n * Serialize the rendering pipeline (Used when exporting)\r\n * @returns the serialized object\r\n */\r\n SSAO2RenderingPipeline.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"SerializationHelper\"].Serialize(this);\r\n serializationObject.customType = \"SSAO2RenderingPipeline\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the serialized pipeline\r\n * @param source Source pipeline.\r\n * @param scene The scene to load the pipeline to.\r\n * @param rootUrl The URL of the serialized pipeline.\r\n * @returns An instantiated pipeline from the serialized object.\r\n */\r\n SSAO2RenderingPipeline.Parse = function (source, scene, rootUrl) {\r\n return _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"SerializationHelper\"].Parse(function () { return new SSAO2RenderingPipeline(source._name, scene, source._ratio); }, source, scene, rootUrl);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"totalStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"maxZ\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"minZAspect\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])(\"samples\")\r\n ], SSAO2RenderingPipeline.prototype, \"_samples\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])(\"textureSamples\")\r\n ], SSAO2RenderingPipeline.prototype, \"_textureSamples\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"_ratio\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])(\"expensiveBlur\")\r\n ], SSAO2RenderingPipeline.prototype, \"_expensiveBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], SSAO2RenderingPipeline.prototype, \"base\", void 0);\r\n return SSAO2RenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__[\"PostProcessRenderPipeline\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_10__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.SSAO2RenderingPipeline\"] = SSAO2RenderingPipeline;\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts\":\n/*!*************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts ***!\n \\*************************************************************************/\n/*! exports provided: SSAORenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return SSAORenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Materials/Textures/dynamicTexture */ \"./Materials/Textures/dynamicTexture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_ssao_fragment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../Shaders/ssao.fragment */ \"./Shaders/ssao.fragment.ts\");\n/* harmony import */ var _Shaders_ssaoCombine_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../Shaders/ssaoCombine.fragment */ \"./Shaders/ssaoCombine.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Render pipeline to produce ssao effect\r\n */\r\nvar SSAORenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SSAORenderingPipeline, _super);\r\n /**\r\n * @constructor\r\n * @param name - The rendering pipeline name\r\n * @param scene - The scene linked to this pipeline\r\n * @param ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 }\r\n * @param cameras - The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function SSAORenderingPipeline(name, scene, ratio, cameras) {\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n // Members\r\n /**\r\n * @ignore\r\n * The PassPostProcess id in the pipeline that contains the original scene color\r\n */\r\n _this.SSAOOriginalSceneColorEffect = \"SSAOOriginalSceneColorEffect\";\r\n /**\r\n * @ignore\r\n * The SSAO PostProcess id in the pipeline\r\n */\r\n _this.SSAORenderEffect = \"SSAORenderEffect\";\r\n /**\r\n * @ignore\r\n * The horizontal blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurHRenderEffect = \"SSAOBlurHRenderEffect\";\r\n /**\r\n * @ignore\r\n * The vertical blur PostProcess id in the pipeline\r\n */\r\n _this.SSAOBlurVRenderEffect = \"SSAOBlurVRenderEffect\";\r\n /**\r\n * @ignore\r\n * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect)\r\n */\r\n _this.SSAOCombineRenderEffect = \"SSAOCombineRenderEffect\";\r\n /**\r\n * The output strength of the SSAO post-process. Default value is 1.0.\r\n */\r\n _this.totalStrength = 1.0;\r\n /**\r\n * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0006\r\n */\r\n _this.radius = 0.0001;\r\n /**\r\n * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel\r\n * Must not be equal to fallOff and superior to fallOff.\r\n * Default value is 0.0075\r\n */\r\n _this.area = 0.0075;\r\n /**\r\n * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel\r\n * Must not be equal to area and inferior to area.\r\n * Default value is 0.000001\r\n */\r\n _this.fallOff = 0.000001;\r\n /**\r\n * The base color of the SSAO post-process\r\n * The final result is \"base + ssao\" between [0, 1]\r\n */\r\n _this.base = 0.5;\r\n _this._firstUpdate = true;\r\n _this._scene = scene;\r\n // Set up assets\r\n _this._createRandomTexture();\r\n _this._depthTexture = scene.enableDepthRenderer().getDepthMap(); // Force depth renderer \"on\"\r\n var ssaoRatio = ratio.ssaoRatio || ratio;\r\n var combineRatio = ratio.combineRatio || ratio;\r\n _this._originalColorPostProcess = new _PostProcesses_passPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"PassPostProcess\"](\"SSAOOriginalSceneColor\", combineRatio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false);\r\n _this._createSSAOPostProcess(ssaoRatio);\r\n _this._createBlurPostProcess(ssaoRatio);\r\n _this._createSSAOCombinePostProcess(combineRatio);\r\n // Set up pipeline\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOOriginalSceneColorEffect, function () { return _this._originalColorPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAORenderEffect, function () { return _this._ssaoPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurHRenderEffect, function () { return _this._blurHPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOBlurVRenderEffect, function () { return _this._blurVPostProcess; }, true));\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_6__[\"PostProcessRenderEffect\"](scene.getEngine(), _this.SSAOCombineRenderEffect, function () { return _this._ssaoCombinePostProcess; }, true));\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n if (cameras) {\r\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(SSAORenderingPipeline.prototype, \"scene\", {\r\n /**\r\n * Gets active scene\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Public Methods\r\n /**\r\n * Get the class name\r\n * @returns \"SSAORenderingPipeline\"\r\n */\r\n SSAORenderingPipeline.prototype.getClassName = function () {\r\n return \"SSAORenderingPipeline\";\r\n };\r\n /**\r\n * Removes the internal pipeline assets and detatches the pipeline from the scene cameras\r\n */\r\n SSAORenderingPipeline.prototype.dispose = function (disableDepthRender) {\r\n if (disableDepthRender === void 0) { disableDepthRender = false; }\r\n for (var i = 0; i < this._scene.cameras.length; i++) {\r\n var camera = this._scene.cameras[i];\r\n this._originalColorPostProcess.dispose(camera);\r\n this._ssaoPostProcess.dispose(camera);\r\n this._blurHPostProcess.dispose(camera);\r\n this._blurVPostProcess.dispose(camera);\r\n this._ssaoCombinePostProcess.dispose(camera);\r\n }\r\n this._randomTexture.dispose();\r\n if (disableDepthRender) {\r\n this._scene.disableDepthRenderer();\r\n }\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\r\n _super.prototype.dispose.call(this);\r\n };\r\n // Private Methods\r\n SSAORenderingPipeline.prototype._createBlurPostProcess = function (ratio) {\r\n var _this = this;\r\n var size = 16;\r\n this._blurHPostProcess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"BlurPostProcess\"](\"BlurH\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1, 0), size, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._blurVPostProcess = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"BlurPostProcess\"](\"BlurV\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1), size, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._blurHPostProcess.onActivateObservable.add(function () {\r\n var dw = _this._blurHPostProcess.width / _this._scene.getEngine().getRenderWidth();\r\n _this._blurHPostProcess.kernel = size * dw;\r\n });\r\n this._blurVPostProcess.onActivateObservable.add(function () {\r\n var dw = _this._blurVPostProcess.height / _this._scene.getEngine().getRenderHeight();\r\n _this._blurVPostProcess.kernel = size * dw;\r\n });\r\n };\r\n /** @hidden */\r\n SSAORenderingPipeline.prototype._rebuild = function () {\r\n this._firstUpdate = true;\r\n _super.prototype._rebuild.call(this);\r\n };\r\n SSAORenderingPipeline.prototype._createSSAOPostProcess = function (ratio) {\r\n var _this = this;\r\n var numSamples = 16;\r\n var sampleSphere = [\r\n 0.5381, 0.1856, -0.4319,\r\n 0.1379, 0.2486, 0.4430,\r\n 0.3371, 0.5679, -0.0057,\r\n -0.6999, -0.0451, -0.0019,\r\n 0.0689, -0.1598, -0.8547,\r\n 0.0560, 0.0069, -0.1843,\r\n -0.0146, 0.1402, 0.0762,\r\n 0.0100, -0.1924, -0.0344,\r\n -0.3577, -0.5301, -0.4358,\r\n -0.3169, 0.1063, 0.0158,\r\n 0.0103, -0.5869, 0.0046,\r\n -0.0897, -0.4940, 0.3287,\r\n 0.7119, -0.0154, -0.0918,\r\n -0.0533, 0.0596, -0.5411,\r\n 0.0352, -0.0631, 0.5460,\r\n -0.4776, 0.2847, -0.0271\r\n ];\r\n var samplesFactor = 1.0 / numSamples;\r\n this._ssaoPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_4__[\"PostProcess\"](\"ssao\", \"ssao\", [\r\n \"sampleSphere\", \"samplesFactor\", \"randTextureTiles\", \"totalStrength\", \"radius\",\r\n \"area\", \"fallOff\", \"base\", \"range\", \"viewport\"\r\n ], [\"randomSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define SAMPLES \" + numSamples + \"\\n#define SSAO\");\r\n this._ssaoPostProcess.onApply = function (effect) {\r\n if (_this._firstUpdate) {\r\n effect.setArray3(\"sampleSphere\", sampleSphere);\r\n effect.setFloat(\"samplesFactor\", samplesFactor);\r\n effect.setFloat(\"randTextureTiles\", 4.0);\r\n }\r\n effect.setFloat(\"totalStrength\", _this.totalStrength);\r\n effect.setFloat(\"radius\", _this.radius);\r\n effect.setFloat(\"area\", _this.area);\r\n effect.setFloat(\"fallOff\", _this.fallOff);\r\n effect.setFloat(\"base\", _this.base);\r\n effect.setTexture(\"textureSampler\", _this._depthTexture);\r\n effect.setTexture(\"randomSampler\", _this._randomTexture);\r\n };\r\n };\r\n SSAORenderingPipeline.prototype._createSSAOCombinePostProcess = function (ratio) {\r\n var _this = this;\r\n this._ssaoCombinePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_4__[\"PostProcess\"](\"ssaoCombine\", \"ssaoCombine\", [], [\"originalColor\", \"viewport\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\r\n this._ssaoCombinePostProcess.onApply = function (effect) {\r\n effect.setVector4(\"viewport\", _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"TmpVectors\"].Vector4[0].copyFromFloats(0, 0, 1.0, 1.0));\r\n effect.setTextureFromPostProcess(\"originalColor\", _this._originalColorPostProcess);\r\n };\r\n };\r\n SSAORenderingPipeline.prototype._createRandomTexture = function () {\r\n var size = 512;\r\n this._randomTexture = new _Materials_Textures_dynamicTexture__WEBPACK_IMPORTED_MODULE_3__[\"DynamicTexture\"](\"SSAORandomTexture\", size, this._scene, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n this._randomTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].WRAP_ADDRESSMODE;\r\n this._randomTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].WRAP_ADDRESSMODE;\r\n var context = this._randomTexture.getContext();\r\n var rand = function (min, max) {\r\n return Math.random() * (max - min) + min;\r\n };\r\n var randVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n for (var x = 0; x < size; x++) {\r\n for (var y = 0; y < size; y++) {\r\n randVector.x = Math.floor(rand(-1.0, 1.0) * 255);\r\n randVector.y = Math.floor(rand(-1.0, 1.0) * 255);\r\n randVector.z = Math.floor(rand(-1.0, 1.0) * 255);\r\n context.fillStyle = 'rgb(' + randVector.x + ', ' + randVector.y + ', ' + randVector.z + ')';\r\n context.fillRect(x, y, 1, 1);\r\n }\r\n }\r\n this._randomTexture.update(false);\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"totalStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"radius\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"area\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"fallOff\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_10__[\"serialize\"])()\r\n ], SSAORenderingPipeline.prototype, \"base\", void 0);\r\n return SSAORenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_5__[\"PostProcessRenderPipeline\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts\":\n/*!*****************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.ts ***!\n \\*****************************************************************************/\n/*! exports provided: StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return StandardRenderingPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../Maths/math.scalar */ \"./Maths/math.scalar.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../PostProcesses/postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../PostProcesses/blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../PostProcesses/fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_typeStore__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../Misc/typeStore */ \"./Misc/typeStore.ts\");\n/* harmony import */ var _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../motionBlurPostProcess */ \"./PostProcesses/motionBlurPostProcess.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony import */ var _Shaders_standard_fragment__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../Shaders/standard.fragment */ \"./Shaders/standard.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Standard rendering pipeline\r\n * Default pipeline should be used going forward but the standard pipeline will be kept for backwards compatibility.\r\n * @see https://doc.babylonjs.com/how_to/using_standard_rendering_pipeline\r\n */\r\nvar StandardRenderingPipeline = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StandardRenderingPipeline, _super);\r\n /**\r\n * Default pipeline should be used going forward but the standard pipeline will be kept for backwards compatibility.\r\n * @constructor\r\n * @param name The rendering pipeline name\r\n * @param scene The scene linked to this pipeline\r\n * @param ratio The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)\r\n * @param originalPostProcess the custom original color post-process. Must be \"reusable\". Can be null.\r\n * @param cameras The array of cameras that the rendering pipeline will be attached to\r\n */\r\n function StandardRenderingPipeline(name, scene, ratio, originalPostProcess, cameras) {\r\n if (originalPostProcess === void 0) { originalPostProcess = null; }\r\n var _this = _super.call(this, scene.getEngine(), name) || this;\r\n /**\r\n * Post-process used to down scale an image x4\r\n */\r\n _this.downSampleX4PostProcess = null;\r\n /**\r\n * Post-process used to calculate the illuminated surfaces controlled by a threshold\r\n */\r\n _this.brightPassPostProcess = null;\r\n /**\r\n * Post-process array storing all the horizontal blur post-processes used by the pipeline\r\n */\r\n _this.blurHPostProcesses = [];\r\n /**\r\n * Post-process array storing all the vertical blur post-processes used by the pipeline\r\n */\r\n _this.blurVPostProcesses = [];\r\n /**\r\n * Post-process used to add colors of 2 textures (typically brightness + real scene color)\r\n */\r\n _this.textureAdderPostProcess = null;\r\n /**\r\n * Post-process used to create volumetric lighting effect\r\n */\r\n _this.volumetricLightPostProcess = null;\r\n /**\r\n * Post-process used to smooth the previous volumetric light post-process on the X axis\r\n */\r\n _this.volumetricLightSmoothXPostProcess = null;\r\n /**\r\n * Post-process used to smooth the previous volumetric light post-process on the Y axis\r\n */\r\n _this.volumetricLightSmoothYPostProcess = null;\r\n /**\r\n * Post-process used to merge the volumetric light effect and the real scene color\r\n */\r\n _this.volumetricLightMergePostProces = null;\r\n /**\r\n * Post-process used to store the final volumetric light post-process (attach/detach for debug purpose)\r\n */\r\n _this.volumetricLightFinalPostProcess = null;\r\n /**\r\n * Base post-process used to calculate the average luminance of the final image for HDR\r\n */\r\n _this.luminancePostProcess = null;\r\n /**\r\n * Post-processes used to create down sample post-processes in order to get\r\n * the average luminance of the final image for HDR\r\n * Array of length \"StandardRenderingPipeline.LuminanceSteps\"\r\n */\r\n _this.luminanceDownSamplePostProcesses = [];\r\n /**\r\n * Post-process used to create a HDR effect (light adaptation)\r\n */\r\n _this.hdrPostProcess = null;\r\n /**\r\n * Post-process used to store the final texture adder post-process (attach/detach for debug purpose)\r\n */\r\n _this.textureAdderFinalPostProcess = null;\r\n /**\r\n * Post-process used to store the final lens flare post-process (attach/detach for debug purpose)\r\n */\r\n _this.lensFlareFinalPostProcess = null;\r\n /**\r\n * Post-process used to merge the final HDR post-process and the real scene color\r\n */\r\n _this.hdrFinalPostProcess = null;\r\n /**\r\n * Post-process used to create a lens flare effect\r\n */\r\n _this.lensFlarePostProcess = null;\r\n /**\r\n * Post-process that merges the result of the lens flare post-process and the real scene color\r\n */\r\n _this.lensFlareComposePostProcess = null;\r\n /**\r\n * Post-process used to create a motion blur effect\r\n */\r\n _this.motionBlurPostProcess = null;\r\n /**\r\n * Post-process used to create a depth of field effect\r\n */\r\n _this.depthOfFieldPostProcess = null;\r\n /**\r\n * The Fast Approximate Anti-Aliasing post process which attemps to remove aliasing from an image.\r\n */\r\n _this.fxaaPostProcess = null;\r\n // Values\r\n /**\r\n * Represents the brightness threshold in order to configure the illuminated surfaces\r\n */\r\n _this.brightThreshold = 1.0;\r\n /**\r\n * Configures the blur intensity used for surexposed surfaces are highlighted surfaces (light halo)\r\n */\r\n _this.blurWidth = 512.0;\r\n /**\r\n * Sets if the blur for highlighted surfaces must be only horizontal\r\n */\r\n _this.horizontalBlur = false;\r\n /**\r\n * Texture used typically to simulate \"dirty\" on camera lens\r\n */\r\n _this.lensTexture = null;\r\n /**\r\n * Represents the offset coefficient based on Rayleigh principle. Typically in interval [-0.2, 0.2]\r\n */\r\n _this.volumetricLightCoefficient = 0.2;\r\n /**\r\n * The overall power of volumetric lights, typically in interval [0, 10] maximum\r\n */\r\n _this.volumetricLightPower = 4.0;\r\n /**\r\n * Used the set the blur intensity to smooth the volumetric lights\r\n */\r\n _this.volumetricLightBlurScale = 64.0;\r\n /**\r\n * Light (spot or directional) used to generate the volumetric lights rays\r\n * The source light must have a shadow generate so the pipeline can get its\r\n * depth map\r\n */\r\n _this.sourceLight = null;\r\n /**\r\n * For eye adaptation, represents the minimum luminance the eye can see\r\n */\r\n _this.hdrMinimumLuminance = 1.0;\r\n /**\r\n * For eye adaptation, represents the decrease luminance speed\r\n */\r\n _this.hdrDecreaseRate = 0.5;\r\n /**\r\n * For eye adaptation, represents the increase luminance speed\r\n */\r\n _this.hdrIncreaseRate = 0.5;\r\n /**\r\n * Lens color texture used by the lens flare effect. Mandatory if lens flare effect enabled\r\n */\r\n _this.lensColorTexture = null;\r\n /**\r\n * The overall strengh for the lens flare effect\r\n */\r\n _this.lensFlareStrength = 20.0;\r\n /**\r\n * Dispersion coefficient for lens flare ghosts\r\n */\r\n _this.lensFlareGhostDispersal = 1.4;\r\n /**\r\n * Main lens flare halo width\r\n */\r\n _this.lensFlareHaloWidth = 0.7;\r\n /**\r\n * Based on the lens distortion effect, defines how much the lens flare result\r\n * is distorted\r\n */\r\n _this.lensFlareDistortionStrength = 16.0;\r\n /**\r\n * Configures the blur intensity used for for lens flare (halo)\r\n */\r\n _this.lensFlareBlurWidth = 512.0;\r\n /**\r\n * Lens star texture must be used to simulate rays on the flares and is available\r\n * in the documentation\r\n */\r\n _this.lensStarTexture = null;\r\n /**\r\n * As the \"lensTexture\" (can be the same texture or different), it is used to apply the lens\r\n * flare effect by taking account of the dirt texture\r\n */\r\n _this.lensFlareDirtTexture = null;\r\n /**\r\n * Represents the focal length for the depth of field effect\r\n */\r\n _this.depthOfFieldDistance = 10.0;\r\n /**\r\n * Represents the blur intensity for the blurred part of the depth of field effect\r\n */\r\n _this.depthOfFieldBlurWidth = 64.0;\r\n /**\r\n * List of animations for the pipeline (IAnimatable implementation)\r\n */\r\n _this.animations = [];\r\n _this._currentDepthOfFieldSource = null;\r\n _this._fixedExposure = 1.0;\r\n _this._currentExposure = 1.0;\r\n _this._hdrAutoExposure = false;\r\n _this._hdrCurrentLuminance = 1.0;\r\n _this._motionStrength = 1.0;\r\n _this._isObjectBasedMotionBlur = false;\r\n _this._camerasToBeAttached = [];\r\n // Getters and setters\r\n _this._bloomEnabled = false;\r\n _this._depthOfFieldEnabled = false;\r\n _this._vlsEnabled = false;\r\n _this._lensFlareEnabled = false;\r\n _this._hdrEnabled = false;\r\n _this._motionBlurEnabled = false;\r\n _this._fxaaEnabled = false;\r\n _this._motionBlurSamples = 64.0;\r\n _this._volumetricLightStepsCount = 50.0;\r\n _this._samples = 1;\r\n _this._cameras = cameras || scene.cameras;\r\n _this._cameras = _this._cameras.slice();\r\n _this._camerasToBeAttached = _this._cameras.slice();\r\n // Initialize\r\n _this._scene = scene;\r\n _this._basePostProcess = originalPostProcess;\r\n _this._ratio = ratio;\r\n // Misc\r\n _this._floatTextureType = scene.getEngine().getCaps().textureFloatRender ? _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n // Finish\r\n scene.postProcessRenderPipelineManager.addPipeline(_this);\r\n _this._buildPipeline();\r\n return _this;\r\n }\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"exposure\", {\r\n /**\r\n * Gets the overall exposure used by the pipeline\r\n */\r\n get: function () {\r\n return this._fixedExposure;\r\n },\r\n /**\r\n * Sets the overall exposure used by the pipeline\r\n */\r\n set: function (value) {\r\n this._fixedExposure = value;\r\n this._currentExposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"hdrAutoExposure\", {\r\n /**\r\n * Gets wether or not the exposure of the overall pipeline should be automatically adjusted by the HDR post-process\r\n */\r\n get: function () {\r\n return this._hdrAutoExposure;\r\n },\r\n /**\r\n * Sets wether or not the exposure of the overall pipeline should be automatically adjusted by the HDR post-process\r\n */\r\n set: function (value) {\r\n this._hdrAutoExposure = value;\r\n if (this.hdrPostProcess) {\r\n var defines = [\"#define HDR\"];\r\n if (value) {\r\n defines.push(\"#define AUTO_EXPOSURE\");\r\n }\r\n this.hdrPostProcess.updateEffect(defines.join(\"\\n\"));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"motionStrength\", {\r\n /**\r\n * Gets how much the image is blurred by the movement while using the motion blur post-process\r\n */\r\n get: function () {\r\n return this._motionStrength;\r\n },\r\n /**\r\n * Sets how much the image is blurred by the movement while using the motion blur post-process\r\n */\r\n set: function (strength) {\r\n this._motionStrength = strength;\r\n if (this._isObjectBasedMotionBlur && this.motionBlurPostProcess) {\r\n this.motionBlurPostProcess.motionStrength = strength;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"objectBasedMotionBlur\", {\r\n /**\r\n * Gets wether or not the motion blur post-process is object based or screen based.\r\n */\r\n get: function () {\r\n return this._isObjectBasedMotionBlur;\r\n },\r\n /**\r\n * Sets wether or not the motion blur post-process should be object based or screen based\r\n */\r\n set: function (value) {\r\n var shouldRebuild = this._isObjectBasedMotionBlur !== value;\r\n this._isObjectBasedMotionBlur = value;\r\n if (shouldRebuild) {\r\n this._buildPipeline();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"BloomEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the bloom pipeline is enabled\r\n */\r\n get: function () {\r\n return this._bloomEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._bloomEnabled === enabled) {\r\n return;\r\n }\r\n this._bloomEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"DepthOfFieldEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the depth of field pipeline is enabed\r\n */\r\n get: function () {\r\n return this._depthOfFieldEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._depthOfFieldEnabled === enabled) {\r\n return;\r\n }\r\n this._depthOfFieldEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"LensFlareEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the lens flare pipeline is enabed\r\n */\r\n get: function () {\r\n return this._lensFlareEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._lensFlareEnabled === enabled) {\r\n return;\r\n }\r\n this._lensFlareEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"HDREnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the HDR pipeline is enabled\r\n */\r\n get: function () {\r\n return this._hdrEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._hdrEnabled === enabled) {\r\n return;\r\n }\r\n this._hdrEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"VLSEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the volumetric lights scattering effect is enabled\r\n */\r\n get: function () {\r\n return this._vlsEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._vlsEnabled === enabled) {\r\n return;\r\n }\r\n if (enabled) {\r\n var geometry = this._scene.enableGeometryBufferRenderer();\r\n if (!geometry) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline\");\r\n return;\r\n }\r\n }\r\n this._vlsEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"MotionBlurEnabled\", {\r\n /**\r\n * @ignore\r\n * Specifies if the motion blur effect is enabled\r\n */\r\n get: function () {\r\n return this._motionBlurEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._motionBlurEnabled === enabled) {\r\n return;\r\n }\r\n this._motionBlurEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"fxaaEnabled\", {\r\n /**\r\n * Specifies if anti-aliasing is enabled\r\n */\r\n get: function () {\r\n return this._fxaaEnabled;\r\n },\r\n set: function (enabled) {\r\n if (this._fxaaEnabled === enabled) {\r\n return;\r\n }\r\n this._fxaaEnabled = enabled;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"volumetricLightStepsCount\", {\r\n /**\r\n * Specifies the number of steps used to calculate the volumetric lights\r\n * Typically in interval [50, 200]\r\n */\r\n get: function () {\r\n return this._volumetricLightStepsCount;\r\n },\r\n set: function (count) {\r\n if (this.volumetricLightPostProcess) {\r\n this.volumetricLightPostProcess.updateEffect(\"#define VLS\\n#define NB_STEPS \" + count.toFixed(1));\r\n }\r\n this._volumetricLightStepsCount = count;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"motionBlurSamples\", {\r\n /**\r\n * Specifies the number of samples used for the motion blur effect\r\n * Typically in interval [16, 64]\r\n */\r\n get: function () {\r\n return this._motionBlurSamples;\r\n },\r\n set: function (samples) {\r\n if (this.motionBlurPostProcess) {\r\n if (this._isObjectBasedMotionBlur) {\r\n this.motionBlurPostProcess.motionBlurSamples = samples;\r\n }\r\n else {\r\n this.motionBlurPostProcess.updateEffect(\"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \" + samples.toFixed(1));\r\n }\r\n }\r\n this._motionBlurSamples = samples;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardRenderingPipeline.prototype, \"samples\", {\r\n /**\r\n * Specifies MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (sampleCount) {\r\n if (this._samples === sampleCount) {\r\n return;\r\n }\r\n this._samples = sampleCount;\r\n this._buildPipeline();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n StandardRenderingPipeline.prototype._buildPipeline = function () {\r\n var _this = this;\r\n var ratio = this._ratio;\r\n var scene = this._scene;\r\n this._disposePostProcesses();\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n // get back cameras to be used to reattach pipeline\r\n this._cameras = this._camerasToBeAttached.slice();\r\n }\r\n this._reset();\r\n // Create pass post-process\r\n if (!this._basePostProcess) {\r\n this.originalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRPass\", \"standard\", [], [], ratio, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", this._floatTextureType);\r\n this.originalPostProcess.onApply = function () {\r\n _this._currentDepthOfFieldSource = _this.originalPostProcess;\r\n };\r\n }\r\n else {\r\n this.originalPostProcess = this._basePostProcess;\r\n }\r\n if (this._bloomEnabled || this._vlsEnabled || this._lensFlareEnabled || this._depthOfFieldEnabled || this._motionBlurEnabled) {\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRPassPostProcess\", function () { return _this.originalPostProcess; }, true));\r\n }\r\n this._currentDepthOfFieldSource = this.originalPostProcess;\r\n if (this._bloomEnabled) {\r\n // Create down sample X4 post-process\r\n this._createDownSampleX4PostProcess(scene, ratio / 2);\r\n // Create bright pass post-process\r\n this._createBrightPassPostProcess(scene, ratio / 2);\r\n // Create gaussian blur post-processes (down sampling blurs)\r\n this._createBlurPostProcesses(scene, ratio / 4, 1);\r\n // Create texture adder post-process\r\n this._createTextureAdderPostProcess(scene, ratio);\r\n // Create depth-of-field source post-process\r\n this.textureAdderFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRDepthOfFieldSource\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBaseDepthOfFieldSource\", function () { return _this.textureAdderFinalPostProcess; }, true));\r\n }\r\n if (this._vlsEnabled) {\r\n // Create volumetric light\r\n this._createVolumetricLightPostProcess(scene, ratio);\r\n // Create volumetric light final post-process\r\n this.volumetricLightFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRVLSFinal\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRVLSFinal\", function () { return _this.volumetricLightFinalPostProcess; }, true));\r\n }\r\n if (this._lensFlareEnabled) {\r\n // Create lens flare post-process\r\n this._createLensFlarePostProcess(scene, ratio);\r\n // Create depth-of-field source post-process post lens-flare and disable it now\r\n this.lensFlareFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRPostLensFlareDepthOfFieldSource\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRPostLensFlareDepthOfFieldSource\", function () { return _this.lensFlareFinalPostProcess; }, true));\r\n }\r\n if (this._hdrEnabled) {\r\n // Create luminance\r\n this._createLuminancePostProcesses(scene, this._floatTextureType);\r\n // Create HDR\r\n this._createHdrPostProcess(scene, ratio);\r\n // Create depth-of-field source post-process post hdr and disable it now\r\n this.hdrFinalPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRPostHDReDepthOfFieldSource\", \"standard\", [], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRPostHDReDepthOfFieldSource\", function () { return _this.hdrFinalPostProcess; }, true));\r\n }\r\n if (this._depthOfFieldEnabled) {\r\n // Create gaussian blur used by depth-of-field\r\n this._createBlurPostProcesses(scene, ratio / 2, 3, \"depthOfFieldBlurWidth\");\r\n // Create depth-of-field post-process\r\n this._createDepthOfFieldPostProcess(scene, ratio);\r\n }\r\n if (this._motionBlurEnabled) {\r\n // Create motion blur post-process\r\n this._createMotionBlurPostProcess(scene, ratio);\r\n }\r\n if (this._fxaaEnabled) {\r\n // Create fxaa post-process\r\n this.fxaaPostProcess = new _PostProcesses_fxaaPostProcess__WEBPACK_IMPORTED_MODULE_10__[\"FxaaPostProcess\"](\"fxaa\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRFxaa\", function () { return _this.fxaaPostProcess; }, true));\r\n }\r\n if (this._cameras !== null) {\r\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\r\n }\r\n if (!this._enableMSAAOnFirstPostProcess(this._samples) && this._samples > 1) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\");\r\n }\r\n };\r\n // Down Sample X4 Post-Processs\r\n StandardRenderingPipeline.prototype._createDownSampleX4PostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var downSampleX4Offsets = new Array(32);\r\n this.downSampleX4PostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRDownSampleX4\", \"standard\", [\"dsOffsets\"], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define DOWN_SAMPLE_X4\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.downSampleX4PostProcess.onApply = function (effect) {\r\n var id = 0;\r\n var width = _this.downSampleX4PostProcess.width;\r\n var height = _this.downSampleX4PostProcess.height;\r\n for (var i = -2; i < 2; i++) {\r\n for (var j = -2; j < 2; j++) {\r\n downSampleX4Offsets[id] = (i + 0.5) * (1.0 / width);\r\n downSampleX4Offsets[id + 1] = (j + 0.5) * (1.0 / height);\r\n id += 2;\r\n }\r\n }\r\n effect.setArray2(\"dsOffsets\", downSampleX4Offsets);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRDownSampleX4\", function () { return _this.downSampleX4PostProcess; }, true));\r\n };\r\n // Brightpass Post-Process\r\n StandardRenderingPipeline.prototype._createBrightPassPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var brightOffsets = new Array(8);\r\n this.brightPassPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRBrightPass\", \"standard\", [\"dsOffsets\", \"brightThreshold\"], [], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define BRIGHT_PASS\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.brightPassPostProcess.onApply = function (effect) {\r\n var sU = (1.0 / _this.brightPassPostProcess.width);\r\n var sV = (1.0 / _this.brightPassPostProcess.height);\r\n brightOffsets[0] = -0.5 * sU;\r\n brightOffsets[1] = 0.5 * sV;\r\n brightOffsets[2] = 0.5 * sU;\r\n brightOffsets[3] = 0.5 * sV;\r\n brightOffsets[4] = -0.5 * sU;\r\n brightOffsets[5] = -0.5 * sV;\r\n brightOffsets[6] = 0.5 * sU;\r\n brightOffsets[7] = -0.5 * sV;\r\n effect.setArray2(\"dsOffsets\", brightOffsets);\r\n effect.setFloat(\"brightThreshold\", _this.brightThreshold);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBrightPass\", function () { return _this.brightPassPostProcess; }, true));\r\n };\r\n // Create blur H&V post-processes\r\n StandardRenderingPipeline.prototype._createBlurPostProcesses = function (scene, ratio, indice, blurWidthKey) {\r\n var _this = this;\r\n if (blurWidthKey === void 0) { blurWidthKey = \"blurWidth\"; }\r\n var engine = scene.getEngine();\r\n var blurX = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"BlurPostProcess\"](\"HDRBlurH\" + \"_\" + indice, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](1, 0), this[blurWidthKey], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n var blurY = new _PostProcesses_blurPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"BlurPostProcess\"](\"HDRBlurV\" + \"_\" + indice, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 1), this[blurWidthKey], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n blurX.onActivateObservable.add(function () {\r\n var dw = blurX.width / engine.getRenderWidth();\r\n blurX.kernel = _this[blurWidthKey] * dw;\r\n });\r\n blurY.onActivateObservable.add(function () {\r\n var dw = blurY.height / engine.getRenderHeight();\r\n blurY.kernel = _this.horizontalBlur ? 64 * dw : _this[blurWidthKey] * dw;\r\n });\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBlurH\" + indice, function () { return blurX; }, true));\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRBlurV\" + indice, function () { return blurY; }, true));\r\n this.blurHPostProcesses.push(blurX);\r\n this.blurVPostProcesses.push(blurY);\r\n };\r\n // Create texture adder post-process\r\n StandardRenderingPipeline.prototype._createTextureAdderPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n this.textureAdderPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRTextureAdder\", \"standard\", [\"exposure\"], [\"otherSampler\", \"lensSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define TEXTURE_ADDER\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.textureAdderPostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"otherSampler\", _this._vlsEnabled ? _this._currentDepthOfFieldSource : _this.originalPostProcess);\r\n effect.setTexture(\"lensSampler\", _this.lensTexture);\r\n effect.setFloat(\"exposure\", _this._currentExposure);\r\n _this._currentDepthOfFieldSource = _this.textureAdderFinalPostProcess;\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRTextureAdder\", function () { return _this.textureAdderPostProcess; }, true));\r\n };\r\n StandardRenderingPipeline.prototype._createVolumetricLightPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var geometryRenderer = scene.enableGeometryBufferRenderer();\r\n geometryRenderer.enablePosition = true;\r\n var geometry = geometryRenderer.getGBuffer();\r\n // Base post-process\r\n this.volumetricLightPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRVLS\", \"standard\", [\"shadowViewProjection\", \"cameraPosition\", \"sunDirection\", \"sunColor\", \"scatteringCoefficient\", \"scatteringPower\", \"depthValues\"], [\"shadowMapSampler\", \"positionSampler\"], ratio / 8, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define VLS\\n#define NB_STEPS \" + this._volumetricLightStepsCount.toFixed(1));\r\n var depthValues = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n this.volumetricLightPostProcess.onApply = function (effect) {\r\n if (_this.sourceLight && _this.sourceLight.getShadowGenerator() && _this._scene.activeCamera) {\r\n var generator = _this.sourceLight.getShadowGenerator();\r\n effect.setTexture(\"shadowMapSampler\", generator.getShadowMap());\r\n effect.setTexture(\"positionSampler\", geometry.textures[2]);\r\n effect.setColor3(\"sunColor\", _this.sourceLight.diffuse);\r\n effect.setVector3(\"sunDirection\", _this.sourceLight.getShadowDirection());\r\n effect.setVector3(\"cameraPosition\", _this._scene.activeCamera.globalPosition);\r\n effect.setMatrix(\"shadowViewProjection\", generator.getTransformMatrix());\r\n effect.setFloat(\"scatteringCoefficient\", _this.volumetricLightCoefficient);\r\n effect.setFloat(\"scatteringPower\", _this.volumetricLightPower);\r\n depthValues.x = _this.sourceLight.getDepthMinZ(_this._scene.activeCamera);\r\n depthValues.y = _this.sourceLight.getDepthMaxZ(_this._scene.activeCamera);\r\n effect.setVector2(\"depthValues\", depthValues);\r\n }\r\n };\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRVLS\", function () { return _this.volumetricLightPostProcess; }, true));\r\n // Smooth\r\n this._createBlurPostProcesses(scene, ratio / 4, 0, \"volumetricLightBlurScale\");\r\n // Merge\r\n this.volumetricLightMergePostProces = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRVLSMerge\", \"standard\", [], [\"originalSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define VLSMERGE\");\r\n this.volumetricLightMergePostProces.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"originalSampler\", _this._bloomEnabled ? _this.textureAdderFinalPostProcess : _this.originalPostProcess);\r\n _this._currentDepthOfFieldSource = _this.volumetricLightFinalPostProcess;\r\n };\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRVLSMerge\", function () { return _this.volumetricLightMergePostProces; }, true));\r\n };\r\n // Create luminance\r\n StandardRenderingPipeline.prototype._createLuminancePostProcesses = function (scene, textureType) {\r\n var _this = this;\r\n // Create luminance\r\n var size = Math.pow(3, StandardRenderingPipeline.LuminanceSteps);\r\n this.luminancePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLuminance\", \"standard\", [\"lumOffsets\"], [], { width: size, height: size }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LUMINANCE\", textureType);\r\n var offsets = [];\r\n this.luminancePostProcess.onApply = function (effect) {\r\n var sU = (1.0 / _this.luminancePostProcess.width);\r\n var sV = (1.0 / _this.luminancePostProcess.height);\r\n offsets[0] = -0.5 * sU;\r\n offsets[1] = 0.5 * sV;\r\n offsets[2] = 0.5 * sU;\r\n offsets[3] = 0.5 * sV;\r\n offsets[4] = -0.5 * sU;\r\n offsets[5] = -0.5 * sV;\r\n offsets[6] = 0.5 * sU;\r\n offsets[7] = -0.5 * sV;\r\n effect.setArray2(\"lumOffsets\", offsets);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLuminance\", function () { return _this.luminancePostProcess; }, true));\r\n // Create down sample luminance\r\n for (var i = StandardRenderingPipeline.LuminanceSteps - 1; i >= 0; i--) {\r\n var size = Math.pow(3, i);\r\n var defines = \"#define LUMINANCE_DOWN_SAMPLE\\n\";\r\n if (i === 0) {\r\n defines += \"#define FINAL_DOWN_SAMPLER\";\r\n }\r\n var postProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLuminanceDownSample\" + i, \"standard\", [\"dsOffsets\", \"halfDestPixelSize\"], [], { width: size, height: size }, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, defines, textureType);\r\n this.luminanceDownSamplePostProcesses.push(postProcess);\r\n }\r\n // Create callbacks and add effects\r\n var lastLuminance = this.luminancePostProcess;\r\n this.luminanceDownSamplePostProcesses.forEach(function (pp, index) {\r\n var downSampleOffsets = new Array(18);\r\n pp.onApply = function (effect) {\r\n if (!lastLuminance) {\r\n return;\r\n }\r\n var id = 0;\r\n for (var x = -1; x < 2; x++) {\r\n for (var y = -1; y < 2; y++) {\r\n downSampleOffsets[id] = x / lastLuminance.width;\r\n downSampleOffsets[id + 1] = y / lastLuminance.height;\r\n id += 2;\r\n }\r\n }\r\n effect.setArray2(\"dsOffsets\", downSampleOffsets);\r\n effect.setFloat(\"halfDestPixelSize\", 0.5 / lastLuminance.width);\r\n if (index === _this.luminanceDownSamplePostProcesses.length - 1) {\r\n lastLuminance = _this.luminancePostProcess;\r\n }\r\n else {\r\n lastLuminance = pp;\r\n }\r\n };\r\n if (index === _this.luminanceDownSamplePostProcesses.length - 1) {\r\n pp.onAfterRender = function () {\r\n var pixel = scene.getEngine().readPixels(0, 0, 1, 1);\r\n var bit_shift = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector4\"](1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);\r\n _this._hdrCurrentLuminance = (pixel[0] * bit_shift.x + pixel[1] * bit_shift.y + pixel[2] * bit_shift.z + pixel[3] * bit_shift.w) / 100.0;\r\n };\r\n }\r\n _this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLuminanceDownSample\" + index, function () { return pp; }, true));\r\n });\r\n };\r\n // Create HDR post-process\r\n StandardRenderingPipeline.prototype._createHdrPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n var defines = [\"#define HDR\"];\r\n if (this._hdrAutoExposure) {\r\n defines.push(\"#define AUTO_EXPOSURE\");\r\n }\r\n this.hdrPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDR\", \"standard\", [\"averageLuminance\"], [\"textureAdderSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, defines.join(\"\\n\"), _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n var outputLiminance = 1;\r\n var time = 0;\r\n var lastTime = 0;\r\n this.hdrPostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"textureAdderSampler\", _this._currentDepthOfFieldSource);\r\n time += scene.getEngine().getDeltaTime();\r\n if (outputLiminance < 0) {\r\n outputLiminance = _this._hdrCurrentLuminance;\r\n }\r\n else {\r\n var dt = (lastTime - time) / 1000.0;\r\n if (_this._hdrCurrentLuminance < outputLiminance + _this.hdrDecreaseRate * dt) {\r\n outputLiminance += _this.hdrDecreaseRate * dt;\r\n }\r\n else if (_this._hdrCurrentLuminance > outputLiminance - _this.hdrIncreaseRate * dt) {\r\n outputLiminance -= _this.hdrIncreaseRate * dt;\r\n }\r\n else {\r\n outputLiminance = _this._hdrCurrentLuminance;\r\n }\r\n }\r\n if (_this.hdrAutoExposure) {\r\n _this._currentExposure = _this._fixedExposure / outputLiminance;\r\n }\r\n else {\r\n outputLiminance = _Maths_math_scalar__WEBPACK_IMPORTED_MODULE_4__[\"Scalar\"].Clamp(outputLiminance, _this.hdrMinimumLuminance, 1e20);\r\n effect.setFloat(\"averageLuminance\", outputLiminance);\r\n }\r\n lastTime = time;\r\n _this._currentDepthOfFieldSource = _this.hdrFinalPostProcess;\r\n };\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDR\", function () { return _this.hdrPostProcess; }, true));\r\n };\r\n // Create lens flare post-process\r\n StandardRenderingPipeline.prototype._createLensFlarePostProcess = function (scene, ratio) {\r\n var _this = this;\r\n this.lensFlarePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLensFlare\", \"standard\", [\"strength\", \"ghostDispersal\", \"haloWidth\", \"resolution\", \"distortionStrength\"], [\"lensColorSampler\"], ratio / 2, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LENS_FLARE\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLensFlare\", function () { return _this.lensFlarePostProcess; }, true));\r\n this._createBlurPostProcesses(scene, ratio / 4, 2, \"lensFlareBlurWidth\");\r\n this.lensFlareComposePostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRLensFlareCompose\", \"standard\", [\"lensStarMatrix\"], [\"otherSampler\", \"lensDirtSampler\", \"lensStarSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LENS_FLARE_COMPOSE\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRLensFlareCompose\", function () { return _this.lensFlareComposePostProcess; }, true));\r\n var resolution = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"](0, 0);\r\n // Lens flare\r\n this.lensFlarePostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._bloomEnabled ? _this.blurHPostProcesses[0] : _this.originalPostProcess);\r\n effect.setTexture(\"lensColorSampler\", _this.lensColorTexture);\r\n effect.setFloat(\"strength\", _this.lensFlareStrength);\r\n effect.setFloat(\"ghostDispersal\", _this.lensFlareGhostDispersal);\r\n effect.setFloat(\"haloWidth\", _this.lensFlareHaloWidth);\r\n // Shift\r\n resolution.x = _this.lensFlarePostProcess.width;\r\n resolution.y = _this.lensFlarePostProcess.height;\r\n effect.setVector2(\"resolution\", resolution);\r\n effect.setFloat(\"distortionStrength\", _this.lensFlareDistortionStrength);\r\n };\r\n // Compose\r\n var scaleBias1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValues(2.0, 0.0, -1.0, 0.0, 0.0, 2.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n var scaleBias2 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValues(0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n this.lensFlareComposePostProcess.onApply = function (effect) {\r\n if (!_this._scene.activeCamera) {\r\n return;\r\n }\r\n effect.setTextureFromPostProcess(\"otherSampler\", _this._currentDepthOfFieldSource);\r\n effect.setTexture(\"lensDirtSampler\", _this.lensFlareDirtTexture);\r\n effect.setTexture(\"lensStarSampler\", _this.lensStarTexture);\r\n // Lens start rotation matrix\r\n var camerax = _this._scene.activeCamera.getViewMatrix().getRow(0);\r\n var cameraz = _this._scene.activeCamera.getViewMatrix().getRow(2);\r\n var camRot = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(camerax.toVector3(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](1.0, 0.0, 0.0)) + _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Dot(cameraz.toVector3(), new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"](0.0, 0.0, 1.0));\r\n camRot *= 4.0;\r\n var starRotation = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].FromValues(Math.cos(camRot) * 0.5, -Math.sin(camRot), 0.0, 0.0, Math.sin(camRot), Math.cos(camRot) * 0.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n var lensStarMatrix = scaleBias2.multiply(starRotation).multiply(scaleBias1);\r\n effect.setMatrix(\"lensStarMatrix\", lensStarMatrix);\r\n _this._currentDepthOfFieldSource = _this.lensFlareFinalPostProcess;\r\n };\r\n };\r\n // Create depth-of-field post-process\r\n StandardRenderingPipeline.prototype._createDepthOfFieldPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n this.depthOfFieldPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRDepthOfField\", \"standard\", [\"distance\"], [\"otherSampler\", \"depthSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define DEPTH_OF_FIELD\", _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this.depthOfFieldPostProcess.onApply = function (effect) {\r\n effect.setTextureFromPostProcess(\"otherSampler\", _this._currentDepthOfFieldSource);\r\n effect.setTexture(\"depthSampler\", _this._getDepthTexture());\r\n effect.setFloat(\"distance\", _this.depthOfFieldDistance);\r\n };\r\n // Add to pipeline\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRDepthOfField\", function () { return _this.depthOfFieldPostProcess; }, true));\r\n };\r\n // Create motion blur post-process\r\n StandardRenderingPipeline.prototype._createMotionBlurPostProcess = function (scene, ratio) {\r\n var _this = this;\r\n if (this._isObjectBasedMotionBlur) {\r\n var mb = new _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_13__[\"MotionBlurPostProcess\"](\"HDRMotionBlur\", scene, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n mb.motionStrength = this.motionStrength;\r\n mb.motionBlurSamples = this.motionBlurSamples;\r\n this.motionBlurPostProcess = mb;\r\n }\r\n else {\r\n this.motionBlurPostProcess = new _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_6__[\"PostProcess\"](\"HDRMotionBlur\", \"standard\", [\"inverseViewProjection\", \"prevViewProjection\", \"screenSize\", \"motionScale\", \"motionStrength\"], [\"depthSampler\"], ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \" + this.motionBlurSamples.toFixed(1), _Engines_constants__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n var motionScale = 0;\r\n var prevViewProjection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n var invViewProjection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n var viewProjection = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n var screenSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n this.motionBlurPostProcess.onApply = function (effect) {\r\n viewProjection = scene.getProjectionMatrix().multiply(scene.getViewMatrix());\r\n viewProjection.invertToRef(invViewProjection);\r\n effect.setMatrix(\"inverseViewProjection\", invViewProjection);\r\n effect.setMatrix(\"prevViewProjection\", prevViewProjection);\r\n prevViewProjection = viewProjection;\r\n screenSize.x = _this.motionBlurPostProcess.width;\r\n screenSize.y = _this.motionBlurPostProcess.height;\r\n effect.setVector2(\"screenSize\", screenSize);\r\n motionScale = scene.getEngine().getFps() / 60.0;\r\n effect.setFloat(\"motionScale\", motionScale);\r\n effect.setFloat(\"motionStrength\", _this.motionStrength);\r\n effect.setTexture(\"depthSampler\", _this._getDepthTexture());\r\n };\r\n }\r\n this.addEffect(new _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_8__[\"PostProcessRenderEffect\"](scene.getEngine(), \"HDRMotionBlur\", function () { return _this.motionBlurPostProcess; }, true));\r\n };\r\n StandardRenderingPipeline.prototype._getDepthTexture = function () {\r\n if (this._scene.getEngine().getCaps().drawBuffersExtension) {\r\n var renderer = this._scene.enableGeometryBufferRenderer();\r\n return renderer.getGBuffer().textures[0];\r\n }\r\n return this._scene.enableDepthRenderer().getDepthMap();\r\n };\r\n StandardRenderingPipeline.prototype._disposePostProcesses = function () {\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n var camera = this._cameras[i];\r\n if (this.originalPostProcess) {\r\n this.originalPostProcess.dispose(camera);\r\n }\r\n if (this.downSampleX4PostProcess) {\r\n this.downSampleX4PostProcess.dispose(camera);\r\n }\r\n if (this.brightPassPostProcess) {\r\n this.brightPassPostProcess.dispose(camera);\r\n }\r\n if (this.textureAdderPostProcess) {\r\n this.textureAdderPostProcess.dispose(camera);\r\n }\r\n if (this.textureAdderFinalPostProcess) {\r\n this.textureAdderFinalPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightPostProcess) {\r\n this.volumetricLightPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightSmoothXPostProcess) {\r\n this.volumetricLightSmoothXPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightSmoothYPostProcess) {\r\n this.volumetricLightSmoothYPostProcess.dispose(camera);\r\n }\r\n if (this.volumetricLightMergePostProces) {\r\n this.volumetricLightMergePostProces.dispose(camera);\r\n }\r\n if (this.volumetricLightFinalPostProcess) {\r\n this.volumetricLightFinalPostProcess.dispose(camera);\r\n }\r\n if (this.lensFlarePostProcess) {\r\n this.lensFlarePostProcess.dispose(camera);\r\n }\r\n if (this.lensFlareComposePostProcess) {\r\n this.lensFlareComposePostProcess.dispose(camera);\r\n }\r\n for (var j = 0; j < this.luminanceDownSamplePostProcesses.length; j++) {\r\n this.luminanceDownSamplePostProcesses[j].dispose(camera);\r\n }\r\n if (this.luminancePostProcess) {\r\n this.luminancePostProcess.dispose(camera);\r\n }\r\n if (this.hdrPostProcess) {\r\n this.hdrPostProcess.dispose(camera);\r\n }\r\n if (this.hdrFinalPostProcess) {\r\n this.hdrFinalPostProcess.dispose(camera);\r\n }\r\n if (this.depthOfFieldPostProcess) {\r\n this.depthOfFieldPostProcess.dispose(camera);\r\n }\r\n if (this.motionBlurPostProcess) {\r\n this.motionBlurPostProcess.dispose(camera);\r\n }\r\n if (this.fxaaPostProcess) {\r\n this.fxaaPostProcess.dispose(camera);\r\n }\r\n for (var j = 0; j < this.blurHPostProcesses.length; j++) {\r\n this.blurHPostProcesses[j].dispose(camera);\r\n }\r\n for (var j = 0; j < this.blurVPostProcesses.length; j++) {\r\n this.blurVPostProcesses[j].dispose(camera);\r\n }\r\n }\r\n this.originalPostProcess = null;\r\n this.downSampleX4PostProcess = null;\r\n this.brightPassPostProcess = null;\r\n this.textureAdderPostProcess = null;\r\n this.textureAdderFinalPostProcess = null;\r\n this.volumetricLightPostProcess = null;\r\n this.volumetricLightSmoothXPostProcess = null;\r\n this.volumetricLightSmoothYPostProcess = null;\r\n this.volumetricLightMergePostProces = null;\r\n this.volumetricLightFinalPostProcess = null;\r\n this.lensFlarePostProcess = null;\r\n this.lensFlareComposePostProcess = null;\r\n this.luminancePostProcess = null;\r\n this.hdrPostProcess = null;\r\n this.hdrFinalPostProcess = null;\r\n this.depthOfFieldPostProcess = null;\r\n this.motionBlurPostProcess = null;\r\n this.fxaaPostProcess = null;\r\n this.luminanceDownSamplePostProcesses = [];\r\n this.blurHPostProcesses = [];\r\n this.blurVPostProcesses = [];\r\n };\r\n /**\r\n * Dispose of the pipeline and stop all post processes\r\n */\r\n StandardRenderingPipeline.prototype.dispose = function () {\r\n this._disposePostProcesses();\r\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Serialize the rendering pipeline (Used when exporting)\r\n * @returns the serialized object\r\n */\r\n StandardRenderingPipeline.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this);\r\n if (this.sourceLight) {\r\n serializationObject.sourceLightId = this.sourceLight.id;\r\n }\r\n serializationObject.customType = \"StandardRenderingPipeline\";\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the serialized pipeline\r\n * @param source Source pipeline.\r\n * @param scene The scene to load the pipeline to.\r\n * @param rootUrl The URL of the serialized pipeline.\r\n * @returns An instantiated pipeline from the serialized object.\r\n */\r\n StandardRenderingPipeline.Parse = function (source, scene, rootUrl) {\r\n var p = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return new StandardRenderingPipeline(source._name, scene, source._ratio); }, source, scene, rootUrl);\r\n if (source.sourceLightId) {\r\n p.sourceLight = scene.getLightByID(source.sourceLightId);\r\n }\r\n return p;\r\n };\r\n /**\r\n * Luminance steps\r\n */\r\n StandardRenderingPipeline.LuminanceSteps = 6;\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"brightThreshold\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"blurWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"horizontalBlur\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"exposure\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightCoefficient\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightPower\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightBlurScale\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrMinimumLuminance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrDecreaseRate\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrIncreaseRate\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"hdrAutoExposure\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensColorTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensColorTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareGhostDispersal\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareHaloWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareDistortionStrength\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"lensFlareBlurWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensStarTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensStarTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsTexture\"])(\"lensFlareDirtTexture\")\r\n ], StandardRenderingPipeline.prototype, \"lensFlareDirtTexture\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"depthOfFieldDistance\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"depthOfFieldBlurWidth\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"motionStrength\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"objectBasedMotionBlur\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"_ratio\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"BloomEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"DepthOfFieldEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"LensFlareEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"HDREnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"VLSEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"MotionBlurEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"fxaaEnabled\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"volumetricLightStepsCount\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"motionBlurSamples\", null);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], StandardRenderingPipeline.prototype, \"samples\", null);\r\n return StandardRenderingPipeline;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_7__[\"PostProcessRenderPipeline\"]));\r\n\r\n_Misc_typeStore__WEBPACK_IMPORTED_MODULE_12__[\"_TypeStore\"].RegisteredTypes[\"BABYLON.StandardRenderingPipeline\"] = StandardRenderingPipeline;\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/index.ts\":\n/*!***********************************************!*\\\n !*** ./PostProcesses/RenderPipeline/index.ts ***!\n \\***********************************************/\n/*! exports provided: PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Pipelines/index */ \"./PostProcesses/RenderPipeline/Pipelines/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _Pipelines_index__WEBPACK_IMPORTED_MODULE_0__[\"StandardRenderingPipeline\"]; });\n\n/* harmony import */ var _postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__[\"PostProcessRenderEffect\"]; });\n\n/* harmony import */ var _postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcessRenderPipeline */ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _postProcessRenderPipeline__WEBPACK_IMPORTED_MODULE_2__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony import */ var _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcessRenderPipelineManager */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_3__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony import */ var _postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./postProcessRenderPipelineManagerSceneComponent */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _postProcessRenderPipelineManagerSceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\":\n/*!*****************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderEffect.ts ***!\n \\*****************************************************************/\n/*! exports provided: PostProcessRenderEffect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return PostProcessRenderEffect; });\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n\r\n/**\r\n * This represents a set of one or more post processes in Babylon.\r\n * A post process can be used to apply a shader to a texture after it is rendered.\r\n * @example https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\nvar PostProcessRenderEffect = /** @class */ (function () {\r\n /**\r\n * Instantiates a post process render effect.\r\n * A post process can be used to apply a shader to a texture after it is rendered.\r\n * @param engine The engine the effect is tied to\r\n * @param name The name of the effect\r\n * @param getPostProcesses A function that returns a set of post processes which the effect will run in order to be run.\r\n * @param singleInstance False if this post process can be run on multiple cameras. (default: true)\r\n */\r\n function PostProcessRenderEffect(engine, name, getPostProcesses, singleInstance) {\r\n this._name = name;\r\n this._singleInstance = singleInstance || true;\r\n this._getPostProcesses = getPostProcesses;\r\n this._cameras = {};\r\n this._indicesForCamera = {};\r\n this._postProcesses = {};\r\n }\r\n Object.defineProperty(PostProcessRenderEffect.prototype, \"isSupported\", {\r\n /**\r\n * Checks if all the post processes in the effect are supported.\r\n */\r\n get: function () {\r\n for (var index in this._postProcesses) {\r\n if (this._postProcesses.hasOwnProperty(index)) {\r\n var pps = this._postProcesses[index];\r\n for (var ppIndex = 0; ppIndex < pps.length; ppIndex++) {\r\n if (!pps[ppIndex].isSupported) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the current state of the effect\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._update = function () {\r\n };\r\n /**\r\n * Attaches the effect on cameras\r\n * @param cameras The camera to attach to.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._attachCameras = function (cameras) {\r\n var _this = this;\r\n var cameraKey;\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n if (this._singleInstance) {\r\n cameraKey = 0;\r\n }\r\n else {\r\n cameraKey = cameraName;\r\n }\r\n if (!this._postProcesses[cameraKey]) {\r\n var postProcess = this._getPostProcesses();\r\n if (postProcess) {\r\n this._postProcesses[cameraKey] = Array.isArray(postProcess) ? postProcess : [postProcess];\r\n }\r\n }\r\n if (!this._indicesForCamera[cameraName]) {\r\n this._indicesForCamera[cameraName] = [];\r\n }\r\n this._postProcesses[cameraKey].forEach(function (postProcess) {\r\n var index = camera.attachPostProcess(postProcess);\r\n _this._indicesForCamera[cameraName].push(index);\r\n });\r\n if (!this._cameras[cameraName]) {\r\n this._cameras[cameraName] = camera;\r\n }\r\n }\r\n };\r\n /**\r\n * Detatches the effect on cameras\r\n * @param cameras The camera to detatch from.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._detachCameras = function (cameras) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n var postProcesses = this._postProcesses[this._singleInstance ? 0 : cameraName];\r\n if (postProcesses) {\r\n postProcesses.forEach(function (postProcess) {\r\n camera.detachPostProcess(postProcess);\r\n });\r\n }\r\n if (this._cameras[cameraName]) {\r\n this._cameras[cameraName] = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Enables the effect on given cameras\r\n * @param cameras The camera to enable.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._enable = function (cameras) {\r\n var _this = this;\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n for (var j = 0; j < this._indicesForCamera[cameraName].length; j++) {\r\n if (camera._postProcesses[this._indicesForCamera[cameraName][j]] === undefined || camera._postProcesses[this._indicesForCamera[cameraName][j]] === null) {\r\n this._postProcesses[this._singleInstance ? 0 : cameraName].forEach(function (postProcess) {\r\n cams[i].attachPostProcess(postProcess, _this._indicesForCamera[cameraName][j]);\r\n });\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Disables the effect on the given cameras\r\n * @param cameras The camera to disable.\r\n * @hidden\r\n */\r\n PostProcessRenderEffect.prototype._disable = function (cameras) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_0__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n this._postProcesses[this._singleInstance ? 0 : cameraName].forEach(function (postProcess) {\r\n camera.detachPostProcess(postProcess);\r\n });\r\n }\r\n };\r\n /**\r\n * Gets a list of the post processes contained in the effect.\r\n * @param camera The camera to get the post processes on.\r\n * @returns The list of the post processes in the effect.\r\n */\r\n PostProcessRenderEffect.prototype.getPostProcesses = function (camera) {\r\n if (this._singleInstance) {\r\n return this._postProcesses[0];\r\n }\r\n else {\r\n if (!camera) {\r\n return null;\r\n }\r\n return this._postProcesses[camera.name];\r\n }\r\n };\r\n return PostProcessRenderEffect;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts\":\n/*!*******************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderPipeline.ts ***!\n \\*******************************************************************/\n/*! exports provided: PostProcessRenderPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return PostProcessRenderPipeline; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Misc/decorators */ \"./Misc/decorators.ts\");\n\r\n\r\n\r\n/**\r\n * PostProcessRenderPipeline\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\nvar PostProcessRenderPipeline = /** @class */ (function () {\r\n /**\r\n * Initializes a PostProcessRenderPipeline\r\n * @param engine engine to add the pipeline to\r\n * @param name name of the pipeline\r\n */\r\n function PostProcessRenderPipeline(engine, name) {\r\n this.engine = engine;\r\n this._name = name;\r\n this._renderEffects = {};\r\n this._renderEffectsForIsolatedPass = new Array();\r\n this._cameras = [];\r\n }\r\n Object.defineProperty(PostProcessRenderPipeline.prototype, \"name\", {\r\n /**\r\n * Gets pipeline name\r\n */\r\n get: function () {\r\n return this._name;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the class name\r\n * @returns \"PostProcessRenderPipeline\"\r\n */\r\n PostProcessRenderPipeline.prototype.getClassName = function () {\r\n return \"PostProcessRenderPipeline\";\r\n };\r\n Object.defineProperty(PostProcessRenderPipeline.prototype, \"isSupported\", {\r\n /**\r\n * If all the render effects in the pipeline are supported\r\n */\r\n get: function () {\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n if (!this._renderEffects[renderEffectName].isSupported) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds an effect to the pipeline\r\n * @param renderEffect the effect to add\r\n */\r\n PostProcessRenderPipeline.prototype.addEffect = function (renderEffect) {\r\n this._renderEffects[renderEffect._name] = renderEffect;\r\n };\r\n // private\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._rebuild = function () {\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._enableEffect = function (renderEffectName, cameras) {\r\n var renderEffects = this._renderEffects[renderEffectName];\r\n if (!renderEffects) {\r\n return;\r\n }\r\n renderEffects._enable(_Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras));\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._disableEffect = function (renderEffectName, cameras) {\r\n var renderEffects = this._renderEffects[renderEffectName];\r\n if (!renderEffects) {\r\n return;\r\n }\r\n renderEffects._disable(_Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras));\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._attachCameras = function (cameras, unique) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n var indicesToDelete = [];\r\n var i;\r\n for (i = 0; i < cams.length; i++) {\r\n var camera = cams[i];\r\n var cameraName = camera.name;\r\n if (this._cameras.indexOf(camera) === -1) {\r\n this._cameras[cameraName] = camera;\r\n }\r\n else if (unique) {\r\n indicesToDelete.push(i);\r\n }\r\n }\r\n for (i = 0; i < indicesToDelete.length; i++) {\r\n cameras.splice(indicesToDelete[i], 1);\r\n }\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n this._renderEffects[renderEffectName]._attachCameras(cams);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._detachCameras = function (cameras) {\r\n var cams = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].MakeArray(cameras || this._cameras);\r\n if (!cams) {\r\n return;\r\n }\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n this._renderEffects[renderEffectName]._detachCameras(cams);\r\n }\r\n }\r\n for (var i = 0; i < cams.length; i++) {\r\n this._cameras.splice(this._cameras.indexOf(cams[i]), 1);\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._update = function () {\r\n for (var renderEffectName in this._renderEffects) {\r\n if (this._renderEffects.hasOwnProperty(renderEffectName)) {\r\n this._renderEffects[renderEffectName]._update();\r\n }\r\n }\r\n for (var i = 0; i < this._cameras.length; i++) {\r\n var cameraName = this._cameras[i].name;\r\n if (this._renderEffectsForIsolatedPass[cameraName]) {\r\n this._renderEffectsForIsolatedPass[cameraName]._update();\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipeline.prototype._reset = function () {\r\n this._renderEffects = {};\r\n this._renderEffectsForIsolatedPass = new Array();\r\n };\r\n PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function (sampleCount) {\r\n if (this.engine.webGLVersion === 1) {\r\n return false;\r\n }\r\n // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)\r\n var effectKeys = Object.keys(this._renderEffects);\r\n if (effectKeys.length > 0) {\r\n var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();\r\n if (postProcesses) {\r\n postProcesses[0].samples = sampleCount;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Disposes of the pipeline\r\n */\r\n PostProcessRenderPipeline.prototype.dispose = function () {\r\n // Must be implemented by children\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], PostProcessRenderPipeline.prototype, \"_name\", void 0);\r\n return PostProcessRenderPipeline;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts\":\n/*!**************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts ***!\n \\**************************************************************************/\n/*! exports provided: PostProcessRenderPipelineManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return PostProcessRenderPipelineManager; });\n/**\r\n * PostProcessRenderPipelineManager class\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\nvar PostProcessRenderPipelineManager = /** @class */ (function () {\r\n /**\r\n * Initializes a PostProcessRenderPipelineManager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocessrenderpipeline\r\n */\r\n function PostProcessRenderPipelineManager() {\r\n this._renderPipelines = {};\r\n }\r\n Object.defineProperty(PostProcessRenderPipelineManager.prototype, \"supportedPipelines\", {\r\n /**\r\n * Gets the list of supported render pipelines\r\n */\r\n get: function () {\r\n var result = [];\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n if (pipeline.isSupported) {\r\n result.push(pipeline);\r\n }\r\n }\r\n }\r\n return result;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a pipeline to the manager\r\n * @param renderPipeline The pipeline to add\r\n */\r\n PostProcessRenderPipelineManager.prototype.addPipeline = function (renderPipeline) {\r\n this._renderPipelines[renderPipeline._name] = renderPipeline;\r\n };\r\n /**\r\n * Attaches a camera to the pipeline\r\n * @param renderPipelineName The name of the pipeline to attach to\r\n * @param cameras the camera to attach\r\n * @param unique if the camera can be attached multiple times to the pipeline\r\n */\r\n PostProcessRenderPipelineManager.prototype.attachCamerasToRenderPipeline = function (renderPipelineName, cameras, unique) {\r\n if (unique === void 0) { unique = false; }\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._attachCameras(cameras, unique);\r\n };\r\n /**\r\n * Detaches a camera from the pipeline\r\n * @param renderPipelineName The name of the pipeline to detach from\r\n * @param cameras the camera to detach\r\n */\r\n PostProcessRenderPipelineManager.prototype.detachCamerasFromRenderPipeline = function (renderPipelineName, cameras) {\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._detachCameras(cameras);\r\n };\r\n /**\r\n * Enables an effect by name on a pipeline\r\n * @param renderPipelineName the name of the pipeline to enable the effect in\r\n * @param renderEffectName the name of the effect to enable\r\n * @param cameras the cameras that the effect should be enabled on\r\n */\r\n PostProcessRenderPipelineManager.prototype.enableEffectInPipeline = function (renderPipelineName, renderEffectName, cameras) {\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._enableEffect(renderEffectName, cameras);\r\n };\r\n /**\r\n * Disables an effect by name on a pipeline\r\n * @param renderPipelineName the name of the pipeline to disable the effect in\r\n * @param renderEffectName the name of the effect to disable\r\n * @param cameras the cameras that the effect should be disabled on\r\n */\r\n PostProcessRenderPipelineManager.prototype.disableEffectInPipeline = function (renderPipelineName, renderEffectName, cameras) {\r\n var renderPipeline = this._renderPipelines[renderPipelineName];\r\n if (!renderPipeline) {\r\n return;\r\n }\r\n renderPipeline._disableEffect(renderEffectName, cameras);\r\n };\r\n /**\r\n * Updates the state of all contained render pipelines and disposes of any non supported pipelines\r\n */\r\n PostProcessRenderPipelineManager.prototype.update = function () {\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n if (!pipeline.isSupported) {\r\n pipeline.dispose();\r\n delete this._renderPipelines[renderPipelineName];\r\n }\r\n else {\r\n pipeline._update();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n PostProcessRenderPipelineManager.prototype._rebuild = function () {\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n pipeline._rebuild();\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes of the manager and pipelines\r\n */\r\n PostProcessRenderPipelineManager.prototype.dispose = function () {\r\n for (var renderPipelineName in this._renderPipelines) {\r\n if (this._renderPipelines.hasOwnProperty(renderPipelineName)) {\r\n var pipeline = this._renderPipelines[renderPipelineName];\r\n pipeline.dispose();\r\n }\r\n }\r\n };\r\n return PostProcessRenderPipelineManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts\":\n/*!****************************************************************************************!*\\\n !*** ./PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.ts ***!\n \\****************************************************************************************/\n/*! exports provided: PostProcessRenderPipelineManagerSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return PostProcessRenderPipelineManagerSceneComponent; });\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcessRenderPipelineManager */ \"./PostProcesses/RenderPipeline/postProcessRenderPipelineManager.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../scene */ \"./scene.ts\");\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype, \"postProcessRenderPipelineManager\", {\r\n get: function () {\r\n if (!this._postProcessRenderPipelineManager) {\r\n // Register the G Buffer component to the scene.\r\n var component = this._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].NAME_POSTPROCESSRENDERPIPELINEMANAGER);\r\n if (!component) {\r\n component = new PostProcessRenderPipelineManagerSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n this._postProcessRenderPipelineManager = new _postProcessRenderPipelineManager__WEBPACK_IMPORTED_MODULE_1__[\"PostProcessRenderPipelineManager\"]();\r\n }\r\n return this._postProcessRenderPipelineManager;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Defines the Render Pipeline scene component responsible to rendering pipelines\r\n */\r\nvar PostProcessRenderPipelineManagerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function PostProcessRenderPipelineManagerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].NAME_POSTPROCESSRENDERPIPELINEMANAGER;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n PostProcessRenderPipelineManagerSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_0__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER, this, this._gatherRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n PostProcessRenderPipelineManagerSceneComponent.prototype.rebuild = function () {\r\n if (this.scene._postProcessRenderPipelineManager) {\r\n this.scene._postProcessRenderPipelineManager._rebuild();\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n PostProcessRenderPipelineManagerSceneComponent.prototype.dispose = function () {\r\n if (this.scene._postProcessRenderPipelineManager) {\r\n this.scene._postProcessRenderPipelineManager.dispose();\r\n }\r\n };\r\n PostProcessRenderPipelineManagerSceneComponent.prototype._gatherRenderTargets = function () {\r\n if (this.scene._postProcessRenderPipelineManager) {\r\n this.scene._postProcessRenderPipelineManager.update();\r\n }\r\n };\r\n return PostProcessRenderPipelineManagerSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/anaglyphPostProcess.ts\":\n/*!**********************************************!*\\\n !*** ./PostProcesses/anaglyphPostProcess.ts ***!\n \\**********************************************/\n/*! exports provided: AnaglyphPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return AnaglyphPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_anaglyph_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/anaglyph.fragment */ \"./Shaders/anaglyph.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Postprocess used to generate anaglyphic rendering\r\n */\r\nvar AnaglyphPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AnaglyphPostProcess, _super);\r\n /**\r\n * Creates a new AnaglyphPostProcess\r\n * @param name defines postprocess name\r\n * @param options defines creation options or target ratio scale\r\n * @param rigCameras defines cameras using this postprocess\r\n * @param samplingMode defines required sampling mode (BABYLON.Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param engine defines hosting engine\r\n * @param reusable defines if the postprocess will be reused multiple times per frame\r\n */\r\n function AnaglyphPostProcess(name, options, rigCameras, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"anaglyph\", null, [\"leftSampler\"], options, rigCameras[1], samplingMode, engine, reusable) || this;\r\n _this._passedProcess = rigCameras[0]._rigPostProcess;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"leftSampler\", _this._passedProcess);\r\n });\r\n return _this;\r\n }\r\n return AnaglyphPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/blackAndWhitePostProcess.ts\":\n/*!***************************************************!*\\\n !*** ./PostProcesses/blackAndWhitePostProcess.ts ***!\n \\***************************************************/\n/*! exports provided: BlackAndWhitePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return BlackAndWhitePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_blackAndWhite_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/blackAndWhite.fragment */ \"./Shaders/blackAndWhite.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Post process used to render in black and white\r\n */\r\nvar BlackAndWhitePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BlackAndWhitePostProcess, _super);\r\n /**\r\n * Creates a black and white post process\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#black-and-white\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function BlackAndWhitePostProcess(name, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"blackAndWhite\", [\"degree\"], null, options, camera, samplingMode, engine, reusable) || this;\r\n /**\r\n * Linear about to convert he result to black and white (default: 1)\r\n */\r\n _this.degree = 1;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat(\"degree\", _this.degree);\r\n });\r\n return _this;\r\n }\r\n return BlackAndWhitePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/bloomEffect.ts\":\n/*!**************************************!*\\\n !*** ./PostProcesses/bloomEffect.ts ***!\n \\**************************************/\n/*! exports provided: BloomEffect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return BloomEffect; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extractHighlightsPostProcess */ \"./PostProcesses/extractHighlightsPostProcess.ts\");\n/* harmony import */ var _blurPostProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bloomMergePostProcess */ \"./PostProcesses/bloomMergePostProcess.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The bloom effect spreads bright areas of an image to simulate artifacts seen in cameras\r\n */\r\nvar BloomEffect = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BloomEffect, _super);\r\n /**\r\n * Creates a new instance of @see BloomEffect\r\n * @param scene The scene the effect belongs to.\r\n * @param bloomScale The ratio of the blur texture to the input texture that should be used to compute the bloom.\r\n * @param bloomKernel The size of the kernel to be used when applying the blur.\r\n * @param bloomWeight The the strength of bloom.\r\n * @param pipelineTextureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function BloomEffect(scene, bloomScale, bloomWeight, bloomKernel, pipelineTextureType, blockCompilation) {\r\n if (pipelineTextureType === void 0) { pipelineTextureType = 0; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, scene.getEngine(), \"bloom\", function () {\r\n return _this._effects;\r\n }, true) || this;\r\n _this.bloomScale = bloomScale;\r\n /**\r\n * @hidden Internal\r\n */\r\n _this._effects = [];\r\n _this._downscale = new _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"ExtractHighlightsPostProcess\"](\"highlights\", 1.0, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n _this._blurX = new _blurPostProcess__WEBPACK_IMPORTED_MODULE_3__[\"BlurPostProcess\"](\"horizontal blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](1.0, 0), 10.0, bloomScale, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, undefined, blockCompilation);\r\n _this._blurX.alwaysForcePOT = true;\r\n _this._blurX.autoClear = false;\r\n _this._blurY = new _blurPostProcess__WEBPACK_IMPORTED_MODULE_3__[\"BlurPostProcess\"](\"vertical blur\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector2\"](0, 1.0), 10.0, bloomScale, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, undefined, blockCompilation);\r\n _this._blurY.alwaysForcePOT = true;\r\n _this._blurY.autoClear = false;\r\n _this.kernel = bloomKernel;\r\n _this._effects = [_this._downscale, _this._blurX, _this._blurY];\r\n _this._merge = new _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BloomMergePostProcess\"](\"bloomMerge\", _this._downscale, _this._blurY, bloomWeight, bloomScale, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n _this._merge.autoClear = false;\r\n _this._effects.push(_this._merge);\r\n return _this;\r\n }\r\n Object.defineProperty(BloomEffect.prototype, \"threshold\", {\r\n /**\r\n * The luminance threshold to find bright areas of the image to bloom.\r\n */\r\n get: function () {\r\n return this._downscale.threshold;\r\n },\r\n set: function (value) {\r\n this._downscale.threshold = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BloomEffect.prototype, \"weight\", {\r\n /**\r\n * The strength of the bloom.\r\n */\r\n get: function () {\r\n return this._merge.weight;\r\n },\r\n set: function (value) {\r\n this._merge.weight = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BloomEffect.prototype, \"kernel\", {\r\n /**\r\n * Specifies the size of the bloom blur kernel, relative to the final output size\r\n */\r\n get: function () {\r\n return this._blurX.kernel / this.bloomScale;\r\n },\r\n set: function (value) {\r\n this._blurX.kernel = value * this.bloomScale;\r\n this._blurY.kernel = value * this.bloomScale;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes each of the internal effects for a given camera.\r\n * @param camera The camera to dispose the effect on.\r\n */\r\n BloomEffect.prototype.disposeEffects = function (camera) {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].dispose(camera);\r\n }\r\n };\r\n /**\r\n * @hidden Internal\r\n */\r\n BloomEffect.prototype._updateEffects = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].updateEffect();\r\n }\r\n };\r\n /**\r\n * Internal\r\n * @returns if all the contained post processes are ready.\r\n * @hidden\r\n */\r\n BloomEffect.prototype._isReady = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n if (!this._effects[effectIndex].isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n return BloomEffect;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_1__[\"PostProcessRenderEffect\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/bloomMergePostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/bloomMergePostProcess.ts ***!\n \\************************************************/\n/*! exports provided: BloomMergePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return BloomMergePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_bloomMerge_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/bloomMerge.fragment */ \"./Shaders/bloomMerge.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The BloomMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\r\n */\r\nvar BloomMergePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BloomMergePostProcess, _super);\r\n /**\r\n * Creates a new instance of @see BloomMergePostProcess\r\n * @param name The name of the effect.\r\n * @param originalFromInput Post process which's input will be used for the merge.\r\n * @param blurred Blurred highlights post process which's output will be used.\r\n * @param weight Weight of the bloom to be added to the original input.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function BloomMergePostProcess(name, originalFromInput, blurred, \r\n /** Weight of the bloom to be added to the original input. */\r\n weight, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"bloomMerge\", [\"bloomWeight\"], [\"circleOfConfusionSampler\", \"blurStep0\", \"blurStep1\", \"blurStep2\", \"bloomBlur\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true) || this;\r\n _this.weight = weight;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\r\n effect.setTextureFromPostProcessOutput(\"bloomBlur\", blurred);\r\n effect.setFloat(\"bloomWeight\", _this.weight);\r\n });\r\n if (!blockCompilation) {\r\n _this.updateEffect();\r\n }\r\n return _this;\r\n }\r\n return BloomMergePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/blurPostProcess.ts\":\n/*!******************************************!*\\\n !*** ./PostProcesses/blurPostProcess.ts ***!\n \\******************************************/\n/*! exports provided: BlurPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return BlurPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_kernelBlur_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/kernelBlur.fragment */ \"./Shaders/kernelBlur.fragment.ts\");\n/* harmony import */ var _Shaders_kernelBlur_vertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Shaders/kernelBlur.vertex */ \"./Shaders/kernelBlur.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Blur Post Process which blurs an image based on a kernel and direction.\r\n * Can be used twice in x and y directions to perform a guassian blur in two passes.\r\n */\r\nvar BlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](BlurPostProcess, _super);\r\n /**\r\n * Creates a new instance BlurPostProcess\r\n * @param name The name of the effect.\r\n * @param direction The direction in which to blur the image.\r\n * @param kernel The size of the kernel to be used when computing the blur. eg. Size of 3 will blur the center pixel by 2 pixels surrounding it.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function BlurPostProcess(name, \r\n /** The direction in which to blur the image. */\r\n direction, kernel, options, camera, samplingMode, engine, reusable, textureType, defines, blockCompilation) {\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (defines === void 0) { defines = \"\"; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"kernelBlur\", [\"delta\", \"direction\", \"cameraMinMaxZ\"], [\"circleOfConfusionSampler\"], options, camera, samplingMode, engine, reusable, null, textureType, \"kernelBlur\", { varyingCount: 0, depCount: 0 }, true) || this;\r\n _this.direction = direction;\r\n _this.blockCompilation = blockCompilation;\r\n _this._packedFloat = false;\r\n _this._staticDefines = \"\";\r\n _this._staticDefines = defines;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (_this._outputTexture) {\r\n effect.setFloat2('delta', (1 / _this._outputTexture.width) * _this.direction.x, (1 / _this._outputTexture.height) * _this.direction.y);\r\n }\r\n else {\r\n effect.setFloat2('delta', (1 / _this.width) * _this.direction.x, (1 / _this.height) * _this.direction.y);\r\n }\r\n });\r\n _this.kernel = kernel;\r\n return _this;\r\n }\r\n Object.defineProperty(BlurPostProcess.prototype, \"kernel\", {\r\n /**\r\n * Gets the length in pixels of the blur sample region\r\n */\r\n get: function () {\r\n return this._idealKernel;\r\n },\r\n /**\r\n * Sets the length in pixels of the blur sample region\r\n */\r\n set: function (v) {\r\n if (this._idealKernel === v) {\r\n return;\r\n }\r\n v = Math.max(v, 1);\r\n this._idealKernel = v;\r\n this._kernel = this._nearestBestKernel(v);\r\n if (!this.blockCompilation) {\r\n this._updateParameters();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BlurPostProcess.prototype, \"packedFloat\", {\r\n /**\r\n * Gets wether or not the blur is unpacking/repacking floats\r\n */\r\n get: function () {\r\n return this._packedFloat;\r\n },\r\n /**\r\n * Sets wether or not the blur needs to unpack/repack floats\r\n */\r\n set: function (v) {\r\n if (this._packedFloat === v) {\r\n return;\r\n }\r\n this._packedFloat = v;\r\n if (!this.blockCompilation) {\r\n this._updateParameters();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n */\r\n BlurPostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n this._updateParameters(onCompiled, onError);\r\n };\r\n BlurPostProcess.prototype._updateParameters = function (onCompiled, onError) {\r\n // Generate sampling offsets and weights\r\n var N = this._kernel;\r\n var centerIndex = (N - 1) / 2;\r\n // Generate Gaussian sampling weights over kernel\r\n var offsets = [];\r\n var weights = [];\r\n var totalWeight = 0;\r\n for (var i = 0; i < N; i++) {\r\n var u = i / (N - 1);\r\n var w = this._gaussianWeight(u * 2.0 - 1);\r\n offsets[i] = (i - centerIndex);\r\n weights[i] = w;\r\n totalWeight += w;\r\n }\r\n // Normalize weights\r\n for (var i = 0; i < weights.length; i++) {\r\n weights[i] /= totalWeight;\r\n }\r\n // Optimize: combine samples to take advantage of hardware linear sampling\r\n // Walk from left to center, combining pairs (symmetrically)\r\n var linearSamplingWeights = [];\r\n var linearSamplingOffsets = [];\r\n var linearSamplingMap = [];\r\n for (var i = 0; i <= centerIndex; i += 2) {\r\n var j = Math.min(i + 1, Math.floor(centerIndex));\r\n var singleCenterSample = i === j;\r\n if (singleCenterSample) {\r\n linearSamplingMap.push({ o: offsets[i], w: weights[i] });\r\n }\r\n else {\r\n var sharedCell = j === centerIndex;\r\n var weightLinear = (weights[i] + weights[j] * (sharedCell ? .5 : 1.));\r\n var offsetLinear = offsets[i] + 1 / (1 + weights[i] / weights[j]);\r\n if (offsetLinear === 0) {\r\n linearSamplingMap.push({ o: offsets[i], w: weights[i] });\r\n linearSamplingMap.push({ o: offsets[i + 1], w: weights[i + 1] });\r\n }\r\n else {\r\n linearSamplingMap.push({ o: offsetLinear, w: weightLinear });\r\n linearSamplingMap.push({ o: -offsetLinear, w: weightLinear });\r\n }\r\n }\r\n }\r\n for (var i = 0; i < linearSamplingMap.length; i++) {\r\n linearSamplingOffsets[i] = linearSamplingMap[i].o;\r\n linearSamplingWeights[i] = linearSamplingMap[i].w;\r\n }\r\n // Replace with optimized\r\n offsets = linearSamplingOffsets;\r\n weights = linearSamplingWeights;\r\n // Generate shaders\r\n var maxVaryingRows = this.getEngine().getCaps().maxVaryingVectors;\r\n var freeVaryingVec2 = Math.max(maxVaryingRows, 0.) - 1; // Because of sampleCenter\r\n var varyingCount = Math.min(offsets.length, freeVaryingVec2);\r\n var defines = \"\";\r\n defines += this._staticDefines;\r\n // The DOF fragment should ignore the center pixel when looping as it is handled manualy in the fragment shader.\r\n if (this._staticDefines.indexOf(\"DOF\") != -1) {\r\n defines += \"#define CENTER_WEIGHT \" + this._glslFloat(weights[varyingCount - 1]) + \"\\r\\n\";\r\n varyingCount--;\r\n }\r\n for (var i = 0; i < varyingCount; i++) {\r\n defines += \"#define KERNEL_OFFSET\" + i + \" \" + this._glslFloat(offsets[i]) + \"\\r\\n\";\r\n defines += \"#define KERNEL_WEIGHT\" + i + \" \" + this._glslFloat(weights[i]) + \"\\r\\n\";\r\n }\r\n var depCount = 0;\r\n for (var i = freeVaryingVec2; i < offsets.length; i++) {\r\n defines += \"#define KERNEL_DEP_OFFSET\" + depCount + \" \" + this._glslFloat(offsets[i]) + \"\\r\\n\";\r\n defines += \"#define KERNEL_DEP_WEIGHT\" + depCount + \" \" + this._glslFloat(weights[i]) + \"\\r\\n\";\r\n depCount++;\r\n }\r\n if (this.packedFloat) {\r\n defines += \"#define PACKEDFLOAT 1\";\r\n }\r\n this.blockCompilation = false;\r\n _super.prototype.updateEffect.call(this, defines, null, null, {\r\n varyingCount: varyingCount,\r\n depCount: depCount\r\n }, onCompiled, onError);\r\n };\r\n /**\r\n * Best kernels are odd numbers that when divided by 2, their integer part is even, so 5, 9 or 13.\r\n * Other odd kernels optimize correctly but require proportionally more samples, even kernels are\r\n * possible but will produce minor visual artifacts. Since each new kernel requires a new shader we\r\n * want to minimize kernel changes, having gaps between physical kernels is helpful in that regard.\r\n * The gaps between physical kernels are compensated for in the weighting of the samples\r\n * @param idealKernel Ideal blur kernel.\r\n * @return Nearest best kernel.\r\n */\r\n BlurPostProcess.prototype._nearestBestKernel = function (idealKernel) {\r\n var v = Math.round(idealKernel);\r\n for (var _i = 0, _a = [v, v - 1, v + 1, v - 2, v + 2]; _i < _a.length; _i++) {\r\n var k = _a[_i];\r\n if (((k % 2) !== 0) && ((Math.floor(k / 2) % 2) === 0) && k > 0) {\r\n return Math.max(k, 3);\r\n }\r\n }\r\n return Math.max(v, 3);\r\n };\r\n /**\r\n * Calculates the value of a Gaussian distribution with sigma 3 at a given point.\r\n * @param x The point on the Gaussian distribution to sample.\r\n * @return the value of the Gaussian function at x.\r\n */\r\n BlurPostProcess.prototype._gaussianWeight = function (x) {\r\n //reference: Engines/ImageProcessingBlur.cpp #dcc760\r\n // We are evaluating the Gaussian (normal) distribution over a kernel parameter space of [-1,1],\r\n // so we truncate at three standard deviations by setting stddev (sigma) to 1/3.\r\n // The choice of 3-sigma truncation is common but arbitrary, and means that the signal is\r\n // truncated at around 1.3% of peak strength.\r\n //the distribution is scaled to account for the difference between the actual kernel size and the requested kernel size\r\n var sigma = (1 / 3);\r\n var denominator = Math.sqrt(2.0 * Math.PI) * sigma;\r\n var exponent = -((x * x) / (2.0 * sigma * sigma));\r\n var weight = (1.0 / denominator) * Math.exp(exponent);\r\n return weight;\r\n };\r\n /**\r\n * Generates a string that can be used as a floating point number in GLSL.\r\n * @param x Value to print.\r\n * @param decimalFigures Number of decimal places to print the number to (excluding trailing 0s).\r\n * @return GLSL float string.\r\n */\r\n BlurPostProcess.prototype._glslFloat = function (x, decimalFigures) {\r\n if (decimalFigures === void 0) { decimalFigures = 8; }\r\n return x.toFixed(decimalFigures).replace(/0+$/, '');\r\n };\r\n return BlurPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/chromaticAberrationPostProcess.ts\":\n/*!*********************************************************!*\\\n !*** ./PostProcesses/chromaticAberrationPostProcess.ts ***!\n \\*********************************************************/\n/*! exports provided: ChromaticAberrationPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return ChromaticAberrationPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_chromaticAberration_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/chromaticAberration.fragment */ \"./Shaders/chromaticAberration.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen\r\n */\r\nvar ChromaticAberrationPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ChromaticAberrationPostProcess, _super);\r\n /**\r\n * Creates a new instance ChromaticAberrationPostProcess\r\n * @param name The name of the effect.\r\n * @param screenWidth The width of the screen to apply the effect on.\r\n * @param screenHeight The height of the screen to apply the effect on.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function ChromaticAberrationPostProcess(name, screenWidth, screenHeight, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"chromaticAberration\", [\"chromatic_aberration\", \"screen_width\", \"screen_height\", \"direction\", \"radialIntensity\", \"centerPosition\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * The amount of seperation of rgb channels (default: 30)\r\n */\r\n _this.aberrationAmount = 30;\r\n /**\r\n * The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)\r\n */\r\n _this.radialIntensity = 0;\r\n /**\r\n * The normilized direction in which the rgb channels should be seperated. If set to 0,0 radial direction will be used. (default: Vector2(0.707,0.707))\r\n */\r\n _this.direction = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0.707, 0.707);\r\n /**\r\n * The center position where the radialIntensity should be around. [0.5,0.5 is center of screen, 1,1 is top right corder] (default: Vector2(0.5 ,0.5))\r\n */\r\n _this.centerPosition = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0.5, 0.5);\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat('chromatic_aberration', _this.aberrationAmount);\r\n effect.setFloat('screen_width', screenWidth);\r\n effect.setFloat('screen_height', screenHeight);\r\n effect.setFloat('radialIntensity', _this.radialIntensity);\r\n effect.setFloat2('direction', _this.direction.x, _this.direction.y);\r\n effect.setFloat2('centerPosition', _this.centerPosition.x, _this.centerPosition.y);\r\n });\r\n return _this;\r\n }\r\n return ChromaticAberrationPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/circleOfConfusionPostProcess.ts\":\n/*!*******************************************************!*\\\n !*** ./PostProcesses/circleOfConfusionPostProcess.ts ***!\n \\*******************************************************/\n/*! exports provided: CircleOfConfusionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return CircleOfConfusionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_circleOfConfusion_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/circleOfConfusion.fragment */ \"./Shaders/circleOfConfusion.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The CircleOfConfusionPostProcess computes the circle of confusion value for each pixel given required lens parameters. See https://en.wikipedia.org/wiki/Circle_of_confusion\r\n */\r\nvar CircleOfConfusionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](CircleOfConfusionPostProcess, _super);\r\n /**\r\n * Creates a new instance CircleOfConfusionPostProcess\r\n * @param name The name of the effect.\r\n * @param depthTexture The depth texture of the scene to compute the circle of confusion. This must be set in order for this to function but may be set after initialization if needed.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function CircleOfConfusionPostProcess(name, depthTexture, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"circleOfConfusion\", [\"cameraMinMaxZ\", \"focusDistance\", \"cocPrecalculation\"], [\"depthSampler\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diamater of the resulting aperture can be computed by lensSize/fStop.\r\n */\r\n _this.lensSize = 50;\r\n /**\r\n * F-Stop of the effect's camera. The diamater of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\r\n */\r\n _this.fStop = 1.4;\r\n /**\r\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\r\n */\r\n _this.focusDistance = 2000;\r\n /**\r\n * Focal length of the effect's camera in scene units/1000 (eg. millimeter). (default: 50)\r\n */\r\n _this.focalLength = 50;\r\n _this._depthTexture = null;\r\n _this._depthTexture = depthTexture;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (!_this._depthTexture) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"No depth texture set on CircleOfConfusionPostProcess\");\r\n return;\r\n }\r\n effect.setTexture(\"depthSampler\", _this._depthTexture);\r\n // Circle of confusion calculation, See https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch23.html\r\n var aperture = _this.lensSize / _this.fStop;\r\n var cocPrecalculation = ((aperture * _this.focalLength) / ((_this.focusDistance - _this.focalLength))); // * ((this.focusDistance - pixelDistance)/pixelDistance) [This part is done in shader]\r\n effect.setFloat('focusDistance', _this.focusDistance);\r\n effect.setFloat('cocPrecalculation', cocPrecalculation);\r\n effect.setFloat2('cameraMinMaxZ', _this._depthTexture.activeCamera.minZ, _this._depthTexture.activeCamera.maxZ);\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(CircleOfConfusionPostProcess.prototype, \"depthTexture\", {\r\n /**\r\n * Depth texture to be used to compute the circle of confusion. This must be set here or in the constructor in order for the post process to function.\r\n */\r\n set: function (value) {\r\n this._depthTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return CircleOfConfusionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/colorCorrectionPostProcess.ts\":\n/*!*****************************************************!*\\\n !*** ./PostProcesses/colorCorrectionPostProcess.ts ***!\n \\*****************************************************/\n/*! exports provided: ColorCorrectionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return ColorCorrectionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Shaders_colorCorrection_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/colorCorrection.fragment */ \"./Shaders/colorCorrection.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n *\r\n * This post-process allows the modification of rendered colors by using\r\n * a 'look-up table' (LUT). This effect is also called Color Grading.\r\n *\r\n * The object needs to be provided an url to a texture containing the color\r\n * look-up table: the texture must be 256 pixels wide and 16 pixels high.\r\n * Use an image editing software to tweak the LUT to match your needs.\r\n *\r\n * For an example of a color LUT, see here:\r\n * @see http://udn.epicgames.com/Three/rsrc/Three/ColorGrading/RGBTable16x1.png\r\n * For explanations on color grading, see here:\r\n * @see http://udn.epicgames.com/Three/ColorGrading.html\r\n *\r\n */\r\nvar ColorCorrectionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ColorCorrectionPostProcess, _super);\r\n function ColorCorrectionPostProcess(name, colorTableUrl, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, 'colorCorrection', null, ['colorTable'], options, camera, samplingMode, engine, reusable) || this;\r\n _this._colorTableTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"](colorTableUrl, camera.getScene(), true, false, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].TRILINEAR_SAMPLINGMODE);\r\n _this._colorTableTexture.anisotropicFilteringLevel = 1;\r\n _this._colorTableTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this._colorTableTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n _this.onApply = function (effect) {\r\n effect.setTexture(\"colorTable\", _this._colorTableTexture);\r\n };\r\n return _this;\r\n }\r\n return ColorCorrectionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/convolutionPostProcess.ts\":\n/*!*************************************************!*\\\n !*** ./PostProcesses/convolutionPostProcess.ts ***!\n \\*************************************************/\n/*! exports provided: ConvolutionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return ConvolutionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_convolution_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/convolution.fragment */ \"./Shaders/convolution.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The ConvolutionPostProcess applies a 3x3 kernel to every pixel of the\r\n * input texture to perform effects such as edge detection or sharpening\r\n * See http://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\nvar ConvolutionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ConvolutionPostProcess, _super);\r\n /**\r\n * Creates a new instance ConvolutionPostProcess\r\n * @param name The name of the effect.\r\n * @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n */\r\n function ConvolutionPostProcess(name, \r\n /** Array of 9 values corresponding to the 3x3 kernel to be applied */\r\n kernel, options, camera, samplingMode, engine, reusable, textureType) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"convolution\", [\"kernel\", \"screenSize\"], null, options, camera, samplingMode, engine, reusable, null, textureType) || this;\r\n _this.kernel = kernel;\r\n _this.onApply = function (effect) {\r\n effect.setFloat2(\"screenSize\", _this.width, _this.height);\r\n effect.setArray(\"kernel\", _this.kernel);\r\n };\r\n return _this;\r\n }\r\n // Statics\r\n /**\r\n * Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1];\r\n /**\r\n * Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0];\r\n /**\r\n * Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1];\r\n /**\r\n * Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0];\r\n /**\r\n * Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2];\r\n /**\r\n * Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n ConvolutionPostProcess.GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0];\r\n return ConvolutionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/depthOfFieldBlurPostProcess.ts\":\n/*!******************************************************!*\\\n !*** ./PostProcesses/depthOfFieldBlurPostProcess.ts ***!\n \\******************************************************/\n/*! exports provided: DepthOfFieldBlurPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return DepthOfFieldBlurPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _blurPostProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The DepthOfFieldBlurPostProcess applied a blur in a give direction.\r\n * This blur differs from the standard BlurPostProcess as it attempts to avoid blurring pixels\r\n * based on samples that have a large difference in distance than the center pixel.\r\n * See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\r\n */\r\nvar DepthOfFieldBlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DepthOfFieldBlurPostProcess, _super);\r\n /**\r\n * Creates a new instance CircleOfConfusionPostProcess\r\n * @param name The name of the effect.\r\n * @param scene The scene the effect belongs to.\r\n * @param direction The direction the blur should be applied.\r\n * @param kernel The size of the kernel used to blur.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param circleOfConfusion The circle of confusion + depth map to be used to avoid blurring accross edges\r\n * @param imageToBlur The image to apply the blur to (default: Current rendered frame)\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function DepthOfFieldBlurPostProcess(name, scene, direction, kernel, options, camera, circleOfConfusion, imageToBlur, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (imageToBlur === void 0) { imageToBlur = null; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, direction, kernel, options, camera, samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE, engine, reusable, textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, \"#define DOF 1\\r\\n\", blockCompilation) || this;\r\n _this.direction = direction;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (imageToBlur != null) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", imageToBlur);\r\n }\r\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\r\n if (scene.activeCamera) {\r\n effect.setFloat2('cameraMinMaxZ', scene.activeCamera.minZ, scene.activeCamera.maxZ);\r\n }\r\n });\r\n return _this;\r\n }\r\n return DepthOfFieldBlurPostProcess;\r\n}(_blurPostProcess__WEBPACK_IMPORTED_MODULE_2__[\"BlurPostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/depthOfFieldEffect.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/depthOfFieldEffect.ts ***!\n \\*********************************************/\n/*! exports provided: DepthOfFieldEffectBlurLevel, DepthOfFieldEffect */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return DepthOfFieldEffectBlurLevel; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return DepthOfFieldEffect; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../PostProcesses/RenderPipeline/postProcessRenderEffect */ \"./PostProcesses/RenderPipeline/postProcessRenderEffect.ts\");\n/* harmony import */ var _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./circleOfConfusionPostProcess */ \"./PostProcesses/circleOfConfusionPostProcess.ts\");\n/* harmony import */ var _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./depthOfFieldBlurPostProcess */ \"./PostProcesses/depthOfFieldBlurPostProcess.ts\");\n/* harmony import */ var _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./depthOfFieldMergePostProcess */ \"./PostProcesses/depthOfFieldMergePostProcess.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Specifies the level of max blur that should be applied when using the depth of field effect\r\n */\r\nvar DepthOfFieldEffectBlurLevel;\r\n(function (DepthOfFieldEffectBlurLevel) {\r\n /**\r\n * Subtle blur\r\n */\r\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"Low\"] = 0] = \"Low\";\r\n /**\r\n * Medium blur\r\n */\r\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"Medium\"] = 1] = \"Medium\";\r\n /**\r\n * Large blur\r\n */\r\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"High\"] = 2] = \"High\";\r\n})(DepthOfFieldEffectBlurLevel || (DepthOfFieldEffectBlurLevel = {}));\r\n/**\r\n * The depth of field effect applies a blur to objects that are closer or further from where the camera is focusing.\r\n */\r\nvar DepthOfFieldEffect = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DepthOfFieldEffect, _super);\r\n /**\r\n * Creates a new instance DepthOfFieldEffect\r\n * @param scene The scene the effect belongs to.\r\n * @param depthTexture The depth texture of the scene to compute the circle of confusion.This must be set in order for this to function but may be set after initialization if needed.\r\n * @param pipelineTextureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function DepthOfFieldEffect(scene, depthTexture, blurLevel, pipelineTextureType, blockCompilation) {\r\n if (blurLevel === void 0) { blurLevel = DepthOfFieldEffectBlurLevel.Low; }\r\n if (pipelineTextureType === void 0) { pipelineTextureType = 0; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, scene.getEngine(), \"depth of field\", function () {\r\n return _this._effects;\r\n }, true) || this;\r\n /**\r\n * @hidden Internal post processes in depth of field effect\r\n */\r\n _this._effects = [];\r\n // Circle of confusion value for each pixel is used to determine how much to blur that pixel\r\n _this._circleOfConfusion = new _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"CircleOfConfusionPostProcess\"](\"circleOfConfusion\", depthTexture, 1, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n // Create a pyramid of blurred images (eg. fullSize 1/4 blur, half size 1/2 blur, quarter size 3/4 blur, eith size 4/4 blur)\r\n // Blur the image but do not blur on sharp far to near distance changes to avoid bleeding artifacts\r\n // See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\r\n _this._depthOfFieldBlurY = [];\r\n _this._depthOfFieldBlurX = [];\r\n var blurCount = 1;\r\n var kernelSize = 15;\r\n switch (blurLevel) {\r\n case DepthOfFieldEffectBlurLevel.High: {\r\n blurCount = 3;\r\n kernelSize = 51;\r\n break;\r\n }\r\n case DepthOfFieldEffectBlurLevel.Medium: {\r\n blurCount = 2;\r\n kernelSize = 31;\r\n break;\r\n }\r\n default: {\r\n kernelSize = 15;\r\n blurCount = 1;\r\n break;\r\n }\r\n }\r\n var adjustedKernelSize = kernelSize / Math.pow(2, blurCount - 1);\r\n var ratio = 1.0;\r\n for (var i = 0; i < blurCount; i++) {\r\n var blurY = new _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_5__[\"DepthOfFieldBlurPostProcess\"](\"verticle blur\", scene, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](0, 1.0), adjustedKernelSize, ratio, null, _this._circleOfConfusion, i == 0 ? _this._circleOfConfusion : null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n blurY.autoClear = false;\r\n ratio = 0.75 / Math.pow(2, i);\r\n var blurX = new _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_5__[\"DepthOfFieldBlurPostProcess\"](\"horizontal blur\", scene, new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1.0, 0), adjustedKernelSize, ratio, null, _this._circleOfConfusion, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n blurX.autoClear = false;\r\n _this._depthOfFieldBlurY.push(blurY);\r\n _this._depthOfFieldBlurX.push(blurX);\r\n }\r\n // Set all post processes on the effect.\r\n _this._effects = [_this._circleOfConfusion];\r\n for (var i = 0; i < _this._depthOfFieldBlurX.length; i++) {\r\n _this._effects.push(_this._depthOfFieldBlurY[i]);\r\n _this._effects.push(_this._depthOfFieldBlurX[i]);\r\n }\r\n // Merge blurred images with original image based on circleOfConfusion\r\n _this._dofMerge = new _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_6__[\"DepthOfFieldMergePostProcess\"](\"dofMerge\", _this._circleOfConfusion, _this._circleOfConfusion, _this._depthOfFieldBlurX, ratio, null, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\r\n _this._dofMerge.autoClear = false;\r\n _this._effects.push(_this._dofMerge);\r\n return _this;\r\n }\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"focalLength\", {\r\n get: function () {\r\n return this._circleOfConfusion.focalLength;\r\n },\r\n /**\r\n * The focal the length of the camera used in the effect in scene units/1000 (eg. millimeter)\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.focalLength = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"fStop\", {\r\n get: function () {\r\n return this._circleOfConfusion.fStop;\r\n },\r\n /**\r\n * F-Stop of the effect's camera. The diameter of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.fStop = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"focusDistance\", {\r\n get: function () {\r\n return this._circleOfConfusion.focusDistance;\r\n },\r\n /**\r\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.focusDistance = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"lensSize\", {\r\n get: function () {\r\n return this._circleOfConfusion.lensSize;\r\n },\r\n /**\r\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diamater of the resulting aperture can be computed by lensSize/fStop.\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.lensSize = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the current effet\r\n * @returns \"DepthOfFieldEffect\"\r\n */\r\n DepthOfFieldEffect.prototype.getClassName = function () {\r\n return \"DepthOfFieldEffect\";\r\n };\r\n Object.defineProperty(DepthOfFieldEffect.prototype, \"depthTexture\", {\r\n /**\r\n * Depth texture to be used to compute the circle of confusion. This must be set here or in the constructor in order for the post process to function.\r\n */\r\n set: function (value) {\r\n this._circleOfConfusion.depthTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes each of the internal effects for a given camera.\r\n * @param camera The camera to dispose the effect on.\r\n */\r\n DepthOfFieldEffect.prototype.disposeEffects = function (camera) {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].dispose(camera);\r\n }\r\n };\r\n /**\r\n * @hidden Internal\r\n */\r\n DepthOfFieldEffect.prototype._updateEffects = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n this._effects[effectIndex].updateEffect();\r\n }\r\n };\r\n /**\r\n * Internal\r\n * @returns if all the contained post processes are ready.\r\n * @hidden\r\n */\r\n DepthOfFieldEffect.prototype._isReady = function () {\r\n for (var effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\r\n if (!this._effects[effectIndex].isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n return DepthOfFieldEffect;\r\n}(_PostProcesses_RenderPipeline_postProcessRenderEffect__WEBPACK_IMPORTED_MODULE_3__[\"PostProcessRenderEffect\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/depthOfFieldMergePostProcess.ts\":\n/*!*******************************************************!*\\\n !*** ./PostProcesses/depthOfFieldMergePostProcess.ts ***!\n \\*******************************************************/\n/*! exports provided: DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return DepthOfFieldMergePostProcessOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return DepthOfFieldMergePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_depthOfFieldMerge_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/depthOfFieldMerge.fragment */ \"./Shaders/depthOfFieldMerge.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Options to be set when merging outputs from the default pipeline.\r\n */\r\nvar DepthOfFieldMergePostProcessOptions = /** @class */ (function () {\r\n function DepthOfFieldMergePostProcessOptions() {\r\n }\r\n return DepthOfFieldMergePostProcessOptions;\r\n}());\r\n\r\n/**\r\n * The DepthOfFieldMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\r\n */\r\nvar DepthOfFieldMergePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DepthOfFieldMergePostProcess, _super);\r\n /**\r\n * Creates a new instance of DepthOfFieldMergePostProcess\r\n * @param name The name of the effect.\r\n * @param originalFromInput Post process which's input will be used for the merge.\r\n * @param circleOfConfusion Circle of confusion post process which's output will be used to blur each pixel.\r\n * @param blurSteps Blur post processes from low to high which will be mixed with the original image.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function DepthOfFieldMergePostProcess(name, originalFromInput, circleOfConfusion, blurSteps, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"depthOfFieldMerge\", [], [\"circleOfConfusionSampler\", \"blurStep0\", \"blurStep1\", \"blurStep2\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true) || this;\r\n _this.blurSteps = blurSteps;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\r\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\r\n blurSteps.forEach(function (step, index) {\r\n effect.setTextureFromPostProcessOutput(\"blurStep\" + (blurSteps.length - index - 1), step);\r\n });\r\n });\r\n if (!blockCompilation) {\r\n _this.updateEffect();\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n */\r\n DepthOfFieldMergePostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n if (!defines) {\r\n defines = \"\";\r\n defines += \"#define BLUR_LEVEL \" + (this.blurSteps.length - 1) + \"\\n\";\r\n }\r\n _super.prototype.updateEffect.call(this, defines, uniforms, samplers, indexParameters, onCompiled, onError);\r\n };\r\n return DepthOfFieldMergePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/displayPassPostProcess.ts\":\n/*!*************************************************!*\\\n !*** ./PostProcesses/displayPassPostProcess.ts ***!\n \\*************************************************/\n/*! exports provided: DisplayPassPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return DisplayPassPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_displayPass_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/displayPass.fragment */ \"./Shaders/displayPass.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * DisplayPassPostProcess which produces an output the same as it's input\r\n */\r\nvar DisplayPassPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](DisplayPassPostProcess, _super);\r\n /**\r\n * Creates the DisplayPassPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function DisplayPassPostProcess(name, options, camera, samplingMode, engine, reusable) {\r\n return _super.call(this, name, \"displayPass\", [\"passSampler\"], [\"passSampler\"], options, camera, samplingMode, engine, reusable) || this;\r\n }\r\n return DisplayPassPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/extractHighlightsPostProcess.ts\":\n/*!*******************************************************!*\\\n !*** ./PostProcesses/extractHighlightsPostProcess.ts ***!\n \\*******************************************************/\n/*! exports provided: ExtractHighlightsPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return ExtractHighlightsPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.constants */ \"./Maths/math.constants.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_extractHighlights_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/extractHighlights.fragment */ \"./Shaders/extractHighlights.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The extract highlights post process sets all pixels to black except pixels above the specified luminance threshold. Used as the first step for a bloom effect.\r\n */\r\nvar ExtractHighlightsPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ExtractHighlightsPostProcess, _super);\r\n function ExtractHighlightsPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"extractHighlights\", [\"threshold\", \"exposure\"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * The luminance threshold, pixels below this value will be set to black.\r\n */\r\n _this.threshold = 0.9;\r\n /** @hidden */\r\n _this._exposure = 1;\r\n /**\r\n * Post process which has the input texture to be used when performing highlight extraction\r\n * @hidden\r\n */\r\n _this._inputPostProcess = null;\r\n _this.onApplyObservable.add(function (effect) {\r\n if (_this._inputPostProcess) {\r\n effect.setTextureFromPostProcess(\"textureSampler\", _this._inputPostProcess);\r\n }\r\n effect.setFloat('threshold', Math.pow(_this.threshold, _Maths_math_constants__WEBPACK_IMPORTED_MODULE_2__[\"ToGammaSpace\"]));\r\n effect.setFloat('exposure', _this._exposure);\r\n });\r\n return _this;\r\n }\r\n return ExtractHighlightsPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/filterPostProcess.ts\":\n/*!********************************************!*\\\n !*** ./PostProcesses/filterPostProcess.ts ***!\n \\********************************************/\n/*! exports provided: FilterPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return FilterPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_filter_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Shaders/filter.fragment */ \"./Shaders/filter.fragment.ts\");\n\r\n\r\n\r\n/**\r\n * Applies a kernel filter to the image\r\n */\r\nvar FilterPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FilterPostProcess, _super);\r\n /**\r\n *\r\n * @param name The name of the effect.\r\n * @param kernelMatrix The matrix to be applied to the image\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function FilterPostProcess(name, \r\n /** The matrix to be applied to the image */\r\n kernelMatrix, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"filter\", [\"kernelMatrix\"], null, options, camera, samplingMode, engine, reusable) || this;\r\n _this.kernelMatrix = kernelMatrix;\r\n _this.onApply = function (effect) {\r\n effect.setMatrix(\"kernelMatrix\", _this.kernelMatrix);\r\n };\r\n return _this;\r\n }\r\n return FilterPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/fxaaPostProcess.ts\":\n/*!******************************************!*\\\n !*** ./PostProcesses/fxaaPostProcess.ts ***!\n \\******************************************/\n/*! exports provided: FxaaPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return FxaaPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_fxaa_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/fxaa.fragment */ \"./Shaders/fxaa.fragment.ts\");\n/* harmony import */ var _Shaders_fxaa_vertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Shaders/fxaa.vertex */ \"./Shaders/fxaa.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Fxaa post process\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#fxaa\r\n */\r\nvar FxaaPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](FxaaPostProcess, _super);\r\n function FxaaPostProcess(name, options, camera, samplingMode, engine, reusable, textureType) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"fxaa\", [\"texelSize\"], null, options, camera, samplingMode || _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE, engine, reusable, null, textureType, \"fxaa\", undefined, true) || this;\r\n var defines = _this._getDefines();\r\n _this.updateEffect(defines);\r\n _this.onApplyObservable.add(function (effect) {\r\n var texelSize = _this.texelSize;\r\n effect.setFloat2(\"texelSize\", texelSize.x, texelSize.y);\r\n });\r\n return _this;\r\n }\r\n FxaaPostProcess.prototype._getDefines = function () {\r\n var engine = this.getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n var glInfo = engine.getGlInfo();\r\n if (glInfo && glInfo.renderer && glInfo.renderer.toLowerCase().indexOf(\"mali\") > -1) {\r\n return \"#define MALI 1\\n\";\r\n }\r\n return null;\r\n };\r\n return FxaaPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/grainPostProcess.ts\":\n/*!*******************************************!*\\\n !*** ./PostProcesses/grainPostProcess.ts ***!\n \\*******************************************/\n/*! exports provided: GrainPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return GrainPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_grain_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/grain.fragment */ \"./Shaders/grain.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The GrainPostProcess adds noise to the image at mid luminance levels\r\n */\r\nvar GrainPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](GrainPostProcess, _super);\r\n /**\r\n * Creates a new instance of @see GrainPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function GrainPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"grain\", [\"intensity\", \"animatedSeed\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * The intensity of the grain added (default: 30)\r\n */\r\n _this.intensity = 30;\r\n /**\r\n * If the grain should be randomized on every frame\r\n */\r\n _this.animated = false;\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat('intensity', _this.intensity);\r\n effect.setFloat('animatedSeed', _this.animated ? Math.random() + 1 : 1);\r\n });\r\n return _this;\r\n }\r\n return GrainPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/highlightsPostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/highlightsPostProcess.ts ***!\n \\************************************************/\n/*! exports provided: HighlightsPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return HighlightsPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_highlights_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/highlights.fragment */ \"./Shaders/highlights.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Extracts highlights from the image\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar HighlightsPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](HighlightsPostProcess, _super);\r\n /**\r\n * Extracts highlights from the image\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of texture for the post process (default: Engine.TEXTURETYPE_UNSIGNED_INT)\r\n */\r\n function HighlightsPostProcess(name, options, camera, samplingMode, engine, reusable, textureType) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n return _super.call(this, name, \"highlights\", null, null, options, camera, samplingMode, engine, reusable, null, textureType) || this;\r\n }\r\n return HighlightsPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/imageProcessingPostProcess.ts\":\n/*!*****************************************************!*\\\n !*** ./PostProcesses/imageProcessingPostProcess.ts ***!\n \\*****************************************************/\n/*! exports provided: ImageProcessingPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return ImageProcessingPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_imageProcessing_fragment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Shaders/imageProcessing.fragment */ \"./Shaders/imageProcessing.fragment.ts\");\n/* harmony import */ var _Shaders_postprocess_vertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/postprocess.vertex */ \"./Shaders/postprocess.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * ImageProcessingPostProcess\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#imageprocessing\r\n */\r\nvar ImageProcessingPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](ImageProcessingPostProcess, _super);\r\n function ImageProcessingPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, imageProcessingConfiguration) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"imageProcessing\", [], [], options, camera, samplingMode, engine, reusable, null, textureType, \"postprocess\", null, true) || this;\r\n _this._fromLinearSpace = true;\r\n /**\r\n * Defines cache preventing GC.\r\n */\r\n _this._defines = {\r\n IMAGEPROCESSING: false,\r\n VIGNETTE: false,\r\n VIGNETTEBLENDMODEMULTIPLY: false,\r\n VIGNETTEBLENDMODEOPAQUE: false,\r\n TONEMAPPING: false,\r\n TONEMAPPING_ACES: false,\r\n CONTRAST: false,\r\n COLORCURVES: false,\r\n COLORGRADING: false,\r\n COLORGRADING3D: false,\r\n FROMLINEARSPACE: false,\r\n SAMPLER3DGREENDEPTH: false,\r\n SAMPLER3DBGRMAP: false,\r\n IMAGEPROCESSINGPOSTPROCESS: false,\r\n EXPOSURE: false,\r\n };\r\n // Setup the configuration as forced by the constructor. This would then not force the\r\n // scene materials output in linear space and let untouched the default forward pass.\r\n if (imageProcessingConfiguration) {\r\n imageProcessingConfiguration.applyByPostProcess = true;\r\n _this._attachImageProcessingConfiguration(imageProcessingConfiguration, true);\r\n // This will cause the shader to be compiled\r\n _this.fromLinearSpace = false;\r\n }\r\n // Setup the default processing configuration to the scene.\r\n else {\r\n _this._attachImageProcessingConfiguration(null, true);\r\n _this.imageProcessingConfiguration.applyByPostProcess = true;\r\n }\r\n _this.onApply = function (effect) {\r\n _this.imageProcessingConfiguration.bind(effect, _this.aspectRatio);\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n // We are almost sure it is applied by post process as\r\n // We are in the post process :-)\r\n value.applyByPostProcess = true;\r\n this._attachImageProcessingConfiguration(value);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration\r\n */\r\n ImageProcessingPostProcess.prototype._attachImageProcessingConfiguration = function (configuration, doNotBuild) {\r\n var _this = this;\r\n if (doNotBuild === void 0) { doNotBuild = false; }\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n var scene = null;\r\n var engine = this.getEngine();\r\n var camera = this.getCamera();\r\n if (camera) {\r\n scene = camera.getScene();\r\n }\r\n else if (engine && engine.scenes) {\r\n var scenes = engine.scenes;\r\n scene = scenes[scenes.length - 1];\r\n }\r\n else {\r\n scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene;\r\n }\r\n this._imageProcessingConfiguration = scene.imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._updateParameters();\r\n });\r\n }\r\n // Ensure the effect will be rebuilt.\r\n if (!doNotBuild) {\r\n this._updateParameters();\r\n }\r\n };\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorCurves\", {\r\n /**\r\n * Gets Color curves setup used in the effect if colorCurvesEnabled is set to true .\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * Sets Color curves setup used in the effect if colorCurvesEnabled is set to true .\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorGradingTexture\", {\r\n /**\r\n * Gets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"colorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"exposure\", {\r\n /**\r\n * Gets exposure used in the effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * Sets exposure used in the effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"toneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"toneMappingType\", {\r\n /**\r\n * Gets the type of tone mapping effect.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingType;\r\n },\r\n /**\r\n * Sets the type of tone mapping effect.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingType = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"contrast\", {\r\n /**\r\n * Gets contrast used in the effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets contrast used in the effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteStretch\", {\r\n /**\r\n * Gets Vignette stretch size.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteStretch;\r\n },\r\n /**\r\n * Sets Vignette stretch size.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteStretch = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteCentreX\", {\r\n /**\r\n * Gets Vignette centre X Offset.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteCentreX;\r\n },\r\n /**\r\n * Sets Vignette centre X Offset.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteCentreX = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteCentreY\", {\r\n /**\r\n * Gets Vignette centre Y Offset.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteCentreY;\r\n },\r\n /**\r\n * Sets Vignette centre Y Offset.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteCentreY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteWeight\", {\r\n /**\r\n * Gets Vignette weight or intensity of the vignette effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteWeight;\r\n },\r\n /**\r\n * Sets Vignette weight or intensity of the vignette effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteWeight = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteColor\", {\r\n /**\r\n * Gets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteColor;\r\n },\r\n /**\r\n * Sets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteColor = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteCameraFov\", {\r\n /**\r\n * Gets Camera field of view used by the Vignette effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteCameraFov;\r\n },\r\n /**\r\n * Sets Camera field of view used by the Vignette effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteCameraFov = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteBlendMode\", {\r\n /**\r\n * Gets the vignette blend mode allowing different kind of effect.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteBlendMode;\r\n },\r\n /**\r\n * Sets the vignette blend mode allowing different kind of effect.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteBlendMode = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"vignetteEnabled\", {\r\n /**\r\n * Gets wether the vignette effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.vignetteEnabled;\r\n },\r\n /**\r\n * Sets wether the vignette effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.vignetteEnabled = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingPostProcess.prototype, \"fromLinearSpace\", {\r\n /**\r\n * Gets wether the input of the processing is in Gamma or Linear Space.\r\n */\r\n get: function () {\r\n return this._fromLinearSpace;\r\n },\r\n /**\r\n * Sets wether the input of the processing is in Gamma or Linear Space.\r\n */\r\n set: function (value) {\r\n if (this._fromLinearSpace === value) {\r\n return;\r\n }\r\n this._fromLinearSpace = value;\r\n this._updateParameters();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * \"ImageProcessingPostProcess\"\r\n * @returns \"ImageProcessingPostProcess\"\r\n */\r\n ImageProcessingPostProcess.prototype.getClassName = function () {\r\n return \"ImageProcessingPostProcess\";\r\n };\r\n ImageProcessingPostProcess.prototype._updateParameters = function () {\r\n this._defines.FROMLINEARSPACE = this._fromLinearSpace;\r\n this.imageProcessingConfiguration.prepareDefines(this._defines, true);\r\n var defines = \"\";\r\n for (var define in this._defines) {\r\n if (this._defines[define]) {\r\n defines += \"#define \" + define + \";\\r\\n\";\r\n }\r\n }\r\n var samplers = [\"textureSampler\"];\r\n var uniforms = [\"scale\"];\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingConfiguration\"]) {\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingConfiguration\"].PrepareSamplers(samplers, this._defines);\r\n _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_2__[\"ImageProcessingConfiguration\"].PrepareUniforms(uniforms, this._defines);\r\n }\r\n this.updateEffect(defines, uniforms, samplers);\r\n };\r\n ImageProcessingPostProcess.prototype.dispose = function (camera) {\r\n _super.prototype.dispose.call(this, camera);\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n if (this._imageProcessingConfiguration) {\r\n this.imageProcessingConfiguration.applyByPostProcess = false;\r\n }\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], ImageProcessingPostProcess.prototype, \"_fromLinearSpace\", void 0);\r\n return ImageProcessingPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/index.ts\":\n/*!********************************!*\\\n !*** ./PostProcesses/index.ts ***!\n \\********************************/\n/*! exports provided: AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./anaglyphPostProcess */ \"./PostProcesses/anaglyphPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return _anaglyphPostProcess__WEBPACK_IMPORTED_MODULE_0__[\"AnaglyphPostProcess\"]; });\n\n/* harmony import */ var _blackAndWhitePostProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./blackAndWhitePostProcess */ \"./PostProcesses/blackAndWhitePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return _blackAndWhitePostProcess__WEBPACK_IMPORTED_MODULE_1__[\"BlackAndWhitePostProcess\"]; });\n\n/* harmony import */ var _bloomEffect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bloomEffect */ \"./PostProcesses/bloomEffect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return _bloomEffect__WEBPACK_IMPORTED_MODULE_2__[\"BloomEffect\"]; });\n\n/* harmony import */ var _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bloomMergePostProcess */ \"./PostProcesses/bloomMergePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return _bloomMergePostProcess__WEBPACK_IMPORTED_MODULE_3__[\"BloomMergePostProcess\"]; });\n\n/* harmony import */ var _blurPostProcess__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./blurPostProcess */ \"./PostProcesses/blurPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return _blurPostProcess__WEBPACK_IMPORTED_MODULE_4__[\"BlurPostProcess\"]; });\n\n/* harmony import */ var _chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./chromaticAberrationPostProcess */ \"./PostProcesses/chromaticAberrationPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return _chromaticAberrationPostProcess__WEBPACK_IMPORTED_MODULE_5__[\"ChromaticAberrationPostProcess\"]; });\n\n/* harmony import */ var _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./circleOfConfusionPostProcess */ \"./PostProcesses/circleOfConfusionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return _circleOfConfusionPostProcess__WEBPACK_IMPORTED_MODULE_6__[\"CircleOfConfusionPostProcess\"]; });\n\n/* harmony import */ var _colorCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./colorCorrectionPostProcess */ \"./PostProcesses/colorCorrectionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return _colorCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_7__[\"ColorCorrectionPostProcess\"]; });\n\n/* harmony import */ var _convolutionPostProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./convolutionPostProcess */ \"./PostProcesses/convolutionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return _convolutionPostProcess__WEBPACK_IMPORTED_MODULE_8__[\"ConvolutionPostProcess\"]; });\n\n/* harmony import */ var _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./depthOfFieldBlurPostProcess */ \"./PostProcesses/depthOfFieldBlurPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return _depthOfFieldBlurPostProcess__WEBPACK_IMPORTED_MODULE_9__[\"DepthOfFieldBlurPostProcess\"]; });\n\n/* harmony import */ var _depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./depthOfFieldEffect */ \"./PostProcesses/depthOfFieldEffect.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return _depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_10__[\"DepthOfFieldEffectBlurLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return _depthOfFieldEffect__WEBPACK_IMPORTED_MODULE_10__[\"DepthOfFieldEffect\"]; });\n\n/* harmony import */ var _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./depthOfFieldMergePostProcess */ \"./PostProcesses/depthOfFieldMergePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_11__[\"DepthOfFieldMergePostProcessOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return _depthOfFieldMergePostProcess__WEBPACK_IMPORTED_MODULE_11__[\"DepthOfFieldMergePostProcess\"]; });\n\n/* harmony import */ var _displayPassPostProcess__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./displayPassPostProcess */ \"./PostProcesses/displayPassPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return _displayPassPostProcess__WEBPACK_IMPORTED_MODULE_12__[\"DisplayPassPostProcess\"]; });\n\n/* harmony import */ var _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./extractHighlightsPostProcess */ \"./PostProcesses/extractHighlightsPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return _extractHighlightsPostProcess__WEBPACK_IMPORTED_MODULE_13__[\"ExtractHighlightsPostProcess\"]; });\n\n/* harmony import */ var _filterPostProcess__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./filterPostProcess */ \"./PostProcesses/filterPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return _filterPostProcess__WEBPACK_IMPORTED_MODULE_14__[\"FilterPostProcess\"]; });\n\n/* harmony import */ var _fxaaPostProcess__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./fxaaPostProcess */ \"./PostProcesses/fxaaPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return _fxaaPostProcess__WEBPACK_IMPORTED_MODULE_15__[\"FxaaPostProcess\"]; });\n\n/* harmony import */ var _grainPostProcess__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./grainPostProcess */ \"./PostProcesses/grainPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return _grainPostProcess__WEBPACK_IMPORTED_MODULE_16__[\"GrainPostProcess\"]; });\n\n/* harmony import */ var _highlightsPostProcess__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./highlightsPostProcess */ \"./PostProcesses/highlightsPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return _highlightsPostProcess__WEBPACK_IMPORTED_MODULE_17__[\"HighlightsPostProcess\"]; });\n\n/* harmony import */ var _imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./imageProcessingPostProcess */ \"./PostProcesses/imageProcessingPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return _imageProcessingPostProcess__WEBPACK_IMPORTED_MODULE_18__[\"ImageProcessingPostProcess\"]; });\n\n/* harmony import */ var _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./motionBlurPostProcess */ \"./PostProcesses/motionBlurPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return _motionBlurPostProcess__WEBPACK_IMPORTED_MODULE_19__[\"MotionBlurPostProcess\"]; });\n\n/* harmony import */ var _passPostProcess__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./passPostProcess */ \"./PostProcesses/passPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return _passPostProcess__WEBPACK_IMPORTED_MODULE_20__[\"PassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return _passPostProcess__WEBPACK_IMPORTED_MODULE_20__[\"PassCubePostProcess\"]; });\n\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return _postProcess__WEBPACK_IMPORTED_MODULE_21__[\"PostProcess\"]; });\n\n/* harmony import */ var _postProcessManager__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./postProcessManager */ \"./PostProcesses/postProcessManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return _postProcessManager__WEBPACK_IMPORTED_MODULE_22__[\"PostProcessManager\"]; });\n\n/* harmony import */ var _refractionPostProcess__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./refractionPostProcess */ \"./PostProcesses/refractionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return _refractionPostProcess__WEBPACK_IMPORTED_MODULE_23__[\"RefractionPostProcess\"]; });\n\n/* harmony import */ var _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./RenderPipeline/index */ \"./PostProcesses/RenderPipeline/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _RenderPipeline_index__WEBPACK_IMPORTED_MODULE_24__[\"StandardRenderingPipeline\"]; });\n\n/* harmony import */ var _sharpenPostProcess__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./sharpenPostProcess */ \"./PostProcesses/sharpenPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return _sharpenPostProcess__WEBPACK_IMPORTED_MODULE_25__[\"SharpenPostProcess\"]; });\n\n/* harmony import */ var _stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./stereoscopicInterlacePostProcess */ \"./PostProcesses/stereoscopicInterlacePostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return _stereoscopicInterlacePostProcess__WEBPACK_IMPORTED_MODULE_26__[\"StereoscopicInterlacePostProcess\"]; });\n\n/* harmony import */ var _tonemapPostProcess__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./tonemapPostProcess */ \"./PostProcesses/tonemapPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return _tonemapPostProcess__WEBPACK_IMPORTED_MODULE_27__[\"TonemappingOperator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return _tonemapPostProcess__WEBPACK_IMPORTED_MODULE_27__[\"TonemapPostProcess\"]; });\n\n/* harmony import */ var _volumetricLightScatteringPostProcess__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./volumetricLightScatteringPostProcess */ \"./PostProcesses/volumetricLightScatteringPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return _volumetricLightScatteringPostProcess__WEBPACK_IMPORTED_MODULE_28__[\"VolumetricLightScatteringPostProcess\"]; });\n\n/* harmony import */ var _vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./vrDistortionCorrectionPostProcess */ \"./PostProcesses/vrDistortionCorrectionPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return _vrDistortionCorrectionPostProcess__WEBPACK_IMPORTED_MODULE_29__[\"VRDistortionCorrectionPostProcess\"]; });\n\n/* harmony import */ var _vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./vrMultiviewToSingleviewPostProcess */ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return _vrMultiviewToSingleviewPostProcess__WEBPACK_IMPORTED_MODULE_30__[\"VRMultiviewToSingleviewPostProcess\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/motionBlurPostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/motionBlurPostProcess.ts ***!\n \\************************************************/\n/*! exports provided: MotionBlurPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return MotionBlurPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Rendering_geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Rendering/geometryBufferRenderer */ \"./Rendering/geometryBufferRenderer.ts\");\n/* harmony import */ var _Animations_animatable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Animations/animatable */ \"./Animations/animatable.ts\");\n/* harmony import */ var _Rendering_geometryBufferRendererSceneComponent__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Rendering/geometryBufferRendererSceneComponent */ \"./Rendering/geometryBufferRendererSceneComponent.ts\");\n/* harmony import */ var _Shaders_motionBlur_fragment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/motionBlur.fragment */ \"./Shaders/motionBlur.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * The Motion Blur Post Process which blurs an image based on the objects velocity in scene.\r\n * Velocity can be affected by each object's rotation, position and scale depending on the transformation speed.\r\n * As an example, all you have to do is to create the post-process:\r\n * var mb = new BABYLON.MotionBlurPostProcess(\r\n * 'mb', // The name of the effect.\r\n * scene, // The scene containing the objects to blur according to their velocity.\r\n * 1.0, // The required width/height ratio to downsize to before computing the render pass.\r\n * camera // The camera to apply the render pass to.\r\n * );\r\n * Then, all objects moving, rotating and/or scaling will be blurred depending on the transformation speed.\r\n */\r\nvar MotionBlurPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](MotionBlurPostProcess, _super);\r\n /**\r\n * Creates a new instance MotionBlurPostProcess\r\n * @param name The name of the effect.\r\n * @param scene The scene containing the objects to blur according to their velocity.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function MotionBlurPostProcess(name, scene, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_4__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"motionBlur\", [\"motionStrength\", \"motionScale\", \"screenSize\"], [\"velocitySampler\"], options, camera, samplingMode, engine, reusable, \"#define GEOMETRY_SUPPORTED\\n#define SAMPLES 64.0\", textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * Defines how much the image is blurred by the movement. Default value is equal to 1\r\n */\r\n _this.motionStrength = 1;\r\n _this._motionBlurSamples = 32;\r\n _this._geometryBufferRenderer = scene.enableGeometryBufferRenderer();\r\n if (!_this._geometryBufferRenderer) {\r\n // Geometry buffer renderer is not supported. So, work as a passthrough.\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_1__[\"Logger\"].Warn(\"Multiple Render Target support needed to compute object based motion blur\");\r\n _this.updateEffect();\r\n }\r\n else {\r\n // Geometry buffer renderer is supported.\r\n _this._geometryBufferRenderer.enableVelocity = true;\r\n _this.onApply = function (effect) {\r\n effect.setVector2(\"screenSize\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](_this.width, _this.height));\r\n effect.setFloat(\"motionScale\", scene.getAnimationRatio());\r\n effect.setFloat(\"motionStrength\", _this.motionStrength);\r\n if (_this._geometryBufferRenderer) {\r\n var velocityIndex = _this._geometryBufferRenderer.getTextureIndex(_Rendering_geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_5__[\"GeometryBufferRenderer\"].VELOCITY_TEXTURE_TYPE);\r\n effect.setTexture(\"velocitySampler\", _this._geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\r\n }\r\n };\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(MotionBlurPostProcess.prototype, \"motionBlurSamples\", {\r\n /**\r\n * Gets the number of iterations are used for motion blur quality. Default value is equal to 32\r\n */\r\n get: function () {\r\n return this._motionBlurSamples;\r\n },\r\n /**\r\n * Sets the number of iterations to be used for motion blur quality\r\n */\r\n set: function (samples) {\r\n this._motionBlurSamples = samples;\r\n if (this._geometryBufferRenderer) {\r\n this.updateEffect(\"#define GEOMETRY_SUPPORTED\\n#define SAMPLES \" + samples.toFixed(1));\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Excludes the given skinned mesh from computing bones velocities.\r\n * Computing bones velocities can have a cost and that cost. The cost can be saved by calling this function and by passing the skinned mesh reference to ignore.\r\n * @param skinnedMesh The mesh containing the skeleton to ignore when computing the velocity map.\r\n */\r\n MotionBlurPostProcess.prototype.excludeSkinnedMesh = function (skinnedMesh) {\r\n if (this._geometryBufferRenderer && skinnedMesh.skeleton) {\r\n this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.push(skinnedMesh);\r\n }\r\n };\r\n /**\r\n * Removes the given skinned mesh from the excluded meshes to integrate bones velocities while rendering the velocity map.\r\n * @param skinnedMesh The mesh containing the skeleton that has been ignored previously.\r\n * @see excludeSkinnedMesh to exclude a skinned mesh from bones velocity computation.\r\n */\r\n MotionBlurPostProcess.prototype.removeExcludedSkinnedMesh = function (skinnedMesh) {\r\n if (this._geometryBufferRenderer && skinnedMesh.skeleton) {\r\n var index = this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.indexOf(skinnedMesh);\r\n if (index !== -1) {\r\n this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity.splice(index, 1);\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n MotionBlurPostProcess.prototype.dispose = function (camera) {\r\n if (this._geometryBufferRenderer) {\r\n // Clear previous transformation matrices dictionary used to compute objects velocities\r\n this._geometryBufferRenderer._previousTransformationMatrices = {};\r\n this._geometryBufferRenderer._previousBonesTransformationMatrices = {};\r\n this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity = [];\r\n }\r\n _super.prototype.dispose.call(this, camera);\r\n };\r\n return MotionBlurPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/passPostProcess.ts\":\n/*!******************************************!*\\\n !*** ./PostProcesses/passPostProcess.ts ***!\n \\******************************************/\n/*! exports provided: PassPostProcess, PassCubePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return PassPostProcess; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return PassCubePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n/* harmony import */ var _Shaders_pass_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/pass.fragment */ \"./Shaders/pass.fragment.ts\");\n/* harmony import */ var _Shaders_passCube_fragment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Shaders/passCube.fragment */ \"./Shaders/passCube.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * PassPostProcess which produces an output the same as it's input\r\n */\r\nvar PassPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PassPostProcess, _super);\r\n /**\r\n * Creates the PassPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function PassPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n return _super.call(this, name, \"pass\", null, null, options, camera, samplingMode, engine, reusable, undefined, textureType, undefined, null, blockCompilation) || this;\r\n }\r\n return PassPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n/**\r\n * PassCubePostProcess which produces an output the same as it's input (which must be a cube texture)\r\n */\r\nvar PassCubePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](PassCubePostProcess, _super);\r\n /**\r\n * Creates the PassCubePostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType The type of texture to be used when performing the post processing.\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function PassCubePostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (camera === void 0) { camera = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_1__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"passCube\", null, null, options, camera, samplingMode, engine, reusable, \"#define POSITIVEX\", textureType, undefined, null, blockCompilation) || this;\r\n _this._face = 0;\r\n return _this;\r\n }\r\n Object.defineProperty(PassCubePostProcess.prototype, \"face\", {\r\n /**\r\n * Gets or sets the cube face to display.\r\n * * 0 is +X\r\n * * 1 is -X\r\n * * 2 is +Y\r\n * * 3 is -Y\r\n * * 4 is +Z\r\n * * 5 is -Z\r\n */\r\n get: function () {\r\n return this._face;\r\n },\r\n set: function (value) {\r\n if (value < 0 || value > 5) {\r\n return;\r\n }\r\n this._face = value;\r\n switch (this._face) {\r\n case 0:\r\n this.updateEffect(\"#define POSITIVEX\");\r\n break;\r\n case 1:\r\n this.updateEffect(\"#define NEGATIVEX\");\r\n break;\r\n case 2:\r\n this.updateEffect(\"#define POSITIVEY\");\r\n break;\r\n case 3:\r\n this.updateEffect(\"#define NEGATIVEY\");\r\n break;\r\n case 4:\r\n this.updateEffect(\"#define POSITIVEZ\");\r\n break;\r\n case 5:\r\n this.updateEffect(\"#define NEGATIVEZ\");\r\n break;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return PassCubePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n_Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"]._RescalePostProcessFactory = function (engine) {\r\n return new PassPostProcess(\"rescale\", 1, null, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURE_BILINEAR_SAMPLINGMODE, engine, false, _Engines_engine__WEBPACK_IMPORTED_MODULE_3__[\"Engine\"].TEXTURETYPE_UNSIGNED_INT);\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/postProcess.ts\":\n/*!**************************************!*\\\n !*** ./PostProcesses/postProcess.ts ***!\n \\**************************************/\n/*! exports provided: PostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return PostProcess; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_postprocess_vertex__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/postprocess.vertex */ \"./Shaders/postprocess.vertex.ts\");\n/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/engine */ \"./Engines/engine.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * PostProcess can be used to apply a shader to a texture after it has been rendered\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcess = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param name The name of the PostProcess.\r\n * @param fragmentUrl The url of the fragment shader to be used.\r\n * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.\r\n * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param defines String of defines that will be set when running the fragment shader. (default: null)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param vertexUrl The url of the vertex shader to be used. (default: \"postprocess\")\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param blockCompilation If the shader should not be compiled imediatly. (default: false)\r\n */\r\n function PostProcess(\r\n /** Name of the PostProcess. */\r\n name, fragmentUrl, parameters, samplers, options, camera, samplingMode, engine, reusable, defines, textureType, vertexUrl, indexParameters, blockCompilation) {\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE; }\r\n if (defines === void 0) { defines = null; }\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (vertexUrl === void 0) { vertexUrl = \"postprocess\"; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n this.name = name;\r\n /**\r\n * Width of the texture to apply the post process on\r\n */\r\n this.width = -1;\r\n /**\r\n * Height of the texture to apply the post process on\r\n */\r\n this.height = -1;\r\n /**\r\n * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)\r\n * @hidden\r\n */\r\n this._outputTexture = null;\r\n /**\r\n * If the buffer needs to be cleared before applying the post process. (default: true)\r\n * Should be set to false if shader will overwrite all previous pixels.\r\n */\r\n this.autoClear = true;\r\n /**\r\n * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)\r\n */\r\n this.alphaMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALPHA_DISABLE;\r\n /**\r\n * Animations to be used for the post processing\r\n */\r\n this.animations = new Array();\r\n /**\r\n * Enable Pixel Perfect mode where texture is not scaled to be power of 2.\r\n * Can only be used on a single postprocess or on the last one of a chain. (default: false)\r\n */\r\n this.enablePixelPerfectMode = false;\r\n /**\r\n * Force the postprocess to be applied without taking in account viewport\r\n */\r\n this.forceFullscreenViewport = true;\r\n /**\r\n * Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 1 | SCALEMODE_FLOOR | [engine.scalemode_floor](http://doc.babylonjs.com/api/classes/babylon.engine#scalemode_floor) |\r\n * | 2 | SCALEMODE_NEAREST | [engine.scalemode_nearest](http://doc.babylonjs.com/api/classes/babylon.engine#scalemode_nearest) |\r\n * | 3 | SCALEMODE_CEILING | [engine.scalemode_ceiling](http://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |\r\n *\r\n */\r\n this.scaleMode = _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].SCALEMODE_FLOOR;\r\n /**\r\n * Force textures to be a power of two (default: false)\r\n */\r\n this.alwaysForcePOT = false;\r\n this._samples = 1;\r\n /**\r\n * Modify the scale of the post process to be the same as the viewport (default: false)\r\n */\r\n this.adaptScaleToCurrentViewport = false;\r\n this._reusable = false;\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @hidden\r\n */\r\n this._textures = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](2);\r\n /**\r\n * The index in _textures that corresponds to the output texture.\r\n * @hidden\r\n */\r\n this._currentRenderTextureInd = 0;\r\n this._scaleRatio = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"](1, 1);\r\n this._texelSize = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__[\"Vector2\"].Zero();\r\n // Events\r\n /**\r\n * An event triggered when the postprocess is activated.\r\n */\r\n this.onActivateObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the postprocess changes its size.\r\n */\r\n this.onSizeChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered when the postprocess applies its effect.\r\n */\r\n this.onApplyObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering the postprocess\r\n */\r\n this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the postprocess\r\n */\r\n this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n if (camera != null) {\r\n this._camera = camera;\r\n this._scene = camera.getScene();\r\n camera.attachPostProcess(this);\r\n this._engine = this._scene.getEngine();\r\n this._scene.postProcesses.push(this);\r\n this.uniqueId = this._scene.getUniqueId();\r\n }\r\n else if (engine) {\r\n this._engine = engine;\r\n this._engine.postProcesses.push(this);\r\n }\r\n this._options = options;\r\n this.renderTargetSamplingMode = samplingMode ? samplingMode : _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_NEAREST_SAMPLINGMODE;\r\n this._reusable = reusable || false;\r\n this._textureType = textureType;\r\n this._samplers = samplers || [];\r\n this._samplers.push(\"textureSampler\");\r\n this._fragmentUrl = fragmentUrl;\r\n this._vertexUrl = vertexUrl;\r\n this._parameters = parameters || [];\r\n this._parameters.push(\"scale\");\r\n this._indexParameters = indexParameters;\r\n if (!blockCompilation) {\r\n this.updateEffect(defines);\r\n }\r\n }\r\n Object.defineProperty(PostProcess.prototype, \"samples\", {\r\n /**\r\n * Number of sample textures (default: 1)\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (n) {\r\n var _this = this;\r\n this._samples = Math.min(n, this._engine.getCaps().maxMSAASamples);\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this._samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this._samples);\r\n }\r\n });\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the fragment url or shader name used in the post process.\r\n * @returns the fragment url or name in the shader store.\r\n */\r\n PostProcess.prototype.getEffectName = function () {\r\n return this._fragmentUrl;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"onActivate\", {\r\n /**\r\n * A function that is added to the onActivateObservable\r\n */\r\n set: function (callback) {\r\n if (this._onActivateObserver) {\r\n this.onActivateObservable.remove(this._onActivateObserver);\r\n }\r\n if (callback) {\r\n this._onActivateObserver = this.onActivateObservable.add(callback);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onSizeChanged\", {\r\n /**\r\n * A function that is added to the onSizeChangedObservable\r\n */\r\n set: function (callback) {\r\n if (this._onSizeChangedObserver) {\r\n this.onSizeChangedObservable.remove(this._onSizeChangedObserver);\r\n }\r\n this._onSizeChangedObserver = this.onSizeChangedObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onApply\", {\r\n /**\r\n * A function that is added to the onApplyObservable\r\n */\r\n set: function (callback) {\r\n if (this._onApplyObserver) {\r\n this.onApplyObservable.remove(this._onApplyObserver);\r\n }\r\n this._onApplyObserver = this.onApplyObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onBeforeRender\", {\r\n /**\r\n * A function that is added to the onBeforeRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onAfterRender\", {\r\n /**\r\n * A function that is added to the onAfterRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"inputTexture\", {\r\n /**\r\n * The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will\r\n * render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.\r\n */\r\n get: function () {\r\n return this._textures.data[this._currentRenderTextureInd];\r\n },\r\n set: function (value) {\r\n this._forcedOutputTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the camera which post process is applied to.\r\n * @returns The camera the post process is applied to.\r\n */\r\n PostProcess.prototype.getCamera = function () {\r\n return this._camera;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"texelSize\", {\r\n /**\r\n * Gets the texel size of the postprocess.\r\n * See https://en.wikipedia.org/wiki/Texel_(graphics)\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.texelSize;\r\n }\r\n if (this._forcedOutputTexture) {\r\n this._texelSize.copyFromFloats(1.0 / this._forcedOutputTexture.width, 1.0 / this._forcedOutputTexture.height);\r\n }\r\n return this._texelSize;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"PostProcess\" string\r\n */\r\n PostProcess.prototype.getClassName = function () {\r\n return \"PostProcess\";\r\n };\r\n /**\r\n * Gets the engine which this post process belongs to.\r\n * @returns The engine the post process was enabled with.\r\n */\r\n PostProcess.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the the postprocess.\r\n */\r\n PostProcess.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.\r\n * @param postProcess The post process to share the output with.\r\n * @returns This post process.\r\n */\r\n PostProcess.prototype.shareOutputWith = function (postProcess) {\r\n this._disposeTextures();\r\n this._shareOutputWithPostProcess = postProcess;\r\n return this;\r\n };\r\n /**\r\n * Reverses the effect of calling shareOutputWith and returns the post process back to its original state.\r\n * This should be called if the post process that shares output with this post process is disabled/disposed.\r\n */\r\n PostProcess.prototype.useOwnOutput = function () {\r\n if (this._textures.length == 0) {\r\n this._textures = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](2);\r\n }\r\n this._shareOutputWithPostProcess = null;\r\n };\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n */\r\n PostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n this._effect = this._engine.createEffect({ vertex: this._vertexUrl, fragment: this._fragmentUrl }, [\"position\"], uniforms || this._parameters, samplers || this._samplers, defines !== null ? defines : \"\", undefined, onCompiled, onError, indexParameters || this._indexParameters);\r\n };\r\n /**\r\n * The post process is reusable if it can be used multiple times within one frame.\r\n * @returns If the post process is reusable\r\n */\r\n PostProcess.prototype.isReusable = function () {\r\n return this._reusable;\r\n };\r\n /** invalidate frameBuffer to hint the postprocess to create a depth buffer */\r\n PostProcess.prototype.markTextureDirty = function () {\r\n this.width = -1;\r\n };\r\n /**\r\n * Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable.\r\n * When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.\r\n * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.\r\n * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)\r\n * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)\r\n * @returns The target texture that was bound to be written to.\r\n */\r\n PostProcess.prototype.activate = function (camera, sourceTexture, forceDepthStencil) {\r\n var _this = this;\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n camera = camera || this._camera;\r\n var scene = camera.getScene();\r\n var engine = scene.getEngine();\r\n var maxSize = engine.getCaps().maxTextureSize;\r\n var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;\r\n var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;\r\n // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen\r\n var webVRCamera = camera.parent;\r\n if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {\r\n requiredWidth /= 2;\r\n }\r\n var desiredWidth = (this._options.width || requiredWidth);\r\n var desiredHeight = this._options.height || requiredHeight;\r\n if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {\r\n if (this.adaptScaleToCurrentViewport) {\r\n var currentViewport = engine.currentViewport;\r\n if (currentViewport) {\r\n desiredWidth *= currentViewport.width;\r\n desiredHeight *= currentViewport.height;\r\n }\r\n }\r\n if (this.renderTargetSamplingMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].TEXTURE_TRILINEAR_SAMPLINGMODE || this.alwaysForcePOT) {\r\n if (!this._options.width) {\r\n desiredWidth = engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;\r\n }\r\n if (!this._options.height) {\r\n desiredHeight = engine.needPOTTextures ? _Engines_engine__WEBPACK_IMPORTED_MODULE_5__[\"Engine\"].GetExponentOfTwo(desiredHeight, maxSize, this.scaleMode) : desiredHeight;\r\n }\r\n }\r\n if (this.width !== desiredWidth || this.height !== desiredHeight) {\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n this._textures.reset();\r\n }\r\n this.width = desiredWidth;\r\n this.height = desiredHeight;\r\n var textureSize = { width: this.width, height: this.height };\r\n var textureOptions = {\r\n generateMipMaps: false,\r\n generateDepthBuffer: forceDepthStencil || camera._postProcesses.indexOf(this) === 0,\r\n generateStencilBuffer: (forceDepthStencil || camera._postProcesses.indexOf(this) === 0) && this._engine.isStencilEnable,\r\n samplingMode: this.renderTargetSamplingMode,\r\n type: this._textureType\r\n };\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n if (this._reusable) {\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n }\r\n this._texelSize.copyFromFloats(1.0 / this.width, 1.0 / this.height);\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n }\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this.samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this.samples);\r\n }\r\n });\r\n }\r\n var target;\r\n if (this._shareOutputWithPostProcess) {\r\n target = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n target = this._forcedOutputTexture;\r\n this.width = this._forcedOutputTexture.width;\r\n this.height = this._forcedOutputTexture.height;\r\n }\r\n else {\r\n target = this.inputTexture;\r\n }\r\n // Bind the input of this post process to be used as the output of the previous post process.\r\n if (this.enablePixelPerfectMode) {\r\n this._scaleRatio.copyFromFloats(requiredWidth / desiredWidth, requiredHeight / desiredHeight);\r\n this._engine.bindFramebuffer(target, 0, requiredWidth, requiredHeight, this.forceFullscreenViewport);\r\n }\r\n else {\r\n this._scaleRatio.copyFromFloats(1, 1);\r\n this._engine.bindFramebuffer(target, 0, undefined, undefined, this.forceFullscreenViewport);\r\n }\r\n this.onActivateObservable.notifyObservers(camera);\r\n // Clear\r\n if (this.autoClear && this.alphaMode === _Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALPHA_DISABLE) {\r\n this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);\r\n }\r\n if (this._reusable) {\r\n this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;\r\n }\r\n return target;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"isSupported\", {\r\n /**\r\n * If the post process is supported.\r\n */\r\n get: function () {\r\n return this._effect.isSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"aspectRatio\", {\r\n /**\r\n * The aspect ratio of the output texture.\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.aspectRatio;\r\n }\r\n if (this._forcedOutputTexture) {\r\n return this._forcedOutputTexture.width / this._forcedOutputTexture.height;\r\n }\r\n return this.width / this.height;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Get a value indicating if the post-process is ready to be used\r\n * @returns true if the post-process is ready (shader is compiled)\r\n */\r\n PostProcess.prototype.isReady = function () {\r\n return this._effect && this._effect.isReady();\r\n };\r\n /**\r\n * Binds all textures and uniforms to the shader, this will be run on every pass.\r\n * @returns the effect corresponding to this post process. Null if not compiled or not ready.\r\n */\r\n PostProcess.prototype.apply = function () {\r\n // Check\r\n if (!this._effect || !this._effect.isReady()) {\r\n return null;\r\n }\r\n // States\r\n this._engine.enableEffect(this._effect);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n // Alpha\r\n this._engine.setAlphaMode(this.alphaMode);\r\n if (this.alphaConstants) {\r\n this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a);\r\n }\r\n // Bind the output texture of the preivous post process as the input to this post process.\r\n var source;\r\n if (this._shareOutputWithPostProcess) {\r\n source = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n source = this._forcedOutputTexture;\r\n }\r\n else {\r\n source = this.inputTexture;\r\n }\r\n this._effect._bindTexture(\"textureSampler\", source);\r\n // Parameters\r\n this._effect.setVector2(\"scale\", this._scaleRatio);\r\n this.onApplyObservable.notifyObservers(this._effect);\r\n return this._effect;\r\n };\r\n PostProcess.prototype._disposeTextures = function () {\r\n if (this._shareOutputWithPostProcess || this._forcedOutputTexture) {\r\n return;\r\n }\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n }\r\n this._textures.dispose();\r\n };\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n PostProcess.prototype.dispose = function (camera) {\r\n camera = camera || this._camera;\r\n this._disposeTextures();\r\n if (this._scene) {\r\n var index_1 = this._scene.postProcesses.indexOf(this);\r\n if (index_1 !== -1) {\r\n this._scene.postProcesses.splice(index_1, 1);\r\n }\r\n }\r\n else {\r\n var index_2 = this._engine.postProcesses.indexOf(this);\r\n if (index_2 !== -1) {\r\n this._engine.postProcesses.splice(index_2, 1);\r\n }\r\n }\r\n if (!camera) {\r\n return;\r\n }\r\n camera.detachPostProcess(this);\r\n var index = camera._postProcesses.indexOf(this);\r\n if (index === 0 && camera._postProcesses.length > 0) {\r\n var firstPostProcess = this._camera._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n }\r\n this.onActivateObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onApplyObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n };\r\n return PostProcess;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/postProcessManager.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/postProcessManager.ts ***!\n \\*********************************************/\n/*! exports provided: PostProcessManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return PostProcessManager; });\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n/**\r\n * PostProcessManager is used to manage one or more post processes or post process pipelines\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcessManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param scene The scene that the post process is associated with.\r\n */\r\n function PostProcessManager(scene) {\r\n this._vertexBuffers = {};\r\n this._scene = scene;\r\n }\r\n PostProcessManager.prototype._prepareBuffers = function () {\r\n if (this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind]) {\r\n return;\r\n }\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](this._scene.getEngine(), vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false, false, 2);\r\n this._buildIndexBuffer();\r\n };\r\n PostProcessManager.prototype._buildIndexBuffer = function () {\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);\r\n };\r\n /**\r\n * Rebuilds the vertex buffers of the manager.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (!vb) {\r\n return;\r\n }\r\n vb._rebuild();\r\n this._buildIndexBuffer();\r\n };\r\n // Methods\r\n /**\r\n * Prepares a frame to be run through a post process.\r\n * @param sourceTexture The input texture to the post procesess. (default: null)\r\n * @param postProcesses An array of post processes to be run. (default: null)\r\n * @returns True if the post processes were able to be run.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._prepareFrame = function (sourceTexture, postProcesses) {\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n if (postProcesses === void 0) { postProcesses = null; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return false;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (!postProcesses || postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return false;\r\n }\r\n postProcesses[0].activate(camera, sourceTexture, postProcesses !== null && postProcesses !== undefined);\r\n return true;\r\n };\r\n /**\r\n * Manually render a set of post processes to a texture.\r\n * @param postProcesses An array of post processes to be run.\r\n * @param targetTexture The target texture to render to.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight\r\n * @param faceIndex defines the face to render to if a cubemap is defined as the target\r\n * @param lodLevel defines which lod of the texture to render to\r\n */\r\n PostProcessManager.prototype.directRender = function (postProcesses, targetTexture, forceFullscreenViewport, faceIndex, lodLevel) {\r\n if (targetTexture === void 0) { targetTexture = null; }\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0; index < postProcesses.length; index++) {\r\n if (index < postProcesses.length - 1) {\r\n postProcesses[index + 1].activate(this._scene.activeCamera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport, undefined, lodLevel);\r\n }\r\n else {\r\n engine.restoreDefaultFramebuffer();\r\n }\r\n }\r\n var pp = postProcesses[index];\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_0__[\"Material\"].TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore depth buffer\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n };\r\n /**\r\n * Finalize the result of the output of the postprocesses.\r\n * @param doNotPresent If true the result will not be displayed to the screen.\r\n * @param targetTexture The target texture to render to.\r\n * @param faceIndex The index of the face to bind the target texture to.\r\n * @param postProcesses The array of post processes to render.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight (default: false)\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._finalizeFrame = function (doNotPresent, targetTexture, faceIndex, postProcesses, forceFullscreenViewport) {\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0, len = postProcesses.length; index < len; index++) {\r\n var pp = postProcesses[index];\r\n if (index < len - 1) {\r\n pp._outputTexture = postProcesses[index + 1].activate(camera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport);\r\n pp._outputTexture = targetTexture;\r\n }\r\n else {\r\n engine.restoreDefaultFramebuffer();\r\n pp._outputTexture = null;\r\n }\r\n }\r\n if (doNotPresent) {\r\n break;\r\n }\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_0__[\"Material\"].TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore states\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n };\r\n /**\r\n * Disposes of the post process manager.\r\n */\r\n PostProcessManager.prototype.dispose = function () {\r\n var buffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n };\r\n return PostProcessManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/refractionPostProcess.ts\":\n/*!************************************************!*\\\n !*** ./PostProcesses/refractionPostProcess.ts ***!\n \\************************************************/\n/*! exports provided: RefractionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return RefractionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_refraction_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/refraction.fragment */ \"./Shaders/refraction.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * Post process which applies a refractin texture\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#refraction\r\n */\r\nvar RefractionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](RefractionPostProcess, _super);\r\n /**\r\n * Initializes the RefractionPostProcess\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#refraction\r\n * @param name The name of the effect.\r\n * @param refractionTextureUrl Url of the refraction texture to use\r\n * @param color the base color of the refraction (used to taint the rendering)\r\n * @param depth simulated refraction depth\r\n * @param colorLevel the coefficient of the base color (0 to remove base color tainting)\r\n * @param camera The camera to apply the render pass to.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function RefractionPostProcess(name, refractionTextureUrl, \r\n /** the base color of the refraction (used to taint the rendering) */\r\n color, \r\n /** simulated refraction depth */\r\n depth, \r\n /** the coefficient of the base color (0 to remove base color tainting) */\r\n colorLevel, options, camera, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"refraction\", [\"baseColor\", \"depth\", \"colorLevel\"], [\"refractionSampler\"], options, camera, samplingMode, engine, reusable) || this;\r\n _this.color = color;\r\n _this.depth = depth;\r\n _this.colorLevel = colorLevel;\r\n _this._ownRefractionTexture = true;\r\n _this.onActivateObservable.add(function (cam) {\r\n _this._refTexture = _this._refTexture || new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"](refractionTextureUrl, cam.getScene());\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setColor3(\"baseColor\", _this.color);\r\n effect.setFloat(\"depth\", _this.depth);\r\n effect.setFloat(\"colorLevel\", _this.colorLevel);\r\n effect.setTexture(\"refractionSampler\", _this._refTexture);\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(RefractionPostProcess.prototype, \"refractionTexture\", {\r\n /**\r\n * Gets or sets the refraction texture\r\n * Please note that you are responsible for disposing the texture if you set it manually\r\n */\r\n get: function () {\r\n return this._refTexture;\r\n },\r\n set: function (value) {\r\n if (this._refTexture && this._ownRefractionTexture) {\r\n this._refTexture.dispose();\r\n }\r\n this._refTexture = value;\r\n this._ownRefractionTexture = false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Disposes of the post process\r\n * @param camera Camera to dispose post process on\r\n */\r\n RefractionPostProcess.prototype.dispose = function (camera) {\r\n if (this._refTexture && this._ownRefractionTexture) {\r\n this._refTexture.dispose();\r\n this._refTexture = null;\r\n }\r\n _super.prototype.dispose.call(this, camera);\r\n };\r\n return RefractionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/sharpenPostProcess.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/sharpenPostProcess.ts ***!\n \\*********************************************/\n/*! exports provided: SharpenPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return SharpenPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_sharpen_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/sharpen.fragment */ \"./Shaders/sharpen.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * The SharpenPostProcess applies a sharpen kernel to every pixel\r\n * See http://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\nvar SharpenPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SharpenPostProcess, _super);\r\n /**\r\n * Creates a new instance ConvolutionPostProcess\r\n * @param name The name of the effect.\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\r\n */\r\n function SharpenPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, blockCompilation) {\r\n if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n var _this = _super.call(this, name, \"sharpen\", [\"sharpnessAmounts\", \"screenSize\"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;\r\n /**\r\n * How much of the original color should be applied. Setting this to 0 will display edge detection. (default: 1)\r\n */\r\n _this.colorAmount = 1.0;\r\n /**\r\n * How much sharpness should be applied (default: 0.3)\r\n */\r\n _this.edgeAmount = 0.3;\r\n _this.onApply = function (effect) {\r\n effect.setFloat2(\"screenSize\", _this.width, _this.height);\r\n effect.setFloat2(\"sharpnessAmounts\", _this.edgeAmount, _this.colorAmount);\r\n };\r\n return _this;\r\n }\r\n return SharpenPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/stereoscopicInterlacePostProcess.ts\":\n/*!***********************************************************!*\\\n !*** ./PostProcesses/stereoscopicInterlacePostProcess.ts ***!\n \\***********************************************************/\n/*! exports provided: StereoscopicInterlacePostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return StereoscopicInterlacePostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_stereoscopicInterlace_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/stereoscopicInterlace.fragment */ \"./Shaders/stereoscopicInterlace.fragment.ts\");\n\r\n\r\n\r\n\r\n/**\r\n * StereoscopicInterlacePostProcess used to render stereo views from a rigged camera\r\n */\r\nvar StereoscopicInterlacePostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](StereoscopicInterlacePostProcess, _super);\r\n /**\r\n * Initializes a StereoscopicInterlacePostProcess\r\n * @param name The name of the effect.\r\n * @param rigCameras The rig cameras to be appled to the post process\r\n * @param isStereoscopicHoriz If the rendered results are horizontal or verticle\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n */\r\n function StereoscopicInterlacePostProcess(name, rigCameras, isStereoscopicHoriz, samplingMode, engine, reusable) {\r\n var _this = _super.call(this, name, \"stereoscopicInterlace\", ['stepSize'], ['camASampler'], 1, rigCameras[1], samplingMode, engine, reusable, isStereoscopicHoriz ? \"#define IS_STEREOSCOPIC_HORIZ 1\" : undefined) || this;\r\n _this._passedProcess = rigCameras[0]._rigPostProcess;\r\n _this._stepSize = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1 / _this.width, 1 / _this.height);\r\n _this.onSizeChangedObservable.add(function () {\r\n _this._stepSize = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](1 / _this.width, 1 / _this.height);\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setTextureFromPostProcess(\"camASampler\", _this._passedProcess);\r\n effect.setFloat2(\"stepSize\", _this._stepSize.x, _this._stepSize.y);\r\n });\r\n return _this;\r\n }\r\n return StereoscopicInterlacePostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/tonemapPostProcess.ts\":\n/*!*********************************************!*\\\n !*** ./PostProcesses/tonemapPostProcess.ts ***!\n \\*********************************************/\n/*! exports provided: TonemappingOperator, TonemapPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return TonemappingOperator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return TonemapPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_tonemap_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/tonemap.fragment */ \"./Shaders/tonemap.fragment.ts\");\n\r\n\r\n\r\n\r\n/** Defines operator used for tonemapping */\r\nvar TonemappingOperator;\r\n(function (TonemappingOperator) {\r\n /** Hable */\r\n TonemappingOperator[TonemappingOperator[\"Hable\"] = 0] = \"Hable\";\r\n /** Reinhard */\r\n TonemappingOperator[TonemappingOperator[\"Reinhard\"] = 1] = \"Reinhard\";\r\n /** HejiDawson */\r\n TonemappingOperator[TonemappingOperator[\"HejiDawson\"] = 2] = \"HejiDawson\";\r\n /** Photographic */\r\n TonemappingOperator[TonemappingOperator[\"Photographic\"] = 3] = \"Photographic\";\r\n})(TonemappingOperator || (TonemappingOperator = {}));\r\n/**\r\n * Defines a post process to apply tone mapping\r\n */\r\nvar TonemapPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](TonemapPostProcess, _super);\r\n /**\r\n * Creates a new TonemapPostProcess\r\n * @param name defines the name of the postprocess\r\n * @param _operator defines the operator to use\r\n * @param exposureAdjustment defines the required exposure adjustement\r\n * @param camera defines the camera to use (can be null)\r\n * @param samplingMode defines the required sampling mode (BABYLON.Texture.BILINEAR_SAMPLINGMODE by default)\r\n * @param engine defines the hosting engine (can be ignore if camera is set)\r\n * @param textureFormat defines the texture format to use (BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n */\r\n function TonemapPostProcess(name, _operator, \r\n /** Defines the required exposure adjustement */\r\n exposureAdjustment, camera, samplingMode, engine, textureFormat) {\r\n if (samplingMode === void 0) { samplingMode = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURE_BILINEAR_SAMPLINGMODE; }\r\n if (textureFormat === void 0) { textureFormat = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT; }\r\n var _this = _super.call(this, name, \"tonemap\", [\"_ExposureAdjustment\"], null, 1.0, camera, samplingMode, engine, true, null, textureFormat) || this;\r\n _this._operator = _operator;\r\n _this.exposureAdjustment = exposureAdjustment;\r\n var defines = \"#define \";\r\n if (_this._operator === TonemappingOperator.Hable) {\r\n defines += \"HABLE_TONEMAPPING\";\r\n }\r\n else if (_this._operator === TonemappingOperator.Reinhard) {\r\n defines += \"REINHARD_TONEMAPPING\";\r\n }\r\n else if (_this._operator === TonemappingOperator.HejiDawson) {\r\n defines += \"OPTIMIZED_HEJIDAWSON_TONEMAPPING\";\r\n }\r\n else if (_this._operator === TonemappingOperator.Photographic) {\r\n defines += \"PHOTOGRAPHIC_TONEMAPPING\";\r\n }\r\n //sadly a second call to create the effect.\r\n _this.updateEffect(defines);\r\n _this.onApply = function (effect) {\r\n effect.setFloat(\"_ExposureAdjustment\", _this.exposureAdjustment);\r\n };\r\n return _this;\r\n }\r\n return TonemapPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_1__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/volumetricLightScatteringPostProcess.ts\":\n/*!***************************************************************!*\\\n !*** ./PostProcesses/volumetricLightScatteringPostProcess.ts ***!\n \\***************************************************************/\n/*! exports provided: VolumetricLightScatteringPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return VolumetricLightScatteringPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/mesh */ \"./Meshes/mesh.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Materials/standardMaterial */ \"./Materials/standardMaterial.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Meshes_Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Meshes/Builders/planeBuilder */ \"./Meshes/Builders/planeBuilder.ts\");\n/* harmony import */ var _Shaders_depth_vertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Shaders/depth.vertex */ \"./Shaders/depth.vertex.ts\");\n/* harmony import */ var _Shaders_volumetricLightScattering_fragment__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Shaders/volumetricLightScattering.fragment */ \"./Shaders/volumetricLightScattering.fragment.ts\");\n/* harmony import */ var _Shaders_volumetricLightScatteringPass_vertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Shaders/volumetricLightScatteringPass.vertex */ \"./Shaders/volumetricLightScatteringPass.vertex.ts\");\n/* harmony import */ var _Shaders_volumetricLightScatteringPass_fragment__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Shaders/volumetricLightScatteringPass.fragment */ \"./Shaders/volumetricLightScatteringPass.fragment.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../Maths/math.viewport */ \"./Maths/math.viewport.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Inspired by http://http.developer.nvidia.com/GPUGems3/gpugems3_ch13.html\r\n */\r\nvar VolumetricLightScatteringPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VolumetricLightScatteringPostProcess, _super);\r\n /**\r\n * @constructor\r\n * @param name The post-process name\r\n * @param ratio The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)\r\n * @param camera The camera that the post-process will be attached to\r\n * @param mesh The mesh used to create the light scattering\r\n * @param samples The post-process quality, default 100\r\n * @param samplingModeThe post-process filtering mode\r\n * @param engine The babylon engine\r\n * @param reusable If the post-process is reusable\r\n * @param scene The constructor needs a scene reference to initialize internal components. If \"camera\" is null a \"scene\" must be provided\r\n */\r\n function VolumetricLightScatteringPostProcess(name, ratio, camera, mesh, samples, samplingMode, engine, reusable, scene) {\r\n if (samples === void 0) { samples = 100; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].BILINEAR_SAMPLINGMODE; }\r\n var _this = _super.call(this, name, \"volumetricLightScattering\", [\"decay\", \"exposure\", \"weight\", \"meshPositionOnScreen\", \"density\"], [\"lightScatteringSampler\"], ratio.postProcessRatio || ratio, camera, samplingMode, engine, reusable, \"#define NUM_SAMPLES \" + samples) || this;\r\n _this._screenCoordinates = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector2\"].Zero();\r\n /**\r\n * Custom position of the mesh. Used if \"useCustomMeshPosition\" is set to \"true\"\r\n */\r\n _this.customMeshPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n /**\r\n * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)\r\n */\r\n _this.useCustomMeshPosition = false;\r\n /**\r\n * If the post-process should inverse the light scattering direction\r\n */\r\n _this.invert = true;\r\n /**\r\n * Array containing the excluded meshes not rendered in the internal pass\r\n */\r\n _this.excludedMeshes = new Array();\r\n /**\r\n * Controls the overall intensity of the post-process\r\n */\r\n _this.exposure = 0.3;\r\n /**\r\n * Dissipates each sample's contribution in range [0, 1]\r\n */\r\n _this.decay = 0.96815;\r\n /**\r\n * Controls the overall intensity of each sample\r\n */\r\n _this.weight = 0.58767;\r\n /**\r\n * Controls the density of each sample\r\n */\r\n _this.density = 0.926;\r\n scene = ((camera === null) ? scene : camera.getScene()); // parameter \"scene\" can be null.\r\n engine = scene.getEngine();\r\n _this._viewPort = new _Maths_math_viewport__WEBPACK_IMPORTED_MODULE_20__[\"Viewport\"](0, 0, 1, 1).toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n // Configure mesh\r\n _this.mesh = ((mesh !== null) ? mesh : VolumetricLightScatteringPostProcess.CreateDefaultMesh(\"VolumetricLightScatteringMesh\", scene));\r\n // Configure\r\n _this._createPass(scene, ratio.passRatio || ratio);\r\n _this.onActivate = function (camera) {\r\n if (!_this.isSupported) {\r\n _this.dispose(camera);\r\n }\r\n _this.onActivate = null;\r\n };\r\n _this.onApplyObservable.add(function (effect) {\r\n _this._updateMeshScreenCoordinates(scene);\r\n effect.setTexture(\"lightScatteringSampler\", _this._volumetricLightScatteringRTT);\r\n effect.setFloat(\"exposure\", _this.exposure);\r\n effect.setFloat(\"decay\", _this.decay);\r\n effect.setFloat(\"weight\", _this.weight);\r\n effect.setFloat(\"density\", _this.density);\r\n effect.setVector2(\"meshPositionOnScreen\", _this._screenCoordinates);\r\n });\r\n return _this;\r\n }\r\n Object.defineProperty(VolumetricLightScatteringPostProcess.prototype, \"useDiffuseColor\", {\r\n /**\r\n * @hidden\r\n * VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\r\n */\r\n get: function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\");\r\n return false;\r\n },\r\n set: function (useDiffuseColor) {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_2__[\"Logger\"].Warn(\"VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"VolumetricLightScatteringPostProcess\"\r\n * @returns \"VolumetricLightScatteringPostProcess\"\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.getClassName = function () {\r\n return \"VolumetricLightScatteringPostProcess\";\r\n };\r\n VolumetricLightScatteringPostProcess.prototype._isReady = function (subMesh, useInstances) {\r\n var mesh = subMesh.getMesh();\r\n // Render this.mesh as default\r\n if (mesh === this.mesh && mesh.material) {\r\n return mesh.material.isReady(mesh);\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].PositionKind];\r\n var material = subMesh.getMaterial();\r\n // Alpha test\r\n if (material) {\r\n if (material.needAlphaTesting()) {\r\n defines.push(\"#define ALPHATEST\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__[\"VertexBuffer\"].MatricesWeightsKind);\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? (mesh.skeleton.bones.length + 1) : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_8__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._volumetricLightScatteringPass = mesh.getScene().getEngine().createEffect(\"volumetricLightScatteringPass\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { maxSimultaneousMorphTargets: mesh.numBoneInfluencers });\r\n }\r\n return this._volumetricLightScatteringPass.isReady();\r\n };\r\n /**\r\n * Sets the new light position for light scattering effect\r\n * @param position The new custom light position\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.setCustomMeshPosition = function (position) {\r\n this.customMeshPosition = position;\r\n };\r\n /**\r\n * Returns the light position for light scattering effect\r\n * @return Vector3 The custom light position\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.getCustomMeshPosition = function () {\r\n return this.customMeshPosition;\r\n };\r\n /**\r\n * Disposes the internal assets and detaches the post-process from the camera\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.dispose = function (camera) {\r\n var rttIndex = camera.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);\r\n if (rttIndex !== -1) {\r\n camera.getScene().customRenderTargets.splice(rttIndex, 1);\r\n }\r\n this._volumetricLightScatteringRTT.dispose();\r\n _super.prototype.dispose.call(this, camera);\r\n };\r\n /**\r\n * Returns the render target texture used by the post-process\r\n * @return the render target texture used by the post-process\r\n */\r\n VolumetricLightScatteringPostProcess.prototype.getPass = function () {\r\n return this._volumetricLightScatteringRTT;\r\n };\r\n // Private methods\r\n VolumetricLightScatteringPostProcess.prototype._meshExcluded = function (mesh) {\r\n if (this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n VolumetricLightScatteringPostProcess.prototype._createPass = function (scene, ratio) {\r\n var _this = this;\r\n var engine = scene.getEngine();\r\n this._volumetricLightScatteringRTT = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_11__[\"RenderTargetTexture\"](\"volumetricLightScatteringMap\", { width: engine.getRenderWidth() * ratio, height: engine.getRenderHeight() * ratio }, scene, false, true, _Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT);\r\n this._volumetricLightScatteringRTT.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._volumetricLightScatteringRTT.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_10__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._volumetricLightScatteringRTT.renderList = null;\r\n this._volumetricLightScatteringRTT.renderParticles = false;\r\n this._volumetricLightScatteringRTT.ignoreCameraViewport = true;\r\n var camera = this.getCamera();\r\n if (camera) {\r\n camera.customRenderTargets.push(this._volumetricLightScatteringRTT);\r\n }\r\n else {\r\n scene.customRenderTargets.push(this._volumetricLightScatteringRTT);\r\n }\r\n // Custom render function for submeshes\r\n var renderSubMesh = function (subMesh) {\r\n var mesh = subMesh.getRenderingMesh();\r\n if (_this._meshExcluded(mesh)) {\r\n return;\r\n }\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return;\r\n }\r\n var scene = mesh.getScene();\r\n var engine = scene.getEngine();\r\n // Culling\r\n engine.setState(material.backFaceCulling);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);\r\n if (_this._isReady(subMesh, hardwareInstancedRendering)) {\r\n var effect = _this._volumetricLightScatteringPass;\r\n if (mesh === _this.mesh) {\r\n if (subMesh.effect) {\r\n effect = subMesh.effect;\r\n }\r\n else {\r\n effect = material.getEffect();\r\n }\r\n }\r\n engine.enableEffect(effect);\r\n mesh._bind(subMesh, effect, _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode);\r\n if (mesh === _this.mesh) {\r\n material.bind(mesh.getWorldMatrix(), mesh);\r\n }\r\n else {\r\n _this._volumetricLightScatteringPass.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n _this._volumetricLightScatteringPass.setTexture(\"diffuseSampler\", alphaTexture);\r\n if (alphaTexture) {\r\n _this._volumetricLightScatteringPass.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n _this._volumetricLightScatteringPass.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n }\r\n }\r\n // Draw\r\n mesh._processRendering(subMesh, _this._volumetricLightScatteringPass, _Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return effect.setMatrix(\"world\", world); });\r\n }\r\n };\r\n // Render target texture callbacks\r\n var savedSceneClearColor;\r\n var sceneClearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_19__[\"Color4\"](0.0, 0.0, 0.0, 1.0);\r\n this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function () {\r\n savedSceneClearColor = scene.clearColor;\r\n scene.clearColor = sceneClearColor;\r\n });\r\n this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function () {\r\n scene.clearColor = savedSceneClearColor;\r\n });\r\n this._volumetricLightScatteringRTT.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var engine = scene.getEngine();\r\n var index;\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n if (transparentSubMeshes.length) {\r\n // Sort sub meshes\r\n for (index = 0; index < transparentSubMeshes.length; index++) {\r\n var submesh = transparentSubMeshes.data[index];\r\n var boundingInfo = submesh.getBoundingInfo();\r\n if (boundingInfo && scene.activeCamera) {\r\n submesh._alphaIndex = submesh.getMesh().alphaIndex;\r\n submesh._distanceToCamera = boundingInfo.boundingSphere.centerWorld.subtract(scene.activeCamera.position).length();\r\n }\r\n }\r\n var sortedArray = transparentSubMeshes.data.slice(0, transparentSubMeshes.length);\r\n sortedArray.sort(function (a, b) {\r\n // Alpha index first\r\n if (a._alphaIndex > b._alphaIndex) {\r\n return 1;\r\n }\r\n if (a._alphaIndex < b._alphaIndex) {\r\n return -1;\r\n }\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return 1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n // Render sub meshes\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].ALPHA_COMBINE);\r\n for (index = 0; index < sortedArray.length; index++) {\r\n renderSubMesh(sortedArray[index]);\r\n }\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_13__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n };\r\n };\r\n VolumetricLightScatteringPostProcess.prototype._updateMeshScreenCoordinates = function (scene) {\r\n var transform = scene.getTransformMatrix();\r\n var meshPosition;\r\n if (this.useCustomMeshPosition) {\r\n meshPosition = this.customMeshPosition;\r\n }\r\n else if (this.attachedNode) {\r\n meshPosition = this.attachedNode.position;\r\n }\r\n else {\r\n meshPosition = this.mesh.parent ? this.mesh.getAbsolutePosition() : this.mesh.position;\r\n }\r\n var pos = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Project(meshPosition, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity(), transform, this._viewPort);\r\n this._screenCoordinates.x = pos.x / this._viewPort.width;\r\n this._screenCoordinates.y = pos.y / this._viewPort.height;\r\n if (this.invert) {\r\n this._screenCoordinates.y = 1.0 - this._screenCoordinates.y;\r\n }\r\n };\r\n // Static methods\r\n /**\r\n * Creates a default mesh for the Volumeric Light Scattering post-process\r\n * @param name The mesh name\r\n * @param scene The scene where to create the mesh\r\n * @return the default mesh\r\n */\r\n VolumetricLightScatteringPostProcess.CreateDefaultMesh = function (name, scene) {\r\n var mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_6__[\"Mesh\"].CreatePlane(name, 1, scene);\r\n mesh.billboardMode = _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_5__[\"AbstractMesh\"].BILLBOARDMODE_ALL;\r\n var material = new _Materials_standardMaterial__WEBPACK_IMPORTED_MODULE_9__[\"StandardMaterial\"](name + \"Material\", scene);\r\n material.emissiveColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_19__[\"Color3\"](1, 1, 1);\r\n mesh.material = material;\r\n return mesh;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"customMeshPosition\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"useCustomMeshPosition\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"invert\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"mesh\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"excludedMeshes\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"exposure\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"decay\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"weight\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serialize\"])()\r\n ], VolumetricLightScatteringPostProcess.prototype, \"density\", void 0);\r\n return VolumetricLightScatteringPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_12__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/vrDistortionCorrectionPostProcess.ts\":\n/*!************************************************************!*\\\n !*** ./PostProcesses/vrDistortionCorrectionPostProcess.ts ***!\n \\************************************************************/\n/*! exports provided: VRDistortionCorrectionPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return VRDistortionCorrectionPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_vrDistortionCorrection_fragment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Shaders/vrDistortionCorrection.fragment */ \"./Shaders/vrDistortionCorrection.fragment.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * VRDistortionCorrectionPostProcess used for mobile VR\r\n */\r\nvar VRDistortionCorrectionPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRDistortionCorrectionPostProcess, _super);\r\n /**\r\n * Initializes the VRDistortionCorrectionPostProcess\r\n * @param name The name of the effect.\r\n * @param camera The camera to apply the render pass to.\r\n * @param isRightEye If this is for the right eye distortion\r\n * @param vrMetrics All the required metrics for the VR camera\r\n */\r\n function VRDistortionCorrectionPostProcess(name, camera, isRightEye, vrMetrics) {\r\n var _this = _super.call(this, name, \"vrDistortionCorrection\", [\r\n 'LensCenter',\r\n 'Scale',\r\n 'ScaleIn',\r\n 'HmdWarpParam'\r\n ], null, vrMetrics.postProcessScaleFactor, camera, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].BILINEAR_SAMPLINGMODE) || this;\r\n _this._isRightEye = isRightEye;\r\n _this._distortionFactors = vrMetrics.distortionK;\r\n _this._postProcessScaleFactor = vrMetrics.postProcessScaleFactor;\r\n _this._lensCenterOffset = vrMetrics.lensCenterOffset;\r\n _this.adaptScaleToCurrentViewport = true;\r\n _this.onSizeChangedObservable.add(function () {\r\n _this._scaleIn = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](2, 2 / _this.aspectRatio);\r\n _this._scaleFactor = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](.5 * (1 / _this._postProcessScaleFactor), .5 * (1 / _this._postProcessScaleFactor) * _this.aspectRatio);\r\n _this._lensCenter = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector2\"](_this._isRightEye ? 0.5 - _this._lensCenterOffset * 0.5 : 0.5 + _this._lensCenterOffset * 0.5, 0.5);\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n effect.setFloat2(\"LensCenter\", _this._lensCenter.x, _this._lensCenter.y);\r\n effect.setFloat2(\"Scale\", _this._scaleFactor.x, _this._scaleFactor.y);\r\n effect.setFloat2(\"ScaleIn\", _this._scaleIn.x, _this._scaleIn.y);\r\n effect.setFloat4(\"HmdWarpParam\", _this._distortionFactors[0], _this._distortionFactors[1], _this._distortionFactors[2], _this._distortionFactors[3]);\r\n });\r\n return _this;\r\n }\r\n return VRDistortionCorrectionPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_3__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./PostProcesses/vrMultiviewToSingleviewPostProcess.ts\":\n/*!*************************************************************!*\\\n !*** ./PostProcesses/vrMultiviewToSingleviewPostProcess.ts ***!\n \\*************************************************************/\n/*! exports provided: VRMultiviewToSingleviewPostProcess */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return VRMultiviewToSingleviewPostProcess; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _postProcess__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./postProcess */ \"./PostProcesses/postProcess.ts\");\n/* harmony import */ var _Shaders_vrMultiviewToSingleview_fragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Shaders/vrMultiviewToSingleview.fragment */ \"./Shaders/vrMultiviewToSingleview.fragment.ts\");\n/* harmony import */ var _Engines_Extensions_engine_multiview__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Engines/Extensions/engine.multiview */ \"./Engines/Extensions/engine.multiview.ts\");\n\r\n\r\n\r\n\r\n\r\n/**\r\n * VRMultiviewToSingleview used to convert multiview texture arrays to standard textures for scenarios such as webVR\r\n * This will not be used for webXR as it supports displaying texture arrays directly\r\n */\r\nvar VRMultiviewToSingleviewPostProcess = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](VRMultiviewToSingleviewPostProcess, _super);\r\n /**\r\n * Initializes a VRMultiviewToSingleview\r\n * @param name name of the post process\r\n * @param camera camera to be applied to\r\n * @param scaleFactor scaling factor to the size of the output texture\r\n */\r\n function VRMultiviewToSingleviewPostProcess(name, camera, scaleFactor) {\r\n var _this = _super.call(this, name, \"vrMultiviewToSingleview\", [\"imageIndex\"], [\"multiviewSampler\"], scaleFactor, camera, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__[\"Texture\"].BILINEAR_SAMPLINGMODE) || this;\r\n _this.onSizeChangedObservable.add(function () {\r\n });\r\n _this.onApplyObservable.add(function (effect) {\r\n if (camera._scene.activeCamera && camera._scene.activeCamera.isLeftCamera) {\r\n effect.setInt(\"imageIndex\", 0);\r\n }\r\n else {\r\n effect.setInt(\"imageIndex\", 1);\r\n }\r\n effect.setTexture(\"multiviewSampler\", camera._multiviewTexture);\r\n });\r\n return _this;\r\n }\r\n return VRMultiviewToSingleviewPostProcess;\r\n}(_postProcess__WEBPACK_IMPORTED_MODULE_2__[\"PostProcess\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Probes/index.ts\":\n/*!*************************!*\\\n !*** ./Probes/index.ts ***!\n \\*************************/\n/*! exports provided: ReflectionProbe */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _reflectionProbe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reflectionProbe */ \"./Probes/reflectionProbe.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return _reflectionProbe__WEBPACK_IMPORTED_MODULE_0__[\"ReflectionProbe\"]; });\n\n\r\n\n\n/***/ }),\n\n/***/ \"./Probes/reflectionProbe.ts\":\n/*!***********************************!*\\\n !*** ./Probes/reflectionProbe.ts ***!\n \\***********************************/\n/*! exports provided: ReflectionProbe */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return ReflectionProbe; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_4__[\"AbstractScene\"].prototype.removeReflectionProbe = function (toRemove) {\r\n if (!this.reflectionProbes) {\r\n return -1;\r\n }\r\n var index = this.reflectionProbes.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.reflectionProbes.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n_abstractScene__WEBPACK_IMPORTED_MODULE_4__[\"AbstractScene\"].prototype.addReflectionProbe = function (newReflectionProbe) {\r\n if (!this.reflectionProbes) {\r\n this.reflectionProbes = [];\r\n }\r\n this.reflectionProbes.push(newReflectionProbe);\r\n};\r\n/**\r\n * Class used to generate realtime reflection / refraction cube textures\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_reflection_probes\r\n */\r\nvar ReflectionProbe = /** @class */ (function () {\r\n /**\r\n * Creates a new reflection probe\r\n * @param name defines the name of the probe\r\n * @param size defines the texture resolution (for each face)\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines if mip maps should be generated automatically (true by default)\r\n * @param useFloat defines if HDR data (flaot data) should be used to store colors (false by default)\r\n */\r\n function ReflectionProbe(\r\n /** defines the name of the probe */\r\n name, size, scene, generateMipMaps, useFloat) {\r\n var _this = this;\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (useFloat === void 0) { useFloat = false; }\r\n this.name = name;\r\n this._viewMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].Identity();\r\n this._target = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._add = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._invertYAxis = false;\r\n /** Gets or sets probe position (center of the cube map) */\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n this._scene = scene;\r\n // Create the scene field if not exist.\r\n if (!this._scene.reflectionProbes) {\r\n this._scene.reflectionProbes = new Array();\r\n }\r\n this._scene.reflectionProbes.push(this);\r\n this._renderTargetTexture = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_2__[\"RenderTargetTexture\"](name, size, scene, generateMipMaps, true, useFloat ? _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_5__[\"Constants\"].TEXTURETYPE_UNSIGNED_INT, true);\r\n this._renderTargetTexture.onBeforeRenderObservable.add(function (faceIndex) {\r\n switch (faceIndex) {\r\n case 0:\r\n _this._add.copyFromFloats(1, 0, 0);\r\n break;\r\n case 1:\r\n _this._add.copyFromFloats(-1, 0, 0);\r\n break;\r\n case 2:\r\n _this._add.copyFromFloats(0, _this._invertYAxis ? 1 : -1, 0);\r\n break;\r\n case 3:\r\n _this._add.copyFromFloats(0, _this._invertYAxis ? -1 : 1, 0);\r\n break;\r\n case 4:\r\n _this._add.copyFromFloats(0, 0, 1);\r\n break;\r\n case 5:\r\n _this._add.copyFromFloats(0, 0, -1);\r\n break;\r\n }\r\n if (_this._attachedMesh) {\r\n _this.position.copyFrom(_this._attachedMesh.getAbsolutePosition());\r\n }\r\n _this.position.addToRef(_this._add, _this._target);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].LookAtLHToRef(_this.position, _this._target, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Up(), _this._viewMatrix);\r\n if (scene.activeCamera) {\r\n _this._projectionMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Matrix\"].PerspectiveFovLH(Math.PI / 2, 1, scene.activeCamera.minZ, scene.activeCamera.maxZ);\r\n scene.setTransformMatrix(_this._viewMatrix, _this._projectionMatrix);\r\n }\r\n scene._forcedViewPosition = _this.position;\r\n });\r\n this._renderTargetTexture.onAfterUnbindObservable.add(function () {\r\n scene._forcedViewPosition = null;\r\n scene.updateTransformMatrix(true);\r\n });\r\n }\r\n Object.defineProperty(ReflectionProbe.prototype, \"samples\", {\r\n /** Gets or sets the number of samples to use for multi-sampling (0 by default). Required WebGL2 */\r\n get: function () {\r\n return this._renderTargetTexture.samples;\r\n },\r\n set: function (value) {\r\n this._renderTargetTexture.samples = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionProbe.prototype, \"refreshRate\", {\r\n /** Gets or sets the refresh rate to use (on every frame by default) */\r\n get: function () {\r\n return this._renderTargetTexture.refreshRate;\r\n },\r\n set: function (value) {\r\n this._renderTargetTexture.refreshRate = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the hosting scene\r\n * @returns a Scene\r\n */\r\n ReflectionProbe.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n Object.defineProperty(ReflectionProbe.prototype, \"cubeTexture\", {\r\n /** Gets the internal CubeTexture used to render to */\r\n get: function () {\r\n return this._renderTargetTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ReflectionProbe.prototype, \"renderList\", {\r\n /** Gets the list of meshes to render */\r\n get: function () {\r\n return this._renderTargetTexture.renderList;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Attach the probe to a specific mesh (Rendering will be done from attached mesh's position)\r\n * @param mesh defines the mesh to attach to\r\n */\r\n ReflectionProbe.prototype.attachToMesh = function (mesh) {\r\n this._attachedMesh = mesh;\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n */\r\n ReflectionProbe.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {\r\n this._renderTargetTexture.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);\r\n };\r\n /**\r\n * Clean all associated resources\r\n */\r\n ReflectionProbe.prototype.dispose = function () {\r\n var index = this._scene.reflectionProbes.indexOf(this);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this._scene.reflectionProbes.splice(index, 1);\r\n }\r\n if (this._renderTargetTexture) {\r\n this._renderTargetTexture.dispose();\r\n this._renderTargetTexture = null;\r\n }\r\n };\r\n /**\r\n * Converts the reflection probe information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable reflection probe info\r\n */\r\n ReflectionProbe.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n if (fullDetails) {\r\n ret += \", position: \" + this.position.toString();\r\n if (this._attachedMesh) {\r\n ret += \", attached mesh: \" + this._attachedMesh.name;\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Get the class name of the relfection probe.\r\n * @returns \"ReflectionProbe\"\r\n */\r\n ReflectionProbe.prototype.getClassName = function () {\r\n return \"ReflectionProbe\";\r\n };\r\n /**\r\n * Serialize the reflection probe to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n ReflectionProbe.prototype.serialize = function () {\r\n var serializationObject = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Serialize(this, this._renderTargetTexture.serialize());\r\n serializationObject.isReflectionProbe = true;\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse the JSON representation of a reflection probe in order to recreate the reflection probe in the given scene.\r\n * @param parsedReflectionProbe Define the JSON representation of the reflection probe\r\n * @param scene Define the scene the parsed reflection probe should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed reflection probe if successful\r\n */\r\n ReflectionProbe.Parse = function (parsedReflectionProbe, scene, rootUrl) {\r\n var reflectionProbe = null;\r\n if (scene.reflectionProbes) {\r\n for (var index = 0; index < scene.reflectionProbes.length; index++) {\r\n var rp = scene.reflectionProbes[index];\r\n if (rp.name === parsedReflectionProbe.name) {\r\n reflectionProbe = rp;\r\n break;\r\n }\r\n }\r\n }\r\n reflectionProbe = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"SerializationHelper\"].Parse(function () { return reflectionProbe || new ReflectionProbe(parsedReflectionProbe.name, parsedReflectionProbe.renderTargetSize, scene, parsedReflectionProbe._generateMipMaps); }, parsedReflectionProbe, scene, rootUrl);\r\n reflectionProbe.cubeTexture._waitingRenderList = parsedReflectionProbe.renderList;\r\n if (parsedReflectionProbe._attachedMesh) {\r\n reflectionProbe.attachToMesh(scene.getMeshByID(parsedReflectionProbe._attachedMesh));\r\n }\r\n return reflectionProbe;\r\n };\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsMeshReference\"])()\r\n ], ReflectionProbe.prototype, \"_attachedMesh\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__[\"serializeAsVector3\"])()\r\n ], ReflectionProbe.prototype, \"position\", void 0);\r\n return ReflectionProbe;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/boundingBoxRenderer.ts\":\n/*!******************************************!*\\\n !*** ./Rendering/boundingBoxRenderer.ts ***!\n \\******************************************/\n/*! exports provided: BoundingBoxRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return BoundingBoxRenderer; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh.vertexData */ \"./Meshes/mesh.vertexData.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Materials/shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony import */ var _Meshes_Builders_boxBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/Builders/boxBuilder */ \"./Meshes/Builders/boxBuilder.ts\");\n/* harmony import */ var _Shaders_color_fragment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/color.fragment */ \"./Shaders/color.fragment.ts\");\n/* harmony import */ var _Shaders_color_vertex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/color.vertex */ \"./Shaders/color.vertex.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"forceShowBoundingBoxes\", {\r\n get: function () {\r\n return this._forceShowBoundingBoxes || false;\r\n },\r\n set: function (value) {\r\n this._forceShowBoundingBoxes = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.getBoundingBoxRenderer = function () {\r\n if (!this._boundingBoxRenderer) {\r\n this._boundingBoxRenderer = new BoundingBoxRenderer(this);\r\n }\r\n return this._boundingBoxRenderer;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype, \"showBoundingBox\", {\r\n get: function () {\r\n return this._showBoundingBox || false;\r\n },\r\n set: function (value) {\r\n this._showBoundingBox = value;\r\n // Lazyly creates a BB renderer if needed.\r\n if (value) {\r\n this.getScene().getBoundingBoxRenderer();\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * Component responsible of rendering the bounding box of the meshes in a scene.\r\n * This is usually used through the mesh.showBoundingBox or the scene.forceShowBoundingBoxes properties\r\n */\r\nvar BoundingBoxRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new bounding box renderer in a scene.\r\n * @param scene the scene the renderer renders in\r\n */\r\n function BoundingBoxRenderer(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].NAME_BOUNDINGBOXRENDERER;\r\n /**\r\n * Color of the bounding box lines placed in front of an object\r\n */\r\n this.frontColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__[\"Color3\"](1, 1, 1);\r\n /**\r\n * Color of the bounding box lines placed behind an object\r\n */\r\n this.backColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_12__[\"Color3\"](0.1, 0.1, 0.1);\r\n /**\r\n * Defines if the renderer should show the back lines or not\r\n */\r\n this.showBackLines = true;\r\n /**\r\n * @hidden\r\n */\r\n this.renderList = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_5__[\"SmartArray\"](32);\r\n this._vertexBuffers = {};\r\n this._fillIndexBuffer = null;\r\n this._fillIndexData = null;\r\n this.scene = scene;\r\n scene._addComponent(this);\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n BoundingBoxRenderer.prototype.register = function () {\r\n this.scene._beforeEvaluateActiveMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER, this, this.reset);\r\n this.scene._activeMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_ACTIVEMESH_BOUNDINGBOXRENDERER, this, this._activeMesh);\r\n this.scene._evaluateSubMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER, this, this._evaluateSubMesh);\r\n this.scene._afterRenderingGroupDrawStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__[\"SceneComponentConstants\"].STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER, this, this.render);\r\n };\r\n BoundingBoxRenderer.prototype._evaluateSubMesh = function (mesh, subMesh) {\r\n if (mesh.showSubMeshesBoundingBox) {\r\n var boundingInfo = subMesh.getBoundingInfo();\r\n if (boundingInfo !== null && boundingInfo !== undefined) {\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n }\r\n };\r\n BoundingBoxRenderer.prototype._activeMesh = function (sourceMesh, mesh) {\r\n if (sourceMesh.showBoundingBox || this.scene.forceShowBoundingBoxes) {\r\n var boundingInfo = sourceMesh.getBoundingInfo();\r\n boundingInfo.boundingBox._tag = mesh.renderingGroupId;\r\n this.renderList.push(boundingInfo.boundingBox);\r\n }\r\n };\r\n BoundingBoxRenderer.prototype._prepareRessources = function () {\r\n if (this._colorShader) {\r\n return;\r\n }\r\n this._colorShader = new _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_8__[\"ShaderMaterial\"](\"colorShader\", this.scene, \"color\", {\r\n attributes: [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind],\r\n uniforms: [\"world\", \"viewProjection\", \"color\"]\r\n });\r\n var engine = this.scene.getEngine();\r\n var boxdata = _Meshes_mesh_vertexData__WEBPACK_IMPORTED_MODULE_3__[\"VertexData\"].CreateBox({ size: 1.0 });\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, boxdata.positions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false);\r\n this._createIndexBuffer();\r\n this._fillIndexData = boxdata.indices;\r\n };\r\n BoundingBoxRenderer.prototype._createIndexBuffer = function () {\r\n var engine = this.scene.getEngine();\r\n this._indexBuffer = engine.createIndexBuffer([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, 6, 2, 5, 3, 4]);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n BoundingBoxRenderer.prototype.rebuild = function () {\r\n var vb = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n };\r\n /**\r\n * @hidden\r\n */\r\n BoundingBoxRenderer.prototype.reset = function () {\r\n this.renderList.reset();\r\n };\r\n /**\r\n * Render the bounding boxes of a specific rendering group\r\n * @param renderingGroupId defines the rendering group to render\r\n */\r\n BoundingBoxRenderer.prototype.render = function (renderingGroupId) {\r\n if (this.renderList.length === 0) {\r\n return;\r\n }\r\n this._prepareRessources();\r\n if (!this._colorShader.isReady()) {\r\n return;\r\n }\r\n var engine = this.scene.getEngine();\r\n engine.setDepthWrite(false);\r\n this._colorShader._preBind();\r\n for (var boundingBoxIndex = 0; boundingBoxIndex < this.renderList.length; boundingBoxIndex++) {\r\n var boundingBox = this.renderList.data[boundingBoxIndex];\r\n if (boundingBox._tag !== renderingGroupId) {\r\n continue;\r\n }\r\n var min = boundingBox.minimum;\r\n var max = boundingBox.maximum;\r\n var diff = max.subtract(min);\r\n var median = min.add(diff.scale(0.5));\r\n var worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Scaling(diff.x, diff.y, diff.z)\r\n .multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._colorShader.getEffect());\r\n if (this.showBackLines) {\r\n // Back\r\n engine.setDepthFunctionToGreaterOrEqual();\r\n this.scene.resetCachedMaterial();\r\n this._colorShader.setColor4(\"color\", this.backColor.toColor4());\r\n this._colorShader.bind(worldMatrix);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].LineListDrawMode, 0, 24);\r\n }\r\n // Front\r\n engine.setDepthFunctionToLess();\r\n this.scene.resetCachedMaterial();\r\n this._colorShader.setColor4(\"color\", this.frontColor.toColor4());\r\n this._colorShader.bind(worldMatrix);\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].LineListDrawMode, 0, 24);\r\n }\r\n this._colorShader.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n };\r\n /**\r\n * In case of occlusion queries, we can render the occlusion bounding box through this method\r\n * @param mesh Define the mesh to render the occlusion bounding box for\r\n */\r\n BoundingBoxRenderer.prototype.renderOcclusionBoundingBox = function (mesh) {\r\n this._prepareRessources();\r\n if (!this._colorShader.isReady() || !mesh._boundingInfo) {\r\n return;\r\n }\r\n var engine = this.scene.getEngine();\r\n if (!this._fillIndexBuffer) {\r\n this._fillIndexBuffer = engine.createIndexBuffer(this._fillIndexData);\r\n }\r\n engine.setDepthWrite(false);\r\n engine.setColorWrite(false);\r\n this._colorShader._preBind();\r\n var boundingBox = mesh._boundingInfo.boundingBox;\r\n var min = boundingBox.minimum;\r\n var max = boundingBox.maximum;\r\n var diff = max.subtract(min);\r\n var median = min.add(diff.scale(0.5));\r\n var worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Scaling(diff.x, diff.y, diff.z)\r\n .multiply(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Matrix\"].Translation(median.x, median.y, median.z))\r\n .multiply(boundingBox.getWorldMatrix());\r\n engine.bindBuffers(this._vertexBuffers, this._fillIndexBuffer, this._colorShader.getEffect());\r\n engine.setDepthFunctionToLess();\r\n this.scene.resetCachedMaterial();\r\n this._colorShader.bind(worldMatrix);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, 36);\r\n this._colorShader.unbind();\r\n engine.setDepthFunctionToLessOrEqual();\r\n engine.setDepthWrite(true);\r\n engine.setColorWrite(true);\r\n };\r\n /**\r\n * Dispose and release the resources attached to this renderer.\r\n */\r\n BoundingBoxRenderer.prototype.dispose = function () {\r\n if (!this._colorShader) {\r\n return;\r\n }\r\n this.renderList.dispose();\r\n this._colorShader.dispose();\r\n var buffer = this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n this.scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n if (this._fillIndexBuffer) {\r\n this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer);\r\n this._fillIndexBuffer = null;\r\n }\r\n };\r\n return BoundingBoxRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/depthRenderer.ts\":\n/*!************************************!*\\\n !*** ./Rendering/depthRenderer.ts ***!\n \\************************************/\n/*! exports provided: DepthRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return DepthRenderer; });\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/renderTargetTexture */ \"./Materials/Textures/renderTargetTexture.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_depth_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/depth.fragment */ \"./Shaders/depth.fragment.ts\");\n/* harmony import */ var _Shaders_depth_vertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/depth.vertex */ \"./Shaders/depth.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This represents a depth renderer in Babylon.\r\n * A depth renderer will render to it's depth map every frame which can be displayed or used in post processing\r\n */\r\nvar DepthRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a depth renderer\r\n * @param scene The scene the renderer belongs to\r\n * @param type The texture type of the depth map (default: Engine.TEXTURETYPE_FLOAT)\r\n * @param camera The camera to be used to render the depth map (default: scene's active camera)\r\n * @param storeNonLinearDepth Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z\r\n */\r\n function DepthRenderer(scene, type, camera, storeNonLinearDepth) {\r\n var _this = this;\r\n if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_FLOAT; }\r\n if (camera === void 0) { camera = null; }\r\n if (storeNonLinearDepth === void 0) { storeNonLinearDepth = false; }\r\n /**\r\n * Specifiess that the depth renderer will only be used within\r\n * the camera it is created for.\r\n * This can help forcing its rendering during the camera processing.\r\n */\r\n this.useOnlyInActiveCamera = false;\r\n this._scene = scene;\r\n this._storeNonLinearDepth = storeNonLinearDepth;\r\n this.isPacked = type === _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this.isPacked) {\r\n this._clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n }\r\n else {\r\n this._clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_0__[\"Color4\"](1.0, 0.0, 0.0, 1.0);\r\n }\r\n DepthRenderer._SceneComponentInitialization(this._scene);\r\n this._camera = camera;\r\n var engine = scene.getEngine();\r\n // Render target\r\n var format = (this.isPacked || engine.webGLVersion === 1) ? _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_RGBA : _Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].TEXTUREFORMAT_R;\r\n this._depthMap = new _Materials_Textures_renderTargetTexture__WEBPACK_IMPORTED_MODULE_3__[\"RenderTargetTexture\"](\"depthMap\", { width: engine.getRenderWidth(), height: engine.getRenderHeight() }, this._scene, false, true, type, false, undefined, undefined, undefined, undefined, format);\r\n this._depthMap.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._depthMap.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._depthMap.refreshRate = 1;\r\n this._depthMap.renderParticles = false;\r\n this._depthMap.renderList = null;\r\n // Camera to get depth map from to support multiple concurrent cameras\r\n this._depthMap.activeCamera = this._camera;\r\n this._depthMap.ignoreCameraViewport = true;\r\n this._depthMap.useCameraPostProcesses = false;\r\n // set default depth value to 1.0 (far away)\r\n this._depthMap.onClearObservable.add(function (engine) {\r\n engine.clear(_this._clearColor, true, true, true);\r\n });\r\n // Custom render function\r\n var renderSubMesh = function (subMesh) {\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = _this._scene;\r\n var engine = scene.getEngine();\r\n var material = subMesh.getMaterial();\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n if (!material) {\r\n return;\r\n }\r\n // Culling and reverse (right handed system)\r\n engine.setState(material.backFaceCulling, 0, false, scene.useRightHandedSystem);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);\r\n var camera = _this._camera || scene.activeCamera;\r\n if (_this.isReady(subMesh, hardwareInstancedRendering) && camera) {\r\n engine.enableEffect(_this._effect);\r\n mesh._bind(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_4__[\"Material\"].TriangleFillMode);\r\n _this._effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n _this._effect.setFloat2(\"depthValues\", camera.minZ, camera.minZ + camera.maxZ);\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n _this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n _this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n _this._effect.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, _this._effect);\r\n // Draw\r\n mesh._processRendering(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_4__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix(\"world\", world); });\r\n }\r\n };\r\n this._depthMap.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var index;\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n };\r\n }\r\n /**\r\n * Creates the depth rendering effect and checks if the effect is ready.\r\n * @param subMesh The submesh to be used to render the depth map of\r\n * @param useInstances If multiple world instances should be used\r\n * @returns if the depth renderer is ready to render the depth map\r\n */\r\n DepthRenderer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n if (material.disableDepthWrite) {\r\n return false;\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n var mesh = subMesh.getMesh();\r\n // Alpha test\r\n if (material && material.needAlphaTesting() && material.getAlphaTestTexture()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var morphTargetManager = mesh.morphTargetManager;\r\n var numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n if (morphTargetManager.numInfluencers > 0) {\r\n numMorphInfluencers = morphTargetManager.numInfluencers;\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_5__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // None linear depth\r\n if (this._storeNonLinearDepth) {\r\n defines.push(\"#define NONLINEARDEPTH\");\r\n }\r\n // Float Mode\r\n if (this.isPacked) {\r\n defines.push(\"#define PACKED\");\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = this._scene.getEngine().createEffect(\"depth\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"depthValues\", \"morphTargetInfluences\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { maxSimultaneousMorphTargets: numMorphInfluencers });\r\n }\r\n return this._effect.isReady();\r\n };\r\n /**\r\n * Gets the texture which the depth map will be written to.\r\n * @returns The depth map texture\r\n */\r\n DepthRenderer.prototype.getDepthMap = function () {\r\n return this._depthMap;\r\n };\r\n /**\r\n * Disposes of the depth renderer.\r\n */\r\n DepthRenderer.prototype.dispose = function () {\r\n this._depthMap.dispose();\r\n };\r\n /** @hidden */\r\n DepthRenderer._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"DepthRendererSceneComponent\");\r\n };\r\n return DepthRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/depthRendererSceneComponent.ts\":\n/*!**************************************************!*\\\n !*** ./Rendering/depthRendererSceneComponent.ts ***!\n \\**************************************************/\n/*! exports provided: DepthRendererSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return DepthRendererSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _depthRenderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./depthRenderer */ \"./Rendering/depthRenderer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n\r\n\r\n\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.enableDepthRenderer = function (camera, storeNonLinearDepth) {\r\n if (storeNonLinearDepth === void 0) { storeNonLinearDepth = false; }\r\n camera = camera || this.activeCamera;\r\n if (!camera) {\r\n throw \"No camera available to enable depth renderer\";\r\n }\r\n if (!this._depthRenderer) {\r\n this._depthRenderer = {};\r\n }\r\n if (!this._depthRenderer[camera.id]) {\r\n var textureType = 0;\r\n if (this.getEngine().getCaps().textureHalfFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_HALF_FLOAT;\r\n }\r\n else if (this.getEngine().getCaps().textureFloatRender) {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT;\r\n }\r\n else {\r\n textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n this._depthRenderer[camera.id] = new _depthRenderer__WEBPACK_IMPORTED_MODULE_1__[\"DepthRenderer\"](this, textureType, camera, storeNonLinearDepth);\r\n }\r\n return this._depthRenderer[camera.id];\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.disableDepthRenderer = function (camera) {\r\n camera = camera || this.activeCamera;\r\n if (!camera || !this._depthRenderer || !this._depthRenderer[camera.id]) {\r\n return;\r\n }\r\n this._depthRenderer[camera.id].dispose();\r\n delete this._depthRenderer[camera.id];\r\n};\r\n/**\r\n * Defines the Depth Renderer scene component responsible to manage a depth buffer useful\r\n * in several rendering techniques.\r\n */\r\nvar DepthRendererSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function DepthRendererSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_DEPTHRENDERER;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n DepthRendererSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_DEPTHRENDERER, this, this._gatherRenderTargets);\r\n this.scene._gatherActiveCameraRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER, this, this._gatherActiveCameraRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n DepthRendererSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n DepthRendererSceneComponent.prototype.dispose = function () {\r\n for (var key in this.scene._depthRenderer) {\r\n this.scene._depthRenderer[key].dispose();\r\n }\r\n };\r\n DepthRendererSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {\r\n if (this.scene._depthRenderer) {\r\n for (var key in this.scene._depthRenderer) {\r\n var depthRenderer = this.scene._depthRenderer[key];\r\n if (!depthRenderer.useOnlyInActiveCamera) {\r\n renderTargets.push(depthRenderer.getDepthMap());\r\n }\r\n }\r\n }\r\n };\r\n DepthRendererSceneComponent.prototype._gatherActiveCameraRenderTargets = function (renderTargets) {\r\n if (this.scene._depthRenderer) {\r\n for (var key in this.scene._depthRenderer) {\r\n var depthRenderer = this.scene._depthRenderer[key];\r\n if (depthRenderer.useOnlyInActiveCamera && this.scene.activeCamera.id === key) {\r\n renderTargets.push(depthRenderer.getDepthMap());\r\n }\r\n }\r\n }\r\n };\r\n return DepthRendererSceneComponent;\r\n}());\r\n\r\n_depthRenderer__WEBPACK_IMPORTED_MODULE_1__[\"DepthRenderer\"]._SceneComponentInitialization = function (scene) {\r\n // Register the G Buffer component to the scene.\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SceneComponentConstants\"].NAME_DEPTHRENDERER);\r\n if (!component) {\r\n component = new DepthRendererSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/edgesRenderer.ts\":\n/*!************************************!*\\\n !*** ./Rendering/edgesRenderer.ts ***!\n \\************************************/\n/*! exports provided: EdgesRenderer, LineEdgesRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return EdgesRenderer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return LineEdgesRenderer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/linesMesh */ \"./Meshes/linesMesh.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/shaderMaterial */ \"./Materials/shaderMaterial.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Shaders_line_fragment__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Shaders/line.fragment */ \"./Shaders/line.fragment.ts\");\n/* harmony import */ var _Shaders_line_vertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Shaders/line.vertex */ \"./Shaders/line.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.disableEdgesRendering = function () {\r\n if (this._edgesRenderer) {\r\n this._edgesRenderer.dispose();\r\n this._edgesRenderer = null;\r\n }\r\n return this;\r\n};\r\n_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n this.disableEdgesRendering();\r\n this._edgesRenderer = new EdgesRenderer(this, epsilon, checkVerticesInsteadOfIndices);\r\n return this;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_2__[\"AbstractMesh\"].prototype, \"edgesRenderer\", {\r\n get: function () {\r\n return this._edgesRenderer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"].prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n this.disableEdgesRendering();\r\n this._edgesRenderer = new LineEdgesRenderer(this, epsilon, checkVerticesInsteadOfIndices);\r\n return this;\r\n};\r\n_Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"InstancedLinesMesh\"].prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n _Meshes_linesMesh__WEBPACK_IMPORTED_MODULE_3__[\"LinesMesh\"].prototype.enableEdgesRendering.apply(this, arguments);\r\n return this;\r\n};\r\n/**\r\n * FaceAdjacencies Helper class to generate edges\r\n */\r\nvar FaceAdjacencies = /** @class */ (function () {\r\n function FaceAdjacencies() {\r\n this.edges = new Array();\r\n this.edgesConnectedCount = 0;\r\n }\r\n return FaceAdjacencies;\r\n}());\r\n/**\r\n * This class is used to generate edges of the mesh that could then easily be rendered in a scene.\r\n */\r\nvar EdgesRenderer = /** @class */ (function () {\r\n /**\r\n * Creates an instance of the EdgesRenderer. It is primarily use to display edges of a mesh.\r\n * Beware when you use this class with complex objects as the adjacencies computation can be really long\r\n * @param source Mesh used to create edges\r\n * @param epsilon sum of angles in adjacency to check for edge\r\n * @param checkVerticesInsteadOfIndices bases the edges detection on vertices vs indices\r\n * @param generateEdgesLines - should generate Lines or only prepare resources.\r\n */\r\n function EdgesRenderer(source, epsilon, checkVerticesInsteadOfIndices, generateEdgesLines) {\r\n var _this = this;\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n if (generateEdgesLines === void 0) { generateEdgesLines = true; }\r\n /**\r\n * Define the size of the edges with an orthographic camera\r\n */\r\n this.edgesWidthScalerForOrthographic = 1000.0;\r\n /**\r\n * Define the size of the edges with a perspective camera\r\n */\r\n this.edgesWidthScalerForPerspective = 50.0;\r\n this._linesPositions = new Array();\r\n this._linesNormals = new Array();\r\n this._linesIndices = new Array();\r\n this._buffers = {};\r\n this._checkVerticesInsteadOfIndices = false;\r\n /** Gets or sets a boolean indicating if the edgesRenderer is active */\r\n this.isEnabled = true;\r\n this._source = source;\r\n this._checkVerticesInsteadOfIndices = checkVerticesInsteadOfIndices;\r\n this._epsilon = epsilon;\r\n this._prepareRessources();\r\n if (generateEdgesLines) {\r\n this._generateEdgesLines();\r\n }\r\n this._meshRebuildObserver = this._source.onRebuildObservable.add(function () {\r\n _this._rebuild();\r\n });\r\n this._meshDisposeObserver = this._source.onDisposeObservable.add(function () {\r\n _this.dispose();\r\n });\r\n }\r\n EdgesRenderer.prototype._prepareRessources = function () {\r\n if (this._lineShader) {\r\n return;\r\n }\r\n this._lineShader = new _Materials_shaderMaterial__WEBPACK_IMPORTED_MODULE_6__[\"ShaderMaterial\"](\"lineShader\", this._source.getScene(), \"line\", {\r\n attributes: [\"position\", \"normal\"],\r\n uniforms: [\"worldViewProjection\", \"color\", \"width\", \"aspectRatio\"]\r\n });\r\n this._lineShader.disableDepthWrite = true;\r\n this._lineShader.backFaceCulling = false;\r\n };\r\n /** @hidden */\r\n EdgesRenderer.prototype._rebuild = function () {\r\n var buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer._rebuild();\r\n }\r\n buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind];\r\n if (buffer) {\r\n buffer._rebuild();\r\n }\r\n var scene = this._source.getScene();\r\n var engine = scene.getEngine();\r\n this._ib = engine.createIndexBuffer(this._linesIndices);\r\n };\r\n /**\r\n * Releases the required resources for the edges renderer\r\n */\r\n EdgesRenderer.prototype.dispose = function () {\r\n this._source.onRebuildObservable.remove(this._meshRebuildObserver);\r\n this._source.onDisposeObservable.remove(this._meshDisposeObserver);\r\n var buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = null;\r\n }\r\n buffer = this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind] = null;\r\n }\r\n if (this._ib) {\r\n this._source.getScene().getEngine()._releaseBuffer(this._ib);\r\n }\r\n this._lineShader.dispose();\r\n };\r\n EdgesRenderer.prototype._processEdgeForAdjacencies = function (pa, pb, p0, p1, p2) {\r\n if (pa === p0 && pb === p1 || pa === p1 && pb === p0) {\r\n return 0;\r\n }\r\n if (pa === p1 && pb === p2 || pa === p2 && pb === p1) {\r\n return 1;\r\n }\r\n if (pa === p2 && pb === p0 || pa === p0 && pb === p2) {\r\n return 2;\r\n }\r\n return -1;\r\n };\r\n EdgesRenderer.prototype._processEdgeForAdjacenciesWithVertices = function (pa, pb, p0, p1, p2) {\r\n if (pa.equalsWithEpsilon(p0) && pb.equalsWithEpsilon(p1) || pa.equalsWithEpsilon(p1) && pb.equalsWithEpsilon(p0)) {\r\n return 0;\r\n }\r\n if (pa.equalsWithEpsilon(p1) && pb.equalsWithEpsilon(p2) || pa.equalsWithEpsilon(p2) && pb.equalsWithEpsilon(p1)) {\r\n return 1;\r\n }\r\n if (pa.equalsWithEpsilon(p2) && pb.equalsWithEpsilon(p0) || pa.equalsWithEpsilon(p0) && pb.equalsWithEpsilon(p2)) {\r\n return 2;\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Checks if the pair of p0 and p1 is en edge\r\n * @param faceIndex\r\n * @param edge\r\n * @param faceNormals\r\n * @param p0\r\n * @param p1\r\n * @private\r\n */\r\n EdgesRenderer.prototype._checkEdge = function (faceIndex, edge, faceNormals, p0, p1) {\r\n var needToCreateLine;\r\n if (edge === undefined) {\r\n needToCreateLine = true;\r\n }\r\n else {\r\n var dotProduct = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Dot(faceNormals[faceIndex], faceNormals[edge]);\r\n needToCreateLine = dotProduct < this._epsilon;\r\n }\r\n if (needToCreateLine) {\r\n this.createLine(p0, p1, this._linesPositions.length / 3);\r\n }\r\n };\r\n /**\r\n * push line into the position, normal and index buffer\r\n * @protected\r\n */\r\n EdgesRenderer.prototype.createLine = function (p0, p1, offset) {\r\n // Positions\r\n this._linesPositions.push(p0.x, p0.y, p0.z, p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, p1.x, p1.y, p1.z);\r\n // Normals\r\n this._linesNormals.push(p1.x, p1.y, p1.z, -1, p1.x, p1.y, p1.z, 1, p0.x, p0.y, p0.z, -1, p0.x, p0.y, p0.z, 1);\r\n // Indices\r\n this._linesIndices.push(offset, offset + 1, offset + 2, offset, offset + 2, offset + 3);\r\n };\r\n /**\r\n * Generates lines edges from adjacencjes\r\n * @private\r\n */\r\n EdgesRenderer.prototype._generateEdgesLines = function () {\r\n var positions = this._source.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var indices = this._source.getIndices();\r\n if (!indices || !positions) {\r\n return;\r\n }\r\n // First let's find adjacencies\r\n var adjacencies = new Array();\r\n var faceNormals = new Array();\r\n var index;\r\n var faceAdjacencies;\r\n // Prepare faces\r\n for (index = 0; index < indices.length; index += 3) {\r\n faceAdjacencies = new FaceAdjacencies();\r\n var p0Index = indices[index];\r\n var p1Index = indices[index + 1];\r\n var p2Index = indices[index + 2];\r\n faceAdjacencies.p0 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](positions[p0Index * 3], positions[p0Index * 3 + 1], positions[p0Index * 3 + 2]);\r\n faceAdjacencies.p1 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](positions[p1Index * 3], positions[p1Index * 3 + 1], positions[p1Index * 3 + 2]);\r\n faceAdjacencies.p2 = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"](positions[p2Index * 3], positions[p2Index * 3 + 1], positions[p2Index * 3 + 2]);\r\n var faceNormal = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].Cross(faceAdjacencies.p1.subtract(faceAdjacencies.p0), faceAdjacencies.p2.subtract(faceAdjacencies.p1));\r\n faceNormal.normalize();\r\n faceNormals.push(faceNormal);\r\n adjacencies.push(faceAdjacencies);\r\n }\r\n // Scan\r\n for (index = 0; index < adjacencies.length; index++) {\r\n faceAdjacencies = adjacencies[index];\r\n for (var otherIndex = index + 1; otherIndex < adjacencies.length; otherIndex++) {\r\n var otherFaceAdjacencies = adjacencies[otherIndex];\r\n if (faceAdjacencies.edgesConnectedCount === 3) { // Full\r\n break;\r\n }\r\n if (otherFaceAdjacencies.edgesConnectedCount === 3) { // Full\r\n continue;\r\n }\r\n var otherP0 = indices[otherIndex * 3];\r\n var otherP1 = indices[otherIndex * 3 + 1];\r\n var otherP2 = indices[otherIndex * 3 + 2];\r\n for (var edgeIndex = 0; edgeIndex < 3; edgeIndex++) {\r\n var otherEdgeIndex = 0;\r\n if (faceAdjacencies.edges[edgeIndex] !== undefined) {\r\n continue;\r\n }\r\n switch (edgeIndex) {\r\n case 0:\r\n if (this._checkVerticesInsteadOfIndices) {\r\n otherEdgeIndex = this._processEdgeForAdjacenciesWithVertices(faceAdjacencies.p0, faceAdjacencies.p1, otherFaceAdjacencies.p0, otherFaceAdjacencies.p1, otherFaceAdjacencies.p2);\r\n }\r\n else {\r\n otherEdgeIndex = this._processEdgeForAdjacencies(indices[index * 3], indices[index * 3 + 1], otherP0, otherP1, otherP2);\r\n }\r\n break;\r\n case 1:\r\n if (this._checkVerticesInsteadOfIndices) {\r\n otherEdgeIndex = this._processEdgeForAdjacenciesWithVertices(faceAdjacencies.p1, faceAdjacencies.p2, otherFaceAdjacencies.p0, otherFaceAdjacencies.p1, otherFaceAdjacencies.p2);\r\n }\r\n else {\r\n otherEdgeIndex = this._processEdgeForAdjacencies(indices[index * 3 + 1], indices[index * 3 + 2], otherP0, otherP1, otherP2);\r\n }\r\n break;\r\n case 2:\r\n if (this._checkVerticesInsteadOfIndices) {\r\n otherEdgeIndex = this._processEdgeForAdjacenciesWithVertices(faceAdjacencies.p2, faceAdjacencies.p0, otherFaceAdjacencies.p0, otherFaceAdjacencies.p1, otherFaceAdjacencies.p2);\r\n }\r\n else {\r\n otherEdgeIndex = this._processEdgeForAdjacencies(indices[index * 3 + 2], indices[index * 3], otherP0, otherP1, otherP2);\r\n }\r\n break;\r\n }\r\n if (otherEdgeIndex === -1) {\r\n continue;\r\n }\r\n faceAdjacencies.edges[edgeIndex] = otherIndex;\r\n otherFaceAdjacencies.edges[otherEdgeIndex] = index;\r\n faceAdjacencies.edgesConnectedCount++;\r\n otherFaceAdjacencies.edgesConnectedCount++;\r\n if (faceAdjacencies.edgesConnectedCount === 3) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n // Create lines\r\n for (index = 0; index < adjacencies.length; index++) {\r\n // We need a line when a face has no adjacency on a specific edge or if all the adjacencies has an angle greater than epsilon\r\n var current = adjacencies[index];\r\n this._checkEdge(index, current.edges[0], faceNormals, current.p0, current.p1);\r\n this._checkEdge(index, current.edges[1], faceNormals, current.p1, current.p2);\r\n this._checkEdge(index, current.edges[2], faceNormals, current.p2, current.p0);\r\n }\r\n // Merge into a single mesh\r\n var engine = this._source.getScene().getEngine();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesPositions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false);\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesNormals, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, false, false, 4);\r\n this._ib = engine.createIndexBuffer(this._linesIndices);\r\n this._indicesCount = this._linesIndices.length;\r\n };\r\n /**\r\n * Checks wether or not the edges renderer is ready to render.\r\n * @return true if ready, otherwise false.\r\n */\r\n EdgesRenderer.prototype.isReady = function () {\r\n return this._lineShader.isReady();\r\n };\r\n /**\r\n * Renders the edges of the attached mesh,\r\n */\r\n EdgesRenderer.prototype.render = function () {\r\n var scene = this._source.getScene();\r\n if (!this.isReady() || !scene.activeCamera) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n this._lineShader._preBind();\r\n if (this._source.edgesColor.a !== 1) {\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].ALPHA_COMBINE);\r\n }\r\n else {\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_8__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // VBOs\r\n engine.bindBuffers(this._buffers, this._ib, this._lineShader.getEffect());\r\n scene.resetCachedMaterial();\r\n this._lineShader.setColor4(\"color\", this._source.edgesColor);\r\n if (scene.activeCamera.mode === _Cameras_camera__WEBPACK_IMPORTED_MODULE_7__[\"Camera\"].ORTHOGRAPHIC_CAMERA) {\r\n this._lineShader.setFloat(\"width\", this._source.edgesWidth / this.edgesWidthScalerForOrthographic);\r\n }\r\n else {\r\n this._lineShader.setFloat(\"width\", this._source.edgesWidth / this.edgesWidthScalerForPerspective);\r\n }\r\n this._lineShader.setFloat(\"aspectRatio\", engine.getAspectRatio(scene.activeCamera));\r\n this._lineShader.bind(this._source.getWorldMatrix());\r\n // Draw order\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, 0, this._indicesCount);\r\n this._lineShader.unbind();\r\n };\r\n return EdgesRenderer;\r\n}());\r\n\r\n/**\r\n * LineEdgesRenderer for LineMeshes to remove unnecessary triangulation\r\n */\r\nvar LineEdgesRenderer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](LineEdgesRenderer, _super);\r\n /**\r\n * This constructor turns off auto generating edges line in Edges Renderer to make it here.\r\n * @param source LineMesh used to generate edges\r\n * @param epsilon not important (specified angle for edge detection)\r\n * @param checkVerticesInsteadOfIndices not important for LineMesh\r\n */\r\n function LineEdgesRenderer(source, epsilon, checkVerticesInsteadOfIndices) {\r\n if (epsilon === void 0) { epsilon = 0.95; }\r\n if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }\r\n var _this = _super.call(this, source, epsilon, checkVerticesInsteadOfIndices, false) || this;\r\n _this._generateEdgesLines();\r\n return _this;\r\n }\r\n /**\r\n * Generate edges for each line in LinesMesh. Every Line should be rendered as edge.\r\n */\r\n LineEdgesRenderer.prototype._generateEdgesLines = function () {\r\n var positions = this._source.getVerticesData(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind);\r\n var indices = this._source.getIndices();\r\n if (!indices || !positions) {\r\n return;\r\n }\r\n var p0 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[0];\r\n var p1 = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"TmpVectors\"].Vector3[1];\r\n var len = indices.length - 1;\r\n for (var i = 0, offset = 0; i < len; i += 2, offset += 4) {\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].FromArrayToRef(positions, 3 * indices[i], p0);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__[\"Vector3\"].FromArrayToRef(positions, 3 * indices[i + 1], p1);\r\n this.createLine(p0, p1, offset);\r\n }\r\n // Merge into a single mesh\r\n var engine = this._source.getScene().getEngine();\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesPositions, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, false);\r\n this._buffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"](engine, this._linesNormals, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind, false, false, 4);\r\n this._ib = engine.createIndexBuffer(this._linesIndices);\r\n this._indicesCount = this._linesIndices.length;\r\n };\r\n return LineEdgesRenderer;\r\n}(EdgesRenderer));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/geometryBufferRenderer.ts\":\n/*!*********************************************!*\\\n !*** ./Rendering/geometryBufferRenderer.ts ***!\n \\*********************************************/\n/*! exports provided: GeometryBufferRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return GeometryBufferRenderer; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_Textures_multiRenderTarget__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/multiRenderTarget */ \"./Materials/Textures/multiRenderTarget.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Shaders_geometry_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/geometry.fragment */ \"./Shaders/geometry.fragment.ts\");\n/* harmony import */ var _Shaders_geometry_vertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/geometry.vertex */ \"./Shaders/geometry.vertex.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * This renderer is helpfull to fill one of the render target with a geometry buffer.\r\n */\r\nvar GeometryBufferRenderer = /** @class */ (function () {\r\n /**\r\n * Creates a new G Buffer for the scene\r\n * @param scene The scene the buffer belongs to\r\n * @param ratio How big is the buffer related to the main canvas.\r\n */\r\n function GeometryBufferRenderer(scene, ratio) {\r\n if (ratio === void 0) { ratio = 1; }\r\n /**\r\n * Dictionary used to store the previous transformation matrices of each rendered mesh\r\n * in order to compute objects velocities when enableVelocity is set to \"true\"\r\n * @hidden\r\n */\r\n this._previousTransformationMatrices = {};\r\n /**\r\n * Dictionary used to store the previous bones transformation matrices of each rendered mesh\r\n * in order to compute objects velocities when enableVelocity is set to \"true\"\r\n * @hidden\r\n */\r\n this._previousBonesTransformationMatrices = {};\r\n /**\r\n * Array used to store the ignored skinned meshes while computing velocity map (typically used by the motion blur post-process).\r\n * Avoids computing bones velocities and computes only mesh's velocity itself (position, rotation, scaling).\r\n */\r\n this.excludedSkinnedMeshesFromVelocity = [];\r\n this._enablePosition = false;\r\n this._enableVelocity = false;\r\n this._positionIndex = -1;\r\n this._velocityIndex = -1;\r\n this._scene = scene;\r\n this._ratio = ratio;\r\n GeometryBufferRenderer._SceneComponentInitialization(this._scene);\r\n // Render target\r\n this._createRenderTargets();\r\n }\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"renderList\", {\r\n /**\r\n * Set the render list (meshes to be rendered) used in the G buffer.\r\n */\r\n set: function (meshes) {\r\n this._multiRenderTarget.renderList = meshes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"isSupported\", {\r\n /**\r\n * Gets wether or not G buffer are supported by the running hardware.\r\n * This requires draw buffer supports\r\n */\r\n get: function () {\r\n return this._multiRenderTarget.isSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the index of the given texture type in the G-Buffer textures array\r\n * @param textureType The texture type constant. For example GeometryBufferRenderer.POSITION_TEXTURE_INDEX\r\n * @returns the index of the given texture type in the G-Buffer textures array\r\n */\r\n GeometryBufferRenderer.prototype.getTextureIndex = function (textureType) {\r\n switch (textureType) {\r\n case GeometryBufferRenderer.POSITION_TEXTURE_TYPE: return this._positionIndex;\r\n case GeometryBufferRenderer.VELOCITY_TEXTURE_TYPE: return this._velocityIndex;\r\n default: return -1;\r\n }\r\n };\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"enablePosition\", {\r\n /**\r\n * Gets a boolean indicating if objects positions are enabled for the G buffer.\r\n */\r\n get: function () {\r\n return this._enablePosition;\r\n },\r\n /**\r\n * Sets whether or not objects positions are enabled for the G buffer.\r\n */\r\n set: function (enable) {\r\n this._enablePosition = enable;\r\n this.dispose();\r\n this._createRenderTargets();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"enableVelocity\", {\r\n /**\r\n * Gets a boolean indicating if objects velocities are enabled for the G buffer.\r\n */\r\n get: function () {\r\n return this._enableVelocity;\r\n },\r\n /**\r\n * Sets wether or not objects velocities are enabled for the G buffer.\r\n */\r\n set: function (enable) {\r\n this._enableVelocity = enable;\r\n if (!enable) {\r\n this._previousTransformationMatrices = {};\r\n }\r\n this.dispose();\r\n this._createRenderTargets();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"scene\", {\r\n /**\r\n * Gets the scene associated with the buffer.\r\n */\r\n get: function () {\r\n return this._scene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"ratio\", {\r\n /**\r\n * Gets the ratio used by the buffer during its creation.\r\n * How big is the buffer related to the main canvas.\r\n */\r\n get: function () {\r\n return this._ratio;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Checks wether everything is ready to render a submesh to the G buffer.\r\n * @param subMesh the submesh to check readiness for\r\n * @param useInstances is the mesh drawn using instance or not\r\n * @returns true if ready otherwise false\r\n */\r\n GeometryBufferRenderer.prototype.isReady = function (subMesh, useInstances) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.disableDepthWrite) {\r\n return false;\r\n }\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].PositionKind, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].NormalKind];\r\n var mesh = subMesh.getMesh();\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n // Buffers\r\n if (this._enablePosition) {\r\n defines.push(\"#define POSITION\");\r\n defines.push(\"#define POSITION_INDEX \" + this._positionIndex);\r\n }\r\n if (this._enableVelocity) {\r\n defines.push(\"#define VELOCITY\");\r\n defines.push(\"#define VELOCITY_INDEX \" + this._velocityIndex);\r\n if (this.excludedSkinnedMeshesFromVelocity.indexOf(mesh) === -1) {\r\n defines.push(\"#define BONES_VELOCITY_ENABLED\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_1__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var morphTargetManager = mesh.morphTargetManager;\r\n var numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n if (morphTargetManager.numInfluencers > 0) {\r\n numMorphInfluencers = morphTargetManager.numInfluencers;\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Setup textures count\r\n defines.push(\"#define RENDER_TARGET_COUNT \" + this._multiRenderTarget.textures.length);\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = this._scene.getEngine().createEffect(\"geometry\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"view\", \"previousWorld\", \"previousViewProjection\", \"mPreviousBones\", \"morphTargetInfluences\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { buffersCount: this._enablePosition ? 3 : 2, maxSimultaneousMorphTargets: numMorphInfluencers });\r\n }\r\n return this._effect.isReady();\r\n };\r\n /**\r\n * Gets the current underlying G Buffer.\r\n * @returns the buffer\r\n */\r\n GeometryBufferRenderer.prototype.getGBuffer = function () {\r\n return this._multiRenderTarget;\r\n };\r\n Object.defineProperty(GeometryBufferRenderer.prototype, \"samples\", {\r\n /**\r\n * Gets the number of samples used to render the buffer (anti aliasing).\r\n */\r\n get: function () {\r\n return this._multiRenderTarget.samples;\r\n },\r\n /**\r\n * Sets the number of samples used to render the buffer (anti aliasing).\r\n */\r\n set: function (value) {\r\n this._multiRenderTarget.samples = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes the renderer and frees up associated resources.\r\n */\r\n GeometryBufferRenderer.prototype.dispose = function () {\r\n this.getGBuffer().dispose();\r\n };\r\n GeometryBufferRenderer.prototype._createRenderTargets = function () {\r\n var _this = this;\r\n var engine = this._scene.getEngine();\r\n var count = 2;\r\n if (this._enablePosition) {\r\n this._positionIndex = count;\r\n count++;\r\n }\r\n if (this._enableVelocity) {\r\n this._velocityIndex = count;\r\n count++;\r\n }\r\n this._multiRenderTarget = new _Materials_Textures_multiRenderTarget__WEBPACK_IMPORTED_MODULE_4__[\"MultiRenderTarget\"](\"gBuffer\", { width: engine.getRenderWidth() * this._ratio, height: engine.getRenderHeight() * this._ratio }, count, this._scene, { generateMipMaps: false, generateDepthTexture: true, defaultType: _Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].TEXTURETYPE_FLOAT });\r\n if (!this.isSupported) {\r\n return;\r\n }\r\n this._multiRenderTarget.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._multiRenderTarget.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._multiRenderTarget.refreshRate = 1;\r\n this._multiRenderTarget.renderParticles = false;\r\n this._multiRenderTarget.renderList = null;\r\n // set default depth value to 1.0 (far away)\r\n this._multiRenderTarget.onClearObservable.add(function (engine) {\r\n engine.clear(new _Maths_math_color__WEBPACK_IMPORTED_MODULE_10__[\"Color4\"](0.0, 0.0, 0.0, 1.0), true, true, true);\r\n });\r\n // Custom render function\r\n var renderSubMesh = function (subMesh) {\r\n var mesh = subMesh.getRenderingMesh();\r\n var scene = _this._scene;\r\n var engine = scene.getEngine();\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return;\r\n }\r\n mesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n // Velocity\r\n if (_this._enableVelocity && !_this._previousTransformationMatrices[mesh.uniqueId]) {\r\n _this._previousTransformationMatrices[mesh.uniqueId] = {\r\n world: _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Matrix\"].Identity(),\r\n viewProjection: scene.getTransformMatrix()\r\n };\r\n if (mesh.skeleton) {\r\n var bonesTransformations = mesh.skeleton.getTransformMatrices(mesh);\r\n _this._previousBonesTransformationMatrices[mesh.uniqueId] = _this._copyBonesTransformationMatrices(bonesTransformations, new Float32Array(bonesTransformations.length));\r\n }\r\n }\r\n // Culling\r\n engine.setState(material.backFaceCulling, 0, false, scene.useRightHandedSystem);\r\n // Managing instances\r\n var batch = mesh._getInstancesRenderList(subMesh._id);\r\n if (batch.mustReturn) {\r\n return;\r\n }\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);\r\n if (_this.isReady(subMesh, hardwareInstancedRendering)) {\r\n engine.enableEffect(_this._effect);\r\n mesh._bind(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode);\r\n _this._effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n _this._effect.setMatrix(\"view\", scene.getViewMatrix());\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n _this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n _this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n _this._effect.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n if (_this._enableVelocity) {\r\n _this._effect.setMatrices(\"mPreviousBones\", _this._previousBonesTransformationMatrices[mesh.uniqueId]);\r\n }\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, _this._effect);\r\n // Velocity\r\n if (_this._enableVelocity) {\r\n _this._effect.setMatrix(\"previousWorld\", _this._previousTransformationMatrices[mesh.uniqueId].world);\r\n _this._effect.setMatrix(\"previousViewProjection\", _this._previousTransformationMatrices[mesh.uniqueId].viewProjection);\r\n }\r\n // Draw\r\n mesh._processRendering(subMesh, _this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix(\"world\", world); });\r\n }\r\n // Velocity\r\n if (_this._enableVelocity) {\r\n _this._previousTransformationMatrices[mesh.uniqueId].world = mesh.getWorldMatrix().clone();\r\n _this._previousTransformationMatrices[mesh.uniqueId].viewProjection = _this._scene.getTransformMatrix().clone();\r\n if (mesh.skeleton) {\r\n _this._copyBonesTransformationMatrices(mesh.skeleton.getTransformMatrices(mesh), _this._previousBonesTransformationMatrices[mesh.uniqueId]);\r\n }\r\n }\r\n };\r\n this._multiRenderTarget.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) {\r\n var index;\r\n if (depthOnlySubMeshes.length) {\r\n engine.setColorWrite(false);\r\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\r\n renderSubMesh(depthOnlySubMeshes.data[index]);\r\n }\r\n engine.setColorWrite(true);\r\n }\r\n for (index = 0; index < opaqueSubMeshes.length; index++) {\r\n renderSubMesh(opaqueSubMeshes.data[index]);\r\n }\r\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\r\n renderSubMesh(alphaTestSubMeshes.data[index]);\r\n }\r\n };\r\n };\r\n // Copies the bones transformation matrices into the target array and returns the target's reference\r\n GeometryBufferRenderer.prototype._copyBonesTransformationMatrices = function (source, target) {\r\n for (var i = 0; i < source.length; i++) {\r\n target[i] = source[i];\r\n }\r\n return target;\r\n };\r\n /**\r\n * Constant used to retrieve the position texture index in the G-Buffer textures array\r\n * using getIndex(GeometryBufferRenderer.POSITION_TEXTURE_INDEX)\r\n */\r\n GeometryBufferRenderer.POSITION_TEXTURE_TYPE = 1;\r\n /**\r\n * Constant used to retrieve the velocity texture index in the G-Buffer textures array\r\n * using getIndex(GeometryBufferRenderer.VELOCITY_TEXTURE_INDEX)\r\n */\r\n GeometryBufferRenderer.VELOCITY_TEXTURE_TYPE = 2;\r\n /** @hidden */\r\n GeometryBufferRenderer._SceneComponentInitialization = function (_) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_9__[\"_DevTools\"].WarnImport(\"GeometryBufferRendererSceneComponent\");\r\n };\r\n return GeometryBufferRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/geometryBufferRendererSceneComponent.ts\":\n/*!***********************************************************!*\\\n !*** ./Rendering/geometryBufferRendererSceneComponent.ts ***!\n \\***********************************************************/\n/*! exports provided: GeometryBufferRendererSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return GeometryBufferRendererSceneComponent; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./geometryBufferRenderer */ \"./Rendering/geometryBufferRenderer.ts\");\n\r\n\r\n\r\nObject.defineProperty(_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype, \"geometryBufferRenderer\", {\r\n get: function () {\r\n this._geometryBufferRenderer;\r\n },\r\n set: function (value) {\r\n if (value && value.isSupported) {\r\n this._geometryBufferRenderer = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.enableGeometryBufferRenderer = function (ratio) {\r\n if (ratio === void 0) { ratio = 1; }\r\n if (this._geometryBufferRenderer) {\r\n return this._geometryBufferRenderer;\r\n }\r\n this._geometryBufferRenderer = new _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_2__[\"GeometryBufferRenderer\"](this, ratio);\r\n if (!this._geometryBufferRenderer.isSupported) {\r\n this._geometryBufferRenderer = null;\r\n }\r\n return this._geometryBufferRenderer;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].prototype.disableGeometryBufferRenderer = function () {\r\n if (!this._geometryBufferRenderer) {\r\n return;\r\n }\r\n this._geometryBufferRenderer.dispose();\r\n this._geometryBufferRenderer = null;\r\n};\r\n/**\r\n * Defines the Geometry Buffer scene component responsible to manage a G-Buffer useful\r\n * in several rendering techniques.\r\n */\r\nvar GeometryBufferRendererSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function GeometryBufferRendererSceneComponent(scene) {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GEOMETRYBUFFERRENDERER;\r\n this.scene = scene;\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n GeometryBufferRendererSceneComponent.prototype.register = function () {\r\n this.scene._gatherRenderTargetsStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n GeometryBufferRendererSceneComponent.prototype.rebuild = function () {\r\n // Nothing to do for this component\r\n };\r\n /**\r\n * Disposes the component and the associated ressources\r\n */\r\n GeometryBufferRendererSceneComponent.prototype.dispose = function () {\r\n // Nothing to do for this component\r\n };\r\n GeometryBufferRendererSceneComponent.prototype._gatherRenderTargets = function (renderTargets) {\r\n if (this.scene._geometryBufferRenderer) {\r\n renderTargets.push(this.scene._geometryBufferRenderer.getGBuffer());\r\n }\r\n };\r\n return GeometryBufferRendererSceneComponent;\r\n}());\r\n\r\n_geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_2__[\"GeometryBufferRenderer\"]._SceneComponentInitialization = function (scene) {\r\n // Register the G Buffer component to the scene.\r\n var component = scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_1__[\"SceneComponentConstants\"].NAME_GEOMETRYBUFFERRENDERER);\r\n if (!component) {\r\n component = new GeometryBufferRendererSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/index.ts\":\n/*!****************************!*\\\n !*** ./Rendering/index.ts ***!\n \\****************************/\n/*! exports provided: BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _boundingBoxRenderer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./boundingBoxRenderer */ \"./Rendering/boundingBoxRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return _boundingBoxRenderer__WEBPACK_IMPORTED_MODULE_0__[\"BoundingBoxRenderer\"]; });\n\n/* harmony import */ var _depthRenderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./depthRenderer */ \"./Rendering/depthRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return _depthRenderer__WEBPACK_IMPORTED_MODULE_1__[\"DepthRenderer\"]; });\n\n/* harmony import */ var _depthRendererSceneComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./depthRendererSceneComponent */ \"./Rendering/depthRendererSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return _depthRendererSceneComponent__WEBPACK_IMPORTED_MODULE_2__[\"DepthRendererSceneComponent\"]; });\n\n/* harmony import */ var _edgesRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edgesRenderer */ \"./Rendering/edgesRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return _edgesRenderer__WEBPACK_IMPORTED_MODULE_3__[\"EdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return _edgesRenderer__WEBPACK_IMPORTED_MODULE_3__[\"LineEdgesRenderer\"]; });\n\n/* harmony import */ var _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./geometryBufferRenderer */ \"./Rendering/geometryBufferRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return _geometryBufferRenderer__WEBPACK_IMPORTED_MODULE_4__[\"GeometryBufferRenderer\"]; });\n\n/* harmony import */ var _geometryBufferRendererSceneComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./geometryBufferRendererSceneComponent */ \"./Rendering/geometryBufferRendererSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return _geometryBufferRendererSceneComponent__WEBPACK_IMPORTED_MODULE_5__[\"GeometryBufferRendererSceneComponent\"]; });\n\n/* harmony import */ var _outlineRenderer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./outlineRenderer */ \"./Rendering/outlineRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return _outlineRenderer__WEBPACK_IMPORTED_MODULE_6__[\"OutlineRenderer\"]; });\n\n/* harmony import */ var _renderingGroup__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./renderingGroup */ \"./Rendering/renderingGroup.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return _renderingGroup__WEBPACK_IMPORTED_MODULE_7__[\"RenderingGroup\"]; });\n\n/* harmony import */ var _renderingManager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./renderingManager */ \"./Rendering/renderingManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return _renderingManager__WEBPACK_IMPORTED_MODULE_8__[\"RenderingGroupInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return _renderingManager__WEBPACK_IMPORTED_MODULE_8__[\"RenderingManager\"]; });\n\n/* harmony import */ var _utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utilityLayerRenderer */ \"./Rendering/utilityLayerRenderer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return _utilityLayerRenderer__WEBPACK_IMPORTED_MODULE_9__[\"UtilityLayerRenderer\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/outlineRenderer.ts\":\n/*!**************************************!*\\\n !*** ./Rendering/outlineRenderer.ts ***!\n \\**************************************/\n/*! exports provided: OutlineRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return OutlineRenderer; });\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/materialHelper */ \"./Materials/materialHelper.ts\");\n/* harmony import */ var _Shaders_outline_fragment__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Shaders/outline.fragment */ \"./Shaders/outline.fragment.ts\");\n/* harmony import */ var _Shaders_outline_vertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/outline.vertex */ \"./Shaders/outline.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Gets the outline renderer associated with the scene\r\n * @returns a OutlineRenderer\r\n */\r\n_scene__WEBPACK_IMPORTED_MODULE_2__[\"Scene\"].prototype.getOutlineRenderer = function () {\r\n if (!this._outlineRenderer) {\r\n this._outlineRenderer = new OutlineRenderer(this);\r\n }\r\n return this._outlineRenderer;\r\n};\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"renderOutline\", {\r\n get: function () {\r\n return this._renderOutline;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n // Lazy Load the component.\r\n this.getScene().getOutlineRenderer();\r\n }\r\n this._renderOutline = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nObject.defineProperty(_Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_1__[\"AbstractMesh\"].prototype, \"renderOverlay\", {\r\n get: function () {\r\n return this._renderOverlay;\r\n },\r\n set: function (value) {\r\n if (value) {\r\n // Lazy Load the component.\r\n this.getScene().getOutlineRenderer();\r\n }\r\n this._renderOverlay = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n/**\r\n * This class is responsible to draw bothe outline/overlay of meshes.\r\n * It should not be used directly but through the available method on mesh.\r\n */\r\nvar OutlineRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new outline renderer. (There could be only one per scene).\r\n * @param scene Defines the scene it belongs to\r\n */\r\n function OutlineRenderer(scene) {\r\n /**\r\n * The name of the component. Each component must have a unique name.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_OUTLINERENDERER;\r\n /**\r\n * Defines a zOffset to prevent zFighting between the overlay and the mesh.\r\n */\r\n this.zOffset = 1;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n this.scene._addComponent(this);\r\n }\r\n /**\r\n * Register the component to one instance of a scene.\r\n */\r\n OutlineRenderer.prototype.register = function () {\r\n this.scene._beforeRenderingMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_BEFORERENDERINGMESH_OUTLINE, this, this._beforeRenderingMesh);\r\n this.scene._afterRenderingMeshStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_AFTERRENDERINGMESH_OUTLINE, this, this._afterRenderingMesh);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n OutlineRenderer.prototype.rebuild = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n OutlineRenderer.prototype.dispose = function () {\r\n // Nothing to do here.\r\n };\r\n /**\r\n * Renders the outline in the canvas.\r\n * @param subMesh Defines the sumesh to render\r\n * @param batch Defines the batch of meshes in case of instances\r\n * @param useOverlay Defines if the rendering is for the overlay or the outline\r\n */\r\n OutlineRenderer.prototype.render = function (subMesh, batch, useOverlay) {\r\n var _this = this;\r\n if (useOverlay === void 0) { useOverlay = false; }\r\n var scene = this.scene;\r\n var engine = scene.getEngine();\r\n var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null) && (batch.visibleInstances[subMesh._id] !== undefined);\r\n if (!this.isReady(subMesh, hardwareInstancedRendering)) {\r\n return;\r\n }\r\n var mesh = subMesh.getRenderingMesh();\r\n var material = subMesh.getMaterial();\r\n if (!material || !scene.activeCamera) {\r\n return;\r\n }\r\n engine.enableEffect(this._effect);\r\n // Logarithmic depth\r\n if (material.useLogarithmicDepth) {\r\n this._effect.setFloat(\"logarithmicDepthConstant\", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));\r\n }\r\n this._effect.setFloat(\"offset\", useOverlay ? 0 : mesh.outlineWidth);\r\n this._effect.setColor4(\"color\", useOverlay ? mesh.overlayColor : mesh.outlineColor, useOverlay ? mesh.overlayAlpha : material.alpha);\r\n this._effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n this._effect.setMatrices(\"mBones\", mesh.skeleton.getTransformMatrices(mesh));\r\n }\r\n // Morph targets\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].BindMorphTargetParameters(mesh, this._effect);\r\n mesh._bind(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode);\r\n // Alpha test\r\n if (material && material.needAlphaTesting()) {\r\n var alphaTexture = material.getAlphaTestTexture();\r\n if (alphaTexture) {\r\n this._effect.setTexture(\"diffuseSampler\", alphaTexture);\r\n this._effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\r\n }\r\n }\r\n engine.setZOffset(-this.zOffset);\r\n mesh._processRendering(subMesh, this._effect, _Materials_material__WEBPACK_IMPORTED_MODULE_5__[\"Material\"].TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { _this._effect.setMatrix(\"world\", world); });\r\n engine.setZOffset(0);\r\n };\r\n /**\r\n * Returns whether or not the outline renderer is ready for a given submesh.\r\n * All the dependencies e.g. submeshes, texture, effect... mus be ready\r\n * @param subMesh Defines the submesh to check readyness for\r\n * @param useInstances Defines wheter wee are trying to render instances or not\r\n * @returns true if ready otherwise false\r\n */\r\n OutlineRenderer.prototype.isReady = function (subMesh, useInstances) {\r\n var defines = [];\r\n var attribs = [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].PositionKind, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].NormalKind];\r\n var mesh = subMesh.getMesh();\r\n var material = subMesh.getMaterial();\r\n if (material) {\r\n // Alpha test\r\n if (material.needAlphaTesting()) {\r\n defines.push(\"#define ALPHATEST\");\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UVKind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UVKind);\r\n defines.push(\"#define UV1\");\r\n }\r\n if (mesh.isVerticesDataPresent(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UV2Kind)) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].UV2Kind);\r\n defines.push(\"#define UV2\");\r\n }\r\n }\r\n //Logarithmic depth\r\n if (material.useLogarithmicDepth) {\r\n defines.push(\"#define LOGARITHMICDEPTH\");\r\n }\r\n }\r\n // Bones\r\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesIndicesKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesIndicesExtraKind);\r\n attribs.push(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__[\"VertexBuffer\"].MatricesWeightsExtraKind);\r\n }\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\r\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Morph targets\r\n var morphTargetManager = mesh.morphTargetManager;\r\n var numMorphInfluencers = 0;\r\n if (morphTargetManager) {\r\n if (morphTargetManager.numInfluencers > 0) {\r\n numMorphInfluencers = morphTargetManager.numInfluencers;\r\n defines.push(\"#define MORPHTARGETS\");\r\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\r\n }\r\n }\r\n // Instances\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n _Materials_materialHelper__WEBPACK_IMPORTED_MODULE_6__[\"MaterialHelper\"].PushAttributesForInstances(attribs);\r\n }\r\n // Get correct effect\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = this.scene.getEngine().createEffect(\"outline\", attribs, [\"world\", \"mBones\", \"viewProjection\", \"diffuseMatrix\", \"offset\", \"color\", \"logarithmicDepthConstant\", \"morphTargetInfluences\"], [\"diffuseSampler\"], join, undefined, undefined, undefined, { maxSimultaneousMorphTargets: numMorphInfluencers });\r\n }\r\n return this._effect.isReady();\r\n };\r\n OutlineRenderer.prototype._beforeRenderingMesh = function (mesh, subMesh, batch) {\r\n // Outline - step 1\r\n this._savedDepthWrite = this._engine.getDepthWrite();\r\n if (mesh.renderOutline) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.needAlphaBlending()) {\r\n this._engine.cacheStencilState();\r\n // Draw only to stencil buffer for the original mesh\r\n // The resulting stencil buffer will be used so the outline is not visible inside the mesh when the mesh is transparent\r\n this._engine.setDepthWrite(false);\r\n this._engine.setColorWrite(false);\r\n this._engine.setStencilBuffer(true);\r\n this._engine.setStencilOperationPass(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].REPLACE);\r\n this._engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALWAYS);\r\n this._engine.setStencilMask(OutlineRenderer._StencilReference);\r\n this._engine.setStencilFunctionReference(OutlineRenderer._StencilReference);\r\n this.render(subMesh, batch, /* This sets offset to 0 */ true);\r\n this._engine.setColorWrite(true);\r\n this._engine.setStencilFunction(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].NOTEQUAL);\r\n }\r\n // Draw the outline using the above stencil if needed to avoid drawing within the mesh\r\n this._engine.setDepthWrite(false);\r\n this.render(subMesh, batch);\r\n this._engine.setDepthWrite(this._savedDepthWrite);\r\n if (material && material.needAlphaBlending()) {\r\n this._engine.restoreStencilState();\r\n }\r\n }\r\n };\r\n OutlineRenderer.prototype._afterRenderingMesh = function (mesh, subMesh, batch) {\r\n // Overlay\r\n if (mesh.renderOverlay) {\r\n var currentMode = this._engine.getAlphaMode();\r\n this._engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_3__[\"Constants\"].ALPHA_COMBINE);\r\n this.render(subMesh, batch, true);\r\n this._engine.setAlphaMode(currentMode);\r\n }\r\n // Outline - step 2\r\n if (mesh.renderOutline && this._savedDepthWrite) {\r\n this._engine.setDepthWrite(true);\r\n this._engine.setColorWrite(false);\r\n this.render(subMesh, batch);\r\n this._engine.setColorWrite(true);\r\n }\r\n };\r\n /**\r\n * Stencil value used to avoid outline being seen within the mesh when the mesh is transparent\r\n */\r\n OutlineRenderer._StencilReference = 0x04;\r\n return OutlineRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/renderingGroup.ts\":\n/*!*************************************!*\\\n !*** ./Rendering/renderingGroup.ts ***!\n \\*************************************/\n/*! exports provided: RenderingGroup */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return RenderingGroup; });\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n/**\r\n * This represents the object necessary to create a rendering group.\r\n * This is exclusively used and created by the rendering manager.\r\n * To modify the behavior, you use the available helpers in your scene or meshes.\r\n * @hidden\r\n */\r\nvar RenderingGroup = /** @class */ (function () {\r\n /**\r\n * Creates a new rendering group.\r\n * @param index The rendering group index\r\n * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied\r\n * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied\r\n * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied\r\n */\r\n function RenderingGroup(index, scene, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this.index = index;\r\n this._opaqueSubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._transparentSubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._alphaTestSubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._depthOnlySubMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._particleSystems = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n this._spriteManagers = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](256);\r\n /** @hidden */\r\n this._edgesRenderers = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_0__[\"SmartArray\"](16);\r\n this._scene = scene;\r\n this.opaqueSortCompareFn = opaqueSortCompareFn;\r\n this.alphaTestSortCompareFn = alphaTestSortCompareFn;\r\n this.transparentSortCompareFn = transparentSortCompareFn;\r\n }\r\n Object.defineProperty(RenderingGroup.prototype, \"opaqueSortCompareFn\", {\r\n /**\r\n * Set the opaque sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._opaqueSortCompareFn = value;\r\n if (value) {\r\n this._renderOpaque = this.renderOpaqueSorted;\r\n }\r\n else {\r\n this._renderOpaque = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"alphaTestSortCompareFn\", {\r\n /**\r\n * Set the alpha test sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._alphaTestSortCompareFn = value;\r\n if (value) {\r\n this._renderAlphaTest = this.renderAlphaTestSorted;\r\n }\r\n else {\r\n this._renderAlphaTest = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"transparentSortCompareFn\", {\r\n /**\r\n * Set the transparent sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this._transparentSortCompareFn = value;\r\n }\r\n else {\r\n this._transparentSortCompareFn = RenderingGroup.defaultTransparentSortCompare;\r\n }\r\n this._renderTransparent = this.renderTransparentSorted;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Render all the sub meshes contained in the group.\r\n * @param customRenderFunction Used to override the default render behaviour of the group.\r\n * @returns true if rendered some submeshes.\r\n */\r\n RenderingGroup.prototype.render = function (customRenderFunction, renderSprites, renderParticles, activeMeshes) {\r\n if (customRenderFunction) {\r\n customRenderFunction(this._opaqueSubMeshes, this._alphaTestSubMeshes, this._transparentSubMeshes, this._depthOnlySubMeshes);\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n // Depth only\r\n if (this._depthOnlySubMeshes.length !== 0) {\r\n engine.setColorWrite(false);\r\n this._renderAlphaTest(this._depthOnlySubMeshes);\r\n engine.setColorWrite(true);\r\n }\r\n // Opaque\r\n if (this._opaqueSubMeshes.length !== 0) {\r\n this._renderOpaque(this._opaqueSubMeshes);\r\n }\r\n // Alpha test\r\n if (this._alphaTestSubMeshes.length !== 0) {\r\n this._renderAlphaTest(this._alphaTestSubMeshes);\r\n }\r\n var stencilState = engine.getStencilBuffer();\r\n engine.setStencilBuffer(false);\r\n // Sprites\r\n if (renderSprites) {\r\n this._renderSprites();\r\n }\r\n // Particles\r\n if (renderParticles) {\r\n this._renderParticles(activeMeshes);\r\n }\r\n if (this.onBeforeTransparentRendering) {\r\n this.onBeforeTransparentRendering();\r\n }\r\n // Transparent\r\n if (this._transparentSubMeshes.length !== 0) {\r\n this._renderTransparent(this._transparentSubMeshes);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // Set back stencil to false in case it changes before the edge renderer.\r\n engine.setStencilBuffer(false);\r\n // Edges\r\n if (this._edgesRenderers.length) {\r\n for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {\r\n this._edgesRenderers.data[edgesRendererIndex].render();\r\n }\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n }\r\n // Restore Stencil state.\r\n engine.setStencilBuffer(stencilState);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the opaqueSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderOpaqueSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._opaqueSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the alphatestSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderAlphaTestSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._alphaTestSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the transparentSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderTransparentSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._transparentSortCompareFn, this._scene.activeCamera, true);\r\n };\r\n /**\r\n * Renders the submeshes in a specified order.\r\n * @param subMeshes The submeshes to sort before render\r\n * @param sortCompareFn The comparison function use to sort\r\n * @param cameraPosition The camera position use to preprocess the submeshes to help sorting\r\n * @param transparent Specifies to activate blending if true\r\n */\r\n RenderingGroup.renderSorted = function (subMeshes, sortCompareFn, camera, transparent) {\r\n var subIndex = 0;\r\n var subMesh;\r\n var cameraPosition = camera ? camera.globalPosition : RenderingGroup._zeroVector;\r\n for (; subIndex < subMeshes.length; subIndex++) {\r\n subMesh = subMeshes.data[subIndex];\r\n subMesh._alphaIndex = subMesh.getMesh().alphaIndex;\r\n subMesh._distanceToCamera = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Distance(subMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\r\n }\r\n var sortedArray = subMeshes.data.slice(0, subMeshes.length);\r\n if (sortCompareFn) {\r\n sortedArray.sort(sortCompareFn);\r\n }\r\n for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {\r\n subMesh = sortedArray[subIndex];\r\n if (transparent) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.needDepthPrePass) {\r\n var engine = material.getScene().getEngine();\r\n engine.setColorWrite(false);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_2__[\"Constants\"].ALPHA_DISABLE);\r\n subMesh.render(false);\r\n engine.setColorWrite(true);\r\n }\r\n }\r\n subMesh.render(transparent);\r\n }\r\n };\r\n /**\r\n * Renders the submeshes in the order they were dispatched (no sort applied).\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.renderUnsorted = function (subMeshes) {\r\n for (var subIndex = 0; subIndex < subMeshes.length; subIndex++) {\r\n var submesh = subMeshes.data[subIndex];\r\n submesh.render(false);\r\n }\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front if in the same alpha index.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.defaultTransparentSortCompare = function (a, b) {\r\n // Alpha index first\r\n if (a._alphaIndex > b._alphaIndex) {\r\n return 1;\r\n }\r\n if (a._alphaIndex < b._alphaIndex) {\r\n return -1;\r\n }\r\n // Then distance to camera\r\n return RenderingGroup.backToFrontSortCompare(a, b);\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.backToFrontSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return 1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return -1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered front to back (prevent overdraw).\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.frontToBackSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return -1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return 1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Resets the different lists of submeshes to prepare a new frame.\r\n */\r\n RenderingGroup.prototype.prepare = function () {\r\n this._opaqueSubMeshes.reset();\r\n this._transparentSubMeshes.reset();\r\n this._alphaTestSubMeshes.reset();\r\n this._depthOnlySubMeshes.reset();\r\n this._particleSystems.reset();\r\n this._spriteManagers.reset();\r\n this._edgesRenderers.reset();\r\n };\r\n RenderingGroup.prototype.dispose = function () {\r\n this._opaqueSubMeshes.dispose();\r\n this._transparentSubMeshes.dispose();\r\n this._alphaTestSubMeshes.dispose();\r\n this._depthOnlySubMeshes.dispose();\r\n this._particleSystems.dispose();\r\n this._spriteManagers.dispose();\r\n this._edgesRenderers.dispose();\r\n };\r\n /**\r\n * Inserts the submesh in its correct queue depending on its material.\r\n * @param subMesh The submesh to dispatch\r\n * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingGroup.prototype.dispatch = function (subMesh, mesh, material) {\r\n // Get mesh and materials if not provided\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n if (material === undefined) {\r\n material = subMesh.getMaterial();\r\n }\r\n if (material === null || material === undefined) {\r\n return;\r\n }\r\n if (material.needAlphaBlendingForMesh(mesh)) { // Transparent\r\n this._transparentSubMeshes.push(subMesh);\r\n }\r\n else if (material.needAlphaTesting()) { // Alpha test\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._alphaTestSubMeshes.push(subMesh);\r\n }\r\n else {\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._opaqueSubMeshes.push(subMesh); // Opaque\r\n }\r\n mesh._renderingGroup = this;\r\n if (mesh._edgesRenderer && mesh._edgesRenderer.isEnabled) {\r\n this._edgesRenderers.push(mesh._edgesRenderer);\r\n }\r\n };\r\n RenderingGroup.prototype.dispatchSprites = function (spriteManager) {\r\n this._spriteManagers.push(spriteManager);\r\n };\r\n RenderingGroup.prototype.dispatchParticles = function (particleSystem) {\r\n this._particleSystems.push(particleSystem);\r\n };\r\n RenderingGroup.prototype._renderParticles = function (activeMeshes) {\r\n if (this._particleSystems.length === 0) {\r\n return;\r\n }\r\n // Particles\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);\r\n for (var particleIndex = 0; particleIndex < this._particleSystems.length; particleIndex++) {\r\n var particleSystem = this._particleSystems.data[particleIndex];\r\n if ((activeCamera && activeCamera.layerMask & particleSystem.layerMask) === 0) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || !activeMeshes || activeMeshes.indexOf(emitter) !== -1) {\r\n this._scene._activeParticles.addCount(particleSystem.render(), false);\r\n }\r\n }\r\n this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup.prototype._renderSprites = function () {\r\n if (!this._scene.spritesEnabled || this._spriteManagers.length === 0) {\r\n return;\r\n }\r\n // Sprites\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);\r\n for (var id = 0; id < this._spriteManagers.length; id++) {\r\n var spriteManager = this._spriteManagers.data[id];\r\n if (((activeCamera && activeCamera.layerMask & spriteManager.layerMask) !== 0)) {\r\n spriteManager.render();\r\n }\r\n }\r\n this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup._zeroVector = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].Zero();\r\n return RenderingGroup;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/renderingManager.ts\":\n/*!***************************************!*\\\n !*** ./Rendering/renderingManager.ts ***!\n \\***************************************/\n/*! exports provided: RenderingGroupInfo, RenderingManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return RenderingGroupInfo; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return RenderingManager; });\n/* harmony import */ var _renderingGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./renderingGroup */ \"./Rendering/renderingGroup.ts\");\n\r\n/**\r\n * This class is used by the onRenderingGroupObservable\r\n */\r\nvar RenderingGroupInfo = /** @class */ (function () {\r\n function RenderingGroupInfo() {\r\n }\r\n return RenderingGroupInfo;\r\n}());\r\n\r\n/**\r\n * This is the manager responsible of all the rendering for meshes sprites and particles.\r\n * It is enable to manage the different groups as well as the different necessary sort functions.\r\n * This should not be used directly aside of the few static configurations\r\n */\r\nvar RenderingManager = /** @class */ (function () {\r\n /**\r\n * Instantiates a new rendering group for a particular scene\r\n * @param scene Defines the scene the groups belongs to\r\n */\r\n function RenderingManager(scene) {\r\n /**\r\n * @hidden\r\n */\r\n this._useSceneAutoClearSetup = false;\r\n this._renderingGroups = new Array();\r\n this._autoClearDepthStencil = {};\r\n this._customOpaqueSortCompareFn = {};\r\n this._customAlphaTestSortCompareFn = {};\r\n this._customTransparentSortCompareFn = {};\r\n this._renderingGroupInfo = new RenderingGroupInfo();\r\n this._scene = scene;\r\n for (var i = RenderingManager.MIN_RENDERINGGROUPS; i < RenderingManager.MAX_RENDERINGGROUPS; i++) {\r\n this._autoClearDepthStencil[i] = { autoClear: true, depth: true, stencil: true };\r\n }\r\n }\r\n RenderingManager.prototype._clearDepthStencilBuffer = function (depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n if (this._depthStencilBufferAlreadyCleaned) {\r\n return;\r\n }\r\n this._scene.getEngine().clear(null, false, depth, stencil);\r\n this._depthStencilBufferAlreadyCleaned = true;\r\n };\r\n /**\r\n * Renders the entire managed groups. This is used by the scene or the different rennder targets.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.render = function (customRenderFunction, activeMeshes, renderParticles, renderSprites) {\r\n // Update the observable context (not null as it only goes away on dispose)\r\n var info = this._renderingGroupInfo;\r\n info.scene = this._scene;\r\n info.camera = this._scene.activeCamera;\r\n // Dispatch sprites\r\n if (this._scene.spriteManagers && renderSprites) {\r\n for (var index = 0; index < this._scene.spriteManagers.length; index++) {\r\n var manager = this._scene.spriteManagers[index];\r\n this.dispatchSprites(manager);\r\n }\r\n }\r\n // Render\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n this._depthStencilBufferAlreadyCleaned = index === RenderingManager.MIN_RENDERINGGROUPS;\r\n var renderingGroup = this._renderingGroups[index];\r\n if (!renderingGroup) {\r\n continue;\r\n }\r\n var renderingGroupMask = Math.pow(2, index);\r\n info.renderingGroupId = index;\r\n // Before Observable\r\n this._scene.onBeforeRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n // Clear depth/stencil if needed\r\n if (RenderingManager.AUTOCLEAR) {\r\n var autoClear = this._useSceneAutoClearSetup ?\r\n this._scene.getAutoClearDepthStencilSetup(index) :\r\n this._autoClearDepthStencil[index];\r\n if (autoClear && autoClear.autoClear) {\r\n this._clearDepthStencilBuffer(autoClear.depth, autoClear.stencil);\r\n }\r\n }\r\n // Render\r\n for (var _i = 0, _a = this._scene._beforeRenderingGroupDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(index);\r\n }\r\n renderingGroup.render(customRenderFunction, renderSprites, renderParticles, activeMeshes);\r\n for (var _b = 0, _c = this._scene._afterRenderingGroupDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(index);\r\n }\r\n // After Observable\r\n this._scene.onAfterRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n }\r\n };\r\n /**\r\n * Resets the different information of the group to prepare a new frame\r\n * @hidden\r\n */\r\n RenderingManager.prototype.reset = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepare();\r\n }\r\n }\r\n };\r\n /**\r\n * Dispose and release the group and its associated resources.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.dispose = function () {\r\n this.freeRenderingGroups();\r\n this._renderingGroups.length = 0;\r\n this._renderingGroupInfo = null;\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n RenderingManager.prototype.freeRenderingGroups = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.dispose();\r\n }\r\n }\r\n };\r\n RenderingManager.prototype._prepareRenderingGroup = function (renderingGroupId) {\r\n if (this._renderingGroups[renderingGroupId] === undefined) {\r\n this._renderingGroups[renderingGroupId] = new _renderingGroup__WEBPACK_IMPORTED_MODULE_0__[\"RenderingGroup\"](renderingGroupId, this._scene, this._customOpaqueSortCompareFn[renderingGroupId], this._customAlphaTestSortCompareFn[renderingGroupId], this._customTransparentSortCompareFn[renderingGroupId]);\r\n }\r\n };\r\n /**\r\n * Add a sprite manager to the rendering manager in order to render it this frame.\r\n * @param spriteManager Define the sprite manager to render\r\n */\r\n RenderingManager.prototype.dispatchSprites = function (spriteManager) {\r\n var renderingGroupId = spriteManager.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchSprites(spriteManager);\r\n };\r\n /**\r\n * Add a particle system to the rendering manager in order to render it this frame.\r\n * @param particleSystem Define the particle system to render\r\n */\r\n RenderingManager.prototype.dispatchParticles = function (particleSystem) {\r\n var renderingGroupId = particleSystem.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchParticles(particleSystem);\r\n };\r\n /**\r\n * Add a submesh to the manager in order to render it this frame\r\n * @param subMesh The submesh to dispatch\r\n * @param mesh Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param material Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingManager.prototype.dispatch = function (subMesh, mesh, material) {\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n var renderingGroupId = mesh.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatch(subMesh, mesh, material);\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderingManager.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._customOpaqueSortCompareFn[renderingGroupId] = opaqueSortCompareFn;\r\n this._customAlphaTestSortCompareFn[renderingGroupId] = alphaTestSortCompareFn;\r\n this._customTransparentSortCompareFn[renderingGroupId] = transparentSortCompareFn;\r\n if (this._renderingGroups[renderingGroupId]) {\r\n var group = this._renderingGroups[renderingGroupId];\r\n group.opaqueSortCompareFn = this._customOpaqueSortCompareFn[renderingGroupId];\r\n group.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[renderingGroupId];\r\n group.transparentSortCompareFn = this._customTransparentSortCompareFn[renderingGroupId];\r\n }\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n RenderingManager.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._autoClearDepthStencil[renderingGroupId] = {\r\n autoClear: autoClearDepthStencil,\r\n depth: depth,\r\n stencil: stencil\r\n };\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n RenderingManager.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._autoClearDepthStencil[index];\r\n };\r\n /**\r\n * The max id used for rendering groups (not included)\r\n */\r\n RenderingManager.MAX_RENDERINGGROUPS = 4;\r\n /**\r\n * The min id used for rendering groups (included)\r\n */\r\n RenderingManager.MIN_RENDERINGGROUPS = 0;\r\n /**\r\n * Used to globally prevent autoclearing scenes.\r\n */\r\n RenderingManager.AUTOCLEAR = true;\r\n return RenderingManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Rendering/utilityLayerRenderer.ts\":\n/*!*******************************************!*\\\n !*** ./Rendering/utilityLayerRenderer.ts ***!\n \\*******************************************/\n/*! exports provided: UtilityLayerRenderer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return UtilityLayerRenderer; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Events/pointerEvents */ \"./Events/pointerEvents.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Lights/hemisphericLight */ \"./Lights/hemisphericLight.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Renders a layer on top of an existing scene\r\n */\r\nvar UtilityLayerRenderer = /** @class */ (function () {\r\n /**\r\n * Instantiates a UtilityLayerRenderer\r\n * @param originalScene the original scene that will be rendered on top of\r\n * @param handleEvents boolean indicating if the utility layer should handle events\r\n */\r\n function UtilityLayerRenderer(\r\n /** the original scene that will be rendered on top of */\r\n originalScene, handleEvents) {\r\n var _this = this;\r\n if (handleEvents === void 0) { handleEvents = true; }\r\n this.originalScene = originalScene;\r\n this._pointerCaptures = {};\r\n this._lastPointerEvents = {};\r\n this._sharedGizmoLight = null;\r\n this._renderCamera = null;\r\n /**\r\n * If the picking should be done on the utility layer prior to the actual scene (Default: true)\r\n */\r\n this.pickUtilitySceneFirst = true;\r\n /**\r\n * If the utility layer should automatically be rendered on top of existing scene\r\n */\r\n this.shouldRender = true;\r\n /**\r\n * If set to true, only pointer down onPointerObservable events will be blocked when picking is occluded by original scene\r\n */\r\n this.onlyCheckPointerDownEvents = true;\r\n /**\r\n * If set to false, only pointerUp, pointerDown and pointerMove will be sent to the utilityLayerScene (false by default)\r\n */\r\n this.processAllEvents = false;\r\n /**\r\n * Observable raised when the pointer move from the utility layer scene to the main scene\r\n */\r\n this.onPointerOutObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n // Create scene which will be rendered in the foreground and remove it from being referenced by engine to avoid interfering with existing app\r\n this.utilityLayerScene = new _scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"](originalScene.getEngine(), { virtual: true });\r\n this.utilityLayerScene.useRightHandedSystem = originalScene.useRightHandedSystem;\r\n this.utilityLayerScene._allowPostProcessClearColor = false;\r\n // Detach controls on utility scene, events will be fired by logic below to handle picking priority\r\n this.utilityLayerScene.detachControl();\r\n if (handleEvents) {\r\n this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {\r\n if (!_this.utilityLayerScene.activeCamera) {\r\n return;\r\n }\r\n if (!_this.processAllEvents) {\r\n if (prePointerInfo.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERMOVE\r\n && prePointerInfo.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP\r\n && prePointerInfo.type !== _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n return;\r\n }\r\n }\r\n _this.utilityLayerScene.pointerX = originalScene.pointerX;\r\n _this.utilityLayerScene.pointerY = originalScene.pointerY;\r\n var pointerEvent = (prePointerInfo.event);\r\n if (originalScene.isPointerCaptured(pointerEvent.pointerId)) {\r\n _this._pointerCaptures[pointerEvent.pointerId] = false;\r\n return;\r\n }\r\n var utilityScenePick = prePointerInfo.ray ? _this.utilityLayerScene.pickWithRay(prePointerInfo.ray) : _this.utilityLayerScene.pick(originalScene.pointerX, originalScene.pointerY);\r\n if (!prePointerInfo.ray && utilityScenePick) {\r\n prePointerInfo.ray = utilityScenePick.ray;\r\n }\r\n // always fire the prepointer oversvable\r\n _this.utilityLayerScene.onPrePointerObservable.notifyObservers(prePointerInfo);\r\n // allow every non pointer down event to flow to the utility layer\r\n if (_this.onlyCheckPointerDownEvents && prePointerInfo.type != _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerInfo\"](prePointerInfo.type, prePointerInfo.event, utilityScenePick));\r\n }\r\n if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP && _this._pointerCaptures[pointerEvent.pointerId]) {\r\n _this._pointerCaptures[pointerEvent.pointerId] = false;\r\n }\r\n return;\r\n }\r\n if (_this.utilityLayerScene.autoClearDepthAndStencil || _this.pickUtilitySceneFirst) {\r\n // If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene\r\n if (utilityScenePick && utilityScenePick.hit) {\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerInfo\"](prePointerInfo.type, prePointerInfo.event, utilityScenePick));\r\n }\r\n prePointerInfo.skipOnPointerObservable = true;\r\n }\r\n }\r\n else {\r\n var originalScenePick = prePointerInfo.ray ? originalScene.pickWithRay(prePointerInfo.ray) : originalScene.pick(originalScene.pointerX, originalScene.pointerY);\r\n var pointerEvent_1 = (prePointerInfo.event);\r\n // If the layer can be occluded by the original scene, only fire pointer events to the first layer that hit they ray\r\n if (originalScenePick && utilityScenePick) {\r\n // No pick in utility scene\r\n if (utilityScenePick.distance === 0 && originalScenePick.pickedMesh) {\r\n if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {\r\n // We touched an utility mesh present in the main scene\r\n _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);\r\n prePointerInfo.skipOnPointerObservable = true;\r\n }\r\n else if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERDOWN) {\r\n _this._pointerCaptures[pointerEvent_1.pointerId] = true;\r\n }\r\n else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {\r\n // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete\r\n _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);\r\n delete _this._lastPointerEvents[pointerEvent_1.pointerId];\r\n }\r\n }\r\n else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance < originalScenePick.distance || originalScenePick.distance === 0)) {\r\n // We pick something in utility scene or the pick in utility is closer than the one in main scene\r\n _this._notifyObservers(prePointerInfo, utilityScenePick, pointerEvent_1);\r\n // If a previous utility layer set this, do not unset this\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n prePointerInfo.skipOnPointerObservable = utilityScenePick.distance > 0;\r\n }\r\n }\r\n else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance > originalScenePick.distance)) {\r\n // We have a pick in both scenes but main is closer than utility\r\n // We touched an utility mesh present in the main scene\r\n if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {\r\n _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);\r\n prePointerInfo.skipOnPointerObservable = true;\r\n }\r\n else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {\r\n // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete\r\n _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);\r\n delete _this._lastPointerEvents[pointerEvent_1.pointerId];\r\n }\r\n }\r\n if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerEventTypes\"].POINTERUP && _this._pointerCaptures[pointerEvent_1.pointerId]) {\r\n _this._pointerCaptures[pointerEvent_1.pointerId] = false;\r\n }\r\n }\r\n }\r\n });\r\n // As a newly added utility layer will be rendered over the screen last, it's pointer events should be processed first\r\n if (this._originalPointerObserver) {\r\n originalScene.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver);\r\n }\r\n }\r\n // Render directly on top of existing scene without clearing\r\n this.utilityLayerScene.autoClear = false;\r\n this._afterRenderObserver = this.originalScene.onAfterCameraRenderObservable.add(function (camera) {\r\n // Only render when the render camera finishes rendering\r\n if (_this.shouldRender && camera == _this.getRenderCamera()) {\r\n _this.render();\r\n }\r\n });\r\n this._sceneDisposeObserver = this.originalScene.onDisposeObservable.add(function () {\r\n _this.dispose();\r\n });\r\n this._updateCamera();\r\n }\r\n /**\r\n * Gets the camera that is used to render the utility layer (when not set, this will be the last active camera)\r\n * @returns the camera that is used when rendering the utility layer\r\n */\r\n UtilityLayerRenderer.prototype.getRenderCamera = function () {\r\n if (this._renderCamera) {\r\n return this._renderCamera;\r\n }\r\n else if (this.originalScene.activeCameras.length > 1) {\r\n return this.originalScene.activeCameras[this.originalScene.activeCameras.length - 1];\r\n }\r\n else {\r\n return this.originalScene.activeCamera;\r\n }\r\n };\r\n /**\r\n * Sets the camera that should be used when rendering the utility layer (If set to null the last active camera will be used)\r\n * @param cam the camera that should be used when rendering the utility layer\r\n */\r\n UtilityLayerRenderer.prototype.setRenderCamera = function (cam) {\r\n this._renderCamera = cam;\r\n };\r\n /**\r\n * @hidden\r\n * Light which used by gizmos to get light shading\r\n */\r\n UtilityLayerRenderer.prototype._getSharedGizmoLight = function () {\r\n if (!this._sharedGizmoLight) {\r\n this._sharedGizmoLight = new _Lights_hemisphericLight__WEBPACK_IMPORTED_MODULE_4__[\"HemisphericLight\"](\"shared gizmo light\", new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_5__[\"Vector3\"](0, 1, 0), this.utilityLayerScene);\r\n this._sharedGizmoLight.intensity = 2;\r\n this._sharedGizmoLight.groundColor = _Maths_math_color__WEBPACK_IMPORTED_MODULE_6__[\"Color3\"].Gray();\r\n }\r\n return this._sharedGizmoLight;\r\n };\r\n Object.defineProperty(UtilityLayerRenderer, \"DefaultUtilityLayer\", {\r\n /**\r\n * A shared utility layer that can be used to overlay objects into a scene (Depth map of the previous scene is cleared before drawing on top of it)\r\n */\r\n get: function () {\r\n if (UtilityLayerRenderer._DefaultUtilityLayer == null) {\r\n UtilityLayerRenderer._DefaultUtilityLayer = new UtilityLayerRenderer(_Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene);\r\n UtilityLayerRenderer._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(function () {\r\n UtilityLayerRenderer._DefaultUtilityLayer = null;\r\n });\r\n }\r\n return UtilityLayerRenderer._DefaultUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UtilityLayerRenderer, \"DefaultKeepDepthUtilityLayer\", {\r\n /**\r\n * A shared utility layer that can be used to embed objects into a scene (Depth map of the previous scene is not cleared before drawing on top of it)\r\n */\r\n get: function () {\r\n if (UtilityLayerRenderer._DefaultKeepDepthUtilityLayer == null) {\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = new UtilityLayerRenderer(_Engines_engineStore__WEBPACK_IMPORTED_MODULE_3__[\"EngineStore\"].LastCreatedScene);\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil = false;\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function () {\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;\r\n });\r\n }\r\n return UtilityLayerRenderer._DefaultKeepDepthUtilityLayer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n UtilityLayerRenderer.prototype._notifyObservers = function (prePointerInfo, pickInfo, pointerEvent) {\r\n if (!prePointerInfo.skipOnPointerObservable) {\r\n this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__[\"PointerInfo\"](prePointerInfo.type, prePointerInfo.event, pickInfo));\r\n this._lastPointerEvents[pointerEvent.pointerId] = true;\r\n }\r\n };\r\n /**\r\n * Renders the utility layers scene on top of the original scene\r\n */\r\n UtilityLayerRenderer.prototype.render = function () {\r\n this._updateCamera();\r\n if (this.utilityLayerScene.activeCamera) {\r\n // Set the camera's scene to utility layers scene\r\n var oldScene = this.utilityLayerScene.activeCamera.getScene();\r\n var camera = this.utilityLayerScene.activeCamera;\r\n camera._scene = this.utilityLayerScene;\r\n if (camera.leftCamera) {\r\n camera.leftCamera._scene = this.utilityLayerScene;\r\n }\r\n if (camera.rightCamera) {\r\n camera.rightCamera._scene = this.utilityLayerScene;\r\n }\r\n this.utilityLayerScene.render(false);\r\n // Reset camera's scene back to original\r\n camera._scene = oldScene;\r\n if (camera.leftCamera) {\r\n camera.leftCamera._scene = oldScene;\r\n }\r\n if (camera.rightCamera) {\r\n camera.rightCamera._scene = oldScene;\r\n }\r\n }\r\n };\r\n /**\r\n * Disposes of the renderer\r\n */\r\n UtilityLayerRenderer.prototype.dispose = function () {\r\n this.onPointerOutObservable.clear();\r\n if (this._afterRenderObserver) {\r\n this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver);\r\n }\r\n if (this._sceneDisposeObserver) {\r\n this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n }\r\n if (this._originalPointerObserver) {\r\n this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver);\r\n }\r\n this.utilityLayerScene.dispose();\r\n };\r\n UtilityLayerRenderer.prototype._updateCamera = function () {\r\n this.utilityLayerScene.cameraToUseForPointers = this.getRenderCamera();\r\n this.utilityLayerScene.activeCamera = this.getRenderCamera();\r\n };\r\n UtilityLayerRenderer._DefaultUtilityLayer = null;\r\n UtilityLayerRenderer._DefaultKeepDepthUtilityLayer = null;\r\n return UtilityLayerRenderer;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/backgroundFragmentDeclaration.ts\":\n/*!*****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/backgroundFragmentDeclaration.ts ***!\n \\*****************************************************************/\n/*! exports provided: backgroundFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundFragmentDeclaration\", function() { return backgroundFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'backgroundFragmentDeclaration';\r\nvar shader = \" uniform vec4 vPrimaryColor;\\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\\nuniform vec4 vPrimaryColorShadow;\\n#endif\\nuniform float shadowLevel;\\nuniform float alpha;\\n#ifdef DIFFUSE\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\n#endif\\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\\nuniform vec3 vBackgroundCenter;\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nuniform vec4 vReflectionControl;\\n#endif\\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\\nuniform mat4 view;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/backgroundUboDeclaration.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/backgroundUboDeclaration.ts ***!\n \\************************************************************/\n/*! exports provided: backgroundUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundUboDeclaration\", function() { return backgroundUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'backgroundUboDeclaration';\r\nvar shader = \"layout(std140,column_major) uniform;\\nuniform Material\\n{\\nuniform vec4 vPrimaryColor;\\nuniform vec4 vPrimaryColorShadow;\\nuniform vec2 vDiffuseInfos;\\nuniform vec2 vReflectionInfos;\\nuniform mat4 diffuseMatrix;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\nuniform float fFovMultiplier;\\nuniform float pointSize;\\nuniform float shadowLevel;\\nuniform float alpha;\\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\\nuniform vec3 vBackgroundCenter;\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nuniform vec4 vReflectionControl;\\n#endif\\n};\\nuniform Scene {\\nmat4 viewProjection;\\n#ifdef MULTIVIEW\\nmat4 viewProjectionR;\\n#endif\\nmat4 view;\\n};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/backgroundVertexDeclaration.ts\":\n/*!***************************************************************!*\\\n !*** ./Shaders/ShadersInclude/backgroundVertexDeclaration.ts ***!\n \\***************************************************************/\n/*! exports provided: backgroundVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundVertexDeclaration\", function() { return backgroundVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'backgroundVertexDeclaration';\r\nvar shader = \"uniform mat4 view;\\nuniform mat4 viewProjection;\\nuniform float shadowLevel;\\n#ifdef DIFFUSE\\nuniform mat4 diffuseMatrix;\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\nuniform float fFovMultiplier;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bonesDeclaration.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/bonesDeclaration.ts ***!\n \\****************************************************/\n/*! exports provided: bonesDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bonesDeclaration\", function() { return bonesDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bonesDeclaration';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\n#ifdef BONETEXTURE\\nuniform sampler2D boneSampler;\\nuniform float boneTextureWidth;\\n#else\\nuniform mat4 mBones[BonesPerMesh];\\n#endif\\nattribute vec4 matricesIndices;\\nattribute vec4 matricesWeights;\\n#if NUM_BONE_INFLUENCERS>4\\nattribute vec4 matricesIndicesExtra;\\nattribute vec4 matricesWeightsExtra;\\n#endif\\n#ifdef BONETEXTURE\\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\\n{\\nfloat offset=index*4.0;\\nfloat dx=1.0/boneTextureWidth;\\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\\nreturn mat4(m0,m1,m2,m3);\\n}\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bonesDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bonesVertex.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/ShadersInclude/bonesVertex.ts ***!\n \\***********************************************/\n/*! exports provided: bonesVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bonesVertex\", function() { return bonesVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bonesVertex';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\nmat4 influence;\\n#ifdef BONETEXTURE\\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\\n#endif\\n#else\\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\n#endif\\nfinalWorld=finalWorld*influence;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bonesVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpFragment.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpFragment.ts ***!\n \\************************************************/\n/*! exports provided: bumpFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpFragment\", function() { return bumpFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpFragment';\r\nvar shader = \"vec2 uvOffset=vec2(0.0,0.0);\\n#if defined(BUMP) || defined(PARALLAX)\\n#ifdef NORMALXYSCALE\\nfloat normalScale=1.0;\\n#else\\nfloat normalScale=vBumpInfos.y;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#else\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\\n#endif\\n#elif defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#else\\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\\n#endif\\n#endif\\n#ifdef PARALLAX\\nmat3 invTBN=transposeMat3(TBN);\\n#ifdef PARALLAXOCCLUSION\\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\\n#else\\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\\n#endif\\n#endif\\n#ifdef BUMP\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\\nnormalW=normalize(mat3(normalMatrix)*normalW);\\n#else\\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpFragmentFunctions.ts\":\n/*!*********************************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpFragmentFunctions.ts ***!\n \\*********************************************************/\n/*! exports provided: bumpFragmentFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpFragmentFunctions\", function() { return bumpFragmentFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpFragmentFunctions';\r\nvar shader = \"#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nuniform mat4 normalMatrix;\\n#endif\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\\n{\\ntextureSample=textureSample*2.0-1.0;\\n#ifdef NORMALXYSCALE\\ntextureSample=normalize(textureSample*vec3(scale,scale,1.0));\\n#endif\\nreturn normalize(cotangentFrame*textureSample);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\\n{\\n\\nuv=gl_FrontFacing ? uv : -uv;\\n\\nvec3 dp1=dFdx(p);\\nvec3 dp2=dFdy(p);\\nvec2 duv1=dFdx(uv);\\nvec2 duv2=dFdy(uv);\\n\\nvec3 dp2perp=cross(dp2,normal);\\nvec3 dp1perp=cross(normal,dp1);\\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\\n\\ntangent*=tangentSpaceParams.x;\\nbitangent*=tangentSpaceParams.y;\\n\\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\\n}\\n#endif\\n#ifdef BUMP\\n#if BUMPDIRECTUV == 1\\n#define vBumpUV vMainUV1\\n#elif BUMPDIRECTUV == 2\\n#define vBumpUV vMainUV2\\n#else\\nvarying vec2 vBumpUV;\\n#endif\\nuniform sampler2D bumpSampler;\\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\\n{\\nreturn perturbNormal(cotangentFrame,texture2D(bumpSampler,uv).xyz,vBumpInfos.y);\\n}\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 color)\\n{\\nreturn perturbNormal(cotangentFrame,color,vBumpInfos.y);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\\n{\\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\\n}\\n#endif\\n#if defined(BUMP) && defined(PARALLAX)\\nconst float minSamples=4.;\\nconst float maxSamples=15.;\\nconst int iMaxSamples=15;\\n\\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\\nparallaxLimit*=parallaxScale;\\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\\nfloat stepSize=1.0/numSamples;\\n\\nfloat currRayHeight=1.0;\\nvec2 vCurrOffset=vec2(0,0);\\nvec2 vLastOffset=vec2(0,0);\\nfloat lastSampledHeight=1.0;\\nfloat currSampledHeight=1.0;\\nfor (int i=0; icurrRayHeight)\\n{\\nfloat delta1=currSampledHeight-currRayHeight;\\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\\nfloat ratio=delta1/(delta1+delta2);\\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\\n\\nbreak;\\n}\\nelse\\n{\\ncurrRayHeight-=stepSize;\\nvLastOffset=vCurrOffset;\\nvCurrOffset+=stepSize*vMaxOffset;\\nlastSampledHeight=currSampledHeight;\\n}\\n}\\nreturn vCurrOffset;\\n}\\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\\n{\\n\\nfloat height=texture2D(bumpSampler,vBumpUV).w;\\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\\nreturn -texCoordOffset;\\n}\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpFragmentFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpVertex.ts\":\n/*!**********************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpVertex.ts ***!\n \\**********************************************/\n/*! exports provided: bumpVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpVertex\", function() { return bumpVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpVertex';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP)\\n#if defined(TANGENT) && defined(NORMAL)\\nvec3 tbnNormal=normalize(normalUpdated);\\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/bumpVertexDeclaration.ts\":\n/*!*********************************************************!*\\\n !*** ./Shaders/ShadersInclude/bumpVertexDeclaration.ts ***!\n \\*********************************************************/\n/*! exports provided: bumpVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bumpVertexDeclaration\", function() { return bumpVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bumpVertexDeclaration';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bumpVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\":\n/*!*****************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneFragment.ts ***!\n \\*****************************************************/\n/*! exports provided: clipPlaneFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneFragment\", function() { return clipPlaneFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneFragment';\r\nvar shader = \"#ifdef CLIPPLANE\\nif (fClipDistance>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE2\\nif (fClipDistance2>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE3\\nif (fClipDistance3>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE4\\nif (fClipDistance4>0.0)\\n{\\ndiscard;\\n}\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\":\n/*!****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts ***!\n \\****************************************************************/\n/*! exports provided: clipPlaneFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneFragmentDeclaration\", function() { return clipPlaneFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneFragmentDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nvarying float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration2.ts\":\n/*!*****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneFragmentDeclaration2.ts ***!\n \\*****************************************************************/\n/*! exports provided: clipPlaneFragmentDeclaration2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneFragmentDeclaration2\", function() { return clipPlaneFragmentDeclaration2; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneFragmentDeclaration2';\r\nvar shader = \"#ifdef CLIPPLANE\\nin float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nin float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nin float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nin float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneFragmentDeclaration2 = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneVertex.ts ***!\n \\***************************************************/\n/*! exports provided: clipPlaneVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneVertex\", function() { return clipPlaneVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneVertex';\r\nvar shader = \"#ifdef CLIPPLANE\\nfClipDistance=dot(worldPos,vClipPlane);\\n#endif\\n#ifdef CLIPPLANE2\\nfClipDistance2=dot(worldPos,vClipPlane2);\\n#endif\\n#ifdef CLIPPLANE3\\nfClipDistance3=dot(worldPos,vClipPlane3);\\n#endif\\n#ifdef CLIPPLANE4\\nfClipDistance4=dot(worldPos,vClipPlane4);\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts ***!\n \\**************************************************************/\n/*! exports provided: clipPlaneVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneVertexDeclaration\", function() { return clipPlaneVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneVertexDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nvarying float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration2.ts\":\n/*!***************************************************************!*\\\n !*** ./Shaders/ShadersInclude/clipPlaneVertexDeclaration2.ts ***!\n \\***************************************************************/\n/*! exports provided: clipPlaneVertexDeclaration2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"clipPlaneVertexDeclaration2\", function() { return clipPlaneVertexDeclaration2; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'clipPlaneVertexDeclaration2';\r\nvar shader = \"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nout float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nout float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nout float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nout float fClipDistance4;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar clipPlaneVertexDeclaration2 = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/defaultFragmentDeclaration.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/defaultFragmentDeclaration.ts ***!\n \\**************************************************************/\n/*! exports provided: defaultFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultFragmentDeclaration\", function() { return defaultFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'defaultFragmentDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/defaultUboDeclaration.ts\":\n/*!*********************************************************!*\\\n !*** ./Shaders/ShadersInclude/defaultUboDeclaration.ts ***!\n \\*********************************************************/\n/*! exports provided: defaultUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultUboDeclaration\", function() { return defaultUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'defaultUboDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/defaultVertexDeclaration.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/defaultVertexDeclaration.ts ***!\n \\************************************************************/\n/*! exports provided: defaultVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultVertexDeclaration\", function() { return defaultVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'defaultVertexDeclaration';\r\nvar shader = \"\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/depthPrePass.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/ShadersInclude/depthPrePass.ts ***!\n \\************************************************/\n/*! exports provided: depthPrePass */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthPrePass\", function() { return depthPrePass; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthPrePass';\r\nvar shader = \"#ifdef DEPTHPREPASS\\ngl_FragColor=vec4(0.,0.,0.,1.0);\\nreturn;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthPrePass = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogFragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/ShadersInclude/fogFragment.ts ***!\n \\***********************************************/\n/*! exports provided: fogFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogFragment\", function() { return fogFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogFragment';\r\nvar shader = \"#ifdef FOG\\nfloat fog=CalcFogFactor();\\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\":\n/*!**********************************************************!*\\\n !*** ./Shaders/ShadersInclude/fogFragmentDeclaration.ts ***!\n \\**********************************************************/\n/*! exports provided: fogFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogFragmentDeclaration\", function() { return fogFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogFragmentDeclaration';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogVertex.ts\":\n/*!*********************************************!*\\\n !*** ./Shaders/ShadersInclude/fogVertex.ts ***!\n \\*********************************************/\n/*! exports provided: fogVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogVertex\", function() { return fogVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogVertex';\r\nvar shader = \"#ifdef FOG\\nvFogDistance=(view*worldPos).xyz;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\":\n/*!********************************************************!*\\\n !*** ./Shaders/ShadersInclude/fogVertexDeclaration.ts ***!\n \\********************************************************/\n/*! exports provided: fogVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fogVertexDeclaration\", function() { return fogVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fogVertexDeclaration';\r\nvar shader = \"#ifdef FOG\\nvarying vec3 vFogDistance;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fogVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/fresnelFunction.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/fresnelFunction.ts ***!\n \\***************************************************/\n/*! exports provided: fresnelFunction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fresnelFunction\", function() { return fresnelFunction; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fresnelFunction';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar fresnelFunction = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/harmonicsFunctions.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/harmonicsFunctions.ts ***!\n \\******************************************************/\n/*! exports provided: harmonicsFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"harmonicsFunctions\", function() { return harmonicsFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'harmonicsFunctions';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar harmonicsFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/helperFunctions.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/helperFunctions.ts ***!\n \\***************************************************/\n/*! exports provided: helperFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"helperFunctions\", function() { return helperFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'helperFunctions';\r\nvar shader = \"const float PI=3.1415926535897932384626433832795;\\nconst float LinearEncodePowerApprox=2.2;\\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\\nconst float Epsilon=0.0000001;\\n#define saturate(x) clamp(x,0.0,1.0)\\n#define absEps(x) abs(x)+Epsilon\\n#define maxEps(x) max(x,Epsilon)\\n#define saturateEps(x) clamp(x,Epsilon,1.0)\\nmat3 transposeMat3(mat3 inMatrix) {\\nvec3 i0=inMatrix[0];\\nvec3 i1=inMatrix[1];\\nvec3 i2=inMatrix[2];\\nmat3 outMatrix=mat3(\\nvec3(i0.x,i1.x,i2.x),\\nvec3(i0.y,i1.y,i2.y),\\nvec3(i0.z,i1.z,i2.z)\\n);\\nreturn outMatrix;\\n}\\n\\nmat3 inverseMat3(mat3 inMatrix) {\\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\\nfloat b01=a22*a11-a12*a21;\\nfloat b11=-a22*a10+a12*a20;\\nfloat b21=a21*a10-a11*a20;\\nfloat det=a00*b01+a01*b11+a02*b21;\\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\\n}\\nvec3 toLinearSpace(vec3 color)\\n{\\nreturn pow(color,vec3(LinearEncodePowerApprox));\\n}\\nvec3 toGammaSpace(vec3 color)\\n{\\nreturn pow(color,vec3(GammaEncodePowerApprox));\\n}\\nfloat square(float value)\\n{\\nreturn value*value;\\n}\\nfloat pow5(float value) {\\nfloat sq=value*value;\\nreturn sq*sq*value;\\n}\\nfloat getLuminance(vec3 color)\\n{\\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\\n}\\n\\nfloat getRand(vec2 seed) {\\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\\n}\\nfloat dither(vec2 seed,float varianceAmount) {\\nfloat rand=getRand(seed);\\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\\nreturn dither;\\n}\\n\\nconst float rgbdMaxRange=255.0;\\nvec4 toRGBD(vec3 color) {\\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\\nfloat D=max(rgbdMaxRange/maxRGB,1.);\\nD=clamp(floor(D)/255.0,0.,1.);\\n\\nvec3 rgb=color.rgb*D;\\n\\nrgb=toGammaSpace(rgb);\\nreturn vec4(rgb,D);\\n}\\nvec3 fromRGBD(vec4 rgbd) {\\n\\nrgbd.rgb=toLinearSpace(rgbd.rgb);\\n\\nreturn rgbd.rgb/rgbd.a;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar helperFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/imageProcessingDeclaration.ts ***!\n \\**************************************************************/\n/*! exports provided: imageProcessingDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"imageProcessingDeclaration\", function() { return imageProcessingDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'imageProcessingDeclaration';\r\nvar shader = \"#ifdef EXPOSURE\\nuniform float exposureLinear;\\n#endif\\n#ifdef CONTRAST\\nuniform float contrast;\\n#endif\\n#ifdef VIGNETTE\\nuniform vec2 vInverseScreenSize;\\nuniform vec4 vignetteSettings1;\\nuniform vec4 vignetteSettings2;\\n#endif\\n#ifdef COLORCURVES\\nuniform vec4 vCameraColorCurveNegative;\\nuniform vec4 vCameraColorCurveNeutral;\\nuniform vec4 vCameraColorCurvePositive;\\n#endif\\n#ifdef COLORGRADING\\n#ifdef COLORGRADING3D\\nuniform highp sampler3D txColorTransform;\\n#else\\nuniform sampler2D txColorTransform;\\n#endif\\nuniform vec4 colorTransformSettings;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar imageProcessingDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/imageProcessingFunctions.ts ***!\n \\************************************************************/\n/*! exports provided: imageProcessingFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"imageProcessingFunctions\", function() { return imageProcessingFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'imageProcessingFunctions';\r\nvar shader = \"#if defined(COLORGRADING) && !defined(COLORGRADING3D)\\n\\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\\n{\\nfloat sliceSize=2.0*sampler3dSetting.x;\\n#ifdef SAMPLER3DGREENDEPTH\\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\\n#else\\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\\n#endif\\nfloat sliceInteger=floor(sliceContinuous);\\n\\n\\nfloat sliceFraction=sliceContinuous-sliceInteger;\\n#ifdef SAMPLER3DGREENDEPTH\\nvec2 sliceUV=color.rb;\\n#else\\nvec2 sliceUV=color.rg;\\n#endif\\nsliceUV.x*=sliceSize;\\nsliceUV.x+=sliceInteger*sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\\nsliceUV.x+=sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\\n#ifdef SAMPLER3DBGRMAP\\ncolor.rgb=result.rgb;\\n#else\\ncolor.rgb=result.bgr;\\n#endif\\nreturn color;\\n}\\n#endif\\n#ifdef TONEMAPPING_ACES\\n\\n\\n\\n\\n\\nconst mat3 ACESInputMat=mat3(\\nvec3(0.59719,0.07600,0.02840),\\nvec3(0.35458,0.90834,0.13383),\\nvec3(0.04823,0.01566,0.83777)\\n);\\n\\nconst mat3 ACESOutputMat=mat3(\\nvec3( 1.60475,-0.10208,-0.00327),\\nvec3(-0.53108,1.10813,-0.07276),\\nvec3(-0.07367,-0.00605,1.07602)\\n);\\nvec3 RRTAndODTFit(vec3 v)\\n{\\nvec3 a=v*(v+0.0245786)-0.000090537;\\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\\nreturn a/b;\\n}\\nvec3 ACESFitted(vec3 color)\\n{\\ncolor=ACESInputMat*color;\\n\\ncolor=RRTAndODTFit(color);\\ncolor=ACESOutputMat*color;\\n\\ncolor=saturate(color);\\nreturn color;\\n}\\n#endif\\nvec4 applyImageProcessing(vec4 result) {\\n#ifdef EXPOSURE\\nresult.rgb*=exposureLinear;\\n#endif\\n#ifdef VIGNETTE\\n\\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\\nviewportXY=viewportXY*2.0-1.0;\\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\\n\\nvec3 vignetteColor=vignetteSettings2.rgb;\\n#ifdef VIGNETTEBLENDMODEMULTIPLY\\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\\nresult.rgb*=vignetteColorMultiplier;\\n#endif\\n#ifdef VIGNETTEBLENDMODEOPAQUE\\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\\n#endif\\n#endif\\n#ifdef TONEMAPPING\\n#ifdef TONEMAPPING_ACES\\nresult.rgb=ACESFitted(result.rgb);\\n#else\\nconst float tonemappingCalibration=1.590579;\\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\\n#endif\\n#endif\\n\\nresult.rgb=toGammaSpace(result.rgb);\\nresult.rgb=saturate(result.rgb);\\n#ifdef CONTRAST\\n\\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\\nif (contrast<1.0) {\\n\\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\\n} else {\\n\\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\\n}\\n#endif\\n\\n#ifdef COLORGRADING\\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\\n#ifdef COLORGRADING3D\\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\\n#else\\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\\n#endif\\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\\n#endif\\n#ifdef COLORCURVES\\n\\nfloat luma=getLuminance(result.rgb);\\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\\nresult.rgb*=colorCurve.rgb;\\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\\n#endif\\nreturn result;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar imageProcessingFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/instancesDeclaration.ts\":\n/*!********************************************************!*\\\n !*** ./Shaders/ShadersInclude/instancesDeclaration.ts ***!\n \\********************************************************/\n/*! exports provided: instancesDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"instancesDeclaration\", function() { return instancesDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'instancesDeclaration';\r\nvar shader = \"#ifdef INSTANCES\\nattribute vec4 world0;\\nattribute vec4 world1;\\nattribute vec4 world2;\\nattribute vec4 world3;\\n#else\\nuniform mat4 world;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar instancesDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/instancesVertex.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/instancesVertex.ts ***!\n \\***************************************************/\n/*! exports provided: instancesVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"instancesVertex\", function() { return instancesVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'instancesVertex';\r\nvar shader = \"#ifdef INSTANCES\\nmat4 finalWorld=mat4(world0,world1,world2,world3);\\n#else\\nmat4 finalWorld=world;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar instancesVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurFragment.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurFragment.ts ***!\n \\******************************************************/\n/*! exports provided: kernelBlurFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurFragment\", function() { return kernelBlurFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurFragment';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurFragment2.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurFragment2.ts ***!\n \\*******************************************************/\n/*! exports provided: kernelBlurFragment2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurFragment2\", function() { return kernelBlurFragment2; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurFragment2';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurFragment2 = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts\":\n/*!****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts ***!\n \\****************************************************************/\n/*! exports provided: kernelBlurVaryingDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurVaryingDeclaration\", function() { return kernelBlurVaryingDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurVaryingDeclaration';\r\nvar shader = \"varying vec2 sampleCoord{X};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurVaryingDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/kernelBlurVertex.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/kernelBlurVertex.ts ***!\n \\****************************************************/\n/*! exports provided: kernelBlurVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurVertex\", function() { return kernelBlurVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'kernelBlurVertex';\r\nvar shader = \"sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightFragment.ts\":\n/*!*************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightFragment.ts ***!\n \\*************************************************/\n/*! exports provided: lightFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightFragment\", function() { return lightFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightFragment';\r\nvar shader = \"#ifdef LIGHT{X}\\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\\n\\n#else\\n#ifdef PBR\\n\\n#ifdef SPOTLIGHT{X}\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(POINTLIGHT{X})\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(HEMILIGHT{X})\\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(DIRLIGHT{X})\\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#endif\\npreInfo.NdotV=NdotV;\\n\\n#ifdef SPOTLIGHT{X}\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#endif\\n#elif defined(POINTLIGHT{X})\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\n#endif\\n#else\\npreInfo.attenuation=1.0;\\n#endif\\n\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=roughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightDiffuse.a,preInfo.lightDistance);\\n#endif\\n\\n#ifdef HEMILIGHT{X}\\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\\n#elif defined(SS_TRANSLUCENCY)\\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,transmittance);\\n#else\\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef SPECULARTERM\\n#ifdef ANISOTROPIC\\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicTangent,anisotropicBitangent,anisotropy,specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#else\\ninfo.specular=computeSpecularLighting(preInfo,normalW,specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#ifdef SHEEN_LINKWITHALBEDO\\n\\npreInfo.roughness=sheenIntensity;\\n#endif\\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef CLEARCOAT\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=clearCoatRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(clearCoatRoughness,light{X}.vLightDiffuse.a,preInfo.lightDistance);\\n#endif\\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearCoatNormalW,clearCoatAARoughnessFactors.x,clearCoatIntensity,light{X}.vLightDiffuse.rgb);\\n#ifdef CLEARCOAT_TINT\\n\\nabsorption=computeClearCoatLightingAbsorption(clearCoatNdotVRefract,preInfo.L,clearCoatNormalW,clearCoatColor,clearCoatThickness,clearCoatIntensity);\\ninfo.diffuse*=absorption;\\n#ifdef SPECULARTERM\\ninfo.specular*=absorption;\\n#endif\\n#endif\\n\\ninfo.diffuse*=info.clearCoat.w;\\n#ifdef SPECULARTERM\\ninfo.specular*=info.clearCoat.w*info.clearCoat.w;\\n#endif\\n#ifdef SHEEN\\ninfo.sheen*=info.clearCoat.w*info.clearCoat.w;\\n#endif\\n#endif\\n#else\\n#ifdef SPOTLIGHT{X}\\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\\n#elif defined(HEMILIGHT{X})\\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,glossiness);\\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\\n#endif\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\\n#endif\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCLOSEESM{X}\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPOISSON{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#else\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#endif\\n#ifdef SHADOWONLY\\n#ifndef SHADOWINUSE\\n#define SHADOWINUSE\\n#endif\\nglobalShadow+=shadow;\\nshadowLightCount+=1.0;\\n#endif\\n#else\\nshadow=1.;\\n#endif\\n#ifndef SHADOWONLY\\n#ifdef CUSTOMUSERLIGHTING\\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\\n#ifdef SPECULARTERM\\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\\n#endif\\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\\ndiffuseBase+=lightmapColor.rgb*shadow;\\n#ifdef SPECULARTERM\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef CLEARCOAT\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#else\\ndiffuseBase+=info.diffuse*shadow;\\n#ifdef SPECULARTERM\\nspecularBase+=info.specular*shadow;\\n#endif\\n#ifdef CLEARCOAT\\nclearCoatBase+=info.clearCoat.rgb*shadow;\\n#endif\\n#ifdef SHEEN\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightFragmentDeclaration.ts ***!\n \\************************************************************/\n/*! exports provided: lightFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightFragmentDeclaration\", function() { return lightFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightFragmentDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform vec4 vLightData{X};\\nuniform vec4 vLightDiffuse{X};\\n#ifdef SPECULARTERM\\nuniform vec3 vLightSpecular{X};\\n#else\\nvec3 vLightSpecular{X}=vec3(0.);\\n#endif\\n#ifdef SHADOW{X}\\n#if defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\nuniform vec4 shadowsInfo{X};\\nuniform vec2 depthValues{X};\\n#endif\\n#ifdef SPOTLIGHT{X}\\nuniform vec4 vLightDirection{X};\\nuniform vec4 vLightFalloff{X};\\n#elif defined(POINTLIGHT{X})\\nuniform vec4 vLightFalloff{X};\\n#elif defined(HEMILIGHT{X})\\nuniform vec3 vLightGround{X};\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightUboDeclaration.ts ***!\n \\*******************************************************/\n/*! exports provided: lightUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightUboDeclaration\", function() { return lightUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightUboDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform Light{X}\\n{\\nvec4 vLightData;\\nvec4 vLightDiffuse;\\nvec3 vLightSpecular;\\n#ifdef SPOTLIGHT{X}\\nvec4 vLightDirection;\\nvec4 vLightFalloff;\\n#elif defined(POINTLIGHT{X})\\nvec4 vLightFalloff;\\n#elif defined(HEMILIGHT{X})\\nvec3 vLightGround;\\n#endif\\nvec4 shadowsInfo;\\nvec2 depthValues;\\n} light{X};\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#ifdef SHADOW{X}\\n#if defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\n#endif\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/lightsFragmentFunctions.ts\":\n/*!***********************************************************!*\\\n !*** ./Shaders/ShadersInclude/lightsFragmentFunctions.ts ***!\n \\***********************************************************/\n/*! exports provided: lightsFragmentFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lightsFragmentFunctions\", function() { return lightsFragmentFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lightsFragmentFunctions';\r\nvar shader = \"\\nstruct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef NDOTL\\nfloat ndl;\\n#endif\\n};\\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 lightVectorW;\\nfloat attenuation=1.0;\\nif (lightData.w == 0.)\\n{\\nvec3 direction=lightData.xyz-vPositionW;\\nattenuation=max(0.,1.0-length(direction)/range);\\nlightVectorW=normalize(direction);\\n}\\nelse\\n{\\nlightVectorW=normalize(-lightData.xyz);\\n}\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 direction=lightData.xyz-vPositionW;\\nvec3 lightVectorW=normalize(direction);\\nfloat attenuation=max(0.,1.0-length(direction)/range);\\n\\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\\nif (cosAngle>=lightDirection.w)\\n{\\ncosAngle=max(0.,pow(cosAngle,lightData.w));\\nattenuation*=cosAngle;\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nresult.diffuse=vec3(0.);\\n#ifdef SPECULARTERM\\nresult.specular=vec3(0.);\\n#endif\\n#ifdef NDOTL\\nresult.ndl=0.;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\\nlightingInfo result;\\n\\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor;\\n#endif\\nreturn result;\\n}\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn textureColor;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lightsFragmentFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/ShadersInclude/logDepthDeclaration.ts ***!\n \\*******************************************************/\n/*! exports provided: logDepthDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logDepthDeclaration\", function() { return logDepthDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'logDepthDeclaration';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nuniform float logarithmicDepthConstant;\\nvarying float vFragmentDepth;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar logDepthDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/logDepthFragment.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/logDepthFragment.ts ***!\n \\****************************************************/\n/*! exports provided: logDepthFragment */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logDepthFragment\", function() { return logDepthFragment; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'logDepthFragment';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar logDepthFragment = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/logDepthVertex.ts\":\n/*!**************************************************!*\\\n !*** ./Shaders/ShadersInclude/logDepthVertex.ts ***!\n \\**************************************************/\n/*! exports provided: logDepthVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logDepthVertex\", function() { return logDepthVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'logDepthVertex';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nvFragmentDepth=1.0+gl_Position.w;\\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar logDepthVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/morphTargetsVertex.ts ***!\n \\******************************************************/\n/*! exports provided: morphTargetsVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"morphTargetsVertex\", function() { return morphTargetsVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'morphTargetsVertex';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar morphTargetsVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\":\n/*!*****************************************************************!*\\\n !*** ./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts ***!\n \\*****************************************************************/\n/*! exports provided: morphTargetsVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"morphTargetsVertexDeclaration\", function() { return morphTargetsVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'morphTargetsVertexDeclaration';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar morphTargetsVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\":\n/*!***********************************************************************!*\\\n !*** ./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts ***!\n \\***********************************************************************/\n/*! exports provided: morphTargetsVertexGlobalDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"morphTargetsVertexGlobalDeclaration\", function() { return morphTargetsVertexGlobalDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'morphTargetsVertexGlobalDeclaration';\r\nvar shader = \"#ifdef MORPHTARGETS\\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar morphTargetsVertexGlobalDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/mrtFragmentDeclaration.ts\":\n/*!**********************************************************!*\\\n !*** ./Shaders/ShadersInclude/mrtFragmentDeclaration.ts ***!\n \\**********************************************************/\n/*! exports provided: mrtFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mrtFragmentDeclaration\", function() { return mrtFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'mrtFragmentDeclaration';\r\nvar shader = \"#if __VERSION__>=200\\nlayout(location=0) out vec4 glFragData[{X}];\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar mrtFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/packingFunctions.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/packingFunctions.ts ***!\n \\****************************************************/\n/*! exports provided: packingFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"packingFunctions\", function() { return packingFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'packingFunctions';\r\nvar shader = \"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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar packingFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrBRDFFunctions.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrBRDFFunctions.ts ***!\n \\****************************************************/\n/*! exports provided: pbrBRDFFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrBRDFFunctions\", function() { return pbrBRDFFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrBRDFFunctions';\r\nvar shader = \"\\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) {\\n\\nvec2 UV=vec2(NdotV,perceptualRoughness);\\n\\nvec4 brdfLookup=texture2D(environmentBrdfSampler,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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrBRDFFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrDebug.ts\":\n/*!********************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrDebug.ts ***!\n \\********************************************/\n/*! exports provided: pbrDebug */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrDebug\", function() { return pbrDebug; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrDebug';\r\nvar shader = \"#if DEBUGMODE>0\\nif (vClipSpacePosition.x/vClipSpacePosition.w=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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrDirectLightingFalloffFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrDirectLightingFunctions.ts\":\n/*!**************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrDirectLightingFunctions.ts ***!\n \\**************************************************************/\n/*! exports provided: pbrDirectLightingFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrDirectLightingFunctions\", function() { return pbrDirectLightingFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrDirectLightingFunctions';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrDirectLightingFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.ts\":\n/*!*******************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.ts ***!\n \\*******************************************************************/\n/*! exports provided: pbrDirectLightingSetupFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrDirectLightingSetupFunctions\", function() { return pbrDirectLightingSetupFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrDirectLightingSetupFunctions';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrDirectLightingSetupFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrFragmentDeclaration.ts\":\n/*!**********************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrFragmentDeclaration.ts ***!\n \\**********************************************************/\n/*! exports provided: pbrFragmentDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrFragmentDeclaration\", function() { return pbrFragmentDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrFragmentDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrFragmentDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrFragmentExtraDeclaration.ts\":\n/*!***************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrFragmentExtraDeclaration.ts ***!\n \\***************************************************************/\n/*! exports provided: pbrFragmentExtraDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrFragmentExtraDeclaration\", function() { return pbrFragmentExtraDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrFragmentExtraDeclaration';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrFragmentExtraDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.ts\":\n/*!******************************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.ts ***!\n \\******************************************************************/\n/*! exports provided: pbrFragmentSamplersDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrFragmentSamplersDeclaration\", function() { return pbrFragmentSamplersDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrFragmentSamplersDeclaration';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrFragmentSamplersDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrHelperFunctions.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrHelperFunctions.ts ***!\n \\******************************************************/\n/*! exports provided: pbrHelperFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrHelperFunctions\", function() { return pbrHelperFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrHelperFunctions';\r\nvar shader = \"\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrHelperFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrIBLFunctions.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrIBLFunctions.ts ***!\n \\***************************************************/\n/*! exports provided: pbrIBLFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrIBLFunctions\", function() { return pbrIBLFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrIBLFunctions';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrIBLFunctions = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrUboDeclaration.ts\":\n/*!*****************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrUboDeclaration.ts ***!\n \\*****************************************************/\n/*! exports provided: pbrUboDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrUboDeclaration\", function() { return pbrUboDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrUboDeclaration';\r\nvar shader = \"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};\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrUboDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pbrVertexDeclaration.ts\":\n/*!********************************************************!*\\\n !*** ./Shaders/ShadersInclude/pbrVertexDeclaration.ts ***!\n \\********************************************************/\n/*! exports provided: pbrVertexDeclaration */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrVertexDeclaration\", function() { return pbrVertexDeclaration; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pbrVertexDeclaration';\r\nvar shader = \"uniform mat4 view;\\nuniform mat4 viewProjection;\\n#ifdef ALBEDO\\nuniform mat4 albedoMatrix;\\nuniform vec2 vAlbedoInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec4 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#ifdef REFLECTIVITY\\nuniform vec3 vReflectivityInfos;\\nuniform mat4 reflectivityMatrix;\\n#endif\\n#ifdef MICROSURFACEMAP\\nuniform vec2 vMicroSurfaceSamplerInfos;\\nuniform mat4 microSurfaceSamplerMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\n#endif\\n\\n#ifdef CLEARCOAT\\n#ifdef CLEARCOAT_TEXTURE\\nuniform vec2 vClearCoatInfos;\\nuniform mat4 clearCoatMatrix;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nuniform vec2 vClearCoatBumpInfos;\\nuniform mat4 clearCoatBumpMatrix;\\n#endif\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\n#endif\\n#endif\\n\\n#ifdef ANISOTROPIC\\n#ifdef ANISOTROPIC_TEXTURE\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#ifdef SHEEN_TEXTURE\\nuniform vec2 vSheenInfos;\\nuniform mat4 sheenMatrix;\\n#endif\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;;\\n#endif\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrVertexDeclaration = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/pointCloudVertex.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/ShadersInclude/pointCloudVertex.ts ***!\n \\****************************************************/\n/*! exports provided: pointCloudVertex */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pointCloudVertex\", function() { return pointCloudVertex; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'pointCloudVertex';\r\nvar shader = \"#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pointCloudVertex = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/reflectionFunction.ts\":\n/*!******************************************************!*\\\n !*** ./Shaders/ShadersInclude/reflectionFunction.ts ***!\n \\******************************************************/\n/*! exports provided: reflectionFunction */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"reflectionFunction\", function() { return reflectionFunction; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'reflectionFunction';\r\nvar shader = \"vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\\n\\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\\nvec3 halfSize=cubeSize*0.5;\\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\\n\\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\\n\\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\\n\\nvec3 intersectPositionWS=vertexPos+origVec*distance;\\n\\nreturn intersectPositionWS-cubePos;\\n}\\nvec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(1.0-s,t,0);\\n}\\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);\\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\\nr=vec3(reflectionMatrix*vec4(r,0));\\nfloat lon=atan(r.z,r.x);\\nfloat lat=acos(r.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(vec3(view*worldPos));\\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\\nvec3 r=reflect(viewDir,viewNormal);\\nr=vec3(reflectionMatrix*vec4(r,0));\\nr.z=r.z-1.0;\\nfloat m=2.0*length(r);\\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\\n}\\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=worldPos.xyz-eyePosition;\\nvec3 coords=normalize(reflect(viewDir,worldNormal));\\nreturn vec3(reflectionMatrix*vec4(coords,1));\\n}\\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*(view*worldPos));\\n}\\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*vec4(positionW,0));\\n}\\n#ifdef REFLECTION\\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\\n{\\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SPHERICAL\\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_PLANAR\\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_CUBIC\\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\\n#else\\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_PROJECTION\\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_EXPLICIT\\nreturn vec3(0,0,0);\\n#endif\\n}\\n#endif\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nvar reflectionFunction = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ShadersInclude/shadowsFragmentFunctions.ts\":\n/*!************************************************************!*\\\n !*** ./Shaders/ShadersInclude/shadowsFragmentFunctions.ts ***!\n \\************************************************************/\n/*! exports provided: shadowsFragmentFunctions */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shadowsFragmentFunctions\", function() { return shadowsFragmentFunctions; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'shadowsFragmentFunctions';\r\nvar shader = \"#ifdef SHADOWS\\n#ifndef SHADOWFLOAT\\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}\\n#endif\\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\\n{\\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.0,clamp(dot(clipSpace,clipSpace),0.,1.));\\nreturn mix(value,1.0,mask);\\n}\\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\\n#else\\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\\n#endif\\nif (depth>shadow)\\n{\\nreturn darkness;\\n}\\nreturn 1.0;\\n}\\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\nfloat visibility=1.;\\nvec3 poissonDisk[4];\\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadow=texture2D(shadowSampler,uv).x;\\n#endif\\nif (shadowPixelDepth>shadow)\\n{\\nreturn computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff);\\n}\\nreturn 1.;\\n}\\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\nfloat visibility=1.;\\nvec2 poissonDisk[4];\\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\\npoissonDisk[3]=vec2(0.34495938,0.29387760);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n#ifdef WEBGL2\\n\\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat shadow=texture2D(shadowSampler,uvDepth);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\n\\n\\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\nconst vec3 PoissonSamplers32[64]=vec3[64](\\nvec3(0.06407013,0.05409927,0.),\\nvec3(0.7366577,0.5789394,0.),\\nvec3(-0.6270542,-0.5320278,0.),\\nvec3(-0.4096107,0.8411095,0.),\\nvec3(0.6849564,-0.4990818,0.),\\nvec3(-0.874181,-0.04579735,0.),\\nvec3(0.9989998,0.0009880066,0.),\\nvec3(-0.004920578,-0.9151649,0.),\\nvec3(0.1805763,0.9747483,0.),\\nvec3(-0.2138451,0.2635818,0.),\\nvec3(0.109845,0.3884785,0.),\\nvec3(0.06876755,-0.3581074,0.),\\nvec3(0.374073,-0.7661266,0.),\\nvec3(0.3079132,-0.1216763,0.),\\nvec3(-0.3794335,-0.8271583,0.),\\nvec3(-0.203878,-0.07715034,0.),\\nvec3(0.5912697,0.1469799,0.),\\nvec3(-0.88069,0.3031784,0.),\\nvec3(0.5040108,0.8283722,0.),\\nvec3(-0.5844124,0.5494877,0.),\\nvec3(0.6017799,-0.1726654,0.),\\nvec3(-0.5554981,0.1559997,0.),\\nvec3(-0.3016369,-0.3900928,0.),\\nvec3(-0.5550632,-0.1723762,0.),\\nvec3(0.925029,0.2995041,0.),\\nvec3(-0.2473137,0.5538505,0.),\\nvec3(0.9183037,-0.2862392,0.),\\nvec3(0.2469421,0.6718712,0.),\\nvec3(0.3916397,-0.4328209,0.),\\nvec3(-0.03576927,-0.6220032,0.),\\nvec3(-0.04661255,0.7995201,0.),\\nvec3(0.4402924,0.3640312,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.)\\n);\\nconst vec3 PoissonSamplers64[64]=vec3[64](\\nvec3(-0.613392,0.617481,0.),\\nvec3(0.170019,-0.040254,0.),\\nvec3(-0.299417,0.791925,0.),\\nvec3(0.645680,0.493210,0.),\\nvec3(-0.651784,0.717887,0.),\\nvec3(0.421003,0.027070,0.),\\nvec3(-0.817194,-0.271096,0.),\\nvec3(-0.705374,-0.668203,0.),\\nvec3(0.977050,-0.108615,0.),\\nvec3(0.063326,0.142369,0.),\\nvec3(0.203528,0.214331,0.),\\nvec3(-0.667531,0.326090,0.),\\nvec3(-0.098422,-0.295755,0.),\\nvec3(-0.885922,0.215369,0.),\\nvec3(0.566637,0.605213,0.),\\nvec3(0.039766,-0.396100,0.),\\nvec3(0.751946,0.453352,0.),\\nvec3(0.078707,-0.715323,0.),\\nvec3(-0.075838,-0.529344,0.),\\nvec3(0.724479,-0.580798,0.),\\nvec3(0.222999,-0.215125,0.),\\nvec3(-0.467574,-0.405438,0.),\\nvec3(-0.248268,-0.814753,0.),\\nvec3(0.354411,-0.887570,0.),\\nvec3(0.175817,0.382366,0.),\\nvec3(0.487472,-0.063082,0.),\\nvec3(-0.084078,0.898312,0.),\\nvec3(0.488876,-0.783441,0.),\\nvec3(0.470016,0.217933,0.),\\nvec3(-0.696890,-0.549791,0.),\\nvec3(-0.149693,0.605762,0.),\\nvec3(0.034211,0.979980,0.),\\nvec3(0.503098,-0.308878,0.),\\nvec3(-0.016205,-0.872921,0.),\\nvec3(0.385784,-0.393902,0.),\\nvec3(-0.146886,-0.859249,0.),\\nvec3(0.643361,0.164098,0.),\\nvec3(0.634388,-0.049471,0.),\\nvec3(-0.688894,0.007843,0.),\\nvec3(0.464034,-0.188818,0.),\\nvec3(-0.440840,0.137486,0.),\\nvec3(0.364483,0.511704,0.),\\nvec3(0.034028,0.325968,0.),\\nvec3(0.099094,-0.308023,0.),\\nvec3(0.693960,-0.366253,0.),\\nvec3(0.678884,-0.204688,0.),\\nvec3(0.001801,0.780328,0.),\\nvec3(0.145177,-0.898984,0.),\\nvec3(0.062655,-0.611866,0.),\\nvec3(0.315226,-0.604297,0.),\\nvec3(-0.780145,0.486251,0.),\\nvec3(-0.371868,0.882138,0.),\\nvec3(0.200476,0.494430,0.),\\nvec3(-0.494552,-0.711051,0.),\\nvec3(0.612476,0.705252,0.),\\nvec3(-0.578845,-0.768792,0.),\\nvec3(-0.772454,-0.090976,0.),\\nvec3(0.504440,0.372295,0.),\\nvec3(0.155736,0.065157,0.),\\nvec3(0.391522,0.849605,0.),\\nvec3(-0.620106,-0.328104,0.),\\nvec3(0.789239,-0.419965,0.),\\nvec3(-0.545396,0.538133,0.),\\nvec3(-0.178564,-0.596057,0.)\\n);\\n\\n\\n\\n\\n\\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i\\n#define RECIPROCAL_PI2 0.15915494\\n\\nuniform vec3 vEyePosition;\\n\\nvarying vec3 vPositionW;\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\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\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\n#define sampleReflection(s,c) textureCube(s,c)\\nuniform samplerCube reflectionSampler;\\n#ifdef TEXTURELODSUPPORT\\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\n#endif\\n#else\\n#define sampleReflection(s,c) texture2D(s,c)\\nuniform sampler2D reflectionSampler;\\n#ifdef TEXTURELODSUPPORT\\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\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#include\\n#endif\\n\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE;\\n#endif\\n\\n#ifndef SHADOWONLY\\n#define SHADOWONLY;\\n#endif\\n#include\\n\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\n#include\\n#ifdef REFLECTIONFRESNEL\\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\\nvec3 fresnelSchlickEnvironmentGGX(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\\nvoid main(void) {\\n#include\\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\\n\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=vec3(0.0,1.0,0.0);\\n#endif\\n\\nfloat shadow=1.;\\nfloat globalShadow=0.;\\nfloat shadowLightCount=0.;\\n#include[0..maxSimultaneousLights]\\n#ifdef SHADOWINUSE\\nglobalShadow/=shadowLightCount;\\n#else\\nglobalShadow=1.0;\\n#endif\\n\\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\\n#ifdef REFLECTION\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\n\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords=reflectionVector;\\n#else\\nvec2 reflectionCoords=reflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nreflectionCoords/=reflectionVector.z;\\n#endif\\nreflectionCoords.y=1.0-reflectionCoords.y;\\n#endif\\n#ifdef REFLECTIONBLUR\\nfloat reflectionLOD=vReflectionInfos.y;\\n#ifdef TEXTURELODSUPPORT\\n\\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\\n#else\\nfloat lodReflectionNormalized=saturate(reflectionLOD);\\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\\nif(lodReflectionNormalizedDoubled<1.0){\\nreflectionColor=mix(\\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\\nreflectionSpecularMid,\\nlodReflectionNormalizedDoubled\\n);\\n} else {\\nreflectionColor=mix(\\nreflectionSpecularMid,\\nsampleReflection(reflectionSamplerLow,reflectionCoords),\\nlodReflectionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#else\\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\\nreflectionColor=reflectionSample;\\n#endif\\n#ifdef RGBDREFLECTION\\nreflectionColor.rgb=fromRGBD(reflectionColor);\\n#endif\\n#ifdef GAMMAREFLECTION\\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\\n#endif\\n#ifdef REFLECTIONBGR\\nreflectionColor.rgb=reflectionColor.bgr;\\n#endif\\n\\nreflectionColor.rgb*=vReflectionInfos.x;\\n#endif\\n\\nvec3 diffuseColor=vec3(1.,1.,1.);\\nfloat finalAlpha=alpha;\\n#ifdef DIFFUSE\\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\\n#ifdef GAMMADIFFUSE\\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\\n#endif\\n\\ndiffuseMap.rgb*=vDiffuseInfos.y;\\n#ifdef DIFFUSEHASALPHA\\nfinalAlpha*=diffuseMap.a;\\n#endif\\ndiffuseColor=diffuseMap.rgb;\\n#endif\\n\\n#ifdef REFLECTIONFRESNEL\\nvec3 colorBase=diffuseColor;\\n#else\\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\\n#endif\\ncolorBase=max(colorBase,0.0);\\n\\n#ifdef USERGBCOLOR\\nvec3 finalColor=colorBase;\\n#else\\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\\n#else\\nvec3 mainColor=vPrimaryColor.rgb;\\n#endif\\nvec3 finalColor=colorBase*mainColor;\\n#endif\\n\\n#ifdef REFLECTIONFRESNEL\\nvec3 reflectionAmount=vReflectionControl.xxx;\\nvec3 reflectionReflectance0=vReflectionControl.yyy;\\nvec3 reflectionReflectance90=vReflectionControl.zzz;\\nfloat VdotN=dot(normalize(vEyePosition),normalW);\\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\\nreflectionAmount*=planarReflectionFresnel;\\n#ifdef REFLECTIONFALLOFF\\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);\\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\\nreflectionAmount*=reflectionDistanceFalloff;\\n#endif\\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\\n#endif\\n#ifdef OPACITYFRESNEL\\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition-vBackgroundCenter));\\n\\nconst float startAngle=0.1;\\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\\nfinalAlpha*=fadeFactor*fadeFactor;\\n#endif\\n\\n#ifdef SHADOWINUSE\\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\\n#endif\\n\\nvec4 color=vec4(finalColor,finalAlpha);\\n#include\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\n\\n\\ncolor.rgb=clamp(color.rgb,0.,30.0);\\n#else\\n\\ncolor=applyImageProcessing(color);\\n#endif\\n#ifdef PREMULTIPLYALPHA\\n\\ncolor.rgb*=color.a;\\n#endif\\n#ifdef NOISE\\ncolor.rgb+=dither(vPositionW.xy,0.5);\\ncolor=max(color,0.0);\\n#endif\\ngl_FragColor=color;\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/background.vertex.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/background.vertex.ts ***!\n \\**************************************/\n/*! exports provided: backgroundVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"backgroundVertexShader\", function() { return backgroundVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_backgroundVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/backgroundVertexDeclaration */ \"./Shaders/ShadersInclude/backgroundVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_backgroundUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/backgroundUboDeclaration */ \"./Shaders/ShadersInclude/backgroundUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n/* harmony import */ var _ShadersInclude_fogVertex__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/fogVertex */ \"./Shaders/ShadersInclude/fogVertex.ts\");\n/* harmony import */ var _ShadersInclude_shadowsVertex__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/shadowsVertex */ \"./Shaders/ShadersInclude/shadowsVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'backgroundVertexShader';\r\nvar shader = \"precision highp float;\\n#include<__decl__backgroundVertex>\\n#include\\n\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#include\\n\\n#include\\n\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\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#include\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\nvoid main(void) {\\n#ifdef REFLECTIONMAP_SKYBOX\\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\\n#else\\nvPositionUVW=position;\\n#endif\\n#endif\\n#include\\n#include\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n} else {\\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\\n}\\n#else\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n#endif\\nvec4 worldPos=finalWorld*vec4(position,1.0);\\nvPositionW=vec3(worldPos);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normal);\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\\nif (fFovMultiplier<=1.0) {\\nvDirectionW=normalize(segment);\\n} else {\\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\\n}\\n#endif\\n#endif\\n#ifndef UV1\\nvec2 uv=vec2(0.,0.);\\n#endif\\n#ifndef UV2\\nvec2 uv2=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uv;\\n#endif\\n#ifdef MAINUV2\\nvMainUV2=uv2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\\nif (vDiffuseInfos.x == 0.)\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\\n}\\nelse\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n\\n#include\\n\\n#include\\n\\n#include[0..maxSimultaneousLights]\\n\\n#ifdef VERTEXCOLOR\\nvColor=color;\\n#endif\\n\\n#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar backgroundVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/blackAndWhite.fragment.ts\":\n/*!*******************************************!*\\\n !*** ./Shaders/blackAndWhite.fragment.ts ***!\n \\*******************************************/\n/*! exports provided: blackAndWhitePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"blackAndWhitePixelShader\", function() { return blackAndWhitePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'blackAndWhitePixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar blackAndWhitePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/bloomMerge.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/bloomMerge.fragment.ts ***!\n \\****************************************/\n/*! exports provided: bloomMergePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bloomMergePixelShader\", function() { return bloomMergePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'bloomMergePixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform sampler2D bloomBlur;\\nvarying vec2 vUV;\\nuniform float bloomWeight;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight);\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar bloomMergePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/chromaticAberration.fragment.ts\":\n/*!*************************************************!*\\\n !*** ./Shaders/chromaticAberration.fragment.ts ***!\n \\*************************************************/\n/*! exports provided: chromaticAberrationPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"chromaticAberrationPixelShader\", function() { return chromaticAberrationPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'chromaticAberrationPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\n\\nuniform float chromatic_aberration;\\nuniform float radialIntensity;\\nuniform vec2 direction;\\nuniform vec2 centerPosition;\\nuniform float screen_width;\\nuniform float screen_height;\\n\\nvarying vec2 vUV;\\nvoid main(void)\\n{\\nvec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);\\nvec2 directionOfEffect=direction;\\nif(directionOfEffect.x == 0. && directionOfEffect.y == 0.){\\ndirectionOfEffect=normalize(centered_screen_pos);\\n}\\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\\n+centered_screen_pos.y*centered_screen_pos.y;\\nfloat radius=sqrt(radius2);\\nvec4 original=texture2D(textureSampler,vUV);\\n\\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\\nfloat ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;\\nfloat ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;\\n\\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\\noriginal.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);\\ngl_FragColor=original;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar chromaticAberrationPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/circleOfConfusion.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/circleOfConfusion.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: circleOfConfusionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"circleOfConfusionPixelShader\", function() { return circleOfConfusionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'circleOfConfusionPixelShader';\r\nvar shader = \"\\nuniform sampler2D depthSampler;\\n\\nvarying vec2 vUV;\\n\\nuniform vec2 cameraMinMaxZ;\\n\\nuniform float focusDistance;\\nuniform float cocPrecalculation;\\nvoid main(void)\\n{\\nfloat depth=texture2D(depthSampler,vUV).r;\\nfloat pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0;\\nfloat coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));\\ncoc=clamp(coc,0.0,1.0);\\ngl_FragColor=vec4(coc,depth,coc,1.0);\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar circleOfConfusionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/color.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/color.fragment.ts ***!\n \\***********************************/\n/*! exports provided: colorPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"colorPixelShader\", function() { return colorPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n\r\n\r\n\r\nvar name = 'colorPixelShader';\r\nvar shader = \"#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#else\\nuniform vec4 color;\\n#endif\\n#include\\nvoid main(void) {\\n#include\\n#ifdef VERTEXCOLOR\\ngl_FragColor=vColor;\\n#else\\ngl_FragColor=color;\\n#endif\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar colorPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/color.vertex.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/color.vertex.ts ***!\n \\*********************************/\n/*! exports provided: colorVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"colorVertexShader\", function() { return colorVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'colorVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar colorVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/colorCorrection.fragment.ts\":\n/*!*********************************************!*\\\n !*** ./Shaders/colorCorrection.fragment.ts ***!\n \\*********************************************/\n/*! exports provided: colorCorrectionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"colorCorrectionPixelShader\", function() { return colorCorrectionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'colorCorrectionPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\nuniform sampler2D colorTable;\\n\\nvarying vec2 vUV;\\n\\nconst float SLICE_COUNT=16.0;\\n\\nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\\nfloat sliceSize=1.0/width;\\nfloat slicePixelSize=sliceSize/width;\\nfloat sliceInnerSize=slicePixelSize*(width-1.0);\\nfloat zSlice0=min(floor(uv.z*width),width-1.0);\\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\\nfloat s0=xOffset+(zSlice0*sliceSize);\\nfloat s1=xOffset+(zSlice1*sliceSize);\\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\\nfloat zOffset=mod(uv.z*width,1.0);\\nvec4 result=mix(slice0Color,slice1Color,zOffset);\\nreturn result;\\n}\\nvoid main(void)\\n{\\nvec4 screen_color=texture2D(textureSampler,vUV);\\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar colorCorrectionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/convolution.fragment.ts\":\n/*!*****************************************!*\\\n !*** ./Shaders/convolution.fragment.ts ***!\n \\*****************************************/\n/*! exports provided: convolutionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"convolutionPixelShader\", function() { return convolutionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'convolutionPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec2 screenSize;\\nuniform float kernel[9];\\nvoid main(void)\\n{\\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\\nvec4 colorSum =\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\\nfloat kernelWeight =\\nkernel[0] +\\nkernel[1] +\\nkernel[2] +\\nkernel[3] +\\nkernel[4] +\\nkernel[5] +\\nkernel[6] +\\nkernel[7] +\\nkernel[8];\\nif (kernelWeight<=0.0) {\\nkernelWeight=1.0;\\n}\\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar convolutionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/default.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/default.fragment.ts ***!\n \\*************************************/\n/*! exports provided: defaultPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultPixelShader\", function() { return defaultPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_defaultFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/defaultFragmentDeclaration */ \"./Shaders/ShadersInclude/defaultFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_defaultUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/defaultUboDeclaration */ \"./Shaders/ShadersInclude/defaultUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightsFragmentFunctions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/lightsFragmentFunctions */ \"./Shaders/ShadersInclude/lightsFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_shadowsFragmentFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/shadowsFragmentFunctions */ \"./Shaders/ShadersInclude/shadowsFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_fresnelFunction__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/fresnelFunction */ \"./Shaders/ShadersInclude/fresnelFunction.ts\");\n/* harmony import */ var _ShadersInclude_reflectionFunction__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/reflectionFunction */ \"./Shaders/ShadersInclude/reflectionFunction.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragmentFunctions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/bumpFragmentFunctions */ \"./Shaders/ShadersInclude/bumpFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogFragmentDeclaration__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/fogFragmentDeclaration */ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragment__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/bumpFragment */ \"./Shaders/ShadersInclude/bumpFragment.ts\");\n/* harmony import */ var _ShadersInclude_depthPrePass__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/depthPrePass */ \"./Shaders/ShadersInclude/depthPrePass.ts\");\n/* harmony import */ var _ShadersInclude_lightFragment__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/lightFragment */ \"./Shaders/ShadersInclude/lightFragment.ts\");\n/* harmony import */ var _ShadersInclude_logDepthFragment__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/logDepthFragment */ \"./Shaders/ShadersInclude/logDepthFragment.ts\");\n/* harmony import */ var _ShadersInclude_fogFragment__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/fogFragment */ \"./Shaders/ShadersInclude/fogFragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'defaultPixelShader';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/default.vertex.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/default.vertex.ts ***!\n \\***********************************/\n/*! exports provided: defaultVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultVertexShader\", function() { return defaultVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_defaultVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/defaultVertexDeclaration */ \"./Shaders/ShadersInclude/defaultVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_defaultUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/defaultUboDeclaration */ \"./Shaders/ShadersInclude/defaultUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertexDeclaration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/bumpVertexDeclaration */ \"./Shaders/ShadersInclude/bumpVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/bumpVertex */ \"./Shaders/ShadersInclude/bumpVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n/* harmony import */ var _ShadersInclude_fogVertex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/fogVertex */ \"./Shaders/ShadersInclude/fogVertex.ts\");\n/* harmony import */ var _ShadersInclude_shadowsVertex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/shadowsVertex */ \"./Shaders/ShadersInclude/shadowsVertex.ts\");\n/* harmony import */ var _ShadersInclude_pointCloudVertex__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/pointCloudVertex */ \"./Shaders/ShadersInclude/pointCloudVertex.ts\");\n/* harmony import */ var _ShadersInclude_logDepthVertex__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ShadersInclude/logDepthVertex */ \"./Shaders/ShadersInclude/logDepthVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'defaultVertexShader';\r\nvar shader = \"#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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar defaultVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depth.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/depth.fragment.ts ***!\n \\***********************************/\n/*! exports provided: depthPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthPixelShader\", function() { return depthPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_packingFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/packingFunctions */ \"./Shaders/ShadersInclude/packingFunctions.ts\");\n\r\n\r\nvar name = 'depthPixelShader';\r\nvar shader = \"#ifdef ALPHATEST\\nvarying vec2 vUV;\\nuniform sampler2D diffuseSampler;\\n#endif\\nvarying float vDepthMetric;\\n#ifdef PACKED\\n#include\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depth.vertex.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/depth.vertex.ts ***!\n \\*********************************/\n/*! exports provided: depthVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthVertexShader\", function() { return depthVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'depthVertexShader';\r\nvar shader = \"\\nattribute vec3 position;\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n\\n#include\\nuniform mat4 viewProjection;\\nuniform vec2 depthValues;\\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\\nvarying float vDepthMetric;\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depthBoxBlur.fragment.ts\":\n/*!******************************************!*\\\n !*** ./Shaders/depthBoxBlur.fragment.ts ***!\n \\******************************************/\n/*! exports provided: depthBoxBlurPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthBoxBlurPixelShader\", function() { return depthBoxBlurPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthBoxBlurPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthBoxBlurPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depthOfField.fragment.ts\":\n/*!******************************************!*\\\n !*** ./Shaders/depthOfField.fragment.ts ***!\n \\******************************************/\n/*! exports provided: depthOfFieldPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthOfFieldPixelShader\", function() { return depthOfFieldPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthOfFieldPixelShader';\r\nvar shader = \"\\n\\n\\n\\n\\nuniform sampler2D textureSampler;\\nuniform sampler2D highlightsSampler;\\nuniform sampler2D depthSampler;\\nuniform sampler2D grainSampler;\\n\\nuniform float grain_amount;\\nuniform bool blur_noise;\\nuniform float screen_width;\\nuniform float screen_height;\\nuniform float distortion;\\nuniform bool dof_enabled;\\n\\nuniform float screen_distance;\\nuniform float aperture;\\nuniform float darken;\\nuniform float edge_blur;\\nuniform bool highlights;\\n\\nuniform float near;\\nuniform float far;\\n\\nvarying vec2 vUV;\\n\\n#define PI 3.14159265\\n#define TWOPI 6.28318530\\n#define inverse_focal_length 0.1\\n\\nvec2 centered_screen_pos;\\nvec2 distorted_coords;\\nfloat radius2;\\nfloat radius;\\n\\nvec2 rand(vec2 co)\\n{\\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\\n}\\n\\nvec2 getDistortedCoords(vec2 coords) {\\nif (distortion == 0.0) { return coords; }\\nvec2 direction=1.0*normalize(centered_screen_pos);\\nvec2 dist_coords=vec2(0.5,0.5);\\ndist_coords.x=0.5+direction.x*radius2*1.0;\\ndist_coords.y=0.5+direction.y*radius2*1.0;\\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\\ndist_coords=mix(coords,dist_coords,dist_amount);\\nreturn dist_coords;\\n}\\n\\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\\n\\nvec2 coords=distorted_coords;\\nfloat angle=rand(coords*100.0).x*TWOPI;\\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\\ncolor+=texture2D(textureSampler,coords)*weight;\\nreturn weight;\\n}\\n\\nfloat getBlurLevel(float size) {\\nreturn min(3.0,ceil(size/1.0));\\n}\\n\\nvec4 getBlurColor(float size) {\\nvec4 col=texture2D(textureSampler,distorted_coords);\\nif (size == 0.0) { return col; }\\n\\n\\nfloat blur_level=getBlurLevel(size);\\nfloat w=(size/screen_width);\\nfloat h=(size/screen_height);\\nfloat total_weight=1.0;\\nvec2 sample_coords;\\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\\nif (blur_level>1.0) {\\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\\n}\\nif (blur_level>2.0) {\\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\\n}\\ncol/=total_weight;\\n\\nif (darken>0.0) {\\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\\n}\\n\\n\\n\\n\\nreturn col;\\n}\\nvoid main(void)\\n{\\n\\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\\nradius=sqrt(radius2);\\ndistorted_coords=getDistortedCoords(vUV);\\nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height);\\nfloat depth=texture2D(depthSampler,distorted_coords).r;\\nfloat distance=near+(far-near)*depth;\\nvec4 color=texture2D(textureSampler,vUV);\\n\\n\\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\\n\\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\\n\\nfloat edge_blur_amount=0.0;\\nif (edge_blur>0.0) {\\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\\n}\\n\\nfloat blur_amount=max(edge_blur_amount,coc);\\n\\nif (blur_amount == 0.0) {\\ngl_FragColor=texture2D(textureSampler,distorted_coords);\\n}\\nelse {\\n\\ngl_FragColor=getBlurColor(blur_amount*1.7);\\n\\nif (highlights) {\\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\\n}\\nif (blur_noise) {\\n\\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\\n}\\n}\\n\\nif (grain_amount>0.0) {\\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\\n}\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthOfFieldPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/depthOfFieldMerge.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/depthOfFieldMerge.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: depthOfFieldMergePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"depthOfFieldMergePixelShader\", function() { return depthOfFieldMergePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'depthOfFieldMergePixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nvarying vec2 vUV;\\nuniform sampler2D circleOfConfusionSampler;\\nuniform sampler2D blurStep0;\\n#if BLUR_LEVEL>0\\nuniform sampler2D blurStep1;\\n#endif\\n#if BLUR_LEVEL>1\\nuniform sampler2D blurStep2;\\n#endif\\nvoid main(void)\\n{\\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\\n#if BLUR_LEVEL == 0\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred0=texture2D(blurStep0,vUV);\\ngl_FragColor=mix(original,blurred0,coc);\\n#endif\\n#if BLUR_LEVEL == 1\\nif(coc<0.5){\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(original,blurred1,coc/0.5);\\n}else{\\nvec4 blurred0=texture2D(blurStep0,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\\n}\\n#endif\\n#if BLUR_LEVEL == 2\\nif(coc<0.33){\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred2=texture2D(blurStep2,vUV);\\ngl_FragColor=mix(original,blurred2,coc/0.33);\\n}else if(coc<0.66){\\nvec4 blurred1=texture2D(blurStep1,vUV);\\nvec4 blurred2=texture2D(blurStep2,vUV);\\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\\n}else{\\nvec4 blurred0=texture2D(blurStep0,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\\n}\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar depthOfFieldMergePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/displayPass.fragment.ts\":\n/*!*****************************************!*\\\n !*** ./Shaders/displayPass.fragment.ts ***!\n \\*****************************************/\n/*! exports provided: displayPassPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"displayPassPixelShader\", function() { return displayPassPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'displayPassPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D passSampler;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(passSampler,vUV);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar displayPassPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/extractHighlights.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/extractHighlights.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: extractHighlightsPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractHighlightsPixelShader\", function() { return extractHighlightsPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'extractHighlightsPixelShader';\r\nvar shader = \"#include\\n\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform float threshold;\\nuniform float exposure;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\nfloat luma=getLuminance(gl_FragColor.rgb*exposure);\\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar extractHighlightsPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/filter.fragment.ts\":\n/*!************************************!*\\\n !*** ./Shaders/filter.fragment.ts ***!\n \\************************************/\n/*! exports provided: filterPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"filterPixelShader\", function() { return filterPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'filterPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform mat4 kernelMatrix;\\nvoid main(void)\\n{\\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\\ngl_FragColor=vec4(updatedColor,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar filterPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/fxaa.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/fxaa.fragment.ts ***!\n \\**********************************/\n/*! exports provided: fxaaPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"fxaaPixelShader\", function() { return fxaaPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'fxaaPixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform vec2 texelSize;\\nvarying vec2 vUV;\\nvarying vec2 sampleCoordS;\\nvarying vec2 sampleCoordE;\\nvarying vec2 sampleCoordN;\\nvarying vec2 sampleCoordW;\\nvarying vec2 sampleCoordNW;\\nvarying vec2 sampleCoordSE;\\nvarying vec2 sampleCoordNE;\\nvarying vec2 sampleCoordSW;\\nconst float fxaaQualitySubpix=1.0;\\nconst float fxaaQualityEdgeThreshold=0.166;\\nconst float fxaaQualityEdgeThresholdMin=0.0833;\\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\\nvoid main(){\\nvec2 posM;\\nposM.x=vUV.x;\\nposM.y=vUV.y;\\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\\nfloat lumaM=FxaaLuma(rgbyM);\\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\\nfloat maxSM=max(lumaS,lumaM);\\nfloat minSM=min(lumaS,lumaM);\\nfloat maxESM=max(lumaE,maxSM);\\nfloat minESM=min(lumaE,minSM);\\nfloat maxWN=max(lumaN,lumaW);\\nfloat minWN=min(lumaN,lumaW);\\nfloat rangeMax=max(maxWN,maxESM);\\nfloat rangeMin=min(minWN,minESM);\\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\\nfloat range=rangeMax-rangeMin;\\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\\n#ifndef MALI\\nif(range=edgeVert;\\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\\nif (!horzSpan)\\n{\\nlumaN=lumaW;\\n}\\nif (!horzSpan)\\n{\\nlumaS=lumaE;\\n}\\nif (horzSpan)\\n{\\nlengthSign=texelSize.y;\\n}\\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\\nfloat gradientN=lumaN-lumaM;\\nfloat gradientS=lumaS-lumaM;\\nfloat lumaNN=lumaN+lumaM;\\nfloat lumaSS=lumaS+lumaM;\\nbool pairN=abs(gradientN)>=abs(gradientS);\\nfloat gradient=max(abs(gradientN),abs(gradientS));\\nif (pairN)\\n{\\nlengthSign=-lengthSign;\\n}\\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\\nvec2 posB;\\nposB.x=posM.x;\\nposB.y=posM.y;\\nvec2 offNP;\\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\\nif (!horzSpan)\\n{\\nposB.x+=lengthSign*0.5;\\n}\\nif (horzSpan)\\n{\\nposB.y+=lengthSign*0.5;\\n}\\nvec2 posN;\\nposN.x=posB.x-offNP.x*1.5;\\nposN.y=posB.y-offNP.y*1.5;\\nvec2 posP;\\nposP.x=posB.x+offNP.x*1.5;\\nposP.y=posB.y+offNP.y*1.5;\\nfloat subpixD=((-2.0)*subpixC)+3.0;\\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\\nfloat subpixE=subpixC*subpixC;\\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\\nif (!pairN)\\n{\\nlumaNN=lumaSS;\\n}\\nfloat gradientScaled=gradient*1.0/4.0;\\nfloat lumaMM=lumaM-lumaNN*0.5;\\nfloat subpixF=subpixD*subpixE;\\nbool lumaMLTZero=lumaMM<0.0;\\nlumaEndN-=lumaNN*0.5;\\nlumaEndP-=lumaNN*0.5;\\nbool doneN=abs(lumaEndN)>=gradientScaled;\\nbool doneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN)\\n{\\nposN.x-=offNP.x*3.0;\\n}\\nif (!doneN)\\n{\\nposN.y-=offNP.y*3.0;\\n}\\nbool doneNP=(!doneN) || (!doneP);\\nif (!doneP)\\n{\\nposP.x+=offNP.x*3.0;\\n}\\nif (!doneP)\\n{\\nposP.y+=offNP.y*3.0;\\n}\\nif (doneNP)\\n{\\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\\ndoneN=abs(lumaEndN)>=gradientScaled;\\ndoneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN) posN.x-=offNP.x*12.0;\\nif (!doneN) posN.y-=offNP.y*12.0;\\ndoneNP=(!doneN) || (!doneP);\\nif (!doneP) posP.x+=offNP.x*12.0;\\nif (!doneP) posP.y+=offNP.y*12.0;\\n}\\nfloat dstN=posM.x-posN.x;\\nfloat dstP=posP.x-posM.x;\\nif (!horzSpan)\\n{\\ndstN=posM.y-posN.y;\\n}\\nif (!horzSpan)\\n{\\ndstP=posP.y-posM.y;\\n}\\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\\nfloat spanLength=(dstP+dstN);\\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\\nfloat spanLengthRcp=1.0/spanLength;\\nbool directionN=dstN[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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar geometryPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/geometry.vertex.ts\":\n/*!************************************!*\\\n !*** ./Shaders/geometry.vertex.ts ***!\n \\************************************/\n/*! exports provided: geometryVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"geometryVertexShader\", function() { return geometryVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'geometryVertexShader';\r\nvar shader = \"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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar geometryVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowBlurPostProcess.fragment.ts\":\n/*!*************************************************!*\\\n !*** ./Shaders/glowBlurPostProcess.fragment.ts ***!\n \\*************************************************/\n/*! exports provided: glowBlurPostProcessPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowBlurPostProcessPixelShader\", function() { return glowBlurPostProcessPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowBlurPostProcessPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform vec2 screenSize;\\nuniform vec2 direction;\\nuniform float blurWidth;\\n\\nfloat getLuminance(vec3 color)\\n{\\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\\n}\\nvoid main(void)\\n{\\nfloat weights[7];\\nweights[0]=0.05;\\nweights[1]=0.1;\\nweights[2]=0.2;\\nweights[3]=0.3;\\nweights[4]=0.2;\\nweights[5]=0.1;\\nweights[6]=0.05;\\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\\nvec2 texelStep=texelSize*direction*blurWidth;\\nvec2 start=vUV-3.0*texelStep;\\nvec4 baseColor=vec4(0.,0.,0.,0.);\\nvec2 texelOffset=vec2(0.,0.);\\nfor (int i=0; i<7; i++)\\n{\\n\\nvec4 texel=texture2D(textureSampler,start+texelOffset);\\nbaseColor.a+=texel.a*weights[i];\\n\\nfloat luminance=getLuminance(baseColor.rgb);\\nfloat luminanceTexel=getLuminance(texel.rgb);\\nfloat choice=step(luminanceTexel,luminance);\\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\\ntexelOffset+=texelStep;\\n}\\ngl_FragColor=baseColor;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowBlurPostProcessPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowMapGeneration.fragment.ts\":\n/*!***********************************************!*\\\n !*** ./Shaders/glowMapGeneration.fragment.ts ***!\n \\***********************************************/\n/*! exports provided: glowMapGenerationPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowMapGenerationPixelShader\", function() { return glowMapGenerationPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowMapGenerationPixelShader';\r\nvar shader = \"#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.a\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n\\n#include\\nuniform mat4 viewProjection;\\nvarying vec4 vPosition;\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef DIFFUSE\\nvarying vec2 vUVDiffuse;\\nuniform mat4 diffuseMatrix;\\n#endif\\n#ifdef OPACITY\\nvarying vec2 vUVOpacity;\\nuniform mat4 opacityMatrix;\\n#endif\\n#ifdef EMISSIVE\\nvarying vec2 vUVEmissive;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef VERTEXALPHA\\nattribute vec4 color;\\nvarying vec4 vColor;\\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\\n#ifdef CUBEMAP\\nvPosition=finalWorld*vec4(positionUpdated,1.0);\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n#else\\nvPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\ngl_Position=vPosition;\\n#endif\\n#ifdef DIFFUSE\\n#ifdef DIFFUSEUV1\\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef DIFFUSEUV2\\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef OPACITY\\n#ifdef OPACITYUV1\\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef OPACITYUV2\\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef EMISSIVE\\n#ifdef EMISSIVEUV1\\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef EMISSIVEUV2\\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef VERTEXALPHA\\nvColor=color;\\n#endif\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowMapGenerationVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowMapMerge.fragment.ts\":\n/*!******************************************!*\\\n !*** ./Shaders/glowMapMerge.fragment.ts ***!\n \\******************************************/\n/*! exports provided: glowMapMergePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowMapMergePixelShader\", function() { return glowMapMergePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowMapMergePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#ifdef EMISSIVE\\nuniform sampler2D textureSampler2;\\n#endif\\n\\nuniform float offset;\\nvoid main(void) {\\nvec4 baseColor=texture2D(textureSampler,vUV);\\n#ifdef EMISSIVE\\nbaseColor+=texture2D(textureSampler2,vUV);\\nbaseColor*=offset;\\n#else\\nbaseColor.a=abs(offset-baseColor.a);\\n#ifdef STROKE\\nfloat alpha=smoothstep(.0,.1,baseColor.a);\\nbaseColor.a=alpha;\\nbaseColor.rgb=baseColor.rgb*alpha;\\n#endif\\n#endif\\ngl_FragColor=baseColor;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowMapMergePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/glowMapMerge.vertex.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/glowMapMerge.vertex.ts ***!\n \\****************************************/\n/*! exports provided: glowMapMergeVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"glowMapMergeVertexShader\", function() { return glowMapMergeVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'glowMapMergeVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvUV=position*madd+madd;\\ngl_Position=vec4(position,0.0,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar glowMapMergeVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuRenderParticles.fragment.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/gpuRenderParticles.fragment.ts ***!\n \\************************************************/\n/*! exports provided: gpuRenderParticlesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuRenderParticlesPixelShader\", function() { return gpuRenderParticlesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration2 */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration2.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'gpuRenderParticlesPixelShader';\r\nvar shader = \"#version 300 es\\nuniform sampler2D textureSampler;\\nin vec2 vUV;\\nin vec4 vColor;\\nout vec4 outFragColor;\\n#include\\n#include\\n#include\\n#include\\nvoid main() {\\n#include\\nvec4 textureColor=texture(textureSampler,vUV);\\noutFragColor=textureColor*vColor;\\n#ifdef BLENDMULTIPLYMODE\\nfloat alpha=vColor.a*textureColor.a;\\noutFragColor.rgb=outFragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\\n#endif\\n\\n\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\\n#else\\n#ifdef IMAGEPROCESSING\\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\\noutFragColor=applyImageProcessing(outFragColor);\\n#endif\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuRenderParticlesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuRenderParticles.vertex.ts\":\n/*!**********************************************!*\\\n !*** ./Shaders/gpuRenderParticles.vertex.ts ***!\n \\**********************************************/\n/*! exports provided: gpuRenderParticlesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuRenderParticlesVertexShader\", function() { return gpuRenderParticlesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration2 */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration2.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n\r\n\r\n\r\nvar name = 'gpuRenderParticlesVertexShader';\r\nvar shader = \"#version 300 es\\nuniform mat4 view;\\nuniform mat4 projection;\\nuniform vec2 translationPivot;\\nuniform vec3 worldOffset;\\n\\nin vec3 position;\\nin float age;\\nin float life;\\nin vec3 size;\\n#ifndef BILLBOARD\\nin vec3 initialDirection;\\n#endif\\n#ifdef BILLBOARDSTRETCHED\\nin vec3 direction;\\n#endif\\nin float angle;\\n#ifdef ANIMATESHEET\\nin float cellIndex;\\n#endif\\nin vec2 offset;\\nin vec2 uv;\\nout vec2 vUV;\\nout vec4 vColor;\\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\\nuniform mat4 invView;\\n#endif\\n#include\\n#ifdef COLORGRADIENTS\\nuniform sampler2D colorGradientSampler;\\n#else\\nuniform vec4 colorDead;\\nin vec4 color;\\n#endif\\n#ifdef ANIMATESHEET\\nuniform vec3 sheetInfos;\\n#endif\\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+worldOffset)+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+worldOffset)+alignedCorner;\\n}\\n#endif\\nvoid main() {\\n#ifdef ANIMATESHEET\\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\\nvec2 uvScale=sheetInfos.xy;\\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\\n#else\\nvUV=uv;\\n#endif\\nfloat ratio=age/life;\\n#ifdef COLORGRADIENTS\\nvColor=texture(colorGradientSampler,vec2(ratio,0));\\n#else\\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\\n#endif\\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\\n#ifdef BILLBOARD\\nvec4 rotatedCorner;\\nrotatedCorner.w=0.;\\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+worldOffset)-eyePosition;\\nyaxis.y=0.;\\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner.xyz);\\nvec4 viewPosition=(view*vec4(worldPos,1.0));\\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+worldOffset)-eyePosition;\\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner.xyz);\\nvec4 viewPosition=(view*vec4(worldPos,1.0));\\n#else\\n\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.z=0.;\\n\\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\\n#endif\\n#else\\n\\nvec3 rotatedCorner;\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=0.;\\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nvec3 yaxis=normalize(initialDirection);\\nvec3 worldPos=rotate(yaxis,rotatedCorner);\\n\\nvec4 viewPosition=view*vec4(worldPos,1.0);\\n#endif\\ngl_Position=projection*viewPosition;\\n\\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\\nvec4 worldPos=invView*viewPosition;\\n#endif\\n#include\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuRenderParticlesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuUpdateParticles.fragment.ts\":\n/*!************************************************!*\\\n !*** ./Shaders/gpuUpdateParticles.fragment.ts ***!\n \\************************************************/\n/*! exports provided: gpuUpdateParticlesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuUpdateParticlesPixelShader\", function() { return gpuUpdateParticlesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'gpuUpdateParticlesPixelShader';\r\nvar shader = \"#version 300 es\\nvoid main() {\\ndiscard;\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuUpdateParticlesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/gpuUpdateParticles.vertex.ts\":\n/*!**********************************************!*\\\n !*** ./Shaders/gpuUpdateParticles.vertex.ts ***!\n \\**********************************************/\n/*! exports provided: gpuUpdateParticlesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gpuUpdateParticlesVertexShader\", function() { return gpuUpdateParticlesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'gpuUpdateParticlesVertexShader';\r\nvar shader = \"#version 300 es\\n#define PI 3.14159\\nuniform float currentCount;\\nuniform float timeDelta;\\nuniform float stopFactor;\\nuniform mat4 emitterWM;\\nuniform vec2 lifeTime;\\nuniform vec2 emitPower;\\nuniform vec2 sizeRange;\\nuniform vec4 scaleRange;\\n#ifndef COLORGRADIENTS\\nuniform vec4 color1;\\nuniform vec4 color2;\\n#endif\\nuniform vec3 gravity;\\nuniform sampler2D randomSampler;\\nuniform sampler2D randomSampler2;\\nuniform vec4 angleRange;\\n#ifdef BOXEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\nuniform vec3 minEmitBox;\\nuniform vec3 maxEmitBox;\\n#endif\\n#ifdef POINTEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#endif\\n#ifdef HEMISPHERICEMITTER\\nuniform float radius;\\nuniform float radiusRange;\\nuniform float directionRandomizer;\\n#endif\\n#ifdef SPHEREEMITTER\\nuniform float radius;\\nuniform float radiusRange;\\n#ifdef DIRECTEDSPHEREEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#else\\nuniform float directionRandomizer;\\n#endif\\n#endif\\n#ifdef CYLINDEREMITTER\\nuniform float radius;\\nuniform float height;\\nuniform float radiusRange;\\n#ifdef DIRECTEDCYLINDEREMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#else\\nuniform float directionRandomizer;\\n#endif\\n#endif\\n#ifdef CONEEMITTER\\nuniform vec2 radius;\\nuniform float coneAngle;\\nuniform vec2 height;\\nuniform float directionRandomizer;\\n#endif\\n\\nin vec3 position;\\nin float age;\\nin float life;\\nin vec4 seed;\\nin vec3 size;\\n#ifndef COLORGRADIENTS\\nin vec4 color;\\n#endif\\nin vec3 direction;\\n#ifndef BILLBOARD\\nin vec3 initialDirection;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nin float angle;\\n#else\\nin vec2 angle;\\n#endif\\n#ifdef ANIMATESHEET\\nin float cellIndex;\\n#ifdef ANIMATESHEETRANDOMSTART\\nin float cellStartOffset;\\n#endif\\n#endif\\n#ifdef NOISE\\nin vec3 noiseCoordinates1;\\nin vec3 noiseCoordinates2;\\n#endif\\n\\nout vec3 outPosition;\\nout float outAge;\\nout float outLife;\\nout vec4 outSeed;\\nout vec3 outSize;\\n#ifndef COLORGRADIENTS\\nout vec4 outColor;\\n#endif\\nout vec3 outDirection;\\n#ifndef BILLBOARD\\nout vec3 outInitialDirection;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nout float outAngle;\\n#else\\nout vec2 outAngle;\\n#endif\\n#ifdef ANIMATESHEET\\nout float outCellIndex;\\n#ifdef ANIMATESHEETRANDOMSTART\\nout float outCellStartOffset;\\n#endif\\n#endif\\n#ifdef NOISE\\nout vec3 outNoiseCoordinates1;\\nout vec3 outNoiseCoordinates2;\\n#endif\\n#ifdef SIZEGRADIENTS\\nuniform sampler2D sizeGradientSampler;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nuniform sampler2D angularSpeedGradientSampler;\\n#endif\\n#ifdef VELOCITYGRADIENTS\\nuniform sampler2D velocityGradientSampler;\\n#endif\\n#ifdef LIMITVELOCITYGRADIENTS\\nuniform sampler2D limitVelocityGradientSampler;\\nuniform float limitVelocityDamping;\\n#endif\\n#ifdef DRAGGRADIENTS\\nuniform sampler2D dragGradientSampler;\\n#endif\\n#ifdef NOISE\\nuniform vec3 noiseStrength;\\nuniform sampler2D noiseSampler;\\n#endif\\n#ifdef ANIMATESHEET\\nuniform vec3 cellInfos;\\n#endif\\nvec3 getRandomVec3(float offset) {\\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\\n}\\nvec4 getRandomVec4(float offset) {\\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\\n}\\nvoid main() {\\nfloat newAge=age+timeDelta;\\n\\nif (newAge>=life && stopFactor != 0.) {\\nvec3 position;\\nvec3 direction;\\n\\nvec4 randoms=getRandomVec4(seed.x);\\n\\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\\noutAge=mod(newAge,outLife);\\n\\noutSeed=seed;\\n\\n#ifdef SIZEGRADIENTS\\noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\\n#else\\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\\n#endif\\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a;\\n#ifndef COLORGRADIENTS\\n\\noutColor=color1+(color2-color1)*randoms.b;\\n#endif\\n\\n#ifndef ANGULARSPEEDGRADIENTS\\noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\\n#else\\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\\n#endif\\n\\n#ifdef POINTEMITTER\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nposition=vec3(0,0,0);\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#elif defined(BOXEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nposition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#elif defined(HEMISPHERICEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\n\\nfloat phi=2.0*PI*randoms2.x;\\nfloat theta=acos(2.0*randoms2.y-1.0);\\nfloat randX=cos(phi)*sin(theta);\\nfloat randY=cos(theta);\\nfloat randZ=sin(phi)*sin(theta);\\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\\ndirection=position+directionRandomizer*randoms3;\\n#elif defined(SPHEREEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\n\\nfloat phi=2.0*PI*randoms2.x;\\nfloat theta=acos(2.0*randoms2.y-1.0);\\nfloat randX=cos(phi)*sin(theta);\\nfloat randY=cos(theta);\\nfloat randZ=sin(phi)*sin(theta);\\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\\n#ifdef DIRECTEDSPHEREEMITTER\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#else\\n\\ndirection=position+directionRandomizer*randoms3;\\n#endif\\n#elif defined(CYLINDEREMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\n\\nfloat yPos=(randoms2.x-0.5)*height;\\nfloat angle=randoms2.y*PI*2.;\\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\\nfloat xPos=positionRadius*cos(angle);\\nfloat zPos=positionRadius*sin(angle);\\nposition=vec3(xPos,yPos,zPos);\\n#ifdef DIRECTEDCYLINDEREMITTER\\ndirection=direction1+(direction2-direction1)*randoms3;\\n#else\\n\\nangle=angle+((randoms3.x-0.5)*PI);\\ndirection=vec3(cos(angle),randoms3.y-0.5,sin(angle));\\ndirection=normalize(direction);\\n#endif\\n#elif defined(CONEEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nfloat s=2.0*PI*randoms2.x;\\n#ifdef CONEEMITTERSPAWNPOINT\\nfloat h=0.0001;\\n#else\\nfloat h=randoms2.y*height.y;\\n\\nh=1.-h*h;\\n#endif\\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\\nlRadius=lRadius*h;\\nfloat randX=lRadius*sin(s);\\nfloat randZ=lRadius*cos(s);\\nfloat randY=h*height.x;\\nposition=vec3(randX,randY,randZ);\\n\\nif (abs(cos(coneAngle)) == 1.0) {\\ndirection=vec3(0.,1.0,0.);\\n} else {\\nvec3 randoms3=getRandomVec3(seed.z);\\ndirection=normalize(position+directionRandomizer*randoms3);\\n}\\n#else\\n\\nposition=vec3(0.,0.,0.);\\n\\ndirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\\n#endif\\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\\noutPosition=(emitterWM*vec4(position,1.)).xyz;\\nvec3 initial=(emitterWM*vec4(direction,0.)).xyz;\\noutDirection=initial*power;\\n#ifndef BILLBOARD\\noutInitialDirection=initial;\\n#endif\\n#ifdef ANIMATESHEET\\noutCellIndex=cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\noutCellStartOffset=randoms.a*outLife;\\n#endif\\n#endif\\n#ifdef NOISE\\noutNoiseCoordinates1=noiseCoordinates1;\\noutNoiseCoordinates2=noiseCoordinates2;\\n#endif\\n} else {\\nfloat directionScale=timeDelta;\\noutAge=newAge;\\nfloat ageGradient=newAge/life;\\n#ifdef VELOCITYGRADIENTS\\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\\n#endif\\n#ifdef DRAGGRADIENTS\\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\\n#endif\\noutPosition=position+direction*directionScale;\\noutLife=life;\\noutSeed=seed;\\n#ifndef COLORGRADIENTS\\noutColor=color;\\n#endif\\n#ifdef SIZEGRADIENTS\\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\\noutSize.yz=size.yz;\\n#else\\noutSize=size;\\n#endif\\n#ifndef BILLBOARD\\noutInitialDirection=initialDirection;\\n#endif\\nvec3 updatedDirection=direction+gravity*timeDelta;\\n#ifdef LIMITVELOCITYGRADIENTS\\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\\nfloat currentVelocity=length(updatedDirection);\\nif (currentVelocity>limitVelocity) {\\nupdatedDirection=updatedDirection*limitVelocityDamping;\\n}\\n#endif\\noutDirection=updatedDirection;\\n#ifdef NOISE\\nvec3 localPosition=outPosition-emitterWM[3].xyz;\\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\\noutDirection=outDirection+force*timeDelta;\\noutNoiseCoordinates1=noiseCoordinates1;\\noutNoiseCoordinates2=noiseCoordinates2;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\\noutAngle=angle+angularSpeed*timeDelta;\\n#else\\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\\n#endif\\n#ifdef ANIMATESHEET\\nfloat offsetAge=outAge;\\nfloat dist=cellInfos.y-cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\noutCellStartOffset=cellStartOffset;\\noffsetAge+=cellStartOffset;\\n#endif\\nfloat ratio=clamp(mod(offsetAge*cellInfos.z,life)/life,0.,1.0);\\noutCellIndex=float(int(cellInfos.x+ratio*dist));\\n#endif\\n}\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar gpuUpdateParticlesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/grain.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/grain.fragment.ts ***!\n \\***********************************/\n/*! exports provided: grainPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"grainPixelShader\", function() { return grainPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'grainPixelShader';\r\nvar shader = \"#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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar grainPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/highlights.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/highlights.fragment.ts ***!\n \\****************************************/\n/*! exports provided: highlightsPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"highlightsPixelShader\", function() { return highlightsPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'highlightsPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar highlightsPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/imageProcessing.fragment.ts\":\n/*!*********************************************!*\\\n !*** ./Shaders/imageProcessing.fragment.ts ***!\n \\*********************************************/\n/*! exports provided: imageProcessingPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"imageProcessingPixelShader\", function() { return imageProcessingPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n\r\n\r\n\r\n\r\nvar name = 'imageProcessingPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar imageProcessingPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/kernelBlur.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/kernelBlur.fragment.ts ***!\n \\****************************************/\n/*! exports provided: kernelBlurPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurPixelShader\", function() { return kernelBlurPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurVaryingDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurVaryingDeclaration */ \"./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_packingFunctions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/packingFunctions */ \"./Shaders/ShadersInclude/packingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurFragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurFragment */ \"./Shaders/ShadersInclude/kernelBlurFragment.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurFragment2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurFragment2 */ \"./Shaders/ShadersInclude/kernelBlurFragment2.ts\");\n\r\n\r\n\r\n\r\n\r\nvar name = 'kernelBlurPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/kernelBlur.vertex.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/kernelBlur.vertex.ts ***!\n \\**************************************/\n/*! exports provided: kernelBlurVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"kernelBlurVertexShader\", function() { return kernelBlurVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurVaryingDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurVaryingDeclaration */ \"./Shaders/ShadersInclude/kernelBlurVaryingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_kernelBlurVertex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/kernelBlurVertex */ \"./Shaders/ShadersInclude/kernelBlurVertex.ts\");\n\r\n\r\n\r\nvar name = 'kernelBlurVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar kernelBlurVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/layer.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/layer.fragment.ts ***!\n \\***********************************/\n/*! exports provided: layerPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"layerPixelShader\", function() { return layerPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'layerPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar layerPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/layer.vertex.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/layer.vertex.ts ***!\n \\*********************************/\n/*! exports provided: layerVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"layerVertexShader\", function() { return layerVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'layerVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar layerVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/lensFlare.fragment.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/lensFlare.fragment.ts ***!\n \\***************************************/\n/*! exports provided: lensFlarePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lensFlarePixelShader\", function() { return lensFlarePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lensFlarePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform vec4 color;\\nvoid main(void) {\\nvec4 baseColor=texture2D(textureSampler,vUV);\\ngl_FragColor=baseColor*color;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lensFlarePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/lensFlare.vertex.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/lensFlare.vertex.ts ***!\n \\*************************************/\n/*! exports provided: lensFlareVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lensFlareVertexShader\", function() { return lensFlareVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lensFlareVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lensFlareVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/lensHighlights.fragment.ts\":\n/*!********************************************!*\\\n !*** ./Shaders/lensHighlights.fragment.ts ***!\n \\********************************************/\n/*! exports provided: lensHighlightsPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lensHighlightsPixelShader\", function() { return lensHighlightsPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lensHighlightsPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\n\\nuniform float gain;\\nuniform float threshold;\\nuniform float screen_width;\\nuniform float screen_height;\\n\\nvarying vec2 vUV;\\n\\nvec4 highlightColor(vec4 color) {\\nvec4 highlight=color;\\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\\nfloat lum_threshold;\\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\\nelse { lum_threshold=0.5+0.44*threshold; }\\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\\nhighlight*=luminance*gain;\\nhighlight.a=1.0;\\nreturn highlight;\\n}\\nvoid main(void)\\n{\\nvec4 original=texture2D(textureSampler,vUV);\\n\\nif (gain == -1.0) {\\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\\nreturn;\\n}\\nfloat w=2.0/screen_width;\\nfloat h=2.0/screen_height;\\nfloat weight=1.0;\\n\\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\\n#ifdef PENTAGON\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\\n#else\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\\n#endif\\nblurred/=39.0;\\ngl_FragColor=blurred;\\n\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lensHighlightsPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/line.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/line.fragment.ts ***!\n \\**********************************/\n/*! exports provided: linePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"linePixelShader\", function() { return linePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'linePixelShader';\r\nvar shader = \"uniform vec4 color;\\nvoid main(void) {\\ngl_FragColor=color;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar linePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/line.vertex.ts\":\n/*!********************************!*\\\n !*** ./Shaders/line.vertex.ts ***!\n \\********************************/\n/*! exports provided: lineVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lineVertexShader\", function() { return lineVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'lineVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar lineVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/motionBlur.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/motionBlur.fragment.ts ***!\n \\****************************************/\n/*! exports provided: motionBlurPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"motionBlurPixelShader\", function() { return motionBlurPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'motionBlurPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D velocitySampler;\\nuniform float motionStrength;\\nuniform float motionScale;\\nuniform vec2 screenSize;\\nvoid main(void)\\n{\\n#ifdef GEOMETRY_SUPPORTED\\nvec2 texelSize=1.0/screenSize;\\nvec2 velocityColor=texture2D(velocitySampler,vUV).rg*2.0-1.0;\\nvec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0));\\nvelocity*=motionScale*motionStrength;\\nfloat speed=length(velocity/texelSize);\\nint samplesCount=int(clamp(speed,1.0,SAMPLES));\\nvelocity=normalize(velocity)*texelSize;\\nfloat hlim=float(-samplesCount)*0.5+0.5;\\nvec4 result=texture2D(textureSampler,vUV);\\nfor (int i=1; i=samplesCount)\\nbreak;\\nvec2 offset=vUV+velocity*(hlim+float(i));\\nresult+=texture2D(textureSampler,offset);\\n}\\ngl_FragColor=result/float(samplesCount);\\ngl_FragColor.a=1.0;\\n#else\\ngl_FragColor=texture2D(textureSampler,vUV);\\n#endif\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar motionBlurPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/noise.fragment.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/noise.fragment.ts ***!\n \\***********************************/\n/*! exports provided: noisePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"noisePixelShader\", function() { return noisePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'noisePixelShader';\r\nvar shader = \"\\n\\nuniform float brightness;\\nuniform float persistence;\\nuniform float timeScale;\\n\\nvarying vec2 vUV;\\n\\nvec2 hash22(vec2 p)\\n{\\np=p*mat2(127.1,311.7,269.5,183.3);\\np=-1.0+2.0*fract(sin(p)*43758.5453123);\\nreturn sin(p*6.283+timeScale);\\n}\\nfloat interpolationNoise(vec2 p)\\n{\\nvec2 pi=floor(p);\\nvec2 pf=p-pi;\\nvec2 w=pf*pf*(3.-2.*pf);\\nfloat f00=dot(hash22(pi+vec2(.0,.0)),pf-vec2(.0,.0));\\nfloat f01=dot(hash22(pi+vec2(.0,1.)),pf-vec2(.0,1.));\\nfloat f10=dot(hash22(pi+vec2(1.0,0.)),pf-vec2(1.0,0.));\\nfloat f11=dot(hash22(pi+vec2(1.0,1.)),pf-vec2(1.0,1.));\\nfloat xm1=mix(f00,f10,w.x);\\nfloat xm2=mix(f01,f11,w.x);\\nfloat ym=mix(xm1,xm2,w.y);\\nreturn ym;\\n}\\nfloat perlinNoise2D(float x,float y)\\n{\\nfloat sum=0.0;\\nfloat frequency=0.0;\\nfloat amplitude=0.0;\\nfor(int i=0; i\\nvoid main(void) {\\n#ifdef ALPHATEST\\nif (texture2D(diffuseSampler,vUV).a<0.4)\\ndiscard;\\n#endif\\n#include\\ngl_FragColor=color;\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar outlinePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/outline.vertex.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/outline.vertex.ts ***!\n \\***********************************/\n/*! exports provided: outlineVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"outlineVertexShader\", function() { return outlineVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_logDepthVertex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/logDepthVertex */ \"./Shaders/ShadersInclude/logDepthVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'outlineVertexShader';\r\nvar shader = \"\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar outlineVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/particles.fragment.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/particles.fragment.ts ***!\n \\***************************************/\n/*! exports provided: particlesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"particlesPixelShader\", function() { return particlesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'particlesPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar particlesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/particles.vertex.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/particles.vertex.ts ***!\n \\*************************************/\n/*! exports provided: particlesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"particlesVertexShader\", function() { return particlesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n\r\n\r\n\r\nvar name = 'particlesVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar particlesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/pass.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/pass.fragment.ts ***!\n \\**********************************/\n/*! exports provided: passPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"passPixelShader\", function() { return passPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'passPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar passPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/passCube.fragment.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/passCube.fragment.ts ***!\n \\**************************************/\n/*! exports provided: passCubePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"passCubePixelShader\", function() { return passCubePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'passCubePixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar passCubePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/pbr.fragment.ts\":\n/*!*********************************!*\\\n !*** ./Shaders/pbr.fragment.ts ***!\n \\*********************************/\n/*! exports provided: pbrPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrPixelShader\", function() { return pbrPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_pbrFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/pbrFragmentDeclaration */ \"./Shaders/ShadersInclude/pbrFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/pbrUboDeclaration */ \"./Shaders/ShadersInclude/pbrUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrFragmentExtraDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/pbrFragmentExtraDeclaration */ \"./Shaders/ShadersInclude/pbrFragmentExtraDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrFragmentSamplersDeclaration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/pbrFragmentSamplersDeclaration */ \"./Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingDeclaration */ \"./Shaders/ShadersInclude/imageProcessingDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragmentDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragmentDeclaration */ \"./Shaders/ShadersInclude/clipPlaneFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogFragmentDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/fogFragmentDeclaration */ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrHelperFunctions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/pbrHelperFunctions */ \"./Shaders/ShadersInclude/pbrHelperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_imageProcessingFunctions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/imageProcessingFunctions */ \"./Shaders/ShadersInclude/imageProcessingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_shadowsFragmentFunctions__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/shadowsFragmentFunctions */ \"./Shaders/ShadersInclude/shadowsFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_harmonicsFunctions__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/harmonicsFunctions */ \"./Shaders/ShadersInclude/harmonicsFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrDirectLightingSetupFunctions__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/pbrDirectLightingSetupFunctions */ \"./Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrDirectLightingFalloffFunctions__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/pbrDirectLightingFalloffFunctions */ \"./Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrBRDFFunctions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/pbrBRDFFunctions */ \"./Shaders/ShadersInclude/pbrBRDFFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrDirectLightingFunctions__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/pbrDirectLightingFunctions */ \"./Shaders/ShadersInclude/pbrDirectLightingFunctions.ts\");\n/* harmony import */ var _ShadersInclude_pbrIBLFunctions__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/pbrIBLFunctions */ \"./Shaders/ShadersInclude/pbrIBLFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragmentFunctions__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/bumpFragmentFunctions */ \"./Shaders/ShadersInclude/bumpFragmentFunctions.ts\");\n/* harmony import */ var _ShadersInclude_reflectionFunction__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ShadersInclude/reflectionFunction */ \"./Shaders/ShadersInclude/reflectionFunction.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneFragment__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneFragment */ \"./Shaders/ShadersInclude/clipPlaneFragment.ts\");\n/* harmony import */ var _ShadersInclude_bumpFragment__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./ShadersInclude/bumpFragment */ \"./Shaders/ShadersInclude/bumpFragment.ts\");\n/* harmony import */ var _ShadersInclude_depthPrePass__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./ShadersInclude/depthPrePass */ \"./Shaders/ShadersInclude/depthPrePass.ts\");\n/* harmony import */ var _ShadersInclude_lightFragment__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./ShadersInclude/lightFragment */ \"./Shaders/ShadersInclude/lightFragment.ts\");\n/* harmony import */ var _ShadersInclude_logDepthFragment__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./ShadersInclude/logDepthFragment */ \"./Shaders/ShadersInclude/logDepthFragment.ts\");\n/* harmony import */ var _ShadersInclude_fogFragment__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./ShadersInclude/fogFragment */ \"./Shaders/ShadersInclude/fogFragment.ts\");\n/* harmony import */ var _ShadersInclude_pbrDebug__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./ShadersInclude/pbrDebug */ \"./Shaders/ShadersInclude/pbrDebug.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'pbrPixelShader';\r\nvar shader = \"#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n#extension GL_EXT_shader_texture_lod : enable\\n#endif\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\nprecision highp float;\\n\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE\\n#endif\\n\\n#include<__decl__pbrFragment>\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#ifdef REFLECTION\\n#include\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\n\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\n\\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#endif\\n#ifdef CLEARCOAT\\n\\nvec3 clearCoatNormalW=normalW;\\n#endif\\n#include\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#if defined(TWOSIDEDLIGHTING)\\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\\n#endif\\nnormalW*=sign(dot(normalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n\\n\\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\\n\\nfloat alpha=vAlbedoColor.a;\\n#ifdef ALBEDO\\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\\nalpha*=albedoTexture.a;\\n#endif\\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\\nsurfaceAlbedo*=vAlbedoInfos.y;\\n#endif\\n#ifdef VERTEXCOLOR\\nsurfaceAlbedo*=vColor.rgb;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\\n\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#ifdef OPACITYRGB\\nalpha=getLuminance(opacityMap.rgb);\\n#else\\nalpha*=opacityMap.a;\\n#endif\\nalpha*=vOpacityInfos.y;\\n#endif\\n#ifdef VERTEXALPHA\\nalpha*=vColor.a;\\n#endif\\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\\n#ifdef ALPHATEST\\nif (alpha\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\n\\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\\n#ifdef AMBIENTINGRAYSCALE\\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\\n#endif\\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\\n#endif\\n#ifdef UNLIT\\nvec3 diffuseBase=vec3(1.,1.,1.);\\n#else\\n\\nfloat microSurface=vReflectivityColor.a;\\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\\n#ifdef REFLECTIVITY\\nvec4 surfaceMetallicColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\\n#ifdef AOSTOREINMETALMAPRED\\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicColorMap.r,surfaceMetallicColorMap.r,surfaceMetallicColorMap.r);\\nambientOcclusionColor=mix(ambientOcclusionColor,aoStoreInMetalMap,vReflectivityInfos.z);\\n#endif\\n#ifdef METALLNESSSTOREINMETALMAPBLUE\\nmetallicRoughness.r*=surfaceMetallicColorMap.b;\\n#else\\nmetallicRoughness.r*=surfaceMetallicColorMap.r;\\n#endif\\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\\nmetallicRoughness.g*=surfaceMetallicColorMap.a;\\n#else\\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\\nmetallicRoughness.g*=surfaceMetallicColorMap.g;\\n#endif\\n#endif\\n#endif\\n#ifdef MICROSURFACEMAP\\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\\nmetallicRoughness.g*=microSurfaceTexel.r;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\\n\\nmicroSurface=1.0-metallicRoughness.g;\\n\\nvec3 baseColor=surfaceAlbedo;\\n#ifdef REFLECTANCE\\n\\n\\n\\n\\n\\nsurfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\\n#else\\n\\n\\n\\nconst vec3 DefaultSpecularReflectanceDielectric=vec3(0.04,0.04,0.04);\\n\\nsurfaceAlbedo=mix(baseColor.rgb*(1.0-DefaultSpecularReflectanceDielectric.r),vec3(0.,0.,0.),metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(DefaultSpecularReflectanceDielectric,baseColor,metallicRoughness.r);\\n#endif\\n#else\\n#ifdef REFLECTIVITY\\nvec4 surfaceReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\\nsurfaceReflectivityColor*=toLinearSpace(surfaceReflectivityColorMap.rgb);\\nsurfaceReflectivityColor*=vReflectivityInfos.y;\\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\\nmicroSurface*=surfaceReflectivityColorMap.a;\\nmicroSurface*=vReflectivityInfos.z;\\n#else\\n#ifdef MICROSURFACEAUTOMATIC\\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\\n#endif\\n#ifdef MICROSURFACEMAP\\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\\nmicroSurface*=microSurfaceTexel.r;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\\n#endif\\n#endif\\n#endif\\n\\nmicroSurface=saturate(microSurface);\\n\\nfloat roughness=1.-microSurface;\\n\\n#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\n\\n\\n\\nfloat opacityPerceptual=alpha;\\n#ifdef LINEARALPHAFRESNEL\\nfloat opacity0=opacityPerceptual;\\n#else\\nfloat opacity0=opacityPerceptual*opacityPerceptual;\\n#endif\\nfloat opacity90=fresnelGrazingReflectance(opacity0);\\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\\n\\nalpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\\n#ifdef ALPHATEST\\nif (alpha[0..maxSimultaneousLights]\\n\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(specularEnvironmentR0,environmentBrdf);\\n#ifdef RADIANCEOCCLUSION\\n#ifdef AMBIENTINGRAYSCALE\\nfloat ambientMonochrome=ambientOcclusionColor.r;\\n#else\\nfloat ambientMonochrome=getLuminance(ambientOcclusionColor);\\n#endif\\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\\nspecularEnvironmentReflectance*=seo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW);\\nspecularEnvironmentReflectance*=eho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\\n#endif\\n\\n#if defined(SHEEN) && defined(REFLECTION)\\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentBrdf);\\n#ifdef RADIANCEOCCLUSION\\nsheenEnvironmentReflectance*=seo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nsheenEnvironmentReflectance*=eho;\\n#endif\\n#endif\\n#endif\\n#endif\\n\\n#ifdef CLEARCOAT\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n\\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\\n#ifdef RADIANCEOCCLUSION\\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\\nclearCoatEnvironmentReflectance*=clearCoatSeo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW);\\nclearCoatEnvironmentReflectance*=clearCoatEho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\\n#endif\\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\\n#if defined(REFLECTION) && defined(CLEARCOAT_TINT)\\n\\nabsorption=computeClearCoatAbsorption(clearCoatNdotVRefract,clearCoatNdotVRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\\n#ifdef REFLECTION\\nenvironmentIrradiance*=absorption;\\n#endif\\n#ifdef SHEEN\\nsheenEnvironmentReflectance*=absorption;\\n#endif\\nspecularEnvironmentReflectance*=absorption;\\n#endif\\n\\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnelIBLClearCoat*=clearCoatIntensity;\\nfloat conservationFactor=(1.-fresnelIBLClearCoat);\\n#ifdef REFLECTION\\nenvironmentIrradiance*=conservationFactor;\\n#endif\\n#ifdef SHEEN\\nsheenEnvironmentReflectance*=(conservationFactor*conservationFactor);\\n#endif\\nspecularEnvironmentReflectance*=(conservationFactor*conservationFactor);\\n#endif\\n\\n#ifdef SS_REFRACTION\\nvec3 refractionTransmittance=vec3(refractionIntensity);\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\n\\n\\n\\n\\n\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\\n\\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\\n\\nenvironmentRefraction.rgb*=volumeAlbedo;\\n#else\\n\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\\n#endif\\n\\nsurfaceAlbedo*=(1.-refractionIntensity);\\n#ifdef REFLECTION\\n\\nenvironmentIrradiance*=(1.-refractionIntensity);\\n#endif\\n\\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\\nspecularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\\n\\nrefractionTransmittance*=1.0-specularEnvironmentReflectance;\\n#endif\\n\\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\\n#if defined(USESPHERICALINVERTEX)\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP)\\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\\n#elif defined(USEIRRADIANCEMAP)\\nvec3 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceVector).rgb;\\n#ifdef RGBDREFLECTION\\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\\n#endif\\n#else\\nvec3 refractionIrradiance=vec3(0.);\\n#endif\\nrefractionIrradiance*=transmittance;\\n#endif\\n\\n\\n\\n#ifndef METALLICWORKFLOW\\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalIrradiance=environmentIrradiance;\\n#if defined(SS_TRANSLUCENCY)\\nfinalIrradiance+=refractionIrradiance;\\n#endif\\nfinalIrradiance*=surfaceAlbedo.rgb;\\n#endif\\n\\n#ifdef SPECULARTERM\\nvec3 finalSpecular=specularBase;\\nfinalSpecular=max(finalSpecular,0.0);\\n\\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalSpecularScaled*=energyConservationFactor;\\n#endif\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalRadiance=environmentRadiance.rgb;\\nfinalRadiance*=specularEnvironmentReflectance;\\n\\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalRadianceScaled*=energyConservationFactor;\\n#endif\\n#endif\\n\\n#ifdef SS_REFRACTION\\nvec3 finalRefraction=environmentRefraction.rgb;\\nfinalRefraction*=refractionTransmittance;\\n#endif\\n\\n#ifdef CLEARCOAT\\nvec3 finalClearCoat=clearCoatBase;\\nfinalClearCoat=max(finalClearCoat,0.0);\\n\\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalClearCoatScaled*=energyConservationFactor;\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalClearCoatRadiance=environmentClearCoatRadiance.rgb;\\nfinalClearCoatRadiance*=clearCoatEnvironmentReflectance;\\n\\nvec3 finalClearCoatRadianceScaled=finalClearCoatRadiance*vLightingIntensity.z;\\n#endif\\n#ifdef SS_REFRACTION\\nfinalRefraction*=(conservationFactor*conservationFactor);\\n#ifdef CLEARCOAT_TINT\\nfinalRefraction*=absorption;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\nvec3 finalSheen=sheenBase*sheenColor;\\nfinalSheen=max(finalSheen,0.0);\\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\\n\\n\\n\\n\\n\\n#ifdef REFLECTION\\nvec3 finalSheenRadiance=environmentSheenRadiance.rgb;\\nfinalSheenRadiance*=sheenEnvironmentReflectance;\\n\\nvec3 finalSheenRadianceScaled=finalSheenRadiance*vLightingIntensity.z;\\n#endif\\n#endif\\n\\n#ifdef ALPHABLEND\\nfloat luminanceOverAlpha=0.0;\\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\\n#if defined(CLEARCOAT)\\nluminanceOverAlpha+=getLuminance(finalClearCoatRadianceScaled);\\n#endif\\n#endif\\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\\n#endif\\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\\n#endif\\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA)\\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\\n#endif\\n#endif\\n#endif\\n\\n\\nvec3 finalDiffuse=diffuseBase;\\nfinalDiffuse*=surfaceAlbedo.rgb;\\nfinalDiffuse=max(finalDiffuse,0.0);\\n\\nvec3 finalAmbient=vAmbientColor;\\nfinalAmbient*=surfaceAlbedo.rgb;\\n\\nvec3 finalEmissive=vEmissiveColor;\\n#ifdef EMISSIVE\\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\\nfinalEmissive*=vEmissiveInfos.y;\\n#endif\\n\\n#ifdef AMBIENT\\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),ambientOcclusionColor,vAmbientInfos.w);\\n#else\\nvec3 ambientOcclusionForDirectDiffuse=ambientOcclusionColor;\\n#endif\\n\\n\\n\\nvec4 finalColor=vec4(\\nfinalAmbient*ambientOcclusionColor +\\nfinalDiffuse*ambientOcclusionForDirectDiffuse*vLightingIntensity.x +\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nfinalIrradiance*ambientOcclusionColor*vLightingIntensity.z +\\n#endif\\n#ifdef SPECULARTERM\\n\\n\\nfinalSpecularScaled +\\n#endif\\n#ifdef CLEARCOAT\\n\\n\\nfinalClearCoatScaled +\\n#endif\\n#ifdef SHEEN\\n\\n\\nfinalSheenScaled +\\n#endif\\n#ifdef REFLECTION\\n\\n\\nfinalRadianceScaled +\\n#ifdef CLEARCOAT\\n\\n\\nfinalClearCoatRadianceScaled +\\n#endif\\n#ifdef SHEEN\\n\\n\\nfinalSheenRadianceScaled +\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nfinalRefraction*vLightingIntensity.z +\\n#endif\\n#endif\\nfinalEmissive*vLightingIntensity.y,\\nalpha);\\n\\n#ifdef LIGHTMAP\\n#ifndef LIGHTMAPEXCLUDED\\n#ifdef USELIGHTMAPASSHADOWMAP\\nfinalColor.rgb*=lightmapColor.rgb;\\n#else\\nfinalColor.rgb+=lightmapColor.rgb;\\n#endif\\n#endif\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FOG\\n\\nfinalColor=max(finalColor,0.0);\\n#include\\n#include(color,finalColor)\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\n\\n\\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\\n#else\\n\\nfinalColor=applyImageProcessing(finalColor);\\n#endif\\nfinalColor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\n\\nfinalColor.rgb*=finalColor.a;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\ngl_FragColor=finalColor;\\n#include\\n}\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/pbr.vertex.ts\":\n/*!*******************************!*\\\n !*** ./Shaders/pbr.vertex.ts ***!\n \\*******************************/\n/*! exports provided: pbrVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pbrVertexShader\", function() { return pbrVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_pbrVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/pbrVertexDeclaration */ \"./Shaders/ShadersInclude/pbrVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_pbrUboDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/pbrUboDeclaration */ \"./Shaders/ShadersInclude/pbrUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_harmonicsFunctions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/harmonicsFunctions */ \"./Shaders/ShadersInclude/harmonicsFunctions.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertexDeclaration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/bumpVertexDeclaration */ \"./Shaders/ShadersInclude/bumpVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertexDeclaration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertexDeclaration */ \"./Shaders/ShadersInclude/clipPlaneVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightFragmentDeclaration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ShadersInclude/lightFragmentDeclaration */ \"./Shaders/ShadersInclude/lightFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_lightUboDeclaration__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ShadersInclude/lightUboDeclaration */ \"./Shaders/ShadersInclude/lightUboDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_logDepthDeclaration__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./ShadersInclude/logDepthDeclaration */ \"./Shaders/ShadersInclude/logDepthDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bumpVertex__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./ShadersInclude/bumpVertex */ \"./Shaders/ShadersInclude/bumpVertex.ts\");\n/* harmony import */ var _ShadersInclude_clipPlaneVertex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./ShadersInclude/clipPlaneVertex */ \"./Shaders/ShadersInclude/clipPlaneVertex.ts\");\n/* harmony import */ var _ShadersInclude_fogVertex__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./ShadersInclude/fogVertex */ \"./Shaders/ShadersInclude/fogVertex.ts\");\n/* harmony import */ var _ShadersInclude_shadowsVertex__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./ShadersInclude/shadowsVertex */ \"./Shaders/ShadersInclude/shadowsVertex.ts\");\n/* harmony import */ var _ShadersInclude_logDepthVertex__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ShadersInclude/logDepthVertex */ \"./Shaders/ShadersInclude/logDepthVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'pbrVertexShader';\r\nvar shader = \"precision highp float;\\n#include<__decl__pbrVertex>\\n#define CUSTOM_VERTEX_BEGIN\\n\\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 MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\\nvarying vec2 vAlbedoUV;\\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(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nvarying vec2 vReflectivityUV;\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nvarying vec2 vMicroSurfaceSamplerUV;\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nvarying vec2 vBumpUV;\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatUV;\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nvarying vec2 vClearCoatBumpUV;\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatTintUV;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nvarying vec2 vSheenUV;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nvarying vec2 vAnisotropyUV;\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nvarying vec2 vThicknessUV;\\n#endif\\n#endif\\n\\nvarying vec3 vPositionW;\\n#if DEBUGMODE>0\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#include\\n#endif\\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\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\n} else {\\ngl_Position=viewProjectionR*finalWorld*vec4(positionUpdated,1.0);\\n}\\n#else\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\n#endif\\n#if DEBUGMODE>0\\nvClipSpacePosition=gl_Position;\\n#endif\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\nvPositionW=vec3(worldPos);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\\n#endif\\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(ALBEDO) && ALBEDODIRECTUV == 0\\nif (vAlbedoInfos.x == 0.)\\n{\\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAlbedoUV=vec2(albedoMatrix*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(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nif (vReflectivityInfos.x == 0.)\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nif (vMicroSurfaceSamplerInfos.x == 0.)\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*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#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nif (vClearCoatInfos.x == 0.)\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nif (vClearCoatBumpInfos.x == 0.)\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nif (vClearCoatTintInfos.x == 0.)\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nif (vSheenInfos.x == 0.)\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nif (vAnisotropyInfos.x == 0.)\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nif (vThicknessInfos.x == 0.)\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n\\n#include\\n\\n#include\\n\\n#include\\n\\n#include[0..maxSimultaneousLights]\\n\\n#ifdef VERTEXCOLOR\\nvColor=color;\\n#endif\\n\\n#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\\n\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar pbrVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/postprocess.vertex.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/postprocess.vertex.ts ***!\n \\***************************************/\n/*! exports provided: postprocessVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"postprocessVertexShader\", function() { return postprocessVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'postprocessVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\nuniform vec2 scale;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvUV=(position*madd+madd)*scale;\\ngl_Position=vec4(position,0.0,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar postprocessVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/procedural.vertex.ts\":\n/*!**************************************!*\\\n !*** ./Shaders/procedural.vertex.ts ***!\n \\**************************************/\n/*! exports provided: proceduralVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"proceduralVertexShader\", function() { return proceduralVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'proceduralVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar proceduralVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/refraction.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/refraction.fragment.ts ***!\n \\****************************************/\n/*! exports provided: refractionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"refractionPixelShader\", function() { return refractionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'refractionPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D refractionSampler;\\n\\nuniform vec3 baseColor;\\nuniform float depth;\\nuniform float colorLevel;\\nvoid main() {\\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\\nvec2 uv=vUV-vec2(0.5);\\nvec2 offset=uv*depth*ref;\\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar refractionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/rgbdDecode.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/rgbdDecode.fragment.ts ***!\n \\****************************************/\n/*! exports provided: rgbdDecodePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rgbdDecodePixelShader\", function() { return rgbdDecodePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'rgbdDecodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar rgbdDecodePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/rgbdEncode.fragment.ts\":\n/*!****************************************!*\\\n !*** ./Shaders/rgbdEncode.fragment.ts ***!\n \\****************************************/\n/*! exports provided: rgbdEncodePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rgbdEncodePixelShader\", function() { return rgbdEncodePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n\r\n\r\nvar name = 'rgbdEncodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar rgbdEncodePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/shadowMap.fragment.ts\":\n/*!***************************************!*\\\n !*** ./Shaders/shadowMap.fragment.ts ***!\n \\***************************************/\n/*! exports provided: shadowMapPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shadowMapPixelShader\", function() { return shadowMapPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_packingFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/packingFunctions */ \"./Shaders/ShadersInclude/packingFunctions.ts\");\n\r\n\r\nvar name = 'shadowMapPixelShader';\r\nvar shader = \"#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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar shadowMapPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/shadowMap.vertex.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/shadowMap.vertex.ts ***!\n \\*************************************/\n/*! exports provided: shadowMapVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shadowMapVertexShader\", function() { return shadowMapVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_bonesDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/bonesDeclaration */ \"./Shaders/ShadersInclude/bonesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexGlobalDeclaration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexGlobalDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertexDeclaration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertexDeclaration */ \"./Shaders/ShadersInclude/morphTargetsVertexDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_instancesDeclaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ShadersInclude/instancesDeclaration */ \"./Shaders/ShadersInclude/instancesDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_helperFunctions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ShadersInclude/helperFunctions */ \"./Shaders/ShadersInclude/helperFunctions.ts\");\n/* harmony import */ var _ShadersInclude_morphTargetsVertex__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ShadersInclude/morphTargetsVertex */ \"./Shaders/ShadersInclude/morphTargetsVertex.ts\");\n/* harmony import */ var _ShadersInclude_instancesVertex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ShadersInclude/instancesVertex */ \"./Shaders/ShadersInclude/instancesVertex.ts\");\n/* harmony import */ var _ShadersInclude_bonesVertex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ShadersInclude/bonesVertex */ \"./Shaders/ShadersInclude/bonesVertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar name = 'shadowMapVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar shadowMapVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/sharpen.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/sharpen.fragment.ts ***!\n \\*************************************/\n/*! exports provided: sharpenPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sharpenPixelShader\", function() { return sharpenPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'sharpenPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec2 screenSize;\\nuniform vec2 sharpnessAmounts;\\nvoid main(void)\\n{\\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\\nvec4 color=texture2D(textureSampler,vUV);\\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\\ncolor*4.0;\\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar sharpenPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/sprites.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/sprites.fragment.ts ***!\n \\*************************************/\n/*! exports provided: spritesPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"spritesPixelShader\", function() { return spritesPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_fogFragmentDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/fogFragmentDeclaration */ \"./Shaders/ShadersInclude/fogFragmentDeclaration.ts\");\n/* harmony import */ var _ShadersInclude_fogFragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ShadersInclude/fogFragment */ \"./Shaders/ShadersInclude/fogFragment.ts\");\n\r\n\r\n\r\nvar name = 'spritesPixelShader';\r\nvar shader = \"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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar spritesPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/sprites.vertex.ts\":\n/*!***********************************!*\\\n !*** ./Shaders/sprites.vertex.ts ***!\n \\***********************************/\n/*! exports provided: spritesVertexShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"spritesVertexShader\", function() { return spritesVertexShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n/* harmony import */ var _ShadersInclude_fogVertexDeclaration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ShadersInclude/fogVertexDeclaration */ \"./Shaders/ShadersInclude/fogVertexDeclaration.ts\");\n\r\n\r\nvar name = 'spritesVertexShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar spritesVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/ssao.fragment.ts\":\n/*!**********************************!*\\\n !*** ./Shaders/ssao.fragment.ts ***!\n \\**********************************/\n/*! exports provided: ssaoPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ssaoPixelShader\", function() { return ssaoPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'ssaoPixelShader';\r\nvar shader = \"\\nuniform sampler2D textureSampler;\\nvarying vec2 vUV;\\n#ifdef SSAO\\nuniform sampler2D randomSampler;\\nuniform float randTextureTiles;\\nuniform float samplesFactor;\\nuniform vec3 sampleSphere[SAMPLES];\\nuniform float totalStrength;\\nuniform float radius;\\nuniform float area;\\nuniform float fallOff;\\nuniform float base;\\nvec3 normalFromDepth(float depth,vec2 coords)\\n{\\nvec2 offset1=vec2(0.0,radius);\\nvec2 offset2=vec2(radius,0.0);\\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\\nvec3 p1=vec3(offset1,depth1-depth);\\nvec3 p2=vec3(offset2,depth2-depth);\\nvec3 normal=cross(p1,p2);\\nnormal.z=-normal.z;\\nreturn normalize(normal);\\n}\\nvoid main()\\n{\\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\\nfloat depth=texture2D(textureSampler,vUV).r;\\nvec3 position=vec3(vUV,depth);\\nvec3 normal=normalFromDepth(depth,vUV);\\nfloat radiusDepth=radius/depth;\\nfloat occlusion=0.0;\\nvec3 ray;\\nvec3 hemiRay;\\nfloat occlusionDepth;\\nfloat difference;\\nfor (int i=0; i1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\\nvec3 bitangent=cross(normal,tangent);\\nmat3 tbn=mat3(tangent,bitangent,normal);\\nfloat difference;\\nfor (int i=0; i1.0 || offset.y>1.0) {\\ncontinue;\\n}\\n\\nfloat sampleDepth=abs(texture2D(textureSampler,offset.xy).r);\\n\\ndifference=depthSign*samplePosition.z-sampleDepth;\\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\\n}\\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\\nfloat result=clamp(ao+base,0.0,1.0);\\ngl_FragColor=vec4(vec3(result),1.0);\\n}\\n#endif\\n#ifdef BILATERAL_BLUR\\nuniform sampler2D depthSampler;\\nuniform float outSize;\\nuniform float samplerOffsets[SAMPLES];\\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.3846153846)*direction;\\nvec2 off2=vec2(3.2307692308)*direction;\\ncolor+=texture2D(image,uv)*0.2270270270;\\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\\nreturn color;\\n}\\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.411764705882353)*direction;\\nvec2 off2=vec2(3.2941176470588234)*direction;\\nvec2 off3=vec2(5.176470588235294)*direction;\\ncolor+=texture2D(image,uv)*0.1964825501511404;\\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\\nreturn color;\\n}\\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.411764705882353)*direction;\\nvec2 off2=vec2(3.2941176470588234)*direction;\\nvec2 off3=vec2(5.176470588235294)*direction;\\nfloat compareDepth=abs(texture2D(depthSampler,uv).r);\\nfloat sampleDepth;\\nfloat weight;\\nfloat weightSum=30.0;\\ncolor+=texture2D(image,uv)*30.0;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off1/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off1/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off2/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off2/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off3/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off3/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\\nreturn color/weightSum;\\n}\\nvoid main()\\n{\\n#if EXPENSIVE\\nfloat compareDepth=abs(texture2D(depthSampler,vUV).r);\\nfloat texelsize=1.0/outSize;\\nfloat result=0.0;\\nfloat weightSum=0.0;\\nfor (int i=0; ishadowPixelDepth)\\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\\ncurrentPosition+=stepL;\\n}\\naccumFog/=NB_STEPS;\\nvec3 color=accumFog*scatteringPower;\\ngl_FragColor=vec4(color*exp(color) ,1.0);\\n}\\n#endif\\n#if defined(VLSMERGE)\\nuniform sampler2D originalSampler;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\\n}\\n#endif\\n#if defined(LUMINANCE)\\nuniform vec2 lumOffsets[4];\\nvoid main()\\n{\\nfloat average=0.0;\\nvec4 color=vec4(0.0);\\nfloat maximum=-1e20;\\nvec3 weight=vec3(0.299,0.587,0.114);\\nfor (int i=0; i<4; i++)\\n{\\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\\n\\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\\n\\n#ifdef WEIGHTED_AVERAGE\\nfloat GreyValue=dot(color.rgb,weight);\\n#endif\\n#ifdef BRIGHTNESS\\nfloat GreyValue=max(color.r,max(color.g,color.b));\\n#endif\\n#ifdef HSL_COMPONENT\\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\\n#endif\\n#ifdef MAGNITUDE\\nfloat GreyValue=length(color.rgb);\\n#endif\\nmaximum=max(maximum,GreyValue);\\naverage+=(0.25*log(1e-5+GreyValue));\\n}\\naverage=exp(average);\\ngl_FragColor=vec4(average,maximum,0.0,1.0);\\n}\\n#endif\\n#if defined(LUMINANCE_DOWN_SAMPLE)\\nuniform vec2 dsOffsets[9];\\nuniform float halfDestPixelSize;\\n#ifdef FINAL_DOWN_SAMPLER\\n#include\\n#endif\\nvoid main()\\n{\\nvec4 color=vec4(0.0);\\nfloat average=0.0;\\nfor (int i=0; i<9; i++)\\n{\\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\\naverage+=color.r;\\n}\\naverage/=9.0;\\n#ifdef FINAL_DOWN_SAMPLER\\ngl_FragColor=pack(average);\\n#else\\ngl_FragColor=vec4(average,average,0.0,1.0);\\n#endif\\n}\\n#endif\\n#if defined(HDR)\\nuniform sampler2D textureAdderSampler;\\nuniform float averageLuminance;\\nvoid main()\\n{\\nvec4 color=texture2D(textureAdderSampler,vUV);\\n#ifndef AUTO_EXPOSURE\\nvec4 adjustedColor=color/averageLuminance;\\ncolor=adjustedColor;\\ncolor.a=1.0;\\n#endif\\ngl_FragColor=color;\\n}\\n#endif\\n#if defined(LENS_FLARE)\\n#define GHOSTS 3\\nuniform sampler2D lensColorSampler;\\nuniform float strength;\\nuniform float ghostDispersal;\\nuniform float haloWidth;\\nuniform vec2 resolution;\\nuniform float distortionStrength;\\nfloat hash(vec2 p)\\n{\\nfloat h=dot(p,vec2(127.1,311.7));\\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\\n}\\nfloat noise(in vec2 p)\\n{\\nvec2 i=floor(p);\\nvec2 f=fract(p);\\nvec2 u=f*f*(3.0-2.0*f);\\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\\nhash(i+vec2(1.0,0.0)),u.x),\\nmix(hash(i+vec2(0.0,1.0)),\\nhash(i+vec2(1.0,1.0)),u.x),u.y);\\n}\\nfloat fbm(vec2 p)\\n{\\nfloat f=0.0;\\nf+=0.5000*noise(p); p*=2.02;\\nf+=0.2500*noise(p); p*=2.03;\\nf+=0.1250*noise(p); p*=2.01;\\nf+=0.0625*noise(p); p*=2.04;\\nf/=0.9375;\\nreturn f;\\n}\\nvec3 pattern(vec2 uv)\\n{\\nvec2 p=-1.0+2.0*uv;\\nfloat p2=dot(p,p);\\nfloat f=fbm(vec2(15.0*p2))/2.0;\\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\\nreturn (1.0-f)*vec3(r,g,b);\\n}\\nfloat luminance(vec3 color)\\n{\\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\\n}\\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\\n{\\nreturn vec4(\\ntexture2D(tex,texcoord+direction*distortion.r).r,\\ntexture2D(tex,texcoord+direction*distortion.g).g,\\ntexture2D(tex,texcoord+direction*distortion.b).b,\\n1.0\\n);\\n}\\nvoid main(void)\\n{\\nvec2 uv=-vUV+vec2(1.0);\\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\\nvec2 texelSize=1.0/resolution;\\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\\nvec4 result=vec4(0.0);\\nfloat ghostIndice=1.0;\\nfor (int i=0; i=nSamples)\\nbreak;\\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\\nresult+=texture2D(textureSampler,offset1);\\n}\\ngl_FragColor=result/float(nSamples);\\n}\\n#endif\\n\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar standardPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/stereoscopicInterlace.fragment.ts\":\n/*!***************************************************!*\\\n !*** ./Shaders/stereoscopicInterlace.fragment.ts ***!\n \\***************************************************/\n/*! exports provided: stereoscopicInterlacePixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"stereoscopicInterlacePixelShader\", function() { return stereoscopicInterlacePixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'stereoscopicInterlacePixelShader';\r\nvar shader = \"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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar stereoscopicInterlacePixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/tonemap.fragment.ts\":\n/*!*************************************!*\\\n !*** ./Shaders/tonemap.fragment.ts ***!\n \\*************************************/\n/*! exports provided: tonemapPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"tonemapPixelShader\", function() { return tonemapPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'tonemapPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform float _ExposureAdjustment;\\n#if defined(HABLE_TONEMAPPING)\\nconst float A=0.15;\\nconst float B=0.50;\\nconst float C=0.10;\\nconst float D=0.20;\\nconst float E=0.02;\\nconst float F=0.30;\\nconst float W=11.2;\\n#endif\\nfloat Luminance(vec3 c)\\n{\\nreturn dot(c,vec3(0.22,0.707,0.071));\\n}\\nvoid main(void)\\n{\\nvec3 colour=texture2D(textureSampler,vUV).rgb;\\n#if defined(REINHARD_TONEMAPPING)\\nfloat lum=Luminance(colour.rgb);\\nfloat lumTm=lum*_ExposureAdjustment;\\nfloat scale=lumTm/(1.0+lumTm);\\ncolour*=scale/lum;\\n#elif defined(HABLE_TONEMAPPING)\\ncolour*=_ExposureAdjustment;\\nconst float ExposureBias=2.0;\\nvec3 x=ExposureBias*colour;\\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\\nx=vec3(W,W,W);\\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\\ncolour=curr*whiteScale;\\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\\ncolour*=_ExposureAdjustment;\\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\\ncolour=retColor*retColor;\\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\\n#endif\\ngl_FragColor=vec4(colour.rgb,1.0);\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar tonemapPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/volumetricLightScattering.fragment.ts\":\n/*!*******************************************************!*\\\n !*** ./Shaders/volumetricLightScattering.fragment.ts ***!\n \\*******************************************************/\n/*! exports provided: volumetricLightScatteringPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"volumetricLightScatteringPixelShader\", function() { return volumetricLightScatteringPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'volumetricLightScatteringPixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform sampler2D lightScatteringSampler;\\nuniform float decay;\\nuniform float exposure;\\nuniform float weight;\\nuniform float density;\\nuniform vec2 meshPositionOnScreen;\\nvarying vec2 vUV;\\nvoid main(void) {\\nvec2 tc=vUV;\\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\\nfloat illuminationDecay=1.0;\\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\\nfor(int i=0; i\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n\\n#include\\nuniform mat4 viewProjection;\\nuniform vec2 depthValues;\\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\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#if (defined(ALPHATEST) || defined(NEED_UV)) && defined(UV1)\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\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\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar volumetricLightScatteringPassVertexShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/vrDistortionCorrection.fragment.ts\":\n/*!****************************************************!*\\\n !*** ./Shaders/vrDistortionCorrection.fragment.ts ***!\n \\****************************************************/\n/*! exports provided: vrDistortionCorrectionPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"vrDistortionCorrectionPixelShader\", function() { return vrDistortionCorrectionPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'vrDistortionCorrectionPixelShader';\r\nvar shader = \"\\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}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar vrDistortionCorrectionPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Shaders/vrMultiviewToSingleview.fragment.ts\":\n/*!*****************************************************!*\\\n !*** ./Shaders/vrMultiviewToSingleview.fragment.ts ***!\n \\*****************************************************/\n/*! exports provided: vrMultiviewToSingleviewPixelShader */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"vrMultiviewToSingleviewPixelShader\", function() { return vrMultiviewToSingleviewPixelShader; });\n/* harmony import */ var _Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Materials/effect */ \"./Materials/effect.ts\");\n\r\nvar name = 'vrMultiviewToSingleviewPixelShader';\r\nvar shader = \"precision mediump sampler2DArray;\\nvarying vec2 vUV;\\nuniform sampler2DArray multiviewSampler;\\nuniform int imageIndex;\\nvoid main(void)\\n{\\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\\n}\";\r\n_Materials_effect__WEBPACK_IMPORTED_MODULE_0__[\"Effect\"].ShadersStore[name] = shader;\r\n/** @hidden */\r\nvar vrMultiviewToSingleviewPixelShader = { name: name, shader: shader };\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/index.ts\":\n/*!**************************!*\\\n !*** ./Sprites/index.ts ***!\n \\**************************/\n/*! exports provided: Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _sprite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sprite */ \"./Sprites/sprite.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return _sprite__WEBPACK_IMPORTED_MODULE_0__[\"Sprite\"]; });\n\n/* harmony import */ var _spriteManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./spriteManager */ \"./Sprites/spriteManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return _spriteManager__WEBPACK_IMPORTED_MODULE_1__[\"SpriteManager\"]; });\n\n/* harmony import */ var _spritePackedManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./spritePackedManager */ \"./Sprites/spritePackedManager.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return _spritePackedManager__WEBPACK_IMPORTED_MODULE_2__[\"SpritePackedManager\"]; });\n\n/* harmony import */ var _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./spriteSceneComponent */ \"./Sprites/spriteSceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_3__[\"SpriteSceneComponent\"]; });\n\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/sprite.ts\":\n/*!***************************!*\\\n !*** ./Sprites/sprite.ts ***!\n \\***************************/\n/*! exports provided: Sprite */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return Sprite; });\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Maths/math.color */ \"./Maths/math.color.ts\");\n\r\n\r\n/**\r\n * Class used to represent a sprite\r\n * @see http://doc.babylonjs.com/babylon101/sprites\r\n */\r\nvar Sprite = /** @class */ (function () {\r\n /**\r\n * Creates a new Sprite\r\n * @param name defines the name\r\n * @param manager defines the manager\r\n */\r\n function Sprite(\r\n /** defines the name */\r\n name, manager) {\r\n this.name = name;\r\n /** Gets or sets the main color */\r\n this.color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__[\"Color4\"](1.0, 1.0, 1.0, 1.0);\r\n /** Gets or sets the width */\r\n this.width = 1.0;\r\n /** Gets or sets the height */\r\n this.height = 1.0;\r\n /** Gets or sets rotation angle */\r\n this.angle = 0;\r\n /** Gets or sets a boolean indicating if UV coordinates should be inverted in U axis */\r\n this.invertU = 0;\r\n /** Gets or sets a boolean indicating if UV coordinates should be inverted in B axis */\r\n this.invertV = 0;\r\n /** Gets the list of attached animations */\r\n this.animations = new Array();\r\n /** Gets or sets a boolean indicating if the sprite can be picked */\r\n this.isPickable = false;\r\n this._animationStarted = false;\r\n this._loopAnimation = false;\r\n this._fromIndex = 0;\r\n this._toIndex = 0;\r\n this._delay = 0;\r\n this._direction = 1;\r\n this._time = 0;\r\n /**\r\n * Gets or sets a boolean indicating if the sprite is visible (renderable). Default is true\r\n */\r\n this.isVisible = true;\r\n this._manager = manager;\r\n this._manager.sprites.push(this);\r\n this.position = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__[\"Vector3\"].Zero();\r\n }\r\n Object.defineProperty(Sprite.prototype, \"size\", {\r\n /**\r\n * Gets or sets the sprite size\r\n */\r\n get: function () {\r\n return this.width;\r\n },\r\n set: function (value) {\r\n this.width = value;\r\n this.height = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Starts an animation\r\n * @param from defines the initial key\r\n * @param to defines the end key\r\n * @param loop defines if the animation must loop\r\n * @param delay defines the start delay (in ms)\r\n * @param onAnimationEnd defines a callback to call when animation ends\r\n */\r\n Sprite.prototype.playAnimation = function (from, to, loop, delay, onAnimationEnd) {\r\n this._fromIndex = from;\r\n this._toIndex = to;\r\n this._loopAnimation = loop;\r\n this._delay = delay;\r\n this._animationStarted = true;\r\n if (from < to) {\r\n this._direction = 1;\r\n }\r\n else {\r\n this._direction = -1;\r\n this._toIndex = from;\r\n this._fromIndex = to;\r\n }\r\n this.cellIndex = from;\r\n this._time = 0;\r\n this._onAnimationEnd = onAnimationEnd;\r\n };\r\n /** Stops current animation (if any) */\r\n Sprite.prototype.stopAnimation = function () {\r\n this._animationStarted = false;\r\n };\r\n /** @hidden */\r\n Sprite.prototype._animate = function (deltaTime) {\r\n if (!this._animationStarted) {\r\n return;\r\n }\r\n this._time += deltaTime;\r\n if (this._time > this._delay) {\r\n this._time = this._time % this._delay;\r\n this.cellIndex += this._direction;\r\n if (this._direction > 0 && this.cellIndex > this._toIndex || this._direction < 0 && this.cellIndex < this._fromIndex) {\r\n if (this._loopAnimation) {\r\n this.cellIndex = this._direction > 0 ? this._fromIndex : this._toIndex;\r\n }\r\n else {\r\n this.cellIndex = this._toIndex;\r\n this._animationStarted = false;\r\n if (this._onAnimationEnd) {\r\n this._onAnimationEnd();\r\n }\r\n if (this.disposeWhenFinishedAnimating) {\r\n this.dispose();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /** Release associated resources */\r\n Sprite.prototype.dispose = function () {\r\n for (var i = 0; i < this._manager.sprites.length; i++) {\r\n if (this._manager.sprites[i] == this) {\r\n this._manager.sprites.splice(i, 1);\r\n }\r\n }\r\n };\r\n return Sprite;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/spriteManager.ts\":\n/*!**********************************!*\\\n !*** ./Sprites/spriteManager.ts ***!\n \\**********************************/\n/*! exports provided: SpriteManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return SpriteManager; });\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/buffer */ \"./Meshes/buffer.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./spriteSceneComponent */ \"./Sprites/spriteSceneComponent.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n/* harmony import */ var _Materials_material__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Materials/material */ \"./Materials/material.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Shaders_sprites_fragment__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Shaders/sprites.fragment */ \"./Shaders/sprites.fragment.ts\");\n/* harmony import */ var _Shaders_sprites_vertex__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Shaders/sprites.vertex */ \"./Shaders/sprites.vertex.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Class used to manage multiple sprites on the same spritesheet\r\n * @see http://doc.babylonjs.com/babylon101/sprites\r\n */\r\nvar SpriteManager = /** @class */ (function () {\r\n /**\r\n * Creates a new sprite manager\r\n * @param name defines the manager's name\r\n * @param imgUrl defines the sprite sheet url\r\n * @param capacity defines the maximum allowed number of sprites\r\n * @param cellSize defines the size of a sprite cell\r\n * @param scene defines the hosting scene\r\n * @param epsilon defines the epsilon value to align texture (0.01 by default)\r\n * @param samplingMode defines the smapling mode to use with spritesheet\r\n * @param fromPacked set to false; do not alter\r\n * @param spriteJSON null otherwise a JSON object defining sprite sheet data; do not alter\r\n */\r\n function SpriteManager(\r\n /** defines the manager's name */\r\n name, imgUrl, capacity, cellSize, scene, epsilon, samplingMode, fromPacked, spriteJSON) {\r\n if (epsilon === void 0) { epsilon = 0.01; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n if (fromPacked === void 0) { fromPacked = false; }\r\n if (spriteJSON === void 0) { spriteJSON = null; }\r\n this.name = name;\r\n /** Gets the list of sprites */\r\n this.sprites = new Array();\r\n /** Gets or sets the rendering group id (0 by default) */\r\n this.renderingGroupId = 0;\r\n /** Gets or sets camera layer mask */\r\n this.layerMask = 0x0FFFFFFF;\r\n /** Gets or sets a boolean indicating if the manager must consider scene fog when rendering */\r\n this.fogEnabled = true;\r\n /** Gets or sets a boolean indicating if the sprites are pickable */\r\n this.isPickable = false;\r\n /** True when packed cell data from JSON file is ready*/\r\n this._packedAndReady = false;\r\n /**\r\n * An event triggered when the manager is disposed.\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__[\"Observable\"]();\r\n this._vertexBuffers = {};\r\n if (!scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_8__[\"SceneComponentConstants\"].NAME_SPRITE)) {\r\n scene._addComponent(new _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SpriteSceneComponent\"](scene));\r\n }\r\n this._capacity = capacity;\r\n this._fromPacked = fromPacked;\r\n this._spriteTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"](imgUrl, scene, true, false, samplingMode);\r\n this._spriteTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n this._spriteTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_6__[\"Texture\"].CLAMP_ADDRESSMODE;\r\n if (cellSize.width && cellSize.height) {\r\n this.cellWidth = cellSize.width;\r\n this.cellHeight = cellSize.height;\r\n }\r\n else if (cellSize !== undefined) {\r\n this.cellWidth = cellSize;\r\n this.cellHeight = cellSize;\r\n }\r\n else {\r\n return;\r\n }\r\n this._epsilon = epsilon;\r\n this._scene = scene;\r\n this._scene.spriteManagers.push(this);\r\n var indices = [];\r\n var index = 0;\r\n for (var count = 0; count < capacity; count++) {\r\n indices.push(index);\r\n indices.push(index + 1);\r\n indices.push(index + 2);\r\n indices.push(index);\r\n indices.push(index + 2);\r\n indices.push(index + 3);\r\n index += 4;\r\n }\r\n this._indexBuffer = scene.getEngine().createIndexBuffer(indices);\r\n // VBO\r\n // 18 floats per sprite (x, y, z, angle, sizeX, sizeY, offsetX, offsetY, invertU, invertV, cellLeft, cellTop, cellWidth, cellHeight, color r, color g, color b, color a)\r\n this._vertexData = new Float32Array(capacity * 18 * 4);\r\n this._buffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"Buffer\"](scene.getEngine(), this._vertexData, true, 18);\r\n var positions = this._buffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, 0, 4);\r\n var options = this._buffer.createVertexBuffer(\"options\", 4, 4);\r\n var inverts = this._buffer.createVertexBuffer(\"inverts\", 8, 2);\r\n var cellInfo = this._buffer.createVertexBuffer(\"cellInfo\", 10, 4);\r\n var colors = this._buffer.createVertexBuffer(_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind, 14, 4);\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind] = positions;\r\n this._vertexBuffers[\"options\"] = options;\r\n this._vertexBuffers[\"inverts\"] = inverts;\r\n this._vertexBuffers[\"cellInfo\"] = cellInfo;\r\n this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind] = colors;\r\n // Effects\r\n this._effectBase = this._scene.getEngine().createEffect(\"sprites\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, \"options\", \"inverts\", \"cellInfo\", _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind], [\"view\", \"projection\", \"textureInfos\", \"alphaTest\"], [\"diffuseSampler\"], \"\");\r\n this._effectFog = this._scene.getEngine().createEffect(\"sprites\", [_Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].PositionKind, \"options\", \"inverts\", \"cellInfo\", _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__[\"VertexBuffer\"].ColorKind], [\"view\", \"projection\", \"textureInfos\", \"alphaTest\", \"vFogInfos\", \"vFogColor\"], [\"diffuseSampler\"], \"#define FOG\");\r\n if (this._fromPacked) {\r\n this._makePacked(imgUrl, spriteJSON);\r\n }\r\n }\r\n Object.defineProperty(SpriteManager.prototype, \"onDispose\", {\r\n /**\r\n * Callback called when the manager is disposed\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpriteManager.prototype, \"texture\", {\r\n /**\r\n * Gets or sets the spritesheet texture\r\n */\r\n get: function () {\r\n return this._spriteTexture;\r\n },\r\n set: function (value) {\r\n this._spriteTexture = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SpriteManager.prototype._makePacked = function (imgUrl, spriteJSON) {\r\n var _this = this;\r\n if (spriteJSON !== null) {\r\n try {\r\n var celldata = JSON.parse(spriteJSON);\r\n var spritemap = Reflect.ownKeys(celldata.frames);\r\n this._spriteMap = spritemap;\r\n this._packedAndReady = true;\r\n this._cellData = celldata.frames;\r\n }\r\n catch (e) {\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON from string. Spritesheet managed with constant cell size.\");\r\n }\r\n }\r\n else {\r\n var re = /\\./g;\r\n var li = void 0;\r\n do {\r\n li = re.lastIndex;\r\n re.test(imgUrl);\r\n } while (re.lastIndex > 0);\r\n var jsonUrl = imgUrl.substring(0, li - 1) + \".json\";\r\n var xmlhttp_1 = new XMLHttpRequest();\r\n xmlhttp_1.open(\"GET\", jsonUrl, true);\r\n xmlhttp_1.onerror = function () {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_10__[\"Logger\"].Error(\"Unable to Load Sprite JSON Data. Spritesheet managed with constant cell size.\");\r\n _this._fromPacked = false;\r\n _this._packedAndReady = false;\r\n };\r\n xmlhttp_1.onload = function () {\r\n try {\r\n var celldata = JSON.parse(xmlhttp_1.response);\r\n var spritemap = Reflect.ownKeys(celldata.frames);\r\n _this._spriteMap = spritemap;\r\n _this._packedAndReady = true;\r\n _this._cellData = celldata.frames;\r\n }\r\n catch (e) {\r\n _this._fromPacked = false;\r\n _this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON from file. Spritesheet managed with constant cell size.\");\r\n }\r\n };\r\n xmlhttp_1.send();\r\n }\r\n };\r\n SpriteManager.prototype._appendSpriteVertex = function (index, sprite, offsetX, offsetY, baseSize) {\r\n var arrayOffset = index * 18;\r\n if (offsetX === 0) {\r\n offsetX = this._epsilon;\r\n }\r\n else if (offsetX === 1) {\r\n offsetX = 1 - this._epsilon;\r\n }\r\n if (offsetY === 0) {\r\n offsetY = this._epsilon;\r\n }\r\n else if (offsetY === 1) {\r\n offsetY = 1 - this._epsilon;\r\n }\r\n // Positions\r\n this._vertexData[arrayOffset] = sprite.position.x;\r\n this._vertexData[arrayOffset + 1] = sprite.position.y;\r\n this._vertexData[arrayOffset + 2] = sprite.position.z;\r\n this._vertexData[arrayOffset + 3] = sprite.angle;\r\n // Options\r\n this._vertexData[arrayOffset + 4] = sprite.width;\r\n this._vertexData[arrayOffset + 5] = sprite.height;\r\n this._vertexData[arrayOffset + 6] = offsetX;\r\n this._vertexData[arrayOffset + 7] = offsetY;\r\n // Inverts\r\n this._vertexData[arrayOffset + 8] = sprite.invertU ? 1 : 0;\r\n this._vertexData[arrayOffset + 9] = sprite.invertV ? 1 : 0;\r\n // CellIfo\r\n if (this._packedAndReady) {\r\n if (!sprite.cellRef) {\r\n sprite.cellIndex = 0;\r\n }\r\n var num = sprite.cellIndex;\r\n if (typeof (num) === \"number\" && isFinite(num) && Math.floor(num) === num) {\r\n sprite.cellRef = this._spriteMap[sprite.cellIndex];\r\n }\r\n this._vertexData[arrayOffset + 10] = this._cellData[sprite.cellRef].frame.x / baseSize.width;\r\n this._vertexData[arrayOffset + 11] = this._cellData[sprite.cellRef].frame.y / baseSize.height;\r\n this._vertexData[arrayOffset + 12] = this._cellData[sprite.cellRef].frame.w / baseSize.width;\r\n this._vertexData[arrayOffset + 13] = this._cellData[sprite.cellRef].frame.h / baseSize.height;\r\n }\r\n else {\r\n if (!sprite.cellIndex) {\r\n sprite.cellIndex = 0;\r\n }\r\n var rowSize = baseSize.width / this.cellWidth;\r\n var offset = (sprite.cellIndex / rowSize) >> 0;\r\n this._vertexData[arrayOffset + 10] = (sprite.cellIndex - offset * rowSize) * this.cellWidth / baseSize.width;\r\n this._vertexData[arrayOffset + 11] = offset * this.cellHeight / baseSize.height;\r\n this._vertexData[arrayOffset + 12] = this.cellWidth / baseSize.width;\r\n this._vertexData[arrayOffset + 13] = this.cellHeight / baseSize.height;\r\n }\r\n // Color\r\n this._vertexData[arrayOffset + 14] = sprite.color.r;\r\n this._vertexData[arrayOffset + 15] = sprite.color.g;\r\n this._vertexData[arrayOffset + 16] = sprite.color.b;\r\n this._vertexData[arrayOffset + 17] = sprite.color.a;\r\n };\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @param fastCheck defines if a fast check only must be done (the first potential sprite is will be used and not the closer)\r\n * @returns null if no hit or a PickingInfo\r\n */\r\n SpriteManager.prototype.intersects = function (ray, camera, predicate, fastCheck) {\r\n var count = Math.min(this._capacity, this.sprites.length);\r\n var min = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var max = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var distance = Number.MAX_VALUE;\r\n var currentSprite = null;\r\n var pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0];\r\n var cameraSpacePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1];\r\n var cameraView = camera.getViewMatrix();\r\n for (var index = 0; index < count; index++) {\r\n var sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n }\r\n else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n if (ray.intersectsBoxMinMax(min, max)) {\r\n var currentDistance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(cameraSpacePosition, ray.origin);\r\n if (distance > currentDistance) {\r\n distance = currentDistance;\r\n currentSprite = sprite;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (currentSprite) {\r\n var result = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_5__[\"PickingInfo\"]();\r\n cameraView.invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = currentSprite;\r\n result.distance = distance;\r\n // Get picked point\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[2];\r\n direction.copyFrom(ray.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n ray.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(pickedPoint, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n return result;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @returns null if no hit or a PickingInfo array\r\n */\r\n SpriteManager.prototype.multiIntersects = function (ray, camera, predicate) {\r\n var count = Math.min(this._capacity, this.sprites.length);\r\n var min = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var max = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Zero();\r\n var distance;\r\n var results = [];\r\n var pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[0].copyFromFloats(0, 0, 0);\r\n var cameraSpacePosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[1].copyFromFloats(0, 0, 0);\r\n var cameraView = camera.getViewMatrix();\r\n for (var index = 0; index < count; index++) {\r\n var sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n }\r\n else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n if (ray.intersectsBoxMinMax(min, max)) {\r\n distance = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].Distance(cameraSpacePosition, ray.origin);\r\n var result = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_5__[\"PickingInfo\"]();\r\n results.push(result);\r\n cameraView.invertToRef(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = sprite;\r\n result.distance = distance;\r\n // Get picked point\r\n var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Vector3[2];\r\n direction.copyFrom(ray.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n ray.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"Vector3\"].TransformCoordinates(pickedPoint, _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__[\"TmpVectors\"].Matrix[0]);\r\n }\r\n }\r\n return results;\r\n };\r\n /**\r\n * Render all child sprites\r\n */\r\n SpriteManager.prototype.render = function () {\r\n // Check\r\n if (!this._effectBase.isReady() || !this._effectFog.isReady() || !this._spriteTexture\r\n || !this._spriteTexture.isReady() || !this.sprites.length) {\r\n return;\r\n }\r\n if (this._fromPacked && (!this._packedAndReady || !this._spriteMap || !this._cellData)) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n var baseSize = this._spriteTexture.getBaseSize();\r\n // Sprites\r\n var deltaTime = engine.getDeltaTime();\r\n var max = Math.min(this._capacity, this.sprites.length);\r\n var offset = 0;\r\n var noSprite = true;\r\n for (var index = 0; index < max; index++) {\r\n var sprite = this.sprites[index];\r\n if (!sprite || !sprite.isVisible) {\r\n continue;\r\n }\r\n noSprite = false;\r\n sprite._animate(deltaTime);\r\n this._appendSpriteVertex(offset++, sprite, 0, 0, baseSize);\r\n this._appendSpriteVertex(offset++, sprite, 1, 0, baseSize);\r\n this._appendSpriteVertex(offset++, sprite, 1, 1, baseSize);\r\n this._appendSpriteVertex(offset++, sprite, 0, 1, baseSize);\r\n }\r\n if (noSprite) {\r\n return;\r\n }\r\n this._buffer.update(this._vertexData);\r\n // Render\r\n var effect = this._effectBase;\r\n if (this._scene.fogEnabled && this._scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].FOGMODE_NONE && this.fogEnabled) {\r\n effect = this._effectFog;\r\n }\r\n engine.enableEffect(effect);\r\n var viewMatrix = this._scene.getViewMatrix();\r\n effect.setTexture(\"diffuseSampler\", this._spriteTexture);\r\n effect.setMatrix(\"view\", viewMatrix);\r\n effect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\r\n // Fog\r\n if (this._scene.fogEnabled && this._scene.fogMode !== _scene__WEBPACK_IMPORTED_MODULE_0__[\"Scene\"].FOGMODE_NONE && this.fogEnabled) {\r\n effect.setFloat4(\"vFogInfos\", this._scene.fogMode, this._scene.fogStart, this._scene.fogEnd, this._scene.fogDensity);\r\n effect.setColor3(\"vFogColor\", this._scene.fogColor);\r\n }\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.setDepthFunctionToLessOrEqual();\r\n effect.setBool(\"alphaTest\", true);\r\n engine.setColorWrite(false);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, (offset / 4) * 6);\r\n engine.setColorWrite(true);\r\n effect.setBool(\"alphaTest\", false);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_COMBINE);\r\n engine.drawElementsType(_Materials_material__WEBPACK_IMPORTED_MODULE_7__[\"Material\"].TriangleFillMode, 0, (offset / 4) * 6);\r\n engine.setAlphaMode(_Engines_constants__WEBPACK_IMPORTED_MODULE_9__[\"Constants\"].ALPHA_DISABLE);\r\n };\r\n /**\r\n * Release associated resources\r\n */\r\n SpriteManager.prototype.dispose = function () {\r\n if (this._buffer) {\r\n this._buffer.dispose();\r\n this._buffer = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (this._spriteTexture) {\r\n this._spriteTexture.dispose();\r\n this._spriteTexture = null;\r\n }\r\n // Remove from scene\r\n var index = this._scene.spriteManagers.indexOf(this);\r\n this._scene.spriteManagers.splice(index, 1);\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n return SpriteManager;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/spritePackedManager.ts\":\n/*!****************************************!*\\\n !*** ./Sprites/spritePackedManager.ts ***!\n \\****************************************/\n/*! exports provided: SpritePackedManager */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return SpritePackedManager; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _spriteManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./spriteManager */ \"./Sprites/spriteManager.ts\");\n/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/texture */ \"./Materials/Textures/texture.ts\");\n\r\n\r\n\r\n/**\r\n * Class used to manage multiple sprites of different sizes on the same spritesheet\r\n * @see http://doc.babylonjs.com/babylon101/sprites\r\n */\r\nvar SpritePackedManager = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](SpritePackedManager, _super);\r\n /**\r\n * Creates a new sprite manager from a packed sprite sheet\r\n * @param name defines the manager's name\r\n * @param imgUrl defines the sprite sheet url\r\n * @param capacity defines the maximum allowed number of sprites\r\n * @param scene defines the hosting scene\r\n * @param spriteJSON null otherwise a JSON object defining sprite sheet data\r\n * @param epsilon defines the epsilon value to align texture (0.01 by default)\r\n * @param samplingMode defines the smapling mode to use with spritesheet\r\n * @param fromPacked set to true; do not alter\r\n */\r\n function SpritePackedManager(\r\n /** defines the packed manager's name */\r\n name, imgUrl, capacity, scene, spriteJSON, epsilon, samplingMode) {\r\n if (spriteJSON === void 0) { spriteJSON = null; }\r\n if (epsilon === void 0) { epsilon = 0.01; }\r\n if (samplingMode === void 0) { samplingMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__[\"Texture\"].TRILINEAR_SAMPLINGMODE; }\r\n var _this = \r\n //the cellSize parameter is not used when built from JSON which provides individual cell data, defaults to 64 if JSON load fails\r\n _super.call(this, name, imgUrl, capacity, 64, scene, epsilon, samplingMode, true, spriteJSON) || this;\r\n _this.name = name;\r\n return _this;\r\n }\r\n return SpritePackedManager;\r\n}(_spriteManager__WEBPACK_IMPORTED_MODULE_1__[\"SpriteManager\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./Sprites/spriteSceneComponent.ts\":\n/*!*****************************************!*\\\n !*** ./Sprites/spriteSceneComponent.ts ***!\n \\*****************************************/\n/*! exports provided: SpriteSceneComponent */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return SpriteSceneComponent; });\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scene */ \"./scene.ts\");\n/* harmony import */ var _Culling_ray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Culling/ray */ \"./Culling/ray.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Actions/actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype._internalPickSprites = function (ray, predicate, fastCheck, camera) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfo = null;\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n if (this.spriteManagers.length > 0) {\r\n for (var spriteIndex = 0; spriteIndex < this.spriteManagers.length; spriteIndex++) {\r\n var spriteManager = this.spriteManagers[spriteIndex];\r\n if (!spriteManager.isPickable) {\r\n continue;\r\n }\r\n var result = spriteManager.intersects(ray, camera, predicate, fastCheck);\r\n if (!result || !result.hit) {\r\n continue;\r\n }\r\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\r\n continue;\r\n }\r\n pickingInfo = result;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return pickingInfo || new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__[\"PickingInfo\"]();\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype._internalMultiPickSprites = function (ray, predicate, camera) {\r\n if (!_Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_3__[\"PickingInfo\"]) {\r\n return null;\r\n }\r\n var pickingInfos = new Array();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n if (this.spriteManagers.length > 0) {\r\n for (var spriteIndex = 0; spriteIndex < this.spriteManagers.length; spriteIndex++) {\r\n var spriteManager = this.spriteManagers[spriteIndex];\r\n if (!spriteManager.isPickable) {\r\n continue;\r\n }\r\n var results = spriteManager.multiIntersects(ray, camera, predicate);\r\n if (results !== null) {\r\n pickingInfos = pickingInfos.concat(results);\r\n }\r\n }\r\n }\r\n return pickingInfos;\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.pickSprite = function (x, y, predicate, fastCheck, camera) {\r\n this.createPickingRayInCameraSpaceToRef(x, y, this._tempSpritePickingRay, camera);\r\n return this._internalPickSprites(this._tempSpritePickingRay, predicate, fastCheck, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.pickSpriteWithRay = function (ray, predicate, fastCheck, camera) {\r\n if (!this._tempSpritePickingRay) {\r\n return null;\r\n }\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"].TransformToRef(ray, camera.getViewMatrix(), this._tempSpritePickingRay);\r\n return this._internalPickSprites(this._tempSpritePickingRay, predicate, fastCheck, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.multiPickSprite = function (x, y, predicate, camera) {\r\n this.createPickingRayInCameraSpaceToRef(x, y, this._tempSpritePickingRay, camera);\r\n return this._internalMultiPickSprites(this._tempSpritePickingRay, predicate, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.multiPickSpriteWithRay = function (ray, predicate, camera) {\r\n if (!this._tempSpritePickingRay) {\r\n return null;\r\n }\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return null;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"].TransformToRef(ray, camera.getViewMatrix(), this._tempSpritePickingRay);\r\n return this._internalMultiPickSprites(this._tempSpritePickingRay, predicate, camera);\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.setPointerOverSprite = function (sprite) {\r\n if (this._pointerOverSprite === sprite) {\r\n return;\r\n }\r\n if (this._pointerOverSprite && this._pointerOverSprite.actionManager) {\r\n this._pointerOverSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPointerOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(this._pointerOverSprite, this));\r\n }\r\n this._pointerOverSprite = sprite;\r\n if (this._pointerOverSprite && this._pointerOverSprite.actionManager) {\r\n this._pointerOverSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPointerOverTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(this._pointerOverSprite, this));\r\n }\r\n};\r\n_scene__WEBPACK_IMPORTED_MODULE_1__[\"Scene\"].prototype.getPointerOverSprite = function () {\r\n return this._pointerOverSprite;\r\n};\r\n/**\r\n * Defines the sprite scene component responsible to manage sprites\r\n * in a given scene.\r\n */\r\nvar SpriteSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function SpriteSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = _sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].NAME_SPRITE;\r\n this.scene = scene;\r\n this.scene.spriteManagers = new Array();\r\n this.scene._tempSpritePickingRay = _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"] ? _Culling_ray__WEBPACK_IMPORTED_MODULE_2__[\"Ray\"].Zero() : null;\r\n this.scene.onBeforeSpritesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this.scene.onAfterSpritesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_0__[\"Observable\"]();\r\n this._spritePredicate = function (sprite) {\r\n if (!sprite.actionManager) {\r\n return false;\r\n }\r\n return sprite.isPickable && sprite.actionManager.hasPointerTriggers;\r\n };\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n SpriteSceneComponent.prototype.register = function () {\r\n this.scene._pointerMoveStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_POINTERMOVE_SPRITE, this, this._pointerMove);\r\n this.scene._pointerDownStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_POINTERDOWN_SPRITE, this, this._pointerDown);\r\n this.scene._pointerUpStage.registerStep(_sceneComponent__WEBPACK_IMPORTED_MODULE_4__[\"SceneComponentConstants\"].STEP_POINTERUP_SPRITE, this, this._pointerUp);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n SpriteSceneComponent.prototype.rebuild = function () {\r\n /** Nothing to do for sprites */\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n SpriteSceneComponent.prototype.dispose = function () {\r\n this.scene.onBeforeSpritesRenderingObservable.clear();\r\n this.scene.onAfterSpritesRenderingObservable.clear();\r\n var spriteManagers = this.scene.spriteManagers;\r\n while (spriteManagers.length) {\r\n spriteManagers[0].dispose();\r\n }\r\n };\r\n SpriteSceneComponent.prototype._pickSpriteButKeepRay = function (originalPointerInfo, x, y, fastCheck, camera) {\r\n var result = this.scene.pickSprite(x, y, this._spritePredicate, fastCheck, camera);\r\n if (result) {\r\n result.ray = originalPointerInfo ? originalPointerInfo.ray : null;\r\n }\r\n return result;\r\n };\r\n SpriteSceneComponent.prototype._pointerMove = function (unTranslatedPointerX, unTranslatedPointerY, pickResult, isMeshPicked, canvas) {\r\n var scene = this.scene;\r\n if (isMeshPicked) {\r\n scene.setPointerOverSprite(null);\r\n }\r\n else {\r\n pickResult = this._pickSpriteButKeepRay(pickResult, unTranslatedPointerX, unTranslatedPointerY, false, scene.cameraToUseForPointers || undefined);\r\n if (pickResult && pickResult.hit && pickResult.pickedSprite) {\r\n scene.setPointerOverSprite(pickResult.pickedSprite);\r\n if (scene._pointerOverSprite && scene._pointerOverSprite.actionManager && scene._pointerOverSprite.actionManager.hoverCursor) {\r\n canvas.style.cursor = scene._pointerOverSprite.actionManager.hoverCursor;\r\n }\r\n else {\r\n canvas.style.cursor = scene.hoverCursor;\r\n }\r\n }\r\n else {\r\n scene.setPointerOverSprite(null);\r\n }\r\n }\r\n return pickResult;\r\n };\r\n SpriteSceneComponent.prototype._pointerDown = function (unTranslatedPointerX, unTranslatedPointerY, pickResult, evt) {\r\n var scene = this.scene;\r\n scene._pickedDownSprite = null;\r\n if (scene.spriteManagers.length > 0) {\r\n pickResult = scene.pickSprite(unTranslatedPointerX, unTranslatedPointerY, this._spritePredicate, false, scene.cameraToUseForPointers || undefined);\r\n if (pickResult && pickResult.hit && pickResult.pickedSprite) {\r\n if (pickResult.pickedSprite.actionManager) {\r\n scene._pickedDownSprite = pickResult.pickedSprite;\r\n switch (evt.button) {\r\n case 0:\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnLeftPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n break;\r\n case 1:\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnCenterPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n break;\r\n case 2:\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnRightPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n break;\r\n }\r\n if (pickResult.pickedSprite.actionManager) {\r\n pickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickDownTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(pickResult.pickedSprite, scene, evt));\r\n }\r\n }\r\n }\r\n }\r\n return pickResult;\r\n };\r\n SpriteSceneComponent.prototype._pointerUp = function (unTranslatedPointerX, unTranslatedPointerY, pickResult, evt) {\r\n var scene = this.scene;\r\n if (scene.spriteManagers.length > 0) {\r\n var spritePickResult = scene.pickSprite(unTranslatedPointerX, unTranslatedPointerY, this._spritePredicate, false, scene.cameraToUseForPointers || undefined);\r\n if (spritePickResult) {\r\n if (spritePickResult.hit && spritePickResult.pickedSprite) {\r\n if (spritePickResult.pickedSprite.actionManager) {\r\n spritePickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickUpTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(spritePickResult.pickedSprite, scene, evt));\r\n if (spritePickResult.pickedSprite.actionManager) {\r\n if (!this.scene._inputManager._isPointerSwiping()) {\r\n spritePickResult.pickedSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(spritePickResult.pickedSprite, scene, evt));\r\n }\r\n }\r\n }\r\n }\r\n if (scene._pickedDownSprite && scene._pickedDownSprite.actionManager && scene._pickedDownSprite !== spritePickResult.pickedSprite) {\r\n scene._pickedDownSprite.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_6__[\"Constants\"].ACTION_OnPickOutTrigger, _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_5__[\"ActionEvent\"].CreateNewFromSprite(scene._pickedDownSprite, scene, evt));\r\n }\r\n }\r\n }\r\n return pickResult;\r\n };\r\n return SpriteSceneComponent;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/alphaCullingState.ts\":\n/*!*************************************!*\\\n !*** ./States/alphaCullingState.ts ***!\n \\*************************************/\n/*! exports provided: _AlphaState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _AlphaState; });\n/**\r\n * @hidden\r\n **/\r\nvar _AlphaState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function _AlphaState() {\r\n this._isAlphaBlendDirty = false;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters = new Array(4);\r\n this._blendEquationParameters = new Array(2);\r\n this._blendConstants = new Array(4);\r\n this.reset();\r\n }\r\n Object.defineProperty(_AlphaState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isAlphaBlendDirty || this._isBlendFunctionParametersDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_AlphaState.prototype, \"alphaBlend\", {\r\n get: function () {\r\n return this._alphaBlend;\r\n },\r\n set: function (value) {\r\n if (this._alphaBlend === value) {\r\n return;\r\n }\r\n this._alphaBlend = value;\r\n this._isAlphaBlendDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n _AlphaState.prototype.setAlphaBlendConstants = function (r, g, b, a) {\r\n if (this._blendConstants[0] === r &&\r\n this._blendConstants[1] === g &&\r\n this._blendConstants[2] === b &&\r\n this._blendConstants[3] === a) {\r\n return;\r\n }\r\n this._blendConstants[0] = r;\r\n this._blendConstants[1] = g;\r\n this._blendConstants[2] = b;\r\n this._blendConstants[3] = a;\r\n this._isBlendConstantsDirty = true;\r\n };\r\n _AlphaState.prototype.setAlphaBlendFunctionParameters = function (value0, value1, value2, value3) {\r\n if (this._blendFunctionParameters[0] === value0 &&\r\n this._blendFunctionParameters[1] === value1 &&\r\n this._blendFunctionParameters[2] === value2 &&\r\n this._blendFunctionParameters[3] === value3) {\r\n return;\r\n }\r\n this._blendFunctionParameters[0] = value0;\r\n this._blendFunctionParameters[1] = value1;\r\n this._blendFunctionParameters[2] = value2;\r\n this._blendFunctionParameters[3] = value3;\r\n this._isBlendFunctionParametersDirty = true;\r\n };\r\n _AlphaState.prototype.setAlphaEquationParameters = function (rgb, alpha) {\r\n if (this._blendEquationParameters[0] === rgb &&\r\n this._blendEquationParameters[1] === alpha) {\r\n return;\r\n }\r\n this._blendEquationParameters[0] = rgb;\r\n this._blendEquationParameters[1] = alpha;\r\n this._isBlendEquationParametersDirty = true;\r\n };\r\n _AlphaState.prototype.reset = function () {\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters[0] = null;\r\n this._blendFunctionParameters[1] = null;\r\n this._blendFunctionParameters[2] = null;\r\n this._blendFunctionParameters[3] = null;\r\n this._blendEquationParameters[0] = null;\r\n this._blendEquationParameters[1] = null;\r\n this._blendConstants[0] = null;\r\n this._blendConstants[1] = null;\r\n this._blendConstants[2] = null;\r\n this._blendConstants[3] = null;\r\n this._isAlphaBlendDirty = true;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n };\r\n _AlphaState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Alpha blend\r\n if (this._isAlphaBlendDirty) {\r\n if (this._alphaBlend) {\r\n gl.enable(gl.BLEND);\r\n }\r\n else {\r\n gl.disable(gl.BLEND);\r\n }\r\n this._isAlphaBlendDirty = false;\r\n }\r\n // Alpha function\r\n if (this._isBlendFunctionParametersDirty) {\r\n gl.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]);\r\n this._isBlendFunctionParametersDirty = false;\r\n }\r\n // Alpha equation\r\n if (this._isBlendEquationParametersDirty) {\r\n gl.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]);\r\n this._isBlendEquationParametersDirty = false;\r\n }\r\n // Constants\r\n if (this._isBlendConstantsDirty) {\r\n gl.blendColor(this._blendConstants[0], this._blendConstants[1], this._blendConstants[2], this._blendConstants[3]);\r\n this._isBlendConstantsDirty = false;\r\n }\r\n };\r\n return _AlphaState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/depthCullingState.ts\":\n/*!*************************************!*\\\n !*** ./States/depthCullingState.ts ***!\n \\*************************************/\n/*! exports provided: _DepthCullingState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _DepthCullingState; });\n/**\r\n * @hidden\r\n **/\r\nvar _DepthCullingState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function _DepthCullingState() {\r\n this._isDepthTestDirty = false;\r\n this._isDepthMaskDirty = false;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(_DepthCullingState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isDepthFuncDirty || this._isDepthTestDirty || this._isDepthMaskDirty || this._isCullFaceDirty || this._isCullDirty || this._isZOffsetDirty || this._isFrontFaceDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"zOffset\", {\r\n get: function () {\r\n return this._zOffset;\r\n },\r\n set: function (value) {\r\n if (this._zOffset === value) {\r\n return;\r\n }\r\n this._zOffset = value;\r\n this._isZOffsetDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"cullFace\", {\r\n get: function () {\r\n return this._cullFace;\r\n },\r\n set: function (value) {\r\n if (this._cullFace === value) {\r\n return;\r\n }\r\n this._cullFace = value;\r\n this._isCullFaceDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"cull\", {\r\n get: function () {\r\n return this._cull;\r\n },\r\n set: function (value) {\r\n if (this._cull === value) {\r\n return;\r\n }\r\n this._cull = value;\r\n this._isCullDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"depthFunc\", {\r\n get: function () {\r\n return this._depthFunc;\r\n },\r\n set: function (value) {\r\n if (this._depthFunc === value) {\r\n return;\r\n }\r\n this._depthFunc = value;\r\n this._isDepthFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"depthMask\", {\r\n get: function () {\r\n return this._depthMask;\r\n },\r\n set: function (value) {\r\n if (this._depthMask === value) {\r\n return;\r\n }\r\n this._depthMask = value;\r\n this._isDepthMaskDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"depthTest\", {\r\n get: function () {\r\n return this._depthTest;\r\n },\r\n set: function (value) {\r\n if (this._depthTest === value) {\r\n return;\r\n }\r\n this._depthTest = value;\r\n this._isDepthTestDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_DepthCullingState.prototype, \"frontFace\", {\r\n get: function () {\r\n return this._frontFace;\r\n },\r\n set: function (value) {\r\n if (this._frontFace === value) {\r\n return;\r\n }\r\n this._frontFace = value;\r\n this._isFrontFaceDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n _DepthCullingState.prototype.reset = function () {\r\n this._depthMask = true;\r\n this._depthTest = true;\r\n this._depthFunc = null;\r\n this._cullFace = null;\r\n this._cull = null;\r\n this._zOffset = 0;\r\n this._frontFace = null;\r\n this._isDepthTestDirty = true;\r\n this._isDepthMaskDirty = true;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n };\r\n _DepthCullingState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Cull\r\n if (this._isCullDirty) {\r\n if (this.cull) {\r\n gl.enable(gl.CULL_FACE);\r\n }\r\n else {\r\n gl.disable(gl.CULL_FACE);\r\n }\r\n this._isCullDirty = false;\r\n }\r\n // Cull face\r\n if (this._isCullFaceDirty) {\r\n gl.cullFace(this.cullFace);\r\n this._isCullFaceDirty = false;\r\n }\r\n // Depth mask\r\n if (this._isDepthMaskDirty) {\r\n gl.depthMask(this.depthMask);\r\n this._isDepthMaskDirty = false;\r\n }\r\n // Depth test\r\n if (this._isDepthTestDirty) {\r\n if (this.depthTest) {\r\n gl.enable(gl.DEPTH_TEST);\r\n }\r\n else {\r\n gl.disable(gl.DEPTH_TEST);\r\n }\r\n this._isDepthTestDirty = false;\r\n }\r\n // Depth func\r\n if (this._isDepthFuncDirty) {\r\n gl.depthFunc(this.depthFunc);\r\n this._isDepthFuncDirty = false;\r\n }\r\n // zOffset\r\n if (this._isZOffsetDirty) {\r\n if (this.zOffset) {\r\n gl.enable(gl.POLYGON_OFFSET_FILL);\r\n gl.polygonOffset(this.zOffset, 0);\r\n }\r\n else {\r\n gl.disable(gl.POLYGON_OFFSET_FILL);\r\n }\r\n this._isZOffsetDirty = false;\r\n }\r\n // Front face\r\n if (this._isFrontFaceDirty) {\r\n gl.frontFace(this.frontFace);\r\n this._isFrontFaceDirty = false;\r\n }\r\n };\r\n return _DepthCullingState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/index.ts\":\n/*!*************************!*\\\n !*** ./States/index.ts ***!\n \\*************************/\n/*! exports provided: _AlphaState, _DepthCullingState, _StencilState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _alphaCullingState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alphaCullingState */ \"./States/alphaCullingState.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _alphaCullingState__WEBPACK_IMPORTED_MODULE_0__[\"_AlphaState\"]; });\n\n/* harmony import */ var _depthCullingState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./depthCullingState */ \"./States/depthCullingState.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _depthCullingState__WEBPACK_IMPORTED_MODULE_1__[\"_DepthCullingState\"]; });\n\n/* harmony import */ var _stencilState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stencilState */ \"./States/stencilState.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _stencilState__WEBPACK_IMPORTED_MODULE_2__[\"_StencilState\"]; });\n\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./States/stencilState.ts\":\n/*!********************************!*\\\n !*** ./States/stencilState.ts ***!\n \\********************************/\n/*! exports provided: _StencilState */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _StencilState; });\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Engines/constants */ \"./Engines/constants.ts\");\n\r\n/**\r\n * @hidden\r\n **/\r\nvar _StencilState = /** @class */ (function () {\r\n function _StencilState() {\r\n this._isStencilTestDirty = false;\r\n this._isStencilMaskDirty = false;\r\n this._isStencilFuncDirty = false;\r\n this._isStencilOpDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(_StencilState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilFunc\", {\r\n get: function () {\r\n return this._stencilFunc;\r\n },\r\n set: function (value) {\r\n if (this._stencilFunc === value) {\r\n return;\r\n }\r\n this._stencilFunc = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilFuncRef\", {\r\n get: function () {\r\n return this._stencilFuncRef;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncRef === value) {\r\n return;\r\n }\r\n this._stencilFuncRef = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilFuncMask\", {\r\n get: function () {\r\n return this._stencilFuncMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncMask === value) {\r\n return;\r\n }\r\n this._stencilFuncMask = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilOpStencilFail\", {\r\n get: function () {\r\n return this._stencilOpStencilFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilFail === value) {\r\n return;\r\n }\r\n this._stencilOpStencilFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilOpDepthFail\", {\r\n get: function () {\r\n return this._stencilOpDepthFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpDepthFail === value) {\r\n return;\r\n }\r\n this._stencilOpDepthFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilOpStencilDepthPass\", {\r\n get: function () {\r\n return this._stencilOpStencilDepthPass;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilDepthPass === value) {\r\n return;\r\n }\r\n this._stencilOpStencilDepthPass = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilMask\", {\r\n get: function () {\r\n return this._stencilMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilMask === value) {\r\n return;\r\n }\r\n this._stencilMask = value;\r\n this._isStencilMaskDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(_StencilState.prototype, \"stencilTest\", {\r\n get: function () {\r\n return this._stencilTest;\r\n },\r\n set: function (value) {\r\n if (this._stencilTest === value) {\r\n return;\r\n }\r\n this._stencilTest = value;\r\n this._isStencilTestDirty = true;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n _StencilState.prototype.reset = function () {\r\n this._stencilTest = false;\r\n this._stencilMask = 0xFF;\r\n this._stencilFunc = _StencilState.ALWAYS;\r\n this._stencilFuncRef = 1;\r\n this._stencilFuncMask = 0xFF;\r\n this._stencilOpStencilFail = _StencilState.KEEP;\r\n this._stencilOpDepthFail = _StencilState.KEEP;\r\n this._stencilOpStencilDepthPass = _StencilState.REPLACE;\r\n this._isStencilTestDirty = true;\r\n this._isStencilMaskDirty = true;\r\n this._isStencilFuncDirty = true;\r\n this._isStencilOpDirty = true;\r\n };\r\n _StencilState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Stencil test\r\n if (this._isStencilTestDirty) {\r\n if (this.stencilTest) {\r\n gl.enable(gl.STENCIL_TEST);\r\n }\r\n else {\r\n gl.disable(gl.STENCIL_TEST);\r\n }\r\n this._isStencilTestDirty = false;\r\n }\r\n // Stencil mask\r\n if (this._isStencilMaskDirty) {\r\n gl.stencilMask(this.stencilMask);\r\n this._isStencilMaskDirty = false;\r\n }\r\n // Stencil func\r\n if (this._isStencilFuncDirty) {\r\n gl.stencilFunc(this.stencilFunc, this.stencilFuncRef, this.stencilFuncMask);\r\n this._isStencilFuncDirty = false;\r\n }\r\n // Stencil op\r\n if (this._isStencilOpDirty) {\r\n gl.stencilOp(this.stencilOpStencilFail, this.stencilOpDepthFail, this.stencilOpStencilDepthPass);\r\n this._isStencilOpDirty = false;\r\n }\r\n };\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n _StencilState.ALWAYS = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].ALWAYS;\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n _StencilState.KEEP = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].KEEP;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n _StencilState.REPLACE = _Engines_constants__WEBPACK_IMPORTED_MODULE_0__[\"Constants\"].REPLACE;\r\n return _StencilState;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./abstractScene.ts\":\n/*!**************************!*\\\n !*** ./abstractScene.ts ***!\n \\**************************/\n/*! exports provided: AbstractScene */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AbstractScene\", function() { return AbstractScene; });\n/**\r\n * Base class of the scene acting as a container for the different elements composing a scene.\r\n * This class is dynamically extended by the different components of the scene increasing\r\n * flexibility and reducing coupling\r\n */\r\nvar AbstractScene = /** @class */ (function () {\r\n function AbstractScene() {\r\n /**\r\n * Gets the list of root nodes (ie. nodes with no parent)\r\n */\r\n this.rootNodes = new Array();\r\n /** All of the cameras added to this scene\r\n * @see http://doc.babylonjs.com/babylon101/cameras\r\n */\r\n this.cameras = new Array();\r\n /**\r\n * All of the lights added to this scene\r\n * @see http://doc.babylonjs.com/babylon101/lights\r\n */\r\n this.lights = new Array();\r\n /**\r\n * All of the (abstract) meshes added to this scene\r\n */\r\n this.meshes = new Array();\r\n /**\r\n * The list of skeletons added to the scene\r\n * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\n this.skeletons = new Array();\r\n /**\r\n * All of the particle systems added to this scene\r\n * @see http://doc.babylonjs.com/babylon101/particles\r\n */\r\n this.particleSystems = new Array();\r\n /**\r\n * Gets a list of Animations associated with the scene\r\n */\r\n this.animations = [];\r\n /**\r\n * All of the animation groups added to this scene\r\n * @see http://doc.babylonjs.com/how_to/group\r\n */\r\n this.animationGroups = new Array();\r\n /**\r\n * All of the multi-materials added to this scene\r\n * @see http://doc.babylonjs.com/how_to/multi_materials\r\n */\r\n this.multiMaterials = new Array();\r\n /**\r\n * All of the materials added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addMaterial and removeMAterial Scene methods.\r\n * Note also that the order of the Material wihin the array is not significant and might change.\r\n * @see http://doc.babylonjs.com/babylon101/materials\r\n */\r\n this.materials = new Array();\r\n /**\r\n * The list of morph target managers added to the scene\r\n * @see http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh\r\n */\r\n this.morphTargetManagers = new Array();\r\n /**\r\n * The list of geometries used in the scene.\r\n */\r\n this.geometries = new Array();\r\n /**\r\n * All of the tranform nodes added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\r\n * Note also that the order of the TransformNode wihin the array is not significant and might change.\r\n * @see http://doc.babylonjs.com/how_to/transformnode\r\n */\r\n this.transformNodes = new Array();\r\n /**\r\n * ActionManagers available on the scene.\r\n */\r\n this.actionManagers = new Array();\r\n /**\r\n * Textures to keep.\r\n */\r\n this.textures = new Array();\r\n /**\r\n * Environment texture for the scene\r\n */\r\n this.environmentTexture = null;\r\n }\r\n /**\r\n * Adds a parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n AbstractScene.AddParser = function (name, parser) {\r\n this._BabylonFileParsers[name] = parser;\r\n };\r\n /**\r\n * Gets a general parser from the list of avaialble ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n AbstractScene.GetParser = function (name) {\r\n if (this._BabylonFileParsers[name]) {\r\n return this._BabylonFileParsers[name];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Adds n individual parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n AbstractScene.AddIndividualParser = function (name, parser) {\r\n this._IndividualBabylonFileParsers[name] = parser;\r\n };\r\n /**\r\n * Gets an individual parser from the list of avaialble ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n AbstractScene.GetIndividualParser = function (name) {\r\n if (this._IndividualBabylonFileParsers[name]) {\r\n return this._IndividualBabylonFileParsers[name];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Parser json data and populate both a scene and its associated container object\r\n * @param jsonData Defines the data to parse\r\n * @param scene Defines the scene to parse the data for\r\n * @param container Defines the container attached to the parsing sequence\r\n * @param rootUrl Defines the root url of the data\r\n */\r\n AbstractScene.Parse = function (jsonData, scene, container, rootUrl) {\r\n for (var parserName in this._BabylonFileParsers) {\r\n if (this._BabylonFileParsers.hasOwnProperty(parserName)) {\r\n this._BabylonFileParsers[parserName](jsonData, scene, container, rootUrl);\r\n }\r\n }\r\n };\r\n /**\r\n * Stores the list of available parsers in the application.\r\n */\r\n AbstractScene._BabylonFileParsers = {};\r\n /**\r\n * Stores the list of available individual parsers in the application.\r\n */\r\n AbstractScene._IndividualBabylonFileParsers = {};\r\n return AbstractScene;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./assetContainer.ts\":\n/*!***************************!*\\\n !*** ./assetContainer.ts ***!\n \\***************************/\n/*! exports provided: KeepAssets, AssetContainer */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"KeepAssets\", function() { return KeepAssets; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"AssetContainer\", function() { return AssetContainer; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Meshes/mesh */ \"./Meshes/mesh.ts\");\n\r\n\r\n\r\n/**\r\n * Set of assets to keep when moving a scene into an asset container.\r\n */\r\nvar KeepAssets = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](KeepAssets, _super);\r\n function KeepAssets() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return KeepAssets;\r\n}(_abstractScene__WEBPACK_IMPORTED_MODULE_1__[\"AbstractScene\"]));\r\n\r\n/**\r\n * Container with a set of assets that can be added or removed from a scene.\r\n */\r\nvar AssetContainer = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](AssetContainer, _super);\r\n /**\r\n * Instantiates an AssetContainer.\r\n * @param scene The scene the AssetContainer belongs to.\r\n */\r\n function AssetContainer(scene) {\r\n var _this = _super.call(this) || this;\r\n _this.scene = scene;\r\n _this[\"sounds\"] = [];\r\n _this[\"effectLayers\"] = [];\r\n _this[\"layers\"] = [];\r\n _this[\"lensFlareSystems\"] = [];\r\n _this[\"proceduralTextures\"] = [];\r\n _this[\"reflectionProbes\"] = [];\r\n return _this;\r\n }\r\n /**\r\n * Adds all the assets from the container to the scene.\r\n */\r\n AssetContainer.prototype.addAllToScene = function () {\r\n var _this = this;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.addCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.addLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.addMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.addSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.addAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.addAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.addMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.addMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.addMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.addGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.addTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.addActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.addTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.addReflectionProbe(o);\r\n });\r\n if (this.environmentTexture) {\r\n this.scene.environmentTexture = this.environmentTexture;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.addFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Removes all the assets in the container from the scene\r\n */\r\n AssetContainer.prototype.removeAllFromScene = function () {\r\n var _this = this;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.removeCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.removeLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.removeMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.removeSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.removeAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.removeAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.removeMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.removeMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.removeMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.removeGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.removeTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.removeActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.removeTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.removeReflectionProbe(o);\r\n });\r\n if (this.environmentTexture === this.scene.environmentTexture) {\r\n this.scene.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Disposes all the assets in the container\r\n */\r\n AssetContainer.prototype.dispose = function () {\r\n this.cameras.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.cameras = [];\r\n this.lights.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.lights = [];\r\n this.meshes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.meshes = [];\r\n this.skeletons.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.skeletons = [];\r\n this.animationGroups.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.animationGroups = [];\r\n this.multiMaterials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.multiMaterials = [];\r\n this.materials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.materials = [];\r\n this.geometries.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.geometries = [];\r\n this.transformNodes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.transformNodes = [];\r\n this.actionManagers.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.actionManagers = [];\r\n this.textures.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.textures = [];\r\n this.reflectionProbes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.reflectionProbes = [];\r\n if (this.environmentTexture) {\r\n this.environmentTexture.dispose();\r\n this.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this, true);\r\n }\r\n };\r\n AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {\r\n if (!sourceAssets) {\r\n return;\r\n }\r\n for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {\r\n var asset = sourceAssets_1[_i];\r\n var move = true;\r\n if (keepAssets) {\r\n for (var _a = 0, keepAssets_1 = keepAssets; _a < keepAssets_1.length; _a++) {\r\n var keepAsset = keepAssets_1[_a];\r\n if (asset === keepAsset) {\r\n move = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (move) {\r\n targetAssets.push(asset);\r\n }\r\n }\r\n };\r\n /**\r\n * Removes all the assets contained in the scene and adds them to the container.\r\n * @param keepAssets Set of assets to keep in the scene. (default: empty)\r\n */\r\n AssetContainer.prototype.moveAllFromScene = function (keepAssets) {\r\n if (keepAssets === undefined) {\r\n keepAssets = new KeepAssets();\r\n }\r\n for (var key in this) {\r\n if (this.hasOwnProperty(key)) {\r\n this[key] = this[key] || (key === \"environmentTexture\" ? null : []);\r\n this._moveAssets(this.scene[key], this[key], keepAssets[key]);\r\n }\r\n }\r\n this.removeAllFromScene();\r\n };\r\n /**\r\n * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.\r\n * @returns the root mesh\r\n */\r\n AssetContainer.prototype.createRootMesh = function () {\r\n var rootMesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__[\"Mesh\"](\"assetContainerRootMesh\", this.scene);\r\n this.meshes.forEach(function (m) {\r\n if (!m.parent) {\r\n rootMesh.addChild(m);\r\n }\r\n });\r\n this.meshes.unshift(rootMesh);\r\n return rootMesh;\r\n };\r\n return AssetContainer;\r\n}(_abstractScene__WEBPACK_IMPORTED_MODULE_1__[\"AbstractScene\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./index.ts\":\n/*!******************!*\\\n !*** ./index.ts ***!\n \\******************/\n/*! exports provided: AbstractScene, KeepAssets, AssetContainer, Node, Scene, SceneComponentConstants, Stage, AbstractActionManager, Action, ActionEvent, ActionManager, Condition, ValueCondition, PredicateCondition, StateCondition, SwitchBooleanAction, SetStateAction, SetValueAction, IncrementValueAction, PlayAnimationAction, StopAnimationAction, DoNothingAction, CombineAction, ExecuteCodeAction, SetParentAction, PlaySoundAction, StopSoundAction, InterpolateValueAction, Animatable, _IAnimationState, Animation, TargetedAnimation, AnimationGroup, AnimationPropertiesOverride, EasingFunction, CircleEase, BackEase, BounceEase, CubicEase, ElasticEase, ExponentialEase, PowerEase, QuadraticEase, QuarticEase, QuinticEase, SineEase, BezierCurveEase, RuntimeAnimation, AnimationEvent, AnimationKeyInterpolation, AnimationRange, Analyser, AudioEngine, AudioSceneComponent, Sound, SoundTrack, WeightedSound, AutoRotationBehavior, BouncingBehavior, FramingBehavior, PointerDragBehavior, Bone, BoneIKController, BoneLookController, Skeleton, CameraInputTypes, CameraInputsManager, Camera, TargetCamera, FreeCamera, FreeCameraInputsManager, TouchCamera, ArcRotateCamera, ArcRotateCameraInputsManager, DeviceOrientationCamera, FlyCamera, FlyCameraInputsManager, FollowCamera, ArcFollowCamera, FollowCameraInputsManager, GamepadCamera, UniversalCamera, VirtualJoysticksCamera, Collider, DefaultCollisionCoordinator, PickingInfo, IntersectionInfo, _MeshCollisionData, BoundingBox, BoundingInfo, BoundingSphere, Ray, AxesViewer, BoneAxesViewer, DebugLayer, PhysicsViewer, RayHelper, SkeletonViewer, Constants, InstancingAttributeInfo, DepthTextureCreationOptions, EngineCapabilities, Engine, EngineStore, NullEngineOptions, NullEngine, WebGLPipelineContext, WebGL2ShaderProcessor, NativeEngine, KeyboardEventTypes, KeyboardInfo, KeyboardInfoPre, PointerEventTypes, PointerInfoBase, PointerInfoPre, PointerInfo, ClipboardEventTypes, ClipboardInfo, DaydreamController, GearVRController, GenericController, OculusTouchController, PoseEnabledControllerType, PoseEnabledControllerHelper, PoseEnabledController, ViveController, WebVRController, WindowsMotionController, StickValues, Gamepad, GenericPad, GamepadManager, GamepadSystemSceneComponent, Xbox360Button, Xbox360Dpad, Xbox360Pad, DualShockButton, DualShockDpad, DualShockPad, AxisDragGizmo, AxisScaleGizmo, BoundingBoxGizmo, Gizmo, GizmoManager, PlaneRotationGizmo, PositionGizmo, RotationGizmo, ScaleGizmo, LightGizmo, PlaneDragGizmo, EnvironmentHelper, PhotoDome, _forceSceneHelpersToBundle, VideoDome, EngineInstrumentation, SceneInstrumentation, _TimeToken, EffectLayer, EffectLayerSceneComponent, GlowLayer, HighlightLayer, Layer, LayerSceneComponent, LensFlare, LensFlareSystem, LensFlareSystemSceneComponent, Light, ShadowLight, DirectionalLight, HemisphericLight, PointLight, SpotLight, DefaultLoadingScreen, SceneLoaderProgressEvent, SceneLoader, SceneLoaderFlags, ColorCurves, EffectFallbacks, EffectCreationOptions, Effect, FresnelParameters, ImageProcessingConfigurationDefines, ImageProcessingConfiguration, Material, MaterialDefines, MaterialHelper, MultiMaterial, PushMaterial, ShaderMaterial, StandardMaterialDefines, StandardMaterial, BaseTexture, CubeTexture, DynamicTexture, EquiRectangularCubeTexture, HDRCubeTexture, InternalTexture, MirrorTexture, MultiRenderTarget, RawTexture, RenderTargetTexture, Texture, UniformBuffer, MaterialFlags, EffectRenderer, EffectWrapper, Scalar, Space, Axis, Color3, Color4, TmpColors, ToGammaSpace, ToLinearSpace, Epsilon, Frustum, Plane, Size, Vector2, Vector3, Vector4, Quaternion, Matrix, TmpVectors, Viewport, SphericalHarmonics, SphericalPolynomial, AbstractMesh, Buffer, VertexBuffer, CSG, Geometry, GroundMesh, TrailMesh, InstancedMesh, LinesMesh, InstancedLinesMesh, _CreationDataStorage, _InstancesBatch, Mesh, VertexData, MeshBuilder, SimplificationSettings, SimplificationQueue, SimplificationType, SimplicationQueueSceneComponent, Polygon, PolygonMeshBuilder, BaseSubMesh, SubMesh, MeshLODLevel, TransformNode, BoxBuilder, SphereBuilder, CylinderBuilder, TorusBuilder, LinesBuilder, PlaneBuilder, GroundBuilder, DataBuffer, WebGLDataBuffer, MorphTarget, MorphTargetManager, Database, BaseParticleSystem, GPUParticleSystem, Particle, ParticleHelper, ParticleSystem, _IDoNeedToBeInTheBuild, ParticleSystemSet, SolidParticle, ModelShape, DepthSortedParticle, SolidParticleSystem, SubEmitterType, SubEmitter, PhysicsEngine, PhysicsEngineSceneComponent, PhysicsHelper, PhysicsRadialExplosionEventOptions, PhysicsUpdraftEventOptions, PhysicsVortexEventOptions, PhysicsRadialImpulseFalloff, PhysicsUpdraftMode, PhysicsImpostor, PhysicsJoint, DistanceJoint, MotorEnabledJoint, HingeJoint, Hinge2Joint, AnaglyphPostProcess, BlackAndWhitePostProcess, BloomEffect, BloomMergePostProcess, BlurPostProcess, ChromaticAberrationPostProcess, CircleOfConfusionPostProcess, ColorCorrectionPostProcess, ConvolutionPostProcess, DepthOfFieldBlurPostProcess, DepthOfFieldEffectBlurLevel, DepthOfFieldEffect, DepthOfFieldMergePostProcessOptions, DepthOfFieldMergePostProcess, DisplayPassPostProcess, ExtractHighlightsPostProcess, FilterPostProcess, FxaaPostProcess, GrainPostProcess, HighlightsPostProcess, ImageProcessingPostProcess, MotionBlurPostProcess, PassPostProcess, PassCubePostProcess, PostProcess, PostProcessManager, RefractionPostProcess, SharpenPostProcess, StereoscopicInterlacePostProcess, TonemappingOperator, TonemapPostProcess, VolumetricLightScatteringPostProcess, VRDistortionCorrectionPostProcess, VRMultiviewToSingleviewPostProcess, ReflectionProbe, BoundingBoxRenderer, DepthRenderer, DepthRendererSceneComponent, EdgesRenderer, LineEdgesRenderer, GeometryBufferRenderer, GeometryBufferRendererSceneComponent, OutlineRenderer, RenderingGroup, RenderingGroupInfo, RenderingManager, UtilityLayerRenderer, Sprite, SpriteManager, SpritePackedManager, SpriteSceneComponent, _AlphaState, _DepthCullingState, _StencilState, AndOrNotEvaluator, AssetTaskState, AbstractAssetTask, AssetsProgressEvent, MeshAssetTask, TextFileAssetTask, BinaryFileAssetTask, ImageAssetTask, TextureAssetTask, CubeTextureAssetTask, HDRCubeTextureAssetTask, EquiRectangularCubeTextureAssetTask, AssetsManager, DDSTools, expandToProperty, serialize, serializeAsTexture, serializeAsColor3, serializeAsFresnelParameters, serializeAsVector2, serializeAsVector3, serializeAsMeshReference, serializeAsColorCurves, serializeAsColor4, serializeAsImageProcessingConfiguration, serializeAsQuaternion, serializeAsMatrix, serializeAsCameraReference, SerializationHelper, Deferred, EnvironmentTextureTools, MeshExploder, FilesInput, CubeMapToSphericalPolynomialTools, KhronosTextureContainer, EventState, Observer, MultiObserver, Observable, PerformanceMonitor, RollingAverage, PromisePolyfill, SceneOptimization, TextureOptimization, HardwareScalingOptimization, ShadowsOptimization, PostProcessesOptimization, LensFlaresOptimization, CustomOptimization, ParticlesOptimization, RenderTargetsOptimization, MergeMeshesOptimization, SceneOptimizerOptions, SceneOptimizer, SceneSerializer, SmartArray, SmartArrayNoDuplicate, StringDictionary, Tags, TextureTools, TGATools, Tools, className, AsyncLoop, VideoRecorder, JoystickAxis, VirtualJoystick, WorkerPool, Logger, _TypeStore, FilesInputStore, DeepCopier, PivotTools, PrecisionDate, ScreenshotTools, WebRequest, InspectableType, BRDFTextureTools, RGBDTextureTools, ColorGradient, Color3Gradient, FactorGradient, GradientHelper, PerfCounter, RetryStrategy, LoadFileError, AttachToBoxBehavior, FadeInOutBehavior, MultiPointerScaleBehavior, SixDofDragBehavior, ArcRotateCameraGamepadInput, ArcRotateCameraKeyboardMoveInput, ArcRotateCameraMouseWheelInput, ArcRotateCameraPointersInput, ArcRotateCameraVRDeviceOrientationInput, FlyCameraKeyboardInput, FlyCameraMouseInput, FollowCameraKeyboardMoveInput, FollowCameraMouseWheelInput, FollowCameraPointersInput, FreeCameraDeviceOrientationInput, FreeCameraGamepadInput, FreeCameraKeyboardMoveInput, FreeCameraMouseInput, FreeCameraTouchInput, FreeCameraVirtualJoystickInput, AnaglyphArcRotateCamera, AnaglyphFreeCamera, AnaglyphGamepadCamera, AnaglyphUniversalCamera, StereoscopicArcRotateCamera, StereoscopicFreeCamera, StereoscopicGamepadCamera, StereoscopicUniversalCamera, VRCameraMetrics, VRDeviceOrientationArcRotateCamera, VRDeviceOrientationFreeCamera, VRDeviceOrientationGamepadCamera, OnAfterEnteringVRObservableEvent, VRExperienceHelper, WebVRFreeCamera, WebXRCamera, WebXREnterExitUIButton, WebXREnterExitUIOptions, WebXREnterExitUI, WebXRState, WebXRExperienceHelper, WebXRInput, WebXRControllerTeleportation, WebXRControllerPointerSelection, WebXRControllerModelLoader, WebXRController, WebXRManagedOutputCanvas, WebXRSessionManager, Octree, OctreeBlock, OctreeSceneComponent, _OcclusionDataStorage, _forceTransformFeedbackToBundle, ShadowGenerator, ShadowGeneratorSceneComponent, _BabylonLoaderRegistered, BackgroundMaterial, PBRMaterialDefines, PBRBaseMaterial, PBRBaseSimpleMaterial, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSpecularGlossinessMaterial, ColorGradingTexture, RawCubeTexture, RawTexture3D, RefractionTexture, VideoTexture, HtmlElementTexture, NodeMaterialBlockTargets, NodeMaterialBlockConnectionPointTypes, NodeMaterialConnectionPoint, NodeMaterialBlock, NodeMaterialDefines, NodeMaterial, NodeMaterialSystemValues, Orientation, BezierCurve, Angle, Arc2, Path2, Path3D, Curve3, PositionNormalVertex, PositionNormalTextureVertex, DracoCompression, TiledBoxBuilder, DiscBuilder, RibbonBuilder, HemisphereBuilder, TorusKnotBuilder, PolygonBuilder, ShapeBuilder, LatheBuilder, TiledPlaneBuilder, TubeBuilder, PolyhedronBuilder, IcoSphereBuilder, DecalBuilder, RecastJSPlugin, RecastJSCrowd, BoxParticleEmitter, ConeParticleEmitter, CylinderParticleEmitter, CylinderDirectedParticleEmitter, HemisphericParticleEmitter, PointParticleEmitter, SphereParticleEmitter, SphereDirectedParticleEmitter, CannonJSPlugin, AmmoJSPlugin, OimoJSPlugin, PostProcessRenderEffect, PostProcessRenderPipeline, PostProcessRenderPipelineManager, PostProcessRenderPipelineManagerSceneComponent, HDRTools, PanoramaToCubeMapTools, _DDSTextureLoader, _ENVTextureLoader, _KTXTextureLoader, _TGATextureLoader, _BasisTextureLoader, CustomProceduralTexture, NoiseProceduralTexture, ProceduralTexture, ProceduralTextureSceneComponent, MultiplyBlock, AddBlock, ScaleBlock, ClampBlock, CrossBlock, DotBlock, TransformBlock, RemapBlock, NormalizeBlock, TrigonometryBlockOperations, TrigonometryBlock, ColorMergerBlock, VectorMergerBlock, ColorSplitterBlock, VectorSplitterBlock, LerpBlock, DivideBlock, SubtractBlock, StepBlock, OppositeBlock, ViewDirectionBlock, FresnelBlock, MaxBlock, MinBlock, NodeMaterialOptimizer, DefaultRenderingPipeline, LensRenderingPipeline, SSAO2RenderingPipeline, SSAORenderingPipeline, StandardRenderingPipeline, VertexOutputBlock, BonesBlock, InstancesBlock, MorphTargetsBlock, LightInformationBlock, FragmentOutputBlock, AlphaTestBlock, ImageProcessingBlock, PerturbNormalBlock, FogBlock, LightBlock, TextureBlock, ReflectionTextureBlock, InputBlock, AnimatedInputBlockTypes */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstractScene */ \"./abstractScene.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractScene\", function() { return _abstractScene__WEBPACK_IMPORTED_MODULE_0__[\"AbstractScene\"]; });\n\n/* harmony import */ var _Actions_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Actions/index */ \"./Actions/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractActionManager\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"AbstractActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Action\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"Action\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionEvent\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ActionEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ActionManager\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ActionManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Condition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"Condition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ValueCondition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ValueCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PredicateCondition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"PredicateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StateCondition\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"StateCondition\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SwitchBooleanAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SwitchBooleanAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetStateAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SetStateAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetValueAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SetValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IncrementValueAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"IncrementValueAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlayAnimationAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"PlayAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopAnimationAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"StopAnimationAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DoNothingAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"DoNothingAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CombineAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"CombineAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExecuteCodeAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"ExecuteCodeAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SetParentAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"SetParentAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaySoundAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"PlaySoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StopSoundAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"StopSoundAction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InterpolateValueAction\", function() { return _Actions_index__WEBPACK_IMPORTED_MODULE_1__[\"InterpolateValueAction\"]; });\n\n/* harmony import */ var _Animations_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Animations/index */ \"./Animations/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animatable\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"Animatable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IAnimationState\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"_IAnimationState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Animation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"Animation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetedAnimation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"TargetedAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationGroup\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationPropertiesOverride\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationPropertiesOverride\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EasingFunction\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"EasingFunction\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"CircleEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"BackEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BounceEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"BounceEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubicEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"CubicEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ElasticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"ElasticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExponentialEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"ExponentialEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PowerEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"PowerEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuadraticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"QuadraticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuarticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"QuarticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"QuinticEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"QuinticEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SineEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"SineEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurveEase\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"BezierCurveEase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RuntimeAnimation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"RuntimeAnimation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationEvent\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationKeyInterpolation\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationKeyInterpolation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimationRange\", function() { return _Animations_index__WEBPACK_IMPORTED_MODULE_2__[\"AnimationRange\"]; });\n\n/* harmony import */ var _assetContainer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./assetContainer */ \"./assetContainer.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeepAssets\", function() { return _assetContainer__WEBPACK_IMPORTED_MODULE_3__[\"KeepAssets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetContainer\", function() { return _assetContainer__WEBPACK_IMPORTED_MODULE_3__[\"AssetContainer\"]; });\n\n/* harmony import */ var _Audio_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Audio/index */ \"./Audio/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Analyser\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"Analyser\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioEngine\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"AudioEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AudioSceneComponent\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"AudioSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sound\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"Sound\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SoundTrack\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"SoundTrack\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WeightedSound\", function() { return _Audio_index__WEBPACK_IMPORTED_MODULE_4__[\"WeightedSound\"]; });\n\n/* harmony import */ var _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Behaviors/index */ \"./Behaviors/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AutoRotationBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"AutoRotationBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BouncingBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"BouncingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FramingBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"FramingBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerDragBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"PointerDragBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AttachToBoxBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"AttachToBoxBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FadeInOutBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"FadeInOutBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiPointerScaleBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"MultiPointerScaleBehavior\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SixDofDragBehavior\", function() { return _Behaviors_index__WEBPACK_IMPORTED_MODULE_5__[\"SixDofDragBehavior\"]; });\n\n/* harmony import */ var _Bones_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Bones/index */ \"./Bones/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Bone\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"Bone\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneIKController\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"BoneIKController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneLookController\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"BoneLookController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Skeleton\", function() { return _Bones_index__WEBPACK_IMPORTED_MODULE_6__[\"Skeleton\"]; });\n\n/* harmony import */ var _Cameras_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Cameras/index */ \"./Cameras/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputTypes\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"CameraInputTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"CameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Camera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"Camera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TargetCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"TargetCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TouchCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"TouchCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeviceOrientationCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"DeviceOrientationCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcFollowCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcFollowCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraInputsManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraInputsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"GamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniversalCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"UniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoysticksCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VirtualJoysticksCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraGamepadInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraKeyboardMoveInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraMouseWheelInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraPointersInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ArcRotateCameraVRDeviceOrientationInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"ArcRotateCameraVRDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraKeyboardInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCameraKeyboardInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FlyCameraMouseInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FlyCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraKeyboardMoveInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraMouseWheelInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraMouseWheelInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FollowCameraPointersInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FollowCameraPointersInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraDeviceOrientationInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraDeviceOrientationInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraGamepadInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraGamepadInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraKeyboardMoveInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraKeyboardMoveInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraMouseInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraMouseInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraTouchInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraTouchInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FreeCameraVirtualJoystickInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"FreeCameraVirtualJoystickInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphGamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphUniversalCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"AnaglyphUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicGamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicUniversalCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"StereoscopicUniversalCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRCameraMetrics\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRCameraMetrics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationArcRotateCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRDeviceOrientationArcRotateCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRDeviceOrientationFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDeviceOrientationGamepadCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRDeviceOrientationGamepadCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OnAfterEnteringVRObservableEvent\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"OnAfterEnteringVRObservableEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRExperienceHelper\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"VRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRFreeCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebVRFreeCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRCamera\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRCamera\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIButton\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXREnterExitUIButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUIOptions\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXREnterExitUIOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXREnterExitUI\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXREnterExitUI\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRState\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRExperienceHelper\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRExperienceHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRInput\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerTeleportation\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRControllerTeleportation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerPointerSelection\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRControllerPointerSelection\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRControllerModelLoader\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRControllerModelLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRController\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRManagedOutputCanvas\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRManagedOutputCanvas\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebXRSessionManager\", function() { return _Cameras_index__WEBPACK_IMPORTED_MODULE_7__[\"WebXRSessionManager\"]; });\n\n/* harmony import */ var _Collisions_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Collisions/index */ \"./Collisions/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Collider\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"Collider\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultCollisionCoordinator\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"DefaultCollisionCoordinator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PickingInfo\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"PickingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IntersectionInfo\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"IntersectionInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_MeshCollisionData\", function() { return _Collisions_index__WEBPACK_IMPORTED_MODULE_8__[\"_MeshCollisionData\"]; });\n\n/* harmony import */ var _Culling_index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Culling/index */ \"./Culling/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBox\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"BoundingBox\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingInfo\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"BoundingInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingSphere\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"BoundingSphere\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Ray\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"Ray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Octree\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"Octree\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeBlock\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"OctreeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OctreeSceneComponent\", function() { return _Culling_index__WEBPACK_IMPORTED_MODULE_9__[\"OctreeSceneComponent\"]; });\n\n/* harmony import */ var _Debug_index__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Debug/index */ \"./Debug/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxesViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"AxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoneAxesViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"BoneAxesViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebugLayer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"DebugLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"PhysicsViewer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RayHelper\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"RayHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SkeletonViewer\", function() { return _Debug_index__WEBPACK_IMPORTED_MODULE_10__[\"SkeletonViewer\"]; });\n\n/* harmony import */ var _Engines_index__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Engines/index */ \"./Engines/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"Constants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancingAttributeInfo\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"InstancingAttributeInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthTextureCreationOptions\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"DepthTextureCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineCapabilities\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"EngineCapabilities\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Engine\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"Engine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineStore\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"EngineStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngineOptions\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"NullEngineOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NullEngine\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"NullEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLPipelineContext\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"WebGLPipelineContext\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGL2ShaderProcessor\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"WebGL2ShaderProcessor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NativeEngine\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"NativeEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_OcclusionDataStorage\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"_OcclusionDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceTransformFeedbackToBundle\", function() { return _Engines_index__WEBPACK_IMPORTED_MODULE_11__[\"_forceTransformFeedbackToBundle\"]; });\n\n/* harmony import */ var _Events_index__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Events/index */ \"./Events/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardEventTypes\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"KeyboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfo\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"KeyboardInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KeyboardInfoPre\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"KeyboardInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerEventTypes\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoBase\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerInfoBase\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfoPre\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerInfoPre\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointerInfo\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"PointerInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardEventTypes\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"ClipboardEventTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClipboardInfo\", function() { return _Events_index__WEBPACK_IMPORTED_MODULE_12__[\"ClipboardInfo\"]; });\n\n/* harmony import */ var _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Gamepads/index */ \"./Gamepads/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DaydreamController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DaydreamController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GearVRController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GearVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GenericController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OculusTouchController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"OculusTouchController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerType\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"PoseEnabledControllerType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledControllerHelper\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"PoseEnabledControllerHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PoseEnabledController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"PoseEnabledController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViveController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"ViveController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebVRController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"WebVRController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WindowsMotionController\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"WindowsMotionController\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StickValues\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"StickValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gamepad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Gamepad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GenericPad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GenericPad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadManager\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GamepadManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GamepadSystemSceneComponent\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"GamepadSystemSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Button\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Xbox360Button\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Dpad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Xbox360Dpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Xbox360Pad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"Xbox360Pad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockButton\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DualShockButton\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockDpad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DualShockDpad\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DualShockPad\", function() { return _Gamepads_index__WEBPACK_IMPORTED_MODULE_13__[\"DualShockPad\"]; });\n\n/* harmony import */ var _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Gizmos/index */ \"./Gizmos/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisDragGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"AxisDragGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AxisScaleGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"AxisScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"BoundingBoxGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Gizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"Gizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GizmoManager\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"GizmoManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneRotationGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"PlaneRotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"PositionGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RotationGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"RotationGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"ScaleGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"LightGizmo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneDragGizmo\", function() { return _Gizmos_index__WEBPACK_IMPORTED_MODULE_14__[\"PlaneDragGizmo\"]; });\n\n/* harmony import */ var _Helpers_index__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Helpers/index */ \"./Helpers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentHelper\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"EnvironmentHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhotoDome\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"PhotoDome\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_forceSceneHelpersToBundle\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"_forceSceneHelpersToBundle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoDome\", function() { return _Helpers_index__WEBPACK_IMPORTED_MODULE_15__[\"VideoDome\"]; });\n\n/* harmony import */ var _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Instrumentation/index */ \"./Instrumentation/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EngineInstrumentation\", function() { return _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__[\"EngineInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneInstrumentation\", function() { return _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__[\"SceneInstrumentation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TimeToken\", function() { return _Instrumentation_index__WEBPACK_IMPORTED_MODULE_16__[\"_TimeToken\"]; });\n\n/* harmony import */ var _Layers_index__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Layers/index */ \"./Layers/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"EffectLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectLayerSceneComponent\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"EffectLayerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GlowLayer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"GlowLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightLayer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"HighlightLayer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Layer\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"Layer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LayerSceneComponent\", function() { return _Layers_index__WEBPACK_IMPORTED_MODULE_17__[\"LayerSceneComponent\"]; });\n\n/* harmony import */ var _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./LensFlares/index */ \"./LensFlares/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlare\", function() { return _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__[\"LensFlare\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystem\", function() { return _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__[\"LensFlareSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlareSystemSceneComponent\", function() { return _LensFlares_index__WEBPACK_IMPORTED_MODULE_18__[\"LensFlareSystemSceneComponent\"]; });\n\n/* harmony import */ var _Lights_index__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Lights/index */ \"./Lights/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Light\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"Light\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"ShadowLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DirectionalLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"DirectionalLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"HemisphericLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"PointLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpotLight\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"SpotLight\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGenerator\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"ShadowGenerator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowGeneratorSceneComponent\", function() { return _Lights_index__WEBPACK_IMPORTED_MODULE_19__[\"ShadowGeneratorSceneComponent\"]; });\n\n/* harmony import */ var _Loading_index__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Loading/index */ \"./Loading/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultLoadingScreen\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"DefaultLoadingScreen\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderProgressEvent\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"SceneLoaderProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoader\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"SceneLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneLoaderFlags\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"SceneLoaderFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BabylonLoaderRegistered\", function() { return _Loading_index__WEBPACK_IMPORTED_MODULE_20__[\"_BabylonLoaderRegistered\"]; });\n\n/* harmony import */ var _Materials_index__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Materials/index */ \"./Materials/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCurves\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectFallbacks\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectFallbacks\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectCreationOptions\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectCreationOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Effect\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"Effect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelParameters\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfigurationDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ImageProcessingConfigurationDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingConfiguration\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Material\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"Material\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialHelper\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaterialHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MultiMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PushMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PushMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShaderMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ShaderMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"StandardMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"StandardMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"BaseTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"CubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DynamicTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"DynamicTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EquiRectangularCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"HDRCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InternalTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"InternalTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MirrorTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MirrorTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiRenderTarget\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MultiRenderTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RawTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RenderTargetTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Texture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"Texture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UniformBuffer\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"UniformBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaterialFlags\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaterialFlags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectRenderer\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EffectWrapper\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"EffectWrapper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BackgroundMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"BackgroundMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRBaseMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRBaseSimpleMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRBaseSimpleMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRMetallicRoughnessMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRMetallicRoughnessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PBRSpecularGlossinessMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PBRSpecularGlossinessMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradingTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorGradingTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawCubeTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RawCubeTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RawTexture3D\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RawTexture3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RefractionTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VideoTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HtmlElementTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"HtmlElementTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockTargets\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialBlockTargets\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlockConnectionPointTypes\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialBlockConnectionPointTypes\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialConnectionPoint\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialConnectionPoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialDefines\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialDefines\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterial\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialSystemValues\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialSystemValues\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DDSTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_DDSTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_ENVTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_ENVTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_KTXTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_KTXTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TGATextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_TGATextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_BasisTextureLoader\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"_BasisTextureLoader\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomProceduralTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"CustomProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NoiseProceduralTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NoiseProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTexture\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ProceduralTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ProceduralTextureSceneComponent\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ProceduralTextureSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiplyBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MultiplyBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AddBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"AddBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScaleBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ScaleBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ClampBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ClampBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CrossBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"CrossBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DotBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"DotBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TransformBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RemapBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"RemapBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NormalizeBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NormalizeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlockOperations\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TrigonometryBlockOperations\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrigonometryBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TrigonometryBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorMergerBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorMergerBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VectorMergerBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorSplitterBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ColorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VectorSplitterBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VectorSplitterBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LerpBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"LerpBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DivideBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"DivideBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubtractBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"SubtractBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StepBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"StepBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OppositeBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"OppositeBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ViewDirectionBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ViewDirectionBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FresnelBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FresnelBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MaxBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MaxBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MinBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MinBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"NodeMaterialOptimizer\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"NodeMaterialOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexOutputBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"VertexOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BonesBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"BonesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancesBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"InstancesBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetsBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"MorphTargetsBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightInformationBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"LightInformationBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FragmentOutputBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FragmentOutputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AlphaTestBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"AlphaTestBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ImageProcessingBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerturbNormalBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"PerturbNormalBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FogBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"FogBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LightBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"LightBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"TextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionTextureBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"ReflectionTextureBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InputBlock\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"InputBlock\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnimatedInputBlockTypes\", function() { return _Materials_index__WEBPACK_IMPORTED_MODULE_21__[\"AnimatedInputBlockTypes\"]; });\n\n/* harmony import */ var _Maths_index__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Maths/index */ \"./Maths/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scalar\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Scalar\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Space\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Space\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Axis\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Axis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Color3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color4\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Color4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpColors\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"TmpColors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToGammaSpace\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"ToGammaSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ToLinearSpace\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"ToLinearSpace\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Epsilon\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Epsilon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Frustum\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Frustum\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Plane\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Plane\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Size\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Size\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector2\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Vector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector3\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Vector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Vector4\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Vector4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Quaternion\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Quaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Matrix\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Matrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TmpVectors\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"TmpVectors\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Viewport\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Viewport\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalHarmonics\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"SphericalHarmonics\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphericalPolynomial\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"SphericalPolynomial\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Orientation\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Orientation\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BezierCurve\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"BezierCurve\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Angle\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Angle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Arc2\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Arc2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path2\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Path2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Path3D\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Path3D\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Curve3\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"Curve3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalVertex\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"PositionNormalVertex\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PositionNormalTextureVertex\", function() { return _Maths_index__WEBPACK_IMPORTED_MODULE_22__[\"PositionNormalTextureVertex\"]; });\n\n/* harmony import */ var _Meshes_index__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Meshes/index */ \"./Meshes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"AbstractMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Buffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Buffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexBuffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"VertexBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CSG\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"CSG\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Geometry\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Geometry\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"GroundMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TrailMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TrailMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"InstancedMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"LinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InstancedLinesMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"InstancedLinesMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_CreationDataStorage\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"_CreationDataStorage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_InstancesBatch\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"_InstancesBatch\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Mesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Mesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VertexData\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"VertexData\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"MeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationSettings\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplificationSettings\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationQueue\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplificationQueue\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplificationType\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplificationType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SimplicationQueueSceneComponent\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SimplicationQueueSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Polygon\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"Polygon\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonMeshBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PolygonMeshBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseSubMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"BaseSubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubMesh\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SubMesh\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshLODLevel\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"MeshLODLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TransformNode\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TransformNode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"BoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"SphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"CylinderBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TorusBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LinesBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"LinesBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PlaneBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GroundBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"GroundBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DataBuffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebGLDataBuffer\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"WebGLDataBuffer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DracoCompression\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DracoCompression\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledBoxBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TiledBoxBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DiscBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DiscBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RibbonBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"RibbonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphereBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"HemisphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TorusKnotBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TorusKnotBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolygonBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PolygonBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShapeBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"ShapeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LatheBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"LatheBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TiledPlaneBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TiledPlaneBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TubeBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"TubeBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PolyhedronBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"PolyhedronBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"IcoSphereBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"IcoSphereBuilder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DecalBuilder\", function() { return _Meshes_index__WEBPACK_IMPORTED_MODULE_23__[\"DecalBuilder\"]; });\n\n/* harmony import */ var _Morph_index__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Morph/index */ \"./Morph/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTarget\", function() { return _Morph_index__WEBPACK_IMPORTED_MODULE_24__[\"MorphTarget\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MorphTargetManager\", function() { return _Morph_index__WEBPACK_IMPORTED_MODULE_24__[\"MorphTargetManager\"]; });\n\n/* harmony import */ var _Navigation_index__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Navigation/index */ \"./Navigation/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSPlugin\", function() { return _Navigation_index__WEBPACK_IMPORTED_MODULE_25__[\"RecastJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RecastJSCrowd\", function() { return _Navigation_index__WEBPACK_IMPORTED_MODULE_25__[\"RecastJSCrowd\"]; });\n\n/* harmony import */ var _node__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./node */ \"./node.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Node\", function() { return _node__WEBPACK_IMPORTED_MODULE_26__[\"Node\"]; });\n\n/* harmony import */ var _Offline_index__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Offline/index */ \"./Offline/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Database\", function() { return _Offline_index__WEBPACK_IMPORTED_MODULE_27__[\"Database\"]; });\n\n/* harmony import */ var _Particles_index__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Particles/index */ \"./Particles/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BaseParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"BaseParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GPUParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"GPUParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Particle\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"Particle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleHelper\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ParticleHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_IDoNeedToBeInTheBuild\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"_IDoNeedToBeInTheBuild\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticleSystemSet\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ParticleSystemSet\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticle\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SolidParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ModelShape\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ModelShape\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthSortedParticle\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"DepthSortedParticle\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SolidParticleSystem\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SolidParticleSystem\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitterType\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SubEmitterType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SubEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SubEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoxParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"BoxParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConeParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"ConeParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"CylinderParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CylinderDirectedParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"CylinderDirectedParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HemisphericParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"HemisphericParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PointParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"PointParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SphereParticleEmitter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SphereDirectedParticleEmitter\", function() { return _Particles_index__WEBPACK_IMPORTED_MODULE_28__[\"SphereDirectedParticleEmitter\"]; });\n\n/* harmony import */ var _Physics_index__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Physics/index */ \"./Physics/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngine\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsEngine\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsEngineSceneComponent\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsEngineSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsHelper\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialExplosionEventOptions\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsRadialExplosionEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftEventOptions\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsUpdraftEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsVortexEventOptions\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsVortexEventOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsRadialImpulseFalloff\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsRadialImpulseFalloff\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsUpdraftMode\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsUpdraftMode\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsImpostor\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsImpostor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PhysicsJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"PhysicsJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DistanceJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"DistanceJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotorEnabledJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"MotorEnabledJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HingeJoint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"HingeJoint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Hinge2Joint\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"Hinge2Joint\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CannonJSPlugin\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"CannonJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AmmoJSPlugin\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"AmmoJSPlugin\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OimoJSPlugin\", function() { return _Physics_index__WEBPACK_IMPORTED_MODULE_29__[\"OimoJSPlugin\"]; });\n\n/* harmony import */ var _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./PostProcesses/index */ \"./PostProcesses/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AnaglyphPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"AnaglyphPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlackAndWhitePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BlackAndWhitePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomEffect\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BloomEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BloomMergePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BloomMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BlurPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"BlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ChromaticAberrationPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ChromaticAberrationPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CircleOfConfusionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"CircleOfConfusionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorCorrectionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ColorCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ConvolutionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ConvolutionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldBlurPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffectBlurLevel\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldEffectBlurLevel\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldEffect\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcessOptions\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldMergePostProcessOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthOfFieldMergePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DepthOfFieldMergePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DisplayPassPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DisplayPassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ExtractHighlightsPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ExtractHighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilterPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"FilterPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FxaaPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"FxaaPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GrainPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"GrainPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HighlightsPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"HighlightsPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageProcessingPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"ImageProcessingPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MotionBlurPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"MotionBlurPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PassPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PassCubePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PassCubePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessManager\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RefractionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"RefractionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SharpenPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"SharpenPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StereoscopicInterlacePostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"StereoscopicInterlacePostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemappingOperator\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"TonemappingOperator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TonemapPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"TonemapPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VolumetricLightScatteringPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"VolumetricLightScatteringPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRDistortionCorrectionPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"VRDistortionCorrectionPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VRMultiviewToSingleviewPostProcess\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"VRMultiviewToSingleviewPostProcess\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderEffect\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderEffect\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManager\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderPipelineManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessRenderPipelineManagerSceneComponent\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"PostProcessRenderPipelineManagerSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DefaultRenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"DefaultRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensRenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"LensRenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAO2RenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"SSAO2RenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SSAORenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"SSAORenderingPipeline\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StandardRenderingPipeline\", function() { return _PostProcesses_index__WEBPACK_IMPORTED_MODULE_30__[\"StandardRenderingPipeline\"]; });\n\n/* harmony import */ var _Probes_index__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Probes/index */ \"./Probes/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ReflectionProbe\", function() { return _Probes_index__WEBPACK_IMPORTED_MODULE_31__[\"ReflectionProbe\"]; });\n\n/* harmony import */ var _Rendering_index__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./Rendering/index */ \"./Rendering/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BoundingBoxRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"BoundingBoxRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"DepthRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DepthRendererSceneComponent\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"DepthRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EdgesRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"EdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LineEdgesRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"LineEdgesRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"GeometryBufferRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GeometryBufferRendererSceneComponent\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"GeometryBufferRendererSceneComponent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"OutlineRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"OutlineRenderer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroup\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"RenderingGroup\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingGroupInfo\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"RenderingGroupInfo\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderingManager\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"RenderingManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"UtilityLayerRenderer\", function() { return _Rendering_index__WEBPACK_IMPORTED_MODULE_32__[\"UtilityLayerRenderer\"]; });\n\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./scene */ \"./scene.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Scene\", function() { return _scene__WEBPACK_IMPORTED_MODULE_33__[\"Scene\"]; });\n\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./sceneComponent */ \"./sceneComponent.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneComponentConstants\", function() { return _sceneComponent__WEBPACK_IMPORTED_MODULE_34__[\"SceneComponentConstants\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Stage\", function() { return _sceneComponent__WEBPACK_IMPORTED_MODULE_34__[\"Stage\"]; });\n\n/* harmony import */ var _Sprites_index__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./Sprites/index */ \"./Sprites/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Sprite\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"Sprite\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteManager\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"SpriteManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpritePackedManager\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"SpritePackedManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SpriteSceneComponent\", function() { return _Sprites_index__WEBPACK_IMPORTED_MODULE_35__[\"SpriteSceneComponent\"]; });\n\n/* harmony import */ var _States_index__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./States/index */ \"./States/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_AlphaState\", function() { return _States_index__WEBPACK_IMPORTED_MODULE_36__[\"_AlphaState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_DepthCullingState\", function() { return _States_index__WEBPACK_IMPORTED_MODULE_36__[\"_DepthCullingState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_StencilState\", function() { return _States_index__WEBPACK_IMPORTED_MODULE_36__[\"_StencilState\"]; });\n\n/* harmony import */ var _Misc_index__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./Misc/index */ \"./Misc/index.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AndOrNotEvaluator\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AndOrNotEvaluator\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetTaskState\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AssetTaskState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AbstractAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AbstractAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsProgressEvent\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AssetsProgressEvent\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MeshAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextFileAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BinaryFileAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"BinaryFileAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ImageAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ImageAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeTextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"CubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRCubeTextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"HDRCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EquiRectangularCubeTextureAssetTask\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"EquiRectangularCubeTextureAssetTask\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AssetsManager\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AssetsManager\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DDSTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"DDSTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"expandToProperty\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"expandToProperty\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serialize\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serialize\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsTexture\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsTexture\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor3\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsColor3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsFresnelParameters\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsFresnelParameters\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector2\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsVector2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsVector3\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsVector3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMeshReference\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsMeshReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColorCurves\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsColorCurves\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsColor4\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsColor4\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsImageProcessingConfiguration\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsImageProcessingConfiguration\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsQuaternion\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsQuaternion\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsMatrix\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsMatrix\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"serializeAsCameraReference\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"serializeAsCameraReference\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SerializationHelper\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SerializationHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Deferred\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Deferred\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EnvironmentTextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"EnvironmentTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MeshExploder\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MeshExploder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInput\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"FilesInput\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CubeMapToSphericalPolynomialTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"CubeMapToSphericalPolynomialTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"KhronosTextureContainer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"KhronosTextureContainer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"EventState\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"EventState\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Observer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MultiObserver\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MultiObserver\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Observable\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Observable\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerformanceMonitor\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PerformanceMonitor\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RollingAverage\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RollingAverage\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PromisePolyfill\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PromisePolyfill\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextureOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HardwareScalingOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"HardwareScalingOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ShadowsOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ShadowsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PostProcessesOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PostProcessesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LensFlaresOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"LensFlaresOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CustomOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"CustomOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ParticlesOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ParticlesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RenderTargetsOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RenderTargetsOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"MergeMeshesOptimization\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"MergeMeshesOptimization\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizerOptions\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneOptimizerOptions\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneOptimizer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneOptimizer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SceneSerializer\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SceneSerializer\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArray\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SmartArray\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"SmartArrayNoDuplicate\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"SmartArrayNoDuplicate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"StringDictionary\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"StringDictionary\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tags\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Tags\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"TGATools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"TGATools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Tools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Tools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"className\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"className\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"AsyncLoop\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"AsyncLoop\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VideoRecorder\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"VideoRecorder\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"JoystickAxis\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"JoystickAxis\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"VirtualJoystick\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"VirtualJoystick\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WorkerPool\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"WorkerPool\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Logger\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Logger\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"_TypeStore\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"_TypeStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FilesInputStore\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"FilesInputStore\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DeepCopier\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"DeepCopier\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PivotTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PivotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PrecisionDate\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PrecisionDate\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ScreenshotTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ScreenshotTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"WebRequest\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"WebRequest\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InspectableType\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"InspectableType\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BRDFTextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"BRDFTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RGBDTextureTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RGBDTextureTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorGradient\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"ColorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Color3Gradient\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"Color3Gradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"FactorGradient\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"FactorGradient\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"GradientHelper\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"GradientHelper\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PerfCounter\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PerfCounter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RetryStrategy\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"RetryStrategy\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LoadFileError\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"LoadFileError\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"HDRTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"HDRTools\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"PanoramaToCubeMapTools\", function() { return _Misc_index__WEBPACK_IMPORTED_MODULE_37__[\"PanoramaToCubeMapTools\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ \"./node.ts\":\n/*!*****************!*\\\n !*** ./node.ts ***!\n \\*****************/\n/*! exports provided: Node */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Node\", function() { return Node; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Misc_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Misc/decorators */ \"./Misc/decorators.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Misc/devTools */ \"./Misc/devTools.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Node is the basic class for all scene objects (Mesh, Light, Camera.)\r\n */\r\nvar Node = /** @class */ (function () {\r\n /**\r\n * Creates a new Node\r\n * @param name the name and id to be given to this node\r\n * @param scene the scene this node will be added to\r\n * @param addToRootNodes the node will be added to scene.rootNodes\r\n */\r\n function Node(name, scene, addToRootNodes) {\r\n if (scene === void 0) { scene = null; }\r\n if (addToRootNodes === void 0) { addToRootNodes = true; }\r\n /**\r\n * Gets or sets a string used to store user defined state for the node\r\n */\r\n this.state = \"\";\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n /**\r\n * Gets or sets a boolean used to define if the node must be serialized\r\n */\r\n this.doNotSerialize = false;\r\n /** @hidden */\r\n this._isDisposed = false;\r\n /**\r\n * Gets a list of Animations associated with the node\r\n */\r\n this.animations = new Array();\r\n this._ranges = {};\r\n /**\r\n * Callback raised when the node is ready to be used\r\n */\r\n this.onReady = null;\r\n this._isEnabled = true;\r\n this._isParentEnabled = true;\r\n this._isReady = true;\r\n /** @hidden */\r\n this._currentRenderId = -1;\r\n this._parentUpdateId = -1;\r\n /** @hidden */\r\n this._childUpdateId = -1;\r\n /** @hidden */\r\n this._waitingParentId = null;\r\n /** @hidden */\r\n this._cache = {};\r\n this._parentNode = null;\r\n this._children = null;\r\n /** @hidden */\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n /** @hidden */\r\n this._worldMatrixDeterminant = 0;\r\n /** @hidden */\r\n this._worldMatrixDeterminantIsDirty = true;\r\n /** @hidden */\r\n this._sceneRootNodesIndex = -1;\r\n this._animationPropertiesOverride = null;\r\n /** @hidden */\r\n this._isNode = true;\r\n /**\r\n * An event triggered when the mesh is disposed\r\n */\r\n this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n this._onDisposeObserver = null;\r\n // Behaviors\r\n this._behaviors = new Array();\r\n this.name = name;\r\n this.id = name;\r\n this._scene = (scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__[\"EngineStore\"].LastCreatedScene);\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._initCache();\r\n if (addToRootNodes) {\r\n this.addToSceneRootNodes();\r\n }\r\n }\r\n /**\r\n * Add a new node constructor\r\n * @param type defines the type name of the node to construct\r\n * @param constructorFunc defines the constructor function\r\n */\r\n Node.AddNodeConstructor = function (type, constructorFunc) {\r\n this._NodeConstructors[type] = constructorFunc;\r\n };\r\n /**\r\n * Returns a node constructor based on type name\r\n * @param type defines the type name\r\n * @param name defines the new node name\r\n * @param scene defines the hosting scene\r\n * @param options defines optional options to transmit to constructors\r\n * @returns the new constructor or null\r\n */\r\n Node.Construct = function (type, name, scene, options) {\r\n var constructorFunc = this._NodeConstructors[type];\r\n if (!constructorFunc) {\r\n return null;\r\n }\r\n return constructorFunc(name, scene, options);\r\n };\r\n /**\r\n * Gets a boolean indicating if the node has been disposed\r\n * @returns true if the node was disposed\r\n */\r\n Node.prototype.isDisposed = function () {\r\n return this._isDisposed;\r\n };\r\n Object.defineProperty(Node.prototype, \"parent\", {\r\n get: function () {\r\n return this._parentNode;\r\n },\r\n /**\r\n * Gets or sets the parent of the node (without keeping the current position in the scene)\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n */\r\n set: function (parent) {\r\n if (this._parentNode === parent) {\r\n return;\r\n }\r\n var previousParentNode = this._parentNode;\r\n // Remove self from list of children of parent\r\n if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {\r\n var index = this._parentNode._children.indexOf(this);\r\n if (index !== -1) {\r\n this._parentNode._children.splice(index, 1);\r\n }\r\n if (!parent && !this._isDisposed) {\r\n this.addToSceneRootNodes();\r\n }\r\n }\r\n // Store new parent\r\n this._parentNode = parent;\r\n // Add as child to new parent\r\n if (this._parentNode) {\r\n if (this._parentNode._children === undefined || this._parentNode._children === null) {\r\n this._parentNode._children = new Array();\r\n }\r\n this._parentNode._children.push(this);\r\n if (!previousParentNode) {\r\n this.removeFromSceneRootNodes();\r\n }\r\n }\r\n // Enabled state\r\n this._syncParentEnabledState();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Node.prototype.addToSceneRootNodes = function () {\r\n if (this._sceneRootNodesIndex === -1) {\r\n this._sceneRootNodesIndex = this._scene.rootNodes.length;\r\n this._scene.rootNodes.push(this);\r\n }\r\n };\r\n Node.prototype.removeFromSceneRootNodes = function () {\r\n if (this._sceneRootNodesIndex !== -1) {\r\n var rootNodes = this._scene.rootNodes;\r\n var lastIdx = rootNodes.length - 1;\r\n rootNodes[this._sceneRootNodesIndex] = rootNodes[lastIdx];\r\n rootNodes[this._sceneRootNodesIndex]._sceneRootNodesIndex = this._sceneRootNodesIndex;\r\n this._scene.rootNodes.pop();\r\n this._sceneRootNodesIndex = -1;\r\n }\r\n };\r\n Object.defineProperty(Node.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"Node\" string\r\n */\r\n Node.prototype.getClassName = function () {\r\n return \"Node\";\r\n };\r\n Object.defineProperty(Node.prototype, \"onDispose\", {\r\n /**\r\n * Sets a callback that will be raised when the node will be disposed\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the scene of the node\r\n * @returns a scene\r\n */\r\n Node.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Gets the engine of the node\r\n * @returns a Engine\r\n */\r\n Node.prototype.getEngine = function () {\r\n return this._scene.getEngine();\r\n };\r\n /**\r\n * Attach a behavior to the node\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @param attachImmediately defines that the behavior must be attached even if the scene is still loading\r\n * @returns the current Node\r\n */\r\n Node.prototype.addBehavior = function (behavior, attachImmediately) {\r\n var _this = this;\r\n if (attachImmediately === void 0) { attachImmediately = false; }\r\n var index = this._behaviors.indexOf(behavior);\r\n if (index !== -1) {\r\n return this;\r\n }\r\n behavior.init();\r\n if (this._scene.isLoading && !attachImmediately) {\r\n // We defer the attach when the scene will be loaded\r\n this._scene.onDataLoadedObservable.addOnce(function () {\r\n behavior.attach(_this);\r\n });\r\n }\r\n else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n return this;\r\n };\r\n /**\r\n * Remove an attached behavior\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @returns the current Node\r\n */\r\n Node.prototype.removeBehavior = function (behavior) {\r\n var index = this._behaviors.indexOf(behavior);\r\n if (index === -1) {\r\n return this;\r\n }\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n return this;\r\n };\r\n Object.defineProperty(Node.prototype, \"behaviors\", {\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n */\r\n get: function () {\r\n return this._behaviors;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see http://doc.babylonjs.com/features/behaviour\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n Node.prototype.getBehaviorByName = function (name) {\r\n for (var _i = 0, _a = this._behaviors; _i < _a.length; _i++) {\r\n var behavior = _a[_i];\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Returns the latest update of the World matrix\r\n * @returns a Matrix\r\n */\r\n Node.prototype.getWorldMatrix = function () {\r\n if (this._currentRenderId !== this._scene.getRenderId()) {\r\n this.computeWorldMatrix();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n Node.prototype._getWorldMatrixDeterminant = function () {\r\n if (this._worldMatrixDeterminantIsDirty) {\r\n this._worldMatrixDeterminantIsDirty = false;\r\n this._worldMatrixDeterminant = this._worldMatrix.determinant();\r\n }\r\n return this._worldMatrixDeterminant;\r\n };\r\n Object.defineProperty(Node.prototype, \"worldMatrixFromCache\", {\r\n /**\r\n * Returns directly the latest state of the mesh World matrix.\r\n * A Matrix is returned.\r\n */\r\n get: function () {\r\n return this._worldMatrix;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method\r\n /** @hidden */\r\n Node.prototype._initCache = function () {\r\n this._cache = {};\r\n this._cache.parent = undefined;\r\n };\r\n /** @hidden */\r\n Node.prototype.updateCache = function (force) {\r\n if (!force && this.isSynchronized()) {\r\n return;\r\n }\r\n this._cache.parent = this.parent;\r\n this._updateCache();\r\n };\r\n /** @hidden */\r\n Node.prototype._getActionManagerForTrigger = function (trigger, initialCall) {\r\n if (initialCall === void 0) { initialCall = true; }\r\n if (!this.parent) {\r\n return null;\r\n }\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n };\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method if !ignoreParentClass\r\n /** @hidden */\r\n Node.prototype._updateCache = function (ignoreParentClass) {\r\n };\r\n // override it in derived class if you add new variables to the cache\r\n /** @hidden */\r\n Node.prototype._isSynchronized = function () {\r\n return true;\r\n };\r\n /** @hidden */\r\n Node.prototype._markSyncedWithParent = function () {\r\n if (this._parentNode) {\r\n this._parentUpdateId = this._parentNode._childUpdateId;\r\n }\r\n };\r\n /** @hidden */\r\n Node.prototype.isSynchronizedWithParent = function () {\r\n if (!this._parentNode) {\r\n return true;\r\n }\r\n if (this._parentUpdateId !== this._parentNode._childUpdateId) {\r\n return false;\r\n }\r\n return this._parentNode.isSynchronized();\r\n };\r\n /** @hidden */\r\n Node.prototype.isSynchronized = function () {\r\n if (this._cache.parent != this._parentNode) {\r\n this._cache.parent = this._parentNode;\r\n return false;\r\n }\r\n if (this._parentNode && !this.isSynchronizedWithParent()) {\r\n return false;\r\n }\r\n return this._isSynchronized();\r\n };\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return true if the node is ready\r\n */\r\n Node.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n return this._isReady;\r\n };\r\n /**\r\n * Is this node enabled?\r\n * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true\r\n * @param checkAncestors indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors\r\n * @return whether this node (and its parent) is enabled\r\n */\r\n Node.prototype.isEnabled = function (checkAncestors) {\r\n if (checkAncestors === void 0) { checkAncestors = true; }\r\n if (checkAncestors === false) {\r\n return this._isEnabled;\r\n }\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n return this._isParentEnabled;\r\n };\r\n /** @hidden */\r\n Node.prototype._syncParentEnabledState = function () {\r\n this._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;\r\n if (this._children) {\r\n this._children.forEach(function (c) {\r\n c._syncParentEnabledState(); // Force children to update accordingly\r\n });\r\n }\r\n };\r\n /**\r\n * Set the enabled state of this node\r\n * @param value defines the new enabled state\r\n */\r\n Node.prototype.setEnabled = function (value) {\r\n this._isEnabled = value;\r\n this._syncParentEnabledState();\r\n };\r\n /**\r\n * Is this node a descendant of the given node?\r\n * The function will iterate up the hierarchy until the ancestor was found or no more parents defined\r\n * @param ancestor defines the parent node to inspect\r\n * @returns a boolean indicating if this node is a descendant of the given node\r\n */\r\n Node.prototype.isDescendantOf = function (ancestor) {\r\n if (this.parent) {\r\n if (this.parent === ancestor) {\r\n return true;\r\n }\r\n return this.parent.isDescendantOf(ancestor);\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n Node.prototype._getDescendants = function (results, directDescendantsOnly, predicate) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }\r\n if (!this._children) {\r\n return;\r\n }\r\n for (var index = 0; index < this._children.length; index++) {\r\n var item = this._children[index];\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n if (!directDescendantsOnly) {\r\n item._getDescendants(results, false, predicate);\r\n }\r\n }\r\n };\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n Node.prototype.getDescendants = function (directDescendantsOnly, predicate) {\r\n var results = new Array();\r\n this._getDescendants(results, directDescendantsOnly, predicate);\r\n return results;\r\n };\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n Node.prototype.getChildMeshes = function (directDescendantsOnly, predicate) {\r\n var results = [];\r\n this._getDescendants(results, directDescendantsOnly, function (node) {\r\n return ((!predicate || predicate(node)) && (node.cullingStrategy !== undefined));\r\n });\r\n return results;\r\n };\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n Node.prototype.getChildren = function (predicate, directDescendantsOnly) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = true; }\r\n return this.getDescendants(directDescendantsOnly, predicate);\r\n };\r\n /** @hidden */\r\n Node.prototype._setReady = function (state) {\r\n if (state === this._isReady) {\r\n return;\r\n }\r\n if (!state) {\r\n this._isReady = false;\r\n return;\r\n }\r\n if (this.onReady) {\r\n this.onReady(this);\r\n }\r\n this._isReady = true;\r\n };\r\n /**\r\n * Get an animation by name\r\n * @param name defines the name of the animation to look for\r\n * @returns null if not found else the requested animation\r\n */\r\n Node.prototype.getAnimationByName = function (name) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n var animation = this.animations[i];\r\n if (animation.name === name) {\r\n return animation;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Creates an animation range for this node\r\n * @param name defines the name of the range\r\n * @param from defines the starting key\r\n * @param to defines the end key\r\n */\r\n Node.prototype.createAnimationRange = function (name, from, to) {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = Node._AnimationRangeFactory(name, from, to);\r\n for (var i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range to delete\r\n * @param deleteFrames defines if animation frames from the range must be deleted as well\r\n */\r\n Node.prototype.deleteAnimationRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n for (var i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Get an animation range by name\r\n * @param name defines the name of the animation range to look for\r\n * @returns null if not found else the requested animation range\r\n */\r\n Node.prototype.getAnimationRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the list of all animation ranges defined on this node\r\n * @returns an array\r\n */\r\n Node.prototype.getAnimationRanges = function () {\r\n var animationRanges = [];\r\n var name;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n };\r\n /**\r\n * Will start the animation sequence\r\n * @param name defines the range frames for animation sequence\r\n * @param loop defines if the animation should loop (false by default)\r\n * @param speedRatio defines the speed factor in which to run the animation (1 by default)\r\n * @param onAnimationEnd defines a function to be executed when the animation ended (undefined by default)\r\n * @returns the object created for this animation. If range does not exist, it will return null\r\n */\r\n Node.prototype.beginAnimation = function (name, loop, speedRatio, onAnimationEnd) {\r\n var range = this.getAnimationRange(name);\r\n if (!range) {\r\n return null;\r\n }\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n };\r\n /**\r\n * Serialize animation ranges into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n Node.prototype.serializeAnimationRanges = function () {\r\n var serializationRanges = [];\r\n for (var name in this._ranges) {\r\n var localRange = this._ranges[name];\r\n if (!localRange) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = localRange.from;\r\n range.to = localRange.to;\r\n serializationRanges.push(range);\r\n }\r\n return serializationRanges;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n Node.prototype.computeWorldMatrix = function (force) {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Matrix\"].Identity();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Node.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this._isDisposed = true;\r\n if (!doNotRecurse) {\r\n var nodes = this.getDescendants(true);\r\n for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\r\n var node = nodes_1[_i];\r\n node.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n }\r\n if (!this.parent) {\r\n this.removeFromSceneRootNodes();\r\n }\r\n else {\r\n this.parent = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n // Behaviors\r\n for (var _a = 0, _b = this._behaviors; _a < _b.length; _a++) {\r\n var behavior = _b[_a];\r\n behavior.detach();\r\n }\r\n this._behaviors = [];\r\n };\r\n /**\r\n * Parse animation range data from a serialization object and store them into a given node\r\n * @param node defines where to store the animation ranges\r\n * @param parsedNode defines the serialization object to read data from\r\n * @param scene defines the hosting scene\r\n */\r\n Node.ParseAnimationRanges = function (node, parsedNode, scene) {\r\n if (parsedNode.ranges) {\r\n for (var index = 0; index < parsedNode.ranges.length; index++) {\r\n var data = parsedNode.ranges[index];\r\n node.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n };\r\n /**\r\n * Return the minimum and maximum world vectors of the entire hierarchy under current node\r\n * @param includeDescendants Include bounding info from descendants as well (true by default)\r\n * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors\r\n * @returns the new bounding vectors\r\n */\r\n Node.prototype.getHierarchyBoundingVectors = function (includeDescendants, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (predicate === void 0) { predicate = null; }\r\n // Ensures that all world matrix will be recomputed.\r\n this.getScene().incrementRenderId();\r\n this.computeWorldMatrix(true);\r\n var min;\r\n var max;\r\n var thisAbstractMesh = this;\r\n if (thisAbstractMesh.getBoundingInfo && thisAbstractMesh.subMeshes) {\r\n // If this is an abstract mesh get its bounding info\r\n var boundingInfo = thisAbstractMesh.getBoundingInfo();\r\n min = boundingInfo.boundingBox.minimumWorld.clone();\r\n max = boundingInfo.boundingBox.maximumWorld.clone();\r\n }\r\n else {\r\n min = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n max = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n }\r\n if (includeDescendants) {\r\n var descendants = this.getDescendants(false);\r\n for (var _i = 0, descendants_1 = descendants; _i < descendants_1.length; _i++) {\r\n var descendant = descendants_1[_i];\r\n var childMesh = descendant;\r\n childMesh.computeWorldMatrix(true);\r\n // Filters meshes based on custom predicate function.\r\n if (predicate && !predicate(childMesh)) {\r\n continue;\r\n }\r\n //make sure we have the needed params to get mix and max\r\n if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {\r\n continue;\r\n }\r\n var childBoundingInfo = childMesh.getBoundingInfo();\r\n var boundingBox = childBoundingInfo.boundingBox;\r\n var minBox = boundingBox.minimumWorld;\r\n var maxBox = boundingBox.maximumWorld;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CheckExtends(minBox, min, max);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__[\"Vector3\"].CheckExtends(maxBox, min, max);\r\n }\r\n }\r\n return {\r\n min: min,\r\n max: max\r\n };\r\n };\r\n /** @hidden */\r\n Node._AnimationRangeFactory = function (name, from, to) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_5__[\"_DevTools\"].WarnImport(\"AnimationRange\");\r\n };\r\n Node._NodeConstructors = {};\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"name\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"id\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"uniqueId\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"state\", void 0);\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__decorate\"]([\r\n Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_2__[\"serialize\"])()\r\n ], Node.prototype, \"metadata\", void 0);\r\n return Node;\r\n}());\r\n\r\n\n\n/***/ }),\n\n/***/ \"./scene.ts\":\n/*!******************!*\\\n !*** ./scene.ts ***!\n \\******************/\n/*! exports provided: Scene */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Scene\", function() { return Scene; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n/* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Misc/tools */ \"./Misc/tools.ts\");\n/* harmony import */ var _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Misc/precisionDate */ \"./Misc/precisionDate.ts\");\n/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Misc/observable */ \"./Misc/observable.ts\");\n/* harmony import */ var _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Misc/smartArray */ \"./Misc/smartArray.ts\");\n/* harmony import */ var _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Misc/stringDictionary */ \"./Misc/stringDictionary.ts\");\n/* harmony import */ var _Misc_tags__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Misc/tags */ \"./Misc/tags.ts\");\n/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Maths/math.vector */ \"./Maths/math.vector.ts\");\n/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Meshes/transformNode */ \"./Meshes/transformNode.ts\");\n/* harmony import */ var _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Meshes/abstractMesh */ \"./Meshes/abstractMesh.ts\");\n/* harmony import */ var _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Cameras/camera */ \"./Cameras/camera.ts\");\n/* harmony import */ var _abstractScene__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./abstractScene */ \"./abstractScene.ts\");\n/* harmony import */ var _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Materials/imageProcessingConfiguration */ \"./Materials/imageProcessingConfiguration.ts\");\n/* harmony import */ var _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Materials/uniformBuffer */ \"./Materials/uniformBuffer.ts\");\n/* harmony import */ var _Lights_light__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Lights/light */ \"./Lights/light.ts\");\n/* harmony import */ var _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Collisions/pickingInfo */ \"./Collisions/pickingInfo.ts\");\n/* harmony import */ var _Actions_actionEvent__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Actions/actionEvent */ \"./Actions/actionEvent.ts\");\n/* harmony import */ var _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./PostProcesses/postProcessManager */ \"./PostProcesses/postProcessManager.ts\");\n/* harmony import */ var _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Rendering/renderingManager */ \"./Rendering/renderingManager.ts\");\n/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./sceneComponent */ \"./sceneComponent.ts\");\n/* harmony import */ var _Engines_constants__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Engines/constants */ \"./Engines/constants.ts\");\n/* harmony import */ var _Misc_domManagement__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Misc/domManagement */ \"./Misc/domManagement.ts\");\n/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Misc/logger */ \"./Misc/logger.ts\");\n/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Engines/engineStore */ \"./Engines/engineStore.ts\");\n/* harmony import */ var _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Misc/devTools */ \"./Misc/devTools.ts\");\n/* harmony import */ var _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Inputs/scene.inputManager */ \"./Inputs/scene.inputManager.ts\");\n/* harmony import */ var _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./Misc/perfCounter */ \"./Misc/perfCounter.ts\");\n/* harmony import */ var _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Maths/math.color */ \"./Maths/math.color.ts\");\n/* harmony import */ var _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Maths/math.frustum */ \"./Maths/math.frustum.ts\");\n/* harmony import */ var _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Misc/uniqueIdGenerator */ \"./Misc/uniqueIdGenerator.ts\");\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/**\r\n * Represents a scene to be rendered by the engine.\r\n * @see http://doc.babylonjs.com/features/scene\r\n */\r\nvar Scene = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Scene, _super);\r\n /**\r\n * Creates a new Scene\r\n * @param engine defines the engine to use to render this scene\r\n * @param options defines the scene options\r\n */\r\n function Scene(engine, options) {\r\n var _this = _super.call(this) || this;\r\n // Members\r\n /** @hidden */\r\n _this._inputManager = new _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"](_this);\r\n /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */\r\n _this.cameraToUseForPointers = null;\r\n /** @hidden */\r\n _this._isScene = true;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame\r\n */\r\n _this.autoClear = true;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame\r\n */\r\n _this.autoClearDepthAndStencil = true;\r\n /**\r\n * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))\r\n */\r\n _this.clearColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__[\"Color4\"](0.2, 0.2, 0.3, 1.0);\r\n /**\r\n * Defines the color used to simulate the ambient color (Default is (0, 0, 0))\r\n */\r\n _this.ambientColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__[\"Color3\"](0, 0, 0);\r\n /** @hidden */\r\n _this._environmentIntensity = 1;\r\n _this._forceWireframe = false;\r\n _this._forcePointsCloud = false;\r\n /**\r\n * Gets or sets a boolean indicating if animations are enabled\r\n */\r\n _this.animationsEnabled = true;\r\n _this._animationPropertiesOverride = null;\r\n /**\r\n * Gets or sets a boolean indicating if a constant deltatime has to be used\r\n * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate\r\n */\r\n _this.useConstantAnimationDeltaTime = false;\r\n /**\r\n * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated\r\n * Please note that it requires to run a ray cast through the scene on every frame\r\n */\r\n _this.constantlyUpdateMeshUnderPointer = false;\r\n /**\r\n * Defines the HTML cursor to use when hovering over interactive elements\r\n */\r\n _this.hoverCursor = \"pointer\";\r\n /**\r\n * Defines the HTML default cursor to use (empty by default)\r\n */\r\n _this.defaultCursor = \"\";\r\n /**\r\n * This is used to call preventDefault() on pointer down\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerDown = true;\r\n /**\r\n * This is used to call preventDefault() on pointer up\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerUp = true;\r\n // Metadata\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n _this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n _this.reservedDataStore = null;\r\n /**\r\n * Use this array to add regular expressions used to disable offline support for specific urls\r\n */\r\n _this.disableOfflineSupportExceptionRules = new Array();\r\n /**\r\n * An event triggered when the scene is disposed.\r\n */\r\n _this.onDisposeObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onDisposeObserver = null;\r\n /**\r\n * An event triggered before rendering the scene (right after animations and physics)\r\n */\r\n _this.onBeforeRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onBeforeRenderObserver = null;\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n _this.onAfterRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera)\r\n */\r\n _this.onAfterRenderCameraObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onAfterRenderObserver = null;\r\n /**\r\n * An event triggered before animating the scene\r\n */\r\n _this.onBeforeAnimationsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after animations processing\r\n */\r\n _this.onAfterAnimationsObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered before draw calls are ready to be sent\r\n */\r\n _this.onBeforeDrawPhaseObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after draw calls have been sent\r\n */\r\n _this.onAfterDrawPhaseObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the scene is ready\r\n */\r\n _this.onReadyObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered before rendering a camera\r\n */\r\n _this.onBeforeCameraRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onBeforeCameraRenderObserver = null;\r\n /**\r\n * An event triggered after rendering a camera\r\n */\r\n _this.onAfterCameraRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n _this._onAfterCameraRenderObserver = null;\r\n /**\r\n * An event triggered when active meshes evaluation is about to start\r\n */\r\n _this.onBeforeActiveMeshesEvaluationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when active meshes evaluation is done\r\n */\r\n _this.onAfterActiveMeshesEvaluationObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when particles rendering is about to start\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onBeforeParticlesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when particles rendering is done\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onAfterParticlesRenderingObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed\r\n */\r\n _this.onDataLoadedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a camera is created\r\n */\r\n _this.onNewCameraAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a camera is removed\r\n */\r\n _this.onCameraRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a light is created\r\n */\r\n _this.onNewLightAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a light is removed\r\n */\r\n _this.onLightRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a geometry is created\r\n */\r\n _this.onNewGeometryAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a geometry is removed\r\n */\r\n _this.onGeometryRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a transform node is created\r\n */\r\n _this.onNewTransformNodeAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a transform node is removed\r\n */\r\n _this.onTransformNodeRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a mesh is created\r\n */\r\n _this.onNewMeshAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a mesh is removed\r\n */\r\n _this.onMeshRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a skeleton is created\r\n */\r\n _this.onNewSkeletonAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a skeleton is removed\r\n */\r\n _this.onSkeletonRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a material is created\r\n */\r\n _this.onNewMaterialAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a material is removed\r\n */\r\n _this.onMaterialRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a texture is created\r\n */\r\n _this.onNewTextureAddedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when a texture is removed\r\n */\r\n _this.onTextureRemovedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when render targets are about to be rendered\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onBeforeRenderTargetsRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when render targets were rendered.\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onAfterRenderTargetsRenderObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered before calculating deterministic simulation step\r\n */\r\n _this.onBeforeStepObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered after calculating deterministic simulation step\r\n */\r\n _this.onAfterStepObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * An event triggered when the activeCamera property is updated\r\n */\r\n _this.onActiveCameraChanged = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * This Observable will be triggered before rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onBeforeRenderingGroupObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * This Observable will be triggered after rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onAfterRenderingGroupObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * This Observable will when a mesh has been imported into the scene.\r\n */\r\n _this.onMeshImportedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n // Animations\r\n /** @hidden */\r\n _this._registeredForLateAnimationBindings = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](256);\r\n /**\r\n * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).\r\n * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPrePointerObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time an input event is received from the rendering canvas\r\n */\r\n _this.onPointerObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n // Keyboard\r\n /**\r\n * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()\r\n * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPreKeyboardObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n /**\r\n * Observable event triggered each time an keyboard event is received from the hosting window\r\n */\r\n _this.onKeyboardObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__[\"Observable\"]();\r\n // Coordinates system\r\n _this._useRightHandedSystem = false;\r\n // Deterministic lockstep\r\n _this._timeAccumulator = 0;\r\n _this._currentStepId = 0;\r\n _this._currentInternalStep = 0;\r\n // Fog\r\n _this._fogEnabled = true;\r\n _this._fogMode = Scene.FOGMODE_NONE;\r\n /**\r\n * Gets or sets the fog color to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is Color3(0.2, 0.2, 0.3))\r\n */\r\n _this.fogColor = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_27__[\"Color3\"](0.2, 0.2, 0.3);\r\n /**\r\n * Gets or sets the fog density to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0.1)\r\n */\r\n _this.fogDensity = 0.1;\r\n /**\r\n * Gets or sets the fog start distance to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0)\r\n */\r\n _this.fogStart = 0;\r\n /**\r\n * Gets or sets the fog end distance to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 1000)\r\n */\r\n _this.fogEnd = 1000.0;\r\n // Lights\r\n _this._shadowsEnabled = true;\r\n _this._lightsEnabled = true;\r\n /** All of the active cameras added to this scene. */\r\n _this.activeCameras = new Array();\r\n // Textures\r\n _this._texturesEnabled = true;\r\n // Particles\r\n /**\r\n * Gets or sets a boolean indicating if particles are enabled on this scene\r\n */\r\n _this.particlesEnabled = true;\r\n // Sprites\r\n /**\r\n * Gets or sets a boolean indicating if sprites are enabled on this scene\r\n */\r\n _this.spritesEnabled = true;\r\n // Skeletons\r\n _this._skeletonsEnabled = true;\r\n // Lens flares\r\n /**\r\n * Gets or sets a boolean indicating if lens flares are enabled on this scene\r\n */\r\n _this.lensFlaresEnabled = true;\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating if collisions are enabled on this scene\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.collisionsEnabled = true;\r\n /**\r\n * Defines the gravity applied to this scene (used only for collisions)\r\n * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.gravity = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"](0, -9.807, 0);\r\n // Postprocesses\r\n /**\r\n * Gets or sets a boolean indicating if postprocesses are enabled on this scene\r\n */\r\n _this.postProcessesEnabled = true;\r\n /**\r\n * The list of postprocesses added to the scene\r\n */\r\n _this.postProcesses = new Array();\r\n // Customs render targets\r\n /**\r\n * Gets or sets a boolean indicating if render targets are enabled on this scene\r\n */\r\n _this.renderTargetsEnabled = true;\r\n /**\r\n * Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes\r\n * We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com\r\n */\r\n _this.dumpNextRenderTargets = false;\r\n /**\r\n * The list of user defined render targets added to the scene\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * Gets the list of meshes imported to the scene through SceneLoader\r\n */\r\n _this.importedMeshesFiles = new Array();\r\n // Probes\r\n /**\r\n * Gets or sets a boolean indicating if probes are enabled on this scene\r\n */\r\n _this.probesEnabled = true;\r\n _this._meshesForIntersections = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](256);\r\n // Procedural textures\r\n /**\r\n * Gets or sets a boolean indicating if procedural textures are enabled on this scene\r\n */\r\n _this.proceduralTexturesEnabled = true;\r\n // Performance counters\r\n _this._totalVertices = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._activeIndices = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._activeParticles = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._activeBones = new _Misc_perfCounter__WEBPACK_IMPORTED_MODULE_26__[\"PerfCounter\"]();\r\n /** @hidden */\r\n _this._animationTime = 0;\r\n /**\r\n * Gets or sets a general scale for animation speed\r\n * @see https://www.babylonjs-playground.com/#IBU2W7#3\r\n */\r\n _this.animationTimeScale = 1;\r\n _this._renderId = 0;\r\n _this._frameId = 0;\r\n _this._executeWhenReadyTimeoutId = -1;\r\n _this._intermediateRendering = false;\r\n _this._viewUpdateFlag = -1;\r\n _this._projectionUpdateFlag = -1;\r\n /** @hidden */\r\n _this._toBeDisposed = new Array(256);\r\n _this._activeRequests = new Array();\r\n /** @hidden */\r\n _this._pendingData = new Array();\r\n _this._isDisposed = false;\r\n /**\r\n * Gets or sets a boolean indicating that all submeshes of active meshes must be rendered\r\n * Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)\r\n */\r\n _this.dispatchAllSubMeshesOfActiveMeshes = false;\r\n _this._activeMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArray\"](256);\r\n _this._processedMaterials = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArray\"](256);\r\n _this._renderTargets = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](256);\r\n /** @hidden */\r\n _this._activeParticleSystems = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArray\"](256);\r\n _this._activeSkeletons = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](32);\r\n _this._softwareSkinnedMeshes = new _Misc_smartArray__WEBPACK_IMPORTED_MODULE_4__[\"SmartArrayNoDuplicate\"](32);\r\n /** @hidden */\r\n _this._activeAnimatables = new Array();\r\n _this._transformMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Matrix\"].Zero();\r\n /**\r\n * Gets or sets a boolean indicating if lights must be sorted by priority (off by default)\r\n * This is useful if there are more lights that the maximum simulteanous authorized\r\n */\r\n _this.requireLightSorting = false;\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._components = [];\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._serializableComponents = [];\r\n /**\r\n * List of components to register on the next registration step.\r\n */\r\n _this._transientComponents = [];\r\n /**\r\n * @hidden\r\n * Defines the actions happening before camera updates.\r\n */\r\n _this._beforeCameraUpdateStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before clear the canvas.\r\n */\r\n _this._beforeClearStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions when collecting render targets for the frame.\r\n */\r\n _this._gatherRenderTargetsStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening for one camera in the frame.\r\n */\r\n _this._gatherActiveCameraRenderTargetsStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per mesh ready checks.\r\n */\r\n _this._isReadyForMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before evaluate active mesh checks.\r\n */\r\n _this._beforeEvaluateActiveMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the evaluate sub mesh checks.\r\n */\r\n _this._evaluateSubMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the active mesh stage.\r\n */\r\n _this._activeMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per camera render target step.\r\n */\r\n _this._cameraDrawRenderTargetStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before the active camera is drawing.\r\n */\r\n _this._beforeCameraDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a render target is drawing.\r\n */\r\n _this._beforeRenderTargetDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a rendering group is drawing.\r\n */\r\n _this._beforeRenderingGroupDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a mesh is drawing.\r\n */\r\n _this._beforeRenderingMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a mesh has been drawn.\r\n */\r\n _this._afterRenderingMeshStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a rendering group has been drawn.\r\n */\r\n _this._afterRenderingGroupDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after the active camera has been drawn.\r\n */\r\n _this._afterCameraDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a render target has been drawn.\r\n */\r\n _this._afterRenderTargetDrawStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after rendering all cameras and computing intersections.\r\n */\r\n _this._afterRenderStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer move event happens.\r\n */\r\n _this._pointerMoveStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer down event happens.\r\n */\r\n _this._pointerDownStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer up event happens.\r\n */\r\n _this._pointerUpStage = _sceneComponent__WEBPACK_IMPORTED_MODULE_19__[\"Stage\"].Create();\r\n /**\r\n * an optional map from Geometry Id to Geometry index in the 'geometries' array\r\n */\r\n _this.geometriesByUniqueId = null;\r\n _this._defaultMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._defaultSubMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._preventFreeActiveMeshesAndRenderingGroups = false;\r\n _this._activeMeshesFrozen = false;\r\n /** @hidden */\r\n _this._allowPostProcessClearColor = true;\r\n /**\r\n * User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode\r\n */\r\n _this.getDeterministicFrameTime = function () {\r\n return 1000.0 / 60.0; // frame time in ms\r\n };\r\n _this._blockMaterialDirtyMechanism = false;\r\n _this._engine = engine || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"].LastCreatedEngine;\r\n if (!options || !options.virtual) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"]._LastCreatedScene = _this;\r\n _this._engine.scenes.push(_this);\r\n }\r\n _this._uid = null;\r\n _this._renderingManager = new _Rendering_renderingManager__WEBPACK_IMPORTED_MODULE_18__[\"RenderingManager\"](_this);\r\n if (_PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_17__[\"PostProcessManager\"]) {\r\n _this.postProcessManager = new _PostProcesses_postProcessManager__WEBPACK_IMPORTED_MODULE_17__[\"PostProcessManager\"](_this);\r\n }\r\n if (_Misc_domManagement__WEBPACK_IMPORTED_MODULE_21__[\"DomManagement\"].IsWindowObjectExist()) {\r\n _this.attachControl();\r\n }\r\n // Uniform Buffer\r\n _this._createUbo();\r\n // Default Image processing definition\r\n if (_Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"ImageProcessingConfiguration\"]) {\r\n _this._imageProcessingConfiguration = new _Materials_imageProcessingConfiguration__WEBPACK_IMPORTED_MODULE_12__[\"ImageProcessingConfiguration\"]();\r\n }\r\n _this.setDefaultCandidateProviders();\r\n if (options && options.useGeometryUniqueIdsMap === true) {\r\n _this.geometriesByUniqueId = {};\r\n }\r\n _this.useMaterialMeshMap = options && options.useGeometryUniqueIdsMap || false;\r\n _this.useClonedMeshhMap = options && options.useClonedMeshhMap || false;\r\n if (!options || !options.virtual) {\r\n _this._engine.onNewSceneAddedObservable.notifyObservers(_this);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Factory used to create the default material.\r\n * @param name The name of the material to create\r\n * @param scene The scene to create the material for\r\n * @returns The default material\r\n */\r\n Scene.DefaultMaterialFactory = function (scene) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"StandardMaterial\");\r\n };\r\n /**\r\n * Factory used to create the a collision coordinator.\r\n * @returns The collision coordinator\r\n */\r\n Scene.CollisionCoordinatorFactory = function () {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"DefaultCollisionCoordinator\");\r\n };\r\n Object.defineProperty(Scene.prototype, \"environmentTexture\", {\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentTexture;\r\n },\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentTexture === value) {\r\n return;\r\n }\r\n this._environmentTexture = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"environmentIntensity\", {\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentIntensity;\r\n },\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentIntensity === value) {\r\n return;\r\n }\r\n this._environmentIntensity = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Default image processing configuration used either in the rendering\r\n * Forward main pass or through the imageProcessingPostProcess if present.\r\n * As in the majority of the scene they are the same (exception for multi camera),\r\n * this is easier to reference from here than from all the materials and post process.\r\n *\r\n * No setter as we it is a shared configuration, you can set the values instead.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forceWireframe\", {\r\n get: function () {\r\n return this._forceWireframe;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in wireframe\r\n */\r\n set: function (value) {\r\n if (this._forceWireframe === value) {\r\n return;\r\n }\r\n this._forceWireframe = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forcePointsCloud\", {\r\n get: function () {\r\n return this._forcePointsCloud;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in point cloud\r\n */\r\n set: function (value) {\r\n if (this._forcePointsCloud === value) {\r\n return;\r\n }\r\n this._forcePointsCloud = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"onDispose\", {\r\n /** Sets a function to be executed when this scene is disposed. */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeRender\", {\r\n /** Sets a function to be executed before rendering this scene */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n if (callback) {\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterRender\", {\r\n /** Sets a function to be executed after rendering this scene */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n if (callback) {\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeCameraRender\", {\r\n /** Sets a function to be executed before rendering a camera*/\r\n set: function (callback) {\r\n if (this._onBeforeCameraRenderObserver) {\r\n this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n }\r\n this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterCameraRender\", {\r\n /** Sets a function to be executed after rendering a camera*/\r\n set: function (callback) {\r\n if (this._onAfterCameraRenderObserver) {\r\n this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n }\r\n this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(callback);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return this._inputManager.unTranslatedPointer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DragMovementThreshold\", {\r\n /**\r\n * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels\r\n */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DragMovementThreshold;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DragMovementThreshold = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"LongPressDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms\r\n */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].LongPressDelay;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].LongPressDelay = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DoubleClickDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms\r\n */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DoubleClickDelay;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].DoubleClickDelay = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"ExclusiveDoubleClickMode\", {\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n get: function () {\r\n return _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].ExclusiveDoubleClickMode;\r\n },\r\n set: function (value) {\r\n _Inputs_scene_inputManager__WEBPACK_IMPORTED_MODULE_25__[\"InputManager\"].ExclusiveDoubleClickMode = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"useRightHandedSystem\", {\r\n get: function () {\r\n return this._useRightHandedSystem;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if the scene must use right-handed coordinates system\r\n */\r\n set: function (value) {\r\n if (this._useRightHandedSystem === value) {\r\n return;\r\n }\r\n this._useRightHandedSystem = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the step Id used by deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @param newStepId defines the step Id\r\n */\r\n Scene.prototype.setStepId = function (newStepId) {\r\n this._currentStepId = newStepId;\r\n };\r\n /**\r\n * Gets the step Id used by deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the step Id\r\n */\r\n Scene.prototype.getStepId = function () {\r\n return this._currentStepId;\r\n };\r\n /**\r\n * Gets the internal step used by deterministic lock step\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the internal step\r\n */\r\n Scene.prototype.getInternalStep = function () {\r\n return this._currentInternalStep;\r\n };\r\n Object.defineProperty(Scene.prototype, \"fogEnabled\", {\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if fog is enabled on this scene\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is true)\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"fogMode\", {\r\n get: function () {\r\n return this._fogMode;\r\n },\r\n /**\r\n * Gets or sets the fog mode to use\r\n * @see http://doc.babylonjs.com/babylon101/environment#fog\r\n * | mode | value |\r\n * | --- | --- |\r\n * | FOGMODE_NONE | 0 |\r\n * | FOGMODE_EXP | 1 |\r\n * | FOGMODE_EXP2 | 2 |\r\n * | FOGMODE_LINEAR | 3 |\r\n */\r\n set: function (value) {\r\n if (this._fogMode === value) {\r\n return;\r\n }\r\n this._fogMode = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_MiscDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"shadowsEnabled\", {\r\n get: function () {\r\n return this._shadowsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if shadows are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._shadowsEnabled === value) {\r\n return;\r\n }\r\n this._shadowsEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_LightDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"lightsEnabled\", {\r\n get: function () {\r\n return this._lightsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if lights are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._lightsEnabled === value) {\r\n return;\r\n }\r\n this._lightsEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_LightDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"activeCamera\", {\r\n /** Gets or sets the current active camera */\r\n get: function () {\r\n return this._activeCamera;\r\n },\r\n set: function (value) {\r\n if (value === this._activeCamera) {\r\n return;\r\n }\r\n this._activeCamera = value;\r\n this.onActiveCameraChanged.notifyObservers(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"defaultMaterial\", {\r\n /** The default material used on meshes when no material is affected */\r\n get: function () {\r\n if (!this._defaultMaterial) {\r\n this._defaultMaterial = Scene.DefaultMaterialFactory(this);\r\n }\r\n return this._defaultMaterial;\r\n },\r\n /** The default material used on meshes when no material is affected */\r\n set: function (value) {\r\n this._defaultMaterial = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"texturesEnabled\", {\r\n get: function () {\r\n return this._texturesEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if textures are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._texturesEnabled === value) {\r\n return;\r\n }\r\n this._texturesEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"skeletonsEnabled\", {\r\n get: function () {\r\n return this._skeletonsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if skeletons are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._skeletonsEnabled === value) {\r\n return;\r\n }\r\n this._skeletonsEnabled = value;\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_AttributesDirtyFlag);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"collisionCoordinator\", {\r\n /** @hidden */\r\n get: function () {\r\n if (!this._collisionCoordinator) {\r\n this._collisionCoordinator = Scene.CollisionCoordinatorFactory();\r\n this._collisionCoordinator.init(this);\r\n }\r\n return this._collisionCoordinator;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"frustumPlanes\", {\r\n /**\r\n * Gets the list of frustum planes (built from the active camera)\r\n */\r\n get: function () {\r\n return this._frustumPlanes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers the transient components if needed.\r\n */\r\n Scene.prototype._registerTransientComponents = function () {\r\n // Register components that have been associated lately to the scene.\r\n if (this._transientComponents.length > 0) {\r\n for (var _i = 0, _a = this._transientComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.register();\r\n }\r\n this._transientComponents = [];\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Add a component to the scene.\r\n * Note that the ccomponent could be registered on th next frame if this is called after\r\n * the register component stage.\r\n * @param component Defines the component to add to the scene\r\n */\r\n Scene.prototype._addComponent = function (component) {\r\n this._components.push(component);\r\n this._transientComponents.push(component);\r\n var serializableComponent = component;\r\n if (serializableComponent.addFromContainer && serializableComponent.serialize) {\r\n this._serializableComponents.push(serializableComponent);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Gets a component from the scene.\r\n * @param name defines the name of the component to retrieve\r\n * @returns the component or null if not present\r\n */\r\n Scene.prototype._getComponent = function (name) {\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n if (component.name === name) {\r\n return component;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"Scene\" string\r\n */\r\n Scene.prototype.getClassName = function () {\r\n return \"Scene\";\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultMeshCandidates = function () {\r\n this._defaultMeshCandidates.data = this.meshes;\r\n this._defaultMeshCandidates.length = this.meshes.length;\r\n return this._defaultMeshCandidates;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultSubMeshCandidates = function (mesh) {\r\n this._defaultSubMeshCandidates.data = mesh.subMeshes;\r\n this._defaultSubMeshCandidates.length = mesh.subMeshes.length;\r\n return this._defaultSubMeshCandidates;\r\n };\r\n /**\r\n * Sets the default candidate providers for the scene.\r\n * This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates\r\n * and getCollidingSubMeshCandidates to their default function\r\n */\r\n Scene.prototype.setDefaultCandidateProviders = function () {\r\n this.getActiveMeshCandidates = this._getDefaultMeshCandidates.bind(this);\r\n this.getActiveSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getIntersectingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getCollidingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n };\r\n Object.defineProperty(Scene.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.meshUnderPointer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerX;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerX = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerY;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerY = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the cached material (ie. the latest rendered one)\r\n * @returns the cached material\r\n */\r\n Scene.prototype.getCachedMaterial = function () {\r\n return this._cachedMaterial;\r\n };\r\n /**\r\n * Gets the cached effect (ie. the latest rendered one)\r\n * @returns the cached effect\r\n */\r\n Scene.prototype.getCachedEffect = function () {\r\n return this._cachedEffect;\r\n };\r\n /**\r\n * Gets the cached visibility state (ie. the latest rendered one)\r\n * @returns the cached visibility state\r\n */\r\n Scene.prototype.getCachedVisibility = function () {\r\n return this._cachedVisibility;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current material / effect / visibility must be bind again\r\n * @param material defines the current material\r\n * @param effect defines the current effect\r\n * @param visibility defines the current visibility state\r\n * @returns true if one parameter is not cached\r\n */\r\n Scene.prototype.isCachedMaterialInvalid = function (material, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return this._cachedEffect !== effect || this._cachedMaterial !== material || this._cachedVisibility !== visibility;\r\n };\r\n /**\r\n * Gets the engine associated with the scene\r\n * @returns an Engine\r\n */\r\n Scene.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Gets the total number of vertices rendered per frame\r\n * @returns the total number of vertices rendered per frame\r\n */\r\n Scene.prototype.getTotalVertices = function () {\r\n return this._totalVertices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalVerticesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for total vertices\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._totalVertices;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)\r\n * @returns the total number of active indices rendered per frame\r\n */\r\n Scene.prototype.getActiveIndices = function () {\r\n return this._activeIndices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalActiveIndicesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active indices\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeIndices;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active particles rendered per frame\r\n * @returns the total number of active particles rendered per frame\r\n */\r\n Scene.prototype.getActiveParticles = function () {\r\n return this._activeParticles.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeParticlesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active particles\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeParticles;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active bones rendered per frame\r\n * @returns the total number of active bones rendered per frame\r\n */\r\n Scene.prototype.getActiveBones = function () {\r\n return this._activeBones.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeBonesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active bones\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeBones;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the array of active meshes\r\n * @returns an array of AbstractMesh\r\n */\r\n Scene.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)\r\n * @returns a number\r\n */\r\n Scene.prototype.getAnimationRatio = function () {\r\n return this._animationRatio !== undefined ? this._animationRatio : 1;\r\n };\r\n /**\r\n * Gets an unique Id for the current render phase\r\n * @returns a number\r\n */\r\n Scene.prototype.getRenderId = function () {\r\n return this._renderId;\r\n };\r\n /**\r\n * Gets an unique Id for the current frame\r\n * @returns a number\r\n */\r\n Scene.prototype.getFrameId = function () {\r\n return this._frameId;\r\n };\r\n /** Call this function if you want to manually increment the render Id*/\r\n Scene.prototype.incrementRenderId = function () {\r\n this._renderId++;\r\n };\r\n Scene.prototype._createUbo = function () {\r\n this._sceneUbo = new _Materials_uniformBuffer__WEBPACK_IMPORTED_MODULE_13__[\"UniformBuffer\"](this._engine, undefined, true);\r\n this._sceneUbo.addUniform(\"viewProjection\", 16);\r\n this._sceneUbo.addUniform(\"view\", 16);\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerMove(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerDown(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n this._inputManager.simulatePointerUp(pickResult, pointerEventInit, doubleTap);\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n Scene.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._inputManager.isPointerCaptured(pointerId);\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n */\r\n Scene.prototype.attachControl = function (attachUp, attachDown, attachMove) {\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n this._inputManager.attachControl(attachUp, attachDown, attachMove);\r\n };\r\n /** Detaches all event handlers*/\r\n Scene.prototype.detachControl = function () {\r\n this._inputManager.detachControl();\r\n };\r\n /**\r\n * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)\r\n * Delay loaded resources are not taking in account\r\n * @return true if all required resources are ready\r\n */\r\n Scene.prototype.isReady = function () {\r\n if (this._isDisposed) {\r\n return false;\r\n }\r\n var index;\r\n var engine = this.getEngine();\r\n // Effects\r\n if (!engine.areAllEffectsReady()) {\r\n return false;\r\n }\r\n // Pending data\r\n if (this._pendingData.length > 0) {\r\n return false;\r\n }\r\n // Meshes\r\n for (index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (!mesh.isEnabled()) {\r\n continue;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n continue;\r\n }\r\n if (!mesh.isReady(true)) {\r\n return false;\r\n }\r\n var hardwareInstancedRendering = mesh.getClassName() === \"InstancedMesh\" || mesh.getClassName() === \"InstancedLinesMesh\" || engine.getCaps().instancedArrays && mesh.instances.length > 0;\r\n // Is Ready For Mesh\r\n for (var _i = 0, _a = this._isReadyForMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n if (!step.action(mesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Geometries\r\n for (index = 0; index < this.geometries.length; index++) {\r\n var geometry = this.geometries[index];\r\n if (geometry.delayLoadState === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].DELAYLOADSTATE_LOADING) {\r\n return false;\r\n }\r\n }\r\n // Post-processes\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var _b = 0, _c = this.activeCameras; _b < _c.length; _b++) {\r\n var camera = _c[_b];\r\n if (!camera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n if (!this.activeCamera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n // Particles\r\n for (var _d = 0, _e = this.particleSystems; _d < _e.length; _d++) {\r\n var particleSystem = _e[_d];\r\n if (!particleSystem.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /** Resets all cached information relative to material (including effect and visibility) */\r\n Scene.prototype.resetCachedMaterial = function () {\r\n this._cachedMaterial = null;\r\n this._cachedEffect = null;\r\n this._cachedVisibility = null;\r\n };\r\n /**\r\n * Registers a function to be called before every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called before every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n };\r\n /**\r\n * Registers a function to be called after every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called after every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n };\r\n Scene.prototype._executeOnceBeforeRender = function (func) {\r\n var _this = this;\r\n var execFunc = function () {\r\n func();\r\n setTimeout(function () {\r\n _this.unregisterBeforeRender(execFunc);\r\n });\r\n };\r\n this.registerBeforeRender(execFunc);\r\n };\r\n /**\r\n * The provided function will run before render once and will be disposed afterwards.\r\n * A timeout delay can be provided so that the function will be executed in N ms.\r\n * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.\r\n * @param func The function to be executed.\r\n * @param timeout optional delay in ms\r\n */\r\n Scene.prototype.executeOnceBeforeRender = function (func, timeout) {\r\n var _this = this;\r\n if (timeout !== undefined) {\r\n setTimeout(function () {\r\n _this._executeOnceBeforeRender(func);\r\n }, timeout);\r\n }\r\n else {\r\n this._executeOnceBeforeRender(func);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._addPendingData = function (data) {\r\n this._pendingData.push(data);\r\n };\r\n /** @hidden */\r\n Scene.prototype._removePendingData = function (data) {\r\n var wasLoading = this.isLoading;\r\n var index = this._pendingData.indexOf(data);\r\n if (index !== -1) {\r\n this._pendingData.splice(index, 1);\r\n }\r\n if (wasLoading && !this.isLoading) {\r\n this.onDataLoadedObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Returns the number of items waiting to be loaded\r\n * @returns the number of items waiting to be loaded\r\n */\r\n Scene.prototype.getWaitingItemsCount = function () {\r\n return this._pendingData.length;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isLoading\", {\r\n /**\r\n * Returns a boolean indicating if the scene is still loading data\r\n */\r\n get: function () {\r\n return this._pendingData.length > 0;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers a function to be executed when the scene is ready\r\n * @param {Function} func - the function to be executed\r\n */\r\n Scene.prototype.executeWhenReady = function (func) {\r\n var _this = this;\r\n this.onReadyObservable.add(func);\r\n if (this._executeWhenReadyTimeoutId !== -1) {\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n /**\r\n * Returns a promise that resolves when the scene is ready\r\n * @returns A promise that resolves when the scene is ready\r\n */\r\n Scene.prototype.whenReadyAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.executeWhenReady(function () {\r\n resolve();\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._checkIsReady = function () {\r\n var _this = this;\r\n this._registerTransientComponents();\r\n if (this.isReady()) {\r\n this.onReadyObservable.notifyObservers(this);\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n if (this._isDisposed) {\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n Object.defineProperty(Scene.prototype, \"animatables\", {\r\n /**\r\n * Gets all animatable attached to the scene\r\n */\r\n get: function () {\r\n return this._activeAnimatables;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the last animation time frame.\r\n * Useful to override when animations start running when loading a scene for the first time.\r\n */\r\n Scene.prototype.resetLastAnimationTimeFrame = function () {\r\n this._animationTimeLast = _Misc_precisionDate__WEBPACK_IMPORTED_MODULE_2__[\"PrecisionDate\"].Now;\r\n };\r\n // Matrix\r\n /**\r\n * Gets the current view matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getViewMatrix = function () {\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Gets the current projection matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getProjectionMatrix = function () {\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the current transform matrix\r\n * @returns a Matrix made of View * Projection\r\n */\r\n Scene.prototype.getTransformMatrix = function () {\r\n return this._transformMatrix;\r\n };\r\n /**\r\n * Sets the current transform matrix\r\n * @param viewL defines the View matrix to use\r\n * @param projectionL defines the Projection matrix to use\r\n * @param viewR defines the right View matrix to use (if provided)\r\n * @param projectionR defines the right Projection matrix to use (if provided)\r\n */\r\n Scene.prototype.setTransformMatrix = function (viewL, projectionL, viewR, projectionR) {\r\n if (this._viewUpdateFlag === viewL.updateFlag && this._projectionUpdateFlag === projectionL.updateFlag) {\r\n return;\r\n }\r\n this._viewUpdateFlag = viewL.updateFlag;\r\n this._projectionUpdateFlag = projectionL.updateFlag;\r\n this._viewMatrix = viewL;\r\n this._projectionMatrix = projectionL;\r\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n // Update frustum\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_28__[\"Frustum\"].GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n _Maths_math_frustum__WEBPACK_IMPORTED_MODULE_28__[\"Frustum\"].GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n if (this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo) {\r\n this._updateMultiviewUbo(viewR, projectionR);\r\n }\r\n else if (this._sceneUbo.useUbo) {\r\n this._sceneUbo.updateMatrix(\"viewProjection\", this._transformMatrix);\r\n this._sceneUbo.updateMatrix(\"view\", this._viewMatrix);\r\n this._sceneUbo.update();\r\n }\r\n };\r\n /**\r\n * Gets the uniform buffer used to store scene data\r\n * @returns a UniformBuffer\r\n */\r\n Scene.prototype.getSceneUniformBuffer = function () {\r\n return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;\r\n };\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n * @returns an unique number for the scene\r\n */\r\n Scene.prototype.getUniqueId = function () {\r\n return _Misc_uniqueIdGenerator__WEBPACK_IMPORTED_MODULE_29__[\"UniqueIdGenerator\"].UniqueId;\r\n };\r\n /**\r\n * Add a mesh to the list of scene's meshes\r\n * @param newMesh defines the mesh to add\r\n * @param recursive if all child meshes should also be added to the scene\r\n */\r\n Scene.prototype.addMesh = function (newMesh, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n this.meshes.push(newMesh);\r\n newMesh._resyncLightSources();\r\n this.onNewMeshAddedObservable.notifyObservers(newMesh);\r\n if (recursive) {\r\n newMesh.getChildMeshes().forEach(function (m) {\r\n _this.addMesh(m);\r\n });\r\n }\r\n };\r\n /**\r\n * Remove a mesh for the list of scene's meshes\r\n * @param toRemove defines the mesh to remove\r\n * @param recursive if all child meshes should also be removed from the scene\r\n * @returns the index where the mesh was in the mesh list\r\n */\r\n Scene.prototype.removeMesh = function (toRemove, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n var index = this.meshes.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.meshes[index] = this.meshes[this.meshes.length - 1];\r\n this.meshes.pop();\r\n }\r\n this.onMeshRemovedObservable.notifyObservers(toRemove);\r\n if (recursive) {\r\n toRemove.getChildMeshes().forEach(function (m) {\r\n _this.removeMesh(m);\r\n });\r\n }\r\n return index;\r\n };\r\n /**\r\n * Add a transform node to the list of scene's transform nodes\r\n * @param newTransformNode defines the transform node to add\r\n */\r\n Scene.prototype.addTransformNode = function (newTransformNode) {\r\n newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;\r\n this.transformNodes.push(newTransformNode);\r\n this.onNewTransformNodeAddedObservable.notifyObservers(newTransformNode);\r\n };\r\n /**\r\n * Remove a transform node for the list of scene's transform nodes\r\n * @param toRemove defines the transform node to remove\r\n * @returns the index where the transform node was in the transform node list\r\n */\r\n Scene.prototype.removeTransformNode = function (toRemove) {\r\n var index = toRemove._indexInSceneTransformNodesArray;\r\n if (index !== -1) {\r\n if (index !== this.transformNodes.length - 1) {\r\n var lastNode = this.transformNodes[this.transformNodes.length - 1];\r\n this.transformNodes[index] = lastNode;\r\n lastNode._indexInSceneTransformNodesArray = index;\r\n }\r\n toRemove._indexInSceneTransformNodesArray = -1;\r\n this.transformNodes.pop();\r\n }\r\n this.onTransformNodeRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a skeleton for the list of scene's skeletons\r\n * @param toRemove defines the skeleton to remove\r\n * @returns the index where the skeleton was in the skeleton list\r\n */\r\n Scene.prototype.removeSkeleton = function (toRemove) {\r\n var index = this.skeletons.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.skeletons.splice(index, 1);\r\n this.onSkeletonRemovedObservable.notifyObservers(toRemove);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a morph target for the list of scene's morph targets\r\n * @param toRemove defines the morph target to remove\r\n * @returns the index where the morph target was in the morph target list\r\n */\r\n Scene.prototype.removeMorphTargetManager = function (toRemove) {\r\n var index = this.morphTargetManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.morphTargetManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a light for the list of scene's lights\r\n * @param toRemove defines the light to remove\r\n * @returns the index where the light was in the light list\r\n */\r\n Scene.prototype.removeLight = function (toRemove) {\r\n var index = this.lights.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(toRemove, false);\r\n }\r\n // Remove from the scene if mesh found\r\n this.lights.splice(index, 1);\r\n this.sortLightsByPriority();\r\n }\r\n this.onLightRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a camera for the list of scene's cameras\r\n * @param toRemove defines the camera to remove\r\n * @returns the index where the camera was in the camera list\r\n */\r\n Scene.prototype.removeCamera = function (toRemove) {\r\n var index = this.cameras.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.cameras.splice(index, 1);\r\n }\r\n // Remove from activeCameras\r\n var index2 = this.activeCameras.indexOf(toRemove);\r\n if (index2 !== -1) {\r\n // Remove from the scene if mesh found\r\n this.activeCameras.splice(index2, 1);\r\n }\r\n // Reset the activeCamera\r\n if (this.activeCamera === toRemove) {\r\n if (this.cameras.length > 0) {\r\n this.activeCamera = this.cameras[0];\r\n }\r\n else {\r\n this.activeCamera = null;\r\n }\r\n }\r\n this.onCameraRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a particle system for the list of scene's particle systems\r\n * @param toRemove defines the particle system to remove\r\n * @returns the index where the particle system was in the particle system list\r\n */\r\n Scene.prototype.removeParticleSystem = function (toRemove) {\r\n var index = this.particleSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.particleSystems.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a animation for the list of scene's animations\r\n * @param toRemove defines the animation to remove\r\n * @returns the index where the animation was in the animation list\r\n */\r\n Scene.prototype.removeAnimation = function (toRemove) {\r\n var index = this.animations.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animations.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Scene.prototype.stopAnimation = function (target, animationName, targetMask) {\r\n // Do nothing as code will be provided by animation component\r\n };\r\n /**\r\n * Removes the given animation group from this scene.\r\n * @param toRemove The animation group to remove\r\n * @returns The index of the removed animation group\r\n */\r\n Scene.prototype.removeAnimationGroup = function (toRemove) {\r\n var index = this.animationGroups.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animationGroups.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given multi-material from this scene.\r\n * @param toRemove The multi-material to remove\r\n * @returns The index of the removed multi-material\r\n */\r\n Scene.prototype.removeMultiMaterial = function (toRemove) {\r\n var index = this.multiMaterials.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.multiMaterials.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given material from this scene.\r\n * @param toRemove The material to remove\r\n * @returns The index of the removed material\r\n */\r\n Scene.prototype.removeMaterial = function (toRemove) {\r\n var index = toRemove._indexInSceneMaterialArray;\r\n if (index !== -1 && index < this.materials.length) {\r\n if (index !== this.materials.length - 1) {\r\n var lastMaterial = this.materials[this.materials.length - 1];\r\n this.materials[index] = lastMaterial;\r\n lastMaterial._indexInSceneMaterialArray = index;\r\n }\r\n toRemove._indexInSceneMaterialArray = -1;\r\n this.materials.pop();\r\n }\r\n this.onMaterialRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Removes the given action manager from this scene.\r\n * @param toRemove The action manager to remove\r\n * @returns The index of the removed action manager\r\n */\r\n Scene.prototype.removeActionManager = function (toRemove) {\r\n var index = this.actionManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.actionManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given texture from this scene.\r\n * @param toRemove The texture to remove\r\n * @returns The index of the removed texture\r\n */\r\n Scene.prototype.removeTexture = function (toRemove) {\r\n var index = this.textures.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.textures.splice(index, 1);\r\n }\r\n this.onTextureRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Adds the given light to this scene\r\n * @param newLight The light to add\r\n */\r\n Scene.prototype.addLight = function (newLight) {\r\n this.lights.push(newLight);\r\n this.sortLightsByPriority();\r\n // Add light to all meshes (To support if the light is removed and then readded)\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(newLight) === -1) {\r\n mesh.lightSources.push(newLight);\r\n mesh._resyncLightSources();\r\n }\r\n }\r\n this.onNewLightAddedObservable.notifyObservers(newLight);\r\n };\r\n /**\r\n * Sorts the list list based on light priorities\r\n */\r\n Scene.prototype.sortLightsByPriority = function () {\r\n if (this.requireLightSorting) {\r\n this.lights.sort(_Lights_light__WEBPACK_IMPORTED_MODULE_14__[\"Light\"].CompareLightsPriority);\r\n }\r\n };\r\n /**\r\n * Adds the given camera to this scene\r\n * @param newCamera The camera to add\r\n */\r\n Scene.prototype.addCamera = function (newCamera) {\r\n this.cameras.push(newCamera);\r\n this.onNewCameraAddedObservable.notifyObservers(newCamera);\r\n };\r\n /**\r\n * Adds the given skeleton to this scene\r\n * @param newSkeleton The skeleton to add\r\n */\r\n Scene.prototype.addSkeleton = function (newSkeleton) {\r\n this.skeletons.push(newSkeleton);\r\n this.onNewSkeletonAddedObservable.notifyObservers(newSkeleton);\r\n };\r\n /**\r\n * Adds the given particle system to this scene\r\n * @param newParticleSystem The particle system to add\r\n */\r\n Scene.prototype.addParticleSystem = function (newParticleSystem) {\r\n this.particleSystems.push(newParticleSystem);\r\n };\r\n /**\r\n * Adds the given animation to this scene\r\n * @param newAnimation The animation to add\r\n */\r\n Scene.prototype.addAnimation = function (newAnimation) {\r\n this.animations.push(newAnimation);\r\n };\r\n /**\r\n * Adds the given animation group to this scene.\r\n * @param newAnimationGroup The animation group to add\r\n */\r\n Scene.prototype.addAnimationGroup = function (newAnimationGroup) {\r\n this.animationGroups.push(newAnimationGroup);\r\n };\r\n /**\r\n * Adds the given multi-material to this scene\r\n * @param newMultiMaterial The multi-material to add\r\n */\r\n Scene.prototype.addMultiMaterial = function (newMultiMaterial) {\r\n this.multiMaterials.push(newMultiMaterial);\r\n };\r\n /**\r\n * Adds the given material to this scene\r\n * @param newMaterial The material to add\r\n */\r\n Scene.prototype.addMaterial = function (newMaterial) {\r\n newMaterial._indexInSceneMaterialArray = this.materials.length;\r\n this.materials.push(newMaterial);\r\n this.onNewMaterialAddedObservable.notifyObservers(newMaterial);\r\n };\r\n /**\r\n * Adds the given morph target to this scene\r\n * @param newMorphTargetManager The morph target to add\r\n */\r\n Scene.prototype.addMorphTargetManager = function (newMorphTargetManager) {\r\n this.morphTargetManagers.push(newMorphTargetManager);\r\n };\r\n /**\r\n * Adds the given geometry to this scene\r\n * @param newGeometry The geometry to add\r\n */\r\n Scene.prototype.addGeometry = function (newGeometry) {\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;\r\n }\r\n this.geometries.push(newGeometry);\r\n };\r\n /**\r\n * Adds the given action manager to this scene\r\n * @param newActionManager The action manager to add\r\n */\r\n Scene.prototype.addActionManager = function (newActionManager) {\r\n this.actionManagers.push(newActionManager);\r\n };\r\n /**\r\n * Adds the given texture to this scene.\r\n * @param newTexture The texture to add\r\n */\r\n Scene.prototype.addTexture = function (newTexture) {\r\n this.textures.push(newTexture);\r\n this.onNewTextureAddedObservable.notifyObservers(newTexture);\r\n };\r\n /**\r\n * Switch active camera\r\n * @param newCamera defines the new active camera\r\n * @param attachControl defines if attachControl must be called for the new active camera (default: true)\r\n */\r\n Scene.prototype.switchActiveCamera = function (newCamera, attachControl) {\r\n if (attachControl === void 0) { attachControl = true; }\r\n var canvas = this._engine.getRenderingCanvas();\r\n if (!canvas) {\r\n return;\r\n }\r\n if (this.activeCamera) {\r\n this.activeCamera.detachControl(canvas);\r\n }\r\n this.activeCamera = newCamera;\r\n if (attachControl) {\r\n newCamera.attachControl(canvas);\r\n }\r\n };\r\n /**\r\n * sets the active camera of the scene using its ID\r\n * @param id defines the camera's ID\r\n * @return the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByID = function (id) {\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * sets the active camera of the scene using its name\r\n * @param name defines the camera's name\r\n * @returns the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByName = function (name) {\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * get an animation group using its name\r\n * @param name defines the material's name\r\n * @return the animation group or null if none found.\r\n */\r\n Scene.prototype.getAnimationGroupByName = function (name) {\r\n for (var index = 0; index < this.animationGroups.length; index++) {\r\n if (this.animationGroups[index].name === name) {\r\n return this.animationGroups[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a material using its unique id\r\n * @param uniqueId defines the material's unique id\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].uniqueId === uniqueId) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * get a material using its id\r\n * @param id defines the material's ID\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByID = function (id) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added material using a given id\r\n * @param id defines the material's ID\r\n * @return the last material with the given id or null if none found.\r\n */\r\n Scene.prototype.getLastMaterialByID = function (id) {\r\n for (var index = this.materials.length - 1; index >= 0; index--) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a material using its name\r\n * @param name defines the material's name\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByName = function (name) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].name === name) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a texture using its unique id\r\n * @param uniqueId defines the texture's unique id\r\n * @return the texture or null if none found.\r\n */\r\n Scene.prototype.getTextureByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.textures.length; index++) {\r\n if (this.textures[index].uniqueId === uniqueId) {\r\n return this.textures[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its id\r\n * @param id defines the id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByID = function (id) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its unique id\r\n * @param uniqueId defines the unique id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].uniqueId === uniqueId) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its name\r\n * @param name defines the camera's name\r\n * @return the camera or null if none found.\r\n */\r\n Scene.prototype.getCameraByName = function (name) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].name === name) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param id defines the bone's id\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByID = function (id) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].id === id) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param name defines the bone's name\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByName = function (name) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].name === name) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its name\r\n * @param name defines the the light's name\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByName = function (name) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].name === name) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its id\r\n * @param id defines the light's id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByID = function (id) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its scene-generated unique ID\r\n * @param uniqueId defines the light's unique id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].uniqueId === uniqueId) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a particle system by id\r\n * @param id defines the particle system id\r\n * @return the corresponding system or null if none found\r\n */\r\n Scene.prototype.getParticleSystemByID = function (id) {\r\n for (var index = 0; index < this.particleSystems.length; index++) {\r\n if (this.particleSystems[index].id === id) {\r\n return this.particleSystems[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a geometry using its ID\r\n * @param id defines the geometry's id\r\n * @return the geometry or null if none found.\r\n */\r\n Scene.prototype.getGeometryByID = function (id) {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].id === id) {\r\n return this.geometries[index];\r\n }\r\n }\r\n return null;\r\n };\r\n Scene.prototype._getGeometryByUniqueID = function (uniqueId) {\r\n if (this.geometriesByUniqueId) {\r\n var index_1 = this.geometriesByUniqueId[uniqueId];\r\n if (index_1 !== undefined) {\r\n return this.geometries[index_1];\r\n }\r\n }\r\n else {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].uniqueId === uniqueId) {\r\n return this.geometries[index];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Add a new geometry to this scene\r\n * @param geometry defines the geometry to be added to the scene.\r\n * @param force defines if the geometry must be pushed even if a geometry with this id already exists\r\n * @return a boolean defining if the geometry was added or not\r\n */\r\n Scene.prototype.pushGeometry = function (geometry, force) {\r\n if (!force && this._getGeometryByUniqueID(geometry.uniqueId)) {\r\n return false;\r\n }\r\n this.addGeometry(geometry);\r\n this.onNewGeometryAddedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Removes an existing geometry\r\n * @param geometry defines the geometry to be removed from the scene\r\n * @return a boolean defining if the geometry was removed or not\r\n */\r\n Scene.prototype.removeGeometry = function (geometry) {\r\n var index;\r\n if (this.geometriesByUniqueId) {\r\n index = this.geometriesByUniqueId[geometry.uniqueId];\r\n if (index === undefined) {\r\n return false;\r\n }\r\n }\r\n else {\r\n index = this.geometries.indexOf(geometry);\r\n if (index < 0) {\r\n return false;\r\n }\r\n }\r\n if (index !== this.geometries.length - 1) {\r\n var lastGeometry = this.geometries[this.geometries.length - 1];\r\n this.geometries[index] = lastGeometry;\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[lastGeometry.uniqueId] = index;\r\n this.geometriesByUniqueId[geometry.uniqueId] = undefined;\r\n }\r\n }\r\n this.geometries.pop();\r\n this.onGeometryRemovedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Gets the list of geometries attached to the scene\r\n * @returns an array of Geometry\r\n */\r\n Scene.prototype.getGeometries = function () {\r\n return this.geometries;\r\n };\r\n /**\r\n * Gets the first added mesh found of a given ID\r\n * @param id defines the id to search for\r\n * @return the mesh found or null if not found at all\r\n */\r\n Scene.prototype.getMeshByID = function (id) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of meshes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of meshes\r\n */\r\n Scene.prototype.getMeshesByID = function (id) {\r\n return this.meshes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets the first added transform node found of a given ID\r\n * @param id defines the id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByID = function (id) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node with its auto-generated unique id\r\n * @param uniqueId efines the unique id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].uniqueId === uniqueId) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of transform nodes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of transform nodes\r\n */\r\n Scene.prototype.getTransformNodesByID = function (id) {\r\n return this.transformNodes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets a mesh with its auto-generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].uniqueId === uniqueId) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added mesh using a given id\r\n * @param id defines the id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getLastMeshByID = function (id) {\r\n for (var index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getLastEntryByID = function (id) {\r\n var index;\r\n for (index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n for (index = this.transformNodes.length - 1; index >= 0; index--) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n for (index = this.cameras.length - 1; index >= 0; index--) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n for (index = this.lights.length - 1; index >= 0; index--) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getNodeByID = function (id) {\r\n var mesh = this.getMeshByID(id);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByID(id);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByID(id);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByID(id);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given name\r\n * @param name defines the name to search for\r\n * @return the found node or null if not found at all.\r\n */\r\n Scene.prototype.getNodeByName = function (name) {\r\n var mesh = this.getMeshByName(name);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByName(name);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByName(name);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByName(name);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a mesh using a given name\r\n * @param name defines the name to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByName = function (name) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].name === name) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node using a given name\r\n * @param name defines the name to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByName = function (name) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].name === name) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getLastSkeletonByID = function (id) {\r\n for (var index = this.skeletons.length - 1; index >= 0; index--) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given auto generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByUniqueId = function (uniqueId) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].uniqueId === uniqueId) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonById = function (id) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given name\r\n * @param name defines the name to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByName = function (name) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].name === name) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target manager using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found morph target manager or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetManagerById = function (id) {\r\n for (var index = 0; index < this.morphTargetManagers.length; index++) {\r\n if (this.morphTargetManagers[index].uniqueId === id) {\r\n return this.morphTargetManagers[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found morph target or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetById = function (id) {\r\n for (var managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\r\n var morphTargetManager = this.morphTargetManagers[managerIndex];\r\n for (var index = 0; index < morphTargetManager.numTargets; ++index) {\r\n var target = morphTargetManager.getTarget(index);\r\n if (target.id === id) {\r\n return target;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given mesh is active\r\n * @param mesh defines the mesh to look for\r\n * @returns true if the mesh is in the active list\r\n */\r\n Scene.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n Object.defineProperty(Scene.prototype, \"uid\", {\r\n /**\r\n * Return a unique id as a string which can serve as an identifier for the scene\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Add an externaly attached data from its key.\r\n * This method call will fail and return false, if such key already exists.\r\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\r\n * @param key the unique key that identifies the data\r\n * @param data the data object to associate to the key for this Engine instance\r\n * @return true if no such key were already present and the data was added successfully, false otherwise\r\n */\r\n Scene.prototype.addExternalData = function (key, data) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_5__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.add(key, data);\r\n };\r\n /**\r\n * Get an externaly attached data from its key\r\n * @param key the unique key that identifies the data\r\n * @return the associated data, if present (can be null), or undefined if not present\r\n */\r\n Scene.prototype.getExternalData = function (key) {\r\n if (!this._externalData) {\r\n return null;\r\n }\r\n return this._externalData.get(key);\r\n };\r\n /**\r\n * Get an externaly attached data from its key, create it using a factory if it's not already present\r\n * @param key the unique key that identifies the data\r\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\r\n * @return the associated data, can be null if the factory returned null.\r\n */\r\n Scene.prototype.getOrAddExternalDataWithFactory = function (key, factory) {\r\n if (!this._externalData) {\r\n this._externalData = new _Misc_stringDictionary__WEBPACK_IMPORTED_MODULE_5__[\"StringDictionary\"]();\r\n }\r\n return this._externalData.getOrAddWithFactory(key, factory);\r\n };\r\n /**\r\n * Remove an externaly attached data from the Engine instance\r\n * @param key the unique key that identifies the data\r\n * @return true if the data was successfully removed, false if it doesn't exist\r\n */\r\n Scene.prototype.removeExternalData = function (key) {\r\n return this._externalData.remove(key);\r\n };\r\n Scene.prototype._evaluateSubMesh = function (subMesh, mesh, initialMesh) {\r\n if (initialMesh.hasInstances || initialMesh.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || mesh.alwaysSelectAsActiveMesh || mesh.subMeshes.length === 1 || subMesh.isInFrustum(this._frustumPlanes)) {\r\n for (var _i = 0, _a = this._evaluateSubMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(mesh, subMesh);\r\n }\r\n var material = subMesh.getMaterial();\r\n if (material !== null && material !== undefined) {\r\n // Render targets\r\n if (material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\r\n if (this._processedMaterials.indexOf(material) === -1) {\r\n this._processedMaterials.push(material);\r\n this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\r\n }\r\n }\r\n // Dispatch\r\n this._activeIndices.addCount(subMesh.indexCount, false);\r\n this._renderingManager.dispatch(subMesh, mesh, material);\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the processed materials smart array preventing retention point in material dispose.\r\n */\r\n Scene.prototype.freeProcessedMaterials = function () {\r\n this._processedMaterials.dispose();\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockfreeActiveMeshesAndRenderingGroups\", {\r\n /** Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups\r\n * It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance\r\n * when disposing several meshes in a row or a hierarchy of meshes.\r\n * When used, it is the responsability of the user to blockfreeActiveMeshesAndRenderingGroups back to false.\r\n */\r\n get: function () {\r\n return this._preventFreeActiveMeshesAndRenderingGroups;\r\n },\r\n set: function (value) {\r\n if (this._preventFreeActiveMeshesAndRenderingGroups === value) {\r\n return;\r\n }\r\n if (value) {\r\n this.freeActiveMeshes();\r\n this.freeRenderingGroups();\r\n }\r\n this._preventFreeActiveMeshesAndRenderingGroups = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Clear the active meshes smart array preventing retention point in mesh dispose.\r\n */\r\n Scene.prototype.freeActiveMeshes = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n this._activeMeshes.dispose();\r\n if (this.activeCamera && this.activeCamera._activeMeshes) {\r\n this.activeCamera._activeMeshes.dispose();\r\n }\r\n if (this.activeCameras) {\r\n for (var i = 0; i < this.activeCameras.length; i++) {\r\n var activeCamera = this.activeCameras[i];\r\n if (activeCamera && activeCamera._activeMeshes) {\r\n activeCamera._activeMeshes.dispose();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n Scene.prototype.freeRenderingGroups = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n if (this.textures) {\r\n for (var i = 0; i < this.textures.length; i++) {\r\n var texture = this.textures[i];\r\n if (texture && texture.renderList) {\r\n texture.freeRenderingGroups();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._isInIntermediateRendering = function () {\r\n return this._intermediateRendering;\r\n };\r\n /**\r\n * Use this function to stop evaluating active meshes. The current list will be keep alive between frames\r\n * @returns the current scene\r\n */\r\n Scene.prototype.freezeActiveMeshes = function () {\r\n if (!this.activeCamera) {\r\n return this;\r\n }\r\n if (!this._frustumPlanes) {\r\n this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());\r\n }\r\n this._evaluateActiveMeshes();\r\n this._activeMeshesFrozen = true;\r\n for (var index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._freeze();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Use this function to restart evaluating active meshes on every frame\r\n * @returns the current scene\r\n */\r\n Scene.prototype.unfreezeActiveMeshes = function () {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (mesh._internalAbstractMeshDataInfo) {\r\n mesh._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n }\r\n for (var index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._unFreeze();\r\n }\r\n this._activeMeshesFrozen = false;\r\n return this;\r\n };\r\n Scene.prototype._evaluateActiveMeshes = function () {\r\n if (this._activeMeshesFrozen && this._activeMeshes.length) {\r\n var len_1 = this._activeMeshes.length;\r\n for (var i = 0; i < len_1; i++) {\r\n var mesh = this._activeMeshes.data[i];\r\n mesh.computeWorldMatrix();\r\n }\r\n return;\r\n }\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this);\r\n this.activeCamera._activeMeshes.reset();\r\n this._activeMeshes.reset();\r\n this._renderingManager.reset();\r\n this._processedMaterials.reset();\r\n this._activeParticleSystems.reset();\r\n this._activeSkeletons.reset();\r\n this._softwareSkinnedMeshes.reset();\r\n for (var _i = 0, _a = this._beforeEvaluateActiveMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Determine mesh candidates\r\n var meshes = this.getActiveMeshCandidates();\r\n // Check each mesh\r\n var len = meshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var mesh = meshes.data[i];\r\n if (mesh.isBlocked) {\r\n continue;\r\n }\r\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\r\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.lengthSquared() === 0) {\r\n continue;\r\n }\r\n mesh.computeWorldMatrix();\r\n // Intersections\r\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionEnterTrigger, _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger)) {\r\n this._meshesForIntersections.pushNoDuplicate(mesh);\r\n }\r\n // Switch to current LOD\r\n var meshToRender = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);\r\n if (meshToRender === undefined || meshToRender === null) {\r\n continue;\r\n }\r\n // Compute world matrix if LOD is billboard\r\n if (meshToRender !== mesh && meshToRender.billboardMode !== _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_8__[\"TransformNode\"].BILLBOARDMODE_NONE) {\r\n meshToRender.computeWorldMatrix();\r\n }\r\n mesh._preActivate();\r\n if (mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) !== 0) && (mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(this._frustumPlanes))) {\r\n this._activeMeshes.push(mesh);\r\n this.activeCamera._activeMeshes.push(mesh);\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(this._renderId, false);\r\n }\r\n if (mesh._activate(this._renderId, false)) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstances = false;\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActive = true;\r\n this._activeMesh(mesh, meshToRender);\r\n }\r\n mesh._postActivate();\r\n }\r\n }\r\n this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this);\r\n // Particle systems\r\n if (this.particlesEnabled) {\r\n this.onBeforeParticlesRenderingObservable.notifyObservers(this);\r\n for (var particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\r\n var particleSystem = this.particleSystems[particleIndex];\r\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || emitter.isEnabled()) {\r\n this._activeParticleSystems.push(particleSystem);\r\n particleSystem.animate();\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n this.onAfterParticlesRenderingObservable.notifyObservers(this);\r\n }\r\n };\r\n Scene.prototype._activeMesh = function (sourceMesh, mesh) {\r\n if (this._skeletonsEnabled && mesh.skeleton !== null && mesh.skeleton !== undefined) {\r\n if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {\r\n mesh.skeleton.prepare();\r\n }\r\n if (!mesh.computeBonesUsingShaders) {\r\n this._softwareSkinnedMeshes.pushNoDuplicate(mesh);\r\n }\r\n }\r\n for (var _i = 0, _a = this._activeMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(sourceMesh, mesh);\r\n }\r\n if (mesh !== undefined && mesh !== null\r\n && mesh.subMeshes !== undefined && mesh.subMeshes !== null && mesh.subMeshes.length > 0) {\r\n var subMeshes = this.getActiveSubMeshCandidates(mesh);\r\n var len = subMeshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var subMesh = subMeshes.data[i];\r\n this._evaluateSubMesh(subMesh, mesh, sourceMesh);\r\n }\r\n }\r\n };\r\n /**\r\n * Update the transform matrix to update from the current active camera\r\n * @param force defines a boolean used to force the update even if cache is up to date\r\n */\r\n Scene.prototype.updateTransformMatrix = function (force) {\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(force));\r\n };\r\n Scene.prototype._bindFrameBuffer = function () {\r\n if (this.activeCamera && this.activeCamera._multiviewTexture) {\r\n this.activeCamera._multiviewTexture._bindFrameBuffer();\r\n }\r\n else if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n var useMultiview = this.getEngine().getCaps().multiview && this.activeCamera.outputRenderTarget && this.activeCamera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.activeCamera.outputRenderTarget._bindFrameBuffer();\r\n }\r\n else {\r\n var internalTexture = this.activeCamera.outputRenderTarget.getInternalTexture();\r\n if (internalTexture) {\r\n this.getEngine().bindFramebuffer(internalTexture);\r\n }\r\n else {\r\n _Misc_logger__WEBPACK_IMPORTED_MODULE_22__[\"Logger\"].Error(\"Camera contains invalid customDefaultRenderTarget\");\r\n }\r\n }\r\n }\r\n else {\r\n this.getEngine().restoreDefaultFramebuffer(); // Restore back buffer if needed\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._renderForCamera = function (camera, rigParent) {\r\n if (camera && camera._skipRendering) {\r\n return;\r\n }\r\n var engine = this._engine;\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.resetCachedMaterial();\r\n this._renderId++;\r\n var useMultiview = this.getEngine().getCaps().multiview && camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.setTransformMatrix(camera._rigCameras[0].getViewMatrix(), camera._rigCameras[0].getProjectionMatrix(), camera._rigCameras[1].getViewMatrix(), camera._rigCameras[1].getProjectionMatrix());\r\n }\r\n else {\r\n this.updateTransformMatrix();\r\n }\r\n this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera);\r\n // Meshes\r\n this._evaluateActiveMeshes();\r\n // Software skinning\r\n for (var softwareSkinnedMeshIndex = 0; softwareSkinnedMeshIndex < this._softwareSkinnedMeshes.length; softwareSkinnedMeshIndex++) {\r\n var mesh = this._softwareSkinnedMeshes.data[softwareSkinnedMeshIndex];\r\n mesh.applySkeleton(mesh.skeleton);\r\n }\r\n // Render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n if (camera.customRenderTargets && camera.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(camera.customRenderTargets);\r\n }\r\n if (rigParent && rigParent.customRenderTargets && rigParent.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(rigParent.customRenderTargets);\r\n }\r\n // Collects render targets from external components.\r\n for (var _i = 0, _a = this._gatherActiveCameraRenderTargetsStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this._renderTargets);\r\n }\r\n if (this.renderTargetsEnabled) {\r\n this._intermediateRendering = true;\r\n var needRebind = false;\r\n if (this._renderTargets.length > 0) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].StartPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n for (var renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {\r\n var renderTarget = this._renderTargets.data[renderIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n var hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;\r\n renderTarget.render(hasSpecialRenderTargetCamera, this.dumpNextRenderTargets);\r\n needRebind = true;\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].EndPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n this._renderId++;\r\n }\r\n for (var _b = 0, _c = this._cameraDrawRenderTargetStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n needRebind = step.action(this.activeCamera) || needRebind;\r\n }\r\n this._intermediateRendering = false;\r\n // Need to bind if sub-camera has an outputRenderTarget eg. for webXR\r\n if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n needRebind = true;\r\n }\r\n // Restore framebuffer after rendering to targets\r\n if (needRebind) {\r\n this._bindFrameBuffer();\r\n }\r\n }\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n // Prepare Frame\r\n if (this.postProcessManager && !camera._multiviewTexture) {\r\n this.postProcessManager._prepareFrame();\r\n }\r\n // Before Camera Draw\r\n for (var _d = 0, _e = this._beforeCameraDrawStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this.activeCamera);\r\n }\r\n // Render\r\n this.onBeforeDrawPhaseObservable.notifyObservers(this);\r\n this._renderingManager.render(null, null, true, true);\r\n this.onAfterDrawPhaseObservable.notifyObservers(this);\r\n // After Camera Draw\r\n for (var _f = 0, _g = this._afterCameraDrawStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action(this.activeCamera);\r\n }\r\n // Finalize frame\r\n if (this.postProcessManager && !camera._multiviewTexture) {\r\n this.postProcessManager._finalizeFrame(camera.isIntermediate);\r\n }\r\n // Reset some special arrays\r\n this._renderTargets.reset();\r\n this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);\r\n };\r\n Scene.prototype._processSubCameras = function (camera) {\r\n if (camera.cameraRigMode === _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__[\"Camera\"].RIG_MODE_NONE || (camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1 && this.getEngine().getCaps().multiview)) {\r\n this._renderForCamera(camera);\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n return;\r\n }\r\n if (camera._useMultiviewToSingleView) {\r\n this._renderMultiviewToSingleView(camera);\r\n }\r\n else {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n this._renderForCamera(camera._rigCameras[index], camera);\r\n }\r\n }\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n this.setTransformMatrix(this._activeCamera.getViewMatrix(), this._activeCamera.getProjectionMatrix());\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n };\r\n Scene.prototype._checkIntersections = function () {\r\n for (var index = 0; index < this._meshesForIntersections.length; index++) {\r\n var sourceMesh = this._meshesForIntersections.data[index];\r\n if (!sourceMesh.actionManager) {\r\n continue;\r\n }\r\n for (var actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {\r\n var action = sourceMesh.actionManager.actions[actionIndex];\r\n if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionEnterTrigger || action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n var parameters = action.getTriggerParameter();\r\n var otherMesh = parameters instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_9__[\"AbstractMesh\"] ? parameters : parameters.mesh;\r\n var areIntersecting = otherMesh.intersectsMesh(sourceMesh, parameters.usePreciseIntersection);\r\n var currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);\r\n if (areIntersecting && currentIntersectionInProgress === -1) {\r\n if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionEnterTrigger) {\r\n action._executeCurrent(_Actions_actionEvent__WEBPACK_IMPORTED_MODULE_16__[\"ActionEvent\"].CreateNew(sourceMesh, undefined, otherMesh));\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n else if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n }\r\n else if (!areIntersecting && currentIntersectionInProgress > -1) {\r\n //They intersected, and now they don't.\r\n //is this trigger an exit trigger? execute an event.\r\n if (action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n action._executeCurrent(_Actions_actionEvent__WEBPACK_IMPORTED_MODULE_16__[\"ActionEvent\"].CreateNew(sourceMesh, undefined, otherMesh));\r\n }\r\n //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.\r\n if (!sourceMesh.actionManager.hasSpecificTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger, function (parameter) {\r\n var parameterMesh = parameter instanceof _Meshes_abstractMesh__WEBPACK_IMPORTED_MODULE_9__[\"AbstractMesh\"] ? parameter : parameter.mesh;\r\n return otherMesh === parameterMesh;\r\n }) || action.trigger === _Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnIntersectionExitTrigger) {\r\n sourceMesh._intersectionsInProgress.splice(currentIntersectionInProgress, 1);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._advancePhysicsEngineStep = function (step) {\r\n // Do nothing. Code will be replaced if physics engine component is referenced\r\n };\r\n /** @hidden */\r\n Scene.prototype._animate = function () {\r\n // Nothing to do as long as Animatable have not been imported.\r\n };\r\n /** Execute all animations (for a frame) */\r\n Scene.prototype.animate = function () {\r\n if (this._engine.isDeterministicLockStep()) {\r\n var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime)) + this._timeAccumulator;\r\n var defaultFPS = (60.0 / 1000.0);\r\n var defaultFrameTime = this.getDeterministicFrameTime();\r\n var stepsTaken = 0;\r\n var maxSubSteps = this._engine.getLockstepMaxSteps();\r\n var internalSteps = Math.floor(deltaTime / (1000 * defaultFPS));\r\n internalSteps = Math.min(internalSteps, maxSubSteps);\r\n do {\r\n this.onBeforeStepObservable.notifyObservers(this);\r\n // Animations\r\n this._animationRatio = defaultFrameTime * defaultFPS;\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n this._advancePhysicsEngineStep(defaultFrameTime);\r\n this.onAfterStepObservable.notifyObservers(this);\r\n this._currentStepId++;\r\n stepsTaken++;\r\n deltaTime -= defaultFrameTime;\r\n } while (deltaTime > 0 && stepsTaken < internalSteps);\r\n this._timeAccumulator = deltaTime < 0 ? 0 : deltaTime;\r\n }\r\n else {\r\n // Animations\r\n var deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));\r\n this._animationRatio = deltaTime * (60.0 / 1000.0);\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n this._advancePhysicsEngineStep(deltaTime);\r\n }\r\n };\r\n /**\r\n * Render the scene\r\n * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)\r\n * @param ignoreAnimations defines a boolean indicating if animations should not be executed (false by default)\r\n */\r\n Scene.prototype.render = function (updateCameras, ignoreAnimations) {\r\n if (updateCameras === void 0) { updateCameras = true; }\r\n if (ignoreAnimations === void 0) { ignoreAnimations = false; }\r\n if (this.isDisposed) {\r\n return;\r\n }\r\n this._frameId++;\r\n // Register components that have been associated lately to the scene.\r\n this._registerTransientComponents();\r\n this._activeParticles.fetchNewFrame();\r\n this._totalVertices.fetchNewFrame();\r\n this._activeIndices.fetchNewFrame();\r\n this._activeBones.fetchNewFrame();\r\n this._meshesForIntersections.reset();\r\n this.resetCachedMaterial();\r\n this.onBeforeAnimationsObservable.notifyObservers(this);\r\n // Actions\r\n if (this.actionManager) {\r\n this.actionManager.processTrigger(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].ACTION_OnEveryFrameTrigger);\r\n }\r\n // Animations\r\n if (!ignoreAnimations) {\r\n this.animate();\r\n }\r\n // Before camera update steps\r\n for (var _i = 0, _a = this._beforeCameraUpdateStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Update Cameras\r\n if (updateCameras) {\r\n if (this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n var camera = this.activeCameras[cameraIndex];\r\n camera.update();\r\n if (camera.cameraRigMode !== _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__[\"Camera\"].RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n camera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n this.activeCamera.update();\r\n if (this.activeCamera.cameraRigMode !== _Cameras_camera__WEBPACK_IMPORTED_MODULE_10__[\"Camera\"].RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {\r\n this.activeCamera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n // Before render\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Customs render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n var engine = this.getEngine();\r\n var currentActiveCamera = this.activeCamera;\r\n if (this.renderTargetsEnabled) {\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].StartPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = true;\r\n for (var customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {\r\n var renderTarget = this.customRenderTargets[customIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n this.activeCamera = renderTarget.activeCamera || this.activeCamera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.updateTransformMatrix();\r\n renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);\r\n }\r\n }\r\n _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].EndPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = false;\r\n this._renderId++;\r\n }\r\n // Restore back buffer\r\n this.activeCamera = currentActiveCamera;\r\n this._bindFrameBuffer();\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n for (var _b = 0, _c = this._beforeClearStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action();\r\n }\r\n // Clear\r\n if (this.autoClearDepthAndStencil || this.autoClear) {\r\n this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);\r\n }\r\n // Collects render targets from external components.\r\n for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this._renderTargets);\r\n }\r\n // Multi-cameras?\r\n if (this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n if (cameraIndex > 0) {\r\n this._engine.clear(null, false, true, true);\r\n }\r\n this._processSubCameras(this.activeCameras[cameraIndex]);\r\n }\r\n }\r\n else {\r\n if (!this.activeCamera) {\r\n throw new Error(\"No camera defined\");\r\n }\r\n this._processSubCameras(this.activeCamera);\r\n }\r\n // Intersection checks\r\n this._checkIntersections();\r\n // Executes the after render stage actions.\r\n for (var _f = 0, _g = this._afterRenderStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action();\r\n }\r\n // After render\r\n if (this.afterRender) {\r\n this.afterRender();\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n // Cleaning\r\n if (this._toBeDisposed.length) {\r\n for (var index = 0; index < this._toBeDisposed.length; index++) {\r\n var data = this._toBeDisposed[index];\r\n if (data) {\r\n data.dispose();\r\n }\r\n }\r\n this._toBeDisposed = [];\r\n }\r\n if (this.dumpNextRenderTargets) {\r\n this.dumpNextRenderTargets = false;\r\n }\r\n this._activeBones.addCount(0, true);\r\n this._activeIndices.addCount(0, true);\r\n this._activeParticles.addCount(0, true);\r\n };\r\n /**\r\n * Freeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.freezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].freeze();\r\n }\r\n };\r\n /**\r\n * Unfreeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.unfreezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].unfreeze();\r\n }\r\n };\r\n /**\r\n * Releases all held ressources\r\n */\r\n Scene.prototype.dispose = function () {\r\n this.beforeRender = null;\r\n this.afterRender = null;\r\n if (_Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"]._LastCreatedScene === this) {\r\n _Engines_engineStore__WEBPACK_IMPORTED_MODULE_23__[\"EngineStore\"]._LastCreatedScene = null;\r\n }\r\n this.skeletons = [];\r\n this.morphTargetManagers = [];\r\n this._transientComponents = [];\r\n this._isReadyForMeshStage.clear();\r\n this._beforeEvaluateActiveMeshStage.clear();\r\n this._evaluateSubMeshStage.clear();\r\n this._activeMeshStage.clear();\r\n this._cameraDrawRenderTargetStage.clear();\r\n this._beforeCameraDrawStage.clear();\r\n this._beforeRenderTargetDrawStage.clear();\r\n this._beforeRenderingGroupDrawStage.clear();\r\n this._beforeRenderingMeshStage.clear();\r\n this._afterRenderingMeshStage.clear();\r\n this._afterRenderingGroupDrawStage.clear();\r\n this._afterCameraDrawStage.clear();\r\n this._afterRenderTargetDrawStage.clear();\r\n this._afterRenderStage.clear();\r\n this._beforeCameraUpdateStage.clear();\r\n this._beforeClearStage.clear();\r\n this._gatherRenderTargetsStage.clear();\r\n this._gatherActiveCameraRenderTargetsStage.clear();\r\n this._pointerMoveStage.clear();\r\n this._pointerDownStage.clear();\r\n this._pointerUpStage.clear();\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.dispose();\r\n }\r\n this.importedMeshesFiles = new Array();\r\n if (this.stopAllAnimations) {\r\n this.stopAllAnimations();\r\n }\r\n this.resetCachedMaterial();\r\n // Smart arrays\r\n if (this.activeCamera) {\r\n this.activeCamera._activeMeshes.dispose();\r\n this.activeCamera = null;\r\n }\r\n this._activeMeshes.dispose();\r\n this._renderingManager.dispose();\r\n this._processedMaterials.dispose();\r\n this._activeParticleSystems.dispose();\r\n this._activeSkeletons.dispose();\r\n this._softwareSkinnedMeshes.dispose();\r\n this._renderTargets.dispose();\r\n this._registeredForLateAnimationBindings.dispose();\r\n this._meshesForIntersections.dispose();\r\n this._toBeDisposed = [];\r\n // Abort active requests\r\n for (var _b = 0, _c = this._activeRequests; _b < _c.length; _b++) {\r\n var request = _c[_b];\r\n request.abort();\r\n }\r\n // Events\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderTargetsRenderObservable.clear();\r\n this.onAfterRenderTargetsRenderObservable.clear();\r\n this.onAfterStepObservable.clear();\r\n this.onBeforeStepObservable.clear();\r\n this.onBeforeActiveMeshesEvaluationObservable.clear();\r\n this.onAfterActiveMeshesEvaluationObservable.clear();\r\n this.onBeforeParticlesRenderingObservable.clear();\r\n this.onAfterParticlesRenderingObservable.clear();\r\n this.onBeforeDrawPhaseObservable.clear();\r\n this.onAfterDrawPhaseObservable.clear();\r\n this.onBeforeAnimationsObservable.clear();\r\n this.onAfterAnimationsObservable.clear();\r\n this.onDataLoadedObservable.clear();\r\n this.onBeforeRenderingGroupObservable.clear();\r\n this.onAfterRenderingGroupObservable.clear();\r\n this.onMeshImportedObservable.clear();\r\n this.onBeforeCameraRenderObservable.clear();\r\n this.onAfterCameraRenderObservable.clear();\r\n this.onReadyObservable.clear();\r\n this.onNewCameraAddedObservable.clear();\r\n this.onCameraRemovedObservable.clear();\r\n this.onNewLightAddedObservable.clear();\r\n this.onLightRemovedObservable.clear();\r\n this.onNewGeometryAddedObservable.clear();\r\n this.onGeometryRemovedObservable.clear();\r\n this.onNewTransformNodeAddedObservable.clear();\r\n this.onTransformNodeRemovedObservable.clear();\r\n this.onNewMeshAddedObservable.clear();\r\n this.onMeshRemovedObservable.clear();\r\n this.onNewSkeletonAddedObservable.clear();\r\n this.onSkeletonRemovedObservable.clear();\r\n this.onNewMaterialAddedObservable.clear();\r\n this.onMaterialRemovedObservable.clear();\r\n this.onNewTextureAddedObservable.clear();\r\n this.onTextureRemovedObservable.clear();\r\n this.onPrePointerObservable.clear();\r\n this.onPointerObservable.clear();\r\n this.onPreKeyboardObservable.clear();\r\n this.onKeyboardObservable.clear();\r\n this.onActiveCameraChanged.clear();\r\n this.detachControl();\r\n // Detach cameras\r\n var canvas = this._engine.getRenderingCanvas();\r\n if (canvas) {\r\n var index;\r\n for (index = 0; index < this.cameras.length; index++) {\r\n this.cameras[index].detachControl(canvas);\r\n }\r\n }\r\n // Release animation groups\r\n while (this.animationGroups.length) {\r\n this.animationGroups[0].dispose();\r\n }\r\n // Release lights\r\n while (this.lights.length) {\r\n this.lights[0].dispose();\r\n }\r\n // Release meshes\r\n while (this.meshes.length) {\r\n this.meshes[0].dispose(true);\r\n }\r\n while (this.transformNodes.length) {\r\n this.transformNodes[0].dispose(true);\r\n }\r\n // Release cameras\r\n while (this.cameras.length) {\r\n this.cameras[0].dispose();\r\n }\r\n // Release materials\r\n if (this._defaultMaterial) {\r\n this._defaultMaterial.dispose();\r\n }\r\n while (this.multiMaterials.length) {\r\n this.multiMaterials[0].dispose();\r\n }\r\n while (this.materials.length) {\r\n this.materials[0].dispose();\r\n }\r\n // Release particles\r\n while (this.particleSystems.length) {\r\n this.particleSystems[0].dispose();\r\n }\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Release textures\r\n while (this.textures.length) {\r\n this.textures[0].dispose();\r\n }\r\n // Release UBO\r\n this._sceneUbo.dispose();\r\n if (this._multiviewSceneUbo) {\r\n this._multiviewSceneUbo.dispose();\r\n }\r\n // Post-processes\r\n this.postProcessManager.dispose();\r\n // Remove from engine\r\n index = this._engine.scenes.indexOf(this);\r\n if (index > -1) {\r\n this._engine.scenes.splice(index, 1);\r\n }\r\n this._engine.wipeCaches(true);\r\n this._isDisposed = true;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isDisposed\", {\r\n /**\r\n * Gets if the scene is already disposed\r\n */\r\n get: function () {\r\n return this._isDisposed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Call this function to reduce memory footprint of the scene.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n Scene.prototype.clearCachedVertexData = function () {\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n var geometry = mesh.geometry;\r\n if (geometry) {\r\n geometry._indices = [];\r\n for (var vbName in geometry._vertexBuffers) {\r\n if (!geometry._vertexBuffers.hasOwnProperty(vbName)) {\r\n continue;\r\n }\r\n geometry._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * This function will remove the local cached buffer data from texture.\r\n * It will save memory but will prevent the texture from being rebuilt\r\n */\r\n Scene.prototype.cleanCachedTextureBuffer = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var baseTexture = _a[_i];\r\n var buffer = baseTexture._buffer;\r\n if (buffer) {\r\n baseTexture._buffer = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Get the world extend vectors with an optional filter\r\n *\r\n * @param filterPredicate the predicate - which meshes should be included when calculating the world size\r\n * @returns {{ min: Vector3; max: Vector3 }} min and max vectors\r\n */\r\n Scene.prototype.getWorldExtends = function (filterPredicate) {\r\n var min = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"](Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"](-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n filterPredicate = filterPredicate || (function () { return true; });\r\n this.meshes.filter(filterPredicate).forEach(function (mesh) {\r\n mesh.computeWorldMatrix(true);\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {\r\n return;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var minBox = boundingInfo.boundingBox.minimumWorld;\r\n var maxBox = boundingInfo.boundingBox.maximumWorld;\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].CheckExtends(minBox, min, max);\r\n _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__[\"Vector3\"].CheckExtends(maxBox, min, max);\r\n });\r\n return {\r\n min: min,\r\n max: max\r\n };\r\n };\r\n // Picking\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param camera defines the camera to use for the picking\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /** Launch a ray to try to pick a mesh in the scene\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null.\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n // Dummy info if picking as not been imported\r\n var pi = new _Collisions_pickingInfo__WEBPACK_IMPORTED_MODULE_15__[\"PickingInfo\"]();\r\n pi._pickingUnavailable = true;\r\n return pi;\r\n };\r\n /** Use the given ray to pick a mesh in the scene\r\n * @param ray The ray to use to pick meshes\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true\r\n * @param fastCheck Launch a fast check only using the bounding boxes. Can be set to null\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param x X position on screen\r\n * @param y Y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param ray Ray to use\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n throw _Misc_devTools__WEBPACK_IMPORTED_MODULE_24__[\"_DevTools\"].WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n */\r\n Scene.prototype.setPointerOverMesh = function (mesh) {\r\n this._inputManager.setPointerOverMesh(mesh);\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n Scene.prototype.getPointerOverMesh = function () {\r\n return this._inputManager.getPointerOverMesh();\r\n };\r\n // Misc.\r\n /** @hidden */\r\n Scene.prototype._rebuildGeometries = function () {\r\n for (var _i = 0, _a = this.geometries; _i < _a.length; _i++) {\r\n var geometry = _a[_i];\r\n geometry._rebuild();\r\n }\r\n for (var _b = 0, _c = this.meshes; _b < _c.length; _b++) {\r\n var mesh = _c[_b];\r\n mesh._rebuild();\r\n }\r\n if (this.postProcessManager) {\r\n this.postProcessManager._rebuild();\r\n }\r\n for (var _d = 0, _e = this._components; _d < _e.length; _d++) {\r\n var component = _e[_d];\r\n component.rebuild();\r\n }\r\n for (var _f = 0, _g = this.particleSystems; _f < _g.length; _f++) {\r\n var system = _g[_f];\r\n system.rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._rebuildTextures = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var texture = _a[_i];\r\n texture._rebuild();\r\n }\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_TextureDirtyFlag);\r\n };\r\n // Tags\r\n Scene.prototype._getByTags = function (list, tagsQuery, forEach) {\r\n if (tagsQuery === undefined) {\r\n // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)\r\n return list;\r\n }\r\n var listByTags = [];\r\n forEach = forEach || (function (item) { return; });\r\n for (var i in list) {\r\n var item = list[i];\r\n if (_Misc_tags__WEBPACK_IMPORTED_MODULE_6__[\"Tags\"] && _Misc_tags__WEBPACK_IMPORTED_MODULE_6__[\"Tags\"].MatchesQuery(item, tagsQuery)) {\r\n listByTags.push(item);\r\n forEach(item);\r\n }\r\n }\r\n return listByTags;\r\n };\r\n /**\r\n * Get a list of meshes by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Mesh\r\n */\r\n Scene.prototype.getMeshesByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.meshes, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of cameras by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Camera\r\n */\r\n Scene.prototype.getCamerasByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.cameras, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of lights by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Light\r\n */\r\n Scene.prototype.getLightsByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.lights, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of materials by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Material\r\n */\r\n Scene.prototype.getMaterialByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n Scene.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n Scene.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n Scene.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._renderingManager.getAutoClearDepthStencilSetup(index);\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockMaterialDirtyMechanism\", {\r\n /** Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync) */\r\n get: function () {\r\n return this._blockMaterialDirtyMechanism;\r\n },\r\n set: function (value) {\r\n if (this._blockMaterialDirtyMechanism === value) {\r\n return;\r\n }\r\n this._blockMaterialDirtyMechanism = value;\r\n if (!value) { // Do a complete update\r\n this.markAllMaterialsAsDirty(_Engines_constants__WEBPACK_IMPORTED_MODULE_20__[\"Constants\"].MATERIAL_AllDirtyFlag);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials as dirty to trigger new shader compilation\r\n * @param flag defines the flag used to specify which material part must be marked as dirty\r\n * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty\r\n */\r\n Scene.prototype.markAllMaterialsAsDirty = function (flag, predicate) {\r\n if (this._blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.materials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (predicate && !predicate(material)) {\r\n continue;\r\n }\r\n material.markAsDirty(flag);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFile = function (url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = _Misc_tools__WEBPACK_IMPORTED_MODULE_1__[\"Tools\"].LoadFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFileAsync = function (url, useOfflineSupport, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, useOfflineSupport, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /** The fog is deactivated */\r\n Scene.FOGMODE_NONE = 0;\r\n /** The fog density is following an exponential function */\r\n Scene.FOGMODE_EXP = 1;\r\n /** The fog density is following an exponential function faster than FOGMODE_EXP */\r\n Scene.FOGMODE_EXP2 = 2;\r\n /** The fog density is following a linear function. */\r\n Scene.FOGMODE_LINEAR = 3;\r\n /**\r\n * Gets or sets the minimum deltatime when deterministic lock step is enabled\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MinDeltaTime = 1.0;\r\n /**\r\n * Gets or sets the maximum deltatime when deterministic lock step is enabled\r\n * @see http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MaxDeltaTime = 1000.0;\r\n return Scene;\r\n}(_abstractScene__WEBPACK_IMPORTED_MODULE_11__[\"AbstractScene\"]));\r\n\r\n\n\n/***/ }),\n\n/***/ \"./sceneComponent.ts\":\n/*!***************************!*\\\n !*** ./sceneComponent.ts ***!\n \\***************************/\n/*! exports provided: SceneComponentConstants, Stage */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SceneComponentConstants\", function() { return SceneComponentConstants; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Stage\", function() { return Stage; });\n/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ \"../node_modules/tslib/tslib.es6.js\");\n\r\n/**\r\n * Groups all the scene component constants in one place to ease maintenance.\r\n * @hidden\r\n */\r\nvar SceneComponentConstants = /** @class */ (function () {\r\n function SceneComponentConstants() {\r\n }\r\n SceneComponentConstants.NAME_EFFECTLAYER = \"EffectLayer\";\r\n SceneComponentConstants.NAME_LAYER = \"Layer\";\r\n SceneComponentConstants.NAME_LENSFLARESYSTEM = \"LensFlareSystem\";\r\n SceneComponentConstants.NAME_BOUNDINGBOXRENDERER = \"BoundingBoxRenderer\";\r\n SceneComponentConstants.NAME_PARTICLESYSTEM = \"ParticleSystem\";\r\n SceneComponentConstants.NAME_GAMEPAD = \"Gamepad\";\r\n SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE = \"SimplificationQueue\";\r\n SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER = \"GeometryBufferRenderer\";\r\n SceneComponentConstants.NAME_DEPTHRENDERER = \"DepthRenderer\";\r\n SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER = \"PostProcessRenderPipelineManager\";\r\n SceneComponentConstants.NAME_SPRITE = \"Sprite\";\r\n SceneComponentConstants.NAME_OUTLINERENDERER = \"Outline\";\r\n SceneComponentConstants.NAME_PROCEDURALTEXTURE = \"ProceduralTexture\";\r\n SceneComponentConstants.NAME_SHADOWGENERATOR = \"ShadowGenerator\";\r\n SceneComponentConstants.NAME_OCTREE = \"Octree\";\r\n SceneComponentConstants.NAME_PHYSICSENGINE = \"PhysicsEngine\";\r\n SceneComponentConstants.NAME_AUDIO = \"Audio\";\r\n SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER = 1;\r\n SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_BEFORERENDERINGMESH_OUTLINE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGMESH_OUTLINE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1;\r\n SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 2;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 3;\r\n SceneComponentConstants.STEP_AFTERRENDER_AUDIO = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;\r\n SceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0;\r\n SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERUP_SPRITE = 0;\r\n return SceneComponentConstants;\r\n}());\r\n\r\n/**\r\n * Repressentation of a stage in the scene (Basically a list of ordered steps)\r\n * @hidden\r\n */\r\nvar Stage = /** @class */ (function (_super) {\r\n tslib__WEBPACK_IMPORTED_MODULE_0__[\"__extends\"](Stage, _super);\r\n /**\r\n * Hide ctor from the rest of the world.\r\n * @param items The items to add.\r\n */\r\n function Stage(items) {\r\n return _super.apply(this, items) || this;\r\n }\r\n /**\r\n * Creates a new Stage.\r\n * @returns A new instance of a Stage\r\n */\r\n Stage.Create = function () {\r\n return Object.create(Stage.prototype);\r\n };\r\n /**\r\n * Registers a step in an ordered way in the targeted stage.\r\n * @param index Defines the position to register the step in\r\n * @param component Defines the component attached to the step\r\n * @param action Defines the action to launch during the step\r\n */\r\n Stage.prototype.registerStep = function (index, component, action) {\r\n var i = 0;\r\n var maxIndex = Number.MAX_VALUE;\r\n for (; i < this.length; i++) {\r\n var step = this[i];\r\n maxIndex = step.index;\r\n if (index < maxIndex) {\r\n break;\r\n }\r\n }\r\n this.splice(i, 0, { index: index, component: component, action: action.bind(component) });\r\n };\r\n /**\r\n * Clears all the steps from the stage.\r\n */\r\n Stage.prototype.clear = function () {\r\n this.length = 0;\r\n };\r\n return Stage;\r\n}(Array));\r\n\r\n\n\n/***/ })\n\n/******/ });\n});\n//# sourceMappingURL=babylon.max.js.map\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"../node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack://BabylonViewer/../dist/preview_release/babylon.max.js?"); /***/ }), diff --git a/materialsLibrary/src/water/water.fragment.fx b/materialsLibrary/src/water/water.fragment.fx index 67b97c081a2..f54fe01aac0 100644 --- a/materialsLibrary/src/water/water.fragment.fx +++ b/materialsLibrary/src/water/water.fragment.fx @@ -246,7 +246,7 @@ vec4 color = vec4(finalDiffuse + finalSpecular, alpha); // We first move from gamma to linear. #ifdef IMAGEPROCESSINGPOSTPROCESS color.rgb = toLinearSpace(color.rgb); -#elif IMAGEPROCESSING +#elif defined(IMAGEPROCESSING) color.rgb = toLinearSpace(color.rgb); color = applyImageProcessing(color); #endif